diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/doc/tcc-doc.html b/.cache/overlay-toolchain/tcc_extract/tcc/doc/tcc-doc.html new file mode 100644 index 00000000..a15247ed --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/doc/tcc-doc.html @@ -0,0 +1,1744 @@ + + + + +Tiny C Compiler Reference Documentation + + + + + + + + + + + + + + + + + +

Tiny C Compiler Reference Documentation

+ + + + +

Table of Contents

+ +
+ + +
+ + + +
+

+Next: , Previous: , Up: (dir)   [Contents][Index]

+
+ +

Tiny C Compiler Reference Documentation

+ +

This manual documents version 0.9.27 of the Tiny C Compiler. +

+ + + + + + + + + + + + +
+ +
+

+Next: , Up: Top   [Contents][Index]

+
+ +

1 Introduction

+ +

TinyCC (aka TCC) is a small but hyper fast C compiler. Unlike other C +compilers, it is meant to be self-relying: you do not need an +external assembler or linker because TCC does that for you. +

+

TCC compiles so fast that even for big projects Makefiles may +not be necessary. +

+

TCC not only supports ANSI C, but also most of the new ISO C99 +standard and many GNUC extensions including inline assembly. +

+

TCC can also be used to make C scripts, i.e. pieces of C source +that you run as a Perl or Python script. Compilation is so fast that +your script will be as fast as if it was an executable. +

+

TCC can also automatically generate memory and bound checks +(see Bounds) while allowing all C pointers operations. TCC can do +these checks even if non patched libraries are used. +

+

With libtcc, you can use TCC as a backend for dynamic code +generation (see Libtcc). +

+

TCC mainly supports the i386 target on Linux and Windows. There are alpha +ports for the ARM (arm-tcc) and the TMS320C67xx targets +(c67-tcc). More information about the ARM port is available at +http://lists.gnu.org/archive/html/tinycc-devel/2003-10/msg00044.html. +

+

For usage on Windows, see also tcc-win32.txt. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

2 Command line invocation

+ + +

2.1 Quick start

+ +
+
usage: tcc [options] [infile1 infile2…] [-run infile args…]
+
+ +

TCC options are a very much like gcc options. The main difference is that TCC +can also execute directly the resulting program and give it runtime +arguments. +

+

Here are some examples to understand the logic: +

+
+
‘tcc -run a.c’
+

Compile a.c and execute it directly +

+
+
‘tcc -run a.c arg1’
+

Compile a.c and execute it directly. arg1 is given as first argument to +the main() of a.c. +

+
+
‘tcc a.c -run b.c arg1’
+

Compile a.c and b.c, link them together and execute them. arg1 is given +as first argument to the main() of the resulting program. +

+
+
‘tcc -o myprog a.c b.c’
+

Compile a.c and b.c, link them and generate the executable myprog. +

+
+
‘tcc -o myprog a.o b.o’
+

link a.o and b.o together and generate the executable myprog. +

+
+
‘tcc -c a.c’
+

Compile a.c and generate object file a.o. +

+
+
‘tcc -c asmfile.S’
+

Preprocess with C preprocess and assemble asmfile.S and generate +object file asmfile.o. +

+
+
‘tcc -c asmfile.s’
+

Assemble (but not preprocess) asmfile.s and generate object file +asmfile.o. +

+
+
‘tcc -r -o ab.o a.c b.c’
+

Compile a.c and b.c, link them together and generate the object file ab.o. +

+
+
+ +

Scripting: +

+

TCC can be invoked from scripts, just as shell scripts. You just +need to add #!/usr/local/bin/tcc -run at the start of your C source: +

+
+
#!/usr/local/bin/tcc -run
+#include <stdio.h>
+
+int main() 
+{
+    printf("Hello World\n");
+    return 0;
+}
+
+ +

TCC can read C source code from standard input when - is used in +place of infile. Example: +

+
+
echo 'main(){puts("hello");}' | tcc -run -
+
+ + +

2.2 Option summary

+ +

General Options: +

+
+
-c
+

Generate an object file. +

+
+
-o outfile
+

Put object file, executable, or dll into output file outfile. +

+
+
-run source [args...]
+

Compile file source and run it with the command line arguments +args. In order to be able to give more than one argument to a +script, several TCC options can be given after the +-run option, separated by spaces: +

+
tcc "-run -L/usr/X11R6/lib -lX11" ex4.c
+
+

In a script, it gives the following header: +

+
#!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11
+
+ +
+
-v
+

Display TCC version. +

+
+
-vv
+

Show included files. As sole argument, print search dirs. -vvv shows tries too. +

+
+
-bench
+

Display compilation statistics. +

+
+
+ +

Preprocessor options: +

+
+
-Idir
+

Specify an additional include path. Include paths are searched in the +order they are specified. +

+

System include paths are always searched after. The default system +include paths are: /usr/local/include, /usr/include +and PREFIX/lib/tcc/include. (PREFIX is usually +/usr or /usr/local). +

+
+
-Dsym[=val]
+

Define preprocessor symbol ‘sym’ to +val. If val is not present, its value is ‘1’. Function-like macros can +also be defined: -DF(a)=a+1 +

+
+
-Usym
+

Undefine preprocessor symbol ‘sym’. +

+
+
-E
+

Preprocess only, to stdout or file (with -o). +

+
+
+ +

Compilation flags: +

+

Note: each of the following options has a negative form beginning with +-fno-. +

+
+
-funsigned-char
+

Let the char type be unsigned. +

+
+
-fsigned-char
+

Let the char type be signed. +

+
+
-fno-common
+

Do not generate common symbols for uninitialized data. +

+
+
-fleading-underscore
+

Add a leading underscore at the beginning of each C symbol. +

+
+
-fms-extensions
+

Allow a MS C compiler extensions to the language. Currently this +assumes a nested named structure declaration without an identifier +behaves like an unnamed one. +

+
+
-fdollars-in-identifiers
+

Allow dollar signs in identifiers +

+
+
+ +

Warning options: +

+
+
-w
+

Disable all warnings. +

+
+
+ +

Note: each of the following warning options has a negative form beginning with +-Wno-. +

+
+
-Wimplicit-function-declaration
+

Warn about implicit function declaration. +

+
+
-Wunsupported
+

Warn about unsupported GCC features that are ignored by TCC. +

+
+
-Wwrite-strings
+

Make string constants be of type const char * instead of char +*. +

+
+
-Werror
+

Abort compilation if warnings are issued. +

+
+
-Wall
+

Activate all warnings, except -Werror, -Wunusupported and +-Wwrite-strings. +

+
+
+ +

Linker options: +

+
+
-Ldir
+

Specify an additional static library path for the -l option. The +default library paths are /usr/local/lib, /usr/lib and /lib. +

+
+
-lxxx
+

Link your program with dynamic library libxxx.so or static library +libxxx.a. The library is searched in the paths specified by the +-L option and LIBRARY_PATH variable. +

+
+
-Bdir
+

Set the path where the tcc internal libraries (and include files) can be +found (default is PREFIX/lib/tcc). +

+
+
-shared
+

Generate a shared library instead of an executable. +

+
+
-soname name
+

set name for shared library to be used at runtime +

+
+
-static
+

Generate a statically linked executable (default is a shared linked +executable). +

+
+
-rdynamic
+

Export global symbols to the dynamic linker. It is useful when a library +opened with dlopen() needs to access executable symbols. +

+
+
-r
+

Generate an object file combining all input files. +

+
+
-Wl,-rpath=path
+

Put custom search path for dynamic libraries into executable. +

+
+
-Wl,--enable-new-dtags
+

When putting a custom search path for dynamic libraries into the executable, +create the new ELF dynamic tag DT_RUNPATH instead of the old legacy DT_RPATH. +

+
+
-Wl,--oformat=fmt
+

Use fmt as output format. The supported output formats are: +

+
elf32-i386
+

ELF output format (default) +

+
binary
+

Binary image (only for executable output) +

+
coff
+

COFF output format (only for executable output for TMS320C67xx target) +

+
+ +
+
-Wl,-subsystem=console/gui/wince/...
+

Set type for PE (Windows) executables. +

+
+
-Wl,-[Ttext=# | section-alignment=# | file-alignment=# | image-base=# | stack=#]
+

Modify executable layout. +

+
+
-Wl,-Bsymbolic
+

Set DT_SYMBOLIC tag. +

+
+
-Wl,-(no-)whole-archive
+

Turn on/off linking of all objects in archives. +

+
+
+ +

Debugger options: +

+
+
-g
+

Generate run time debug information so that you get clear run time +error messages: test.c:68: in function 'test5()': dereferencing +invalid pointer instead of the laconic Segmentation +fault. +

+
+
-b
+

Generate additional support code to check +memory allocations and array/pointer bounds. -g is implied. Note +that the generated code is slower and bigger in this case. +

+

Note: -b is only available on i386 when using libtcc for the moment. +

+
+
-bt N
+

Display N callers in stack traces. This is useful with -g or +-b. +

+
+
+ +

Misc options: +

+
+
-MD
+

Generate makefile fragment with dependencies. +

+
+
-MF depfile
+

Use depfile as output for -MD. +

+
+
-print-search-dirs
+

Print the configured installation directory and a list of library +and include directories tcc will search. +

+
+
-dumpversion
+

Print version. +

+
+
+ +

Target specific options: +

+
+
-mms-bitfields
+

Use an algorithm for bitfield alignment consistent with MSVC. Default is +gcc’s algorithm. +

+
+
-mfloat-abi (ARM only)
+

Select the float ABI. Possible values: softfp and hard +

+
+
-mno-sse
+

Do not use sse registers on x86_64 +

+
+
-m32, -m64
+

Pass command line to the i386/x86_64 cross compiler. +

+
+
+ +

Note: GCC options -Ox, -fx and -mx are +ignored. +

+

Environment variables that affect how tcc operates. +

+
+
CPATH
+
C_INCLUDE_PATH
+

A colon-separated list of directories searched for include files, +directories given with -I are searched first. +

+
+
LIBRARY_PATH
+

A colon-separated list of directories searched for libraries for the +-l option, directories given with -L are searched first. +

+
+
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

3 C language support

+ + +

3.1 ANSI C

+ +

TCC implements all the ANSI C standard, including structure bit fields +and floating point numbers (long double, double, and +float fully supported). +

+ +

3.2 ISOC99 extensions

+ +

TCC implements many features of the new C standard: ISO C99. Currently +missing items are: complex and imaginary numbers. +

+

Currently implemented ISOC99 features: +

+ + + +

3.3 GNU C extensions

+ +

TCC implements some GNU C extensions: +

+ + + +

3.4 TinyCC extensions

+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

4 TinyCC Assembler

+ +

Since version 0.9.16, TinyCC integrates its own assembler. TinyCC +assembler supports a gas-like syntax (GNU assembler). You can +deactivate assembler support if you want a smaller TinyCC executable +(the C compiler does not rely on the assembler). +

+

TinyCC Assembler is used to handle files with .S (C +preprocessed assembler) and .s extensions. It is also used to +handle the GNU inline assembler with the asm keyword. +

+ +

4.1 Syntax

+ +

TinyCC Assembler supports most of the gas syntax. The tokens are the +same as C. +

+ + + +

4.2 Expressions

+ + + + +

4.3 Labels

+ + + + +

4.4 Directives

+ + + + + + + + + + + + + + + + + + + + + + + + +

All directives are preceded by a ’.’. The following directives are +supported: +

+ + + +

4.5 X86 Assembler

+ + +

All X86 opcodes are supported. Only ATT syntax is supported (source +then destination operand order). If no size suffix is given, TinyCC +tries to guess it from the operand sizes. +

+

Currently, MMX opcodes are supported but not SSE ones. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

5 TinyCC Linker

+ + + +

5.1 ELF file generation

+ + +

TCC can directly output relocatable ELF files (object files), +executable ELF files and dynamic ELF libraries without relying on an +external linker. +

+

Dynamic ELF libraries can be output but the C compiler does not generate +position independent code (PIC). It means that the dynamic library +code generated by TCC cannot be factorized among processes yet. +

+

TCC linker eliminates unreferenced object code in libraries. A single pass is +done on the object and library list, so the order in which object files and +libraries are specified is important (same constraint as GNU ld). No grouping +options (--start-group and --end-group) are supported. +

+ +

5.2 ELF file loader

+ +

TCC can load ELF object files, archives (.a files) and dynamic +libraries (.so). +

+ +

5.3 PE-i386 file generation

+ + +

TCC for Windows supports the native Win32 executable file format (PE-i386). It +generates EXE files (console and gui) and DLL files. +

+

For usage on Windows, see also tcc-win32.txt. +

+ +

5.4 GNU Linker Scripts

+ + + + + + + +

Because on many Linux systems some dynamic libraries (such as +/usr/lib/libc.so) are in fact GNU ld link scripts (horrible!), +the TCC linker also supports a subset of GNU ld scripts. +

+

The GROUP and FILE commands are supported. OUTPUT_FORMAT +and TARGET are ignored. +

+

Example from /usr/lib/libc.so: +

+
/* GNU ld script
+   Use the shared library, but some functions are only in
+   the static library, so try that secondarily.  */
+GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
+
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

6 TinyCC Memory and Bound checks

+ + + +

This feature is activated with the -b (see Invoke). +

+

Note that pointer size is unchanged and that code generated +with bound checks is fully compatible with unchecked +code. When a pointer comes from unchecked code, it is assumed to be +valid. Even very obscure C code with casts should work correctly. +

+

For more information about the ideas behind this method, see +http://www.doc.ic.ac.uk/~phjk/BoundsChecking.html. +

+

Here are some examples of caught errors: +

+
+
Invalid range with standard string function:
+
+
{
+    char tab[10];
+    memset(tab, 0, 11);
+}
+
+ +
+
Out of bounds-error in global or local arrays:
+
+
{
+    int tab[10];
+    for(i=0;i<11;i++) {
+        sum += tab[i];
+    }
+}
+
+ +
+
Out of bounds-error in malloc’ed data:
+
+
{
+    int *tab;
+    tab = malloc(20 * sizeof(int));
+    for(i=0;i<21;i++) {
+        sum += tab4[i];
+    }
+    free(tab);
+}
+
+ +
+
Access of freed memory:
+
+
{
+    int *tab;
+    tab = malloc(20 * sizeof(int));
+    free(tab);
+    for(i=0;i<20;i++) {
+        sum += tab4[i];
+    }
+}
+
+ +
+
Double free:
+
+
{
+    int *tab;
+    tab = malloc(20 * sizeof(int));
+    free(tab);
+    free(tab);
+}
+
+ +
+
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

7 The libtcc library

+ +

The libtcc library enables you to use TCC as a backend for +dynamic code generation. +

+

Read the libtcc.h to have an overview of the API. Read +libtcc_test.c to have a very simple example. +

+

The idea consists in giving a C string containing the program you want +to compile directly to libtcc. Then you can access to any global +symbol (function or variable) defined. +

+
+ +
+

+Previous: , Up: Top   [Contents][Index]

+
+ +

8 Developer’s guide

+ +

This chapter gives some hints to understand how TCC works. You can skip +it if you do not intend to modify the TCC code. +

+ +

8.1 File reading

+ +

The BufferedFile structure contains the context needed to read a +file, including the current line number. tcc_open() opens a new +file and tcc_close() closes it. inp() returns the next +character. +

+ +

8.2 Lexer

+ +

next() reads the next token in the current +file. next_nomacro() reads the next token without macro +expansion. +

+

tok contains the current token (see TOK_xxx) +constants. Identifiers and keywords are also keywords. tokc +contains additional infos about the token (for example a constant value +if number or string token). +

+ +

8.3 Parser

+ +

The parser is hardcoded (yacc is not necessary). It does only one pass, +except: +

+ + + +

8.4 Types

+ +

The types are stored in a single ’int’ variable. It was chosen in the +first stages of development when tcc was much simpler. Now, it may not +be the best solution. +

+
+
#define VT_INT        0  /* integer type */
+#define VT_BYTE       1  /* signed byte type */
+#define VT_SHORT      2  /* short type */
+#define VT_VOID       3  /* void type */
+#define VT_PTR        4  /* pointer */
+#define VT_ENUM       5  /* enum definition */
+#define VT_FUNC       6  /* function type */
+#define VT_STRUCT     7  /* struct/union definition */
+#define VT_FLOAT      8  /* IEEE float */
+#define VT_DOUBLE     9  /* IEEE double */
+#define VT_LDOUBLE   10  /* IEEE long double */
+#define VT_BOOL      11  /* ISOC99 boolean type */
+#define VT_LLONG     12  /* 64 bit integer */
+#define VT_LONG      13  /* long integer (NEVER USED as type, only
+                            during parsing) */
+#define VT_BTYPE      0x000f /* mask for basic type */
+#define VT_UNSIGNED   0x0010  /* unsigned type */
+#define VT_ARRAY      0x0020  /* array type (also has VT_PTR) */
+#define VT_VLA        0x20000 /* VLA type (also has VT_PTR and VT_ARRAY) */
+#define VT_BITFIELD   0x0040  /* bitfield modifier */
+#define VT_CONSTANT   0x0800  /* const modifier */
+#define VT_VOLATILE   0x1000  /* volatile modifier */
+#define VT_DEFSIGN    0x2000  /* signed type */
+
+#define VT_STRUCT_SHIFT 18   /* structure/enum name shift (14 bits left) */
+
+ +

When a reference to another type is needed (for pointers, functions and +structures), the 32 - VT_STRUCT_SHIFT high order bits are used to +store an identifier reference. +

+

The VT_UNSIGNED flag can be set for chars, shorts, ints and long +longs. +

+

Arrays are considered as pointers VT_PTR with the flag +VT_ARRAY set. Variable length arrays are considered as special +arrays and have flag VT_VLA set instead of VT_ARRAY. +

+

The VT_BITFIELD flag can be set for chars, shorts, ints and long +longs. If it is set, then the bitfield position is stored from bits +VT_STRUCT_SHIFT to VT_STRUCT_SHIFT + 5 and the bit field size is stored +from bits VT_STRUCT_SHIFT + 6 to VT_STRUCT_SHIFT + 11. +

+

VT_LONG is never used except during parsing. +

+

During parsing, the storage of an object is also stored in the type +integer: +

+
+
#define VT_EXTERN  0x00000080  /* extern definition */
+#define VT_STATIC  0x00000100  /* static variable */
+#define VT_TYPEDEF 0x00000200  /* typedef definition */
+#define VT_INLINE  0x00000400  /* inline definition */
+#define VT_IMPORT  0x00004000  /* win32: extern data imported from dll */
+#define VT_EXPORT  0x00008000  /* win32: data exported from dll */
+#define VT_WEAK    0x00010000  /* win32: data exported from dll */
+
+ + +

8.5 Symbols

+ +

All symbols are stored in hashed symbol stacks. Each symbol stack +contains Sym structures. +

+

Sym.v contains the symbol name (remember +an identifier is also a token, so a string is never necessary to store +it). Sym.t gives the type of the symbol. Sym.r is usually +the register in which the corresponding variable is stored. Sym.c is +usually a constant associated to the symbol like its address for normal +symbols, and the number of entries for symbols representing arrays. +Variable length array types use Sym.c as a location on the stack +which holds the runtime sizeof for the type. +

+

Four main symbol stacks are defined: +

+
+
define_stack
+

for the macros (#defines). +

+
+
global_stack
+

for the global variables, functions and types. +

+
+
local_stack
+

for the local variables, functions and types. +

+
+
global_label_stack
+

for the local labels (for goto). +

+
+
label_stack
+

for GCC block local labels (see the __label__ keyword). +

+
+
+ +

sym_push() is used to add a new symbol in the local symbol +stack. If no local symbol stack is active, it is added in the global +symbol stack. +

+

sym_pop(st,b) pops symbols from the symbol stack st until +the symbol b is on the top of stack. If b is NULL, the stack +is emptied. +

+

sym_find(v) return the symbol associated to the identifier +v. The local stack is searched first from top to bottom, then the +global stack. +

+ +

8.6 Sections

+ +

The generated code and data are written in sections. The structure +Section contains all the necessary information for a given +section. new_section() creates a new section. ELF file semantics +is assumed for each section. +

+

The following sections are predefined: +

+
+
text_section
+

is the section containing the generated code. ind contains the +current position in the code section. +

+
+
data_section
+

contains initialized data +

+
+
bss_section
+

contains uninitialized data +

+
+
bounds_section
+
lbounds_section
+

are used when bound checking is activated +

+
+
stab_section
+
stabstr_section
+

are used when debugging is active to store debug information +

+
+
symtab_section
+
strtab_section
+

contain the exported symbols (currently only used for debugging). +

+
+
+ + +

8.7 Code generation

+ + + +

8.7.1 Introduction

+ +

The TCC code generator directly generates linked binary code in one +pass. It is rather unusual these days (see gcc for example which +generates text assembly), but it can be very fast and surprisingly +little complicated. +

+

The TCC code generator is register based. Optimization is only done at +the expression level. No intermediate representation of expression is +kept except the current values stored in the value stack. +

+

On x86, three temporary registers are used. When more registers are +needed, one register is spilled into a new temporary variable on the stack. +

+ +

8.7.2 The value stack

+ + +

When an expression is parsed, its value is pushed on the value stack +(vstack). The top of the value stack is vtop. Each value +stack entry is the structure SValue. +

+

SValue.t is the type. SValue.r indicates how the value is +currently stored in the generated code. It is usually a CPU register +index (REG_xxx constants), but additional values and flags are +defined: +

+
+
#define VT_CONST     0x00f0
+#define VT_LLOCAL    0x00f1
+#define VT_LOCAL     0x00f2
+#define VT_CMP       0x00f3
+#define VT_JMP       0x00f4
+#define VT_JMPI      0x00f5
+#define VT_LVAL      0x0100
+#define VT_SYM       0x0200
+#define VT_MUSTCAST  0x0400
+#define VT_MUSTBOUND 0x0800
+#define VT_BOUNDED   0x8000
+#define VT_LVAL_BYTE     0x1000
+#define VT_LVAL_SHORT    0x2000
+#define VT_LVAL_UNSIGNED 0x4000
+#define VT_LVAL_TYPE     (VT_LVAL_BYTE | VT_LVAL_SHORT | VT_LVAL_UNSIGNED)
+
+ +
+
VT_CONST
+

indicates that the value is a constant. It is stored in the union +SValue.c, depending on its type. +

+
+
VT_LOCAL
+

indicates a local variable pointer at offset SValue.c.i in the +stack. +

+
+
VT_CMP
+

indicates that the value is actually stored in the CPU flags (i.e. the +value is the consequence of a test). The value is either 0 or 1. The +actual CPU flags used is indicated in SValue.c.i. +

+

If any code is generated which destroys the CPU flags, this value MUST be +put in a normal register. +

+
+
VT_JMP
+
VT_JMPI
+

indicates that the value is the consequence of a conditional jump. For VT_JMP, +it is 1 if the jump is taken, 0 otherwise. For VT_JMPI it is inverted. +

+

These values are used to compile the || and && logical +operators. +

+

If any code is generated, this value MUST be put in a normal +register. Otherwise, the generated code won’t be executed if the jump is +taken. +

+
+
VT_LVAL
+

is a flag indicating that the value is actually an lvalue (left value of +an assignment). It means that the value stored is actually a pointer to +the wanted value. +

+

Understanding the use VT_LVAL is very important if you want to +understand how TCC works. +

+
+
VT_LVAL_BYTE
+
VT_LVAL_SHORT
+
VT_LVAL_UNSIGNED
+

if the lvalue has an integer type, then these flags give its real +type. The type alone is not enough in case of cast optimisations. +

+
+
VT_LLOCAL
+

is a saved lvalue on the stack. VT_LVAL must also be set with +VT_LLOCAL. VT_LLOCAL can arise when a VT_LVAL in +a register has to be saved to the stack, or it can come from an +architecture-specific calling convention. +

+
+
VT_MUSTCAST
+

indicates that a cast to the value type must be performed if the value +is used (lazy casting). +

+
+
VT_SYM
+

indicates that the symbol SValue.sym must be added to the constant. +

+
+
VT_MUSTBOUND
+
VT_BOUNDED
+

are only used for optional bound checking. +

+
+
+ + +

8.7.3 Manipulating the value stack

+ + +

vsetc() and vset() pushes a new value on the value +stack. If the previous vtop was stored in a very unsafe place(for +example in the CPU flags), then some code is generated to put the +previous vtop in a safe storage. +

+

vpop() pops vtop. In some cases, it also generates cleanup +code (for example if stacked floating point registers are used as on +x86). +

+

The gv(rc) function generates code to evaluate vtop (the +top value of the stack) into registers. rc selects in which +register class the value should be put. gv() is the most +important function of the code generator. +

+

gv2() is the same as gv() but for the top two stack +entries. +

+ +

8.7.4 CPU dependent code generation

+ +

See the i386-gen.c file to have an example. +

+
+
load()
+

must generate the code needed to load a stack value into a register. +

+
+
store()
+

must generate the code needed to store a register into a stack value +lvalue. +

+
+
gfunc_start()
+
gfunc_param()
+
gfunc_call()
+

should generate a function call +

+
+
gfunc_prolog()
+
gfunc_epilog()
+

should generate a function prolog/epilog. +

+
+
gen_opi(op)
+

must generate the binary integer operation op on the two top +entries of the stack which are guaranteed to contain integer types. +

+

The result value should be put on the stack. +

+
+
gen_opf(op)
+

same as gen_opi() for floating point operations. The two top +entries of the stack are guaranteed to contain floating point values of +same types. +

+
+
gen_cvt_itof()
+

integer to floating point conversion. +

+
+
gen_cvt_ftoi()
+

floating point to integer conversion. +

+
+
gen_cvt_ftof()
+

floating point to floating point of different size conversion. +

+
+
gen_bounded_ptr_add()
+
gen_bounded_ptr_deref()
+

are only used for bounds checking. +

+
+
+ + +

8.8 Optimizations done

+ + + + + + + +

Constant propagation is done for all operations. Multiplications and +divisions are optimized to shifts when appropriate. Comparison +operators are optimized by maintaining a special cache for the +processor flags. &&, || and ! are optimized by maintaining a special +’jump target’ value. No other jump optimization is currently performed +because it would require to store the code in a more abstract fashion. +

+ +

Concept Index

+
Jump to:   _ +   +
+A +   +B +   +C +   +D +   +E +   +F +   +G +   +I +   +J +   +L +   +M +   +O +   +P +   +Q +   +R +   +S +   +T +   +U +   +V +   +W +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

_
__asm__: Clang

A
align directive: asm
aligned attribute: Clang
ascii directive: asm
asciz directive: asm
assembler: asm
assembler directives: asm
assembly, inline: Clang

B
bound checks: Bounds
bss directive: asm
byte directive: asm

C
caching processor flags: devel
cdecl attribute: Clang
code generation: devel
comparison operators: devel
constant propagation: devel
CPU dependent: devel

D
data directive: asm
directives, assembler: asm
dllexport attribute: Clang

E
ELF: linker

F
FILE, linker command: linker
fill directive: asm
flags, caching: devel

G
gas: Clang
global directive: asm
globl directive: asm
GROUP, linker command: linker

I
inline assembly: Clang
int directive: asm

J
jump optimization: devel

L
linker: linker
linker scripts: linker
long directive: asm

M
memory checks: Bounds

O
optimizations: devel
org directive: asm
OUTPUT_FORMAT, linker command: linker

P
packed attribute: Clang
PE-i386: linker
previous directive: asm

Q
quad directive: asm

R
regparm attribute: Clang

S
scripts, linker: linker
section attribute: Clang
section directive: asm
short directive: asm
skip directive: asm
space directive: asm
stdcall attribute: Clang
strength reduction: devel
string directive: asm

T
TARGET, linker command: linker
text directive: asm

U
unused attribute: Clang

V
value stack: devel
value stack, introduction: devel

W
word directive: asm

+
Jump to:   _ +   +
+A +   +B +   +C +   +D +   +E +   +F +   +G +   +I +   +J +   +L +   +M +   +O +   +P +   +Q +   +R +   +S +   +T +   +U +   +V +   +W +   +
+ +
+ + + + + diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/doc/tcc-win32.txt b/.cache/overlay-toolchain/tcc_extract/tcc/doc/tcc-win32.txt new file mode 100644 index 00000000..ab730073 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/doc/tcc-win32.txt @@ -0,0 +1,168 @@ + + TinyCC + ====== + + This file contains specific information for usage of TinyCC + under MS-Windows. See tcc-doc.html to have all the features. + + + Installation from the binary ZIP package: + ----------------------------------------- + Unzip the package to a directory of your choice. + + + Set the system PATH: + -------------------- + To be able to invoke the compiler from everywhere on your computer by + just typing "tcc", please add the directory containing tcc.exe to your + system PATH. + + + Include and library search paths + -------------------------------- + On windows, the standard "include" and "lib" directories are searched + relatively from the location of the executables (tcc.exe, libtcc.dll). + + + Examples: + --------- + Open a console window (DOS box) and 'cd' to the examples directory. + + For the 'Fibonacci' example type: + + tcc fib.c + + For the 'Hello Windows' GUI example type: + + tcc hello_win.c + + For the 'Hello DLL' example type + + tcc -shared dll.c + tcc -impdef dll.dll (optional) + tcc hello_dll.c dll.def + + + Using libtcc as JIT compiler in your program + -------------------------------------------- + Check out the 'libtcc_test' example: + + - Running it from source: + tcc -I libtcc libtcc/libtcc.def -run examples/libtcc_test.c + + - Compiling with TCC: + tcc examples/libtcc_test.c -I libtcc libtcc/libtcc.def + + - Compiling with MinGW: + gcc examples/libtcc_test.c -I libtcc libtcc.dll -o libtcc_test.exe + + - Compiling with MSVC: + lib /def:libtcc\libtcc.def /out:libtcc.lib + cl /MD examples/libtcc_test.c -I libtcc libtcc.lib + + + Import Definition Files: + ------------------------ + To link with Windows system DLLs, TCC uses import definition + files (.def) instead of libraries. + + The now built-in 'tiny_impdef' program may be used to make + additional .def files for any DLL. For example + + tcc -impdef [-v] opengl32.dll [-o opengl32.def] + + Put opengl32.def into the tcc/lib directory. Specify -lopengl32 at + the TCC commandline to link a program that uses opengl32.dll. + + + Header Files: + ------------- + The system header files (except _mingw.h) are from the MinGW + distribution: + + http://www.mingw.org/ + + From the windows headers, only a minimal set is included. If you need + more, get MinGW's "w32api" package. Extract the files from "include" + into your "tcc/include/winapi" directory. + + + Resource Files: + --------------- + TCC can link windows resources in coff format as generated by MinGW's + windres.exe. For example: + + windres -O coff app.rc -o appres.o + tcc app.c appres.o -o app.exe + + + Tiny Libmaker: + -------------- + The now built-in tiny_libmaker tool by Timovj Lahde can be used as + 'ar' replacement to make a library from several object files: + + tcc -ar [rcsv] library objectfiles ... + + + Compilation from source: + ------------------------ + * You can use the MinGW and MSYS tools available at + http://www.mingw.org + http://www.mingw-w64.org + http://www.msys2.org + + Untar the TCC archive and type in the MSYS shell: + ./configure [--prefix installpath] + make + make install + + The default install location is c:\Program Files\tcc + + Cygwin can be used too with its mingw cross-compiler installed: + ./configure --cross-prefix=i686-w64-mingw32- + (the prefix may vary) + + * Alternatively you can compile TCC with just GCC from MinGW using + > build-tcc.bat (from the win32 directory) + + Also MSVC can be used with the "VSTools Developer Command Prompt": + > build-tcc.bat -c cl + + or with an existing tcc (needs to be in a different directory) + > build-tcc.bat -c some-tcc-dir\tcc.exe + + Also you can copy/install everything into another directory: + > build-tcc.bat -i + + Limitations: + ------------ + - On the object file level, currently TCC supports only the ELF format, + not COFF as used by MinGW and MSVC. It is not possible to exchange + object files or libraries between TCC and these compilers. + + However libraries for TCC from objects by TCC can be made using + tcc -ar lib.a files.o ,,, + + - No leading underscore is generated in the ELF symbols. + + Documentation and License: + -------------------------- + TCC is distributed under the GNU Lesser General Public License. (See + COPYING file or http://www.gnu.org/licenses/lgpl-2.1.html) + + TinyCC homepage is at: + + http://fabrice.bellard.free.fr/tcc/ + + + WinAPI Help and 3rd-party tools: + -------------------------------- + The Windows API documentation (Win95) in a single .hlp file is + available on the lcc-win32 site as "win32hlp.exe" or from other + locations as "win32hlp_big.zip". + + A nice RAD tool to create windows resources (dialog boxes etc.) is + "ResEd", available at the RadASM website. + + + --- grischka diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/examples/dll.c b/.cache/overlay-toolchain/tcc_extract/tcc/examples/dll.c new file mode 100644 index 00000000..052a0564 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/examples/dll.c @@ -0,0 +1,13 @@ +//+--------------------------------------------------------------------------- +// +// dll.c - Windows DLL example - dynamically linked part +// + +#include + +__declspec(dllexport) const char *hello_data = "(not set)"; + +__declspec(dllexport) void hello_func (void) +{ + MessageBox (0, hello_data, "From DLL", MB_ICONINFORMATION); +} diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/examples/fib.c b/.cache/overlay-toolchain/tcc_extract/tcc/examples/fib.c new file mode 100644 index 00000000..8da26bce --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/examples/fib.c @@ -0,0 +1,24 @@ +#include +#include // atoi() + +int fib(n) +{ + if (n <= 2) + return 1; + else + return fib(n-1) + fib(n-2); +} + +int main(int argc, char **argv) +{ + int n; + if (argc < 2) { + printf("usage: fib n\n" + "Compute nth Fibonacci number\n"); + return 1; + } + + n = atoi(argv[1]); + printf("fib(%d) = %d\n", n, fib(n)); + return 0; +} diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/examples/hello_dll.c b/.cache/overlay-toolchain/tcc_extract/tcc/examples/hello_dll.c new file mode 100644 index 00000000..4813c5b9 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/examples/hello_dll.c @@ -0,0 +1,20 @@ +//+--------------------------------------------------------------------------- +// +// HELLO_DLL.C - Windows DLL example - main application part +// + +#include + +void hello_func (void); +__declspec(dllimport) extern const char *hello_data; + +int WINAPI WinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + hello_data = "Hello World!"; + hello_func(); + return 0; +} diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/examples/hello_win.c b/.cache/overlay-toolchain/tcc_extract/tcc/examples/hello_win.c new file mode 100644 index 00000000..96546e41 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/examples/hello_win.c @@ -0,0 +1,163 @@ +//+--------------------------------------------------------------------------- +// +// HELLO_WIN.C - Windows GUI 'Hello World!' Example +// +//+--------------------------------------------------------------------------- + +#include + +#define APPNAME "HELLO_WIN" + +char szAppName[] = APPNAME; // The name of this application +char szTitle[] = APPNAME; // The title bar text +const char *pWindowText; + +void CenterWindow(HWND hWnd); + +//+--------------------------------------------------------------------------- +// +// Function: WndProc +// +// Synopsis: very unusual type of function - gets called by system to +// process windows messages. +// +// Arguments: same as always. +//---------------------------------------------------------------------------- + +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) { + + // ----------------------- first and last + case WM_CREATE: + CenterWindow(hwnd); + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + + // ----------------------- get out of it... + case WM_RBUTTONUP: + DestroyWindow(hwnd); + break; + + case WM_KEYDOWN: + if (VK_ESCAPE == wParam) + DestroyWindow(hwnd); + break; + + // ----------------------- display our minimal info + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc; + RECT rc; + hdc = BeginPaint(hwnd, &ps); + + GetClientRect(hwnd, &rc); + SetTextColor(hdc, RGB(240,240,96)); + SetBkMode(hdc, TRANSPARENT); + DrawText(hdc, pWindowText, -1, &rc, DT_CENTER|DT_SINGLELINE|DT_VCENTER); + + EndPaint(hwnd, &ps); + break; + } + + // ----------------------- let windows do all other stuff + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + return 0; +} + +//+--------------------------------------------------------------------------- +// +// Function: WinMain +// +// Synopsis: standard entrypoint for GUI Win32 apps +// +//---------------------------------------------------------------------------- +int APIENTRY WinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow + ) +{ + MSG msg; + WNDCLASS wc; + HWND hwnd; + + pWindowText = lpCmdLine[0] ? lpCmdLine : "Hello Windows!"; + + // Fill in window class structure with parameters that describe + // the main window. + + ZeroMemory(&wc, sizeof wc); + wc.hInstance = hInstance; + wc.lpszClassName = szAppName; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW; + wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + + if (FALSE == RegisterClass(&wc)) + return 0; + + // create the browser + hwnd = CreateWindow( + szAppName, + szTitle, + WS_OVERLAPPEDWINDOW|WS_VISIBLE, + CW_USEDEFAULT, + CW_USEDEFAULT, + 360,//CW_USEDEFAULT, + 240,//CW_USEDEFAULT, + 0, + 0, + hInstance, + 0); + + if (NULL == hwnd) + return 0; + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0) > 0) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return msg.wParam; +} + +//+--------------------------------------------------------------------------- + +//+--------------------------------------------------------------------------- + +void CenterWindow(HWND hwnd_self) +{ + HWND hwnd_parent; + RECT rw_self, rc_parent, rw_parent; + int xpos, ypos; + + hwnd_parent = GetParent(hwnd_self); + if (NULL == hwnd_parent) + hwnd_parent = GetDesktopWindow(); + + GetWindowRect(hwnd_parent, &rw_parent); + GetClientRect(hwnd_parent, &rc_parent); + GetWindowRect(hwnd_self, &rw_self); + + xpos = rw_parent.left + (rc_parent.right + rw_self.left - rw_self.right) / 2; + ypos = rw_parent.top + (rc_parent.bottom + rw_self.top - rw_self.bottom) / 2; + + SetWindowPos( + hwnd_self, NULL, + xpos, ypos, 0, 0, + SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE + ); +} + +//+--------------------------------------------------------------------------- diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/examples/libtcc_test.c b/.cache/overlay-toolchain/tcc_extract/tcc/examples/libtcc_test.c new file mode 100644 index 00000000..480d3148 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/examples/libtcc_test.c @@ -0,0 +1,96 @@ +/* + * Simple Test program for libtcc + * + * libtcc can be useful to use tcc as a "backend" for a code generator. + */ +#include +#include +#include + +#include "libtcc.h" + +/* this function is called by the generated code */ +int add(int a, int b) +{ + return a + b; +} + +/* this strinc is referenced by the generated code */ +const char hello[] = "Hello World!"; + +char my_program[] = +"#include \n" /* include the "Simple libc header for TCC" */ +"extern int add(int a, int b);\n" +"#ifdef _WIN32\n" /* dynamically linked data needs 'dllimport' */ +" __attribute__((dllimport))\n" +"#endif\n" +"extern const char hello[];\n" +"int fib(int n)\n" +"{\n" +" if (n <= 2)\n" +" return 1;\n" +" else\n" +" return fib(n-1) + fib(n-2);\n" +"}\n" +"\n" +"int foo(int n)\n" +"{\n" +" printf(\"%s\\n\", hello);\n" +" printf(\"fib(%d) = %d\\n\", n, fib(n));\n" +" printf(\"add(%d, %d) = %d\\n\", n, 2 * n, add(n, 2 * n));\n" +" return 0;\n" +"}\n"; + +int main(int argc, char **argv) +{ + TCCState *s; + int i; + int (*func)(int); + + s = tcc_new(); + if (!s) { + fprintf(stderr, "Could not create tcc state\n"); + exit(1); + } + + /* if tcclib.h and libtcc1.a are not installed, where can we find them */ + for (i = 1; i < argc; ++i) { + char *a = argv[i]; + if (a[0] == '-') { + if (a[1] == 'B') + tcc_set_lib_path(s, a+2); + else if (a[1] == 'I') + tcc_add_include_path(s, a+2); + else if (a[1] == 'L') + tcc_add_library_path(s, a+2); + } + } + + /* MUST BE CALLED before any compilation */ + tcc_set_output_type(s, TCC_OUTPUT_MEMORY); + + if (tcc_compile_string(s, my_program) == -1) + return 1; + + /* as a test, we add symbols that the compiled program can use. + You may also open a dll with tcc_add_dll() and use symbols from that */ + tcc_add_symbol(s, "add", add); + tcc_add_symbol(s, "hello", hello); + + /* relocate the code */ + if (tcc_relocate(s, TCC_RELOCATE_AUTO) < 0) + return 1; + + /* get entry symbol */ + func = tcc_get_symbol(s, "foo"); + if (!func) + return 1; + + /* run the code */ + func(32); + + /* delete the state */ + tcc_delete(s); + + return 0; +} diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/i386-win32-tcc.exe b/.cache/overlay-toolchain/tcc_extract/tcc/i386-win32-tcc.exe new file mode 100644 index 00000000..9f985670 Binary files /dev/null and b/.cache/overlay-toolchain/tcc_extract/tcc/i386-win32-tcc.exe differ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/_mingw.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/_mingw.h new file mode 100644 index 00000000..2fc97987 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/_mingw.h @@ -0,0 +1,170 @@ +/* + * _mingw.h + * + * This file is for TinyCC and not part of the Mingw32 package. + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +#ifndef __MINGW_H +#define __MINGW_H + +/* some winapi files define these before including _mingw.h --> */ +#undef __cdecl +#undef _X86_ +#undef WIN32 +/* <-- */ + +#include +#include + +#define __int8 char +#define __int16 short +#define __int32 int +#define __int64 long long +#define _HAVE_INT64 + +#define __cdecl +#define __declspec(x) __attribute__((x)) +#define __unaligned __attribute__((packed)) +#define __fastcall __attribute__((fastcall)) + +#define __MSVCRT__ 1 +#undef _MSVCRT_ +#define __MINGW_IMPORT extern __declspec(dllimport) +#define __MINGW_ATTRIB_NORETURN +#define __MINGW_ATTRIB_CONST +#define __MINGW_ATTRIB_DEPRECATED +#define __MINGW_ATTRIB_MALLOC +#define __MINGW_ATTRIB_PURE +#define __MINGW_ATTRIB_NONNULL(arg) +#define __MINGW_NOTHROW +#define __GNUC_VA_LIST + +#define _CRTIMP extern +#define __CRT_INLINE extern __inline__ + +#define _CRT_ALIGN(x) __attribute__((aligned(x))) +#define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) +#define _CRT_PACKING 8 +#define __CRT_UNALIGNED +#define _CONST_RETURN + +#ifndef _TRUNCATE +#define _TRUNCATE ((size_t)-1) +#endif + +#define __CRT_STRINGIZE(_Value) #_Value +#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value) +#define __CRT_WIDE(_String) L ## _String +#define _CRT_WIDE(_String) __CRT_WIDE(_String) + +#ifdef _WIN64 +#define __stdcall +#define _AMD64_ 1 +#define __x86_64 1 +#define _M_X64 100 /* Visual Studio */ +#define _M_AMD64 100 /* Visual Studio */ +#define USE_MINGW_SETJMP_TWO_ARGS +#define mingw_getsp tinyc_getbp +#define __TRY__ +#else +#define __stdcall __attribute__((__stdcall__)) +#define _X86_ 1 +#define _M_IX86 300 /* Visual Studio */ +#define WIN32 1 +#define _USE_32BIT_TIME_T +#ifdef __arm__ +#define __TRY__ +#else +#define __TRY__ void __try__(void**), *_sehrec[6]; __try__(_sehrec); +#endif +#endif + +/* in stddef.h */ +#define _SIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#define _PTRDIFF_T_DEFINED +#define _WCHAR_T_DEFINED +#define _UINTPTR_T_DEFINED +#define _INTPTR_T_DEFINED +#define _INTEGRAL_MAX_BITS 64 + +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED +typedef long __time32_t; +#endif + +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +typedef long long __time64_t; +#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T +typedef __time32_t time_t; +#else +typedef __time64_t time_t; +#endif +#endif + +#ifndef _WCTYPE_T_DEFINED +#define _WCTYPE_T_DEFINED +typedef wchar_t wctype_t; +#endif + +#ifndef _WINT_T +#define _WINT_T +typedef __WINT_TYPE__ wint_t; +#endif + +typedef int errno_t; +#define _ERRCODE_DEFINED + +typedef struct threadlocaleinfostruct *pthreadlocinfo; +typedef struct threadmbcinfostruct *pthreadmbcinfo; +typedef struct localeinfo_struct _locale_tstruct,*_locale_t; + +/* for winapi */ +#define _ANONYMOUS_UNION +#define _ANONYMOUS_STRUCT +#define DECLSPEC_NORETURN +#define DECLARE_STDCALL_P(type) __stdcall type +#define NOSERVICE 1 +#define NOMCX 1 +#define NOIME 1 +#define __INTRIN_H_ +#ifndef DUMMYUNIONNAME +# define DUMMYUNIONNAME +# define DUMMYUNIONNAME1 +# define DUMMYUNIONNAME2 +# define DUMMYUNIONNAME3 +# define DUMMYUNIONNAME4 +# define DUMMYUNIONNAME5 +#endif +#ifndef DUMMYSTRUCTNAME +# define DUMMYSTRUCTNAME +#endif +#ifndef WINVER +# define WINVER 0x0502 +#endif +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x502 +#endif + +#define __C89_NAMELESS +#define __MINGW_EXTENSION +#define WINAPI_FAMILY_PARTITION(X) 1 +#define MINGW_HAS_SECURE_API + +#endif /* __MINGW_H */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/assert.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/assert.h new file mode 100644 index 00000000..466d4571 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/assert.h @@ -0,0 +1,57 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef __ASSERT_H_ +#define __ASSERT_H_ + +#include <_mingw.h> +#ifdef __cplusplus +#include +#endif + +#ifdef NDEBUG +#ifndef assert +#define assert(_Expression) ((void)0) +#endif +#else + +#ifndef _CRT_TERMINATE_DEFINED +#define _CRT_TERMINATE_DEFINED + void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; + _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; +#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ +/* C99 function name */ +void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; +__CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) +{ _exit(status); } +#endif + +#pragma push_macro("abort") +#undef abort + void __cdecl __declspec(noreturn) abort(void); +#pragma pop_macro("abort") + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line); +extern void __cdecl _assert(const char *, const char *, unsigned); + +#ifdef __cplusplus +} +#endif + +#ifndef assert +//#define assert(_Expression) (void)((!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0)) +#define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__)) +#endif + +#endif + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/conio.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/conio.h new file mode 100644 index 00000000..39f779eb --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/conio.h @@ -0,0 +1,409 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_CONIO +#define _INC_CONIO + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP char *_cgets(char *_Buffer); + _CRTIMP int __cdecl _cprintf(const char *_Format,...); + _CRTIMP int __cdecl _cputs(const char *_Str); + _CRTIMP int __cdecl _cscanf(const char *_Format,...); + _CRTIMP int __cdecl _cscanf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _getch(void); + _CRTIMP int __cdecl _getche(void); + _CRTIMP int __cdecl _vcprintf(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_p(const char *_Format,...); + _CRTIMP int __cdecl _vcprintf_p(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_p_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _kbhit(void); + +#if defined(_X86_) && !defined(__x86_64) + int __cdecl _inp(unsigned short); + unsigned short __cdecl _inpw(unsigned short); + unsigned long __cdecl _inpd(unsigned short); + int __cdecl _outp(unsigned short,int); + unsigned short __cdecl _outpw(unsigned short,unsigned short); + unsigned long __cdecl _outpd(unsigned short,unsigned long); +#endif + + _CRTIMP int __cdecl _putch(int _Ch); + _CRTIMP int __cdecl _ungetch(int _Ch); + _CRTIMP int __cdecl _getch_nolock(void); + _CRTIMP int __cdecl _getche_nolock(void); + _CRTIMP int __cdecl _putch_nolock(int _Ch); + _CRTIMP int __cdecl _ungetch_nolock(int _Ch); + +#ifndef _WCONIO_DEFINED +#define _WCONIO_DEFINED + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + + _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _getwch(void); + _CRTIMP wint_t __cdecl _getwche(void); + _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh); + _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh); + _CRTIMP int __cdecl _cputws(const wchar_t *_String); + _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP wint_t __cdecl _putwch_nolock(wchar_t _WCh); + _CRTIMP wint_t __cdecl _getwch_nolock(void); + _CRTIMP wint_t __cdecl _getwche_nolock(void); + _CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh); +#endif + +#ifndef NO_OLDNAMES + char *__cdecl cgets(char *_Buffer); + int __cdecl cprintf(const char *_Format,...); + int __cdecl cputs(const char *_Str); + int __cdecl cscanf(const char *_Format,...); + int __cdecl getch(void); + int __cdecl getche(void); + int __cdecl kbhit(void); + int __cdecl putch(int _Ch); + int __cdecl ungetch(int _Ch); + +#if (defined(_X86_) && !defined(__x86_64)) + int __cdecl inp(unsigned short); + unsigned short __cdecl inpw(unsigned short); + int __cdecl outp(unsigned short,int); + unsigned short __cdecl outpw(unsigned short,unsigned short); +#endif + + /* I/O intrin functions. */ + __CRT_INLINE unsigned char __inbyte(unsigned short Port) + { + unsigned char value; + __asm__ __volatile__ ("inb %w1,%b0" + : "=a" (value) + : "Nd" (Port)); + return value; + } + __CRT_INLINE unsigned short __inword(unsigned short Port) + { + unsigned short value; + __asm__ __volatile__ ("inw %w1,%w0" + : "=a" (value) + : "Nd" (Port)); + return value; + } + __CRT_INLINE unsigned long __indword(unsigned short Port) + { + unsigned long value; + __asm__ __volatile__ ("inl %w1,%0" + : "=a" (value) + : "Nd" (Port)); + return value; + } + __CRT_INLINE void __outbyte(unsigned short Port,unsigned char Data) + { + __asm__ __volatile__ ("outb %b0,%w1" + : + : "a" (Data), "Nd" (Port)); + } + __CRT_INLINE void __outword(unsigned short Port,unsigned short Data) + { + __asm__ __volatile__ ("outw %w0,%w1" + : + : "a" (Data), "Nd" (Port)); + } + __CRT_INLINE void __outdword(unsigned short Port,unsigned long Data) + { + __asm__ __volatile__ ("outl %0,%w1" + : + : "a" (Data), "Nd" (Port)); + } + __CRT_INLINE void __inbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; insb " + : "=D" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + __CRT_INLINE void __inwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; insw " + : "=D" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + __CRT_INLINE void __indwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; insl " + : "=D" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + + __CRT_INLINE void __outbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; outsb " + : "=S" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + __CRT_INLINE void __outwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; outsw " + : "=S" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + __CRT_INLINE void __outdwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; outsl " + : "=S" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + + __CRT_INLINE unsigned __int64 __readcr0(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr0, %[value]" + : [value] "=q" (value)); + return value; + } + + /* Register sizes are different between 32/64 bit mode. So we have to do this for _WIN64 and _WIN32 + separately. */ + +#ifdef _WIN64 + __CRT_INLINE void __writecr0(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr0" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned __int64 __readcr2(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr2, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr2(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr2" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned __int64 __readcr3(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr3, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr3(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr3" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned __int64 __readcr4(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr4, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr4(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr4" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned __int64 __readcr8(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr8, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr8(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr8" + : + : [Data] "q" (Data) + : "memory"); + } + +#elif defined(_WIN32) + + __CRT_INLINE void __writecr0(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr0" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned long __readcr2(void) + { + unsigned long value; + __asm__ __volatile__ ( + "mov %%cr2, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr2(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr2" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned long __readcr3(void) + { + unsigned long value; + __asm__ __volatile__ ( + "mov %%cr3, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr3(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr3" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned long __readcr4(void) + { + unsigned long value; + __asm__ __volatile__ ( + "mov %%cr4, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr4(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr4" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned long __readcr8(void) + { + unsigned long value; __asm__ __volatile__ ( + "mov %%cr8, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr8(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr8" + : + : [Data] "q" (Data) + : "memory"); + } + +#endif + + __CRT_INLINE unsigned __int64 __readmsr(unsigned long msr) + { + unsigned __int64 val1, val2; + __asm__ __volatile__( + "rdmsr" + : "=a" (val1), "=d" (val2) + : "c" (msr)); + return val1 | (val2 << 32); + } + + __CRT_INLINE void __writemsr (unsigned long msr, unsigned __int64 Value) + { + unsigned long val1 = Value, val2 = Value >> 32; + __asm__ __volatile__ ( + "wrmsr" + : + : "c" (msr), "a" (val1), "d" (val2)); + } + + __CRT_INLINE unsigned __int64 __rdtsc(void) + { + unsigned __int64 val1, val2; + __asm__ __volatile__ ( + "rdtsc" + : "=a" (val1), "=d" (val2)); + return val1 | (val2 << 32); + } + + __CRT_INLINE void __cpuid(int CPUInfo[4], int InfoType) + { + __asm__ __volatile__ ( + "cpuid" + : "=a" (CPUInfo [0]), "=b" (CPUInfo [1]), "=c" (CPUInfo [2]), "=d" (CPUInfo [3]) + : "a" (InfoType)); + } + +#endif + +#ifdef __cplusplus +} +#endif + +#include + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/ctype.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/ctype.h new file mode 100644 index 00000000..7e901002 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/ctype.h @@ -0,0 +1,281 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_CTYPE +#define _INC_CTYPE + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() +#ifdef _MSVCRT_ +#define __pctype_func() (_pctype) +#else +#define __pctype_func() (*_imp___pctype) +#endif +#endif + +#ifndef _pctype +#ifdef _MSVCRT_ + extern unsigned short *_pctype; +#else + extern unsigned short **_imp___pctype; +#define _pctype (*_imp___pctype) +#endif +#endif + +#endif +#endif + +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#ifndef _wctype +#ifdef _MSVCRT_ + extern unsigned short *_wctype; +#else + extern unsigned short **_imp___wctype; +#define _wctype (*_imp___wctype) +#endif +#endif +#ifdef _MSVCRT_ +#define __pwctype_func() (_pwctype) +#ifndef _pwctype + extern unsigned short *_pwctype; +#endif +#else +#define __pwctype_func() (*_imp___pwctype) +#ifndef _pwctype + extern unsigned short **_imp___pwctype; +#define _pwctype (*_imp___pwctype) +#endif +#endif +#endif +#endif + + /* CRT stuff */ +#if 1 + extern const unsigned char __newclmap[]; + extern const unsigned char __newcumap[]; + extern pthreadlocinfo __ptlocinfo; + extern pthreadmbcinfo __ptmbcinfo; + extern int __globallocalestatus; + extern int __locale_changed; + extern struct threadlocaleinfostruct __initiallocinfo; + extern _locale_tstruct __initiallocalestructinfo; + pthreadlocinfo __cdecl __updatetlocinfo(void); + pthreadmbcinfo __cdecl __updatetmbcinfo(void); +#endif + +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 + +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 + +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) + +#ifndef _CTYPE_DEFINED +#define _CTYPE_DEFINED + + _CRTIMP int __cdecl _isctype(int _C,int _Type); + _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); + _CRTIMP int __cdecl isalpha(int _C); + _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isupper(int _C); + _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl islower(int _C); + _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isdigit(int _C); + _CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isxdigit(int _C); + _CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isspace(int _C); + _CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl ispunct(int _C); + _CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isalnum(int _C); + _CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isprint(int _C); + _CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isgraph(int _C); + _CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl iscntrl(int _C); + _CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl toupper(int _C); + _CRTIMP int __cdecl tolower(int _C); + _CRTIMP int __cdecl _tolower(int _C); + _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _toupper(int _C); + _CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl __isascii(int _C); + _CRTIMP int __cdecl __toascii(int _C); + _CRTIMP int __cdecl __iscsymf(int _C); + _CRTIMP int __cdecl __iscsym(int _C); + +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) +int __cdecl isblank(int _C); +#endif +#endif + +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED + + int __cdecl iswalpha(wint_t _C); + _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); + int __cdecl iswupper(wint_t _C); + _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); + int __cdecl iswlower(wint_t _C); + _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswdigit(wint_t _C); + _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswxdigit(wint_t _C); + _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswspace(wint_t _C); + _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); + int __cdecl iswpunct(wint_t _C); + _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); + int __cdecl iswalnum(wint_t _C); + _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); + int __cdecl iswprint(wint_t _C); + _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); + int __cdecl iswgraph(wint_t _C); + _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); + int __cdecl iswcntrl(wint_t _C); + _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); + int __cdecl iswascii(wint_t _C); + int __cdecl isleadbyte(int _C); + _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); + wint_t __cdecl towupper(wint_t _C); + _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); + wint_t __cdecl towlower(wint_t _C); + _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswctype(wint_t _C,wctype_t _Type); + _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsymf(wint_t _C); + _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsym(wint_t _C); + _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); + int __cdecl is_wctype(wint_t _C,wctype_t _Type); + +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) +int __cdecl iswblank(wint_t _C); +#endif +#endif + +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef MB_CUR_MAX +#define MB_CUR_MAX ___mb_cur_max_func() +#ifndef __mb_cur_max +#ifdef _MSVCRT_ + extern int __mb_cur_max; +#else +#define __mb_cur_max (*_imp____mb_cur_max) + extern int *_imp____mb_cur_max; +#endif +#endif +#ifdef _MSVCRT_ +#define ___mb_cur_max_func() (__mb_cur_max) +#else +#define ___mb_cur_max_func() (*_imp____mb_cur_max) +#endif +#endif + +#define __chvalidchk(a,b) (__PCTYPE_FUNC[(a)] & (b)) +#define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[_Char] & (_Flag)) +#define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale)) +#define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale) +#define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale) +#define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale) +#define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale) +#define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale) +#define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale) +#define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale) +#define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale) +#define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale) +#define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale) +#define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale) +#define _tolower(_Char) ((_Char)-'A'+'a') +#define _toupper(_Char) ((_Char)-'a'+'A') +#define __isascii(_Char) ((unsigned)(_Char) < 0x80) +#define __toascii(_Char) ((_Char) & 0x7f) + +#ifndef _WCTYPE_INLINE_DEFINED +#define _WCTYPE_INLINE_DEFINED + +#undef _CRT_WCTYPE_NOINLINE +#ifndef __cplusplus +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) +#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) +#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) +#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) +#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) +#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) +#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) +#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) +#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) +#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) +#endif +#endif + +#define __iscsymf(_c) (isalpha(_c) || ((_c)=='_')) +#define __iscsym(_c) (isalnum(_c) || ((_c)=='_')) +#define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_')) +#define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_')) +#define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_')) +#define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_')) +#define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_')) +#define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_')) +#endif + +#ifndef NO_OLDNAMES +#ifndef _CTYPE_DEFINED + int __cdecl isascii(int _C); + int __cdecl toascii(int _C); + int __cdecl iscsymf(int _C); + int __cdecl iscsym(int _C); +#else +#define isascii __isascii +#define toascii __toascii +#define iscsymf __iscsymf +#define iscsym __iscsym +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/dir.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/dir.h new file mode 100644 index 00000000..f38f750d --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/dir.h @@ -0,0 +1,31 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * dir.h + * + * This file OBSOLESCENT and only provided for backward compatibility. + * Please use io.h instead. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * Mumit Khan + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +#include + diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/direct.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/direct.h new file mode 100644 index 00000000..99ce69db --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/direct.h @@ -0,0 +1,68 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_DIRECT +#define _INC_DIRECT + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _DISKFREE_T_DEFINED +#define _DISKFREE_T_DEFINED + struct _diskfree_t { + unsigned total_clusters; + unsigned avail_clusters; + unsigned sectors_per_cluster; + unsigned bytes_per_sector; + }; +#endif + + _CRTIMP char *__cdecl _getcwd(char *_DstBuf,int _SizeInBytes); + _CRTIMP char *__cdecl _getdcwd(int _Drive,char *_DstBuf,int _SizeInBytes); + char *__cdecl _getdcwd_nolock(int _Drive,char *_DstBuf,int _SizeInBytes); + _CRTIMP int __cdecl _chdir(const char *_Path); + _CRTIMP int __cdecl _mkdir(const char *_Path); + _CRTIMP int __cdecl _rmdir(const char *_Path); + _CRTIMP int __cdecl _chdrive(int _Drive); + _CRTIMP int __cdecl _getdrive(void); + _CRTIMP unsigned long __cdecl _getdrives(void); + +#ifndef _GETDISKFREE_DEFINED +#define _GETDISKFREE_DEFINED + _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); +#endif + +#ifndef _WDIRECT_DEFINED +#define _WDIRECT_DEFINED + _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); +#endif + +#ifndef NO_OLDNAMES + +#define diskfree_t _diskfree_t + + char *__cdecl getcwd(char *_DstBuf,int _SizeInBytes); + int __cdecl chdir(const char *_Path); + int __cdecl mkdir(const char *_Path); + int __cdecl rmdir(const char *_Path); +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/dirent.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/dirent.h new file mode 100644 index 00000000..cd31f59e --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/dirent.h @@ -0,0 +1,135 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* All the headers include this file. */ +#include <_mingw.h> + +#ifndef __STRICT_ANSI__ + +#ifndef _DIRENT_H_ +#define _DIRENT_H_ + + +#pragma pack(push,_CRT_PACKING) + +#include + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + + struct dirent + { + long d_ino; /* Always zero. */ + unsigned short d_reclen; /* Always zero. */ + unsigned short d_namlen; /* Length of name in d_name. */ + char* d_name; /* File name. */ + /* NOTE: The name in the dirent structure points to the name in the + * finddata_t structure in the DIR. */ + }; + + /* + * This is an internal data structure. Good programmers will not use it + * except as an argument to one of the functions below. + * dd_stat field is now int (was short in older versions). + */ + typedef struct + { + /* disk transfer area for this dir */ + struct _finddata_t dd_dta; + + /* dirent struct to return from dir (NOTE: this makes this thread + * safe as long as only one thread uses a particular DIR struct at + * a time) */ + struct dirent dd_dir; + + /* _findnext handle */ + long dd_handle; + + /* + * Status of search: + * 0 = not started yet (next entry to read is first entry) + * -1 = off the end + * positive = 0 based index of next entry + */ + int dd_stat; + + /* given path for dir with search pattern (struct is extended) */ + char dd_name[1]; + } DIR; + + DIR* __cdecl opendir (const char*); + struct dirent* __cdecl readdir (DIR*); + int __cdecl closedir (DIR*); + void __cdecl rewinddir (DIR*); + long __cdecl telldir (DIR*); + void __cdecl seekdir (DIR*, long); + + + /* wide char versions */ + + struct _wdirent + { + long d_ino; /* Always zero. */ + unsigned short d_reclen; /* Always zero. */ + unsigned short d_namlen; /* Length of name in d_name. */ + wchar_t* d_name; /* File name. */ + /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */ + }; + + /* + * This is an internal data structure. Good programmers will not use it + * except as an argument to one of the functions below. + */ + typedef struct + { + /* disk transfer area for this dir */ + struct _wfinddata_t dd_dta; + + /* dirent struct to return from dir (NOTE: this makes this thread + * safe as long as only one thread uses a particular DIR struct at + * a time) */ + struct _wdirent dd_dir; + + /* _findnext handle */ + long dd_handle; + + /* + * Status of search: + * 0 = not started yet (next entry to read is first entry) + * -1 = off the end + * positive = 0 based index of next entry + */ + int dd_stat; + + /* given path for dir with search pattern (struct is extended) */ + wchar_t dd_name[1]; + } _WDIR; + + + + _WDIR* __cdecl _wopendir (const wchar_t*); + struct _wdirent* __cdecl _wreaddir (_WDIR*); + int __cdecl _wclosedir (_WDIR*); + void __cdecl _wrewinddir (_WDIR*); + long __cdecl _wtelldir (_WDIR*); + void __cdecl _wseekdir (_WDIR*, long); + + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#pragma pack(pop) + +#endif /* Not _DIRENT_H_ */ + + +#endif /* Not __STRICT_ANSI__ */ + diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/dos.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/dos.h new file mode 100644 index 00000000..294e8fe1 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/dos.h @@ -0,0 +1,55 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_DOS +#define _INC_DOS + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _DISKFREE_T_DEFINED +#define _DISKFREE_T_DEFINED + + struct _diskfree_t { + unsigned total_clusters; + unsigned avail_clusters; + unsigned sectors_per_cluster; + unsigned bytes_per_sector; + }; +#endif + +#define _A_NORMAL 0x00 +#define _A_RDONLY 0x01 +#define _A_HIDDEN 0x02 +#define _A_SYSTEM 0x04 +#define _A_SUBDIR 0x10 +#define _A_ARCH 0x20 + +#ifndef _GETDISKFREE_DEFINED +#define _GETDISKFREE_DEFINED + _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); +#endif + +#if (defined(_X86_) && !defined(__x86_64)) + void __cdecl _disable(void); + void __cdecl _enable(void); +#endif + +#ifndef NO_OLDNAMES +#define diskfree_t _diskfree_t +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/errno.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/errno.h new file mode 100644 index 00000000..c2df0158 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/errno.h @@ -0,0 +1,75 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_ERRNO +#define _INC_ERRNO + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRT_ERRNO_DEFINED +#define _CRT_ERRNO_DEFINED + _CRTIMP extern int *__cdecl _errno(void); +#define errno (*_errno()) + + errno_t __cdecl _set_errno(int _Value); + errno_t __cdecl _get_errno(int *_Value); +#endif + +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define EDEADLK 36 +#define ENAMETOOLONG 38 +#define ENOLCK 39 +#define ENOSYS 40 +#define ENOTEMPTY 41 + +#ifndef RC_INVOKED +#if !defined(_SECURECRT_ERRCODE_VALUES_DEFINED) +#define _SECURECRT_ERRCODE_VALUES_DEFINED +#define EINVAL 22 +#define ERANGE 34 +#define EILSEQ 42 +#define STRUNCATE 80 +#endif +#endif + +#define EDEADLOCK EDEADLK + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/excpt.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/excpt.h new file mode 100644 index 00000000..26cc9437 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/excpt.h @@ -0,0 +1,123 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_EXCPT +#define _INC_EXCPT + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + + struct _EXCEPTION_POINTERS; + +#ifndef EXCEPTION_DISPOSITION +#define EXCEPTION_DISPOSITION int +#endif +#define ExceptionContinueExecution 0 +#define ExceptionContinueSearch 1 +#define ExceptionNestedException 2 +#define ExceptionCollidedUnwind 3 + +#if (defined(_X86_) && !defined(__x86_64)) + struct _EXCEPTION_RECORD; + struct _CONTEXT; + + EXCEPTION_DISPOSITION __cdecl _except_handler(struct _EXCEPTION_RECORD *_ExceptionRecord,void *_EstablisherFrame,struct _CONTEXT *_ContextRecord,void *_DispatcherContext); +#elif defined(__ia64__) + + typedef struct _EXCEPTION_POINTERS *Exception_info_ptr; + struct _EXCEPTION_RECORD; + struct _CONTEXT; + struct _DISPATCHER_CONTEXT; + + _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler (struct _EXCEPTION_RECORD *_ExceptionRecord,unsigned __int64 _MemoryStackFp,unsigned __int64 _BackingStoreFp,struct _CONTEXT *_ContextRecord,struct _DISPATCHER_CONTEXT *_DispatcherContext,unsigned __int64 _GlobalPointer); +#elif defined(__x86_64) + + struct _EXCEPTION_RECORD; + struct _CONTEXT; +#endif + +#define GetExceptionCode _exception_code +#define exception_code _exception_code +#define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info +#define exception_info (struct _EXCEPTION_POINTERS *)_exception_info +#define AbnormalTermination _abnormal_termination +#define abnormal_termination _abnormal_termination + + unsigned long __cdecl _exception_code(void); + void *__cdecl _exception_info(void); + int __cdecl _abnormal_termination(void); + +#define EXCEPTION_EXECUTE_HANDLER 1 +#define EXCEPTION_CONTINUE_SEARCH 0 +#define EXCEPTION_CONTINUE_EXECUTION -1 + + /* CRT stuff */ + typedef void (__cdecl * _PHNDLR)(int); + + struct _XCPT_ACTION { + unsigned long XcptNum; + int SigNum; + _PHNDLR XcptAction; + }; + + extern struct _XCPT_ACTION _XcptActTab[]; + extern int _XcptActTabCount; + extern int _XcptActTabSize; + extern int _First_FPE_Indx; + extern int _Num_FPE; + + int __cdecl __CppXcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); + int __cdecl _XcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); + + /* + * The type of function that is expected as an exception handler to be + * installed with _try1. + */ + typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); + +#ifndef HAVE_NO_SEH + /* + * This is not entirely necessary, but it is the structure installed by + * the _try1 primitive below. + */ + typedef struct _EXCEPTION_REGISTRATION { + struct _EXCEPTION_REGISTRATION *prev; + EXCEPTION_DISPOSITION (*handler)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); + } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION; + + typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD; + typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD; +#endif + +#if (defined(_X86_) && !defined(__x86_64)) +#define __try1(pHandler) \ + __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler)); + +#define __except1 \ + __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \ + : : : "%eax"); +#elif defined(__x86_64) +#define __try1(pHandler) \ + __asm__ ("pushq %0;pushq %%gs:0;movq %%rsp,%%gs:0;" : : "g" (pHandler)); + +#define __except1 \ + __asm__ ("movq (%%rsp),%%rax;movq %%rax,%%gs:0;addq $16,%%rsp;" \ + : : : "%rax"); +#else +#define __try1(pHandler) +#define __except1 +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/fcntl.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/fcntl.h new file mode 100644 index 00000000..9202b08c --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/fcntl.h @@ -0,0 +1,52 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#include + +#ifndef _INC_FCNTL +#define _INC_FCNTL + +#define _O_RDONLY 0x0000 +#define _O_WRONLY 0x0001 +#define _O_RDWR 0x0002 +#define _O_APPEND 0x0008 +#define _O_CREAT 0x0100 +#define _O_TRUNC 0x0200 +#define _O_EXCL 0x0400 +#define _O_TEXT 0x4000 +#define _O_BINARY 0x8000 +#define _O_WTEXT 0x10000 +#define _O_U16TEXT 0x20000 +#define _O_U8TEXT 0x40000 +#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) + +#define _O_RAW _O_BINARY +#define _O_NOINHERIT 0x0080 +#define _O_TEMPORARY 0x0040 +#define _O_SHORT_LIVED 0x1000 + +#define _O_SEQUENTIAL 0x0020 +#define _O_RANDOM 0x0010 + +#if !defined(NO_OLDNAMES) || defined(_POSIX) +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_APPEND _O_APPEND +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_EXCL _O_EXCL +#define O_TEXT _O_TEXT +#define O_BINARY _O_BINARY +#define O_RAW _O_BINARY +#define O_TEMPORARY _O_TEMPORARY +#define O_NOINHERIT _O_NOINHERIT +#define O_SEQUENTIAL _O_SEQUENTIAL +#define O_RANDOM _O_RANDOM +#define O_ACCMODE _O_ACCMODE +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/fenv.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/fenv.h new file mode 100644 index 00000000..258f3a5d --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/fenv.h @@ -0,0 +1,108 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _FENV_H_ +#define _FENV_H_ + +#include <_mingw.h> + +/* FPU status word exception flags */ +#define FE_INVALID 0x01 +#define FE_DENORMAL 0x02 +#define FE_DIVBYZERO 0x04 +#define FE_OVERFLOW 0x08 +#define FE_UNDERFLOW 0x10 +#define FE_INEXACT 0x20 +#define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \ + | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) + +/* FPU control word rounding flags */ +#define FE_TONEAREST 0x0000 +#define FE_DOWNWARD 0x0400 +#define FE_UPWARD 0x0800 +#define FE_TOWARDZERO 0x0c00 + +/* The MXCSR exception flags are the same as the + FE flags. */ +#define __MXCSR_EXCEPT_FLAG_SHIFT 0 + +/* How much to shift FE status word exception flags + to get MXCSR rounding flags, */ +#define __MXCSR_ROUND_FLAG_SHIFT 3 + +#ifndef RC_INVOKED +/* + For now, support only for the basic abstraction of flags that are + either set or clear. fexcept_t could be structure that holds more + info about the fp environment. +*/ +typedef unsigned short fexcept_t; + +/* This 32-byte struct represents the entire floating point + environment as stored by fnstenv or fstenv, augmented by + the contents of the MXCSR register, as stored by stmxcsr + (if CPU supports it). */ +typedef struct +{ + unsigned short __control_word; + unsigned short __unused0; + unsigned short __status_word; + unsigned short __unused1; + unsigned short __tag_word; + unsigned short __unused2; + unsigned int __ip_offset; /* instruction pointer offset */ + unsigned short __ip_selector; + unsigned short __opcode; + unsigned int __data_offset; + unsigned short __data_selector; + unsigned short __unused3; + unsigned int __mxcsr; /* contents of the MXCSR register */ +} fenv_t; + + +/*The C99 standard (7.6.9) allows us to define implementation-specific macros for + different fp environments */ + +/* The default Intel x87 floating point environment (64-bit mantissa) */ +#define FE_PC64_ENV ((const fenv_t *)-1) + +/* The floating point environment set by MSVCRT _fpreset (53-bit mantissa) */ +#define FE_PC53_ENV ((const fenv_t *)-2) + +/* The FE_DFL_ENV macro is required by standard. + fesetenv will use the environment set at app startup.*/ +#define FE_DFL_ENV ((const fenv_t *) 0) + +#ifdef __cplusplus +extern "C" { +#endif + +/*TODO: Some of these could be inlined */ +/* 7.6.2 Exception */ + +extern int __cdecl feclearexcept (int); +extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts); +extern int __cdecl feraiseexcept (int excepts ); +extern int __cdecl fesetexceptflag (const fexcept_t *, int); +extern int __cdecl fetestexcept (int excepts); + +/* 7.6.3 Rounding */ + +extern int __cdecl fegetround (void); +extern int __cdecl fesetround (int mode); + +/* 7.6.4 Environment */ + +extern int __cdecl fegetenv(fenv_t * envp); +extern int __cdecl fesetenv(const fenv_t * ); +extern int __cdecl feupdateenv(const fenv_t *); +extern int __cdecl feholdexcept(fenv_t *); + +#ifdef __cplusplus +} +#endif +#endif /* Not RC_INVOKED */ + +#endif /* ndef _FENV_H */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/float.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/float.h new file mode 100644 index 00000000..f16f1f0c --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/float.h @@ -0,0 +1,57 @@ +#ifndef _FLOAT_H_ +#define _FLOAT_H_ + +#define FLT_RADIX 2 + +/* IEEE float */ +#define FLT_MANT_DIG 24 +#define FLT_DIG 6 +#define FLT_ROUNDS 1 +#define FLT_EPSILON 1.19209290e-07F +#define FLT_MIN_EXP (-125) +#define FLT_MIN 1.17549435e-38F +#define FLT_MIN_10_EXP (-37) +#define FLT_MAX_EXP 128 +#define FLT_MAX 3.40282347e+38F +#define FLT_MAX_10_EXP 38 + +/* IEEE double */ +#define DBL_MANT_DIG 53 +#define DBL_DIG 15 +#define DBL_EPSILON 2.2204460492503131e-16 +#define DBL_MIN_EXP (-1021) +#define DBL_MIN 2.2250738585072014e-308 +#define DBL_MIN_10_EXP (-307) +#define DBL_MAX_EXP 1024 +#define DBL_MAX 1.7976931348623157e+308 +#define DBL_MAX_10_EXP 308 + +/* horrible intel long double */ +#if defined __i386__ || defined __x86_64__ + +#define LDBL_MANT_DIG 64 +#define LDBL_DIG 18 +#define LDBL_EPSILON 1.08420217248550443401e-19L +#define LDBL_MIN_EXP (-16381) +#define LDBL_MIN 3.36210314311209350626e-4932L +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_EXP 16384 +#define LDBL_MAX 1.18973149535723176502e+4932L +#define LDBL_MAX_10_EXP 4932 + +#else + +/* same as IEEE double */ +#define LDBL_MANT_DIG 53 +#define LDBL_DIG 15 +#define LDBL_EPSILON 2.2204460492503131e-16 +#define LDBL_MIN_EXP (-1021) +#define LDBL_MIN 2.2250738585072014e-308 +#define LDBL_MIN_10_EXP (-307) +#define LDBL_MAX_EXP 1024 +#define LDBL_MAX 1.7976931348623157e+308 +#define LDBL_MAX_10_EXP 308 + +#endif + +#endif /* _FLOAT_H_ */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/inttypes.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/inttypes.h new file mode 100644 index 00000000..73600919 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/inttypes.h @@ -0,0 +1,297 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* 7.8 Format conversion of integer types */ + +#ifndef _INTTYPES_H_ +#define _INTTYPES_H_ + +#include <_mingw.h> +#include +#define __need_wchar_t +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + intmax_t quot; + intmax_t rem; + } imaxdiv_t; + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) + +/* 7.8.1 Macros for format specifiers + * + * MS runtime does not yet understand C9x standard "ll" + * length specifier. It appears to treat "ll" as "l". + * The non-standard I64 length specifier causes warning in GCC, + * but understood by MS runtime functions. + */ + +/* fprintf macros for signed types */ +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 "I64d" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "d" +#define PRIdLEAST64 "I64d" + +#define PRIdFAST8 "d" +#define PRIdFAST16 "d" +#define PRIdFAST32 "d" +#define PRIdFAST64 "I64d" + +#define PRIdMAX "I64d" + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 "I64i" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "i" +#define PRIiLEAST64 "I64i" + +#define PRIiFAST8 "i" +#define PRIiFAST16 "i" +#define PRIiFAST32 "i" +#define PRIiFAST64 "I64i" + +#define PRIiMAX "I64i" + +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 "I64o" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "o" +#define PRIoLEAST64 "I64o" + +#define PRIoFAST8 "o" +#define PRIoFAST16 "o" +#define PRIoFAST32 "o" +#define PRIoFAST64 "I64o" + +#define PRIoMAX "I64o" + +/* fprintf macros for unsigned types */ +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 "I64u" + + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "u" +#define PRIuLEAST64 "I64u" + +#define PRIuFAST8 "u" +#define PRIuFAST16 "u" +#define PRIuFAST32 "u" +#define PRIuFAST64 "I64u" + +#define PRIuMAX "I64u" + +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 "I64x" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "x" +#define PRIxLEAST64 "I64x" + +#define PRIxFAST8 "x" +#define PRIxFAST16 "x" +#define PRIxFAST32 "x" +#define PRIxFAST64 "I64x" + +#define PRIxMAX "I64x" + +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 "I64X" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "X" +#define PRIXLEAST64 "I64X" + +#define PRIXFAST8 "X" +#define PRIXFAST16 "X" +#define PRIXFAST32 "X" +#define PRIXFAST64 "I64X" + +#define PRIXMAX "I64X" + +/* + * fscanf macros for signed int types + * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t + * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have + * no length identifiers + */ + +#define SCNd16 "hd" +#define SCNd32 "d" +#define SCNd64 "I64d" + +#define SCNdLEAST16 "hd" +#define SCNdLEAST32 "d" +#define SCNdLEAST64 "I64d" + +#define SCNdFAST16 "hd" +#define SCNdFAST32 "d" +#define SCNdFAST64 "I64d" + +#define SCNdMAX "I64d" + +#define SCNi16 "hi" +#define SCNi32 "i" +#define SCNi64 "I64i" + +#define SCNiLEAST16 "hi" +#define SCNiLEAST32 "i" +#define SCNiLEAST64 "I64i" + +#define SCNiFAST16 "hi" +#define SCNiFAST32 "i" +#define SCNiFAST64 "I64i" + +#define SCNiMAX "I64i" + +#define SCNo16 "ho" +#define SCNo32 "o" +#define SCNo64 "I64o" + +#define SCNoLEAST16 "ho" +#define SCNoLEAST32 "o" +#define SCNoLEAST64 "I64o" + +#define SCNoFAST16 "ho" +#define SCNoFAST32 "o" +#define SCNoFAST64 "I64o" + +#define SCNoMAX "I64o" + +#define SCNx16 "hx" +#define SCNx32 "x" +#define SCNx64 "I64x" + +#define SCNxLEAST16 "hx" +#define SCNxLEAST32 "x" +#define SCNxLEAST64 "I64x" + +#define SCNxFAST16 "hx" +#define SCNxFAST32 "x" +#define SCNxFAST64 "I64x" + +#define SCNxMAX "I64x" + +/* fscanf macros for unsigned int types */ + +#define SCNu16 "hu" +#define SCNu32 "u" +#define SCNu64 "I64u" + +#define SCNuLEAST16 "hu" +#define SCNuLEAST32 "u" +#define SCNuLEAST64 "I64u" + +#define SCNuFAST16 "hu" +#define SCNuFAST32 "u" +#define SCNuFAST64 "I64u" + +#define SCNuMAX "I64u" + +#ifdef _WIN64 +#define PRIdPTR "I64d" +#define PRIiPTR "I64i" +#define PRIoPTR "I64o" +#define PRIuPTR "I64u" +#define PRIxPTR "I64x" +#define PRIXPTR "I64X" +#define SCNdPTR "I64d" +#define SCNiPTR "I64i" +#define SCNoPTR "I64o" +#define SCNxPTR "I64x" +#define SCNuPTR "I64u" +#else +#define PRIdPTR "d" +#define PRIiPTR "i" +#define PRIoPTR "o" +#define PRIuPTR "u" +#define PRIxPTR "x" +#define PRIXPTR "X" +#define SCNdPTR "d" +#define SCNiPTR "i" +#define SCNoPTR "o" +#define SCNxPTR "x" +#define SCNuPTR "u" +#endif + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +/* + * no length modifier for char types prior to C9x + * MS runtime scanf appears to treat "hh" as "h" + */ + +/* signed char */ +#define SCNd8 "hhd" +#define SCNdLEAST8 "hhd" +#define SCNdFAST8 "hhd" + +#define SCNi8 "hhi" +#define SCNiLEAST8 "hhi" +#define SCNiFAST8 "hhi" + +#define SCNo8 "hho" +#define SCNoLEAST8 "hho" +#define SCNoFAST8 "hho" + +#define SCNx8 "hhx" +#define SCNxLEAST8 "hhx" +#define SCNxFAST8 "hhx" + +/* unsigned char */ +#define SCNu8 "hhu" +#define SCNuLEAST8 "hhu" +#define SCNuFAST8 "hhu" +#endif /* __STDC_VERSION__ >= 199901 */ + +#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ + +intmax_t __cdecl imaxabs (intmax_t j); +__CRT_INLINE intmax_t __cdecl imaxabs (intmax_t j) + {return (j >= 0 ? j : -j);} +imaxdiv_t __cdecl imaxdiv (intmax_t numer, intmax_t denom); + +/* 7.8.2 Conversion functions for greatest-width integer types */ + +intmax_t __cdecl strtoimax (const char* __restrict__ nptr, + char** __restrict__ endptr, int base); +uintmax_t __cdecl strtoumax (const char* __restrict__ nptr, + char** __restrict__ endptr, int base); + +intmax_t __cdecl wcstoimax (const wchar_t* __restrict__ nptr, + wchar_t** __restrict__ endptr, int base); +uintmax_t __cdecl wcstoumax (const wchar_t* __restrict__ nptr, + wchar_t** __restrict__ endptr, int base); + +#ifdef __cplusplus +} +#endif + +#endif /* ndef _INTTYPES_H */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/io.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/io.h new file mode 100644 index 00000000..e2aeec3d --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/io.h @@ -0,0 +1,418 @@ + +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _IO_H_ +#define _IO_H_ + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifndef _POSIX_ + +#ifdef __cplusplus +extern "C" { +#endif + +_CRTIMP char* __cdecl _getcwd (char*, int); +#ifndef _FSIZE_T_DEFINED + typedef unsigned long _fsize_t; +#define _FSIZE_T_DEFINED +#endif + +#ifndef _FINDDATA_T_DEFINED + + struct _finddata32_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + _fsize_t size; + char name[260]; + }; + +/*#if _INTEGRAL_MAX_BITS >= 64*/ + + struct _finddata32i64_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + __int64 size; + char name[260]; + }; + + struct _finddata64i32_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + _fsize_t size; + char name[260]; + }; + + struct __finddata64_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + __int64 size; + char name[260]; + }; +/* #endif */ + +#ifdef _USE_32BIT_TIME_T +#define _finddata_t _finddata32_t +#define _finddatai64_t _finddata32i64_t + +#ifdef _WIN64 +#define _findfirst _findfirst32 +#define _findnext _findnext32 +#else +#define _findfirst32 _findfirst +#define _findnext32 _findnext +#endif +#define _findfirsti64 _findfirst32i64 +#define _findnexti64 _findnext32i64 +#else +#define _finddata_t _finddata64i32_t +#define _finddatai64_t __finddata64_t + +#define _findfirst _findfirst64i32 +#define _findnext _findnext64i32 +#define _findfirsti64 _findfirst64 +#define _findnexti64 _findnext64 +#endif + +#define _FINDDATA_T_DEFINED +#endif + +#ifndef _WFINDDATA_T_DEFINED + + struct _wfinddata32_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + _fsize_t size; + wchar_t name[260]; + }; + +/* #if _INTEGRAL_MAX_BITS >= 64 */ + + struct _wfinddata32i64_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + __int64 size; + wchar_t name[260]; + }; + + struct _wfinddata64i32_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + _fsize_t size; + wchar_t name[260]; + }; + + struct _wfinddata64_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + __int64 size; + wchar_t name[260]; + }; +/* #endif */ + +#ifdef _USE_32BIT_TIME_T +#define _wfinddata_t _wfinddata32_t +#define _wfinddatai64_t _wfinddata32i64_t + +#define _wfindfirst _wfindfirst32 +#define _wfindnext _wfindnext32 +#define _wfindfirsti64 _wfindfirst32i64 +#define _wfindnexti64 _wfindnext32i64 +#else +#define _wfinddata_t _wfinddata64i32_t +#define _wfinddatai64_t _wfinddata64_t + +#define _wfindfirst _wfindfirst64i32 +#define _wfindnext _wfindnext64i32 +#define _wfindfirsti64 _wfindfirst64 +#define _wfindnexti64 _wfindnext64 +#endif + +#define _WFINDDATA_T_DEFINED +#endif + +#define _A_NORMAL 0x00 +#define _A_RDONLY 0x01 +#define _A_HIDDEN 0x02 +#define _A_SYSTEM 0x04 +#define _A_SUBDIR 0x10 +#define _A_ARCH 0x20 + +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +#undef size_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int size_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 size_t; +#endif +#else + typedef unsigned int size_t; +#endif +#endif + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef int ssize_t; +#endif +#endif + +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif + +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int _off64_t __attribute__ ((mode (DI))); +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef int off64_t __attribute__ ((mode (DI))); +#endif +#else + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif +#endif + + /* Some defines for _access nAccessMode (MS doesn't define them, but + * it doesn't seem to hurt to add them). */ +#define F_OK 0 /* Check for file existence */ +#define X_OK 1 /* Check for execute permission. */ +#define W_OK 2 /* Check for write permission */ +#define R_OK 4 /* Check for read permission */ + + _CRTIMP int __cdecl _access(const char *_Filename,int _AccessMode); + _CRTIMP int __cdecl _chmod(const char *_Filename,int _Mode); + _CRTIMP int __cdecl _chsize(int _FileHandle,long _Size); + _CRTIMP int __cdecl _close(int _FileHandle); + _CRTIMP int __cdecl _commit(int _FileHandle); + _CRTIMP int __cdecl _creat(const char *_Filename,int _PermissionMode); + _CRTIMP int __cdecl _dup(int _FileHandle); + _CRTIMP int __cdecl _dup2(int _FileHandleSrc,int _FileHandleDst); + _CRTIMP int __cdecl _eof(int _FileHandle); + _CRTIMP long __cdecl _filelength(int _FileHandle); + _CRTIMP intptr_t __cdecl _findfirst32(const char *_Filename,struct _finddata32_t *_FindData); + _CRTIMP int __cdecl _findnext32(intptr_t _FindHandle,struct _finddata32_t *_FindData); + _CRTIMP int __cdecl _findclose(intptr_t _FindHandle); + _CRTIMP int __cdecl _isatty(int _FileHandle); + _CRTIMP int __cdecl _locking(int _FileHandle,int _LockMode,long _NumOfBytes); + _CRTIMP long __cdecl _lseek(int _FileHandle,long _Offset,int _Origin); + _off64_t lseek64(int fd,_off64_t offset, int whence); + _CRTIMP char *__cdecl _mktemp(char *_TemplateName); + _CRTIMP int __cdecl _pipe(int *_PtHandles,unsigned int _PipeSize,int _TextMode); + _CRTIMP int __cdecl _read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount); + +#ifndef _CRT_DIRECTORY_DEFINED +#define _CRT_DIRECTORY_DEFINED + int __cdecl remove(const char *_Filename); + int __cdecl rename(const char *_OldFilename,const char *_NewFilename); + _CRTIMP int __cdecl _unlink(const char *_Filename); +#ifndef NO_OLDNAMES + int __cdecl unlink(const char *_Filename); +#endif +#endif + + _CRTIMP int __cdecl _setmode(int _FileHandle,int _Mode); + _CRTIMP long __cdecl _tell(int _FileHandle); + _CRTIMP int __cdecl _umask(int _Mode); + _CRTIMP int __cdecl _write(int _FileHandle,const void *_Buf,unsigned int _MaxCharCount); + +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP __int64 __cdecl _filelengthi64(int _FileHandle); + _CRTIMP intptr_t __cdecl _findfirst32i64(const char *_Filename,struct _finddata32i64_t *_FindData); + _CRTIMP intptr_t __cdecl _findfirst64(const char *_Filename,struct __finddata64_t *_FindData); +#ifdef __cplusplus +#include +#endif + intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData); + __CRT_INLINE intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData) + { + struct __finddata64_t fd; + intptr_t ret = _findfirst64(_Filename,&fd); + _FindData->attrib=fd.attrib; + _FindData->time_create=fd.time_create; + _FindData->time_access=fd.time_access; + _FindData->time_write=fd.time_write; + _FindData->size=(_fsize_t) fd.size; + strncpy(_FindData->name,fd.name,260); + return ret; + } + _CRTIMP int __cdecl _findnext32i64(intptr_t _FindHandle,struct _finddata32i64_t *_FindData); + _CRTIMP int __cdecl _findnext64(intptr_t _FindHandle,struct __finddata64_t *_FindData); + int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData); + __CRT_INLINE int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData) + { + struct __finddata64_t fd; + int ret = _findnext64(_FindHandle,&fd); + _FindData->attrib=fd.attrib; + _FindData->time_create=fd.time_create; + _FindData->time_access=fd.time_access; + _FindData->time_write=fd.time_write; + _FindData->size=(_fsize_t) fd.size; + strncpy(_FindData->name,fd.name,260); + return ret; + } + __int64 __cdecl _lseeki64(int _FileHandle,__int64 _Offset,int _Origin); + __int64 __cdecl _telli64(int _FileHandle); +#endif +#ifndef NO_OLDNAMES + +#ifndef _UWIN + int __cdecl chdir (const char *); + char *__cdecl getcwd (char *, int); + int __cdecl mkdir (const char *); + char *__cdecl mktemp(char *); + int __cdecl rmdir (const char*); + int __cdecl chmod (const char *, int); +#endif /* _UWIN */ + +#endif /* Not NO_OLDNAMES */ + + _CRTIMP errno_t __cdecl _sopen_s(int *_FileHandle,const char *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode); + +#ifndef __cplusplus + _CRTIMP int __cdecl _open(const char *_Filename,int _OpenFlag,...); + _CRTIMP int __cdecl _sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...); +#else + extern "C++" _CRTIMP int __cdecl _open(const char *_Filename,int _Openflag,int _PermissionMode = 0); + extern "C++" _CRTIMP int __cdecl _sopen(const char *_Filename,int _Openflag,int _ShareFlag,int _PermissionMode = 0); +#endif + +#ifndef _WIO_DEFINED +#define _WIO_DEFINED + _CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode); + _CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode); + _CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode); + _CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wunlink(const wchar_t *_Filename); + _CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename); + _CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName); + +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData); + intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData); + _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData); + _CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData); + int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData); + _CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData); +#endif + + _CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag); + +#if !defined(__cplusplus) || !(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,...); + _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...); +#else + extern "C++" _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,int _PermissionMode = 0); + extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0); +#endif + +#endif + + int __cdecl __lock_fhandle(int _Filehandle); + void __cdecl _unlock_fhandle(int _Filehandle); + _CRTIMP intptr_t __cdecl _get_osfhandle(int _FileHandle); + _CRTIMP int __cdecl _open_osfhandle(intptr_t _OSFileHandle,int _Flags); + +#ifndef NO_OLDNAMES + int __cdecl access(const char *_Filename,int _AccessMode); + int __cdecl chmod(const char *_Filename,int _AccessMode); + int __cdecl chsize(int _FileHandle,long _Size); + int __cdecl close(int _FileHandle); + int __cdecl creat(const char *_Filename,int _PermissionMode); + int __cdecl dup(int _FileHandle); + int __cdecl dup2(int _FileHandleSrc,int _FileHandleDst); + int __cdecl eof(int _FileHandle); + long __cdecl filelength(int _FileHandle); + int __cdecl isatty(int _FileHandle); + int __cdecl locking(int _FileHandle,int _LockMode,long _NumOfBytes); + long __cdecl lseek(int _FileHandle,long _Offset,int _Origin); + char *__cdecl mktemp(char *_TemplateName); + int __cdecl open(const char *_Filename,int _OpenFlag,...); + int __cdecl read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount); + int __cdecl setmode(int _FileHandle,int _Mode); + int __cdecl sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...); + long __cdecl tell(int _FileHandle); + int __cdecl umask(int _Mode); + int __cdecl write(int _Filehandle,const void *_Buf,unsigned int _MaxCharCount); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Misc stuff */ +char *getlogin(void); +#ifdef __USE_MINGW_ALARM +unsigned int alarm(unsigned int seconds); +#endif + +#ifdef __USE_MINGW_ACCESS +/* Old versions of MSVCRT access() just ignored X_OK, while the version + shipped with Vista, returns an error code. This will restore the + old behaviour */ +static inline int __mingw_access (const char *__fname, int __mode) { + return _access (__fname, __mode & ~X_OK); +} + +#define access(__f,__m) __mingw_access (__f, __m) +#endif + + +#ifdef __cplusplus +} +#endif + + +#pragma pack(pop) + +#include + +#endif /* End _IO_H_ */ + diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/limits.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/limits.h new file mode 100644 index 00000000..fafb04a4 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/limits.h @@ -0,0 +1,111 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#ifndef _INC_LIMITS +#define _INC_LIMITS + +/* +* File system limits +* +* TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the +* same as FILENAME_MAX and FOPEN_MAX from stdio.h? +* NOTE: Apparently the actual size of PATH_MAX is 260, but a space is +* required for the NUL. TODO: Test? +*/ +#define PATH_MAX (259) + +#define CHAR_BIT 8 +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 +#define UCHAR_MAX 0xff + +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX + +#define MB_LEN_MAX 5 +#define SHRT_MIN (-32768) +#define SHRT_MAX 32767 +#define USHRT_MAX 0xffff +#define INT_MIN (-2147483647 - 1) +#define INT_MAX 2147483647 +#define UINT_MAX 0xffffffff +#define LONG_MIN (-2147483647L - 1) +#define LONG_MAX 2147483647L +#define ULONG_MAX 0xffffffffUL +#define LLONG_MAX 9223372036854775807ll +#define LLONG_MIN (-9223372036854775807ll - 1) +#define ULLONG_MAX 0xffffffffffffffffull + +#if _INTEGRAL_MAX_BITS >= 8 +#define _I8_MIN (-127 - 1) +#define _I8_MAX 127i8 +#define _UI8_MAX 0xffu +#endif + +#if _INTEGRAL_MAX_BITS >= 16 +#define _I16_MIN (-32767 - 1) +#define _I16_MAX 32767i16 +#define _UI16_MAX 0xffffu +#endif + +#if _INTEGRAL_MAX_BITS >= 32 +#define _I32_MIN (-2147483647 - 1) +#define _I32_MAX 2147483647 +#define _UI32_MAX 0xffffffffu +#endif + +#if defined(__GNUC__) +#undef LONG_LONG_MAX +#define LONG_LONG_MAX 9223372036854775807ll +#undef LONG_LONG_MIN +#define LONG_LONG_MIN (-LONG_LONG_MAX-1) +#undef ULONG_LONG_MAX +#define ULONG_LONG_MAX (2ull * LONG_LONG_MAX + 1ull) +#endif + +#if _INTEGRAL_MAX_BITS >= 64 +#define _I64_MIN (-9223372036854775807ll - 1) +#define _I64_MAX 9223372036854775807ll +#define _UI64_MAX 0xffffffffffffffffull +#endif + +#ifndef SIZE_MAX +#ifdef _WIN64 +#define SIZE_MAX _UI64_MAX +#else +#define SIZE_MAX UINT_MAX +#endif +#endif + +#ifdef _POSIX_ +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 6 +#define _POSIX_LINK_MAX 8 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_NAME_MAX 14 +#define _POSIX_NGROUPS_MAX 0 +#define _POSIX_OPEN_MAX 16 +#define _POSIX_PATH_MAX 255 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_TZNAME_MAX 3 +#define ARG_MAX 14500 +#define LINK_MAX 1024 +#define MAX_CANON _POSIX_MAX_CANON +#define MAX_INPUT _POSIX_MAX_INPUT +#define NAME_MAX 255 +#define NGROUPS_MAX 16 +#define OPEN_MAX 32 +#define PATH_MAX 512 +#define PIPE_BUF _POSIX_PIPE_BUF +#define SSIZE_MAX _POSIX_SSIZE_MAX +#define STREAM_MAX 20 +#define TZNAME_MAX 10 +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/locale.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/locale.h new file mode 100644 index 00000000..686aa9ba --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/locale.h @@ -0,0 +1,91 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_LOCALE +#define _INC_LOCALE + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_MONETARY 3 +#define LC_NUMERIC 4 +#define LC_TIME 5 + +#define LC_MIN LC_ALL +#define LC_MAX LC_TIME + +#ifndef _LCONV_DEFINED +#define _LCONV_DEFINED + struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + }; +#endif + +#ifndef _CONFIG_LOCALE_SWT +#define _CONFIG_LOCALE_SWT + +#define _ENABLE_PER_THREAD_LOCALE 0x1 +#define _DISABLE_PER_THREAD_LOCALE 0x2 +#define _ENABLE_PER_THREAD_LOCALE_GLOBAL 0x10 +#define _DISABLE_PER_THREAD_LOCALE_GLOBAL 0x20 +#define _ENABLE_PER_THREAD_LOCALE_NEW 0x100 +#define _DISABLE_PER_THREAD_LOCALE_NEW 0x200 + +#endif + + int __cdecl _configthreadlocale(int _Flag); + char *__cdecl setlocale(int _Category,const char *_Locale); + _CRTIMP struct lconv *__cdecl localeconv(void); + _locale_t __cdecl _get_current_locale(void); + _locale_t __cdecl _create_locale(int _Category,const char *_Locale); + void __cdecl _free_locale(_locale_t _Locale); + _locale_t __cdecl __get_current_locale(void); + _locale_t __cdecl __create_locale(int _Category,const char *_Locale); + void __cdecl __free_locale(_locale_t _Locale); + +#ifndef _WLOCALE_DEFINED +#define _WLOCALE_DEFINED + _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/malloc.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/malloc.h new file mode 100644 index 00000000..fc783a8e --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/malloc.h @@ -0,0 +1,181 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _MALLOC_H_ +#define _MALLOC_H_ + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifndef _MM_MALLOC_H_INCLUDED +#define _MM_MALLOC_H_INCLUDED +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN64 +#define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0 +#else +#define _HEAP_MAXREQ 0xFFFFFFE0 +#endif + +#ifndef _STATIC_ASSERT +#define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1]) +#endif + +/* Return codes for _heapwalk() */ +#define _HEAPEMPTY (-1) +#define _HEAPOK (-2) +#define _HEAPBADBEGIN (-3) +#define _HEAPBADNODE (-4) +#define _HEAPEND (-5) +#define _HEAPBADPTR (-6) + +/* Values for _heapinfo.useflag */ +#define _FREEENTRY 0 +#define _USEDENTRY 1 + +#ifndef _HEAPINFO_DEFINED +#define _HEAPINFO_DEFINED + /* The structure used to walk through the heap with _heapwalk. */ + typedef struct _heapinfo { + int *_pentry; + size_t _size; + int _useflag; + } _HEAPINFO; +#endif + + extern unsigned int _amblksiz; + +#define _mm_free(a) _aligned_free(a) +#define _mm_malloc(a,b) _aligned_malloc(a,b) + +#ifndef _CRT_ALLOCATION_DEFINED +#define _CRT_ALLOCATION_DEFINED + void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements); + void __cdecl free(void *_Memory); + void *__cdecl malloc(size_t _Size); + void *__cdecl realloc(void *_Memory,size_t _NewSize); + _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size); + /* _CRTIMP void __cdecl _aligned_free(void *_Memory); + _CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment); */ + _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset); +#endif + +#define _MAX_WAIT_MALLOC_CRT 60000 + + _CRTIMP int __cdecl _resetstkoflw (void); + _CRTIMP unsigned long __cdecl _set_malloc_crt_max_wait(unsigned long _NewValue); + + _CRTIMP void *__cdecl _expand(void *_Memory,size_t _NewSize); + _CRTIMP size_t __cdecl _msize(void *_Memory); +#ifdef __GNUC__ +#undef _alloca +#define _alloca(x) __builtin_alloca((x)) +#else + /* tcc implements alloca internally and exposes it (since commit d778bde7). + /* alloca is declared at include/stddef.h (which is distributed with tcc). + */ +#ifdef _alloca +#undef _alloca +#endif +#define _alloca(x) alloca((x)) +#endif + _CRTIMP size_t __cdecl _get_sbh_threshold(void); + _CRTIMP int __cdecl _set_sbh_threshold(size_t _NewValue); + _CRTIMP errno_t __cdecl _set_amblksiz(size_t _Value); + _CRTIMP errno_t __cdecl _get_amblksiz(size_t *_Value); + _CRTIMP int __cdecl _heapadd(void *_Memory,size_t _Size); + _CRTIMP int __cdecl _heapchk(void); + _CRTIMP int __cdecl _heapmin(void); + _CRTIMP int __cdecl _heapset(unsigned int _Fill); + _CRTIMP int __cdecl _heapwalk(_HEAPINFO *_EntryInfo); + _CRTIMP size_t __cdecl _heapused(size_t *_Used,size_t *_Commit); + _CRTIMP intptr_t __cdecl _get_heap_handle(void); + +#define _ALLOCA_S_THRESHOLD 1024 +#define _ALLOCA_S_STACK_MARKER 0xCCCC +#define _ALLOCA_S_HEAP_MARKER 0xDDDD + +#if(defined(_X86_) && !defined(__x86_64)) +#define _ALLOCA_S_MARKER_SIZE 8 +#elif defined(__ia64__) || defined(__x86_64) +#define _ALLOCA_S_MARKER_SIZE 16 +#endif + +#if !defined(RC_INVOKED) + static __inline void *_MarkAllocaS(void *_Ptr,unsigned int _Marker) { + if(_Ptr) { + *((unsigned int*)_Ptr) = _Marker; + _Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE; + } + return _Ptr; + } +#endif + +#undef _malloca +#define _malloca(size) \ + ((((size) + _ALLOCA_S_MARKER_SIZE) <= _ALLOCA_S_THRESHOLD) ? \ + _MarkAllocaS(_alloca((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_STACK_MARKER) : \ + _MarkAllocaS(malloc((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_HEAP_MARKER)) +#undef _FREEA_INLINE +#define _FREEA_INLINE + +#ifndef RC_INVOKED +#undef _freea + static __inline void __cdecl _freea(void *_Memory) { + unsigned int _Marker; + if(_Memory) { + _Memory = (char*)_Memory - _ALLOCA_S_MARKER_SIZE; + _Marker = *(unsigned int *)_Memory; + if(_Marker==_ALLOCA_S_HEAP_MARKER) { + free(_Memory); + } +#ifdef _ASSERTE + else if(_Marker!=_ALLOCA_S_STACK_MARKER) { + _ASSERTE(("Corrupted pointer passed to _freea",0)); + } +#endif + } + } +#endif /* RC_INVOKED */ + +#ifndef NO_OLDNAMES +#ifdef __GNUC__ +#undef alloca +#define alloca(x) __builtin_alloca((x)) +#endif +#endif + +#ifdef HEAPHOOK +#ifndef _HEAPHOOK_DEFINED +#define _HEAPHOOK_DEFINED + typedef int (__cdecl *_HEAPHOOK)(int,size_t,void *,void **); +#endif + + _CRTIMP _HEAPHOOK __cdecl _setheaphook(_HEAPHOOK _NewHook); + +#define _HEAP_MALLOC 1 +#define _HEAP_CALLOC 2 +#define _HEAP_FREE 3 +#define _HEAP_REALLOC 4 +#define _HEAP_MSIZE 5 +#define _HEAP_EXPAND 6 +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#endif /* _MALLOC_H_ */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/math.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/math.h new file mode 100644 index 00000000..74add20e --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/math.h @@ -0,0 +1,737 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _MATH_H_ +#define _MATH_H_ + +#if __GNUC__ >= 3 +#pragma GCC system_header +#endif + +#include <_mingw.h> + +struct exception; + +#pragma pack(push,_CRT_PACKING) + +#define _DOMAIN 1 +#define _SING 2 +#define _OVERFLOW 3 +#define _UNDERFLOW 4 +#define _TLOSS 5 +#define _PLOSS 6 + +#ifndef __STRICT_ANSI__ +#ifndef NO_OLDNAMES +#define DOMAIN _DOMAIN +#define SING _SING +#define OVERFLOW _OVERFLOW +#define UNDERFLOW _UNDERFLOW +#define TLOSS _TLOSS +#define PLOSS _PLOSS +#endif +#endif + +#ifndef __STRICT_ANSI__ +#define M_E 2.71828182845904523536 +#define M_LOG2E 1.44269504088896340736 +#define M_LOG10E 0.434294481903251827651 +#define M_LN2 0.693147180559945309417 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.785398163397448309616 +#define M_1_PI 0.318309886183790671538 +#define M_2_PI 0.636619772367581343076 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.707106781186547524401 +#endif + +#ifndef __STRICT_ANSI__ +/* See also float.h */ +#ifndef __MINGW_FPCLASS_DEFINED +#define __MINGW_FPCLASS_DEFINED 1 +#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ +#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ +#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ +#define _FPCLASS_NN 0x0008 /* Negative Normal */ +#define _FPCLASS_ND 0x0010 /* Negative Denormal */ +#define _FPCLASS_NZ 0x0020 /* Negative Zero */ +#define _FPCLASS_PZ 0x0040 /* Positive Zero */ +#define _FPCLASS_PD 0x0080 /* Positive Denormal */ +#define _FPCLASS_PN 0x0100 /* Positive Normal */ +#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _EXCEPTION_DEFINED +#define _EXCEPTION_DEFINED + struct _exception { + int type; + char *name; + double arg1; + double arg2; + double retval; + }; +#endif + +#ifndef _COMPLEX_DEFINED +#define _COMPLEX_DEFINED + struct _complex { + double x,y; + }; +#endif + +#define EDOM 33 +#define ERANGE 34 + +#ifndef _HUGE +#ifdef _MSVCRT_ + extern double *_HUGE; +#else + extern double *_imp___HUGE; +#define _HUGE (*_imp___HUGE) +#endif +#endif + +#define HUGE_VAL _HUGE + +#ifndef _CRT_ABS_DEFINED +#define _CRT_ABS_DEFINED + int __cdecl abs(int _X); + long __cdecl labs(long _X); +#endif + double __cdecl acos(double _X); + double __cdecl asin(double _X); + double __cdecl atan(double _X); + double __cdecl atan2(double _Y,double _X); +#ifndef _SIGN_DEFINED +#define _SIGN_DEFINED + _CRTIMP double __cdecl _copysign (double _Number,double _Sign); + _CRTIMP double __cdecl _chgsign (double _X); +#endif + double __cdecl cos(double _X); + double __cdecl cosh(double _X); + double __cdecl exp(double _X); + double __cdecl expm1(double _X); + double __cdecl fabs(double _X); + double __cdecl fmod(double _X,double _Y); + double __cdecl log(double _X); + double __cdecl log10(double _X); + double __cdecl pow(double _X,double _Y); + double __cdecl sin(double _X); + double __cdecl sinh(double _X); + double __cdecl tan(double _X); + double __cdecl tanh(double _X); + double __cdecl sqrt(double _X); +#ifndef _CRT_ATOF_DEFINED +#define _CRT_ATOF_DEFINED + double __cdecl atof(const char *_String); + double __cdecl _atof_l(const char *_String,_locale_t _Locale); +#endif + + _CRTIMP double __cdecl _cabs(struct _complex _ComplexA); + double __cdecl ceil(double _X); + double __cdecl floor(double _X); + double __cdecl frexp(double _X,int *_Y); + double __cdecl _hypot(double _X,double _Y); + _CRTIMP double __cdecl _j0(double _X); + _CRTIMP double __cdecl _j1(double _X); + _CRTIMP double __cdecl _jn(int _X,double _Y); + double __cdecl ldexp(double _X,int _Y); +#ifndef _CRT_MATHERR_DEFINED +#define _CRT_MATHERR_DEFINED + int __cdecl _matherr(struct _exception *_Except); +#endif + double __cdecl modf(double _X,double *_Y); + _CRTIMP double __cdecl _y0(double _X); + _CRTIMP double __cdecl _y1(double _X); + _CRTIMP double __cdecl _yn(int _X,double _Y); + +#if(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _set_SSE2_enable(int _Flag); + /* from libmingwex */ + float __cdecl _hypotf(float _X,float _Y); +#endif + + float frexpf(float _X,int *_Y); + float __cdecl ldexpf(float _X,int _Y); + long double __cdecl ldexpl(long double _X,int _Y); + float __cdecl acosf(float _X); + float __cdecl asinf(float _X); + float __cdecl atanf(float _X); + float __cdecl atan2f(float _X,float _Y); + float __cdecl cosf(float _X); + float __cdecl sinf(float _X); + float __cdecl tanf(float _X); + float __cdecl coshf(float _X); + float __cdecl sinhf(float _X); + float __cdecl tanhf(float _X); + float __cdecl expf(float _X); + float __cdecl expm1f(float _X); + float __cdecl logf(float _X); + float __cdecl log10f(float _X); + float __cdecl modff(float _X,float *_Y); + float __cdecl powf(float _X,float _Y); + float __cdecl sqrtf(float _X); + float __cdecl ceilf(float _X); + float __cdecl floorf(float _X); + float __cdecl fmodf(float _X,float _Y); + float __cdecl _hypotf(float _X,float _Y); + float __cdecl fabsf(float _X); +#if !defined(__ia64__) + /* from libmingwex */ + float __cdecl _copysignf (float _Number,float _Sign); + float __cdecl _chgsignf (float _X); + float __cdecl _logbf(float _X); + float __cdecl _nextafterf(float _X,float _Y); + int __cdecl _finitef(float _X); + int __cdecl _isnanf(float _X); + int __cdecl _fpclassf(float _X); +#endif + +#ifndef __cplusplus + __CRT_INLINE long double __cdecl fabsl (long double x) + { + long double res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } +#define _hypotl(x,y) ((long double)_hypot((double)(x),(double)(y))) +#define _matherrl _matherr + __CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign((double)(_Number)); } + __CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign((double)(_Number),(double)(_Sign)); } + __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); } + +#if !defined (__ia64__) + __CRT_INLINE float __cdecl fabsf (float x) + { + float res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + + __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); } +#endif +#else + // cplusplus + __CRT_INLINE long double __cdecl fabsl (long double x) + { + long double res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + __CRT_INLINE long double modfl(long double _X,long double *_Y) { + double _Di,_Df = modf((double)_X,&_Di); + *_Y = (long double)_Di; + return (_Df); + } + __CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign(static_cast(_Number)); } + __CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign(static_cast(_Number),static_cast(_Sign)); } + __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); } +#ifndef __ia64__ + __CRT_INLINE float __cdecl fabsf (float x) + { + float res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); } +#ifndef __x86_64 + __CRT_INLINE float acosf(float _X) { return ((float)acos((double)_X)); } + __CRT_INLINE float asinf(float _X) { return ((float)asin((double)_X)); } + __CRT_INLINE float atanf(float _X) { return ((float)atan((double)_X)); } + __CRT_INLINE float atan2f(float _X,float _Y) { return ((float)atan2((double)_X,(double)_Y)); } + __CRT_INLINE float ceilf(float _X) { return ((float)ceil((double)_X)); } + __CRT_INLINE float cosf(float _X) { return ((float)cos((double)_X)); } + __CRT_INLINE float coshf(float _X) { return ((float)cosh((double)_X)); } + __CRT_INLINE float expf(float _X) { return ((float)exp((double)_X)); } + __CRT_INLINE float floorf(float _X) { return ((float)floor((double)_X)); } + __CRT_INLINE float fmodf(float _X,float _Y) { return ((float)fmod((double)_X,(double)_Y)); } + __CRT_INLINE float logf(float _X) { return ((float)log((double)_X)); } + __CRT_INLINE float log10f(float _X) { return ((float)log10((double)_X)); } + __CRT_INLINE float modff(float _X,float *_Y) { + double _Di,_Df = modf((double)_X,&_Di); + *_Y = (float)_Di; + return ((float)_Df); + } + __CRT_INLINE float powf(float _X,float _Y) { return ((float)pow((double)_X,(double)_Y)); } + __CRT_INLINE float sinf(float _X) { return ((float)sin((double)_X)); } + __CRT_INLINE float sinhf(float _X) { return ((float)sinh((double)_X)); } + __CRT_INLINE float sqrtf(float _X) { return ((float)sqrt((double)_X)); } + __CRT_INLINE float tanf(float _X) { return ((float)tan((double)_X)); } + __CRT_INLINE float tanhf(float _X) { return ((float)tanh((double)_X)); } +#endif +#endif +#endif + +#ifndef NO_OLDNAMES +#define matherr _matherr + +#define HUGE _HUGE + /* double __cdecl cabs(struct _complex _X); */ + double __cdecl hypot(double _X,double _Y); + _CRTIMP double __cdecl j0(double _X); + _CRTIMP double __cdecl j1(double _X); + _CRTIMP double __cdecl jn(int _X,double _Y); + _CRTIMP double __cdecl y0(double _X); + _CRTIMP double __cdecl y1(double _X); + _CRTIMP double __cdecl yn(int _X,double _Y); +#endif + +#ifndef __NO_ISOCEXT +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ + || !defined __STRICT_ANSI__ || defined __GLIBCPP__ + +#define NAN (0.0F/0.0F) +#define HUGE_VALF (1.0F/0.0F) +#define HUGE_VALL (1.0L/0.0L) +#define INFINITY (1.0F/0.0F) + + +#define FP_NAN 0x0100 +#define FP_NORMAL 0x0400 +#define FP_INFINITE (FP_NAN | FP_NORMAL) +#define FP_ZERO 0x4000 +#define FP_SUBNORMAL (FP_NORMAL | FP_ZERO) + /* 0x0200 is signbit mask */ + + + /* + We can't __CRT_INLINE float or double, because we want to ensure truncation + to semantic type before classification. + (A normal long double value might become subnormal when + converted to double, and zero when converted to float.) + */ + + extern int __cdecl __fpclassifyf (float); + extern int __cdecl __fpclassify (double); + extern int __cdecl __fpclassifyl (long double); + +/* Implemented at tcc/tcc_libm.h */ +#define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \ + : sizeof (x) == sizeof (double) ? __fpclassify (x) \ + : __fpclassifyl (x)) + + /* 7.12.3.2 */ +#define isfinite(x) ((fpclassify(x) & FP_NAN) == 0) + + /* 7.12.3.3 */ +#define isinf(x) (fpclassify(x) == FP_INFINITE) + + /* 7.12.3.4 */ + /* We don't need to worry about truncation here: + A NaN stays a NaN. */ +#define isnan(x) (fpclassify(x) == FP_NAN) + + /* 7.12.3.5 */ +#define isnormal(x) (fpclassify(x) == FP_NORMAL) + + /* 7.12.3.6 The signbit macro */ + + extern int __cdecl __signbitf (float); + extern int __cdecl __signbit (double); + extern int __cdecl __signbitl (long double); + +/* Implemented at tcc/tcc_libm.h */ +#define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \ + : sizeof (x) == sizeof (double) ? __signbit (x) \ + : __signbitl (x)) + + extern double __cdecl exp2(double); + extern float __cdecl exp2f(float); + extern long double __cdecl exp2l(long double); + +#define FP_ILOGB0 ((int)0x80000000) +#define FP_ILOGBNAN ((int)0x80000000) + extern int __cdecl ilogb (double); + extern int __cdecl ilogbf (float); + extern int __cdecl ilogbl (long double); + + extern double __cdecl log1p(double); + extern float __cdecl log1pf(float); + extern long double __cdecl log1pl(long double); + + extern double __cdecl log2 (double); + extern float __cdecl log2f (float); + extern long double __cdecl log2l (long double); + + extern double __cdecl logb (double); + extern float __cdecl logbf (float); + extern long double __cdecl logbl (long double); + + __CRT_INLINE double __cdecl logb (double x) + { + double res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } + + __CRT_INLINE float __cdecl logbf (float x) + { + float res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } + + __CRT_INLINE long double __cdecl logbl (long double x) + { + long double res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } + + extern long double __cdecl modfl (long double, long double*); + + /* 7.12.6.13 */ + extern double __cdecl scalbn (double, int); + extern float __cdecl scalbnf (float, int); + extern long double __cdecl scalbnl (long double, int); + + extern double __cdecl scalbln (double, long); + extern float __cdecl scalblnf (float, long); + extern long double __cdecl scalblnl (long double, long); + + /* 7.12.7.1 */ + /* Implementations adapted from Cephes versions */ + extern double __cdecl cbrt (double); + extern float __cdecl cbrtf (float); + extern long double __cdecl cbrtl (long double); + + __CRT_INLINE float __cdecl hypotf (float x, float y) + { return (float) hypot (x, y);} + extern long double __cdecl hypotl (long double, long double); + + extern long double __cdecl powl (long double, long double); + extern long double __cdecl expl(long double); + extern long double __cdecl expm1l(long double); + extern long double __cdecl coshl(long double); + extern long double __cdecl fabsl (long double); + extern long double __cdecl acosl(long double); + extern long double __cdecl asinl(long double); + extern long double __cdecl atanl(long double); + extern long double __cdecl atan2l(long double,long double); + extern long double __cdecl sinhl(long double); + extern long double __cdecl tanhl(long double); + + /* 7.12.8.1 The erf functions */ + extern double __cdecl erf (double); + extern float __cdecl erff (float); + /* TODO + extern long double __cdecl erfl (long double); + */ + + /* 7.12.8.2 The erfc functions */ + extern double __cdecl erfc (double); + extern float __cdecl erfcf (float); + /* TODO + extern long double __cdecl erfcl (long double); + */ + + /* 7.12.8.3 The lgamma functions */ + extern double __cdecl lgamma (double); + extern float __cdecl lgammaf (float); + extern long double __cdecl lgammal (long double); + + /* 7.12.8.4 The tgamma functions */ + extern double __cdecl tgamma (double); + extern float __cdecl tgammaf (float); + extern long double __cdecl tgammal (long double); + + extern long double __cdecl ceill (long double); + extern long double __cdecl floorl (long double); + extern long double __cdecl frexpl(long double,int *); + extern long double __cdecl log10l(long double); + extern long double __cdecl logl(long double); + extern long double __cdecl cosl(long double); + extern long double __cdecl sinl(long double); + extern long double __cdecl tanl(long double); + extern long double sqrtl(long double); + + /* 7.12.9.3 */ + extern double __cdecl nearbyint ( double); + extern float __cdecl nearbyintf (float); + extern long double __cdecl nearbyintl (long double); + + /* 7.12.9.4 */ + /* round, using fpu control word settings */ + __CRT_INLINE double __cdecl rint (double x) + { + double retval; + __asm__ ( + "fldl %1\n" + "frndint \n" + "fstl %0\n" : "=m" (retval) : "m" (x)); + return retval; + } + + __CRT_INLINE float __cdecl rintf (float x) + { + float retval; + __asm__ ( + "flds %1\n" + "frndint \n" + "fsts %0\n" : "=m" (retval) : "m" (x)); + return retval; + } + + __CRT_INLINE long double __cdecl rintl (long double x) + { + long double retval; + __asm__ ( + "fldt %1\n" + "frndint \n" + "fstt %0\n" : "=m" (retval) : "m" (x)); + return retval; + } + + /* 7.12.9.5 */ + __CRT_INLINE long __cdecl lrint (double x) + { + long retval; + __asm__ __volatile__ \ + ("fldl %1\n" \ + "fistpl %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long __cdecl lrintf (float x) + { + long retval; + __asm__ __volatile__ \ + ("flds %1\n" \ + "fistpl %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long __cdecl lrintl (long double x) + { + long retval; + __asm__ __volatile__ \ + ("fldt %1\n" \ + "fistpl %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long long __cdecl llrint (double x) + { + long long retval; + __asm__ __volatile__ \ + ("fldl %1\n" \ + "fistpll %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long long __cdecl llrintf (float x) + { + long long retval; + __asm__ __volatile__ \ + ("flds %1\n" \ + "fistpll %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long long __cdecl llrintl (long double x) + { + long long retval; + __asm__ __volatile__ \ + ("fldt %1\n" \ + "fistpll %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + #define FE_TONEAREST 0x0000 + #define FE_DOWNWARD 0x0400 + #define FE_UPWARD 0x0800 + #define FE_TOWARDZERO 0x0c00 + + __CRT_INLINE double trunc (double _x) + { + double retval; + unsigned short saved_cw; + unsigned short tmp_cw; + __asm__ ("fnstcw %0;" : "=m" (saved_cw)); /* save FPU control word */ + tmp_cw = (saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)) + | FE_TOWARDZERO; + __asm__ ("fldcw %0;" : : "m" (tmp_cw)); + __asm__ ("fldl %1;" + "frndint;" + "fstl %0;" : "=m" (retval) : "m" (_x)); /* round towards zero */ + __asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */ + return retval; + } + + /* 7.12.9.6 */ + /* round away from zero, regardless of fpu control word settings */ + extern double __cdecl round (double); + extern float __cdecl roundf (float); + extern long double __cdecl roundl (long double); + + /* 7.12.9.7 */ + extern long __cdecl lround (double); + extern long __cdecl lroundf (float); + extern long __cdecl lroundl (long double); + + extern long long __cdecl llround (double); + extern long long __cdecl llroundf (float); + extern long long __cdecl llroundl (long double); + + /* 7.12.9.8 */ + /* round towards zero, regardless of fpu control word settings */ + extern double __cdecl trunc (double); + extern float __cdecl truncf (float); + extern long double __cdecl truncl (long double); + + extern long double __cdecl fmodl (long double, long double); + + /* 7.12.10.2 */ + extern double __cdecl remainder (double, double); + extern float __cdecl remainderf (float, float); + extern long double __cdecl remainderl (long double, long double); + + /* 7.12.10.3 */ + extern double __cdecl remquo(double, double, int *); + extern float __cdecl remquof(float, float, int *); + extern long double __cdecl remquol(long double, long double, int *); + + /* 7.12.11.1 */ + extern double __cdecl copysign (double, double); /* in libmoldname.a */ + extern float __cdecl copysignf (float, float); + extern long double __cdecl copysignl (long double, long double); + + /* 7.12.11.2 Return a NaN */ + extern double __cdecl nan(const char *tagp); + extern float __cdecl nanf(const char *tagp); + extern long double __cdecl nanl(const char *tagp); + +#ifndef __STRICT_ANSI__ +#define _nan() nan("") +#define _nanf() nanf("") +#define _nanl() nanl("") +#endif + + /* 7.12.11.3 */ + extern double __cdecl nextafter (double, double); /* in libmoldname.a */ + extern float __cdecl nextafterf (float, float); + extern long double __cdecl nextafterl (long double, long double); + + /* 7.12.11.4 The nexttoward functions: TODO */ + + /* 7.12.12.1 */ + /* x > y ? (x - y) : 0.0 */ + extern double __cdecl fdim (double x, double y); + extern float __cdecl fdimf (float x, float y); + extern long double __cdecl fdiml (long double x, long double y); + + /* fmax and fmin. + NaN arguments are treated as missing data: if one argument is a NaN + and the other numeric, then these functions choose the numeric + value. */ + + /* 7.12.12.2 */ + extern double __cdecl fmax (double, double); + extern float __cdecl fmaxf (float, float); + extern long double __cdecl fmaxl (long double, long double); + + /* 7.12.12.3 */ + extern double __cdecl fmin (double, double); + extern float __cdecl fminf (float, float); + extern long double __cdecl fminl (long double, long double); + + /* 7.12.13.1 */ + /* return x * y + z as a ternary op */ + extern double __cdecl fma (double, double, double); + extern float __cdecl fmaf (float, float, float); + extern long double __cdecl fmal (long double, long double, long double); + + +#if 0 // gr: duplicate, see below + /* 7.12.14 */ + /* + * With these functions, comparisons involving quiet NaNs set the FP + * condition code to "unordered". The IEEE floating-point spec + * dictates that the result of floating-point comparisons should be + * false whenever a NaN is involved, with the exception of the != op, + * which always returns true: yes, (NaN != NaN) is true). + */ + +#if __GNUC__ >= 3 + +#define isgreater(x, y) __builtin_isgreater(x, y) +#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) +#define isless(x, y) __builtin_isless(x, y) +#define islessequal(x, y) __builtin_islessequal(x, y) +#define islessgreater(x, y) __builtin_islessgreater(x, y) +#define isunordered(x, y) __builtin_isunordered(x, y) + +#else + /* helper */ + __CRT_INLINE int __cdecl + __fp_unordered_compare (long double x, long double y){ + unsigned short retval; + __asm__ ("fucom %%st(1);" + "fnstsw;": "=a" (retval) : "t" (x), "u" (y)); + return retval; + } + +#define isgreater(x, y) ((__fp_unordered_compare(x, y) \ + & 0x4500) == 0) +#define isless(x, y) ((__fp_unordered_compare (y, x) \ + & 0x4500) == 0) +#define isgreaterequal(x, y) ((__fp_unordered_compare (x, y) \ + & FP_INFINITE) == 0) +#define islessequal(x, y) ((__fp_unordered_compare(y, x) \ + & FP_INFINITE) == 0) +#define islessgreater(x, y) ((__fp_unordered_compare(x, y) \ + & FP_SUBNORMAL) == 0) +#define isunordered(x, y) ((__fp_unordered_compare(x, y) \ + & 0x4500) == 0x4500) + +#endif +#endif //0 + + +#endif /* __STDC_VERSION__ >= 199901L */ +#endif /* __NO_ISOCEXT */ + +#ifdef __cplusplus +} +extern "C++" { + template inline _Ty _Pow_int(_Ty _X,int _Y) { + unsigned int _N; + if(_Y >= 0) _N = (unsigned int)_Y; + else _N = (unsigned int)(-_Y); + for(_Ty _Z = _Ty(1);;_X *= _X) { + if((_N & 1)!=0) _Z *= _X; + if((_N >>= 1)==0) return (_Y < 0 ? _Ty(1) / _Z : _Z); + } + } +} +#endif + +#pragma pack(pop) + +/* 7.12.14 */ +/* + * With these functions, comparisons involving quiet NaNs set the FP + * condition code to "unordered". The IEEE floating-point spec + * dictates that the result of floating-point comparisons should be + * false whenever a NaN is involved, with the exception of the != op, + * which always returns true: yes, (NaN != NaN) is true). + */ + +/* Mini libm (inline __fpclassify*, __signbit* and variants) */ +#include "tcc/tcc_libm.h" + +#endif /* End _MATH_H_ */ + diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/mem.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/mem.h new file mode 100644 index 00000000..25520235 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/mem.h @@ -0,0 +1,13 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * This file is part of the Mingw32 package. + * + * mem.h maps to string.h + */ +#ifndef __STRICT_ANSI__ +#include +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/memory.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/memory.h new file mode 100644 index 00000000..90d88aed --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/memory.h @@ -0,0 +1,40 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_MEMORY +#define _INC_MEMORY + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CONST_RETURN +#define _CONST_RETURN +#endif + +#define _WConst_return _CONST_RETURN + +#ifndef _CRT_MEMORY_DEFINED +#define _CRT_MEMORY_DEFINED + _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); + _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); + _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); + _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); + int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); + void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); + void *__cdecl memset(void *_Dst,int _Val,size_t _Size); + +#ifndef NO_OLDNAMES + void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); + int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/process.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/process.h new file mode 100644 index 00000000..dadaf2b7 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/process.h @@ -0,0 +1,176 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_PROCESS +#define _INC_PROCESS + +#include <_mingw.h> + +/* Includes a definition of _pid_t and pid_t */ +#include + +#ifndef _POSIX_ +#ifdef __cplusplus +extern "C" { +#endif + +#define _P_WAIT 0 +#define _P_NOWAIT 1 +#define _OLD_P_OVERLAY 2 +#define _P_NOWAITO 3 +#define _P_DETACH 4 +#define _P_OVERLAY 2 + +#define _WAIT_CHILD 0 +#define _WAIT_GRANDCHILD 1 + + _CRTIMP uintptr_t __cdecl _beginthread(void (__cdecl *_StartAddress) (void *),unsigned _StackSize,void *_ArgList); + _CRTIMP void __cdecl _endthread(void); + _CRTIMP uintptr_t __cdecl _beginthreadex(void *_Security,unsigned _StackSize,unsigned (__stdcall *_StartAddress) (void *),void *_ArgList,unsigned _InitFlag,unsigned *_ThrdAddr); + _CRTIMP void __cdecl _endthreadex(unsigned _Retval); + +#ifndef _CRT_TERMINATE_DEFINED +#define _CRT_TERMINATE_DEFINED + void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; + _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; + +#pragma push_macro("abort") +#undef abort + void __cdecl __declspec(noreturn) abort(void); +#pragma pop_macro("abort") + +#endif + + _CRTIMP void __cdecl __MINGW_NOTHROW _cexit(void); + _CRTIMP void __cdecl __MINGW_NOTHROW _c_exit(void); + _CRTIMP int __cdecl _getpid(void); + _CRTIMP intptr_t __cdecl _cwait(int *_TermStat,intptr_t _ProcHandle,int _Action); + _CRTIMP intptr_t __cdecl _execl(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execle(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execlp(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execlpe(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execv(const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _execve(const char *_Filename,const char *const *_ArgList,const char *const *_Env); + _CRTIMP intptr_t __cdecl _execvp(const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _execvpe(const char *_Filename,const char *const *_ArgList,const char *const *_Env); + _CRTIMP intptr_t __cdecl _spawnl(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnle(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnlp(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnlpe(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _spawnve(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); + _CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _spawnvpe(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); + +#ifndef _CRT_SYSTEM_DEFINED +#define _CRT_SYSTEM_DEFINED + int __cdecl system(const char *_Command); +#endif + +#ifndef _WPROCESS_DEFINED +#define _WPROCESS_DEFINED + _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif +#endif + + void __cdecl __security_init_cookie(void); +#if (defined(_X86_) && !defined(__x86_64)) + void __fastcall __security_check_cookie(uintptr_t _StackCookie); + __declspec(noreturn) void __cdecl __report_gsfailure(void); +#else + void __cdecl __security_check_cookie(uintptr_t _StackCookie); + __declspec(noreturn) void __cdecl __report_gsfailure(uintptr_t _StackCookie); +#endif + extern uintptr_t __security_cookie; + + intptr_t __cdecl _loaddll(char *_Filename); + int __cdecl _unloaddll(intptr_t _Handle); + int (__cdecl *__cdecl _getdllprocaddr(intptr_t _Handle,char *_ProcedureName,intptr_t _Ordinal))(void); + +#ifdef _DECL_DLLMAIN +#ifdef _WINDOWS_ + WINBOOL WINAPI DllMain(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); + WINBOOL WINAPI _CRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); + WINBOOL WINAPI _wCRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); + extern WINBOOL (WINAPI *const _pRawDllMain)(HANDLE,DWORD,LPVOID); +#else + int __stdcall DllMain(void *_HDllHandle,unsigned _Reason,void *_Reserved); + int __stdcall _CRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); + int __stdcall _wCRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); + extern int (__stdcall *const _pRawDllMain)(void *,unsigned,void *); +#endif +#endif + +#ifndef NO_OLDNAMES +#define P_WAIT _P_WAIT +#define P_NOWAIT _P_NOWAIT +#define P_OVERLAY _P_OVERLAY +#define OLD_P_OVERLAY _OLD_P_OVERLAY +#define P_NOWAITO _P_NOWAITO +#define P_DETACH _P_DETACH +#define WAIT_CHILD _WAIT_CHILD +#define WAIT_GRANDCHILD _WAIT_GRANDCHILD + + intptr_t __cdecl cwait(int *_TermStat,intptr_t _ProcHandle,int _Action); +#ifdef __GNUC__ + int __cdecl execl(const char *_Filename,const char *_ArgList,...); + int __cdecl execle(const char *_Filename,const char *_ArgList,...); + int __cdecl execlp(const char *_Filename,const char *_ArgList,...); + int __cdecl execlpe(const char *_Filename,const char *_ArgList,...); +#else + intptr_t __cdecl execl(const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl execle(const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl execlp(const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl execlpe(const char *_Filename,const char *_ArgList,...); +#endif + intptr_t __cdecl spawnl(int,const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl spawnle(int,const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl spawnlp(int,const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl spawnlpe(int,const char *_Filename,const char *_ArgList,...); + int __cdecl getpid(void); +#ifdef __GNUC__ + /* Those methods are predefined by gcc builtins to return int. So to prevent + stupid warnings, define them in POSIX way. This is save, because those + methods do not return in success case, so that the return value is not + really dependent to its scalar width. */ + int __cdecl execv(const char *_Filename,const char *const _ArgList[]); + int __cdecl execve(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); + int __cdecl execvp(const char *_Filename,const char *const _ArgList[]); + int __cdecl execvpe(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); +#else + intptr_t __cdecl execv(const char *_Filename,const char *const _ArgList[]); + intptr_t __cdecl execve(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); + intptr_t __cdecl execvp(const char *_Filename,const char *const _ArgList[]); + intptr_t __cdecl execvpe(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); +#endif + intptr_t __cdecl spawnv(int,const char *_Filename,const char *const _ArgList[]); + intptr_t __cdecl spawnve(int,const char *_Filename,const char *const _ArgList[],const char *const _Env[]); + intptr_t __cdecl spawnvp(int,const char *_Filename,const char *const _ArgList[]); + intptr_t __cdecl spawnvpe(int,const char *_Filename,const char *const _ArgList[],char *const _Env[]); +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/conio_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/conio_s.h new file mode 100644 index 00000000..98d97ba2 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/conio_s.h @@ -0,0 +1,42 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _INC_CONIO_S +#define _INC_CONIO_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _cgets_s(char *_Buffer,size_t _Size,size_t *_SizeRead); + _CRTIMP int __cdecl _cprintf_s(const char *_Format,...); + _CRTIMP int __cdecl _cscanf_s(const char *_Format,...); + _CRTIMP int __cdecl _cscanf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_s(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + +#ifndef _WCONIO_DEFINED_S +#define _WCONIO_DEFINED_S + _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); + _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/crtdbg_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/crtdbg_s.h new file mode 100644 index 00000000..4598b4f7 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/crtdbg_s.h @@ -0,0 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _INC_CRTDBG_S +#define _INC_CRTDBG_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#define _dupenv_s_dbg(ps1,size,s2,t,f,l) _dupenv_s(ps1,size,s2) +#define _wdupenv_s_dbg(ps1,size,s2,t,f,l) _wdupenv_s(ps1,size,s2) + +#endif + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/io_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/io_s.h new file mode 100644 index 00000000..ec565a61 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/io_s.h @@ -0,0 +1,33 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_IO_S +#define _INC_IO_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _access_s(const char *_Filename,int _AccessMode); + _CRTIMP errno_t __cdecl _chsize_s(int _FileHandle,__int64 _Size); + _CRTIMP errno_t __cdecl _mktemp_s(char *_TemplateName,size_t _Size); + _CRTIMP errno_t __cdecl _umask_s(int _NewMode,int *_OldMode); + +#ifndef _WIO_S_DEFINED +#define _WIO_S_DEFINED + _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); + _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/mbstring_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/mbstring_s.h new file mode 100644 index 00000000..6b2b188f --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/mbstring_s.h @@ -0,0 +1,52 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_MBSTRING_S +#define _INC_MBSTRING_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _MBSTRING_S_DEFINED +#define _MBSTRING_S_DEFINED + _CRTIMP errno_t __cdecl _mbscat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); + _CRTIMP errno_t __cdecl _mbscat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbscpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); + _CRTIMP errno_t __cdecl _mbscpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbslwr_s(unsigned char *_Str,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _mbslwr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnbcat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnbcat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnbcpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnbcpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnbset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnbset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsncat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsncat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsncpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsncpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val); + _CRTIMP errno_t __cdecl _mbsset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbstok_s(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context); + _CRTIMP unsigned char *__cdecl _mbstok_s_l(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsupr_s(unsigned char *_Str,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _mbsupr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbccpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src); + _CRTIMP errno_t __cdecl _mbccpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src,_locale_t _Locale); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/search_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/search_s.h new file mode 100644 index 00000000..cae89989 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/search_s.h @@ -0,0 +1,25 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SEARCH_S +#define _INC_SEARCH_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP void *__cdecl _lfind_s(const void *_Key,const void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); + _CRTIMP void *__cdecl _lsearch_s(const void *_Key,void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/stdio_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/stdio_s.h new file mode 100644 index 00000000..c9b803b1 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/stdio_s.h @@ -0,0 +1,145 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDIO_S +#define _INC_STDIO_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _STDIO_S_DEFINED +#define _STDIO_S_DEFINED + _CRTIMP errno_t __cdecl clearerr_s(FILE *_File); + int __cdecl fprintf_s(FILE *_File,const char *_Format,...); + size_t __cdecl fread_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File); + _CRTIMP int __cdecl _fscanf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + int __cdecl printf_s(const char *_Format,...); + _CRTIMP int __cdecl _scanf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scanf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _snprintf_c(char *_DstBuf,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _vsnprintf_c(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); + int __cdecl sprintf_s(char *_DstBuf,size_t _DstSize,const char *_Format,...); + _CRTIMP int __cdecl _fscanf_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _sscanf_l(const char *_Src,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _sscanf_s_l(const char *_Src,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snscanf_s(const char *_Src,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _snscanf_l(const char *_Src,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snscanf_s_l(const char *_Src,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + int __cdecl vfprintf_s(FILE *_File,const char *_Format,va_list _ArgList); + int __cdecl vprintf_s(const char *_Format,va_list _ArgList); + int __cdecl vsnprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vsnprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,va_list _ArgList); + int __cdecl vsprintf_s(char *_DstBuf,size_t _Size,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _fprintf_p(FILE *_File,const char *_Format,...); + _CRTIMP int __cdecl _printf_p(const char *_Format,...); + _CRTIMP int __cdecl _sprintf_p(char *_Dst,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _vfprintf_p(FILE *_File,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vprintf_p(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vsprintf_p(char *_Dst,size_t _MaxCount,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _scprintf_p(const char *_Format,...); + _CRTIMP int __cdecl _vscprintf_p(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _printf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _printf_p_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fprintf_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _fprintf_p_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfprintf_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vfprintf_p_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _sprintf_l(char *_DstBuf,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _sprintf_p_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsprintf_l(char *_DstBuf,const char *_Format,_locale_t,va_list _ArgList); + _CRTIMP int __cdecl _vsprintf_p_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _scprintf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scprintf_p_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vscprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vscprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _printf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fprintf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfprintf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _sprintf_s_l(char *_DstBuf,size_t _DstSize,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsprintf_s_l(char *_DstBuf,size_t _DstSize,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snprintf_s_l(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnprintf_s_l(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snprintf_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snprintf_c_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnprintf_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vsnprintf_c_l(char *_DstBuf,size_t _MaxCount,const char *,_locale_t _Locale,va_list _ArgList); + +#ifndef _WSTDIO_S_DEFINED +#define _WSTDIO_S_DEFINED + _CRTIMP wchar_t *__cdecl _getws_s(wchar_t *_Str,size_t _SizeInWords); + int __cdecl fwprintf_s(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf_s(const wchar_t *_Format,...); + int __cdecl vwprintf_s(const wchar_t *_Format,va_list _ArgList); + int __cdecl swprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,...); + int __cdecl vswprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwscanf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swscanf_s_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf_s(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf_s_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP errno_t __cdecl _wfopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP errno_t __cdecl _wfreopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); + _CRTIMP errno_t __cdecl _wtmpnam_s(wchar_t *_DstBuf,size_t _SizeInWords); + _CRTIMP int __cdecl _fwprintf_p(FILE *_File,const wchar_t *_Format,...); + _CRTIMP int __cdecl _wprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vfwprintf_p(FILE *_File,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vscwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _fwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vfwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vswprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vscwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl __swprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,...); + _CRTIMP int __cdecl __vswprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,va_list _Args); + _CRTIMP int __cdecl _vscwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwscanf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swscanf_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wscanf_l(const wchar_t *_Format,_locale_t _Locale,...); +#endif +#endif + + _CRTIMP size_t __cdecl _fread_nolock_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File); + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/stdlib_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/stdlib_s.h new file mode 100644 index 00000000..f98262cc --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/stdlib_s.h @@ -0,0 +1,67 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDLIB_S +#define _INC_STDLIB_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _dupenv_s(char **_PBuffer,size_t *_PBufferSizeInBytes,const char *_VarName); + _CRTIMP errno_t __cdecl _itoa_s(int _Value,char *_DstBuf,size_t _Size,int _Radix); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _i64toa_s(__int64 _Val,char *_DstBuf,size_t _Size,int _Radix); + _CRTIMP errno_t __cdecl _ui64toa_s(unsigned __int64 _Val,char *_DstBuf,size_t _Size,int _Radix); +#endif + _CRTIMP errno_t __cdecl _ltoa_s(long _Val,char *_DstBuf,size_t _Size,int _Radix); + _CRTIMP errno_t __cdecl mbstowcs_s(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbstowcs_s_l(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _ultoa_s(unsigned long _Val,char *_DstBuf,size_t _Size,int _Radix); + _CRTIMP errno_t __cdecl _wctomb_s_l(int *_SizeConverted,char *_MbCh,size_t _SizeInBytes,wchar_t _WCh,_locale_t _Locale); + _CRTIMP errno_t __cdecl wcstombs_s(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes); + _CRTIMP errno_t __cdecl _wcstombs_s_l(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes,_locale_t _Locale); + +#ifndef _WSTDLIB_S_DEFINED +#define _WSTDLIB_S_DEFINED + _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); + _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); +#endif +#endif + +#ifndef _POSIX_ + _CRTIMP errno_t __cdecl _ecvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDights,int *_PtDec,int *_PtSign); + _CRTIMP errno_t __cdecl _fcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); + _CRTIMP errno_t __cdecl _gcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDigits); + _CRTIMP errno_t __cdecl _makepath_s(char *_PathResult,size_t _Size,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); + _CRTIMP errno_t __cdecl _putenv_s(const char *_Name,const char *_Value); + _CRTIMP errno_t __cdecl _searchenv_s(const char *_Filename,const char *_EnvVar,char *_ResultPath,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _splitpath_s(const char *_FullPath,char *_Drive,size_t _DriveSize,char *_Dir,size_t _DirSize,char *_Filename,size_t _FilenameSize,char *_Ext,size_t _ExtSize); + +#ifndef _WSTDLIBP_S_DEFINED +#define _WSTDLIBP_S_DEFINED + _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); + _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); + _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/stralign_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/stralign_s.h new file mode 100644 index 00000000..5b78f586 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/stralign_s.h @@ -0,0 +1,30 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef __STRALIGN_H_S_ +#define __STRALIGN_H_S_ + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(I_X86_) && defined(_WSTRING_S_DEFINED) +#if defined(__cplusplus) && defined(_WConst_Return) + static __inline PUWSTR ua_wcscpy_s(PUWSTR Destination,size_t DestinationSize,PCUWSTR Source) { + if(WSTR_ALIGNED(Source) && WSTR_ALIGNED(Destination)) return (wcscpy_s((PWSTR)Destination,DestinationSize,(PCWSTR)Source)==0 ? Destination : NULL); + return uaw_wcscpy((PCUWSTR)String,Character); + } +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/string_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/string_s.h new file mode 100644 index 00000000..9db70e77 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/string_s.h @@ -0,0 +1,41 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STRING_S +#define _INC_STRING_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _strset_s(char *_Dst,size_t _DstSize,int _Value); + _CRTIMP errno_t __cdecl _strerror_s(char *_Buf,size_t _SizeInBytes,const char *_ErrMsg); + _CRTIMP errno_t __cdecl _strlwr_s(char *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _strlwr_s_l(char *_Str,size_t _Size,_locale_t _Locale); + _CRTIMP errno_t __cdecl _strnset_s(char *_Str,size_t _Size,int _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _strupr_s(char *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _strupr_s_l(char *_Str,size_t _Size,_locale_t _Locale); +#ifndef _WSTRING_S_DEFINED +#define _WSTRING_S_DEFINED + _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); + _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); + _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); + _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); + _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); + _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/sys/timeb_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/sys/timeb_s.h new file mode 100644 index 00000000..af5ef098 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/sys/timeb_s.h @@ -0,0 +1,34 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _TIMEB_H_S +#define _TIMEB_H_S + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef _USE_32BIT_TIME_T +#define _ftime_s _ftime32_s +#else +#define _ftime_s _ftime64_s +#endif + + _CRTIMP errno_t __cdecl _ftime32_s(struct __timeb32 *_Time); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _ftime64_s(struct __timeb64 *_Time); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/tchar_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/tchar_s.h new file mode 100644 index 00000000..343d348e --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/tchar_s.h @@ -0,0 +1,266 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_TCHAR_S +#define _INC_TCHAR_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _UNICODE + +#define _tprintf_s wprintf_s +#define _tprintf_s_l _wprintf_s_l +#define _tcprintf_s _cwprintf_s +#define _tcprintf_s_l _cwprintf_s_l +#define _vtcprintf_s _vcwprintf_s +#define _vtcprintf_s_l _vcwprintf_s_l +#define _ftprintf_s fwprintf_s +#define _ftprintf_s_l _fwprintf_s_l +#define _stprintf_s swprintf_s +#define _stprintf_s_l _swprintf_s_l +#define _sntprintf_s _snwprintf_s +#define _sntprintf_s_l _snwprintf_s_l +#define _vtprintf_s vwprintf_s +#define _vtprintf_s_l _vwprintf_s_l +#define _vftprintf_s vfwprintf_s +#define _vftprintf_s_l _vfwprintf_s_l +#define _vstprintf_s vswprintf_s +#define _vstprintf_s_l _vswprintf_s_l +#define _vsntprintf_s _vsnwprintf_s +#define _vsntprintf_s_l _vsnwprintf_s_l + +#define _tscanf_s wscanf_s +#define _tscanf_s_l _wscanf_s_l +#define _tcscanf_s _cwscanf_s +#define _tcscanf_s_l _cwscanf_s_l +#define _ftscanf_s fwscanf_s +#define _ftscanf_s_l _fwscanf_s_l +#define _stscanf_s swscanf_s +#define _stscanf_s_l _swscanf_s_l +#define _sntscanf_s _snwscanf_s +#define _sntscanf_s_l _snwscanf_s_l + +#define _cgetts_s _cgetws_s +#define _getts_s _getws_s + +#define _itot_s _itow_s +#define _ltot_s _ltow_s +#define _ultot_s _ultow_s +#define _i64tot_s _i64tow_s +#define _ui64tot_s _ui64tow_s + +#define _tcscat_s wcscat_s +#define _tcscpy_s wcscpy_s +#define _tcsncat_s wcsncat_s +#define _tcsncat_s_l _wcsncat_s_l +#define _tcsncpy_s wcsncpy_s +#define _tcsncpy_s_l _wcsncpy_s_l +#define _tcstok_s wcstok_s +#define _tcstok_s_l _wcstok_s_l +#define _tcserror_s _wcserror_s +#define __tcserror_s __wcserror_s + +#define _tcsnset_s _wcsnset_s +#define _tcsnset_s_l _wcsnset_s_l +#define _tcsset_s _wcsset_s +#define _tcsset_s_l _wcsset_s_l + +#define _tasctime_s _wasctime_s +#define _tctime_s _wctime_s +#define _tctime32_s _wctime32_s +#define _tctime64_s _wctime64_s +#define _tstrdate_s _wstrdate_s +#define _tstrtime_s _wstrtime_s + +#define _tgetenv_s _wgetenv_s +#define _tdupenv_s _wdupenv_s +#define _tmakepath_s _wmakepath_s +#define _tputenv_s _wputenv_s +#define _tsearchenv_s _wsearchenv_s +#define _tsplitpath_s _wsplitpath_s + +#define _tfopen_s _wfopen_s +#define _tfreopen_s _wfreopen_s +#define _ttmpnam_s _wtmpnam_s +#define _taccess_s _waccess_s +#define _tmktemp_s _wmktemp_s + +#define _tcsnccat_s wcsncat_s +#define _tcsnccat_s_l _wcsncat_s_l +#define _tcsnccpy_s wcsncpy_s +#define _tcsnccpy_s_l _wcsncpy_s_l + +#define _tcslwr_s _wcslwr_s +#define _tcslwr_s_l _wcslwr_s_l +#define _tcsupr_s _wcsupr_s +#define _tcsupr_s_l _wcsupr_s_l + +#define _wcstok_s_l(_String,_Delimiters,_Current_position,_Locale) (wcstok_s(_String,_Delimiters,_Current_position)) +#define _wcsnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_wcsnset_s(_Destination,_Destination_size_chars,_Value,_Count)) +#define _wcsset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_wcsset_s(_Destination,_Destination_size_chars,_Value)) + +#else + +#define _tprintf_s printf_s +#define _tprintf_s_l _printf_s_l +#define _tcprintf_s _cprintf_s +#define _tcprintf_s_l _cprintf_s_l +#define _vtcprintf_s _vcprintf_s +#define _vtcprintf_s_l _vcprintf_s_l +#define _ftprintf_s fprintf_s +#define _ftprintf_s_l _fprintf_s_l +#define _stprintf_s sprintf_s +#define _stprintf_s_l _sprintf_s_l +#define _sntprintf_s _snprintf_s +#define _sntprintf_s_l _snprintf_s_l +#define _vtprintf_s vprintf_s +#define _vtprintf_s_l _vprintf_s_l +#define _vftprintf_s vfprintf_s +#define _vftprintf_s_l _vfprintf_s_l +#define _vstprintf_s vsprintf_s +#define _vstprintf_s_l _vsprintf_s_l +#define _vsntprintf_s _vsnprintf_s +#define _vsntprintf_s_l _vsnprintf_s_l +#define _tscanf_s scanf_s +#define _tscanf_s_l _scanf_s_l +#define _tcscanf_s _cscanf_s +#define _tcscanf_s_l _cscanf_s_l +#define _ftscanf_s fscanf_s +#define _ftscanf_s_l _fscanf_s_l +#define _stscanf_s sscanf_s +#define _stscanf_s_l _sscanf_s_l +#define _sntscanf_s _snscanf_s +#define _sntscanf_s_l _snscanf_s_l + +#define _getts_s gets_s +#define _cgetts_s _cgets_s +#define _itot_s _itoa_s +#define _ltot_s _ltoa_s +#define _ultot_s _ultoa_s +#define _i64tot_s _i64toa_s +#define _ui64tot_s _ui64toa_s + +#define _tcscat_s strcat_s +#define _tcscpy_s strcpy_s +#define _tcserror_s strerror_s +#define __tcserror_s _strerror_s + +#define _tasctime_s asctime_s +#define _tctime_s ctime_s +#define _tctime32_s _ctime32_s +#define _tctime64_s _ctime64_s +#define _tstrdate_s _strdate_s +#define _tstrtime_s _strtime_s + +#define _tgetenv_s getenv_s +#define _tdupenv_s _dupenv_s +#define _tmakepath_s _makepath_s +#define _tputenv_s _putenv_s +#define _tsearchenv_s _searchenv_s +#define _tsplitpath_s _splitpath_s + +#define _tfopen_s fopen_s +#define _tfreopen_s freopen_s +#define _ttmpnam_s tmpnam_s +#define _tmktemp_s _mktemp_s + +#ifndef _POSIX_ +#define _taccess_s _access_s +#endif + +#define _tsopen_s _sopen_s + +#ifdef _MBCS + +#ifdef _MB_MAP_DIRECT + +#define _tcsncat_s _mbsnbcat_s +#define _tcsncat_s_l _mbsnbcat_s_l +#define _tcsncpy_s _mbsnbcpy_s +#define _tcsncpy_s_l _mbsnbcpy_s_l +#define _tcstok_s _mbstok_s +#define _tcstok_s_l _mbstok_s_l + +#define _tcsnset_s _mbsnbset_s +#define _tcsnset_s_l _mbsnbset_s_l +#define _tcsset_s _mbsset_s +#define _tcsset_s_l _mbsset_s_l + +#define _tcsnccat_s _mbsncat_s +#define _tcsnccat_s_l _mbsncat_s_l +#define _tcsnccpy_s _mbsncpy_s +#define _tcsnccpy_s_l _mbsncpy_s_l +#define _tcsncset_s _mbsnset_s +#define _tcsncset_s_l _mbsnset_s_l + +#define _tcslwr_s _mbslwr_s +#define _tcslwr_s_l _mbslwr_s_l +#define _tcsupr_s _mbsupr_s +#define _tcsupr_s_l _mbsupr_s_l + +#define _tccpy_s _mbccpy_s +#define _tccpy_s_l _mbccpy_s_l +#else + + _CRTIMP char *__cdecl _tcsncat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsncpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcstok_s(char *_Str,const char *_Delim,char **_Context); + _CRTIMP char *__cdecl _tcstok_s_l(char *_Str,const char *_Delim,char **_Context,_locale_t _Locale); + _CRTIMP errno_t __cdecl _tcsset_s(char *_Str,size_t _SizeInChars,unsigned int _Val); + _CRTIMP errno_t __cdecl _tcsset_s_l(char *_Str,size_t _SizeInChars,unsigned int,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcslwr_s(char *_Str,size_t _SizeInChars); + _CRTIMP char *__cdecl _tcslwr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsupr_s(char *_Str,size_t _SizeInChars); + _CRTIMP char *__cdecl _tcsupr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale); + +#endif + +#else + +#define _tcsncat_s strncat_s +#define _tcsncat_s_l _strncat_s_l +#define _tcsncpy_s strncpy_s +#define _tcsncpy_s_l _strncpy_s_l +#define _tcstok_s strtok_s +#define _tcstok_s_l _strtok_s_l + +#define _tcsnset_s _strnset_s +#define _tcsnset_s_l _strnset_s_l +#define _tcsset_s _strset_s +#define _tcsset_s _strset_s +#define _tcsset_s_l _strset_s_l + +#define _tcsnccat_s strncat_s +#define _tcsnccat_s_l _strncat_s_l +#define _tcsnccpy_s strncpy_s +#define _tcsnccpy_s_l _strncpy_s_l + +#define _tcslwr_s _strlwr_s +#define _tcslwr_s_l _strlwr_s_l +#define _tcsupr_s _strupr_s +#define _tcsupr_s_l _strupr_s_l + +#define _strnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_strnset_s(_Destination,_Destination_size_chars,_Value,_Count)) +#define _strset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_strset_s(_Destination,_Destination_size_chars,_Value)) +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/time_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/time_s.h new file mode 100644 index 00000000..9603b94f --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/time_s.h @@ -0,0 +1,61 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _TIME_H__S +#define _TIME_H__S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _ctime32_s(char *_Buf,size_t _SizeInBytes,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _gmtime32_s(struct tm *_Tm,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _localtime32_s(struct tm *_Tm,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _strdate_s(char *_Buf,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _strtime_s(char *_Buf ,size_t _SizeInBytes); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _ctime64_s(char *_Buf,size_t _SizeInBytes,const __time64_t *_Time); + _CRTIMP errno_t __cdecl _gmtime64_s(struct tm *_Tm,const __time64_t *_Time); + _CRTIMP errno_t __cdecl _localtime64_s(struct tm *_Tm,const __time64_t *_Time); +#endif + +#ifndef _WTIME_S_DEFINED +#define _WTIME_S_DEFINED + _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); + _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) +#define _INC_WTIME_S_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } +#else +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } +#endif +#endif +#endif + +#ifndef RC_INVOKED +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); } +#else +__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); } +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/wchar_s.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/wchar_s.h new file mode 100644 index 00000000..94251aa8 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sec_api/wchar_s.h @@ -0,0 +1,128 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_WCHAR_S +#define _INC_WCHAR_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WIO_S_DEFINED +#define _WIO_S_DEFINED + _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); + _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); +#endif + +#ifndef _WCONIO_S_DEFINED +#define _WCONIO_S_DEFINED + _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); + _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); +#endif + +#ifndef _WSTDIO_S_DEFINED +#define _WSTDIO_S_DEFINED + _CRTIMP wchar_t *__cdecl _getws_s(wchar_t *_Str,size_t _SizeInWords); + int __cdecl fwprintf_s(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf_s(const wchar_t *_Format,...); + int __cdecl vfwprintf_s(FILE *_File,const wchar_t *_Format,va_list _ArgList); + int __cdecl vwprintf_s(const wchar_t *_Format,va_list _ArgList); + int __cdecl swprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,...); + int __cdecl vswprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwscanf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swscanf_s_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf_s(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf_s_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP errno_t __cdecl _wfopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP errno_t __cdecl _wfreopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); + _CRTIMP errno_t __cdecl _wtmpnam_s(wchar_t *_DstBuf,size_t _SizeInWords); +#endif + +#ifndef _WSTDLIB_S_DEFINED +#define _WSTDLIB_S_DEFINED + _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); + _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); +#endif +#endif + +#ifndef _POSIX_ +#ifndef _WSTDLIBP_S_DEFINED +#define _WSTDLIBP_S_DEFINED + _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); + _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); + _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); +#endif +#endif + +#ifndef _WSTRING_S_DEFINED +#define _WSTRING_S_DEFINED + _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); + _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); + _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); + _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); + _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); + _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); +#endif + +#ifndef _WTIME_S_DEFINED +#define _WTIME_S_DEFINED + _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); + _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) +#define _INC_WTIME_S_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } +#else +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } +#endif +#endif +#endif + + _CRTIMP errno_t __cdecl mbsrtowcs_s(size_t *_Retval,wchar_t *_Dst,size_t _SizeInWords,const char **_PSrc,size_t _N,mbstate_t *_State); + _CRTIMP errno_t __cdecl wcrtomb_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,wchar_t _Ch,mbstate_t *_State); + _CRTIMP errno_t __cdecl wcsrtombs_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,const wchar_t **_Src,size_t _Size,mbstate_t *_State); + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/setjmp.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/setjmp.h new file mode 100644 index 00000000..e4f142a3 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/setjmp.h @@ -0,0 +1,160 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SETJMP +#define _INC_SETJMP + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#if (defined(_X86_) && !defined(__x86_64)) + +#define _JBLEN 16 +#define _JBTYPE int + + typedef struct __JUMP_BUFFER { + unsigned long Ebp; + unsigned long Ebx; + unsigned long Edi; + unsigned long Esi; + unsigned long Esp; + unsigned long Eip; + unsigned long Registration; + unsigned long TryLevel; + unsigned long Cookie; + unsigned long UnwindFunc; + unsigned long UnwindData[6]; + } _JUMP_BUFFER; +#elif defined(__ia64__) + typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { + __int64 LowPart; + __int64 HighPart; + } SETJMP_FLOAT128; + +#define _JBLEN 33 + typedef SETJMP_FLOAT128 _JBTYPE; + + typedef struct __JUMP_BUFFER { + + unsigned long iAReserved[6]; + + unsigned long Registration; + unsigned long TryLevel; + unsigned long Cookie; + unsigned long UnwindFunc; + + unsigned long UnwindData[6]; + + SETJMP_FLOAT128 FltS0; + SETJMP_FLOAT128 FltS1; + SETJMP_FLOAT128 FltS2; + SETJMP_FLOAT128 FltS3; + SETJMP_FLOAT128 FltS4; + SETJMP_FLOAT128 FltS5; + SETJMP_FLOAT128 FltS6; + SETJMP_FLOAT128 FltS7; + SETJMP_FLOAT128 FltS8; + SETJMP_FLOAT128 FltS9; + SETJMP_FLOAT128 FltS10; + SETJMP_FLOAT128 FltS11; + SETJMP_FLOAT128 FltS12; + SETJMP_FLOAT128 FltS13; + SETJMP_FLOAT128 FltS14; + SETJMP_FLOAT128 FltS15; + SETJMP_FLOAT128 FltS16; + SETJMP_FLOAT128 FltS17; + SETJMP_FLOAT128 FltS18; + SETJMP_FLOAT128 FltS19; + __int64 FPSR; + __int64 StIIP; + __int64 BrS0; + __int64 BrS1; + __int64 BrS2; + __int64 BrS3; + __int64 BrS4; + __int64 IntS0; + __int64 IntS1; + __int64 IntS2; + __int64 IntS3; + __int64 RsBSP; + __int64 RsPFS; + __int64 ApUNAT; + __int64 ApLC; + __int64 IntSp; + __int64 IntNats; + __int64 Preds; + + } _JUMP_BUFFER; +#elif defined(__x86_64) + typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { + unsigned __int64 Part[2]; + } SETJMP_FLOAT128; + +#define _JBLEN 16 + typedef SETJMP_FLOAT128 _JBTYPE; + + typedef struct _JUMP_BUFFER { + unsigned __int64 Frame; + unsigned __int64 Rbx; + unsigned __int64 Rsp; + unsigned __int64 Rbp; + unsigned __int64 Rsi; + unsigned __int64 Rdi; + unsigned __int64 R12; + unsigned __int64 R13; + unsigned __int64 R14; + unsigned __int64 R15; + unsigned __int64 Rip; + unsigned __int64 Spare; + SETJMP_FLOAT128 Xmm6; + SETJMP_FLOAT128 Xmm7; + SETJMP_FLOAT128 Xmm8; + SETJMP_FLOAT128 Xmm9; + SETJMP_FLOAT128 Xmm10; + SETJMP_FLOAT128 Xmm11; + SETJMP_FLOAT128 Xmm12; + SETJMP_FLOAT128 Xmm13; + SETJMP_FLOAT128 Xmm14; + SETJMP_FLOAT128 Xmm15; + } _JUMP_BUFFER; +#endif +#ifndef _JMP_BUF_DEFINED + typedef _JBTYPE jmp_buf[_JBLEN]; +#define _JMP_BUF_DEFINED +#endif + + void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void); + +#ifdef USE_MINGW_SETJMP_TWO_ARGS +#ifndef _INC_SETJMPEX +#define setjmp(BUF) _setjmp((BUF),mingw_getsp()) + int __cdecl __attribute__ ((__nothrow__)) _setjmp(jmp_buf _Buf,void *_Ctx); +#else +#undef setjmp +#define setjmp(BUF) _setjmpex((BUF),mingw_getsp()) +#define setjmpex(BUF) _setjmpex((BUF),mingw_getsp()) + int __cdecl __attribute__ ((__nothrow__)) _setjmpex(jmp_buf _Buf,void *_Ctx); +#endif +#else +#ifndef _INC_SETJMPEX +#define setjmp _setjmp +#endif + int __cdecl __attribute__ ((__nothrow__)) setjmp(jmp_buf _Buf); +#endif + + __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/; + __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value); + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/share.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/share.h new file mode 100644 index 00000000..358855fe --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/share.h @@ -0,0 +1,28 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SHARE +#define _INC_SHARE + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#define _SH_COMPAT 0x00 +#define _SH_DENYRW 0x10 +#define _SH_DENYWR 0x20 +#define _SH_DENYRD 0x30 +#define _SH_DENYNO 0x40 +#define _SH_SECURE 0x80 + +#ifndef NO_OLDNAMES +#define SH_COMPAT _SH_COMPAT +#define SH_DENYRW _SH_DENYRW +#define SH_DENYWR _SH_DENYWR +#define SH_DENYRD _SH_DENYRD +#define SH_DENYNO _SH_DENYNO +#endif + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/signal.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/signal.h new file mode 100644 index 00000000..a518f6b3 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/signal.h @@ -0,0 +1,63 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SIGNAL +#define _INC_SIGNAL + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SIG_ATOMIC_T_DEFINED +#define _SIG_ATOMIC_T_DEFINED + typedef int sig_atomic_t; +#endif + +#define NSIG 23 + +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGIOT 6 /* IOT instruction */ +#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#ifdef __USE_MINGW_ALARM +#define SIGALRM 14 /* alarm clock */ +#endif +#define SIGTERM 15 +#define SIGBREAK 21 +#define SIGABRT2 22 + +#define SIGABRT_COMPAT 6 + + typedef void (*__p_sig_fn_t)(int); + +#define SIG_DFL (__p_sig_fn_t)0 +#define SIG_IGN (__p_sig_fn_t)1 +#define SIG_GET (__p_sig_fn_t)2 +#define SIG_SGE (__p_sig_fn_t)3 +#define SIG_ACK (__p_sig_fn_t)4 +#define SIG_ERR (__p_sig_fn_t)-1 + + extern void **__cdecl __pxcptinfoptrs(void); +#define _pxcptinfoptrs (*__pxcptinfoptrs()) + + __p_sig_fn_t __cdecl signal(int _SigNum,__p_sig_fn_t _Func); + int __cdecl raise(int _SigNum); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/stdarg.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdarg.h new file mode 100644 index 00000000..10ce733b --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdarg.h @@ -0,0 +1,79 @@ +#ifndef _STDARG_H +#define _STDARG_H + +#ifdef __x86_64__ +#ifndef _WIN64 + +//This should be in sync with the declaration on our lib/libtcc1.c +/* GCC compatible definition of va_list. */ +typedef struct { + unsigned int gp_offset; + unsigned int fp_offset; + union { + unsigned int overflow_offset; + char *overflow_arg_area; + }; + char *reg_save_area; +} __va_list_struct; + +typedef __va_list_struct va_list[1]; + +void __va_start(__va_list_struct *ap, void *fp); +void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align); + +#define va_start(ap, last) __va_start(ap, __builtin_frame_address(0)) +#define va_arg(ap, type) \ + (*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type), __alignof__(type)))) +#define va_copy(dest, src) (*(dest) = *(src)) +#define va_end(ap) + +/* avoid conflicting definition for va_list on Macs. */ +#define _VA_LIST_T + +#else /* _WIN64 */ +typedef char *va_list; +#define va_start(ap,last) __builtin_va_start(ap,last) +#define va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \ + ? **(t **)((ap += 8) - 8) : *(t *)((ap += 8) - 8)) +#define va_copy(dest, src) ((dest) = (src)) +#define va_end(ap) +#endif + +#elif __arm__ +typedef char *va_list; +#define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x) +#define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \ + & ~(_tcc_alignof(type) - 1)) +#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3) +#define va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \ + &~3), *(type *)(ap - ((sizeof(type)+3)&~3))) +#define va_copy(dest, src) (dest) = (src) +#define va_end(ap) + +#elif defined(__aarch64__) +typedef struct { + void *__stack; + void *__gr_top; + void *__vr_top; + int __gr_offs; + int __vr_offs; +} va_list; +#define va_start(ap, last) __va_start(ap, last) +#define va_arg(ap, type) __va_arg(ap, type) +#define va_end(ap) +#define va_copy(dest, src) ((dest) = (src)) + +#else /* __i386__ */ +typedef char *va_list; +/* only correct for i386 */ +#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3) +#define va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3))) +#define va_copy(dest, src) (dest) = (src) +#define va_end(ap) +#endif + +/* fix a buggy dependency on GCC in libio.h */ +typedef va_list __gnuc_va_list; +#define _VA_LIST_DEFINED + +#endif /* _STDARG_H */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/stdbool.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdbool.h new file mode 100644 index 00000000..d2ee446e --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdbool.h @@ -0,0 +1,11 @@ +#ifndef _STDBOOL_H +#define _STDBOOL_H + +/* ISOC99 boolean */ + +#define bool _Bool +#define true 1 +#define false 0 +#define __bool_true_false_are_defined 1 + +#endif /* _STDBOOL_H */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/stddef.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/stddef.h new file mode 100644 index 00000000..694d5037 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/stddef.h @@ -0,0 +1,54 @@ +#ifndef _STDDEF_H +#define _STDDEF_H + +typedef __SIZE_TYPE__ size_t; +typedef __PTRDIFF_TYPE__ ssize_t; +typedef __WCHAR_TYPE__ wchar_t; +typedef __PTRDIFF_TYPE__ ptrdiff_t; +typedef __PTRDIFF_TYPE__ intptr_t; +typedef __SIZE_TYPE__ uintptr_t; + +#ifndef __int8_t_defined +#define __int8_t_defined +typedef signed char int8_t; +typedef signed short int int16_t; +typedef signed int int32_t; +#ifdef __LP64__ +typedef signed long int int64_t; +#else +typedef signed long long int int64_t; +#endif +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +#ifdef __LP64__ +typedef unsigned long int uint64_t; +#else +typedef unsigned long long int uint64_t; +#endif +#endif + +#ifndef NULL +#define NULL ((void*)0) +#endif + +#define offsetof(type, field) ((size_t)&((type *)0)->field) + +void *alloca(size_t size); + +#endif + +/* Older glibc require a wint_t from (when requested + by __need_wint_t, as otherwise stddef.h isn't allowed to + define this type). Note that this must be outside the normal + _STDDEF_H guard, so that it works even when we've included the file + already (without requiring wint_t). Some other libs define _WINT_T + if they've already provided that type, so we can use that as guard. + TCC defines __WINT_TYPE__ for us. */ +#if defined (__need_wint_t) +#ifndef _WINT_T +#define _WINT_T +typedef __WINT_TYPE__ wint_t; +#endif +#undef __need_wint_t +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/stdint.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdint.h new file mode 100644 index 00000000..cde32b6e --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdint.h @@ -0,0 +1,212 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* ISO C9x 7.18 Integer types + * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794) + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * Contributor: Danny Smith + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Date: 2000-12-02 + */ + + +#ifndef _STDINT_H +#define _STDINT_H + +#include <_mingw.h> + +#define __need_wint_t +#define __need_wchar_t +#include "stddef.h" + +#ifndef __int8_t_defined +#define __int8_t_defined +/* 7.18.1.1 Exact-width integer types */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned uint32_t; +typedef long long int64_t; +typedef unsigned long long uint64_t; +#endif + +/* 7.18.1.2 Minimum-width integer types */ +typedef signed char int_least8_t; +typedef unsigned char uint_least8_t; +typedef short int_least16_t; +typedef unsigned short uint_least16_t; +typedef int int_least32_t; +typedef unsigned uint_least32_t; +typedef long long int_least64_t; +typedef unsigned long long uint_least64_t; + +/* 7.18.1.3 Fastest minimum-width integer types + * Not actually guaranteed to be fastest for all purposes + * Here we use the exact-width types for 8 and 16-bit ints. + */ +typedef char int_fast8_t; +typedef unsigned char uint_fast8_t; +typedef short int_fast16_t; +typedef unsigned short uint_fast16_t; +typedef int int_fast32_t; +typedef unsigned int uint_fast32_t; +typedef long long int_fast64_t; +typedef unsigned long long uint_fast64_t; + +/* 7.18.1.5 Greatest-width integer types */ +typedef long long intmax_t; +typedef unsigned long long uintmax_t; + +/* 7.18.2 Limits of specified-width integer types */ +#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) + +/* 7.18.2.1 Limits of exact-width integer types */ +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647 - 1) +#define INT64_MIN (-9223372036854775807LL - 1) + +#define INT8_MAX 127 +#define INT16_MAX 32767 +#define INT32_MAX 2147483647 +#define INT64_MAX 9223372036854775807LL + +#define UINT8_MAX 0xff /* 255U */ +#define UINT16_MAX 0xffff /* 65535U */ +#define UINT32_MAX 0xffffffff /* 4294967295U */ +#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ + +/* 7.18.2.2 Limits of minimum-width integer types */ +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN + +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX + +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +/* 7.18.2.3 Limits of fastest minimum-width integer types */ +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST64_MIN INT64_MIN + +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MAX INT64_MAX + +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +/* 7.18.2.4 Limits of integer types capable of holding + object pointers */ +#ifdef _WIN64 +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#else +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#endif + +/* 7.18.2.5 Limits of greatest-width integer types */ +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +/* 7.18.3 Limits of other integer types */ +#ifdef _WIN64 +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX +#else +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#endif + +#define SIG_ATOMIC_MIN INT32_MIN +#define SIG_ATOMIC_MAX INT32_MAX + +#ifndef SIZE_MAX +#ifdef _WIN64 +#define SIZE_MAX UINT64_MAX +#else +#define SIZE_MAX UINT32_MAX +#endif +#endif + +#ifndef WCHAR_MIN /* also in wchar.h */ +#define WCHAR_MIN 0 +#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ +#endif + +/* + * wint_t is unsigned short for compatibility with MS runtime + */ +#define WINT_MIN 0 +#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */ + +#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ + + +/* 7.18.4 Macros for integer constants */ +#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS) + +/* 7.18.4.1 Macros for minimum-width integer constants + + According to Douglas Gwyn : + "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC + 9899:1999 as initially published, the expansion was required + to be an integer constant of precisely matching type, which + is impossible to accomplish for the shorter types on most + platforms, because C99 provides no standard way to designate + an integer constant with width less than that of type int. + TC1 changed this to require just an integer constant + *expression* with *promoted* type." + + The trick used here is from Clive D W Feather. +*/ + +#define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val)) +#define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val)) +#define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val)) +/* The 'trick' doesn't work in C89 for long long because, without + suffix, (val) will be evaluated as int, not intmax_t */ +#define INT64_C(val) val##LL + +#define UINT8_C(val) (UINT_LEAST8_MAX-UINT_LEAST8_MAX+(val)) +#define UINT16_C(val) (UINT_LEAST16_MAX-UINT_LEAST16_MAX+(val)) +#define UINT32_C(val) (UINT_LEAST32_MAX-UINT_LEAST32_MAX+(val)) +#define UINT64_C(val) val##ULL + +/* 7.18.4.2 Macros for greatest-width integer constants */ +#define INTMAX_C(val) val##LL +#define UINTMAX_C(val) val##ULL + +#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/stdio.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdio.h new file mode 100644 index 00000000..da887936 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdio.h @@ -0,0 +1,429 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDIO +#define _INC_STDIO + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#define BUFSIZ 512 +#define _NFILE _NSTREAM_ +#define _NSTREAM_ 512 +#define _IOB_ENTRIES 20 +#define EOF (-1) + +#ifndef _FILE_DEFINED + struct _iobuf { + char *_ptr; + int _cnt; + char *_base; + int _flag; + int _file; + int _charbuf; + int _bufsiz; + char *_tmpfname; + }; + typedef struct _iobuf FILE; +#define _FILE_DEFINED +#endif + +#ifdef _POSIX_ +#define _P_tmpdir "/" +#define _wP_tmpdir L"/" +#else +#define _P_tmpdir "\\" +#define _wP_tmpdir L"\\" +#endif + +#define L_tmpnam (sizeof(_P_tmpdir) + 12) + +#ifdef _POSIX_ +#define L_ctermid 9 +#define L_cuserid 32 +#endif + +#define SEEK_CUR 1 +#define SEEK_END 2 +#define SEEK_SET 0 + +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +#define FILENAME_MAX 260 +#define FOPEN_MAX 20 +#define _SYS_OPEN 20 +#define TMP_MAX 32767 + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif + +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif + +#ifndef _STDIO_DEFINED +#ifdef _WIN64 + _CRTIMP FILE *__cdecl __iob_func(void); +#else +#ifdef _MSVCRT_ +extern FILE _iob[]; /* A pointer to an array of FILE */ +#define __iob_func() (_iob) +#else +extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */ +#define __iob_func() (*_imp___iob) +#define _iob __iob_func() +#endif +#endif +#endif + +#ifndef _FPOS_T_DEFINED +#define _FPOS_T_DEFINED +#undef _FPOSOFF + +#if (!defined(NO_OLDNAMES) || defined(__GNUC__)) && _INTEGRAL_MAX_BITS >= 64 + typedef __int64 fpos_t; +#define _FPOSOFF(fp) ((long)(fp)) +#else + typedef long long fpos_t; +#define _FPOSOFF(fp) ((long)(fp)) +#endif + +#endif + +#ifndef _STDSTREAM_DEFINED +#define _STDSTREAM_DEFINED + +#define stdin (&__iob_func()[0]) +#define stdout (&__iob_func()[1]) +#define stderr (&__iob_func()[2]) +#endif + +#define _IOREAD 0x0001 +#define _IOWRT 0x0002 + +#define _IOFBF 0x0000 +#define _IOLBF 0x0040 +#define _IONBF 0x0004 + +#define _IOMYBUF 0x0008 +#define _IOEOF 0x0010 +#define _IOERR 0x0020 +#define _IOSTRG 0x0040 +#define _IORW 0x0080 +#ifdef _POSIX_ +#define _IOAPPEND 0x0200 +#endif + +#define _TWO_DIGIT_EXPONENT 0x1 + +#ifndef _STDIO_DEFINED + + _CRTIMP int __cdecl _filbuf(FILE *_File); + _CRTIMP int __cdecl _flsbuf(int _Ch,FILE *_File); +#ifdef _POSIX_ + _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode); +#else + _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode,int _ShFlag); +#endif + void __cdecl clearerr(FILE *_File); + int __cdecl fclose(FILE *_File); + _CRTIMP int __cdecl _fcloseall(void); +#ifdef _POSIX_ + FILE *__cdecl fdopen(int _FileHandle,const char *_Mode); +#else + _CRTIMP FILE *__cdecl _fdopen(int _FileHandle,const char *_Mode); +#endif + int __cdecl feof(FILE *_File); + int __cdecl ferror(FILE *_File); + int __cdecl fflush(FILE *_File); + int __cdecl fgetc(FILE *_File); + _CRTIMP int __cdecl _fgetchar(void); + int __cdecl fgetpos(FILE *_File ,fpos_t *_Pos); + char *__cdecl fgets(char *_Buf,int _MaxCount,FILE *_File); +#ifdef _POSIX_ + int __cdecl fileno(FILE *_File); +#else + _CRTIMP int __cdecl _fileno(FILE *_File); +#endif + _CRTIMP char *__cdecl _tempnam(const char *_DirName,const char *_FilePrefix); + _CRTIMP int __cdecl _flushall(void); + FILE *__cdecl fopen(const char *_Filename,const char *_Mode); + FILE *fopen64(const char *filename,const char *mode); + int __cdecl fprintf(FILE *_File,const char *_Format,...); + int __cdecl fputc(int _Ch,FILE *_File); + _CRTIMP int __cdecl _fputchar(int _Ch); + int __cdecl fputs(const char *_Str,FILE *_File); + size_t __cdecl fread(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File); + FILE *__cdecl freopen(const char *_Filename,const char *_Mode,FILE *_File); + int __cdecl fscanf(FILE *_File,const char *_Format,...); + int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos); + int __cdecl fseek(FILE *_File,long _Offset,int _Origin); + int fseeko64(FILE* stream, _off64_t offset, int whence); + long __cdecl ftell(FILE *_File); + _off64_t ftello64(FILE * stream); + int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin); + __int64 __cdecl _ftelli64(FILE *_File); + size_t __cdecl fwrite(const void *_Str,size_t _Size,size_t _Count,FILE *_File); + int __cdecl getc(FILE *_File); + int __cdecl getchar(void); + _CRTIMP int __cdecl _getmaxstdio(void); + char *__cdecl gets(char *_Buffer); + int __cdecl _getw(FILE *_File); +#ifndef _CRT_PERROR_DEFINED +#define _CRT_PERROR_DEFINED + void __cdecl perror(const char *_ErrMsg); +#endif + _CRTIMP int __cdecl _pclose(FILE *_File); + _CRTIMP FILE *__cdecl _popen(const char *_Command,const char *_Mode); +#if !defined(NO_OLDNAMES) && !defined(popen) +#define popen _popen +#define pclose _pclose +#endif + int __cdecl printf(const char *_Format,...); + int __cdecl putc(int _Ch,FILE *_File); + int __cdecl putchar(int _Ch); + int __cdecl puts(const char *_Str); + _CRTIMP int __cdecl _putw(int _Word,FILE *_File); +#ifndef _CRT_DIRECTORY_DEFINED +#define _CRT_DIRECTORY_DEFINED + int __cdecl remove(const char *_Filename); + int __cdecl rename(const char *_OldFilename,const char *_NewFilename); + _CRTIMP int __cdecl _unlink(const char *_Filename); +#ifndef NO_OLDNAMES + int __cdecl unlink(const char *_Filename); +#endif +#endif + void __cdecl rewind(FILE *_File); + _CRTIMP int __cdecl _rmtmp(void); + int __cdecl scanf(const char *_Format,...); + void __cdecl setbuf(FILE *_File,char *_Buffer); + _CRTIMP int __cdecl _setmaxstdio(int _Max); + _CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format); + _CRTIMP unsigned int __cdecl _get_output_format(void); + int __cdecl setvbuf(FILE *_File,char *_Buf,int _Mode,size_t _Size); + _CRTIMP int __cdecl _scprintf(const char *_Format,...); + int __cdecl sscanf(const char *_Src,const char *_Format,...); + _CRTIMP int __cdecl _snscanf(const char *_Src,size_t _MaxCount,const char *_Format,...); + FILE *__cdecl tmpfile(void); + char *__cdecl tmpnam(char *_Buffer); + int __cdecl ungetc(int _Ch,FILE *_File); + int __cdecl vfprintf(FILE *_File,const char *_Format,va_list _ArgList); + int __cdecl vprintf(const char *_Format,va_list _ArgList); + /* Make sure macros are not defined. */ +#pragma push_macro("vsnprintf") +#pragma push_macro("snprintf") +# undef vsnprintf +# undef snprintf + extern + __attribute__((format(gnu_printf, 3, 0))) __attribute__((nonnull (3))) + int __mingw_vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); + extern + __attribute__((format(gnu_printf, 3, 4))) __attribute__((nonnull (3))) + int __mingw_snprintf(char* s, size_t n, const char* format, ...); + int __cdecl vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snprintf(char *_Dest,size_t _Count,const char *_Format,...); + _CRTIMP int __cdecl _vsnprintf(char *_Dest,size_t _Count,const char *_Format,va_list _Args); + int __cdecl sprintf(char *_Dest,const char *_Format,...); + int __cdecl vsprintf(char *_Dest,const char *_Format,va_list _Args); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ + int __cdecl snprintf(char* s, size_t n, const char* format, ...); + __CRT_INLINE int __cdecl vsnprintf (char* s, size_t n, const char* format,va_list arg) { + return _vsnprintf ( s, n, format, arg); + } + int __cdecl vscanf(const char * Format, va_list argp); + int __cdecl vfscanf (FILE * fp, const char * Format,va_list argp); + int __cdecl vsscanf (const char * _Str,const char * Format,va_list argp); +#endif +/* Restore may prior defined macros snprintf/vsnprintf. */ +#pragma pop_macro("snprintf") +#pragma pop_macro("vsnprintf") +/* Check if vsnprintf and snprintf are defaulting to gnu-style. */ +# if defined(USE_MINGW_GNU_SNPRINTF) && USE_MINGW_GNU_SNPRINTF +# ifndef vsnprint +# define vsnprintf __mingw_vsnprintf +# endif +# ifndef snprintf +# define snprintf __mingw_snprintf +# endif +# endif + _CRTIMP int __cdecl _vscprintf(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _set_printf_count_output(int _Value); + _CRTIMP int __cdecl _get_printf_count_output(void); + +#ifndef _WSTDIO_DEFINED + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifdef _POSIX_ + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); +#else + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); +#endif + wint_t __cdecl fgetwc(FILE *_File); + _CRTIMP wint_t __cdecl _fgetwchar(void); + wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); + wint_t __cdecl getwc(FILE *_File); + wint_t __cdecl getwchar(void); + wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); + wint_t __cdecl putwchar(wchar_t _Ch); + wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); + wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File); + int __cdecl fputws(const wchar_t *_Str,FILE *_File); + _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String); + _CRTIMP int __cdecl _putws(const wchar_t *_Str); + int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...); + int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList); + int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...); + _CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list); + _CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ + int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...); + __CRT_INLINE int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, va_list arg) { return _vsnwprintf(s,n,format,arg); } + int __cdecl vwscanf (const wchar_t *, va_list); + int __cdecl vfwscanf (FILE *,const wchar_t *,va_list); + int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list); +#endif + _CRTIMP int __cdecl _swprintf(wchar_t *_Dest,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args); + +#ifndef RC_INVOKED +#include +#endif + +#ifdef _CRT_NON_CONFORMING_SWPRINTFS +#ifndef __cplusplus +#define swprintf _swprintf +#define vswprintf _vswprintf +#define _swprintf_l __swprintf_l +#define _vswprintf_l __vswprintf_l +#endif +#endif + + _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); + _CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList); + int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...); + int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + int __cdecl wscanf(const wchar_t *_Format,...); + _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfopen(const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); +#if !defined(NO_OLDNAMES) && !defined(wpopen) +#define wpopen _wpopen +#endif + _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); + _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); + _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); + +#undef _CRT_GETPUTWCHAR_NOINLINE + +#if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) +#define getwchar() fgetwc(stdin) +#define putwchar(_c) fputwc((_c),stdout) +#else + __CRT_INLINE wint_t __cdecl getwchar() { return (fgetwc(stdin)); } + __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) { return (fputwc(_C,stdout)); } +#endif + +#define getwc(_stm) fgetwc(_stm) +#define putwc(_c,_stm) fputwc(_c,_stm) +#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) +#define _getwc_nolock(_stm) _fgetwc_nolock(_stm) + +#define _WSTDIO_DEFINED +#endif + +#define _STDIO_DEFINED +#endif + +#define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) +#define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream))) +#define _getc_nolock(_stream) _fgetc_nolock(_stream) +#define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream) +#define _getchar_nolock() _getc_nolock(stdin) +#define _putchar_nolock(_c) _putc_nolock((_c),stdout) +#define _getwchar_nolock() _getwc_nolock(stdin) +#define _putwchar_nolock(_c) _putwc_nolock((_c),stdout) + + _CRTIMP void __cdecl _lock_file(FILE *_File); + _CRTIMP void __cdecl _unlock_file(FILE *_File); + _CRTIMP int __cdecl _fclose_nolock(FILE *_File); + _CRTIMP int __cdecl _fflush_nolock(FILE *_File); + _CRTIMP size_t __cdecl _fread_nolock(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File); + _CRTIMP int __cdecl _fseek_nolock(FILE *_File,long _Offset,int _Origin); + _CRTIMP long __cdecl _ftell_nolock(FILE *_File); + _CRTIMP int __cdecl _fseeki64_nolock(FILE *_File,__int64 _Offset,int _Origin); + _CRTIMP __int64 __cdecl _ftelli64_nolock(FILE *_File); + _CRTIMP size_t __cdecl _fwrite_nolock(const void *_DstBuf,size_t _Size,size_t _Count,FILE *_File); + _CRTIMP int __cdecl _ungetc_nolock(int _Ch,FILE *_File); + +#if !defined(NO_OLDNAMES) || !defined(_POSIX) +#define P_tmpdir _P_tmpdir +#define SYS_OPEN _SYS_OPEN + + char *__cdecl tempnam(const char *_Directory,const char *_FilePrefix); + int __cdecl fcloseall(void); + FILE *__cdecl fdopen(int _FileHandle,const char *_Format); + int __cdecl fgetchar(void); + int __cdecl fileno(FILE *_File); + int __cdecl flushall(void); + int __cdecl fputchar(int _Ch); + int __cdecl getw(FILE *_File); + int __cdecl putw(int _Ch,FILE *_File); + int __cdecl rmtmp(void); +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/stdlib.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdlib.h new file mode 100644 index 00000000..96765b29 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/stdlib.h @@ -0,0 +1,580 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDLIB +#define _INC_STDLIB + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 + +#ifndef _ONEXIT_T_DEFINED +#define _ONEXIT_T_DEFINED + + typedef int (__cdecl *_onexit_t)(void); + +#ifndef NO_OLDNAMES +#define onexit_t _onexit_t +#endif +#endif + +#ifndef _DIV_T_DEFINED +#define _DIV_T_DEFINED + + typedef struct _div_t { + int quot; + int rem; + } div_t; + + typedef struct _ldiv_t { + long quot; + long rem; + } ldiv_t; +#endif + +#ifndef _CRT_DOUBLE_DEC +#define _CRT_DOUBLE_DEC + +#pragma pack(4) + typedef struct { + unsigned char ld[10]; + } _LDOUBLE; +#pragma pack() + +#define _PTR_LD(x) ((unsigned char *)(&(x)->ld)) + + typedef struct { + double x; + } _CRT_DOUBLE; + + typedef struct { + float f; + } _CRT_FLOAT; + +#pragma push_macro("long") +#undef long + + typedef struct { + long double x; + } _LONGDOUBLE; + +#pragma pop_macro("long") + +#pragma pack(4) + typedef struct { + unsigned char ld12[12]; + } _LDBL12; +#pragma pack() +#endif + +#define RAND_MAX 0x7fff + +#ifndef MB_CUR_MAX +#define MB_CUR_MAX ___mb_cur_max_func() +#ifndef __mb_cur_max +#ifdef _MSVCRT_ + extern int __mb_cur_max; +#else +#define __mb_cur_max (*_imp____mb_cur_max) + extern int *_imp____mb_cur_max; +#endif +#endif +#ifdef _MSVCRT_ + extern int __mbcur_max; +#define ___mb_cur_max_func() (__mb_cur_max) +#else + extern int* _imp____mbcur_max; +#define ___mb_cur_max_func() (*_imp____mb_cur_max) +#endif +#endif + +#define __max(a,b) (((a) > (b)) ? (a) : (b)) +#define __min(a,b) (((a) < (b)) ? (a) : (b)) + +#define _MAX_PATH 260 +#define _MAX_DRIVE 3 +#define _MAX_DIR 256 +#define _MAX_FNAME 256 +#define _MAX_EXT 256 + +#define _OUT_TO_DEFAULT 0 +#define _OUT_TO_STDERR 1 +#define _OUT_TO_MSGBOX 2 +#define _REPORT_ERRMODE 3 + +#define _WRITE_ABORT_MSG 0x1 +#define _CALL_REPORTFAULT 0x2 + +#define _MAX_ENV 32767 + + typedef void (__cdecl *_purecall_handler)(void); + + _CRTIMP _purecall_handler __cdecl _set_purecall_handler(_purecall_handler _Handler); + _CRTIMP _purecall_handler __cdecl _get_purecall_handler(void); + + typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t); + _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler); + _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void); + +#ifndef _CRT_ERRNO_DEFINED +#define _CRT_ERRNO_DEFINED + _CRTIMP extern int *__cdecl _errno(void); +#define errno (*_errno()) + errno_t __cdecl _set_errno(int _Value); + errno_t __cdecl _get_errno(int *_Value); +#endif + _CRTIMP unsigned long *__cdecl __doserrno(void); +#define _doserrno (*__doserrno()) + errno_t __cdecl _set_doserrno(unsigned long _Value); + errno_t __cdecl _get_doserrno(unsigned long *_Value); +#ifdef _MSVCRT_ + extern char *_sys_errlist[]; + extern int _sys_nerr; +#else + _CRTIMP char *_sys_errlist[1]; + _CRTIMP int _sys_nerr; +#endif +#if (defined(_X86_) && !defined(__x86_64)) + _CRTIMP int *__cdecl __p___argc(void); + _CRTIMP char ***__cdecl __p___argv(void); + _CRTIMP wchar_t ***__cdecl __p___wargv(void); + _CRTIMP char ***__cdecl __p__environ(void); + _CRTIMP wchar_t ***__cdecl __p__wenviron(void); + _CRTIMP char **__cdecl __p__pgmptr(void); + _CRTIMP wchar_t **__cdecl __p__wpgmptr(void); +#endif +#ifndef __argc +#ifdef _MSVCRT_ + extern int __argc; +#else +#define __argc (*_imp____argc) + extern int *_imp____argc; +#endif +#endif +#ifndef __argv +#ifdef _MSVCRT_ + extern char **__argv; +#else +#define __argv (*_imp____argv) + extern char ***_imp____argv; +#endif +#endif +#ifndef __wargv +#ifdef _MSVCRT_ + extern wchar_t **__wargv; +#else +#define __wargv (*_imp____wargv) + extern wchar_t ***_imp____wargv; +#endif +#endif + +#ifdef _POSIX_ + extern char **environ; +#else +#ifndef _environ +#ifdef _MSVCRT_ + extern char **_environ; +#else +#define _environ (*_imp___environ) + extern char ***_imp___environ; +#endif +#endif + +#ifndef _wenviron +#ifdef _MSVCRT_ + extern wchar_t **_wenviron; +#else +#define _wenviron (*_imp___wenviron) + extern wchar_t ***_imp___wenviron; +#endif +#endif +#endif +#ifndef _pgmptr +#ifdef _MSVCRT_ + extern char *_pgmptr; +#else +#define _pgmptr (*_imp___pgmptr) + extern char **_imp___pgmptr; +#endif +#endif + +#ifndef _wpgmptr +#ifdef _MSVCRT_ + extern wchar_t *_wpgmptr; +#else +#define _wpgmptr (*_imp___wpgmptr) + extern wchar_t **_imp___wpgmptr; +#endif +#endif + errno_t __cdecl _get_pgmptr(char **_Value); + errno_t __cdecl _get_wpgmptr(wchar_t **_Value); +#ifndef _fmode +#ifdef _MSVCRT_ + extern int _fmode; +#else +#define _fmode (*_imp___fmode) + extern int *_imp___fmode; +#endif +#endif + _CRTIMP errno_t __cdecl _set_fmode(int _Mode); + _CRTIMP errno_t __cdecl _get_fmode(int *_PMode); + +#ifndef _osplatform +#ifdef _MSVCRT_ + extern unsigned int _osplatform; +#else +#define _osplatform (*_imp___osplatform) + extern unsigned int *_imp___osplatform; +#endif +#endif + +#ifndef _osver +#ifdef _MSVCRT_ + extern unsigned int _osver; +#else +#define _osver (*_imp___osver) + extern unsigned int *_imp___osver; +#endif +#endif + +#ifndef _winver +#ifdef _MSVCRT_ + extern unsigned int _winver; +#else +#define _winver (*_imp___winver) + extern unsigned int *_imp___winver; +#endif +#endif + +#ifndef _winmajor +#ifdef _MSVCRT_ + extern unsigned int _winmajor; +#else +#define _winmajor (*_imp___winmajor) + extern unsigned int *_imp___winmajor; +#endif +#endif + +#ifndef _winminor +#ifdef _MSVCRT_ + extern unsigned int _winminor; +#else +#define _winminor (*_imp___winminor) + extern unsigned int *_imp___winminor; +#endif +#endif + + errno_t __cdecl _get_osplatform(unsigned int *_Value); + errno_t __cdecl _get_osver(unsigned int *_Value); + errno_t __cdecl _get_winver(unsigned int *_Value); + errno_t __cdecl _get_winmajor(unsigned int *_Value); + errno_t __cdecl _get_winminor(unsigned int *_Value); +#ifndef _countof +#ifndef __cplusplus +#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) +#else + extern "C++" { + template char (*__countof_helper(UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray]; +#define _countof(_Array) sizeof(*__countof_helper(_Array)) + } +#endif +#endif + +#ifndef _CRT_TERMINATE_DEFINED +#define _CRT_TERMINATE_DEFINED + void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; + _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; +#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ + /* C99 function name */ + void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; + __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) + { _exit(status); } +#endif + +#pragma push_macro("abort") +#undef abort + void __cdecl __declspec(noreturn) abort(void); +#pragma pop_macro("abort") + +#endif + + _CRTIMP unsigned int __cdecl _set_abort_behavior(unsigned int _Flags,unsigned int _Mask); + +#ifndef _CRT_ABS_DEFINED +#define _CRT_ABS_DEFINED + int __cdecl abs(int _X); + long __cdecl labs(long _X); +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + __int64 __cdecl _abs64(__int64); +#endif + int __cdecl atexit(void (__cdecl *)(void)); +#ifndef _CRT_ATOF_DEFINED +#define _CRT_ATOF_DEFINED + double __cdecl atof(const char *_String); + double __cdecl _atof_l(const char *_String,_locale_t _Locale); +#endif + int __cdecl atoi(const char *_Str); + _CRTIMP int __cdecl _atoi_l(const char *_Str,_locale_t _Locale); + long __cdecl atol(const char *_Str); + _CRTIMP long __cdecl _atol_l(const char *_Str,_locale_t _Locale); +#ifndef _CRT_ALGO_DEFINED +#define _CRT_ALGO_DEFINED + void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); + void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); +#endif + unsigned short __cdecl _byteswap_ushort(unsigned short _Short); + /*unsigned long __cdecl _byteswap_ulong (unsigned long _Long); */ +#if _INTEGRAL_MAX_BITS >= 64 + unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 _Int64); +#endif + div_t __cdecl div(int _Numerator,int _Denominator); + char *__cdecl getenv(const char *_VarName); + _CRTIMP char *__cdecl _itoa(int _Value,char *_Dest,int _Radix); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP char *__cdecl _i64toa(__int64 _Val,char *_DstBuf,int _Radix); + _CRTIMP char *__cdecl _ui64toa(unsigned __int64 _Val,char *_DstBuf,int _Radix); + _CRTIMP __int64 __cdecl _atoi64(const char *_String); + _CRTIMP __int64 __cdecl _atoi64_l(const char *_String,_locale_t _Locale); + _CRTIMP __int64 __cdecl _strtoi64(const char *_String,char **_EndPtr,int _Radix); + _CRTIMP __int64 __cdecl _strtoi64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP unsigned __int64 __cdecl _strtoui64(const char *_String,char **_EndPtr,int _Radix); + _CRTIMP unsigned __int64 __cdecl _strtoui64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale); +#endif + ldiv_t __cdecl ldiv(long _Numerator,long _Denominator); + _CRTIMP char *__cdecl _ltoa(long _Value,char *_Dest,int _Radix); + int __cdecl mblen(const char *_Ch,size_t _MaxCount); + _CRTIMP int __cdecl _mblen_l(const char *_Ch,size_t _MaxCount,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbstrlen(const char *_Str); + _CRTIMP size_t __cdecl _mbstrlen_l(const char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbstrnlen(const char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _mbstrnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale); + int __cdecl mbtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes); + _CRTIMP int __cdecl _mbtowc_l(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes,_locale_t _Locale); + size_t __cdecl mbstowcs(wchar_t *_Dest,const char *_Source,size_t _MaxCount); + _CRTIMP size_t __cdecl _mbstowcs_l(wchar_t *_Dest,const char *_Source,size_t _MaxCount,_locale_t _Locale); + int __cdecl rand(void); + _CRTIMP int __cdecl _set_error_mode(int _Mode); + void __cdecl srand(unsigned int _Seed); + double __cdecl strtod(const char *_Str,char **_EndPtr); + float __cdecl strtof(const char *nptr, char **endptr); +#if !defined __NO_ISOCEXT /* in libmingwex.a */ + float __cdecl strtof (const char * __restrict__, char ** __restrict__); + long double __cdecl strtold(const char * __restrict__, char ** __restrict__); +#endif /* __NO_ISOCEXT */ + _CRTIMP double __cdecl _strtod_l(const char *_Str,char **_EndPtr,_locale_t _Locale); + long __cdecl strtol(const char *_Str,char **_EndPtr,int _Radix); + _CRTIMP long __cdecl _strtol_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale); + unsigned long __cdecl strtoul(const char *_Str,char **_EndPtr,int _Radix); + _CRTIMP unsigned long __cdecl _strtoul_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale); +#ifndef _CRT_SYSTEM_DEFINED +#define _CRT_SYSTEM_DEFINED + int __cdecl system(const char *_Command); +#endif + _CRTIMP char *__cdecl _ultoa(unsigned long _Value,char *_Dest,int _Radix); + int __cdecl wctomb(char *_MbCh,wchar_t _WCh); + _CRTIMP int __cdecl _wctomb_l(char *_MbCh,wchar_t _WCh,_locale_t _Locale); + size_t __cdecl wcstombs(char *_Dest,const wchar_t *_Source,size_t _MaxCount); + _CRTIMP size_t __cdecl _wcstombs_l(char *_Dest,const wchar_t *_Source,size_t _MaxCount,_locale_t _Locale); + +#ifndef _CRT_ALLOCATION_DEFINED +#define _CRT_ALLOCATION_DEFINED + void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements); + void __cdecl free(void *_Memory); + void *__cdecl malloc(size_t _Size); + void *__cdecl realloc(void *_Memory,size_t _NewSize); + _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size); + //_CRTIMP void __cdecl _aligned_free(void *_Memory); + //_CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset); +#endif + +#ifndef _WSTDLIB_DEFINED +#define _WSTDLIB_DEFINED + + _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix); + double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr); + float __cdecl wcstof(const wchar_t *nptr, wchar_t **endptr); +#if !defined __NO_ISOCEXT /* in libmingwex.a */ + float __cdecl wcstof( const wchar_t * __restrict__, wchar_t ** __restrict__); + long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t ** __restrict__); +#endif /* __NO_ISOCEXT */ + _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale); + long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif + _CRTIMP double __cdecl _wtof(const wchar_t *_Str); + _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _wtoi(const wchar_t *_Str); + _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP long __cdecl _wtol(const wchar_t *_Str); + _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale); + +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str); + _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str ,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); +#endif +#endif + +#ifndef _POSIX_ +#define _CVTBUFSIZE (309+40) + _CRTIMP char *__cdecl _fullpath(char *_FullPath,const char *_Path,size_t _SizeInBytes); + _CRTIMP char *__cdecl _ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign); + _CRTIMP char *__cdecl _fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); + _CRTIMP char *__cdecl _gcvt(double _Val,int _NumOfDigits,char *_DstBuf); + _CRTIMP int __cdecl _atodbl(_CRT_DOUBLE *_Result,char *_Str); + _CRTIMP int __cdecl _atoldbl(_LDOUBLE *_Result,char *_Str); + _CRTIMP int __cdecl _atoflt(_CRT_FLOAT *_Result,char *_Str); + _CRTIMP int __cdecl _atodbl_l(_CRT_DOUBLE *_Result,char *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _atoldbl_l(_LDOUBLE *_Result,char *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _atoflt_l(_CRT_FLOAT *_Result,char *_Str,_locale_t _Locale); + unsigned long __cdecl _lrotl(unsigned long _Val,int _Shift); + unsigned long __cdecl _lrotr(unsigned long _Val,int _Shift); + _CRTIMP void __cdecl _makepath(char *_Path,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); + _onexit_t __cdecl _onexit(_onexit_t _Func); + +#ifndef _CRT_PERROR_DEFINED +#define _CRT_PERROR_DEFINED + void __cdecl perror(const char *_ErrMsg); +#endif + _CRTIMP int __cdecl _putenv(const char *_EnvString); + unsigned int __cdecl _rotl(unsigned int _Val,int _Shift); +#if _INTEGRAL_MAX_BITS >= 64 + unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val,int _Shift); +#endif + unsigned int __cdecl _rotr(unsigned int _Val,int _Shift); +#if _INTEGRAL_MAX_BITS >= 64 + unsigned __int64 __cdecl _rotr64(unsigned __int64 _Val,int _Shift); +#endif + _CRTIMP void __cdecl _searchenv(const char *_Filename,const char *_EnvVar,char *_ResultPath); + _CRTIMP void __cdecl _splitpath(const char *_FullPath,char *_Drive,char *_Dir,char *_Filename,char *_Ext); + _CRTIMP void __cdecl _swab(char *_Buf1,char *_Buf2,int _SizeInBytes); + +#ifndef _WSTDLIBP_DEFINED +#define _WSTDLIBP_DEFINED + _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords); + _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString); + _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath); + _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext); +#endif + + _CRTIMP void __cdecl _beep(unsigned _Frequency,unsigned _Duration) __MINGW_ATTRIB_DEPRECATED; + /* Not to be confused with _set_error_mode (int). */ + _CRTIMP void __cdecl _seterrormode(int _Mode) __MINGW_ATTRIB_DEPRECATED; + _CRTIMP void __cdecl _sleep(unsigned long _Duration) __MINGW_ATTRIB_DEPRECATED; +#endif + +#ifndef NO_OLDNAMES +#ifndef _POSIX_ +#if 0 +#ifndef __cplusplus +#ifndef NOMINMAX +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#endif +#endif +#endif + +#define sys_errlist _sys_errlist +#define sys_nerr _sys_nerr +#define environ _environ + char *__cdecl ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign); + char *__cdecl fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); + char *__cdecl gcvt(double _Val,int _NumOfDigits,char *_DstBuf); + char *__cdecl itoa(int _Val,char *_DstBuf,int _Radix); + char *__cdecl ltoa(long _Val,char *_DstBuf,int _Radix); + int __cdecl putenv(const char *_EnvString); + void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes); + char *__cdecl ultoa(unsigned long _Val,char *_Dstbuf,int _Radix); + onexit_t __cdecl onexit(onexit_t _Func); +#endif +#endif + +#if !defined __NO_ISOCEXT /* externs in static libmingwex.a */ + + typedef struct { long long quot, rem; } lldiv_t; + + lldiv_t __cdecl lldiv(long long, long long); + + __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); } + + long long __cdecl strtoll(const char* __restrict__, char** __restrict, int); + unsigned long long __cdecl strtoull(const char* __restrict__, char** __restrict__, int); + + /* these are stubs for MS _i64 versions */ + long long __cdecl atoll (const char *); + +#ifndef __STRICT_ANSI__ + long long __cdecl wtoll (const wchar_t *); + char *__cdecl lltoa (long long, char *, int); + char *__cdecl ulltoa (unsigned long long , char *, int); + wchar_t *__cdecl lltow (long long, wchar_t *, int); + wchar_t *__cdecl ulltow (unsigned long long, wchar_t *, int); + + /* __CRT_INLINE using non-ansi functions */ + __CRT_INLINE long long __cdecl atoll (const char * _c) { return _atoi64 (_c); } + __CRT_INLINE char *__cdecl lltoa (long long _n, char * _c, int _i) { return _i64toa (_n, _c, _i); } + __CRT_INLINE char *__cdecl ulltoa (unsigned long long _n, char * _c, int _i) { return _ui64toa (_n, _c, _i); } + __CRT_INLINE long long __cdecl wtoll (const wchar_t * _w) { return _wtoi64 (_w); } + __CRT_INLINE wchar_t *__cdecl lltow (long long _n, wchar_t * _w, int _i) { return _i64tow (_n, _w, _i); } + __CRT_INLINE wchar_t *__cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); } +#endif /* (__STRICT_ANSI__) */ + +#endif /* !__NO_ISOCEXT */ + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include +#include + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/string.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/string.h new file mode 100644 index 00000000..3249dc3b --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/string.h @@ -0,0 +1,164 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STRING +#define _INC_STRING + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _NLSCMP_DEFINED +#define _NLSCMP_DEFINED +#define _NLSCMPERROR 2147483647 +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define _WConst_return _CONST_RETURN + +#ifndef _CRT_MEMORY_DEFINED +#define _CRT_MEMORY_DEFINED + _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); + _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); + _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); + _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); + int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); + void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); + void *__cdecl memset(void *_Dst,int _Val,size_t _Size); +#ifndef NO_OLDNAMES + void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); + int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); +#endif +#endif + char *__cdecl _strset(char *_Str,int _Val); + char *__cdecl strcpy(char *_Dest,const char *_Source); + char *__cdecl strcat(char *_Dest,const char *_Source); + int __cdecl strcmp(const char *_Str1,const char *_Str2); + size_t __cdecl strlen(const char *_Str); +#if 0 + size_t __cdecl strnlen(const char *_Str,size_t _MaxCount); +#endif + void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size); + _CRTIMP char *__cdecl _strdup(const char *_Src); + _CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val); + _CRTIMP int __cdecl _stricmp(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _strcmpi(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _stricmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + int __cdecl strcoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _strcoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _stricoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _stricoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _strncoll (const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _strnicoll (const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + size_t __cdecl strcspn(const char *_Str,const char *_Control); + _CRTIMP char *__cdecl _strerror(const char *_ErrMsg); + char *__cdecl strerror(int); + _CRTIMP char *__cdecl _strlwr(char *_String); + char *strlwr_l(char *_String,_locale_t _Locale); + char *__cdecl strncat(char *_Dest,const char *_Source,size_t _Count); + int __cdecl strncmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + char *strncpy(char *_Dest,const char *_Source,size_t _Count); + _CRTIMP char *__cdecl _strnset(char *_Str,int _Val,size_t _MaxCount); + _CONST_RETURN char *__cdecl strpbrk(const char *_Str,const char *_Control); + _CONST_RETURN char *__cdecl strrchr(const char *_Str,int _Ch); + _CRTIMP char *__cdecl _strrev(char *_Str); + size_t __cdecl strspn(const char *_Str,const char *_Control); + _CONST_RETURN char *__cdecl strstr(const char *_Str,const char *_SubStr); + char *__cdecl strtok(char *_Str,const char *_Delim); + _CRTIMP char *__cdecl _strupr(char *_String); + _CRTIMP char *_strupr_l(char *_String,_locale_t _Locale); + size_t __cdecl strxfrm(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP size_t __cdecl _strxfrm_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + +#ifndef NO_OLDNAMES + char *__cdecl strdup(const char *_Src); + int __cdecl strcmpi(const char *_Str1,const char *_Str2); + int __cdecl stricmp(const char *_Str1,const char *_Str2); + char *__cdecl strlwr(char *_Str); + int __cdecl strnicmp(const char *_Str1,const char *_Str,size_t _MaxCount); + __CRT_INLINE int __cdecl strncasecmp (const char *__sz1, const char *__sz2, size_t __sizeMaxCompare) { return _strnicmp (__sz1, __sz2, __sizeMaxCompare); } + __CRT_INLINE int __cdecl strcasecmp (const char *__sz1, const char *__sz2) { return _stricmp (__sz1, __sz2); } + char *__cdecl strnset(char *_Str,int _Val,size_t _MaxCount); + char *__cdecl strrev(char *_Str); + char *__cdecl strset(char *_Str,int _Val); + char *__cdecl strupr(char *_Str); +#endif + +#ifndef _WSTRING_DEFINED +#define _WSTRING_DEFINED + + _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); + wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); + _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); + int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); + wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); + size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); + size_t __cdecl wcslen(const wchar_t *_Str); + size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); + wchar_t *wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); + size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr); + wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim); + _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum); + _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str); + _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str); + _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val); + _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String); + _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String); + _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale); + size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount); + _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale); + int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + +#ifndef NO_OLDNAMES + wchar_t *__cdecl wcsdup(const wchar_t *_Str); +#define wcswcs wcsstr + int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + wchar_t *__cdecl wcsrev(wchar_t *_Str); + wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val); + wchar_t *__cdecl wcslwr(wchar_t *_Str); + wchar_t *__cdecl wcsupr(wchar_t *_Str); + int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/fcntl.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/fcntl.h new file mode 100644 index 00000000..29fd55a1 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/fcntl.h @@ -0,0 +1,13 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * This file is part of the Mingw32 package. + * + * This fcntl.h maps to the root fcntl.h + */ +#ifndef __STRICT_ANSI__ +#include +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/file.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/file.h new file mode 100644 index 00000000..370f352d --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/file.h @@ -0,0 +1,14 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * This file is part of the Mingw32 package. + * + * This file.h maps to the root fcntl.h + * TODO? + */ +#ifndef __STRICT_ANSI__ +#include +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/locking.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/locking.h new file mode 100644 index 00000000..e3fc85b3 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/locking.h @@ -0,0 +1,30 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_LOCKING +#define _INC_LOCKING + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +/* All the headers include this file. */ +#include <_mingw.h> + +#define _LK_UNLCK 0 +#define _LK_LOCK 1 +#define _LK_NBLCK 2 +#define _LK_RLCK 3 +#define _LK_NBRLCK 4 + +#ifndef NO_OLDNAMES +#define LK_UNLCK _LK_UNLCK +#define LK_LOCK _LK_LOCK +#define LK_NBLCK _LK_NBLCK +#define LK_RLCK _LK_RLCK +#define LK_NBRLCK _LK_NBRLCK +#endif + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/stat.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/stat.h new file mode 100644 index 00000000..344d4a24 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/stat.h @@ -0,0 +1,290 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STAT +#define _INC_STAT + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#include + +#ifndef __TINYC__ /* gr */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif +#endif + +#ifndef _TIME32_T_DEFINED + typedef long __time32_t; +#define _TIME32_T_DEFINED +#endif + +#ifndef _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +#define _TIME64_T_DEFINED +#endif + +#ifndef _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#define _TIME_T_DEFINED +#endif + +#ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + +#ifndef _STAT_DEFINED + +#ifdef _USE_32BIT_TIME_T +#ifndef _WIN64 +#define _fstat32 _fstat +#define _stat32 _stat +#define _wstat32 _wstat +#else +#define _fstat _fstat32 +#define _stat _stat32 +#define _wstat _wstat32 +#endif +#define _fstati64 _fstat32i64 +#define _stati64 _stat32i64 +#define _wstati64 _wstat32i64 +#else +#define _fstat _fstat64i32 +#define _fstati64 _fstat64 +#define _stat _stat64i32 +#define _stati64 _stat64 +#define _wstat _wstat64i32 +#define _wstati64 _wstat64 +#endif + + struct _stat32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + +#ifndef NO_OLDNAMES + struct stat { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; + }; +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + struct _stat32i64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + + struct _stat64i32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; + + struct _stat64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; +#endif + +#define __stat64 _stat64 + +#define _STAT_DEFINED +#endif + +#define _S_IFMT 0xF000 +#define _S_IFDIR 0x4000 +#define _S_IFCHR 0x2000 +#define _S_IFIFO 0x1000 +#define _S_IFREG 0x8000 +#define _S_IREAD 0x0100 +#define _S_IWRITE 0x0080 +#define _S_IEXEC 0x0040 + + _CRTIMP int __cdecl _fstat32(int _FileDes,struct _stat32 *_Stat); + _CRTIMP int __cdecl _stat32(const char *_Name,struct _stat32 *_Stat); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat); + _CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat); + int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat); + __CRT_INLINE int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat) + { + struct _stat64 st; + int ret=_fstat64(_FileDes,&st); + _Stat->st_dev=st.st_dev; + _Stat->st_ino=st.st_ino; + _Stat->st_mode=st.st_mode; + _Stat->st_nlink=st.st_nlink; + _Stat->st_uid=st.st_uid; + _Stat->st_gid=st.st_gid; + _Stat->st_rdev=st.st_rdev; + _Stat->st_size=(_off_t) st.st_size; + _Stat->st_atime=st.st_atime; + _Stat->st_mtime=st.st_mtime; + _Stat->st_ctime=st.st_ctime; + return ret; + } + _CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat); + _CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat); + int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat); + __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat) + { + struct _stat64 st; + int ret=_stat64(_Name,&st); + _Stat->st_dev=st.st_dev; + _Stat->st_ino=st.st_ino; + _Stat->st_mode=st.st_mode; + _Stat->st_nlink=st.st_nlink; + _Stat->st_uid=st.st_uid; + _Stat->st_gid=st.st_gid; + _Stat->st_rdev=st.st_rdev; + _Stat->st_size=(_off_t) st.st_size; + _Stat->st_atime=st.st_atime; + _Stat->st_mtime=st.st_mtime; + _Stat->st_ctime=st.st_ctime; + return ret; + } +#endif + +#ifndef _WSTAT_DEFINED +#define _WSTAT_DEFINED + _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); + int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); + _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); +#endif +#endif + +#ifndef NO_OLDNAMES +#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ + +#define S_IFMT _S_IFMT +#define S_IFDIR _S_IFDIR +#define S_IFCHR _S_IFCHR +#define S_IFREG _S_IFREG +#define S_IREAD _S_IREAD +#define S_IWRITE _S_IWRITE +#define S_IEXEC _S_IEXEC +#define S_IFIFO _S_IFIFO +#define S_IFBLK _S_IFBLK + +#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) +#define _S_IXUSR _S_IEXEC +#define _S_IWUSR _S_IWRITE + +#define S_IRWXU _S_IRWXU +#define S_IXUSR _S_IXUSR +#define S_IWUSR _S_IWUSR +#define S_IRUSR _S_IRUSR +#define _S_IRUSR _S_IREAD + +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) + +#endif + +#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) +int __cdecl stat(const char *_Filename,struct stat *_Stat); +int __cdecl fstat(int _Desc,struct stat *_Stat); +int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat); +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { + return _fstat32(_Desc,(struct _stat32 *)_Stat); +} +__CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { + return _stat32(_Filename,(struct _stat32 *)_Stat); +} +#else +__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { + return _fstat64i32(_Desc,(struct _stat64i32 *)_Stat); +} +__CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { + return _stat64i32(_Filename,(struct _stat64i32 *)_Stat); +} +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/time.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/time.h new file mode 100644 index 00000000..8ccab831 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/time.h @@ -0,0 +1,69 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __STRICT_ANSI__ +#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ +#define _TIMEVAL_DEFINED +struct timeval { + long tv_sec; + long tv_usec; +}; +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec != (uvp)->tv_sec) ? \ + ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ + ((tvp)->tv_usec cmp (uvp)->tv_usec)) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif /* _TIMEVAL_DEFINED */ + +#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ +#define _TIMEZONE_DEFINED +/* Provided for compatibility with code that assumes that + the presence of gettimeofday function implies a definition + of struct timezone. */ +struct timezone +{ + int tz_minuteswest; /* of Greenwich */ + int tz_dsttime; /* type of dst correction to apply */ +}; + + extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); + +#endif + +/* + Implementation as per: + The Open Group Base Specifications, Issue 6 + IEEE Std 1003.1, 2004 Edition + + The timezone pointer arg is ignored. Errors are ignored. +*/ +#ifndef _GETTIMEOFDAY_DEFINED +#define _GETTIMEOFDAY_DEFINED +int __cdecl gettimeofday(struct timeval *__restrict__, + void *__restrict__ /* tzp (unused) */); +#endif + +#endif /* __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif + +/* Adding timespec definition. */ +#include + + +#endif /* _SYS_TIME_H_ */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/timeb.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/timeb.h new file mode 100644 index 00000000..34837738 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/timeb.h @@ -0,0 +1,133 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _TIMEB_H_ +#define _TIMEB_H_ + +#include <_mingw.h> + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#ifndef __TINYC__ /* gr */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif +#endif + +#ifndef _TIME32_T_DEFINED + typedef long __time32_t; +#define _TIME32_T_DEFINED +#endif + +#ifndef _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +#define _TIME64_T_DEFINED +#endif + +#ifndef _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#define _TIME_T_DEFINED +#endif + +#ifndef _TIMEB_DEFINED +#define _TIMEB_DEFINED + + struct __timeb32 { + __time32_t time; + unsigned short millitm; + short timezone; + short dstflag; + }; + +#ifndef NO_OLDNAMES + struct timeb { + time_t time; + unsigned short millitm; + short timezone; + short dstflag; + }; +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + struct __timeb64 { + __time64_t time; + unsigned short millitm; + short timezone; + short dstflag; + }; +#endif + +#ifdef _USE_32BIT_TIME_T +#define _timeb __timeb32 +//gr #define _ftime _ftime32 +#define _ftime32 _ftime +#else +#define _timeb __timeb64 +#define _ftime _ftime64 +#endif +#endif + + _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time); +#endif + +#ifndef _TIMESPEC_DEFINED +#define _TIMESPEC_DEFINED +struct timespec { + time_t tv_sec; /* Seconds */ + long tv_nsec; /* Nanoseconds */ +}; + +struct itimerspec { + struct timespec it_interval; /* Timer period */ + struct timespec it_value; /* Timer expiration */ +}; +#endif + +#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { + _ftime32((struct __timeb32 *)_Tmb); +} +#else +__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { + _ftime64((struct __timeb64 *)_Tmb); +} +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/types.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/types.h new file mode 100644 index 00000000..7379b0f1 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/types.h @@ -0,0 +1,118 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_TYPES +#define _INC_TYPES + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <_mingw.h> + +#ifndef __TINYC__ /* gr */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif +#endif + +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED +typedef long __time32_t; +#endif + +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 +typedef __int64 __time64_t; +#endif +#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T +typedef __time32_t time_t; +#else +typedef __time64_t time_t; +#endif +#endif + +#ifndef _INO_T_DEFINED +#define _INO_T_DEFINED +typedef unsigned short _ino_t; +#ifndef NO_OLDNAMES +typedef unsigned short ino_t; +#endif +#endif + +#ifndef _DEV_T_DEFINED +#define _DEV_T_DEFINED +typedef unsigned int _dev_t; +#ifndef NO_OLDNAMES +typedef unsigned int dev_t; +#endif +#endif + +#ifndef _PID_T_ +#define _PID_T_ +#ifndef _WIN64 +typedef int _pid_t; +#else +typedef __int64 _pid_t; +#endif + +#ifndef NO_OLDNAMES +typedef _pid_t pid_t; +#endif +#endif /* Not _PID_T_ */ + +#ifndef _MODE_T_ +#define _MODE_T_ +typedef unsigned short _mode_t; + +#ifndef NO_OLDNAMES +typedef _mode_t mode_t; +#endif +#endif /* Not _MODE_T_ */ + +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif + +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif + +#ifndef _TIMESPEC_DEFINED +#define _TIMESPEC_DEFINED +struct timespec { + time_t tv_sec; /* Seconds */ + long tv_nsec; /* Nanoseconds */ +}; + +struct itimerspec { + struct timespec it_interval; /* Timer period */ + struct timespec it_value; /* Timer expiration */ +}; +#endif + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/unistd.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/unistd.h new file mode 100644 index 00000000..31006d32 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/unistd.h @@ -0,0 +1,14 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * This file is part of the Mingw32 package. + * + * unistd.h maps (roughly) to io.h + */ +#ifndef __STRICT_ANSI__ +#include +#endif + diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/utime.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/utime.h new file mode 100644 index 00000000..fec8304f --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/sys/utime.h @@ -0,0 +1,146 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_UTIME +#define _INC_UTIME + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + +#ifndef __TINYC__ /* gr */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif +#endif + +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED + typedef long __time32_t; +#endif + +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#endif + +#ifndef _UTIMBUF_DEFINED +#define _UTIMBUF_DEFINED + + struct _utimbuf { + time_t actime; + time_t modtime; + }; + + struct __utimbuf32 { + __time32_t actime; + __time32_t modtime; + }; + +#if _INTEGRAL_MAX_BITS >= 64 + struct __utimbuf64 { + __time64_t actime; + __time64_t modtime; + }; +#endif + +#ifndef NO_OLDNAMES + struct utimbuf { + time_t actime; + time_t modtime; + }; + + struct utimbuf32 { + __time32_t actime; + __time32_t modtime; + }; +#endif +#endif + + _CRTIMP int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Time); + _CRTIMP int __cdecl _futime32(int _FileDes,struct __utimbuf32 *_Time); + _CRTIMP int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Time); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _utime64(const char *_Filename,struct __utimbuf64 *_Time); + _CRTIMP int __cdecl _futime64(int _FileDes,struct __utimbuf64 *_Time); + _CRTIMP int __cdecl _wutime64(const wchar_t *_Filename,struct __utimbuf64 *_Time); +#endif + +#ifndef RC_INVOKED +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { + return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { + return _futime32(_Desc,(struct __utimbuf32 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { + return _wutime32(_Filename,(struct __utimbuf32 *)_Utimbuf); +} +#else +__CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { + return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { + return _futime64(_Desc,(struct __utimbuf64 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { + return _wutime64(_Filename,(struct __utimbuf64 *)_Utimbuf); +} +#endif + +#ifndef NO_OLDNAMES +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { + return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); +} +#else +__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { + return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); +} +#endif +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/tcc/tcc_libm.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/tcc/tcc_libm.h new file mode 100644 index 00000000..0a62e6fb --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/tcc/tcc_libm.h @@ -0,0 +1,201 @@ +#ifndef _TCC_LIBM_H_ +#define _TCC_LIBM_H_ + +#include "../math.h" + +/* TCC uses 8 bytes for double and long double, so effectively the l variants + * are never used. For now, they just run the normal (double) variant. + */ + +/* + * most of the code in this file is taken from MUSL rs-1.0 (MIT license) + * - musl-libc: http://git.musl-libc.org/cgit/musl/tree/src/math?h=rs-1.0 + * - License: http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT?h=rs-1.0 + */ + +/******************************************************************************* + Start of code based on MUSL +*******************************************************************************/ +/* +musl as a whole is licensed under the following standard MIT license: + +---------------------------------------------------------------------- +Copyright © 2005-2014 Rich Felker, et al. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +---------------------------------------------------------------------- +*/ + +/* fpclassify */ + +__CRT_INLINE int __cdecl __fpclassify (double x) { + union {double f; uint64_t i;} u = {x}; + int e = u.i>>52 & 0x7ff; + if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; + if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; + return FP_NORMAL; +} + +__CRT_INLINE int __cdecl __fpclassifyf (float x) { + union {float f; uint32_t i;} u = {x}; + int e = u.i>>23 & 0xff; + if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; + if (e==0xff) return u.i<<9 ? FP_NAN : FP_INFINITE; + return FP_NORMAL; +} + +__CRT_INLINE int __cdecl __fpclassifyl (long double x) { + return __fpclassify(x); +} + + +/* signbit */ + +__CRT_INLINE int __cdecl __signbit (double x) { + union {double d; uint64_t i;} y = { x }; + return y.i>>63; +} + +__CRT_INLINE int __cdecl __signbitf (float x) { + union {float f; uint32_t i; } y = { x }; + return y.i>>31; +} + +__CRT_INLINE int __cdecl __signbitl (long double x) { + return __signbit(x); +} + + +/* fmin*, fmax* */ + +#define TCCFP_FMIN_EVAL (isnan(x) ? y : \ + isnan(y) ? x : \ + (signbit(x) != signbit(y)) ? (signbit(x) ? x : y) : \ + x < y ? x : y) + +__CRT_INLINE double __cdecl fmin (double x, double y) { + return TCCFP_FMIN_EVAL; +} + +__CRT_INLINE float __cdecl fminf (float x, float y) { + return TCCFP_FMIN_EVAL; +} + +__CRT_INLINE long double __cdecl fminl (long double x, long double y) { + return TCCFP_FMIN_EVAL; +} + +#define TCCFP_FMAX_EVAL (isnan(x) ? y : \ + isnan(y) ? x : \ + (signbit(x) != signbit(y)) ? (signbit(x) ? y : x) : \ + x < y ? y : x) + +__CRT_INLINE double __cdecl fmax (double x, double y) { + return TCCFP_FMAX_EVAL; +} + +__CRT_INLINE float __cdecl fmaxf (float x, float y) { + return TCCFP_FMAX_EVAL; +} + +__CRT_INLINE long double __cdecl fmaxl (long double x, long double y) { + return TCCFP_FMAX_EVAL; +} + + +/* *round* */ + +#define TCCFP_FORCE_EVAL(x) do { \ +if (sizeof(x) == sizeof(float)) { \ + volatile float __x; \ + __x = (x); \ +} else if (sizeof(x) == sizeof(double)) { \ + volatile double __x; \ + __x = (x); \ +} else { \ + volatile long double __x; \ + __x = (x); \ +} \ +} while(0) + +__CRT_INLINE double __cdecl round (double x) { + union {double f; uint64_t i;} u = {x}; + int e = u.i >> 52 & 0x7ff; + double y; + + if (e >= 0x3ff+52) + return x; + if (u.i >> 63) + x = -x; + if (e < 0x3ff-1) { + /* raise inexact if x!=0 */ + TCCFP_FORCE_EVAL(x + 0x1p52); + return 0*u.f; + } + y = (double)(x + 0x1p52) - 0x1p52 - x; + if (y > 0.5) + y = y + x - 1; + else if (y <= -0.5) + y = y + x + 1; + else + y = y + x; + if (u.i >> 63) + y = -y; + return y; +} + +__CRT_INLINE long __cdecl lround (double x) { + return round(x); +} + +__CRT_INLINE long long __cdecl llround (double x) { + return round(x); +} + +__CRT_INLINE float __cdecl roundf (float x) { + return round(x); +} + +__CRT_INLINE long __cdecl lroundf (float x) { + return round(x); +} + +__CRT_INLINE long long __cdecl llroundf (float x) { + return round(x); +} + +__CRT_INLINE long double __cdecl roundl (long double x) { + return round(x); +} + +__CRT_INLINE long __cdecl lroundl (long double x) { + return round(x); +} + +__CRT_INLINE long long __cdecl llroundl (long double x) { + return round(x); +} + + +/******************************************************************************* + End of code based on MUSL +*******************************************************************************/ + +#endif /* _TCC_LIBM_H_ */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/tcclib.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/tcclib.h new file mode 100644 index 00000000..8d59e4c9 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/tcclib.h @@ -0,0 +1,80 @@ +/* Simple libc header for TCC + * + * Add any function you want from the libc there. This file is here + * only for your convenience so that you do not need to put the whole + * glibc include files on your floppy disk + */ +#ifndef _TCCLIB_H +#define _TCCLIB_H + +#include +#include + +/* stdlib.h */ +void *calloc(size_t nmemb, size_t size); +void *malloc(size_t size); +void free(void *ptr); +void *realloc(void *ptr, size_t size); +int atoi(const char *nptr); +long int strtol(const char *nptr, char **endptr, int base); +unsigned long int strtoul(const char *nptr, char **endptr, int base); +void exit(int); + +/* stdio.h */ +typedef struct __FILE FILE; +#define EOF (-1) +extern FILE *stdin; +extern FILE *stdout; +extern FILE *stderr; +FILE *fopen(const char *path, const char *mode); +FILE *fdopen(int fildes, const char *mode); +FILE *freopen(const char *path, const char *mode, FILE *stream); +int fclose(FILE *stream); +size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); +size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream); +int fgetc(FILE *stream); +char *fgets(char *s, int size, FILE *stream); +int getc(FILE *stream); +int getchar(void); +char *gets(char *s); +int ungetc(int c, FILE *stream); +int fflush(FILE *stream); +int putchar (int c); + +int printf(const char *format, ...); +int fprintf(FILE *stream, const char *format, ...); +int sprintf(char *str, const char *format, ...); +int snprintf(char *str, size_t size, const char *format, ...); +int asprintf(char **strp, const char *format, ...); +int dprintf(int fd, const char *format, ...); +int vprintf(const char *format, va_list ap); +int vfprintf(FILE *stream, const char *format, va_list ap); +int vsprintf(char *str, const char *format, va_list ap); +int vsnprintf(char *str, size_t size, const char *format, va_list ap); +int vasprintf(char **strp, const char *format, va_list ap); +int vdprintf(int fd, const char *format, va_list ap); + +void perror(const char *s); + +/* string.h */ +char *strcat(char *dest, const char *src); +char *strchr(const char *s, int c); +char *strrchr(const char *s, int c); +char *strcpy(char *dest, const char *src); +void *memcpy(void *dest, const void *src, size_t n); +void *memmove(void *dest, const void *src, size_t n); +void *memset(void *s, int c, size_t n); +char *strdup(const char *s); +size_t strlen(const char *s); + +/* dlfcn.h */ +#define RTLD_LAZY 0x001 +#define RTLD_NOW 0x002 +#define RTLD_GLOBAL 0x100 + +void *dlopen(const char *filename, int flag); +const char *dlerror(void); +void *dlsym(void *handle, char *symbol); +int dlclose(void *handle); + +#endif /* _TCCLIB_H */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/tchar.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/tchar.h new file mode 100644 index 00000000..cd44beca --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/tchar.h @@ -0,0 +1,1102 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#ifndef _INC_TCHAR +#define _INC_TCHAR + +#ifdef _STRSAFE_H_INCLUDED_ +#error Need to include strsafe.h after tchar.h +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define _ftcscat _tcscat +#define _ftcschr _tcschr +#define _ftcscpy _tcscpy +#define _ftcscspn _tcscspn +#define _ftcslen _tcslen +#define _ftcsncat _tcsncat +#define _ftcsncpy _tcsncpy +#define _ftcspbrk _tcspbrk +#define _ftcsrchr _tcsrchr +#define _ftcsspn _tcsspn +#define _ftcsstr _tcsstr +#define _ftcstok _tcstok + +#define _ftcsdup _tcsdup +#define _ftcsnset _tcsnset +#define _ftcsrev _tcsrev +#define _ftcsset _tcsset + +#define _ftcscmp _tcscmp +#define _ftcsicmp _tcsicmp +#define _ftcsnccmp _tcsnccmp +#define _ftcsncmp _tcsncmp +#define _ftcsncicmp _tcsncicmp +#define _ftcsnicmp _tcsnicmp + +#define _ftcscoll _tcscoll +#define _ftcsicoll _tcsicoll +#define _ftcsnccoll _tcsnccoll +#define _ftcsncoll _tcsncoll +#define _ftcsncicoll _tcsncicoll +#define _ftcsnicoll _tcsnicoll + +#define _ftcsclen _tcsclen +#define _ftcsnccat _tcsnccat +#define _ftcsnccpy _tcsnccpy +#define _ftcsncset _tcsncset + +#define _ftcsdec _tcsdec +#define _ftcsinc _tcsinc +#define _ftcsnbcnt _tcsnbcnt +#define _ftcsnccnt _tcsnccnt +#define _ftcsnextc _tcsnextc +#define _ftcsninc _tcsninc +#define _ftcsspnp _tcsspnp + +#define _ftcslwr _tcslwr +#define _ftcsupr _tcsupr + +#define _ftclen _tclen +#define _ftccpy _tccpy +#define _ftccmp _tccmp + +#ifndef _CONST_RETURN +#ifdef __cplusplus +#define _CONST_RETURN const +#define _CRT_CONST_CORRECT_OVERLOADS +#else +#define _CONST_RETURN +#endif +#endif + +#define _WConst_return _CONST_RETURN + +#ifdef _UNICODE + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WCTYPE_T_DEFINED +#define _WCTYPE_T_DEFINED + typedef unsigned short wint_t; + typedef unsigned short wctype_t; +#endif + +#ifndef __TCHAR_DEFINED +#define __TCHAR_DEFINED + typedef wchar_t _TCHAR; + typedef wchar_t _TSCHAR; + typedef wchar_t _TUCHAR; + typedef wchar_t _TXCHAR; + typedef wint_t _TINT; +#endif + +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED +#ifndef NO_OLDNAMES + typedef wchar_t TCHAR; +#endif +#endif + +#define _TEOF WEOF + +#define __T(x) L##x + +#define _tmain wmain +#define _tWinMain wWinMain +#define _tenviron _wenviron +#define __targv __wargv + +#define _tprintf wprintf +#define _tprintf_l _wprintf_l +#define _tprintf_p _wprintf_p +#define _tprintf_p_l _wprintf_p_l +#define _tcprintf _cwprintf +#define _tcprintf_l _cwprintf_l +#define _tcprintf_p _cwprintf_p +#define _tcprintf_p_l _cwprintf_p_l +#define _vtcprintf _vcwprintf +#define _vtcprintf_l _vcwprintf_l +#define _vtcprintf_p _vcwprintf_p +#define _vtcprintf_p_l _vcwprintf_p_l +#define _ftprintf fwprintf +#define _ftprintf_l _fwprintf_l +#define _ftprintf_p _fwprintf_p +#define _ftprintf_p_l _fwprintf_p_l +#define _stprintf swprintf +#define _stprintf_l __swprintf_l +#define _stprintf_p _swprintf_p +#define _stprintf_p_l _swprintf_p_l +#define _sctprintf _scwprintf +#define _sctprintf_l _scwprintf_l +#define _sctprintf_p _scwprintf_p +#define _sctprintf_p_l _scwprintf_p_l +#define _sntprintf _snwprintf +#define _sntprintf_l _snwprintf_l +#define _vtprintf vwprintf +#define _vtprintf_l _vwprintf_l +#define _vtprintf_p _vwprintf_p +#define _vtprintf_p_l _vwprintf_p_l +#define _vftprintf vfwprintf +#define _vftprintf_l _vfwprintf_l +#define _vftprintf_p _vfwprintf_p +#define _vftprintf_p_l _vfwprintf_p_l +#define _vstprintf vswprintf +#define _vstprintf_l _vswprintf_l +#define _vstprintf_p _vswprintf_p +#define _vstprintf_p_l _vswprintf_p_l +#define _vsctprintf _vscwprintf +#define _vsctprintf_l _vscwprintf_l +#define _vsctprintf_p _vscwprintf_p +#define _vsctprintf_p_l _vscwprintf_p_l +#define _vsntprintf _vsnwprintf +#define _vsntprintf_l _vsnwprintf_l + +#define _tscanf wscanf +#define _tscanf_l _wscanf_l +#define _tcscanf _cwscanf +#define _tcscanf_l _cwscanf_l +#define _ftscanf fwscanf +#define _ftscanf_l _fwscanf_l +#define _stscanf swscanf +#define _stscanf_l _swscanf_l +#define _sntscanf _snwscanf +#define _sntscanf_l _snwscanf_l + +#define _fgettc fgetwc +#define _fgettc_nolock _fgetwc_nolock +#define _fgettchar _fgetwchar +#define _fgetts fgetws +#define _fputtc fputwc +#define _fputtc_nolock _fputwc_nolock +#define _fputtchar _fputwchar +#define _fputts fputws +#define _cputts _cputws +#define _cgetts _cgetws +#define _gettc getwc +#define _gettc_nolock _getwc_nolock +#define _gettch _getwch +#define _gettch_nolock _getwch_nolock +#define _gettche _getwche +#define _gettche_nolock _getwche_nolock +#define _gettchar getwchar +#define _gettchar_nolock _getwchar_nolock +#define _getts _getws +#define _puttc putwc +#define _puttc_nolock _putwc_nolock +#define _puttchar putwchar +#define _puttchar_nolock _putwchar_nolock +#define _puttch _putwch +#define _puttch_nolock _putwch_nolock +#define _putts _putws +#define _ungettc ungetwc +#define _ungettc_nolock _ungetwc_nolock +#define _ungettch _ungetwch +#define _ungettch_nolock _ungetwch_nolock + +#define _tcstod wcstod +#define _tcstol wcstol +#define _tcstoul wcstoul +#define _tcstoi64 _wcstoi64 +#define _tcstoui64 _wcstoui64 +#define _tstof _wtof +#define _tstol _wtol +#define _tstoi _wtoi +#define _tstoi64 _wtoi64 +#define _tcstod_l _wcstod_l +#define _tcstol_l _wcstol_l +#define _tcstoul_l _wcstoul_l +#define _tcstoi64_l _wcstoi64_l +#define _tcstoui64_l _wcstoui64_l +#define _tstof_l _wtof_l +#define _tstol_l _wtol_l +#define _tstoi_l _wtoi_l +#define _tstoi64_l _wtoi64_l + +#define _itot _itow +#define _ltot _ltow +#define _ultot _ultow +#define _ttoi _wtoi +#define _ttol _wtol + +#define _ttoi64 _wtoi64 +#define _i64tot _i64tow +#define _ui64tot _ui64tow + +#define _tcscat wcscat +#define _tcschr wcschr +#define _tcscpy wcscpy +#define _tcscspn wcscspn +#define _tcslen wcslen +#define _tcsnlen wcsnlen +#define _tcsncat wcsncat +#define _tcsncat_l _wcsncat_l +#define _tcsncpy wcsncpy +#define _tcsncpy_l _wcsncpy_l +#define _tcspbrk wcspbrk +#define _tcsrchr wcsrchr +#define _tcsspn wcsspn +#define _tcsstr wcsstr +#define _tcstok wcstok +#define _tcstok_l _wcstok_l +#define _tcserror _wcserror +#define __tcserror __wcserror + +#define _tcsdup _wcsdup +#define _tcsnset _wcsnset +#define _tcsnset_l _wcsnset_l +#define _tcsrev _wcsrev +#define _tcsset _wcsset +#define _tcsset_l _wcsset_l + +#define _tcscmp wcscmp +#define _tcsicmp _wcsicmp +#define _tcsicmp_l _wcsicmp_l +#define _tcsnccmp wcsncmp +#define _tcsncmp wcsncmp +#define _tcsncicmp _wcsnicmp +#define _tcsncicmp_l _wcsnicmp_l +#define _tcsnicmp _wcsnicmp +#define _tcsnicmp_l _wcsnicmp_l + +#define _tcscoll wcscoll +#define _tcscoll_l _wcscoll_l +#define _tcsicoll _wcsicoll +#define _tcsicoll_l _wcsicoll_l +#define _tcsnccoll _wcsncoll +#define _tcsnccoll_l _wcsncoll_l +#define _tcsncoll _wcsncoll +#define _tcsncoll_l _wcsncoll_l +#define _tcsncicoll _wcsnicoll +#define _tcsncicoll_l _wcsnicoll_l +#define _tcsnicoll _wcsnicoll +#define _tcsnicoll_l _wcsnicoll_l + +#define _texecl _wexecl +#define _texecle _wexecle +#define _texeclp _wexeclp +#define _texeclpe _wexeclpe +#define _texecv _wexecv +#define _texecve _wexecve +#define _texecvp _wexecvp +#define _texecvpe _wexecvpe + +#define _tspawnl _wspawnl +#define _tspawnle _wspawnle +#define _tspawnlp _wspawnlp +#define _tspawnlpe _wspawnlpe +#define _tspawnv _wspawnv +#define _tspawnve _wspawnve +#define _tspawnvp _wspawnvp +#define _tspawnvp _wspawnvp +#define _tspawnvpe _wspawnvpe + +#define _tsystem _wsystem + +#define _tasctime _wasctime +#define _tctime _wctime +#define _tctime32 _wctime32 +#define _tctime64 _wctime64 +#define _tstrdate _wstrdate +#define _tstrtime _wstrtime +#define _tutime _wutime +#define _tutime32 _wutime32 +#define _tutime64 _wutime64 +#define _tcsftime wcsftime +#define _tcsftime_l _wcsftime_l + +#define _tchdir _wchdir +#define _tgetcwd _wgetcwd +#define _tgetdcwd _wgetdcwd +#define _tgetdcwd_nolock _wgetdcwd_nolock +#define _tmkdir _wmkdir +#define _trmdir _wrmdir + +#define _tfullpath _wfullpath +#define _tgetenv _wgetenv +#define _tmakepath _wmakepath +#define _tpgmptr _wpgmptr +#define _get_tpgmptr _get_wpgmptr +#define _tputenv _wputenv +#define _tsearchenv _wsearchenv +#define _tsplitpath _wsplitpath + +#define _tfdopen _wfdopen +#define _tfsopen _wfsopen +#define _tfopen _wfopen +#define _tfreopen _wfreopen +#define _tperror _wperror +#define _tpopen _wpopen +#define _ttempnam _wtempnam +#define _ttmpnam _wtmpnam + +#define _taccess _waccess +#define _tchmod _wchmod +#define _tcreat _wcreat +#define _tfindfirst _wfindfirst +#define _tfindfirst32 _wfindfirst32 +#define _tfindfirst64 _wfindfirst64 +#define _tfindfirsti64 _wfindfirsti64 +#define _tfindfirst32i64 _wfindfirst32i64 +#define _tfindfirst64i32 _wfindfirst64i32 +#define _tfindnext _wfindnext +#define _tfindnext32 _wfindnext32 +#define _tfindnext64 _wfindnext64 +#define _tfindnexti64 _wfindnexti64 +#define _tfindnext32i64 _wfindnext32i64 +#define _tfindnext64i32 _wfindnext64i32 +#define _tmktemp _wmktemp +#define _topen _wopen +#define _tremove _wremove +#define _trename _wrename +#define _tsopen _wsopen +#define _tunlink _wunlink + +#define _tfinddata_t _wfinddata_t +#define _tfinddata32_t _wfinddata32_t +#define _tfinddata64_t _wfinddata64_t +#define _tfinddatai64_t _wfinddatai64_t +#define _tfinddata32i64_t _wfinddata32i64_t +#define _tfinddata64i32_t _wfinddata64i32_t + +#define _tstat _wstat +#define _tstat32 _wstat32 +#define _tstat32i64 _wstat32i64 +#define _tstat64 _wstat64 +#define _tstat64i32 _wstat64i32 +#define _tstati64 _wstati64 + +#define _tsetlocale _wsetlocale + +#define _tcsclen wcslen +#define _tcscnlen wcsnlen +#define _tcsclen_l(_String,_Locale) wcslen(_String) +#define _tcscnlen_l(_String,_Max_count,_Locale) wcsnlen_l((_String),(_Max_count)) +#define _tcsnccat wcsncat +#define _tcsnccat_l _wcsncat_l +#define _tcsnccpy wcsncpy +#define _tcsnccpy_l _wcsncpy_l +#define _tcsncset _wcsnset + +#define _tcsdec _wcsdec +#define _tcsinc _wcsinc +#define _tcsnbcnt _wcsncnt +#define _tcsnccnt _wcsncnt +#define _tcsnextc _wcsnextc +#define _tcsninc _wcsninc +#define _tcsspnp _wcsspnp + +#define _tcslwr _wcslwr +#define _tcslwr_l _wcslwr_l +#define _tcsupr _wcsupr +#define _tcsupr_l _wcsupr_l +#define _tcsxfrm wcsxfrm +#define _tcsxfrm_l _wcsxfrm_l + +#define _tclen(_pc) (1) +#define _tccpy(_pc1,_cpc2) ((*(_pc1) = *(_cpc2))) +#define _tccmp(_cpc1,_cpc2) ((*(_cpc1))-(*(_cpc2))) + +#define _istalnum iswalnum +#define _istalnum_l _iswalnum_l +#define _istalpha iswalpha +#define _istalpha_l _iswalpha_l +#define _istascii iswascii +#define _istcntrl iswcntrl +#define _istcntrl_l _iswcntrl_l +#define _istdigit iswdigit +#define _istdigit_l _iswdigit_l +#define _istgraph iswgraph +#define _istgraph_l _iswgraph_l +#define _istlower iswlower +#define _istlower_l _iswlower_l +#define _istprint iswprint +#define _istprint_l _iswprint_l +#define _istpunct iswpunct +#define _istpunct_l _iswpunct_l +#define _istspace iswspace +#define _istspace_l _iswspace_l +#define _istupper iswupper +#define _istupper_l _iswupper_l +#define _istxdigit iswxdigit +#define _istxdigit_l _iswxdigit_l + +#define _totupper towupper +#define _totupper_l _towupper_l +#define _totlower towlower +#define _totlower_l _towlower_l + +#define _istlegal(_Char) (1) +#define _istlead(_Char) (0) +#define _istleadbyte(_Char) (0) +#define _istleadbyte_l(_Char,_Locale) (0) + +#define _wcsdec(_cpc1,_cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1) +#define _wcsinc(_pc) ((_pc)+1) +#define _wcsnextc(_cpc) ((unsigned int) *(_cpc)) +#define _wcsninc(_pc,_sz) (((_pc)+(_sz))) + _CRTIMP size_t __cdecl __wcsncnt(const wchar_t *_Str,size_t _MaxCount); +#define _wcsncnt(_cpc,_sz) (__wcsncnt(_cpc,_sz)) +#define _wcsspnp(_cpc1,_cpc2) (!_cpc1 ? NULL : ((*((_cpc1)+wcsspn(_cpc1,_cpc2))) ? ((_cpc1)+wcsspn(_cpc1,_cpc2)) : NULL)) +#define _wcsncpy_l(_Destination,_Source,_Count,_Locale) (wcsncpy(_Destination,_Source,_Count)) +#define _wcsncat_l(_Destination,_Source,_Count,_Locale) (wcsncat(_Destination,_Source,_Count)) +#define _wcstok_l(_String,_Delimiters,_Locale) (wcstok(_String,_Delimiters)) +#define _wcsnset_l(_Destination,_Value,_Count,_Locale) (_wcsnset(_Destination,_Value,_Count)) +#define _wcsset_l(_Destination,_Value,_Locale) (_wcsset(_Destination,_Value)) + + /* dirent structures and functions */ +#define _tdirent _wdirent +#define _TDIR _WDIR +#define _topendir _wopendir +#define _tclosedir _wclosedir +#define _treaddir _wreaddir +#define _trewinddir _wrewinddir +#define _ttelldir _wtelldir +#define _tseekdir _wseekdir + +#else + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define _TEOF EOF + +#define __T(x) x + +#define _tmain main +#define _tWinMain WinMain +#ifdef _POSIX_ +#define _tenviron environ +#else +#define _tenviron _environ +#endif +#define __targv __argv + +#define _tprintf printf +#define _tprintf_l _printf_l +#define _tprintf_p _printf_p +#define _tprintf_p_l _printf_p_l +#define _tcprintf _cprintf +#define _tcprintf_l _cprintf_l +#define _tcprintf_p _cprintf_p +#define _tcprintf_p_l _cprintf_p_l +#define _vtcprintf _vcprintf +#define _vtcprintf_l _vcprintf_l +#define _vtcprintf_p _vcprintf_p +#define _vtcprintf_p_l _vcprintf_p_l +#define _ftprintf fprintf +#define _ftprintf_l _fprintf_l +#define _ftprintf_p _fprintf_p +#define _ftprintf_p_l _fprintf_p_l +#define _stprintf sprintf +#define _stprintf_l _sprintf_l +#define _stprintf_p _sprintf_p +#define _stprintf_p_l _sprintf_p_l +#define _sctprintf _scprintf +#define _sctprintf_l _scprintf_l +#define _sctprintf_p _scprintf_p +#define _sctprintf_p_l _scprintf_p_l +#define _sntprintf _snprintf +#define _sntprintf_l _snprintf_l +#define _vtprintf vprintf +#define _vtprintf_l _vprintf_l +#define _vtprintf_p _vprintf_p +#define _vtprintf_p_l _vprintf_p_l +#define _vftprintf vfprintf +#define _vftprintf_l _vfprintf_l +#define _vftprintf_p _vfprintf_p +#define _vftprintf_p_l _vfprintf_p_l +#define _vstprintf vsprintf +#define _vstprintf_l _vsprintf_l +#define _vstprintf_p _vsprintf_p +#define _vstprintf_p_l _vsprintf_p_l +#define _vsctprintf _vscprintf +#define _vsctprintf_l _vscprintf_l +#define _vsctprintf_p _vscprintf_p +#define _vsctprintf_p_l _vscprintf_p_l +#define _vsntprintf _vsnprintf +#define _vsntprintf_l _vsnprintf_l + +#define _tscanf scanf +#define _tscanf_l _scanf_l +#define _tcscanf _cscanf +#define _tcscanf_l _cscanf_l +#define _ftscanf fscanf +#define _ftscanf_l _fscanf_l +#define _stscanf sscanf +#define _stscanf_l _sscanf_l +#define _sntscanf _snscanf +#define _sntscanf_l _snscanf_l + +#define _fgettc fgetc +#define _fgettc_nolock _fgetc_nolock +#define _fgettchar _fgetchar +#define _fgetts fgets +#define _fputtc fputc +#define _fputtc_nolock _fputc_nolock +#define _fputtchar _fputchar +#define _fputts fputs +#define _cputts _cputs +#define _gettc getc +#define _gettc_nolock _getc_nolock +#define _gettch _getch +#define _gettch_nolock _getch_nolock +#define _gettche _getche +#define _gettche_nolock _getche_nolock +#define _gettchar getchar +#define _gettchar_nolock _getchar_nolock +#define _getts gets +#define _cgetts _cgets +#define _puttc putc +#define _puttc_nolock _putc_nolock +#define _puttchar putchar +#define _puttchar_nolock _putchar_nolock +#define _puttch _putch +#define _puttch_nolock _putch_nolock +#define _putts puts +#define _ungettc ungetc +#define _ungettc_nolock _ungetc_nolock +#define _ungettch _ungetch +#define _ungettch_nolock _ungetch_nolock + +#define _tcstod strtod +#define _tcstol strtol +#define _tcstoul strtoul +#define _tstof atof +#define _tstol atol +#define _tstoi atoi +#define _tstoi64 _atoi64 +#define _tcstod_l _strtod_l +#define _tcstol_l _strtol_l +#define _tcstoul_l _strtoul_l +#define _tstof_l _atof_l +#define _tstol_l _atol_l +#define _tstoi_l _atoi_l +#define _tstoi64_l _atoi64_l + +#define _itot _itoa +#define _ltot _ltoa +#define _ultot _ultoa +#define _ttoi atoi +#define _ttol atol + +#define _ttoi64 _atoi64 +#define _tcstoi64 _strtoi64 +#define _tcstoi64_l _strtoi64_l +#define _tcstoui64 _strtoui64 +#define _tcstoui64_l _strtoui64_l +#define _i64tot _i64toa +#define _ui64tot _ui64toa + +#define _tcscat strcat +#define _tcscpy strcpy +#define _tcsdup _strdup +#define _tcslen strlen +#if 0 +#define _tcsnlen strnlen +#endif +#define _tcsxfrm strxfrm +#define _tcsxfrm_l _strxfrm_l +#define _tcserror strerror +#define __tcserror _strerror + +#define _texecl _execl +#define _texecle _execle +#define _texeclp _execlp +#define _texeclpe _execlpe +#define _texecv _execv +#define _texecve _execve +#define _texecvp _execvp +#define _texecvpe _execvpe + +#define _tspawnl _spawnl +#define _tspawnle _spawnle +#define _tspawnlp _spawnlp +#define _tspawnlpe _spawnlpe +#define _tspawnv _spawnv +#define _tspawnve _spawnve +#define _tspawnvp _spawnvp +#define _tspawnvpe _spawnvpe + +#define _tsystem system + +#define _tasctime asctime +#define _tctime ctime +#define _tctime32 _ctime32 +#define _tctime64 _ctime64 +#define _tstrdate _strdate +#define _tstrtime _strtime +#define _tutime _utime +#define _tutime32 _utime32 +#define _tutime64 _utime64 +#define _tcsftime strftime +#define _tcsftime_l _strftime_l + +#define _tchdir _chdir +#define _tgetcwd _getcwd +#define _tgetdcwd _getdcwd +#define _tgetdcwd_nolock _getdcwd_nolock +#define _tmkdir _mkdir +#define _trmdir _rmdir + +#define _tfullpath _fullpath +#define _tgetenv getenv +#define _tmakepath _makepath +#define _tpgmptr _pgmptr +#define _get_tpgmptr _get_pgmptr +#define _tputenv _putenv +#define _tsearchenv _searchenv +#define _tsplitpath _splitpath + +#ifdef _POSIX_ +#define _tfdopen fdopen +#else +#define _tfdopen _fdopen +#endif +#define _tfsopen _fsopen +#define _tfopen fopen +#define _tfreopen freopen +#define _tperror perror +#define _tpopen _popen +#define _ttempnam _tempnam +#define _ttmpnam tmpnam + +#define _tchmod _chmod +#define _tcreat _creat +#define _tfindfirst _findfirst +#define _tfindfirst32 _findfirst32 +#define _tfindfirst64 _findfirst64 +#define _tfindfirsti64 _findfirsti64 +#define _tfindfirst32i64 _findfirst32i64 +#define _tfindfirst64i32 _findfirst64i32 +#define _tfindnext _findnext +#define _tfindnext32 _findnext32 +#define _tfindnext64 _findnext64 +#define _tfindnexti64 _findnexti64 +#define _tfindnext32i64 _findnext32i64 +#define _tfindnext64i32 _findnext64i32 +#define _tmktemp _mktemp + +#ifdef _POSIX_ +#define _topen open +#define _taccess access +#else +#define _topen _open +#define _taccess _access +#endif + +#define _tremove remove +#define _trename rename +#define _tsopen _sopen +#define _tunlink _unlink + +#define _tfinddata_t _finddata_t +#define _tfinddata32_t _finddata32_t +#define _tfinddata64_t __finddata64_t +#define _tfinddatai64_t _finddatai64_t +#define _tfinddata32i64_t _finddata32i64_t +#define _tfinddata64i32_t _finddata64i32_t + +#define _istascii __isascii +#define _istcntrl iscntrl +#define _istcntrl_l _iscntrl_l +#define _istxdigit isxdigit +#define _istxdigit_l _isxdigit_l + +#define _tstat _stat +#define _tstat32 _stat32 +#define _tstat32i64 _stat32i64 +#define _tstat64 _stat64 +#define _tstat64i32 _stat64i32 +#define _tstati64 _stati64 + +#define _tsetlocale setlocale + +#ifdef _MBCS + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __TCHAR_DEFINED + typedef char _TCHAR; + typedef signed char _TSCHAR; + typedef unsigned char _TUCHAR; + typedef unsigned char _TXCHAR; + typedef unsigned int _TINT; +#define __TCHAR_DEFINED +#endif + +#ifndef _TCHAR_DEFINED +#ifndef NO_OLDNAMES + typedef char TCHAR; +#endif +#define _TCHAR_DEFINED +#endif + +#ifdef _MB_MAP_DIRECT + +#define _tcschr _mbschr +#define _tcscspn _mbscspn +#define _tcsncat _mbsnbcat +#define _tcsncat_l _mbsnbcat_l +#define _tcsncpy _mbsnbcpy +#define _tcsncpy_l _mbsnbcpy_l +#define _tcspbrk _mbspbrk +#define _tcsrchr _mbsrchr +#define _tcsspn _mbsspn +#define _tcsstr _mbsstr +#define _tcstok _mbstok +#define _tcstok_l _mbstok_l + +#define _tcsnset _mbsnbset +#define _tcsnset_l _mbsnbset_l +#define _tcsrev _mbsrev +#define _tcsset _mbsset +#define _tcsset_l _mbsset_l + +#define _tcscmp _mbscmp +#define _tcsicmp _mbsicmp +#define _tcsicmp_l _mbsicmp_l +#define _tcsnccmp _mbsncmp +#define _tcsncmp _mbsnbcmp +#define _tcsncicmp _mbsnicmp +#define _tcsncicmp_l _mbsnicmp_l +#define _tcsnicmp _mbsnbicmp +#define _tcsnicmp_l _mbsnbicmp_l + +#define _tcscoll _mbscoll +#define _tcscoll_l _mbscoll_l +#define _tcsicoll _mbsicoll +#define _tcsicoll_l _mbsicoll_l +#define _tcsnccoll _mbsncoll +#define _tcsnccoll_l _mbsncoll_l +#define _tcsncoll _mbsnbcoll +#define _tcsncoll_l _mbsnbcoll_l +#define _tcsncicoll _mbsnicoll +#define _tcsncicoll_l _mbsnicoll_l +#define _tcsnicoll _mbsnbicoll +#define _tcsnicoll_l _mbsnbicoll_l + +#define _tcsclen _mbslen +#define _tcscnlen _mbsnlen +#define _tcsclen_l _mbslen_l +#define _tcscnlen_l _mbsnlen_l +#define _tcsnccat _mbsncat +#define _tcsnccat_l _mbsncat_l +#define _tcsnccpy _mbsncpy +#define _tcsnccpy_l _mbsncpy_l +#define _tcsncset _mbsnset +#define _tcsncset_l _mbsnset_l + +#define _tcsdec _mbsdec +#define _tcsinc _mbsinc +#define _tcsnbcnt _mbsnbcnt +#define _tcsnccnt _mbsnccnt +#define _tcsnextc _mbsnextc +#define _tcsninc _mbsninc +#define _tcsspnp _mbsspnp + +#define _tcslwr _mbslwr +#define _tcslwr_l _mbslwr_l +#define _tcsupr _mbsupr +#define _tcsupr_l _mbsupr_l + +#define _tclen _mbclen +#define _tccpy _mbccpy +#define _tccpy_l _mbccpy_l +#else + + _CRTIMP _CONST_RETURN char *__cdecl _tcschr(const char *_Str,unsigned int _Val); + _CRTIMP size_t __cdecl _tcscspn(const char *_Str,const char *_Control); + _CRTIMP char *__cdecl _tcsncat(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsncpy(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP _CONST_RETURN char *__cdecl _tcspbrk(const char *_Str,const char *_Control); + _CRTIMP _CONST_RETURN char *__cdecl _tcsrchr(const char *_Str,unsigned int _Ch); + _CRTIMP size_t __cdecl _tcsspn(const char *_Str,const char *_Control); + _CRTIMP _CONST_RETURN char *__cdecl _tcsstr(const char *_Str,const char *_Substr); + _CRTIMP char *__cdecl _tcstok(char *_Str,const char *_Delim); + _CRTIMP char *__cdecl _tcstok_l(char *_Str,const char *_Delim,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnset(char *_Str,unsigned int _Val,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsrev(char *_Str); + _CRTIMP char *__cdecl _tcsset(char *_Str,unsigned int _Val); + _CRTIMP char *__cdecl _tcsset_l(char *_Str,unsigned int _Val,_locale_t _Locale); + _CRTIMP int __cdecl _tcscmp(const char *_Str1,const char *_Str); + _CRTIMP int __cdecl _tcsicmp(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _tcsicmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnccmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcscoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _tcscoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _tcsicoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _tcsicoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnccoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsnccoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsncoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsncicoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnicoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP size_t __cdecl _tcsclen(const char *_Str); + _CRTIMP size_t __cdecl _tcscnlen(const char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _tcsclen_l(const char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _tcscnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccat(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccpy(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsncset(char *_Str,unsigned int _Val,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsdec(const char *_Start,const char *_Pos); + _CRTIMP char *__cdecl _tcsinc(const char *_Ptr); + _CRTIMP size_t __cdecl _tcsnbcnt(const char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _tcsnccnt(const char *_Str,size_t _MaxCount); + _CRTIMP unsigned int __cdecl _tcsnextc (const char *_Str); + _CRTIMP char *__cdecl _tcsninc(const char *_Ptr,size_t _Count); + _CRTIMP char *__cdecl _tcsspnp(const char *_Str1,const char *_Str2); + _CRTIMP char *__cdecl _tcslwr(char *_Str); + _CRTIMP char *__cdecl _tcslwr_l(char *_Str,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsupr(char *_Str); + _CRTIMP char *__cdecl _tcsupr_l(char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _tclen(const char *_Str); + _CRTIMP void __cdecl _tccpy(char *_DstCh,const char *_SrcCh); + +#ifdef __cplusplus +#ifndef _CPP_TCHAR_INLINES_DEFINED +#define _CPP_TCHAR_INLINES_DEFINED + extern "C++" { + extern inline char *__cdecl _tcschr(char *_S,unsigned int _C) { return ((char *)_tcschr((const char *)_S,_C)); } + extern inline char *__cdecl _tcspbrk(char *_S,const char *_P) { return ((char *)_tcspbrk((const char *)_S,_P)); } + extern inline char *__cdecl _tcsrchr(char *_S,unsigned int _C) { return ((char *)_tcsrchr((const char *)_S,_C)); } + extern inline char *__cdecl _tcsstr(char *_S,const char *_P) { return ((char *)_tcsstr((const char *)_S,_P)); } + } +#endif +#endif +#endif + +#define _tccmp(_cp1,_cp2) _tcsnccmp(_cp1,_cp2,1) + +#define _istalnum _ismbcalnum +#define _istalnum_l _ismbcalnum_l +#define _istalpha _ismbcalpha +#define _istalpha_l _ismbcalpha_l +#define _istdigit _ismbcdigit +#define _istdigit_l _ismbcdigit_l +#define _istgraph _ismbcgraph +#define _istgraph_l _ismbcgraph_l +#define _istlegal _ismbclegal +#define _istlegal_l _ismbclegal_l +#define _istlower _ismbclower +#define _istlower_l _ismbclower_l +#define _istprint _ismbcprint +#define _istprint_l _ismbcprint_l +#define _istpunct _ismbcpunct +#define _istpunct_l _ismbcpunct_l +#define _istspace _ismbcspace +#define _istspace_l _ismbcspace_l +#define _istupper _ismbcupper +#define _istupper_l _ismbcupper_l + +#define _totupper _mbctoupper +#define _totupper_l _mbctoupper_l +#define _totlower _mbctolower +#define _totlower_l _mbctolower_l + +#define _istlead _ismbblead +#define _istleadbyte isleadbyte +#define _istleadbyte_l _isleadbyte_l +#else + +#ifndef __TCHAR_DEFINED +#define __TCHAR_DEFINED + typedef char _TCHAR; + typedef signed char _TSCHAR; + typedef unsigned char _TUCHAR; + typedef char _TXCHAR; + typedef int _TINT; +#endif + +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED +#ifndef NO_OLDNAMES + typedef char TCHAR; +#endif +#endif + +#define _tcschr strchr +#define _tcscspn strcspn +#define _tcsncat strncat +#define _tcsncat_l _strncat_l +#define _tcsncpy strncpy +#define _tcsncpy_l _strncpy_l +#define _tcspbrk strpbrk +#define _tcsrchr strrchr +#define _tcsspn strspn +#define _tcsstr strstr +#define _tcstok strtok +#define _tcstok_l _strtok_l + +#define _tcsnset _strnset +#define _tcsnset_l _strnset_l +#define _tcsrev _strrev +#define _tcsset _strset + +#define _tcscmp strcmp +#define _tcsicmp _stricmp +#define _tcsicmp_l _stricmp_l +#define _tcsnccmp strncmp +#define _tcsncmp strncmp +#define _tcsncicmp _strnicmp +#define _tcsncicmp_l _strnicmp_l +#define _tcsnicmp _strnicmp +#define _tcsnicmp_l _strnicmp_l + +#define _tcscoll strcoll +#define _tcscoll_l _strcoll_l +#define _tcsicoll _stricoll +#define _tcsicoll_l _stricoll_l +#define _tcsnccoll _strncoll +#define _tcsnccoll_l _strncoll_l +#define _tcsncoll _strncoll +#define _tcsncoll_l _strncoll_l +#define _tcsncicoll _strnicoll +#define _tcsncicoll_l _strnicoll_l +#define _tcsnicoll _strnicoll +#define _tcsnicoll_l _strnicoll_l + +#define _tcsclen strlen +#define _tcscnlen strnlen +#define _tcsclen_l(_String,_Locale) strlen(_String) +#define _tcscnlen_l(_String,_Max_count,_Locale) strnlen_l((_String),(_Max_count)) +#define _tcsnccat strncat +#define _tcsnccat_l _strncat_l +#define _tcsnccpy strncpy +#define _tcsnccpy_l _strncpy_l +#define _tcsncset _strnset + +#define _tcsdec _strdec +#define _tcsinc _strinc +#define _tcsnbcnt _strncnt +#define _tcsnccnt _strncnt +#define _tcsnextc _strnextc +#define _tcsninc _strninc +#define _tcsspnp _strspnp + +#define _tcslwr _strlwr +#define _tcslwr_l _strlwr_l +#define _tcsupr _strupr +#define _tcsupr_l _strupr_l +#define _tcsxfrm strxfrm +#define _tcsxfrm_l _strxfrm_l + +#define _istlead(_Char) (0) +#define _istleadbyte(_Char) (0) +#define _istleadbyte_l(_Char,_Locale) (0) + +#define _tclen(_pc) (1) +#define _tccpy(_pc1,_cpc2) (*(_pc1) = *(_cpc2)) +#define _tccmp(_cpc1,_cpc2) (((unsigned char)*(_cpc1))-((unsigned char)*(_cpc2))) + + /* dirent structures and functions */ +#define _tdirent dirent +#define _TDIR DIR +#define _topendir opendir +#define _tclosedir closedir +#define _treaddir readdir +#define _trewinddir rewinddir +#define _ttelldir telldir +#define _tseekdir seekdir + +#define _istalnum isalnum +#define _istalnum_l _isalnum_l +#define _istalpha isalpha +#define _istalpha_l _isalpha_l +#define _istdigit isdigit +#define _istdigit_l _isdigit_l +#define _istgraph isgraph +#define _istgraph_l _isgraph_l +#define _istlower islower +#define _istlower_l _islower_l +#define _istprint isprint +#define _istprint_l _isprint_l +#define _istpunct ispunct +#define _istpunct_l _ispunct_l +#define _istspace isspace +#define _istspace_l _isspace_l +#define _istupper isupper +#define _istupper_l _isupper_l + +#define _totupper toupper +#define _totupper_l _toupper_l +#define _totlower tolower +#define _totlower_l _tolower_l + +#define _istlegal(_c) (1) + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define _strdec(_cpc1,_cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1) +#define _strinc(_pc) ((_pc)+1) +#define _strnextc(_cpc) ((unsigned int) *(const unsigned char *)(_cpc)) +#define _strninc(_pc,_sz) (((_pc)+(_sz))) + _CRTIMP size_t __cdecl __strncnt(const char *_Str,size_t _Cnt); +#define _strncnt(_cpc,_sz) (__strncnt(_cpc,_sz)) +#define _strspnp(_cpc1,_cpc2) (!_cpc1 ? NULL : ((*((_cpc1)+strspn(_cpc1,_cpc2))) ? ((_cpc1)+strspn(_cpc1,_cpc2)) : NULL)) + +#define _strncpy_l(_Destination,_Source,_Count,_Locale) (strncpy(_Destination,_Source,_Count)) +#define _strncat_l(_Destination,_Source,_Count,_Locale) (strncat(_Destination,_Source,_Count)) +#define _strtok_l(_String,_Delimiters,_Locale) (strtok(_String,_Delimiters)) +#define _strnset_l(_Destination,_Value,_Count,_Locale) (_strnset(_Destination,_Value,_Count)) +#define _strset_l(_Destination,_Value,_Locale) (_strset(_Destination,_Value)) +#endif +#endif + +#define _T(x) __T(x) +#define _TEXT(x) __T(x) + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/time.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/time.h new file mode 100644 index 00000000..6c72e266 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/time.h @@ -0,0 +1,287 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _TIME_H_ +#define _TIME_H_ + +#include <_mingw.h> + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#ifndef _WCHAR_T_DEFINED +#define _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#endif + +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED + typedef long __time32_t; +#endif + +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int _time64_t __attribute__ ((mode (DI))); +#else + typedef __int64 __time64_t; +#endif +#endif +#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#endif + +#ifndef _CLOCK_T_DEFINED +#define _CLOCK_T_DEFINED + typedef long clock_t; +#endif + +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +#undef size_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int size_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 size_t; +#endif +#else + typedef unsigned int size_t; +#endif +#endif + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef int ssize_t; +#endif +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#ifdef _USE_32BIT_TIME_T +#define _localtime32 localtime +#define _difftime32 difftime +#define _ctime32 ctime +#define _gmtime32 gmtime +#define _mktime32 mktime +#define _time32 time +#endif + +#ifndef _TM_DEFINED +#define _TM_DEFINED + struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + }; +#endif + +#define CLOCKS_PER_SEC 1000 + + __MINGW_IMPORT int _daylight; + __MINGW_IMPORT long _dstbias; + __MINGW_IMPORT long _timezone; + __MINGW_IMPORT char * _tzname[2]; + _CRTIMP errno_t __cdecl _get_daylight(int *_Daylight); + _CRTIMP errno_t __cdecl _get_dstbias(long *_Daylight_savings_bias); + _CRTIMP errno_t __cdecl _get_timezone(long *_Timezone); + _CRTIMP errno_t __cdecl _get_tzname(size_t *_ReturnValue,char *_Buffer,size_t _SizeInBytes,int _Index); + char *__cdecl asctime(const struct tm *_Tm); + _CRTIMP char *__cdecl _ctime32(const __time32_t *_Time); + clock_t __cdecl clock(void); + _CRTIMP double __cdecl _difftime32(__time32_t _Time1,__time32_t _Time2); + _CRTIMP struct tm *__cdecl _gmtime32(const __time32_t *_Time); + _CRTIMP struct tm *__cdecl _localtime32(const __time32_t *_Time); + size_t __cdecl strftime(char *_Buf,size_t _SizeInBytes,const char *_Format,const struct tm *_Tm); + _CRTIMP size_t __cdecl _strftime_l(char *_Buf,size_t _Max_size,const char *_Format,const struct tm *_Tm,_locale_t _Locale); + _CRTIMP char *__cdecl _strdate(char *_Buffer); + _CRTIMP char *__cdecl _strtime(char *_Buffer); + _CRTIMP __time32_t __cdecl _time32(__time32_t *_Time); + _CRTIMP __time32_t __cdecl _mktime32(struct tm *_Tm); + _CRTIMP __time32_t __cdecl _mkgmtime32(struct tm *_Tm); +#if defined (_POSIX_) || defined(__GNUC__) + void __cdecl tzset(void); +#else + _CRTIMP void __cdecl _tzset(void); +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2); + _CRTIMP char *__cdecl _ctime64(const __time64_t *_Time); + _CRTIMP struct tm *__cdecl _gmtime64(const __time64_t *_Time); + _CRTIMP struct tm *__cdecl _localtime64(const __time64_t *_Time); + _CRTIMP __time64_t __cdecl _mktime64(struct tm *_Tm); + _CRTIMP __time64_t __cdecl _mkgmtime64(struct tm *_Tm); + _CRTIMP __time64_t __cdecl _time64(__time64_t *_Time); +#endif + unsigned __cdecl _getsystime(struct tm *_Tm); + unsigned __cdecl _setsystime(struct tm *_Tm,unsigned _MilliSec); + +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int size_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 size_t; +#endif +#else + typedef unsigned long size_t; +#endif +#endif + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef long ssize_t; +#endif +#endif + +#ifndef _WTIME_DEFINED + _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm); + _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time); + size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm); + _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer); + _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL) +#define _INC_WTIME_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); } +#else +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); } +#endif +#endif + +#define _WTIME_DEFINED +#endif + +#ifndef RC_INVOKED +double __cdecl difftime(time_t _Time1,time_t _Time2); +char *__cdecl ctime(const time_t *_Time); +struct tm *__cdecl gmtime(const time_t *_Time); +struct tm *__cdecl localtime(const time_t *_Time); +struct tm *__cdecl localtime_r(const time_t *_Time,struct tm *); + +time_t __cdecl mktime(struct tm *_Tm); +time_t __cdecl _mkgmtime(struct tm *_Tm); +time_t __cdecl time(time_t *_Time); + +#ifdef _USE_32BIT_TIME_T +#if 0 +__CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); } +__CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime32(_Time); } +__CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime32(_Time); } +__CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime32(_Time); } +__CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime32(_Tm); } +__CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime32(_Tm); } +__CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time32(_Time); } +#endif +#else +__CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); } +__CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime64(_Time); } +__CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime64(_Time); } +__CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime64(_Time); } +__CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime64(_Tm); } +__CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); } +__CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); } +#endif +#endif + +#if !defined(NO_OLDNAMES) || defined(_POSIX) +#define CLK_TCK CLOCKS_PER_SEC + + __MINGW_IMPORT int daylight; + __MINGW_IMPORT long dstbias; + __MINGW_IMPORT long timezone; + __MINGW_IMPORT char *tzname[2]; + void __cdecl tzset(void); +#endif + +#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ +#define _TIMEVAL_DEFINED +struct timeval { + long tv_sec; + long tv_usec; +}; +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp,uvp,cmp) ((tvp)->tv_sec cmp (uvp)->tv_sec || (tvp)->tv_sec==(uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif /* _TIMEVAL_DEFINED */ + +#ifndef __STRICT_ANSI__ +#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ +#define _TIMEZONE_DEFINED +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + + extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); +#endif +#endif /* __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include + +/* Adding timespec definition. */ +#include + +#endif /* End _TIME_H_ */ + diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/vadefs.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/vadefs.h new file mode 100644 index 00000000..749b0bdd --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/vadefs.h @@ -0,0 +1,11 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_VADEFS +#define _INC_VADEFS + +//!__TINYC__: GNUC specific stuff removed + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/values.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/values.h new file mode 100644 index 00000000..1cd643ce --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/values.h @@ -0,0 +1,4 @@ +/* + * TODO: Nothing here yet. Should provide UNIX compatibility constants + * comparable to those in limits.h and float.h. + */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/varargs.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/varargs.h new file mode 100644 index 00000000..d614366e --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/varargs.h @@ -0,0 +1,12 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _VARARGS_H +#define _VARARGS_H + +#error "TinyCC no longer implements ." +#error "Revise your code to use ." + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/wchar.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/wchar.h new file mode 100644 index 00000000..389196fa --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/wchar.h @@ -0,0 +1,873 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_WCHAR +#define _INC_WCHAR + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WCHAR_MIN /* also at stdint.h */ +#define WCHAR_MIN 0 +#define WCHAR_MAX ((wchar_t) -1) /* UINT16_MAX */ +#endif + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + typedef __builtin_va_list __gnuc_va_list; +#endif + +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED + typedef __gnuc_va_list va_list; +#endif + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifndef _FILE_DEFINED + struct _iobuf { + char *_ptr; + int _cnt; + char *_base; + int _flag; + int _file; + int _charbuf; + int _bufsiz; + char *_tmpfname; + }; + typedef struct _iobuf FILE; +#define _FILE_DEFINED +#endif + +#ifndef _STDIO_DEFINED +#ifdef _WIN64 + _CRTIMP FILE *__cdecl __iob_func(void); +#else +#ifdef _MSVCRT_ +extern FILE _iob[]; /* A pointer to an array of FILE */ +#define __iob_func() (_iob) +#else +extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */ +#define __iob_func() (*_imp___iob) +#define _iob __iob_func() +#endif +#endif + +#define _iob __iob_func() +#endif + +#ifndef _STDSTREAM_DEFINED +#define stdin (&__iob_func()[0]) +#define stdout (&__iob_func()[1]) +#define stderr (&__iob_func()[2]) +#define _STDSTREAM_DEFINED +#endif + +#ifndef _FSIZE_T_DEFINED + typedef unsigned long _fsize_t; +#define _FSIZE_T_DEFINED +#endif + +#ifndef _WFINDDATA_T_DEFINED + struct _wfinddata32_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + _fsize_t size; + wchar_t name[260]; + }; + +/* #if _INTEGRAL_MAX_BITS >= 64 */ + + struct _wfinddata32i64_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + __int64 size; + wchar_t name[260]; + }; + + struct _wfinddata64i32_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + _fsize_t size; + wchar_t name[260]; + }; + + struct _wfinddata64_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + __int64 size; + wchar_t name[260]; + }; +/* #endif */ + +#ifdef _USE_32BIT_TIME_T +#define _wfinddata_t _wfinddata32_t +#define _wfinddatai64_t _wfinddata32i64_t + +#define _wfindfirst _wfindfirst32 +#define _wfindnext _wfindnext32 +#define _wfindfirsti64 _wfindfirst32i64 +#define _wfindnexti64 _wfindnext32i64 +#else +#define _wfinddata_t _wfinddata64i32_t +#define _wfinddatai64_t _wfinddata64_t + +#define _wfindfirst _wfindfirst64i32 +#define _wfindnext _wfindnext64i32 +#define _wfindfirsti64 _wfindfirst64 +#define _wfindnexti64 _wfindnext64 +#endif + +#define _WFINDDATA_T_DEFINED +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#ifndef _CONST_RETURN +#define _CONST_RETURN +#endif + +#define _WConst_return _CONST_RETURN + +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() +#ifdef _MSVCRT_ +#define __pctype_func() (_pctype) +#else +#define __pctype_func() (*_imp___pctype) +#endif +#endif + +#ifndef _pctype +#ifdef _MSVCRT_ + extern unsigned short *_pctype; +#else + extern unsigned short **_imp___pctype; +#define _pctype (*_imp___pctype) +#endif +#endif +#endif +#endif + +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#ifndef _wctype +#ifdef _MSVCRT_ + extern unsigned short *_wctype; +#else + extern unsigned short **_imp___wctype; +#define _wctype (*_imp___wctype) +#endif +#endif + +#ifdef _MSVCRT_ +#define __pwctype_func() (_pwctype) +#else +#define __pwctype_func() (*_imp___pwctype) +#endif + +#ifndef _pwctype +#ifdef _MSVCRT_ + extern unsigned short *_pwctype; +#else + extern unsigned short **_imp___pwctype; +#define _pwctype (*_imp___pwctype) +#endif +#endif + +#endif +#endif + +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 + +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 + +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) + +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED + + int __cdecl iswalpha(wint_t _C); + _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); + int __cdecl iswupper(wint_t _C); + _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); + int __cdecl iswlower(wint_t _C); + _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswdigit(wint_t _C); + _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswxdigit(wint_t _C); + _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswspace(wint_t _C); + _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); + int __cdecl iswpunct(wint_t _C); + _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); + int __cdecl iswalnum(wint_t _C); + _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); + int __cdecl iswprint(wint_t _C); + _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); + int __cdecl iswgraph(wint_t _C); + _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); + int __cdecl iswcntrl(wint_t _C); + _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); + int __cdecl iswascii(wint_t _C); + int __cdecl isleadbyte(int _C); + _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); + wint_t __cdecl towupper(wint_t _C); + _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); + wint_t __cdecl towlower(wint_t _C); + _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswctype(wint_t _C,wctype_t _Type); + _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsymf(wint_t _C); + _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsym(wint_t _C); + _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); + int __cdecl is_wctype(wint_t _C,wctype_t _Type); +#endif + +#ifndef _WDIRECT_DEFINED +#define _WDIRECT_DEFINED + + _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); +#endif + +#ifndef _WIO_DEFINED +#define _WIO_DEFINED + + _CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode); + _CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode); + _CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode); + _CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wunlink(const wchar_t *_Filename); + _CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename); + _CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData); + intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData); + _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData); + _CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData); + int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData); + _CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData); +#endif + _CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag); +#if !defined(__cplusplus) || !(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,...); + _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...); +#else + extern "C++" _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,int _PermissionMode = 0); + extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0); +#endif +#endif + +#ifndef _WLOCALE_DEFINED +#define _WLOCALE_DEFINED + _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); +#endif + +#ifndef _WPROCESS_DEFINED +#define _WPROCESS_DEFINED + + _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif +#endif + +#ifndef _WCTYPE_INLINE_DEFINED +#undef _CRT_WCTYPE_NOINLINE +#if !defined(__cplusplus) || defined(_CRT_WCTYPE_NOINLINE) +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) + +#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) +#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) +#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) +#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) +#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) +#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) +#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) +#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) +#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) +#ifndef _CTYPE_DISABLE_MACROS +#define isleadbyte(_c) (__PCTYPE_FUNC[(unsigned char)(_c)] & _LEADBYTE) +#endif +#endif +#define _WCTYPE_INLINE_DEFINED +#endif + +#if !defined(_POSIX_) || defined(__GNUC__) +#ifndef _INO_T_DEFINED +#define _INO_T_DEFINED + typedef unsigned short _ino_t; +#ifndef NO_OLDNAMES + typedef unsigned short ino_t; +#endif +#endif + +#ifndef _DEV_T_DEFINED +#define _DEV_T_DEFINED + typedef unsigned int _dev_t; +#ifndef NO_OLDNAMES + typedef unsigned int dev_t; +#endif +#endif + +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif + +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif + +#ifndef _STAT_DEFINED +#define _STAT_DEFINED + +#ifdef _USE_32BIT_TIME_T +#ifdef WIN64 +#define _fstat _fstat32 +#define _stat _stat32 +#define _wstat _wstat32 +#else +#define _fstat32 _fstat +#define _stat32 _stat +#define _wstat32 _wstat +#endif +#define _fstati64 _fstat32i64 +#define _stati64 _stat32i64 +#define _wstati64 _wstat32i64 +#else +#define _fstat _fstat64i32 +#define _fstati64 _fstat64 +#define _stat _stat64i32 +#define _stati64 _stat64 +#define _wstat _wstat64i32 +#define _wstati64 _wstat64 +#endif + + struct _stat32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + +#ifndef NO_OLDNAMES + struct stat { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; + }; +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + + struct _stat32i64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + + struct _stat64i32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; + + struct _stat64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; +#endif + +#define __stat64 _stat64 + +#endif + +#ifndef _WSTAT_DEFINED +#define _WSTAT_DEFINED + + _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); + int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); + _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); +#endif +#endif +#endif + +#ifndef _WCONIO_DEFINED +#define _WCONIO_DEFINED + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + + _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _getwch(void); + _CRTIMP wint_t __cdecl _getwche(void); + _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh); + _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh); + _CRTIMP int __cdecl _cputws(const wchar_t *_String); + _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList); + + _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + wint_t __cdecl _putwch_nolock(wchar_t _WCh); + wint_t __cdecl _getwch_nolock(void); + wint_t __cdecl _getwche_nolock(void); + wint_t __cdecl _ungetwch_nolock(wint_t _WCh); +#endif + +#ifndef _WSTDIO_DEFINED +#define _WSTDIO_DEFINED + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifdef _POSIX_ + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); +#else + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); +#endif + + wint_t __cdecl fgetwc(FILE *_File); + _CRTIMP wint_t __cdecl _fgetwchar(void); + wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); + wint_t __cdecl getwc(FILE *_File); + wint_t __cdecl getwchar(void); + wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); + wint_t __cdecl putwchar(wchar_t _Ch); + wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); + wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File); + int __cdecl fputws(const wchar_t *_Str,FILE *_File); + _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String); + _CRTIMP int __cdecl _putws(const wchar_t *_Str); + int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...); + int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList); + int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...); + _CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list); + _CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ + int __cdecl snwprintf (wchar_t *s, size_t n, const wchar_t * format, ...); + __CRT_INLINE int __cdecl vsnwprintf (wchar_t *s, size_t n, const wchar_t *format, va_list arg) { return _vsnwprintf(s,n,format,arg); } + int __cdecl vwscanf (const wchar_t *, va_list); + int __cdecl vfwscanf (FILE *,const wchar_t *,va_list); + int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list); +#endif + _CRTIMP int __cdecl _fwprintf_p(FILE *_File,const wchar_t *_Format,...); + _CRTIMP int __cdecl _wprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vfwprintf_p(FILE *_File,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vscwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _fwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vfwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vswprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vscwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf(wchar_t *_Dest,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args); + _CRTIMP int __cdecl __swprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,...); + _CRTIMP int __cdecl __vswprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,va_list _Args); +#ifndef RC_INVOKED +#include +#endif + +#ifdef _CRT_NON_CONFORMING_SWPRINTFS +#ifndef __cplusplus +#define swprintf _swprintf +#define vswprintf _vswprintf +#define _swprintf_l __swprintf_l +#define _vswprintf_l __vswprintf_l +#endif +#endif + + _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); + _CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vscwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...); + _CRTIMP int __cdecl _fwscanf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...); + _CRTIMP int __cdecl _swscanf_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + int __cdecl wscanf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _wscanf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfopen(const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); + +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); +#if !defined(NO_OLDNAMES) && !defined(wpopen) +#define wpopen _wpopen +#endif + _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); + _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); + _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); + +#undef _CRT_GETPUTWCHAR_NOINLINE + +#if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) +#define getwchar() fgetwc(stdin) +#define putwchar(_c) fputwc((_c),stdout) +#else + __CRT_INLINE wint_t __cdecl getwchar() {return (fgetwc(stdin)); } + __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) {return (fputwc(_C,stdout)); } +#endif + +#define getwc(_stm) fgetwc(_stm) +#define putwc(_c,_stm) fputwc(_c,_stm) +#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) +#define _getwc_nolock(_c) _fgetwc_nolock(_c) +#endif + +#ifndef _WSTDLIB_DEFINED +#define _WSTDLIB_DEFINED + + _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix); + double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr); + _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale); + float __cdecl wcstof( const wchar_t *nptr, wchar_t **endptr); +#if !defined __NO_ISOCEXT /* in libmingwex.a */ + float __cdecl wcstof (const wchar_t * __restrict__, wchar_t ** __restrict__); + long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); +#endif /* __NO_ISOCEXT */ + long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif + _CRTIMP double __cdecl _wtof(const wchar_t *_Str); + _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _wtoi(const wchar_t *_Str); + _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP long __cdecl _wtol(const wchar_t *_Str); + _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale); + +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str); + _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); +#endif +#endif + +#ifndef _POSIX_ +#ifndef _WSTDLIBP_DEFINED +#define _WSTDLIBP_DEFINED + _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords); + _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString); + _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath); + _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext); +#endif +#endif + +#ifndef _WSTRING_DEFINED +#define _WSTRING_DEFINED + _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); + wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); + _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); + int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); + wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); + size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); + size_t __cdecl wcslen(const wchar_t *_Str); + size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); + wchar_t *__cdecl wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *__cdecl wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); + size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr); + wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim); + _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum); + _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str); + _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str); + _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val); + _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String); + _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String); + _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale); + size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount); + _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale); + int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + +#ifndef NO_OLDNAMES + wchar_t *__cdecl wcsdup(const wchar_t *_Str); +#define wcswcs wcsstr + int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + wchar_t *__cdecl wcsrev(wchar_t *_Str); + wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val); + wchar_t *__cdecl wcslwr(wchar_t *_Str); + wchar_t *__cdecl wcsupr(wchar_t *_Str); + int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); +#endif +#endif + +#ifndef _TM_DEFINED +#define _TM_DEFINED + struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + }; +#endif + +#ifndef _WTIME_DEFINED +#define _WTIME_DEFINED + + _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm); + _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time); + size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm); + _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer); + _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL) +#define _INC_WTIME_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); } +#else +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); } +#endif +#endif +#endif + + typedef int mbstate_t; + typedef wchar_t _Wint_t; + + wint_t __cdecl btowc(int); + size_t __cdecl mbrlen(const char *_Ch,size_t _SizeInBytes,mbstate_t *_State); + size_t __cdecl mbrtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SizeInBytes,mbstate_t *_State); + size_t __cdecl mbsrtowcs(wchar_t *_Dest,const char **_PSrc,size_t _Count,mbstate_t *_State); + size_t __cdecl wcrtomb(char *_Dest,wchar_t _Source,mbstate_t *_State); + size_t __cdecl wcsrtombs(char *_Dest,const wchar_t **_PSource,size_t _Count,mbstate_t *_State); + int __cdecl wctob(wint_t _WCh); + +#ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */ + wchar_t *__cdecl wmemset(wchar_t *s, wchar_t c, size_t n); + _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *s, wchar_t c, size_t n); + int wmemcmp(const wchar_t *s1, const wchar_t *s2,size_t n); + wchar_t *__cdecl wmemcpy(wchar_t *s1,const wchar_t *s2,size_t n); + wchar_t *__cdecl wmemmove(wchar_t *s1, const wchar_t *s2, size_t n); + long long __cdecl wcstoll(const wchar_t *nptr,wchar_t **endptr, int base); + unsigned long long __cdecl wcstoull(const wchar_t *nptr,wchar_t **endptr, int base); +#endif /* __NO_ISOCEXT */ + + void *__cdecl memmove(void *_Dst,const void *_Src,size_t _MaxCount); + void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _MaxCount); + __CRT_INLINE int __cdecl fwide(FILE *_F,int _M) { (void)_F; return (_M); } + __CRT_INLINE int __cdecl mbsinit(const mbstate_t *_P) { return (!_P || *_P==0); } + __CRT_INLINE _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *_S,wchar_t _C,size_t _N) { for (;0<_N;++_S,--_N) if (*_S==_C) return (_CONST_RETURN wchar_t *)(_S); return (0); } + __CRT_INLINE int __cdecl wmemcmp(const wchar_t *_S1,const wchar_t *_S2,size_t _N) { for (; 0 < _N; ++_S1,++_S2,--_N) if (*_S1!=*_S2) return (*_S1 < *_S2 ? -1 : +1); return (0); } + __CRT_INLINE wchar_t *__cdecl wmemcpy(wchar_t *_S1,const wchar_t *_S2,size_t _N) { return (wchar_t *)memcpy(_S1,_S2,_N*sizeof(wchar_t)); } + __CRT_INLINE wchar_t *__cdecl wmemmove(wchar_t *_S1,const wchar_t *_S2,size_t _N) { return (wchar_t *)memmove(_S1,_S2,_N*sizeof(wchar_t)); } + __CRT_INLINE wchar_t *__cdecl wmemset(wchar_t *_S,wchar_t _C,size_t _N) { + wchar_t *_Su = _S; + for (;0<_N;++_Su,--_N) { + *_Su = _C; + } + return (_S); + } +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/wctype.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/wctype.h new file mode 100644 index 00000000..a44cb384 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/wctype.h @@ -0,0 +1,172 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_WCTYPE +#define _INC_WCTYPE + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + +#ifndef _WCTYPE_T_DEFINED + typedef unsigned short wint_t; + typedef unsigned short wctype_t; +#define _WCTYPE_T_DEFINED +#endif + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() +#ifdef _MSVCRT_ +#define __pctype_func() (_pctype) +#else +#define __pctype_func() (*_imp___pctype) +#endif +#endif + +#ifndef _pctype +#ifdef _MSVCRT_ + extern unsigned short *_pctype; +#else + extern unsigned short **_imp___pctype; +#define _pctype (*_imp___pctype) +#endif +#endif + +#endif +#endif + +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#ifndef _wctype +#ifdef _MSVCRT_ + extern unsigned short *_wctype; +#else + extern unsigned short **_imp___wctype; +#define _wctype (*_imp___wctype) +#endif +#endif + +#ifndef _pwctype +#ifdef _MSVCRT_ + extern unsigned short *_pwctype; +#else + extern unsigned short **_imp___pwctype; +#define _pwctype (*_imp___pwctype) +#define __pwctype_func() (*_imp___pwctype) +#endif +#endif +#endif +#endif + +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 + +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 + +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) + +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED + + int __cdecl iswalpha(wint_t); + int __cdecl iswupper(wint_t); + int __cdecl iswlower(wint_t); + int __cdecl iswdigit(wint_t); + int __cdecl iswxdigit(wint_t); + int __cdecl iswspace(wint_t); + int __cdecl iswpunct(wint_t); + int __cdecl iswalnum(wint_t); + int __cdecl iswprint(wint_t); + int __cdecl iswgraph(wint_t); + int __cdecl iswcntrl(wint_t); + int __cdecl iswascii(wint_t); + int __cdecl isleadbyte(int); + wint_t __cdecl towupper(wint_t); + wint_t __cdecl towlower(wint_t); + int __cdecl iswctype(wint_t,wctype_t); + _CRTIMP int __cdecl __iswcsymf(wint_t); + _CRTIMP int __cdecl __iswcsym(wint_t); + int __cdecl is_wctype(wint_t,wctype_t); +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) +int __cdecl isblank(int _C); +#endif +#endif + +#ifndef _WCTYPE_INLINE_DEFINED +#define _WCTYPE_INLINE_DEFINED +#ifndef __cplusplus +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) +#define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE) +#else + __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); } + __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); } + __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); } + __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); } + __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); } + __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); } + __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); } + __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); } + __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); } + __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); } + __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); } + __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); } + __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); } +#endif +#endif + + typedef wchar_t wctrans_t; + wint_t __cdecl towctrans(wint_t,wctrans_t); + wctrans_t __cdecl wctrans(const char *); + wctype_t __cdecl wctype(const char *); + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/basetsd.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/basetsd.h new file mode 100644 index 00000000..47d78c4c --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/basetsd.h @@ -0,0 +1,149 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _BASETSD_H_ +#define _BASETSD_H_ + +#if (defined(__x86_64) || defined(__ia64__)) && !defined(RC_INVOKED) +typedef unsigned __int64 POINTER_64_INT; +#else +typedef unsigned long POINTER_64_INT; +#endif + +#define POINTER_32 +#define POINTER_64 +#define FIRMWARE_PTR + +#ifdef __cplusplus +extern "C" { +#endif + + typedef signed char INT8,*PINT8; + typedef signed short INT16,*PINT16; + typedef signed int INT32,*PINT32; + typedef signed __int64 INT64,*PINT64; + typedef unsigned char UINT8,*PUINT8; + typedef unsigned short UINT16,*PUINT16; + typedef unsigned int UINT32,*PUINT32; + typedef unsigned __int64 UINT64,*PUINT64; + typedef signed int LONG32,*PLONG32; + typedef unsigned int ULONG32,*PULONG32; + typedef unsigned int DWORD32,*PDWORD32; + +#ifndef _W64 +#define _W64 +#endif + +#ifdef _WIN64 + typedef __int64 INT_PTR,*PINT_PTR; + typedef unsigned __int64 UINT_PTR,*PUINT_PTR; + typedef __int64 LONG_PTR,*PLONG_PTR; + typedef unsigned __int64 ULONG_PTR,*PULONG_PTR; +#define __int3264 __int64 +#else + typedef int INT_PTR,*PINT_PTR; + typedef unsigned int UINT_PTR,*PUINT_PTR; + typedef long LONG_PTR,*PLONG_PTR; + typedef unsigned long ULONG_PTR,*PULONG_PTR; +#define __int3264 __int32 +#endif + +#ifdef _WIN64 +#define ADDRESS_TAG_BIT 0x40000000000ULL + typedef __int64 SHANDLE_PTR; + typedef unsigned __int64 HANDLE_PTR; + typedef unsigned int UHALF_PTR,*PUHALF_PTR; + typedef int HALF_PTR,*PHALF_PTR; + + static __inline unsigned long HandleToULong(const void *h) { return((unsigned long) (ULONG_PTR) h); } + static __inline long HandleToLong(const void *h) { return((long) (LONG_PTR) h); } + static __inline void *ULongToHandle(const unsigned long h) { return((void *) (UINT_PTR) h); } + static __inline void *LongToHandle(const long h) { return((void *) (INT_PTR) h); } + static __inline unsigned long PtrToUlong(const void *p) { return((unsigned long) (ULONG_PTR) p); } + static __inline unsigned int PtrToUint(const void *p) { return((unsigned int) (UINT_PTR) p); } + static __inline unsigned short PtrToUshort(const void *p) { return((unsigned short) (unsigned long) (ULONG_PTR) p); } + static __inline long PtrToLong(const void *p) { return((long) (LONG_PTR) p); } + static __inline int PtrToInt(const void *p) { return((int) (INT_PTR) p); } + static __inline short PtrToShort(const void *p) { return((short) (long) (LONG_PTR) p); } + static __inline void *IntToPtr(const int i) { return((void *)(INT_PTR)i); } + static __inline void *UIntToPtr(const unsigned int ui) { return((void *)(UINT_PTR)ui); } + static __inline void *LongToPtr(const long l) { return((void *)(LONG_PTR)l); } + static __inline void *ULongToPtr(const unsigned long ul) { return((void *)(ULONG_PTR)ul); } + +#define PtrToPtr64(p) ((void *) p) +#define Ptr64ToPtr(p) ((void *) p) +#define HandleToHandle64(h) (PtrToPtr64(h)) +#define Handle64ToHandle(h) (Ptr64ToPtr(h)) + + static __inline void *Ptr32ToPtr(const void *p) { return (void *)p; } + static __inline void *Handle32ToHandle(const void *h) { return((void *) h); } + static __inline void *PtrToPtr32(const void *p) { return((void *) (ULONG_PTR) p); } + +#define HandleToHandle32(h) (PtrToPtr32(h)) +#else + +#define ADDRESS_TAG_BIT 0x80000000UL + + typedef unsigned short UHALF_PTR,*PUHALF_PTR; + typedef short HALF_PTR,*PHALF_PTR; + typedef long SHANDLE_PTR; + typedef unsigned long HANDLE_PTR; + +#define HandleToULong(h) ((ULONG)(ULONG_PTR)(h)) +#define HandleToLong(h) ((LONG)(LONG_PTR) (h)) +#define ULongToHandle(ul) ((HANDLE)(ULONG_PTR) (ul)) +#define LongToHandle(h) ((HANDLE)(LONG_PTR) (h)) +#define PtrToUlong(p) ((ULONG)(ULONG_PTR) (p)) +#define PtrToLong(p) ((LONG)(LONG_PTR) (p)) +#define PtrToUint(p) ((UINT)(UINT_PTR) (p)) +#define PtrToInt(p) ((INT)(INT_PTR) (p)) +#define PtrToUshort(p) ((unsigned short)(ULONG_PTR)(p)) +#define PtrToShort(p) ((short)(LONG_PTR)(p)) +#define IntToPtr(i) ((VOID *)(INT_PTR)((int)i)) +#define UIntToPtr(ui) ((VOID *)(UINT_PTR)((unsigned int)ui)) +#define LongToPtr(l) ((VOID *)(LONG_PTR)((long)l)) +#define ULongToPtr(ul) ((VOID *)(ULONG_PTR)((unsigned long)ul)) + + static __inline void *PtrToPtr64(const void *p) { return((void *) (ULONG_PTR)p); } + static __inline void *Ptr64ToPtr(const void *p) { return((void *) (ULONG_PTR) p); } + static __inline void *HandleToHandle64(const void *h) { return((void *) h); } + static __inline void *Handle64ToHandle(const void *h) { return((void *) (ULONG_PTR) h); } + +#define Ptr32ToPtr(p) ((void *) p) +#define Handle32ToHandle(h) (Ptr32ToPtr(h)) +#define PtrToPtr32(p) ((void *) p) +#define HandleToHandle32(h) (PtrToPtr32(h)) +#endif + +#define HandleToUlong(h) HandleToULong(h) +#define UlongToHandle(ul) ULongToHandle(ul) +#define UlongToPtr(ul) ULongToPtr(ul) +#define UintToPtr(ui) UIntToPtr(ui) + +#define MAXUINT_PTR (~((UINT_PTR)0)) +#define MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1)) +#define MININT_PTR (~MAXINT_PTR) + +#define MAXULONG_PTR (~((ULONG_PTR)0)) +#define MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1)) +#define MINLONG_PTR (~MAXLONG_PTR) + +#define MAXUHALF_PTR ((UHALF_PTR)~0) +#define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1)) +#define MINHALF_PTR (~MAXHALF_PTR) + + typedef ULONG_PTR SIZE_T,*PSIZE_T; + typedef LONG_PTR SSIZE_T,*PSSIZE_T; + typedef ULONG_PTR DWORD_PTR,*PDWORD_PTR; + typedef __int64 LONG64,*PLONG64; + typedef unsigned __int64 ULONG64,*PULONG64; + typedef unsigned __int64 DWORD64,*PDWORD64; + typedef ULONG_PTR KAFFINITY; + typedef KAFFINITY *PKAFFINITY; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/basetyps.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/basetyps.h new file mode 100644 index 00000000..376665e7 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/basetyps.h @@ -0,0 +1,85 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !defined(_BASETYPS_H_) +#define _BASETYPS_H_ + +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C extern +#endif + +#define STDMETHODCALLTYPE WINAPI +#define STDMETHODVCALLTYPE __cdecl + +#define STDAPICALLTYPE WINAPI +#define STDAPIVCALLTYPE __cdecl + +#define STDAPI EXTERN_C HRESULT WINAPI +#define STDAPI_(type) EXTERN_C type WINAPI + +#define STDMETHODIMP HRESULT WINAPI +#define STDMETHODIMP_(type) type WINAPI + +#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE +#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE + +#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE +#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE + +#if defined(__cplusplus) && !defined(CINTERFACE) + +#define __STRUCT__ struct +#define STDMETHOD(method) virtual HRESULT WINAPI method +#define STDMETHOD_(type,method) virtual type WINAPI method +#define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method +#define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method +#define PURE = 0 +#define THIS_ +#define THIS void +#define DECLARE_INTERFACE(iface) __STRUCT__ iface +#define DECLARE_INTERFACE_(iface,baseiface) __STRUCT__ iface : public baseiface +#else + +#ifndef __OBJC__ +#define interface struct +#endif + +#define STDMETHOD(method) HRESULT (WINAPI *method) +#define STDMETHOD_(type,method) type (WINAPI *method) +#define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method) +#define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method) + +#define PURE +#define THIS_ INTERFACE *This, +#define THIS INTERFACE *This +#ifdef CONST_VTABLE +#define DECLARE_INTERFACE(iface) typedef struct iface { \ + const struct iface##Vtbl *lpVtbl; } iface; \ + typedef const struct iface##Vtbl iface##Vtbl; \ + const struct iface##Vtbl +#else +#define DECLARE_INTERFACE(iface) typedef struct iface { \ + struct iface##Vtbl *lpVtbl; \ + } iface; \ + typedef struct iface##Vtbl iface##Vtbl; \ + struct iface##Vtbl +#endif +#define DECLARE_INTERFACE_(iface,baseiface) DECLARE_INTERFACE(iface) +#endif + +#include + +#ifndef _ERROR_STATUS_T_DEFINED +#define _ERROR_STATUS_T_DEFINED +typedef unsigned long error_status_t; +#endif + +#ifndef _WCHAR_T_DEFINED +typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/guiddef.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/guiddef.h new file mode 100644 index 00000000..4e7909a9 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/guiddef.h @@ -0,0 +1,156 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef GUID_DEFINED +#define GUID_DEFINED +typedef struct _GUID { + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[8 ]; +} GUID; +#endif + +#ifndef UUID_DEFINED +#define UUID_DEFINED +typedef GUID UUID; +#endif + +#ifndef FAR +#define FAR +#endif + +#ifndef DECLSPEC_SELECTANY +#define DECLSPEC_SELECTANY __declspec(selectany) +#endif + +#ifndef EXTERN_C +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C extern +#endif +#endif + +#ifdef DEFINE_GUID +#undef DEFINE_GUID +#endif + +#ifdef INITGUID +#ifdef __cplusplus +#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } +#else +#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } +#endif +#else +#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID name +#endif + +#define DEFINE_OLEGUID(name,l,w1,w2) DEFINE_GUID(name,l,w1,w2,0xC0,0,0,0,0,0,0,0x46) + +#ifndef _GUIDDEF_H_ +#define _GUIDDEF_H_ + +#ifndef __LPGUID_DEFINED__ +#define __LPGUID_DEFINED__ +typedef GUID *LPGUID; +#endif + +#ifndef __LPCGUID_DEFINED__ +#define __LPCGUID_DEFINED__ +typedef const GUID *LPCGUID; +#endif + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef GUID IID; +typedef IID *LPIID; +#define IID_NULL GUID_NULL +#define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) +typedef GUID CLSID; +typedef CLSID *LPCLSID; +#define CLSID_NULL GUID_NULL +#define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) +typedef GUID FMTID; +typedef FMTID *LPFMTID; +#define FMTID_NULL GUID_NULL +#define IsEqualFMTID(rfmtid1,rfmtid2) IsEqualGUID(rfmtid1,rfmtid2) + +#ifdef __midl_proxy +#define __MIDL_CONST +#else +#define __MIDL_CONST const +#endif + +#ifndef _REFGUID_DEFINED +#define _REFGUID_DEFINED +#ifdef __cplusplus +#define REFGUID const GUID & +#else +#define REFGUID const GUID *__MIDL_CONST +#endif +#endif + +#ifndef _REFIID_DEFINED +#define _REFIID_DEFINED +#ifdef __cplusplus +#define REFIID const IID & +#else +#define REFIID const IID *__MIDL_CONST +#endif +#endif + +#ifndef _REFCLSID_DEFINED +#define _REFCLSID_DEFINED +#ifdef __cplusplus +#define REFCLSID const IID & +#else +#define REFCLSID const IID *__MIDL_CONST +#endif +#endif + +#ifndef _REFFMTID_DEFINED +#define _REFFMTID_DEFINED +#ifdef __cplusplus +#define REFFMTID const IID & +#else +#define REFFMTID const IID *__MIDL_CONST +#endif +#endif +#endif + +#ifndef _SYS_GUID_OPERATORS_ +#define _SYS_GUID_OPERATORS_ +#include + +#ifdef __cplusplus +__inline int InlineIsEqualGUID(REFGUID rguid1,REFGUID rguid2) { + return (((unsigned long *) &rguid1)[0]==((unsigned long *) &rguid2)[0] && ((unsigned long *) &rguid1)[1]==((unsigned long *) &rguid2)[1] && + ((unsigned long *) &rguid1)[2]==((unsigned long *) &rguid2)[2] && ((unsigned long *) &rguid1)[3]==((unsigned long *) &rguid2)[3]); +} +__inline int IsEqualGUID(REFGUID rguid1,REFGUID rguid2) { return !memcmp(&rguid1,&rguid2,sizeof(GUID)); } +#else +#define InlineIsEqualGUID(rguid1,rguid2) (((unsigned long *) rguid1)[0]==((unsigned long *) rguid2)[0] && ((unsigned long *) rguid1)[1]==((unsigned long *) rguid2)[1] && ((unsigned long *) rguid1)[2]==((unsigned long *) rguid2)[2] && ((unsigned long *) rguid1)[3]==((unsigned long *) rguid2)[3]) +#define IsEqualGUID(rguid1,rguid2) (!memcmp(rguid1,rguid2,sizeof(GUID))) +#endif + +#ifdef __INLINE_ISEQUAL_GUID +#undef IsEqualGUID +#define IsEqualGUID(rguid1,rguid2) InlineIsEqualGUID(rguid1,rguid2) +#endif + +#define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) +#define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) + +#if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_ +#define _SYS_GUID_OPERATOR_EQ_ +#ifdef __cplusplus +__inline int operator==(REFGUID guidOne,REFGUID guidOther) { return IsEqualGUID(guidOne,guidOther); } +__inline int operator!=(REFGUID guidOne,REFGUID guidOther) { return !(guidOne==guidOther); } +#endif +#endif +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/poppack.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/poppack.h new file mode 100644 index 00000000..b08cba22 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/poppack.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(pop) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack1.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack1.h new file mode 100644 index 00000000..d18d9e85 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack1.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(push,1) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack2.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack2.h new file mode 100644 index 00000000..7de16fd3 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack2.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(push,2) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack4.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack4.h new file mode 100644 index 00000000..1c8e61d7 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack4.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(push,4) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack8.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack8.h new file mode 100644 index 00000000..70a3c7f7 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/pshpack8.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(push,8) +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winbase.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winbase.h new file mode 100644 index 00000000..4a38006e --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winbase.h @@ -0,0 +1,2951 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINBASE_ +#define _WINBASE_ + +#define WINADVAPI DECLSPEC_IMPORT +#define WINBASEAPI DECLSPEC_IMPORT +#define ZAWPROXYAPI DECLSPEC_IMPORT + +#ifdef __cplusplus +extern "C" { +#endif + +#define DefineHandleTable(w) ((w),TRUE) +#define LimitEmsPages(dw) +#define SetSwapAreaSize(w) (w) +#define LockSegment(w) GlobalFix((HANDLE)(w)) +#define UnlockSegment(w) GlobalUnfix((HANDLE)(w)) +#define GetCurrentTime() GetTickCount() + +#define Yield() + +#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1) +#define INVALID_FILE_SIZE ((DWORD)0xffffffff) +#define INVALID_SET_FILE_POINTER ((DWORD)-1) +#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) + +#define FILE_BEGIN 0 +#define FILE_CURRENT 1 +#define FILE_END 2 + +#define TIME_ZONE_ID_INVALID ((DWORD)0xffffffff) + +#define WAIT_FAILED ((DWORD)0xffffffff) +#define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0) +#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) + 0) +#define WAIT_ABANDONED_0 ((STATUS_ABANDONED_WAIT_0) + 0) +#define WAIT_IO_COMPLETION STATUS_USER_APC +#define STILL_ACTIVE STATUS_PENDING +#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION +#define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT +#define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT +#define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP +#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED +#define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND +#define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO +#define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT +#define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION +#define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW +#define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK +#define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW +#define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO +#define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW +#define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION +#define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR +#define EXCEPTION_ILLEGAL_INSTRUCTION STATUS_ILLEGAL_INSTRUCTION +#define EXCEPTION_NONCONTINUABLE_EXCEPTION STATUS_NONCONTINUABLE_EXCEPTION +#define EXCEPTION_STACK_OVERFLOW STATUS_STACK_OVERFLOW +#define EXCEPTION_INVALID_DISPOSITION STATUS_INVALID_DISPOSITION +#define EXCEPTION_GUARD_PAGE STATUS_GUARD_PAGE_VIOLATION +#define EXCEPTION_INVALID_HANDLE STATUS_INVALID_HANDLE +#define EXCEPTION_POSSIBLE_DEADLOCK STATUS_POSSIBLE_DEADLOCK +#define CONTROL_C_EXIT STATUS_CONTROL_C_EXIT +#define MoveMemory RtlMoveMemory +#define CopyMemory RtlCopyMemory +#define FillMemory RtlFillMemory +#define ZeroMemory RtlZeroMemory +#define SecureZeroMemory RtlSecureZeroMemory + +#define FILE_FLAG_WRITE_THROUGH 0x80000000 +#define FILE_FLAG_OVERLAPPED 0x40000000 +#define FILE_FLAG_NO_BUFFERING 0x20000000 +#define FILE_FLAG_RANDOM_ACCESS 0x10000000 +#define FILE_FLAG_SEQUENTIAL_SCAN 0x8000000 +#define FILE_FLAG_DELETE_ON_CLOSE 0x4000000 +#define FILE_FLAG_BACKUP_SEMANTICS 0x2000000 +#define FILE_FLAG_POSIX_SEMANTICS 0x1000000 +#define FILE_FLAG_OPEN_REPARSE_POINT 0x200000 +#define FILE_FLAG_OPEN_NO_RECALL 0x100000 +#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x80000 + +#define CREATE_NEW 1 +#define CREATE_ALWAYS 2 +#define OPEN_EXISTING 3 +#define OPEN_ALWAYS 4 +#define TRUNCATE_EXISTING 5 + +#define PROGRESS_CONTINUE 0 +#define PROGRESS_CANCEL 1 +#define PROGRESS_STOP 2 +#define PROGRESS_QUIET 3 + +#define CALLBACK_CHUNK_FINISHED 0x0 +#define CALLBACK_STREAM_SWITCH 0x1 + +#define COPY_FILE_FAIL_IF_EXISTS 0x1 +#define COPY_FILE_RESTARTABLE 0x2 +#define COPY_FILE_OPEN_SOURCE_FOR_WRITE 0x4 +#define COPY_FILE_ALLOW_DECRYPTED_DESTINATION 0x8 + +#define REPLACEFILE_WRITE_THROUGH 0x1 +#define REPLACEFILE_IGNORE_MERGE_ERRORS 0x2 + +#define PIPE_ACCESS_INBOUND 0x1 +#define PIPE_ACCESS_OUTBOUND 0x2 +#define PIPE_ACCESS_DUPLEX 0x3 + +#define PIPE_CLIENT_END 0x0 +#define PIPE_SERVER_END 0x1 + +#define PIPE_WAIT 0x0 +#define PIPE_NOWAIT 0x1 +#define PIPE_READMODE_BYTE 0x0 +#define PIPE_READMODE_MESSAGE 0x2 +#define PIPE_TYPE_BYTE 0x0 +#define PIPE_TYPE_MESSAGE 0x4 + +#define PIPE_UNLIMITED_INSTANCES 255 + +#define SECURITY_ANONYMOUS (SecurityAnonymous << 16) +#define SECURITY_IDENTIFICATION (SecurityIdentification << 16) +#define SECURITY_IMPERSONATION (SecurityImpersonation << 16) +#define SECURITY_DELEGATION (SecurityDelegation << 16) + +#define SECURITY_CONTEXT_TRACKING 0x40000 +#define SECURITY_EFFECTIVE_ONLY 0x80000 + +#define SECURITY_SQOS_PRESENT 0x100000 +#define SECURITY_VALID_SQOS_FLAGS 0x1f0000 + + typedef struct _OVERLAPPED { + ULONG_PTR Internal; + ULONG_PTR InternalHigh; + union { + struct { + DWORD Offset; + DWORD OffsetHigh; + }; + PVOID Pointer; + }; + HANDLE hEvent; + } OVERLAPPED,*LPOVERLAPPED; + + typedef struct _SECURITY_ATTRIBUTES { + DWORD nLength; + LPVOID lpSecurityDescriptor; + WINBOOL bInheritHandle; + } SECURITY_ATTRIBUTES,*PSECURITY_ATTRIBUTES,*LPSECURITY_ATTRIBUTES; + + typedef struct _PROCESS_INFORMATION { + HANDLE hProcess; + HANDLE hThread; + DWORD dwProcessId; + DWORD dwThreadId; + } PROCESS_INFORMATION,*PPROCESS_INFORMATION,*LPPROCESS_INFORMATION; + +#ifndef _FILETIME_ +#define _FILETIME_ + typedef struct _FILETIME { + DWORD dwLowDateTime; + DWORD dwHighDateTime; + } FILETIME,*PFILETIME,*LPFILETIME; +#endif + + typedef struct _SYSTEMTIME { + WORD wYear; + WORD wMonth; + WORD wDayOfWeek; + WORD wDay; + WORD wHour; + WORD wMinute; + WORD wSecond; + WORD wMilliseconds; + } SYSTEMTIME,*PSYSTEMTIME,*LPSYSTEMTIME; + + typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter); + typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; + typedef VOID (WINAPI *PFIBER_START_ROUTINE)(LPVOID lpFiberParameter); + typedef PFIBER_START_ROUTINE LPFIBER_START_ROUTINE; + + typedef RTL_CRITICAL_SECTION CRITICAL_SECTION; + typedef PRTL_CRITICAL_SECTION PCRITICAL_SECTION; + typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION; + typedef RTL_CRITICAL_SECTION_DEBUG CRITICAL_SECTION_DEBUG; + typedef PRTL_CRITICAL_SECTION_DEBUG PCRITICAL_SECTION_DEBUG; + typedef PRTL_CRITICAL_SECTION_DEBUG LPCRITICAL_SECTION_DEBUG; + + WINBASEAPI PVOID WINAPI EncodePointer(PVOID Ptr); + WINBASEAPI PVOID WINAPI DecodePointer(PVOID Ptr); + WINBASEAPI PVOID WINAPI EncodeSystemPointer(PVOID Ptr); + WINBASEAPI PVOID WINAPI DecodeSystemPointer(PVOID Ptr); + +#ifdef I_X86_ + typedef PLDT_ENTRY LPLDT_ENTRY; +#else + typedef LPVOID LPLDT_ENTRY; +#endif + +#define MUTEX_MODIFY_STATE MUTANT_QUERY_STATE +#define MUTEX_ALL_ACCESS MUTANT_ALL_ACCESS + +#define SP_SERIALCOMM ((DWORD)0x1) + +#define PST_UNSPECIFIED ((DWORD)0x0) +#define PST_RS232 ((DWORD)0x1) +#define PST_PARALLELPORT ((DWORD)0x2) +#define PST_RS422 ((DWORD)0x3) +#define PST_RS423 ((DWORD)0x4) +#define PST_RS449 ((DWORD)0x5) +#define PST_MODEM ((DWORD)0x6) +#define PST_FAX ((DWORD)0x21) +#define PST_SCANNER ((DWORD)0x22) +#define PST_NETWORK_BRIDGE ((DWORD)0x100) +#define PST_LAT ((DWORD)0x101) +#define PST_TCPIP_TELNET ((DWORD)0x102) +#define PST_X25 ((DWORD)0x103) + +#define PCF_DTRDSR ((DWORD)0x1) +#define PCF_RTSCTS ((DWORD)0x2) +#define PCF_RLSD ((DWORD)0x4) +#define PCF_PARITY_CHECK ((DWORD)0x8) +#define PCF_XONXOFF ((DWORD)0x10) +#define PCF_SETXCHAR ((DWORD)0x20) +#define PCF_TOTALTIMEOUTS ((DWORD)0x40) +#define PCF_INTTIMEOUTS ((DWORD)0x80) +#define PCF_SPECIALCHARS ((DWORD)0x100) +#define PCF_16BITMODE ((DWORD)0x200) + +#define SP_PARITY ((DWORD)0x1) +#define SP_BAUD ((DWORD)0x2) +#define SP_DATABITS ((DWORD)0x4) +#define SP_STOPBITS ((DWORD)0x8) +#define SP_HANDSHAKING ((DWORD)0x10) +#define SP_PARITY_CHECK ((DWORD)0x20) +#define SP_RLSD ((DWORD)0x40) + +#define BAUD_075 ((DWORD)0x1) +#define BAUD_110 ((DWORD)0x2) +#define BAUD_134_5 ((DWORD)0x4) +#define BAUD_150 ((DWORD)0x8) +#define BAUD_300 ((DWORD)0x10) +#define BAUD_600 ((DWORD)0x20) +#define BAUD_1200 ((DWORD)0x40) +#define BAUD_1800 ((DWORD)0x80) +#define BAUD_2400 ((DWORD)0x100) +#define BAUD_4800 ((DWORD)0x200) +#define BAUD_7200 ((DWORD)0x400) +#define BAUD_9600 ((DWORD)0x800) +#define BAUD_14400 ((DWORD)0x1000) +#define BAUD_19200 ((DWORD)0x2000) +#define BAUD_38400 ((DWORD)0x4000) +#define BAUD_56K ((DWORD)0x8000) +#define BAUD_128K ((DWORD)0x10000) +#define BAUD_115200 ((DWORD)0x20000) +#define BAUD_57600 ((DWORD)0x40000) +#define BAUD_USER ((DWORD)0x10000000) + +#define DATABITS_5 ((WORD)0x1) +#define DATABITS_6 ((WORD)0x2) +#define DATABITS_7 ((WORD)0x4) +#define DATABITS_8 ((WORD)0x8) +#define DATABITS_16 ((WORD)0x10) +#define DATABITS_16X ((WORD)0x20) + +#define STOPBITS_10 ((WORD)0x1) +#define STOPBITS_15 ((WORD)0x2) +#define STOPBITS_20 ((WORD)0x4) +#define PARITY_NONE ((WORD)0x100) +#define PARITY_ODD ((WORD)0x200) +#define PARITY_EVEN ((WORD)0x400) +#define PARITY_MARK ((WORD)0x800) +#define PARITY_SPACE ((WORD)0x1000) + + typedef struct _COMMPROP { + WORD wPacketLength; + WORD wPacketVersion; + DWORD dwServiceMask; + DWORD dwReserved1; + DWORD dwMaxTxQueue; + DWORD dwMaxRxQueue; + DWORD dwMaxBaud; + DWORD dwProvSubType; + DWORD dwProvCapabilities; + DWORD dwSettableParams; + DWORD dwSettableBaud; + WORD wSettableData; + WORD wSettableStopParity; + DWORD dwCurrentTxQueue; + DWORD dwCurrentRxQueue; + DWORD dwProvSpec1; + DWORD dwProvSpec2; + WCHAR wcProvChar[1]; + } COMMPROP,*LPCOMMPROP; + +#define COMMPROP_INITIALIZED ((DWORD)0xE73CF52E) + + typedef struct _COMSTAT { + DWORD fCtsHold : 1; + DWORD fDsrHold : 1; + DWORD fRlsdHold : 1; + DWORD fXoffHold : 1; + DWORD fXoffSent : 1; + DWORD fEof : 1; + DWORD fTxim : 1; + DWORD fReserved : 25; + DWORD cbInQue; + DWORD cbOutQue; + } COMSTAT,*LPCOMSTAT; + +#define DTR_CONTROL_DISABLE 0x0 +#define DTR_CONTROL_ENABLE 0x1 +#define DTR_CONTROL_HANDSHAKE 0x2 + +#define RTS_CONTROL_DISABLE 0x0 +#define RTS_CONTROL_ENABLE 0x1 +#define RTS_CONTROL_HANDSHAKE 0x2 +#define RTS_CONTROL_TOGGLE 0x3 + + typedef struct _DCB { + DWORD DCBlength; + DWORD BaudRate; + DWORD fBinary: 1; + DWORD fParity: 1; + DWORD fOutxCtsFlow:1; + DWORD fOutxDsrFlow:1; + DWORD fDtrControl:2; + DWORD fDsrSensitivity:1; + DWORD fTXContinueOnXoff: 1; + DWORD fOutX: 1; + DWORD fInX: 1; + DWORD fErrorChar: 1; + DWORD fNull: 1; + DWORD fRtsControl:2; + DWORD fAbortOnError:1; + DWORD fDummy2:17; + WORD wReserved; + WORD XonLim; + WORD XoffLim; + BYTE ByteSize; + BYTE Parity; + BYTE StopBits; + char XonChar; + char XoffChar; + char ErrorChar; + char EofChar; + char EvtChar; + WORD wReserved1; + } DCB,*LPDCB; + + typedef struct _COMMTIMEOUTS { + DWORD ReadIntervalTimeout; + DWORD ReadTotalTimeoutMultiplier; + DWORD ReadTotalTimeoutConstant; + DWORD WriteTotalTimeoutMultiplier; + DWORD WriteTotalTimeoutConstant; + } COMMTIMEOUTS,*LPCOMMTIMEOUTS; + + typedef struct _COMMCONFIG { + DWORD dwSize; + WORD wVersion; + WORD wReserved; + DCB dcb; + DWORD dwProviderSubType; + DWORD dwProviderOffset; + DWORD dwProviderSize; + WCHAR wcProviderData[1]; + } COMMCONFIG,*LPCOMMCONFIG; + + typedef struct _SYSTEM_INFO { + union { + DWORD dwOemId; + struct { + WORD wProcessorArchitecture; + WORD wReserved; + }; + }; + DWORD dwPageSize; + LPVOID lpMinimumApplicationAddress; + LPVOID lpMaximumApplicationAddress; + DWORD_PTR dwActiveProcessorMask; + DWORD dwNumberOfProcessors; + DWORD dwProcessorType; + DWORD dwAllocationGranularity; + WORD wProcessorLevel; + WORD wProcessorRevision; + } SYSTEM_INFO,*LPSYSTEM_INFO; + +#define FreeModule(hLibModule) FreeLibrary((hLibModule)) +#define MakeProcInstance(lpProc,hInstance) (lpProc) +#define FreeProcInstance(lpProc) (lpProc) + +#define GMEM_FIXED 0x0 +#define GMEM_MOVEABLE 0x2 +#define GMEM_NOCOMPACT 0x10 +#define GMEM_NODISCARD 0x20 +#define GMEM_ZEROINIT 0x40 +#define GMEM_MODIFY 0x80 +#define GMEM_DISCARDABLE 0x100 +#define GMEM_NOT_BANKED 0x1000 +#define GMEM_SHARE 0x2000 +#define GMEM_DDESHARE 0x2000 +#define GMEM_NOTIFY 0x4000 +#define GMEM_LOWER GMEM_NOT_BANKED +#define GMEM_VALID_FLAGS 0x7F72 +#define GMEM_INVALID_HANDLE 0x8000 + +#define GHND (GMEM_MOVEABLE | GMEM_ZEROINIT) +#define GPTR (GMEM_FIXED | GMEM_ZEROINIT) + +#define GlobalLRUNewest(h) ((HANDLE)(h)) +#define GlobalLRUOldest(h) ((HANDLE)(h)) +#define GlobalDiscard(h) GlobalReAlloc((h),0,GMEM_MOVEABLE) + +#define GMEM_DISCARDED 0x4000 +#define GMEM_LOCKCOUNT 0xff + + typedef struct _MEMORYSTATUS { + DWORD dwLength; + DWORD dwMemoryLoad; + SIZE_T dwTotalPhys; + SIZE_T dwAvailPhys; + SIZE_T dwTotalPageFile; + SIZE_T dwAvailPageFile; + SIZE_T dwTotalVirtual; + SIZE_T dwAvailVirtual; + } MEMORYSTATUS,*LPMEMORYSTATUS; + +#define LMEM_FIXED 0x0 +#define LMEM_MOVEABLE 0x2 +#define LMEM_NOCOMPACT 0x10 +#define LMEM_NODISCARD 0x20 +#define LMEM_ZEROINIT 0x40 +#define LMEM_MODIFY 0x80 +#define LMEM_DISCARDABLE 0xf00 +#define LMEM_VALID_FLAGS 0xf72 +#define LMEM_INVALID_HANDLE 0x8000 + +#define LHND (LMEM_MOVEABLE | LMEM_ZEROINIT) +#define LPTR (LMEM_FIXED | LMEM_ZEROINIT) + +#define NONZEROLHND (LMEM_MOVEABLE) +#define NONZEROLPTR (LMEM_FIXED) + +#define LocalDiscard(h) LocalReAlloc((h),0,LMEM_MOVEABLE) + +#define LMEM_DISCARDED 0x4000 +#define LMEM_LOCKCOUNT 0xff + +#define DEBUG_PROCESS 0x1 +#define DEBUG_ONLY_THIS_PROCESS 0x2 +#define CREATE_SUSPENDED 0x4 +#define DETACHED_PROCESS 0x8 +#define CREATE_NEW_CONSOLE 0x10 +#define NORMAL_PRIORITY_CLASS 0x20 +#define IDLE_PRIORITY_CLASS 0x40 +#define HIGH_PRIORITY_CLASS 0x80 +#define REALTIME_PRIORITY_CLASS 0x100 +#define CREATE_NEW_PROCESS_GROUP 0x200 +#define CREATE_UNICODE_ENVIRONMENT 0x400 +#define CREATE_SEPARATE_WOW_VDM 0x800 +#define CREATE_SHARED_WOW_VDM 0x1000 +#define CREATE_FORCEDOS 0x2000 +#define BELOW_NORMAL_PRIORITY_CLASS 0x4000 +#define ABOVE_NORMAL_PRIORITY_CLASS 0x8000 +#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x10000 + +#define CREATE_BREAKAWAY_FROM_JOB 0x1000000 +#define CREATE_PRESERVE_CODE_AUTHZ_LEVEL 0x2000000 + +#define CREATE_DEFAULT_ERROR_MODE 0x4000000 +#define CREATE_NO_WINDOW 0x8000000 + +#define PROFILE_USER 0x10000000 +#define PROFILE_KERNEL 0x20000000 +#define PROFILE_SERVER 0x40000000 + +#define CREATE_IGNORE_SYSTEM_DEFAULT 0x80000000 + +#define THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN +#define THREAD_PRIORITY_BELOW_NORMAL (THREAD_PRIORITY_LOWEST+1) +#define THREAD_PRIORITY_NORMAL 0 +#define THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX +#define THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST-1) +#define THREAD_PRIORITY_ERROR_RETURN (MAXLONG) + +#define THREAD_PRIORITY_TIME_CRITICAL THREAD_BASE_PRIORITY_LOWRT +#define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE + +#define EXCEPTION_DEBUG_EVENT 1 +#define CREATE_THREAD_DEBUG_EVENT 2 +#define CREATE_PROCESS_DEBUG_EVENT 3 +#define EXIT_THREAD_DEBUG_EVENT 4 +#define EXIT_PROCESS_DEBUG_EVENT 5 +#define LOAD_DLL_DEBUG_EVENT 6 +#define UNLOAD_DLL_DEBUG_EVENT 7 +#define OUTPUT_DEBUG_STRING_EVENT 8 +#define RIP_EVENT 9 + + typedef struct _EXCEPTION_DEBUG_INFO { + EXCEPTION_RECORD ExceptionRecord; + DWORD dwFirstChance; + } EXCEPTION_DEBUG_INFO,*LPEXCEPTION_DEBUG_INFO; + + typedef struct _CREATE_THREAD_DEBUG_INFO { + HANDLE hThread; + LPVOID lpThreadLocalBase; + LPTHREAD_START_ROUTINE lpStartAddress; + } CREATE_THREAD_DEBUG_INFO,*LPCREATE_THREAD_DEBUG_INFO; + + typedef struct _CREATE_PROCESS_DEBUG_INFO { + HANDLE hFile; + HANDLE hProcess; + HANDLE hThread; + LPVOID lpBaseOfImage; + DWORD dwDebugInfoFileOffset; + DWORD nDebugInfoSize; + LPVOID lpThreadLocalBase; + LPTHREAD_START_ROUTINE lpStartAddress; + LPVOID lpImageName; + WORD fUnicode; + } CREATE_PROCESS_DEBUG_INFO,*LPCREATE_PROCESS_DEBUG_INFO; + + typedef struct _EXIT_THREAD_DEBUG_INFO { + DWORD dwExitCode; + } EXIT_THREAD_DEBUG_INFO,*LPEXIT_THREAD_DEBUG_INFO; + + typedef struct _EXIT_PROCESS_DEBUG_INFO { + DWORD dwExitCode; + } EXIT_PROCESS_DEBUG_INFO,*LPEXIT_PROCESS_DEBUG_INFO; + + typedef struct _LOAD_DLL_DEBUG_INFO { + HANDLE hFile; + LPVOID lpBaseOfDll; + DWORD dwDebugInfoFileOffset; + DWORD nDebugInfoSize; + LPVOID lpImageName; + WORD fUnicode; + } LOAD_DLL_DEBUG_INFO,*LPLOAD_DLL_DEBUG_INFO; + + typedef struct _UNLOAD_DLL_DEBUG_INFO { + LPVOID lpBaseOfDll; + } UNLOAD_DLL_DEBUG_INFO,*LPUNLOAD_DLL_DEBUG_INFO; + + typedef struct _OUTPUT_DEBUG_STRING_INFO { + LPSTR lpDebugStringData; + WORD fUnicode; + WORD nDebugStringLength; + } OUTPUT_DEBUG_STRING_INFO,*LPOUTPUT_DEBUG_STRING_INFO; + + typedef struct _RIP_INFO { + DWORD dwError; + DWORD dwType; + } RIP_INFO,*LPRIP_INFO; + + typedef struct _DEBUG_EVENT { + DWORD dwDebugEventCode; + DWORD dwProcessId; + DWORD dwThreadId; + union { + EXCEPTION_DEBUG_INFO Exception; + CREATE_THREAD_DEBUG_INFO CreateThread; + CREATE_PROCESS_DEBUG_INFO CreateProcessInfo; + EXIT_THREAD_DEBUG_INFO ExitThread; + EXIT_PROCESS_DEBUG_INFO ExitProcess; + LOAD_DLL_DEBUG_INFO LoadDll; + UNLOAD_DLL_DEBUG_INFO UnloadDll; + OUTPUT_DEBUG_STRING_INFO DebugString; + RIP_INFO RipInfo; + } u; + } DEBUG_EVENT,*LPDEBUG_EVENT; + + typedef PCONTEXT LPCONTEXT; + typedef PEXCEPTION_RECORD LPEXCEPTION_RECORD; + typedef PEXCEPTION_POINTERS LPEXCEPTION_POINTERS; + +#define DRIVE_UNKNOWN 0 +#define DRIVE_NO_ROOT_DIR 1 +#define DRIVE_REMOVABLE 2 +#define DRIVE_FIXED 3 +#define DRIVE_REMOTE 4 +#define DRIVE_CDROM 5 +#define DRIVE_RAMDISK 6 + +#define GetFreeSpace(w) (0x100000L) +#define FILE_TYPE_UNKNOWN 0x0 +#define FILE_TYPE_DISK 0x1 +#define FILE_TYPE_CHAR 0x2 +#define FILE_TYPE_PIPE 0x3 +#define FILE_TYPE_REMOTE 0x8000 + +#define STD_INPUT_HANDLE ((DWORD)-10) +#define STD_OUTPUT_HANDLE ((DWORD)-11) +#define STD_ERROR_HANDLE ((DWORD)-12) + +#define NOPARITY 0 +#define ODDPARITY 1 +#define EVENPARITY 2 +#define MARKPARITY 3 +#define SPACEPARITY 4 + +#define ONESTOPBIT 0 +#define ONE5STOPBITS 1 +#define TWOSTOPBITS 2 + +#define IGNORE 0 +#define INFINITE 0xffffffff + +#define CBR_110 110 +#define CBR_300 300 +#define CBR_600 600 +#define CBR_1200 1200 +#define CBR_2400 2400 +#define CBR_4800 4800 +#define CBR_9600 9600 +#define CBR_14400 14400 +#define CBR_19200 19200 +#define CBR_38400 38400 +#define CBR_56000 56000 +#define CBR_57600 57600 +#define CBR_115200 115200 +#define CBR_128000 128000 +#define CBR_256000 256000 + +#define CE_RXOVER 0x1 +#define CE_OVERRUN 0x2 +#define CE_RXPARITY 0x4 +#define CE_FRAME 0x8 +#define CE_BREAK 0x10 +#define CE_TXFULL 0x100 +#define CE_PTO 0x200 +#define CE_IOE 0x400 +#define CE_DNS 0x800 +#define CE_OOP 0x1000 +#define CE_MODE 0x8000 + +#define IE_BADID (-1) +#define IE_OPEN (-2) +#define IE_NOPEN (-3) +#define IE_MEMORY (-4) +#define IE_DEFAULT (-5) +#define IE_HARDWARE (-10) +#define IE_BYTESIZE (-11) +#define IE_BAUDRATE (-12) + +#define EV_RXCHAR 0x1 +#define EV_RXFLAG 0x2 +#define EV_TXEMPTY 0x4 +#define EV_CTS 0x8 +#define EV_DSR 0x10 +#define EV_RLSD 0x20 +#define EV_BREAK 0x40 +#define EV_ERR 0x80 +#define EV_RING 0x100 +#define EV_PERR 0x200 +#define EV_RX80FULL 0x400 +#define EV_EVENT1 0x800 +#define EV_EVENT2 0x1000 + +#define SETXOFF 1 +#define SETXON 2 +#define SETRTS 3 +#define CLRRTS 4 +#define SETDTR 5 +#define CLRDTR 6 +#define RESETDEV 7 +#define SETBREAK 8 +#define CLRBREAK 9 + +#define PURGE_TXABORT 0x1 +#define PURGE_RXABORT 0x2 +#define PURGE_TXCLEAR 0x4 +#define PURGE_RXCLEAR 0x8 + +#define LPTx 0x80 + +#define MS_CTS_ON ((DWORD)0x10) +#define MS_DSR_ON ((DWORD)0x20) +#define MS_RING_ON ((DWORD)0x40) +#define MS_RLSD_ON ((DWORD)0x80) + +#define S_QUEUEEMPTY 0 +#define S_THRESHOLD 1 +#define S_ALLTHRESHOLD 2 + +#define S_NORMAL 0 +#define S_LEGATO 1 +#define S_STACCATO 2 + +#define S_PERIOD512 0 +#define S_PERIOD1024 1 +#define S_PERIOD2048 2 +#define S_PERIODVOICE 3 +#define S_WHITE512 4 +#define S_WHITE1024 5 +#define S_WHITE2048 6 +#define S_WHITEVOICE 7 + +#define S_SERDVNA (-1) +#define S_SEROFM (-2) +#define S_SERMACT (-3) +#define S_SERQFUL (-4) +#define S_SERBDNT (-5) +#define S_SERDLN (-6) +#define S_SERDCC (-7) +#define S_SERDTP (-8) +#define S_SERDVL (-9) +#define S_SERDMD (-10) +#define S_SERDSH (-11) +#define S_SERDPT (-12) +#define S_SERDFQ (-13) +#define S_SERDDR (-14) +#define S_SERDSR (-15) +#define S_SERDST (-16) + +#define NMPWAIT_WAIT_FOREVER 0xffffffff +#define NMPWAIT_NOWAIT 0x1 +#define NMPWAIT_USE_DEFAULT_WAIT 0x0 + +#define FS_CASE_IS_PRESERVED FILE_CASE_PRESERVED_NAMES +#define FS_CASE_SENSITIVE FILE_CASE_SENSITIVE_SEARCH +#define FS_UNICODE_STORED_ON_DISK FILE_UNICODE_ON_DISK +#define FS_PERSISTENT_ACLS FILE_PERSISTENT_ACLS +#define FS_VOL_IS_COMPRESSED FILE_VOLUME_IS_COMPRESSED +#define FS_FILE_COMPRESSION FILE_FILE_COMPRESSION +#define FS_FILE_ENCRYPTION FILE_SUPPORTS_ENCRYPTION + +#define FILE_MAP_COPY SECTION_QUERY +#define FILE_MAP_WRITE SECTION_MAP_WRITE +#define FILE_MAP_READ SECTION_MAP_READ +#define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS +#define FILE_MAP_EXECUTE SECTION_MAP_EXECUTE_EXPLICIT + +#define OF_READ 0x0 +#define OF_WRITE 0x1 +#define OF_READWRITE 0x2 +#define OF_SHARE_COMPAT 0x0 +#define OF_SHARE_EXCLUSIVE 0x10 +#define OF_SHARE_DENY_WRITE 0x20 +#define OF_SHARE_DENY_READ 0x30 +#define OF_SHARE_DENY_NONE 0x40 +#define OF_PARSE 0x100 +#define OF_DELETE 0x200 +#define OF_VERIFY 0x400 +#define OF_CANCEL 0x800 +#define OF_CREATE 0x1000 +#define OF_PROMPT 0x2000 +#define OF_EXIST 0x4000 +#define OF_REOPEN 0x8000 + +#define OFS_MAXPATHNAME 128 + typedef struct _OFSTRUCT { + BYTE cBytes; + BYTE fFixedDisk; + WORD nErrCode; + WORD Reserved1; + WORD Reserved2; + CHAR szPathName[OFS_MAXPATHNAME]; + } OFSTRUCT,*LPOFSTRUCT,*POFSTRUCT; + +#ifndef NOWINBASEINTERLOCK + +#ifndef _NTOS_ + +#if defined(__ia64__) && !defined(RC_INVOKED) + +#define InterlockedIncrement _InterlockedIncrement +#define InterlockedIncrementAcquire _InterlockedIncrement_acq +#define InterlockedIncrementRelease _InterlockedIncrement_rel +#define InterlockedDecrement _InterlockedDecrement +#define InterlockedDecrementAcquire _InterlockedDecrement_acq +#define InterlockedDecrementRelease _InterlockedDecrement_rel +#define InterlockedExchange _InterlockedExchange +#define InterlockedExchangeAdd _InterlockedExchangeAdd +#define InterlockedCompareExchange _InterlockedCompareExchange +#define InterlockedCompareExchangeAcquire _InterlockedCompareExchange_acq +#define InterlockedCompareExchangeRelease _InterlockedCompareExchange_rel +#define InterlockedExchangePointer _InterlockedExchangePointer +#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer_rel +#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer_acq + +#define InterlockedIncrement64 _InterlockedIncrement64 +#define InterlockedDecrement64 _InterlockedDecrement64 +#define InterlockedExchange64 _InterlockedExchange64 +#define InterlockedExchangeAcquire64 _InterlockedExchange64_acq +#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 +#define InterlockedCompareExchange64 _InterlockedCompareExchange64 +#define InterlockedCompareExchangeAcquire64 _InterlockedCompareExchange64_acq +#define InterlockedCompareExchangeRelease64 _InterlockedCompareExchange64_rel + + LONGLONG __cdecl InterlockedIncrement64(LONGLONG volatile *Addend); + LONGLONG __cdecl InterlockedDecrement64(LONGLONG volatile *Addend); + LONG __cdecl InterlockedIncrementAcquire(LONG volatile *Addend); + LONG __cdecl InterlockedDecrementAcquire(LONG volatile *Addend); + LONG __cdecl InterlockedIncrementRelease(LONG volatile *Addend); + LONG __cdecl InterlockedDecrementRelease(LONG volatile *Addend); + LONGLONG __cdecl InterlockedExchange64 (LONGLONG volatile *Target,LONGLONG Value); + LONGLONG __cdecl InterlockedExchangeAcquire64 (LONGLONG volatile *Target,LONGLONG Value); + LONGLONG __cdecl InterlockedExchangeAdd64 (LONGLONG volatile *Addend,LONGLONG Value); + LONGLONG __cdecl InterlockedCompareExchange64 (LONGLONG volatile *Destination,LONGLONG ExChange,LONGLONG Comperand); + LONGLONG __cdecl InterlockedCompareExchangeAcquire64 (LONGLONG volatile *Destination,LONGLONG ExChange,LONGLONG Comperand); + LONGLONG __cdecl InterlockedCompareExchangeRelease64 (LONGLONG volatile *Destination,LONGLONG ExChange,LONGLONG Comperand); + LONG __cdecl InterlockedIncrement(LONG volatile *lpAddend); + LONG __cdecl InterlockedDecrement(LONG volatile *lpAddend); + LONG __cdecl InterlockedExchange(LONG volatile *Target,LONG Value); + LONG __cdecl InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); + LONG __cdecl InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand); + LONG __cdecl InterlockedCompareExchangeRelease(LONG volatile *Destination,LONG ExChange,LONG Comperand); + LONG __cdecl InterlockedCompareExchangeAcquire(LONG volatile *Destination,LONG ExChange,LONG Comperand); + PVOID __cdecl InterlockedExchangePointer(PVOID volatile *Target,PVOID Value); + PVOID __cdecl InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand); + PVOID __cdecl InterlockedCompareExchangePointerAcquire(PVOID volatile *Destination,PVOID Exchange,PVOID Comperand); + PVOID __cdecl InterlockedCompareExchangePointerRelease(PVOID volatile *Destination,PVOID Exchange,PVOID Comperand); + +#ifndef InterlockedAnd +#define InterlockedAnd InterlockedAnd_Inline + __CRT_INLINE LONG InterlockedAnd_Inline(LONG volatile *Target,LONG Set) { + LONG i; + LONG j; + j = *Target; + do { + i = j; + j = InterlockedCompareExchange(Target,i & Set,i); + } while(i!=j); + return j; + } +#endif + +#ifndef InterlockedOr +#define InterlockedOr InterlockedOr_Inline + + __CRT_INLINE LONG InterlockedOr_Inline(LONG volatile *Target,LONG Set) { + LONG i; + LONG j; + j = *Target; + do { + i = j; + j = InterlockedCompareExchange(Target,i | Set,i); + } while(i!=j); + return j; + } +#endif + +#ifndef InterlockedXor +#define InterlockedXor InterlockedXor_Inline + + __CRT_INLINE LONG InterlockedXor_Inline(LONG volatile *Target,LONG Set) { + LONG i; + LONG j; + j = *Target; + do { + i = j; + j = InterlockedCompareExchange(Target,i ^ Set,i); + } while(i!=j); + return j; + } +#endif + +#ifndef !defined (InterlockedAnd64) +#define InterlockedAnd64 InterlockedAnd64_Inline + + __CRT_INLINE LONGLONG InterlockedAnd64_Inline (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old & Value,Old)!=Old); + return Old; + } +#endif + +#ifndef InterlockedOr64 +#define InterlockedOr64 InterlockedOr64_Inline + + __CRT_INLINE LONGLONG InterlockedOr64_Inline (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old | Value,Old)!=Old); + return Old; + } +#endif + +#ifndef InterlockedXor64 +#define InterlockedXor64 InterlockedXor64_Inline + + __CRT_INLINE LONGLONG InterlockedXor64_Inline (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old ^ Value,Old)!=Old); + return Old; + } +#endif + +#ifndef InterlockedBitTestAndSet +#define InterlockedBitTestAndSet InterlockedBitTestAndSet_Inline + + __CRT_INLINE BOOLEAN InterlockedBitTestAndSet_Inline(LONG *Base,LONG Bit) { + LONG tBit; + tBit = 1<<(Bit & (sizeof (*Base)*8-1)); + return (BOOLEAN)((InterlockedOr(&Base[Bit/(sizeof(*Base)*8)],tBit)&tBit)!=0); + } +#endif + +#ifndef InterlockedBitTestAndReset +#define InterlockedBitTestAndReset InterlockedBitTestAndReset_Inline + + __CRT_INLINE BOOLEAN InterlockedBitTestAndReset_Inline(LONG *Base,LONG Bit) { + LONG tBit; + tBit = 1<<(Bit & (sizeof (*Base)*8-1)); + return (BOOLEAN)((InterlockedAnd(&Base[Bit/(sizeof(*Base)*8)],~tBit)&tBit)!=0); + } +#endif + +#ifndef InterlockedBitTestAndComplement +#define InterlockedBitTestAndComplement InterlockedBitTestAndComplement_Inline + + __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement_Inline(LONG *Base,LONG Bit) { + LONG tBit; + tBit = 1<<(Bit & (sizeof (*Base)*8-1)); + return (BOOLEAN)((InterlockedXor(&Base[Bit/(sizeof(*Base)*8)],tBit)&tBit)!=0); + } +#endif +#elif defined(__x86_64) && !defined(RC_INVOKED) + +#define InterlockedIncrement _InterlockedIncrement +#define InterlockedIncrementAcquire InterlockedIncrement +#define InterlockedIncrementRelease InterlockedIncrement +#define InterlockedDecrement _InterlockedDecrement +#define InterlockedDecrementAcquire InterlockedDecrement +#define InterlockedDecrementRelease InterlockedDecrement +#define InterlockedExchange _InterlockedExchange +#define InterlockedExchangeAdd _InterlockedExchangeAdd +#define InterlockedCompareExchange _InterlockedCompareExchange +#define InterlockedCompareExchangeAcquire InterlockedCompareExchange +#define InterlockedCompareExchangeRelease InterlockedCompareExchange +#define InterlockedExchangePointer _InterlockedExchangePointer +#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer +#define InterlockedAnd64 _InterlockedAnd64 +#define InterlockedOr64 _InterlockedOr64 +#define InterlockedXor64 _InterlockedXor64 +#define InterlockedIncrement64 _InterlockedIncrement64 +#define InterlockedDecrement64 _InterlockedDecrement64 +#define InterlockedExchange64 _InterlockedExchange64 +#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 +#define InterlockedCompareExchange64 _InterlockedCompareExchange64 +#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 +#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 + + LONG InterlockedIncrement(LONG volatile *Addend); + LONG InterlockedDecrement(LONG volatile *Addend); + LONG InterlockedExchange(LONG volatile *Target,LONG Value); + LONG InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); + LONG InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand); + PVOID InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID Exchange,PVOID Comperand); + PVOID InterlockedExchangePointer(PVOID volatile *Target,PVOID Value); + LONG64 InterlockedAnd64(LONG64 volatile *Destination,LONG64 Value); + LONG64 InterlockedOr64(LONG64 volatile *Destination,LONG64 Value); + LONG64 InterlockedXor64(LONG64 volatile *Destination,LONG64 Value); + LONG64 InterlockedIncrement64(LONG64 volatile *Addend); + LONG64 InterlockedDecrement64(LONG64 volatile *Addend); + LONG64 InterlockedExchange64(LONG64 volatile *Target,LONG64 Value); + LONG64 InterlockedExchangeAdd64(LONG64 volatile *Addend,LONG64 Value); + LONG64 InterlockedCompareExchange64(LONG64 volatile *Destination,LONG64 ExChange,LONG64 Comperand); +#else + LONG WINAPI InterlockedIncrement(LONG volatile *lpAddend); + LONG WINAPI InterlockedDecrement(LONG volatile *lpAddend); + LONG WINAPI InterlockedExchange(LONG volatile *Target,LONG Value); + +#define InterlockedExchangePointer(Target,Value) (PVOID)InterlockedExchange((PLONG)(Target),(LONG)(Value)) + + LONG WINAPI InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); + LONG WINAPI InterlockedCompareExchange(LONG volatile *Destination,LONG Exchange,LONG Comperand); + LONGLONG WINAPI InterlockedCompareExchange64(LONGLONG volatile *Destination,LONGLONG Exchange,LONGLONG Comperand); + + __CRT_INLINE LONGLONG InterlockedAnd64 (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old & Value,Old)!=Old); + return Old; + } + + __CRT_INLINE LONGLONG InterlockedOr64 (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old | Value,Old)!=Old); + return Old; + } + + __CRT_INLINE LONGLONG InterlockedXor64 (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old ^ Value,Old)!=Old); + + return Old; + } + + __CRT_INLINE LONGLONG InterlockedIncrement64(LONGLONG volatile *Addend) { + LONGLONG Old; + do { + Old = *Addend; + } while(InterlockedCompareExchange64(Addend,Old + 1,Old)!=Old); + return Old + 1; + } + + __CRT_INLINE LONGLONG InterlockedDecrement64(LONGLONG volatile *Addend) { + LONGLONG Old; + do { + Old = *Addend; + } while(InterlockedCompareExchange64(Addend,Old - 1,Old)!=Old); + return Old - 1; + } + + __CRT_INLINE LONGLONG InterlockedExchange64(LONGLONG volatile *Target,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Target; + } while(InterlockedCompareExchange64(Target,Value,Old)!=Old); + return Old; + } + + __CRT_INLINE LONGLONG InterlockedExchangeAdd64(LONGLONG volatile *Addend,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Addend; + } while(InterlockedCompareExchange64(Addend,Old + Value,Old)!=Old); + return Old; + } + +#ifdef __cplusplus + __CRT_INLINE PVOID __cdecl __InlineInterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand) { + return((PVOID)(LONG_PTR)InterlockedCompareExchange((LONG volatile *)Destination,(LONG)(LONG_PTR)ExChange,(LONG)(LONG_PTR)Comperand)); + } +#define InterlockedCompareExchangePointer __InlineInterlockedCompareExchangePointer +#else +#define InterlockedCompareExchangePointer(Destination,ExChange,Comperand)(PVOID)(LONG_PTR)InterlockedCompareExchange((LONG volatile *)(Destination),(LONG)(LONG_PTR)(ExChange),(LONG)(LONG_PTR)(Comperand)) +#endif + +#define InterlockedIncrementAcquire InterlockedIncrement +#define InterlockedIncrementRelease InterlockedIncrement +#define InterlockedDecrementAcquire InterlockedDecrement +#define InterlockedDecrementRelease InterlockedDecrement +#define InterlockedIncrementAcquire InterlockedIncrement +#define InterlockedIncrementRelease InterlockedIncrement +#define InterlockedCompareExchangeAcquire InterlockedCompareExchange +#define InterlockedCompareExchangeRelease InterlockedCompareExchange +#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 +#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 +#define InterlockedCompareExchangePointerAcquire InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerRelease InterlockedCompareExchangePointer +#endif + +#if defined(_SLIST_HEADER_) && !defined(_NTOSP_) + WINBASEAPI VOID WINAPI InitializeSListHead(PSLIST_HEADER ListHead); + WINBASEAPI PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead); + WINBASEAPI PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER ListHead,PSLIST_ENTRY ListEntry); + WINBASEAPI PSLIST_ENTRY WINAPI InterlockedFlushSList(PSLIST_HEADER ListHead); + WINBASEAPI USHORT WINAPI QueryDepthSList(PSLIST_HEADER ListHead); +#endif +#endif +#endif + + WINBASEAPI WINBOOL WINAPI FreeResource(HGLOBAL hResData); + WINBASEAPI LPVOID WINAPI LockResource(HGLOBAL hResData); + +#define UnlockResource(hResData) ((hResData),0) +#define MAXINTATOM 0xC000 +#define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i))) +#define INVALID_ATOM ((ATOM)0) + + int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd); + WINBASEAPI WINBOOL WINAPI FreeLibrary(HMODULE hLibModule); + WINBASEAPI DECLSPEC_NORETURN VOID WINAPI FreeLibraryAndExitThread(HMODULE hLibModule,DWORD dwExitCode); + WINBASEAPI WINBOOL WINAPI DisableThreadLibraryCalls(HMODULE hLibModule); + WINBASEAPI FARPROC WINAPI GetProcAddress(HMODULE hModule,LPCSTR lpProcName); + WINBASEAPI DWORD WINAPI GetVersion(VOID); + WINBASEAPI HGLOBAL WINAPI GlobalAlloc(UINT uFlags,SIZE_T dwBytes); + WINBASEAPI HGLOBAL WINAPI GlobalReAlloc(HGLOBAL hMem,SIZE_T dwBytes,UINT uFlags); + WINBASEAPI SIZE_T WINAPI GlobalSize(HGLOBAL hMem); + WINBASEAPI UINT WINAPI GlobalFlags(HGLOBAL hMem); + WINBASEAPI LPVOID WINAPI GlobalLock(HGLOBAL hMem); + WINBASEAPI HGLOBAL WINAPI GlobalHandle(LPCVOID pMem); + WINBASEAPI WINBOOL WINAPI GlobalUnlock(HGLOBAL hMem); + WINBASEAPI HGLOBAL WINAPI GlobalFree(HGLOBAL hMem); + WINBASEAPI SIZE_T WINAPI GlobalCompact(DWORD dwMinFree); + WINBASEAPI VOID WINAPI GlobalFix(HGLOBAL hMem); + WINBASEAPI VOID WINAPI GlobalUnfix(HGLOBAL hMem); + WINBASEAPI LPVOID WINAPI GlobalWire(HGLOBAL hMem); + WINBASEAPI WINBOOL WINAPI GlobalUnWire(HGLOBAL hMem); + WINBASEAPI VOID WINAPI GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer); + + typedef struct _MEMORYSTATUSEX { + DWORD dwLength; + DWORD dwMemoryLoad; + DWORDLONG ullTotalPhys; + DWORDLONG ullAvailPhys; + DWORDLONG ullTotalPageFile; + DWORDLONG ullAvailPageFile; + DWORDLONG ullTotalVirtual; + DWORDLONG ullAvailVirtual; + DWORDLONG ullAvailExtendedVirtual; + } MEMORYSTATUSEX,*LPMEMORYSTATUSEX; + + WINBASEAPI WINBOOL WINAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer); + WINBASEAPI HLOCAL WINAPI LocalAlloc(UINT uFlags,SIZE_T uBytes); + WINBASEAPI HLOCAL WINAPI LocalReAlloc(HLOCAL hMem,SIZE_T uBytes,UINT uFlags); + WINBASEAPI LPVOID WINAPI LocalLock(HLOCAL hMem); + WINBASEAPI HLOCAL WINAPI LocalHandle(LPCVOID pMem); + WINBASEAPI WINBOOL WINAPI LocalUnlock(HLOCAL hMem); + WINBASEAPI SIZE_T WINAPI LocalSize(HLOCAL hMem); + WINBASEAPI UINT WINAPI LocalFlags(HLOCAL hMem); + WINBASEAPI HLOCAL WINAPI LocalFree(HLOCAL hMem); + WINBASEAPI SIZE_T WINAPI LocalShrink(HLOCAL hMem,UINT cbNewSize); + WINBASEAPI SIZE_T WINAPI LocalCompact(UINT uMinFree); + WINBASEAPI WINBOOL WINAPI FlushInstructionCache(HANDLE hProcess,LPCVOID lpBaseAddress,SIZE_T dwSize); + WINBASEAPI LPVOID WINAPI VirtualAlloc(LPVOID lpAddress,SIZE_T dwSize,DWORD flAllocationType,DWORD flProtect); + WINBASEAPI WINBOOL WINAPI VirtualFree(LPVOID lpAddress,SIZE_T dwSize,DWORD dwFreeType); + WINBASEAPI WINBOOL WINAPI VirtualProtect(LPVOID lpAddress,SIZE_T dwSize,DWORD flNewProtect,PDWORD lpflOldProtect); + WINBASEAPI SIZE_T WINAPI VirtualQuery(LPCVOID lpAddress,PMEMORY_BASIC_INFORMATION lpBuffer,SIZE_T dwLength); + WINBASEAPI LPVOID WINAPI VirtualAllocEx(HANDLE hProcess,LPVOID lpAddress,SIZE_T dwSize,DWORD flAllocationType,DWORD flProtect); + WINBASEAPI UINT WINAPI GetWriteWatch(DWORD dwFlags,PVOID lpBaseAddress,SIZE_T dwRegionSize,PVOID *lpAddresses,ULONG_PTR *lpdwCount,PULONG lpdwGranularity); + WINBASEAPI UINT WINAPI ResetWriteWatch(LPVOID lpBaseAddress,SIZE_T dwRegionSize); + WINBASEAPI SIZE_T WINAPI GetLargePageMinimum(VOID); + WINBASEAPI UINT WINAPI EnumSystemFirmwareTables(DWORD FirmwareTableProviderSignature,PVOID pFirmwareTableEnumBuffer,DWORD BufferSize); + WINBASEAPI UINT WINAPI GetSystemFirmwareTable(DWORD FirmwareTableProviderSignature,DWORD FirmwareTableID,PVOID pFirmwareTableBuffer,DWORD BufferSize); + WINBASEAPI WINBOOL WINAPI VirtualFreeEx(HANDLE hProcess,LPVOID lpAddress,SIZE_T dwSize,DWORD dwFreeType); + WINBASEAPI WINBOOL WINAPI VirtualProtectEx(HANDLE hProcess,LPVOID lpAddress,SIZE_T dwSize,DWORD flNewProtect,PDWORD lpflOldProtect); + WINBASEAPI SIZE_T WINAPI VirtualQueryEx(HANDLE hProcess,LPCVOID lpAddress,PMEMORY_BASIC_INFORMATION lpBuffer,SIZE_T dwLength); + WINBASEAPI HANDLE WINAPI HeapCreate(DWORD flOptions,SIZE_T dwInitialSize,SIZE_T dwMaximumSize); + WINBASEAPI WINBOOL WINAPI HeapDestroy(HANDLE hHeap); + WINBASEAPI LPVOID WINAPI HeapAlloc(HANDLE hHeap,DWORD dwFlags,SIZE_T dwBytes); + WINBASEAPI LPVOID WINAPI HeapReAlloc(HANDLE hHeap,DWORD dwFlags,LPVOID lpMem,SIZE_T dwBytes); + WINBASEAPI WINBOOL WINAPI HeapFree(HANDLE hHeap,DWORD dwFlags,LPVOID lpMem); + WINBASEAPI SIZE_T WINAPI HeapSize(HANDLE hHeap,DWORD dwFlags,LPCVOID lpMem); + WINBASEAPI WINBOOL WINAPI HeapValidate(HANDLE hHeap,DWORD dwFlags,LPCVOID lpMem); + WINBASEAPI SIZE_T WINAPI HeapCompact(HANDLE hHeap,DWORD dwFlags); + WINBASEAPI HANDLE WINAPI GetProcessHeap(VOID); + WINBASEAPI DWORD WINAPI GetProcessHeaps(DWORD NumberOfHeaps,PHANDLE ProcessHeaps); + + typedef struct _PROCESS_HEAP_ENTRY { + PVOID lpData; + DWORD cbData; + BYTE cbOverhead; + BYTE iRegionIndex; + WORD wFlags; + union { + struct { + HANDLE hMem; + DWORD dwReserved[3]; + } Block; + struct { + DWORD dwCommittedSize; + DWORD dwUnCommittedSize; + LPVOID lpFirstBlock; + LPVOID lpLastBlock; + } Region; + }; + } PROCESS_HEAP_ENTRY,*LPPROCESS_HEAP_ENTRY,*PPROCESS_HEAP_ENTRY; + +#define PROCESS_HEAP_REGION 0x1 +#define PROCESS_HEAP_UNCOMMITTED_RANGE 0x2 +#define PROCESS_HEAP_ENTRY_BUSY 0x4 +#define PROCESS_HEAP_ENTRY_MOVEABLE 0x10 +#define PROCESS_HEAP_ENTRY_DDESHARE 0x20 + + WINBASEAPI WINBOOL WINAPI HeapLock(HANDLE hHeap); + WINBASEAPI WINBOOL WINAPI HeapUnlock(HANDLE hHeap); + WINBASEAPI WINBOOL WINAPI HeapWalk(HANDLE hHeap,LPPROCESS_HEAP_ENTRY lpEntry); + WINBASEAPI WINBOOL WINAPI HeapSetInformation(HANDLE HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength); + WINBASEAPI WINBOOL WINAPI HeapQueryInformation(HANDLE HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength); + +#define SCS_32BIT_BINARY 0 +#define SCS_DOS_BINARY 1 +#define SCS_WOW_BINARY 2 +#define SCS_PIF_BINARY 3 +#define SCS_POSIX_BINARY 4 +#define SCS_OS216_BINARY 5 +#define SCS_64BIT_BINARY 6 + +#ifdef UNICODE +#define GetBinaryType GetBinaryTypeW +#define GetShortPathName GetShortPathNameW +#define GetLongPathName GetLongPathNameW +#define GetEnvironmentStrings GetEnvironmentStringsW +#define SetEnvironmentStrings SetEnvironmentStringsW +#define FreeEnvironmentStrings FreeEnvironmentStringsW +#else +#define GetBinaryType GetBinaryTypeA +#define GetShortPathName GetShortPathNameA +#define GetLongPathName GetLongPathNameA +#define GetEnvironmentStringsA GetEnvironmentStrings +#define SetEnvironmentStrings SetEnvironmentStringsA +#define FreeEnvironmentStrings FreeEnvironmentStringsA +#endif + +#ifdef _WIN64 +#define SCS_THIS_PLATFORM_BINARY SCS_64BIT_BINARY +#else +#define SCS_THIS_PLATFORM_BINARY SCS_32BIT_BINARY +#endif + + WINBASEAPI WINBOOL WINAPI GetBinaryTypeA(LPCSTR lpApplicationName,LPDWORD lpBinaryType); + WINBASEAPI WINBOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName,LPDWORD lpBinaryType); + WINBASEAPI DWORD WINAPI GetShortPathNameA(LPCSTR lpszLongPath,LPSTR lpszShortPath,DWORD cchBuffer); + WINBASEAPI DWORD WINAPI GetShortPathNameW(LPCWSTR lpszLongPath,LPWSTR lpszShortPath,DWORD cchBuffer); + WINBASEAPI DWORD WINAPI GetLongPathNameA(LPCSTR lpszShortPath,LPSTR lpszLongPath,DWORD cchBuffer); + WINBASEAPI DWORD WINAPI GetLongPathNameW(LPCWSTR lpszShortPath,LPWSTR lpszLongPath,DWORD cchBuffer); + WINBASEAPI WINBOOL WINAPI GetProcessAffinityMask(HANDLE hProcess,PDWORD_PTR lpProcessAffinityMask,PDWORD_PTR lpSystemAffinityMask); + WINBASEAPI WINBOOL WINAPI SetProcessAffinityMask(HANDLE hProcess,DWORD_PTR dwProcessAffinityMask); + WINBASEAPI WINBOOL WINAPI GetProcessHandleCount(HANDLE hProcess,PDWORD pdwHandleCount); + WINBASEAPI WINBOOL WINAPI GetProcessTimes(HANDLE hProcess,LPFILETIME lpCreationTime,LPFILETIME lpExitTime,LPFILETIME lpKernelTime,LPFILETIME lpUserTime); + WINBASEAPI WINBOOL WINAPI GetProcessIoCounters(HANDLE hProcess,PIO_COUNTERS lpIoCounters); + WINBASEAPI WINBOOL WINAPI GetProcessWorkingSetSize(HANDLE hProcess,PSIZE_T lpMinimumWorkingSetSize,PSIZE_T lpMaximumWorkingSetSize); + WINBASEAPI WINBOOL WINAPI GetProcessWorkingSetSizeEx(HANDLE hProcess,PSIZE_T lpMinimumWorkingSetSize,PSIZE_T lpMaximumWorkingSetSize,PDWORD Flags); + WINBASEAPI WINBOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess,SIZE_T dwMinimumWorkingSetSize,SIZE_T dwMaximumWorkingSetSize); + WINBASEAPI WINBOOL WINAPI SetProcessWorkingSetSizeEx(HANDLE hProcess,SIZE_T dwMinimumWorkingSetSize,SIZE_T dwMaximumWorkingSetSize,DWORD Flags); + WINBASEAPI HANDLE WINAPI OpenProcess(DWORD dwDesiredAccess,WINBOOL bInheritHandle,DWORD dwProcessId); + WINBASEAPI HANDLE WINAPI GetCurrentProcess(VOID); + WINBASEAPI DWORD WINAPI GetCurrentProcessId(VOID); + WINBASEAPI DECLSPEC_NORETURN VOID WINAPI ExitProcess(UINT uExitCode); + WINBASEAPI WINBOOL WINAPI TerminateProcess(HANDLE hProcess,UINT uExitCode); + WINBASEAPI WINBOOL WINAPI GetExitCodeProcess(HANDLE hProcess,LPDWORD lpExitCode); + WINBASEAPI VOID WINAPI FatalExit(int ExitCode); + /* WINBASEAPI LPCH WINAPI GetEnvironmentStrings(VOID); */ + WINBASEAPI LPWCH WINAPI GetEnvironmentStringsW(VOID); + WINBASEAPI WINBOOL WINAPI SetEnvironmentStringsA(LPCH NewEnvironment); + WINBASEAPI WINBOOL WINAPI SetEnvironmentStringsW(LPWCH NewEnvironment); + WINBASEAPI WINBOOL WINAPI FreeEnvironmentStringsA(LPCH); + WINBASEAPI WINBOOL WINAPI FreeEnvironmentStringsW(LPWCH); + WINBASEAPI VOID WINAPI RaiseException(DWORD dwExceptionCode,DWORD dwExceptionFlags,DWORD nNumberOfArguments,CONST ULONG_PTR *lpArguments); + WINBASEAPI LONG WINAPI UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo); + + typedef LONG (WINAPI *PTOP_LEVEL_EXCEPTION_FILTER)(struct _EXCEPTION_POINTERS *ExceptionInfo); + typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; + + WINBASEAPI LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter); + +#define FIBER_FLAG_FLOAT_SWITCH 0x1 + + WINBASEAPI LPVOID WINAPI CreateFiber(SIZE_T dwStackSize,LPFIBER_START_ROUTINE lpStartAddress,LPVOID lpParameter); + WINBASEAPI LPVOID WINAPI CreateFiberEx(SIZE_T dwStackCommitSize,SIZE_T dwStackReserveSize,DWORD dwFlags,LPFIBER_START_ROUTINE lpStartAddress,LPVOID lpParameter); + WINBASEAPI VOID WINAPI DeleteFiber(LPVOID lpFiber); + WINBASEAPI LPVOID WINAPI ConvertThreadToFiber(LPVOID lpParameter); + WINBASEAPI LPVOID WINAPI ConvertThreadToFiberEx(LPVOID lpParameter,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI ConvertFiberToThread(VOID); + WINBASEAPI VOID WINAPI SwitchToFiber(LPVOID lpFiber); + WINBASEAPI WINBOOL WINAPI SwitchToThread(VOID); + WINBASEAPI HANDLE WINAPI CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes,SIZE_T dwStackSize,LPTHREAD_START_ROUTINE lpStartAddress,LPVOID lpParameter,DWORD dwCreationFlags,LPDWORD lpThreadId); + WINBASEAPI HANDLE WINAPI CreateRemoteThread(HANDLE hProcess,LPSECURITY_ATTRIBUTES lpThreadAttributes,SIZE_T dwStackSize,LPTHREAD_START_ROUTINE lpStartAddress,LPVOID lpParameter,DWORD dwCreationFlags,LPDWORD lpThreadId); + WINBASEAPI HANDLE WINAPI GetCurrentThread(VOID); + WINBASEAPI DWORD WINAPI GetCurrentThreadId(VOID); + WINBASEAPI WINBOOL WINAPI SetThreadStackGuarantee (PULONG StackSizeInBytes); + WINBASEAPI DWORD WINAPI GetProcessIdOfThread(HANDLE Thread); + WINBASEAPI DWORD WINAPI GetThreadId(HANDLE Thread); + WINBASEAPI DWORD WINAPI GetProcessId(HANDLE Process); + WINBASEAPI DWORD WINAPI GetCurrentProcessorNumber(VOID); + WINBASEAPI DWORD_PTR WINAPI SetThreadAffinityMask(HANDLE hThread,DWORD_PTR dwThreadAffinityMask); + WINBASEAPI DWORD WINAPI SetThreadIdealProcessor(HANDLE hThread,DWORD dwIdealProcessor); + WINBASEAPI WINBOOL WINAPI SetProcessPriorityBoost(HANDLE hProcess,WINBOOL bDisablePriorityBoost); + WINBASEAPI WINBOOL WINAPI GetProcessPriorityBoost(HANDLE hProcess,PBOOL pDisablePriorityBoost); + WINBASEAPI WINBOOL WINAPI RequestWakeupLatency(LATENCY_TIME latency); + WINBASEAPI WINBOOL WINAPI IsSystemResumeAutomatic(VOID); + WINBASEAPI HANDLE WINAPI OpenThread(DWORD dwDesiredAccess,WINBOOL bInheritHandle,DWORD dwThreadId); + WINBASEAPI WINBOOL WINAPI SetThreadPriority(HANDLE hThread,int nPriority); + WINBASEAPI WINBOOL WINAPI SetThreadPriorityBoost(HANDLE hThread,WINBOOL bDisablePriorityBoost); + WINBASEAPI WINBOOL WINAPI GetThreadPriorityBoost(HANDLE hThread,PBOOL pDisablePriorityBoost); + WINBASEAPI int WINAPI GetThreadPriority(HANDLE hThread); + WINBASEAPI WINBOOL WINAPI GetThreadTimes(HANDLE hThread,LPFILETIME lpCreationTime,LPFILETIME lpExitTime,LPFILETIME lpKernelTime,LPFILETIME lpUserTime); + WINBASEAPI WINBOOL WINAPI GetThreadIOPendingFlag(HANDLE hThread,PBOOL lpIOIsPending); + WINBASEAPI DECLSPEC_NORETURN VOID WINAPI ExitThread(DWORD dwExitCode); + WINBASEAPI WINBOOL WINAPI TerminateThread(HANDLE hThread,DWORD dwExitCode); + WINBASEAPI WINBOOL WINAPI GetExitCodeThread(HANDLE hThread,LPDWORD lpExitCode); + WINBASEAPI WINBOOL WINAPI GetThreadSelectorEntry(HANDLE hThread,DWORD dwSelector,LPLDT_ENTRY lpSelectorEntry); + WINBASEAPI EXECUTION_STATE WINAPI SetThreadExecutionState(EXECUTION_STATE esFlags); + WINBASEAPI DWORD WINAPI GetLastError(VOID); + WINBASEAPI VOID WINAPI SetLastError(DWORD dwErrCode); + +#ifndef RC_INVOKED +#ifdef WINBASE_DECLARE_RESTORE_LAST_ERROR + WINBASEAPI VOID WINAPI RestoreLastError(DWORD dwErrCode); + + typedef VOID (WINAPI *PRESTORE_LAST_ERROR)(DWORD); + +#define RESTORE_LAST_ERROR_NAME_A "RestoreLastError" +#define RESTORE_LAST_ERROR_NAME_W L"RestoreLastError" +#define RESTORE_LAST_ERROR_NAME TEXT("RestoreLastError") +#endif +#endif + +#define HasOverlappedIoCompleted(lpOverlapped) (((DWORD)(lpOverlapped)->Internal)!=STATUS_PENDING) + + WINBASEAPI WINBOOL WINAPI GetOverlappedResult(HANDLE hFile,LPOVERLAPPED lpOverlapped,LPDWORD lpNumberOfBytesTransferred,WINBOOL bWait); + WINBASEAPI HANDLE WINAPI CreateIoCompletionPort(HANDLE FileHandle,HANDLE ExistingCompletionPort,ULONG_PTR CompletionKey,DWORD NumberOfConcurrentThreads); + WINBASEAPI WINBOOL WINAPI GetQueuedCompletionStatus(HANDLE CompletionPort,LPDWORD lpNumberOfBytesTransferred,PULONG_PTR lpCompletionKey,LPOVERLAPPED *lpOverlapped,DWORD dwMilliseconds); + WINBASEAPI WINBOOL WINAPI PostQueuedCompletionStatus(HANDLE CompletionPort,DWORD dwNumberOfBytesTransferred,ULONG_PTR dwCompletionKey,LPOVERLAPPED lpOverlapped); + +#define SEM_FAILCRITICALERRORS 0x1 +#define SEM_NOGPFAULTERRORBOX 0x2 +#define SEM_NOALIGNMENTFAULTEXCEPT 0x4 +#define SEM_NOOPENFILEERRORBOX 0x8000 + + WINBASEAPI UINT WINAPI SetErrorMode(UINT uMode); + WINBASEAPI WINBOOL WINAPI ReadProcessMemory(HANDLE hProcess,LPCVOID lpBaseAddress,LPVOID lpBuffer,SIZE_T nSize,SIZE_T *lpNumberOfBytesRead); + WINBASEAPI WINBOOL WINAPI WriteProcessMemory(HANDLE hProcess,LPVOID lpBaseAddress,LPCVOID lpBuffer,SIZE_T nSize,SIZE_T *lpNumberOfBytesWritten); + WINBASEAPI WINBOOL WINAPI GetThreadContext(HANDLE hThread,LPCONTEXT lpContext); + WINBASEAPI WINBOOL WINAPI SetThreadContext(HANDLE hThread,CONST CONTEXT *lpContext); + WINBASEAPI DWORD WINAPI SuspendThread(HANDLE hThread); + WINBASEAPI DWORD WINAPI ResumeThread(HANDLE hThread); + + typedef VOID (WINAPI *PAPCFUNC)(ULONG_PTR dwParam); + + WINBASEAPI DWORD WINAPI QueueUserAPC(PAPCFUNC pfnAPC,HANDLE hThread,ULONG_PTR dwData); + WINBASEAPI WINBOOL WINAPI IsDebuggerPresent(VOID); + WINBASEAPI WINBOOL WINAPI CheckRemoteDebuggerPresent(HANDLE hProcess,PBOOL pbDebuggerPresent); + WINBASEAPI VOID WINAPI DebugBreak(VOID); + WINBASEAPI WINBOOL WINAPI WaitForDebugEvent(LPDEBUG_EVENT lpDebugEvent,DWORD dwMilliseconds); + WINBASEAPI WINBOOL WINAPI ContinueDebugEvent(DWORD dwProcessId,DWORD dwThreadId,DWORD dwContinueStatus); + WINBASEAPI WINBOOL WINAPI DebugActiveProcess(DWORD dwProcessId); + WINBASEAPI WINBOOL WINAPI DebugActiveProcessStop(DWORD dwProcessId); + WINBASEAPI WINBOOL WINAPI DebugSetProcessKillOnExit(WINBOOL KillOnExit); + WINBASEAPI WINBOOL WINAPI DebugBreakProcess(HANDLE Process); + WINBASEAPI VOID WINAPI InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI VOID WINAPI EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI VOID WINAPI LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI WINBOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION lpCriticalSection,DWORD dwSpinCount); + WINBASEAPI DWORD WINAPI SetCriticalSectionSpinCount(LPCRITICAL_SECTION lpCriticalSection,DWORD dwSpinCount); + WINBASEAPI WINBOOL WINAPI TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI VOID WINAPI DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI WINBOOL WINAPI SetEvent(HANDLE hEvent); + WINBASEAPI WINBOOL WINAPI ResetEvent(HANDLE hEvent); + WINBASEAPI WINBOOL WINAPI PulseEvent(HANDLE hEvent); + WINBASEAPI WINBOOL WINAPI ReleaseSemaphore(HANDLE hSemaphore,LONG lReleaseCount,LPLONG lpPreviousCount); + WINBASEAPI WINBOOL WINAPI ReleaseMutex(HANDLE hMutex); + WINBASEAPI DWORD WINAPI WaitForSingleObject(HANDLE hHandle,DWORD dwMilliseconds); + WINBASEAPI DWORD WINAPI WaitForMultipleObjects(DWORD nCount,CONST HANDLE *lpHandles,WINBOOL bWaitAll,DWORD dwMilliseconds); + WINBASEAPI VOID WINAPI Sleep(DWORD dwMilliseconds); + WINBASEAPI HGLOBAL WINAPI LoadResource(HMODULE hModule,HRSRC hResInfo); + WINBASEAPI DWORD WINAPI SizeofResource(HMODULE hModule,HRSRC hResInfo); + WINBASEAPI ATOM WINAPI GlobalDeleteAtom(ATOM nAtom); + WINBASEAPI WINBOOL WINAPI InitAtomTable(DWORD nSize); + WINBASEAPI ATOM WINAPI DeleteAtom(ATOM nAtom); + WINBASEAPI UINT WINAPI SetHandleCount(UINT uNumber); + WINBASEAPI DWORD WINAPI GetLogicalDrives(VOID); + WINBASEAPI WINBOOL WINAPI LockFile(HANDLE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,DWORD nNumberOfBytesToLockLow,DWORD nNumberOfBytesToLockHigh); + WINBASEAPI WINBOOL WINAPI UnlockFile(HANDLE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh); + WINBASEAPI WINBOOL WINAPI LockFileEx(HANDLE hFile,DWORD dwFlags,DWORD dwReserved,DWORD nNumberOfBytesToLockLow,DWORD nNumberOfBytesToLockHigh,LPOVERLAPPED lpOverlapped); + +#define LOCKFILE_FAIL_IMMEDIATELY 0x1 +#define LOCKFILE_EXCLUSIVE_LOCK 0x2 + + WINBASEAPI WINBOOL WINAPI UnlockFileEx(HANDLE hFile,DWORD dwReserved,DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh,LPOVERLAPPED lpOverlapped); + + typedef struct _BY_HANDLE_FILE_INFORMATION { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD dwVolumeSerialNumber; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD nNumberOfLinks; + DWORD nFileIndexHigh; + DWORD nFileIndexLow; + } BY_HANDLE_FILE_INFORMATION,*PBY_HANDLE_FILE_INFORMATION,*LPBY_HANDLE_FILE_INFORMATION; + +#ifdef UNICODE +#define SetFileShortName SetFileShortNameW +#else +#define SetFileShortName SetFileShortNameA +#endif + + WINBASEAPI WINBOOL WINAPI GetFileInformationByHandle(HANDLE hFile,LPBY_HANDLE_FILE_INFORMATION lpFileInformation); + WINBASEAPI DWORD WINAPI GetFileType(HANDLE hFile); + WINBASEAPI DWORD WINAPI GetFileSize(HANDLE hFile,LPDWORD lpFileSizeHigh); + WINBASEAPI WINBOOL WINAPI GetFileSizeEx(HANDLE hFile,PLARGE_INTEGER lpFileSize); + WINBASEAPI HANDLE WINAPI GetStdHandle(DWORD nStdHandle); + WINBASEAPI WINBOOL WINAPI SetStdHandle(DWORD nStdHandle,HANDLE hHandle); + WINBASEAPI WINBOOL WINAPI WriteFile(HANDLE hFile,LPCVOID lpBuffer,DWORD nNumberOfBytesToWrite,LPDWORD lpNumberOfBytesWritten,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI ReadFile(HANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI FlushFileBuffers(HANDLE hFile); + WINBASEAPI WINBOOL WINAPI DeviceIoControl(HANDLE hDevice,DWORD dwIoControlCode,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesReturned,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI RequestDeviceWakeup(HANDLE hDevice); + WINBASEAPI WINBOOL WINAPI CancelDeviceWakeupRequest(HANDLE hDevice); + WINBASEAPI WINBOOL WINAPI GetDevicePowerState(HANDLE hDevice,WINBOOL *pfOn); + WINBASEAPI WINBOOL WINAPI SetMessageWaitingIndicator(HANDLE hMsgIndicator,ULONG ulMsgCount); + WINBASEAPI WINBOOL WINAPI SetEndOfFile(HANDLE hFile); + WINBASEAPI DWORD WINAPI SetFilePointer(HANDLE hFile,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); + WINBASEAPI WINBOOL WINAPI SetFilePointerEx(HANDLE hFile,LARGE_INTEGER liDistanceToMove,PLARGE_INTEGER lpNewFilePointer,DWORD dwMoveMethod); + WINBASEAPI WINBOOL WINAPI FindClose(HANDLE hFindFile); + WINBASEAPI WINBOOL WINAPI GetFileTime(HANDLE hFile,LPFILETIME lpCreationTime,LPFILETIME lpLastAccessTime,LPFILETIME lpLastWriteTime); + WINBASEAPI WINBOOL WINAPI SetFileTime(HANDLE hFile,CONST FILETIME *lpCreationTime,CONST FILETIME *lpLastAccessTime,CONST FILETIME *lpLastWriteTime); + WINBASEAPI WINBOOL WINAPI SetFileValidData(HANDLE hFile,LONGLONG ValidDataLength); + WINBASEAPI WINBOOL WINAPI SetFileShortNameA(HANDLE hFile,LPCSTR lpShortName); + WINBASEAPI WINBOOL WINAPI SetFileShortNameW(HANDLE hFile,LPCWSTR lpShortName); + WINBASEAPI WINBOOL WINAPI CloseHandle(HANDLE hObject); + WINBASEAPI WINBOOL WINAPI DuplicateHandle(HANDLE hSourceProcessHandle,HANDLE hSourceHandle,HANDLE hTargetProcessHandle,LPHANDLE lpTargetHandle,DWORD dwDesiredAccess,WINBOOL bInheritHandle,DWORD dwOptions); + WINBASEAPI WINBOOL WINAPI GetHandleInformation(HANDLE hObject,LPDWORD lpdwFlags); + WINBASEAPI WINBOOL WINAPI SetHandleInformation(HANDLE hObject,DWORD dwMask,DWORD dwFlags); + +#define HANDLE_FLAG_INHERIT 0x1 +#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x2 + +#define HINSTANCE_ERROR 32 + + WINBASEAPI DWORD WINAPI LoadModule(LPCSTR lpModuleName,LPVOID lpParameterBlock); + WINBASEAPI UINT WINAPI WinExec(LPCSTR lpCmdLine,UINT uCmdShow); + WINBASEAPI WINBOOL WINAPI ClearCommBreak(HANDLE hFile); + WINBASEAPI WINBOOL WINAPI ClearCommError(HANDLE hFile,LPDWORD lpErrors,LPCOMSTAT lpStat); + WINBASEAPI WINBOOL WINAPI SetupComm(HANDLE hFile,DWORD dwInQueue,DWORD dwOutQueue); + WINBASEAPI WINBOOL WINAPI EscapeCommFunction(HANDLE hFile,DWORD dwFunc); + WINBASEAPI WINBOOL WINAPI GetCommConfig(HANDLE hCommDev,LPCOMMCONFIG lpCC,LPDWORD lpdwSize); + WINBASEAPI WINBOOL WINAPI GetCommMask(HANDLE hFile,LPDWORD lpEvtMask); + WINBASEAPI WINBOOL WINAPI GetCommProperties(HANDLE hFile,LPCOMMPROP lpCommProp); + WINBASEAPI WINBOOL WINAPI GetCommModemStatus(HANDLE hFile,LPDWORD lpModemStat); + WINBASEAPI WINBOOL WINAPI GetCommState(HANDLE hFile,LPDCB lpDCB); + WINBASEAPI WINBOOL WINAPI GetCommTimeouts(HANDLE hFile,LPCOMMTIMEOUTS lpCommTimeouts); + WINBASEAPI WINBOOL WINAPI PurgeComm(HANDLE hFile,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI SetCommBreak(HANDLE hFile); + WINBASEAPI WINBOOL WINAPI SetCommConfig(HANDLE hCommDev,LPCOMMCONFIG lpCC,DWORD dwSize); + WINBASEAPI WINBOOL WINAPI SetCommMask(HANDLE hFile,DWORD dwEvtMask); + WINBASEAPI WINBOOL WINAPI SetCommState(HANDLE hFile,LPDCB lpDCB); + WINBASEAPI WINBOOL WINAPI SetCommTimeouts(HANDLE hFile,LPCOMMTIMEOUTS lpCommTimeouts); + WINBASEAPI WINBOOL WINAPI TransmitCommChar(HANDLE hFile,char cChar); + WINBASEAPI WINBOOL WINAPI WaitCommEvent(HANDLE hFile,LPDWORD lpEvtMask,LPOVERLAPPED lpOverlapped); + WINBASEAPI DWORD WINAPI SetTapePosition(HANDLE hDevice,DWORD dwPositionMethod,DWORD dwPartition,DWORD dwOffsetLow,DWORD dwOffsetHigh,WINBOOL bImmediate); + WINBASEAPI DWORD WINAPI GetTapePosition(HANDLE hDevice,DWORD dwPositionType,LPDWORD lpdwPartition,LPDWORD lpdwOffsetLow,LPDWORD lpdwOffsetHigh); + WINBASEAPI DWORD WINAPI PrepareTape(HANDLE hDevice,DWORD dwOperation,WINBOOL bImmediate); + WINBASEAPI DWORD WINAPI EraseTape(HANDLE hDevice,DWORD dwEraseType,WINBOOL bImmediate); + WINBASEAPI DWORD WINAPI CreateTapePartition(HANDLE hDevice,DWORD dwPartitionMethod,DWORD dwCount,DWORD dwSize); + WINBASEAPI DWORD WINAPI WriteTapemark(HANDLE hDevice,DWORD dwTapemarkType,DWORD dwTapemarkCount,WINBOOL bImmediate); + WINBASEAPI DWORD WINAPI GetTapeStatus(HANDLE hDevice); + WINBASEAPI DWORD WINAPI GetTapeParameters(HANDLE hDevice,DWORD dwOperation,LPDWORD lpdwSize,LPVOID lpTapeInformation); + +#define GET_TAPE_MEDIA_INFORMATION 0 +#define GET_TAPE_DRIVE_INFORMATION 1 + + WINBASEAPI DWORD WINAPI SetTapeParameters(HANDLE hDevice,DWORD dwOperation,LPVOID lpTapeInformation); + +#define SET_TAPE_MEDIA_INFORMATION 0 +#define SET_TAPE_DRIVE_INFORMATION 1 + + WINBASEAPI WINBOOL WINAPI Beep(DWORD dwFreq,DWORD dwDuration); + WINBASEAPI int WINAPI MulDiv(int nNumber,int nNumerator,int nDenominator); + WINBASEAPI VOID WINAPI GetSystemTime(LPSYSTEMTIME lpSystemTime); + WINBASEAPI VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime); + WINBASEAPI WINBOOL WINAPI SetSystemTime(CONST SYSTEMTIME *lpSystemTime); + WINBASEAPI VOID WINAPI GetLocalTime(LPSYSTEMTIME lpSystemTime); + WINBASEAPI WINBOOL WINAPI SetLocalTime(CONST SYSTEMTIME *lpSystemTime); + WINBASEAPI VOID WINAPI GetSystemInfo(LPSYSTEM_INFO lpSystemInfo); + WINBASEAPI WINBOOL WINAPI SetSystemFileCacheSize(SIZE_T MinimumFileCacheSize,SIZE_T MaximumFileCacheSize,DWORD Flags); + WINBASEAPI WINBOOL WINAPI GetSystemFileCacheSize(PSIZE_T lpMinimumFileCacheSize,PSIZE_T lpMaximumFileCacheSize,PDWORD lpFlags); + WINBASEAPI WINBOOL WINAPI GetSystemRegistryQuota(PDWORD pdwQuotaAllowed,PDWORD pdwQuotaUsed); + WINBOOL WINAPI GetSystemTimes(LPFILETIME lpIdleTime,LPFILETIME lpKernelTime,LPFILETIME lpUserTime); + WINBASEAPI VOID WINAPI GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo); + WINBASEAPI WINBOOL WINAPI IsProcessorFeaturePresent(DWORD ProcessorFeature); + + typedef struct _TIME_ZONE_INFORMATION { + LONG Bias; + WCHAR StandardName[32]; + SYSTEMTIME StandardDate; + LONG StandardBias; + WCHAR DaylightName[32]; + SYSTEMTIME DaylightDate; + LONG DaylightBias; + } TIME_ZONE_INFORMATION,*PTIME_ZONE_INFORMATION,*LPTIME_ZONE_INFORMATION; + +#ifdef UNICODE +#define FormatMessage FormatMessageW +#else +#define FormatMessage FormatMessageA +#endif + + WINBASEAPI WINBOOL WINAPI SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation,LPSYSTEMTIME lpUniversalTime,LPSYSTEMTIME lpLocalTime); + WINBASEAPI WINBOOL WINAPI TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation,LPSYSTEMTIME lpLocalTime,LPSYSTEMTIME lpUniversalTime); + WINBASEAPI DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation); + WINBASEAPI WINBOOL WINAPI SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation); + WINBASEAPI WINBOOL WINAPI SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime,LPFILETIME lpFileTime); + WINBASEAPI WINBOOL WINAPI FileTimeToLocalFileTime(CONST FILETIME *lpFileTime,LPFILETIME lpLocalFileTime); + WINBASEAPI WINBOOL WINAPI LocalFileTimeToFileTime(CONST FILETIME *lpLocalFileTime,LPFILETIME lpFileTime); + WINBASEAPI WINBOOL WINAPI FileTimeToSystemTime(CONST FILETIME *lpFileTime,LPSYSTEMTIME lpSystemTime); + WINBASEAPI LONG WINAPI CompareFileTime(CONST FILETIME *lpFileTime1,CONST FILETIME *lpFileTime2); + WINBASEAPI WINBOOL WINAPI FileTimeToDosDateTime(CONST FILETIME *lpFileTime,LPWORD lpFatDate,LPWORD lpFatTime); + WINBASEAPI WINBOOL WINAPI DosDateTimeToFileTime(WORD wFatDate,WORD wFatTime,LPFILETIME lpFileTime); + WINBASEAPI DWORD WINAPI GetTickCount(VOID); + WINBASEAPI WINBOOL WINAPI SetSystemTimeAdjustment(DWORD dwTimeAdjustment,WINBOOL bTimeAdjustmentDisabled); + WINBASEAPI WINBOOL WINAPI GetSystemTimeAdjustment(PDWORD lpTimeAdjustment,PDWORD lpTimeIncrement,PBOOL lpTimeAdjustmentDisabled); + WINBASEAPI DWORD WINAPI FormatMessageA(DWORD dwFlags,LPCVOID lpSource,DWORD dwMessageId,DWORD dwLanguageId,LPSTR lpBuffer,DWORD nSize,va_list *Arguments); + WINBASEAPI DWORD WINAPI FormatMessageW(DWORD dwFlags,LPCVOID lpSource,DWORD dwMessageId,DWORD dwLanguageId,LPWSTR lpBuffer,DWORD nSize,va_list *Arguments); + +#define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x100 +#define FORMAT_MESSAGE_IGNORE_INSERTS 0x200 +#define FORMAT_MESSAGE_FROM_STRING 0x400 +#define FORMAT_MESSAGE_FROM_HMODULE 0x800 +#define FORMAT_MESSAGE_FROM_SYSTEM 0x1000 +#define FORMAT_MESSAGE_ARGUMENT_ARRAY 0x2000 +#define FORMAT_MESSAGE_MAX_WIDTH_MASK 0xff + +#ifdef UNICODE +#define CreateMailslot CreateMailslotW +#define EncryptFile EncryptFileW +#define DecryptFile DecryptFileW +#define FileEncryptionStatus FileEncryptionStatusW +#else +#define CreateMailslot CreateMailslotA +#define EncryptFile EncryptFileA +#define DecryptFile DecryptFileA +#define FileEncryptionStatus FileEncryptionStatusA +#endif + + WINBASEAPI WINBOOL WINAPI CreatePipe(PHANDLE hReadPipe,PHANDLE hWritePipe,LPSECURITY_ATTRIBUTES lpPipeAttributes,DWORD nSize); + WINBASEAPI WINBOOL WINAPI ConnectNamedPipe(HANDLE hNamedPipe,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI DisconnectNamedPipe(HANDLE hNamedPipe); + WINBASEAPI WINBOOL WINAPI SetNamedPipeHandleState(HANDLE hNamedPipe,LPDWORD lpMode,LPDWORD lpMaxCollectionCount,LPDWORD lpCollectDataTimeout); + WINBASEAPI WINBOOL WINAPI GetNamedPipeInfo(HANDLE hNamedPipe,LPDWORD lpFlags,LPDWORD lpOutBufferSize,LPDWORD lpInBufferSize,LPDWORD lpMaxInstances); + WINBASEAPI WINBOOL WINAPI PeekNamedPipe(HANDLE hNamedPipe,LPVOID lpBuffer,DWORD nBufferSize,LPDWORD lpBytesRead,LPDWORD lpTotalBytesAvail,LPDWORD lpBytesLeftThisMessage); + WINBASEAPI WINBOOL WINAPI TransactNamedPipe(HANDLE hNamedPipe,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesRead,LPOVERLAPPED lpOverlapped); + WINBASEAPI HANDLE WINAPI CreateMailslotA(LPCSTR lpName,DWORD nMaxMessageSize,DWORD lReadTimeout,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI HANDLE WINAPI CreateMailslotW(LPCWSTR lpName,DWORD nMaxMessageSize,DWORD lReadTimeout,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI GetMailslotInfo(HANDLE hMailslot,LPDWORD lpMaxMessageSize,LPDWORD lpNextSize,LPDWORD lpMessageCount,LPDWORD lpReadTimeout); + WINBASEAPI WINBOOL WINAPI SetMailslotInfo(HANDLE hMailslot,DWORD lReadTimeout); + WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE hFileMappingObject,DWORD dwDesiredAccess,DWORD dwFileOffsetHigh,DWORD dwFileOffsetLow,SIZE_T dwNumberOfBytesToMap); + WINBASEAPI WINBOOL WINAPI FlushViewOfFile(LPCVOID lpBaseAddress,SIZE_T dwNumberOfBytesToFlush); + WINBASEAPI WINBOOL WINAPI UnmapViewOfFile(LPCVOID lpBaseAddress); + WINADVAPI WINBOOL WINAPI EncryptFileA(LPCSTR lpFileName); + WINADVAPI WINBOOL WINAPI EncryptFileW(LPCWSTR lpFileName); + WINADVAPI WINBOOL WINAPI DecryptFileA(LPCSTR lpFileName,DWORD dwReserved); + WINADVAPI WINBOOL WINAPI DecryptFileW(LPCWSTR lpFileName,DWORD dwReserved); + +#define FILE_ENCRYPTABLE 0 +#define FILE_IS_ENCRYPTED 1 +#define FILE_SYSTEM_ATTR 2 +#define FILE_ROOT_DIR 3 +#define FILE_SYSTEM_DIR 4 +#define FILE_UNKNOWN 5 +#define FILE_SYSTEM_NOT_SUPPORT 6 +#define FILE_USER_DISALLOWED 7 +#define FILE_READ_ONLY 8 +#define FILE_DIR_DISALLOWED 9 + + WINADVAPI WINBOOL WINAPI FileEncryptionStatusA(LPCSTR lpFileName,LPDWORD lpStatus); + WINADVAPI WINBOOL WINAPI FileEncryptionStatusW(LPCWSTR lpFileName,LPDWORD lpStatus); + +#define EFS_USE_RECOVERY_KEYS (0x1) + + typedef DWORD (WINAPI *PFE_EXPORT_FUNC)(PBYTE pbData,PVOID pvCallbackContext,ULONG ulLength); + typedef DWORD (WINAPI *PFE_IMPORT_FUNC)(PBYTE pbData,PVOID pvCallbackContext,PULONG ulLength); + +#define CREATE_FOR_IMPORT (1) +#define CREATE_FOR_DIR (2) +#define OVERWRITE_HIDDEN (4) + +#ifdef UNICODE +#define OpenEncryptedFileRaw OpenEncryptedFileRawW +#define lstrcmp lstrcmpW +#define lstrcmpi lstrcmpiW +#define lstrcpyn lstrcpynW +#define lstrcpy lstrcpyW +#define lstrcat lstrcatW +#define lstrlen lstrlenW +#else +#define OpenEncryptedFileRaw OpenEncryptedFileRawA +#define lstrcmp lstrcmpA +#define lstrcmpi lstrcmpiA +#define lstrcpyn lstrcpynA +#define lstrcpy lstrcpyA +#define lstrcat lstrcatA +#define lstrlen lstrlenA +#endif + + WINADVAPI DWORD WINAPI OpenEncryptedFileRawA(LPCSTR lpFileName,ULONG ulFlags,PVOID *pvContext); + WINADVAPI DWORD WINAPI OpenEncryptedFileRawW(LPCWSTR lpFileName,ULONG ulFlags,PVOID *pvContext); + WINADVAPI DWORD WINAPI ReadEncryptedFileRaw(PFE_EXPORT_FUNC pfExportCallback,PVOID pvCallbackContext,PVOID pvContext); + WINADVAPI DWORD WINAPI WriteEncryptedFileRaw(PFE_IMPORT_FUNC pfImportCallback,PVOID pvCallbackContext,PVOID pvContext); + WINADVAPI VOID WINAPI CloseEncryptedFileRaw(PVOID pvContext); + WINBASEAPI int WINAPI lstrcmpA(LPCSTR lpString1,LPCSTR lpString2); + WINBASEAPI int WINAPI lstrcmpW(LPCWSTR lpString1,LPCWSTR lpString2); + WINBASEAPI int WINAPI lstrcmpiA(LPCSTR lpString1,LPCSTR lpString2); + WINBASEAPI int WINAPI lstrcmpiW(LPCWSTR lpString1,LPCWSTR lpString2); + WINBASEAPI LPSTR WINAPI lstrcpynA(LPSTR lpString1,LPCSTR lpString2,int iMaxLength); + WINBASEAPI LPWSTR WINAPI lstrcpynW(LPWSTR lpString1,LPCWSTR lpString2,int iMaxLength); + WINBASEAPI LPSTR WINAPI lstrcpyA(LPSTR lpString1,LPCSTR lpString2); + WINBASEAPI LPWSTR WINAPI lstrcpyW(LPWSTR lpString1,LPCWSTR lpString2); + WINBASEAPI LPSTR WINAPI lstrcatA(LPSTR lpString1,LPCSTR lpString2); + WINBASEAPI LPWSTR WINAPI lstrcatW(LPWSTR lpString1,LPCWSTR lpString2); + WINBASEAPI int WINAPI lstrlenA(LPCSTR lpString); + WINBASEAPI int WINAPI lstrlenW(LPCWSTR lpString); + WINBASEAPI HFILE WINAPI OpenFile(LPCSTR lpFileName,LPOFSTRUCT lpReOpenBuff,UINT uStyle); + WINBASEAPI HFILE WINAPI _lopen(LPCSTR lpPathName,int iReadWrite); + WINBASEAPI HFILE WINAPI _lcreat(LPCSTR lpPathName,int iAttribute); + WINBASEAPI UINT WINAPI _lread(HFILE hFile,LPVOID lpBuffer,UINT uBytes); + WINBASEAPI UINT WINAPI _lwrite(HFILE hFile,LPCCH lpBuffer,UINT uBytes); + WINBASEAPI long WINAPI _hread(HFILE hFile,LPVOID lpBuffer,long lBytes); + WINBASEAPI long WINAPI _hwrite(HFILE hFile,LPCCH lpBuffer,long lBytes); + WINBASEAPI HFILE WINAPI _lclose(HFILE hFile); + WINBASEAPI LONG WINAPI _llseek(HFILE hFile,LONG lOffset,int iOrigin); + WINADVAPI WINBOOL WINAPI IsTextUnicode(CONST VOID *lpv,int iSize,LPINT lpiResult); + +#define FLS_OUT_OF_INDEXES ((DWORD)0xffffffff) + + WINBASEAPI DWORD WINAPI FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback); + WINBASEAPI PVOID WINAPI FlsGetValue(DWORD dwFlsIndex); + WINBASEAPI WINBOOL WINAPI FlsSetValue(DWORD dwFlsIndex,PVOID lpFlsData); + WINBASEAPI WINBOOL WINAPI FlsFree(DWORD dwFlsIndex); + +#define TLS_OUT_OF_INDEXES ((DWORD)0xffffffff) + + WINBASEAPI DWORD WINAPI TlsAlloc(VOID); + WINBASEAPI LPVOID WINAPI TlsGetValue(DWORD dwTlsIndex); + WINBASEAPI WINBOOL WINAPI TlsSetValue(DWORD dwTlsIndex,LPVOID lpTlsValue); + WINBASEAPI WINBOOL WINAPI TlsFree(DWORD dwTlsIndex); + + typedef VOID (WINAPI *LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode,DWORD dwNumberOfBytesTransfered,LPOVERLAPPED lpOverlapped); + + WINBASEAPI DWORD WINAPI SleepEx(DWORD dwMilliseconds,WINBOOL bAlertable); + WINBASEAPI DWORD WINAPI WaitForSingleObjectEx(HANDLE hHandle,DWORD dwMilliseconds,WINBOOL bAlertable); + WINBASEAPI DWORD WINAPI WaitForMultipleObjectsEx(DWORD nCount,CONST HANDLE *lpHandles,WINBOOL bWaitAll,DWORD dwMilliseconds,WINBOOL bAlertable); + WINBASEAPI DWORD WINAPI SignalObjectAndWait(HANDLE hObjectToSignal,HANDLE hObjectToWaitOn,DWORD dwMilliseconds,WINBOOL bAlertable); + WINBASEAPI WINBOOL WINAPI ReadFileEx(HANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPOVERLAPPED lpOverlapped,LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); + WINBASEAPI WINBOOL WINAPI WriteFileEx(HANDLE hFile,LPCVOID lpBuffer,DWORD nNumberOfBytesToWrite,LPOVERLAPPED lpOverlapped,LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); + WINBASEAPI WINBOOL WINAPI BackupRead(HANDLE hFile,LPBYTE lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,WINBOOL bAbort,WINBOOL bProcessSecurity,LPVOID *lpContext); + WINBASEAPI WINBOOL WINAPI BackupSeek(HANDLE hFile,DWORD dwLowBytesToSeek,DWORD dwHighBytesToSeek,LPDWORD lpdwLowByteSeeked,LPDWORD lpdwHighByteSeeked,LPVOID *lpContext); + WINBASEAPI WINBOOL WINAPI BackupWrite(HANDLE hFile,LPBYTE lpBuffer,DWORD nNumberOfBytesToWrite,LPDWORD lpNumberOfBytesWritten,WINBOOL bAbort,WINBOOL bProcessSecurity,LPVOID *lpContext); + + typedef struct _WIN32_STREAM_ID { + DWORD dwStreamId; + DWORD dwStreamAttributes; + LARGE_INTEGER Size; + DWORD dwStreamNameSize; + WCHAR cStreamName[ANYSIZE_ARRAY]; + } WIN32_STREAM_ID,*LPWIN32_STREAM_ID; + +#define BACKUP_INVALID 0x0 +#define BACKUP_DATA 0x1 +#define BACKUP_EA_DATA 0x2 +#define BACKUP_SECURITY_DATA 0x3 +#define BACKUP_ALTERNATE_DATA 0x4 +#define BACKUP_LINK 0x5 +#define BACKUP_PROPERTY_DATA 0x6 +#define BACKUP_OBJECT_ID 0x7 +#define BACKUP_REPARSE_DATA 0x8 +#define BACKUP_SPARSE_BLOCK 0x9 + +#define STREAM_NORMAL_ATTRIBUTE 0x0 +#define STREAM_MODIFIED_WHEN_READ 0x1 +#define STREAM_CONTAINS_SECURITY 0x2 +#define STREAM_CONTAINS_PROPERTIES 0x4 +#define STREAM_SPARSE_ATTRIBUTE 0x8 + + WINBASEAPI WINBOOL WINAPI ReadFileScatter(HANDLE hFile,FILE_SEGMENT_ELEMENT aSegmentArray[],DWORD nNumberOfBytesToRead,LPDWORD lpReserved,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI WriteFileGather(HANDLE hFile,FILE_SEGMENT_ELEMENT aSegmentArray[],DWORD nNumberOfBytesToWrite,LPDWORD lpReserved,LPOVERLAPPED lpOverlapped); + +#define STARTF_USESHOWWINDOW 0x1 +#define STARTF_USESIZE 0x2 +#define STARTF_USEPOSITION 0x4 +#define STARTF_USECOUNTCHARS 0x8 +#define STARTF_USEFILLATTRIBUTE 0x10 +#define STARTF_RUNFULLSCREEN 0x20 +#define STARTF_FORCEONFEEDBACK 0x40 +#define STARTF_FORCEOFFFEEDBACK 0x80 +#define STARTF_USESTDHANDLES 0x100 + +#define STARTF_USEHOTKEY 0x200 + + typedef struct _STARTUPINFOA { + DWORD cb; + LPSTR lpReserved; + LPSTR lpDesktop; + LPSTR lpTitle; + DWORD dwX; + DWORD dwY; + DWORD dwXSize; + DWORD dwYSize; + DWORD dwXCountChars; + DWORD dwYCountChars; + DWORD dwFillAttribute; + DWORD dwFlags; + WORD wShowWindow; + WORD cbReserved2; + LPBYTE lpReserved2; + HANDLE hStdInput; + HANDLE hStdOutput; + HANDLE hStdError; + } STARTUPINFOA,*LPSTARTUPINFOA; + + typedef struct _STARTUPINFOW { + DWORD cb; + LPWSTR lpReserved; + LPWSTR lpDesktop; + LPWSTR lpTitle; + DWORD dwX; + DWORD dwY; + DWORD dwXSize; + DWORD dwYSize; + DWORD dwXCountChars; + DWORD dwYCountChars; + DWORD dwFillAttribute; + DWORD dwFlags; + WORD wShowWindow; + WORD cbReserved2; + LPBYTE lpReserved2; + HANDLE hStdInput; + HANDLE hStdOutput; + HANDLE hStdError; + } STARTUPINFOW,*LPSTARTUPINFOW; + +#ifdef UNICODE + typedef STARTUPINFOW STARTUPINFO; + typedef LPSTARTUPINFOW LPSTARTUPINFO; +#else + typedef STARTUPINFOA STARTUPINFO; + typedef LPSTARTUPINFOA LPSTARTUPINFO; +#endif + +#define SHUTDOWN_NORETRY 0x1 + + typedef struct _WIN32_FIND_DATAA { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD dwReserved0; + DWORD dwReserved1; + CHAR cFileName[MAX_PATH]; + CHAR cAlternateFileName[14]; + } WIN32_FIND_DATAA,*PWIN32_FIND_DATAA,*LPWIN32_FIND_DATAA; + + typedef struct _WIN32_FIND_DATAW { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD dwReserved0; + DWORD dwReserved1; + WCHAR cFileName[MAX_PATH]; + WCHAR cAlternateFileName[14]; + } WIN32_FIND_DATAW,*PWIN32_FIND_DATAW,*LPWIN32_FIND_DATAW; + +#ifdef UNICODE + typedef WIN32_FIND_DATAW WIN32_FIND_DATA; + typedef PWIN32_FIND_DATAW PWIN32_FIND_DATA; + typedef LPWIN32_FIND_DATAW LPWIN32_FIND_DATA; +#else + typedef WIN32_FIND_DATAA WIN32_FIND_DATA; + typedef PWIN32_FIND_DATAA PWIN32_FIND_DATA; + typedef LPWIN32_FIND_DATAA LPWIN32_FIND_DATA; +#endif + + typedef struct _WIN32_FILE_ATTRIBUTE_DATA { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + } WIN32_FILE_ATTRIBUTE_DATA,*LPWIN32_FILE_ATTRIBUTE_DATA; + +#ifdef UNICODE +#define CreateMutex CreateMutexW +#define OpenMutex OpenMutexW +#define CreateEvent CreateEventW +#define OpenEvent OpenEventW +#define CreateSemaphore CreateSemaphoreW +#define OpenSemaphore OpenSemaphoreW +#else +#define CreateMutex CreateMutexA +#define OpenMutex OpenMutexA +#define CreateEvent CreateEventA +#define OpenEvent OpenEventA +#define CreateSemaphore CreateSemaphoreA +#define OpenSemaphore OpenSemaphoreA +#endif + + WINBASEAPI HANDLE WINAPI CreateMutexA(LPSECURITY_ATTRIBUTES lpMutexAttributes,WINBOOL bInitialOwner,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateMutexW(LPSECURITY_ATTRIBUTES lpMutexAttributes,WINBOOL bInitialOwner,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenMutexA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenMutexW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes,WINBOOL bManualReset,WINBOOL bInitialState,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes,WINBOOL bManualReset,WINBOOL bInitialState,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenEventA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenEventW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,LONG lInitialCount,LONG lMaximumCount,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,LONG lInitialCount,LONG lMaximumCount,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenSemaphoreA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenSemaphoreW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + + typedef VOID (WINAPI *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue); + +#ifdef UNICODE +#define CreateWaitableTimer CreateWaitableTimerW +#define OpenWaitableTimer OpenWaitableTimerW +#define CreateFileMapping CreateFileMappingW +#define OpenFileMapping OpenFileMappingW +#define GetLogicalDriveStrings GetLogicalDriveStringsW +#define LoadLibrary LoadLibraryW +#define LoadLibraryEx LoadLibraryExW +#define GetModuleFileName GetModuleFileNameW +#define GetModuleHandle GetModuleHandleW +#else +#define CreateWaitableTimer CreateWaitableTimerA +#define OpenWaitableTimer OpenWaitableTimerA +#define CreateFileMapping CreateFileMappingA +#define OpenFileMapping OpenFileMappingA +#define GetLogicalDriveStrings GetLogicalDriveStringsA +#define LoadLibrary LoadLibraryA +#define LoadLibraryEx LoadLibraryExA +#define GetModuleFileName GetModuleFileNameA +#define GetModuleHandle GetModuleHandleA +#endif + + WINBASEAPI HANDLE WINAPI CreateWaitableTimerA(LPSECURITY_ATTRIBUTES lpTimerAttributes,WINBOOL bManualReset,LPCSTR lpTimerName); + WINBASEAPI HANDLE WINAPI CreateWaitableTimerW(LPSECURITY_ATTRIBUTES lpTimerAttributes,WINBOOL bManualReset,LPCWSTR lpTimerName); + WINBASEAPI HANDLE WINAPI OpenWaitableTimerA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpTimerName); + WINBASEAPI HANDLE WINAPI OpenWaitableTimerW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpTimerName); + WINBASEAPI WINBOOL WINAPI SetWaitableTimer(HANDLE hTimer,const LARGE_INTEGER *lpDueTime,LONG lPeriod,PTIMERAPCROUTINE pfnCompletionRoutine,LPVOID lpArgToCompletionRoutine,WINBOOL fResume); + WINBASEAPI WINBOOL WINAPI CancelWaitableTimer(HANDLE hTimer); + WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE hFile,LPSECURITY_ATTRIBUTES lpFileMappingAttributes,DWORD flProtect,DWORD dwMaximumSizeHigh,DWORD dwMaximumSizeLow,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE hFile,LPSECURITY_ATTRIBUTES lpFileMappingAttributes,DWORD flProtect,DWORD dwMaximumSizeHigh,DWORD dwMaximumSizeLow,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenFileMappingA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenFileMappingW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + WINBASEAPI DWORD WINAPI GetLogicalDriveStringsA(DWORD nBufferLength,LPSTR lpBuffer); + WINBASEAPI DWORD WINAPI GetLogicalDriveStringsW(DWORD nBufferLength,LPWSTR lpBuffer); + + typedef enum _MEMORY_RESOURCE_NOTIFICATION_TYPE { + LowMemoryResourceNotification,HighMemoryResourceNotification + } MEMORY_RESOURCE_NOTIFICATION_TYPE; + + WINBASEAPI HANDLE WINAPI CreateMemoryResourceNotification(MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType); + WINBASEAPI WINBOOL WINAPI QueryMemoryResourceNotification(HANDLE ResourceNotificationHandle,PBOOL ResourceState); + WINBASEAPI HMODULE WINAPI LoadLibraryA(LPCSTR lpLibFileName); + WINBASEAPI HMODULE WINAPI LoadLibraryW(LPCWSTR lpLibFileName); + WINBASEAPI HMODULE WINAPI LoadLibraryExA(LPCSTR lpLibFileName,HANDLE hFile,DWORD dwFlags); + WINBASEAPI HMODULE WINAPI LoadLibraryExW(LPCWSTR lpLibFileName,HANDLE hFile,DWORD dwFlags); + +#define DONT_RESOLVE_DLL_REFERENCES 0x1 +#define LOAD_LIBRARY_AS_DATAFILE 0x2 +#define LOAD_WITH_ALTERED_SEARCH_PATH 0x8 +#define LOAD_IGNORE_CODE_AUTHZ_LEVEL 0x10 +#define LOAD_LINRARY_AS_IMAGE_RESOURCE 0x20 +#define LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE 0x40 + + WINBASEAPI DWORD WINAPI GetModuleFileNameA(HMODULE hModule,LPCH lpFilename,DWORD nSize); + WINBASEAPI DWORD WINAPI GetModuleFileNameW(HMODULE hModule,LPWCH lpFilename,DWORD nSize); + WINBASEAPI HMODULE WINAPI GetModuleHandleA(LPCSTR lpModuleName); + WINBASEAPI HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName); + +#ifndef RC_INVOKED +#define GET_MODULE_HANDLE_EX_FLAG_PIN (0x1) +#define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT (0x2) +#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS (0x4) + + typedef WINBOOL (WINAPI *PGET_MODULE_HANDLE_EXA)(DWORD dwFlags,LPCSTR lpModuleName,HMODULE *phModule); + typedef WINBOOL (WINAPI *PGET_MODULE_HANDLE_EXW)(DWORD dwFlags,LPCWSTR lpModuleName,HMODULE *phModule); + +#ifdef UNICODE +#define PGET_MODULE_HANDLE_EX PGET_MODULE_HANDLE_EXW +#define GetModuleHandleEx GetModuleHandleExW +#else +#define PGET_MODULE_HANDLE_EX PGET_MODULE_HANDLE_EXA +#define GetModuleHandleEx GetModuleHandleExA +#endif + + WINBASEAPI WINBOOL WINAPI GetModuleHandleExA(DWORD dwFlags,LPCSTR lpModuleName,HMODULE *phModule); + WINBASEAPI WINBOOL WINAPI GetModuleHandleExW(DWORD dwFlags,LPCWSTR lpModuleName,HMODULE *phModule); +#endif + +#ifdef UNICODE +#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW +#define CreateProcess CreateProcessW +#define FatalAppExit FatalAppExitW +#define GetStartupInfo GetStartupInfoW +#define GetCommandLine GetCommandLineW +#define GetEnvironmentVariable GetEnvironmentVariableW +#define SetEnvironmentVariable SetEnvironmentVariableW +#define ExpandEnvironmentStrings ExpandEnvironmentStringsW +#define GetFirmwareEnvironmentVariable GetFirmwareEnvironmentVariableW +#define SetFirmwareEnvironmentVariable SetFirmwareEnvironmentVariableW +#define OutputDebugString OutputDebugStringW +#define FindResource FindResourceW +#define FindResourceEx FindResourceExW +#else +#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA +#define CreateProcess CreateProcessA +#define FatalAppExit FatalAppExitA +#define GetStartupInfo GetStartupInfoA +#define GetCommandLine GetCommandLineA +#define GetEnvironmentVariable GetEnvironmentVariableA +#define SetEnvironmentVariable SetEnvironmentVariableA +#define ExpandEnvironmentStrings ExpandEnvironmentStringsA +#define GetFirmwareEnvironmentVariable GetFirmwareEnvironmentVariableA +#define SetFirmwareEnvironmentVariable SetFirmwareEnvironmentVariableA +#define OutputDebugString OutputDebugStringA +#define FindResource FindResourceA +#define FindResourceEx FindResourceExA +#endif + + WINBASEAPI WINBOOL WINAPI NeedCurrentDirectoryForExePathA(LPCSTR ExeName); + WINBASEAPI WINBOOL WINAPI NeedCurrentDirectoryForExePathW(LPCWSTR ExeName); + WINBASEAPI WINBOOL WINAPI CreateProcessA(LPCSTR lpApplicationName,LPSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCSTR lpCurrentDirectory,LPSTARTUPINFOA lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINBASEAPI WINBOOL WINAPI CreateProcessW(LPCWSTR lpApplicationName,LPWSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINBASEAPI DWORD WINAPI AddLocalAlternateComputerNameA(LPCSTR lpDnsFQHostname,ULONG ulFlags); + WINBASEAPI DWORD WINAPI AddLocalAlternateComputerNameW(LPCWSTR lpDnsFQHostname,ULONG ulFlags); + WINBASEAPI WINBOOL WINAPI SetProcessShutdownParameters(DWORD dwLevel,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI GetProcessShutdownParameters(LPDWORD lpdwLevel,LPDWORD lpdwFlags); + WINBASEAPI DWORD WINAPI GetProcessVersion(DWORD ProcessId); + WINBASEAPI VOID WINAPI FatalAppExitA(UINT uAction,LPCSTR lpMessageText); + WINBASEAPI VOID WINAPI FatalAppExitW(UINT uAction,LPCWSTR lpMessageText); + WINBASEAPI VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo); + WINBASEAPI VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo); + WINBASEAPI LPSTR WINAPI GetCommandLineA(VOID); + WINBASEAPI LPWSTR WINAPI GetCommandLineW(VOID); + WINBASEAPI DWORD WINAPI GetEnvironmentVariableA(LPCSTR lpName,LPSTR lpBuffer,DWORD nSize); + WINBASEAPI DWORD WINAPI GetEnvironmentVariableW(LPCWSTR lpName,LPWSTR lpBuffer,DWORD nSize); + WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableA(LPCSTR lpName,LPCSTR lpValue); + WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableW(LPCWSTR lpName,LPCWSTR lpValue); + WINBASEAPI DWORD WINAPI ExpandEnvironmentStringsA(LPCSTR lpSrc,LPSTR lpDst,DWORD nSize); + WINBASEAPI DWORD WINAPI ExpandEnvironmentStringsW(LPCWSTR lpSrc,LPWSTR lpDst,DWORD nSize); + WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR lpName,LPCSTR lpGuid,PVOID pBuffer,DWORD nSize); + WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR lpName,LPCWSTR lpGuid,PVOID pBuffer,DWORD nSize); + WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableA(LPCSTR lpName,LPCSTR lpGuid,PVOID pValue,DWORD nSize); + WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableW(LPCWSTR lpName,LPCWSTR lpGuid,PVOID pValue,DWORD nSize); + WINBASEAPI VOID WINAPI OutputDebugStringA(LPCSTR lpOutputString); + WINBASEAPI VOID WINAPI OutputDebugStringW(LPCWSTR lpOutputString); + WINBASEAPI HRSRC WINAPI FindResourceA(HMODULE hModule,LPCSTR lpName,LPCSTR lpType); + WINBASEAPI HRSRC WINAPI FindResourceW(HMODULE hModule,LPCWSTR lpName,LPCWSTR lpType); + WINBASEAPI HRSRC WINAPI FindResourceExA(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,WORD wLanguage); + WINBASEAPI HRSRC WINAPI FindResourceExW(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,WORD wLanguage); + +#ifdef UNICODE +#define ENUMRESTYPEPROC ENUMRESTYPEPROCW +#define ENUMRESNAMEPROC ENUMRESNAMEPROCW +#define ENUMRESLANGPROC ENUMRESLANGPROCW +#define EnumResourceTypes EnumResourceTypesW +#define EnumResourceNames EnumResourceNamesW +#define EnumResourceLanguages EnumResourceLanguagesW +#define BeginUpdateResource BeginUpdateResourceW +#define UpdateResource UpdateResourceW +#define EndUpdateResource EndUpdateResourceW +#define GlobalAddAtom GlobalAddAtomW +#define GlobalFindAtom GlobalFindAtomW +#define GlobalGetAtomName GlobalGetAtomNameW +#define AddAtom AddAtomW +#define FindAtom FindAtomW +#define GetAtomName GetAtomNameW +#define GetProfileInt GetProfileIntW +#define GetProfileString GetProfileStringW +#define WriteProfileString WriteProfileStringW +#define GetProfileSection GetProfileSectionW +#define WriteProfileSection WriteProfileSectionW +#define GetPrivateProfileInt GetPrivateProfileIntW +#define GetPrivateProfileString GetPrivateProfileStringW +#define WritePrivateProfileString WritePrivateProfileStringW +#define GetPrivateProfileSection GetPrivateProfileSectionW +#define WritePrivateProfileSection WritePrivateProfileSectionW +#define GetPrivateProfileSectionNames GetPrivateProfileSectionNamesW +#define GetPrivateProfileStruct GetPrivateProfileStructW +#define WritePrivateProfileStruct WritePrivateProfileStructW +#define GetDriveType GetDriveTypeW +#define GetSystemDirectory GetSystemDirectoryW +#define GetTempPath GetTempPathW +#define GetTempFileName GetTempFileNameW +#define GetWindowsDirectory GetWindowsDirectoryW +#define GetSystemWindowsDirectory GetSystemWindowsDirectoryW +#define AddLocalAlternateComputerName AddLocalAlternateComputerNameW +#else +#define ENUMRESTYPEPROC ENUMRESTYPEPROCA +#define ENUMRESNAMEPROC ENUMRESNAMEPROCA +#define ENUMRESLANGPROC ENUMRESLANGPROCA +#define EnumResourceTypes EnumResourceTypesA +#define EnumResourceNames EnumResourceNamesA +#define EnumResourceLanguages EnumResourceLanguagesA +#define BeginUpdateResource BeginUpdateResourceA +#define UpdateResource UpdateResourceA +#define EndUpdateResource EndUpdateResourceA +#define GlobalAddAtom GlobalAddAtomA +#define GlobalFindAtom GlobalFindAtomA +#define GlobalGetAtomName GlobalGetAtomNameA +#define AddAtom AddAtomA +#define FindAtom FindAtomA +#define GetAtomName GetAtomNameA +#define GetProfileInt GetProfileIntA +#define GetProfileString GetProfileStringA +#define WriteProfileString WriteProfileStringA +#define GetProfileSection GetProfileSectionA +#define WriteProfileSection WriteProfileSectionA +#define GetPrivateProfileInt GetPrivateProfileIntA +#define GetPrivateProfileString GetPrivateProfileStringA +#define WritePrivateProfileString WritePrivateProfileStringA +#define GetPrivateProfileSection GetPrivateProfileSectionA +#define WritePrivateProfileSection WritePrivateProfileSectionA +#define GetPrivateProfileSectionNames GetPrivateProfileSectionNamesA +#define GetPrivateProfileStruct GetPrivateProfileStructA +#define WritePrivateProfileStruct WritePrivateProfileStructA +#define GetDriveType GetDriveTypeA +#define GetSystemDirectory GetSystemDirectoryA +#define GetTempPath GetTempPathA +#define GetTempFileName GetTempFileNameA +#define GetWindowsDirectory GetWindowsDirectoryA +#define GetSystemWindowsDirectory GetSystemWindowsDirectoryA +#define AddLocalAlternateComputerName AddLocalAlternateComputerNameA +#endif + + typedef WINBOOL (CALLBACK *ENUMRESTYPEPROCA)(HMODULE hModule,LPSTR lpType,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESTYPEPROCW)(HMODULE hModule,LPWSTR lpType,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESNAMEPROCA)(HMODULE hModule,LPCSTR lpType,LPSTR lpName,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESNAMEPROCW)(HMODULE hModule,LPCWSTR lpType,LPWSTR lpName,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESLANGPROCA)(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,WORD wLanguage,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESLANGPROCW)(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,WORD wLanguage,LONG_PTR lParam); + + WINBASEAPI WINBOOL WINAPI EnumResourceTypesA(HMODULE hModule,ENUMRESTYPEPROCA lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceTypesW(HMODULE hModule,ENUMRESTYPEPROCW lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceNamesA(HMODULE hModule,LPCSTR lpType,ENUMRESNAMEPROCA lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceNamesW(HMODULE hModule,LPCWSTR lpType,ENUMRESNAMEPROCW lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesA(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,ENUMRESLANGPROCA lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesW(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,ENUMRESLANGPROCW lpEnumFunc,LONG_PTR lParam); + WINBASEAPI HANDLE WINAPI BeginUpdateResourceA(LPCSTR pFileName,WINBOOL bDeleteExistingResources); + WINBASEAPI HANDLE WINAPI BeginUpdateResourceW(LPCWSTR pFileName,WINBOOL bDeleteExistingResources); + WINBASEAPI WINBOOL WINAPI UpdateResourceA(HANDLE hUpdate,LPCSTR lpType,LPCSTR lpName,WORD wLanguage,LPVOID lpData,DWORD cb); + WINBASEAPI WINBOOL WINAPI UpdateResourceW(HANDLE hUpdate,LPCWSTR lpType,LPCWSTR lpName,WORD wLanguage,LPVOID lpData,DWORD cb); + WINBASEAPI WINBOOL WINAPI EndUpdateResourceA(HANDLE hUpdate,WINBOOL fDiscard); + WINBASEAPI WINBOOL WINAPI EndUpdateResourceW(HANDLE hUpdate,WINBOOL fDiscard); + WINBASEAPI ATOM WINAPI GlobalAddAtomA(LPCSTR lpString); + WINBASEAPI ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString); + WINBASEAPI ATOM WINAPI GlobalFindAtomA(LPCSTR lpString); + WINBASEAPI ATOM WINAPI GlobalFindAtomW(LPCWSTR lpString); + WINBASEAPI UINT WINAPI GlobalGetAtomNameA(ATOM nAtom,LPSTR lpBuffer,int nSize); + WINBASEAPI UINT WINAPI GlobalGetAtomNameW(ATOM nAtom,LPWSTR lpBuffer,int nSize); + WINBASEAPI ATOM WINAPI AddAtomA(LPCSTR lpString); + WINBASEAPI ATOM WINAPI AddAtomW(LPCWSTR lpString); + WINBASEAPI ATOM WINAPI FindAtomA(LPCSTR lpString); + WINBASEAPI ATOM WINAPI FindAtomW(LPCWSTR lpString); + WINBASEAPI UINT WINAPI GetAtomNameA(ATOM nAtom,LPSTR lpBuffer,int nSize); + WINBASEAPI UINT WINAPI GetAtomNameW(ATOM nAtom,LPWSTR lpBuffer,int nSize); + WINBASEAPI UINT WINAPI GetProfileIntA(LPCSTR lpAppName,LPCSTR lpKeyName,INT nDefault); + WINBASEAPI UINT WINAPI GetProfileIntW(LPCWSTR lpAppName,LPCWSTR lpKeyName,INT nDefault); + WINBASEAPI DWORD WINAPI GetProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault,LPSTR lpReturnedString,DWORD nSize); + WINBASEAPI DWORD WINAPI GetProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpDefault,LPWSTR lpReturnedString,DWORD nSize); + WINBASEAPI WINBOOL WINAPI WriteProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpString); + WINBASEAPI WINBOOL WINAPI WriteProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString); + WINBASEAPI DWORD WINAPI GetProfileSectionA(LPCSTR lpAppName,LPSTR lpReturnedString,DWORD nSize); + WINBASEAPI DWORD WINAPI GetProfileSectionW(LPCWSTR lpAppName,LPWSTR lpReturnedString,DWORD nSize); + WINBASEAPI WINBOOL WINAPI WriteProfileSectionA(LPCSTR lpAppName,LPCSTR lpString); + WINBASEAPI WINBOOL WINAPI WriteProfileSectionW(LPCWSTR lpAppName,LPCWSTR lpString); + WINBASEAPI UINT WINAPI GetPrivateProfileIntA(LPCSTR lpAppName,LPCSTR lpKeyName,INT nDefault,LPCSTR lpFileName); + WINBASEAPI UINT WINAPI GetPrivateProfileIntW(LPCWSTR lpAppName,LPCWSTR lpKeyName,INT nDefault,LPCWSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault,LPSTR lpReturnedString,DWORD nSize,LPCSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpDefault,LPWSTR lpReturnedString,DWORD nSize,LPCWSTR lpFileName); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpString,LPCSTR lpFileName); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString,LPCWSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileSectionA(LPCSTR lpAppName,LPSTR lpReturnedString,DWORD nSize,LPCSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileSectionW(LPCWSTR lpAppName,LPWSTR lpReturnedString,DWORD nSize,LPCWSTR lpFileName); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileSectionA(LPCSTR lpAppName,LPCSTR lpString,LPCSTR lpFileName); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileSectionW(LPCWSTR lpAppName,LPCWSTR lpString,LPCWSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileSectionNamesA(LPSTR lpszReturnBuffer,DWORD nSize,LPCSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileSectionNamesW(LPWSTR lpszReturnBuffer,DWORD nSize,LPCWSTR lpFileName); + WINBASEAPI WINBOOL WINAPI GetPrivateProfileStructA(LPCSTR lpszSection,LPCSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCSTR szFile); + WINBASEAPI WINBOOL WINAPI GetPrivateProfileStructW(LPCWSTR lpszSection,LPCWSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCWSTR szFile); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileStructA(LPCSTR lpszSection,LPCSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCSTR szFile); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileStructW(LPCWSTR lpszSection,LPCWSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCWSTR szFile); + WINBASEAPI UINT WINAPI GetDriveTypeA(LPCSTR lpRootPathName); + WINBASEAPI UINT WINAPI GetDriveTypeW(LPCWSTR lpRootPathName); + WINBASEAPI UINT WINAPI GetSystemDirectoryA(LPSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetSystemDirectoryW(LPWSTR lpBuffer,UINT uSize); + WINBASEAPI DWORD WINAPI GetTempPathA(DWORD nBufferLength,LPSTR lpBuffer); + WINBASEAPI DWORD WINAPI GetTempPathW(DWORD nBufferLength,LPWSTR lpBuffer); + WINBASEAPI UINT WINAPI GetTempFileNameA(LPCSTR lpPathName,LPCSTR lpPrefixString,UINT uUnique,LPSTR lpTempFileName); + WINBASEAPI UINT WINAPI GetTempFileNameW(LPCWSTR lpPathName,LPCWSTR lpPrefixString,UINT uUnique,LPWSTR lpTempFileName); + WINBASEAPI UINT WINAPI GetWindowsDirectoryA(LPSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetWindowsDirectoryW(LPWSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryA(LPSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryW(LPWSTR lpBuffer,UINT uSize); + +#ifndef RC_INVOKED +#ifdef UNICODE +#define GetSystemWow64Directory GetSystemWow64DirectoryW +#else +#define GetSystemWow64Directory GetSystemWow64DirectoryA +#endif + + WINBASEAPI UINT WINAPI GetSystemWow64DirectoryA(LPSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetSystemWow64DirectoryW(LPWSTR lpBuffer,UINT uSize); + WINBASEAPI BOOLEAN WINAPI Wow64EnableWow64FsRedirection(BOOLEAN Wow64FsEnableRedirection); + WINBASEAPI WINBOOL WINAPI Wow64DisableWow64FsRedirection(PVOID *OldValue); + WINBASEAPI WINBOOL WINAPI Wow64RevertWow64FsRedirection(PVOID OlValue); + + typedef UINT (WINAPI *PGET_SYSTEM_WOW64_DIRECTORY_A)(LPSTR lpBuffer,UINT uSize); + typedef UINT (WINAPI *PGET_SYSTEM_WOW64_DIRECTORY_W)(LPWSTR lpBuffer,UINT uSize); + +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A "GetSystemWow64DirectoryA" +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W L"GetSystemWow64DirectoryA" +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T TEXT("GetSystemWow64DirectoryA") +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A "GetSystemWow64DirectoryW" +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W L"GetSystemWow64DirectoryW" +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T TEXT("GetSystemWow64DirectoryW") + +#ifdef UNICODE +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T +#else +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T +#endif +#endif + +#ifdef UNICODE +#define SetCurrentDirectory SetCurrentDirectoryW +#define GetCurrentDirectory GetCurrentDirectoryW +#define SetDllDirectory SetDllDirectoryW +#define GetDllDirectory GetDllDirectoryW +#define GetDiskFreeSpace GetDiskFreeSpaceW +#define GetDiskFreeSpaceEx GetDiskFreeSpaceExW +#define CreateDirectory CreateDirectoryW +#define CreateDirectoryEx CreateDirectoryExW +#define RemoveDirectory RemoveDirectoryW +#define GetFullPathName GetFullPathNameW +#define DefineDosDevice DefineDosDeviceW +#define QueryDosDevice QueryDosDeviceW +#define CreateFile CreateFileW +#define SetFileAttributes SetFileAttributesW +#define GetFileAttributes GetFileAttributesW +#else +#define SetCurrentDirectory SetCurrentDirectoryA +#define GetCurrentDirectory GetCurrentDirectoryA +#define SetDllDirectory SetDllDirectoryA +#define GetDllDirectory GetDllDirectoryA +#define GetDiskFreeSpace GetDiskFreeSpaceA +#define GetDiskFreeSpaceEx GetDiskFreeSpaceExA +#define CreateDirectory CreateDirectoryA +#define CreateDirectoryEx CreateDirectoryExA +#define RemoveDirectory RemoveDirectoryA +#define GetFullPathName GetFullPathNameA +#define DefineDosDevice DefineDosDeviceA +#define QueryDosDevice QueryDosDeviceA +#define CreateFile CreateFileA +#define SetFileAttributes SetFileAttributesA +#define GetFileAttributes GetFileAttributesA +#endif + + WINBASEAPI WINBOOL WINAPI SetCurrentDirectoryA(LPCSTR lpPathName); + WINBASEAPI WINBOOL WINAPI SetCurrentDirectoryW(LPCWSTR lpPathName); + WINBASEAPI DWORD WINAPI GetCurrentDirectoryA(DWORD nBufferLength,LPSTR lpBuffer); + WINBASEAPI DWORD WINAPI GetCurrentDirectoryW(DWORD nBufferLength,LPWSTR lpBuffer); + WINBASEAPI WINBOOL WINAPI SetDllDirectoryA(LPCSTR lpPathName); + WINBASEAPI WINBOOL WINAPI SetDllDirectoryW(LPCWSTR lpPathName); + WINBASEAPI DWORD WINAPI GetDllDirectoryA(DWORD nBufferLength,LPSTR lpBuffer); + WINBASEAPI DWORD WINAPI GetDllDirectoryW(DWORD nBufferLength,LPWSTR lpBuffer); + WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceA(LPCSTR lpRootPathName,LPDWORD lpSectorsPerCluster,LPDWORD lpBytesPerSector,LPDWORD lpNumberOfFreeClusters,LPDWORD lpTotalNumberOfClusters); + WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceW(LPCWSTR lpRootPathName,LPDWORD lpSectorsPerCluster,LPDWORD lpBytesPerSector,LPDWORD lpNumberOfFreeClusters,LPDWORD lpTotalNumberOfClusters); + WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceExA(LPCSTR lpDirectoryName,PULARGE_INTEGER lpFreeBytesAvailableToCaller,PULARGE_INTEGER lpTotalNumberOfBytes,PULARGE_INTEGER lpTotalNumberOfFreeBytes); + WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceExW(LPCWSTR lpDirectoryName,PULARGE_INTEGER lpFreeBytesAvailableToCaller,PULARGE_INTEGER lpTotalNumberOfBytes,PULARGE_INTEGER lpTotalNumberOfFreeBytes); + WINBASEAPI WINBOOL WINAPI CreateDirectoryA(LPCSTR lpPathName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI CreateDirectoryW(LPCWSTR lpPathName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI CreateDirectoryExA(LPCSTR lpTemplateDirectory,LPCSTR lpNewDirectory,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI CreateDirectoryExW(LPCWSTR lpTemplateDirectory,LPCWSTR lpNewDirectory,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI RemoveDirectoryA(LPCSTR lpPathName); + WINBASEAPI WINBOOL WINAPI RemoveDirectoryW(LPCWSTR lpPathName); + WINBASEAPI DWORD WINAPI GetFullPathNameA(LPCSTR lpFileName,DWORD nBufferLength,LPSTR lpBuffer,LPSTR *lpFilePart); + WINBASEAPI DWORD WINAPI GetFullPathNameW(LPCWSTR lpFileName,DWORD nBufferLength,LPWSTR lpBuffer,LPWSTR *lpFilePart); + +#define DDD_RAW_TARGET_PATH 0x1 +#define DDD_REMOVE_DEFINITION 0x2 +#define DDD_EXACT_MATCH_ON_REMOVE 0x4 +#define DDD_NO_BROADCAST_SYSTEM 0x8 +#define DDD_LUID_BROADCAST_DRIVE 0x10 + + WINBASEAPI WINBOOL WINAPI DefineDosDeviceA(DWORD dwFlags,LPCSTR lpDeviceName,LPCSTR lpTargetPath); + WINBASEAPI WINBOOL WINAPI DefineDosDeviceW(DWORD dwFlags,LPCWSTR lpDeviceName,LPCWSTR lpTargetPath); + WINBASEAPI DWORD WINAPI QueryDosDeviceA(LPCSTR lpDeviceName,LPSTR lpTargetPath,DWORD ucchMax); + WINBASEAPI DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName,LPWSTR lpTargetPath,DWORD ucchMax); + +#define EXPAND_LOCAL_DRIVES + + WINBASEAPI HANDLE WINAPI CreateFileA(LPCSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition,DWORD dwFlagsAndAttributes,HANDLE hTemplateFile); + WINBASEAPI HANDLE WINAPI CreateFileW(LPCWSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition,DWORD dwFlagsAndAttributes,HANDLE hTemplateFile); + WINBASEAPI HANDLE WINAPI ReOpenFile(HANDLE hOriginalFile,DWORD dwDesiredAccess,DWORD dwShareMode,DWORD dwFlagsAndAttributes); + WINBASEAPI WINBOOL WINAPI SetFileAttributesA(LPCSTR lpFileName,DWORD dwFileAttributes); + WINBASEAPI WINBOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName,DWORD dwFileAttributes); + WINBASEAPI DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName); + WINBASEAPI DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName); + + typedef enum _GET_FILEEX_INFO_LEVELS { + GetFileExInfoStandard,GetFileExMaxInfoLevel + } GET_FILEEX_INFO_LEVELS; + +#ifdef UNICODE +#define GetFileAttributesEx GetFileAttributesExW +#define GetCompressedFileSize GetCompressedFileSizeW +#define DeleteFile DeleteFileW +#define CheckNameLegalDOS8Dot3 CheckNameLegalDOS8Dot3W +#else +#define GetFileAttributesEx GetFileAttributesExA +#define GetCompressedFileSize GetCompressedFileSizeA +#define DeleteFile DeleteFileA +#define CheckNameLegalDOS8Dot3 CheckNameLegalDOS8Dot3A +#endif + + WINBASEAPI WINBOOL WINAPI GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation); + WINBASEAPI WINBOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation); + WINBASEAPI DWORD WINAPI GetCompressedFileSizeA(LPCSTR lpFileName,LPDWORD lpFileSizeHigh); + WINBASEAPI DWORD WINAPI GetCompressedFileSizeW(LPCWSTR lpFileName,LPDWORD lpFileSizeHigh); + WINBASEAPI WINBOOL WINAPI DeleteFileA(LPCSTR lpFileName); + WINBASEAPI WINBOOL WINAPI DeleteFileW(LPCWSTR lpFileName); + WINBASEAPI WINBOOL WINAPI CheckNameLegalDOS8Dot3A(LPCSTR lpName,LPSTR lpOemName,DWORD OemNameSize,PBOOL pbNameContainsSpaces,PBOOL pbNameLegal); + WINBASEAPI WINBOOL WINAPI CheckNameLegalDOS8Dot3W(LPCWSTR lpName,LPSTR lpOemName,DWORD OemNameSize,PBOOL pbNameContainsSpaces,PBOOL pbNameLegal); + + typedef enum _FINDEX_INFO_LEVELS { + FindExInfoStandard,FindExInfoMaxInfoLevel + } FINDEX_INFO_LEVELS; + + typedef enum _FINDEX_SEARCH_OPS { + FindExSearchNameMatch,FindExSearchLimitToDirectories,FindExSearchLimitToDevices,FindExSearchMaxSearchOp + } FINDEX_SEARCH_OPS; + +#define FIND_FIRST_EX_CASE_SENSITIVE 0x1 + +#ifdef UNICODE +#define FindFirstFileEx FindFirstFileExW +#define FindFirstFile FindFirstFileW +#define FindNextFile FindNextFileW +#define SearchPath SearchPathW +#define CopyFile CopyFileW +#define CopyFileEx CopyFileExW +#define MoveFile MoveFileW +#define MoveFileEx MoveFileExW +#define MoveFileWithProgress MoveFileWithProgressW +#define ReplaceFile ReplaceFileW +#define CreateHardLink CreateHardLinkW +#define CreateNamedPipe CreateNamedPipeW +#define GetNamedPipeHandleState GetNamedPipeHandleStateW +#define CallNamedPipe CallNamedPipeW +#define WaitNamedPipe WaitNamedPipeW +#define SetVolumeLabel SetVolumeLabelW +#define GetVolumeInformation GetVolumeInformationW +#define ClearEventLog ClearEventLogW +#define BackupEventLog BackupEventLogW +#define OpenEventLog OpenEventLogW +#define RegisterEventSource RegisterEventSourceW +#define OpenBackupEventLog OpenBackupEventLogW +#define ReadEventLog ReadEventLogW +#define ReportEvent ReportEventW +#define AccessCheckAndAuditAlarm AccessCheckAndAuditAlarmW +#define AccessCheckByTypeAndAuditAlarm AccessCheckByTypeAndAuditAlarmW +#define AccessCheckByTypeResultListAndAuditAlarm AccessCheckByTypeResultListAndAuditAlarmW +#define AccessCheckByTypeResultListAndAuditAlarmByHandle AccessCheckByTypeResultListAndAuditAlarmByHandleW +#define ObjectOpenAuditAlarm ObjectOpenAuditAlarmW +#define ObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmW +#define ObjectCloseAuditAlarm ObjectCloseAuditAlarmW +#define ObjectDeleteAuditAlarm ObjectDeleteAuditAlarmW +#define PrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmW +#define SetFileSecurity SetFileSecurityW +#define GetFileSecurity GetFileSecurityW +#define FindFirstChangeNotification FindFirstChangeNotificationW +#define IsBadStringPtr IsBadStringPtrW +#define LookupAccountSid LookupAccountSidW +#define LookupAccountName LookupAccountNameW +#define LookupPrivilegeValue LookupPrivilegeValueW +#define LookupPrivilegeName LookupPrivilegeNameW +#define LookupPrivilegeDisplayName LookupPrivilegeDisplayNameW +#define BuildCommDCB BuildCommDCBW +#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsW +#define CommConfigDialog CommConfigDialogW +#define GetDefaultCommConfig GetDefaultCommConfigW +#define SetDefaultCommConfig SetDefaultCommConfigW +#define GetComputerName GetComputerNameW +#define SetComputerName SetComputerNameW +#define GetComputerNameEx GetComputerNameExW +#define SetComputerNameEx SetComputerNameExW +#define DnsHostnameToComputerName DnsHostnameToComputerNameW +#define GetUserName GetUserNameW +#else +#define FindFirstFileEx FindFirstFileExA +#define FindFirstFile FindFirstFileA +#define FindNextFile FindNextFileA +#define SearchPath SearchPathA +#define CopyFile CopyFileA +#define CopyFileEx CopyFileExA +#define MoveFile MoveFileA +#define MoveFileEx MoveFileExA +#define MoveFileWithProgress MoveFileWithProgressA +#define ReplaceFile ReplaceFileA +#define CreateHardLink CreateHardLinkA +#define CreateNamedPipe CreateNamedPipeA +#define GetNamedPipeHandleState GetNamedPipeHandleStateA +#define CallNamedPipe CallNamedPipeA +#define WaitNamedPipe WaitNamedPipeA +#define SetVolumeLabel SetVolumeLabelA +#define GetVolumeInformation GetVolumeInformationA +#define ClearEventLog ClearEventLogA +#define BackupEventLog BackupEventLogA +#define OpenEventLog OpenEventLogA +#define RegisterEventSource RegisterEventSourceA +#define OpenBackupEventLog OpenBackupEventLogA +#define ReadEventLog ReadEventLogA +#define ReportEvent ReportEventA +#define AccessCheckAndAuditAlarm AccessCheckAndAuditAlarmA +#define AccessCheckByTypeAndAuditAlarm AccessCheckByTypeAndAuditAlarmA +#define AccessCheckByTypeResultListAndAuditAlarm AccessCheckByTypeResultListAndAuditAlarmA +#define AccessCheckByTypeResultListAndAuditAlarmByHandle AccessCheckByTypeResultListAndAuditAlarmByHandleA +#define ObjectOpenAuditAlarm ObjectOpenAuditAlarmA +#define ObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmA +#define ObjectCloseAuditAlarm ObjectCloseAuditAlarmA +#define ObjectDeleteAuditAlarm ObjectDeleteAuditAlarmA +#define PrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmA +#define SetFileSecurity SetFileSecurityA +#define GetFileSecurity GetFileSecurityA +#define FindFirstChangeNotification FindFirstChangeNotificationA +#define IsBadStringPtr IsBadStringPtrA +#define LookupAccountSid LookupAccountSidA +#define LookupAccountName LookupAccountNameA +#define LookupPrivilegeValue LookupPrivilegeValueA +#define LookupPrivilegeName LookupPrivilegeNameA +#define LookupPrivilegeDisplayName LookupPrivilegeDisplayNameA +#define BuildCommDCB BuildCommDCBA +#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsA +#define CommConfigDialog CommConfigDialogA +#define GetDefaultCommConfig GetDefaultCommConfigA +#define SetDefaultCommConfig SetDefaultCommConfigA +#define GetComputerName GetComputerNameA +#define SetComputerName SetComputerNameA +#define GetComputerNameEx GetComputerNameExA +#define SetComputerNameEx SetComputerNameExA +#define DnsHostnameToComputerName DnsHostnameToComputerNameA +#define GetUserName GetUserNameA +#endif + + WINBASEAPI HANDLE WINAPI FindFirstFileExA(LPCSTR lpFileName,FINDEX_INFO_LEVELS fInfoLevelId,LPVOID lpFindFileData,FINDEX_SEARCH_OPS fSearchOp,LPVOID lpSearchFilter,DWORD dwAdditionalFlags); + WINBASEAPI HANDLE WINAPI FindFirstFileExW(LPCWSTR lpFileName,FINDEX_INFO_LEVELS fInfoLevelId,LPVOID lpFindFileData,FINDEX_SEARCH_OPS fSearchOp,LPVOID lpSearchFilter,DWORD dwAdditionalFlags); + WINBASEAPI HANDLE WINAPI FindFirstFileA(LPCSTR lpFileName,LPWIN32_FIND_DATAA lpFindFileData); + WINBASEAPI HANDLE WINAPI FindFirstFileW(LPCWSTR lpFileName,LPWIN32_FIND_DATAW lpFindFileData); + WINBASEAPI WINBOOL WINAPI FindNextFileA(HANDLE hFindFile,LPWIN32_FIND_DATAA lpFindFileData); + WINBASEAPI WINBOOL WINAPI FindNextFileW(HANDLE hFindFile,LPWIN32_FIND_DATAW lpFindFileData); + WINBASEAPI DWORD WINAPI SearchPathA(LPCSTR lpPath,LPCSTR lpFileName,LPCSTR lpExtension,DWORD nBufferLength,LPSTR lpBuffer,LPSTR *lpFilePart); + WINBASEAPI DWORD WINAPI SearchPathW(LPCWSTR lpPath,LPCWSTR lpFileName,LPCWSTR lpExtension,DWORD nBufferLength,LPWSTR lpBuffer,LPWSTR *lpFilePart); + WINBASEAPI WINBOOL WINAPI CopyFileA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,WINBOOL bFailIfExists); + WINBASEAPI WINBOOL WINAPI CopyFileW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,WINBOOL bFailIfExists); + + typedef DWORD (WINAPI *LPPROGRESS_ROUTINE)(LARGE_INTEGER TotalFileSize,LARGE_INTEGER TotalBytesTransferred,LARGE_INTEGER StreamSize,LARGE_INTEGER StreamBytesTransferred,DWORD dwStreamNumber,DWORD dwCallbackReason,HANDLE hSourceFile,HANDLE hDestinationFile,LPVOID lpData); + + WINBASEAPI WINBOOL WINAPI CopyFileExA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,LPBOOL pbCancel,DWORD dwCopyFlags); + WINBASEAPI WINBOOL WINAPI CopyFileExW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,LPBOOL pbCancel,DWORD dwCopyFlags); + WINBASEAPI WINBOOL WINAPI MoveFileA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName); + WINBASEAPI WINBOOL WINAPI MoveFileW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName); + WINBASEAPI WINBOOL WINAPI MoveFileExA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI MoveFileExW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI MoveFileWithProgressA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI MoveFileWithProgressW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,DWORD dwFlags); + +#define MOVEFILE_REPLACE_EXISTING 0x1 +#define MOVEFILE_COPY_ALLOWED 0x2 +#define MOVEFILE_DELAY_UNTIL_REBOOT 0x4 +#define MOVEFILE_WRITE_THROUGH 0x8 +#define MOVEFILE_CREATE_HARDLINK 0x10 +#define MOVEFILE_FAIL_IF_NOT_TRACKABLE 0x20 + + WINBASEAPI WINBOOL WINAPI ReplaceFileA(LPCSTR lpReplacedFileName,LPCSTR lpReplacementFileName,LPCSTR lpBackupFileName,DWORD dwReplaceFlags,LPVOID lpExclude,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI ReplaceFileW(LPCWSTR lpReplacedFileName,LPCWSTR lpReplacementFileName,LPCWSTR lpBackupFileName,DWORD dwReplaceFlags,LPVOID lpExclude,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI CreateHardLinkA(LPCSTR lpFileName,LPCSTR lpExistingFileName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI CreateHardLinkW(LPCWSTR lpFileName,LPCWSTR lpExistingFileName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + + typedef enum _STREAM_INFO_LEVELS { + FindStreamInfoStandard,FindStreamInfoMaxInfoLevel + } STREAM_INFO_LEVELS; + + typedef struct _WIN32_FIND_STREAM_DATA { + LARGE_INTEGER StreamSize; + WCHAR cStreamName[MAX_PATH + 36]; + } WIN32_FIND_STREAM_DATA,*PWIN32_FIND_STREAM_DATA; + + HANDLE WINAPI FindFirstStreamW(LPCWSTR lpFileName,STREAM_INFO_LEVELS InfoLevel,LPVOID lpFindStreamData,DWORD dwFlags); + WINBOOL WINAPI FindNextStreamW(HANDLE hFindStream,LPVOID lpFindStreamData); + WINBASEAPI HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName,DWORD dwOpenMode,DWORD dwPipeMode,DWORD nMaxInstances,DWORD nOutBufferSize,DWORD nInBufferSize,DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI HANDLE WINAPI CreateNamedPipeW(LPCWSTR lpName,DWORD dwOpenMode,DWORD dwPipeMode,DWORD nMaxInstances,DWORD nOutBufferSize,DWORD nInBufferSize,DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateA(HANDLE hNamedPipe,LPDWORD lpState,LPDWORD lpCurInstances,LPDWORD lpMaxCollectionCount,LPDWORD lpCollectDataTimeout,LPSTR lpUserName,DWORD nMaxUserNameSize); + WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateW(HANDLE hNamedPipe,LPDWORD lpState,LPDWORD lpCurInstances,LPDWORD lpMaxCollectionCount,LPDWORD lpCollectDataTimeout,LPWSTR lpUserName,DWORD nMaxUserNameSize); + WINBASEAPI WINBOOL WINAPI CallNamedPipeA(LPCSTR lpNamedPipeName,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesRead,DWORD nTimeOut); + WINBASEAPI WINBOOL WINAPI CallNamedPipeW(LPCWSTR lpNamedPipeName,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesRead,DWORD nTimeOut); + WINBASEAPI WINBOOL WINAPI WaitNamedPipeA(LPCSTR lpNamedPipeName,DWORD nTimeOut); + WINBASEAPI WINBOOL WINAPI WaitNamedPipeW(LPCWSTR lpNamedPipeName,DWORD nTimeOut); + WINBASEAPI WINBOOL WINAPI SetVolumeLabelA(LPCSTR lpRootPathName,LPCSTR lpVolumeName); + WINBASEAPI WINBOOL WINAPI SetVolumeLabelW(LPCWSTR lpRootPathName,LPCWSTR lpVolumeName); + WINBASEAPI VOID WINAPI SetFileApisToOEM(VOID); + WINBASEAPI VOID WINAPI SetFileApisToANSI(VOID); + WINBASEAPI WINBOOL WINAPI AreFileApisANSI(VOID); + WINBASEAPI WINBOOL WINAPI GetVolumeInformationA(LPCSTR lpRootPathName,LPSTR lpVolumeNameBuffer,DWORD nVolumeNameSize,LPDWORD lpVolumeSerialNumber,LPDWORD lpMaximumComponentLength,LPDWORD lpFileSystemFlags,LPSTR lpFileSystemNameBuffer,DWORD nFileSystemNameSize); + WINBASEAPI WINBOOL WINAPI GetVolumeInformationW(LPCWSTR lpRootPathName,LPWSTR lpVolumeNameBuffer,DWORD nVolumeNameSize,LPDWORD lpVolumeSerialNumber,LPDWORD lpMaximumComponentLength,LPDWORD lpFileSystemFlags,LPWSTR lpFileSystemNameBuffer,DWORD nFileSystemNameSize); + WINBASEAPI WINBOOL WINAPI CancelIo(HANDLE hFile); + WINADVAPI WINBOOL WINAPI ClearEventLogA(HANDLE hEventLog,LPCSTR lpBackupFileName); + WINADVAPI WINBOOL WINAPI ClearEventLogW(HANDLE hEventLog,LPCWSTR lpBackupFileName); + WINADVAPI WINBOOL WINAPI BackupEventLogA(HANDLE hEventLog,LPCSTR lpBackupFileName); + WINADVAPI WINBOOL WINAPI BackupEventLogW(HANDLE hEventLog,LPCWSTR lpBackupFileName); + WINADVAPI WINBOOL WINAPI CloseEventLog(HANDLE hEventLog); + WINADVAPI WINBOOL WINAPI DeregisterEventSource(HANDLE hEventLog); + WINADVAPI WINBOOL WINAPI NotifyChangeEventLog(HANDLE hEventLog,HANDLE hEvent); + WINADVAPI WINBOOL WINAPI GetNumberOfEventLogRecords(HANDLE hEventLog,PDWORD NumberOfRecords); + WINADVAPI WINBOOL WINAPI GetOldestEventLogRecord(HANDLE hEventLog,PDWORD OldestRecord); + WINADVAPI HANDLE WINAPI OpenEventLogA(LPCSTR lpUNCServerName,LPCSTR lpSourceName); + WINADVAPI HANDLE WINAPI OpenEventLogW(LPCWSTR lpUNCServerName,LPCWSTR lpSourceName); + WINADVAPI HANDLE WINAPI RegisterEventSourceA(LPCSTR lpUNCServerName,LPCSTR lpSourceName); + WINADVAPI HANDLE WINAPI RegisterEventSourceW(LPCWSTR lpUNCServerName,LPCWSTR lpSourceName); + WINADVAPI HANDLE WINAPI OpenBackupEventLogA(LPCSTR lpUNCServerName,LPCSTR lpFileName); + WINADVAPI HANDLE WINAPI OpenBackupEventLogW(LPCWSTR lpUNCServerName,LPCWSTR lpFileName); + WINADVAPI WINBOOL WINAPI ReadEventLogA(HANDLE hEventLog,DWORD dwReadFlags,DWORD dwRecordOffset,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,DWORD *pnBytesRead,DWORD *pnMinNumberOfBytesNeeded); + WINADVAPI WINBOOL WINAPI ReadEventLogW(HANDLE hEventLog,DWORD dwReadFlags,DWORD dwRecordOffset,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,DWORD *pnBytesRead,DWORD *pnMinNumberOfBytesNeeded); + WINADVAPI WINBOOL WINAPI ReportEventA(HANDLE hEventLog,WORD wType,WORD wCategory,DWORD dwEventID,PSID lpUserSid,WORD wNumStrings,DWORD dwDataSize,LPCSTR *lpStrings,LPVOID lpRawData); + WINADVAPI WINBOOL WINAPI ReportEventW(HANDLE hEventLog,WORD wType,WORD wCategory,DWORD dwEventID,PSID lpUserSid,WORD wNumStrings,DWORD dwDataSize,LPCWSTR *lpStrings,LPVOID lpRawData); + +#define EVENTLOG_FULL_INFO 0 + + typedef struct _EVENTLOG_FULL_INFORMATION { + DWORD dwFull; + } EVENTLOG_FULL_INFORMATION,*LPEVENTLOG_FULL_INFORMATION; + + WINADVAPI WINBOOL WINAPI GetEventLogInformation(HANDLE hEventLog,DWORD dwInfoLevel,LPVOID lpBuffer,DWORD cbBufSize,LPDWORD pcbBytesNeeded); + WINADVAPI WINBOOL WINAPI DuplicateToken(HANDLE ExistingTokenHandle,SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,PHANDLE DuplicateTokenHandle); + WINADVAPI WINBOOL WINAPI GetKernelObjectSecurity(HANDLE Handle,SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD nLength,LPDWORD lpnLengthNeeded); + WINADVAPI WINBOOL WINAPI ImpersonateNamedPipeClient(HANDLE hNamedPipe); + WINADVAPI WINBOOL WINAPI ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel); + WINADVAPI WINBOOL WINAPI RevertToSelf(VOID); + WINADVAPI WINBOOL WINAPI SetThreadToken (PHANDLE Thread,HANDLE Token); + WINADVAPI WINBOOL WINAPI AccessCheck(PSECURITY_DESCRIPTOR pSecurityDescriptor,HANDLE ClientToken,DWORD DesiredAccess,PGENERIC_MAPPING GenericMapping,PPRIVILEGE_SET PrivilegeSet,LPDWORD PrivilegeSetLength,LPDWORD GrantedAccess,LPBOOL AccessStatus); + WINADVAPI WINBOOL WINAPI AccessCheckByType(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID PrincipalSelfSid,HANDLE ClientToken,DWORD DesiredAccess,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,PPRIVILEGE_SET PrivilegeSet,LPDWORD PrivilegeSetLength,LPDWORD GrantedAccess,LPBOOL AccessStatus); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultList(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID PrincipalSelfSid,HANDLE ClientToken,DWORD DesiredAccess,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,PPRIVILEGE_SET PrivilegeSet,LPDWORD PrivilegeSetLength,LPDWORD GrantedAccessList,LPDWORD AccessStatusList); + WINADVAPI WINBOOL WINAPI OpenProcessToken(HANDLE ProcessHandle,DWORD DesiredAccess,PHANDLE TokenHandle); + WINADVAPI WINBOOL WINAPI OpenThreadToken(HANDLE ThreadHandle,DWORD DesiredAccess,WINBOOL OpenAsSelf,PHANDLE TokenHandle); + WINADVAPI WINBOOL WINAPI GetTokenInformation(HANDLE TokenHandle,TOKEN_INFORMATION_CLASS TokenInformationClass,LPVOID TokenInformation,DWORD TokenInformationLength,PDWORD ReturnLength); + WINADVAPI WINBOOL WINAPI SetTokenInformation(HANDLE TokenHandle,TOKEN_INFORMATION_CLASS TokenInformationClass,LPVOID TokenInformation,DWORD TokenInformationLength); + WINADVAPI WINBOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle,WINBOOL DisableAllPrivileges,PTOKEN_PRIVILEGES NewState,DWORD BufferLength,PTOKEN_PRIVILEGES PreviousState,PDWORD ReturnLength); + WINADVAPI WINBOOL WINAPI AdjustTokenGroups(HANDLE TokenHandle,WINBOOL ResetToDefault,PTOKEN_GROUPS NewState,DWORD BufferLength,PTOKEN_GROUPS PreviousState,PDWORD ReturnLength); + WINADVAPI WINBOOL WINAPI PrivilegeCheck(HANDLE ClientToken,PPRIVILEGE_SET RequiredPrivileges,LPBOOL pfResult); + WINADVAPI WINBOOL WINAPI AccessCheckAndAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPSTR ObjectTypeName,LPSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,DWORD DesiredAccess,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckAndAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPWSTR ObjectTypeName,LPWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,DWORD DesiredAccess,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeAndAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPCSTR ObjectTypeName,LPCSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeAndAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPCWSTR ObjectTypeName,LPCWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPCSTR ObjectTypeName,LPCSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPCWSTR ObjectTypeName,LPCWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmByHandleA(LPCSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,LPCSTR ObjectTypeName,LPCSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmByHandleW(LPCWSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,LPCWSTR ObjectTypeName,LPCWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectOpenAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPSTR ObjectTypeName,LPSTR ObjectName,PSECURITY_DESCRIPTOR pSecurityDescriptor,HANDLE ClientToken,DWORD DesiredAccess,DWORD GrantedAccess,PPRIVILEGE_SET Privileges,WINBOOL ObjectCreation,WINBOOL AccessGranted,LPBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectOpenAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPWSTR ObjectTypeName,LPWSTR ObjectName,PSECURITY_DESCRIPTOR pSecurityDescriptor,HANDLE ClientToken,DWORD DesiredAccess,DWORD GrantedAccess,PPRIVILEGE_SET Privileges,WINBOOL ObjectCreation,WINBOOL AccessGranted,LPBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectPrivilegeAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,DWORD DesiredAccess,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); + WINADVAPI WINBOOL WINAPI ObjectPrivilegeAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,DWORD DesiredAccess,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); + WINADVAPI WINBOOL WINAPI ObjectCloseAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectCloseAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectDeleteAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectDeleteAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI PrivilegedServiceAuditAlarmA(LPCSTR SubsystemName,LPCSTR ServiceName,HANDLE ClientToken,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); + WINADVAPI WINBOOL WINAPI PrivilegedServiceAuditAlarmW(LPCWSTR SubsystemName,LPCWSTR ServiceName,HANDLE ClientToken,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); + WINADVAPI WINBOOL WINAPI IsWellKnownSid(PSID pSid,WELL_KNOWN_SID_TYPE WellKnownSidType); + WINADVAPI WINBOOL WINAPI CreateWellKnownSid(WELL_KNOWN_SID_TYPE WellKnownSidType,PSID DomainSid,PSID pSid,DWORD *cbSid); + WINADVAPI WINBOOL WINAPI EqualDomainSid(PSID pSid1,PSID pSid2,WINBOOL *pfEqual); + WINADVAPI WINBOOL WINAPI GetWindowsAccountDomainSid(PSID pSid,PSID pDomainSid,DWORD *cbDomainSid); + WINADVAPI WINBOOL WINAPI IsValidSid(PSID pSid); + WINADVAPI WINBOOL WINAPI EqualSid(PSID pSid1,PSID pSid2); + WINADVAPI WINBOOL WINAPI EqualPrefixSid(PSID pSid1,PSID pSid2); + WINADVAPI DWORD WINAPI GetSidLengthRequired (UCHAR nSubAuthorityCount); + WINADVAPI WINBOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,BYTE nSubAuthorityCount,DWORD nSubAuthority0,DWORD nSubAuthority1,DWORD nSubAuthority2,DWORD nSubAuthority3,DWORD nSubAuthority4,DWORD nSubAuthority5,DWORD nSubAuthority6,DWORD nSubAuthority7,PSID *pSid); + WINADVAPI PVOID WINAPI FreeSid(PSID pSid); + WINADVAPI WINBOOL WINAPI InitializeSid(PSID Sid,PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,BYTE nSubAuthorityCount); + WINADVAPI PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID pSid); + WINADVAPI PDWORD WINAPI GetSidSubAuthority(PSID pSid,DWORD nSubAuthority); + WINADVAPI PUCHAR WINAPI GetSidSubAuthorityCount(PSID pSid); + WINADVAPI DWORD WINAPI GetLengthSid(PSID pSid); + WINADVAPI WINBOOL WINAPI CopySid(DWORD nDestinationSidLength,PSID pDestinationSid,PSID pSourceSid); + WINADVAPI WINBOOL WINAPI AreAllAccessesGranted(DWORD GrantedAccess,DWORD DesiredAccess); + WINADVAPI WINBOOL WINAPI AreAnyAccessesGranted(DWORD GrantedAccess,DWORD DesiredAccess); + WINADVAPI VOID WINAPI MapGenericMask(PDWORD AccessMask,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI IsValidAcl(PACL pAcl); + WINADVAPI WINBOOL WINAPI InitializeAcl(PACL pAcl,DWORD nAclLength,DWORD dwAclRevision); + WINADVAPI WINBOOL WINAPI GetAclInformation(PACL pAcl,LPVOID pAclInformation,DWORD nAclInformationLength,ACL_INFORMATION_CLASS dwAclInformationClass); + WINADVAPI WINBOOL WINAPI SetAclInformation(PACL pAcl,LPVOID pAclInformation,DWORD nAclInformationLength,ACL_INFORMATION_CLASS dwAclInformationClass); + WINADVAPI WINBOOL WINAPI AddAce(PACL pAcl,DWORD dwAceRevision,DWORD dwStartingAceIndex,LPVOID pAceList,DWORD nAceListLength); + WINADVAPI WINBOOL WINAPI DeleteAce(PACL pAcl,DWORD dwAceIndex); + WINADVAPI WINBOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce); + WINADVAPI WINBOOL WINAPI AddAccessAllowedAce(PACL pAcl,DWORD dwAceRevision,DWORD AccessMask,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAccessAllowedAceEx(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAccessDeniedAce(PACL pAcl,DWORD dwAceRevision,DWORD AccessMask,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAccessDeniedAceEx(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAuditAccessAce(PACL pAcl,DWORD dwAceRevision,DWORD dwAccessMask,PSID pSid,WINBOOL bAuditSuccess,WINBOOL bAuditFailure); + WINADVAPI WINBOOL WINAPI AddAuditAccessAceEx(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD dwAccessMask,PSID pSid,WINBOOL bAuditSuccess,WINBOOL bAuditFailure); + WINADVAPI WINBOOL WINAPI AddAccessAllowedObjectAce(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,GUID *ObjectTypeGuid,GUID *InheritedObjectTypeGuid,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAccessDeniedObjectAce(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,GUID *ObjectTypeGuid,GUID *InheritedObjectTypeGuid,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAuditAccessObjectAce(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,GUID *ObjectTypeGuid,GUID *InheritedObjectTypeGuid,PSID pSid,WINBOOL bAuditSuccess,WINBOOL bAuditFailure); + WINADVAPI WINBOOL WINAPI FindFirstFreeAce(PACL pAcl,LPVOID *pAce); + WINADVAPI WINBOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD dwRevision); + WINADVAPI WINBOOL WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI DWORD WINAPI GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSECURITY_DESCRIPTOR_CONTROL pControl,LPDWORD lpdwRevision); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,WINBOOL bDaclPresent,PACL pDacl,WINBOOL bDaclDefaulted); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,LPBOOL lpbDaclPresent,PACL *pDacl,LPBOOL lpbDaclDefaulted); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,WINBOOL bSaclPresent,PACL pSacl,WINBOOL bSaclDefaulted); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,LPBOOL lpbSaclPresent,PACL *pSacl,LPBOOL lpbSaclDefaulted); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID pOwner,WINBOOL bOwnerDefaulted); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID *pOwner,LPBOOL lpbOwnerDefaulted); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID pGroup,WINBOOL bGroupDefaulted); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID *pGroup,LPBOOL lpbGroupDefaulted); + WINADVAPI DWORD WINAPI SetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,PUCHAR RMControl); + WINADVAPI DWORD WINAPI GetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,PUCHAR RMControl); + WINADVAPI WINBOOL WINAPI CreatePrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CreatorDescriptor,PSECURITY_DESCRIPTOR *NewDescriptor,WINBOOL IsDirectoryObject,HANDLE Token,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI ConvertToAutoInheritPrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CurrentSecurityDescriptor,PSECURITY_DESCRIPTOR *NewSecurityDescriptor,GUID *ObjectType,BOOLEAN IsDirectoryObject,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI CreatePrivateObjectSecurityEx(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CreatorDescriptor,PSECURITY_DESCRIPTOR *NewDescriptor,GUID *ObjectType,WINBOOL IsContainerObject,ULONG AutoInheritFlags,HANDLE Token,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI CreatePrivateObjectSecurityWithMultipleInheritance(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CreatorDescriptor,PSECURITY_DESCRIPTOR *NewDescriptor,GUID **ObjectTypes,ULONG GuidCount,WINBOOL IsContainerObject,ULONG AutoInheritFlags,HANDLE Token,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI SetPrivateObjectSecurity (SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR ModificationDescriptor,PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,PGENERIC_MAPPING GenericMapping,HANDLE Token); + WINADVAPI WINBOOL WINAPI SetPrivateObjectSecurityEx (SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR ModificationDescriptor,PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,ULONG AutoInheritFlags,PGENERIC_MAPPING GenericMapping,HANDLE Token); + WINADVAPI WINBOOL WINAPI GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR ResultantDescriptor,DWORD DescriptorLength,PDWORD ReturnLength); + WINADVAPI WINBOOL WINAPI DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR *ObjectDescriptor); + WINADVAPI WINBOOL WINAPI MakeSelfRelativeSD(PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,LPDWORD lpdwBufferLength); + WINADVAPI WINBOOL WINAPI MakeAbsoluteSD(PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,LPDWORD lpdwAbsoluteSecurityDescriptorSize,PACL pDacl,LPDWORD lpdwDaclSize,PACL pSacl,LPDWORD lpdwSaclSize,PSID pOwner,LPDWORD lpdwOwnerSize,PSID pPrimaryGroup,LPDWORD lpdwPrimaryGroupSize); + WINADVAPI WINBOOL WINAPI MakeAbsoluteSD2(PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,LPDWORD lpdwBufferSize); + WINADVAPI WINBOOL WINAPI SetFileSecurityA(LPCSTR lpFileName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI WINBOOL WINAPI SetFileSecurityW(LPCWSTR lpFileName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI WINBOOL WINAPI GetFileSecurityA(LPCSTR lpFileName,SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD nLength,LPDWORD lpnLengthNeeded); + WINADVAPI WINBOOL WINAPI GetFileSecurityW(LPCWSTR lpFileName,SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD nLength,LPDWORD lpnLengthNeeded); + WINADVAPI WINBOOL WINAPI SetKernelObjectSecurity(HANDLE Handle,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR SecurityDescriptor); + WINBASEAPI HANDLE WINAPI FindFirstChangeNotificationA(LPCSTR lpPathName,WINBOOL bWatchSubtree,DWORD dwNotifyFilter); + WINBASEAPI HANDLE WINAPI FindFirstChangeNotificationW(LPCWSTR lpPathName,WINBOOL bWatchSubtree,DWORD dwNotifyFilter); + WINBASEAPI WINBOOL WINAPI FindNextChangeNotification(HANDLE hChangeHandle); + WINBASEAPI WINBOOL WINAPI FindCloseChangeNotification(HANDLE hChangeHandle); + WINBASEAPI WINBOOL WINAPI ReadDirectoryChangesW(HANDLE hDirectory,LPVOID lpBuffer,DWORD nBufferLength,WINBOOL bWatchSubtree,DWORD dwNotifyFilter,LPDWORD lpBytesReturned,LPOVERLAPPED lpOverlapped,LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); + WINBASEAPI WINBOOL WINAPI VirtualLock(LPVOID lpAddress,SIZE_T dwSize); + WINBASEAPI WINBOOL WINAPI VirtualUnlock(LPVOID lpAddress,SIZE_T dwSize); + WINBASEAPI LPVOID WINAPI MapViewOfFileEx(HANDLE hFileMappingObject,DWORD dwDesiredAccess,DWORD dwFileOffsetHigh,DWORD dwFileOffsetLow,SIZE_T dwNumberOfBytesToMap,LPVOID lpBaseAddress); + WINBASEAPI WINBOOL WINAPI SetPriorityClass(HANDLE hProcess,DWORD dwPriorityClass); + WINBASEAPI DWORD WINAPI GetPriorityClass(HANDLE hProcess); + WINBASEAPI WINBOOL WINAPI IsBadReadPtr(CONST VOID *lp,UINT_PTR ucb); + WINBASEAPI WINBOOL WINAPI IsBadWritePtr(LPVOID lp,UINT_PTR ucb); + WINBASEAPI WINBOOL WINAPI IsBadHugeReadPtr(CONST VOID *lp,UINT_PTR ucb); + WINBASEAPI WINBOOL WINAPI IsBadHugeWritePtr(LPVOID lp,UINT_PTR ucb); + WINBASEAPI WINBOOL WINAPI IsBadCodePtr(FARPROC lpfn); + WINBASEAPI WINBOOL WINAPI IsBadStringPtrA(LPCSTR lpsz,UINT_PTR ucchMax); + WINBASEAPI WINBOOL WINAPI IsBadStringPtrW(LPCWSTR lpsz,UINT_PTR ucchMax); + WINADVAPI WINBOOL WINAPI LookupAccountSidA(LPCSTR lpSystemName,PSID Sid,LPSTR Name,LPDWORD cchName,LPSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); + WINADVAPI WINBOOL WINAPI LookupAccountSidW(LPCWSTR lpSystemName,PSID Sid,LPWSTR Name,LPDWORD cchName,LPWSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); + WINADVAPI WINBOOL WINAPI LookupAccountNameA(LPCSTR lpSystemName,LPCSTR lpAccountName,PSID Sid,LPDWORD cbSid,LPSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); + WINADVAPI WINBOOL WINAPI LookupAccountNameW(LPCWSTR lpSystemName,LPCWSTR lpAccountName,PSID Sid,LPDWORD cbSid,LPWSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); + WINADVAPI WINBOOL WINAPI LookupPrivilegeValueA(LPCSTR lpSystemName,LPCSTR lpName,PLUID lpLuid); + WINADVAPI WINBOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName,LPCWSTR lpName,PLUID lpLuid); + WINADVAPI WINBOOL WINAPI LookupPrivilegeNameA(LPCSTR lpSystemName,PLUID lpLuid,LPSTR lpName,LPDWORD cchName); + WINADVAPI WINBOOL WINAPI LookupPrivilegeNameW(LPCWSTR lpSystemName,PLUID lpLuid,LPWSTR lpName,LPDWORD cchName); + WINADVAPI WINBOOL WINAPI LookupPrivilegeDisplayNameA(LPCSTR lpSystemName,LPCSTR lpName,LPSTR lpDisplayName,LPDWORD cchDisplayName,LPDWORD lpLanguageId); + WINADVAPI WINBOOL WINAPI LookupPrivilegeDisplayNameW(LPCWSTR lpSystemName,LPCWSTR lpName,LPWSTR lpDisplayName,LPDWORD cchDisplayName,LPDWORD lpLanguageId); + WINADVAPI WINBOOL WINAPI AllocateLocallyUniqueId(PLUID Luid); + WINBASEAPI WINBOOL WINAPI BuildCommDCBA(LPCSTR lpDef,LPDCB lpDCB); + WINBASEAPI WINBOOL WINAPI BuildCommDCBW(LPCWSTR lpDef,LPDCB lpDCB); + WINBASEAPI WINBOOL WINAPI BuildCommDCBAndTimeoutsA(LPCSTR lpDef,LPDCB lpDCB,LPCOMMTIMEOUTS lpCommTimeouts); + WINBASEAPI WINBOOL WINAPI BuildCommDCBAndTimeoutsW(LPCWSTR lpDef,LPDCB lpDCB,LPCOMMTIMEOUTS lpCommTimeouts); + WINBASEAPI WINBOOL WINAPI CommConfigDialogA(LPCSTR lpszName,HWND hWnd,LPCOMMCONFIG lpCC); + WINBASEAPI WINBOOL WINAPI CommConfigDialogW(LPCWSTR lpszName,HWND hWnd,LPCOMMCONFIG lpCC); + WINBASEAPI WINBOOL WINAPI GetDefaultCommConfigA(LPCSTR lpszName,LPCOMMCONFIG lpCC,LPDWORD lpdwSize); + WINBASEAPI WINBOOL WINAPI GetDefaultCommConfigW(LPCWSTR lpszName,LPCOMMCONFIG lpCC,LPDWORD lpdwSize); + WINBASEAPI WINBOOL WINAPI SetDefaultCommConfigA(LPCSTR lpszName,LPCOMMCONFIG lpCC,DWORD dwSize); + WINBASEAPI WINBOOL WINAPI SetDefaultCommConfigW(LPCWSTR lpszName,LPCOMMCONFIG lpCC,DWORD dwSize); + +#define MAX_COMPUTERNAME_LENGTH 15 + + WINBASEAPI WINBOOL WINAPI GetComputerNameA(LPSTR lpBuffer,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI GetComputerNameW(LPWSTR lpBuffer,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI SetComputerNameA(LPCSTR lpComputerName); + WINBASEAPI WINBOOL WINAPI SetComputerNameW(LPCWSTR lpComputerName); + + typedef enum _COMPUTER_NAME_FORMAT { + ComputerNameNetBIOS,ComputerNameDnsHostname,ComputerNameDnsDomain,ComputerNameDnsFullyQualified,ComputerNamePhysicalNetBIOS,ComputerNamePhysicalDnsHostname,ComputerNamePhysicalDnsDomain,ComputerNamePhysicalDnsFullyQualified,ComputerNameMax + } COMPUTER_NAME_FORMAT; + + WINBASEAPI WINBOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT NameType,LPSTR lpBuffer,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT NameType,LPWSTR lpBuffer,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI SetComputerNameExA(COMPUTER_NAME_FORMAT NameType,LPCSTR lpBuffer); + WINBASEAPI WINBOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType,LPCWSTR lpBuffer); + WINBASEAPI WINBOOL WINAPI DnsHostnameToComputerNameA(LPCSTR Hostname,LPSTR ComputerName,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR Hostname,LPWSTR ComputerName,LPDWORD nSize); + WINADVAPI WINBOOL WINAPI GetUserNameA(LPSTR lpBuffer,LPDWORD pcbBuffer); + WINADVAPI WINBOOL WINAPI GetUserNameW(LPWSTR lpBuffer,LPDWORD pcbBuffer); + +#define LOGON32_LOGON_INTERACTIVE 2 +#define LOGON32_LOGON_NETWORK 3 +#define LOGON32_LOGON_BATCH 4 +#define LOGON32_LOGON_SERVICE 5 +#define LOGON32_LOGON_UNLOCK 7 +#define LOGON32_LOGON_NETWORK_CLEARTEXT 8 +#define LOGON32_LOGON_NEW_CREDENTIALS 9 + +#define LOGON32_PROVIDER_DEFAULT 0 +#define LOGON32_PROVIDER_WINNT35 1 +#define LOGON32_PROVIDER_WINNT40 2 +#define LOGON32_PROVIDER_WINNT50 3 + +#ifdef UNICODE +#define LogonUser LogonUserW +#define LogonUserEx LogonUserExW +#define CreateProcessAsUser CreateProcessAsUserW +#else +#define LogonUser LogonUserA +#define LogonUserEx LogonUserExA +#define CreateProcessAsUser CreateProcessAsUserA +#endif + + WINADVAPI WINBOOL WINAPI LogonUserA(LPCSTR lpszUsername,LPCSTR lpszDomain,LPCSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken); + WINADVAPI WINBOOL WINAPI LogonUserW(LPCWSTR lpszUsername,LPCWSTR lpszDomain,LPCWSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken); + WINADVAPI WINBOOL WINAPI LogonUserExA(LPCSTR lpszUsername,LPCSTR lpszDomain,LPCSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken,PSID *ppLogonSid,PVOID *ppProfileBuffer,LPDWORD pdwProfileLength,PQUOTA_LIMITS pQuotaLimits); + WINADVAPI WINBOOL WINAPI LogonUserExW(LPCWSTR lpszUsername,LPCWSTR lpszDomain,LPCWSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken,PSID *ppLogonSid,PVOID *ppProfileBuffer,LPDWORD pdwProfileLength,PQUOTA_LIMITS pQuotaLimits); + WINADVAPI WINBOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken); + WINADVAPI WINBOOL WINAPI CreateProcessAsUserA(HANDLE hToken,LPCSTR lpApplicationName,LPSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCSTR lpCurrentDirectory,LPSTARTUPINFOA lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINADVAPI WINBOOL WINAPI CreateProcessAsUserW(HANDLE hToken,LPCWSTR lpApplicationName,LPWSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + +#define LOGON_WITH_PROFILE 0x1 +#define LOGON_NETCREDENTIALS_ONLY 0x2 +#define LOGON_ZERO_PASSWORD_BUFFER 0x80000000 + + WINADVAPI WINBOOL WINAPI CreateProcessWithLogonW(LPCWSTR lpUsername,LPCWSTR lpDomain,LPCWSTR lpPassword,DWORD dwLogonFlags,LPCWSTR lpApplicationName,LPWSTR lpCommandLine,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINADVAPI WINBOOL WINAPI CreateProcessWithTokenW(HANDLE hToken,DWORD dwLogonFlags,LPCWSTR lpApplicationName,LPWSTR lpCommandLine,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINADVAPI WINBOOL WINAPI ImpersonateAnonymousToken(HANDLE ThreadHandle); + WINADVAPI WINBOOL WINAPI DuplicateTokenEx(HANDLE hExistingToken,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpTokenAttributes,SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,TOKEN_TYPE TokenType,PHANDLE phNewToken); + WINADVAPI WINBOOL WINAPI CreateRestrictedToken(HANDLE ExistingTokenHandle,DWORD Flags,DWORD DisableSidCount,PSID_AND_ATTRIBUTES SidsToDisable,DWORD DeletePrivilegeCount,PLUID_AND_ATTRIBUTES PrivilegesToDelete,DWORD RestrictedSidCount,PSID_AND_ATTRIBUTES SidsToRestrict,PHANDLE NewTokenHandle); + WINADVAPI WINBOOL WINAPI IsTokenRestricted(HANDLE TokenHandle); + WINADVAPI WINBOOL WINAPI IsTokenUntrusted(HANDLE TokenHandle); + WINADVAPI WINBOOL WINAPI CheckTokenMembership(HANDLE TokenHandle,PSID SidToCheck,PBOOL IsMember); + + typedef WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK; + + WINBASEAPI WINBOOL WINAPI RegisterWaitForSingleObject(PHANDLE phNewWaitObject,HANDLE hObject,WAITORTIMERCALLBACK Callback,PVOID Context,ULONG dwMilliseconds,ULONG dwFlags); + WINBASEAPI HANDLE WINAPI RegisterWaitForSingleObjectEx(HANDLE hObject,WAITORTIMERCALLBACK Callback,PVOID Context,ULONG dwMilliseconds,ULONG dwFlags); + WINBASEAPI WINBOOL WINAPI UnregisterWait(HANDLE WaitHandle); + WINBASEAPI WINBOOL WINAPI UnregisterWaitEx(HANDLE WaitHandle,HANDLE CompletionEvent); + WINBASEAPI WINBOOL WINAPI QueueUserWorkItem(LPTHREAD_START_ROUTINE Function,PVOID Context,ULONG Flags); + WINBASEAPI WINBOOL WINAPI BindIoCompletionCallback(HANDLE FileHandle,LPOVERLAPPED_COMPLETION_ROUTINE Function,ULONG Flags); + WINBASEAPI HANDLE WINAPI CreateTimerQueue(VOID); + WINBASEAPI WINBOOL WINAPI CreateTimerQueueTimer(PHANDLE phNewTimer,HANDLE TimerQueue,WAITORTIMERCALLBACK Callback,PVOID Parameter,DWORD DueTime,DWORD Period,ULONG Flags); + WINBASEAPI WINBOOL WINAPI ChangeTimerQueueTimer(HANDLE TimerQueue,HANDLE Timer,ULONG DueTime,ULONG Period); + WINBASEAPI WINBOOL WINAPI DeleteTimerQueueTimer(HANDLE TimerQueue,HANDLE Timer,HANDLE CompletionEvent); + WINBASEAPI WINBOOL WINAPI DeleteTimerQueueEx(HANDLE TimerQueue,HANDLE CompletionEvent); + WINBASEAPI HANDLE WINAPI SetTimerQueueTimer(HANDLE TimerQueue,WAITORTIMERCALLBACK Callback,PVOID Parameter,DWORD DueTime,DWORD Period,WINBOOL PreferIo); + WINBASEAPI WINBOOL WINAPI CancelTimerQueueTimer(HANDLE TimerQueue,HANDLE Timer); + WINBASEAPI WINBOOL WINAPI DeleteTimerQueue(HANDLE TimerQueue); + +#define HW_PROFILE_GUIDLEN 39 +#define MAX_PROFILE_LEN 80 + +#define DOCKINFO_UNDOCKED (0x1) +#define DOCKINFO_DOCKED (0x2) +#define DOCKINFO_USER_SUPPLIED (0x4) +#define DOCKINFO_USER_UNDOCKED (DOCKINFO_USER_SUPPLIED | DOCKINFO_UNDOCKED) +#define DOCKINFO_USER_DOCKED (DOCKINFO_USER_SUPPLIED | DOCKINFO_DOCKED) + + typedef struct tagHW_PROFILE_INFOA { + DWORD dwDockInfo; + CHAR szHwProfileGuid[HW_PROFILE_GUIDLEN]; + CHAR szHwProfileName[MAX_PROFILE_LEN]; + } HW_PROFILE_INFOA,*LPHW_PROFILE_INFOA; + + typedef struct tagHW_PROFILE_INFOW { + DWORD dwDockInfo; + WCHAR szHwProfileGuid[HW_PROFILE_GUIDLEN]; + WCHAR szHwProfileName[MAX_PROFILE_LEN]; + } HW_PROFILE_INFOW,*LPHW_PROFILE_INFOW; + +#ifdef UNICODE + typedef HW_PROFILE_INFOW HW_PROFILE_INFO; + typedef LPHW_PROFILE_INFOW LPHW_PROFILE_INFO; +#else + typedef HW_PROFILE_INFOA HW_PROFILE_INFO; + typedef LPHW_PROFILE_INFOA LPHW_PROFILE_INFO; +#endif + +#ifdef UNICODE +#define GetCurrentHwProfile GetCurrentHwProfileW +#define GetVersionEx GetVersionExW +#define VerifyVersionInfo VerifyVersionInfoW +#else +#define GetCurrentHwProfile GetCurrentHwProfileA +#define GetVersionEx GetVersionExA +#define VerifyVersionInfo VerifyVersionInfoA +#endif + + WINADVAPI WINBOOL WINAPI GetCurrentHwProfileA (LPHW_PROFILE_INFOA lpHwProfileInfo); + WINADVAPI WINBOOL WINAPI GetCurrentHwProfileW (LPHW_PROFILE_INFOW lpHwProfileInfo); + WINBASEAPI WINBOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount); + WINBASEAPI WINBOOL WINAPI QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency); + WINBASEAPI WINBOOL WINAPI GetVersionExA(LPOSVERSIONINFOA lpVersionInformation); + WINBASEAPI WINBOOL WINAPI GetVersionExW(LPOSVERSIONINFOW lpVersionInformation); + WINBASEAPI WINBOOL WINAPI VerifyVersionInfoA(LPOSVERSIONINFOEXA lpVersionInformation,DWORD dwTypeMask,DWORDLONG dwlConditionMask); + WINBASEAPI WINBOOL WINAPI VerifyVersionInfoW(LPOSVERSIONINFOEXW lpVersionInformation,DWORD dwTypeMask,DWORDLONG dwlConditionMask); + +#include + +#define TC_NORMAL 0 +#define TC_HARDERR 1 +#define TC_GP_TRAP 2 +#define TC_SIGNAL 3 + +#define AC_LINE_OFFLINE 0x0 +#define AC_LINE_ONLINE 0x1 +#define AC_LINE_BACKUP_POWER 0x2 +#define AC_LINE_UNKNOWN 0xff + +#define BATTERY_FLAG_HIGH 0x1 +#define BATTERY_FLAG_LOW 0x2 +#define BATTERY_FLAG_CRITICAL 0x4 +#define BATTERY_FLAG_CHARGING 0x8 +#define BATTERY_FLAG_NO_BATTERY 0x80 +#define BATTERY_FLAG_UNKNOWN 0xff + +#define BATTERY_PERCENTAGE_UNKNOWN 0xff + +#define BATTERY_LIFE_UNKNOWN 0xffffffff + + typedef struct _SYSTEM_POWER_STATUS { + BYTE ACLineStatus; + BYTE BatteryFlag; + BYTE BatteryLifePercent; + BYTE Reserved1; + DWORD BatteryLifeTime; + DWORD BatteryFullLifeTime; + } SYSTEM_POWER_STATUS,*LPSYSTEM_POWER_STATUS; + +#ifdef UNICODE +#define CreateJobObject CreateJobObjectW +#define OpenJobObject OpenJobObjectW +#define FindFirstVolume FindFirstVolumeW +#define FindNextVolume FindNextVolumeW +#define FindFirstVolumeMountPoint FindFirstVolumeMountPointW +#define FindNextVolumeMountPoint FindNextVolumeMountPointW +#define SetVolumeMountPoint SetVolumeMountPointW +#define DeleteVolumeMountPoint DeleteVolumeMountPointW +#define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointW +#define GetVolumePathName GetVolumePathNameW +#define GetVolumePathNamesForVolumeName GetVolumePathNamesForVolumeNameW +#else +#define CreateJobObject CreateJobObjectA +#define OpenJobObject OpenJobObjectA +#define FindFirstVolume FindFirstVolumeA +#define FindNextVolume FindNextVolumeA +#define FindFirstVolumeMountPoint FindFirstVolumeMountPointA +#define FindNextVolumeMountPoint FindNextVolumeMountPointA +#define SetVolumeMountPoint SetVolumeMountPointA +#define DeleteVolumeMountPoint DeleteVolumeMountPointA +#define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointA +#define GetVolumePathName GetVolumePathNameA +#define GetVolumePathNamesForVolumeName GetVolumePathNamesForVolumeNameA +#endif + + WINBOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS lpSystemPowerStatus); + WINBOOL WINAPI SetSystemPowerState(WINBOOL fSuspend,WINBOOL fForce); + WINBASEAPI WINBOOL WINAPI AllocateUserPhysicalPages(HANDLE hProcess,PULONG_PTR NumberOfPages,PULONG_PTR PageArray); + WINBASEAPI WINBOOL WINAPI FreeUserPhysicalPages(HANDLE hProcess,PULONG_PTR NumberOfPages,PULONG_PTR PageArray); + WINBASEAPI WINBOOL WINAPI MapUserPhysicalPages(PVOID VirtualAddress,ULONG_PTR NumberOfPages,PULONG_PTR PageArray); + WINBASEAPI WINBOOL WINAPI MapUserPhysicalPagesScatter(PVOID *VirtualAddresses,ULONG_PTR NumberOfPages,PULONG_PTR PageArray); + WINBASEAPI HANDLE WINAPI CreateJobObjectA(LPSECURITY_ATTRIBUTES lpJobAttributes,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenJobObjectA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenJobObjectW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + WINBASEAPI WINBOOL WINAPI AssignProcessToJobObject(HANDLE hJob,HANDLE hProcess); + WINBASEAPI WINBOOL WINAPI TerminateJobObject(HANDLE hJob,UINT uExitCode); + WINBASEAPI WINBOOL WINAPI QueryInformationJobObject(HANDLE hJob,JOBOBJECTINFOCLASS JobObjectInformationClass,LPVOID lpJobObjectInformation,DWORD cbJobObjectInformationLength,LPDWORD lpReturnLength); + WINBASEAPI WINBOOL WINAPI SetInformationJobObject(HANDLE hJob,JOBOBJECTINFOCLASS JobObjectInformationClass,LPVOID lpJobObjectInformation,DWORD cbJobObjectInformationLength); + WINBASEAPI WINBOOL WINAPI IsProcessInJob(HANDLE ProcessHandle,HANDLE JobHandle,PBOOL Result); + WINBASEAPI WINBOOL WINAPI CreateJobSet(ULONG NumJob,PJOB_SET_ARRAY UserJobSet,ULONG Flags); + WINBASEAPI PVOID WINAPI AddVectoredExceptionHandler (ULONG First,PVECTORED_EXCEPTION_HANDLER Handler); + WINBASEAPI ULONG WINAPI RemoveVectoredExceptionHandler(PVOID Handle); + WINBASEAPI PVOID WINAPI AddVectoredContinueHandler (ULONG First,PVECTORED_EXCEPTION_HANDLER Handler); + WINBASEAPI ULONG WINAPI RemoveVectoredContinueHandler(PVOID Handle); + WINBASEAPI HANDLE WINAPI FindFirstVolumeA(LPSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI HANDLE WINAPI FindFirstVolumeW(LPWSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindNextVolumeA(HANDLE hFindVolume,LPSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindNextVolumeW(HANDLE hFindVolume,LPWSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindVolumeClose(HANDLE hFindVolume); + WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointA(LPCSTR lpszRootPathName,LPSTR lpszVolumeMountPoint,DWORD cchBufferLength); + WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointW(LPCWSTR lpszRootPathName,LPWSTR lpszVolumeMountPoint,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindNextVolumeMountPointA(HANDLE hFindVolumeMountPoint,LPSTR lpszVolumeMountPoint,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindNextVolumeMountPointW(HANDLE hFindVolumeMountPoint,LPWSTR lpszVolumeMountPoint,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindVolumeMountPointClose(HANDLE hFindVolumeMountPoint); + WINBASEAPI WINBOOL WINAPI SetVolumeMountPointA(LPCSTR lpszVolumeMountPoint,LPCSTR lpszVolumeName); + WINBASEAPI WINBOOL WINAPI SetVolumeMountPointW(LPCWSTR lpszVolumeMountPoint,LPCWSTR lpszVolumeName); + WINBASEAPI WINBOOL WINAPI DeleteVolumeMountPointA(LPCSTR lpszVolumeMountPoint); + WINBASEAPI WINBOOL WINAPI DeleteVolumeMountPointW(LPCWSTR lpszVolumeMountPoint); + WINBASEAPI WINBOOL WINAPI GetVolumeNameForVolumeMountPointA(LPCSTR lpszVolumeMountPoint,LPSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI GetVolumeNameForVolumeMountPointW(LPCWSTR lpszVolumeMountPoint,LPWSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI GetVolumePathNameA(LPCSTR lpszFileName,LPSTR lpszVolumePathName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI GetVolumePathNameW(LPCWSTR lpszFileName,LPWSTR lpszVolumePathName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI GetVolumePathNamesForVolumeNameA(LPCSTR lpszVolumeName,LPCH lpszVolumePathNames,DWORD cchBufferLength,PDWORD lpcchReturnLength); + WINBASEAPI WINBOOL WINAPI GetVolumePathNamesForVolumeNameW(LPCWSTR lpszVolumeName,LPWCH lpszVolumePathNames,DWORD cchBufferLength,PDWORD lpcchReturnLength); + +#define ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID 0x1 +#define ACTCTX_FLAG_LANGID_VALID 0x2 +#define ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID 0x4 +#define ACTCTX_FLAG_RESOURCE_NAME_VALID 0x8 +#define ACTCTX_FLAG_SET_PROCESS_DEFAULT 0x10 +#define ACTCTX_FLAG_APPLICATION_NAME_VALID 0x20 +#define ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF 0x40 +#define ACTCTX_FLAG_HMODULE_VALID 0x80 + + typedef struct tagACTCTXA { + ULONG cbSize; + DWORD dwFlags; + LPCSTR lpSource; + USHORT wProcessorArchitecture; + LANGID wLangId; + LPCSTR lpAssemblyDirectory; + LPCSTR lpResourceName; + LPCSTR lpApplicationName; + HMODULE hModule; + } ACTCTXA,*PACTCTXA; + + typedef struct tagACTCTXW { + ULONG cbSize; + DWORD dwFlags; + LPCWSTR lpSource; + USHORT wProcessorArchitecture; + LANGID wLangId; + LPCWSTR lpAssemblyDirectory; + LPCWSTR lpResourceName; + LPCWSTR lpApplicationName; + HMODULE hModule; + } ACTCTXW,*PACTCTXW; + + typedef const ACTCTXA *PCACTCTXA; + typedef const ACTCTXW *PCACTCTXW; + +#ifdef UNICODE + typedef ACTCTXW ACTCTX; + typedef PACTCTXW PACTCTX; + typedef PCACTCTXW PCACTCTX; +#else + typedef ACTCTXA ACTCTX; + typedef PACTCTXA PACTCTX; + typedef PCACTCTXA PCACTCTX; +#endif + +#ifdef UNICODE +#define CreateActCtx CreateActCtxW +#else +#define CreateActCtx CreateActCtxA +#endif + + WINBASEAPI HANDLE WINAPI CreateActCtxA(PCACTCTXA pActCtx); + WINBASEAPI HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx); + WINBASEAPI VOID WINAPI AddRefActCtx(HANDLE hActCtx); + WINBASEAPI VOID WINAPI ReleaseActCtx(HANDLE hActCtx); + WINBASEAPI WINBOOL WINAPI ZombifyActCtx(HANDLE hActCtx); + WINBASEAPI WINBOOL WINAPI ActivateActCtx(HANDLE hActCtx,ULONG_PTR *lpCookie); + +#define DEACTIVATE_ACTCTX_FLAG_FORCE_EARLY_DEACTIVATION (0x1) + + WINBASEAPI WINBOOL WINAPI DeactivateActCtx(DWORD dwFlags,ULONG_PTR ulCookie); + WINBASEAPI WINBOOL WINAPI GetCurrentActCtx(HANDLE *lphActCtx); + + typedef struct tagACTCTX_SECTION_KEYED_DATA_2600 { + ULONG cbSize; + ULONG ulDataFormatVersion; + PVOID lpData; + ULONG ulLength; + PVOID lpSectionGlobalData; + ULONG ulSectionGlobalDataLength; + PVOID lpSectionBase; + ULONG ulSectionTotalLength; + HANDLE hActCtx; + ULONG ulAssemblyRosterIndex; + } ACTCTX_SECTION_KEYED_DATA_2600,*PACTCTX_SECTION_KEYED_DATA_2600; + + typedef const ACTCTX_SECTION_KEYED_DATA_2600 *PCACTCTX_SECTION_KEYED_DATA_2600; + + typedef struct tagACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA { + PVOID lpInformation; + PVOID lpSectionBase; + ULONG ulSectionLength; + PVOID lpSectionGlobalDataBase; + ULONG ulSectionGlobalDataLength; + } ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA,*PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; + + typedef const ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA *PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; + + typedef struct tagACTCTX_SECTION_KEYED_DATA { + ULONG cbSize; + ULONG ulDataFormatVersion; + PVOID lpData; + ULONG ulLength; + PVOID lpSectionGlobalData; + ULONG ulSectionGlobalDataLength; + PVOID lpSectionBase; + ULONG ulSectionTotalLength; + HANDLE hActCtx; + ULONG ulAssemblyRosterIndex; + + ULONG ulFlags; + ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA AssemblyMetadata; + } ACTCTX_SECTION_KEYED_DATA,*PACTCTX_SECTION_KEYED_DATA; + + typedef const ACTCTX_SECTION_KEYED_DATA *PCACTCTX_SECTION_KEYED_DATA; + +#define FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX 0x1 +#define FIND_ACTCTX_SECTION_KEY_RETURN_FLAGS 0x2 +#define FIND_ACTCTX_SECTION_KEY_RETURN_ASSEMBLY_METADATA 0x4 + +#ifdef UNICODE +#define FindActCtxSectionString FindActCtxSectionStringW +#else +#define FindActCtxSectionString FindActCtxSectionStringA +#endif + + WINBASEAPI WINBOOL WINAPI FindActCtxSectionStringA(DWORD dwFlags,const GUID *lpExtensionGuid,ULONG ulSectionId,LPCSTR lpStringToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); + WINBASEAPI WINBOOL WINAPI FindActCtxSectionStringW(DWORD dwFlags,const GUID *lpExtensionGuid,ULONG ulSectionId,LPCWSTR lpStringToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); + WINBASEAPI WINBOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags,const GUID *lpExtensionGuid,ULONG ulSectionId,const GUID *lpGuidToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); + +#ifndef RC_INVOKED +#ifndef ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED + + typedef struct _ACTIVATION_CONTEXT_BASIC_INFORMATION { + HANDLE hActCtx; + DWORD dwFlags; + } ACTIVATION_CONTEXT_BASIC_INFORMATION,*PACTIVATION_CONTEXT_BASIC_INFORMATION; + + typedef const struct _ACTIVATION_CONTEXT_BASIC_INFORMATION *PCACTIVATION_CONTEXT_BASIC_INFORMATION; + +#define ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED 1 +#endif +#endif + +#define QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX 0x4 +#define QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE 0x8 +#define QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS 0x10 +#define QUERY_ACTCTX_FLAG_NO_ADDREF 0x80000000 + + WINBASEAPI WINBOOL WINAPI QueryActCtxW(DWORD dwFlags,HANDLE hActCtx,PVOID pvSubInstance,ULONG ulInfoClass,PVOID pvBuffer,SIZE_T cbBuffer,SIZE_T *pcbWrittenOrRequired); + + typedef WINBOOL (WINAPI *PQUERYACTCTXW_FUNC)(DWORD dwFlags,HANDLE hActCtx,PVOID pvSubInstance,ULONG ulInfoClass,PVOID pvBuffer,SIZE_T cbBuffer,SIZE_T *pcbWrittenOrRequired); + + WINBASEAPI WINBOOL WINAPI ProcessIdToSessionId(DWORD dwProcessId,DWORD *pSessionId); + WINBASEAPI DWORD WINAPI WTSGetActiveConsoleSessionId(); + WINBASEAPI WINBOOL WINAPI IsWow64Process(HANDLE hProcess,PBOOL Wow64Process); + WINBASEAPI WINBOOL WINAPI GetLogicalProcessorInformation(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer,PDWORD ReturnedLength); + WINBASEAPI WINBOOL WINAPI GetNumaHighestNodeNumber(PULONG HighestNodeNumber); + WINBASEAPI WINBOOL WINAPI GetNumaProcessorNode(UCHAR Processor,PUCHAR NodeNumber); + WINBASEAPI WINBOOL WINAPI GetNumaNodeProcessorMask(UCHAR Node,PULONGLONG ProcessorMask); + WINBASEAPI WINBOOL WINAPI GetNumaAvailableMemoryNode(UCHAR Node,PULONGLONG AvailableBytes); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/wincon.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/wincon.h new file mode 100644 index 00000000..a3501ee7 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/wincon.h @@ -0,0 +1,301 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINCON_ +#define _WINCON_ + +#ifdef __cplusplus +extern "C" { +#endif + + typedef struct _COORD { + SHORT X; + SHORT Y; + } COORD,*PCOORD; + + typedef struct _SMALL_RECT { + SHORT Left; + SHORT Top; + SHORT Right; + SHORT Bottom; + } SMALL_RECT,*PSMALL_RECT; + + typedef struct _KEY_EVENT_RECORD { + WINBOOL bKeyDown; + WORD wRepeatCount; + WORD wVirtualKeyCode; + WORD wVirtualScanCode; + union { + WCHAR UnicodeChar; + CHAR AsciiChar; + } uChar; + DWORD dwControlKeyState; + } KEY_EVENT_RECORD,*PKEY_EVENT_RECORD; + +#define RIGHT_ALT_PRESSED 0x1 +#define LEFT_ALT_PRESSED 0x2 +#define RIGHT_CTRL_PRESSED 0x4 +#define LEFT_CTRL_PRESSED 0x8 +#define SHIFT_PRESSED 0x10 +#define NUMLOCK_ON 0x20 +#define SCROLLLOCK_ON 0x40 +#define CAPSLOCK_ON 0x80 +#define ENHANCED_KEY 0x100 +#define NLS_DBCSCHAR 0x10000 +#define NLS_ALPHANUMERIC 0x0 +#define NLS_KATAKANA 0x20000 +#define NLS_HIRAGANA 0x40000 +#define NLS_ROMAN 0x400000 +#define NLS_IME_CONVERSION 0x800000 +#define NLS_IME_DISABLE 0x20000000 + + typedef struct _MOUSE_EVENT_RECORD { + COORD dwMousePosition; + DWORD dwButtonState; + DWORD dwControlKeyState; + DWORD dwEventFlags; + } MOUSE_EVENT_RECORD,*PMOUSE_EVENT_RECORD; + +#define FROM_LEFT_1ST_BUTTON_PRESSED 0x1 +#define RIGHTMOST_BUTTON_PRESSED 0x2 +#define FROM_LEFT_2ND_BUTTON_PRESSED 0x4 +#define FROM_LEFT_3RD_BUTTON_PRESSED 0x8 +#define FROM_LEFT_4TH_BUTTON_PRESSED 0x10 + +#define MOUSE_MOVED 0x1 +#define DOUBLE_CLICK 0x2 +#define MOUSE_WHEELED 0x4 + + typedef struct _WINDOW_BUFFER_SIZE_RECORD { + COORD dwSize; + } WINDOW_BUFFER_SIZE_RECORD,*PWINDOW_BUFFER_SIZE_RECORD; + + typedef struct _MENU_EVENT_RECORD { + UINT dwCommandId; + } MENU_EVENT_RECORD,*PMENU_EVENT_RECORD; + + typedef struct _FOCUS_EVENT_RECORD { + WINBOOL bSetFocus; + } FOCUS_EVENT_RECORD,*PFOCUS_EVENT_RECORD; + + typedef struct _INPUT_RECORD { + WORD EventType; + union { + KEY_EVENT_RECORD KeyEvent; + MOUSE_EVENT_RECORD MouseEvent; + WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent; + MENU_EVENT_RECORD MenuEvent; + FOCUS_EVENT_RECORD FocusEvent; + } Event; + } INPUT_RECORD,*PINPUT_RECORD; + +#define KEY_EVENT 0x1 +#define MOUSE_EVENT 0x2 +#define WINDOW_BUFFER_SIZE_EVENT 0x4 +#define MENU_EVENT 0x8 +#define FOCUS_EVENT 0x10 + + typedef struct _CHAR_INFO { + union { + WCHAR UnicodeChar; + CHAR AsciiChar; + } Char; + WORD Attributes; + } CHAR_INFO,*PCHAR_INFO; + +#define FOREGROUND_BLUE 0x1 +#define FOREGROUND_GREEN 0x2 +#define FOREGROUND_RED 0x4 +#define FOREGROUND_INTENSITY 0x8 +#define BACKGROUND_BLUE 0x10 +#define BACKGROUND_GREEN 0x20 +#define BACKGROUND_RED 0x40 +#define BACKGROUND_INTENSITY 0x80 +#define COMMON_LVB_LEADING_BYTE 0x100 +#define COMMON_LVB_TRAILING_BYTE 0x200 +#define COMMON_LVB_GRID_HORIZONTAL 0x400 +#define COMMON_LVB_GRID_LVERTICAL 0x800 +#define COMMON_LVB_GRID_RVERTICAL 0x1000 +#define COMMON_LVB_REVERSE_VIDEO 0x4000 +#define COMMON_LVB_UNDERSCORE 0x8000 + +#define COMMON_LVB_SBCSDBCS 0x300 + + typedef struct _CONSOLE_SCREEN_BUFFER_INFO { + COORD dwSize; + COORD dwCursorPosition; + WORD wAttributes; + SMALL_RECT srWindow; + COORD dwMaximumWindowSize; + } CONSOLE_SCREEN_BUFFER_INFO,*PCONSOLE_SCREEN_BUFFER_INFO; + + typedef struct _CONSOLE_CURSOR_INFO { + DWORD dwSize; + WINBOOL bVisible; + } CONSOLE_CURSOR_INFO,*PCONSOLE_CURSOR_INFO; + + typedef struct _CONSOLE_FONT_INFO { + DWORD nFont; + COORD dwFontSize; + } CONSOLE_FONT_INFO,*PCONSOLE_FONT_INFO; + + typedef struct _CONSOLE_SELECTION_INFO { + DWORD dwFlags; + COORD dwSelectionAnchor; + SMALL_RECT srSelection; + } CONSOLE_SELECTION_INFO,*PCONSOLE_SELECTION_INFO; + +#define CONSOLE_NO_SELECTION 0x0 +#define CONSOLE_SELECTION_IN_PROGRESS 0x1 +#define CONSOLE_SELECTION_NOT_EMPTY 0x2 +#define CONSOLE_MOUSE_SELECTION 0x4 +#define CONSOLE_MOUSE_DOWN 0x8 + + typedef WINBOOL (WINAPI *PHANDLER_ROUTINE)(DWORD CtrlType); + +#define CTRL_C_EVENT 0 +#define CTRL_BREAK_EVENT 1 +#define CTRL_CLOSE_EVENT 2 + +#define CTRL_LOGOFF_EVENT 5 +#define CTRL_SHUTDOWN_EVENT 6 + +#define ENABLE_PROCESSED_INPUT 0x1 +#define ENABLE_LINE_INPUT 0x2 +#define ENABLE_ECHO_INPUT 0x4 +#define ENABLE_WINDOW_INPUT 0x8 +#define ENABLE_MOUSE_INPUT 0x10 + +#define ENABLE_PROCESSED_OUTPUT 0x1 +#define ENABLE_WRAP_AT_EOL_OUTPUT 0x2 + +#ifdef UNICODE +#define PeekConsoleInput PeekConsoleInputW +#define ReadConsoleInput ReadConsoleInputW +#define WriteConsoleInput WriteConsoleInputW +#define ReadConsoleOutput ReadConsoleOutputW +#define WriteConsoleOutput WriteConsoleOutputW +#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW +#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW +#define FillConsoleOutputCharacter FillConsoleOutputCharacterW +#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW +#define GetConsoleTitle GetConsoleTitleW +#define SetConsoleTitle SetConsoleTitleW +#define ReadConsole ReadConsoleW +#define WriteConsole WriteConsoleW +#define AddConsoleAlias AddConsoleAliasW +#define GetConsoleAlias GetConsoleAliasW +#define GetConsoleAliasesLength GetConsoleAliasesLengthW +#define GetConsoleAliasExesLength GetConsoleAliasExesLengthW +#define GetConsoleAliases GetConsoleAliasesW +#define GetConsoleAliasExes GetConsoleAliasExesW +#else +#define PeekConsoleInput PeekConsoleInputA +#define ReadConsoleInput ReadConsoleInputA +#define WriteConsoleInput WriteConsoleInputA +#define ReadConsoleOutput ReadConsoleOutputA +#define WriteConsoleOutput WriteConsoleOutputA +#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA +#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA +#define FillConsoleOutputCharacter FillConsoleOutputCharacterA +#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA +#define GetConsoleTitle GetConsoleTitleA +#define SetConsoleTitle SetConsoleTitleA +#define ReadConsole ReadConsoleA +#define WriteConsole WriteConsoleA +#define AddConsoleAlias AddConsoleAliasA +#define GetConsoleAlias GetConsoleAliasA +#define GetConsoleAliasesLength GetConsoleAliasesLengthA +#define GetConsoleAliasExesLength GetConsoleAliasExesLengthA +#define GetConsoleAliases GetConsoleAliasesA +#define GetConsoleAliasExes GetConsoleAliasExesA +#endif + + WINBASEAPI WINBOOL WINAPI PeekConsoleInputA(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); + WINBASEAPI WINBOOL WINAPI PeekConsoleInputW(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); + WINBASEAPI WINBOOL WINAPI ReadConsoleInputA(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); + WINBASEAPI WINBOOL WINAPI ReadConsoleInputW(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); + WINBASEAPI WINBOOL WINAPI WriteConsoleInputA(HANDLE hConsoleInput,CONST INPUT_RECORD *lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsWritten); + WINBASEAPI WINBOOL WINAPI WriteConsoleInputW(HANDLE hConsoleInput,CONST INPUT_RECORD *lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsWritten); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputA(HANDLE hConsoleOutput,PCHAR_INFO lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpReadRegion); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputW(HANDLE hConsoleOutput,PCHAR_INFO lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpReadRegion); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputA(HANDLE hConsoleOutput,CONST CHAR_INFO *lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpWriteRegion); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputW(HANDLE hConsoleOutput,CONST CHAR_INFO *lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpWriteRegion); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputCharacterA(HANDLE hConsoleOutput,LPSTR lpCharacter,DWORD nLength,COORD dwReadCoord,LPDWORD lpNumberOfCharsRead); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputCharacterW(HANDLE hConsoleOutput,LPWSTR lpCharacter,DWORD nLength,COORD dwReadCoord,LPDWORD lpNumberOfCharsRead); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputAttribute(HANDLE hConsoleOutput,LPWORD lpAttribute,DWORD nLength,COORD dwReadCoord,LPDWORD lpNumberOfAttrsRead); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput,LPCSTR lpCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputCharacterW(HANDLE hConsoleOutput,LPCWSTR lpCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputAttribute(HANDLE hConsoleOutput,CONST WORD *lpAttribute,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfAttrsWritten); + WINBASEAPI WINBOOL WINAPI FillConsoleOutputCharacterA(HANDLE hConsoleOutput,CHAR cCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); + WINBASEAPI WINBOOL WINAPI FillConsoleOutputCharacterW(HANDLE hConsoleOutput,WCHAR cCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); + WINBASEAPI WINBOOL WINAPI FillConsoleOutputAttribute(HANDLE hConsoleOutput,WORD wAttribute,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfAttrsWritten); + WINBASEAPI WINBOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle,LPDWORD lpMode); + WINBASEAPI WINBOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE hConsoleInput,LPDWORD lpNumberOfEvents); + WINBASEAPI WINBOOL WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); + WINBASEAPI COORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput); + WINBASEAPI WINBOOL WINAPI GetConsoleCursorInfo(HANDLE hConsoleOutput,PCONSOLE_CURSOR_INFO lpConsoleCursorInfo); + WINBASEAPI WINBOOL WINAPI GetCurrentConsoleFont(HANDLE hConsoleOutput,WINBOOL bMaximumWindow,PCONSOLE_FONT_INFO lpConsoleCurrentFont); + WINBASEAPI COORD WINAPI GetConsoleFontSize(HANDLE hConsoleOutput,DWORD nFont); + WINBASEAPI WINBOOL WINAPI GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo); + WINBASEAPI WINBOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD lpNumberOfMouseButtons); + WINBASEAPI WINBOOL WINAPI SetConsoleMode(HANDLE hConsoleHandle,DWORD dwMode); + WINBASEAPI WINBOOL WINAPI SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput); + WINBASEAPI WINBOOL WINAPI FlushConsoleInputBuffer(HANDLE hConsoleInput); + WINBASEAPI WINBOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput,COORD dwSize); + WINBASEAPI WINBOOL WINAPI SetConsoleCursorPosition(HANDLE hConsoleOutput,COORD dwCursorPosition); + WINBASEAPI WINBOOL WINAPI SetConsoleCursorInfo(HANDLE hConsoleOutput,CONST CONSOLE_CURSOR_INFO *lpConsoleCursorInfo); + WINBASEAPI WINBOOL WINAPI ScrollConsoleScreenBufferA(HANDLE hConsoleOutput,CONST SMALL_RECT *lpScrollRectangle,CONST SMALL_RECT *lpClipRectangle,COORD dwDestinationOrigin,CONST CHAR_INFO *lpFill); + WINBASEAPI WINBOOL WINAPI ScrollConsoleScreenBufferW(HANDLE hConsoleOutput,CONST SMALL_RECT *lpScrollRectangle,CONST SMALL_RECT *lpClipRectangle,COORD dwDestinationOrigin,CONST CHAR_INFO *lpFill); + WINBASEAPI WINBOOL WINAPI SetConsoleWindowInfo(HANDLE hConsoleOutput,WINBOOL bAbsolute,CONST SMALL_RECT *lpConsoleWindow); + WINBASEAPI WINBOOL WINAPI SetConsoleTextAttribute(HANDLE hConsoleOutput,WORD wAttributes); + WINBASEAPI WINBOOL WINAPI SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine,WINBOOL Add); + WINBASEAPI WINBOOL WINAPI GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,DWORD dwProcessGroupId); + WINBASEAPI WINBOOL WINAPI AllocConsole(VOID); + WINBASEAPI WINBOOL WINAPI FreeConsole(VOID); + WINBASEAPI WINBOOL WINAPI AttachConsole(DWORD dwProcessId); + +#define ATTACH_PARENT_PROCESS ((DWORD)-1) + + WINBASEAPI DWORD WINAPI GetConsoleTitleA(LPSTR lpConsoleTitle,DWORD nSize); + WINBASEAPI DWORD WINAPI GetConsoleTitleW(LPWSTR lpConsoleTitle,DWORD nSize); + WINBASEAPI WINBOOL WINAPI SetConsoleTitleA(LPCSTR lpConsoleTitle); + WINBASEAPI WINBOOL WINAPI SetConsoleTitleW(LPCWSTR lpConsoleTitle); + WINBASEAPI WINBOOL WINAPI ReadConsoleA(HANDLE hConsoleInput,LPVOID lpBuffer,DWORD nNumberOfCharsToRead,LPDWORD lpNumberOfCharsRead,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI ReadConsoleW(HANDLE hConsoleInput,LPVOID lpBuffer,DWORD nNumberOfCharsToRead,LPDWORD lpNumberOfCharsRead,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI WriteConsoleA(HANDLE hConsoleOutput,CONST VOID *lpBuffer,DWORD nNumberOfCharsToWrite,LPDWORD lpNumberOfCharsWritten,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI WriteConsoleW(HANDLE hConsoleOutput,CONST VOID *lpBuffer,DWORD nNumberOfCharsToWrite,LPDWORD lpNumberOfCharsWritten,LPVOID lpReserved); + +#define CONSOLE_TEXTMODE_BUFFER 1 + + WINBASEAPI HANDLE WINAPI CreateConsoleScreenBuffer(DWORD dwDesiredAccess,DWORD dwShareMode,CONST SECURITY_ATTRIBUTES *lpSecurityAttributes,DWORD dwFlags,LPVOID lpScreenBufferData); + WINBASEAPI UINT WINAPI GetConsoleCP(VOID); + WINBASEAPI WINBOOL WINAPI SetConsoleCP(UINT wCodePageID); + WINBASEAPI UINT WINAPI GetConsoleOutputCP(VOID); + WINBASEAPI WINBOOL WINAPI SetConsoleOutputCP(UINT wCodePageID); + +#define CONSOLE_FULLSCREEN 1 +#define CONSOLE_FULLSCREEN_HARDWARE 2 + + WINBASEAPI WINBOOL WINAPI GetConsoleDisplayMode(LPDWORD lpModeFlags); + WINBASEAPI HWND WINAPI GetConsoleWindow(VOID); + WINBASEAPI DWORD WINAPI GetConsoleProcessList(LPDWORD lpdwProcessList,DWORD dwProcessCount); + WINBASEAPI WINBOOL WINAPI AddConsoleAliasA(LPSTR Source,LPSTR Target,LPSTR ExeName); + WINBASEAPI WINBOOL WINAPI AddConsoleAliasW(LPWSTR Source,LPWSTR Target,LPWSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasA(LPSTR Source,LPSTR TargetBuffer,DWORD TargetBufferLength,LPSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasW(LPWSTR Source,LPWSTR TargetBuffer,DWORD TargetBufferLength,LPWSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthA(LPSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthA(VOID); + WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthW(VOID); + WINBASEAPI DWORD WINAPI GetConsoleAliasesA(LPSTR AliasBuffer,DWORD AliasBufferLength,LPSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasesW(LPWSTR AliasBuffer,DWORD AliasBufferLength,LPWSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasExesA(LPSTR ExeNameBuffer,DWORD ExeNameBufferLength); + WINBASEAPI DWORD WINAPI GetConsoleAliasExesW(LPWSTR ExeNameBuffer,DWORD ExeNameBufferLength); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/windef.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/windef.h new file mode 100644 index 00000000..d63bdef1 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/windef.h @@ -0,0 +1,293 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINDEF_ +#define _WINDEF_ + +#ifndef STRICT +#define STRICT 1 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#ifndef BASETYPES +#define BASETYPES + typedef unsigned long ULONG; + typedef ULONG *PULONG; + typedef unsigned short USHORT; + typedef USHORT *PUSHORT; + typedef unsigned char UCHAR; + typedef UCHAR *PUCHAR; + typedef char *PSZ; +#endif + +#define MAX_PATH 260 + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef IN +#define IN +#endif + +#ifndef OUT +#define OUT +#endif + +#ifndef OPTIONAL +#define OPTIONAL +#endif + +#undef far +#undef near +#undef pascal + +#define far +#define near +#define pascal __stdcall + +#define cdecl +#ifndef CDECL +#define CDECL +#endif +#ifndef CALLBACK +#define CALLBACK __stdcall +#endif +#ifndef WINAPI +#define WINAPI __stdcall +#endif +#define WINAPIV __cdecl +#define APIENTRY WINAPI +#define APIPRIVATE WINAPI +#define PASCAL WINAPI +#define WINAPI_INLINE WINAPI + +#undef FAR +#undef NEAR +#define FAR +#define NEAR +#ifndef CONST +#define CONST const +#endif + + typedef unsigned long DWORD; + typedef int WINBOOL; +#define BOOL WINBOOL + typedef unsigned char BYTE; + typedef unsigned short WORD; + typedef float FLOAT; + typedef FLOAT *PFLOAT; + typedef WINBOOL *PBOOL; + typedef WINBOOL *LPBOOL; + typedef BYTE *PBYTE; + typedef BYTE *LPBYTE; + typedef int *PINT; + typedef int *LPINT; + typedef WORD *PWORD; + typedef WORD *LPWORD; + typedef long *LPLONG; + typedef DWORD *PDWORD; + typedef DWORD *LPDWORD; + typedef void *LPVOID; +# ifndef _LPCVOID_DEFINED +#define _LPCVOID_DEFINED +typedef CONST void *LPCVOID; +#endif + typedef int INT; + typedef unsigned int UINT; + typedef unsigned int *PUINT; + +#ifndef NT_INCLUDED +#include +#endif + +//gr #include + + typedef UINT_PTR WPARAM; + typedef LONG_PTR LPARAM; + typedef LONG_PTR LRESULT; + +#ifndef __cplusplus +#ifndef NOMINMAX +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#endif +#endif + +#define MAKEWORD(a,b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8)) +#define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16)) +#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff)) +#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) +#define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff)) +#define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) + +#ifndef WIN_INTERNAL + DECLARE_HANDLE (HWND); + DECLARE_HANDLE (HHOOK); +#ifdef WINABLE + DECLARE_HANDLE (HEVENT); +#endif +#endif + + typedef WORD ATOM; + + typedef HANDLE *SPHANDLE; + typedef HANDLE *LPHANDLE; + typedef HANDLE HGLOBAL; + typedef HANDLE HLOCAL; + typedef HANDLE GLOBALHANDLE; + typedef HANDLE LOCALHANDLE; +#ifdef _WIN64 + typedef INT_PTR (WINAPI *FARPROC)(); + typedef INT_PTR (WINAPI *NEARPROC)(); + typedef INT_PTR (WINAPI *PROC)(); +#else + typedef int (WINAPI *FARPROC)(); + typedef int (WINAPI *NEARPROC)(); + typedef int (WINAPI *PROC)(); +#endif + + typedef void *HGDIOBJ; + + DECLARE_HANDLE(HKEY); + typedef HKEY *PHKEY; + + DECLARE_HANDLE(HACCEL); + DECLARE_HANDLE(HBITMAP); + DECLARE_HANDLE(HBRUSH); + DECLARE_HANDLE(HCOLORSPACE); + DECLARE_HANDLE(HDC); + DECLARE_HANDLE(HGLRC); + DECLARE_HANDLE(HDESK); + DECLARE_HANDLE(HENHMETAFILE); + DECLARE_HANDLE(HFONT); + DECLARE_HANDLE(HICON); + DECLARE_HANDLE(HMENU); + DECLARE_HANDLE(HMETAFILE); + DECLARE_HANDLE(HINSTANCE); + typedef HINSTANCE HMODULE; + DECLARE_HANDLE(HPALETTE); + DECLARE_HANDLE(HPEN); + DECLARE_HANDLE(HRGN); + DECLARE_HANDLE(HRSRC); + DECLARE_HANDLE(HSTR); + DECLARE_HANDLE(HTASK); + DECLARE_HANDLE(HWINSTA); + DECLARE_HANDLE(HKL); + DECLARE_HANDLE(HMONITOR); + DECLARE_HANDLE(HWINEVENTHOOK); + DECLARE_HANDLE(HUMPD); + + typedef int HFILE; + typedef HICON HCURSOR; + typedef DWORD COLORREF; + typedef DWORD *LPCOLORREF; + +#define HFILE_ERROR ((HFILE)-1) + + typedef struct tagRECT { + LONG left; + LONG top; + LONG right; + LONG bottom; + } RECT,*PRECT,*NPRECT,*LPRECT; + + typedef const RECT *LPCRECT; + + typedef struct _RECTL { + LONG left; + LONG top; + LONG right; + LONG bottom; + } RECTL,*PRECTL,*LPRECTL; + + typedef const RECTL *LPCRECTL; + + typedef struct tagPOINT { + LONG x; + LONG y; + } POINT,*PPOINT,*NPPOINT,*LPPOINT; + + typedef struct _POINTL { + LONG x; + LONG y; + } POINTL,*PPOINTL; + + typedef struct tagSIZE { + LONG cx; + LONG cy; + } SIZE,*PSIZE,*LPSIZE; + + typedef SIZE SIZEL; + typedef SIZE *PSIZEL,*LPSIZEL; + + typedef struct tagPOINTS { + SHORT x; + SHORT y; + } POINTS,*PPOINTS,*LPPOINTS; + + typedef struct _FILETIME { + DWORD dwLowDateTime; + DWORD dwHighDateTime; + } FILETIME,*PFILETIME,*LPFILETIME; +#define _FILETIME_ + +#define DM_UPDATE 1 +#define DM_COPY 2 +#define DM_PROMPT 4 +#define DM_MODIFY 8 + +#define DM_IN_BUFFER DM_MODIFY +#define DM_IN_PROMPT DM_PROMPT +#define DM_OUT_BUFFER DM_COPY +#define DM_OUT_DEFAULT DM_UPDATE + +#define DC_FIELDS 1 +#define DC_PAPERS 2 +#define DC_PAPERSIZE 3 +#define DC_MINEXTENT 4 +#define DC_MAXEXTENT 5 +#define DC_BINS 6 +#define DC_DUPLEX 7 +#define DC_SIZE 8 +#define DC_EXTRA 9 +#define DC_VERSION 10 +#define DC_DRIVER 11 +#define DC_BINNAMES 12 +#define DC_ENUMRESOLUTIONS 13 +#define DC_FILEDEPENDENCIES 14 +#define DC_TRUETYPE 15 +#define DC_PAPERNAMES 16 +#define DC_ORIENTATION 17 +#define DC_COPIES 18 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/windows.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/windows.h new file mode 100644 index 00000000..2660d7f0 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/windows.h @@ -0,0 +1,127 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINDOWS_ +#define _WINDOWS_ + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#include <_mingw.h> + +#ifndef _INC_WINDOWS +#define _INC_WINDOWS + +#if defined(RC_INVOKED) && !defined(NOWINRES) + +#include +#else + +#ifdef RC_INVOKED +#define NOATOM +#define NOGDI +#define NOGDICAPMASKS +#define NOMETAFILE +#define NOMINMAX +#define NOMSG +#define NOOPENFILE +#define NORASTEROPS +#define NOSCROLL +#define NOSOUND +#define NOSYSMETRICS +#define NOTEXTMETRIC +#define NOWH +#define NOCOMM +#define NOKANJI +#define NOCRYPT +#define NOMCX +#endif + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && (defined(_X86_) && !defined(__x86_64)) +#define I_X86_ +#endif + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(__x86_64) +#define _AMD64_ +#endif + +#if !defined(I_X86_) && !(defined(_X86_) && !defined(__x86_64)) && !defined(_AMD64_) && defined(__ia64__) +#if !defined(_IA64_) +#define _IA64_ +#endif +#endif + +#ifndef RC_INVOKED +#include +#include +#endif + +#include +#include +#include +#include +//gr #include +#include +#include +#include +//gr #include + +#ifndef WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef NOCRYPT +#include +#include +#include +#endif + +#ifndef NOUSER +#ifndef NOGDI +#include +#ifdef INC_OLE1 +#include +#else +#include +#endif +#include +#endif +#endif +#endif + +//gr #include + +#ifdef INC_OLE2 +#include +#endif + +#ifndef NOSERVICE +#include +#endif + +#ifndef NOMCX +#include +#endif + +#ifndef NOIME +#include +#endif + +#endif +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winerror.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winerror.h new file mode 100644 index 00000000..77d85edc --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winerror.h @@ -0,0 +1,3166 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINERROR_ +#define _WINERROR_ + +#define FACILITY_WINDOWSUPDATE 36 +#define FACILITY_WINDOWS_CE 24 +#define FACILITY_WINDOWS 8 +#define FACILITY_URT 19 +#define FACILITY_UMI 22 +#define FACILITY_SXS 23 +#define FACILITY_STORAGE 3 +#define FACILITY_STATE_MANAGEMENT 34 +#define FACILITY_SSPI 9 +#define FACILITY_SCARD 16 +#define FACILITY_SETUPAPI 15 +#define FACILITY_SECURITY 9 +#define FACILITY_RPC 1 +#define FACILITY_WIN32 7 +#define FACILITY_CONTROL 10 +#define FACILITY_NULL 0 +#define FACILITY_METADIRECTORY 35 +#define FACILITY_MSMQ 14 +#define FACILITY_MEDIASERVER 13 +#define FACILITY_INTERNET 12 +#define FACILITY_ITF 4 +#define FACILITY_HTTP 25 +#define FACILITY_DPLAY 21 +#define FACILITY_DISPATCH 2 +#define FACILITY_DIRECTORYSERVICE 37 +#define FACILITY_CONFIGURATION 33 +#define FACILITY_COMPLUS 17 +#define FACILITY_CERT 11 +#define FACILITY_BACKGROUNDCOPY 32 +#define FACILITY_ACS 20 +#define FACILITY_AAF 18 +#define ERROR_SUCCESS 0L +#define NO_ERROR 0L +#define SEC_E_OK ((HRESULT)0x00000000L) +#define ERROR_INVALID_FUNCTION 1L +#define ERROR_FILE_NOT_FOUND 2L +#define ERROR_PATH_NOT_FOUND 3L +#define ERROR_TOO_MANY_OPEN_FILES 4L +#define ERROR_ACCESS_DENIED 5L +#define ERROR_INVALID_HANDLE 6L +#define ERROR_ARENA_TRASHED 7L +#define ERROR_NOT_ENOUGH_MEMORY 8L +#define ERROR_INVALID_BLOCK 9L +#define ERROR_BAD_ENVIRONMENT 10L +#define ERROR_BAD_FORMAT 11L +#define ERROR_INVALID_ACCESS 12L +#define ERROR_INVALID_DATA 13L +#define ERROR_OUTOFMEMORY 14L +#define ERROR_INVALID_DRIVE 15L +#define ERROR_CURRENT_DIRECTORY 16L +#define ERROR_NOT_SAME_DEVICE 17L +#define ERROR_NO_MORE_FILES 18L +#define ERROR_WRITE_PROTECT 19L +#define ERROR_BAD_UNIT 20L +#define ERROR_NOT_READY 21L +#define ERROR_BAD_COMMAND 22L +#define ERROR_CRC 23L +#define ERROR_BAD_LENGTH 24L +#define ERROR_SEEK 25L +#define ERROR_NOT_DOS_DISK 26L +#define ERROR_SECTOR_NOT_FOUND 27L +#define ERROR_OUT_OF_PAPER 28L +#define ERROR_WRITE_FAULT 29L +#define ERROR_READ_FAULT 30L +#define ERROR_GEN_FAILURE 31L +#define ERROR_SHARING_VIOLATION 32L +#define ERROR_LOCK_VIOLATION 33L +#define ERROR_WRONG_DISK 34L +#define ERROR_SHARING_BUFFER_EXCEEDED 36L +#define ERROR_HANDLE_EOF 38L +#define ERROR_HANDLE_DISK_FULL 39L +#define ERROR_NOT_SUPPORTED 50L +#define ERROR_REM_NOT_LIST 51L +#define ERROR_DUP_NAME 52L +#define ERROR_BAD_NETPATH 53L +#define ERROR_NETWORK_BUSY 54L +#define ERROR_DEV_NOT_EXIST 55L +#define ERROR_TOO_MANY_CMDS 56L +#define ERROR_ADAP_HDW_ERR 57L +#define ERROR_BAD_NET_RESP 58L +#define ERROR_UNEXP_NET_ERR 59L +#define ERROR_BAD_REM_ADAP 60L +#define ERROR_PRINTQ_FULL 61L +#define ERROR_NO_SPOOL_SPACE 62L +#define ERROR_PRINT_CANCELLED 63L +#define ERROR_NETNAME_DELETED 64L +#define ERROR_NETWORK_ACCESS_DENIED 65L +#define ERROR_BAD_DEV_TYPE 66L +#define ERROR_BAD_NET_NAME 67L +#define ERROR_TOO_MANY_NAMES 68L +#define ERROR_TOO_MANY_SESS 69L +#define ERROR_SHARING_PAUSED 70L +#define ERROR_REQ_NOT_ACCEP 71L +#define ERROR_REDIR_PAUSED 72L +#define ERROR_FILE_EXISTS 80L +#define ERROR_CANNOT_MAKE 82L +#define ERROR_FAIL_I24 83L +#define ERROR_OUT_OF_STRUCTURES 84L +#define ERROR_ALREADY_ASSIGNED 85L +#define ERROR_INVALID_PASSWORD 86L +#define ERROR_INVALID_PARAMETER 87L +#define ERROR_NET_WRITE_FAULT 88L +#define ERROR_NO_PROC_SLOTS 89L +#define ERROR_TOO_MANY_SEMAPHORES 100L +#define ERROR_EXCL_SEM_ALREADY_OWNED 101L +#define ERROR_SEM_IS_SET 102L +#define ERROR_TOO_MANY_SEM_REQUESTS 103L +#define ERROR_INVALID_AT_INTERRUPT_TIME 104L +#define ERROR_SEM_OWNER_DIED 105L +#define ERROR_SEM_USER_LIMIT 106L +#define ERROR_DISK_CHANGE 107L +#define ERROR_DRIVE_LOCKED 108L +#define ERROR_BROKEN_PIPE 109L +#define ERROR_OPEN_FAILED 110L +#define ERROR_BUFFER_OVERFLOW 111L +#define ERROR_DISK_FULL 112L +#define ERROR_NO_MORE_SEARCH_HANDLES 113L +#define ERROR_INVALID_TARGET_HANDLE 114L +#define ERROR_INVALID_CATEGORY 117L +#define ERROR_INVALID_VERIFY_SWITCH 118L +#define ERROR_BAD_DRIVER_LEVEL 119L +#define ERROR_CALL_NOT_IMPLEMENTED 120L +#define ERROR_SEM_TIMEOUT 121L +#define ERROR_INSUFFICIENT_BUFFER 122L +#define ERROR_INVALID_NAME 123L +#define ERROR_INVALID_LEVEL 124L +#define ERROR_NO_VOLUME_LABEL 125L +#define ERROR_MOD_NOT_FOUND 126L +#define ERROR_PROC_NOT_FOUND 127L +#define ERROR_WAIT_NO_CHILDREN 128L +#define ERROR_CHILD_NOT_COMPLETE 129L +#define ERROR_DIRECT_ACCESS_HANDLE 130L +#define ERROR_NEGATIVE_SEEK 131L +#define ERROR_SEEK_ON_DEVICE 132L +#define ERROR_IS_JOIN_TARGET 133L +#define ERROR_IS_JOINED 134L +#define ERROR_IS_SUBSTED 135L +#define ERROR_NOT_JOINED 136L +#define ERROR_NOT_SUBSTED 137L +#define ERROR_JOIN_TO_JOIN 138L +#define ERROR_SUBST_TO_SUBST 139L +#define ERROR_JOIN_TO_SUBST 140L +#define ERROR_SUBST_TO_JOIN 141L +#define ERROR_BUSY_DRIVE 142L +#define ERROR_SAME_DRIVE 143L +#define ERROR_DIR_NOT_ROOT 144L +#define ERROR_DIR_NOT_EMPTY 145L +#define ERROR_IS_SUBST_PATH 146L +#define ERROR_IS_JOIN_PATH 147L +#define ERROR_PATH_BUSY 148L +#define ERROR_IS_SUBST_TARGET 149L +#define ERROR_SYSTEM_TRACE 150L +#define ERROR_INVALID_EVENT_COUNT 151L +#define ERROR_TOO_MANY_MUXWAITERS 152L +#define ERROR_INVALID_LIST_FORMAT 153L +#define ERROR_LABEL_TOO_LONG 154L +#define ERROR_TOO_MANY_TCBS 155L +#define ERROR_SIGNAL_REFUSED 156L +#define ERROR_DISCARDED 157L +#define ERROR_NOT_LOCKED 158L +#define ERROR_BAD_THREADID_ADDR 159L +#define ERROR_BAD_ARGUMENTS 160L +#define ERROR_BAD_PATHNAME 161L +#define ERROR_SIGNAL_PENDING 162L +#define ERROR_MAX_THRDS_REACHED 164L +#define ERROR_LOCK_FAILED 167L +#define ERROR_BUSY 170L +#define ERROR_CANCEL_VIOLATION 173L +#define ERROR_ATOMIC_LOCKS_NOT_SUPPORTED 174L +#define ERROR_INVALID_SEGMENT_NUMBER 180L +#define ERROR_INVALID_ORDINAL 182L +#define ERROR_ALREADY_EXISTS 183L +#define ERROR_INVALID_FLAG_NUMBER 186L +#define ERROR_SEM_NOT_FOUND 187L +#define ERROR_INVALID_STARTING_CODESEG 188L +#define ERROR_INVALID_STACKSEG 189L +#define ERROR_INVALID_MODULETYPE 190L +#define ERROR_INVALID_EXE_SIGNATURE 191L +#define ERROR_EXE_MARKED_INVALID 192L +#define ERROR_BAD_EXE_FORMAT 193L +#define ERROR_ITERATED_DATA_EXCEEDS_64k 194L +#define ERROR_INVALID_MINALLOCSIZE 195L +#define ERROR_DYNLINK_FROM_INVALID_RING 196L +#define ERROR_IOPL_NOT_ENABLED 197L +#define ERROR_INVALID_SEGDPL 198L +#define ERROR_AUTODATASEG_EXCEEDS_64k 199L +#define ERROR_RING2SEG_MUST_BE_MOVABLE 200L +#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201L +#define ERROR_INFLOOP_IN_RELOC_CHAIN 202L +#define ERROR_ENVVAR_NOT_FOUND 203L +#define ERROR_NO_SIGNAL_SENT 205L +#define ERROR_FILENAME_EXCED_RANGE 206L +#define ERROR_RING2_STACK_IN_USE 207L +#define ERROR_META_EXPANSION_TOO_LONG 208L +#define ERROR_INVALID_SIGNAL_NUMBER 209L +#define ERROR_THREAD_1_INACTIVE 210L +#define ERROR_LOCKED 212L +#define ERROR_TOO_MANY_MODULES 214L +#define ERROR_NESTING_NOT_ALLOWED 215L +#define ERROR_EXE_MACHINE_TYPE_MISMATCH 216L +#define ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY 217L +#define ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY 218L +#define ERROR_BAD_PIPE 230L +#define ERROR_PIPE_BUSY 231L +#define ERROR_NO_DATA 232L +#define ERROR_PIPE_NOT_CONNECTED 233L +#define ERROR_MORE_DATA 234L +#define ERROR_VC_DISCONNECTED 240L +#define ERROR_INVALID_EA_NAME 254L +#define ERROR_EA_LIST_INCONSISTENT 255L +#define WAIT_TIMEOUT 258L +#define ERROR_NO_MORE_ITEMS 259L +#define ERROR_CANNOT_COPY 266L +#define ERROR_DIRECTORY 267L +#define ERROR_EAS_DIDNT_FIT 275L +#define ERROR_EA_FILE_CORRUPT 276L +#define ERROR_EA_TABLE_FULL 277L +#define ERROR_INVALID_EA_HANDLE 278L +#define ERROR_EAS_NOT_SUPPORTED 282L +#define ERROR_NOT_OWNER 288L +#define ERROR_TOO_MANY_POSTS 298L +#define ERROR_PARTIAL_COPY 299L +#define ERROR_OPLOCK_NOT_GRANTED 300L +#define ERROR_INVALID_OPLOCK_PROTOCOL 301L +#define ERROR_DISK_TOO_FRAGMENTED 302L +#define ERROR_DELETE_PENDING 303L +#define ERROR_MR_MID_NOT_FOUND 317L +#define ERROR_SCOPE_NOT_FOUND 318L +#define ERROR_INVALID_ADDRESS 487L +#define ERROR_ARITHMETIC_OVERFLOW 534L +#define ERROR_PIPE_CONNECTED 535L +#define ERROR_PIPE_LISTENING 536L +#define ERROR_EA_ACCESS_DENIED 994L +#define ERROR_OPERATION_ABORTED 995L +#define ERROR_IO_INCOMPLETE 996L +#define ERROR_IO_PENDING 997L +#define ERROR_NOACCESS 998L +#define ERROR_SWAPERROR 999L +#define ERROR_STACK_OVERFLOW 1001L +#define ERROR_INVALID_MESSAGE 1002L +#define ERROR_CAN_NOT_COMPLETE 1003L +#define ERROR_INVALID_FLAGS 1004L +#define ERROR_UNRECOGNIZED_VOLUME 1005L +#define ERROR_FILE_INVALID 1006L +#define ERROR_FULLSCREEN_MODE 1007L +#define ERROR_NO_TOKEN 1008L +#define ERROR_BADDB 1009L +#define ERROR_BADKEY 1010L +#define ERROR_CANTOPEN 1011L +#define ERROR_CANTREAD 1012L +#define ERROR_CANTWRITE 1013L +#define ERROR_REGISTRY_RECOVERED 1014L +#define ERROR_REGISTRY_CORRUPT 1015L +#define ERROR_REGISTRY_IO_FAILED 1016L +#define ERROR_NOT_REGISTRY_FILE 1017L +#define ERROR_KEY_DELETED 1018L +#define ERROR_NO_LOG_SPACE 1019L +#define ERROR_KEY_HAS_CHILDREN 1020L +#define ERROR_CHILD_MUST_BE_VOLATILE 1021L +#define ERROR_NOTIFY_ENUM_DIR 1022L +#define ERROR_DEPENDENT_SERVICES_RUNNING 1051L +#define ERROR_INVALID_SERVICE_CONTROL 1052L +#define ERROR_SERVICE_REQUEST_TIMEOUT 1053L +#define ERROR_SERVICE_NO_THREAD 1054L +#define ERROR_SERVICE_DATABASE_LOCKED 1055L +#define ERROR_SERVICE_ALREADY_RUNNING 1056L +#define ERROR_INVALID_SERVICE_ACCOUNT 1057L +#define ERROR_SERVICE_DISABLED 1058L +#define ERROR_CIRCULAR_DEPENDENCY 1059L +#define ERROR_SERVICE_DOES_NOT_EXIST 1060L +#define ERROR_SERVICE_CANNOT_ACCEPT_CTRL 1061L +#define ERROR_SERVICE_NOT_ACTIVE 1062L +#define ERROR_FAILED_SERVICE_CONTROLLER_CONNECT 1063L +#define ERROR_EXCEPTION_IN_SERVICE 1064L +#define ERROR_DATABASE_DOES_NOT_EXIST 1065L +#define ERROR_SERVICE_SPECIFIC_ERROR 1066L +#define ERROR_PROCESS_ABORTED 1067L +#define ERROR_SERVICE_DEPENDENCY_FAIL 1068L +#define ERROR_SERVICE_LOGON_FAILED 1069L +#define ERROR_SERVICE_START_HANG 1070L +#define ERROR_INVALID_SERVICE_LOCK 1071L +#define ERROR_SERVICE_MARKED_FOR_DELETE 1072L +#define ERROR_SERVICE_EXISTS 1073L +#define ERROR_ALREADY_RUNNING_LKG 1074L +#define ERROR_SERVICE_DEPENDENCY_DELETED 1075L +#define ERROR_BOOT_ALREADY_ACCEPTED 1076L +#define ERROR_SERVICE_NEVER_STARTED 1077L +#define ERROR_DUPLICATE_SERVICE_NAME 1078L +#define ERROR_DIFFERENT_SERVICE_ACCOUNT 1079L +#define ERROR_CANNOT_DETECT_DRIVER_FAILURE 1080L +#define ERROR_CANNOT_DETECT_PROCESS_ABORT 1081L +#define ERROR_NO_RECOVERY_PROGRAM 1082L +#define ERROR_SERVICE_NOT_IN_EXE 1083L +#define ERROR_NOT_SAFEBOOT_SERVICE 1084L +#define ERROR_END_OF_MEDIA 1100L +#define ERROR_FILEMARK_DETECTED 1101L +#define ERROR_BEGINNING_OF_MEDIA 1102L +#define ERROR_SETMARK_DETECTED 1103L +#define ERROR_NO_DATA_DETECTED 1104L +#define ERROR_PARTITION_FAILURE 1105L +#define ERROR_INVALID_BLOCK_LENGTH 1106L +#define ERROR_DEVICE_NOT_PARTITIONED 1107L +#define ERROR_UNABLE_TO_LOCK_MEDIA 1108L +#define ERROR_UNABLE_TO_UNLOAD_MEDIA 1109L +#define ERROR_MEDIA_CHANGED 1110L +#define ERROR_BUS_RESET 1111L +#define ERROR_NO_MEDIA_IN_DRIVE 1112L +#define ERROR_NO_UNICODE_TRANSLATION 1113L +#define ERROR_DLL_INIT_FAILED 1114L +#define ERROR_SHUTDOWN_IN_PROGRESS 1115L +#define ERROR_NO_SHUTDOWN_IN_PROGRESS 1116L +#define ERROR_IO_DEVICE 1117L +#define ERROR_SERIAL_NO_DEVICE 1118L +#define ERROR_IRQ_BUSY 1119L +#define ERROR_MORE_WRITES 1120L +#define ERROR_COUNTER_TIMEOUT 1121L +#define ERROR_FLOPPY_ID_MARK_NOT_FOUND 1122L +#define ERROR_FLOPPY_WRONG_CYLINDER 1123L +#define ERROR_FLOPPY_UNKNOWN_ERROR 1124L +#define ERROR_FLOPPY_BAD_REGISTERS 1125L +#define ERROR_DISK_RECALIBRATE_FAILED 1126L +#define ERROR_DISK_OPERATION_FAILED 1127L +#define ERROR_DISK_RESET_FAILED 1128L +#define ERROR_EOM_OVERFLOW 1129L +#define ERROR_NOT_ENOUGH_SERVER_MEMORY 1130L +#define ERROR_POSSIBLE_DEADLOCK 1131L +#define ERROR_MAPPED_ALIGNMENT 1132L +#define ERROR_SET_POWER_STATE_VETOED 1140L +#define ERROR_SET_POWER_STATE_FAILED 1141L +#define ERROR_TOO_MANY_LINKS 1142L +#define ERROR_OLD_WIN_VERSION 1150L +#define ERROR_APP_WRONG_OS 1151L +#define ERROR_SINGLE_INSTANCE_APP 1152L +#define ERROR_RMODE_APP 1153L +#define ERROR_INVALID_DLL 1154L +#define ERROR_NO_ASSOCIATION 1155L +#define ERROR_DDE_FAIL 1156L +#define ERROR_DLL_NOT_FOUND 1157L +#define ERROR_NO_MORE_USER_HANDLES 1158L +#define ERROR_MESSAGE_SYNC_ONLY 1159L +#define ERROR_SOURCE_ELEMENT_EMPTY 1160L +#define ERROR_DESTINATION_ELEMENT_FULL 1161L +#define ERROR_ILLEGAL_ELEMENT_ADDRESS 1162L +#define ERROR_MAGAZINE_NOT_PRESENT 1163L +#define ERROR_DEVICE_REINITIALIZATION_NEEDED 1164L +#define ERROR_DEVICE_REQUIRES_CLEANING 1165L +#define ERROR_DEVICE_DOOR_OPEN 1166L +#define ERROR_DEVICE_NOT_CONNECTED 1167L +#define ERROR_NOT_FOUND 1168L +#define ERROR_NO_MATCH 1169L +#define ERROR_SET_NOT_FOUND 1170L +#define ERROR_POINT_NOT_FOUND 1171L +#define ERROR_NO_TRACKING_SERVICE 1172L +#define ERROR_NO_VOLUME_ID 1173L +#define ERROR_UNABLE_TO_REMOVE_REPLACED 1175L +#define ERROR_UNABLE_TO_MOVE_REPLACEMENT 1176L +#define ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 1177L +#define ERROR_JOURNAL_DELETE_IN_PROGRESS 1178L +#define ERROR_JOURNAL_NOT_ACTIVE 1179L +#define ERROR_POTENTIAL_FILE_FOUND 1180L +#define ERROR_JOURNAL_ENTRY_DELETED 1181L +#define ERROR_BAD_DEVICE 1200L +#define ERROR_CONNECTION_UNAVAIL 1201L +#define ERROR_DEVICE_ALREADY_REMEMBERED 1202L +#define ERROR_NO_NET_OR_BAD_PATH 1203L +#define ERROR_BAD_PROVIDER 1204L +#define ERROR_CANNOT_OPEN_PROFILE 1205L +#define ERROR_BAD_PROFILE 1206L +#define ERROR_NOT_CONTAINER 1207L +#define ERROR_EXTENDED_ERROR 1208L +#define ERROR_INVALID_GROUPNAME 1209L +#define ERROR_INVALID_COMPUTERNAME 1210L +#define ERROR_INVALID_EVENTNAME 1211L +#define ERROR_INVALID_DOMAINNAME 1212L +#define ERROR_INVALID_SERVICENAME 1213L +#define ERROR_INVALID_NETNAME 1214L +#define ERROR_INVALID_SHARENAME 1215L +#define ERROR_INVALID_PASSWORDNAME 1216L +#define ERROR_INVALID_MESSAGENAME 1217L +#define ERROR_INVALID_MESSAGEDEST 1218L +#define ERROR_SESSION_CREDENTIAL_CONFLICT 1219L +#define ERROR_REMOTE_SESSION_LIMIT_EXCEEDED 1220L +#define ERROR_DUP_DOMAINNAME 1221L +#define ERROR_NO_NETWORK 1222L +#define ERROR_CANCELLED 1223L +#define ERROR_USER_MAPPED_FILE 1224L +#define ERROR_CONNECTION_REFUSED 1225L +#define ERROR_GRACEFUL_DISCONNECT 1226L +#define ERROR_ADDRESS_ALREADY_ASSOCIATED 1227L +#define ERROR_ADDRESS_NOT_ASSOCIATED 1228L +#define ERROR_CONNECTION_INVALID 1229L +#define ERROR_CONNECTION_ACTIVE 1230L +#define ERROR_NETWORK_UNREACHABLE 1231L +#define ERROR_HOST_UNREACHABLE 1232L +#define ERROR_PROTOCOL_UNREACHABLE 1233L +#define ERROR_PORT_UNREACHABLE 1234L +#define ERROR_REQUEST_ABORTED 1235L +#define ERROR_CONNECTION_ABORTED 1236L +#define ERROR_RETRY 1237L +#define ERROR_CONNECTION_COUNT_LIMIT 1238L +#define ERROR_LOGIN_TIME_RESTRICTION 1239L +#define ERROR_LOGIN_WKSTA_RESTRICTION 1240L +#define ERROR_INCORRECT_ADDRESS 1241L +#define ERROR_ALREADY_REGISTERED 1242L +#define ERROR_SERVICE_NOT_FOUND 1243L +#define ERROR_NOT_AUTHENTICATED 1244L +#define ERROR_NOT_LOGGED_ON 1245L +#define ERROR_CONTINUE 1246L +#define ERROR_ALREADY_INITIALIZED 1247L +#define ERROR_NO_MORE_DEVICES 1248L +#define ERROR_NO_SUCH_SITE 1249L +#define ERROR_DOMAIN_CONTROLLER_EXISTS 1250L +#define ERROR_ONLY_IF_CONNECTED 1251L +#define ERROR_OVERRIDE_NOCHANGES 1252L +#define ERROR_BAD_USER_PROFILE 1253L +#define ERROR_NOT_SUPPORTED_ON_SBS 1254L +#define ERROR_SERVER_SHUTDOWN_IN_PROGRESS 1255L +#define ERROR_HOST_DOWN 1256L +#define ERROR_NON_ACCOUNT_SID 1257L +#define ERROR_NON_DOMAIN_SID 1258L +#define ERROR_APPHELP_BLOCK 1259L +#define ERROR_ACCESS_DISABLED_BY_POLICY 1260L +#define ERROR_REG_NAT_CONSUMPTION 1261L +#define ERROR_CSCSHARE_OFFLINE 1262L +#define ERROR_PKINIT_FAILURE 1263L +#define ERROR_SMARTCARD_SUBSYSTEM_FAILURE 1264L +#define ERROR_DOWNGRADE_DETECTED 1265L +#define ERROR_MACHINE_LOCKED 1271L +#define ERROR_CALLBACK_SUPPLIED_INVALID_DATA 1273L +#define ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED 1274L +#define ERROR_DRIVER_BLOCKED 1275L +#define ERROR_INVALID_IMPORT_OF_NON_DLL 1276L +#define ERROR_ACCESS_DISABLED_WEBBLADE 1277L +#define ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER 1278L +#define ERROR_RECOVERY_FAILURE 1279L +#define ERROR_ALREADY_FIBER 1280L +#define ERROR_ALREADY_THREAD 1281L +#define ERROR_STACK_BUFFER_OVERRUN 1282L +#define ERROR_PARAMETER_QUOTA_EXCEEDED 1283L +#define ERROR_DEBUGGER_INACTIVE 1284L +#define ERROR_DELAY_LOAD_FAILED 1285L +#define ERROR_VDM_DISALLOWED 1286L +#define ERROR_UNIDENTIFIED_ERROR 1287L +#define ERROR_NOT_ALL_ASSIGNED 1300L +#define ERROR_SOME_NOT_MAPPED 1301L +#define ERROR_NO_QUOTAS_FOR_ACCOUNT 1302L +#define ERROR_LOCAL_USER_SESSION_KEY 1303L +#define ERROR_NULL_LM_PASSWORD 1304L +#define ERROR_UNKNOWN_REVISION 1305L +#define ERROR_REVISION_MISMATCH 1306L +#define ERROR_INVALID_OWNER 1307L +#define ERROR_INVALID_PRIMARY_GROUP 1308L +#define ERROR_NO_IMPERSONATION_TOKEN 1309L +#define ERROR_CANT_DISABLE_MANDATORY 1310L +#define ERROR_NO_LOGON_SERVERS 1311L +#define ERROR_NO_SUCH_LOGON_SESSION 1312L +#define ERROR_NO_SUCH_PRIVILEGE 1313L +#define ERROR_PRIVILEGE_NOT_HELD 1314L +#define ERROR_INVALID_ACCOUNT_NAME 1315L +#define ERROR_USER_EXISTS 1316L +#define ERROR_NO_SUCH_USER 1317L +#define ERROR_GROUP_EXISTS 1318L +#define ERROR_NO_SUCH_GROUP 1319L +#define ERROR_MEMBER_IN_GROUP 1320L +#define ERROR_MEMBER_NOT_IN_GROUP 1321L +#define ERROR_LAST_ADMIN 1322L +#define ERROR_WRONG_PASSWORD 1323L +#define ERROR_ILL_FORMED_PASSWORD 1324L +#define ERROR_PASSWORD_RESTRICTION 1325L +#define ERROR_LOGON_FAILURE 1326L +#define ERROR_ACCOUNT_RESTRICTION 1327L +#define ERROR_INVALID_LOGON_HOURS 1328L +#define ERROR_INVALID_WORKSTATION 1329L +#define ERROR_PASSWORD_EXPIRED 1330L +#define ERROR_ACCOUNT_DISABLED 1331L +#define ERROR_NONE_MAPPED 1332L +#define ERROR_TOO_MANY_LUIDS_REQUESTED 1333L +#define ERROR_LUIDS_EXHAUSTED 1334L +#define ERROR_INVALID_SUB_AUTHORITY 1335L +#define ERROR_INVALID_ACL 1336L +#define ERROR_INVALID_SID 1337L +#define ERROR_INVALID_SECURITY_DESCR 1338L +#define ERROR_BAD_INHERITANCE_ACL 1340L +#define ERROR_SERVER_DISABLED 1341L +#define ERROR_SERVER_NOT_DISABLED 1342L +#define ERROR_INVALID_ID_AUTHORITY 1343L +#define ERROR_ALLOTTED_SPACE_EXCEEDED 1344L +#define ERROR_INVALID_GROUP_ATTRIBUTES 1345L +#define ERROR_BAD_IMPERSONATION_LEVEL 1346L +#define ERROR_CANT_OPEN_ANONYMOUS 1347L +#define ERROR_BAD_VALIDATION_CLASS 1348L +#define ERROR_BAD_TOKEN_TYPE 1349L +#define ERROR_NO_SECURITY_ON_OBJECT 1350L +#define ERROR_CANT_ACCESS_DOMAIN_INFO 1351L +#define ERROR_INVALID_SERVER_STATE 1352L +#define ERROR_INVALID_DOMAIN_STATE 1353L +#define ERROR_INVALID_DOMAIN_ROLE 1354L +#define ERROR_NO_SUCH_DOMAIN 1355L +#define ERROR_DOMAIN_EXISTS 1356L +#define ERROR_DOMAIN_LIMIT_EXCEEDED 1357L +#define ERROR_INTERNAL_DB_CORRUPTION 1358L +#define ERROR_INTERNAL_ERROR 1359L +#define ERROR_GENERIC_NOT_MAPPED 1360L +#define ERROR_BAD_DESCRIPTOR_FORMAT 1361L +#define ERROR_NOT_LOGON_PROCESS 1362L +#define ERROR_LOGON_SESSION_EXISTS 1363L +#define ERROR_NO_SUCH_PACKAGE 1364L +#define ERROR_BAD_LOGON_SESSION_STATE 1365L +#define ERROR_LOGON_SESSION_COLLISION 1366L +#define ERROR_INVALID_LOGON_TYPE 1367L +#define ERROR_CANNOT_IMPERSONATE 1368L +#define ERROR_RXACT_INVALID_STATE 1369L +#define ERROR_RXACT_COMMIT_FAILURE 1370L +#define ERROR_SPECIAL_ACCOUNT 1371L +#define ERROR_SPECIAL_GROUP 1372L +#define ERROR_SPECIAL_USER 1373L +#define ERROR_MEMBERS_PRIMARY_GROUP 1374L +#define ERROR_TOKEN_ALREADY_IN_USE 1375L +#define ERROR_NO_SUCH_ALIAS 1376L +#define ERROR_MEMBER_NOT_IN_ALIAS 1377L +#define ERROR_MEMBER_IN_ALIAS 1378L +#define ERROR_ALIAS_EXISTS 1379L +#define ERROR_LOGON_NOT_GRANTED 1380L +#define ERROR_TOO_MANY_SECRETS 1381L +#define ERROR_SECRET_TOO_LONG 1382L +#define ERROR_INTERNAL_DB_ERROR 1383L +#define ERROR_TOO_MANY_CONTEXT_IDS 1384L +#define ERROR_LOGON_TYPE_NOT_GRANTED 1385L +#define ERROR_NT_CROSS_ENCRYPTION_REQUIRED 1386L +#define ERROR_NO_SUCH_MEMBER 1387L +#define ERROR_INVALID_MEMBER 1388L +#define ERROR_TOO_MANY_SIDS 1389L +#define ERROR_LM_CROSS_ENCRYPTION_REQUIRED 1390L +#define ERROR_NO_INHERITANCE 1391L +#define ERROR_FILE_CORRUPT 1392L +#define ERROR_DISK_CORRUPT 1393L +#define ERROR_NO_USER_SESSION_KEY 1394L +#define ERROR_LICENSE_QUOTA_EXCEEDED 1395L +#define ERROR_WRONG_TARGET_NAME 1396L +#define ERROR_MUTUAL_AUTH_FAILED 1397L +#define ERROR_TIME_SKEW 1398L +#define ERROR_CURRENT_DOMAIN_NOT_ALLOWED 1399L +#define ERROR_INVALID_WINDOW_HANDLE 1400L +#define ERROR_INVALID_MENU_HANDLE 1401L +#define ERROR_INVALID_CURSOR_HANDLE 1402L +#define ERROR_INVALID_ACCEL_HANDLE 1403L +#define ERROR_INVALID_HOOK_HANDLE 1404L +#define ERROR_INVALID_DWP_HANDLE 1405L +#define ERROR_TLW_WITH_WSCHILD 1406L +#define ERROR_CANNOT_FIND_WND_CLASS 1407L +#define ERROR_WINDOW_OF_OTHER_THREAD 1408L +#define ERROR_HOTKEY_ALREADY_REGISTERED 1409L +#define ERROR_CLASS_ALREADY_EXISTS 1410L +#define ERROR_CLASS_DOES_NOT_EXIST 1411L +#define ERROR_CLASS_HAS_WINDOWS 1412L +#define ERROR_INVALID_INDEX 1413L +#define ERROR_INVALID_ICON_HANDLE 1414L +#define ERROR_PRIVATE_DIALOG_INDEX 1415L +#define ERROR_LISTBOX_ID_NOT_FOUND 1416L +#define ERROR_NO_WILDCARD_CHARACTERS 1417L +#define ERROR_CLIPBOARD_NOT_OPEN 1418L +#define ERROR_HOTKEY_NOT_REGISTERED 1419L +#define ERROR_WINDOW_NOT_DIALOG 1420L +#define ERROR_CONTROL_ID_NOT_FOUND 1421L +#define ERROR_INVALID_COMBOBOX_MESSAGE 1422L +#define ERROR_WINDOW_NOT_COMBOBOX 1423L +#define ERROR_INVALID_EDIT_HEIGHT 1424L +#define ERROR_DC_NOT_FOUND 1425L +#define ERROR_INVALID_HOOK_FILTER 1426L +#define ERROR_INVALID_FILTER_PROC 1427L +#define ERROR_HOOK_NEEDS_HMOD 1428L +#define ERROR_GLOBAL_ONLY_HOOK 1429L +#define ERROR_JOURNAL_HOOK_SET 1430L +#define ERROR_HOOK_NOT_INSTALLED 1431L +#define ERROR_INVALID_LB_MESSAGE 1432L +#define ERROR_SETCOUNT_ON_BAD_LB 1433L +#define ERROR_LB_WITHOUT_TABSTOPS 1434L +#define ERROR_DESTROY_OBJECT_OF_OTHER_THREAD 1435L +#define ERROR_CHILD_WINDOW_MENU 1436L +#define ERROR_NO_SYSTEM_MENU 1437L +#define ERROR_INVALID_MSGBOX_STYLE 1438L +#define ERROR_INVALID_SPI_VALUE 1439L +#define ERROR_SCREEN_ALREADY_LOCKED 1440L +#define ERROR_HWNDS_HAVE_DIFF_PARENT 1441L +#define ERROR_NOT_CHILD_WINDOW 1442L +#define ERROR_INVALID_GW_COMMAND 1443L +#define ERROR_INVALID_THREAD_ID 1444L +#define ERROR_NON_MDICHILD_WINDOW 1445L +#define ERROR_POPUP_ALREADY_ACTIVE 1446L +#define ERROR_NO_SCROLLBARS 1447L +#define ERROR_INVALID_SCROLLBAR_RANGE 1448L +#define ERROR_INVALID_SHOWWIN_COMMAND 1449L +#define ERROR_NO_SYSTEM_RESOURCES 1450L +#define ERROR_NONPAGED_SYSTEM_RESOURCES 1451L +#define ERROR_PAGED_SYSTEM_RESOURCES 1452L +#define ERROR_WORKING_SET_QUOTA 1453L +#define ERROR_PAGEFILE_QUOTA 1454L +#define ERROR_COMMITMENT_LIMIT 1455L +#define ERROR_MENU_ITEM_NOT_FOUND 1456L +#define ERROR_INVALID_KEYBOARD_HANDLE 1457L +#define ERROR_HOOK_TYPE_NOT_ALLOWED 1458L +#define ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION 1459L +#define ERROR_TIMEOUT 1460L +#define ERROR_INVALID_MONITOR_HANDLE 1461L +#define ERROR_INCORRECT_SIZE 1462L +#define ERROR_EVENTLOG_FILE_CORRUPT 1500L +#define ERROR_EVENTLOG_CANT_START 1501L +#define ERROR_LOG_FILE_FULL 1502L +#define ERROR_EVENTLOG_FILE_CHANGED 1503L +#define ERROR_INSTALL_SERVICE_FAILURE 1601L +#define ERROR_INSTALL_USEREXIT 1602L +#define ERROR_INSTALL_FAILURE 1603L +#define ERROR_INSTALL_SUSPEND 1604L +#define ERROR_UNKNOWN_PRODUCT 1605L +#define ERROR_UNKNOWN_FEATURE 1606L +#define ERROR_UNKNOWN_COMPONENT 1607L +#define ERROR_UNKNOWN_PROPERTY 1608L +#define ERROR_INVALID_HANDLE_STATE 1609L +#define ERROR_BAD_CONFIGURATION 1610L +#define ERROR_INDEX_ABSENT 1611L +#define ERROR_INSTALL_SOURCE_ABSENT 1612L +#define ERROR_INSTALL_PACKAGE_VERSION 1613L +#define ERROR_PRODUCT_UNINSTALLED 1614L +#define ERROR_BAD_QUERY_SYNTAX 1615L +#define ERROR_INVALID_FIELD 1616L +#define ERROR_DEVICE_REMOVED 1617L +#define ERROR_INSTALL_ALREADY_RUNNING 1618L +#define ERROR_INSTALL_PACKAGE_OPEN_FAILED 1619L +#define ERROR_INSTALL_PACKAGE_INVALID 1620L +#define ERROR_INSTALL_UI_FAILURE 1621L +#define ERROR_INSTALL_LOG_FAILURE 1622L +#define ERROR_INSTALL_LANGUAGE_UNSUPPORTED 1623L +#define ERROR_INSTALL_TRANSFORM_FAILURE 1624L +#define ERROR_INSTALL_PACKAGE_REJECTED 1625L +#define ERROR_FUNCTION_NOT_CALLED 1626L +#define ERROR_FUNCTION_FAILED 1627L +#define ERROR_INVALID_TABLE 1628L +#define ERROR_DATATYPE_MISMATCH 1629L +#define ERROR_UNSUPPORTED_TYPE 1630L +#define ERROR_CREATE_FAILED 1631L +#define ERROR_INSTALL_TEMP_UNWRITABLE 1632L +#define ERROR_INSTALL_PLATFORM_UNSUPPORTED 1633L +#define ERROR_INSTALL_NOTUSED 1634L +#define ERROR_PATCH_PACKAGE_OPEN_FAILED 1635L +#define ERROR_PATCH_PACKAGE_INVALID 1636L +#define ERROR_PATCH_PACKAGE_UNSUPPORTED 1637L +#define ERROR_PRODUCT_VERSION 1638L +#define ERROR_INVALID_COMMAND_LINE 1639L +#define ERROR_INSTALL_REMOTE_DISALLOWED 1640L +#define ERROR_SUCCESS_REBOOT_INITIATED 1641L +#define ERROR_PATCH_TARGET_NOT_FOUND 1642L +#define ERROR_PATCH_PACKAGE_REJECTED 1643L +#define ERROR_INSTALL_TRANSFORM_REJECTED 1644L +#define ERROR_INSTALL_REMOTE_PROHIBITED 1645L +#define RPC_S_INVALID_STRING_BINDING 1700L +#define RPC_S_WRONG_KIND_OF_BINDING 1701L +#define RPC_S_INVALID_BINDING 1702L +#define RPC_S_PROTSEQ_NOT_SUPPORTED 1703L +#define RPC_S_INVALID_RPC_PROTSEQ 1704L +#define RPC_S_INVALID_STRING_UUID 1705L +#define RPC_S_INVALID_ENDPOINT_FORMAT 1706L +#define RPC_S_INVALID_NET_ADDR 1707L +#define RPC_S_NO_ENDPOINT_FOUND 1708L +#define RPC_S_INVALID_TIMEOUT 1709L +#define RPC_S_OBJECT_NOT_FOUND 1710L +#define RPC_S_ALREADY_REGISTERED 1711L +#define RPC_S_TYPE_ALREADY_REGISTERED 1712L +#define RPC_S_ALREADY_LISTENING 1713L +#define RPC_S_NO_PROTSEQS_REGISTERED 1714L +#define RPC_S_NOT_LISTENING 1715L +#define RPC_S_UNKNOWN_MGR_TYPE 1716L +#define RPC_S_UNKNOWN_IF 1717L +#define RPC_S_NO_BINDINGS 1718L +#define RPC_S_NO_PROTSEQS 1719L +#define RPC_S_CANT_CREATE_ENDPOINT 1720L +#define RPC_S_OUT_OF_RESOURCES 1721L +#define RPC_S_SERVER_UNAVAILABLE 1722L +#define RPC_S_SERVER_TOO_BUSY 1723L +#define RPC_S_INVALID_NETWORK_OPTIONS 1724L +#define RPC_S_NO_CALL_ACTIVE 1725L +#define RPC_S_CALL_FAILED 1726L +#define RPC_S_CALL_FAILED_DNE 1727L +#define RPC_S_PROTOCOL_ERROR 1728L +#define RPC_S_UNSUPPORTED_TRANS_SYN 1730L +#define RPC_S_UNSUPPORTED_TYPE 1732L +#define RPC_S_INVALID_TAG 1733L +#define RPC_S_INVALID_BOUND 1734L +#define RPC_S_NO_ENTRY_NAME 1735L +#define RPC_S_INVALID_NAME_SYNTAX 1736L +#define RPC_S_UNSUPPORTED_NAME_SYNTAX 1737L +#define RPC_S_UUID_NO_ADDRESS 1739L +#define RPC_S_DUPLICATE_ENDPOINT 1740L +#define RPC_S_UNKNOWN_AUTHN_TYPE 1741L +#define RPC_S_MAX_CALLS_TOO_SMALL 1742L +#define RPC_S_STRING_TOO_LONG 1743L +#define RPC_S_PROTSEQ_NOT_FOUND 1744L +#define RPC_S_PROCNUM_OUT_OF_RANGE 1745L +#define RPC_S_BINDING_HAS_NO_AUTH 1746L +#define RPC_S_UNKNOWN_AUTHN_SERVICE 1747L +#define RPC_S_UNKNOWN_AUTHN_LEVEL 1748L +#define RPC_S_INVALID_AUTH_IDENTITY 1749L +#define RPC_S_UNKNOWN_AUTHZ_SERVICE 1750L +#define EPT_S_INVALID_ENTRY 1751L +#define EPT_S_CANT_PERFORM_OP 1752L +#define EPT_S_NOT_REGISTERED 1753L +#define RPC_S_NOTHING_TO_EXPORT 1754L +#define RPC_S_INCOMPLETE_NAME 1755L +#define RPC_S_INVALID_VERS_OPTION 1756L +#define RPC_S_NO_MORE_MEMBERS 1757L +#define RPC_S_NOT_ALL_OBJS_UNEXPORTED 1758L +#define RPC_S_INTERFACE_NOT_FOUND 1759L +#define RPC_S_ENTRY_ALREADY_EXISTS 1760L +#define RPC_S_ENTRY_NOT_FOUND 1761L +#define RPC_S_NAME_SERVICE_UNAVAILABLE 1762L +#define RPC_S_INVALID_NAF_ID 1763L +#define RPC_S_CANNOT_SUPPORT 1764L +#define RPC_S_NO_CONTEXT_AVAILABLE 1765L +#define RPC_S_INTERNAL_ERROR 1766L +#define RPC_S_ZERO_DIVIDE 1767L +#define RPC_S_ADDRESS_ERROR 1768L +#define RPC_S_FP_DIV_ZERO 1769L +#define RPC_S_FP_UNDERFLOW 1770L +#define RPC_S_FP_OVERFLOW 1771L +#define RPC_X_NO_MORE_ENTRIES 1772L +#define RPC_X_SS_CHAR_TRANS_OPEN_FAIL 1773L +#define RPC_X_SS_CHAR_TRANS_SHORT_FILE 1774L +#define RPC_X_SS_IN_NULL_CONTEXT 1775L +#define RPC_X_SS_CONTEXT_DAMAGED 1777L +#define RPC_X_SS_HANDLES_MISMATCH 1778L +#define RPC_X_SS_CANNOT_GET_CALL_HANDLE 1779L +#define RPC_X_NULL_REF_POINTER 1780L +#define RPC_X_ENUM_VALUE_OUT_OF_RANGE 1781L +#define RPC_X_BYTE_COUNT_TOO_SMALL 1782L +#define RPC_X_BAD_STUB_DATA 1783L +#define ERROR_INVALID_USER_BUFFER 1784L +#define ERROR_UNRECOGNIZED_MEDIA 1785L +#define ERROR_NO_TRUST_LSA_SECRET 1786L +#define ERROR_NO_TRUST_SAM_ACCOUNT 1787L +#define ERROR_TRUSTED_DOMAIN_FAILURE 1788L +#define ERROR_TRUSTED_RELATIONSHIP_FAILURE 1789L +#define ERROR_TRUST_FAILURE 1790L +#define RPC_S_CALL_IN_PROGRESS 1791L +#define ERROR_NETLOGON_NOT_STARTED 1792L +#define ERROR_ACCOUNT_EXPIRED 1793L +#define ERROR_REDIRECTOR_HAS_OPEN_HANDLES 1794L +#define ERROR_PRINTER_DRIVER_ALREADY_INSTALLED 1795L +#define ERROR_UNKNOWN_PORT 1796L +#define ERROR_UNKNOWN_PRINTER_DRIVER 1797L +#define ERROR_UNKNOWN_PRINTPROCESSOR 1798L +#define ERROR_INVALID_SEPARATOR_FILE 1799L +#define ERROR_INVALID_PRIORITY 1800L +#define ERROR_INVALID_PRINTER_NAME 1801L +#define ERROR_PRINTER_ALREADY_EXISTS 1802L +#define ERROR_INVALID_PRINTER_COMMAND 1803L +#define ERROR_INVALID_DATATYPE 1804L +#define ERROR_INVALID_ENVIRONMENT 1805L +#define RPC_S_NO_MORE_BINDINGS 1806L +#define ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 1807L +#define ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT 1808L +#define ERROR_NOLOGON_SERVER_TRUST_ACCOUNT 1809L +#define ERROR_DOMAIN_TRUST_INCONSISTENT 1810L +#define ERROR_SERVER_HAS_OPEN_HANDLES 1811L +#define ERROR_RESOURCE_DATA_NOT_FOUND 1812L +#define ERROR_RESOURCE_TYPE_NOT_FOUND 1813L +#define ERROR_RESOURCE_NAME_NOT_FOUND 1814L +#define ERROR_RESOURCE_LANG_NOT_FOUND 1815L +#define ERROR_NOT_ENOUGH_QUOTA 1816L +#define RPC_S_NO_INTERFACES 1817L +#define RPC_S_CALL_CANCELLED 1818L +#define RPC_S_BINDING_INCOMPLETE 1819L +#define RPC_S_COMM_FAILURE 1820L +#define RPC_S_UNSUPPORTED_AUTHN_LEVEL 1821L +#define RPC_S_NO_PRINC_NAME 1822L +#define RPC_S_NOT_RPC_ERROR 1823L +#define RPC_S_UUID_LOCAL_ONLY 1824L +#define RPC_S_SEC_PKG_ERROR 1825L +#define RPC_S_NOT_CANCELLED 1826L +#define RPC_X_INVALID_ES_ACTION 1827L +#define RPC_X_WRONG_ES_VERSION 1828L +#define RPC_X_WRONG_STUB_VERSION 1829L +#define RPC_X_INVALID_PIPE_OBJECT 1830L +#define RPC_X_WRONG_PIPE_ORDER 1831L +#define RPC_X_WRONG_PIPE_VERSION 1832L +#define RPC_S_GROUP_MEMBER_NOT_FOUND 1898L +#define EPT_S_CANT_CREATE 1899L +#define RPC_S_INVALID_OBJECT 1900L +#define ERROR_INVALID_TIME 1901L +#define ERROR_INVALID_FORM_NAME 1902L +#define ERROR_INVALID_FORM_SIZE 1903L +#define ERROR_ALREADY_WAITING 1904L +#define ERROR_PRINTER_DELETED 1905L +#define ERROR_INVALID_PRINTER_STATE 1906L +#define ERROR_PASSWORD_MUST_CHANGE 1907L +#define ERROR_DOMAIN_CONTROLLER_NOT_FOUND 1908L +#define ERROR_ACCOUNT_LOCKED_OUT 1909L +#define OR_INVALID_OXID 1910L +#define OR_INVALID_OID 1911L +#define OR_INVALID_SET 1912L +#define RPC_S_SEND_INCOMPLETE 1913L +#define RPC_S_INVALID_ASYNC_HANDLE 1914L +#define RPC_S_INVALID_ASYNC_CALL 1915L +#define RPC_X_PIPE_CLOSED 1916L +#define RPC_X_PIPE_DISCIPLINE_ERROR 1917L +#define RPC_X_PIPE_EMPTY 1918L +#define ERROR_NO_SITENAME 1919L +#define ERROR_CANT_ACCESS_FILE 1920L +#define ERROR_CANT_RESOLVE_FILENAME 1921L +#define RPC_S_ENTRY_TYPE_MISMATCH 1922L +#define RPC_S_NOT_ALL_OBJS_EXPORTED 1923L +#define RPC_S_INTERFACE_NOT_EXPORTED 1924L +#define RPC_S_PROFILE_NOT_ADDED 1925L +#define RPC_S_PRF_ELT_NOT_ADDED 1926L +#define RPC_S_PRF_ELT_NOT_REMOVED 1927L +#define RPC_S_GRP_ELT_NOT_ADDED 1928L +#define RPC_S_GRP_ELT_NOT_REMOVED 1929L +#define ERROR_KM_DRIVER_BLOCKED 1930L +#define ERROR_CONTEXT_EXPIRED 1931L +#define ERROR_PER_USER_TRUST_QUOTA_EXCEEDED 1932L +#define ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED 1933L +#define ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED 1934L +#define ERROR_AUTHENTICATION_FIREWALL_FAILED 1935L +#define ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED 1936L +#define ERROR_INVALID_PIXEL_FORMAT 2000L +#define ERROR_BAD_DRIVER 2001L +#define ERROR_INVALID_WINDOW_STYLE 2002L +#define ERROR_METAFILE_NOT_SUPPORTED 2003L +#define ERROR_TRANSFORM_NOT_SUPPORTED 2004L +#define ERROR_CLIPPING_NOT_SUPPORTED 2005L +#define ERROR_INVALID_CMM 2010L +#define ERROR_INVALID_PROFILE 2011L +#define ERROR_TAG_NOT_FOUND 2012L +#define ERROR_TAG_NOT_PRESENT 2013L +#define ERROR_DUPLICATE_TAG 2014L +#define ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE 2015L +#define ERROR_PROFILE_NOT_FOUND 2016L +#define ERROR_INVALID_COLORSPACE 2017L +#define ERROR_ICM_NOT_ENABLED 2018L +#define ERROR_DELETING_ICM_XFORM 2019L +#define ERROR_INVALID_TRANSFORM 2020L +#define ERROR_COLORSPACE_MISMATCH 2021L +#define ERROR_INVALID_COLORINDEX 2022L +#define ERROR_CONNECTED_OTHER_PASSWORD 2108L +#define ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT 2109L +#define ERROR_BAD_USERNAME 2202L +#define ERROR_NOT_CONNECTED 2250L +#define ERROR_OPEN_FILES 2401L +#define ERROR_ACTIVE_CONNECTIONS 2402L +#define ERROR_DEVICE_IN_USE 2404L +#define ERROR_UNKNOWN_PRINT_MONITOR 3000L +#define ERROR_PRINTER_DRIVER_IN_USE 3001L +#define ERROR_SPOOL_FILE_NOT_FOUND 3002L +#define ERROR_SPL_NO_STARTDOC 3003L +#define ERROR_SPL_NO_ADDJOB 3004L +#define ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED 3005L +#define ERROR_PRINT_MONITOR_ALREADY_INSTALLED 3006L +#define ERROR_INVALID_PRINT_MONITOR 3007L +#define ERROR_PRINT_MONITOR_IN_USE 3008L +#define ERROR_PRINTER_HAS_JOBS_QUEUED 3009L +#define ERROR_SUCCESS_REBOOT_REQUIRED 3010L +#define ERROR_SUCCESS_RESTART_REQUIRED 3011L +#define ERROR_PRINTER_NOT_FOUND 3012L +#define ERROR_PRINTER_DRIVER_WARNED 3013L +#define ERROR_PRINTER_DRIVER_BLOCKED 3014L +#define ERROR_WINS_INTERNAL 4000L +#define ERROR_CAN_NOT_DEL_LOCAL_WINS 4001L +#define ERROR_STATIC_INIT 4002L +#define ERROR_INC_BACKUP 4003L +#define ERROR_FULL_BACKUP 4004L +#define ERROR_REC_NON_EXISTENT 4005L +#define ERROR_RPL_NOT_ALLOWED 4006L +#define ERROR_DHCP_ADDRESS_CONFLICT 4100L +#define ERROR_WMI_GUID_NOT_FOUND 4200L +#define ERROR_WMI_INSTANCE_NOT_FOUND 4201L +#define ERROR_WMI_ITEMID_NOT_FOUND 4202L +#define ERROR_WMI_TRY_AGAIN 4203L +#define ERROR_WMI_DP_NOT_FOUND 4204L +#define ERROR_WMI_UNRESOLVED_INSTANCE_REF 4205L +#define ERROR_WMI_ALREADY_ENABLED 4206L +#define ERROR_WMI_GUID_DISCONNECTED 4207L +#define ERROR_WMI_SERVER_UNAVAILABLE 4208L +#define ERROR_WMI_DP_FAILED 4209L +#define ERROR_WMI_INVALID_MOF 4210L +#define ERROR_WMI_INVALID_REGINFO 4211L +#define ERROR_WMI_ALREADY_DISABLED 4212L +#define ERROR_WMI_READ_ONLY 4213L +#define ERROR_WMI_SET_FAILURE 4214L +#define ERROR_INVALID_MEDIA 4300L +#define ERROR_INVALID_LIBRARY 4301L +#define ERROR_INVALID_MEDIA_POOL 4302L +#define ERROR_DRIVE_MEDIA_MISMATCH 4303L +#define ERROR_MEDIA_OFFLINE 4304L +#define ERROR_LIBRARY_OFFLINE 4305L +#define ERROR_EMPTY 4306L +#define ERROR_NOT_EMPTY 4307L +#define ERROR_MEDIA_UNAVAILABLE 4308L +#define ERROR_RESOURCE_DISABLED 4309L +#define ERROR_INVALID_CLEANER 4310L +#define ERROR_UNABLE_TO_CLEAN 4311L +#define ERROR_OBJECT_NOT_FOUND 4312L +#define ERROR_DATABASE_FAILURE 4313L +#define ERROR_DATABASE_FULL 4314L +#define ERROR_MEDIA_INCOMPATIBLE 4315L +#define ERROR_RESOURCE_NOT_PRESENT 4316L +#define ERROR_INVALID_OPERATION 4317L +#define ERROR_MEDIA_NOT_AVAILABLE 4318L +#define ERROR_DEVICE_NOT_AVAILABLE 4319L +#define ERROR_REQUEST_REFUSED 4320L +#define ERROR_INVALID_DRIVE_OBJECT 4321L +#define ERROR_LIBRARY_FULL 4322L +#define ERROR_MEDIUM_NOT_ACCESSIBLE 4323L +#define ERROR_UNABLE_TO_LOAD_MEDIUM 4324L +#define ERROR_UNABLE_TO_INVENTORY_DRIVE 4325L +#define ERROR_UNABLE_TO_INVENTORY_SLOT 4326L +#define ERROR_UNABLE_TO_INVENTORY_TRANSPORT 4327L +#define ERROR_TRANSPORT_FULL 4328L +#define ERROR_CONTROLLING_IEPORT 4329L +#define ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA 4330L +#define ERROR_CLEANER_SLOT_SET 4331L +#define ERROR_CLEANER_SLOT_NOT_SET 4332L +#define ERROR_CLEANER_CARTRIDGE_SPENT 4333L +#define ERROR_UNEXPECTED_OMID 4334L +#define ERROR_CANT_DELETE_LAST_ITEM 4335L +#define ERROR_MESSAGE_EXCEEDS_MAX_SIZE 4336L +#define ERROR_VOLUME_CONTAINS_SYS_FILES 4337L +#define ERROR_INDIGENOUS_TYPE 4338L +#define ERROR_NO_SUPPORTING_DRIVES 4339L +#define ERROR_CLEANER_CARTRIDGE_INSTALLED 4340L +#define ERROR_IEPORT_FULL 4341L +#define ERROR_FILE_OFFLINE 4350L +#define ERROR_REMOTE_STORAGE_NOT_ACTIVE 4351L +#define ERROR_REMOTE_STORAGE_MEDIA_ERROR 4352L +#define ERROR_NOT_A_REPARSE_POINT 4390L +#define ERROR_REPARSE_ATTRIBUTE_CONFLICT 4391L +#define ERROR_INVALID_REPARSE_DATA 4392L +#define ERROR_REPARSE_TAG_INVALID 4393L +#define ERROR_REPARSE_TAG_MISMATCH 4394L +#define ERROR_VOLUME_NOT_SIS_ENABLED 4500L +#define ERROR_DEPENDENT_RESOURCE_EXISTS 5001L +#define ERROR_DEPENDENCY_NOT_FOUND 5002L +#define ERROR_DEPENDENCY_ALREADY_EXISTS 5003L +#define ERROR_RESOURCE_NOT_ONLINE 5004L +#define ERROR_HOST_NODE_NOT_AVAILABLE 5005L +#define ERROR_RESOURCE_NOT_AVAILABLE 5006L +#define ERROR_RESOURCE_NOT_FOUND 5007L +#define ERROR_SHUTDOWN_CLUSTER 5008L +#define ERROR_CANT_EVICT_ACTIVE_NODE 5009L +#define ERROR_OBJECT_ALREADY_EXISTS 5010L +#define ERROR_OBJECT_IN_LIST 5011L +#define ERROR_GROUP_NOT_AVAILABLE 5012L +#define ERROR_GROUP_NOT_FOUND 5013L +#define ERROR_GROUP_NOT_ONLINE 5014L +#define ERROR_HOST_NODE_NOT_RESOURCE_OWNER 5015L +#define ERROR_HOST_NODE_NOT_GROUP_OWNER 5016L +#define ERROR_RESMON_CREATE_FAILED 5017L +#define ERROR_RESMON_ONLINE_FAILED 5018L +#define ERROR_RESOURCE_ONLINE 5019L +#define ERROR_QUORUM_RESOURCE 5020L +#define ERROR_NOT_QUORUM_CAPABLE 5021L +#define ERROR_CLUSTER_SHUTTING_DOWN 5022L +#define ERROR_INVALID_STATE 5023L +#define ERROR_RESOURCE_PROPERTIES_STORED 5024L +#define ERROR_NOT_QUORUM_CLASS 5025L +#define ERROR_CORE_RESOURCE 5026L +#define ERROR_QUORUM_RESOURCE_ONLINE_FAILED 5027L +#define ERROR_QUORUMLOG_OPEN_FAILED 5028L +#define ERROR_CLUSTERLOG_CORRUPT 5029L +#define ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE 5030L +#define ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE 5031L +#define ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND 5032L +#define ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE 5033L +#define ERROR_QUORUM_OWNER_ALIVE 5034L +#define ERROR_NETWORK_NOT_AVAILABLE 5035L +#define ERROR_NODE_NOT_AVAILABLE 5036L +#define ERROR_ALL_NODES_NOT_AVAILABLE 5037L +#define ERROR_RESOURCE_FAILED 5038L +#define ERROR_CLUSTER_INVALID_NODE 5039L +#define ERROR_CLUSTER_NODE_EXISTS 5040L +#define ERROR_CLUSTER_JOIN_IN_PROGRESS 5041L +#define ERROR_CLUSTER_NODE_NOT_FOUND 5042L +#define ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND 5043L +#define ERROR_CLUSTER_NETWORK_EXISTS 5044L +#define ERROR_CLUSTER_NETWORK_NOT_FOUND 5045L +#define ERROR_CLUSTER_NETINTERFACE_EXISTS 5046L +#define ERROR_CLUSTER_NETINTERFACE_NOT_FOUND 5047L +#define ERROR_CLUSTER_INVALID_REQUEST 5048L +#define ERROR_CLUSTER_INVALID_NETWORK_PROVIDER 5049L +#define ERROR_CLUSTER_NODE_DOWN 5050L +#define ERROR_CLUSTER_NODE_UNREACHABLE 5051L +#define ERROR_CLUSTER_NODE_NOT_MEMBER 5052L +#define ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS 5053L +#define ERROR_CLUSTER_INVALID_NETWORK 5054L +#define ERROR_CLUSTER_NODE_UP 5056L +#define ERROR_CLUSTER_IPADDR_IN_USE 5057L +#define ERROR_CLUSTER_NODE_NOT_PAUSED 5058L +#define ERROR_CLUSTER_NO_SECURITY_CONTEXT 5059L +#define ERROR_CLUSTER_NETWORK_NOT_INTERNAL 5060L +#define ERROR_CLUSTER_NODE_ALREADY_UP 5061L +#define ERROR_CLUSTER_NODE_ALREADY_DOWN 5062L +#define ERROR_CLUSTER_NETWORK_ALREADY_ONLINE 5063L +#define ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE 5064L +#define ERROR_CLUSTER_NODE_ALREADY_MEMBER 5065L +#define ERROR_CLUSTER_LAST_INTERNAL_NETWORK 5066L +#define ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS 5067L +#define ERROR_INVALID_OPERATION_ON_QUORUM 5068L +#define ERROR_DEPENDENCY_NOT_ALLOWED 5069L +#define ERROR_CLUSTER_NODE_PAUSED 5070L +#define ERROR_NODE_CANT_HOST_RESOURCE 5071L +#define ERROR_CLUSTER_NODE_NOT_READY 5072L +#define ERROR_CLUSTER_NODE_SHUTTING_DOWN 5073L +#define ERROR_CLUSTER_JOIN_ABORTED 5074L +#define ERROR_CLUSTER_INCOMPATIBLE_VERSIONS 5075L +#define ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED 5076L +#define ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED 5077L +#define ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND 5078L +#define ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED 5079L +#define ERROR_CLUSTER_RESNAME_NOT_FOUND 5080L +#define ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED 5081L +#define ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST 5082L +#define ERROR_CLUSTER_DATABASE_SEQMISMATCH 5083L +#define ERROR_RESMON_INVALID_STATE 5084L +#define ERROR_CLUSTER_GUM_NOT_LOCKER 5085L +#define ERROR_QUORUM_DISK_NOT_FOUND 5086L +#define ERROR_DATABASE_BACKUP_CORRUPT 5087L +#define ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT 5088L +#define ERROR_RESOURCE_PROPERTY_UNCHANGEABLE 5089L +#define ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE 5890L +#define ERROR_CLUSTER_QUORUMLOG_NOT_FOUND 5891L +#define ERROR_CLUSTER_MEMBERSHIP_HALT 5892L +#define ERROR_CLUSTER_INSTANCE_ID_MISMATCH 5893L +#define ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP 5894L +#define ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH 5895L +#define ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP 5896L +#define ERROR_CLUSTER_PARAMETER_MISMATCH 5897L +#define ERROR_NODE_CANNOT_BE_CLUSTERED 5898L +#define ERROR_CLUSTER_WRONG_OS_VERSION 5899L +#define ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME 5900L +#define ERROR_CLUSCFG_ALREADY_COMMITTED 5901L +#define ERROR_CLUSCFG_ROLLBACK_FAILED 5902L +#define ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT 5903L +#define ERROR_CLUSTER_OLD_VERSION 5904L +#define ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME 5905L +#define ERROR_ENCRYPTION_FAILED 6000L +#define ERROR_DECRYPTION_FAILED 6001L +#define ERROR_FILE_ENCRYPTED 6002L +#define ERROR_NO_RECOVERY_POLICY 6003L +#define ERROR_NO_EFS 6004L +#define ERROR_WRONG_EFS 6005L +#define ERROR_NO_USER_KEYS 6006L +#define ERROR_FILE_NOT_ENCRYPTED 6007L +#define ERROR_NOT_EXPORT_FORMAT 6008L +#define ERROR_FILE_READ_ONLY 6009L +#define ERROR_DIR_EFS_DISALLOWED 6010L +#define ERROR_EFS_SERVER_NOT_TRUSTED 6011L +#define ERROR_BAD_RECOVERY_POLICY 6012L +#define ERROR_EFS_ALG_BLOB_TOO_BIG 6013L +#define ERROR_VOLUME_NOT_SUPPORT_EFS 6014L +#define ERROR_EFS_DISABLED 6015L +#define ERROR_EFS_VERSION_NOT_SUPPORT 6016L +#define ERROR_NO_BROWSER_SERVERS_FOUND 6118L +#define SCHED_E_SERVICE_NOT_LOCALSYSTEM 6200L +#define ERROR_CTX_WINSTATION_NAME_INVALID 7001L +#define ERROR_CTX_INVALID_PD 7002L +#define ERROR_CTX_PD_NOT_FOUND 7003L +#define ERROR_CTX_WD_NOT_FOUND 7004L +#define ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY 7005L +#define ERROR_CTX_SERVICE_NAME_COLLISION 7006L +#define ERROR_CTX_CLOSE_PENDING 7007L +#define ERROR_CTX_NO_OUTBUF 7008L +#define ERROR_CTX_MODEM_INF_NOT_FOUND 7009L +#define ERROR_CTX_INVALID_MODEMNAME 7010L +#define ERROR_CTX_MODEM_RESPONSE_ERROR 7011L +#define ERROR_CTX_MODEM_RESPONSE_TIMEOUT 7012L +#define ERROR_CTX_MODEM_RESPONSE_NO_CARRIER 7013L +#define ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE 7014L +#define ERROR_CTX_MODEM_RESPONSE_BUSY 7015L +#define ERROR_CTX_MODEM_RESPONSE_VOICE 7016L +#define ERROR_CTX_TD_ERROR 7017L +#define ERROR_CTX_WINSTATION_NOT_FOUND 7022L +#define ERROR_CTX_WINSTATION_ALREADY_EXISTS 7023L +#define ERROR_CTX_WINSTATION_BUSY 7024L +#define ERROR_CTX_BAD_VIDEO_MODE 7025L +#define ERROR_CTX_GRAPHICS_INVALID 7035L +#define ERROR_CTX_LOGON_DISABLED 7037L +#define ERROR_CTX_NOT_CONSOLE 7038L +#define ERROR_CTX_CLIENT_QUERY_TIMEOUT 7040L +#define ERROR_CTX_CONSOLE_DISCONNECT 7041L +#define ERROR_CTX_CONSOLE_CONNECT 7042L +#define ERROR_CTX_SHADOW_DENIED 7044L +#define ERROR_CTX_WINSTATION_ACCESS_DENIED 7045L +#define ERROR_CTX_INVALID_WD 7049L +#define ERROR_CTX_SHADOW_INVALID 7050L +#define ERROR_CTX_SHADOW_DISABLED 7051L +#define ERROR_CTX_CLIENT_LICENSE_IN_USE 7052L +#define ERROR_CTX_CLIENT_LICENSE_NOT_SET 7053L +#define ERROR_CTX_LICENSE_NOT_AVAILABLE 7054L +#define ERROR_CTX_LICENSE_CLIENT_INVALID 7055L +#define ERROR_CTX_LICENSE_EXPIRED 7056L +#define ERROR_CTX_SHADOW_NOT_RUNNING 7057L +#define ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE 7058L +#define ERROR_ACTIVATION_COUNT_EXCEEDED 7059L +#define FRS_ERR_INVALID_API_SEQUENCE 8001L +#define FRS_ERR_STARTING_SERVICE 8002L +#define FRS_ERR_STOPPING_SERVICE 8003L +#define FRS_ERR_INTERNAL_API 8004L +#define FRS_ERR_INTERNAL 8005L +#define FRS_ERR_SERVICE_COMM 8006L +#define FRS_ERR_INSUFFICIENT_PRIV 8007L +#define FRS_ERR_AUTHENTICATION 8008L +#define FRS_ERR_PARENT_INSUFFICIENT_PRIV 8009L +#define FRS_ERR_PARENT_AUTHENTICATION 8010L +#define FRS_ERR_CHILD_TO_PARENT_COMM 8011L +#define FRS_ERR_PARENT_TO_CHILD_COMM 8012L +#define FRS_ERR_SYSVOL_POPULATE 8013L +#define FRS_ERR_SYSVOL_POPULATE_TIMEOUT 8014L +#define FRS_ERR_SYSVOL_IS_BUSY 8015L +#define FRS_ERR_SYSVOL_DEMOTE 8016L +#define FRS_ERR_INVALID_SERVICE_PARAMETER 8017L +#define DS_S_SUCCESS NO_ERROR +#define ERROR_DS_NOT_INSTALLED 8200L +#define ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY 8201L +#define ERROR_DS_NO_ATTRIBUTE_OR_VALUE 8202L +#define ERROR_DS_INVALID_ATTRIBUTE_SYNTAX 8203L +#define ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED 8204L +#define ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS 8205L +#define ERROR_DS_BUSY 8206L +#define ERROR_DS_UNAVAILABLE 8207L +#define ERROR_DS_NO_RIDS_ALLOCATED 8208L +#define ERROR_DS_NO_MORE_RIDS 8209L +#define ERROR_DS_INCORRECT_ROLE_OWNER 8210L +#define ERROR_DS_RIDMGR_INIT_ERROR 8211L +#define ERROR_DS_OBJ_CLASS_VIOLATION 8212L +#define ERROR_DS_CANT_ON_NON_LEAF 8213L +#define ERROR_DS_CANT_ON_RDN 8214L +#define ERROR_DS_CANT_MOD_OBJ_CLASS 8215L +#define ERROR_DS_CROSS_DOM_MOVE_ERROR 8216L +#define ERROR_DS_GC_NOT_AVAILABLE 8217L +#define ERROR_SHARED_POLICY 8218L +#define ERROR_POLICY_OBJECT_NOT_FOUND 8219L +#define ERROR_POLICY_ONLY_IN_DS 8220L +#define ERROR_PROMOTION_ACTIVE 8221L +#define ERROR_NO_PROMOTION_ACTIVE 8222L +#define ERROR_DS_OPERATIONS_ERROR 8224L +#define ERROR_DS_PROTOCOL_ERROR 8225L +#define ERROR_DS_TIMELIMIT_EXCEEDED 8226L +#define ERROR_DS_SIZELIMIT_EXCEEDED 8227L +#define ERROR_DS_ADMIN_LIMIT_EXCEEDED 8228L +#define ERROR_DS_COMPARE_FALSE 8229L +#define ERROR_DS_COMPARE_TRUE 8230L +#define ERROR_DS_AUTH_METHOD_NOT_SUPPORTED 8231L +#define ERROR_DS_STRONG_AUTH_REQUIRED 8232L +#define ERROR_DS_INAPPROPRIATE_AUTH 8233L +#define ERROR_DS_AUTH_UNKNOWN 8234L +#define ERROR_DS_REFERRAL 8235L +#define ERROR_DS_UNAVAILABLE_CRIT_EXTENSION 8236L +#define ERROR_DS_CONFIDENTIALITY_REQUIRED 8237L +#define ERROR_DS_INAPPROPRIATE_MATCHING 8238L +#define ERROR_DS_CONSTRAINT_VIOLATION 8239L +#define ERROR_DS_NO_SUCH_OBJECT 8240L +#define ERROR_DS_ALIAS_PROBLEM 8241L +#define ERROR_DS_INVALID_DN_SYNTAX 8242L +#define ERROR_DS_IS_LEAF 8243L +#define ERROR_DS_ALIAS_DEREF_PROBLEM 8244L +#define ERROR_DS_UNWILLING_TO_PERFORM 8245L +#define ERROR_DS_LOOP_DETECT 8246L +#define ERROR_DS_NAMING_VIOLATION 8247L +#define ERROR_DS_OBJECT_RESULTS_TOO_LARGE 8248L +#define ERROR_DS_AFFECTS_MULTIPLE_DSAS 8249L +#define ERROR_DS_SERVER_DOWN 8250L +#define ERROR_DS_LOCAL_ERROR 8251L +#define ERROR_DS_ENCODING_ERROR 8252L +#define ERROR_DS_DECODING_ERROR 8253L +#define ERROR_DS_FILTER_UNKNOWN 8254L +#define ERROR_DS_PARAM_ERROR 8255L +#define ERROR_DS_NOT_SUPPORTED 8256L +#define ERROR_DS_NO_RESULTS_RETURNED 8257L +#define ERROR_DS_CONTROL_NOT_FOUND 8258L +#define ERROR_DS_CLIENT_LOOP 8259L +#define ERROR_DS_REFERRAL_LIMIT_EXCEEDED 8260L +#define ERROR_DS_SORT_CONTROL_MISSING 8261L +#define ERROR_DS_OFFSET_RANGE_ERROR 8262L +#define ERROR_DS_ROOT_MUST_BE_NC 8301L +#define ERROR_DS_ADD_REPLICA_INHIBITED 8302L +#define ERROR_DS_ATT_NOT_DEF_IN_SCHEMA 8303L +#define ERROR_DS_MAX_OBJ_SIZE_EXCEEDED 8304L +#define ERROR_DS_OBJ_STRING_NAME_EXISTS 8305L +#define ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA 8306L +#define ERROR_DS_RDN_DOESNT_MATCH_SCHEMA 8307L +#define ERROR_DS_NO_REQUESTED_ATTS_FOUND 8308L +#define ERROR_DS_USER_BUFFER_TO_SMALL 8309L +#define ERROR_DS_ATT_IS_NOT_ON_OBJ 8310L +#define ERROR_DS_ILLEGAL_MOD_OPERATION 8311L +#define ERROR_DS_OBJ_TOO_LARGE 8312L +#define ERROR_DS_BAD_INSTANCE_TYPE 8313L +#define ERROR_DS_MASTERDSA_REQUIRED 8314L +#define ERROR_DS_OBJECT_CLASS_REQUIRED 8315L +#define ERROR_DS_MISSING_REQUIRED_ATT 8316L +#define ERROR_DS_ATT_NOT_DEF_FOR_CLASS 8317L +#define ERROR_DS_ATT_ALREADY_EXISTS 8318L +#define ERROR_DS_CANT_ADD_ATT_VALUES 8320L +#define ERROR_DS_SINGLE_VALUE_CONSTRAINT 8321L +#define ERROR_DS_RANGE_CONSTRAINT 8322L +#define ERROR_DS_ATT_VAL_ALREADY_EXISTS 8323L +#define ERROR_DS_CANT_REM_MISSING_ATT 8324L +#define ERROR_DS_CANT_REM_MISSING_ATT_VAL 8325L +#define ERROR_DS_ROOT_CANT_BE_SUBREF 8326L +#define ERROR_DS_NO_CHAINING 8327L +#define ERROR_DS_NO_CHAINED_EVAL 8328L +#define ERROR_DS_NO_PARENT_OBJECT 8329L +#define ERROR_DS_PARENT_IS_AN_ALIAS 8330L +#define ERROR_DS_CANT_MIX_MASTER_AND_REPS 8331L +#define ERROR_DS_CHILDREN_EXIST 8332L +#define ERROR_DS_OBJ_NOT_FOUND 8333L +#define ERROR_DS_ALIASED_OBJ_MISSING 8334L +#define ERROR_DS_BAD_NAME_SYNTAX 8335L +#define ERROR_DS_ALIAS_POINTS_TO_ALIAS 8336L +#define ERROR_DS_CANT_DEREF_ALIAS 8337L +#define ERROR_DS_OUT_OF_SCOPE 8338L +#define ERROR_DS_OBJECT_BEING_REMOVED 8339L +#define ERROR_DS_CANT_DELETE_DSA_OBJ 8340L +#define ERROR_DS_GENERIC_ERROR 8341L +#define ERROR_DS_DSA_MUST_BE_INT_MASTER 8342L +#define ERROR_DS_CLASS_NOT_DSA 8343L +#define ERROR_DS_INSUFF_ACCESS_RIGHTS 8344L +#define ERROR_DS_ILLEGAL_SUPERIOR 8345L +#define ERROR_DS_ATTRIBUTE_OWNED_BY_SAM 8346L +#define ERROR_DS_NAME_TOO_MANY_PARTS 8347L +#define ERROR_DS_NAME_TOO_LONG 8348L +#define ERROR_DS_NAME_VALUE_TOO_LONG 8349L +#define ERROR_DS_NAME_UNPARSEABLE 8350L +#define ERROR_DS_NAME_TYPE_UNKNOWN 8351L +#define ERROR_DS_NOT_AN_OBJECT 8352L +#define ERROR_DS_SEC_DESC_TOO_SHORT 8353L +#define ERROR_DS_SEC_DESC_INVALID 8354L +#define ERROR_DS_NO_DELETED_NAME 8355L +#define ERROR_DS_SUBREF_MUST_HAVE_PARENT 8356L +#define ERROR_DS_NCNAME_MUST_BE_NC 8357L +#define ERROR_DS_CANT_ADD_SYSTEM_ONLY 8358L +#define ERROR_DS_CLASS_MUST_BE_CONCRETE 8359L +#define ERROR_DS_INVALID_DMD 8360L +#define ERROR_DS_OBJ_GUID_EXISTS 8361L +#define ERROR_DS_NOT_ON_BACKLINK 8362L +#define ERROR_DS_NO_CROSSREF_FOR_NC 8363L +#define ERROR_DS_SHUTTING_DOWN 8364L +#define ERROR_DS_UNKNOWN_OPERATION 8365L +#define ERROR_DS_INVALID_ROLE_OWNER 8366L +#define ERROR_DS_COULDNT_CONTACT_FSMO 8367L +#define ERROR_DS_CROSS_NC_DN_RENAME 8368L +#define ERROR_DS_CANT_MOD_SYSTEM_ONLY 8369L +#define ERROR_DS_REPLICATOR_ONLY 8370L +#define ERROR_DS_OBJ_CLASS_NOT_DEFINED 8371L +#define ERROR_DS_OBJ_CLASS_NOT_SUBCLASS 8372L +#define ERROR_DS_NAME_REFERENCE_INVALID 8373L +#define ERROR_DS_CROSS_REF_EXISTS 8374L +#define ERROR_DS_CANT_DEL_MASTER_CROSSREF 8375L +#define ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD 8376L +#define ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX 8377L +#define ERROR_DS_DUP_RDN 8378L +#define ERROR_DS_DUP_OID 8379L +#define ERROR_DS_DUP_MAPI_ID 8380L +#define ERROR_DS_DUP_SCHEMA_ID_GUID 8381L +#define ERROR_DS_DUP_LDAP_DISPLAY_NAME 8382L +#define ERROR_DS_SEMANTIC_ATT_TEST 8383L +#define ERROR_DS_SYNTAX_MISMATCH 8384L +#define ERROR_DS_EXISTS_IN_MUST_HAVE 8385L +#define ERROR_DS_EXISTS_IN_MAY_HAVE 8386L +#define ERROR_DS_NONEXISTENT_MAY_HAVE 8387L +#define ERROR_DS_NONEXISTENT_MUST_HAVE 8388L +#define ERROR_DS_AUX_CLS_TEST_FAIL 8389L +#define ERROR_DS_NONEXISTENT_POSS_SUP 8390L +#define ERROR_DS_SUB_CLS_TEST_FAIL 8391L +#define ERROR_DS_BAD_RDN_ATT_ID_SYNTAX 8392L +#define ERROR_DS_EXISTS_IN_AUX_CLS 8393L +#define ERROR_DS_EXISTS_IN_SUB_CLS 8394L +#define ERROR_DS_EXISTS_IN_POSS_SUP 8395L +#define ERROR_DS_RECALCSCHEMA_FAILED 8396L +#define ERROR_DS_TREE_DELETE_NOT_FINISHED 8397L +#define ERROR_DS_CANT_DELETE 8398L +#define ERROR_DS_ATT_SCHEMA_REQ_ID 8399L +#define ERROR_DS_BAD_ATT_SCHEMA_SYNTAX 8400L +#define ERROR_DS_CANT_CACHE_ATT 8401L +#define ERROR_DS_CANT_CACHE_CLASS 8402L +#define ERROR_DS_CANT_REMOVE_ATT_CACHE 8403L +#define ERROR_DS_CANT_REMOVE_CLASS_CACHE 8404L +#define ERROR_DS_CANT_RETRIEVE_DN 8405L +#define ERROR_DS_MISSING_SUPREF 8406L +#define ERROR_DS_CANT_RETRIEVE_INSTANCE 8407L +#define ERROR_DS_CODE_INCONSISTENCY 8408L +#define ERROR_DS_DATABASE_ERROR 8409L +#define ERROR_DS_GOVERNSID_MISSING 8410L +#define ERROR_DS_MISSING_EXPECTED_ATT 8411L +#define ERROR_DS_NCNAME_MISSING_CR_REF 8412L +#define ERROR_DS_SECURITY_CHECKING_ERROR 8413L +#define ERROR_DS_SCHEMA_NOT_LOADED 8414L +#define ERROR_DS_SCHEMA_ALLOC_FAILED 8415L +#define ERROR_DS_ATT_SCHEMA_REQ_SYNTAX 8416L +#define ERROR_DS_GCVERIFY_ERROR 8417L +#define ERROR_DS_DRA_SCHEMA_MISMATCH 8418L +#define ERROR_DS_CANT_FIND_DSA_OBJ 8419L +#define ERROR_DS_CANT_FIND_EXPECTED_NC 8420L +#define ERROR_DS_CANT_FIND_NC_IN_CACHE 8421L +#define ERROR_DS_CANT_RETRIEVE_CHILD 8422L +#define ERROR_DS_SECURITY_ILLEGAL_MODIFY 8423L +#define ERROR_DS_CANT_REPLACE_HIDDEN_REC 8424L +#define ERROR_DS_BAD_HIERARCHY_FILE 8425L +#define ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED 8426L +#define ERROR_DS_CONFIG_PARAM_MISSING 8427L +#define ERROR_DS_COUNTING_AB_INDICES_FAILED 8428L +#define ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED 8429L +#define ERROR_DS_INTERNAL_FAILURE 8430L +#define ERROR_DS_UNKNOWN_ERROR 8431L +#define ERROR_DS_ROOT_REQUIRES_CLASS_TOP 8432L +#define ERROR_DS_REFUSING_FSMO_ROLES 8433L +#define ERROR_DS_MISSING_FSMO_SETTINGS 8434L +#define ERROR_DS_UNABLE_TO_SURRENDER_ROLES 8435L +#define ERROR_DS_DRA_GENERIC 8436L +#define ERROR_DS_DRA_INVALID_PARAMETER 8437L +#define ERROR_DS_DRA_BUSY 8438L +#define ERROR_DS_DRA_BAD_DN 8439L +#define ERROR_DS_DRA_BAD_NC 8440L +#define ERROR_DS_DRA_DN_EXISTS 8441L +#define ERROR_DS_DRA_INTERNAL_ERROR 8442L +#define ERROR_DS_DRA_INCONSISTENT_DIT 8443L +#define ERROR_DS_DRA_CONNECTION_FAILED 8444L +#define ERROR_DS_DRA_BAD_INSTANCE_TYPE 8445L +#define ERROR_DS_DRA_OUT_OF_MEM 8446L +#define ERROR_DS_DRA_MAIL_PROBLEM 8447L +#define ERROR_DS_DRA_REF_ALREADY_EXISTS 8448L +#define ERROR_DS_DRA_REF_NOT_FOUND 8449L +#define ERROR_DS_DRA_OBJ_IS_REP_SOURCE 8450L +#define ERROR_DS_DRA_DB_ERROR 8451L +#define ERROR_DS_DRA_NO_REPLICA 8452L +#define ERROR_DS_DRA_ACCESS_DENIED 8453L +#define ERROR_DS_DRA_NOT_SUPPORTED 8454L +#define ERROR_DS_DRA_RPC_CANCELLED 8455L +#define ERROR_DS_DRA_SOURCE_DISABLED 8456L +#define ERROR_DS_DRA_SINK_DISABLED 8457L +#define ERROR_DS_DRA_NAME_COLLISION 8458L +#define ERROR_DS_DRA_SOURCE_REINSTALLED 8459L +#define ERROR_DS_DRA_MISSING_PARENT 8460L +#define ERROR_DS_DRA_PREEMPTED 8461L +#define ERROR_DS_DRA_ABANDON_SYNC 8462L +#define ERROR_DS_DRA_SHUTDOWN 8463L +#define ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET 8464L +#define ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA 8465L +#define ERROR_DS_DRA_EXTN_CONNECTION_FAILED 8466L +#define ERROR_DS_INSTALL_SCHEMA_MISMATCH 8467L +#define ERROR_DS_DUP_LINK_ID 8468L +#define ERROR_DS_NAME_ERROR_RESOLVING 8469L +#define ERROR_DS_NAME_ERROR_NOT_FOUND 8470L +#define ERROR_DS_NAME_ERROR_NOT_UNIQUE 8471L +#define ERROR_DS_NAME_ERROR_NO_MAPPING 8472L +#define ERROR_DS_NAME_ERROR_DOMAIN_ONLY 8473L +#define ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING 8474L +#define ERROR_DS_CONSTRUCTED_ATT_MOD 8475L +#define ERROR_DS_WRONG_OM_OBJ_CLASS 8476L +#define ERROR_DS_DRA_REPL_PENDING 8477L +#define ERROR_DS_DS_REQUIRED 8478L +#define ERROR_DS_INVALID_LDAP_DISPLAY_NAME 8479L +#define ERROR_DS_NON_BASE_SEARCH 8480L +#define ERROR_DS_CANT_RETRIEVE_ATTS 8481L +#define ERROR_DS_BACKLINK_WITHOUT_LINK 8482L +#define ERROR_DS_EPOCH_MISMATCH 8483L +#define ERROR_DS_SRC_NAME_MISMATCH 8484L +#define ERROR_DS_SRC_AND_DST_NC_IDENTICAL 8485L +#define ERROR_DS_DST_NC_MISMATCH 8486L +#define ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC 8487L +#define ERROR_DS_SRC_GUID_MISMATCH 8488L +#define ERROR_DS_CANT_MOVE_DELETED_OBJECT 8489L +#define ERROR_DS_PDC_OPERATION_IN_PROGRESS 8490L +#define ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD 8491L +#define ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION 8492L +#define ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS 8493L +#define ERROR_DS_NC_MUST_HAVE_NC_PARENT 8494L +#define ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE 8495L +#define ERROR_DS_DST_DOMAIN_NOT_NATIVE 8496L +#define ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER 8497L +#define ERROR_DS_CANT_MOVE_ACCOUNT_GROUP 8498L +#define ERROR_DS_CANT_MOVE_RESOURCE_GROUP 8499L +#define ERROR_DS_INVALID_SEARCH_FLAG 8500L +#define ERROR_DS_NO_TREE_DELETE_ABOVE_NC 8501L +#define ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE 8502L +#define ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE 8503L +#define ERROR_DS_SAM_INIT_FAILURE 8504L +#define ERROR_DS_SENSITIVE_GROUP_VIOLATION 8505L +#define ERROR_DS_CANT_MOD_PRIMARYGROUPID 8506L +#define ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD 8507L +#define ERROR_DS_NONSAFE_SCHEMA_CHANGE 8508L +#define ERROR_DS_SCHEMA_UPDATE_DISALLOWED 8509L +#define ERROR_DS_CANT_CREATE_UNDER_SCHEMA 8510L +#define ERROR_DS_INSTALL_NO_SRC_SCH_VERSION 8511L +#define ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE 8512L +#define ERROR_DS_INVALID_GROUP_TYPE 8513L +#define ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN 8514L +#define ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN 8515L +#define ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER 8516L +#define ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER 8517L +#define ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER 8518L +#define ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER 8519L +#define ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER 8520L +#define ERROR_DS_HAVE_PRIMARY_MEMBERS 8521L +#define ERROR_DS_STRING_SD_CONVERSION_FAILED 8522L +#define ERROR_DS_NAMING_MASTER_GC 8523L +#define ERROR_DS_DNS_LOOKUP_FAILURE 8524L +#define ERROR_DS_COULDNT_UPDATE_SPNS 8525L +#define ERROR_DS_CANT_RETRIEVE_SD 8526L +#define ERROR_DS_KEY_NOT_UNIQUE 8527L +#define ERROR_DS_WRONG_LINKED_ATT_SYNTAX 8528L +#define ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD 8529L +#define ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY 8530L +#define ERROR_DS_CANT_START 8531L +#define ERROR_DS_INIT_FAILURE 8532L +#define ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION 8533L +#define ERROR_DS_SOURCE_DOMAIN_IN_FOREST 8534L +#define ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST 8535L +#define ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED 8536L +#define ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN 8537L +#define ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER 8538L +#define ERROR_DS_SRC_SID_EXISTS_IN_FOREST 8539L +#define ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH 8540L +#define ERROR_SAM_INIT_FAILURE 8541L +#define ERROR_DS_DRA_SCHEMA_INFO_SHIP 8542L +#define ERROR_DS_DRA_SCHEMA_CONFLICT 8543L +#define ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT 8544L +#define ERROR_DS_DRA_OBJ_NC_MISMATCH 8545L +#define ERROR_DS_NC_STILL_HAS_DSAS 8546L +#define ERROR_DS_GC_REQUIRED 8547L +#define ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY 8548L +#define ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS 8549L +#define ERROR_DS_CANT_ADD_TO_GC 8550L +#define ERROR_DS_NO_CHECKPOINT_WITH_PDC 8551L +#define ERROR_DS_SOURCE_AUDITING_NOT_ENABLED 8552L +#define ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC 8553L +#define ERROR_DS_INVALID_NAME_FOR_SPN 8554L +#define ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS 8555L +#define ERROR_DS_UNICODEPWD_NOT_IN_QUOTES 8556L +#define ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED 8557L +#define ERROR_DS_MUST_BE_RUN_ON_DST_DC 8558L +#define ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER 8559L +#define ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ 8560L +#define ERROR_DS_INIT_FAILURE_CONSOLE 8561L +#define ERROR_DS_SAM_INIT_FAILURE_CONSOLE 8562L +#define ERROR_DS_FOREST_VERSION_TOO_HIGH 8563L +#define ERROR_DS_DOMAIN_VERSION_TOO_HIGH 8564L +#define ERROR_DS_FOREST_VERSION_TOO_LOW 8565L +#define ERROR_DS_DOMAIN_VERSION_TOO_LOW 8566L +#define ERROR_DS_INCOMPATIBLE_VERSION 8567L +#define ERROR_DS_LOW_DSA_VERSION 8568L +#define ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN 8569L +#define ERROR_DS_NOT_SUPPORTED_SORT_ORDER 8570L +#define ERROR_DS_NAME_NOT_UNIQUE 8571L +#define ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 8572L +#define ERROR_DS_OUT_OF_VERSION_STORE 8573L +#define ERROR_DS_INCOMPATIBLE_CONTROLS_USED 8574L +#define ERROR_DS_NO_REF_DOMAIN 8575L +#define ERROR_DS_RESERVED_LINK_ID 8576L +#define ERROR_DS_LINK_ID_NOT_AVAILABLE 8577L +#define ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER 8578L +#define ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE 8579L +#define ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC 8580L +#define ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG 8581L +#define ERROR_DS_MODIFYDN_WRONG_GRANDPARENT 8582L +#define ERROR_DS_NAME_ERROR_TRUST_REFERRAL 8583L +#define ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER 8584L +#define ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD 8585L +#define ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 8586L +#define ERROR_DS_THREAD_LIMIT_EXCEEDED 8587L +#define ERROR_DS_NOT_CLOSEST 8588L +#define ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF 8589L +#define ERROR_DS_SINGLE_USER_MODE_FAILED 8590L +#define ERROR_DS_NTDSCRIPT_SYNTAX_ERROR 8591L +#define ERROR_DS_NTDSCRIPT_PROCESS_ERROR 8592L +#define ERROR_DS_DIFFERENT_REPL_EPOCHS 8593L +#define ERROR_DS_DRS_EXTENSIONS_CHANGED 8594L +#define ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR 8595L +#define ERROR_DS_NO_MSDS_INTID 8596L +#define ERROR_DS_DUP_MSDS_INTID 8597L +#define ERROR_DS_EXISTS_IN_RDNATTID 8598L +#define ERROR_DS_AUTHORIZATION_FAILED 8599L +#define ERROR_DS_INVALID_SCRIPT 8600L +#define ERROR_DS_REMOTE_CROSSREF_OP_FAILED 8601L +#define ERROR_DS_CROSS_REF_BUSY 8602L +#define ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN 8603L +#define ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC 8604L +#define ERROR_DS_DUPLICATE_ID_FOUND 8605L +#define ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT 8606L +#define ERROR_DS_GROUP_CONVERSION_ERROR 8607L +#define ERROR_DS_CANT_MOVE_APP_BASIC_GROUP 8608L +#define ERROR_DS_CANT_MOVE_APP_QUERY_GROUP 8609L +#define ERROR_DS_ROLE_NOT_VERIFIED 8610L +#define ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL 8611L +#define ERROR_DS_DOMAIN_RENAME_IN_PROGRESS 8612L +#define ERROR_DS_EXISTING_AD_CHILD_NC 8613L +#define ERROR_DS_REPL_LIFETIME_EXCEEDED 8614L +#define ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER 8615L +#define ERROR_DS_LDAP_SEND_QUEUE_FULL 8616L +#define ERROR_DS_DRA_OUT_SCHEDULE_WINDOW 8617L +#define DNS_ERROR_RESPONSE_CODES_BASE 9000 +#define DNS_ERROR_RCODE_NO_ERROR NO_ERROR +#define DNS_ERROR_MASK 0x00002328 +#define DNS_ERROR_RCODE_FORMAT_ERROR 9001L +#define DNS_ERROR_RCODE_SERVER_FAILURE 9002L +#define DNS_ERROR_RCODE_NAME_ERROR 9003L +#define DNS_ERROR_RCODE_NOT_IMPLEMENTED 9004L +#define DNS_ERROR_RCODE_REFUSED 9005L +#define DNS_ERROR_RCODE_YXDOMAIN 9006L +#define DNS_ERROR_RCODE_YXRRSET 9007L +#define DNS_ERROR_RCODE_NXRRSET 9008L +#define DNS_ERROR_RCODE_NOTAUTH 9009L +#define DNS_ERROR_RCODE_NOTZONE 9010L +#define DNS_ERROR_RCODE_BADSIG 9016L +#define DNS_ERROR_RCODE_BADKEY 9017L +#define DNS_ERROR_RCODE_BADTIME 9018L +#define DNS_ERROR_RCODE_LAST DNS_ERROR_RCODE_BADTIME +#define DNS_ERROR_PACKET_FMT_BASE 9500 +#define DNS_INFO_NO_RECORDS 9501L +#define DNS_ERROR_BAD_PACKET 9502L +#define DNS_ERROR_NO_PACKET 9503L +#define DNS_ERROR_RCODE 9504L +#define DNS_ERROR_UNSECURE_PACKET 9505L +#define DNS_STATUS_PACKET_UNSECURE DNS_ERROR_UNSECURE_PACKET +#define DNS_ERROR_NO_MEMORY ERROR_OUTOFMEMORY +#define DNS_ERROR_INVALID_NAME ERROR_INVALID_NAME +#define DNS_ERROR_INVALID_DATA ERROR_INVALID_DATA +#define DNS_ERROR_GENERAL_API_BASE 9550 +#define DNS_ERROR_INVALID_TYPE 9551L +#define DNS_ERROR_INVALID_IP_ADDRESS 9552L +#define DNS_ERROR_INVALID_PROPERTY 9553L +#define DNS_ERROR_TRY_AGAIN_LATER 9554L +#define DNS_ERROR_NOT_UNIQUE 9555L +#define DNS_ERROR_NON_RFC_NAME 9556L +#define DNS_STATUS_FQDN 9557L +#define DNS_STATUS_DOTTED_NAME 9558L +#define DNS_STATUS_SINGLE_PART_NAME 9559L +#define DNS_ERROR_INVALID_NAME_CHAR 9560L +#define DNS_ERROR_NUMERIC_NAME 9561L +#define DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER 9562L +#define DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION 9563L +#define DNS_ERROR_CANNOT_FIND_ROOT_HINTS 9564L +#define DNS_ERROR_INCONSISTENT_ROOT_HINTS 9565L +#define DNS_ERROR_ZONE_BASE 9600 +#define DNS_ERROR_ZONE_DOES_NOT_EXIST 9601L +#define DNS_ERROR_NO_ZONE_INFO 9602L +#define DNS_ERROR_INVALID_ZONE_OPERATION 9603L +#define DNS_ERROR_ZONE_CONFIGURATION_ERROR 9604L +#define DNS_ERROR_ZONE_HAS_NO_SOA_RECORD 9605L +#define DNS_ERROR_ZONE_HAS_NO_NS_RECORDS 9606L +#define DNS_ERROR_ZONE_LOCKED 9607L +#define DNS_ERROR_ZONE_CREATION_FAILED 9608L +#define DNS_ERROR_ZONE_ALREADY_EXISTS 9609L +#define DNS_ERROR_AUTOZONE_ALREADY_EXISTS 9610L +#define DNS_ERROR_INVALID_ZONE_TYPE 9611L +#define DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP 9612L +#define DNS_ERROR_ZONE_NOT_SECONDARY 9613L +#define DNS_ERROR_NEED_SECONDARY_ADDRESSES 9614L +#define DNS_ERROR_WINS_INIT_FAILED 9615L +#define DNS_ERROR_NEED_WINS_SERVERS 9616L +#define DNS_ERROR_NBSTAT_INIT_FAILED 9617L +#define DNS_ERROR_SOA_DELETE_INVALID 9618L +#define DNS_ERROR_FORWARDER_ALREADY_EXISTS 9619L +#define DNS_ERROR_ZONE_REQUIRES_MASTER_IP 9620L +#define DNS_ERROR_ZONE_IS_SHUTDOWN 9621L +#define DNS_ERROR_DATAFILE_BASE 9650 +#define DNS_ERROR_PRIMARY_REQUIRES_DATAFILE 9651L +#define DNS_ERROR_INVALID_DATAFILE_NAME 9652L +#define DNS_ERROR_DATAFILE_OPEN_FAILURE 9653L +#define DNS_ERROR_FILE_WRITEBACK_FAILED 9654L +#define DNS_ERROR_DATAFILE_PARSING 9655L +#define DNS_ERROR_DATABASE_BASE 9700 +#define DNS_ERROR_RECORD_DOES_NOT_EXIST 9701L +#define DNS_ERROR_RECORD_FORMAT 9702L +#define DNS_ERROR_NODE_CREATION_FAILED 9703L +#define DNS_ERROR_UNKNOWN_RECORD_TYPE 9704L +#define DNS_ERROR_RECORD_TIMED_OUT 9705L +#define DNS_ERROR_NAME_NOT_IN_ZONE 9706L +#define DNS_ERROR_CNAME_LOOP 9707L +#define DNS_ERROR_NODE_IS_CNAME 9708L +#define DNS_ERROR_CNAME_COLLISION 9709L +#define DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT 9710L +#define DNS_ERROR_RECORD_ALREADY_EXISTS 9711L +#define DNS_ERROR_SECONDARY_DATA 9712L +#define DNS_ERROR_NO_CREATE_CACHE_DATA 9713L +#define DNS_ERROR_NAME_DOES_NOT_EXIST 9714L +#define DNS_WARNING_PTR_CREATE_FAILED 9715L +#define DNS_WARNING_DOMAIN_UNDELETED 9716L +#define DNS_ERROR_DS_UNAVAILABLE 9717L +#define DNS_ERROR_DS_ZONE_ALREADY_EXISTS 9718L +#define DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE 9719L +#define DNS_ERROR_OPERATION_BASE 9750 +#define DNS_INFO_AXFR_COMPLETE 9751L +#define DNS_ERROR_AXFR 9752L +#define DNS_INFO_ADDED_LOCAL_WINS 9753L +#define DNS_ERROR_SECURE_BASE 9800 +#define DNS_STATUS_CONTINUE_NEEDED 9801L +#define DNS_ERROR_SETUP_BASE 9850 +#define DNS_ERROR_NO_TCPIP 9851L +#define DNS_ERROR_NO_DNS_SERVERS 9852L +#define DNS_ERROR_DP_BASE 9900 +#define DNS_ERROR_DP_DOES_NOT_EXIST 9901L +#define DNS_ERROR_DP_ALREADY_EXISTS 9902L +#define DNS_ERROR_DP_NOT_ENLISTED 9903L +#define DNS_ERROR_DP_ALREADY_ENLISTED 9904L +#define DNS_ERROR_DP_NOT_AVAILABLE 9905L +#define DNS_ERROR_DP_FSMO_ERROR 9906L + +#ifndef WSABASEERR +#define WSABASEERR 10000 +#define WSAEINTR 10004L +#define WSAEBADF 10009L +#define WSAEACCES 10013L +#define WSAEFAULT 10014L +#define WSAEINVAL 10022L +#define WSAEMFILE 10024L +#define WSAEWOULDBLOCK 10035L +#define WSAEINPROGRESS 10036L +#define WSAEALREADY 10037L +#define WSAENOTSOCK 10038L +#define WSAEDESTADDRREQ 10039L +#define WSAEMSGSIZE 10040L +#define WSAEPROTOTYPE 10041L +#define WSAENOPROTOOPT 10042L +#define WSAEPROTONOSUPPORT 10043L +#define WSAESOCKTNOSUPPORT 10044L +#define WSAEOPNOTSUPP 10045L +#define WSAEPFNOSUPPORT 10046L +#define WSAEAFNOSUPPORT 10047L +#define WSAEADDRINUSE 10048L +#define WSAEADDRNOTAVAIL 10049L +#define WSAENETDOWN 10050L +#define WSAENETUNREACH 10051L +#define WSAENETRESET 10052L +#define WSAECONNABORTED 10053L +#define WSAECONNRESET 10054L +#define WSAENOBUFS 10055L +#define WSAEISCONN 10056L +#define WSAENOTCONN 10057L +#define WSAESHUTDOWN 10058L +#define WSAETOOMANYREFS 10059L +#define WSAETIMEDOUT 10060L +#define WSAECONNREFUSED 10061L +#define WSAELOOP 10062L +#define WSAENAMETOOLONG 10063L +#define WSAEHOSTDOWN 10064L +#define WSAEHOSTUNREACH 10065L +#define WSAENOTEMPTY 10066L +#define WSAEPROCLIM 10067L +#define WSAEUSERS 10068L +#define WSAEDQUOT 10069L +#define WSAESTALE 10070L +#define WSAEREMOTE 10071L +#define WSASYSNOTREADY 10091L +#define WSAVERNOTSUPPORTED 10092L +#define WSANOTINITIALISED 10093L +#define WSAEDISCON 10101L +#define WSAENOMORE 10102L +#define WSAECANCELLED 10103L +#define WSAEINVALIDPROCTABLE 10104L +#define WSAEINVALIDPROVIDER 10105L +#define WSAEPROVIDERFAILEDINIT 10106L +#define WSASYSCALLFAILURE 10107L +#define WSASERVICE_NOT_FOUND 10108L +#define WSATYPE_NOT_FOUND 10109L +#define WSA_E_NO_MORE 10110L +#define WSA_E_CANCELLED 10111L +#define WSAEREFUSED 10112L +#ifndef WSAHOST_NOT_FOUND +#define WSAHOST_NOT_FOUND 11001L +#endif +#ifndef WSATRY_AGAIN +#define WSATRY_AGAIN 11002L +#endif +#ifndef WSANO_RECOVERY +#define WSANO_RECOVERY 11003L +#endif +#ifndef WSANO_DATA +#define WSANO_DATA 11004L +#endif +#ifndef WSA_QOS_RECEIVERS +#define WSA_QOS_RECEIVERS 11005L +#endif +#ifndef WSA_QOS_SENDERS +#define WSA_QOS_SENDERS 11006L +#endif +#ifndef WSA_QOS_NO_SENDERS +#define WSA_QOS_NO_SENDERS 11007L +#endif +#ifndef WSA_QOS_NO_RECEIVERS +#define WSA_QOS_NO_RECEIVERS 11008L +#endif +#ifndef WSA_QOS_REQUEST_CONFIRMED +#define WSA_QOS_REQUEST_CONFIRMED 11009L +#endif +#ifndef WSA_QOS_ADMISSION_FAILURE +#define WSA_QOS_ADMISSION_FAILURE 11010L +#endif +#ifndef WSA_QOS_POLICY_FAILURE +#define WSA_QOS_POLICY_FAILURE 11011L +#endif +#ifndef WSA_QOS_BAD_STYLE +#define WSA_QOS_BAD_STYLE 11012L +#endif +#ifndef WSA_QOS_BAD_OBJECT +#define WSA_QOS_BAD_OBJECT 11013L +#endif +#ifndef WSA_QOS_TRAFFIC_CTRL_ERROR +#define WSA_QOS_TRAFFIC_CTRL_ERROR 11014L +#endif +#ifndef WSA_QOS_GENERIC_ERROR +#define WSA_QOS_GENERIC_ERROR 11015L +#endif +#ifndef WSA_QOS_ESERVICETYPE +#define WSA_QOS_ESERVICETYPE 11016L +#endif +#ifndef WSA_QOS_EFLOWSPEC +#define WSA_QOS_EFLOWSPEC 11017L +#endif +#ifndef WSA_QOS_EPROVSPECBUF +#define WSA_QOS_EPROVSPECBUF 11018L +#endif +#ifndef WSA_QOS_EFILTERSTYLE +#define WSA_QOS_EFILTERSTYLE 11019L +#endif +#ifndef WSA_QOS_EFILTERTYPE +#define WSA_QOS_EFILTERTYPE 11020L +#endif +#ifndef WSA_QOS_EFILTERCOUNT +#define WSA_QOS_EFILTERCOUNT 11021L +#endif +#ifndef WSA_QOS_EOBJLENGTH +#define WSA_QOS_EOBJLENGTH 11022L +#endif +#ifndef WSA_QOS_EFLOWCOUNT +#define WSA_QOS_EFLOWCOUNT 11023L +#endif +#ifndef WSA_QOS_EUNKNOWNPSOBJ +#define WSA_QOS_EUNKNOWNPSOBJ 11024L +#endif +#ifndef WSA_QOS_EPOLICYOBJ +#define WSA_QOS_EPOLICYOBJ 11025L +#endif +#ifndef WSA_QOS_EFLOWDESC +#define WSA_QOS_EFLOWDESC 11026L +#endif +#ifndef WSA_QOS_EPSFLOWSPEC +#define WSA_QOS_EPSFLOWSPEC 11027L +#endif +#ifndef WSA_QOS_EPSFILTERSPEC +#define WSA_QOS_EPSFILTERSPEC 11028L +#endif +#ifndef WSA_QOS_ESDMODEOBJ +#define WSA_QOS_ESDMODEOBJ 11029L +#endif +#ifndef WSA_QOS_ESHAPERATEOBJ +#define WSA_QOS_ESHAPERATEOBJ 11030L +#endif +#ifndef WSA_QOS_RESERVED_PETYPE +#define WSA_QOS_RESERVED_PETYPE 11031L +#endif +#endif /* WSABASEERR */ + +#define ERROR_SXS_SECTION_NOT_FOUND 14000L +#define ERROR_SXS_CANT_GEN_ACTCTX 14001L +#define ERROR_SXS_INVALID_ACTCTXDATA_FORMAT 14002L +#define ERROR_SXS_ASSEMBLY_NOT_FOUND 14003L +#define ERROR_SXS_MANIFEST_FORMAT_ERROR 14004L +#define ERROR_SXS_MANIFEST_PARSE_ERROR 14005L +#define ERROR_SXS_ACTIVATION_CONTEXT_DISABLED 14006L +#define ERROR_SXS_KEY_NOT_FOUND 14007L +#define ERROR_SXS_VERSION_CONFLICT 14008L +#define ERROR_SXS_WRONG_SECTION_TYPE 14009L +#define ERROR_SXS_THREAD_QUERIES_DISABLED 14010L +#define ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET 14011L +#define ERROR_SXS_UNKNOWN_ENCODING_GROUP 14012L +#define ERROR_SXS_UNKNOWN_ENCODING 14013L +#define ERROR_SXS_INVALID_XML_NAMESPACE_URI 14014L +#define ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED 14015L +#define ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED 14016L +#define ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE 14017L +#define ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE 14018L +#define ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE 14019L +#define ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT 14020L +#define ERROR_SXS_DUPLICATE_DLL_NAME 14021L +#define ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME 14022L +#define ERROR_SXS_DUPLICATE_CLSID 14023L +#define ERROR_SXS_DUPLICATE_IID 14024L +#define ERROR_SXS_DUPLICATE_TLBID 14025L +#define ERROR_SXS_DUPLICATE_PROGID 14026L +#define ERROR_SXS_DUPLICATE_ASSEMBLY_NAME 14027L +#define ERROR_SXS_FILE_HASH_MISMATCH 14028L +#define ERROR_SXS_POLICY_PARSE_ERROR 14029L +#define ERROR_SXS_XML_E_MISSINGQUOTE 14030L +#define ERROR_SXS_XML_E_COMMENTSYNTAX 14031L +#define ERROR_SXS_XML_E_BADSTARTNAMECHAR 14032L +#define ERROR_SXS_XML_E_BADNAMECHAR 14033L +#define ERROR_SXS_XML_E_BADCHARINSTRING 14034L +#define ERROR_SXS_XML_E_XMLDECLSYNTAX 14035L +#define ERROR_SXS_XML_E_BADCHARDATA 14036L +#define ERROR_SXS_XML_E_MISSINGWHITESPACE 14037L +#define ERROR_SXS_XML_E_EXPECTINGTAGEND 14038L +#define ERROR_SXS_XML_E_MISSINGSEMICOLON 14039L +#define ERROR_SXS_XML_E_UNBALANCEDPAREN 14040L +#define ERROR_SXS_XML_E_INTERNALERROR 14041L +#define ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE 14042L +#define ERROR_SXS_XML_E_INCOMPLETE_ENCODING 14043L +#define ERROR_SXS_XML_E_MISSING_PAREN 14044L +#define ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE 14045L +#define ERROR_SXS_XML_E_MULTIPLE_COLONS 14046L +#define ERROR_SXS_XML_E_INVALID_DECIMAL 14047L +#define ERROR_SXS_XML_E_INVALID_HEXIDECIMAL 14048L +#define ERROR_SXS_XML_E_INVALID_UNICODE 14049L +#define ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK 14050L +#define ERROR_SXS_XML_E_UNEXPECTEDENDTAG 14051L +#define ERROR_SXS_XML_E_UNCLOSEDTAG 14052L +#define ERROR_SXS_XML_E_DUPLICATEATTRIBUTE 14053L +#define ERROR_SXS_XML_E_MULTIPLEROOTS 14054L +#define ERROR_SXS_XML_E_INVALIDATROOTLEVEL 14055L +#define ERROR_SXS_XML_E_BADXMLDECL 14056L +#define ERROR_SXS_XML_E_MISSINGROOT 14057L +#define ERROR_SXS_XML_E_UNEXPECTEDEOF 14058L +#define ERROR_SXS_XML_E_BADPEREFINSUBSET 14059L +#define ERROR_SXS_XML_E_UNCLOSEDSTARTTAG 14060L +#define ERROR_SXS_XML_E_UNCLOSEDENDTAG 14061L +#define ERROR_SXS_XML_E_UNCLOSEDSTRING 14062L +#define ERROR_SXS_XML_E_UNCLOSEDCOMMENT 14063L +#define ERROR_SXS_XML_E_UNCLOSEDDECL 14064L +#define ERROR_SXS_XML_E_UNCLOSEDCDATA 14065L +#define ERROR_SXS_XML_E_RESERVEDNAMESPACE 14066L +#define ERROR_SXS_XML_E_INVALIDENCODING 14067L +#define ERROR_SXS_XML_E_INVALIDSWITCH 14068L +#define ERROR_SXS_XML_E_BADXMLCASE 14069L +#define ERROR_SXS_XML_E_INVALID_STANDALONE 14070L +#define ERROR_SXS_XML_E_UNEXPECTED_STANDALONE 14071L +#define ERROR_SXS_XML_E_INVALID_VERSION 14072L +#define ERROR_SXS_XML_E_MISSINGEQUALS 14073L +#define ERROR_SXS_PROTECTION_RECOVERY_FAILED 14074L +#define ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT 14075L +#define ERROR_SXS_PROTECTION_CATALOG_NOT_VALID 14076L +#define ERROR_SXS_UNTRANSLATABLE_HRESULT 14077L +#define ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING 14078L +#define ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE 14079L +#define ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME 14080L +#define ERROR_IPSEC_QM_POLICY_EXISTS 13000L +#define ERROR_IPSEC_QM_POLICY_NOT_FOUND 13001L +#define ERROR_IPSEC_QM_POLICY_IN_USE 13002L +#define ERROR_IPSEC_MM_POLICY_EXISTS 13003L +#define ERROR_IPSEC_MM_POLICY_NOT_FOUND 13004L +#define ERROR_IPSEC_MM_POLICY_IN_USE 13005L +#define ERROR_IPSEC_MM_FILTER_EXISTS 13006L +#define ERROR_IPSEC_MM_FILTER_NOT_FOUND 13007L +#define ERROR_IPSEC_TRANSPORT_FILTER_EXISTS 13008L +#define ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND 13009L +#define ERROR_IPSEC_MM_AUTH_EXISTS 13010L +#define ERROR_IPSEC_MM_AUTH_NOT_FOUND 13011L +#define ERROR_IPSEC_MM_AUTH_IN_USE 13012L +#define ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND 13013L +#define ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND 13014L +#define ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND 13015L +#define ERROR_IPSEC_TUNNEL_FILTER_EXISTS 13016L +#define ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND 13017L +#define ERROR_IPSEC_MM_FILTER_PENDING_DELETION 13018L +#define ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION 13019L +#define ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION 13020L +#define ERROR_IPSEC_MM_POLICY_PENDING_DELETION 13021L +#define ERROR_IPSEC_MM_AUTH_PENDING_DELETION 13022L +#define ERROR_IPSEC_QM_POLICY_PENDING_DELETION 13023L +#define WARNING_IPSEC_MM_POLICY_PRUNED 13024L +#define WARNING_IPSEC_QM_POLICY_PRUNED 13025L +#define ERROR_IPSEC_IKE_NEG_STATUS_BEGIN 13800L +#define ERROR_IPSEC_IKE_AUTH_FAIL 13801L +#define ERROR_IPSEC_IKE_ATTRIB_FAIL 13802L +#define ERROR_IPSEC_IKE_NEGOTIATION_PENDING 13803L +#define ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR 13804L +#define ERROR_IPSEC_IKE_TIMED_OUT 13805L +#define ERROR_IPSEC_IKE_NO_CERT 13806L +#define ERROR_IPSEC_IKE_SA_DELETED 13807L +#define ERROR_IPSEC_IKE_SA_REAPED 13808L +#define ERROR_IPSEC_IKE_MM_ACQUIRE_DROP 13809L +#define ERROR_IPSEC_IKE_QM_ACQUIRE_DROP 13810L +#define ERROR_IPSEC_IKE_QUEUE_DROP_MM 13811L +#define ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM 13812L +#define ERROR_IPSEC_IKE_DROP_NO_RESPONSE 13813L +#define ERROR_IPSEC_IKE_MM_DELAY_DROP 13814L +#define ERROR_IPSEC_IKE_QM_DELAY_DROP 13815L +#define ERROR_IPSEC_IKE_ERROR 13816L +#define ERROR_IPSEC_IKE_CRL_FAILED 13817L +#define ERROR_IPSEC_IKE_INVALID_KEY_USAGE 13818L +#define ERROR_IPSEC_IKE_INVALID_CERT_TYPE 13819L +#define ERROR_IPSEC_IKE_NO_PRIVATE_KEY 13820L +#define ERROR_IPSEC_IKE_DH_FAIL 13822L +#define ERROR_IPSEC_IKE_INVALID_HEADER 13824L +#define ERROR_IPSEC_IKE_NO_POLICY 13825L +#define ERROR_IPSEC_IKE_INVALID_SIGNATURE 13826L +#define ERROR_IPSEC_IKE_KERBEROS_ERROR 13827L +#define ERROR_IPSEC_IKE_NO_PUBLIC_KEY 13828L +#define ERROR_IPSEC_IKE_PROCESS_ERR 13829L +#define ERROR_IPSEC_IKE_PROCESS_ERR_SA 13830L +#define ERROR_IPSEC_IKE_PROCESS_ERR_PROP 13831L +#define ERROR_IPSEC_IKE_PROCESS_ERR_TRANS 13832L +#define ERROR_IPSEC_IKE_PROCESS_ERR_KE 13833L +#define ERROR_IPSEC_IKE_PROCESS_ERR_ID 13834L +#define ERROR_IPSEC_IKE_PROCESS_ERR_CERT 13835L +#define ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ 13836L +#define ERROR_IPSEC_IKE_PROCESS_ERR_HASH 13837L +#define ERROR_IPSEC_IKE_PROCESS_ERR_SIG 13838L +#define ERROR_IPSEC_IKE_PROCESS_ERR_NONCE 13839L +#define ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY 13840L +#define ERROR_IPSEC_IKE_PROCESS_ERR_DELETE 13841L +#define ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR 13842L +#define ERROR_IPSEC_IKE_INVALID_PAYLOAD 13843L +#define ERROR_IPSEC_IKE_LOAD_SOFT_SA 13844L +#define ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN 13845L +#define ERROR_IPSEC_IKE_INVALID_COOKIE 13846L +#define ERROR_IPSEC_IKE_NO_PEER_CERT 13847L +#define ERROR_IPSEC_IKE_PEER_CRL_FAILED 13848L +#define ERROR_IPSEC_IKE_POLICY_CHANGE 13849L +#define ERROR_IPSEC_IKE_NO_MM_POLICY 13850L +#define ERROR_IPSEC_IKE_NOTCBPRIV 13851L +#define ERROR_IPSEC_IKE_SECLOADFAIL 13852L +#define ERROR_IPSEC_IKE_FAILSSPINIT 13853L +#define ERROR_IPSEC_IKE_FAILQUERYSSP 13854L +#define ERROR_IPSEC_IKE_SRVACQFAIL 13855L +#define ERROR_IPSEC_IKE_SRVQUERYCRED 13856L +#define ERROR_IPSEC_IKE_GETSPIFAIL 13857L +#define ERROR_IPSEC_IKE_INVALID_FILTER 13858L +#define ERROR_IPSEC_IKE_OUT_OF_MEMORY 13859L +#define ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED 13860L +#define ERROR_IPSEC_IKE_INVALID_POLICY 13861L +#define ERROR_IPSEC_IKE_UNKNOWN_DOI 13862L +#define ERROR_IPSEC_IKE_INVALID_SITUATION 13863L +#define ERROR_IPSEC_IKE_DH_FAILURE 13864L +#define ERROR_IPSEC_IKE_INVALID_GROUP 13865L +#define ERROR_IPSEC_IKE_ENCRYPT 13866L +#define ERROR_IPSEC_IKE_DECRYPT 13867L +#define ERROR_IPSEC_IKE_POLICY_MATCH 13868L +#define ERROR_IPSEC_IKE_UNSUPPORTED_ID 13869L +#define ERROR_IPSEC_IKE_INVALID_HASH 13870L +#define ERROR_IPSEC_IKE_INVALID_HASH_ALG 13871L +#define ERROR_IPSEC_IKE_INVALID_HASH_SIZE 13872L +#define ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG 13873L +#define ERROR_IPSEC_IKE_INVALID_AUTH_ALG 13874L +#define ERROR_IPSEC_IKE_INVALID_SIG 13875L +#define ERROR_IPSEC_IKE_LOAD_FAILED 13876L +#define ERROR_IPSEC_IKE_RPC_DELETE 13877L +#define ERROR_IPSEC_IKE_BENIGN_REINIT 13878L +#define ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY 13879L +#define ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN 13881L +#define ERROR_IPSEC_IKE_MM_LIMIT 13882L +#define ERROR_IPSEC_IKE_NEGOTIATION_DISABLED 13883L +#define ERROR_IPSEC_IKE_NEG_STATUS_END 13884L +#define SEVERITY_SUCCESS 0 +#define SEVERITY_ERROR 1 +#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) +#define FAILED(hr) ((HRESULT)(hr) < 0) +#define IS_ERROR(Status) ((unsigned long)(Status) >> 31==SEVERITY_ERROR) +#define HRESULT_CODE(hr) ((hr) & 0xFFFF) +#define SCODE_CODE(sc) ((sc) & 0xFFFF) +#define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff) +#define SCODE_FACILITY(sc) (((sc) >> 16) & 0x1fff) +#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1) +#define SCODE_SEVERITY(sc) (((sc) >> 31) & 0x1) +#define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) +#define MAKE_SCODE(sev,fac,code) ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) +#define FACILITY_NT_BIT 0x10000000 +#define __HRESULT_FROM_WIN32(x) ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000))) +#ifdef INLINE_HRESULT_FROM_WIN32 +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED +typedef long HRESULT; +#endif +__CRT_INLINE HRESULT HRESULT_FROM_WIN32(long x) { return x <= 0 ? (HRESULT)x : (HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000);} +#else +#define HRESULT_FROM_WIN32(x) __HRESULT_FROM_WIN32(x) +#endif +#define HRESULT_FROM_NT(x) ((HRESULT) ((x) | FACILITY_NT_BIT)) +#define GetScode(hr) ((SCODE) (hr)) +#define ResultFromScode(sc) ((HRESULT) (sc)) +#define PropagateResult(hrPrevious,scBase) ((HRESULT) scBase) +#ifdef RC_INVOKED +#define _HRESULT_TYPEDEF_(_sc) _sc +#else +#define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc) +#endif +#define NOERROR 0 +#define E_UNEXPECTED _HRESULT_TYPEDEF_(0x8000FFFFL) +#define E_NOTIMPL _HRESULT_TYPEDEF_(0x80004001L) +#define E_OUTOFMEMORY _HRESULT_TYPEDEF_(0x8007000EL) +#define E_INVALIDARG _HRESULT_TYPEDEF_(0x80070057L) +#define E_NOINTERFACE _HRESULT_TYPEDEF_(0x80004002L) +#define E_POINTER _HRESULT_TYPEDEF_(0x80004003L) +#define E_HANDLE _HRESULT_TYPEDEF_(0x80070006L) +#define E_ABORT _HRESULT_TYPEDEF_(0x80004004L) +#define E_FAIL _HRESULT_TYPEDEF_(0x80004005L) +#define E_ACCESSDENIED _HRESULT_TYPEDEF_(0x80070005L) +#define E_PENDING _HRESULT_TYPEDEF_(0x8000000AL) +#define CO_E_INIT_TLS _HRESULT_TYPEDEF_(0x80004006L) +#define CO_E_INIT_SHARED_ALLOCATOR _HRESULT_TYPEDEF_(0x80004007L) +#define CO_E_INIT_MEMORY_ALLOCATOR _HRESULT_TYPEDEF_(0x80004008L) +#define CO_E_INIT_CLASS_CACHE _HRESULT_TYPEDEF_(0x80004009L) +#define CO_E_INIT_RPC_CHANNEL _HRESULT_TYPEDEF_(0x8000400AL) +#define CO_E_INIT_TLS_SET_CHANNEL_CONTROL _HRESULT_TYPEDEF_(0x8000400BL) +#define CO_E_INIT_TLS_CHANNEL_CONTROL _HRESULT_TYPEDEF_(0x8000400CL) +#define CO_E_INIT_UNACCEPTED_USER_ALLOCATOR _HRESULT_TYPEDEF_(0x8000400DL) +#define CO_E_INIT_SCM_MUTEX_EXISTS _HRESULT_TYPEDEF_(0x8000400EL) +#define CO_E_INIT_SCM_FILE_MAPPING_EXISTS _HRESULT_TYPEDEF_(0x8000400FL) +#define CO_E_INIT_SCM_MAP_VIEW_OF_FILE _HRESULT_TYPEDEF_(0x80004010L) +#define CO_E_INIT_SCM_EXEC_FAILURE _HRESULT_TYPEDEF_(0x80004011L) +#define CO_E_INIT_ONLY_SINGLE_THREADED _HRESULT_TYPEDEF_(0x80004012L) +#define CO_E_CANT_REMOTE _HRESULT_TYPEDEF_(0x80004013L) +#define CO_E_BAD_SERVER_NAME _HRESULT_TYPEDEF_(0x80004014L) +#define CO_E_WRONG_SERVER_IDENTITY _HRESULT_TYPEDEF_(0x80004015L) +#define CO_E_OLE1DDE_DISABLED _HRESULT_TYPEDEF_(0x80004016L) +#define CO_E_RUNAS_SYNTAX _HRESULT_TYPEDEF_(0x80004017L) +#define CO_E_CREATEPROCESS_FAILURE _HRESULT_TYPEDEF_(0x80004018L) +#define CO_E_RUNAS_CREATEPROCESS_FAILURE _HRESULT_TYPEDEF_(0x80004019L) +#define CO_E_RUNAS_LOGON_FAILURE _HRESULT_TYPEDEF_(0x8000401AL) +#define CO_E_LAUNCH_PERMSSION_DENIED _HRESULT_TYPEDEF_(0x8000401BL) +#define CO_E_START_SERVICE_FAILURE _HRESULT_TYPEDEF_(0x8000401CL) +#define CO_E_REMOTE_COMMUNICATION_FAILURE _HRESULT_TYPEDEF_(0x8000401DL) +#define CO_E_SERVER_START_TIMEOUT _HRESULT_TYPEDEF_(0x8000401EL) +#define CO_E_CLSREG_INCONSISTENT _HRESULT_TYPEDEF_(0x8000401FL) +#define CO_E_IIDREG_INCONSISTENT _HRESULT_TYPEDEF_(0x80004020L) +#define CO_E_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x80004021L) +#define CO_E_RELOAD_DLL _HRESULT_TYPEDEF_(0x80004022L) +#define CO_E_MSI_ERROR _HRESULT_TYPEDEF_(0x80004023L) +#define CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT _HRESULT_TYPEDEF_(0x80004024L) +#define CO_E_SERVER_PAUSED _HRESULT_TYPEDEF_(0x80004025L) +#define CO_E_SERVER_NOT_PAUSED _HRESULT_TYPEDEF_(0x80004026L) +#define CO_E_CLASS_DISABLED _HRESULT_TYPEDEF_(0x80004027L) +#define CO_E_CLRNOTAVAILABLE _HRESULT_TYPEDEF_(0x80004028L) +#define CO_E_ASYNC_WORK_REJECTED _HRESULT_TYPEDEF_(0x80004029L) +#define CO_E_SERVER_INIT_TIMEOUT _HRESULT_TYPEDEF_(0x8000402AL) +#define CO_E_NO_SECCTX_IN_ACTIVATE _HRESULT_TYPEDEF_(0x8000402BL) +#define CO_E_TRACKER_CONFIG _HRESULT_TYPEDEF_(0x80004030L) +#define CO_E_THREADPOOL_CONFIG _HRESULT_TYPEDEF_(0x80004031L) +#define CO_E_SXS_CONFIG _HRESULT_TYPEDEF_(0x80004032L) +#define CO_E_MALFORMED_SPN _HRESULT_TYPEDEF_(0x80004033L) +#define S_OK ((HRESULT)0x00000000L) +#define S_FALSE ((HRESULT)0x00000001L) +#define OLE_E_FIRST ((HRESULT)0x80040000L) +#define OLE_E_LAST ((HRESULT)0x800400FFL) +#define OLE_S_FIRST ((HRESULT)0x00040000L) +#define OLE_S_LAST ((HRESULT)0x000400FFL) +#define OLE_E_OLEVERB _HRESULT_TYPEDEF_(0x80040000L) +#define OLE_E_ADVF _HRESULT_TYPEDEF_(0x80040001L) +#define OLE_E_ENUM_NOMORE _HRESULT_TYPEDEF_(0x80040002L) +#define OLE_E_ADVISENOTSUPPORTED _HRESULT_TYPEDEF_(0x80040003L) +#define OLE_E_NOCONNECTION _HRESULT_TYPEDEF_(0x80040004L) +#define OLE_E_NOTRUNNING _HRESULT_TYPEDEF_(0x80040005L) +#define OLE_E_NOCACHE _HRESULT_TYPEDEF_(0x80040006L) +#define OLE_E_BLANK _HRESULT_TYPEDEF_(0x80040007L) +#define OLE_E_CLASSDIFF _HRESULT_TYPEDEF_(0x80040008L) +#define OLE_E_CANT_GETMONIKER _HRESULT_TYPEDEF_(0x80040009L) +#define OLE_E_CANT_BINDTOSOURCE _HRESULT_TYPEDEF_(0x8004000AL) +#define OLE_E_STATIC _HRESULT_TYPEDEF_(0x8004000BL) +#define OLE_E_PROMPTSAVECANCELLED _HRESULT_TYPEDEF_(0x8004000CL) +#define OLE_E_INVALIDRECT _HRESULT_TYPEDEF_(0x8004000DL) +#define OLE_E_WRONGCOMPOBJ _HRESULT_TYPEDEF_(0x8004000EL) +#define OLE_E_INVALIDHWND _HRESULT_TYPEDEF_(0x8004000FL) +#define OLE_E_NOT_INPLACEACTIVE _HRESULT_TYPEDEF_(0x80040010L) +#define OLE_E_CANTCONVERT _HRESULT_TYPEDEF_(0x80040011L) +#define OLE_E_NOSTORAGE _HRESULT_TYPEDEF_(0x80040012L) +#define DV_E_FORMATETC _HRESULT_TYPEDEF_(0x80040064L) +#define DV_E_DVTARGETDEVICE _HRESULT_TYPEDEF_(0x80040065L) +#define DV_E_STGMEDIUM _HRESULT_TYPEDEF_(0x80040066L) +#define DV_E_STATDATA _HRESULT_TYPEDEF_(0x80040067L) +#define DV_E_LINDEX _HRESULT_TYPEDEF_(0x80040068L) +#define DV_E_TYMED _HRESULT_TYPEDEF_(0x80040069L) +#define DV_E_CLIPFORMAT _HRESULT_TYPEDEF_(0x8004006AL) +#define DV_E_DVASPECT _HRESULT_TYPEDEF_(0x8004006BL) +#define DV_E_DVTARGETDEVICE_SIZE _HRESULT_TYPEDEF_(0x8004006CL) +#define DV_E_NOIVIEWOBJECT _HRESULT_TYPEDEF_(0x8004006DL) +#define DRAGDROP_E_FIRST 0x80040100L +#define DRAGDROP_E_LAST 0x8004010FL +#define DRAGDROP_S_FIRST 0x00040100L +#define DRAGDROP_S_LAST 0x0004010FL +#define DRAGDROP_E_NOTREGISTERED _HRESULT_TYPEDEF_(0x80040100L) +#define DRAGDROP_E_ALREADYREGISTERED _HRESULT_TYPEDEF_(0x80040101L) +#define DRAGDROP_E_INVALIDHWND _HRESULT_TYPEDEF_(0x80040102L) +#define CLASSFACTORY_E_FIRST 0x80040110L +#define CLASSFACTORY_E_LAST 0x8004011FL +#define CLASSFACTORY_S_FIRST 0x00040110L +#define CLASSFACTORY_S_LAST 0x0004011FL +#define CLASS_E_NOAGGREGATION _HRESULT_TYPEDEF_(0x80040110L) +#define CLASS_E_CLASSNOTAVAILABLE _HRESULT_TYPEDEF_(0x80040111L) +#define CLASS_E_NOTLICENSED _HRESULT_TYPEDEF_(0x80040112L) +#define MARSHAL_E_FIRST 0x80040120L +#define MARSHAL_E_LAST 0x8004012FL +#define MARSHAL_S_FIRST 0x00040120L +#define MARSHAL_S_LAST 0x0004012FL +#define DATA_E_FIRST 0x80040130L +#define DATA_E_LAST 0x8004013FL +#define DATA_S_FIRST 0x00040130L +#define DATA_S_LAST 0x0004013FL +#define VIEW_E_FIRST 0x80040140L +#define VIEW_E_LAST 0x8004014FL +#define VIEW_S_FIRST 0x00040140L +#define VIEW_S_LAST 0x0004014FL +#define VIEW_E_DRAW _HRESULT_TYPEDEF_(0x80040140L) +#define REGDB_E_FIRST 0x80040150L +#define REGDB_E_LAST 0x8004015FL +#define REGDB_S_FIRST 0x00040150L +#define REGDB_S_LAST 0x0004015FL +#define REGDB_E_READREGDB _HRESULT_TYPEDEF_(0x80040150L) +#define REGDB_E_WRITEREGDB _HRESULT_TYPEDEF_(0x80040151L) +#define REGDB_E_KEYMISSING _HRESULT_TYPEDEF_(0x80040152L) +#define REGDB_E_INVALIDVALUE _HRESULT_TYPEDEF_(0x80040153L) +#define REGDB_E_CLASSNOTREG _HRESULT_TYPEDEF_(0x80040154L) +#define REGDB_E_IIDNOTREG _HRESULT_TYPEDEF_(0x80040155L) +#define REGDB_E_BADTHREADINGMODEL _HRESULT_TYPEDEF_(0x80040156L) +#define CAT_E_FIRST 0x80040160L +#define CAT_E_LAST 0x80040161L +#define CAT_E_CATIDNOEXIST _HRESULT_TYPEDEF_(0x80040160L) +#define CAT_E_NODESCRIPTION _HRESULT_TYPEDEF_(0x80040161L) +#define CS_E_FIRST 0x80040164L +#define CS_E_LAST 0x8004016FL +#define CS_E_PACKAGE_NOTFOUND _HRESULT_TYPEDEF_(0x80040164L) +#define CS_E_NOT_DELETABLE _HRESULT_TYPEDEF_(0x80040165L) +#define CS_E_CLASS_NOTFOUND _HRESULT_TYPEDEF_(0x80040166L) +#define CS_E_INVALID_VERSION _HRESULT_TYPEDEF_(0x80040167L) +#define CS_E_NO_CLASSSTORE _HRESULT_TYPEDEF_(0x80040168L) +#define CS_E_OBJECT_NOTFOUND _HRESULT_TYPEDEF_(0x80040169L) +#define CS_E_OBJECT_ALREADY_EXISTS _HRESULT_TYPEDEF_(0x8004016AL) +#define CS_E_INVALID_PATH _HRESULT_TYPEDEF_(0x8004016BL) +#define CS_E_NETWORK_ERROR _HRESULT_TYPEDEF_(0x8004016CL) +#define CS_E_ADMIN_LIMIT_EXCEEDED _HRESULT_TYPEDEF_(0x8004016DL) +#define CS_E_SCHEMA_MISMATCH _HRESULT_TYPEDEF_(0x8004016EL) +#define CS_E_INTERNAL_ERROR _HRESULT_TYPEDEF_(0x8004016FL) +#define CACHE_E_FIRST 0x80040170L +#define CACHE_E_LAST 0x8004017FL +#define CACHE_S_FIRST 0x00040170L +#define CACHE_S_LAST 0x0004017FL +#define CACHE_E_NOCACHE_UPDATED _HRESULT_TYPEDEF_(0x80040170L) +#define OLEOBJ_E_FIRST 0x80040180L +#define OLEOBJ_E_LAST 0x8004018FL +#define OLEOBJ_S_FIRST 0x00040180L +#define OLEOBJ_S_LAST 0x0004018FL +#define OLEOBJ_E_NOVERBS _HRESULT_TYPEDEF_(0x80040180L) +#define OLEOBJ_E_INVALIDVERB _HRESULT_TYPEDEF_(0x80040181L) +#define CLIENTSITE_E_FIRST 0x80040190L +#define CLIENTSITE_E_LAST 0x8004019FL +#define CLIENTSITE_S_FIRST 0x00040190L +#define CLIENTSITE_S_LAST 0x0004019FL +#define INPLACE_E_NOTUNDOABLE _HRESULT_TYPEDEF_(0x800401A0L) +#define INPLACE_E_NOTOOLSPACE _HRESULT_TYPEDEF_(0x800401A1L) +#define INPLACE_E_FIRST 0x800401A0L +#define INPLACE_E_LAST 0x800401AFL +#define INPLACE_S_FIRST 0x000401A0L +#define INPLACE_S_LAST 0x000401AFL +#define ENUM_E_FIRST 0x800401B0L +#define ENUM_E_LAST 0x800401BFL +#define ENUM_S_FIRST 0x000401B0L +#define ENUM_S_LAST 0x000401BFL +#define CONVERT10_E_FIRST 0x800401C0L +#define CONVERT10_E_LAST 0x800401CFL +#define CONVERT10_S_FIRST 0x000401C0L +#define CONVERT10_S_LAST 0x000401CFL +#define CONVERT10_E_OLESTREAM_GET _HRESULT_TYPEDEF_(0x800401C0L) +#define CONVERT10_E_OLESTREAM_PUT _HRESULT_TYPEDEF_(0x800401C1L) +#define CONVERT10_E_OLESTREAM_FMT _HRESULT_TYPEDEF_(0x800401C2L) +#define CONVERT10_E_OLESTREAM_BITMAP_TO_DIB _HRESULT_TYPEDEF_(0x800401C3L) +#define CONVERT10_E_STG_FMT _HRESULT_TYPEDEF_(0x800401C4L) +#define CONVERT10_E_STG_NO_STD_STREAM _HRESULT_TYPEDEF_(0x800401C5L) +#define CONVERT10_E_STG_DIB_TO_BITMAP _HRESULT_TYPEDEF_(0x800401C6L) +#define CLIPBRD_E_FIRST 0x800401D0L +#define CLIPBRD_E_LAST 0x800401DFL +#define CLIPBRD_S_FIRST 0x000401D0L +#define CLIPBRD_S_LAST 0x000401DFL +#define CLIPBRD_E_CANT_OPEN _HRESULT_TYPEDEF_(0x800401D0L) +#define CLIPBRD_E_CANT_EMPTY _HRESULT_TYPEDEF_(0x800401D1L) +#define CLIPBRD_E_CANT_SET _HRESULT_TYPEDEF_(0x800401D2L) +#define CLIPBRD_E_BAD_DATA _HRESULT_TYPEDEF_(0x800401D3L) +#define CLIPBRD_E_CANT_CLOSE _HRESULT_TYPEDEF_(0x800401D4L) +#define MK_E_FIRST 0x800401E0L +#define MK_E_LAST 0x800401EFL +#define MK_S_FIRST 0x000401E0L +#define MK_S_LAST 0x000401EFL +#define MK_E_CONNECTMANUALLY _HRESULT_TYPEDEF_(0x800401E0L) +#define MK_E_EXCEEDEDDEADLINE _HRESULT_TYPEDEF_(0x800401E1L) +#define MK_E_NEEDGENERIC _HRESULT_TYPEDEF_(0x800401E2L) +#define MK_E_UNAVAILABLE _HRESULT_TYPEDEF_(0x800401E3L) +#define MK_E_SYNTAX _HRESULT_TYPEDEF_(0x800401E4L) +#define MK_E_NOOBJECT _HRESULT_TYPEDEF_(0x800401E5L) +#define MK_E_INVALIDEXTENSION _HRESULT_TYPEDEF_(0x800401E6L) +#define MK_E_INTERMEDIATEINTERFACENOTSUPPORTED _HRESULT_TYPEDEF_(0x800401E7L) +#define MK_E_NOTBINDABLE _HRESULT_TYPEDEF_(0x800401E8L) +#define MK_E_NOTBOUND _HRESULT_TYPEDEF_(0x800401E9L) +#define MK_E_CANTOPENFILE _HRESULT_TYPEDEF_(0x800401EAL) +#define MK_E_MUSTBOTHERUSER _HRESULT_TYPEDEF_(0x800401EBL) +#define MK_E_NOINVERSE _HRESULT_TYPEDEF_(0x800401ECL) +#define MK_E_NOSTORAGE _HRESULT_TYPEDEF_(0x800401EDL) +#define MK_E_NOPREFIX _HRESULT_TYPEDEF_(0x800401EEL) +#define MK_E_ENUMERATION_FAILED _HRESULT_TYPEDEF_(0x800401EFL) +#define CO_E_FIRST 0x800401F0L +#define CO_E_LAST 0x800401FFL +#define CO_S_FIRST 0x000401F0L +#define CO_S_LAST 0x000401FFL +#define CO_E_NOTINITIALIZED _HRESULT_TYPEDEF_(0x800401F0L) +#define CO_E_ALREADYINITIALIZED _HRESULT_TYPEDEF_(0x800401F1L) +#define CO_E_CANTDETERMINECLASS _HRESULT_TYPEDEF_(0x800401F2L) +#define CO_E_CLASSSTRING _HRESULT_TYPEDEF_(0x800401F3L) +#define CO_E_IIDSTRING _HRESULT_TYPEDEF_(0x800401F4L) +#define CO_E_APPNOTFOUND _HRESULT_TYPEDEF_(0x800401F5L) +#define CO_E_APPSINGLEUSE _HRESULT_TYPEDEF_(0x800401F6L) +#define CO_E_ERRORINAPP _HRESULT_TYPEDEF_(0x800401F7L) +#define CO_E_DLLNOTFOUND _HRESULT_TYPEDEF_(0x800401F8L) +#define CO_E_ERRORINDLL _HRESULT_TYPEDEF_(0x800401F9L) +#define CO_E_WRONGOSFORAPP _HRESULT_TYPEDEF_(0x800401FAL) +#define CO_E_OBJNOTREG _HRESULT_TYPEDEF_(0x800401FBL) +#define CO_E_OBJISREG _HRESULT_TYPEDEF_(0x800401FCL) +#define CO_E_OBJNOTCONNECTED _HRESULT_TYPEDEF_(0x800401FDL) +#define CO_E_APPDIDNTREG _HRESULT_TYPEDEF_(0x800401FEL) +#define CO_E_RELEASED _HRESULT_TYPEDEF_(0x800401FFL) +#define EVENT_E_FIRST 0x80040200L +#define EVENT_E_LAST 0x8004021FL +#define EVENT_S_FIRST 0x00040200L +#define EVENT_S_LAST 0x0004021FL +#define EVENT_S_SOME_SUBSCRIBERS_FAILED _HRESULT_TYPEDEF_(0x00040200L) +#define EVENT_E_ALL_SUBSCRIBERS_FAILED _HRESULT_TYPEDEF_(0x80040201L) +#define EVENT_S_NOSUBSCRIBERS _HRESULT_TYPEDEF_(0x00040202L) +#define EVENT_E_QUERYSYNTAX _HRESULT_TYPEDEF_(0x80040203L) +#define EVENT_E_QUERYFIELD _HRESULT_TYPEDEF_(0x80040204L) +#define EVENT_E_INTERNALEXCEPTION _HRESULT_TYPEDEF_(0x80040205L) +#define EVENT_E_INTERNALERROR _HRESULT_TYPEDEF_(0x80040206L) +#define EVENT_E_INVALID_PER_USER_SID _HRESULT_TYPEDEF_(0x80040207L) +#define EVENT_E_USER_EXCEPTION _HRESULT_TYPEDEF_(0x80040208L) +#define EVENT_E_TOO_MANY_METHODS _HRESULT_TYPEDEF_(0x80040209L) +#define EVENT_E_MISSING_EVENTCLASS _HRESULT_TYPEDEF_(0x8004020AL) +#define EVENT_E_NOT_ALL_REMOVED _HRESULT_TYPEDEF_(0x8004020BL) +#define EVENT_E_COMPLUS_NOT_INSTALLED _HRESULT_TYPEDEF_(0x8004020CL) +#define EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT _HRESULT_TYPEDEF_(0x8004020DL) +#define EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT _HRESULT_TYPEDEF_(0x8004020EL) +#define EVENT_E_INVALID_EVENT_CLASS_PARTITION _HRESULT_TYPEDEF_(0x8004020FL) +#define EVENT_E_PER_USER_SID_NOT_LOGGED_ON _HRESULT_TYPEDEF_(0x80040210L) +#define XACT_E_FIRST 0x8004D000 +#define XACT_E_LAST 0x8004D029 +#define XACT_S_FIRST 0x0004D000 +#define XACT_S_LAST 0x0004D010 +#define XACT_E_ALREADYOTHERSINGLEPHASE _HRESULT_TYPEDEF_(0x8004D000L) +#define XACT_E_CANTRETAIN _HRESULT_TYPEDEF_(0x8004D001L) +#define XACT_E_COMMITFAILED _HRESULT_TYPEDEF_(0x8004D002L) +#define XACT_E_COMMITPREVENTED _HRESULT_TYPEDEF_(0x8004D003L) +#define XACT_E_HEURISTICABORT _HRESULT_TYPEDEF_(0x8004D004L) +#define XACT_E_HEURISTICCOMMIT _HRESULT_TYPEDEF_(0x8004D005L) +#define XACT_E_HEURISTICDAMAGE _HRESULT_TYPEDEF_(0x8004D006L) +#define XACT_E_HEURISTICDANGER _HRESULT_TYPEDEF_(0x8004D007L) +#define XACT_E_ISOLATIONLEVEL _HRESULT_TYPEDEF_(0x8004D008L) +#define XACT_E_NOASYNC _HRESULT_TYPEDEF_(0x8004D009L) +#define XACT_E_NOENLIST _HRESULT_TYPEDEF_(0x8004D00AL) +#define XACT_E_NOISORETAIN _HRESULT_TYPEDEF_(0x8004D00BL) +#define XACT_E_NORESOURCE _HRESULT_TYPEDEF_(0x8004D00CL) +#define XACT_E_NOTCURRENT _HRESULT_TYPEDEF_(0x8004D00DL) +#define XACT_E_NOTRANSACTION _HRESULT_TYPEDEF_(0x8004D00EL) +#define XACT_E_NOTSUPPORTED _HRESULT_TYPEDEF_(0x8004D00FL) +#define XACT_E_UNKNOWNRMGRID _HRESULT_TYPEDEF_(0x8004D010L) +#define XACT_E_WRONGSTATE _HRESULT_TYPEDEF_(0x8004D011L) +#define XACT_E_WRONGUOW _HRESULT_TYPEDEF_(0x8004D012L) +#define XACT_E_XTIONEXISTS _HRESULT_TYPEDEF_(0x8004D013L) +#define XACT_E_NOIMPORTOBJECT _HRESULT_TYPEDEF_(0x8004D014L) +#define XACT_E_INVALIDCOOKIE _HRESULT_TYPEDEF_(0x8004D015L) +#define XACT_E_INDOUBT _HRESULT_TYPEDEF_(0x8004D016L) +#define XACT_E_NOTIMEOUT _HRESULT_TYPEDEF_(0x8004D017L) +#define XACT_E_ALREADYINPROGRESS _HRESULT_TYPEDEF_(0x8004D018L) +#define XACT_E_ABORTED _HRESULT_TYPEDEF_(0x8004D019L) +#define XACT_E_LOGFULL _HRESULT_TYPEDEF_(0x8004D01AL) +#define XACT_E_TMNOTAVAILABLE _HRESULT_TYPEDEF_(0x8004D01BL) +#define XACT_E_CONNECTION_DOWN _HRESULT_TYPEDEF_(0x8004D01CL) +#define XACT_E_CONNECTION_DENIED _HRESULT_TYPEDEF_(0x8004D01DL) +#define XACT_E_REENLISTTIMEOUT _HRESULT_TYPEDEF_(0x8004D01EL) +#define XACT_E_TIP_CONNECT_FAILED _HRESULT_TYPEDEF_(0x8004D01FL) +#define XACT_E_TIP_PROTOCOL_ERROR _HRESULT_TYPEDEF_(0x8004D020L) +#define XACT_E_TIP_PULL_FAILED _HRESULT_TYPEDEF_(0x8004D021L) +#define XACT_E_DEST_TMNOTAVAILABLE _HRESULT_TYPEDEF_(0x8004D022L) +#define XACT_E_TIP_DISABLED _HRESULT_TYPEDEF_(0x8004D023L) +#define XACT_E_NETWORK_TX_DISABLED _HRESULT_TYPEDEF_(0x8004D024L) +#define XACT_E_PARTNER_NETWORK_TX_DISABLED _HRESULT_TYPEDEF_(0x8004D025L) +#define XACT_E_XA_TX_DISABLED _HRESULT_TYPEDEF_(0x8004D026L) +#define XACT_E_UNABLE_TO_READ_DTC_CONFIG _HRESULT_TYPEDEF_(0x8004D027L) +#define XACT_E_UNABLE_TO_LOAD_DTC_PROXY _HRESULT_TYPEDEF_(0x8004D028L) +#define XACT_E_ABORTING _HRESULT_TYPEDEF_(0x8004D029L) +#define XACT_E_CLERKNOTFOUND _HRESULT_TYPEDEF_(0x8004D080L) +#define XACT_E_CLERKEXISTS _HRESULT_TYPEDEF_(0x8004D081L) +#define XACT_E_RECOVERYINPROGRESS _HRESULT_TYPEDEF_(0x8004D082L) +#define XACT_E_TRANSACTIONCLOSED _HRESULT_TYPEDEF_(0x8004D083L) +#define XACT_E_INVALIDLSN _HRESULT_TYPEDEF_(0x8004D084L) +#define XACT_E_REPLAYREQUEST _HRESULT_TYPEDEF_(0x8004D085L) +#define XACT_S_ASYNC _HRESULT_TYPEDEF_(0x0004D000L) +#define XACT_S_DEFECT _HRESULT_TYPEDEF_(0x0004D001L) +#define XACT_S_READONLY _HRESULT_TYPEDEF_(0x0004D002L) +#define XACT_S_SOMENORETAIN _HRESULT_TYPEDEF_(0x0004D003L) +#define XACT_S_OKINFORM _HRESULT_TYPEDEF_(0x0004D004L) +#define XACT_S_MADECHANGESCONTENT _HRESULT_TYPEDEF_(0x0004D005L) +#define XACT_S_MADECHANGESINFORM _HRESULT_TYPEDEF_(0x0004D006L) +#define XACT_S_ALLNORETAIN _HRESULT_TYPEDEF_(0x0004D007L) +#define XACT_S_ABORTING _HRESULT_TYPEDEF_(0x0004D008L) +#define XACT_S_SINGLEPHASE _HRESULT_TYPEDEF_(0x0004D009L) +#define XACT_S_LOCALLY_OK _HRESULT_TYPEDEF_(0x0004D00AL) +#define XACT_S_LASTRESOURCEMANAGER _HRESULT_TYPEDEF_(0x0004D010L) +#define CONTEXT_E_FIRST 0x8004E000L +#define CONTEXT_E_LAST 0x8004E02FL +#define CONTEXT_S_FIRST 0x0004E000L +#define CONTEXT_S_LAST 0x0004E02FL +#define CONTEXT_E_ABORTED _HRESULT_TYPEDEF_(0x8004E002L) +#define CONTEXT_E_ABORTING _HRESULT_TYPEDEF_(0x8004E003L) +#define CONTEXT_E_NOCONTEXT _HRESULT_TYPEDEF_(0x8004E004L) +#define CONTEXT_E_WOULD_DEADLOCK _HRESULT_TYPEDEF_(0x8004E005L) +#define CONTEXT_E_SYNCH_TIMEOUT _HRESULT_TYPEDEF_(0x8004E006L) +#define CONTEXT_E_OLDREF _HRESULT_TYPEDEF_(0x8004E007L) +#define CONTEXT_E_ROLENOTFOUND _HRESULT_TYPEDEF_(0x8004E00CL) +#define CONTEXT_E_TMNOTAVAILABLE _HRESULT_TYPEDEF_(0x8004E00FL) +#define CO_E_ACTIVATIONFAILED _HRESULT_TYPEDEF_(0x8004E021L) +#define CO_E_ACTIVATIONFAILED_EVENTLOGGED _HRESULT_TYPEDEF_(0x8004E022L) +#define CO_E_ACTIVATIONFAILED_CATALOGERROR _HRESULT_TYPEDEF_(0x8004E023L) +#define CO_E_ACTIVATIONFAILED_TIMEOUT _HRESULT_TYPEDEF_(0x8004E024L) +#define CO_E_INITIALIZATIONFAILED _HRESULT_TYPEDEF_(0x8004E025L) +#define CONTEXT_E_NOJIT _HRESULT_TYPEDEF_(0x8004E026L) +#define CONTEXT_E_NOTRANSACTION _HRESULT_TYPEDEF_(0x8004E027L) +#define CO_E_THREADINGMODEL_CHANGED _HRESULT_TYPEDEF_(0x8004E028L) +#define CO_E_NOIISINTRINSICS _HRESULT_TYPEDEF_(0x8004E029L) +#define CO_E_NOCOOKIES _HRESULT_TYPEDEF_(0x8004E02AL) +#define CO_E_DBERROR _HRESULT_TYPEDEF_(0x8004E02BL) +#define CO_E_NOTPOOLED _HRESULT_TYPEDEF_(0x8004E02CL) +#define CO_E_NOTCONSTRUCTED _HRESULT_TYPEDEF_(0x8004E02DL) +#define CO_E_NOSYNCHRONIZATION _HRESULT_TYPEDEF_(0x8004E02EL) +#define CO_E_ISOLEVELMISMATCH _HRESULT_TYPEDEF_(0x8004E02FL) +#define OLE_S_USEREG _HRESULT_TYPEDEF_(0x00040000L) +#define OLE_S_STATIC _HRESULT_TYPEDEF_(0x00040001L) +#define OLE_S_MAC_CLIPFORMAT _HRESULT_TYPEDEF_(0x00040002L) +#define DRAGDROP_S_DROP _HRESULT_TYPEDEF_(0x00040100L) +#define DRAGDROP_S_CANCEL _HRESULT_TYPEDEF_(0x00040101L) +#define DRAGDROP_S_USEDEFAULTCURSORS _HRESULT_TYPEDEF_(0x00040102L) +#define DATA_S_SAMEFORMATETC _HRESULT_TYPEDEF_(0x00040130L) +#define VIEW_S_ALREADY_FROZEN _HRESULT_TYPEDEF_(0x00040140L) +#define CACHE_S_FORMATETC_NOTSUPPORTED _HRESULT_TYPEDEF_(0x00040170L) +#define CACHE_S_SAMECACHE _HRESULT_TYPEDEF_(0x00040171L) +#define CACHE_S_SOMECACHES_NOTUPDATED _HRESULT_TYPEDEF_(0x00040172L) +#define OLEOBJ_S_INVALIDVERB _HRESULT_TYPEDEF_(0x00040180L) +#define OLEOBJ_S_CANNOT_DOVERB_NOW _HRESULT_TYPEDEF_(0x00040181L) +#define OLEOBJ_S_INVALIDHWND _HRESULT_TYPEDEF_(0x00040182L) +#define INPLACE_S_TRUNCATED _HRESULT_TYPEDEF_(0x000401A0L) +#define CONVERT10_S_NO_PRESENTATION _HRESULT_TYPEDEF_(0x000401C0L) +#define MK_S_REDUCED_TO_SELF _HRESULT_TYPEDEF_(0x000401E2L) +#define MK_S_ME _HRESULT_TYPEDEF_(0x000401E4L) +#define MK_S_HIM _HRESULT_TYPEDEF_(0x000401E5L) +#define MK_S_US _HRESULT_TYPEDEF_(0x000401E6L) +#define MK_S_MONIKERALREADYREGISTERED _HRESULT_TYPEDEF_(0x000401E7L) +#define SCHED_S_TASK_READY _HRESULT_TYPEDEF_(0x00041300L) +#define SCHED_S_TASK_RUNNING _HRESULT_TYPEDEF_(0x00041301L) +#define SCHED_S_TASK_DISABLED _HRESULT_TYPEDEF_(0x00041302L) +#define SCHED_S_TASK_HAS_NOT_RUN _HRESULT_TYPEDEF_(0x00041303L) +#define SCHED_S_TASK_NO_MORE_RUNS _HRESULT_TYPEDEF_(0x00041304L) +#define SCHED_S_TASK_NOT_SCHEDULED _HRESULT_TYPEDEF_(0x00041305L) +#define SCHED_S_TASK_TERMINATED _HRESULT_TYPEDEF_(0x00041306L) +#define SCHED_S_TASK_NO_VALID_TRIGGERS _HRESULT_TYPEDEF_(0x00041307L) +#define SCHED_S_EVENT_TRIGGER _HRESULT_TYPEDEF_(0x00041308L) +#define SCHED_E_TRIGGER_NOT_FOUND _HRESULT_TYPEDEF_(0x80041309L) +#define SCHED_E_TASK_NOT_READY _HRESULT_TYPEDEF_(0x8004130AL) +#define SCHED_E_TASK_NOT_RUNNING _HRESULT_TYPEDEF_(0x8004130BL) +#define SCHED_E_SERVICE_NOT_INSTALLED _HRESULT_TYPEDEF_(0x8004130CL) +#define SCHED_E_CANNOT_OPEN_TASK _HRESULT_TYPEDEF_(0x8004130DL) +#define SCHED_E_INVALID_TASK _HRESULT_TYPEDEF_(0x8004130EL) +#define SCHED_E_ACCOUNT_INFORMATION_NOT_SET _HRESULT_TYPEDEF_(0x8004130FL) +#define SCHED_E_ACCOUNT_NAME_NOT_FOUND _HRESULT_TYPEDEF_(0x80041310L) +#define SCHED_E_ACCOUNT_DBASE_CORRUPT _HRESULT_TYPEDEF_(0x80041311L) +#define SCHED_E_NO_SECURITY_SERVICES _HRESULT_TYPEDEF_(0x80041312L) +#define SCHED_E_UNKNOWN_OBJECT_VERSION _HRESULT_TYPEDEF_(0x80041313L) +#define SCHED_E_UNSUPPORTED_ACCOUNT_OPTION _HRESULT_TYPEDEF_(0x80041314L) +#define SCHED_E_SERVICE_NOT_RUNNING _HRESULT_TYPEDEF_(0x80041315L) +#define CO_E_CLASS_CREATE_FAILED _HRESULT_TYPEDEF_(0x80080001L) +#define CO_E_SCM_ERROR _HRESULT_TYPEDEF_(0x80080002L) +#define CO_E_SCM_RPC_FAILURE _HRESULT_TYPEDEF_(0x80080003L) +#define CO_E_BAD_PATH _HRESULT_TYPEDEF_(0x80080004L) +#define CO_E_SERVER_EXEC_FAILURE _HRESULT_TYPEDEF_(0x80080005L) +#define CO_E_OBJSRV_RPC_FAILURE _HRESULT_TYPEDEF_(0x80080006L) +#define MK_E_NO_NORMALIZED _HRESULT_TYPEDEF_(0x80080007L) +#define CO_E_SERVER_STOPPING _HRESULT_TYPEDEF_(0x80080008L) +#define MEM_E_INVALID_ROOT _HRESULT_TYPEDEF_(0x80080009L) +#define MEM_E_INVALID_LINK _HRESULT_TYPEDEF_(0x80080010L) +#define MEM_E_INVALID_SIZE _HRESULT_TYPEDEF_(0x80080011L) +#define CO_S_NOTALLINTERFACES _HRESULT_TYPEDEF_(0x00080012L) +#define CO_S_MACHINENAMENOTFOUND _HRESULT_TYPEDEF_(0x00080013L) +#define DISP_E_UNKNOWNINTERFACE _HRESULT_TYPEDEF_(0x80020001L) +#define DISP_E_MEMBERNOTFOUND _HRESULT_TYPEDEF_(0x80020003L) +#define DISP_E_PARAMNOTFOUND _HRESULT_TYPEDEF_(0x80020004L) +#define DISP_E_TYPEMISMATCH _HRESULT_TYPEDEF_(0x80020005L) +#define DISP_E_UNKNOWNNAME _HRESULT_TYPEDEF_(0x80020006L) +#define DISP_E_NONAMEDARGS _HRESULT_TYPEDEF_(0x80020007L) +#define DISP_E_BADVARTYPE _HRESULT_TYPEDEF_(0x80020008L) +#define DISP_E_EXCEPTION _HRESULT_TYPEDEF_(0x80020009L) +#define DISP_E_OVERFLOW _HRESULT_TYPEDEF_(0x8002000AL) +#define DISP_E_BADINDEX _HRESULT_TYPEDEF_(0x8002000BL) +#define DISP_E_UNKNOWNLCID _HRESULT_TYPEDEF_(0x8002000CL) +#define DISP_E_ARRAYISLOCKED _HRESULT_TYPEDEF_(0x8002000DL) +#define DISP_E_BADPARAMCOUNT _HRESULT_TYPEDEF_(0x8002000EL) +#define DISP_E_PARAMNOTOPTIONAL _HRESULT_TYPEDEF_(0x8002000FL) +#define DISP_E_BADCALLEE _HRESULT_TYPEDEF_(0x80020010L) +#define DISP_E_NOTACOLLECTION _HRESULT_TYPEDEF_(0x80020011L) +#define DISP_E_DIVBYZERO _HRESULT_TYPEDEF_(0x80020012L) +#define DISP_E_BUFFERTOOSMALL _HRESULT_TYPEDEF_(0x80020013L) +#define TYPE_E_BUFFERTOOSMALL _HRESULT_TYPEDEF_(0x80028016L) +#define TYPE_E_FIELDNOTFOUND _HRESULT_TYPEDEF_(0x80028017L) +#define TYPE_E_INVDATAREAD _HRESULT_TYPEDEF_(0x80028018L) +#define TYPE_E_UNSUPFORMAT _HRESULT_TYPEDEF_(0x80028019L) +#define TYPE_E_REGISTRYACCESS _HRESULT_TYPEDEF_(0x8002801CL) +#define TYPE_E_LIBNOTREGISTERED _HRESULT_TYPEDEF_(0x8002801DL) +#define TYPE_E_UNDEFINEDTYPE _HRESULT_TYPEDEF_(0x80028027L) +#define TYPE_E_QUALIFIEDNAMEDISALLOWED _HRESULT_TYPEDEF_(0x80028028L) +#define TYPE_E_INVALIDSTATE _HRESULT_TYPEDEF_(0x80028029L) +#define TYPE_E_WRONGTYPEKIND _HRESULT_TYPEDEF_(0x8002802AL) +#define TYPE_E_ELEMENTNOTFOUND _HRESULT_TYPEDEF_(0x8002802BL) +#define TYPE_E_AMBIGUOUSNAME _HRESULT_TYPEDEF_(0x8002802CL) +#define TYPE_E_NAMECONFLICT _HRESULT_TYPEDEF_(0x8002802DL) +#define TYPE_E_UNKNOWNLCID _HRESULT_TYPEDEF_(0x8002802EL) +#define TYPE_E_DLLFUNCTIONNOTFOUND _HRESULT_TYPEDEF_(0x8002802FL) +#define TYPE_E_BADMODULEKIND _HRESULT_TYPEDEF_(0x800288BDL) +#define TYPE_E_SIZETOOBIG _HRESULT_TYPEDEF_(0x800288C5L) +#define TYPE_E_DUPLICATEID _HRESULT_TYPEDEF_(0x800288C6L) +#define TYPE_E_INVALIDID _HRESULT_TYPEDEF_(0x800288CFL) +#define TYPE_E_TYPEMISMATCH _HRESULT_TYPEDEF_(0x80028CA0L) +#define TYPE_E_OUTOFBOUNDS _HRESULT_TYPEDEF_(0x80028CA1L) +#define TYPE_E_IOERROR _HRESULT_TYPEDEF_(0x80028CA2L) +#define TYPE_E_CANTCREATETMPFILE _HRESULT_TYPEDEF_(0x80028CA3L) +#define TYPE_E_CANTLOADLIBRARY _HRESULT_TYPEDEF_(0x80029C4AL) +#define TYPE_E_INCONSISTENTPROPFUNCS _HRESULT_TYPEDEF_(0x80029C83L) +#define TYPE_E_CIRCULARTYPE _HRESULT_TYPEDEF_(0x80029C84L) +#define STG_E_INVALIDFUNCTION _HRESULT_TYPEDEF_(0x80030001L) +#define STG_E_FILENOTFOUND _HRESULT_TYPEDEF_(0x80030002L) +#define STG_E_PATHNOTFOUND _HRESULT_TYPEDEF_(0x80030003L) +#define STG_E_TOOMANYOPENFILES _HRESULT_TYPEDEF_(0x80030004L) +#define STG_E_ACCESSDENIED _HRESULT_TYPEDEF_(0x80030005L) +#define STG_E_INVALIDHANDLE _HRESULT_TYPEDEF_(0x80030006L) +#define STG_E_INSUFFICIENTMEMORY _HRESULT_TYPEDEF_(0x80030008L) +#define STG_E_INVALIDPOINTER _HRESULT_TYPEDEF_(0x80030009L) +#define STG_E_NOMOREFILES _HRESULT_TYPEDEF_(0x80030012L) +#define STG_E_DISKISWRITEPROTECTED _HRESULT_TYPEDEF_(0x80030013L) +#define STG_E_SEEKERROR _HRESULT_TYPEDEF_(0x80030019L) +#define STG_E_WRITEFAULT _HRESULT_TYPEDEF_(0x8003001DL) +#define STG_E_READFAULT _HRESULT_TYPEDEF_(0x8003001EL) +#define STG_E_SHAREVIOLATION _HRESULT_TYPEDEF_(0x80030020L) +#define STG_E_LOCKVIOLATION _HRESULT_TYPEDEF_(0x80030021L) +#define STG_E_FILEALREADYEXISTS _HRESULT_TYPEDEF_(0x80030050L) +#define STG_E_INVALIDPARAMETER _HRESULT_TYPEDEF_(0x80030057L) +#define STG_E_MEDIUMFULL _HRESULT_TYPEDEF_(0x80030070L) +#define STG_E_PROPSETMISMATCHED _HRESULT_TYPEDEF_(0x800300F0L) +#define STG_E_ABNORMALAPIEXIT _HRESULT_TYPEDEF_(0x800300FAL) +#define STG_E_INVALIDHEADER _HRESULT_TYPEDEF_(0x800300FBL) +#define STG_E_INVALIDNAME _HRESULT_TYPEDEF_(0x800300FCL) +#define STG_E_UNKNOWN _HRESULT_TYPEDEF_(0x800300FDL) +#define STG_E_UNIMPLEMENTEDFUNCTION _HRESULT_TYPEDEF_(0x800300FEL) +#define STG_E_INVALIDFLAG _HRESULT_TYPEDEF_(0x800300FFL) +#define STG_E_INUSE _HRESULT_TYPEDEF_(0x80030100L) +#define STG_E_NOTCURRENT _HRESULT_TYPEDEF_(0x80030101L) +#define STG_E_REVERTED _HRESULT_TYPEDEF_(0x80030102L) +#define STG_E_CANTSAVE _HRESULT_TYPEDEF_(0x80030103L) +#define STG_E_OLDFORMAT _HRESULT_TYPEDEF_(0x80030104L) +#define STG_E_OLDDLL _HRESULT_TYPEDEF_(0x80030105L) +#define STG_E_SHAREREQUIRED _HRESULT_TYPEDEF_(0x80030106L) +#define STG_E_NOTFILEBASEDSTORAGE _HRESULT_TYPEDEF_(0x80030107L) +#define STG_E_EXTANTMARSHALLINGS _HRESULT_TYPEDEF_(0x80030108L) +#define STG_E_DOCFILECORRUPT _HRESULT_TYPEDEF_(0x80030109L) +#define STG_E_BADBASEADDRESS _HRESULT_TYPEDEF_(0x80030110L) +#define STG_E_DOCFILETOOLARGE _HRESULT_TYPEDEF_(0x80030111L) +#define STG_E_NOTSIMPLEFORMAT _HRESULT_TYPEDEF_(0x80030112L) +#define STG_E_INCOMPLETE _HRESULT_TYPEDEF_(0x80030201L) +#define STG_E_TERMINATED _HRESULT_TYPEDEF_(0x80030202L) +#define STG_S_CONVERTED _HRESULT_TYPEDEF_(0x00030200L) +#define STG_S_BLOCK _HRESULT_TYPEDEF_(0x00030201L) +#define STG_S_RETRYNOW _HRESULT_TYPEDEF_(0x00030202L) +#define STG_S_MONITORING _HRESULT_TYPEDEF_(0x00030203L) +#define STG_S_MULTIPLEOPENS _HRESULT_TYPEDEF_(0x00030204L) +#define STG_S_CONSOLIDATIONFAILED _HRESULT_TYPEDEF_(0x00030205L) +#define STG_S_CANNOTCONSOLIDATE _HRESULT_TYPEDEF_(0x00030206L) +#define STG_E_STATUS_COPY_PROTECTION_FAILURE _HRESULT_TYPEDEF_(0x80030305L) +#define STG_E_CSS_AUTHENTICATION_FAILURE _HRESULT_TYPEDEF_(0x80030306L) +#define STG_E_CSS_KEY_NOT_PRESENT _HRESULT_TYPEDEF_(0x80030307L) +#define STG_E_CSS_KEY_NOT_ESTABLISHED _HRESULT_TYPEDEF_(0x80030308L) +#define STG_E_CSS_SCRAMBLED_SECTOR _HRESULT_TYPEDEF_(0x80030309L) +#define STG_E_CSS_REGION_MISMATCH _HRESULT_TYPEDEF_(0x8003030AL) +#define STG_E_RESETS_EXHAUSTED _HRESULT_TYPEDEF_(0x8003030BL) +#define RPC_E_CALL_REJECTED _HRESULT_TYPEDEF_(0x80010001L) +#define RPC_E_CALL_CANCELED _HRESULT_TYPEDEF_(0x80010002L) +#define RPC_E_CANTPOST_INSENDCALL _HRESULT_TYPEDEF_(0x80010003L) +#define RPC_E_CANTCALLOUT_INASYNCCALL _HRESULT_TYPEDEF_(0x80010004L) +#define RPC_E_CANTCALLOUT_INEXTERNALCALL _HRESULT_TYPEDEF_(0x80010005L) +#define RPC_E_CONNECTION_TERMINATED _HRESULT_TYPEDEF_(0x80010006L) +#define RPC_E_SERVER_DIED _HRESULT_TYPEDEF_(0x80010007L) +#define RPC_E_CLIENT_DIED _HRESULT_TYPEDEF_(0x80010008L) +#define RPC_E_INVALID_DATAPACKET _HRESULT_TYPEDEF_(0x80010009L) +#define RPC_E_CANTTRANSMIT_CALL _HRESULT_TYPEDEF_(0x8001000AL) +#define RPC_E_CLIENT_CANTMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000BL) +#define RPC_E_CLIENT_CANTUNMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000CL) +#define RPC_E_SERVER_CANTMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000DL) +#define RPC_E_SERVER_CANTUNMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000EL) +#define RPC_E_INVALID_DATA _HRESULT_TYPEDEF_(0x8001000FL) +#define RPC_E_INVALID_PARAMETER _HRESULT_TYPEDEF_(0x80010010L) +#define RPC_E_CANTCALLOUT_AGAIN _HRESULT_TYPEDEF_(0x80010011L) +#define RPC_E_SERVER_DIED_DNE _HRESULT_TYPEDEF_(0x80010012L) +#define RPC_E_SYS_CALL_FAILED _HRESULT_TYPEDEF_(0x80010100L) +#define RPC_E_OUT_OF_RESOURCES _HRESULT_TYPEDEF_(0x80010101L) +#define RPC_E_ATTEMPTED_MULTITHREAD _HRESULT_TYPEDEF_(0x80010102L) +#define RPC_E_NOT_REGISTERED _HRESULT_TYPEDEF_(0x80010103L) +#define RPC_E_FAULT _HRESULT_TYPEDEF_(0x80010104L) +#define RPC_E_SERVERFAULT _HRESULT_TYPEDEF_(0x80010105L) +#define RPC_E_CHANGED_MODE _HRESULT_TYPEDEF_(0x80010106L) +#define RPC_E_INVALIDMETHOD _HRESULT_TYPEDEF_(0x80010107L) +#define RPC_E_DISCONNECTED _HRESULT_TYPEDEF_(0x80010108L) +#define RPC_E_RETRY _HRESULT_TYPEDEF_(0x80010109L) +#define RPC_E_SERVERCALL_RETRYLATER _HRESULT_TYPEDEF_(0x8001010AL) +#define RPC_E_SERVERCALL_REJECTED _HRESULT_TYPEDEF_(0x8001010BL) +#define RPC_E_INVALID_CALLDATA _HRESULT_TYPEDEF_(0x8001010CL) +#define RPC_E_CANTCALLOUT_ININPUTSYNCCALL _HRESULT_TYPEDEF_(0x8001010DL) +#define RPC_E_WRONG_THREAD _HRESULT_TYPEDEF_(0x8001010EL) +#define RPC_E_THREAD_NOT_INIT _HRESULT_TYPEDEF_(0x8001010FL) +#define RPC_E_VERSION_MISMATCH _HRESULT_TYPEDEF_(0x80010110L) +#define RPC_E_INVALID_HEADER _HRESULT_TYPEDEF_(0x80010111L) +#define RPC_E_INVALID_EXTENSION _HRESULT_TYPEDEF_(0x80010112L) +#define RPC_E_INVALID_IPID _HRESULT_TYPEDEF_(0x80010113L) +#define RPC_E_INVALID_OBJECT _HRESULT_TYPEDEF_(0x80010114L) +#define RPC_S_CALLPENDING _HRESULT_TYPEDEF_(0x80010115L) +#define RPC_S_WAITONTIMER _HRESULT_TYPEDEF_(0x80010116L) +#define RPC_E_CALL_COMPLETE _HRESULT_TYPEDEF_(0x80010117L) +#define RPC_E_UNSECURE_CALL _HRESULT_TYPEDEF_(0x80010118L) +#define RPC_E_TOO_LATE _HRESULT_TYPEDEF_(0x80010119L) +#define RPC_E_NO_GOOD_SECURITY_PACKAGES _HRESULT_TYPEDEF_(0x8001011AL) +#define RPC_E_ACCESS_DENIED _HRESULT_TYPEDEF_(0x8001011BL) +#define RPC_E_REMOTE_DISABLED _HRESULT_TYPEDEF_(0x8001011CL) +#define RPC_E_INVALID_OBJREF _HRESULT_TYPEDEF_(0x8001011DL) +#define RPC_E_NO_CONTEXT _HRESULT_TYPEDEF_(0x8001011EL) +#define RPC_E_TIMEOUT _HRESULT_TYPEDEF_(0x8001011FL) +#define RPC_E_NO_SYNC _HRESULT_TYPEDEF_(0x80010120L) +#define RPC_E_FULLSIC_REQUIRED _HRESULT_TYPEDEF_(0x80010121L) +#define RPC_E_INVALID_STD_NAME _HRESULT_TYPEDEF_(0x80010122L) +#define CO_E_FAILEDTOIMPERSONATE _HRESULT_TYPEDEF_(0x80010123L) +#define CO_E_FAILEDTOGETSECCTX _HRESULT_TYPEDEF_(0x80010124L) +#define CO_E_FAILEDTOOPENTHREADTOKEN _HRESULT_TYPEDEF_(0x80010125L) +#define CO_E_FAILEDTOGETTOKENINFO _HRESULT_TYPEDEF_(0x80010126L) +#define CO_E_TRUSTEEDOESNTMATCHCLIENT _HRESULT_TYPEDEF_(0x80010127L) +#define CO_E_FAILEDTOQUERYCLIENTBLANKET _HRESULT_TYPEDEF_(0x80010128L) +#define CO_E_FAILEDTOSETDACL _HRESULT_TYPEDEF_(0x80010129L) +#define CO_E_ACCESSCHECKFAILED _HRESULT_TYPEDEF_(0x8001012AL) +#define CO_E_NETACCESSAPIFAILED _HRESULT_TYPEDEF_(0x8001012BL) +#define CO_E_WRONGTRUSTEENAMESYNTAX _HRESULT_TYPEDEF_(0x8001012CL) +#define CO_E_INVALIDSID _HRESULT_TYPEDEF_(0x8001012DL) +#define CO_E_CONVERSIONFAILED _HRESULT_TYPEDEF_(0x8001012EL) +#define CO_E_NOMATCHINGSIDFOUND _HRESULT_TYPEDEF_(0x8001012FL) +#define CO_E_LOOKUPACCSIDFAILED _HRESULT_TYPEDEF_(0x80010130L) +#define CO_E_NOMATCHINGNAMEFOUND _HRESULT_TYPEDEF_(0x80010131L) +#define CO_E_LOOKUPACCNAMEFAILED _HRESULT_TYPEDEF_(0x80010132L) +#define CO_E_SETSERLHNDLFAILED _HRESULT_TYPEDEF_(0x80010133L) +#define CO_E_FAILEDTOGETWINDIR _HRESULT_TYPEDEF_(0x80010134L) +#define CO_E_PATHTOOLONG _HRESULT_TYPEDEF_(0x80010135L) +#define CO_E_FAILEDTOGENUUID _HRESULT_TYPEDEF_(0x80010136L) +#define CO_E_FAILEDTOCREATEFILE _HRESULT_TYPEDEF_(0x80010137L) +#define CO_E_FAILEDTOCLOSEHANDLE _HRESULT_TYPEDEF_(0x80010138L) +#define CO_E_EXCEEDSYSACLLIMIT _HRESULT_TYPEDEF_(0x80010139L) +#define CO_E_ACESINWRONGORDER _HRESULT_TYPEDEF_(0x8001013AL) +#define CO_E_INCOMPATIBLESTREAMVERSION _HRESULT_TYPEDEF_(0x8001013BL) +#define CO_E_FAILEDTOOPENPROCESSTOKEN _HRESULT_TYPEDEF_(0x8001013CL) +#define CO_E_DECODEFAILED _HRESULT_TYPEDEF_(0x8001013DL) +#define CO_E_ACNOTINITIALIZED _HRESULT_TYPEDEF_(0x8001013FL) +#define CO_E_CANCEL_DISABLED _HRESULT_TYPEDEF_(0x80010140L) +#define RPC_E_UNEXPECTED _HRESULT_TYPEDEF_(0x8001FFFFL) +#define ERROR_AUDITING_DISABLED _HRESULT_TYPEDEF_(0xC0090001L) +#define ERROR_ALL_SIDS_FILTERED _HRESULT_TYPEDEF_(0xC0090002L) +#define NTE_BAD_UID _HRESULT_TYPEDEF_(0x80090001L) +#define NTE_BAD_HASH _HRESULT_TYPEDEF_(0x80090002L) +#define NTE_BAD_KEY _HRESULT_TYPEDEF_(0x80090003L) +#define NTE_BAD_LEN _HRESULT_TYPEDEF_(0x80090004L) +#define NTE_BAD_DATA _HRESULT_TYPEDEF_(0x80090005L) +#define NTE_BAD_SIGNATURE _HRESULT_TYPEDEF_(0x80090006L) +#define NTE_BAD_VER _HRESULT_TYPEDEF_(0x80090007L) +#define NTE_BAD_ALGID _HRESULT_TYPEDEF_(0x80090008L) +#define NTE_BAD_FLAGS _HRESULT_TYPEDEF_(0x80090009L) +#define NTE_BAD_TYPE _HRESULT_TYPEDEF_(0x8009000AL) +#define NTE_BAD_KEY_STATE _HRESULT_TYPEDEF_(0x8009000BL) +#define NTE_BAD_HASH_STATE _HRESULT_TYPEDEF_(0x8009000CL) +#define NTE_NO_KEY _HRESULT_TYPEDEF_(0x8009000DL) +#define NTE_NO_MEMORY _HRESULT_TYPEDEF_(0x8009000EL) +#define NTE_EXISTS _HRESULT_TYPEDEF_(0x8009000FL) +#define NTE_PERM _HRESULT_TYPEDEF_(0x80090010L) +#define NTE_NOT_FOUND _HRESULT_TYPEDEF_(0x80090011L) +#define NTE_DOUBLE_ENCRYPT _HRESULT_TYPEDEF_(0x80090012L) +#define NTE_BAD_PROVIDER _HRESULT_TYPEDEF_(0x80090013L) +#define NTE_BAD_PROV_TYPE _HRESULT_TYPEDEF_(0x80090014L) +#define NTE_BAD_PUBLIC_KEY _HRESULT_TYPEDEF_(0x80090015L) +#define NTE_BAD_KEYSET _HRESULT_TYPEDEF_(0x80090016L) +#define NTE_PROV_TYPE_NOT_DEF _HRESULT_TYPEDEF_(0x80090017L) +#define NTE_PROV_TYPE_ENTRY_BAD _HRESULT_TYPEDEF_(0x80090018L) +#define NTE_KEYSET_NOT_DEF _HRESULT_TYPEDEF_(0x80090019L) +#define NTE_KEYSET_ENTRY_BAD _HRESULT_TYPEDEF_(0x8009001AL) +#define NTE_PROV_TYPE_NO_MATCH _HRESULT_TYPEDEF_(0x8009001BL) +#define NTE_SIGNATURE_FILE_BAD _HRESULT_TYPEDEF_(0x8009001CL) +#define NTE_PROVIDER_DLL_FAIL _HRESULT_TYPEDEF_(0x8009001DL) +#define NTE_PROV_DLL_NOT_FOUND _HRESULT_TYPEDEF_(0x8009001EL) +#define NTE_BAD_KEYSET_PARAM _HRESULT_TYPEDEF_(0x8009001FL) +#define NTE_FAIL _HRESULT_TYPEDEF_(0x80090020L) +#define NTE_SYS_ERR _HRESULT_TYPEDEF_(0x80090021L) +#define NTE_SILENT_CONTEXT _HRESULT_TYPEDEF_(0x80090022L) +#define NTE_TOKEN_KEYSET_STORAGE_FULL _HRESULT_TYPEDEF_(0x80090023L) +#define NTE_TEMPORARY_PROFILE _HRESULT_TYPEDEF_(0x80090024L) +#define NTE_FIXEDPARAMETER _HRESULT_TYPEDEF_(0x80090025L) +#define SEC_E_INSUFFICIENT_MEMORY _HRESULT_TYPEDEF_(0x80090300L) +#define SEC_E_INVALID_HANDLE _HRESULT_TYPEDEF_(0x80090301L) +#define SEC_E_UNSUPPORTED_FUNCTION _HRESULT_TYPEDEF_(0x80090302L) +#define SEC_E_TARGET_UNKNOWN _HRESULT_TYPEDEF_(0x80090303L) +#define SEC_E_INTERNAL_ERROR _HRESULT_TYPEDEF_(0x80090304L) +#define SEC_E_SECPKG_NOT_FOUND _HRESULT_TYPEDEF_(0x80090305L) +#define SEC_E_NOT_OWNER _HRESULT_TYPEDEF_(0x80090306L) +#define SEC_E_CANNOT_INSTALL _HRESULT_TYPEDEF_(0x80090307L) +#define SEC_E_INVALID_TOKEN _HRESULT_TYPEDEF_(0x80090308L) +#define SEC_E_CANNOT_PACK _HRESULT_TYPEDEF_(0x80090309L) +#define SEC_E_QOP_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009030AL) +#define SEC_E_NO_IMPERSONATION _HRESULT_TYPEDEF_(0x8009030BL) +#define SEC_E_LOGON_DENIED _HRESULT_TYPEDEF_(0x8009030CL) +#define SEC_E_UNKNOWN_CREDENTIALS _HRESULT_TYPEDEF_(0x8009030DL) +#define SEC_E_NO_CREDENTIALS _HRESULT_TYPEDEF_(0x8009030EL) +#define SEC_E_MESSAGE_ALTERED _HRESULT_TYPEDEF_(0x8009030FL) +#define SEC_E_OUT_OF_SEQUENCE _HRESULT_TYPEDEF_(0x80090310L) +#define SEC_E_NO_AUTHENTICATING_AUTHORITY _HRESULT_TYPEDEF_(0x80090311L) +#define SEC_I_CONTINUE_NEEDED _HRESULT_TYPEDEF_(0x00090312L) +#define SEC_I_COMPLETE_NEEDED _HRESULT_TYPEDEF_(0x00090313L) +#define SEC_I_COMPLETE_AND_CONTINUE _HRESULT_TYPEDEF_(0x00090314L) +#define SEC_I_LOCAL_LOGON _HRESULT_TYPEDEF_(0x00090315L) +#define SEC_E_BAD_PKGID _HRESULT_TYPEDEF_(0x80090316L) +#define SEC_E_CONTEXT_EXPIRED _HRESULT_TYPEDEF_(0x80090317L) +#define SEC_I_CONTEXT_EXPIRED _HRESULT_TYPEDEF_(0x00090317L) +#define SEC_E_INCOMPLETE_MESSAGE _HRESULT_TYPEDEF_(0x80090318L) +#define SEC_E_INCOMPLETE_CREDENTIALS _HRESULT_TYPEDEF_(0x80090320L) +#define SEC_E_BUFFER_TOO_SMALL _HRESULT_TYPEDEF_(0x80090321L) +#define SEC_I_INCOMPLETE_CREDENTIALS _HRESULT_TYPEDEF_(0x00090320L) +#define SEC_I_RENEGOTIATE _HRESULT_TYPEDEF_(0x00090321L) +#define SEC_E_WRONG_PRINCIPAL _HRESULT_TYPEDEF_(0x80090322L) +#define SEC_I_NO_LSA_CONTEXT _HRESULT_TYPEDEF_(0x00090323L) +#define SEC_E_TIME_SKEW _HRESULT_TYPEDEF_(0x80090324L) +#define SEC_E_UNTRUSTED_ROOT _HRESULT_TYPEDEF_(0x80090325L) +#define SEC_E_ILLEGAL_MESSAGE _HRESULT_TYPEDEF_(0x80090326L) +#define SEC_E_CERT_UNKNOWN _HRESULT_TYPEDEF_(0x80090327L) +#define SEC_E_CERT_EXPIRED _HRESULT_TYPEDEF_(0x80090328L) +#define SEC_E_ENCRYPT_FAILURE _HRESULT_TYPEDEF_(0x80090329L) +#define SEC_E_DECRYPT_FAILURE _HRESULT_TYPEDEF_(0x80090330L) +#define SEC_E_ALGORITHM_MISMATCH _HRESULT_TYPEDEF_(0x80090331L) +#define SEC_E_SECURITY_QOS_FAILED _HRESULT_TYPEDEF_(0x80090332L) +#define SEC_E_UNFINISHED_CONTEXT_DELETED _HRESULT_TYPEDEF_(0x80090333L) +#define SEC_E_NO_TGT_REPLY _HRESULT_TYPEDEF_(0x80090334L) +#define SEC_E_NO_IP_ADDRESSES _HRESULT_TYPEDEF_(0x80090335L) +#define SEC_E_WRONG_CREDENTIAL_HANDLE _HRESULT_TYPEDEF_(0x80090336L) +#define SEC_E_CRYPTO_SYSTEM_INVALID _HRESULT_TYPEDEF_(0x80090337L) +#define SEC_E_MAX_REFERRALS_EXCEEDED _HRESULT_TYPEDEF_(0x80090338L) +#define SEC_E_MUST_BE_KDC _HRESULT_TYPEDEF_(0x80090339L) +#define SEC_E_STRONG_CRYPTO_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009033AL) +#define SEC_E_TOO_MANY_PRINCIPALS _HRESULT_TYPEDEF_(0x8009033BL) +#define SEC_E_NO_PA_DATA _HRESULT_TYPEDEF_(0x8009033CL) +#define SEC_E_PKINIT_NAME_MISMATCH _HRESULT_TYPEDEF_(0x8009033DL) +#define SEC_E_SMARTCARD_LOGON_REQUIRED _HRESULT_TYPEDEF_(0x8009033EL) +#define SEC_E_SHUTDOWN_IN_PROGRESS _HRESULT_TYPEDEF_(0x8009033FL) +#define SEC_E_KDC_INVALID_REQUEST _HRESULT_TYPEDEF_(0x80090340L) +#define SEC_E_KDC_UNABLE_TO_REFER _HRESULT_TYPEDEF_(0x80090341L) +#define SEC_E_KDC_UNKNOWN_ETYPE _HRESULT_TYPEDEF_(0x80090342L) +#define SEC_E_UNSUPPORTED_PREAUTH _HRESULT_TYPEDEF_(0x80090343L) +#define SEC_E_DELEGATION_REQUIRED _HRESULT_TYPEDEF_(0x80090345L) +#define SEC_E_BAD_BINDINGS _HRESULT_TYPEDEF_(0x80090346L) +#define SEC_E_MULTIPLE_ACCOUNTS _HRESULT_TYPEDEF_(0x80090347L) +#define SEC_E_NO_KERB_KEY _HRESULT_TYPEDEF_(0x80090348L) +#define SEC_E_CERT_WRONG_USAGE _HRESULT_TYPEDEF_(0x80090349L) +#define SEC_E_DOWNGRADE_DETECTED _HRESULT_TYPEDEF_(0x80090350L) +#define SEC_E_SMARTCARD_CERT_REVOKED _HRESULT_TYPEDEF_(0x80090351L) +#define SEC_E_ISSUING_CA_UNTRUSTED _HRESULT_TYPEDEF_(0x80090352L) +#define SEC_E_REVOCATION_OFFLINE_C _HRESULT_TYPEDEF_(0x80090353L) +#define SEC_E_PKINIT_CLIENT_FAILURE _HRESULT_TYPEDEF_(0x80090354L) +#define SEC_E_SMARTCARD_CERT_EXPIRED _HRESULT_TYPEDEF_(0x80090355L) +#define SEC_E_NO_S4U_PROT_SUPPORT _HRESULT_TYPEDEF_(0x80090356L) +#define SEC_E_CROSSREALM_DELEGATION_FAILURE _HRESULT_TYPEDEF_(0x80090357L) +#define SEC_E_REVOCATION_OFFLINE_KDC _HRESULT_TYPEDEF_(0x80090358L) +#define SEC_E_ISSUING_CA_UNTRUSTED_KDC _HRESULT_TYPEDEF_(0x80090359L) +#define SEC_E_KDC_CERT_EXPIRED _HRESULT_TYPEDEF_(0x8009035AL) +#define SEC_E_KDC_CERT_REVOKED _HRESULT_TYPEDEF_(0x8009035BL) +#define SEC_E_NO_SPM SEC_E_INTERNAL_ERROR +#define SEC_E_NOT_SUPPORTED SEC_E_UNSUPPORTED_FUNCTION +#define CRYPT_E_MSG_ERROR _HRESULT_TYPEDEF_(0x80091001L) +#define CRYPT_E_UNKNOWN_ALGO _HRESULT_TYPEDEF_(0x80091002L) +#define CRYPT_E_OID_FORMAT _HRESULT_TYPEDEF_(0x80091003L) +#define CRYPT_E_INVALID_MSG_TYPE _HRESULT_TYPEDEF_(0x80091004L) +#define CRYPT_E_UNEXPECTED_ENCODING _HRESULT_TYPEDEF_(0x80091005L) +#define CRYPT_E_AUTH_ATTR_MISSING _HRESULT_TYPEDEF_(0x80091006L) +#define CRYPT_E_HASH_VALUE _HRESULT_TYPEDEF_(0x80091007L) +#define CRYPT_E_INVALID_INDEX _HRESULT_TYPEDEF_(0x80091008L) +#define CRYPT_E_ALREADY_DECRYPTED _HRESULT_TYPEDEF_(0x80091009L) +#define CRYPT_E_NOT_DECRYPTED _HRESULT_TYPEDEF_(0x8009100AL) +#define CRYPT_E_RECIPIENT_NOT_FOUND _HRESULT_TYPEDEF_(0x8009100BL) +#define CRYPT_E_CONTROL_TYPE _HRESULT_TYPEDEF_(0x8009100CL) +#define CRYPT_E_ISSUER_SERIALNUMBER _HRESULT_TYPEDEF_(0x8009100DL) +#define CRYPT_E_SIGNER_NOT_FOUND _HRESULT_TYPEDEF_(0x8009100EL) +#define CRYPT_E_ATTRIBUTES_MISSING _HRESULT_TYPEDEF_(0x8009100FL) +#define CRYPT_E_STREAM_MSG_NOT_READY _HRESULT_TYPEDEF_(0x80091010L) +#define CRYPT_E_STREAM_INSUFFICIENT_DATA _HRESULT_TYPEDEF_(0x80091011L) +#define CRYPT_I_NEW_PROTECTION_REQUIRED _HRESULT_TYPEDEF_(0x00091012L) +#define CRYPT_E_BAD_LEN _HRESULT_TYPEDEF_(0x80092001L) +#define CRYPT_E_BAD_ENCODE _HRESULT_TYPEDEF_(0x80092002L) +#define CRYPT_E_FILE_ERROR _HRESULT_TYPEDEF_(0x80092003L) +#define CRYPT_E_NOT_FOUND _HRESULT_TYPEDEF_(0x80092004L) +#define CRYPT_E_EXISTS _HRESULT_TYPEDEF_(0x80092005L) +#define CRYPT_E_NO_PROVIDER _HRESULT_TYPEDEF_(0x80092006L) +#define CRYPT_E_SELF_SIGNED _HRESULT_TYPEDEF_(0x80092007L) +#define CRYPT_E_DELETED_PREV _HRESULT_TYPEDEF_(0x80092008L) +#define CRYPT_E_NO_MATCH _HRESULT_TYPEDEF_(0x80092009L) +#define CRYPT_E_UNEXPECTED_MSG_TYPE _HRESULT_TYPEDEF_(0x8009200AL) +#define CRYPT_E_NO_KEY_PROPERTY _HRESULT_TYPEDEF_(0x8009200BL) +#define CRYPT_E_NO_DECRYPT_CERT _HRESULT_TYPEDEF_(0x8009200CL) +#define CRYPT_E_BAD_MSG _HRESULT_TYPEDEF_(0x8009200DL) +#define CRYPT_E_NO_SIGNER _HRESULT_TYPEDEF_(0x8009200EL) +#define CRYPT_E_PENDING_CLOSE _HRESULT_TYPEDEF_(0x8009200FL) +#define CRYPT_E_REVOKED _HRESULT_TYPEDEF_(0x80092010L) +#define CRYPT_E_NO_REVOCATION_DLL _HRESULT_TYPEDEF_(0x80092011L) +#define CRYPT_E_NO_REVOCATION_CHECK _HRESULT_TYPEDEF_(0x80092012L) +#define CRYPT_E_REVOCATION_OFFLINE _HRESULT_TYPEDEF_(0x80092013L) +#define CRYPT_E_NOT_IN_REVOCATION_DATABASE _HRESULT_TYPEDEF_(0x80092014L) +#define CRYPT_E_INVALID_NUMERIC_STRING _HRESULT_TYPEDEF_(0x80092020L) +#define CRYPT_E_INVALID_PRINTABLE_STRING _HRESULT_TYPEDEF_(0x80092021L) +#define CRYPT_E_INVALID_IA5_STRING _HRESULT_TYPEDEF_(0x80092022L) +#define CRYPT_E_INVALID_X500_STRING _HRESULT_TYPEDEF_(0x80092023L) +#define CRYPT_E_NOT_CHAR_STRING _HRESULT_TYPEDEF_(0x80092024L) +#define CRYPT_E_FILERESIZED _HRESULT_TYPEDEF_(0x80092025L) +#define CRYPT_E_SECURITY_SETTINGS _HRESULT_TYPEDEF_(0x80092026L) +#define CRYPT_E_NO_VERIFY_USAGE_DLL _HRESULT_TYPEDEF_(0x80092027L) +#define CRYPT_E_NO_VERIFY_USAGE_CHECK _HRESULT_TYPEDEF_(0x80092028L) +#define CRYPT_E_VERIFY_USAGE_OFFLINE _HRESULT_TYPEDEF_(0x80092029L) +#define CRYPT_E_NOT_IN_CTL _HRESULT_TYPEDEF_(0x8009202AL) +#define CRYPT_E_NO_TRUSTED_SIGNER _HRESULT_TYPEDEF_(0x8009202BL) +#define CRYPT_E_MISSING_PUBKEY_PARA _HRESULT_TYPEDEF_(0x8009202CL) +#define CRYPT_E_OSS_ERROR _HRESULT_TYPEDEF_(0x80093000L) +#define OSS_MORE_BUF _HRESULT_TYPEDEF_(0x80093001L) +#define OSS_NEGATIVE_UINTEGER _HRESULT_TYPEDEF_(0x80093002L) +#define OSS_PDU_RANGE _HRESULT_TYPEDEF_(0x80093003L) +#define OSS_MORE_INPUT _HRESULT_TYPEDEF_(0x80093004L) +#define OSS_DATA_ERROR _HRESULT_TYPEDEF_(0x80093005L) +#define OSS_BAD_ARG _HRESULT_TYPEDEF_(0x80093006L) +#define OSS_BAD_VERSION _HRESULT_TYPEDEF_(0x80093007L) +#define OSS_OUT_MEMORY _HRESULT_TYPEDEF_(0x80093008L) +#define OSS_PDU_MISMATCH _HRESULT_TYPEDEF_(0x80093009L) +#define OSS_LIMITED _HRESULT_TYPEDEF_(0x8009300AL) +#define OSS_BAD_PTR _HRESULT_TYPEDEF_(0x8009300BL) +#define OSS_BAD_TIME _HRESULT_TYPEDEF_(0x8009300CL) +#define OSS_INDEFINITE_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009300DL) +#define OSS_MEM_ERROR _HRESULT_TYPEDEF_(0x8009300EL) +#define OSS_BAD_TABLE _HRESULT_TYPEDEF_(0x8009300FL) +#define OSS_TOO_LONG _HRESULT_TYPEDEF_(0x80093010L) +#define OSS_CONSTRAINT_VIOLATED _HRESULT_TYPEDEF_(0x80093011L) +#define OSS_FATAL_ERROR _HRESULT_TYPEDEF_(0x80093012L) +#define OSS_ACCESS_SERIALIZATION_ERROR _HRESULT_TYPEDEF_(0x80093013L) +#define OSS_NULL_TBL _HRESULT_TYPEDEF_(0x80093014L) +#define OSS_NULL_FCN _HRESULT_TYPEDEF_(0x80093015L) +#define OSS_BAD_ENCRULES _HRESULT_TYPEDEF_(0x80093016L) +#define OSS_UNAVAIL_ENCRULES _HRESULT_TYPEDEF_(0x80093017L) +#define OSS_CANT_OPEN_TRACE_WINDOW _HRESULT_TYPEDEF_(0x80093018L) +#define OSS_UNIMPLEMENTED _HRESULT_TYPEDEF_(0x80093019L) +#define OSS_OID_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009301AL) +#define OSS_CANT_OPEN_TRACE_FILE _HRESULT_TYPEDEF_(0x8009301BL) +#define OSS_TRACE_FILE_ALREADY_OPEN _HRESULT_TYPEDEF_(0x8009301CL) +#define OSS_TABLE_MISMATCH _HRESULT_TYPEDEF_(0x8009301DL) +#define OSS_TYPE_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009301EL) +#define OSS_REAL_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009301FL) +#define OSS_REAL_CODE_NOT_LINKED _HRESULT_TYPEDEF_(0x80093020L) +#define OSS_OUT_OF_RANGE _HRESULT_TYPEDEF_(0x80093021L) +#define OSS_COPIER_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093022L) +#define OSS_CONSTRAINT_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093023L) +#define OSS_COMPARATOR_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093024L) +#define OSS_COMPARATOR_CODE_NOT_LINKED _HRESULT_TYPEDEF_(0x80093025L) +#define OSS_MEM_MGR_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093026L) +#define OSS_PDV_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093027L) +#define OSS_PDV_CODE_NOT_LINKED _HRESULT_TYPEDEF_(0x80093028L) +#define OSS_API_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093029L) +#define OSS_BERDER_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009302AL) +#define OSS_PER_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009302BL) +#define OSS_OPEN_TYPE_ERROR _HRESULT_TYPEDEF_(0x8009302CL) +#define OSS_MUTEX_NOT_CREATED _HRESULT_TYPEDEF_(0x8009302DL) +#define OSS_CANT_CLOSE_TRACE_FILE _HRESULT_TYPEDEF_(0x8009302EL) +#define CRYPT_E_ASN1_ERROR _HRESULT_TYPEDEF_(0x80093100L) +#define CRYPT_E_ASN1_INTERNAL _HRESULT_TYPEDEF_(0x80093101L) +#define CRYPT_E_ASN1_EOD _HRESULT_TYPEDEF_(0x80093102L) +#define CRYPT_E_ASN1_CORRUPT _HRESULT_TYPEDEF_(0x80093103L) +#define CRYPT_E_ASN1_LARGE _HRESULT_TYPEDEF_(0x80093104L) +#define CRYPT_E_ASN1_CONSTRAINT _HRESULT_TYPEDEF_(0x80093105L) +#define CRYPT_E_ASN1_MEMORY _HRESULT_TYPEDEF_(0x80093106L) +#define CRYPT_E_ASN1_OVERFLOW _HRESULT_TYPEDEF_(0x80093107L) +#define CRYPT_E_ASN1_BADPDU _HRESULT_TYPEDEF_(0x80093108L) +#define CRYPT_E_ASN1_BADARGS _HRESULT_TYPEDEF_(0x80093109L) +#define CRYPT_E_ASN1_BADREAL _HRESULT_TYPEDEF_(0x8009310AL) +#define CRYPT_E_ASN1_BADTAG _HRESULT_TYPEDEF_(0x8009310BL) +#define CRYPT_E_ASN1_CHOICE _HRESULT_TYPEDEF_(0x8009310CL) +#define CRYPT_E_ASN1_RULE _HRESULT_TYPEDEF_(0x8009310DL) +#define CRYPT_E_ASN1_UTF8 _HRESULT_TYPEDEF_(0x8009310EL) +#define CRYPT_E_ASN1_PDU_TYPE _HRESULT_TYPEDEF_(0x80093133L) +#define CRYPT_E_ASN1_NYI _HRESULT_TYPEDEF_(0x80093134L) +#define CRYPT_E_ASN1_EXTENDED _HRESULT_TYPEDEF_(0x80093201L) +#define CRYPT_E_ASN1_NOEOD _HRESULT_TYPEDEF_(0x80093202L) +#define CERTSRV_E_BAD_REQUESTSUBJECT _HRESULT_TYPEDEF_(0x80094001L) +#define CERTSRV_E_NO_REQUEST _HRESULT_TYPEDEF_(0x80094002L) +#define CERTSRV_E_BAD_REQUESTSTATUS _HRESULT_TYPEDEF_(0x80094003L) +#define CERTSRV_E_PROPERTY_EMPTY _HRESULT_TYPEDEF_(0x80094004L) +#define CERTSRV_E_INVALID_CA_CERTIFICATE _HRESULT_TYPEDEF_(0x80094005L) +#define CERTSRV_E_SERVER_SUSPENDED _HRESULT_TYPEDEF_(0x80094006L) +#define CERTSRV_E_ENCODING_LENGTH _HRESULT_TYPEDEF_(0x80094007L) +#define CERTSRV_E_ROLECONFLICT _HRESULT_TYPEDEF_(0x80094008L) +#define CERTSRV_E_RESTRICTEDOFFICER _HRESULT_TYPEDEF_(0x80094009L) +#define CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED _HRESULT_TYPEDEF_(0x8009400AL) +#define CERTSRV_E_NO_VALID_KRA _HRESULT_TYPEDEF_(0x8009400BL) +#define CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL _HRESULT_TYPEDEF_(0x8009400CL) +#define CERTSRV_E_NO_CAADMIN_DEFINED _HRESULT_TYPEDEF_(0x8009400DL) +#define CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE _HRESULT_TYPEDEF_(0x8009400EL) +#define CERTSRV_E_NO_DB_SESSIONS _HRESULT_TYPEDEF_(0x8009400FL) +#define CERTSRV_E_ALIGNMENT_FAULT _HRESULT_TYPEDEF_(0x80094010L) +#define CERTSRV_E_ENROLL_DENIED _HRESULT_TYPEDEF_(0x80094011L) +#define CERTSRV_E_TEMPLATE_DENIED _HRESULT_TYPEDEF_(0x80094012L) +#define CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE _HRESULT_TYPEDEF_(0x80094013L) +#define CERTSRV_E_UNSUPPORTED_CERT_TYPE _HRESULT_TYPEDEF_(0x80094800L) +#define CERTSRV_E_NO_CERT_TYPE _HRESULT_TYPEDEF_(0x80094801L) +#define CERTSRV_E_TEMPLATE_CONFLICT _HRESULT_TYPEDEF_(0x80094802L) +#define CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED _HRESULT_TYPEDEF_(0x80094803L) +#define CERTSRV_E_ARCHIVED_KEY_REQUIRED _HRESULT_TYPEDEF_(0x80094804L) +#define CERTSRV_E_SMIME_REQUIRED _HRESULT_TYPEDEF_(0x80094805L) +#define CERTSRV_E_BAD_RENEWAL_SUBJECT _HRESULT_TYPEDEF_(0x80094806L) +#define CERTSRV_E_BAD_TEMPLATE_VERSION _HRESULT_TYPEDEF_(0x80094807L) +#define CERTSRV_E_TEMPLATE_POLICY_REQUIRED _HRESULT_TYPEDEF_(0x80094808L) +#define CERTSRV_E_SIGNATURE_POLICY_REQUIRED _HRESULT_TYPEDEF_(0x80094809L) +#define CERTSRV_E_SIGNATURE_COUNT _HRESULT_TYPEDEF_(0x8009480AL) +#define CERTSRV_E_SIGNATURE_REJECTED _HRESULT_TYPEDEF_(0x8009480BL) +#define CERTSRV_E_ISSUANCE_POLICY_REQUIRED _HRESULT_TYPEDEF_(0x8009480CL) +#define CERTSRV_E_SUBJECT_UPN_REQUIRED _HRESULT_TYPEDEF_(0x8009480DL) +#define CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED _HRESULT_TYPEDEF_(0x8009480EL) +#define CERTSRV_E_SUBJECT_DNS_REQUIRED _HRESULT_TYPEDEF_(0x8009480FL) +#define CERTSRV_E_ARCHIVED_KEY_UNEXPECTED _HRESULT_TYPEDEF_(0x80094810L) +#define CERTSRV_E_KEY_LENGTH _HRESULT_TYPEDEF_(0x80094811L) +#define CERTSRV_E_SUBJECT_EMAIL_REQUIRED _HRESULT_TYPEDEF_(0x80094812L) +#define CERTSRV_E_UNKNOWN_CERT_TYPE _HRESULT_TYPEDEF_(0x80094813L) +#define CERTSRV_E_CERT_TYPE_OVERLAP _HRESULT_TYPEDEF_(0x80094814L) +#define XENROLL_E_KEY_NOT_EXPORTABLE _HRESULT_TYPEDEF_(0x80095000L) +#define XENROLL_E_CANNOT_ADD_ROOT_CERT _HRESULT_TYPEDEF_(0x80095001L) +#define XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND _HRESULT_TYPEDEF_(0x80095002L) +#define XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH _HRESULT_TYPEDEF_(0x80095003L) +#define XENROLL_E_RESPONSE_KA_HASH_MISMATCH _HRESULT_TYPEDEF_(0x80095004L) +#define XENROLL_E_KEYSPEC_SMIME_MISMATCH _HRESULT_TYPEDEF_(0x80095005L) +#define TRUST_E_SYSTEM_ERROR _HRESULT_TYPEDEF_(0x80096001L) +#define TRUST_E_NO_SIGNER_CERT _HRESULT_TYPEDEF_(0x80096002L) +#define TRUST_E_COUNTER_SIGNER _HRESULT_TYPEDEF_(0x80096003L) +#define TRUST_E_CERT_SIGNATURE _HRESULT_TYPEDEF_(0x80096004L) +#define TRUST_E_TIME_STAMP _HRESULT_TYPEDEF_(0x80096005L) +#define TRUST_E_BAD_DIGEST _HRESULT_TYPEDEF_(0x80096010L) +#define TRUST_E_BASIC_CONSTRAINTS _HRESULT_TYPEDEF_(0x80096019L) +#define TRUST_E_FINANCIAL_CRITERIA _HRESULT_TYPEDEF_(0x8009601EL) +#define MSSIPOTF_E_OUTOFMEMRANGE _HRESULT_TYPEDEF_(0x80097001L) +#define MSSIPOTF_E_CANTGETOBJECT _HRESULT_TYPEDEF_(0x80097002L) +#define MSSIPOTF_E_NOHEADTABLE _HRESULT_TYPEDEF_(0x80097003L) +#define MSSIPOTF_E_BAD_MAGICNUMBER _HRESULT_TYPEDEF_(0x80097004L) +#define MSSIPOTF_E_BAD_OFFSET_TABLE _HRESULT_TYPEDEF_(0x80097005L) +#define MSSIPOTF_E_TABLE_TAGORDER _HRESULT_TYPEDEF_(0x80097006L) +#define MSSIPOTF_E_TABLE_LONGWORD _HRESULT_TYPEDEF_(0x80097007L) +#define MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT _HRESULT_TYPEDEF_(0x80097008L) +#define MSSIPOTF_E_TABLES_OVERLAP _HRESULT_TYPEDEF_(0x80097009L) +#define MSSIPOTF_E_TABLE_PADBYTES _HRESULT_TYPEDEF_(0x8009700AL) +#define MSSIPOTF_E_FILETOOSMALL _HRESULT_TYPEDEF_(0x8009700BL) +#define MSSIPOTF_E_TABLE_CHECKSUM _HRESULT_TYPEDEF_(0x8009700CL) +#define MSSIPOTF_E_FILE_CHECKSUM _HRESULT_TYPEDEF_(0x8009700DL) +#define MSSIPOTF_E_FAILED_POLICY _HRESULT_TYPEDEF_(0x80097010L) +#define MSSIPOTF_E_FAILED_HINTS_CHECK _HRESULT_TYPEDEF_(0x80097011L) +#define MSSIPOTF_E_NOT_OPENTYPE _HRESULT_TYPEDEF_(0x80097012L) +#define MSSIPOTF_E_FILE _HRESULT_TYPEDEF_(0x80097013L) +#define MSSIPOTF_E_CRYPT _HRESULT_TYPEDEF_(0x80097014L) +#define MSSIPOTF_E_BADVERSION _HRESULT_TYPEDEF_(0x80097015L) +#define MSSIPOTF_E_DSIG_STRUCTURE _HRESULT_TYPEDEF_(0x80097016L) +#define MSSIPOTF_E_PCONST_CHECK _HRESULT_TYPEDEF_(0x80097017L) +#define MSSIPOTF_E_STRUCTURE _HRESULT_TYPEDEF_(0x80097018L) +#define NTE_OP_OK 0 +#define TRUST_E_PROVIDER_UNKNOWN _HRESULT_TYPEDEF_(0x800B0001L) +#define TRUST_E_ACTION_UNKNOWN _HRESULT_TYPEDEF_(0x800B0002L) +#define TRUST_E_SUBJECT_FORM_UNKNOWN _HRESULT_TYPEDEF_(0x800B0003L) +#define TRUST_E_SUBJECT_NOT_TRUSTED _HRESULT_TYPEDEF_(0x800B0004L) +#define DIGSIG_E_ENCODE _HRESULT_TYPEDEF_(0x800B0005L) +#define DIGSIG_E_DECODE _HRESULT_TYPEDEF_(0x800B0006L) +#define DIGSIG_E_EXTENSIBILITY _HRESULT_TYPEDEF_(0x800B0007L) +#define DIGSIG_E_CRYPTO _HRESULT_TYPEDEF_(0x800B0008L) +#define PERSIST_E_SIZEDEFINITE _HRESULT_TYPEDEF_(0x800B0009L) +#define PERSIST_E_SIZEINDEFINITE _HRESULT_TYPEDEF_(0x800B000AL) +#define PERSIST_E_NOTSELFSIZING _HRESULT_TYPEDEF_(0x800B000BL) +#define TRUST_E_NOSIGNATURE _HRESULT_TYPEDEF_(0x800B0100L) +#define CERT_E_EXPIRED _HRESULT_TYPEDEF_(0x800B0101L) +#define CERT_E_VALIDITYPERIODNESTING _HRESULT_TYPEDEF_(0x800B0102L) +#define CERT_E_ROLE _HRESULT_TYPEDEF_(0x800B0103L) +#define CERT_E_PATHLENCONST _HRESULT_TYPEDEF_(0x800B0104L) +#define CERT_E_CRITICAL _HRESULT_TYPEDEF_(0x800B0105L) +#define CERT_E_PURPOSE _HRESULT_TYPEDEF_(0x800B0106L) +#define CERT_E_ISSUERCHAINING _HRESULT_TYPEDEF_(0x800B0107L) +#define CERT_E_MALFORMED _HRESULT_TYPEDEF_(0x800B0108L) +#define CERT_E_UNTRUSTEDROOT _HRESULT_TYPEDEF_(0x800B0109L) +#define CERT_E_CHAINING _HRESULT_TYPEDEF_(0x800B010AL) +#define TRUST_E_FAIL _HRESULT_TYPEDEF_(0x800B010BL) +#define CERT_E_REVOKED _HRESULT_TYPEDEF_(0x800B010CL) +#define CERT_E_UNTRUSTEDTESTROOT _HRESULT_TYPEDEF_(0x800B010DL) +#define CERT_E_REVOCATION_FAILURE _HRESULT_TYPEDEF_(0x800B010EL) +#define CERT_E_CN_NO_MATCH _HRESULT_TYPEDEF_(0x800B010FL) +#define CERT_E_WRONG_USAGE _HRESULT_TYPEDEF_(0x800B0110L) +#define TRUST_E_EXPLICIT_DISTRUST _HRESULT_TYPEDEF_(0x800B0111L) +#define CERT_E_UNTRUSTEDCA _HRESULT_TYPEDEF_(0x800B0112L) +#define CERT_E_INVALID_POLICY _HRESULT_TYPEDEF_(0x800B0113L) +#define CERT_E_INVALID_NAME _HRESULT_TYPEDEF_(0x800B0114L) +#define HRESULT_FROM_SETUPAPI(x) ((((x) & (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR))==(APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR)) ? ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_SETUPAPI << 16) | 0x80000000)) : HRESULT_FROM_WIN32(x)) +#define SPAPI_E_EXPECTED_SECTION_NAME _HRESULT_TYPEDEF_(0x800F0000L) +#define SPAPI_E_BAD_SECTION_NAME_LINE _HRESULT_TYPEDEF_(0x800F0001L) +#define SPAPI_E_SECTION_NAME_TOO_LONG _HRESULT_TYPEDEF_(0x800F0002L) +#define SPAPI_E_GENERAL_SYNTAX _HRESULT_TYPEDEF_(0x800F0003L) +#define SPAPI_E_WRONG_INF_STYLE _HRESULT_TYPEDEF_(0x800F0100L) +#define SPAPI_E_SECTION_NOT_FOUND _HRESULT_TYPEDEF_(0x800F0101L) +#define SPAPI_E_LINE_NOT_FOUND _HRESULT_TYPEDEF_(0x800F0102L) +#define SPAPI_E_NO_BACKUP _HRESULT_TYPEDEF_(0x800F0103L) +#define SPAPI_E_NO_ASSOCIATED_CLASS _HRESULT_TYPEDEF_(0x800F0200L) +#define SPAPI_E_CLASS_MISMATCH _HRESULT_TYPEDEF_(0x800F0201L) +#define SPAPI_E_DUPLICATE_FOUND _HRESULT_TYPEDEF_(0x800F0202L) +#define SPAPI_E_NO_DRIVER_SELECTED _HRESULT_TYPEDEF_(0x800F0203L) +#define SPAPI_E_KEY_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x800F0204L) +#define SPAPI_E_INVALID_DEVINST_NAME _HRESULT_TYPEDEF_(0x800F0205L) +#define SPAPI_E_INVALID_CLASS _HRESULT_TYPEDEF_(0x800F0206L) +#define SPAPI_E_DEVINST_ALREADY_EXISTS _HRESULT_TYPEDEF_(0x800F0207L) +#define SPAPI_E_DEVINFO_NOT_REGISTERED _HRESULT_TYPEDEF_(0x800F0208L) +#define SPAPI_E_INVALID_REG_PROPERTY _HRESULT_TYPEDEF_(0x800F0209L) +#define SPAPI_E_NO_INF _HRESULT_TYPEDEF_(0x800F020AL) +#define SPAPI_E_NO_SUCH_DEVINST _HRESULT_TYPEDEF_(0x800F020BL) +#define SPAPI_E_CANT_LOAD_CLASS_ICON _HRESULT_TYPEDEF_(0x800F020CL) +#define SPAPI_E_INVALID_CLASS_INSTALLER _HRESULT_TYPEDEF_(0x800F020DL) +#define SPAPI_E_DI_DO_DEFAULT _HRESULT_TYPEDEF_(0x800F020EL) +#define SPAPI_E_DI_NOFILECOPY _HRESULT_TYPEDEF_(0x800F020FL) +#define SPAPI_E_INVALID_HWPROFILE _HRESULT_TYPEDEF_(0x800F0210L) +#define SPAPI_E_NO_DEVICE_SELECTED _HRESULT_TYPEDEF_(0x800F0211L) +#define SPAPI_E_DEVINFO_LIST_LOCKED _HRESULT_TYPEDEF_(0x800F0212L) +#define SPAPI_E_DEVINFO_DATA_LOCKED _HRESULT_TYPEDEF_(0x800F0213L) +#define SPAPI_E_DI_BAD_PATH _HRESULT_TYPEDEF_(0x800F0214L) +#define SPAPI_E_NO_CLASSINSTALL_PARAMS _HRESULT_TYPEDEF_(0x800F0215L) +#define SPAPI_E_FILEQUEUE_LOCKED _HRESULT_TYPEDEF_(0x800F0216L) +#define SPAPI_E_BAD_SERVICE_INSTALLSECT _HRESULT_TYPEDEF_(0x800F0217L) +#define SPAPI_E_NO_CLASS_DRIVER_LIST _HRESULT_TYPEDEF_(0x800F0218L) +#define SPAPI_E_NO_ASSOCIATED_SERVICE _HRESULT_TYPEDEF_(0x800F0219L) +#define SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE _HRESULT_TYPEDEF_(0x800F021AL) +#define SPAPI_E_DEVICE_INTERFACE_ACTIVE _HRESULT_TYPEDEF_(0x800F021BL) +#define SPAPI_E_DEVICE_INTERFACE_REMOVED _HRESULT_TYPEDEF_(0x800F021CL) +#define SPAPI_E_BAD_INTERFACE_INSTALLSECT _HRESULT_TYPEDEF_(0x800F021DL) +#define SPAPI_E_NO_SUCH_INTERFACE_CLASS _HRESULT_TYPEDEF_(0x800F021EL) +#define SPAPI_E_INVALID_REFERENCE_STRING _HRESULT_TYPEDEF_(0x800F021FL) +#define SPAPI_E_INVALID_MACHINENAME _HRESULT_TYPEDEF_(0x800F0220L) +#define SPAPI_E_REMOTE_COMM_FAILURE _HRESULT_TYPEDEF_(0x800F0221L) +#define SPAPI_E_MACHINE_UNAVAILABLE _HRESULT_TYPEDEF_(0x800F0222L) +#define SPAPI_E_NO_CONFIGMGR_SERVICES _HRESULT_TYPEDEF_(0x800F0223L) +#define SPAPI_E_INVALID_PROPPAGE_PROVIDER _HRESULT_TYPEDEF_(0x800F0224L) +#define SPAPI_E_NO_SUCH_DEVICE_INTERFACE _HRESULT_TYPEDEF_(0x800F0225L) +#define SPAPI_E_DI_POSTPROCESSING_REQUIRED _HRESULT_TYPEDEF_(0x800F0226L) +#define SPAPI_E_INVALID_COINSTALLER _HRESULT_TYPEDEF_(0x800F0227L) +#define SPAPI_E_NO_COMPAT_DRIVERS _HRESULT_TYPEDEF_(0x800F0228L) +#define SPAPI_E_NO_DEVICE_ICON _HRESULT_TYPEDEF_(0x800F0229L) +#define SPAPI_E_INVALID_INF_LOGCONFIG _HRESULT_TYPEDEF_(0x800F022AL) +#define SPAPI_E_DI_DONT_INSTALL _HRESULT_TYPEDEF_(0x800F022BL) +#define SPAPI_E_INVALID_FILTER_DRIVER _HRESULT_TYPEDEF_(0x800F022CL) +#define SPAPI_E_NON_WINDOWS_NT_DRIVER _HRESULT_TYPEDEF_(0x800F022DL) +#define SPAPI_E_NON_WINDOWS_DRIVER _HRESULT_TYPEDEF_(0x800F022EL) +#define SPAPI_E_NO_CATALOG_FOR_OEM_INF _HRESULT_TYPEDEF_(0x800F022FL) +#define SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE _HRESULT_TYPEDEF_(0x800F0230L) +#define SPAPI_E_NOT_DISABLEABLE _HRESULT_TYPEDEF_(0x800F0231L) +#define SPAPI_E_CANT_REMOVE_DEVINST _HRESULT_TYPEDEF_(0x800F0232L) +#define SPAPI_E_INVALID_TARGET _HRESULT_TYPEDEF_(0x800F0233L) +#define SPAPI_E_DRIVER_NONNATIVE _HRESULT_TYPEDEF_(0x800F0234L) +#define SPAPI_E_IN_WOW64 _HRESULT_TYPEDEF_(0x800F0235L) +#define SPAPI_E_SET_SYSTEM_RESTORE_POINT _HRESULT_TYPEDEF_(0x800F0236L) +#define SPAPI_E_INCORRECTLY_COPIED_INF _HRESULT_TYPEDEF_(0x800F0237L) +#define SPAPI_E_SCE_DISABLED _HRESULT_TYPEDEF_(0x800F0238L) +#define SPAPI_E_UNKNOWN_EXCEPTION _HRESULT_TYPEDEF_(0x800F0239L) +#define SPAPI_E_PNP_REGISTRY_ERROR _HRESULT_TYPEDEF_(0x800F023AL) +#define SPAPI_E_REMOTE_REQUEST_UNSUPPORTED _HRESULT_TYPEDEF_(0x800F023BL) +#define SPAPI_E_NOT_AN_INSTALLED_OEM_INF _HRESULT_TYPEDEF_(0x800F023CL) +#define SPAPI_E_INF_IN_USE_BY_DEVICES _HRESULT_TYPEDEF_(0x800F023DL) +#define SPAPI_E_DI_FUNCTION_OBSOLETE _HRESULT_TYPEDEF_(0x800F023EL) +#define SPAPI_E_NO_AUTHENTICODE_CATALOG _HRESULT_TYPEDEF_(0x800F023FL) +#define SPAPI_E_AUTHENTICODE_DISALLOWED _HRESULT_TYPEDEF_(0x800F0240L) +#define SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER _HRESULT_TYPEDEF_(0x800F0241L) +#define SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED _HRESULT_TYPEDEF_(0x800F0242L) +#define SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED _HRESULT_TYPEDEF_(0x800F0243L) +#define SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH _HRESULT_TYPEDEF_(0x800F0244L) +#define SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE _HRESULT_TYPEDEF_(0x800F0245L) +#define SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW _HRESULT_TYPEDEF_(0x800F0300L) +#define SPAPI_E_ERROR_NOT_INSTALLED _HRESULT_TYPEDEF_(0x800F1000L) +#define SCARD_S_SUCCESS NO_ERROR +#define SCARD_F_INTERNAL_ERROR _HRESULT_TYPEDEF_(0x80100001L) +#define SCARD_E_CANCELLED _HRESULT_TYPEDEF_(0x80100002L) +#define SCARD_E_INVALID_HANDLE _HRESULT_TYPEDEF_(0x80100003L) +#define SCARD_E_INVALID_PARAMETER _HRESULT_TYPEDEF_(0x80100004L) +#define SCARD_E_INVALID_TARGET _HRESULT_TYPEDEF_(0x80100005L) +#define SCARD_E_NO_MEMORY _HRESULT_TYPEDEF_(0x80100006L) +#define SCARD_F_WAITED_TOO_LONG _HRESULT_TYPEDEF_(0x80100007L) +#define SCARD_E_INSUFFICIENT_BUFFER _HRESULT_TYPEDEF_(0x80100008L) +#define SCARD_E_UNKNOWN_READER _HRESULT_TYPEDEF_(0x80100009L) +#define SCARD_E_TIMEOUT _HRESULT_TYPEDEF_(0x8010000AL) +#define SCARD_E_SHARING_VIOLATION _HRESULT_TYPEDEF_(0x8010000BL) +#define SCARD_E_NO_SMARTCARD _HRESULT_TYPEDEF_(0x8010000CL) +#define SCARD_E_UNKNOWN_CARD _HRESULT_TYPEDEF_(0x8010000DL) +#define SCARD_E_CANT_DISPOSE _HRESULT_TYPEDEF_(0x8010000EL) +#define SCARD_E_PROTO_MISMATCH _HRESULT_TYPEDEF_(0x8010000FL) +#define SCARD_E_NOT_READY _HRESULT_TYPEDEF_(0x80100010L) +#define SCARD_E_INVALID_VALUE _HRESULT_TYPEDEF_(0x80100011L) +#define SCARD_E_SYSTEM_CANCELLED _HRESULT_TYPEDEF_(0x80100012L) +#define SCARD_F_COMM_ERROR _HRESULT_TYPEDEF_(0x80100013L) +#define SCARD_F_UNKNOWN_ERROR _HRESULT_TYPEDEF_(0x80100014L) +#define SCARD_E_INVALID_ATR _HRESULT_TYPEDEF_(0x80100015L) +#define SCARD_E_NOT_TRANSACTED _HRESULT_TYPEDEF_(0x80100016L) +#define SCARD_E_READER_UNAVAILABLE _HRESULT_TYPEDEF_(0x80100017L) +#define SCARD_P_SHUTDOWN _HRESULT_TYPEDEF_(0x80100018L) +#define SCARD_E_PCI_TOO_SMALL _HRESULT_TYPEDEF_(0x80100019L) +#define SCARD_E_READER_UNSUPPORTED _HRESULT_TYPEDEF_(0x8010001AL) +#define SCARD_E_DUPLICATE_READER _HRESULT_TYPEDEF_(0x8010001BL) +#define SCARD_E_CARD_UNSUPPORTED _HRESULT_TYPEDEF_(0x8010001CL) +#define SCARD_E_NO_SERVICE _HRESULT_TYPEDEF_(0x8010001DL) +#define SCARD_E_SERVICE_STOPPED _HRESULT_TYPEDEF_(0x8010001EL) +#define SCARD_E_UNEXPECTED _HRESULT_TYPEDEF_(0x8010001FL) +#define SCARD_E_ICC_INSTALLATION _HRESULT_TYPEDEF_(0x80100020L) +#define SCARD_E_ICC_CREATEORDER _HRESULT_TYPEDEF_(0x80100021L) +#define SCARD_E_UNSUPPORTED_FEATURE _HRESULT_TYPEDEF_(0x80100022L) +#define SCARD_E_DIR_NOT_FOUND _HRESULT_TYPEDEF_(0x80100023L) +#define SCARD_E_FILE_NOT_FOUND _HRESULT_TYPEDEF_(0x80100024L) +#define SCARD_E_NO_DIR _HRESULT_TYPEDEF_(0x80100025L) +#define SCARD_E_NO_FILE _HRESULT_TYPEDEF_(0x80100026L) +#define SCARD_E_NO_ACCESS _HRESULT_TYPEDEF_(0x80100027L) +#define SCARD_E_WRITE_TOO_MANY _HRESULT_TYPEDEF_(0x80100028L) +#define SCARD_E_BAD_SEEK _HRESULT_TYPEDEF_(0x80100029L) +#define SCARD_E_INVALID_CHV _HRESULT_TYPEDEF_(0x8010002AL) +#define SCARD_E_UNKNOWN_RES_MNG _HRESULT_TYPEDEF_(0x8010002BL) +#define SCARD_E_NO_SUCH_CERTIFICATE _HRESULT_TYPEDEF_(0x8010002CL) +#define SCARD_E_CERTIFICATE_UNAVAILABLE _HRESULT_TYPEDEF_(0x8010002DL) +#define SCARD_E_NO_READERS_AVAILABLE _HRESULT_TYPEDEF_(0x8010002EL) +#define SCARD_E_COMM_DATA_LOST _HRESULT_TYPEDEF_(0x8010002FL) +#define SCARD_E_NO_KEY_CONTAINER _HRESULT_TYPEDEF_(0x80100030L) +#define SCARD_E_SERVER_TOO_BUSY _HRESULT_TYPEDEF_(0x80100031L) +#define SCARD_W_UNSUPPORTED_CARD _HRESULT_TYPEDEF_(0x80100065L) +#define SCARD_W_UNRESPONSIVE_CARD _HRESULT_TYPEDEF_(0x80100066L) +#define SCARD_W_UNPOWERED_CARD _HRESULT_TYPEDEF_(0x80100067L) +#define SCARD_W_RESET_CARD _HRESULT_TYPEDEF_(0x80100068L) +#define SCARD_W_REMOVED_CARD _HRESULT_TYPEDEF_(0x80100069L) +#define SCARD_W_SECURITY_VIOLATION _HRESULT_TYPEDEF_(0x8010006AL) +#define SCARD_W_WRONG_CHV _HRESULT_TYPEDEF_(0x8010006BL) +#define SCARD_W_CHV_BLOCKED _HRESULT_TYPEDEF_(0x8010006CL) +#define SCARD_W_EOF _HRESULT_TYPEDEF_(0x8010006DL) +#define SCARD_W_CANCELLED_BY_USER _HRESULT_TYPEDEF_(0x8010006EL) +#define SCARD_W_CARD_NOT_AUTHENTICATED _HRESULT_TYPEDEF_(0x8010006FL) +#define COMADMIN_E_OBJECTERRORS _HRESULT_TYPEDEF_(0x80110401L) +#define COMADMIN_E_OBJECTINVALID _HRESULT_TYPEDEF_(0x80110402L) +#define COMADMIN_E_KEYMISSING _HRESULT_TYPEDEF_(0x80110403L) +#define COMADMIN_E_ALREADYINSTALLED _HRESULT_TYPEDEF_(0x80110404L) +#define COMADMIN_E_APP_FILE_WRITEFAIL _HRESULT_TYPEDEF_(0x80110407L) +#define COMADMIN_E_APP_FILE_READFAIL _HRESULT_TYPEDEF_(0x80110408L) +#define COMADMIN_E_APP_FILE_VERSION _HRESULT_TYPEDEF_(0x80110409L) +#define COMADMIN_E_BADPATH _HRESULT_TYPEDEF_(0x8011040AL) +#define COMADMIN_E_APPLICATIONEXISTS _HRESULT_TYPEDEF_(0x8011040BL) +#define COMADMIN_E_ROLEEXISTS _HRESULT_TYPEDEF_(0x8011040CL) +#define COMADMIN_E_CANTCOPYFILE _HRESULT_TYPEDEF_(0x8011040DL) +#define COMADMIN_E_NOUSER _HRESULT_TYPEDEF_(0x8011040FL) +#define COMADMIN_E_INVALIDUSERIDS _HRESULT_TYPEDEF_(0x80110410L) +#define COMADMIN_E_NOREGISTRYCLSID _HRESULT_TYPEDEF_(0x80110411L) +#define COMADMIN_E_BADREGISTRYPROGID _HRESULT_TYPEDEF_(0x80110412L) +#define COMADMIN_E_AUTHENTICATIONLEVEL _HRESULT_TYPEDEF_(0x80110413L) +#define COMADMIN_E_USERPASSWDNOTVALID _HRESULT_TYPEDEF_(0x80110414L) +#define COMADMIN_E_CLSIDORIIDMISMATCH _HRESULT_TYPEDEF_(0x80110418L) +#define COMADMIN_E_REMOTEINTERFACE _HRESULT_TYPEDEF_(0x80110419L) +#define COMADMIN_E_DLLREGISTERSERVER _HRESULT_TYPEDEF_(0x8011041AL) +#define COMADMIN_E_NOSERVERSHARE _HRESULT_TYPEDEF_(0x8011041BL) +#define COMADMIN_E_DLLLOADFAILED _HRESULT_TYPEDEF_(0x8011041DL) +#define COMADMIN_E_BADREGISTRYLIBID _HRESULT_TYPEDEF_(0x8011041EL) +#define COMADMIN_E_APPDIRNOTFOUND _HRESULT_TYPEDEF_(0x8011041FL) +#define COMADMIN_E_REGISTRARFAILED _HRESULT_TYPEDEF_(0x80110423L) +#define COMADMIN_E_COMPFILE_DOESNOTEXIST _HRESULT_TYPEDEF_(0x80110424L) +#define COMADMIN_E_COMPFILE_LOADDLLFAIL _HRESULT_TYPEDEF_(0x80110425L) +#define COMADMIN_E_COMPFILE_GETCLASSOBJ _HRESULT_TYPEDEF_(0x80110426L) +#define COMADMIN_E_COMPFILE_CLASSNOTAVAIL _HRESULT_TYPEDEF_(0x80110427L) +#define COMADMIN_E_COMPFILE_BADTLB _HRESULT_TYPEDEF_(0x80110428L) +#define COMADMIN_E_COMPFILE_NOTINSTALLABLE _HRESULT_TYPEDEF_(0x80110429L) +#define COMADMIN_E_NOTCHANGEABLE _HRESULT_TYPEDEF_(0x8011042AL) +#define COMADMIN_E_NOTDELETEABLE _HRESULT_TYPEDEF_(0x8011042BL) +#define COMADMIN_E_SESSION _HRESULT_TYPEDEF_(0x8011042CL) +#define COMADMIN_E_COMP_MOVE_LOCKED _HRESULT_TYPEDEF_(0x8011042DL) +#define COMADMIN_E_COMP_MOVE_BAD_DEST _HRESULT_TYPEDEF_(0x8011042EL) +#define COMADMIN_E_REGISTERTLB _HRESULT_TYPEDEF_(0x80110430L) +#define COMADMIN_E_SYSTEMAPP _HRESULT_TYPEDEF_(0x80110433L) +#define COMADMIN_E_COMPFILE_NOREGISTRAR _HRESULT_TYPEDEF_(0x80110434L) +#define COMADMIN_E_COREQCOMPINSTALLED _HRESULT_TYPEDEF_(0x80110435L) +#define COMADMIN_E_SERVICENOTINSTALLED _HRESULT_TYPEDEF_(0x80110436L) +#define COMADMIN_E_PROPERTYSAVEFAILED _HRESULT_TYPEDEF_(0x80110437L) +#define COMADMIN_E_OBJECTEXISTS _HRESULT_TYPEDEF_(0x80110438L) +#define COMADMIN_E_COMPONENTEXISTS _HRESULT_TYPEDEF_(0x80110439L) +#define COMADMIN_E_REGFILE_CORRUPT _HRESULT_TYPEDEF_(0x8011043BL) +#define COMADMIN_E_PROPERTY_OVERFLOW _HRESULT_TYPEDEF_(0x8011043CL) +#define COMADMIN_E_NOTINREGISTRY _HRESULT_TYPEDEF_(0x8011043EL) +#define COMADMIN_E_OBJECTNOTPOOLABLE _HRESULT_TYPEDEF_(0x8011043FL) +#define COMADMIN_E_APPLID_MATCHES_CLSID _HRESULT_TYPEDEF_(0x80110446L) +#define COMADMIN_E_ROLE_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x80110447L) +#define COMADMIN_E_START_APP_NEEDS_COMPONENTS _HRESULT_TYPEDEF_(0x80110448L) +#define COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM _HRESULT_TYPEDEF_(0x80110449L) +#define COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY _HRESULT_TYPEDEF_(0x8011044AL) +#define COMADMIN_E_CAN_NOT_START_APP _HRESULT_TYPEDEF_(0x8011044BL) +#define COMADMIN_E_CAN_NOT_EXPORT_SYS_APP _HRESULT_TYPEDEF_(0x8011044CL) +#define COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT _HRESULT_TYPEDEF_(0x8011044DL) +#define COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER _HRESULT_TYPEDEF_(0x8011044EL) +#define COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE _HRESULT_TYPEDEF_(0x8011044FL) +#define COMADMIN_E_BASE_PARTITION_ONLY _HRESULT_TYPEDEF_(0x80110450L) +#define COMADMIN_E_START_APP_DISABLED _HRESULT_TYPEDEF_(0x80110451L) +#define COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME _HRESULT_TYPEDEF_(0x80110457L) +#define COMADMIN_E_CAT_INVALID_PARTITION_NAME _HRESULT_TYPEDEF_(0x80110458L) +#define COMADMIN_E_CAT_PARTITION_IN_USE _HRESULT_TYPEDEF_(0x80110459L) +#define COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES _HRESULT_TYPEDEF_(0x8011045AL) +#define COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED _HRESULT_TYPEDEF_(0x8011045BL) +#define COMADMIN_E_AMBIGUOUS_APPLICATION_NAME _HRESULT_TYPEDEF_(0x8011045CL) +#define COMADMIN_E_AMBIGUOUS_PARTITION_NAME _HRESULT_TYPEDEF_(0x8011045DL) +#define COMADMIN_E_REGDB_NOTINITIALIZED _HRESULT_TYPEDEF_(0x80110472L) +#define COMADMIN_E_REGDB_NOTOPEN _HRESULT_TYPEDEF_(0x80110473L) +#define COMADMIN_E_REGDB_SYSTEMERR _HRESULT_TYPEDEF_(0x80110474L) +#define COMADMIN_E_REGDB_ALREADYRUNNING _HRESULT_TYPEDEF_(0x80110475L) +#define COMADMIN_E_MIG_VERSIONNOTSUPPORTED _HRESULT_TYPEDEF_(0x80110480L) +#define COMADMIN_E_MIG_SCHEMANOTFOUND _HRESULT_TYPEDEF_(0x80110481L) +#define COMADMIN_E_CAT_BITNESSMISMATCH _HRESULT_TYPEDEF_(0x80110482L) +#define COMADMIN_E_CAT_UNACCEPTABLEBITNESS _HRESULT_TYPEDEF_(0x80110483L) +#define COMADMIN_E_CAT_WRONGAPPBITNESS _HRESULT_TYPEDEF_(0x80110484L) +#define COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x80110485L) +#define COMADMIN_E_CAT_SERVERFAULT _HRESULT_TYPEDEF_(0x80110486L) +#define COMQC_E_APPLICATION_NOT_QUEUED _HRESULT_TYPEDEF_(0x80110600L) +#define COMQC_E_NO_QUEUEABLE_INTERFACES _HRESULT_TYPEDEF_(0x80110601L) +#define COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE _HRESULT_TYPEDEF_(0x80110602L) +#define COMQC_E_NO_IPERSISTSTREAM _HRESULT_TYPEDEF_(0x80110603L) +#define COMQC_E_BAD_MESSAGE _HRESULT_TYPEDEF_(0x80110604L) +#define COMQC_E_UNAUTHENTICATED _HRESULT_TYPEDEF_(0x80110605L) +#define COMQC_E_UNTRUSTED_ENQUEUER _HRESULT_TYPEDEF_(0x80110606L) +#define MSDTC_E_DUPLICATE_RESOURCE _HRESULT_TYPEDEF_(0x80110701L) +#define COMADMIN_E_OBJECT_PARENT_MISSING _HRESULT_TYPEDEF_(0x80110808L) +#define COMADMIN_E_OBJECT_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x80110809L) +#define COMADMIN_E_APP_NOT_RUNNING _HRESULT_TYPEDEF_(0x8011080AL) +#define COMADMIN_E_INVALID_PARTITION _HRESULT_TYPEDEF_(0x8011080BL) +#define COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE _HRESULT_TYPEDEF_(0x8011080DL) +#define COMADMIN_E_USER_IN_SET _HRESULT_TYPEDEF_(0x8011080EL) +#define COMADMIN_E_CANTRECYCLELIBRARYAPPS _HRESULT_TYPEDEF_(0x8011080FL) +#define COMADMIN_E_CANTRECYCLESERVICEAPPS _HRESULT_TYPEDEF_(0x80110811L) +#define COMADMIN_E_PROCESSALREADYRECYCLED _HRESULT_TYPEDEF_(0x80110812L) +#define COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED _HRESULT_TYPEDEF_(0x80110813L) +#define COMADMIN_E_CANTMAKEINPROCSERVICE _HRESULT_TYPEDEF_(0x80110814L) +#define COMADMIN_E_PROGIDINUSEBYCLSID _HRESULT_TYPEDEF_(0x80110815L) +#define COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET _HRESULT_TYPEDEF_(0x80110816L) +#define COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED _HRESULT_TYPEDEF_(0x80110817L) +#define COMADMIN_E_PARTITION_ACCESSDENIED _HRESULT_TYPEDEF_(0x80110818L) +#define COMADMIN_E_PARTITION_MSI_ONLY _HRESULT_TYPEDEF_(0x80110819L) +#define COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT _HRESULT_TYPEDEF_(0x8011081AL) +#define COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS _HRESULT_TYPEDEF_(0x8011081BL) +#define COMADMIN_E_COMP_MOVE_SOURCE _HRESULT_TYPEDEF_(0x8011081CL) +#define COMADMIN_E_COMP_MOVE_DEST _HRESULT_TYPEDEF_(0x8011081DL) +#define COMADMIN_E_COMP_MOVE_PRIVATE _HRESULT_TYPEDEF_(0x8011081EL) +#define COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET _HRESULT_TYPEDEF_(0x8011081FL) +#define COMADMIN_E_CANNOT_ALIAS_EVENTCLASS _HRESULT_TYPEDEF_(0x80110820L) +#define COMADMIN_E_PRIVATE_ACCESSDENIED _HRESULT_TYPEDEF_(0x80110821L) +#define COMADMIN_E_SAFERINVALID _HRESULT_TYPEDEF_(0x80110822L) +#define COMADMIN_E_REGISTRY_ACCESSDENIED _HRESULT_TYPEDEF_(0x80110823L) +#define COMADMIN_E_PARTITIONS_DISABLED _HRESULT_TYPEDEF_(0x80110824L) +#endif /* _WINERROR_ */ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/wingdi.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/wingdi.h new file mode 100644 index 00000000..63d38917 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/wingdi.h @@ -0,0 +1,4080 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINGDI_ +#define _WINGDI_ + +#define WINGDIAPI DECLSPEC_IMPORT +#define WINSPOOLAPI DECLSPEC_IMPORT + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#ifndef NOGDI +#ifndef NORASTEROPS +#define R2_BLACK 1 +#define R2_NOTMERGEPEN 2 +#define R2_MASKNOTPEN 3 +#define R2_NOTCOPYPEN 4 +#define R2_MASKPENNOT 5 +#define R2_NOT 6 +#define R2_XORPEN 7 +#define R2_NOTMASKPEN 8 +#define R2_MASKPEN 9 +#define R2_NOTXORPEN 10 +#define R2_NOP 11 +#define R2_MERGENOTPEN 12 +#define R2_COPYPEN 13 +#define R2_MERGEPENNOT 14 +#define R2_MERGEPEN 15 +#define R2_WHITE 16 +#define R2_LAST 16 + +#define SRCCOPY (DWORD)0x00CC0020 +#define SRCPAINT (DWORD)0x00EE0086 +#define SRCAND (DWORD)0x008800C6 +#define SRCINVERT (DWORD)0x00660046 +#define SRCERASE (DWORD)0x00440328 +#define NOTSRCCOPY (DWORD)0x00330008 +#define NOTSRCERASE (DWORD)0x001100A6 +#define MERGECOPY (DWORD)0x00C000CA +#define MERGEPAINT (DWORD)0x00BB0226 +#define PATCOPY (DWORD)0x00F00021 +#define PATPAINT (DWORD)0x00FB0A09 +#define PATINVERT (DWORD)0x005A0049 +#define DSTINVERT (DWORD)0x00550009 +#define BLACKNESS (DWORD)0x00000042 +#define WHITENESS (DWORD)0x00FF0062 +#define NOMIRRORBITMAP (DWORD)0x80000000 +#define CAPTUREBLT (DWORD)0x40000000 +#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) +#endif + +#define GDI_ERROR (0xFFFFFFFFL) +#define HGDI_ERROR (LongToHandle(0xFFFFFFFFL)) + +#define ERROR 0 +#define NULLREGION 1 +#define SIMPLEREGION 2 +#define COMPLEXREGION 3 +#define RGN_ERROR ERROR + +#define RGN_AND 1 +#define RGN_OR 2 +#define RGN_XOR 3 +#define RGN_DIFF 4 +#define RGN_COPY 5 +#define RGN_MIN RGN_AND +#define RGN_MAX RGN_COPY + +#define BLACKONWHITE 1 +#define WHITEONBLACK 2 +#define COLORONCOLOR 3 +#define HALFTONE 4 +#define MAXSTRETCHBLTMODE 4 + +#define STRETCH_ANDSCANS BLACKONWHITE +#define STRETCH_ORSCANS WHITEONBLACK +#define STRETCH_DELETESCANS COLORONCOLOR +#define STRETCH_HALFTONE HALFTONE + +#define ALTERNATE 1 +#define WINDING 2 +#define POLYFILL_LAST 2 + +#define LAYOUT_RTL 0x00000001 +#define LAYOUT_BTT 0x00000002 +#define LAYOUT_VBH 0x00000004 +#define LAYOUT_ORIENTATIONMASK (LAYOUT_RTL | LAYOUT_BTT | LAYOUT_VBH) +#define LAYOUT_BITMAPORIENTATIONPRESERVED 0x00000008 + +#define TA_NOUPDATECP 0 +#define TA_UPDATECP 1 + +#define TA_LEFT 0 +#define TA_RIGHT 2 +#define TA_CENTER 6 + +#define TA_TOP 0 +#define TA_BOTTOM 8 +#define TA_BASELINE 24 +#define TA_RTLREADING 256 +#define TA_MASK (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING) + +#define VTA_BASELINE TA_BASELINE +#define VTA_LEFT TA_BOTTOM +#define VTA_RIGHT TA_TOP +#define VTA_CENTER TA_CENTER +#define VTA_BOTTOM TA_RIGHT +#define VTA_TOP TA_LEFT + +#define ETO_OPAQUE 0x0002 +#define ETO_CLIPPED 0x0004 +#define ETO_GLYPH_INDEX 0x0010 +#define ETO_RTLREADING 0x0080 +#define ETO_NUMERICSLOCAL 0x0400 +#define ETO_NUMERICSLATIN 0x0800 +#define ETO_IGNORELANGUAGE 0x1000 +#define ETO_PDY 0x2000 + +#define ASPECT_FILTERING 0x0001 + +#define DCB_RESET 0x0001 +#define DCB_ACCUMULATE 0x0002 +#define DCB_DIRTY DCB_ACCUMULATE +#define DCB_SET (DCB_RESET | DCB_ACCUMULATE) +#define DCB_ENABLE 0x0004 +#define DCB_DISABLE 0x0008 + +#ifndef NOMETAFILE + +#define META_SETBKCOLOR 0x0201 +#define META_SETBKMODE 0x0102 +#define META_SETMAPMODE 0x0103 +#define META_SETROP2 0x0104 +#define META_SETRELABS 0x0105 +#define META_SETPOLYFILLMODE 0x0106 +#define META_SETSTRETCHBLTMODE 0x0107 +#define META_SETTEXTCHAREXTRA 0x0108 +#define META_SETTEXTCOLOR 0x0209 +#define META_SETTEXTJUSTIFICATION 0x020A +#define META_SETWINDOWORG 0x020B +#define META_SETWINDOWEXT 0x020C +#define META_SETVIEWPORTORG 0x020D +#define META_SETVIEWPORTEXT 0x020E +#define META_OFFSETWINDOWORG 0x020F +#define META_SCALEWINDOWEXT 0x0410 +#define META_OFFSETVIEWPORTORG 0x0211 +#define META_SCALEVIEWPORTEXT 0x0412 +#define META_LINETO 0x0213 +#define META_MOVETO 0x0214 +#define META_EXCLUDECLIPRECT 0x0415 +#define META_INTERSECTCLIPRECT 0x0416 +#define META_ARC 0x0817 +#define META_ELLIPSE 0x0418 +#define META_FLOODFILL 0x0419 +#define META_PIE 0x081A +#define META_RECTANGLE 0x041B +#define META_ROUNDRECT 0x061C +#define META_PATBLT 0x061D +#define META_SAVEDC 0x001E +#define META_SETPIXEL 0x041F +#define META_OFFSETCLIPRGN 0x0220 +#define META_TEXTOUT 0x0521 +#define META_BITBLT 0x0922 +#define META_STRETCHBLT 0x0B23 +#define META_POLYGON 0x0324 +#define META_POLYLINE 0x0325 +#define META_ESCAPE 0x0626 +#define META_RESTOREDC 0x0127 +#define META_FILLREGION 0x0228 +#define META_FRAMEREGION 0x0429 +#define META_INVERTREGION 0x012A +#define META_PAINTREGION 0x012B +#define META_SELECTCLIPREGION 0x012C +#define META_SELECTOBJECT 0x012D +#define META_SETTEXTALIGN 0x012E +#define META_CHORD 0x0830 +#define META_SETMAPPERFLAGS 0x0231 +#define META_EXTTEXTOUT 0x0a32 +#define META_SETDIBTODEV 0x0d33 +#define META_SELECTPALETTE 0x0234 +#define META_REALIZEPALETTE 0x0035 +#define META_ANIMATEPALETTE 0x0436 +#define META_SETPALENTRIES 0x0037 +#define META_POLYPOLYGON 0x0538 +#define META_RESIZEPALETTE 0x0139 +#define META_DIBBITBLT 0x0940 +#define META_DIBSTRETCHBLT 0x0b41 +#define META_DIBCREATEPATTERNBRUSH 0x0142 +#define META_STRETCHDIB 0x0f43 +#define META_EXTFLOODFILL 0x0548 +#define META_SETLAYOUT 0x0149 +#define META_DELETEOBJECT 0x01f0 +#define META_CREATEPALETTE 0x00f7 +#define META_CREATEPATTERNBRUSH 0x01F9 +#define META_CREATEPENINDIRECT 0x02FA +#define META_CREATEFONTINDIRECT 0x02FB +#define META_CREATEBRUSHINDIRECT 0x02FC +#define META_CREATEREGION 0x06FF + + typedef struct _DRAWPATRECT { + POINT ptPosition; + POINT ptSize; + WORD wStyle; + WORD wPattern; + } DRAWPATRECT,*PDRAWPATRECT; +#endif + +#define NEWFRAME 1 +#define ABORTDOC 2 +#define NEXTBAND 3 +#define SETCOLORTABLE 4 +#define GETCOLORTABLE 5 +#define FLUSHOUTPUT 6 +#define DRAFTMODE 7 +#define QUERYESCSUPPORT 8 +#define SETABORTPROC 9 +#define STARTDOC 10 +#define ENDDOC 11 +#define GETPHYSPAGESIZE 12 +#define GETPRINTINGOFFSET 13 +#define GETSCALINGFACTOR 14 +#define MFCOMMENT 15 +#define GETPENWIDTH 16 +#define SETCOPYCOUNT 17 +#define SELECTPAPERSOURCE 18 +#define DEVICEDATA 19 +#define PASSTHROUGH 19 +#define GETTECHNOLGY 20 +#define GETTECHNOLOGY 20 +#define SETLINECAP 21 +#define SETLINEJOIN 22 +#define SETMITERLIMIT 23 +#define BANDINFO 24 +#define DRAWPATTERNRECT 25 +#define GETVECTORPENSIZE 26 +#define GETVECTORBRUSHSIZE 27 +#define ENABLEDUPLEX 28 +#define GETSETPAPERBINS 29 +#define GETSETPRINTORIENT 30 +#define ENUMPAPERBINS 31 +#define SETDIBSCALING 32 +#define EPSPRINTING 33 +#define ENUMPAPERMETRICS 34 +#define GETSETPAPERMETRICS 35 +#define POSTSCRIPT_DATA 37 +#define POSTSCRIPT_IGNORE 38 +#define MOUSETRAILS 39 +#define GETDEVICEUNITS 42 + +#define GETEXTENDEDTEXTMETRICS 256 +#define GETEXTENTTABLE 257 +#define GETPAIRKERNTABLE 258 +#define GETTRACKKERNTABLE 259 +#define EXTTEXTOUT 512 +#define GETFACENAME 513 +#define DOWNLOADFACE 514 +#define ENABLERELATIVEWIDTHS 768 +#define ENABLEPAIRKERNING 769 +#define SETKERNTRACK 770 +#define SETALLJUSTVALUES 771 +#define SETCHARSET 772 + +#define STRETCHBLT 2048 +#define METAFILE_DRIVER 2049 +#define GETSETSCREENPARAMS 3072 +#define QUERYDIBSUPPORT 3073 +#define BEGIN_PATH 4096 +#define CLIP_TO_PATH 4097 +#define END_PATH 4098 +#define EXT_DEVICE_CAPS 4099 +#define RESTORE_CTM 4100 +#define SAVE_CTM 4101 +#define SET_ARC_DIRECTION 4102 +#define SET_BACKGROUND_COLOR 4103 +#define SET_POLY_MODE 4104 +#define SET_SCREEN_ANGLE 4105 +#define SET_SPREAD 4106 +#define TRANSFORM_CTM 4107 +#define SET_CLIP_BOX 4108 +#define SET_BOUNDS 4109 +#define SET_MIRROR_MODE 4110 +#define OPENCHANNEL 4110 +#define DOWNLOADHEADER 4111 +#define CLOSECHANNEL 4112 +#define POSTSCRIPT_PASSTHROUGH 4115 +#define ENCAPSULATED_POSTSCRIPT 4116 + +#define POSTSCRIPT_IDENTIFY 4117 +#define POSTSCRIPT_INJECTION 4118 + +#define CHECKJPEGFORMAT 4119 +#define CHECKPNGFORMAT 4120 + +#define GET_PS_FEATURESETTING 4121 + +#define SPCLPASSTHROUGH2 4568 + +#define PSIDENT_GDICENTRIC 0 +#define PSIDENT_PSCENTRIC 1 + + typedef struct _PSINJECTDATA { + DWORD DataBytes; + WORD InjectionPoint; + WORD PageNumber; + } PSINJECTDATA,*PPSINJECTDATA; + +#define PSINJECT_BEGINSTREAM 1 +#define PSINJECT_PSADOBE 2 +#define PSINJECT_PAGESATEND 3 +#define PSINJECT_PAGES 4 + +#define PSINJECT_DOCNEEDEDRES 5 +#define PSINJECT_DOCSUPPLIEDRES 6 +#define PSINJECT_PAGEORDER 7 +#define PSINJECT_ORIENTATION 8 +#define PSINJECT_BOUNDINGBOX 9 +#define PSINJECT_DOCUMENTPROCESSCOLORS 10 + +#define PSINJECT_COMMENTS 11 +#define PSINJECT_BEGINDEFAULTS 12 +#define PSINJECT_ENDDEFAULTS 13 +#define PSINJECT_BEGINPROLOG 14 +#define PSINJECT_ENDPROLOG 15 +#define PSINJECT_BEGINSETUP 16 +#define PSINJECT_ENDSETUP 17 +#define PSINJECT_TRAILER 18 +#define PSINJECT_EOF 19 +#define PSINJECT_ENDSTREAM 20 +#define PSINJECT_DOCUMENTPROCESSCOLORSATEND 21 + +#define PSINJECT_PAGENUMBER 100 +#define PSINJECT_BEGINPAGESETUP 101 +#define PSINJECT_ENDPAGESETUP 102 +#define PSINJECT_PAGETRAILER 103 +#define PSINJECT_PLATECOLOR 104 + +#define PSINJECT_SHOWPAGE 105 +#define PSINJECT_PAGEBBOX 106 +#define PSINJECT_ENDPAGECOMMENTS 107 + +#define PSINJECT_VMSAVE 200 +#define PSINJECT_VMRESTORE 201 + +#define FEATURESETTING_NUP 0 +#define FEATURESETTING_OUTPUT 1 +#define FEATURESETTING_PSLEVEL 2 +#define FEATURESETTING_CUSTPAPER 3 +#define FEATURESETTING_MIRROR 4 +#define FEATURESETTING_NEGATIVE 5 +#define FEATURESETTING_PROTOCOL 6 + +#define FEATURESETTING_PRIVATE_BEGIN 0x1000 +#define FEATURESETTING_PRIVATE_END 0x1FFF + + typedef struct _PSFEATURE_OUTPUT { + WINBOOL bPageIndependent; + WINBOOL bSetPageDevice; + } PSFEATURE_OUTPUT,*PPSFEATURE_OUTPUT; + + typedef struct _PSFEATURE_CUSTPAPER { + LONG lOrientation; + LONG lWidth; + LONG lHeight; + LONG lWidthOffset; + LONG lHeightOffset; + } PSFEATURE_CUSTPAPER,*PPSFEATURE_CUSTPAPER; + +#define PSPROTOCOL_ASCII 0 +#define PSPROTOCOL_BCP 1 +#define PSPROTOCOL_TBCP 2 +#define PSPROTOCOL_BINARY 3 + +#define QDI_SETDIBITS 1 +#define QDI_GETDIBITS 2 +#define QDI_DIBTOSCREEN 4 +#define QDI_STRETCHDIB 8 + +#define SP_NOTREPORTED 0x4000 +#define SP_ERROR (-1) +#define SP_APPABORT (-2) +#define SP_USERABORT (-3) +#define SP_OUTOFDISK (-4) +#define SP_OUTOFMEMORY (-5) + +#define PR_JOBSTATUS 0x0000 + +#define OBJ_PEN 1 +#define OBJ_BRUSH 2 +#define OBJ_DC 3 +#define OBJ_METADC 4 +#define OBJ_PAL 5 +#define OBJ_FONT 6 +#define OBJ_BITMAP 7 +#define OBJ_REGION 8 +#define OBJ_METAFILE 9 +#define OBJ_MEMDC 10 +#define OBJ_EXTPEN 11 +#define OBJ_ENHMETADC 12 +#define OBJ_ENHMETAFILE 13 +#define OBJ_COLORSPACE 14 + +#define MWT_IDENTITY 1 +#define MWT_LEFTMULTIPLY 2 +#define MWT_RIGHTMULTIPLY 3 + +#define MWT_MIN MWT_IDENTITY +#define MWT_MAX MWT_RIGHTMULTIPLY + +#define _XFORM_ + typedef struct tagXFORM { + FLOAT eM11; + FLOAT eM12; + FLOAT eM21; + FLOAT eM22; + FLOAT eDx; + FLOAT eDy; + } XFORM,*PXFORM,*LPXFORM; + + typedef struct tagBITMAP { + LONG bmType; + LONG bmWidth; + LONG bmHeight; + LONG bmWidthBytes; + WORD bmPlanes; + WORD bmBitsPixel; + LPVOID bmBits; + } BITMAP,*PBITMAP,*NPBITMAP,*LPBITMAP; + +#include + typedef struct tagRGBTRIPLE { + BYTE rgbtBlue; + BYTE rgbtGreen; + BYTE rgbtRed; + } RGBTRIPLE; +#include + + typedef struct tagRGBQUAD { + BYTE rgbBlue; + BYTE rgbGreen; + BYTE rgbRed; + BYTE rgbReserved; + } RGBQUAD; + typedef RGBQUAD *LPRGBQUAD; + +#define CS_ENABLE 0x00000001L +#define CS_DISABLE 0x00000002L +#define CS_DELETE_TRANSFORM 0x00000003L + +//!__TINYC__: #define LCS_SIGNATURE 'PSOC' +//!__TINYC__: #define LCS_sRGB 'sRGB' +//!__TINYC__: #define LCS_WINDOWS_COLOR_SPACE 'Win ' + + typedef LONG LCSCSTYPE; +#define LCS_CALIBRATED_RGB 0x00000000L + + typedef LONG LCSGAMUTMATCH; +#define LCS_GM_BUSINESS 0x00000001L +#define LCS_GM_GRAPHICS 0x00000002L +#define LCS_GM_IMAGES 0x00000004L +#define LCS_GM_ABS_COLORIMETRIC 0x00000008L + +#define CM_OUT_OF_GAMUT 255 +#define CM_IN_GAMUT 0 + +#define ICM_ADDPROFILE 1 +#define ICM_DELETEPROFILE 2 +#define ICM_QUERYPROFILE 3 +#define ICM_SETDEFAULTPROFILE 4 +#define ICM_REGISTERICMATCHER 5 +#define ICM_UNREGISTERICMATCHER 6 +#define ICM_QUERYMATCH 7 + +#define GetKValue(cmyk) ((BYTE)(cmyk)) +#define GetYValue(cmyk) ((BYTE)((cmyk)>> 8)) +#define GetMValue(cmyk) ((BYTE)((cmyk)>>16)) +#define GetCValue(cmyk) ((BYTE)((cmyk)>>24)) + +#define CMYK(c,m,y,k) ((COLORREF)((((BYTE)(k)|((WORD)((BYTE)(y))<<8))|(((DWORD)(BYTE)(m))<<16))|(((DWORD)(BYTE)(c))<<24))) + + typedef long FXPT16DOT16,*LPFXPT16DOT16; + typedef long FXPT2DOT30,*LPFXPT2DOT30; + + typedef struct tagCIEXYZ { + FXPT2DOT30 ciexyzX; + FXPT2DOT30 ciexyzY; + FXPT2DOT30 ciexyzZ; + } CIEXYZ; + typedef CIEXYZ *LPCIEXYZ; + + typedef struct tagICEXYZTRIPLE { + CIEXYZ ciexyzRed; + CIEXYZ ciexyzGreen; + CIEXYZ ciexyzBlue; + } CIEXYZTRIPLE; + + typedef CIEXYZTRIPLE *LPCIEXYZTRIPLE; + + typedef struct tagLOGCOLORSPACEA { + DWORD lcsSignature; + DWORD lcsVersion; + DWORD lcsSize; + LCSCSTYPE lcsCSType; + LCSGAMUTMATCH lcsIntent; + CIEXYZTRIPLE lcsEndpoints; + DWORD lcsGammaRed; + DWORD lcsGammaGreen; + DWORD lcsGammaBlue; + CHAR lcsFilename[MAX_PATH]; + } LOGCOLORSPACEA,*LPLOGCOLORSPACEA; + + typedef struct tagLOGCOLORSPACEW { + DWORD lcsSignature; + DWORD lcsVersion; + DWORD lcsSize; + LCSCSTYPE lcsCSType; + LCSGAMUTMATCH lcsIntent; + CIEXYZTRIPLE lcsEndpoints; + DWORD lcsGammaRed; + DWORD lcsGammaGreen; + DWORD lcsGammaBlue; + WCHAR lcsFilename[MAX_PATH]; + } LOGCOLORSPACEW,*LPLOGCOLORSPACEW; + +#ifdef UNICODE + typedef LOGCOLORSPACEW LOGCOLORSPACE; + typedef LPLOGCOLORSPACEW LPLOGCOLORSPACE; +#else + typedef LOGCOLORSPACEA LOGCOLORSPACE; + typedef LPLOGCOLORSPACEA LPLOGCOLORSPACE; +#endif + + typedef struct tagBITMAPCOREHEADER { + DWORD bcSize; + WORD bcWidth; + WORD bcHeight; + WORD bcPlanes; + WORD bcBitCount; + } BITMAPCOREHEADER,*LPBITMAPCOREHEADER,*PBITMAPCOREHEADER; + + typedef struct tagBITMAPINFOHEADER { + DWORD biSize; + LONG biWidth; + LONG biHeight; + WORD biPlanes; + WORD biBitCount; + DWORD biCompression; + DWORD biSizeImage; + LONG biXPelsPerMeter; + LONG biYPelsPerMeter; + DWORD biClrUsed; + DWORD biClrImportant; + } BITMAPINFOHEADER,*LPBITMAPINFOHEADER,*PBITMAPINFOHEADER; + + typedef struct { + DWORD bV4Size; + LONG bV4Width; + LONG bV4Height; + WORD bV4Planes; + WORD bV4BitCount; + DWORD bV4V4Compression; + DWORD bV4SizeImage; + LONG bV4XPelsPerMeter; + LONG bV4YPelsPerMeter; + DWORD bV4ClrUsed; + DWORD bV4ClrImportant; + DWORD bV4RedMask; + DWORD bV4GreenMask; + DWORD bV4BlueMask; + DWORD bV4AlphaMask; + DWORD bV4CSType; + CIEXYZTRIPLE bV4Endpoints; + DWORD bV4GammaRed; + DWORD bV4GammaGreen; + DWORD bV4GammaBlue; + } BITMAPV4HEADER,*LPBITMAPV4HEADER,*PBITMAPV4HEADER; + + typedef struct { + DWORD bV5Size; + LONG bV5Width; + LONG bV5Height; + WORD bV5Planes; + WORD bV5BitCount; + DWORD bV5Compression; + DWORD bV5SizeImage; + LONG bV5XPelsPerMeter; + LONG bV5YPelsPerMeter; + DWORD bV5ClrUsed; + DWORD bV5ClrImportant; + DWORD bV5RedMask; + DWORD bV5GreenMask; + DWORD bV5BlueMask; + DWORD bV5AlphaMask; + DWORD bV5CSType; + CIEXYZTRIPLE bV5Endpoints; + DWORD bV5GammaRed; + DWORD bV5GammaGreen; + DWORD bV5GammaBlue; + DWORD bV5Intent; + DWORD bV5ProfileData; + DWORD bV5ProfileSize; + DWORD bV5Reserved; + } BITMAPV5HEADER,*LPBITMAPV5HEADER,*PBITMAPV5HEADER; + +//!__TINYC__: #define PROFILE_LINKED 'LINK' +//!__TINYC__: #define PROFILE_EMBEDDED 'MBED' + +#define BI_RGB 0L +#define BI_RLE8 1L +#define BI_RLE4 2L +#define BI_BITFIELDS 3L +#define BI_JPEG 4L +#define BI_PNG 5L + + typedef struct tagBITMAPINFO { + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[1]; + } BITMAPINFO,*LPBITMAPINFO,*PBITMAPINFO; + + typedef struct tagBITMAPCOREINFO { + BITMAPCOREHEADER bmciHeader; + RGBTRIPLE bmciColors[1]; + } BITMAPCOREINFO,*LPBITMAPCOREINFO,*PBITMAPCOREINFO; + +#include + typedef struct tagBITMAPFILEHEADER { + WORD bfType; + DWORD bfSize; + WORD bfReserved1; + WORD bfReserved2; + DWORD bfOffBits; + } BITMAPFILEHEADER,*LPBITMAPFILEHEADER,*PBITMAPFILEHEADER; +#include + +#define MAKEPOINTS(l) (*((POINTS *)&(l))) + +#ifndef NOFONTSIG + typedef struct tagFONTSIGNATURE { + DWORD fsUsb[4]; + DWORD fsCsb[2]; + } FONTSIGNATURE,*PFONTSIGNATURE,*LPFONTSIGNATURE; + + typedef struct tagCHARSETINFO { + UINT ciCharset; + UINT ciACP; + FONTSIGNATURE fs; + } CHARSETINFO,*PCHARSETINFO,*NPCHARSETINFO,*LPCHARSETINFO; + +#define TCI_SRCCHARSET 1 +#define TCI_SRCCODEPAGE 2 +#define TCI_SRCFONTSIG 3 +#define TCI_SRCLOCALE 0x1000 + + typedef struct tagLOCALESIGNATURE { + DWORD lsUsb[4]; + DWORD lsCsbDefault[2]; + DWORD lsCsbSupported[2]; + } LOCALESIGNATURE,*PLOCALESIGNATURE,*LPLOCALESIGNATURE; +#endif + + +#ifndef NOMETAFILE + typedef struct tagHANDLETABLE { + HGDIOBJ objectHandle[1]; + } HANDLETABLE,*PHANDLETABLE,*LPHANDLETABLE; + + typedef struct tagMETARECORD { + DWORD rdSize; + WORD rdFunction; + WORD rdParm[1]; + } METARECORD; + typedef struct tagMETARECORD UNALIGNED *PMETARECORD; + typedef struct tagMETARECORD UNALIGNED *LPMETARECORD; + + typedef struct tagMETAFILEPICT { + LONG mm; + LONG xExt; + LONG yExt; + HMETAFILE hMF; + } METAFILEPICT,*LPMETAFILEPICT; + +#include + typedef struct tagMETAHEADER { + WORD mtType; + WORD mtHeaderSize; + WORD mtVersion; + DWORD mtSize; + WORD mtNoObjects; + DWORD mtMaxRecord; + WORD mtNoParameters; + } METAHEADER; + typedef struct tagMETAHEADER UNALIGNED *PMETAHEADER; + typedef struct tagMETAHEADER UNALIGNED *LPMETAHEADER; + +#include + + typedef struct tagENHMETARECORD { + DWORD iType; + DWORD nSize; + DWORD dParm[1]; + } ENHMETARECORD,*PENHMETARECORD,*LPENHMETARECORD; + + typedef struct tagENHMETAHEADER { + DWORD iType; + DWORD nSize; + RECTL rclBounds; + RECTL rclFrame; + DWORD dSignature; + DWORD nVersion; + DWORD nBytes; + DWORD nRecords; + WORD nHandles; + WORD sReserved; + DWORD nDescription; + DWORD offDescription; + DWORD nPalEntries; + SIZEL szlDevice; + SIZEL szlMillimeters; + DWORD cbPixelFormat; + DWORD offPixelFormat; + DWORD bOpenGL; + SIZEL szlMicrometers; + } ENHMETAHEADER,*PENHMETAHEADER,*LPENHMETAHEADER; +#endif + +#ifndef NOTEXTMETRIC +#define TMPF_FIXED_PITCH 0x01 +#define TMPF_VECTOR 0x02 +#define TMPF_DEVICE 0x08 +#define TMPF_TRUETYPE 0x04 + +#ifdef UNICODE + typedef WCHAR BCHAR; +#else + typedef BYTE BCHAR; +#endif + +#ifndef _TEXTMETRIC_DEFINED +#define _TEXTMETRIC_DEFINED + typedef struct tagTEXTMETRICA { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + BYTE tmFirstChar; + BYTE tmLastChar; + BYTE tmDefaultChar; + BYTE tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; + } TEXTMETRICA,*PTEXTMETRICA,*NPTEXTMETRICA,*LPTEXTMETRICA; + + typedef struct tagTEXTMETRICW { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + WCHAR tmFirstChar; + WCHAR tmLastChar; + WCHAR tmDefaultChar; + WCHAR tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; + } TEXTMETRICW,*PTEXTMETRICW,*NPTEXTMETRICW,*LPTEXTMETRICW; +#ifdef UNICODE + typedef TEXTMETRICW TEXTMETRIC; + typedef PTEXTMETRICW PTEXTMETRIC; + typedef NPTEXTMETRICW NPTEXTMETRIC; + typedef LPTEXTMETRICW LPTEXTMETRIC; +#else + typedef TEXTMETRICA TEXTMETRIC; + typedef PTEXTMETRICA PTEXTMETRIC; + typedef NPTEXTMETRICA NPTEXTMETRIC; + typedef LPTEXTMETRICA LPTEXTMETRIC; +#endif +#endif + +#define NTM_REGULAR 0x00000040L +#define NTM_BOLD 0x00000020L +#define NTM_ITALIC 0x00000001L + +#define NTM_NONNEGATIVE_AC 0x00010000 +#define NTM_PS_OPENTYPE 0x00020000 +#define NTM_TT_OPENTYPE 0x00040000 +#define NTM_MULTIPLEMASTER 0x00080000 +#define NTM_TYPE1 0x00100000 +#define NTM_DSIG 0x00200000 + +#include + typedef struct tagNEWTEXTMETRICA { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + BYTE tmFirstChar; + BYTE tmLastChar; + BYTE tmDefaultChar; + BYTE tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; + DWORD ntmFlags; + UINT ntmSizeEM; + UINT ntmCellHeight; + UINT ntmAvgWidth; + } NEWTEXTMETRICA,*PNEWTEXTMETRICA,*NPNEWTEXTMETRICA,*LPNEWTEXTMETRICA; + + typedef struct tagNEWTEXTMETRICW { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + WCHAR tmFirstChar; + WCHAR tmLastChar; + WCHAR tmDefaultChar; + WCHAR tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; + DWORD ntmFlags; + UINT ntmSizeEM; + UINT ntmCellHeight; + UINT ntmAvgWidth; + } NEWTEXTMETRICW,*PNEWTEXTMETRICW,*NPNEWTEXTMETRICW,*LPNEWTEXTMETRICW; +#ifdef UNICODE + typedef NEWTEXTMETRICW NEWTEXTMETRIC; + typedef PNEWTEXTMETRICW PNEWTEXTMETRIC; + typedef NPNEWTEXTMETRICW NPNEWTEXTMETRIC; + typedef LPNEWTEXTMETRICW LPNEWTEXTMETRIC; +#else + typedef NEWTEXTMETRICA NEWTEXTMETRIC; + typedef PNEWTEXTMETRICA PNEWTEXTMETRIC; + typedef NPNEWTEXTMETRICA NPNEWTEXTMETRIC; + typedef LPNEWTEXTMETRICA LPNEWTEXTMETRIC; +#endif +#include + + typedef struct tagNEWTEXTMETRICEXA { + NEWTEXTMETRICA ntmTm; + FONTSIGNATURE ntmFontSig; + } NEWTEXTMETRICEXA; + + typedef struct tagNEWTEXTMETRICEXW { + NEWTEXTMETRICW ntmTm; + FONTSIGNATURE ntmFontSig; + } NEWTEXTMETRICEXW; +#ifdef UNICODE + typedef NEWTEXTMETRICEXW NEWTEXTMETRICEX; +#else + typedef NEWTEXTMETRICEXA NEWTEXTMETRICEX; +#endif +#endif + + typedef struct tagPELARRAY { + LONG paXCount; + LONG paYCount; + LONG paXExt; + LONG paYExt; + BYTE paRGBs; + } PELARRAY,*PPELARRAY,*NPPELARRAY,*LPPELARRAY; + + typedef struct tagLOGBRUSH { + UINT lbStyle; + COLORREF lbColor; + ULONG_PTR lbHatch; + } LOGBRUSH,*PLOGBRUSH,*NPLOGBRUSH,*LPLOGBRUSH; + + typedef struct tagLOGBRUSH32 { + UINT lbStyle; + COLORREF lbColor; + ULONG lbHatch; + } LOGBRUSH32,*PLOGBRUSH32,*NPLOGBRUSH32,*LPLOGBRUSH32; + + typedef LOGBRUSH PATTERN; + typedef PATTERN *PPATTERN; + typedef PATTERN *NPPATTERN; + typedef PATTERN *LPPATTERN; + + typedef struct tagLOGPEN { + UINT lopnStyle; + POINT lopnWidth; + COLORREF lopnColor; + } LOGPEN,*PLOGPEN,*NPLOGPEN,*LPLOGPEN; + + typedef struct tagEXTLOGPEN { + DWORD elpPenStyle; + DWORD elpWidth; + UINT elpBrushStyle; + COLORREF elpColor; + ULONG_PTR elpHatch; + DWORD elpNumEntries; + DWORD elpStyleEntry[1]; + } EXTLOGPEN,*PEXTLOGPEN,*NPEXTLOGPEN,*LPEXTLOGPEN; + +#ifndef _PALETTEENTRY_DEFINED +#define _PALETTEENTRY_DEFINED + typedef struct tagPALETTEENTRY { + BYTE peRed; + BYTE peGreen; + BYTE peBlue; + BYTE peFlags; + } PALETTEENTRY,*PPALETTEENTRY,*LPPALETTEENTRY; +#endif + +#ifndef _LOGPALETTE_DEFINED +#define _LOGPALETTE_DEFINED + + typedef struct tagLOGPALETTE { + WORD palVersion; + WORD palNumEntries; + PALETTEENTRY palPalEntry[1]; + } LOGPALETTE,*PLOGPALETTE,*NPLOGPALETTE,*LPLOGPALETTE; +#endif + +#define LF_FACESIZE 32 + + typedef struct tagLOGFONTA { + LONG lfHeight; + LONG lfWidth; + LONG lfEscapement; + LONG lfOrientation; + LONG lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + CHAR lfFaceName[LF_FACESIZE]; + } LOGFONTA,*PLOGFONTA,*NPLOGFONTA,*LPLOGFONTA; + + typedef struct tagLOGFONTW { + LONG lfHeight; + LONG lfWidth; + LONG lfEscapement; + LONG lfOrientation; + LONG lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + WCHAR lfFaceName[LF_FACESIZE]; + } LOGFONTW,*PLOGFONTW,*NPLOGFONTW,*LPLOGFONTW; +#ifdef UNICODE + typedef LOGFONTW LOGFONT; + typedef PLOGFONTW PLOGFONT; + typedef NPLOGFONTW NPLOGFONT; + typedef LPLOGFONTW LPLOGFONT; +#else + typedef LOGFONTA LOGFONT; + typedef PLOGFONTA PLOGFONT; + typedef NPLOGFONTA NPLOGFONT; + typedef LPLOGFONTA LPLOGFONT; +#endif + +#define LF_FULLFACESIZE 64 + + typedef struct tagENUMLOGFONTA { + LOGFONTA elfLogFont; + BYTE elfFullName[LF_FULLFACESIZE]; + BYTE elfStyle[LF_FACESIZE]; + } ENUMLOGFONTA,*LPENUMLOGFONTA; + + typedef struct tagENUMLOGFONTW { + LOGFONTW elfLogFont; + WCHAR elfFullName[LF_FULLFACESIZE]; + WCHAR elfStyle[LF_FACESIZE]; + } ENUMLOGFONTW,*LPENUMLOGFONTW; +#ifdef UNICODE + typedef ENUMLOGFONTW ENUMLOGFONT; + typedef LPENUMLOGFONTW LPENUMLOGFONT; +#else + typedef ENUMLOGFONTA ENUMLOGFONT; + typedef LPENUMLOGFONTA LPENUMLOGFONT; +#endif + + typedef struct tagENUMLOGFONTEXA { + LOGFONTA elfLogFont; + BYTE elfFullName[LF_FULLFACESIZE]; + BYTE elfStyle[LF_FACESIZE]; + BYTE elfScript[LF_FACESIZE]; + } ENUMLOGFONTEXA,*LPENUMLOGFONTEXA; + + typedef struct tagENUMLOGFONTEXW { + LOGFONTW elfLogFont; + WCHAR elfFullName[LF_FULLFACESIZE]; + WCHAR elfStyle[LF_FACESIZE]; + WCHAR elfScript[LF_FACESIZE]; + } ENUMLOGFONTEXW,*LPENUMLOGFONTEXW; +#ifdef UNICODE + typedef ENUMLOGFONTEXW ENUMLOGFONTEX; + typedef LPENUMLOGFONTEXW LPENUMLOGFONTEX; +#else + typedef ENUMLOGFONTEXA ENUMLOGFONTEX; + typedef LPENUMLOGFONTEXA LPENUMLOGFONTEX; +#endif + +#define OUT_DEFAULT_PRECIS 0 +#define OUT_STRING_PRECIS 1 +#define OUT_CHARACTER_PRECIS 2 +#define OUT_STROKE_PRECIS 3 +#define OUT_TT_PRECIS 4 +#define OUT_DEVICE_PRECIS 5 +#define OUT_RASTER_PRECIS 6 +#define OUT_TT_ONLY_PRECIS 7 +#define OUT_OUTLINE_PRECIS 8 +#define OUT_SCREEN_OUTLINE_PRECIS 9 +#define OUT_PS_ONLY_PRECIS 10 + +#define CLIP_DEFAULT_PRECIS 0 +#define CLIP_CHARACTER_PRECIS 1 +#define CLIP_STROKE_PRECIS 2 +#define CLIP_MASK 0xf +#define CLIP_LH_ANGLES (1<<4) +#define CLIP_TT_ALWAYS (2<<4) +#define CLIP_DFA_DISABLE (4<<4) +#define CLIP_EMBEDDED (8<<4) + +#define DEFAULT_QUALITY 0 +#define DRAFT_QUALITY 1 +#define PROOF_QUALITY 2 +#define NONANTIALIASED_QUALITY 3 +#define ANTIALIASED_QUALITY 4 + +#define CLEARTYPE_QUALITY 5 +#define CLEARTYPE_NATURAL_QUALITY 6 + +#define DEFAULT_PITCH 0 +#define FIXED_PITCH 1 +#define VARIABLE_PITCH 2 +#define MONO_FONT 8 + +#define ANSI_CHARSET 0 +#define DEFAULT_CHARSET 1 +#define SYMBOL_CHARSET 2 +#define SHIFTJIS_CHARSET 128 +#define HANGEUL_CHARSET 129 +#define HANGUL_CHARSET 129 +#define GB2312_CHARSET 134 +#define CHINESEBIG5_CHARSET 136 +#define OEM_CHARSET 255 +#define JOHAB_CHARSET 130 +#define HEBREW_CHARSET 177 +#define ARABIC_CHARSET 178 +#define GREEK_CHARSET 161 +#define TURKISH_CHARSET 162 +#define VIETNAMESE_CHARSET 163 +#define THAI_CHARSET 222 +#define EASTEUROPE_CHARSET 238 +#define RUSSIAN_CHARSET 204 + +#define MAC_CHARSET 77 +#define BALTIC_CHARSET 186 + +#define FS_LATIN1 0x00000001L +#define FS_LATIN2 0x00000002L +#define FS_CYRILLIC 0x00000004L +#define FS_GREEK 0x00000008L +#define FS_TURKISH 0x00000010L +#define FS_HEBREW 0x00000020L +#define FS_ARABIC 0x00000040L +#define FS_BALTIC 0x00000080L +#define FS_VIETNAMESE 0x00000100L +#define FS_THAI 0x00010000L +#define FS_JISJAPAN 0x00020000L +#define FS_CHINESESIMP 0x00040000L +#define FS_WANSUNG 0x00080000L +#define FS_CHINESETRAD 0x00100000L +#define FS_JOHAB 0x00200000L +#define FS_SYMBOL 0x80000000L + +#define FF_DONTCARE (0<<4) +#define FF_ROMAN (1<<4) + +#define FF_SWISS (2<<4) + +#define FF_MODERN (3<<4) + +#define FF_SCRIPT (4<<4) +#define FF_DECORATIVE (5<<4) + +#define FW_DONTCARE 0 +#define FW_THIN 100 +#define FW_EXTRALIGHT 200 +#define FW_LIGHT 300 +#define FW_NORMAL 400 +#define FW_MEDIUM 500 +#define FW_SEMIBOLD 600 +#define FW_BOLD 700 +#define FW_EXTRABOLD 800 +#define FW_HEAVY 900 + +#define FW_ULTRALIGHT FW_EXTRALIGHT +#define FW_REGULAR FW_NORMAL +#define FW_DEMIBOLD FW_SEMIBOLD +#define FW_ULTRABOLD FW_EXTRABOLD +#define FW_BLACK FW_HEAVY + +#define PANOSE_COUNT 10 +#define PAN_FAMILYTYPE_INDEX 0 +#define PAN_SERIFSTYLE_INDEX 1 +#define PAN_WEIGHT_INDEX 2 +#define PAN_PROPORTION_INDEX 3 +#define PAN_CONTRAST_INDEX 4 +#define PAN_STROKEVARIATION_INDEX 5 +#define PAN_ARMSTYLE_INDEX 6 +#define PAN_LETTERFORM_INDEX 7 +#define PAN_MIDLINE_INDEX 8 +#define PAN_XHEIGHT_INDEX 9 + +#define PAN_CULTURE_LATIN 0 + + typedef struct tagPANOSE { + BYTE bFamilyType; + BYTE bSerifStyle; + BYTE bWeight; + BYTE bProportion; + BYTE bContrast; + BYTE bStrokeVariation; + BYTE bArmStyle; + BYTE bLetterform; + BYTE bMidline; + BYTE bXHeight; + } PANOSE,*LPPANOSE; + +#define PAN_ANY 0 +#define PAN_NO_FIT 1 + +#define PAN_FAMILY_TEXT_DISPLAY 2 +#define PAN_FAMILY_SCRIPT 3 +#define PAN_FAMILY_DECORATIVE 4 +#define PAN_FAMILY_PICTORIAL 5 + +#define PAN_SERIF_COVE 2 +#define PAN_SERIF_OBTUSE_COVE 3 +#define PAN_SERIF_SQUARE_COVE 4 +#define PAN_SERIF_OBTUSE_SQUARE_COVE 5 +#define PAN_SERIF_SQUARE 6 +#define PAN_SERIF_THIN 7 +#define PAN_SERIF_BONE 8 +#define PAN_SERIF_EXAGGERATED 9 +#define PAN_SERIF_TRIANGLE 10 +#define PAN_SERIF_NORMAL_SANS 11 +#define PAN_SERIF_OBTUSE_SANS 12 +#define PAN_SERIF_PERP_SANS 13 +#define PAN_SERIF_FLARED 14 +#define PAN_SERIF_ROUNDED 15 + +#define PAN_WEIGHT_VERY_LIGHT 2 +#define PAN_WEIGHT_LIGHT 3 +#define PAN_WEIGHT_THIN 4 +#define PAN_WEIGHT_BOOK 5 +#define PAN_WEIGHT_MEDIUM 6 +#define PAN_WEIGHT_DEMI 7 +#define PAN_WEIGHT_BOLD 8 +#define PAN_WEIGHT_HEAVY 9 +#define PAN_WEIGHT_BLACK 10 +#define PAN_WEIGHT_NORD 11 + +#define PAN_PROP_OLD_STYLE 2 +#define PAN_PROP_MODERN 3 +#define PAN_PROP_EVEN_WIDTH 4 +#define PAN_PROP_EXPANDED 5 +#define PAN_PROP_CONDENSED 6 +#define PAN_PROP_VERY_EXPANDED 7 +#define PAN_PROP_VERY_CONDENSED 8 +#define PAN_PROP_MONOSPACED 9 + +#define PAN_CONTRAST_NONE 2 +#define PAN_CONTRAST_VERY_LOW 3 +#define PAN_CONTRAST_LOW 4 +#define PAN_CONTRAST_MEDIUM_LOW 5 +#define PAN_CONTRAST_MEDIUM 6 +#define PAN_CONTRAST_MEDIUM_HIGH 7 +#define PAN_CONTRAST_HIGH 8 +#define PAN_CONTRAST_VERY_HIGH 9 + +#define PAN_STROKE_GRADUAL_DIAG 2 +#define PAN_STROKE_GRADUAL_TRAN 3 +#define PAN_STROKE_GRADUAL_VERT 4 +#define PAN_STROKE_GRADUAL_HORZ 5 +#define PAN_STROKE_RAPID_VERT 6 +#define PAN_STROKE_RAPID_HORZ 7 +#define PAN_STROKE_INSTANT_VERT 8 + +#define PAN_STRAIGHT_ARMS_HORZ 2 +#define PAN_STRAIGHT_ARMS_WEDGE 3 +#define PAN_STRAIGHT_ARMS_VERT 4 +#define PAN_STRAIGHT_ARMS_SINGLE_SERIF 5 +#define PAN_STRAIGHT_ARMS_DOUBLE_SERIF 6 +#define PAN_BENT_ARMS_HORZ 7 +#define PAN_BENT_ARMS_WEDGE 8 +#define PAN_BENT_ARMS_VERT 9 +#define PAN_BENT_ARMS_SINGLE_SERIF 10 +#define PAN_BENT_ARMS_DOUBLE_SERIF 11 + +#define PAN_LETT_NORMAL_CONTACT 2 +#define PAN_LETT_NORMAL_WEIGHTED 3 +#define PAN_LETT_NORMAL_BOXED 4 +#define PAN_LETT_NORMAL_FLATTENED 5 +#define PAN_LETT_NORMAL_ROUNDED 6 +#define PAN_LETT_NORMAL_OFF_CENTER 7 +#define PAN_LETT_NORMAL_SQUARE 8 +#define PAN_LETT_OBLIQUE_CONTACT 9 +#define PAN_LETT_OBLIQUE_WEIGHTED 10 +#define PAN_LETT_OBLIQUE_BOXED 11 +#define PAN_LETT_OBLIQUE_FLATTENED 12 +#define PAN_LETT_OBLIQUE_ROUNDED 13 +#define PAN_LETT_OBLIQUE_OFF_CENTER 14 +#define PAN_LETT_OBLIQUE_SQUARE 15 + +#define PAN_MIDLINE_STANDARD_TRIMMED 2 +#define PAN_MIDLINE_STANDARD_POINTED 3 +#define PAN_MIDLINE_STANDARD_SERIFED 4 +#define PAN_MIDLINE_HIGH_TRIMMED 5 +#define PAN_MIDLINE_HIGH_POINTED 6 +#define PAN_MIDLINE_HIGH_SERIFED 7 +#define PAN_MIDLINE_CONSTANT_TRIMMED 8 +#define PAN_MIDLINE_CONSTANT_POINTED 9 +#define PAN_MIDLINE_CONSTANT_SERIFED 10 +#define PAN_MIDLINE_LOW_TRIMMED 11 +#define PAN_MIDLINE_LOW_POINTED 12 +#define PAN_MIDLINE_LOW_SERIFED 13 + +#define PAN_XHEIGHT_CONSTANT_SMALL 2 +#define PAN_XHEIGHT_CONSTANT_STD 3 +#define PAN_XHEIGHT_CONSTANT_LARGE 4 +#define PAN_XHEIGHT_DUCKING_SMALL 5 +#define PAN_XHEIGHT_DUCKING_STD 6 +#define PAN_XHEIGHT_DUCKING_LARGE 7 + +#define ELF_VENDOR_SIZE 4 + + typedef struct tagEXTLOGFONTA { + LOGFONTA elfLogFont; + BYTE elfFullName[LF_FULLFACESIZE]; + BYTE elfStyle[LF_FACESIZE]; + DWORD elfVersion; + DWORD elfStyleSize; + DWORD elfMatch; + DWORD elfReserved; + BYTE elfVendorId[ELF_VENDOR_SIZE]; + DWORD elfCulture; + PANOSE elfPanose; + } EXTLOGFONTA,*PEXTLOGFONTA,*NPEXTLOGFONTA,*LPEXTLOGFONTA; + + typedef struct tagEXTLOGFONTW { + LOGFONTW elfLogFont; + WCHAR elfFullName[LF_FULLFACESIZE]; + WCHAR elfStyle[LF_FACESIZE]; + DWORD elfVersion; + DWORD elfStyleSize; + DWORD elfMatch; + DWORD elfReserved; + BYTE elfVendorId[ELF_VENDOR_SIZE]; + DWORD elfCulture; + PANOSE elfPanose; + } EXTLOGFONTW,*PEXTLOGFONTW,*NPEXTLOGFONTW,*LPEXTLOGFONTW; +#ifdef UNICODE + typedef EXTLOGFONTW EXTLOGFONT; + typedef PEXTLOGFONTW PEXTLOGFONT; + typedef NPEXTLOGFONTW NPEXTLOGFONT; + typedef LPEXTLOGFONTW LPEXTLOGFONT; +#else + typedef EXTLOGFONTA EXTLOGFONT; + typedef PEXTLOGFONTA PEXTLOGFONT; + typedef NPEXTLOGFONTA NPEXTLOGFONT; + typedef LPEXTLOGFONTA LPEXTLOGFONT; +#endif + +#define ELF_VERSION 0 +#define ELF_CULTURE_LATIN 0 + +#define RASTER_FONTTYPE 0x0001 +#define DEVICE_FONTTYPE 0x002 +#define TRUETYPE_FONTTYPE 0x004 + +#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) +#define PALETTERGB(r,g,b) (0x02000000 | RGB(r,g,b)) +#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) + +#define PC_RESERVED 0x01 +#define PC_EXPLICIT 0x02 +#define PC_NOCOLLAPSE 0x04 + +#define GetRValue(rgb) (LOBYTE(rgb)) +#define GetGValue(rgb) (LOBYTE(((WORD)(rgb)) >> 8)) +#define GetBValue(rgb) (LOBYTE((rgb)>>16)) + +#define TRANSPARENT 1 +#define OPAQUE 2 +#define BKMODE_LAST 2 + +#define GM_COMPATIBLE 1 +#define GM_ADVANCED 2 +#define GM_LAST 2 + +#define PT_CLOSEFIGURE 0x01 +#define PT_LINETO 0x02 +#define PT_BEZIERTO 0x04 +#define PT_MOVETO 0x06 + +#define MM_TEXT 1 +#define MM_LOMETRIC 2 +#define MM_HIMETRIC 3 +#define MM_LOENGLISH 4 +#define MM_HIENGLISH 5 +#define MM_TWIPS 6 +#define MM_ISOTROPIC 7 +#define MM_ANISOTROPIC 8 + +#define MM_MIN MM_TEXT +#define MM_MAX MM_ANISOTROPIC +#define MM_MAX_FIXEDSCALE MM_TWIPS + +#define ABSOLUTE 1 +#define RELATIVE 2 + +#define WHITE_BRUSH 0 +#define LTGRAY_BRUSH 1 +#define GRAY_BRUSH 2 +#define DKGRAY_BRUSH 3 +#define BLACK_BRUSH 4 +#define NULL_BRUSH 5 +#define HOLLOW_BRUSH NULL_BRUSH +#define WHITE_PEN 6 +#define BLACK_PEN 7 +#define NULL_PEN 8 +#define OEM_FIXED_FONT 10 +#define ANSI_FIXED_FONT 11 +#define ANSI_VAR_FONT 12 +#define SYSTEM_FONT 13 +#define DEVICE_DEFAULT_FONT 14 +#define DEFAULT_PALETTE 15 +#define SYSTEM_FIXED_FONT 16 + +#define DEFAULT_GUI_FONT 17 + +#define DC_BRUSH 18 +#define DC_PEN 19 + +#define STOCK_LAST 19 + +#define CLR_INVALID 0xFFFFFFFF + +#define BS_SOLID 0 +#define BS_NULL 1 +#define BS_HOLLOW BS_NULL +#define BS_HATCHED 2 +#define BS_PATTERN 3 +#define BS_INDEXED 4 +#define BS_DIBPATTERN 5 +#define BS_DIBPATTERNPT 6 +#define BS_PATTERN8X8 7 +#define BS_DIBPATTERN8X8 8 +#define BS_MONOPATTERN 9 + +#define HS_HORIZONTAL 0 +#define HS_VERTICAL 1 +#define HS_FDIAGONAL 2 +#define HS_BDIAGONAL 3 +#define HS_CROSS 4 +#define HS_DIAGCROSS 5 + +#define PS_SOLID 0 +#define PS_DASH 1 +#define PS_DOT 2 +#define PS_DASHDOT 3 +#define PS_DASHDOTDOT 4 +#define PS_NULL 5 +#define PS_INSIDEFRAME 6 +#define PS_USERSTYLE 7 +#define PS_ALTERNATE 8 +#define PS_STYLE_MASK 0x0000000F + +#define PS_ENDCAP_ROUND 0x00000000 +#define PS_ENDCAP_SQUARE 0x00000100 +#define PS_ENDCAP_FLAT 0x00000200 +#define PS_ENDCAP_MASK 0x00000F00 + +#define PS_JOIN_ROUND 0x00000000 +#define PS_JOIN_BEVEL 0x00001000 +#define PS_JOIN_MITER 0x00002000 +#define PS_JOIN_MASK 0x0000F000 + +#define PS_COSMETIC 0x00000000 +#define PS_GEOMETRIC 0x00010000 +#define PS_TYPE_MASK 0x000F0000 + +#define AD_COUNTERCLOCKWISE 1 +#define AD_CLOCKWISE 2 + +#define DRIVERVERSION 0 +#define TECHNOLOGY 2 +#define HORZSIZE 4 +#define VERTSIZE 6 +#define HORZRES 8 +#define VERTRES 10 +#define BITSPIXEL 12 +#define PLANES 14 +#define NUMBRUSHES 16 +#define NUMPENS 18 +#define NUMMARKERS 20 +#define NUMFONTS 22 +#define NUMCOLORS 24 +#define PDEVICESIZE 26 +#define CURVECAPS 28 +#define LINECAPS 30 +#define POLYGONALCAPS 32 +#define TEXTCAPS 34 +#define CLIPCAPS 36 +#define RASTERCAPS 38 +#define ASPECTX 40 +#define ASPECTY 42 +#define ASPECTXY 44 + +#define LOGPIXELSX 88 +#define LOGPIXELSY 90 + +#define SIZEPALETTE 104 +#define NUMRESERVED 106 +#define COLORRES 108 + +#define PHYSICALWIDTH 110 +#define PHYSICALHEIGHT 111 +#define PHYSICALOFFSETX 112 +#define PHYSICALOFFSETY 113 +#define SCALINGFACTORX 114 +#define SCALINGFACTORY 115 + +#define VREFRESH 116 + +#define DESKTOPVERTRES 117 + +#define DESKTOPHORZRES 118 + +#define BLTALIGNMENT 119 + +#define SHADEBLENDCAPS 120 +#define COLORMGMTCAPS 121 + +#ifndef NOGDICAPMASKS +#define DT_PLOTTER 0 +#define DT_RASDISPLAY 1 +#define DT_RASPRINTER 2 +#define DT_RASCAMERA 3 +#define DT_CHARSTREAM 4 +#define DT_METAFILE 5 +#define DT_DISPFILE 6 + +#define CC_NONE 0 +#define CC_CIRCLES 1 +#define CC_PIE 2 +#define CC_CHORD 4 +#define CC_ELLIPSES 8 +#define CC_WIDE 16 +#define CC_STYLED 32 +#define CC_WIDESTYLED 64 +#define CC_INTERIORS 128 +#define CC_ROUNDRECT 256 + +#define LC_NONE 0 +#define LC_POLYLINE 2 +#define LC_MARKER 4 +#define LC_POLYMARKER 8 +#define LC_WIDE 16 +#define LC_STYLED 32 +#define LC_WIDESTYLED 64 +#define LC_INTERIORS 128 + +#define PC_NONE 0 +#define PC_POLYGON 1 +#define PC_RECTANGLE 2 +#define PC_WINDPOLYGON 4 +#define PC_TRAPEZOID 4 +#define PC_SCANLINE 8 +#define PC_WIDE 16 +#define PC_STYLED 32 +#define PC_WIDESTYLED 64 +#define PC_INTERIORS 128 +#define PC_POLYPOLYGON 256 +#define PC_PATHS 512 + +#define CP_NONE 0 +#define CP_RECTANGLE 1 +#define CP_REGION 2 + +#define TC_OP_CHARACTER 0x00000001 +#define TC_OP_STROKE 0x00000002 +#define TC_CP_STROKE 0x00000004 +#define TC_CR_90 0x00000008 +#define TC_CR_ANY 0x00000010 +#define TC_SF_X_YINDEP 0x00000020 +#define TC_SA_DOUBLE 0x00000040 +#define TC_SA_INTEGER 0x00000080 +#define TC_SA_CONTIN 0x00000100 +#define TC_EA_DOUBLE 0x00000200 +#define TC_IA_ABLE 0x00000400 +#define TC_UA_ABLE 0x00000800 +#define TC_SO_ABLE 0x00001000 +#define TC_RA_ABLE 0x00002000 +#define TC_VA_ABLE 0x00004000 +#define TC_RESERVED 0x00008000 +#define TC_SCROLLBLT 0x00010000 +#endif + +#define RC_NONE +#define RC_BITBLT 1 +#define RC_BANDING 2 +#define RC_SCALING 4 +#define RC_BITMAP64 8 +#define RC_GDI20_OUTPUT 0x0010 +#define RC_GDI20_STATE 0x0020 +#define RC_SAVEBITMAP 0x0040 +#define RC_DI_BITMAP 0x0080 +#define RC_PALETTE 0x0100 +#define RC_DIBTODEV 0x0200 +#define RC_BIGFONT 0x0400 +#define RC_STRETCHBLT 0x0800 +#define RC_FLOODFILL 0x1000 +#define RC_STRETCHDIB 0x2000 +#define RC_OP_DX_OUTPUT 0x4000 +#define RC_DEVBITS 0x8000 + +#define SB_NONE 0x00000000 +#define SB_CONST_ALPHA 0x00000001 +#define SB_PIXEL_ALPHA 0x00000002 +#define SB_PREMULT_ALPHA 0x00000004 + +#define SB_GRAD_RECT 0x00000010 +#define SB_GRAD_TRI 0x00000020 + +#define CM_NONE 0x00000000 +#define CM_DEVICE_ICM 0x00000001 +#define CM_GAMMA_RAMP 0x00000002 +#define CM_CMYK_COLOR 0x00000004 + +#define DIB_RGB_COLORS 0 +#define DIB_PAL_COLORS 1 + +#define SYSPAL_ERROR 0 +#define SYSPAL_STATIC 1 +#define SYSPAL_NOSTATIC 2 +#define SYSPAL_NOSTATIC256 3 + +#define CBM_INIT 0x04L + +#define FLOODFILLBORDER 0 +#define FLOODFILLSURFACE 1 + +#define CCHDEVICENAME 32 + +#define CCHFORMNAME 32 + + typedef struct _devicemodeA { + BYTE dmDeviceName[CCHDEVICENAME]; + WORD dmSpecVersion; + WORD dmDriverVersion; + WORD dmSize; + WORD dmDriverExtra; + DWORD dmFields; + union { + struct { + short dmOrientation; + short dmPaperSize; + short dmPaperLength; + short dmPaperWidth; + short dmScale; + short dmCopies; + short dmDefaultSource; + short dmPrintQuality; + }; + struct { + POINTL dmPosition; + DWORD dmDisplayOrientation; + DWORD dmDisplayFixedOutput; + }; + }; + short dmColor; + short dmDuplex; + short dmYResolution; + short dmTTOption; + short dmCollate; + BYTE dmFormName[CCHFORMNAME]; + WORD dmLogPixels; + DWORD dmBitsPerPel; + DWORD dmPelsWidth; + DWORD dmPelsHeight; + union { + DWORD dmDisplayFlags; + DWORD dmNup; + }; + DWORD dmDisplayFrequency; + DWORD dmICMMethod; + DWORD dmICMIntent; + DWORD dmMediaType; + DWORD dmDitherType; + DWORD dmReserved1; + DWORD dmReserved2; + DWORD dmPanningWidth; + DWORD dmPanningHeight; + } DEVMODEA,*PDEVMODEA,*NPDEVMODEA,*LPDEVMODEA; + + typedef struct _devicemodeW { + WCHAR dmDeviceName[CCHDEVICENAME]; + WORD dmSpecVersion; + WORD dmDriverVersion; + WORD dmSize; + WORD dmDriverExtra; + DWORD dmFields; + union { + struct { + short dmOrientation; + short dmPaperSize; + short dmPaperLength; + short dmPaperWidth; + short dmScale; + short dmCopies; + short dmDefaultSource; + short dmPrintQuality; + }; + struct { + POINTL dmPosition; + DWORD dmDisplayOrientation; + DWORD dmDisplayFixedOutput; + }; + }; + short dmColor; + short dmDuplex; + short dmYResolution; + short dmTTOption; + short dmCollate; + WCHAR dmFormName[CCHFORMNAME]; + WORD dmLogPixels; + DWORD dmBitsPerPel; + DWORD dmPelsWidth; + DWORD dmPelsHeight; + union { + DWORD dmDisplayFlags; + DWORD dmNup; + }; + DWORD dmDisplayFrequency; + DWORD dmICMMethod; + DWORD dmICMIntent; + DWORD dmMediaType; + DWORD dmDitherType; + DWORD dmReserved1; + DWORD dmReserved2; + DWORD dmPanningWidth; + DWORD dmPanningHeight; + } DEVMODEW,*PDEVMODEW,*NPDEVMODEW,*LPDEVMODEW; +#ifdef UNICODE + typedef DEVMODEW DEVMODE; + typedef PDEVMODEW PDEVMODE; + typedef NPDEVMODEW NPDEVMODE; + typedef LPDEVMODEW LPDEVMODE; +#else + typedef DEVMODEA DEVMODE; + typedef PDEVMODEA PDEVMODE; + typedef NPDEVMODEA NPDEVMODE; + typedef LPDEVMODEA LPDEVMODE; +#endif + +#define DM_SPECVERSION 0x0401 + +#define DM_ORIENTATION 0x00000001L +#define DM_PAPERSIZE 0x00000002L +#define DM_PAPERLENGTH 0x00000004L +#define DM_PAPERWIDTH 0x00000008L +#define DM_SCALE 0x00000010L +#define DM_POSITION 0x00000020L +#define DM_NUP 0x00000040L +#define DM_DISPLAYORIENTATION 0x00000080L +#define DM_COPIES 0x00000100L +#define DM_DEFAULTSOURCE 0x00000200L +#define DM_PRINTQUALITY 0x00000400L +#define DM_COLOR 0x00000800L +#define DM_DUPLEX 0x00001000L +#define DM_YRESOLUTION 0x00002000L +#define DM_TTOPTION 0x00004000L +#define DM_COLLATE 0x00008000L +#define DM_FORMNAME 0x00010000L +#define DM_LOGPIXELS 0x00020000L +#define DM_BITSPERPEL 0x00040000L +#define DM_PELSWIDTH 0x00080000L +#define DM_PELSHEIGHT 0x00100000L +#define DM_DISPLAYFLAGS 0x00200000L +#define DM_DISPLAYFREQUENCY 0x00400000L +#define DM_ICMMETHOD 0x00800000L +#define DM_ICMINTENT 0x01000000L +#define DM_MEDIATYPE 0x02000000L +#define DM_DITHERTYPE 0x04000000L +#define DM_PANNINGWIDTH 0x08000000L +#define DM_PANNINGHEIGHT 0x10000000L +#define DM_DISPLAYFIXEDOUTPUT 0x20000000L + +#define DMORIENT_PORTRAIT 1 +#define DMORIENT_LANDSCAPE 2 + +#define DMPAPER_FIRST DMPAPER_LETTER +#define DMPAPER_LETTER 1 +#define DMPAPER_LETTERSMALL 2 +#define DMPAPER_TABLOID 3 +#define DMPAPER_LEDGER 4 +#define DMPAPER_LEGAL 5 +#define DMPAPER_STATEMENT 6 +#define DMPAPER_EXECUTIVE 7 +#define DMPAPER_A3 8 +#define DMPAPER_A4 9 +#define DMPAPER_A4SMALL 10 +#define DMPAPER_A5 11 +#define DMPAPER_B4 12 +#define DMPAPER_B5 13 +#define DMPAPER_FOLIO 14 +#define DMPAPER_QUARTO 15 +#define DMPAPER_10X14 16 +#define DMPAPER_11X17 17 +#define DMPAPER_NOTE 18 +#define DMPAPER_ENV_9 19 +#define DMPAPER_ENV_10 20 +#define DMPAPER_ENV_11 21 +#define DMPAPER_ENV_12 22 +#define DMPAPER_ENV_14 23 +#define DMPAPER_CSHEET 24 +#define DMPAPER_DSHEET 25 +#define DMPAPER_ESHEET 26 +#define DMPAPER_ENV_DL 27 +#define DMPAPER_ENV_C5 28 +#define DMPAPER_ENV_C3 29 +#define DMPAPER_ENV_C4 30 +#define DMPAPER_ENV_C6 31 +#define DMPAPER_ENV_C65 32 +#define DMPAPER_ENV_B4 33 +#define DMPAPER_ENV_B5 34 +#define DMPAPER_ENV_B6 35 +#define DMPAPER_ENV_ITALY 36 +#define DMPAPER_ENV_MONARCH 37 +#define DMPAPER_ENV_PERSONAL 38 +#define DMPAPER_FANFOLD_US 39 +#define DMPAPER_FANFOLD_STD_GERMAN 40 +#define DMPAPER_FANFOLD_LGL_GERMAN 41 +#define DMPAPER_ISO_B4 42 +#define DMPAPER_JAPANESE_POSTCARD 43 +#define DMPAPER_9X11 44 +#define DMPAPER_10X11 45 +#define DMPAPER_15X11 46 +#define DMPAPER_ENV_INVITE 47 +#define DMPAPER_RESERVED_48 48 +#define DMPAPER_RESERVED_49 49 +#define DMPAPER_LETTER_EXTRA 50 +#define DMPAPER_LEGAL_EXTRA 51 +#define DMPAPER_TABLOID_EXTRA 52 +#define DMPAPER_A4_EXTRA 53 +#define DMPAPER_LETTER_TRANSVERSE 54 +#define DMPAPER_A4_TRANSVERSE 55 +#define DMPAPER_LETTER_EXTRA_TRANSVERSE 56 +#define DMPAPER_A_PLUS 57 +#define DMPAPER_B_PLUS 58 +#define DMPAPER_LETTER_PLUS 59 +#define DMPAPER_A4_PLUS 60 +#define DMPAPER_A5_TRANSVERSE 61 +#define DMPAPER_B5_TRANSVERSE 62 +#define DMPAPER_A3_EXTRA 63 +#define DMPAPER_A5_EXTRA 64 +#define DMPAPER_B5_EXTRA 65 +#define DMPAPER_A2 66 +#define DMPAPER_A3_TRANSVERSE 67 +#define DMPAPER_A3_EXTRA_TRANSVERSE 68 +#define DMPAPER_DBL_JAPANESE_POSTCARD 69 +#define DMPAPER_A6 70 +#define DMPAPER_JENV_KAKU2 71 +#define DMPAPER_JENV_KAKU3 72 +#define DMPAPER_JENV_CHOU3 73 +#define DMPAPER_JENV_CHOU4 74 +#define DMPAPER_LETTER_ROTATED 75 +#define DMPAPER_A3_ROTATED 76 +#define DMPAPER_A4_ROTATED 77 +#define DMPAPER_A5_ROTATED 78 +#define DMPAPER_B4_JIS_ROTATED 79 +#define DMPAPER_B5_JIS_ROTATED 80 +#define DMPAPER_JAPANESE_POSTCARD_ROTATED 81 +#define DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED 82 +#define DMPAPER_A6_ROTATED 83 +#define DMPAPER_JENV_KAKU2_ROTATED 84 +#define DMPAPER_JENV_KAKU3_ROTATED 85 +#define DMPAPER_JENV_CHOU3_ROTATED 86 +#define DMPAPER_JENV_CHOU4_ROTATED 87 +#define DMPAPER_B6_JIS 88 +#define DMPAPER_B6_JIS_ROTATED 89 +#define DMPAPER_12X11 90 +#define DMPAPER_JENV_YOU4 91 +#define DMPAPER_JENV_YOU4_ROTATED 92 +#define DMPAPER_P16K 93 +#define DMPAPER_P32K 94 +#define DMPAPER_P32KBIG 95 +#define DMPAPER_PENV_1 96 +#define DMPAPER_PENV_2 97 +#define DMPAPER_PENV_3 98 +#define DMPAPER_PENV_4 99 +#define DMPAPER_PENV_5 100 +#define DMPAPER_PENV_6 101 +#define DMPAPER_PENV_7 102 +#define DMPAPER_PENV_8 103 +#define DMPAPER_PENV_9 104 +#define DMPAPER_PENV_10 105 +#define DMPAPER_P16K_ROTATED 106 +#define DMPAPER_P32K_ROTATED 107 +#define DMPAPER_P32KBIG_ROTATED 108 +#define DMPAPER_PENV_1_ROTATED 109 +#define DMPAPER_PENV_2_ROTATED 110 +#define DMPAPER_PENV_3_ROTATED 111 +#define DMPAPER_PENV_4_ROTATED 112 +#define DMPAPER_PENV_5_ROTATED 113 +#define DMPAPER_PENV_6_ROTATED 114 +#define DMPAPER_PENV_7_ROTATED 115 +#define DMPAPER_PENV_8_ROTATED 116 +#define DMPAPER_PENV_9_ROTATED 117 +#define DMPAPER_PENV_10_ROTATED 118 + +#define DMPAPER_LAST DMPAPER_PENV_10_ROTATED + +#define DMPAPER_USER 256 + +#define DMBIN_FIRST DMBIN_UPPER +#define DMBIN_UPPER 1 +#define DMBIN_ONLYONE 1 +#define DMBIN_LOWER 2 +#define DMBIN_MIDDLE 3 +#define DMBIN_MANUAL 4 +#define DMBIN_ENVELOPE 5 +#define DMBIN_ENVMANUAL 6 +#define DMBIN_AUTO 7 +#define DMBIN_TRACTOR 8 +#define DMBIN_SMALLFMT 9 +#define DMBIN_LARGEFMT 10 +#define DMBIN_LARGECAPACITY 11 +#define DMBIN_CASSETTE 14 +#define DMBIN_FORMSOURCE 15 +#define DMBIN_LAST DMBIN_FORMSOURCE + +#define DMBIN_USER 256 + +#define DMRES_DRAFT (-1) +#define DMRES_LOW (-2) +#define DMRES_MEDIUM (-3) +#define DMRES_HIGH (-4) + +#define DMCOLOR_MONOCHROME 1 +#define DMCOLOR_COLOR 2 + +#define DMDUP_SIMPLEX 1 +#define DMDUP_VERTICAL 2 +#define DMDUP_HORIZONTAL 3 + +#define DMTT_BITMAP 1 +#define DMTT_DOWNLOAD 2 +#define DMTT_SUBDEV 3 +#define DMTT_DOWNLOAD_OUTLINE 4 + +#define DMCOLLATE_FALSE 0 +#define DMCOLLATE_TRUE 1 + +#define DMDO_DEFAULT 0 +#define DMDO_90 1 +#define DMDO_180 2 +#define DMDO_270 3 + +#define DMDFO_DEFAULT 0 +#define DMDFO_STRETCH 1 +#define DMDFO_CENTER 2 + +#define DMDISPLAYFLAGS_TEXTMODE 0x00000004 + +#define DMNUP_SYSTEM 1 +#define DMNUP_ONEUP 2 + +#define DMICMMETHOD_NONE 1 +#define DMICMMETHOD_SYSTEM 2 +#define DMICMMETHOD_DRIVER 3 +#define DMICMMETHOD_DEVICE 4 + +#define DMICMMETHOD_USER 256 + +#define DMICM_SATURATE 1 +#define DMICM_CONTRAST 2 +#define DMICM_COLORIMETRIC 3 +#define DMICM_ABS_COLORIMETRIC 4 + +#define DMICM_USER 256 + +#define DMMEDIA_STANDARD 1 +#define DMMEDIA_TRANSPARENCY 2 +#define DMMEDIA_GLOSSY 3 + +#define DMMEDIA_USER 256 + +#define DMDITHER_NONE 1 +#define DMDITHER_COARSE 2 +#define DMDITHER_FINE 3 +#define DMDITHER_LINEART 4 +#define DMDITHER_ERRORDIFFUSION 5 +#define DMDITHER_RESERVED6 6 +#define DMDITHER_RESERVED7 7 +#define DMDITHER_RESERVED8 8 +#define DMDITHER_RESERVED9 9 +#define DMDITHER_GRAYSCALE 10 + +#define DMDITHER_USER 256 + + typedef struct _DISPLAY_DEVICEA { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD StateFlags; + CHAR DeviceID[128]; + CHAR DeviceKey[128]; + } DISPLAY_DEVICEA,*PDISPLAY_DEVICEA,*LPDISPLAY_DEVICEA; + typedef struct _DISPLAY_DEVICEW { + DWORD cb; + WCHAR DeviceName[32]; + WCHAR DeviceString[128]; + DWORD StateFlags; + WCHAR DeviceID[128]; + WCHAR DeviceKey[128]; + } DISPLAY_DEVICEW,*PDISPLAY_DEVICEW,*LPDISPLAY_DEVICEW; +#ifdef UNICODE + typedef DISPLAY_DEVICEW DISPLAY_DEVICE; + typedef PDISPLAY_DEVICEW PDISPLAY_DEVICE; + typedef LPDISPLAY_DEVICEW LPDISPLAY_DEVICE; +#else + typedef DISPLAY_DEVICEA DISPLAY_DEVICE; + typedef PDISPLAY_DEVICEA PDISPLAY_DEVICE; + typedef LPDISPLAY_DEVICEA LPDISPLAY_DEVICE; +#endif + +#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP 0x00000001 +#define DISPLAY_DEVICE_MULTI_DRIVER 0x00000002 +#define DISPLAY_DEVICE_PRIMARY_DEVICE 0x00000004 +#define DISPLAY_DEVICE_MIRRORING_DRIVER 0x00000008 +#define DISPLAY_DEVICE_VGA_COMPATIBLE 0x00000010 +#define DISPLAY_DEVICE_REMOVABLE 0x00000020 +#define DISPLAY_DEVICE_MODESPRUNED 0x08000000 +#define DISPLAY_DEVICE_REMOTE 0x04000000 +#define DISPLAY_DEVICE_DISCONNECT 0x02000000 + +#define DISPLAY_DEVICE_ACTIVE 0x00000001 +#define DISPLAY_DEVICE_ATTACHED 0x00000002 + +#define RDH_RECTANGLES 1 + + typedef struct _RGNDATAHEADER { + DWORD dwSize; + DWORD iType; + DWORD nCount; + DWORD nRgnSize; + RECT rcBound; + } RGNDATAHEADER,*PRGNDATAHEADER; + + typedef struct _RGNDATA { + RGNDATAHEADER rdh; + char Buffer[1]; + } RGNDATA,*PRGNDATA,*NPRGNDATA,*LPRGNDATA; + +#define SYSRGN 4 + + typedef struct _ABC { + int abcA; + UINT abcB; + int abcC; + } ABC,*PABC,*NPABC,*LPABC; + + typedef struct _ABCFLOAT { + FLOAT abcfA; + FLOAT abcfB; + FLOAT abcfC; + } ABCFLOAT,*PABCFLOAT,*NPABCFLOAT,*LPABCFLOAT; + +#ifndef NOTEXTMETRIC + + typedef struct _OUTLINETEXTMETRICA { + UINT otmSize; + TEXTMETRICA otmTextMetrics; + BYTE otmFiller; + PANOSE otmPanoseNumber; + UINT otmfsSelection; + UINT otmfsType; + int otmsCharSlopeRise; + int otmsCharSlopeRun; + int otmItalicAngle; + UINT otmEMSquare; + int otmAscent; + int otmDescent; + UINT otmLineGap; + UINT otmsCapEmHeight; + UINT otmsXHeight; + RECT otmrcFontBox; + int otmMacAscent; + int otmMacDescent; + UINT otmMacLineGap; + UINT otmusMinimumPPEM; + POINT otmptSubscriptSize; + POINT otmptSubscriptOffset; + POINT otmptSuperscriptSize; + POINT otmptSuperscriptOffset; + UINT otmsStrikeoutSize; + int otmsStrikeoutPosition; + int otmsUnderscoreSize; + int otmsUnderscorePosition; + PSTR otmpFamilyName; + PSTR otmpFaceName; + PSTR otmpStyleName; + PSTR otmpFullName; + } OUTLINETEXTMETRICA,*POUTLINETEXTMETRICA,*NPOUTLINETEXTMETRICA,*LPOUTLINETEXTMETRICA; + + typedef struct _OUTLINETEXTMETRICW { + UINT otmSize; + TEXTMETRICW otmTextMetrics; + BYTE otmFiller; + PANOSE otmPanoseNumber; + UINT otmfsSelection; + UINT otmfsType; + int otmsCharSlopeRise; + int otmsCharSlopeRun; + int otmItalicAngle; + UINT otmEMSquare; + int otmAscent; + int otmDescent; + UINT otmLineGap; + UINT otmsCapEmHeight; + UINT otmsXHeight; + RECT otmrcFontBox; + int otmMacAscent; + int otmMacDescent; + UINT otmMacLineGap; + UINT otmusMinimumPPEM; + POINT otmptSubscriptSize; + POINT otmptSubscriptOffset; + POINT otmptSuperscriptSize; + POINT otmptSuperscriptOffset; + UINT otmsStrikeoutSize; + int otmsStrikeoutPosition; + int otmsUnderscoreSize; + int otmsUnderscorePosition; + PSTR otmpFamilyName; + PSTR otmpFaceName; + PSTR otmpStyleName; + PSTR otmpFullName; + } OUTLINETEXTMETRICW,*POUTLINETEXTMETRICW,*NPOUTLINETEXTMETRICW,*LPOUTLINETEXTMETRICW; +#ifdef UNICODE + typedef OUTLINETEXTMETRICW OUTLINETEXTMETRIC; + typedef POUTLINETEXTMETRICW POUTLINETEXTMETRIC; + typedef NPOUTLINETEXTMETRICW NPOUTLINETEXTMETRIC; + typedef LPOUTLINETEXTMETRICW LPOUTLINETEXTMETRIC; +#else + typedef OUTLINETEXTMETRICA OUTLINETEXTMETRIC; + typedef POUTLINETEXTMETRICA POUTLINETEXTMETRIC; + typedef NPOUTLINETEXTMETRICA NPOUTLINETEXTMETRIC; + typedef LPOUTLINETEXTMETRICA LPOUTLINETEXTMETRIC; +#endif +#endif + + typedef struct tagPOLYTEXTA { + int x; + int y; + UINT n; + LPCSTR lpstr; + UINT uiFlags; + RECT rcl; + int *pdx; + } POLYTEXTA,*PPOLYTEXTA,*NPPOLYTEXTA,*LPPOLYTEXTA; + + typedef struct tagPOLYTEXTW { + int x; + int y; + UINT n; + LPCWSTR lpstr; + UINT uiFlags; + RECT rcl; + int *pdx; + } POLYTEXTW,*PPOLYTEXTW,*NPPOLYTEXTW,*LPPOLYTEXTW; +#ifdef UNICODE + typedef POLYTEXTW POLYTEXT; + typedef PPOLYTEXTW PPOLYTEXT; + typedef NPPOLYTEXTW NPPOLYTEXT; + typedef LPPOLYTEXTW LPPOLYTEXT; +#else + typedef POLYTEXTA POLYTEXT; + typedef PPOLYTEXTA PPOLYTEXT; + typedef NPPOLYTEXTA NPPOLYTEXT; + typedef LPPOLYTEXTA LPPOLYTEXT; +#endif + + typedef struct _FIXED { + WORD fract; + short value; + } FIXED; + + typedef struct _MAT2 { + FIXED eM11; + FIXED eM12; + FIXED eM21; + FIXED eM22; + } MAT2,*LPMAT2; + + typedef struct _GLYPHMETRICS { + UINT gmBlackBoxX; + UINT gmBlackBoxY; + POINT gmptGlyphOrigin; + short gmCellIncX; + short gmCellIncY; + } GLYPHMETRICS,*LPGLYPHMETRICS; + +#define GGO_METRICS 0 +#define GGO_BITMAP 1 +#define GGO_NATIVE 2 +#define GGO_BEZIER 3 + +#define GGO_GRAY2_BITMAP 4 +#define GGO_GRAY4_BITMAP 5 +#define GGO_GRAY8_BITMAP 6 +#define GGO_GLYPH_INDEX 0x0080 +#define GGO_UNHINTED 0x0100 + +#define TT_POLYGON_TYPE 24 + +#define TT_PRIM_LINE 1 +#define TT_PRIM_QSPLINE 2 +#define TT_PRIM_CSPLINE 3 + + typedef struct tagPOINTFX { + FIXED x; + FIXED y; + } POINTFX,*LPPOINTFX; + + typedef struct tagTTPOLYCURVE { + WORD wType; + WORD cpfx; + POINTFX apfx[1]; + } TTPOLYCURVE,*LPTTPOLYCURVE; + + typedef struct tagTTPOLYGONHEADER { + DWORD cb; + DWORD dwType; + POINTFX pfxStart; + } TTPOLYGONHEADER,*LPTTPOLYGONHEADER; + +#define GCP_DBCS 0x0001 +#define GCP_REORDER 0x0002 +#define GCP_USEKERNING 0x0008 +#define GCP_GLYPHSHAPE 0x0010 +#define GCP_LIGATE 0x0020 + +#define GCP_DIACRITIC 0x0100 +#define GCP_KASHIDA 0x0400 +#define GCP_ERROR 0x8000 +#define FLI_MASK 0x103B + +#define GCP_JUSTIFY 0x00010000L + +#define FLI_GLYPHS 0x00040000L +#define GCP_CLASSIN 0x00080000L +#define GCP_MAXEXTENT 0x00100000L +#define GCP_JUSTIFYIN 0x00200000L +#define GCP_DISPLAYZWG 0x00400000L +#define GCP_SYMSWAPOFF 0x00800000L +#define GCP_NUMERICOVERRIDE 0x01000000L +#define GCP_NEUTRALOVERRIDE 0x02000000L +#define GCP_NUMERICSLATIN 0x04000000L +#define GCP_NUMERICSLOCAL 0x08000000L + +#define GCPCLASS_LATIN 1 +#define GCPCLASS_HEBREW 2 +#define GCPCLASS_ARABIC 2 +#define GCPCLASS_NEUTRAL 3 +#define GCPCLASS_LOCALNUMBER 4 +#define GCPCLASS_LATINNUMBER 5 +#define GCPCLASS_LATINNUMERICTERMINATOR 6 +#define GCPCLASS_LATINNUMERICSEPARATOR 7 +#define GCPCLASS_NUMERICSEPARATOR 8 +#define GCPCLASS_PREBOUNDLTR 0x80 +#define GCPCLASS_PREBOUNDRTL 0x40 +#define GCPCLASS_POSTBOUNDLTR 0x20 +#define GCPCLASS_POSTBOUNDRTL 0x10 + +#define GCPGLYPH_LINKBEFORE 0x8000 +#define GCPGLYPH_LINKAFTER 0x4000 + + typedef struct tagGCP_RESULTSA { + DWORD lStructSize; + LPSTR lpOutString; + UINT *lpOrder; + int *lpDx; + int *lpCaretPos; + LPSTR lpClass; + LPWSTR lpGlyphs; + UINT nGlyphs; + int nMaxFit; + } GCP_RESULTSA,*LPGCP_RESULTSA; + typedef struct tagGCP_RESULTSW { + DWORD lStructSize; + LPWSTR lpOutString; + UINT *lpOrder; + int *lpDx; + int *lpCaretPos; + LPSTR lpClass; + LPWSTR lpGlyphs; + UINT nGlyphs; + int nMaxFit; + } GCP_RESULTSW,*LPGCP_RESULTSW; +#ifdef UNICODE + typedef GCP_RESULTSW GCP_RESULTS; + typedef LPGCP_RESULTSW LPGCP_RESULTS; +#else + typedef GCP_RESULTSA GCP_RESULTS; + typedef LPGCP_RESULTSA LPGCP_RESULTS; +#endif + + typedef struct _RASTERIZER_STATUS { + short nSize; + short wFlags; + short nLanguageID; + } RASTERIZER_STATUS,*LPRASTERIZER_STATUS; + +#define TT_AVAILABLE 0x0001 +#define TT_ENABLED 0x0002 + + typedef struct tagPIXELFORMATDESCRIPTOR { + WORD nSize; + WORD nVersion; + DWORD dwFlags; + BYTE iPixelType; + BYTE cColorBits; + BYTE cRedBits; + BYTE cRedShift; + BYTE cGreenBits; + BYTE cGreenShift; + BYTE cBlueBits; + BYTE cBlueShift; + BYTE cAlphaBits; + BYTE cAlphaShift; + BYTE cAccumBits; + BYTE cAccumRedBits; + BYTE cAccumGreenBits; + BYTE cAccumBlueBits; + BYTE cAccumAlphaBits; + BYTE cDepthBits; + BYTE cStencilBits; + BYTE cAuxBuffers; + BYTE iLayerType; + BYTE bReserved; + DWORD dwLayerMask; + DWORD dwVisibleMask; + DWORD dwDamageMask; + } PIXELFORMATDESCRIPTOR,*PPIXELFORMATDESCRIPTOR,*LPPIXELFORMATDESCRIPTOR; + +#define PFD_TYPE_RGBA 0 +#define PFD_TYPE_COLORINDEX 1 + +#define PFD_MAIN_PLANE 0 +#define PFD_OVERLAY_PLANE 1 +#define PFD_UNDERLAY_PLANE (-1) + +#define PFD_DOUBLEBUFFER 0x00000001 +#define PFD_STEREO 0x00000002 +#define PFD_DRAW_TO_WINDOW 0x00000004 +#define PFD_DRAW_TO_BITMAP 0x00000008 +#define PFD_SUPPORT_GDI 0x00000010 +#define PFD_SUPPORT_OPENGL 0x00000020 +#define PFD_GENERIC_FORMAT 0x00000040 +#define PFD_NEED_PALETTE 0x00000080 +#define PFD_NEED_SYSTEM_PALETTE 0x00000100 +#define PFD_SWAP_EXCHANGE 0x00000200 +#define PFD_SWAP_COPY 0x00000400 +#define PFD_SWAP_LAYER_BUFFERS 0x00000800 +#define PFD_GENERIC_ACCELERATED 0x00001000 +#define PFD_SUPPORT_DIRECTDRAW 0x00002000 + +#define PFD_DEPTH_DONTCARE 0x20000000 +#define PFD_DOUBLEBUFFER_DONTCARE 0x40000000 +#define PFD_STEREO_DONTCARE 0x80000000 + +#ifndef NOTEXTMETRIC + typedef int (CALLBACK *OLDFONTENUMPROCA)(CONST LOGFONTA *,CONST TEXTMETRICA *,DWORD,LPARAM); + typedef int (CALLBACK *OLDFONTENUMPROCW)(CONST LOGFONTW *,CONST TEXTMETRICW *,DWORD,LPARAM); +#ifdef UNICODE +#define OLDFONTENUMPROC OLDFONTENUMPROCW +#else +#define OLDFONTENUMPROC OLDFONTENUMPROCA +#endif +#else + typedef int (CALLBACK *OLDFONTENUMPROCA)(CONST LOGFONTA *,CONST VOID *,DWORD,LPARAM); + typedef int (CALLBACK *OLDFONTENUMPROCW)(CONST LOGFONTW *,CONST VOID *,DWORD,LPARAM); +#ifdef UNICODE +#define OLDFONTENUMPROC OLDFONTENUMPROCW +#else +#define OLDFONTENUMPROC OLDFONTENUMPROCA +#endif +#endif + + typedef OLDFONTENUMPROCA FONTENUMPROCA; + typedef OLDFONTENUMPROCW FONTENUMPROCW; +#ifdef UNICODE + typedef FONTENUMPROCW FONTENUMPROC; +#else + typedef FONTENUMPROCA FONTENUMPROC; +#endif + + typedef int (CALLBACK *GOBJENUMPROC)(LPVOID,LPARAM); + typedef VOID (CALLBACK *LINEDDAPROC)(int,int,LPARAM); + +#ifdef UNICODE +#define AddFontResource AddFontResourceW +#define CopyMetaFile CopyMetaFileW +#define CreateDC CreateDCW +#define CreateFontIndirect CreateFontIndirectW +#define CreateFont CreateFontW +#define CreateIC CreateICW +#define CreateMetaFile CreateMetaFileW +#define CreateScalableFontResource CreateScalableFontResourceW +#else +#define AddFontResource AddFontResourceA +#define CopyMetaFile CopyMetaFileA +#define CreateDC CreateDCA +#define CreateFontIndirect CreateFontIndirectA +#define CreateFont CreateFontA +#define CreateIC CreateICA +#define CreateMetaFile CreateMetaFileA +#define CreateScalableFontResource CreateScalableFontResourceA +#endif + + WINGDIAPI int WINAPI AddFontResourceA(LPCSTR); + WINGDIAPI int WINAPI AddFontResourceW(LPCWSTR); + WINGDIAPI WINBOOL WINAPI AnimatePalette(HPALETTE hPal,UINT iStartIndex,UINT cEntries,CONST PALETTEENTRY *ppe); + WINGDIAPI WINBOOL WINAPI Arc(HDC hdc,int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4); + WINGDIAPI WINBOOL WINAPI BitBlt(HDC hdc,int x,int y,int cx,int cy,HDC hdcSrc,int x1,int y1,DWORD rop); + WINGDIAPI WINBOOL WINAPI CancelDC(HDC hdc); + WINGDIAPI WINBOOL WINAPI Chord(HDC hdc,int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4); + WINGDIAPI int WINAPI ChoosePixelFormat(HDC hdc,CONST PIXELFORMATDESCRIPTOR *ppfd); + WINGDIAPI HMETAFILE WINAPI CloseMetaFile(HDC hdc); + WINGDIAPI int WINAPI CombineRgn(HRGN hrgnDst,HRGN hrgnSrc1,HRGN hrgnSrc2,int iMode); + WINGDIAPI HMETAFILE WINAPI CopyMetaFileA(HMETAFILE,LPCSTR); + WINGDIAPI HMETAFILE WINAPI CopyMetaFileW(HMETAFILE,LPCWSTR); + WINGDIAPI HBITMAP WINAPI CreateBitmap(int nWidth,int nHeight,UINT nPlanes,UINT nBitCount,CONST VOID *lpBits); + WINGDIAPI HBITMAP WINAPI CreateBitmapIndirect(CONST BITMAP *pbm); + WINGDIAPI HBRUSH WINAPI CreateBrushIndirect(CONST LOGBRUSH *plbrush); + WINGDIAPI HBITMAP WINAPI CreateCompatibleBitmap(HDC hdc,int cx,int cy); + WINGDIAPI HBITMAP WINAPI CreateDiscardableBitmap(HDC hdc,int cx,int cy); + WINGDIAPI HDC WINAPI CreateCompatibleDC(HDC hdc); + WINGDIAPI HDC WINAPI CreateDCA(LPCSTR pwszDriver,LPCSTR pwszDevice,LPCSTR pszPort,CONST DEVMODEA *pdm); + WINGDIAPI HDC WINAPI CreateDCW(LPCWSTR pwszDriver,LPCWSTR pwszDevice,LPCWSTR pszPort,CONST DEVMODEW *pdm); + WINGDIAPI HBITMAP WINAPI CreateDIBitmap(HDC hdc,CONST BITMAPINFOHEADER *pbmih,DWORD flInit,CONST VOID *pjBits,CONST BITMAPINFO *pbmi,UINT iUsage); + WINGDIAPI HBRUSH WINAPI CreateDIBPatternBrush(HGLOBAL h,UINT iUsage); + WINGDIAPI HBRUSH WINAPI CreateDIBPatternBrushPt(CONST VOID *lpPackedDIB,UINT iUsage); + WINGDIAPI HRGN WINAPI CreateEllipticRgn(int x1,int y1,int x2,int y2); + WINGDIAPI HRGN WINAPI CreateEllipticRgnIndirect(CONST RECT *lprect); + WINGDIAPI HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf); + WINGDIAPI HFONT WINAPI CreateFontIndirectW(CONST LOGFONTW *lplf); + WINGDIAPI HFONT WINAPI CreateFontA(int cHeight,int cWidth,int cEscapement,int cOrientation,int cWeight,DWORD bItalic,DWORD bUnderline,DWORD bStrikeOut,DWORD iCharSet,DWORD iOutPrecision,DWORD iClipPrecision,DWORD iQuality,DWORD iPitchAndFamily,LPCSTR pszFaceName); + WINGDIAPI HFONT WINAPI CreateFontW(int cHeight,int cWidth,int cEscapement,int cOrientation,int cWeight,DWORD bItalic,DWORD bUnderline,DWORD bStrikeOut,DWORD iCharSet,DWORD iOutPrecision,DWORD iClipPrecision,DWORD iQuality,DWORD iPitchAndFamily,LPCWSTR pszFaceName); + WINGDIAPI HBRUSH WINAPI CreateHatchBrush(int iHatch,COLORREF color); + WINGDIAPI HDC WINAPI CreateICA(LPCSTR pszDriver,LPCSTR pszDevice,LPCSTR pszPort,CONST DEVMODEA *pdm); + WINGDIAPI HDC WINAPI CreateICW(LPCWSTR pszDriver,LPCWSTR pszDevice,LPCWSTR pszPort,CONST DEVMODEW *pdm); + WINGDIAPI HDC WINAPI CreateMetaFileA(LPCSTR pszFile); + WINGDIAPI HDC WINAPI CreateMetaFileW(LPCWSTR pszFile); + WINGDIAPI HPALETTE WINAPI CreatePalette(CONST LOGPALETTE *plpal); + WINGDIAPI HPEN WINAPI CreatePen(int iStyle,int cWidth,COLORREF color); + WINGDIAPI HPEN WINAPI CreatePenIndirect(CONST LOGPEN *plpen); + WINGDIAPI HRGN WINAPI CreatePolyPolygonRgn(CONST POINT *pptl,CONST INT *pc,int cPoly,int iMode); + WINGDIAPI HBRUSH WINAPI CreatePatternBrush(HBITMAP hbm); + WINGDIAPI HRGN WINAPI CreateRectRgn(int x1,int y1,int x2,int y2); + WINGDIAPI HRGN WINAPI CreateRectRgnIndirect(CONST RECT *lprect); + WINGDIAPI HRGN WINAPI CreateRoundRectRgn(int x1,int y1,int x2,int y2,int w,int h); + WINGDIAPI WINBOOL WINAPI CreateScalableFontResourceA(DWORD fdwHidden,LPCSTR lpszFont,LPCSTR lpszFile,LPCSTR lpszPath); + WINGDIAPI WINBOOL WINAPI CreateScalableFontResourceW(DWORD fdwHidden,LPCWSTR lpszFont,LPCWSTR lpszFile,LPCWSTR lpszPath); + WINGDIAPI HBRUSH WINAPI CreateSolidBrush(COLORREF color); + WINGDIAPI WINBOOL WINAPI DeleteDC(HDC hdc); + WINGDIAPI WINBOOL WINAPI DeleteMetaFile(HMETAFILE hmf); + WINGDIAPI WINBOOL WINAPI DeleteObject(HGDIOBJ ho); + WINGDIAPI int WINAPI DescribePixelFormat(HDC hdc,int iPixelFormat,UINT nBytes,LPPIXELFORMATDESCRIPTOR ppfd); + + typedef UINT (CALLBACK *LPFNDEVMODE)(HWND,HMODULE,LPDEVMODE,LPSTR,LPSTR,LPDEVMODE,LPSTR,UINT); + typedef DWORD (CALLBACK *LPFNDEVCAPS)(LPSTR,LPSTR,UINT,LPSTR,LPDEVMODE); + +#define DM_UPDATE 1 +#define DM_COPY 2 +#define DM_PROMPT 4 +#define DM_MODIFY 8 + +#define DM_IN_BUFFER DM_MODIFY +#define DM_IN_PROMPT DM_PROMPT +#define DM_OUT_BUFFER DM_COPY +#define DM_OUT_DEFAULT DM_UPDATE + +#define DC_FIELDS 1 +#define DC_PAPERS 2 +#define DC_PAPERSIZE 3 +#define DC_MINEXTENT 4 +#define DC_MAXEXTENT 5 +#define DC_BINS 6 +#define DC_DUPLEX 7 +#define DC_SIZE 8 +#define DC_EXTRA 9 +#define DC_VERSION 10 +#define DC_DRIVER 11 +#define DC_BINNAMES 12 +#define DC_ENUMRESOLUTIONS 13 +#define DC_FILEDEPENDENCIES 14 +#define DC_TRUETYPE 15 +#define DC_PAPERNAMES 16 +#define DC_ORIENTATION 17 +#define DC_COPIES 18 +#define DC_BINADJUST 19 +#define DC_EMF_COMPLIANT 20 +#define DC_DATATYPE_PRODUCED 21 +#define DC_COLLATE 22 +#define DC_MANUFACTURER 23 +#define DC_MODEL 24 +#define DC_PERSONALITY 25 +#define DC_PRINTRATE 26 +#define DC_PRINTRATEUNIT 27 +#define PRINTRATEUNIT_PPM 1 +#define PRINTRATEUNIT_CPS 2 +#define PRINTRATEUNIT_LPM 3 +#define PRINTRATEUNIT_IPM 4 +#define DC_PRINTERMEM 28 +#define DC_MEDIAREADY 29 +#define DC_STAPLE 30 +#define DC_PRINTRATEPPM 31 +#define DC_COLORDEVICE 32 +#define DC_NUP 33 +#define DC_MEDIATYPENAMES 34 +#define DC_MEDIATYPES 35 + +#define DCTT_BITMAP 0x0000001L +#define DCTT_DOWNLOAD 0x0000002L +#define DCTT_SUBDEV 0x0000004L +#define DCTT_DOWNLOAD_OUTLINE 0x0000008L + +#define DCBA_FACEUPNONE 0x0000 +#define DCBA_FACEUPCENTER 0x0001 +#define DCBA_FACEUPLEFT 0x0002 +#define DCBA_FACEUPRIGHT 0x0003 +#define DCBA_FACEDOWNNONE 0x0100 +#define DCBA_FACEDOWNCENTER 0x0101 +#define DCBA_FACEDOWNLEFT 0x0102 +#define DCBA_FACEDOWNRIGHT 0x0103 + +#ifdef UNICODE +#define DeviceCapabilities DeviceCapabilitiesW +#define EnumFontFamiliesEx EnumFontFamiliesExW +#define EnumFontFamilies EnumFontFamiliesW +#define EnumFonts EnumFontsW +#define GetCharWidth GetCharWidthW +#define GetCharWidth32 GetCharWidth32W +#define GetCharWidthFloat GetCharWidthFloatW +#define GetCharABCWidths GetCharABCWidthsW +#define GetCharABCWidthsFloat GetCharABCWidthsFloatW +#define GetGlyphOutline GetGlyphOutlineW +#define GetMetaFile GetMetaFileW +#else +#define DeviceCapabilities DeviceCapabilitiesA +#define EnumFontFamiliesEx EnumFontFamiliesExA +#define EnumFontFamilies EnumFontFamiliesA +#define EnumFonts EnumFontsA +#define GetCharWidth GetCharWidthA +#define GetCharWidth32 GetCharWidth32A +#define GetCharWidthFloat GetCharWidthFloatA +#define GetCharABCWidths GetCharABCWidthsA +#define GetCharABCWidthsFloat GetCharABCWidthsFloatA +#define GetGlyphOutline GetGlyphOutlineA +#define GetMetaFile GetMetaFileA +#endif + + WINSPOOLAPI int WINAPI DeviceCapabilitiesA(LPCSTR pDevice,LPCSTR pPort,WORD fwCapability,LPSTR pOutput,CONST DEVMODEA *pDevMode); + WINSPOOLAPI int WINAPI DeviceCapabilitiesW(LPCWSTR pDevice,LPCWSTR pPort,WORD fwCapability,LPWSTR pOutput,CONST DEVMODEW *pDevMode); + WINGDIAPI int WINAPI DrawEscape(HDC hdc,int iEscape,int cjIn,LPCSTR lpIn); + WINGDIAPI WINBOOL WINAPI Ellipse(HDC hdc,int left,int top,int right,int bottom); + WINGDIAPI int WINAPI EnumFontFamiliesExA(HDC hdc,LPLOGFONTA lpLogfont,FONTENUMPROCA lpProc,LPARAM lParam,DWORD dwFlags); + WINGDIAPI int WINAPI EnumFontFamiliesExW(HDC hdc,LPLOGFONTW lpLogfont,FONTENUMPROCW lpProc,LPARAM lParam,DWORD dwFlags); + WINGDIAPI int WINAPI EnumFontFamiliesA(HDC hdc,LPCSTR lpLogfont,FONTENUMPROCA lpProc,LPARAM lParam); + WINGDIAPI int WINAPI EnumFontFamiliesW(HDC hdc,LPCWSTR lpLogfont,FONTENUMPROCW lpProc,LPARAM lParam); + WINGDIAPI int WINAPI EnumFontsA(HDC hdc,LPCSTR lpLogfont,FONTENUMPROCA lpProc,LPARAM lParam); + WINGDIAPI int WINAPI EnumFontsW(HDC hdc,LPCWSTR lpLogfont,FONTENUMPROCW lpProc,LPARAM lParam); + WINGDIAPI int WINAPI EnumObjects(HDC hdc,int nType,GOBJENUMPROC lpFunc,LPARAM lParam); + WINGDIAPI WINBOOL WINAPI EqualRgn(HRGN hrgn1,HRGN hrgn2); + WINGDIAPI int WINAPI Escape(HDC hdc,int iEscape,int cjIn,LPCSTR pvIn,LPVOID pvOut); + WINGDIAPI int WINAPI ExtEscape(HDC hdc,int iEscape,int cjInput,LPCSTR lpInData,int cjOutput,LPSTR lpOutData); + WINGDIAPI int WINAPI ExcludeClipRect(HDC hdc,int left,int top,int right,int bottom); + WINGDIAPI HRGN WINAPI ExtCreateRegion(CONST XFORM *lpx,DWORD nCount,CONST RGNDATA *lpData); + WINGDIAPI WINBOOL WINAPI ExtFloodFill(HDC hdc,int x,int y,COLORREF color,UINT type); + WINGDIAPI WINBOOL WINAPI FillRgn(HDC hdc,HRGN hrgn,HBRUSH hbr); + WINGDIAPI WINBOOL WINAPI FloodFill(HDC hdc,int x,int y,COLORREF color); + WINGDIAPI WINBOOL WINAPI FrameRgn(HDC hdc,HRGN hrgn,HBRUSH hbr,int w,int h); + WINGDIAPI int WINAPI GetROP2(HDC hdc); + WINGDIAPI WINBOOL WINAPI GetAspectRatioFilterEx(HDC hdc,LPSIZE lpsize); + WINGDIAPI COLORREF WINAPI GetBkColor(HDC hdc); + WINGDIAPI COLORREF WINAPI GetDCBrushColor(HDC hdc); + WINGDIAPI COLORREF WINAPI GetDCPenColor(HDC hdc); + WINGDIAPI int WINAPI GetBkMode(HDC hdc); + WINGDIAPI LONG WINAPI GetBitmapBits(HBITMAP hbit,LONG cb,LPVOID lpvBits); + WINGDIAPI WINBOOL WINAPI GetBitmapDimensionEx(HBITMAP hbit,LPSIZE lpsize); + WINGDIAPI UINT WINAPI GetBoundsRect(HDC hdc,LPRECT lprect,UINT flags); + WINGDIAPI WINBOOL WINAPI GetBrushOrgEx(HDC hdc,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI GetCharWidthA(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidthW(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidth32A(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidth32W(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidthFloatA(HDC hdc,UINT iFirst,UINT iLast,PFLOAT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidthFloatW(HDC hdc,UINT iFirst,UINT iLast,PFLOAT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsA(HDC hdc,UINT wFirst,UINT wLast,LPABC lpABC); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsW(HDC hdc,UINT wFirst,UINT wLast,LPABC lpABC); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsFloatA(HDC hdc,UINT iFirst,UINT iLast,LPABCFLOAT lpABC); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsFloatW(HDC hdc,UINT iFirst,UINT iLast,LPABCFLOAT lpABC); + WINGDIAPI int WINAPI GetClipBox(HDC hdc,LPRECT lprect); + WINGDIAPI int WINAPI GetClipRgn(HDC hdc,HRGN hrgn); + WINGDIAPI int WINAPI GetMetaRgn(HDC hdc,HRGN hrgn); + WINGDIAPI HGDIOBJ WINAPI GetCurrentObject(HDC hdc,UINT type); + WINGDIAPI WINBOOL WINAPI GetCurrentPositionEx(HDC hdc,LPPOINT lppt); + WINGDIAPI int WINAPI GetDeviceCaps(HDC hdc,int index); + WINGDIAPI int WINAPI GetDIBits(HDC hdc,HBITMAP hbm,UINT start,UINT cLines,LPVOID lpvBits,LPBITMAPINFO lpbmi,UINT usage); + WINGDIAPI DWORD WINAPI GetFontData (HDC hdc,DWORD dwTable,DWORD dwOffset,PVOID pvBuffer,DWORD cjBuffer); + WINGDIAPI DWORD WINAPI GetGlyphOutlineA(HDC hdc,UINT uChar,UINT fuFormat,LPGLYPHMETRICS lpgm,DWORD cjBuffer,LPVOID pvBuffer,CONST MAT2 *lpmat2); + WINGDIAPI DWORD WINAPI GetGlyphOutlineW(HDC hdc,UINT uChar,UINT fuFormat,LPGLYPHMETRICS lpgm,DWORD cjBuffer,LPVOID pvBuffer,CONST MAT2 *lpmat2); + WINGDIAPI int WINAPI GetGraphicsMode(HDC hdc); + WINGDIAPI int WINAPI GetMapMode(HDC hdc); + WINGDIAPI UINT WINAPI GetMetaFileBitsEx(HMETAFILE hMF,UINT cbBuffer,LPVOID lpData); + WINGDIAPI HMETAFILE WINAPI GetMetaFileA(LPCSTR lpName); + WINGDIAPI HMETAFILE WINAPI GetMetaFileW(LPCWSTR lpName); + WINGDIAPI COLORREF WINAPI GetNearestColor(HDC hdc,COLORREF color); + WINGDIAPI UINT WINAPI GetNearestPaletteIndex(HPALETTE h,COLORREF color); + WINGDIAPI DWORD WINAPI GetObjectType(HGDIOBJ h); + +#ifndef NOTEXTMETRIC +#ifdef UNICODE +#define GetOutlineTextMetrics GetOutlineTextMetricsW +#else +#define GetOutlineTextMetrics GetOutlineTextMetricsA +#endif + + WINGDIAPI UINT WINAPI GetOutlineTextMetricsA(HDC hdc,UINT cjCopy,LPOUTLINETEXTMETRICA potm); + WINGDIAPI UINT WINAPI GetOutlineTextMetricsW(HDC hdc,UINT cjCopy,LPOUTLINETEXTMETRICW potm); +#endif + +#ifdef UNICODE +#define GetTextExtentPoint GetTextExtentPointW +#define GetTextExtentPoint32 GetTextExtentPoint32W +#define GetTextExtentExPoint GetTextExtentExPointW +#define GetCharacterPlacement GetCharacterPlacementW +#else +#define GetTextExtentPoint GetTextExtentPointA +#define GetTextExtentPoint32 GetTextExtentPoint32A +#define GetTextExtentExPoint GetTextExtentExPointA +#define GetCharacterPlacement GetCharacterPlacementA +#endif + + WINGDIAPI UINT WINAPI GetPaletteEntries(HPALETTE hpal,UINT iStart,UINT cEntries,LPPALETTEENTRY pPalEntries); + WINGDIAPI COLORREF WINAPI GetPixel(HDC hdc,int x,int y); + WINGDIAPI int WINAPI GetPixelFormat(HDC hdc); + WINGDIAPI int WINAPI GetPolyFillMode(HDC hdc); + WINGDIAPI WINBOOL WINAPI GetRasterizerCaps(LPRASTERIZER_STATUS lpraststat,UINT cjBytes); + WINGDIAPI int WINAPI GetRandomRgn (HDC hdc,HRGN hrgn,INT i); + WINGDIAPI DWORD WINAPI GetRegionData(HRGN hrgn,DWORD nCount,LPRGNDATA lpRgnData); + WINGDIAPI int WINAPI GetRgnBox(HRGN hrgn,LPRECT lprc); + WINGDIAPI HGDIOBJ WINAPI GetStockObject(int i); + WINGDIAPI int WINAPI GetStretchBltMode(HDC hdc); + WINGDIAPI UINT WINAPI GetSystemPaletteEntries(HDC hdc,UINT iStart,UINT cEntries,LPPALETTEENTRY pPalEntries); + WINGDIAPI UINT WINAPI GetSystemPaletteUse(HDC hdc); + WINGDIAPI int WINAPI GetTextCharacterExtra(HDC hdc); + WINGDIAPI UINT WINAPI GetTextAlign(HDC hdc); + WINGDIAPI COLORREF WINAPI GetTextColor(HDC hdc); + WINGDIAPI WINBOOL WINAPI GetTextExtentPointA(HDC hdc,LPCSTR lpString,int c,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI GetTextExtentPointW(HDC hdc,LPCWSTR lpString,int c,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI GetTextExtentPoint32A(HDC hdc,LPCSTR lpString,int c,LPSIZE psizl); + WINGDIAPI WINBOOL WINAPI GetTextExtentPoint32W(HDC hdc,LPCWSTR lpString,int c,LPSIZE psizl); + WINGDIAPI WINBOOL WINAPI GetTextExtentExPointA(HDC hdc,LPCSTR lpszString,int cchString,int nMaxExtent,LPINT lpnFit,LPINT lpnDx,LPSIZE lpSize); + WINGDIAPI WINBOOL WINAPI GetTextExtentExPointW(HDC hdc,LPCWSTR lpszString,int cchString,int nMaxExtent,LPINT lpnFit,LPINT lpnDx,LPSIZE lpSize); + WINGDIAPI int WINAPI GetTextCharset(HDC hdc); + WINGDIAPI int WINAPI GetTextCharsetInfo(HDC hdc,LPFONTSIGNATURE lpSig,DWORD dwFlags); + WINGDIAPI WINBOOL WINAPI TranslateCharsetInfo(DWORD *lpSrc,LPCHARSETINFO lpCs,DWORD dwFlags); + WINGDIAPI DWORD WINAPI GetFontLanguageInfo(HDC hdc); + WINGDIAPI DWORD WINAPI GetCharacterPlacementA(HDC hdc,LPCSTR lpString,int nCount,int nMexExtent,LPGCP_RESULTSA lpResults,DWORD dwFlags); + WINGDIAPI DWORD WINAPI GetCharacterPlacementW(HDC hdc,LPCWSTR lpString,int nCount,int nMexExtent,LPGCP_RESULTSW lpResults,DWORD dwFlags); + + typedef struct tagWCRANGE { + WCHAR wcLow; + USHORT cGlyphs; + } WCRANGE,*PWCRANGE,*LPWCRANGE; + + typedef struct tagGLYPHSET { + DWORD cbThis; + DWORD flAccel; + DWORD cGlyphsSupported; + DWORD cRanges; + WCRANGE ranges[1]; + } GLYPHSET,*PGLYPHSET,*LPGLYPHSET; + +#define GS_8BIT_INDICES 0x00000001 + +#define GGI_MARK_NONEXISTING_GLYPHS 0X0001 + +#ifdef UNICODE +#define GetGlyphIndices GetGlyphIndicesW +#else +#define GetGlyphIndices GetGlyphIndicesA +#endif + + WINGDIAPI DWORD WINAPI GetFontUnicodeRanges(HDC hdc,LPGLYPHSET lpgs); + WINGDIAPI DWORD WINAPI GetGlyphIndicesA(HDC hdc,LPCSTR lpstr,int c,LPWORD pgi,DWORD fl); + WINGDIAPI DWORD WINAPI GetGlyphIndicesW(HDC hdc,LPCWSTR lpstr,int c,LPWORD pgi,DWORD fl); + WINGDIAPI WINBOOL WINAPI GetTextExtentPointI(HDC hdc,LPWORD pgiIn,int cgi,LPSIZE psize); + WINGDIAPI WINBOOL WINAPI GetTextExtentExPointI (HDC hdc,LPWORD lpwszString,int cwchString,int nMaxExtent,LPINT lpnFit,LPINT lpnDx,LPSIZE lpSize); + WINGDIAPI WINBOOL WINAPI GetCharWidthI(HDC hdc,UINT giFirst,UINT cgi,LPWORD pgi,LPINT piWidths); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsI(HDC hdc,UINT giFirst,UINT cgi,LPWORD pgi,LPABC pabc); + +#define STAMP_DESIGNVECTOR (0x8000000 + 'd' + ('v' << 8)) +#define STAMP_AXESLIST (0x8000000 + 'a' + ('l' << 8)) +#define MM_MAX_NUMAXES 16 + + typedef struct tagDESIGNVECTOR { + DWORD dvReserved; + DWORD dvNumAxes; + LONG dvValues[MM_MAX_NUMAXES]; + } DESIGNVECTOR,*PDESIGNVECTOR,*LPDESIGNVECTOR; + +#ifdef UNICODE +#define AddFontResourceEx AddFontResourceExW +#define RemoveFontResourceEx RemoveFontResourceExW +#else +#define AddFontResourceEx AddFontResourceExA +#define RemoveFontResourceEx RemoveFontResourceExA +#endif + + WINGDIAPI int WINAPI AddFontResourceExA(LPCSTR name,DWORD fl,PVOID res); + WINGDIAPI int WINAPI AddFontResourceExW(LPCWSTR name,DWORD fl,PVOID res); + WINGDIAPI WINBOOL WINAPI RemoveFontResourceExA(LPCSTR name,DWORD fl,PVOID pdv); + WINGDIAPI WINBOOL WINAPI RemoveFontResourceExW(LPCWSTR name,DWORD fl,PVOID pdv); + WINGDIAPI HANDLE WINAPI AddFontMemResourceEx(PVOID pFileView,DWORD cjSize,PVOID pvResrved,DWORD *pNumFonts); + WINGDIAPI WINBOOL WINAPI RemoveFontMemResourceEx(HANDLE h); + +#define FR_PRIVATE 0x10 +#define FR_NOT_ENUM 0x20 + +#define MM_MAX_AXES_NAMELEN 16 + + typedef struct tagAXISINFOA { + LONG axMinValue; + LONG axMaxValue; + BYTE axAxisName[MM_MAX_AXES_NAMELEN]; + } AXISINFOA,*PAXISINFOA,*LPAXISINFOA; + + typedef struct tagAXISINFOW { + LONG axMinValue; + LONG axMaxValue; + WCHAR axAxisName[MM_MAX_AXES_NAMELEN]; + } AXISINFOW,*PAXISINFOW,*LPAXISINFOW; +#ifdef UNICODE + typedef AXISINFOW AXISINFO; + typedef PAXISINFOW PAXISINFO; + typedef LPAXISINFOW LPAXISINFO; +#else + typedef AXISINFOA AXISINFO; + typedef PAXISINFOA PAXISINFO; + typedef LPAXISINFOA LPAXISINFO; +#endif + + typedef struct tagAXESLISTA { + DWORD axlReserved; + DWORD axlNumAxes; + AXISINFOA axlAxisInfo[MM_MAX_NUMAXES]; + } AXESLISTA,*PAXESLISTA,*LPAXESLISTA; + + typedef struct tagAXESLISTW { + DWORD axlReserved; + DWORD axlNumAxes; + AXISINFOW axlAxisInfo[MM_MAX_NUMAXES]; + } AXESLISTW,*PAXESLISTW,*LPAXESLISTW; +#ifdef UNICODE + typedef AXESLISTW AXESLIST; + typedef PAXESLISTW PAXESLIST; + typedef LPAXESLISTW LPAXESLIST; +#else + typedef AXESLISTA AXESLIST; + typedef PAXESLISTA PAXESLIST; + typedef LPAXESLISTA LPAXESLIST; +#endif + + typedef struct tagENUMLOGFONTEXDVA { + ENUMLOGFONTEXA elfEnumLogfontEx; + DESIGNVECTOR elfDesignVector; + } ENUMLOGFONTEXDVA,*PENUMLOGFONTEXDVA,*LPENUMLOGFONTEXDVA; + + typedef struct tagENUMLOGFONTEXDVW { + ENUMLOGFONTEXW elfEnumLogfontEx; + DESIGNVECTOR elfDesignVector; + } ENUMLOGFONTEXDVW,*PENUMLOGFONTEXDVW,*LPENUMLOGFONTEXDVW; +#ifdef UNICODE + typedef ENUMLOGFONTEXDVW ENUMLOGFONTEXDV; + typedef PENUMLOGFONTEXDVW PENUMLOGFONTEXDV; + typedef LPENUMLOGFONTEXDVW LPENUMLOGFONTEXDV; +#else + typedef ENUMLOGFONTEXDVA ENUMLOGFONTEXDV; + typedef PENUMLOGFONTEXDVA PENUMLOGFONTEXDV; + typedef LPENUMLOGFONTEXDVA LPENUMLOGFONTEXDV; +#endif + +#ifdef UNICODE +#define CreateFontIndirectEx CreateFontIndirectExW +#else +#define CreateFontIndirectEx CreateFontIndirectExA +#endif + + WINGDIAPI HFONT WINAPI CreateFontIndirectExA(CONST ENUMLOGFONTEXDVA *); + WINGDIAPI HFONT WINAPI CreateFontIndirectExW(CONST ENUMLOGFONTEXDVW *); + +#ifndef NOTEXTMETRIC + typedef struct tagENUMTEXTMETRICA { + NEWTEXTMETRICEXA etmNewTextMetricEx; + AXESLISTA etmAxesList; + } ENUMTEXTMETRICA,*PENUMTEXTMETRICA,*LPENUMTEXTMETRICA; + typedef struct tagENUMTEXTMETRICW + { + NEWTEXTMETRICEXW etmNewTextMetricEx; + AXESLISTW etmAxesList; + } ENUMTEXTMETRICW,*PENUMTEXTMETRICW,*LPENUMTEXTMETRICW; +#ifdef UNICODE + typedef ENUMTEXTMETRICW ENUMTEXTMETRIC; + typedef PENUMTEXTMETRICW PENUMTEXTMETRIC; + typedef LPENUMTEXTMETRICW LPENUMTEXTMETRIC; +#else + typedef ENUMTEXTMETRICA ENUMTEXTMETRIC; + typedef PENUMTEXTMETRICA PENUMTEXTMETRIC; + typedef LPENUMTEXTMETRICA LPENUMTEXTMETRIC; +#endif +#endif + +#ifdef UNICODE +#define ResetDC ResetDCW +#define RemoveFontResource RemoveFontResourceW +#else +#define ResetDC ResetDCA +#define RemoveFontResource RemoveFontResourceA +#endif + + WINGDIAPI WINBOOL WINAPI GetViewportExtEx(HDC hdc,LPSIZE lpsize); + WINGDIAPI WINBOOL WINAPI GetViewportOrgEx(HDC hdc,LPPOINT lppoint); + WINGDIAPI WINBOOL WINAPI GetWindowExtEx(HDC hdc,LPSIZE lpsize); + WINGDIAPI WINBOOL WINAPI GetWindowOrgEx(HDC hdc,LPPOINT lppoint); + WINGDIAPI int WINAPI IntersectClipRect(HDC hdc,int left,int top,int right,int bottom); + WINGDIAPI WINBOOL WINAPI InvertRgn(HDC hdc,HRGN hrgn); + WINGDIAPI WINBOOL WINAPI LineDDA(int xStart,int yStart,int xEnd,int yEnd,LINEDDAPROC lpProc,LPARAM data); + WINGDIAPI WINBOOL WINAPI LineTo(HDC hdc,int x,int y); + WINGDIAPI WINBOOL WINAPI MaskBlt(HDC hdcDest,int xDest,int yDest,int width,int height,HDC hdcSrc,int xSrc,int ySrc,HBITMAP hbmMask,int xMask,int yMask,DWORD rop); + WINGDIAPI WINBOOL WINAPI PlgBlt(HDC hdcDest,CONST POINT *lpPoint,HDC hdcSrc,int xSrc,int ySrc,int width,int height,HBITMAP hbmMask,int xMask,int yMask); + WINGDIAPI int WINAPI OffsetClipRgn(HDC hdc,int x,int y); + WINGDIAPI int WINAPI OffsetRgn(HRGN hrgn,int x,int y); + WINGDIAPI WINBOOL WINAPI PatBlt(HDC hdc,int x,int y,int w,int h,DWORD rop); + WINGDIAPI WINBOOL WINAPI Pie(HDC hdc,int left,int top,int right,int bottom,int xr1,int yr1,int xr2,int yr2); + WINGDIAPI WINBOOL WINAPI PlayMetaFile(HDC hdc,HMETAFILE hmf); + WINGDIAPI WINBOOL WINAPI PaintRgn(HDC hdc,HRGN hrgn); + WINGDIAPI WINBOOL WINAPI PolyPolygon(HDC hdc,CONST POINT *apt,CONST INT *asz,int csz); + WINGDIAPI WINBOOL WINAPI PtInRegion(HRGN hrgn,int x,int y); + WINGDIAPI WINBOOL WINAPI PtVisible(HDC hdc,int x,int y); + WINGDIAPI WINBOOL WINAPI RectInRegion(HRGN hrgn,CONST RECT *lprect); + WINGDIAPI WINBOOL WINAPI RectVisible(HDC hdc,CONST RECT *lprect); + WINGDIAPI WINBOOL WINAPI Rectangle(HDC hdc,int left,int top,int right,int bottom); + WINGDIAPI WINBOOL WINAPI RestoreDC(HDC hdc,int nSavedDC); + WINGDIAPI HDC WINAPI ResetDCA(HDC hdc,CONST DEVMODEA *lpdm); + WINGDIAPI HDC WINAPI ResetDCW(HDC hdc,CONST DEVMODEW *lpdm); + WINGDIAPI UINT WINAPI RealizePalette(HDC hdc); + WINGDIAPI WINBOOL WINAPI RemoveFontResourceA(LPCSTR lpFileName); + WINGDIAPI WINBOOL WINAPI RemoveFontResourceW(LPCWSTR lpFileName); + WINGDIAPI WINBOOL WINAPI RoundRect(HDC hdc,int left,int top,int right,int bottom,int width,int height); + WINGDIAPI WINBOOL WINAPI ResizePalette(HPALETTE hpal,UINT n); + WINGDIAPI int WINAPI SaveDC(HDC hdc); + WINGDIAPI int WINAPI SelectClipRgn(HDC hdc,HRGN hrgn); + WINGDIAPI int WINAPI ExtSelectClipRgn(HDC hdc,HRGN hrgn,int mode); + WINGDIAPI int WINAPI SetMetaRgn(HDC hdc); + WINGDIAPI HGDIOBJ WINAPI SelectObject(HDC hdc,HGDIOBJ h); + WINGDIAPI HPALETTE WINAPI SelectPalette(HDC hdc,HPALETTE hPal,WINBOOL bForceBkgd); + WINGDIAPI COLORREF WINAPI SetBkColor(HDC hdc,COLORREF color); + WINGDIAPI COLORREF WINAPI SetDCBrushColor(HDC hdc,COLORREF color); + WINGDIAPI COLORREF WINAPI SetDCPenColor(HDC hdc,COLORREF color); + WINGDIAPI int WINAPI SetBkMode(HDC hdc,int mode); + WINGDIAPI LONG WINAPI SetBitmapBits(HBITMAP hbm,DWORD cb,CONST VOID *pvBits); + WINGDIAPI UINT WINAPI SetBoundsRect(HDC hdc,CONST RECT *lprect,UINT flags); + WINGDIAPI int WINAPI SetDIBits(HDC hdc,HBITMAP hbm,UINT start,UINT cLines,CONST VOID *lpBits,CONST BITMAPINFO *lpbmi,UINT ColorUse); + WINGDIAPI int WINAPI SetDIBitsToDevice(HDC hdc,int xDest,int yDest,DWORD w,DWORD h,int xSrc,int ySrc,UINT StartScan,UINT cLines,CONST VOID *lpvBits,CONST BITMAPINFO *lpbmi,UINT ColorUse); + WINGDIAPI DWORD WINAPI SetMapperFlags(HDC hdc,DWORD flags); + WINGDIAPI int WINAPI SetGraphicsMode(HDC hdc,int iMode); + WINGDIAPI int WINAPI SetMapMode(HDC hdc,int iMode); + WINGDIAPI DWORD WINAPI SetLayout(HDC hdc,DWORD l); + WINGDIAPI DWORD WINAPI GetLayout(HDC hdc); + WINGDIAPI HMETAFILE WINAPI SetMetaFileBitsEx(UINT cbBuffer,CONST BYTE *lpData); + WINGDIAPI UINT WINAPI SetPaletteEntries(HPALETTE hpal,UINT iStart,UINT cEntries,CONST PALETTEENTRY *pPalEntries); + WINGDIAPI COLORREF WINAPI SetPixel(HDC hdc,int x,int y,COLORREF color); + WINGDIAPI WINBOOL WINAPI SetPixelV(HDC hdc,int x,int y,COLORREF color); + WINGDIAPI WINBOOL WINAPI SetPixelFormat(HDC hdc,int format,CONST PIXELFORMATDESCRIPTOR *ppfd); + WINGDIAPI int WINAPI SetPolyFillMode(HDC hdc,int mode); + WINGDIAPI WINBOOL WINAPI StretchBlt(HDC hdcDest,int xDest,int yDest,int wDest,int hDest,HDC hdcSrc,int xSrc,int ySrc,int wSrc,int hSrc,DWORD rop); + WINGDIAPI WINBOOL WINAPI SetRectRgn(HRGN hrgn,int left,int top,int right,int bottom); + WINGDIAPI int WINAPI StretchDIBits(HDC hdc,int xDest,int yDest,int DestWidth,int DestHeight,int xSrc,int ySrc,int SrcWidth,int SrcHeight,CONST VOID *lpBits,CONST BITMAPINFO *lpbmi,UINT iUsage,DWORD rop); + WINGDIAPI int WINAPI SetROP2(HDC hdc,int rop2); + WINGDIAPI int WINAPI SetStretchBltMode(HDC hdc,int mode); + WINGDIAPI UINT WINAPI SetSystemPaletteUse(HDC hdc,UINT use); + WINGDIAPI int WINAPI SetTextCharacterExtra(HDC hdc,int extra); + WINGDIAPI COLORREF WINAPI SetTextColor(HDC hdc,COLORREF color); + WINGDIAPI UINT WINAPI SetTextAlign(HDC hdc,UINT align); + WINGDIAPI WINBOOL WINAPI SetTextJustification(HDC hdc,int extra,int count); + WINGDIAPI WINBOOL WINAPI UpdateColors(HDC hdc); + + typedef USHORT COLOR16; + + typedef struct _TRIVERTEX { + LONG x; + LONG y; + COLOR16 Red; + COLOR16 Green; + COLOR16 Blue; + COLOR16 Alpha; + } TRIVERTEX,*PTRIVERTEX,*LPTRIVERTEX; + + typedef struct _GRADIENT_TRIANGLE { + ULONG Vertex1; + ULONG Vertex2; + ULONG Vertex3; + } GRADIENT_TRIANGLE,*PGRADIENT_TRIANGLE,*LPGRADIENT_TRIANGLE; + + typedef struct _GRADIENT_RECT { + ULONG UpperLeft; + ULONG LowerRight; + } GRADIENT_RECT,*PGRADIENT_RECT,*LPGRADIENT_RECT; + + typedef struct _BLENDFUNCTION { + BYTE BlendOp; + BYTE BlendFlags; + BYTE SourceConstantAlpha; + BYTE AlphaFormat; + } BLENDFUNCTION,*PBLENDFUNCTION; + +#define AC_SRC_OVER 0x00 +#define AC_SRC_ALPHA 0x01 + + WINGDIAPI WINBOOL WINAPI AlphaBlend(HDC hdcDest,int xoriginDest,int yoriginDest,int wDest,int hDest,HDC hdcSrc,int xoriginSrc,int yoriginSrc,int wSrc,int hSrc,BLENDFUNCTION ftn); + WINGDIAPI WINBOOL WINAPI TransparentBlt(HDC hdcDest,int xoriginDest,int yoriginDest,int wDest,int hDest,HDC hdcSrc,int xoriginSrc,int yoriginSrc,int wSrc,int hSrc,UINT crTransparent); + +#define GRADIENT_FILL_RECT_H 0x00000000 +#define GRADIENT_FILL_RECT_V 0x00000001 +#define GRADIENT_FILL_TRIANGLE 0x00000002 +#define GRADIENT_FILL_OP_FLAG 0x000000ff + + WINGDIAPI WINBOOL WINAPI GradientFill(HDC hdc,PTRIVERTEX pVertex,ULONG nVertex,PVOID pMesh,ULONG nMesh,ULONG ulMode); + +#ifndef NOMETAFILE + +#ifdef UNICODE +#define CopyEnhMetaFile CopyEnhMetaFileW +#define CreateEnhMetaFile CreateEnhMetaFileW +#define GetEnhMetaFile GetEnhMetaFileW +#define GetEnhMetaFileDescription GetEnhMetaFileDescriptionW +#else +#define CopyEnhMetaFile CopyEnhMetaFileA +#define CreateEnhMetaFile CreateEnhMetaFileA +#define GetEnhMetaFile GetEnhMetaFileA +#define GetEnhMetaFileDescription GetEnhMetaFileDescriptionA +#endif + + WINGDIAPI WINBOOL WINAPI PlayMetaFileRecord(HDC hdc,LPHANDLETABLE lpHandleTable,LPMETARECORD lpMR,UINT noObjs); + + typedef int (CALLBACK *MFENUMPROC)(HDC hdc,HANDLETABLE *lpht,METARECORD *lpMR,int nObj,LPARAM param); + + WINGDIAPI WINBOOL WINAPI EnumMetaFile(HDC hdc,HMETAFILE hmf,MFENUMPROC proc,LPARAM param); + + typedef int (CALLBACK *ENHMFENUMPROC)(HDC hdc,HANDLETABLE *lpht,CONST ENHMETARECORD *lpmr,int hHandles,LPARAM data); + + WINGDIAPI HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc); + WINGDIAPI HENHMETAFILE WINAPI CopyEnhMetaFileA(HENHMETAFILE hEnh,LPCSTR lpFileName); + WINGDIAPI HENHMETAFILE WINAPI CopyEnhMetaFileW(HENHMETAFILE hEnh,LPCWSTR lpFileName); + WINGDIAPI HDC WINAPI CreateEnhMetaFileA(HDC hdc,LPCSTR lpFilename,CONST RECT *lprc,LPCSTR lpDesc); + WINGDIAPI HDC WINAPI CreateEnhMetaFileW(HDC hdc,LPCWSTR lpFilename,CONST RECT *lprc,LPCWSTR lpDesc); + WINGDIAPI WINBOOL WINAPI DeleteEnhMetaFile(HENHMETAFILE hmf); + WINGDIAPI WINBOOL WINAPI EnumEnhMetaFile(HDC hdc,HENHMETAFILE hmf,ENHMFENUMPROC proc,LPVOID param,CONST RECT *lpRect); + WINGDIAPI HENHMETAFILE WINAPI GetEnhMetaFileA(LPCSTR lpName); + WINGDIAPI HENHMETAFILE WINAPI GetEnhMetaFileW(LPCWSTR lpName); + WINGDIAPI UINT WINAPI GetEnhMetaFileBits(HENHMETAFILE hEMF,UINT nSize,LPBYTE lpData); + WINGDIAPI UINT WINAPI GetEnhMetaFileDescriptionA(HENHMETAFILE hemf,UINT cchBuffer,LPSTR lpDescription); + WINGDIAPI UINT WINAPI GetEnhMetaFileDescriptionW(HENHMETAFILE hemf,UINT cchBuffer,LPWSTR lpDescription); + WINGDIAPI UINT WINAPI GetEnhMetaFileHeader(HENHMETAFILE hemf,UINT nSize,LPENHMETAHEADER lpEnhMetaHeader); + WINGDIAPI UINT WINAPI GetEnhMetaFilePaletteEntries(HENHMETAFILE hemf,UINT nNumEntries,LPPALETTEENTRY lpPaletteEntries); + WINGDIAPI UINT WINAPI GetEnhMetaFilePixelFormat(HENHMETAFILE hemf,UINT cbBuffer,PIXELFORMATDESCRIPTOR *ppfd); + WINGDIAPI UINT WINAPI GetWinMetaFileBits(HENHMETAFILE hemf,UINT cbData16,LPBYTE pData16,INT iMapMode,HDC hdcRef); + WINGDIAPI WINBOOL WINAPI PlayEnhMetaFile(HDC hdc,HENHMETAFILE hmf,CONST RECT *lprect); + WINGDIAPI WINBOOL WINAPI PlayEnhMetaFileRecord(HDC hdc,LPHANDLETABLE pht,CONST ENHMETARECORD *pmr,UINT cht); + WINGDIAPI HENHMETAFILE WINAPI SetEnhMetaFileBits(UINT nSize,CONST BYTE *pb); + WINGDIAPI HENHMETAFILE WINAPI SetWinMetaFileBits(UINT nSize,CONST BYTE *lpMeta16Data,HDC hdcRef,CONST METAFILEPICT *lpMFP); + WINGDIAPI WINBOOL WINAPI GdiComment(HDC hdc,UINT nSize,CONST BYTE *lpData); +#endif + +#ifndef NOTEXTMETRIC +#ifdef UNICODE +#define GetTextMetrics GetTextMetricsW +#else +#define GetTextMetrics GetTextMetricsA +#endif + + WINGDIAPI WINBOOL WINAPI GetTextMetricsA(HDC hdc,LPTEXTMETRICA lptm); + WINGDIAPI WINBOOL WINAPI GetTextMetricsW(HDC hdc,LPTEXTMETRICW lptm); +#endif + + typedef struct tagDIBSECTION { + BITMAP dsBm; + BITMAPINFOHEADER dsBmih; + DWORD dsBitfields[3]; + HANDLE dshSection; + DWORD dsOffset; + } DIBSECTION,*LPDIBSECTION,*PDIBSECTION; + + WINGDIAPI WINBOOL WINAPI AngleArc(HDC hdc,int x,int y,DWORD r,FLOAT StartAngle,FLOAT SweepAngle); + WINGDIAPI WINBOOL WINAPI PolyPolyline(HDC hdc,CONST POINT *apt,CONST DWORD *asz,DWORD csz); + WINGDIAPI WINBOOL WINAPI GetWorldTransform(HDC hdc,LPXFORM lpxf); + WINGDIAPI WINBOOL WINAPI SetWorldTransform(HDC hdc,CONST XFORM *lpxf); + WINGDIAPI WINBOOL WINAPI ModifyWorldTransform(HDC hdc,CONST XFORM *lpxf,DWORD mode); + WINGDIAPI WINBOOL WINAPI CombineTransform(LPXFORM lpxfOut,CONST XFORM *lpxf1,CONST XFORM *lpxf2); + WINGDIAPI HBITMAP WINAPI CreateDIBSection(HDC hdc,CONST BITMAPINFO *lpbmi,UINT usage,VOID **ppvBits,HANDLE hSection,DWORD offset); + WINGDIAPI UINT WINAPI GetDIBColorTable(HDC hdc,UINT iStart,UINT cEntries,RGBQUAD *prgbq); + WINGDIAPI UINT WINAPI SetDIBColorTable(HDC hdc,UINT iStart,UINT cEntries,CONST RGBQUAD *prgbq); + +#define CA_NEGATIVE 0x0001 +#define CA_LOG_FILTER 0x0002 + +#define ILLUMINANT_DEVICE_DEFAULT 0 +#define ILLUMINANT_A 1 +#define ILLUMINANT_B 2 +#define ILLUMINANT_C 3 +#define ILLUMINANT_D50 4 +#define ILLUMINANT_D55 5 +#define ILLUMINANT_D65 6 +#define ILLUMINANT_D75 7 +#define ILLUMINANT_F2 8 +#define ILLUMINANT_MAX_INDEX ILLUMINANT_F2 + +#define ILLUMINANT_TUNGSTEN ILLUMINANT_A +#define ILLUMINANT_DAYLIGHT ILLUMINANT_C +#define ILLUMINANT_FLUORESCENT ILLUMINANT_F2 +#define ILLUMINANT_NTSC ILLUMINANT_C + +#define RGB_GAMMA_MIN (WORD)02500 +#define RGB_GAMMA_MAX (WORD)65000 + +#define REFERENCE_WHITE_MIN (WORD)6000 +#define REFERENCE_WHITE_MAX (WORD)10000 +#define REFERENCE_BLACK_MIN (WORD)0 +#define REFERENCE_BLACK_MAX (WORD)4000 + +#define COLOR_ADJ_MIN (SHORT)-100 +#define COLOR_ADJ_MAX (SHORT)100 + + typedef struct tagCOLORADJUSTMENT { + WORD caSize; + WORD caFlags; + WORD caIlluminantIndex; + WORD caRedGamma; + WORD caGreenGamma; + WORD caBlueGamma; + WORD caReferenceBlack; + WORD caReferenceWhite; + SHORT caContrast; + SHORT caBrightness; + SHORT caColorfulness; + SHORT caRedGreenTint; + } COLORADJUSTMENT,*PCOLORADJUSTMENT,*LPCOLORADJUSTMENT; + + WINGDIAPI WINBOOL WINAPI SetColorAdjustment(HDC hdc,CONST COLORADJUSTMENT *lpca); + WINGDIAPI WINBOOL WINAPI GetColorAdjustment(HDC hdc,LPCOLORADJUSTMENT lpca); + WINGDIAPI HPALETTE WINAPI CreateHalftonePalette(HDC hdc); + + typedef WINBOOL (CALLBACK *ABORTPROC)(HDC,int); + + typedef struct _DOCINFOA { + int cbSize; + LPCSTR lpszDocName; + LPCSTR lpszOutput; + LPCSTR lpszDatatype; + DWORD fwType; + } DOCINFOA,*LPDOCINFOA; + + typedef struct _DOCINFOW { + int cbSize; + LPCWSTR lpszDocName; + LPCWSTR lpszOutput; + LPCWSTR lpszDatatype; + DWORD fwType; + } DOCINFOW,*LPDOCINFOW; + +#ifdef UNICODE + typedef DOCINFOW DOCINFO; + typedef LPDOCINFOW LPDOCINFO; +#else + typedef DOCINFOA DOCINFO; + typedef LPDOCINFOA LPDOCINFO; +#endif + +#define DI_APPBANDING 0x00000001 +#define DI_ROPS_READ_DESTINATION 0x00000002 + +#ifdef UNICODE +#define StartDoc StartDocW +#define GetObject GetObjectW +#define TextOut TextOutW +#define ExtTextOut ExtTextOutW +#define PolyTextOut PolyTextOutW +#define GetTextFace GetTextFaceW +#else +#define StartDoc StartDocA +#define GetObject GetObjectA +#define TextOut TextOutA +#define ExtTextOut ExtTextOutA +#define PolyTextOut PolyTextOutA +#define GetTextFace GetTextFaceA +#endif + + WINGDIAPI int WINAPI StartDocA(HDC hdc,CONST DOCINFOA *lpdi); + WINGDIAPI int WINAPI StartDocW(HDC hdc,CONST DOCINFOW *lpdi); + WINGDIAPI int WINAPI EndDoc(HDC hdc); + WINGDIAPI int WINAPI StartPage(HDC hdc); + WINGDIAPI int WINAPI EndPage(HDC hdc); + WINGDIAPI int WINAPI AbortDoc(HDC hdc); + WINGDIAPI int WINAPI SetAbortProc(HDC hdc,ABORTPROC proc); + WINGDIAPI WINBOOL WINAPI AbortPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI ArcTo(HDC hdc,int left,int top,int right,int bottom,int xr1,int yr1,int xr2,int yr2); + WINGDIAPI WINBOOL WINAPI BeginPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI CloseFigure(HDC hdc); + WINGDIAPI WINBOOL WINAPI EndPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI FillPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI FlattenPath(HDC hdc); + WINGDIAPI int WINAPI GetPath(HDC hdc,LPPOINT apt,LPBYTE aj,int cpt); + WINGDIAPI HRGN WINAPI PathToRegion(HDC hdc); + WINGDIAPI WINBOOL WINAPI PolyDraw(HDC hdc,CONST POINT *apt,CONST BYTE *aj,int cpt); + WINGDIAPI WINBOOL WINAPI SelectClipPath(HDC hdc,int mode); + WINGDIAPI int WINAPI SetArcDirection(HDC hdc,int dir); + WINGDIAPI WINBOOL WINAPI SetMiterLimit(HDC hdc,FLOAT limit,PFLOAT old); + WINGDIAPI WINBOOL WINAPI StrokeAndFillPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI StrokePath(HDC hdc); + WINGDIAPI WINBOOL WINAPI WidenPath(HDC hdc); + WINGDIAPI HPEN WINAPI ExtCreatePen(DWORD iPenStyle,DWORD cWidth,CONST LOGBRUSH *plbrush,DWORD cStyle,CONST DWORD *pstyle); + WINGDIAPI WINBOOL WINAPI GetMiterLimit(HDC hdc,PFLOAT plimit); + WINGDIAPI int WINAPI GetArcDirection(HDC hdc); + WINGDIAPI int WINAPI GetObjectA(HANDLE h,int c,LPVOID pv); + WINGDIAPI int WINAPI GetObjectW(HANDLE h,int c,LPVOID pv); + WINGDIAPI WINBOOL WINAPI MoveToEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI TextOutA(HDC hdc,int x,int y,LPCSTR lpString,int c); + WINGDIAPI WINBOOL WINAPI TextOutW(HDC hdc,int x,int y,LPCWSTR lpString,int c); + WINGDIAPI WINBOOL WINAPI ExtTextOutA(HDC hdc,int x,int y,UINT options,CONST RECT *lprect,LPCSTR lpString,UINT c,CONST INT *lpDx); + WINGDIAPI WINBOOL WINAPI ExtTextOutW(HDC hdc,int x,int y,UINT options,CONST RECT *lprect,LPCWSTR lpString,UINT c,CONST INT *lpDx); + WINGDIAPI WINBOOL WINAPI PolyTextOutA(HDC hdc,CONST POLYTEXTA *ppt,int nstrings); + WINGDIAPI WINBOOL WINAPI PolyTextOutW(HDC hdc,CONST POLYTEXTW *ppt,int nstrings); + WINGDIAPI HRGN WINAPI CreatePolygonRgn(CONST POINT *pptl,int cPoint,int iMode); + WINGDIAPI WINBOOL WINAPI DPtoLP(HDC hdc,LPPOINT lppt,int c); + WINGDIAPI WINBOOL WINAPI LPtoDP(HDC hdc,LPPOINT lppt,int c); + WINGDIAPI WINBOOL WINAPI Polygon(HDC hdc,CONST POINT *apt,int cpt); + WINGDIAPI WINBOOL WINAPI Polyline(HDC hdc,CONST POINT *apt,int cpt); + WINGDIAPI WINBOOL WINAPI PolyBezier(HDC hdc,CONST POINT *apt,DWORD cpt); + WINGDIAPI WINBOOL WINAPI PolyBezierTo(HDC hdc,CONST POINT *apt,DWORD cpt); + WINGDIAPI WINBOOL WINAPI PolylineTo(HDC hdc,CONST POINT *apt,DWORD cpt); + WINGDIAPI WINBOOL WINAPI SetViewportExtEx(HDC hdc,int x,int y,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI SetViewportOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI SetWindowExtEx(HDC hdc,int x,int y,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI SetWindowOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI OffsetViewportOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI OffsetWindowOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI ScaleViewportExtEx(HDC hdc,int xn,int dx,int yn,int yd,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI ScaleWindowExtEx(HDC hdc,int xn,int xd,int yn,int yd,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI SetBitmapDimensionEx(HBITMAP hbm,int w,int h,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI SetBrushOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI int WINAPI GetTextFaceA(HDC hdc,int c,LPSTR lpName); + WINGDIAPI int WINAPI GetTextFaceW(HDC hdc,int c,LPWSTR lpName); + +#define FONTMAPPER_MAX 10 + + typedef struct tagKERNINGPAIR { + WORD wFirst; + WORD wSecond; + int iKernAmount; + } KERNINGPAIR,*LPKERNINGPAIR; + +#ifdef UNICODE +#define GetKerningPairs GetKerningPairsW +#else +#define GetKerningPairs GetKerningPairsA +#endif + + WINGDIAPI DWORD WINAPI GetKerningPairsA(HDC hdc,DWORD nPairs,LPKERNINGPAIR lpKernPair); + WINGDIAPI DWORD WINAPI GetKerningPairsW(HDC hdc,DWORD nPairs,LPKERNINGPAIR lpKernPair); + WINGDIAPI WINBOOL WINAPI GetDCOrgEx(HDC hdc,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI FixBrushOrgEx(HDC hdc,int x,int y,LPPOINT ptl); + WINGDIAPI WINBOOL WINAPI UnrealizeObject(HGDIOBJ h); + WINGDIAPI WINBOOL WINAPI GdiFlush(); + WINGDIAPI DWORD WINAPI GdiSetBatchLimit(DWORD dw); + WINGDIAPI DWORD WINAPI GdiGetBatchLimit(); + +#define ICM_OFF 1 +#define ICM_ON 2 +#define ICM_QUERY 3 +#define ICM_DONE_OUTSIDEDC 4 + + typedef int (CALLBACK *ICMENUMPROCA)(LPSTR,LPARAM); + typedef int (CALLBACK *ICMENUMPROCW)(LPWSTR,LPARAM); + +#ifdef UNICODE +#define ICMENUMPROC ICMENUMPROCW +#define EnumICMProfiles EnumICMProfilesW +#define UpdateICMRegKey UpdateICMRegKeyW +#define GetLogColorSpace GetLogColorSpaceW +#define CreateColorSpace CreateColorSpaceW +#define GetICMProfile GetICMProfileW +#define SetICMProfile SetICMProfileW +#else +#define ICMENUMPROC ICMENUMPROCA +#define EnumICMProfiles EnumICMProfilesA +#define UpdateICMRegKey UpdateICMRegKeyA +#define GetLogColorSpace GetLogColorSpaceA +#define CreateColorSpace CreateColorSpaceA +#define GetICMProfile GetICMProfileA +#define SetICMProfile SetICMProfileA +#endif + + WINGDIAPI int WINAPI SetICMMode(HDC hdc,int mode); + WINGDIAPI WINBOOL WINAPI CheckColorsInGamut(HDC hdc,LPVOID lpRGBTriple,LPVOID dlpBuffer,DWORD nCount); + WINGDIAPI HCOLORSPACE WINAPI GetColorSpace(HDC hdc); + WINGDIAPI WINBOOL WINAPI GetLogColorSpaceA(HCOLORSPACE hColorSpace,LPLOGCOLORSPACEA lpBuffer,DWORD nSize); + WINGDIAPI WINBOOL WINAPI GetLogColorSpaceW(HCOLORSPACE hColorSpace,LPLOGCOLORSPACEW lpBuffer,DWORD nSize); + WINGDIAPI HCOLORSPACE WINAPI CreateColorSpaceA(LPLOGCOLORSPACEA lplcs); + WINGDIAPI HCOLORSPACE WINAPI CreateColorSpaceW(LPLOGCOLORSPACEW lplcs); + WINGDIAPI HCOLORSPACE WINAPI SetColorSpace(HDC hdc,HCOLORSPACE hcs); + WINGDIAPI WINBOOL WINAPI DeleteColorSpace(HCOLORSPACE hcs); + WINGDIAPI WINBOOL WINAPI GetICMProfileA(HDC hdc,LPDWORD pBufSize,LPSTR pszFilename); + WINGDIAPI WINBOOL WINAPI GetICMProfileW(HDC hdc,LPDWORD pBufSize,LPWSTR pszFilename); + WINGDIAPI WINBOOL WINAPI SetICMProfileA(HDC hdc,LPSTR lpFileName); + WINGDIAPI WINBOOL WINAPI SetICMProfileW(HDC hdc,LPWSTR lpFileName); + WINGDIAPI WINBOOL WINAPI GetDeviceGammaRamp(HDC hdc,LPVOID lpRamp); + WINGDIAPI WINBOOL WINAPI SetDeviceGammaRamp(HDC hdc,LPVOID lpRamp); + WINGDIAPI WINBOOL WINAPI ColorMatchToTarget(HDC hdc,HDC hdcTarget,DWORD action); + WINGDIAPI int WINAPI EnumICMProfilesA(HDC hdc,ICMENUMPROCA proc,LPARAM param); + WINGDIAPI int WINAPI EnumICMProfilesW(HDC hdc,ICMENUMPROCW proc,LPARAM param); + WINGDIAPI WINBOOL WINAPI UpdateICMRegKeyA(DWORD reserved,LPSTR lpszCMID,LPSTR lpszFileName,UINT command); + WINGDIAPI WINBOOL WINAPI UpdateICMRegKeyW(DWORD reserved,LPWSTR lpszCMID,LPWSTR lpszFileName,UINT command); + WINGDIAPI WINBOOL WINAPI ColorCorrectPalette(HDC hdc,HPALETTE hPal,DWORD deFirst,DWORD num); + +#ifndef NOMETAFILE + +#define ENHMETA_SIGNATURE 0x464D4520 +#define ENHMETA_STOCK_OBJECT 0x80000000 + +#define EMR_HEADER 1 +#define EMR_POLYBEZIER 2 +#define EMR_POLYGON 3 +#define EMR_POLYLINE 4 +#define EMR_POLYBEZIERTO 5 +#define EMR_POLYLINETO 6 +#define EMR_POLYPOLYLINE 7 +#define EMR_POLYPOLYGON 8 +#define EMR_SETWINDOWEXTEX 9 +#define EMR_SETWINDOWORGEX 10 +#define EMR_SETVIEWPORTEXTEX 11 +#define EMR_SETVIEWPORTORGEX 12 +#define EMR_SETBRUSHORGEX 13 +#define EMR_EOF 14 +#define EMR_SETPIXELV 15 +#define EMR_SETMAPPERFLAGS 16 +#define EMR_SETMAPMODE 17 +#define EMR_SETBKMODE 18 +#define EMR_SETPOLYFILLMODE 19 +#define EMR_SETROP2 20 +#define EMR_SETSTRETCHBLTMODE 21 +#define EMR_SETTEXTALIGN 22 +#define EMR_SETCOLORADJUSTMENT 23 +#define EMR_SETTEXTCOLOR 24 +#define EMR_SETBKCOLOR 25 +#define EMR_OFFSETCLIPRGN 26 +#define EMR_MOVETOEX 27 +#define EMR_SETMETARGN 28 +#define EMR_EXCLUDECLIPRECT 29 +#define EMR_INTERSECTCLIPRECT 30 +#define EMR_SCALEVIEWPORTEXTEX 31 +#define EMR_SCALEWINDOWEXTEX 32 +#define EMR_SAVEDC 33 +#define EMR_RESTOREDC 34 +#define EMR_SETWORLDTRANSFORM 35 +#define EMR_MODIFYWORLDTRANSFORM 36 +#define EMR_SELECTOBJECT 37 +#define EMR_CREATEPEN 38 +#define EMR_CREATEBRUSHINDIRECT 39 +#define EMR_DELETEOBJECT 40 +#define EMR_ANGLEARC 41 +#define EMR_ELLIPSE 42 +#define EMR_RECTANGLE 43 +#define EMR_ROUNDRECT 44 +#define EMR_ARC 45 +#define EMR_CHORD 46 +#define EMR_PIE 47 +#define EMR_SELECTPALETTE 48 +#define EMR_CREATEPALETTE 49 +#define EMR_SETPALETTEENTRIES 50 +#define EMR_RESIZEPALETTE 51 +#define EMR_REALIZEPALETTE 52 +#define EMR_EXTFLOODFILL 53 +#define EMR_LINETO 54 +#define EMR_ARCTO 55 +#define EMR_POLYDRAW 56 +#define EMR_SETARCDIRECTION 57 +#define EMR_SETMITERLIMIT 58 +#define EMR_BEGINPATH 59 +#define EMR_ENDPATH 60 +#define EMR_CLOSEFIGURE 61 +#define EMR_FILLPATH 62 +#define EMR_STROKEANDFILLPATH 63 +#define EMR_STROKEPATH 64 +#define EMR_FLATTENPATH 65 +#define EMR_WIDENPATH 66 +#define EMR_SELECTCLIPPATH 67 +#define EMR_ABORTPATH 68 + +#define EMR_GDICOMMENT 70 +#define EMR_FILLRGN 71 +#define EMR_FRAMERGN 72 +#define EMR_INVERTRGN 73 +#define EMR_PAINTRGN 74 +#define EMR_EXTSELECTCLIPRGN 75 +#define EMR_BITBLT 76 +#define EMR_STRETCHBLT 77 +#define EMR_MASKBLT 78 +#define EMR_PLGBLT 79 +#define EMR_SETDIBITSTODEVICE 80 +#define EMR_STRETCHDIBITS 81 +#define EMR_EXTCREATEFONTINDIRECTW 82 +#define EMR_EXTTEXTOUTA 83 +#define EMR_EXTTEXTOUTW 84 +#define EMR_POLYBEZIER16 85 +#define EMR_POLYGON16 86 +#define EMR_POLYLINE16 87 +#define EMR_POLYBEZIERTO16 88 +#define EMR_POLYLINETO16 89 +#define EMR_POLYPOLYLINE16 90 +#define EMR_POLYPOLYGON16 91 +#define EMR_POLYDRAW16 92 +#define EMR_CREATEMONOBRUSH 93 +#define EMR_CREATEDIBPATTERNBRUSHPT 94 +#define EMR_EXTCREATEPEN 95 +#define EMR_POLYTEXTOUTA 96 +#define EMR_POLYTEXTOUTW 97 + +#define EMR_SETICMMODE 98 +#define EMR_CREATECOLORSPACE 99 +#define EMR_SETCOLORSPACE 100 +#define EMR_DELETECOLORSPACE 101 +#define EMR_GLSRECORD 102 +#define EMR_GLSBOUNDEDRECORD 103 +#define EMR_PIXELFORMAT 104 +#define EMR_RESERVED_105 105 +#define EMR_RESERVED_106 106 +#define EMR_RESERVED_107 107 +#define EMR_RESERVED_108 108 +#define EMR_RESERVED_109 109 +#define EMR_RESERVED_110 110 +#define EMR_COLORCORRECTPALETTE 111 +#define EMR_SETICMPROFILEA 112 +#define EMR_SETICMPROFILEW 113 +#define EMR_ALPHABLEND 114 +#define EMR_SETLAYOUT 115 +#define EMR_TRANSPARENTBLT 116 +#define EMR_RESERVED_117 117 +#define EMR_GRADIENTFILL 118 +#define EMR_RESERVED_119 119 +#define EMR_RESERVED_120 120 +#define EMR_COLORMATCHTOTARGETW 121 +#define EMR_CREATECOLORSPACEW 122 + +#define EMR_MIN 1 + +#define EMR_MAX 122 + + typedef struct tagEMR { + DWORD iType; + DWORD nSize; + } EMR,*PEMR; + + typedef struct tagEMRTEXT { + POINTL ptlReference; + DWORD nChars; + DWORD offString; + DWORD fOptions; + RECTL rcl; + DWORD offDx; + } EMRTEXT,*PEMRTEXT; + + typedef struct tagABORTPATH { + EMR emr; + } EMRABORTPATH,*PEMRABORTPATH,EMRBEGINPATH,*PEMRBEGINPATH,EMRENDPATH,*PEMRENDPATH,EMRCLOSEFIGURE,*PEMRCLOSEFIGURE,EMRFLATTENPATH,*PEMRFLATTENPATH,EMRWIDENPATH,*PEMRWIDENPATH,EMRSETMETARGN,*PEMRSETMETARGN,EMRSAVEDC,*PEMRSAVEDC,EMRREALIZEPALETTE,*PEMRREALIZEPALETTE; + + typedef struct tagEMRSELECTCLIPPATH { + EMR emr; + DWORD iMode; + } EMRSELECTCLIPPATH,*PEMRSELECTCLIPPATH,EMRSETBKMODE,*PEMRSETBKMODE,EMRSETMAPMODE,*PEMRSETMAPMODE,EMRSETLAYOUT,*PEMRSETLAYOUT, + EMRSETPOLYFILLMODE,*PEMRSETPOLYFILLMODE,EMRSETROP2,*PEMRSETROP2,EMRSETSTRETCHBLTMODE,*PEMRSETSTRETCHBLTMODE,EMRSETICMMODE, + *PEMRSETICMMODE,EMRSETTEXTALIGN,*PEMRSETTEXTALIGN; + + typedef struct tagEMRSETMITERLIMIT { + EMR emr; + FLOAT eMiterLimit; + } EMRSETMITERLIMIT,*PEMRSETMITERLIMIT; + + typedef struct tagEMRRESTOREDC { + EMR emr; + LONG iRelative; + } EMRRESTOREDC,*PEMRRESTOREDC; + + typedef struct tagEMRSETARCDIRECTION { + EMR emr; + DWORD iArcDirection; + + } EMRSETARCDIRECTION,*PEMRSETARCDIRECTION; + + typedef struct tagEMRSETMAPPERFLAGS { + EMR emr; + DWORD dwFlags; + } EMRSETMAPPERFLAGS,*PEMRSETMAPPERFLAGS; + + typedef struct tagEMRSETTEXTCOLOR { + EMR emr; + COLORREF crColor; + } EMRSETBKCOLOR,*PEMRSETBKCOLOR,EMRSETTEXTCOLOR,*PEMRSETTEXTCOLOR; + + typedef struct tagEMRSELECTOBJECT { + EMR emr; + DWORD ihObject; + } EMRSELECTOBJECT,*PEMRSELECTOBJECT,EMRDELETEOBJECT,*PEMRDELETEOBJECT; + + typedef struct tagEMRSELECTPALETTE { + EMR emr; + DWORD ihPal; + } EMRSELECTPALETTE,*PEMRSELECTPALETTE; + + typedef struct tagEMRRESIZEPALETTE { + EMR emr; + DWORD ihPal; + DWORD cEntries; + } EMRRESIZEPALETTE,*PEMRRESIZEPALETTE; + + typedef struct tagEMRSETPALETTEENTRIES { + EMR emr; + DWORD ihPal; + DWORD iStart; + DWORD cEntries; + PALETTEENTRY aPalEntries[1]; + } EMRSETPALETTEENTRIES,*PEMRSETPALETTEENTRIES; + + typedef struct tagEMRSETCOLORADJUSTMENT { + EMR emr; + COLORADJUSTMENT ColorAdjustment; + } EMRSETCOLORADJUSTMENT,*PEMRSETCOLORADJUSTMENT; + + typedef struct tagEMRGDICOMMENT { + EMR emr; + DWORD cbData; + BYTE Data[1]; + } EMRGDICOMMENT,*PEMRGDICOMMENT; + + typedef struct tagEMREOF { + EMR emr; + DWORD nPalEntries; + DWORD offPalEntries; + DWORD nSizeLast; + } EMREOF,*PEMREOF; + + typedef struct tagEMRLINETO { + EMR emr; + POINTL ptl; + } EMRLINETO,*PEMRLINETO,EMRMOVETOEX,*PEMRMOVETOEX; + + typedef struct tagEMROFFSETCLIPRGN { + EMR emr; + POINTL ptlOffset; + } EMROFFSETCLIPRGN,*PEMROFFSETCLIPRGN; + + typedef struct tagEMRFILLPATH { + EMR emr; + RECTL rclBounds; + } EMRFILLPATH,*PEMRFILLPATH,EMRSTROKEANDFILLPATH,*PEMRSTROKEANDFILLPATH,EMRSTROKEPATH,*PEMRSTROKEPATH; + + typedef struct tagEMREXCLUDECLIPRECT { + EMR emr; + RECTL rclClip; + } EMREXCLUDECLIPRECT,*PEMREXCLUDECLIPRECT,EMRINTERSECTCLIPRECT,*PEMRINTERSECTCLIPRECT; + + typedef struct tagEMRSETVIEWPORTORGEX { + EMR emr; + POINTL ptlOrigin; + } EMRSETVIEWPORTORGEX,*PEMRSETVIEWPORTORGEX,EMRSETWINDOWORGEX,*PEMRSETWINDOWORGEX,EMRSETBRUSHORGEX,*PEMRSETBRUSHORGEX; + + typedef struct tagEMRSETVIEWPORTEXTEX { + EMR emr; + SIZEL szlExtent; + } EMRSETVIEWPORTEXTEX,*PEMRSETVIEWPORTEXTEX,EMRSETWINDOWEXTEX,*PEMRSETWINDOWEXTEX; + + typedef struct tagEMRSCALEVIEWPORTEXTEX { + EMR emr; + LONG xNum; + LONG xDenom; + LONG yNum; + LONG yDenom; + } EMRSCALEVIEWPORTEXTEX,*PEMRSCALEVIEWPORTEXTEX,EMRSCALEWINDOWEXTEX,*PEMRSCALEWINDOWEXTEX; + + typedef struct tagEMRSETWORLDTRANSFORM { + EMR emr; + XFORM xform; + } EMRSETWORLDTRANSFORM,*PEMRSETWORLDTRANSFORM; + + typedef struct tagEMRMODIFYWORLDTRANSFORM { + EMR emr; + XFORM xform; + DWORD iMode; + } EMRMODIFYWORLDTRANSFORM,*PEMRMODIFYWORLDTRANSFORM; + + typedef struct tagEMRSETPIXELV { + EMR emr; + POINTL ptlPixel; + COLORREF crColor; + } EMRSETPIXELV,*PEMRSETPIXELV; + + typedef struct tagEMREXTFLOODFILL { + EMR emr; + POINTL ptlStart; + COLORREF crColor; + DWORD iMode; + } EMREXTFLOODFILL,*PEMREXTFLOODFILL; + + typedef struct tagEMRELLIPSE { + EMR emr; + RECTL rclBox; + } EMRELLIPSE,*PEMRELLIPSE,EMRRECTANGLE,*PEMRRECTANGLE; + + typedef struct tagEMRROUNDRECT { + EMR emr; + RECTL rclBox; + SIZEL szlCorner; + } EMRROUNDRECT,*PEMRROUNDRECT; + + typedef struct tagEMRARC { + EMR emr; + RECTL rclBox; + POINTL ptlStart; + POINTL ptlEnd; + } EMRARC,*PEMRARC,EMRARCTO,*PEMRARCTO,EMRCHORD,*PEMRCHORD,EMRPIE,*PEMRPIE; + + typedef struct tagEMRANGLEARC { + EMR emr; + POINTL ptlCenter; + DWORD nRadius; + FLOAT eStartAngle; + FLOAT eSweepAngle; + } EMRANGLEARC,*PEMRANGLEARC; + + typedef struct tagEMRPOLYLINE { + EMR emr; + RECTL rclBounds; + DWORD cptl; + POINTL aptl[1]; + } EMRPOLYLINE,*PEMRPOLYLINE,EMRPOLYBEZIER,*PEMRPOLYBEZIER,EMRPOLYGON,*PEMRPOLYGON,EMRPOLYBEZIERTO,*PEMRPOLYBEZIERTO,EMRPOLYLINETO,*PEMRPOLYLINETO; + + typedef struct tagEMRPOLYLINE16 { + EMR emr; + RECTL rclBounds; + DWORD cpts; + POINTS apts[1]; + } EMRPOLYLINE16,*PEMRPOLYLINE16,EMRPOLYBEZIER16,*PEMRPOLYBEZIER16,EMRPOLYGON16,*PEMRPOLYGON16,EMRPOLYBEZIERTO16,*PEMRPOLYBEZIERTO16,EMRPOLYLINETO16,*PEMRPOLYLINETO16; + + typedef struct tagEMRPOLYDRAW { + EMR emr; + RECTL rclBounds; + DWORD cptl; + POINTL aptl[1]; + BYTE abTypes[1]; + } EMRPOLYDRAW,*PEMRPOLYDRAW; + + typedef struct tagEMRPOLYDRAW16 { + EMR emr; + RECTL rclBounds; + DWORD cpts; + POINTS apts[1]; + BYTE abTypes[1]; + } EMRPOLYDRAW16,*PEMRPOLYDRAW16; + + typedef struct tagEMRPOLYPOLYLINE { + EMR emr; + RECTL rclBounds; + DWORD nPolys; + DWORD cptl; + DWORD aPolyCounts[1]; + POINTL aptl[1]; + } EMRPOLYPOLYLINE,*PEMRPOLYPOLYLINE,EMRPOLYPOLYGON,*PEMRPOLYPOLYGON; + + typedef struct tagEMRPOLYPOLYLINE16 { + EMR emr; + RECTL rclBounds; + DWORD nPolys; + DWORD cpts; + DWORD aPolyCounts[1]; + POINTS apts[1]; + } EMRPOLYPOLYLINE16,*PEMRPOLYPOLYLINE16,EMRPOLYPOLYGON16,*PEMRPOLYPOLYGON16; + + typedef struct tagEMRINVERTRGN { + EMR emr; + RECTL rclBounds; + DWORD cbRgnData; + BYTE RgnData[1]; + } EMRINVERTRGN,*PEMRINVERTRGN,EMRPAINTRGN,*PEMRPAINTRGN; + + typedef struct tagEMRFILLRGN { + EMR emr; + RECTL rclBounds; + DWORD cbRgnData; + DWORD ihBrush; + BYTE RgnData[1]; + } EMRFILLRGN,*PEMRFILLRGN; + + typedef struct tagEMRFRAMERGN { + EMR emr; + RECTL rclBounds; + DWORD cbRgnData; + DWORD ihBrush; + SIZEL szlStroke; + BYTE RgnData[1]; + } EMRFRAMERGN,*PEMRFRAMERGN; + + typedef struct tagEMREXTSELECTCLIPRGN { + EMR emr; + DWORD cbRgnData; + DWORD iMode; + BYTE RgnData[1]; + } EMREXTSELECTCLIPRGN,*PEMREXTSELECTCLIPRGN; + + typedef struct tagEMREXTTEXTOUTA { + EMR emr; + RECTL rclBounds; + DWORD iGraphicsMode; + FLOAT exScale; + FLOAT eyScale; + EMRTEXT emrtext; + } EMREXTTEXTOUTA,*PEMREXTTEXTOUTA,EMREXTTEXTOUTW,*PEMREXTTEXTOUTW; + + typedef struct tagEMRPOLYTEXTOUTA { + EMR emr; + RECTL rclBounds; + DWORD iGraphicsMode; + FLOAT exScale; + FLOAT eyScale; + LONG cStrings; + EMRTEXT aemrtext[1]; + } EMRPOLYTEXTOUTA,*PEMRPOLYTEXTOUTA,EMRPOLYTEXTOUTW,*PEMRPOLYTEXTOUTW; + + typedef struct tagEMRBITBLT { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + } EMRBITBLT,*PEMRBITBLT; + + typedef struct tagEMRSTRETCHBLT { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG cxSrc; + LONG cySrc; + } EMRSTRETCHBLT,*PEMRSTRETCHBLT; + + typedef struct tagEMRMASKBLT { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG xMask; + LONG yMask; + DWORD iUsageMask; + DWORD offBmiMask; + DWORD cbBmiMask; + DWORD offBitsMask; + DWORD cbBitsMask; + } EMRMASKBLT,*PEMRMASKBLT; + + typedef struct tagEMRPLGBLT { + EMR emr; + RECTL rclBounds; + POINTL aptlDest[3]; + LONG xSrc; + LONG ySrc; + LONG cxSrc; + LONG cySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG xMask; + LONG yMask; + DWORD iUsageMask; + DWORD offBmiMask; + DWORD cbBmiMask; + DWORD offBitsMask; + DWORD cbBitsMask; + } EMRPLGBLT,*PEMRPLGBLT; + + typedef struct tagEMRSETDIBITSTODEVICE { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG xSrc; + LONG ySrc; + LONG cxSrc; + LONG cySrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + DWORD iUsageSrc; + DWORD iStartScan; + DWORD cScans; + } EMRSETDIBITSTODEVICE,*PEMRSETDIBITSTODEVICE; + + typedef struct tagEMRSTRETCHDIBITS { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG xSrc; + LONG ySrc; + LONG cxSrc; + LONG cySrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + DWORD iUsageSrc; + DWORD dwRop; + LONG cxDest; + LONG cyDest; + } EMRSTRETCHDIBITS,*PEMRSTRETCHDIBITS; + + typedef struct tagEMREXTCREATEFONTINDIRECTW { + EMR emr; + DWORD ihFont; + EXTLOGFONTW elfw; + } EMREXTCREATEFONTINDIRECTW,*PEMREXTCREATEFONTINDIRECTW; + + typedef struct tagEMRCREATEPALETTE { + EMR emr; + DWORD ihPal; + LOGPALETTE lgpl; + } EMRCREATEPALETTE,*PEMRCREATEPALETTE; + + typedef struct tagEMRCREATEPEN { + EMR emr; + DWORD ihPen; + LOGPEN lopn; + } EMRCREATEPEN,*PEMRCREATEPEN; + + typedef struct tagEMREXTCREATEPEN { + EMR emr; + DWORD ihPen; + DWORD offBmi; + DWORD cbBmi; + DWORD offBits; + DWORD cbBits; + EXTLOGPEN elp; + } EMREXTCREATEPEN,*PEMREXTCREATEPEN; + + typedef struct tagEMRCREATEBRUSHINDIRECT { + EMR emr; + DWORD ihBrush; + LOGBRUSH32 lb; + } EMRCREATEBRUSHINDIRECT,*PEMRCREATEBRUSHINDIRECT; + + typedef struct tagEMRCREATEMONOBRUSH { + EMR emr; + DWORD ihBrush; + DWORD iUsage; + DWORD offBmi; + DWORD cbBmi; + DWORD offBits; + DWORD cbBits; + } EMRCREATEMONOBRUSH,*PEMRCREATEMONOBRUSH; + + typedef struct tagEMRCREATEDIBPATTERNBRUSHPT { + EMR emr; + DWORD ihBrush; + DWORD iUsage; + DWORD offBmi; + DWORD cbBmi; + DWORD offBits; + DWORD cbBits; + } EMRCREATEDIBPATTERNBRUSHPT,*PEMRCREATEDIBPATTERNBRUSHPT; + + typedef struct tagEMRFORMAT { + DWORD dSignature; + DWORD nVersion; + DWORD cbData; + DWORD offData; + } EMRFORMAT,*PEMRFORMAT; + + typedef struct tagEMRGLSRECORD { + EMR emr; + DWORD cbData; + BYTE Data[1]; + } EMRGLSRECORD,*PEMRGLSRECORD; + + typedef struct tagEMRGLSBOUNDEDRECORD { + EMR emr; + RECTL rclBounds; + DWORD cbData; + BYTE Data[1]; + } EMRGLSBOUNDEDRECORD,*PEMRGLSBOUNDEDRECORD; + + typedef struct tagEMRPIXELFORMAT { + EMR emr; + PIXELFORMATDESCRIPTOR pfd; + } EMRPIXELFORMAT,*PEMRPIXELFORMAT; + + typedef struct tagEMRCREATECOLORSPACE { + EMR emr; + DWORD ihCS; + LOGCOLORSPACEA lcs; + } EMRCREATECOLORSPACE,*PEMRCREATECOLORSPACE; + + typedef struct tagEMRSETCOLORSPACE { + EMR emr; + DWORD ihCS; + } EMRSETCOLORSPACE,*PEMRSETCOLORSPACE,EMRSELECTCOLORSPACE,*PEMRSELECTCOLORSPACE,EMRDELETECOLORSPACE,*PEMRDELETECOLORSPACE; + + typedef struct tagEMREXTESCAPE { + EMR emr; + INT iEscape; + INT cbEscData; + BYTE EscData[1]; + } EMREXTESCAPE,*PEMREXTESCAPE,EMRDRAWESCAPE,*PEMRDRAWESCAPE; + + typedef struct tagEMRNAMEDESCAPE { + EMR emr; + INT iEscape; + INT cbDriver; + INT cbEscData; + BYTE EscData[1]; + } EMRNAMEDESCAPE,*PEMRNAMEDESCAPE; + +#define SETICMPROFILE_EMBEDED 0x00000001 + + typedef struct tagEMRSETICMPROFILE { + EMR emr; + DWORD dwFlags; + DWORD cbName; + DWORD cbData; + BYTE Data[1]; + } EMRSETICMPROFILE,*PEMRSETICMPROFILE,EMRSETICMPROFILEA,*PEMRSETICMPROFILEA,EMRSETICMPROFILEW,*PEMRSETICMPROFILEW; + +#define CREATECOLORSPACE_EMBEDED 0x00000001 + + typedef struct tagEMRCREATECOLORSPACEW { + EMR emr; + DWORD ihCS; + LOGCOLORSPACEW lcs; + DWORD dwFlags; + DWORD cbData; + BYTE Data[1]; + } EMRCREATECOLORSPACEW,*PEMRCREATECOLORSPACEW; + +#define COLORMATCHTOTARGET_EMBEDED 0x00000001 + + typedef struct tagCOLORMATCHTOTARGET { + EMR emr; + DWORD dwAction; + DWORD dwFlags; + DWORD cbName; + DWORD cbData; + BYTE Data[1]; + } EMRCOLORMATCHTOTARGET,*PEMRCOLORMATCHTOTARGET; + + typedef struct tagCOLORCORRECTPALETTE { + EMR emr; + DWORD ihPalette; + DWORD nFirstEntry; + DWORD nPalEntries; + DWORD nReserved; + } EMRCOLORCORRECTPALETTE,*PEMRCOLORCORRECTPALETTE; + + typedef struct tagEMRALPHABLEND { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG cxSrc; + LONG cySrc; + } EMRALPHABLEND,*PEMRALPHABLEND; + + typedef struct tagEMRGRADIENTFILL { + EMR emr; + RECTL rclBounds; + DWORD nVer; + DWORD nTri; + ULONG ulMode; + TRIVERTEX Ver[1]; + } EMRGRADIENTFILL,*PEMRGRADIENTFILL; + + typedef struct tagEMRTRANSPARENTBLT { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG cxSrc; + LONG cySrc; + } EMRTRANSPARENTBLT,*PEMRTRANSPARENTBLT; + +#define GDICOMMENT_IDENTIFIER 0x43494447 +#define GDICOMMENT_WINDOWS_METAFILE 0x80000001 +#define GDICOMMENT_BEGINGROUP 0x00000002 +#define GDICOMMENT_ENDGROUP 0x00000003 +#define GDICOMMENT_MULTIFORMATS 0x40000004 +#define EPS_SIGNATURE 0x46535045 +#define GDICOMMENT_UNICODE_STRING 0x00000040 +#define GDICOMMENT_UNICODE_END 0x00000080 +#endif + +#ifdef UNICODE +#define wglUseFontBitmaps wglUseFontBitmapsW +#else +#define wglUseFontBitmaps wglUseFontBitmapsA +#endif + + WINGDIAPI WINBOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT); + WINGDIAPI HGLRC WINAPI wglCreateContext(HDC); + WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int); + WINGDIAPI WINBOOL WINAPI wglDeleteContext(HGLRC); + WINGDIAPI HGLRC WINAPI wglGetCurrentContext(VOID); + WINGDIAPI HDC WINAPI wglGetCurrentDC(VOID); + WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR); + WINGDIAPI WINBOOL WINAPI wglMakeCurrent(HDC,HGLRC); + WINGDIAPI WINBOOL WINAPI wglShareLists(HGLRC,HGLRC); + WINGDIAPI WINBOOL WINAPI wglUseFontBitmapsA(HDC,DWORD,DWORD,DWORD); + WINGDIAPI WINBOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD); + WINGDIAPI WINBOOL WINAPI SwapBuffers(HDC); + + typedef struct _POINTFLOAT { + FLOAT x; + FLOAT y; + } POINTFLOAT,*PPOINTFLOAT; + + typedef struct _GLYPHMETRICSFLOAT { + FLOAT gmfBlackBoxX; + FLOAT gmfBlackBoxY; + POINTFLOAT gmfptGlyphOrigin; + FLOAT gmfCellIncX; + FLOAT gmfCellIncY; + } GLYPHMETRICSFLOAT,*PGLYPHMETRICSFLOAT,*LPGLYPHMETRICSFLOAT; + +#define WGL_FONT_LINES 0 +#define WGL_FONT_POLYGONS 1 + +#ifdef UNICODE +#define wglUseFontOutlines wglUseFontOutlinesW +#else +#define wglUseFontOutlines wglUseFontOutlinesA +#endif + + WINGDIAPI WINBOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); + WINGDIAPI WINBOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); + + typedef struct tagLAYERPLANEDESCRIPTOR { + WORD nSize; + WORD nVersion; + DWORD dwFlags; + BYTE iPixelType; + BYTE cColorBits; + BYTE cRedBits; + BYTE cRedShift; + BYTE cGreenBits; + BYTE cGreenShift; + BYTE cBlueBits; + BYTE cBlueShift; + BYTE cAlphaBits; + BYTE cAlphaShift; + BYTE cAccumBits; + BYTE cAccumRedBits; + BYTE cAccumGreenBits; + BYTE cAccumBlueBits; + BYTE cAccumAlphaBits; + BYTE cDepthBits; + BYTE cStencilBits; + BYTE cAuxBuffers; + BYTE iLayerPlane; + BYTE bReserved; + COLORREF crTransparent; + } LAYERPLANEDESCRIPTOR,*PLAYERPLANEDESCRIPTOR,*LPLAYERPLANEDESCRIPTOR; + +#define LPD_DOUBLEBUFFER 0x00000001 +#define LPD_STEREO 0x00000002 +#define LPD_SUPPORT_GDI 0x00000010 +#define LPD_SUPPORT_OPENGL 0x00000020 +#define LPD_SHARE_DEPTH 0x00000040 +#define LPD_SHARE_STENCIL 0x00000080 +#define LPD_SHARE_ACCUM 0x00000100 +#define LPD_SWAP_EXCHANGE 0x00000200 +#define LPD_SWAP_COPY 0x00000400 +#define LPD_TRANSPARENT 0x00001000 + +#define LPD_TYPE_RGBA 0 +#define LPD_TYPE_COLORINDEX 1 + +#define WGL_SWAP_MAIN_PLANE 0x00000001 +#define WGL_SWAP_OVERLAY1 0x00000002 +#define WGL_SWAP_OVERLAY2 0x00000004 +#define WGL_SWAP_OVERLAY3 0x00000008 +#define WGL_SWAP_OVERLAY4 0x00000010 +#define WGL_SWAP_OVERLAY5 0x00000020 +#define WGL_SWAP_OVERLAY6 0x00000040 +#define WGL_SWAP_OVERLAY7 0x00000080 +#define WGL_SWAP_OVERLAY8 0x00000100 +#define WGL_SWAP_OVERLAY9 0x00000200 +#define WGL_SWAP_OVERLAY10 0x00000400 +#define WGL_SWAP_OVERLAY11 0x00000800 +#define WGL_SWAP_OVERLAY12 0x00001000 +#define WGL_SWAP_OVERLAY13 0x00002000 +#define WGL_SWAP_OVERLAY14 0x00004000 +#define WGL_SWAP_OVERLAY15 0x00008000 +#define WGL_SWAP_UNDERLAY1 0x00010000 +#define WGL_SWAP_UNDERLAY2 0x00020000 +#define WGL_SWAP_UNDERLAY3 0x00040000 +#define WGL_SWAP_UNDERLAY4 0x00080000 +#define WGL_SWAP_UNDERLAY5 0x00100000 +#define WGL_SWAP_UNDERLAY6 0x00200000 +#define WGL_SWAP_UNDERLAY7 0x00400000 +#define WGL_SWAP_UNDERLAY8 0x00800000 +#define WGL_SWAP_UNDERLAY9 0x01000000 +#define WGL_SWAP_UNDERLAY10 0x02000000 +#define WGL_SWAP_UNDERLAY11 0x04000000 +#define WGL_SWAP_UNDERLAY12 0x08000000 +#define WGL_SWAP_UNDERLAY13 0x10000000 +#define WGL_SWAP_UNDERLAY14 0x20000000 +#define WGL_SWAP_UNDERLAY15 0x40000000 + + WINGDIAPI WINBOOL WINAPI wglDescribeLayerPlane(HDC,int,int,UINT,LPLAYERPLANEDESCRIPTOR); + WINGDIAPI int WINAPI wglSetLayerPaletteEntries(HDC,int,int,int,CONST COLORREF *); + WINGDIAPI int WINAPI wglGetLayerPaletteEntries(HDC,int,int,int,COLORREF *); + WINGDIAPI WINBOOL WINAPI wglRealizeLayerPalette(HDC,int,WINBOOL); + WINGDIAPI WINBOOL WINAPI wglSwapLayerBuffers(HDC,UINT); + + typedef struct _WGLSWAP { + HDC hdc; + UINT uiFlags; + } WGLSWAP,*PWGLSWAP,*LPWGLSWAP; + +#define WGL_SWAPMULTIPLE_MAX 16 + + WINGDIAPI DWORD WINAPI wglSwapMultipleBuffers(UINT,CONST WGLSWAP *); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winnt.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winnt.h new file mode 100644 index 00000000..4cf685d2 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winnt.h @@ -0,0 +1,5835 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINNT_ +#define _WINNT_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#define ANYSIZE_ARRAY 1 + +//gr #include + +#define RESTRICTED_POINTER + +#ifndef __CRT_UNALIGNED +#define __CRT_UNALIGNED +#endif + +#if defined(__ia64__) || defined(__x86_64) +#define UNALIGNED __CRT_UNALIGNED +#ifdef _WIN64 +#define UNALIGNED64 __CRT_UNALIGNED +#else +#define UNALIGNED64 +#endif +#else +#define UNALIGNED +#define UNALIGNED64 +#endif + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && (defined(_X86_) && !defined(__x86_64)) +#define I_X86_ +#endif + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(__x86_64) +#define _AMD64_ +#endif + +#if !defined(I_X86_) && !(defined(_X86_) && !defined(__x86_64)) && !defined(_AMD64_) && defined(__ia64__) +#if !defined(_IA64_) +#define _IA64_ +#endif +#endif + + +#ifdef _WIN64 +#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG) +#define MEMORY_ALLOCATION_ALIGNMENT 16 +#else +#define MAX_NATURAL_ALIGNMENT sizeof(DWORD) +#define MEMORY_ALLOCATION_ALIGNMENT 8 +#endif + +#ifdef __cplusplus +#define TYPE_ALIGNMENT(t) __alignof__ (t) +#else +#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; },test) +#endif + +#ifdef _WIN64 +#ifdef _AMD64_ +#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD) +#elif defined(_IA64_) +#define PROBE_ALIGNMENT(_s) (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD)) +#else +#error No Target Architecture +#endif +#define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD) +#else +#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD) +#endif + +#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] + +#include + +#if defined(_X86_) || defined(__ia64__) || defined(__x86_64) +#define DECLSPEC_IMPORT __declspec(dllimport) +#else +#define DECLSPEC_IMPORT +#endif + +#ifndef DECLSPEC_NORETURN +#define DECLSPEC_NORETURN __declspec(noreturn) +#endif + +#ifndef DECLSPEC_ALIGN +#define DECLSPEC_ALIGN(x) __attribute__ ((aligned(x))) +#endif + +#ifndef SYSTEM_CACHE_ALIGNMENT_SIZE +#if defined(_AMD64_) || defined(I_X86_) +#define SYSTEM_CACHE_ALIGNMENT_SIZE 64 +#else +#define SYSTEM_CACHE_ALIGNMENT_SIZE 128 +#endif +#endif + +#ifndef DECLSPEC_CACHEALIGN +#define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE) +#endif + +#ifndef DECLSPEC_UUID +#define DECLSPEC_UUID(x) +#endif + +#ifndef DECLSPEC_NOVTABLE +#define DECLSPEC_NOVTABLE +#endif + +#ifndef DECLSPEC_SELECTANY +#define DECLSPEC_SELECTANY __declspec(selectany) +#endif + +#ifndef NOP_FUNCTION +#define NOP_FUNCTION (void)0 +#endif + +#ifndef DECLSPEC_NOINLINE +#define DECLSPEC_NOINLINE +#endif + +#ifndef FORCEINLINE +#define FORCEINLINE static __inline__ +#endif + +#ifndef DECLSPEC_DEPRECATED +#define DECLSPEC_DEPRECATED __declspec(deprecated) +#define DEPRECATE_SUPPORTED +#endif + +#define DECLSPEC_DEPRECATED_DDK +#define PRAGMA_DEPRECATED_DDK 0 + + typedef void *PVOID; + typedef void *PVOID64; + +#define NTAPI __stdcall +#define NTSYSAPI DECLSPEC_IMPORT +#define NTSYSCALLAPI DECLSPEC_IMPORT + +#ifndef VOID +#define VOID void + typedef char CHAR; + typedef short SHORT; + typedef long LONG; +#endif + + typedef wchar_t WCHAR; + typedef WCHAR *PWCHAR,*LPWCH,*PWCH; + typedef CONST WCHAR *LPCWCH,*PCWCH; + typedef WCHAR *NWPSTR,*LPWSTR,*PWSTR; + typedef PWSTR *PZPWSTR; + typedef CONST PWSTR *PCZPWSTR; + typedef WCHAR UNALIGNED *LPUWSTR,*PUWSTR; + typedef CONST WCHAR *LPCWSTR,*PCWSTR; + typedef PCWSTR *PZPCWSTR; + typedef CONST WCHAR UNALIGNED *LPCUWSTR,*PCUWSTR; + typedef CHAR *PCHAR,*LPCH,*PCH; + typedef CONST CHAR *LPCCH,*PCCH; + typedef CHAR *NPSTR,*LPSTR,*PSTR; + typedef PSTR *PZPSTR; + typedef CONST PSTR *PCZPSTR; + typedef CONST CHAR *LPCSTR,*PCSTR; + typedef PCSTR *PZPCSTR; + +#ifdef UNICODE +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED + typedef WCHAR TCHAR,*PTCHAR; + typedef WCHAR TBYTE ,*PTBYTE; +#endif + + typedef LPWSTR LPTCH,PTCH; + typedef LPWSTR PTSTR,LPTSTR; + typedef LPCWSTR PCTSTR,LPCTSTR; + typedef LPUWSTR PUTSTR,LPUTSTR; + typedef LPCUWSTR PCUTSTR,LPCUTSTR; + typedef LPWSTR LP; +#define __TEXT(quote) L##quote +#else +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED + typedef char TCHAR,*PTCHAR; + typedef unsigned char TBYTE ,*PTBYTE; +#endif + + typedef LPSTR LPTCH,PTCH; + typedef LPSTR PTSTR,LPTSTR,PUTSTR,LPUTSTR; + typedef LPCSTR PCTSTR,LPCTSTR,PCUTSTR,LPCUTSTR; +#define __TEXT(quote) quote +#endif + +#define TEXT(quote) __TEXT(quote) + + typedef SHORT *PSHORT; + typedef LONG *PLONG; + + typedef void *HANDLE; +#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name + typedef HANDLE *PHANDLE; + + typedef BYTE FCHAR; + typedef WORD FSHORT; + typedef DWORD FLONG; + +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED + typedef LONG HRESULT; +#endif + +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C extern +#endif + +#define STDMETHODCALLTYPE WINAPI +#define STDMETHODVCALLTYPE __cdecl +#define STDAPICALLTYPE WINAPI +#define STDAPIVCALLTYPE __cdecl +#define STDAPI EXTERN_C HRESULT WINAPI +#define STDAPI_(type) EXTERN_C type WINAPI +#define STDMETHODIMP HRESULT WINAPI +#define STDMETHODIMP_(type) type WINAPI +#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE +#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE +#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE +#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE + + typedef char CCHAR; +#ifndef _LCID_DEFINED +#define _LCID_DEFINED +typedef DWORD LCID; +#endif + typedef PDWORD PLCID; +#ifndef _LANGID_DEFINED +#define _LANGID_DEFINED + typedef WORD LANGID; +#endif +#define APPLICATION_ERROR_MASK 0x20000000 +#define ERROR_SEVERITY_SUCCESS 0x00000000 +#define ERROR_SEVERITY_INFORMATIONAL 0x40000000 +#define ERROR_SEVERITY_WARNING 0x80000000 +#define ERROR_SEVERITY_ERROR 0xC0000000 + +#ifdef __ia64__ + __declspec(align(16)) +#endif + typedef struct _FLOAT128 { + __int64 LowPart; + __int64 HighPart; + } FLOAT128; + + typedef FLOAT128 *PFLOAT128; + +#define _ULONGLONG_ +#if((!(defined(_X86_) && !defined(__x86_64)) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64))) + typedef __int64 LONGLONG; + typedef unsigned __int64 ULONGLONG; + +#define MAXLONGLONG (0x7fffffffffffffff) +#else + + typedef double LONGLONG; + typedef double ULONGLONG; +#endif + + typedef LONGLONG *PLONGLONG; + typedef ULONGLONG *PULONGLONG; + + typedef LONGLONG USN; + + typedef union _LARGE_INTEGER { + struct { + DWORD LowPart; + LONG HighPart; + }; + struct { + DWORD LowPart; + LONG HighPart; + } u; + LONGLONG QuadPart; + } LARGE_INTEGER; + + typedef LARGE_INTEGER *PLARGE_INTEGER; + + typedef union _ULARGE_INTEGER { + struct { + DWORD LowPart; + DWORD HighPart; + }; + struct { + DWORD LowPart; + DWORD HighPart; + } u; + ULONGLONG QuadPart; + } ULARGE_INTEGER; + + typedef ULARGE_INTEGER *PULARGE_INTEGER; + + typedef struct _LUID { + DWORD LowPart; + LONG HighPart; + } LUID,*PLUID; + +#define _DWORDLONG_ + typedef ULONGLONG DWORDLONG; + typedef DWORDLONG *PDWORDLONG; + +#ifdef RC_INVOKED +#define Int32x32To64(a,b) ((LONGLONG)((LONG)(a)) *(LONGLONG)((LONG)(b))) +#define UInt32x32To64(a,b) ((ULONGLONG)((DWORD)(a)) *(ULONGLONG)((DWORD)(b))) +#define Int64ShrlMod32(a,b) ((ULONGLONG)(a) >> (b)) +#elif (defined(_X86_) && !defined(__x86_64)) +#define Int32x32To64(a,b) (LONGLONG)((LONGLONG)(LONG)(a) *(LONG)(b)) +#define UInt32x32To64(a,b) (ULONGLONG)((ULONGLONG)(DWORD)(a) *(DWORD)(b)) +#define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b)) +#elif defined(__ia64__) || defined(__x86_64) +#define Int32x32To64(a,b) ((LONGLONG)((LONG)(a)) *(LONGLONG)((LONG)(b))) +#define UInt32x32To64(a,b) ((ULONGLONG)((DWORD)(a)) *(ULONGLONG)((DWORD)(b))) +#define Int64ShrlMod32(a,b) ((ULONGLONG)(a) >> (b)) +#else +#error Must define a target architecture. +#endif + +#define Int64ShraMod32(a,b) ((LONGLONG)(a) >> (b)) +#define Int64ShllMod32(a,b) ((ULONGLONG)(a) << (b)) + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef __x86_64 + +#define RotateLeft8 _rotl8 +#define RotateLeft16 _rotl16 +#define RotateRight8 _rotr8 +#define RotateRight16 _rotr16 + + unsigned char __cdecl _rotl8(unsigned char Value,unsigned char Shift); + unsigned short __cdecl _rotl16(unsigned short Value,unsigned char Shift); + unsigned char __cdecl _rotr8(unsigned char Value,unsigned char Shift); + unsigned short __cdecl _rotr16(unsigned short Value,unsigned char Shift); +#endif + +#define RotateLeft32 _rotl +#define RotateLeft64 _rotl64 +#define RotateRight32 _rotr +#define RotateRight64 _rotr64 + + unsigned int __cdecl _rotl(unsigned int Value,int Shift); + unsigned __int64 __cdecl _rotl64(unsigned __int64 Value,int Shift); + unsigned int __cdecl _rotr(unsigned int Value,int Shift); + unsigned __int64 __cdecl _rotr64(unsigned __int64 Value,int Shift); +#ifdef __cplusplus + } +#endif + +#define ANSI_NULL ((CHAR)0) +#define UNICODE_NULL ((WCHAR)0) +#define UNICODE_STRING_MAX_BYTES ((WORD) 65534) +#define UNICODE_STRING_MAX_CHARS (32767) + +#ifndef _BOOLEAN_ +#define _BOOLEAN_ + typedef BYTE BOOLEAN; +#endif + typedef BOOLEAN *PBOOLEAN; + + typedef struct _LIST_ENTRY { + struct _LIST_ENTRY *Flink; + struct _LIST_ENTRY *Blink; + } LIST_ENTRY,*PLIST_ENTRY,*RESTRICTED_POINTER PRLIST_ENTRY; + + typedef struct _SINGLE_LIST_ENTRY { + struct _SINGLE_LIST_ENTRY *Next; + } SINGLE_LIST_ENTRY,*PSINGLE_LIST_ENTRY; + + typedef struct LIST_ENTRY32 { + DWORD Flink; + DWORD Blink; + } LIST_ENTRY32; + typedef LIST_ENTRY32 *PLIST_ENTRY32; + + typedef struct LIST_ENTRY64 { + ULONGLONG Flink; + ULONGLONG Blink; + } LIST_ENTRY64; + typedef LIST_ENTRY64 *PLIST_ENTRY64; + +#include + +#ifndef __OBJECTID_DEFINED +#define __OBJECTID_DEFINED + typedef struct _OBJECTID { + GUID Lineage; + DWORD Uniquifier; + } OBJECTID; +#endif + +#define MINCHAR 0x80 +#define MAXCHAR 0x7f +#define MINSHORT 0x8000 +#define MAXSHORT 0x7fff +#define MINLONG 0x80000000 +#define MAXLONG 0x7fffffff +#define MAXBYTE 0xff +#define MAXWORD 0xffff +#define MAXDWORD 0xffffffff + +#define FIELD_OFFSET(type,field) ((LONG)(LONG_PTR)&(((type *)0)->field)) +#define RTL_FIELD_SIZE(type,field) (sizeof(((type *)0)->field)) +#define RTL_SIZEOF_THROUGH_FIELD(type,field) (FIELD_OFFSET(type,field) + RTL_FIELD_SIZE(type,field)) +#define RTL_CONTAINS_FIELD(Struct,Size,Field) ((((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size))) +#define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0])) +#define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A) + +#ifdef ENABLE_RTL_NUMBER_OF_V2 +#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A) +#else +#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A) +#endif + +#define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A) +#define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A) + +#define RTL_FIELD_TYPE(type,field) (((type*)0)->field) +#define RTL_NUMBER_OF_FIELD(type,field) (RTL_NUMBER_OF(RTL_FIELD_TYPE(type,field))) +#define RTL_PADDING_BETWEEN_FIELDS(T,F1,F2) ((FIELD_OFFSET(T,F2) > FIELD_OFFSET(T,F1)) ? (FIELD_OFFSET(T,F2) - FIELD_OFFSET(T,F1) - RTL_FIELD_SIZE(T,F1)) : (FIELD_OFFSET(T,F1) - FIELD_OFFSET(T,F2) - RTL_FIELD_SIZE(T,F2))) + +#ifdef __cplusplus +#define RTL_CONST_CAST(type) const_cast +#else +#define RTL_CONST_CAST(type) (type) +#endif + +#define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) *8) +#define RTL_BITS_OF_FIELD(type,field) (RTL_BITS_OF(RTL_FIELD_TYPE(type,field))) +#define CONTAINING_RECORD(address,type,field) ((type *)((PCHAR)(address) - (ULONG_PTR)(&((type *)0)->field))) + +#define VER_SERVER_NT 0x80000000 +#define VER_WORKSTATION_NT 0x40000000 +#define VER_SUITE_SMALLBUSINESS 0x00000001 +#define VER_SUITE_ENTERPRISE 0x00000002 +#define VER_SUITE_BACKOFFICE 0x00000004 +#define VER_SUITE_COMMUNICATIONS 0x00000008 +#define VER_SUITE_TERMINAL 0x00000010 +#define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020 +#define VER_SUITE_EMBEDDEDNT 0x00000040 +#define VER_SUITE_DATACENTER 0x00000080 +#define VER_SUITE_SINGLEUSERTS 0x00000100 +#define VER_SUITE_PERSONAL 0x00000200 +#define VER_SUITE_BLADE 0x00000400 +#define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800 +#define VER_SUITE_SECURITY_APPLIANCE 0x00001000 +#define VER_SUITE_STORAGE_SERVER 0x00002000 +#define VER_SUITE_COMPUTE_SERVER 0x00004000 + +#define PRODUCT_UNDEFINED 0x0 + +#define PRODUCT_ULTIMATE 0x1 +#define PRODUCT_HOME_BASIC 0x2 +#define PRODUCT_HOME_PREMIUM 0x3 +#define PRODUCT_ENTERPRISE 0x4 +#define PRODUCT_HOME_BASIC_N 0x5 +#define PRODUCT_BUSINESS 0x6 +#define PRODUCT_STANDARD_SERVER 0x7 +#define PRODUCT_DATACENTER_SERVER 0x8 +#define PRODUCT_SMALLBUSINESS_SERVER 0x9 +#define PRODUCT_ENTERPRISE_SERVER 0xa +#define PRODUCT_STARTER 0xb +#define PRODUCT_DATACENTER_SERVER_CORE 0xc +#define PRODUCT_STANDARD_SERVER_CORE 0xd +#define PRODUCT_ENTERPRISE_SERVER_CORE 0xe +#define PRODUCT_ENTERPRISE_SERVER_IA64 0xf +#define PRODUCT_BUSINESS_N 0x10 +#define PRODUCT_WEB_SERVER 0x11 +#define PRODUCT_CLUSTER_SERVER 0x12 +#define PRODUCT_HOME_SERVER 0x13 +#define PRODUCT_STORAGE_EXPRESS_SERVER 0x14 +#define PRODUCT_STORAGE_STANDARD_SERVER 0x15 +#define PRODUCT_STORAGE_WORKGROUP_SERVER 0x16 +#define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x17 +#define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x18 +#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x19 + +#define PRODUCT_UNLICENSED 0xabcdabcd + +#define LANG_NEUTRAL 0x00 +#define LANG_INVARIANT 0x7f + +#define LANG_AFRIKAANS 0x36 +#define LANG_ALBANIAN 0x1c +#define LANG_ALSATIAN 0x84 +#define LANG_AMHARIC 0x5e +#define LANG_ARABIC 0x01 +#define LANG_ARMENIAN 0x2b +#define LANG_ASSAMESE 0x4d +#define LANG_AZERI 0x2c +#define LANG_BASHKIR 0x6d +#define LANG_BASQUE 0x2d +#define LANG_BELARUSIAN 0x23 +#define LANG_BENGALI 0x45 +#define LANG_BRETON 0x7e +#define LANG_BOSNIAN 0x1a +#define LANG_BOSNIAN_NEUTRAL 0x781a +#define LANG_BULGARIAN 0x02 +#define LANG_CATALAN 0x03 +#define LANG_CHINESE 0x04 +#define LANG_CHINESE_SIMPLIFIED 0x04 +#define LANG_CHINESE_TRADITIONAL 0x7c04 +#define LANG_CORSICAN 0x83 +#define LANG_CROATIAN 0x1a +#define LANG_CZECH 0x05 +#define LANG_DANISH 0x06 +#define LANG_DARI 0x8c +#define LANG_DIVEHI 0x65 +#define LANG_DUTCH 0x13 +#define LANG_ENGLISH 0x09 +#define LANG_ESTONIAN 0x25 +#define LANG_FAEROESE 0x38 +#define LANG_FARSI 0x29 +#define LANG_FILIPINO 0x64 +#define LANG_FINNISH 0x0b +#define LANG_FRENCH 0x0c +#define LANG_FRISIAN 0x62 +#define LANG_GALICIAN 0x56 +#define LANG_GEORGIAN 0x37 +#define LANG_GERMAN 0x07 +#define LANG_GREEK 0x08 +#define LANG_GREENLANDIC 0x6f +#define LANG_GUJARATI 0x47 +#define LANG_HAUSA 0x68 +#define LANG_HEBREW 0x0d +#define LANG_HINDI 0x39 +#define LANG_HUNGARIAN 0x0e +#define LANG_ICELANDIC 0x0f +#define LANG_IGBO 0x70 +#define LANG_INDONESIAN 0x21 +#define LANG_INUKTITUT 0x5d +#define LANG_IRISH 0x3c +#define LANG_ITALIAN 0x10 +#define LANG_JAPANESE 0x11 +#define LANG_KANNADA 0x4b +#define LANG_KASHMIRI 0x60 +#define LANG_KAZAK 0x3f +#define LANG_KHMER 0x53 +#define LANG_KICHE 0x86 +#define LANG_KINYARWANDA 0x87 +#define LANG_KONKANI 0x57 +#define LANG_KOREAN 0x12 +#define LANG_KYRGYZ 0x40 +#define LANG_LAO 0x54 +#define LANG_LATVIAN 0x26 +#define LANG_LITHUANIAN 0x27 +#define LANG_LOWER_SORBIAN 0x2e +#define LANG_LUXEMBOURGISH 0x6e +#define LANG_MACEDONIAN 0x2f +#define LANG_MALAY 0x3e +#define LANG_MALAYALAM 0x4c +#define LANG_MALTESE 0x3a +#define LANG_MANIPURI 0x58 +#define LANG_MAORI 0x81 +#define LANG_MAPUDUNGUN 0x7a +#define LANG_MARATHI 0x4e +#define LANG_MOHAWK 0x7c +#define LANG_MONGOLIAN 0x50 +#define LANG_NEPALI 0x61 +#define LANG_NORWEGIAN 0x14 +#define LANG_OCCITAN 0x82 +#define LANG_ORIYA 0x48 +#define LANG_PASHTO 0x63 +#define LANG_PERSIAN 0x29 +#define LANG_POLISH 0x15 +#define LANG_PORTUGUESE 0x16 +#define LANG_PUNJABI 0x46 +#define LANG_QUECHUA 0x6b +#define LANG_ROMANIAN 0x18 +#define LANG_RUSSIAN 0x19 +#define LANG_SAMI 0x3b +#define LANG_ROMANSH 0x17 +#define LANG_SANSKRIT 0x4f +#define LANG_SERBIAN 0x1a +#define LANG_SERBIAN_NEUTRAL 0x7c1a +#define LANG_SINDHI 0x59 +#define LANG_SINHALESE 0x5b +#define LANG_SLOVAK 0x1b +#define LANG_SLOVENIAN 0x24 +#define LANG_SOTHO 0x6c +#define LANG_SPANISH 0x0a +#define LANG_SWAHILI 0x41 +#define LANG_SWEDISH 0x1d +#define LANG_SYRIAC 0x5a +#define LANG_TAJIK 0x28 +#define LANG_TAMAZIGHT 0x5f +#define LANG_TAMIL 0x49 +#define LANG_TATAR 0x44 +#define LANG_TELUGU 0x4a +#define LANG_THAI 0x1e +#define LANG_TIBETAN 0x51 +#define LANG_TIGRIGNA 0x73 +#define LANG_TSWANA 0x32 +#define LANG_TURKISH 0x1f +#define LANG_TURKMEN 0x42 +#define LANG_UIGHUR 0x80 +#define LANG_UKRAINIAN 0x22 +#define LANG_UPPER_SORBIAN 0x2e +#define LANG_URDU 0x20 +#define LANG_UZBEK 0x43 +#define LANG_VIETNAMESE 0x2a +#define LANG_WELSH 0x52 +#define LANG_WOLOF 0x88 +#define LANG_XHOSA 0x34 +#define LANG_YAKUT 0x85 +#define LANG_YI 0x78 +#define LANG_YORUBA 0x6a +#define LANG_ZULU 0x35 + +#define SUBLANG_NEUTRAL 0x0 +#define SUBLANG_DEFAULT 0x1 +#define SUBLANG_SYS_DEFAULT 0x2 +#define SUBLANG_CUSTOM_DEFAULT 0x3 +#define SUBLANG_CUSTOM_UNSPECIFIED 0x4 +#define SUBLANG_UI_CUSTOM_DEFAULT 0x5 + +#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +#define SUBLANG_ARABIC_IRAQ 0x02 +#define SUBLANG_ARABIC_EGYPT 0x03 +#define SUBLANG_ARABIC_LIBYA 0x04 +#define SUBLANG_ARABIC_ALGERIA 0x05 +#define SUBLANG_ARABIC_MOROCCO 0x06 +#define SUBLANG_ARABIC_TUNISIA 0x07 +#define SUBLANG_ARABIC_OMAN 0x08 +#define SUBLANG_ARABIC_YEMEN 0x09 +#define SUBLANG_ARABIC_SYRIA 0x0a +#define SUBLANG_ARABIC_JORDAN 0x0b +#define SUBLANG_ARABIC_LEBANON 0x0c +#define SUBLANG_ARABIC_KUWAIT 0x0d +#define SUBLANG_ARABIC_UAE 0x0e +#define SUBLANG_ARABIC_BAHRAIN 0x0f +#define SUBLANG_ARABIC_QATAR 0x10 +#define SUBLANG_AZERI_LATIN 0x01 +#define SUBLANG_AZERI_CYRILLIC 0x02 +#define SUBLANG_CHINESE_TRADITIONAL 0x01 +#define SUBLANG_CHINESE_SIMPLIFIED 0x02 +#define SUBLANG_CHINESE_HONGKONG 0x03 +#define SUBLANG_CHINESE_SINGAPORE 0x04 +#define SUBLANG_CHINESE_MACAU 0x05 +#define SUBLANG_DUTCH 0x01 +#define SUBLANG_DUTCH_BELGIAN 0x02 +#define SUBLANG_ENGLISH_US 0x01 +#define SUBLANG_ENGLISH_UK 0x02 +#define SUBLANG_ENGLISH_AUS 0x03 +#define SUBLANG_ENGLISH_CAN 0x04 +#define SUBLANG_ENGLISH_NZ 0x05 +#define SUBLANG_ENGLISH_EIRE 0x06 +#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 +#define SUBLANG_ENGLISH_JAMAICA 0x08 +#define SUBLANG_ENGLISH_CARIBBEAN 0x09 +#define SUBLANG_ENGLISH_BELIZE 0x0a +#define SUBLANG_ENGLISH_TRINIDAD 0x0b +#define SUBLANG_ENGLISH_ZIMBABWE 0x0c +#define SUBLANG_ENGLISH_PHILIPPINES 0x0d +#define SUBLANG_FRENCH 0x01 +#define SUBLANG_FRENCH_BELGIAN 0x02 +#define SUBLANG_FRENCH_CANADIAN 0x03 +#define SUBLANG_FRENCH_SWISS 0x04 +#define SUBLANG_FRENCH_LUXEMBOURG 0x05 +#define SUBLANG_FRENCH_MONACO 0x06 +#define SUBLANG_GERMAN 0x01 +#define SUBLANG_GERMAN_SWISS 0x02 +#define SUBLANG_GERMAN_AUSTRIAN 0x03 +#define SUBLANG_GERMAN_LUXEMBOURG 0x04 +#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 +#define SUBLANG_ITALIAN 0x01 +#define SUBLANG_ITALIAN_SWISS 0x02 +#define SUBLANG_KASHMIRI_SASIA 0x02 +#define SUBLANG_KASHMIRI_INDIA 0x02 +#define SUBLANG_KOREAN 0x01 +#define SUBLANG_LITHUANIAN 0x01 +#define SUBLANG_MALAY_MALAYSIA 0x01 +#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 +#define SUBLANG_NEPALI_INDIA 0x02 +#define SUBLANG_NORWEGIAN_BOKMAL 0x01 +#define SUBLANG_NORWEGIAN_NYNORSK 0x02 +#define SUBLANG_PORTUGUESE 0x02 +#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 +#define SUBLANG_SERBIAN_LATIN 0x02 +#define SUBLANG_SERBIAN_CYRILLIC 0x03 +#define SUBLANG_SPANISH 0x01 +#define SUBLANG_SPANISH_MEXICAN 0x02 +#define SUBLANG_SPANISH_MODERN 0x03 +#define SUBLANG_SPANISH_GUATEMALA 0x04 +#define SUBLANG_SPANISH_COSTA_RICA 0x05 +#define SUBLANG_SPANISH_PANAMA 0x06 +#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 +#define SUBLANG_SPANISH_VENEZUELA 0x08 +#define SUBLANG_SPANISH_COLOMBIA 0x09 +#define SUBLANG_SPANISH_PERU 0x0a +#define SUBLANG_SPANISH_ARGENTINA 0x0b +#define SUBLANG_SPANISH_ECUADOR 0x0c +#define SUBLANG_SPANISH_CHILE 0x0d +#define SUBLANG_SPANISH_URUGUAY 0x0e +#define SUBLANG_SPANISH_PARAGUAY 0x0f +#define SUBLANG_SPANISH_BOLIVIA 0x10 +#define SUBLANG_SPANISH_EL_SALVADOR 0x11 +#define SUBLANG_SPANISH_HONDURAS 0x12 +#define SUBLANG_SPANISH_NICARAGUA 0x13 +#define SUBLANG_SPANISH_PUERTO_RICO 0x14 +#define SUBLANG_SWEDISH 0x01 +#define SUBLANG_SWEDISH_FINLAND 0x02 +#define SUBLANG_URDU_PAKISTAN 0x01 +#define SUBLANG_URDU_INDIA 0x02 +#define SUBLANG_UZBEK_LATIN 0x01 +#define SUBLANG_UZBEK_CYRILLIC 0x02 + +#define SORT_DEFAULT 0x0 +#define SORT_INVARIANT_MATH 0x1 + +#define SORT_JAPANESE_XJIS 0x0 +#define SORT_JAPANESE_UNICODE 0x1 +#define SORT_JAPANESE_RADICALSTROKE 0x4 + +#define SORT_CHINESE_BIG5 0x0 +#define SORT_CHINESE_PRCP 0x0 +#define SORT_CHINESE_UNICODE 0x1 +#define SORT_CHINESE_PRC 0x2 +#define SORT_CHINESE_BOPOMOFO 0x3 + +#define SORT_KOREAN_KSC 0x0 +#define SORT_KOREAN_UNICODE 0x1 + +#define SORT_GERMAN_PHONE_BOOK 0x1 + +#define SORT_HUNGARIAN_DEFAULT 0x0 +#define SORT_HUNGARIAN_TECHNICAL 0x1 + +#define SORT_GEORGIAN_TRADITIONAL 0x0 +#define SORT_GEORGIAN_MODERN 0x1 + +#define MAKELANGID(p,s) ((((WORD)(s)) << 10) | (WORD)(p)) +#define PRIMARYLANGID(lgid) ((WORD)(lgid) & 0x3ff) +#define SUBLANGID(lgid) ((WORD)(lgid) >> 10) + +#define NLS_VALID_LOCALE_MASK 0x000fffff + +#define MAKELCID(lgid,srtid) ((DWORD)((((DWORD)((WORD)(srtid))) << 16) | ((DWORD)((WORD)(lgid))))) +#define MAKESORTLCID(lgid,srtid,ver) ((DWORD)((MAKELCID(lgid,srtid)) | (((DWORD)((WORD)(ver))) << 20))) +#define LANGIDFROMLCID(lcid) ((WORD)(lcid)) +#define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0xf)) +#define SORTVERSIONFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 20) & 0xf)) + +#define LOCALE_NAME_MAX_LENGTH 85 +#define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT)) +#define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT)) + +#define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT,SORT_DEFAULT)) +#define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT,SORT_DEFAULT)) + +#define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT)) + +#define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT)) +#define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT)) +#define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT)) + +#define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT)) + +#define UNREFERENCED_PARAMETER(P) (P) +#define DBG_UNREFERENCED_PARAMETER(P) (P) +#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V) + +#define DEFAULT_UNREACHABLE + +#ifndef WIN32_NO_STATUS +#define STATUS_WAIT_0 ((DWORD)0x00000000L) +#define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080L) +#define STATUS_USER_APC ((DWORD)0x000000C0L) +#define STATUS_TIMEOUT ((DWORD)0x00000102L) +#define STATUS_PENDING ((DWORD)0x00000103L) +#define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001L) +#define DBG_CONTINUE ((DWORD)0x00010002L) +#define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005L) +#define DBG_TERMINATE_THREAD ((DWORD)0x40010003L) +#define DBG_TERMINATE_PROCESS ((DWORD)0x40010004L) +#define DBG_CONTROL_C ((DWORD)0x40010005L) +#define DBG_CONTROL_BREAK ((DWORD)0x40010008L) +#define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009L) +#define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001L) +#define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002L) +#define STATUS_BREAKPOINT ((DWORD)0x80000003L) +#define STATUS_SINGLE_STEP ((DWORD)0x80000004L) +#define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001L) +#define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005L) +#define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006L) +#define STATUS_INVALID_HANDLE ((DWORD)0xC0000008L) +#define STATUS_NO_MEMORY ((DWORD)0xC0000017L) +#define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001DL) +#define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025L) +#define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026L) +#define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008CL) +#define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008DL) +#define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008EL) +#define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008FL) +#define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090L) +#define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091L) +#define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092L) +#define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093L) +#define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094L) +#define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095L) +#define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096L) +#define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FDL) +#define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013AL) +#define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4L) +#define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5L) +#define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9L) +#define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000FL) +#define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010L) +#endif + +#define MAXIMUM_WAIT_OBJECTS 64 +#define MAXIMUM_SUSPEND_COUNT MAXCHAR + + typedef ULONG_PTR KSPIN_LOCK; + typedef KSPIN_LOCK *PKSPIN_LOCK; + +#ifdef _AMD64_ + +#if defined(__x86_64) && !defined(RC_INVOKED) + +#ifdef __cplusplus + extern "C" { +#endif + +#define BitTest _bittest +#define BitTestAndComplement _bittestandcomplement +#define BitTestAndSet _bittestandset +#define BitTestAndReset _bittestandreset +#define InterlockedBitTestAndSet _interlockedbittestandset +#define InterlockedBitTestAndReset _interlockedbittestandreset +#define BitTest64 _bittest64 +#define BitTestAndComplement64 _bittestandcomplement64 +#define BitTestAndSet64 _bittestandset64 +#define BitTestAndReset64 _bittestandreset64 +#define InterlockedBitTestAndSet64 _interlockedbittestandset64 +#define InterlockedBitTestAndReset64 _interlockedbittestandreset64 + + __CRT_INLINE BOOLEAN _bittest(LONG const *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandcomplement(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("btcl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement(LONG *Base,LONG Bit) { + int old = 0; + __asm__ __volatile__("lock ; btcl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Bit)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandset(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandreset(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _interlockedbittestandset(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("lock ; btsl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _interlockedbittestandreset(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("lock ; btrl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittest64(LONG64 const *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("btq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandcomplement64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("btcq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandset64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("btsq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandreset64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("btrq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _interlockedbittestandset64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("lock ; btsq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _interlockedbittestandreset64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("lock ; btrq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } +#define BitScanForward _BitScanForward +#define BitScanReverse _BitScanReverse +#define BitScanForward64 _BitScanForward64 +#define BitScanReverse64 _BitScanReverse64 + + __CRT_INLINE BOOLEAN _BitScanForward(DWORD *Index,DWORD Mask) { + __asm__ __volatile__("bsfl %1,%0" : "=r" (Mask),"=m" ((*(volatile long *)Index))); + return Mask!=0; + } + __CRT_INLINE BOOLEAN _BitScanReverse(DWORD *Index,DWORD Mask) { + __asm__ __volatile__("bsrl %1,%0" : "=r" (Mask),"=m" ((*(volatile long *)Index))); + return Mask!=0; + } + __CRT_INLINE BOOLEAN _BitScanForward64(DWORD *Index,DWORD64 Mask) { + __asm__ __volatile__("bsfq %1,%0" : "=r" (Mask),"=m" ((*(volatile long long *)Index))); + return Mask!=0; + } + __CRT_INLINE BOOLEAN _BitScanReverse64(DWORD *Index,DWORD64 Mask) { + __asm__ __volatile__("bsrq %1,%0" : "=r" (Mask),"=m" ((*(volatile long long *)Index))); + return Mask!=0; + } + +#define InterlockedIncrement16 _InterlockedIncrement16 +#define InterlockedDecrement16 _InterlockedDecrement16 +#define InterlockedCompareExchange16 _InterlockedCompareExchange16 + +#define InterlockedAnd _InterlockedAnd +#define InterlockedOr _InterlockedOr +#define InterlockedXor _InterlockedXor +#define InterlockedIncrement _InterlockedIncrement +#define InterlockedIncrementAcquire InterlockedIncrement +#define InterlockedIncrementRelease InterlockedIncrement +#define InterlockedDecrement _InterlockedDecrement +#define InterlockedDecrementAcquire InterlockedDecrement +#define InterlockedDecrementRelease InterlockedDecrement +#define InterlockedAdd _InterlockedAdd +#define InterlockedExchange _InterlockedExchange +#define InterlockedExchangeAdd _InterlockedExchangeAdd +#define InterlockedCompareExchange _InterlockedCompareExchange +#define InterlockedCompareExchangeAcquire InterlockedCompareExchange +#define InterlockedCompareExchangeRelease InterlockedCompareExchange + +#define InterlockedAnd64 _InterlockedAnd64 +#define InterlockedAndAffinity InterlockedAnd64 +#define InterlockedOr64 _InterlockedOr64 +#define InterlockedOrAffinity InterlockedOr64 +#define InterlockedXor64 _InterlockedXor64 +#define InterlockedIncrement64 _InterlockedIncrement64 +#define InterlockedDecrement64 _InterlockedDecrement64 +#define InterlockedAdd64 _InterlockedAdd64 +#define InterlockedExchange64 _InterlockedExchange64 +#define InterlockedExchangeAcquire64 InterlockedExchange64 +#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 +#define InterlockedCompareExchange64 _InterlockedCompareExchange64 +#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 +#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 + +#define InterlockedExchangePointer _InterlockedExchangePointer +#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer + +#define InterlockedExchangeAddSizeT(a,b) InterlockedExchangeAdd64((LONG64 *)a,b) +#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONG64 *)a) +#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONG64 *)a) + + __CRT_INLINE SHORT InterlockedIncrement16(SHORT volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; addw $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE SHORT InterlockedDecrement16(SHORT volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; subw $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE SHORT InterlockedCompareExchange16(SHORT volatile *Destination,SHORT ExChange,SHORT Comperand) { + SHORT prev; + __asm__ __volatile__("lock ; cmpxchgw %w1,%2" + :"=a"(prev) + :"q"(ExChange), "m"(*Destination), "0"(Comperand) + : "memory"); + return prev; + } + __CRT_INLINE LONG InterlockedAnd(LONG volatile *Destination,LONG Value) { + __asm__ __volatile__("lock ; andl %0,%1" + : :"r"(Value),"m"(*Destination) + : "memory"); + return *Destination; + } + __CRT_INLINE LONG InterlockedOr(LONG volatile *Destination,LONG Value) { + __asm__ __volatile__("lock ; orl %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + __CRT_INLINE LONG InterlockedXor(LONG volatile *Destination,LONG Value) { + __asm__ __volatile__("lock ; xorl %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + // $$$$ + __CRT_INLINE LONG64 InterlockedAnd64(LONG64 volatile *Destination,LONG64 Value) { + __asm__ __volatile__("lock ; andq %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + __CRT_INLINE LONG64 InterlockedOr64(LONG64 volatile *Destination,LONG64 Value) { + __asm__ __volatile__("lock ; orq %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + __CRT_INLINE LONG64 InterlockedXor64(LONG64 volatile *Destination,LONG64 Value) { + __asm__ __volatile__("lock ; xorq %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + __CRT_INLINE LONG InterlockedIncrement(LONG volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; addl $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE LONG InterlockedDecrement(LONG volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; subl $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE LONG InterlockedExchange(LONG volatile *Target,LONG Value) { + __asm__ __volatile("lock ; xchgl %0,%1" + : "=r"(Value) + : "m"(*Target),"0"(Value) + : "memory"); + return Value; + } + LONG InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); + +#ifndef _X86AMD64_ + __CRT_INLINE LONG InterlockedAdd(LONG volatile *Addend,LONG Value) { return InterlockedExchangeAdd(Addend,Value) + Value; } +#endif + __CRT_INLINE LONG InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand) { + LONG prev; + __asm__ __volatile__("lock ; cmpxchgl %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory"); + return prev; + } + __CRT_INLINE LONG64 InterlockedIncrement64(LONG64 volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; addq $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE LONG64 InterlockedDecrement64(LONG64 volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; subq $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE LONG64 InterlockedExchange64(LONG64 volatile *Target,LONG64 Value) { + __asm__ __volatile("lock ; xchgq %0,%1" + : "=r"(Value) + : "m"(*Target),"0"(Value) + : "memory"); + return Value; + } + LONG64 InterlockedExchangeAdd64(LONG64 volatile *Addend,LONG64 Value); + +#ifndef _X86AMD64_ + __CRT_INLINE LONG64 InterlockedAdd64(LONG64 volatile *Addend,LONG64 Value) { return InterlockedExchangeAdd64(Addend,Value) + Value; } +#endif + + __CRT_INLINE LONG64 InterlockedCompareExchange64(LONG64 volatile *Destination,LONG64 ExChange,LONG64 Comperand) { + LONG64 prev; + __asm__ __volatile__("lock ; cmpxchgq %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory"); + return prev; + } + __CRT_INLINE PVOID InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand) { + PVOID prev; + __asm__ __volatile__("lock ; cmpxchgq %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory"); + return prev; + } + __CRT_INLINE PVOID InterlockedExchangePointer(PVOID volatile *Target,PVOID Value) { + __asm__ __volatile("lock ; xchgq %0,%1" + : "=r"(Value) + : "m"(*Target),"0"(Value) + : "memory"); + return Value; + } + +#define CacheLineFlush(Address) _mm_clflush(Address) + + VOID _ReadWriteBarrier(VOID); + +#define FastFence __faststorefence +#define LoadFence _mm_lfence +#define MemoryFence _mm_mfence +#define StoreFence _mm_sfence + + VOID __faststorefence(VOID); + VOID _m_prefetchw(volatile CONST VOID *Source); + +//!__TINYC__: #include + +#define YieldProcessor _mm_pause +#define MemoryBarrier __faststorefence +#define PreFetchCacheLine(l,a) _mm_prefetch((CHAR CONST *) a,l) +#define PrefetchForWrite(p) _m_prefetchw(p) +#define ReadForWriteAccess(p) (_m_prefetchw(p),*(p)) + +#define PF_TEMPORAL_LEVEL_1 _MM_HINT_T0 +#define PF_TEMPORAL_LEVEL_2 _MM_HINT_T1 +#define PF_TEMPORAL_LEVEL_3 _MM_HINT_T2 +#define PF_NON_TEMPORAL_LEVEL_ALL _MM_HINT_NTA + +#define ReadMxCsr _mm_getcsr +#define WriteMxCsr _mm_setcsr + + VOID __int2c(VOID); + +#define DbgRaiseAssertionFailure() __int2c() +#define GetCallersEflags() __getcallerseflags() + + unsigned __int32 __getcallerseflags(VOID); + +#define GetSegmentLimit __segmentlimit + + DWORD __segmentlimit(DWORD Selector); + +#define ReadTimeStampCounter() __rdtsc() + + DWORD64 __rdtsc(VOID); + VOID __movsb(PBYTE Destination,BYTE const *Source,SIZE_T Count); + VOID __movsw(PWORD Destination,WORD const *Source,SIZE_T Count); + VOID __movsd(PDWORD Destination,DWORD const *Source,SIZE_T Count); + VOID __movsq(PDWORD64 Destination,DWORD64 const *Source,SIZE_T Count); + VOID __stosb(PBYTE Destination,BYTE Value,SIZE_T Count); + VOID __stosw(PWORD Destination,WORD Value,SIZE_T Count); + VOID __stosd(PDWORD Destination,DWORD Value,SIZE_T Count); + VOID __stosq(PDWORD64 Destination,DWORD64 Value,SIZE_T Count); + +#define MultiplyHigh __mulh +#define UnsignedMultiplyHigh __umulh + + LONGLONG MultiplyHigh(LONGLONG Multiplier,LONGLONG Multiplicand); + ULONGLONG UnsignedMultiplyHigh(ULONGLONG Multiplier,ULONGLONG Multiplicand); + +#define ShiftLeft128 __shiftleft128 +#define ShiftRight128 __shiftright128 + + DWORD64 ShiftLeft128(DWORD64 LowPart,DWORD64 HighPart,BYTE Shift); + DWORD64 ShiftRight128(DWORD64 LowPart,DWORD64 HighPart,BYTE Shift); + +#define Multiply128 _mul128 + + LONG64 Multiply128(LONG64 Multiplier,LONG64 Multiplicand,LONG64 *HighProduct); + +#define UnsignedMultiply128 _umul128 + + DWORD64 UnsignedMultiply128(DWORD64 Multiplier,DWORD64 Multiplicand,DWORD64 *HighProduct); + + __CRT_INLINE LONG64 MultiplyExtract128(LONG64 Multiplier,LONG64 Multiplicand,BYTE Shift) { + LONG64 extractedProduct; + LONG64 highProduct; + LONG64 lowProduct; + lowProduct = Multiply128(Multiplier,Multiplicand,&highProduct); + extractedProduct = (LONG64)ShiftRight128((LONG64)lowProduct,(LONG64)highProduct,Shift); + return extractedProduct; + } + + __CRT_INLINE DWORD64 UnsignedMultiplyExtract128(DWORD64 Multiplier,DWORD64 Multiplicand,BYTE Shift) { + DWORD64 extractedProduct; + DWORD64 highProduct; + DWORD64 lowProduct; + lowProduct = UnsignedMultiply128(Multiplier,Multiplicand,&highProduct); + extractedProduct = ShiftRight128(lowProduct,highProduct,Shift); + return extractedProduct; + } + + __CRT_INLINE BYTE __readgsbyte(DWORD Offset) { + BYTE ret; + __asm__ volatile ("movb %%gs:%1,%0" + : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + return ret; + } + __CRT_INLINE WORD __readgsword(DWORD Offset) { + WORD ret; + __asm__ volatile ("movw %%gs:%1,%0" + : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + return ret; + } + __CRT_INLINE DWORD __readgsdword(DWORD Offset) { + DWORD ret; + __asm__ volatile ("movl %%gs:%1,%0" + : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + return ret; + } + __CRT_INLINE DWORD64 __readgsqword(DWORD Offset) { + void *ret; + __asm__ volatile ("movq %%gs:%1,%0" + : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + return (DWORD64) ret; + } + __CRT_INLINE VOID __writegsbyte(DWORD Offset,BYTE Data) { + __asm__ volatile ("movb %0,%%gs:%1" + : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + } + __CRT_INLINE VOID __writegsword(DWORD Offset,WORD Data) { + __asm__ volatile ("movw %0,%%gs:%1" + : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + } + __CRT_INLINE VOID __writegsdword(DWORD Offset,DWORD Data) { + __asm__ volatile ("movl %0,%%gs:%1" + : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + } + __CRT_INLINE VOID __writegsqword(DWORD Offset,DWORD64 Data) { + __asm__ volatile ("movq %0,%%gs:%1" + : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + } + +#ifdef __cplusplus + } +#endif +#endif + +#define EXCEPTION_READ_FAULT 0 +#define EXCEPTION_WRITE_FAULT 1 +#define EXCEPTION_EXECUTE_FAULT 8 + +#if !defined(RC_INVOKED) + +#define CONTEXT_AMD64 0x100000 + +#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L) +#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L) +#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L) +#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L) +#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L) + +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) +#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS) + +#define CONTEXT_EXCEPTION_ACTIVE 0x8000000 +#define CONTEXT_SERVICE_ACTIVE 0x10000000 +#define CONTEXT_EXCEPTION_REQUEST 0x40000000 +#define CONTEXT_EXCEPTION_REPORTING 0x80000000 +#endif + +#define INITIAL_MXCSR 0x1f80 +#define INITIAL_FPCSR 0x027f + + typedef DECLSPEC_ALIGN(16) struct _M128A { + ULONGLONG Low; + LONGLONG High; + } M128A,*PM128A; + + typedef struct _XMM_SAVE_AREA32 { + WORD ControlWord; + WORD StatusWord; + BYTE TagWord; + BYTE Reserved1; + WORD ErrorOpcode; + DWORD ErrorOffset; + WORD ErrorSelector; + WORD Reserved2; + DWORD DataOffset; + WORD DataSelector; + WORD Reserved3; + DWORD MxCsr; + DWORD MxCsr_Mask; + M128A FloatRegisters[8]; + M128A XmmRegisters[16]; + BYTE Reserved4[96]; + } XMM_SAVE_AREA32,*PXMM_SAVE_AREA32; + +#define LEGACY_SAVE_AREA_LENGTH sizeof(XMM_SAVE_AREA32) + + typedef DECLSPEC_ALIGN(16) struct _CONTEXT { + DWORD64 P1Home; + DWORD64 P2Home; + DWORD64 P3Home; + DWORD64 P4Home; + DWORD64 P5Home; + DWORD64 P6Home; + DWORD ContextFlags; + DWORD MxCsr; + WORD SegCs; + WORD SegDs; + WORD SegEs; + WORD SegFs; + WORD SegGs; + WORD SegSs; + DWORD EFlags; + DWORD64 Dr0; + DWORD64 Dr1; + DWORD64 Dr2; + DWORD64 Dr3; + DWORD64 Dr6; + DWORD64 Dr7; + DWORD64 Rax; + DWORD64 Rcx; + DWORD64 Rdx; + DWORD64 Rbx; + DWORD64 Rsp; + DWORD64 Rbp; + DWORD64 Rsi; + DWORD64 Rdi; + DWORD64 R8; + DWORD64 R9; + DWORD64 R10; + DWORD64 R11; + DWORD64 R12; + DWORD64 R13; + DWORD64 R14; + DWORD64 R15; + DWORD64 Rip; + union { + XMM_SAVE_AREA32 FltSave; + XMM_SAVE_AREA32 FloatSave; + struct { + M128A Header[2]; + M128A Legacy[8]; + M128A Xmm0; + M128A Xmm1; + M128A Xmm2; + M128A Xmm3; + M128A Xmm4; + M128A Xmm5; + M128A Xmm6; + M128A Xmm7; + M128A Xmm8; + M128A Xmm9; + M128A Xmm10; + M128A Xmm11; + M128A Xmm12; + M128A Xmm13; + M128A Xmm14; + M128A Xmm15; + }; + }; + M128A VectorRegister[26]; + DWORD64 VectorControl; + DWORD64 DebugControl; + DWORD64 LastBranchToRip; + DWORD64 LastBranchFromRip; + DWORD64 LastExceptionToRip; + DWORD64 LastExceptionFromRip; + } CONTEXT,*PCONTEXT; + +#define RUNTIME_FUNCTION_INDIRECT 0x1 + + typedef struct _RUNTIME_FUNCTION { + DWORD BeginAddress; + DWORD EndAddress; + DWORD UnwindData; + } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION; + + typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 ControlPc,PVOID Context); + typedef DWORD (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(HANDLE Process,PVOID TableAddress,PDWORD Entries,PRUNTIME_FUNCTION *Functions); + +#define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback" + + NTSYSAPI VOID __cdecl RtlRestoreContext (PCONTEXT ContextRecord,struct _EXCEPTION_RECORD *ExceptionRecord); + NTSYSAPI BOOLEAN __cdecl RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,DWORD EntryCount,DWORD64 BaseAddress); + NTSYSAPI BOOLEAN __cdecl RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,DWORD64 BaseAddress,DWORD Length,PGET_RUNTIME_FUNCTION_CALLBACK Callback,PVOID Context,PCWSTR OutOfProcessCallbackDll); + NTSYSAPI BOOLEAN __cdecl RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable); +#endif + +#ifdef I_X86_ +#if(defined(_X86_) && !defined(__x86_64)) && !defined(RC_INVOKED) +#ifdef __cplusplus + extern "C" { +#endif + + __CRT_INLINE BOOLEAN InterlockedBitTestAndSet(LONG *Base,LONG Bit) { + int old = 0; + __asm__ __volatile__("lock ; btsl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Bit)); + return (BOOLEAN) (old!=0); + } + + __CRT_INLINE BOOLEAN InterlockedBitTestAndReset(LONG *Base,LONG Bit) { + int old = 0; + __asm__ __volatile__("lock ; btrl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Bit)); + return (BOOLEAN) (old!=0); + } + + __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement(LONG *Base,LONG Bit) { + int old = 0; + __asm__ __volatile__("lock ; btcl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Bit)); + return (BOOLEAN) (old!=0); + } + +#ifdef _PREFIX_ + BYTE __readfsbyte(DWORD Offset); + WORD __readfsword(DWORD Offset); + DWORD __readfsdword(DWORD Offset); + VOID __writefsbyte(DWORD Offset,BYTE Data); + VOID __writefsword(DWORD Offset,WORD Data); + VOID __writefsdword(DWORD Offset,DWORD Data); +#endif + +#ifdef __cplusplus + } +#endif +#endif + +#if(defined(_X86_) && !defined(__x86_64)) + __CRT_INLINE VOID MemoryBarrier(VOID) { + LONG Barrier; + __asm__ __volatile__("xchgl %eax,%0 " + :"=r" (Barrier)); + } +#define YieldProcessor() __asm__ __volatile__("rep nop "); + +#define PreFetchCacheLine(l,a) +#define ReadForWriteAccess(p) (*(p)) + +#define PF_TEMPORAL_LEVEL_1 +#define PF_NON_TEMPORAL_LEVEL_ALL + + __CRT_INLINE VOID DbgRaiseAssertionFailure(void) { + __asm__ __volatile__("int 0x2c "); + } + PVOID GetCurrentFiber(void); + __CRT_INLINE PVOID GetCurrentFiber(void) + { + void *ret; + __asm__ volatile ("movl %%fs:0x10,%0" + : "=r" (ret)); + return ret; + } + PVOID GetFiberData(void); + __CRT_INLINE PVOID GetFiberData(void) + { + void *ret; + __asm__ volatile ("movl %%fs:0x10,%0\n" + "movl (%0),%0" + : "=r" (ret)); + return ret; + } +#endif + +#define EXCEPTION_READ_FAULT 0 +#define EXCEPTION_WRITE_FAULT 1 +#define EXCEPTION_EXECUTE_FAULT 8 + +#define SIZE_OF_80387_REGISTERS 80 + +#if !defined(RC_INVOKED) + +#define CONTEXT_i386 0x00010000 +#define CONTEXT_i486 0x00010000 + +#define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L) +#define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L) +#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L) +#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L) +#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) +#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x00000020L) + +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS) + +#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS) +#endif + +#define MAXIMUM_SUPPORTED_EXTENSION 512 + + typedef struct _FLOATING_SAVE_AREA { + DWORD ControlWord; + DWORD StatusWord; + DWORD TagWord; + DWORD ErrorOffset; + DWORD ErrorSelector; + DWORD DataOffset; + DWORD DataSelector; + BYTE RegisterArea[SIZE_OF_80387_REGISTERS]; + DWORD Cr0NpxState; + } FLOATING_SAVE_AREA; + + typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA; + + typedef struct _CONTEXT { + DWORD ContextFlags; + DWORD Dr0; + DWORD Dr1; + DWORD Dr2; + DWORD Dr3; + DWORD Dr6; + DWORD Dr7; + FLOATING_SAVE_AREA FloatSave; + DWORD SegGs; + DWORD SegFs; + DWORD SegEs; + DWORD SegDs; + + DWORD Edi; + DWORD Esi; + DWORD Ebx; + DWORD Edx; + DWORD Ecx; + DWORD Eax; + DWORD Ebp; + DWORD Eip; + DWORD SegCs; + DWORD EFlags; + DWORD Esp; + DWORD SegSs; + BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; + } CONTEXT; + + typedef CONTEXT *PCONTEXT; +#endif + +#ifndef _LDT_ENTRY_DEFINED +#define _LDT_ENTRY_DEFINED + + typedef struct _LDT_ENTRY { + WORD LimitLow; + WORD BaseLow; + union { + struct { + BYTE BaseMid; + BYTE Flags1; + BYTE Flags2; + BYTE BaseHi; + } Bytes; + struct { + DWORD BaseMid : 8; + DWORD Type : 5; + DWORD Dpl : 2; + DWORD Pres : 1; + DWORD LimitHi : 4; + DWORD Sys : 1; + DWORD Reserved_0 : 1; + DWORD Default_Big : 1; + DWORD Granularity : 1; + DWORD BaseHi : 8; + } Bits; + } HighWord; + } LDT_ENTRY,*PLDT_ENTRY; +#endif + +#if defined(__ia64__) && !defined(RC_INVOKED) + +#ifdef __cplusplus + extern "C" { +#endif + + BOOLEAN BitScanForward64(DWORD *Index,DWORD64 Mask); + BOOLEAN BitScanReverse64(DWORD *Index,DWORD64 Mask); + +#ifdef __cplusplus + } +#endif +#endif + +#if !defined(GENUTIL) && !defined(_GENIA64_) && defined(_IA64_) + + void *_cdecl _rdteb(void); +#ifdef __ia64__ + +#define NtCurrentTeb() ((struct _TEB *)_rdteb()) +#define GetCurrentFiber() (((PNT_TIB)NtCurrentTeb())->FiberData) +#define GetFiberData() (*(PVOID *)(GetCurrentFiber())) + +#ifdef __cplusplus + extern "C" { +#endif + + void __break(int); + void __yield(void); + void __mf(void); + void __lfetch(int Level,VOID CONST *Address); + void __lfetchfault(int Level,VOID CONST *Address); + void __lfetch_excl(int Level,VOID CONST *Address); + void __lfetchfault_excl(int Level,VOID CONST *Address); + +#define MD_LFHINT_NONE 0x00 +#define MD_LFHINT_NT1 0x01 +#define MD_LFHINT_NT2 0x02 +#define MD_LFHINT_NTA 0x03 + +#ifdef __cplusplus + } +#endif + +#define YieldProcessor __yield +#define MemoryBarrier __mf +#define PreFetchCacheLine __lfetch +#define ReadForWriteAccess(p) (*(p)) +#define DbgRaiseAssertionFailure() __break(ASSERT_BREAKPOINT) + +#define PF_TEMPORAL_LEVEL_1 MD_LFHINT_NONE +#define PF_NON_TEMPORAL_LEVEL_ALL MD_LFHINT_NTA + +#define UnsignedMultiplyHigh __UMULH + + ULONGLONG UnsignedMultiplyHigh(ULONGLONG Multiplier,ULONGLONG Multiplicand); +#else + struct _TEB *NtCurrentTeb(void); +#endif +#endif + +#ifdef _IA64_ + +#define EXCEPTION_READ_FAULT 0 +#define EXCEPTION_WRITE_FAULT 1 +#define EXCEPTION_EXECUTE_FAULT 2 + +#if !defined(RC_INVOKED) + +#define CONTEXT_IA64 0x00080000 + +#define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001L) +#define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002L) +#define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004L) +#define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008L) +#define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010L) +#define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020L) + +#define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT) +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL) +#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL) + +#define CONTEXT_EXCEPTION_ACTIVE 0x8000000 +#define CONTEXT_SERVICE_ACTIVE 0x10000000 +#define CONTEXT_EXCEPTION_REQUEST 0x40000000 +#define CONTEXT_EXCEPTION_REPORTING 0x80000000 +#endif + + typedef struct _CONTEXT { + DWORD ContextFlags; + DWORD Fill1[3]; + ULONGLONG DbI0; + ULONGLONG DbI1; + ULONGLONG DbI2; + ULONGLONG DbI3; + ULONGLONG DbI4; + ULONGLONG DbI5; + ULONGLONG DbI6; + ULONGLONG DbI7; + ULONGLONG DbD0; + ULONGLONG DbD1; + ULONGLONG DbD2; + ULONGLONG DbD3; + ULONGLONG DbD4; + ULONGLONG DbD5; + ULONGLONG DbD6; + ULONGLONG DbD7; + FLOAT128 FltS0; + FLOAT128 FltS1; + FLOAT128 FltS2; + FLOAT128 FltS3; + FLOAT128 FltT0; + FLOAT128 FltT1; + FLOAT128 FltT2; + FLOAT128 FltT3; + FLOAT128 FltT4; + FLOAT128 FltT5; + FLOAT128 FltT6; + FLOAT128 FltT7; + FLOAT128 FltT8; + FLOAT128 FltT9; + FLOAT128 FltS4; + FLOAT128 FltS5; + FLOAT128 FltS6; + FLOAT128 FltS7; + FLOAT128 FltS8; + FLOAT128 FltS9; + FLOAT128 FltS10; + FLOAT128 FltS11; + FLOAT128 FltS12; + FLOAT128 FltS13; + FLOAT128 FltS14; + FLOAT128 FltS15; + FLOAT128 FltS16; + FLOAT128 FltS17; + FLOAT128 FltS18; + FLOAT128 FltS19; + FLOAT128 FltF32; + FLOAT128 FltF33; + FLOAT128 FltF34; + FLOAT128 FltF35; + FLOAT128 FltF36; + FLOAT128 FltF37; + FLOAT128 FltF38; + FLOAT128 FltF39; + FLOAT128 FltF40; + FLOAT128 FltF41; + FLOAT128 FltF42; + FLOAT128 FltF43; + FLOAT128 FltF44; + FLOAT128 FltF45; + FLOAT128 FltF46; + FLOAT128 FltF47; + FLOAT128 FltF48; + FLOAT128 FltF49; + FLOAT128 FltF50; + FLOAT128 FltF51; + FLOAT128 FltF52; + FLOAT128 FltF53; + FLOAT128 FltF54; + FLOAT128 FltF55; + FLOAT128 FltF56; + FLOAT128 FltF57; + FLOAT128 FltF58; + FLOAT128 FltF59; + FLOAT128 FltF60; + FLOAT128 FltF61; + FLOAT128 FltF62; + FLOAT128 FltF63; + FLOAT128 FltF64; + FLOAT128 FltF65; + FLOAT128 FltF66; + FLOAT128 FltF67; + FLOAT128 FltF68; + FLOAT128 FltF69; + FLOAT128 FltF70; + FLOAT128 FltF71; + FLOAT128 FltF72; + FLOAT128 FltF73; + FLOAT128 FltF74; + FLOAT128 FltF75; + FLOAT128 FltF76; + FLOAT128 FltF77; + FLOAT128 FltF78; + FLOAT128 FltF79; + FLOAT128 FltF80; + FLOAT128 FltF81; + FLOAT128 FltF82; + FLOAT128 FltF83; + FLOAT128 FltF84; + FLOAT128 FltF85; + FLOAT128 FltF86; + FLOAT128 FltF87; + FLOAT128 FltF88; + FLOAT128 FltF89; + FLOAT128 FltF90; + FLOAT128 FltF91; + FLOAT128 FltF92; + FLOAT128 FltF93; + FLOAT128 FltF94; + FLOAT128 FltF95; + FLOAT128 FltF96; + FLOAT128 FltF97; + FLOAT128 FltF98; + FLOAT128 FltF99; + FLOAT128 FltF100; + FLOAT128 FltF101; + FLOAT128 FltF102; + FLOAT128 FltF103; + FLOAT128 FltF104; + FLOAT128 FltF105; + FLOAT128 FltF106; + FLOAT128 FltF107; + FLOAT128 FltF108; + FLOAT128 FltF109; + FLOAT128 FltF110; + FLOAT128 FltF111; + FLOAT128 FltF112; + FLOAT128 FltF113; + FLOAT128 FltF114; + FLOAT128 FltF115; + FLOAT128 FltF116; + FLOAT128 FltF117; + FLOAT128 FltF118; + FLOAT128 FltF119; + FLOAT128 FltF120; + FLOAT128 FltF121; + FLOAT128 FltF122; + FLOAT128 FltF123; + FLOAT128 FltF124; + FLOAT128 FltF125; + FLOAT128 FltF126; + FLOAT128 FltF127; + ULONGLONG StFPSR; + ULONGLONG IntGp; + ULONGLONG IntT0; + ULONGLONG IntT1; + ULONGLONG IntS0; + ULONGLONG IntS1; + ULONGLONG IntS2; + ULONGLONG IntS3; + ULONGLONG IntV0; + ULONGLONG IntT2; + ULONGLONG IntT3; + ULONGLONG IntT4; + ULONGLONG IntSp; + ULONGLONG IntTeb; + ULONGLONG IntT5; + ULONGLONG IntT6; + ULONGLONG IntT7; + ULONGLONG IntT8; + ULONGLONG IntT9; + ULONGLONG IntT10; + ULONGLONG IntT11; + ULONGLONG IntT12; + ULONGLONG IntT13; + ULONGLONG IntT14; + ULONGLONG IntT15; + ULONGLONG IntT16; + ULONGLONG IntT17; + ULONGLONG IntT18; + ULONGLONG IntT19; + ULONGLONG IntT20; + ULONGLONG IntT21; + ULONGLONG IntT22; + ULONGLONG IntNats; + ULONGLONG Preds; + ULONGLONG BrRp; + ULONGLONG BrS0; + ULONGLONG BrS1; + ULONGLONG BrS2; + ULONGLONG BrS3; + ULONGLONG BrS4; + ULONGLONG BrT0; + ULONGLONG BrT1; + ULONGLONG ApUNAT; + ULONGLONG ApLC; + ULONGLONG ApEC; + ULONGLONG ApCCV; + ULONGLONG ApDCR; + ULONGLONG RsPFS; + ULONGLONG RsBSP; + ULONGLONG RsBSPSTORE; + ULONGLONG RsRSC; + ULONGLONG RsRNAT; + ULONGLONG StIPSR; + ULONGLONG StIIP; + ULONGLONG StIFS; + ULONGLONG StFCR; + ULONGLONG Eflag; + ULONGLONG SegCSD; + ULONGLONG SegSSD; + ULONGLONG Cflag; + ULONGLONG StFSR; + ULONGLONG StFIR; + ULONGLONG StFDR; + ULONGLONG UNUSEDPACK; + } CONTEXT,*PCONTEXT; + + typedef struct _PLABEL_DESCRIPTOR { + ULONGLONG EntryPoint; + ULONGLONG GlobalPointer; + } PLABEL_DESCRIPTOR,*PPLABEL_DESCRIPTOR; + + typedef struct _RUNTIME_FUNCTION { + DWORD BeginAddress; + DWORD EndAddress; + DWORD UnwindInfoAddress; + } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION; + + typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 ControlPc,PVOID Context); + typedef DWORD (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(HANDLE Process,PVOID TableAddress,PDWORD Entries,PRUNTIME_FUNCTION *Functions); + +#define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback" + + BOOLEAN RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,DWORD EntryCount,ULONGLONG BaseAddress,ULONGLONG TargetGp); + BOOLEAN RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,DWORD64 BaseAddress,DWORD Length,DWORD64 TargetGp,PGET_RUNTIME_FUNCTION_CALLBACK Callback,PVOID Context,PCWSTR OutOfProcessCallbackDll); + BOOLEAN RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable); + VOID RtlRestoreContext (PCONTEXT ContextRecord,struct _EXCEPTION_RECORD *ExceptionRecord); + VOID __jump_unwind(ULONGLONG TargetMsFrame,ULONGLONG TargetBsFrame,ULONGLONG TargetPc); +#endif + +#define EXCEPTION_NONCONTINUABLE 0x1 +#define EXCEPTION_MAXIMUM_PARAMETERS 15 + + typedef struct _EXCEPTION_RECORD { + DWORD ExceptionCode; + DWORD ExceptionFlags; + struct _EXCEPTION_RECORD *ExceptionRecord; + PVOID ExceptionAddress; + DWORD NumberParameters; + ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; + } EXCEPTION_RECORD; + + typedef EXCEPTION_RECORD *PEXCEPTION_RECORD; + + typedef struct _EXCEPTION_RECORD32 { + DWORD ExceptionCode; + DWORD ExceptionFlags; + DWORD ExceptionRecord; + DWORD ExceptionAddress; + DWORD NumberParameters; + DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; + } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32; + + typedef struct _EXCEPTION_RECORD64 { + DWORD ExceptionCode; + DWORD ExceptionFlags; + DWORD64 ExceptionRecord; + DWORD64 ExceptionAddress; + DWORD NumberParameters; + DWORD __unusedAlignment; + DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; + } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64; + + typedef struct _EXCEPTION_POINTERS { + PEXCEPTION_RECORD ExceptionRecord; + PCONTEXT ContextRecord; + } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS; + +#ifdef __x86_64 + + typedef EXCEPTION_DISPOSITION NTAPI EXCEPTION_ROUTINE (struct _EXCEPTION_RECORD *ExceptionRecord, PVOID EstablisherFrame, struct _CONTEXT *ContextRecord, PVOID DispatcherContext); +#ifndef __PEXCEPTION_ROUTINE_DEFINED +#define __PEXCEPTION_ROUTINE_DEFINED + typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE; +#endif + + /* http://msdn.microsoft.com/en-us/library/ms680597(VS.85).aspx */ + +#define UNWIND_HISTORY_TABLE_SIZE 12 + + typedef struct _UNWIND_HISTORY_TABLE_ENTRY { + ULONG64 ImageBase; + PRUNTIME_FUNCTION FunctionEntry; + } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY; + +#define UNWIND_HISTORY_TABLE_NONE 0 +#define UNWIND_HISTORY_TABLE_GLOBAL 1 +#define UNWIND_HISTORY_TABLE_LOCAL 2 + + typedef struct _UNWIND_HISTORY_TABLE { + ULONG Count; + UCHAR Search; + ULONG64 LowAddress; + ULONG64 HighAddress; + UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE]; + } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE; + + /* http://msdn.microsoft.com/en-us/library/b6sf5kbd(VS.80).aspx */ + + struct _DISPATCHER_CONTEXT; + typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT; + typedef struct _DISPATCHER_CONTEXT *PDISPATCHER_CONTEXT; + + struct _DISPATCHER_CONTEXT { + ULONG64 ControlPc; + ULONG64 ImageBase; + PRUNTIME_FUNCTION FunctionEntry; + ULONG64 EstablisherFrame; + ULONG64 TargetIp; + PCONTEXT ContextRecord; + PEXCEPTION_ROUTINE LanguageHandler; + PVOID HandlerData; + /* http://www.nynaeve.net/?p=99 */ + PUNWIND_HISTORY_TABLE HistoryTable; + ULONG ScopeIndex; + ULONG Fill0; + }; + + /* http://msdn.microsoft.com/en-us/library/ms680617(VS.85).aspx */ + + typedef struct _KNONVOLATILE_CONTEXT_POINTERS + { + PM128A FloatingContext[16]; + PULONG64 IntegerContext[16]; + } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; +#endif /* defined(__x86_64) */ + + typedef PVOID PACCESS_TOKEN; + typedef PVOID PSECURITY_DESCRIPTOR; + typedef PVOID PSID; + + typedef DWORD ACCESS_MASK; + typedef ACCESS_MASK *PACCESS_MASK; + +#define DELETE (0x00010000L) +#define READ_CONTROL (0x00020000L) +#define WRITE_DAC (0x00040000L) +#define WRITE_OWNER (0x00080000L) +#define SYNCHRONIZE (0x00100000L) + +#define STANDARD_RIGHTS_REQUIRED (0x000F0000L) +#define STANDARD_RIGHTS_READ (READ_CONTROL) +#define STANDARD_RIGHTS_WRITE (READ_CONTROL) +#define STANDARD_RIGHTS_EXECUTE (READ_CONTROL) +#define STANDARD_RIGHTS_ALL (0x001F0000L) + +#define SPECIFIC_RIGHTS_ALL (0x0000FFFFL) + +#define ACCESS_SYSTEM_SECURITY (0x01000000L) + +#define MAXIMUM_ALLOWED (0x02000000L) + +#define GENERIC_READ (0x80000000L) +#define GENERIC_WRITE (0x40000000L) +#define GENERIC_EXECUTE (0x20000000L) +#define GENERIC_ALL (0x10000000L) + + typedef struct _GENERIC_MAPPING { + ACCESS_MASK GenericRead; + ACCESS_MASK GenericWrite; + ACCESS_MASK GenericExecute; + ACCESS_MASK GenericAll; + } GENERIC_MAPPING; + typedef GENERIC_MAPPING *PGENERIC_MAPPING; + +#include + + typedef struct _LUID_AND_ATTRIBUTES { + LUID Luid; + DWORD Attributes; + } LUID_AND_ATTRIBUTES,*PLUID_AND_ATTRIBUTES; + typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; + typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY; + +#include + +#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED +#define SID_IDENTIFIER_AUTHORITY_DEFINED + typedef struct _SID_IDENTIFIER_AUTHORITY { + BYTE Value[6]; + } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY; +#endif + +#ifndef SID_DEFINED +#define SID_DEFINED + typedef struct _SID { + BYTE Revision; + BYTE SubAuthorityCount; + SID_IDENTIFIER_AUTHORITY IdentifierAuthority; + DWORD SubAuthority[ANYSIZE_ARRAY]; + } SID,*PISID; +#endif + +#define SID_REVISION (1) +#define SID_MAX_SUB_AUTHORITIES (15) +#define SID_RECOMMENDED_SUB_AUTHORITIES (1) + +#define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES *sizeof(DWORD))) + + typedef enum _SID_NAME_USE { + SidTypeUser = 1,SidTypeGroup,SidTypeDomain,SidTypeAlias,SidTypeWellKnownGroup,SidTypeDeletedAccount,SidTypeInvalid,SidTypeUnknown,SidTypeComputer + } SID_NAME_USE,*PSID_NAME_USE; + + typedef struct _SID_AND_ATTRIBUTES { + PSID Sid; + DWORD Attributes; + } SID_AND_ATTRIBUTES,*PSID_AND_ATTRIBUTES; + + typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; + typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY; + +#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0} +#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1} +#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2} +#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3} +#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4} +#define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9} + +#define SECURITY_NULL_RID (0x00000000L) +#define SECURITY_WORLD_RID (0x00000000L) +#define SECURITY_LOCAL_RID (0x00000000L) + +#define SECURITY_CREATOR_OWNER_RID (0x00000000L) +#define SECURITY_CREATOR_GROUP_RID (0x00000001L) + +#define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L) +#define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L) + +#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5} + +#define SECURITY_DIALUP_RID (0x00000001L) +#define SECURITY_NETWORK_RID (0x00000002L) +#define SECURITY_BATCH_RID (0x00000003L) +#define SECURITY_INTERACTIVE_RID (0x00000004L) +#define SECURITY_LOGON_IDS_RID (0x00000005L) +#define SECURITY_LOGON_IDS_RID_COUNT (3L) +#define SECURITY_SERVICE_RID (0x00000006L) +#define SECURITY_ANONYMOUS_LOGON_RID (0x00000007L) +#define SECURITY_PROXY_RID (0x00000008L) +#define SECURITY_ENTERPRISE_CONTROLLERS_RID (0x00000009L) +#define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID +#define SECURITY_PRINCIPAL_SELF_RID (0x0000000AL) +#define SECURITY_AUTHENTICATED_USER_RID (0x0000000BL) +#define SECURITY_RESTRICTED_CODE_RID (0x0000000CL) +#define SECURITY_TERMINAL_SERVER_RID (0x0000000DL) +#define SECURITY_REMOTE_LOGON_RID (0x0000000EL) +#define SECURITY_THIS_ORGANIZATION_RID (0x0000000FL) +#define SECURITY_IUSER_RID (0x00000011L) + +#define SECURITY_LOCAL_SYSTEM_RID (0x00000012L) +#define SECURITY_LOCAL_SERVICE_RID (0x00000013L) +#define SECURITY_NETWORK_SERVICE_RID (0x00000014L) + +#define SECURITY_NT_NON_UNIQUE (0x00000015L) +#define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT (3L) + +#define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID (0x00000016L) + +#define SECURITY_BUILTIN_DOMAIN_RID (0x00000020L) +#define SECURITY_WRITE_RESTRICTED_CODE_RID (0x00000021L) + +#define SECURITY_PACKAGE_BASE_RID (0x00000040L) +#define SECURITY_PACKAGE_RID_COUNT (2L) +#define SECURITY_PACKAGE_NTLM_RID (0x0000000AL) +#define SECURITY_PACKAGE_SCHANNEL_RID (0x0000000EL) +#define SECURITY_PACKAGE_DIGEST_RID (0x00000015L) + +#define SECURITY_SERVICE_ID_BASE_RID (0x00000050L) +#define SECURITY_SERVICE_ID_RID_COUNT (6L) + +#define SECURITY_RESERVED_ID_BASE_RID (0x00000051L) + +#define SECURITY_MAX_ALWAYS_FILTERED (0x000003E7L) +#define SECURITY_MIN_NEVER_FILTERED (0x000003E8L) + +#define SECURITY_OTHER_ORGANIZATION_RID (0x000003E8L) + +#define FOREST_USER_RID_MAX (0x000001F3L) + +#define DOMAIN_USER_RID_ADMIN (0x000001F4L) +#define DOMAIN_USER_RID_GUEST (0x000001F5L) +#define DOMAIN_USER_RID_KRBTGT (0x000001F6L) + +#define DOMAIN_USER_RID_MAX (0x000003E7L) + +#define DOMAIN_GROUP_RID_ADMINS (0x00000200L) +#define DOMAIN_GROUP_RID_USERS (0x00000201L) +#define DOMAIN_GROUP_RID_GUESTS (0x00000202L) +#define DOMAIN_GROUP_RID_COMPUTERS (0x00000203L) +#define DOMAIN_GROUP_RID_CONTROLLERS (0x00000204L) +#define DOMAIN_GROUP_RID_CERT_ADMINS (0x00000205L) +#define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L) +#define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L) +#define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L) +#define DOMAIN_GROUP_RID_READONLY_CONTROLLERS (0x00000209L) + +#define DOMAIN_ALIAS_RID_ADMINS (0x00000220L) +#define DOMAIN_ALIAS_RID_USERS (0x00000221L) +#define DOMAIN_ALIAS_RID_GUESTS (0x00000222L) +#define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L) + +#define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L) +#define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L) +#define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L) +#define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L) + +#define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L) +#define DOMAIN_ALIAS_RID_RAS_SERVERS (0x00000229L) +#define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS (0x0000022AL) +#define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS (0x0000022BL) +#define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS (0x0000022CL) +#define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS (0x0000022DL) + +#define DOMAIN_ALIAS_RID_MONITORING_USERS (0x0000022EL) +#define DOMAIN_ALIAS_RID_LOGGING_USERS (0x0000022FL) +#define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS (0x00000230L) +#define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS (0x00000231L) +#define DOMAIN_ALIAS_RID_DCOM_USERS (0x00000232L) + +#define DOMAIN_ALIAS_RID_IUSERS (0x00000238L) +#define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS (0x00000239L) +#define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP (0x0000023BL) +#define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP (0x0000023CL) +#define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP (0x0000023DL) + +#define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16} +#define SECURITY_MANDATORY_UNTRUSTED_RID (0x00000000L) +#define SECURITY_MANDATORY_LOW_RID (0x00001000L) +#define SECURITY_MANDATORY_MEDIUM_RID (0x00002000L) +#define SECURITY_MANDATORY_HIGH_RID (0x00003000L) +#define SECURITY_MANDATORY_SYSTEM_RID (0x00004000L) +#define SECURITY_MANDATORY_PROTECTED_PROCESS_RID (0x00005000L) + +#define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID + +#define MANDATORY_LEVEL_TO_MANDATORY_RID(IL) (IL * 0x1000) + + typedef enum { + WinNullSid = 0,WinWorldSid = 1,WinLocalSid = 2,WinCreatorOwnerSid = 3,WinCreatorGroupSid = 4,WinCreatorOwnerServerSid = 5,WinCreatorGroupServerSid = 6,WinNtAuthoritySid = 7,WinDialupSid = 8,WinNetworkSid = 9,WinBatchSid = 10,WinInteractiveSid = 11,WinServiceSid = 12,WinAnonymousSid = 13,WinProxySid = 14,WinEnterpriseControllersSid = 15,WinSelfSid = 16,WinAuthenticatedUserSid = 17,WinRestrictedCodeSid = 18,WinTerminalServerSid = 19,WinRemoteLogonIdSid = 20,WinLogonIdsSid = 21,WinLocalSystemSid = 22,WinLocalServiceSid = 23,WinNetworkServiceSid = 24,WinBuiltinDomainSid = 25,WinBuiltinAdministratorsSid = 26,WinBuiltinUsersSid = 27,WinBuiltinGuestsSid = 28,WinBuiltinPowerUsersSid = 29,WinBuiltinAccountOperatorsSid = 30,WinBuiltinSystemOperatorsSid = 31,WinBuiltinPrintOperatorsSid = 32,WinBuiltinBackupOperatorsSid = 33,WinBuiltinReplicatorSid = 34,WinBuiltinPreWindows2000CompatibleAccessSid = 35,WinBuiltinRemoteDesktopUsersSid = 36,WinBuiltinNetworkConfigurationOperatorsSid = 37,WinAccountAdministratorSid = 38,WinAccountGuestSid = 39,WinAccountKrbtgtSid = 40,WinAccountDomainAdminsSid = 41,WinAccountDomainUsersSid = 42,WinAccountDomainGuestsSid = 43,WinAccountComputersSid = 44,WinAccountControllersSid = 45,WinAccountCertAdminsSid = 46,WinAccountSchemaAdminsSid = 47,WinAccountEnterpriseAdminsSid = 48,WinAccountPolicyAdminsSid = 49,WinAccountRasAndIasServersSid = 50,WinNTLMAuthenticationSid = 51,WinDigestAuthenticationSid = 52,WinSChannelAuthenticationSid = 53,WinThisOrganizationSid = 54,WinOtherOrganizationSid = 55,WinBuiltinIncomingForestTrustBuildersSid = 56,WinBuiltinPerfMonitoringUsersSid = 57,WinBuiltinPerfLoggingUsersSid = 58,WinBuiltinAuthorizationAccessSid = 59,WinBuiltinTerminalServerLicenseServersSid = 60,WinBuiltinDCOMUsersSid = 61 + } WELL_KNOWN_SID_TYPE; + +#define SYSTEM_LUID { 0x3E7,0x0 } +#define ANONYMOUS_LOGON_LUID { 0x3e6,0x0 } +#define LOCALSERVICE_LUID { 0x3e5,0x0 } +#define NETWORKSERVICE_LUID { 0x3e4,0x0 } +#define IUSER_LUID { 0x3e3, 0x0 } + +#define SE_GROUP_MANDATORY (0x00000001L) +#define SE_GROUP_ENABLED_BY_DEFAULT (0x00000002L) +#define SE_GROUP_ENABLED (0x00000004L) +#define SE_GROUP_OWNER (0x00000008L) +#define SE_GROUP_USE_FOR_DENY_ONLY (0x00000010L) +#define SE_GROUP_INTEGRITY (0x00000020L) +#define SE_GROUP_INTEGRITY_ENABLED (0x00000040L) +#define SE_GROUP_LOGON_ID (0xC0000000L) +#define SE_GROUP_RESOURCE (0x20000000L) + +#define ACL_REVISION (2) +#define ACL_REVISION_DS (4) + +#define ACL_REVISION1 (1) +#define MIN_ACL_REVISION ACL_REVISION2 +#define ACL_REVISION2 (2) +#define ACL_REVISION3 (3) +#define ACL_REVISION4 (4) +#define MAX_ACL_REVISION ACL_REVISION4 + + typedef struct _ACL { + BYTE AclRevision; + BYTE Sbz1; + WORD AclSize; + WORD AceCount; + WORD Sbz2; + } ACL; + typedef ACL *PACL; + + typedef struct _ACE_HEADER { + BYTE AceType; + BYTE AceFlags; + WORD AceSize; + } ACE_HEADER; + typedef ACE_HEADER *PACE_HEADER; + +#define ACCESS_MIN_MS_ACE_TYPE (0x0) +#define ACCESS_ALLOWED_ACE_TYPE (0x0) +#define ACCESS_DENIED_ACE_TYPE (0x1) +#define SYSTEM_AUDIT_ACE_TYPE (0x2) +#define SYSTEM_ALARM_ACE_TYPE (0x3) +#define ACCESS_MAX_MS_V2_ACE_TYPE (0x3) + +#define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4) +#define ACCESS_MAX_MS_V3_ACE_TYPE (0x4) + +#define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5) +#define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5) +#define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6) +#define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7) +#define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8) +#define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8) + +#define ACCESS_MAX_MS_V4_ACE_TYPE (0x8) +#define ACCESS_MAX_MS_ACE_TYPE (0x8) + +#define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9) +#define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA) +#define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB) +#define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC) +#define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD) +#define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE) +#define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF) +#define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10) + +#define SYSTEM_MANDATORY_LABEL_ACE_TYPE (0x11) +#define ACCESS_MAX_MS_V5_ACE_TYPE (0x11) + +#define OBJECT_INHERIT_ACE (0x1) +#define CONTAINER_INHERIT_ACE (0x2) +#define NO_PROPAGATE_INHERIT_ACE (0x4) +#define INHERIT_ONLY_ACE (0x8) +#define INHERITED_ACE (0x10) +#define VALID_INHERIT_FLAGS (0x1F) + +#define SUCCESSFUL_ACCESS_ACE_FLAG (0x40) +#define FAILED_ACCESS_ACE_FLAG (0x80) + + typedef struct _ACCESS_ALLOWED_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + } ACCESS_ALLOWED_ACE; + + typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE; + + typedef struct _ACCESS_DENIED_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + } ACCESS_DENIED_ACE; + typedef ACCESS_DENIED_ACE *PACCESS_DENIED_ACE; + + typedef struct _SYSTEM_AUDIT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + } SYSTEM_AUDIT_ACE; + typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE; + + typedef struct _SYSTEM_ALARM_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + } SYSTEM_ALARM_ACE; + typedef SYSTEM_ALARM_ACE *PSYSTEM_ALARM_ACE; + + typedef struct _ACCESS_ALLOWED_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE; + + typedef struct _ACCESS_DENIED_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE; + + typedef struct _SYSTEM_AUDIT_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE; + + typedef struct _SYSTEM_ALARM_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE; + + typedef struct _ACCESS_ALLOWED_CALLBACK_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + + } ACCESS_ALLOWED_CALLBACK_ACE,*PACCESS_ALLOWED_CALLBACK_ACE; + + typedef struct _ACCESS_DENIED_CALLBACK_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + + } ACCESS_DENIED_CALLBACK_ACE,*PACCESS_DENIED_CALLBACK_ACE; + + typedef struct _SYSTEM_AUDIT_CALLBACK_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + + } SYSTEM_AUDIT_CALLBACK_ACE,*PSYSTEM_AUDIT_CALLBACK_ACE; + + typedef struct _SYSTEM_ALARM_CALLBACK_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + + } SYSTEM_ALARM_CALLBACK_ACE,*PSYSTEM_ALARM_CALLBACK_ACE; + + typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + + } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE,*PACCESS_ALLOWED_CALLBACK_OBJECT_ACE; + + typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + + } ACCESS_DENIED_CALLBACK_OBJECT_ACE,*PACCESS_DENIED_CALLBACK_OBJECT_ACE; + + typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + + } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE,*PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE; + + typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + + } SYSTEM_ALARM_CALLBACK_OBJECT_ACE,*PSYSTEM_ALARM_CALLBACK_OBJECT_ACE; + +#define ACE_OBJECT_TYPE_PRESENT 0x1 +#define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2 + + typedef enum _ACL_INFORMATION_CLASS { + AclRevisionInformation = 1,AclSizeInformation + } ACL_INFORMATION_CLASS; + + typedef struct _ACL_REVISION_INFORMATION { + DWORD AclRevision; + } ACL_REVISION_INFORMATION; + typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION; + + typedef struct _ACL_SIZE_INFORMATION { + DWORD AceCount; + DWORD AclBytesInUse; + DWORD AclBytesFree; + } ACL_SIZE_INFORMATION; + typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION; + +#define SECURITY_DESCRIPTOR_REVISION (1) +#define SECURITY_DESCRIPTOR_REVISION1 (1) + +#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR)) + + typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL; + +#define SE_OWNER_DEFAULTED (0x0001) +#define SE_GROUP_DEFAULTED (0x0002) +#define SE_DACL_PRESENT (0x0004) +#define SE_DACL_DEFAULTED (0x0008) +#define SE_SACL_PRESENT (0x0010) +#define SE_SACL_DEFAULTED (0x0020) +#define SE_DACL_AUTO_INHERIT_REQ (0x0100) +#define SE_SACL_AUTO_INHERIT_REQ (0x0200) +#define SE_DACL_AUTO_INHERITED (0x0400) +#define SE_SACL_AUTO_INHERITED (0x0800) +#define SE_DACL_PROTECTED (0x1000) +#define SE_SACL_PROTECTED (0x2000) +#define SE_RM_CONTROL_VALID (0x4000) +#define SE_SELF_RELATIVE (0x8000) + + typedef struct _SECURITY_DESCRIPTOR_RELATIVE { + BYTE Revision; + BYTE Sbz1; + SECURITY_DESCRIPTOR_CONTROL Control; + DWORD Owner; + DWORD Group; + DWORD Sacl; + DWORD Dacl; + } SECURITY_DESCRIPTOR_RELATIVE,*PISECURITY_DESCRIPTOR_RELATIVE; + + typedef struct _SECURITY_DESCRIPTOR { + BYTE Revision; + BYTE Sbz1; + SECURITY_DESCRIPTOR_CONTROL Control; + PSID Owner; + PSID Group; + PACL Sacl; + PACL Dacl; + + } SECURITY_DESCRIPTOR,*PISECURITY_DESCRIPTOR; + + typedef struct _OBJECT_TYPE_LIST { + WORD Level; + WORD Sbz; + GUID *ObjectType; + } OBJECT_TYPE_LIST,*POBJECT_TYPE_LIST; + +#define ACCESS_OBJECT_GUID 0 +#define ACCESS_PROPERTY_SET_GUID 1 +#define ACCESS_PROPERTY_GUID 2 + +#define ACCESS_MAX_LEVEL 4 + + typedef enum _AUDIT_EVENT_TYPE { + AuditEventObjectAccess,AuditEventDirectoryServiceAccess + } AUDIT_EVENT_TYPE,*PAUDIT_EVENT_TYPE; + +#define AUDIT_ALLOW_NO_PRIVILEGE 0x1 + +#define ACCESS_DS_SOURCE_A "DS" +#define ACCESS_DS_SOURCE_W L"DS" +#define ACCESS_DS_OBJECT_TYPE_NAME_A "Directory Service Object" +#define ACCESS_DS_OBJECT_TYPE_NAME_W L"Directory Service Object" + +#define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L) +#define SE_PRIVILEGE_ENABLED (0x00000002L) +#define SE_PRIVILEGE_REMOVED (0X00000004L) +#define SE_PRIVILEGE_USED_FOR_ACCESS (0x80000000L) + +#define PRIVILEGE_SET_ALL_NECESSARY (1) + + typedef struct _PRIVILEGE_SET { + DWORD PrivilegeCount; + DWORD Control; + LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]; + } PRIVILEGE_SET,*PPRIVILEGE_SET; + +#define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege") +#define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege") +#define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege") +#define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege") +#define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege") +#define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege") +#define SE_TCB_NAME TEXT("SeTcbPrivilege") +#define SE_SECURITY_NAME TEXT("SeSecurityPrivilege") +#define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege") +#define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege") +#define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege") +#define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege") +#define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege") +#define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege") +#define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege") +#define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege") +#define SE_BACKUP_NAME TEXT("SeBackupPrivilege") +#define SE_RESTORE_NAME TEXT("SeRestorePrivilege") +#define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege") +#define SE_DEBUG_NAME TEXT("SeDebugPrivilege") +#define SE_AUDIT_NAME TEXT("SeAuditPrivilege") +#define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege") +#define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege") +#define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege") +#define SE_UNDOCK_NAME TEXT("SeUndockPrivilege") +#define SE_SYNC_AGENT_NAME TEXT("SeSyncAgentPrivilege") +#define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege") +#define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege") +#define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege") +#define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege") + + typedef enum _SECURITY_IMPERSONATION_LEVEL { + SecurityAnonymous,SecurityIdentification,SecurityImpersonation,SecurityDelegation + } SECURITY_IMPERSONATION_LEVEL,*PSECURITY_IMPERSONATION_LEVEL; + +#define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation +#define SECURITY_MIN_IMPERSONATION_LEVEL SecurityAnonymous +#define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation +#define VALID_IMPERSONATION_LEVEL(L) (((L) >= SECURITY_MIN_IMPERSONATION_LEVEL) && ((L) <= SECURITY_MAX_IMPERSONATION_LEVEL)) + +#define TOKEN_ASSIGN_PRIMARY (0x0001) +#define TOKEN_DUPLICATE (0x0002) +#define TOKEN_IMPERSONATE (0x0004) +#define TOKEN_QUERY (0x0008) +#define TOKEN_QUERY_SOURCE (0x0010) +#define TOKEN_ADJUST_PRIVILEGES (0x0020) +#define TOKEN_ADJUST_GROUPS (0x0040) +#define TOKEN_ADJUST_DEFAULT (0x0080) +#define TOKEN_ADJUST_SESSIONID (0x0100) + +#define TOKEN_ALL_ACCESS_P (STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE | TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT) +#define TOKEN_ALL_ACCESS (TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID) +#define TOKEN_READ (STANDARD_RIGHTS_READ | TOKEN_QUERY) + +#define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT) + +#define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE) + + typedef enum _TOKEN_TYPE { + TokenPrimary = 1,TokenImpersonation + } TOKEN_TYPE; + typedef TOKEN_TYPE *PTOKEN_TYPE; + + typedef enum _TOKEN_INFORMATION_CLASS { + TokenUser = 1,TokenGroups,TokenPrivileges,TokenOwner,TokenPrimaryGroup,TokenDefaultDacl,TokenSource,TokenType,TokenImpersonationLevel, + TokenStatistics,TokenRestrictedSids,TokenSessionId,TokenGroupsAndPrivileges,TokenSessionReference,TokenSandBoxInert,TokenAuditPolicy, + TokenOrigin,MaxTokenInfoClass + } TOKEN_INFORMATION_CLASS,*PTOKEN_INFORMATION_CLASS; + + typedef struct _TOKEN_USER { + SID_AND_ATTRIBUTES User; + } TOKEN_USER,*PTOKEN_USER; + + typedef struct _TOKEN_GROUPS { + DWORD GroupCount; + SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]; + } TOKEN_GROUPS,*PTOKEN_GROUPS; + + typedef struct _TOKEN_PRIVILEGES { + DWORD PrivilegeCount; + LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; + } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES; + + typedef struct _TOKEN_OWNER { + PSID Owner; + } TOKEN_OWNER,*PTOKEN_OWNER; + + typedef struct _TOKEN_PRIMARY_GROUP { + PSID PrimaryGroup; + } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP; + + typedef struct _TOKEN_DEFAULT_DACL { + PACL DefaultDacl; + } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL; + + typedef struct _TOKEN_GROUPS_AND_PRIVILEGES { + DWORD SidCount; + DWORD SidLength; + PSID_AND_ATTRIBUTES Sids; + DWORD RestrictedSidCount; + DWORD RestrictedSidLength; + PSID_AND_ATTRIBUTES RestrictedSids; + DWORD PrivilegeCount; + DWORD PrivilegeLength; + PLUID_AND_ATTRIBUTES Privileges; + LUID AuthenticationId; + } TOKEN_GROUPS_AND_PRIVILEGES,*PTOKEN_GROUPS_AND_PRIVILEGES; + +#define TOKEN_AUDIT_SUCCESS_INCLUDE 0x1 +#define TOKEN_AUDIT_SUCCESS_EXCLUDE 0x2 +#define TOKEN_AUDIT_FAILURE_INCLUDE 0x4 +#define TOKEN_AUDIT_FAILURE_EXCLUDE 0x8 + +#define VALID_AUDIT_POLICY_BITS (TOKEN_AUDIT_SUCCESS_INCLUDE | TOKEN_AUDIT_SUCCESS_EXCLUDE | TOKEN_AUDIT_FAILURE_INCLUDE | TOKEN_AUDIT_FAILURE_EXCLUDE) +#define VALID_TOKEN_AUDIT_POLICY_ELEMENT(P) ((((P).PolicyMask & ~VALID_AUDIT_POLICY_BITS)==0) && ((P).Category <= AuditEventMaxType)) + + typedef struct _TOKEN_AUDIT_POLICY_ELEMENT { + DWORD Category; + DWORD PolicyMask; + } TOKEN_AUDIT_POLICY_ELEMENT,*PTOKEN_AUDIT_POLICY_ELEMENT; + + typedef struct _TOKEN_AUDIT_POLICY { + DWORD PolicyCount; + TOKEN_AUDIT_POLICY_ELEMENT Policy[ANYSIZE_ARRAY]; + } TOKEN_AUDIT_POLICY,*PTOKEN_AUDIT_POLICY; + +#define PER_USER_AUDITING_POLICY_SIZE(p) (sizeof(TOKEN_AUDIT_POLICY) + (((p)->PolicyCount > ANYSIZE_ARRAY) ? (sizeof(TOKEN_AUDIT_POLICY_ELEMENT) *((p)->PolicyCount - ANYSIZE_ARRAY)) : 0)) +#define PER_USER_AUDITING_POLICY_SIZE_BY_COUNT(C) (sizeof(TOKEN_AUDIT_POLICY) + (((C) > ANYSIZE_ARRAY) ? (sizeof(TOKEN_AUDIT_POLICY_ELEMENT) *((C) - ANYSIZE_ARRAY)) : 0)) + +#define TOKEN_SOURCE_LENGTH 8 + + typedef struct _TOKEN_SOURCE { + CHAR SourceName[TOKEN_SOURCE_LENGTH]; + LUID SourceIdentifier; + } TOKEN_SOURCE,*PTOKEN_SOURCE; + + typedef struct _TOKEN_STATISTICS { + LUID TokenId; + LUID AuthenticationId; + LARGE_INTEGER ExpirationTime; + TOKEN_TYPE TokenType; + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; + DWORD DynamicCharged; + DWORD DynamicAvailable; + DWORD GroupCount; + DWORD PrivilegeCount; + LUID ModifiedId; + } TOKEN_STATISTICS,*PTOKEN_STATISTICS; + + typedef struct _TOKEN_CONTROL { + LUID TokenId; + LUID AuthenticationId; + LUID ModifiedId; + TOKEN_SOURCE TokenSource; + } TOKEN_CONTROL,*PTOKEN_CONTROL; + + typedef struct _TOKEN_ORIGIN { + LUID OriginatingLogonSession; + } TOKEN_ORIGIN,*PTOKEN_ORIGIN; + +#define SECURITY_DYNAMIC_TRACKING (TRUE) +#define SECURITY_STATIC_TRACKING (FALSE) + + typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,*PSECURITY_CONTEXT_TRACKING_MODE; + + typedef struct _SECURITY_QUALITY_OF_SERVICE { + DWORD Length; + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; + SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; + BOOLEAN EffectiveOnly; + } SECURITY_QUALITY_OF_SERVICE,*PSECURITY_QUALITY_OF_SERVICE; + + typedef struct _SE_IMPERSONATION_STATE { + PACCESS_TOKEN Token; + BOOLEAN CopyOnOpen; + BOOLEAN EffectiveOnly; + SECURITY_IMPERSONATION_LEVEL Level; + } SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE; + +#define DISABLE_MAX_PRIVILEGE 0x1 +#define SANDBOX_INERT 0x2 + + typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION; + +#define OWNER_SECURITY_INFORMATION (0x00000001L) +#define GROUP_SECURITY_INFORMATION (0x00000002L) +#define DACL_SECURITY_INFORMATION (0x00000004L) +#define SACL_SECURITY_INFORMATION (0x00000008L) + +#define PROTECTED_DACL_SECURITY_INFORMATION (0x80000000L) +#define PROTECTED_SACL_SECURITY_INFORMATION (0x40000000L) +#define UNPROTECTED_DACL_SECURITY_INFORMATION (0x20000000L) +#define UNPROTECTED_SACL_SECURITY_INFORMATION (0x10000000L) + +#define PROCESS_TERMINATE (0x0001) +#define PROCESS_CREATE_THREAD (0x0002) +#define PROCESS_SET_SESSIONID (0x0004) +#define PROCESS_VM_OPERATION (0x0008) +#define PROCESS_VM_READ (0x0010) +#define PROCESS_VM_WRITE (0x0020) +#define PROCESS_DUP_HANDLE (0x0040) +#define PROCESS_CREATE_PROCESS (0x0080) +#define PROCESS_SET_QUOTA (0x0100) +#define PROCESS_SET_INFORMATION (0x0200) +#define PROCESS_QUERY_INFORMATION (0x0400) +#define PROCESS_SUSPEND_RESUME (0x0800) +#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF) + +#ifdef _WIN64 +#define MAXIMUM_PROCESSORS 64 +#else +#define MAXIMUM_PROCESSORS 32 +#endif + +#define THREAD_TERMINATE (0x0001) +#define THREAD_SUSPEND_RESUME (0x0002) +#define THREAD_GET_CONTEXT (0x0008) +#define THREAD_SET_CONTEXT (0x0010) +#define THREAD_SET_INFORMATION (0x0020) +#define THREAD_QUERY_INFORMATION (0x0040) +#define THREAD_SET_THREAD_TOKEN (0x0080) +#define THREAD_IMPERSONATE (0x0100) +#define THREAD_DIRECT_IMPERSONATION (0x0200) + +#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3FF) + +#define JOB_OBJECT_ASSIGN_PROCESS (0x0001) +#define JOB_OBJECT_SET_ATTRIBUTES (0x0002) +#define JOB_OBJECT_QUERY (0x0004) +#define JOB_OBJECT_TERMINATE (0x0008) +#define JOB_OBJECT_SET_SECURITY_ATTRIBUTES (0x0010) +#define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1F) + + typedef struct _JOB_SET_ARRAY { + HANDLE JobHandle; + DWORD MemberLevel; + DWORD Flags; + } JOB_SET_ARRAY,*PJOB_SET_ARRAY; + +#define FLS_MAXIMUM_AVAILABLE 128 +#define TLS_MINIMUM_AVAILABLE 64 + +#ifndef _NT_TIB_DEFINED +#define _NT_TIB_DEFINED + typedef struct _NT_TIB { + struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; + PVOID StackBase; + PVOID StackLimit; + PVOID SubSystemTib; + union { + PVOID FiberData; + DWORD Version; + }; + PVOID ArbitraryUserPointer; + struct _NT_TIB *Self; + } NT_TIB; + typedef NT_TIB *PNT_TIB; +#endif + + typedef struct _NT_TIB32 { + DWORD ExceptionList; + DWORD StackBase; + DWORD StackLimit; + DWORD SubSystemTib; + union { + DWORD FiberData; + DWORD Version; + }; + DWORD ArbitraryUserPointer; + DWORD Self; + } NT_TIB32,*PNT_TIB32; + + typedef struct _NT_TIB64 { + DWORD64 ExceptionList; + DWORD64 StackBase; + DWORD64 StackLimit; + DWORD64 SubSystemTib; + union { + DWORD64 FiberData; + DWORD Version; + }; + DWORD64 ArbitraryUserPointer; + DWORD64 Self; + } NT_TIB64,*PNT_TIB64; + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) +#define WX86 +#endif + +#define THREAD_BASE_PRIORITY_LOWRT 15 +#define THREAD_BASE_PRIORITY_MAX 2 +#define THREAD_BASE_PRIORITY_MIN (-2) +#define THREAD_BASE_PRIORITY_IDLE (-15) + + typedef struct _QUOTA_LIMITS { + SIZE_T PagedPoolLimit; + SIZE_T NonPagedPoolLimit; + SIZE_T MinimumWorkingSetSize; + SIZE_T MaximumWorkingSetSize; + SIZE_T PagefileLimit; + LARGE_INTEGER TimeLimit; + } QUOTA_LIMITS,*PQUOTA_LIMITS; + +#define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001 +#define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002 +#define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004 +#define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008 + + typedef struct _QUOTA_LIMITS_EX { + SIZE_T PagedPoolLimit; + SIZE_T NonPagedPoolLimit; + SIZE_T MinimumWorkingSetSize; + SIZE_T MaximumWorkingSetSize; + SIZE_T PagefileLimit; + LARGE_INTEGER TimeLimit; + SIZE_T Reserved1; + SIZE_T Reserved2; + SIZE_T Reserved3; + SIZE_T Reserved4; + DWORD Flags; + DWORD Reserved5; + } QUOTA_LIMITS_EX,*PQUOTA_LIMITS_EX; + + typedef struct _IO_COUNTERS { + ULONGLONG ReadOperationCount; + ULONGLONG WriteOperationCount; + ULONGLONG OtherOperationCount; + ULONGLONG ReadTransferCount; + ULONGLONG WriteTransferCount; + ULONGLONG OtherTransferCount; + } IO_COUNTERS; + typedef IO_COUNTERS *PIO_COUNTERS; + + typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION { + LARGE_INTEGER TotalUserTime; + LARGE_INTEGER TotalKernelTime; + LARGE_INTEGER ThisPeriodTotalUserTime; + LARGE_INTEGER ThisPeriodTotalKernelTime; + DWORD TotalPageFaultCount; + DWORD TotalProcesses; + DWORD ActiveProcesses; + DWORD TotalTerminatedProcesses; + } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION; + + typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION { + LARGE_INTEGER PerProcessUserTimeLimit; + LARGE_INTEGER PerJobUserTimeLimit; + DWORD LimitFlags; + SIZE_T MinimumWorkingSetSize; + SIZE_T MaximumWorkingSetSize; + DWORD ActiveProcessLimit; + ULONG_PTR Affinity; + DWORD PriorityClass; + DWORD SchedulingClass; + } JOBOBJECT_BASIC_LIMIT_INFORMATION,*PJOBOBJECT_BASIC_LIMIT_INFORMATION; + + typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION { + JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; + IO_COUNTERS IoInfo; + SIZE_T ProcessMemoryLimit; + SIZE_T JobMemoryLimit; + SIZE_T PeakProcessMemoryUsed; + SIZE_T PeakJobMemoryUsed; + } JOBOBJECT_EXTENDED_LIMIT_INFORMATION,*PJOBOBJECT_EXTENDED_LIMIT_INFORMATION; + + typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST { + DWORD NumberOfAssignedProcesses; + DWORD NumberOfProcessIdsInList; + ULONG_PTR ProcessIdList[1]; + } JOBOBJECT_BASIC_PROCESS_ID_LIST,*PJOBOBJECT_BASIC_PROCESS_ID_LIST; + + typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS { + DWORD UIRestrictionsClass; + } JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS; + + typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION { + DWORD SecurityLimitFlags; + HANDLE JobToken; + PTOKEN_GROUPS SidsToDisable; + PTOKEN_PRIVILEGES PrivilegesToDelete; + PTOKEN_GROUPS RestrictedSids; + } JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION; + + typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION { + DWORD EndOfJobTimeAction; + } JOBOBJECT_END_OF_JOB_TIME_INFORMATION,*PJOBOBJECT_END_OF_JOB_TIME_INFORMATION; + + typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT { + PVOID CompletionKey; + HANDLE CompletionPort; + } JOBOBJECT_ASSOCIATE_COMPLETION_PORT,*PJOBOBJECT_ASSOCIATE_COMPLETION_PORT; + + typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION { + JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo; + IO_COUNTERS IoInfo; + } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION; + + typedef struct _JOBOBJECT_JOBSET_INFORMATION { + DWORD MemberLevel; + } JOBOBJECT_JOBSET_INFORMATION,*PJOBOBJECT_JOBSET_INFORMATION; + +#define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0 +#define JOB_OBJECT_POST_AT_END_OF_JOB 1 + +#define JOB_OBJECT_MSG_END_OF_JOB_TIME 1 +#define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2 +#define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3 +#define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4 +#define JOB_OBJECT_MSG_NEW_PROCESS 6 +#define JOB_OBJECT_MSG_EXIT_PROCESS 7 +#define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8 +#define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9 +#define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10 + +#define JOB_OBJECT_LIMIT_WORKINGSET 0x00000001 +#define JOB_OBJECT_LIMIT_PROCESS_TIME 0x00000002 +#define JOB_OBJECT_LIMIT_JOB_TIME 0x00000004 +#define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x00000008 +#define JOB_OBJECT_LIMIT_AFFINITY 0x00000010 +#define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x00000020 +#define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x00000040 +#define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x00000080 + +#define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100 +#define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200 +#define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400 +#define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800 +#define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000 +#define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000 + +#define JOB_OBJECT_LIMIT_RESERVED2 0x00004000 +#define JOB_OBJECT_LIMIT_RESERVED3 0x00008000 +#define JOB_OBJECT_LIMIT_RESERVED4 0x00010000 +#define JOB_OBJECT_LIMIT_RESERVED5 0x00020000 +#define JOB_OBJECT_LIMIT_RESERVED6 0x00040000 + +#define JOB_OBJECT_LIMIT_VALID_FLAGS 0x0007ffff + +#define JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS 0x000000ff +#define JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS 0x00003fff +#define JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS 0x0007ffff + +#define JOB_OBJECT_UILIMIT_NONE 0x00000000 + +#define JOB_OBJECT_UILIMIT_HANDLES 0x00000001 +#define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x00000002 +#define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x00000004 +#define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x00000008 +#define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x00000010 +#define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x00000020 +#define JOB_OBJECT_UILIMIT_DESKTOP 0x00000040 +#define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x00000080 + +#define JOB_OBJECT_UILIMIT_ALL 0x000000FF + +#define JOB_OBJECT_UI_VALID_FLAGS 0x000000FF + +#define JOB_OBJECT_SECURITY_NO_ADMIN 0x00000001 +#define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x00000002 +#define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x00000004 +#define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x00000008 + +#define JOB_OBJECT_SECURITY_VALID_FLAGS 0x0000000f + + typedef enum _JOBOBJECTINFOCLASS { + JobObjectBasicAccountingInformation = 1,JobObjectBasicLimitInformation,JobObjectBasicProcessIdList,JobObjectBasicUIRestrictions, + JobObjectSecurityLimitInformation,JobObjectEndOfJobTimeInformation,JobObjectAssociateCompletionPortInformation, + JobObjectBasicAndIoAccountingInformation,JobObjectExtendedLimitInformation,JobObjectJobSetInformation,MaxJobObjectInfoClass + } JOBOBJECTINFOCLASS; + +#define EVENT_MODIFY_STATE 0x0002 +#define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) + +#define MUTANT_QUERY_STATE 0x0001 + +#define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE| MUTANT_QUERY_STATE) +#define SEMAPHORE_MODIFY_STATE 0x0002 +#define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) + +#define TIMER_QUERY_STATE 0x0001 +#define TIMER_MODIFY_STATE 0x0002 + +#define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE| TIMER_QUERY_STATE|TIMER_MODIFY_STATE) + +#define TIME_ZONE_ID_UNKNOWN 0 +#define TIME_ZONE_ID_STANDARD 1 +#define TIME_ZONE_ID_DAYLIGHT 2 + + typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP { + RelationProcessorCore,RelationNumaNode,RelationCache + } LOGICAL_PROCESSOR_RELATIONSHIP; + +#define LTP_PC_SMT 0x1 + + typedef enum _PROCESSOR_CACHE_TYPE { + CacheUnified,CacheInstruction,CacheData,CacheTrace + } PROCESSOR_CACHE_TYPE; + +#define CACHE_FULLY_ASSOCIATIVE 0xFF + + typedef struct _CACHE_DESCRIPTOR { + BYTE Level; + BYTE Associativity; + WORD LineSize; + DWORD Size; + PROCESSOR_CACHE_TYPE Type; + } CACHE_DESCRIPTOR,*PCACHE_DESCRIPTOR; + + typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION { + ULONG_PTR ProcessorMask; + LOGICAL_PROCESSOR_RELATIONSHIP Relationship; + union { + struct { + BYTE Flags; + } ProcessorCore; + struct { + DWORD NodeNumber; + } NumaNode; + CACHE_DESCRIPTOR Cache; + ULONGLONG Reserved[2]; + }; + } SYSTEM_LOGICAL_PROCESSOR_INFORMATION,*PSYSTEM_LOGICAL_PROCESSOR_INFORMATION; + +#define PROCESSOR_INTEL_386 386 +#define PROCESSOR_INTEL_486 486 +#define PROCESSOR_INTEL_PENTIUM 586 +#define PROCESSOR_INTEL_IA64 2200 +#define PROCESSOR_AMD_X8664 8664 +#define PROCESSOR_MIPS_R4000 4000 +#define PROCESSOR_ALPHA_21064 21064 +#define PROCESSOR_PPC_601 601 +#define PROCESSOR_PPC_603 603 +#define PROCESSOR_PPC_604 604 +#define PROCESSOR_PPC_620 620 +#define PROCESSOR_HITACHI_SH3 10003 +#define PROCESSOR_HITACHI_SH3E 10004 +#define PROCESSOR_HITACHI_SH4 10005 +#define PROCESSOR_MOTOROLA_821 821 +#define PROCESSOR_SHx_SH3 103 +#define PROCESSOR_SHx_SH4 104 +#define PROCESSOR_STRONGARM 2577 +#define PROCESSOR_ARM720 1824 +#define PROCESSOR_ARM820 2080 +#define PROCESSOR_ARM920 2336 +#define PROCESSOR_ARM_7TDMI 70001 +#define PROCESSOR_OPTIL 0x494f + +#define PROCESSOR_ARCHITECTURE_INTEL 0 +#define PROCESSOR_ARCHITECTURE_MIPS 1 +#define PROCESSOR_ARCHITECTURE_ALPHA 2 +#define PROCESSOR_ARCHITECTURE_PPC 3 +#define PROCESSOR_ARCHITECTURE_SHX 4 +#define PROCESSOR_ARCHITECTURE_ARM 5 +#define PROCESSOR_ARCHITECTURE_IA64 6 +#define PROCESSOR_ARCHITECTURE_ALPHA64 7 +#define PROCESSOR_ARCHITECTURE_MSIL 8 +#define PROCESSOR_ARCHITECTURE_AMD64 9 +#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10 + +#define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF + +#define PF_FLOATING_POINT_PRECISION_ERRATA 0 +#define PF_FLOATING_POINT_EMULATED 1 +#define PF_COMPARE_EXCHANGE_DOUBLE 2 +#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 +#define PF_PPC_MOVEMEM_64BIT_OK 4 +#define PF_ALPHA_BYTE_INSTRUCTIONS 5 +#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 +#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 +#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 +#define PF_PAE_ENABLED 9 +#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 +#define PF_SSE_DAZ_MODE_AVAILABLE 11 +#define PF_NX_ENABLED 12 + + typedef struct _MEMORY_BASIC_INFORMATION { + PVOID BaseAddress; + PVOID AllocationBase; + DWORD AllocationProtect; + SIZE_T RegionSize; + DWORD State; + DWORD Protect; + DWORD Type; + } MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION; + + typedef struct _MEMORY_BASIC_INFORMATION32 { + DWORD BaseAddress; + DWORD AllocationBase; + DWORD AllocationProtect; + DWORD RegionSize; + DWORD State; + DWORD Protect; + DWORD Type; + } MEMORY_BASIC_INFORMATION32,*PMEMORY_BASIC_INFORMATION32; + + typedef DECLSPEC_ALIGN(16) struct _MEMORY_BASIC_INFORMATION64 { + ULONGLONG BaseAddress; + ULONGLONG AllocationBase; + DWORD AllocationProtect; + DWORD __alignment1; + ULONGLONG RegionSize; + DWORD State; + DWORD Protect; + DWORD Type; + DWORD __alignment2; + } MEMORY_BASIC_INFORMATION64,*PMEMORY_BASIC_INFORMATION64; + +#define SECTION_QUERY 0x0001 +#define SECTION_MAP_WRITE 0x0002 +#define SECTION_MAP_READ 0x0004 +#define SECTION_MAP_EXECUTE 0x0008 +#define SECTION_EXTEND_SIZE 0x0010 +#define SECTION_MAP_EXECUTE_EXPLICIT 0x0020 + +#define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY| SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE) +#define PAGE_NOACCESS 0x01 +#define PAGE_READONLY 0x02 +#define PAGE_READWRITE 0x04 +#define PAGE_WRITECOPY 0x08 +#define PAGE_EXECUTE 0x10 +#define PAGE_EXECUTE_READ 0x20 +#define PAGE_EXECUTE_READWRITE 0x40 +#define PAGE_EXECUTE_WRITECOPY 0x80 +#define PAGE_GUARD 0x100 +#define PAGE_NOCACHE 0x200 +#define PAGE_WRITECOMBINE 0x400 +#define MEM_COMMIT 0x1000 +#define MEM_RESERVE 0x2000 +#define MEM_DECOMMIT 0x4000 +#define MEM_RELEASE 0x8000 +#define MEM_FREE 0x10000 +#define MEM_PRIVATE 0x20000 +#define MEM_MAPPED 0x40000 +#define MEM_RESET 0x80000 +#define MEM_TOP_DOWN 0x100000 +#define MEM_WRITE_WATCH 0x200000 +#define MEM_PHYSICAL 0x400000 +#define MEM_LARGE_PAGES 0x20000000 +#define MEM_4MB_PAGES 0x80000000 +#define SEC_FILE 0x800000 +#define SEC_IMAGE 0x1000000 +#define SEC_RESERVE 0x4000000 +#define SEC_COMMIT 0x8000000 +#define SEC_NOCACHE 0x10000000 +#define SEC_LARGE_PAGES 0x80000000 +#define MEM_IMAGE SEC_IMAGE +#define WRITE_WATCH_FLAG_RESET 0x01 + +#define FILE_READ_DATA (0x0001) +#define FILE_LIST_DIRECTORY (0x0001) + +#define FILE_WRITE_DATA (0x0002) +#define FILE_ADD_FILE (0x0002) + +#define FILE_APPEND_DATA (0x0004) +#define FILE_ADD_SUBDIRECTORY (0x0004) +#define FILE_CREATE_PIPE_INSTANCE (0x0004) + +#define FILE_READ_EA (0x0008) + +#define FILE_WRITE_EA (0x0010) + +#define FILE_EXECUTE (0x0020) +#define FILE_TRAVERSE (0x0020) + +#define FILE_DELETE_CHILD (0x0040) + +#define FILE_READ_ATTRIBUTES (0x0080) + +#define FILE_WRITE_ATTRIBUTES (0x0100) + +#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) +#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE) +#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE) +#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE) + +#define FILE_SHARE_READ 0x00000001 +#define FILE_SHARE_WRITE 0x00000002 +#define FILE_SHARE_DELETE 0x00000004 +#define FILE_ATTRIBUTE_READONLY 0x00000001 +#define FILE_ATTRIBUTE_HIDDEN 0x00000002 +#define FILE_ATTRIBUTE_SYSTEM 0x00000004 +#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 +#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 +#define FILE_ATTRIBUTE_DEVICE 0x00000040 +#define FILE_ATTRIBUTE_NORMAL 0x00000080 +#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 +#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 +#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 +#define FILE_ATTRIBUTE_COMPRESSED 0x00000800 +#define FILE_ATTRIBUTE_OFFLINE 0x00001000 +#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 +#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 +#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 +#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 +#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 +#define FILE_NOTIFY_CHANGE_SIZE 0x00000008 +#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 +#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 +#define FILE_NOTIFY_CHANGE_CREATION 0x00000040 +#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 +#define FILE_ACTION_ADDED 0x00000001 +#define FILE_ACTION_REMOVED 0x00000002 +#define FILE_ACTION_MODIFIED 0x00000003 +#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 +#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 +#define MAILSLOT_NO_MESSAGE ((DWORD)-1) +#define MAILSLOT_WAIT_FOREVER ((DWORD)-1) +#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 +#define FILE_CASE_PRESERVED_NAMES 0x00000002 +#define FILE_UNICODE_ON_DISK 0x00000004 +#define FILE_PERSISTENT_ACLS 0x00000008 +#define FILE_FILE_COMPRESSION 0x00000010 +#define FILE_VOLUME_QUOTAS 0x00000020 +#define FILE_SUPPORTS_SPARSE_FILES 0x00000040 +#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 +#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 +#define FILE_VOLUME_IS_COMPRESSED 0x00008000 +#define FILE_SUPPORTS_OBJECT_IDS 0x00010000 +#define FILE_SUPPORTS_ENCRYPTION 0x00020000 +#define FILE_NAMED_STREAMS 0x00040000 +#define FILE_READ_ONLY_VOLUME 0x00080000 + + typedef struct _FILE_NOTIFY_INFORMATION { + DWORD NextEntryOffset; + DWORD Action; + DWORD FileNameLength; + WCHAR FileName[1]; + } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION; + + typedef union _FILE_SEGMENT_ELEMENT { + PVOID64 Buffer; + ULONGLONG Alignment; + }FILE_SEGMENT_ELEMENT,*PFILE_SEGMENT_ELEMENT; + + typedef struct _REPARSE_GUID_DATA_BUFFER { + DWORD ReparseTag; + WORD ReparseDataLength; + WORD Reserved; + GUID ReparseGuid; + struct { + BYTE DataBuffer[1]; + } GenericReparseBuffer; + } REPARSE_GUID_DATA_BUFFER,*PREPARSE_GUID_DATA_BUFFER; + +#define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER,GenericReparseBuffer) + +#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 *1024) + +#define IO_REPARSE_TAG_RESERVED_ZERO (0) +#define IO_REPARSE_TAG_RESERVED_ONE (1) + +#define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE + +#define IsReparseTagMicrosoft(_tag) (((_tag) & 0x80000000)) +#define IsReparseTagNameSurrogate(_tag) (((_tag) & 0x20000000)) + +#define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L) +#define IO_REPARSE_TAG_HSM (0xC0000004L) +#define IO_REPARSE_TAG_SIS (0x80000007L) +#define IO_REPARSE_TAG_DFS (0x8000000AL) +#define IO_REPARSE_TAG_FILTER_MANAGER (0x8000000BL) +#define IO_COMPLETION_MODIFY_STATE 0x0002 +#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) +#define DUPLICATE_CLOSE_SOURCE 0x00000001 +#define DUPLICATE_SAME_ACCESS 0x00000002 + + typedef enum _SYSTEM_POWER_STATE { + PowerSystemUnspecified = 0,PowerSystemWorking = 1,PowerSystemSleeping1 = 2,PowerSystemSleeping2 = 3,PowerSystemSleeping3 = 4,PowerSystemHibernate = 5,PowerSystemShutdown = 6,PowerSystemMaximum = 7 + } SYSTEM_POWER_STATE,*PSYSTEM_POWER_STATE; + +#define POWER_SYSTEM_MAXIMUM 7 + + typedef enum { + PowerActionNone = 0,PowerActionReserved,PowerActionSleep,PowerActionHibernate,PowerActionShutdown,PowerActionShutdownReset,PowerActionShutdownOff,PowerActionWarmEject + } POWER_ACTION,*PPOWER_ACTION; + + typedef enum _DEVICE_POWER_STATE { + PowerDeviceUnspecified = 0,PowerDeviceD0,PowerDeviceD1,PowerDeviceD2,PowerDeviceD3,PowerDeviceMaximum + } DEVICE_POWER_STATE,*PDEVICE_POWER_STATE; + +#define ES_SYSTEM_REQUIRED ((DWORD)0x00000001) +#define ES_DISPLAY_REQUIRED ((DWORD)0x00000002) +#define ES_USER_PRESENT ((DWORD)0x00000004) +#define ES_CONTINUOUS ((DWORD)0x80000000) + + typedef DWORD EXECUTION_STATE; + + typedef enum { + LT_DONT_CARE,LT_LOWEST_LATENCY + } LATENCY_TIME; + +#define PDCAP_D0_SUPPORTED 0x00000001 +#define PDCAP_D1_SUPPORTED 0x00000002 +#define PDCAP_D2_SUPPORTED 0x00000004 +#define PDCAP_D3_SUPPORTED 0x00000008 +#define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010 +#define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020 +#define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040 +#define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080 +#define PDCAP_WARM_EJECT_SUPPORTED 0x00000100 + + typedef struct CM_Power_Data_s { + DWORD PD_Size; + DEVICE_POWER_STATE PD_MostRecentPowerState; + DWORD PD_Capabilities; + DWORD PD_D1Latency; + DWORD PD_D2Latency; + DWORD PD_D3Latency; + DEVICE_POWER_STATE PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM]; + SYSTEM_POWER_STATE PD_DeepestSystemWake; + } CM_POWER_DATA,*PCM_POWER_DATA; + + typedef enum { + SystemPowerPolicyAc,SystemPowerPolicyDc,VerifySystemPolicyAc,VerifySystemPolicyDc,SystemPowerCapabilities,SystemBatteryState,SystemPowerStateHandler,ProcessorStateHandler,SystemPowerPolicyCurrent,AdministratorPowerPolicy,SystemReserveHiberFile,ProcessorInformation,SystemPowerInformation,ProcessorStateHandler2,LastWakeTime,LastSleepTime,SystemExecutionState,SystemPowerStateNotifyHandler,ProcessorPowerPolicyAc,ProcessorPowerPolicyDc,VerifyProcessorPowerPolicyAc,VerifyProcessorPowerPolicyDc,ProcessorPowerPolicyCurrent,SystemPowerStateLogging,SystemPowerLoggingEntry + } POWER_INFORMATION_LEVEL; + + typedef struct { + DWORD Granularity; + DWORD Capacity; + } BATTERY_REPORTING_SCALE,*PBATTERY_REPORTING_SCALE; + + typedef struct { + POWER_ACTION Action; + DWORD Flags; + DWORD EventCode; + } POWER_ACTION_POLICY,*PPOWER_ACTION_POLICY; + +#define POWER_ACTION_QUERY_ALLOWED 0x00000001 +#define POWER_ACTION_UI_ALLOWED 0x00000002 +#define POWER_ACTION_OVERRIDE_APPS 0x00000004 +#define POWER_ACTION_LIGHTEST_FIRST 0x10000000 +#define POWER_ACTION_LOCK_CONSOLE 0x20000000 +#define POWER_ACTION_DISABLE_WAKES 0x40000000 +#define POWER_ACTION_CRITICAL 0x80000000 + +#define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001 +#define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002 +#define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004 +#define POWER_USER_NOTIFY_BUTTON 0x00000008 +#define POWER_USER_NOTIFY_SHUTDOWN 0x00000010 +#define POWER_FORCE_TRIGGER_RESET 0x80000000 + + typedef struct { + BOOLEAN Enable; + BYTE Spare[3]; + DWORD BatteryLevel; + POWER_ACTION_POLICY PowerPolicy; + SYSTEM_POWER_STATE MinSystemState; + } SYSTEM_POWER_LEVEL,*PSYSTEM_POWER_LEVEL; + +#define NUM_DISCHARGE_POLICIES 4 +#define DISCHARGE_POLICY_CRITICAL 0 +#define DISCHARGE_POLICY_LOW 1 + +#define PO_THROTTLE_NONE 0 +#define PO_THROTTLE_CONSTANT 1 +#define PO_THROTTLE_DEGRADE 2 +#define PO_THROTTLE_ADAPTIVE 3 +#define PO_THROTTLE_MAXIMUM 4 + + typedef struct _SYSTEM_POWER_POLICY { + DWORD Revision; + POWER_ACTION_POLICY PowerButton; + POWER_ACTION_POLICY SleepButton; + POWER_ACTION_POLICY LidClose; + SYSTEM_POWER_STATE LidOpenWake; + DWORD Reserved; + POWER_ACTION_POLICY Idle; + DWORD IdleTimeout; + BYTE IdleSensitivity; + BYTE DynamicThrottle; + BYTE Spare2[2]; + SYSTEM_POWER_STATE MinSleep; + SYSTEM_POWER_STATE MaxSleep; + SYSTEM_POWER_STATE ReducedLatencySleep; + DWORD WinLogonFlags; + DWORD Spare3; + DWORD DozeS4Timeout; + DWORD BroadcastCapacityResolution; + SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES]; + DWORD VideoTimeout; + BOOLEAN VideoDimDisplay; + DWORD VideoReserved[3]; + DWORD SpindownTimeout; + BOOLEAN OptimizeForPower; + BYTE FanThrottleTolerance; + BYTE ForcedThrottle; + BYTE MinThrottle; + POWER_ACTION_POLICY OverThrottled; + } SYSTEM_POWER_POLICY,*PSYSTEM_POWER_POLICY; + + typedef struct _PROCESSOR_POWER_POLICY_INFO { + DWORD TimeCheck; + DWORD DemoteLimit; + DWORD PromoteLimit; + BYTE DemotePercent; + BYTE PromotePercent; + BYTE Spare[2]; + DWORD AllowDemotion:1; + DWORD AllowPromotion:1; + DWORD Reserved:30; + } PROCESSOR_POWER_POLICY_INFO,*PPROCESSOR_POWER_POLICY_INFO; + + typedef struct _PROCESSOR_POWER_POLICY { + DWORD Revision; + BYTE DynamicThrottle; + BYTE Spare[3]; + DWORD DisableCStates:1; + DWORD Reserved:31; + DWORD PolicyCount; + PROCESSOR_POWER_POLICY_INFO Policy[3]; + } PROCESSOR_POWER_POLICY,*PPROCESSOR_POWER_POLICY; + + typedef struct _ADMINISTRATOR_POWER_POLICY { + SYSTEM_POWER_STATE MinSleep; + SYSTEM_POWER_STATE MaxSleep; + DWORD MinVideoTimeout; + DWORD MaxVideoTimeout; + DWORD MinSpindownTimeout; + DWORD MaxSpindownTimeout; + } ADMINISTRATOR_POWER_POLICY,*PADMINISTRATOR_POWER_POLICY; + + typedef struct { + BOOLEAN PowerButtonPresent; + BOOLEAN SleepButtonPresent; + BOOLEAN LidPresent; + BOOLEAN SystemS1; + BOOLEAN SystemS2; + BOOLEAN SystemS3; + BOOLEAN SystemS4; + BOOLEAN SystemS5; + BOOLEAN HiberFilePresent; + BOOLEAN FullWake; + BOOLEAN VideoDimPresent; + BOOLEAN ApmPresent; + BOOLEAN UpsPresent; + BOOLEAN ThermalControl; + BOOLEAN ProcessorThrottle; + BYTE ProcessorMinThrottle; + BYTE ProcessorMaxThrottle; + BYTE spare2[4]; + BOOLEAN DiskSpinDown; + BYTE spare3[8]; + BOOLEAN SystemBatteriesPresent; + BOOLEAN BatteriesAreShortTerm; + BATTERY_REPORTING_SCALE BatteryScale[3]; + SYSTEM_POWER_STATE AcOnLineWake; + SYSTEM_POWER_STATE SoftLidWake; + SYSTEM_POWER_STATE RtcWake; + SYSTEM_POWER_STATE MinDeviceWakeState; + SYSTEM_POWER_STATE DefaultLowLatencyWake; + } SYSTEM_POWER_CAPABILITIES,*PSYSTEM_POWER_CAPABILITIES; + + typedef struct { + BOOLEAN AcOnLine; + BOOLEAN BatteryPresent; + BOOLEAN Charging; + BOOLEAN Discharging; + BOOLEAN Spare1[4]; + DWORD MaxCapacity; + DWORD RemainingCapacity; + DWORD Rate; + DWORD EstimatedTime; + DWORD DefaultAlert1; + DWORD DefaultAlert2; + } SYSTEM_BATTERY_STATE,*PSYSTEM_BATTERY_STATE; + +#include "pshpack4.h" + +#define IMAGE_DOS_SIGNATURE 0x5A4D +#define IMAGE_OS2_SIGNATURE 0x454E +#define IMAGE_OS2_SIGNATURE_LE 0x454C +#define IMAGE_VXD_SIGNATURE 0x454C +#define IMAGE_NT_SIGNATURE 0x00004550 + +#include "pshpack2.h" + + typedef struct _IMAGE_DOS_HEADER { + WORD e_magic; + WORD e_cblp; + WORD e_cp; + WORD e_crlc; + WORD e_cparhdr; + WORD e_minalloc; + WORD e_maxalloc; + WORD e_ss; + WORD e_sp; + WORD e_csum; + WORD e_ip; + WORD e_cs; + WORD e_lfarlc; + WORD e_ovno; + WORD e_res[4]; + WORD e_oemid; + WORD e_oeminfo; + WORD e_res2[10]; + LONG e_lfanew; + } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER; + + typedef struct _IMAGE_OS2_HEADER { + WORD ne_magic; + CHAR ne_ver; + CHAR ne_rev; + WORD ne_enttab; + WORD ne_cbenttab; + LONG ne_crc; + WORD ne_flags; + WORD ne_autodata; + WORD ne_heap; + WORD ne_stack; + LONG ne_csip; + LONG ne_sssp; + WORD ne_cseg; + WORD ne_cmod; + WORD ne_cbnrestab; + WORD ne_segtab; + WORD ne_rsrctab; + WORD ne_restab; + WORD ne_modtab; + WORD ne_imptab; + LONG ne_nrestab; + WORD ne_cmovent; + WORD ne_align; + WORD ne_cres; + BYTE ne_exetyp; + BYTE ne_flagsothers; + WORD ne_pretthunks; + WORD ne_psegrefbytes; + WORD ne_swaparea; + WORD ne_expver; + } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER; + + typedef struct _IMAGE_VXD_HEADER { + WORD e32_magic; + BYTE e32_border; + BYTE e32_worder; + DWORD e32_level; + WORD e32_cpu; + WORD e32_os; + DWORD e32_ver; + DWORD e32_mflags; + DWORD e32_mpages; + DWORD e32_startobj; + DWORD e32_eip; + DWORD e32_stackobj; + DWORD e32_esp; + DWORD e32_pagesize; + DWORD e32_lastpagesize; + DWORD e32_fixupsize; + DWORD e32_fixupsum; + DWORD e32_ldrsize; + DWORD e32_ldrsum; + DWORD e32_objtab; + DWORD e32_objcnt; + DWORD e32_objmap; + DWORD e32_itermap; + DWORD e32_rsrctab; + DWORD e32_rsrccnt; + DWORD e32_restab; + DWORD e32_enttab; + DWORD e32_dirtab; + DWORD e32_dircnt; + DWORD e32_fpagetab; + DWORD e32_frectab; + DWORD e32_impmod; + DWORD e32_impmodcnt; + DWORD e32_impproc; + DWORD e32_pagesum; + DWORD e32_datapage; + DWORD e32_preload; + DWORD e32_nrestab; + DWORD e32_cbnrestab; + DWORD e32_nressum; + DWORD e32_autodata; + DWORD e32_debuginfo; + DWORD e32_debuglen; + DWORD e32_instpreload; + DWORD e32_instdemand; + DWORD e32_heapsize; + BYTE e32_res3[12]; + DWORD e32_winresoff; + DWORD e32_winreslen; + WORD e32_devid; + WORD e32_ddkver; + } IMAGE_VXD_HEADER,*PIMAGE_VXD_HEADER; + +#include "poppack.h" + + typedef struct _IMAGE_FILE_HEADER { + WORD Machine; + WORD NumberOfSections; + DWORD TimeDateStamp; + DWORD PointerToSymbolTable; + DWORD NumberOfSymbols; + WORD SizeOfOptionalHeader; + WORD Characteristics; + } IMAGE_FILE_HEADER,*PIMAGE_FILE_HEADER; + +#define IMAGE_SIZEOF_FILE_HEADER 20 + +#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 +#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 +#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 +#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 +#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010 +#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 +#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 +#define IMAGE_FILE_32BIT_MACHINE 0x0100 +#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 +#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400 +#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800 +#define IMAGE_FILE_SYSTEM 0x1000 +#define IMAGE_FILE_DLL 0x2000 +#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000 +#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 + +#define IMAGE_FILE_MACHINE_UNKNOWN 0 +#define IMAGE_FILE_MACHINE_I386 0x014c +#define IMAGE_FILE_MACHINE_R3000 0x0162 +#define IMAGE_FILE_MACHINE_R4000 0x0166 +#define IMAGE_FILE_MACHINE_R10000 0x0168 +#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 +#define IMAGE_FILE_MACHINE_ALPHA 0x0184 +#define IMAGE_FILE_MACHINE_SH3 0x01a2 +#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3 +#define IMAGE_FILE_MACHINE_SH3E 0x01a4 +#define IMAGE_FILE_MACHINE_SH4 0x01a6 +#define IMAGE_FILE_MACHINE_SH5 0x01a8 +#define IMAGE_FILE_MACHINE_ARM 0x01c0 +#define IMAGE_FILE_MACHINE_THUMB 0x01c2 +#define IMAGE_FILE_MACHINE_AM33 0x01d3 +#define IMAGE_FILE_MACHINE_POWERPC 0x01F0 +#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 +#define IMAGE_FILE_MACHINE_IA64 0x0200 +#define IMAGE_FILE_MACHINE_MIPS16 0x0266 +#define IMAGE_FILE_MACHINE_ALPHA64 0x0284 +#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 +#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 +#define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64 +#define IMAGE_FILE_MACHINE_TRICORE 0x0520 +#define IMAGE_FILE_MACHINE_CEF 0x0CEF +#define IMAGE_FILE_MACHINE_EBC 0x0EBC +#define IMAGE_FILE_MACHINE_AMD64 0x8664 +#define IMAGE_FILE_MACHINE_M32R 0x9041 +#define IMAGE_FILE_MACHINE_CEE 0xC0EE + + typedef struct _IMAGE_DATA_DIRECTORY { + DWORD VirtualAddress; + DWORD Size; + } IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY; + +#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 + + typedef struct _IMAGE_OPTIONAL_HEADER { + + WORD Magic; + BYTE MajorLinkerVersion; + BYTE MinorLinkerVersion; + DWORD SizeOfCode; + DWORD SizeOfInitializedData; + DWORD SizeOfUninitializedData; + DWORD AddressOfEntryPoint; + DWORD BaseOfCode; + DWORD BaseOfData; + DWORD ImageBase; + DWORD SectionAlignment; + DWORD FileAlignment; + WORD MajorOperatingSystemVersion; + WORD MinorOperatingSystemVersion; + WORD MajorImageVersion; + WORD MinorImageVersion; + WORD MajorSubsystemVersion; + WORD MinorSubsystemVersion; + DWORD Win32VersionValue; + DWORD SizeOfImage; + DWORD SizeOfHeaders; + DWORD CheckSum; + WORD Subsystem; + WORD DllCharacteristics; + DWORD SizeOfStackReserve; + DWORD SizeOfStackCommit; + DWORD SizeOfHeapReserve; + DWORD SizeOfHeapCommit; + DWORD LoaderFlags; + DWORD NumberOfRvaAndSizes; + IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; + } IMAGE_OPTIONAL_HEADER32,*PIMAGE_OPTIONAL_HEADER32; + + typedef struct _IMAGE_ROM_OPTIONAL_HEADER { + WORD Magic; + BYTE MajorLinkerVersion; + BYTE MinorLinkerVersion; + DWORD SizeOfCode; + DWORD SizeOfInitializedData; + DWORD SizeOfUninitializedData; + DWORD AddressOfEntryPoint; + DWORD BaseOfCode; + DWORD BaseOfData; + DWORD BaseOfBss; + DWORD GprMask; + DWORD CprMask[4]; + DWORD GpValue; + } IMAGE_ROM_OPTIONAL_HEADER,*PIMAGE_ROM_OPTIONAL_HEADER; + + typedef struct _IMAGE_OPTIONAL_HEADER64 { + WORD Magic; + BYTE MajorLinkerVersion; + BYTE MinorLinkerVersion; + DWORD SizeOfCode; + DWORD SizeOfInitializedData; + DWORD SizeOfUninitializedData; + DWORD AddressOfEntryPoint; + DWORD BaseOfCode; + ULONGLONG ImageBase; + DWORD SectionAlignment; + DWORD FileAlignment; + WORD MajorOperatingSystemVersion; + WORD MinorOperatingSystemVersion; + WORD MajorImageVersion; + WORD MinorImageVersion; + WORD MajorSubsystemVersion; + WORD MinorSubsystemVersion; + DWORD Win32VersionValue; + DWORD SizeOfImage; + DWORD SizeOfHeaders; + DWORD CheckSum; + WORD Subsystem; + WORD DllCharacteristics; + ULONGLONG SizeOfStackReserve; + ULONGLONG SizeOfStackCommit; + ULONGLONG SizeOfHeapReserve; + ULONGLONG SizeOfHeapCommit; + DWORD LoaderFlags; + DWORD NumberOfRvaAndSizes; + IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; + } IMAGE_OPTIONAL_HEADER64,*PIMAGE_OPTIONAL_HEADER64; + +#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 +#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 +#define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224 +#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240 + +#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b +#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b +#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 + +#ifdef _WIN64 + typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER; + typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER; +#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER +#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC +#else + typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER; + typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER; +#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER +#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC +#endif + + typedef struct _IMAGE_NT_HEADERS64 { + DWORD Signature; + IMAGE_FILE_HEADER FileHeader; + IMAGE_OPTIONAL_HEADER64 OptionalHeader; + } IMAGE_NT_HEADERS64,*PIMAGE_NT_HEADERS64; + + typedef struct _IMAGE_NT_HEADERS { + DWORD Signature; + IMAGE_FILE_HEADER FileHeader; + IMAGE_OPTIONAL_HEADER32 OptionalHeader; + } IMAGE_NT_HEADERS32,*PIMAGE_NT_HEADERS32; + + typedef struct _IMAGE_ROM_HEADERS { + IMAGE_FILE_HEADER FileHeader; + IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; + } IMAGE_ROM_HEADERS,*PIMAGE_ROM_HEADERS; + +#ifdef _WIN64 + typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS; + typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS; +#else + typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS; + typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS; +#endif + +#define IMAGE_FIRST_SECTION(ntheader) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)ntheader + FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader) + ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader)) + +#define IMAGE_SUBSYSTEM_UNKNOWN 0 +#define IMAGE_SUBSYSTEM_NATIVE 1 +#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 +#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 +#define IMAGE_SUBSYSTEM_OS2_CUI 5 +#define IMAGE_SUBSYSTEM_POSIX_CUI 7 +#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 +#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 +#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 +#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 +#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 +#define IMAGE_SUBSYSTEM_EFI_ROM 13 +#define IMAGE_SUBSYSTEM_XBOX 14 + +#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200 +#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400 +#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 +#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 +#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 + +#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 +#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 +#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 +#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 +#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 +#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 +#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 + +#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7 +#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 +#define IMAGE_DIRECTORY_ENTRY_TLS 9 +#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 +#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 +#define IMAGE_DIRECTORY_ENTRY_IAT 12 +#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13 +#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 + + typedef struct ANON_OBJECT_HEADER { + WORD Sig1; + WORD Sig2; + WORD Version; + WORD Machine; + DWORD TimeDateStamp; + CLSID ClassID; + DWORD SizeOfData; + } ANON_OBJECT_HEADER; + +#define IMAGE_SIZEOF_SHORT_NAME 8 + + typedef struct _IMAGE_SECTION_HEADER { + BYTE Name[IMAGE_SIZEOF_SHORT_NAME]; + union { + DWORD PhysicalAddress; + DWORD VirtualSize; + } Misc; + DWORD VirtualAddress; + DWORD SizeOfRawData; + DWORD PointerToRawData; + DWORD PointerToRelocations; + DWORD PointerToLinenumbers; + WORD NumberOfRelocations; + WORD NumberOfLinenumbers; + DWORD Characteristics; + } IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER; + +#define IMAGE_SIZEOF_SECTION_HEADER 40 + +#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 + +#define IMAGE_SCN_CNT_CODE 0x00000020 +#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 +#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 +#define IMAGE_SCN_LNK_OTHER 0x00000100 +#define IMAGE_SCN_LNK_INFO 0x00000200 +#define IMAGE_SCN_LNK_REMOVE 0x00000800 +#define IMAGE_SCN_LNK_COMDAT 0x00001000 +#define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000 +#define IMAGE_SCN_GPREL 0x00008000 +#define IMAGE_SCN_MEM_FARDATA 0x00008000 +#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 +#define IMAGE_SCN_MEM_16BIT 0x00020000 +#define IMAGE_SCN_MEM_LOCKED 0x00040000 +#define IMAGE_SCN_MEM_PRELOAD 0x00080000 + +#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 +#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 +#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 +#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 +#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 +#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 +#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 +#define IMAGE_SCN_ALIGN_128BYTES 0x00800000 +#define IMAGE_SCN_ALIGN_256BYTES 0x00900000 +#define IMAGE_SCN_ALIGN_512BYTES 0x00A00000 +#define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000 +#define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000 +#define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000 +#define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000 + +#define IMAGE_SCN_ALIGN_MASK 0x00F00000 + +#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 +#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 +#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 +#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 +#define IMAGE_SCN_MEM_SHARED 0x10000000 +#define IMAGE_SCN_MEM_EXECUTE 0x20000000 +#define IMAGE_SCN_MEM_READ 0x40000000 +#define IMAGE_SCN_MEM_WRITE 0x80000000 + +#define IMAGE_SCN_SCALE_INDEX 0x00000001 + +#include "pshpack2.h" + + typedef struct _IMAGE_SYMBOL { + union { + BYTE ShortName[8]; + struct { + DWORD Short; + DWORD Long; + } Name; + DWORD LongName[2]; + } N; + DWORD Value; + SHORT SectionNumber; + WORD Type; + BYTE StorageClass; + BYTE NumberOfAuxSymbols; + } IMAGE_SYMBOL; + typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL; + +#define IMAGE_SIZEOF_SYMBOL 18 + +#define IMAGE_SYM_UNDEFINED (SHORT)0 +#define IMAGE_SYM_ABSOLUTE (SHORT)-1 +#define IMAGE_SYM_DEBUG (SHORT)-2 +#define IMAGE_SYM_SECTION_MAX 0xFEFF + +#define IMAGE_SYM_TYPE_NULL 0x0000 +#define IMAGE_SYM_TYPE_VOID 0x0001 +#define IMAGE_SYM_TYPE_CHAR 0x0002 +#define IMAGE_SYM_TYPE_SHORT 0x0003 +#define IMAGE_SYM_TYPE_INT 0x0004 +#define IMAGE_SYM_TYPE_LONG 0x0005 +#define IMAGE_SYM_TYPE_FLOAT 0x0006 +#define IMAGE_SYM_TYPE_DOUBLE 0x0007 +#define IMAGE_SYM_TYPE_STRUCT 0x0008 +#define IMAGE_SYM_TYPE_UNION 0x0009 +#define IMAGE_SYM_TYPE_ENUM 0x000A +#define IMAGE_SYM_TYPE_MOE 0x000B +#define IMAGE_SYM_TYPE_BYTE 0x000C +#define IMAGE_SYM_TYPE_WORD 0x000D +#define IMAGE_SYM_TYPE_UINT 0x000E +#define IMAGE_SYM_TYPE_DWORD 0x000F +#define IMAGE_SYM_TYPE_PCODE 0x8000 + +#define IMAGE_SYM_DTYPE_NULL 0 +#define IMAGE_SYM_DTYPE_POINTER 1 +#define IMAGE_SYM_DTYPE_FUNCTION 2 +#define IMAGE_SYM_DTYPE_ARRAY 3 + +#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE)-1 +#define IMAGE_SYM_CLASS_NULL 0x0000 +#define IMAGE_SYM_CLASS_AUTOMATIC 0x0001 +#define IMAGE_SYM_CLASS_EXTERNAL 0x0002 +#define IMAGE_SYM_CLASS_STATIC 0x0003 +#define IMAGE_SYM_CLASS_REGISTER 0x0004 +#define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005 +#define IMAGE_SYM_CLASS_LABEL 0x0006 +#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007 +#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008 +#define IMAGE_SYM_CLASS_ARGUMENT 0x0009 +#define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A +#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B +#define IMAGE_SYM_CLASS_UNION_TAG 0x000C +#define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D +#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E +#define IMAGE_SYM_CLASS_ENUM_TAG 0x000F +#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010 +#define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011 +#define IMAGE_SYM_CLASS_BIT_FIELD 0x0012 +#define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044 +#define IMAGE_SYM_CLASS_BLOCK 0x0064 +#define IMAGE_SYM_CLASS_FUNCTION 0x0065 +#define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066 +#define IMAGE_SYM_CLASS_FILE 0x0067 +#define IMAGE_SYM_CLASS_SECTION 0x0068 +#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069 +#define IMAGE_SYM_CLASS_CLR_TOKEN 0x006B + +#define N_BTMASK 0x000F +#define N_TMASK 0x0030 +#define N_TMASK1 0x00C0 +#define N_TMASK2 0x00F0 +#define N_BTSHFT 4 +#define N_TSHIFT 2 + +#define BTYPE(x) ((x) & N_BTMASK) + +#ifndef ISPTR +#define ISPTR(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_POINTER << N_BTSHFT)) +#endif + +#ifndef ISFCN +#define ISFCN(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT)) +#endif + +#ifndef ISARY +#define ISARY(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT)) +#endif + +#ifndef ISTAG +#define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG) +#endif + +#ifndef INCREF +#define INCREF(x) ((((x)&~N_BTMASK)<>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) +#endif + + typedef union _IMAGE_AUX_SYMBOL { + struct { + DWORD TagIndex; + union { + struct { + WORD Linenumber; + WORD Size; + } LnSz; + DWORD TotalSize; + } Misc; + union { + struct { + DWORD PointerToLinenumber; + DWORD PointerToNextFunction; + } Function; + struct { + WORD Dimension[4]; + } Array; + } FcnAry; + WORD TvIndex; + } Sym; + struct { + BYTE Name[IMAGE_SIZEOF_SYMBOL]; + } File; + struct { + DWORD Length; + WORD NumberOfRelocations; + WORD NumberOfLinenumbers; + DWORD CheckSum; + SHORT Number; + BYTE Selection; + } Section; + } IMAGE_AUX_SYMBOL; + typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL; + +#define IMAGE_SIZEOF_AUX_SYMBOL 18 + + typedef enum IMAGE_AUX_SYMBOL_TYPE { + IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1 + } IMAGE_AUX_SYMBOL_TYPE; + +#include + + typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF { + BYTE bAuxType; + BYTE bReserved; + DWORD SymbolTableIndex; + BYTE rgbReserved[12]; + } IMAGE_AUX_SYMBOL_TOKEN_DEF; + + typedef IMAGE_AUX_SYMBOL_TOKEN_DEF UNALIGNED *PIMAGE_AUX_SYMBOL_TOKEN_DEF; + +#include + +#define IMAGE_COMDAT_SELECT_NODUPLICATES 1 +#define IMAGE_COMDAT_SELECT_ANY 2 +#define IMAGE_COMDAT_SELECT_SAME_SIZE 3 +#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 +#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 +#define IMAGE_COMDAT_SELECT_LARGEST 6 +#define IMAGE_COMDAT_SELECT_NEWEST 7 + +#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 +#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 +#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 + + typedef struct _IMAGE_RELOCATION { + union { + DWORD VirtualAddress; + DWORD RelocCount; + }; + DWORD SymbolTableIndex; + WORD Type; + } IMAGE_RELOCATION; + typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION; + +#define IMAGE_SIZEOF_RELOCATION 10 + +#define IMAGE_REL_I386_ABSOLUTE 0x0000 +#define IMAGE_REL_I386_DIR16 0x0001 +#define IMAGE_REL_I386_REL16 0x0002 +#define IMAGE_REL_I386_DIR32 0x0006 +#define IMAGE_REL_I386_DIR32NB 0x0007 +#define IMAGE_REL_I386_SEG12 0x0009 +#define IMAGE_REL_I386_SECTION 0x000A +#define IMAGE_REL_I386_SECREL 0x000B +#define IMAGE_REL_I386_TOKEN 0x000C +#define IMAGE_REL_I386_SECREL7 0x000D +#define IMAGE_REL_I386_REL32 0x0014 + +#define IMAGE_REL_MIPS_ABSOLUTE 0x0000 +#define IMAGE_REL_MIPS_REFHALF 0x0001 +#define IMAGE_REL_MIPS_REFWORD 0x0002 +#define IMAGE_REL_MIPS_JMPADDR 0x0003 +#define IMAGE_REL_MIPS_REFHI 0x0004 +#define IMAGE_REL_MIPS_REFLO 0x0005 +#define IMAGE_REL_MIPS_GPREL 0x0006 +#define IMAGE_REL_MIPS_LITERAL 0x0007 +#define IMAGE_REL_MIPS_SECTION 0x000A +#define IMAGE_REL_MIPS_SECREL 0x000B +#define IMAGE_REL_MIPS_SECRELLO 0x000C +#define IMAGE_REL_MIPS_SECRELHI 0x000D +#define IMAGE_REL_MIPS_TOKEN 0x000E +#define IMAGE_REL_MIPS_JMPADDR16 0x0010 +#define IMAGE_REL_MIPS_REFWORDNB 0x0022 +#define IMAGE_REL_MIPS_PAIR 0x0025 + +#define IMAGE_REL_ALPHA_ABSOLUTE 0x0000 +#define IMAGE_REL_ALPHA_REFLONG 0x0001 +#define IMAGE_REL_ALPHA_REFQUAD 0x0002 +#define IMAGE_REL_ALPHA_GPREL32 0x0003 +#define IMAGE_REL_ALPHA_LITERAL 0x0004 +#define IMAGE_REL_ALPHA_LITUSE 0x0005 +#define IMAGE_REL_ALPHA_GPDISP 0x0006 +#define IMAGE_REL_ALPHA_BRADDR 0x0007 +#define IMAGE_REL_ALPHA_HINT 0x0008 +#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009 +#define IMAGE_REL_ALPHA_REFHI 0x000A +#define IMAGE_REL_ALPHA_REFLO 0x000B +#define IMAGE_REL_ALPHA_PAIR 0x000C +#define IMAGE_REL_ALPHA_MATCH 0x000D +#define IMAGE_REL_ALPHA_SECTION 0x000E +#define IMAGE_REL_ALPHA_SECREL 0x000F +#define IMAGE_REL_ALPHA_REFLONGNB 0x0010 +#define IMAGE_REL_ALPHA_SECRELLO 0x0011 +#define IMAGE_REL_ALPHA_SECRELHI 0x0012 +#define IMAGE_REL_ALPHA_REFQ3 0x0013 +#define IMAGE_REL_ALPHA_REFQ2 0x0014 +#define IMAGE_REL_ALPHA_REFQ1 0x0015 +#define IMAGE_REL_ALPHA_GPRELLO 0x0016 +#define IMAGE_REL_ALPHA_GPRELHI 0x0017 + +#define IMAGE_REL_PPC_ABSOLUTE 0x0000 +#define IMAGE_REL_PPC_ADDR64 0x0001 +#define IMAGE_REL_PPC_ADDR32 0x0002 +#define IMAGE_REL_PPC_ADDR24 0x0003 +#define IMAGE_REL_PPC_ADDR16 0x0004 +#define IMAGE_REL_PPC_ADDR14 0x0005 +#define IMAGE_REL_PPC_REL24 0x0006 +#define IMAGE_REL_PPC_REL14 0x0007 +#define IMAGE_REL_PPC_TOCREL16 0x0008 +#define IMAGE_REL_PPC_TOCREL14 0x0009 +#define IMAGE_REL_PPC_ADDR32NB 0x000A +#define IMAGE_REL_PPC_SECREL 0x000B +#define IMAGE_REL_PPC_SECTION 0x000C +#define IMAGE_REL_PPC_IFGLUE 0x000D +#define IMAGE_REL_PPC_IMGLUE 0x000E +#define IMAGE_REL_PPC_SECREL16 0x000F +#define IMAGE_REL_PPC_REFHI 0x0010 +#define IMAGE_REL_PPC_REFLO 0x0011 +#define IMAGE_REL_PPC_PAIR 0x0012 +#define IMAGE_REL_PPC_SECRELLO 0x0013 +#define IMAGE_REL_PPC_SECRELHI 0x0014 +#define IMAGE_REL_PPC_GPREL 0x0015 +#define IMAGE_REL_PPC_TOKEN 0x0016 +#define IMAGE_REL_PPC_TYPEMASK 0x00FF +#define IMAGE_REL_PPC_NEG 0x0100 +#define IMAGE_REL_PPC_BRTAKEN 0x0200 +#define IMAGE_REL_PPC_BRNTAKEN 0x0400 +#define IMAGE_REL_PPC_TOCDEFN 0x0800 + +#define IMAGE_REL_SH3_ABSOLUTE 0x0000 +#define IMAGE_REL_SH3_DIRECT16 0x0001 +#define IMAGE_REL_SH3_DIRECT32 0x0002 +#define IMAGE_REL_SH3_DIRECT8 0x0003 +#define IMAGE_REL_SH3_DIRECT8_WORD 0x0004 +#define IMAGE_REL_SH3_DIRECT8_LONG 0x0005 +#define IMAGE_REL_SH3_DIRECT4 0x0006 +#define IMAGE_REL_SH3_DIRECT4_WORD 0x0007 +#define IMAGE_REL_SH3_DIRECT4_LONG 0x0008 +#define IMAGE_REL_SH3_PCREL8_WORD 0x0009 +#define IMAGE_REL_SH3_PCREL8_LONG 0x000A +#define IMAGE_REL_SH3_PCREL12_WORD 0x000B +#define IMAGE_REL_SH3_STARTOF_SECTION 0x000C +#define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D +#define IMAGE_REL_SH3_SECTION 0x000E +#define IMAGE_REL_SH3_SECREL 0x000F +#define IMAGE_REL_SH3_DIRECT32_NB 0x0010 +#define IMAGE_REL_SH3_GPREL4_LONG 0x0011 +#define IMAGE_REL_SH3_TOKEN 0x0012 + +#define IMAGE_REL_SHM_PCRELPT 0x0013 +#define IMAGE_REL_SHM_REFLO 0x0014 +#define IMAGE_REL_SHM_REFHALF 0x0015 +#define IMAGE_REL_SHM_RELLO 0x0016 +#define IMAGE_REL_SHM_RELHALF 0x0017 +#define IMAGE_REL_SHM_PAIR 0x0018 + +#define IMAGE_REL_SH_NOMODE 0x8000 + +#define IMAGE_REL_ARM_ABSOLUTE 0x0000 +#define IMAGE_REL_ARM_ADDR32 0x0001 +#define IMAGE_REL_ARM_ADDR32NB 0x0002 +#define IMAGE_REL_ARM_BRANCH24 0x0003 +#define IMAGE_REL_ARM_BRANCH11 0x0004 +#define IMAGE_REL_ARM_TOKEN 0x0005 +#define IMAGE_REL_ARM_GPREL12 0x0006 +#define IMAGE_REL_ARM_GPREL7 0x0007 +#define IMAGE_REL_ARM_BLX24 0x0008 +#define IMAGE_REL_ARM_BLX11 0x0009 +#define IMAGE_REL_ARM_SECTION 0x000E +#define IMAGE_REL_ARM_SECREL 0x000F + +#define IMAGE_REL_AM_ABSOLUTE 0x0000 +#define IMAGE_REL_AM_ADDR32 0x0001 +#define IMAGE_REL_AM_ADDR32NB 0x0002 +#define IMAGE_REL_AM_CALL32 0x0003 +#define IMAGE_REL_AM_FUNCINFO 0x0004 +#define IMAGE_REL_AM_REL32_1 0x0005 +#define IMAGE_REL_AM_REL32_2 0x0006 +#define IMAGE_REL_AM_SECREL 0x0007 +#define IMAGE_REL_AM_SECTION 0x0008 +#define IMAGE_REL_AM_TOKEN 0x0009 + +#define IMAGE_REL_AMD64_ABSOLUTE 0x0000 +#define IMAGE_REL_AMD64_ADDR64 0x0001 +#define IMAGE_REL_AMD64_ADDR32 0x0002 +#define IMAGE_REL_AMD64_ADDR32NB 0x0003 +#define IMAGE_REL_AMD64_REL32 0x0004 +#define IMAGE_REL_AMD64_REL32_1 0x0005 +#define IMAGE_REL_AMD64_REL32_2 0x0006 +#define IMAGE_REL_AMD64_REL32_3 0x0007 +#define IMAGE_REL_AMD64_REL32_4 0x0008 +#define IMAGE_REL_AMD64_REL32_5 0x0009 +#define IMAGE_REL_AMD64_SECTION 0x000A +#define IMAGE_REL_AMD64_SECREL 0x000B +#define IMAGE_REL_AMD64_SECREL7 0x000C +#define IMAGE_REL_AMD64_TOKEN 0x000D +#define IMAGE_REL_AMD64_SREL32 0x000E +#define IMAGE_REL_AMD64_PAIR 0x000F +#define IMAGE_REL_AMD64_SSPAN32 0x0010 + +#define IMAGE_REL_IA64_ABSOLUTE 0x0000 +#define IMAGE_REL_IA64_IMM14 0x0001 +#define IMAGE_REL_IA64_IMM22 0x0002 +#define IMAGE_REL_IA64_IMM64 0x0003 +#define IMAGE_REL_IA64_DIR32 0x0004 +#define IMAGE_REL_IA64_DIR64 0x0005 +#define IMAGE_REL_IA64_PCREL21B 0x0006 +#define IMAGE_REL_IA64_PCREL21M 0x0007 +#define IMAGE_REL_IA64_PCREL21F 0x0008 +#define IMAGE_REL_IA64_GPREL22 0x0009 +#define IMAGE_REL_IA64_LTOFF22 0x000A +#define IMAGE_REL_IA64_SECTION 0x000B +#define IMAGE_REL_IA64_SECREL22 0x000C +#define IMAGE_REL_IA64_SECREL64I 0x000D +#define IMAGE_REL_IA64_SECREL32 0x000E + +#define IMAGE_REL_IA64_DIR32NB 0x0010 +#define IMAGE_REL_IA64_SREL14 0x0011 +#define IMAGE_REL_IA64_SREL22 0x0012 +#define IMAGE_REL_IA64_SREL32 0x0013 +#define IMAGE_REL_IA64_UREL32 0x0014 +#define IMAGE_REL_IA64_PCREL60X 0x0015 +#define IMAGE_REL_IA64_PCREL60B 0x0016 +#define IMAGE_REL_IA64_PCREL60F 0x0017 +#define IMAGE_REL_IA64_PCREL60I 0x0018 +#define IMAGE_REL_IA64_PCREL60M 0x0019 +#define IMAGE_REL_IA64_IMMGPREL64 0x001A +#define IMAGE_REL_IA64_TOKEN 0x001B +#define IMAGE_REL_IA64_GPREL32 0x001C +#define IMAGE_REL_IA64_ADDEND 0x001F + +#define IMAGE_REL_CEF_ABSOLUTE 0x0000 +#define IMAGE_REL_CEF_ADDR32 0x0001 +#define IMAGE_REL_CEF_ADDR64 0x0002 +#define IMAGE_REL_CEF_ADDR32NB 0x0003 +#define IMAGE_REL_CEF_SECTION 0x0004 +#define IMAGE_REL_CEF_SECREL 0x0005 +#define IMAGE_REL_CEF_TOKEN 0x0006 + +#define IMAGE_REL_CEE_ABSOLUTE 0x0000 +#define IMAGE_REL_CEE_ADDR32 0x0001 +#define IMAGE_REL_CEE_ADDR64 0x0002 +#define IMAGE_REL_CEE_ADDR32NB 0x0003 +#define IMAGE_REL_CEE_SECTION 0x0004 +#define IMAGE_REL_CEE_SECREL 0x0005 +#define IMAGE_REL_CEE_TOKEN 0x0006 + +#define IMAGE_REL_M32R_ABSOLUTE 0x0000 +#define IMAGE_REL_M32R_ADDR32 0x0001 +#define IMAGE_REL_M32R_ADDR32NB 0x0002 +#define IMAGE_REL_M32R_ADDR24 0x0003 +#define IMAGE_REL_M32R_GPREL16 0x0004 +#define IMAGE_REL_M32R_PCREL24 0x0005 +#define IMAGE_REL_M32R_PCREL16 0x0006 +#define IMAGE_REL_M32R_PCREL8 0x0007 +#define IMAGE_REL_M32R_REFHALF 0x0008 +#define IMAGE_REL_M32R_REFHI 0x0009 +#define IMAGE_REL_M32R_REFLO 0x000A +#define IMAGE_REL_M32R_PAIR 0x000B +#define IMAGE_REL_M32R_SECTION 0x000C +#define IMAGE_REL_M32R_SECREL32 0x000D +#define IMAGE_REL_M32R_TOKEN 0x000E + +#define EXT_IMM64(Value,Address,Size,InstPos,ValPos) Value |= (((ULONGLONG)((*(Address) >> InstPos) & (((ULONGLONG)1 << Size) - 1))) << ValPos) +#define INS_IMM64(Value,Address,Size,InstPos,ValPos) *(PDWORD)Address = (*(PDWORD)Address & ~(((1 << Size) - 1) << InstPos)) | ((DWORD)((((ULONGLONG)Value >> ValPos) & (((ULONGLONG)1 << Size) - 1))) << InstPos) + +#define EMARCH_ENC_I17_IMM7B_INST_WORD_X 3 +#define EMARCH_ENC_I17_IMM7B_SIZE_X 7 +#define EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X 4 +#define EMARCH_ENC_I17_IMM7B_VAL_POS_X 0 + +#define EMARCH_ENC_I17_IMM9D_INST_WORD_X 3 +#define EMARCH_ENC_I17_IMM9D_SIZE_X 9 +#define EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X 18 +#define EMARCH_ENC_I17_IMM9D_VAL_POS_X 7 + +#define EMARCH_ENC_I17_IMM5C_INST_WORD_X 3 +#define EMARCH_ENC_I17_IMM5C_SIZE_X 5 +#define EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X 13 +#define EMARCH_ENC_I17_IMM5C_VAL_POS_X 16 + +#define EMARCH_ENC_I17_IC_INST_WORD_X 3 +#define EMARCH_ENC_I17_IC_SIZE_X 1 +#define EMARCH_ENC_I17_IC_INST_WORD_POS_X 12 +#define EMARCH_ENC_I17_IC_VAL_POS_X 21 + +#define EMARCH_ENC_I17_IMM41a_INST_WORD_X 1 +#define EMARCH_ENC_I17_IMM41a_SIZE_X 10 +#define EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X 14 +#define EMARCH_ENC_I17_IMM41a_VAL_POS_X 22 + +#define EMARCH_ENC_I17_IMM41b_INST_WORD_X 1 +#define EMARCH_ENC_I17_IMM41b_SIZE_X 8 +#define EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X 24 +#define EMARCH_ENC_I17_IMM41b_VAL_POS_X 32 + +#define EMARCH_ENC_I17_IMM41c_INST_WORD_X 2 +#define EMARCH_ENC_I17_IMM41c_SIZE_X 23 +#define EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X 0 +#define EMARCH_ENC_I17_IMM41c_VAL_POS_X 40 + +#define EMARCH_ENC_I17_SIGN_INST_WORD_X 3 +#define EMARCH_ENC_I17_SIGN_SIZE_X 1 +#define EMARCH_ENC_I17_SIGN_INST_WORD_POS_X 27 +#define EMARCH_ENC_I17_SIGN_VAL_POS_X 63 + +#define X3_OPCODE_INST_WORD_X 3 +#define X3_OPCODE_SIZE_X 4 +#define X3_OPCODE_INST_WORD_POS_X 28 +#define X3_OPCODE_SIGN_VAL_POS_X 0 + +#define X3_I_INST_WORD_X 3 +#define X3_I_SIZE_X 1 +#define X3_I_INST_WORD_POS_X 27 +#define X3_I_SIGN_VAL_POS_X 59 + +#define X3_D_WH_INST_WORD_X 3 +#define X3_D_WH_SIZE_X 3 +#define X3_D_WH_INST_WORD_POS_X 24 +#define X3_D_WH_SIGN_VAL_POS_X 0 + +#define X3_IMM20_INST_WORD_X 3 +#define X3_IMM20_SIZE_X 20 +#define X3_IMM20_INST_WORD_POS_X 4 +#define X3_IMM20_SIGN_VAL_POS_X 0 + +#define X3_IMM39_1_INST_WORD_X 2 +#define X3_IMM39_1_SIZE_X 23 +#define X3_IMM39_1_INST_WORD_POS_X 0 +#define X3_IMM39_1_SIGN_VAL_POS_X 36 + +#define X3_IMM39_2_INST_WORD_X 1 +#define X3_IMM39_2_SIZE_X 16 +#define X3_IMM39_2_INST_WORD_POS_X 16 +#define X3_IMM39_2_SIGN_VAL_POS_X 20 + +#define X3_P_INST_WORD_X 3 +#define X3_P_SIZE_X 4 +#define X3_P_INST_WORD_POS_X 0 +#define X3_P_SIGN_VAL_POS_X 0 + +#define X3_TMPLT_INST_WORD_X 0 +#define X3_TMPLT_SIZE_X 4 +#define X3_TMPLT_INST_WORD_POS_X 0 +#define X3_TMPLT_SIGN_VAL_POS_X 0 + +#define X3_BTYPE_QP_INST_WORD_X 2 +#define X3_BTYPE_QP_SIZE_X 9 +#define X3_BTYPE_QP_INST_WORD_POS_X 23 +#define X3_BTYPE_QP_INST_VAL_POS_X 0 + +#define X3_EMPTY_INST_WORD_X 1 +#define X3_EMPTY_SIZE_X 2 +#define X3_EMPTY_INST_WORD_POS_X 14 +#define X3_EMPTY_INST_VAL_POS_X 0 + + typedef struct _IMAGE_LINENUMBER { + union { + DWORD SymbolTableIndex; + DWORD VirtualAddress; + } Type; + WORD Linenumber; + } IMAGE_LINENUMBER; + typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER; + +#define IMAGE_SIZEOF_LINENUMBER 6 + +#include "poppack.h" + + typedef struct _IMAGE_BASE_RELOCATION { + DWORD VirtualAddress; + DWORD SizeOfBlock; + + } IMAGE_BASE_RELOCATION; + typedef IMAGE_BASE_RELOCATION UNALIGNED *PIMAGE_BASE_RELOCATION; + +#define IMAGE_SIZEOF_BASE_RELOCATION 8 + +#define IMAGE_REL_BASED_ABSOLUTE 0 +#define IMAGE_REL_BASED_HIGH 1 +#define IMAGE_REL_BASED_LOW 2 +#define IMAGE_REL_BASED_HIGHLOW 3 +#define IMAGE_REL_BASED_HIGHADJ 4 +#define IMAGE_REL_BASED_MIPS_JMPADDR 5 +#define IMAGE_REL_BASED_MIPS_JMPADDR16 9 +#define IMAGE_REL_BASED_IA64_IMM64 9 +#define IMAGE_REL_BASED_DIR64 10 + +#define IMAGE_ARCHIVE_START_SIZE 8 +#define IMAGE_ARCHIVE_START "!\n" +#define IMAGE_ARCHIVE_END "`\n" +#define IMAGE_ARCHIVE_PAD "\n" +#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " +#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " + + typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { + BYTE Name[16]; + BYTE Date[12]; + BYTE UserID[6]; + BYTE GroupID[6]; + BYTE Mode[8]; + BYTE Size[10]; + BYTE EndHeader[2]; + } IMAGE_ARCHIVE_MEMBER_HEADER,*PIMAGE_ARCHIVE_MEMBER_HEADER; + +#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 + + typedef struct _IMAGE_EXPORT_DIRECTORY { + DWORD Characteristics; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + DWORD Name; + DWORD Base; + DWORD NumberOfFunctions; + DWORD NumberOfNames; + DWORD AddressOfFunctions; + DWORD AddressOfNames; + DWORD AddressOfNameOrdinals; + } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY; + + typedef struct _IMAGE_IMPORT_BY_NAME { + WORD Hint; + BYTE Name[1]; + } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME; + +#include "pshpack8.h" + + typedef struct _IMAGE_THUNK_DATA64 { + union { + ULONGLONG ForwarderString; + ULONGLONG Function; + ULONGLONG Ordinal; + ULONGLONG AddressOfData; + } u1; + } IMAGE_THUNK_DATA64; + typedef IMAGE_THUNK_DATA64 *PIMAGE_THUNK_DATA64; + +#include "poppack.h" + + typedef struct _IMAGE_THUNK_DATA32 { + union { + DWORD ForwarderString; + DWORD Function; + DWORD Ordinal; + DWORD AddressOfData; + } u1; + } IMAGE_THUNK_DATA32; + typedef IMAGE_THUNK_DATA32 *PIMAGE_THUNK_DATA32; + +#define IMAGE_ORDINAL_FLAG64 0x8000000000000000ull +#define IMAGE_ORDINAL_FLAG32 0x80000000 +#define IMAGE_ORDINAL64(Ordinal) (Ordinal & 0xffffull) +#define IMAGE_ORDINAL32(Ordinal) (Ordinal & 0xffff) +#define IMAGE_SNAP_BY_ORDINAL64(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG64)!=0) +#define IMAGE_SNAP_BY_ORDINAL32(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG32)!=0) + + typedef VOID + (NTAPI *PIMAGE_TLS_CALLBACK)(PVOID DllHandle,DWORD Reason,PVOID Reserved); + + typedef struct _IMAGE_TLS_DIRECTORY64 { + ULONGLONG StartAddressOfRawData; + ULONGLONG EndAddressOfRawData; + ULONGLONG AddressOfIndex; + ULONGLONG AddressOfCallBacks; + DWORD SizeOfZeroFill; + DWORD Characteristics; + } IMAGE_TLS_DIRECTORY64; + typedef IMAGE_TLS_DIRECTORY64 *PIMAGE_TLS_DIRECTORY64; + + typedef struct _IMAGE_TLS_DIRECTORY32 { + DWORD StartAddressOfRawData; + DWORD EndAddressOfRawData; + DWORD AddressOfIndex; + DWORD AddressOfCallBacks; + DWORD SizeOfZeroFill; + DWORD Characteristics; + } IMAGE_TLS_DIRECTORY32; + typedef IMAGE_TLS_DIRECTORY32 *PIMAGE_TLS_DIRECTORY32; + +#ifdef _WIN64 +#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64 +#define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal) + typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA; + typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA; +#define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal) + typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY; + typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY; +#else +#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32 +#define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal) + typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA; + typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA; +#define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal) + typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY; + typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY; +#endif + + typedef struct _IMAGE_IMPORT_DESCRIPTOR { + union { + DWORD Characteristics; + DWORD OriginalFirstThunk; + }; + DWORD TimeDateStamp; + + DWORD ForwarderChain; + DWORD Name; + DWORD FirstThunk; + } IMAGE_IMPORT_DESCRIPTOR; + typedef IMAGE_IMPORT_DESCRIPTOR UNALIGNED *PIMAGE_IMPORT_DESCRIPTOR; + + typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR { + DWORD TimeDateStamp; + WORD OffsetModuleName; + WORD NumberOfModuleForwarderRefs; + } IMAGE_BOUND_IMPORT_DESCRIPTOR,*PIMAGE_BOUND_IMPORT_DESCRIPTOR; + + typedef struct _IMAGE_BOUND_FORWARDER_REF { + DWORD TimeDateStamp; + WORD OffsetModuleName; + WORD Reserved; + } IMAGE_BOUND_FORWARDER_REF,*PIMAGE_BOUND_FORWARDER_REF; + + typedef struct _IMAGE_RESOURCE_DIRECTORY { + DWORD Characteristics; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + WORD NumberOfNamedEntries; + WORD NumberOfIdEntries; + } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY; + +#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000 +#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000 + + typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { + union { + struct { + DWORD NameOffset:31; + DWORD NameIsString:1; + }; + DWORD Name; + WORD Id; + }; + union { + DWORD OffsetToData; + struct { + DWORD OffsetToDirectory:31; + DWORD DataIsDirectory:1; + }; + }; + } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY; + + typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING { + WORD Length; + CHAR NameString[1]; + } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING; + + typedef struct _IMAGE_RESOURCE_DIR_STRING_U { + WORD Length; + WCHAR NameString[1]; + } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U; + + typedef struct _IMAGE_RESOURCE_DATA_ENTRY { + DWORD OffsetToData; + DWORD Size; + DWORD CodePage; + DWORD Reserved; + } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY; + + typedef struct { + DWORD Size; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + DWORD GlobalFlagsClear; + DWORD GlobalFlagsSet; + DWORD CriticalSectionDefaultTimeout; + DWORD DeCommitFreeBlockThreshold; + DWORD DeCommitTotalFreeThreshold; + DWORD LockPrefixTable; + DWORD MaximumAllocationSize; + DWORD VirtualMemoryThreshold; + DWORD ProcessHeapFlags; + DWORD ProcessAffinityMask; + WORD CSDVersion; + WORD Reserved1; + DWORD EditList; + DWORD SecurityCookie; + DWORD SEHandlerTable; + DWORD SEHandlerCount; + } IMAGE_LOAD_CONFIG_DIRECTORY32,*PIMAGE_LOAD_CONFIG_DIRECTORY32; + + typedef struct { + DWORD Size; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + DWORD GlobalFlagsClear; + DWORD GlobalFlagsSet; + DWORD CriticalSectionDefaultTimeout; + ULONGLONG DeCommitFreeBlockThreshold; + ULONGLONG DeCommitTotalFreeThreshold; + ULONGLONG LockPrefixTable; + ULONGLONG MaximumAllocationSize; + ULONGLONG VirtualMemoryThreshold; + ULONGLONG ProcessAffinityMask; + DWORD ProcessHeapFlags; + WORD CSDVersion; + WORD Reserved1; + ULONGLONG EditList; + ULONGLONG SecurityCookie; + ULONGLONG SEHandlerTable; + ULONGLONG SEHandlerCount; + } IMAGE_LOAD_CONFIG_DIRECTORY64,*PIMAGE_LOAD_CONFIG_DIRECTORY64; + +#ifdef _WIN64 + typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY; + typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY; +#else + typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY; + typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY; +#endif + + typedef struct _IMAGE_CE_RUNTIME_FUNCTION_ENTRY { + DWORD FuncStart; + DWORD PrologLen : 8; + DWORD FuncLen : 22; + DWORD ThirtyTwoBit : 1; + DWORD ExceptionFlag : 1; + } IMAGE_CE_RUNTIME_FUNCTION_ENTRY,*PIMAGE_CE_RUNTIME_FUNCTION_ENTRY; + + typedef struct _IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY { + ULONGLONG BeginAddress; + ULONGLONG EndAddress; + ULONGLONG ExceptionHandler; + ULONGLONG HandlerData; + ULONGLONG PrologEndAddress; + } IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY,*PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY; + + typedef struct _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY { + DWORD BeginAddress; + DWORD EndAddress; + DWORD ExceptionHandler; + DWORD HandlerData; + DWORD PrologEndAddress; + } IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY,*PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY; + + typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY { + DWORD BeginAddress; + DWORD EndAddress; + DWORD UnwindInfoAddress; + } _IMAGE_RUNTIME_FUNCTION_ENTRY,*_PIMAGE_RUNTIME_FUNCTION_ENTRY; + + typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_IA64_RUNTIME_FUNCTION_ENTRY; + typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY; + + typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_RUNTIME_FUNCTION_ENTRY; + typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_RUNTIME_FUNCTION_ENTRY; + + typedef struct _IMAGE_DEBUG_DIRECTORY { + DWORD Characteristics; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + DWORD Type; + DWORD SizeOfData; + DWORD AddressOfRawData; + DWORD PointerToRawData; + } IMAGE_DEBUG_DIRECTORY,*PIMAGE_DEBUG_DIRECTORY; + +#define IMAGE_DEBUG_TYPE_UNKNOWN 0 +#define IMAGE_DEBUG_TYPE_COFF 1 +#define IMAGE_DEBUG_TYPE_CODEVIEW 2 +#define IMAGE_DEBUG_TYPE_FPO 3 +#define IMAGE_DEBUG_TYPE_MISC 4 +#define IMAGE_DEBUG_TYPE_EXCEPTION 5 +#define IMAGE_DEBUG_TYPE_FIXUP 6 +#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7 +#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8 +#define IMAGE_DEBUG_TYPE_BORLAND 9 +#define IMAGE_DEBUG_TYPE_RESERVED10 10 +#define IMAGE_DEBUG_TYPE_CLSID 11 + + typedef struct _IMAGE_COFF_SYMBOLS_HEADER { + DWORD NumberOfSymbols; + DWORD LvaToFirstSymbol; + DWORD NumberOfLinenumbers; + DWORD LvaToFirstLinenumber; + DWORD RvaToFirstByteOfCode; + DWORD RvaToLastByteOfCode; + DWORD RvaToFirstByteOfData; + DWORD RvaToLastByteOfData; + } IMAGE_COFF_SYMBOLS_HEADER,*PIMAGE_COFF_SYMBOLS_HEADER; + +#define FRAME_FPO 0 +#define FRAME_TRAP 1 +#define FRAME_TSS 2 +#define FRAME_NONFPO 3 + + typedef struct _FPO_DATA { + DWORD ulOffStart; + DWORD cbProcSize; + DWORD cdwLocals; + WORD cdwParams; + WORD cbProlog : 8; + WORD cbRegs : 3; + WORD fHasSEH : 1; + WORD fUseBP : 1; + WORD reserved : 1; + WORD cbFrame : 2; + } FPO_DATA,*PFPO_DATA; +#define SIZEOF_RFPO_DATA 16 + +#define IMAGE_DEBUG_MISC_EXENAME 1 + + typedef struct _IMAGE_DEBUG_MISC { + DWORD DataType; + DWORD Length; + BOOLEAN Unicode; + BYTE Reserved[3]; + BYTE Data[1]; + } IMAGE_DEBUG_MISC,*PIMAGE_DEBUG_MISC; + + typedef struct _IMAGE_FUNCTION_ENTRY { + DWORD StartingAddress; + DWORD EndingAddress; + DWORD EndOfPrologue; + } IMAGE_FUNCTION_ENTRY,*PIMAGE_FUNCTION_ENTRY; + + typedef struct _IMAGE_FUNCTION_ENTRY64 { + ULONGLONG StartingAddress; + ULONGLONG EndingAddress; + union { + ULONGLONG EndOfPrologue; + ULONGLONG UnwindInfoAddress; + }; + } IMAGE_FUNCTION_ENTRY64,*PIMAGE_FUNCTION_ENTRY64; + + typedef struct _IMAGE_SEPARATE_DEBUG_HEADER { + WORD Signature; + WORD Flags; + WORD Machine; + WORD Characteristics; + DWORD TimeDateStamp; + DWORD CheckSum; + DWORD ImageBase; + DWORD SizeOfImage; + DWORD NumberOfSections; + DWORD ExportedNamesSize; + DWORD DebugDirectorySize; + DWORD SectionAlignment; + DWORD Reserved[2]; + } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER; + + typedef struct _NON_PAGED_DEBUG_INFO { + WORD Signature; + WORD Flags; + DWORD Size; + WORD Machine; + WORD Characteristics; + DWORD TimeDateStamp; + DWORD CheckSum; + DWORD SizeOfImage; + ULONGLONG ImageBase; + + } NON_PAGED_DEBUG_INFO,*PNON_PAGED_DEBUG_INFO; + +#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944 +#define NON_PAGED_DEBUG_SIGNATURE 0x494E + +#define IMAGE_SEPARATE_DEBUG_FLAGS_MASK 0x8000 +#define IMAGE_SEPARATE_DEBUG_MISMATCH 0x8000 + + typedef struct _ImageArchitectureHeader { + unsigned int AmaskValue: 1; + int Adummy1 :7; + unsigned int AmaskShift: 8; + int Adummy2 :16; + DWORD FirstEntryRVA; + } IMAGE_ARCHITECTURE_HEADER,*PIMAGE_ARCHITECTURE_HEADER; + + typedef struct _ImageArchitectureEntry { + DWORD FixupInstRVA; + DWORD NewInst; + } IMAGE_ARCHITECTURE_ENTRY,*PIMAGE_ARCHITECTURE_ENTRY; + +#include "poppack.h" + +#define IMPORT_OBJECT_HDR_SIG2 0xffff + + typedef struct IMPORT_OBJECT_HEADER { + WORD Sig1; + WORD Sig2; + WORD Version; + WORD Machine; + DWORD TimeDateStamp; + DWORD SizeOfData; + union { + WORD Ordinal; + WORD Hint; + }; + WORD Type : 2; + WORD NameType : 3; + WORD Reserved : 11; + } IMPORT_OBJECT_HEADER; + + typedef enum IMPORT_OBJECT_TYPE { + IMPORT_OBJECT_CODE = 0,IMPORT_OBJECT_DATA = 1,IMPORT_OBJECT_CONST = 2 + } IMPORT_OBJECT_TYPE; + + typedef enum IMPORT_OBJECT_NAME_TYPE { + IMPORT_OBJECT_ORDINAL = 0,IMPORT_OBJECT_NAME = 1,IMPORT_OBJECT_NAME_NO_PREFIX = 2,IMPORT_OBJECT_NAME_UNDECORATE = 3 + } IMPORT_OBJECT_NAME_TYPE; + +#ifndef __IMAGE_COR20_HEADER_DEFINED__ +#define __IMAGE_COR20_HEADER_DEFINED__ + typedef enum ReplacesCorHdrNumericDefines { + COMIMAGE_FLAGS_ILONLY =0x00000001,COMIMAGE_FLAGS_32BITREQUIRED =0x00000002,COMIMAGE_FLAGS_IL_LIBRARY =0x00000004, + COMIMAGE_FLAGS_STRONGNAMESIGNED =0x00000008,COMIMAGE_FLAGS_TRACKDEBUGDATA =0x00010000,COR_VERSION_MAJOR_V2 =2, + COR_VERSION_MAJOR =COR_VERSION_MAJOR_V2,COR_VERSION_MINOR =0,COR_DELETED_NAME_LENGTH =8,COR_VTABLEGAP_NAME_LENGTH =8, + NATIVE_TYPE_MAX_CB =1,COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE=0xFF,IMAGE_COR_MIH_METHODRVA =0x01,IMAGE_COR_MIH_EHRVA =0x02, + IMAGE_COR_MIH_BASICBLOCK =0x08,COR_VTABLE_32BIT =0x01,COR_VTABLE_64BIT =0x02,COR_VTABLE_FROM_UNMANAGED =0x04, + COR_VTABLE_CALL_MOST_DERIVED =0x10,IMAGE_COR_EATJ_THUNK_SIZE =32,MAX_CLASS_NAME =1024,MAX_PACKAGE_NAME =1024 + } ReplacesCorHdrNumericDefines; + + typedef struct IMAGE_COR20_HEADER { + DWORD cb; + WORD MajorRuntimeVersion; + WORD MinorRuntimeVersion; + IMAGE_DATA_DIRECTORY MetaData; + DWORD Flags; + DWORD EntryPointToken; + IMAGE_DATA_DIRECTORY Resources; + IMAGE_DATA_DIRECTORY StrongNameSignature; + IMAGE_DATA_DIRECTORY CodeManagerTable; + IMAGE_DATA_DIRECTORY VTableFixups; + IMAGE_DATA_DIRECTORY ExportAddressTableJumps; + IMAGE_DATA_DIRECTORY ManagedNativeHeader; + } IMAGE_COR20_HEADER,*PIMAGE_COR20_HEADER; +#endif + +#if defined (__x86_64) + NTSYSAPI PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry (DWORD64 ControlPc, PDWORD64 ImageBase, PUNWIND_HISTORY_TABLE HistoryTable); + NTSYSAPI VOID NTAPI RtlUnwindEx (PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable); +#endif + +#include + +#ifndef _SLIST_HEADER_ +#define _SLIST_HEADER_ + +#ifdef _WIN64 + typedef struct _SLIST_ENTRY *PSLIST_ENTRY; + typedef DECLSPEC_ALIGN(16) struct _SLIST_ENTRY { + PSLIST_ENTRY Next; + } SLIST_ENTRY; +#else + +#define SLIST_ENTRY SINGLE_LIST_ENTRY +#define _SLIST_ENTRY _SINGLE_LIST_ENTRY +#define PSLIST_ENTRY PSINGLE_LIST_ENTRY +#endif + +#if defined(_WIN64) + + typedef DECLSPEC_ALIGN(16) struct _SLIST_HEADER { + ULONGLONG Alignment; + ULONGLONG Region; + } SLIST_HEADER; + + typedef struct _SLIST_HEADER *PSLIST_HEADER; +#else + + typedef union _SLIST_HEADER { + ULONGLONG Alignment; + struct { + SLIST_ENTRY Next; + WORD Depth; + WORD Sequence; + }; + } SLIST_HEADER,*PSLIST_HEADER; +#endif +#endif + + NTSYSAPI VOID NTAPI RtlInitializeSListHead(PSLIST_HEADER ListHead); + NTSYSAPI PSLIST_ENTRY NTAPI RtlFirstEntrySList(const SLIST_HEADER *ListHead); + NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedPopEntrySList(PSLIST_HEADER ListHead); + NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedPushEntrySList(PSLIST_HEADER ListHead,PSLIST_ENTRY ListEntry); + NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedFlushSList(PSLIST_HEADER ListHead); + NTSYSAPI WORD NTAPI RtlQueryDepthSList(PSLIST_HEADER ListHead); + +#define HEAP_NO_SERIALIZE 0x00000001 +#define HEAP_GROWABLE 0x00000002 +#define HEAP_GENERATE_EXCEPTIONS 0x00000004 +#define HEAP_ZERO_MEMORY 0x00000008 +#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010 +#define HEAP_TAIL_CHECKING_ENABLED 0x00000020 +#define HEAP_FREE_CHECKING_ENABLED 0x00000040 +#define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080 +#define HEAP_CREATE_ALIGN_16 0x00010000 +#define HEAP_CREATE_ENABLE_TRACING 0x00020000 +#define HEAP_CREATE_ENABLE_EXECUTE 0x00040000 +#define HEAP_MAXIMUM_TAG 0x0FFF +#define HEAP_PSEUDO_TAG_FLAG 0x8000 +#define HEAP_TAG_SHIFT 18 +#define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b) + ((o) << 18))) + + NTSYSAPI VOID NTAPI RtlCaptureContext(PCONTEXT ContextRecord); + +#define IS_TEXT_UNICODE_ASCII16 0x0001 +#define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010 + +#define IS_TEXT_UNICODE_STATISTICS 0x0002 +#define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020 + +#define IS_TEXT_UNICODE_CONTROLS 0x0004 +#define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040 + +#define IS_TEXT_UNICODE_SIGNATURE 0x0008 +#define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080 + +#define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100 +#define IS_TEXT_UNICODE_ODD_LENGTH 0x0200 +#define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400 +#define IS_TEXT_UNICODE_NULL_BYTES 0x1000 + +#define IS_TEXT_UNICODE_UNICODE_MASK 0x000F +#define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0 +#define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00 +#define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000 + +#define COMPRESSION_FORMAT_NONE (0x0000) +#define COMPRESSION_FORMAT_DEFAULT (0x0001) +#define COMPRESSION_FORMAT_LZNT1 (0x0002) +#define COMPRESSION_ENGINE_STANDARD (0x0000) +#define COMPRESSION_ENGINE_MAXIMUM (0x0100) +#define COMPRESSION_ENGINE_HIBER (0x0200) + +#if _DBG_MEMCPY_INLINE_ && !defined(_MEMCPY_INLINE_) && !defined(_CRTBLD) +#define _MEMCPY_INLINE_ + __CRT_INLINE PVOID __cdecl memcpy_inline(void *dst,const void *src,size_t size) { + if(((char *)dst > (char *)src) && ((char *)dst < ((char *)src + size))) { + __debugbreak(); + } + return memcpy(dst,src,size); + } +#define memcpy memcpy_inline +#endif + + NTSYSAPI SIZE_T NTAPI RtlCompareMemory(const VOID *Source1,const VOID *Source2,SIZE_T Length); + +#define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length))) +#define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length)) +#define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length)) +#define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length)) +#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length)) + + __CRT_INLINE PVOID RtlSecureZeroMemory(PVOID ptr,SIZE_T cnt) { + volatile char *vptr =(volatile char *)ptr; +#ifdef __x86_64 + __stosb((PBYTE)((DWORD64)vptr),0,cnt); +#else + while(cnt) { + *vptr = 0; + vptr++; + cnt--; + } +#endif + return ptr; + } + + typedef struct _MESSAGE_RESOURCE_ENTRY { + WORD Length; + WORD Flags; + BYTE Text[1]; + } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY; + +#define MESSAGE_RESOURCE_UNICODE 0x0001 + + typedef struct _MESSAGE_RESOURCE_BLOCK { + DWORD LowId; + DWORD HighId; + DWORD OffsetToEntries; + } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK; + + typedef struct _MESSAGE_RESOURCE_DATA { + DWORD NumberOfBlocks; + MESSAGE_RESOURCE_BLOCK Blocks[1]; + } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA; + + typedef struct _OSVERSIONINFOA { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + CHAR szCSDVersion[128]; + } OSVERSIONINFOA,*POSVERSIONINFOA,*LPOSVERSIONINFOA; + + typedef struct _OSVERSIONINFOW { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + WCHAR szCSDVersion[128]; + } OSVERSIONINFOW,*POSVERSIONINFOW,*LPOSVERSIONINFOW,RTL_OSVERSIONINFOW,*PRTL_OSVERSIONINFOW; + +#ifdef UNICODE + typedef OSVERSIONINFOW OSVERSIONINFO; + typedef POSVERSIONINFOW POSVERSIONINFO; + typedef LPOSVERSIONINFOW LPOSVERSIONINFO; +#else + typedef OSVERSIONINFOA OSVERSIONINFO; + typedef POSVERSIONINFOA POSVERSIONINFO; + typedef LPOSVERSIONINFOA LPOSVERSIONINFO; +#endif + + typedef struct _OSVERSIONINFOEXA { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + CHAR szCSDVersion[128]; + WORD wServicePackMajor; + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; + BYTE wReserved; + } OSVERSIONINFOEXA,*POSVERSIONINFOEXA,*LPOSVERSIONINFOEXA; + + typedef struct _OSVERSIONINFOEXW { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + WCHAR szCSDVersion[128]; + WORD wServicePackMajor; + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; + BYTE wReserved; + } OSVERSIONINFOEXW,*POSVERSIONINFOEXW,*LPOSVERSIONINFOEXW,RTL_OSVERSIONINFOEXW,*PRTL_OSVERSIONINFOEXW; +#ifdef UNICODE + typedef OSVERSIONINFOEXW OSVERSIONINFOEX; + typedef POSVERSIONINFOEXW POSVERSIONINFOEX; + typedef LPOSVERSIONINFOEXW LPOSVERSIONINFOEX; +#else + typedef OSVERSIONINFOEXA OSVERSIONINFOEX; + typedef POSVERSIONINFOEXA POSVERSIONINFOEX; + typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX; +#endif + +#define VER_EQUAL 1 +#define VER_GREATER 2 +#define VER_GREATER_EQUAL 3 +#define VER_LESS 4 +#define VER_LESS_EQUAL 5 +#define VER_AND 6 +#define VER_OR 7 + +#define VER_CONDITION_MASK 7 +#define VER_NUM_BITS_PER_CONDITION_MASK 3 + +#define VER_MINORVERSION 0x0000001 +#define VER_MAJORVERSION 0x0000002 +#define VER_BUILDNUMBER 0x0000004 +#define VER_PLATFORMID 0x0000008 +#define VER_SERVICEPACKMINOR 0x0000010 +#define VER_SERVICEPACKMAJOR 0x0000020 +#define VER_SUITENAME 0x0000040 +#define VER_PRODUCT_TYPE 0x0000080 + +#define VER_NT_WORKSTATION 0x0000001 +#define VER_NT_DOMAIN_CONTROLLER 0x0000002 +#define VER_NT_SERVER 0x0000003 + +#define VER_PLATFORM_WIN32s 0 +#define VER_PLATFORM_WIN32_WINDOWS 1 +#define VER_PLATFORM_WIN32_NT 2 + +#define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_))) + + NTSYSAPI ULONGLONG NTAPI VerSetConditionMask(ULONGLONG ConditionMask,DWORD TypeMask,BYTE Condition); + + typedef struct _RTL_CRITICAL_SECTION_DEBUG { + WORD Type; + WORD CreatorBackTraceIndex; + struct _RTL_CRITICAL_SECTION *CriticalSection; + LIST_ENTRY ProcessLocksList; + DWORD EntryCount; + DWORD ContentionCount; + DWORD Spare[2]; + } RTL_CRITICAL_SECTION_DEBUG,*PRTL_CRITICAL_SECTION_DEBUG,RTL_RESOURCE_DEBUG,*PRTL_RESOURCE_DEBUG; + +#define RTL_CRITSECT_TYPE 0 +#define RTL_RESOURCE_TYPE 1 + + typedef struct _RTL_CRITICAL_SECTION { + PRTL_CRITICAL_SECTION_DEBUG DebugInfo; + LONG LockCount; + LONG RecursionCount; + HANDLE OwningThread; + HANDLE LockSemaphore; + ULONG_PTR SpinCount; + } RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION; + + typedef VOID (NTAPI *RTL_VERIFIER_DLL_LOAD_CALLBACK) (PWSTR DllName,PVOID DllBase,SIZE_T DllSize,PVOID Reserved); + typedef VOID (NTAPI *RTL_VERIFIER_DLL_UNLOAD_CALLBACK) (PWSTR DllName,PVOID DllBase,SIZE_T DllSize,PVOID Reserved); + typedef VOID (NTAPI *RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK)(PVOID AllocationBase,SIZE_T AllocationSize); + + typedef struct _RTL_VERIFIER_THUNK_DESCRIPTOR { + PCHAR ThunkName; + PVOID ThunkOldAddress; + PVOID ThunkNewAddress; + } RTL_VERIFIER_THUNK_DESCRIPTOR,*PRTL_VERIFIER_THUNK_DESCRIPTOR; + + typedef struct _RTL_VERIFIER_DLL_DESCRIPTOR { + PWCHAR DllName; + DWORD DllFlags; + PVOID DllAddress; + PRTL_VERIFIER_THUNK_DESCRIPTOR DllThunks; + } RTL_VERIFIER_DLL_DESCRIPTOR,*PRTL_VERIFIER_DLL_DESCRIPTOR; + + typedef struct _RTL_VERIFIER_PROVIDER_DESCRIPTOR { + DWORD Length; + PRTL_VERIFIER_DLL_DESCRIPTOR ProviderDlls; + RTL_VERIFIER_DLL_LOAD_CALLBACK ProviderDllLoadCallback; + RTL_VERIFIER_DLL_UNLOAD_CALLBACK ProviderDllUnloadCallback; + PWSTR VerifierImage; + DWORD VerifierFlags; + DWORD VerifierDebug; + PVOID RtlpGetStackTraceAddress; + PVOID RtlpDebugPageHeapCreate; + PVOID RtlpDebugPageHeapDestroy; + RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK ProviderNtdllHeapFreeCallback; + } RTL_VERIFIER_PROVIDER_DESCRIPTOR,*PRTL_VERIFIER_PROVIDER_DESCRIPTOR; + +#define RTL_VRF_FLG_FULL_PAGE_HEAP 0x00000001 +#define RTL_VRF_FLG_RESERVED_DONOTUSE 0x00000002 +#define RTL_VRF_FLG_HANDLE_CHECKS 0x00000004 +#define RTL_VRF_FLG_STACK_CHECKS 0x00000008 +#define RTL_VRF_FLG_APPCOMPAT_CHECKS 0x00000010 +#define RTL_VRF_FLG_TLS_CHECKS 0x00000020 +#define RTL_VRF_FLG_DIRTY_STACKS 0x00000040 +#define RTL_VRF_FLG_RPC_CHECKS 0x00000080 +#define RTL_VRF_FLG_COM_CHECKS 0x00000100 +#define RTL_VRF_FLG_DANGEROUS_APIS 0x00000200 +#define RTL_VRF_FLG_RACE_CHECKS 0x00000400 +#define RTL_VRF_FLG_DEADLOCK_CHECKS 0x00000800 +#define RTL_VRF_FLG_FIRST_CHANCE_EXCEPTION_CHECKS 0x00001000 +#define RTL_VRF_FLG_VIRTUAL_MEM_CHECKS 0x00002000 +#define RTL_VRF_FLG_ENABLE_LOGGING 0x00004000 +#define RTL_VRF_FLG_FAST_FILL_HEAP 0x00008000 +#define RTL_VRF_FLG_VIRTUAL_SPACE_TRACKING 0x00010000 +#define RTL_VRF_FLG_ENABLED_SYSTEM_WIDE 0x00020000 +#define RTL_VRF_FLG_MISCELLANEOUS_CHECKS 0x00020000 +#define RTL_VRF_FLG_LOCK_CHECKS 0x00040000 + +#define APPLICATION_VERIFIER_INTERNAL_ERROR 0x80000000 +#define APPLICATION_VERIFIER_INTERNAL_WARNING 0x40000000 +#define APPLICATION_VERIFIER_NO_BREAK 0x20000000 +#define APPLICATION_VERIFIER_CONTINUABLE_BREAK 0x10000000 + +#define APPLICATION_VERIFIER_UNKNOWN_ERROR 0x0001 +#define APPLICATION_VERIFIER_ACCESS_VIOLATION 0x0002 +#define APPLICATION_VERIFIER_UNSYNCHRONIZED_ACCESS 0x0003 +#define APPLICATION_VERIFIER_EXTREME_SIZE_REQUEST 0x0004 +#define APPLICATION_VERIFIER_BAD_HEAP_HANDLE 0x0005 +#define APPLICATION_VERIFIER_SWITCHED_HEAP_HANDLE 0x0006 +#define APPLICATION_VERIFIER_DOUBLE_FREE 0x0007 +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK 0x0008 +#define APPLICATION_VERIFIER_DESTROY_PROCESS_HEAP 0x0009 +#define APPLICATION_VERIFIER_UNEXPECTED_EXCEPTION 0x000A +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_EXCEPTION_RAISED_FOR_HEADER 0x000B +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_EXCEPTION_RAISED_FOR_PROBING 0x000C +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_HEADER 0x000D +#define APPLICATION_VERIFIER_CORRUPTED_FREED_HEAP_BLOCK 0x000E +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_SUFFIX 0x000F +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_START_STAMP 0x0010 +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_END_STAMP 0x0011 +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_PREFIX 0x0012 +#define APPLICATION_VERIFIER_FIRST_CHANCE_ACCESS_VIOLATION 0x0013 +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_LIST 0x0014 + +#define APPLICATION_VERIFIER_TERMINATE_THREAD_CALL 0x0100 +#define APPLICATION_VERIFIER_STACK_OVERFLOW 0x0101 +#define APPLICATION_VERIFIER_INVALID_EXIT_PROCESS_CALL 0x0102 + +#define APPLICATION_VERIFIER_EXIT_THREAD_OWNS_LOCK 0x0200 +#define APPLICATION_VERIFIER_LOCK_IN_UNLOADED_DLL 0x0201 +#define APPLICATION_VERIFIER_LOCK_IN_FREED_HEAP 0x0202 +#define APPLICATION_VERIFIER_LOCK_DOUBLE_INITIALIZE 0x0203 +#define APPLICATION_VERIFIER_LOCK_IN_FREED_MEMORY 0x0204 +#define APPLICATION_VERIFIER_LOCK_CORRUPTED 0x0205 +#define APPLICATION_VERIFIER_LOCK_INVALID_OWNER 0x0206 +#define APPLICATION_VERIFIER_LOCK_INVALID_RECURSION_COUNT 0x0207 +#define APPLICATION_VERIFIER_LOCK_INVALID_LOCK_COUNT 0x0208 +#define APPLICATION_VERIFIER_LOCK_OVER_RELEASED 0x0209 +#define APPLICATION_VERIFIER_LOCK_NOT_INITIALIZED 0x0210 +#define APPLICATION_VERIFIER_LOCK_ALREADY_INITIALIZED 0x0211 +#define APPLICATION_VERIFIER_LOCK_IN_FREED_VMEM 0x0212 +#define APPLICATION_VERIFIER_LOCK_IN_UNMAPPED_MEM 0x0213 +#define APPLICATION_VERIFIER_THREAD_NOT_LOCK_OWNER 0x0214 + +#define APPLICATION_VERIFIER_INVALID_HANDLE 0x0300 +#define APPLICATION_VERIFIER_INVALID_TLS_VALUE 0x0301 +#define APPLICATION_VERIFIER_INCORRECT_WAIT_CALL 0x0302 +#define APPLICATION_VERIFIER_NULL_HANDLE 0x0303 +#define APPLICATION_VERIFIER_WAIT_IN_DLLMAIN 0x0304 + +#define APPLICATION_VERIFIER_COM_ERROR 0x0400 +#define APPLICATION_VERIFIER_COM_API_IN_DLLMAIN 0x0401 +#define APPLICATION_VERIFIER_COM_UNHANDLED_EXCEPTION 0x0402 +#define APPLICATION_VERIFIER_COM_UNBALANCED_COINIT 0x0403 +#define APPLICATION_VERIFIER_COM_UNBALANCED_OLEINIT 0x0404 +#define APPLICATION_VERIFIER_COM_UNBALANCED_SWC 0x0405 +#define APPLICATION_VERIFIER_COM_NULL_DACL 0x0406 +#define APPLICATION_VERIFIER_COM_UNSAFE_IMPERSONATION 0x0407 +#define APPLICATION_VERIFIER_COM_SMUGGLED_WRAPPER 0x0408 +#define APPLICATION_VERIFIER_COM_SMUGGLED_PROXY 0x0409 +#define APPLICATION_VERIFIER_COM_CF_SUCCESS_WITH_NULL 0x040A +#define APPLICATION_VERIFIER_COM_GCO_SUCCESS_WITH_NULL 0x040B +#define APPLICATION_VERIFIER_COM_OBJECT_IN_FREED_MEMORY 0x040C +#define APPLICATION_VERIFIER_COM_OBJECT_IN_UNLOADED_DLL 0x040D +#define APPLICATION_VERIFIER_COM_VTBL_IN_FREED_MEMORY 0x040E +#define APPLICATION_VERIFIER_COM_VTBL_IN_UNLOADED_DLL 0x040F +#define APPLICATION_VERIFIER_COM_HOLDING_LOCKS_ON_CALL 0x0410 + +#define APPLICATION_VERIFIER_RPC_ERROR 0x0500 + +#define APPLICATION_VERIFIER_INVALID_FREEMEM 0x0600 +#define APPLICATION_VERIFIER_INVALID_ALLOCMEM 0x0601 +#define APPLICATION_VERIFIER_INVALID_MAPVIEW 0x0602 +#define APPLICATION_VERIFIER_PROBE_INVALID_ADDRESS 0x0603 +#define APPLICATION_VERIFIER_PROBE_FREE_MEM 0x0604 +#define APPLICATION_VERIFIER_PROBE_GUARD_PAGE 0x0605 +#define APPLICATION_VERIFIER_PROBE_NULL 0x0606 +#define APPLICATION_VERIFIER_PROBE_INVALID_START_OR_SIZE 0x0607 +#define APPLICATION_VERIFIER_SIZE_HEAP_UNEXPECTED_EXCEPTION 0x0618 + +#define VERIFIER_STOP(Code,Msg,P1,S1,P2,S2,P3,S3,P4,S4) { RtlApplicationVerifierStop ((Code),(Msg),(ULONG_PTR)(P1),(S1),(ULONG_PTR)(P2),(S2),(ULONG_PTR)(P3),(S3),(ULONG_PTR)(P4),(S4)); } + + VOID NTAPI RtlApplicationVerifierStop(ULONG_PTR Code,PSTR Message,ULONG_PTR Param1,PSTR Description1,ULONG_PTR Param2,PSTR Description2,ULONG_PTR Param3,PSTR Description3,ULONG_PTR Param4,PSTR Description4); + + typedef LONG (NTAPI *PVECTORED_EXCEPTION_HANDLER)(struct _EXCEPTION_POINTERS *ExceptionInfo); +#define SEF_DACL_AUTO_INHERIT 0x01 +#define SEF_SACL_AUTO_INHERIT 0x02 +#define SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT 0x04 +#define SEF_AVOID_PRIVILEGE_CHECK 0x08 +#define SEF_AVOID_OWNER_CHECK 0x10 +#define SEF_DEFAULT_OWNER_FROM_PARENT 0x20 +#define SEF_DEFAULT_GROUP_FROM_PARENT 0x40 + + typedef enum _HEAP_INFORMATION_CLASS { + HeapCompatibilityInformation + } HEAP_INFORMATION_CLASS; + + NTSYSAPI DWORD NTAPI RtlSetHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength); + NTSYSAPI DWORD NTAPI RtlQueryHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength); + DWORD NTAPI RtlMultipleAllocateHeap(PVOID HeapHandle,DWORD Flags,SIZE_T Size,DWORD Count,PVOID *Array); + DWORD NTAPI RtlMultipleFreeHeap(PVOID HeapHandle,DWORD Flags,DWORD Count,PVOID *Array); + +#define WT_EXECUTEDEFAULT 0x00000000 +#define WT_EXECUTEINIOTHREAD 0x00000001 +#define WT_EXECUTEINUITHREAD 0x00000002 +#define WT_EXECUTEINWAITTHREAD 0x00000004 +#define WT_EXECUTEONLYONCE 0x00000008 +#define WT_EXECUTEINTIMERTHREAD 0x00000020 +#define WT_EXECUTELONGFUNCTION 0x00000010 +#define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040 +#define WT_EXECUTEINPERSISTENTTHREAD 0x00000080 +#define WT_TRANSFER_IMPERSONATION 0x00000100 +#define WT_SET_MAX_THREADPOOL_THREADS(Flags,Limit) ((Flags) |= (Limit)<<16) + typedef VOID (NTAPI *WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN); + typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID); + typedef VOID (NTAPI *APC_CALLBACK_FUNCTION)(DWORD ,PVOID,PVOID); + typedef + VOID + (NTAPI *PFLS_CALLBACK_FUNCTION)(PVOID lpFlsData); +#define WT_EXECUTEINLONGTHREAD 0x00000010 +#define WT_EXECUTEDELETEWAIT 0x00000008 + + typedef enum _ACTIVATION_CONTEXT_INFO_CLASS { + ActivationContextBasicInformation = 1,ActivationContextDetailedInformation = 2,AssemblyDetailedInformationInActivationContext = 3,FileInformationInAssemblyOfAssemblyInActivationContext = 4,MaxActivationContextInfoClass,AssemblyDetailedInformationInActivationContxt = 3,FileInformationInAssemblyOfAssemblyInActivationContxt = 4 + } ACTIVATION_CONTEXT_INFO_CLASS; + +#define ACTIVATIONCONTEXTINFOCLASS ACTIVATION_CONTEXT_INFO_CLASS + + typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX { + DWORD ulAssemblyIndex; + DWORD ulFileIndexInAssembly; + } ACTIVATION_CONTEXT_QUERY_INDEX,*PACTIVATION_CONTEXT_QUERY_INDEX; + + typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX; + +#define ACTIVATION_CONTEXT_PATH_TYPE_NONE (1) +#define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE (2) +#define ACTIVATION_CONTEXT_PATH_TYPE_URL (3) +#define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF (4) + + typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION { + DWORD ulFlags; + DWORD ulFilenameLength; + DWORD ulPathLength; + + PCWSTR lpFileName; + PCWSTR lpFilePath; + } ASSEMBLY_FILE_DETAILED_INFORMATION,*PASSEMBLY_FILE_DETAILED_INFORMATION; + typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION; + +#define _ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION _ASSEMBLY_FILE_DETAILED_INFORMATION +#define ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION ASSEMBLY_FILE_DETAILED_INFORMATION +#define PASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION PASSEMBLY_FILE_DETAILED_INFORMATION +#define PCASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION PCASSEMBLY_FILE_DETAILED_INFORMATION + + typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION { + DWORD ulFlags; + DWORD ulEncodedAssemblyIdentityLength; + DWORD ulManifestPathType; + DWORD ulManifestPathLength; + LARGE_INTEGER liManifestLastWriteTime; + DWORD ulPolicyPathType; + DWORD ulPolicyPathLength; + LARGE_INTEGER liPolicyLastWriteTime; + DWORD ulMetadataSatelliteRosterIndex; + DWORD ulManifestVersionMajor; + DWORD ulManifestVersionMinor; + DWORD ulPolicyVersionMajor; + DWORD ulPolicyVersionMinor; + DWORD ulAssemblyDirectoryNameLength; + PCWSTR lpAssemblyEncodedAssemblyIdentity; + PCWSTR lpAssemblyManifestPath; + PCWSTR lpAssemblyPolicyPath; + PCWSTR lpAssemblyDirectoryName; + DWORD ulFileCount; + } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; + + typedef const struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; + + typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION { + DWORD dwFlags; + DWORD ulFormatVersion; + DWORD ulAssemblyCount; + DWORD ulRootManifestPathType; + DWORD ulRootManifestPathChars; + DWORD ulRootConfigurationPathType; + DWORD ulRootConfigurationPathChars; + DWORD ulAppDirPathType; + DWORD ulAppDirPathChars; + PCWSTR lpRootManifestPath; + PCWSTR lpRootConfigurationPath; + PCWSTR lpAppDirPath; + } ACTIVATION_CONTEXT_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_DETAILED_INFORMATION; + + typedef const struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION; + +#define DLL_PROCESS_ATTACH 1 +#define DLL_THREAD_ATTACH 2 +#define DLL_THREAD_DETACH 3 +#define DLL_PROCESS_DETACH 0 +#define DLL_PROCESS_VERIFIER 4 + +#define EVENTLOG_SEQUENTIAL_READ 0x0001 +#define EVENTLOG_SEEK_READ 0x0002 +#define EVENTLOG_FORWARDS_READ 0x0004 +#define EVENTLOG_BACKWARDS_READ 0x0008 + +#define EVENTLOG_SUCCESS 0x0000 +#define EVENTLOG_ERROR_TYPE 0x0001 +#define EVENTLOG_WARNING_TYPE 0x0002 +#define EVENTLOG_INFORMATION_TYPE 0x0004 +#define EVENTLOG_AUDIT_SUCCESS 0x0008 +#define EVENTLOG_AUDIT_FAILURE 0x0010 + +#define EVENTLOG_START_PAIRED_EVENT 0x0001 +#define EVENTLOG_END_PAIRED_EVENT 0x0002 +#define EVENTLOG_END_ALL_PAIRED_EVENTS 0x0004 +#define EVENTLOG_PAIRED_EVENT_ACTIVE 0x0008 +#define EVENTLOG_PAIRED_EVENT_INACTIVE 0x0010 + + typedef struct _EVENTLOGRECORD { + DWORD Length; + DWORD Reserved; + DWORD RecordNumber; + DWORD TimeGenerated; + DWORD TimeWritten; + DWORD EventID; + WORD EventType; + WORD NumStrings; + WORD EventCategory; + WORD ReservedFlags; + DWORD ClosingRecordNumber; + DWORD StringOffset; + DWORD UserSidLength; + DWORD UserSidOffset; + DWORD DataLength; + DWORD DataOffset; + } EVENTLOGRECORD,*PEVENTLOGRECORD; + +#define MAXLOGICALLOGNAMESIZE 256 + + typedef struct _EVENTSFORLOGFILE{ + DWORD ulSize; + WCHAR szLogicalLogFile[MAXLOGICALLOGNAMESIZE]; + DWORD ulNumRecords; + EVENTLOGRECORD pEventLogRecords[]; + } EVENTSFORLOGFILE,*PEVENTSFORLOGFILE; + + typedef struct _PACKEDEVENTINFO{ + DWORD ulSize; + DWORD ulNumEventsForLogFile; + DWORD ulOffsets[]; + } PACKEDEVENTINFO,*PPACKEDEVENTINFO; + +#define KEY_QUERY_VALUE (0x0001) +#define KEY_SET_VALUE (0x0002) +#define KEY_CREATE_SUB_KEY (0x0004) +#define KEY_ENUMERATE_SUB_KEYS (0x0008) +#define KEY_NOTIFY (0x0010) +#define KEY_CREATE_LINK (0x0020) +#define KEY_WOW64_32KEY (0x0200) +#define KEY_WOW64_64KEY (0x0100) +#define KEY_WOW64_RES (0x0300) + +#define KEY_READ ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~SYNCHRONIZE)) +#define KEY_WRITE ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE)) +#define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE)) +#define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL | KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY | KEY_CREATE_LINK) & (~SYNCHRONIZE)) +#define REG_OPTION_RESERVED (0x00000000L) + +#define REG_OPTION_NON_VOLATILE (0x00000000L) +#define REG_OPTION_VOLATILE (0x00000001L) +#define REG_OPTION_CREATE_LINK (0x00000002L) +#define REG_OPTION_BACKUP_RESTORE (0x00000004L) +#define REG_OPTION_OPEN_LINK (0x00000008L) +#define REG_LEGAL_OPTION (REG_OPTION_RESERVED | REG_OPTION_NON_VOLATILE | REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK | REG_OPTION_BACKUP_RESTORE | REG_OPTION_OPEN_LINK) +#define REG_CREATED_NEW_KEY (0x00000001L) +#define REG_OPENED_EXISTING_KEY (0x00000002L) +#define REG_STANDARD_FORMAT 1 +#define REG_LATEST_FORMAT 2 +#define REG_NO_COMPRESSION 4 +#define REG_WHOLE_HIVE_VOLATILE (0x00000001L) +#define REG_REFRESH_HIVE (0x00000002L) +#define REG_NO_LAZY_FLUSH (0x00000004L) +#define REG_FORCE_RESTORE (0x00000008L) +#define REG_FORCE_UNLOAD 1 + +#define REG_NOTIFY_CHANGE_NAME (0x00000001L) +#define REG_NOTIFY_CHANGE_ATTRIBUTES (0x00000002L) +#define REG_NOTIFY_CHANGE_LAST_SET (0x00000004L) +#define REG_NOTIFY_CHANGE_SECURITY (0x00000008L) + +#define REG_LEGAL_CHANGE_FILTER (REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_SECURITY) + +#define REG_NONE (0) +#define REG_SZ (1) +#define REG_EXPAND_SZ (2) + +#define REG_BINARY (3) +#define REG_DWORD (4) +#define REG_DWORD_LITTLE_ENDIAN (4) +#define REG_DWORD_BIG_ENDIAN (5) +#define REG_LINK (6) +#define REG_MULTI_SZ (7) +#define REG_RESOURCE_LIST (8) +#define REG_FULL_RESOURCE_DESCRIPTOR (9) +#define REG_RESOURCE_REQUIREMENTS_LIST (10) +#define REG_QWORD (11) +#define REG_QWORD_LITTLE_ENDIAN (11) + +#define SERVICE_KERNEL_DRIVER 0x00000001 +#define SERVICE_FILE_SYSTEM_DRIVER 0x00000002 +#define SERVICE_ADAPTER 0x00000004 +#define SERVICE_RECOGNIZER_DRIVER 0x00000008 + +#define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | SERVICE_RECOGNIZER_DRIVER) + +#define SERVICE_WIN32_OWN_PROCESS 0x00000010 +#define SERVICE_WIN32_SHARE_PROCESS 0x00000020 +#define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS) + +#define SERVICE_INTERACTIVE_PROCESS 0x00000100 + +#define SERVICE_TYPE_ALL (SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS) + +#define SERVICE_BOOT_START 0x00000000 +#define SERVICE_SYSTEM_START 0x00000001 +#define SERVICE_AUTO_START 0x00000002 +#define SERVICE_DEMAND_START 0x00000003 +#define SERVICE_DISABLED 0x00000004 + +#define SERVICE_ERROR_IGNORE 0x00000000 +#define SERVICE_ERROR_NORMAL 0x00000001 +#define SERVICE_ERROR_SEVERE 0x00000002 +#define SERVICE_ERROR_CRITICAL 0x00000003 + + typedef enum _CM_SERVICE_NODE_TYPE { + DriverType = SERVICE_KERNEL_DRIVER,FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS, + Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,AdapterType = SERVICE_ADAPTER,RecognizerType = SERVICE_RECOGNIZER_DRIVER + } SERVICE_NODE_TYPE; + + typedef enum _CM_SERVICE_LOAD_TYPE { + BootLoad = SERVICE_BOOT_START,SystemLoad = SERVICE_SYSTEM_START,AutoLoad = SERVICE_AUTO_START,DemandLoad = SERVICE_DEMAND_START, + DisableLoad = SERVICE_DISABLED + } SERVICE_LOAD_TYPE; + + typedef enum _CM_ERROR_CONTROL_TYPE { + IgnoreError = SERVICE_ERROR_IGNORE,NormalError = SERVICE_ERROR_NORMAL,SevereError = SERVICE_ERROR_SEVERE,CriticalError = SERVICE_ERROR_CRITICAL + } SERVICE_ERROR_TYPE; + +#define TAPE_ERASE_SHORT 0L +#define TAPE_ERASE_LONG 1L + + typedef struct _TAPE_ERASE { + DWORD Type; + BOOLEAN Immediate; + } TAPE_ERASE,*PTAPE_ERASE; + +#define TAPE_LOAD 0L +#define TAPE_UNLOAD 1L +#define TAPE_TENSION 2L +#define TAPE_LOCK 3L +#define TAPE_UNLOCK 4L +#define TAPE_FORMAT 5L + + typedef struct _TAPE_PREPARE { + DWORD Operation; + BOOLEAN Immediate; + } TAPE_PREPARE,*PTAPE_PREPARE; + +#define TAPE_SETMARKS 0L +#define TAPE_FILEMARKS 1L +#define TAPE_SHORT_FILEMARKS 2L +#define TAPE_LONG_FILEMARKS 3L + + typedef struct _TAPE_WRITE_MARKS { + DWORD Type; + DWORD Count; + BOOLEAN Immediate; + } TAPE_WRITE_MARKS,*PTAPE_WRITE_MARKS; + +#define TAPE_ABSOLUTE_POSITION 0L +#define TAPE_LOGICAL_POSITION 1L +#define TAPE_PSEUDO_LOGICAL_POSITION 2L + + typedef struct _TAPE_GET_POSITION { + DWORD Type; + DWORD Partition; + LARGE_INTEGER Offset; + } TAPE_GET_POSITION,*PTAPE_GET_POSITION; + +#define TAPE_REWIND 0L +#define TAPE_ABSOLUTE_BLOCK 1L +#define TAPE_LOGICAL_BLOCK 2L +#define TAPE_PSEUDO_LOGICAL_BLOCK 3L +#define TAPE_SPACE_END_OF_DATA 4L +#define TAPE_SPACE_RELATIVE_BLOCKS 5L +#define TAPE_SPACE_FILEMARKS 6L +#define TAPE_SPACE_SEQUENTIAL_FMKS 7L +#define TAPE_SPACE_SETMARKS 8L +#define TAPE_SPACE_SEQUENTIAL_SMKS 9L + + typedef struct _TAPE_SET_POSITION { + DWORD Method; + DWORD Partition; + LARGE_INTEGER Offset; + BOOLEAN Immediate; + } TAPE_SET_POSITION,*PTAPE_SET_POSITION; + +#define TAPE_DRIVE_FIXED 0x00000001 +#define TAPE_DRIVE_SELECT 0x00000002 +#define TAPE_DRIVE_INITIATOR 0x00000004 + +#define TAPE_DRIVE_ERASE_SHORT 0x00000010 +#define TAPE_DRIVE_ERASE_LONG 0x00000020 +#define TAPE_DRIVE_ERASE_BOP_ONLY 0x00000040 +#define TAPE_DRIVE_ERASE_IMMEDIATE 0x00000080 + +#define TAPE_DRIVE_TAPE_CAPACITY 0x00000100 +#define TAPE_DRIVE_TAPE_REMAINING 0x00000200 +#define TAPE_DRIVE_FIXED_BLOCK 0x00000400 +#define TAPE_DRIVE_VARIABLE_BLOCK 0x00000800 + +#define TAPE_DRIVE_WRITE_PROTECT 0x00001000 +#define TAPE_DRIVE_EOT_WZ_SIZE 0x00002000 + +#define TAPE_DRIVE_ECC 0x00010000 +#define TAPE_DRIVE_COMPRESSION 0x00020000 +#define TAPE_DRIVE_PADDING 0x00040000 +#define TAPE_DRIVE_REPORT_SMKS 0x00080000 + +#define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000 +#define TAPE_DRIVE_GET_LOGICAL_BLK 0x00200000 +#define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x00400000 + +#define TAPE_DRIVE_EJECT_MEDIA 0x01000000 +#define TAPE_DRIVE_CLEAN_REQUESTS 0x02000000 +#define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x04000000 + +#define TAPE_DRIVE_RESERVED_BIT 0x80000000 + +#define TAPE_DRIVE_LOAD_UNLOAD 0x80000001 +#define TAPE_DRIVE_TENSION 0x80000002 +#define TAPE_DRIVE_LOCK_UNLOCK 0x80000004 +#define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008 + +#define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010 +#define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020 +#define TAPE_DRIVE_TENSION_IMMED 0x80000040 +#define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080 + +#define TAPE_DRIVE_SET_ECC 0x80000100 +#define TAPE_DRIVE_SET_COMPRESSION 0x80000200 +#define TAPE_DRIVE_SET_PADDING 0x80000400 +#define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800 + +#define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000 +#define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000 +#define TAPE_DRIVE_LOGICAL_BLK 0x80004000 +#define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000 + +#define TAPE_DRIVE_END_OF_DATA 0x80010000 +#define TAPE_DRIVE_RELATIVE_BLKS 0x80020000 +#define TAPE_DRIVE_FILEMARKS 0x80040000 +#define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000 + +#define TAPE_DRIVE_SETMARKS 0x80100000 +#define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000 +#define TAPE_DRIVE_REVERSE_POSITION 0x80400000 +#define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000 + +#define TAPE_DRIVE_WRITE_SETMARKS 0x81000000 +#define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000 +#define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000 +#define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000 + +#define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000 +#define TAPE_DRIVE_FORMAT 0xA0000000 +#define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000 +#define TAPE_DRIVE_HIGH_FEATURES 0x80000000 + + typedef struct _TAPE_GET_DRIVE_PARAMETERS { + BOOLEAN ECC; + BOOLEAN Compression; + BOOLEAN DataPadding; + BOOLEAN ReportSetmarks; + DWORD DefaultBlockSize; + DWORD MaximumBlockSize; + DWORD MinimumBlockSize; + DWORD MaximumPartitionCount; + DWORD FeaturesLow; + DWORD FeaturesHigh; + DWORD EOTWarningZoneSize; + } TAPE_GET_DRIVE_PARAMETERS,*PTAPE_GET_DRIVE_PARAMETERS; + + typedef struct _TAPE_SET_DRIVE_PARAMETERS { + BOOLEAN ECC; + BOOLEAN Compression; + BOOLEAN DataPadding; + BOOLEAN ReportSetmarks; + DWORD EOTWarningZoneSize; + } TAPE_SET_DRIVE_PARAMETERS,*PTAPE_SET_DRIVE_PARAMETERS; + + typedef struct _TAPE_GET_MEDIA_PARAMETERS { + LARGE_INTEGER Capacity; + LARGE_INTEGER Remaining; + DWORD BlockSize; + DWORD PartitionCount; + BOOLEAN WriteProtected; + } TAPE_GET_MEDIA_PARAMETERS,*PTAPE_GET_MEDIA_PARAMETERS; + + typedef struct _TAPE_SET_MEDIA_PARAMETERS { + DWORD BlockSize; + } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS; + +#define TAPE_FIXED_PARTITIONS 0L +#define TAPE_SELECT_PARTITIONS 1L +#define TAPE_INITIATOR_PARTITIONS 2L + + typedef struct _TAPE_CREATE_PARTITION { + DWORD Method; + DWORD Count; + DWORD Size; + } TAPE_CREATE_PARTITION,*PTAPE_CREATE_PARTITION; + +#define TAPE_QUERY_DRIVE_PARAMETERS 0L +#define TAPE_QUERY_MEDIA_CAPACITY 1L +#define TAPE_CHECK_FOR_DRIVE_PROBLEM 2L +#define TAPE_QUERY_IO_ERROR_DATA 3L +#define TAPE_QUERY_DEVICE_ERROR_DATA 4L + + typedef struct _TAPE_WMI_OPERATIONS { + DWORD Method; + DWORD DataBufferSize; + PVOID DataBuffer; + } TAPE_WMI_OPERATIONS,*PTAPE_WMI_OPERATIONS; + + typedef enum _TAPE_DRIVE_PROBLEM_TYPE { + TapeDriveProblemNone,TapeDriveReadWriteWarning,TapeDriveReadWriteError,TapeDriveReadWarning,TapeDriveWriteWarning,TapeDriveReadError,TapeDriveWriteError,TapeDriveHardwareError,TapeDriveUnsupportedMedia,TapeDriveScsiConnectionError,TapeDriveTimetoClean,TapeDriveCleanDriveNow,TapeDriveMediaLifeExpired,TapeDriveSnappedTape + } TAPE_DRIVE_PROBLEM_TYPE; + +#if defined(__x86_64) + __CRT_INLINE struct _TEB *NtCurrentTeb(VOID) { return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB,Self)); } + __CRT_INLINE PVOID GetCurrentFiber(VOID) { return(PVOID)__readgsqword(FIELD_OFFSET(NT_TIB,FiberData)); } + __CRT_INLINE PVOID GetFiberData(VOID) { + return *(PVOID *)GetCurrentFiber(); + } +#endif + +#if(defined(_X86_) && !defined(__x86_64)) +#define PcTeb 0x18 + __CRT_INLINE struct _TEB *NtCurrentTeb(void) { + struct _TEB *ret; + __asm__ volatile ("movl %%fs:0x18,%0" + : "=r" (ret)); + return ret; + } +#endif + +#define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION (1) +#define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION (2) +#define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION (3) +#define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION (4) +#define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION (5) +#define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION (6) +#define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION (7) +#define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE (8) +#define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES (9) +#define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS (10) + +#ifdef __cplusplus + } +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winreg.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winreg.h new file mode 100644 index 00000000..f158d282 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winreg.h @@ -0,0 +1,272 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINREG_ +#define _WINREG_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#define RRF_RT_REG_NONE 0x00000001 +#define RRF_RT_REG_SZ 0x00000002 +#define RRF_RT_REG_EXPAND_SZ 0x00000004 +#define RRF_RT_REG_BINARY 0x00000008 +#define RRF_RT_REG_DWORD 0x00000010 +#define RRF_RT_REG_MULTI_SZ 0x00000020 +#define RRF_RT_REG_QWORD 0x00000040 + +#define RRF_RT_DWORD (RRF_RT_REG_BINARY | RRF_RT_REG_DWORD) +#define RRF_RT_QWORD (RRF_RT_REG_BINARY | RRF_RT_REG_QWORD) +#define RRF_RT_ANY 0x0000ffff + +#define RRF_NOEXPAND 0x10000000 +#define RRF_ZEROONFAILURE 0x20000000 + + typedef ACCESS_MASK REGSAM; + +#define HKEY_CLASSES_ROOT ((HKEY) (ULONG_PTR)((LONG)0x80000000)) +#define HKEY_CURRENT_USER ((HKEY) (ULONG_PTR)((LONG)0x80000001)) +#define HKEY_LOCAL_MACHINE ((HKEY) (ULONG_PTR)((LONG)0x80000002)) +#define HKEY_USERS ((HKEY) (ULONG_PTR)((LONG)0x80000003)) +#define HKEY_PERFORMANCE_DATA ((HKEY) (ULONG_PTR)((LONG)0x80000004)) +#define HKEY_PERFORMANCE_TEXT ((HKEY) (ULONG_PTR)((LONG)0x80000050)) +#define HKEY_PERFORMANCE_NLSTEXT ((HKEY) (ULONG_PTR)((LONG)0x80000060)) +#define HKEY_CURRENT_CONFIG ((HKEY) (ULONG_PTR)((LONG)0x80000005)) +#define HKEY_DYN_DATA ((HKEY) (ULONG_PTR)((LONG)0x80000006)) + +#define REG_SECURE_CONNECTION 1 + +#ifndef _PROVIDER_STRUCTS_DEFINED +#define _PROVIDER_STRUCTS_DEFINED + +#define PROVIDER_KEEPS_VALUE_LENGTH 0x1 + struct val_context { + int valuelen; + LPVOID value_context; + LPVOID val_buff_ptr; + }; + + typedef struct val_context *PVALCONTEXT; + + typedef struct pvalueA { + LPSTR pv_valuename; + int pv_valuelen; + LPVOID pv_value_context; + DWORD pv_type; + }PVALUEA,*PPVALUEA; + + typedef struct pvalueW { + LPWSTR pv_valuename; + int pv_valuelen; + LPVOID pv_value_context; + DWORD pv_type; + }PVALUEW,*PPVALUEW; + +#ifdef UNICODE + typedef PVALUEW PVALUE; + typedef PPVALUEW PPVALUE; +#else + typedef PVALUEA PVALUE; + typedef PPVALUEA PPVALUE; +#endif + + typedef DWORD __cdecl QUERYHANDLER(LPVOID keycontext,PVALCONTEXT val_list,DWORD num_vals,LPVOID outputbuffer,DWORD *total_outlen,DWORD input_blen); + + typedef QUERYHANDLER *PQUERYHANDLER; + + typedef struct provider_info { + PQUERYHANDLER pi_R0_1val; + PQUERYHANDLER pi_R0_allvals; + PQUERYHANDLER pi_R3_1val; + PQUERYHANDLER pi_R3_allvals; + DWORD pi_flags; + LPVOID pi_key_context; + } REG_PROVIDER; + + typedef struct provider_info *PPROVIDER; + + typedef struct value_entA { + LPSTR ve_valuename; + DWORD ve_valuelen; + DWORD_PTR ve_valueptr; + DWORD ve_type; + } VALENTA,*PVALENTA; + + typedef struct value_entW { + LPWSTR ve_valuename; + DWORD ve_valuelen; + DWORD_PTR ve_valueptr; + DWORD ve_type; + } VALENTW,*PVALENTW; + +#ifdef UNICODE + typedef VALENTW VALENT; + typedef PVALENTW PVALENT; +#else + typedef VALENTA VALENT; + typedef PVALENTA PVALENT; +#endif +#endif + +#define WIN31_CLASS NULL + +#ifdef UNICODE +#define RegConnectRegistry RegConnectRegistryW +#define RegConnectRegistryEx RegConnectRegistryExW +#define RegCreateKey RegCreateKeyW +#define RegCreateKeyEx RegCreateKeyExW +#define RegDeleteKey RegDeleteKeyW +#define RegDeleteKeyEx RegDeleteKeyExW +#define RegDeleteValue RegDeleteValueW +#define RegEnumKey RegEnumKeyW +#define RegEnumKeyEx RegEnumKeyExW +#define RegEnumValue RegEnumValueW +#define RegLoadKey RegLoadKeyW +#define RegOpenKey RegOpenKeyW +#define RegOpenKeyEx RegOpenKeyExW +#define RegQueryInfoKey RegQueryInfoKeyW +#define RegQueryValue RegQueryValueW +#define RegQueryMultipleValues RegQueryMultipleValuesW +#define RegQueryValueEx RegQueryValueExW +#define RegReplaceKey RegReplaceKeyW +#define RegRestoreKey RegRestoreKeyW +#define RegSaveKey RegSaveKeyW +#define RegSetValue RegSetValueW +#define RegSetValueEx RegSetValueExW +#define RegUnLoadKey RegUnLoadKeyW +#define RegGetValue RegGetValueW +#define InitiateSystemShutdown InitiateSystemShutdownW +#define AbortSystemShutdown AbortSystemShutdownW +#else +#define RegConnectRegistry RegConnectRegistryA +#define RegConnectRegistryEx RegConnectRegistryExA +#define RegCreateKey RegCreateKeyA +#define RegCreateKeyEx RegCreateKeyExA +#define RegDeleteKey RegDeleteKeyA +#define RegDeleteKeyEx RegDeleteKeyExA +#define RegDeleteValue RegDeleteValueA +#define RegEnumKey RegEnumKeyA +#define RegEnumKeyEx RegEnumKeyExA +#define RegEnumValue RegEnumValueA +#define RegLoadKey RegLoadKeyA +#define RegOpenKey RegOpenKeyA +#define RegOpenKeyEx RegOpenKeyExA +#define RegQueryInfoKey RegQueryInfoKeyA +#define RegQueryValue RegQueryValueA +#define RegQueryMultipleValues RegQueryMultipleValuesA +#define RegQueryValueEx RegQueryValueExA +#define RegReplaceKey RegReplaceKeyA +#define RegRestoreKey RegRestoreKeyA +#define RegSaveKey RegSaveKeyA +#define RegSetValue RegSetValueA +#define RegSetValueEx RegSetValueExA +#define RegUnLoadKey RegUnLoadKeyA +#define RegGetValue RegGetValueA +#define InitiateSystemShutdown InitiateSystemShutdownA +#define AbortSystemShutdown AbortSystemShutdownA +#endif + + WINADVAPI LONG WINAPI RegCloseKey(HKEY hKey); + WINADVAPI LONG WINAPI RegOverridePredefKey(HKEY hKey,HKEY hNewHKey); + WINADVAPI LONG WINAPI RegOpenUserClassesRoot(HANDLE hToken,DWORD dwOptions,REGSAM samDesired,PHKEY phkResult); + WINADVAPI LONG WINAPI RegOpenCurrentUser(REGSAM samDesired,PHKEY phkResult); + WINADVAPI LONG WINAPI RegDisablePredefinedCache(); + WINADVAPI LONG WINAPI RegConnectRegistryA(LPCSTR lpMachineName,HKEY hKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegConnectRegistryW(LPCWSTR lpMachineName,HKEY hKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegConnectRegistryExA(LPCSTR lpMachineName,HKEY hKey,ULONG Flags,PHKEY phkResult); + WINADVAPI LONG WINAPI RegConnectRegistryExW(LPCWSTR lpMachineName,HKEY hKey,ULONG Flags,PHKEY phkResult); + WINADVAPI LONG WINAPI RegCreateKeyA(HKEY hKey,LPCSTR lpSubKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegCreateKeyW(HKEY hKey,LPCWSTR lpSubKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegCreateKeyExA(HKEY hKey,LPCSTR lpSubKey,DWORD Reserved,LPSTR lpClass,DWORD dwOptions,REGSAM samDesired,LPSECURITY_ATTRIBUTES lpSecurityAttributes,PHKEY phkResult,LPDWORD lpdwDisposition); + WINADVAPI LONG WINAPI RegCreateKeyExW(HKEY hKey,LPCWSTR lpSubKey,DWORD Reserved,LPWSTR lpClass,DWORD dwOptions,REGSAM samDesired,LPSECURITY_ATTRIBUTES lpSecurityAttributes,PHKEY phkResult,LPDWORD lpdwDisposition); + WINADVAPI LONG WINAPI RegDeleteKeyA(HKEY hKey,LPCSTR lpSubKey); + WINADVAPI LONG WINAPI RegDeleteKeyW(HKEY hKey,LPCWSTR lpSubKey); + WINADVAPI LONG WINAPI RegDeleteKeyExA(HKEY hKey,LPCSTR lpSubKey,REGSAM samDesired,DWORD Reserved); + WINADVAPI LONG WINAPI RegDeleteKeyExW(HKEY hKey,LPCWSTR lpSubKey,REGSAM samDesired,DWORD Reserved); + WINADVAPI LONG WINAPI RegDisableReflectionKey(HKEY hBase); + WINADVAPI LONG WINAPI RegEnableReflectionKey(HKEY hBase); + WINADVAPI LONG WINAPI RegQueryReflectionKey(HKEY hBase,WINBOOL *bIsReflectionDisabled); + WINADVAPI LONG WINAPI RegDeleteValueA(HKEY hKey,LPCSTR lpValueName); + WINADVAPI LONG WINAPI RegDeleteValueW(HKEY hKey,LPCWSTR lpValueName); + WINADVAPI LONG WINAPI RegEnumKeyA(HKEY hKey,DWORD dwIndex,LPSTR lpName,DWORD cchName); + WINADVAPI LONG WINAPI RegEnumKeyW(HKEY hKey,DWORD dwIndex,LPWSTR lpName,DWORD cchName); + WINADVAPI LONG WINAPI RegEnumKeyExA(HKEY hKey,DWORD dwIndex,LPSTR lpName,LPDWORD lpcchName,LPDWORD lpReserved,LPSTR lpClass,LPDWORD lpcchClass,PFILETIME lpftLastWriteTime); + WINADVAPI LONG WINAPI RegEnumKeyExW(HKEY hKey,DWORD dwIndex,LPWSTR lpName,LPDWORD lpcchName,LPDWORD lpReserved,LPWSTR lpClass,LPDWORD lpcchClass,PFILETIME lpftLastWriteTime); + WINADVAPI LONG WINAPI RegEnumValueA(HKEY hKey,DWORD dwIndex,LPSTR lpValueName,LPDWORD lpcchValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); + WINADVAPI LONG WINAPI RegEnumValueW(HKEY hKey,DWORD dwIndex,LPWSTR lpValueName,LPDWORD lpcchValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); + WINADVAPI LONG WINAPI RegFlushKey(HKEY hKey); + WINADVAPI LONG WINAPI RegGetKeySecurity(HKEY hKey,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,LPDWORD lpcbSecurityDescriptor); + WINADVAPI LONG WINAPI RegLoadKeyA(HKEY hKey,LPCSTR lpSubKey,LPCSTR lpFile); + WINADVAPI LONG WINAPI RegLoadKeyW(HKEY hKey,LPCWSTR lpSubKey,LPCWSTR lpFile); + WINADVAPI LONG WINAPI RegNotifyChangeKeyValue(HKEY hKey,WINBOOL bWatchSubtree,DWORD dwNotifyFilter,HANDLE hEvent,WINBOOL fAsynchronous); + WINADVAPI LONG WINAPI RegOpenKeyA(HKEY hKey,LPCSTR lpSubKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegOpenKeyW(HKEY hKey,LPCWSTR lpSubKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegOpenKeyExA(HKEY hKey,LPCSTR lpSubKey,DWORD ulOptions,REGSAM samDesired,PHKEY phkResult); + WINADVAPI LONG WINAPI RegOpenKeyExW(HKEY hKey,LPCWSTR lpSubKey,DWORD ulOptions,REGSAM samDesired,PHKEY phkResult); + WINADVAPI LONG WINAPI RegQueryInfoKeyA(HKEY hKey,LPSTR lpClass,LPDWORD lpcchClass,LPDWORD lpReserved,LPDWORD lpcSubKeys,LPDWORD lpcbMaxSubKeyLen,LPDWORD lpcbMaxClassLen,LPDWORD lpcValues,LPDWORD lpcbMaxValueNameLen,LPDWORD lpcbMaxValueLen,LPDWORD lpcbSecurityDescriptor,PFILETIME lpftLastWriteTime); + WINADVAPI LONG WINAPI RegQueryInfoKeyW(HKEY hKey,LPWSTR lpClass,LPDWORD lpcchClass,LPDWORD lpReserved,LPDWORD lpcSubKeys,LPDWORD lpcbMaxSubKeyLen,LPDWORD lpcbMaxClassLen,LPDWORD lpcValues,LPDWORD lpcbMaxValueNameLen,LPDWORD lpcbMaxValueLen,LPDWORD lpcbSecurityDescriptor,PFILETIME lpftLastWriteTime); + WINADVAPI LONG WINAPI RegQueryValueA(HKEY hKey,LPCSTR lpSubKey,LPSTR lpData,PLONG lpcbData); + WINADVAPI LONG WINAPI RegQueryValueW(HKEY hKey,LPCWSTR lpSubKey,LPWSTR lpData,PLONG lpcbData); + WINADVAPI LONG WINAPI RegQueryMultipleValuesA(HKEY hKey,PVALENTA val_list,DWORD num_vals,LPSTR lpValueBuf,LPDWORD ldwTotsize); + WINADVAPI LONG WINAPI RegQueryMultipleValuesW(HKEY hKey,PVALENTW val_list,DWORD num_vals,LPWSTR lpValueBuf,LPDWORD ldwTotsize); + WINADVAPI LONG WINAPI RegQueryValueExA(HKEY hKey,LPCSTR lpValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); + WINADVAPI LONG WINAPI RegQueryValueExW(HKEY hKey,LPCWSTR lpValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); + WINADVAPI LONG WINAPI RegReplaceKeyA(HKEY hKey,LPCSTR lpSubKey,LPCSTR lpNewFile,LPCSTR lpOldFile); + WINADVAPI LONG WINAPI RegReplaceKeyW(HKEY hKey,LPCWSTR lpSubKey,LPCWSTR lpNewFile,LPCWSTR lpOldFile); + WINADVAPI LONG WINAPI RegRestoreKeyA(HKEY hKey,LPCSTR lpFile,DWORD dwFlags); + WINADVAPI LONG WINAPI RegRestoreKeyW(HKEY hKey,LPCWSTR lpFile,DWORD dwFlags); + WINADVAPI LONG WINAPI RegSaveKeyA(HKEY hKey,LPCSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINADVAPI LONG WINAPI RegSaveKeyW(HKEY hKey,LPCWSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINADVAPI LONG WINAPI RegSetKeySecurity(HKEY hKey,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI LONG WINAPI RegSetValueA(HKEY hKey,LPCSTR lpSubKey,DWORD dwType,LPCSTR lpData,DWORD cbData); + WINADVAPI LONG WINAPI RegSetValueW(HKEY hKey,LPCWSTR lpSubKey,DWORD dwType,LPCWSTR lpData,DWORD cbData); + WINADVAPI LONG WINAPI RegSetValueExA(HKEY hKey,LPCSTR lpValueName,DWORD Reserved,DWORD dwType,CONST BYTE *lpData,DWORD cbData); + WINADVAPI LONG WINAPI RegSetValueExW(HKEY hKey,LPCWSTR lpValueName,DWORD Reserved,DWORD dwType,CONST BYTE *lpData,DWORD cbData); + WINADVAPI LONG WINAPI RegUnLoadKeyA(HKEY hKey,LPCSTR lpSubKey); + WINADVAPI LONG WINAPI RegUnLoadKeyW(HKEY hKey,LPCWSTR lpSubKey); + WINADVAPI LONG WINAPI RegGetValueA(HKEY hkey,LPCSTR lpSubKey,LPCSTR lpValue,DWORD dwFlags,LPDWORD pdwType,PVOID pvData,LPDWORD pcbData); + WINADVAPI LONG WINAPI RegGetValueW(HKEY hkey,LPCWSTR lpSubKey,LPCWSTR lpValue,DWORD dwFlags,LPDWORD pdwType,PVOID pvData,LPDWORD pcbData); + WINADVAPI WINBOOL WINAPI InitiateSystemShutdownA(LPSTR lpMachineName,LPSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown); + WINADVAPI WINBOOL WINAPI InitiateSystemShutdownW(LPWSTR lpMachineName,LPWSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown); + WINADVAPI WINBOOL WINAPI AbortSystemShutdownA(LPSTR lpMachineName); + WINADVAPI WINBOOL WINAPI AbortSystemShutdownW(LPWSTR lpMachineName); + +//gr #include + +#define REASON_SWINSTALL SHTDN_REASON_MAJOR_SOFTWARE|SHTDN_REASON_MINOR_INSTALLATION +#define REASON_HWINSTALL SHTDN_REASON_MAJOR_HARDWARE|SHTDN_REASON_MINOR_INSTALLATION +#define REASON_SERVICEHANG SHTDN_REASON_MAJOR_SOFTWARE|SHTDN_REASON_MINOR_HUNG +#define REASON_UNSTABLE SHTDN_REASON_MAJOR_SYSTEM|SHTDN_REASON_MINOR_UNSTABLE +#define REASON_SWHWRECONF SHTDN_REASON_MAJOR_SOFTWARE|SHTDN_REASON_MINOR_RECONFIG +#define REASON_OTHER SHTDN_REASON_MAJOR_OTHER|SHTDN_REASON_MINOR_OTHER +#define REASON_UNKNOWN SHTDN_REASON_UNKNOWN +#define REASON_LEGACY_API SHTDN_REASON_LEGACY_API +#define REASON_PLANNED_FLAG SHTDN_REASON_FLAG_PLANNED + +#define MAX_SHUTDOWN_TIMEOUT (10*365*24*60*60) + +#ifdef UNICODE +#define InitiateSystemShutdownEx InitiateSystemShutdownExW +#define RegSaveKeyEx RegSaveKeyExW +#else +#define InitiateSystemShutdownEx InitiateSystemShutdownExA +#define RegSaveKeyEx RegSaveKeyExA +#endif + + WINADVAPI WINBOOL WINAPI InitiateSystemShutdownExA(LPSTR lpMachineName,LPSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown,DWORD dwReason); + WINADVAPI WINBOOL WINAPI InitiateSystemShutdownExW(LPWSTR lpMachineName,LPWSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown,DWORD dwReason); + WINADVAPI LONG WINAPI RegSaveKeyExA(HKEY hKey,LPCSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD Flags); + WINADVAPI LONG WINAPI RegSaveKeyExW(HKEY hKey,LPCWSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD Flags); + WINADVAPI LONG WINAPI Wow64Win32ApiEntry (DWORD dwFuncNumber,DWORD dwFlag,DWORD dwRes); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winuser.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winuser.h new file mode 100644 index 00000000..4cd9ffb5 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winuser.h @@ -0,0 +1,5651 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINUSER_ +#define _WINUSER_ + +#define WINUSERAPI DECLSPEC_IMPORT + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#include + +#ifndef NOUSER + typedef HANDLE HDWP; + typedef VOID MENUTEMPLATEA; + typedef VOID MENUTEMPLATEW; + typedef PVOID LPMENUTEMPLATEA; + typedef PVOID LPMENUTEMPLATEW; + +#ifdef UNICODE + typedef MENUTEMPLATEW MENUTEMPLATE; + typedef LPMENUTEMPLATEW LPMENUTEMPLATE; +#else + typedef MENUTEMPLATEA MENUTEMPLATE; + typedef LPMENUTEMPLATEA LPMENUTEMPLATE; +#endif + + typedef LRESULT (CALLBACK *WNDPROC)(HWND,UINT,WPARAM,LPARAM); + typedef INT_PTR (CALLBACK *DLGPROC)(HWND,UINT,WPARAM,LPARAM); + typedef VOID (CALLBACK *TIMERPROC)(HWND,UINT,UINT_PTR,DWORD); + typedef WINBOOL (CALLBACK *GRAYSTRINGPROC)(HDC,LPARAM,int); + typedef WINBOOL (CALLBACK *WNDENUMPROC)(HWND,LPARAM); + typedef LRESULT (CALLBACK *HOOKPROC)(int code,WPARAM wParam,LPARAM lParam); + typedef VOID (CALLBACK *SENDASYNCPROC)(HWND,UINT,ULONG_PTR,LRESULT); + typedef WINBOOL (CALLBACK *PROPENUMPROCA)(HWND,LPCSTR,HANDLE); + typedef WINBOOL (CALLBACK *PROPENUMPROCW)(HWND,LPCWSTR,HANDLE); + typedef WINBOOL (CALLBACK *PROPENUMPROCEXA)(HWND,LPSTR,HANDLE,ULONG_PTR); + typedef WINBOOL (CALLBACK *PROPENUMPROCEXW)(HWND,LPWSTR,HANDLE,ULONG_PTR); + typedef int (CALLBACK *EDITWORDBREAKPROCA)(LPSTR lpch,int ichCurrent,int cch,int code); + typedef int (CALLBACK *EDITWORDBREAKPROCW)(LPWSTR lpch,int ichCurrent,int cch,int code); + typedef WINBOOL (CALLBACK *DRAWSTATEPROC)(HDC hdc,LPARAM lData,WPARAM wData,int cx,int cy); + +#ifdef UNICODE + typedef PROPENUMPROCW PROPENUMPROC; + typedef PROPENUMPROCEXW PROPENUMPROCEX; + typedef EDITWORDBREAKPROCW EDITWORDBREAKPROC; +#else + typedef PROPENUMPROCA PROPENUMPROC; + typedef PROPENUMPROCEXA PROPENUMPROCEX; + typedef EDITWORDBREAKPROCA EDITWORDBREAKPROC; +#endif + + typedef WINBOOL (CALLBACK *NAMEENUMPROCA)(LPSTR,LPARAM); + typedef WINBOOL (CALLBACK *NAMEENUMPROCW)(LPWSTR,LPARAM); + typedef NAMEENUMPROCA WINSTAENUMPROCA; + typedef NAMEENUMPROCA DESKTOPENUMPROCA; + typedef NAMEENUMPROCW WINSTAENUMPROCW; + typedef NAMEENUMPROCW DESKTOPENUMPROCW; + +#ifdef UNICODE + typedef WINSTAENUMPROCW WINSTAENUMPROC; + typedef DESKTOPENUMPROCW DESKTOPENUMPROC; +#else + typedef WINSTAENUMPROCA WINSTAENUMPROC; + typedef DESKTOPENUMPROCA DESKTOPENUMPROC; +#endif + +#define IS_INTRESOURCE(_r) ((((ULONG_PTR)(_r)) >> 16)==0) +#define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i)))) +#define MAKEINTRESOURCEW(i) ((LPWSTR)((ULONG_PTR)((WORD)(i)))) +#ifdef UNICODE +#define MAKEINTRESOURCE MAKEINTRESOURCEW +#else +#define MAKEINTRESOURCE MAKEINTRESOURCEA +#endif + +#ifndef NORESOURCE + +#define RT_CURSOR MAKEINTRESOURCE(1) +#define RT_BITMAP MAKEINTRESOURCE(2) +#define RT_ICON MAKEINTRESOURCE(3) +#define RT_MENU MAKEINTRESOURCE(4) +#define RT_DIALOG MAKEINTRESOURCE(5) +#define RT_STRING MAKEINTRESOURCE(6) +#define RT_FONTDIR MAKEINTRESOURCE(7) +#define RT_FONT MAKEINTRESOURCE(8) +#define RT_ACCELERATOR MAKEINTRESOURCE(9) +#define RT_RCDATA MAKEINTRESOURCE(10) +#define RT_MESSAGETABLE MAKEINTRESOURCE(11) + +#define DIFFERENCE 11 +#define RT_GROUP_CURSOR MAKEINTRESOURCE((ULONG_PTR)RT_CURSOR + DIFFERENCE) +#define RT_GROUP_ICON MAKEINTRESOURCE((ULONG_PTR)RT_ICON + DIFFERENCE) +#define RT_VERSION MAKEINTRESOURCE(16) +#define RT_DLGINCLUDE MAKEINTRESOURCE(17) +#define RT_PLUGPLAY MAKEINTRESOURCE(19) +#define RT_VXD MAKEINTRESOURCE(20) +#define RT_ANICURSOR MAKEINTRESOURCE(21) +#define RT_ANIICON MAKEINTRESOURCE(22) +#define RT_HTML MAKEINTRESOURCE(23) +#ifdef RC_INVOKED +#define RT_MANIFEST 24 +#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 +#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2 +#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3 +#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID 1 +#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID 16 +#else +#define RT_MANIFEST MAKEINTRESOURCE(24) +#define CREATEPROCESS_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(1) +#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(2) +#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(3) +#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(1) +#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(16) +#endif +#endif + +#ifdef UNICODE +#define wvsprintf wvsprintfW +#define wsprintf wsprintfW +#else +#define wvsprintf wvsprintfA +#define wsprintf wsprintfA +#endif + + WINUSERAPI int WINAPI wvsprintfA(LPSTR,LPCSTR,va_list arglist); + WINUSERAPI int WINAPI wvsprintfW(LPWSTR,LPCWSTR,va_list arglist); + WINUSERAPI int WINAPIV wsprintfA(LPSTR,LPCSTR,...); + WINUSERAPI int WINAPIV wsprintfW(LPWSTR,LPCWSTR,...); + +#define SETWALLPAPER_DEFAULT ((LPWSTR)-1) + +#ifndef NOSCROLL +#define SB_HORZ 0 +#define SB_VERT 1 +#define SB_CTL 2 +#define SB_BOTH 3 + +#define SB_LINEUP 0 +#define SB_LINELEFT 0 +#define SB_LINEDOWN 1 +#define SB_LINERIGHT 1 +#define SB_PAGEUP 2 +#define SB_PAGELEFT 2 +#define SB_PAGEDOWN 3 +#define SB_PAGERIGHT 3 +#define SB_THUMBPOSITION 4 +#define SB_THUMBTRACK 5 +#define SB_TOP 6 +#define SB_LEFT 6 +#define SB_BOTTOM 7 +#define SB_RIGHT 7 +#define SB_ENDSCROLL 8 +#endif + +#ifndef NOSHOWWINDOW +#define SW_HIDE 0 +#define SW_SHOWNORMAL 1 +#define SW_NORMAL 1 +#define SW_SHOWMINIMIZED 2 +#define SW_SHOWMAXIMIZED 3 +#define SW_MAXIMIZE 3 +#define SW_SHOWNOACTIVATE 4 +#define SW_SHOW 5 +#define SW_MINIMIZE 6 +#define SW_SHOWMINNOACTIVE 7 +#define SW_SHOWNA 8 +#define SW_RESTORE 9 +#define SW_SHOWDEFAULT 10 +#define SW_FORCEMINIMIZE 11 +#define SW_MAX 11 + +#define HIDE_WINDOW 0 +#define SHOW_OPENWINDOW 1 +#define SHOW_ICONWINDOW 2 +#define SHOW_FULLSCREEN 3 +#define SHOW_OPENNOACTIVATE 4 + +#define SW_PARENTCLOSING 1 +#define SW_OTHERZOOM 2 +#define SW_PARENTOPENING 3 +#define SW_OTHERUNZOOM 4 +#endif + +#define AW_HOR_POSITIVE 0x00000001 +#define AW_HOR_NEGATIVE 0x00000002 +#define AW_VER_POSITIVE 0x00000004 +#define AW_VER_NEGATIVE 0x00000008 +#define AW_CENTER 0x00000010 +#define AW_HIDE 0x00010000 +#define AW_ACTIVATE 0x00020000 +#define AW_SLIDE 0x00040000 +#define AW_BLEND 0x00080000 + +#define KF_EXTENDED 0x0100 +#define KF_DLGMODE 0x0800 +#define KF_MENUMODE 0x1000 +#define KF_ALTDOWN 0x2000 +#define KF_REPEAT 0x4000 +#define KF_UP 0x8000 + +#ifndef NOVIRTUALKEYCODES + +#define VK_LBUTTON 0x01 +#define VK_RBUTTON 0x02 +#define VK_CANCEL 0x03 +#define VK_MBUTTON 0x04 +#define VK_XBUTTON1 0x05 +#define VK_XBUTTON2 0x06 +#define VK_BACK 0x08 +#define VK_TAB 0x09 +#define VK_CLEAR 0x0C +#define VK_RETURN 0x0D +#define VK_SHIFT 0x10 +#define VK_CONTROL 0x11 +#define VK_MENU 0x12 +#define VK_PAUSE 0x13 +#define VK_CAPITAL 0x14 +#define VK_KANA 0x15 +#define VK_HANGEUL 0x15 +#define VK_HANGUL 0x15 +#define VK_JUNJA 0x17 +#define VK_FINAL 0x18 +#define VK_HANJA 0x19 +#define VK_KANJI 0x19 +#define VK_ESCAPE 0x1B +#define VK_CONVERT 0x1C +#define VK_NONCONVERT 0x1D +#define VK_ACCEPT 0x1E +#define VK_MODECHANGE 0x1F +#define VK_SPACE 0x20 +#define VK_PRIOR 0x21 +#define VK_NEXT 0x22 +#define VK_END 0x23 +#define VK_HOME 0x24 +#define VK_LEFT 0x25 +#define VK_UP 0x26 +#define VK_RIGHT 0x27 +#define VK_DOWN 0x28 +#define VK_SELECT 0x29 +#define VK_PRINT 0x2A +#define VK_EXECUTE 0x2B +#define VK_SNAPSHOT 0x2C +#define VK_INSERT 0x2D +#define VK_DELETE 0x2E +#define VK_HELP 0x2F + +#define VK_LWIN 0x5B +#define VK_RWIN 0x5C +#define VK_APPS 0x5D +#define VK_SLEEP 0x5F +#define VK_NUMPAD0 0x60 +#define VK_NUMPAD1 0x61 +#define VK_NUMPAD2 0x62 +#define VK_NUMPAD3 0x63 +#define VK_NUMPAD4 0x64 +#define VK_NUMPAD5 0x65 +#define VK_NUMPAD6 0x66 +#define VK_NUMPAD7 0x67 +#define VK_NUMPAD8 0x68 +#define VK_NUMPAD9 0x69 +#define VK_MULTIPLY 0x6A +#define VK_ADD 0x6B +#define VK_SEPARATOR 0x6C +#define VK_SUBTRACT 0x6D +#define VK_DECIMAL 0x6E +#define VK_DIVIDE 0x6F +#define VK_F1 0x70 +#define VK_F2 0x71 +#define VK_F3 0x72 +#define VK_F4 0x73 +#define VK_F5 0x74 +#define VK_F6 0x75 +#define VK_F7 0x76 +#define VK_F8 0x77 +#define VK_F9 0x78 +#define VK_F10 0x79 +#define VK_F11 0x7A +#define VK_F12 0x7B +#define VK_F13 0x7C +#define VK_F14 0x7D +#define VK_F15 0x7E +#define VK_F16 0x7F +#define VK_F17 0x80 +#define VK_F18 0x81 +#define VK_F19 0x82 +#define VK_F20 0x83 +#define VK_F21 0x84 +#define VK_F22 0x85 +#define VK_F23 0x86 +#define VK_F24 0x87 +#define VK_NUMLOCK 0x90 +#define VK_SCROLL 0x91 +#define VK_OEM_NEC_EQUAL 0x92 +#define VK_OEM_FJ_JISHO 0x92 +#define VK_OEM_FJ_MASSHOU 0x93 +#define VK_OEM_FJ_TOUROKU 0x94 +#define VK_OEM_FJ_LOYA 0x95 +#define VK_OEM_FJ_ROYA 0x96 +#define VK_LSHIFT 0xA0 +#define VK_RSHIFT 0xA1 +#define VK_LCONTROL 0xA2 +#define VK_RCONTROL 0xA3 +#define VK_LMENU 0xA4 +#define VK_RMENU 0xA5 +#define VK_BROWSER_BACK 0xA6 +#define VK_BROWSER_FORWARD 0xA7 +#define VK_BROWSER_REFRESH 0xA8 +#define VK_BROWSER_STOP 0xA9 +#define VK_BROWSER_SEARCH 0xAA +#define VK_BROWSER_FAVORITES 0xAB +#define VK_BROWSER_HOME 0xAC +#define VK_VOLUME_MUTE 0xAD +#define VK_VOLUME_DOWN 0xAE +#define VK_VOLUME_UP 0xAF +#define VK_MEDIA_NEXT_TRACK 0xB0 +#define VK_MEDIA_PREV_TRACK 0xB1 +#define VK_MEDIA_STOP 0xB2 +#define VK_MEDIA_PLAY_PAUSE 0xB3 +#define VK_LAUNCH_MAIL 0xB4 +#define VK_LAUNCH_MEDIA_SELECT 0xB5 +#define VK_LAUNCH_APP1 0xB6 +#define VK_LAUNCH_APP2 0xB7 +#define VK_OEM_1 0xBA +#define VK_OEM_PLUS 0xBB +#define VK_OEM_COMMA 0xBC +#define VK_OEM_MINUS 0xBD +#define VK_OEM_PERIOD 0xBE +#define VK_OEM_2 0xBF +#define VK_OEM_3 0xC0 +#define VK_OEM_4 0xDB +#define VK_OEM_5 0xDC +#define VK_OEM_6 0xDD +#define VK_OEM_7 0xDE +#define VK_OEM_8 0xDF +#define VK_OEM_AX 0xE1 +#define VK_OEM_102 0xE2 +#define VK_ICO_HELP 0xE3 +#define VK_ICO_00 0xE4 +#define VK_PROCESSKEY 0xE5 +#define VK_ICO_CLEAR 0xE6 +#define VK_PACKET 0xE7 +#define VK_OEM_RESET 0xE9 +#define VK_OEM_JUMP 0xEA +#define VK_OEM_PA1 0xEB +#define VK_OEM_PA2 0xEC +#define VK_OEM_PA3 0xED +#define VK_OEM_WSCTRL 0xEE +#define VK_OEM_CUSEL 0xEF +#define VK_OEM_ATTN 0xF0 +#define VK_OEM_FINISH 0xF1 +#define VK_OEM_COPY 0xF2 +#define VK_OEM_AUTO 0xF3 +#define VK_OEM_ENLW 0xF4 +#define VK_OEM_BACKTAB 0xF5 +#define VK_ATTN 0xF6 +#define VK_CRSEL 0xF7 +#define VK_EXSEL 0xF8 +#define VK_EREOF 0xF9 +#define VK_PLAY 0xFA +#define VK_ZOOM 0xFB +#define VK_NONAME 0xFC +#define VK_PA1 0xFD +#define VK_OEM_CLEAR 0xFE +#endif + +#ifndef NOWH + +#define WH_MIN (-1) +#define WH_MSGFILTER (-1) +#define WH_JOURNALRECORD 0 +#define WH_JOURNALPLAYBACK 1 +#define WH_KEYBOARD 2 +#define WH_GETMESSAGE 3 +#define WH_CALLWNDPROC 4 +#define WH_CBT 5 +#define WH_SYSMSGFILTER 6 +#define WH_MOUSE 7 +#define WH_HARDWARE 8 +#define WH_DEBUG 9 +#define WH_SHELL 10 +#define WH_FOREGROUNDIDLE 11 +#define WH_CALLWNDPROCRET 12 + +#define WH_KEYBOARD_LL 13 +#define WH_MOUSE_LL 14 + +#define WH_MAX 14 + +#define WH_MINHOOK WH_MIN +#define WH_MAXHOOK WH_MAX + +#define HC_ACTION 0 +#define HC_GETNEXT 1 +#define HC_SKIP 2 +#define HC_NOREMOVE 3 +#define HC_NOREM HC_NOREMOVE +#define HC_SYSMODALON 4 +#define HC_SYSMODALOFF 5 + +#define HCBT_MOVESIZE 0 +#define HCBT_MINMAX 1 +#define HCBT_QS 2 +#define HCBT_CREATEWND 3 +#define HCBT_DESTROYWND 4 +#define HCBT_ACTIVATE 5 +#define HCBT_CLICKSKIPPED 6 +#define HCBT_KEYSKIPPED 7 +#define HCBT_SYSCOMMAND 8 +#define HCBT_SETFOCUS 9 + + typedef struct tagCBT_CREATEWNDA { + struct tagCREATESTRUCTA *lpcs; + HWND hwndInsertAfter; + } CBT_CREATEWNDA,*LPCBT_CREATEWNDA; + + typedef struct tagCBT_CREATEWNDW { + struct tagCREATESTRUCTW *lpcs; + HWND hwndInsertAfter; + } CBT_CREATEWNDW,*LPCBT_CREATEWNDW; +#ifdef UNICODE + typedef CBT_CREATEWNDW CBT_CREATEWND; + typedef LPCBT_CREATEWNDW LPCBT_CREATEWND; +#else + typedef CBT_CREATEWNDA CBT_CREATEWND; + typedef LPCBT_CREATEWNDA LPCBT_CREATEWND; +#endif + + typedef struct tagCBTACTIVATESTRUCT + { + WINBOOL fMouse; + HWND hWndActive; + } CBTACTIVATESTRUCT,*LPCBTACTIVATESTRUCT; + + typedef struct tagWTSSESSION_NOTIFICATION { + DWORD cbSize; + DWORD dwSessionId; + + } WTSSESSION_NOTIFICATION,*PWTSSESSION_NOTIFICATION; + +#define WTS_CONSOLE_CONNECT 0x1 +#define WTS_CONSOLE_DISCONNECT 0x2 +#define WTS_REMOTE_CONNECT 0x3 +#define WTS_REMOTE_DISCONNECT 0x4 +#define WTS_SESSION_LOGON 0x5 +#define WTS_SESSION_LOGOFF 0x6 +#define WTS_SESSION_LOCK 0x7 +#define WTS_SESSION_UNLOCK 0x8 +#define WTS_SESSION_REMOTE_CONTROL 0x9 + +#define MSGF_DIALOGBOX 0 +#define MSGF_MESSAGEBOX 1 +#define MSGF_MENU 2 +#define MSGF_SCROLLBAR 5 +#define MSGF_NEXTWINDOW 6 +#define MSGF_MAX 8 +#define MSGF_USER 4096 + +#define HSHELL_WINDOWCREATED 1 +#define HSHELL_WINDOWDESTROYED 2 +#define HSHELL_ACTIVATESHELLWINDOW 3 + +#define HSHELL_WINDOWACTIVATED 4 +#define HSHELL_GETMINRECT 5 +#define HSHELL_REDRAW 6 +#define HSHELL_TASKMAN 7 +#define HSHELL_LANGUAGE 8 +#define HSHELL_SYSMENU 9 +#define HSHELL_ENDTASK 10 +#define HSHELL_ACCESSIBILITYSTATE 11 +#define HSHELL_APPCOMMAND 12 +#define HSHELL_WINDOWREPLACED 13 +#define HSHELL_WINDOWREPLACING 14 +#define HSHELL_HIGHBIT 0x8000 +#define HSHELL_FLASH (HSHELL_REDRAW|HSHELL_HIGHBIT) +#define HSHELL_RUDEAPPACTIVATED (HSHELL_WINDOWACTIVATED|HSHELL_HIGHBIT) + +#define ACCESS_STICKYKEYS 0x0001 +#define ACCESS_FILTERKEYS 0x0002 +#define ACCESS_MOUSEKEYS 0x0003 + +#define APPCOMMAND_BROWSER_BACKWARD 1 +#define APPCOMMAND_BROWSER_FORWARD 2 +#define APPCOMMAND_BROWSER_REFRESH 3 +#define APPCOMMAND_BROWSER_STOP 4 +#define APPCOMMAND_BROWSER_SEARCH 5 +#define APPCOMMAND_BROWSER_FAVORITES 6 +#define APPCOMMAND_BROWSER_HOME 7 +#define APPCOMMAND_VOLUME_MUTE 8 +#define APPCOMMAND_VOLUME_DOWN 9 +#define APPCOMMAND_VOLUME_UP 10 +#define APPCOMMAND_MEDIA_NEXTTRACK 11 +#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12 +#define APPCOMMAND_MEDIA_STOP 13 +#define APPCOMMAND_MEDIA_PLAY_PAUSE 14 +#define APPCOMMAND_LAUNCH_MAIL 15 +#define APPCOMMAND_LAUNCH_MEDIA_SELECT 16 +#define APPCOMMAND_LAUNCH_APP1 17 +#define APPCOMMAND_LAUNCH_APP2 18 +#define APPCOMMAND_BASS_DOWN 19 +#define APPCOMMAND_BASS_BOOST 20 +#define APPCOMMAND_BASS_UP 21 +#define APPCOMMAND_TREBLE_DOWN 22 +#define APPCOMMAND_TREBLE_UP 23 +#define APPCOMMAND_MICROPHONE_VOLUME_MUTE 24 +#define APPCOMMAND_MICROPHONE_VOLUME_DOWN 25 +#define APPCOMMAND_MICROPHONE_VOLUME_UP 26 +#define APPCOMMAND_HELP 27 +#define APPCOMMAND_FIND 28 +#define APPCOMMAND_NEW 29 +#define APPCOMMAND_OPEN 30 +#define APPCOMMAND_CLOSE 31 +#define APPCOMMAND_SAVE 32 +#define APPCOMMAND_PRINT 33 +#define APPCOMMAND_UNDO 34 +#define APPCOMMAND_REDO 35 +#define APPCOMMAND_COPY 36 +#define APPCOMMAND_CUT 37 +#define APPCOMMAND_PASTE 38 +#define APPCOMMAND_REPLY_TO_MAIL 39 +#define APPCOMMAND_FORWARD_MAIL 40 +#define APPCOMMAND_SEND_MAIL 41 +#define APPCOMMAND_SPELL_CHECK 42 +#define APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE 43 +#define APPCOMMAND_MIC_ON_OFF_TOGGLE 44 +#define APPCOMMAND_CORRECTION_LIST 45 +#define APPCOMMAND_MEDIA_PLAY 46 +#define APPCOMMAND_MEDIA_PAUSE 47 +#define APPCOMMAND_MEDIA_RECORD 48 +#define APPCOMMAND_MEDIA_FAST_FORWARD 49 +#define APPCOMMAND_MEDIA_REWIND 50 +#define APPCOMMAND_MEDIA_CHANNEL_UP 51 +#define APPCOMMAND_MEDIA_CHANNEL_DOWN 52 + +#define FAPPCOMMAND_MOUSE 0x8000 +#define FAPPCOMMAND_KEY 0 +#define FAPPCOMMAND_OEM 0x1000 +#define FAPPCOMMAND_MASK 0xF000 + +#define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK)) +#define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK)) +#define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM +#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam)) +#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam) + + typedef struct { + HWND hwnd; + RECT rc; + } SHELLHOOKINFO,*LPSHELLHOOKINFO; + + typedef struct tagEVENTMSG { + UINT message; + UINT paramL; + UINT paramH; + DWORD time; + HWND hwnd; + } EVENTMSG,*PEVENTMSGMSG,*NPEVENTMSGMSG,*LPEVENTMSGMSG; + + typedef struct tagEVENTMSG *PEVENTMSG,*NPEVENTMSG,*LPEVENTMSG; + + typedef struct tagCWPSTRUCT { + LPARAM lParam; + WPARAM wParam; + UINT message; + HWND hwnd; + } CWPSTRUCT,*PCWPSTRUCT,*NPCWPSTRUCT,*LPCWPSTRUCT; + + typedef struct tagCWPRETSTRUCT { + LRESULT lResult; + LPARAM lParam; + WPARAM wParam; + UINT message; + HWND hwnd; + } CWPRETSTRUCT,*PCWPRETSTRUCT,*NPCWPRETSTRUCT,*LPCWPRETSTRUCT; + +#define LLKHF_EXTENDED (KF_EXTENDED >> 8) +#define LLKHF_INJECTED 0x00000010 +#define LLKHF_ALTDOWN (KF_ALTDOWN >> 8) +#define LLKHF_UP (KF_UP >> 8) + +#define LLMHF_INJECTED 0x00000001 + + typedef struct tagKBDLLHOOKSTRUCT { + DWORD vkCode; + DWORD scanCode; + DWORD flags; + DWORD time; + ULONG_PTR dwExtraInfo; + } KBDLLHOOKSTRUCT,*LPKBDLLHOOKSTRUCT,*PKBDLLHOOKSTRUCT; + + typedef struct tagMSLLHOOKSTRUCT { + POINT pt; + DWORD mouseData; + DWORD flags; + DWORD time; + ULONG_PTR dwExtraInfo; + } MSLLHOOKSTRUCT,*LPMSLLHOOKSTRUCT,*PMSLLHOOKSTRUCT; + + typedef struct tagDEBUGHOOKINFO { + DWORD idThread; + DWORD idThreadInstaller; + LPARAM lParam; + WPARAM wParam; + int code; + } DEBUGHOOKINFO,*PDEBUGHOOKINFO,*NPDEBUGHOOKINFO,*LPDEBUGHOOKINFO; + + typedef struct tagMOUSEHOOKSTRUCT { + POINT pt; + HWND hwnd; + UINT wHitTestCode; + ULONG_PTR dwExtraInfo; + } MOUSEHOOKSTRUCT,*LPMOUSEHOOKSTRUCT,*PMOUSEHOOKSTRUCT; + +#ifdef __cplusplus + typedef struct tagMOUSEHOOKSTRUCTEX : public tagMOUSEHOOKSTRUCT { + DWORD mouseData; + } MOUSEHOOKSTRUCTEX,*LPMOUSEHOOKSTRUCTEX,*PMOUSEHOOKSTRUCTEX; +#else + typedef struct tagMOUSEHOOKSTRUCTEX { + MOUSEHOOKSTRUCT _unnamed; + DWORD mouseData; + } MOUSEHOOKSTRUCTEX,*LPMOUSEHOOKSTRUCTEX,*PMOUSEHOOKSTRUCTEX; +#endif + + typedef struct tagHARDWAREHOOKSTRUCT { + HWND hwnd; + UINT message; + WPARAM wParam; + LPARAM lParam; + } HARDWAREHOOKSTRUCT,*LPHARDWAREHOOKSTRUCT,*PHARDWAREHOOKSTRUCT; +#endif + +#define HKL_PREV 0 +#define HKL_NEXT 1 + +#define KLF_ACTIVATE 0x00000001 +#define KLF_SUBSTITUTE_OK 0x00000002 +#define KLF_REORDER 0x00000008 +#define KLF_REPLACELANG 0x00000010 +#define KLF_NOTELLSHELL 0x00000080 +#define KLF_SETFORPROCESS 0x00000100 +#define KLF_SHIFTLOCK 0x00010000 +#define KLF_RESET 0x40000000 + +#define INPUTLANGCHANGE_SYSCHARSET 0x0001 +#define INPUTLANGCHANGE_FORWARD 0x0002 +#define INPUTLANGCHANGE_BACKWARD 0x0004 + +#define KL_NAMELENGTH 9 + +#ifdef UNICODE +#define LoadKeyboardLayout LoadKeyboardLayoutW +#define GetKeyboardLayoutName GetKeyboardLayoutNameW +#else +#define LoadKeyboardLayout LoadKeyboardLayoutA +#define GetKeyboardLayoutName GetKeyboardLayoutNameA +#endif + + WINUSERAPI HKL WINAPI LoadKeyboardLayoutA(LPCSTR pwszKLID,UINT Flags); + WINUSERAPI HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID,UINT Flags); + WINUSERAPI HKL WINAPI ActivateKeyboardLayout(HKL hkl,UINT Flags); + WINUSERAPI int WINAPI ToUnicodeEx(UINT wVirtKey,UINT wScanCode,CONST BYTE *lpKeyState,LPWSTR pwszBuff,int cchBuff,UINT wFlags,HKL dwhkl); + WINUSERAPI WINBOOL WINAPI UnloadKeyboardLayout(HKL hkl); + WINUSERAPI WINBOOL WINAPI GetKeyboardLayoutNameA(LPSTR pwszKLID); + WINUSERAPI WINBOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID); + WINUSERAPI int WINAPI GetKeyboardLayoutList(int nBuff,HKL *lpList); + WINUSERAPI HKL WINAPI GetKeyboardLayout(DWORD idThread); + + typedef struct tagMOUSEMOVEPOINT { + int x; + int y; + DWORD time; + ULONG_PTR dwExtraInfo; + } MOUSEMOVEPOINT,*PMOUSEMOVEPOINT,*LPMOUSEMOVEPOINT; + +#define GMMP_USE_DISPLAY_POINTS 1 +#define GMMP_USE_HIGH_RESOLUTION_POINTS 2 + + WINUSERAPI int WINAPI GetMouseMovePointsEx(UINT cbSize,LPMOUSEMOVEPOINT lppt,LPMOUSEMOVEPOINT lpptBuf,int nBufPoints,DWORD resolution); + +#ifndef NODESKTOP + +#define DESKTOP_READOBJECTS 0x0001L +#define DESKTOP_CREATEWINDOW 0x0002L +#define DESKTOP_CREATEMENU 0x0004L +#define DESKTOP_HOOKCONTROL 0x0008L +#define DESKTOP_JOURNALRECORD 0x0010L +#define DESKTOP_JOURNALPLAYBACK 0x0020L +#define DESKTOP_ENUMERATE 0x0040L +#define DESKTOP_WRITEOBJECTS 0x0080L +#define DESKTOP_SWITCHDESKTOP 0x0100L + +#define DF_ALLOWOTHERACCOUNTHOOK 0x0001L + +#ifdef _WINGDI_ +#ifndef NOGDI +#ifdef UNICODE +#define CreateDesktop CreateDesktopW +#else +#define CreateDesktop CreateDesktopA +#endif + + WINUSERAPI HDESK WINAPI CreateDesktopA(LPCSTR lpszDesktop,LPCSTR lpszDevice,LPDEVMODEA pDevmode,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); + WINUSERAPI HDESK WINAPI CreateDesktopW(LPCWSTR lpszDesktop,LPCWSTR lpszDevice,LPDEVMODEW pDevmode,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); +#endif +#endif + +#ifdef UNICODE +#define OpenDesktop OpenDesktopW +#define EnumDesktops EnumDesktopsW +#else +#define OpenDesktop OpenDesktopA +#define EnumDesktops EnumDesktopsA +#endif + + WINUSERAPI HDESK WINAPI OpenDesktopA(LPCSTR lpszDesktop,DWORD dwFlags,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI HDESK WINAPI OpenDesktopW(LPCWSTR lpszDesktop,DWORD dwFlags,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI HDESK WINAPI OpenInputDesktop(DWORD dwFlags,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI WINBOOL WINAPI EnumDesktopsA(HWINSTA hwinsta,DESKTOPENUMPROCA lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI EnumDesktopsW(HWINSTA hwinsta,DESKTOPENUMPROCW lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI EnumDesktopWindows(HDESK hDesktop,WNDENUMPROC lpfn,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI SwitchDesktop(HDESK hDesktop); + WINUSERAPI WINBOOL WINAPI SetThreadDesktop(HDESK hDesktop); + WINUSERAPI WINBOOL WINAPI CloseDesktop(HDESK hDesktop); + WINUSERAPI HDESK WINAPI GetThreadDesktop(DWORD dwThreadId); +#endif + +#ifndef NOWINDOWSTATION +#define WINSTA_ENUMDESKTOPS 0x0001L +#define WINSTA_READATTRIBUTES 0x0002L +#define WINSTA_ACCESSCLIPBOARD 0x0004L +#define WINSTA_CREATEDESKTOP 0x0008L +#define WINSTA_WRITEATTRIBUTES 0x0010L +#define WINSTA_ACCESSGLOBALATOMS 0x0020L +#define WINSTA_EXITWINDOWS 0x0040L +#define WINSTA_ENUMERATE 0x0100L +#define WINSTA_READSCREEN 0x0200L +#define WINSTA_ALL_ACCESS (WINSTA_ENUMDESKTOPS | WINSTA_READATTRIBUTES | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS | WINSTA_ENUMERATE | WINSTA_READSCREEN) + +#define CWF_CREATE_ONLY 0x0001L + +#define WSF_VISIBLE 0x0001L + +#ifdef UNICODE +#define CreateWindowStation CreateWindowStationW +#define OpenWindowStation OpenWindowStationW +#define EnumWindowStations EnumWindowStationsW +#else +#define CreateWindowStation CreateWindowStationA +#define OpenWindowStation OpenWindowStationA +#define EnumWindowStations EnumWindowStationsA +#endif + + WINUSERAPI HWINSTA WINAPI CreateWindowStationA(LPCSTR lpwinsta,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); + WINUSERAPI HWINSTA WINAPI CreateWindowStationW(LPCWSTR lpwinsta,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); + WINUSERAPI HWINSTA WINAPI OpenWindowStationA(LPCSTR lpszWinSta,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI HWINSTA WINAPI OpenWindowStationW(LPCWSTR lpszWinSta,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI WINBOOL WINAPI EnumWindowStationsA(WINSTAENUMPROCA lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI EnumWindowStationsW(WINSTAENUMPROCW lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI CloseWindowStation(HWINSTA hWinSta); + WINUSERAPI WINBOOL WINAPI SetProcessWindowStation(HWINSTA hWinSta); + WINUSERAPI HWINSTA WINAPI GetProcessWindowStation(VOID); +#endif + +#ifndef NOSECURITY + WINUSERAPI WINBOOL WINAPI SetUserObjectSecurity(HANDLE hObj,PSECURITY_INFORMATION pSIRequested,PSECURITY_DESCRIPTOR pSID); + WINUSERAPI WINBOOL WINAPI GetUserObjectSecurity(HANDLE hObj,PSECURITY_INFORMATION pSIRequested,PSECURITY_DESCRIPTOR pSID,DWORD nLength,LPDWORD lpnLengthNeeded); + +#define UOI_FLAGS 1 +#define UOI_NAME 2 +#define UOI_TYPE 3 +#define UOI_USER_SID 4 + + typedef struct tagUSEROBJECTFLAGS { + WINBOOL fInherit; + WINBOOL fReserved; + DWORD dwFlags; + } USEROBJECTFLAGS,*PUSEROBJECTFLAGS; + +#ifdef UNICODE +#define GetUserObjectInformation GetUserObjectInformationW +#define SetUserObjectInformation SetUserObjectInformationW +#else +#define GetUserObjectInformation GetUserObjectInformationA +#define SetUserObjectInformation SetUserObjectInformationA +#endif + + WINUSERAPI WINBOOL WINAPI GetUserObjectInformationA(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength,LPDWORD lpnLengthNeeded); + WINUSERAPI WINBOOL WINAPI GetUserObjectInformationW(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength,LPDWORD lpnLengthNeeded); + WINUSERAPI WINBOOL WINAPI SetUserObjectInformationA(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength); + WINUSERAPI WINBOOL WINAPI SetUserObjectInformationW(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength); +#endif + + typedef struct tagWNDCLASSEXA { + UINT cbSize; + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HINSTANCE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCSTR lpszMenuName; + LPCSTR lpszClassName; + HICON hIconSm; + } WNDCLASSEXA,*PWNDCLASSEXA,*NPWNDCLASSEXA,*LPWNDCLASSEXA; + + typedef struct tagWNDCLASSEXW { + UINT cbSize; + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HINSTANCE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCWSTR lpszMenuName; + LPCWSTR lpszClassName; + + HICON hIconSm; + } WNDCLASSEXW,*PWNDCLASSEXW,*NPWNDCLASSEXW,*LPWNDCLASSEXW; + +#ifdef UNICODE + typedef WNDCLASSEXW WNDCLASSEX; + typedef PWNDCLASSEXW PWNDCLASSEX; + typedef NPWNDCLASSEXW NPWNDCLASSEX; + typedef LPWNDCLASSEXW LPWNDCLASSEX; +#else + typedef WNDCLASSEXA WNDCLASSEX; + typedef PWNDCLASSEXA PWNDCLASSEX; + typedef NPWNDCLASSEXA NPWNDCLASSEX; + typedef LPWNDCLASSEXA LPWNDCLASSEX; +#endif + + typedef struct tagWNDCLASSA { + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HINSTANCE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCSTR lpszMenuName; + LPCSTR lpszClassName; + } WNDCLASSA,*PWNDCLASSA,*NPWNDCLASSA,*LPWNDCLASSA; + + typedef struct tagWNDCLASSW { + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HINSTANCE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCWSTR lpszMenuName; + LPCWSTR lpszClassName; + } WNDCLASSW,*PWNDCLASSW,*NPWNDCLASSW,*LPWNDCLASSW; + +#ifdef UNICODE + typedef WNDCLASSW WNDCLASS; + typedef PWNDCLASSW PWNDCLASS; + typedef NPWNDCLASSW NPWNDCLASS; + typedef LPWNDCLASSW LPWNDCLASS; +#else + typedef WNDCLASSA WNDCLASS; + typedef PWNDCLASSA PWNDCLASS; + typedef NPWNDCLASSA NPWNDCLASS; + typedef LPWNDCLASSA LPWNDCLASS; +#endif + + WINUSERAPI WINBOOL WINAPI IsHungAppWindow(HWND hwnd); + WINUSERAPI VOID WINAPI DisableProcessWindowsGhosting(VOID); + +#ifndef NOMSG + typedef struct tagMSG { + HWND hwnd; + UINT message; + WPARAM wParam; + LPARAM lParam; + DWORD time; + POINT pt; + } MSG,*PMSG,*NPMSG,*LPMSG; + +#define POINTSTOPOINT(pt,pts) { (pt).x = (LONG)(SHORT)LOWORD(*(LONG*)&pts); (pt).y = (LONG)(SHORT)HIWORD(*(LONG*)&pts); } + +#define POINTTOPOINTS(pt) (MAKELONG((short)((pt).x),(short)((pt).y))) +#define MAKEWPARAM(l,h) ((WPARAM)(DWORD)MAKELONG(l,h)) +#define MAKELPARAM(l,h) ((LPARAM)(DWORD)MAKELONG(l,h)) +#define MAKELRESULT(l,h) ((LRESULT)(DWORD)MAKELONG(l,h)) +#endif + +#ifndef NOWINOFFSETS +#define GWL_WNDPROC (-4) +#define GWL_HINSTANCE (-6) +#define GWL_HWNDPARENT (-8) +#define GWL_STYLE (-16) +#define GWL_EXSTYLE (-20) +#define GWL_USERDATA (-21) +#define GWL_ID (-12) + +#ifdef _WIN64 +#undef GWL_WNDPROC +#undef GWL_HINSTANCE +#undef GWL_HWNDPARENT +#undef GWL_USERDATA +#endif + +#define GWLP_WNDPROC (-4) +#define GWLP_HINSTANCE (-6) +#define GWLP_HWNDPARENT (-8) +#define GWLP_USERDATA (-21) +#define GWLP_ID (-12) + +#define GCL_MENUNAME (-8) +#define GCL_HBRBACKGROUND (-10) +#define GCL_HCURSOR (-12) +#define GCL_HICON (-14) +#define GCL_HMODULE (-16) +#define GCL_CBWNDEXTRA (-18) +#define GCL_CBCLSEXTRA (-20) +#define GCL_WNDPROC (-24) +#define GCL_STYLE (-26) +#define GCW_ATOM (-32) +#define GCL_HICONSM (-34) + +#ifdef _WIN64 + +#undef GCL_MENUNAME +#undef GCL_HBRBACKGROUND +#undef GCL_HCURSOR +#undef GCL_HICON +#undef GCL_HMODULE +#undef GCL_WNDPROC +#undef GCL_HICONSM +#endif + +#define GCLP_MENUNAME (-8) +#define GCLP_HBRBACKGROUND (-10) +#define GCLP_HCURSOR (-12) +#define GCLP_HICON (-14) +#define GCLP_HMODULE (-16) +#define GCLP_WNDPROC (-24) +#define GCLP_HICONSM (-34) +#endif + +#ifndef NOWINMESSAGES + +#define WM_NULL 0x0000 +#define WM_CREATE 0x0001 +#define WM_DESTROY 0x0002 +#define WM_MOVE 0x0003 +#define WM_SIZE 0x0005 + +#define WM_ACTIVATE 0x0006 + +#define WA_INACTIVE 0 +#define WA_ACTIVE 1 +#define WA_CLICKACTIVE 2 + +#define WM_SETFOCUS 0x0007 +#define WM_KILLFOCUS 0x0008 +#define WM_ENABLE 0x000A +#define WM_SETREDRAW 0x000B +#define WM_SETTEXT 0x000C +#define WM_GETTEXT 0x000D +#define WM_GETTEXTLENGTH 0x000E +#define WM_PAINT 0x000F +#define WM_CLOSE 0x0010 +#ifndef _WIN32_WCE +#define WM_QUERYENDSESSION 0x0011 +#define WM_QUERYOPEN 0x0013 +#define WM_ENDSESSION 0x0016 +#endif +#define WM_QUIT 0x0012 +#define WM_ERASEBKGND 0x0014 +#define WM_SYSCOLORCHANGE 0x0015 +#define WM_SHOWWINDOW 0x0018 +#define WM_WININICHANGE 0x001A +#define WM_SETTINGCHANGE WM_WININICHANGE +#define WM_DEVMODECHANGE 0x001B +#define WM_ACTIVATEAPP 0x001C +#define WM_FONTCHANGE 0x001D +#define WM_TIMECHANGE 0x001E +#define WM_CANCELMODE 0x001F +#define WM_SETCURSOR 0x0020 +#define WM_MOUSEACTIVATE 0x0021 +#define WM_CHILDACTIVATE 0x0022 +#define WM_QUEUESYNC 0x0023 + +#define WM_GETMINMAXINFO 0x0024 + + typedef struct tagMINMAXINFO { + POINT ptReserved; + POINT ptMaxSize; + POINT ptMaxPosition; + POINT ptMinTrackSize; + POINT ptMaxTrackSize; + } MINMAXINFO,*PMINMAXINFO,*LPMINMAXINFO; + +#define WM_PAINTICON 0x0026 +#define WM_ICONERASEBKGND 0x0027 +#define WM_NEXTDLGCTL 0x0028 +#define WM_SPOOLERSTATUS 0x002A +#define WM_DRAWITEM 0x002B +#define WM_MEASUREITEM 0x002C +#define WM_DELETEITEM 0x002D +#define WM_VKEYTOITEM 0x002E +#define WM_CHARTOITEM 0x002F +#define WM_SETFONT 0x0030 +#define WM_GETFONT 0x0031 +#define WM_SETHOTKEY 0x0032 +#define WM_GETHOTKEY 0x0033 +#define WM_QUERYDRAGICON 0x0037 +#define WM_COMPAREITEM 0x0039 +#ifndef _WIN32_WCE +#define WM_GETOBJECT 0x003D +#endif +#define WM_COMPACTING 0x0041 +#define WM_COMMNOTIFY 0x0044 +#define WM_WINDOWPOSCHANGING 0x0046 +#define WM_WINDOWPOSCHANGED 0x0047 + +#define WM_POWER 0x0048 + +#define PWR_OK 1 +#define PWR_FAIL (-1) +#define PWR_SUSPENDREQUEST 1 +#define PWR_SUSPENDRESUME 2 +#define PWR_CRITICALRESUME 3 + +#define WM_COPYDATA 0x004A +#define WM_CANCELJOURNAL 0x004B + + typedef struct tagCOPYDATASTRUCT { + ULONG_PTR dwData; + DWORD cbData; + PVOID lpData; + } COPYDATASTRUCT,*PCOPYDATASTRUCT; + + typedef struct tagMDINEXTMENU { + HMENU hmenuIn; + HMENU hmenuNext; + HWND hwndNext; + } MDINEXTMENU,*PMDINEXTMENU,*LPMDINEXTMENU; + +#define WM_NOTIFY 0x004E +#define WM_INPUTLANGCHANGEREQUEST 0x0050 +#define WM_INPUTLANGCHANGE 0x0051 +#define WM_TCARD 0x0052 +#define WM_HELP 0x0053 +#define WM_USERCHANGED 0x0054 +#define WM_NOTIFYFORMAT 0x0055 + +#define NFR_ANSI 1 +#define NFR_UNICODE 2 +#define NF_QUERY 3 +#define NF_REQUERY 4 + +#define WM_CONTEXTMENU 0x007B +#define WM_STYLECHANGING 0x007C +#define WM_STYLECHANGED 0x007D +#define WM_DISPLAYCHANGE 0x007E +#define WM_GETICON 0x007F +#define WM_SETICON 0x0080 + +#define WM_NCCREATE 0x0081 +#define WM_NCDESTROY 0x0082 +#define WM_NCCALCSIZE 0x0083 +#define WM_NCHITTEST 0x0084 +#define WM_NCPAINT 0x0085 +#define WM_NCACTIVATE 0x0086 +#define WM_GETDLGCODE 0x0087 +#ifndef _WIN32_WCE +#define WM_SYNCPAINT 0x0088 +#endif +#define WM_NCMOUSEMOVE 0x00A0 +#define WM_NCLBUTTONDOWN 0x00A1 +#define WM_NCLBUTTONUP 0x00A2 +#define WM_NCLBUTTONDBLCLK 0x00A3 +#define WM_NCRBUTTONDOWN 0x00A4 +#define WM_NCRBUTTONUP 0x00A5 +#define WM_NCRBUTTONDBLCLK 0x00A6 +#define WM_NCMBUTTONDOWN 0x00A7 +#define WM_NCMBUTTONUP 0x00A8 +#define WM_NCMBUTTONDBLCLK 0x00A9 + +#define WM_NCXBUTTONDOWN 0x00AB +#define WM_NCXBUTTONUP 0x00AC +#define WM_NCXBUTTONDBLCLK 0x00AD +#define WM_INPUT 0x00FF +#define WM_KEYFIRST 0x0100 +#define WM_KEYDOWN 0x0100 +#define WM_KEYUP 0x0101 +#define WM_CHAR 0x0102 +#define WM_DEADCHAR 0x0103 +#define WM_SYSKEYDOWN 0x0104 +#define WM_SYSKEYUP 0x0105 +#define WM_SYSCHAR 0x0106 +#define WM_SYSDEADCHAR 0x0107 +#define WM_UNICHAR 0x0109 +#define WM_KEYLAST 0x0109 +#define UNICODE_NOCHAR 0xFFFF +#define WM_IME_STARTCOMPOSITION 0x010D +#define WM_IME_ENDCOMPOSITION 0x010E +#define WM_IME_COMPOSITION 0x010F +#define WM_IME_KEYLAST 0x010F +#define WM_INITDIALOG 0x0110 +#define WM_COMMAND 0x0111 +#define WM_SYSCOMMAND 0x0112 +#define WM_TIMER 0x0113 +#define WM_HSCROLL 0x0114 +#define WM_VSCROLL 0x0115 +#define WM_INITMENU 0x0116 +#define WM_INITMENUPOPUP 0x0117 +#define WM_MENUSELECT 0x011F +#define WM_MENUCHAR 0x0120 +#define WM_ENTERIDLE 0x0121 +#ifndef _WIN32_WCE +#define WM_MENURBUTTONUP 0x0122 +#define WM_MENUDRAG 0x0123 +#define WM_MENUGETOBJECT 0x0124 +#define WM_UNINITMENUPOPUP 0x0125 +#define WM_MENUCOMMAND 0x0126 + +#ifndef _WIN32_WCE +#define WM_CHANGEUISTATE 0x0127 +#define WM_UPDATEUISTATE 0x0128 +#define WM_QUERYUISTATE 0x0129 + +#define UIS_SET 1 +#define UIS_CLEAR 2 +#define UIS_INITIALIZE 3 + +#define UISF_HIDEFOCUS 0x1 +#define UISF_HIDEACCEL 0x2 +#define UISF_ACTIVE 0x4 +#endif +#endif + +#define WM_CTLCOLORMSGBOX 0x0132 +#define WM_CTLCOLOREDIT 0x0133 +#define WM_CTLCOLORLISTBOX 0x0134 +#define WM_CTLCOLORBTN 0x0135 +#define WM_CTLCOLORDLG 0x0136 +#define WM_CTLCOLORSCROLLBAR 0x0137 +#define WM_CTLCOLORSTATIC 0x0138 +#define MN_GETHMENU 0x01E1 + +#define WM_MOUSEFIRST 0x0200 +#define WM_MOUSEMOVE 0x0200 +#define WM_LBUTTONDOWN 0x0201 +#define WM_LBUTTONUP 0x0202 +#define WM_LBUTTONDBLCLK 0x0203 +#define WM_RBUTTONDOWN 0x0204 +#define WM_RBUTTONUP 0x0205 +#define WM_RBUTTONDBLCLK 0x0206 +#define WM_MBUTTONDOWN 0x0207 +#define WM_MBUTTONUP 0x0208 +#define WM_MBUTTONDBLCLK 0x0209 +#define WM_MOUSEWHEEL 0x020A +#define WM_XBUTTONDOWN 0x020B +#define WM_XBUTTONUP 0x020C +#define WM_XBUTTONDBLCLK 0x020D +#define WM_MOUSELAST 0x020D + +#define WHEEL_DELTA 120 +#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) + +#define WHEEL_PAGESCROLL (UINT_MAX) + +#define GET_KEYSTATE_WPARAM(wParam) (LOWORD(wParam)) +#define GET_NCHITTEST_WPARAM(wParam) ((short)LOWORD(wParam)) +#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) + +#define XBUTTON1 0x0001 +#define XBUTTON2 0x0002 + +#define WM_PARENTNOTIFY 0x0210 +#define WM_ENTERMENULOOP 0x0211 +#define WM_EXITMENULOOP 0x0212 + +#define WM_NEXTMENU 0x0213 +#define WM_SIZING 0x0214 +#define WM_CAPTURECHANGED 0x0215 +#define WM_MOVING 0x0216 + +#define WM_POWERBROADCAST 0x0218 + +#ifndef _WIN32_WCE +#define PBT_APMQUERYSUSPEND 0x0000 +#define PBT_APMQUERYSTANDBY 0x0001 + +#define PBT_APMQUERYSUSPENDFAILED 0x0002 +#define PBT_APMQUERYSTANDBYFAILED 0x0003 + +#define PBT_APMSUSPEND 0x0004 +#define PBT_APMSTANDBY 0x0005 + +#define PBT_APMRESUMECRITICAL 0x0006 +#define PBT_APMRESUMESUSPEND 0x0007 +#define PBT_APMRESUMESTANDBY 0x0008 + +#define PBTF_APMRESUMEFROMFAILURE 0x00000001 + +#define PBT_APMBATTERYLOW 0x0009 +#define PBT_APMPOWERSTATUSCHANGE 0x000A + +#define PBT_APMOEMEVENT 0x000B +#define PBT_APMRESUMEAUTOMATIC 0x0012 +#endif + +#define WM_DEVICECHANGE 0x0219 + +#define WM_MDICREATE 0x0220 +#define WM_MDIDESTROY 0x0221 +#define WM_MDIACTIVATE 0x0222 +#define WM_MDIRESTORE 0x0223 +#define WM_MDINEXT 0x0224 +#define WM_MDIMAXIMIZE 0x0225 +#define WM_MDITILE 0x0226 +#define WM_MDICASCADE 0x0227 +#define WM_MDIICONARRANGE 0x0228 +#define WM_MDIGETACTIVE 0x0229 + +#define WM_MDISETMENU 0x0230 +#define WM_ENTERSIZEMOVE 0x0231 +#define WM_EXITSIZEMOVE 0x0232 +#define WM_DROPFILES 0x0233 +#define WM_MDIREFRESHMENU 0x0234 + +#define WM_IME_SETCONTEXT 0x0281 +#define WM_IME_NOTIFY 0x0282 +#define WM_IME_CONTROL 0x0283 +#define WM_IME_COMPOSITIONFULL 0x0284 +#define WM_IME_SELECT 0x0285 +#define WM_IME_CHAR 0x0286 +#define WM_IME_REQUEST 0x0288 +#define WM_IME_KEYDOWN 0x0290 +#define WM_IME_KEYUP 0x0291 + +#define WM_MOUSEHOVER 0x02A1 +#define WM_MOUSELEAVE 0x02A3 +#define WM_NCMOUSEHOVER 0x02A0 +#define WM_NCMOUSELEAVE 0x02A2 +#define WM_WTSSESSION_CHANGE 0x02B1 +#define WM_TABLET_FIRST 0x02c0 +#define WM_TABLET_LAST 0x02df +#define WM_CUT 0x0300 +#define WM_COPY 0x0301 +#define WM_PASTE 0x0302 +#define WM_CLEAR 0x0303 +#define WM_UNDO 0x0304 +#define WM_RENDERFORMAT 0x0305 +#define WM_RENDERALLFORMATS 0x0306 +#define WM_DESTROYCLIPBOARD 0x0307 +#define WM_DRAWCLIPBOARD 0x0308 +#define WM_PAINTCLIPBOARD 0x0309 +#define WM_VSCROLLCLIPBOARD 0x030A +#define WM_SIZECLIPBOARD 0x030B +#define WM_ASKCBFORMATNAME 0x030C +#define WM_CHANGECBCHAIN 0x030D +#define WM_HSCROLLCLIPBOARD 0x030E +#define WM_QUERYNEWPALETTE 0x030F +#define WM_PALETTEISCHANGING 0x0310 +#define WM_PALETTECHANGED 0x0311 +#define WM_HOTKEY 0x0312 +#define WM_PRINT 0x0317 +#define WM_PRINTCLIENT 0x0318 +#define WM_APPCOMMAND 0x0319 +#define WM_THEMECHANGED 0x031A +#define WM_HANDHELDFIRST 0x0358 +#define WM_HANDHELDLAST 0x035F +#define WM_AFXFIRST 0x0360 +#define WM_AFXLAST 0x037F +#define WM_PENWINFIRST 0x0380 +#define WM_PENWINLAST 0x038F +#define WM_APP 0x8000 +#define WM_USER 0x0400 + +#define WMSZ_LEFT 1 +#define WMSZ_RIGHT 2 +#define WMSZ_TOP 3 +#define WMSZ_TOPLEFT 4 +#define WMSZ_TOPRIGHT 5 +#define WMSZ_BOTTOM 6 +#define WMSZ_BOTTOMLEFT 7 +#define WMSZ_BOTTOMRIGHT 8 + +#ifndef NONCMESSAGES + +#define HTERROR (-2) +#define HTTRANSPARENT (-1) +#define HTNOWHERE 0 +#define HTCLIENT 1 +#define HTCAPTION 2 +#define HTSYSMENU 3 +#define HTGROWBOX 4 +#define HTSIZE HTGROWBOX +#define HTMENU 5 +#define HTHSCROLL 6 +#define HTVSCROLL 7 +#define HTMINBUTTON 8 +#define HTMAXBUTTON 9 +#define HTLEFT 10 +#define HTRIGHT 11 +#define HTTOP 12 +#define HTTOPLEFT 13 +#define HTTOPRIGHT 14 +#define HTBOTTOM 15 +#define HTBOTTOMLEFT 16 +#define HTBOTTOMRIGHT 17 +#define HTBORDER 18 +#define HTREDUCE HTMINBUTTON +#define HTZOOM HTMAXBUTTON +#define HTSIZEFIRST HTLEFT +#define HTSIZELAST HTBOTTOMRIGHT +#define HTOBJECT 19 +#define HTCLOSE 20 +#define HTHELP 21 + +#define SMTO_NORMAL 0x0000 +#define SMTO_BLOCK 0x0001 +#define SMTO_ABORTIFHUNG 0x0002 +#define SMTO_NOTIMEOUTIFNOTHUNG 0x0008 +#endif + +#define MA_ACTIVATE 1 +#define MA_ACTIVATEANDEAT 2 +#define MA_NOACTIVATE 3 +#define MA_NOACTIVATEANDEAT 4 + +#define ICON_SMALL 0 +#define ICON_BIG 1 +#define ICON_SMALL2 2 + +#ifdef UNICODE +#define RegisterWindowMessage RegisterWindowMessageW +#else +#define RegisterWindowMessage RegisterWindowMessageA +#endif + + WINUSERAPI UINT WINAPI RegisterWindowMessageA(LPCSTR lpString); + WINUSERAPI UINT WINAPI RegisterWindowMessageW(LPCWSTR lpString); + +#define SIZE_RESTORED 0 +#define SIZE_MINIMIZED 1 +#define SIZE_MAXIMIZED 2 +#define SIZE_MAXSHOW 3 +#define SIZE_MAXHIDE 4 + +#define SIZENORMAL SIZE_RESTORED +#define SIZEICONIC SIZE_MINIMIZED +#define SIZEFULLSCREEN SIZE_MAXIMIZED +#define SIZEZOOMSHOW SIZE_MAXSHOW +#define SIZEZOOMHIDE SIZE_MAXHIDE + + typedef struct tagWINDOWPOS { + HWND hwnd; + HWND hwndInsertAfter; + int x; + int y; + int cx; + int cy; + UINT flags; + } WINDOWPOS,*LPWINDOWPOS,*PWINDOWPOS; + + typedef struct tagNCCALCSIZE_PARAMS { + RECT rgrc[3]; + PWINDOWPOS lppos; + } NCCALCSIZE_PARAMS,*LPNCCALCSIZE_PARAMS; + +#define WVR_ALIGNTOP 0x0010 +#define WVR_ALIGNLEFT 0x0020 +#define WVR_ALIGNBOTTOM 0x0040 +#define WVR_ALIGNRIGHT 0x0080 +#define WVR_HREDRAW 0x0100 +#define WVR_VREDRAW 0x0200 +#define WVR_REDRAW (WVR_HREDRAW | WVR_VREDRAW) +#define WVR_VALIDRECTS 0x0400 + +#ifndef NOKEYSTATES + +#define MK_LBUTTON 0x0001 +#define MK_RBUTTON 0x0002 +#define MK_SHIFT 0x0004 +#define MK_CONTROL 0x0008 +#define MK_MBUTTON 0x0010 +#define MK_XBUTTON1 0x0020 +#define MK_XBUTTON2 0x0040 +#endif + +#ifndef NOTRACKMOUSEEVENT +#define TME_HOVER 0x00000001 +#define TME_LEAVE 0x00000002 +#define TME_NONCLIENT 0x00000010 +#define TME_QUERY 0x40000000 +#define TME_CANCEL 0x80000000 + +#define HOVER_DEFAULT 0xFFFFFFFF +#endif + + typedef struct tagTRACKMOUSEEVENT { + DWORD cbSize; + DWORD dwFlags; + HWND hwndTrack; + DWORD dwHoverTime; + } TRACKMOUSEEVENT,*LPTRACKMOUSEEVENT; + + WINUSERAPI WINBOOL WINAPI TrackMouseEvent(LPTRACKMOUSEEVENT lpEventTrack); +#endif + +#ifndef NOWINSTYLES + +#define WS_OVERLAPPED 0x00000000L +#define WS_POPUP 0x80000000L +#define WS_CHILD 0x40000000L +#define WS_MINIMIZE 0x20000000L +#define WS_VISIBLE 0x10000000L +#define WS_DISABLED 0x08000000L +#define WS_CLIPSIBLINGS 0x04000000L +#define WS_CLIPCHILDREN 0x02000000L +#define WS_MAXIMIZE 0x01000000L +#define WS_CAPTION 0x00C00000L +#define WS_BORDER 0x00800000L +#define WS_DLGFRAME 0x00400000L +#define WS_VSCROLL 0x00200000L +#define WS_HSCROLL 0x00100000L +#define WS_SYSMENU 0x00080000L +#define WS_THICKFRAME 0x00040000L +#define WS_GROUP 0x00020000L +#define WS_TABSTOP 0x00010000L +#define WS_MINIMIZEBOX 0x00020000L +#define WS_MAXIMIZEBOX 0x00010000L +#define WS_TILED WS_OVERLAPPED +#define WS_ICONIC WS_MINIMIZE +#define WS_SIZEBOX WS_THICKFRAME +#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW +#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX) +#define WS_POPUPWINDOW (WS_POPUP | WS_BORDER | WS_SYSMENU) +#define WS_CHILDWINDOW (WS_CHILD) + +#define WS_EX_DLGMODALFRAME 0x00000001L +#define WS_EX_NOPARENTNOTIFY 0x00000004L +#define WS_EX_TOPMOST 0x00000008L +#define WS_EX_ACCEPTFILES 0x00000010L +#define WS_EX_TRANSPARENT 0x00000020L +#define WS_EX_MDICHILD 0x00000040L +#define WS_EX_TOOLWINDOW 0x00000080L +#define WS_EX_WINDOWEDGE 0x00000100L +#define WS_EX_CLIENTEDGE 0x00000200L +#define WS_EX_CONTEXTHELP 0x00000400L +#define WS_EX_RIGHT 0x00001000L +#define WS_EX_LEFT 0x00000000L +#define WS_EX_RTLREADING 0x00002000L +#define WS_EX_LTRREADING 0x00000000L +#define WS_EX_LEFTSCROLLBAR 0x00004000L +#define WS_EX_RIGHTSCROLLBAR 0x00000000L +#define WS_EX_CONTROLPARENT 0x00010000L +#define WS_EX_STATICEDGE 0x00020000L +#define WS_EX_APPWINDOW 0x00040000L +#define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE) +#define WS_EX_PALETTEWINDOW (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST) +#define WS_EX_LAYERED 0x00080000 +#define WS_EX_NOINHERITLAYOUT 0x00100000L +#define WS_EX_LAYOUTRTL 0x00400000L +#define WS_EX_COMPOSITED 0x02000000L +#define WS_EX_NOACTIVATE 0x08000000L + +#define CS_VREDRAW 0x0001 +#define CS_HREDRAW 0x0002 +#define CS_DBLCLKS 0x0008 +#define CS_OWNDC 0x0020 +#define CS_CLASSDC 0x0040 +#define CS_PARENTDC 0x0080 +#define CS_NOCLOSE 0x0200 +#define CS_SAVEBITS 0x0800 +#define CS_BYTEALIGNCLIENT 0x1000 +#define CS_BYTEALIGNWINDOW 0x2000 +#define CS_GLOBALCLASS 0x4000 +#define CS_IME 0x00010000 +#define CS_DROPSHADOW 0x00020000 +#endif + +#define PRF_CHECKVISIBLE 0x00000001L +#define PRF_NONCLIENT 0x00000002L +#define PRF_CLIENT 0x00000004L +#define PRF_ERASEBKGND 0x00000008L +#define PRF_CHILDREN 0x00000010L +#define PRF_OWNED 0x00000020L + +#define BDR_RAISEDOUTER 0x0001 +#define BDR_SUNKENOUTER 0x0002 +#define BDR_RAISEDINNER 0x0004 +#define BDR_SUNKENINNER 0x0008 + +#define BDR_OUTER (BDR_RAISEDOUTER | BDR_SUNKENOUTER) +#define BDR_INNER (BDR_RAISEDINNER | BDR_SUNKENINNER) +#define BDR_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER) +#define BDR_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER) + +#define EDGE_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER) +#define EDGE_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER) +#define EDGE_ETCHED (BDR_SUNKENOUTER | BDR_RAISEDINNER) +#define EDGE_BUMP (BDR_RAISEDOUTER | BDR_SUNKENINNER) + +#define BF_LEFT 0x0001 +#define BF_TOP 0x0002 +#define BF_RIGHT 0x0004 +#define BF_BOTTOM 0x0008 + +#define BF_TOPLEFT (BF_TOP | BF_LEFT) +#define BF_TOPRIGHT (BF_TOP | BF_RIGHT) +#define BF_BOTTOMLEFT (BF_BOTTOM | BF_LEFT) +#define BF_BOTTOMRIGHT (BF_BOTTOM | BF_RIGHT) +#define BF_RECT (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM) + +#define BF_DIAGONAL 0x0010 + +#define BF_DIAGONAL_ENDTOPRIGHT (BF_DIAGONAL | BF_TOP | BF_RIGHT) +#define BF_DIAGONAL_ENDTOPLEFT (BF_DIAGONAL | BF_TOP | BF_LEFT) +#define BF_DIAGONAL_ENDBOTTOMLEFT (BF_DIAGONAL | BF_BOTTOM | BF_LEFT) +#define BF_DIAGONAL_ENDBOTTOMRIGHT (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT) + +#define BF_MIDDLE 0x0800 +#define BF_SOFT 0x1000 +#define BF_ADJUST 0x2000 +#define BF_FLAT 0x4000 +#define BF_MONO 0x8000 + + WINUSERAPI WINBOOL WINAPI DrawEdge(HDC hdc,LPRECT qrc,UINT edge,UINT grfFlags); + +#define DFC_CAPTION 1 +#define DFC_MENU 2 +#define DFC_SCROLL 3 +#define DFC_BUTTON 4 +#define DFC_POPUPMENU 5 + +#define DFCS_CAPTIONCLOSE 0x0000 +#define DFCS_CAPTIONMIN 0x0001 +#define DFCS_CAPTIONMAX 0x0002 +#define DFCS_CAPTIONRESTORE 0x0003 +#define DFCS_CAPTIONHELP 0x0004 + +#define DFCS_MENUARROW 0x0000 +#define DFCS_MENUCHECK 0x0001 +#define DFCS_MENUBULLET 0x0002 +#define DFCS_MENUARROWRIGHT 0x0004 +#define DFCS_SCROLLUP 0x0000 +#define DFCS_SCROLLDOWN 0x0001 +#define DFCS_SCROLLLEFT 0x0002 +#define DFCS_SCROLLRIGHT 0x0003 +#define DFCS_SCROLLCOMBOBOX 0x0005 +#define DFCS_SCROLLSIZEGRIP 0x0008 +#define DFCS_SCROLLSIZEGRIPRIGHT 0x0010 + +#define DFCS_BUTTONCHECK 0x0000 +#define DFCS_BUTTONRADIOIMAGE 0x0001 +#define DFCS_BUTTONRADIOMASK 0x0002 +#define DFCS_BUTTONRADIO 0x0004 +#define DFCS_BUTTON3STATE 0x0008 +#define DFCS_BUTTONPUSH 0x0010 + +#define DFCS_INACTIVE 0x0100 +#define DFCS_PUSHED 0x0200 +#define DFCS_CHECKED 0x0400 + +#define DFCS_TRANSPARENT 0x0800 +#define DFCS_HOT 0x1000 + +#define DFCS_ADJUSTRECT 0x2000 +#define DFCS_FLAT 0x4000 +#define DFCS_MONO 0x8000 + + WINUSERAPI WINBOOL WINAPI DrawFrameControl(HDC,LPRECT,UINT,UINT); + +#define DC_ACTIVE 0x0001 +#define DC_SMALLCAP 0x0002 +#define DC_ICON 0x0004 +#define DC_TEXT 0x0008 +#define DC_INBUTTON 0x0010 +#define DC_GRADIENT 0x0020 +#define DC_BUTTONS 0x1000 + + WINUSERAPI WINBOOL WINAPI DrawCaption(HWND hwnd,HDC hdc,CONST RECT *lprect,UINT flags); + +#define IDANI_OPEN 1 +#define IDANI_CAPTION 3 + + WINUSERAPI WINBOOL WINAPI DrawAnimatedRects(HWND hwnd,int idAni,CONST RECT *lprcFrom,CONST RECT *lprcTo); + +#ifndef NOCLIPBOARD + +#define CF_TEXT 1 +#define CF_BITMAP 2 +#define CF_METAFILEPICT 3 +#define CF_SYLK 4 +#define CF_DIF 5 +#define CF_TIFF 6 +#define CF_OEMTEXT 7 +#define CF_DIB 8 +#define CF_PALETTE 9 +#define CF_PENDATA 10 +#define CF_RIFF 11 +#define CF_WAVE 12 +#define CF_UNICODETEXT 13 +#define CF_ENHMETAFILE 14 +#define CF_HDROP 15 +#define CF_LOCALE 16 +#define CF_DIBV5 17 +#define CF_MAX 18 + +#define CF_OWNERDISPLAY 0x0080 +#define CF_DSPTEXT 0x0081 +#define CF_DSPBITMAP 0x0082 +#define CF_DSPMETAFILEPICT 0x0083 +#define CF_DSPENHMETAFILE 0x008E + +#define CF_PRIVATEFIRST 0x0200 +#define CF_PRIVATELAST 0x02FF + +#define CF_GDIOBJFIRST 0x0300 +#define CF_GDIOBJLAST 0x03FF +#endif + +#define FVIRTKEY TRUE +#define FNOINVERT 0x02 +#define FSHIFT 0x04 +#define FCONTROL 0x08 +#define FALT 0x10 + + typedef struct tagACCEL { + BYTE fVirt; + WORD key; + WORD cmd; + } ACCEL,*LPACCEL; + + typedef struct tagPAINTSTRUCT { + HDC hdc; + WINBOOL fErase; + RECT rcPaint; + WINBOOL fRestore; + WINBOOL fIncUpdate; + BYTE rgbReserved[32]; + } PAINTSTRUCT,*PPAINTSTRUCT,*NPPAINTSTRUCT,*LPPAINTSTRUCT; + + typedef struct tagCREATESTRUCTA { + LPVOID lpCreateParams; + HINSTANCE hInstance; + HMENU hMenu; + HWND hwndParent; + int cy; + int cx; + int y; + int x; + LONG style; + LPCSTR lpszName; + LPCSTR lpszClass; + DWORD dwExStyle; + } CREATESTRUCTA,*LPCREATESTRUCTA; + + typedef struct tagCREATESTRUCTW { + LPVOID lpCreateParams; + HINSTANCE hInstance; + HMENU hMenu; + HWND hwndParent; + int cy; + int cx; + int y; + int x; + LONG style; + LPCWSTR lpszName; + LPCWSTR lpszClass; + DWORD dwExStyle; + } CREATESTRUCTW,*LPCREATESTRUCTW; + +#ifdef UNICODE + typedef CREATESTRUCTW CREATESTRUCT; + typedef LPCREATESTRUCTW LPCREATESTRUCT; +#else + typedef CREATESTRUCTA CREATESTRUCT; + typedef LPCREATESTRUCTA LPCREATESTRUCT; +#endif + + typedef struct tagWINDOWPLACEMENT { + UINT length; + UINT flags; + UINT showCmd; + POINT ptMinPosition; + POINT ptMaxPosition; + RECT rcNormalPosition; + } WINDOWPLACEMENT; + typedef WINDOWPLACEMENT *PWINDOWPLACEMENT,*LPWINDOWPLACEMENT; + +#define WPF_SETMINPOSITION 0x0001 +#define WPF_RESTORETOMAXIMIZED 0x0002 +#define WPF_ASYNCWINDOWPLACEMENT 0x0004 + + typedef struct tagNMHDR { + HWND hwndFrom; + UINT_PTR idFrom; + UINT code; + } NMHDR; + + typedef NMHDR *LPNMHDR; + + typedef struct tagSTYLESTRUCT { + DWORD styleOld; + DWORD styleNew; + } STYLESTRUCT,*LPSTYLESTRUCT; + +#define ODT_MENU 1 +#define ODT_LISTBOX 2 +#define ODT_COMBOBOX 3 +#define ODT_BUTTON 4 +#define ODT_STATIC 5 + +#define ODA_DRAWENTIRE 0x0001 +#define ODA_SELECT 0x0002 +#define ODA_FOCUS 0x0004 + +#define ODS_SELECTED 0x0001 +#define ODS_GRAYED 0x0002 +#define ODS_DISABLED 0x0004 +#define ODS_CHECKED 0x0008 +#define ODS_FOCUS 0x0010 +#define ODS_DEFAULT 0x0020 +#define ODS_COMBOBOXEDIT 0x1000 +#define ODS_HOTLIGHT 0x0040 +#define ODS_INACTIVE 0x0080 +#define ODS_NOACCEL 0x0100 +#define ODS_NOFOCUSRECT 0x0200 + + typedef struct tagMEASUREITEMSTRUCT { + UINT CtlType; + UINT CtlID; + UINT itemID; + UINT itemWidth; + UINT itemHeight; + ULONG_PTR itemData; + } MEASUREITEMSTRUCT,*PMEASUREITEMSTRUCT,*LPMEASUREITEMSTRUCT; + + typedef struct tagDRAWITEMSTRUCT { + UINT CtlType; + UINT CtlID; + UINT itemID; + UINT itemAction; + UINT itemState; + HWND hwndItem; + HDC hDC; + RECT rcItem; + ULONG_PTR itemData; + } DRAWITEMSTRUCT,*PDRAWITEMSTRUCT,*LPDRAWITEMSTRUCT; + + typedef struct tagDELETEITEMSTRUCT { + UINT CtlType; + UINT CtlID; + UINT itemID; + HWND hwndItem; + ULONG_PTR itemData; + } DELETEITEMSTRUCT,*PDELETEITEMSTRUCT,*LPDELETEITEMSTRUCT; + + typedef struct tagCOMPAREITEMSTRUCT { + UINT CtlType; + UINT CtlID; + HWND hwndItem; + UINT itemID1; + ULONG_PTR itemData1; + UINT itemID2; + ULONG_PTR itemData2; + DWORD dwLocaleId; + } COMPAREITEMSTRUCT,*PCOMPAREITEMSTRUCT,*LPCOMPAREITEMSTRUCT; + +#ifndef NOMSG +#ifdef UNICODE +#define GetMessage GetMessageW +#define DispatchMessage DispatchMessageW +#define PeekMessage PeekMessageW +#else +#define GetMessage GetMessageA +#define DispatchMessage DispatchMessageA +#define PeekMessage PeekMessageA +#endif + + WINUSERAPI WINBOOL WINAPI GetMessageA(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax); + WINUSERAPI WINBOOL WINAPI GetMessageW(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax); + WINUSERAPI WINBOOL WINAPI TranslateMessage(CONST MSG *lpMsg); + WINUSERAPI LRESULT WINAPI DispatchMessageA(CONST MSG *lpMsg); + WINUSERAPI LRESULT WINAPI DispatchMessageW(CONST MSG *lpMsg); + WINUSERAPI WINBOOL WINAPI SetMessageQueue(int cMessagesMax); + WINUSERAPI WINBOOL WINAPI PeekMessageA(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax,UINT wRemoveMsg); + WINUSERAPI WINBOOL WINAPI PeekMessageW(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax,UINT wRemoveMsg); + +#define PM_NOREMOVE 0x0000 +#define PM_REMOVE 0x0001 +#define PM_NOYIELD 0x0002 +#define PM_QS_INPUT (QS_INPUT << 16) +#define PM_QS_POSTMESSAGE ((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16) +#define PM_QS_PAINT (QS_PAINT << 16) +#define PM_QS_SENDMESSAGE (QS_SENDMESSAGE << 16) +#endif + + WINUSERAPI WINBOOL WINAPI RegisterHotKey(HWND hWnd,int id,UINT fsModifiers,UINT vk); + WINUSERAPI WINBOOL WINAPI UnregisterHotKey(HWND hWnd,int id); + +#define MOD_ALT 0x0001 +#define MOD_CONTROL 0x0002 +#define MOD_SHIFT 0x0004 +#define MOD_WIN 0x0008 + +#define IDHOT_SNAPWINDOW (-1) +#define IDHOT_SNAPDESKTOP (-2) + +#ifdef WIN_INTERNAL +#ifndef LSTRING +#define NOLSTRING +#endif +#ifndef LFILEIO +#define NOLFILEIO +#endif +#endif + +#define ENDSESSION_LOGOFF 0x80000000 + +#define EWX_LOGOFF 0 +#define EWX_SHUTDOWN 0x00000001 +#define EWX_REBOOT 0x00000002 +#define EWX_FORCE 0x00000004 +#define EWX_POWEROFF 0x00000008 +#define EWX_FORCEIFHUNG 0x00000010 + +#define ExitWindows(dwReserved,Code) ExitWindowsEx(EWX_LOGOFF,0xFFFFFFFF) + +#ifdef UNICODE +#define SendMessage SendMessageW +#define SendMessageTimeout SendMessageTimeoutW +#define SendNotifyMessage SendNotifyMessageW +#define SendMessageCallback SendMessageCallbackW +#else +#define SendMessage SendMessageA +#define SendMessageTimeout SendMessageTimeoutA +#define SendNotifyMessage SendNotifyMessageA +#define SendMessageCallback SendMessageCallbackA +#endif + + WINUSERAPI WINBOOL WINAPI ExitWindowsEx(UINT uFlags,DWORD dwReason); + WINUSERAPI WINBOOL WINAPI SwapMouseButton(WINBOOL fSwap); + WINUSERAPI DWORD WINAPI GetMessagePos(VOID); + WINUSERAPI LONG WINAPI GetMessageTime(VOID); + WINUSERAPI LPARAM WINAPI GetMessageExtraInfo(VOID); + WINUSERAPI WINBOOL WINAPI IsWow64Message(VOID); + WINUSERAPI LPARAM WINAPI SetMessageExtraInfo(LPARAM lParam); + WINUSERAPI LRESULT WINAPI SendMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI SendMessageW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI SendMessageTimeoutA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,UINT fuFlags,UINT uTimeout,PDWORD_PTR lpdwResult); + WINUSERAPI LRESULT WINAPI SendMessageTimeoutW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,UINT fuFlags,UINT uTimeout,PDWORD_PTR lpdwResult); + WINUSERAPI WINBOOL WINAPI SendNotifyMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI SendNotifyMessageW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI SendMessageCallbackA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,SENDASYNCPROC lpResultCallBack,ULONG_PTR dwData); + WINUSERAPI WINBOOL WINAPI SendMessageCallbackW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,SENDASYNCPROC lpResultCallBack,ULONG_PTR dwData); + + typedef struct { + UINT cbSize; + HDESK hdesk; + HWND hwnd; + LUID luid; + } BSMINFO,*PBSMINFO; + +#ifdef UNICODE +#define BroadcastSystemMessageEx BroadcastSystemMessageExW +#define BroadcastSystemMessage BroadcastSystemMessageW +#else +#define BroadcastSystemMessageEx BroadcastSystemMessageExA +#define BroadcastSystemMessage BroadcastSystemMessageA +#endif + + WINUSERAPI long WINAPI BroadcastSystemMessageExA(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam,PBSMINFO pbsmInfo); + WINUSERAPI long WINAPI BroadcastSystemMessageExW(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam,PBSMINFO pbsmInfo); + WINUSERAPI long WINAPI BroadcastSystemMessageA(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI long WINAPI BroadcastSystemMessageW(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam); + +#define BSM_ALLCOMPONENTS 0x00000000 +#define BSM_VXDS 0x00000001 +#define BSM_NETDRIVER 0x00000002 +#define BSM_INSTALLABLEDRIVERS 0x00000004 +#define BSM_APPLICATIONS 0x00000008 +#define BSM_ALLDESKTOPS 0x00000010 + +#define BSF_QUERY 0x00000001 +#define BSF_IGNORECURRENTTASK 0x00000002 +#define BSF_FLUSHDISK 0x00000004 +#define BSF_NOHANG 0x00000008 +#define BSF_POSTMESSAGE 0x00000010 +#define BSF_FORCEIFHUNG 0x00000020 +#define BSF_NOTIMEOUTIFNOTHUNG 0x00000040 +#define BSF_ALLOWSFW 0x00000080 +#define BSF_SENDNOTIFYMESSAGE 0x00000100 +#define BSF_RETURNHDESK 0x00000200 +#define BSF_LUID 0x00000400 + +#define BROADCAST_QUERY_DENY 0x424D5144 + + typedef PVOID HDEVNOTIFY; + typedef HDEVNOTIFY *PHDEVNOTIFY; + +#define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000 +#define DEVICE_NOTIFY_SERVICE_HANDLE 0x00000001 +#define DEVICE_NOTIFY_ALL_INTERFACE_CLASSES 0x00000004 + +#ifdef UNICODE +#define RegisterDeviceNotification RegisterDeviceNotificationW +#define PostMessage PostMessageW +#define PostThreadMessage PostThreadMessageW +#define PostAppMessage PostAppMessageW +#define DefWindowProc DefWindowProcW +#define CallWindowProc CallWindowProcW +#define RegisterClass RegisterClassW +#define UnregisterClass UnregisterClassW +#define GetClassInfo GetClassInfoW +#define RegisterClassEx RegisterClassExW +#define GetClassInfoEx GetClassInfoExW +#else +#define RegisterDeviceNotification RegisterDeviceNotificationA +#define PostMessage PostMessageA +#define PostThreadMessage PostThreadMessageA +#define PostAppMessage PostAppMessageA +#define DefWindowProc DefWindowProcA +#define CallWindowProc CallWindowProcA +#define RegisterClass RegisterClassA +#define UnregisterClass UnregisterClassA +#define GetClassInfo GetClassInfoA +#define RegisterClassEx RegisterClassExA +#define GetClassInfoEx GetClassInfoExA +#endif + + WINUSERAPI HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE hRecipient,LPVOID NotificationFilter,DWORD Flags); + WINUSERAPI HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE hRecipient,LPVOID NotificationFilter,DWORD Flags); + WINUSERAPI WINBOOL WINAPI UnregisterDeviceNotification(HDEVNOTIFY Handle); + WINUSERAPI WINBOOL WINAPI PostMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI PostMessageW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI PostThreadMessageA(DWORD idThread,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI PostThreadMessageW(DWORD idThread,UINT Msg,WPARAM wParam,LPARAM lParam); +#define PostAppMessageA(idThread,wMsg,wParam,lParam) PostThreadMessageA((DWORD)idThread,wMsg,wParam,lParam) +#define PostAppMessageW(idThread,wMsg,wParam,lParam) PostThreadMessageW((DWORD)idThread,wMsg,wParam,lParam) + +#define HWND_BROADCAST ((HWND)0xffff) +#define HWND_MESSAGE ((HWND)-3) + + WINUSERAPI WINBOOL WINAPI AttachThreadInput(DWORD idAttach,DWORD idAttachTo,WINBOOL fAttach); + WINUSERAPI WINBOOL WINAPI ReplyMessage(LRESULT lResult); + WINUSERAPI WINBOOL WINAPI WaitMessage(VOID); + WINUSERAPI DWORD WINAPI WaitForInputIdle(HANDLE hProcess,DWORD dwMilliseconds); + WINUSERAPI LRESULT WINAPI DefWindowProcA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefWindowProcW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI VOID WINAPI PostQuitMessage(int nExitCode); + WINUSERAPI LRESULT WINAPI CallWindowProcA(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI CallWindowProcW(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI InSendMessage(VOID); + WINUSERAPI DWORD WINAPI InSendMessageEx(LPVOID lpReserved); + +#define ISMEX_NOSEND 0x00000000 +#define ISMEX_SEND 0x00000001 +#define ISMEX_NOTIFY 0x00000002 +#define ISMEX_CALLBACK 0x00000004 +#define ISMEX_REPLIED 0x00000008 + + WINUSERAPI UINT WINAPI GetDoubleClickTime(VOID); + WINUSERAPI WINBOOL WINAPI SetDoubleClickTime(UINT); + WINUSERAPI ATOM WINAPI RegisterClassA(CONST WNDCLASSA *lpWndClass); + WINUSERAPI ATOM WINAPI RegisterClassW(CONST WNDCLASSW *lpWndClass); + WINUSERAPI WINBOOL WINAPI UnregisterClassA(LPCSTR lpClassName,HINSTANCE hInstance); + WINUSERAPI WINBOOL WINAPI UnregisterClassW(LPCWSTR lpClassName,HINSTANCE hInstance); + WINUSERAPI WINBOOL WINAPI GetClassInfoA(HINSTANCE hInstance,LPCSTR lpClassName,LPWNDCLASSA lpWndClass); + WINUSERAPI WINBOOL WINAPI GetClassInfoW(HINSTANCE hInstance,LPCWSTR lpClassName,LPWNDCLASSW lpWndClass); + WINUSERAPI ATOM WINAPI RegisterClassExA(CONST WNDCLASSEXA *); + WINUSERAPI ATOM WINAPI RegisterClassExW(CONST WNDCLASSEXW *); + WINUSERAPI WINBOOL WINAPI GetClassInfoExA(HINSTANCE hInstance,LPCSTR lpszClass,LPWNDCLASSEXA lpwcx); + WINUSERAPI WINBOOL WINAPI GetClassInfoExW(HINSTANCE hInstance,LPCWSTR lpszClass,LPWNDCLASSEXW lpwcx); + +#define CW_USEDEFAULT ((int)0x80000000) + +#define HWND_DESKTOP ((HWND)0) + + typedef BOOLEAN (WINAPI *PREGISTERCLASSNAMEW)(LPCWSTR); + +#ifdef UNICODE +#define CreateWindowEx CreateWindowExW +#define CreateWindow CreateWindowW +#else +#define CreateWindowEx CreateWindowExA +#define CreateWindow CreateWindowA +#endif + + WINUSERAPI HWND WINAPI CreateWindowExA(DWORD dwExStyle,LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam); + WINUSERAPI HWND WINAPI CreateWindowExW(DWORD dwExStyle,LPCWSTR lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam); +#define CreateWindowA(lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) CreateWindowExA(0L,lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) +#define CreateWindowW(lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) CreateWindowExW(0L,lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) + WINUSERAPI WINBOOL WINAPI IsWindow(HWND hWnd); + WINUSERAPI WINBOOL WINAPI IsMenu(HMENU hMenu); + WINUSERAPI WINBOOL WINAPI IsChild(HWND hWndParent,HWND hWnd); + WINUSERAPI WINBOOL WINAPI DestroyWindow(HWND hWnd); + WINUSERAPI WINBOOL WINAPI ShowWindow(HWND hWnd,int nCmdShow); + WINUSERAPI WINBOOL WINAPI AnimateWindow(HWND hWnd,DWORD dwTime,DWORD dwFlags); + +#if defined(_WINGDI_) && !defined(NOGDI) + WINUSERAPI WINBOOL WINAPI UpdateLayeredWindow(HWND hWnd,HDC hdcDst,POINT *pptDst,SIZE *psize,HDC hdcSrc,POINT *pptSrc,COLORREF crKey,BLENDFUNCTION *pblend,DWORD dwFlags); + + typedef struct tagUPDATELAYEREDWINDOWINFO { + DWORD cbSize; + HDC hdcDst; + POINT CONST *pptDst; + SIZE CONST *psize; + HDC hdcSrc; + POINT CONST *pptSrc; + COLORREF crKey; + BLENDFUNCTION CONST *pblend; + DWORD dwFlags; + RECT CONST *prcDirty; + } UPDATELAYEREDWINDOWINFO,*PUPDATELAYEREDWINDOWINFO; + + WINUSERAPI WINBOOL WINAPI UpdateLayeredWindowIndirect(HWND hWnd,UPDATELAYEREDWINDOWINFO CONST *pULWInfo); + WINUSERAPI WINBOOL WINAPI GetLayeredWindowAttributes(HWND hwnd,COLORREF *pcrKey,BYTE *pbAlpha,DWORD *pdwFlags); + +#define PW_CLIENTONLY 0x00000001 + + WINUSERAPI WINBOOL WINAPI PrintWindow(HWND hwnd,HDC hdcBlt,UINT nFlags); + WINUSERAPI WINBOOL WINAPI SetLayeredWindowAttributes(HWND hwnd,COLORREF crKey,BYTE bAlpha,DWORD dwFlags); + +#define LWA_COLORKEY 0x00000001 +#define LWA_ALPHA 0x00000002 + +#define ULW_COLORKEY 0x00000001 +#define ULW_ALPHA 0x00000002 +#define ULW_OPAQUE 0x00000004 + +#define ULW_EX_NORESIZE 0x00000008 + + WINUSERAPI WINBOOL WINAPI ShowWindowAsync(HWND hWnd,int nCmdShow); + WINUSERAPI WINBOOL WINAPI FlashWindow(HWND hWnd,WINBOOL bInvert); + + typedef struct { + UINT cbSize; + HWND hwnd; + DWORD dwFlags; + UINT uCount; + DWORD dwTimeout; + } FLASHWINFO,*PFLASHWINFO; + + WINUSERAPI WINBOOL WINAPI FlashWindowEx(PFLASHWINFO pfwi); + +#define FLASHW_STOP 0 +#define FLASHW_CAPTION 0x00000001 +#define FLASHW_TRAY 0x00000002 +#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY) +#define FLASHW_TIMER 0x00000004 +#define FLASHW_TIMERNOFG 0x0000000C + + WINUSERAPI WINBOOL WINAPI ShowOwnedPopups(HWND hWnd,WINBOOL fShow); + WINUSERAPI WINBOOL WINAPI OpenIcon(HWND hWnd); + WINUSERAPI WINBOOL WINAPI CloseWindow(HWND hWnd); + WINUSERAPI WINBOOL WINAPI MoveWindow(HWND hWnd,int X,int Y,int nWidth,int nHeight,WINBOOL bRepaint); + WINUSERAPI WINBOOL WINAPI SetWindowPos(HWND hWnd,HWND hWndInsertAfter,int X,int Y,int cx,int cy,UINT uFlags); + WINUSERAPI WINBOOL WINAPI GetWindowPlacement(HWND hWnd,WINDOWPLACEMENT *lpwndpl); + WINUSERAPI WINBOOL WINAPI SetWindowPlacement(HWND hWnd,CONST WINDOWPLACEMENT *lpwndpl); + +#ifndef NODEFERWINDOWPOS + WINUSERAPI HDWP WINAPI BeginDeferWindowPos(int nNumWindows); + WINUSERAPI HDWP WINAPI DeferWindowPos(HDWP hWinPosInfo,HWND hWnd,HWND hWndInsertAfter,int x,int y,int cx,int cy,UINT uFlags); + WINUSERAPI WINBOOL WINAPI EndDeferWindowPos(HDWP hWinPosInfo); +#endif + + WINUSERAPI WINBOOL WINAPI IsWindowVisible(HWND hWnd); + WINUSERAPI WINBOOL WINAPI IsIconic(HWND hWnd); + WINUSERAPI WINBOOL WINAPI AnyPopup(VOID); + WINUSERAPI WINBOOL WINAPI BringWindowToTop(HWND hWnd); + WINUSERAPI WINBOOL WINAPI IsZoomed(HWND hWnd); + +#define SWP_NOSIZE 0x0001 +#define SWP_NOMOVE 0x0002 +#define SWP_NOZORDER 0x0004 +#define SWP_NOREDRAW 0x0008 +#define SWP_NOACTIVATE 0x0010 +#define SWP_FRAMECHANGED 0x0020 +#define SWP_SHOWWINDOW 0x0040 +#define SWP_HIDEWINDOW 0x0080 +#define SWP_NOCOPYBITS 0x0100 +#define SWP_NOOWNERZORDER 0x0200 +#define SWP_NOSENDCHANGING 0x0400 + +#define SWP_DRAWFRAME SWP_FRAMECHANGED +#define SWP_NOREPOSITION SWP_NOOWNERZORDER +#define SWP_DEFERERASE 0x2000 +#define SWP_ASYNCWINDOWPOS 0x4000 + +#define HWND_TOP ((HWND)0) +#define HWND_BOTTOM ((HWND)1) +#define HWND_TOPMOST ((HWND)-1) +#define HWND_NOTOPMOST ((HWND)-2) + +#ifndef NOCTLMGR + +#include + + typedef struct { + DWORD style; + DWORD dwExtendedStyle; + WORD cdit; + short x; + short y; + short cx; + short cy; + } DLGTEMPLATE; + + typedef DLGTEMPLATE *LPDLGTEMPLATEA; + typedef DLGTEMPLATE *LPDLGTEMPLATEW; + +#ifdef UNICODE + typedef LPDLGTEMPLATEW LPDLGTEMPLATE; +#else + typedef LPDLGTEMPLATEA LPDLGTEMPLATE; +#endif + + typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEA; + typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEW; + +#ifdef UNICODE + typedef LPCDLGTEMPLATEW LPCDLGTEMPLATE; +#else + typedef LPCDLGTEMPLATEA LPCDLGTEMPLATE; +#endif + + typedef struct { + DWORD style; + DWORD dwExtendedStyle; + short x; + short y; + short cx; + short cy; + WORD id; + } DLGITEMTEMPLATE; + + typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEA; + typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEW; + +#ifdef UNICODE + typedef PDLGITEMTEMPLATEW PDLGITEMTEMPLATE; +#else + typedef PDLGITEMTEMPLATEA PDLGITEMTEMPLATE; +#endif + + typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEA; + typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEW; + +#ifdef UNICODE + typedef LPDLGITEMTEMPLATEW LPDLGITEMTEMPLATE; +#else + typedef LPDLGITEMTEMPLATEA LPDLGITEMTEMPLATE; +#endif + +#include + +#ifdef UNICODE +#define CreateDialogParam CreateDialogParamW +#define CreateDialogIndirectParam CreateDialogIndirectParamW +#define CreateDialog CreateDialogW +#define CreateDialogIndirect CreateDialogIndirectW +#define DialogBoxParam DialogBoxParamW +#define DialogBoxIndirectParam DialogBoxIndirectParamW +#define DialogBox DialogBoxW +#define DialogBoxIndirect DialogBoxIndirectW +#define SetDlgItemText SetDlgItemTextW +#define GetDlgItemText GetDlgItemTextW +#define SendDlgItemMessage SendDlgItemMessageW +#define DefDlgProc DefDlgProcW +#else +#define CreateDialogParam CreateDialogParamA +#define CreateDialogIndirectParam CreateDialogIndirectParamA +#define CreateDialog CreateDialogA +#define CreateDialogIndirect CreateDialogIndirectA +#define DialogBoxParam DialogBoxParamA +#define DialogBoxIndirectParam DialogBoxIndirectParamA +#define DialogBox DialogBoxA +#define DialogBoxIndirect DialogBoxIndirectA +#define SetDlgItemText SetDlgItemTextA +#define GetDlgItemText GetDlgItemTextA +#define SendDlgItemMessage SendDlgItemMessageA +#define DefDlgProc DefDlgProcA +#endif + + WINUSERAPI HWND WINAPI CreateDialogParamA(HINSTANCE hInstance,LPCSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI HWND WINAPI CreateDialogParamW(HINSTANCE hInstance,LPCWSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI HWND WINAPI CreateDialogIndirectParamA(HINSTANCE hInstance,LPCDLGTEMPLATEA lpTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI HWND WINAPI CreateDialogIndirectParamW(HINSTANCE hInstance,LPCDLGTEMPLATEW lpTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); +#define CreateDialogA(hInstance,lpName,hWndParent,lpDialogFunc) CreateDialogParamA(hInstance,lpName,hWndParent,lpDialogFunc,0L) +#define CreateDialogW(hInstance,lpName,hWndParent,lpDialogFunc) CreateDialogParamW(hInstance,lpName,hWndParent,lpDialogFunc,0L) +#define CreateDialogIndirectA(hInstance,lpTemplate,hWndParent,lpDialogFunc) CreateDialogIndirectParamA(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) +#define CreateDialogIndirectW(hInstance,lpTemplate,hWndParent,lpDialogFunc) CreateDialogIndirectParamW(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) + WINUSERAPI INT_PTR WINAPI DialogBoxParamA(HINSTANCE hInstance,LPCSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI INT_PTR WINAPI DialogBoxParamW(HINSTANCE hInstance,LPCWSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI INT_PTR WINAPI DialogBoxIndirectParamA(HINSTANCE hInstance,LPCDLGTEMPLATEA hDialogTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI INT_PTR WINAPI DialogBoxIndirectParamW(HINSTANCE hInstance,LPCDLGTEMPLATEW hDialogTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); +#define DialogBoxA(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxParamA(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) +#define DialogBoxW(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxParamW(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) +#define DialogBoxIndirectA(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxIndirectParamA(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) +#define DialogBoxIndirectW(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxIndirectParamW(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) + WINUSERAPI WINBOOL WINAPI EndDialog(HWND hDlg,INT_PTR nResult); + WINUSERAPI HWND WINAPI GetDlgItem(HWND hDlg,int nIDDlgItem); + WINUSERAPI WINBOOL WINAPI SetDlgItemInt(HWND hDlg,int nIDDlgItem,UINT uValue,WINBOOL bSigned); + WINUSERAPI UINT WINAPI GetDlgItemInt(HWND hDlg,int nIDDlgItem,WINBOOL *lpTranslated,WINBOOL bSigned); + WINUSERAPI WINBOOL WINAPI SetDlgItemTextA(HWND hDlg,int nIDDlgItem,LPCSTR lpString); + WINUSERAPI WINBOOL WINAPI SetDlgItemTextW(HWND hDlg,int nIDDlgItem,LPCWSTR lpString); + WINUSERAPI UINT WINAPI GetDlgItemTextA(HWND hDlg,int nIDDlgItem,LPSTR lpString,int cchMax); + WINUSERAPI UINT WINAPI GetDlgItemTextW(HWND hDlg,int nIDDlgItem,LPWSTR lpString,int cchMax); + WINUSERAPI WINBOOL WINAPI CheckDlgButton(HWND hDlg,int nIDButton,UINT uCheck); + WINUSERAPI WINBOOL WINAPI CheckRadioButton(HWND hDlg,int nIDFirstButton,int nIDLastButton,int nIDCheckButton); + WINUSERAPI UINT WINAPI IsDlgButtonChecked(HWND hDlg,int nIDButton); + WINUSERAPI LRESULT WINAPI SendDlgItemMessageA(HWND hDlg,int nIDDlgItem,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI SendDlgItemMessageW(HWND hDlg,int nIDDlgItem,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI HWND WINAPI GetNextDlgGroupItem(HWND hDlg,HWND hCtl,WINBOOL bPrevious); + WINUSERAPI HWND WINAPI GetNextDlgTabItem(HWND hDlg,HWND hCtl,WINBOOL bPrevious); + WINUSERAPI int WINAPI GetDlgCtrlID(HWND hWnd); + WINUSERAPI long WINAPI GetDialogBaseUnits(VOID); + WINUSERAPI LRESULT WINAPI DefDlgProcA(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefDlgProcW(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam); + +#define DLGWINDOWEXTRA 30 +#endif + +#ifndef NOMSG + +#ifdef UNICODE +#define CallMsgFilter CallMsgFilterW +#else +#define CallMsgFilter CallMsgFilterA +#endif + + WINUSERAPI WINBOOL WINAPI CallMsgFilterA(LPMSG lpMsg,int nCode); + WINUSERAPI WINBOOL WINAPI CallMsgFilterW(LPMSG lpMsg,int nCode); +#endif + +#ifndef NOCLIPBOARD + +#ifdef UNICODE +#define RegisterClipboardFormat RegisterClipboardFormatW +#define GetClipboardFormatName GetClipboardFormatNameW +#else +#define RegisterClipboardFormat RegisterClipboardFormatA +#define GetClipboardFormatName GetClipboardFormatNameA +#endif + + WINUSERAPI WINBOOL WINAPI OpenClipboard(HWND hWndNewOwner); + WINUSERAPI WINBOOL WINAPI CloseClipboard(VOID); + WINUSERAPI DWORD WINAPI GetClipboardSequenceNumber(VOID); + WINUSERAPI HWND WINAPI GetClipboardOwner(VOID); + WINUSERAPI HWND WINAPI SetClipboardViewer(HWND hWndNewViewer); + WINUSERAPI HWND WINAPI GetClipboardViewer(VOID); + WINUSERAPI WINBOOL WINAPI ChangeClipboardChain(HWND hWndRemove,HWND hWndNewNext); + WINUSERAPI HANDLE WINAPI SetClipboardData(UINT uFormat,HANDLE hMem); + WINUSERAPI HANDLE WINAPI GetClipboardData(UINT uFormat); + WINUSERAPI UINT WINAPI RegisterClipboardFormatA(LPCSTR lpszFormat); + WINUSERAPI UINT WINAPI RegisterClipboardFormatW(LPCWSTR lpszFormat); + WINUSERAPI int WINAPI CountClipboardFormats(VOID); + WINUSERAPI UINT WINAPI EnumClipboardFormats(UINT format); + WINUSERAPI int WINAPI GetClipboardFormatNameA(UINT format,LPSTR lpszFormatName,int cchMaxCount); + WINUSERAPI int WINAPI GetClipboardFormatNameW(UINT format,LPWSTR lpszFormatName,int cchMaxCount); + WINUSERAPI WINBOOL WINAPI EmptyClipboard(VOID); + WINUSERAPI WINBOOL WINAPI IsClipboardFormatAvailable(UINT format); + WINUSERAPI int WINAPI GetPriorityClipboardFormat(UINT *paFormatPriorityList,int cFormats); + WINUSERAPI HWND WINAPI GetOpenClipboardWindow(VOID); +#endif + +#ifdef UNICODE +#define CharToOem CharToOemW +#define OemToChar OemToCharW +#define CharToOemBuff CharToOemBuffW +#define OemToCharBuff OemToCharBuffW +#define CharUpper CharUpperW +#define CharUpperBuff CharUpperBuffW +#define CharLower CharLowerW +#define CharLowerBuff CharLowerBuffW +#define CharNext CharNextW +#define CharPrev CharPrevW +#else +#define CharToOem CharToOemA +#define OemToChar OemToCharA +#define CharToOemBuff CharToOemBuffA +#define OemToCharBuff OemToCharBuffA +#define CharUpper CharUpperA +#define CharUpperBuff CharUpperBuffA +#define CharLower CharLowerA +#define CharLowerBuff CharLowerBuffA +#define CharNext CharNextA +#define CharPrev CharPrevA +#endif + + WINUSERAPI WINBOOL WINAPI CharToOemA(LPCSTR lpszSrc,LPSTR lpszDst); + WINUSERAPI WINBOOL WINAPI CharToOemW(LPCWSTR lpszSrc,LPSTR lpszDst); + WINUSERAPI WINBOOL WINAPI OemToCharA(LPCSTR lpszSrc,LPSTR lpszDst); + WINUSERAPI WINBOOL WINAPI OemToCharW(LPCSTR lpszSrc,LPWSTR lpszDst); + WINUSERAPI WINBOOL WINAPI CharToOemBuffA(LPCSTR lpszSrc,LPSTR lpszDst,DWORD cchDstLength); + WINUSERAPI WINBOOL WINAPI CharToOemBuffW(LPCWSTR lpszSrc,LPSTR lpszDst,DWORD cchDstLength); + WINUSERAPI WINBOOL WINAPI OemToCharBuffA(LPCSTR lpszSrc,LPSTR lpszDst,DWORD cchDstLength); + WINUSERAPI WINBOOL WINAPI OemToCharBuffW(LPCSTR lpszSrc,LPWSTR lpszDst,DWORD cchDstLength); + WINUSERAPI LPSTR WINAPI CharUpperA(LPSTR lpsz); + WINUSERAPI LPWSTR WINAPI CharUpperW(LPWSTR lpsz); + WINUSERAPI DWORD WINAPI CharUpperBuffA(LPSTR lpsz,DWORD cchLength); + WINUSERAPI DWORD WINAPI CharUpperBuffW(LPWSTR lpsz,DWORD cchLength); + WINUSERAPI LPSTR WINAPI CharLowerA(LPSTR lpsz); + WINUSERAPI LPWSTR WINAPI CharLowerW(LPWSTR lpsz); + WINUSERAPI DWORD WINAPI CharLowerBuffA(LPSTR lpsz,DWORD cchLength); + WINUSERAPI DWORD WINAPI CharLowerBuffW(LPWSTR lpsz,DWORD cchLength); + WINUSERAPI LPSTR WINAPI CharNextA(LPCSTR lpsz); + WINUSERAPI LPWSTR WINAPI CharNextW(LPCWSTR lpsz); + WINUSERAPI LPSTR WINAPI CharPrevA(LPCSTR lpszStart,LPCSTR lpszCurrent); + WINUSERAPI LPWSTR WINAPI CharPrevW(LPCWSTR lpszStart,LPCWSTR lpszCurrent); + WINUSERAPI LPSTR WINAPI CharNextExA(WORD CodePage,LPCSTR lpCurrentChar,DWORD dwFlags); + WINUSERAPI LPSTR WINAPI CharPrevExA(WORD CodePage,LPCSTR lpStart,LPCSTR lpCurrentChar,DWORD dwFlags); + +#define AnsiToOem CharToOemA +#define OemToAnsi OemToCharA +#define AnsiToOemBuff CharToOemBuffA +#define OemToAnsiBuff OemToCharBuffA +#define AnsiUpper CharUpperA +#define AnsiUpperBuff CharUpperBuffA +#define AnsiLower CharLowerA +#define AnsiLowerBuff CharLowerBuffA +#define AnsiNext CharNextA +#define AnsiPrev CharPrevA + +#ifndef NOLANGUAGE + +#ifdef UNICODE +#define IsCharAlpha IsCharAlphaW +#define IsCharAlphaNumeric IsCharAlphaNumericW +#define IsCharUpper IsCharUpperW +#define IsCharLower IsCharLowerW +#else +#define IsCharAlpha IsCharAlphaA +#define IsCharAlphaNumeric IsCharAlphaNumericA +#define IsCharUpper IsCharUpperA +#define IsCharLower IsCharLowerA +#endif + + WINUSERAPI WINBOOL WINAPI IsCharAlphaA(CHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharAlphaW(WCHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharAlphaNumericA(CHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharAlphaNumericW(WCHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharUpperA(CHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharUpperW(WCHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharLowerA(CHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharLowerW(WCHAR ch); +#endif + +#ifdef UNICODE +#define GetKeyNameText GetKeyNameTextW +#define VkKeyScan VkKeyScanW +#define VkKeyScanEx VkKeyScanExW +#else +#define GetKeyNameText GetKeyNameTextA +#define VkKeyScan VkKeyScanA +#define VkKeyScanEx VkKeyScanExA +#endif + + WINUSERAPI HWND WINAPI SetFocus(HWND hWnd); + WINUSERAPI HWND WINAPI GetActiveWindow(VOID); + WINUSERAPI HWND WINAPI GetFocus(VOID); + WINUSERAPI UINT WINAPI GetKBCodePage(VOID); + WINUSERAPI SHORT WINAPI GetKeyState(int nVirtKey); + WINUSERAPI SHORT WINAPI GetAsyncKeyState(int vKey); + WINUSERAPI WINBOOL WINAPI GetKeyboardState(PBYTE lpKeyState); + WINUSERAPI WINBOOL WINAPI SetKeyboardState(LPBYTE lpKeyState); + WINUSERAPI int WINAPI GetKeyNameTextA(LONG lParam,LPSTR lpString,int cchSize); + WINUSERAPI int WINAPI GetKeyNameTextW(LONG lParam,LPWSTR lpString,int cchSize); + WINUSERAPI int WINAPI GetKeyboardType(int nTypeFlag); + WINUSERAPI int WINAPI ToAscii(UINT uVirtKey,UINT uScanCode,CONST BYTE *lpKeyState,LPWORD lpChar,UINT uFlags); + WINUSERAPI int WINAPI ToAsciiEx(UINT uVirtKey,UINT uScanCode,CONST BYTE *lpKeyState,LPWORD lpChar,UINT uFlags,HKL dwhkl); + WINUSERAPI int WINAPI ToUnicode(UINT wVirtKey,UINT wScanCode,CONST BYTE *lpKeyState,LPWSTR pwszBuff,int cchBuff,UINT wFlags); + WINUSERAPI DWORD WINAPI OemKeyScan(WORD wOemChar); + WINUSERAPI SHORT WINAPI VkKeyScanA(CHAR ch); + WINUSERAPI SHORT WINAPI VkKeyScanW(WCHAR ch); + WINUSERAPI SHORT WINAPI VkKeyScanExA(CHAR ch,HKL dwhkl); + WINUSERAPI SHORT WINAPI VkKeyScanExW(WCHAR ch,HKL dwhkl); + +#define KEYEVENTF_EXTENDEDKEY 0x0001 +#define KEYEVENTF_KEYUP 0x0002 +#define KEYEVENTF_UNICODE 0x0004 +#define KEYEVENTF_SCANCODE 0x0008 + + WINUSERAPI VOID WINAPI keybd_event(BYTE bVk,BYTE bScan,DWORD dwFlags,ULONG_PTR dwExtraInfo); + +#define MOUSEEVENTF_MOVE 0x0001 +#define MOUSEEVENTF_LEFTDOWN 0x0002 +#define MOUSEEVENTF_LEFTUP 0x0004 +#define MOUSEEVENTF_RIGHTDOWN 0x0008 +#define MOUSEEVENTF_RIGHTUP 0x0010 +#define MOUSEEVENTF_MIDDLEDOWN 0x0020 +#define MOUSEEVENTF_MIDDLEUP 0x0040 +#define MOUSEEVENTF_XDOWN 0x0080 +#define MOUSEEVENTF_XUP 0x0100 +#define MOUSEEVENTF_WHEEL 0x0800 +#define MOUSEEVENTF_VIRTUALDESK 0x4000 +#define MOUSEEVENTF_ABSOLUTE 0x8000 + + WINUSERAPI VOID WINAPI mouse_event(DWORD dwFlags,DWORD dx,DWORD dy,DWORD dwData,ULONG_PTR dwExtraInfo); + + typedef struct tagMOUSEINPUT { + LONG dx; + LONG dy; + DWORD mouseData; + DWORD dwFlags; + DWORD time; + ULONG_PTR dwExtraInfo; + } MOUSEINPUT,*PMOUSEINPUT,*LPMOUSEINPUT; + + typedef struct tagKEYBDINPUT { + WORD wVk; + WORD wScan; + DWORD dwFlags; + DWORD time; + ULONG_PTR dwExtraInfo; + } KEYBDINPUT,*PKEYBDINPUT,*LPKEYBDINPUT; + + typedef struct tagHARDWAREINPUT { + DWORD uMsg; + WORD wParamL; + WORD wParamH; + } HARDWAREINPUT,*PHARDWAREINPUT,*LPHARDWAREINPUT; + +#define INPUT_MOUSE 0 +#define INPUT_KEYBOARD 1 +#define INPUT_HARDWARE 2 + + typedef struct tagINPUT { + DWORD type; + union { + MOUSEINPUT mi; + KEYBDINPUT ki; + HARDWAREINPUT hi; + }; + } INPUT,*PINPUT,*LPINPUT; + + WINUSERAPI UINT WINAPI SendInput(UINT cInputs,LPINPUT pInputs,int cbSize); + + typedef struct tagLASTINPUTINFO { + UINT cbSize; + DWORD dwTime; + } LASTINPUTINFO,*PLASTINPUTINFO; + +#ifdef UNICODE +#define MapVirtualKey MapVirtualKeyW +#define MapVirtualKeyEx MapVirtualKeyExW +#else +#define MapVirtualKey MapVirtualKeyA +#define MapVirtualKeyEx MapVirtualKeyExA +#endif + + WINUSERAPI WINBOOL WINAPI GetLastInputInfo(PLASTINPUTINFO plii); + WINUSERAPI UINT WINAPI MapVirtualKeyA(UINT uCode,UINT uMapType); + WINUSERAPI UINT WINAPI MapVirtualKeyW(UINT uCode,UINT uMapType); + WINUSERAPI UINT WINAPI MapVirtualKeyExA(UINT uCode,UINT uMapType,HKL dwhkl); + WINUSERAPI UINT WINAPI MapVirtualKeyExW(UINT uCode,UINT uMapType,HKL dwhkl); + WINUSERAPI WINBOOL WINAPI GetInputState(VOID); + WINUSERAPI DWORD WINAPI GetQueueStatus(UINT flags); + WINUSERAPI HWND WINAPI GetCapture(VOID); + WINUSERAPI HWND WINAPI SetCapture(HWND hWnd); + WINUSERAPI WINBOOL WINAPI ReleaseCapture(VOID); + WINUSERAPI DWORD WINAPI MsgWaitForMultipleObjects(DWORD nCount,CONST HANDLE *pHandles,WINBOOL fWaitAll,DWORD dwMilliseconds,DWORD dwWakeMask); + WINUSERAPI DWORD WINAPI MsgWaitForMultipleObjectsEx(DWORD nCount,CONST HANDLE *pHandles,DWORD dwMilliseconds,DWORD dwWakeMask,DWORD dwFlags); + +#define MWMO_WAITALL 0x0001 +#define MWMO_ALERTABLE 0x0002 +#define MWMO_INPUTAVAILABLE 0x0004 + +#define QS_KEY 0x0001 +#define QS_MOUSEMOVE 0x0002 +#define QS_MOUSEBUTTON 0x0004 +#define QS_POSTMESSAGE 0x0008 +#define QS_TIMER 0x0010 +#define QS_PAINT 0x0020 +#define QS_SENDMESSAGE 0x0040 +#define QS_HOTKEY 0x0080 +#define QS_ALLPOSTMESSAGE 0x0100 +#define QS_RAWINPUT 0x0400 +#define QS_MOUSE (QS_MOUSEMOVE | QS_MOUSEBUTTON) +#define QS_INPUT (QS_MOUSE | QS_KEY | QS_RAWINPUT) +#define QS_ALLEVENTS (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY) +#define QS_ALLINPUT (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE) + +#define USER_TIMER_MAXIMUM 0x7FFFFFFF +#define USER_TIMER_MINIMUM 0x0000000A + +#ifdef UNICODE +#define LoadAccelerators LoadAcceleratorsW +#define CreateAcceleratorTable CreateAcceleratorTableW +#define CopyAcceleratorTable CopyAcceleratorTableW +#else +#define LoadAccelerators LoadAcceleratorsA +#define CreateAcceleratorTable CreateAcceleratorTableA +#define CopyAcceleratorTable CopyAcceleratorTableA +#endif + + WINUSERAPI UINT_PTR WINAPI SetTimer(HWND hWnd,UINT_PTR nIDEvent,UINT uElapse,TIMERPROC lpTimerFunc); + WINUSERAPI WINBOOL WINAPI KillTimer(HWND hWnd,UINT_PTR uIDEvent); + WINUSERAPI WINBOOL WINAPI IsWindowUnicode(HWND hWnd); + WINUSERAPI WINBOOL WINAPI EnableWindow(HWND hWnd,WINBOOL bEnable); + WINUSERAPI WINBOOL WINAPI IsWindowEnabled(HWND hWnd); + WINUSERAPI HACCEL WINAPI LoadAcceleratorsA(HINSTANCE hInstance,LPCSTR lpTableName); + WINUSERAPI HACCEL WINAPI LoadAcceleratorsW(HINSTANCE hInstance,LPCWSTR lpTableName); + WINUSERAPI HACCEL WINAPI CreateAcceleratorTableA(LPACCEL paccel,int cAccel); + WINUSERAPI HACCEL WINAPI CreateAcceleratorTableW(LPACCEL paccel,int cAccel); + WINUSERAPI WINBOOL WINAPI DestroyAcceleratorTable(HACCEL hAccel); + WINUSERAPI int WINAPI CopyAcceleratorTableA(HACCEL hAccelSrc,LPACCEL lpAccelDst,int cAccelEntries); + WINUSERAPI int WINAPI CopyAcceleratorTableW(HACCEL hAccelSrc,LPACCEL lpAccelDst,int cAccelEntries); + +#ifndef NOMSG + +#ifdef UNICODE +#define TranslateAccelerator TranslateAcceleratorW +#else +#define TranslateAccelerator TranslateAcceleratorA +#endif + + WINUSERAPI int WINAPI TranslateAcceleratorA(HWND hWnd,HACCEL hAccTable,LPMSG lpMsg); + WINUSERAPI int WINAPI TranslateAcceleratorW(HWND hWnd,HACCEL hAccTable,LPMSG lpMsg); +#endif + +#ifndef NOSYSMETRICS + +#define SM_CXSCREEN 0 +#define SM_CYSCREEN 1 +#define SM_CXVSCROLL 2 +#define SM_CYHSCROLL 3 +#define SM_CYCAPTION 4 +#define SM_CXBORDER 5 +#define SM_CYBORDER 6 +#define SM_CXDLGFRAME 7 +#define SM_CYDLGFRAME 8 +#define SM_CYVTHUMB 9 +#define SM_CXHTHUMB 10 +#define SM_CXICON 11 +#define SM_CYICON 12 +#define SM_CXCURSOR 13 +#define SM_CYCURSOR 14 +#define SM_CYMENU 15 +#define SM_CXFULLSCREEN 16 +#define SM_CYFULLSCREEN 17 +#define SM_CYKANJIWINDOW 18 +#define SM_MOUSEPRESENT 19 +#define SM_CYVSCROLL 20 +#define SM_CXHSCROLL 21 +#define SM_DEBUG 22 +#define SM_SWAPBUTTON 23 +#define SM_RESERVED1 24 +#define SM_RESERVED2 25 +#define SM_RESERVED3 26 +#define SM_RESERVED4 27 +#define SM_CXMIN 28 +#define SM_CYMIN 29 +#define SM_CXSIZE 30 +#define SM_CYSIZE 31 +#define SM_CXFRAME 32 +#define SM_CYFRAME 33 +#define SM_CXMINTRACK 34 +#define SM_CYMINTRACK 35 +#define SM_CXDOUBLECLK 36 +#define SM_CYDOUBLECLK 37 +#define SM_CXICONSPACING 38 +#define SM_CYICONSPACING 39 +#define SM_MENUDROPALIGNMENT 40 +#define SM_PENWINDOWS 41 +#define SM_DBCSENABLED 42 +#define SM_CMOUSEBUTTONS 43 + +#define SM_CXFIXEDFRAME SM_CXDLGFRAME +#define SM_CYFIXEDFRAME SM_CYDLGFRAME +#define SM_CXSIZEFRAME SM_CXFRAME +#define SM_CYSIZEFRAME SM_CYFRAME + +#define SM_SECURE 44 +#define SM_CXEDGE 45 +#define SM_CYEDGE 46 +#define SM_CXMINSPACING 47 +#define SM_CYMINSPACING 48 +#define SM_CXSMICON 49 +#define SM_CYSMICON 50 +#define SM_CYSMCAPTION 51 +#define SM_CXSMSIZE 52 +#define SM_CYSMSIZE 53 +#define SM_CXMENUSIZE 54 +#define SM_CYMENUSIZE 55 +#define SM_ARRANGE 56 +#define SM_CXMINIMIZED 57 +#define SM_CYMINIMIZED 58 +#define SM_CXMAXTRACK 59 +#define SM_CYMAXTRACK 60 +#define SM_CXMAXIMIZED 61 +#define SM_CYMAXIMIZED 62 +#define SM_NETWORK 63 +#define SM_CLEANBOOT 67 +#define SM_CXDRAG 68 +#define SM_CYDRAG 69 +#define SM_SHOWSOUNDS 70 +#define SM_CXMENUCHECK 71 +#define SM_CYMENUCHECK 72 +#define SM_SLOWMACHINE 73 +#define SM_MIDEASTENABLED 74 +#define SM_MOUSEWHEELPRESENT 75 +#define SM_XVIRTUALSCREEN 76 +#define SM_YVIRTUALSCREEN 77 +#define SM_CXVIRTUALSCREEN 78 +#define SM_CYVIRTUALSCREEN 79 +#define SM_CMONITORS 80 +#define SM_SAMEDISPLAYFORMAT 81 +#define SM_IMMENABLED 82 +#define SM_CXFOCUSBORDER 83 +#define SM_CYFOCUSBORDER 84 +#define SM_TABLETPC 86 +#define SM_MEDIACENTER 87 +#define SM_STARTER 88 +#define SM_SERVERR2 89 +#define SM_CMETRICS 90 +#define SM_REMOTESESSION 0x1000 +#define SM_SHUTTINGDOWN 0x2000 +#define SM_REMOTECONTROL 0x2001 +#define SM_CARETBLINKINGENABLED 0x2002 + + WINUSERAPI int WINAPI GetSystemMetrics(int nIndex); +#endif + +#ifndef NOMENUS + +#ifdef UNICODE +#define LoadMenu LoadMenuW +#define LoadMenuIndirect LoadMenuIndirectW +#define ChangeMenu ChangeMenuW +#define GetMenuString GetMenuStringW +#define InsertMenu InsertMenuW +#define AppendMenu AppendMenuW +#define ModifyMenu ModifyMenuW +#else +#define LoadMenu LoadMenuA +#define LoadMenuIndirect LoadMenuIndirectA +#define ChangeMenu ChangeMenuA +#define GetMenuString GetMenuStringA +#define InsertMenu InsertMenuA +#define AppendMenu AppendMenuA +#define ModifyMenu ModifyMenuA +#endif + + WINUSERAPI HMENU WINAPI LoadMenuA(HINSTANCE hInstance,LPCSTR lpMenuName); + WINUSERAPI HMENU WINAPI LoadMenuW(HINSTANCE hInstance,LPCWSTR lpMenuName); + WINUSERAPI HMENU WINAPI LoadMenuIndirectA(CONST MENUTEMPLATEA *lpMenuTemplate); + WINUSERAPI HMENU WINAPI LoadMenuIndirectW(CONST MENUTEMPLATEW *lpMenuTemplate); + WINUSERAPI HMENU WINAPI GetMenu(HWND hWnd); + WINUSERAPI WINBOOL WINAPI SetMenu(HWND hWnd,HMENU hMenu); + WINUSERAPI WINBOOL WINAPI ChangeMenuA(HMENU hMenu,UINT cmd,LPCSTR lpszNewItem,UINT cmdInsert,UINT flags); + WINUSERAPI WINBOOL WINAPI ChangeMenuW(HMENU hMenu,UINT cmd,LPCWSTR lpszNewItem,UINT cmdInsert,UINT flags); + WINUSERAPI WINBOOL WINAPI HiliteMenuItem(HWND hWnd,HMENU hMenu,UINT uIDHiliteItem,UINT uHilite); + WINUSERAPI int WINAPI GetMenuStringA(HMENU hMenu,UINT uIDItem,LPSTR lpString,int cchMax,UINT flags); + WINUSERAPI int WINAPI GetMenuStringW(HMENU hMenu,UINT uIDItem,LPWSTR lpString,int cchMax,UINT flags); + WINUSERAPI UINT WINAPI GetMenuState(HMENU hMenu,UINT uId,UINT uFlags); + WINUSERAPI WINBOOL WINAPI DrawMenuBar(HWND hWnd); + +#define PMB_ACTIVE 0x00000001 + + WINUSERAPI HMENU WINAPI GetSystemMenu(HWND hWnd,WINBOOL bRevert); + WINUSERAPI HMENU WINAPI CreateMenu(VOID); + WINUSERAPI HMENU WINAPI CreatePopupMenu(VOID); + WINUSERAPI WINBOOL WINAPI DestroyMenu(HMENU hMenu); + WINUSERAPI DWORD WINAPI CheckMenuItem(HMENU hMenu,UINT uIDCheckItem,UINT uCheck); + WINUSERAPI WINBOOL WINAPI EnableMenuItem(HMENU hMenu,UINT uIDEnableItem,UINT uEnable); + WINUSERAPI HMENU WINAPI GetSubMenu(HMENU hMenu,int nPos); + WINUSERAPI UINT WINAPI GetMenuItemID(HMENU hMenu,int nPos); + WINUSERAPI int WINAPI GetMenuItemCount(HMENU hMenu); + WINUSERAPI WINBOOL WINAPI InsertMenuA(HMENU hMenu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI InsertMenuW(HMENU hMenu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCWSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI AppendMenuA(HMENU hMenu,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI AppendMenuW(HMENU hMenu,UINT uFlags,UINT_PTR uIDNewItem,LPCWSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI ModifyMenuA(HMENU hMnu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI ModifyMenuW(HMENU hMnu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCWSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI RemoveMenu(HMENU hMenu,UINT uPosition,UINT uFlags); + WINUSERAPI WINBOOL WINAPI DeleteMenu(HMENU hMenu,UINT uPosition,UINT uFlags); + WINUSERAPI WINBOOL WINAPI SetMenuItemBitmaps(HMENU hMenu,UINT uPosition,UINT uFlags,HBITMAP hBitmapUnchecked,HBITMAP hBitmapChecked); + WINUSERAPI LONG WINAPI GetMenuCheckMarkDimensions(VOID); + WINUSERAPI WINBOOL WINAPI TrackPopupMenu(HMENU hMenu,UINT uFlags,int x,int y,int nReserved,HWND hWnd,CONST RECT *prcRect); + +#define MNC_IGNORE 0 +#define MNC_CLOSE 1 +#define MNC_EXECUTE 2 +#define MNC_SELECT 3 + + typedef struct tagTPMPARAMS { + UINT cbSize; + RECT rcExclude; + } TPMPARAMS; + + typedef TPMPARAMS *LPTPMPARAMS; + + WINUSERAPI WINBOOL WINAPI TrackPopupMenuEx(HMENU,UINT,int,int,HWND,LPTPMPARAMS); + +#define MNS_NOCHECK 0x80000000 +#define MNS_MODELESS 0x40000000 +#define MNS_DRAGDROP 0x20000000 +#define MNS_AUTODISMISS 0x10000000 +#define MNS_NOTIFYBYPOS 0x08000000 +#define MNS_CHECKORBMP 0x04000000 + +#define MIM_MAXHEIGHT 0x00000001 +#define MIM_BACKGROUND 0x00000002 +#define MIM_HELPID 0x00000004 +#define MIM_MENUDATA 0x00000008 +#define MIM_STYLE 0x00000010 +#define MIM_APPLYTOSUBMENUS 0x80000000 + + typedef struct tagMENUINFO { + DWORD cbSize; + DWORD fMask; + DWORD dwStyle; + UINT cyMax; + HBRUSH hbrBack; + DWORD dwContextHelpID; + ULONG_PTR dwMenuData; + } MENUINFO,*LPMENUINFO; + + typedef MENUINFO CONST *LPCMENUINFO; + + WINUSERAPI WINBOOL WINAPI GetMenuInfo(HMENU,LPMENUINFO); + WINUSERAPI WINBOOL WINAPI SetMenuInfo(HMENU,LPCMENUINFO); + WINUSERAPI WINBOOL WINAPI EndMenu(VOID); + +#define MND_CONTINUE 0 +#define MND_ENDMENU 1 + + typedef struct tagMENUGETOBJECTINFO { + DWORD dwFlags; + UINT uPos; + HMENU hmenu; + PVOID riid; + PVOID pvObj; + } MENUGETOBJECTINFO,*PMENUGETOBJECTINFO; + +#define MNGOF_TOPGAP 0x00000001 +#define MNGOF_BOTTOMGAP 0x00000002 + +#define MNGO_NOINTERFACE 0x00000000 +#define MNGO_NOERROR 0x00000001 + +#define MIIM_STATE 0x00000001 +#define MIIM_ID 0x00000002 +#define MIIM_SUBMENU 0x00000004 +#define MIIM_CHECKMARKS 0x00000008 +#define MIIM_TYPE 0x00000010 +#define MIIM_DATA 0x00000020 + +#define MIIM_STRING 0x00000040 +#define MIIM_BITMAP 0x00000080 +#define MIIM_FTYPE 0x00000100 + +#define HBMMENU_CALLBACK ((HBITMAP) -1) +#define HBMMENU_SYSTEM ((HBITMAP) 1) +#define HBMMENU_MBAR_RESTORE ((HBITMAP) 2) +#define HBMMENU_MBAR_MINIMIZE ((HBITMAP) 3) +#define HBMMENU_MBAR_CLOSE ((HBITMAP) 5) +#define HBMMENU_MBAR_CLOSE_D ((HBITMAP) 6) +#define HBMMENU_MBAR_MINIMIZE_D ((HBITMAP) 7) +#define HBMMENU_POPUP_CLOSE ((HBITMAP) 8) +#define HBMMENU_POPUP_RESTORE ((HBITMAP) 9) +#define HBMMENU_POPUP_MAXIMIZE ((HBITMAP) 10) +#define HBMMENU_POPUP_MINIMIZE ((HBITMAP) 11) + + typedef struct tagMENUITEMINFOA { + UINT cbSize; + UINT fMask; + UINT fType; + UINT fState; + UINT wID; + HMENU hSubMenu; + HBITMAP hbmpChecked; + HBITMAP hbmpUnchecked; + ULONG_PTR dwItemData; + LPSTR dwTypeData; + UINT cch; + HBITMAP hbmpItem; + } MENUITEMINFOA,*LPMENUITEMINFOA; + + typedef struct tagMENUITEMINFOW { + UINT cbSize; + UINT fMask; + UINT fType; + UINT fState; + UINT wID; + HMENU hSubMenu; + HBITMAP hbmpChecked; + HBITMAP hbmpUnchecked; + ULONG_PTR dwItemData; + LPWSTR dwTypeData; + UINT cch; + HBITMAP hbmpItem; + } MENUITEMINFOW,*LPMENUITEMINFOW; + +#ifdef UNICODE + typedef MENUITEMINFOW MENUITEMINFO; + typedef LPMENUITEMINFOW LPMENUITEMINFO; +#else + typedef MENUITEMINFOA MENUITEMINFO; + typedef LPMENUITEMINFOA LPMENUITEMINFO; +#endif + typedef MENUITEMINFOA CONST *LPCMENUITEMINFOA; + typedef MENUITEMINFOW CONST *LPCMENUITEMINFOW; +#ifdef UNICODE + typedef LPCMENUITEMINFOW LPCMENUITEMINFO; +#else + typedef LPCMENUITEMINFOA LPCMENUITEMINFO; +#endif + +#ifdef UNICODE +#define InsertMenuItem InsertMenuItemW +#define GetMenuItemInfo GetMenuItemInfoW +#define SetMenuItemInfo SetMenuItemInfoW +#else +#define InsertMenuItem InsertMenuItemA +#define GetMenuItemInfo GetMenuItemInfoA +#define SetMenuItemInfo SetMenuItemInfoA +#endif + + WINUSERAPI WINBOOL WINAPI InsertMenuItemA(HMENU hmenu,UINT item,WINBOOL fByPosition,LPCMENUITEMINFOA lpmi); + WINUSERAPI WINBOOL WINAPI InsertMenuItemW(HMENU hmenu,UINT item,WINBOOL fByPosition,LPCMENUITEMINFOW lpmi); + WINUSERAPI WINBOOL WINAPI GetMenuItemInfoA(HMENU hmenu,UINT item,WINBOOL fByPosition,LPMENUITEMINFOA lpmii); + WINUSERAPI WINBOOL WINAPI GetMenuItemInfoW(HMENU hmenu,UINT item,WINBOOL fByPosition,LPMENUITEMINFOW lpmii); + WINUSERAPI WINBOOL WINAPI SetMenuItemInfoA(HMENU hmenu,UINT item,WINBOOL fByPositon,LPCMENUITEMINFOA lpmii); + WINUSERAPI WINBOOL WINAPI SetMenuItemInfoW(HMENU hmenu,UINT item,WINBOOL fByPositon,LPCMENUITEMINFOW lpmii); + +#define GMDI_USEDISABLED 0x0001L +#define GMDI_GOINTOPOPUPS 0x0002L + + WINUSERAPI UINT WINAPI GetMenuDefaultItem(HMENU hMenu,UINT fByPos,UINT gmdiFlags); + WINUSERAPI WINBOOL WINAPI SetMenuDefaultItem(HMENU hMenu,UINT uItem,UINT fByPos); + WINUSERAPI WINBOOL WINAPI GetMenuItemRect(HWND hWnd,HMENU hMenu,UINT uItem,LPRECT lprcItem); + WINUSERAPI int WINAPI MenuItemFromPoint(HWND hWnd,HMENU hMenu,POINT ptScreen); + +#define TPM_LEFTBUTTON 0x0000L +#define TPM_RIGHTBUTTON 0x0002L +#define TPM_LEFTALIGN 0x0000L +#define TPM_CENTERALIGN 0x0004L +#define TPM_RIGHTALIGN 0x0008L +#define TPM_TOPALIGN 0x0000L +#define TPM_VCENTERALIGN 0x0010L +#define TPM_BOTTOMALIGN 0x0020L + +#define TPM_HORIZONTAL 0x0000L +#define TPM_VERTICAL 0x0040L +#define TPM_NONOTIFY 0x0080L +#define TPM_RETURNCMD 0x0100L +#define TPM_RECURSE 0x0001L +#define TPM_HORPOSANIMATION 0x0400L +#define TPM_HORNEGANIMATION 0x0800L +#define TPM_VERPOSANIMATION 0x1000L +#define TPM_VERNEGANIMATION 0x2000L +#define TPM_NOANIMATION 0x4000L +#define TPM_LAYOUTRTL 0x8000L +#endif + + typedef struct tagDROPSTRUCT { + HWND hwndSource; + HWND hwndSink; + DWORD wFmt; + ULONG_PTR dwData; + POINT ptDrop; + DWORD dwControlData; + } DROPSTRUCT,*PDROPSTRUCT,*LPDROPSTRUCT; + +#define DOF_EXECUTABLE 0x8001 +#define DOF_DOCUMENT 0x8002 +#define DOF_DIRECTORY 0x8003 +#define DOF_MULTIPLE 0x8004 +#define DOF_PROGMAN 0x0001 +#define DOF_SHELLDATA 0x0002 + +#define DO_DROPFILE 0x454C4946L +#define DO_PRINTFILE 0x544E5250L + + WINUSERAPI DWORD WINAPI DragObject(HWND hwndParent,HWND hwndFrom,UINT fmt,ULONG_PTR data,HCURSOR hcur); + WINUSERAPI WINBOOL WINAPI DragDetect(HWND hwnd,POINT pt); + WINUSERAPI WINBOOL WINAPI DrawIcon(HDC hDC,int X,int Y,HICON hIcon); + +#ifndef NODRAWTEXT + +#define DT_TOP 0x00000000 +#define DT_LEFT 0x00000000 +#define DT_CENTER 0x00000001 +#define DT_RIGHT 0x00000002 +#define DT_VCENTER 0x00000004 +#define DT_BOTTOM 0x00000008 +#define DT_WORDBREAK 0x00000010 +#define DT_SINGLELINE 0x00000020 +#define DT_EXPANDTABS 0x00000040 +#define DT_TABSTOP 0x00000080 +#define DT_NOCLIP 0x00000100 +#define DT_EXTERNALLEADING 0x00000200 +#define DT_CALCRECT 0x00000400 +#define DT_NOPREFIX 0x00000800 +#define DT_INTERNAL 0x00001000 + +#define DT_EDITCONTROL 0x00002000 +#define DT_PATH_ELLIPSIS 0x00004000 +#define DT_END_ELLIPSIS 0x00008000 +#define DT_MODIFYSTRING 0x00010000 +#define DT_RTLREADING 0x00020000 +#define DT_WORD_ELLIPSIS 0x00040000 +#define DT_NOFULLWIDTHCHARBREAK 0x00080000 +#define DT_HIDEPREFIX 0x00100000 +#define DT_PREFIXONLY 0x00200000 + + typedef struct tagDRAWTEXTPARAMS { + UINT cbSize; + int iTabLength; + int iLeftMargin; + int iRightMargin; + UINT uiLengthDrawn; + } DRAWTEXTPARAMS,*LPDRAWTEXTPARAMS; + +#ifdef UNICODE +#define DrawText DrawTextW +#define DrawTextEx DrawTextExW +#else +#define DrawText DrawTextA +#define DrawTextEx DrawTextExA +#endif + + WINUSERAPI int WINAPI DrawTextA(HDC hdc,LPCSTR lpchText,int cchText,LPRECT lprc,UINT format); + WINUSERAPI int WINAPI DrawTextW(HDC hdc,LPCWSTR lpchText,int cchText,LPRECT lprc,UINT format); + WINUSERAPI int WINAPI DrawTextExA(HDC hdc,LPSTR lpchText,int cchText,LPRECT lprc,UINT format,LPDRAWTEXTPARAMS lpdtp); + WINUSERAPI int WINAPI DrawTextExW(HDC hdc,LPWSTR lpchText,int cchText,LPRECT lprc,UINT format,LPDRAWTEXTPARAMS lpdtp); +#endif + +#ifdef UNICODE +#define GrayString GrayStringW +#define DrawState DrawStateW +#define TabbedTextOut TabbedTextOutW +#define GetTabbedTextExtent GetTabbedTextExtentW +#else +#define GrayString GrayStringA +#define DrawState DrawStateA +#define TabbedTextOut TabbedTextOutA +#define GetTabbedTextExtent GetTabbedTextExtentA +#endif + + WINUSERAPI WINBOOL WINAPI GrayStringA(HDC hDC,HBRUSH hBrush,GRAYSTRINGPROC lpOutputFunc,LPARAM lpData,int nCount,int X,int Y,int nWidth,int nHeight); + WINUSERAPI WINBOOL WINAPI GrayStringW(HDC hDC,HBRUSH hBrush,GRAYSTRINGPROC lpOutputFunc,LPARAM lpData,int nCount,int X,int Y,int nWidth,int nHeight); + +#define DST_COMPLEX 0x0000 +#define DST_TEXT 0x0001 +#define DST_PREFIXTEXT 0x0002 +#define DST_ICON 0x0003 +#define DST_BITMAP 0x0004 + +#define DSS_NORMAL 0x0000 +#define DSS_UNION 0x0010 +#define DSS_DISABLED 0x0020 +#define DSS_MONO 0x0080 +#define DSS_HIDEPREFIX 0x0200 +#define DSS_PREFIXONLY 0x0400 +#define DSS_RIGHT 0x8000 + + WINUSERAPI WINBOOL WINAPI DrawStateA(HDC hdc,HBRUSH hbrFore,DRAWSTATEPROC qfnCallBack,LPARAM lData,WPARAM wData,int x,int y,int cx,int cy,UINT uFlags); + WINUSERAPI WINBOOL WINAPI DrawStateW(HDC hdc,HBRUSH hbrFore,DRAWSTATEPROC qfnCallBack,LPARAM lData,WPARAM wData,int x,int y,int cx,int cy,UINT uFlags); + WINUSERAPI LONG WINAPI TabbedTextOutA(HDC hdc,int x,int y,LPCSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions,int nTabOrigin); + WINUSERAPI LONG WINAPI TabbedTextOutW(HDC hdc,int x,int y,LPCWSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions,int nTabOrigin); + WINUSERAPI DWORD WINAPI GetTabbedTextExtentA(HDC hdc,LPCSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions); + WINUSERAPI DWORD WINAPI GetTabbedTextExtentW(HDC hdc,LPCWSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions); + WINUSERAPI WINBOOL WINAPI UpdateWindow(HWND hWnd); + WINUSERAPI HWND WINAPI SetActiveWindow(HWND hWnd); + WINUSERAPI HWND WINAPI GetForegroundWindow(VOID); + WINUSERAPI WINBOOL WINAPI PaintDesktop(HDC hdc); + WINUSERAPI VOID WINAPI SwitchToThisWindow(HWND hwnd,WINBOOL fUnknown); + WINUSERAPI WINBOOL WINAPI SetForegroundWindow(HWND hWnd); + WINUSERAPI WINBOOL WINAPI AllowSetForegroundWindow(DWORD dwProcessId); + +#define ASFW_ANY ((DWORD)-1) + + WINUSERAPI WINBOOL WINAPI LockSetForegroundWindow(UINT uLockCode); + +#define LSFW_LOCK 1 +#define LSFW_UNLOCK 2 + + WINUSERAPI HWND WINAPI WindowFromDC(HDC hDC); + WINUSERAPI HDC WINAPI GetDC(HWND hWnd); + WINUSERAPI HDC WINAPI GetDCEx(HWND hWnd,HRGN hrgnClip,DWORD flags); + +#define DCX_WINDOW 0x00000001L +#define DCX_CACHE 0x00000002L +#define DCX_NORESETATTRS 0x00000004L +#define DCX_CLIPCHILDREN 0x00000008L +#define DCX_CLIPSIBLINGS 0x00000010L +#define DCX_PARENTCLIP 0x00000020L +#define DCX_EXCLUDERGN 0x00000040L +#define DCX_INTERSECTRGN 0x00000080L +#define DCX_EXCLUDEUPDATE 0x00000100L +#define DCX_INTERSECTUPDATE 0x00000200L +#define DCX_LOCKWINDOWUPDATE 0x00000400L + +#define DCX_VALIDATE 0x00200000L + + WINUSERAPI HDC WINAPI GetWindowDC(HWND hWnd); + WINUSERAPI int WINAPI ReleaseDC(HWND hWnd,HDC hDC); + WINUSERAPI HDC WINAPI BeginPaint(HWND hWnd,LPPAINTSTRUCT lpPaint); + WINUSERAPI WINBOOL WINAPI EndPaint(HWND hWnd,CONST PAINTSTRUCT *lpPaint); + WINUSERAPI WINBOOL WINAPI GetUpdateRect(HWND hWnd,LPRECT lpRect,WINBOOL bErase); + WINUSERAPI int WINAPI GetUpdateRgn(HWND hWnd,HRGN hRgn,WINBOOL bErase); + WINUSERAPI int WINAPI SetWindowRgn(HWND hWnd,HRGN hRgn,WINBOOL bRedraw); + WINUSERAPI int WINAPI GetWindowRgn(HWND hWnd,HRGN hRgn); + WINUSERAPI int WINAPI GetWindowRgnBox(HWND hWnd,LPRECT lprc); + WINUSERAPI int WINAPI ExcludeUpdateRgn(HDC hDC,HWND hWnd); + WINUSERAPI WINBOOL WINAPI InvalidateRect(HWND hWnd,CONST RECT *lpRect,WINBOOL bErase); + WINUSERAPI WINBOOL WINAPI ValidateRect(HWND hWnd,CONST RECT *lpRect); + WINUSERAPI WINBOOL WINAPI InvalidateRgn(HWND hWnd,HRGN hRgn,WINBOOL bErase); + WINUSERAPI WINBOOL WINAPI ValidateRgn(HWND hWnd,HRGN hRgn); + WINUSERAPI WINBOOL WINAPI RedrawWindow(HWND hWnd,CONST RECT *lprcUpdate,HRGN hrgnUpdate,UINT flags); + +#define RDW_INVALIDATE 0x0001 +#define RDW_INTERNALPAINT 0x0002 +#define RDW_ERASE 0x0004 + +#define RDW_VALIDATE 0x0008 +#define RDW_NOINTERNALPAINT 0x0010 +#define RDW_NOERASE 0x0020 + +#define RDW_NOCHILDREN 0x0040 +#define RDW_ALLCHILDREN 0x0080 + +#define RDW_UPDATENOW 0x0100 +#define RDW_ERASENOW 0x0200 + +#define RDW_FRAME 0x0400 +#define RDW_NOFRAME 0x0800 + + WINUSERAPI WINBOOL WINAPI LockWindowUpdate(HWND hWndLock); + WINUSERAPI WINBOOL WINAPI ScrollWindow(HWND hWnd,int XAmount,int YAmount,CONST RECT *lpRect,CONST RECT *lpClipRect); + WINUSERAPI WINBOOL WINAPI ScrollDC(HDC hDC,int dx,int dy,CONST RECT *lprcScroll,CONST RECT *lprcClip,HRGN hrgnUpdate,LPRECT lprcUpdate); + WINUSERAPI int WINAPI ScrollWindowEx(HWND hWnd,int dx,int dy,CONST RECT *prcScroll,CONST RECT *prcClip,HRGN hrgnUpdate,LPRECT prcUpdate,UINT flags); + +#define SW_SCROLLCHILDREN 0x0001 +#define SW_INVALIDATE 0x0002 +#define SW_ERASE 0x0004 +#define SW_SMOOTHSCROLL 0x0010 + +#ifndef NOSCROLL + WINUSERAPI int WINAPI SetScrollPos(HWND hWnd,int nBar,int nPos,WINBOOL bRedraw); + WINUSERAPI int WINAPI GetScrollPos(HWND hWnd,int nBar); + WINUSERAPI WINBOOL WINAPI SetScrollRange(HWND hWnd,int nBar,int nMinPos,int nMaxPos,WINBOOL bRedraw); + WINUSERAPI WINBOOL WINAPI GetScrollRange(HWND hWnd,int nBar,LPINT lpMinPos,LPINT lpMaxPos); + WINUSERAPI WINBOOL WINAPI ShowScrollBar(HWND hWnd,int wBar,WINBOOL bShow); + WINUSERAPI WINBOOL WINAPI EnableScrollBar(HWND hWnd,UINT wSBflags,UINT wArrows); + +#define ESB_ENABLE_BOTH 0x0000 +#define ESB_DISABLE_BOTH 0x0003 + +#define ESB_DISABLE_LEFT 0x0001 +#define ESB_DISABLE_RIGHT 0x0002 + +#define ESB_DISABLE_UP 0x0001 +#define ESB_DISABLE_DOWN 0x0002 + +#define ESB_DISABLE_LTUP ESB_DISABLE_LEFT +#define ESB_DISABLE_RTDN ESB_DISABLE_RIGHT +#endif + +#ifdef UNICODE +#define SetProp SetPropW +#define GetProp GetPropW +#define RemoveProp RemovePropW +#define EnumPropsEx EnumPropsExW +#define EnumProps EnumPropsW +#define SetWindowText SetWindowTextW +#define GetWindowText GetWindowTextW +#define GetWindowTextLength GetWindowTextLengthW +#else +#define SetProp SetPropA +#define GetProp GetPropA +#define RemoveProp RemovePropA +#define EnumPropsEx EnumPropsExA +#define EnumProps EnumPropsA +#define SetWindowText SetWindowTextA +#define GetWindowText GetWindowTextA +#define GetWindowTextLength GetWindowTextLengthA +#endif + + WINUSERAPI WINBOOL WINAPI SetPropA(HWND hWnd,LPCSTR lpString,HANDLE hData); + WINUSERAPI WINBOOL WINAPI SetPropW(HWND hWnd,LPCWSTR lpString,HANDLE hData); + WINUSERAPI HANDLE WINAPI GetPropA(HWND hWnd,LPCSTR lpString); + WINUSERAPI HANDLE WINAPI GetPropW(HWND hWnd,LPCWSTR lpString); + WINUSERAPI HANDLE WINAPI RemovePropA(HWND hWnd,LPCSTR lpString); + WINUSERAPI HANDLE WINAPI RemovePropW(HWND hWnd,LPCWSTR lpString); + WINUSERAPI int WINAPI EnumPropsExA(HWND hWnd,PROPENUMPROCEXA lpEnumFunc,LPARAM lParam); + WINUSERAPI int WINAPI EnumPropsExW(HWND hWnd,PROPENUMPROCEXW lpEnumFunc,LPARAM lParam); + WINUSERAPI int WINAPI EnumPropsA(HWND hWnd,PROPENUMPROCA lpEnumFunc); + WINUSERAPI int WINAPI EnumPropsW(HWND hWnd,PROPENUMPROCW lpEnumFunc); + WINUSERAPI WINBOOL WINAPI SetWindowTextA(HWND hWnd,LPCSTR lpString); + WINUSERAPI WINBOOL WINAPI SetWindowTextW(HWND hWnd,LPCWSTR lpString); + WINUSERAPI int WINAPI GetWindowTextA(HWND hWnd,LPSTR lpString,int nMaxCount); + WINUSERAPI int WINAPI GetWindowTextW(HWND hWnd,LPWSTR lpString,int nMaxCount); + WINUSERAPI int WINAPI GetWindowTextLengthA(HWND hWnd); + WINUSERAPI int WINAPI GetWindowTextLengthW(HWND hWnd); + WINUSERAPI WINBOOL WINAPI GetClientRect(HWND hWnd,LPRECT lpRect); + WINUSERAPI WINBOOL WINAPI GetWindowRect(HWND hWnd,LPRECT lpRect); + WINUSERAPI WINBOOL WINAPI AdjustWindowRect(LPRECT lpRect,DWORD dwStyle,WINBOOL bMenu); + WINUSERAPI WINBOOL WINAPI AdjustWindowRectEx(LPRECT lpRect,DWORD dwStyle,WINBOOL bMenu,DWORD dwExStyle); + +#define HELPINFO_WINDOW 0x0001 +#define HELPINFO_MENUITEM 0x0002 + + typedef struct tagHELPINFO { + UINT cbSize; + int iContextType; + int iCtrlId; + HANDLE hItemHandle; + DWORD_PTR dwContextId; + POINT MousePos; + } HELPINFO,*LPHELPINFO; + + WINUSERAPI WINBOOL WINAPI SetWindowContextHelpId(HWND,DWORD); + WINUSERAPI DWORD WINAPI GetWindowContextHelpId(HWND); + WINUSERAPI WINBOOL WINAPI SetMenuContextHelpId(HMENU,DWORD); + WINUSERAPI DWORD WINAPI GetMenuContextHelpId(HMENU); + +#ifndef NOMB + +#define MB_OK 0x00000000L +#define MB_OKCANCEL 0x00000001L +#define MB_ABORTRETRYIGNORE 0x00000002L +#define MB_YESNOCANCEL 0x00000003L +#define MB_YESNO 0x00000004L +#define MB_RETRYCANCEL 0x00000005L +#define MB_CANCELTRYCONTINUE 0x00000006L +#define MB_ICONHAND 0x00000010L +#define MB_ICONQUESTION 0x00000020L +#define MB_ICONEXCLAMATION 0x00000030L +#define MB_ICONASTERISK 0x00000040L +#define MB_USERICON 0x00000080L +#define MB_ICONWARNING MB_ICONEXCLAMATION +#define MB_ICONERROR MB_ICONHAND +#define MB_ICONINFORMATION MB_ICONASTERISK +#define MB_ICONSTOP MB_ICONHAND +#define MB_DEFBUTTON1 0x00000000L +#define MB_DEFBUTTON2 0x00000100L +#define MB_DEFBUTTON3 0x00000200L +#define MB_DEFBUTTON4 0x00000300L +#define MB_APPLMODAL 0x00000000L +#define MB_SYSTEMMODAL 0x00001000L +#define MB_TASKMODAL 0x00002000L +#define MB_HELP 0x00004000L +#define MB_NOFOCUS 0x00008000L +#define MB_SETFOREGROUND 0x00010000L +#define MB_DEFAULT_DESKTOP_ONLY 0x00020000L +#define MB_TOPMOST 0x00040000L +#define MB_RIGHT 0x00080000L +#define MB_RTLREADING 0x00100000L +#define MB_SERVICE_NOTIFICATION 0x00200000L +#define MB_SERVICE_NOTIFICATION_NT3X 0x00040000L +#define MB_TYPEMASK 0x0000000FL +#define MB_ICONMASK 0x000000F0L +#define MB_DEFMASK 0x00000F00L +#define MB_MODEMASK 0x00003000L +#define MB_MISCMASK 0x0000C000L + +#ifdef UNICODE +#define MessageBox MessageBoxW +#define MessageBoxEx MessageBoxExW +#else +#define MessageBox MessageBoxA +#define MessageBoxEx MessageBoxExA +#endif + + WINUSERAPI int WINAPI MessageBoxA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType); + WINUSERAPI int WINAPI MessageBoxW(HWND hWnd,LPCWSTR lpText,LPCWSTR lpCaption,UINT uType); + WINUSERAPI int WINAPI MessageBoxExA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType,WORD wLanguageId); + WINUSERAPI int WINAPI MessageBoxExW(HWND hWnd,LPCWSTR lpText,LPCWSTR lpCaption,UINT uType,WORD wLanguageId); + + typedef VOID (CALLBACK *MSGBOXCALLBACK)(LPHELPINFO lpHelpInfo); + + typedef struct tagMSGBOXPARAMSA { + UINT cbSize; + HWND hwndOwner; + HINSTANCE hInstance; + LPCSTR lpszText; + LPCSTR lpszCaption; + DWORD dwStyle; + LPCSTR lpszIcon; + DWORD_PTR dwContextHelpId; + MSGBOXCALLBACK lpfnMsgBoxCallback; + DWORD dwLanguageId; + } MSGBOXPARAMSA,*PMSGBOXPARAMSA,*LPMSGBOXPARAMSA; + + typedef struct tagMSGBOXPARAMSW { + UINT cbSize; + HWND hwndOwner; + HINSTANCE hInstance; + LPCWSTR lpszText; + LPCWSTR lpszCaption; + DWORD dwStyle; + LPCWSTR lpszIcon; + DWORD_PTR dwContextHelpId; + MSGBOXCALLBACK lpfnMsgBoxCallback; + DWORD dwLanguageId; + } MSGBOXPARAMSW,*PMSGBOXPARAMSW,*LPMSGBOXPARAMSW; + +#ifdef UNICODE + typedef MSGBOXPARAMSW MSGBOXPARAMS; + typedef PMSGBOXPARAMSW PMSGBOXPARAMS; + typedef LPMSGBOXPARAMSW LPMSGBOXPARAMS; +#else + typedef MSGBOXPARAMSA MSGBOXPARAMS; + typedef PMSGBOXPARAMSA PMSGBOXPARAMS; + typedef LPMSGBOXPARAMSA LPMSGBOXPARAMS; +#endif + +#ifdef UNICODE +#define MessageBoxIndirect MessageBoxIndirectW +#else +#define MessageBoxIndirect MessageBoxIndirectA +#endif + + WINUSERAPI int WINAPI MessageBoxIndirectA(CONST MSGBOXPARAMSA *lpmbp); + WINUSERAPI int WINAPI MessageBoxIndirectW(CONST MSGBOXPARAMSW *lpmbp); + WINUSERAPI WINBOOL WINAPI MessageBeep(UINT uType); +#endif + + WINUSERAPI int WINAPI ShowCursor(WINBOOL bShow); + WINUSERAPI WINBOOL WINAPI SetCursorPos(int X,int Y); + WINUSERAPI HCURSOR WINAPI SetCursor(HCURSOR hCursor); + WINUSERAPI WINBOOL WINAPI GetCursorPos(LPPOINT lpPoint); + WINUSERAPI WINBOOL WINAPI ClipCursor(CONST RECT *lpRect); + WINUSERAPI WINBOOL WINAPI GetClipCursor(LPRECT lpRect); + WINUSERAPI HCURSOR WINAPI GetCursor(VOID); + WINUSERAPI WINBOOL WINAPI CreateCaret(HWND hWnd,HBITMAP hBitmap,int nWidth,int nHeight); + WINUSERAPI UINT WINAPI GetCaretBlinkTime(VOID); + WINUSERAPI WINBOOL WINAPI SetCaretBlinkTime(UINT uMSeconds); + WINUSERAPI WINBOOL WINAPI DestroyCaret(VOID); + WINUSERAPI WINBOOL WINAPI HideCaret(HWND hWnd); + WINUSERAPI WINBOOL WINAPI ShowCaret(HWND hWnd); + WINUSERAPI WINBOOL WINAPI SetCaretPos(int X,int Y); + WINUSERAPI WINBOOL WINAPI GetCaretPos(LPPOINT lpPoint); + WINUSERAPI WINBOOL WINAPI ClientToScreen(HWND hWnd,LPPOINT lpPoint); + WINUSERAPI WINBOOL WINAPI ScreenToClient(HWND hWnd,LPPOINT lpPoint); + WINUSERAPI int WINAPI MapWindowPoints(HWND hWndFrom,HWND hWndTo,LPPOINT lpPoints,UINT cPoints); + WINUSERAPI HWND WINAPI WindowFromPoint(POINT Point); + WINUSERAPI HWND WINAPI ChildWindowFromPoint(HWND hWndParent,POINT Point); + +#define CWP_ALL 0x0000 +#define CWP_SKIPINVISIBLE 0x0001 +#define CWP_SKIPDISABLED 0x0002 +#define CWP_SKIPTRANSPARENT 0x0004 + + WINUSERAPI HWND WINAPI ChildWindowFromPointEx(HWND hwnd,POINT pt,UINT flags); + +#ifndef NOCOLOR + +#define CTLCOLOR_MSGBOX 0 +#define CTLCOLOR_EDIT 1 +#define CTLCOLOR_LISTBOX 2 +#define CTLCOLOR_BTN 3 +#define CTLCOLOR_DLG 4 +#define CTLCOLOR_SCROLLBAR 5 +#define CTLCOLOR_STATIC 6 +#define CTLCOLOR_MAX 7 + +#define COLOR_SCROLLBAR 0 +#define COLOR_BACKGROUND 1 +#define COLOR_ACTIVECAPTION 2 +#define COLOR_INACTIVECAPTION 3 +#define COLOR_MENU 4 +#define COLOR_WINDOW 5 +#define COLOR_WINDOWFRAME 6 +#define COLOR_MENUTEXT 7 +#define COLOR_WINDOWTEXT 8 +#define COLOR_CAPTIONTEXT 9 +#define COLOR_ACTIVEBORDER 10 +#define COLOR_INACTIVEBORDER 11 +#define COLOR_APPWORKSPACE 12 +#define COLOR_HIGHLIGHT 13 +#define COLOR_HIGHLIGHTTEXT 14 +#define COLOR_BTNFACE 15 +#define COLOR_BTNSHADOW 16 +#define COLOR_GRAYTEXT 17 +#define COLOR_BTNTEXT 18 +#define COLOR_INACTIVECAPTIONTEXT 19 +#define COLOR_BTNHIGHLIGHT 20 + +#define COLOR_3DDKSHADOW 21 +#define COLOR_3DLIGHT 22 +#define COLOR_INFOTEXT 23 +#define COLOR_INFOBK 24 + +#define COLOR_HOTLIGHT 26 +#define COLOR_GRADIENTACTIVECAPTION 27 +#define COLOR_GRADIENTINACTIVECAPTION 28 +#define COLOR_MENUHILIGHT 29 +#define COLOR_MENUBAR 30 + +#define COLOR_DESKTOP COLOR_BACKGROUND +#define COLOR_3DFACE COLOR_BTNFACE +#define COLOR_3DSHADOW COLOR_BTNSHADOW +#define COLOR_3DHIGHLIGHT COLOR_BTNHIGHLIGHT +#define COLOR_3DHILIGHT COLOR_BTNHIGHLIGHT +#define COLOR_BTNHILIGHT COLOR_BTNHIGHLIGHT + + WINUSERAPI DWORD WINAPI GetSysColor(int nIndex); + WINUSERAPI HBRUSH WINAPI GetSysColorBrush(int nIndex); + WINUSERAPI WINBOOL WINAPI SetSysColors(int cElements,CONST INT *lpaElements,CONST COLORREF *lpaRgbValues); +#endif + + WINUSERAPI WINBOOL WINAPI DrawFocusRect(HDC hDC,CONST RECT *lprc); + WINUSERAPI int WINAPI FillRect(HDC hDC,CONST RECT *lprc,HBRUSH hbr); + WINUSERAPI int WINAPI FrameRect(HDC hDC,CONST RECT *lprc,HBRUSH hbr); + WINUSERAPI WINBOOL WINAPI InvertRect(HDC hDC,CONST RECT *lprc); + WINUSERAPI WINBOOL WINAPI SetRect(LPRECT lprc,int xLeft,int yTop,int xRight,int yBottom); + WINUSERAPI WINBOOL WINAPI SetRectEmpty(LPRECT lprc); + WINUSERAPI WINBOOL WINAPI CopyRect(LPRECT lprcDst,CONST RECT *lprcSrc); + WINUSERAPI WINBOOL WINAPI InflateRect(LPRECT lprc,int dx,int dy); + WINUSERAPI WINBOOL WINAPI IntersectRect(LPRECT lprcDst,CONST RECT *lprcSrc1,CONST RECT *lprcSrc2); + WINUSERAPI WINBOOL WINAPI UnionRect(LPRECT lprcDst,CONST RECT *lprcSrc1,CONST RECT *lprcSrc2); + WINUSERAPI WINBOOL WINAPI SubtractRect(LPRECT lprcDst,CONST RECT *lprcSrc1,CONST RECT *lprcSrc2); + WINUSERAPI WINBOOL WINAPI OffsetRect(LPRECT lprc,int dx,int dy); + WINUSERAPI WINBOOL WINAPI IsRectEmpty(CONST RECT *lprc); + WINUSERAPI WINBOOL WINAPI EqualRect(CONST RECT *lprc1,CONST RECT *lprc2); + WINUSERAPI WINBOOL WINAPI PtInRect(CONST RECT *lprc,POINT pt); + +#ifndef NOWINOFFSETS + +#ifdef UNICODE +#define GetWindowLong GetWindowLongW +#define SetWindowLong SetWindowLongW +#else +#define GetWindowLong GetWindowLongA +#define SetWindowLong SetWindowLongA +#endif + + WINUSERAPI WORD WINAPI GetWindowWord(HWND hWnd,int nIndex); + WINUSERAPI WORD WINAPI SetWindowWord(HWND hWnd,int nIndex,WORD wNewWord); + WINUSERAPI LONG WINAPI GetWindowLongA(HWND hWnd,int nIndex); + WINUSERAPI LONG WINAPI GetWindowLongW(HWND hWnd,int nIndex); + WINUSERAPI LONG WINAPI SetWindowLongA(HWND hWnd,int nIndex,LONG dwNewLong); + WINUSERAPI LONG WINAPI SetWindowLongW(HWND hWnd,int nIndex,LONG dwNewLong); + +#ifdef _WIN64 + +#ifdef UNICODE +#define GetWindowLongPtr GetWindowLongPtrW +#define SetWindowLongPtr SetWindowLongPtrW +#else +#define GetWindowLongPtr GetWindowLongPtrA +#define SetWindowLongPtr SetWindowLongPtrA +#endif + + WINUSERAPI LONG_PTR WINAPI GetWindowLongPtrA(HWND hWnd,int nIndex); + WINUSERAPI LONG_PTR WINAPI GetWindowLongPtrW(HWND hWnd,int nIndex); + WINUSERAPI LONG_PTR WINAPI SetWindowLongPtrA(HWND hWnd,int nIndex,LONG_PTR dwNewLong); + WINUSERAPI LONG_PTR WINAPI SetWindowLongPtrW(HWND hWnd,int nIndex,LONG_PTR dwNewLong); +#else + +#ifdef UNICODE +#define GetWindowLongPtr GetWindowLongPtrW +#define SetWindowLongPtr SetWindowLongPtrW +#else +#define GetWindowLongPtr GetWindowLongPtrA +#define SetWindowLongPtr SetWindowLongPtrA +#endif + +#define GetWindowLongPtrA GetWindowLongA +#define GetWindowLongPtrW GetWindowLongW +#define SetWindowLongPtrA SetWindowLongA +#define SetWindowLongPtrW SetWindowLongW +#endif + +#ifdef UNICODE +#define GetClassLong GetClassLongW +#define SetClassLong SetClassLongW +#else +#define GetClassLong GetClassLongA +#define SetClassLong SetClassLongA +#endif + + WINUSERAPI WORD WINAPI GetClassWord(HWND hWnd,int nIndex); + WINUSERAPI WORD WINAPI SetClassWord(HWND hWnd,int nIndex,WORD wNewWord); + WINUSERAPI DWORD WINAPI GetClassLongA(HWND hWnd,int nIndex); + WINUSERAPI DWORD WINAPI GetClassLongW(HWND hWnd,int nIndex); + WINUSERAPI DWORD WINAPI SetClassLongA(HWND hWnd,int nIndex,LONG dwNewLong); + WINUSERAPI DWORD WINAPI SetClassLongW(HWND hWnd,int nIndex,LONG dwNewLong); + +#ifdef _WIN64 + +#ifdef UNICODE +#define GetClassLongPtr GetClassLongPtrW +#define SetClassLongPtr SetClassLongPtrW +#else +#define GetClassLongPtr GetClassLongPtrA +#define SetClassLongPtr SetClassLongPtrA +#endif + + WINUSERAPI ULONG_PTR WINAPI GetClassLongPtrA(HWND hWnd,int nIndex); + WINUSERAPI ULONG_PTR WINAPI GetClassLongPtrW(HWND hWnd,int nIndex); + WINUSERAPI ULONG_PTR WINAPI SetClassLongPtrA(HWND hWnd,int nIndex,LONG_PTR dwNewLong); + WINUSERAPI ULONG_PTR WINAPI SetClassLongPtrW(HWND hWnd,int nIndex,LONG_PTR dwNewLong); +#else +#ifdef UNICODE +#define GetClassLongPtr GetClassLongPtrW +#define SetClassLongPtr SetClassLongPtrW +#else +#define GetClassLongPtr GetClassLongPtrA +#define SetClassLongPtr SetClassLongPtrA +#endif + +#define GetClassLongPtrA GetClassLongA +#define GetClassLongPtrW GetClassLongW +#define SetClassLongPtrA SetClassLongA +#define SetClassLongPtrW SetClassLongW +#endif +#endif + +#ifdef UNICODE +#define FindWindow FindWindowW +#define FindWindowEx FindWindowExW +#define GetClassName GetClassNameW +#else +#define FindWindow FindWindowA +#define FindWindowEx FindWindowExA +#define GetClassName GetClassNameA +#endif + + WINUSERAPI WINBOOL WINAPI GetProcessDefaultLayout(DWORD *pdwDefaultLayout); + WINUSERAPI WINBOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout); + WINUSERAPI HWND WINAPI GetDesktopWindow(VOID); + WINUSERAPI HWND WINAPI GetParent(HWND hWnd); + WINUSERAPI HWND WINAPI SetParent(HWND hWndChild,HWND hWndNewParent); + WINUSERAPI WINBOOL WINAPI EnumChildWindows(HWND hWndParent,WNDENUMPROC lpEnumFunc,LPARAM lParam); + WINUSERAPI HWND WINAPI FindWindowA(LPCSTR lpClassName,LPCSTR lpWindowName); + WINUSERAPI HWND WINAPI FindWindowW(LPCWSTR lpClassName,LPCWSTR lpWindowName); + WINUSERAPI HWND WINAPI FindWindowExA(HWND hWndParent,HWND hWndChildAfter,LPCSTR lpszClass,LPCSTR lpszWindow); + WINUSERAPI HWND WINAPI FindWindowExW(HWND hWndParent,HWND hWndChildAfter,LPCWSTR lpszClass,LPCWSTR lpszWindow); + WINUSERAPI HWND WINAPI GetShellWindow(VOID); + WINUSERAPI WINBOOL WINAPI RegisterShellHookWindow(HWND hwnd); + WINUSERAPI WINBOOL WINAPI DeregisterShellHookWindow(HWND hwnd); + WINUSERAPI WINBOOL WINAPI EnumWindows(WNDENUMPROC lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI EnumThreadWindows(DWORD dwThreadId,WNDENUMPROC lpfn,LPARAM lParam); + +#define EnumTaskWindows(hTask,lpfn,lParam) EnumThreadWindows(HandleToUlong(hTask),lpfn,lParam) + + WINUSERAPI int WINAPI GetClassNameA(HWND hWnd,LPSTR lpClassName,int nMaxCount); + WINUSERAPI int WINAPI GetClassNameW(HWND hWnd,LPWSTR lpClassName,int nMaxCount); + WINUSERAPI HWND WINAPI GetTopWindow(HWND hWnd); + +#define GetNextWindow(hWnd,wCmd) GetWindow(hWnd,wCmd) +#define GetSysModalWindow() (NULL) +#define SetSysModalWindow(hWnd) (NULL) + + WINUSERAPI DWORD WINAPI GetWindowThreadProcessId(HWND hWnd,LPDWORD lpdwProcessId); + WINUSERAPI WINBOOL WINAPI IsGUIThread(WINBOOL bConvert); + +#define GetWindowTask(hWnd) ((HANDLE)(DWORD_PTR)GetWindowThreadProcessId(hWnd,NULL)) + + WINUSERAPI HWND WINAPI GetLastActivePopup(HWND hWnd); + +#define GW_HWNDFIRST 0 +#define GW_HWNDLAST 1 +#define GW_HWNDNEXT 2 +#define GW_HWNDPREV 3 +#define GW_OWNER 4 +#define GW_CHILD 5 +#define GW_ENABLEDPOPUP 6 +#define GW_MAX 6 + + WINUSERAPI HWND WINAPI GetWindow(HWND hWnd,UINT uCmd); + +#ifndef NOWH + +#ifdef UNICODE +#define SetWindowsHook SetWindowsHookW +#define SetWindowsHookEx SetWindowsHookExW +#else +#define SetWindowsHook SetWindowsHookA +#define SetWindowsHookEx SetWindowsHookExA +#endif + + WINUSERAPI HHOOK WINAPI SetWindowsHookA(int nFilterType,HOOKPROC pfnFilterProc); + WINUSERAPI HHOOK WINAPI SetWindowsHookW(int nFilterType,HOOKPROC pfnFilterProc); + WINUSERAPI WINBOOL WINAPI UnhookWindowsHook(int nCode,HOOKPROC pfnFilterProc); + WINUSERAPI HHOOK WINAPI SetWindowsHookExA(int idHook,HOOKPROC lpfn,HINSTANCE hmod,DWORD dwThreadId); + WINUSERAPI HHOOK WINAPI SetWindowsHookExW(int idHook,HOOKPROC lpfn,HINSTANCE hmod,DWORD dwThreadId); + WINUSERAPI WINBOOL WINAPI UnhookWindowsHookEx(HHOOK hhk); + WINUSERAPI LRESULT WINAPI CallNextHookEx(HHOOK hhk,int nCode,WPARAM wParam,LPARAM lParam); +#define DefHookProc(nCode,wParam,lParam,phhk) CallNextHookEx(*phhk,nCode,wParam,lParam) +#endif + +#ifndef NOMENUS + +#define MF_INSERT 0x00000000L +#define MF_CHANGE 0x00000080L +#define MF_APPEND 0x00000100L +#define MF_DELETE 0x00000200L +#define MF_REMOVE 0x00001000L +#define MF_BYCOMMAND 0x00000000L +#define MF_BYPOSITION 0x00000400L +#define MF_SEPARATOR 0x00000800L +#define MF_ENABLED 0x00000000L +#define MF_GRAYED 0x00000001L +#define MF_DISABLED 0x00000002L +#define MF_UNCHECKED 0x00000000L +#define MF_CHECKED 0x00000008L +#define MF_USECHECKBITMAPS 0x00000200L +#define MF_STRING 0x00000000L +#define MF_BITMAP 0x00000004L +#define MF_OWNERDRAW 0x00000100L +#define MF_POPUP 0x00000010L +#define MF_MENUBARBREAK 0x00000020L +#define MF_MENUBREAK 0x00000040L +#define MF_UNHILITE 0x00000000L +#define MF_HILITE 0x00000080L +#define MF_DEFAULT 0x00001000L +#define MF_SYSMENU 0x00002000L +#define MF_HELP 0x00004000L +#define MF_RIGHTJUSTIFY 0x00004000L +#define MF_MOUSESELECT 0x00008000L +#define MF_END 0x00000080L + +#define MFT_STRING MF_STRING +#define MFT_BITMAP MF_BITMAP +#define MFT_MENUBARBREAK MF_MENUBARBREAK +#define MFT_MENUBREAK MF_MENUBREAK +#define MFT_OWNERDRAW MF_OWNERDRAW +#define MFT_RADIOCHECK 0x00000200L +#define MFT_SEPARATOR MF_SEPARATOR +#define MFT_RIGHTORDER 0x00002000L +#define MFT_RIGHTJUSTIFY MF_RIGHTJUSTIFY + +#define MFS_GRAYED 0x00000003L +#define MFS_DISABLED MFS_GRAYED +#define MFS_CHECKED MF_CHECKED +#define MFS_HILITE MF_HILITE +#define MFS_ENABLED MF_ENABLED +#define MFS_UNCHECKED MF_UNCHECKED +#define MFS_UNHILITE MF_UNHILITE +#define MFS_DEFAULT MF_DEFAULT + + WINUSERAPI WINBOOL WINAPI CheckMenuRadioItem(HMENU hmenu,UINT first,UINT last,UINT check,UINT flags); + + typedef struct { + WORD versionNumber; + WORD offset; + } MENUITEMTEMPLATEHEADER,*PMENUITEMTEMPLATEHEADER; + + typedef struct { + WORD mtOption; + WORD mtID; + WCHAR mtString[1]; + } MENUITEMTEMPLATE,*PMENUITEMTEMPLATE; +#define MF_END 0x00000080L +#endif + +#ifndef NOSYSCOMMANDS + +#define SC_SIZE 0xF000 +#define SC_MOVE 0xF010 +#define SC_MINIMIZE 0xF020 +#define SC_MAXIMIZE 0xF030 +#define SC_NEXTWINDOW 0xF040 +#define SC_PREVWINDOW 0xF050 +#define SC_CLOSE 0xF060 +#define SC_VSCROLL 0xF070 +#define SC_HSCROLL 0xF080 +#define SC_MOUSEMENU 0xF090 +#define SC_KEYMENU 0xF100 +#define SC_ARRANGE 0xF110 +#define SC_RESTORE 0xF120 +#define SC_TASKLIST 0xF130 +#define SC_SCREENSAVE 0xF140 +#define SC_HOTKEY 0xF150 +#define SC_DEFAULT 0xF160 +#define SC_MONITORPOWER 0xF170 +#define SC_CONTEXTHELP 0xF180 +#define SC_SEPARATOR 0xF00F +#define SC_ICON SC_MINIMIZE +#define SC_ZOOM SC_MAXIMIZE +#endif + +#ifdef UNICODE +#define LoadBitmap LoadBitmapW +#define LoadCursor LoadCursorW +#define LoadCursorFromFile LoadCursorFromFileW +#else +#define LoadBitmap LoadBitmapA +#define LoadCursor LoadCursorA +#define LoadCursorFromFile LoadCursorFromFileA +#endif + + WINUSERAPI HBITMAP WINAPI LoadBitmapA(HINSTANCE hInstance,LPCSTR lpBitmapName); + WINUSERAPI HBITMAP WINAPI LoadBitmapW(HINSTANCE hInstance,LPCWSTR lpBitmapName); + WINUSERAPI HCURSOR WINAPI LoadCursorA(HINSTANCE hInstance,LPCSTR lpCursorName); + WINUSERAPI HCURSOR WINAPI LoadCursorW(HINSTANCE hInstance,LPCWSTR lpCursorName); + WINUSERAPI HCURSOR WINAPI LoadCursorFromFileA(LPCSTR lpFileName); + WINUSERAPI HCURSOR WINAPI LoadCursorFromFileW(LPCWSTR lpFileName); + WINUSERAPI HCURSOR WINAPI CreateCursor(HINSTANCE hInst,int xHotSpot,int yHotSpot,int nWidth,int nHeight,CONST VOID *pvANDPlane,CONST VOID *pvXORPlane); + WINUSERAPI WINBOOL WINAPI DestroyCursor(HCURSOR hCursor); + +#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur))) + +#define IDC_ARROW MAKEINTRESOURCE(32512) +#define IDC_IBEAM MAKEINTRESOURCE(32513) +#define IDC_WAIT MAKEINTRESOURCE(32514) +#define IDC_CROSS MAKEINTRESOURCE(32515) +#define IDC_UPARROW MAKEINTRESOURCE(32516) +#define IDC_SIZE MAKEINTRESOURCE(32640) +#define IDC_ICON MAKEINTRESOURCE(32641) +#define IDC_SIZENWSE MAKEINTRESOURCE(32642) +#define IDC_SIZENESW MAKEINTRESOURCE(32643) +#define IDC_SIZEWE MAKEINTRESOURCE(32644) +#define IDC_SIZENS MAKEINTRESOURCE(32645) +#define IDC_SIZEALL MAKEINTRESOURCE(32646) +#define IDC_NO MAKEINTRESOURCE(32648) +#define IDC_HAND MAKEINTRESOURCE(32649) +#define IDC_APPSTARTING MAKEINTRESOURCE(32650) +#define IDC_HELP MAKEINTRESOURCE(32651) + + WINUSERAPI WINBOOL WINAPI SetSystemCursor(HCURSOR hcur,DWORD id); + + typedef struct _ICONINFO { + WINBOOL fIcon; + DWORD xHotspot; + DWORD yHotspot; + HBITMAP hbmMask; + HBITMAP hbmColor; + } ICONINFO; + typedef ICONINFO *PICONINFO; + +#ifdef UNICODE +#define LoadIcon LoadIconW +#define PrivateExtractIcons PrivateExtractIconsW +#else +#define LoadIcon LoadIconA +#define PrivateExtractIcons PrivateExtractIconsA +#endif + + WINUSERAPI HICON WINAPI LoadIconA(HINSTANCE hInstance,LPCSTR lpIconName); + WINUSERAPI HICON WINAPI LoadIconW(HINSTANCE hInstance,LPCWSTR lpIconName); + WINUSERAPI UINT WINAPI PrivateExtractIconsA(LPCSTR szFileName,int nIconIndex,int cxIcon,int cyIcon,HICON *phicon,UINT *piconid,UINT nIcons,UINT flags); + WINUSERAPI UINT WINAPI PrivateExtractIconsW(LPCWSTR szFileName,int nIconIndex,int cxIcon,int cyIcon,HICON *phicon,UINT *piconid,UINT nIcons,UINT flags); + WINUSERAPI HICON WINAPI CreateIcon(HINSTANCE hInstance,int nWidth,int nHeight,BYTE cPlanes,BYTE cBitsPixel,CONST BYTE *lpbANDbits,CONST BYTE *lpbXORbits); + WINUSERAPI WINBOOL WINAPI DestroyIcon(HICON hIcon); + WINUSERAPI int WINAPI LookupIconIdFromDirectory(PBYTE presbits,WINBOOL fIcon); + WINUSERAPI int WINAPI LookupIconIdFromDirectoryEx(PBYTE presbits,WINBOOL fIcon,int cxDesired,int cyDesired,UINT Flags); + WINUSERAPI HICON WINAPI CreateIconFromResource(PBYTE presbits,DWORD dwResSize,WINBOOL fIcon,DWORD dwVer); + WINUSERAPI HICON WINAPI CreateIconFromResourceEx(PBYTE presbits,DWORD dwResSize,WINBOOL fIcon,DWORD dwVer,int cxDesired,int cyDesired,UINT Flags); + + typedef struct tagCURSORSHAPE { + int xHotSpot; + int yHotSpot; + int cx; + int cy; + int cbWidth; + BYTE Planes; + BYTE BitsPixel; + } CURSORSHAPE,*LPCURSORSHAPE; + +#define IMAGE_BITMAP 0 +#define IMAGE_ICON 1 +#define IMAGE_CURSOR 2 +#define IMAGE_ENHMETAFILE 3 + +#define LR_DEFAULTCOLOR 0x0000 +#define LR_MONOCHROME 0x0001 +#define LR_COLOR 0x0002 +#define LR_COPYRETURNORG 0x0004 +#define LR_COPYDELETEORG 0x0008 +#define LR_LOADFROMFILE 0x0010 +#define LR_LOADTRANSPARENT 0x0020 +#define LR_DEFAULTSIZE 0x0040 +#define LR_VGACOLOR 0x0080 +#define LR_LOADMAP3DCOLORS 0x1000 +#define LR_CREATEDIBSECTION 0x2000 +#define LR_COPYFROMRESOURCE 0x4000 +#define LR_SHARED 0x8000 + +#ifdef UNICODE +#define LoadImage LoadImageW +#else +#define LoadImage LoadImageA +#endif + + WINUSERAPI HANDLE WINAPI LoadImageA(HINSTANCE hInst,LPCSTR name,UINT type,int cx,int cy,UINT fuLoad); + WINUSERAPI HANDLE WINAPI LoadImageW(HINSTANCE hInst,LPCWSTR name,UINT type,int cx,int cy,UINT fuLoad); + WINUSERAPI HANDLE WINAPI CopyImage(HANDLE h,UINT type,int cx,int cy,UINT flags); + +#define DI_MASK 0x0001 +#define DI_IMAGE 0x0002 +#define DI_NORMAL 0x0003 +#define DI_COMPAT 0x0004 +#define DI_DEFAULTSIZE 0x0008 +#define DI_NOMIRROR 0x0010 + + WINUSERAPI WINBOOL WINAPI DrawIconEx(HDC hdc,int xLeft,int yTop,HICON hIcon,int cxWidth,int cyWidth,UINT istepIfAniCur,HBRUSH hbrFlickerFreeDraw,UINT diFlags); + WINUSERAPI HICON WINAPI CreateIconIndirect(PICONINFO piconinfo); + WINUSERAPI HICON WINAPI CopyIcon(HICON hIcon); + WINUSERAPI WINBOOL WINAPI GetIconInfo(HICON hIcon,PICONINFO piconinfo); + +#define RES_ICON 1 +#define RES_CURSOR 2 + +#ifdef OEMRESOURCE + +#define OBM_CLOSE 32754 +#define OBM_UPARROW 32753 +#define OBM_DNARROW 32752 +#define OBM_RGARROW 32751 +#define OBM_LFARROW 32750 +#define OBM_REDUCE 32749 +#define OBM_ZOOM 32748 +#define OBM_RESTORE 32747 +#define OBM_REDUCED 32746 +#define OBM_ZOOMD 32745 +#define OBM_RESTORED 32744 +#define OBM_UPARROWD 32743 +#define OBM_DNARROWD 32742 +#define OBM_RGARROWD 32741 +#define OBM_LFARROWD 32740 +#define OBM_MNARROW 32739 +#define OBM_COMBO 32738 +#define OBM_UPARROWI 32737 +#define OBM_DNARROWI 32736 +#define OBM_RGARROWI 32735 +#define OBM_LFARROWI 32734 + +#define OBM_OLD_CLOSE 32767 +#define OBM_SIZE 32766 +#define OBM_OLD_UPARROW 32765 +#define OBM_OLD_DNARROW 32764 +#define OBM_OLD_RGARROW 32763 +#define OBM_OLD_LFARROW 32762 +#define OBM_BTSIZE 32761 +#define OBM_CHECK 32760 +#define OBM_CHECKBOXES 32759 +#define OBM_BTNCORNERS 32758 +#define OBM_OLD_REDUCE 32757 +#define OBM_OLD_ZOOM 32756 +#define OBM_OLD_RESTORE 32755 + +#define OCR_NORMAL 32512 +#define OCR_IBEAM 32513 +#define OCR_WAIT 32514 +#define OCR_CROSS 32515 +#define OCR_UP 32516 +#define OCR_SIZE 32640 +#define OCR_ICON 32641 +#define OCR_SIZENWSE 32642 +#define OCR_SIZENESW 32643 +#define OCR_SIZEWE 32644 +#define OCR_SIZENS 32645 +#define OCR_SIZEALL 32646 +#define OCR_ICOCUR 32647 +#define OCR_NO 32648 +#define OCR_HAND 32649 +#define OCR_APPSTARTING 32650 + +#define OIC_SAMPLE 32512 +#define OIC_HAND 32513 +#define OIC_QUES 32514 +#define OIC_BANG 32515 +#define OIC_NOTE 32516 +#define OIC_WINLOGO 32517 +#define OIC_WARNING OIC_BANG +#define OIC_ERROR OIC_HAND +#define OIC_INFORMATION OIC_NOTE +#endif + +#define ORD_LANGDRIVER 1 + +#ifndef NOICONS + +#ifdef RC_INVOKED +#define IDI_APPLICATION 32512 +#define IDI_HAND 32513 +#define IDI_QUESTION 32514 +#define IDI_EXCLAMATION 32515 +#define IDI_ASTERISK 32516 +#define IDI_WINLOGO 32517 +#else +#define IDI_APPLICATION MAKEINTRESOURCE(32512) +#define IDI_HAND MAKEINTRESOURCE(32513) +#define IDI_QUESTION MAKEINTRESOURCE(32514) +#define IDI_EXCLAMATION MAKEINTRESOURCE(32515) +#define IDI_ASTERISK MAKEINTRESOURCE(32516) +#define IDI_WINLOGO MAKEINTRESOURCE(32517) +#endif + +#define IDI_WARNING IDI_EXCLAMATION +#define IDI_ERROR IDI_HAND +#define IDI_INFORMATION IDI_ASTERISK +#endif + +#ifdef UNICODE +#define LoadString LoadStringW +#else +#define LoadString LoadStringA +#endif + + WINUSERAPI int WINAPI LoadStringA(HINSTANCE hInstance,UINT uID,LPSTR lpBuffer,int cchBufferMax); + WINUSERAPI int WINAPI LoadStringW(HINSTANCE hInstance,UINT uID,LPWSTR lpBuffer,int cchBufferMax); + +#define IDOK 1 +#define IDCANCEL 2 +#define IDABORT 3 +#define IDRETRY 4 +#define IDIGNORE 5 +#define IDYES 6 +#define IDNO 7 +#define IDCLOSE 8 +#define IDHELP 9 +#define IDTRYAGAIN 10 +#define IDCONTINUE 11 + +#ifndef IDTIMEOUT +#define IDTIMEOUT 32000 +#endif + +#ifndef NOCTLMGR + +#ifndef NOWINSTYLES +#define ES_LEFT 0x0000L +#define ES_CENTER 0x0001L +#define ES_RIGHT 0x0002L +#define ES_MULTILINE 0x0004L +#define ES_UPPERCASE 0x0008L +#define ES_LOWERCASE 0x0010L +#define ES_PASSWORD 0x0020L +#define ES_AUTOVSCROLL 0x0040L +#define ES_AUTOHSCROLL 0x0080L +#define ES_NOHIDESEL 0x0100L +#define ES_OEMCONVERT 0x0400L +#define ES_READONLY 0x0800L +#define ES_WANTRETURN 0x1000L +#define ES_NUMBER 0x2000L +#endif + +#define EN_SETFOCUS 0x0100 +#define EN_KILLFOCUS 0x0200 +#define EN_CHANGE 0x0300 +#define EN_UPDATE 0x0400 +#define EN_ERRSPACE 0x0500 +#define EN_MAXTEXT 0x0501 +#define EN_HSCROLL 0x0601 +#define EN_VSCROLL 0x0602 +#define EN_ALIGN_LTR_EC 0x0700 +#define EN_ALIGN_RTL_EC 0x0701 + +#define EC_LEFTMARGIN 0x0001 +#define EC_RIGHTMARGIN 0x0002 +#define EC_USEFONTINFO 0xffff + +#define EMSIS_COMPOSITIONSTRING 0x0001 + +#define EIMES_GETCOMPSTRATONCE 0x0001 +#define EIMES_CANCELCOMPSTRINFOCUS 0x0002 +#define EIMES_COMPLETECOMPSTRKILLFOCUS 0x0004 + +#ifndef NOWINMESSAGES + +#define EM_GETSEL 0x00B0 +#define EM_SETSEL 0x00B1 +#define EM_GETRECT 0x00B2 +#define EM_SETRECT 0x00B3 +#define EM_SETRECTNP 0x00B4 +#define EM_SCROLL 0x00B5 +#define EM_LINESCROLL 0x00B6 +#define EM_SCROLLCARET 0x00B7 +#define EM_GETMODIFY 0x00B8 +#define EM_SETMODIFY 0x00B9 +#define EM_GETLINECOUNT 0x00BA +#define EM_LINEINDEX 0x00BB +#define EM_SETHANDLE 0x00BC +#define EM_GETHANDLE 0x00BD +#define EM_GETTHUMB 0x00BE +#define EM_LINELENGTH 0x00C1 +#define EM_REPLACESEL 0x00C2 +#define EM_GETLINE 0x00C4 +#define EM_LIMITTEXT 0x00C5 +#define EM_CANUNDO 0x00C6 +#define EM_UNDO 0x00C7 +#define EM_FMTLINES 0x00C8 +#define EM_LINEFROMCHAR 0x00C9 +#define EM_SETTABSTOPS 0x00CB +#define EM_SETPASSWORDCHAR 0x00CC +#define EM_EMPTYUNDOBUFFER 0x00CD +#define EM_GETFIRSTVISIBLELINE 0x00CE +#define EM_SETREADONLY 0x00CF +#define EM_SETWORDBREAKPROC 0x00D0 +#define EM_GETWORDBREAKPROC 0x00D1 +#define EM_GETPASSWORDCHAR 0x00D2 +#define EM_SETMARGINS 0x00D3 +#define EM_GETMARGINS 0x00D4 +#define EM_SETLIMITTEXT EM_LIMITTEXT +#define EM_GETLIMITTEXT 0x00D5 +#define EM_POSFROMCHAR 0x00D6 +#define EM_CHARFROMPOS 0x00D7 +#define EM_SETIMESTATUS 0x00D8 +#define EM_GETIMESTATUS 0x00D9 +#endif + +#define WB_LEFT 0 +#define WB_RIGHT 1 +#define WB_ISDELIMITER 2 + +#define BS_PUSHBUTTON 0x00000000L +#define BS_DEFPUSHBUTTON 0x00000001L +#define BS_CHECKBOX 0x00000002L +#define BS_AUTOCHECKBOX 0x00000003L +#define BS_RADIOBUTTON 0x00000004L +#define BS_3STATE 0x00000005L +#define BS_AUTO3STATE 0x00000006L +#define BS_GROUPBOX 0x00000007L +#define BS_USERBUTTON 0x00000008L +#define BS_AUTORADIOBUTTON 0x00000009L +#define BS_PUSHBOX 0x0000000AL +#define BS_OWNERDRAW 0x0000000BL +#define BS_TYPEMASK 0x0000000FL +#define BS_LEFTTEXT 0x00000020L +#define BS_TEXT 0x00000000L +#define BS_ICON 0x00000040L +#define BS_BITMAP 0x00000080L +#define BS_LEFT 0x00000100L +#define BS_RIGHT 0x00000200L +#define BS_CENTER 0x00000300L +#define BS_TOP 0x00000400L +#define BS_BOTTOM 0x00000800L +#define BS_VCENTER 0x00000C00L +#define BS_PUSHLIKE 0x00001000L +#define BS_MULTILINE 0x00002000L +#define BS_NOTIFY 0x00004000L +#define BS_FLAT 0x00008000L +#define BS_RIGHTBUTTON BS_LEFTTEXT + +#define BN_CLICKED 0 +#define BN_PAINT 1 +#define BN_HILITE 2 +#define BN_UNHILITE 3 +#define BN_DISABLE 4 +#define BN_DOUBLECLICKED 5 +#define BN_PUSHED BN_HILITE +#define BN_UNPUSHED BN_UNHILITE +#define BN_DBLCLK BN_DOUBLECLICKED +#define BN_SETFOCUS 6 +#define BN_KILLFOCUS 7 + +#define BM_GETCHECK 0x00F0 +#define BM_SETCHECK 0x00F1 +#define BM_GETSTATE 0x00F2 +#define BM_SETSTATE 0x00F3 +#define BM_SETSTYLE 0x00F4 +#define BM_CLICK 0x00F5 +#define BM_GETIMAGE 0x00F6 +#define BM_SETIMAGE 0x00F7 + +#define BST_UNCHECKED 0x0000 +#define BST_CHECKED 0x0001 +#define BST_INDETERMINATE 0x0002 +#define BST_PUSHED 0x0004 +#define BST_FOCUS 0x0008 + +#define SS_LEFT 0x00000000L +#define SS_CENTER 0x00000001L +#define SS_RIGHT 0x00000002L +#define SS_ICON 0x00000003L +#define SS_BLACKRECT 0x00000004L +#define SS_GRAYRECT 0x00000005L +#define SS_WHITERECT 0x00000006L +#define SS_BLACKFRAME 0x00000007L +#define SS_GRAYFRAME 0x00000008L +#define SS_WHITEFRAME 0x00000009L +#define SS_USERITEM 0x0000000AL +#define SS_SIMPLE 0x0000000BL +#define SS_LEFTNOWORDWRAP 0x0000000CL +#define SS_OWNERDRAW 0x0000000DL +#define SS_BITMAP 0x0000000EL +#define SS_ENHMETAFILE 0x0000000FL +#define SS_ETCHEDHORZ 0x00000010L +#define SS_ETCHEDVERT 0x00000011L +#define SS_ETCHEDFRAME 0x00000012L +#define SS_TYPEMASK 0x0000001FL +#define SS_REALSIZECONTROL 0x00000040L +#define SS_NOPREFIX 0x00000080L +#define SS_NOTIFY 0x00000100L +#define SS_CENTERIMAGE 0x00000200L +#define SS_RIGHTJUST 0x00000400L +#define SS_REALSIZEIMAGE 0x00000800L +#define SS_SUNKEN 0x00001000L +#define SS_EDITCONTROL 0x00002000L +#define SS_ENDELLIPSIS 0x00004000L +#define SS_PATHELLIPSIS 0x00008000L +#define SS_WORDELLIPSIS 0x0000C000L +#define SS_ELLIPSISMASK 0x0000C000L + +#ifndef NOWINMESSAGES + +#define STM_SETICON 0x0170 +#define STM_GETICON 0x0171 +#define STM_SETIMAGE 0x0172 +#define STM_GETIMAGE 0x0173 +#define STN_CLICKED 0 +#define STN_DBLCLK 1 +#define STN_ENABLE 2 +#define STN_DISABLE 3 +#define STM_MSGMAX 0x0174 +#endif + +#define WC_DIALOG (MAKEINTATOM(0x8002)) + +#define DWL_MSGRESULT 0 +#define DWL_DLGPROC 4 +#define DWL_USER 8 + +#ifdef _WIN64 + +#undef DWL_MSGRESULT +#undef DWL_DLGPROC +#undef DWL_USER +#endif + +#define DWLP_MSGRESULT 0 +#define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT) +#define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC) + +#ifndef NOMSG + +#ifdef UNICODE +#define IsDialogMessage IsDialogMessageW +#else +#define IsDialogMessage IsDialogMessageA +#endif + + WINUSERAPI WINBOOL WINAPI IsDialogMessageA(HWND hDlg,LPMSG lpMsg); + WINUSERAPI WINBOOL WINAPI IsDialogMessageW(HWND hDlg,LPMSG lpMsg); +#endif + +#ifdef UNICODE +#define DlgDirList DlgDirListW +#define DlgDirSelectEx DlgDirSelectExW +#define DlgDirListComboBox DlgDirListComboBoxW +#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExW +#else +#define DlgDirList DlgDirListA +#define DlgDirSelectEx DlgDirSelectExA +#define DlgDirListComboBox DlgDirListComboBoxA +#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExA +#endif + + WINUSERAPI WINBOOL WINAPI MapDialogRect(HWND hDlg,LPRECT lpRect); + WINUSERAPI int WINAPI DlgDirListA(HWND hDlg,LPSTR lpPathSpec,int nIDListBox,int nIDStaticPath,UINT uFileType); + WINUSERAPI int WINAPI DlgDirListW(HWND hDlg,LPWSTR lpPathSpec,int nIDListBox,int nIDStaticPath,UINT uFileType); + +#define DDL_READWRITE 0x0000 +#define DDL_READONLY 0x0001 +#define DDL_HIDDEN 0x0002 +#define DDL_SYSTEM 0x0004 +#define DDL_DIRECTORY 0x0010 +#define DDL_ARCHIVE 0x0020 + +#define DDL_POSTMSGS 0x2000 +#define DDL_DRIVES 0x4000 +#define DDL_EXCLUSIVE 0x8000 + + WINUSERAPI WINBOOL WINAPI DlgDirSelectExA(HWND hwndDlg,LPSTR lpString,int chCount,int idListBox); + WINUSERAPI WINBOOL WINAPI DlgDirSelectExW(HWND hwndDlg,LPWSTR lpString,int chCount,int idListBox); + WINUSERAPI int WINAPI DlgDirListComboBoxA(HWND hDlg,LPSTR lpPathSpec,int nIDComboBox,int nIDStaticPath,UINT uFiletype); + WINUSERAPI int WINAPI DlgDirListComboBoxW(HWND hDlg,LPWSTR lpPathSpec,int nIDComboBox,int nIDStaticPath,UINT uFiletype); + WINUSERAPI WINBOOL WINAPI DlgDirSelectComboBoxExA(HWND hwndDlg,LPSTR lpString,int cchOut,int idComboBox); + WINUSERAPI WINBOOL WINAPI DlgDirSelectComboBoxExW(HWND hwndDlg,LPWSTR lpString,int cchOut,int idComboBox); + +#define DS_ABSALIGN 0x01L +#define DS_SYSMODAL 0x02L +#define DS_LOCALEDIT 0x20L +#define DS_SETFONT 0x40L +#define DS_MODALFRAME 0x80L +#define DS_NOIDLEMSG 0x100L +#define DS_SETFOREGROUND 0x200L + +#define DS_3DLOOK 0x0004L +#define DS_FIXEDSYS 0x0008L +#define DS_NOFAILCREATE 0x0010L +#define DS_CONTROL 0x0400L +#define DS_CENTER 0x0800L +#define DS_CENTERMOUSE 0x1000L +#define DS_CONTEXTHELP 0x2000L + +#define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS) + +#if(_WIN32_WCE >= 0x0500) +#define DS_USEPIXELS 0x8000L +#endif + +#define DM_GETDEFID (WM_USER+0) +#define DM_SETDEFID (WM_USER+1) +#define DM_REPOSITION (WM_USER+2) + +#define DC_HASDEFID 0x534B + +#define DLGC_WANTARROWS 0x0001 +#define DLGC_WANTTAB 0x0002 +#define DLGC_WANTALLKEYS 0x0004 +#define DLGC_WANTMESSAGE 0x0004 +#define DLGC_HASSETSEL 0x0008 +#define DLGC_DEFPUSHBUTTON 0x0010 +#define DLGC_UNDEFPUSHBUTTON 0x0020 +#define DLGC_RADIOBUTTON 0x0040 +#define DLGC_WANTCHARS 0x0080 +#define DLGC_STATIC 0x0100 +#define DLGC_BUTTON 0x2000 + +#define LB_CTLCODE 0L + +#define LB_OKAY 0 +#define LB_ERR (-1) +#define LB_ERRSPACE (-2) + +#define LBN_ERRSPACE (-2) +#define LBN_SELCHANGE 1 +#define LBN_DBLCLK 2 +#define LBN_SELCANCEL 3 +#define LBN_SETFOCUS 4 +#define LBN_KILLFOCUS 5 + +#ifndef NOWINMESSAGES + +#define LB_ADDSTRING 0x0180 +#define LB_INSERTSTRING 0x0181 +#define LB_DELETESTRING 0x0182 +#define LB_SELITEMRANGEEX 0x0183 +#define LB_RESETCONTENT 0x0184 +#define LB_SETSEL 0x0185 +#define LB_SETCURSEL 0x0186 +#define LB_GETSEL 0x0187 +#define LB_GETCURSEL 0x0188 +#define LB_GETTEXT 0x0189 +#define LB_GETTEXTLEN 0x018A +#define LB_GETCOUNT 0x018B +#define LB_SELECTSTRING 0x018C +#define LB_DIR 0x018D +#define LB_GETTOPINDEX 0x018E +#define LB_FINDSTRING 0x018F +#define LB_GETSELCOUNT 0x0190 +#define LB_GETSELITEMS 0x0191 +#define LB_SETTABSTOPS 0x0192 +#define LB_GETHORIZONTALEXTENT 0x0193 +#define LB_SETHORIZONTALEXTENT 0x0194 +#define LB_SETCOLUMNWIDTH 0x0195 +#define LB_ADDFILE 0x0196 +#define LB_SETTOPINDEX 0x0197 +#define LB_GETITEMRECT 0x0198 +#define LB_GETITEMDATA 0x0199 +#define LB_SETITEMDATA 0x019A +#define LB_SELITEMRANGE 0x019B +#define LB_SETANCHORINDEX 0x019C +#define LB_GETANCHORINDEX 0x019D +#define LB_SETCARETINDEX 0x019E +#define LB_GETCARETINDEX 0x019F +#define LB_SETITEMHEIGHT 0x01A0 +#define LB_GETITEMHEIGHT 0x01A1 +#define LB_FINDSTRINGEXACT 0x01A2 +#define LB_SETLOCALE 0x01A5 +#define LB_GETLOCALE 0x01A6 +#define LB_SETCOUNT 0x01A7 +#define LB_INITSTORAGE 0x01A8 +#define LB_ITEMFROMPOINT 0x01A9 +#if(_WIN32_WCE >= 0x0400) +#define LB_MULTIPLEADDSTRING 0x01B1 +#endif +#define LB_GETLISTBOXINFO 0x01B2 +#define LB_MSGMAX 0x01B3 +#endif + +#ifndef NOWINSTYLES + +#define LBS_NOTIFY 0x0001L +#define LBS_SORT 0x0002L +#define LBS_NOREDRAW 0x0004L +#define LBS_MULTIPLESEL 0x0008L +#define LBS_OWNERDRAWFIXED 0x0010L +#define LBS_OWNERDRAWVARIABLE 0x0020L +#define LBS_HASSTRINGS 0x0040L +#define LBS_USETABSTOPS 0x0080L +#define LBS_NOINTEGRALHEIGHT 0x0100L +#define LBS_MULTICOLUMN 0x0200L +#define LBS_WANTKEYBOARDINPUT 0x0400L +#define LBS_EXTENDEDSEL 0x0800L +#define LBS_DISABLENOSCROLL 0x1000L +#define LBS_NODATA 0x2000L +#define LBS_NOSEL 0x4000L +#define LBS_COMBOBOX 0x8000L + +#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER) +#endif + +#define CB_OKAY 0 +#define CB_ERR (-1) +#define CB_ERRSPACE (-2) + +#define CBN_ERRSPACE (-1) +#define CBN_SELCHANGE 1 +#define CBN_DBLCLK 2 +#define CBN_SETFOCUS 3 +#define CBN_KILLFOCUS 4 +#define CBN_EDITCHANGE 5 +#define CBN_EDITUPDATE 6 +#define CBN_DROPDOWN 7 +#define CBN_CLOSEUP 8 +#define CBN_SELENDOK 9 +#define CBN_SELENDCANCEL 10 + +#ifndef NOWINSTYLES + +#define CBS_SIMPLE 0x0001L +#define CBS_DROPDOWN 0x0002L +#define CBS_DROPDOWNLIST 0x0003L +#define CBS_OWNERDRAWFIXED 0x0010L +#define CBS_OWNERDRAWVARIABLE 0x0020L +#define CBS_AUTOHSCROLL 0x0040L +#define CBS_OEMCONVERT 0x0080L +#define CBS_SORT 0x0100L +#define CBS_HASSTRINGS 0x0200L +#define CBS_NOINTEGRALHEIGHT 0x0400L +#define CBS_DISABLENOSCROLL 0x0800L +#define CBS_UPPERCASE 0x2000L +#define CBS_LOWERCASE 0x4000L +#endif + +#ifndef NOWINMESSAGES +#define CB_GETEDITSEL 0x0140 +#define CB_LIMITTEXT 0x0141 +#define CB_SETEDITSEL 0x0142 +#define CB_ADDSTRING 0x0143 +#define CB_DELETESTRING 0x0144 +#define CB_DIR 0x0145 +#define CB_GETCOUNT 0x0146 +#define CB_GETCURSEL 0x0147 +#define CB_GETLBTEXT 0x0148 +#define CB_GETLBTEXTLEN 0x0149 +#define CB_INSERTSTRING 0x014A +#define CB_RESETCONTENT 0x014B +#define CB_FINDSTRING 0x014C +#define CB_SELECTSTRING 0x014D +#define CB_SETCURSEL 0x014E +#define CB_SHOWDROPDOWN 0x014F +#define CB_GETITEMDATA 0x0150 +#define CB_SETITEMDATA 0x0151 +#define CB_GETDROPPEDCONTROLRECT 0x0152 +#define CB_SETITEMHEIGHT 0x0153 +#define CB_GETITEMHEIGHT 0x0154 +#define CB_SETEXTENDEDUI 0x0155 +#define CB_GETEXTENDEDUI 0x0156 +#define CB_GETDROPPEDSTATE 0x0157 +#define CB_FINDSTRINGEXACT 0x0158 +#define CB_SETLOCALE 0x0159 +#define CB_GETLOCALE 0x015A +#define CB_GETTOPINDEX 0x015b +#define CB_SETTOPINDEX 0x015c +#define CB_GETHORIZONTALEXTENT 0x015d +#define CB_SETHORIZONTALEXTENT 0x015e +#define CB_GETDROPPEDWIDTH 0x015f +#define CB_SETDROPPEDWIDTH 0x0160 +#define CB_INITSTORAGE 0x0161 +#if(_WIN32_WCE >= 0x0400) +#define CB_MULTIPLEADDSTRING 0x0163 +#endif +#define CB_GETCOMBOBOXINFO 0x0164 +#define CB_MSGMAX 0x0165 +#endif + +#ifndef NOWINSTYLES + +#define SBS_HORZ 0x0000L +#define SBS_VERT 0x0001L +#define SBS_TOPALIGN 0x0002L +#define SBS_LEFTALIGN 0x0002L +#define SBS_BOTTOMALIGN 0x0004L +#define SBS_RIGHTALIGN 0x0004L +#define SBS_SIZEBOXTOPLEFTALIGN 0x0002L +#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L +#define SBS_SIZEBOX 0x0008L +#define SBS_SIZEGRIP 0x0010L +#endif + +#ifndef NOWINMESSAGES +#define SBM_SETPOS 0x00E0 +#define SBM_GETPOS 0x00E1 +#define SBM_SETRANGE 0x00E2 +#define SBM_SETRANGEREDRAW 0x00E6 +#define SBM_GETRANGE 0x00E3 +#define SBM_ENABLE_ARROWS 0x00E4 +#define SBM_SETSCROLLINFO 0x00E9 +#define SBM_GETSCROLLINFO 0x00EA +#define SBM_GETSCROLLBARINFO 0x00EB + +#define SIF_RANGE 0x0001 +#define SIF_PAGE 0x0002 +#define SIF_POS 0x0004 +#define SIF_DISABLENOSCROLL 0x0008 +#define SIF_TRACKPOS 0x0010 +#define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS) + + typedef struct tagSCROLLINFO { + UINT cbSize; + UINT fMask; + int nMin; + int nMax; + UINT nPage; + int nPos; + int nTrackPos; + } SCROLLINFO,*LPSCROLLINFO; + typedef SCROLLINFO CONST *LPCSCROLLINFO; + + WINUSERAPI int WINAPI SetScrollInfo(HWND hwnd,int nBar,LPCSCROLLINFO lpsi,WINBOOL redraw); + WINUSERAPI WINBOOL WINAPI GetScrollInfo(HWND hwnd,int nBar,LPSCROLLINFO lpsi); +#endif +#endif + +#ifndef NOMDI + +#define MDIS_ALLCHILDSTYLES 0x0001 + +#define MDITILE_VERTICAL 0x0000 +#define MDITILE_HORIZONTAL 0x0001 +#define MDITILE_SKIPDISABLED 0x0002 +#define MDITILE_ZORDER 0x0004 + + typedef struct tagMDICREATESTRUCTA { + LPCSTR szClass; + LPCSTR szTitle; + HANDLE hOwner; + int x; + int y; + int cx; + int cy; + DWORD style; + LPARAM lParam; + } MDICREATESTRUCTA,*LPMDICREATESTRUCTA; + + typedef struct tagMDICREATESTRUCTW { + LPCWSTR szClass; + LPCWSTR szTitle; + HANDLE hOwner; + int x; + int y; + int cx; + int cy; + DWORD style; + LPARAM lParam; + } MDICREATESTRUCTW,*LPMDICREATESTRUCTW; + +#ifdef UNICODE + typedef MDICREATESTRUCTW MDICREATESTRUCT; + typedef LPMDICREATESTRUCTW LPMDICREATESTRUCT; +#else + typedef MDICREATESTRUCTA MDICREATESTRUCT; + typedef LPMDICREATESTRUCTA LPMDICREATESTRUCT; +#endif + + typedef struct tagCLIENTCREATESTRUCT { + HANDLE hWindowMenu; + UINT idFirstChild; + } CLIENTCREATESTRUCT,*LPCLIENTCREATESTRUCT; + +#ifdef UNICODE +#define DefFrameProc DefFrameProcW +#define DefMDIChildProc DefMDIChildProcW +#define CreateMDIWindow CreateMDIWindowW +#else +#define DefFrameProc DefFrameProcA +#define DefMDIChildProc DefMDIChildProcA +#define CreateMDIWindow CreateMDIWindowA +#endif + + WINUSERAPI LRESULT WINAPI DefFrameProcA(HWND hWnd,HWND hWndMDIClient,UINT uMsg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefFrameProcW(HWND hWnd,HWND hWndMDIClient,UINT uMsg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefMDIChildProcA(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefMDIChildProcW(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); + +#ifndef NOMSG + WINUSERAPI WINBOOL WINAPI TranslateMDISysAccel(HWND hWndClient,LPMSG lpMsg); +#endif + + WINUSERAPI UINT WINAPI ArrangeIconicWindows(HWND hWnd); + WINUSERAPI HWND WINAPI CreateMDIWindowA(LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HINSTANCE hInstance,LPARAM lParam); + WINUSERAPI HWND WINAPI CreateMDIWindowW(LPCWSTR lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HINSTANCE hInstance,LPARAM lParam); + WINUSERAPI WORD WINAPI TileWindows(HWND hwndParent,UINT wHow,CONST RECT *lpRect,UINT cKids,const HWND *lpKids); + WINUSERAPI WORD WINAPI CascadeWindows(HWND hwndParent,UINT wHow,CONST RECT *lpRect,UINT cKids,const HWND *lpKids); +#endif +#endif + +#ifndef NOHELP + + typedef DWORD HELPPOLY; + typedef struct tagMULTIKEYHELPA { + DWORD mkSize; + CHAR mkKeylist; + CHAR szKeyphrase[1]; + } MULTIKEYHELPA,*PMULTIKEYHELPA,*LPMULTIKEYHELPA; + + typedef struct tagMULTIKEYHELPW { + DWORD mkSize; + WCHAR mkKeylist; + WCHAR szKeyphrase[1]; + } MULTIKEYHELPW,*PMULTIKEYHELPW,*LPMULTIKEYHELPW; + +#ifdef UNICODE + typedef MULTIKEYHELPW MULTIKEYHELP; + typedef PMULTIKEYHELPW PMULTIKEYHELP; + typedef LPMULTIKEYHELPW LPMULTIKEYHELP; +#else + typedef MULTIKEYHELPA MULTIKEYHELP; + typedef PMULTIKEYHELPA PMULTIKEYHELP; + typedef LPMULTIKEYHELPA LPMULTIKEYHELP; +#endif + + typedef struct tagHELPWININFOA { + int wStructSize; + int x; + int y; + int dx; + int dy; + int wMax; + CHAR rgchMember[2]; + } HELPWININFOA,*PHELPWININFOA,*LPHELPWININFOA; + + typedef struct tagHELPWININFOW { + int wStructSize; + int x; + int y; + int dx; + int dy; + int wMax; + WCHAR rgchMember[2]; + } HELPWININFOW,*PHELPWININFOW,*LPHELPWININFOW; + +#ifdef UNICODE + typedef HELPWININFOW HELPWININFO; + typedef PHELPWININFOW PHELPWININFO; + typedef LPHELPWININFOW LPHELPWININFO; +#else + typedef HELPWININFOA HELPWININFO; + typedef PHELPWININFOA PHELPWININFO; + typedef LPHELPWININFOA LPHELPWININFO; +#endif + +#define HELP_CONTEXT 0x0001L +#define HELP_QUIT 0x0002L +#define HELP_INDEX 0x0003L +#define HELP_CONTENTS 0x0003L +#define HELP_HELPONHELP 0x0004L +#define HELP_SETINDEX 0x0005L +#define HELP_SETCONTENTS 0x0005L +#define HELP_CONTEXTPOPUP 0x0008L +#define HELP_FORCEFILE 0x0009L +#define HELP_KEY 0x0101L +#define HELP_COMMAND 0x0102L +#define HELP_PARTIALKEY 0x0105L +#define HELP_MULTIKEY 0x0201L +#define HELP_SETWINPOS 0x0203L +#define HELP_CONTEXTMENU 0x000a +#define HELP_FINDER 0x000b +#define HELP_WM_HELP 0x000c +#define HELP_SETPOPUP_POS 0x000d + +#define HELP_TCARD 0x8000 +#define HELP_TCARD_DATA 0x0010 +#define HELP_TCARD_OTHER_CALLER 0x0011 + +#define IDH_NO_HELP 28440 +#define IDH_MISSING_CONTEXT 28441 +#define IDH_GENERIC_HELP_BUTTON 28442 +#define IDH_OK 28443 +#define IDH_CANCEL 28444 +#define IDH_HELP 28445 + +#ifdef UNICODE +#define WinHelp WinHelpW +#else +#define WinHelp WinHelpA +#endif + + WINUSERAPI WINBOOL WINAPI WinHelpA(HWND hWndMain,LPCSTR lpszHelp,UINT uCommand,ULONG_PTR dwData); + WINUSERAPI WINBOOL WINAPI WinHelpW(HWND hWndMain,LPCWSTR lpszHelp,UINT uCommand,ULONG_PTR dwData); +#endif + +#define GR_GDIOBJECTS 0 +#define GR_USEROBJECTS 1 + + WINUSERAPI DWORD WINAPI GetGuiResources(HANDLE hProcess,DWORD uiFlags); + +#ifndef NOSYSPARAMSINFO + +#define SPI_GETBEEP 0x0001 +#define SPI_SETBEEP 0x0002 +#define SPI_GETMOUSE 0x0003 +#define SPI_SETMOUSE 0x0004 +#define SPI_GETBORDER 0x0005 +#define SPI_SETBORDER 0x0006 +#define SPI_GETKEYBOARDSPEED 0x000A +#define SPI_SETKEYBOARDSPEED 0x000B +#define SPI_LANGDRIVER 0x000C +#define SPI_ICONHORIZONTALSPACING 0x000D +#define SPI_GETSCREENSAVETIMEOUT 0x000E +#define SPI_SETSCREENSAVETIMEOUT 0x000F +#define SPI_GETSCREENSAVEACTIVE 0x0010 +#define SPI_SETSCREENSAVEACTIVE 0x0011 +#define SPI_GETGRIDGRANULARITY 0x0012 +#define SPI_SETGRIDGRANULARITY 0x0013 +#define SPI_SETDESKWALLPAPER 0x0014 +#define SPI_SETDESKPATTERN 0x0015 +#define SPI_GETKEYBOARDDELAY 0x0016 +#define SPI_SETKEYBOARDDELAY 0x0017 +#define SPI_ICONVERTICALSPACING 0x0018 +#define SPI_GETICONTITLEWRAP 0x0019 +#define SPI_SETICONTITLEWRAP 0x001A +#define SPI_GETMENUDROPALIGNMENT 0x001B +#define SPI_SETMENUDROPALIGNMENT 0x001C +#define SPI_SETDOUBLECLKWIDTH 0x001D +#define SPI_SETDOUBLECLKHEIGHT 0x001E +#define SPI_GETICONTITLELOGFONT 0x001F +#define SPI_SETDOUBLECLICKTIME 0x0020 +#define SPI_SETMOUSEBUTTONSWAP 0x0021 +#define SPI_SETICONTITLELOGFONT 0x0022 +#define SPI_GETFASTTASKSWITCH 0x0023 +#define SPI_SETFASTTASKSWITCH 0x0024 +#define SPI_SETDRAGFULLWINDOWS 0x0025 +#define SPI_GETDRAGFULLWINDOWS 0x0026 +#define SPI_GETNONCLIENTMETRICS 0x0029 +#define SPI_SETNONCLIENTMETRICS 0x002A +#define SPI_GETMINIMIZEDMETRICS 0x002B +#define SPI_SETMINIMIZEDMETRICS 0x002C +#define SPI_GETICONMETRICS 0x002D +#define SPI_SETICONMETRICS 0x002E +#define SPI_SETWORKAREA 0x002F +#define SPI_GETWORKAREA 0x0030 +#define SPI_SETPENWINDOWS 0x0031 + +#define SPI_GETHIGHCONTRAST 0x0042 +#define SPI_SETHIGHCONTRAST 0x0043 +#define SPI_GETKEYBOARDPREF 0x0044 +#define SPI_SETKEYBOARDPREF 0x0045 +#define SPI_GETSCREENREADER 0x0046 +#define SPI_SETSCREENREADER 0x0047 +#define SPI_GETANIMATION 0x0048 +#define SPI_SETANIMATION 0x0049 +#define SPI_GETFONTSMOOTHING 0x004A +#define SPI_SETFONTSMOOTHING 0x004B +#define SPI_SETDRAGWIDTH 0x004C +#define SPI_SETDRAGHEIGHT 0x004D +#define SPI_SETHANDHELD 0x004E +#define SPI_GETLOWPOWERTIMEOUT 0x004F +#define SPI_GETPOWEROFFTIMEOUT 0x0050 +#define SPI_SETLOWPOWERTIMEOUT 0x0051 +#define SPI_SETPOWEROFFTIMEOUT 0x0052 +#define SPI_GETLOWPOWERACTIVE 0x0053 +#define SPI_GETPOWEROFFACTIVE 0x0054 +#define SPI_SETLOWPOWERACTIVE 0x0055 +#define SPI_SETPOWEROFFACTIVE 0x0056 +#define SPI_SETCURSORS 0x0057 +#define SPI_SETICONS 0x0058 +#define SPI_GETDEFAULTINPUTLANG 0x0059 +#define SPI_SETDEFAULTINPUTLANG 0x005A +#define SPI_SETLANGTOGGLE 0x005B +#define SPI_GETWINDOWSEXTENSION 0x005C +#define SPI_SETMOUSETRAILS 0x005D +#define SPI_GETMOUSETRAILS 0x005E +#define SPI_SETSCREENSAVERRUNNING 0x0061 +#define SPI_SCREENSAVERRUNNING SPI_SETSCREENSAVERRUNNING +#define SPI_GETFILTERKEYS 0x0032 +#define SPI_SETFILTERKEYS 0x0033 +#define SPI_GETTOGGLEKEYS 0x0034 +#define SPI_SETTOGGLEKEYS 0x0035 +#define SPI_GETMOUSEKEYS 0x0036 +#define SPI_SETMOUSEKEYS 0x0037 +#define SPI_GETSHOWSOUNDS 0x0038 +#define SPI_SETSHOWSOUNDS 0x0039 +#define SPI_GETSTICKYKEYS 0x003A +#define SPI_SETSTICKYKEYS 0x003B +#define SPI_GETACCESSTIMEOUT 0x003C +#define SPI_SETACCESSTIMEOUT 0x003D +#define SPI_GETSERIALKEYS 0x003E +#define SPI_SETSERIALKEYS 0x003F +#define SPI_GETSOUNDSENTRY 0x0040 +#define SPI_SETSOUNDSENTRY 0x0041 +#define SPI_GETSNAPTODEFBUTTON 0x005F +#define SPI_SETSNAPTODEFBUTTON 0x0060 +#define SPI_GETMOUSEHOVERWIDTH 0x0062 +#define SPI_SETMOUSEHOVERWIDTH 0x0063 +#define SPI_GETMOUSEHOVERHEIGHT 0x0064 +#define SPI_SETMOUSEHOVERHEIGHT 0x0065 +#define SPI_GETMOUSEHOVERTIME 0x0066 +#define SPI_SETMOUSEHOVERTIME 0x0067 +#define SPI_GETWHEELSCROLLLINES 0x0068 +#define SPI_SETWHEELSCROLLLINES 0x0069 +#define SPI_GETMENUSHOWDELAY 0x006A +#define SPI_SETMENUSHOWDELAY 0x006B +#define SPI_GETSHOWIMEUI 0x006E +#define SPI_SETSHOWIMEUI 0x006F +#define SPI_GETMOUSESPEED 0x0070 +#define SPI_SETMOUSESPEED 0x0071 +#define SPI_GETSCREENSAVERRUNNING 0x0072 +#define SPI_GETDESKWALLPAPER 0x0073 + +#define SPI_GETACTIVEWINDOWTRACKING 0x1000 +#define SPI_SETACTIVEWINDOWTRACKING 0x1001 +#define SPI_GETMENUANIMATION 0x1002 +#define SPI_SETMENUANIMATION 0x1003 +#define SPI_GETCOMBOBOXANIMATION 0x1004 +#define SPI_SETCOMBOBOXANIMATION 0x1005 +#define SPI_GETLISTBOXSMOOTHSCROLLING 0x1006 +#define SPI_SETLISTBOXSMOOTHSCROLLING 0x1007 +#define SPI_GETGRADIENTCAPTIONS 0x1008 +#define SPI_SETGRADIENTCAPTIONS 0x1009 +#define SPI_GETKEYBOARDCUES 0x100A +#define SPI_SETKEYBOARDCUES 0x100B +#define SPI_GETMENUUNDERLINES SPI_GETKEYBOARDCUES +#define SPI_SETMENUUNDERLINES SPI_SETKEYBOARDCUES +#define SPI_GETACTIVEWNDTRKZORDER 0x100C +#define SPI_SETACTIVEWNDTRKZORDER 0x100D +#define SPI_GETHOTTRACKING 0x100E +#define SPI_SETHOTTRACKING 0x100F +#define SPI_GETMENUFADE 0x1012 +#define SPI_SETMENUFADE 0x1013 +#define SPI_GETSELECTIONFADE 0x1014 +#define SPI_SETSELECTIONFADE 0x1015 +#define SPI_GETTOOLTIPANIMATION 0x1016 +#define SPI_SETTOOLTIPANIMATION 0x1017 +#define SPI_GETTOOLTIPFADE 0x1018 +#define SPI_SETTOOLTIPFADE 0x1019 +#define SPI_GETCURSORSHADOW 0x101A +#define SPI_SETCURSORSHADOW 0x101B +#define SPI_GETMOUSESONAR 0x101C +#define SPI_SETMOUSESONAR 0x101D +#define SPI_GETMOUSECLICKLOCK 0x101E +#define SPI_SETMOUSECLICKLOCK 0x101F +#define SPI_GETMOUSEVANISH 0x1020 +#define SPI_SETMOUSEVANISH 0x1021 +#define SPI_GETFLATMENU 0x1022 +#define SPI_SETFLATMENU 0x1023 +#define SPI_GETDROPSHADOW 0x1024 +#define SPI_SETDROPSHADOW 0x1025 +#define SPI_GETBLOCKSENDINPUTRESETS 0x1026 +#define SPI_SETBLOCKSENDINPUTRESETS 0x1027 +#define SPI_GETUIEFFECTS 0x103E +#define SPI_SETUIEFFECTS 0x103F +#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000 +#define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001 +#define SPI_GETACTIVEWNDTRKTIMEOUT 0x2002 +#define SPI_SETACTIVEWNDTRKTIMEOUT 0x2003 +#define SPI_GETFOREGROUNDFLASHCOUNT 0x2004 +#define SPI_SETFOREGROUNDFLASHCOUNT 0x2005 +#define SPI_GETCARETWIDTH 0x2006 +#define SPI_SETCARETWIDTH 0x2007 +#define SPI_GETMOUSECLICKLOCKTIME 0x2008 +#define SPI_SETMOUSECLICKLOCKTIME 0x2009 +#define SPI_GETFONTSMOOTHINGTYPE 0x200A +#define SPI_SETFONTSMOOTHINGTYPE 0x200B + +#define FE_FONTSMOOTHINGSTANDARD 0x0001 +#define FE_FONTSMOOTHINGCLEARTYPE 0x0002 +#define FE_FONTSMOOTHINGDOCKING 0x8000 + +#define SPI_GETFONTSMOOTHINGCONTRAST 0x200C +#define SPI_SETFONTSMOOTHINGCONTRAST 0x200D +#define SPI_GETFOCUSBORDERWIDTH 0x200E +#define SPI_SETFOCUSBORDERWIDTH 0x200F +#define SPI_GETFOCUSBORDERHEIGHT 0x2010 +#define SPI_SETFOCUSBORDERHEIGHT 0x2011 +#define SPI_GETFONTSMOOTHINGORIENTATION 0x2012 +#define SPI_SETFONTSMOOTHINGORIENTATION 0x2013 + +#define FE_FONTSMOOTHINGORIENTATIONBGR 0x0000 +#define FE_FONTSMOOTHINGORIENTATIONRGB 0x0001 + +#define SPIF_UPDATEINIFILE 0x0001 +#define SPIF_SENDWININICHANGE 0x0002 +#define SPIF_SENDCHANGE SPIF_SENDWININICHANGE + +#define METRICS_USEDEFAULT -1 +#ifdef _WINGDI_ +#ifndef NOGDI + typedef struct tagNONCLIENTMETRICSA { + UINT cbSize; + int iBorderWidth; + int iScrollWidth; + int iScrollHeight; + int iCaptionWidth; + int iCaptionHeight; + LOGFONTA lfCaptionFont; + int iSmCaptionWidth; + int iSmCaptionHeight; + LOGFONTA lfSmCaptionFont; + int iMenuWidth; + int iMenuHeight; + LOGFONTA lfMenuFont; + LOGFONTA lfStatusFont; + LOGFONTA lfMessageFont; + } NONCLIENTMETRICSA,*PNONCLIENTMETRICSA,*LPNONCLIENTMETRICSA; + + typedef struct tagNONCLIENTMETRICSW { + UINT cbSize; + int iBorderWidth; + int iScrollWidth; + int iScrollHeight; + int iCaptionWidth; + int iCaptionHeight; + LOGFONTW lfCaptionFont; + int iSmCaptionWidth; + int iSmCaptionHeight; + LOGFONTW lfSmCaptionFont; + int iMenuWidth; + int iMenuHeight; + LOGFONTW lfMenuFont; + LOGFONTW lfStatusFont; + LOGFONTW lfMessageFont; + } NONCLIENTMETRICSW,*PNONCLIENTMETRICSW,*LPNONCLIENTMETRICSW; + +#ifdef UNICODE + typedef NONCLIENTMETRICSW NONCLIENTMETRICS; + typedef PNONCLIENTMETRICSW PNONCLIENTMETRICS; + typedef LPNONCLIENTMETRICSW LPNONCLIENTMETRICS; +#else + typedef NONCLIENTMETRICSA NONCLIENTMETRICS; + typedef PNONCLIENTMETRICSA PNONCLIENTMETRICS; + typedef LPNONCLIENTMETRICSA LPNONCLIENTMETRICS; +#endif +#endif +#endif + +#define ARW_BOTTOMLEFT 0x0000L +#define ARW_BOTTOMRIGHT 0x0001L +#define ARW_TOPLEFT 0x0002L +#define ARW_TOPRIGHT 0x0003L +#define ARW_STARTMASK 0x0003L +#define ARW_STARTRIGHT 0x0001L +#define ARW_STARTTOP 0x0002L + +#define ARW_LEFT 0x0000L +#define ARW_RIGHT 0x0000L +#define ARW_UP 0x0004L +#define ARW_DOWN 0x0004L +#define ARW_HIDE 0x0008L + + typedef struct tagMINIMIZEDMETRICS { + UINT cbSize; + int iWidth; + int iHorzGap; + int iVertGap; + int iArrange; + } MINIMIZEDMETRICS,*PMINIMIZEDMETRICS,*LPMINIMIZEDMETRICS; + +#ifdef _WINGDI_ +#ifndef NOGDI + typedef struct tagICONMETRICSA { + UINT cbSize; + int iHorzSpacing; + int iVertSpacing; + int iTitleWrap; + LOGFONTA lfFont; + } ICONMETRICSA,*PICONMETRICSA,*LPICONMETRICSA; + + typedef struct tagICONMETRICSW { + UINT cbSize; + int iHorzSpacing; + int iVertSpacing; + int iTitleWrap; + LOGFONTW lfFont; + } ICONMETRICSW,*PICONMETRICSW,*LPICONMETRICSW; + +#ifdef UNICODE + typedef ICONMETRICSW ICONMETRICS; + typedef PICONMETRICSW PICONMETRICS; + typedef LPICONMETRICSW LPICONMETRICS; +#else + typedef ICONMETRICSA ICONMETRICS; + typedef PICONMETRICSA PICONMETRICS; + typedef LPICONMETRICSA LPICONMETRICS; +#endif +#endif +#endif + + typedef struct tagANIMATIONINFO { + UINT cbSize; + int iMinAnimate; + } ANIMATIONINFO,*LPANIMATIONINFO; + + typedef struct tagSERIALKEYSA { + UINT cbSize; + DWORD dwFlags; + LPSTR lpszActivePort; + LPSTR lpszPort; + UINT iBaudRate; + UINT iPortState; + UINT iActive; + } SERIALKEYSA,*LPSERIALKEYSA; + + typedef struct tagSERIALKEYSW { + UINT cbSize; + DWORD dwFlags; + LPWSTR lpszActivePort; + LPWSTR lpszPort; + UINT iBaudRate; + UINT iPortState; + UINT iActive; + } SERIALKEYSW,*LPSERIALKEYSW; + +#ifdef UNICODE + typedef SERIALKEYSW SERIALKEYS; + typedef LPSERIALKEYSW LPSERIALKEYS; +#else + typedef SERIALKEYSA SERIALKEYS; + typedef LPSERIALKEYSA LPSERIALKEYS; +#endif + +#define SERKF_SERIALKEYSON 0x00000001 +#define SERKF_AVAILABLE 0x00000002 +#define SERKF_INDICATOR 0x00000004 + + typedef struct tagHIGHCONTRASTA { + UINT cbSize; + DWORD dwFlags; + LPSTR lpszDefaultScheme; + } HIGHCONTRASTA,*LPHIGHCONTRASTA; + + typedef struct tagHIGHCONTRASTW { + UINT cbSize; + DWORD dwFlags; + LPWSTR lpszDefaultScheme; + } HIGHCONTRASTW,*LPHIGHCONTRASTW; + +#ifdef UNICODE + typedef HIGHCONTRASTW HIGHCONTRAST; + typedef LPHIGHCONTRASTW LPHIGHCONTRAST; +#else + typedef HIGHCONTRASTA HIGHCONTRAST; + typedef LPHIGHCONTRASTA LPHIGHCONTRAST; +#endif + +#define HCF_HIGHCONTRASTON 0x00000001 +#define HCF_AVAILABLE 0x00000002 +#define HCF_HOTKEYACTIVE 0x00000004 +#define HCF_CONFIRMHOTKEY 0x00000008 +#define HCF_HOTKEYSOUND 0x00000010 +#define HCF_INDICATOR 0x00000020 +#define HCF_HOTKEYAVAILABLE 0x00000040 +#define HCF_LOGONDESKTOP 0x00000100 +#define HCF_DEFAULTDESKTOP 0x00000200 + +#define CDS_UPDATEREGISTRY 0x00000001 +#define CDS_TEST 0x00000002 +#define CDS_FULLSCREEN 0x00000004 +#define CDS_GLOBAL 0x00000008 +#define CDS_SET_PRIMARY 0x00000010 +#define CDS_VIDEOPARAMETERS 0x00000020 +#define CDS_RESET 0x40000000 +#define CDS_NORESET 0x10000000 + +//gr #include + +#define DISP_CHANGE_SUCCESSFUL 0 +#define DISP_CHANGE_RESTART 1 +#define DISP_CHANGE_FAILED -1 +#define DISP_CHANGE_BADMODE -2 +#define DISP_CHANGE_NOTUPDATED -3 +#define DISP_CHANGE_BADFLAGS -4 +#define DISP_CHANGE_BADPARAM -5 +#define DISP_CHANGE_BADDUALVIEW -6 + +#ifdef _WINGDI_ +#ifndef NOGDI + +#ifdef UNICODE +#define ChangeDisplaySettings ChangeDisplaySettingsW +#define ChangeDisplaySettingsEx ChangeDisplaySettingsExW +#define EnumDisplaySettings EnumDisplaySettingsW +#define EnumDisplaySettingsEx EnumDisplaySettingsExW +#define EnumDisplayDevices EnumDisplayDevicesW +#else +#define ChangeDisplaySettings ChangeDisplaySettingsA +#define ChangeDisplaySettingsEx ChangeDisplaySettingsExA +#define EnumDisplaySettings EnumDisplaySettingsA +#define EnumDisplaySettingsEx EnumDisplaySettingsExA +#define EnumDisplayDevices EnumDisplayDevicesA +#endif + + WINUSERAPI LONG WINAPI ChangeDisplaySettingsA(LPDEVMODEA lpDevMode,DWORD dwFlags); + WINUSERAPI LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW lpDevMode,DWORD dwFlags); + WINUSERAPI LONG WINAPI ChangeDisplaySettingsExA(LPCSTR lpszDeviceName,LPDEVMODEA lpDevMode,HWND hwnd,DWORD dwflags,LPVOID lParam); + WINUSERAPI LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName,LPDEVMODEW lpDevMode,HWND hwnd,DWORD dwflags,LPVOID lParam); + +#define ENUM_CURRENT_SETTINGS ((DWORD)-1) +#define ENUM_REGISTRY_SETTINGS ((DWORD)-2) + + WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsA(LPCSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEA lpDevMode); + WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsW(LPCWSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEW lpDevMode); + WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEA lpDevMode,DWORD dwFlags); + WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEW lpDevMode,DWORD dwFlags); + +#define EDS_RAWMODE 0x00000002 + + WINUSERAPI WINBOOL WINAPI EnumDisplayDevicesA(LPCSTR lpDevice,DWORD iDevNum,PDISPLAY_DEVICEA lpDisplayDevice,DWORD dwFlags); + WINUSERAPI WINBOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice,DWORD iDevNum,PDISPLAY_DEVICEW lpDisplayDevice,DWORD dwFlags); +#endif +#endif + +#ifdef UNICODE +#define SystemParametersInfo SystemParametersInfoW +#else +#define SystemParametersInfo SystemParametersInfoA +#endif + + WINUSERAPI WINBOOL WINAPI SystemParametersInfoA(UINT uiAction,UINT uiParam,PVOID pvParam,UINT fWinIni); + WINUSERAPI WINBOOL WINAPI SystemParametersInfoW(UINT uiAction,UINT uiParam,PVOID pvParam,UINT fWinIni); +#endif + + typedef struct tagFILTERKEYS { + UINT cbSize; + DWORD dwFlags; + DWORD iWaitMSec; + DWORD iDelayMSec; + DWORD iRepeatMSec; + DWORD iBounceMSec; + } FILTERKEYS,*LPFILTERKEYS; + +#define FKF_FILTERKEYSON 0x00000001 +#define FKF_AVAILABLE 0x00000002 +#define FKF_HOTKEYACTIVE 0x00000004 +#define FKF_CONFIRMHOTKEY 0x00000008 +#define FKF_HOTKEYSOUND 0x00000010 +#define FKF_INDICATOR 0x00000020 +#define FKF_CLICKON 0x00000040 + + typedef struct tagSTICKYKEYS { + UINT cbSize; + DWORD dwFlags; + } STICKYKEYS,*LPSTICKYKEYS; + +#define SKF_STICKYKEYSON 0x00000001 +#define SKF_AVAILABLE 0x00000002 +#define SKF_HOTKEYACTIVE 0x00000004 +#define SKF_CONFIRMHOTKEY 0x00000008 +#define SKF_HOTKEYSOUND 0x00000010 +#define SKF_INDICATOR 0x00000020 +#define SKF_AUDIBLEFEEDBACK 0x00000040 +#define SKF_TRISTATE 0x00000080 +#define SKF_TWOKEYSOFF 0x00000100 +#define SKF_LALTLATCHED 0x10000000 +#define SKF_LCTLLATCHED 0x04000000 +#define SKF_LSHIFTLATCHED 0x01000000 +#define SKF_RALTLATCHED 0x20000000 +#define SKF_RCTLLATCHED 0x08000000 +#define SKF_RSHIFTLATCHED 0x02000000 +#define SKF_LWINLATCHED 0x40000000 +#define SKF_RWINLATCHED 0x80000000 +#define SKF_LALTLOCKED 0x00100000 +#define SKF_LCTLLOCKED 0x00040000 +#define SKF_LSHIFTLOCKED 0x00010000 +#define SKF_RALTLOCKED 0x00200000 +#define SKF_RCTLLOCKED 0x00080000 +#define SKF_RSHIFTLOCKED 0x00020000 +#define SKF_LWINLOCKED 0x00400000 +#define SKF_RWINLOCKED 0x00800000 + + typedef struct tagMOUSEKEYS { + UINT cbSize; + DWORD dwFlags; + DWORD iMaxSpeed; + DWORD iTimeToMaxSpeed; + DWORD iCtrlSpeed; + DWORD dwReserved1; + DWORD dwReserved2; + } MOUSEKEYS,*LPMOUSEKEYS; + +#define MKF_MOUSEKEYSON 0x00000001 +#define MKF_AVAILABLE 0x00000002 +#define MKF_HOTKEYACTIVE 0x00000004 +#define MKF_CONFIRMHOTKEY 0x00000008 +#define MKF_HOTKEYSOUND 0x00000010 +#define MKF_INDICATOR 0x00000020 +#define MKF_MODIFIERS 0x00000040 +#define MKF_REPLACENUMBERS 0x00000080 +#define MKF_LEFTBUTTONSEL 0x10000000 +#define MKF_RIGHTBUTTONSEL 0x20000000 +#define MKF_LEFTBUTTONDOWN 0x01000000 +#define MKF_RIGHTBUTTONDOWN 0x02000000 +#define MKF_MOUSEMODE 0x80000000 + + typedef struct tagACCESSTIMEOUT { + UINT cbSize; + DWORD dwFlags; + DWORD iTimeOutMSec; + } ACCESSTIMEOUT,*LPACCESSTIMEOUT; + +#define ATF_TIMEOUTON 0x00000001 +#define ATF_ONOFFFEEDBACK 0x00000002 + +#define SSGF_NONE 0 +#define SSGF_DISPLAY 3 + +#define SSTF_NONE 0 +#define SSTF_CHARS 1 +#define SSTF_BORDER 2 +#define SSTF_DISPLAY 3 + +#define SSWF_NONE 0 +#define SSWF_TITLE 1 +#define SSWF_WINDOW 2 +#define SSWF_DISPLAY 3 +#define SSWF_CUSTOM 4 + + typedef struct tagSOUNDSENTRYA { + UINT cbSize; + DWORD dwFlags; + DWORD iFSTextEffect; + DWORD iFSTextEffectMSec; + DWORD iFSTextEffectColorBits; + DWORD iFSGrafEffect; + DWORD iFSGrafEffectMSec; + DWORD iFSGrafEffectColor; + DWORD iWindowsEffect; + DWORD iWindowsEffectMSec; + LPSTR lpszWindowsEffectDLL; + DWORD iWindowsEffectOrdinal; + } SOUNDSENTRYA,*LPSOUNDSENTRYA; + + typedef struct tagSOUNDSENTRYW { + UINT cbSize; + DWORD dwFlags; + DWORD iFSTextEffect; + DWORD iFSTextEffectMSec; + DWORD iFSTextEffectColorBits; + DWORD iFSGrafEffect; + DWORD iFSGrafEffectMSec; + DWORD iFSGrafEffectColor; + DWORD iWindowsEffect; + DWORD iWindowsEffectMSec; + LPWSTR lpszWindowsEffectDLL; + DWORD iWindowsEffectOrdinal; + } SOUNDSENTRYW,*LPSOUNDSENTRYW; + +#ifdef UNICODE + typedef SOUNDSENTRYW SOUNDSENTRY; + typedef LPSOUNDSENTRYW LPSOUNDSENTRY; +#else + typedef SOUNDSENTRYA SOUNDSENTRY; + typedef LPSOUNDSENTRYA LPSOUNDSENTRY; +#endif + +#define SSF_SOUNDSENTRYON 0x00000001 +#define SSF_AVAILABLE 0x00000002 +#define SSF_INDICATOR 0x00000004 + + typedef struct tagTOGGLEKEYS { + UINT cbSize; + DWORD dwFlags; + } TOGGLEKEYS,*LPTOGGLEKEYS; + +#define TKF_TOGGLEKEYSON 0x00000001 +#define TKF_AVAILABLE 0x00000002 +#define TKF_HOTKEYACTIVE 0x00000004 +#define TKF_CONFIRMHOTKEY 0x00000008 +#define TKF_HOTKEYSOUND 0x00000010 +#define TKF_INDICATOR 0x00000020 + + WINUSERAPI VOID WINAPI SetDebugErrorLevel(DWORD dwLevel); + +#define SLE_ERROR 0x00000001 +#define SLE_MINORERROR 0x00000002 +#define SLE_WARNING 0x00000003 + + WINUSERAPI VOID WINAPI SetLastErrorEx(DWORD dwErrCode,DWORD dwType); + WINUSERAPI int WINAPI InternalGetWindowText(HWND hWnd,LPWSTR pString,int cchMaxCount); + +#ifdef WINNT + WINUSERAPI WINBOOL WINAPI EndTask(HWND hWnd,WINBOOL fShutDown,WINBOOL fForce); +#endif + +#define MONITOR_DEFAULTTONULL 0x00000000 +#define MONITOR_DEFAULTTOPRIMARY 0x00000001 +#define MONITOR_DEFAULTTONEAREST 0x00000002 + + WINUSERAPI HMONITOR WINAPI MonitorFromPoint(POINT pt,DWORD dwFlags); + WINUSERAPI HMONITOR WINAPI MonitorFromRect(LPCRECT lprc,DWORD dwFlags); + WINUSERAPI HMONITOR WINAPI MonitorFromWindow(HWND hwnd,DWORD dwFlags); + +#define MONITORINFOF_PRIMARY 0x00000001 + +#ifndef CCHDEVICENAME +#define CCHDEVICENAME 32 +#endif + + typedef struct tagMONITORINFO { + DWORD cbSize; + RECT rcMonitor; + RECT rcWork; + DWORD dwFlags; + } MONITORINFO,*LPMONITORINFO; + +#ifdef __cplusplus + typedef struct tagMONITORINFOEXA : public tagMONITORINFO { + CHAR szDevice[CCHDEVICENAME]; + } MONITORINFOEXA,*LPMONITORINFOEXA; + + typedef struct tagMONITORINFOEXW : public tagMONITORINFO { + WCHAR szDevice[CCHDEVICENAME]; + } MONITORINFOEXW,*LPMONITORINFOEXW; + +#ifdef UNICODE + typedef MONITORINFOEXW MONITORINFOEX; + typedef LPMONITORINFOEXW LPMONITORINFOEX; +#else + typedef MONITORINFOEXA MONITORINFOEX; + typedef LPMONITORINFOEXA LPMONITORINFOEX; +#endif +#else + typedef struct tagMONITORINFOEXA { + MONITORINFO mi; + CHAR szDevice[CCHDEVICENAME]; + } MONITORINFOEXA,*LPMONITORINFOEXA; + + typedef struct tagMONITORINFOEXW { + MONITORINFO mi; + WCHAR szDevice[CCHDEVICENAME]; + } MONITORINFOEXW,*LPMONITORINFOEXW; +#ifdef UNICODE + typedef MONITORINFOEXW MONITORINFOEX; + typedef LPMONITORINFOEXW LPMONITORINFOEX; +#else + typedef MONITORINFOEXA MONITORINFOEX; + typedef LPMONITORINFOEXA LPMONITORINFOEX; +#endif +#endif + +#ifdef UNICODE +#define GetMonitorInfo GetMonitorInfoW +#else +#define GetMonitorInfo GetMonitorInfoA +#endif + + WINUSERAPI WINBOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor,LPMONITORINFO lpmi); + WINUSERAPI WINBOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor,LPMONITORINFO lpmi); + + typedef WINBOOL (CALLBACK *MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM); + + WINUSERAPI WINBOOL WINAPI EnumDisplayMonitors(HDC hdc,LPCRECT lprcClip,MONITORENUMPROC lpfnEnum,LPARAM dwData); + +#ifndef NOWINABLE + WINUSERAPI VOID WINAPI NotifyWinEvent(DWORD event,HWND hwnd,LONG idObject,LONG idChild); + + typedef VOID (CALLBACK *WINEVENTPROC)(HWINEVENTHOOK hWinEventHook,DWORD event,HWND hwnd,LONG idObject,LONG idChild,DWORD idEventThread,DWORD dwmsEventTime); + + WINUSERAPI HWINEVENTHOOK WINAPI SetWinEventHook(DWORD eventMin,DWORD eventMax,HMODULE hmodWinEventProc,WINEVENTPROC pfnWinEventProc,DWORD idProcess,DWORD idThread,DWORD dwFlags); + WINUSERAPI WINBOOL WINAPI IsWinEventHookInstalled(DWORD event); + +#define WINEVENT_OUTOFCONTEXT 0x0000 +#define WINEVENT_SKIPOWNTHREAD 0x0001 +#define WINEVENT_SKIPOWNPROCESS 0x0002 +#define WINEVENT_INCONTEXT 0x0004 + + WINUSERAPI WINBOOL WINAPI UnhookWinEvent(HWINEVENTHOOK hWinEventHook); + +#define CHILDID_SELF 0 +#define INDEXID_OBJECT 0 +#define INDEXID_CONTAINER 0 + +#define OBJID_WINDOW ((LONG)0x00000000) +#define OBJID_SYSMENU ((LONG)0xFFFFFFFF) +#define OBJID_TITLEBAR ((LONG)0xFFFFFFFE) +#define OBJID_MENU ((LONG)0xFFFFFFFD) +#define OBJID_CLIENT ((LONG)0xFFFFFFFC) +#define OBJID_VSCROLL ((LONG)0xFFFFFFFB) +#define OBJID_HSCROLL ((LONG)0xFFFFFFFA) +#define OBJID_SIZEGRIP ((LONG)0xFFFFFFF9) +#define OBJID_CARET ((LONG)0xFFFFFFF8) +#define OBJID_CURSOR ((LONG)0xFFFFFFF7) +#define OBJID_ALERT ((LONG)0xFFFFFFF6) +#define OBJID_SOUND ((LONG)0xFFFFFFF5) +#define OBJID_QUERYCLASSNAMEIDX ((LONG)0xFFFFFFF4) +#define OBJID_NATIVEOM ((LONG)0xFFFFFFF0) + +#define EVENT_MIN 0x00000001 +#define EVENT_MAX 0x7FFFFFFF + +#define EVENT_SYSTEM_SOUND 0x0001 +#define EVENT_SYSTEM_ALERT 0x0002 +#define EVENT_SYSTEM_FOREGROUND 0x0003 +#define EVENT_SYSTEM_MENUSTART 0x0004 +#define EVENT_SYSTEM_MENUEND 0x0005 +#define EVENT_SYSTEM_MENUPOPUPSTART 0x0006 +#define EVENT_SYSTEM_MENUPOPUPEND 0x0007 +#define EVENT_SYSTEM_CAPTURESTART 0x0008 +#define EVENT_SYSTEM_CAPTUREEND 0x0009 +#define EVENT_SYSTEM_MOVESIZESTART 0x000A +#define EVENT_SYSTEM_MOVESIZEEND 0x000B +#define EVENT_SYSTEM_CONTEXTHELPSTART 0x000C +#define EVENT_SYSTEM_CONTEXTHELPEND 0x000D +#define EVENT_SYSTEM_DRAGDROPSTART 0x000E +#define EVENT_SYSTEM_DRAGDROPEND 0x000F +#define EVENT_SYSTEM_DIALOGSTART 0x0010 +#define EVENT_SYSTEM_DIALOGEND 0x0011 +#define EVENT_SYSTEM_SCROLLINGSTART 0x0012 +#define EVENT_SYSTEM_SCROLLINGEND 0x0013 +#define EVENT_SYSTEM_SWITCHSTART 0x0014 +#define EVENT_SYSTEM_SWITCHEND 0x0015 +#define EVENT_SYSTEM_MINIMIZESTART 0x0016 +#define EVENT_SYSTEM_MINIMIZEEND 0x0017 + +#define EVENT_CONSOLE_CARET 0x4001 +#define EVENT_CONSOLE_UPDATE_REGION 0x4002 +#define EVENT_CONSOLE_UPDATE_SIMPLE 0x4003 +#define EVENT_CONSOLE_UPDATE_SCROLL 0x4004 +#define EVENT_CONSOLE_LAYOUT 0x4005 +#define EVENT_CONSOLE_START_APPLICATION 0x4006 +#define EVENT_CONSOLE_END_APPLICATION 0x4007 + +#define CONSOLE_APPLICATION_16BIT 0x0001 + +#define CONSOLE_CARET_SELECTION 0x0001 +#define CONSOLE_CARET_VISIBLE 0x0002 + +#define EVENT_OBJECT_CREATE 0x8000 +#define EVENT_OBJECT_DESTROY 0x8001 +#define EVENT_OBJECT_SHOW 0x8002 +#define EVENT_OBJECT_HIDE 0x8003 +#define EVENT_OBJECT_REORDER 0x8004 + +#define EVENT_OBJECT_FOCUS 0x8005 +#define EVENT_OBJECT_SELECTION 0x8006 +#define EVENT_OBJECT_SELECTIONADD 0x8007 +#define EVENT_OBJECT_SELECTIONREMOVE 0x8008 +#define EVENT_OBJECT_SELECTIONWITHIN 0x8009 + +#define EVENT_OBJECT_STATECHANGE 0x800A + +#define EVENT_OBJECT_LOCATIONCHANGE 0x800B + +#define EVENT_OBJECT_NAMECHANGE 0x800C +#define EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D +#define EVENT_OBJECT_VALUECHANGE 0x800E +#define EVENT_OBJECT_PARENTCHANGE 0x800F +#define EVENT_OBJECT_HELPCHANGE 0x8010 +#define EVENT_OBJECT_DEFACTIONCHANGE 0x8011 +#define EVENT_OBJECT_ACCELERATORCHANGE 0x8012 + +#define SOUND_SYSTEM_STARTUP 1 +#define SOUND_SYSTEM_SHUTDOWN 2 +#define SOUND_SYSTEM_BEEP 3 +#define SOUND_SYSTEM_ERROR 4 +#define SOUND_SYSTEM_QUESTION 5 +#define SOUND_SYSTEM_WARNING 6 +#define SOUND_SYSTEM_INFORMATION 7 +#define SOUND_SYSTEM_MAXIMIZE 8 +#define SOUND_SYSTEM_MINIMIZE 9 +#define SOUND_SYSTEM_RESTOREUP 10 +#define SOUND_SYSTEM_RESTOREDOWN 11 +#define SOUND_SYSTEM_APPSTART 12 +#define SOUND_SYSTEM_FAULT 13 +#define SOUND_SYSTEM_APPEND 14 +#define SOUND_SYSTEM_MENUCOMMAND 15 +#define SOUND_SYSTEM_MENUPOPUP 16 +#define CSOUND_SYSTEM 16 + +#define ALERT_SYSTEM_INFORMATIONAL 1 +#define ALERT_SYSTEM_WARNING 2 +#define ALERT_SYSTEM_ERROR 3 +#define ALERT_SYSTEM_QUERY 4 +#define ALERT_SYSTEM_CRITICAL 5 +#define CALERT_SYSTEM 6 + + typedef struct tagGUITHREADINFO { + DWORD cbSize; + DWORD flags; + HWND hwndActive; + HWND hwndFocus; + HWND hwndCapture; + HWND hwndMenuOwner; + HWND hwndMoveSize; + HWND hwndCaret; + RECT rcCaret; + } GUITHREADINFO,*PGUITHREADINFO,*LPGUITHREADINFO; + +#define GUI_CARETBLINKING 0x00000001 +#define GUI_INMOVESIZE 0x00000002 +#define GUI_INMENUMODE 0x00000004 +#define GUI_SYSTEMMENUMODE 0x00000008 +#define GUI_POPUPMENUMODE 0x00000010 +#define GUI_16BITTASK 0x00000020 + +#ifdef UNICODE +#define GetWindowModuleFileName GetWindowModuleFileNameW +#else +#define GetWindowModuleFileName GetWindowModuleFileNameA +#endif + + WINUSERAPI WINBOOL WINAPI GetGUIThreadInfo(DWORD idThread,PGUITHREADINFO pgui); + WINUSERAPI UINT WINAPI GetWindowModuleFileNameA(HWND hwnd,LPSTR pszFileName,UINT cchFileNameMax); + WINUSERAPI UINT WINAPI GetWindowModuleFileNameW(HWND hwnd,LPWSTR pszFileName,UINT cchFileNameMax); + +#ifndef NO_STATE_FLAGS +#define STATE_SYSTEM_UNAVAILABLE 0x00000001 +#define STATE_SYSTEM_SELECTED 0x00000002 +#define STATE_SYSTEM_FOCUSED 0x00000004 +#define STATE_SYSTEM_PRESSED 0x00000008 +#define STATE_SYSTEM_CHECKED 0x00000010 +#define STATE_SYSTEM_MIXED 0x00000020 +#define STATE_SYSTEM_INDETERMINATE STATE_SYSTEM_MIXED +#define STATE_SYSTEM_READONLY 0x00000040 +#define STATE_SYSTEM_HOTTRACKED 0x00000080 +#define STATE_SYSTEM_DEFAULT 0x00000100 +#define STATE_SYSTEM_EXPANDED 0x00000200 +#define STATE_SYSTEM_COLLAPSED 0x00000400 +#define STATE_SYSTEM_BUSY 0x00000800 +#define STATE_SYSTEM_FLOATING 0x00001000 +#define STATE_SYSTEM_MARQUEED 0x00002000 +#define STATE_SYSTEM_ANIMATED 0x00004000 +#define STATE_SYSTEM_INVISIBLE 0x00008000 +#define STATE_SYSTEM_OFFSCREEN 0x00010000 +#define STATE_SYSTEM_SIZEABLE 0x00020000 +#define STATE_SYSTEM_MOVEABLE 0x00040000 +#define STATE_SYSTEM_SELFVOICING 0x00080000 +#define STATE_SYSTEM_FOCUSABLE 0x00100000 +#define STATE_SYSTEM_SELECTABLE 0x00200000 +#define STATE_SYSTEM_LINKED 0x00400000 +#define STATE_SYSTEM_TRAVERSED 0x00800000 +#define STATE_SYSTEM_MULTISELECTABLE 0x01000000 +#define STATE_SYSTEM_EXTSELECTABLE 0x02000000 +#define STATE_SYSTEM_ALERT_LOW 0x04000000 +#define STATE_SYSTEM_ALERT_MEDIUM 0x08000000 +#define STATE_SYSTEM_ALERT_HIGH 0x10000000 +#define STATE_SYSTEM_PROTECTED 0x20000000 +#define STATE_SYSTEM_VALID 0x3FFFFFFF +#endif + +#define CCHILDREN_TITLEBAR 5 +#define CCHILDREN_SCROLLBAR 5 + + typedef struct tagCURSORINFO { + DWORD cbSize; + DWORD flags; + HCURSOR hCursor; + POINT ptScreenPos; + } CURSORINFO,*PCURSORINFO,*LPCURSORINFO; + +#define CURSOR_SHOWING 0x00000001 + + WINUSERAPI WINBOOL WINAPI GetCursorInfo(PCURSORINFO pci); + + typedef struct tagWINDOWINFO { + DWORD cbSize; + RECT rcWindow; + RECT rcClient; + DWORD dwStyle; + DWORD dwExStyle; + DWORD dwWindowStatus; + UINT cxWindowBorders; + UINT cyWindowBorders; + ATOM atomWindowType; + WORD wCreatorVersion; + } WINDOWINFO,*PWINDOWINFO,*LPWINDOWINFO; + +#define WS_ACTIVECAPTION 0x0001 + + WINUSERAPI WINBOOL WINAPI GetWindowInfo(HWND hwnd,PWINDOWINFO pwi); + + typedef struct tagTITLEBARINFO { + DWORD cbSize; + RECT rcTitleBar; + DWORD rgstate[CCHILDREN_TITLEBAR + 1]; + } TITLEBARINFO,*PTITLEBARINFO,*LPTITLEBARINFO; + + WINUSERAPI WINBOOL WINAPI GetTitleBarInfo(HWND hwnd,PTITLEBARINFO pti); + + typedef struct tagMENUBARINFO { + DWORD cbSize; + RECT rcBar; + HMENU hMenu; + HWND hwndMenu; + WINBOOL fBarFocused:1; + WINBOOL fFocused:1; + } MENUBARINFO,*PMENUBARINFO,*LPMENUBARINFO; + + WINUSERAPI WINBOOL WINAPI GetMenuBarInfo(HWND hwnd,LONG idObject,LONG idItem,PMENUBARINFO pmbi); + + typedef struct tagSCROLLBARINFO { + DWORD cbSize; + RECT rcScrollBar; + int dxyLineButton; + int xyThumbTop; + int xyThumbBottom; + int reserved; + DWORD rgstate[CCHILDREN_SCROLLBAR + 1]; + } SCROLLBARINFO,*PSCROLLBARINFO,*LPSCROLLBARINFO; + + WINUSERAPI WINBOOL WINAPI GetScrollBarInfo(HWND hwnd,LONG idObject,PSCROLLBARINFO psbi); + + typedef struct tagCOMBOBOXINFO { + DWORD cbSize; + RECT rcItem; + RECT rcButton; + DWORD stateButton; + HWND hwndCombo; + HWND hwndItem; + HWND hwndList; + } COMBOBOXINFO,*PCOMBOBOXINFO,*LPCOMBOBOXINFO; + + WINUSERAPI WINBOOL WINAPI GetComboBoxInfo(HWND hwndCombo,PCOMBOBOXINFO pcbi); + +#define GA_PARENT 1 +#define GA_ROOT 2 +#define GA_ROOTOWNER 3 + + WINUSERAPI HWND WINAPI GetAncestor(HWND hwnd,UINT gaFlags); + WINUSERAPI HWND WINAPI RealChildWindowFromPoint(HWND hwndParent,POINT ptParentClientCoords); + WINUSERAPI UINT WINAPI RealGetWindowClassA(HWND hwnd,LPSTR ptszClassName,UINT cchClassNameMax); + WINUSERAPI UINT WINAPI RealGetWindowClassW(HWND hwnd,LPWSTR ptszClassName,UINT cchClassNameMax); +#ifdef UNICODE +#define RealGetWindowClass RealGetWindowClassW +#else +#define RealGetWindowClass RealGetWindowClassA +#endif + + typedef struct tagALTTABINFO { + DWORD cbSize; + int cItems; + int cColumns; + int cRows; + int iColFocus; + int iRowFocus; + int cxItem; + int cyItem; + POINT ptStart; + } ALTTABINFO,*PALTTABINFO,*LPALTTABINFO; + +#ifdef UNICODE +#define GetAltTabInfo GetAltTabInfoW +#else +#define GetAltTabInfo GetAltTabInfoA +#endif + + WINUSERAPI WINBOOL WINAPI GetAltTabInfoA(HWND hwnd,int iItem,PALTTABINFO pati,LPSTR pszItemText,UINT cchItemText); + WINUSERAPI WINBOOL WINAPI GetAltTabInfoW(HWND hwnd,int iItem,PALTTABINFO pati,LPWSTR pszItemText,UINT cchItemText); + WINUSERAPI DWORD WINAPI GetListBoxInfo(HWND hwnd); +#endif + + WINUSERAPI WINBOOL WINAPI LockWorkStation(VOID); + WINUSERAPI WINBOOL WINAPI UserHandleGrantAccess(HANDLE hUserHandle,HANDLE hJob,WINBOOL bGrant); + + DECLARE_HANDLE(HRAWINPUT); + +#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff) + +#define RIM_INPUT 0 +#define RIM_INPUTSINK 1 + + typedef struct tagRAWINPUTHEADER { + DWORD dwType; + DWORD dwSize; + HANDLE hDevice; + WPARAM wParam; + } RAWINPUTHEADER,*PRAWINPUTHEADER,*LPRAWINPUTHEADER; + +#define RIM_TYPEMOUSE 0 +#define RIM_TYPEKEYBOARD 1 +#define RIM_TYPEHID 2 + + typedef struct tagRAWMOUSE { + USHORT usFlags; + union { + ULONG ulButtons; + struct { + USHORT usButtonFlags; + USHORT usButtonData; + }; + }; + ULONG ulRawButtons; + LONG lLastX; + LONG lLastY; + ULONG ulExtraInformation; + } RAWMOUSE,*PRAWMOUSE,*LPRAWMOUSE; + +#define RI_MOUSE_LEFT_BUTTON_DOWN 0x0001 +#define RI_MOUSE_LEFT_BUTTON_UP 0x0002 +#define RI_MOUSE_RIGHT_BUTTON_DOWN 0x0004 +#define RI_MOUSE_RIGHT_BUTTON_UP 0x0008 +#define RI_MOUSE_MIDDLE_BUTTON_DOWN 0x0010 +#define RI_MOUSE_MIDDLE_BUTTON_UP 0x0020 + +#define RI_MOUSE_BUTTON_1_DOWN RI_MOUSE_LEFT_BUTTON_DOWN +#define RI_MOUSE_BUTTON_1_UP RI_MOUSE_LEFT_BUTTON_UP +#define RI_MOUSE_BUTTON_2_DOWN RI_MOUSE_RIGHT_BUTTON_DOWN +#define RI_MOUSE_BUTTON_2_UP RI_MOUSE_RIGHT_BUTTON_UP +#define RI_MOUSE_BUTTON_3_DOWN RI_MOUSE_MIDDLE_BUTTON_DOWN +#define RI_MOUSE_BUTTON_3_UP RI_MOUSE_MIDDLE_BUTTON_UP + +#define RI_MOUSE_BUTTON_4_DOWN 0x0040 +#define RI_MOUSE_BUTTON_4_UP 0x0080 +#define RI_MOUSE_BUTTON_5_DOWN 0x0100 +#define RI_MOUSE_BUTTON_5_UP 0x0200 + +#define RI_MOUSE_WHEEL 0x0400 + +#define MOUSE_MOVE_RELATIVE 0 +#define MOUSE_MOVE_ABSOLUTE 1 +#define MOUSE_VIRTUAL_DESKTOP 0x02 +#define MOUSE_ATTRIBUTES_CHANGED 0x04 + + typedef struct tagRAWKEYBOARD { + USHORT MakeCode; + USHORT Flags; + USHORT Reserved; + USHORT VKey; + UINT Message; + ULONG ExtraInformation; + } RAWKEYBOARD,*PRAWKEYBOARD,*LPRAWKEYBOARD; + +#define KEYBOARD_OVERRUN_MAKE_CODE 0xFF + +#define RI_KEY_MAKE 0 +#define RI_KEY_BREAK 1 +#define RI_KEY_E0 2 +#define RI_KEY_E1 4 +#define RI_KEY_TERMSRV_SET_LED 8 +#define RI_KEY_TERMSRV_SHADOW 0x10 + + typedef struct tagRAWHID { + DWORD dwSizeHid; + DWORD dwCount; + BYTE bRawData[1]; + } RAWHID,*PRAWHID,*LPRAWHID; + + typedef struct tagRAWINPUT { + RAWINPUTHEADER header; + union { + RAWMOUSE mouse; + RAWKEYBOARD keyboard; + RAWHID hid; + } data; + } RAWINPUT,*PRAWINPUT,*LPRAWINPUT; + +#ifdef _WIN64 +#define RAWINPUT_ALIGN(x) (((x) + sizeof(QWORD) - 1) & ~(sizeof(QWORD) - 1)) +#else +#define RAWINPUT_ALIGN(x) (((x) + sizeof(DWORD) - 1) & ~(sizeof(DWORD) - 1)) +#endif + +#define NEXTRAWINPUTBLOCK(ptr) ((PRAWINPUT)RAWINPUT_ALIGN((ULONG_PTR)((PBYTE)(ptr) + (ptr)->header.dwSize))) + +#define RID_INPUT 0x10000003 +#define RID_HEADER 0x10000005 + + WINUSERAPI UINT WINAPI GetRawInputData(HRAWINPUT hRawInput,UINT uiCommand,LPVOID pData,PUINT pcbSize,UINT cbSizeHeader); + +#define RIDI_PREPARSEDDATA 0x20000005 +#define RIDI_DEVICENAME 0x20000007 +#define RIDI_DEVICEINFO 0x2000000b + + typedef struct tagRID_DEVICE_INFO_MOUSE { + DWORD dwId; + DWORD dwNumberOfButtons; + DWORD dwSampleRate; + } RID_DEVICE_INFO_MOUSE,*PRID_DEVICE_INFO_MOUSE; + + typedef struct tagRID_DEVICE_INFO_KEYBOARD { + DWORD dwType; + DWORD dwSubType; + DWORD dwKeyboardMode; + DWORD dwNumberOfFunctionKeys; + DWORD dwNumberOfIndicators; + DWORD dwNumberOfKeysTotal; + } RID_DEVICE_INFO_KEYBOARD,*PRID_DEVICE_INFO_KEYBOARD; + + typedef struct tagRID_DEVICE_INFO_HID { + DWORD dwVendorId; + DWORD dwProductId; + DWORD dwVersionNumber; + USHORT usUsagePage; + USHORT usUsage; + } RID_DEVICE_INFO_HID,*PRID_DEVICE_INFO_HID; + + typedef struct tagRID_DEVICE_INFO { + DWORD cbSize; + DWORD dwType; + union { + RID_DEVICE_INFO_MOUSE mouse; + RID_DEVICE_INFO_KEYBOARD keyboard; + RID_DEVICE_INFO_HID hid; + }; + } RID_DEVICE_INFO,*PRID_DEVICE_INFO,*LPRID_DEVICE_INFO; + +#ifdef UNICODE +#define GetRawInputDeviceInfo GetRawInputDeviceInfoW +#else +#define GetRawInputDeviceInfo GetRawInputDeviceInfoA +#endif + + WINUSERAPI UINT WINAPI GetRawInputDeviceInfoA(HANDLE hDevice,UINT uiCommand,LPVOID pData,PUINT pcbSize); + WINUSERAPI UINT WINAPI GetRawInputDeviceInfoW(HANDLE hDevice,UINT uiCommand,LPVOID pData,PUINT pcbSize); + WINUSERAPI UINT WINAPI GetRawInputBuffer(PRAWINPUT pData,PUINT pcbSize,UINT cbSizeHeader); + + typedef struct tagRAWINPUTDEVICE { + USHORT usUsagePage; + USHORT usUsage; + DWORD dwFlags; + HWND hwndTarget; + } RAWINPUTDEVICE,*PRAWINPUTDEVICE,*LPRAWINPUTDEVICE; + + typedef CONST RAWINPUTDEVICE *PCRAWINPUTDEVICE; + +#define RIDEV_REMOVE 0x00000001 +#define RIDEV_EXCLUDE 0x00000010 +#define RIDEV_PAGEONLY 0x00000020 +#define RIDEV_NOLEGACY 0x00000030 +#define RIDEV_INPUTSINK 0x00000100 +#define RIDEV_CAPTUREMOUSE 0x00000200 +#define RIDEV_NOHOTKEYS 0x00000200 +#define RIDEV_APPKEYS 0x00000400 +#define RIDEV_EXMODEMASK 0x000000F0 +#define RIDEV_EXMODE(mode) ((mode) & RIDEV_EXMODEMASK) + + WINUSERAPI WINBOOL WINAPI RegisterRawInputDevices(PCRAWINPUTDEVICE pRawInputDevices,UINT uiNumDevices,UINT cbSize); + WINUSERAPI UINT WINAPI GetRegisteredRawInputDevices(PRAWINPUTDEVICE pRawInputDevices,PUINT puiNumDevices,UINT cbSize); + + typedef struct tagRAWINPUTDEVICELIST { + HANDLE hDevice; + DWORD dwType; + } RAWINPUTDEVICELIST,*PRAWINPUTDEVICELIST; + + WINUSERAPI UINT WINAPI GetRawInputDeviceList(PRAWINPUTDEVICELIST pRawInputDeviceList,PUINT puiNumDevices,UINT cbSize); + WINUSERAPI LRESULT WINAPI DefRawInputProc(PRAWINPUT *paRawInput,INT nInput,UINT cbSizeHeader); + +#endif /* NOUSER */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winver.h b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winver.h new file mode 100644 index 00000000..5c0f036b --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/include/winapi/winver.h @@ -0,0 +1,160 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef VER_H +#define VER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define VS_FILE_INFO RT_VERSION +#define VS_VERSION_INFO 1 +#define VS_USER_DEFINED 100 + +#define VS_FFI_SIGNATURE 0xFEEF04BDL +#define VS_FFI_STRUCVERSION 0x00010000L +#define VS_FFI_FILEFLAGSMASK 0x0000003FL + +#define VS_FF_DEBUG 0x00000001L +#define VS_FF_PRERELEASE 0x00000002L +#define VS_FF_PATCHED 0x00000004L +#define VS_FF_PRIVATEBUILD 0x00000008L +#define VS_FF_INFOINFERRED 0x00000010L +#define VS_FF_SPECIALBUILD 0x00000020L + +#define VOS_UNKNOWN 0x00000000L +#define VOS_DOS 0x00010000L +#define VOS_OS216 0x00020000L +#define VOS_OS232 0x00030000L +#define VOS_NT 0x00040000L +#define VOS_WINCE 0x00050000L + +#define VOS__BASE 0x00000000L +#define VOS__WINDOWS16 0x00000001L +#define VOS__PM16 0x00000002L +#define VOS__PM32 0x00000003L +#define VOS__WINDOWS32 0x00000004L + +#define VOS_DOS_WINDOWS16 0x00010001L +#define VOS_DOS_WINDOWS32 0x00010004L +#define VOS_OS216_PM16 0x00020002L +#define VOS_OS232_PM32 0x00030003L +#define VOS_NT_WINDOWS32 0x00040004L + +#define VFT_UNKNOWN 0x00000000L +#define VFT_APP 0x00000001L +#define VFT_DLL 0x00000002L +#define VFT_DRV 0x00000003L +#define VFT_FONT 0x00000004L +#define VFT_VXD 0x00000005L +#define VFT_STATIC_LIB 0x00000007L + +#define VFT2_UNKNOWN 0x00000000L +#define VFT2_DRV_PRINTER 0x00000001L +#define VFT2_DRV_KEYBOARD 0x00000002L +#define VFT2_DRV_LANGUAGE 0x00000003L +#define VFT2_DRV_DISPLAY 0x00000004L +#define VFT2_DRV_MOUSE 0x00000005L +#define VFT2_DRV_NETWORK 0x00000006L +#define VFT2_DRV_SYSTEM 0x00000007L +#define VFT2_DRV_INSTALLABLE 0x00000008L +#define VFT2_DRV_SOUND 0x00000009L +#define VFT2_DRV_COMM 0x0000000AL +#define VFT2_DRV_INPUTMETHOD 0x0000000BL +#define VFT2_DRV_VERSIONED_PRINTER 0x0000000CL + +#define VFT2_FONT_RASTER 0x00000001L +#define VFT2_FONT_VECTOR 0x00000002L +#define VFT2_FONT_TRUETYPE 0x00000003L + +#define VFFF_ISSHAREDFILE 0x0001 + +#define VFF_CURNEDEST 0x0001 +#define VFF_FILEINUSE 0x0002 +#define VFF_BUFFTOOSMALL 0x0004 + +#define VIFF_FORCEINSTALL 0x0001 +#define VIFF_DONTDELETEOLD 0x0002 + +#define VIF_TEMPFILE 0x00000001L +#define VIF_MISMATCH 0x00000002L +#define VIF_SRCOLD 0x00000004L + +#define VIF_DIFFLANG 0x00000008L +#define VIF_DIFFCODEPG 0x00000010L +#define VIF_DIFFTYPE 0x00000020L + +#define VIF_WRITEPROT 0x00000040L +#define VIF_FILEINUSE 0x00000080L +#define VIF_OUTOFSPACE 0x00000100L +#define VIF_ACCESSVIOLATION 0x00000200L +#define VIF_SHARINGVIOLATION 0x00000400L +#define VIF_CANNOTCREATE 0x00000800L +#define VIF_CANNOTDELETE 0x00001000L +#define VIF_CANNOTRENAME 0x00002000L +#define VIF_CANNOTDELETECUR 0x00004000L +#define VIF_OUTOFMEMORY 0x00008000L + +#define VIF_CANNOTREADSRC 0x00010000L +#define VIF_CANNOTREADDST 0x00020000L + +#define VIF_BUFFTOOSMALL 0x00040000L +#define VIF_CANNOTLOADLZ32 0x00080000L +#define VIF_CANNOTLOADCABINET 0x00100000L + +#ifndef RC_INVOKED + + typedef struct tagVS_FIXEDFILEINFO + { + DWORD dwSignature; + DWORD dwStrucVersion; + DWORD dwFileVersionMS; + DWORD dwFileVersionLS; + DWORD dwProductVersionMS; + DWORD dwProductVersionLS; + DWORD dwFileFlagsMask; + DWORD dwFileFlags; + DWORD dwFileOS; + DWORD dwFileType; + DWORD dwFileSubtype; + DWORD dwFileDateMS; + DWORD dwFileDateLS; + } VS_FIXEDFILEINFO; + +#ifdef UNICODE +#define VerFindFile VerFindFileW +#define VerInstallFile VerInstallFileW +#define GetFileVersionInfoSize GetFileVersionInfoSizeW +#define GetFileVersionInfo GetFileVersionInfoW +#define VerLanguageName VerLanguageNameW +#define VerQueryValue VerQueryValueW +#else +#define VerFindFile VerFindFileA +#define VerInstallFile VerInstallFileA +#define GetFileVersionInfoSize GetFileVersionInfoSizeA +#define GetFileVersionInfo GetFileVersionInfoA +#define VerLanguageName VerLanguageNameA +#define VerQueryValue VerQueryValueA +#endif + + DWORD WINAPI VerFindFileA(DWORD uFlags,LPSTR szFileName,LPSTR szWinDir,LPSTR szAppDir,LPSTR szCurDir,PUINT lpuCurDirLen,LPSTR szDestDir,PUINT lpuDestDirLen); + DWORD WINAPI VerFindFileW(DWORD uFlags,LPWSTR szFileName,LPWSTR szWinDir,LPWSTR szAppDir,LPWSTR szCurDir,PUINT lpuCurDirLen,LPWSTR szDestDir,PUINT lpuDestDirLen); + DWORD WINAPI VerInstallFileA(DWORD uFlags,LPSTR szSrcFileName,LPSTR szDestFileName,LPSTR szSrcDir,LPSTR szDestDir,LPSTR szCurDir,LPSTR szTmpFile,PUINT lpuTmpFileLen); + DWORD WINAPI VerInstallFileW(DWORD uFlags,LPWSTR szSrcFileName,LPWSTR szDestFileName,LPWSTR szSrcDir,LPWSTR szDestDir,LPWSTR szCurDir,LPWSTR szTmpFile,PUINT lpuTmpFileLen); + DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR lptstrFilename,LPDWORD lpdwHandle); + DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR lptstrFilename,LPDWORD lpdwHandle); + WINBOOL WINAPI GetFileVersionInfoA(LPCSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); + WINBOOL WINAPI GetFileVersionInfoW(LPCWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); + DWORD WINAPI VerLanguageNameA(DWORD wLang,LPSTR szLang,DWORD nSize); + DWORD WINAPI VerLanguageNameW(DWORD wLang,LPWSTR szLang,DWORD nSize); + WINBOOL WINAPI VerQueryValueA(const LPVOID pBlock,LPSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); + WINBOOL WINAPI VerQueryValueW(const LPVOID pBlock,LPWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/lib/gdi32.def b/.cache/overlay-toolchain/tcc_extract/tcc/lib/gdi32.def new file mode 100644 index 00000000..02766da4 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/lib/gdi32.def @@ -0,0 +1,337 @@ +LIBRARY gdi32.dll + +EXPORTS +AbortDoc +AbortPath +AddFontResourceA +AddFontResourceW +AngleArc +AnimatePalette +Arc +ArcTo +BeginPath +BitBlt +ByeByeGDI +CancelDC +CheckColorsInGamut +ChoosePixelFormat +Chord +CloseEnhMetaFile +CloseFigure +CloseMetaFile +ColorCorrectPalette +ColorMatchToTarget +CombineRgn +CombineTransform +CopyEnhMetaFileA +CopyEnhMetaFileW +CopyMetaFileA +CopyMetaFileW +CreateBitmap +CreateBitmapIndirect +CreateBrushIndirect +CreateColorSpaceA +CreateColorSpaceW +CreateCompatibleBitmap +CreateCompatibleDC +CreateDCA +CreateDCW +CreateDIBPatternBrush +CreateDIBPatternBrushPt +CreateDIBSection +CreateDIBitmap +CreateDiscardableBitmap +CreateEllipticRgn +CreateEllipticRgnIndirect +CreateEnhMetaFileA +CreateEnhMetaFileW +CreateFontA +CreateFontIndirectA +CreateFontIndirectW +CreateFontW +CreateHalftonePalette +CreateHatchBrush +CreateICA +CreateICW +CreateMetaFileA +CreateMetaFileW +CreatePalette +CreatePatternBrush +CreatePen +CreatePenIndirect +CreatePolyPolygonRgn +CreatePolygonRgn +CreateRectRgn +CreateRectRgnIndirect +CreateRoundRectRgn +CreateScalableFontResourceA +CreateScalableFontResourceW +CreateSolidBrush +DPtoLP +DeleteColorSpace +DeleteDC +DeleteEnhMetaFile +DeleteMetaFile +DeleteObject +DescribePixelFormat +DeviceCapabilitiesEx +DeviceCapabilitiesExA +DeviceCapabilitiesExW +DrawEscape +Ellipse +EnableEUDC +EndDoc +EndPage +EndPath +EnumEnhMetaFile +EnumFontFamiliesA +EnumFontFamiliesExA +EnumFontFamiliesExW +EnumFontFamiliesW +EnumFontsA +EnumFontsW +EnumICMProfilesA +EnumICMProfilesW +EnumMetaFile +EnumObjects +EqualRgn +Escape +ExcludeClipRect +ExtCreatePen +ExtCreateRegion +ExtEscape +ExtFloodFill +ExtSelectClipRgn +ExtTextOutA +ExtTextOutW +FillPath +FillRgn +FixBrushOrgEx +FlattenPath +FloodFill +FrameRgn +GdiComment +GdiFlush +GdiGetBatchLimit +GdiPlayDCScript +GdiPlayJournal +GdiPlayScript +GdiSetBatchLimit +GetArcDirection +GetAspectRatioFilterEx +GetBitmapBits +GetBitmapDimensionEx +GetBkColor +GetBkMode +GetBoundsRect +GetBrushOrgEx +GetCharABCWidthsA +GetCharABCWidthsFloatA +GetCharABCWidthsFloatW +GetCharABCWidthsW +GetCharWidth32A +GetCharWidth32W +GetCharWidthA +GetCharWidthFloatA +GetCharWidthFloatW +GetCharWidthW +GetCharacterPlacementA +GetCharacterPlacementW +GetClipBox +GetClipRgn +GetColorAdjustment +GetColorSpace +GetCurrentObject +GetCurrentPositionEx +GetDCOrgEx +GetDIBColorTable +GetDIBits +GetDeviceCaps +GetDeviceGammaRamp +GetEnhMetaFileA +GetEnhMetaFileBits +GetEnhMetaFileDescriptionA +GetEnhMetaFileDescriptionW +GetEnhMetaFileHeader +GetEnhMetaFilePaletteEntries +GetEnhMetaFileW +GetFontData +GetFontLanguageInfo +GetFontResourceInfo +GetGlyphOutline +GetGlyphOutlineA +GetGlyphOutlineW +GetGraphicsMode +GetICMProfileA +GetICMProfileW +GetKerningPairs +GetKerningPairsA +GetKerningPairsW +GetLayout +GetLogColorSpaceA +GetLogColorSpaceW +GetMapMode +GetMetaFileA +GetMetaFileBitsEx +GetMetaFileW +GetMetaRgn +GetMiterLimit +GetNearestColor +GetNearestPaletteIndex +GetObjectA +GetObjectType +GetObjectW +GetOutlineTextMetricsA +GetOutlineTextMetricsW +GetPaletteEntries +GetPath +GetPixel +GetPixelFormat +GetPolyFillMode +GetROP2 +GetRandomRgn +GetRasterizerCaps +GetRegionData +GetRgnBox +GetStockObject +GetStretchBltMode +GetSystemPaletteEntries +GetSystemPaletteUse +GetTextAlign +GetTextCharacterExtra +GetTextCharset +GetTextCharsetInfo +GetTextColor +GetTextExtentExPointA +GetTextExtentExPointW +GetTextExtentPoint32A +GetTextExtentPoint32W +GetTextExtentPointA +GetTextExtentPointW +GetTextFaceA +GetTextFaceW +GetTextMetricsA +GetTextMetricsW +GetViewportExtEx +GetViewportOrgEx +GetWinMetaFileBits +GetWindowExtEx +GetWindowOrgEx +GetWorldTransform +IntersectClipRect +InvertRgn +LPtoDP +LineDDA +LineTo +MaskBlt +ModifyWorldTransform +MoveToEx +OffsetClipRgn +OffsetRgn +OffsetViewportOrgEx +OffsetWindowOrgEx +PaintRgn +PatBlt +PathToRegion +Pie +PlayEnhMetaFile +PlayEnhMetaFileRecord +PlayMetaFile +PlayMetaFileRecord +PlgBlt +PolyBezier +PolyBezierTo +PolyDraw +PolyPolygon +PolyPolyline +PolyTextOutA +PolyTextOutW +Polygon +Polyline +PolylineTo +PtInRegion +PtVisible +RealizePalette +RectInRegion +RectVisible +Rectangle +RemoveFontResourceA +RemoveFontResourceW +ResetDCA +ResetDCW +ResizePalette +RestoreDC +RoundRect +SaveDC +ScaleViewportExtEx +ScaleWindowExtEx +SelectClipPath +SelectClipRgn +SelectObject +SelectPalette +SetAbortProc +SetArcDirection +SetBitmapBits +SetBitmapDimensionEx +SetBkColor +SetBkMode +SetBoundsRect +SetBrushOrgEx +SetColorAdjustment +SetColorSpace +SetDIBColorTable +SetDIBits +SetDIBitsToDevice +SetDeviceGammaRamp +SetEnhMetaFileBits +SetFontEnumeration +SetGraphicsMode +SetICMMode +SetICMProfileA +SetICMProfileW +SetLayout +SetMagicColors +SetMapMode +SetMapperFlags +SetMetaFileBitsEx +SetMetaRgn +SetMiterLimit +SetObjectOwner +SetPaletteEntries +SetPixel +SetPixelFormat +SetPixelV +SetPolyFillMode +SetROP2 +SetRectRgn +SetStretchBltMode +SetSystemPaletteUse +SetTextAlign +SetTextCharacterExtra +SetTextColor +SetTextJustification +SetViewportExtEx +SetViewportOrgEx +SetWinMetaFileBits +SetWindowExtEx +SetWindowOrgEx +SetWorldTransform +StartDocA +StartDocW +StartPage +StretchBlt +StretchDIBits +StrokeAndFillPath +StrokePath +SwapBuffers +TextOutA +TextOutW +TranslateCharsetInfo +UnrealizeObject +UpdateColors +UpdateICMRegKeyA +UpdateICMRegKeyW +WidenPath +gdiPlaySpoolStream +pfnRealizePalette +pfnSelectPalette diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/lib/kernel32.def b/.cache/overlay-toolchain/tcc_extract/tcc/lib/kernel32.def new file mode 100644 index 00000000..f03e17ba --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/lib/kernel32.def @@ -0,0 +1,770 @@ +LIBRARY kernel32.dll + +EXPORTS +AddAtomA +AddAtomW +AllocConsole +AllocLSCallback +AllocSLCallback +AreFileApisANSI +BackupRead +BackupSeek +BackupWrite +Beep +BeginUpdateResourceA +BeginUpdateResourceW +BuildCommDCBA +BuildCommDCBAndTimeoutsA +BuildCommDCBAndTimeoutsW +BuildCommDCBW +CallNamedPipeA +CallNamedPipeW +Callback12 +Callback16 +Callback20 +Callback24 +Callback28 +Callback32 +Callback36 +Callback4 +Callback40 +Callback44 +Callback48 +Callback52 +Callback56 +Callback60 +Callback64 +Callback8 +CancelDeviceWakeupRequest +CancelIo +CancelWaitableTimer +ClearCommBreak +ClearCommError +CloseHandle +CloseProfileUserMapping +CloseSystemHandle +CommConfigDialogA +CommConfigDialogW +CompareFileTime +CompareStringA +CompareStringW +ConnectNamedPipe +ContinueDebugEvent +ConvertDefaultLocale +ConvertThreadToFiber +ConvertToGlobalHandle +CopyFileA +CopyFileExA +CopyFileExW +CopyFileW +CreateConsoleScreenBuffer +CreateDirectoryA +CreateDirectoryExA +CreateDirectoryExW +CreateDirectoryW +CreateEventA +CreateEventW +CreateFiber +CreateFileA +CreateFileMappingA +CreateFileMappingW +CreateFileW +CreateIoCompletionPort +CreateKernelThread +CreateMailslotA +CreateMailslotW +CreateMutexA +CreateMutexW +CreateNamedPipeA +CreateNamedPipeW +CreatePipe +CreateProcessA +CreateProcessW +CreateRemoteThread +CreateSemaphoreA +CreateSemaphoreW +CreateSocketHandle +CreateTapePartition +CreateThread +CreateToolhelp32Snapshot +CreateWaitableTimerA +CreateWaitableTimerW +DebugActiveProcess +DebugBreak +DefineDosDeviceA +DefineDosDeviceW +DeleteAtom +DeleteCriticalSection +DeleteFiber +DeleteFileA +DeleteFileW +DeviceIoControl +DisableThreadLibraryCalls +DisconnectNamedPipe +DosDateTimeToFileTime +DuplicateHandle +EndUpdateResourceA +EndUpdateResourceW +EnterCriticalSection +EnumCalendarInfoA +EnumCalendarInfoExA +EnumCalendarInfoExW +EnumCalendarInfoW +EnumDateFormatsA +EnumDateFormatsExA +EnumDateFormatsExW +EnumDateFormatsW +EnumLanguageGroupLocalesA +EnumLanguageGroupLocalesW +EnumResourceLanguagesA +EnumResourceLanguagesW +EnumResourceNamesA +EnumResourceNamesW +EnumResourceTypesA +EnumResourceTypesW +EnumSystemCodePagesA +EnumSystemCodePagesW +EnumSystemGeoID +EnumSystemLanguageGroupsA +EnumSystemLanguageGroupsW +EnumSystemLocalesA +EnumSystemLocalesW +EnumTimeFormatsA +EnumTimeFormatsW +EnumUILanguagesA +EnumUILanguagesW +EraseTape +EscapeCommFunction +ExitProcess +ExitThread +ExpandEnvironmentStringsA +ExpandEnvironmentStringsW +FT_Exit0 +FT_Exit12 +FT_Exit16 +FT_Exit20 +FT_Exit24 +FT_Exit28 +FT_Exit32 +FT_Exit36 +FT_Exit4 +FT_Exit40 +FT_Exit44 +FT_Exit48 +FT_Exit52 +FT_Exit56 +FT_Exit8 +FT_Prolog +FT_Thunk +FatalAppExitA +FatalAppExitW +FatalExit +FileTimeToDosDateTime +FileTimeToLocalFileTime +FileTimeToSystemTime +FillConsoleOutputAttribute +FillConsoleOutputCharacterA +FillConsoleOutputCharacterW +FindAtomA +FindAtomW +FindClose +FindCloseChangeNotification +FindFirstChangeNotificationA +FindFirstChangeNotificationW +FindFirstFileA +FindFirstFileExA +FindFirstFileExW +FindFirstFileW +FindNextChangeNotification +FindNextFileA +FindNextFileW +FindResourceA +FindResourceExA +FindResourceExW +FindResourceW +FlushConsoleInputBuffer +FlushFileBuffers +FlushInstructionCache +FlushViewOfFile +FoldStringA +FoldStringW +FormatMessageA +FormatMessageW +FreeConsole +FreeEnvironmentStringsA +FreeEnvironmentStringsW +FreeLSCallback +FreeLibrary +FreeLibraryAndExitThread +FreeResource +FreeSLCallback +GenerateConsoleCtrlEvent +GetACP +GetAtomNameA +GetAtomNameW +GetBinaryType +GetBinaryTypeA +GetBinaryTypeW +GetCPInfo +GetCPInfoExA +GetCPInfoExW +GetCalendarInfoA +GetCalendarInfoW +GetCommConfig +GetCommMask +GetCommModemStatus +GetCommProperties +GetCommState +GetCommTimeouts +GetCommandLineA +GetCommandLineW +GetCompressedFileSizeA +GetCompressedFileSizeW +GetComputerNameA +GetComputerNameW +GetConsoleCP +GetConsoleCursorInfo +GetConsoleMode +GetConsoleOutputCP +GetConsoleScreenBufferInfo +GetConsoleTitleA +GetConsoleTitleW +GetCurrencyFormatA +GetCurrencyFormatW +GetCurrentDirectoryA +GetCurrentDirectoryW +GetCurrentProcess +GetCurrentProcessId +GetCurrentThread +GetCurrentThreadId +GetDateFormatA +GetDateFormatW +GetDaylightFlag +GetDefaultCommConfigA +GetDefaultCommConfigW +GetDevicePowerState +GetDiskFreeSpaceA +GetDiskFreeSpaceExA +GetDiskFreeSpaceExW +GetDiskFreeSpaceW +GetDriveTypeA +GetDriveTypeW +GetEnvironmentStrings +GetEnvironmentStringsA +GetEnvironmentStringsW +GetEnvironmentVariableA +GetEnvironmentVariableW +GetErrorMode +GetExitCodeProcess +GetExitCodeThread +GetFileAttributesA +GetFileAttributesExA +GetFileAttributesExW +GetFileAttributesW +GetFileInformationByHandle +GetFileSize +GetFileTime +GetFileType +GetFullPathNameA +GetFullPathNameW +GetGeoInfoA +GetGeoInfoW +GetHandleContext +GetHandleInformation +GetLSCallbackTarget +GetLSCallbackTemplate +GetLargestConsoleWindowSize +GetLastError +GetLocalTime +GetLocaleInfoA +GetLocaleInfoW +GetLogicalDriveStringsA +GetLogicalDriveStringsW +GetLogicalDrives +GetLongPathNameA +GetLongPathNameW +GetMailslotInfo +GetModuleFileNameA +GetModuleFileNameW +GetModuleHandleA +GetModuleHandleW +GetModuleHandleExA +GetModuleHandleExW +GetNamedPipeHandleStateA +GetNamedPipeHandleStateW +GetNamedPipeInfo +GetNumberFormatA +GetNumberFormatW +GetNumberOfConsoleInputEvents +GetNumberOfConsoleMouseButtons +GetOEMCP +GetOverlappedResult +GetPriorityClass +GetPrivateProfileIntA +GetPrivateProfileIntW +GetPrivateProfileSectionA +GetPrivateProfileSectionNamesA +GetPrivateProfileSectionNamesW +GetPrivateProfileSectionW +GetPrivateProfileStringA +GetPrivateProfileStringW +GetPrivateProfileStructA +GetPrivateProfileStructW +GetProcAddress +GetProcessAffinityMask +GetProcessFlags +GetProcessHeap +GetProcessHeaps +GetProcessPriorityBoost +GetProcessShutdownParameters +GetProcessTimes +GetProcessVersion +GetProcessWorkingSetSize +GetProductName +GetProfileIntA +GetProfileIntW +GetProfileSectionA +GetProfileSectionW +GetProfileStringA +GetProfileStringW +GetQueuedCompletionStatus +GetSLCallbackTarget +GetSLCallbackTemplate +GetShortPathNameA +GetShortPathNameW +GetStartupInfoA +GetStartupInfoW +GetStdHandle +GetStringTypeA +GetStringTypeExA +GetStringTypeExW +GetStringTypeW +GetSystemDefaultLCID +GetSystemDefaultLangID +GetSystemDefaultUILanguage +GetSystemDirectoryA +GetSystemDirectoryW +GetSystemInfo +GetSystemPowerStatus +GetSystemTime +GetSystemTimeAdjustment +GetSystemTimeAsFileTime +GetTapeParameters +GetTapePosition +GetTapeStatus +GetTempFileNameA +GetTempFileNameW +GetTempPathA +GetTempPathW +GetThreadContext +GetThreadLocale +GetThreadPriority +GetThreadPriorityBoost +GetThreadSelectorEntry +GetThreadTimes +GetTickCount +GetTimeFormatA +GetTimeFormatW +GetTimeZoneInformation +GetUserDefaultLCID +GetUserDefaultLangID +GetUserDefaultUILanguage +GetUserGeoID +GetVersion +GetVersionExA +GetVersionExW +GetVolumeInformationA +GetVolumeInformationW +GetWindowsDirectoryA +GetWindowsDirectoryW +GetWriteWatch +GlobalAddAtomA +GlobalAddAtomW +GlobalAlloc +GlobalCompact +GlobalDeleteAtom +GlobalFindAtomA +GlobalFindAtomW +GlobalFix +GlobalFlags +GlobalFree +GlobalGetAtomNameA +GlobalGetAtomNameW +GlobalHandle +GlobalLock +GlobalMemoryStatus +GlobalReAlloc +GlobalSize +GlobalUnWire +GlobalUnfix +GlobalUnlock +GlobalWire +Heap32First +Heap32ListFirst +Heap32ListNext +Heap32Next +HeapAlloc +HeapCompact +HeapCreate +HeapDestroy +HeapFree +HeapLock +HeapReAlloc +HeapSetFlags +HeapSize +HeapUnlock +HeapValidate +HeapWalk +InitAtomTable +InitializeCriticalSection +InitializeCriticalSectionAndSpinCount +InterlockedCompareExchange +InterlockedDecrement +InterlockedExchange +InterlockedExchangeAdd +InterlockedIncrement +InvalidateNLSCache +IsBadCodePtr +IsBadHugeReadPtr +IsBadHugeWritePtr +IsBadReadPtr +IsBadStringPtrA +IsBadStringPtrW +IsBadWritePtr +IsDBCSLeadByte +IsDBCSLeadByteEx +IsDebuggerPresent +IsLSCallback +IsProcessorFeaturePresent +IsSLCallback +IsSystemResumeAutomatic +IsValidCodePage +IsValidLanguageGroup +IsValidLocale +K32Thk1632Epilog +K32Thk1632Prolog +K32_NtCreateFile +K32_RtlNtStatusToDosError +LCMapStringA +LCMapStringW +LeaveCriticalSection +LoadLibraryA +LoadLibraryExA +LoadLibraryExW +LoadLibraryW +LoadModule +LoadResource +LocalAlloc +LocalCompact +LocalFileTimeToFileTime +LocalFlags +LocalFree +LocalHandle +LocalLock +LocalReAlloc +LocalShrink +LocalSize +LocalUnlock +LockFile +LockFileEx +LockResource +MakeCriticalSectionGlobal +MapHInstLS +MapHInstLS_PN +MapHInstSL +MapHInstSL_PN +MapHModuleLS +MapHModuleSL +MapLS +MapSL +MapSLFix +MapViewOfFile +MapViewOfFileEx +Module32First +Module32Next +MoveFileA +MoveFileExA +MoveFileExW +MoveFileW +MulDiv +MultiByteToWideChar +NotifyNLSUserCache +OpenEventA +OpenEventW +OpenFile +OpenFileMappingA +OpenFileMappingW +OpenMutexA +OpenMutexW +OpenProcess +OpenProfileUserMapping +OpenSemaphoreA +OpenSemaphoreW +OpenThread +OpenVxDHandle +OpenWaitableTimerA +OpenWaitableTimerW +OutputDebugStringA +OutputDebugStringW +PeekConsoleInputA +PeekConsoleInputW +PeekNamedPipe +PostQueuedCompletionStatus +PrepareTape +Process32First +Process32Next +PulseEvent +PurgeComm +QT_Thunk +QueryDosDeviceA +QueryDosDeviceW +QueryNumberOfEventLogRecords +QueryOldestEventLogRecord +QueryPerformanceCounter +QueryPerformanceFrequency +QueueUserAPC +RaiseException +ReadConsoleA +ReadConsoleInputA +ReadConsoleInputW +ReadConsoleOutputA +ReadConsoleOutputAttribute +ReadConsoleOutputCharacterA +ReadConsoleOutputCharacterW +ReadConsoleOutputW +ReadConsoleW +ReadDirectoryChangesW +ReadFile +ReadFileEx +ReadFileScatter +ReadProcessMemory +RegisterServiceProcess +RegisterSysMsgHandler +ReinitializeCriticalSection +ReleaseMutex +ReleaseSemaphore +RemoveDirectoryA +RemoveDirectoryW +RequestDeviceWakeup +RequestWakeupLatency +ResetEvent +ResetNLSUserInfoCache +ResetWriteWatch +ResumeThread +RtlAddFunctionTable +RtlDeleteFunctionTable +RtlFillMemory +RtlInstallFunctionTableCallback +RtlMoveMemory +RtlUnwind +RtlUnwindEx +RtlZeroMemory +SMapLS +SMapLS_IP_EBP_12 +SMapLS_IP_EBP_16 +SMapLS_IP_EBP_20 +SMapLS_IP_EBP_24 +SMapLS_IP_EBP_28 +SMapLS_IP_EBP_32 +SMapLS_IP_EBP_36 +SMapLS_IP_EBP_40 +SMapLS_IP_EBP_8 +SUnMapLS +SUnMapLS_IP_EBP_12 +SUnMapLS_IP_EBP_16 +SUnMapLS_IP_EBP_20 +SUnMapLS_IP_EBP_24 +SUnMapLS_IP_EBP_28 +SUnMapLS_IP_EBP_32 +SUnMapLS_IP_EBP_36 +SUnMapLS_IP_EBP_40 +SUnMapLS_IP_EBP_8 +ScrollConsoleScreenBufferA +ScrollConsoleScreenBufferW +SearchPathA +SearchPathW +SetCalendarInfoA +SetCalendarInfoW +SetCommBreak +SetCommConfig +SetCommMask +SetCommState +SetCommTimeouts +SetComputerNameA +SetComputerNameW +SetConsoleActiveScreenBuffer +SetConsoleCP +SetConsoleCtrlHandler +SetConsoleCursorInfo +SetConsoleCursorPosition +SetConsoleMode +SetConsoleOutputCP +SetConsoleScreenBufferSize +SetConsoleTextAttribute +SetConsoleTitleA +SetConsoleTitleW +SetConsoleWindowInfo +SetCriticalSectionSpinCount +SetCurrentDirectoryA +SetCurrentDirectoryW +SetDaylightFlag +SetDefaultCommConfigA +SetDefaultCommConfigW +SetEndOfFile +SetEnvironmentVariableA +SetEnvironmentVariableW +SetErrorMode +SetEvent +SetFileApisToANSI +SetFileApisToOEM +SetFileAttributesA +SetFileAttributesW +SetFilePointer +SetFilePointerEx +SetFileTime +SetHandleContext +SetHandleCount +SetHandleInformation +SetLastError +SetLocalTime +SetLocaleInfoA +SetLocaleInfoW +SetMailslotInfo +SetMessageWaitingIndicator +SetNamedPipeHandleState +SetPriorityClass +SetProcessAffinityMask +SetProcessPriorityBoost +SetProcessShutdownParameters +SetProcessWorkingSetSize +SetStdHandle +SetSystemPowerState +SetSystemTime +SetSystemTimeAdjustment +SetTapeParameters +SetTapePosition +SetThreadAffinityMask +SetThreadContext +SetThreadExecutionState +SetThreadIdealProcessor +SetThreadLocale +SetThreadPriority +SetThreadPriorityBoost +SetTimeZoneInformation +SetUnhandledExceptionFilter +SetUserGeoID +SetVolumeLabelA +SetVolumeLabelW +SetWaitableTimer +SetupComm +SignalObjectAndWait +SignalSysMsgHandlers +SizeofResource +Sleep +SleepEx +SuspendThread +SwitchToFiber +SwitchToThread +SystemTimeToFileTime +SystemTimeToTzSpecificLocalTime +TerminateProcess +TerminateThread +Thread32First +Thread32Next +ThunkConnect32 +TlsAlloc +TlsAllocInternal +TlsFree +TlsFreeInternal +TlsGetValue +TlsSetValue +Toolhelp32ReadProcessMemory +TransactNamedPipe +TransmitCommChar +TryEnterCriticalSection +UTRegister +UTUnRegister +UnMapLS +UnMapSLFixArray +UnhandledExceptionFilter +UninitializeCriticalSection +UnlockFile +UnlockFileEx +UnmapViewOfFile +UpdateResourceA +UpdateResourceW +VerLanguageNameA +VerLanguageNameW +VirtualAlloc +VirtualAllocEx +VirtualFree +VirtualFreeEx +VirtualLock +VirtualProtect +VirtualProtectEx +VirtualQuery +VirtualQueryEx +VirtualUnlock +WaitCommEvent +WaitForDebugEvent +WaitForMultipleObjects +WaitForMultipleObjectsEx +WaitForSingleObject +WaitForSingleObjectEx +WaitNamedPipeA +WaitNamedPipeW +WideCharToMultiByte +WinExec +WriteConsoleA +WriteConsoleInputA +WriteConsoleInputW +WriteConsoleOutputA +WriteConsoleOutputAttribute +WriteConsoleOutputCharacterA +WriteConsoleOutputCharacterW +WriteConsoleOutputW +WriteConsoleW +WriteFile +WriteFileEx +WriteFileGather +WritePrivateProfileSectionA +WritePrivateProfileSectionW +WritePrivateProfileStringA +WritePrivateProfileStringW +WritePrivateProfileStructA +WritePrivateProfileStructW +WriteProcessMemory +WriteProfileSectionA +WriteProfileSectionW +WriteProfileStringA +WriteProfileStringW +WriteTapemark +_DebugOut +_DebugPrintf +_hread +_hwrite +_lclose +_lcreat +_llseek +_lopen +_lread +_lwrite +dprintf +lstrcat +lstrcatA +lstrcatW +lstrcmp +lstrcmpA +lstrcmpW +lstrcmpi +lstrcmpiA +lstrcmpiW +lstrcpy +lstrcpyA +lstrcpyW +lstrcpyn +lstrcpynA +lstrcpynW +lstrlen +lstrlenA +lstrlenW diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/lib/libtcc1-32.a b/.cache/overlay-toolchain/tcc_extract/tcc/lib/libtcc1-32.a new file mode 100644 index 00000000..3fdf1fae Binary files /dev/null and b/.cache/overlay-toolchain/tcc_extract/tcc/lib/libtcc1-32.a differ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/lib/libtcc1-64.a b/.cache/overlay-toolchain/tcc_extract/tcc/lib/libtcc1-64.a new file mode 100644 index 00000000..cf1bf6da Binary files /dev/null and b/.cache/overlay-toolchain/tcc_extract/tcc/lib/libtcc1-64.a differ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/lib/msvcrt.def b/.cache/overlay-toolchain/tcc_extract/tcc/lib/msvcrt.def new file mode 100644 index 00000000..742acb8b --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/lib/msvcrt.def @@ -0,0 +1,1399 @@ +LIBRARY msvcrt.dll + +EXPORTS +$I10_OUTPUT +??0__non_rtti_object@@QAE@ABV0@@Z +??0__non_rtti_object@@QAE@PBD@Z +??0bad_cast@@AAE@PBQBD@Z +??0bad_cast@@QAE@ABQBD@Z +??0bad_cast@@QAE@ABV0@@Z +??0bad_cast@@QAE@PBD@Z +??0bad_typeid@@QAE@ABV0@@Z +??0bad_typeid@@QAE@PBD@Z +??0exception@@QAE@ABQBD@Z +??0exception@@QAE@ABQBDH@Z +??0exception@@QAE@ABV0@@Z +??0exception@@QAE@XZ +??1__non_rtti_object@@UAE@XZ +??1bad_cast@@UAE@XZ +??1bad_typeid@@UAE@XZ +??1exception@@UAE@XZ +??1type_info@@UAE@XZ +??2@YAPAXI@Z +??2@YAPAXIHPBDH@Z +??3@YAXPAX@Z +??4__non_rtti_object@@QAEAAV0@ABV0@@Z +??4bad_cast@@QAEAAV0@ABV0@@Z +??4bad_typeid@@QAEAAV0@ABV0@@Z +??4exception@@QAEAAV0@ABV0@@Z +??8type_info@@QBEHABV0@@Z +??9type_info@@QBEHABV0@@Z +??_7__non_rtti_object@@6B@ +??_7bad_cast@@6B@ +??_7bad_typeid@@6B@ +??_7exception@@6B@ +??_E__non_rtti_object@@UAEPAXI@Z +??_Ebad_cast@@UAEPAXI@Z +??_Ebad_typeid@@UAEPAXI@Z +??_Eexception@@UAEPAXI@Z +??_Fbad_cast@@QAEXXZ +??_Fbad_typeid@@QAEXXZ +??_G__non_rtti_object@@UAEPAXI@Z +??_Gbad_cast@@UAEPAXI@Z +??_Gbad_typeid@@UAEPAXI@Z +??_Gexception@@UAEPAXI@Z +??_U@YAPAXI@Z +??_U@YAPAXIHPBDH@Z +??_V@YAXPAX@Z +?_query_new_handler@@YAP6AHI@ZXZ +?_query_new_mode@@YAHXZ +?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z +?_set_new_mode@@YAHH@Z +?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z +?before@type_info@@QBEHABV1@@Z +?name@type_info@@QBEPBDXZ +?raw_name@type_info@@QBEPBDXZ +?set_new_handler@@YAP6AXXZP6AXXZ@Z +?set_terminate@@YAP6AXXZP6AXXZ@Z +?set_unexpected@@YAP6AXXZP6AXXZ@Z +?terminate@@YAXXZ +?unexpected@@YAXXZ +?what@exception@@UBEPBDXZ +_CIacos +_CIasin +_CIatan +_CIatan2 +_CIcos +_CIcosh +_CIexp +_CIfmod +_CIlog +_CIlog10 +_CIpow +_CIsin +_CIsinh +_CIsqrt +_CItan +_CItanh +_CrtCheckMemory +_CrtDbgBreak +_CrtDbgReport +_CrtDbgReportV +_CrtDbgReportW +_CrtDbgReportWV +_CrtDoForAllClientObjects +_CrtDumpMemoryLeaks +_CrtIsMemoryBlock +_CrtIsValidHeapPointer +_CrtIsValidPointer +_CrtMemCheckpoint +_CrtMemDifference +_CrtMemDumpAllObjectsSince +_CrtMemDumpStatistics +_CrtReportBlockType +_CrtSetAllocHook +_CrtSetBreakAlloc +_CrtSetDbgBlockType +_CrtSetDbgFlag +_CrtSetDumpClient +_CrtSetReportFile +_CrtSetReportHook +_CrtSetReportHook2 +_CrtSetReportMode +_CxxThrowException +_EH_prolog +_Getdays +_Getmonths +_Gettnames +_HUGE +_Strftime +_XcptFilter +__CppXcptFilter +__CxxCallUnwindDelDtor +__CxxCallUnwindDtor +__CxxCallUnwindVecDtor +__CxxDetectRethrow +__CxxExceptionFilter +__CxxFrameHandler +__CxxFrameHandler2 +__CxxFrameHandler3 +__CxxLongjmpUnwind +__CxxQueryExceptionSize +__CxxRegisterExceptionObject +__CxxUnregisterExceptionObject +__DestructExceptionObject +__RTCastToVoid +__RTDynamicCast +__RTtypeid +__STRINGTOLD +___lc_codepage_func +___lc_collate_cp_func +___lc_handle_func +___mb_cur_max_func +___setlc_active_func +___unguarded_readlc_active_add_func +__argc +__argv +__badioinfo +__crtCompareStringA +__crtCompareStringW +__crtGetLocaleInfoW +__crtGetStringTypeW +__crtLCMapStringA +__crtLCMapStringW +__daylight +__dllonexit +__doserrno +__dstbias +__fpecode +__getmainargs +__initenv +__iob_func +__isascii +__iscsym +__iscsymf +__lc_codepage +__lc_collate_cp +__lc_handle +__lconv_init +__libm_sse2_acos +__libm_sse2_acosf +__libm_sse2_asin +__libm_sse2_asinf +__libm_sse2_atan +__libm_sse2_atan2 +__libm_sse2_atanf +__libm_sse2_cos +__libm_sse2_cosf +__libm_sse2_exp +__libm_sse2_expf +__libm_sse2_log +__libm_sse2_log10 +__libm_sse2_log10f +__libm_sse2_logf +__libm_sse2_pow +__libm_sse2_powf +__libm_sse2_sin +__libm_sse2_sinf +__libm_sse2_tan +__libm_sse2_tanf +__mb_cur_max +__p___argc +__p___argv +__p___initenv +__p___mb_cur_max +__p___wargv +__p___winitenv +__p__acmdln +__p__amblksiz +__p__commode +__p__daylight +__p__dstbias +__p__environ +__p__fileinfo +__p__fmode +__p__iob +__p__mbcasemap +__p__mbctype +__p__osver +__p__pctype +__p__pgmptr +__p__pwctype +__p__timezone +__p__tzname +__p__wcmdln +__p__wenviron +__p__winmajor +__p__winminor +__p__winver +__p__wpgmptr +__pctype_func +__pioinfo +__pwctype_func +__pxcptinfoptrs +__set_app_type +__setlc_active +__setusermatherr +__strncnt +__threadhandle +__threadid +__toascii +__unDName +__unDNameEx +__uncaught_exception +__unguarded_readlc_active +__wargv +__wcserror +__wcserror_s +__wcsncnt +__wgetmainargs +__winitenv +_abnormal_termination +_abs64 +_access +_access_s +_acmdln +_adj_fdiv_m16i +_adj_fdiv_m32 +_adj_fdiv_m32i +_adj_fdiv_m64 +_adj_fdiv_r +_adj_fdivr_m16i +_adj_fdivr_m32 +_adj_fdivr_m32i +_adj_fdivr_m64 +_adj_fpatan +_adj_fprem +_adj_fprem1 +_adj_fptan +_adjust_fdiv +_aexit_rtn +_aligned_free +_aligned_free_dbg +_aligned_malloc +_aligned_malloc_dbg +_aligned_offset_malloc +_aligned_offset_malloc_dbg +_aligned_offset_realloc +_aligned_offset_realloc_dbg +_aligned_realloc +_aligned_realloc_dbg +_amsg_exit +_assert +_atodbl +_atodbl_l +_atof_l +_atoflt_l +_atoi64 +_atoi64_l +_atoi_l +_atol_l +_atoldbl +_atoldbl_l +_beep +_beginthread +_beginthreadex +_c_exit +_cabs +_callnewh +_calloc_dbg +_cexit +_cgets +_cgets_s +_cgetws +_cgetws_s +_chdir +_chdrive +_chgsign +_chkesp +_chmod +_chsize +_chsize_s +_chvalidator +_chvalidator_l +_clearfp +_close +_commit +_commode +_control87 +_controlfp +_controlfp_s +_copysign +_cprintf +_cprintf_l +_cprintf_p +_cprintf_p_l +_cprintf_s +_cprintf_s_l +_cputs +_cputws +_creat +_crtAssertBusy +_crtBreakAlloc +_crtDbgFlag +_cscanf +_cscanf_l +_cscanf_s +_cscanf_s_l +_ctime32 +_ctime32_s +_ctime64 +_ctime64_s +_ctype +_cwait +_cwprintf +_cwprintf_l +_cwprintf_p +_cwprintf_p_l +_cwprintf_s +_cwprintf_s_l +_cwscanf +_cwscanf_l +_cwscanf_s +_cwscanf_s_l +_daylight +_difftime32 +_difftime64 +_dstbias +_dup +_dup2 +_ecvt +_ecvt_s +_endthread +_endthreadex +_environ +_eof +_errno +_except_handler2 +_except_handler3 +_except_handler4_common +_execl +_execle +_execlp +_execlpe +_execv +_execve +_execvp +_execvpe +_exit +_expand +_expand_dbg +_fcloseall +_fcvt +_fcvt_s +_fdopen +_fgetchar +_fgetwchar +_filbuf +_fileinfo +_filelength +_filelengthi64 +_fileno +_findclose +_findfirst +_findfirst64 +_findfirsti64 +_findnext +_findnext64 +_findnexti64 +_finite +_flsbuf +_flushall +_fmode +_fpclass +_fpieee_flt +_fpreset +_fprintf_l +_fprintf_p +_fprintf_p_l +_fprintf_s_l +_fputchar +_fputwchar +_free_dbg +_freea +_freea_s +_fscanf_l +_fscanf_s_l +_fseeki64 +_fsopen +_fstat +_fstat64 +_fstati64 +_ftime +_ftime32 +_ftime32_s +_ftime64 +_ftime64_s +_ftol +_ftol2 +_ftol2_sse +_ftol2_sse_excpt +_fullpath +_fullpath_dbg +_futime +_futime32 +_futime64 +_fwprintf_l +_fwprintf_p +_fwprintf_p_l +_fwprintf_s_l +_fwscanf_l +_fwscanf_s_l +_gcvt +_gcvt_s +_get_doserrno +_get_environ +_get_errno +_get_fileinfo +_get_fmode +_get_heap_handle +_get_osfhandle +_get_osplatform +_get_osver +_get_output_format +_get_pgmptr +_get_sbh_threshold +_get_wenviron +_get_winmajor +_get_winminor +_get_winver +_get_wpgmptr +_getch +_getche +_getcwd +_getdcwd +_getdiskfree +_getdllprocaddr +_getdrive +_getdrives +_getmaxstdio +_getmbcp +_getpid +_getsystime +_getw +_getwch +_getwche +_getws +_global_unwind2 +_gmtime32 +_gmtime32_s +_gmtime64 +_gmtime64_s +_heapadd +_heapchk +_heapmin +_heapset +_heapused +_heapwalk +_hypot +_i64toa +_i64toa_s +_i64tow +_i64tow_s +_initterm +_initterm_e +_inp +_inpd +_inpw +_invalid_parameter +_iob +_isalnum_l +_isalpha_l +_isatty +_iscntrl_l +_isctype +_isctype_l +_isdigit_l +_isgraph_l +_isleadbyte_l +_islower_l +_ismbbalnum +_ismbbalnum_l +_ismbbalpha +_ismbbalpha_l +_ismbbgraph +_ismbbgraph_l +_ismbbkalnum +_ismbbkalnum_l +_ismbbkana +_ismbbkana_l +_ismbbkprint +_ismbbkprint_l +_ismbbkpunct +_ismbbkpunct_l +_ismbblead +_ismbblead_l +_ismbbprint +_ismbbprint_l +_ismbbpunct +_ismbbpunct_l +_ismbbtrail +_ismbbtrail_l +_ismbcalnum +_ismbcalnum_l +_ismbcalpha +_ismbcalpha_l +_ismbcdigit +_ismbcdigit_l +_ismbcgraph +_ismbcgraph_l +_ismbchira +_ismbchira_l +_ismbckata +_ismbckata_l +_ismbcl0 +_ismbcl0_l +_ismbcl1 +_ismbcl1_l +_ismbcl2 +_ismbcl2_l +_ismbclegal +_ismbclegal_l +_ismbclower +_ismbclower_l +_ismbcprint +_ismbcprint_l +_ismbcpunct +_ismbcpunct_l +_ismbcspace +_ismbcspace_l +_ismbcsymbol +_ismbcsymbol_l +_ismbcupper +_ismbcupper_l +_ismbslead +_ismbslead_l +_ismbstrail +_ismbstrail_l +_isnan +_isprint_l +_isspace_l +_isupper_l +_iswalnum_l +_iswalpha_l +_iswcntrl_l +_iswctype_l +_iswdigit_l +_iswgraph_l +_iswlower_l +_iswprint_l +_iswpunct_l +_iswspace_l +_iswupper_l +_iswxdigit_l +_isxdigit_l +_itoa +_itoa_s +_itow +_itow_s +_j0 +_j1 +_jn +_kbhit +_lfind +_lfind_s +_loaddll +_local_unwind2 +_local_unwind4 +_localtime32 +_localtime32_s +_localtime64 +_localtime64_s +_lock +_locking +_logb +_longjmpex +_lrotl +_lrotr +_lsearch +_lsearch_s +_lseek +_lseeki64 +_ltoa +_ltoa_s +_ltow +_ltow_s +_makepath +_makepath_s +_malloc_dbg +_mbbtombc +_mbbtombc_l +_mbbtype +_mbcasemap +_mbccpy +_mbccpy_l +_mbccpy_s +_mbccpy_s_l +_mbcjistojms +_mbcjistojms_l +_mbcjmstojis +_mbcjmstojis_l +_mbclen +_mbclen_l +_mbctohira +_mbctohira_l +_mbctokata +_mbctokata_l +_mbctolower +_mbctolower_l +_mbctombb +_mbctombb_l +_mbctoupper +_mbctoupper_l +_mbctype +_mblen_l +_mbsbtype +_mbsbtype_l +_mbscat +_mbscat_s +_mbscat_s_l +_mbschr +_mbschr_l +_mbscmp +_mbscmp_l +_mbscoll +_mbscoll_l +_mbscpy +_mbscpy_s +_mbscpy_s_l +_mbscspn +_mbscspn_l +_mbsdec +_mbsdec_l +_mbsdup +_mbsicmp +_mbsicmp_l +_mbsicoll +_mbsicoll_l +_mbsinc +_mbsinc_l +_mbslen +_mbslen_l +_mbslwr +_mbslwr_l +_mbslwr_s +_mbslwr_s_l +_mbsnbcat +_mbsnbcat_l +_mbsnbcat_s +_mbsnbcat_s_l +_mbsnbcmp +_mbsnbcmp_l +_mbsnbcnt +_mbsnbcnt_l +_mbsnbcoll +_mbsnbcoll_l +_mbsnbcpy +_mbsnbcpy_l +_mbsnbcpy_s +_mbsnbcpy_s_l +_mbsnbicmp +_mbsnbicmp_l +_mbsnbicoll +_mbsnbicoll_l +_mbsnbset +_mbsnbset_l +_mbsnbset_s +_mbsnbset_s_l +_mbsncat +_mbsncat_l +_mbsncat_s +_mbsncat_s_l +_mbsnccnt +_mbsnccnt_l +_mbsncmp +_mbsncmp_l +_mbsncoll +_mbsncoll_l +_mbsncpy +_mbsncpy_l +_mbsncpy_s +_mbsncpy_s_l +_mbsnextc +_mbsnextc_l +_mbsnicmp +_mbsnicmp_l +_mbsnicoll +_mbsnicoll_l +_mbsninc +_mbsninc_l +_mbsnlen +_mbsnlen_l +_mbsnset +_mbsnset_l +_mbsnset_s +_mbsnset_s_l +_mbspbrk +_mbspbrk_l +_mbsrchr +_mbsrchr_l +_mbsrev +_mbsrev_l +_mbsset +_mbsset_l +_mbsset_s +_mbsset_s_l +_mbsspn +_mbsspn_l +_mbsspnp +_mbsspnp_l +_mbsstr +_mbsstr_l +_mbstok +_mbstok_l +_mbstok_s +_mbstok_s_l +_mbstowcs_l +_mbstowcs_s_l +_mbstrlen +_mbstrlen_l +_mbstrnlen +_mbstrnlen_l +_mbsupr +_mbsupr_l +_mbsupr_s +_mbsupr_s_l +_mbtowc_l +_memccpy +_memicmp +_memicmp_l +_mkdir +_mkgmtime +_mkgmtime32 +_mkgmtime64 +_mktemp +_mktemp_s +_mktime32 +_mktime64 +_msize +_msize_debug +_nextafter +_onexit +_open +_open_osfhandle +_osplatform +_osver +_outp +_outpd +_outpw +_pclose +_pctype +_pgmptr +_pipe +_popen +_printf_l +_printf_p +_printf_p_l +_printf_s_l +_purecall +_putch +_putenv +_putenv_s +_putw +_putwch +_putws +_pwctype +_read +_realloc_dbg +_resetstkoflw +_rmdir +_rmtmp +_rotl +_rotl64 +_rotr +_rotr64 +_safe_fdiv +_safe_fdivr +_safe_fprem +_safe_fprem1 +_scalb +_scanf_l +_scanf_s_l +_scprintf +_scprintf_l +_scprintf_p_l +_scwprintf +_scwprintf_l +_scwprintf_p_l +_searchenv +_searchenv_s +_seh_longjmp_unwind +_seh_longjmp_unwind4 +_set_SSE2_enable +_set_controlfp +_set_doserrno +_set_errno +_set_error_mode +_set_fileinfo +_set_fmode +_set_output_format +_set_sbh_threshold +_seterrormode +_setjmp +_setjmp3 +_setmaxstdio +_setmbcp +_setmode +_setsystime +_sleep +_snprintf +_snprintf_c +_snprintf_c_l +_snprintf_l +_snprintf_s +_snprintf_s_l +_snscanf +_snscanf_l +_snscanf_s +_snscanf_s_l +_snwprintf +_snwprintf_l +_snwprintf_s +_snwprintf_s_l +_snwscanf +_snwscanf_l +_snwscanf_s +_snwscanf_s_l +_sopen +_sopen_s +_spawnl +_spawnle +_spawnlp +_spawnlpe +_spawnv +_spawnve +_spawnvp +_spawnvpe +_splitpath +_splitpath_s +_sprintf_l +_sprintf_p_l +_sprintf_s_l +_sscanf_l +_sscanf_s_l +_stat +_stat64 +_stati64 +_statusfp +_strcmpi +_strcoll_l +_strdate +_strdate_s +_strdup +_strdup_dbg +_strerror +_strerror_s +_stricmp +_stricmp_l +_stricoll +_stricoll_l +_strlwr +_strlwr_l +_strlwr_s +_strlwr_s_l +_strncoll +_strncoll_l +_strnicmp +_strnicmp_l +_strnicoll +_strnicoll_l +_strnset +_strnset_s +_strrev +_strset +_strset_s +_strtime +_strtime_s +_strtod_l +_strtoi64 +_strtoi64_l +_strtol_l +_strtoui64 +_strtoui64_l +_strtoul_l +_strupr +_strupr_l +_strupr_s +_strupr_s_l +_strxfrm_l +_swab +_swprintf +_swprintf_c +_swprintf_c_l +_swprintf_p_l +_swprintf_s_l +_swscanf_l +_swscanf_s_l +_sys_errlist +_sys_nerr +_tell +_telli64 +_tempnam +_tempnam_dbg +_time32 +_time64 +_timezone +_tolower +_tolower_l +_toupper +_toupper_l +_towlower_l +_towupper_l +_tzname +_tzset +_ui64toa +_ui64toa_s +_ui64tow +_ui64tow_s +_ultoa +_ultoa_s +_ultow +_ultow_s +_umask +_umask_s +_ungetch +_ungetwch +_unlink +_unloaddll +_unlock +_utime +_utime32 +_utime64 +_vcprintf +_vcprintf_l +_vcprintf_p +_vcprintf_p_l +_vcprintf_s +_vcprintf_s_l +_vcwprintf +_vcwprintf_l +_vcwprintf_p +_vcwprintf_p_l +_vcwprintf_s +_vcwprintf_s_l +_vfprintf_l +_vfprintf_p +_vfprintf_p_l +_vfprintf_s_l +_vfwprintf_l +_vfwprintf_p +_vfwprintf_p_l +_vfwprintf_s_l +_vprintf_l +_vprintf_p +_vprintf_p_l +_vprintf_s_l +_vscprintf +_vscprintf_l +_vscprintf_p_l +_vscwprintf +_vscwprintf_l +_vscwprintf_p_l +_vsnprintf +_vsnprintf_c +_vsnprintf_c_l +_vsnprintf_l +_vsnprintf_s +_vsnprintf_s_l +_vsnwprintf +_vsnwprintf_l +_vsnwprintf_s +_vsnwprintf_s_l +_vsprintf_l +_vsprintf_p +_vsprintf_p_l +_vsprintf_s_l +_vswprintf +_vswprintf_c +_vswprintf_c_l +_vswprintf_l +_vswprintf_p_l +_vswprintf_s_l +_vwprintf_l +_vwprintf_p +_vwprintf_p_l +_vwprintf_s_l +_waccess +_waccess_s +_wasctime +_wasctime_s +_wassert +_wchdir +_wchmod +_wcmdln +_wcreat +_wcscoll_l +_wcsdup +_wcsdup_dbg +_wcserror +_wcserror_s +_wcsftime_l +_wcsicmp +_wcsicmp_l +_wcsicoll +_wcsicoll_l +_wcslwr +_wcslwr_l +_wcslwr_s +_wcslwr_s_l +_wcsncoll +_wcsncoll_l +_wcsnicmp +_wcsnicmp_l +_wcsnicoll +_wcsnicoll_l +_wcsnset +_wcsnset_s +_wcsrev +_wcsset +_wcsset_s +_wcstoi64 +_wcstoi64_l +_wcstol_l +_wcstombs_l +_wcstombs_s_l +_wcstoui64 +_wcstoui64_l +_wcstoul_l +_wcsupr +_wcsupr_l +_wcsupr_s +_wcsupr_s_l +_wcsxfrm_l +_wctime +_wctime32 +_wctime32_s +_wctime64 +_wctime64_s +_wctomb_l +_wctomb_s_l +_wctype +_wenviron +_wexecl +_wexecle +_wexeclp +_wexeclpe +_wexecv +_wexecve +_wexecvp +_wexecvpe +_wfdopen +_wfindfirst +_wfindfirst64 +_wfindfirsti64 +_wfindnext +_wfindnext64 +_wfindnexti64 +_wfopen +_wfopen_s +_wfreopen +_wfreopen_s +_wfsopen +_wfullpath +_wfullpath_dbg +_wgetcwd +_wgetdcwd +_wgetenv +_wgetenv_s +_winmajor +_winminor +_winput_s +_winver +_wmakepath +_wmakepath_s +_wmkdir +_wmktemp +_wmktemp_s +_wopen +_woutput_s +_wperror +_wpgmptr +_wpopen +_wprintf_l +_wprintf_p +_wprintf_p_l +_wprintf_s_l +_wputenv +_wputenv_s +_wremove +_wrename +_write +_wrmdir +_wscanf_l +_wscanf_s_l +_wsearchenv +_wsearchenv_s +_wsetlocale +_wsopen +_wsopen_s +_wspawnl +_wspawnle +_wspawnlp +_wspawnlpe +_wspawnv +_wspawnve +_wspawnvp +_wspawnvpe +_wsplitpath +_wsplitpath_s +_wstat +_wstat64 +_wstati64 +_wstrdate +_wstrdate_s +_wstrtime +_wstrtime_s +_wsystem +_wtempnam +_wtempnam_dbg +_wtmpnam +_wtmpnam_s +_wtof +_wtof_l +_wtoi +_wtoi64 +_wtoi64_l +_wtoi_l +_wtol +_wtol_l +_wunlink +_wutime +_wutime32 +_wutime64 +_y0 +_y1 +_yn +abort +abs +acos +asctime +asctime_s +asin +atan +atan2 +atexit +atof +atoi +atol +bsearch +bsearch_s +btowc +calloc +ceil +clearerr +clearerr_s +clock +cos +cosh +ctime +difftime +div +exit +exp +fabs +fclose +feof +ferror +fflush +fgetc +fgetpos +fgets +fgetwc +fgetws +floor +fmod +fopen +fopen_s +fprintf +fprintf_s +fputc +fputs +fputwc +fputws +fread +free +freopen +freopen_s +frexp +fscanf +fscanf_s +fseek +fsetpos +ftell +fwprintf +fwprintf_s +fwrite +fwscanf +fwscanf_s +getc +getchar +getenv +getenv_s +gets +getwc +getwchar +gmtime +is_wctype +isalnum +isalpha +iscntrl +isdigit +isgraph +isleadbyte +islower +isprint +ispunct +isspace +isupper +iswalnum +iswalpha +iswascii +iswcntrl +iswctype +iswdigit +iswgraph +iswlower +iswprint +iswpunct +iswspace +iswupper +iswxdigit +isxdigit +labs +ldexp +ldiv +localeconv +localtime +log +log10 +longjmp +malloc +mblen +mbrlen +mbrtowc +mbsdup_dbg +mbsrtowcs +mbsrtowcs_s +mbstowcs +mbstowcs_s +mbtowc +memchr +memcmp +memcpy +memcpy_s +memmove +memmove_s +memset +mktime +modf +perror +pow +printf +printf_s +putc +putchar +puts +putwc +putwchar +qsort +qsort_s +raise +rand +rand_s +realloc +remove +rename +rewind +scanf +scanf_s +setbuf +setlocale +setvbuf +signal +sin +sinh +sprintf +sprintf_s +sqrt +srand +sscanf +sscanf_s +strcat +strcat_s +strchr +strcmp +strcoll +strcpy +strcpy_s +strcspn +strerror +strerror_s +strftime +strlen +strncat +strncat_s +strncmp +strncpy +strncpy_s +strnlen +strpbrk +strrchr +strspn +strstr +strtod +strtok +strtok_s +strtol +strtoul +strxfrm +swprintf +swprintf_s +swscanf +swscanf_s +system +tan +tanh +time +tmpfile +tmpfile_s +tmpnam +tmpnam_s +tolower +toupper +towlower +towupper +ungetc +ungetwc +utime +vfprintf +vfprintf_s +vfwprintf +vfwprintf_s +vprintf +vprintf_s +vsnprintf +vsprintf +vsprintf_s +vswprintf +vswprintf_s +vwprintf +vwprintf_s +wcrtomb +wcrtomb_s +wcscat +wcscat_s +wcschr +wcscmp +wcscoll +wcscpy +wcscpy_s +wcscspn +wcsftime +wcslen +wcsncat +wcsncat_s +wcsncmp +wcsncpy +wcsncpy_s +wcsnlen +wcspbrk +wcsrchr +wcsrtombs +wcsrtombs_s +wcsspn +wcsstr +wcstod +wcstok +wcstok_s +wcstol +wcstombs +wcstombs_s +wcstoul +wcsxfrm +wctob +wctomb +wctomb_s +wprintf +wprintf_s +wscanf +wscanf_s diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/lib/user32.def b/.cache/overlay-toolchain/tcc_extract/tcc/lib/user32.def new file mode 100644 index 00000000..a034dac2 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/lib/user32.def @@ -0,0 +1,658 @@ +LIBRARY user32.dll + +EXPORTS +ActivateKeyboardLayout +AdjustWindowRect +AdjustWindowRectEx +AlignRects +AllowSetForegroundWindow +AnimateWindow +AnyPopup +AppendMenuA +AppendMenuW +ArrangeIconicWindows +AttachThreadInput +BeginDeferWindowPos +BeginPaint +BlockInput +BringWindowToTop +BroadcastSystemMessage +BroadcastSystemMessageA +BroadcastSystemMessageW +CalcChildScroll +CallMsgFilter +CallMsgFilterA +CallMsgFilterW +CallNextHookEx +CallWindowProcA +CallWindowProcW +CascadeChildWindows +CascadeWindows +ChangeClipboardChain +ChangeDisplaySettingsA +ChangeDisplaySettingsExA +ChangeDisplaySettingsExW +ChangeDisplaySettingsW +ChangeMenuA +ChangeMenuW +CharLowerA +CharLowerBuffA +CharLowerBuffW +CharLowerW +CharNextA +CharNextExA +CharNextExW +CharNextW +CharPrevA +CharPrevExA +CharPrevExW +CharPrevW +CharToOemA +CharToOemBuffA +CharToOemBuffW +CharToOemW +CharUpperA +CharUpperBuffA +CharUpperBuffW +CharUpperW +CheckDlgButton +CheckMenuItem +CheckMenuRadioItem +CheckRadioButton +ChildWindowFromPoint +ChildWindowFromPointEx +ClientThreadConnect +ClientToScreen +ClipCursor +CloseClipboard +CloseDesktop +CloseWindow +CloseWindowStation +CopyAcceleratorTableA +CopyAcceleratorTableW +CopyIcon +CopyImage +CopyRect +CountClipboardFormats +CreateAcceleratorTableA +CreateAcceleratorTableW +CreateCaret +CreateCursor +CreateDesktopA +CreateDesktopW +CreateDialogIndirectParamA +CreateDialogIndirectParamW +CreateDialogParamA +CreateDialogParamW +CreateIcon +CreateIconFromResource +CreateIconFromResourceEx +CreateIconIndirect +CreateMDIWindowA +CreateMDIWindowW +CreateMenu +CreatePopupMenu +CreateWindowExA +CreateWindowExW +CreateWindowStationA +CreateWindowStationW +DdeAbandonTransaction +DdeAccessData +DdeAddData +DdeClientTransaction +DdeCmpStringHandles +DdeConnect +DdeConnectList +DdeCreateDataHandle +DdeCreateStringHandleA +DdeCreateStringHandleW +DdeDisconnect +DdeDisconnectList +DdeEnableCallback +DdeFreeDataHandle +DdeFreeStringHandle +DdeGetData +DdeGetLastError +DdeImpersonateClient +DdeInitializeA +DdeInitializeW +DdeKeepStringHandle +DdeNameService +DdePostAdvise +DdeQueryConvInfo +DdeQueryNextServer +DdeQueryStringA +DdeQueryStringW +DdeReconnect +DdeSetQualityOfService +DdeSetUserHandle +DdeUnaccessData +DdeUninitialize +DefDlgProcA +DefDlgProcW +DefFrameProcA +DefFrameProcW +DefMDIChildProcA +DefMDIChildProcW +DefWindowProcA +DefWindowProcW +DeferWindowPos +DeleteMenu +DestroyAcceleratorTable +DestroyCaret +DestroyCursor +DestroyIcon +DestroyMenu +DestroyWindow +DialogBoxIndirectParamA +DialogBoxIndirectParamW +DialogBoxParamA +DialogBoxParamW +DispatchMessageA +DispatchMessageW +DlgDirListA +DlgDirListComboBoxA +DlgDirListComboBoxW +DlgDirListW +DlgDirSelectComboBoxExA +DlgDirSelectComboBoxExW +DlgDirSelectExA +DlgDirSelectExW +DragDetect +DragObject +DrawAnimatedRects +DrawCaption +DrawCaptionTempA +DrawCaptionTempW +DrawEdge +DrawFocusRect +DrawFrame +DrawFrameControl +DrawIcon +DrawIconEx +DrawMenuBar +DrawMenuBarTemp +DrawStateA +DrawStateW +DrawTextA +DrawTextExA +DrawTextExW +DrawTextW +EditWndProc +EmptyClipboard +EnableMenuItem +EnableScrollBar +EnableWindow +EndDeferWindowPos +EndDialog +EndMenu +EndPaint +EndTask +EnumChildWindows +EnumClipboardFormats +EnumDesktopWindows +EnumDesktopsA +EnumDesktopsW +EnumDisplayDevicesA +EnumDisplayDevicesW +EnumDisplayMonitors +EnumDisplaySettingsA +EnumDisplaySettingsExA +EnumDisplaySettingsExW +EnumDisplaySettingsW +EnumPropsA +EnumPropsExA +EnumPropsExW +EnumPropsW +EnumThreadWindows +EnumWindowStationsA +EnumWindowStationsW +EnumWindows +EqualRect +ExcludeUpdateRgn +ExitWindowsEx +FillRect +FindWindowA +FindWindowExA +FindWindowExW +FindWindowW +FlashWindow +FlashWindowEx +FrameRect +FreeDDElParam +GetActiveWindow +GetAltTabInfo +GetAncestor +GetAsyncKeyState +GetCapture +GetCaretBlinkTime +GetCaretPos +GetClassInfoA +GetClassInfoExA +GetClassInfoExW +GetClassInfoW +GetClassLongA +GetClassLongW +GetClassNameA +GetClassNameW +GetClassWord +GetClientRect +GetClipCursor +GetClipboardData +GetClipboardFormatNameA +GetClipboardFormatNameW +GetClipboardOwner +GetClipboardSequenceNumber +GetClipboardViewer +GetComboBoxInfo +GetCursor +GetCursorInfo +GetCursorPos +GetDC +GetDCEx +GetDesktopWindow +GetDialogBaseUnits +GetDlgCtrlID +GetDlgItem +GetDlgItemInt +GetDlgItemTextA +GetDlgItemTextW +GetDoubleClickTime +GetFocus +GetForegroundWindow +GetGUIThreadInfo +GetGuiResources +GetIconInfo +GetInputDesktop +GetInputState +GetInternalWindowPos +GetKBCodePage +GetKeyNameTextA +GetKeyNameTextW +GetKeyState +GetKeyboardLayout +GetKeyboardLayoutList +GetKeyboardLayoutNameA +GetKeyboardLayoutNameW +GetKeyboardState +GetKeyboardType +GetLastActivePopup +GetListBoxInfo +GetMenu +GetMenuBarInfo +GetMenuCheckMarkDimensions +GetMenuContextHelpId +GetMenuDefaultItem +GetMenuInfo +GetMenuItemCount +GetMenuItemID +GetMenuItemInfoA +GetMenuItemInfoW +GetMenuItemRect +GetMenuState +GetMenuStringA +GetMenuStringW +GetMessageA +GetMessageExtraInfo +GetMessagePos +GetMessageTime +GetMessageW +GetMonitorInfoA +GetMonitorInfoW +GetMouseMovePoints +GetMouseMovePointsEx +GetNextDlgGroupItem +GetNextDlgTabItem +GetNextQueueWindow +GetOpenClipboardWindow +GetParent +GetPriorityClipboardFormat +GetProcessDefaultLayout +GetProcessWindowStation +GetPropA +GetPropW +GetQueueStatus +GetScrollBarInfo +GetScrollInfo +GetScrollPos +GetScrollRange +GetShellWindow +GetSubMenu +GetSysColor +GetSysColorBrush +GetSystemMenu +GetSystemMetrics +GetTabbedTextExtentA +GetTabbedTextExtentW +GetThreadDesktop +GetTitleBarInfo +GetTopWindow +GetUpdateRect +GetUpdateRgn +GetUserObjectInformationA +GetUserObjectInformationW +GetUserObjectSecurity +GetWindow +GetWindowContextHelpId +GetWindowDC +GetWindowInfo +GetWindowLongPtrA +GetWindowLongPtrW +SetWindowLongPtrA +SetWindowLongPtrW +GetWindowLongA +GetWindowLongW +GetWindowModuleFileNameA +GetWindowModuleFileNameW +GetWindowPlacement +GetWindowRect +GetWindowRgn +GetWindowTextA +GetWindowTextLengthA +GetWindowTextLengthW +GetWindowTextW +GetWindowThreadProcessId +GetWindowWord +GrayStringA +GrayStringW +HasSystemSleepStarted +HideCaret +HiliteMenuItem +IMPGetIMEA +IMPGetIMEW +IMPQueryIMEA +IMPQueryIMEW +IMPSetIMEA +IMPSetIMEW +ImpersonateDdeClientWindow +InSendMessage +InSendMessageEx +InflateRect +InitSharedTable +InitTask +InsertMenuA +InsertMenuItemA +InsertMenuItemW +InsertMenuW +InternalGetWindowText +IntersectRect +InvalidateRect +InvalidateRgn +InvertRect +IsCharAlphaA +IsCharAlphaNumericA +IsCharAlphaNumericW +IsCharAlphaW +IsCharLowerA +IsCharLowerW +IsCharUpperA +IsCharUpperW +IsChild +IsClipboardFormatAvailable +IsDialogMessage +IsDialogMessageA +IsDialogMessageW +IsDlgButtonChecked +IsHungThread +IsIconic +IsMenu +IsRectEmpty +IsWindow +IsWindowEnabled +IsWindowUnicode +IsWindowVisible +IsZoomed +KillTimer +LoadAcceleratorsA +LoadAcceleratorsW +LoadBitmapA +LoadBitmapW +LoadCursorA +LoadCursorFromFileA +LoadCursorFromFileW +LoadCursorW +LoadIconA +LoadIconW +LoadImageA +LoadImageW +LoadKeyboardLayoutA +LoadKeyboardLayoutW +LoadMenuA +LoadMenuIndirectA +LoadMenuIndirectW +LoadMenuW +LoadStringA +LoadStringW +LockSetForegroundWindow +LockWindowStation +LockWindowUpdate +LookupIconIdFromDirectory +LookupIconIdFromDirectoryEx +MapDialogRect +MapVirtualKeyA +MapVirtualKeyExA +MapVirtualKeyExW +MapVirtualKeyW +MapWindowPoints +MenuItemFromPoint +MessageBeep +MessageBoxA +MessageBoxExA +MessageBoxExW +MessageBoxIndirectA +MessageBoxIndirectW +MessageBoxW +ModifyAccess +ModifyMenuA +ModifyMenuW +MonitorFromPoint +MonitorFromRect +MonitorFromWindow +MoveWindow +MsgWaitForMultipleObjects +MsgWaitForMultipleObjectsEx +NotifyWinEvent +OemKeyScan +OemToCharA +OemToCharBuffA +OemToCharBuffW +OemToCharW +OffsetRect +OpenClipboard +OpenDesktopA +OpenDesktopW +OpenIcon +OpenInputDesktop +OpenWindowStationA +OpenWindowStationW +PackDDElParam +PaintDesktop +PeekMessageA +PeekMessageW +PlaySoundEvent +PostMessageA +PostMessageW +PostQuitMessage +PostThreadMessageA +PostThreadMessageW +PtInRect +RealChildWindowFromPoint +RealGetWindowClass +RedrawWindow +RegisterClassA +RegisterClassExA +RegisterClassExW +RegisterClassW +RegisterClipboardFormatA +RegisterClipboardFormatW +RegisterDeviceNotificationA +RegisterDeviceNotificationW +RegisterHotKey +RegisterLogonProcess +RegisterNetworkCapabilities +RegisterSystemThread +RegisterTasklist +RegisterWindowMessageA +RegisterWindowMessageW +ReleaseCapture +ReleaseDC +RemoveMenu +RemovePropA +RemovePropW +ReplyMessage +ReuseDDElParam +ScreenToClient +ScrollDC +ScrollWindow +ScrollWindowEx +SendDlgItemMessageA +SendDlgItemMessageW +SendIMEMessageExA +SendIMEMessageExW +SendInput +SendMessageA +SendMessageCallbackA +SendMessageCallbackW +SendMessageTimeoutA +SendMessageTimeoutW +SendMessageW +SendNotifyMessageA +SendNotifyMessageW +SetActiveWindow +SetCapture +SetCaretBlinkTime +SetCaretPos +SetClassLongA +SetClassLongW +SetClassWord +SetClipboardData +SetClipboardViewer +SetCursor +SetCursorPos +SetDebugErrorLevel +SetDeskWallpaper +SetDesktopBitmap +SetDlgItemInt +SetDlgItemTextA +SetDlgItemTextW +SetDoubleClickTime +SetFocus +SetForegroundWindow +SetInternalWindowPos +SetKeyboardState +SetLastErrorEx +SetLogonNotifyWindow +SetMenu +SetMenuContextHelpId +SetMenuDefaultItem +SetMenuInfo +SetMenuItemBitmaps +SetMenuItemInfoA +SetMenuItemInfoW +SetMessageExtraInfo +SetMessageQueue +SetParent +SetProcessDefaultLayout +SetProcessWindowStation +SetPropA +SetPropW +SetRect +SetRectEmpty +SetScrollInfo +SetScrollPos +SetScrollRange +SetShellWindow +SetSysColors +SetSysColorsTemp +SetSystemCursor +SetThreadDesktop +SetTimer +SetUserObjectInformationA +SetUserObjectInformationW +SetUserObjectSecurity +SetWinEventHook +SetWindowContextHelpId +SetWindowFullScreenState +SetWindowLongA +SetWindowLongW +SetWindowPlacement +SetWindowPos +SetWindowRgn +SetWindowTextA +SetWindowTextW +SetWindowWord +SetWindowsHookA +SetWindowsHookExA +SetWindowsHookExW +SetWindowsHookW +ShowCaret +ShowCursor +ShowOwnedPopups +ShowScrollBar +ShowWindow +ShowWindowAsync +SubtractRect +SwapMouseButton +SwitchDesktop +SwitchToThisWindow +SysErrorBox +SystemParametersInfoA +SystemParametersInfoW +TabbedTextOutA +TabbedTextOutW +TileChildWindows +TileWindows +ToAscii +ToAsciiEx +ToUnicode +ToUnicodeEx +TrackMouseEvent +TrackPopupMenu +TrackPopupMenuEx +TranslateAccelerator +TranslateAcceleratorA +TranslateAcceleratorW +TranslateMDISysAccel +TranslateMessage +UnhookWinEvent +UnhookWindowsHook +UnhookWindowsHookEx +UnionRect +UnloadKeyboardLayout +UnlockWindowStation +UnpackDDElParam +UnregisterClassA +UnregisterClassW +UnregisterDeviceNotification +UnregisterHotKey +UpdateWindow +UserClientDllInitialize +UserIsSystemResumeAutomatic +UserSetDeviceHoldState +UserSignalProc +UserTickleTimer +ValidateRect +ValidateRgn +VkKeyScanA +VkKeyScanExA +VkKeyScanExW +VkKeyScanW +WINNLSEnableIME +WINNLSGetEnableStatus +WINNLSGetIMEHotkey +WNDPROC_CALLBACK +WaitForInputIdle +WaitMessage +WinHelpA +WinHelpW +WinOldAppHackoMatic +WindowFromDC +WindowFromPoint +YieldTask +_SetProcessDefaultLayout +keybd_event +mouse_event +wsprintfA +wsprintfW +wvsprintfA +wvsprintfW diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/libtcc.dll b/.cache/overlay-toolchain/tcc_extract/tcc/libtcc.dll new file mode 100644 index 00000000..0a5d8179 Binary files /dev/null and b/.cache/overlay-toolchain/tcc_extract/tcc/libtcc.dll differ diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/libtcc/libtcc.def b/.cache/overlay-toolchain/tcc_extract/tcc/libtcc/libtcc.def new file mode 100644 index 00000000..bc866ab9 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/libtcc/libtcc.def @@ -0,0 +1,37 @@ +LIBRARY libtcc.dll + +EXPORTS +tcc_add_file +tcc_add_include_path +tcc_add_library +tcc_add_library_err +tcc_add_library_path +tcc_add_symbol +tcc_add_sysinclude_path +tcc_basename +tcc_compile_string +tcc_define_symbol +tcc_delete +tcc_error +tcc_error_noabort +tcc_fileextension +tcc_free +tcc_get_dllexports +tcc_get_symbol +tcc_malloc +tcc_mallocz +tcc_memcheck +tcc_new +tcc_output_file +tcc_parse_args +tcc_print_stats +tcc_realloc +tcc_relocate +tcc_run +tcc_set_error_func +tcc_set_lib_path +tcc_set_options +tcc_set_output_type +tcc_strdup +tcc_undefine_symbol +tcc_warning diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/libtcc/libtcc.h b/.cache/overlay-toolchain/tcc_extract/tcc/libtcc/libtcc.h new file mode 100644 index 00000000..a1b31e30 --- /dev/null +++ b/.cache/overlay-toolchain/tcc_extract/tcc/libtcc/libtcc.h @@ -0,0 +1,100 @@ +#ifndef LIBTCC_H +#define LIBTCC_H + +#ifndef LIBTCCAPI +# define LIBTCCAPI +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct TCCState; + +typedef struct TCCState TCCState; + +/* create a new TCC compilation context */ +LIBTCCAPI TCCState *tcc_new(void); + +/* free a TCC compilation context */ +LIBTCCAPI void tcc_delete(TCCState *s); + +/* set CONFIG_TCCDIR at runtime */ +LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path); + +/* set error/warning display callback */ +LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque, + void (*error_func)(void *opaque, const char *msg)); + +/* set options as from command line (multiple supported) */ +LIBTCCAPI void tcc_set_options(TCCState *s, const char *str); + +/*****************************/ +/* preprocessor */ + +/* add include path */ +LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname); + +/* add in system include path */ +LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname); + +/* define preprocessor symbol 'sym'. Can put optional value */ +LIBTCCAPI void tcc_define_symbol(TCCState *s, const char *sym, const char *value); + +/* undefine preprocess symbol 'sym' */ +LIBTCCAPI void tcc_undefine_symbol(TCCState *s, const char *sym); + +/*****************************/ +/* compiling */ + +/* add a file (C file, dll, object, library, ld script). Return -1 if error. */ +LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename); + +/* compile a string containing a C source. Return -1 if error. */ +LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf); + +/*****************************/ +/* linking commands */ + +/* set output type. MUST BE CALLED before any compilation */ +LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type); +#define TCC_OUTPUT_MEMORY 1 /* output will be run in memory (default) */ +#define TCC_OUTPUT_EXE 2 /* executable file */ +#define TCC_OUTPUT_DLL 3 /* dynamic library */ +#define TCC_OUTPUT_OBJ 4 /* object file */ +#define TCC_OUTPUT_PREPROCESS 5 /* only preprocess (used internally) */ + +/* equivalent to -Lpath option */ +LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname); + +/* the library name is the same as the argument of the '-l' option */ +LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname); + +/* add a symbol to the compiled program */ +LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val); + +/* output an executable, library or object file. DO NOT call + tcc_relocate() before. */ +LIBTCCAPI int tcc_output_file(TCCState *s, const char *filename); + +/* link and run main() function and return its value. DO NOT call + tcc_relocate() before. */ +LIBTCCAPI int tcc_run(TCCState *s, int argc, char **argv); + +/* do all relocations (needed before using tcc_get_symbol()) */ +LIBTCCAPI int tcc_relocate(TCCState *s1, void *ptr); +/* possible values for 'ptr': + - TCC_RELOCATE_AUTO : Allocate and manage memory internally + - NULL : return required memory size for the step below + - memory address : copy code to memory passed by the caller + returns -1 if error. */ +#define TCC_RELOCATE_AUTO (void*)1 + +/* return symbol value or NULL if not found */ +LIBTCCAPI void *tcc_get_symbol(TCCState *s, const char *name); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/.cache/overlay-toolchain/tcc_extract/tcc/tcc.exe b/.cache/overlay-toolchain/tcc_extract/tcc/tcc.exe new file mode 100644 index 00000000..2c8d0639 Binary files /dev/null and b/.cache/overlay-toolchain/tcc_extract/tcc/tcc.exe differ diff --git a/docs/MOD_PACKAGES.md b/docs/MOD_PACKAGES.md index f225cf1e..d025ed10 100644 --- a/docs/MOD_PACKAGES.md +++ b/docs/MOD_PACKAGES.md @@ -755,6 +755,13 @@ some selections of one feature is a `[[requirement]]`, not a dependency. ## Implicit requirements across packages +The shared PGXP plugin uses `psx_mod_set_pgxp_precision(enabled, cpu_mode)`. +This stores a session selection as well as setting live correction flags, so +later renderer initialization cannot erase mod activation with the base video +settings. Session start clears the selection before activating the new plan; +the player's persistent settings remain unchanged. Explicit validation +environment overrides still take precedence at renderer initialization. + Package format 7 lets a feature, while a condition on its own options holds, need a feature of **another** package: @@ -897,6 +904,27 @@ length. An audio-first disc or a nonzero first-track start is rejected. Use a CUE for a raw image containing multiple tracks. Declared volume metadata must have matching byte orders and 2048-byte logical sectors. +The resolved plan owns an immutable canonical snapshot. During its callbacks, +a trusted plugin calls `psx_mod_current_resource_bytes(id, &bytes, &size)` to +obtain a read-only view scoped to its own package and feature. Ordinary +unverified resources cannot supply bytes through this API. The pointer remains +valid until the committed plan is replaced or cleared. Decode into host or +enhancement memory and rebuild derived data when activation changes; never +reopen the owner path as a substitute for the verified snapshot. + +An activation callback can mount a slice of its verified resource for native CD +streaming with `psx_mod_append_disc_extent(id, byte_offset, sector_count, &lba)`. +The slice contains 2336-byte Mode-2 sectors beginning at the duplicated XA +subheader. The runtime appends extents after the mounted disc, synthesizes raw +sector headers and a data-track TOC/subchannel entry, and retains the original +CD-ROM/XA decoder, interrupts and timing. The returned LBAs are deterministic +for the same activation order. Registration rejects missing/unowned resources, +invalid ranges/subheaders, late calls and addresses beyond the CD MSF limit. +Plan replacement or netplay clearing removes the extents; base sectors remain +unchanged. The game plugin supplies its own file lookup, names and stream +selection. Donor bytes remain external and are covered by the resource fingerprint. + + Verified resource fingerprints include format, canonical size and SHA-256, rather than the selected path, so moving identical media or changing N64 byte order does not change save compatibility. Donor bytes are never package files, diff --git a/docs/TCP_COMMANDS.md b/docs/TCP_COMMANDS.md index d1812847..4b46ebce 100644 --- a/docs/TCP_COMMANDS.md +++ b/docs/TCP_COMMANDS.md @@ -56,7 +56,8 @@ Columns: **N** = native, **D** = DuckStation oracle. | `present_shot` | ✓ | | `path` | PNG of the **composed present surface** — the frame after the backend fits the display buffer to the window, so it carries the presented aspect. ⚠ every other capture resolves the display buffer *before* that fit: on a 508×256 display in a 4:3 window they answer 508×256 while the player sees 640×480. Use this one for anything aspect-shaped (widescreen, letterbox), where a pre-fit buffer would hide the very stage the change touches. Staged and fulfilled on the next present, so the ack means *queued* — poll `present_shot_seq`. Unavailable headless and on the Vulkan backend (its swapchain has no readback hook) | | `present_shot_seq` | ✓ | | — | Completion counter for `present_shot`, plus `wrote` (1 = that completion produced a PNG). Sample before staging, poll until `seq` moves. Advances on success *and* failure, so the poll always terminates | | `gl_interp` | ✓ | | — | OpenGL frame-rate presenter ([FRAME_RATE.md](FRAME_RATE.md)): enabled/suspended, host and target Hz, swaps, `source` (`vblank`/`flip`), `flip_period`, `captures` (new source frames) and `duplicates` (VBlanks that re-presented the same frame) | -| `render_pass_stats` | ✓ | | — | Render passes ([RENDER_PASSES.md](RENDER_PASSES.md)): plans, phases wanted/planned (shedding), passes, rollbacks (`nesting_repairs`: watchdog aborts whose skipped frame exits the restore undid), dropped device stores by class, `verify_mismatch` under `PSX_RENDER_PASS_VERIFY=1`, host-time split per pass, smoothed pass cost (`cost_us`; `cost_rewarms`: estimates no pass had run on for a while, measured again), presents made from pass images (`late_presents`: held past the frame's planned end because the next flip was late; `expired`: frames whose images stopped showing after several frame lengths without a flip), pass image textures allocated (`image_textures`, `image_bytes`), `status` (`psx_mod_render_pass_status`: 0 ready, 1 no presenter, 2 backend, 3 disabled, 4 session, 5 fast-forward, 6 busy), `backups_reused` (passes that reused the previous pass's VRAM backup) | +| `render_pass_stats` | ✓ | | — | Render passes ([RENDER_PASSES.md](RENDER_PASSES.md)): plans, phases wanted/planned (shedding), passes, rollbacks (`nesting_repairs`: watchdog aborts whose skipped frame exits the restore undid), dropped device stores by class, `verify_mismatch` under `PSX_RENDER_PASS_VERIFY=1`, host-time split per pass, smoothed pass cost (`cost_us`; `cost_rewarms`: estimates no pass had run on for a while, measured again), presents made from pass images (`late_presents`: held past the frame's planned end because the next flip was late; `expired`: frames whose images stopped showing after several frame lengths without a flip), pass image textures allocated (`image_textures`, `image_bytes`), `status` (`psx_mod_render_pass_status`: 0 ready, 1 no presenter, 2 backend, 3 disabled, 4 session, 5 fast-forward, 6 busy), `backups_reused` (passes that reused the previous pass's VRAM backup), `spans` / `span_failures` and the last failure `span_fail` (`psx_mod_run_guest_span`: reason, exit PC, `$ra`, PC after a call that did not return) | +| `window_size` | ✓ | | `w`, `h` | Resize the game window as a player would (Fit / adaptive widescreen follow it): window-shaped checks in `--hidden-window` runs. Pair with `present_shot` | | `render_pass_dump` | ✓ | | `path`, `count` | Write the images (the game's own frame, then each pass in phase order) of the next `count` frames that get passes as `/g__a.png` | | `render_pass_refuse` | ✓ | | `on` | Make the OpenGL backend decline render passes (`status` 2, BACKEND), as a renderer mode without them would; tests a plugin's fallback. `PSX_RENDER_PASS_REFUSE=1` does the same from start | | `geom_correction` | | ✓ | — | `[video] geometry_correction` / `perspective_texturing` engagement: enable flag plus free-running `geometry_vertex_hits` and `perspective_triangles` totals. Both enhancements silently fall back to the faithful path on anything they cannot prove is projected geometry, so a zero counter with the flag on means the title never qualifies — sample twice and diff for a rate. Also `texture_correction`. Its `pgxp` object adds the engine's per-lookup counters, the `position_fallback` / `preserve_projection` / `culling` switches, `ppp_produced` and `ppp_window_fallback` (exact projections outside the agreement window, shadowed with the IR path instead), geometry-corrected triangles split into `tri_precise` / `tri_mixed` / `tri_native` (the mixed share is the mesh-cracking exposure), `rect_bypass` / `rect_partial` (fully / partly precise textured quads that matched the 2D rectangle shortcut; only the former leave it) and `nclip_precise` / `nclip_disagree` / `nclip_corrected` (NCLIPs with an exact determinant, whose exact sign differs from the integer one, and that precise culling corrected); `ENHANCEMENTS.md` G1.11/G1.12 | @@ -430,9 +431,9 @@ The TCP server is the canonical instrumentation surface. Rule 3 in `CLAUDE.md` i ## Complete command index (generated) -**323 commands registered** — 310 on the native server (`runtime/src/debug_server.c`), 61 on the Beetle server (`runtime/src/beetle_debug_server.c`). +**334 commands registered** — 321 on the native server (`runtime/src/debug_server.c`), 61 on the Beetle server (`runtime/src/beetle_debug_server.c`). -62 of 323 have prose above; **261 are index-only**. An index-only command still works — it just has no description here yet. Send it `{"cmd":""}` and read the reply, or find its `handle_*` function in the server source. +63 of 334 have prose above; **271 are index-only**. An index-only command still works — it just has no description here yet. Send it `{"cmd":""}` and read the reply, or find its `handle_*` function in the server source. Regenerate with `python tools/gen_tcp_commands.py`; `--check` fails if this block has drifted from the code. @@ -452,6 +453,7 @@ Regenerate with `python tools/gen_tcp_commands.py`; `--check` fails if this bloc | `call_focus_stats` | ✓ | | | | `callret_watch` | ✓ | | ✓ | | `capture_freeze` | ✓ | | | +| `capture_mark` | ✓ | | | | `capture_quads` | ✓ | | | | `card_buffer_dump` | ✓ | | | | `card_data_writes` | ✓ | | | @@ -569,6 +571,7 @@ Regenerate with `python tools/gen_tcp_commands.py`; `--check` fails if this bloc | `gpu_opcodes` | ✓ | | | | `gpu_ring_stats` | ✓ | | | | `gpu_state` | ✓ | | ✓ | +| `gpu_timeline` | ✓ | | | | `gte_frame_stats` | ✓ | | | | `gte_intpl_dump` | ✓ | | | | `gte_latch_dump` | ✓ | | | @@ -603,6 +606,8 @@ Regenerate with `python tools/gen_tcp_commands.py`; `--check` fails if this bloc | `mmio_clear` | ✓ | | ✓ | | `mmio_dump` | ✓ | | ✓ | | `mmx6_freshfix` | ✓ | | | +| `mod_counters` | ✓ | | | +| `nclip_stats` | ✓ | | | | `overlay_candidates` | ✓ | | | | `overlay_capture_dump` | ✓ | | | | `overlay_cps_probe` | ✓ | | | @@ -632,9 +637,13 @@ Regenerate with `python tools/gen_tcp_commands.py`; `--check` fails if this bloc | `pc_probe_clear` | ✓ | | | | `pc_probe_dump` | ✓ | | | | `pgxp` | ✓ | | ✓ | +| `pgxp_miss_ring` | ✓ | | | +| `pgxp_shadow` | ✓ | | | | `phase_hot` | ✓ | | | | `phase_profile` | ✓ | | | | `ping` | ✓ | ✓ | ✓ | +| `present_image_ring_get` | ✓ | | | +| `present_image_ring_stats` | ✓ | | | | `present_ring` | ✓ | | | | `present_shot` | ✓ | | ✓ | | `present_shot_seq` | ✓ | | ✓ | @@ -651,6 +660,7 @@ Regenerate with `python tools/gen_tcp_commands.py`; `--check` fails if this bloc | `render_pass_dump` | ✓ | | ✓ | | `render_pass_refuse` | ✓ | | ✓ | | `render_pass_stats` | ✓ | | ✓ | +| `resident_status` | ✓ | | | | `restore_trace` | ✓ | | | | `restore_trace_clear` | ✓ | | | | `restore_trace_window` | ✓ | | | @@ -721,6 +731,7 @@ Regenerate with `python tools/gen_tcp_commands.py`; `--check` fails if this bloc | `watch` | ✓ | | ✓ | | `wide_full` | ✓ | | | | `wide_shot` | ✓ | | | +| `window_size` | ✓ | | ✓ | | `write_ram` | ✓ | | ✓ | | `ws_aspect` | ✓ | | | | `ws_aspect_cone_site` | ✓ | | | @@ -735,6 +746,7 @@ Regenerate with `python tools/gen_tcp_commands.py`; `--check` fails if this bloc | `ws_hud_mode` | ✓ | | | | `ws_margin` | ✓ | | | | `ws_nw` | ✓ | | | +| `ws_tag_stats` | ✓ | | | | `ws_ui_groups` | ✓ | | | | `wtrace_add` | ✓ | | | | `wtrace_all_dump` | ✓ | ✓ | | diff --git a/docs/WIDESCREEN.md b/docs/WIDESCREEN.md index 2d243e9e..741e6f66 100644 --- a/docs/WIDESCREEN.md +++ b/docs/WIDESCREEN.md @@ -25,6 +25,47 @@ OpenGL `test_gl_readback_region.c` fixture. MMX6 is the first consumer; owner gameplay validation is still pending (`beads-eio.3.146`). ## Earlier squash-mode implementation +## Explicit native-wide background polygons (September 2026) + +A title plugin can call `gpu_ws_tag_background_prim(prim)` for each opaque +background polygon in a verified composite, before submitting its ordering +table. The command starts at `prim + 4`; an embedded command can therefore use +`command_address - 4` even when that preceding word is not a DMA header. +The framework validates command type, RAM bounds, complete packet contents, +address and freshness. The title owns the proof that these are backgrounds +and that their union covers the authored viewport. No fixed game addresses or +background guesses belong in the shared API. + +OpenGL and software rendering stretch only those polygons about the display +center in the native-wide surface, preserving canonical VRAM and the default +4:3 path. Tag every part, including flat fills behind textured sky quads, so +the composite remains continuous. Tags expire after two frames and reject +reused packets whose words changed. This method performs no guest writes or +extra guest allocations. + +OpenGL preserves the tag across flat and textured batching. Once a valid +background has been tagged, it renders the full wide composite instead of +copying the canonical center over it, which would create a scale seam. Packet +freshness and displayed-pixel lifetime are separate: a slow game or held display +can retain stretched pixels after the two-frame packet guard expires. The +full-composite requirement therefore remains latched until GPU reset or snapshot +restore; packet-address/content freshness is not relaxed. Sessions that have not +tagged a background retain the center-copy optimization. Measure performance in +the title and validate the visible sky at the requested aspect before release. +Vulkan's native-wide compositor is not implemented; this API does not add one. + +### Parked validation checkpoint (2026-09-12) + +The focused GPU packet/tag regression passes, including expired packets, +changed packet contents, disabled widescreen and retained composite lifetime. +The V8 Windows runtime builds and both game CTests pass. In the oil-field +21:9 playtest the owner reports that terrain looks fine and the background +flickers less badly, but still flickers. This is partial improvement, not visual +acceptance. State replay required the HLE scheduler; repeat the comparison with +matched scheduler settings before attributing the improvement solely to this +change. Work is parked in a draft; no release is approved. + +## Earlier projection-and-stretch implementation Status as of 2026-06-13. Branch `feat/widescreen` in **both** `psxrecomp` (framework) and `TombaRecomp` (game opt-in + config), pushed to remote. diff --git a/docs/internal/FAITHFUL_TIMING_PLAN.md b/docs/internal/FAITHFUL_TIMING_PLAN.md index ff03478b..90b17471 100644 --- a/docs/internal/FAITHFUL_TIMING_PLAN.md +++ b/docs/internal/FAITHFUL_TIMING_PLAN.md @@ -756,6 +756,85 @@ on a fixed region -> next. Ledger `recompiler/tests/test_segment_aware_codegen.py` (synthetic KUSEG EXE, Beetle fetch transcription vs psx_icache.c): 10 known gaps, model checks exact. Not a live Beetle run (no oracle binary on the Mac); §7.2 lists the oracle runs. +- **2026-09-30 (Phase 5 owner-requested source checkpoint):** Preserve the + existing V8:2 combined-content title and generic callback/disc-extent support + on local `checkpoint/v82-combined-20260930` branches. Source, tests and + attribution only; donor media, generated outputs and playtest evidence stay + external. Owner explicitly paused further implementation, including + widescreen, original music and netplay, pending a check-in. No publication. + +- **2026-09-30 (Phase 5 Dreamland mushroom freeze):** `beads-eio.12.5` + identified an imported projectile flag write altering its callback, followed + by a skipped prologue and invalid return into the BIOS exception loop. The + title converter now tracks the local projectile factory and target pointers. + Added 4163 relocation/flag property cases and an opt-in native mushroom-event + stress driver; the old overlay fails and the repaired overlay completes both + families. All 16 title checks pass. No framework behavior changes. + +- **2026-09-30 (Phase 5 Dreamland effect cleanup):** `beads-eio.12.2` traced + the owner's frozen V8:2 match to an imported projectile effect writing its + matrix over the native child link. The title's input-overlay converter now + recognizes both effect-factory object returns. Five corrected field accesses, + owner-media regression checks, complete overlay code generation and a live + explosion allocation/free check validate the repair. No framework execution, + timing or generated-source changes; owner handoff remains at 1x rendering. + +- **2026-09-30 (Phase 5 instruction callbacks):** `beads-kbj0` adds plan-owned, + exact-word-guarded callbacks before opt-in game instructions, including branch + and delay slots. Native/overlay metadata participates in the codegen hash; + dirty-RAM execution routes through the same guard after load retirement. + Overlay ABI v27 forwards the callback. Runtime, parser/emitter and interpreter + routing checks pass. V8:2 uses seven seams for independent vehicle stats, + upgrades, transformation parts and special dependencies. Chassey's live match, + input/pause and savestate roundtrip were observed after correcting the title + allocator to retain shrinking allocations, matching its source implementation. + +- **2026-09-30 (Phase 5 mod-defined callbacks):** `beads-eio.3.212` adds + trusted mod-defined guest functions in an unused address range, separate + from original function-entry hooks. Active plans own availability and + callback resource context. Generated BIOS dispatch handles these through + its normal return/stack contract, with no synthetic guest instructions. + Runtime tests cover aliases, collisions, activation/clearing and nested + callback scopes; emitter tests cover routing before hardware dispatch. + OpenBIOS/SCPH1001 regenerated; V8:2 title rebuilt. Imported content still + needs its title-side runtime/selection adapters (`beads-eio.12.1`). + +- **2026-09-30 (Phase 5 combined V8 project):** Owner selected USA 2nd Offense + as the game-code base while retaining psxrecomp as the runtime/recompiler. + New local `Vigilante82PSXRecomp` builds against `071847ab`, reaches a stock + match, responds to driving input and reloads a savestate in an isolated run. + The reference's thirteen original-car conversions roundtrip successfully; + imported runtime/selector adapters remain title work (`beads-eio.12.1`). + No generic execution or hardware change was needed for this bring-up. + +- **2026-09-30 (Phase 5 callback reentrancy):** Plugin activation, VBlank and + function-entry callbacks now use the same scoped resource/completion context. + A native call inside an entry hook can deliver VBlank; previously those + callbacks cleared its plugin, making explicit completion fail and executing + the original function again. A regression fails before the fix and passes + after it, also refusing VBlank completion of the interrupted function. The + runtime test and seven V8 checks pass; isolated six-contact construction now + produces one chassis and survives drive/save/load. Tracked by `beads-i3ow`. + +- **2026-09-29 (Phase 5 mod function completion):** Trusted entry callbacks + may explicitly complete the current guest function through + `psx_mod_finish_function`. Static codegen, native overlay forwarding and both + dirty-RAM entry paths honor the callback result; nested callback completion + remains scoped to its CPU and invocation. ABI 26 / codegen 16 reject old + caches and states. Five focused framework checks pass. V8's independent + sequel-bank integration is being exercised separately under `beads-jogl`; + the generic mechanism is tracked by `beads-i3ow`. No title address or content + behavior is embedded in the framework. + +- **2026-09-29 (Phase 5 enhancement media):** Added format-8 verified donor + resources (exact canonical size/SHA-256, immutable snapshots scoped to the + owning plugin). N64 byte orders normalize before hashing; PSX identity covers + the first data track using the existing disc reader. Mixed-mode retail volume + sizes include audio and are not data-track lengths. Framework media/package/ + runtime tests pass; V8's isolated headless importer validates Super Dreamland + 64 from owner media. No CPU execution or timing changes. Arena conversion and + gameplay integration remain open. Local uncommitted work tracked by + `beads-09ww` and `beads-ip30`; content epic `beads-eio.5.13` remains open. - **2026-09-13 (SIO card hack removal — branch-only review checkpoint):** Reproduced fixed-Ape-RAM IRQ7/mask injection after an absent-card probe, diff --git a/find_func.py b/find_func.py new file mode 100644 index 00000000..cbfcd53f --- /dev/null +++ b/find_func.py @@ -0,0 +1,11 @@ +import json,sys +d=json.load(open(sys.argv[1])) +addrs=[int(x,16) for x in sys.argv[2:]] +funcs=d['functions'] +funcs.sort(key=lambda f:f['addr']) +import bisect +starts=[f['addr'] for f in funcs] +for a in addrs: + i=bisect.bisect_right(starts,a)-1 + f=funcs[i] + print(hex(a), '->', f['name'], hex(f['addr']), hex(f['end']), f.get('confidence')) diff --git a/generated/OpenBIOS.emitter.sha b/generated/OpenBIOS.emitter.sha index 9b5600be..8c2ec8ca 100644 --- a/generated/OpenBIOS.emitter.sha +++ b/generated/OpenBIOS.emitter.sha @@ -1 +1 @@ -8b10cee63c750fee313839c132742e52441938a70c5736576c140383240036df +ce9236c0e4e157e673c66063e9327f214ae88286e23fc9714af1b243d4334046 diff --git a/generated/OpenBIOS_full.c b/generated/OpenBIOS_full.c index ecb86e34..e784d9dd 100644 --- a/generated/OpenBIOS_full.c +++ b/generated/OpenBIOS_full.c @@ -1281,7 +1281,8 @@ label_BFC000B8: psx_cyc_step(cpu, 0x10004u); #endif /* 0xBFC000C0: 0202102B sltu $v0, $s0, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0202102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC000C0u); #endif @@ -1622,7 +1623,8 @@ label_BFC00118: psx_cyc_step(cpu, 0x10000u); #endif /* 0xBFC0011C: 321000FF andi $s0, $s0, 0xFF */ - cpu->gpr[16] = cpu->gpr[16] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[16] = cpu->gpr[16] & 0xFFu; + PGXP_ALU(0x321000FFu, cpu->gpr[16], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC0011Cu); #endif @@ -3945,7 +3947,8 @@ label_BFC003A8: psx_cyc_step(cpu, 0x48u); #endif /* 0xBFC003B8: 00661826 xor $v1, $v1, $a2 */ - cpu->gpr[3] = cpu->gpr[3] ^ cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[3] = cpu->gpr[3] ^ cpu->gpr[6]; + PGXP_ALU(0x00661826u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC003B8u); #endif @@ -4118,7 +4121,8 @@ label_BFC003D0: psx_cyc_step(cpu, 0x60u); #endif /* 0xBFC003E0: 00A62826 xor $a1, $a1, $a2 */ - cpu->gpr[5] = cpu->gpr[5] ^ cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[5] = cpu->gpr[5] ^ cpu->gpr[6]; + PGXP_ALU(0x00A62826u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC003E0u); #endif @@ -4170,7 +4174,8 @@ label_BFC003E4: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC003EC: 00451026 xor $v0, $v0, $a1 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[5]; + PGXP_ALU(0x00451026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC003ECu); #endif @@ -4189,7 +4194,8 @@ label_BFC003E4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC003F4: 2C420001 sltiu $v0, $v0, 1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC003F4u); #endif @@ -4816,7 +4822,8 @@ label_BFC00478: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC00488: 30E700F0 andi $a3, $a3, 0xF0 */ - cpu->gpr[7] = cpu->gpr[7] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0xF0u; + PGXP_ALU(0x30E700F0u, cpu->gpr[7], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0xBFC00488u); #endif @@ -5388,7 +5395,8 @@ label_BFC00514: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC00514: 38820052 xori $v0, $a0, 0x52 */ - cpu->gpr[2] = cpu->gpr[4] ^ 0x52u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] ^ 0x52u; + PGXP_ALU(0x38820052u, cpu->gpr[2], _pgx1, 0x0052u); } #ifdef PSX_COSIM cosim_instr(0xBFC00514u); #endif @@ -5407,7 +5415,8 @@ label_BFC00514: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC0051C: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0051Cu); #endif @@ -5442,7 +5451,8 @@ label_BFC00520: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC00520: 38820051 xori $v0, $a0, 0x51 */ - cpu->gpr[2] = cpu->gpr[4] ^ 0x51u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] ^ 0x51u; + PGXP_ALU(0x38820051u, cpu->gpr[2], _pgx1, 0x0051u); } #ifdef PSX_COSIM cosim_instr(0xBFC00520u); #endif @@ -5461,7 +5471,8 @@ label_BFC00520: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC00528: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC00528u); #endif @@ -13509,7 +13520,8 @@ label_BFC00D4C: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC00D54: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC00D54u); #endif @@ -15460,7 +15472,8 @@ label_BFC00F38: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC00F64: 2C430009 sltiu $v1, $v0, 9 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000009u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000009u ? 1 : 0); + PGXP_ALU(0x2C430009u, cpu->gpr[3], _pgx1, 0x0009u); } #ifdef PSX_COSIM cosim_instr(0xBFC00F64u); #endif @@ -19391,7 +19404,8 @@ label_BFC01364: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC01378: 2842000F slti $v0, $v0, 15 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + PGXP_ALU(0x2842000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC01378u); #endif @@ -21063,7 +21077,8 @@ label_BFC0150C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC01520: 28420014 slti $v0, $v0, 20 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (20) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (20) ? 1 : 0); + PGXP_ALU(0x28420014u, cpu->gpr[2], _pgx1, 0x0014u); } #ifdef PSX_COSIM cosim_instr(0xBFC01520u); #endif @@ -23647,7 +23662,8 @@ label_BFC017B0: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC017B4: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC017B4u); #endif @@ -26795,7 +26811,8 @@ label_BFC01AE8: psx_cyc_step(cpu, 0x10004u); #endif /* 0xBFC01AE8: 2A02000F slti $v0, $s0, 15 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[16] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[16] < (15) ? 1 : 0); + PGXP_ALU(0x2A02000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC01AE8u); #endif @@ -28285,7 +28302,8 @@ label_BFC01C40: psx_cyc_step(cpu, 0x800004u); #endif /* 0xBFC01C40: 32E28000 andi $v0, $s7, 0x8000 */ - cpu->gpr[2] = cpu->gpr[23] & 0x8000u; + { uint32_t _pgx1 = cpu->gpr[23]; cpu->gpr[2] = cpu->gpr[23] & 0x8000u; + PGXP_ALU(0x32E28000u, cpu->gpr[2], _pgx1, 0x8000u); } #ifdef PSX_COSIM cosim_instr(0xBFC01C40u); #endif @@ -28479,7 +28497,8 @@ label_BFC01C5C: psx_cyc_step(cpu, 0x800004u); #endif /* 0xBFC01C70: 32E20200 andi $v0, $s7, 0x200 */ - cpu->gpr[2] = cpu->gpr[23] & 0x200u; + { uint32_t _pgx1 = cpu->gpr[23]; cpu->gpr[2] = cpu->gpr[23] & 0x200u; + PGXP_ALU(0x32E20200u, cpu->gpr[2], _pgx1, 0x0200u); } #ifdef PSX_COSIM cosim_instr(0xBFC01C70u); #endif @@ -28798,7 +28817,8 @@ label_BFC01CBC: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC01CC4: 30C600F0 andi $a2, $a2, 0xF0 */ - cpu->gpr[6] = cpu->gpr[6] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0xF0u; + PGXP_ALU(0x30C600F0u, cpu->gpr[6], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0xBFC01CC4u); #endif @@ -28950,7 +28970,8 @@ label_BFC01CE0: psx_cyc_step(cpu, 0x84u); #endif /* 0xBFC01CE8: 0047102B sltu $v0, $v0, $a3 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x0047102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01CE8u); #endif @@ -29103,7 +29124,8 @@ label_BFC01D0C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC01D14: 304200F0 andi $v0, $v0, 0xF0 */ - cpu->gpr[2] = cpu->gpr[2] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xF0u; + PGXP_ALU(0x304200F0u, cpu->gpr[2], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0xBFC01D14u); #endif @@ -29351,7 +29373,8 @@ label_BFC01D4C: psx_cyc_step(cpu, 0x1010u); #endif /* 0xBFC01D54: 2C8C0001 sltiu $t4, $a0, 1 */ - cpu->gpr[12] = (uint32_t)(cpu->gpr[4] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[12] = (uint32_t)(cpu->gpr[4] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C8C0001u, cpu->gpr[12], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC01D54u); #endif @@ -29467,7 +29490,8 @@ label_BFC01D6C: psx_cyc_step(cpu, 0x94u); #endif /* 0xBFC01D70: 0047202B sltu $a0, $v0, $a3 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x0047202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01D70u); #endif @@ -29520,7 +29544,8 @@ label_BFC01D7C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC01D7C: 28420002 slti $v0, $v0, 2 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (2) ? 1 : 0); + PGXP_ALU(0x28420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC01D7Cu); #endif @@ -33843,7 +33868,8 @@ label_BFC021C4: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC021E4: 30A500F0 andi $a1, $a1, 0xF0 */ - cpu->gpr[5] = cpu->gpr[5] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xF0u; + PGXP_ALU(0x30A500F0u, cpu->gpr[5], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0xBFC021E4u); #endif @@ -35457,7 +35483,8 @@ label_BFC02378: psx_cyc_step(cpu, 0x58u); #endif /* 0xBFC02378: 0083302B sltu $a2, $a0, $v1 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[4] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[6] = (uint32_t)(cpu->gpr[4] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0083302Bu, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02378u); #endif @@ -35510,7 +35537,8 @@ label_BFC02384: psx_cyc_step(cpu, 0x1Cu); #endif /* 0xBFC02384: 0043202B sltu $a0, $v0, $v1 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02384u); #endif @@ -37718,7 +37746,8 @@ label_BFC025AC: psx_cyc_step(cpu, 0x60u); #endif /* 0xBFC025AC: 28C50040 slti $a1, $a2, 64 */ - cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[6] < (64) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[6] < (64) ? 1 : 0); + PGXP_ALU(0x28C50040u, cpu->gpr[5], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0xBFC025ACu); #endif @@ -38870,7 +38899,8 @@ label_BFC026BC: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC026C4: 3222007F andi $v0, $s1, 0x7F */ - cpu->gpr[2] = cpu->gpr[17] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[2] = cpu->gpr[17] & 0x7Fu; + PGXP_ALU(0x3222007Fu, cpu->gpr[2], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC026C4u); #endif @@ -38943,7 +38973,8 @@ label_BFC026D0: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC026D8: 0222102B sltu $v0, $s1, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[17] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[17] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0222102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC026D8u); #endif @@ -39285,7 +39316,8 @@ label_BFC02738: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC02740: 30428000 andi $v0, $v0, 0x8000 */ - cpu->gpr[2] = cpu->gpr[2] & 0x8000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x8000u; + PGXP_ALU(0x30428000u, cpu->gpr[2], _pgx1, 0x8000u); } #ifdef PSX_COSIM cosim_instr(0xBFC02740u); #endif @@ -39529,7 +39561,8 @@ label_BFC02774: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC02774: 3222003F andi $v0, $s1, 0x3F */ - cpu->gpr[2] = cpu->gpr[17] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[2] = cpu->gpr[17] & 0x3Fu; + PGXP_ALU(0x3222003Fu, cpu->gpr[2], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC02774u); #endif @@ -39626,7 +39659,8 @@ label_BFC02784: psx_cyc_step(cpu, 0x90004u); #endif /* 0xBFC0278C: 0270102A slt $v0, $s3, $s0 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0270102Au, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0278Cu); #endif @@ -42244,7 +42278,8 @@ label_BFC02A20: psx_cyc_step(cpu, 0x40004u); #endif /* 0xBFC02A28: 3242007F andi $v0, $s2, 0x7F */ - cpu->gpr[2] = cpu->gpr[18] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[2] = cpu->gpr[18] & 0x7Fu; + PGXP_ALU(0x3242007Fu, cpu->gpr[2], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC02A28u); #endif @@ -42317,7 +42352,8 @@ label_BFC02A34: psx_cyc_step(cpu, 0x40004u); #endif /* 0xBFC02A3C: 0242102B sltu $v0, $s2, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[18] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[18] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0242102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02A3Cu); #endif @@ -42659,7 +42695,8 @@ label_BFC02A9C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC02AA4: 30428000 andi $v0, $v0, 0x8000 */ - cpu->gpr[2] = cpu->gpr[2] & 0x8000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x8000u; + PGXP_ALU(0x30428000u, cpu->gpr[2], _pgx1, 0x8000u); } #ifdef PSX_COSIM cosim_instr(0xBFC02AA4u); #endif @@ -42891,7 +42928,8 @@ label_BFC02AD4: psx_cyc_step(cpu, 0x40008u); #endif /* 0xBFC02AD4: 3243003F andi $v1, $s2, 0x3F */ - cpu->gpr[3] = cpu->gpr[18] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[3] = cpu->gpr[18] & 0x3Fu; + PGXP_ALU(0x3243003Fu, cpu->gpr[3], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC02AD4u); #endif @@ -42988,7 +43026,8 @@ label_BFC02AE4: psx_cyc_step(cpu, 0x280004u); #endif /* 0xBFC02AEC: 0275102A slt $v0, $s3, $s5 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0275102Au, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02AECu); #endif @@ -50849,7 +50888,8 @@ label_BFC032B4: psx_cyc_step(cpu, 0x40010004u); #endif /* 0xBFC032C4: 021E102B sltu $v0, $s0, $fp */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[30] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[30]; cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[30] ? 1 : 0); + PGXP_ALU(0x021E102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC032C4u); #endif @@ -51113,7 +51153,8 @@ label_BFC0330C: psx_cyc_step(cpu, 0x20108u); #endif /* 0xBFC0330C: 0228182A slt $v1, $s1, $t0 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0228182Au, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0330Cu); #endif @@ -51429,7 +51470,8 @@ label_BFC03354: psx_cyc_step(cpu, 0x244u); #endif /* 0xBFC03354: 0049302A slt $a2, $v0, $t1 */ - cpu->gpr[6] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[6] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0049302Au, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03354u); #endif @@ -53045,7 +53087,8 @@ label_BFC034F8: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC03504: 00641826 xor $v1, $v1, $a0 */ - cpu->gpr[3] = cpu->gpr[3] ^ cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[3] ^ cpu->gpr[4]; + PGXP_ALU(0x00641826u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03504u); #endif @@ -53412,7 +53455,8 @@ label_BFC03564: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0356C: 30430001 andi $v1, $v0, 0x1 */ - cpu->gpr[3] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30430001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC0356Cu); #endif @@ -53496,7 +53540,8 @@ label_BFC0357C: psx_cyc_step(cpu, 0x110004u); #endif /* 0xBFC03580: 0214102B sltu $v0, $s0, $s4 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[20] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[20]; cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[20] ? 1 : 0); + PGXP_ALU(0x0214102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03580u); #endif @@ -53888,7 +53933,8 @@ label_BFC035D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC035D0: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC035D0u); #endif @@ -54177,7 +54223,8 @@ label_BFC03610: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC0361C: 2C84001A sltiu $a0, $a0, 26 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2C84001Au, cpu->gpr[4], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC0361Cu); #endif @@ -54231,7 +54278,8 @@ label_BFC03628: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC03628: 00451024 and $v0, $v0, $a1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[5]; + PGXP_ALU(0x00451024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03628u); #endif @@ -55022,7 +55070,8 @@ label_BFC036E0: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC036E4: 30C207FF andi $v0, $a2, 0x7FF */ - cpu->gpr[2] = cpu->gpr[6] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[6] & 0x7FFu; + PGXP_ALU(0x30C207FFu, cpu->gpr[2], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC036E4u); #endif @@ -55144,7 +55193,8 @@ label_BFC03700: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC03708: 304307FF andi $v1, $v0, 0x7FF */ - cpu->gpr[3] = cpu->gpr[2] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0x7FFu; + PGXP_ALU(0x304307FFu, cpu->gpr[3], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03708u); #endif @@ -55260,7 +55310,8 @@ label_BFC0371C: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC03724: 0043102B sltu $v0, $v0, $v1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03724u); #endif @@ -55461,7 +55512,8 @@ label_BFC03758: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC03758: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC03758u); #endif @@ -55899,7 +55951,8 @@ label_BFC037C0: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC037CC: 02221024 and $v0, $s1, $v0 */ - cpu->gpr[2] = cpu->gpr[17] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[17] & cpu->gpr[2]; + PGXP_ALU(0x02221024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC037CCu); #endif @@ -55922,7 +55975,8 @@ label_BFC037C0: psx_cyc_step(cpu, 0x30u); #endif /* 0xBFC037D4: 00A4202B sltu $a0, $a1, $a0 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x00A4202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC037D4u); #endif @@ -56199,7 +56253,8 @@ label_BFC0380C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0380C: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC0380Cu); #endif @@ -57844,7 +57899,8 @@ label_BFC039B0: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC039B0: 2CC6001A sltiu $a2, $a2, 26 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[6] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = (uint32_t)(cpu->gpr[6] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2CC6001Au, cpu->gpr[6], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC039B0u); #endif @@ -57898,7 +57954,8 @@ label_BFC039BC: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC039BC: 00681824 and $v1, $v1, $t0 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[8]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[8]; + PGXP_ALU(0x00681824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC039BCu); #endif @@ -58162,7 +58219,8 @@ label_BFC039FC: psx_cyc_step(cpu, 0xC8u); #endif /* 0xBFC039FC: 00C3382B sltu $a3, $a2, $v1 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[6] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[7] = (uint32_t)(cpu->gpr[6] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x00C3382Bu, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC039FCu); #endif @@ -58215,7 +58273,8 @@ label_BFC03A08: psx_cyc_step(cpu, 0x4Cu); #endif /* 0xBFC03A08: 0043302B sltu $a2, $v0, $v1 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043302Bu, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03A08u); #endif @@ -58563,7 +58622,8 @@ label_BFC03A54: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC03A54: 2C84001A sltiu $a0, $a0, 26 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2C84001Au, cpu->gpr[4], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC03A54u); #endif @@ -58617,7 +58677,8 @@ label_BFC03A60: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC03A60: 00461024 and $v0, $v0, $a2 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + PGXP_ALU(0x00461024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03A60u); #endif @@ -62272,7 +62333,8 @@ label_BFC03DE0: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC03DEC: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03DECu); #endif @@ -62347,7 +62409,8 @@ label_BFC03DF8: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC03DFC: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03DFCu); #endif @@ -62358,7 +62421,8 @@ label_BFC03DF8: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC03E00: 2CA51733 sltiu $a1, $a1, 5939 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < 0x00001733u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < 0x00001733u ? 1 : 0); + PGXP_ALU(0x2CA51733u, cpu->gpr[5], _pgx1, 0x1733u); } #ifdef PSX_COSIM cosim_instr(0xBFC03E00u); #endif @@ -62475,7 +62539,8 @@ label_BFC03E10: psx_cyc_step(cpu, 0x30u); #endif /* 0xBFC03E20: 0085282B sltu $a1, $a0, $a1 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[4] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[5] = (uint32_t)(cpu->gpr[4] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0085282Bu, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03E20u); #endif @@ -62628,7 +62693,8 @@ label_BFC03E2C: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC03E50: 3082FFFF andi $v0, $a0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3082FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03E50u); #endif @@ -62833,7 +62899,8 @@ label_BFC03E70: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC03E74: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03E74u); #endif @@ -62844,7 +62911,8 @@ label_BFC03E70: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC03E78: 2C42037F sltiu $v0, $v0, 895 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000037Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000037Fu ? 1 : 0); + PGXP_ALU(0x2C42037Fu, cpu->gpr[2], _pgx1, 0x037Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC03E78u); #endif @@ -62997,7 +63065,8 @@ label_BFC03E94: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC03EA0: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03EA0u); #endif @@ -63116,7 +63185,8 @@ label_BFC03EC0: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC03EC0: 3063FFFF andi $v1, $v1, 0xFFFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + PGXP_ALU(0x3063FFFFu, cpu->gpr[3], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03EC0u); #endif @@ -63127,7 +63197,8 @@ label_BFC03EC0: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC03EC4: 2C630FD4 sltiu $v1, $v1, 4052 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000FD4u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000FD4u ? 1 : 0); + PGXP_ALU(0x2C630FD4u, cpu->gpr[3], _pgx1, 0x0FD4u); } #ifdef PSX_COSIM cosim_instr(0xBFC03EC4u); #endif @@ -67424,7 +67495,8 @@ label_BFC04304: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC04304: 2C830010 sltiu $v1, $a0, 16 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < 0x00000010u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < 0x00000010u ? 1 : 0); + PGXP_ALU(0x2C830010u, cpu->gpr[3], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC04304u); #endif @@ -68746,7 +68818,8 @@ label_BFC0443C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC04440: 2C42000A sltiu $v0, $v0, 10 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2C42000Au, cpu->gpr[2], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC04440u); #endif @@ -69220,7 +69293,8 @@ label_BFC044B0: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC044B0: 2D08000A sltiu $t0, $t0, 10 */ - cpu->gpr[8] = (uint32_t)(cpu->gpr[8] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = (uint32_t)(cpu->gpr[8] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2D08000Au, cpu->gpr[8], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC044B0u); #endif @@ -69514,7 +69588,8 @@ label_BFC044F0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC044F8: 30421000 andi $v0, $v0, 0x1000 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1000u; + PGXP_ALU(0x30421000u, cpu->gpr[2], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0xBFC044F8u); #endif @@ -70320,7 +70395,8 @@ label_BFC045B8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC045CC: 30420001 andi $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC045CCu); #endif @@ -73347,7 +73423,8 @@ label_BFC048AC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC048B4: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC048B4u); #endif @@ -73599,7 +73676,8 @@ label_BFC048E4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC048F4: 30420004 andi $v0, $v0, 0x4 */ - cpu->gpr[2] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30420004u, cpu->gpr[2], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC048F4u); #endif @@ -74633,7 +74711,8 @@ label_BFC049E0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC049E8: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC049E8u); #endif @@ -74885,7 +74964,8 @@ label_BFC04A18: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC04A28: 30420004 andi $v0, $v0, 0x4 */ - cpu->gpr[2] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30420004u, cpu->gpr[2], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC04A28u); #endif @@ -77343,7 +77423,8 @@ label_BFC04C70: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC04C74: 00621024 and $v0, $v1, $v0 */ - cpu->gpr[2] = cpu->gpr[3] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[3] & cpu->gpr[2]; + PGXP_ALU(0x00621024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC04C74u); #endif @@ -78209,7 +78290,8 @@ label_BFC04D3C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC04D44: 30420007 andi $v0, $v0, 0x7 */ - cpu->gpr[2] = cpu->gpr[2] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x7u; + PGXP_ALU(0x30420007u, cpu->gpr[2], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0xBFC04D44u); #endif @@ -78712,7 +78794,8 @@ label_BFC04DB8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC04DC0: 3042007F andi $v0, $v0, 0x7F */ - cpu->gpr[2] = cpu->gpr[2] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x7Fu; + PGXP_ALU(0x3042007Fu, cpu->gpr[2], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC04DC0u); #endif @@ -79103,7 +79186,8 @@ label_BFC04E1C: psx_cyc_step(cpu, 0x30008u); #endif /* 0xBFC04E20: 0230182B sltu $v1, $s1, $s0 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[17] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[3] = (uint32_t)(cpu->gpr[17] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0230182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC04E20u); #endif @@ -79608,7 +79692,8 @@ label_BFC04E84: psx_cyc_step(cpu, 0x50008u); #endif /* 0xBFC04E84: 0212182B sltu $v1, $s0, $s2 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[16] < cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[3] = (uint32_t)(cpu->gpr[16] < cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0212182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC04E84u); #endif @@ -79815,7 +79900,8 @@ label_BFC04EB0: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC04EB0: 28430020 slti $v1, $v0, 32 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (32) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (32) ? 1 : 0); + PGXP_ALU(0x28430020u, cpu->gpr[3], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0xBFC04EB0u); #endif @@ -79900,7 +79986,8 @@ label_BFC04EC4: psx_cyc_step(cpu, 0x50004u); #endif /* 0xBFC04EC4: 0212102B sltu $v0, $s0, $s2 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0212102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC04EC4u); #endif @@ -83370,7 +83457,8 @@ label_BFC0522C: psx_cyc_step(cpu, 0x80008u); #endif /* 0xBFC05234: 00731824 and $v1, $v1, $s3 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[19]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[19]; + PGXP_ALU(0x00731824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC05234u); #endif @@ -83451,7 +83539,8 @@ label_BFC05240: psx_cyc_step(cpu, 0x48u); #endif /* 0xBFC05248: 30C3FFFF andi $v1, $a2, 0xFFFF */ - cpu->gpr[3] = cpu->gpr[6] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[3] = cpu->gpr[6] & 0xFFFFu; + PGXP_ALU(0x30C3FFFFu, cpu->gpr[3], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC05248u); #endif @@ -83474,7 +83563,8 @@ label_BFC05240: psx_cyc_step(cpu, 0x10000u); #endif /* 0xBFC05250: 3210FFFF andi $s0, $s0, 0xFFFF */ - cpu->gpr[16] = cpu->gpr[16] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[16] = cpu->gpr[16] & 0xFFFFu; + PGXP_ALU(0x3210FFFFu, cpu->gpr[16], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC05250u); #endif @@ -84170,7 +84260,8 @@ label_BFC052F4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC05308: 00621824 and $v1, $v1, $v0 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[2]; + PGXP_ALU(0x00621824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC05308u); #endif @@ -84299,7 +84390,8 @@ label_BFC05324: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC0532C: 00641824 and $v1, $v1, $a0 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + PGXP_ALU(0x00641824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0532Cu); #endif @@ -84708,7 +84800,8 @@ label_BFC05384: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC0538C: 00641824 and $v1, $v1, $a0 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + PGXP_ALU(0x00641824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0538Cu); #endif @@ -84825,7 +84918,8 @@ label_BFC053A4: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC053AC: 00441024 and $v0, $v0, $a0 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[4]; + PGXP_ALU(0x00441024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC053ACu); #endif @@ -85188,7 +85282,8 @@ label_BFC053E0: psx_cyc_step(cpu, 0x50u); #endif /* 0xBFC05410: 30C4FFFF andi $a0, $a2, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[6] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[4] = cpu->gpr[6] & 0xFFFFu; + PGXP_ALU(0x30C4FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC05410u); #endif @@ -86811,7 +86906,8 @@ label_BFC055D8: psx_cyc_step(cpu, 0x38u); #endif /* 0xBFC055D8: 0065202B sltu $a0, $v1, $a1 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[3] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[4] = (uint32_t)(cpu->gpr[3] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0065202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC055D8u); #endif @@ -87079,7 +87175,8 @@ label_BFC05618: psx_cyc_step(cpu, 0x38u); #endif /* 0xBFC05618: 0064282B sltu $a1, $v1, $a0 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[5] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064282Bu, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC05618u); #endif @@ -87705,7 +87802,8 @@ label_BFC056B4: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC056B4: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC056B4u); #endif @@ -87922,7 +88020,8 @@ label_BFC056EC: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC056EC: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC056ECu); #endif @@ -88128,7 +88227,8 @@ label_BFC05724: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC05724: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC05724u); #endif @@ -88275,7 +88375,8 @@ label_BFC0574C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC0574C: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC0574Cu); #endif @@ -88526,7 +88627,8 @@ label_BFC0578C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC0578C: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC0578Cu); #endif @@ -89314,7 +89416,8 @@ label_BFC05858: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0585C: 2C63001A sltiu $v1, $v1, 26 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2C63001Au, cpu->gpr[3], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC0585Cu); #endif @@ -89380,7 +89483,8 @@ label_BFC05868: psx_cyc_step(cpu, 0x1Cu); #endif /* 0xBFC0586C: 00831024 and $v0, $a0, $v1 */ - cpu->gpr[2] = cpu->gpr[4] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[4] & cpu->gpr[3]; + PGXP_ALU(0x00831024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0586Cu); #endif @@ -89464,7 +89568,8 @@ label_BFC05878: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0587C: 2C63001A sltiu $v1, $v1, 26 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2C63001Au, cpu->gpr[3], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC0587Cu); #endif @@ -90541,7 +90646,8 @@ label_BFC05958: psx_cyc_step(cpu, 0x90u); #endif /* 0xBFC05960: 2C870001 sltiu $a3, $a0, 1 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[4] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[7] = (uint32_t)(cpu->gpr[4] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C870001u, cpu->gpr[7], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC05960u); #endif @@ -95822,7 +95928,8 @@ label_BFC05E74: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC05E78: 2C43000A sltiu $v1, $v0, 10 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2C43000Au, cpu->gpr[3], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC05E78u); #endif @@ -95887,7 +95994,8 @@ label_BFC05E84: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC05E88: 00821024 and $v0, $a0, $v0 */ - cpu->gpr[2] = cpu->gpr[4] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[4] & cpu->gpr[2]; + PGXP_ALU(0x00821024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC05E88u); #endif @@ -95910,7 +96018,8 @@ label_BFC05E84: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC05E90: 2C420006 sltiu $v0, $v0, 6 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000006u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000006u ? 1 : 0); + PGXP_ALU(0x2C420006u, cpu->gpr[2], _pgx1, 0x0006u); } #ifdef PSX_COSIM cosim_instr(0xBFC05E90u); #endif @@ -96011,7 +96120,8 @@ label_BFC05EA4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC05EA8: 2C42001A sltiu $v0, $v0, 26 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2C42001Au, cpu->gpr[2], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC05EA8u); #endif @@ -96157,7 +96267,8 @@ label_BFC05EC4: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC05EC8: 00442026 xor $a0, $v0, $a0 */ - cpu->gpr[4] = cpu->gpr[2] ^ cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[2] ^ cpu->gpr[4]; + PGXP_ALU(0x00442026u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC05EC8u); #endif @@ -97072,7 +97183,8 @@ label_BFC05F90: psx_cyc_step(cpu, 0x4Cu); #endif /* 0xBFC05F94: 0043302B sltu $a2, $v0, $v1 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043302Bu, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC05F94u); #endif @@ -97473,7 +97585,8 @@ label_BFC05FE4: psx_cyc_step(cpu, 0x4Cu); #endif /* 0xBFC05FE8: 0043302B sltu $a2, $v0, $v1 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043302Bu, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC05FE8u); #endif @@ -98786,7 +98899,8 @@ label_BFC060E4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0610C: 30427FFF andi $v0, $v0, 0x7FFF */ - cpu->gpr[2] = cpu->gpr[2] & 0x7FFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x7FFFu; + PGXP_ALU(0x30427FFFu, cpu->gpr[2], _pgx1, 0x7FFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC0610Cu); #endif @@ -99426,7 +99540,8 @@ label_BFC061A0: psx_cyc_step(cpu, 0x20044u); #endif /* 0xBFC061A0: 0226102A slt $v0, $s1, $a2 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x0226102Au, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC061A0u); #endif @@ -99937,7 +100052,8 @@ label_BFC06220: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC06220: 2C82000F sltiu $v0, $a0, 15 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[4] < 0x0000000Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = (uint32_t)(cpu->gpr[4] < 0x0000000Fu ? 1 : 0); + PGXP_ALU(0x2C82000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC06220u); #endif @@ -100639,7 +100755,8 @@ label_BFC062A8: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC062BC: 00A21024 and $v0, $a1, $v0 */ - cpu->gpr[2] = cpu->gpr[5] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[5] & cpu->gpr[2]; + PGXP_ALU(0x00A21024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC062BCu); #endif @@ -100671,7 +100788,8 @@ label_BFC062C0: psx_cyc_step(cpu, 0x50u); #endif /* 0xBFC062C0: 28860009 slti $a2, $a0, 9 */ - cpu->gpr[6] = (uint32_t)((int32_t)cpu->gpr[4] < (9) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[6] = (uint32_t)((int32_t)cpu->gpr[4] < (9) ? 1 : 0); + PGXP_ALU(0x28860009u, cpu->gpr[6], _pgx1, 0x0009u); } #ifdef PSX_COSIM cosim_instr(0xBFC062C0u); #endif @@ -101246,7 +101364,8 @@ label_BFC06348: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC06348: 28430800 slti $v1, $v0, 2048 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (2048) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (2048) ? 1 : 0); + PGXP_ALU(0x28430800u, cpu->gpr[3], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0xBFC06348u); #endif @@ -102912,7 +103031,8 @@ label_BFC064E4: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC064E8: 2CA5001A sltiu $a1, $a1, 26 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2CA5001Au, cpu->gpr[5], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC064E8u); #endif @@ -102966,7 +103086,8 @@ label_BFC064F4: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC064F4: 00461024 and $v0, $v0, $a2 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + PGXP_ALU(0x00461024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC064F4u); #endif @@ -105726,7 +105847,8 @@ label_BFC067D4: psx_cyc_step(cpu, 0x80028u); #endif /* 0xBFC067D4: 0073282A slt $a1, $v1, $s3 */ - cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0073282Au, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC067D4u); #endif @@ -105811,7 +105933,8 @@ label_BFC067E8: psx_cyc_step(cpu, 0x40048u); #endif /* 0xBFC067E8: 0072302A slt $a2, $v1, $s2 */ - cpu->gpr[6] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[6] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0072302Au, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC067E8u); #endif @@ -106917,7 +107040,8 @@ label_BFC068F8: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC068F8: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC068F8u); #endif @@ -107065,7 +107189,8 @@ label_BFC06924: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC06924: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06924u); #endif @@ -107577,7 +107702,8 @@ label_BFC069A8: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC069AC: 2C820005 sltiu $v0, $a0, 5 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[4] < 0x00000005u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = (uint32_t)(cpu->gpr[4] < 0x00000005u ? 1 : 0); + PGXP_ALU(0x2C820005u, cpu->gpr[2], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0xBFC069ACu); #endif @@ -109990,7 +110116,8 @@ label_BFC06BC8: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC06BC8: 2C64000A sltiu $a0, $v1, 10 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[3] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[4] = (uint32_t)(cpu->gpr[3] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2C64000Au, cpu->gpr[4], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC06BC8u); #endif @@ -110117,7 +110244,8 @@ label_BFC06BE4: psx_cyc_step(cpu, 0x1108u); #endif /* 0xBFC06BE4: 010C1824 and $v1, $t0, $t4 */ - cpu->gpr[3] = cpu->gpr[8] & cpu->gpr[12]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[12]; cpu->gpr[3] = cpu->gpr[8] & cpu->gpr[12]; + PGXP_ALU(0x010C1824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC06BE4u); #endif @@ -110140,7 +110268,8 @@ label_BFC06BE4: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC06BEC: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06BECu); #endif @@ -110151,7 +110280,8 @@ label_BFC06BE4: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC06BF0: 2C630006 sltiu $v1, $v1, 6 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000006u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000006u ? 1 : 0); + PGXP_ALU(0x2C630006u, cpu->gpr[3], _pgx1, 0x0006u); } #ifdef PSX_COSIM cosim_instr(0xBFC06BF0u); #endif @@ -110216,7 +110346,8 @@ label_BFC06BFC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC06C00: 2C42001A sltiu $v0, $v0, 26 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2C42001Au, cpu->gpr[2], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC06C00u); #endif @@ -110469,7 +110600,8 @@ label_BFC06C38: psx_cyc_step(cpu, 0x500u); #endif /* 0xBFC06C40: 310A00FF andi $t2, $t0, 0xFF */ - cpu->gpr[10] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[10] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310A00FFu, cpu->gpr[10], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06C40u); #endif @@ -111165,7 +111297,8 @@ label_BFC06C7C: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC06CB0: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC06CB0u); #endif @@ -111939,7 +112072,8 @@ label_BFC06D78: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC06D80: 2C430021 sltiu $v1, $v0, 33 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000021u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000021u ? 1 : 0); + PGXP_ALU(0x2C430021u, cpu->gpr[3], _pgx1, 0x0021u); } #ifdef PSX_COSIM cosim_instr(0xBFC06D80u); #endif @@ -113276,7 +113410,8 @@ label_BFC06ED8: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC06EE0: 3068000F andi $t0, $v1, 0xF */ - cpu->gpr[8] = cpu->gpr[3] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[8] = cpu->gpr[3] & 0xFu; + PGXP_ALU(0x3068000Fu, cpu->gpr[8], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC06EE0u); #endif @@ -114891,7 +115026,8 @@ label_BFC07074: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC07080: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07080u); #endif @@ -116895,7 +117031,8 @@ label_BFC0728C: psx_cyc_step(cpu, 0x84u); #endif /* 0xBFC07290: 28E2000B slti $v0, $a3, 11 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[7] < (11) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[7] < (11) ? 1 : 0); + PGXP_ALU(0x28E2000Bu, cpu->gpr[2], _pgx1, 0x000Bu); } #ifdef PSX_COSIM cosim_instr(0xBFC07290u); #endif @@ -117825,7 +117962,8 @@ label_BFC07354: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC07360: 306400FF andi $a0, $v1, 0xFF */ - cpu->gpr[4] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[4] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC07360u); #endif @@ -117836,7 +117974,8 @@ label_BFC07354: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC07364: 2C84000E sltiu $a0, $a0, 14 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x0000000Eu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x0000000Eu ? 1 : 0); + PGXP_ALU(0x2C84000Eu, cpu->gpr[4], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0xBFC07364u); #endif @@ -117890,7 +118029,8 @@ label_BFC07370: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC07370: 30840001 andi $a0, $a0, 0x1 */ - cpu->gpr[4] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30840001u, cpu->gpr[4], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC07370u); #endif @@ -119578,7 +119718,8 @@ label_BFC07510: psx_cyc_step(cpu, 0x30004u); #endif /* 0xBFC07514: 0211102B sltu $v0, $s0, $s1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0211102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07514u); #endif @@ -122137,7 +122278,8 @@ label_BFC0776C: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC07784: 30E70001 andi $a3, $a3, 0x1 */ - cpu->gpr[7] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30E70001u, cpu->gpr[7], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC07784u); #endif @@ -122225,7 +122367,8 @@ label_BFC07798: psx_cyc_step(cpu, 0xA0u); #endif /* 0xBFC07798: 2CA70401 sltiu $a3, $a1, 1025 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[5] < 0x00000401u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[7] = (uint32_t)(cpu->gpr[5] < 0x00000401u ? 1 : 0); + PGXP_ALU(0x2CA70401u, cpu->gpr[7], _pgx1, 0x0401u); } #ifdef PSX_COSIM cosim_instr(0xBFC07798u); #endif @@ -122747,7 +122890,8 @@ label_BFC07814: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC0782C: 30E70001 andi $a3, $a3, 0x1 */ - cpu->gpr[7] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30E70001u, cpu->gpr[7], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC0782Cu); #endif @@ -122835,7 +122979,8 @@ label_BFC07840: psx_cyc_step(cpu, 0xA0u); #endif /* 0xBFC07840: 2CA70401 sltiu $a3, $a1, 1025 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[5] < 0x00000401u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[7] = (uint32_t)(cpu->gpr[5] < 0x00000401u ? 1 : 0); + PGXP_ALU(0x2CA70401u, cpu->gpr[7], _pgx1, 0x0401u); } #ifdef PSX_COSIM cosim_instr(0xBFC07840u); #endif @@ -123353,7 +123498,8 @@ label_BFC078BC: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC078D4: 30C60001 andi $a2, $a2, 0x1 */ - cpu->gpr[6] = cpu->gpr[6] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x1u; + PGXP_ALU(0x30C60001u, cpu->gpr[6], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC078D4u); #endif @@ -123923,7 +124069,8 @@ label_BFC07968: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC07980: 306300FE andi $v1, $v1, 0xFE */ - cpu->gpr[3] = cpu->gpr[3] & 0xFEu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFEu; + PGXP_ALU(0x306300FEu, cpu->gpr[3], _pgx1, 0x00FEu); } #ifdef PSX_COSIM cosim_instr(0xBFC07980u); #endif @@ -124216,7 +124363,8 @@ label_BFC079C8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC079DC: 2C420002 sltiu $v0, $v0, 2 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2C420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC079DCu); #endif @@ -124541,7 +124689,8 @@ label_BFC07A24: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC07A38: 30630010 andi $v1, $v1, 0x10 */ - cpu->gpr[3] = cpu->gpr[3] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x10u; + PGXP_ALU(0x30630010u, cpu->gpr[3], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC07A38u); #endif @@ -125456,7 +125605,8 @@ label_BFC07B18: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC07B20: 30420004 andi $v0, $v0, 0x4 */ - cpu->gpr[2] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30420004u, cpu->gpr[2], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC07B20u); #endif @@ -126150,7 +126300,8 @@ label_BFC07BE0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC07BE8: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC07BE8u); #endif @@ -126380,7 +126531,8 @@ label_BFC07C20: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC07C28: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC07C28u); #endif @@ -126474,7 +126626,8 @@ label_BFC07C34: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC07C44: 30420008 andi $v0, $v0, 0x8 */ - cpu->gpr[2] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30420008u, cpu->gpr[2], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC07C44u); #endif @@ -126931,7 +127084,8 @@ label_BFC07CA4: psx_cyc_step(cpu, 0x120u); #endif /* 0xBFC07CAC: 28A87403 slti $t0, $a1, 29699 */ - cpu->gpr[8] = (uint32_t)((int32_t)cpu->gpr[5] < (29699) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[8] = (uint32_t)((int32_t)cpu->gpr[5] < (29699) ? 1 : 0); + PGXP_ALU(0x28A87403u, cpu->gpr[8], _pgx1, 0x7403u); } #ifdef PSX_COSIM cosim_instr(0xBFC07CACu); #endif @@ -127729,7 +127883,8 @@ label_BFC07D68: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC07D6C: 00651824 and $v1, $v1, $a1 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[5]; + PGXP_ALU(0x00651824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07D6Cu); #endif @@ -128406,7 +128561,8 @@ label_BFC07E14: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC07E14: 30680003 andi $t0, $v1, 0x3 */ - cpu->gpr[8] = cpu->gpr[3] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[8] = cpu->gpr[3] & 0x3u; + PGXP_ALU(0x30680003u, cpu->gpr[8], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0xBFC07E14u); #endif @@ -128543,7 +128699,8 @@ label_BFC07E30: psx_cyc_step(cpu, 0x8080u); #endif /* 0xBFC07E30: 00EF3824 and $a3, $a3, $t7 */ - cpu->gpr[7] = cpu->gpr[7] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[7] = cpu->gpr[7] & cpu->gpr[15]; + PGXP_ALU(0x00EF3824u, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07E30u); #endif @@ -128573,7 +128730,8 @@ label_BFC07E34: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC07E38: 01074026 xor $t0, $t0, $a3 */ - cpu->gpr[8] = cpu->gpr[8] ^ cpu->gpr[7]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[8] = cpu->gpr[8] ^ cpu->gpr[7]; + PGXP_ALU(0x01074026u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07E38u); #endif @@ -128584,7 +128742,8 @@ label_BFC07E34: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC07E3C: 3908003D xori $t0, $t0, 0x3D */ - cpu->gpr[8] = cpu->gpr[8] ^ 0x3Du; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] ^ 0x3Du; + PGXP_ALU(0x3908003Du, cpu->gpr[8], _pgx1, 0x003Du); } #ifdef PSX_COSIM cosim_instr(0xBFC07E3Cu); #endif @@ -128631,7 +128790,8 @@ label_BFC07E34: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC07E4C: 00E83826 xor $a3, $a3, $t0 */ - cpu->gpr[7] = cpu->gpr[7] ^ cpu->gpr[8]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[7] = cpu->gpr[7] ^ cpu->gpr[8]; + PGXP_ALU(0x00E83826u, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07E4Cu); #endif @@ -128684,7 +128844,8 @@ label_BFC07E34: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC07E5C: 00E83826 xor $a3, $a3, $t0 */ - cpu->gpr[7] = cpu->gpr[7] ^ cpu->gpr[8]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[7] = cpu->gpr[7] ^ cpu->gpr[8]; + PGXP_ALU(0x00E83826u, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07E5Cu); #endif @@ -128790,7 +128951,8 @@ label_BFC07E74: psx_cyc_step(cpu, 0x2080u); #endif /* 0xBFC07E78: 00ED3824 and $a3, $a3, $t5 */ - cpu->gpr[7] = cpu->gpr[7] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[7] = cpu->gpr[7] & cpu->gpr[13]; + PGXP_ALU(0x00ED3824u, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07E78u); #endif @@ -134818,7 +134980,8 @@ label_BFC08478: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC08478: 2CA20002 sltiu $v0, $a1, 2 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[5] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[2] = (uint32_t)(cpu->gpr[5] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2CA20002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC08478u); #endif @@ -135180,7 +135343,8 @@ label_BFC084D4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC084D8: 0043182B sltu $v1, $v0, $v1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC084D8u); #endif @@ -135763,7 +135927,8 @@ label_BFC08570: psx_cyc_step(cpu, 0x10004u); #endif /* 0xBFC08574: 0050102B sltu $v0, $v0, $s0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0050102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08574u); #endif @@ -135836,7 +136001,8 @@ label_BFC08584: psx_cyc_step(cpu, 0x280004u); #endif /* 0xBFC08584: 0275102B sltu $v0, $s3, $s5 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[19] < cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[2] = (uint32_t)(cpu->gpr[19] < cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0275102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08584u); #endif @@ -136446,7 +136612,8 @@ label_BFC08604: psx_cyc_step(cpu, 0x38u); #endif /* 0xBFC08604: 0085182B sltu $v1, $a0, $a1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0085182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08604u); #endif @@ -136500,7 +136667,8 @@ label_BFC08610: psx_cyc_step(cpu, 0x38u); #endif /* 0xBFC08610: 00A4182B sltu $v1, $a1, $a0 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x00A4182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08610u); #endif @@ -136597,7 +136765,8 @@ label_BFC08624: psx_cyc_step(cpu, 0x50u); #endif /* 0xBFC08628: 0086202B sltu $a0, $a0, $a2 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x0086202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08628u); #endif @@ -137097,7 +137266,8 @@ label_BFC08688: psx_cyc_step(cpu, 0x188u); #endif /* 0xBFC08698: 0067402B sltu $t0, $v1, $a3 */ - cpu->gpr[8] = (uint32_t)(cpu->gpr[3] < cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[8] = (uint32_t)(cpu->gpr[3] < cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x0067402Bu, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08698u); #endif @@ -137118,7 +137288,8 @@ label_BFC08688: psx_cyc_step(cpu, 0x88u); #endif /* 0xBFC086A0: 00E3182B sltu $v1, $a3, $v1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[7] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[7] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x00E3182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC086A0u); #endif @@ -137620,7 +137791,8 @@ label_BFC086E8: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC086E8: 2CC20025 sltiu $v0, $a2, 37 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[6] < 0x00000025u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[2] = (uint32_t)(cpu->gpr[6] < 0x00000025u ? 1 : 0); + PGXP_ALU(0x2CC20025u, cpu->gpr[2], _pgx1, 0x0025u); } #ifdef PSX_COSIM cosim_instr(0xBFC086E8u); #endif @@ -138087,7 +138259,8 @@ label_BFC08760: psx_cyc_step(cpu, 0x1000000u); #endif /* 0xBFC08760: 331800FF andi $t8, $t8, 0xFF */ - cpu->gpr[24] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[24] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x331800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08760u); #endif @@ -138098,7 +138271,8 @@ label_BFC08760: psx_cyc_step(cpu, 0x1000000u); #endif /* 0xBFC08764: 2F180005 sltiu $t8, $t8, 5 */ - cpu->gpr[24] = (uint32_t)(cpu->gpr[24] < 0x00000005u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[24] = (uint32_t)(cpu->gpr[24] < 0x00000005u ? 1 : 0); + PGXP_ALU(0x2F180005u, cpu->gpr[24], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0xBFC08764u); #endif @@ -138413,7 +138587,8 @@ label_BFC087A8: psx_cyc_step(cpu, 0x1002000u); #endif /* 0xBFC087A8: 030DC024 and $t8, $t8, $t5 */ - cpu->gpr[24] = cpu->gpr[24] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[24] = cpu->gpr[24] & cpu->gpr[13]; + PGXP_ALU(0x030DC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC087A8u); #endif @@ -138424,7 +138599,8 @@ label_BFC087A8: psx_cyc_step(cpu, 0x1000000u); #endif /* 0xBFC087AC: 331800FF andi $t8, $t8, 0xFF */ - cpu->gpr[24] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[24] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x331800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC087ACu); #endif @@ -138519,7 +138695,8 @@ label_BFC087C0: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC087C0: 3863002D xori $v1, $v1, 0x2D */ - cpu->gpr[3] = cpu->gpr[3] ^ 0x2Du; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] ^ 0x2Du; + PGXP_ALU(0x3863002Du, cpu->gpr[3], _pgx1, 0x002Du); } #ifdef PSX_COSIM cosim_instr(0xBFC087C0u); #endif @@ -138530,7 +138707,8 @@ label_BFC087C0: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC087C4: 2C630001 sltiu $v1, $v1, 1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C630001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC087C4u); #endif @@ -138773,7 +138951,8 @@ label_BFC087F4: psx_cyc_step(cpu, 0xC8u); #endif /* 0xBFC087F8: 0066382A slt $a3, $v1, $a2 */ - cpu->gpr[7] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[7] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x0066382Au, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC087F8u); #endif @@ -138857,7 +139036,8 @@ label_BFC08804: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0880C: 0062102B sltu $v0, $v1, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0880Cu); #endif @@ -138878,7 +139058,8 @@ label_BFC08804: psx_cyc_step(cpu, 0x80Cu); #endif /* 0xBFC08814: 006B102B sltu $v0, $v1, $t3 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[3] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[2] = (uint32_t)(cpu->gpr[3] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x006B102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08814u); #endif @@ -139473,7 +139654,8 @@ label_BFC08898: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC08898: 30E700FF andi $a3, $a3, 0xFF */ - cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30E700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08898u); #endif @@ -139484,7 +139666,8 @@ label_BFC08898: psx_cyc_step(cpu, 0x1000080u); #endif /* 0xBFC0889C: 2CF8000A sltiu $t8, $a3, 10 */ - cpu->gpr[24] = (uint32_t)(cpu->gpr[7] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[24] = (uint32_t)(cpu->gpr[7] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2CF8000Au, cpu->gpr[24], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC0889Cu); #endif @@ -139549,7 +139732,8 @@ label_BFC088A8: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC088AC: 30E700FF andi $a3, $a3, 0xFF */ - cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30E700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC088ACu); #endif @@ -139560,7 +139744,8 @@ label_BFC088A8: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC088B0: 2CE7001A sltiu $a3, $a3, 26 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[7] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = (uint32_t)(cpu->gpr[7] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2CE7001Au, cpu->gpr[7], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC088B0u); #endif @@ -139614,7 +139799,8 @@ label_BFC088BC: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC088BC: 30E700FF andi $a3, $a3, 0xFF */ - cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30E700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC088BCu); #endif @@ -139625,7 +139811,8 @@ label_BFC088BC: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC088C0: 2CE7001A sltiu $a3, $a3, 26 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[7] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = (uint32_t)(cpu->gpr[7] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2CE7001Au, cpu->gpr[7], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC088C0u); #endif @@ -141170,7 +141357,8 @@ label_BFC08A44: psx_cyc_step(cpu, 0x1000008u); #endif /* 0xBFC08A48: 2878002E slti $t8, $v1, 46 */ - cpu->gpr[24] = (uint32_t)((int32_t)cpu->gpr[3] < (46) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[24] = (uint32_t)((int32_t)cpu->gpr[3] < (46) ? 1 : 0); + PGXP_ALU(0x2878002Eu, cpu->gpr[24], _pgx1, 0x002Eu); } #ifdef PSX_COSIM cosim_instr(0xBFC08A48u); #endif @@ -141370,7 +141558,8 @@ label_BFC08A6C: psx_cyc_step(cpu, 0x200100u); #endif /* 0xBFC08A6C: 3AA80001 xori $t0, $s5, 0x1 */ - cpu->gpr[8] = cpu->gpr[21] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[21]; cpu->gpr[8] = cpu->gpr[21] ^ 0x1u; + PGXP_ALU(0x3AA80001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC08A6Cu); #endif @@ -141388,7 +141577,8 @@ label_BFC08A70: psx_cyc_step(cpu, 0x400110u); #endif /* 0xBFC08A70: 0104B024 and $s6, $t0, $a0 */ - cpu->gpr[22] = cpu->gpr[8] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[22] = cpu->gpr[8] & cpu->gpr[4]; + PGXP_ALU(0x0104B024u, cpu->gpr[22], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08A70u); #endif @@ -141580,7 +141770,8 @@ label_BFC08A98: psx_cyc_step(cpu, 0x90u); #endif /* 0xBFC08AA4: 28E4005B slti $a0, $a3, 91 */ - cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[7] < (91) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[7] < (91) ? 1 : 0); + PGXP_ALU(0x28E4005Bu, cpu->gpr[4], _pgx1, 0x005Bu); } #ifdef PSX_COSIM cosim_instr(0xBFC08AA4u); #endif @@ -141810,7 +142001,8 @@ label_BFC08AD8: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC08AD8: 2CA5000A sltiu $a1, $a1, 10 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2CA5000Au, cpu->gpr[5], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC08AD8u); #endif @@ -142152,7 +142344,8 @@ label_BFC08B28: psx_cyc_step(cpu, 0x200100u); #endif /* 0xBFC08B2C: 3AA80001 xori $t0, $s5, 0x1 */ - cpu->gpr[8] = cpu->gpr[21] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[21]; cpu->gpr[8] = cpu->gpr[21] ^ 0x1u; + PGXP_ALU(0x3AA80001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC08B2Cu); #endif @@ -142510,7 +142703,8 @@ label_BFC08B78: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC08B7C: 2C84000A sltiu $a0, $a0, 10 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2C84000Au, cpu->gpr[4], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC08B7Cu); #endif @@ -142531,7 +142725,8 @@ label_BFC08B78: psx_cyc_step(cpu, 0x90u); #endif /* 0xBFC08B84: 28E4005B slti $a0, $a3, 91 */ - cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[7] < (91) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[7] < (91) ? 1 : 0); + PGXP_ALU(0x28E4005Bu, cpu->gpr[4], _pgx1, 0x005Bu); } #ifdef PSX_COSIM cosim_instr(0xBFC08B84u); #endif @@ -142681,7 +142876,8 @@ label_BFC08B98: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC08BA4: 00642026 xor $a0, $v1, $a0 */ - cpu->gpr[4] = cpu->gpr[3] ^ cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[3] ^ cpu->gpr[4]; + PGXP_ALU(0x00642026u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08BA4u); #endif @@ -142732,7 +142928,8 @@ label_BFC08BB4: psx_cyc_step(cpu, 0x30u); #endif /* 0xBFC08BB4: 2885003D slti $a1, $a0, 61 */ - cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[4] < (61) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[4] < (61) ? 1 : 0); + PGXP_ALU(0x2885003Du, cpu->gpr[5], _pgx1, 0x003Du); } #ifdef PSX_COSIM cosim_instr(0xBFC08BB4u); #endif @@ -143167,7 +143364,8 @@ label_BFC08C28: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC08C28: 2F0F000D sltiu $t7, $t8, 13 */ - cpu->gpr[15] = (uint32_t)(cpu->gpr[24] < 0x0000000Du ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[15] = (uint32_t)(cpu->gpr[24] < 0x0000000Du ? 1 : 0); + PGXP_ALU(0x2F0F000Du, cpu->gpr[15], _pgx1, 0x000Du); } #ifdef PSX_COSIM cosim_instr(0xBFC08C28u); #endif @@ -143386,7 +143584,8 @@ label_BFC08C58: psx_cyc_step(cpu, 0x29u); #endif /* 0xBFC08C5C: 0003282B sltu $a1, $zero, $v1 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[0] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[5] = (uint32_t)(cpu->gpr[0] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0003282Bu, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08C5Cu); #endif @@ -143534,7 +143733,8 @@ label_BFC08C84: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC08C8C: 2C630001 sltiu $v1, $v1, 1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C630001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC08C8Cu); #endif @@ -143861,7 +144061,8 @@ label_BFC08CBC: psx_cyc_step(cpu, 0x2040000u); #endif /* 0xBFC08CBC: 3A590008 xori $t9, $s2, 0x8 */ - cpu->gpr[25] = cpu->gpr[18] ^ 0x8u; + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[25] = cpu->gpr[18] ^ 0x8u; + PGXP_ALU(0x3A590008u, cpu->gpr[25], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC08CBCu); #endif @@ -143872,7 +144073,8 @@ label_BFC08CBC: psx_cyc_step(cpu, 0x2000001u); #endif /* 0xBFC08CC0: 0019C82B sltu $t9, $zero, $t9 */ - cpu->gpr[25] = (uint32_t)(cpu->gpr[0] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[25] = (uint32_t)(cpu->gpr[0] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0019C82Bu, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08CC0u); #endif @@ -143883,7 +144085,8 @@ label_BFC08CBC: psx_cyc_step(cpu, 0x2000800u); #endif /* 0xBFC08CC4: 01795824 and $t3, $t3, $t9 */ - cpu->gpr[11] = cpu->gpr[11] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[11] = cpu->gpr[11] & cpu->gpr[25]; + PGXP_ALU(0x01795824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08CC4u); #endif @@ -144083,7 +144286,8 @@ label_BFC08CF4: psx_cyc_step(cpu, 0x2001001u); #endif /* 0xBFC08CF8: 0019602B sltu $t4, $zero, $t9 */ - cpu->gpr[12] = (uint32_t)(cpu->gpr[0] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[12] = (uint32_t)(cpu->gpr[0] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0019602Bu, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08CF8u); #endif @@ -144127,7 +144331,8 @@ label_BFC08CFC: psx_cyc_step(cpu, 0x3010u); #endif /* 0xBFC08D00: 008C682A slt $t5, $a0, $t4 */ - cpu->gpr[13] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[12] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[12]; cpu->gpr[13] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[12] ? 1 : 0); + PGXP_ALU(0x008C682Au, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08D00u); #endif @@ -144357,7 +144562,8 @@ label_BFC08D2C: psx_cyc_step(cpu, 0x1000u); #endif /* 0xBFC08D34: 2D8C0003 sltiu $t4, $t4, 3 */ - cpu->gpr[12] = (uint32_t)(cpu->gpr[12] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[12] = (uint32_t)(cpu->gpr[12] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2D8C0003u, cpu->gpr[12], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0xBFC08D34u); #endif @@ -144502,7 +144708,8 @@ label_BFC08D4C: psx_cyc_step(cpu, 0x1000u); #endif /* 0xBFC08D54: 2D8C0003 sltiu $t4, $t4, 3 */ - cpu->gpr[12] = (uint32_t)(cpu->gpr[12] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[12] = (uint32_t)(cpu->gpr[12] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2D8C0003u, cpu->gpr[12], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0xBFC08D54u); #endif @@ -144793,7 +145000,8 @@ label_BFC08D88: psx_cyc_step(cpu, 0x41008u); #endif /* 0xBFC08DA0: 0072602B sltu $t4, $v1, $s2 */ - cpu->gpr[12] = (uint32_t)(cpu->gpr[3] < cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[12] = (uint32_t)(cpu->gpr[3] < cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0072602Bu, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08DA0u); #endif @@ -144994,7 +145202,8 @@ label_BFC08DD4: psx_cyc_step(cpu, 0x19u); #endif /* 0xBFC08DD4: 00032027 nor $a0, $zero, $v1 */ - cpu->gpr[4] = ~(cpu->gpr[0] | cpu->gpr[3]); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[4] = ~(cpu->gpr[0] | cpu->gpr[3]); + PGXP_ALU(0x00032027u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08DD4u); #endif @@ -145017,7 +145226,8 @@ label_BFC08DD4: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC08DDC: 00641824 and $v1, $v1, $a0 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + PGXP_ALU(0x00641824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08DDCu); #endif @@ -145583,7 +145793,8 @@ label_BFC08E64: psx_cyc_step(cpu, 0x400010u); #endif /* 0xBFC08E64: 2EC40034 sltiu $a0, $s6, 52 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[22] < 0x00000034u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; cpu->gpr[4] = (uint32_t)(cpu->gpr[22] < 0x00000034u ? 1 : 0); + PGXP_ALU(0x2EC40034u, cpu->gpr[4], _pgx1, 0x0034u); } #ifdef PSX_COSIM cosim_instr(0xBFC08E64u); #endif @@ -145975,7 +146186,8 @@ label_BFC08EBC: psx_cyc_step(cpu, 0x800008u); #endif /* 0xBFC08EBC: 2EE30034 sltiu $v1, $s7, 52 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[23] < 0x00000034u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[23]; cpu->gpr[3] = (uint32_t)(cpu->gpr[23] < 0x00000034u ? 1 : 0); + PGXP_ALU(0x2EE30034u, cpu->gpr[3], _pgx1, 0x0034u); } #ifdef PSX_COSIM cosim_instr(0xBFC08EBCu); #endif @@ -146603,7 +146815,8 @@ label_BFC08F38: psx_cyc_step(cpu, 0x80008u); #endif /* 0xBFC08F40: 02639824 and $s3, $s3, $v1 */ - cpu->gpr[19] = cpu->gpr[19] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[19] = cpu->gpr[19] & cpu->gpr[3]; + PGXP_ALU(0x02639824u, cpu->gpr[19], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08F40u); #endif @@ -147229,7 +147442,8 @@ label_BFC08FC0: psx_cyc_step(cpu, 0x58u); #endif /* 0xBFC08FC0: 0064302A slt $a2, $v1, $a0 */ - cpu->gpr[6] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[6] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064302Au, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08FC0u); #endif @@ -147594,7 +147808,8 @@ label_BFC0900C: psx_cyc_step(cpu, 0x40030u); #endif /* 0xBFC0900C: 0092282A slt $a1, $a0, $s2 */ - cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0092282Au, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0900Cu); #endif @@ -147928,7 +148143,8 @@ label_BFC0904C: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC0904C: 2CC6005F sltiu $a2, $a2, 95 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[6] < 0x0000005Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = (uint32_t)(cpu->gpr[6] < 0x0000005Fu ? 1 : 0); + PGXP_ALU(0x2CC6005Fu, cpu->gpr[6], _pgx1, 0x005Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0904Cu); #endif @@ -147994,7 +148210,8 @@ label_BFC09058: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0905C: 3063001F andi $v1, $v1, 0x1F */ - cpu->gpr[3] = cpu->gpr[3] & 0x1Fu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x1Fu; + PGXP_ALU(0x3063001Fu, cpu->gpr[3], _pgx1, 0x001Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0905Cu); #endif @@ -148084,7 +148301,8 @@ label_BFC09074: psx_cyc_step(cpu, 0x40008u); #endif /* 0xBFC09078: 2A430063 slti $v1, $s2, 99 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[18] < (99) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[18] < (99) ? 1 : 0); + PGXP_ALU(0x2A430063u, cpu->gpr[3], _pgx1, 0x0063u); } #ifdef PSX_COSIM cosim_instr(0xBFC09078u); #endif @@ -148147,7 +148365,8 @@ label_BFC09084: psx_cyc_step(cpu, 0x40018u); #endif /* 0xBFC09088: 0092182A slt $v1, $a0, $s2 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0092182Au, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC09088u); #endif @@ -150556,7 +150775,8 @@ label_BFC09274: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC09280: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC09280u); #endif @@ -150567,7 +150787,8 @@ label_BFC09274: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC09284: 2C64000A sltiu $a0, $v1, 10 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[3] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[4] = (uint32_t)(cpu->gpr[3] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2C64000Au, cpu->gpr[4], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC09284u); #endif @@ -150642,7 +150863,8 @@ label_BFC09290: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC09298: 2843006A slti $v1, $v0, 106 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (106) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (106) ? 1 : 0); + PGXP_ALU(0x2843006Au, cpu->gpr[3], _pgx1, 0x006Au); } #ifdef PSX_COSIM cosim_instr(0xBFC09298u); #endif @@ -150726,7 +150948,8 @@ label_BFC092A4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC092A8: 28430026 slti $v1, $v0, 38 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (38) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (38) ? 1 : 0); + PGXP_ALU(0x28430026u, cpu->gpr[3], _pgx1, 0x0026u); } #ifdef PSX_COSIM cosim_instr(0xBFC092A8u); #endif @@ -151657,7 +151880,8 @@ label_BFC09374: psx_cyc_step(cpu, 0x10004u); #endif /* 0xBFC0938C: 2E02000A sltiu $v0, $s0, 10 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2E02000Au, cpu->gpr[2], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC0938Cu); #endif @@ -151902,7 +152126,8 @@ label_BFC093C0: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC093C8: 28430076 slti $v1, $v0, 118 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (118) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (118) ? 1 : 0); + PGXP_ALU(0x28430076u, cpu->gpr[3], _pgx1, 0x0076u); } #ifdef PSX_COSIM cosim_instr(0xBFC093C8u); #endif @@ -152190,7 +152415,8 @@ label_BFC09408: psx_cyc_step(cpu, 0x300004u); #endif /* 0xBFC09408: 02B4102A slt $v0, $s5, $s4 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[21] < (int32_t)cpu->gpr[20] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[21]; uint32_t _pgx2 = cpu->gpr[20]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[21] < (int32_t)cpu->gpr[20] ? 1 : 0); + PGXP_ALU(0x02B4102Au, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC09408u); #endif @@ -152553,7 +152779,8 @@ label_BFC09464: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC09464: 3084000F andi $a0, $a0, 0xF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFu; + PGXP_ALU(0x3084000Fu, cpu->gpr[4], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC09464u); #endif @@ -153102,7 +153329,8 @@ label_BFC094E8: psx_cyc_step(cpu, 0x900008u); #endif /* 0xBFC094E8: 02F4182A slt $v1, $s7, $s4 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[23] < (int32_t)cpu->gpr[20] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[23]; uint32_t _pgx2 = cpu->gpr[20]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[23] < (int32_t)cpu->gpr[20] ? 1 : 0); + PGXP_ALU(0x02F4182Au, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC094E8u); #endif @@ -153646,7 +153874,8 @@ label_BFC0956C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC0956C: 3084000F andi $a0, $a0, 0xF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFu; + PGXP_ALU(0x3084000Fu, cpu->gpr[4], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0956Cu); #endif @@ -154279,7 +154508,8 @@ label_BFC0A510: psx_cyc_step(cpu, 0x502u); #endif /* 0xBFC0A510: 0148082A slt $at, $t2, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0148082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030010u); #endif @@ -155184,7 +155414,8 @@ label_BFC0A59C: psx_cyc_step(cpu, 0x10008u); #endif /* 0xBFC0A5B8: 38700045 xori $s0, $v1, 0x45 */ - cpu->gpr[16] = cpu->gpr[3] ^ 0x45u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[16] = cpu->gpr[3] ^ 0x45u; + PGXP_ALU(0x38700045u, cpu->gpr[16], _pgx1, 0x0045u); } #ifdef PSX_COSIM cosim_instr(0x800300B8u); #endif @@ -155192,7 +155423,8 @@ label_BFC0A59C: psx_cyc_step(cpu, 0x10000u); #endif /* 0xBFC0A5BC: 2E100001 sltiu $s0, $s0, 1 */ - cpu->gpr[16] = (uint32_t)(cpu->gpr[16] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[16] = (uint32_t)(cpu->gpr[16] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2E100001u, cpu->gpr[16], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800300BCu); #endif @@ -156242,7 +156474,8 @@ label_BFC0A6F8: psx_cyc_step(cpu, 0xC04u); #endif /* 0xBFC0A700: 014B102A slt $v0, $t2, $t3 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x014B102Au, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030200u); #endif @@ -156329,7 +156562,8 @@ label_BFC0A710: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0A71C: 2C430003 sltiu $v1, $v0, 3 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2C430003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x8003021Cu); #endif @@ -156570,7 +156804,8 @@ label_BFC0A760: psx_cyc_step(cpu, 0x400Cu); #endif /* 0xBFC0A76C: 004E182A slt $v1, $v0, $t6 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x004E182Au, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003026Cu); #endif @@ -158972,7 +159207,8 @@ label_BFC0AA54: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC0AA5C: 00651824 and $v1, $v1, $a1 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[5]; + PGXP_ALU(0x00651824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003055Cu); #endif @@ -159287,7 +159523,8 @@ label_BFC0AAC0: psx_cyc_step(cpu, 0x1104u); #endif /* 0xBFC0AAC0: 010C102A slt $v0, $t0, $t4 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[12] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[12]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[12] ? 1 : 0); + PGXP_ALU(0x010C102Au, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800305C0u); #endif @@ -159401,7 +159638,8 @@ label_BFC0AAD4: psx_cyc_step(cpu, 0x400u); #endif /* 0xBFC0AAE0: 2D4A0028 sltiu $t2, $t2, 40 */ - cpu->gpr[10] = (uint32_t)(cpu->gpr[10] < 0x00000028u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[10] = (uint32_t)(cpu->gpr[10] < 0x00000028u ? 1 : 0); + PGXP_ALU(0x2D4A0028u, cpu->gpr[10], _pgx1, 0x0028u); } #ifdef PSX_COSIM cosim_instr(0x800305E0u); #endif @@ -159703,7 +159941,8 @@ label_BFC0AB34: psx_cyc_step(cpu, 0x8Cu); #endif /* 0xBFC0AB34: 0067102A slt $v0, $v1, $a3 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x0067102Au, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030634u); #endif @@ -160105,7 +160344,8 @@ label_BFC0ABC4: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC0ABCC: 00641824 and $v1, $v1, $a0 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + PGXP_ALU(0x00641824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800306CCu); #endif @@ -162105,7 +162345,8 @@ label_BFC0AE6C: psx_cyc_step(cpu, 0x320u); #endif /* 0xBFC0AE6C: 00A8482A slt $t1, $a1, $t0 */ - cpu->gpr[9] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[9] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x00A8482Au, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003096Cu); #endif @@ -162262,7 +162503,8 @@ label_BFC0AE94: psx_cyc_step(cpu, 0x320u); #endif /* 0xBFC0AE94: 00A8482A slt $t1, $a1, $t0 */ - cpu->gpr[9] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[9] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x00A8482Au, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030994u); #endif @@ -162413,7 +162655,8 @@ label_BFC0AEBC: psx_cyc_step(cpu, 0x320u); #endif /* 0xBFC0AEBC: 00A8482A slt $t1, $a1, $t0 */ - cpu->gpr[9] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[9] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x00A8482Au, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800309BCu); #endif @@ -164288,7 +164531,8 @@ label_BFC0B0A4: psx_cyc_step(cpu, 0x60u); #endif /* 0xBFC0B0C8: 00C5282A slt $a1, $a2, $a1 */ - cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x00C5282Au, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030BC8u); #endif @@ -164397,7 +164641,8 @@ label_BFC0B0E4: psx_cyc_step(cpu, 0x430u); #endif /* 0xBFC0B0E4: 008A282A slt $a1, $a0, $t2 */ - cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x008A282Au, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030BE4u); #endif @@ -165247,7 +165492,8 @@ label_BFC0B184: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC0B1C4: 00641824 and $v1, $v1, $a0 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + PGXP_ALU(0x00641824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030CC4u); #endif @@ -165729,7 +165975,8 @@ label_BFC0B264: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0B270: 2C42000A sltiu $v0, $v0, 10 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2C42000Au, cpu->gpr[2], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x80030D70u); #endif @@ -165737,7 +165984,8 @@ label_BFC0B264: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0B274: 38420001 xori $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + PGXP_ALU(0x38420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80030D74u); #endif @@ -165835,7 +166083,8 @@ label_BFC0B280: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0B294: 2C420002 sltiu $v0, $v0, 2 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2C420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80030D94u); #endif @@ -165896,7 +166145,8 @@ label_BFC0B298: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0B2A4: 3842000F xori $v0, $v0, 0xF */ - cpu->gpr[2] = cpu->gpr[2] ^ 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0xFu; + PGXP_ALU(0x3842000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80030DA4u); #endif @@ -165909,7 +166159,8 @@ label_BFC0B298: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0B2AC: 2C420001 sltiu $v0, $v0, 1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80030DACu); #endif @@ -166222,7 +166473,8 @@ label_BFC0B2F4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B2FC: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030DFCu); #endif @@ -166290,7 +166542,8 @@ label_BFC0B308: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B310: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030E10u); #endif @@ -166452,7 +166705,8 @@ label_BFC0B33C: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC0B340: 0044202B sltu $a0, $v0, $a0 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030E40u); #endif @@ -166582,7 +166836,8 @@ label_BFC0B35C: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B35C: 2C430004 sltiu $v1, $v0, 4 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000004u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000004u ? 1 : 0); + PGXP_ALU(0x2C430004u, cpu->gpr[3], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80030E5Cu); #endif @@ -166641,7 +166896,8 @@ label_BFC0B368: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0B36C: 2C420002 sltiu $v0, $v0, 2 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2C420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80030E6Cu); #endif @@ -166835,7 +167091,8 @@ label_BFC0B39C: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B3A8: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030EA8u); #endif @@ -166901,7 +167158,8 @@ label_BFC0B3B4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B3BC: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030EBCu); #endif @@ -167255,7 +167513,8 @@ label_BFC0B410: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B424: 30620007 andi $v0, $v1, 0x7 */ - cpu->gpr[2] = cpu->gpr[3] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[3] & 0x7u; + PGXP_ALU(0x30620007u, cpu->gpr[2], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x80030F24u); #endif @@ -167339,7 +167598,8 @@ label_BFC0B43C: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0B43C: 30630018 andi $v1, $v1, 0x18 */ - cpu->gpr[3] = cpu->gpr[3] & 0x18u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x18u; + PGXP_ALU(0x30630018u, cpu->gpr[3], _pgx1, 0x0018u); } #ifdef PSX_COSIM cosim_instr(0x80030F3Cu); #endif @@ -167439,7 +167699,8 @@ label_BFC0B454: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0B458: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80030F58u); #endif @@ -167447,7 +167708,8 @@ label_BFC0B454: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B45C: 2C430005 sltiu $v1, $v0, 5 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000005u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000005u ? 1 : 0); + PGXP_ALU(0x2C430005u, cpu->gpr[3], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0x80030F5Cu); #endif @@ -167994,7 +168256,8 @@ label_BFC0B4D0: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B4EC: 2C43000D sltiu $v1, $v0, 13 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x0000000Du ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x0000000Du ? 1 : 0); + PGXP_ALU(0x2C43000Du, cpu->gpr[3], _pgx1, 0x000Du); } #ifdef PSX_COSIM cosim_instr(0x80030FECu); #endif @@ -170064,7 +170327,8 @@ label_BFC0B718: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0B718: 2C420001 sltiu $v0, $v0, 1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80031218u); #endif @@ -170108,7 +170372,8 @@ label_BFC0B71C: psx_cyc_step(cpu, 0xA0008u); #endif /* 0xBFC0B728: 0233182B sltu $v1, $s1, $s3 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[17] < cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[3] = (uint32_t)(cpu->gpr[17] < cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0233182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031228u); #endif @@ -170642,7 +170907,8 @@ label_BFC0B7A0: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B7AC: 2C43000A sltiu $v1, $v0, 10 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2C43000Au, cpu->gpr[3], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x800312ACu); #endif @@ -172007,7 +172273,8 @@ label_BFC0B930: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B938: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031438u); #endif @@ -172220,7 +172487,8 @@ label_BFC0B95C: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0B968: 38620001 xori $v0, $v1, 0x1 */ - cpu->gpr[2] = cpu->gpr[3] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[3] ^ 0x1u; + PGXP_ALU(0x38620001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80031468u); #endif @@ -172493,7 +172761,8 @@ label_BFC0B9B0: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC0B9BC: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800314BCu); #endif @@ -172579,7 +172848,8 @@ label_BFC0B9D0: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC0B9DC: 2CA50001 sltiu $a1, $a1, 1 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2CA50001u, cpu->gpr[5], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800314DCu); #endif @@ -172599,7 +172869,8 @@ label_BFC0B9D0: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC0B9E4: 30A50280 andi $a1, $a1, 0x280 */ - cpu->gpr[5] = cpu->gpr[5] & 0x280u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x280u; + PGXP_ALU(0x30A50280u, cpu->gpr[5], _pgx1, 0x0280u); } #ifdef PSX_COSIM cosim_instr(0x800314E4u); #endif @@ -172683,7 +172954,8 @@ label_BFC0B9F0: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC0BA08: 2CC60001 sltiu $a2, $a2, 1 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[6] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = (uint32_t)(cpu->gpr[6] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2CC60001u, cpu->gpr[6], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80031508u); #endif @@ -172800,7 +173072,8 @@ label_BFC0BA0C: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC0BA30: 30C60280 andi $a2, $a2, 0x280 */ - cpu->gpr[6] = cpu->gpr[6] & 0x280u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x280u; + PGXP_ALU(0x30C60280u, cpu->gpr[6], _pgx1, 0x0280u); } #ifdef PSX_COSIM cosim_instr(0x80031530u); #endif @@ -173427,7 +173700,8 @@ label_BFC0BAE0: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC0BAF0: 30642000 andi $a0, $v1, 0x2000 */ - cpu->gpr[4] = cpu->gpr[3] & 0x2000u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[4] = cpu->gpr[3] & 0x2000u; + PGXP_ALU(0x30642000u, cpu->gpr[4], _pgx1, 0x2000u); } #ifdef PSX_COSIM cosim_instr(0x800315F0u); #endif @@ -173540,7 +173814,8 @@ label_BFC0BB04: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0BB04: 2C420001 sltiu $v0, $v0, 1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80031604u); #endif @@ -173657,7 +173932,8 @@ label_BFC0BB24: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0BB2C: 30420001 andi $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8003162Cu); #endif @@ -173725,7 +174001,8 @@ label_BFC0BB38: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0BB40: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031640u); #endif @@ -174083,7 +174360,8 @@ label_BFC0BB94: psx_cyc_step(cpu, 0x11u); #endif /* 0xBFC0BB94: 0004202B sltu $a0, $zero, $a0 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0004202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031694u); #endif @@ -175353,7 +175631,8 @@ label_BFC0BCD4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0BD44: 0043182A slt $v1, $v0, $v1 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043182Au, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031844u); #endif @@ -175690,7 +175969,8 @@ label_BFC0BD9C: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC0BD9C: 2E220002 sltiu $v0, $s1, 2 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[17] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[2] = (uint32_t)(cpu->gpr[17] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2E220002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8003189Cu); #endif @@ -175914,7 +176194,8 @@ label_BFC0BDE4: psx_cyc_step(cpu, 0x5004u); #endif /* 0xBFC0BDE8: 01CC102B sltu $v0, $t6, $t4 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[14] < cpu->gpr[12] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[12]; cpu->gpr[2] = (uint32_t)(cpu->gpr[14] < cpu->gpr[12] ? 1 : 0); + PGXP_ALU(0x01CC102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800318E8u); #endif @@ -176264,7 +176545,8 @@ label_BFC0BE3C: psx_cyc_step(cpu, 0x30004u); #endif /* 0xBFC0BE44: 0211102B sltu $v0, $s0, $s1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0211102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031944u); #endif @@ -176899,7 +177181,8 @@ label_BFC0BEE4: psx_cyc_step(cpu, 0x20088u); #endif /* 0xBFC0BEE4: 0071382A slt $a3, $v1, $s1 */ - cpu->gpr[7] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[7] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0071382Au, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800319E4u); #endif @@ -177032,7 +177315,8 @@ label_BFC0BEF0: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC0BF18: 2A220002 slti $v0, $s1, 2 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[17] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[17] < (2) ? 1 : 0); + PGXP_ALU(0x2A220002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80031A18u); #endif @@ -177155,7 +177439,8 @@ label_BFC0BF34: psx_cyc_step(cpu, 0x20404u); #endif /* 0xBFC0BF34: 0151102A slt $v0, $t2, $s1 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0151102Au, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031A34u); #endif @@ -177203,7 +177488,8 @@ label_BFC0BF40: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC0BF40: 29030003 slti $v1, $t0, 3 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[8] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[8] < (3) ? 1 : 0); + PGXP_ALU(0x29030003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80031A40u); #endif @@ -177517,7 +177803,8 @@ label_BFC0BFA4: psx_cyc_step(cpu, 0x1C0u); #endif /* 0xBFC0BFAC: 00E6402A slt $t0, $a3, $a2 */ - cpu->gpr[8] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[8] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x00E6402Au, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031AACu); #endif @@ -177639,7 +177926,8 @@ label_BFC0BFC0: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC0BFD0: 00E8382A slt $a3, $a3, $t0 */ - cpu->gpr[7] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[7] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x00E8382Au, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031AD0u); #endif @@ -178569,7 +178857,8 @@ label_BFC0C0DC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0C0F8: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80031BF8u); #endif @@ -180345,7 +180634,8 @@ label_BFC0C354: psx_cyc_step(cpu, 0x30u); #endif /* 0xBFC0C358: 30850600 andi $a1, $a0, 0x600 */ - cpu->gpr[5] = cpu->gpr[4] & 0x600u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[5] = cpu->gpr[4] & 0x600u; + PGXP_ALU(0x30850600u, cpu->gpr[5], _pgx1, 0x0600u); } #ifdef PSX_COSIM cosim_instr(0x80031E58u); #endif @@ -180353,7 +180643,8 @@ label_BFC0C354: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC0C35C: 308307FF andi $v1, $a0, 0x7FF */ - cpu->gpr[3] = cpu->gpr[4] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0x7FFu; + PGXP_ALU(0x308307FFu, cpu->gpr[3], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80031E5Cu); #endif @@ -180462,7 +180753,8 @@ label_BFC0C37C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC0C37C: 30840400 andi $a0, $a0, 0x400 */ - cpu->gpr[4] = cpu->gpr[4] & 0x400u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x400u; + PGXP_ALU(0x30840400u, cpu->gpr[4], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x80031E7Cu); #endif @@ -180591,7 +180883,8 @@ label_BFC0C3A0: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC0C3A0: 2C640600 sltiu $a0, $v1, 1536 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[3] < 0x00000600u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[4] = (uint32_t)(cpu->gpr[3] < 0x00000600u ? 1 : 0); + PGXP_ALU(0x2C640600u, cpu->gpr[4], _pgx1, 0x0600u); } #ifdef PSX_COSIM cosim_instr(0x80031EA0u); #endif @@ -180788,7 +181081,8 @@ label_BFC0C3C0: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC0C3C4: 30A20600 andi $v0, $a1, 0x600 */ - cpu->gpr[2] = cpu->gpr[5] & 0x600u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[2] = cpu->gpr[5] & 0x600u; + PGXP_ALU(0x30A20600u, cpu->gpr[2], _pgx1, 0x0600u); } #ifdef PSX_COSIM cosim_instr(0x80031EC4u); #endif @@ -180833,7 +181127,8 @@ label_BFC0C3C0: psx_cyc_step(cpu, 0x30u); #endif /* 0xBFC0C3D8: 30A407FF andi $a0, $a1, 0x7FF */ - cpu->gpr[4] = cpu->gpr[5] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[4] = cpu->gpr[5] & 0x7FFu; + PGXP_ALU(0x30A407FFu, cpu->gpr[4], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80031ED8u); #endif @@ -186147,7 +186442,8 @@ label_BFC0CB40: psx_cyc_step(cpu, 0x128u); #endif /* 0xBFC0CB40: 0105182B sltu $v1, $t0, $a1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[8] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[3] = (uint32_t)(cpu->gpr[8] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0105182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032640u); #endif @@ -186508,7 +186804,8 @@ label_BFC0CBA4: psx_cyc_step(cpu, 0x184u); #endif /* 0xBFC0CBA8: 0048382B sltu $a3, $v0, $t0 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[7] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0048382Bu, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800326A8u); #endif @@ -186550,7 +186847,8 @@ label_BFC0CBAC: psx_cyc_step(cpu, 0x184u); #endif /* 0xBFC0CBB0: 0102382B sltu $a3, $t0, $v0 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[8] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[7] = (uint32_t)(cpu->gpr[8] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0102382Bu, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800326B0u); #endif @@ -186589,7 +186887,8 @@ label_BFC0CBB4: psx_cyc_step(cpu, 0x184u); #endif /* 0xBFC0CBB8: 0048382B sltu $a3, $v0, $t0 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[7] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0048382Bu, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800326B8u); #endif @@ -186670,7 +186969,8 @@ label_BFC0CBC4: psx_cyc_step(cpu, 0xB0u); #endif /* 0xBFC0CBC8: 00A4382B sltu $a3, $a1, $a0 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[7] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x00A4382Bu, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800326C8u); #endif @@ -186745,7 +187045,8 @@ label_BFC0CBD4: psx_cyc_step(cpu, 0x184u); #endif /* 0xBFC0CBD4: 0102382B sltu $a3, $t0, $v0 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[8] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[7] = (uint32_t)(cpu->gpr[8] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0102382Bu, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800326D4u); #endif @@ -186809,7 +187110,8 @@ label_BFC0CBE0: psx_cyc_step(cpu, 0xB0u); #endif /* 0xBFC0CBE4: 0085382B sltu $a3, $a0, $a1 */ - cpu->gpr[7] = (uint32_t)(cpu->gpr[4] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[7] = (uint32_t)(cpu->gpr[4] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0085382Bu, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800326E4u); #endif @@ -186890,7 +187192,8 @@ label_BFC0CBF0: psx_cyc_step(cpu, 0x490u); #endif /* 0xBFC0CBF4: 0087502B sltu $t2, $a0, $a3 */ - cpu->gpr[10] = (uint32_t)(cpu->gpr[4] < cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[10] = (uint32_t)(cpu->gpr[4] < cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x0087502Bu, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800326F4u); #endif @@ -188369,7 +188672,8 @@ label_BFC0CDB8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0CDC0: 2C42001F sltiu $v0, $v0, 31 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000001Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000001Fu ? 1 : 0); + PGXP_ALU(0x2C42001Fu, cpu->gpr[2], _pgx1, 0x001Fu); } #ifdef PSX_COSIM cosim_instr(0x800328C0u); #endif @@ -188868,7 +189172,8 @@ label_BFC0CE44: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0CE4C: 2C42001F sltiu $v0, $v0, 31 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000001Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000001Fu ? 1 : 0); + PGXP_ALU(0x2C42001Fu, cpu->gpr[2], _pgx1, 0x001Fu); } #ifdef PSX_COSIM cosim_instr(0x8003294Cu); #endif @@ -189905,7 +190210,8 @@ label_BFC0CFA4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0CFAC: 304207FF andi $v0, $v0, 0x7FF */ - cpu->gpr[2] = cpu->gpr[2] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x7FFu; + PGXP_ALU(0x304207FFu, cpu->gpr[2], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80032AACu); #endif @@ -190083,7 +190389,8 @@ label_BFC0CFC0: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC0CFDC: 00451024 and $v0, $v0, $a1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[5]; + PGXP_ALU(0x00451024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032ADCu); #endif @@ -190667,7 +190974,8 @@ label_BFC0D070: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0D078: 3063000F andi $v1, $v1, 0xF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFu; + PGXP_ALU(0x3063000Fu, cpu->gpr[3], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032B78u); #endif @@ -190675,7 +190983,8 @@ label_BFC0D070: psx_cyc_step(cpu, 0x48u); #endif /* 0xBFC0D07C: 2C66000F sltiu $a2, $v1, 15 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[3] < 0x0000000Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[6] = (uint32_t)(cpu->gpr[3] < 0x0000000Fu ? 1 : 0); + PGXP_ALU(0x2C66000Fu, cpu->gpr[6], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032B7Cu); #endif @@ -190686,7 +190995,8 @@ label_BFC0D070: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC0D080: 3045000F andi $a1, $v0, 0xF */ - cpu->gpr[5] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3045000Fu, cpu->gpr[5], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032B80u); #endif @@ -191003,7 +191313,8 @@ label_BFC0D0C0: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D0CC: 304300FF andi $v1, $v0, 0xFF */ - cpu->gpr[3] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80032BCCu); #endif @@ -191746,7 +192057,8 @@ label_BFC0D174: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D180: 2843006C slti $v1, $v0, 108 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (108) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (108) ? 1 : 0); + PGXP_ALU(0x2843006Cu, cpu->gpr[3], _pgx1, 0x006Cu); } #ifdef PSX_COSIM cosim_instr(0x80032C80u); #endif @@ -191903,7 +192215,8 @@ label_BFC0D198: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D1A4: 2843038C slti $v1, $v0, 908 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (908) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[2] < (908) ? 1 : 0); + PGXP_ALU(0x2843038Cu, cpu->gpr[3], _pgx1, 0x038Cu); } #ifdef PSX_COSIM cosim_instr(0x80032CA4u); #endif @@ -192025,7 +192338,8 @@ label_BFC0D1B8: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC0D1B8: 2C450011 sltiu $a1, $v0, 17 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2C450011u, cpu->gpr[5], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x80032CB8u); #endif @@ -192238,7 +192552,8 @@ label_BFC0D1F4: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC0D1F4: 31030001 andi $v1, $t0, 0x1 */ - cpu->gpr[3] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[3] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31030001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80032CF4u); #endif @@ -192428,7 +192743,8 @@ label_BFC0D214: psx_cyc_step(cpu, 0x1Cu); #endif /* 0xBFC0D220: 0043202A slt $a0, $v0, $v1 */ - cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043202Au, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032D20u); #endif @@ -192501,7 +192817,8 @@ label_BFC0D22C: psx_cyc_step(cpu, 0x1Cu); #endif /* 0xBFC0D238: 0062202A slt $a0, $v1, $v0 */ - cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062202Au, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032D38u); #endif @@ -192721,7 +193038,8 @@ label_BFC0D264: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D268: 2C430040 sltiu $v1, $v0, 64 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C430040u, cpu->gpr[3], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80032D68u); #endif @@ -192812,7 +193130,8 @@ label_BFC0D27C: psx_cyc_step(cpu, 0x1Cu); #endif /* 0xBFC0D27C: 0062202A slt $a0, $v1, $v0 */ - cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062202Au, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032D7Cu); #endif @@ -192895,7 +193214,8 @@ label_BFC0D288: psx_cyc_step(cpu, 0x1Cu); #endif /* 0xBFC0D298: 0043202A slt $a0, $v0, $v1 */ - cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043202Au, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032D98u); #endif @@ -192962,7 +193282,8 @@ label_BFC0D29C: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC0D29C: 2C450011 sltiu $a1, $v0, 17 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2C450011u, cpu->gpr[5], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x80032D9Cu); #endif @@ -193178,7 +193499,8 @@ label_BFC0D2D8: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC0D2D8: 31030001 andi $v1, $t0, 0x1 */ - cpu->gpr[3] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[3] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31030001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80032DD8u); #endif @@ -193359,7 +193681,8 @@ label_BFC0D2F8: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC0D300: 30A50003 andi $a1, $a1, 0x3 */ - cpu->gpr[5] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30A50003u, cpu->gpr[5], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80032E00u); #endif @@ -193374,7 +193697,8 @@ label_BFC0D2F8: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC0D308: 3082001F andi $v0, $a0, 0x1F */ - cpu->gpr[2] = cpu->gpr[4] & 0x1Fu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] & 0x1Fu; + PGXP_ALU(0x3082001Fu, cpu->gpr[2], _pgx1, 0x001Fu); } #ifdef PSX_COSIM cosim_instr(0x80032E08u); #endif @@ -193623,7 +193947,8 @@ label_BFC0D34C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0D34C: 3042000F andi $v0, $v0, 0xF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3042000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032E4Cu); #endif @@ -193661,7 +193986,8 @@ label_BFC0D34C: psx_cyc_step(cpu, 0x30u); #endif /* 0xBFC0D35C: 28850020 slti $a1, $a0, 32 */ - cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[4] < (32) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[5] = (uint32_t)((int32_t)cpu->gpr[4] < (32) ? 1 : 0); + PGXP_ALU(0x28850020u, cpu->gpr[5], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x80032E5Cu); #endif @@ -193791,7 +194117,8 @@ label_BFC0D378: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D37C: 2C430040 sltiu $v1, $v0, 64 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C430040u, cpu->gpr[3], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80032E7Cu); #endif @@ -194054,7 +194381,8 @@ label_BFC0D3A8: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC0D3B0: 30A50003 andi $a1, $a1, 0x3 */ - cpu->gpr[5] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30A50003u, cpu->gpr[5], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80032EB0u); #endif @@ -194093,7 +194421,8 @@ label_BFC0D3A8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0D3C4: 3042001F andi $v0, $v0, 0x1F */ - cpu->gpr[2] = cpu->gpr[2] & 0x1Fu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1Fu; + PGXP_ALU(0x3042001Fu, cpu->gpr[2], _pgx1, 0x001Fu); } #ifdef PSX_COSIM cosim_instr(0x80032EC4u); #endif @@ -194360,7 +194689,8 @@ label_BFC0D408: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC0D410: 3084000F andi $a0, $a0, 0xF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFu; + PGXP_ALU(0x3084000Fu, cpu->gpr[4], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032F10u); #endif @@ -194398,7 +194728,8 @@ label_BFC0D408: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC0D420: 28840020 slti $a0, $a0, 32 */ - cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[4] < (32) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[4] < (32) ? 1 : 0); + PGXP_ALU(0x28840020u, cpu->gpr[4], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x80032F20u); #endif @@ -194474,7 +194805,8 @@ label_BFC0D430: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0D434: 28420040 slti $v0, $v0, 64 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (64) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (64) ? 1 : 0); + PGXP_ALU(0x28420040u, cpu->gpr[2], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80032F34u); #endif @@ -194626,7 +194958,8 @@ label_BFC0D460: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC0D460: 31030001 andi $v1, $t0, 0x1 */ - cpu->gpr[3] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[3] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31030001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80032F60u); #endif @@ -194918,7 +195251,8 @@ label_BFC0D4A0: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC0D4A0: 2C450011 sltiu $a1, $v0, 17 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2C450011u, cpu->gpr[5], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x80032FA0u); #endif @@ -195083,7 +195417,8 @@ label_BFC0D4C4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D4C8: 2C430040 sltiu $v1, $v0, 64 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C430040u, cpu->gpr[3], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80032FC8u); #endif @@ -195661,7 +195996,8 @@ label_BFC0D54C: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0D554: 3063000F andi $v1, $v1, 0xF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFu; + PGXP_ALU(0x3063000Fu, cpu->gpr[3], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80033054u); #endif @@ -195669,7 +196005,8 @@ label_BFC0D54C: psx_cyc_step(cpu, 0x48u); #endif /* 0xBFC0D558: 2C66000F sltiu $a2, $v1, 15 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[3] < 0x0000000Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[6] = (uint32_t)(cpu->gpr[3] < 0x0000000Fu ? 1 : 0); + PGXP_ALU(0x2C66000Fu, cpu->gpr[6], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80033058u); #endif @@ -195677,7 +196014,8 @@ label_BFC0D54C: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC0D55C: 3045000F andi $a1, $v0, 0xF */ - cpu->gpr[5] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3045000Fu, cpu->gpr[5], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003305Cu); #endif @@ -195888,7 +196226,8 @@ label_BFC0D588: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC0D58C: 30A5003F andi $a1, $a1, 0x3F */ - cpu->gpr[5] = cpu->gpr[5] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x3Fu; + PGXP_ALU(0x30A5003Fu, cpu->gpr[5], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x8003308Cu); #endif @@ -195899,7 +196238,8 @@ label_BFC0D588: psx_cyc_step(cpu, 0x21u); #endif /* 0xBFC0D590: 0005282B sltu $a1, $zero, $a1 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[0] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[5] = (uint32_t)(cpu->gpr[0] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0005282Bu, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033090u); #endif @@ -195961,7 +196301,8 @@ label_BFC0D588: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0D5AC: 3063FFCF andi $v1, $v1, 0xFFCF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFCFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFCFu; + PGXP_ALU(0x3063FFCFu, cpu->gpr[3], _pgx1, 0xFFCFu); } #ifdef PSX_COSIM cosim_instr(0x800330ACu); #endif @@ -196044,7 +196385,8 @@ label_BFC0D5C4: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC0D5CC: 30A50030 andi $a1, $a1, 0x30 */ - cpu->gpr[5] = cpu->gpr[5] & 0x30u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x30u; + PGXP_ALU(0x30A50030u, cpu->gpr[5], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x800330CCu); #endif @@ -196121,7 +196463,8 @@ label_BFC0D5D8: psx_cyc_step(cpu, 0x60u); #endif /* 0xBFC0D5E4: 00A62824 and $a1, $a1, $a2 */ - cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[6]; + PGXP_ALU(0x00A62824u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800330E4u); #endif @@ -196234,7 +196577,8 @@ label_BFC0D608: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D610: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033110u); #endif @@ -197277,7 +197621,8 @@ label_BFC0D730: psx_cyc_step(cpu, 0x10410u); #endif /* 0xBFC0D738: 0204502B sltu $t2, $s0, $a0 */ - cpu->gpr[10] = (uint32_t)(cpu->gpr[16] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[10] = (uint32_t)(cpu->gpr[16] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0204502Bu, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033238u); #endif @@ -197427,7 +197772,8 @@ label_BFC0D754: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0D760: 2C63FFFE sltiu $v1, $v1, -2 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0xFFFFFFFEu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0xFFFFFFFEu ? 1 : 0); + PGXP_ALU(0x2C63FFFEu, cpu->gpr[3], _pgx1, 0xFFFEu); } #ifdef PSX_COSIM cosim_instr(0x80033260u); #endif @@ -198806,7 +199152,8 @@ label_BFC0D8C4: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC0D8E8: 0044102B sltu $v0, $v0, $a0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800333E8u); #endif @@ -199186,7 +199533,8 @@ label_BFC0D950: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D964: 0043182B sltu $v1, $v0, $v1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033464u); #endif @@ -199203,7 +199551,8 @@ label_BFC0D950: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D96C: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003346Cu); #endif @@ -199401,7 +199750,8 @@ label_BFC0D9A4: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0D9B8: 3063000F andi $v1, $v1, 0xF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFu; + PGXP_ALU(0x3063000Fu, cpu->gpr[3], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x800334B8u); #endif @@ -199430,7 +199780,8 @@ label_BFC0D9A4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D9C4: 2C430040 sltiu $v1, $v0, 64 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C430040u, cpu->gpr[3], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x800334C4u); #endif @@ -199447,7 +199798,8 @@ label_BFC0D9A4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D9CC: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800334CCu); #endif @@ -199540,7 +199892,8 @@ label_BFC0D9D8: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0D9EC: 0043182B sltu $v1, $v0, $v1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800334ECu); #endif @@ -199981,7 +200334,8 @@ label_BFC0DA80: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0DA8C: 2C430040 sltiu $v1, $v0, 64 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C430040u, cpu->gpr[3], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x8003358Cu); #endif @@ -200278,7 +200632,8 @@ label_BFC0DAE8: psx_cyc_step(cpu, 0x1008u); #endif /* 0xBFC0DAF4: 318300F0 andi $v1, $t4, 0xF0 */ - cpu->gpr[3] = cpu->gpr[12] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[3] = cpu->gpr[12] & 0xF0u; + PGXP_ALU(0x318300F0u, cpu->gpr[3], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x800335F4u); #endif @@ -200313,7 +200668,8 @@ label_BFC0DAE8: psx_cyc_step(cpu, 0x1000u); #endif /* 0xBFC0DB04: 318C0F00 andi $t4, $t4, 0xF00 */ - cpu->gpr[12] = cpu->gpr[12] & 0xF00u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[12] = cpu->gpr[12] & 0xF00u; + PGXP_ALU(0x318C0F00u, cpu->gpr[12], _pgx1, 0x0F00u); } #ifdef PSX_COSIM cosim_instr(0x80033604u); #endif @@ -200342,7 +200698,8 @@ label_BFC0DAE8: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC0DB10: 316B000F andi $t3, $t3, 0xF */ - cpu->gpr[11] = cpu->gpr[11] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0xFu; + PGXP_ALU(0x316B000Fu, cpu->gpr[11], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80033610u); #endif @@ -200368,7 +200725,8 @@ label_BFC0DAE8: psx_cyc_step(cpu, 0x500u); #endif /* 0xBFC0DB1C: 310A000F andi $t2, $t0, 0xF */ - cpu->gpr[10] = cpu->gpr[8] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[10] = cpu->gpr[8] & 0xFu; + PGXP_ALU(0x310A000Fu, cpu->gpr[10], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003361Cu); #endif @@ -200530,7 +200888,8 @@ label_BFC0DB34: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0DB4C: 28630040 slti $v1, $v1, 64 */ - cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[3] < (64) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)((int32_t)cpu->gpr[3] < (64) ? 1 : 0); + PGXP_ALU(0x28630040u, cpu->gpr[3], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x8003364Cu); #endif @@ -200740,7 +201099,8 @@ label_BFC0DB84: psx_cyc_step(cpu, 0x210u); #endif /* 0xBFC0DB84: 31240001 andi $a0, $t1, 0x1 */ - cpu->gpr[4] = cpu->gpr[9] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[4] = cpu->gpr[9] & 0x1u; + PGXP_ALU(0x31240001u, cpu->gpr[4], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80033684u); #endif @@ -201246,7 +201606,8 @@ label_BFC0DBF4: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC0DC28: 3065000C andi $a1, $v1, 0xC */ - cpu->gpr[5] = cpu->gpr[3] & 0xCu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[5] = cpu->gpr[3] & 0xCu; + PGXP_ALU(0x3065000Cu, cpu->gpr[5], _pgx1, 0x000Cu); } #ifdef PSX_COSIM cosim_instr(0x80033728u); #endif @@ -201315,7 +201676,8 @@ label_BFC0DC38: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0DC38: 2C630040 sltiu $v1, $v1, 64 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C630040u, cpu->gpr[3], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80033738u); #endif @@ -201393,7 +201755,8 @@ label_BFC0DC48: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0DC4C: 306300FD andi $v1, $v1, 0xFD */ - cpu->gpr[3] = cpu->gpr[3] & 0xFDu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFDu; + PGXP_ALU(0x306300FDu, cpu->gpr[3], _pgx1, 0x00FDu); } #ifdef PSX_COSIM cosim_instr(0x8003374Cu); #endif @@ -201835,7 +202198,8 @@ label_BFC0DCD0: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC0DCD4: 316B00FF andi $t3, $t3, 0xFF */ - cpu->gpr[11] = cpu->gpr[11] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0xFFu; + PGXP_ALU(0x316B00FFu, cpu->gpr[11], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800337D4u); #endif @@ -201843,7 +202207,8 @@ label_BFC0DCD0: psx_cyc_step(cpu, 0x808u); #endif /* 0xBFC0DCD8: 2D63000D sltiu $v1, $t3, 13 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[11] < 0x0000000Du ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[3] = (uint32_t)(cpu->gpr[11] < 0x0000000Du ? 1 : 0); + PGXP_ALU(0x2D63000Du, cpu->gpr[3], _pgx1, 0x000Du); } #ifdef PSX_COSIM cosim_instr(0x800337D8u); #endif @@ -202353,7 +202718,8 @@ label_BFC0DD50: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0DD58: 306300F0 andi $v1, $v1, 0xF0 */ - cpu->gpr[3] = cpu->gpr[3] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xF0u; + PGXP_ALU(0x306300F0u, cpu->gpr[3], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80033858u); #endif @@ -202399,7 +202765,8 @@ label_BFC0DD64: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC0DD68: 310800F0 andi $t0, $t0, 0xF0 */ - cpu->gpr[8] = cpu->gpr[8] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xF0u; + PGXP_ALU(0x310800F0u, cpu->gpr[8], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80033868u); #endif @@ -202448,7 +202815,8 @@ label_BFC0DD6C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0DD74: 3042000F andi $v0, $v0, 0xF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3042000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80033874u); #endif @@ -202593,7 +202961,8 @@ label_BFC0DD8C: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC0DD94: 306300F0 andi $v1, $v1, 0xF0 */ - cpu->gpr[3] = cpu->gpr[3] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xF0u; + PGXP_ALU(0x306300F0u, cpu->gpr[3], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80033894u); #endif @@ -202686,7 +203055,8 @@ label_BFC0DDA8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0DDB0: 3042000F andi $v0, $v0, 0xF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3042000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x800338B0u); #endif @@ -203030,7 +203400,8 @@ label_BFC0DDF0: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC0DDF4: 29020041 slti $v0, $t0, 65 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[8] < (65) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[8] < (65) ? 1 : 0); + PGXP_ALU(0x29020041u, cpu->gpr[2], _pgx1, 0x0041u); } #ifdef PSX_COSIM cosim_instr(0x800338F4u); #endif @@ -203213,7 +203584,8 @@ label_BFC0DE28: psx_cyc_step(cpu, 0x208u); #endif /* 0xBFC0DE28: 31230001 andi $v1, $t1, 0x1 */ - cpu->gpr[3] = cpu->gpr[9] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[3] = cpu->gpr[9] & 0x1u; + PGXP_ALU(0x31230001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80033928u); #endif @@ -203545,7 +203917,8 @@ label_BFC0DE70: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0DE74: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80033974u); #endif @@ -203553,7 +203926,8 @@ label_BFC0DE70: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0DE78: 2C43000E sltiu $v1, $v0, 14 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x0000000Eu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x0000000Eu ? 1 : 0); + PGXP_ALU(0x2C43000Eu, cpu->gpr[3], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0x80033978u); #endif @@ -204097,7 +204471,8 @@ label_BFC0DF00: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0DF08: 304200F0 andi $v0, $v0, 0xF0 */ - cpu->gpr[2] = cpu->gpr[2] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xF0u; + PGXP_ALU(0x304200F0u, cpu->gpr[2], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80033A08u); #endif @@ -204535,7 +204910,8 @@ label_BFC0DF68: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0DF70: 3042000F andi $v0, $v0, 0xF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3042000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80033A70u); #endif @@ -204653,7 +205029,8 @@ label_BFC0DF80: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0DF90: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80033A90u); #endif @@ -204661,7 +205038,8 @@ label_BFC0DF80: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0DF94: 2C420040 sltiu $v0, $v0, 64 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C420040u, cpu->gpr[2], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80033A94u); #endif @@ -205041,7 +205419,8 @@ label_BFC0DFDC: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC0DFE0: 2D020020 sltiu $v0, $t0, 32 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[8] < 0x00000020u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[2] = (uint32_t)(cpu->gpr[8] < 0x00000020u ? 1 : 0); + PGXP_ALU(0x2D020020u, cpu->gpr[2], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x80033AE0u); #endif @@ -205265,7 +205644,8 @@ label_BFC0E004: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC0E014: 0043182B sltu $v1, $v0, $v1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033B14u); #endif @@ -205635,7 +206015,8 @@ label_BFC1E51C: psx_cyc_step(cpu, 0x48u); #endif /* 0xBFC1E51C: 2CC30020 sltiu $v1, $a2, 32 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[6] < 0x00000020u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[3] = (uint32_t)(cpu->gpr[6] < 0x00000020u ? 1 : 0); + PGXP_ALU(0x2CC30020u, cpu->gpr[3], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x00000548u); #endif @@ -205840,7 +206221,8 @@ label_BFC1E540: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC1E554: 30830003 andi $v1, $a0, 0x3 */ - cpu->gpr[3] = cpu->gpr[4] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0x3u; + PGXP_ALU(0x30830003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00000580u); #endif @@ -205920,7 +206302,8 @@ label_BFC1E540: psx_cyc_step(cpu, 0x240u); #endif /* 0xBFC1E578: 30C900FF andi $t1, $a2, 0xFF */ - cpu->gpr[9] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[9] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30C900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x000005A4u); #endif @@ -208316,7 +208699,8 @@ label_BFC1E848: psx_cyc_step(cpu, 0x90u); #endif /* 0xBFC1E848: 00872024 and $a0, $a0, $a3 */ - cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[7]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[7]; + PGXP_ALU(0x00872024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00000874u); #endif @@ -209070,7 +209454,8 @@ label_BFC1E94C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1E958: 30420008 andi $v0, $v0, 0x8 */ - cpu->gpr[2] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30420008u, cpu->gpr[2], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x00000984u); #endif @@ -209131,7 +209516,8 @@ label_BFC1E964: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1E96C: 30420008 andi $v0, $v0, 0x8 */ - cpu->gpr[2] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30420008u, cpu->gpr[2], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x00000998u); #endif @@ -209209,7 +209595,8 @@ label_BFC1E978: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1E984: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000009B0u); #endif @@ -210003,7 +210390,8 @@ label_BFC1EA60: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1EA6C: 30420004 andi $v0, $v0, 0x4 */ - cpu->gpr[2] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30420004u, cpu->gpr[2], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00000A98u); #endif @@ -210067,7 +210455,8 @@ label_BFC1EA78: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1EA80: 30420004 andi $v0, $v0, 0x4 */ - cpu->gpr[2] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30420004u, cpu->gpr[2], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00000AACu); #endif @@ -210174,7 +210563,8 @@ label_BFC1EA8C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC1EAA4: 30840007 andi $a0, $a0, 0x7 */ - cpu->gpr[4] = cpu->gpr[4] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x7u; + PGXP_ALU(0x30840007u, cpu->gpr[4], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x00000AD0u); #endif @@ -210318,7 +210708,8 @@ label_BFC1EACC: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC1EAD4: 30630018 andi $v1, $v1, 0x18 */ - cpu->gpr[3] = cpu->gpr[3] & 0x18u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x18u; + PGXP_ALU(0x30630018u, cpu->gpr[3], _pgx1, 0x0018u); } #ifdef PSX_COSIM cosim_instr(0x00000B00u); #endif @@ -210401,7 +210792,8 @@ label_BFC1EAE0: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC1EAF0: 30630018 andi $v1, $v1, 0x18 */ - cpu->gpr[3] = cpu->gpr[3] & 0x18u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x18u; + PGXP_ALU(0x30630018u, cpu->gpr[3], _pgx1, 0x0018u); } #ifdef PSX_COSIM cosim_instr(0x00000B1Cu); #endif @@ -210496,7 +210888,8 @@ label_BFC1EB0C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1EB14: 30420007 andi $v0, $v0, 0x7 */ - cpu->gpr[2] = cpu->gpr[2] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x7u; + PGXP_ALU(0x30420007u, cpu->gpr[2], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x00000B40u); #endif @@ -210513,7 +210906,8 @@ label_BFC1EB0C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1EB1C: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00000B48u); #endif @@ -210521,7 +210915,8 @@ label_BFC1EB0C: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1EB20: 2C430005 sltiu $v1, $v0, 5 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000005u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < 0x00000005u ? 1 : 0); + PGXP_ALU(0x2C430005u, cpu->gpr[3], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0x00000B4Cu); #endif @@ -210770,7 +211165,8 @@ label_BFC1EB50: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC1EB68: 2C4400F7 sltiu $a0, $v0, 247 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x000000F7u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x000000F7u ? 1 : 0); + PGXP_ALU(0x2C4400F7u, cpu->gpr[4], _pgx1, 0x00F7u); } #ifdef PSX_COSIM cosim_instr(0x00000B94u); #endif @@ -210966,7 +211362,8 @@ label_BFC1EB88: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC1EB94: 2C4400EC sltiu $a0, $v0, 236 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x000000ECu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x000000ECu ? 1 : 0); + PGXP_ALU(0x2C4400ECu, cpu->gpr[4], _pgx1, 0x00ECu); } #ifdef PSX_COSIM cosim_instr(0x00000BC0u); #endif @@ -211005,7 +211402,8 @@ label_BFC1EB98: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC1EB9C: 2C440006 sltiu $a0, $v0, 6 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x00000006u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x00000006u ? 1 : 0); + PGXP_ALU(0x2C440006u, cpu->gpr[4], _pgx1, 0x0006u); } #ifdef PSX_COSIM cosim_instr(0x00000BC8u); #endif @@ -211079,7 +211477,8 @@ label_BFC1EBA8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1EBA8: 2C420003 sltiu $v0, $v0, 3 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2C420003u, cpu->gpr[2], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00000BD4u); #endif @@ -212280,7 +212679,8 @@ label_BFC1ECA0: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC1ECAC: 2C45001B sltiu $a1, $v0, 27 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x0000001Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x0000001Bu ? 1 : 0); + PGXP_ALU(0x2C45001Bu, cpu->gpr[5], _pgx1, 0x001Bu); } #ifdef PSX_COSIM cosim_instr(0x00000CD8u); #endif @@ -212394,7 +212794,8 @@ label_BFC1ECC0: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC1ECC0: 2C440013 sltiu $a0, $v0, 19 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x00000013u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x00000013u ? 1 : 0); + PGXP_ALU(0x2C440013u, cpu->gpr[4], _pgx1, 0x0013u); } #ifdef PSX_COSIM cosim_instr(0x00000CECu); #endif @@ -212463,7 +212864,8 @@ label_BFC1ECD0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1ECD0: 2C420002 sltiu $v0, $v0, 2 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2C420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00000CFCu); #endif @@ -212947,7 +213349,8 @@ label_BFC1ED24: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1ED2C: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00000D58u); #endif @@ -213117,7 +213520,8 @@ label_BFC1ED54: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC1ED60: 2C4500E7 sltiu $a1, $v0, 231 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x000000E7u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x000000E7u ? 1 : 0); + PGXP_ALU(0x2C4500E7u, cpu->gpr[5], _pgx1, 0x00E7u); } #ifdef PSX_COSIM cosim_instr(0x00000D8Cu); #endif @@ -213197,7 +213601,8 @@ label_BFC1ED6C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1ED70: 2C420003 sltiu $v0, $v0, 3 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2C420003u, cpu->gpr[2], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00000D9Cu); #endif @@ -213691,7 +214096,8 @@ label_BFC1EDE0: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC1EDE0: 2C46001A sltiu $a2, $v0, 26 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < 0x0000001Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < 0x0000001Au ? 1 : 0); + PGXP_ALU(0x2C46001Au, cpu->gpr[6], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0x00000E0Cu); #endif @@ -213798,7 +214204,8 @@ label_BFC1EDF8: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC1EDFC: 2C440019 sltiu $a0, $v0, 25 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x00000019u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < 0x00000019u ? 1 : 0); + PGXP_ALU(0x2C440019u, cpu->gpr[4], _pgx1, 0x0019u); } #ifdef PSX_COSIM cosim_instr(0x00000E28u); #endif @@ -214109,7 +214516,8 @@ label_BFC1EE64: psx_cyc_step(cpu, 0x60u); #endif /* 0xBFC1EE74: 00A63024 and $a2, $a1, $a2 */ - cpu->gpr[6] = cpu->gpr[5] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[5] & cpu->gpr[6]; + PGXP_ALU(0x00A63024u, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00000EA0u); #endif @@ -214169,7 +214577,8 @@ label_BFC1EE80: psx_cyc_step(cpu, 0x60u); #endif /* 0xBFC1EE84: 00A62824 and $a1, $a1, $a2 */ - cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[6]; + PGXP_ALU(0x00A62824u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00000EB0u); #endif @@ -214299,7 +214708,8 @@ label_BFC1EEA0: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC1EEA0: 2C4500FF sltiu $a1, $v0, 255 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x000000FFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x000000FFu ? 1 : 0); + PGXP_ALU(0x2C4500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00000ECCu); #endif @@ -214317,7 +214727,8 @@ label_BFC1EEA0: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC1EEA8: 2C4500E6 sltiu $a1, $v0, 230 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x000000E6u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = (uint32_t)(cpu->gpr[2] < 0x000000E6u ? 1 : 0); + PGXP_ALU(0x2C4500E6u, cpu->gpr[5], _pgx1, 0x00E6u); } #ifdef PSX_COSIM cosim_instr(0x00000ED4u); #endif @@ -215179,7 +215590,8 @@ label_BFC1EF34: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC1EF68: 00A2282B sltu $a1, $a1, $v0 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[5] = (uint32_t)(cpu->gpr[5] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x00A2282Bu, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00000F94u); #endif @@ -215240,7 +215652,8 @@ label_BFC1EF74: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC1EF7C: 30A50010 andi $a1, $a1, 0x10 */ - cpu->gpr[5] = cpu->gpr[5] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x10u; + PGXP_ALU(0x30A50010u, cpu->gpr[5], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00000FA8u); #endif @@ -215801,7 +216214,8 @@ label_BFC1EFF4: psx_cyc_step(cpu, 0x90u); #endif /* 0xBFC1EFF8: 30E4000F andi $a0, $a3, 0xF */ - cpu->gpr[4] = cpu->gpr[7] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[4] = cpu->gpr[7] & 0xFu; + PGXP_ALU(0x30E4000Fu, cpu->gpr[4], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x00001024u); #endif @@ -215937,7 +216351,8 @@ label_BFC1F014: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC1F018: 30C6000F andi $a2, $a2, 0xF */ - cpu->gpr[6] = cpu->gpr[6] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0xFu; + PGXP_ALU(0x30C6000Fu, cpu->gpr[6], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x00001044u); #endif @@ -216055,7 +216470,8 @@ label_BFC1F034: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC1F034: 30840010 andi $a0, $a0, 0x10 */ - cpu->gpr[4] = cpu->gpr[4] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x10u; + PGXP_ALU(0x30840010u, cpu->gpr[4], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00001060u); #endif @@ -216465,7 +216881,8 @@ label_BFC1F098: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F0A8: 30420100 andi $v0, $v0, 0x100 */ - cpu->gpr[2] = cpu->gpr[2] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x100u; + PGXP_ALU(0x30420100u, cpu->gpr[2], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x000010D4u); #endif @@ -217519,7 +217936,8 @@ label_BFC1F19C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F1A0: 2C420003 sltiu $v0, $v0, 3 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2C420003u, cpu->gpr[2], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x000011CCu); #endif @@ -218792,7 +219210,8 @@ label_BFC1F2E8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F2F0: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x0000131Cu); #endif @@ -219850,7 +220269,8 @@ label_BFC1F410: psx_cyc_step(cpu, 0x48u); #endif /* 0xBFC1F418: 30C30010 andi $v1, $a2, 0x10 */ - cpu->gpr[3] = cpu->gpr[6] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[3] = cpu->gpr[6] & 0x10u; + PGXP_ALU(0x30C30010u, cpu->gpr[3], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00001444u); #endif @@ -219907,7 +220327,8 @@ label_BFC1F428: psx_cyc_step(cpu, 0x48u); #endif /* 0xBFC1F428: 30C30020 andi $v1, $a2, 0x20 */ - cpu->gpr[3] = cpu->gpr[6] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[3] = cpu->gpr[6] & 0x20u; + PGXP_ALU(0x30C30020u, cpu->gpr[3], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x00001454u); #endif @@ -220117,7 +220538,8 @@ label_BFC1F438: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC1F474: 30630010 andi $v1, $v1, 0x10 */ - cpu->gpr[3] = cpu->gpr[3] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x10u; + PGXP_ALU(0x30630010u, cpu->gpr[3], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x000014A0u); #endif @@ -220527,7 +220949,8 @@ label_BFC1F4D4: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC1F4EC: 30630010 andi $v1, $v1, 0x10 */ - cpu->gpr[3] = cpu->gpr[3] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x10u; + PGXP_ALU(0x30630010u, cpu->gpr[3], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00001518u); #endif @@ -221057,7 +221480,8 @@ label_BFC1F568: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC1F594: 00461024 and $v0, $v0, $a2 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + PGXP_ALU(0x00461024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000015C0u); #endif @@ -221092,7 +221516,8 @@ label_BFC1F568: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F5A4: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000015D0u); #endif @@ -221126,7 +221551,8 @@ label_BFC1F568: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC1F5B4: 00461024 and $v0, $v0, $a2 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + PGXP_ALU(0x00461024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000015E0u); #endif @@ -221160,7 +221586,8 @@ label_BFC1F568: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F5C4: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000015F0u); #endif @@ -221282,7 +221709,8 @@ label_BFC1F568: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F5F8: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001624u); #endif @@ -221470,7 +221898,8 @@ label_BFC1F634: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC1F63C: 00461024 and $v0, $v0, $a2 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[6]; + PGXP_ALU(0x00461024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001668u); #endif @@ -221957,7 +222386,8 @@ label_BFC1F6B8: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F6D4: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001700u); #endif @@ -221965,7 +222395,8 @@ label_BFC1F6B8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F6D8: 30420004 andi $v0, $v0, 0x4 */ - cpu->gpr[2] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30420004u, cpu->gpr[2], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00001704u); #endif @@ -222136,7 +222567,8 @@ label_BFC1F704: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F70C: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001738u); #endif @@ -222205,7 +222637,8 @@ label_BFC1F718: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F724: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001750u); #endif @@ -222213,7 +222646,8 @@ label_BFC1F718: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F728: 30420200 andi $v0, $v0, 0x200 */ - cpu->gpr[2] = cpu->gpr[2] & 0x200u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x200u; + PGXP_ALU(0x30420200u, cpu->gpr[2], _pgx1, 0x0200u); } #ifdef PSX_COSIM cosim_instr(0x00001754u); #endif @@ -222384,7 +222818,8 @@ label_BFC1F754: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F75C: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001788u); #endif @@ -222443,7 +222878,8 @@ label_BFC1F764: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F774: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000017A0u); #endif @@ -222451,7 +222887,8 @@ label_BFC1F764: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F778: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x000017A4u); #endif @@ -222622,7 +223059,8 @@ label_BFC1F7A4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F7AC: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000017D8u); #endif @@ -222691,7 +223129,8 @@ label_BFC1F7B8: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F7C4: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000017F0u); #endif @@ -222699,7 +223138,8 @@ label_BFC1F7B8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F7C8: 30420400 andi $v0, $v0, 0x400 */ - cpu->gpr[2] = cpu->gpr[2] & 0x400u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x400u; + PGXP_ALU(0x30420400u, cpu->gpr[2], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x000017F4u); #endif @@ -223021,7 +223461,8 @@ label_BFC1F7F4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F7FC: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001828u); #endif @@ -223159,7 +223600,8 @@ label_BFC1F814: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F814: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001840u); #endif @@ -223190,7 +223632,8 @@ label_BFC1F818: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F818: 30420100 andi $v0, $v0, 0x100 */ - cpu->gpr[2] = cpu->gpr[2] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x100u; + PGXP_ALU(0x30420100u, cpu->gpr[2], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x00001844u); #endif @@ -223466,7 +223909,8 @@ label_BFC1F84C: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F84C: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001878u); #endif @@ -223613,7 +224057,8 @@ label_BFC1F858: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F864: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001890u); #endif @@ -223621,7 +224066,8 @@ label_BFC1F858: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F868: 30420001 andi $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00001894u); #endif @@ -223792,7 +224238,8 @@ label_BFC1F894: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F89C: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000018C8u); #endif @@ -223851,7 +224298,8 @@ label_BFC1F8A4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F8B4: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000018E0u); #endif @@ -223859,7 +224307,8 @@ label_BFC1F8A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F8B8: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x000018E4u); #endif @@ -224030,7 +224479,8 @@ label_BFC1F8E4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F8EC: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001918u); #endif @@ -224099,7 +224549,8 @@ label_BFC1F8F8: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F904: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001930u); #endif @@ -224107,7 +224558,8 @@ label_BFC1F8F8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F908: 30420020 andi $v0, $v0, 0x20 */ - cpu->gpr[2] = cpu->gpr[2] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x20u; + PGXP_ALU(0x30420020u, cpu->gpr[2], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x00001934u); #endif @@ -224278,7 +224730,8 @@ label_BFC1F934: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F93C: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001968u); #endif @@ -224337,7 +224790,8 @@ label_BFC1F944: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F954: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001980u); #endif @@ -224345,7 +224799,8 @@ label_BFC1F944: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F958: 30420040 andi $v0, $v0, 0x40 */ - cpu->gpr[2] = cpu->gpr[2] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x40u; + PGXP_ALU(0x30420040u, cpu->gpr[2], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x00001984u); #endif @@ -224516,7 +224971,8 @@ label_BFC1F984: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F98C: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000019B8u); #endif @@ -224585,7 +225041,8 @@ label_BFC1F998: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F9A4: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000019D0u); #endif @@ -224593,7 +225050,8 @@ label_BFC1F998: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F9A8: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000019D4u); #endif @@ -224764,7 +225222,8 @@ label_BFC1F9D4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F9DC: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001A08u); #endif @@ -224823,7 +225282,8 @@ label_BFC1F9E4: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1F9F4: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001A20u); #endif @@ -224831,7 +225291,8 @@ label_BFC1F9E4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1F9F8: 30420008 andi $v0, $v0, 0x8 */ - cpu->gpr[2] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30420008u, cpu->gpr[2], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x00001A24u); #endif @@ -225002,7 +225463,8 @@ label_BFC1FA24: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC1FA2C: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001A58u); #endif @@ -225137,7 +225599,8 @@ label_BFC1FA48: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1FA54: 30420001 andi $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00001A80u); #endif @@ -225201,7 +225664,8 @@ label_BFC1FA60: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1FA68: 30420001 andi $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00001A94u); #endif @@ -225446,7 +225910,8 @@ label_BFC1FAA0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1FAAC: 30420040 andi $v0, $v0, 0x40 */ - cpu->gpr[2] = cpu->gpr[2] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x40u; + PGXP_ALU(0x30420040u, cpu->gpr[2], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x00001AD8u); #endif @@ -225510,7 +225975,8 @@ label_BFC1FAB8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1FAC0: 30420040 andi $v0, $v0, 0x40 */ - cpu->gpr[2] = cpu->gpr[2] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x40u; + PGXP_ALU(0x30420040u, cpu->gpr[2], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x00001AECu); #endif @@ -225761,7 +226227,8 @@ label_BFC1FAF8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1FB04: 30420020 andi $v0, $v0, 0x20 */ - cpu->gpr[2] = cpu->gpr[2] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x20u; + PGXP_ALU(0x30420020u, cpu->gpr[2], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x00001B30u); #endif @@ -225825,7 +226292,8 @@ label_BFC1FB10: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1FB18: 30420020 andi $v0, $v0, 0x20 */ - cpu->gpr[2] = cpu->gpr[2] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x20u; + PGXP_ALU(0x30420020u, cpu->gpr[2], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x00001B44u); #endif @@ -226070,7 +226538,8 @@ label_BFC1FB50: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1FB5C: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00001B88u); #endif @@ -226134,7 +226603,8 @@ label_BFC1FB68: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1FB70: 30420010 andi $v0, $v0, 0x10 */ - cpu->gpr[2] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30420010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00001B9Cu); #endif @@ -227657,7 +228127,8 @@ label_BFC1FCB4: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC1FCD8: 00451024 and $v0, $v0, $a1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[5]; + PGXP_ALU(0x00451024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001D04u); #endif @@ -228112,7 +228583,8 @@ label_BFC1FD74: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC1FD74: 2C830003 sltiu $v1, $a0, 3 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2C830003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00001DA0u); #endif @@ -228264,7 +228736,8 @@ label_BFC1FD98: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC1FD98: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001DC4u); #endif @@ -228272,7 +228745,8 @@ label_BFC1FD98: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC1FD9C: 2C830003 sltiu $v1, $a0, 3 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2C830003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00001DC8u); #endif @@ -228362,7 +228836,8 @@ label_BFC1FDA8: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC1FDB8: 30C20010 andi $v0, $a2, 0x10 */ - cpu->gpr[2] = cpu->gpr[6] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[6] & 0x10u; + PGXP_ALU(0x30C20010u, cpu->gpr[2], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00001DE4u); #endif @@ -228370,7 +228845,8 @@ label_BFC1FDA8: psx_cyc_step(cpu, 0x48u); #endif /* 0xBFC1FDBC: 30C30001 andi $v1, $a2, 0x1 */ - cpu->gpr[3] = cpu->gpr[6] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[3] = cpu->gpr[6] & 0x1u; + PGXP_ALU(0x30C30001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00001DE8u); #endif @@ -228378,7 +228854,8 @@ label_BFC1FDA8: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC1FDC0: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001DECu); #endif @@ -228407,7 +228884,8 @@ label_BFC1FDA8: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC1FDCC: 30C61000 andi $a2, $a2, 0x1000 */ - cpu->gpr[6] = cpu->gpr[6] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x1000u; + PGXP_ALU(0x30C61000u, cpu->gpr[6], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x00001DF8u); #endif @@ -228574,7 +229052,8 @@ label_BFC1FDF8: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC1FDF8: 3082FFFF andi $v0, $a0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3082FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001E24u); #endif @@ -228645,7 +229124,8 @@ label_BFC1FDF8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1FE18: 2C420003 sltiu $v0, $v0, 3 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2C420003u, cpu->gpr[2], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00001E44u); #endif @@ -228714,7 +229194,8 @@ label_BFC1FE2C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC1FE2C: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001E58u); #endif @@ -228785,7 +229266,8 @@ label_BFC1FE2C: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC1FE4C: 00021027 nor $v0, $zero, $v0 */ - cpu->gpr[2] = ~(cpu->gpr[0] | cpu->gpr[2]); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = ~(cpu->gpr[0] | cpu->gpr[2]); + PGXP_ALU(0x00021027u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001E78u); #endif @@ -228793,7 +229275,8 @@ label_BFC1FE2C: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC1FE50: 00451024 and $v0, $v0, $a1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[5]; + PGXP_ALU(0x00451024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001E7Cu); #endif @@ -228865,7 +229348,8 @@ label_BFC1FE60: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC1FE60: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001E8Cu); #endif @@ -228876,7 +229360,8 @@ label_BFC1FE60: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC1FE64: 2C830003 sltiu $v1, $a0, 3 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = (uint32_t)(cpu->gpr[4] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2C830003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00001E90u); #endif @@ -229792,7 +230277,8 @@ label_BFC1FF40: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC1FF5C: 3063003C andi $v1, $v1, 0x3C */ - cpu->gpr[3] = cpu->gpr[3] & 0x3Cu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x3Cu; + PGXP_ALU(0x3063003Cu, cpu->gpr[3], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x00001F88u); #endif @@ -229963,7 +230449,8 @@ label_BFC1FF78: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC1FF94: 2C650003 sltiu $a1, $v1, 3 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[3] < 0x00000003u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[5] = (uint32_t)(cpu->gpr[3] < 0x00000003u ? 1 : 0); + PGXP_ALU(0x2C650003u, cpu->gpr[5], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00001FC0u); #endif @@ -230306,7 +230793,8 @@ label_BFC1FFD8: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC1FFD8: 30830404 andi $v1, $a0, 0x404 */ - cpu->gpr[3] = cpu->gpr[4] & 0x404u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0x404u; + PGXP_ALU(0x30830404u, cpu->gpr[3], _pgx1, 0x0404u); } #ifdef PSX_COSIM cosim_instr(0x00002004u); #endif @@ -230337,7 +230825,8 @@ label_BFC1FFDC: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC1FFDC: 38630404 xori $v1, $v1, 0x404 */ - cpu->gpr[3] = cpu->gpr[3] ^ 0x404u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] ^ 0x404u; + PGXP_ALU(0x38630404u, cpu->gpr[3], _pgx1, 0x0404u); } #ifdef PSX_COSIM cosim_instr(0x00002008u); #endif @@ -230368,7 +230857,8 @@ label_BFC1FFE0: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC1FFE0: 2C630001 sltiu $v1, $v1, 1 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C630001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x0000200Cu); #endif @@ -230442,7 +230932,8 @@ label_BFC1FFE8: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC1FFEC: 00832024 and $a0, $a0, $v1 */ - cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[3]; + PGXP_ALU(0x00832024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002018u); #endif @@ -231204,7 +231695,8 @@ label_BFC20070: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC20078: 00822024 and $a0, $a0, $v0 */ - cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[2]; + PGXP_ALU(0x00822024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000020A4u); #endif @@ -231670,7 +232162,8 @@ label_BFC200E8: psx_cyc_step(cpu, 0x510u); #endif /* 0xBFC200F0: 0104502B sltu $t2, $t0, $a0 */ - cpu->gpr[10] = (uint32_t)(cpu->gpr[8] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[10] = (uint32_t)(cpu->gpr[8] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0104502Bu, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000211Cu); #endif @@ -231773,7 +232266,8 @@ label_BFC20104: psx_cyc_step(cpu, 0x500u); #endif /* 0xBFC2010C: 010A502B sltu $t2, $t0, $t2 */ - cpu->gpr[10] = (uint32_t)(cpu->gpr[8] < cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[10] = (uint32_t)(cpu->gpr[8] < cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x010A502Bu, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002138u); #endif @@ -232691,7 +233185,8 @@ label_BFC201D4: psx_cyc_step(cpu, 0x10Cu); #endif /* 0xBFC201D8: 0062402B sltu $t0, $v1, $v0 */ - cpu->gpr[8] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[8] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062402Bu, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002204u); #endif @@ -233438,7 +233933,8 @@ label_BFC202A4: psx_cyc_step(cpu, 0x10Cu); #endif /* 0xBFC202B4: 0062402B sltu $t0, $v1, $v0 */ - cpu->gpr[8] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[8] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062402Bu, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000022E0u); #endif @@ -234016,7 +234512,8 @@ label_BFC20318: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC20324: 00C23024 and $a2, $a2, $v0 */ - cpu->gpr[6] = cpu->gpr[6] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[6] = cpu->gpr[6] & cpu->gpr[2]; + PGXP_ALU(0x00C23024u, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002350u); #endif @@ -234189,7 +234686,8 @@ label_BFC20350: psx_cyc_step(cpu, 0x848u); #endif /* 0xBFC20350: 00CB182B sltu $v1, $a2, $t3 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[6] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[3] = (uint32_t)(cpu->gpr[6] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x00CB182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000237Cu); #endif @@ -234418,7 +234916,8 @@ label_BFC20388: psx_cyc_step(cpu, 0x114u); #endif /* 0xBFC20388: 0048202B sltu $a0, $v0, $t0 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0048202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000023B4u); #endif @@ -234466,7 +234965,8 @@ label_BFC20394: psx_cyc_step(cpu, 0x850u); #endif /* 0xBFC20394: 00CB202B sltu $a0, $a2, $t3 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[6] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[4] = (uint32_t)(cpu->gpr[6] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x00CB202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000023C0u); #endif @@ -234743,7 +235243,8 @@ label_BFC203D4: psx_cyc_step(cpu, 0x218u); #endif /* 0xBFC203DC: 0124182B sltu $v1, $t1, $a0 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[9] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = (uint32_t)(cpu->gpr[9] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0124182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002408u); #endif @@ -235239,7 +235740,8 @@ label_BFC20448: psx_cyc_step(cpu, 0x114u); #endif /* 0xBFC20454: 0048202B sltu $a0, $v0, $t0 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[4] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0048202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002480u); #endif @@ -235271,7 +235773,8 @@ label_BFC20458: psx_cyc_step(cpu, 0x850u); #endif /* 0xBFC20458: 00CB202B sltu $a0, $a2, $t3 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[6] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[4] = (uint32_t)(cpu->gpr[6] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x00CB202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002484u); #endif @@ -235551,7 +236054,8 @@ label_BFC2049C: psx_cyc_step(cpu, 0x850u); #endif /* 0xBFC2049C: 00CB202B sltu $a0, $a2, $t3 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[6] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[4] = (uint32_t)(cpu->gpr[6] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x00CB202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000024C8u); #endif @@ -235990,7 +236494,8 @@ label_BFC20500: psx_cyc_step(cpu, 0x218u); #endif /* 0xBFC20508: 0124182B sltu $v1, $t1, $a0 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[9] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = (uint32_t)(cpu->gpr[9] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0124182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002534u); #endif @@ -236415,7 +236920,8 @@ label_BFC2056C: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC20574: 00832024 and $a0, $a0, $v1 */ - cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[3]; + PGXP_ALU(0x00832024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000025A0u); #endif @@ -236471,7 +236977,8 @@ label_BFC2056C: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC2058C: 00A32824 and $a1, $a1, $v1 */ - cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[3]; + PGXP_ALU(0x00A32824u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000025B8u); #endif @@ -236673,7 +237180,8 @@ label_BFC205B4: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC205BC: 00832024 and $a0, $a0, $v1 */ - cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[3]; + PGXP_ALU(0x00832024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000025E8u); #endif @@ -236732,7 +237240,8 @@ label_BFC205B4: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC205D4: 00A32824 and $a1, $a1, $v1 */ - cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[3]; + PGXP_ALU(0x00A32824u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002600u); #endif @@ -236937,7 +237446,8 @@ label_BFC20610: psx_cyc_step(cpu, 0x30004u); #endif /* 0xBFC20610: 0211102B sltu $v0, $s0, $s1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[2] = (uint32_t)(cpu->gpr[16] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0211102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000263Cu); #endif @@ -237626,7 +238136,8 @@ label_BFC206D0: psx_cyc_step(cpu, 0x4Cu); #endif /* 0xBFC206D0: 0043302B sltu $a2, $v0, $v1 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[6] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043302Bu, cpu->gpr[6], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000026FCu); #endif @@ -238832,7 +239343,8 @@ label_BFC207C0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC207C0: 3042003C andi $v0, $v0, 0x3C */ - cpu->gpr[2] = cpu->gpr[2] & 0x3Cu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x3Cu; + PGXP_ALU(0x3042003Cu, cpu->gpr[2], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x000027ECu); #endif @@ -238908,7 +239420,8 @@ label_BFC207CC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC207D8: 304200FE andi $v0, $v0, 0xFE */ - cpu->gpr[2] = cpu->gpr[2] & 0xFEu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFEu; + PGXP_ALU(0x304200FEu, cpu->gpr[2], _pgx1, 0x00FEu); } #ifdef PSX_COSIM cosim_instr(0x00002804u); #endif @@ -241496,7 +242009,8 @@ label_BFC20B30: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC20B54: 2C65000D sltiu $a1, $v1, 13 */ - cpu->gpr[5] = (uint32_t)(cpu->gpr[3] < 0x0000000Du ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[5] = (uint32_t)(cpu->gpr[3] < 0x0000000Du ? 1 : 0); + PGXP_ALU(0x2C65000Du, cpu->gpr[5], _pgx1, 0x000Du); } #ifdef PSX_COSIM cosim_instr(0x00002B80u); #endif @@ -241643,7 +242157,8 @@ label_BFC20B80: psx_cyc_step(cpu, 0x11u); #endif /* 0xBFC20B80: 0004202B sltu $a0, $zero, $a0 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0004202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002BACu); #endif @@ -241753,7 +242268,8 @@ label_BFC20B80: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC20BB0: 3063000F andi $v1, $v1, 0xF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFu; + PGXP_ALU(0x3063000Fu, cpu->gpr[3], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x00002BDCu); #endif @@ -242272,7 +242788,8 @@ label_BFC20C5C: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC20C5C: 30A30008 andi $v1, $a1, 0x8 */ - cpu->gpr[3] = cpu->gpr[5] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[3] = cpu->gpr[5] & 0x8u; + PGXP_ALU(0x30A30008u, cpu->gpr[3], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x00002C88u); #endif @@ -242655,7 +243172,8 @@ label_BFC20CCC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC20CDC: 3842005A xori $v0, $v0, 0x5A */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x5Au; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x5Au; + PGXP_ALU(0x3842005Au, cpu->gpr[2], _pgx1, 0x005Au); } #ifdef PSX_COSIM cosim_instr(0x00002D08u); #endif @@ -242714,7 +243232,8 @@ label_BFC20CCC: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC20CF4: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002D20u); #endif @@ -242837,7 +243356,8 @@ label_BFC20D10: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC20D14: 3842005D xori $v0, $v0, 0x5D */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x5Du; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x5Du; + PGXP_ALU(0x3842005Du, cpu->gpr[2], _pgx1, 0x005Du); } #ifdef PSX_COSIM cosim_instr(0x00002D40u); #endif @@ -242900,7 +243420,8 @@ label_BFC20D10: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC20D30: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002D5Cu); #endif @@ -243142,7 +243663,8 @@ label_BFC20D5C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC20D6C: 3842005C xori $v0, $v0, 0x5C */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x5Cu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x5Cu; + PGXP_ALU(0x3842005Cu, cpu->gpr[2], _pgx1, 0x005Cu); } #ifdef PSX_COSIM cosim_instr(0x00002D98u); #endif @@ -243208,7 +243730,8 @@ label_BFC20D5C: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC20D88: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002DB4u); #endif @@ -243454,7 +243977,8 @@ label_BFC20DA0: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC20DD0: 00A22826 xor $a1, $a1, $v0 */ - cpu->gpr[5] = cpu->gpr[5] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[5] = cpu->gpr[5] ^ cpu->gpr[2]; + PGXP_ALU(0x00A22826u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002DFCu); #endif @@ -243534,7 +244058,8 @@ label_BFC20DD4: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC20DE8: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00002E14u); #endif @@ -243697,7 +244222,8 @@ label_BFC20DFC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC20E1C: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00002E48u); #endif @@ -244044,7 +244570,8 @@ label_BFC20E48: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC20E98: 00641826 xor $v1, $v1, $a0 */ - cpu->gpr[3] = cpu->gpr[3] ^ cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[3] ^ cpu->gpr[4]; + PGXP_ALU(0x00641826u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002EC4u); #endif @@ -244313,7 +244840,8 @@ label_BFC20EE8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC20EF0: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00002F1Cu); #endif @@ -244574,7 +245102,8 @@ label_BFC20F18: psx_cyc_step(cpu, 0x48u); #endif /* 0xBFC20F3C: 2C66000A sltiu $a2, $v1, 10 */ - cpu->gpr[6] = (uint32_t)(cpu->gpr[3] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[6] = (uint32_t)(cpu->gpr[3] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2C66000Au, cpu->gpr[6], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x00002F68u); #endif @@ -244736,7 +245265,8 @@ label_BFC20F70: psx_cyc_step(cpu, 0x11u); #endif /* 0xBFC20F70: 0004202B sltu $a0, $zero, $a0 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0004202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002F9Cu); #endif @@ -244846,7 +245376,8 @@ label_BFC20F70: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC20FA0: 3063000F andi $v1, $v1, 0xF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFu; + PGXP_ALU(0x3063000Fu, cpu->gpr[3], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x00002FCCu); #endif @@ -245682,7 +246213,8 @@ label_BFC2104C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC21064: 30A50008 andi $a1, $a1, 0x8 */ - cpu->gpr[5] = cpu->gpr[5] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x8u; + PGXP_ALU(0x30A50008u, cpu->gpr[5], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x00003090u); #endif @@ -246066,7 +246598,8 @@ label_BFC210C0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC210D0: 3842005A xori $v0, $v0, 0x5A */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x5Au; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x5Au; + PGXP_ALU(0x3842005Au, cpu->gpr[2], _pgx1, 0x005Au); } #ifdef PSX_COSIM cosim_instr(0x000030FCu); #endif @@ -246125,7 +246658,8 @@ label_BFC210C0: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC210E8: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003114u); #endif @@ -246487,7 +247021,8 @@ label_BFC2113C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2114C: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00003178u); #endif @@ -246590,7 +247125,8 @@ label_BFC2113C: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC21178: 00821026 xor $v0, $a0, $v0 */ - cpu->gpr[2] = cpu->gpr[4] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[4] ^ cpu->gpr[2]; + PGXP_ALU(0x00821026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000031A4u); #endif @@ -246923,7 +247459,8 @@ label_BFC211CC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC211DC: 3842005C xori $v0, $v0, 0x5C */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x5Cu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x5Cu; + PGXP_ALU(0x3842005Cu, cpu->gpr[2], _pgx1, 0x005Cu); } #ifdef PSX_COSIM cosim_instr(0x00003208u); #endif @@ -246989,7 +247526,8 @@ label_BFC211CC: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC211F8: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003224u); #endif @@ -247223,7 +247761,8 @@ label_BFC21230: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21238: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00003264u); #endif @@ -247360,7 +247899,8 @@ label_BFC21254: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21264: 30420004 andi $v0, $v0, 0x4 */ - cpu->gpr[2] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30420004u, cpu->gpr[2], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00003290u); #endif @@ -247892,7 +248432,8 @@ label_BFC212E0: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC212F8: 28440004 slti $a0, $v0, 4 */ - cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[2] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[4] = (uint32_t)((int32_t)cpu->gpr[2] < (4) ? 1 : 0); + PGXP_ALU(0x28440004u, cpu->gpr[4], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00003324u); #endif @@ -248383,7 +248924,8 @@ label_BFC2137C: psx_cyc_step(cpu, 0x19u); #endif /* 0xBFC2137C: 0003202B sltu $a0, $zero, $v1 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0003202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000033A8u); #endif @@ -248493,7 +249035,8 @@ label_BFC2137C: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC213AC: 3063000F andi $v1, $v1, 0xF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFu; + PGXP_ALU(0x3063000Fu, cpu->gpr[3], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x000033D8u); #endif @@ -248933,7 +249476,8 @@ label_BFC21450: psx_cyc_step(cpu, 0x30u); #endif /* 0xBFC21450: 3085000C andi $a1, $a0, 0xC */ - cpu->gpr[5] = cpu->gpr[4] & 0xCu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[5] = cpu->gpr[4] & 0xCu; + PGXP_ALU(0x3085000Cu, cpu->gpr[5], _pgx1, 0x000Cu); } #ifdef PSX_COSIM cosim_instr(0x0000347Cu); #endif @@ -249067,7 +249611,8 @@ label_BFC2145C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC21480: 30840004 andi $a0, $a0, 0x4 */ - cpu->gpr[4] = cpu->gpr[4] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x4u; + PGXP_ALU(0x30840004u, cpu->gpr[4], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x000034ACu); #endif @@ -249571,7 +250116,8 @@ label_BFC21504: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC2150C: 30430001 andi $v1, $v0, 0x1 */ - cpu->gpr[3] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30430001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00003538u); #endif @@ -249833,7 +250379,8 @@ label_BFC2153C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21544: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00003570u); #endif @@ -249956,7 +250503,8 @@ label_BFC21558: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21558: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00003584u); #endif @@ -250279,7 +250827,8 @@ label_BFC21588: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC215C4: 00220826 xor $at, $at, $v0 */ - cpu->gpr[1] = cpu->gpr[1] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[1]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = cpu->gpr[1] ^ cpu->gpr[2]; + PGXP_ALU(0x00220826u, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000035F0u); #endif @@ -250361,7 +250910,8 @@ label_BFC21588: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC215E8: 2C420080 sltiu $v0, $v0, 128 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00003614u); #endif @@ -250581,7 +251131,8 @@ label_BFC215FC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC21638: 00220826 xor $at, $at, $v0 */ - cpu->gpr[1] = cpu->gpr[1] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[1]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = cpu->gpr[1] ^ cpu->gpr[2]; + PGXP_ALU(0x00220826u, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003664u); #endif @@ -250663,7 +251214,8 @@ label_BFC215FC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2165C: 2C42007F sltiu $v0, $v0, 127 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2C42007Fu, cpu->gpr[2], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x00003688u); #endif @@ -250947,7 +251499,8 @@ label_BFC216AC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC216B8: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000036E4u); #endif @@ -251008,7 +251561,8 @@ label_BFC216C4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC216CC: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000036F8u); #endif @@ -251084,7 +251638,8 @@ label_BFC216D8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC216E4: 2C420001 sltiu $v0, $v0, 1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00003710u); #endif @@ -251179,7 +251734,8 @@ label_BFC216F0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC216FC: 30420001 andi $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00003728u); #endif @@ -251243,7 +251799,8 @@ label_BFC21708: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21710: 30420001 andi $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x0000373Cu); #endif @@ -252155,7 +252712,8 @@ label_BFC2180C: psx_cyc_step(cpu, 0x15u); #endif /* 0xBFC2181C: 0002202B sltu $a0, $zero, $v0 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[4] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002202Bu, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003848u); #endif @@ -253058,7 +253616,8 @@ label_BFC21924: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC21938: 00641824 and $v1, $v1, $a0 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + PGXP_ALU(0x00641824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003964u); #endif @@ -253428,7 +253987,8 @@ label_BFC21998: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC219AC: 00641824 and $v1, $v1, $a0 */ - cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[3] & cpu->gpr[4]; + PGXP_ALU(0x00641824u, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000039D8u); #endif @@ -253977,7 +254537,8 @@ label_BFC21A20: psx_cyc_step(cpu, 0x800000u); #endif /* 0xBFC21A68: 32F7FFFF andi $s7, $s7, 0xFFFF */ - cpu->gpr[23] = cpu->gpr[23] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[23]; cpu->gpr[23] = cpu->gpr[23] & 0xFFFFu; + PGXP_ALU(0x32F7FFFFu, cpu->gpr[23], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00003A94u); #endif @@ -254126,7 +254687,8 @@ label_BFC21A98: psx_cyc_step(cpu, 0x20001u); #endif /* 0xBFC21AA0: 0011882B sltu $s1, $zero, $s1 */ - cpu->gpr[17] = (uint32_t)(cpu->gpr[0] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[17] = (uint32_t)(cpu->gpr[0] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0011882Bu, cpu->gpr[17], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003ACCu); #endif @@ -254258,7 +254820,8 @@ label_BFC21AC4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21ACC: 30420001 andi $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00003AF8u); #endif @@ -254475,7 +255038,8 @@ label_BFC21B0C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21B14: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00003B40u); #endif @@ -254607,7 +255171,8 @@ label_BFC21B34: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21B3C: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00003B68u); #endif @@ -254811,7 +255376,8 @@ label_BFC21B78: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21B80: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00003BACu); #endif @@ -254888,7 +255454,8 @@ label_BFC21B8C: psx_cyc_step(cpu, 0x10000u); #endif /* 0xBFC21B98: 3210000F andi $s0, $s0, 0xF */ - cpu->gpr[16] = cpu->gpr[16] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[16] = cpu->gpr[16] & 0xFu; + PGXP_ALU(0x3210000Fu, cpu->gpr[16], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x00003BC4u); #endif @@ -254991,7 +255558,8 @@ label_BFC21BAC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21BB4: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00003BE0u); #endif @@ -255249,7 +255817,8 @@ label_BFC21BEC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21BF4: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00003C20u); #endif @@ -255558,7 +256127,8 @@ label_BFC21C20: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC21C24: 30630080 andi $v1, $v1, 0x80 */ - cpu->gpr[3] = cpu->gpr[3] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x80u; + PGXP_ALU(0x30630080u, cpu->gpr[3], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00003C50u); #endif @@ -255774,7 +256344,8 @@ label_BFC21C48: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC21C50: 02221024 and $v0, $s1, $v0 */ - cpu->gpr[2] = cpu->gpr[17] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[17] & cpu->gpr[2]; + PGXP_ALU(0x02221024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003C7Cu); #endif @@ -255951,7 +256522,8 @@ label_BFC21C88: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21C90: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00003CBCu); #endif @@ -256064,7 +256636,8 @@ label_BFC21CAC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21CB4: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00003CE0u); #endif @@ -256192,7 +256765,8 @@ label_BFC21CD4: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC21CDC: 02221024 and $v0, $s1, $v0 */ - cpu->gpr[2] = cpu->gpr[17] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[17] & cpu->gpr[2]; + PGXP_ALU(0x02221024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003D08u); #endif @@ -256343,7 +256917,8 @@ label_BFC21D08: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21D10: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00003D3Cu); #endif @@ -257085,7 +257660,8 @@ label_BFC21DDC: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC21DE4: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003E10u); #endif @@ -257131,7 +257707,8 @@ label_BFC21DE8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21DF0: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00003E1Cu); #endif @@ -257217,7 +257794,8 @@ label_BFC21E00: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC21E08: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00003E34u); #endif @@ -257470,7 +258048,8 @@ label_BFC21E34: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC21E3C: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003E68u); #endif @@ -258412,7 +258991,8 @@ label_BFC21F1C: psx_cyc_step(cpu, 0x60u); #endif /* 0xBFC21F3C: 00A62824 and $a1, $a1, $a2 */ - cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[6]; + PGXP_ALU(0x00A62824u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003F68u); #endif @@ -258943,7 +259523,8 @@ label_BFC21FE0: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC21FE0: 30840001 andi $a0, $a0, 0x1 */ - cpu->gpr[4] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30840001u, cpu->gpr[4], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x0000400Cu); #endif @@ -262472,7 +263053,8 @@ label_BFC22414: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC22414: 38C20041 xori $v0, $a2, 0x41 */ - cpu->gpr[2] = cpu->gpr[6] ^ 0x41u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[6] ^ 0x41u; + PGXP_ALU(0x38C20041u, cpu->gpr[2], _pgx1, 0x0041u); } #ifdef PSX_COSIM cosim_instr(0x00004440u); #endif @@ -262487,7 +263069,8 @@ label_BFC22414: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC2241C: 38C20023 xori $v0, $a2, 0x23 */ - cpu->gpr[2] = cpu->gpr[6] ^ 0x23u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[6] ^ 0x23u; + PGXP_ALU(0x38C20023u, cpu->gpr[2], _pgx1, 0x0023u); } #ifdef PSX_COSIM cosim_instr(0x00004448u); #endif @@ -262575,7 +263158,8 @@ label_BFC22428: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC22430: 3062FFFF andi $v0, $v1, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[3] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[3] & 0xFFFFu; + PGXP_ALU(0x3062FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x0000445Cu); #endif @@ -262744,7 +263328,8 @@ label_BFC22458: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC22464: 2C630011 sltiu $v1, $v1, 17 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = (uint32_t)(cpu->gpr[3] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2C630011u, cpu->gpr[3], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x00004490u); #endif @@ -262792,7 +263377,8 @@ label_BFC22470: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC22470: 00431024 and $v0, $v0, $v1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[3]; + PGXP_ALU(0x00431024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000449Cu); #endif @@ -262848,7 +263434,8 @@ label_BFC2247C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC22484: 2C420011 sltiu $v0, $v0, 17 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2C420011u, cpu->gpr[2], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x000044B0u); #endif @@ -262911,7 +263498,8 @@ label_BFC22490: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC22498: 3042FF7F andi $v0, $v0, 0xFF7F */ - cpu->gpr[2] = cpu->gpr[2] & 0xFF7Fu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFF7Fu; + PGXP_ALU(0x3042FF7Fu, cpu->gpr[2], _pgx1, 0xFF7Fu); } #ifdef PSX_COSIM cosim_instr(0x000044C4u); #endif @@ -263139,7 +263727,8 @@ label_BFC224CC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC224D0: 2C420002 sltiu $v0, $v0, 2 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2C420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x000044FCu); #endif diff --git a/generated/SCPH1001.emitter.sha b/generated/SCPH1001.emitter.sha index 739b11d0..4c35ffe5 100644 --- a/generated/SCPH1001.emitter.sha +++ b/generated/SCPH1001.emitter.sha @@ -1 +1 @@ -3e8f77cfe0b52d865e06c2375cac130df6e7a50dc3516fae30c945c44a9b2341 +6354929d9f6d6ffeb9a410bc1bcf7640366bfbaa3df78cee998bb13fdcfb1002 diff --git a/generated/SCPH1001_full.c b/generated/SCPH1001_full.c index 66a2e689..d6e21052 100644 --- a/generated/SCPH1001_full.c +++ b/generated/SCPH1001_full.c @@ -3644,7 +3644,8 @@ label_BFC003B8: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC003C0: 0043082B sltu $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC003C0u); #endif @@ -5801,7 +5802,8 @@ label_BFC00810: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC0081C: 31CF00FF andi $t7, $t6, 0xFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC0081Cu); #endif @@ -5836,7 +5838,8 @@ label_BFC00810: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC00828: 316C00FF andi $t4, $t3, 0xFF */ - cpu->gpr[12] = cpu->gpr[11] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0xFFu; + PGXP_ALU(0x316C00FFu, cpu->gpr[12], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00828u); #endif @@ -5976,7 +5979,8 @@ label_BFC00810: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC00858: 31F800FF andi $t8, $t7, 0xFF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31F800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00858u); #endif @@ -7743,7 +7747,8 @@ label_BFC00A04: psx_cyc_step(cpu, 0x1000010u); #endif /* 0xBFC00A14: 309800FF andi $t8, $a0, 0xFF */ - cpu->gpr[24] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[24] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x309800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00A14u); #endif @@ -7786,7 +7791,8 @@ label_BFC00A04: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC00A24: 31090008 andi $t1, $t0, 0x8 */ - cpu->gpr[9] = cpu->gpr[8] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x8u; + PGXP_ALU(0x31090008u, cpu->gpr[9], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00A24u); #endif @@ -7941,7 +7947,8 @@ label_BFC00A40: psx_cyc_step(cpu, 0x410u); #endif /* 0xBFC00A48: 308A00FF andi $t2, $a0, 0xFF */ - cpu->gpr[10] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[10] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308A00FFu, cpu->gpr[10], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00A48u); #endif @@ -7984,7 +7991,8 @@ label_BFC00A40: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC00A58: 318D0008 andi $t5, $t4, 0x8 */ - cpu->gpr[13] = cpu->gpr[12] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x8u; + PGXP_ALU(0x318D0008u, cpu->gpr[13], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00A58u); #endif @@ -8191,7 +8199,8 @@ label_BFC00A7C: psx_cyc_step(cpu, 0x4008u); #endif /* 0xBFC00A88: 306E00FF andi $t6, $v1, 0xFF */ - cpu->gpr[14] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[14] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00A88u); #endif @@ -8234,7 +8243,8 @@ label_BFC00A7C: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC00A98: 30580008 andi $t8, $v0, 0x8 */ - cpu->gpr[24] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30580008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00A98u); #endif @@ -8255,7 +8265,8 @@ label_BFC00A7C: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC00AA0: 304A0044 andi $t2, $v0, 0x44 */ - cpu->gpr[10] = cpu->gpr[2] & 0x44u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x44u; + PGXP_ALU(0x304A0044u, cpu->gpr[10], _pgx1, 0x0044u); } #ifdef PSX_COSIM cosim_instr(0xBFC00AA0u); #endif @@ -8400,7 +8411,8 @@ label_BFC00AB4: psx_cyc_step(cpu, 0x2000008u); #endif /* 0xBFC00AC0: 307900FF andi $t9, $v1, 0xFF */ - cpu->gpr[25] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[25] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x307900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00AC0u); #endif @@ -8443,7 +8455,8 @@ label_BFC00AB4: psx_cyc_step(cpu, 0x204u); #endif /* 0xBFC00AD0: 30490008 andi $t1, $v0, 0x8 */ - cpu->gpr[9] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[9] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30490008u, cpu->gpr[9], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00AD0u); #endif @@ -8496,7 +8509,8 @@ label_BFC00ADC: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC00ADC: 304A0044 andi $t2, $v0, 0x44 */ - cpu->gpr[10] = cpu->gpr[2] & 0x44u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x44u; + PGXP_ALU(0x304A0044u, cpu->gpr[10], _pgx1, 0x0044u); } #ifdef PSX_COSIM cosim_instr(0xBFC00ADCu); #endif @@ -8557,7 +8571,8 @@ label_BFC00AE8: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC00AE8: 304B0004 andi $t3, $v0, 0x4 */ - cpu->gpr[11] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x304B0004u, cpu->gpr[11], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC00AE8u); #endif @@ -8820,7 +8835,8 @@ label_BFC00B20: psx_cyc_step(cpu, 0x4008u); #endif /* 0xBFC00B2C: 306E00FF andi $t6, $v1, 0xFF */ - cpu->gpr[14] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[14] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00B2Cu); #endif @@ -8863,7 +8879,8 @@ label_BFC00B20: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC00B3C: 30580044 andi $t8, $v0, 0x44 */ - cpu->gpr[24] = cpu->gpr[2] & 0x44u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x44u; + PGXP_ALU(0x30580044u, cpu->gpr[24], _pgx1, 0x0044u); } #ifdef PSX_COSIM cosim_instr(0xBFC00B3Cu); #endif @@ -8884,7 +8901,8 @@ label_BFC00B20: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC00B44: 304B0004 andi $t3, $v0, 0x4 */ - cpu->gpr[11] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x304B0004u, cpu->gpr[11], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC00B44u); #endif @@ -9563,7 +9581,8 @@ label_BFC00BD8: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC00BE8: 304F00FF andi $t7, $v0, 0xFF */ - cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00BE8u); #endif @@ -9606,7 +9625,8 @@ label_BFC00BD8: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC00BF8: 33280008 andi $t0, $t9, 0x8 */ - cpu->gpr[8] = cpu->gpr[25] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x8u; + PGXP_ALU(0x33280008u, cpu->gpr[8], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00BF8u); #endif @@ -9761,7 +9781,8 @@ label_BFC00C14: psx_cyc_step(cpu, 0x204u); #endif /* 0xBFC00C1C: 304900FF andi $t1, $v0, 0xFF */ - cpu->gpr[9] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[9] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00C1Cu); #endif @@ -9804,7 +9825,8 @@ label_BFC00C14: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC00C2C: 316C0008 andi $t4, $t3, 0x8 */ - cpu->gpr[12] = cpu->gpr[11] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x8u; + PGXP_ALU(0x316C0008u, cpu->gpr[12], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00C2Cu); #endif @@ -9999,7 +10021,8 @@ label_BFC00C50: psx_cyc_step(cpu, 0x2004u); #endif /* 0xBFC00C58: 304D00FF andi $t5, $v0, 0xFF */ - cpu->gpr[13] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[13] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304D00FFu, cpu->gpr[13], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00C58u); #endif @@ -10042,7 +10065,8 @@ label_BFC00C50: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC00C68: 31F80008 andi $t8, $t7, 0x8 */ - cpu->gpr[24] = cpu->gpr[15] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x8u; + PGXP_ALU(0x31F80008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00C68u); #endif @@ -10196,7 +10220,8 @@ label_BFC00C84: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC00C8C: 305900FF andi $t9, $v0, 0xFF */ - cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC00C8Cu); #endif @@ -10239,7 +10264,8 @@ label_BFC00C84: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC00C9C: 312A0008 andi $t2, $t1, 0x8 */ - cpu->gpr[10] = cpu->gpr[9] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x8u; + PGXP_ALU(0x312A0008u, cpu->gpr[10], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00C9Cu); #endif @@ -10463,7 +10489,8 @@ label_BFC00CC0: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC00CD8: 31CF0008 andi $t7, $t6, 0x8 */ - cpu->gpr[15] = cpu->gpr[14] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x8u; + PGXP_ALU(0x31CF0008u, cpu->gpr[15], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00CD8u); #endif @@ -10569,7 +10596,8 @@ label_BFC00CE4: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC00CF8: 31090008 andi $t1, $t0, 0x8 */ - cpu->gpr[9] = cpu->gpr[8] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x8u; + PGXP_ALU(0x31090008u, cpu->gpr[9], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC00CF8u); #endif @@ -13097,7 +13125,8 @@ label_BFC00EF4: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC00F00: 2C610080 sltiu $at, $v1, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C610080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0xBFC00F00u); #endif @@ -13181,7 +13210,8 @@ label_BFC00F10: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC00F10: 2C610080 sltiu $at, $v1, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C610080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0xBFC00F10u); #endif @@ -13274,7 +13304,8 @@ label_BFC00F1C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC00F28: 33190004 andi $t9, $t8, 0x4 */ - cpu->gpr[25] = cpu->gpr[24] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x4u; + PGXP_ALU(0x33190004u, cpu->gpr[25], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC00F28u); #endif @@ -13403,7 +13434,8 @@ label_BFC00F38: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC00F4C: 2C610080 sltiu $at, $v1, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C610080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0xBFC00F4Cu); #endif @@ -13489,7 +13521,8 @@ label_BFC00F58: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC00F64: 33190004 andi $t9, $t8, 0x4 */ - cpu->gpr[25] = cpu->gpr[24] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x4u; + PGXP_ALU(0x33190004u, cpu->gpr[25], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC00F64u); #endif @@ -13828,7 +13861,8 @@ label_BFC00F9C: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC00FB0: 2C610080 sltiu $at, $v1, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C610080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0xBFC00FB0u); #endif @@ -13914,7 +13948,8 @@ label_BFC00FBC: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC00FC8: 33190004 andi $t9, $t8, 0x4 */ - cpu->gpr[25] = cpu->gpr[24] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x4u; + PGXP_ALU(0x33190004u, cpu->gpr[25], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC00FC8u); #endif @@ -14271,7 +14306,8 @@ label_BFC01018: psx_cyc_step(cpu, 0x28000u); #endif /* 0xBFC01018: 322F0001 andi $t7, $s1, 0x1 */ - cpu->gpr[15] = cpu->gpr[17] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[15] = cpu->gpr[17] & 0x1u; + PGXP_ALU(0x322F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC01018u); #endif @@ -14389,7 +14425,8 @@ label_BFC01034: psx_cyc_step(cpu, 0x1020000u); #endif /* 0xBFC01034: 32380004 andi $t8, $s1, 0x4 */ - cpu->gpr[24] = cpu->gpr[17] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[24] = cpu->gpr[17] & 0x4u; + PGXP_ALU(0x32380004u, cpu->gpr[24], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC01034u); #endif @@ -14638,7 +14675,8 @@ label_BFC0106C: psx_cyc_step(cpu, 0x2020000u); #endif /* 0xBFC0106C: 32390001 andi $t9, $s1, 0x1 */ - cpu->gpr[25] = cpu->gpr[17] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[25] = cpu->gpr[17] & 0x1u; + PGXP_ALU(0x32390001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC0106Cu); #endif @@ -14659,7 +14697,8 @@ label_BFC0106C: psx_cyc_step(cpu, 0x1020000u); #endif /* 0xBFC01074: 32380004 andi $t8, $s1, 0x4 */ - cpu->gpr[24] = cpu->gpr[17] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[24] = cpu->gpr[17] & 0x4u; + PGXP_ALU(0x32380004u, cpu->gpr[24], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC01074u); #endif @@ -14764,7 +14803,8 @@ label_BFC0108C: psx_cyc_step(cpu, 0x1020000u); #endif /* 0xBFC0108C: 32380004 andi $t8, $s1, 0x4 */ - cpu->gpr[24] = cpu->gpr[17] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[24] = cpu->gpr[17] & 0x4u; + PGXP_ALU(0x32380004u, cpu->gpr[24], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC0108Cu); #endif @@ -14987,7 +15027,8 @@ label_BFC010C0: psx_cyc_step(cpu, 0x2020000u); #endif /* 0xBFC010C4: 32390001 andi $t9, $s1, 0x1 */ - cpu->gpr[25] = cpu->gpr[17] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[25] = cpu->gpr[17] & 0x1u; + PGXP_ALU(0x32390001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC010C4u); #endif @@ -15124,7 +15165,8 @@ label_BFC010E4: psx_cyc_step(cpu, 0x24000u); #endif /* 0xBFC010E4: 322E0004 andi $t6, $s1, 0x4 */ - cpu->gpr[14] = cpu->gpr[17] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[14] = cpu->gpr[17] & 0x4u; + PGXP_ALU(0x322E0004u, cpu->gpr[14], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC010E4u); #endif @@ -15734,7 +15776,8 @@ label_BFC0117C: psx_cyc_step(cpu, 0x4Au); #endif /* 0xBFC01180: 00C3082A slt $at, $a2, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x00C3082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01180u); #endif @@ -16069,7 +16112,8 @@ label_BFC011D0: psx_cyc_step(cpu, 0x28000u); #endif /* 0xBFC011D0: 322F0001 andi $t7, $s1, 0x1 */ - cpu->gpr[15] = cpu->gpr[17] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[15] = cpu->gpr[17] & 0x1u; + PGXP_ALU(0x322F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC011D0u); #endif @@ -16199,7 +16243,8 @@ label_BFC011F0: psx_cyc_step(cpu, 0x1020000u); #endif /* 0xBFC011F0: 32380004 andi $t8, $s1, 0x4 */ - cpu->gpr[24] = cpu->gpr[17] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[24] = cpu->gpr[17] & 0x4u; + PGXP_ALU(0x32380004u, cpu->gpr[24], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC011F0u); #endif @@ -16411,7 +16456,8 @@ label_BFC01218: psx_cyc_step(cpu, 0x24000u); #endif /* 0xBFC01224: 322E0001 andi $t6, $s1, 0x1 */ - cpu->gpr[14] = cpu->gpr[17] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[14] = cpu->gpr[17] & 0x1u; + PGXP_ALU(0x322E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC01224u); #endif @@ -16548,7 +16594,8 @@ label_BFC01244: psx_cyc_step(cpu, 0x28000u); #endif /* 0xBFC01244: 322F0004 andi $t7, $s1, 0x4 */ - cpu->gpr[15] = cpu->gpr[17] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[15] = cpu->gpr[17] & 0x4u; + PGXP_ALU(0x322F0004u, cpu->gpr[15], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC01244u); #endif @@ -16700,7 +16747,8 @@ label_BFC01268: psx_cyc_step(cpu, 0x1020000u); #endif /* 0xBFC01268: 32380008 andi $t8, $s1, 0x8 */ - cpu->gpr[24] = cpu->gpr[17] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[24] = cpu->gpr[17] & 0x8u; + PGXP_ALU(0x32380008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC01268u); #endif @@ -16869,7 +16917,8 @@ label_BFC01288: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC0128C: 02218824 and $s1, $s1, $at */ - cpu->gpr[17] = cpu->gpr[17] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[17] = cpu->gpr[17] & cpu->gpr[1]; + PGXP_ALU(0x02218824u, cpu->gpr[17], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0128Cu); #endif @@ -16981,7 +17030,8 @@ label_BFC012A0: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC012A4: 32220008 andi $v0, $s1, 0x8 */ - cpu->gpr[2] = cpu->gpr[17] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[2] = cpu->gpr[17] & 0x8u; + PGXP_ALU(0x32220008u, cpu->gpr[2], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC012A4u); #endif @@ -17576,7 +17626,8 @@ label_BFC01338: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC01338: 32220040 andi $v0, $s1, 0x40 */ - cpu->gpr[2] = cpu->gpr[17] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[2] = cpu->gpr[17] & 0x40u; + PGXP_ALU(0x32220040u, cpu->gpr[2], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0xBFC01338u); #endif @@ -17710,7 +17761,8 @@ label_BFC01354: psx_cyc_step(cpu, 0x3000002u); #endif /* 0xBFC01360: 0338082A slt $at, $t9, $t8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x0338082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01360u); #endif @@ -17850,7 +17902,8 @@ label_BFC01380: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC01380: 32220030 andi $v0, $s1, 0x30 */ - cpu->gpr[2] = cpu->gpr[17] & 0x30u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[2] = cpu->gpr[17] & 0x30u; + PGXP_ALU(0x32220030u, cpu->gpr[2], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0xBFC01380u); #endif @@ -17966,7 +18019,8 @@ label_BFC01394: psx_cyc_step(cpu, 0x200006u); #endif /* 0xBFC0139C: 0055082A slt $at, $v0, $s5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0055082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0139Cu); #endif @@ -18069,7 +18123,8 @@ label_BFC013B0: psx_cyc_step(cpu, 0x210002u); #endif /* 0xBFC013B4: 0215082A slt $at, $s0, $s5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0215082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC013B4u); #endif @@ -18798,7 +18853,8 @@ label_BFC0147C: psx_cyc_step(cpu, 0x200006u); #endif /* 0xBFC01484: 0055082A slt $at, $v0, $s5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0055082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01484u); #endif @@ -18901,7 +18957,8 @@ label_BFC01498: psx_cyc_step(cpu, 0x210002u); #endif /* 0xBFC0149C: 0215082A slt $at, $s0, $s5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0215082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0149Cu); #endif @@ -19076,7 +19133,8 @@ label_BFC014C8: psx_cyc_step(cpu, 0x1004002u); #endif /* 0xBFC014D0: 030E082A slt $at, $t8, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x030E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC014D0u); #endif @@ -19185,7 +19243,8 @@ label_BFC014E4: psx_cyc_step(cpu, 0x18002u); #endif /* 0xBFC014EC: 020F082A slt $at, $s0, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x020F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC014ECu); #endif @@ -19600,7 +19659,8 @@ label_BFC01558: psx_cyc_step(cpu, 0x1020000u); #endif /* 0xBFC01560: 32380010 andi $t8, $s1, 0x10 */ - cpu->gpr[24] = cpu->gpr[17] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[24] = cpu->gpr[17] & 0x10u; + PGXP_ALU(0x32380010u, cpu->gpr[24], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC01560u); #endif @@ -19808,7 +19868,8 @@ label_BFC01594: psx_cyc_step(cpu, 0x1020000u); #endif /* 0xBFC01594: 32380010 andi $t8, $s1, 0x10 */ - cpu->gpr[24] = cpu->gpr[17] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[24] = cpu->gpr[17] & 0x10u; + PGXP_ALU(0x32380010u, cpu->gpr[24], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC01594u); #endif @@ -19886,7 +19947,8 @@ label_BFC015A0: psx_cyc_step(cpu, 0x204002u); #endif /* 0xBFC015A8: 01D5082A slt $at, $t6, $s5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x01D5082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC015A8u); #endif @@ -19989,7 +20051,8 @@ label_BFC015BC: psx_cyc_step(cpu, 0x210002u); #endif /* 0xBFC015C0: 0215082A slt $at, $s0, $s5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0215082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC015C0u); #endif @@ -20154,7 +20217,8 @@ label_BFC015EC: psx_cyc_step(cpu, 0x208002u); #endif /* 0xBFC015F0: 01F5082A slt $at, $t7, $s5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x01F5082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC015F0u); #endif @@ -20495,7 +20559,8 @@ label_BFC0164C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC01650: 2C410045 sltiu $at, $v0, 69 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000045u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000045u ? 1 : 0); + PGXP_ALU(0x2C410045u, cpu->gpr[1], _pgx1, 0x0045u); } #ifdef PSX_COSIM cosim_instr(0xBFC01650u); #endif @@ -20580,7 +20645,8 @@ label_BFC0165C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC01660: 2C410033 sltiu $at, $v0, 51 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000033u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000033u ? 1 : 0); + PGXP_ALU(0x2C410033u, cpu->gpr[1], _pgx1, 0x0033u); } #ifdef PSX_COSIM cosim_instr(0xBFC01660u); #endif @@ -20665,7 +20731,8 @@ label_BFC0166C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC01670: 2C41002E sltiu $at, $v0, 46 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000002Eu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000002Eu ? 1 : 0); + PGXP_ALU(0x2C41002Eu, cpu->gpr[1], _pgx1, 0x002Eu); } #ifdef PSX_COSIM cosim_instr(0xBFC01670u); #endif @@ -20749,7 +20816,8 @@ label_BFC0167C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC01680: 2C41002B sltiu $at, $v0, 43 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000002Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000002Bu ? 1 : 0); + PGXP_ALU(0x2C41002Bu, cpu->gpr[1], _pgx1, 0x002Bu); } #ifdef PSX_COSIM cosim_instr(0xBFC01680u); #endif @@ -20833,7 +20901,8 @@ label_BFC0168C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC01690: 2C410021 sltiu $at, $v0, 33 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000021u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000021u ? 1 : 0); + PGXP_ALU(0x2C410021u, cpu->gpr[1], _pgx1, 0x0021u); } #ifdef PSX_COSIM cosim_instr(0xBFC01690u); #endif @@ -21343,7 +21412,8 @@ label_BFC01700: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC01704: 2C410031 sltiu $at, $v0, 49 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000031u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000031u ? 1 : 0); + PGXP_ALU(0x2C410031u, cpu->gpr[1], _pgx1, 0x0031u); } #ifdef PSX_COSIM cosim_instr(0xBFC01704u); #endif @@ -21630,7 +21700,8 @@ label_BFC01738: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC0173C: 2C410037 sltiu $at, $v0, 55 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000037u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000037u ? 1 : 0); + PGXP_ALU(0x2C410037u, cpu->gpr[1], _pgx1, 0x0037u); } #ifdef PSX_COSIM cosim_instr(0xBFC0173Cu); #endif @@ -21715,7 +21786,8 @@ label_BFC01748: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC0174C: 2C410035 sltiu $at, $v0, 53 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000035u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000035u ? 1 : 0); + PGXP_ALU(0x2C410035u, cpu->gpr[1], _pgx1, 0x0035u); } #ifdef PSX_COSIM cosim_instr(0xBFC0174Cu); #endif @@ -21996,7 +22068,8 @@ label_BFC0177C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC01784: 2C410039 sltiu $at, $v0, 57 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000039u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000039u ? 1 : 0); + PGXP_ALU(0x2C410039u, cpu->gpr[1], _pgx1, 0x0039u); } #ifdef PSX_COSIM cosim_instr(0xBFC01784u); #endif @@ -22284,7 +22357,8 @@ label_BFC017B8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC017BC: 2C41006A sltiu $at, $v0, 106 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000006Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000006Au ? 1 : 0); + PGXP_ALU(0x2C41006Au, cpu->gpr[1], _pgx1, 0x006Au); } #ifdef PSX_COSIM cosim_instr(0xBFC017BCu); #endif @@ -22369,7 +22443,8 @@ label_BFC017C8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC017CC: 2C410059 sltiu $at, $v0, 89 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000059u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000059u ? 1 : 0); + PGXP_ALU(0x2C410059u, cpu->gpr[1], _pgx1, 0x0059u); } #ifdef PSX_COSIM cosim_instr(0xBFC017CCu); #endif @@ -22454,7 +22529,8 @@ label_BFC017D8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC017DC: 2C410050 sltiu $at, $v0, 80 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000050u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000050u ? 1 : 0); + PGXP_ALU(0x2C410050u, cpu->gpr[1], _pgx1, 0x0050u); } #ifdef PSX_COSIM cosim_instr(0xBFC017DCu); #endif @@ -22734,7 +22810,8 @@ label_BFC0180C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC01814: 2C410065 sltiu $at, $v0, 101 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000065u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000065u ? 1 : 0); + PGXP_ALU(0x2C410065u, cpu->gpr[1], _pgx1, 0x0065u); } #ifdef PSX_COSIM cosim_instr(0xBFC01814u); #endif @@ -23013,7 +23090,8 @@ label_BFC01844: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC0184C: 2C410071 sltiu $at, $v0, 113 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000071u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000071u ? 1 : 0); + PGXP_ALU(0x2C410071u, cpu->gpr[1], _pgx1, 0x0071u); } #ifdef PSX_COSIM cosim_instr(0xBFC0184Cu); #endif @@ -23098,7 +23176,8 @@ label_BFC01858: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC0185C: 2C41006F sltiu $at, $v0, 111 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000006Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000006Fu ? 1 : 0); + PGXP_ALU(0x2C41006Fu, cpu->gpr[1], _pgx1, 0x006Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0185Cu); #endif @@ -23280,7 +23359,8 @@ label_BFC01878: psx_cyc_step(cpu, 0x2020000u); #endif /* 0xBFC01880: 32390001 andi $t9, $s1, 0x1 */ - cpu->gpr[25] = cpu->gpr[17] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[25] = cpu->gpr[17] & 0x1u; + PGXP_ALU(0x32390001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC01880u); #endif @@ -23377,7 +23457,8 @@ label_BFC0188C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC01894: 2C410076 sltiu $at, $v0, 118 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000076u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000076u ? 1 : 0); + PGXP_ALU(0x2C410076u, cpu->gpr[1], _pgx1, 0x0076u); } #ifdef PSX_COSIM cosim_instr(0xBFC01894u); #endif @@ -23559,7 +23640,8 @@ label_BFC018B0: psx_cyc_step(cpu, 0x24000u); #endif /* 0xBFC018B8: 322E0001 andi $t6, $s1, 0x1 */ - cpu->gpr[14] = cpu->gpr[17] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[14] = cpu->gpr[17] & 0x1u; + PGXP_ALU(0x322E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC018B8u); #endif @@ -25067,7 +25149,8 @@ label_BFC01A60: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC01A68: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC01A68u); #endif @@ -26405,7 +26488,8 @@ label_BFC01B88: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC01B94: 0044082B sltu $at, $v0, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01B94u); #endif @@ -26653,7 +26737,8 @@ label_BFC01BB4: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC01BD8: 0043082B sltu $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01BD8u); #endif @@ -26674,7 +26759,8 @@ label_BFC01BB4: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC01BE0: 0045082B sltu $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01BE0u); #endif @@ -26749,7 +26835,8 @@ label_BFC01BEC: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC01BEC: 0045082B sltu $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01BECu); #endif @@ -26940,7 +27027,8 @@ label_BFC01C08: psx_cyc_step(cpu, 0x8012u); #endif /* 0xBFC01C1C: 008F082B sltu $at, $a0, $t7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x008F082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01C1Cu); #endif @@ -27500,7 +27588,8 @@ label_BFC01C8C: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC01CA8: 00A12824 and $a1, $a1, $at */ - cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[5] = cpu->gpr[5] & cpu->gpr[1]; + PGXP_ALU(0x00A12824u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01CA8u); #endif @@ -27600,7 +27689,8 @@ label_BFC01CB4: psx_cyc_step(cpu, 0x540u); #endif /* 0xBFC01CC0: 00CA4024 and $t0, $a2, $t2 */ - cpu->gpr[8] = cpu->gpr[6] & cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[8] = cpu->gpr[6] & cpu->gpr[10]; + PGXP_ALU(0x00CA4024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01CC0u); #endif @@ -27611,7 +27701,8 @@ label_BFC01CB4: psx_cyc_step(cpu, 0x122u); #endif /* 0xBFC01CC4: 0105082B sltu $at, $t0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0105082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01CC4u); #endif @@ -27825,7 +27916,8 @@ label_BFC01D00: psx_cyc_step(cpu, 0x2000080u); #endif /* 0xBFC01D00: 30F90001 andi $t9, $a3, 0x1 */ - cpu->gpr[25] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[25] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30F90001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC01D00u); #endif @@ -27909,7 +28001,8 @@ label_BFC01D0C: psx_cyc_step(cpu, 0x142u); #endif /* 0xBFC01D18: 00C14024 and $t0, $a2, $at */ - cpu->gpr[8] = cpu->gpr[6] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[6] & cpu->gpr[1]; + PGXP_ALU(0x00C14024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01D18u); #endif @@ -28031,7 +28124,8 @@ label_BFC01D24: psx_cyc_step(cpu, 0x2102u); #endif /* 0xBFC01D34: 01A8082B sltu $at, $t5, $t0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x01A8082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01D34u); #endif @@ -28116,7 +28210,8 @@ label_BFC01D40: psx_cyc_step(cpu, 0x142u); #endif /* 0xBFC01D4C: 00C14024 and $t0, $a2, $at */ - cpu->gpr[8] = cpu->gpr[6] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[6] & cpu->gpr[1]; + PGXP_ALU(0x00C14024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01D4Cu); #endif @@ -28263,7 +28358,8 @@ label_BFC01D70: psx_cyc_step(cpu, 0x1480u); #endif /* 0xBFC01D74: 00EA6024 and $t4, $a3, $t2 */ - cpu->gpr[12] = cpu->gpr[7] & cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[12] = cpu->gpr[7] & cpu->gpr[10]; + PGXP_ALU(0x00EA6024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01D74u); #endif @@ -28318,7 +28414,8 @@ label_BFC01D70: psx_cyc_step(cpu, 0x4480u); #endif /* 0xBFC01D88: 00EA7024 and $t6, $a3, $t2 */ - cpu->gpr[14] = cpu->gpr[7] & cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[14] = cpu->gpr[7] & cpu->gpr[10]; + PGXP_ALU(0x00EA7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01D88u); #endif @@ -28341,7 +28438,8 @@ label_BFC01D70: psx_cyc_step(cpu, 0x62u); #endif /* 0xBFC01D90: 00C5082B sltu $at, $a2, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x00C5082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01D90u); #endif @@ -28416,7 +28514,8 @@ label_BFC01D9C: psx_cyc_step(cpu, 0x142u); #endif /* 0xBFC01DA4: 00C14024 and $t0, $a2, $at */ - cpu->gpr[8] = cpu->gpr[6] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[6] & cpu->gpr[1]; + PGXP_ALU(0x00C14024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01DA4u); #endif @@ -28453,7 +28552,8 @@ label_BFC01DAC: psx_cyc_step(cpu, 0x8042u); #endif /* 0xBFC01DAC: 00C17824 and $t7, $a2, $at */ - cpu->gpr[15] = cpu->gpr[6] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[6] & cpu->gpr[1]; + PGXP_ALU(0x00C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01DACu); #endif @@ -28464,7 +28564,8 @@ label_BFC01DAC: psx_cyc_step(cpu, 0x8022u); #endif /* 0xBFC01DB0: 00AF082B sltu $at, $a1, $t7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x00AF082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01DB0u); #endif @@ -28485,7 +28586,8 @@ label_BFC01DAC: psx_cyc_step(cpu, 0x122u); #endif /* 0xBFC01DB8: 0105082B sltu $at, $t0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0105082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01DB8u); #endif @@ -28715,7 +28817,8 @@ label_BFC01DC8: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC01DF8: 31F80001 andi $t8, $t7, 0x1 */ - cpu->gpr[24] = cpu->gpr[15] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x1u; + PGXP_ALU(0x31F80001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC01DF8u); #endif @@ -28781,7 +28884,8 @@ label_BFC01E08: psx_cyc_step(cpu, 0x122u); #endif /* 0xBFC01E08: 0105082B sltu $at, $t0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0105082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01E08u); #endif @@ -29378,7 +29482,8 @@ label_BFC01E5C: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC01E94: 02218824 and $s1, $s1, $at */ - cpu->gpr[17] = cpu->gpr[17] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[17] = cpu->gpr[17] & cpu->gpr[1]; + PGXP_ALU(0x02218824u, cpu->gpr[17], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01E94u); #endif @@ -29506,7 +29611,8 @@ label_BFC01EA0: psx_cyc_step(cpu, 0x8006u); #endif /* 0xBFC01EB4: 004F082B sltu $at, $v0, $t7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x004F082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01EB4u); #endif @@ -29956,7 +30062,8 @@ label_BFC01F18: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC01F2C: 30830001 andi $v1, $a0, 0x1 */ - cpu->gpr[3] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30830001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC01F2Cu); #endif @@ -30038,7 +30145,8 @@ label_BFC01F38: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC01F40: 0044082B sltu $at, $v0, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01F40u); #endif @@ -30091,7 +30199,8 @@ label_BFC01F44: psx_cyc_step(cpu, 0x40210u); #endif /* 0xBFC01F4C: 00924824 and $t1, $a0, $s2 */ - cpu->gpr[9] = cpu->gpr[4] & cpu->gpr[18]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[9] = cpu->gpr[4] & cpu->gpr[18]; + PGXP_ALU(0x00924824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01F4Cu); #endif @@ -30145,7 +30254,8 @@ label_BFC01F58: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC01F58: 0044082B sltu $at, $v0, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01F58u); #endif @@ -30173,7 +30283,8 @@ label_BFC01F5C: psx_cyc_step(cpu, 0x20012u); #endif /* 0xBFC01F60: 0091082B sltu $at, $a0, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0091082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01F60u); #endif @@ -30424,7 +30535,8 @@ label_BFC01FA0: psx_cyc_step(cpu, 0x20012u); #endif /* 0xBFC01FA0: 0091082B sltu $at, $a0, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0091082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC01FA0u); #endif @@ -30572,7 +30684,8 @@ label_BFC01FAC: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC01FCC: 304E0001 andi $t6, $v0, 0x1 */ - cpu->gpr[14] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC01FCCu); #endif @@ -30856,7 +30969,8 @@ label_BFC02008: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC02008: 304E0001 andi $t6, $v0, 0x1 */ - cpu->gpr[14] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC02008u); #endif @@ -30916,7 +31030,8 @@ label_BFC02014: psx_cyc_step(cpu, 0x42004u); #endif /* 0xBFC02014: 00526824 and $t5, $v0, $s2 */ - cpu->gpr[13] = cpu->gpr[2] & cpu->gpr[18]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[13] = cpu->gpr[2] & cpu->gpr[18]; + PGXP_ALU(0x00526824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02014u); #endif @@ -31097,7 +31212,8 @@ label_BFC02038: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC0204C: 30830001 andi $v1, $a0, 0x1 */ - cpu->gpr[3] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30830001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC0204Cu); #endif @@ -31575,7 +31691,8 @@ label_BFC020B0: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC020C4: 30830001 andi $v1, $a0, 0x1 */ - cpu->gpr[3] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30830001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC020C4u); #endif @@ -33017,7 +33134,8 @@ label_BFC02200: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC02224: 30427FFF andi $v0, $v0, 0x7FFF */ - cpu->gpr[2] = cpu->gpr[2] & 0x7FFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x7FFFu; + PGXP_ALU(0x30427FFFu, cpu->gpr[2], _pgx1, 0x7FFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC02224u); #endif @@ -33537,7 +33655,8 @@ label_BFC022C0: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC022C8: 308E00FF andi $t6, $a0, 0xFF */ - cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC022C8u); #endif @@ -33593,7 +33712,8 @@ label_BFC022C0: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC022DC: 304F0004 andi $t7, $v0, 0x4 */ - cpu->gpr[15] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x304F0004u, cpu->gpr[15], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC022DCu); #endif @@ -33690,7 +33810,8 @@ label_BFC022F0: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC022F0: 30580003 andi $t8, $v0, 0x3 */ - cpu->gpr[24] = cpu->gpr[2] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x3u; + PGXP_ALU(0x30580003u, cpu->gpr[24], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0xBFC022F0u); #endif @@ -34356,7 +34477,8 @@ label_BFC025E0: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC025F0: 308E00FF andi $t6, $a0, 0xFF */ - cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC025F0u); #endif @@ -34399,7 +34521,8 @@ label_BFC025E0: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC02600: 33190008 andi $t9, $t8, 0x8 */ - cpu->gpr[25] = cpu->gpr[24] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x8u; + PGXP_ALU(0x33190008u, cpu->gpr[25], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC02600u); #endif @@ -34420,7 +34543,8 @@ label_BFC025E0: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC02608: 2A610002 slti $at, $s3, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (2) ? 1 : 0); + PGXP_ALU(0x2A610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC02608u); #endif @@ -34473,7 +34597,8 @@ label_BFC0260C: psx_cyc_step(cpu, 0x110u); #endif /* 0xBFC02614: 308800FF andi $t0, $a0, 0xFF */ - cpu->gpr[8] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[8] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308800FFu, cpu->gpr[8], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC02614u); #endif @@ -34516,7 +34641,8 @@ label_BFC0260C: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC02624: 314B0008 andi $t3, $t2, 0x8 */ - cpu->gpr[11] = cpu->gpr[10] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x8u; + PGXP_ALU(0x314B0008u, cpu->gpr[11], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC02624u); #endif @@ -34537,7 +34663,8 @@ label_BFC0260C: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC0262C: 2A610002 slti $at, $s3, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (2) ? 1 : 0); + PGXP_ALU(0x2A610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC0262Cu); #endif @@ -34579,7 +34706,8 @@ label_BFC02630: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC02634: 2A610025 slti $at, $s3, 37 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (37) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (37) ? 1 : 0); + PGXP_ALU(0x2A610025u, cpu->gpr[1], _pgx1, 0x0025u); } #ifdef PSX_COSIM cosim_instr(0xBFC02634u); #endif @@ -35317,7 +35445,8 @@ label_BFC026D8: psx_cyc_step(cpu, 0x80006u); #endif /* 0xBFC026D8: 0053082B sltu $at, $v0, $s3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0053082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC026D8u); #endif @@ -35470,7 +35599,8 @@ label_BFC02700: psx_cyc_step(cpu, 0x80006u); #endif /* 0xBFC02700: 0053082B sltu $at, $v0, $s3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0053082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02700u); #endif @@ -35996,7 +36126,8 @@ label_BFC02770: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC02780: 308E00FF andi $t6, $a0, 0xFF */ - cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC02780u); #endif @@ -36039,7 +36170,8 @@ label_BFC02770: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC02790: 33190008 andi $t9, $t8, 0x8 */ - cpu->gpr[25] = cpu->gpr[24] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x8u; + PGXP_ALU(0x33190008u, cpu->gpr[25], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC02790u); #endif @@ -36113,7 +36245,8 @@ label_BFC0279C: psx_cyc_step(cpu, 0x110u); #endif /* 0xBFC027A4: 308800FF andi $t0, $a0, 0xFF */ - cpu->gpr[8] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[8] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308800FFu, cpu->gpr[8], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC027A4u); #endif @@ -36156,7 +36289,8 @@ label_BFC0279C: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC027B4: 314B0008 andi $t3, $t2, 0x8 */ - cpu->gpr[11] = cpu->gpr[10] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x8u; + PGXP_ALU(0x314B0008u, cpu->gpr[11], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC027B4u); #endif @@ -36231,7 +36365,8 @@ label_BFC027C0: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC027C8: 2E610002 sltiu $at, $s3, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2E610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC027C8u); #endif @@ -36327,7 +36462,8 @@ label_BFC027DC: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC027DC: 2E610002 sltiu $at, $s3, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2E610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC027DCu); #endif @@ -36355,7 +36491,8 @@ label_BFC027E0: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC027E4: 2E610025 sltiu $at, $s3, 37 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < 0x00000025u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < 0x00000025u ? 1 : 0); + PGXP_ALU(0x2E610025u, cpu->gpr[1], _pgx1, 0x0025u); } #ifdef PSX_COSIM cosim_instr(0xBFC027E4u); #endif @@ -37093,7 +37230,8 @@ label_BFC02888: psx_cyc_step(cpu, 0x80006u); #endif /* 0xBFC02888: 0053082B sltu $at, $v0, $s3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0053082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02888u); #endif @@ -37369,7 +37507,8 @@ label_BFC028CC: psx_cyc_step(cpu, 0x80006u); #endif /* 0xBFC028D0: 0053082B sltu $at, $v0, $s3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0053082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC028D0u); #endif @@ -38245,7 +38384,8 @@ label_BFC02984: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC02994: 308E00FF andi $t6, $a0, 0xFF */ - cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC02994u); #endif @@ -38288,7 +38428,8 @@ label_BFC02984: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC029A4: 33190008 andi $t9, $t8, 0x8 */ - cpu->gpr[25] = cpu->gpr[24] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x8u; + PGXP_ALU(0x33190008u, cpu->gpr[25], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC029A4u); #endif @@ -38362,7 +38503,8 @@ label_BFC029B0: psx_cyc_step(cpu, 0x110u); #endif /* 0xBFC029B8: 308800FF andi $t0, $a0, 0xFF */ - cpu->gpr[8] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[8] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308800FFu, cpu->gpr[8], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC029B8u); #endif @@ -38405,7 +38547,8 @@ label_BFC029B0: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC029C8: 314B0008 andi $t3, $t2, 0x8 */ - cpu->gpr[11] = cpu->gpr[10] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x8u; + PGXP_ALU(0x314B0008u, cpu->gpr[11], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC029C8u); #endif @@ -39069,7 +39212,8 @@ label_BFC02A5C: psx_cyc_step(cpu, 0x200006u); #endif /* 0xBFC02A5C: 0055082B sltu $at, $v0, $s5 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0055082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02A5Cu); #endif @@ -39360,7 +39504,8 @@ label_BFC02AA8: psx_cyc_step(cpu, 0x200006u); #endif /* 0xBFC02AA8: 0055082B sltu $at, $v0, $s5 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0055082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02AA8u); #endif @@ -40240,7 +40385,8 @@ label_BFC02B8C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC02B90: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC02B90u); #endif @@ -40558,7 +40704,8 @@ label_BFC02BC8: psx_cyc_step(cpu, 0x32u); #endif /* 0xBFC02BCC: 00A4082B sltu $at, $a1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x00A4082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02BCCu); #endif @@ -40679,7 +40826,8 @@ label_BFC02BE4: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC02BE8: 0082082B sltu $at, $a0, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0082082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02BE8u); #endif @@ -41668,7 +41816,8 @@ label_BFC02CC0: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC02CC4: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC02CC4u); #endif @@ -43178,7 +43327,8 @@ label_BFC02E3C: psx_cyc_step(cpu, 0x60002u); #endif /* 0xBFC02E3C: 0232082A slt $at, $s1, $s2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0232082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02E3Cu); #endif @@ -43579,7 +43729,8 @@ label_BFC02EA0: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC02EA8: 308200FF andi $v0, $a0, 0xFF */ - cpu->gpr[2] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC02EA8u); #endif @@ -43634,7 +43785,8 @@ label_BFC02EA0: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC02EBC: 31CF0002 andi $t7, $t6, 0x2 */ - cpu->gpr[15] = cpu->gpr[14] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x2u; + PGXP_ALU(0x31CF0002u, cpu->gpr[15], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC02EBCu); #endif @@ -43809,7 +43961,8 @@ label_BFC02EDC: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC02EE4: 308200FF andi $v0, $a0, 0xFF */ - cpu->gpr[2] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC02EE4u); #endif @@ -43864,7 +44017,8 @@ label_BFC02EDC: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC02EF8: 31CF0001 andi $t7, $t6, 0x1 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31CF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC02EF8u); #endif @@ -44233,7 +44387,8 @@ label_BFC02F58: psx_cyc_step(cpu, 0xA00002u); #endif /* 0xBFC02F58: 02F5082A slt $at, $s7, $s5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[23] < (int32_t)cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[23]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[23] < (int32_t)cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x02F5082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02F58u); #endif @@ -44419,7 +44574,8 @@ label_BFC02F84: psx_cyc_step(cpu, 0xA00002u); #endif /* 0xBFC02F84: 02B7082A slt $at, $s5, $s7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[21] < (int32_t)cpu->gpr[23] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[21]; uint32_t _pgx2 = cpu->gpr[23]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[21] < (int32_t)cpu->gpr[23] ? 1 : 0); + PGXP_ALU(0x02B7082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02F84u); #endif @@ -44701,7 +44857,8 @@ label_BFC02FD0: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC02FD4: 0230082A slt $at, $s1, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0230082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02FD4u); #endif @@ -44787,7 +44944,8 @@ label_BFC02FE0: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC02FE4: 0230082A slt $at, $s1, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0230082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02FE4u); #endif @@ -44808,7 +44966,8 @@ label_BFC02FE0: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC02FEC: 0230082A slt $at, $s1, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0230082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC02FECu); #endif @@ -44973,7 +45132,8 @@ label_BFC03014: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC03018: 0230082A slt $at, $s1, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0230082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03018u); #endif @@ -45015,7 +45175,8 @@ label_BFC0301C: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC03020: 0230082A slt $at, $s1, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0230082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03020u); #endif @@ -45108,7 +45269,8 @@ label_BFC03034: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC03034: 0230082A slt $at, $s1, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0230082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03034u); #endif @@ -49556,7 +49718,8 @@ label_BFC03450: psx_cyc_step(cpu, 0x46u); #endif /* 0xBFC03454: 0046082A slt $at, $v0, $a2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x0046082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03454u); #endif @@ -49621,7 +49784,8 @@ label_BFC03460: psx_cyc_step(cpu, 0x46u); #endif /* 0xBFC03464: 0046082A slt $at, $v0, $a2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x0046082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03464u); #endif @@ -50795,7 +50959,8 @@ label_BFC03564: psx_cyc_step(cpu, 0x1Cu); #endif /* 0xBFC03564: 0044182B sltu $v1, $v0, $a0 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03564u); #endif @@ -51581,7 +51746,8 @@ label_BFC03610: psx_cyc_step(cpu, 0x1Cu); #endif /* 0xBFC03610: 0044182B sltu $v1, $v0, $a0 */ - cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[3] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044182Bu, cpu->gpr[3], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03610u); #endif @@ -55004,7 +55170,8 @@ label_BFC03910: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC03924: 31CF0001 andi $t7, $t6, 0x1 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31CF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC03924u); #endif @@ -55078,7 +55245,8 @@ label_BFC03930: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC03938: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC03938u); #endif @@ -58575,7 +58743,8 @@ label_BFC03CAC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC03CAC: 28410800 slti $at, $v0, 2048 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (2048) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (2048) ? 1 : 0); + PGXP_ALU(0x28410800u, cpu->gpr[1], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0xBFC03CACu); #endif @@ -59503,7 +59672,8 @@ label_BFC03D80: psx_cyc_step(cpu, 0x1048000u); #endif /* 0xBFC03DB0: 01F2C024 and $t8, $t7, $s2 */ - cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[18]; + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[18]; + PGXP_ALU(0x01F2C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03DB0u); #endif @@ -59744,7 +59914,8 @@ label_BFC03DDC: psx_cyc_step(cpu, 0x40300u); #endif /* 0xBFC03DF0: 01124824 and $t1, $t0, $s2 */ - cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[18]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[18]; + PGXP_ALU(0x01124824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC03DF0u); #endif @@ -59888,7 +60059,8 @@ label_BFC03E04: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC03E1C: 31AEFFFF andi $t6, $t5, 0xFFFF */ - cpu->gpr[14] = cpu->gpr[13] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0xFFFFu; + PGXP_ALU(0x31AEFFFFu, cpu->gpr[14], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03E1Cu); #endif @@ -59965,7 +60137,8 @@ label_BFC03E04: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC03E38: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03E38u); #endif @@ -60558,7 +60731,8 @@ label_BFC03EBC: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC03EE8: 3328FFFF andi $t0, $t9, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[25] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0xFFFFu; + PGXP_ALU(0x3328FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03EE8u); #endif @@ -60593,7 +60767,8 @@ label_BFC03EBC: psx_cyc_step(cpu, 0x810u); #endif /* 0xBFC03EF4: 308BFFFF andi $t3, $a0, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[11] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x308BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC03EF4u); #endif @@ -62661,7 +62836,8 @@ label_BFC04138: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC04150: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC04150u); #endif @@ -62736,7 +62912,8 @@ label_BFC0415C: psx_cyc_step(cpu, 0x3000010u); #endif /* 0xBFC04164: 0304C824 and $t9, $t8, $a0 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[4]; + PGXP_ALU(0x0304C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC04164u); #endif @@ -62963,7 +63140,8 @@ label_BFC04190: psx_cyc_step(cpu, 0x310u); #endif /* 0xBFC04198: 01044824 and $t1, $t0, $a0 */ - cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[4]; + PGXP_ALU(0x01044824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC04198u); #endif @@ -63113,7 +63291,8 @@ label_BFC041AC: psx_cyc_step(cpu, 0xC20u); #endif /* 0xBFC041C0: 01455824 and $t3, $t2, $a1 */ - cpu->gpr[11] = cpu->gpr[10] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[11] = cpu->gpr[10] & cpu->gpr[5]; + PGXP_ALU(0x01455824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC041C0u); #endif @@ -63340,7 +63519,8 @@ label_BFC041EC: psx_cyc_step(cpu, 0x3020u); #endif /* 0xBFC041F4: 01856824 and $t5, $t4, $a1 */ - cpu->gpr[13] = cpu->gpr[12] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[13] = cpu->gpr[12] & cpu->gpr[5]; + PGXP_ALU(0x01856824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC041F4u); #endif @@ -63415,7 +63595,8 @@ label_BFC04200: psx_cyc_step(cpu, 0xC008u); #endif /* 0xBFC04208: 01C37824 and $t7, $t6, $v1 */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[3]; + PGXP_ALU(0x01C37824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC04208u); #endif @@ -63489,7 +63670,8 @@ label_BFC04214: psx_cyc_step(cpu, 0x3000008u); #endif /* 0xBFC0421C: 0303C824 and $t9, $t8, $v1 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[3]; + PGXP_ALU(0x0303C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0421Cu); #endif @@ -65285,7 +65467,8 @@ label_BFC046D8: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC046F8: 0045082B sltu $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC046F8u); #endif @@ -65363,7 +65546,8 @@ label_BFC04708: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC0470C: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0470Cu); #endif @@ -66117,7 +66301,8 @@ label_BFC047B8: psx_cyc_step(cpu, 0x52u); #endif /* 0xBFC047C8: 00C4082B sltu $at, $a2, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x00C4082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC047C8u); #endif @@ -66180,7 +66365,8 @@ label_BFC047D4: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC047D8: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC047D8u); #endif @@ -66310,7 +66496,8 @@ label_BFC047E8: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC047FC: 0045082B sltu $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC047FCu); #endif @@ -66395,7 +66582,8 @@ label_BFC0480C: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC04810: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC04810u); #endif @@ -67523,7 +67711,8 @@ label_BFC04934: psx_cyc_step(cpu, 0xC040u); #endif /* 0xBFC0494C: 01C67824 and $t7, $t6, $a2 */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[6]; + PGXP_ALU(0x01C67824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0494Cu); #endif @@ -67567,7 +67756,8 @@ label_BFC04934: psx_cyc_step(cpu, 0x3000020u); #endif /* 0xBFC0495C: 0305C824 and $t9, $t8, $a1 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[5]; + PGXP_ALU(0x0305C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0495Cu); #endif @@ -67764,7 +67954,8 @@ label_BFC04934: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC049A0: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC049A0u); #endif @@ -69259,7 +69450,8 @@ label_BFC04B14: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC04B28: 30580010 andi $t8, $v0, 0x10 */ - cpu->gpr[24] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30580010u, cpu->gpr[24], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC04B28u); #endif @@ -70660,7 +70852,8 @@ label_BFC04C70: psx_cyc_step(cpu, 0x1000040u); #endif /* 0xBFC04CA0: 30D80010 andi $t8, $a2, 0x10 */ - cpu->gpr[24] = cpu->gpr[6] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[24] = cpu->gpr[6] & 0x10u; + PGXP_ALU(0x30D80010u, cpu->gpr[24], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC04CA0u); #endif @@ -70781,7 +70974,8 @@ label_BFC04CBC: psx_cyc_step(cpu, 0x140u); #endif /* 0xBFC04CBC: 30C80020 andi $t0, $a2, 0x20 */ - cpu->gpr[8] = cpu->gpr[6] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[8] = cpu->gpr[6] & 0x20u; + PGXP_ALU(0x30C80020u, cpu->gpr[8], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0xBFC04CBCu); #endif @@ -71005,7 +71199,8 @@ label_BFC04CE4: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC04CF8: 304B0010 andi $t3, $v0, 0x10 */ - cpu->gpr[11] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304B0010u, cpu->gpr[11], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC04CF8u); #endif @@ -71134,7 +71329,8 @@ label_BFC04D0C: psx_cyc_step(cpu, 0x1040u); #endif /* 0xBFC04D18: 30CC00FF andi $t4, $a2, 0xFF */ - cpu->gpr[12] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[12] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30CC00FFu, cpu->gpr[12], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC04D18u); #endif @@ -71586,7 +71782,8 @@ label_BFC04D78: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC04D94: 304F0010 andi $t7, $v0, 0x10 */ - cpu->gpr[15] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304F0010u, cpu->gpr[15], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC04D94u); #endif @@ -71715,7 +71912,8 @@ label_BFC04DA8: psx_cyc_step(cpu, 0x1000010u); #endif /* 0xBFC04DB4: 309800FF andi $t8, $a0, 0xFF */ - cpu->gpr[24] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[24] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x309800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC04DB4u); #endif @@ -72043,7 +72241,8 @@ label_BFC04DEC: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC04E04: 31CF0004 andi $t7, $t6, 0x4 */ - cpu->gpr[15] = cpu->gpr[14] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x4u; + PGXP_ALU(0x31CF0004u, cpu->gpr[15], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC04E04u); #endif @@ -72160,7 +72359,8 @@ label_BFC04E18: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC04E20: 30580004 andi $t8, $v0, 0x4 */ - cpu->gpr[24] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30580004u, cpu->gpr[24], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC04E20u); #endif @@ -72343,7 +72543,8 @@ label_BFC04E34: psx_cyc_step(cpu, 0x84u); #endif /* 0xBFC04E54: 30470007 andi $a3, $v0, 0x7 */ - cpu->gpr[7] = cpu->gpr[2] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[7] = cpu->gpr[2] & 0x7u; + PGXP_ALU(0x30470007u, cpu->gpr[7], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0xBFC04E54u); #endif @@ -72354,7 +72555,8 @@ label_BFC04E34: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC04E58: 30E700FF andi $a3, $a3, 0xFF */ - cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30E700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC04E58u); #endif @@ -72375,7 +72577,8 @@ label_BFC04E34: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC04E60: 30430018 andi $v1, $v0, 0x18 */ - cpu->gpr[3] = cpu->gpr[2] & 0x18u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0x18u; + PGXP_ALU(0x30430018u, cpu->gpr[3], _pgx1, 0x0018u); } #ifdef PSX_COSIM cosim_instr(0xBFC04E60u); #endif @@ -72475,7 +72678,8 @@ label_BFC04E64: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC04E7C: 29010004 slti $at, $t0, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4) ? 1 : 0); + PGXP_ALU(0x29010004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC04E7Cu); #endif @@ -72496,7 +72700,8 @@ label_BFC04E64: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC04E84: 30430018 andi $v1, $v0, 0x18 */ - cpu->gpr[3] = cpu->gpr[2] & 0x18u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0x18u; + PGXP_ALU(0x30430018u, cpu->gpr[3], _pgx1, 0x0018u); } #ifdef PSX_COSIM cosim_instr(0xBFC04E84u); #endif @@ -72624,7 +72829,8 @@ label_BFC04E88: psx_cyc_step(cpu, 0x1002u); #endif /* 0xBFC04EAC: 29810004 slti $at, $t4, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (4) ? 1 : 0); + PGXP_ALU(0x29810004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC04EACu); #endif @@ -72677,7 +72883,8 @@ label_BFC04EB8: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC04EB8: 30430018 andi $v1, $v0, 0x18 */ - cpu->gpr[3] = cpu->gpr[2] & 0x18u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0x18u; + PGXP_ALU(0x30430018u, cpu->gpr[3], _pgx1, 0x0018u); } #ifdef PSX_COSIM cosim_instr(0xBFC04EB8u); #endif @@ -72695,7 +72902,8 @@ label_BFC04EBC: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC04EBC: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC04EBCu); #endif @@ -72805,7 +73013,8 @@ label_BFC04EC8: psx_cyc_step(cpu, 0x2002u); #endif /* 0xBFC04EDC: 29A10004 slti $at, $t5, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (4) ? 1 : 0); + PGXP_ALU(0x29A10004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC04EDCu); #endif @@ -72955,7 +73164,8 @@ label_BFC04EE8: psx_cyc_step(cpu, 0x2000002u); #endif /* 0xBFC04F0C: 2B210004 slti $at, $t9, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (4) ? 1 : 0); + PGXP_ALU(0x2B210004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC04F0Cu); #endif @@ -73039,7 +73249,8 @@ label_BFC04F1C: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC04F20: 2D010005 sltiu $at, $t0, 5 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < 0x00000005u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < 0x00000005u ? 1 : 0); + PGXP_ALU(0x2D010005u, cpu->gpr[1], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0xBFC04F20u); #endif @@ -73870,7 +74081,8 @@ label_BFC04FBC: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC04FD4: 31CF0008 andi $t7, $t6, 0x8 */ - cpu->gpr[15] = cpu->gpr[14] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x8u; + PGXP_ALU(0x31CF0008u, cpu->gpr[15], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC04FD4u); #endif @@ -73987,7 +74199,8 @@ label_BFC04FE8: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC04FF0: 30580008 andi $t8, $v0, 0x8 */ - cpu->gpr[24] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30580008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC04FF0u); #endif @@ -74138,7 +74351,8 @@ label_BFC05004: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05018: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC05018u); #endif @@ -75268,7 +75482,8 @@ label_BFC05120: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC05150: 29010004 slti $at, $t0, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4) ? 1 : 0); + PGXP_ALU(0x29010004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC05150u); #endif @@ -75424,7 +75639,8 @@ label_BFC05160: psx_cyc_step(cpu, 0x1002u); #endif /* 0xBFC05180: 29810004 slti $at, $t4, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (4) ? 1 : 0); + PGXP_ALU(0x29810004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC05180u); #endif @@ -77465,7 +77681,8 @@ label_BFC05300: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05304: 2841001A slti $at, $v0, 26 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (26) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (26) ? 1 : 0); + PGXP_ALU(0x2841001Au, cpu->gpr[1], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0xBFC05304u); #endif @@ -77550,7 +77767,8 @@ label_BFC05310: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05314: 2841000F slti $at, $v0, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + PGXP_ALU(0x2841000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC05314u); #endif @@ -77635,7 +77853,8 @@ label_BFC05320: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05324: 28410009 slti $at, $v0, 9 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (9) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (9) ? 1 : 0); + PGXP_ALU(0x28410009u, cpu->gpr[1], _pgx1, 0x0009u); } #ifdef PSX_COSIM cosim_instr(0xBFC05324u); #endif @@ -77720,7 +77939,8 @@ label_BFC05330: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05334: 28410006 slti $at, $v0, 6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (6) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (6) ? 1 : 0); + PGXP_ALU(0x28410006u, cpu->gpr[1], _pgx1, 0x0006u); } #ifdef PSX_COSIM cosim_instr(0xBFC05334u); #endif @@ -77805,7 +78025,8 @@ label_BFC05340: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05344: 28410004 slti $at, $v0, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4) ? 1 : 0); + PGXP_ALU(0x28410004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC05344u); #endif @@ -78171,7 +78392,8 @@ label_BFC05388: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05390: 2841000C slti $at, $v0, 12 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (12) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (12) ? 1 : 0); + PGXP_ALU(0x2841000Cu, cpu->gpr[1], _pgx1, 0x000Cu); } #ifdef PSX_COSIM cosim_instr(0xBFC05390u); #endif @@ -78442,7 +78664,8 @@ label_BFC053C0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC053C8: 28410015 slti $at, $v0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (21) ? 1 : 0); + PGXP_ALU(0x28410015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0xBFC053C8u); #endif @@ -78527,7 +78750,8 @@ label_BFC053D4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC053D8: 28410013 slti $at, $v0, 19 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (19) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (19) ? 1 : 0); + PGXP_ALU(0x28410013u, cpu->gpr[1], _pgx1, 0x0013u); } #ifdef PSX_COSIM cosim_instr(0xBFC053D8u); #endif @@ -78800,7 +79024,8 @@ label_BFC05408: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05410: 28410017 slti $at, $v0, 23 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (23) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (23) ? 1 : 0); + PGXP_ALU(0x28410017u, cpu->gpr[1], _pgx1, 0x0017u); } #ifdef PSX_COSIM cosim_instr(0xBFC05410u); #endif @@ -79071,7 +79296,8 @@ label_BFC05440: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05448: 284100F7 slti $at, $v0, 247 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (247) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (247) ? 1 : 0); + PGXP_ALU(0x284100F7u, cpu->gpr[1], _pgx1, 0x00F7u); } #ifdef PSX_COSIM cosim_instr(0xBFC05448u); #endif @@ -79156,7 +79382,8 @@ label_BFC05454: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05458: 284100E7 slti $at, $v0, 231 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (231) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (231) ? 1 : 0); + PGXP_ALU(0x284100E7u, cpu->gpr[1], _pgx1, 0x00E7u); } #ifdef PSX_COSIM cosim_instr(0xBFC05458u); #endif @@ -79241,7 +79468,8 @@ label_BFC05464: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05468: 28410051 slti $at, $v0, 81 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + PGXP_ALU(0x28410051u, cpu->gpr[1], _pgx1, 0x0051u); } #ifdef PSX_COSIM cosim_instr(0xBFC05468u); #endif @@ -79512,7 +79740,8 @@ label_BFC05498: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC054A0: 284100EF slti $at, $v0, 239 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (239) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (239) ? 1 : 0); + PGXP_ALU(0x284100EFu, cpu->gpr[1], _pgx1, 0x00EFu); } #ifdef PSX_COSIM cosim_instr(0xBFC054A0u); #endif @@ -79786,7 +80015,8 @@ label_BFC054D0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC054D8: 28410DDE slti $at, $v0, 3550 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3550) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3550) ? 1 : 0); + PGXP_ALU(0x28410DDEu, cpu->gpr[1], _pgx1, 0x0DDEu); } #ifdef PSX_COSIM cosim_instr(0xBFC054D8u); #endif @@ -79871,7 +80101,8 @@ label_BFC054E4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC054E8: 284100FF slti $at, $v0, 255 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (255) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (255) ? 1 : 0); + PGXP_ALU(0x284100FFu, cpu->gpr[1], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC054E8u); #endif @@ -80143,7 +80374,8 @@ label_BFC05518: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05520: 28411000 slti $at, $v0, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4096) ? 1 : 0); + PGXP_ALU(0x28411000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0xBFC05520u); #endif @@ -82070,7 +82302,8 @@ label_BFC056E4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC056E8: 28410CCD slti $at, $v0, 3277 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3277) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3277) ? 1 : 0); + PGXP_ALU(0x28410CCDu, cpu->gpr[1], _pgx1, 0x0CCDu); } #ifdef PSX_COSIM cosim_instr(0xBFC056E8u); #endif @@ -82155,7 +82388,8 @@ label_BFC056F4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC056F8: 28410017 slti $at, $v0, 23 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (23) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (23) ? 1 : 0); + PGXP_ALU(0x28410017u, cpu->gpr[1], _pgx1, 0x0017u); } #ifdef PSX_COSIM cosim_instr(0xBFC056F8u); #endif @@ -82240,7 +82474,8 @@ label_BFC05704: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05708: 2841000A slti $at, $v0, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (10) ? 1 : 0); + PGXP_ALU(0x2841000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC05708u); #endif @@ -82717,7 +82952,8 @@ label_BFC05768: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC05770: 28411000 slti $at, $v0, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4096) ? 1 : 0); + PGXP_ALU(0x28411000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0xBFC05770u); #endif @@ -83403,7 +83639,8 @@ label_BFC057EC: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC0581C: 29210004 slti $at, $t1, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (4) ? 1 : 0); + PGXP_ALU(0x29210004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC0581Cu); #endif @@ -83574,7 +83811,8 @@ label_BFC05828: psx_cyc_step(cpu, 0x8002u); #endif /* 0xBFC05854: 29E10004 slti $at, $t7, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (4) ? 1 : 0); + PGXP_ALU(0x29E10004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC05854u); #endif @@ -89293,7 +89531,8 @@ label_BFC05DB0: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC05DBC: 308300FF andi $v1, $a0, 0xFF */ - cpu->gpr[3] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC05DBCu); #endif @@ -89936,7 +90175,8 @@ label_BFC05E58: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC05E70: 31F80100 andi $t8, $t7, 0x100 */ - cpu->gpr[24] = cpu->gpr[15] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x100u; + PGXP_ALU(0x31F80100u, cpu->gpr[24], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0xBFC05E70u); #endif @@ -91622,7 +91862,8 @@ label_BFC06038: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC06044: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06044u); #endif @@ -92171,7 +92412,8 @@ label_BFC060DC: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC060EC: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC060ECu); #endif @@ -92236,7 +92478,8 @@ label_BFC060DC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC06104: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06104u); #endif @@ -92342,7 +92585,8 @@ label_BFC06114: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC06120: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06120u); #endif @@ -93331,7 +93575,8 @@ label_BFC06218: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC06230: 304E0010 andi $t6, $v0, 0x10 */ - cpu->gpr[14] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304E0010u, cpu->gpr[14], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC06230u); #endif @@ -94016,7 +94261,8 @@ label_BFC062CC: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC062F8: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC062F8u); #endif @@ -94027,7 +94273,8 @@ label_BFC062CC: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC062FC: 304E000F andi $t6, $v0, 0xF */ - cpu->gpr[14] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x304E000Fu, cpu->gpr[14], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC062FCu); #endif @@ -94050,7 +94297,8 @@ label_BFC062CC: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC06304: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06304u); #endif @@ -94163,7 +94411,8 @@ label_BFC062CC: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC0632C: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC0632Cu); #endif @@ -94174,7 +94423,8 @@ label_BFC062CC: psx_cyc_step(cpu, 0x8008u); #endif /* 0xBFC06330: 306F000F andi $t7, $v1, 0xF */ - cpu->gpr[15] = cpu->gpr[3] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[15] = cpu->gpr[3] & 0xFu; + PGXP_ALU(0x306F000Fu, cpu->gpr[15], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC06330u); #endif @@ -94206,7 +94456,8 @@ label_BFC062CC: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC0633C: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC0633Cu); #endif @@ -94253,7 +94504,8 @@ label_BFC062CC: psx_cyc_step(cpu, 0x1000040u); #endif /* 0xBFC0634C: 30D80010 andi $t8, $a2, 0x10 */ - cpu->gpr[24] = cpu->gpr[6] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[24] = cpu->gpr[6] & 0x10u; + PGXP_ALU(0x30D80010u, cpu->gpr[24], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC0634Cu); #endif @@ -94274,7 +94526,8 @@ label_BFC062CC: psx_cyc_step(cpu, 0x90u); #endif /* 0xBFC06354: 308700FF andi $a3, $a0, 0xFF */ - cpu->gpr[7] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[7] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06354u); #endif @@ -94503,7 +94756,8 @@ label_BFC0636C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC06390: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06390u); #endif @@ -94541,7 +94795,8 @@ label_BFC0636C: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC0639C: 314B00FF andi $t3, $t2, 0xFF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFu; + PGXP_ALU(0x314B00FFu, cpu->gpr[11], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC0639Cu); #endif @@ -94932,7 +95187,8 @@ label_BFC063CC: psx_cyc_step(cpu, 0x10Au); #endif /* 0xBFC06414: 0103082B sltu $at, $t0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0103082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC06414u); #endif @@ -95175,7 +95431,8 @@ label_BFC06444: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC06458: 304A0010 andi $t2, $v0, 0x10 */ - cpu->gpr[10] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304A0010u, cpu->gpr[10], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC06458u); #endif @@ -95420,7 +95677,8 @@ label_BFC06478: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC06498: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC06498u); #endif @@ -95458,7 +95716,8 @@ label_BFC06478: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC064A4: 318D00FF andi $t5, $t4, 0xFF */ - cpu->gpr[13] = cpu->gpr[12] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0xFFu; + PGXP_ALU(0x318D00FFu, cpu->gpr[13], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC064A4u); #endif @@ -95496,7 +95755,8 @@ label_BFC06478: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC064B0: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC064B0u); #endif @@ -96600,7 +96860,8 @@ label_BFC065C0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC065D8: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC065D8u); #endif @@ -97202,7 +97463,8 @@ label_BFC06680: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC06698: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC06698u); #endif @@ -98895,7 +99157,8 @@ label_BFC06808: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC06810: 00412024 and $a0, $v0, $at */ - cpu->gpr[4] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[4] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00412024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC06810u); #endif @@ -103837,7 +104100,8 @@ label_BFC06CC8: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC06CD0: 00412024 and $a0, $v0, $at */ - cpu->gpr[4] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[4] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00412024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC06CD0u); #endif @@ -110741,7 +111005,8 @@ label_BFC073B0: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC073BC: 01C2082A slt $at, $t6, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x01C2082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC073BCu); #endif @@ -110897,7 +111162,8 @@ label_BFC073CC: psx_cyc_step(cpu, 0x106u); #endif /* 0xBFC073EC: 0102082A slt $at, $t0, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0102082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC073ECu); #endif @@ -112077,7 +112343,8 @@ label_BFC07518: psx_cyc_step(cpu, 0xE00u); #endif /* 0xBFC07528: 012A5826 xor $t3, $t1, $t2 */ - cpu->gpr[11] = cpu->gpr[9] ^ cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[9] ^ cpu->gpr[10]; + PGXP_ALU(0x012A5826u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07528u); #endif @@ -112112,7 +112379,8 @@ label_BFC07518: psx_cyc_step(cpu, 0x100006u); #endif /* 0xBFC07534: 0054082B sltu $at, $v0, $s4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[20] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[20] ? 1 : 0); + PGXP_ALU(0x0054082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07534u); #endif @@ -112553,7 +112821,8 @@ label_BFC07580: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC075BC: 3063FFFF andi $v1, $v1, 0xFFFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + PGXP_ALU(0x3063FFFFu, cpu->gpr[3], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC075BCu); #endif @@ -112702,7 +112971,8 @@ label_BFC075DC: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC075EC: 30480001 andi $t0, $v0, 0x1 */ - cpu->gpr[8] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30480001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC075ECu); #endif @@ -112841,7 +113111,8 @@ label_BFC0760C: psx_cyc_step(cpu, 0x110002u); #endif /* 0xBFC0760C: 0214082B sltu $at, $s0, $s4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[20] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[20] ? 1 : 0); + PGXP_ALU(0x0214082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0760Cu); #endif @@ -113588,7 +113859,8 @@ label_BFC076C8: psx_cyc_step(cpu, 0x1020002u); #endif /* 0xBFC076D4: 0238082A slt $at, $s1, $t8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x0238082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC076D4u); #endif @@ -114865,7 +115137,8 @@ label_BFC07834: psx_cyc_step(cpu, 0xA0002u); #endif /* 0xBFC07848: 0233082B sltu $at, $s1, $s3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0233082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07848u); #endif @@ -114919,7 +115192,8 @@ label_BFC07854: psx_cyc_step(cpu, 0x140002u); #endif /* 0xBFC07854: 0254082B sltu $at, $s2, $s4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[18] < cpu->gpr[20] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)(cpu->gpr[18] < cpu->gpr[20] ? 1 : 0); + PGXP_ALU(0x0254082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07854u); #endif @@ -115361,7 +115635,8 @@ label_BFC078C8: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC078C8: 304E0010 andi $t6, $v0, 0x10 */ - cpu->gpr[14] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304E0010u, cpu->gpr[14], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC078C8u); #endif @@ -116759,7 +117034,8 @@ label_BFC07A04: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC07A24: 31CF07FF andi $t7, $t6, 0x7FF */ - cpu->gpr[15] = cpu->gpr[14] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x7FFu; + PGXP_ALU(0x31CF07FFu, cpu->gpr[15], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC07A24u); #endif @@ -116915,7 +117191,8 @@ label_BFC07A3C: psx_cyc_step(cpu, 0x1000010u); #endif /* 0xBFC07A44: 309807FF andi $t8, $a0, 0x7FF */ - cpu->gpr[24] = cpu->gpr[4] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[24] = cpu->gpr[4] & 0x7FFu; + PGXP_ALU(0x309807FFu, cpu->gpr[24], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC07A44u); #endif @@ -117062,7 +117339,8 @@ label_BFC07A60: psx_cyc_step(cpu, 0x112u); #endif /* 0xBFC07A68: 0088082B sltu $at, $a0, $t0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0088082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07A68u); #endif @@ -117228,7 +117506,8 @@ label_BFC07A8C: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC07A90: 304A0010 andi $t2, $v0, 0x10 */ - cpu->gpr[10] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304A0010u, cpu->gpr[10], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC07A90u); #endif @@ -117951,7 +118230,8 @@ label_BFC07B40: psx_cyc_step(cpu, 0x406u); #endif /* 0xBFC07B50: 004A082B sltu $at, $v0, $t2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x004A082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC07B50u); #endif @@ -118277,7 +118557,8 @@ label_BFC07B98: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC07B98: 304E0010 andi $t6, $v0, 0x10 */ - cpu->gpr[14] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304E0010u, cpu->gpr[14], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC07B98u); #endif @@ -119102,7 +119383,8 @@ label_BFC07C1C: psx_cyc_step(cpu, 0x400004u); #endif /* 0xBFC07C58: 2AC2000A slti $v0, $s6, 10 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[22] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[22] < (10) ? 1 : 0); + PGXP_ALU(0x2AC2000Au, cpu->gpr[2], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC07C58u); #endif @@ -120733,7 +121015,8 @@ label_BFC07E14: psx_cyc_step(cpu, 0x400004u); #endif /* 0xBFC07E18: 2AC2000A slti $v0, $s6, 10 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[22] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[22] < (10) ? 1 : 0); + PGXP_ALU(0x2AC2000Au, cpu->gpr[2], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC07E18u); #endif @@ -121504,7 +121787,8 @@ label_BFC07EC0: psx_cyc_step(cpu, 0x400004u); #endif /* 0xBFC07EC4: 2AC2000A slti $v0, $s6, 10 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[22] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[22] < (10) ? 1 : 0); + PGXP_ALU(0x2AC2000Au, cpu->gpr[2], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC07EC4u); #endif @@ -122056,7 +122340,8 @@ label_BFC07F44: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC07F44: 304E00FF andi $t6, $v0, 0xFF */ - cpu->gpr[14] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC07F44u); #endif @@ -122200,7 +122485,8 @@ label_BFC07F64: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC07F64: 304F00FF andi $t7, $v0, 0xFF */ - cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC07F64u); #endif @@ -122515,7 +122801,8 @@ label_BFC07FAC: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC07FAC: 305800FF andi $t8, $v0, 0xFF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC07FACu); #endif @@ -122674,7 +122961,8 @@ label_BFC07FD4: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC07FD4: 305900FF andi $t9, $v0, 0xFF */ - cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC07FD4u); #endif @@ -123661,7 +123949,8 @@ label_BFC080B0: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC080B0: 304E0010 andi $t6, $v0, 0x10 */ - cpu->gpr[14] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304E0010u, cpu->gpr[14], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC080B0u); #endif @@ -125340,7 +125629,8 @@ label_BFC08264: psx_cyc_step(cpu, 0x2000Au); #endif /* 0xBFC08268: 0223082B sltu $at, $s1, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0223082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08268u); #endif @@ -125832,7 +126122,8 @@ label_BFC082D8: psx_cyc_step(cpu, 0x2000Au); #endif /* 0xBFC082E0: 0223082B sltu $at, $s1, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0223082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC082E0u); #endif @@ -125914,7 +126205,8 @@ label_BFC082F0: psx_cyc_step(cpu, 0x2000Au); #endif /* 0xBFC082F4: 0223082B sltu $at, $s1, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0223082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC082F4u); #endif @@ -127594,7 +127886,8 @@ label_BFC084A0: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC084A4: 2A610008 slti $at, $s3, 8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (8) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (8) ? 1 : 0); + PGXP_ALU(0x2A610008u, cpu->gpr[1], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC084A4u); #endif @@ -127797,7 +128090,8 @@ label_BFC084CC: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC084D0: 2A610008 slti $at, $s3, 8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (8) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (8) ? 1 : 0); + PGXP_ALU(0x2A610008u, cpu->gpr[1], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC084D0u); #endif @@ -127825,7 +128119,8 @@ label_BFC084D8: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC084D8: 2A610008 slti $at, $s3, 8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (8) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (8) ? 1 : 0); + PGXP_ALU(0x2A610008u, cpu->gpr[1], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC084D8u); #endif @@ -128219,7 +128514,8 @@ label_BFC08520: psx_cyc_step(cpu, 0x420002u); #endif /* 0xBFC0852C: 02D1082A slt $at, $s6, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x02D1082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0852Cu); #endif @@ -128523,7 +128819,8 @@ label_BFC08574: psx_cyc_step(cpu, 0xA0002u); #endif /* 0xBFC08578: 0271082A slt $at, $s3, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0271082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08578u); #endif @@ -130234,7 +130531,8 @@ label_BFC08720: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC0872C: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC0872Cu); #endif @@ -130254,7 +130552,8 @@ label_BFC08720: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC08734: 004E1026 xor $v0, $v0, $t6 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[14]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[14]; + PGXP_ALU(0x004E1026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08734u); #endif @@ -130265,7 +130564,8 @@ label_BFC08720: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08738: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08738u); #endif @@ -130300,7 +130600,8 @@ label_BFC08720: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC08744: 004F1026 xor $v0, $v0, $t7 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[15]; + PGXP_ALU(0x004F1026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08744u); #endif @@ -130311,7 +130612,8 @@ label_BFC08720: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08748: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08748u); #endif @@ -130383,7 +130685,8 @@ label_BFC08758: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC08760: 00581026 xor $v0, $v0, $t8 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[24]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[24]; + PGXP_ALU(0x00581026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08760u); #endif @@ -130394,7 +130697,8 @@ label_BFC08758: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08764: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08764u); #endif @@ -130414,7 +130718,8 @@ label_BFC08758: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC0876C: 00591026 xor $v0, $v0, $t9 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[25]; + PGXP_ALU(0x00591026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0876Cu); #endif @@ -130425,7 +130730,8 @@ label_BFC08758: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08770: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08770u); #endif @@ -130457,7 +130763,8 @@ label_BFC08758: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC0877C: 00481026 xor $v0, $v0, $t0 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[8]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[8]; + PGXP_ALU(0x00481026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0877Cu); #endif @@ -130468,7 +130775,8 @@ label_BFC08758: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08780: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08780u); #endif @@ -130515,7 +130823,8 @@ label_BFC08758: psx_cyc_step(cpu, 0x204u); #endif /* 0xBFC08790: 00491026 xor $v0, $v0, $t1 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[9]; + PGXP_ALU(0x00491026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08790u); #endif @@ -130526,7 +130835,8 @@ label_BFC08758: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08794: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08794u); #endif @@ -130762,7 +131072,8 @@ label_BFC087C4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC087D0: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC087D0u); #endif @@ -130782,7 +131093,8 @@ label_BFC087C4: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC087D8: 004E1026 xor $v0, $v0, $t6 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[14]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[14]; + PGXP_ALU(0x004E1026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC087D8u); #endif @@ -130793,7 +131105,8 @@ label_BFC087C4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC087DC: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC087DCu); #endif @@ -130828,7 +131141,8 @@ label_BFC087C4: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC087E8: 004F1026 xor $v0, $v0, $t7 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[15]; + PGXP_ALU(0x004F1026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC087E8u); #endif @@ -130839,7 +131153,8 @@ label_BFC087C4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC087EC: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC087ECu); #endif @@ -130911,7 +131226,8 @@ label_BFC087FC: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC08804: 00581026 xor $v0, $v0, $t8 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[24]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[24]; + PGXP_ALU(0x00581026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08804u); #endif @@ -130922,7 +131238,8 @@ label_BFC087FC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08808: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08808u); #endif @@ -130942,7 +131259,8 @@ label_BFC087FC: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC08810: 00591026 xor $v0, $v0, $t9 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[25]; + PGXP_ALU(0x00591026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08810u); #endif @@ -130953,7 +131271,8 @@ label_BFC087FC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08814: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08814u); #endif @@ -130985,7 +131304,8 @@ label_BFC087FC: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC08820: 00481026 xor $v0, $v0, $t0 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[8]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[8]; + PGXP_ALU(0x00481026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08820u); #endif @@ -130996,7 +131316,8 @@ label_BFC087FC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08824: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08824u); #endif @@ -131043,7 +131364,8 @@ label_BFC087FC: psx_cyc_step(cpu, 0x204u); #endif /* 0xBFC08834: 00491026 xor $v0, $v0, $t1 */ - cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[2] = cpu->gpr[2] ^ cpu->gpr[9]; + PGXP_ALU(0x00491026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC08834u); #endif @@ -131054,7 +131376,8 @@ label_BFC087FC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC08838: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0xBFC08838u); #endif @@ -137556,7 +137879,8 @@ label_BFC08EA8: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC08EAC: 2A01000F slti $at, $s0, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (15) ? 1 : 0); + PGXP_ALU(0x2A01000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC08EACu); #endif @@ -139632,7 +139956,8 @@ label_BFC09098: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC090A4: 31AE00F0 andi $t6, $t5, 0xF0 */ - cpu->gpr[14] = cpu->gpr[13] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0xF0u; + PGXP_ALU(0x31AE00F0u, cpu->gpr[14], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0xBFC090A4u); #endif @@ -145349,7 +145674,8 @@ label_BFC09618: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC0962C: 2A010014 slti $at, $s0, 20 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (20) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (20) ? 1 : 0); + PGXP_ALU(0x2A010014u, cpu->gpr[1], _pgx1, 0x0014u); } #ifdef PSX_COSIM cosim_instr(0xBFC0962Cu); #endif @@ -145403,7 +145729,8 @@ label_BFC09630: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC09638: 2A010014 slti $at, $s0, 20 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (20) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (20) ? 1 : 0); + PGXP_ALU(0x2A010014u, cpu->gpr[1], _pgx1, 0x0014u); } #ifdef PSX_COSIM cosim_instr(0xBFC09638u); #endif @@ -147781,7 +148108,8 @@ label_BFC09890: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC09890: 38820052 xori $v0, $a0, 0x52 */ - cpu->gpr[2] = cpu->gpr[4] ^ 0x52u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] ^ 0x52u; + PGXP_ALU(0x38820052u, cpu->gpr[2], _pgx1, 0x0052u); } #ifdef PSX_COSIM cosim_instr(0xBFC09890u); #endif @@ -147800,7 +148128,8 @@ label_BFC09890: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC09898: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC09898u); #endif @@ -147835,7 +148164,8 @@ label_BFC0989C: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC0989C: 38820051 xori $v0, $a0, 0x51 */ - cpu->gpr[2] = cpu->gpr[4] ^ 0x51u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] ^ 0x51u; + PGXP_ALU(0x38820051u, cpu->gpr[2], _pgx1, 0x0051u); } #ifdef PSX_COSIM cosim_instr(0xBFC0989Cu); #endif @@ -147854,7 +148184,8 @@ label_BFC0989C: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC098A4: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC098A4u); #endif @@ -149198,7 +149529,8 @@ label_BFC099D8: psx_cyc_step(cpu, 0x2080000u); #endif /* 0xBFC099D8: 32798000 andi $t9, $s3, 0x8000 */ - cpu->gpr[25] = cpu->gpr[19] & 0x8000u; + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[25] = cpu->gpr[19] & 0x8000u; + PGXP_ALU(0x32798000u, cpu->gpr[25], _pgx1, 0x8000u); } #ifdef PSX_COSIM cosim_instr(0xBFC099D8u); #endif @@ -149231,7 +149563,8 @@ label_BFC099D8: psx_cyc_step(cpu, 0x80800u); #endif /* 0xBFC099E4: 326B0200 andi $t3, $s3, 0x200 */ - cpu->gpr[11] = cpu->gpr[19] & 0x200u; + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[11] = cpu->gpr[19] & 0x200u; + PGXP_ALU(0x326B0200u, cpu->gpr[11], _pgx1, 0x0200u); } #ifdef PSX_COSIM cosim_instr(0xBFC099E4u); #endif @@ -149318,7 +149651,8 @@ label_BFC099F4: psx_cyc_step(cpu, 0x80800u); #endif /* 0xBFC099F8: 326B0200 andi $t3, $s3, 0x200 */ - cpu->gpr[11] = cpu->gpr[19] & 0x200u; + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[11] = cpu->gpr[19] & 0x200u; + PGXP_ALU(0x326B0200u, cpu->gpr[11], _pgx1, 0x0200u); } #ifdef PSX_COSIM cosim_instr(0xBFC099F8u); #endif @@ -149393,7 +149727,8 @@ label_BFC09A04: psx_cyc_step(cpu, 0x80800u); #endif /* 0xBFC09A04: 326B0200 andi $t3, $s3, 0x200 */ - cpu->gpr[11] = cpu->gpr[19] & 0x200u; + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[11] = cpu->gpr[19] & 0x200u; + PGXP_ALU(0x326B0200u, cpu->gpr[11], _pgx1, 0x0200u); } #ifdef PSX_COSIM cosim_instr(0xBFC09A04u); #endif @@ -149875,7 +150210,8 @@ label_BFC09A80: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC09A88: 31F800F0 andi $t8, $t7, 0xF0 */ - cpu->gpr[24] = cpu->gpr[15] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xF0u; + PGXP_ALU(0x31F800F0u, cpu->gpr[24], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0xBFC09A88u); #endif @@ -150014,7 +150350,8 @@ label_BFC09AA4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC09AA8: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC09AA8u); #endif @@ -150049,7 +150386,8 @@ label_BFC09AA4: psx_cyc_step(cpu, 0x2000006u); #endif /* 0xBFC09AB4: 0322082B sltu $at, $t9, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[25] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[25] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0322082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC09AB4u); #endif @@ -150123,7 +150461,8 @@ label_BFC09AC0: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC09AC8: 304B1FFF andi $t3, $v0, 0x1FFF */ - cpu->gpr[11] = cpu->gpr[2] & 0x1FFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x1FFFu; + PGXP_ALU(0x304B1FFFu, cpu->gpr[11], _pgx1, 0x1FFFu); } #ifdef PSX_COSIM cosim_instr(0xBFC09AC8u); #endif @@ -150289,7 +150628,8 @@ label_BFC09AF0: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC09AF8: 318D00F0 andi $t5, $t4, 0xF0 */ - cpu->gpr[13] = cpu->gpr[12] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0xF0u; + PGXP_ALU(0x318D00F0u, cpu->gpr[13], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0xBFC09AF8u); #endif @@ -150854,7 +151194,8 @@ label_BFC09B98: psx_cyc_step(cpu, 0x10Au); #endif /* 0xBFC09B9C: 0068082A slt $at, $v1, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0068082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC09B9Cu); #endif @@ -150920,7 +151261,8 @@ label_BFC09BA8: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC09BAC: 28610002 slti $at, $v1, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (2) ? 1 : 0); + PGXP_ALU(0x28610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC09BACu); #endif @@ -153005,7 +153347,8 @@ label_BFC09DB4: psx_cyc_step(cpu, 0x2000008u); #endif /* 0xBFC09DBC: 3079007F andi $t9, $v1, 0x7F */ - cpu->gpr[25] = cpu->gpr[3] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[25] = cpu->gpr[3] & 0x7Fu; + PGXP_ALU(0x3079007Fu, cpu->gpr[25], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC09DBCu); #endif @@ -153145,7 +153488,8 @@ label_BFC09DD8: psx_cyc_step(cpu, 0x20Au); #endif /* 0xBFC09DE0: 0069082B sltu $at, $v1, $t1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0069082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC09DE0u); #endif @@ -153322,7 +153666,8 @@ label_BFC09DFC: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC09E10: 316C8000 andi $t4, $t3, 0x8000 */ - cpu->gpr[12] = cpu->gpr[11] & 0x8000u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x8000u; + PGXP_ALU(0x316C8000u, cpu->gpr[12], _pgx1, 0x8000u); } #ifdef PSX_COSIM cosim_instr(0xBFC09E10u); #endif @@ -154649,7 +154994,8 @@ label_BFC09F78: psx_cyc_step(cpu, 0x22000u); #endif /* 0xBFC09F7C: 322D003F andi $t5, $s1, 0x3F */ - cpu->gpr[13] = cpu->gpr[17] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[13] = cpu->gpr[17] & 0x3Fu; + PGXP_ALU(0x322D003Fu, cpu->gpr[13], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC09F7Cu); #endif @@ -154754,7 +155100,8 @@ label_BFC09F8C: psx_cyc_step(cpu, 0x40006u); #endif /* 0xBFC09F90: 0052082A slt $at, $v0, $s2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0052082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC09F90u); #endif @@ -156189,7 +156536,8 @@ label_BFC0A0F8: psx_cyc_step(cpu, 0x2000008u); #endif /* 0xBFC0A100: 3079007F andi $t9, $v1, 0x7F */ - cpu->gpr[25] = cpu->gpr[3] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[25] = cpu->gpr[3] & 0x7Fu; + PGXP_ALU(0x3079007Fu, cpu->gpr[25], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0A100u); #endif @@ -156329,7 +156677,8 @@ label_BFC0A11C: psx_cyc_step(cpu, 0x20Au); #endif /* 0xBFC0A124: 0069082B sltu $at, $v1, $t1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0069082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0A124u); #endif @@ -156506,7 +156855,8 @@ label_BFC0A140: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC0A154: 316C8000 andi $t4, $t3, 0x8000 */ - cpu->gpr[12] = cpu->gpr[11] & 0x8000u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x8000u; + PGXP_ALU(0x316C8000u, cpu->gpr[12], _pgx1, 0x8000u); } #ifdef PSX_COSIM cosim_instr(0xBFC0A154u); #endif @@ -157881,7 +158231,8 @@ label_BFC0A2CC: psx_cyc_step(cpu, 0x24000u); #endif /* 0xBFC0A2D0: 322E003F andi $t6, $s1, 0x3F */ - cpu->gpr[14] = cpu->gpr[17] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[14] = cpu->gpr[17] & 0x3Fu; + PGXP_ALU(0x322E003Fu, cpu->gpr[14], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0A2D0u); #endif @@ -157986,7 +158337,8 @@ label_BFC0A2E0: psx_cyc_step(cpu, 0x40006u); #endif /* 0xBFC0A2E4: 0052082A slt $at, $v0, $s2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0052082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0A2E4u); #endif @@ -158879,7 +159231,8 @@ label_BFC0A3D4: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC0A3D4: 28C10040 slti $at, $a2, 64 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (64) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (64) ? 1 : 0); + PGXP_ALU(0x28C10040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0xBFC0A3D4u); #endif @@ -159079,7 +159432,8 @@ label_BFC0A400: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC0A410: 28C10040 slti $at, $a2, 64 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (64) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (64) ? 1 : 0); + PGXP_ALU(0x28C10040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0xBFC0A410u); #endif @@ -160625,7 +160979,8 @@ label_BFC0A570: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC0A598: 31CF00F0 andi $t7, $t6, 0xF0 */ - cpu->gpr[15] = cpu->gpr[14] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xF0u; + PGXP_ALU(0x31CF00F0u, cpu->gpr[15], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0xBFC0A598u); #endif @@ -161634,7 +161989,8 @@ label_BFC0A694: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC0A698: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0A698u); #endif @@ -162095,7 +162451,8 @@ label_BFC0A700: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC0A708: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0A708u); #endif @@ -162179,7 +162536,8 @@ label_BFC0A718: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC0A71C: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0A71Cu); #endif @@ -162488,7 +162846,8 @@ label_BFC0A754: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC0A760: 28A1000F slti $at, $a1, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (15) ? 1 : 0); + PGXP_ALU(0x28A1000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0A760u); #endif @@ -163596,7 +163955,8 @@ label_BFC0A87C: psx_cyc_step(cpu, 0x40002u); #endif /* 0xBFC0A880: 2A41000F slti $at, $s2, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (15) ? 1 : 0); + PGXP_ALU(0x2A41000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0A880u); #endif @@ -175753,7 +176113,8 @@ label_BFC0B488: psx_cyc_step(cpu, 0x82u); #endif /* 0xBFC0B494: 28E10014 slti $at, $a3, 20 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (20) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (20) ? 1 : 0); + PGXP_ALU(0x28E10014u, cpu->gpr[1], _pgx1, 0x0014u); } #ifdef PSX_COSIM cosim_instr(0xBFC0B494u); #endif @@ -175840,7 +176201,8 @@ label_BFC0B4A4: psx_cyc_step(cpu, 0x82u); #endif /* 0xBFC0B4A4: 28E10014 slti $at, $a3, 20 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (20) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (20) ? 1 : 0); + PGXP_ALU(0x28E10014u, cpu->gpr[1], _pgx1, 0x0014u); } #ifdef PSX_COSIM cosim_instr(0xBFC0B4A4u); #endif @@ -177895,7 +178257,8 @@ label_BFC0B68C: psx_cyc_step(cpu, 0x8002u); #endif /* 0xBFC0B694: 2DE10008 sltiu $at, $t7, 8 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < 0x00000008u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < 0x00000008u ? 1 : 0); + PGXP_ALU(0x2DE10008u, cpu->gpr[1], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0xBFC0B694u); #endif @@ -183378,7 +183741,8 @@ label_BFC0BC64: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC0BC80: 2861000F slti $at, $v1, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (15) ? 1 : 0); + PGXP_ALU(0x2861000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0BC80u); #endif @@ -184844,7 +185208,8 @@ label_BFC0BE0C: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC0BE10: 2A01000F slti $at, $s0, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (15) ? 1 : 0); + PGXP_ALU(0x2A01000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0BE10u); #endif @@ -185997,7 +186362,8 @@ label_BFC0BF38: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC0BF54: 28610014 slti $at, $v1, 20 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (20) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (20) ? 1 : 0); + PGXP_ALU(0x28610014u, cpu->gpr[1], _pgx1, 0x0014u); } #ifdef PSX_COSIM cosim_instr(0xBFC0BF54u); #endif @@ -190783,7 +191149,8 @@ label_BFC0C5F4: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC0C5FC: 29C12710 slti $at, $t6, 10000 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (10000) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (10000) ? 1 : 0); + PGXP_ALU(0x29C12710u, cpu->gpr[1], _pgx1, 0x2710u); } #ifdef PSX_COSIM cosim_instr(0xBFC0C5FCu); #endif @@ -190939,7 +191306,8 @@ label_BFC0C60C: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC0C62C: 29012710 slti $at, $t0, 10000 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (10000) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (10000) ? 1 : 0); + PGXP_ALU(0x29012710u, cpu->gpr[1], _pgx1, 0x2710u); } #ifdef PSX_COSIM cosim_instr(0xBFC0C62Cu); #endif @@ -191095,7 +191463,8 @@ label_BFC0C648: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC0C654: 2921000A slti $at, $t1, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (10) ? 1 : 0); + PGXP_ALU(0x2921000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC0C654u); #endif @@ -191297,7 +191666,8 @@ label_BFC0C678: psx_cyc_step(cpu, 0x2002u); #endif /* 0xBFC0C690: 29A1000A slti $at, $t5, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (10) ? 1 : 0); + PGXP_ALU(0x29A1000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC0C690u); #endif @@ -191417,7 +191787,8 @@ label_BFC0C6A4: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC0C6B0: 29C1000A slti $at, $t6, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (10) ? 1 : 0); + PGXP_ALU(0x29C1000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC0C6B0u); #endif @@ -191619,7 +191990,8 @@ label_BFC0C6D4: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC0C6EC: 2901000A slti $at, $t0, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (10) ? 1 : 0); + PGXP_ALU(0x2901000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0xBFC0C6ECu); #endif @@ -192293,7 +192665,8 @@ label_BFC0C790: psx_cyc_step(cpu, 0x28002u); #endif /* 0xBFC0C798: 01F1082A slt $at, $t7, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x01F1082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0C798u); #endif @@ -192449,7 +192822,8 @@ label_BFC0C7A8: psx_cyc_step(cpu, 0x20202u); #endif /* 0xBFC0C7C8: 0131082A slt $at, $t1, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0131082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0C7C8u); #endif @@ -194531,7 +194905,8 @@ label_BFC0C9EC: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC0C9F0: 2E210002 sltiu $at, $s1, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2E210002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC0C9F0u); #endif @@ -195821,7 +196196,8 @@ label_BFC0CB30: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC0CB38: 33280004 andi $t0, $t9, 0x4 */ - cpu->gpr[8] = cpu->gpr[25] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x4u; + PGXP_ALU(0x33280004u, cpu->gpr[8], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC0CB38u); #endif @@ -196500,7 +196876,8 @@ label_BFC0CBEC: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC0CBF4: 31AE0002 andi $t6, $t5, 0x2 */ - cpu->gpr[14] = cpu->gpr[13] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x2u; + PGXP_ALU(0x31AE0002u, cpu->gpr[14], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC0CBF4u); #endif @@ -197796,7 +198173,8 @@ label_BFC0CD20: psx_cyc_step(cpu, 0x302u); #endif /* 0xBFC0CD28: 01014824 and $t1, $t0, $at */ - cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[1]; + PGXP_ALU(0x01014824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0xBFC0CD28u); #endif @@ -199235,7 +199613,8 @@ label_BFC0CE94: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC0CE9C: 30580001 andi $t8, $v0, 0x1 */ - cpu->gpr[24] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30580001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC0CE9Cu); #endif @@ -199620,7 +199999,8 @@ label_BFC0CF00: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC0CF08: 304E0001 andi $t6, $v0, 0x1 */ - cpu->gpr[14] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC0CF08u); #endif @@ -200779,7 +201159,8 @@ label_BFC0CFF0: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC0CFF4: 28810709 slti $at, $a0, 1801 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1801) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1801) ? 1 : 0); + PGXP_ALU(0x28810709u, cpu->gpr[1], _pgx1, 0x0709u); } #ifdef PSX_COSIM cosim_instr(0xBFC0CFF4u); #endif @@ -200864,7 +201245,8 @@ label_BFC0D000: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC0D004: 28810097 slti $at, $a0, 151 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (151) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (151) ? 1 : 0); + PGXP_ALU(0x28810097u, cpu->gpr[1], _pgx1, 0x0097u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D004u); #endif @@ -200949,7 +201331,8 @@ label_BFC0D010: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC0D014: 2881006F slti $at, $a0, 111 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (111) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (111) ? 1 : 0); + PGXP_ALU(0x2881006Fu, cpu->gpr[1], _pgx1, 0x006Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0D014u); #endif @@ -201227,7 +201610,8 @@ label_BFC0D044: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC0D04C: 28810259 slti $at, $a0, 601 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (601) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (601) ? 1 : 0); + PGXP_ALU(0x28810259u, cpu->gpr[1], _pgx1, 0x0259u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D04Cu); #endif @@ -201504,7 +201888,8 @@ label_BFC0D07C: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC0D084: 28812581 slti $at, $a0, 9601 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (9601) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (9601) ? 1 : 0); + PGXP_ALU(0x28812581u, cpu->gpr[1], _pgx1, 0x2581u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D084u); #endif @@ -201589,7 +201974,8 @@ label_BFC0D090: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC0D094: 288112C1 slti $at, $a0, 4801 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (4801) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (4801) ? 1 : 0); + PGXP_ALU(0x288112C1u, cpu->gpr[1], _pgx1, 0x12C1u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D094u); #endif @@ -202396,7 +202782,8 @@ label_BFC0D11C: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC0D144: 30580001 andi $t8, $v0, 0x1 */ - cpu->gpr[24] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30580001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D144u); #endif @@ -202417,7 +202804,8 @@ label_BFC0D11C: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC0D14C: 30590010 andi $t9, $v0, 0x10 */ - cpu->gpr[25] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30590010u, cpu->gpr[25], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D14Cu); #endif @@ -202492,7 +202880,8 @@ label_BFC0D158: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC0D158: 30590010 andi $t9, $v0, 0x10 */ - cpu->gpr[25] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30590010u, cpu->gpr[25], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D158u); #endif @@ -202520,7 +202909,8 @@ label_BFC0D15C: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC0D160: 305900C0 andi $t9, $v0, 0xC0 */ - cpu->gpr[25] = cpu->gpr[2] & 0xC0u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0xC0u; + PGXP_ALU(0x305900C0u, cpu->gpr[25], _pgx1, 0x00C0u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D160u); #endif @@ -202573,7 +202963,8 @@ label_BFC0D164: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC0D16C: 31090001 andi $t1, $t0, 0x1 */ - cpu->gpr[9] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31090001u, cpu->gpr[9], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D16Cu); #endif @@ -203199,7 +203590,8 @@ label_BFC0D218: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC0D220: 31CF0001 andi $t7, $t6, 0x1 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31CF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D220u); #endif @@ -203352,7 +203744,8 @@ label_BFC0D240: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC0D240: 305900C0 andi $t9, $v0, 0xC0 */ - cpu->gpr[25] = cpu->gpr[2] & 0xC0u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0xC0u; + PGXP_ALU(0x305900C0u, cpu->gpr[25], _pgx1, 0x00C0u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D240u); #endif @@ -204595,7 +204988,8 @@ label_BFC0D34C: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC0D390: 33280002 andi $t0, $t9, 0x2 */ - cpu->gpr[8] = cpu->gpr[25] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x2u; + PGXP_ALU(0x33280002u, cpu->gpr[8], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D390u); #endif @@ -204702,7 +205096,8 @@ label_BFC0D3A4: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC0D3AC: 312A0002 andi $t2, $t1, 0x2 */ - cpu->gpr[10] = cpu->gpr[9] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x2u; + PGXP_ALU(0x312A0002u, cpu->gpr[10], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D3ACu); #endif @@ -204890,7 +205285,8 @@ label_BFC0D3D8: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC0D3E0: 31AE0004 andi $t6, $t5, 0x4 */ - cpu->gpr[14] = cpu->gpr[13] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x4u; + PGXP_ALU(0x31AE0004u, cpu->gpr[14], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D3E0u); #endif @@ -205053,7 +205449,8 @@ label_BFC0D400: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC0D408: 31F80004 andi $t8, $t7, 0x4 */ - cpu->gpr[24] = cpu->gpr[15] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x4u; + PGXP_ALU(0x31F80004u, cpu->gpr[24], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D408u); #endif @@ -205937,7 +206334,8 @@ label_BFC0D4F0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC0D4F4: 2C41000F sltiu $at, $v0, 15 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000000Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000000Fu ? 1 : 0); + PGXP_ALU(0x2C41000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0xBFC0D4F4u); #endif @@ -207768,7 +208166,8 @@ label_BFC0D6B4: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC0D6D4: 30510007 andi $s1, $v0, 0x7 */ - cpu->gpr[17] = cpu->gpr[2] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[17] = cpu->gpr[2] & 0x7u; + PGXP_ALU(0x30510007u, cpu->gpr[17], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D6D4u); #endif @@ -207789,7 +208188,8 @@ label_BFC0D6B4: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC0D6DC: 2A010005 slti $at, $s0, 5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (5) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (5) ? 1 : 0); + PGXP_ALU(0x2A010005u, cpu->gpr[1], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D6DCu); #endif @@ -207878,7 +208278,8 @@ label_BFC0D6E8: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC0D6F0: 2A010005 slti $at, $s0, 5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (5) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (5) ? 1 : 0); + PGXP_ALU(0x2A010005u, cpu->gpr[1], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0xBFC0D6F0u); #endif @@ -208377,7 +208778,8 @@ label_BFC0D764: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC0D768: 3059001D andi $t9, $v0, 0x1D */ - cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + PGXP_ALU(0x3059001Du, cpu->gpr[25], _pgx1, 0x001Du); } #ifdef PSX_COSIM cosim_instr(0xBFC0D768u); #endif @@ -208488,7 +208890,8 @@ label_BFC0D77C: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC0D77C: 3059001D andi $t9, $v0, 0x1D */ - cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + PGXP_ALU(0x3059001Du, cpu->gpr[25], _pgx1, 0x001Du); } #ifdef PSX_COSIM cosim_instr(0xBFC0D77Cu); #endif @@ -209026,7 +209429,8 @@ label_BFC0D7F4: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC0D7F8: 3059001D andi $t9, $v0, 0x1D */ - cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + PGXP_ALU(0x3059001Du, cpu->gpr[25], _pgx1, 0x001Du); } #ifdef PSX_COSIM cosim_instr(0xBFC0D7F8u); #endif @@ -209137,7 +209541,8 @@ label_BFC0D80C: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC0D80C: 3059001D andi $t9, $v0, 0x1D */ - cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + PGXP_ALU(0x3059001Du, cpu->gpr[25], _pgx1, 0x001Du); } #ifdef PSX_COSIM cosim_instr(0xBFC0D80Cu); #endif @@ -213728,7 +214133,8 @@ label_BFC100A8: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC100B0: 0043082B sltu $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000005B0u); #endif @@ -215055,7 +215461,8 @@ label_BFC107C0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC107C0: 3042003C andi $v0, $v0, 0x3C */ - cpu->gpr[2] = cpu->gpr[2] & 0x3Cu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x3Cu; + PGXP_ALU(0x3042003Cu, cpu->gpr[2], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x00000CC0u); #endif @@ -215128,7 +215535,8 @@ label_BFC107CC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC107D8: 304200FE andi $v0, $v0, 0xFE */ - cpu->gpr[2] = cpu->gpr[2] & 0xFEu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFEu; + PGXP_ALU(0x304200FEu, cpu->gpr[2], _pgx1, 0x00FEu); } #ifdef PSX_COSIM cosim_instr(0x00000CD8u); #endif @@ -217494,7 +217902,8 @@ label_BFC10B38: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC10B44: 0044082B sltu $at, $v0, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001044u); #endif @@ -217709,7 +218118,8 @@ label_BFC10B64: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC10B88: 0043082B sltu $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001088u); #endif @@ -217727,7 +218137,8 @@ label_BFC10B64: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC10B90: 0045082B sltu $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001090u); #endif @@ -217799,7 +218210,8 @@ label_BFC10B9C: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC10B9C: 0045082B sltu $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000109Cu); #endif @@ -217988,7 +218400,8 @@ label_BFC10BB8: psx_cyc_step(cpu, 0x8012u); #endif /* 0xBFC10BCC: 008F082B sltu $at, $a0, $t7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x008F082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000010CCu); #endif @@ -218815,7 +219228,8 @@ label_BFC10C74: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC10CAC: 02218824 and $s1, $s1, $at */ - cpu->gpr[17] = cpu->gpr[17] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[17] = cpu->gpr[17] & cpu->gpr[1]; + PGXP_ALU(0x02218824u, cpu->gpr[17], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000011ACu); #endif @@ -218928,7 +219342,8 @@ label_BFC10CB8: psx_cyc_step(cpu, 0x8006u); #endif /* 0xBFC10CCC: 004F082B sltu $at, $v0, $t7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x004F082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000011CCu); #endif @@ -219327,7 +219742,8 @@ label_BFC10D30: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC10D44: 30830001 andi $v1, $a0, 0x1 */ - cpu->gpr[3] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30830001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00001244u); #endif @@ -219400,7 +219816,8 @@ label_BFC10D50: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC10D58: 0044082B sltu $at, $v0, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001258u); #endif @@ -219450,7 +219867,8 @@ label_BFC10D5C: psx_cyc_step(cpu, 0x40210u); #endif /* 0xBFC10D64: 00924824 and $t1, $a0, $s2 */ - cpu->gpr[9] = cpu->gpr[4] & cpu->gpr[18]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[9] = cpu->gpr[4] & cpu->gpr[18]; + PGXP_ALU(0x00924824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001264u); #endif @@ -219498,7 +219916,8 @@ label_BFC10D70: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC10D70: 0044082B sltu $at, $v0, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001270u); #endif @@ -219523,7 +219942,8 @@ label_BFC10D74: psx_cyc_step(cpu, 0x20012u); #endif /* 0xBFC10D78: 0091082B sltu $at, $a0, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0091082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001278u); #endif @@ -219750,7 +220170,8 @@ label_BFC10DB8: psx_cyc_step(cpu, 0x20012u); #endif /* 0xBFC10DB8: 0091082B sltu $at, $a0, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0091082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000012B8u); #endif @@ -219880,7 +220301,8 @@ label_BFC10DC4: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC10DE4: 304E0001 andi $t6, $v0, 0x1 */ - cpu->gpr[14] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x000012E4u); #endif @@ -220146,7 +220568,8 @@ label_BFC10E20: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC10E20: 304E0001 andi $t6, $v0, 0x1 */ - cpu->gpr[14] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00001320u); #endif @@ -220203,7 +220626,8 @@ label_BFC10E2C: psx_cyc_step(cpu, 0x42004u); #endif /* 0xBFC10E2C: 00526824 and $t5, $v0, $s2 */ - cpu->gpr[13] = cpu->gpr[2] & cpu->gpr[18]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[13] = cpu->gpr[2] & cpu->gpr[18]; + PGXP_ALU(0x00526824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000132Cu); #endif @@ -220357,7 +220781,8 @@ label_BFC10E50: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC10E64: 30830001 andi $v1, $a0, 0x1 */ - cpu->gpr[3] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30830001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00001364u); #endif @@ -220781,7 +221206,8 @@ label_BFC10EC8: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC10EDC: 30830001 andi $v1, $a0, 0x1 */ - cpu->gpr[3] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30830001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x000013DCu); #endif @@ -222086,7 +222512,8 @@ label_BFC11008: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC11040: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001540u); #endif @@ -222683,7 +223110,8 @@ label_BFC110F8: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC110F8: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x000015F8u); #endif @@ -222691,7 +223119,8 @@ label_BFC110F8: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC110FC: 28810003 slti $at, $a0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + PGXP_ALU(0x28810003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x000015FCu); #endif @@ -222702,7 +223131,8 @@ label_BFC110F8: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC11100: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001600u); #endif @@ -222866,7 +223296,8 @@ label_BFC11114: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC11124: 00811026 xor $v0, $a0, $at */ - cpu->gpr[2] = cpu->gpr[4] ^ cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[4] ^ cpu->gpr[1]; + PGXP_ALU(0x00811026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001624u); #endif @@ -222895,7 +223326,8 @@ label_BFC11114: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC11130: 2C420001 sltiu $v0, $v0, 1 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[2] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00001630u); #endif @@ -223001,7 +223433,8 @@ label_BFC1114C: psx_cyc_step(cpu, 0x2000080u); #endif /* 0xBFC1114C: 30F90010 andi $t9, $a3, 0x10 */ - cpu->gpr[25] = cpu->gpr[7] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[25] = cpu->gpr[7] & 0x10u; + PGXP_ALU(0x30F90010u, cpu->gpr[25], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x0000164Cu); #endif @@ -223019,7 +223452,8 @@ label_BFC1114C: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC11154: 30E80001 andi $t0, $a3, 0x1 */ - cpu->gpr[8] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[8] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30E80001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00001654u); #endif @@ -223060,7 +223494,8 @@ label_BFC11158: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC1115C: 30E80001 andi $t0, $a3, 0x1 */ - cpu->gpr[8] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[8] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30E80001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x0000165Cu); #endif @@ -223085,7 +223520,8 @@ label_BFC11160: psx_cyc_step(cpu, 0x880u); #endif /* 0xBFC11164: 30EB1000 andi $t3, $a3, 0x1000 */ - cpu->gpr[11] = cpu->gpr[7] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[11] = cpu->gpr[7] & 0x1000u; + PGXP_ALU(0x30EB1000u, cpu->gpr[11], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x00001664u); #endif @@ -223183,7 +223619,8 @@ label_BFC11174: psx_cyc_step(cpu, 0x880u); #endif /* 0xBFC11178: 30EB1000 andi $t3, $a3, 0x1000 */ - cpu->gpr[11] = cpu->gpr[7] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[11] = cpu->gpr[7] & 0x1000u; + PGXP_ALU(0x30EB1000u, cpu->gpr[11], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x00001678u); #endif @@ -223215,7 +223652,8 @@ label_BFC1117C: psx_cyc_step(cpu, 0x480u); #endif /* 0xBFC1117C: 30EA0001 andi $t2, $a3, 0x1 */ - cpu->gpr[10] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[10] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30EA0001u, cpu->gpr[10], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x0000167Cu); #endif @@ -223233,7 +223671,8 @@ label_BFC1117C: psx_cyc_step(cpu, 0x880u); #endif /* 0xBFC11184: 30EB1000 andi $t3, $a3, 0x1000 */ - cpu->gpr[11] = cpu->gpr[7] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[11] = cpu->gpr[7] & 0x1000u; + PGXP_ALU(0x30EB1000u, cpu->gpr[11], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x00001684u); #endif @@ -223284,7 +223723,8 @@ label_BFC1118C: psx_cyc_step(cpu, 0x880u); #endif /* 0xBFC1118C: 30EB1000 andi $t3, $a3, 0x1000 */ - cpu->gpr[11] = cpu->gpr[7] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[11] = cpu->gpr[7] & 0x1000u; + PGXP_ALU(0x30EB1000u, cpu->gpr[11], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x0000168Cu); #endif @@ -223431,7 +223871,8 @@ label_BFC111AC: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC111AC: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x000016ACu); #endif @@ -223442,7 +223883,8 @@ label_BFC111AC: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC111B0: 28810003 slti $at, $a0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + PGXP_ALU(0x28810003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x000016B0u); #endif @@ -223645,7 +224087,8 @@ label_BFC111E4: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC111E8: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x000016E8u); #endif @@ -223704,7 +224147,8 @@ label_BFC111E4: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC11204: 28810003 slti $at, $a0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + PGXP_ALU(0x28810003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00001704u); #endif @@ -223857,7 +224301,8 @@ label_BFC11228: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC11228: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001728u); #endif @@ -223925,7 +224370,8 @@ label_BFC11228: psx_cyc_step(cpu, 0x3000001u); #endif /* 0xBFC11248: 0300C827 nor $t9, $t8, $zero */ - cpu->gpr[25] = ~(cpu->gpr[24] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[25] = ~(cpu->gpr[24] | cpu->gpr[0]); + PGXP_ALU(0x0300C827u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001748u); #endif @@ -223933,7 +224379,8 @@ label_BFC11228: psx_cyc_step(cpu, 0x2004100u); #endif /* 0xBFC1124C: 01D94024 and $t0, $t6, $t9 */ - cpu->gpr[8] = cpu->gpr[14] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[14] & cpu->gpr[25]; + PGXP_ALU(0x01D94024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000174Cu); #endif @@ -224004,7 +224451,8 @@ label_BFC1125C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC1125C: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x0000175Cu); #endif @@ -224015,7 +224463,8 @@ label_BFC1125C: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC11260: 28810003 slti $at, $a0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + PGXP_ALU(0x28810003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x00001760u); #endif @@ -224273,7 +224722,8 @@ label_BFC11294: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC112AC: 31CF0010 andi $t7, $t6, 0x10 */ - cpu->gpr[15] = cpu->gpr[14] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x10u; + PGXP_ALU(0x31CF0010u, cpu->gpr[15], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x000017ACu); #endif @@ -224340,7 +224790,8 @@ label_BFC112B8: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC112C0: 33190010 andi $t9, $t8, 0x10 */ - cpu->gpr[25] = cpu->gpr[24] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x10u; + PGXP_ALU(0x33190010u, cpu->gpr[25], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x000017C0u); #endif @@ -224631,7 +225082,8 @@ label_BFC112F4: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC1130C: 31CF0020 andi $t7, $t6, 0x20 */ - cpu->gpr[15] = cpu->gpr[14] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x20u; + PGXP_ALU(0x31CF0020u, cpu->gpr[15], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x0000180Cu); #endif @@ -224698,7 +225150,8 @@ label_BFC11318: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC11320: 33190020 andi $t9, $t8, 0x20 */ - cpu->gpr[25] = cpu->gpr[24] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x20u; + PGXP_ALU(0x33190020u, cpu->gpr[25], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x00001820u); #endif @@ -225004,7 +225457,8 @@ label_BFC11358: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC11370: 31CF0040 andi $t7, $t6, 0x40 */ - cpu->gpr[15] = cpu->gpr[14] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x40u; + PGXP_ALU(0x31CF0040u, cpu->gpr[15], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x00001870u); #endif @@ -225068,7 +225522,8 @@ label_BFC1137C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC11384: 33190040 andi $t9, $t8, 0x40 */ - cpu->gpr[25] = cpu->gpr[24] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x40u; + PGXP_ALU(0x33190040u, cpu->gpr[25], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x00001884u); #endif @@ -225371,7 +225826,8 @@ label_BFC113BC: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC113D4: 31CF0001 andi $t7, $t6, 0x1 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31CF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x000018D4u); #endif @@ -225432,7 +225888,8 @@ label_BFC113E0: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC113E8: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x000018E8u); #endif @@ -226513,7 +226970,8 @@ label_BFC11500: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC11520: 3063003C andi $v1, $v1, 0x3C */ - cpu->gpr[3] = cpu->gpr[3] & 0x3Cu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x3Cu; + PGXP_ALU(0x3063003Cu, cpu->gpr[3], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x00001A20u); #endif @@ -226648,7 +227106,8 @@ label_BFC1152C: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC11538: 2C610004 sltiu $at, $v1, 4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000004u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000004u ? 1 : 0); + PGXP_ALU(0x2C610004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00001A38u); #endif @@ -226829,7 +227288,8 @@ label_BFC11560: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC11568: 31090404 andi $t1, $t0, 0x404 */ - cpu->gpr[9] = cpu->gpr[8] & 0x404u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x404u; + PGXP_ALU(0x31090404u, cpu->gpr[9], _pgx1, 0x0404u); } #ifdef PSX_COSIM cosim_instr(0x00001A68u); #endif @@ -226962,7 +227422,8 @@ label_BFC11584: psx_cyc_step(cpu, 0x1802u); #endif /* 0xBFC1158C: 01616024 and $t4, $t3, $at */ - cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[1]; + PGXP_ALU(0x01616024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001A8Cu); #endif @@ -227964,7 +228425,8 @@ label_BFC11644: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC11694: 0062082B sltu $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001B94u); #endif @@ -228481,7 +228943,8 @@ label_BFC11720: psx_cyc_step(cpu, 0x110002u); #endif /* 0xBFC11724: 0214082B sltu $at, $s0, $s4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[20] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[20] ? 1 : 0); + PGXP_ALU(0x0214082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001C24u); #endif @@ -228793,7 +229256,8 @@ label_BFC1175C: psx_cyc_step(cpu, 0x8Au); #endif /* 0xBFC11790: 0067082B sltu $at, $v1, $a3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x0067082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001C90u); #endif @@ -229124,7 +229588,8 @@ label_BFC117E8: psx_cyc_step(cpu, 0x46u); #endif /* 0xBFC117EC: 0046082B sltu $at, $v0, $a2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x0046082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001CECu); #endif @@ -229340,7 +229805,8 @@ label_BFC11800: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC11834: 01C2082B sltu $at, $t6, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x01C2082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001D34u); #endif @@ -229583,7 +230049,8 @@ label_BFC11870: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC11874: 0062082B sltu $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001D74u); #endif @@ -230117,7 +230584,8 @@ label_BFC1191C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC1191C: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001E1Cu); #endif @@ -230245,7 +230713,8 @@ label_BFC11944: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC11944: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001E44u); #endif @@ -230725,7 +231194,8 @@ label_BFC119C8: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC119C8: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001EC8u); #endif @@ -230970,7 +231440,8 @@ label_BFC11A10: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC11A10: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001F10u); #endif @@ -231172,7 +231643,8 @@ label_BFC11A4C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC11A4C: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x00001F4Cu); #endif @@ -231502,7 +231974,8 @@ label_BFC11A88: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC11ABC: 01C2082B sltu $at, $t6, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x01C2082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00001FBCu); #endif @@ -231752,7 +232225,8 @@ label_BFC11AFC: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC11B00: 0062082B sltu $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002000u); #endif @@ -232289,7 +232763,8 @@ label_BFC11BA8: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC11BA8: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x000020A8u); #endif @@ -232434,7 +232909,8 @@ label_BFC11BD4: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC11BD8: 3063FFFF andi $v1, $v1, 0xFFFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + PGXP_ALU(0x3063FFFFu, cpu->gpr[3], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x000020D8u); #endif @@ -233318,7 +233794,8 @@ label_BFC11C8C: psx_cyc_step(cpu, 0x100C000u); #endif /* 0xBFC11CA8: 01CFC024 and $t8, $t6, $t7 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + PGXP_ALU(0x01CFC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000021A8u); #endif @@ -233326,7 +233803,8 @@ label_BFC11C8C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC11CAC: 33190004 andi $t9, $t8, 0x4 */ - cpu->gpr[25] = cpu->gpr[24] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x4u; + PGXP_ALU(0x33190004u, cpu->gpr[25], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x000021ACu); #endif @@ -233490,7 +233968,8 @@ label_BFC11CD4: psx_cyc_step(cpu, 0x700u); #endif /* 0xBFC11CE0: 01095024 and $t2, $t0, $t1 */ - cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + PGXP_ALU(0x01095024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000021E0u); #endif @@ -233498,7 +233977,8 @@ label_BFC11CD4: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC11CE4: 314B0200 andi $t3, $t2, 0x200 */ - cpu->gpr[11] = cpu->gpr[10] & 0x200u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x200u; + PGXP_ALU(0x314B0200u, cpu->gpr[11], _pgx1, 0x0200u); } #ifdef PSX_COSIM cosim_instr(0x000021E4u); #endif @@ -233653,7 +234133,8 @@ label_BFC11D0C: psx_cyc_step(cpu, 0x7000u); #endif /* 0xBFC11D18: 018D7024 and $t6, $t4, $t5 */ - cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + PGXP_ALU(0x018D7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002218u); #endif @@ -233661,7 +234142,8 @@ label_BFC11D0C: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC11D1C: 31CF0002 andi $t7, $t6, 0x2 */ - cpu->gpr[15] = cpu->gpr[14] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x2u; + PGXP_ALU(0x31CF0002u, cpu->gpr[15], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x0000221Cu); #endif @@ -233825,7 +234307,8 @@ label_BFC11D44: psx_cyc_step(cpu, 0x3000100u); #endif /* 0xBFC11D50: 03194024 and $t0, $t8, $t9 */ - cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + PGXP_ALU(0x03194024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002250u); #endif @@ -233833,7 +234316,8 @@ label_BFC11D44: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC11D54: 31090400 andi $t1, $t0, 0x400 */ - cpu->gpr[9] = cpu->gpr[8] & 0x400u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x400u; + PGXP_ALU(0x31090400u, cpu->gpr[9], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x00002254u); #endif @@ -233988,7 +234472,8 @@ label_BFC11D7C: psx_cyc_step(cpu, 0x1C00u); #endif /* 0xBFC11D88: 014B6024 and $t4, $t2, $t3 */ - cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + PGXP_ALU(0x014B6024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002288u); #endif @@ -233996,7 +234481,8 @@ label_BFC11D7C: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC11D8C: 318D0100 andi $t5, $t4, 0x100 */ - cpu->gpr[13] = cpu->gpr[12] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x100u; + PGXP_ALU(0x318D0100u, cpu->gpr[13], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x0000228Cu); #endif @@ -234160,7 +234646,8 @@ label_BFC11DB4: psx_cyc_step(cpu, 0x100C000u); #endif /* 0xBFC11DC0: 01CFC024 and $t8, $t6, $t7 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + PGXP_ALU(0x01CFC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000022C0u); #endif @@ -234168,7 +234655,8 @@ label_BFC11DB4: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC11DC4: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x000022C4u); #endif @@ -234323,7 +234811,8 @@ label_BFC11DEC: psx_cyc_step(cpu, 0x700u); #endif /* 0xBFC11DF8: 01095024 and $t2, $t0, $t1 */ - cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + PGXP_ALU(0x01095024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000022F8u); #endif @@ -234331,7 +234820,8 @@ label_BFC11DEC: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC11DFC: 314B0010 andi $t3, $t2, 0x10 */ - cpu->gpr[11] = cpu->gpr[10] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x10u; + PGXP_ALU(0x314B0010u, cpu->gpr[11], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x000022FCu); #endif @@ -234495,7 +234985,8 @@ label_BFC11E24: psx_cyc_step(cpu, 0x7000u); #endif /* 0xBFC11E30: 018D7024 and $t6, $t4, $t5 */ - cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + PGXP_ALU(0x018D7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002330u); #endif @@ -234503,7 +234994,8 @@ label_BFC11E24: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC11E34: 31CF0020 andi $t7, $t6, 0x20 */ - cpu->gpr[15] = cpu->gpr[14] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x20u; + PGXP_ALU(0x31CF0020u, cpu->gpr[15], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x00002334u); #endif @@ -234658,7 +235150,8 @@ label_BFC11E5C: psx_cyc_step(cpu, 0x3000100u); #endif /* 0xBFC11E68: 03194024 and $t0, $t8, $t9 */ - cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + PGXP_ALU(0x03194024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002368u); #endif @@ -234666,7 +235159,8 @@ label_BFC11E5C: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC11E6C: 31090040 andi $t1, $t0, 0x40 */ - cpu->gpr[9] = cpu->gpr[8] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x40u; + PGXP_ALU(0x31090040u, cpu->gpr[9], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x0000236Cu); #endif @@ -234830,7 +235324,8 @@ label_BFC11E94: psx_cyc_step(cpu, 0x1C00u); #endif /* 0xBFC11EA0: 014B6024 and $t4, $t2, $t3 */ - cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + PGXP_ALU(0x014B6024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000023A0u); #endif @@ -234838,7 +235333,8 @@ label_BFC11E94: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC11EA4: 318D0080 andi $t5, $t4, 0x80 */ - cpu->gpr[13] = cpu->gpr[12] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x80u; + PGXP_ALU(0x318D0080u, cpu->gpr[13], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000023A4u); #endif @@ -234993,7 +235489,8 @@ label_BFC11ECC: psx_cyc_step(cpu, 0x100C000u); #endif /* 0xBFC11ED8: 01CFC024 and $t8, $t6, $t7 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + PGXP_ALU(0x01CFC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000023D8u); #endif @@ -235001,7 +235498,8 @@ label_BFC11ECC: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC11EDC: 33190008 andi $t9, $t8, 0x8 */ - cpu->gpr[25] = cpu->gpr[24] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x8u; + PGXP_ALU(0x33190008u, cpu->gpr[25], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x000023DCu); #endif @@ -235345,7 +235843,8 @@ label_BFC11F40: psx_cyc_step(cpu, 0x811u); #endif /* 0xBFC11F40: 00805827 nor $t3, $a0, $zero */ - cpu->gpr[11] = ~(cpu->gpr[4] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[11] = ~(cpu->gpr[4] | cpu->gpr[0]); + PGXP_ALU(0x00805827u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002440u); #endif @@ -235561,7 +236060,8 @@ label_BFC11F58: psx_cyc_step(cpu, 0x100C000u); #endif /* 0xBFC11F74: 01CFC024 and $t8, $t6, $t7 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + PGXP_ALU(0x01CFC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002474u); #endif @@ -235569,7 +236069,8 @@ label_BFC11F58: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC11F78: 33190004 andi $t9, $t8, 0x4 */ - cpu->gpr[25] = cpu->gpr[24] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x4u; + PGXP_ALU(0x33190004u, cpu->gpr[25], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00002478u); #endif @@ -235727,7 +236228,8 @@ label_BFC11FA0: psx_cyc_step(cpu, 0x700u); #endif /* 0xBFC11FAC: 01095024 and $t2, $t0, $t1 */ - cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + PGXP_ALU(0x01095024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000024ACu); #endif @@ -235738,7 +236240,8 @@ label_BFC11FA0: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC11FB0: 314B0200 andi $t3, $t2, 0x200 */ - cpu->gpr[11] = cpu->gpr[10] & 0x200u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x200u; + PGXP_ALU(0x314B0200u, cpu->gpr[11], _pgx1, 0x0200u); } #ifdef PSX_COSIM cosim_instr(0x000024B0u); #endif @@ -235899,7 +236402,8 @@ label_BFC11FD8: psx_cyc_step(cpu, 0x7000u); #endif /* 0xBFC11FE4: 018D7024 and $t6, $t4, $t5 */ - cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + PGXP_ALU(0x018D7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000024E4u); #endif @@ -235907,7 +236411,8 @@ label_BFC11FD8: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC11FE8: 31CF0002 andi $t7, $t6, 0x2 */ - cpu->gpr[15] = cpu->gpr[14] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x2u; + PGXP_ALU(0x31CF0002u, cpu->gpr[15], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x000024E8u); #endif @@ -236065,7 +236570,8 @@ label_BFC12010: psx_cyc_step(cpu, 0x3000100u); #endif /* 0xBFC1201C: 03194024 and $t0, $t8, $t9 */ - cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + PGXP_ALU(0x03194024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000251Cu); #endif @@ -236076,7 +236582,8 @@ label_BFC12010: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC12020: 31090400 andi $t1, $t0, 0x400 */ - cpu->gpr[9] = cpu->gpr[8] & 0x400u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x400u; + PGXP_ALU(0x31090400u, cpu->gpr[9], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x00002520u); #endif @@ -236237,7 +236744,8 @@ label_BFC12048: psx_cyc_step(cpu, 0x1C00u); #endif /* 0xBFC12054: 014B6024 and $t4, $t2, $t3 */ - cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + PGXP_ALU(0x014B6024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002554u); #endif @@ -236245,7 +236753,8 @@ label_BFC12048: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC12058: 318D0100 andi $t5, $t4, 0x100 */ - cpu->gpr[13] = cpu->gpr[12] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x100u; + PGXP_ALU(0x318D0100u, cpu->gpr[13], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x00002558u); #endif @@ -236403,7 +236912,8 @@ label_BFC12080: psx_cyc_step(cpu, 0x100C000u); #endif /* 0xBFC1208C: 01CFC024 and $t8, $t6, $t7 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + PGXP_ALU(0x01CFC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000258Cu); #endif @@ -236414,7 +236924,8 @@ label_BFC12080: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC12090: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00002590u); #endif @@ -236575,7 +237086,8 @@ label_BFC120B8: psx_cyc_step(cpu, 0x700u); #endif /* 0xBFC120C4: 01095024 and $t2, $t0, $t1 */ - cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + PGXP_ALU(0x01095024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000025C4u); #endif @@ -236583,7 +237095,8 @@ label_BFC120B8: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC120C8: 314B0010 andi $t3, $t2, 0x10 */ - cpu->gpr[11] = cpu->gpr[10] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x10u; + PGXP_ALU(0x314B0010u, cpu->gpr[11], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x000025C8u); #endif @@ -236741,7 +237254,8 @@ label_BFC120F0: psx_cyc_step(cpu, 0x7000u); #endif /* 0xBFC120FC: 018D7024 and $t6, $t4, $t5 */ - cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + PGXP_ALU(0x018D7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000025FCu); #endif @@ -236752,7 +237266,8 @@ label_BFC120F0: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC12100: 31CF0020 andi $t7, $t6, 0x20 */ - cpu->gpr[15] = cpu->gpr[14] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x20u; + PGXP_ALU(0x31CF0020u, cpu->gpr[15], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x00002600u); #endif @@ -236913,7 +237428,8 @@ label_BFC12128: psx_cyc_step(cpu, 0x3000100u); #endif /* 0xBFC12134: 03194024 and $t0, $t8, $t9 */ - cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + PGXP_ALU(0x03194024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002634u); #endif @@ -236921,7 +237437,8 @@ label_BFC12128: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC12138: 31090040 andi $t1, $t0, 0x40 */ - cpu->gpr[9] = cpu->gpr[8] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x40u; + PGXP_ALU(0x31090040u, cpu->gpr[9], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x00002638u); #endif @@ -237079,7 +237596,8 @@ label_BFC12160: psx_cyc_step(cpu, 0x1C00u); #endif /* 0xBFC1216C: 014B6024 and $t4, $t2, $t3 */ - cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + PGXP_ALU(0x014B6024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000266Cu); #endif @@ -237090,7 +237608,8 @@ label_BFC12160: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC12170: 318D0080 andi $t5, $t4, 0x80 */ - cpu->gpr[13] = cpu->gpr[12] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x80u; + PGXP_ALU(0x318D0080u, cpu->gpr[13], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00002670u); #endif @@ -237251,7 +237770,8 @@ label_BFC12198: psx_cyc_step(cpu, 0x100C000u); #endif /* 0xBFC121A4: 01CFC024 and $t8, $t6, $t7 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + PGXP_ALU(0x01CFC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000026A4u); #endif @@ -237259,7 +237779,8 @@ label_BFC12198: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC121A8: 33190008 andi $t9, $t8, 0x8 */ - cpu->gpr[25] = cpu->gpr[24] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x8u; + PGXP_ALU(0x33190008u, cpu->gpr[25], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x000026A8u); #endif @@ -237597,7 +238118,8 @@ label_BFC1220C: psx_cyc_step(cpu, 0x811u); #endif /* 0xBFC1220C: 00805827 nor $t3, $a0, $zero */ - cpu->gpr[11] = ~(cpu->gpr[4] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[11] = ~(cpu->gpr[4] | cpu->gpr[0]); + PGXP_ALU(0x00805827u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000270Cu); #endif @@ -241614,7 +242136,8 @@ label_BFC12670: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC12680: 33190010 andi $t9, $t8, 0x10 */ - cpu->gpr[25] = cpu->gpr[24] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x10u; + PGXP_ALU(0x33190010u, cpu->gpr[25], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00002B80u); #endif @@ -241855,7 +242378,8 @@ label_BFC126B8: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC126D4: 318D0004 andi $t5, $t4, 0x4 */ - cpu->gpr[13] = cpu->gpr[12] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x4u; + PGXP_ALU(0x318D0004u, cpu->gpr[13], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00002BD4u); #endif @@ -242890,7 +243414,8 @@ label_BFC127DC: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC127EC: 33190010 andi $t9, $t8, 0x10 */ - cpu->gpr[25] = cpu->gpr[24] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x10u; + PGXP_ALU(0x33190010u, cpu->gpr[25], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x00002CECu); #endif @@ -243131,7 +243656,8 @@ label_BFC12824: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC12840: 318D0004 andi $t5, $t4, 0x4 */ - cpu->gpr[13] = cpu->gpr[12] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x4u; + PGXP_ALU(0x318D0004u, cpu->gpr[13], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00002D40u); #endif @@ -245110,7 +245636,8 @@ label_BFC12A5C: psx_cyc_step(cpu, 0x100000Au); #endif /* 0xBFC12A5C: 0061C024 and $t8, $v1, $at */ - cpu->gpr[24] = cpu->gpr[3] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[3] & cpu->gpr[1]; + PGXP_ALU(0x0061C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00002F5Cu); #endif @@ -246215,7 +246742,8 @@ label_BFC12B90: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC12B94: 0062082B sltu $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003094u); #endif @@ -246423,7 +246951,8 @@ label_BFC12BC8: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC12BCC: 28810010 slti $at, $a0, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (16) ? 1 : 0); + PGXP_ALU(0x28810010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x000030CCu); #endif @@ -246844,7 +247373,8 @@ label_BFC12C08: psx_cyc_step(cpu, 0x3000002u); #endif /* 0xBFC12C40: 0319082B sltu $at, $t8, $t9 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0319082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003140u); #endif @@ -247151,7 +247681,8 @@ label_BFC12C7C: psx_cyc_step(cpu, 0x10402u); #endif /* 0xBFC12C98: 020A082B sltu $at, $s0, $t2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x020A082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003198u); #endif @@ -248112,7 +248643,8 @@ label_BFC12D8C: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC12DAC: 316C0044 andi $t4, $t3, 0x44 */ - cpu->gpr[12] = cpu->gpr[11] & 0x44u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x44u; + PGXP_ALU(0x316C0044u, cpu->gpr[12], _pgx1, 0x0044u); } #ifdef PSX_COSIM cosim_instr(0x000032ACu); #endif @@ -248217,7 +248749,8 @@ label_BFC12DBC: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC12DD0: 31F80044 andi $t8, $t7, 0x44 */ - cpu->gpr[24] = cpu->gpr[15] & 0x44u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x44u; + PGXP_ALU(0x31F80044u, cpu->gpr[24], _pgx1, 0x0044u); } #ifdef PSX_COSIM cosim_instr(0x000032D0u); #endif @@ -248434,7 +248967,8 @@ label_BFC12E04: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC12E18: 316C0004 andi $t4, $t3, 0x4 */ - cpu->gpr[12] = cpu->gpr[11] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x4u; + PGXP_ALU(0x316C0004u, cpu->gpr[12], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00003318u); #endif @@ -248971,7 +249505,8 @@ label_BFC12EA4: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC12EAC: 2CC10010 sltiu $at, $a2, 16 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < 0x00000010u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < 0x00000010u ? 1 : 0); + PGXP_ALU(0x2CC10010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x000033ACu); #endif @@ -249031,7 +249566,8 @@ label_BFC12EBC: psx_cyc_step(cpu, 0x82u); #endif /* 0xBFC12EBC: 2CE10010 sltiu $at, $a3, 16 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[7] < 0x00000010u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)(cpu->gpr[7] < 0x00000010u ? 1 : 0); + PGXP_ALU(0x2CE10010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x000033BCu); #endif @@ -249656,7 +250192,8 @@ label_BFC12F7C: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC12F80: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003480u); #endif @@ -249732,7 +250269,8 @@ label_BFC12F8C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC12F9C: 30420002 andi $v0, $v0, 0x2 */ - cpu->gpr[2] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30420002u, cpu->gpr[2], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x0000349Cu); #endif @@ -249743,7 +250281,8 @@ label_BFC12F8C: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC12FA0: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000034A0u); #endif @@ -250066,7 +250605,8 @@ label_BFC12FF4: psx_cyc_step(cpu, 0x3000002u); #endif /* 0xBFC13008: 0319082B sltu $at, $t8, $t9 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0319082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003508u); #endif @@ -250084,7 +250624,8 @@ label_BFC12FF4: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC13010: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00003510u); #endif @@ -250248,7 +250789,8 @@ label_BFC1302C: psx_cyc_step(cpu, 0x400Au); #endif /* 0xBFC13038: 006E082B sltu $at, $v1, $t6 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x006E082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003538u); #endif @@ -256481,7 +257023,8 @@ label_BFC1372C: psx_cyc_step(cpu, 0x1000006u); #endif /* 0xBFC13758: 0058082B sltu $at, $v0, $t8 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x0058082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003C58u); #endif @@ -256890,7 +257433,8 @@ label_BFC137BC: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC137C0: 0062082B sltu $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003CC0u); #endif @@ -257184,7 +257728,8 @@ label_BFC137E0: psx_cyc_step(cpu, 0x3000002u); #endif /* 0xBFC13818: 0319082B sltu $at, $t8, $t9 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0319082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003D18u); #endif @@ -257554,7 +258099,8 @@ label_BFC13868: psx_cyc_step(cpu, 0x10802u); #endif /* 0xBFC13884: 020B082B sltu $at, $s0, $t3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x020B082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003D84u); #endif @@ -257823,7 +258369,8 @@ label_BFC138AC: psx_cyc_step(cpu, 0x1000006u); #endif /* 0xBFC138DC: 0058082B sltu $at, $v0, $t8 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x0058082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003DDCu); #endif @@ -258116,7 +258663,8 @@ label_BFC13934: psx_cyc_step(cpu, 0x10006u); #endif /* 0xBFC13938: 0202082B sltu $at, $s0, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0202082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003E38u); #endif @@ -258496,7 +259044,8 @@ label_BFC139A8: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC139B0: 31CF1000 andi $t7, $t6, 0x1000 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1000u; + PGXP_ALU(0x31CF1000u, cpu->gpr[15], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x00003EB0u); #endif @@ -258654,7 +259203,8 @@ label_BFC139DC: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC139E0: 0211082B sltu $at, $s0, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0211082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003EE0u); #endif @@ -258913,7 +259463,8 @@ label_BFC13A1C: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC13A24: 304E0001 andi $t6, $v0, 0x1 */ - cpu->gpr[14] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00003F24u); #endif @@ -258960,7 +259511,8 @@ label_BFC13A30: psx_cyc_step(cpu, 0x8040u); #endif /* 0xBFC13A30: 30CF00FF andi $t7, $a2, 0xFF */ - cpu->gpr[15] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00003F30u); #endif @@ -259016,7 +259568,8 @@ label_BFC13A40: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC13A40: 30580004 andi $t8, $v0, 0x4 */ - cpu->gpr[24] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30580004u, cpu->gpr[24], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00003F40u); #endif @@ -259031,7 +259584,8 @@ label_BFC13A40: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC13A48: 30C2007F andi $v0, $a2, 0x7F */ - cpu->gpr[2] = cpu->gpr[6] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[6] & 0x7Fu; + PGXP_ALU(0x30C2007Fu, cpu->gpr[2], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x00003F48u); #endif @@ -259151,7 +259705,8 @@ label_BFC13A68: psx_cyc_step(cpu, 0x44u); #endif /* 0xBFC13A68: 30C2007F andi $v0, $a2, 0x7F */ - cpu->gpr[2] = cpu->gpr[6] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[2] = cpu->gpr[6] & 0x7Fu; + PGXP_ALU(0x30C2007Fu, cpu->gpr[2], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x00003F68u); #endif @@ -259426,7 +259981,8 @@ label_BFC13AAC: psx_cyc_step(cpu, 0xC02u); #endif /* 0xBFC13AB4: 01415824 and $t3, $t2, $at */ - cpu->gpr[11] = cpu->gpr[10] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[11] = cpu->gpr[10] & cpu->gpr[1]; + PGXP_ALU(0x01415824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00003FB4u); #endif @@ -259488,7 +260044,8 @@ label_BFC13AC0: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC13AC8: 318D0002 andi $t5, $t4, 0x2 */ - cpu->gpr[13] = cpu->gpr[12] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x2u; + PGXP_ALU(0x318D0002u, cpu->gpr[13], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00003FC8u); #endif @@ -259741,7 +260298,8 @@ label_BFC13B08: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC13B10: 3042007F andi $v0, $v0, 0x7F */ - cpu->gpr[2] = cpu->gpr[2] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x7Fu; + PGXP_ALU(0x3042007Fu, cpu->gpr[2], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x00004010u); #endif @@ -259996,7 +260554,8 @@ label_BFC13B4C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC13B50: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00004050u); #endif @@ -260421,7 +260980,8 @@ label_BFC13BAC: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC13BC0: 31F80007 andi $t8, $t7, 0x7 */ - cpu->gpr[24] = cpu->gpr[15] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x7u; + PGXP_ALU(0x31F80007u, cpu->gpr[24], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x000040C0u); #endif @@ -260638,7 +261198,8 @@ label_BFC13BE4: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC13BF4: 31090097 andi $t1, $t0, 0x97 */ - cpu->gpr[9] = cpu->gpr[8] & 0x97u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x97u; + PGXP_ALU(0x31090097u, cpu->gpr[9], _pgx1, 0x0097u); } #ifdef PSX_COSIM cosim_instr(0x000040F4u); #endif @@ -261581,7 +262142,8 @@ label_BFC13CEC: psx_cyc_step(cpu, 0x60002u); #endif /* 0xBFC13CF0: 0251082B sltu $at, $s2, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[18] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[18] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0251082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000041F0u); #endif @@ -261620,7 +262182,8 @@ label_BFC13CF4: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC13CF8: 308E00FF andi $t6, $a0, 0xFF */ - cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x000041F8u); #endif @@ -261698,7 +262261,8 @@ label_BFC13D04: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC13D08: 0230082B sltu $at, $s1, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0230082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00004208u); #endif @@ -261987,7 +262551,8 @@ label_BFC13D4C: psx_cyc_step(cpu, 0x60002u); #endif /* 0xBFC13D4C: 0251082B sltu $at, $s2, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[18] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[18] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0251082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x0000424Cu); #endif @@ -262212,7 +262777,8 @@ label_BFC13D7C: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC13D80: 308E00FF andi $t6, $a0, 0xFF */ - cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00004280u); #endif @@ -262265,7 +262831,8 @@ label_BFC13D84: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC13D94: 31F80097 andi $t8, $t7, 0x97 */ - cpu->gpr[24] = cpu->gpr[15] & 0x97u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x97u; + PGXP_ALU(0x31F80097u, cpu->gpr[24], _pgx1, 0x0097u); } #ifdef PSX_COSIM cosim_instr(0x00004294u); #endif @@ -262321,7 +262888,8 @@ label_BFC13DA0: psx_cyc_step(cpu, 0x2020002u); #endif /* 0xBFC13DA4: 0239082B sltu $at, $s1, $t9 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0239082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000042A4u); #endif @@ -263011,7 +263579,8 @@ label_BFC13E60: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC13E68: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00004368u); #endif @@ -264508,7 +265077,8 @@ label_BFC14048: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC14060: 31AE0001 andi $t6, $t5, 0x1 */ - cpu->gpr[14] = cpu->gpr[13] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x1u; + PGXP_ALU(0x31AE0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00004560u); #endif @@ -264573,7 +265143,8 @@ label_BFC1406C: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC14074: 31F80001 andi $t8, $t7, 0x1 */ - cpu->gpr[24] = cpu->gpr[15] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x1u; + PGXP_ALU(0x31F80001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00004574u); #endif @@ -264768,7 +265339,8 @@ label_BFC14090: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC140B8: 314B0002 andi $t3, $t2, 0x2 */ - cpu->gpr[11] = cpu->gpr[10] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x2u; + PGXP_ALU(0x314B0002u, cpu->gpr[11], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x000045B8u); #endif @@ -264832,7 +265404,8 @@ label_BFC140C4: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC140CC: 318D0002 andi $t5, $t4, 0x2 */ - cpu->gpr[13] = cpu->gpr[12] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x2u; + PGXP_ALU(0x318D0002u, cpu->gpr[13], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x000045CCu); #endif @@ -264938,7 +265511,8 @@ label_BFC140E4: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC140EC: 31CF0080 andi $t7, $t6, 0x80 */ - cpu->gpr[15] = cpu->gpr[14] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x80u; + PGXP_ALU(0x31CF0080u, cpu->gpr[15], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000045ECu); #endif @@ -265014,7 +265588,8 @@ label_BFC140FC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC14100: 28420051 slti $v0, $v0, 81 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + PGXP_ALU(0x28420051u, cpu->gpr[2], _pgx1, 0x0051u); } #ifdef PSX_COSIM cosim_instr(0x00004600u); #endif @@ -265022,7 +265597,8 @@ label_BFC140FC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC14104: 38420001 xori $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + PGXP_ALU(0x38420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00004604u); #endif @@ -265096,7 +265672,8 @@ label_BFC14114: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC1411C: 31090080 andi $t1, $t0, 0x80 */ - cpu->gpr[9] = cpu->gpr[8] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x80u; + PGXP_ALU(0x31090080u, cpu->gpr[9], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x0000461Cu); #endif @@ -265279,7 +265856,8 @@ label_BFC14138: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC14158: 31AE0002 andi $t6, $t5, 0x2 */ - cpu->gpr[14] = cpu->gpr[13] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x2u; + PGXP_ALU(0x31AE0002u, cpu->gpr[14], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00004658u); #endif @@ -265343,7 +265921,8 @@ label_BFC14164: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC1416C: 31F80002 andi $t8, $t7, 0x2 */ - cpu->gpr[24] = cpu->gpr[15] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x2u; + PGXP_ALU(0x31F80002u, cpu->gpr[24], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x0000466Cu); #endif @@ -265429,7 +266008,8 @@ label_BFC14178: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC14188: 3043000F andi $v1, $v0, 0xF */ - cpu->gpr[3] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3043000Fu, cpu->gpr[3], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x00004688u); #endif @@ -265555,7 +266135,8 @@ label_BFC141A8: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC141B0: 312A0080 andi $t2, $t1, 0x80 */ - cpu->gpr[10] = cpu->gpr[9] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x80u; + PGXP_ALU(0x312A0080u, cpu->gpr[10], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000046B0u); #endif @@ -265624,7 +266205,8 @@ label_BFC141C0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC141C4: 28420051 slti $v0, $v0, 81 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + PGXP_ALU(0x28420051u, cpu->gpr[2], _pgx1, 0x0051u); } #ifdef PSX_COSIM cosim_instr(0x000046C4u); #endif @@ -265632,7 +266214,8 @@ label_BFC141C0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC141C8: 38420001 xori $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + PGXP_ALU(0x38420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x000046C8u); #endif @@ -265709,7 +266292,8 @@ label_BFC141D8: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC141E0: 31AE0080 andi $t6, $t5, 0x80 */ - cpu->gpr[14] = cpu->gpr[13] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x80u; + PGXP_ALU(0x31AE0080u, cpu->gpr[14], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000046E0u); #endif @@ -265877,7 +266461,8 @@ label_BFC141FC: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC1421C: 33280002 andi $t0, $t9, 0x2 */ - cpu->gpr[8] = cpu->gpr[25] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x2u; + PGXP_ALU(0x33280002u, cpu->gpr[8], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x0000471Cu); #endif @@ -265944,7 +266529,8 @@ label_BFC14228: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC14230: 312A0002 andi $t2, $t1, 0x2 */ - cpu->gpr[10] = cpu->gpr[9] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x2u; + PGXP_ALU(0x312A0002u, cpu->gpr[10], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00004730u); #endif @@ -266121,7 +266707,8 @@ label_BFC1425C: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC14264: 316C0080 andi $t4, $t3, 0x80 */ - cpu->gpr[12] = cpu->gpr[11] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x80u; + PGXP_ALU(0x316C0080u, cpu->gpr[12], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00004764u); #endif @@ -266190,7 +266777,8 @@ label_BFC14274: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC14278: 28420051 slti $v0, $v0, 81 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + PGXP_ALU(0x28420051u, cpu->gpr[2], _pgx1, 0x0051u); } #ifdef PSX_COSIM cosim_instr(0x00004778u); #endif @@ -266198,7 +266786,8 @@ label_BFC14274: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1427C: 38420001 xori $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + PGXP_ALU(0x38420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x0000477Cu); #endif @@ -266275,7 +266864,8 @@ label_BFC1428C: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC14294: 31F80080 andi $t8, $t7, 0x80 */ - cpu->gpr[24] = cpu->gpr[15] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x80u; + PGXP_ALU(0x31F80080u, cpu->gpr[24], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00004794u); #endif @@ -266335,7 +266925,8 @@ label_BFC142A0: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC142A8: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000047A8u); #endif @@ -266385,7 +266976,8 @@ label_BFC142B4: psx_cyc_step(cpu, 0x200005u); #endif /* 0xBFC142B4: 0015102B sltu $v0, $zero, $s5 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0015102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000047B4u); #endif @@ -266526,7 +267118,8 @@ label_BFC142C8: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC142E8: 312A0002 andi $t2, $t1, 0x2 */ - cpu->gpr[10] = cpu->gpr[9] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x2u; + PGXP_ALU(0x312A0002u, cpu->gpr[10], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x000047E8u); #endif @@ -266590,7 +267183,8 @@ label_BFC142F4: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC142FC: 316C0080 andi $t4, $t3, 0x80 */ - cpu->gpr[12] = cpu->gpr[11] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x80u; + PGXP_ALU(0x316C0080u, cpu->gpr[12], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000047FCu); #endif @@ -266657,7 +267251,8 @@ label_BFC14308: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC14310: 31AE0002 andi $t6, $t5, 0x2 */ - cpu->gpr[14] = cpu->gpr[13] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x2u; + PGXP_ALU(0x31AE0002u, cpu->gpr[14], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00004810u); #endif @@ -266721,7 +267316,8 @@ label_BFC1431C: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC14324: 31F80002 andi $t8, $t7, 0x2 */ - cpu->gpr[24] = cpu->gpr[15] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x2u; + PGXP_ALU(0x31F80002u, cpu->gpr[24], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00004824u); #endif @@ -266827,7 +267423,8 @@ label_BFC1433C: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC14344: 33280002 andi $t0, $t9, 0x2 */ - cpu->gpr[8] = cpu->gpr[25] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x2u; + PGXP_ALU(0x33280002u, cpu->gpr[8], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00004844u); #endif @@ -266933,7 +267530,8 @@ label_BFC14350: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC1436C: 312A0080 andi $t2, $t1, 0x80 */ - cpu->gpr[10] = cpu->gpr[9] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x80u; + PGXP_ALU(0x312A0080u, cpu->gpr[10], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x0000486Cu); #endif @@ -267008,7 +267606,8 @@ label_BFC1437C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC14380: 28420051 slti $v0, $v0, 81 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + PGXP_ALU(0x28420051u, cpu->gpr[2], _pgx1, 0x0051u); } #ifdef PSX_COSIM cosim_instr(0x00004880u); #endif @@ -267016,7 +267615,8 @@ label_BFC1437C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC14384: 38420001 xori $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + PGXP_ALU(0x38420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00004884u); #endif @@ -267090,7 +267690,8 @@ label_BFC14394: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC1439C: 31AE0080 andi $t6, $t5, 0x80 */ - cpu->gpr[14] = cpu->gpr[13] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x80u; + PGXP_ALU(0x31AE0080u, cpu->gpr[14], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x0000489Cu); #endif @@ -267156,7 +267757,8 @@ label_BFC143A8: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC143B0: 0002102B sltu $v0, $zero, $v0 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0002102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000048B0u); #endif @@ -267203,7 +267805,8 @@ label_BFC143BC: psx_cyc_step(cpu, 0x200005u); #endif /* 0xBFC143BC: 0015102B sltu $v0, $zero, $s5 */ - cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[0]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[2] = (uint32_t)(cpu->gpr[0] < cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x0015102Bu, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000048BCu); #endif @@ -267341,7 +267944,8 @@ label_BFC143D0: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC143F0: 33280002 andi $t0, $t9, 0x2 */ - cpu->gpr[8] = cpu->gpr[25] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x2u; + PGXP_ALU(0x33280002u, cpu->gpr[8], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x000048F0u); #endif @@ -267405,7 +268009,8 @@ label_BFC143FC: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC14404: 312A0002 andi $t2, $t1, 0x2 */ - cpu->gpr[10] = cpu->gpr[9] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x2u; + PGXP_ALU(0x312A0002u, cpu->gpr[10], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00004904u); #endif @@ -268883,7 +269488,8 @@ label_BFC1454C: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC14560: 31CF0001 andi $t7, $t6, 0x1 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31CF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00004A60u); #endif @@ -268947,7 +269553,8 @@ label_BFC1456C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC14574: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00004A74u); #endif @@ -272918,7 +273525,8 @@ label_BFC149BC: psx_cyc_step(cpu, 0x610u); #endif /* 0xBFC149D4: 01245024 and $t2, $t1, $a0 */ - cpu->gpr[10] = cpu->gpr[9] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[10] = cpu->gpr[9] & cpu->gpr[4]; + PGXP_ALU(0x01245024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00004ED4u); #endif @@ -273138,7 +273746,8 @@ label_BFC14A0C: psx_cyc_step(cpu, 0x1810u); #endif /* 0xBFC14A24: 01646024 and $t4, $t3, $a0 */ - cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[4]; + PGXP_ALU(0x01646024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00004F24u); #endif @@ -273579,7 +274188,8 @@ label_BFC14A90: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC14AA8: 31CF0080 andi $t7, $t6, 0x80 */ - cpu->gpr[15] = cpu->gpr[14] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x80u; + PGXP_ALU(0x31CF0080u, cpu->gpr[15], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00004FA8u); #endif @@ -273643,7 +274253,8 @@ label_BFC14AB4: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC14ABC: 33190080 andi $t9, $t8, 0x80 */ - cpu->gpr[25] = cpu->gpr[24] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x80u; + PGXP_ALU(0x33190080u, cpu->gpr[25], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00004FBCu); #endif @@ -273766,7 +274377,8 @@ label_BFC14AD8: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC14AD8: 30480001 andi $t0, $v0, 0x1 */ - cpu->gpr[8] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30480001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00004FD8u); #endif @@ -274453,7 +275065,8 @@ label_BFC14B6C: psx_cyc_step(cpu, 0x1008010u); #endif /* 0xBFC14BA0: 01E4C024 and $t8, $t7, $a0 */ - cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[4]; + PGXP_ALU(0x01E4C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000050A0u); #endif @@ -274950,7 +275563,8 @@ label_BFC14C28: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC14C5C: 312A0001 andi $t2, $t1, 0x1 */ - cpu->gpr[10] = cpu->gpr[9] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x1u; + PGXP_ALU(0x312A0001u, cpu->gpr[10], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x0000515Cu); #endif @@ -275632,7 +276246,8 @@ label_BFC14CF4: psx_cyc_step(cpu, 0x8002u); #endif /* 0xBFC14D1C: 2DE1000A sltiu $at, $t7, 10 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2DE1000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x0000521Cu); #endif @@ -276008,7 +276623,8 @@ label_BFC14D58: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC14D7C: 312A000F andi $t2, $t1, 0xF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFu; + PGXP_ALU(0x312A000Fu, cpu->gpr[10], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x0000527Cu); #endif @@ -276512,7 +277128,8 @@ label_BFC14E40: psx_cyc_step(cpu, 0x208u); #endif /* 0xBFC14E40: 30690008 andi $t1, $v1, 0x8 */ - cpu->gpr[9] = cpu->gpr[3] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[9] = cpu->gpr[3] & 0x8u; + PGXP_ALU(0x30690008u, cpu->gpr[9], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x00005340u); #endif @@ -277009,7 +277626,8 @@ label_BFC14ED4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC14EE4: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x000053E4u); #endif @@ -277257,7 +277875,8 @@ label_BFC14F2C: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC14F34: 30A300FF andi $v1, $a1, 0xFF */ - cpu->gpr[3] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[3] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00005434u); #endif @@ -277398,7 +278017,8 @@ label_BFC14F2C: psx_cyc_step(cpu, 0x308u); #endif /* 0xBFC14F74: 01034826 xor $t1, $t0, $v1 */ - cpu->gpr[9] = cpu->gpr[8] ^ cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[9] = cpu->gpr[8] ^ cpu->gpr[3]; + PGXP_ALU(0x01034826u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00005474u); #endif @@ -278144,7 +278764,8 @@ label_BFC15074: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC1507C: 31090002 andi $t1, $t0, 0x2 */ - cpu->gpr[9] = cpu->gpr[8] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x2u; + PGXP_ALU(0x31090002u, cpu->gpr[9], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x0000557Cu); #endif @@ -278211,7 +278832,8 @@ label_BFC15088: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC15090: 314B0002 andi $t3, $t2, 0x2 */ - cpu->gpr[11] = cpu->gpr[10] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x2u; + PGXP_ALU(0x314B0002u, cpu->gpr[11], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00005590u); #endif @@ -278366,7 +278988,8 @@ label_BFC150B0: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC150C4: 304E0004 andi $t6, $v0, 0x4 */ - cpu->gpr[14] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x304E0004u, cpu->gpr[14], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x000055C4u); #endif @@ -279264,7 +279887,8 @@ label_BFC15188: psx_cyc_step(cpu, 0x1000002u); #endif /* 0xBFC151C0: 2F01000D sltiu $at, $t8, 13 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < 0x0000000Du ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < 0x0000000Du ? 1 : 0); + PGXP_ALU(0x2F01000Du, cpu->gpr[1], _pgx1, 0x000Du); } #ifdef PSX_COSIM cosim_instr(0x000056C0u); #endif @@ -279593,7 +280217,8 @@ label_BFC151FC: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC15220: 312A000F andi $t2, $t1, 0xF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFu; + PGXP_ALU(0x312A000Fu, cpu->gpr[10], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x00005720u); #endif @@ -280126,7 +280751,8 @@ label_BFC152DC: psx_cyc_step(cpu, 0x210u); #endif /* 0xBFC152DC: 30890008 andi $t1, $a0, 0x8 */ - cpu->gpr[9] = cpu->gpr[4] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[9] = cpu->gpr[4] & 0x8u; + PGXP_ALU(0x30890008u, cpu->gpr[9], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x000057DCu); #endif @@ -280667,7 +281293,8 @@ label_BFC15370: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC15380: 332800FF andi $t0, $t9, 0xFF */ - cpu->gpr[8] = cpu->gpr[25] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0xFFu; + PGXP_ALU(0x332800FFu, cpu->gpr[8], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00005880u); #endif @@ -280860,7 +281487,8 @@ label_BFC153B4: psx_cyc_step(cpu, 0x2040u); #endif /* 0xBFC153BC: 30CD00FF andi $t5, $a2, 0xFF */ - cpu->gpr[13] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[13] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30CD00FFu, cpu->gpr[13], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x000058BCu); #endif @@ -281643,7 +282271,8 @@ label_BFC15490: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC154BC: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x000059BCu); #endif @@ -281765,7 +282394,8 @@ label_BFC154D0: psx_cyc_step(cpu, 0x4040u); #endif /* 0xBFC154D0: 30CE00FF andi $t6, $a2, 0xFF */ - cpu->gpr[14] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[14] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30CE00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x000059D0u); #endif @@ -281773,7 +282403,8 @@ label_BFC154D0: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC154D4: 31CF00FF andi $t7, $t6, 0xFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x000059D4u); #endif @@ -281781,7 +282412,8 @@ label_BFC154D0: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC154D8: 305800FF andi $t8, $v0, 0xFF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x000059D8u); #endif @@ -281819,7 +282451,8 @@ label_BFC154D0: psx_cyc_step(cpu, 0x3008000u); #endif /* 0xBFC154E8: 01F8C826 xor $t9, $t7, $t8 */ - cpu->gpr[25] = cpu->gpr[15] ^ cpu->gpr[24]; + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[15] ^ cpu->gpr[24]; + PGXP_ALU(0x01F8C826u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000059E8u); #endif @@ -282056,7 +282689,8 @@ label_BFC15508: psx_cyc_step(cpu, 0x4040u); #endif /* 0xBFC15534: 30CE00FF andi $t6, $a2, 0xFF */ - cpu->gpr[14] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[14] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30CE00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00005A34u); #endif @@ -282453,7 +283087,8 @@ label_BFC15580: psx_cyc_step(cpu, 0x3800u); #endif /* 0xBFC155A4: 016C6826 xor $t5, $t3, $t4 */ - cpu->gpr[13] = cpu->gpr[11] ^ cpu->gpr[12]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[11] ^ cpu->gpr[12]; + PGXP_ALU(0x016C6826u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00005AA4u); #endif @@ -282803,7 +283438,8 @@ label_BFC15600: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC15608: 314B0002 andi $t3, $t2, 0x2 */ - cpu->gpr[11] = cpu->gpr[10] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x2u; + PGXP_ALU(0x314B0002u, cpu->gpr[11], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00005B08u); #endif @@ -282867,7 +283503,8 @@ label_BFC15614: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC1561C: 318D0002 andi $t5, $t4, 0x2 */ - cpu->gpr[13] = cpu->gpr[12] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x2u; + PGXP_ALU(0x318D0002u, cpu->gpr[13], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x00005B1Cu); #endif @@ -283295,7 +283932,8 @@ label_BFC15664: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC1567C: 2DC10004 sltiu $at, $t6, 4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000004u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000004u ? 1 : 0); + PGXP_ALU(0x2DC10004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00005B7Cu); #endif @@ -283627,7 +284265,8 @@ label_BFC156B8: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC156DC: 3328000F andi $t0, $t9, 0xF */ - cpu->gpr[8] = cpu->gpr[25] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0xFu; + PGXP_ALU(0x3328000Fu, cpu->gpr[8], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x00005BDCu); #endif @@ -284173,7 +284812,8 @@ label_BFC15798: psx_cyc_step(cpu, 0x2000008u); #endif /* 0xBFC15798: 30790004 andi $t9, $v1, 0x4 */ - cpu->gpr[25] = cpu->gpr[3] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[25] = cpu->gpr[3] & 0x4u; + PGXP_ALU(0x30790004u, cpu->gpr[25], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x00005C98u); #endif @@ -284458,7 +285098,8 @@ label_BFC157F0: psx_cyc_step(cpu, 0x808u); #endif /* 0xBFC157F0: 306B0008 andi $t3, $v1, 0x8 */ - cpu->gpr[11] = cpu->gpr[3] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[11] = cpu->gpr[3] & 0x8u; + PGXP_ALU(0x306B0008u, cpu->gpr[11], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x00005CF0u); #endif @@ -285818,7 +286459,8 @@ label_BFC15964: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC15974: 304F0001 andi $t7, $v0, 0x1 */ - cpu->gpr[15] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00005E74u); #endif @@ -285872,7 +286514,8 @@ label_BFC15980: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC15984: 28A10401 slti $at, $a1, 1025 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (1025) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (1025) ? 1 : 0); + PGXP_ALU(0x28A10401u, cpu->gpr[1], _pgx1, 0x0401u); } #ifdef PSX_COSIM cosim_instr(0x00005E84u); #endif @@ -286428,7 +287071,8 @@ label_BFC15A18: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC15A28: 304F0001 andi $t7, $v0, 0x1 */ - cpu->gpr[15] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00005F28u); #endif @@ -286485,7 +287129,8 @@ label_BFC15A34: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC15A38: 28A10401 slti $at, $a1, 1025 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (1025) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (1025) ? 1 : 0); + PGXP_ALU(0x28A10401u, cpu->gpr[1], _pgx1, 0x0401u); } #ifdef PSX_COSIM cosim_instr(0x00005F38u); #endif @@ -287038,7 +287683,8 @@ label_BFC15ACC: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC15ADC: 304F0001 andi $t7, $v0, 0x1 */ - cpu->gpr[15] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00005FDCu); #endif @@ -287544,7 +288190,8 @@ label_BFC15B7C: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC15B84: 304F0001 andi $t7, $v0, 0x1 */ - cpu->gpr[15] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x00006084u); #endif @@ -289028,7 +289675,8 @@ label_BFC15D18: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC15D28: 310900FF andi $t1, $t0, 0xFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00006228u); #endif @@ -289184,7 +289832,8 @@ label_BFC15D4C: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC15D64: 2DC10011 sltiu $at, $t6, 17 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2DC10011u, cpu->gpr[1], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x00006264u); #endif @@ -289245,7 +289894,8 @@ label_BFC15D70: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC15D78: 31F8FFBF andi $t8, $t7, 0xFFBF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFBFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFBFu; + PGXP_ALU(0x31F8FFBFu, cpu->gpr[24], _pgx1, 0xFFBFu); } #ifdef PSX_COSIM cosim_instr(0x00006278u); #endif @@ -289295,7 +289945,8 @@ label_BFC15D80: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC15D8C: 2D010011 sltiu $at, $t0, 17 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2D010011u, cpu->gpr[1], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x0000628Cu); #endif @@ -289362,7 +290013,8 @@ label_BFC15D98: psx_cyc_step(cpu, 0x2000200u); #endif /* 0xBFC15DA0: 3329FF7F andi $t1, $t9, 0xFF7F */ - cpu->gpr[9] = cpu->gpr[25] & 0xFF7Fu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[9] = cpu->gpr[25] & 0xFF7Fu; + PGXP_ALU(0x3329FF7Fu, cpu->gpr[9], _pgx1, 0xFF7Fu); } #ifdef PSX_COSIM cosim_instr(0x000062A0u); #endif @@ -289592,7 +290244,8 @@ label_BFC15DD8: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC15DE8: 31AE00FF andi $t6, $t5, 0xFF */ - cpu->gpr[14] = cpu->gpr[13] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0xFFu; + PGXP_ALU(0x31AE00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x000062E8u); #endif @@ -289748,7 +290401,8 @@ label_BFC15E0C: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC15E24: 2D210011 sltiu $at, $t1, 17 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2D210011u, cpu->gpr[1], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x00006324u); #endif @@ -289809,7 +290463,8 @@ label_BFC15E30: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC15E38: 314BFFBF andi $t3, $t2, 0xFFBF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFBFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFBFu; + PGXP_ALU(0x314BFFBFu, cpu->gpr[11], _pgx1, 0xFFBFu); } #ifdef PSX_COSIM cosim_instr(0x00006338u); #endif @@ -289859,7 +290514,8 @@ label_BFC15E40: psx_cyc_step(cpu, 0x2002u); #endif /* 0xBFC15E4C: 2DA10011 sltiu $at, $t5, 17 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2DA10011u, cpu->gpr[1], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x0000634Cu); #endif @@ -289926,7 +290582,8 @@ label_BFC15E58: psx_cyc_step(cpu, 0x5000u); #endif /* 0xBFC15E60: 318EFF7F andi $t6, $t4, 0xFF7F */ - cpu->gpr[14] = cpu->gpr[12] & 0xFF7Fu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[14] = cpu->gpr[12] & 0xFF7Fu; + PGXP_ALU(0x318EFF7Fu, cpu->gpr[14], _pgx1, 0xFF7Fu); } #ifdef PSX_COSIM cosim_instr(0x00006360u); #endif @@ -290666,7 +291323,8 @@ label_BFC15F30: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC15F38: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00006438u); #endif @@ -290792,7 +291450,8 @@ label_BFC15F4C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC15F4C: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x0000644Cu); #endif @@ -291112,7 +291771,8 @@ label_BFC15F74: psx_cyc_step(cpu, 0x4000004u); #endif /* 0xBFC15FC0: 0342D026 xor $k0, $k0, $v0 */ - cpu->gpr[26] = cpu->gpr[26] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[26]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[26] = cpu->gpr[26] ^ cpu->gpr[2]; + PGXP_ALU(0x0342D026u, cpu->gpr[26], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x000064C0u); #endif @@ -291173,7 +291833,8 @@ label_BFC15F74: psx_cyc_step(cpu, 0x4000002u); #endif /* 0xBFC15FDC: 2F410080 sltiu $at, $k0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[26] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[26]; cpu->gpr[1] = (uint32_t)(cpu->gpr[26] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2F410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000064DCu); #endif @@ -291488,7 +292149,8 @@ label_BFC16014: psx_cyc_step(cpu, 0x4000004u); #endif /* 0xBFC16060: 0342D026 xor $k0, $k0, $v0 */ - cpu->gpr[26] = cpu->gpr[26] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[26]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[26] = cpu->gpr[26] ^ cpu->gpr[2]; + PGXP_ALU(0x0342D026u, cpu->gpr[26], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x00006560u); #endif @@ -291549,7 +292211,8 @@ label_BFC16014: psx_cyc_step(cpu, 0x4000002u); #endif /* 0xBFC1607C: 2F41007F sltiu $at, $k0, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[26] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[26]; cpu->gpr[1] = (uint32_t)(cpu->gpr[26] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2F41007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x0000657Cu); #endif @@ -292177,7 +292840,8 @@ label_BFC1618C: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC1619C: 2DC10004 sltiu $at, $t6, 4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000004u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000004u ? 1 : 0); + PGXP_ALU(0x2DC10004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x0000669Cu); #endif @@ -292347,7 +293011,8 @@ label_BFC161C4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC161CC: 2C410040 sltiu $at, $v0, 64 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C410040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x000066CCu); #endif @@ -292365,7 +293030,8 @@ label_BFC161C4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC161D4: 2C41007F sltiu $at, $v0, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2C41007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x000066D4u); #endif @@ -292404,7 +293070,8 @@ label_BFC161D8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC161DC: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000066DCu); #endif @@ -292476,7 +293143,8 @@ label_BFC161E8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC161E8: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x000066E8u); #endif @@ -292504,7 +293172,8 @@ label_BFC161EC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC161F0: 2C4100AD sltiu $at, $v0, 173 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000ADu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000ADu ? 1 : 0); + PGXP_ALU(0x2C4100ADu, cpu->gpr[1], _pgx1, 0x00ADu); } #ifdef PSX_COSIM cosim_instr(0x000066F0u); #endif @@ -292543,7 +293212,8 @@ label_BFC161F4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC161F8: 2C4100B8 sltiu $at, $v0, 184 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B8u ? 1 : 0); + PGXP_ALU(0x2C4100B8u, cpu->gpr[1], _pgx1, 0x00B8u); } #ifdef PSX_COSIM cosim_instr(0x000066F8u); #endif @@ -292618,7 +293288,8 @@ label_BFC16204: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16204: 2C4100B8 sltiu $at, $v0, 184 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B8u ? 1 : 0); + PGXP_ALU(0x2C4100B8u, cpu->gpr[1], _pgx1, 0x00B8u); } #ifdef PSX_COSIM cosim_instr(0x00006704u); #endif @@ -292643,7 +293314,8 @@ label_BFC16208: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1620C: 2C4100C0 sltiu $at, $v0, 192 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C0u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C0u ? 1 : 0); + PGXP_ALU(0x2C4100C0u, cpu->gpr[1], _pgx1, 0x00C0u); } #ifdef PSX_COSIM cosim_instr(0x0000670Cu); #endif @@ -292682,7 +293354,8 @@ label_BFC16210: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16214: 2C4100C8 sltiu $at, $v0, 200 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C8u ? 1 : 0); + PGXP_ALU(0x2C4100C8u, cpu->gpr[1], _pgx1, 0x00C8u); } #ifdef PSX_COSIM cosim_instr(0x00006714u); #endif @@ -292754,7 +293427,8 @@ label_BFC16220: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16220: 2C4100C8 sltiu $at, $v0, 200 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C8u ? 1 : 0); + PGXP_ALU(0x2C4100C8u, cpu->gpr[1], _pgx1, 0x00C8u); } #ifdef PSX_COSIM cosim_instr(0x00006720u); #endif @@ -292779,7 +293453,8 @@ label_BFC16224: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16228: 2C4100CF sltiu $at, $v0, 207 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000CFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000CFu ? 1 : 0); + PGXP_ALU(0x2C4100CFu, cpu->gpr[1], _pgx1, 0x00CFu); } #ifdef PSX_COSIM cosim_instr(0x00006728u); #endif @@ -292821,7 +293496,8 @@ label_BFC1622C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16230: 2C4100DA sltiu $at, $v0, 218 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000DAu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000DAu ? 1 : 0); + PGXP_ALU(0x2C4100DAu, cpu->gpr[1], _pgx1, 0x00DAu); } #ifdef PSX_COSIM cosim_instr(0x00006730u); #endif @@ -292893,7 +293569,8 @@ label_BFC1623C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1623C: 2C4100DA sltiu $at, $v0, 218 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000DAu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000DAu ? 1 : 0); + PGXP_ALU(0x2C4100DAu, cpu->gpr[1], _pgx1, 0x00DAu); } #ifdef PSX_COSIM cosim_instr(0x0000673Cu); #endif @@ -292918,7 +293595,8 @@ label_BFC16240: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16244: 2C4100E9 sltiu $at, $v0, 233 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000E9u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000E9u ? 1 : 0); + PGXP_ALU(0x2C4100E9u, cpu->gpr[1], _pgx1, 0x00E9u); } #ifdef PSX_COSIM cosim_instr(0x00006744u); #endif @@ -292957,7 +293635,8 @@ label_BFC16248: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1624C: 2C4100F0 sltiu $at, $v0, 240 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F0u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F0u ? 1 : 0); + PGXP_ALU(0x2C4100F0u, cpu->gpr[1], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x0000674Cu); #endif @@ -293029,7 +293708,8 @@ label_BFC16258: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16258: 2C4100F0 sltiu $at, $v0, 240 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F0u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F0u ? 1 : 0); + PGXP_ALU(0x2C4100F0u, cpu->gpr[1], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x00006758u); #endif @@ -293057,7 +293737,8 @@ label_BFC1625C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16260: 2C4100F8 sltiu $at, $v0, 248 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F8u ? 1 : 0); + PGXP_ALU(0x2C4100F8u, cpu->gpr[1], _pgx1, 0x00F8u); } #ifdef PSX_COSIM cosim_instr(0x00006760u); #endif @@ -293421,7 +294102,8 @@ label_BFC162B8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC162C0: 2C41004F sltiu $at, $v0, 79 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000004Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000004Fu ? 1 : 0); + PGXP_ALU(0x2C41004Fu, cpu->gpr[1], _pgx1, 0x004Fu); } #ifdef PSX_COSIM cosim_instr(0x000067C0u); #endif @@ -293436,7 +294118,8 @@ label_BFC162B8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC162C8: 2C410059 sltiu $at, $v0, 89 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000059u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000059u ? 1 : 0); + PGXP_ALU(0x2C410059u, cpu->gpr[1], _pgx1, 0x0059u); } #ifdef PSX_COSIM cosim_instr(0x000067C8u); #endif @@ -293478,7 +294161,8 @@ label_BFC162CC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC162D0: 2C410060 sltiu $at, $v0, 96 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000060u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000060u ? 1 : 0); + PGXP_ALU(0x2C410060u, cpu->gpr[1], _pgx1, 0x0060u); } #ifdef PSX_COSIM cosim_instr(0x000067D0u); #endif @@ -293550,7 +294234,8 @@ label_BFC162DC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC162DC: 2C410060 sltiu $at, $v0, 96 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000060u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000060u ? 1 : 0); + PGXP_ALU(0x2C410060u, cpu->gpr[1], _pgx1, 0x0060u); } #ifdef PSX_COSIM cosim_instr(0x000067DCu); #endif @@ -293575,7 +294260,8 @@ label_BFC162E0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC162E4: 2C41007A sltiu $at, $v0, 122 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Au ? 1 : 0); + PGXP_ALU(0x2C41007Au, cpu->gpr[1], _pgx1, 0x007Au); } #ifdef PSX_COSIM cosim_instr(0x000067E4u); #endif @@ -293614,7 +294300,8 @@ label_BFC162E8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC162EC: 2C410081 sltiu $at, $v0, 129 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000081u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000081u ? 1 : 0); + PGXP_ALU(0x2C410081u, cpu->gpr[1], _pgx1, 0x0081u); } #ifdef PSX_COSIM cosim_instr(0x000067ECu); #endif @@ -293686,7 +294373,8 @@ label_BFC162F8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC162F8: 2C410081 sltiu $at, $v0, 129 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000081u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000081u ? 1 : 0); + PGXP_ALU(0x2C410081u, cpu->gpr[1], _pgx1, 0x0081u); } #ifdef PSX_COSIM cosim_instr(0x000067F8u); #endif @@ -293714,7 +294402,8 @@ label_BFC162FC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16300: 2C41009B sltiu $at, $v0, 155 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Bu ? 1 : 0); + PGXP_ALU(0x2C41009Bu, cpu->gpr[1], _pgx1, 0x009Bu); } #ifdef PSX_COSIM cosim_instr(0x00006800u); #endif @@ -293753,7 +294442,8 @@ label_BFC16304: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16308: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x00006808u); #endif @@ -293828,7 +294518,8 @@ label_BFC16314: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16314: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x00006814u); #endif @@ -293853,7 +294544,8 @@ label_BFC16318: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1631C: 2C4100F2 sltiu $at, $v0, 242 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F2u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F2u ? 1 : 0); + PGXP_ALU(0x2C4100F2u, cpu->gpr[1], _pgx1, 0x00F2u); } #ifdef PSX_COSIM cosim_instr(0x0000681Cu); #endif @@ -293930,7 +294622,8 @@ label_BFC1632C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1632C: 2C4100F2 sltiu $at, $v0, 242 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F2u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F2u ? 1 : 0); + PGXP_ALU(0x2C4100F2u, cpu->gpr[1], _pgx1, 0x00F2u); } #ifdef PSX_COSIM cosim_instr(0x0000682Cu); #endif @@ -294178,7 +294871,8 @@ label_BFC16370: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16378: 2C410040 sltiu $at, $v0, 64 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C410040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x00006878u); #endif @@ -294196,7 +294890,8 @@ label_BFC16370: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16380: 2C41007F sltiu $at, $v0, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2C41007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x00006880u); #endif @@ -294235,7 +294930,8 @@ label_BFC16384: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16388: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00006888u); #endif @@ -294310,7 +295006,8 @@ label_BFC16394: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16394: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00006894u); #endif @@ -294335,7 +295032,8 @@ label_BFC16398: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1639C: 2C410097 sltiu $at, $v0, 151 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000097u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000097u ? 1 : 0); + PGXP_ALU(0x2C410097u, cpu->gpr[1], _pgx1, 0x0097u); } #ifdef PSX_COSIM cosim_instr(0x0000689Cu); #endif @@ -294374,7 +295072,8 @@ label_BFC163A0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC163A4: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x000068A4u); #endif @@ -294446,7 +295145,8 @@ label_BFC163B0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC163B0: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x000068B0u); #endif @@ -294471,7 +295171,8 @@ label_BFC163B4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC163B8: 2C4100B7 sltiu $at, $v0, 183 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B7u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B7u ? 1 : 0); + PGXP_ALU(0x2C4100B7u, cpu->gpr[1], _pgx1, 0x00B7u); } #ifdef PSX_COSIM cosim_instr(0x000068B8u); #endif @@ -294513,7 +295214,8 @@ label_BFC163BC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC163C0: 2C4100BF sltiu $at, $v0, 191 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + PGXP_ALU(0x2C4100BFu, cpu->gpr[1], _pgx1, 0x00BFu); } #ifdef PSX_COSIM cosim_instr(0x000068C0u); #endif @@ -294585,7 +295287,8 @@ label_BFC163CC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC163CC: 2C4100BF sltiu $at, $v0, 191 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + PGXP_ALU(0x2C4100BFu, cpu->gpr[1], _pgx1, 0x00BFu); } #ifdef PSX_COSIM cosim_instr(0x000068CCu); #endif @@ -294610,7 +295313,8 @@ label_BFC163D0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC163D4: 2C4100D7 sltiu $at, $v0, 215 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000D7u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000D7u ? 1 : 0); + PGXP_ALU(0x2C4100D7u, cpu->gpr[1], _pgx1, 0x00D7u); } #ifdef PSX_COSIM cosim_instr(0x000068D4u); #endif @@ -294690,7 +295394,8 @@ label_BFC163E4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC163E4: 2C4100D7 sltiu $at, $v0, 215 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000D7u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000D7u ? 1 : 0); + PGXP_ALU(0x2C4100D7u, cpu->gpr[1], _pgx1, 0x00D7u); } #ifdef PSX_COSIM cosim_instr(0x000068E4u); #endif @@ -294938,7 +295643,8 @@ label_BFC16428: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16430: 2C410040 sltiu $at, $v0, 64 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C410040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x00006930u); #endif @@ -294953,7 +295659,8 @@ label_BFC16428: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16438: 2C410061 sltiu $at, $v0, 97 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000061u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000061u ? 1 : 0); + PGXP_ALU(0x2C410061u, cpu->gpr[1], _pgx1, 0x0061u); } #ifdef PSX_COSIM cosim_instr(0x00006938u); #endif @@ -294995,7 +295702,8 @@ label_BFC1643C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16440: 2C410070 sltiu $at, $v0, 112 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000070u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000070u ? 1 : 0); + PGXP_ALU(0x2C410070u, cpu->gpr[1], _pgx1, 0x0070u); } #ifdef PSX_COSIM cosim_instr(0x00006940u); #endif @@ -295067,7 +295775,8 @@ label_BFC1644C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1644C: 2C410070 sltiu $at, $v0, 112 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000070u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000070u ? 1 : 0); + PGXP_ALU(0x2C410070u, cpu->gpr[1], _pgx1, 0x0070u); } #ifdef PSX_COSIM cosim_instr(0x0000694Cu); #endif @@ -295092,7 +295801,8 @@ label_BFC16450: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16454: 2C41007F sltiu $at, $v0, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2C41007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x00006954u); #endif @@ -295131,7 +295841,8 @@ label_BFC16458: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1645C: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x0000695Cu); #endif @@ -295203,7 +295914,8 @@ label_BFC16468: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16468: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x00006968u); #endif @@ -295231,7 +295943,8 @@ label_BFC1646C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16470: 2C410092 sltiu $at, $v0, 146 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000092u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000092u ? 1 : 0); + PGXP_ALU(0x2C410092u, cpu->gpr[1], _pgx1, 0x0092u); } #ifdef PSX_COSIM cosim_instr(0x00006970u); #endif @@ -295270,7 +295983,8 @@ label_BFC16474: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16478: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x00006978u); #endif @@ -295345,7 +296059,8 @@ label_BFC16484: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC16484: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x00006984u); #endif @@ -295370,7 +296085,8 @@ label_BFC16488: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1648C: 2C4100BF sltiu $at, $v0, 191 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + PGXP_ALU(0x2C4100BFu, cpu->gpr[1], _pgx1, 0x00BFu); } #ifdef PSX_COSIM cosim_instr(0x0000698Cu); #endif @@ -295447,7 +296163,8 @@ label_BFC1649C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1649C: 2C4100BF sltiu $at, $v0, 191 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + PGXP_ALU(0x2C4100BFu, cpu->gpr[1], _pgx1, 0x00BFu); } #ifdef PSX_COSIM cosim_instr(0x0000699Cu); #endif @@ -295695,7 +296412,8 @@ label_BFC164E0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC164E8: 2C41007F sltiu $at, $v0, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2C41007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x000069E8u); #endif @@ -295832,7 +296550,8 @@ label_BFC16500: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC1650C: 316C00FF andi $t4, $t3, 0xFF */ - cpu->gpr[12] = cpu->gpr[11] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0xFFu; + PGXP_ALU(0x316C00FFu, cpu->gpr[12], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x00006A0Cu); #endif @@ -303017,7 +303736,8 @@ label_BFC18600: psx_cyc_step(cpu, 0x2010002u); #endif /* 0xBFC1860C: 0219082A slt $at, $s0, $t9 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0219082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003060Cu); #endif @@ -304535,7 +305255,8 @@ label_BFC18788: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC18788: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80030788u); #endif @@ -306073,7 +306794,8 @@ label_BFC18930: psx_cyc_step(cpu, 0x8012u); #endif /* 0xBFC18934: 00817824 and $t7, $a0, $at */ - cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80030934u); #endif @@ -306704,7 +307426,8 @@ label_BFC189B0: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC189BC: 2862003D slti $v0, $v1, 61 */ - cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[3] < (61) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[2] = (uint32_t)((int32_t)cpu->gpr[3] < (61) ? 1 : 0); + PGXP_ALU(0x2862003Du, cpu->gpr[2], _pgx1, 0x003Du); } #ifdef PSX_COSIM cosim_instr(0x800309BCu); #endif @@ -306715,7 +307438,8 @@ label_BFC189B0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC189C0: 38420001 xori $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + PGXP_ALU(0x38420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800309C0u); #endif @@ -315488,7 +316212,8 @@ label_BFC194F0: psx_cyc_step(cpu, 0x10102u); #endif /* 0xBFC194FC: 0208082A slt $at, $s0, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0208082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800314FCu); #endif @@ -317209,7 +317934,8 @@ label_BFC1970C: psx_cyc_step(cpu, 0x1000u); #endif /* 0xBFC19714: 318CFFF3 andi $t4, $t4, 0xFFF3 */ - cpu->gpr[12] = cpu->gpr[12] & 0xFFF3u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[12] = cpu->gpr[12] & 0xFFF3u; + PGXP_ALU(0x318CFFF3u, cpu->gpr[12], _pgx1, 0xFFF3u); } #ifdef PSX_COSIM cosim_instr(0x80031714u); #endif @@ -317843,7 +318569,8 @@ label_BFC197D8: psx_cyc_step(cpu, 0x208u); #endif /* 0xBFC197D8: 31230003 andi $v1, $t1, 0x3 */ - cpu->gpr[3] = cpu->gpr[9] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[3] = cpu->gpr[9] & 0x3u; + PGXP_ALU(0x31230003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x800317D8u); #endif @@ -317946,7 +318673,8 @@ label_BFC197F0: psx_cyc_step(cpu, 0x2004u); #endif /* 0xBFC197F8: 304D00C0 andi $t5, $v0, 0xC0 */ - cpu->gpr[13] = cpu->gpr[2] & 0xC0u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[13] = cpu->gpr[2] & 0xC0u; + PGXP_ALU(0x304D00C0u, cpu->gpr[13], _pgx1, 0x00C0u); } #ifdef PSX_COSIM cosim_instr(0x800317F8u); #endif @@ -317954,7 +318682,8 @@ label_BFC197F0: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC197FC: 304F0030 andi $t7, $v0, 0x30 */ - cpu->gpr[15] = cpu->gpr[2] & 0x30u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x30u; + PGXP_ALU(0x304F0030u, cpu->gpr[15], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x800317FCu); #endif @@ -318019,7 +318748,8 @@ label_BFC197F0: psx_cyc_step(cpu, 0x2004u); #endif /* 0xBFC19818: 304D000C andi $t5, $v0, 0xC */ - cpu->gpr[13] = cpu->gpr[2] & 0xCu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[13] = cpu->gpr[2] & 0xCu; + PGXP_ALU(0x304D000Cu, cpu->gpr[13], _pgx1, 0x000Cu); } #ifdef PSX_COSIM cosim_instr(0x80031818u); #endif @@ -318039,7 +318769,8 @@ label_BFC197F0: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC19820: 304E0003 andi $t6, $v0, 0x3 */ - cpu->gpr[14] = cpu->gpr[2] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x3u; + PGXP_ALU(0x304E0003u, cpu->gpr[14], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80031820u); #endif @@ -318210,7 +318941,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x2004u); #endif /* 0xBFC19850: 304D00C0 andi $t5, $v0, 0xC0 */ - cpu->gpr[13] = cpu->gpr[2] & 0xC0u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[13] = cpu->gpr[2] & 0xC0u; + PGXP_ALU(0x304D00C0u, cpu->gpr[13], _pgx1, 0x00C0u); } #ifdef PSX_COSIM cosim_instr(0x80031850u); #endif @@ -318218,7 +318950,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC19854: 304E0030 andi $t6, $v0, 0x30 */ - cpu->gpr[14] = cpu->gpr[2] & 0x30u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x30u; + PGXP_ALU(0x304E0030u, cpu->gpr[14], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x80031854u); #endif @@ -318283,7 +319016,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x2004u); #endif /* 0xBFC19870: 304D000C andi $t5, $v0, 0xC */ - cpu->gpr[13] = cpu->gpr[2] & 0xCu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[13] = cpu->gpr[2] & 0xCu; + PGXP_ALU(0x304D000Cu, cpu->gpr[13], _pgx1, 0x000Cu); } #ifdef PSX_COSIM cosim_instr(0x80031870u); #endif @@ -318300,7 +319034,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC19878: 304F0003 andi $t7, $v0, 0x3 */ - cpu->gpr[15] = cpu->gpr[2] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x3u; + PGXP_ALU(0x304F0003u, cpu->gpr[15], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80031878u); #endif @@ -318344,7 +319079,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x2000008u); #endif /* 0xBFC1988C: 307900C0 andi $t9, $v1, 0xC0 */ - cpu->gpr[25] = cpu->gpr[3] & 0xC0u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[25] = cpu->gpr[3] & 0xC0u; + PGXP_ALU(0x307900C0u, cpu->gpr[25], _pgx1, 0x00C0u); } #ifdef PSX_COSIM cosim_instr(0x8003188Cu); #endif @@ -318355,7 +319091,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x4008u); #endif /* 0xBFC19890: 306E0030 andi $t6, $v1, 0x30 */ - cpu->gpr[14] = cpu->gpr[3] & 0x30u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[14] = cpu->gpr[3] & 0x30u; + PGXP_ALU(0x306E0030u, cpu->gpr[14], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x80031890u); #endif @@ -318416,7 +319153,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x2000008u); #endif /* 0xBFC198AC: 3079000C andi $t9, $v1, 0xC */ - cpu->gpr[25] = cpu->gpr[3] & 0xCu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[25] = cpu->gpr[3] & 0xCu; + PGXP_ALU(0x3079000Cu, cpu->gpr[25], _pgx1, 0x000Cu); } #ifdef PSX_COSIM cosim_instr(0x800318ACu); #endif @@ -318436,7 +319174,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x2008u); #endif /* 0xBFC198B4: 306D0003 andi $t5, $v1, 0x3 */ - cpu->gpr[13] = cpu->gpr[3] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[13] = cpu->gpr[3] & 0x3u; + PGXP_ALU(0x306D0003u, cpu->gpr[13], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x800318B4u); #endif @@ -318479,7 +319218,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x1000010u); #endif /* 0xBFC198C8: 309800C0 andi $t8, $a0, 0xC0 */ - cpu->gpr[24] = cpu->gpr[4] & 0xC0u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[24] = cpu->gpr[4] & 0xC0u; + PGXP_ALU(0x309800C0u, cpu->gpr[24], _pgx1, 0x00C0u); } #ifdef PSX_COSIM cosim_instr(0x800318C8u); #endif @@ -318487,7 +319227,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC198CC: 308E0030 andi $t6, $a0, 0x30 */ - cpu->gpr[14] = cpu->gpr[4] & 0x30u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0x30u; + PGXP_ALU(0x308E0030u, cpu->gpr[14], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x800318CCu); #endif @@ -318551,7 +319292,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x1000010u); #endif /* 0xBFC198E8: 3098000C andi $t8, $a0, 0xC */ - cpu->gpr[24] = cpu->gpr[4] & 0xCu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[24] = cpu->gpr[4] & 0xCu; + PGXP_ALU(0x3098000Cu, cpu->gpr[24], _pgx1, 0x000Cu); } #ifdef PSX_COSIM cosim_instr(0x800318E8u); #endif @@ -318571,7 +319313,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x2000010u); #endif /* 0xBFC198F0: 30990003 andi $t9, $a0, 0x3 */ - cpu->gpr[25] = cpu->gpr[4] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[4] & 0x3u; + PGXP_ALU(0x30990003u, cpu->gpr[25], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x800318F0u); #endif @@ -318614,7 +319357,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x8020u); #endif /* 0xBFC19904: 30AF00C0 andi $t7, $a1, 0xC0 */ - cpu->gpr[15] = cpu->gpr[5] & 0xC0u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[15] = cpu->gpr[5] & 0xC0u; + PGXP_ALU(0x30AF00C0u, cpu->gpr[15], _pgx1, 0x00C0u); } #ifdef PSX_COSIM cosim_instr(0x80031904u); #endif @@ -318622,7 +319366,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x4020u); #endif /* 0xBFC19908: 30AE0030 andi $t6, $a1, 0x30 */ - cpu->gpr[14] = cpu->gpr[5] & 0x30u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[14] = cpu->gpr[5] & 0x30u; + PGXP_ALU(0x30AE0030u, cpu->gpr[14], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x80031908u); #endif @@ -318686,7 +319431,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x8020u); #endif /* 0xBFC19924: 30AF000C andi $t7, $a1, 0xC */ - cpu->gpr[15] = cpu->gpr[5] & 0xCu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[15] = cpu->gpr[5] & 0xCu; + PGXP_ALU(0x30AF000Cu, cpu->gpr[15], _pgx1, 0x000Cu); } #ifdef PSX_COSIM cosim_instr(0x80031924u); #endif @@ -318703,7 +319449,8 @@ label_BFC19848: psx_cyc_step(cpu, 0x1000020u); #endif /* 0xBFC1992C: 30B80003 andi $t8, $a1, 0x3 */ - cpu->gpr[24] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[24] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30B80003u, cpu->gpr[24], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x8003192Cu); #endif @@ -318817,7 +319564,8 @@ label_BFC19944: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1994C: 3042000F andi $v0, $v0, 0xF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3042000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003194Cu); #endif @@ -318979,7 +319727,8 @@ label_BFC19970: psx_cyc_step(cpu, 0xA000u); #endif /* 0xBFC19978: 31AF00F0 andi $t7, $t5, 0xF0 */ - cpu->gpr[15] = cpu->gpr[13] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[15] = cpu->gpr[13] & 0xF0u; + PGXP_ALU(0x31AF00F0u, cpu->gpr[15], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80031978u); #endif @@ -319045,7 +319794,8 @@ label_BFC19984: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1998C: 3042000F andi $v0, $v0, 0xF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3042000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003198Cu); #endif @@ -319129,7 +319879,8 @@ label_BFC1999C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC199A4: 331900F0 andi $t9, $t8, 0xF0 */ - cpu->gpr[25] = cpu->gpr[24] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xF0u; + PGXP_ALU(0x331900F0u, cpu->gpr[25], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x800319A4u); #endif @@ -319243,7 +319994,8 @@ label_BFC199C4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC199CC: 3042000F andi $v0, $v0, 0xF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3042000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x800319CCu); #endif @@ -321383,7 +322135,8 @@ label_BFC19C54: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC19C60: 2DCF0001 sltiu $t7, $t6, 1 */ - cpu->gpr[15] = (uint32_t)(cpu->gpr[14] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = (uint32_t)(cpu->gpr[14] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2DCF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80031C60u); #endif @@ -321509,7 +322262,8 @@ label_BFC19C80: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC19C8C: 2F190001 sltiu $t9, $t8, 1 */ - cpu->gpr[25] = (uint32_t)(cpu->gpr[24] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = (uint32_t)(cpu->gpr[24] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2F190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80031C8Cu); #endif @@ -324366,7 +325120,8 @@ label_BFC19FD0: psx_cyc_step(cpu, 0x4012u); #endif /* 0xBFC19FDC: 00817024 and $t6, $a0, $at */ - cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80031FDCu); #endif @@ -324849,7 +325604,8 @@ label_BFC1A050: psx_cyc_step(cpu, 0x4012u); #endif /* 0xBFC1A05C: 00817024 and $t6, $a0, $at */ - cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003205Cu); #endif @@ -325535,7 +326291,8 @@ label_BFC1A11C: psx_cyc_step(cpu, 0x4012u); #endif /* 0xBFC1A128: 00817024 and $t6, $a0, $at */ - cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032128u); #endif @@ -326224,7 +326981,8 @@ label_BFC1A1BC: psx_cyc_step(cpu, 0x4012u); #endif /* 0xBFC1A1C8: 00817024 and $t6, $a0, $at */ - cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800321C8u); #endif @@ -329065,7 +329823,8 @@ label_BFC1A49C: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1A4A0: 2A0100D0 slti $at, $s0, 208 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (208) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (208) ? 1 : 0); + PGXP_ALU(0x2A0100D0u, cpu->gpr[1], _pgx1, 0x00D0u); } #ifdef PSX_COSIM cosim_instr(0x800324A0u); #endif @@ -329341,7 +330100,8 @@ label_BFC1A4E4: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC1A4F0: 2DF80001 sltiu $t8, $t7, 1 */ - cpu->gpr[24] = (uint32_t)(cpu->gpr[15] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = (uint32_t)(cpu->gpr[15] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2DF80001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800324F0u); #endif @@ -329615,7 +330375,8 @@ label_BFC1A538: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1A53C: 2A0100D0 slti $at, $s0, 208 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (208) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (208) ? 1 : 0); + PGXP_ALU(0x2A0100D0u, cpu->gpr[1], _pgx1, 0x00D0u); } #ifdef PSX_COSIM cosim_instr(0x8003253Cu); #endif @@ -329878,7 +330639,8 @@ label_BFC1A580: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC1A58C: 2F280001 sltiu $t0, $t9, 1 */ - cpu->gpr[8] = (uint32_t)(cpu->gpr[25] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = (uint32_t)(cpu->gpr[25] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2F280001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8003258Cu); #endif @@ -330147,7 +330909,8 @@ label_BFC1A5C8: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC1A5D4: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800325D4u); #endif @@ -330511,7 +331274,8 @@ label_BFC1A630: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC1A644: 2D210007 sltiu $at, $t1, 7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000007u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000007u ? 1 : 0); + PGXP_ALU(0x2D210007u, cpu->gpr[1], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x80032644u); #endif @@ -331447,7 +332211,8 @@ label_BFC1A6EC: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC1A704: 2DCF0001 sltiu $t7, $t6, 1 */ - cpu->gpr[15] = (uint32_t)(cpu->gpr[14] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = (uint32_t)(cpu->gpr[14] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2DCF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80032704u); #endif @@ -331604,7 +332369,8 @@ label_BFC1A728: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC1A73C: 2F190001 sltiu $t9, $t8, 1 */ - cpu->gpr[25] = (uint32_t)(cpu->gpr[24] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = (uint32_t)(cpu->gpr[24] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2F190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8003273Cu); #endif @@ -331725,7 +332491,8 @@ label_BFC1A760: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC1A768: 2861002B slti $at, $v1, 43 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (43) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (43) ? 1 : 0); + PGXP_ALU(0x2861002Bu, cpu->gpr[1], _pgx1, 0x002Bu); } #ifdef PSX_COSIM cosim_instr(0x80032768u); #endif @@ -331776,7 +332543,8 @@ label_BFC1A774: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC1A774: 2861002F slti $at, $v1, 47 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (47) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (47) ? 1 : 0); + PGXP_ALU(0x2861002Fu, cpu->gpr[1], _pgx1, 0x002Fu); } #ifdef PSX_COSIM cosim_instr(0x80032774u); #endif @@ -334612,7 +335380,8 @@ label_BFC1AAB8: psx_cyc_step(cpu, 0x8002u); #endif /* 0xBFC1AAC4: 2DE1000A sltiu $at, $t7, 10 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2DE1000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x80032AC4u); #endif @@ -334627,7 +335396,8 @@ label_BFC1AAB8: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC1AACC: 3058000F andi $t8, $v0, 0xF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3058000Fu, cpu->gpr[24], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032ACCu); #endif @@ -334659,7 +335429,8 @@ label_BFC1AAD0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1AAD0: 3042000F andi $v0, $v0, 0xF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3042000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032AD0u); #endif @@ -334667,7 +335438,8 @@ label_BFC1AAD0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1AAD4: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80032AD4u); #endif @@ -334675,7 +335447,8 @@ label_BFC1AAD0: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC1AAD8: 3058000F andi $t8, $v0, 0xF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3058000Fu, cpu->gpr[24], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032AD8u); #endif @@ -334693,7 +335466,8 @@ label_BFC1AADC: psx_cyc_step(cpu, 0x1000002u); #endif /* 0xBFC1AADC: 2F01000A sltiu $at, $t8, 10 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2F01000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x80032ADCu); #endif @@ -334744,7 +335518,8 @@ label_BFC1AAE8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1AAE8: 304200F0 andi $v0, $v0, 0xF0 */ - cpu->gpr[2] = cpu->gpr[2] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xF0u; + PGXP_ALU(0x304200F0u, cpu->gpr[2], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80032AE8u); #endif @@ -334752,7 +335527,8 @@ label_BFC1AAE8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC1AAEC: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80032AECu); #endif @@ -334846,7 +335622,8 @@ label_BFC1AB00: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC1AB0C: 3045000F andi $a1, $v0, 0xF */ - cpu->gpr[5] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x3045000Fu, cpu->gpr[5], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032B0Cu); #endif @@ -334943,7 +335720,8 @@ label_BFC1AB20: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC1AB2C: 30A5000F andi $a1, $a1, 0xF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFu; + PGXP_ALU(0x30A5000Fu, cpu->gpr[5], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032B2Cu); #endif @@ -335040,7 +335818,8 @@ label_BFC1AB40: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC1AB4C: 30A5000F andi $a1, $a1, 0xF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFu; + PGXP_ALU(0x30A5000Fu, cpu->gpr[5], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80032B4Cu); #endif @@ -336155,7 +336934,8 @@ label_BFC1AC80: psx_cyc_step(cpu, 0x8002u); #endif /* 0xBFC1AC94: 2DE1000A sltiu $at, $t7, 10 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2DE1000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x80032C94u); #endif @@ -336986,7 +337766,8 @@ label_BFC1AD60: psx_cyc_step(cpu, 0x1000006u); #endif /* 0xBFC1AD68: 0041C024 and $t8, $v0, $at */ - cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x0041C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032D68u); #endif @@ -337046,7 +337827,8 @@ label_BFC1AD74: psx_cyc_step(cpu, 0x2000006u); #endif /* 0xBFC1AD78: 0041C824 and $t9, $v0, $at */ - cpu->gpr[25] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[25] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x0041C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032D78u); #endif @@ -337187,7 +337969,8 @@ label_BFC1AD94: psx_cyc_step(cpu, 0x106u); #endif /* 0xBFC1AD98: 00414024 and $t0, $v0, $at */ - cpu->gpr[8] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00414024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032D98u); #endif @@ -337247,7 +338030,8 @@ label_BFC1ADA4: psx_cyc_step(cpu, 0x206u); #endif /* 0xBFC1ADA8: 00414824 and $t1, $v0, $at */ - cpu->gpr[9] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00414824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032DA8u); #endif @@ -338379,7 +339163,8 @@ label_BFC1AE80: psx_cyc_step(cpu, 0x14002u); #endif /* 0xBFC1AE88: 02017024 and $t6, $s0, $at */ - cpu->gpr[14] = cpu->gpr[16] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[16] & cpu->gpr[1]; + PGXP_ALU(0x02017024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032E88u); #endif @@ -338589,7 +339374,8 @@ label_BFC1AEC4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1AEC4: 28410015 slti $at, $v0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (21) ? 1 : 0); + PGXP_ALU(0x28410015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80032EC4u); #endif @@ -338883,7 +339669,8 @@ label_BFC1AF18: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1AF24: 2841000B slti $at, $v0, 11 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (11) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (11) ? 1 : 0); + PGXP_ALU(0x2841000Bu, cpu->gpr[1], _pgx1, 0x000Bu); } #ifdef PSX_COSIM cosim_instr(0x80032F24u); #endif @@ -338949,7 +339736,8 @@ label_BFC1AF28: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1AF38: 2841000B slti $at, $v0, 11 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (11) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (11) ? 1 : 0); + PGXP_ALU(0x2841000Bu, cpu->gpr[1], _pgx1, 0x000Bu); } #ifdef PSX_COSIM cosim_instr(0x80032F38u); #endif @@ -339223,7 +340011,8 @@ label_BFC1AF64: psx_cyc_step(cpu, 0x2Au); #endif /* 0xBFC1AF84: 00A3082B sltu $at, $a1, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x00A3082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032F84u); #endif @@ -339347,7 +340136,8 @@ label_BFC1AFA0: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC1AFAC: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80032FACu); #endif @@ -339644,7 +340434,8 @@ label_BFC1AFE8: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC1B004: 00A2082B sltu $at, $a1, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x00A2082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033004u); #endif @@ -340083,7 +340874,8 @@ label_BFC1B08C: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC1B09C: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003309Cu); #endif @@ -340122,7 +340914,8 @@ label_BFC1B0A0: psx_cyc_step(cpu, 0x2Au); #endif /* 0xBFC1B0A4: 00A3082B sltu $at, $a1, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x00A3082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800330A4u); #endif @@ -340198,7 +340991,8 @@ label_BFC1B0B0: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC1B0B4: 28C10063 slti $at, $a2, 99 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (99) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (99) ? 1 : 0); + PGXP_ALU(0x28C10063u, cpu->gpr[1], _pgx1, 0x0063u); } #ifdef PSX_COSIM cosim_instr(0x800330B4u); #endif @@ -340239,7 +341033,8 @@ label_BFC1B0B8: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC1B0BC: 00A2082B sltu $at, $a1, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x00A2082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800330BCu); #endif @@ -340290,7 +341085,8 @@ label_BFC1B0C8: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1B0C8: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800330C8u); #endif @@ -340318,7 +341114,8 @@ label_BFC1B0CC: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC1B0D0: 28C10063 slti $at, $a2, 99 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (99) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (99) ? 1 : 0); + PGXP_ALU(0x28C10063u, cpu->gpr[1], _pgx1, 0x0063u); } #ifdef PSX_COSIM cosim_instr(0x800330D0u); #endif @@ -340438,7 +341235,8 @@ label_BFC1B0E4: psx_cyc_step(cpu, 0x10022u); #endif /* 0xBFC1B0F4: 00B0082B sltu $at, $a1, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x00B0082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800330F4u); #endif @@ -340507,7 +341305,8 @@ label_BFC1B100: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1B10C: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x8003310Cu); #endif @@ -340572,7 +341371,8 @@ label_BFC1B11C: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC1B11C: 28C10063 slti $at, $a2, 99 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (99) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (99) ? 1 : 0); + PGXP_ALU(0x28C10063u, cpu->gpr[1], _pgx1, 0x0063u); } #ifdef PSX_COSIM cosim_instr(0x8003311Cu); #endif @@ -340597,7 +341397,8 @@ label_BFC1B120: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC1B124: 28610015 slti $at, $v1, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (21) ? 1 : 0); + PGXP_ALU(0x28610015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80033124u); #endif @@ -341032,7 +341833,8 @@ label_BFC1B1A4: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC1B1A8: 28C10063 slti $at, $a2, 99 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (99) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (99) ? 1 : 0); + PGXP_ALU(0x28C10063u, cpu->gpr[1], _pgx1, 0x0063u); } #ifdef PSX_COSIM cosim_instr(0x800331A8u); #endif @@ -341487,7 +342289,8 @@ label_BFC1B228: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC1B238: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033238u); #endif @@ -341529,7 +342332,8 @@ label_BFC1B23C: psx_cyc_step(cpu, 0x2Au); #endif /* 0xBFC1B240: 00A3082B sltu $at, $a1, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x00A3082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033240u); #endif @@ -341672,7 +342476,8 @@ label_BFC1B260: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC1B264: 0043082A slt $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033264u); #endif @@ -341797,7 +342602,8 @@ label_BFC1B280: psx_cyc_step(cpu, 0x1000Au); #endif /* 0xBFC1B288: 0203082A slt $at, $s0, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0203082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033288u); #endif @@ -341881,7 +342687,8 @@ label_BFC1B2A0: psx_cyc_step(cpu, 0x2Au); #endif /* 0xBFC1B2A0: 00A3082B sltu $at, $a1, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x00A3082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800332A0u); #endif @@ -341929,7 +342736,8 @@ label_BFC1B2AC: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1B2AC: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800332ACu); #endif @@ -342075,7 +342883,8 @@ label_BFC1B2C8: psx_cyc_step(cpu, 0x10022u); #endif /* 0xBFC1B2D8: 00B0082B sltu $at, $a1, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x00B0082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800332D8u); #endif @@ -342093,7 +342902,8 @@ label_BFC1B2C8: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1B2E0: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800332E0u); #endif @@ -343155,7 +343965,8 @@ label_BFC1B410: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC1B41C: 2CA10015 sltiu $at, $a1, 21 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000015u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000015u ? 1 : 0); + PGXP_ALU(0x2CA10015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x8003341Cu); #endif @@ -343344,7 +344155,8 @@ label_BFC1B43C: psx_cyc_step(cpu, 0x10022u); #endif /* 0xBFC1B45C: 00B0082B sltu $at, $a1, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x00B0082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003345Cu); #endif @@ -343591,7 +344403,8 @@ label_BFC1B494: psx_cyc_step(cpu, 0x10022u); #endif /* 0xBFC1B4A0: 00B0082B sltu $at, $a1, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x00B0082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800334A0u); #endif @@ -343650,7 +344463,8 @@ label_BFC1B4A4: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC1B4B0: 2C810002 sltiu $at, $a0, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2C810002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x800334B0u); #endif @@ -343801,7 +344615,8 @@ label_BFC1B4D0: psx_cyc_step(cpu, 0x10012u); #endif /* 0xBFC1B4DC: 0204082B sltu $at, $s0, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0204082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800334DCu); #endif @@ -343994,7 +344809,8 @@ label_BFC1B508: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC1B51C: 0045082A slt $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003351Cu); #endif @@ -344111,7 +344927,8 @@ label_BFC1B538: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC1B540: 28810015 slti $at, $a0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (21) ? 1 : 0); + PGXP_ALU(0x28810015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80033540u); #endif @@ -344365,7 +345182,8 @@ label_BFC1B58C: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC1B590: 0062082B sltu $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033590u); #endif @@ -344480,7 +345298,8 @@ label_BFC1B5A4: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC1B5B0: 0045082B sltu $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800335B0u); #endif @@ -344528,7 +345347,8 @@ label_BFC1B5BC: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1B5BC: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800335BCu); #endif @@ -344700,7 +345520,8 @@ label_BFC1B5EC: psx_cyc_step(cpu, 0x10022u); #endif /* 0xBFC1B5F0: 0205082B sltu $at, $s0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0205082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800335F0u); #endif @@ -344715,7 +345536,8 @@ label_BFC1B5EC: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1B5F8: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800335F8u); #endif @@ -345691,7 +346513,8 @@ label_BFC1B6EC: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC1B6F4: 28610015 slti $at, $v1, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (21) ? 1 : 0); + PGXP_ALU(0x28610015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800336F4u); #endif @@ -345851,7 +346674,8 @@ label_BFC1B718: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC1B728: 2DF80001 sltiu $t8, $t7, 1 */ - cpu->gpr[24] = (uint32_t)(cpu->gpr[15] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = (uint32_t)(cpu->gpr[15] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2DF80001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80033728u); #endif @@ -345990,7 +346814,8 @@ label_BFC1B748: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC1B758: 2F280001 sltiu $t0, $t9, 1 */ - cpu->gpr[8] = (uint32_t)(cpu->gpr[25] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = (uint32_t)(cpu->gpr[25] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2F280001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80033758u); #endif @@ -348404,7 +349229,8 @@ label_BFC1B9EC: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC1B9F8: 2D210015 sltiu $at, $t1, 21 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000015u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000015u ? 1 : 0); + PGXP_ALU(0x2D210015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800339F8u); #endif @@ -349276,7 +350102,8 @@ label_BFC1BAF4: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC1BB00: 2C610002 sltiu $at, $v1, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2C610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80033B00u); #endif @@ -349480,7 +350307,8 @@ label_BFC1BB2C: psx_cyc_step(cpu, 0x2000Au); #endif /* 0xBFC1BB38: 0223082B sltu $at, $s1, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0223082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033B38u); #endif @@ -349558,7 +350386,8 @@ label_BFC1BB44: psx_cyc_step(cpu, 0x8006u); #endif /* 0xBFC1BB50: 01E2082B sltu $at, $t7, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[15] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x01E2082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033B50u); #endif @@ -349606,7 +350435,8 @@ label_BFC1BB5C: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC1BB5C: 2A210015 slti $at, $s1, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (21) ? 1 : 0); + PGXP_ALU(0x2A210015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80033B5Cu); #endif @@ -349816,7 +350646,8 @@ label_BFC1BB88: psx_cyc_step(cpu, 0x1020002u); #endif /* 0xBFC1BB94: 0311082B sltu $at, $t8, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0311082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033B94u); #endif @@ -349831,7 +350662,8 @@ label_BFC1BB88: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC1BB9C: 2A210015 slti $at, $s1, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (21) ? 1 : 0); + PGXP_ALU(0x2A210015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80033B9Cu); #endif @@ -349887,7 +350719,8 @@ label_BFC1BBA0: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC1BBAC: 28610002 slti $at, $v1, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (2) ? 1 : 0); + PGXP_ALU(0x28610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80033BACu); #endif @@ -350041,7 +350874,8 @@ label_BFC1BBD0: psx_cyc_step(cpu, 0x2000Au); #endif /* 0xBFC1BBDC: 0223082A slt $at, $s1, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0223082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033BDCu); #endif @@ -350151,7 +350985,8 @@ label_BFC1BBF0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1BC00: 28410015 slti $at, $v0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (21) ? 1 : 0); + PGXP_ALU(0x28410015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80033C00u); #endif @@ -350341,7 +351176,8 @@ label_BFC1BC2C: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC1BC30: 2A210015 slti $at, $s1, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (21) ? 1 : 0); + PGXP_ALU(0x2A210015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80033C30u); #endif @@ -350620,7 +351456,8 @@ label_BFC1BC74: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC1BC84: 28410002 slti $at, $v0, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (2) ? 1 : 0); + PGXP_ALU(0x28410002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80033C84u); #endif @@ -350774,7 +351611,8 @@ label_BFC1BCA4: psx_cyc_step(cpu, 0x20006u); #endif /* 0xBFC1BCB4: 0222082A slt $at, $s1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0222082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033CB4u); #endif @@ -350845,7 +351683,8 @@ label_BFC1BCC0: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC1BCCC: 0062082A slt $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033CCCu); #endif @@ -351015,7 +351854,8 @@ label_BFC1BCF4: psx_cyc_step(cpu, 0x20402u); #endif /* 0xBFC1BD00: 0151082A slt $at, $t2, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0151082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033D00u); #endif @@ -351452,7 +352292,8 @@ label_BFC1BD80: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC1BD8C: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80033D8Cu); #endif @@ -351761,7 +352602,8 @@ label_BFC1BDDC: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC1BDEC: 2D210005 sltiu $at, $t1, 5 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000005u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000005u ? 1 : 0); + PGXP_ALU(0x2D210005u, cpu->gpr[1], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0x80033DECu); #endif @@ -353464,7 +354306,8 @@ label_BFC1BF90: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC1BFBC: 2C610002 sltiu $at, $v1, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2C610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80033FBCu); #endif @@ -353717,7 +354560,8 @@ label_BFC1BFF8: psx_cyc_step(cpu, 0x1000Au); #endif /* 0xBFC1C004: 0203082B sltu $at, $s0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0203082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034004u); #endif @@ -353816,7 +354660,8 @@ label_BFC1C018: psx_cyc_step(cpu, 0x106u); #endif /* 0xBFC1C024: 0102082B sltu $at, $t0, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0102082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034024u); #endif @@ -353901,7 +354746,8 @@ label_BFC1C03C: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1C03C: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x8003403Cu); #endif @@ -354182,7 +355028,8 @@ label_BFC1C07C: psx_cyc_step(cpu, 0x10402u); #endif /* 0xBFC1C088: 0150082B sltu $at, $t2, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[10] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[10] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0150082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034088u); #endif @@ -354390,7 +355237,8 @@ label_BFC1C0B8: psx_cyc_step(cpu, 0x802u); #endif /* 0xBFC1C0C4: 29610002 slti $at, $t3, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (2) ? 1 : 0); + PGXP_ALU(0x29610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x800340C4u); #endif @@ -354405,7 +355253,8 @@ label_BFC1C0B8: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1C0CC: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800340CCu); #endif @@ -354564,7 +355413,8 @@ label_BFC1C0EC: psx_cyc_step(cpu, 0x14002u); #endif /* 0xBFC1C0F8: 020E082A slt $at, $s0, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x020E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800340F8u); #endif @@ -354582,7 +355432,8 @@ label_BFC1C0EC: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1C100: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80034100u); #endif @@ -355345,7 +356196,8 @@ label_BFC1C1A4: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC1C1B4: 2D210002 sltiu $at, $t1, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2D210002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x800341B4u); #endif @@ -355616,7 +356468,8 @@ label_BFC1C1F8: psx_cyc_step(cpu, 0x10202u); #endif /* 0xBFC1C204: 0209082B sltu $at, $s0, $t1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0209082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034204u); #endif @@ -355715,7 +356568,8 @@ label_BFC1C218: psx_cyc_step(cpu, 0x502u); #endif /* 0xBFC1C224: 010A082B sltu $at, $t0, $t2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x010A082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034224u); #endif @@ -355821,7 +356675,8 @@ label_BFC1C244: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1C244: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80034244u); #endif @@ -356037,7 +356892,8 @@ label_BFC1C27C: psx_cyc_step(cpu, 0x10102u); #endif /* 0xBFC1C280: 0110082B sltu $at, $t0, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0110082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034280u); #endif @@ -356417,7 +357273,8 @@ label_BFC1C2D8: psx_cyc_step(cpu, 0x10012u); #endif /* 0xBFC1C2F8: 0204082B sltu $at, $s0, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0204082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800342F8u); #endif @@ -356508,7 +357365,8 @@ label_BFC1C30C: psx_cyc_step(cpu, 0x902u); #endif /* 0xBFC1C310: 010B082B sltu $at, $t0, $t3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x010B082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034310u); #endif @@ -356635,7 +357493,8 @@ label_BFC1C338: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC1C338: 2C810002 sltiu $at, $a0, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2C810002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80034338u); #endif @@ -356834,7 +357693,8 @@ label_BFC1C370: psx_cyc_step(cpu, 0x10012u); #endif /* 0xBFC1C374: 0204082B sltu $at, $s0, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0204082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034374u); #endif @@ -356957,7 +357817,8 @@ label_BFC1C380: psx_cyc_step(cpu, 0xA2u); #endif /* 0xBFC1C3A0: 00E5082B sltu $at, $a3, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[7] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[7] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x00E5082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800343A0u); #endif @@ -357151,7 +358012,8 @@ label_BFC1C3D8: psx_cyc_step(cpu, 0x902u); #endif /* 0xBFC1C3D8: 010B082B sltu $at, $t0, $t3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x010B082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800343D8u); #endif @@ -357454,7 +358316,8 @@ label_BFC1C42C: psx_cyc_step(cpu, 0x10102u); #endif /* 0xBFC1C42C: 0110082B sltu $at, $t0, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0110082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003442Cu); #endif @@ -357616,7 +358479,8 @@ label_BFC1C454: psx_cyc_step(cpu, 0x902u); #endif /* 0xBFC1C454: 010B082B sltu $at, $t0, $t3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x010B082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034454u); #endif @@ -357787,7 +358651,8 @@ label_BFC1C488: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC1C490: 0043082B sltu $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034490u); #endif @@ -360015,7 +360880,8 @@ label_BFC1C6E8: psx_cyc_step(cpu, 0x2006u); #endif /* 0xBFC1C6FC: 01A2082B sltu $at, $t5, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x01A2082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800346FCu); #endif @@ -360066,7 +360932,8 @@ label_BFC1C708: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1C708: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80034708u); #endif @@ -360191,7 +361058,8 @@ label_BFC1C720: psx_cyc_step(cpu, 0x14002u); #endif /* 0xBFC1C72C: 01D0082B sltu $at, $t6, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x01D0082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003472Cu); #endif @@ -360209,7 +361077,8 @@ label_BFC1C720: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1C734: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80034734u); #endif @@ -362016,7 +362885,8 @@ label_BFC1C904: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC1C910: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034910u); #endif @@ -362853,7 +363723,8 @@ label_BFC1C9F0: psx_cyc_step(cpu, 0x2000012u); #endif /* 0xBFC1C9F4: 0081C824 and $t9, $a0, $at */ - cpu->gpr[25] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[25] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x0081C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800349F4u); #endif @@ -363142,7 +364013,8 @@ label_BFC1CA38: psx_cyc_step(cpu, 0x212u); #endif /* 0xBFC1CA3C: 00814824 and $t1, $a0, $at */ - cpu->gpr[9] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00814824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034A3Cu); #endif @@ -363294,7 +364166,8 @@ label_BFC1CA5C: psx_cyc_step(cpu, 0x412u); #endif /* 0xBFC1CA60: 00815024 and $t2, $a0, $at */ - cpu->gpr[10] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[10] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00815024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034A60u); #endif @@ -363443,7 +364316,8 @@ label_BFC1CA80: psx_cyc_step(cpu, 0x812u); #endif /* 0xBFC1CA84: 00815824 and $t3, $a0, $at */ - cpu->gpr[11] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[11] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00815824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034A84u); #endif @@ -363589,7 +364463,8 @@ label_BFC1CAA4: psx_cyc_step(cpu, 0x1012u); #endif /* 0xBFC1CAA8: 00816024 and $t4, $a0, $at */ - cpu->gpr[12] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[12] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00816024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034AA8u); #endif @@ -363741,7 +364616,8 @@ label_BFC1CAC8: psx_cyc_step(cpu, 0x2012u); #endif /* 0xBFC1CACC: 00816824 and $t5, $a0, $at */ - cpu->gpr[13] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[13] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00816824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80034ACCu); #endif @@ -364962,7 +365838,8 @@ label_BFC1CBF4: psx_cyc_step(cpu, 0x140u); #endif /* 0xBFC1CC18: 30C8000F andi $t0, $a2, 0xF */ - cpu->gpr[8] = cpu->gpr[6] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[8] = cpu->gpr[6] & 0xFu; + PGXP_ALU(0x30C8000Fu, cpu->gpr[8], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80034C18u); #endif @@ -364970,7 +365847,8 @@ label_BFC1CBF4: psx_cyc_step(cpu, 0x880u); #endif /* 0xBFC1CC1C: 30EB000F andi $t3, $a3, 0xF */ - cpu->gpr[11] = cpu->gpr[7] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[11] = cpu->gpr[7] & 0xFu; + PGXP_ALU(0x30EB000Fu, cpu->gpr[11], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80034C1Cu); #endif @@ -365150,7 +366028,8 @@ label_BFC1CC3C: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC1CC64: 30E8000F andi $t0, $a3, 0xF */ - cpu->gpr[8] = cpu->gpr[7] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[8] = cpu->gpr[7] & 0xFu; + PGXP_ALU(0x30E8000Fu, cpu->gpr[8], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80034C64u); #endif @@ -365185,7 +366064,8 @@ label_BFC1CC3C: psx_cyc_step(cpu, 0x4040u); #endif /* 0xBFC1CC74: 30CE000F andi $t6, $a2, 0xF */ - cpu->gpr[14] = cpu->gpr[6] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[14] = cpu->gpr[6] & 0xFu; + PGXP_ALU(0x30CE000Fu, cpu->gpr[14], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80034C74u); #endif @@ -365324,7 +366204,8 @@ label_BFC1CC90: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC1CCA4: 2881003C slti $at, $a0, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (60) ? 1 : 0); + PGXP_ALU(0x2881003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x80034CA4u); #endif @@ -366881,7 +367762,8 @@ label_BFC1CE24: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC1CE2C: 2E010005 sltiu $at, $s0, 5 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < 0x00000005u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < 0x00000005u ? 1 : 0); + PGXP_ALU(0x2E010005u, cpu->gpr[1], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0x80034E2Cu); #endif @@ -370505,7 +371387,8 @@ label_BFC1D294: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC1D2AC: 28610002 slti $at, $v1, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (2) ? 1 : 0); + PGXP_ALU(0x28610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x800352ACu); #endif @@ -371653,7 +372536,8 @@ label_BFC1D42C: psx_cyc_step(cpu, 0x200Au); #endif /* 0xBFC1D43C: 01A3082A slt $at, $t5, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x01A3082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003543Cu); #endif @@ -374266,7 +375150,8 @@ label_BFC1D7AC: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC1D7B4: 004E082A slt $at, $v0, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x004E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800357B4u); #endif @@ -374817,7 +375702,8 @@ label_BFC1D86C: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC1D870: 2A61003C slti $at, $s3, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (60) ? 1 : 0); + PGXP_ALU(0x2A61003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x80035870u); #endif @@ -374992,7 +375878,8 @@ label_BFC1D87C: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC1D8A4: 2A61003C slti $at, $s3, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (60) ? 1 : 0); + PGXP_ALU(0x2A61003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x800358A4u); #endif @@ -375123,7 +376010,8 @@ label_BFC1D8C4: psx_cyc_step(cpu, 0x100002u); #endif /* 0xBFC1D8C8: 2A810064 slti $at, $s4, 100 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (100) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (100) ? 1 : 0); + PGXP_ALU(0x2A810064u, cpu->gpr[1], _pgx1, 0x0064u); } #ifdef PSX_COSIM cosim_instr(0x800358C8u); #endif @@ -375167,7 +376055,8 @@ label_BFC1D8CC: psx_cyc_step(cpu, 0x100002u); #endif /* 0xBFC1D8D0: 2A810064 slti $at, $s4, 100 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (100) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (100) ? 1 : 0); + PGXP_ALU(0x2A810064u, cpu->gpr[1], _pgx1, 0x0064u); } #ifdef PSX_COSIM cosim_instr(0x800358D0u); #endif @@ -376281,7 +377170,8 @@ label_BFC1DA18: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC1DA24: 31F80010 andi $t8, $t7, 0x10 */ - cpu->gpr[24] = cpu->gpr[15] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x10u; + PGXP_ALU(0x31F80010u, cpu->gpr[24], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80035A24u); #endif @@ -376623,7 +377513,8 @@ label_BFC1DA78: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC1DA84: 31090010 andi $t1, $t0, 0x10 */ - cpu->gpr[9] = cpu->gpr[8] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x10u; + PGXP_ALU(0x31090010u, cpu->gpr[9], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80035A84u); #endif @@ -377295,7 +378186,8 @@ label_BFC1DB30: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC1DB3C: 304E0080 andi $t6, $v0, 0x80 */ - cpu->gpr[14] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x304E0080u, cpu->gpr[14], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80035B3Cu); #endif @@ -377535,7 +378427,8 @@ label_BFC1DB78: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC1DB84: 33280008 andi $t0, $t9, 0x8 */ - cpu->gpr[8] = cpu->gpr[25] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x8u; + PGXP_ALU(0x33280008u, cpu->gpr[8], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80035B84u); #endif @@ -377582,7 +378475,8 @@ label_BFC1DB90: psx_cyc_step(cpu, 0x204u); #endif /* 0xBFC1DB90: 30490040 andi $t1, $v0, 0x40 */ - cpu->gpr[9] = cpu->gpr[2] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[9] = cpu->gpr[2] & 0x40u; + PGXP_ALU(0x30490040u, cpu->gpr[9], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80035B90u); #endif @@ -377597,7 +378491,8 @@ label_BFC1DB90: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC1DB98: 304B0080 andi $t3, $v0, 0x80 */ - cpu->gpr[11] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x304B0080u, cpu->gpr[11], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80035B98u); #endif @@ -377690,7 +378585,8 @@ label_BFC1DBAC: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC1DBAC: 304B0080 andi $t3, $v0, 0x80 */ - cpu->gpr[11] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x304B0080u, cpu->gpr[11], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80035BACu); #endif @@ -377788,7 +378684,8 @@ label_BFC1DBC4: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC1DBC4: 304C0010 andi $t4, $v0, 0x10 */ - cpu->gpr[12] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304C0010u, cpu->gpr[12], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80035BC4u); #endif @@ -380750,7 +381647,8 @@ label_BFC1DF94: psx_cyc_step(cpu, 0x2000006u); #endif /* 0xBFC1DFA4: 0059082B sltu $at, $v0, $t9 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0059082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80035FA4u); #endif @@ -381184,7 +382082,8 @@ label_BFC1E024: psx_cyc_step(cpu, 0x802u); #endif /* 0xBFC1E030: 2D610095 sltiu $at, $t3, 149 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < 0x00000095u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < 0x00000095u ? 1 : 0); + PGXP_ALU(0x2D610095u, cpu->gpr[1], _pgx1, 0x0095u); } #ifdef PSX_COSIM cosim_instr(0x80036030u); #endif @@ -381367,7 +382266,8 @@ label_BFC1E058: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC1E064: 2CC10007 sltiu $at, $a2, 7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < 0x00000007u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < 0x00000007u ? 1 : 0); + PGXP_ALU(0x2CC10007u, cpu->gpr[1], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x80036064u); #endif @@ -381543,7 +382443,8 @@ label_BFC1E084: psx_cyc_step(cpu, 0x2002u); #endif /* 0xBFC1E090: 2DA10006 sltiu $at, $t5, 6 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < 0x00000006u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < 0x00000006u ? 1 : 0); + PGXP_ALU(0x2DA10006u, cpu->gpr[1], _pgx1, 0x0006u); } #ifdef PSX_COSIM cosim_instr(0x80036090u); #endif @@ -382773,7 +383674,8 @@ label_BFC1E1CC: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC1E1E0: 2DC10018 sltiu $at, $t6, 24 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000018u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000018u ? 1 : 0); + PGXP_ALU(0x2DC10018u, cpu->gpr[1], _pgx1, 0x0018u); } #ifdef PSX_COSIM cosim_instr(0x800361E0u); #endif @@ -385607,7 +386509,8 @@ label_BFC1E3F0: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC1E404: 2DC10018 sltiu $at, $t6, 24 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000018u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000018u ? 1 : 0); + PGXP_ALU(0x2DC10018u, cpu->gpr[1], _pgx1, 0x0018u); } #ifdef PSX_COSIM cosim_instr(0x80036404u); #endif @@ -386210,7 +387113,8 @@ label_BFC1E48C: psx_cyc_step(cpu, 0x802u); #endif /* 0xBFC1E4B4: 2D61000A sltiu $at, $t3, 10 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < 0x0000000Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < 0x0000000Au ? 1 : 0); + PGXP_ALU(0x2D61000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x800364B4u); #endif @@ -387155,7 +388059,8 @@ label_BFC1E5B8: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC1E5B8: 30A30003 andi $v1, $a1, 0x3 */ - cpu->gpr[3] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[3] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30A30003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x800365B8u); #endif @@ -388040,7 +388945,8 @@ label_BFC1E6BC: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC1E6C8: 33280080 andi $t0, $t9, 0x80 */ - cpu->gpr[8] = cpu->gpr[25] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x80u; + PGXP_ALU(0x33280080u, cpu->gpr[8], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x800366C8u); #endif @@ -388184,7 +389090,8 @@ label_BFC1E6E4: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC1E6F8: 3084007F andi $a0, $a0, 0x7F */ - cpu->gpr[4] = cpu->gpr[4] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x7Fu; + PGXP_ALU(0x3084007Fu, cpu->gpr[4], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x800366F8u); #endif @@ -388356,7 +389263,8 @@ label_BFC1E718: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC1E72C: 3084007F andi $a0, $a0, 0x7F */ - cpu->gpr[4] = cpu->gpr[4] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x7Fu; + PGXP_ALU(0x3084007Fu, cpu->gpr[4], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x8003672Cu); #endif @@ -389041,7 +389949,8 @@ label_BFC1E7E0: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC1E7F4: 0043082A slt $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800367F4u); #endif @@ -389159,7 +390068,8 @@ label_BFC1E80C: psx_cyc_step(cpu, 0x2000Au); #endif /* 0xBFC1E818: 0223082A slt $at, $s1, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0223082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036818u); #endif @@ -389245,7 +390155,8 @@ label_BFC1E824: psx_cyc_step(cpu, 0x100Au); #endif /* 0xBFC1E834: 006C082B sltu $at, $v1, $t4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[12] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[12]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[12] ? 1 : 0); + PGXP_ALU(0x006C082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036834u); #endif @@ -389363,7 +390274,8 @@ label_BFC1E84C: psx_cyc_step(cpu, 0x22002u); #endif /* 0xBFC1E858: 022D082B sltu $at, $s1, $t5 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)(cpu->gpr[17] < cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x022D082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036858u); #endif @@ -390399,7 +391311,8 @@ label_BFC1E974: psx_cyc_step(cpu, 0x406u); #endif /* 0xBFC1E980: 0142082A slt $at, $t2, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0142082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036980u); #endif @@ -391223,7 +392136,8 @@ label_BFC1EA60: psx_cyc_step(cpu, 0x10006u); #endif /* 0xBFC1EA6C: 0050082B sltu $at, $v0, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0050082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036A6Cu); #endif @@ -392056,7 +392970,8 @@ label_BFC1EB50: psx_cyc_step(cpu, 0x10006u); #endif /* 0xBFC1EB5C: 0050082B sltu $at, $v0, $s0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0050082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036B5Cu); #endif @@ -392193,7 +393108,8 @@ label_BFC1EB74: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC1EB88: 01CF082B sltu $at, $t6, $t7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x01CF082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036B88u); #endif @@ -393442,7 +394358,8 @@ label_BFC1ECE0: psx_cyc_step(cpu, 0x2000006u); #endif /* 0xBFC1ECF4: 0322082B sltu $at, $t9, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[25] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[25] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0322082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036CF4u); #endif @@ -393603,7 +394520,8 @@ label_BFC1ED1C: psx_cyc_step(cpu, 0x20202u); #endif /* 0xBFC1ED28: 0131082B sltu $at, $t1, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0131082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036D28u); #endif @@ -394184,7 +395102,8 @@ label_BFC1EDB4: psx_cyc_step(cpu, 0x806u); #endif /* 0xBFC1EDC8: 0162082B sltu $at, $t3, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0162082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036DC8u); #endif @@ -394348,7 +395267,8 @@ label_BFC1EDF0: psx_cyc_step(cpu, 0x24002u); #endif /* 0xBFC1EDFC: 01D1082B sltu $at, $t6, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x01D1082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036DFCu); #endif @@ -395198,7 +396118,8 @@ label_BFC1EEE0: psx_cyc_step(cpu, 0x20006u); #endif /* 0xBFC1EEE0: 0051082A slt $at, $v0, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0051082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036EE0u); #endif @@ -395514,7 +396435,8 @@ label_BFC1EF40: psx_cyc_step(cpu, 0x20006u); #endif /* 0xBFC1EF40: 0051082A slt $at, $v0, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0051082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80036F40u); #endif @@ -395684,7 +396606,8 @@ label_BFC1EF5C: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC1EF78: 28810015 slti $at, $a0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (21) ? 1 : 0); + PGXP_ALU(0x28810015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x80036F78u); #endif @@ -397391,7 +398314,8 @@ label_BFC1F160: psx_cyc_step(cpu, 0x808u); #endif /* 0xBFC1F16C: 306B0010 andi $t3, $v1, 0x10 */ - cpu->gpr[11] = cpu->gpr[3] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[11] = cpu->gpr[3] & 0x10u; + PGXP_ALU(0x306B0010u, cpu->gpr[11], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x8003716Cu); #endif @@ -398021,7 +398945,8 @@ label_BFC1F224: psx_cyc_step(cpu, 0x408u); #endif /* 0xBFC1F224: 306A0008 andi $t2, $v1, 0x8 */ - cpu->gpr[10] = cpu->gpr[3] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[10] = cpu->gpr[3] & 0x8u; + PGXP_ALU(0x306A0008u, cpu->gpr[10], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80037224u); #endif @@ -398081,7 +399006,8 @@ label_BFC1F230: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC1F238: 30680004 andi $t0, $v1, 0x4 */ - cpu->gpr[8] = cpu->gpr[3] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[8] = cpu->gpr[3] & 0x4u; + PGXP_ALU(0x30680004u, cpu->gpr[8], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80037238u); #endif @@ -398249,7 +399175,8 @@ label_BFC1F268: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC1F26C: 304C0080 andi $t4, $v0, 0x80 */ - cpu->gpr[12] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x304C0080u, cpu->gpr[12], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x8003726Cu); #endif @@ -398340,7 +399267,8 @@ label_BFC1F284: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC1F284: 304E0040 andi $t6, $v0, 0x40 */ - cpu->gpr[14] = cpu->gpr[2] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x40u; + PGXP_ALU(0x304E0040u, cpu->gpr[14], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80037284u); #endif @@ -398355,7 +399283,8 @@ label_BFC1F284: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC1F28C: 30590010 andi $t9, $v0, 0x10 */ - cpu->gpr[25] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30590010u, cpu->gpr[25], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x8003728Cu); #endif @@ -398414,7 +399343,8 @@ label_BFC1F290: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC1F29C: 30590010 andi $t9, $v0, 0x10 */ - cpu->gpr[25] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30590010u, cpu->gpr[25], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x8003729Cu); #endif @@ -398521,7 +399451,8 @@ label_BFC1F2B8: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC1F2B8: 30680004 andi $t0, $v1, 0x4 */ - cpu->gpr[8] = cpu->gpr[3] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[8] = cpu->gpr[3] & 0x4u; + PGXP_ALU(0x30680004u, cpu->gpr[8], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x800372B8u); #endif @@ -398582,7 +399513,8 @@ label_BFC1F2C4: psx_cyc_step(cpu, 0x204u); #endif /* 0xBFC1F2C4: 30490008 andi $t1, $v0, 0x8 */ - cpu->gpr[9] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[9] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30490008u, cpu->gpr[9], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x800372C4u); #endif @@ -399140,7 +400072,8 @@ label_BFC1F364: psx_cyc_step(cpu, 0x408u); #endif /* 0xBFC1F36C: 306A0001 andi $t2, $v1, 0x1 */ - cpu->gpr[10] = cpu->gpr[3] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[10] = cpu->gpr[3] & 0x1u; + PGXP_ALU(0x306A0001u, cpu->gpr[10], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8003736Cu); #endif @@ -399172,7 +400105,8 @@ label_BFC1F370: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC1F370: 30580040 andi $t8, $v0, 0x40 */ - cpu->gpr[24] = cpu->gpr[2] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x40u; + PGXP_ALU(0x30580040u, cpu->gpr[24], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80037370u); #endif @@ -399219,7 +400153,8 @@ label_BFC1F37C: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC1F37C: 30480020 andi $t0, $v0, 0x20 */ - cpu->gpr[8] = cpu->gpr[2] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x20u; + PGXP_ALU(0x30480020u, cpu->gpr[8], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x8003737Cu); #endif @@ -399269,7 +400204,8 @@ label_BFC1F388: psx_cyc_step(cpu, 0x204u); #endif /* 0xBFC1F388: 30490010 andi $t1, $v0, 0x10 */ - cpu->gpr[9] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[9] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x30490010u, cpu->gpr[9], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80037388u); #endif @@ -399287,7 +400223,8 @@ label_BFC1F388: psx_cyc_step(cpu, 0x408u); #endif /* 0xBFC1F390: 306A0001 andi $t2, $v1, 0x1 */ - cpu->gpr[10] = cpu->gpr[3] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[10] = cpu->gpr[3] & 0x1u; + PGXP_ALU(0x306A0001u, cpu->gpr[10], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80037390u); #endif @@ -399385,7 +400322,8 @@ label_BFC1F3A8: psx_cyc_step(cpu, 0x408u); #endif /* 0xBFC1F3A8: 306A0001 andi $t2, $v1, 0x1 */ - cpu->gpr[10] = cpu->gpr[3] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[10] = cpu->gpr[3] & 0x1u; + PGXP_ALU(0x306A0001u, cpu->gpr[10], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800373A8u); #endif @@ -399446,7 +400384,8 @@ label_BFC1F3B4: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC1F3B4: 304B0080 andi $t3, $v0, 0x80 */ - cpu->gpr[11] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x304B0080u, cpu->gpr[11], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x800373B4u); #endif @@ -400624,7 +401563,8 @@ label_BFC1F50C: psx_cyc_step(cpu, 0x28u); #endif /* 0xBFC1F50C: 30A30003 andi $v1, $a1, 0x3 */ - cpu->gpr[3] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[3] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30A30003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x8003750Cu); #endif @@ -401159,7 +402099,8 @@ label_BFC1F5B0: psx_cyc_step(cpu, 0x210u); #endif /* 0xBFC1F5B4: 308900FF andi $t1, $a0, 0xFF */ - cpu->gpr[9] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[9] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800375B4u); #endif @@ -403359,7 +404300,8 @@ label_BFC1F84C: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC1F84C: 0045082B sltu $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003784Cu); #endif @@ -403377,7 +404319,8 @@ label_BFC1F84C: psx_cyc_step(cpu, 0x46u); #endif /* 0xBFC1F854: 00C2082B sltu $at, $a2, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[6] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x00C2082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80037854u); #endif @@ -409888,7 +410831,8 @@ label_BFC2020C: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC20220: 0043082A slt $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80038220u); #endif @@ -410016,7 +410960,8 @@ label_BFC20238: psx_cyc_step(cpu, 0x1000Au); #endif /* 0xBFC20244: 0203082A slt $at, $s0, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0203082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80038244u); #endif @@ -411583,7 +412528,8 @@ label_BFC203E4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC203E4: 28410002 slti $at, $v0, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (2) ? 1 : 0); + PGXP_ALU(0x28410002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x800383E4u); #endif @@ -411771,7 +412717,8 @@ label_BFC2041C: psx_cyc_step(cpu, 0x20006u); #endif /* 0xBFC2041C: 0222082A slt $at, $s1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0222082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003841Cu); #endif @@ -412513,7 +413460,8 @@ label_BFC204DC: psx_cyc_step(cpu, 0x2000006u); #endif /* 0xBFC204F0: 0059082B sltu $at, $v0, $t9 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0059082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800384F0u); #endif @@ -414399,7 +415347,8 @@ label_BFC206D0: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC206DC: 004E082A slt $at, $v0, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x004E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800386DCu); #endif @@ -414954,7 +415903,8 @@ label_BFC20770: psx_cyc_step(cpu, 0x20006u); #endif /* 0xBFC20770: 0051082A slt $at, $v0, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0051082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80038770u); #endif @@ -415446,7 +416396,8 @@ label_BFC207F8: psx_cyc_step(cpu, 0x20006u); #endif /* 0xBFC207F8: 0051082A slt $at, $v0, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0051082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800387F8u); #endif @@ -415783,7 +416734,8 @@ label_BFC20860: psx_cyc_step(cpu, 0x20006u); #endif /* 0xBFC20860: 0051082A slt $at, $v0, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0051082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80038860u); #endif @@ -415983,7 +416935,8 @@ label_BFC20884: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC208A0: 28810015 slti $at, $a0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (21) ? 1 : 0); + PGXP_ALU(0x28810015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800388A0u); #endif @@ -416880,7 +417833,8 @@ label_BFC20990: psx_cyc_step(cpu, 0x2802u); #endif /* 0xBFC209A4: 016D082B sltu $at, $t3, $t5 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x016D082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800389A4u); #endif @@ -417437,7 +418391,8 @@ label_BFC20A40: psx_cyc_step(cpu, 0x602u); #endif /* 0xBFC20A54: 012A082B sltu $at, $t1, $t2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x012A082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80038A54u); #endif @@ -422434,7 +423389,8 @@ label_BFC20F24: psx_cyc_step(cpu, 0x20010u); #endif /* 0xBFC20F34: 309100FF andi $s1, $a0, 0xFF */ - cpu->gpr[17] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[17] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x309100FFu, cpu->gpr[17], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80038F34u); #endif @@ -427368,7 +428324,8 @@ label_BFC213E8: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC213E8: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800393E8u); #endif @@ -427384,7 +428341,8 @@ label_BFC213E8: psx_cyc_step(cpu, 0x14u); #endif /* 0xBFC213F0: 3082000F andi $v0, $a0, 0xF */ - cpu->gpr[2] = cpu->gpr[4] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[2] = cpu->gpr[4] & 0xFu; + PGXP_ALU(0x3082000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x800393F0u); #endif @@ -427720,7 +428678,8 @@ label_BFC21438: psx_cyc_step(cpu, 0x50002u); #endif /* 0xBFC21448: 0212082A slt $at, $s0, $s2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0212082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039448u); #endif @@ -427785,7 +428744,8 @@ label_BFC2144C: psx_cyc_step(cpu, 0x50002u); #endif /* 0xBFC2145C: 0212082A slt $at, $s0, $s2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0212082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003945Cu); #endif @@ -427843,7 +428803,8 @@ label_BFC21468: psx_cyc_step(cpu, 0x50002u); #endif /* 0xBFC21468: 0212082A slt $at, $s0, $s2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0212082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039468u); #endif @@ -428370,7 +429331,8 @@ label_BFC214CC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC214DC: 2841003D slti $at, $v0, 61 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (61) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (61) ? 1 : 0); + PGXP_ALU(0x2841003Du, cpu->gpr[1], _pgx1, 0x003Du); } #ifdef PSX_COSIM cosim_instr(0x800394DCu); #endif @@ -428879,7 +429841,8 @@ label_BFC21564: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2156C: 28410003 slti $at, $v0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3) ? 1 : 0); + PGXP_ALU(0x28410003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x8003956Cu); #endif @@ -429382,7 +430345,8 @@ label_BFC21610: psx_cyc_step(cpu, 0x8006u); #endif /* 0xBFC2161C: 004F082A slt $at, $v0, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x004F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003961Cu); #endif @@ -432059,7 +433023,8 @@ label_BFC218E0: psx_cyc_step(cpu, 0x8012u); #endif /* 0xBFC218E8: 00817824 and $t7, $a0, $at */ - cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800398E8u); #endif @@ -432251,7 +433216,8 @@ label_BFC21914: psx_cyc_step(cpu, 0x1000012u); #endif /* 0xBFC21918: 0081C024 and $t8, $a0, $at */ - cpu->gpr[24] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x0081C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039918u); #endif @@ -434511,7 +435477,8 @@ label_BFC21B7C: psx_cyc_step(cpu, 0x1006u); #endif /* 0xBFC21B98: 0182082A slt $at, $t4, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0182082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039B98u); #endif @@ -435218,7 +436185,8 @@ label_BFC21C78: psx_cyc_step(cpu, 0x40102u); #endif /* 0xBFC21C84: 0248082A slt $at, $s2, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0248082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039C84u); #endif @@ -435637,7 +436605,8 @@ label_BFC21D18: psx_cyc_step(cpu, 0x40102u); #endif /* 0xBFC21D20: 0248082A slt $at, $s2, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0248082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039D20u); #endif @@ -435943,7 +436912,8 @@ label_BFC21D88: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC21D90: 28410011 slti $at, $v0, 17 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (17) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (17) ? 1 : 0); + PGXP_ALU(0x28410011u, cpu->gpr[1], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x80039D90u); #endif @@ -435958,7 +436928,8 @@ label_BFC21D88: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC21D98: 28410014 slti $at, $v0, 20 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (20) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (20) ? 1 : 0); + PGXP_ALU(0x28410014u, cpu->gpr[1], _pgx1, 0x0014u); } #ifdef PSX_COSIM cosim_instr(0x80039D98u); #endif @@ -436053,7 +437024,8 @@ label_BFC21DA4: psx_cyc_step(cpu, 0x42002u); #endif /* 0xBFC21DB0: 024D082A slt $at, $s2, $t5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x024D082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039DB0u); #endif @@ -436472,7 +437444,8 @@ label_BFC21E44: psx_cyc_step(cpu, 0x42002u); #endif /* 0xBFC21E4C: 024D082A slt $at, $s2, $t5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x024D082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039E4Cu); #endif @@ -436974,7 +437947,8 @@ label_BFC21EB8: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC21F0C: 28610010 slti $at, $v1, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (16) ? 1 : 0); + PGXP_ALU(0x28610010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80039F0Cu); #endif @@ -437063,7 +438037,8 @@ label_BFC21F18: psx_cyc_step(cpu, 0x42002u); #endif /* 0xBFC21F20: 024D082A slt $at, $s2, $t5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x024D082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039F20u); #endif @@ -437341,7 +438316,8 @@ label_BFC21F78: psx_cyc_step(cpu, 0x2040002u); #endif /* 0xBFC21F80: 0259082A slt $at, $s2, $t9 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0259082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80039F80u); #endif @@ -439363,7 +440339,8 @@ label_BFC221F4: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC22218: 2A61000F slti $at, $s3, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (15) ? 1 : 0); + PGXP_ALU(0x2A61000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003A218u); #endif @@ -439499,7 +440476,8 @@ label_BFC2223C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2223C: 28410020 slti $at, $v0, 32 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (32) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (32) ? 1 : 0); + PGXP_ALU(0x28410020u, cpu->gpr[1], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x8003A23Cu); #endif @@ -439882,7 +440860,8 @@ label_BFC222B0: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC222B0: 2A010041 slti $at, $s0, 65 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (65) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (65) ? 1 : 0); + PGXP_ALU(0x2A010041u, cpu->gpr[1], _pgx1, 0x0041u); } #ifdef PSX_COSIM cosim_instr(0x8003A2B0u); #endif @@ -440038,7 +441017,8 @@ label_BFC222D4: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC222D4: 2A010040 slti $at, $s0, 64 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (64) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (64) ? 1 : 0); + PGXP_ALU(0x2A010040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x8003A2D4u); #endif @@ -440171,7 +441151,8 @@ label_BFC222F4: psx_cyc_step(cpu, 0x2080002u); #endif /* 0xBFC222FC: 0279082A slt $at, $s3, $t9 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0279082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003A2FCu); #endif @@ -440222,7 +441203,8 @@ label_BFC22308: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC22308: 2A61000F slti $at, $s3, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (15) ? 1 : 0); + PGXP_ALU(0x2A61000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003A308u); #endif @@ -440430,7 +441412,8 @@ label_BFC2233C: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC22340: 2A61000F slti $at, $s3, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (15) ? 1 : 0); + PGXP_ALU(0x2A61000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003A340u); #endif @@ -442301,7 +443284,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC22618: 312900FF andi $t1, $t1, 0xFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFu; + PGXP_ALU(0x312900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A618u); #endif @@ -442321,7 +443305,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC22620: 310800FF andi $t0, $t0, 0xFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310800FFu, cpu->gpr[8], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A620u); #endif @@ -442338,7 +443323,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0xA0u); #endif /* 0xBFC22628: 30A700FF andi $a3, $a1, 0xFF */ - cpu->gpr[7] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[7] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A628u); #endif @@ -442358,7 +443344,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0xC0u); #endif /* 0xBFC22630: 30E600FF andi $a2, $a3, 0xFF */ - cpu->gpr[6] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[6] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30E600FFu, cpu->gpr[6], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A630u); #endif @@ -442375,7 +443362,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x500u); #endif /* 0xBFC22638: 310A00FF andi $t2, $t0, 0xFF */ - cpu->gpr[10] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[10] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310A00FFu, cpu->gpr[10], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A638u); #endif @@ -442395,7 +443383,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x1200u); #endif /* 0xBFC22640: 312C00FF andi $t4, $t1, 0xFF */ - cpu->gpr[12] = cpu->gpr[9] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[12] = cpu->gpr[9] & 0xFFu; + PGXP_ALU(0x312C00FFu, cpu->gpr[12], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A640u); #endif @@ -442403,7 +443392,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x810u); #endif /* 0xBFC22644: 308B00FF andi $t3, $a0, 0xFF */ - cpu->gpr[11] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[11] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308B00FFu, cpu->gpr[11], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A644u); #endif @@ -442491,7 +443481,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC2266C: 30E700FF andi $a3, $a3, 0xFF */ - cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30E700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A66Cu); #endif @@ -442511,7 +443502,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC22674: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A674u); #endif @@ -442528,7 +443520,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC2267C: 306400FF andi $a0, $v1, 0xFF */ - cpu->gpr[4] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[4] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A67Cu); #endif @@ -442548,7 +443541,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x50u); #endif /* 0xBFC22684: 308600FF andi $a2, $a0, 0xFF */ - cpu->gpr[6] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[6] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308600FFu, cpu->gpr[6], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A684u); #endif @@ -442565,7 +443559,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x420u); #endif /* 0xBFC2268C: 30AA00FF andi $t2, $a1, 0xFF */ - cpu->gpr[10] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[10] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30AA00FFu, cpu->gpr[10], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A68Cu); #endif @@ -442585,7 +443580,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x1080u); #endif /* 0xBFC22694: 30EC00FF andi $t4, $a3, 0xFF */ - cpu->gpr[12] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[12] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30EC00FFu, cpu->gpr[12], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A694u); #endif @@ -442593,7 +443589,8 @@ label_BFC225A8: psx_cyc_step(cpu, 0x80000800u); #endif /* 0xBFC22698: 33EB00FF andi $t3, $ra, 0xFF */ - cpu->gpr[11] = cpu->gpr[31] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[31]; cpu->gpr[11] = cpu->gpr[31] & 0xFFu; + PGXP_ALU(0x33EB00FFu, cpu->gpr[11], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003A698u); #endif @@ -442947,7 +443944,8 @@ label_BFC226E4: psx_cyc_step(cpu, 0x8012u); #endif /* 0xBFC226EC: 00817824 and $t7, $a0, $at */ - cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003A6ECu); #endif @@ -444048,7 +445046,8 @@ label_BFC227EC: psx_cyc_step(cpu, 0x2000012u); #endif /* 0xBFC227F0: 0081C824 and $t9, $a0, $at */ - cpu->gpr[25] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[25] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x0081C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003A7F0u); #endif @@ -444197,7 +445196,8 @@ label_BFC22810: psx_cyc_step(cpu, 0x112u); #endif /* 0xBFC22814: 00814024 and $t0, $a0, $at */ - cpu->gpr[8] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00814024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003A814u); #endif @@ -444254,7 +445254,8 @@ label_BFC22820: psx_cyc_step(cpu, 0x212u); #endif /* 0xBFC22824: 00814824 and $t1, $a0, $at */ - cpu->gpr[9] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00814824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003A824u); #endif @@ -444311,7 +445312,8 @@ label_BFC22830: psx_cyc_step(cpu, 0x412u); #endif /* 0xBFC22834: 00815024 and $t2, $a0, $at */ - cpu->gpr[10] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[10] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00815024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003A834u); #endif @@ -444368,7 +445370,8 @@ label_BFC22840: psx_cyc_step(cpu, 0x812u); #endif /* 0xBFC22844: 00815824 and $t3, $a0, $at */ - cpu->gpr[11] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[11] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00815824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003A844u); #endif @@ -447358,7 +448361,8 @@ label_BFC22B94: psx_cyc_step(cpu, 0x4012u); #endif /* 0xBFC22BA0: 00817024 and $t6, $a0, $at */ - cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003ABA0u); #endif @@ -447804,7 +448808,8 @@ label_BFC22C00: psx_cyc_step(cpu, 0x8012u); #endif /* 0xBFC22C08: 00817824 and $t7, $a0, $at */ - cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003AC08u); #endif @@ -448095,7 +449100,8 @@ label_BFC22C48: psx_cyc_step(cpu, 0x1000012u); #endif /* 0xBFC22C4C: 0081C024 and $t8, $a0, $at */ - cpu->gpr[24] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x0081C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003AC4Cu); #endif @@ -448615,7 +449621,8 @@ label_BFC22CC4: psx_cyc_step(cpu, 0x2000012u); #endif /* 0xBFC22CC8: 0081C824 and $t9, $a0, $at */ - cpu->gpr[25] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[25] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x0081C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003ACC8u); #endif @@ -449007,7 +450014,8 @@ label_BFC22D20: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC22D2C: 2901003C slti $at, $t0, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (60) ? 1 : 0); + PGXP_ALU(0x2901003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x8003AD2Cu); #endif @@ -449377,7 +450385,8 @@ label_BFC22D80: psx_cyc_step(cpu, 0x412u); #endif /* 0xBFC22D84: 00815024 and $t2, $a0, $at */ - cpu->gpr[10] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[10] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00815024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003AD84u); #endif @@ -449392,7 +450401,8 @@ label_BFC22D80: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC22D8C: 2841003C slti $at, $v0, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (60) ? 1 : 0); + PGXP_ALU(0x2841003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x8003AD8Cu); #endif @@ -449691,7 +450701,8 @@ label_BFC22DC8: psx_cyc_step(cpu, 0x812u); #endif /* 0xBFC22DD0: 00815824 and $t3, $a0, $at */ - cpu->gpr[11] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[11] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00815824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003ADD0u); #endif @@ -449706,7 +450717,8 @@ label_BFC22DC8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC22DD8: 2841003C slti $at, $v0, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (60) ? 1 : 0); + PGXP_ALU(0x2841003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x8003ADD8u); #endif @@ -451442,7 +452454,8 @@ label_BFC22FF8: psx_cyc_step(cpu, 0x80002u); #endif /* 0xBFC22FF8: 2A610002 slti $at, $s3, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (2) ? 1 : 0); + PGXP_ALU(0x2A610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8003AFF8u); #endif @@ -451640,7 +452653,8 @@ label_BFC23020: psx_cyc_step(cpu, 0x400402u); #endif /* 0xBFC23030: 02CA082A slt $at, $s6, $t2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (int32_t)cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (int32_t)cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x02CA082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003B030u); #endif @@ -452221,7 +453235,8 @@ label_BFC230E4: psx_cyc_step(cpu, 0x20022u); #endif /* 0xBFC230E4: 00B1082A slt $at, $a1, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x00B1082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003B0E4u); #endif @@ -452312,7 +453327,8 @@ label_BFC230F8: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC230FC: 0211082A slt $at, $s0, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0211082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003B0FCu); #endif @@ -452719,7 +453735,8 @@ label_BFC2317C: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC23180: 2A21000F slti $at, $s1, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (15) ? 1 : 0); + PGXP_ALU(0x2A21000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003B180u); #endif @@ -453021,7 +454038,8 @@ label_BFC231DC: psx_cyc_step(cpu, 0x40002u); #endif /* 0xBFC231E0: 2A41000F slti $at, $s2, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (15) ? 1 : 0); + PGXP_ALU(0x2A41000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003B1E0u); #endif @@ -454125,7 +455143,8 @@ label_BFC2332C: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC23338: 28610002 slti $at, $v1, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (2) ? 1 : 0); + PGXP_ALU(0x28610002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8003B338u); #endif @@ -455822,7 +456841,8 @@ label_BFC23570: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC23578: 2881003C slti $at, $a0, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (60) ? 1 : 0); + PGXP_ALU(0x2881003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x8003B578u); #endif @@ -455975,7 +456995,8 @@ label_BFC235A4: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC235A4: 2881003C slti $at, $a0, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (60) ? 1 : 0); + PGXP_ALU(0x2881003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x8003B5A4u); #endif @@ -456311,7 +457332,8 @@ label_BFC235D0: psx_cyc_step(cpu, 0x20000u); #endif /* 0xBFC23614: 323100FF andi $s1, $s1, 0xFF */ - cpu->gpr[17] = cpu->gpr[17] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[17] = cpu->gpr[17] & 0xFFu; + PGXP_ALU(0x323100FFu, cpu->gpr[17], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003B614u); #endif @@ -456326,7 +457348,8 @@ label_BFC235D0: psx_cyc_step(cpu, 0x40004u); #endif /* 0xBFC2361C: 305200FF andi $s2, $v0, 0xFF */ - cpu->gpr[18] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[18] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305200FFu, cpu->gpr[18], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003B61Cu); #endif @@ -460735,7 +461758,8 @@ label_BFC23C4C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC23CC8: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003BCC8u); #endif @@ -460764,7 +461788,8 @@ label_BFC23C4C: psx_cyc_step(cpu, 0x50u); #endif /* 0xBFC23CD4: 30C400FF andi $a0, $a2, 0xFF */ - cpu->gpr[4] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[4] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30C400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003BCD4u); #endif @@ -460820,7 +461845,8 @@ label_BFC23C4C: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC23CEC: 312900FF andi $t1, $t1, 0xFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFu; + PGXP_ALU(0x312900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003BCECu); #endif @@ -460831,7 +461857,8 @@ label_BFC23C4C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC23CF0: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003BCF0u); #endif @@ -460839,7 +461866,8 @@ label_BFC23C4C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC23CF4: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003BCF4u); #endif @@ -460847,7 +461875,8 @@ label_BFC23C4C: psx_cyc_step(cpu, 0x108u); #endif /* 0xBFC23CF8: 310300FF andi $v1, $t0, 0xFF */ - cpu->gpr[3] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[3] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8003BCF8u); #endif @@ -462320,7 +463349,8 @@ label_BFC23E7C: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC23E80: 2A01000A slti $at, $s0, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (10) ? 1 : 0); + PGXP_ALU(0x2A01000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x8003BE80u); #endif @@ -463328,7 +464358,8 @@ label_BFC23FA4: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC23FA8: 2A01000A slti $at, $s0, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (10) ? 1 : 0); + PGXP_ALU(0x2A01000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x8003BFA8u); #endif @@ -463971,7 +465002,8 @@ label_BFC24064: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC24068: 2A01000A slti $at, $s0, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (10) ? 1 : 0); + PGXP_ALU(0x2A01000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x8003C068u); #endif @@ -464579,7 +465611,8 @@ label_BFC24114: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC24118: 2A01000A slti $at, $s0, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (10) ? 1 : 0); + PGXP_ALU(0x2A01000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x8003C118u); #endif @@ -465049,7 +466082,8 @@ label_BFC2418C: psx_cyc_step(cpu, 0x206u); #endif /* 0xBFC241AC: 0049082A slt $at, $v0, $t1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0049082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003C1ACu); #endif @@ -465523,7 +466557,8 @@ label_BFC24238: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC24244: 304A1FFF andi $t2, $v0, 0x1FFF */ - cpu->gpr[10] = cpu->gpr[2] & 0x1FFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x1FFFu; + PGXP_ALU(0x304A1FFFu, cpu->gpr[10], _pgx1, 0x1FFFu); } #ifdef PSX_COSIM cosim_instr(0x8003C244u); #endif @@ -466419,7 +467454,8 @@ label_BFC24314: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC24320: 28A1003C slti $at, $a1, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (60) ? 1 : 0); + PGXP_ALU(0x28A1003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x8003C320u); #endif @@ -467315,7 +468351,8 @@ label_BFC24418: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC2442C: 2A21003C slti $at, $s1, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (60) ? 1 : 0); + PGXP_ALU(0x2A21003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x8003C42Cu); #endif @@ -468129,7 +469166,8 @@ label_BFC244EC: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC2453C: 2A01000E slti $at, $s0, 14 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (14) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (14) ? 1 : 0); + PGXP_ALU(0x2A01000Eu, cpu->gpr[1], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0x8003C53Cu); #endif @@ -468407,7 +469445,8 @@ label_BFC24598: psx_cyc_step(cpu, 0x40002u); #endif /* 0xBFC2459C: 2A41000E slti $at, $s2, 14 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (14) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (14) ? 1 : 0); + PGXP_ALU(0x2A41000Eu, cpu->gpr[1], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0x8003C59Cu); #endif @@ -469118,7 +470157,8 @@ label_BFC24664: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC24670: 2861003C slti $at, $v1, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (60) ? 1 : 0); + PGXP_ALU(0x2861003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x8003C670u); #endif @@ -470086,7 +471126,8 @@ label_BFC24770: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC247C0: 29010010 slti $at, $t0, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (16) ? 1 : 0); + PGXP_ALU(0x29010010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x8003C7C0u); #endif @@ -471356,7 +472397,8 @@ label_BFC24960: psx_cyc_step(cpu, 0x302u); #endif /* 0xBFC2496C: 0128082A slt $at, $t1, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0128082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003C96Cu); #endif @@ -471692,7 +472734,8 @@ label_BFC249B8: psx_cyc_step(cpu, 0x1802u); #endif /* 0xBFC249C4: 018B082A slt $at, $t4, $t3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (int32_t)cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (int32_t)cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x018B082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003C9C4u); #endif @@ -471870,7 +472913,8 @@ label_BFC249F0: psx_cyc_step(cpu, 0x100006u); #endif /* 0xBFC249F0: 0282082A slt $at, $s4, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0282082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003C9F0u); #endif @@ -472431,7 +473475,8 @@ label_BFC24A7C: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC24A88: 29C1003C slti $at, $t6, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (60) ? 1 : 0); + PGXP_ALU(0x29C1003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x8003CA88u); #endif @@ -473403,7 +474448,8 @@ label_BFC24BC4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC24BCC: 2841000F slti $at, $v0, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + PGXP_ALU(0x2841000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003CBCCu); #endif @@ -473526,7 +474572,8 @@ label_BFC24BDC: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC24BF4: 29C10010 slti $at, $t6, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (16) ? 1 : 0); + PGXP_ALU(0x29C10010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x8003CBF4u); #endif @@ -475095,7 +476142,8 @@ label_BFC24DFC: psx_cyc_step(cpu, 0x2004002u); #endif /* 0xBFC24E08: 032E082A slt $at, $t9, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x032E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003CE08u); #endif @@ -475425,7 +476473,8 @@ label_BFC24E54: psx_cyc_step(cpu, 0x1000402u); #endif /* 0xBFC24E60: 0158082A slt $at, $t2, $t8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x0158082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003CE60u); #endif @@ -475609,7 +476658,8 @@ label_BFC24E8C: psx_cyc_step(cpu, 0x100006u); #endif /* 0xBFC24E8C: 0282082A slt $at, $s4, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0282082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003CE8Cu); #endif @@ -475786,7 +476836,8 @@ label_BFC24EB4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC24EBC: 2841000F slti $at, $v0, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + PGXP_ALU(0x2841000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8003CEBCu); #endif @@ -480786,7 +481837,8 @@ label_BFC253E4: psx_cyc_step(cpu, 0x10006u); #endif /* 0xBFC253F8: 0050082A slt $at, $v0, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0050082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D3F8u); #endif @@ -480870,7 +481922,8 @@ label_BFC2540C: psx_cyc_step(cpu, 0x10006u); #endif /* 0xBFC2540C: 0050082A slt $at, $v0, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0050082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D40Cu); #endif @@ -482219,7 +483272,8 @@ label_BFC255A0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC255B4: 38420001 xori $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] ^ 0x1u; + PGXP_ALU(0x38420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8003D5B4u); #endif @@ -483082,7 +484136,8 @@ label_BFC256E4: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC256F0: 29C10002 slti $at, $t6, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (2) ? 1 : 0); + PGXP_ALU(0x29C10002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8003D6F0u); #endif @@ -483155,7 +484210,8 @@ label_BFC256FC: psx_cyc_step(cpu, 0x8002u); #endif /* 0xBFC25708: 29E10002 slti $at, $t7, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (2) ? 1 : 0); + PGXP_ALU(0x29E10002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8003D708u); #endif @@ -483626,7 +484682,8 @@ label_BFC25788: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC25798: 2DC14000 sltiu $at, $t6, 16384 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00004000u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00004000u ? 1 : 0); + PGXP_ALU(0x2DC14000u, cpu->gpr[1], _pgx1, 0x4000u); } #ifdef PSX_COSIM cosim_instr(0x8003D798u); #endif @@ -483730,7 +484787,8 @@ label_BFC257A4: psx_cyc_step(cpu, 0x3000008u); #endif /* 0xBFC257BC: 0078C826 xor $t9, $v1, $t8 */ - cpu->gpr[25] = cpu->gpr[3] ^ cpu->gpr[24]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[3] ^ cpu->gpr[24]; + PGXP_ALU(0x0078C826u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D7BCu); #endif @@ -483750,7 +484808,8 @@ label_BFC257A4: psx_cyc_step(cpu, 0x304u); #endif /* 0xBFC257C4: 01024826 xor $t1, $t0, $v0 */ - cpu->gpr[9] = cpu->gpr[8] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[9] = cpu->gpr[8] ^ cpu->gpr[2]; + PGXP_ALU(0x01024826u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D7C4u); #endif @@ -484006,7 +485065,8 @@ label_BFC2580C: psx_cyc_step(cpu, 0xC004u); #endif /* 0xBFC25818: 01C27826 xor $t7, $t6, $v0 */ - cpu->gpr[15] = cpu->gpr[14] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[14] ^ cpu->gpr[2]; + PGXP_ALU(0x01C27826u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D818u); #endif @@ -484035,7 +485095,8 @@ label_BFC2580C: psx_cyc_step(cpu, 0x2000104u); #endif /* 0xBFC25824: 03224026 xor $t0, $t9, $v0 */ - cpu->gpr[8] = cpu->gpr[25] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[25] ^ cpu->gpr[2]; + PGXP_ALU(0x03224026u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D824u); #endif @@ -484133,7 +485194,8 @@ label_BFC25840: psx_cyc_step(cpu, 0x100600u); #endif /* 0xBFC25848: 01345024 and $t2, $t1, $s4 */ - cpu->gpr[10] = cpu->gpr[9] & cpu->gpr[20]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[20]; cpu->gpr[10] = cpu->gpr[9] & cpu->gpr[20]; + PGXP_ALU(0x01345024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D848u); #endif @@ -484167,7 +485229,8 @@ label_BFC25840: psx_cyc_step(cpu, 0x1802u); #endif /* 0xBFC25858: 01616024 and $t4, $t3, $at */ - cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[1]; + PGXP_ALU(0x01616024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D858u); #endif @@ -484522,7 +485585,8 @@ label_BFC2592C: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC25938: 0082082A slt $at, $a0, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0082082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D938u); #endif @@ -484638,7 +485702,8 @@ label_BFC2594C: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC25958: 0044082A slt $at, $v0, $a0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0044082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D958u); #endif @@ -484733,7 +485798,8 @@ label_BFC25968: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC25974: 00A2082A slt $at, $a1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x00A2082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D974u); #endif @@ -484846,7 +485912,8 @@ label_BFC25988: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC25994: 0045082A slt $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003D994u); #endif @@ -485218,7 +486285,8 @@ label_BFC25A0C: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC25A14: 308300F0 andi $v1, $a0, 0xF0 */ - cpu->gpr[3] = cpu->gpr[4] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0xF0u; + PGXP_ALU(0x308300F0u, cpu->gpr[3], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x8003DA14u); #endif @@ -485419,7 +486487,8 @@ label_BFC25A2C: psx_cyc_step(cpu, 0x601u); #endif /* 0xBFC25A50: 01205027 nor $t2, $t1, $zero */ - cpu->gpr[10] = ~(cpu->gpr[9] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[10] = ~(cpu->gpr[9] | cpu->gpr[0]); + PGXP_ALU(0x01205027u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003DA50u); #endif @@ -485427,7 +486496,8 @@ label_BFC25A2C: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC25A54: 314B0008 andi $t3, $t2, 0x8 */ - cpu->gpr[11] = cpu->gpr[10] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x8u; + PGXP_ALU(0x314B0008u, cpu->gpr[11], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x8003DA54u); #endif @@ -485612,7 +486682,8 @@ label_BFC25A88: psx_cyc_step(cpu, 0x1008001u); #endif /* 0xBFC25A90: 01E0C027 nor $t8, $t7, $zero */ - cpu->gpr[24] = ~(cpu->gpr[15] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[24] = ~(cpu->gpr[15] | cpu->gpr[0]); + PGXP_ALU(0x01E0C027u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003DA90u); #endif @@ -485620,7 +486691,8 @@ label_BFC25A88: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC25A94: 33190004 andi $t9, $t8, 0x4 */ - cpu->gpr[25] = cpu->gpr[24] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x4u; + PGXP_ALU(0x33190004u, cpu->gpr[25], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x8003DA94u); #endif @@ -485737,7 +486809,8 @@ label_BFC25AB4: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC25ABC: 314BFFFF andi $t3, $t2, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8003DABCu); #endif @@ -485851,7 +486924,8 @@ label_BFC25AD4: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC25AE0: 306300F0 andi $v1, $v1, 0xF0 */ - cpu->gpr[3] = cpu->gpr[3] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xF0u; + PGXP_ALU(0x306300F0u, cpu->gpr[3], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x8003DAE0u); #endif @@ -486119,7 +487193,8 @@ label_BFC25B14: psx_cyc_step(cpu, 0x601u); #endif /* 0xBFC25B30: 01205027 nor $t2, $t1, $zero */ - cpu->gpr[10] = ~(cpu->gpr[9] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[10] = ~(cpu->gpr[9] | cpu->gpr[0]); + PGXP_ALU(0x01205027u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003DB30u); #endif @@ -486127,7 +487202,8 @@ label_BFC25B14: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC25B34: 314BFFFF andi $t3, $t2, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8003DB34u); #endif @@ -486160,7 +487236,8 @@ label_BFC25B14: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC25B44: 306300F0 andi $v1, $v1, 0xF0 */ - cpu->gpr[3] = cpu->gpr[3] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xF0u; + PGXP_ALU(0x306300F0u, cpu->gpr[3], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x8003DB44u); #endif @@ -489896,7 +490973,8 @@ label_BFC25F88: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC25F98: 2A0100B4 slti $at, $s0, 180 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (180) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (180) ? 1 : 0); + PGXP_ALU(0x2A0100B4u, cpu->gpr[1], _pgx1, 0x00B4u); } #ifdef PSX_COSIM cosim_instr(0x8003DF98u); #endif @@ -489978,7 +491056,8 @@ label_BFC25FA4: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC25FA8: 2A0101B5 slti $at, $s0, 437 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (437) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (437) ? 1 : 0); + PGXP_ALU(0x2A0101B5u, cpu->gpr[1], _pgx1, 0x01B5u); } #ifdef PSX_COSIM cosim_instr(0x8003DFA8u); #endif @@ -490089,7 +491168,8 @@ label_BFC25FC4: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC25FC4: 2A0101B5 slti $at, $s0, 437 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (437) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (437) ? 1 : 0); + PGXP_ALU(0x2A0101B5u, cpu->gpr[1], _pgx1, 0x01B5u); } #ifdef PSX_COSIM cosim_instr(0x8003DFC4u); #endif @@ -491130,7 +492210,8 @@ label_BFC26110: psx_cyc_step(cpu, 0x10022u); #endif /* 0xBFC26114: 00B0082A slt $at, $a1, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x00B0082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E114u); #endif @@ -491187,7 +492268,8 @@ label_BFC26120: psx_cyc_step(cpu, 0x18002u); #endif /* 0xBFC26124: 020F082A slt $at, $s0, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x020F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E124u); #endif @@ -491202,7 +492284,8 @@ label_BFC26120: psx_cyc_step(cpu, 0x20082u); #endif /* 0xBFC2612C: 00F1082A slt $at, $a3, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x00F1082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E12Cu); #endif @@ -491282,7 +492365,8 @@ label_BFC26138: psx_cyc_step(cpu, 0x1020002u); #endif /* 0xBFC2613C: 0238082A slt $at, $s1, $t8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x0238082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E13Cu); #endif @@ -491384,7 +492468,8 @@ label_BFC26150: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC26158: 332E0020 andi $t6, $t9, 0x20 */ - cpu->gpr[14] = cpu->gpr[25] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[14] = cpu->gpr[25] & 0x20u; + PGXP_ALU(0x332E0020u, cpu->gpr[14], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x8003E158u); #endif @@ -491812,7 +492897,8 @@ label_BFC261CC: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC261D4: 31F80020 andi $t8, $t7, 0x20 */ - cpu->gpr[24] = cpu->gpr[15] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x20u; + PGXP_ALU(0x31F80020u, cpu->gpr[24], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x8003E1D4u); #endif @@ -492149,7 +493235,8 @@ label_BFC2622C: psx_cyc_step(cpu, 0x1008002u); #endif /* 0xBFC26238: 01E1C024 and $t8, $t7, $at */ - cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[1]; + PGXP_ALU(0x01E1C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E238u); #endif @@ -492362,7 +493449,8 @@ label_BFC26264: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC26270: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E270u); #endif @@ -492687,7 +493775,8 @@ label_BFC262B4: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC262C4: 2A210072 slti $at, $s1, 114 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (114) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (114) ? 1 : 0); + PGXP_ALU(0x2A210072u, cpu->gpr[1], _pgx1, 0x0072u); } #ifdef PSX_COSIM cosim_instr(0x8003E2C4u); #endif @@ -492726,7 +493815,8 @@ label_BFC262C8: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC262CC: 2A21016B slti $at, $s1, 363 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (363) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (363) ? 1 : 0); + PGXP_ALU(0x2A21016Bu, cpu->gpr[1], _pgx1, 0x016Bu); } #ifdef PSX_COSIM cosim_instr(0x8003E2CCu); #endif @@ -492765,7 +493855,8 @@ label_BFC262D0: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC262D4: 2A010015 slti $at, $s0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (21) ? 1 : 0); + PGXP_ALU(0x2A010015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x8003E2D4u); #endif @@ -492804,7 +493895,8 @@ label_BFC262D8: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC262DC: 2A0100B3 slti $at, $s0, 179 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (179) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (179) ? 1 : 0); + PGXP_ALU(0x2A0100B3u, cpu->gpr[1], _pgx1, 0x00B3u); } #ifdef PSX_COSIM cosim_instr(0x8003E2DCu); #endif @@ -492843,7 +493935,8 @@ label_BFC262E0: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC262E4: 2A0101A7 slti $at, $s0, 423 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (423) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (423) ? 1 : 0); + PGXP_ALU(0x2A0101A7u, cpu->gpr[1], _pgx1, 0x01A7u); } #ifdef PSX_COSIM cosim_instr(0x8003E2E4u); #endif @@ -492949,7 +494042,8 @@ label_BFC262F8: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC262F8: 2A0101A7 slti $at, $s0, 423 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (423) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (423) ? 1 : 0); + PGXP_ALU(0x2A0101A7u, cpu->gpr[1], _pgx1, 0x01A7u); } #ifdef PSX_COSIM cosim_instr(0x8003E2F8u); #endif @@ -492977,7 +494071,8 @@ label_BFC262FC: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC26300: 2A010245 slti $at, $s0, 581 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (581) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (581) ? 1 : 0); + PGXP_ALU(0x2A010245u, cpu->gpr[1], _pgx1, 0x0245u); } #ifdef PSX_COSIM cosim_instr(0x8003E300u); #endif @@ -493929,7 +495024,8 @@ label_BFC263F0: psx_cyc_step(cpu, 0x8120u); #endif /* 0xBFC263F0: 01057824 and $t7, $t0, $a1 */ - cpu->gpr[15] = cpu->gpr[8] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[15] = cpu->gpr[8] & cpu->gpr[5]; + PGXP_ALU(0x01057824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E3F0u); #endif @@ -494094,7 +495190,8 @@ label_BFC26414: psx_cyc_step(cpu, 0x1000120u); #endif /* 0xBFC26414: 0105C024 and $t8, $t0, $a1 */ - cpu->gpr[24] = cpu->gpr[8] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[24] = cpu->gpr[8] & cpu->gpr[5]; + PGXP_ALU(0x0105C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E414u); #endif @@ -496980,7 +498077,8 @@ label_BFC26750: psx_cyc_step(cpu, 0x182u); #endif /* 0xBFC26754: 00E14024 and $t0, $a3, $at */ - cpu->gpr[8] = cpu->gpr[7] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[7] & cpu->gpr[1]; + PGXP_ALU(0x00E14024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E754u); #endif @@ -497585,7 +498683,8 @@ label_BFC267E8: psx_cyc_step(cpu, 0x1082u); #endif /* 0xBFC267F0: 00E16024 and $t4, $a3, $at */ - cpu->gpr[12] = cpu->gpr[7] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[12] = cpu->gpr[7] & cpu->gpr[1]; + PGXP_ALU(0x00E16024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E7F0u); #endif @@ -498222,7 +499321,8 @@ label_BFC26894: psx_cyc_step(cpu, 0x1000082u); #endif /* 0xBFC268A4: 00E1C024 and $t8, $a3, $at */ - cpu->gpr[24] = cpu->gpr[7] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[7] & cpu->gpr[1]; + PGXP_ALU(0x00E1C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003E8A4u); #endif @@ -499451,7 +500551,8 @@ label_BFC26A0C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC26A20: 30A5007F andi $a1, $a1, 0x7F */ - cpu->gpr[5] = cpu->gpr[5] & 0x7Fu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x7Fu; + PGXP_ALU(0x30A5007Fu, cpu->gpr[5], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x8003EA20u); #endif @@ -502151,7 +503252,8 @@ label_BFC26D64: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC26D6C: 30420080 andi $v0, $v0, 0x80 */ - cpu->gpr[2] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30420080u, cpu->gpr[2], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x8003ED6Cu); #endif @@ -502218,7 +503320,8 @@ label_BFC26D78: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC26D80: 31F80080 andi $t8, $t7, 0x80 */ - cpu->gpr[24] = cpu->gpr[15] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x80u; + PGXP_ALU(0x31F80080u, cpu->gpr[24], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x8003ED80u); #endif @@ -502402,7 +503505,8 @@ label_BFC26DA8: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC26DB0: 33280010 andi $t0, $t9, 0x10 */ - cpu->gpr[8] = cpu->gpr[25] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x10u; + PGXP_ALU(0x33280010u, cpu->gpr[8], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x8003EDB0u); #endif @@ -502520,7 +503624,8 @@ label_BFC26DCC: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC26DD0: 312A0010 andi $t2, $t1, 0x10 */ - cpu->gpr[10] = cpu->gpr[9] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x10u; + PGXP_ALU(0x312A0010u, cpu->gpr[10], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x8003EDD0u); #endif @@ -507474,7 +508579,8 @@ label_BFC273A8: psx_cyc_step(cpu, 0x800002u); #endif /* 0xBFC273AC: 2AE1001E slti $at, $s7, 30 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[23] < (30) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[23]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[23] < (30) ? 1 : 0); + PGXP_ALU(0x2AE1001Eu, cpu->gpr[1], _pgx1, 0x001Eu); } #ifdef PSX_COSIM cosim_instr(0x8003F3ACu); #endif @@ -509609,7 +510715,8 @@ label_BFC275F0: psx_cyc_step(cpu, 0x40006u); #endif /* 0xBFC275F0: 0242082A slt $at, $s2, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0242082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003F5F0u); #endif @@ -511325,7 +512432,8 @@ label_BFC27828: psx_cyc_step(cpu, 0x100002u); #endif /* 0xBFC27828: 2A810002 slti $at, $s4, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (2) ? 1 : 0); + PGXP_ALU(0x2A810002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8003F828u); #endif @@ -512262,7 +513370,8 @@ label_BFC27954: psx_cyc_step(cpu, 0x100000Au); #endif /* 0xBFC27968: 0303082B sltu $at, $t8, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0303082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003F968u); #endif @@ -512517,7 +513626,8 @@ label_BFC2799C: psx_cyc_step(cpu, 0x40Au); #endif /* 0xBFC279CC: 0143082B sltu $at, $t2, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[10] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[10] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0143082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003F9CCu); #endif @@ -513102,7 +514212,8 @@ label_BFC27A64: psx_cyc_step(cpu, 0x100000Au); #endif /* 0xBFC27A78: 0303082B sltu $at, $t8, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0303082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003FA78u); #endif @@ -513357,7 +514468,8 @@ label_BFC27AAC: psx_cyc_step(cpu, 0x40Au); #endif /* 0xBFC27ADC: 0143082B sltu $at, $t2, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[10] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[10] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0143082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8003FADCu); #endif @@ -516591,7 +517703,8 @@ label_BFC27EB4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC27EC0: 2C410007 sltiu $at, $v0, 7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000007u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000007u ? 1 : 0); + PGXP_ALU(0x2C410007u, cpu->gpr[1], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x8003FEC0u); #endif @@ -521711,7 +522824,8 @@ label_BFC2867C: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC2867C: 2A012329 slti $at, $s0, 9001 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (9001) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (9001) ? 1 : 0); + PGXP_ALU(0x2A012329u, cpu->gpr[1], _pgx1, 0x2329u); } #ifdef PSX_COSIM cosim_instr(0x8004067Cu); #endif @@ -523120,7 +524234,8 @@ label_BFC2884C: psx_cyc_step(cpu, 0x10802u); #endif /* 0xBFC28850: 020B082A slt $at, $s0, $t3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x020B082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80040850u); #endif @@ -525641,7 +526756,8 @@ label_BFC28B38: psx_cyc_step(cpu, 0x100002u); #endif /* 0xBFC28B48: 2A810002 slti $at, $s4, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (2) ? 1 : 0); + PGXP_ALU(0x2A810002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80040B48u); #endif @@ -530141,7 +531257,8 @@ label_BFC29174: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC29188: 28410002 slti $at, $v0, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (2) ? 1 : 0); + PGXP_ALU(0x28410002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80041188u); #endif @@ -531641,7 +532758,8 @@ label_BFC2932C: psx_cyc_step(cpu, 0x82u); #endif /* 0xBFC29338: 28E11000 slti $at, $a3, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (4096) ? 1 : 0); + PGXP_ALU(0x28E11000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80041338u); #endif @@ -531751,7 +532869,8 @@ label_BFC29350: psx_cyc_step(cpu, 0x86u); #endif /* 0xBFC2935C: 0047082A slt $at, $v0, $a3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x0047082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004135Cu); #endif @@ -535710,7 +536829,8 @@ label_BFC2986C: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC2986C: 29011000 slti $at, $t0, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4096) ? 1 : 0); + PGXP_ALU(0x29011000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x8004186Cu); #endif @@ -535728,7 +536848,8 @@ label_BFC2986C: psx_cyc_step(cpu, 0x182u); #endif /* 0xBFC29874: 00E8082A slt $at, $a3, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x00E8082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80041874u); #endif @@ -535769,7 +536890,8 @@ label_BFC29878: psx_cyc_step(cpu, 0x182u); #endif /* 0xBFC2987C: 00E8082A slt $at, $a3, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x00E8082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004187Cu); #endif @@ -536201,7 +537323,8 @@ label_BFC298EC: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC29908: 304E001F andi $t6, $v0, 0x1F */ - cpu->gpr[14] = cpu->gpr[2] & 0x1Fu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1Fu; + PGXP_ALU(0x304E001Fu, cpu->gpr[14], _pgx1, 0x001Fu); } #ifdef PSX_COSIM cosim_instr(0x80041908u); #endif @@ -536319,7 +537442,8 @@ label_BFC298EC: psx_cyc_step(cpu, 0x2000200u); #endif /* 0xBFC29934: 3329FFFF andi $t1, $t9, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[25] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[9] = cpu->gpr[25] & 0xFFFFu; + PGXP_ALU(0x3329FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80041934u); #endif @@ -536327,7 +537451,8 @@ label_BFC298EC: psx_cyc_step(cpu, 0x604u); #endif /* 0xBFC29938: 01225026 xor $t2, $t1, $v0 */ - cpu->gpr[10] = cpu->gpr[9] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[9] ^ cpu->gpr[2]; + PGXP_ALU(0x01225026u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80041938u); #endif @@ -536335,7 +537460,8 @@ label_BFC298EC: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC2993C: 314B001F andi $t3, $t2, 0x1F */ - cpu->gpr[11] = cpu->gpr[10] & 0x1Fu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x1Fu; + PGXP_ALU(0x314B001Fu, cpu->gpr[11], _pgx1, 0x001Fu); } #ifdef PSX_COSIM cosim_instr(0x8004193Cu); #endif @@ -536346,7 +537472,8 @@ label_BFC298EC: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC29940: 01621026 xor $v0, $t3, $v0 */ - cpu->gpr[2] = cpu->gpr[11] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[11] ^ cpu->gpr[2]; + PGXP_ALU(0x01621026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80041940u); #endif @@ -536354,7 +537481,8 @@ label_BFC298EC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC29944: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80041944u); #endif @@ -536803,7 +537931,8 @@ label_BFC299B0: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC299B8: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800419B8u); #endif @@ -536811,7 +537940,8 @@ label_BFC299B0: psx_cyc_step(cpu, 0x2000600u); #endif /* 0xBFC299BC: 03295026 xor $t2, $t9, $t1 */ - cpu->gpr[10] = cpu->gpr[25] ^ cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[25] ^ cpu->gpr[9]; + PGXP_ALU(0x03295026u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800419BCu); #endif @@ -536840,7 +537970,8 @@ label_BFC299B0: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC299C8: 01821026 xor $v0, $t4, $v0 */ - cpu->gpr[2] = cpu->gpr[12] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[12] ^ cpu->gpr[2]; + PGXP_ALU(0x01821026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800419C8u); #endif @@ -536848,7 +537979,8 @@ label_BFC299B0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC299CC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800419CCu); #endif @@ -537122,7 +538254,8 @@ label_BFC299F4: psx_cyc_step(cpu, 0x2000200u); #endif /* 0xBFC29A18: 3329FFFF andi $t1, $t9, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[25] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[9] = cpu->gpr[25] & 0xFFFFu; + PGXP_ALU(0x3329FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80041A18u); #endif @@ -537142,7 +538275,8 @@ label_BFC299F4: psx_cyc_step(cpu, 0xE00u); #endif /* 0xBFC29A20: 012A5826 xor $t3, $t1, $t2 */ - cpu->gpr[11] = cpu->gpr[9] ^ cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[9] ^ cpu->gpr[10]; + PGXP_ALU(0x012A5826u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80041A20u); #endif @@ -537168,7 +538302,8 @@ label_BFC299F4: psx_cyc_step(cpu, 0x2004u); #endif /* 0xBFC29A2C: 01A21026 xor $v0, $t5, $v0 */ - cpu->gpr[2] = cpu->gpr[13] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[13] ^ cpu->gpr[2]; + PGXP_ALU(0x01A21026u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80041A2Cu); #endif @@ -537179,7 +538314,8 @@ label_BFC299F4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC29A30: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80041A30u); #endif @@ -537517,7 +538653,8 @@ label_BFC29A88: psx_cyc_step(cpu, 0xA0002u); #endif /* 0xBFC29A8C: 0271082B sltu $at, $s3, $s1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0271082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80041A8Cu); #endif @@ -540043,7 +541180,8 @@ label_BFC29D84: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC29D90: 2841003C slti $at, $v0, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (60) ? 1 : 0); + PGXP_ALU(0x2841003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x80041D90u); #endif @@ -540987,7 +542125,8 @@ label_BFC29EE0: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC29EE0: 29210400 slti $at, $t1, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (1024) ? 1 : 0); + PGXP_ALU(0x29210400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x80041EE0u); #endif @@ -541576,7 +542715,8 @@ label_BFC29F9C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC29FA4: 2841005B slti $at, $v0, 91 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (91) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (91) ? 1 : 0); + PGXP_ALU(0x2841005Bu, cpu->gpr[1], _pgx1, 0x005Bu); } #ifdef PSX_COSIM cosim_instr(0x80041FA4u); #endif @@ -542249,7 +543389,8 @@ label_BFC2A068: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2A094: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80042094u); #endif @@ -542275,7 +543416,8 @@ label_BFC2A068: psx_cyc_step(cpu, 0x300000u); #endif /* 0xBFC2A0A0: 32B4FFFF andi $s4, $s5, 0xFFFF */ - cpu->gpr[20] = cpu->gpr[21] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[21]; cpu->gpr[20] = cpu->gpr[21] & 0xFFFFu; + PGXP_ALU(0x32B4FFFFu, cpu->gpr[20], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800420A0u); #endif @@ -542364,7 +543506,8 @@ label_BFC2A068: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2A0C8: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800420C8u); #endif @@ -542462,7 +543605,8 @@ label_BFC2A068: psx_cyc_step(cpu, 0x40020u); #endif /* 0xBFC2A0F4: 3245FFFF andi $a1, $s2, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[18] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[5] = cpu->gpr[18] & 0xFFFFu; + PGXP_ALU(0x3245FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800420F4u); #endif @@ -542470,7 +543614,8 @@ label_BFC2A068: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2A0F8: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800420F8u); #endif @@ -542577,7 +543722,8 @@ label_BFC2A068: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2A128: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80042128u); #endif @@ -542809,7 +543955,8 @@ label_BFC2A158: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2A188: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80042188u); #endif @@ -542925,7 +544072,8 @@ label_BFC2A158: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2A1BC: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800421BCu); #endif @@ -543023,7 +544171,8 @@ label_BFC2A158: psx_cyc_step(cpu, 0x200040u); #endif /* 0xBFC2A1E8: 32A6FFFF andi $a2, $s5, 0xFFFF */ - cpu->gpr[6] = cpu->gpr[21] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[21]; cpu->gpr[6] = cpu->gpr[21] & 0xFFFFu; + PGXP_ALU(0x32A6FFFFu, cpu->gpr[6], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800421E8u); #endif @@ -543031,7 +544180,8 @@ label_BFC2A158: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2A1EC: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800421ECu); #endif @@ -543093,7 +544243,8 @@ label_BFC2A158: psx_cyc_step(cpu, 0x40020u); #endif /* 0xBFC2A208: 3245FFFF andi $a1, $s2, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[18] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[5] = cpu->gpr[18] & 0xFFFFu; + PGXP_ALU(0x3245FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80042208u); #endif @@ -543122,7 +544273,8 @@ label_BFC2A158: psx_cyc_step(cpu, 0x80000080u); #endif /* 0xBFC2A214: 33E7FFFF andi $a3, $ra, 0xFFFF */ - cpu->gpr[7] = cpu->gpr[31] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[31]; cpu->gpr[7] = cpu->gpr[31] & 0xFFFFu; + PGXP_ALU(0x33E7FFFFu, cpu->gpr[7], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80042214u); #endif @@ -543211,7 +544363,8 @@ label_BFC2A158: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2A23C: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004223Cu); #endif @@ -543228,7 +544381,8 @@ label_BFC2A158: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2A244: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80042244u); #endif @@ -543245,7 +544399,8 @@ label_BFC2A158: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2A24C: 31D9FFFF andi $t9, $t6, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[25] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31D9FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004224Cu); #endif @@ -545231,7 +546386,8 @@ label_BFC2A578: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC2A57C: 2C810081 sltiu $at, $a0, 129 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000081u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000081u ? 1 : 0); + PGXP_ALU(0x2C810081u, cpu->gpr[1], _pgx1, 0x0081u); } #ifdef PSX_COSIM cosim_instr(0x8004257Cu); #endif @@ -545392,7 +546548,8 @@ label_BFC2A5A0: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC2A5A0: 2C810081 sltiu $at, $a0, 129 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000081u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000081u ? 1 : 0); + PGXP_ALU(0x2C810081u, cpu->gpr[1], _pgx1, 0x0081u); } #ifdef PSX_COSIM cosim_instr(0x800425A0u); #endif @@ -545417,7 +546574,8 @@ label_BFC2A5A4: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC2A5A8: 2C810099 sltiu $at, $a0, 153 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000099u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000099u ? 1 : 0); + PGXP_ALU(0x2C810099u, cpu->gpr[1], _pgx1, 0x0099u); } #ifdef PSX_COSIM cosim_instr(0x800425A8u); #endif @@ -545518,7 +546676,8 @@ label_BFC2A5B4: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC2A5C0: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800425C0u); #endif @@ -545602,7 +546761,8 @@ label_BFC2A5D4: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC2A5D4: 3058FFFF andi $t8, $v0, 0xFFFF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3058FFFFu, cpu->gpr[24], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800425D4u); #endif @@ -545617,7 +546777,8 @@ label_BFC2A5D4: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC2A5DC: 3045FFFF andi $a1, $v0, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3045FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800425DCu); #endif @@ -545708,7 +546869,8 @@ label_BFC2A5EC: psx_cyc_step(cpu, 0x200022u); #endif /* 0xBFC2A5EC: 00B5082B sltu $at, $a1, $s5 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[21] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[21]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[21] ? 1 : 0); + PGXP_ALU(0x00B5082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800425ECu); #endif @@ -545726,7 +546888,8 @@ label_BFC2A5EC: psx_cyc_step(cpu, 0x800022u); #endif /* 0xBFC2A5F4: 00B7082B sltu $at, $a1, $s7 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[23] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[23]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[23] ? 1 : 0); + PGXP_ALU(0x00B7082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800425F4u); #endif @@ -545898,7 +547061,8 @@ label_BFC2A61C: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2A620: 00A1082B sltu $at, $a1, $at */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + PGXP_ALU(0x00A1082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80042620u); #endif @@ -545946,7 +547110,8 @@ label_BFC2A62C: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2A62C: 00A1082B sltu $at, $a1, $at */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + PGXP_ALU(0x00A1082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004262Cu); #endif @@ -546327,7 +547492,8 @@ label_BFC2A690: psx_cyc_step(cpu, 0x400002u); #endif /* 0xBFC2A69C: 2AC10100 slti $at, $s6, 256 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (256) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (256) ? 1 : 0); + PGXP_ALU(0x2AC10100u, cpu->gpr[1], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x8004269Cu); #endif @@ -546519,7 +547685,8 @@ label_BFC2A6CC: psx_cyc_step(cpu, 0x80400002u); #endif /* 0xBFC2A6CC: 03F6082A slt $at, $ra, $s6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[31] < (int32_t)cpu->gpr[22] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[31]; uint32_t _pgx2 = cpu->gpr[22]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[31] < (int32_t)cpu->gpr[22] ? 1 : 0); + PGXP_ALU(0x03F6082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800426CCu); #endif @@ -546733,7 +547900,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC2A714: 30840001 andi $a0, $a0, 0x1 */ - cpu->gpr[4] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30840001u, cpu->gpr[4], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042714u); #endif @@ -546741,7 +547909,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC2A718: 316B0001 andi $t3, $t3, 0x1 */ - cpu->gpr[11] = cpu->gpr[11] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0x1u; + PGXP_ALU(0x316B0001u, cpu->gpr[11], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042718u); #endif @@ -546749,7 +547918,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC2A71C: 30630001 andi $v1, $v1, 0x1 */ - cpu->gpr[3] = cpu->gpr[3] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x1u; + PGXP_ALU(0x30630001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004271Cu); #endif @@ -546808,7 +547978,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC2A734: 30A50001 andi $a1, $a1, 0x1 */ - cpu->gpr[5] = cpu->gpr[5] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x1u; + PGXP_ALU(0x30A50001u, cpu->gpr[5], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042734u); #endif @@ -546864,7 +548035,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC2A74C: 30C60001 andi $a2, $a2, 0x1 */ - cpu->gpr[6] = cpu->gpr[6] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x1u; + PGXP_ALU(0x30C60001u, cpu->gpr[6], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004274Cu); #endif @@ -546953,7 +548125,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC2A770: 31080001 andi $t0, $t0, 0x1 */ - cpu->gpr[8] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31080001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042770u); #endif @@ -546961,7 +548134,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC2A774: 30E70001 andi $a3, $a3, 0x1 */ - cpu->gpr[7] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30E70001u, cpu->gpr[7], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042774u); #endif @@ -547029,7 +548203,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC2A790: 31290001 andi $t1, $t1, 0x1 */ - cpu->gpr[9] = cpu->gpr[9] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0x1u; + PGXP_ALU(0x31290001u, cpu->gpr[9], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042790u); #endif @@ -547085,7 +548260,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC2A7A8: 304C0001 andi $t4, $v0, 0x1 */ - cpu->gpr[12] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304C0001u, cpu->gpr[12], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800427A8u); #endif @@ -547171,7 +548347,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC2A7CC: 30630001 andi $v1, $v1, 0x1 */ - cpu->gpr[3] = cpu->gpr[3] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x1u; + PGXP_ALU(0x30630001u, cpu->gpr[3], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800427CCu); #endif @@ -547182,7 +548359,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC2A7D0: 30840001 andi $a0, $a0, 0x1 */ - cpu->gpr[4] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30840001u, cpu->gpr[4], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800427D0u); #endif @@ -547247,7 +548425,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC2A7EC: 30A50001 andi $a1, $a1, 0x1 */ - cpu->gpr[5] = cpu->gpr[5] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x1u; + PGXP_ALU(0x30A50001u, cpu->gpr[5], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800427ECu); #endif @@ -547306,7 +548485,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC2A804: 30C60001 andi $a2, $a2, 0x1 */ - cpu->gpr[6] = cpu->gpr[6] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x1u; + PGXP_ALU(0x30C60001u, cpu->gpr[6], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042804u); #endif @@ -547401,7 +548581,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC2A82C: 30E70001 andi $a3, $a3, 0x1 */ - cpu->gpr[7] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30E70001u, cpu->gpr[7], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004282Cu); #endif @@ -547412,7 +548593,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC2A830: 31080001 andi $t0, $t0, 0x1 */ - cpu->gpr[8] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31080001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042830u); #endif @@ -547477,7 +548659,8 @@ label_BFC2A700: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC2A84C: 31290001 andi $t1, $t1, 0x1 */ - cpu->gpr[9] = cpu->gpr[9] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0x1u; + PGXP_ALU(0x31290001u, cpu->gpr[9], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004284Cu); #endif @@ -547672,7 +548855,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2A894: 31CF0001 andi $t7, $t6, 0x1 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31CF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042894u); #endif @@ -547680,7 +548864,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2A898: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042898u); #endif @@ -547718,7 +548903,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2A8A8: 31F90001 andi $t9, $t7, 0x1 */ - cpu->gpr[25] = cpu->gpr[15] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[25] = cpu->gpr[15] & 0x1u; + PGXP_ALU(0x31F90001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800428A8u); #endif @@ -547756,7 +548942,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2A8B8: 332E0001 andi $t6, $t9, 0x1 */ - cpu->gpr[14] = cpu->gpr[25] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[14] = cpu->gpr[25] & 0x1u; + PGXP_ALU(0x332E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800428B8u); #endif @@ -547824,7 +549011,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2A8D4: 31CF0001 andi $t7, $t6, 0x1 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31CF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800428D4u); #endif @@ -547832,7 +549020,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2A8D8: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800428D8u); #endif @@ -547870,7 +549059,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2A8E8: 332F0001 andi $t7, $t9, 0x1 */ - cpu->gpr[15] = cpu->gpr[25] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[15] = cpu->gpr[25] & 0x1u; + PGXP_ALU(0x332F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800428E8u); #endif @@ -547899,7 +549089,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC2A8F4: 304F0001 andi $t7, $v0, 0x1 */ - cpu->gpr[15] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800428F4u); #endif @@ -547976,7 +549167,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2A914: 31F90001 andi $t9, $t7, 0x1 */ - cpu->gpr[25] = cpu->gpr[15] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[25] = cpu->gpr[15] & 0x1u; + PGXP_ALU(0x31F90001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042914u); #endif @@ -547984,7 +549176,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x1004000u); #endif /* 0xBFC2A918: 330E0001 andi $t6, $t8, 0x1 */ - cpu->gpr[14] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[14] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x330E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042918u); #endif @@ -548022,7 +549215,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2A928: 31D90001 andi $t9, $t6, 0x1 */ - cpu->gpr[25] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[25] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31D90001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042928u); #endif @@ -548060,7 +549254,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2A938: 33380001 andi $t8, $t9, 0x1 */ - cpu->gpr[24] = cpu->gpr[25] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[24] = cpu->gpr[25] & 0x1u; + PGXP_ALU(0x33380001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042938u); #endif @@ -548137,7 +549332,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x1004000u); #endif /* 0xBFC2A958: 330E0001 andi $t6, $t8, 0x1 */ - cpu->gpr[14] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[14] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x330E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80042958u); #endif @@ -548145,7 +549341,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2A95C: 31F90001 andi $t9, $t7, 0x1 */ - cpu->gpr[25] = cpu->gpr[15] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[25] = cpu->gpr[15] & 0x1u; + PGXP_ALU(0x31F90001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004295Cu); #endif @@ -548183,7 +549380,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2A96C: 332E0001 andi $t6, $t9, 0x1 */ - cpu->gpr[14] = cpu->gpr[25] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[14] = cpu->gpr[25] & 0x1u; + PGXP_ALU(0x332E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004296Cu); #endif @@ -548221,7 +549419,8 @@ label_BFC2A884: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2A97C: 31CF0001 andi $t7, $t6, 0x1 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31CF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004297Cu); #endif @@ -548360,7 +549559,8 @@ label_BFC2A9A4: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC2A9A8: 2A210010 slti $at, $s1, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (16) ? 1 : 0); + PGXP_ALU(0x2A210010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x800429A8u); #endif @@ -548378,7 +549578,8 @@ label_BFC2A9A4: psx_cyc_step(cpu, 0x480002u); #endif /* 0xBFC2A9B0: 0276082A slt $at, $s3, $s6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[22] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[22]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[22] ? 1 : 0); + PGXP_ALU(0x0276082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800429B0u); #endif @@ -548417,7 +549618,8 @@ label_BFC2A9B4: psx_cyc_step(cpu, 0x400002u); #endif /* 0xBFC2A9B8: 2AC10010 slti $at, $s6, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (16) ? 1 : 0); + PGXP_ALU(0x2AC10010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x800429B8u); #endif @@ -548461,7 +549663,8 @@ label_BFC2A9BC: psx_cyc_step(cpu, 0x800002u); #endif /* 0xBFC2A9C0: 2AE10100 slti $at, $s7, 256 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[23] < (256) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[23]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[23] < (256) ? 1 : 0); + PGXP_ALU(0x2AE10100u, cpu->gpr[1], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x800429C0u); #endif @@ -548476,7 +549679,8 @@ label_BFC2A9BC: psx_cyc_step(cpu, 0x400002u); #endif /* 0xBFC2A9C8: 2AC10010 slti $at, $s6, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (16) ? 1 : 0); + PGXP_ALU(0x2AC10010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x800429C8u); #endif @@ -549186,7 +550390,8 @@ label_BFC2AA20: psx_cyc_step(cpu, 0x400002u); #endif /* 0xBFC2AAB0: 2AC10011 slti $at, $s6, 17 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (17) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (17) ? 1 : 0); + PGXP_ALU(0x2AC10011u, cpu->gpr[1], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x80042AB0u); #endif @@ -549290,7 +550495,8 @@ label_BFC2AAC8: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC2AACC: 3222000F andi $v0, $s1, 0xF */ - cpu->gpr[2] = cpu->gpr[17] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[2] = cpu->gpr[17] & 0xFu; + PGXP_ALU(0x3222000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80042ACCu); #endif @@ -549450,7 +550656,8 @@ label_BFC2AAE4: psx_cyc_step(cpu, 0x400002u); #endif /* 0xBFC2AAF4: 2AC10010 slti $at, $s6, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (16) ? 1 : 0); + PGXP_ALU(0x2AC10010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80042AF4u); #endif @@ -549591,7 +550798,8 @@ label_BFC2AB18: psx_cyc_step(cpu, 0x2080000u); #endif /* 0xBFC2AB1C: 3279003F andi $t9, $s3, 0x3F */ - cpu->gpr[25] = cpu->gpr[19] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[19]; cpu->gpr[25] = cpu->gpr[19] & 0x3Fu; + PGXP_ALU(0x3279003Fu, cpu->gpr[25], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80042B1Cu); #endif @@ -549681,7 +550889,8 @@ label_BFC2AB2C: psx_cyc_step(cpu, 0x2000012u); #endif /* 0xBFC2AB2C: 0324082A slt $at, $t9, $a0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0324082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80042B2Cu); #endif @@ -550264,7 +551473,8 @@ label_BFC2ABD8: psx_cyc_step(cpu, 0x20006u); #endif /* 0xBFC2ABE8: 0222082A slt $at, $s1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0222082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80042BE8u); #endif @@ -550814,7 +552024,8 @@ label_BFC2ACEC: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC2ACFC: 2DC10004 sltiu $at, $t6, 4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000004u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000004u ? 1 : 0); + PGXP_ALU(0x2DC10004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80042CFCu); #endif @@ -550984,7 +552195,8 @@ label_BFC2AD24: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD2C: 2C410040 sltiu $at, $v0, 64 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C410040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80042D2Cu); #endif @@ -551002,7 +552214,8 @@ label_BFC2AD24: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD34: 2C41007F sltiu $at, $v0, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2C41007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x80042D34u); #endif @@ -551041,7 +552254,8 @@ label_BFC2AD38: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD3C: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80042D3Cu); #endif @@ -551113,7 +552327,8 @@ label_BFC2AD48: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD48: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80042D48u); #endif @@ -551141,7 +552356,8 @@ label_BFC2AD4C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD50: 2C4100AD sltiu $at, $v0, 173 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000ADu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000ADu ? 1 : 0); + PGXP_ALU(0x2C4100ADu, cpu->gpr[1], _pgx1, 0x00ADu); } #ifdef PSX_COSIM cosim_instr(0x80042D50u); #endif @@ -551180,7 +552396,8 @@ label_BFC2AD54: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD58: 2C4100B8 sltiu $at, $v0, 184 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B8u ? 1 : 0); + PGXP_ALU(0x2C4100B8u, cpu->gpr[1], _pgx1, 0x00B8u); } #ifdef PSX_COSIM cosim_instr(0x80042D58u); #endif @@ -551255,7 +552472,8 @@ label_BFC2AD64: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD64: 2C4100B8 sltiu $at, $v0, 184 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B8u ? 1 : 0); + PGXP_ALU(0x2C4100B8u, cpu->gpr[1], _pgx1, 0x00B8u); } #ifdef PSX_COSIM cosim_instr(0x80042D64u); #endif @@ -551280,7 +552498,8 @@ label_BFC2AD68: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD6C: 2C4100C0 sltiu $at, $v0, 192 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C0u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C0u ? 1 : 0); + PGXP_ALU(0x2C4100C0u, cpu->gpr[1], _pgx1, 0x00C0u); } #ifdef PSX_COSIM cosim_instr(0x80042D6Cu); #endif @@ -551319,7 +552538,8 @@ label_BFC2AD70: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD74: 2C4100C8 sltiu $at, $v0, 200 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C8u ? 1 : 0); + PGXP_ALU(0x2C4100C8u, cpu->gpr[1], _pgx1, 0x00C8u); } #ifdef PSX_COSIM cosim_instr(0x80042D74u); #endif @@ -551391,7 +552611,8 @@ label_BFC2AD80: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD80: 2C4100C8 sltiu $at, $v0, 200 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000C8u ? 1 : 0); + PGXP_ALU(0x2C4100C8u, cpu->gpr[1], _pgx1, 0x00C8u); } #ifdef PSX_COSIM cosim_instr(0x80042D80u); #endif @@ -551416,7 +552637,8 @@ label_BFC2AD84: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD88: 2C4100CF sltiu $at, $v0, 207 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000CFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000CFu ? 1 : 0); + PGXP_ALU(0x2C4100CFu, cpu->gpr[1], _pgx1, 0x00CFu); } #ifdef PSX_COSIM cosim_instr(0x80042D88u); #endif @@ -551458,7 +552680,8 @@ label_BFC2AD8C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD90: 2C4100DA sltiu $at, $v0, 218 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000DAu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000DAu ? 1 : 0); + PGXP_ALU(0x2C4100DAu, cpu->gpr[1], _pgx1, 0x00DAu); } #ifdef PSX_COSIM cosim_instr(0x80042D90u); #endif @@ -551530,7 +552753,8 @@ label_BFC2AD9C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AD9C: 2C4100DA sltiu $at, $v0, 218 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000DAu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000DAu ? 1 : 0); + PGXP_ALU(0x2C4100DAu, cpu->gpr[1], _pgx1, 0x00DAu); } #ifdef PSX_COSIM cosim_instr(0x80042D9Cu); #endif @@ -551555,7 +552779,8 @@ label_BFC2ADA0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2ADA4: 2C4100E9 sltiu $at, $v0, 233 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000E9u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000E9u ? 1 : 0); + PGXP_ALU(0x2C4100E9u, cpu->gpr[1], _pgx1, 0x00E9u); } #ifdef PSX_COSIM cosim_instr(0x80042DA4u); #endif @@ -551594,7 +552819,8 @@ label_BFC2ADA8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2ADAC: 2C4100F0 sltiu $at, $v0, 240 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F0u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F0u ? 1 : 0); + PGXP_ALU(0x2C4100F0u, cpu->gpr[1], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80042DACu); #endif @@ -551666,7 +552892,8 @@ label_BFC2ADB8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2ADB8: 2C4100F0 sltiu $at, $v0, 240 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F0u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F0u ? 1 : 0); + PGXP_ALU(0x2C4100F0u, cpu->gpr[1], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80042DB8u); #endif @@ -551694,7 +552921,8 @@ label_BFC2ADBC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2ADC0: 2C4100F8 sltiu $at, $v0, 248 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F8u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F8u ? 1 : 0); + PGXP_ALU(0x2C4100F8u, cpu->gpr[1], _pgx1, 0x00F8u); } #ifdef PSX_COSIM cosim_instr(0x80042DC0u); #endif @@ -552058,7 +553286,8 @@ label_BFC2AE18: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE20: 2C41004F sltiu $at, $v0, 79 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000004Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000004Fu ? 1 : 0); + PGXP_ALU(0x2C41004Fu, cpu->gpr[1], _pgx1, 0x004Fu); } #ifdef PSX_COSIM cosim_instr(0x80042E20u); #endif @@ -552073,7 +553302,8 @@ label_BFC2AE18: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE28: 2C410059 sltiu $at, $v0, 89 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000059u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000059u ? 1 : 0); + PGXP_ALU(0x2C410059u, cpu->gpr[1], _pgx1, 0x0059u); } #ifdef PSX_COSIM cosim_instr(0x80042E28u); #endif @@ -552115,7 +553345,8 @@ label_BFC2AE2C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE30: 2C410060 sltiu $at, $v0, 96 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000060u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000060u ? 1 : 0); + PGXP_ALU(0x2C410060u, cpu->gpr[1], _pgx1, 0x0060u); } #ifdef PSX_COSIM cosim_instr(0x80042E30u); #endif @@ -552187,7 +553418,8 @@ label_BFC2AE3C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE3C: 2C410060 sltiu $at, $v0, 96 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000060u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000060u ? 1 : 0); + PGXP_ALU(0x2C410060u, cpu->gpr[1], _pgx1, 0x0060u); } #ifdef PSX_COSIM cosim_instr(0x80042E3Cu); #endif @@ -552212,7 +553444,8 @@ label_BFC2AE40: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE44: 2C41007A sltiu $at, $v0, 122 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Au ? 1 : 0); + PGXP_ALU(0x2C41007Au, cpu->gpr[1], _pgx1, 0x007Au); } #ifdef PSX_COSIM cosim_instr(0x80042E44u); #endif @@ -552251,7 +553484,8 @@ label_BFC2AE48: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE4C: 2C410081 sltiu $at, $v0, 129 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000081u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000081u ? 1 : 0); + PGXP_ALU(0x2C410081u, cpu->gpr[1], _pgx1, 0x0081u); } #ifdef PSX_COSIM cosim_instr(0x80042E4Cu); #endif @@ -552323,7 +553557,8 @@ label_BFC2AE58: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE58: 2C410081 sltiu $at, $v0, 129 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000081u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000081u ? 1 : 0); + PGXP_ALU(0x2C410081u, cpu->gpr[1], _pgx1, 0x0081u); } #ifdef PSX_COSIM cosim_instr(0x80042E58u); #endif @@ -552351,7 +553586,8 @@ label_BFC2AE5C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE60: 2C41009B sltiu $at, $v0, 155 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Bu ? 1 : 0); + PGXP_ALU(0x2C41009Bu, cpu->gpr[1], _pgx1, 0x009Bu); } #ifdef PSX_COSIM cosim_instr(0x80042E60u); #endif @@ -552390,7 +553626,8 @@ label_BFC2AE64: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE68: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x80042E68u); #endif @@ -552465,7 +553702,8 @@ label_BFC2AE74: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE74: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x80042E74u); #endif @@ -552490,7 +553728,8 @@ label_BFC2AE78: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE7C: 2C4100F2 sltiu $at, $v0, 242 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F2u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F2u ? 1 : 0); + PGXP_ALU(0x2C4100F2u, cpu->gpr[1], _pgx1, 0x00F2u); } #ifdef PSX_COSIM cosim_instr(0x80042E7Cu); #endif @@ -552567,7 +553806,8 @@ label_BFC2AE8C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AE8C: 2C4100F2 sltiu $at, $v0, 242 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F2u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000F2u ? 1 : 0); + PGXP_ALU(0x2C4100F2u, cpu->gpr[1], _pgx1, 0x00F2u); } #ifdef PSX_COSIM cosim_instr(0x80042E8Cu); #endif @@ -552815,7 +554055,8 @@ label_BFC2AED0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AED8: 2C410040 sltiu $at, $v0, 64 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C410040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80042ED8u); #endif @@ -552833,7 +554074,8 @@ label_BFC2AED0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AEE0: 2C41007F sltiu $at, $v0, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2C41007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x80042EE0u); #endif @@ -552872,7 +554114,8 @@ label_BFC2AEE4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AEE8: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80042EE8u); #endif @@ -552947,7 +554190,8 @@ label_BFC2AEF4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AEF4: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80042EF4u); #endif @@ -552972,7 +554216,8 @@ label_BFC2AEF8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AEFC: 2C410097 sltiu $at, $v0, 151 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000097u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000097u ? 1 : 0); + PGXP_ALU(0x2C410097u, cpu->gpr[1], _pgx1, 0x0097u); } #ifdef PSX_COSIM cosim_instr(0x80042EFCu); #endif @@ -553011,7 +554256,8 @@ label_BFC2AF00: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AF04: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x80042F04u); #endif @@ -553083,7 +554329,8 @@ label_BFC2AF10: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AF10: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x80042F10u); #endif @@ -553108,7 +554355,8 @@ label_BFC2AF14: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AF18: 2C4100B7 sltiu $at, $v0, 183 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B7u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000B7u ? 1 : 0); + PGXP_ALU(0x2C4100B7u, cpu->gpr[1], _pgx1, 0x00B7u); } #ifdef PSX_COSIM cosim_instr(0x80042F18u); #endif @@ -553150,7 +554398,8 @@ label_BFC2AF1C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AF20: 2C4100BF sltiu $at, $v0, 191 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + PGXP_ALU(0x2C4100BFu, cpu->gpr[1], _pgx1, 0x00BFu); } #ifdef PSX_COSIM cosim_instr(0x80042F20u); #endif @@ -553222,7 +554471,8 @@ label_BFC2AF2C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AF2C: 2C4100BF sltiu $at, $v0, 191 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + PGXP_ALU(0x2C4100BFu, cpu->gpr[1], _pgx1, 0x00BFu); } #ifdef PSX_COSIM cosim_instr(0x80042F2Cu); #endif @@ -553247,7 +554497,8 @@ label_BFC2AF30: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AF34: 2C4100D7 sltiu $at, $v0, 215 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000D7u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000D7u ? 1 : 0); + PGXP_ALU(0x2C4100D7u, cpu->gpr[1], _pgx1, 0x00D7u); } #ifdef PSX_COSIM cosim_instr(0x80042F34u); #endif @@ -553327,7 +554578,8 @@ label_BFC2AF44: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AF44: 2C4100D7 sltiu $at, $v0, 215 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000D7u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000D7u ? 1 : 0); + PGXP_ALU(0x2C4100D7u, cpu->gpr[1], _pgx1, 0x00D7u); } #ifdef PSX_COSIM cosim_instr(0x80042F44u); #endif @@ -553575,7 +554827,8 @@ label_BFC2AF88: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AF90: 2C410040 sltiu $at, $v0, 64 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C410040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80042F90u); #endif @@ -553590,7 +554843,8 @@ label_BFC2AF88: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AF98: 2C410061 sltiu $at, $v0, 97 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000061u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000061u ? 1 : 0); + PGXP_ALU(0x2C410061u, cpu->gpr[1], _pgx1, 0x0061u); } #ifdef PSX_COSIM cosim_instr(0x80042F98u); #endif @@ -553632,7 +554886,8 @@ label_BFC2AF9C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFA0: 2C410070 sltiu $at, $v0, 112 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000070u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000070u ? 1 : 0); + PGXP_ALU(0x2C410070u, cpu->gpr[1], _pgx1, 0x0070u); } #ifdef PSX_COSIM cosim_instr(0x80042FA0u); #endif @@ -553704,7 +554959,8 @@ label_BFC2AFAC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFAC: 2C410070 sltiu $at, $v0, 112 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000070u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000070u ? 1 : 0); + PGXP_ALU(0x2C410070u, cpu->gpr[1], _pgx1, 0x0070u); } #ifdef PSX_COSIM cosim_instr(0x80042FACu); #endif @@ -553729,7 +554985,8 @@ label_BFC2AFB0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFB4: 2C41007F sltiu $at, $v0, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2C41007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x80042FB4u); #endif @@ -553768,7 +555025,8 @@ label_BFC2AFB8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFBC: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80042FBCu); #endif @@ -553840,7 +555098,8 @@ label_BFC2AFC8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFC8: 2C410080 sltiu $at, $v0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C410080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80042FC8u); #endif @@ -553868,7 +555127,8 @@ label_BFC2AFCC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFD0: 2C410092 sltiu $at, $v0, 146 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000092u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000092u ? 1 : 0); + PGXP_ALU(0x2C410092u, cpu->gpr[1], _pgx1, 0x0092u); } #ifdef PSX_COSIM cosim_instr(0x80042FD0u); #endif @@ -553907,7 +555167,8 @@ label_BFC2AFD4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFD8: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x80042FD8u); #endif @@ -553982,7 +555243,8 @@ label_BFC2AFE4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFE4: 2C41009F sltiu $at, $v0, 159 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000009Fu ? 1 : 0); + PGXP_ALU(0x2C41009Fu, cpu->gpr[1], _pgx1, 0x009Fu); } #ifdef PSX_COSIM cosim_instr(0x80042FE4u); #endif @@ -554007,7 +555269,8 @@ label_BFC2AFE8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFEC: 2C4100BF sltiu $at, $v0, 191 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + PGXP_ALU(0x2C4100BFu, cpu->gpr[1], _pgx1, 0x00BFu); } #ifdef PSX_COSIM cosim_instr(0x80042FECu); #endif @@ -554084,7 +555347,8 @@ label_BFC2AFFC: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2AFFC: 2C4100BF sltiu $at, $v0, 191 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x000000BFu ? 1 : 0); + PGXP_ALU(0x2C4100BFu, cpu->gpr[1], _pgx1, 0x00BFu); } #ifdef PSX_COSIM cosim_instr(0x80042FFCu); #endif @@ -554332,7 +555596,8 @@ label_BFC2B040: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2B048: 2C41007F sltiu $at, $v0, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2C41007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x80043048u); #endif @@ -554469,7 +555734,8 @@ label_BFC2B060: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC2B06C: 316C00FF andi $t4, $t3, 0xFF */ - cpu->gpr[12] = cpu->gpr[11] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0xFFu; + PGXP_ALU(0x316C00FFu, cpu->gpr[12], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004306Cu); #endif @@ -554737,7 +556003,8 @@ label_BFC2B0A8: psx_cyc_step(cpu, 0x30u); #endif /* 0xBFC2B0A8: 308500FF andi $a1, $a0, 0xFF */ - cpu->gpr[5] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[5] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800430A8u); #endif @@ -554757,7 +556024,8 @@ label_BFC2B0A8: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B0B0: 2CA10020 sltiu $at, $a1, 32 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000020u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000020u ? 1 : 0); + PGXP_ALU(0x2CA10020u, cpu->gpr[1], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x800430B0u); #endif @@ -554814,7 +556082,8 @@ label_BFC2B0C0: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B0C0: 2CA10030 sltiu $at, $a1, 48 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000030u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000030u ? 1 : 0); + PGXP_ALU(0x2CA10030u, cpu->gpr[1], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x800430C0u); #endif @@ -554829,7 +556098,8 @@ label_BFC2B0C0: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B0C8: 2CA10030 sltiu $at, $a1, 48 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000030u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000030u ? 1 : 0); + PGXP_ALU(0x2CA10030u, cpu->gpr[1], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x800430C8u); #endif @@ -554904,7 +556174,8 @@ label_BFC2B0D4: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B0D4: 2CA10030 sltiu $at, $a1, 48 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000030u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000030u ? 1 : 0); + PGXP_ALU(0x2CA10030u, cpu->gpr[1], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x800430D4u); #endif @@ -554929,7 +556200,8 @@ label_BFC2B0D8: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B0DC: 2CA1003A sltiu $at, $a1, 58 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000003Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000003Au ? 1 : 0); + PGXP_ALU(0x2CA1003Au, cpu->gpr[1], _pgx1, 0x003Au); } #ifdef PSX_COSIM cosim_instr(0x800430DCu); #endif @@ -554968,7 +556240,8 @@ label_BFC2B0E0: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B0E4: 2CA1003A sltiu $at, $a1, 58 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000003Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000003Au ? 1 : 0); + PGXP_ALU(0x2CA1003Au, cpu->gpr[1], _pgx1, 0x003Au); } #ifdef PSX_COSIM cosim_instr(0x800430E4u); #endif @@ -555040,7 +556313,8 @@ label_BFC2B0F0: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B0F0: 2CA1003A sltiu $at, $a1, 58 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000003Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000003Au ? 1 : 0); + PGXP_ALU(0x2CA1003Au, cpu->gpr[1], _pgx1, 0x003Au); } #ifdef PSX_COSIM cosim_instr(0x800430F0u); #endif @@ -555065,7 +556339,8 @@ label_BFC2B0F4: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B0F8: 2CA10041 sltiu $at, $a1, 65 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000041u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000041u ? 1 : 0); + PGXP_ALU(0x2CA10041u, cpu->gpr[1], _pgx1, 0x0041u); } #ifdef PSX_COSIM cosim_instr(0x800430F8u); #endif @@ -555107,7 +556382,8 @@ label_BFC2B0FC: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B100: 2CA10041 sltiu $at, $a1, 65 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000041u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000041u ? 1 : 0); + PGXP_ALU(0x2CA10041u, cpu->gpr[1], _pgx1, 0x0041u); } #ifdef PSX_COSIM cosim_instr(0x80043100u); #endif @@ -555179,7 +556455,8 @@ label_BFC2B10C: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B10C: 2CA10041 sltiu $at, $a1, 65 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000041u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000041u ? 1 : 0); + PGXP_ALU(0x2CA10041u, cpu->gpr[1], _pgx1, 0x0041u); } #ifdef PSX_COSIM cosim_instr(0x8004310Cu); #endif @@ -555204,7 +556481,8 @@ label_BFC2B110: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B114: 2CA1005B sltiu $at, $a1, 91 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000005Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000005Bu ? 1 : 0); + PGXP_ALU(0x2CA1005Bu, cpu->gpr[1], _pgx1, 0x005Bu); } #ifdef PSX_COSIM cosim_instr(0x80043114u); #endif @@ -555243,7 +556521,8 @@ label_BFC2B118: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B11C: 2CA1005B sltiu $at, $a1, 91 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000005Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000005Bu ? 1 : 0); + PGXP_ALU(0x2CA1005Bu, cpu->gpr[1], _pgx1, 0x005Bu); } #ifdef PSX_COSIM cosim_instr(0x8004311Cu); #endif @@ -555324,7 +556603,8 @@ label_BFC2B12C: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B12C: 2CA1005B sltiu $at, $a1, 91 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000005Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000005Bu ? 1 : 0); + PGXP_ALU(0x2CA1005Bu, cpu->gpr[1], _pgx1, 0x005Bu); } #ifdef PSX_COSIM cosim_instr(0x8004312Cu); #endif @@ -555349,7 +556629,8 @@ label_BFC2B130: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B134: 2CA10061 sltiu $at, $a1, 97 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000061u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000061u ? 1 : 0); + PGXP_ALU(0x2CA10061u, cpu->gpr[1], _pgx1, 0x0061u); } #ifdef PSX_COSIM cosim_instr(0x80043134u); #endif @@ -555388,7 +556669,8 @@ label_BFC2B138: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B13C: 2CA10061 sltiu $at, $a1, 97 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000061u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000061u ? 1 : 0); + PGXP_ALU(0x2CA10061u, cpu->gpr[1], _pgx1, 0x0061u); } #ifdef PSX_COSIM cosim_instr(0x8004313Cu); #endif @@ -555460,7 +556742,8 @@ label_BFC2B148: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B148: 2CA10061 sltiu $at, $a1, 97 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000061u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000061u ? 1 : 0); + PGXP_ALU(0x2CA10061u, cpu->gpr[1], _pgx1, 0x0061u); } #ifdef PSX_COSIM cosim_instr(0x80043148u); #endif @@ -555488,7 +556771,8 @@ label_BFC2B14C: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B150: 2CA1007B sltiu $at, $a1, 123 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000007Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000007Bu ? 1 : 0); + PGXP_ALU(0x2CA1007Bu, cpu->gpr[1], _pgx1, 0x007Bu); } #ifdef PSX_COSIM cosim_instr(0x80043150u); #endif @@ -555527,7 +556811,8 @@ label_BFC2B154: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B158: 2CA1007B sltiu $at, $a1, 123 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000007Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000007Bu ? 1 : 0); + PGXP_ALU(0x2CA1007Bu, cpu->gpr[1], _pgx1, 0x007Bu); } #ifdef PSX_COSIM cosim_instr(0x80043158u); #endif @@ -555611,7 +556896,8 @@ label_BFC2B168: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B168: 2CA1007B sltiu $at, $a1, 123 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000007Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000007Bu ? 1 : 0); + PGXP_ALU(0x2CA1007Bu, cpu->gpr[1], _pgx1, 0x007Bu); } #ifdef PSX_COSIM cosim_instr(0x80043168u); #endif @@ -555639,7 +556925,8 @@ label_BFC2B16C: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B170: 2CA1007F sltiu $at, $a1, 127 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000007Fu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000007Fu ? 1 : 0); + PGXP_ALU(0x2CA1007Fu, cpu->gpr[1], _pgx1, 0x007Fu); } #ifdef PSX_COSIM cosim_instr(0x80043170u); #endif @@ -557191,7 +558478,8 @@ label_BFC2B304: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC2B308: 2C810081 sltiu $at, $a0, 129 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000081u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000081u ? 1 : 0); + PGXP_ALU(0x2C810081u, cpu->gpr[1], _pgx1, 0x0081u); } #ifdef PSX_COSIM cosim_instr(0x80043308u); #endif @@ -557378,7 +558666,8 @@ label_BFC2B338: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC2B338: 2C810081 sltiu $at, $a0, 129 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000081u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000081u ? 1 : 0); + PGXP_ALU(0x2C810081u, cpu->gpr[1], _pgx1, 0x0081u); } #ifdef PSX_COSIM cosim_instr(0x80043338u); #endif @@ -557406,7 +558695,8 @@ label_BFC2B33C: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC2B340: 2C810099 sltiu $at, $a0, 153 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000099u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000099u ? 1 : 0); + PGXP_ALU(0x2C810099u, cpu->gpr[1], _pgx1, 0x0099u); } #ifdef PSX_COSIM cosim_instr(0x80043340u); #endif @@ -557504,7 +558794,8 @@ label_BFC2B34C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC2B358: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043358u); #endif @@ -557588,7 +558879,8 @@ label_BFC2B36C: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC2B36C: 3058FFFF andi $t8, $v0, 0xFFFF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3058FFFFu, cpu->gpr[24], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004336Cu); #endif @@ -557606,7 +558898,8 @@ label_BFC2B36C: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC2B374: 3045FFFF andi $a1, $v0, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3045FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043374u); #endif @@ -557706,7 +558999,8 @@ label_BFC2B384: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B388: 00A1082B sltu $at, $a1, $at */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + PGXP_ALU(0x00A1082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80043388u); #endif @@ -557757,7 +559051,8 @@ label_BFC2B394: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B394: 00A1082B sltu $at, $a1, $at */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + PGXP_ALU(0x00A1082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80043394u); #endif @@ -557941,7 +559236,8 @@ label_BFC2B3CC: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B3D0: 00A1082B sltu $at, $a1, $at */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + PGXP_ALU(0x00A1082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800433D0u); #endif @@ -557989,7 +559285,8 @@ label_BFC2B3DC: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC2B3DC: 00A1082B sltu $at, $a1, $at */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + PGXP_ALU(0x00A1082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800433DCu); #endif @@ -558378,7 +559675,8 @@ label_BFC2B44C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2B44C: 28410093 slti $at, $v0, 147 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (147) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (147) ? 1 : 0); + PGXP_ALU(0x28410093u, cpu->gpr[1], _pgx1, 0x0093u); } #ifdef PSX_COSIM cosim_instr(0x8004344Cu); #endif @@ -558396,7 +559694,8 @@ label_BFC2B44C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC2B454: 284100D1 slti $at, $v0, 209 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (209) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (209) ? 1 : 0); + PGXP_ALU(0x284100D1u, cpu->gpr[1], _pgx1, 0x00D1u); } #ifdef PSX_COSIM cosim_instr(0x80043454u); #endif @@ -558666,7 +559965,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x8020u); #endif /* 0xBFC2B4B0: 30AF00FF andi $t7, $a1, 0xFF */ - cpu->gpr[15] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[15] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30AF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800434B0u); #endif @@ -558683,7 +559983,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2B4B8: 31D900FF andi $t9, $t6, 0xFF */ - cpu->gpr[25] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[25] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31D900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800434B8u); #endif @@ -558712,7 +560013,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B4C4: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800434C4u); #endif @@ -558729,7 +560031,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B4CC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800434CCu); #endif @@ -558740,7 +560043,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B4D0: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800434D0u); #endif @@ -558748,7 +560052,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC2B4D4: 304F00FF andi $t7, $v0, 0xFF */ - cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800434D4u); #endif @@ -558765,7 +560070,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2B4DC: 331900FF andi $t9, $t8, 0xFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x331900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800434DCu); #endif @@ -558821,7 +560127,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x1000040u); #endif /* 0xBFC2B4F4: 30D800FF andi $t8, $a2, 0xFF */ - cpu->gpr[24] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[24] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30D800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800434F4u); #endif @@ -558838,7 +560145,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2B4FC: 332F00FF andi $t7, $t9, 0xFF */ - cpu->gpr[15] = cpu->gpr[25] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[15] = cpu->gpr[25] & 0xFFu; + PGXP_ALU(0x332F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800434FCu); #endif @@ -558858,7 +560166,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B504: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043504u); #endif @@ -558875,7 +560184,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B50C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004350Cu); #endif @@ -558886,7 +560196,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B510: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043510u); #endif @@ -558894,7 +560205,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC2B514: 305800FF andi $t8, $v0, 0xFF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043514u); #endif @@ -558911,7 +560223,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2B51C: 31CF00FF andi $t7, $t6, 0xFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004351Cu); #endif @@ -558967,7 +560280,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4080u); #endif /* 0xBFC2B534: 30EE00FF andi $t6, $a3, 0xFF */ - cpu->gpr[14] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[14] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30EE00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043534u); #endif @@ -558984,7 +560298,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC2B53C: 31F800FF andi $t8, $t7, 0xFF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31F800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004353Cu); #endif @@ -559004,7 +560319,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B544: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043544u); #endif @@ -559021,7 +560337,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B54C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004354Cu); #endif @@ -559032,7 +560349,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B550: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043550u); #endif @@ -559040,7 +560358,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC2B554: 304E00FF andi $t6, $v0, 0xFF */ - cpu->gpr[14] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043554u); #endif @@ -559057,7 +560376,8 @@ label_BFC2B4A4: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2B55C: 333800FF andi $t8, $t9, 0xFF */ - cpu->gpr[24] = cpu->gpr[25] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[24] = cpu->gpr[25] & 0xFFu; + PGXP_ALU(0x333800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004355Cu); #endif @@ -559138,7 +560458,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x2000010u); #endif /* 0xBFC2B57C: 309900FF andi $t9, $a0, 0xFF */ - cpu->gpr[25] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x309900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004357Cu); #endif @@ -559158,7 +560479,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x1004000u); #endif /* 0xBFC2B584: 330E00FF andi $t6, $t8, 0xFF */ - cpu->gpr[14] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[14] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x330E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043584u); #endif @@ -559187,7 +560509,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B590: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043590u); #endif @@ -559204,7 +560527,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B598: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043598u); #endif @@ -559212,7 +560536,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B59C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004359Cu); #endif @@ -559223,7 +560548,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC2B5A0: 305900FF andi $t9, $v0, 0xFF */ - cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800435A0u); #endif @@ -559240,7 +560566,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2B5A8: 31EE00FF andi $t6, $t7, 0xFF */ - cpu->gpr[14] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[14] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31EE00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800435A8u); #endif @@ -559287,7 +560614,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x8020u); #endif /* 0xBFC2B5BC: 30AF00FF andi $t7, $a1, 0xFF */ - cpu->gpr[15] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[15] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30AF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800435BCu); #endif @@ -559307,7 +560635,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2B5C4: 31D900FF andi $t9, $t6, 0xFF */ - cpu->gpr[25] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[25] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31D900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800435C4u); #endif @@ -559324,7 +560653,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B5CC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800435CCu); #endif @@ -559344,7 +560674,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B5D4: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800435D4u); #endif @@ -559352,7 +560683,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B5D8: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800435D8u); #endif @@ -559360,7 +560692,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC2B5DC: 304F00FF andi $t7, $v0, 0xFF */ - cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800435DCu); #endif @@ -559380,7 +560713,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2B5E4: 331900FF andi $t9, $t8, 0xFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x331900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800435E4u); #endif @@ -559433,7 +560767,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x1000040u); #endif /* 0xBFC2B5FC: 30D800FF andi $t8, $a2, 0xFF */ - cpu->gpr[24] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[24] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30D800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800435FCu); #endif @@ -559453,7 +560788,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2B604: 332F00FF andi $t7, $t9, 0xFF */ - cpu->gpr[15] = cpu->gpr[25] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[15] = cpu->gpr[25] & 0xFFu; + PGXP_ALU(0x332F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043604u); #endif @@ -559470,7 +560806,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B60C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004360Cu); #endif @@ -559490,7 +560827,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B614: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043614u); #endif @@ -559498,7 +560836,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B618: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043618u); #endif @@ -559506,7 +560845,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC2B61C: 305800FF andi $t8, $v0, 0xFF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004361Cu); #endif @@ -559526,7 +560866,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2B624: 31CF00FF andi $t7, $t6, 0xFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043624u); #endif @@ -559579,7 +560920,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4080u); #endif /* 0xBFC2B63C: 30EE00FF andi $t6, $a3, 0xFF */ - cpu->gpr[14] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[14] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30EE00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004363Cu); #endif @@ -559599,7 +560941,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC2B644: 31F800FF andi $t8, $t7, 0xFF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31F800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043644u); #endif @@ -559616,7 +560959,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B64C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004364Cu); #endif @@ -559636,7 +560980,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B654: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043654u); #endif @@ -559644,7 +560989,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B658: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043658u); #endif @@ -559652,7 +560998,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC2B65C: 304E00FF andi $t6, $v0, 0xFF */ - cpu->gpr[14] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004365Cu); #endif @@ -559672,7 +561019,8 @@ label_BFC2B574: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2B664: 333800FF andi $t8, $t9, 0xFF */ - cpu->gpr[24] = cpu->gpr[25] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[24] = cpu->gpr[25] & 0xFFu; + PGXP_ALU(0x333800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043664u); #endif @@ -560045,7 +561393,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x2000020u); #endif /* 0xBFC2B6DC: 30B900FF andi $t9, $a1, 0xFF */ - cpu->gpr[25] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[25] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30B900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800436DCu); #endif @@ -560065,7 +561414,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x1004000u); #endif /* 0xBFC2B6E4: 330E00FF andi $t6, $t8, 0xFF */ - cpu->gpr[14] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[14] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x330E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800436E4u); #endif @@ -560100,7 +561450,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B6F4: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800436F4u); #endif @@ -560117,7 +561468,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B6FC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800436FCu); #endif @@ -560128,7 +561480,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B700: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043700u); #endif @@ -560136,7 +561489,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC2B704: 305900FF andi $t9, $v0, 0xFF */ - cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043704u); #endif @@ -560153,7 +561507,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2B70C: 31EE00FF andi $t6, $t7, 0xFF */ - cpu->gpr[14] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[14] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31EE00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004370Cu); #endif @@ -560209,7 +561564,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x8040u); #endif /* 0xBFC2B724: 30CF00FF andi $t7, $a2, 0xFF */ - cpu->gpr[15] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043724u); #endif @@ -560226,7 +561582,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2B72C: 31D900FF andi $t9, $t6, 0xFF */ - cpu->gpr[25] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[25] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31D900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004372Cu); #endif @@ -560246,7 +561603,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B734: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043734u); #endif @@ -560263,7 +561621,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B73C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004373Cu); #endif @@ -560274,7 +561633,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B740: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043740u); #endif @@ -560282,7 +561642,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC2B744: 304F00FF andi $t7, $v0, 0xFF */ - cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043744u); #endif @@ -560299,7 +561660,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2B74C: 331900FF andi $t9, $t8, 0xFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x331900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004374Cu); #endif @@ -560355,7 +561717,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x1000080u); #endif /* 0xBFC2B764: 30F800FF andi $t8, $a3, 0xFF */ - cpu->gpr[24] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[24] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30F800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043764u); #endif @@ -560372,7 +561735,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2B76C: 332F00FF andi $t7, $t9, 0xFF */ - cpu->gpr[15] = cpu->gpr[25] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[15] = cpu->gpr[25] & 0xFFu; + PGXP_ALU(0x332F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004376Cu); #endif @@ -560392,7 +561756,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B774: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043774u); #endif @@ -560409,7 +561774,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B77C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004377Cu); #endif @@ -560420,7 +561786,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B780: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043780u); #endif @@ -560428,7 +561795,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC2B784: 305800FF andi $t8, $v0, 0xFF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043784u); #endif @@ -560445,7 +561813,8 @@ label_BFC2B6D0: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2B78C: 31CF00FF andi $t7, $t6, 0xFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004378Cu); #endif @@ -560526,7 +561895,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC2B7AC: 308E00FF andi $t6, $a0, 0xFF */ - cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800437ACu); #endif @@ -560546,7 +561916,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC2B7B4: 31F800FF andi $t8, $t7, 0xFF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31F800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800437B4u); #endif @@ -560575,7 +561946,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B7C0: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800437C0u); #endif @@ -560592,7 +561964,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B7C8: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800437C8u); #endif @@ -560600,7 +561973,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B7CC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800437CCu); #endif @@ -560611,7 +561985,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC2B7D0: 304E00FF andi $t6, $v0, 0xFF */ - cpu->gpr[14] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800437D0u); #endif @@ -560628,7 +562003,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2B7D8: 333800FF andi $t8, $t9, 0xFF */ - cpu->gpr[24] = cpu->gpr[25] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[24] = cpu->gpr[25] & 0xFFu; + PGXP_ALU(0x333800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800437D8u); #endif @@ -560675,7 +562051,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x2000020u); #endif /* 0xBFC2B7EC: 30B900FF andi $t9, $a1, 0xFF */ - cpu->gpr[25] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[25] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30B900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800437ECu); #endif @@ -560695,7 +562072,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x1004000u); #endif /* 0xBFC2B7F4: 330E00FF andi $t6, $t8, 0xFF */ - cpu->gpr[14] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[14] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x330E00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800437F4u); #endif @@ -560712,7 +562090,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B7FC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800437FCu); #endif @@ -560732,7 +562111,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B804: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043804u); #endif @@ -560740,7 +562120,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B808: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043808u); #endif @@ -560748,7 +562129,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC2B80C: 305900FF andi $t9, $v0, 0xFF */ - cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004380Cu); #endif @@ -560768,7 +562150,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2B814: 31EE00FF andi $t6, $t7, 0xFF */ - cpu->gpr[14] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[14] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31EE00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043814u); #endif @@ -560821,7 +562204,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x8040u); #endif /* 0xBFC2B82C: 30CF00FF andi $t7, $a2, 0xFF */ - cpu->gpr[15] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004382Cu); #endif @@ -560841,7 +562225,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2B834: 31D900FF andi $t9, $t6, 0xFF */ - cpu->gpr[25] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[25] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31D900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043834u); #endif @@ -560858,7 +562243,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B83C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004383Cu); #endif @@ -560878,7 +562264,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B844: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043844u); #endif @@ -560886,7 +562273,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B848: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043848u); #endif @@ -560894,7 +562282,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC2B84C: 304F00FF andi $t7, $v0, 0xFF */ - cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004384Cu); #endif @@ -560914,7 +562303,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2B854: 331900FF andi $t9, $t8, 0xFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x331900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043854u); #endif @@ -560967,7 +562357,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x1000080u); #endif /* 0xBFC2B86C: 30F800FF andi $t8, $a3, 0xFF */ - cpu->gpr[24] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[24] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30F800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004386Cu); #endif @@ -560987,7 +562378,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2B874: 332F00FF andi $t7, $t9, 0xFF */ - cpu->gpr[15] = cpu->gpr[25] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[15] = cpu->gpr[25] & 0xFFu; + PGXP_ALU(0x332F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043874u); #endif @@ -561004,7 +562396,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B87C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004387Cu); #endif @@ -561024,7 +562417,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B884: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043884u); #endif @@ -561032,7 +562426,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2B888: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80043888u); #endif @@ -561040,7 +562435,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC2B88C: 305800FF andi $t8, $v0, 0xFF */ - cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004388Cu); #endif @@ -561060,7 +562456,8 @@ label_BFC2B7A4: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2B894: 31CF00FF andi $t7, $t6, 0xFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80043894u); #endif @@ -561404,7 +562801,8 @@ label_BFC2B8F4: psx_cyc_step(cpu, 0x1000002u); #endif /* 0xBFC2B8FC: 2B010100 slti $at, $t8, 256 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (256) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (256) ? 1 : 0); + PGXP_ALU(0x2B010100u, cpu->gpr[1], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x800438FCu); #endif @@ -561592,7 +562990,8 @@ label_BFC2B938: psx_cyc_step(cpu, 0x80000012u); #endif /* 0xBFC2B938: 03E4082A slt $at, $ra, $a0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[31] < (int32_t)cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[31]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[31] < (int32_t)cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x03E4082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80043938u); #endif @@ -561837,7 +563236,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC2B984: 30A50001 andi $a1, $a1, 0x1 */ - cpu->gpr[5] = cpu->gpr[5] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x1u; + PGXP_ALU(0x30A50001u, cpu->gpr[5], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043984u); #endif @@ -561845,7 +563245,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC2B988: 316B0001 andi $t3, $t3, 0x1 */ - cpu->gpr[11] = cpu->gpr[11] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0x1u; + PGXP_ALU(0x316B0001u, cpu->gpr[11], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043988u); #endif @@ -561853,7 +563254,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC2B98C: 30840001 andi $a0, $a0, 0x1 */ - cpu->gpr[4] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30840001u, cpu->gpr[4], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004398Cu); #endif @@ -561921,7 +563323,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC2B9A8: 30C60001 andi $a2, $a2, 0x1 */ - cpu->gpr[6] = cpu->gpr[6] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x1u; + PGXP_ALU(0x30C60001u, cpu->gpr[6], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800439A8u); #endif @@ -561980,7 +563383,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC2B9C0: 30E70001 andi $a3, $a3, 0x1 */ - cpu->gpr[7] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30E70001u, cpu->gpr[7], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800439C0u); #endif @@ -562075,7 +563479,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC2B9E8: 31290001 andi $t1, $t1, 0x1 */ - cpu->gpr[9] = cpu->gpr[9] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0x1u; + PGXP_ALU(0x31290001u, cpu->gpr[9], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800439E8u); #endif @@ -562083,7 +563488,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC2B9EC: 31080001 andi $t0, $t0, 0x1 */ - cpu->gpr[8] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31080001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800439ECu); #endif @@ -562151,7 +563557,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x400u); #endif /* 0xBFC2BA08: 314A0001 andi $t2, $t2, 0x1 */ - cpu->gpr[10] = cpu->gpr[10] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[10] = cpu->gpr[10] & 0x1u; + PGXP_ALU(0x314A0001u, cpu->gpr[10], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043A08u); #endif @@ -562210,7 +563617,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC2BA20: 304C0001 andi $t4, $v0, 0x1 */ - cpu->gpr[12] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304C0001u, cpu->gpr[12], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043A20u); #endif @@ -562296,7 +563704,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC2BA44: 30840001 andi $a0, $a0, 0x1 */ - cpu->gpr[4] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30840001u, cpu->gpr[4], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043A44u); #endif @@ -562304,7 +563713,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC2BA48: 30A50001 andi $a1, $a1, 0x1 */ - cpu->gpr[5] = cpu->gpr[5] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x1u; + PGXP_ALU(0x30A50001u, cpu->gpr[5], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043A48u); #endif @@ -562372,7 +563782,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC2BA64: 30C60001 andi $a2, $a2, 0x1 */ - cpu->gpr[6] = cpu->gpr[6] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x1u; + PGXP_ALU(0x30C60001u, cpu->gpr[6], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043A64u); #endif @@ -562428,7 +563839,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC2BA7C: 30E70001 andi $a3, $a3, 0x1 */ - cpu->gpr[7] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30E70001u, cpu->gpr[7], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043A7Cu); #endif @@ -562526,7 +563938,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC2BAA4: 31080001 andi $t0, $t0, 0x1 */ - cpu->gpr[8] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31080001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043AA4u); #endif @@ -562534,7 +563947,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC2BAA8: 31290001 andi $t1, $t1, 0x1 */ - cpu->gpr[9] = cpu->gpr[9] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0x1u; + PGXP_ALU(0x31290001u, cpu->gpr[9], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043AA8u); #endif @@ -562602,7 +564016,8 @@ label_BFC2B970: psx_cyc_step(cpu, 0x400u); #endif /* 0xBFC2BAC4: 314A0001 andi $t2, $t2, 0x1 */ - cpu->gpr[10] = cpu->gpr[10] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[10] = cpu->gpr[10] & 0x1u; + PGXP_ALU(0x314A0001u, cpu->gpr[10], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043AC4u); #endif @@ -562851,7 +564266,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x1004000u); #endif /* 0xBFC2BB24: 31D80001 andi $t8, $t6, 0x1 */ - cpu->gpr[24] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[24] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31D80001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043B24u); #endif @@ -562859,7 +564275,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2BB28: 332F0001 andi $t7, $t9, 0x1 */ - cpu->gpr[15] = cpu->gpr[25] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[15] = cpu->gpr[25] & 0x1u; + PGXP_ALU(0x332F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043B28u); #endif @@ -562897,7 +564314,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC2BB38: 31F80001 andi $t8, $t7, 0x1 */ - cpu->gpr[24] = cpu->gpr[15] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x1u; + PGXP_ALU(0x31F80001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043B38u); #endif @@ -562935,7 +564353,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2BB48: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043B48u); #endif @@ -563012,7 +564431,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2BB68: 332F0001 andi $t7, $t9, 0x1 */ - cpu->gpr[15] = cpu->gpr[25] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[15] = cpu->gpr[25] & 0x1u; + PGXP_ALU(0x332F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043B68u); #endif @@ -563020,7 +564440,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x1004000u); #endif /* 0xBFC2BB6C: 31D80001 andi $t8, $t6, 0x1 */ - cpu->gpr[24] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[24] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31D80001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043B6Cu); #endif @@ -563058,7 +564479,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC2BB7C: 330F0001 andi $t7, $t8, 0x1 */ - cpu->gpr[15] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[15] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x330F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043B7Cu); #endif @@ -563087,7 +564509,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC2BB88: 304F0001 andi $t7, $v0, 0x1 */ - cpu->gpr[15] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043B88u); #endif @@ -563164,7 +564587,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC2BBA8: 31F80001 andi $t8, $t7, 0x1 */ - cpu->gpr[24] = cpu->gpr[15] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x1u; + PGXP_ALU(0x31F80001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043BA8u); #endif @@ -563172,7 +564596,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2BBAC: 31D90001 andi $t9, $t6, 0x1 */ - cpu->gpr[25] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[25] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31D90001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043BACu); #endif @@ -563210,7 +564635,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2BBBC: 33380001 andi $t8, $t9, 0x1 */ - cpu->gpr[24] = cpu->gpr[25] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[24] = cpu->gpr[25] & 0x1u; + PGXP_ALU(0x33380001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043BBCu); #endif @@ -563248,7 +564674,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x1004000u); #endif /* 0xBFC2BBCC: 330E0001 andi $t6, $t8, 0x1 */ - cpu->gpr[14] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[14] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x330E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043BCCu); #endif @@ -563325,7 +564752,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x2004000u); #endif /* 0xBFC2BBEC: 31D90001 andi $t9, $t6, 0x1 */ - cpu->gpr[25] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[25] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31D90001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043BECu); #endif @@ -563336,7 +564764,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC2BBF0: 31F80001 andi $t8, $t7, 0x1 */ - cpu->gpr[24] = cpu->gpr[15] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x1u; + PGXP_ALU(0x31F80001u, cpu->gpr[24], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043BF0u); #endif @@ -563374,7 +564803,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2BC00: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043C00u); #endif @@ -563412,7 +564842,8 @@ label_BFC2BB04: psx_cyc_step(cpu, 0x2008000u); #endif /* 0xBFC2BC10: 332F0001 andi $t7, $t9, 0x1 */ - cpu->gpr[15] = cpu->gpr[25] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[15] = cpu->gpr[25] & 0x1u; + PGXP_ALU(0x332F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80043C10u); #endif @@ -563623,7 +565054,8 @@ label_BFC2BC54: psx_cyc_step(cpu, 0x100002u); #endif /* 0xBFC2BC58: 2A810010 slti $at, $s4, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (16) ? 1 : 0); + PGXP_ALU(0x2A810010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80043C58u); #endif @@ -563674,7 +565106,8 @@ label_BFC2BC64: psx_cyc_step(cpu, 0x200012u); #endif /* 0xBFC2BC64: 02A4082A slt $at, $s5, $a0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[21] < (int32_t)cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[21]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[21] < (int32_t)cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x02A4082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80043C64u); #endif @@ -563689,7 +565122,8 @@ label_BFC2BC64: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC2BC6C: 28810010 slti $at, $a0, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (16) ? 1 : 0); + PGXP_ALU(0x28810010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80043C6Cu); #endif @@ -563744,7 +565178,8 @@ label_BFC2BC70: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC2BC7C: 29C10100 slti $at, $t6, 256 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (256) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (256) ? 1 : 0); + PGXP_ALU(0x29C10100u, cpu->gpr[1], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x80043C7Cu); #endif @@ -563795,7 +565230,8 @@ label_BFC2BC88: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC2BC88: 28810010 slti $at, $a0, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (16) ? 1 : 0); + PGXP_ALU(0x28810010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80043C88u); #endif @@ -564527,7 +565963,8 @@ label_BFC2BCEC: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC2BD80: 28610011 slti $at, $v1, 17 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (17) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (17) ? 1 : 0); + PGXP_ALU(0x28610011u, cpu->gpr[1], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x80043D80u); #endif @@ -564631,7 +566068,8 @@ label_BFC2BD98: psx_cyc_step(cpu, 0x20004u); #endif /* 0xBFC2BD9C: 3222000F andi $v0, $s1, 0xF */ - cpu->gpr[2] = cpu->gpr[17] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[2] = cpu->gpr[17] & 0xFu; + PGXP_ALU(0x3222000Fu, cpu->gpr[2], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80043D9Cu); #endif @@ -564791,7 +566229,8 @@ label_BFC2BDB4: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC2BDC4: 28610010 slti $at, $v1, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (16) ? 1 : 0); + PGXP_ALU(0x28610010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80043DC4u); #endif @@ -564932,7 +566371,8 @@ label_BFC2BDE8: psx_cyc_step(cpu, 0x208000u); #endif /* 0xBFC2BDEC: 32AF003F andi $t7, $s5, 0x3F */ - cpu->gpr[15] = cpu->gpr[21] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[21]; cpu->gpr[15] = cpu->gpr[21] & 0x3Fu; + PGXP_ALU(0x32AF003Fu, cpu->gpr[15], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80043DECu); #endif @@ -565022,7 +566462,8 @@ label_BFC2BDFC: psx_cyc_step(cpu, 0x8012u); #endif /* 0xBFC2BDFC: 01E4082A slt $at, $t7, $a0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x01E4082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80043DFCu); #endif @@ -565605,7 +567046,8 @@ label_BFC2BEA8: psx_cyc_step(cpu, 0x100006u); #endif /* 0xBFC2BEB8: 0282082A slt $at, $s4, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0282082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80043EB8u); #endif @@ -566443,7 +567885,8 @@ label_BFC2BFAC: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC2BFB4: 304F0008 andi $t7, $v0, 0x8 */ - cpu->gpr[15] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304F0008u, cpu->gpr[15], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80043FB4u); #endif @@ -566458,7 +567901,8 @@ label_BFC2BFAC: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC2BFBC: 30580003 andi $t8, $v0, 0x3 */ - cpu->gpr[24] = cpu->gpr[2] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x3u; + PGXP_ALU(0x30580003u, cpu->gpr[24], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80043FBCu); #endif @@ -566514,7 +567958,8 @@ label_BFC2BFC0: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC2BFCC: 30580003 andi $t8, $v0, 0x3 */ - cpu->gpr[24] = cpu->gpr[2] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x3u; + PGXP_ALU(0x30580003u, cpu->gpr[24], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80043FCCu); #endif @@ -567088,7 +568533,8 @@ label_BFC2C074: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC2C08C: 30840007 andi $a0, $a0, 0x7 */ - cpu->gpr[4] = cpu->gpr[4] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0x7u; + PGXP_ALU(0x30840007u, cpu->gpr[4], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x8004408Cu); #endif @@ -567172,7 +568618,8 @@ label_BFC2C090: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC2C0AC: 31AE003F andi $t6, $t5, 0x3F */ - cpu->gpr[14] = cpu->gpr[13] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x3Fu; + PGXP_ALU(0x31AE003Fu, cpu->gpr[14], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x800440ACu); #endif @@ -567306,7 +568753,8 @@ label_BFC2C0BC: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC2C0D0: 31F800FF andi $t8, $t7, 0xFF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31F800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800440D0u); #endif @@ -567419,7 +568867,8 @@ label_BFC2C0E0: psx_cyc_step(cpu, 0x2000002u); #endif /* 0xBFC2C0EC: 2F210002 sltiu $at, $t9, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[25] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)(cpu->gpr[25] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2F210002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x800440ECu); #endif @@ -567722,7 +569171,8 @@ label_BFC2C158: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC2C160: 2DC10002 sltiu $at, $t6, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2DC10002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80044160u); #endif @@ -568070,7 +569520,8 @@ label_BFC2C1C4: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2C1DC: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800441DCu); #endif @@ -568135,7 +569586,8 @@ label_BFC2C1E8: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC2C1F0: 316CFFFF andi $t4, $t3, 0xFFFF */ - cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316CFFFFu, cpu->gpr[12], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800441F0u); #endif @@ -568179,7 +569631,8 @@ label_BFC2C1E8: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2C204: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80044204u); #endif @@ -568214,7 +569667,8 @@ label_BFC2C1E8: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2C214: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80044214u); #endif @@ -568288,7 +569742,8 @@ label_BFC2C1E8: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC2C234: 312AFFFF andi $t2, $t1, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x312AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80044234u); #endif @@ -568341,7 +569796,8 @@ label_BFC2C1E8: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC2C24C: 316CFFFF andi $t4, $t3, 0xFFFF */ - cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316CFFFFu, cpu->gpr[12], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004424Cu); #endif @@ -568388,7 +569844,8 @@ label_BFC2C1E8: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2C260: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80044260u); #endif @@ -568423,7 +569880,8 @@ label_BFC2C1E8: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2C270: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80044270u); #endif @@ -568467,7 +569925,8 @@ label_BFC2C1E8: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC2C284: 312AFFFF andi $t2, $t1, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x312AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80044284u); #endif @@ -568522,7 +569981,8 @@ label_BFC2C290: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC2C298: 316CFFFF andi $t4, $t3, 0xFFFF */ - cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316CFFFFu, cpu->gpr[12], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80044298u); #endif @@ -568566,7 +570026,8 @@ label_BFC2C290: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC2C2AC: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800442ACu); #endif @@ -568601,7 +570062,8 @@ label_BFC2C290: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2C2BC: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800442BCu); #endif @@ -568648,7 +570110,8 @@ label_BFC2C290: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC2C2D0: 312AFFFF andi $t2, $t1, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x312AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800442D0u); #endif @@ -568974,7 +570437,8 @@ label_BFC2C328: psx_cyc_step(cpu, 0x106u); #endif /* 0xBFC2C33C: 0048082B sltu $at, $v0, $t0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0048082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004433Cu); #endif @@ -569095,7 +570559,8 @@ label_BFC2C364: psx_cyc_step(cpu, 0x32u); #endif /* 0xBFC2C364: 0085082B sltu $at, $a0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0085082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80044364u); #endif @@ -569211,7 +570676,8 @@ label_BFC2C370: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC2C390: 0045082B sltu $at, $v0, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0045082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80044390u); #endif @@ -569313,7 +570779,8 @@ label_BFC2C3AC: psx_cyc_step(cpu, 0x182u); #endif /* 0xBFC2C3B0: 00E8082B sltu $at, $a3, $t0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[7] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[7] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x00E8082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800443B0u); #endif @@ -570119,7 +571586,8 @@ label_BFC2C494: psx_cyc_step(cpu, 0x808u); #endif /* 0xBFC2C494: 306BFFFF andi $t3, $v1, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[3] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[11] = cpu->gpr[3] & 0xFFFFu; + PGXP_ALU(0x306BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80044494u); #endif @@ -570837,7 +572305,8 @@ label_BFC2C4E4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC2C59C: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004459Cu); #endif @@ -580616,7 +582085,8 @@ label_BFC2D154: psx_cyc_step(cpu, 0x4018u); #endif /* 0xBFC2D194: 01C32026 xor $a0, $t6, $v1 */ - cpu->gpr[4] = cpu->gpr[14] ^ cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[4] = cpu->gpr[14] ^ cpu->gpr[3]; + PGXP_ALU(0x01C32026u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045194u); #endif @@ -580624,7 +582094,8 @@ label_BFC2D154: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC2D198: 2C840001 sltiu $a0, $a0, 1 */ - cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x00000001u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = (uint32_t)(cpu->gpr[4] < 0x00000001u ? 1 : 0); + PGXP_ALU(0x2C840001u, cpu->gpr[4], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80045198u); #endif @@ -580819,7 +582290,8 @@ label_BFC2D1CC: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC2D1D4: 304B00F0 andi $t3, $v0, 0xF0 */ - cpu->gpr[11] = cpu->gpr[2] & 0xF0u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0xF0u; + PGXP_ALU(0x304B00F0u, cpu->gpr[11], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x800451D4u); #endif @@ -580866,7 +582338,8 @@ label_BFC2D1E0: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC2D1E0: 304C0004 andi $t4, $v0, 0x4 */ - cpu->gpr[12] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x304C0004u, cpu->gpr[12], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x800451E0u); #endif @@ -581166,7 +582639,8 @@ label_BFC2D230: psx_cyc_step(cpu, 0x2008002u); #endif /* 0xBFC2D234: 032F082A slt $at, $t9, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x032F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045234u); #endif @@ -581438,7 +582912,8 @@ label_BFC2D240: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC2D2A0: 0062082A slt $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800452A0u); #endif @@ -581767,7 +583242,8 @@ label_BFC2D310: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC2D310: 304A0002 andi $t2, $v0, 0x2 */ - cpu->gpr[10] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x304A0002u, cpu->gpr[10], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80045310u); #endif @@ -581782,7 +583258,8 @@ label_BFC2D310: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC2D318: 304F0001 andi $t7, $v0, 0x1 */ - cpu->gpr[15] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80045318u); #endif @@ -582060,7 +583537,8 @@ label_BFC2D370: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC2D380: 304F0001 andi $t7, $v0, 0x1 */ - cpu->gpr[15] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304F0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80045380u); #endif @@ -582085,7 +583563,8 @@ label_BFC2D384: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC2D388: 304C0008 andi $t4, $v0, 0x8 */ - cpu->gpr[12] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304C0008u, cpu->gpr[12], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80045388u); #endif @@ -582451,7 +583930,8 @@ label_BFC2D400: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC2D410: 304C0008 andi $t4, $v0, 0x8 */ - cpu->gpr[12] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304C0008u, cpu->gpr[12], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80045410u); #endif @@ -582604,7 +584084,8 @@ label_BFC2D41C: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC2D444: 30430080 andi $v1, $v0, 0x80 */ - cpu->gpr[3] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30430080u, cpu->gpr[3], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80045444u); #endif @@ -583087,7 +584568,8 @@ label_BFC2D4CC: psx_cyc_step(cpu, 0x204u); #endif /* 0xBFC2D4D4: 30490004 andi $t1, $v0, 0x4 */ - cpu->gpr[9] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[9] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30490004u, cpu->gpr[9], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x800454D4u); #endif @@ -583102,7 +584584,8 @@ label_BFC2D4CC: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC2D4DC: 304B0010 andi $t3, $v0, 0x10 */ - cpu->gpr[11] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304B0010u, cpu->gpr[11], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x800454DCu); #endif @@ -583477,7 +584960,8 @@ label_BFC2D54C: psx_cyc_step(cpu, 0x1000102u); #endif /* 0xBFC2D550: 0118082A slt $at, $t0, $t8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x0118082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045550u); #endif @@ -583749,7 +585233,8 @@ label_BFC2D55C: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC2D5BC: 0062082A slt $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800455BCu); #endif @@ -584259,7 +585744,8 @@ label_BFC2D658: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC2D668: 304B0010 andi $t3, $v0, 0x10 */ - cpu->gpr[11] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304B0010u, cpu->gpr[11], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80045668u); #endif @@ -584878,7 +586364,8 @@ label_BFC2D6E4: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC2D724: 2A01003C slti $at, $s0, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (60) ? 1 : 0); + PGXP_ALU(0x2A01003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x80045724u); #endif @@ -585057,7 +586544,8 @@ label_BFC2D758: psx_cyc_step(cpu, 0x10006u); #endif /* 0xBFC2D758: 0050082A slt $at, $v0, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0050082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045758u); #endif @@ -585154,7 +586642,8 @@ label_BFC2D76C: psx_cyc_step(cpu, 0x30002u); #endif /* 0xBFC2D770: 0230082A slt $at, $s1, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0230082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045770u); #endif @@ -585290,7 +586779,8 @@ label_BFC2D78C: psx_cyc_step(cpu, 0x18002u); #endif /* 0xBFC2D798: 020F082A slt $at, $s0, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x020F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045798u); #endif @@ -585831,7 +587321,8 @@ label_BFC2D7CC: psx_cyc_step(cpu, 0x412u); #endif /* 0xBFC2D854: 008A082A slt $at, $a0, $t2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x008A082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045854u); #endif @@ -586000,7 +587491,8 @@ label_BFC2D87C: psx_cyc_step(cpu, 0x2802u); #endif /* 0xBFC2D888: 01AB082A slt $at, $t5, $t3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x01AB082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045888u); #endif @@ -586124,7 +587616,8 @@ label_BFC2D8A0: psx_cyc_step(cpu, 0x90002u); #endif /* 0xBFC2D8A8: 0213082A slt $at, $s0, $s3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0213082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800458A8u); #endif @@ -586212,7 +587705,8 @@ label_BFC2D8BC: psx_cyc_step(cpu, 0x28002u); #endif /* 0xBFC2D8C0: 022F082A slt $at, $s1, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x022F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800458C0u); #endif @@ -586983,7 +588477,8 @@ label_BFC2D99C: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC2D9C0: 30590020 andi $t9, $v0, 0x20 */ - cpu->gpr[25] = cpu->gpr[2] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x20u; + PGXP_ALU(0x30590020u, cpu->gpr[25], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x800459C0u); #endif @@ -587453,7 +588948,8 @@ label_BFC2DA38: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC2DA50: 2A01003C slti $at, $s0, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (60) ? 1 : 0); + PGXP_ALU(0x2A01003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x80045A50u); #endif @@ -588069,7 +589565,8 @@ label_BFC2DB00: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC2DB08: 33190020 andi $t9, $t8, 0x20 */ - cpu->gpr[25] = cpu->gpr[24] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x20u; + PGXP_ALU(0x33190020u, cpu->gpr[25], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x80045B08u); #endif @@ -588157,7 +589654,8 @@ label_BFC2DB18: psx_cyc_step(cpu, 0x40002u); #endif /* 0xBFC2DB20: 2A41000F slti $at, $s2, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (15) ? 1 : 0); + PGXP_ALU(0x2A41000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80045B20u); #endif @@ -588351,7 +589849,8 @@ label_BFC2DB50: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC2DB54: 2A210010 slti $at, $s1, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (16) ? 1 : 0); + PGXP_ALU(0x2A210010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80045B54u); #endif @@ -589409,7 +590908,8 @@ label_BFC2DCA8: psx_cyc_step(cpu, 0x206u); #endif /* 0xBFC2DCB4: 0122082A slt $at, $t1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0122082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045CB4u); #endif @@ -589518,7 +591018,8 @@ label_BFC2DCC8: psx_cyc_step(cpu, 0x106u); #endif /* 0xBFC2DCD4: 0102082A slt $at, $t0, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0102082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045CD4u); #endif @@ -589718,7 +591219,8 @@ label_BFC2DD08: psx_cyc_step(cpu, 0x1006u); #endif /* 0xBFC2DD14: 0182082A slt $at, $t4, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0182082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045D14u); #endif @@ -589827,7 +591329,8 @@ label_BFC2DD28: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC2DD34: 01C2082A slt $at, $t6, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x01C2082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045D34u); #endif @@ -589919,7 +591422,8 @@ label_BFC2DD40: psx_cyc_step(cpu, 0x1008002u); #endif /* 0xBFC2DD54: 01E1C024 and $t8, $t7, $at */ - cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[1]; + PGXP_ALU(0x01E1C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045D54u); #endif @@ -590853,7 +592357,8 @@ label_BFC2DEA8: psx_cyc_step(cpu, 0x24002u); #endif /* 0xBFC2DEB0: 022E082A slt $at, $s1, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x022E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045EB0u); #endif @@ -591061,7 +592566,8 @@ label_BFC2DEE8: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC2DEE8: 30580040 andi $t8, $v0, 0x40 */ - cpu->gpr[24] = cpu->gpr[2] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x40u; + PGXP_ALU(0x30580040u, cpu->gpr[24], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80045EE8u); #endif @@ -591438,7 +592944,8 @@ label_BFC2DF60: psx_cyc_step(cpu, 0x8006u); #endif /* 0xBFC2DF6C: 01E2082A slt $at, $t7, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x01E2082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045F6Cu); #endif @@ -591547,7 +593054,8 @@ label_BFC2DF80: psx_cyc_step(cpu, 0x1000006u); #endif /* 0xBFC2DF8C: 0302082A slt $at, $t8, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0302082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045F8Cu); #endif @@ -591750,7 +593258,8 @@ label_BFC2DFC0: psx_cyc_step(cpu, 0x406u); #endif /* 0xBFC2DFCC: 0142082A slt $at, $t2, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0142082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045FCCu); #endif @@ -591859,7 +593368,8 @@ label_BFC2DFE0: psx_cyc_step(cpu, 0x806u); #endif /* 0xBFC2DFEC: 0162082A slt $at, $t3, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0162082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80045FECu); #endif @@ -591972,7 +593482,8 @@ label_BFC2DFF8: psx_cyc_step(cpu, 0x3002u); #endif /* 0xBFC2E014: 01A16024 and $t4, $t5, $at */ - cpu->gpr[12] = cpu->gpr[13] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[12] = cpu->gpr[13] & cpu->gpr[1]; + PGXP_ALU(0x01A16024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80046014u); #endif @@ -592621,7 +594132,8 @@ label_BFC2E0FC: psx_cyc_step(cpu, 0x24002u); #endif /* 0xBFC2E104: 022E082A slt $at, $s1, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x022E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80046104u); #endif @@ -593908,7 +595420,8 @@ label_BFC2E2B0: psx_cyc_step(cpu, 0x42002u); #endif /* 0xBFC2E2BC: 024D082A slt $at, $s2, $t5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x024D082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800462BCu); #endif @@ -594021,7 +595534,8 @@ label_BFC2E2D4: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC2E2DC: 29C10060 slti $at, $t6, 96 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (96) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (96) ? 1 : 0); + PGXP_ALU(0x29C10060u, cpu->gpr[1], _pgx1, 0x0060u); } #ifdef PSX_COSIM cosim_instr(0x800462DCu); #endif @@ -594791,7 +596305,8 @@ label_BFC2E3C4: psx_cyc_step(cpu, 0x2Au); #endif /* 0xBFC2E3E0: 0065082A slt $at, $v1, $a1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0065082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800463E0u); #endif @@ -594918,7 +596433,8 @@ label_BFC2E3F4: psx_cyc_step(cpu, 0x200000Au); #endif /* 0xBFC2E404: 0323082A slt $at, $t9, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0323082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80046404u); #endif @@ -597103,7 +598619,8 @@ label_BFC2E6B8: psx_cyc_step(cpu, 0x1008020u); #endif /* 0xBFC2E6F8: 00AFC024 and $t8, $a1, $t7 */ - cpu->gpr[24] = cpu->gpr[5] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[5] & cpu->gpr[15]; + PGXP_ALU(0x00AFC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800466F8u); #endif @@ -597406,7 +598923,8 @@ label_BFC2E750: psx_cyc_step(cpu, 0x822u); #endif /* 0xBFC2E754: 00A15824 and $t3, $a1, $at */ - cpu->gpr[11] = cpu->gpr[5] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[11] = cpu->gpr[5] & cpu->gpr[1]; + PGXP_ALU(0x00A15824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80046754u); #endif @@ -597696,7 +599214,8 @@ label_BFC2E7B4: psx_cyc_step(cpu, 0x8022u); #endif /* 0xBFC2E7B8: 00A17824 and $t7, $a1, $at */ - cpu->gpr[15] = cpu->gpr[5] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[5] & cpu->gpr[1]; + PGXP_ALU(0x00A17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800467B8u); #endif @@ -597986,7 +599505,8 @@ label_BFC2E814: psx_cyc_step(cpu, 0x122u); #endif /* 0xBFC2E818: 00A14024 and $t0, $a1, $at */ - cpu->gpr[8] = cpu->gpr[5] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[5] & cpu->gpr[1]; + PGXP_ALU(0x00A14024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80046818u); #endif @@ -598276,7 +599796,8 @@ label_BFC2E874: psx_cyc_step(cpu, 0x822u); #endif /* 0xBFC2E878: 00A15824 and $t3, $a1, $at */ - cpu->gpr[11] = cpu->gpr[5] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[11] = cpu->gpr[5] & cpu->gpr[1]; + PGXP_ALU(0x00A15824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80046878u); #endif @@ -598658,7 +600179,8 @@ label_BFC2E8CC: psx_cyc_step(cpu, 0x4022u); #endif /* 0xBFC2E8E4: 00A17024 and $t6, $a1, $at */ - cpu->gpr[14] = cpu->gpr[5] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[5] & cpu->gpr[1]; + PGXP_ALU(0x00A17024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800468E4u); #endif @@ -599124,7 +600646,8 @@ label_BFC2E97C: psx_cyc_step(cpu, 0x422u); #endif /* 0xBFC2E980: 00A15024 and $t2, $a1, $at */ - cpu->gpr[10] = cpu->gpr[5] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[10] = cpu->gpr[5] & cpu->gpr[1]; + PGXP_ALU(0x00A15024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80046980u); #endif @@ -599417,7 +600940,8 @@ label_BFC2E9DC: psx_cyc_step(cpu, 0x2022u); #endif /* 0xBFC2E9E0: 00A16824 and $t5, $a1, $at */ - cpu->gpr[13] = cpu->gpr[5] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[13] = cpu->gpr[5] & cpu->gpr[1]; + PGXP_ALU(0x00A16824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800469E0u); #endif @@ -599710,7 +601234,8 @@ label_BFC2EA3C: psx_cyc_step(cpu, 0x1000022u); #endif /* 0xBFC2EA40: 00A1C024 and $t8, $a1, $at */ - cpu->gpr[24] = cpu->gpr[5] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[5] & cpu->gpr[1]; + PGXP_ALU(0x00A1C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80046A40u); #endif @@ -602332,7 +603857,8 @@ label_BFC2EE90: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC2EE94: 00A2082A slt $at, $a1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x00A2082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80046E94u); #endif @@ -603672,7 +605198,8 @@ label_BFC2F014: psx_cyc_step(cpu, 0x100002u); #endif /* 0xBFC2F014: 2A81003C slti $at, $s4, 60 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (60) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (60) ? 1 : 0); + PGXP_ALU(0x2A81003Cu, cpu->gpr[1], _pgx1, 0x003Cu); } #ifdef PSX_COSIM cosim_instr(0x80047014u); #endif @@ -603915,7 +605442,8 @@ label_BFC2F03C: psx_cyc_step(cpu, 0x20802u); #endif /* 0xBFC2F064: 022B082A slt $at, $s1, $t3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x022B082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80047064u); #endif @@ -609188,7 +610716,8 @@ label_BFC2F830: psx_cyc_step(cpu, 0x800Cu); #endif /* 0xBFC2F83C: 006F1024 and $v0, $v1, $t7 */ - cpu->gpr[2] = cpu->gpr[3] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[2] = cpu->gpr[3] & cpu->gpr[15]; + PGXP_ALU(0x006F1024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004783Cu); #endif @@ -610976,7 +612505,8 @@ label_BFC2FA18: psx_cyc_step(cpu, 0x180002u); #endif /* 0xBFC2FA1C: 0293082A slt $at, $s4, $s3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (int32_t)cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (int32_t)cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0293082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80047A1Cu); #endif @@ -614437,7 +615967,8 @@ label_BFC2FEC4: psx_cyc_step(cpu, 0x2402u); #endif /* 0xBFC2FED4: 014D082A slt $at, $t2, $t5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (int32_t)cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x014D082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80047ED4u); #endif @@ -614603,7 +616134,8 @@ label_BFC2FEEC: psx_cyc_step(cpu, 0x602u); #endif /* 0xBFC2FF10: 012A082A slt $at, $t1, $t2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x012A082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80047F10u); #endif @@ -617814,7 +619346,8 @@ label_BFC3041C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC30430: 2C410004 sltiu $at, $v0, 4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000004u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000004u ? 1 : 0); + PGXP_ALU(0x2C410004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80048430u); #endif @@ -618735,7 +620268,8 @@ label_BFC30514: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC30528: 2C410004 sltiu $at, $v0, 4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000004u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000004u ? 1 : 0); + PGXP_ALU(0x2C410004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80048528u); #endif @@ -628301,7 +629835,8 @@ label_BFC31128: psx_cyc_step(cpu, 0x420002u); #endif /* 0xBFC3112C: 0236082A slt $at, $s1, $s6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[22] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; uint32_t _pgx2 = cpu->gpr[22]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (int32_t)cpu->gpr[22] ? 1 : 0); + PGXP_ALU(0x0236082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004912Cu); #endif @@ -630229,7 +631764,8 @@ label_BFC313B8: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC313C4: 2A211000 slti $at, $s1, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (4096) ? 1 : 0); + PGXP_ALU(0x2A211000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x800493C4u); #endif @@ -630521,7 +632057,8 @@ label_BFC31418: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC31424: 2A211000 slti $at, $s1, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (4096) ? 1 : 0); + PGXP_ALU(0x2A211000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80049424u); #endif @@ -631210,7 +632747,8 @@ label_BFC31530: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC31534: 2A011000 slti $at, $s0, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (4096) ? 1 : 0); + PGXP_ALU(0x2A011000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80049534u); #endif @@ -631768,7 +633306,8 @@ label_BFC315FC: psx_cyc_step(cpu, 0x20002u); #endif /* 0xBFC31608: 2A211000 slti $at, $s1, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[17] < (4096) ? 1 : 0); + PGXP_ALU(0x2A211000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80049608u); #endif @@ -633319,7 +634858,8 @@ label_BFC3182C: psx_cyc_step(cpu, 0x500u); #endif /* 0xBFC31854: 310A003F andi $t2, $t0, 0x3F */ - cpu->gpr[10] = cpu->gpr[8] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[10] = cpu->gpr[8] & 0x3Fu; + PGXP_ALU(0x310A003Fu, cpu->gpr[10], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80049854u); #endif @@ -633922,7 +635462,8 @@ label_BFC318E4: psx_cyc_step(cpu, 0x408u); #endif /* 0xBFC3190C: 306A003F andi $t2, $v1, 0x3F */ - cpu->gpr[10] = cpu->gpr[3] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[10] = cpu->gpr[3] & 0x3Fu; + PGXP_ALU(0x306A003Fu, cpu->gpr[10], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x8004990Cu); #endif @@ -634931,7 +636472,8 @@ label_BFC319EC: psx_cyc_step(cpu, 0x4008u); #endif /* 0xBFC31A14: 306E003F andi $t6, $v1, 0x3F */ - cpu->gpr[14] = cpu->gpr[3] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[14] = cpu->gpr[3] & 0x3Fu; + PGXP_ALU(0x306E003Fu, cpu->gpr[14], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80049A14u); #endif @@ -635863,7 +637405,8 @@ label_BFC31B38: psx_cyc_step(cpu, 0x11000u); #endif /* 0xBFC31B3C: 320C003F andi $t4, $s0, 0x3F */ - cpu->gpr[12] = cpu->gpr[16] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[12] = cpu->gpr[16] & 0x3Fu; + PGXP_ALU(0x320C003Fu, cpu->gpr[12], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80049B3Cu); #endif @@ -636767,7 +638310,8 @@ label_BFC31C50: psx_cyc_step(cpu, 0x10Cu); #endif /* 0xBFC31C60: 01031024 and $v0, $t0, $v1 */ - cpu->gpr[2] = cpu->gpr[8] & cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[8] & cpu->gpr[3]; + PGXP_ALU(0x01031024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80049C60u); #endif @@ -637023,7 +638567,8 @@ label_BFC31C88: psx_cyc_step(cpu, 0x2000080u); #endif /* 0xBFC31CAC: 30F9003F andi $t9, $a3, 0x3F */ - cpu->gpr[25] = cpu->gpr[7] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[25] = cpu->gpr[7] & 0x3Fu; + PGXP_ALU(0x30F9003Fu, cpu->gpr[25], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80049CACu); #endif @@ -637666,7 +639211,8 @@ label_BFC31D38: psx_cyc_step(cpu, 0x2000080u); #endif /* 0xBFC31D5C: 30F9003F andi $t9, $a3, 0x3F */ - cpu->gpr[25] = cpu->gpr[7] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[25] = cpu->gpr[7] & 0x3Fu; + PGXP_ALU(0x30F9003Fu, cpu->gpr[25], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80049D5Cu); #endif @@ -638309,7 +639855,8 @@ label_BFC31DE8: psx_cyc_step(cpu, 0x2000080u); #endif /* 0xBFC31E0C: 30F9003F andi $t9, $a3, 0x3F */ - cpu->gpr[25] = cpu->gpr[7] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[25] = cpu->gpr[7] & 0x3Fu; + PGXP_ALU(0x30F9003Fu, cpu->gpr[25], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80049E0Cu); #endif @@ -638952,7 +640499,8 @@ label_BFC31E98: psx_cyc_step(cpu, 0x2000080u); #endif /* 0xBFC31EBC: 30F9003F andi $t9, $a3, 0x3F */ - cpu->gpr[25] = cpu->gpr[7] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[25] = cpu->gpr[7] & 0x3Fu; + PGXP_ALU(0x30F9003Fu, cpu->gpr[25], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80049EBCu); #endif @@ -639653,7 +641201,8 @@ label_BFC32054: psx_cyc_step(cpu, 0xC001u); #endif /* 0xBFC3205C: 01C07827 nor $t7, $t6, $zero */ - cpu->gpr[15] = ~(cpu->gpr[14] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[15] = ~(cpu->gpr[14] | cpu->gpr[0]); + PGXP_ALU(0x01C07827u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A05Cu); #endif @@ -640083,7 +641632,8 @@ label_BFC320D0: psx_cyc_step(cpu, 0x100C000u); #endif /* 0xBFC320DC: 01CFC024 and $t8, $t6, $t7 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + PGXP_ALU(0x01CFC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A0DCu); #endif @@ -640372,7 +641922,8 @@ label_BFC3211C: psx_cyc_step(cpu, 0x4022u); #endif /* 0xBFC32124: 00AE082A slt $at, $a1, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x00AE082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A124u); #endif @@ -640433,7 +641984,8 @@ label_BFC32130: psx_cyc_step(cpu, 0x8042u); #endif /* 0xBFC32138: 00CF082A slt $at, $a2, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x00CF082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A138u); #endif @@ -640796,7 +642348,8 @@ label_BFC3214C: psx_cyc_step(cpu, 0x2008400u); #endif /* 0xBFC321BC: 032A7824 and $t7, $t9, $t2 */ - cpu->gpr[15] = cpu->gpr[25] & cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[15] = cpu->gpr[25] & cpu->gpr[10]; + PGXP_ALU(0x032A7824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A1BCu); #endif @@ -641193,7 +642746,8 @@ label_BFC32210: psx_cyc_step(cpu, 0x4022u); #endif /* 0xBFC32218: 00AE082A slt $at, $a1, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x00AE082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A218u); #endif @@ -641257,7 +642811,8 @@ label_BFC32224: psx_cyc_step(cpu, 0x8042u); #endif /* 0xBFC3222C: 00CF082A slt $at, $a2, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x00CF082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A22Cu); #endif @@ -641542,7 +643097,8 @@ label_BFC32238: psx_cyc_step(cpu, 0x1000201u); #endif /* 0xBFC32294: 0120C027 nor $t8, $t1, $zero */ - cpu->gpr[24] = ~(cpu->gpr[9] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[24] = ~(cpu->gpr[9] | cpu->gpr[0]); + PGXP_ALU(0x0120C027u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A294u); #endif @@ -641597,7 +643153,8 @@ label_BFC32238: psx_cyc_step(cpu, 0x1006000u); #endif /* 0xBFC322AC: 01B87024 and $t6, $t5, $t8 */ - cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[24]; + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[24]; + PGXP_ALU(0x01B87024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A2ACu); #endif @@ -643698,7 +645255,8 @@ label_BFC324F8: psx_cyc_step(cpu, 0x10006u); #endif /* 0xBFC32508: 0202082A slt $at, $s0, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0202082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A508u); #endif @@ -643802,7 +645360,8 @@ label_BFC3251C: psx_cyc_step(cpu, 0x8000Au); #endif /* 0xBFC32528: 0263082A slt $at, $s3, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0263082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A528u); #endif @@ -644122,7 +645681,8 @@ label_BFC3255C: psx_cyc_step(cpu, 0x10Au); #endif /* 0xBFC32580: 0068082A slt $at, $v1, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0068082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A580u); #endif @@ -644203,7 +645763,8 @@ label_BFC3258C: psx_cyc_step(cpu, 0x8006u); #endif /* 0xBFC3259C: 01E2082A slt $at, $t7, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x01E2082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A59Cu); #endif @@ -644313,7 +645874,8 @@ label_BFC325B0: psx_cyc_step(cpu, 0xA2u); #endif /* 0xBFC325BC: 00E5082A slt $at, $a3, $a1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x00E5082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A5BCu); #endif @@ -644396,7 +645958,8 @@ label_BFC325C8: psx_cyc_step(cpu, 0x2000012u); #endif /* 0xBFC325D8: 0324082A slt $at, $t9, $a0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0324082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A5D8u); #endif @@ -644512,7 +646075,8 @@ label_BFC325EC: psx_cyc_step(cpu, 0xA02u); #endif /* 0xBFC325F8: 0169082A slt $at, $t3, $t1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (int32_t)cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (int32_t)cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0169082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A5F8u); #endif @@ -644628,7 +646192,8 @@ label_BFC3260C: psx_cyc_step(cpu, 0x2102u); #endif /* 0xBFC32618: 01A8082A slt $at, $t5, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x01A8082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A618u); #endif @@ -644748,7 +646313,8 @@ label_BFC3262C: psx_cyc_step(cpu, 0x40012u); #endif /* 0xBFC32638: 0244082A slt $at, $s2, $a0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0244082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A638u); #endif @@ -644838,7 +646404,8 @@ label_BFC3264C: psx_cyc_step(cpu, 0x10006u); #endif /* 0xBFC32650: 0202082A slt $at, $s0, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0202082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A650u); #endif @@ -645197,7 +646764,8 @@ label_BFC3269C: psx_cyc_step(cpu, 0x10006u); #endif /* 0xBFC326B4: 0202082A slt $at, $s0, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0202082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A6B4u); #endif @@ -645311,7 +646879,8 @@ label_BFC326D0: psx_cyc_step(cpu, 0x40012u); #endif /* 0xBFC326DC: 0244082A slt $at, $s2, $a0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0244082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A6DCu); #endif @@ -646711,7 +648280,8 @@ label_BFC32874: psx_cyc_step(cpu, 0x11002u); #endif /* 0xBFC328B0: 020C082A slt $at, $s0, $t4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[12] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[12]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[12] ? 1 : 0); + PGXP_ALU(0x020C082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004A8B0u); #endif @@ -648069,7 +649639,8 @@ label_BFC32A5C: psx_cyc_step(cpu, 0x180002u); #endif /* 0xBFC32A60: 0274082B sltu $at, $s3, $s4 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < cpu->gpr[20] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < cpu->gpr[20] ? 1 : 0); + PGXP_ALU(0x0274082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004AA60u); #endif @@ -649460,7 +651031,8 @@ label_BFC32C50: psx_cyc_step(cpu, 0x6002u); #endif /* 0xBFC32C70: 01AE082B sltu $at, $t5, $t6 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x01AE082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004AC70u); #endif @@ -654860,7 +656432,8 @@ label_BFC331A0: psx_cyc_step(cpu, 0x200082u); #endif /* 0xBFC331D0: 02A7082A slt $at, $s5, $a3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[21] < (int32_t)cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[21]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[21] < (int32_t)cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x02A7082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B1D0u); #endif @@ -655011,7 +656584,8 @@ label_BFC331F4: psx_cyc_step(cpu, 0x40000Au); #endif /* 0xBFC331FC: 02C3082A slt $at, $s6, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[22]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[22] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x02C3082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B1FCu); #endif @@ -655340,7 +656914,8 @@ label_BFC33244: psx_cyc_step(cpu, 0xC0002u); #endif /* 0xBFC33244: 0253082A slt $at, $s2, $s3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0253082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B244u); #endif @@ -655547,7 +657122,8 @@ label_BFC3327C: psx_cyc_step(cpu, 0x90002u); #endif /* 0xBFC33280: 0270082A slt $at, $s3, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0270082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B280u); #endif @@ -655673,7 +657249,8 @@ label_BFC3329C: psx_cyc_step(cpu, 0xA0002u); #endif /* 0xBFC332A8: 0271082A slt $at, $s3, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0271082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B2A8u); #endif @@ -655936,7 +657513,8 @@ label_BFC332EC: psx_cyc_step(cpu, 0x50002u); #endif /* 0xBFC332F0: 0250082A slt $at, $s2, $s0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[16] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[16] ? 1 : 0); + PGXP_ALU(0x0250082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B2F0u); #endif @@ -656062,7 +657640,8 @@ label_BFC3330C: psx_cyc_step(cpu, 0x60002u); #endif /* 0xBFC33318: 0251082A slt $at, $s2, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0251082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B318u); #endif @@ -656374,7 +657953,8 @@ label_BFC33358: psx_cyc_step(cpu, 0x18002u); #endif /* 0xBFC33388: 020F082A slt $at, $s0, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x020F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B388u); #endif @@ -656585,7 +658165,8 @@ label_BFC333BC: psx_cyc_step(cpu, 0x10202u); #endif /* 0xBFC333D4: 0209082A slt $at, $s0, $t1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (int32_t)cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0209082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B3D4u); #endif @@ -656844,7 +658425,8 @@ label_BFC33400: psx_cyc_step(cpu, 0x8002u); #endif /* 0xBFC3342C: 29E10002 slti $at, $t7, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (2) ? 1 : 0); + PGXP_ALU(0x29E10002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8004B42Cu); #endif @@ -656979,7 +658561,8 @@ label_BFC33438: psx_cyc_step(cpu, 0x40000002u); #endif /* 0xBFC3345C: 2BC10002 slti $at, $fp, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[30] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[30]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[30] < (2) ? 1 : 0); + PGXP_ALU(0x2BC10002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8004B45Cu); #endif @@ -657233,7 +658816,8 @@ label_BFC3349C: psx_cyc_step(cpu, 0x100002u); #endif /* 0xBFC334A0: 2A810002 slti $at, $s4, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[20] < (2) ? 1 : 0); + PGXP_ALU(0x2A810002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8004B4A0u); #endif @@ -657499,7 +659083,8 @@ label_BFC334E0: psx_cyc_step(cpu, 0x40080002u); #endif /* 0xBFC334E4: 027E082A slt $at, $s3, $fp */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[30] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[30]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[19] < (int32_t)cpu->gpr[30] ? 1 : 0); + PGXP_ALU(0x027E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B4E4u); #endif @@ -657561,7 +659146,8 @@ label_BFC334F0: psx_cyc_step(cpu, 0x1800002u); #endif /* 0xBFC334F8: 02F8082A slt $at, $s7, $t8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[23] < (int32_t)cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[23]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[23] < (int32_t)cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x02F8082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004B4F8u); #endif @@ -657579,7 +659165,8 @@ label_BFC334F0: psx_cyc_step(cpu, 0x40000002u); #endif /* 0xBFC33500: 2BC10002 slti $at, $fp, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[30] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[30]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[30] < (2) ? 1 : 0); + PGXP_ALU(0x2BC10002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8004B500u); #endif @@ -660326,7 +661913,8 @@ label_BFC33800: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC3380C: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B80Cu); #endif @@ -660337,7 +661925,8 @@ label_BFC33800: psx_cyc_step(cpu, 0x400u); #endif /* 0xBFC33810: 314AFFFF andi $t2, $t2, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[10] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B810u); #endif @@ -660440,7 +662029,8 @@ label_BFC33800: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC33838: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B838u); #endif @@ -660448,7 +662038,8 @@ label_BFC33800: psx_cyc_step(cpu, 0x400u); #endif /* 0xBFC3383C: 314AFFFF andi $t2, $t2, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[10] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B83Cu); #endif @@ -660585,7 +662176,8 @@ label_BFC33800: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC33868: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B868u); #endif @@ -660718,7 +662310,8 @@ label_BFC3388C: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC33898: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B898u); #endif @@ -660726,7 +662319,8 @@ label_BFC3388C: psx_cyc_step(cpu, 0x400u); #endif /* 0xBFC3389C: 314AFFFF andi $t2, $t2, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[10] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B89Cu); #endif @@ -660832,7 +662426,8 @@ label_BFC3388C: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC338C4: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B8C4u); #endif @@ -660840,7 +662435,8 @@ label_BFC3388C: psx_cyc_step(cpu, 0x400u); #endif /* 0xBFC338C8: 314AFFFF andi $t2, $t2, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[10] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B8C8u); #endif @@ -660977,7 +662573,8 @@ label_BFC3388C: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC338F4: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004B8F4u); #endif @@ -662885,7 +664482,8 @@ label_BFC33B9C: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC33B9C: 30480001 andi $t0, $v0, 0x1 */ - cpu->gpr[8] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30480001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004BB9Cu); #endif @@ -662905,7 +664503,8 @@ label_BFC33B9C: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC33BA4: 004A5024 and $t2, $v0, $t2 */ - cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[10]; + PGXP_ALU(0x004A5024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004BBA4u); #endif @@ -663344,7 +664943,8 @@ label_BFC33C20: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC33C20: 30480001 andi $t0, $v0, 0x1 */ - cpu->gpr[8] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30480001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004BC20u); #endif @@ -663361,7 +664961,8 @@ label_BFC33C20: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC33C28: 004A5024 and $t2, $v0, $t2 */ - cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[10]; + PGXP_ALU(0x004A5024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004BC28u); #endif @@ -663922,7 +665523,8 @@ label_BFC33CBC: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC33CBC: 30480001 andi $t0, $v0, 0x1 */ - cpu->gpr[8] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30480001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x8004BCBCu); #endif @@ -663978,7 +665580,8 @@ label_BFC33CC0: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC33CC4: 004A5024 and $t2, $v0, $t2 */ - cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[10]; + PGXP_ALU(0x004A5024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004BCC4u); #endif @@ -664386,7 +665989,8 @@ label_BFC33D30: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC33D3C: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004BD3Cu); #endif @@ -664487,7 +666091,8 @@ label_BFC33D30: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC33D64: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004BD64u); #endif @@ -664957,7 +666562,8 @@ label_BFC33DA4: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC33E04: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004BE04u); #endif @@ -667441,7 +669047,8 @@ label_BFC3409C: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC340A4: 3109001F andi $t1, $t0, 0x1F */ - cpu->gpr[9] = cpu->gpr[8] & 0x1Fu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x1Fu; + PGXP_ALU(0x3109001Fu, cpu->gpr[9], _pgx1, 0x001Fu); } #ifdef PSX_COSIM cosim_instr(0x8004C0A4u); #endif @@ -667458,7 +669065,8 @@ label_BFC3409C: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC340AC: 310903E0 andi $t1, $t0, 0x3E0 */ - cpu->gpr[9] = cpu->gpr[8] & 0x3E0u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x3E0u; + PGXP_ALU(0x310903E0u, cpu->gpr[9], _pgx1, 0x03E0u); } #ifdef PSX_COSIM cosim_instr(0x8004C0ACu); #endif @@ -667487,7 +669095,8 @@ label_BFC3409C: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC340B8: 31097C00 andi $t1, $t0, 0x7C00 */ - cpu->gpr[9] = cpu->gpr[8] & 0x7C00u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x7C00u; + PGXP_ALU(0x31097C00u, cpu->gpr[9], _pgx1, 0x7C00u); } #ifdef PSX_COSIM cosim_instr(0x8004C0B8u); #endif @@ -668017,7 +669626,8 @@ label_BFC34148: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3414C: 28410003 slti $at, $v0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3) ? 1 : 0); + PGXP_ALU(0x28410003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x8004C14Cu); #endif @@ -673303,7 +674913,8 @@ label_BFC348A8: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC348B0: 30630FFF andi $v1, $v1, 0xFFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFFu; + PGXP_ALU(0x30630FFFu, cpu->gpr[3], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004C8B0u); #endif @@ -673474,7 +675085,8 @@ label_BFC348D0: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC348D4: 30630FFF andi $v1, $v1, 0xFFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFFu; + PGXP_ALU(0x30630FFFu, cpu->gpr[3], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004C8D4u); #endif @@ -673679,7 +675291,8 @@ label_BFC348FC: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34900: 28810400 slti $at, $a0, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + PGXP_ALU(0x28810400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8004C900u); #endif @@ -673718,7 +675331,8 @@ label_BFC34904: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34908: 28810400 slti $at, $a0, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + PGXP_ALU(0x28810400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8004C908u); #endif @@ -673828,7 +675442,8 @@ label_BFC34924: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34924: 28810400 slti $at, $a0, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + PGXP_ALU(0x28810400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8004C924u); #endif @@ -673880,7 +675495,8 @@ label_BFC34928: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC3492C: 28810800 slti $at, $a0, 2048 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + PGXP_ALU(0x28810800u, cpu->gpr[1], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0x8004C92Cu); #endif @@ -673919,7 +675535,8 @@ label_BFC34930: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34934: 28810800 slti $at, $a0, 2048 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + PGXP_ALU(0x28810800u, cpu->gpr[1], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0x8004C934u); #endif @@ -674038,7 +675655,8 @@ label_BFC34954: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34954: 28810800 slti $at, $a0, 2048 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + PGXP_ALU(0x28810800u, cpu->gpr[1], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0x8004C954u); #endif @@ -674090,7 +675708,8 @@ label_BFC34958: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC3495C: 28810C00 slti $at, $a0, 3072 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + PGXP_ALU(0x28810C00u, cpu->gpr[1], _pgx1, 0x0C00u); } #ifdef PSX_COSIM cosim_instr(0x8004C95Cu); #endif @@ -674129,7 +675748,8 @@ label_BFC34960: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34964: 28810C00 slti $at, $a0, 3072 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + PGXP_ALU(0x28810C00u, cpu->gpr[1], _pgx1, 0x0C00u); } #ifdef PSX_COSIM cosim_instr(0x8004C964u); #endif @@ -674237,7 +675857,8 @@ label_BFC34980: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34980: 28810C00 slti $at, $a0, 3072 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + PGXP_ALU(0x28810C00u, cpu->gpr[1], _pgx1, 0x0C00u); } #ifdef PSX_COSIM cosim_instr(0x8004C980u); #endif @@ -674290,7 +675911,8 @@ label_BFC34984: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34988: 28811000 slti $at, $a0, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (4096) ? 1 : 0); + PGXP_ALU(0x28811000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x8004C988u); #endif @@ -674565,7 +676187,8 @@ label_BFC349C4: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC349C8: 30840FFF andi $a0, $a0, 0xFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFu; + PGXP_ALU(0x30840FFFu, cpu->gpr[4], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004C9C8u); #endif @@ -674665,7 +676288,8 @@ label_BFC349D8: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC349DC: 28810400 slti $at, $a0, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + PGXP_ALU(0x28810400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8004C9DCu); #endif @@ -674704,7 +676328,8 @@ label_BFC349E0: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC349E4: 28810400 slti $at, $a0, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + PGXP_ALU(0x28810400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8004C9E4u); #endif @@ -674823,7 +676448,8 @@ label_BFC34A04: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34A04: 28810400 slti $at, $a0, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + PGXP_ALU(0x28810400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8004CA04u); #endif @@ -674875,7 +676501,8 @@ label_BFC34A08: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34A0C: 28810800 slti $at, $a0, 2048 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + PGXP_ALU(0x28810800u, cpu->gpr[1], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0x8004CA0Cu); #endif @@ -674914,7 +676541,8 @@ label_BFC34A10: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34A14: 28810800 slti $at, $a0, 2048 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + PGXP_ALU(0x28810800u, cpu->gpr[1], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0x8004CA14u); #endif @@ -675022,7 +676650,8 @@ label_BFC34A30: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34A30: 28810800 slti $at, $a0, 2048 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (2048) ? 1 : 0); + PGXP_ALU(0x28810800u, cpu->gpr[1], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0x8004CA30u); #endif @@ -675074,7 +676703,8 @@ label_BFC34A34: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34A38: 28810C00 slti $at, $a0, 3072 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + PGXP_ALU(0x28810C00u, cpu->gpr[1], _pgx1, 0x0C00u); } #ifdef PSX_COSIM cosim_instr(0x8004CA38u); #endif @@ -675116,7 +676746,8 @@ label_BFC34A3C: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34A40: 28810C00 slti $at, $a0, 3072 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + PGXP_ALU(0x28810C00u, cpu->gpr[1], _pgx1, 0x0C00u); } #ifdef PSX_COSIM cosim_instr(0x8004CA40u); #endif @@ -675233,7 +676864,8 @@ label_BFC34A60: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34A60: 28810C00 slti $at, $a0, 3072 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3072) ? 1 : 0); + PGXP_ALU(0x28810C00u, cpu->gpr[1], _pgx1, 0x0C00u); } #ifdef PSX_COSIM cosim_instr(0x8004CA60u); #endif @@ -675286,7 +676918,8 @@ label_BFC34A64: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC34A68: 28811000 slti $at, $a0, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (4096) ? 1 : 0); + PGXP_ALU(0x28811000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x8004CA68u); #endif @@ -677449,7 +679082,8 @@ label_BFC34CF4: psx_cyc_step(cpu, 0x222u); #endif /* 0xBFC34CF8: 0125082B sltu $at, $t1, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0125082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004CCF8u); #endif @@ -677627,7 +679261,8 @@ label_BFC34D2C: psx_cyc_step(cpu, 0x1000022u); #endif /* 0xBFC34D34: 00B8082A slt $at, $a1, $t8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x00B8082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004CD34u); #endif @@ -677787,7 +679422,8 @@ label_BFC34D60: psx_cyc_step(cpu, 0x602u); #endif /* 0xBFC34D64: 012A082B sltu $at, $t1, $t2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)(cpu->gpr[9] < cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x012A082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004CD64u); #endif @@ -677844,7 +679480,8 @@ label_BFC34D70: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC34D74: 2C410009 sltiu $at, $v0, 9 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000009u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000009u ? 1 : 0); + PGXP_ALU(0x2C410009u, cpu->gpr[1], _pgx1, 0x0009u); } #ifdef PSX_COSIM cosim_instr(0x8004CD74u); #endif @@ -679347,7 +680984,8 @@ label_BFC34F70: psx_cyc_step(cpu, 0x122u); #endif /* 0xBFC34F74: 00A8082B sltu $at, $a1, $t0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x00A8082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004CF74u); #endif @@ -679362,7 +681000,8 @@ label_BFC34F70: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC34F7C: 28410014 slti $at, $v0, 20 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (20) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (20) ? 1 : 0); + PGXP_ALU(0x28410014u, cpu->gpr[1], _pgx1, 0x0014u); } #ifdef PSX_COSIM cosim_instr(0x8004CF7Cu); #endif @@ -679699,7 +681338,8 @@ label_BFC34FA0: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC34FE4: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004CFE4u); #endif @@ -679933,7 +681573,8 @@ label_BFC34FA0: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC35040: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D040u); #endif @@ -680050,7 +681691,8 @@ label_BFC34FA0: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC35068: 316BFFFF andi $t3, $t3, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D068u); #endif @@ -680088,7 +681730,8 @@ label_BFC34FA0: psx_cyc_step(cpu, 0x2000u); #endif /* 0xBFC35078: 31ADFFFF andi $t5, $t5, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + PGXP_ALU(0x31ADFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D078u); #endif @@ -680312,7 +681955,8 @@ label_BFC34FA0: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC350CC: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D0CCu); #endif @@ -680341,7 +681985,8 @@ label_BFC34FA0: psx_cyc_step(cpu, 0x8000u); #endif /* 0xBFC350D8: 31EFFFFF andi $t7, $t7, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + PGXP_ALU(0x31EFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D0D8u); #endif @@ -680729,7 +682374,8 @@ label_BFC35128: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC3516C: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D16Cu); #endif @@ -680963,7 +682609,8 @@ label_BFC35128: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC351C8: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D1C8u); #endif @@ -681083,7 +682730,8 @@ label_BFC35128: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC351F0: 316BFFFF andi $t3, $t3, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D1F0u); #endif @@ -681121,7 +682769,8 @@ label_BFC35128: psx_cyc_step(cpu, 0x2000u); #endif /* 0xBFC35200: 31ADFFFF andi $t5, $t5, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + PGXP_ALU(0x31ADFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D200u); #endif @@ -681198,7 +682847,8 @@ label_BFC35128: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC3521C: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D21Cu); #endif @@ -681236,7 +682886,8 @@ label_BFC35128: psx_cyc_step(cpu, 0x8000u); #endif /* 0xBFC3522C: 31EFFFFF andi $t7, $t7, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + PGXP_ALU(0x31EFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D22Cu); #endif @@ -681407,7 +683058,8 @@ label_BFC3524C: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC35268: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D268u); #endif @@ -681641,7 +683293,8 @@ label_BFC3524C: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC352C4: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D2C4u); #endif @@ -681758,7 +683411,8 @@ label_BFC3524C: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC352EC: 316BFFFF andi $t3, $t3, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D2ECu); #endif @@ -681796,7 +683450,8 @@ label_BFC3524C: psx_cyc_step(cpu, 0x2000u); #endif /* 0xBFC352FC: 31ADFFFF andi $t5, $t5, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + PGXP_ALU(0x31ADFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D2FCu); #endif @@ -681876,7 +683531,8 @@ label_BFC3524C: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC35318: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D318u); #endif @@ -681914,7 +683570,8 @@ label_BFC3524C: psx_cyc_step(cpu, 0x8000u); #endif /* 0xBFC35328: 31EFFFFF andi $t7, $t7, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + PGXP_ALU(0x31EFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D328u); #endif @@ -682196,7 +683853,8 @@ label_BFC35348: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC35390: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D390u); #endif @@ -682427,7 +684085,8 @@ label_BFC35348: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC353EC: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D3ECu); #endif @@ -682547,7 +684206,8 @@ label_BFC35348: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC35414: 316BFFFF andi $t3, $t3, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D414u); #endif @@ -682585,7 +684245,8 @@ label_BFC35348: psx_cyc_step(cpu, 0x2000u); #endif /* 0xBFC35424: 31ADFFFF andi $t5, $t5, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + PGXP_ALU(0x31ADFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D424u); #endif @@ -682665,7 +684326,8 @@ label_BFC35348: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC35440: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D440u); #endif @@ -682703,7 +684365,8 @@ label_BFC35348: psx_cyc_step(cpu, 0x8000u); #endif /* 0xBFC35450: 31EFFFFF andi $t7, $t7, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + PGXP_ALU(0x31EFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D450u); #endif @@ -682979,7 +684642,8 @@ label_BFC35470: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC354B8: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D4B8u); #endif @@ -683213,7 +684877,8 @@ label_BFC35470: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC35514: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D514u); #endif @@ -683330,7 +684995,8 @@ label_BFC35470: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC3553C: 316BFFFF andi $t3, $t3, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D53Cu); #endif @@ -683368,7 +685034,8 @@ label_BFC35470: psx_cyc_step(cpu, 0x2000u); #endif /* 0xBFC3554C: 31ADFFFF andi $t5, $t5, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + PGXP_ALU(0x31ADFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D54Cu); #endif @@ -683448,7 +685115,8 @@ label_BFC35470: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC35568: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D568u); #endif @@ -683486,7 +685154,8 @@ label_BFC35470: psx_cyc_step(cpu, 0x8000u); #endif /* 0xBFC35578: 31EFFFFF andi $t7, $t7, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + PGXP_ALU(0x31EFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D578u); #endif @@ -683648,7 +685317,8 @@ label_BFC35598: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC355B0: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D5B0u); #endif @@ -683665,7 +685335,8 @@ label_BFC35598: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC355B8: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D5B8u); #endif @@ -683899,7 +685570,8 @@ label_BFC35598: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC35614: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D614u); #endif @@ -684016,7 +685688,8 @@ label_BFC35598: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC3563C: 316BFFFF andi $t3, $t3, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D63Cu); #endif @@ -684054,7 +685727,8 @@ label_BFC35598: psx_cyc_step(cpu, 0x2000u); #endif /* 0xBFC3564C: 31ADFFFF andi $t5, $t5, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + PGXP_ALU(0x31ADFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D64Cu); #endif @@ -684134,7 +685808,8 @@ label_BFC35598: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC35668: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D668u); #endif @@ -684172,7 +685847,8 @@ label_BFC35598: psx_cyc_step(cpu, 0x8000u); #endif /* 0xBFC35678: 31EFFFFF andi $t7, $t7, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + PGXP_ALU(0x31EFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D678u); #endif @@ -684454,7 +686130,8 @@ label_BFC35698: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC356E0: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D6E0u); #endif @@ -684685,7 +686362,8 @@ label_BFC35698: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC3573C: 01214824 and $t1, $t1, $at */ - cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[9] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01214824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004D73Cu); #endif @@ -684805,7 +686483,8 @@ label_BFC35698: psx_cyc_step(cpu, 0x800u); #endif /* 0xBFC35764: 316BFFFF andi $t3, $t3, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[11] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D764u); #endif @@ -684834,7 +686513,8 @@ label_BFC35698: psx_cyc_step(cpu, 0x2000u); #endif /* 0xBFC35770: 31ADFFFF andi $t5, $t5, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[13] = cpu->gpr[13] & 0xFFFFu; + PGXP_ALU(0x31ADFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D770u); #endif @@ -684915,7 +686595,8 @@ label_BFC35698: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC3578C: 3108FFFF andi $t0, $t0, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3108FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D78Cu); #endif @@ -684944,7 +686625,8 @@ label_BFC35698: psx_cyc_step(cpu, 0x8000u); #endif /* 0xBFC35798: 31EFFFFF andi $t7, $t7, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[15] = cpu->gpr[15] & 0xFFFFu; + PGXP_ALU(0x31EFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D798u); #endif @@ -685694,7 +687376,8 @@ label_BFC35890: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC35898: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D898u); #endif @@ -685798,7 +687481,8 @@ label_BFC35890: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC358C4: 3129FFFF andi $t1, $t1, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x3129FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D8C4u); #endif @@ -685872,7 +687556,8 @@ label_BFC35890: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC358E0: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D8E0u); #endif @@ -685952,7 +687637,8 @@ label_BFC35890: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC35900: 3129FFFF andi $t1, $t1, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x3129FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D900u); #endif @@ -686023,7 +687709,8 @@ label_BFC35890: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3591C: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D91Cu); #endif @@ -686103,7 +687790,8 @@ label_BFC35890: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC3593C: 3129FFFF andi $t1, $t1, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x3129FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D93Cu); #endif @@ -686177,7 +687865,8 @@ label_BFC35890: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC35958: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D958u); #endif @@ -686257,7 +687946,8 @@ label_BFC35890: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC35978: 3129FFFF andi $t1, $t1, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x3129FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D978u); #endif @@ -686331,7 +688021,8 @@ label_BFC35890: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC35994: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D994u); #endif @@ -686449,7 +688140,8 @@ label_BFC359B4: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC359BC: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D9BCu); #endif @@ -686553,7 +688245,8 @@ label_BFC359B4: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC359E8: 3129FFFF andi $t1, $t1, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x3129FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004D9E8u); #endif @@ -686627,7 +688320,8 @@ label_BFC359B4: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC35A04: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004DA04u); #endif @@ -686707,7 +688401,8 @@ label_BFC359B4: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC35A24: 3129FFFF andi $t1, $t1, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x3129FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004DA24u); #endif @@ -686781,7 +688476,8 @@ label_BFC359B4: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC35A40: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004DA40u); #endif @@ -686861,7 +688557,8 @@ label_BFC359B4: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC35A60: 3129FFFF andi $t1, $t1, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x3129FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004DA60u); #endif @@ -686932,7 +688629,8 @@ label_BFC359B4: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC35A7C: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004DA7Cu); #endif @@ -687012,7 +688710,8 @@ label_BFC359B4: psx_cyc_step(cpu, 0x200u); #endif /* 0xBFC35A9C: 3129FFFF andi $t1, $t1, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[9] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x3129FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004DA9Cu); #endif @@ -687086,7 +688785,8 @@ label_BFC359B4: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC35AB8: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004DAB8u); #endif @@ -687747,7 +689447,8 @@ label_BFC35B88: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC35B94: 29C10280 slti $at, $t6, 640 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (640) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (640) ? 1 : 0); + PGXP_ALU(0x29C10280u, cpu->gpr[1], _pgx1, 0x0280u); } #ifdef PSX_COSIM cosim_instr(0x8004DB94u); #endif @@ -701700,7 +703401,8 @@ label_BFC36CF0: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC36D08: 00612024 and $a0, $v1, $at */ - cpu->gpr[4] = cpu->gpr[3] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[4] = cpu->gpr[3] & cpu->gpr[1]; + PGXP_ALU(0x00612024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004ED08u); #endif @@ -701821,7 +703523,8 @@ label_BFC36D1C: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC36D2C: 30630003 andi $v1, $v1, 0x3 */ - cpu->gpr[3] = cpu->gpr[3] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0x3u; + PGXP_ALU(0x30630003u, cpu->gpr[3], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x8004ED2Cu); #endif @@ -702871,7 +704574,8 @@ label_BFC36E54: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC36E5C: 33280008 andi $t0, $t9, 0x8 */ - cpu->gpr[8] = cpu->gpr[25] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x8u; + PGXP_ALU(0x33280008u, cpu->gpr[8], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x8004EE5Cu); #endif @@ -704736,7 +706440,8 @@ label_BFC370A0: psx_cyc_step(cpu, 0x140u); #endif /* 0xBFC370B4: 30C800FF andi $t0, $a2, 0xFF */ - cpu->gpr[8] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[8] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30C800FFu, cpu->gpr[8], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004F0B4u); #endif @@ -704744,7 +706449,8 @@ label_BFC370A0: psx_cyc_step(cpu, 0x88u); #endif /* 0xBFC370B8: 30E300FF andi $v1, $a3, 0xFF */ - cpu->gpr[3] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[3] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30E300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004F0B8u); #endif @@ -704761,7 +706467,8 @@ label_BFC370A0: psx_cyc_step(cpu, 0x220u); #endif /* 0xBFC370C0: 30A900FF andi $t1, $a1, 0xFF */ - cpu->gpr[9] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[9] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004F0C0u); #endif @@ -705390,7 +707097,8 @@ label_BFC3716C: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC3719C: 312AFFFF andi $t2, $t1, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x312AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004F19Cu); #endif @@ -706013,7 +707721,8 @@ label_BFC373AC: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC373C4: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004F3C4u); #endif @@ -706554,7 +708263,8 @@ label_BFC37458: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC37460: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004F460u); #endif @@ -707290,7 +709000,8 @@ label_BFC37518: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC37524: 304B0FFF andi $t3, $v0, 0xFFF */ - cpu->gpr[11] = cpu->gpr[2] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0xFFFu; + PGXP_ALU(0x304B0FFFu, cpu->gpr[11], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004F524u); #endif @@ -707298,7 +709009,8 @@ label_BFC37518: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC37528: 31F80FFF andi $t8, $t7, 0xFFF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFFu; + PGXP_ALU(0x31F80FFFu, cpu->gpr[24], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004F528u); #endif @@ -707373,7 +709085,8 @@ label_BFC37538: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC37540: 318D01FF andi $t5, $t4, 0x1FF */ - cpu->gpr[13] = cpu->gpr[12] & 0x1FFu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x1FFu; + PGXP_ALU(0x318D01FFu, cpu->gpr[13], _pgx1, 0x01FFu); } #ifdef PSX_COSIM cosim_instr(0x8004F540u); #endif @@ -707390,7 +709103,8 @@ label_BFC37538: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC37548: 31F803FF andi $t8, $t7, 0x3FF */ - cpu->gpr[24] = cpu->gpr[15] & 0x3FFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x3FFu; + PGXP_ALU(0x31F803FFu, cpu->gpr[24], _pgx1, 0x03FFu); } #ifdef PSX_COSIM cosim_instr(0x8004F548u); #endif @@ -707821,7 +709535,8 @@ label_BFC375D0: psx_cyc_step(cpu, 0x82u); #endif /* 0xBFC375D0: 28E101F4 slti $at, $a3, 500 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (500) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (500) ? 1 : 0); + PGXP_ALU(0x28E101F4u, cpu->gpr[1], _pgx1, 0x01F4u); } #ifdef PSX_COSIM cosim_instr(0x8004F5D0u); #endif @@ -707912,7 +709627,8 @@ label_BFC375E4: psx_cyc_step(cpu, 0x82u); #endif /* 0xBFC375E4: 28E10CDB slti $at, $a3, 3291 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (3291) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (3291) ? 1 : 0); + PGXP_ALU(0x28E10CDBu, cpu->gpr[1], _pgx1, 0x0CDBu); } #ifdef PSX_COSIM cosim_instr(0x8004F5E4u); #endif @@ -708047,7 +709763,8 @@ label_BFC37600: psx_cyc_step(cpu, 0x206u); #endif /* 0xBFC37604: 0122082A slt $at, $t1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0122082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004F604u); #endif @@ -708062,7 +709779,8 @@ label_BFC37600: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC3760C: 29210CDB slti $at, $t1, 3291 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (3291) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (3291) ? 1 : 0); + PGXP_ALU(0x29210CDBu, cpu->gpr[1], _pgx1, 0x0CDBu); } #ifdef PSX_COSIM cosim_instr(0x8004F60Cu); #endif @@ -708134,7 +709852,8 @@ label_BFC37618: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC37618: 29210CDB slti $at, $t1, 3291 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (3291) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (3291) ? 1 : 0); + PGXP_ALU(0x29210CDBu, cpu->gpr[1], _pgx1, 0x0CDBu); } #ifdef PSX_COSIM cosim_instr(0x8004F618u); #endif @@ -708280,7 +709999,8 @@ label_BFC37634: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC37638: 28C10138 slti $at, $a2, 312 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (312) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (312) ? 1 : 0); + PGXP_ALU(0x28C10138u, cpu->gpr[1], _pgx1, 0x0138u); } #ifdef PSX_COSIM cosim_instr(0x8004F638u); #endif @@ -708355,7 +710075,8 @@ label_BFC37644: psx_cyc_step(cpu, 0x42u); #endif /* 0xBFC37644: 28C10138 slti $at, $a2, 312 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (312) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (312) ? 1 : 0); + PGXP_ALU(0x28C10138u, cpu->gpr[1], _pgx1, 0x0138u); } #ifdef PSX_COSIM cosim_instr(0x8004F644u); #endif @@ -708491,7 +710212,8 @@ label_BFC37660: psx_cyc_step(cpu, 0x142u); #endif /* 0xBFC37660: 0106082A slt $at, $t0, $a2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x0106082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004F660u); #endif @@ -708506,7 +710228,8 @@ label_BFC37660: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC37668: 29010138 slti $at, $t0, 312 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (312) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (312) ? 1 : 0); + PGXP_ALU(0x29010138u, cpu->gpr[1], _pgx1, 0x0138u); } #ifdef PSX_COSIM cosim_instr(0x8004F668u); #endif @@ -708581,7 +710304,8 @@ label_BFC37674: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC37674: 29010138 slti $at, $t0, 312 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (312) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (312) ? 1 : 0); + PGXP_ALU(0x29010138u, cpu->gpr[1], _pgx1, 0x0138u); } #ifdef PSX_COSIM cosim_instr(0x8004F674u); #endif @@ -708732,7 +710456,8 @@ label_BFC37690: psx_cyc_step(cpu, 0x2200u); #endif /* 0xBFC37698: 312D0FFF andi $t5, $t1, 0xFFF */ - cpu->gpr[13] = cpu->gpr[9] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[13] = cpu->gpr[9] & 0xFFFu; + PGXP_ALU(0x312D0FFFu, cpu->gpr[13], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004F698u); #endif @@ -708815,7 +710540,8 @@ label_BFC37690: psx_cyc_step(cpu, 0x1000080u); #endif /* 0xBFC376BC: 30F80FFF andi $t8, $a3, 0xFFF */ - cpu->gpr[24] = cpu->gpr[7] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[24] = cpu->gpr[7] & 0xFFFu; + PGXP_ALU(0x30F80FFFu, cpu->gpr[24], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004F6BCu); #endif @@ -708891,7 +710617,8 @@ label_BFC376C8: psx_cyc_step(cpu, 0x1100u); #endif /* 0xBFC376D8: 310C03FF andi $t4, $t0, 0x3FF */ - cpu->gpr[12] = cpu->gpr[8] & 0x3FFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[12] = cpu->gpr[8] & 0x3FFu; + PGXP_ALU(0x310C03FFu, cpu->gpr[12], _pgx1, 0x03FFu); } #ifdef PSX_COSIM cosim_instr(0x8004F6D8u); #endif @@ -708950,7 +710677,8 @@ label_BFC376C8: psx_cyc_step(cpu, 0x4040u); #endif /* 0xBFC376F4: 30CE03FF andi $t6, $a2, 0x3FF */ - cpu->gpr[14] = cpu->gpr[6] & 0x3FFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[14] = cpu->gpr[6] & 0x3FFu; + PGXP_ALU(0x30CE03FFu, cpu->gpr[14], _pgx1, 0x03FFu); } #ifdef PSX_COSIM cosim_instr(0x8004F6F4u); #endif @@ -709335,7 +711063,8 @@ label_BFC37760: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC37768: 28410119 slti $at, $v0, 281 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (281) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (281) ? 1 : 0); + PGXP_ALU(0x28410119u, cpu->gpr[1], _pgx1, 0x0119u); } #ifdef PSX_COSIM cosim_instr(0x8004F768u); #endif @@ -709353,7 +711082,8 @@ label_BFC37760: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC37770: 28410161 slti $at, $v0, 353 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (353) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (353) ? 1 : 0); + PGXP_ALU(0x28410161u, cpu->gpr[1], _pgx1, 0x0161u); } #ifdef PSX_COSIM cosim_instr(0x8004F770u); #endif @@ -709424,7 +711154,8 @@ label_BFC3777C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3777C: 28410161 slti $at, $v0, 353 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (353) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (353) ? 1 : 0); + PGXP_ALU(0x28410161u, cpu->gpr[1], _pgx1, 0x0161u); } #ifdef PSX_COSIM cosim_instr(0x8004F77Cu); #endif @@ -709449,7 +711180,8 @@ label_BFC37780: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC37784: 28410191 slti $at, $v0, 401 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (401) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (401) ? 1 : 0); + PGXP_ALU(0x28410191u, cpu->gpr[1], _pgx1, 0x0191u); } #ifdef PSX_COSIM cosim_instr(0x8004F784u); #endif @@ -709521,7 +711253,8 @@ label_BFC37790: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC37790: 28410191 slti $at, $v0, 401 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (401) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (401) ? 1 : 0); + PGXP_ALU(0x28410191u, cpu->gpr[1], _pgx1, 0x0191u); } #ifdef PSX_COSIM cosim_instr(0x8004F790u); #endif @@ -709546,7 +711279,8 @@ label_BFC37794: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC37798: 28410231 slti $at, $v0, 561 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (561) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (561) ? 1 : 0); + PGXP_ALU(0x28410231u, cpu->gpr[1], _pgx1, 0x0231u); } #ifdef PSX_COSIM cosim_instr(0x8004F798u); #endif @@ -709621,7 +711355,8 @@ label_BFC377A4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC377A4: 28410231 slti $at, $v0, 561 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (561) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (561) ? 1 : 0); + PGXP_ALU(0x28410231u, cpu->gpr[1], _pgx1, 0x0231u); } #ifdef PSX_COSIM cosim_instr(0x8004F7A4u); #endif @@ -709853,7 +711588,8 @@ label_BFC377D0: psx_cyc_step(cpu, 0x800Au); #endif /* 0xBFC377D8: 006F082A slt $at, $v1, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x006F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004F7D8u); #endif @@ -710443,7 +712179,8 @@ label_BFC37888: psx_cyc_step(cpu, 0x1000006u); #endif /* 0xBFC3788C: 0041C024 and $t8, $v0, $at */ - cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x0041C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004F88Cu); #endif @@ -710675,7 +712412,8 @@ label_BFC378B4: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC378CC: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004F8CCu); #endif @@ -710920,7 +712658,8 @@ label_BFC37908: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC37920: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004F920u); #endif @@ -711298,7 +713037,8 @@ label_BFC37998: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC379B0: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004F9B0u); #endif @@ -711555,7 +713295,8 @@ label_BFC37A4C: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC37A64: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004FA64u); #endif @@ -711632,7 +713373,8 @@ label_BFC37A4C: psx_cyc_step(cpu, 0xC0u); #endif /* 0xBFC37A84: 30E6FFFF andi $a2, $a3, 0xFFFF */ - cpu->gpr[6] = cpu->gpr[7] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[6] = cpu->gpr[7] & 0xFFFFu; + PGXP_ALU(0x30E6FFFFu, cpu->gpr[6], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004FA84u); #endif @@ -712703,7 +714445,8 @@ label_BFC37BEC: psx_cyc_step(cpu, 0x1000002u); #endif /* 0xBFC37BF0: 2B010400 slti $at, $t8, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (1024) ? 1 : 0); + PGXP_ALU(0x2B010400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8004FBF0u); #endif @@ -713082,7 +714825,8 @@ label_BFC37C48: psx_cyc_step(cpu, 0x106u); #endif /* 0xBFC37C50: 0048082A slt $at, $v0, $t0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0048082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004FC50u); #endif @@ -713328,7 +715072,8 @@ label_BFC37C84: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC37C8C: 312A003F andi $t2, $t1, 0x3F */ - cpu->gpr[10] = cpu->gpr[9] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x3Fu; + PGXP_ALU(0x312A003Fu, cpu->gpr[10], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x8004FC8Cu); #endif @@ -713393,7 +715138,8 @@ label_BFC37C98: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC37CA0: 316C003F andi $t4, $t3, 0x3F */ - cpu->gpr[12] = cpu->gpr[11] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x3Fu; + PGXP_ALU(0x316C003Fu, cpu->gpr[12], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x8004FCA0u); #endif @@ -713983,7 +715729,8 @@ label_BFC37D90: psx_cyc_step(cpu, 0x28000u); #endif /* 0xBFC37D94: 322F00FF andi $t7, $s1, 0xFF */ - cpu->gpr[15] = cpu->gpr[17] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[15] = cpu->gpr[17] & 0xFFu; + PGXP_ALU(0x322F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8004FD94u); #endif @@ -714012,7 +715759,8 @@ label_BFC37D90: psx_cyc_step(cpu, 0x3000100u); #endif /* 0xBFC37DA0: 0308C826 xor $t9, $t8, $t0 */ - cpu->gpr[25] = cpu->gpr[24] ^ cpu->gpr[8]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[25] = cpu->gpr[24] ^ cpu->gpr[8]; + PGXP_ALU(0x0308C826u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004FDA0u); #endif @@ -714029,7 +715777,8 @@ label_BFC37D90: psx_cyc_step(cpu, 0x604u); #endif /* 0xBFC37DA8: 01225026 xor $t2, $t1, $v0 */ - cpu->gpr[10] = cpu->gpr[9] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[9] ^ cpu->gpr[2]; + PGXP_ALU(0x01225026u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004FDA8u); #endif @@ -714175,7 +715924,8 @@ label_BFC37DC8: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC37DD0: 30C6FFFF andi $a2, $a2, 0xFFFF */ - cpu->gpr[6] = cpu->gpr[6] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0xFFFFu; + PGXP_ALU(0x30C6FFFFu, cpu->gpr[6], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8004FDD0u); #endif @@ -714453,7 +716203,8 @@ label_BFC37E04: psx_cyc_step(cpu, 0x2000040u); #endif /* 0xBFC37E10: 30D927FF andi $t9, $a2, 0x27FF */ - cpu->gpr[25] = cpu->gpr[6] & 0x27FFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[25] = cpu->gpr[6] & 0x27FFu; + PGXP_ALU(0x30D927FFu, cpu->gpr[25], _pgx1, 0x27FFu); } #ifdef PSX_COSIM cosim_instr(0x8004FE10u); #endif @@ -714724,7 +716475,8 @@ label_BFC37E44: psx_cyc_step(cpu, 0x440u); #endif /* 0xBFC37E50: 30CA01FF andi $t2, $a2, 0x1FF */ - cpu->gpr[10] = cpu->gpr[6] & 0x1FFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[10] = cpu->gpr[6] & 0x1FFu; + PGXP_ALU(0x30CA01FFu, cpu->gpr[10], _pgx1, 0x01FFu); } #ifdef PSX_COSIM cosim_instr(0x8004FE50u); #endif @@ -714945,7 +716697,8 @@ label_BFC37E7C: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC37E7C: 28810400 slti $at, $a0, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + PGXP_ALU(0x28810400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8004FE7Cu); #endif @@ -715308,7 +717061,8 @@ label_BFC37ED4: psx_cyc_step(cpu, 0x2Au); #endif /* 0xBFC37ED4: 0065082A slt $at, $v1, $a1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0065082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004FED4u); #endif @@ -715549,7 +717303,8 @@ label_BFC37F08: psx_cyc_step(cpu, 0x120u); #endif /* 0xBFC37F0C: 30A803FF andi $t0, $a1, 0x3FF */ - cpu->gpr[8] = cpu->gpr[5] & 0x3FFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[8] = cpu->gpr[5] & 0x3FFu; + PGXP_ALU(0x30A803FFu, cpu->gpr[8], _pgx1, 0x03FFu); } #ifdef PSX_COSIM cosim_instr(0x8004FF0Cu); #endif @@ -715581,7 +717336,8 @@ label_BFC37F10: psx_cyc_step(cpu, 0x4020u); #endif /* 0xBFC37F10: 30AE0FFF andi $t6, $a1, 0xFFF */ - cpu->gpr[14] = cpu->gpr[5] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[14] = cpu->gpr[5] & 0xFFFu; + PGXP_ALU(0x30AE0FFFu, cpu->gpr[14], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004FF10u); #endif @@ -715619,7 +717375,8 @@ label_BFC37F10: psx_cyc_step(cpu, 0x2000010u); #endif /* 0xBFC37F20: 30990FFF andi $t9, $a0, 0xFFF */ - cpu->gpr[25] = cpu->gpr[4] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[4] & 0xFFFu; + PGXP_ALU(0x30990FFFu, cpu->gpr[25], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004FF20u); #endif @@ -715686,7 +717443,8 @@ label_BFC37F30: psx_cyc_step(cpu, 0x810u); #endif /* 0xBFC37F3C: 308B03FF andi $t3, $a0, 0x3FF */ - cpu->gpr[11] = cpu->gpr[4] & 0x3FFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[11] = cpu->gpr[4] & 0x3FFu; + PGXP_ALU(0x308B03FFu, cpu->gpr[11], _pgx1, 0x03FFu); } #ifdef PSX_COSIM cosim_instr(0x8004FF3Cu); #endif @@ -715910,7 +717668,8 @@ label_BFC37F68: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC37F68: 28810400 slti $at, $a0, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (1024) ? 1 : 0); + PGXP_ALU(0x28810400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8004FF68u); #endif @@ -716267,7 +718026,8 @@ label_BFC37FC0: psx_cyc_step(cpu, 0x2Au); #endif /* 0xBFC37FC0: 0065082A slt $at, $v1, $a1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0065082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8004FFC0u); #endif @@ -716514,7 +718274,8 @@ label_BFC37FF4: psx_cyc_step(cpu, 0x120u); #endif /* 0xBFC37FF8: 30A801FF andi $t0, $a1, 0x1FF */ - cpu->gpr[8] = cpu->gpr[5] & 0x1FFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[8] = cpu->gpr[5] & 0x1FFu; + PGXP_ALU(0x30A801FFu, cpu->gpr[8], _pgx1, 0x01FFu); } #ifdef PSX_COSIM cosim_instr(0x8004FFF8u); #endif @@ -716546,7 +718307,8 @@ label_BFC37FFC: psx_cyc_step(cpu, 0x4020u); #endif /* 0xBFC37FFC: 30AE0FFF andi $t6, $a1, 0xFFF */ - cpu->gpr[14] = cpu->gpr[5] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[14] = cpu->gpr[5] & 0xFFFu; + PGXP_ALU(0x30AE0FFFu, cpu->gpr[14], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8004FFFCu); #endif @@ -716584,7 +718346,8 @@ label_BFC37FFC: psx_cyc_step(cpu, 0x2000010u); #endif /* 0xBFC3800C: 30990FFF andi $t9, $a0, 0xFFF */ - cpu->gpr[25] = cpu->gpr[4] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[4] & 0xFFFu; + PGXP_ALU(0x30990FFFu, cpu->gpr[25], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x8005000Cu); #endif @@ -716657,7 +718420,8 @@ label_BFC3801C: psx_cyc_step(cpu, 0x810u); #endif /* 0xBFC38028: 308B03FF andi $t3, $a0, 0x3FF */ - cpu->gpr[11] = cpu->gpr[4] & 0x3FFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[11] = cpu->gpr[4] & 0x3FFu; + PGXP_ALU(0x308B03FFu, cpu->gpr[11], _pgx1, 0x03FFu); } #ifdef PSX_COSIM cosim_instr(0x80050028u); #endif @@ -716817,7 +718581,8 @@ label_BFC38054: psx_cyc_step(cpu, 0x8020u); #endif /* 0xBFC38054: 30AF0FFF andi $t7, $a1, 0xFFF */ - cpu->gpr[15] = cpu->gpr[5] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[15] = cpu->gpr[5] & 0xFFFu; + PGXP_ALU(0x30AF0FFFu, cpu->gpr[15], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x80050054u); #endif @@ -716855,7 +718620,8 @@ label_BFC38054: psx_cyc_step(cpu, 0x110u); #endif /* 0xBFC38064: 30880FFF andi $t0, $a0, 0xFFF */ - cpu->gpr[8] = cpu->gpr[4] & 0xFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[8] = cpu->gpr[4] & 0xFFFu; + PGXP_ALU(0x30880FFFu, cpu->gpr[8], _pgx1, 0x0FFFu); } #ifdef PSX_COSIM cosim_instr(0x80050064u); #endif @@ -716895,7 +718661,8 @@ label_BFC38070: psx_cyc_step(cpu, 0x220u); #endif /* 0xBFC38070: 30A907FF andi $t1, $a1, 0x7FF */ - cpu->gpr[9] = cpu->gpr[5] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[9] = cpu->gpr[5] & 0x7FFu; + PGXP_ALU(0x30A907FFu, cpu->gpr[9], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80050070u); #endif @@ -716933,7 +718700,8 @@ label_BFC38070: psx_cyc_step(cpu, 0x1010u); #endif /* 0xBFC38080: 308C07FF andi $t4, $a0, 0x7FF */ - cpu->gpr[12] = cpu->gpr[4] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[12] = cpu->gpr[4] & 0x7FFu; + PGXP_ALU(0x308C07FFu, cpu->gpr[12], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80050080u); #endif @@ -717069,7 +718837,8 @@ label_BFC38098: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC380A8: 30C600FF andi $a2, $a2, 0xFF */ - cpu->gpr[6] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30C600FFu, cpu->gpr[6], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800500A8u); #endif @@ -717098,7 +718867,8 @@ label_BFC38098: psx_cyc_step(cpu, 0x81u); #endif /* 0xBFC380B4: 00E03827 nor $a3, $a3, $zero */ - cpu->gpr[7] = ~(cpu->gpr[7] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[7] = ~(cpu->gpr[7] | cpu->gpr[0]); + PGXP_ALU(0x00E03827u, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800500B4u); #endif @@ -717106,7 +718876,8 @@ label_BFC38098: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC380B8: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800500B8u); #endif @@ -717126,7 +718897,8 @@ label_BFC38098: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC380C0: 30E700FF andi $a3, $a3, 0xFF */ - cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0xFFu; + PGXP_ALU(0x30E700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800500C0u); #endif @@ -717164,7 +718936,8 @@ label_BFC38098: psx_cyc_step(cpu, 0x21u); #endif /* 0xBFC380D0: 00A02827 nor $a1, $a1, $zero */ - cpu->gpr[5] = ~(cpu->gpr[5] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[5] = ~(cpu->gpr[5] | cpu->gpr[0]); + PGXP_ALU(0x00A02827u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800500D0u); #endif @@ -717202,7 +718975,8 @@ label_BFC38098: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC380E0: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800500E0u); #endif @@ -718513,7 +720287,8 @@ label_BFC38270: psx_cyc_step(cpu, 0x16000u); #endif /* 0xBFC38284: 01B07024 and $t6, $t5, $s0 */ - cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[16]; + PGXP_ALU(0x01B07024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050284u); #endif @@ -718710,7 +720485,8 @@ label_BFC382A8: psx_cyc_step(cpu, 0x3010000u); #endif /* 0xBFC382BC: 0310C824 and $t9, $t8, $s0 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[16]; + PGXP_ALU(0x0310C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800502BCu); #endif @@ -719139,7 +720915,8 @@ label_BFC3832C: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC38330: 29210400 slti $at, $t1, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (1024) ? 1 : 0); + PGXP_ALU(0x29210400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x80050330u); #endif @@ -719518,7 +721295,8 @@ label_BFC38388: psx_cyc_step(cpu, 0x806u); #endif /* 0xBFC38390: 004B082A slt $at, $v0, $t3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x004B082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050390u); #endif @@ -719764,7 +721542,8 @@ label_BFC383C4: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC383CC: 318D003F andi $t5, $t4, 0x3F */ - cpu->gpr[13] = cpu->gpr[12] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x3Fu; + PGXP_ALU(0x318D003Fu, cpu->gpr[13], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x800503CCu); #endif @@ -719832,7 +721611,8 @@ label_BFC383D8: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC383E0: 31CF003F andi $t7, $t6, 0x3F */ - cpu->gpr[15] = cpu->gpr[14] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x3Fu; + PGXP_ALU(0x31CF003Fu, cpu->gpr[15], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x800503E0u); #endif @@ -719926,7 +721706,8 @@ label_BFC383F0: psx_cyc_step(cpu, 0x3000004u); #endif /* 0xBFC383FC: 0302C824 and $t9, $t8, $v0 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[2]; + PGXP_ALU(0x0302C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800503FCu); #endif @@ -720093,7 +721874,8 @@ label_BFC383F0: psx_cyc_step(cpu, 0x2024u); #endif /* 0xBFC38440: 00A26824 and $t5, $a1, $v0 */ - cpu->gpr[13] = cpu->gpr[5] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[13] = cpu->gpr[5] & cpu->gpr[2]; + PGXP_ALU(0x00A26824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050440u); #endif @@ -720562,7 +722344,8 @@ label_BFC384C4: psx_cyc_step(cpu, 0x2024u); #endif /* 0xBFC384E4: 00A26824 and $t5, $a1, $v0 */ - cpu->gpr[13] = cpu->gpr[5] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[13] = cpu->gpr[5] & cpu->gpr[2]; + PGXP_ALU(0x00A26824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800504E4u); #endif @@ -721106,7 +722889,8 @@ label_BFC38578: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC3857C: 29210400 slti $at, $t1, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (1024) ? 1 : 0); + PGXP_ALU(0x29210400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x8005057Cu); #endif @@ -721485,7 +723269,8 @@ label_BFC385D4: psx_cyc_step(cpu, 0x806u); #endif /* 0xBFC385DC: 004B082A slt $at, $v0, $t3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x004B082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800505DCu); #endif @@ -721734,7 +723519,8 @@ label_BFC38610: psx_cyc_step(cpu, 0x1002u); #endif /* 0xBFC38618: 29810400 slti $at, $t4, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (1024) ? 1 : 0); + PGXP_ALU(0x29810400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x80050618u); #endif @@ -722090,7 +723876,8 @@ label_BFC38670: psx_cyc_step(cpu, 0x11800u); #endif /* 0xBFC38684: 01706024 and $t4, $t3, $s0 */ - cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[16]; + PGXP_ALU(0x01706024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050684u); #endif @@ -722249,7 +724036,8 @@ label_BFC386A0: psx_cyc_step(cpu, 0x1C000u); #endif /* 0xBFC386B4: 01D07824 and $t7, $t6, $s0 */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[16]; + PGXP_ALU(0x01D07824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800506B4u); #endif @@ -722538,7 +724326,8 @@ label_BFC386F4: psx_cyc_step(cpu, 0x50u); #endif /* 0xBFC38714: 30C4000F andi $a0, $a2, 0xF */ - cpu->gpr[4] = cpu->gpr[6] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[4] = cpu->gpr[6] & 0xFu; + PGXP_ALU(0x30C4000Fu, cpu->gpr[4], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80050714u); #endif @@ -723479,7 +725268,8 @@ label_BFC38824: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC38828: 29210400 slti $at, $t1, 1024 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (1024) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (1024) ? 1 : 0); + PGXP_ALU(0x29210400u, cpu->gpr[1], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x80050828u); #endif @@ -723855,7 +725645,8 @@ label_BFC38880: psx_cyc_step(cpu, 0x806u); #endif /* 0xBFC38888: 004B082A slt $at, $v0, $t3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x004B082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050888u); #endif @@ -724341,7 +726132,8 @@ label_BFC388F4: psx_cyc_step(cpu, 0x1C000u); #endif /* 0xBFC38908: 01D07824 and $t7, $t6, $s0 */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[16]; + PGXP_ALU(0x01D07824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050908u); #endif @@ -724594,7 +726386,8 @@ label_BFC38940: psx_cyc_step(cpu, 0x3010000u); #endif /* 0xBFC38954: 0310C824 and $t9, $t8, $s0 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[16]; + PGXP_ALU(0x0310C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050954u); #endif @@ -724787,7 +726580,8 @@ label_BFC38968: psx_cyc_step(cpu, 0x3004u); #endif /* 0xBFC389A0: 01826824 and $t5, $t4, $v0 */ - cpu->gpr[13] = cpu->gpr[12] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[13] = cpu->gpr[12] & cpu->gpr[2]; + PGXP_ALU(0x01826824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800509A0u); #endif @@ -724851,7 +726645,8 @@ label_BFC389AC: psx_cyc_step(cpu, 0xC004u); #endif /* 0xBFC389B4: 01C27824 and $t7, $t6, $v0 */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[2]; + PGXP_ALU(0x01C27824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800509B4u); #endif @@ -724905,7 +726700,8 @@ label_BFC389C0: psx_cyc_step(cpu, 0x90u); #endif /* 0xBFC389C4: 30E4000F andi $a0, $a3, 0xF */ - cpu->gpr[4] = cpu->gpr[7] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[4] = cpu->gpr[7] & 0xFu; + PGXP_ALU(0x30E4000Fu, cpu->gpr[4], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x800509C4u); #endif @@ -725684,7 +727480,8 @@ label_BFC38AA4: psx_cyc_step(cpu, 0x8012u); #endif /* 0xBFC38AB4: 00817824 and $t7, $a0, $at */ - cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00817824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050AB4u); #endif @@ -726396,7 +728193,8 @@ label_BFC38B80: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC38BAC: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050BACu); #endif @@ -726916,7 +728714,8 @@ label_BFC38C68: psx_cyc_step(cpu, 0x10000u); #endif /* 0xBFC38C90: 3210003F andi $s0, $s0, 0x3F */ - cpu->gpr[16] = cpu->gpr[16] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[16] = cpu->gpr[16] & 0x3Fu; + PGXP_ALU(0x3210003Fu, cpu->gpr[16], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80050C90u); #endif @@ -727538,7 +729337,8 @@ label_BFC38CD8: psx_cyc_step(cpu, 0xA02u); #endif /* 0xBFC38D6C: 01215824 and $t3, $t1, $at */ - cpu->gpr[11] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[11] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01215824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050D6Cu); #endif @@ -727671,7 +729471,8 @@ label_BFC38D80: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC38D98: 3042003F andi $v0, $v0, 0x3F */ - cpu->gpr[2] = cpu->gpr[2] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x3Fu; + PGXP_ALU(0x3042003Fu, cpu->gpr[2], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80050D98u); #endif @@ -728100,7 +729901,8 @@ label_BFC38DFC: psx_cyc_step(cpu, 0x2040100u); #endif /* 0xBFC38E10: 03324024 and $t0, $t9, $s2 */ - cpu->gpr[8] = cpu->gpr[25] & cpu->gpr[18]; + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[8] = cpu->gpr[25] & cpu->gpr[18]; + PGXP_ALU(0x03324024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050E10u); #endif @@ -728350,7 +730152,8 @@ label_BFC38E48: psx_cyc_step(cpu, 0x13000u); #endif /* 0xBFC38E5C: 01906824 and $t5, $t4, $s0 */ - cpu->gpr[13] = cpu->gpr[12] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[13] = cpu->gpr[12] & cpu->gpr[16]; + PGXP_ALU(0x01906824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050E5Cu); #endif @@ -728512,7 +730315,8 @@ label_BFC38E78: psx_cyc_step(cpu, 0x1018000u); #endif /* 0xBFC38E8C: 01F0C024 and $t8, $t7, $s0 */ - cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[16]; + PGXP_ALU(0x01F0C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80050E8Cu); #endif @@ -728921,7 +730725,8 @@ label_BFC38F20: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC38F30: 312A003F andi $t2, $t1, 0x3F */ - cpu->gpr[10] = cpu->gpr[9] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x3Fu; + PGXP_ALU(0x312A003Fu, cpu->gpr[10], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80050F30u); #endif @@ -729811,7 +731616,8 @@ label_BFC39034: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC39048: 31AE3FFF andi $t6, $t5, 0x3FFF */ - cpu->gpr[14] = cpu->gpr[13] & 0x3FFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x3FFFu; + PGXP_ALU(0x31AE3FFFu, cpu->gpr[14], _pgx1, 0x3FFFu); } #ifdef PSX_COSIM cosim_instr(0x80051048u); #endif @@ -729862,7 +731668,8 @@ label_BFC39034: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC39060: 33191000 andi $t9, $t8, 0x1000 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1000u; + PGXP_ALU(0x33191000u, cpu->gpr[25], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80051060u); #endif @@ -730557,7 +732364,8 @@ label_BFC390F0: psx_cyc_step(cpu, 0x2010100u); #endif /* 0xBFC39104: 03304024 and $t0, $t9, $s0 */ - cpu->gpr[8] = cpu->gpr[25] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[8] = cpu->gpr[25] & cpu->gpr[16]; + PGXP_ALU(0x03304024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051104u); #endif @@ -730924,7 +732732,8 @@ label_BFC39160: psx_cyc_step(cpu, 0x21800u); #endif /* 0xBFC39174: 01716024 and $t4, $t3, $s1 */ - cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[17]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[12] = cpu->gpr[11] & cpu->gpr[17]; + PGXP_ALU(0x01716024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051174u); #endif @@ -730985,7 +732794,8 @@ label_BFC39180: psx_cyc_step(cpu, 0x46000u); #endif /* 0xBFC39188: 01B27024 and $t6, $t5, $s2 */ - cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[18]; + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[18]; + PGXP_ALU(0x01B27024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051188u); #endif @@ -731118,7 +732928,8 @@ label_BFC3919C: psx_cyc_step(cpu, 0x3010000u); #endif /* 0xBFC391B0: 0310C824 and $t9, $t8, $s0 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[16]; + PGXP_ALU(0x0310C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800511B0u); #endif @@ -731234,7 +733045,8 @@ label_BFC391C8: psx_cyc_step(cpu, 0x10300u); #endif /* 0xBFC391D0: 01104824 and $t1, $t0, $s0 */ - cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[16]; + PGXP_ALU(0x01104824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800511D0u); #endif @@ -731457,7 +733269,8 @@ label_BFC39200: psx_cyc_step(cpu, 0x10C00u); #endif /* 0xBFC39214: 01505824 and $t3, $t2, $s0 */ - cpu->gpr[11] = cpu->gpr[10] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[11] = cpu->gpr[10] & cpu->gpr[16]; + PGXP_ALU(0x01505824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051214u); #endif @@ -731684,7 +733497,8 @@ label_BFC39244: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC39260: 3042003F andi $v0, $v0, 0x3F */ - cpu->gpr[2] = cpu->gpr[2] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x3Fu; + PGXP_ALU(0x3042003Fu, cpu->gpr[2], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80051260u); #endif @@ -731758,7 +733572,8 @@ label_BFC39264: psx_cyc_step(cpu, 0x3040000u); #endif /* 0xBFC39278: 0312C824 and $t9, $t8, $s2 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[18]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[18]; + PGXP_ALU(0x0312C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051278u); #endif @@ -731878,7 +733693,8 @@ label_BFC39290: psx_cyc_step(cpu, 0x10300u); #endif /* 0xBFC3929C: 01104824 and $t1, $t0, $s0 */ - cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[9] = cpu->gpr[8] & cpu->gpr[16]; + PGXP_ALU(0x01104824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005129Cu); #endif @@ -732304,7 +734120,8 @@ label_BFC39300: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC39314: 01CF082A slt $at, $t6, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x01CF082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051314u); #endif @@ -732393,7 +734210,8 @@ label_BFC39320: psx_cyc_step(cpu, 0x2000006u); #endif /* 0xBFC39334: 0041C824 and $t9, $v0, $at */ - cpu->gpr[25] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[25] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x0041C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051334u); #endif @@ -732544,7 +734362,8 @@ label_BFC3934C: psx_cyc_step(cpu, 0x602u); #endif /* 0xBFC39360: 01215024 and $t2, $t1, $at */ - cpu->gpr[10] = cpu->gpr[9] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[10] = cpu->gpr[9] & cpu->gpr[1]; + PGXP_ALU(0x01215024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051360u); #endif @@ -735002,7 +736821,8 @@ label_BFC3964C: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC39660: 308E0003 andi $t6, $a0, 0x3 */ - cpu->gpr[14] = cpu->gpr[4] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0x3u; + PGXP_ALU(0x308E0003u, cpu->gpr[14], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051660u); #endif @@ -735034,7 +736854,8 @@ label_BFC39664: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC39664: 308E0003 andi $t6, $a0, 0x3 */ - cpu->gpr[14] = cpu->gpr[4] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0x3u; + PGXP_ALU(0x308E0003u, cpu->gpr[14], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051664u); #endif @@ -735042,7 +736863,8 @@ label_BFC39664: psx_cyc_step(cpu, 0x1000020u); #endif /* 0xBFC39668: 30B80003 andi $t8, $a1, 0x3 */ - cpu->gpr[24] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[24] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30B80003u, cpu->gpr[24], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051668u); #endif @@ -735071,7 +736893,8 @@ label_BFC39664: psx_cyc_step(cpu, 0x240u); #endif /* 0xBFC39674: 30C90300 andi $t1, $a2, 0x300 */ - cpu->gpr[9] = cpu->gpr[6] & 0x300u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[9] = cpu->gpr[6] & 0x300u; + PGXP_ALU(0x30C90300u, cpu->gpr[9], _pgx1, 0x0300u); } #ifdef PSX_COSIM cosim_instr(0x80051674u); #endif @@ -735100,7 +736923,8 @@ label_BFC39664: psx_cyc_step(cpu, 0x1080u); #endif /* 0xBFC39680: 30EC03FF andi $t4, $a3, 0x3FF */ - cpu->gpr[12] = cpu->gpr[7] & 0x3FFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[12] = cpu->gpr[7] & 0x3FFu; + PGXP_ALU(0x30EC03FFu, cpu->gpr[12], _pgx1, 0x03FFu); } #ifdef PSX_COSIM cosim_instr(0x80051680u); #endif @@ -735169,7 +736993,8 @@ label_BFC39694: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC39694: 308E0003 andi $t6, $a0, 0x3 */ - cpu->gpr[14] = cpu->gpr[4] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0x3u; + PGXP_ALU(0x308E0003u, cpu->gpr[14], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051694u); #endif @@ -735187,7 +737012,8 @@ label_BFC39698: psx_cyc_step(cpu, 0x8020u); #endif /* 0xBFC39698: 30AF0003 andi $t7, $a1, 0x3 */ - cpu->gpr[15] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[15] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30AF0003u, cpu->gpr[15], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051698u); #endif @@ -735216,7 +737042,8 @@ label_BFC39698: psx_cyc_step(cpu, 0x140u); #endif /* 0xBFC396A4: 30C80100 andi $t0, $a2, 0x100 */ - cpu->gpr[8] = cpu->gpr[6] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[8] = cpu->gpr[6] & 0x100u; + PGXP_ALU(0x30C80100u, cpu->gpr[8], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x800516A4u); #endif @@ -735245,7 +737072,8 @@ label_BFC39698: psx_cyc_step(cpu, 0x880u); #endif /* 0xBFC396B0: 30EB03FF andi $t3, $a3, 0x3FF */ - cpu->gpr[11] = cpu->gpr[7] & 0x3FFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[11] = cpu->gpr[7] & 0x3FFu; + PGXP_ALU(0x30EB03FFu, cpu->gpr[11], _pgx1, 0x03FFu); } #ifdef PSX_COSIM cosim_instr(0x800516B0u); #endif @@ -735310,7 +737138,8 @@ label_BFC396C0: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC396CC: 3062FFFF andi $v0, $v1, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[3] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[2] = cpu->gpr[3] & 0xFFFFu; + PGXP_ALU(0x3062FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800516CCu); #endif @@ -735354,7 +737183,8 @@ label_BFC396D0: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC396D4: 31F8003F andi $t8, $t7, 0x3F */ - cpu->gpr[24] = cpu->gpr[15] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x3Fu; + PGXP_ALU(0x31F8003Fu, cpu->gpr[24], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x800516D4u); #endif @@ -735388,7 +737218,8 @@ label_BFC396D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC396E4: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800516E4u); #endif @@ -735464,7 +737295,8 @@ label_BFC396E8: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC396F0: 3083FFFF andi $v1, $a0, 0xFFFF */ - cpu->gpr[3] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3083FFFFu, cpu->gpr[3], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800516F0u); #endif @@ -735581,7 +737413,8 @@ label_BFC39708: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC39714: 31CF0300 andi $t7, $t6, 0x300 */ - cpu->gpr[15] = cpu->gpr[14] & 0x300u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x300u; + PGXP_ALU(0x31CF0300u, cpu->gpr[15], _pgx1, 0x0300u); } #ifdef PSX_COSIM cosim_instr(0x80051714u); #endif @@ -735628,7 +737461,8 @@ label_BFC39708: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC39728: 30E707C0 andi $a3, $a3, 0x7C0 */ - cpu->gpr[7] = cpu->gpr[7] & 0x7C0u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x7C0u; + PGXP_ALU(0x30E707C0u, cpu->gpr[7], _pgx1, 0x07C0u); } #ifdef PSX_COSIM cosim_instr(0x80051728u); #endif @@ -735636,7 +737470,8 @@ label_BFC39708: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC3972C: 30C60003 andi $a2, $a2, 0x3 */ - cpu->gpr[6] = cpu->gpr[6] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x3u; + PGXP_ALU(0x30C60003u, cpu->gpr[6], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x8005172Cu); #endif @@ -735647,7 +737482,8 @@ label_BFC39708: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC39730: 30A50003 andi $a1, $a1, 0x3 */ - cpu->gpr[5] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30A50003u, cpu->gpr[5], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051730u); #endif @@ -735763,7 +737599,8 @@ label_BFC39748: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC39754: 33280100 andi $t0, $t9, 0x100 */ - cpu->gpr[8] = cpu->gpr[25] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x100u; + PGXP_ALU(0x33280100u, cpu->gpr[8], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x80051754u); #endif @@ -735810,7 +737647,8 @@ label_BFC39748: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC39768: 30E707C0 andi $a3, $a3, 0x7C0 */ - cpu->gpr[7] = cpu->gpr[7] & 0x7C0u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x7C0u; + PGXP_ALU(0x30E707C0u, cpu->gpr[7], _pgx1, 0x07C0u); } #ifdef PSX_COSIM cosim_instr(0x80051768u); #endif @@ -735818,7 +737656,8 @@ label_BFC39748: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC3976C: 30C60003 andi $a2, $a2, 0x3 */ - cpu->gpr[6] = cpu->gpr[6] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x3u; + PGXP_ALU(0x30C60003u, cpu->gpr[6], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x8005176Cu); #endif @@ -735829,7 +737668,8 @@ label_BFC39748: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC39770: 30A50003 andi $a1, $a1, 0x3 */ - cpu->gpr[5] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30A50003u, cpu->gpr[5], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051770u); #endif @@ -735979,7 +737819,8 @@ label_BFC39804: psx_cyc_step(cpu, 0x3000008u); #endif /* 0xBFC39814: 0303C826 xor $t9, $t8, $v1 */ - cpu->gpr[25] = cpu->gpr[24] ^ cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[25] = cpu->gpr[24] ^ cpu->gpr[3]; + PGXP_ALU(0x0303C826u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051814u); #endif @@ -736008,7 +737849,8 @@ label_BFC39804: psx_cyc_step(cpu, 0x608u); #endif /* 0xBFC39820: 01235026 xor $t2, $t1, $v1 */ - cpu->gpr[10] = cpu->gpr[9] ^ cpu->gpr[3]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[10] = cpu->gpr[9] ^ cpu->gpr[3]; + PGXP_ALU(0x01235026u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051820u); #endif @@ -736042,7 +737884,8 @@ label_BFC39804: psx_cyc_step(cpu, 0x824u); #endif /* 0xBFC39830: 00A25826 xor $t3, $a1, $v0 */ - cpu->gpr[11] = cpu->gpr[5] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[5] ^ cpu->gpr[2]; + PGXP_ALU(0x00A25826u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051830u); #endif @@ -736068,7 +737911,8 @@ label_BFC39804: psx_cyc_step(cpu, 0x6004u); #endif /* 0xBFC3983C: 01A27026 xor $t6, $t5, $v0 */ - cpu->gpr[14] = cpu->gpr[13] ^ cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[13] ^ cpu->gpr[2]; + PGXP_ALU(0x01A27026u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005183Cu); #endif @@ -736197,7 +738041,8 @@ label_BFC398DC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC398E8: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800518E8u); #endif @@ -736255,7 +738100,8 @@ label_BFC398F4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC398FC: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800518FCu); #endif @@ -736266,7 +738112,8 @@ label_BFC398F4: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC39900: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80051900u); #endif @@ -736400,7 +738247,8 @@ label_BFC39918: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC39924: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80051924u); #endif @@ -736455,7 +738303,8 @@ label_BFC39930: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC39938: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051938u); #endif @@ -736463,7 +738312,8 @@ label_BFC39930: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3993C: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005193Cu); #endif @@ -736550,7 +738400,8 @@ label_BFC3994C: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC39958: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051958u); #endif @@ -736668,7 +738519,8 @@ label_BFC3999C: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC399A8: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800519A8u); #endif @@ -736786,7 +738638,8 @@ label_BFC399EC: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC399F8: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800519F8u); #endif @@ -736904,7 +738757,8 @@ label_BFC39A14: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC39A20: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051A20u); #endif @@ -737019,7 +738873,8 @@ label_BFC39A3C: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC39A48: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051A48u); #endif @@ -737137,7 +738992,8 @@ label_BFC39ADC: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC39AE8: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051AE8u); #endif @@ -737255,7 +739111,8 @@ label_BFC39BA4: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC39BB0: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051BB0u); #endif @@ -737370,7 +739227,8 @@ label_BFC39BCC: psx_cyc_step(cpu, 0xC002u); #endif /* 0xBFC39BD8: 01C17824 and $t7, $t6, $at */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C17824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80051BD8u); #endif @@ -738050,7 +739908,8 @@ label_BFC39DF4: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC39E04: 316C0300 andi $t4, $t3, 0x300 */ - cpu->gpr[12] = cpu->gpr[11] & 0x300u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x300u; + PGXP_ALU(0x316C0300u, cpu->gpr[12], _pgx1, 0x0300u); } #ifdef PSX_COSIM cosim_instr(0x80051E04u); #endif @@ -738097,7 +739956,8 @@ label_BFC39DF4: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC39E18: 30E707C0 andi $a3, $a3, 0x7C0 */ - cpu->gpr[7] = cpu->gpr[7] & 0x7C0u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x7C0u; + PGXP_ALU(0x30E707C0u, cpu->gpr[7], _pgx1, 0x07C0u); } #ifdef PSX_COSIM cosim_instr(0x80051E18u); #endif @@ -738105,7 +739965,8 @@ label_BFC39DF4: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC39E1C: 30C60003 andi $a2, $a2, 0x3 */ - cpu->gpr[6] = cpu->gpr[6] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x3u; + PGXP_ALU(0x30C60003u, cpu->gpr[6], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051E1Cu); #endif @@ -738116,7 +739977,8 @@ label_BFC39DF4: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC39E20: 30A50003 andi $a1, $a1, 0x3 */ - cpu->gpr[5] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30A50003u, cpu->gpr[5], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051E20u); #endif @@ -738238,7 +740100,8 @@ label_BFC39E38: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC39E48: 31CF0100 andi $t7, $t6, 0x100 */ - cpu->gpr[15] = cpu->gpr[14] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x100u; + PGXP_ALU(0x31CF0100u, cpu->gpr[15], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x80051E48u); #endif @@ -738285,7 +740148,8 @@ label_BFC39E38: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC39E5C: 30E707C0 andi $a3, $a3, 0x7C0 */ - cpu->gpr[7] = cpu->gpr[7] & 0x7C0u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x7C0u; + PGXP_ALU(0x30E707C0u, cpu->gpr[7], _pgx1, 0x07C0u); } #ifdef PSX_COSIM cosim_instr(0x80051E5Cu); #endif @@ -738296,7 +740160,8 @@ label_BFC39E38: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC39E60: 30C60003 andi $a2, $a2, 0x3 */ - cpu->gpr[6] = cpu->gpr[6] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x3u; + PGXP_ALU(0x30C60003u, cpu->gpr[6], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051E60u); #endif @@ -738304,7 +740169,8 @@ label_BFC39E38: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC39E64: 30A50003 andi $a1, $a1, 0x3 */ - cpu->gpr[5] = cpu->gpr[5] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0x3u; + PGXP_ALU(0x30A50003u, cpu->gpr[5], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80051E64u); #endif @@ -738893,7 +740759,8 @@ label_BFC39F30: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC39F30: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80051F30u); #endif @@ -738917,7 +740784,8 @@ label_BFC39F30: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC39F3C: 2C810020 sltiu $at, $a0, 32 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000020u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000020u ? 1 : 0); + PGXP_ALU(0x2C810020u, cpu->gpr[1], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x80051F3Cu); #endif @@ -738997,7 +740865,8 @@ label_BFC39F50: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC39F54: 2C810080 sltiu $at, $a0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C810080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80051F54u); #endif @@ -739232,7 +741101,8 @@ label_BFC39F90: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC39F90: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80051F90u); #endif @@ -739256,7 +741126,8 @@ label_BFC39F90: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC39F9C: 2C810020 sltiu $at, $a0, 32 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000020u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000020u ? 1 : 0); + PGXP_ALU(0x2C810020u, cpu->gpr[1], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x80051F9Cu); #endif @@ -739330,7 +741201,8 @@ label_BFC39FAC: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC39FB0: 2C810080 sltiu $at, $a0, 128 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000080u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000080u ? 1 : 0); + PGXP_ALU(0x2C810080u, cpu->gpr[1], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80051FB0u); #endif @@ -739743,7 +741615,8 @@ label_BFC3A020: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3A020: 31CF00FF andi $t7, $t6, 0xFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052020u); #endif @@ -739989,7 +741862,8 @@ label_BFC3A06C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3A06C: 331900FF andi $t9, $t8, 0xFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x331900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005206Cu); #endif @@ -740539,7 +742413,8 @@ label_BFC3A114: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC3A114: 31F800FF andi $t8, $t7, 0xFF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31F800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052114u); #endif @@ -740621,7 +742496,8 @@ label_BFC3A120: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3A130: 310900FF andi $t1, $t0, 0xFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052130u); #endif @@ -741569,7 +743445,8 @@ label_BFC3A250: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC3A25C: 31F800FF andi $t8, $t7, 0xFF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFu; + PGXP_ALU(0x31F800FFu, cpu->gpr[24], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005225Cu); #endif @@ -741702,7 +743579,8 @@ label_BFC3A274: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3A288: 310900FF andi $t1, $t0, 0xFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052288u); #endif @@ -742170,7 +744048,8 @@ label_BFC3A308: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC3A310: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052310u); #endif @@ -742235,7 +744114,8 @@ label_BFC3A31C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3A324: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052324u); #endif @@ -742243,7 +744123,8 @@ label_BFC3A31C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3A328: 2C410018 sltiu $at, $v0, 24 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000018u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000018u ? 1 : 0); + PGXP_ALU(0x2C410018u, cpu->gpr[1], _pgx1, 0x0018u); } #ifdef PSX_COSIM cosim_instr(0x80052328u); #endif @@ -742647,7 +744528,8 @@ label_BFC3A36C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC3A3A8: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800523A8u); #endif @@ -742655,7 +744537,8 @@ label_BFC3A36C: psx_cyc_step(cpu, 0x92u); #endif /* 0xBFC3A3AC: 0087082B sltu $at, $a0, $a3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x0087082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800523ACu); #endif @@ -742804,7 +744687,8 @@ label_BFC3A3CC: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC3A3D8: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800523D8u); #endif @@ -742824,7 +744708,8 @@ label_BFC3A3CC: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC3A3E0: 2C810021 sltiu $at, $a0, 33 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000021u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00000021u ? 1 : 0); + PGXP_ALU(0x2C810021u, cpu->gpr[1], _pgx1, 0x0021u); } #ifdef PSX_COSIM cosim_instr(0x800523E0u); #endif @@ -743698,7 +745583,8 @@ label_BFC3A4E4: psx_cyc_step(cpu, 0x1006u); #endif /* 0xBFC3A4EC: 0182082B sltu $at, $t4, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[12] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[12] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0182082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800524ECu); #endif @@ -743748,7 +745634,8 @@ label_BFC3A4F8: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3A4F8: 3182FFFF andi $v0, $t4, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[12] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[2] = cpu->gpr[12] & 0xFFFFu; + PGXP_ALU(0x3182FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800524F8u); #endif @@ -743756,7 +745643,8 @@ label_BFC3A4F8: psx_cyc_step(cpu, 0x810u); #endif /* 0xBFC3A4FC: 3164FFFF andi $a0, $t3, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[4] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x3164FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800524FCu); #endif @@ -743774,7 +745662,8 @@ label_BFC3A4F8: psx_cyc_step(cpu, 0x140u); #endif /* 0xBFC3A504: 310600FF andi $a2, $t0, 0xFF */ - cpu->gpr[6] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[6] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310600FFu, cpu->gpr[6], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052504u); #endif @@ -743813,7 +745702,8 @@ label_BFC3A508: psx_cyc_step(cpu, 0x812u); #endif /* 0xBFC3A50C: 0164082B sltu $at, $t3, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0164082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005250Cu); #endif @@ -743884,7 +745774,8 @@ label_BFC3A518: psx_cyc_step(cpu, 0x810u); #endif /* 0xBFC3A518: 3164FFFF andi $a0, $t3, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[4] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x3164FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052518u); #endif @@ -743902,7 +745793,8 @@ label_BFC3A518: psx_cyc_step(cpu, 0x140u); #endif /* 0xBFC3A520: 310600FF andi $a2, $t0, 0xFF */ - cpu->gpr[6] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[6] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310600FFu, cpu->gpr[6], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052520u); #endif @@ -743990,7 +745882,8 @@ label_BFC3A52C: psx_cyc_step(cpu, 0x2802u); #endif /* 0xBFC3A534: 01AB082A slt $at, $t5, $t3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x01AB082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052534u); #endif @@ -744046,7 +745939,8 @@ label_BFC3A540: psx_cyc_step(cpu, 0x100Au); #endif /* 0xBFC3A544: 0183082B sltu $at, $t4, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[12] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[12] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0183082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052544u); #endif @@ -744099,7 +745993,8 @@ label_BFC3A550: psx_cyc_step(cpu, 0x1008u); #endif /* 0xBFC3A554: 3183FFFF andi $v1, $t4, 0xFFFF */ - cpu->gpr[3] = cpu->gpr[12] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[3] = cpu->gpr[12] & 0xFFFFu; + PGXP_ALU(0x3183FFFFu, cpu->gpr[3], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052554u); #endif @@ -744114,7 +746009,8 @@ label_BFC3A550: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC3A55C: 310700FF andi $a3, $t0, 0xFF */ - cpu->gpr[7] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[7] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005255Cu); #endif @@ -744202,7 +746098,8 @@ label_BFC3A568: psx_cyc_step(cpu, 0x822u); #endif /* 0xBFC3A570: 0165082B sltu $at, $t3, $a1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0165082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052570u); #endif @@ -744249,7 +746146,8 @@ label_BFC3A57C: psx_cyc_step(cpu, 0x820u); #endif /* 0xBFC3A57C: 3165FFFF andi $a1, $t3, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[5] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x3165FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8005257Cu); #endif @@ -744260,7 +746158,8 @@ label_BFC3A57C: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC3A580: 310700FF andi $a3, $t0, 0xFF */ - cpu->gpr[7] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[7] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052580u); #endif @@ -744293,7 +746192,8 @@ label_BFC3A584: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC3A58C: 310800FF andi $t0, $t0, 0xFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310800FFu, cpu->gpr[8], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005258Cu); #endif @@ -744304,7 +746204,8 @@ label_BFC3A584: psx_cyc_step(cpu, 0x302u); #endif /* 0xBFC3A590: 0109082B sltu $at, $t0, $t1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0109082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052590u); #endif @@ -744539,7 +746440,8 @@ label_BFC3A5C4: psx_cyc_step(cpu, 0x280u); #endif /* 0xBFC3A5C4: 312700FF andi $a3, $t1, 0xFF */ - cpu->gpr[7] = cpu->gpr[9] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[7] = cpu->gpr[9] & 0xFFu; + PGXP_ALU(0x312700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800525C4u); #endif @@ -744650,7 +746552,8 @@ label_BFC3A5D4: psx_cyc_step(cpu, 0xA002u); #endif /* 0xBFC3A5E8: 01AF082A slt $at, $t5, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x01AF082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800525E8u); #endif @@ -744714,7 +746617,8 @@ label_BFC3A5F4: psx_cyc_step(cpu, 0x26u); #endif /* 0xBFC3A5FC: 00A2082B sltu $at, $a1, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x00A2082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800525FCu); #endif @@ -744764,7 +746668,8 @@ label_BFC3A608: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC3A608: 3045FFFF andi $a1, $v0, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3045FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052608u); #endif @@ -744772,7 +746677,8 @@ label_BFC3A608: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC3A60C: 310700FF andi $a3, $t0, 0xFF */ - cpu->gpr[7] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[7] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310700FFu, cpu->gpr[7], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005260Cu); #endif @@ -744799,7 +746705,8 @@ label_BFC3A610: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC3A614: 310800FF andi $t0, $t0, 0xFF */ - cpu->gpr[8] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310800FFu, cpu->gpr[8], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052614u); #endif @@ -744807,7 +746714,8 @@ label_BFC3A610: psx_cyc_step(cpu, 0x302u); #endif /* 0xBFC3A618: 0109082B sltu $at, $t0, $t1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0109082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052618u); #endif @@ -745177,7 +747085,8 @@ label_BFC3A638: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3A68C: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8005268Cu); #endif @@ -745498,7 +747407,8 @@ label_BFC3A638: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC3A704: 2D010040 sltiu $at, $t0, 64 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2D010040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80052704u); #endif @@ -745771,7 +747681,8 @@ label_BFC3A74C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3A758: 2C410040 sltiu $at, $v0, 64 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C410040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80052758u); #endif @@ -745996,7 +747907,8 @@ label_BFC3A78C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3A798: 2C410040 sltiu $at, $v0, 64 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000040u ? 1 : 0); + PGXP_ALU(0x2C410040u, cpu->gpr[1], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80052798u); #endif @@ -746229,7 +748141,8 @@ label_BFC3A7CC: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC3A7DC: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800527DCu); #endif @@ -746425,7 +748338,8 @@ label_BFC3A7F4: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC3A810: 30E7FFFF andi $a3, $a3, 0xFFFF */ - cpu->gpr[7] = cpu->gpr[7] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0xFFFFu; + PGXP_ALU(0x30E7FFFFu, cpu->gpr[7], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052810u); #endif @@ -746695,7 +748609,8 @@ label_BFC3A7F4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3A87C: 28410010 slti $at, $v0, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (16) ? 1 : 0); + PGXP_ALU(0x28410010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x8005287Cu); #endif @@ -746797,7 +748712,8 @@ label_BFC3A894: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC3A89C: 3063FFFF andi $v1, $v1, 0xFFFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + PGXP_ALU(0x3063FFFFu, cpu->gpr[3], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8005289Cu); #endif @@ -746887,7 +748803,8 @@ label_BFC3A8A8: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC3A8B8: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800528B8u); #endif @@ -746931,7 +748848,8 @@ label_BFC3A8BC: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC3A8C8: 318D0004 andi $t5, $t4, 0x4 */ - cpu->gpr[13] = cpu->gpr[12] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x4u; + PGXP_ALU(0x318D0004u, cpu->gpr[13], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x800528C8u); #endif @@ -747117,7 +749035,8 @@ label_BFC3A900: psx_cyc_step(cpu, 0x809u); #endif /* 0xBFC3A908: 00605827 nor $t3, $v1, $zero */ - cpu->gpr[11] = ~(cpu->gpr[3] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[11] = ~(cpu->gpr[3] | cpu->gpr[0]); + PGXP_ALU(0x00605827u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052908u); #endif @@ -747152,7 +749071,8 @@ label_BFC3A900: psx_cyc_step(cpu, 0xE00u); #endif /* 0xBFC3A918: 012B5024 and $t2, $t1, $t3 */ - cpu->gpr[10] = cpu->gpr[9] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[10] = cpu->gpr[9] & cpu->gpr[11]; + PGXP_ALU(0x012B5024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052918u); #endif @@ -747172,7 +749092,8 @@ label_BFC3A900: psx_cyc_step(cpu, 0x2011u); #endif /* 0xBFC3A920: 00806827 nor $t5, $a0, $zero */ - cpu->gpr[13] = ~(cpu->gpr[4] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[13] = ~(cpu->gpr[4] | cpu->gpr[0]); + PGXP_ALU(0x00806827u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052920u); #endif @@ -747189,7 +749110,8 @@ label_BFC3A900: psx_cyc_step(cpu, 0x7000u); #endif /* 0xBFC3A928: 018D7024 and $t6, $t4, $t5 */ - cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + PGXP_ALU(0x018D7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052928u); #endif @@ -747380,7 +749302,8 @@ label_BFC3A95C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3A968: 2C410010 sltiu $at, $v0, 16 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000010u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < 0x00000010u ? 1 : 0); + PGXP_ALU(0x2C410010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80052968u); #endif @@ -747449,7 +749372,8 @@ label_BFC3A974: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC3A97C: 3063FFFF andi $v1, $v1, 0xFFFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFFFu; + PGXP_ALU(0x3063FFFFu, cpu->gpr[3], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8005297Cu); #endif @@ -747549,7 +749473,8 @@ label_BFC3A98C: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC3A998: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052998u); #endif @@ -748006,7 +749931,8 @@ label_BFC3AA24: psx_cyc_step(cpu, 0x4020u); #endif /* 0xBFC3AA34: 30AEFFFF andi $t6, $a1, 0xFFFF */ - cpu->gpr[14] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[14] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30AEFFFFu, cpu->gpr[14], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052A34u); #endif @@ -748023,7 +749949,8 @@ label_BFC3AA24: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC3AA3C: 2DC10010 sltiu $at, $t6, 16 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000010u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[14] < 0x00000010u ? 1 : 0); + PGXP_ALU(0x2DC10010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80052A3Cu); #endif @@ -748034,7 +749961,8 @@ label_BFC3AA24: psx_cyc_step(cpu, 0x30u); #endif /* 0xBFC3AA40: 30A4FFFF andi $a0, $a1, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[4] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A4FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052A40u); #endif @@ -748327,7 +750255,8 @@ label_BFC3AA9C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3AAA4: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052AA4u); #endif @@ -748416,7 +750345,8 @@ label_BFC3AAB0: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3AAB8: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052AB8u); #endif @@ -748707,7 +750637,8 @@ label_BFC3AAF4: psx_cyc_step(cpu, 0x482u); #endif /* 0xBFC3AB14: 00EA082B sltu $at, $a3, $t2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[7] < cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)(cpu->gpr[7] < cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x00EA082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052B14u); #endif @@ -748768,7 +750699,8 @@ label_BFC3AB20: psx_cyc_step(cpu, 0x882u); #endif /* 0xBFC3AB28: 0167082B sltu $at, $t3, $a3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)(cpu->gpr[11] < cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x0167082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052B28u); #endif @@ -748872,7 +750804,8 @@ label_BFC3AB34: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC3AB4C: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052B4Cu); #endif @@ -748917,7 +750850,8 @@ label_BFC3AB50: psx_cyc_step(cpu, 0x46u); #endif /* 0xBFC3AB5C: 0046082A slt $at, $v0, $a2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x0046082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052B5Cu); #endif @@ -749135,7 +751069,8 @@ label_BFC3AB70: psx_cyc_step(cpu, 0x2000010u); #endif /* 0xBFC3ABA0: 30990001 andi $t9, $a0, 0x1 */ - cpu->gpr[25] = cpu->gpr[4] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[4] & 0x1u; + PGXP_ALU(0x30990001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80052BA0u); #endif @@ -750075,7 +752010,8 @@ label_BFC3ACD0: psx_cyc_step(cpu, 0x8022u); #endif /* 0xBFC3ACDC: 00AF082A slt $at, $a1, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x00AF082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052CDCu); #endif @@ -750600,7 +752536,8 @@ label_BFC3AD68: psx_cyc_step(cpu, 0x40080u); #endif /* 0xBFC3AD90: 30F2FFFF andi $s2, $a3, 0xFFFF */ - cpu->gpr[18] = cpu->gpr[7] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[18] = cpu->gpr[7] & 0xFFFFu; + PGXP_ALU(0x30F2FFFFu, cpu->gpr[18], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052D90u); #endif @@ -750991,7 +752928,8 @@ label_BFC3ADB0: psx_cyc_step(cpu, 0x80802u); #endif /* 0xBFC3AE28: 026B082B sltu $at, $s3, $t3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < cpu->gpr[11] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[19]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[1] = (uint32_t)(cpu->gpr[19] < cpu->gpr[11] ? 1 : 0); + PGXP_ALU(0x026B082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052E28u); #endif @@ -751290,7 +753228,8 @@ label_BFC3AE74: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3AE74: 304C00FF andi $t4, $v0, 0xFF */ - cpu->gpr[12] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304C00FFu, cpu->gpr[12], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052E74u); #endif @@ -751298,7 +753237,8 @@ label_BFC3AE74: psx_cyc_step(cpu, 0x40004u); #endif /* 0xBFC3AE78: 305200FF andi $s2, $v0, 0xFF */ - cpu->gpr[18] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[18] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x305200FFu, cpu->gpr[18], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80052E78u); #endif @@ -751545,7 +753485,8 @@ label_BFC3AEB0: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC3AED8: 312AFFFF andi $t2, $t1, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x312AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052ED8u); #endif @@ -751849,7 +753790,8 @@ label_BFC3AF44: psx_cyc_step(cpu, 0x1802u); #endif /* 0xBFC3AF5C: 016C082A slt $at, $t3, $t4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (int32_t)cpu->gpr[12] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[12]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (int32_t)cpu->gpr[12] ? 1 : 0); + PGXP_ALU(0x016C082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80052F5Cu); #endif @@ -752241,7 +754183,8 @@ label_BFC3AFE0: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC3AFE8: 3045FFFF andi $a1, $v0, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3045FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80052FE8u); #endif @@ -752341,7 +754284,8 @@ label_BFC3B004: psx_cyc_step(cpu, 0x10000u); #endif /* 0xBFC3B008: 321000FF andi $s0, $s0, 0xFF */ - cpu->gpr[16] = cpu->gpr[16] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[16] = cpu->gpr[16] & 0xFFu; + PGXP_ALU(0x321000FFu, cpu->gpr[16], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80053008u); #endif @@ -752349,7 +754293,8 @@ label_BFC3B004: psx_cyc_step(cpu, 0x50002u); #endif /* 0xBFC3B00C: 0212082B sltu $at, $s0, $s2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0212082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005300Cu); #endif @@ -752751,7 +754696,8 @@ label_BFC3B054: psx_cyc_step(cpu, 0x100080u); #endif /* 0xBFC3B094: 30F4FFFF andi $s4, $a3, 0xFFFF */ - cpu->gpr[20] = cpu->gpr[7] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[20] = cpu->gpr[7] & 0xFFFFu; + PGXP_ALU(0x30F4FFFFu, cpu->gpr[20], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80053094u); #endif @@ -753176,7 +755122,8 @@ label_BFC3B110: psx_cyc_step(cpu, 0x20000u); #endif /* 0xBFC3B114: 323100FF andi $s1, $s1, 0xFF */ - cpu->gpr[17] = cpu->gpr[17] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[17]; cpu->gpr[17] = cpu->gpr[17] & 0xFFu; + PGXP_ALU(0x323100FFu, cpu->gpr[17], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80053114u); #endif @@ -753203,7 +755150,8 @@ label_BFC3B118: psx_cyc_step(cpu, 0x10000u); #endif /* 0xBFC3B11C: 321000FF andi $s0, $s0, 0xFF */ - cpu->gpr[16] = cpu->gpr[16] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[16] = cpu->gpr[16] & 0xFFu; + PGXP_ALU(0x321000FFu, cpu->gpr[16], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005311Cu); #endif @@ -753214,7 +755162,8 @@ label_BFC3B118: psx_cyc_step(cpu, 0x50002u); #endif /* 0xBFC3B120: 0212082B sltu $at, $s0, $s2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[18] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)(cpu->gpr[16] < cpu->gpr[18] ? 1 : 0); + PGXP_ALU(0x0212082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80053120u); #endif @@ -753594,7 +755543,8 @@ label_BFC3B17C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3B1A4: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800531A4u); #endif @@ -753611,7 +755561,8 @@ label_BFC3B17C: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC3B1AC: 0043082B sltu $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[2] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800531ACu); #endif @@ -753722,7 +755673,8 @@ label_BFC3B1B8: psx_cyc_step(cpu, 0x3001u); #endif /* 0xBFC3B1D4: 01806827 nor $t5, $t4, $zero */ - cpu->gpr[13] = ~(cpu->gpr[12] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[13] = ~(cpu->gpr[12] | cpu->gpr[0]); + PGXP_ALU(0x01806827u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800531D4u); #endif @@ -753748,7 +755700,8 @@ label_BFC3B1B8: psx_cyc_step(cpu, 0xA800u); #endif /* 0xBFC3B1E0: 016D7824 and $t7, $t3, $t5 */ - cpu->gpr[15] = cpu->gpr[11] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[15] = cpu->gpr[11] & cpu->gpr[13]; + PGXP_ALU(0x016D7824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800531E0u); #endif @@ -753774,7 +755727,8 @@ label_BFC3B1B8: psx_cyc_step(cpu, 0x3000001u); #endif /* 0xBFC3B1EC: 0300C827 nor $t9, $t8, $zero */ - cpu->gpr[25] = ~(cpu->gpr[24] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[25] = ~(cpu->gpr[24] | cpu->gpr[0]); + PGXP_ALU(0x0300C827u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800531ECu); #endif @@ -753800,7 +755754,8 @@ label_BFC3B1B8: psx_cyc_step(cpu, 0x2004200u); #endif /* 0xBFC3B1F8: 01D94824 and $t1, $t6, $t9 */ - cpu->gpr[9] = cpu->gpr[14] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[9] = cpu->gpr[14] & cpu->gpr[25]; + PGXP_ALU(0x01D94824u, cpu->gpr[9], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800531F8u); #endif @@ -753820,7 +755775,8 @@ label_BFC3B1B8: psx_cyc_step(cpu, 0x8100u); #endif /* 0xBFC3B200: 31E8FFFF andi $t0, $t7, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[15] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[8] = cpu->gpr[15] & 0xFFFFu; + PGXP_ALU(0x31E8FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80053200u); #endif @@ -756201,7 +758157,8 @@ label_BFC3B530: psx_cyc_step(cpu, 0x2000002u); #endif /* 0xBFC3B538: 2B210005 slti $at, $t9, 5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (5) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (5) ? 1 : 0); + PGXP_ALU(0x2B210005u, cpu->gpr[1], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0x80053538u); #endif @@ -756402,7 +758359,8 @@ label_BFC3B560: psx_cyc_step(cpu, 0x16u); #endif /* 0xBFC3B570: 0082082B sltu $at, $a0, $v0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0082082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80053570u); #endif @@ -756937,7 +758895,8 @@ label_BFC3B614: psx_cyc_step(cpu, 0x200000Au); #endif /* 0xBFC3B620: 0079082A slt $at, $v1, $t9 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0079082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80053620u); #endif @@ -757143,7 +759102,8 @@ label_BFC3B668: psx_cyc_step(cpu, 0x10Au); #endif /* 0xBFC3B668: 0103082B sltu $at, $t0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0103082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80053668u); #endif @@ -757241,7 +759201,8 @@ label_BFC3B674: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC3B68C: 29C10005 slti $at, $t6, 5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (5) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (5) ? 1 : 0); + PGXP_ALU(0x29C10005u, cpu->gpr[1], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0x8005368Cu); #endif @@ -757833,7 +759794,8 @@ label_BFC3B738: psx_cyc_step(cpu, 0x2002u); #endif /* 0xBFC3B744: 01A1082B sltu $at, $t5, $at */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < cpu->gpr[1] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[1] = (uint32_t)(cpu->gpr[13] < cpu->gpr[1] ? 1 : 0); + PGXP_ALU(0x01A1082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80053744u); #endif @@ -758137,7 +760099,8 @@ label_BFC3B798: psx_cyc_step(cpu, 0x2008u); #endif /* 0xBFC3B7A8: 306D0001 andi $t5, $v1, 0x1 */ - cpu->gpr[13] = cpu->gpr[3] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[13] = cpu->gpr[3] & 0x1u; + PGXP_ALU(0x306D0001u, cpu->gpr[13], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800537A8u); #endif @@ -758590,7 +760553,8 @@ label_BFC3B81C: psx_cyc_step(cpu, 0x10Au); #endif /* 0xBFC3B820: 0103082B sltu $at, $t0, $v1 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0103082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80053820u); #endif @@ -758860,7 +760824,8 @@ label_BFC3B85C: psx_cyc_step(cpu, 0x10002u); #endif /* 0xBFC3B86C: 2A010002 slti $at, $s0, 2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (2) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[16]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[16] < (2) ? 1 : 0); + PGXP_ALU(0x2A010002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x8005386Cu); #endif @@ -759851,7 +761816,8 @@ label_BFC3B964: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3B998: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80053998u); #endif @@ -759898,7 +761864,8 @@ label_BFC3B964: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3B9AC: 28410010 slti $at, $v0, 16 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (16) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (16) ? 1 : 0); + PGXP_ALU(0x28410010u, cpu->gpr[1], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x800539ACu); #endif @@ -759909,7 +761876,8 @@ label_BFC3B964: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC3B9B0: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800539B0u); #endif @@ -760358,7 +762326,8 @@ label_BFC3BA4C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3BA54: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80053A54u); #endif @@ -760447,7 +762416,8 @@ label_BFC3BA60: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3BA68: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80053A68u); #endif @@ -760963,7 +762933,8 @@ label_BFC3BAF0: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC3BAF0: 0062082A slt $at, $v1, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x0062082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80053AF0u); #endif @@ -762778,7 +764749,8 @@ label_BFC3BDCC: psx_cyc_step(cpu, 0xAu); #endif /* 0xBFC3BDCC: 2861000A slti $at, $v1, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (10) ? 1 : 0); + PGXP_ALU(0x2861000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x80053DCCu); #endif @@ -765688,7 +767660,8 @@ label_BFC3C140: psx_cyc_step(cpu, 0x4002u); #endif /* 0xBFC3C150: 29C100F0 slti $at, $t6, 240 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (240) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (240) ? 1 : 0); + PGXP_ALU(0x29C100F0u, cpu->gpr[1], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80054150u); #endif @@ -765838,7 +767811,8 @@ label_BFC3C160: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC3C188: 292100F0 slti $at, $t1, 240 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (240) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (240) ? 1 : 0); + PGXP_ALU(0x292100F0u, cpu->gpr[1], _pgx1, 0x00F0u); } #ifdef PSX_COSIM cosim_instr(0x80054188u); #endif @@ -766197,7 +768171,8 @@ label_BFC3C1EC: psx_cyc_step(cpu, 0x2000400u); #endif /* 0xBFC3C1F4: 332A07FF andi $t2, $t9, 0x7FF */ - cpu->gpr[10] = cpu->gpr[25] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[10] = cpu->gpr[25] & 0x7FFu; + PGXP_ALU(0x332A07FFu, cpu->gpr[10], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x800541F4u); #endif @@ -766294,7 +768269,8 @@ label_BFC3C208: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3C20C: 28411389 slti $at, $v0, 5001 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (5001) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (5001) ? 1 : 0); + PGXP_ALU(0x28411389u, cpu->gpr[1], _pgx1, 0x1389u); } #ifdef PSX_COSIM cosim_instr(0x8005420Cu); #endif @@ -766487,7 +768463,8 @@ label_BFC3C240: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC3C248: 316C07FF andi $t4, $t3, 0x7FF */ - cpu->gpr[12] = cpu->gpr[11] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x7FFu; + PGXP_ALU(0x316C07FFu, cpu->gpr[12], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80054248u); #endif @@ -767974,7 +769951,8 @@ label_BFC3C428: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC3C448: 30C607FF andi $a2, $a2, 0x7FF */ - cpu->gpr[6] = cpu->gpr[6] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0x7FFu; + PGXP_ALU(0x30C607FFu, cpu->gpr[6], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80054448u); #endif @@ -767982,7 +769960,8 @@ label_BFC3C428: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C44C: 3042FFCF andi $v0, $v0, 0xFFCF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFCFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFCFu; + PGXP_ALU(0x3042FFCFu, cpu->gpr[2], _pgx1, 0xFFCFu); } #ifdef PSX_COSIM cosim_instr(0x8005444Cu); #endif @@ -767993,7 +769972,8 @@ label_BFC3C428: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C450: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054450u); #endif @@ -768016,7 +769996,8 @@ label_BFC3C428: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC3C45C: 30C6FFFF andi $a2, $a2, 0xFFFF */ - cpu->gpr[6] = cpu->gpr[6] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0xFFFFu; + PGXP_ALU(0x30C6FFFFu, cpu->gpr[6], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8005445Cu); #endif @@ -768027,7 +770008,8 @@ label_BFC3C428: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3C460: 31CF07FF andi $t7, $t6, 0x7FF */ - cpu->gpr[15] = cpu->gpr[14] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x7FFu; + PGXP_ALU(0x31CF07FFu, cpu->gpr[15], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80054460u); #endif @@ -768136,7 +770118,8 @@ label_BFC3C478: psx_cyc_step(cpu, 0x82u); #endif /* 0xBFC3C47C: 28E11389 slti $at, $a3, 5001 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (5001) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (5001) ? 1 : 0); + PGXP_ALU(0x28E11389u, cpu->gpr[1], _pgx1, 0x1389u); } #ifdef PSX_COSIM cosim_instr(0x8005447Cu); #endif @@ -768314,7 +770297,8 @@ label_BFC3C4A8: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3C4B0: 331907FF andi $t9, $t8, 0x7FF */ - cpu->gpr[25] = cpu->gpr[24] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x7FFu; + PGXP_ALU(0x331907FFu, cpu->gpr[25], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x800544B0u); #endif @@ -768684,7 +770668,8 @@ label_BFC3C4E0: psx_cyc_step(cpu, 0x200000u); #endif /* 0xBFC3C510: 32B507FF andi $s5, $s5, 0x7FF */ - cpu->gpr[21] = cpu->gpr[21] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[21]; cpu->gpr[21] = cpu->gpr[21] & 0x7FFu; + PGXP_ALU(0x32B507FFu, cpu->gpr[21], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80054510u); #endif @@ -768701,7 +770686,8 @@ label_BFC3C4E0: psx_cyc_step(cpu, 0x200000u); #endif /* 0xBFC3C518: 32B5FFFF andi $s5, $s5, 0xFFFF */ - cpu->gpr[21] = cpu->gpr[21] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[21]; cpu->gpr[21] = cpu->gpr[21] & 0xFFFFu; + PGXP_ALU(0x32B5FFFFu, cpu->gpr[21], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054518u); #endif @@ -768773,7 +770759,8 @@ label_BFC3C528: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC3C530: 31F807FF andi $t8, $t7, 0x7FF */ - cpu->gpr[24] = cpu->gpr[15] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x7FFu; + PGXP_ALU(0x31F807FFu, cpu->gpr[24], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80054530u); #endif @@ -768839,7 +770826,8 @@ label_BFC3C540: psx_cyc_step(cpu, 0x40002u); #endif /* 0xBFC3C540: 2A411389 slti $at, $s2, 5001 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (5001) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (5001) ? 1 : 0); + PGXP_ALU(0x2A411389u, cpu->gpr[1], _pgx1, 0x1389u); } #ifdef PSX_COSIM cosim_instr(0x80054540u); #endif @@ -769035,7 +771023,8 @@ label_BFC3C574: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC3C57C: 332807FF andi $t0, $t9, 0x7FF */ - cpu->gpr[8] = cpu->gpr[25] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x7FFu; + PGXP_ALU(0x332807FFu, cpu->gpr[8], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x8005457Cu); #endif @@ -769156,7 +771145,8 @@ label_BFC3C594: psx_cyc_step(cpu, 0x100002u); #endif /* 0xBFC3C598: 2E810041 sltiu $at, $s4, 65 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[20] < 0x00000041u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)(cpu->gpr[20] < 0x00000041u ? 1 : 0); + PGXP_ALU(0x2E810041u, cpu->gpr[1], _pgx1, 0x0041u); } #ifdef PSX_COSIM cosim_instr(0x80054598u); #endif @@ -769333,7 +771323,8 @@ label_BFC3C5B8: psx_cyc_step(cpu, 0x8000Au); #endif /* 0xBFC3C5C0: 0073082A slt $at, $v1, $s3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[19] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[3] < (int32_t)cpu->gpr[19] ? 1 : 0); + PGXP_ALU(0x0073082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800545C0u); #endif @@ -769404,7 +771395,8 @@ label_BFC3C5D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C5D8: 3042FFCF andi $v0, $v0, 0xFFCF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFCFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFCFu; + PGXP_ALU(0x3042FFCFu, cpu->gpr[2], _pgx1, 0xFFCFu); } #ifdef PSX_COSIM cosim_instr(0x800545D8u); #endif @@ -769412,7 +771404,8 @@ label_BFC3C5D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C5DC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800545DCu); #endif @@ -769432,7 +771425,8 @@ label_BFC3C5D0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C5E4: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800545E4u); #endif @@ -769488,7 +771482,8 @@ label_BFC3C5F0: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC3C5F8: 312A0400 andi $t2, $t1, 0x400 */ - cpu->gpr[10] = cpu->gpr[9] & 0x400u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x400u; + PGXP_ALU(0x312A0400u, cpu->gpr[10], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x800545F8u); #endif @@ -769557,7 +771552,8 @@ label_BFC3C608: psx_cyc_step(cpu, 0x40002u); #endif /* 0xBFC3C608: 2A411389 slti $at, $s2, 5001 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (5001) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (5001) ? 1 : 0); + PGXP_ALU(0x2A411389u, cpu->gpr[1], _pgx1, 0x1389u); } #ifdef PSX_COSIM cosim_instr(0x80054608u); #endif @@ -769756,7 +771752,8 @@ label_BFC3C63C: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC3C644: 316C0400 andi $t4, $t3, 0x400 */ - cpu->gpr[12] = cpu->gpr[11] & 0x400u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x400u; + PGXP_ALU(0x316C0400u, cpu->gpr[12], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x80054644u); #endif @@ -769908,7 +771905,8 @@ label_BFC3C664: psx_cyc_step(cpu, 0x100002u); #endif /* 0xBFC3C66C: 2E810041 sltiu $at, $s4, 65 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[20] < 0x00000041u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[20]; cpu->gpr[1] = (uint32_t)(cpu->gpr[20] < 0x00000041u ? 1 : 0); + PGXP_ALU(0x2E810041u, cpu->gpr[1], _pgx1, 0x0041u); } #ifdef PSX_COSIM cosim_instr(0x8005466Cu); #endif @@ -769981,7 +771979,8 @@ label_BFC3C678: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C680: 3042FFCF andi $v0, $v0, 0xFFCF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFCFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFCFu; + PGXP_ALU(0x3042FFCFu, cpu->gpr[2], _pgx1, 0xFFCFu); } #ifdef PSX_COSIM cosim_instr(0x80054680u); #endif @@ -769989,7 +771988,8 @@ label_BFC3C678: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C684: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054684u); #endif @@ -770023,7 +772023,8 @@ label_BFC3C678: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC3C694: 31AE07FF andi $t6, $t5, 0x7FF */ - cpu->gpr[14] = cpu->gpr[13] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x7FFu; + PGXP_ALU(0x31AE07FFu, cpu->gpr[14], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80054694u); #endif @@ -770120,7 +772121,8 @@ label_BFC3C6A8: psx_cyc_step(cpu, 0x40002u); #endif /* 0xBFC3C6AC: 2A411389 slti $at, $s2, 5001 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (5001) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[18]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[18] < (5001) ? 1 : 0); + PGXP_ALU(0x2A411389u, cpu->gpr[1], _pgx1, 0x1389u); } #ifdef PSX_COSIM cosim_instr(0x800546ACu); #endif @@ -770298,7 +772300,8 @@ label_BFC3C6D8: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC3C6E0: 31F807FF andi $t8, $t7, 0x7FF */ - cpu->gpr[24] = cpu->gpr[15] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x7FFu; + PGXP_ALU(0x31F807FFu, cpu->gpr[24], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x800546E0u); #endif @@ -770929,7 +772932,8 @@ label_BFC3C710: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC3C72C: 30E707FF andi $a3, $a3, 0x7FF */ - cpu->gpr[7] = cpu->gpr[7] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0x7FFu; + PGXP_ALU(0x30E707FFu, cpu->gpr[7], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x8005472Cu); #endif @@ -770940,7 +772944,8 @@ label_BFC3C710: psx_cyc_step(cpu, 0x100u); #endif /* 0xBFC3C730: 3108000E andi $t0, $t0, 0xE */ - cpu->gpr[8] = cpu->gpr[8] & 0xEu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[8] = cpu->gpr[8] & 0xEu; + PGXP_ALU(0x3108000Eu, cpu->gpr[8], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0x80054730u); #endif @@ -770948,7 +772953,8 @@ label_BFC3C710: psx_cyc_step(cpu, 0x80u); #endif /* 0xBFC3C734: 30E7FFFF andi $a3, $a3, 0xFFFF */ - cpu->gpr[7] = cpu->gpr[7] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[7] = cpu->gpr[7] & 0xFFFFu; + PGXP_ALU(0x30E7FFFFu, cpu->gpr[7], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054734u); #endif @@ -771188,7 +773194,8 @@ label_BFC3C76C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3C774: 3319BFFF andi $t9, $t8, 0xBFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xBFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xBFFFu; + PGXP_ALU(0x3319BFFFu, cpu->gpr[25], _pgx1, 0xBFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054774u); #endif @@ -771250,7 +773257,8 @@ label_BFC3C780: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC3C788: 312A4000 andi $t2, $t1, 0x4000 */ - cpu->gpr[10] = cpu->gpr[9] & 0x4000u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x4000u; + PGXP_ALU(0x312A4000u, cpu->gpr[10], _pgx1, 0x4000u); } #ifdef PSX_COSIM cosim_instr(0x80054788u); #endif @@ -771453,7 +773461,8 @@ label_BFC3C7B0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C7B8: 3042FFBF andi $v0, $v0, 0xFFBF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFBFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFBFu; + PGXP_ALU(0x3042FFBFu, cpu->gpr[2], _pgx1, 0xFFBFu); } #ifdef PSX_COSIM cosim_instr(0x800547B8u); #endif @@ -771461,7 +773470,8 @@ label_BFC3C7B0: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C7BC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800547BCu); #endif @@ -771538,7 +773548,8 @@ label_BFC3C7C8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C7D4: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800547D4u); #endif @@ -771600,7 +773611,8 @@ label_BFC3C7E0: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC3C7E8: 318D0040 andi $t5, $t4, 0x40 */ - cpu->gpr[13] = cpu->gpr[12] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x40u; + PGXP_ALU(0x318D0040u, cpu->gpr[13], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x800547E8u); #endif @@ -771757,7 +773769,8 @@ label_BFC3C808: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3C810: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054810u); #endif @@ -771765,7 +773778,8 @@ label_BFC3C808: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3C814: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054814u); #endif @@ -771927,7 +773941,8 @@ label_BFC3C83C: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC3C850: 31F807FF andi $t8, $t7, 0x7FF */ - cpu->gpr[24] = cpu->gpr[15] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x7FFu; + PGXP_ALU(0x31F807FFu, cpu->gpr[24], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80054850u); #endif @@ -772027,7 +774042,8 @@ label_BFC3C864: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3C868: 28411389 slti $at, $v0, 5001 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (5001) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (5001) ? 1 : 0); + PGXP_ALU(0x28411389u, cpu->gpr[1], _pgx1, 0x1389u); } #ifdef PSX_COSIM cosim_instr(0x80054868u); #endif @@ -772205,7 +774221,8 @@ label_BFC3C894: psx_cyc_step(cpu, 0x2000200u); #endif /* 0xBFC3C89C: 332907FF andi $t1, $t9, 0x7FF */ - cpu->gpr[9] = cpu->gpr[25] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[9] = cpu->gpr[25] & 0x7FFu; + PGXP_ALU(0x332907FFu, cpu->gpr[9], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x8005489Cu); #endif @@ -772612,7 +774629,8 @@ label_BFC3C8F8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3C8FC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800548FCu); #endif @@ -772623,7 +774641,8 @@ label_BFC3C8F8: psx_cyc_step(cpu, 0x24u); #endif /* 0xBFC3C900: 3045FFFF andi $a1, $v0, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[5] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3045FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054900u); #endif @@ -772848,7 +774867,8 @@ label_BFC3C940: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC3C954: 318D07FF andi $t5, $t4, 0x7FF */ - cpu->gpr[13] = cpu->gpr[12] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0x7FFu; + PGXP_ALU(0x318D07FFu, cpu->gpr[13], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x80054954u); #endif @@ -772945,7 +774965,8 @@ label_BFC3C968: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3C96C: 28411389 slti $at, $v0, 5001 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (5001) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (5001) ? 1 : 0); + PGXP_ALU(0x28411389u, cpu->gpr[1], _pgx1, 0x1389u); } #ifdef PSX_COSIM cosim_instr(0x8005496Cu); #endif @@ -773123,7 +775144,8 @@ label_BFC3C998: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3C9A0: 31CF07FF andi $t7, $t6, 0x7FF */ - cpu->gpr[15] = cpu->gpr[14] & 0x7FFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x7FFu; + PGXP_ALU(0x31CF07FFu, cpu->gpr[15], _pgx1, 0x07FFu); } #ifdef PSX_COSIM cosim_instr(0x800549A0u); #endif @@ -773530,7 +775552,8 @@ label_BFC3C9FC: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3CA00: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054A00u); #endif @@ -773538,7 +775561,8 @@ label_BFC3C9FC: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC3CA04: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054A04u); #endif @@ -773865,7 +775889,8 @@ label_BFC3CA5C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CA64: 3042FFCF andi $v0, $v0, 0xFFCF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFCFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFCFu; + PGXP_ALU(0x3042FFCFu, cpu->gpr[2], _pgx1, 0xFFCFu); } #ifdef PSX_COSIM cosim_instr(0x80054A64u); #endif @@ -773873,7 +775898,8 @@ label_BFC3CA5C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CA68: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054A68u); #endif @@ -773970,7 +775996,8 @@ label_BFC3CA7C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CA84: 3042000E andi $v0, $v0, 0xE */ - cpu->gpr[2] = cpu->gpr[2] & 0xEu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xEu; + PGXP_ALU(0x3042000Eu, cpu->gpr[2], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0x80054A84u); #endif @@ -773987,7 +776014,8 @@ label_BFC3CA7C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CA8C: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054A8Cu); #endif @@ -774053,7 +776081,8 @@ label_BFC3CA98: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CAA0: 30420001 andi $v0, $v0, 0x1 */ - cpu->gpr[2] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x30420001u, cpu->gpr[2], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80054AA0u); #endif @@ -774061,7 +776090,8 @@ label_BFC3CA98: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CAA4: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054AA4u); #endif @@ -774135,7 +776165,8 @@ label_BFC3CAB4: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC3CABC: 31F8000E andi $t8, $t7, 0xE */ - cpu->gpr[24] = cpu->gpr[15] & 0xEu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xEu; + PGXP_ALU(0x31F8000Eu, cpu->gpr[24], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0x80054ABCu); #endif @@ -774210,7 +776241,8 @@ label_BFC3CACC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CAD4: 3042FF7F andi $v0, $v0, 0xFF7F */ - cpu->gpr[2] = cpu->gpr[2] & 0xFF7Fu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFF7Fu; + PGXP_ALU(0x3042FF7Fu, cpu->gpr[2], _pgx1, 0xFF7Fu); } #ifdef PSX_COSIM cosim_instr(0x80054AD4u); #endif @@ -774218,7 +776250,8 @@ label_BFC3CACC: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC3CAD8: 312A0001 andi $t2, $t1, 0x1 */ - cpu->gpr[10] = cpu->gpr[9] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0x1u; + PGXP_ALU(0x312A0001u, cpu->gpr[10], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80054AD8u); #endif @@ -774226,7 +776259,8 @@ label_BFC3CACC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CADC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054ADCu); #endif @@ -774255,7 +776289,8 @@ label_BFC3CACC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CAE8: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054AE8u); #endif @@ -774320,7 +776355,8 @@ label_BFC3CAF4: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3CAFC: 304C0080 andi $t4, $v0, 0x80 */ - cpu->gpr[12] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x304C0080u, cpu->gpr[12], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80054AFCu); #endif @@ -774479,7 +776515,8 @@ label_BFC3CB1C: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3CB24: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054B24u); #endif @@ -774843,7 +776880,8 @@ label_BFC3CB78: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC3CB7C: 312AFFFF andi $t2, $t1, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x312AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054B7Cu); #endif @@ -774911,7 +776949,8 @@ label_BFC3CB88: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC3CB90: 316CFFFF andi $t4, $t3, 0xFFFF */ - cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316CFFFFu, cpu->gpr[12], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054B90u); #endif @@ -774977,7 +777016,8 @@ label_BFC3CB9C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CBA4: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054BA4u); #endif @@ -774985,7 +777025,8 @@ label_BFC3CB9C: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CBA8: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054BA8u); #endif @@ -775131,7 +777172,8 @@ label_BFC3CBC8: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC3CBD0: 31F8FFFF andi $t8, $t7, 0xFFFF */ - cpu->gpr[24] = cpu->gpr[15] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xFFFFu; + PGXP_ALU(0x31F8FFFFu, cpu->gpr[24], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054BD0u); #endif @@ -775139,7 +777181,8 @@ label_BFC3CBC8: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3CBD4: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054BD4u); #endif @@ -775156,7 +777199,8 @@ label_BFC3CBC8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CBDC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054BDCu); #endif @@ -775200,7 +777244,8 @@ label_BFC3CBC8: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC3CBF0: 314B00FF andi $t3, $t2, 0xFF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFu; + PGXP_ALU(0x314B00FFu, cpu->gpr[11], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80054BF0u); #endif @@ -775208,7 +777253,8 @@ label_BFC3CBC8: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC3CBF4: 316CFFFF andi $t4, $t3, 0xFFFF */ - cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0xFFFFu; + PGXP_ALU(0x316CFFFFu, cpu->gpr[12], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054BF4u); #endif @@ -775225,7 +777271,8 @@ label_BFC3CBC8: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CBFC: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054BFCu); #endif @@ -775291,7 +777338,8 @@ label_BFC3CC08: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC3CC10: 31AE00FF andi $t6, $t5, 0xFF */ - cpu->gpr[14] = cpu->gpr[13] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0xFFu; + PGXP_ALU(0x31AE00FFu, cpu->gpr[14], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80054C10u); #endif @@ -775308,7 +777356,8 @@ label_BFC3CC08: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3CC18: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054C18u); #endif @@ -775383,7 +777432,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC3CC30: 314BFFFF andi $t3, $t2, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054C30u); #endif @@ -775391,7 +777441,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0x1801u); #endif /* 0xBFC3CC34: 01606027 nor $t4, $t3, $zero */ - cpu->gpr[12] = ~(cpu->gpr[11] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[12] = ~(cpu->gpr[11] | cpu->gpr[0]); + PGXP_ALU(0x01606027u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80054C34u); #endif @@ -775399,7 +777450,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC3CC38: 318DFFFF andi $t5, $t4, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[12] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0xFFFFu; + PGXP_ALU(0x318DFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054C38u); #endif @@ -775407,7 +777459,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0x2004u); #endif /* 0xBFC3CC3C: 004D1024 and $v0, $v0, $t5 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[13]; + PGXP_ALU(0x004D1024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80054C3Cu); #endif @@ -775418,7 +777471,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CC40: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054C40u); #endif @@ -775459,7 +777513,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC3CC54: 330F00FF andi $t7, $t8, 0xFF */ - cpu->gpr[15] = cpu->gpr[24] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[15] = cpu->gpr[24] & 0xFFu; + PGXP_ALU(0x330F00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80054C54u); #endif @@ -775467,7 +777522,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0x2008001u); #endif /* 0xBFC3CC58: 01E0C827 nor $t9, $t7, $zero */ - cpu->gpr[25] = ~(cpu->gpr[15] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[25] = ~(cpu->gpr[15] | cpu->gpr[0]); + PGXP_ALU(0x01E0C827u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80054C58u); #endif @@ -775475,7 +777531,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0x2000200u); #endif /* 0xBFC3CC5C: 3329FFFF andi $t1, $t9, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[25] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[9] = cpu->gpr[25] & 0xFFFFu; + PGXP_ALU(0x3329FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054C5Cu); #endif @@ -775486,7 +777543,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0x204u); #endif /* 0xBFC3CC60: 00491024 and $v0, $v0, $t1 */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[9]; + PGXP_ALU(0x00491024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80054C60u); #endif @@ -775494,7 +777552,8 @@ label_BFC3CC28: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC3CC64: 3042FFFF andi $v0, $v0, 0xFFFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x3042FFFFu, cpu->gpr[2], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80054C64u); #endif @@ -775700,7 +777759,8 @@ label_BFC3CC90: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CC98: 2CA1002E sltiu $at, $a1, 46 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000002Eu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000002Eu ? 1 : 0); + PGXP_ALU(0x2CA1002Eu, cpu->gpr[1], _pgx1, 0x002Eu); } #ifdef PSX_COSIM cosim_instr(0x80054C98u); #endif @@ -775782,7 +777842,8 @@ label_BFC3CCA4: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CCA8: 2CA10023 sltiu $at, $a1, 35 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000023u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000023u ? 1 : 0); + PGXP_ALU(0x2CA10023u, cpu->gpr[1], _pgx1, 0x0023u); } #ifdef PSX_COSIM cosim_instr(0x80054CA8u); #endif @@ -775864,7 +777925,8 @@ label_BFC3CCB4: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CCB8: 2CA10011 sltiu $at, $a1, 17 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000011u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000011u ? 1 : 0); + PGXP_ALU(0x2CA10011u, cpu->gpr[1], _pgx1, 0x0011u); } #ifdef PSX_COSIM cosim_instr(0x80054CB8u); #endif @@ -775946,7 +778008,8 @@ label_BFC3CCC4: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CCC8: 2CA10002 sltiu $at, $a1, 2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000002u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000002u ? 1 : 0); + PGXP_ALU(0x2CA10002u, cpu->gpr[1], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80054CC8u); #endif @@ -776259,7 +778322,8 @@ label_BFC3CD04: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CD0C: 2CA10021 sltiu $at, $a1, 33 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000021u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000021u ? 1 : 0); + PGXP_ALU(0x2CA10021u, cpu->gpr[1], _pgx1, 0x0021u); } #ifdef PSX_COSIM cosim_instr(0x80054D0Cu); #endif @@ -776518,7 +778582,8 @@ label_BFC3CD3C: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CD44: 2CA1002A sltiu $at, $a1, 42 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000002Au ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000002Au ? 1 : 0); + PGXP_ALU(0x2CA1002Au, cpu->gpr[1], _pgx1, 0x002Au); } #ifdef PSX_COSIM cosim_instr(0x80054D44u); #endif @@ -776597,7 +778662,8 @@ label_BFC3CD50: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CD54: 2CA10026 sltiu $at, $a1, 38 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000026u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000026u ? 1 : 0); + PGXP_ALU(0x2CA10026u, cpu->gpr[1], _pgx1, 0x0026u); } #ifdef PSX_COSIM cosim_instr(0x80054D54u); #endif @@ -776853,7 +778919,8 @@ label_BFC3CD84: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CD8C: 2CA1002C sltiu $at, $a1, 44 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000002Cu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000002Cu ? 1 : 0); + PGXP_ALU(0x2CA1002Cu, cpu->gpr[1], _pgx1, 0x002Cu); } #ifdef PSX_COSIM cosim_instr(0x80054D8Cu); #endif @@ -777112,7 +779179,8 @@ label_BFC3CDBC: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CDC4: 2CA10067 sltiu $at, $a1, 103 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000067u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000067u ? 1 : 0); + PGXP_ALU(0x2CA10067u, cpu->gpr[1], _pgx1, 0x0067u); } #ifdef PSX_COSIM cosim_instr(0x80054DC4u); #endif @@ -777191,7 +779259,8 @@ label_BFC3CDD0: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CDD4: 2CA10062 sltiu $at, $a1, 98 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000062u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000062u ? 1 : 0); + PGXP_ALU(0x2CA10062u, cpu->gpr[1], _pgx1, 0x0062u); } #ifdef PSX_COSIM cosim_instr(0x80054DD4u); #endif @@ -777270,7 +779339,8 @@ label_BFC3CDE0: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CDE4: 2CA10030 sltiu $at, $a1, 48 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000030u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000030u ? 1 : 0); + PGXP_ALU(0x2CA10030u, cpu->gpr[1], _pgx1, 0x0030u); } #ifdef PSX_COSIM cosim_instr(0x80054DE4u); #endif @@ -777526,7 +779596,8 @@ label_BFC3CE14: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CE1C: 2CA10064 sltiu $at, $a1, 100 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000064u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000064u ? 1 : 0); + PGXP_ALU(0x2CA10064u, cpu->gpr[1], _pgx1, 0x0064u); } #ifdef PSX_COSIM cosim_instr(0x80054E1Cu); #endif @@ -777785,7 +779856,8 @@ label_BFC3CE4C: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CE54: 2CA1006B sltiu $at, $a1, 107 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000006Bu ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x0000006Bu ? 1 : 0); + PGXP_ALU(0x2CA1006Bu, cpu->gpr[1], _pgx1, 0x006Bu); } #ifdef PSX_COSIM cosim_instr(0x80054E54u); #endif @@ -777864,7 +779936,8 @@ label_BFC3CE60: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CE64: 2CA10069 sltiu $at, $a1, 105 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000069u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000069u ? 1 : 0); + PGXP_ALU(0x2CA10069u, cpu->gpr[1], _pgx1, 0x0069u); } #ifdef PSX_COSIM cosim_instr(0x80054E64u); #endif @@ -778120,7 +780193,8 @@ label_BFC3CE94: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3CE9C: 2CA10102 sltiu $at, $a1, 258 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000102u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < 0x00000102u ? 1 : 0); + PGXP_ALU(0x2CA10102u, cpu->gpr[1], _pgx1, 0x0102u); } #ifdef PSX_COSIM cosim_instr(0x80054E9Cu); #endif @@ -778735,7 +780809,8 @@ label_BFC3CEEC: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC3CEEC: 304E0001 andi $t6, $v0, 0x1 */ - cpu->gpr[14] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80054EECu); #endif @@ -778935,7 +781010,8 @@ label_BFC3CF24: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC3CF24: 30580002 andi $t8, $v0, 0x2 */ - cpu->gpr[24] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30580002u, cpu->gpr[24], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80054F24u); #endif @@ -779057,7 +781133,8 @@ label_BFC3CF44: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC3CF44: 30480004 andi $t0, $v0, 0x4 */ - cpu->gpr[8] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30480004u, cpu->gpr[8], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80054F44u); #endif @@ -779179,7 +781256,8 @@ label_BFC3CF64: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC3CF64: 304A0008 andi $t2, $v0, 0x8 */ - cpu->gpr[10] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304A0008u, cpu->gpr[10], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80054F64u); #endif @@ -779301,7 +781379,8 @@ label_BFC3CF84: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3CF84: 304C0010 andi $t4, $v0, 0x10 */ - cpu->gpr[12] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304C0010u, cpu->gpr[12], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80054F84u); #endif @@ -779423,7 +781502,8 @@ label_BFC3CFA4: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC3CFA4: 304E0020 andi $t6, $v0, 0x20 */ - cpu->gpr[14] = cpu->gpr[2] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x20u; + PGXP_ALU(0x304E0020u, cpu->gpr[14], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x80054FA4u); #endif @@ -779545,7 +781625,8 @@ label_BFC3CFC4: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC3CFC4: 30580040 andi $t8, $v0, 0x40 */ - cpu->gpr[24] = cpu->gpr[2] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x40u; + PGXP_ALU(0x30580040u, cpu->gpr[24], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80054FC4u); #endif @@ -779667,7 +781748,8 @@ label_BFC3CFE4: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC3CFE4: 30480080 andi $t0, $v0, 0x80 */ - cpu->gpr[8] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x30480080u, cpu->gpr[8], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x80054FE4u); #endif @@ -779789,7 +781871,8 @@ label_BFC3D004: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC3D004: 304A0100 andi $t2, $v0, 0x100 */ - cpu->gpr[10] = cpu->gpr[2] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x100u; + PGXP_ALU(0x304A0100u, cpu->gpr[10], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x80055004u); #endif @@ -779911,7 +781994,8 @@ label_BFC3D024: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3D024: 304C0200 andi $t4, $v0, 0x200 */ - cpu->gpr[12] = cpu->gpr[2] & 0x200u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x200u; + PGXP_ALU(0x304C0200u, cpu->gpr[12], _pgx1, 0x0200u); } #ifdef PSX_COSIM cosim_instr(0x80055024u); #endif @@ -780033,7 +782117,8 @@ label_BFC3D044: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC3D044: 304E0400 andi $t6, $v0, 0x400 */ - cpu->gpr[14] = cpu->gpr[2] & 0x400u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x400u; + PGXP_ALU(0x304E0400u, cpu->gpr[14], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x80055044u); #endif @@ -780155,7 +782240,8 @@ label_BFC3D064: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC3D064: 30580800 andi $t8, $v0, 0x800 */ - cpu->gpr[24] = cpu->gpr[2] & 0x800u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x800u; + PGXP_ALU(0x30580800u, cpu->gpr[24], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0x80055064u); #endif @@ -780277,7 +782363,8 @@ label_BFC3D084: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC3D084: 30481000 andi $t0, $v0, 0x1000 */ - cpu->gpr[8] = cpu->gpr[2] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x1000u; + PGXP_ALU(0x30481000u, cpu->gpr[8], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80055084u); #endif @@ -780399,7 +782486,8 @@ label_BFC3D0A4: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC3D0A4: 304A2000 andi $t2, $v0, 0x2000 */ - cpu->gpr[10] = cpu->gpr[2] & 0x2000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x2000u; + PGXP_ALU(0x304A2000u, cpu->gpr[10], _pgx1, 0x2000u); } #ifdef PSX_COSIM cosim_instr(0x800550A4u); #endif @@ -780521,7 +782609,8 @@ label_BFC3D0C4: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3D0C4: 304C4000 andi $t4, $v0, 0x4000 */ - cpu->gpr[12] = cpu->gpr[2] & 0x4000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x4000u; + PGXP_ALU(0x304C4000u, cpu->gpr[12], _pgx1, 0x4000u); } #ifdef PSX_COSIM cosim_instr(0x800550C4u); #endif @@ -780643,7 +782732,8 @@ label_BFC3D0E4: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC3D0E4: 304E8000 andi $t6, $v0, 0x8000 */ - cpu->gpr[14] = cpu->gpr[2] & 0x8000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x8000u; + PGXP_ALU(0x304E8000u, cpu->gpr[14], _pgx1, 0x8000u); } #ifdef PSX_COSIM cosim_instr(0x800550E4u); #endif @@ -780766,7 +782856,8 @@ label_BFC3D104: psx_cyc_step(cpu, 0x1000006u); #endif /* 0xBFC3D104: 0041C024 and $t8, $v0, $at */ - cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x0041C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055104u); #endif @@ -780889,7 +782980,8 @@ label_BFC3D124: psx_cyc_step(cpu, 0x106u); #endif /* 0xBFC3D124: 00414024 and $t0, $v0, $at */ - cpu->gpr[8] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00414024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055124u); #endif @@ -781012,7 +783104,8 @@ label_BFC3D144: psx_cyc_step(cpu, 0x406u); #endif /* 0xBFC3D144: 00415024 and $t2, $v0, $at */ - cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00415024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055144u); #endif @@ -781135,7 +783228,8 @@ label_BFC3D164: psx_cyc_step(cpu, 0x1006u); #endif /* 0xBFC3D164: 00416024 and $t4, $v0, $at */ - cpu->gpr[12] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[12] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00416024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055164u); #endif @@ -781258,7 +783352,8 @@ label_BFC3D184: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC3D184: 00417024 and $t6, $v0, $at */ - cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00417024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055184u); #endif @@ -781381,7 +783476,8 @@ label_BFC3D1A4: psx_cyc_step(cpu, 0x1000006u); #endif /* 0xBFC3D1A4: 0041C024 and $t8, $v0, $at */ - cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x0041C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800551A4u); #endif @@ -781504,7 +783600,8 @@ label_BFC3D1C4: psx_cyc_step(cpu, 0x106u); #endif /* 0xBFC3D1C4: 00414024 and $t0, $v0, $at */ - cpu->gpr[8] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00414024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800551C4u); #endif @@ -781627,7 +783724,8 @@ label_BFC3D1E4: psx_cyc_step(cpu, 0x406u); #endif /* 0xBFC3D1E4: 00415024 and $t2, $v0, $at */ - cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00415024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800551E4u); #endif @@ -781750,7 +783848,8 @@ label_BFC3D204: psx_cyc_step(cpu, 0x1006u); #endif /* 0xBFC3D204: 00416024 and $t4, $v0, $at */ - cpu->gpr[12] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[12] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00416024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055204u); #endif @@ -781873,7 +783972,8 @@ label_BFC3D224: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC3D224: 00417024 and $t6, $v0, $at */ - cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00417024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055224u); #endif @@ -781996,7 +784096,8 @@ label_BFC3D244: psx_cyc_step(cpu, 0x1000006u); #endif /* 0xBFC3D244: 0041C024 and $t8, $v0, $at */ - cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x0041C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055244u); #endif @@ -782119,7 +784220,8 @@ label_BFC3D264: psx_cyc_step(cpu, 0x106u); #endif /* 0xBFC3D264: 00414024 and $t0, $v0, $at */ - cpu->gpr[8] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00414024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055264u); #endif @@ -782242,7 +784344,8 @@ label_BFC3D284: psx_cyc_step(cpu, 0x406u); #endif /* 0xBFC3D284: 00415024 and $t2, $v0, $at */ - cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[10] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00415024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055284u); #endif @@ -782365,7 +784468,8 @@ label_BFC3D2A4: psx_cyc_step(cpu, 0x1006u); #endif /* 0xBFC3D2A4: 00416024 and $t4, $v0, $at */ - cpu->gpr[12] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[12] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00416024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800552A4u); #endif @@ -782488,7 +784592,8 @@ label_BFC3D2C4: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC3D2C4: 00417024 and $t6, $v0, $at */ - cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00417024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800552C4u); #endif @@ -782611,7 +784716,8 @@ label_BFC3D2E4: psx_cyc_step(cpu, 0x1000006u); #endif /* 0xBFC3D2E4: 0041C024 and $t8, $v0, $at */ - cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x0041C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800552E4u); #endif @@ -783043,7 +785149,8 @@ label_BFC3D328: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC3D328: 304E0001 andi $t6, $v0, 0x1 */ - cpu->gpr[14] = cpu->gpr[2] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1u; + PGXP_ALU(0x304E0001u, cpu->gpr[14], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80055328u); #endif @@ -783240,7 +785347,8 @@ label_BFC3D360: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC3D360: 30580002 andi $t8, $v0, 0x2 */ - cpu->gpr[24] = cpu->gpr[2] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x2u; + PGXP_ALU(0x30580002u, cpu->gpr[24], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80055360u); #endif @@ -783362,7 +785470,8 @@ label_BFC3D380: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC3D380: 30480004 andi $t0, $v0, 0x4 */ - cpu->gpr[8] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30480004u, cpu->gpr[8], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80055380u); #endif @@ -783484,7 +785593,8 @@ label_BFC3D3A0: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC3D3A0: 304A0008 andi $t2, $v0, 0x8 */ - cpu->gpr[10] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304A0008u, cpu->gpr[10], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x800553A0u); #endif @@ -783606,7 +785716,8 @@ label_BFC3D3C0: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3D3C0: 304C0010 andi $t4, $v0, 0x10 */ - cpu->gpr[12] = cpu->gpr[2] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x10u; + PGXP_ALU(0x304C0010u, cpu->gpr[12], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x800553C0u); #endif @@ -783728,7 +785839,8 @@ label_BFC3D3E0: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC3D3E0: 304E0020 andi $t6, $v0, 0x20 */ - cpu->gpr[14] = cpu->gpr[2] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x20u; + PGXP_ALU(0x304E0020u, cpu->gpr[14], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x800553E0u); #endif @@ -783850,7 +785962,8 @@ label_BFC3D400: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC3D400: 30580100 andi $t8, $v0, 0x100 */ - cpu->gpr[24] = cpu->gpr[2] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x100u; + PGXP_ALU(0x30580100u, cpu->gpr[24], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x80055400u); #endif @@ -783970,7 +786083,8 @@ label_BFC3D41C: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3D424: 3109FFFB andi $t1, $t0, 0xFFFB */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFBu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFBu; + PGXP_ALU(0x3109FFFBu, cpu->gpr[9], _pgx1, 0xFFFBu); } #ifdef PSX_COSIM cosim_instr(0x80055424u); #endif @@ -784099,7 +786213,8 @@ label_BFC3D448: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3D448: 304C0400 andi $t4, $v0, 0x400 */ - cpu->gpr[12] = cpu->gpr[2] & 0x400u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x400u; + PGXP_ALU(0x304C0400u, cpu->gpr[12], _pgx1, 0x0400u); } #ifdef PSX_COSIM cosim_instr(0x80055448u); #endif @@ -784219,7 +786334,8 @@ label_BFC3D464: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3D46C: 31CFFFFE andi $t7, $t6, 0xFFFE */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFEu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFEu; + PGXP_ALU(0x31CFFFFEu, cpu->gpr[15], _pgx1, 0xFFFEu); } #ifdef PSX_COSIM cosim_instr(0x8005546Cu); #endif @@ -784354,7 +786470,8 @@ label_BFC3D490: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC3D490: 30480040 andi $t0, $v0, 0x40 */ - cpu->gpr[8] = cpu->gpr[2] & 0x40u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x40u; + PGXP_ALU(0x30480040u, cpu->gpr[8], _pgx1, 0x0040u); } #ifdef PSX_COSIM cosim_instr(0x80055490u); #endif @@ -784476,7 +786593,8 @@ label_BFC3D4B0: psx_cyc_step(cpu, 0x404u); #endif /* 0xBFC3D4B0: 304A0080 andi $t2, $v0, 0x80 */ - cpu->gpr[10] = cpu->gpr[2] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] = cpu->gpr[2] & 0x80u; + PGXP_ALU(0x304A0080u, cpu->gpr[10], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x800554B0u); #endif @@ -784598,7 +786716,8 @@ label_BFC3D4D0: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3D4D0: 304C0200 andi $t4, $v0, 0x200 */ - cpu->gpr[12] = cpu->gpr[2] & 0x200u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x200u; + PGXP_ALU(0x304C0200u, cpu->gpr[12], _pgx1, 0x0200u); } #ifdef PSX_COSIM cosim_instr(0x800554D0u); #endif @@ -784718,7 +786837,8 @@ label_BFC3D4EC: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3D4F4: 31CFFFF7 andi $t7, $t6, 0xFFF7 */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFF7u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFF7u; + PGXP_ALU(0x31CFFFF7u, cpu->gpr[15], _pgx1, 0xFFF7u); } #ifdef PSX_COSIM cosim_instr(0x800554F4u); #endif @@ -784847,7 +786967,8 @@ label_BFC3D518: psx_cyc_step(cpu, 0x104u); #endif /* 0xBFC3D518: 30480800 andi $t0, $v0, 0x800 */ - cpu->gpr[8] = cpu->gpr[2] & 0x800u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[8] = cpu->gpr[2] & 0x800u; + PGXP_ALU(0x30480800u, cpu->gpr[8], _pgx1, 0x0800u); } #ifdef PSX_COSIM cosim_instr(0x80055518u); #endif @@ -784967,7 +787088,8 @@ label_BFC3D534: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC3D53C: 314BFFFD andi $t3, $t2, 0xFFFD */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFFDu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFFDu; + PGXP_ALU(0x314BFFFDu, cpu->gpr[11], _pgx1, 0xFFFDu); } #ifdef PSX_COSIM cosim_instr(0x8005553Cu); #endif @@ -785102,7 +787224,8 @@ label_BFC3D560: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC3D560: 304E1000 andi $t6, $v0, 0x1000 */ - cpu->gpr[14] = cpu->gpr[2] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0x1000u; + PGXP_ALU(0x304E1000u, cpu->gpr[14], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80055560u); #endif @@ -785166,7 +787289,8 @@ label_BFC3D56C: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC3D574: 31F8C0FF andi $t8, $t7, 0xC0FF */ - cpu->gpr[24] = cpu->gpr[15] & 0xC0FFu; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0xC0FFu; + PGXP_ALU(0x31F8C0FFu, cpu->gpr[24], _pgx1, 0xC0FFu); } #ifdef PSX_COSIM cosim_instr(0x80055574u); #endif @@ -785198,7 +787322,8 @@ label_BFC3D56C: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3D584: 3109003F andi $t1, $t0, 0x3F */ - cpu->gpr[9] = cpu->gpr[8] & 0x3Fu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x3Fu; + PGXP_ALU(0x3109003Fu, cpu->gpr[9], _pgx1, 0x003Fu); } #ifdef PSX_COSIM cosim_instr(0x80055584u); #endif @@ -785215,7 +787340,8 @@ label_BFC3D56C: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC3D58C: 314BFFFF andi $t3, $t2, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8005558Cu); #endif @@ -785293,7 +787419,8 @@ label_BFC3D5A0: psx_cyc_step(cpu, 0x2004u); #endif /* 0xBFC3D5A0: 304D2000 andi $t5, $v0, 0x2000 */ - cpu->gpr[13] = cpu->gpr[2] & 0x2000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[13] = cpu->gpr[2] & 0x2000u; + PGXP_ALU(0x304D2000u, cpu->gpr[13], _pgx1, 0x2000u); } #ifdef PSX_COSIM cosim_instr(0x800555A0u); #endif @@ -785357,7 +787484,8 @@ label_BFC3D5AC: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3D5B4: 31CFFF7F andi $t7, $t6, 0xFF7F */ - cpu->gpr[15] = cpu->gpr[14] & 0xFF7Fu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFF7Fu; + PGXP_ALU(0x31CFFF7Fu, cpu->gpr[15], _pgx1, 0xFF7Fu); } #ifdef PSX_COSIM cosim_instr(0x800555B4u); #endif @@ -785389,7 +787517,8 @@ label_BFC3D5AC: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3D5C4: 31090001 andi $t1, $t0, 0x1 */ - cpu->gpr[9] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31090001u, cpu->gpr[9], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800555C4u); #endif @@ -785406,7 +787535,8 @@ label_BFC3D5AC: psx_cyc_step(cpu, 0x2000400u); #endif /* 0xBFC3D5CC: 3159FFFF andi $t9, $t2, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[25] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x3159FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800555CCu); #endif @@ -785484,7 +787614,8 @@ label_BFC3D5E0: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC3D5E0: 304C4000 andi $t4, $v0, 0x4000 */ - cpu->gpr[12] = cpu->gpr[2] & 0x4000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x4000u; + PGXP_ALU(0x304C4000u, cpu->gpr[12], _pgx1, 0x4000u); } #ifdef PSX_COSIM cosim_instr(0x800555E0u); #endif @@ -785548,7 +787679,8 @@ label_BFC3D5EC: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC3D5F4: 31AEFFF1 andi $t6, $t5, 0xFFF1 */ - cpu->gpr[14] = cpu->gpr[13] & 0xFFF1u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0xFFF1u; + PGXP_ALU(0x31AEFFF1u, cpu->gpr[14], _pgx1, 0xFFF1u); } #ifdef PSX_COSIM cosim_instr(0x800555F4u); #endif @@ -785580,7 +787712,8 @@ label_BFC3D5EC: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3D604: 31090007 andi $t1, $t0, 0x7 */ - cpu->gpr[9] = cpu->gpr[8] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x7u; + PGXP_ALU(0x31090007u, cpu->gpr[9], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x80055604u); #endif @@ -785597,7 +787730,8 @@ label_BFC3D5EC: psx_cyc_step(cpu, 0x1000400u); #endif /* 0xBFC3D60C: 3158FFFF andi $t8, $t2, 0xFFFF */ - cpu->gpr[24] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[24] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x3158FFFFu, cpu->gpr[24], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8005560Cu); #endif @@ -785675,7 +787809,8 @@ label_BFC3D620: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC3D620: 304B8000 andi $t3, $v0, 0x8000 */ - cpu->gpr[11] = cpu->gpr[2] & 0x8000u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x8000u; + PGXP_ALU(0x304B8000u, cpu->gpr[11], _pgx1, 0x8000u); } #ifdef PSX_COSIM cosim_instr(0x80055620u); #endif @@ -785739,7 +787874,8 @@ label_BFC3D62C: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC3D634: 318DFFFE andi $t5, $t4, 0xFFFE */ - cpu->gpr[13] = cpu->gpr[12] & 0xFFFEu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0xFFFEu; + PGXP_ALU(0x318DFFFEu, cpu->gpr[13], _pgx1, 0xFFFEu); } #ifdef PSX_COSIM cosim_instr(0x80055634u); #endif @@ -785771,7 +787907,8 @@ label_BFC3D62C: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3D644: 31090001 andi $t1, $t0, 0x1 */ - cpu->gpr[9] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31090001u, cpu->gpr[9], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80055644u); #endif @@ -785779,7 +787916,8 @@ label_BFC3D62C: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC3D648: 312AFFFF andi $t2, $t1, 0xFFFF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFFFFu; + PGXP_ALU(0x312AFFFFu, cpu->gpr[10], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80055648u); #endif @@ -785951,7 +788089,8 @@ label_BFC3D65C: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3D670: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80055670u); #endif @@ -785985,7 +788124,8 @@ label_BFC3D65C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3D680: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80055680u); #endif @@ -786019,7 +788159,8 @@ label_BFC3D65C: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3D690: 3109FFFF andi $t1, $t0, 0xFFFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFFFu; + PGXP_ALU(0x3109FFFFu, cpu->gpr[9], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80055690u); #endif @@ -786053,7 +788194,8 @@ label_BFC3D65C: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC3D6A0: 314BFFFF andi $t3, $t2, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800556A0u); #endif @@ -786087,7 +788229,8 @@ label_BFC3D65C: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC3D6B0: 318DFFFF andi $t5, $t4, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[12] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0xFFFFu; + PGXP_ALU(0x318DFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800556B0u); #endif @@ -786121,7 +788264,8 @@ label_BFC3D65C: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3D6C0: 31CFFFFF andi $t7, $t6, 0xFFFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFFFu; + PGXP_ALU(0x31CFFFFFu, cpu->gpr[15], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800556C0u); #endif @@ -786155,7 +788299,8 @@ label_BFC3D65C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3D6D0: 33190004 andi $t9, $t8, 0x4 */ - cpu->gpr[25] = cpu->gpr[24] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x4u; + PGXP_ALU(0x33190004u, cpu->gpr[25], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x800556D0u); #endif @@ -786296,7 +788441,8 @@ label_BFC3D6F0: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3D6F8: 31090001 andi $t1, $t0, 0x1 */ - cpu->gpr[9] = cpu->gpr[8] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x1u; + PGXP_ALU(0x31090001u, cpu->gpr[9], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800556F8u); #endif @@ -786419,7 +788565,8 @@ label_BFC3D710: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC3D718: 314BFFFF andi $t3, $t2, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80055718u); #endif @@ -786453,7 +788600,8 @@ label_BFC3D710: psx_cyc_step(cpu, 0x3000u); #endif /* 0xBFC3D728: 318DFFFF andi $t5, $t4, 0xFFFF */ - cpu->gpr[13] = cpu->gpr[12] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[12] & 0xFFFFu; + PGXP_ALU(0x318DFFFFu, cpu->gpr[13], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80055728u); #endif @@ -786487,7 +788635,8 @@ label_BFC3D710: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3D738: 31CF0008 andi $t7, $t6, 0x8 */ - cpu->gpr[15] = cpu->gpr[14] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x8u; + PGXP_ALU(0x31CF0008u, cpu->gpr[15], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80055738u); #endif @@ -786610,7 +788759,8 @@ label_BFC3D750: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3D758: 33190002 andi $t9, $t8, 0x2 */ - cpu->gpr[25] = cpu->gpr[24] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x2u; + PGXP_ALU(0x33190002u, cpu->gpr[25], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80055758u); #endif @@ -786733,7 +788883,8 @@ label_BFC3D770: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3D778: 31093F00 andi $t1, $t0, 0x3F00 */ - cpu->gpr[9] = cpu->gpr[8] & 0x3F00u; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0x3F00u; + PGXP_ALU(0x31093F00u, cpu->gpr[9], _pgx1, 0x3F00u); } #ifdef PSX_COSIM cosim_instr(0x80055778u); #endif @@ -786776,7 +788927,8 @@ label_BFC3D770: psx_cyc_step(cpu, 0x1800u); #endif /* 0xBFC3D78C: 316C0080 andi $t4, $t3, 0x80 */ - cpu->gpr[12] = cpu->gpr[11] & 0x80u; + { uint32_t _pgx1 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[11] & 0x80u; + PGXP_ALU(0x316C0080u, cpu->gpr[12], _pgx1, 0x0080u); } #ifdef PSX_COSIM cosim_instr(0x8005578Cu); #endif @@ -786914,7 +789066,8 @@ label_BFC3D7A8: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3D7B0: 31CF000E andi $t7, $t6, 0xE */ - cpu->gpr[15] = cpu->gpr[14] & 0xEu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xEu; + PGXP_ALU(0x31CF000Eu, cpu->gpr[15], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0x800557B0u); #endif @@ -786957,7 +789110,8 @@ label_BFC3D7A8: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC3D7C4: 33280001 andi $t0, $t9, 0x1 */ - cpu->gpr[8] = cpu->gpr[25] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x1u; + PGXP_ALU(0x33280001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x800557C4u); #endif @@ -787084,7 +789238,8 @@ label_BFC3D7E0: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC3D7E8: 314BFFFF andi $t3, $t2, 0xFFFF */ - cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0xFFFFu; + PGXP_ALU(0x314BFFFFu, cpu->gpr[11], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800557E8u); #endif @@ -787104,7 +789259,8 @@ label_BFC3D7E0: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC3D7F0: 31AEFFFF andi $t6, $t5, 0xFFFF */ - cpu->gpr[14] = cpu->gpr[13] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0xFFFFu; + PGXP_ALU(0x31AEFFFFu, cpu->gpr[14], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x800557F0u); #endif @@ -787148,7 +789304,8 @@ label_BFC3D7E0: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3D804: 3319FFFF andi $t9, $t8, 0xFFFF */ - cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0xFFFFu; + PGXP_ALU(0x3319FFFFu, cpu->gpr[25], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80055804u); #endif @@ -787299,7 +789456,8 @@ label_BFC3D828: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC3D830: 31CF0001 andi $t7, $t6, 0x1 */ - cpu->gpr[15] = cpu->gpr[14] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x1u; + PGXP_ALU(0x31CF0001u, cpu->gpr[15], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80055830u); #endif @@ -788102,7 +790260,8 @@ label_BFC3D8E8: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC3D908: 3063000E andi $v1, $v1, 0xE */ - cpu->gpr[3] = cpu->gpr[3] & 0xEu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xEu; + PGXP_ALU(0x3063000Eu, cpu->gpr[3], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0x80055908u); #endif @@ -788493,7 +790652,8 @@ label_BFC3D98C: psx_cyc_step(cpu, 0x3000000u); #endif /* 0xBFC3D994: 33190001 andi $t9, $t8, 0x1 */ - cpu->gpr[25] = cpu->gpr[24] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[25] = cpu->gpr[24] & 0x1u; + PGXP_ALU(0x33190001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80055994u); #endif @@ -788583,7 +790743,8 @@ label_BFC3D9A4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3D9B0: 2841000A slti $at, $v0, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (10) ? 1 : 0); + PGXP_ALU(0x2841000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x800559B0u); #endif @@ -789771,7 +791932,8 @@ label_BFC3DB20: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC3DB28: 314B0008 andi $t3, $t2, 0x8 */ - cpu->gpr[11] = cpu->gpr[10] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x8u; + PGXP_ALU(0x314B0008u, cpu->gpr[11], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80055B28u); #endif @@ -790617,7 +792779,8 @@ label_BFC3DC38: psx_cyc_step(cpu, 0xA00u); #endif /* 0xBFC3DC40: 312B0010 andi $t3, $t1, 0x10 */ - cpu->gpr[11] = cpu->gpr[9] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[11] = cpu->gpr[9] & 0x10u; + PGXP_ALU(0x312B0010u, cpu->gpr[11], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80055C40u); #endif @@ -791723,7 +793886,8 @@ label_BFC3DD8C: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC3DD94: 31AE0002 andi $t6, $t5, 0x2 */ - cpu->gpr[14] = cpu->gpr[13] & 0x2u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x2u; + PGXP_ALU(0x31AE0002u, cpu->gpr[14], _pgx1, 0x0002u); } #ifdef PSX_COSIM cosim_instr(0x80055D94u); #endif @@ -791913,7 +794077,8 @@ label_BFC3DDD0: psx_cyc_step(cpu, 0xA00u); #endif /* 0xBFC3DDD8: 312B0004 andi $t3, $t1, 0x4 */ - cpu->gpr[11] = cpu->gpr[9] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[11] = cpu->gpr[9] & 0x4u; + PGXP_ALU(0x312B0004u, cpu->gpr[11], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80055DD8u); #endif @@ -792260,7 +794425,8 @@ label_BFC3DED0: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3DEDC: 00A1082B sltu $at, $a1, $at */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[1] ? 1 : 0); + PGXP_ALU(0x00A1082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055EDCu); #endif @@ -792941,7 +795107,8 @@ label_BFC3DF90: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC3DF9C: 0081082B sltu $at, $a0, $at */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[1] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[1] ? 1 : 0); + PGXP_ALU(0x0081082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055F9Cu); #endif @@ -793032,7 +795199,8 @@ label_BFC3DFB0: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC3DFB0: 2C811000 sltiu $at, $a0, 4096 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00001000u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < 0x00001000u ? 1 : 0); + PGXP_ALU(0x2C811000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80055FB0u); #endif @@ -793047,7 +795215,8 @@ label_BFC3DFB0: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC3DFB8: 308E0007 andi $t6, $a0, 0x7 */ - cpu->gpr[14] = cpu->gpr[4] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0x7u; + PGXP_ALU(0x308E0007u, cpu->gpr[14], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x80055FB8u); #endif @@ -793122,7 +795291,8 @@ label_BFC3DFC4: psx_cyc_step(cpu, 0x4010u); #endif /* 0xBFC3DFC4: 308E0007 andi $t6, $a0, 0x7 */ - cpu->gpr[14] = cpu->gpr[4] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[4] & 0x7u; + PGXP_ALU(0x308E0007u, cpu->gpr[14], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x80055FC4u); #endif @@ -793240,7 +795410,8 @@ label_BFC3DFD8: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC3DFE0: 00812024 and $a0, $a0, $at */ - cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[4] = cpu->gpr[4] & cpu->gpr[1]; + PGXP_ALU(0x00812024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80055FE0u); #endif @@ -794720,7 +796891,8 @@ label_BFC3E164: psx_cyc_step(cpu, 0x4840u); #endif /* 0xBFC3E16C: 00CB7024 and $t6, $a2, $t3 */ - cpu->gpr[14] = cpu->gpr[6] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[14] = cpu->gpr[6] & cpu->gpr[11]; + PGXP_ALU(0x00CB7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005616Cu); #endif @@ -794834,7 +797006,8 @@ label_BFC3E184: psx_cyc_step(cpu, 0x1000C00u); #endif /* 0xBFC3E190: 014BC024 and $t8, $t2, $t3 */ - cpu->gpr[24] = cpu->gpr[10] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[24] = cpu->gpr[10] & cpu->gpr[11]; + PGXP_ALU(0x014BC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056190u); #endif @@ -794906,7 +797079,8 @@ label_BFC3E19C: psx_cyc_step(cpu, 0x1000C00u); #endif /* 0xBFC3E19C: 014BC024 and $t8, $t2, $t3 */ - cpu->gpr[24] = cpu->gpr[10] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[24] = cpu->gpr[10] & cpu->gpr[11]; + PGXP_ALU(0x014BC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005619Cu); #endif @@ -794969,7 +797143,8 @@ label_BFC3E1A8: psx_cyc_step(cpu, 0x2002040u); #endif /* 0xBFC3E1AC: 00CDC824 and $t9, $a2, $t5 */ - cpu->gpr[25] = cpu->gpr[6] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[25] = cpu->gpr[6] & cpu->gpr[13]; + PGXP_ALU(0x00CDC824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800561ACu); #endif @@ -794980,7 +797155,8 @@ label_BFC3E1A8: psx_cyc_step(cpu, 0x1002400u); #endif /* 0xBFC3E1B0: 014DC024 and $t8, $t2, $t5 */ - cpu->gpr[24] = cpu->gpr[10] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[24] = cpu->gpr[10] & cpu->gpr[13]; + PGXP_ALU(0x014DC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800561B0u); #endif @@ -795148,7 +797324,8 @@ label_BFC3E1E4: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC3E1E4: 0043082A slt $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800561E4u); #endif @@ -795352,7 +797529,8 @@ label_BFC3E20C: psx_cyc_step(cpu, 0x3010000u); #endif /* 0xBFC3E214: 0310C824 and $t9, $t8, $s0 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[16]; + PGXP_ALU(0x0310C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056214u); #endif @@ -795459,7 +797637,8 @@ label_BFC3E22C: psx_cyc_step(cpu, 0x4006u); #endif /* 0xBFC3E22C: 004E082A slt $at, $v0, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x004E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005622Cu); #endif @@ -795564,7 +797743,8 @@ label_BFC3E244: psx_cyc_step(cpu, 0x1010400u); #endif /* 0xBFC3E24C: 0150C024 and $t8, $t2, $s0 */ - cpu->gpr[24] = cpu->gpr[10] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[24] = cpu->gpr[10] & cpu->gpr[16]; + PGXP_ALU(0x0150C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005624Cu); #endif @@ -795621,7 +797801,8 @@ label_BFC3E258: psx_cyc_step(cpu, 0x2002400u); #endif /* 0xBFC3E25C: 014DC824 and $t9, $t2, $t5 */ - cpu->gpr[25] = cpu->gpr[10] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[25] = cpu->gpr[10] & cpu->gpr[13]; + PGXP_ALU(0x014DC824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005625Cu); #endif @@ -795632,7 +797813,8 @@ label_BFC3E258: psx_cyc_step(cpu, 0x6040u); #endif /* 0xBFC3E260: 00CD7024 and $t6, $a2, $t5 */ - cpu->gpr[14] = cpu->gpr[6] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[6] & cpu->gpr[13]; + PGXP_ALU(0x00CD7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056260u); #endif @@ -795640,7 +797822,8 @@ label_BFC3E258: psx_cyc_step(cpu, 0x2004002u); #endif /* 0xBFC3E264: 032E082B sltu $at, $t9, $t6 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[25] < cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)(cpu->gpr[25] < cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x032E082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056264u); #endif @@ -795769,7 +797952,8 @@ label_BFC3E28C: psx_cyc_step(cpu, 0x8Au); #endif /* 0xBFC3E290: 00E3082A slt $at, $a3, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x00E3082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056290u); #endif @@ -795836,7 +798020,8 @@ label_BFC3E2A0: psx_cyc_step(cpu, 0xEu); #endif /* 0xBFC3E2A0: 0043082A slt $at, $v0, $v1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[3]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (int32_t)cpu->gpr[3] ? 1 : 0); + PGXP_ALU(0x0043082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800562A0u); #endif @@ -795978,7 +798163,8 @@ label_BFC3E2BC: psx_cyc_step(cpu, 0x1010040u); #endif /* 0xBFC3E2C4: 00D0C024 and $t8, $a2, $s0 */ - cpu->gpr[24] = cpu->gpr[6] & cpu->gpr[16]; + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[16]; cpu->gpr[24] = cpu->gpr[6] & cpu->gpr[16]; + PGXP_ALU(0x00D0C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800562C4u); #endif @@ -796466,7 +798652,8 @@ label_BFC3E32C: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC3E35C: 3063000E andi $v1, $v1, 0xE */ - cpu->gpr[3] = cpu->gpr[3] & 0xEu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xEu; + PGXP_ALU(0x3063000Eu, cpu->gpr[3], _pgx1, 0x000Eu); } #ifdef PSX_COSIM cosim_instr(0x8005635Cu); #endif @@ -796997,7 +799184,8 @@ label_BFC3E3F0: psx_cyc_step(cpu, 0x2000005u); #endif /* 0xBFC3E3F4: 0040C827 nor $t9, $v0, $zero */ - cpu->gpr[25] = ~(cpu->gpr[2] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[25] = ~(cpu->gpr[2] | cpu->gpr[0]); + PGXP_ALU(0x0040C827u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800563F4u); #endif @@ -797005,7 +799193,8 @@ label_BFC3E3F0: psx_cyc_step(cpu, 0x2008100u); #endif /* 0xBFC3E3F8: 01197824 and $t7, $t0, $t9 */ - cpu->gpr[15] = cpu->gpr[8] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[15] = cpu->gpr[8] & cpu->gpr[25]; + PGXP_ALU(0x01197824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800563F8u); #endif @@ -797166,7 +799355,8 @@ label_BFC3E410: psx_cyc_step(cpu, 0x1004040u); #endif /* 0xBFC3E428: 01C6C024 and $t8, $t6, $a2 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[6]; + PGXP_ALU(0x01C6C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056428u); #endif @@ -797554,7 +799744,8 @@ label_BFC3E49C: psx_cyc_step(cpu, 0x8044u); #endif /* 0xBFC3E4A4: 00467824 and $t7, $v0, $a2 */ - cpu->gpr[15] = cpu->gpr[2] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[2] & cpu->gpr[6]; + PGXP_ALU(0x00467824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800564A4u); #endif @@ -797601,7 +799792,8 @@ label_BFC3E4B0: psx_cyc_step(cpu, 0x4014u); #endif /* 0xBFC3E4B0: 00447024 and $t6, $v0, $a0 */ - cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[4]; + PGXP_ALU(0x00447024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800564B0u); #endif @@ -797665,7 +799857,8 @@ label_BFC3E4BC: psx_cyc_step(cpu, 0x1000102u); #endif /* 0xBFC3E4C4: 0308082B sltu $at, $t8, $t0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0308082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800564C4u); #endif @@ -797801,7 +799994,8 @@ label_BFC3E4E0: psx_cyc_step(cpu, 0x422u); #endif /* 0xBFC3E4E4: 00AA082A slt $at, $a1, $t2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (int32_t)cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x00AA082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800564E4u); #endif @@ -797996,7 +800190,8 @@ label_BFC3E508: psx_cyc_step(cpu, 0x8240u); #endif /* 0xBFC3E514: 01267824 and $t7, $t1, $a2 */ - cpu->gpr[15] = cpu->gpr[9] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[9] & cpu->gpr[6]; + PGXP_ALU(0x01267824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056514u); #endif @@ -798011,7 +800206,8 @@ label_BFC3E508: psx_cyc_step(cpu, 0xC02u); #endif /* 0xBFC3E51C: 016A082A slt $at, $t3, $t2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (int32_t)cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[11] < (int32_t)cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x016A082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005651Cu); #endif @@ -798108,7 +800304,8 @@ label_BFC3E528: psx_cyc_step(cpu, 0x1000102u); #endif /* 0xBFC3E534: 0308082B sltu $at, $t8, $t0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[8] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)(cpu->gpr[24] < cpu->gpr[8] ? 1 : 0); + PGXP_ALU(0x0308082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056534u); #endif @@ -798182,7 +800379,8 @@ label_BFC3E540: psx_cyc_step(cpu, 0x8210u); #endif /* 0xBFC3E54C: 01247824 and $t7, $t1, $a0 */ - cpu->gpr[15] = cpu->gpr[9] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[15] = cpu->gpr[9] & cpu->gpr[4]; + PGXP_ALU(0x01247824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005654Cu); #endif @@ -798292,7 +800490,8 @@ label_BFC3E540: psx_cyc_step(cpu, 0x1004010u); #endif /* 0xBFC3E57C: 01C4C024 and $t8, $t6, $a0 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[4]; + PGXP_ALU(0x01C4C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005657Cu); #endif @@ -798452,7 +800651,8 @@ label_BFC3E5A0: psx_cyc_step(cpu, 0x142u); #endif /* 0xBFC3E5A8: 0106082B sltu $at, $t0, $a2 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)(cpu->gpr[8] < cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x0106082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800565A8u); #endif @@ -798529,7 +800729,8 @@ label_BFC3E5B4: psx_cyc_step(cpu, 0x482u); #endif /* 0xBFC3E5C0: 00EA082A slt $at, $a3, $t2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[10] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[7] < (int32_t)cpu->gpr[10] ? 1 : 0); + PGXP_ALU(0x00EA082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800565C0u); #endif @@ -798752,7 +800953,8 @@ label_BFC3E610: psx_cyc_step(cpu, 0x2000210u); #endif /* 0xBFC3E614: 0124C824 and $t9, $t1, $a0 */ - cpu->gpr[25] = cpu->gpr[9] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[9] & cpu->gpr[4]; + PGXP_ALU(0x0124C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056614u); #endif @@ -799229,7 +801431,8 @@ label_BFC3E694: psx_cyc_step(cpu, 0x100Au); #endif /* 0xBFC3E698: 00616024 and $t4, $v1, $at */ - cpu->gpr[12] = cpu->gpr[3] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[12] = cpu->gpr[3] & cpu->gpr[1]; + PGXP_ALU(0x00616024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056698u); #endif @@ -799289,7 +801492,8 @@ label_BFC3E6A4: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC3E6A8: 00612024 and $a0, $v1, $at */ - cpu->gpr[4] = cpu->gpr[3] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[4] = cpu->gpr[3] & cpu->gpr[1]; + PGXP_ALU(0x00612024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800566A8u); #endif @@ -799394,7 +801598,8 @@ label_BFC3E6C4: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC3E6CC: 00612024 and $a0, $v1, $at */ - cpu->gpr[4] = cpu->gpr[3] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[4] = cpu->gpr[3] & cpu->gpr[1]; + PGXP_ALU(0x00612024u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800566CCu); #endif @@ -799459,7 +801664,8 @@ label_BFC3E6E4: psx_cyc_step(cpu, 0x2042u); #endif /* 0xBFC3E6E4: 01A6082A slt $at, $t5, $a2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x01A6082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800566E4u); #endif @@ -799666,7 +801872,8 @@ label_BFC3E708: psx_cyc_step(cpu, 0x8202u); #endif /* 0xBFC3E71C: 01E9082A slt $at, $t7, $t1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x01E9082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005671Cu); #endif @@ -799812,7 +802019,8 @@ label_BFC3E734: psx_cyc_step(cpu, 0x3000002u); #endif /* 0xBFC3E744: 0301C824 and $t9, $t8, $at */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[1]; + PGXP_ALU(0x0301C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056744u); #endif @@ -800009,7 +802217,8 @@ label_BFC3E77C: psx_cyc_step(cpu, 0x2000202u); #endif /* 0xBFC3E790: 0139082A slt $at, $t1, $t9 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0139082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056790u); #endif @@ -800155,7 +802364,8 @@ label_BFC3E7A8: psx_cyc_step(cpu, 0x1004002u); #endif /* 0xBFC3E7B8: 01C1C024 and $t8, $t6, $at */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[1]; + PGXP_ALU(0x01C1C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800567B8u); #endif @@ -800346,7 +802556,8 @@ label_BFC3E7F8: psx_cyc_step(cpu, 0x2042u); #endif /* 0xBFC3E7FC: 00CD082A slt $at, $a2, $t5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x00CD082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800567FCu); #endif @@ -800459,7 +802670,8 @@ label_BFC3E808: psx_cyc_step(cpu, 0x4202u); #endif /* 0xBFC3E81C: 01C9082A slt $at, $t6, $t1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[14] < (int32_t)cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x01C9082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005681Cu); #endif @@ -800591,7 +802803,8 @@ label_BFC3E830: psx_cyc_step(cpu, 0x1000202u); #endif /* 0xBFC3E844: 0138082A slt $at, $t1, $t8 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[24] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[24] ? 1 : 0); + PGXP_ALU(0x0138082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056844u); #endif @@ -800743,7 +802956,8 @@ label_BFC3E85C: psx_cyc_step(cpu, 0x2042u); #endif /* 0xBFC3E870: 01A6082A slt $at, $t5, $a2 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[6] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[13] < (int32_t)cpu->gpr[6] ? 1 : 0); + PGXP_ALU(0x01A6082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056870u); #endif @@ -801054,7 +803268,8 @@ label_BFC3E8D8: psx_cyc_step(cpu, 0x2042u); #endif /* 0xBFC3E8D8: 00CD082A slt $at, $a2, $t5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x00CD082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800568D8u); #endif @@ -801213,7 +803428,8 @@ label_BFC3E8F4: psx_cyc_step(cpu, 0x8202u); #endif /* 0xBFC3E908: 012F082A slt $at, $t1, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x012F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056908u); #endif @@ -801332,7 +803548,8 @@ label_BFC3E920: psx_cyc_step(cpu, 0x4082u); #endif /* 0xBFC3E924: 00E17024 and $t6, $a3, $at */ - cpu->gpr[14] = cpu->gpr[7] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = cpu->gpr[7] & cpu->gpr[1]; + PGXP_ALU(0x00E17024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056924u); #endif @@ -801340,7 +803557,8 @@ label_BFC3E920: psx_cyc_step(cpu, 0x2042u); #endif /* 0xBFC3E928: 00CD082A slt $at, $a2, $t5 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[13] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[6]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[6] < (int32_t)cpu->gpr[13] ? 1 : 0); + PGXP_ALU(0x00CD082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056928u); #endif @@ -802012,7 +804230,8 @@ label_BFC3E9DC: psx_cyc_step(cpu, 0x19u); #endif /* 0xBFC3E9E0: 00602027 nor $a0, $v1, $zero */ - cpu->gpr[4] = ~(cpu->gpr[3] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[4] = ~(cpu->gpr[3] | cpu->gpr[0]); + PGXP_ALU(0x00602027u, cpu->gpr[4], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800569E0u); #endif @@ -802020,7 +804239,8 @@ label_BFC3E9DC: psx_cyc_step(cpu, 0x1000210u); #endif /* 0xBFC3E9E4: 0124C024 and $t8, $t1, $a0 */ - cpu->gpr[24] = cpu->gpr[9] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[24] = cpu->gpr[9] & cpu->gpr[4]; + PGXP_ALU(0x0124C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800569E4u); #endif @@ -802148,7 +804368,8 @@ label_BFC3E9FC: psx_cyc_step(cpu, 0x2000090u); #endif /* 0xBFC3EA04: 00E4C824 and $t9, $a3, $a0 */ - cpu->gpr[25] = cpu->gpr[7] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[7]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[7] & cpu->gpr[4]; + PGXP_ALU(0x00E4C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056A04u); #endif @@ -802294,7 +804515,8 @@ label_BFC3EA20: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3EA2C: 28A11000 slti $at, $a1, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (4096) ? 1 : 0); + PGXP_ALU(0x28A11000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80056A2Cu); #endif @@ -802434,7 +804656,8 @@ label_BFC3EA44: psx_cyc_step(cpu, 0x8006u); #endif /* 0xBFC3EA50: 01E2082A slt $at, $t7, $v0 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[2] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[2] ? 1 : 0); + PGXP_ALU(0x01E2082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056A50u); #endif @@ -802565,7 +804788,8 @@ label_BFC3EA64: psx_cyc_step(cpu, 0x3000040u); #endif /* 0xBFC3EA78: 0306C824 and $t9, $t8, $a2 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[6]; + PGXP_ALU(0x0306C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056A78u); #endif @@ -802621,7 +804845,8 @@ label_BFC3EA84: psx_cyc_step(cpu, 0x22u); #endif /* 0xBFC3EA88: 28A11001 slti $at, $a1, 4097 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (4097) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[5] < (4097) ? 1 : 0); + PGXP_ALU(0x28A11001u, cpu->gpr[1], _pgx1, 0x1001u); } #ifdef PSX_COSIM cosim_instr(0x80056A88u); #endif @@ -802735,7 +804960,8 @@ label_BFC3EA9C: psx_cyc_step(cpu, 0x2008002u); #endif /* 0xBFC3EAB0: 032F082A slt $at, $t9, $t7 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[15] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[15] ? 1 : 0); + PGXP_ALU(0x032F082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056AB0u); #endif @@ -803032,7 +805258,8 @@ label_BFC3EB00: psx_cyc_step(cpu, 0x2004002u); #endif /* 0xBFC3EB14: 032E082A slt $at, $t9, $t6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[14] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[25] < (int32_t)cpu->gpr[14] ? 1 : 0); + PGXP_ALU(0x032E082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056B14u); #endif @@ -803442,7 +805669,8 @@ label_BFC3EB90: psx_cyc_step(cpu, 0x8408u); #endif /* 0xBFC3EB98: 006A7824 and $t7, $v1, $t2 */ - cpu->gpr[15] = cpu->gpr[3] & cpu->gpr[10]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[10]; cpu->gpr[15] = cpu->gpr[3] & cpu->gpr[10]; + PGXP_ALU(0x006A7824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056B98u); #endif @@ -803460,7 +805688,8 @@ label_BFC3EB90: psx_cyc_step(cpu, 0x8048u); #endif /* 0xBFC3EBA0: 00667824 and $t7, $v1, $a2 */ - cpu->gpr[15] = cpu->gpr[3] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[3] & cpu->gpr[6]; + PGXP_ALU(0x00667824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056BA0u); #endif @@ -803492,7 +805721,8 @@ label_BFC3EBA4: psx_cyc_step(cpu, 0x888u); #endif /* 0xBFC3EBA4: 006B3824 and $a3, $v1, $t3 */ - cpu->gpr[7] = cpu->gpr[3] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[7] = cpu->gpr[3] & cpu->gpr[11]; + PGXP_ALU(0x006B3824u, cpu->gpr[7], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056BA4u); #endif @@ -803500,7 +805730,8 @@ label_BFC3EBA4: psx_cyc_step(cpu, 0xA2u); #endif /* 0xBFC3EBA8: 00A7082B sltu $at, $a1, $a3 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[7] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[7] ? 1 : 0); + PGXP_ALU(0x00A7082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056BA8u); #endif @@ -803576,7 +805807,8 @@ label_BFC3EBB4: psx_cyc_step(cpu, 0x2000022u); #endif /* 0xBFC3EBC0: 00B9082B sltu $at, $a1, $t9 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x00B9082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056BC0u); #endif @@ -803641,7 +805873,8 @@ label_BFC3EBCC: psx_cyc_step(cpu, 0x6040u); #endif /* 0xBFC3EBD4: 01C66824 and $t5, $t6, $a2 */ - cpu->gpr[13] = cpu->gpr[14] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[13] = cpu->gpr[14] & cpu->gpr[6]; + PGXP_ALU(0x01C66824u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056BD4u); #endif @@ -803766,7 +805999,8 @@ label_BFC3EBF0: psx_cyc_step(cpu, 0x212u); #endif /* 0xBFC3EBF4: 0089082A slt $at, $a0, $t1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0089082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056BF4u); #endif @@ -803970,7 +806204,8 @@ label_BFC3EC20: psx_cyc_step(cpu, 0x212u); #endif /* 0xBFC3EC28: 0089082A slt $at, $a0, $t1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0089082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056C28u); #endif @@ -804172,7 +806407,8 @@ label_BFC3EC58: psx_cyc_step(cpu, 0x8048u); #endif /* 0xBFC3EC58: 00667824 and $t7, $v1, $a2 */ - cpu->gpr[15] = cpu->gpr[3] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[3] & cpu->gpr[6]; + PGXP_ALU(0x00667824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056C58u); #endif @@ -804304,7 +806540,8 @@ label_BFC3EC70: psx_cyc_step(cpu, 0x212u); #endif /* 0xBFC3EC7C: 0089082A slt $at, $a0, $t1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[9] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (int32_t)cpu->gpr[9] ? 1 : 0); + PGXP_ALU(0x0089082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056C7Cu); #endif @@ -804414,7 +806651,8 @@ label_BFC3EC94: psx_cyc_step(cpu, 0x828u); #endif /* 0xBFC3EC94: 006B2824 and $a1, $v1, $t3 */ - cpu->gpr[5] = cpu->gpr[3] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[5] = cpu->gpr[3] & cpu->gpr[11]; + PGXP_ALU(0x006B2824u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056C94u); #endif @@ -804669,7 +806907,8 @@ label_BFC3ECD4: psx_cyc_step(cpu, 0x4044u); #endif /* 0xBFC3ECDC: 00467024 and $t6, $v0, $a2 */ - cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[6]; + PGXP_ALU(0x00467024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056CDCu); #endif @@ -804719,7 +806958,8 @@ label_BFC3ECE8: psx_cyc_step(cpu, 0x8084u); #endif /* 0xBFC3ECE8: 00477824 and $t7, $v0, $a3 */ - cpu->gpr[15] = cpu->gpr[2] & cpu->gpr[7]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[7]; cpu->gpr[15] = cpu->gpr[2] & cpu->gpr[7]; + PGXP_ALU(0x00477824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056CE8u); #endif @@ -804769,7 +807009,8 @@ label_BFC3ECF4: psx_cyc_step(cpu, 0x124u); #endif /* 0xBFC3ECF4: 00482824 and $a1, $v0, $t0 */ - cpu->gpr[5] = cpu->gpr[2] & cpu->gpr[8]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[8]; cpu->gpr[5] = cpu->gpr[2] & cpu->gpr[8]; + PGXP_ALU(0x00482824u, cpu->gpr[5], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056CF4u); #endif @@ -804777,7 +807018,8 @@ label_BFC3ECF4: psx_cyc_step(cpu, 0x32u); #endif /* 0xBFC3ECF8: 00A4082B sltu $at, $a1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[5]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[5] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x00A4082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056CF8u); #endif @@ -804885,7 +807127,8 @@ label_BFC3ED0C: psx_cyc_step(cpu, 0x2000012u); #endif /* 0xBFC3ED18: 0099082B sltu $at, $a0, $t9 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[25] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[1] = (uint32_t)(cpu->gpr[4] < cpu->gpr[25] ? 1 : 0); + PGXP_ALU(0x0099082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056D18u); #endif @@ -805223,7 +807466,8 @@ label_BFC3ED68: psx_cyc_step(cpu, 0x4014u); #endif /* 0xBFC3ED70: 00447024 and $t6, $v0, $a0 */ - cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[4]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[14] = cpu->gpr[2] & cpu->gpr[4]; + PGXP_ALU(0x00447024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056D70u); #endif @@ -805845,7 +808089,8 @@ label_BFC3EE0C: psx_cyc_step(cpu, 0x2080100u); #endif /* 0xBFC3EE24: 03334024 and $t0, $t9, $s3 */ - cpu->gpr[8] = cpu->gpr[25] & cpu->gpr[19]; + { uint32_t _pgx1 = cpu->gpr[25]; uint32_t _pgx2 = cpu->gpr[19]; cpu->gpr[8] = cpu->gpr[25] & cpu->gpr[19]; + PGXP_ALU(0x03334024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056E24u); #endif @@ -805977,7 +808222,8 @@ label_BFC3EE44: psx_cyc_step(cpu, 0x20202u); #endif /* 0xBFC3EE50: 0131082A slt $at, $t1, $s1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[17] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (int32_t)cpu->gpr[17] ? 1 : 0); + PGXP_ALU(0x0131082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80056E50u); #endif @@ -806656,7 +808902,8 @@ label_BFC3EF24: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC3EF30: 30430007 andi $v1, $v0, 0x7 */ - cpu->gpr[3] = cpu->gpr[2] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0x7u; + PGXP_ALU(0x30430007u, cpu->gpr[3], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x80056F30u); #endif @@ -807055,7 +809302,8 @@ label_BFC3EF98: psx_cyc_step(cpu, 0xCu); #endif /* 0xBFC3EFA4: 30430007 andi $v1, $v0, 0x7 */ - cpu->gpr[3] = cpu->gpr[2] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[3] = cpu->gpr[2] & 0x7u; + PGXP_ALU(0x30430007u, cpu->gpr[3], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x80056FA4u); #endif @@ -807661,7 +809909,8 @@ label_BFC3F040: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC3F044: 3059001D andi $t9, $v0, 0x1D */ - cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + PGXP_ALU(0x3059001Du, cpu->gpr[25], _pgx1, 0x001Du); } #ifdef PSX_COSIM cosim_instr(0x80057044u); #endif @@ -807766,7 +810015,8 @@ label_BFC3F058: psx_cyc_step(cpu, 0x2000004u); #endif /* 0xBFC3F058: 3059001D andi $t9, $v0, 0x1D */ - cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[2] & 0x1Du; + PGXP_ALU(0x3059001Du, cpu->gpr[25], _pgx1, 0x001Du); } #ifdef PSX_COSIM cosim_instr(0x80057058u); #endif @@ -808148,7 +810398,8 @@ label_BFC3F090: psx_cyc_step(cpu, 0xC040u); #endif /* 0xBFC3F0C8: 01C67824 and $t7, $t6, $a2 */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[6]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[6]; + PGXP_ALU(0x01C67824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800570C8u); #endif @@ -808183,7 +810434,8 @@ label_BFC3F090: psx_cyc_step(cpu, 0x3000020u); #endif /* 0xBFC3F0D8: 0305C824 and $t9, $t8, $a1 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[5]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[5]; + PGXP_ALU(0x0305C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x800570D8u); #endif @@ -808284,7 +810536,8 @@ label_BFC3F090: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC3F104: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80057104u); #endif @@ -809226,7 +811479,8 @@ label_BFC3F210: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC3F224: 30580008 andi $t8, $v0, 0x8 */ - cpu->gpr[24] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30580008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80057224u); #endif @@ -810287,7 +812541,8 @@ label_BFC3F324: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC3F338: 30580008 andi $t8, $v0, 0x8 */ - cpu->gpr[24] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30580008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80057338u); #endif @@ -812136,7 +814391,8 @@ label_BFC3F5D8: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC3F5F0: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800575F0u); #endif @@ -812357,7 +814613,8 @@ label_BFC3F608: psx_cyc_step(cpu, 0x8040u); #endif /* 0xBFC3F62C: 30CF0010 andi $t7, $a2, 0x10 */ - cpu->gpr[15] = cpu->gpr[6] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[15] = cpu->gpr[6] & 0x10u; + PGXP_ALU(0x30CF0010u, cpu->gpr[15], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x8005762Cu); #endif @@ -812469,7 +814726,8 @@ label_BFC3F648: psx_cyc_step(cpu, 0x2000040u); #endif /* 0xBFC3F648: 30D90020 andi $t9, $a2, 0x20 */ - cpu->gpr[25] = cpu->gpr[6] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[25] = cpu->gpr[6] & 0x20u; + PGXP_ALU(0x30D90020u, cpu->gpr[25], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x80057648u); #endif @@ -812669,7 +814927,8 @@ label_BFC3F670: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC3F684: 304B0008 andi $t3, $v0, 0x8 */ - cpu->gpr[11] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304B0008u, cpu->gpr[11], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80057684u); #endif @@ -812838,7 +815097,8 @@ label_BFC3F6A0: psx_cyc_step(cpu, 0x2040u); #endif /* 0xBFC3F6B8: 30CD00FF andi $t5, $a2, 0xFF */ - cpu->gpr[13] = cpu->gpr[6] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[13] = cpu->gpr[6] & 0xFFu; + PGXP_ALU(0x30CD00FFu, cpu->gpr[13], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800576B8u); #endif @@ -813195,7 +815455,8 @@ label_BFC3F710: psx_cyc_step(cpu, 0x8010u); #endif /* 0xBFC3F724: 308F0010 andi $t7, $a0, 0x10 */ - cpu->gpr[15] = cpu->gpr[4] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[15] = cpu->gpr[4] & 0x10u; + PGXP_ALU(0x308F0010u, cpu->gpr[15], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80057724u); #endif @@ -813301,7 +815562,8 @@ label_BFC3F740: psx_cyc_step(cpu, 0x2000010u); #endif /* 0xBFC3F740: 30990020 andi $t9, $a0, 0x20 */ - cpu->gpr[25] = cpu->gpr[4] & 0x20u; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[4] & 0x20u; + PGXP_ALU(0x30990020u, cpu->gpr[25], _pgx1, 0x0020u); } #ifdef PSX_COSIM cosim_instr(0x80057740u); #endif @@ -813498,7 +815760,8 @@ label_BFC3F768: psx_cyc_step(cpu, 0x804u); #endif /* 0xBFC3F77C: 304B0008 andi $t3, $v0, 0x8 */ - cpu->gpr[11] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304B0008u, cpu->gpr[11], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x8005777Cu); #endif @@ -813673,7 +815936,8 @@ label_BFC3F798: psx_cyc_step(cpu, 0x2010u); #endif /* 0xBFC3F7B0: 308D00FF andi $t5, $a0, 0xFF */ - cpu->gpr[13] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[13] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308D00FFu, cpu->gpr[13], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800577B0u); #endif @@ -814900,7 +817164,8 @@ label_BFC3F910: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC3F928: 304F0008 andi $t7, $v0, 0x8 */ - cpu->gpr[15] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304F0008u, cpu->gpr[15], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80057928u); #endif @@ -815111,7 +817376,8 @@ label_BFC3F94C: psx_cyc_step(cpu, 0x2000010u); #endif /* 0xBFC3F96C: 309900FF andi $t9, $a0, 0xFF */ - cpu->gpr[25] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[25] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x309900FFu, cpu->gpr[25], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005796Cu); #endif @@ -820246,7 +822512,8 @@ label_BFC3FE84: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC3FE98: 30580008 andi $t8, $v0, 0x8 */ - cpu->gpr[24] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30580008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80057E98u); #endif @@ -820955,7 +823222,8 @@ label_BFC3FF64: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC3FF78: 30580008 andi $t8, $v0, 0x8 */ - cpu->gpr[24] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30580008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80057F78u); #endif @@ -821353,7 +823621,8 @@ label_BFC3FFE4: psx_cyc_step(cpu, 0x300u); #endif /* 0xBFC3FFFC: 310900FF andi $t1, $t0, 0xFF */ - cpu->gpr[9] = cpu->gpr[8] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[9] = cpu->gpr[8] & 0xFFu; + PGXP_ALU(0x310900FFu, cpu->gpr[9], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80057FFCu); #endif @@ -822917,7 +825186,8 @@ label_BFC40184: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC40190: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80058190u); #endif @@ -824316,7 +826586,8 @@ label_BFC40300: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC40314: 30580008 andi $t8, $v0, 0x8 */ - cpu->gpr[24] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30580008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80058314u); #endif @@ -824651,7 +826922,8 @@ label_BFC40378: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC40384: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80058384u); #endif @@ -825633,7 +827905,8 @@ label_BFC40484: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC4049C: 31CF0004 andi $t7, $t6, 0x4 */ - cpu->gpr[15] = cpu->gpr[14] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x4u; + PGXP_ALU(0x31CF0004u, cpu->gpr[15], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x8005849Cu); #endif @@ -825738,7 +828011,8 @@ label_BFC404B0: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC404B8: 30580004 andi $t8, $v0, 0x4 */ - cpu->gpr[24] = cpu->gpr[2] & 0x4u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x4u; + PGXP_ALU(0x30580004u, cpu->gpr[24], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x800584B8u); #endif @@ -825874,7 +828148,8 @@ label_BFC404CC: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC404E0: 33280003 andi $t0, $t9, 0x3 */ - cpu->gpr[8] = cpu->gpr[25] & 0x3u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x3u; + PGXP_ALU(0x33280003u, cpu->gpr[8], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x800584E0u); #endif @@ -825933,7 +828208,8 @@ label_BFC404CC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC404FC: 30420007 andi $v0, $v0, 0x7 */ - cpu->gpr[2] = cpu->gpr[2] & 0x7u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0x7u; + PGXP_ALU(0x30420007u, cpu->gpr[2], _pgx1, 0x0007u); } #ifdef PSX_COSIM cosim_instr(0x800584FCu); #endif @@ -825944,7 +828220,8 @@ label_BFC404CC: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC40500: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80058500u); #endif @@ -825970,7 +828247,8 @@ label_BFC404CC: psx_cyc_step(cpu, 0x1002u); #endif /* 0xBFC4050C: 2D810005 sltiu $at, $t4, 5 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[12] < 0x00000005u ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[1] = (uint32_t)(cpu->gpr[12] < 0x00000005u ? 1 : 0); + PGXP_ALU(0x2D810005u, cpu->gpr[1], _pgx1, 0x0005u); } #ifdef PSX_COSIM cosim_instr(0x8005850Cu); #endif @@ -826683,7 +828961,8 @@ label_BFC405B0: psx_cyc_step(cpu, 0x1000002u); #endif /* 0xBFC405D0: 2B010004 slti $at, $t8, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[24]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[24] < (4) ? 1 : 0); + PGXP_ALU(0x2B010004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x800585D0u); #endif @@ -826813,7 +829092,8 @@ label_BFC405E0: psx_cyc_step(cpu, 0x402u); #endif /* 0xBFC40600: 29410004 slti $at, $t2, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[10] < (4) ? 1 : 0); + PGXP_ALU(0x29410004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80058600u); #endif @@ -827038,7 +829318,8 @@ label_BFC40628: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC40640: 31CF0008 andi $t7, $t6, 0x8 */ - cpu->gpr[15] = cpu->gpr[14] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x8u; + PGXP_ALU(0x31CF0008u, cpu->gpr[15], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80058640u); #endif @@ -827143,7 +829424,8 @@ label_BFC40654: psx_cyc_step(cpu, 0x1000004u); #endif /* 0xBFC4065C: 30580008 andi $t8, $v0, 0x8 */ - cpu->gpr[24] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[24] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x30580008u, cpu->gpr[24], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x8005865Cu); #endif @@ -827312,7 +829594,8 @@ label_BFC40670: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40694: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80058694u); #endif @@ -828013,7 +830296,8 @@ label_BFC40744: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC40774: 29010004 slti $at, $t0, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4) ? 1 : 0); + PGXP_ALU(0x29010004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80058774u); #endif @@ -828145,7 +830429,8 @@ label_BFC40784: psx_cyc_step(cpu, 0x1002u); #endif /* 0xBFC407A4: 29810004 slti $at, $t4, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (4) ? 1 : 0); + PGXP_ALU(0x29810004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x800587A4u); #endif @@ -830011,7 +832296,8 @@ label_BFC4090C: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40914: 2841001A slti $at, $v0, 26 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (26) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (26) ? 1 : 0); + PGXP_ALU(0x2841001Au, cpu->gpr[1], _pgx1, 0x001Au); } #ifdef PSX_COSIM cosim_instr(0x80058914u); #endif @@ -830090,7 +832376,8 @@ label_BFC40920: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40924: 2841000F slti $at, $v0, 15 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (15) ? 1 : 0); + PGXP_ALU(0x2841000Fu, cpu->gpr[1], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80058924u); #endif @@ -830169,7 +832456,8 @@ label_BFC40930: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40934: 28410009 slti $at, $v0, 9 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (9) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (9) ? 1 : 0); + PGXP_ALU(0x28410009u, cpu->gpr[1], _pgx1, 0x0009u); } #ifdef PSX_COSIM cosim_instr(0x80058934u); #endif @@ -830248,7 +832536,8 @@ label_BFC40940: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40944: 28410006 slti $at, $v0, 6 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (6) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (6) ? 1 : 0); + PGXP_ALU(0x28410006u, cpu->gpr[1], _pgx1, 0x0006u); } #ifdef PSX_COSIM cosim_instr(0x80058944u); #endif @@ -830327,7 +832616,8 @@ label_BFC40950: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40954: 28410004 slti $at, $v0, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4) ? 1 : 0); + PGXP_ALU(0x28410004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80058954u); #endif @@ -830666,7 +832956,8 @@ label_BFC40998: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC409A0: 2841000C slti $at, $v0, 12 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (12) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (12) ? 1 : 0); + PGXP_ALU(0x2841000Cu, cpu->gpr[1], _pgx1, 0x000Cu); } #ifdef PSX_COSIM cosim_instr(0x800589A0u); #endif @@ -830919,7 +833210,8 @@ label_BFC409D0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC409D8: 28410015 slti $at, $v0, 21 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (21) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (21) ? 1 : 0); + PGXP_ALU(0x28410015u, cpu->gpr[1], _pgx1, 0x0015u); } #ifdef PSX_COSIM cosim_instr(0x800589D8u); #endif @@ -831001,7 +833293,8 @@ label_BFC409E4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC409E8: 28410013 slti $at, $v0, 19 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (19) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (19) ? 1 : 0); + PGXP_ALU(0x28410013u, cpu->gpr[1], _pgx1, 0x0013u); } #ifdef PSX_COSIM cosim_instr(0x800589E8u); #endif @@ -831259,7 +833552,8 @@ label_BFC40A18: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40A20: 28410017 slti $at, $v0, 23 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (23) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (23) ? 1 : 0); + PGXP_ALU(0x28410017u, cpu->gpr[1], _pgx1, 0x0017u); } #ifdef PSX_COSIM cosim_instr(0x80058A20u); #endif @@ -831512,7 +833806,8 @@ label_BFC40A50: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40A58: 284100F7 slti $at, $v0, 247 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (247) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (247) ? 1 : 0); + PGXP_ALU(0x284100F7u, cpu->gpr[1], _pgx1, 0x00F7u); } #ifdef PSX_COSIM cosim_instr(0x80058A58u); #endif @@ -831594,7 +833889,8 @@ label_BFC40A64: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40A68: 284100E7 slti $at, $v0, 231 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (231) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (231) ? 1 : 0); + PGXP_ALU(0x284100E7u, cpu->gpr[1], _pgx1, 0x00E7u); } #ifdef PSX_COSIM cosim_instr(0x80058A68u); #endif @@ -831676,7 +833972,8 @@ label_BFC40A74: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40A78: 28410051 slti $at, $v0, 81 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (81) ? 1 : 0); + PGXP_ALU(0x28410051u, cpu->gpr[1], _pgx1, 0x0051u); } #ifdef PSX_COSIM cosim_instr(0x80058A78u); #endif @@ -831932,7 +834229,8 @@ label_BFC40AA8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40AB0: 284100EF slti $at, $v0, 239 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (239) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (239) ? 1 : 0); + PGXP_ALU(0x284100EFu, cpu->gpr[1], _pgx1, 0x00EFu); } #ifdef PSX_COSIM cosim_instr(0x80058AB0u); #endif @@ -832188,7 +834486,8 @@ label_BFC40AE0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40AE8: 28410DDE slti $at, $v0, 3550 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3550) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3550) ? 1 : 0); + PGXP_ALU(0x28410DDEu, cpu->gpr[1], _pgx1, 0x0DDEu); } #ifdef PSX_COSIM cosim_instr(0x80058AE8u); #endif @@ -832270,7 +834569,8 @@ label_BFC40AF4: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40AF8: 284100FF slti $at, $v0, 255 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (255) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (255) ? 1 : 0); + PGXP_ALU(0x284100FFu, cpu->gpr[1], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80058AF8u); #endif @@ -832527,7 +834827,8 @@ label_BFC40B28: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40B30: 28411000 slti $at, $v0, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4096) ? 1 : 0); + PGXP_ALU(0x28411000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80058B30u); #endif @@ -834354,7 +836655,8 @@ label_BFC40D18: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40D1C: 28410CCD slti $at, $v0, 3277 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3277) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (3277) ? 1 : 0); + PGXP_ALU(0x28410CCDu, cpu->gpr[1], _pgx1, 0x0CCDu); } #ifdef PSX_COSIM cosim_instr(0x80058D1Cu); #endif @@ -834433,7 +836735,8 @@ label_BFC40D28: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40D2C: 28410017 slti $at, $v0, 23 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (23) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (23) ? 1 : 0); + PGXP_ALU(0x28410017u, cpu->gpr[1], _pgx1, 0x0017u); } #ifdef PSX_COSIM cosim_instr(0x80058D2Cu); #endif @@ -834512,7 +836815,8 @@ label_BFC40D38: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40D3C: 2841000A slti $at, $v0, 10 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (10) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (10) ? 1 : 0); + PGXP_ALU(0x2841000Au, cpu->gpr[1], _pgx1, 0x000Au); } #ifdef PSX_COSIM cosim_instr(0x80058D3Cu); #endif @@ -834972,7 +837276,8 @@ label_BFC40DA0: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC40DA8: 28411000 slti $at, $v0, 4096 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4096) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[2] < (4096) ? 1 : 0); + PGXP_ALU(0x28411000u, cpu->gpr[1], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80058DA8u); #endif @@ -835579,7 +837884,8 @@ label_BFC40E24: psx_cyc_step(cpu, 0x202u); #endif /* 0xBFC40E54: 29210004 slti $at, $t1, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[9] < (4) ? 1 : 0); + PGXP_ALU(0x29210004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80058E54u); #endif @@ -835717,7 +838023,8 @@ label_BFC40E60: psx_cyc_step(cpu, 0x8002u); #endif /* 0xBFC40E8C: 29E10004 slti $at, $t7, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (4) ? 1 : 0); + PGXP_ALU(0x29E10004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80058E8Cu); #endif @@ -840689,7 +842996,8 @@ label_BFC413B0: psx_cyc_step(cpu, 0x18u); #endif /* 0xBFC413BC: 308300FF andi $v1, $a0, 0xFF */ - cpu->gpr[3] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[3] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800593BCu); #endif @@ -841309,7 +843617,8 @@ label_BFC41468: psx_cyc_step(cpu, 0x1008000u); #endif /* 0xBFC41480: 31F80100 andi $t8, $t7, 0x100 */ - cpu->gpr[24] = cpu->gpr[15] & 0x100u; + { uint32_t _pgx1 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[15] & 0x100u; + PGXP_ALU(0x31F80100u, cpu->gpr[24], _pgx1, 0x0100u); } #ifdef PSX_COSIM cosim_instr(0x80059480u); #endif @@ -842906,7 +845215,8 @@ label_BFC41670: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC4167C: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005967Cu); #endif @@ -843344,7 +845654,8 @@ label_BFC41708: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC41718: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80059718u); #endif @@ -843397,7 +845708,8 @@ label_BFC41708: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC41730: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80059730u); #endif @@ -843488,7 +845800,8 @@ label_BFC41740: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC4174C: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005974Cu); #endif @@ -844362,7 +846675,8 @@ label_BFC41848: psx_cyc_step(cpu, 0x8004u); #endif /* 0xBFC41860: 304F0008 andi $t7, $v0, 0x8 */ - cpu->gpr[15] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[15] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304F0008u, cpu->gpr[15], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80059860u); #endif @@ -845100,7 +847414,8 @@ label_BFC4192C: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC41958: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80059958u); #endif @@ -845108,7 +847423,8 @@ label_BFC4192C: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC4195C: 304E000F andi $t6, $v0, 0xF */ - cpu->gpr[14] = cpu->gpr[2] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0xFu; + PGXP_ALU(0x304E000Fu, cpu->gpr[14], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x8005995Cu); #endif @@ -845128,7 +847444,8 @@ label_BFC4192C: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC41964: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80059964u); #endif @@ -845217,7 +847534,8 @@ label_BFC4192C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC4198C: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005998Cu); #endif @@ -845228,7 +847546,8 @@ label_BFC4192C: psx_cyc_step(cpu, 0x8010u); #endif /* 0xBFC41990: 308F000F andi $t7, $a0, 0xF */ - cpu->gpr[15] = cpu->gpr[4] & 0xFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[15] = cpu->gpr[4] & 0xFu; + PGXP_ALU(0x308F000Fu, cpu->gpr[15], _pgx1, 0x000Fu); } #ifdef PSX_COSIM cosim_instr(0x80059990u); #endif @@ -845251,7 +847570,8 @@ label_BFC4192C: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC4199C: 30A500FF andi $a1, $a1, 0xFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFu; + PGXP_ALU(0x30A500FFu, cpu->gpr[5], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x8005999Cu); #endif @@ -845289,7 +847609,8 @@ label_BFC4192C: psx_cyc_step(cpu, 0x2000040u); #endif /* 0xBFC419AC: 30D90008 andi $t9, $a2, 0x8 */ - cpu->gpr[25] = cpu->gpr[6] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[25] = cpu->gpr[6] & 0x8u; + PGXP_ALU(0x30D90008u, cpu->gpr[25], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x800599ACu); #endif @@ -845444,7 +847765,8 @@ label_BFC419C8: psx_cyc_step(cpu, 0x8u); #endif /* 0xBFC419D4: 306300FF andi $v1, $v1, 0xFF */ - cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[3]; cpu->gpr[3] = cpu->gpr[3] & 0xFFu; + PGXP_ALU(0x306300FFu, cpu->gpr[3], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800599D4u); #endif @@ -845494,7 +847816,8 @@ label_BFC419C8: psx_cyc_step(cpu, 0x600u); #endif /* 0xBFC419E8: 312A00FF andi $t2, $t1, 0xFF */ - cpu->gpr[10] = cpu->gpr[9] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[9] & 0xFFu; + PGXP_ALU(0x312A00FFu, cpu->gpr[10], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x800599E8u); #endif @@ -846117,7 +848440,8 @@ label_BFC41ABC: psx_cyc_step(cpu, 0x1Au); #endif /* 0xBFC41AC0: 0064082B sltu $at, $v1, $a0 */ - cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)(cpu->gpr[3] < cpu->gpr[4] ? 1 : 0); + PGXP_ALU(0x0064082Bu, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059AC0u); #endif @@ -846327,7 +848651,8 @@ label_BFC41AF0: psx_cyc_step(cpu, 0x1004u); #endif /* 0xBFC41B04: 304C0008 andi $t4, $v0, 0x8 */ - cpu->gpr[12] = cpu->gpr[2] & 0x8u; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[12] = cpu->gpr[2] & 0x8u; + PGXP_ALU(0x304C0008u, cpu->gpr[12], _pgx1, 0x0008u); } #ifdef PSX_COSIM cosim_instr(0x80059B04u); #endif @@ -846500,7 +848825,8 @@ label_BFC41B24: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC41B30: 31CF00FF andi $t7, $t6, 0xFF */ - cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0xFFu; + PGXP_ALU(0x31CF00FFu, cpu->gpr[15], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80059B30u); #endif @@ -846539,7 +848865,8 @@ label_BFC41B24: psx_cyc_step(cpu, 0x4u); #endif /* 0xBFC41B40: 304200FF andi $v0, $v0, 0xFF */ - cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[2] = cpu->gpr[2] & 0xFFu; + PGXP_ALU(0x304200FFu, cpu->gpr[2], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80059B40u); #endif @@ -846599,7 +848926,8 @@ label_BFC41B48: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC41B4C: 308400FF andi $a0, $a0, 0xFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFu; + PGXP_ALU(0x308400FFu, cpu->gpr[4], _pgx1, 0x00FFu); } #ifdef PSX_COSIM cosim_instr(0x80059B4Cu); #endif @@ -846907,7 +849235,8 @@ label_BFC41BA8: psx_cyc_step(cpu, 0x6u); #endif /* 0xBFC41BC0: 00411024 and $v0, $v0, $at */ - cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[2] = cpu->gpr[2] & cpu->gpr[1]; + PGXP_ALU(0x00411024u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059BC0u); #endif @@ -847246,7 +849575,8 @@ label_BFC41C0C: psx_cyc_step(cpu, 0x102u); #endif /* 0xBFC41C3C: 29010004 slti $at, $t0, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (4) ? 1 : 0); + PGXP_ALU(0x29010004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80059C3Cu); #endif @@ -847381,7 +849711,8 @@ label_BFC41C4C: psx_cyc_step(cpu, 0x1002u); #endif /* 0xBFC41C6C: 29810004 slti $at, $t4, 4 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (4) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[12]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[12] < (4) ? 1 : 0); + PGXP_ALU(0x29810004u, cpu->gpr[1], _pgx1, 0x0004u); } #ifdef PSX_COSIM cosim_instr(0x80059C6Cu); #endif @@ -847599,7 +849930,8 @@ label_BFC41C80: psx_cyc_step(cpu, 0x40u); #endif /* 0xBFC41CB4: 30C6FFFF andi $a2, $a2, 0xFFFF */ - cpu->gpr[6] = cpu->gpr[6] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[6]; cpu->gpr[6] = cpu->gpr[6] & 0xFFFFu; + PGXP_ALU(0x30C6FFFFu, cpu->gpr[6], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80059CB4u); #endif @@ -847992,7 +850324,8 @@ label_BFC41D18: psx_cyc_step(cpu, 0x10Au); #endif /* 0xBFC41D24: 00614024 and $t0, $v1, $at */ - cpu->gpr[8] = cpu->gpr[3] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[8] = cpu->gpr[3] & cpu->gpr[1]; + PGXP_ALU(0x00614024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059D24u); #endif @@ -848080,7 +850413,8 @@ label_BFC41D30: psx_cyc_step(cpu, 0x608u); #endif /* 0xBFC41D44: 00695026 xor $t2, $v1, $t1 */ - cpu->gpr[10] = cpu->gpr[3] ^ cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[3] ^ cpu->gpr[9]; + PGXP_ALU(0x00695026u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059D44u); #endif @@ -848088,7 +850422,8 @@ label_BFC41D30: psx_cyc_step(cpu, 0xC04u); #endif /* 0xBFC41D48: 01425824 and $t3, $t2, $v0 */ - cpu->gpr[11] = cpu->gpr[10] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[11] = cpu->gpr[10] & cpu->gpr[2]; + PGXP_ALU(0x01425824u, cpu->gpr[11], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059D48u); #endif @@ -848152,7 +850487,8 @@ label_BFC41D54: psx_cyc_step(cpu, 0x3008u); #endif /* 0xBFC41D5C: 006C6826 xor $t5, $v1, $t4 */ - cpu->gpr[13] = cpu->gpr[3] ^ cpu->gpr[12]; + { uint32_t _pgx1 = cpu->gpr[3]; uint32_t _pgx2 = cpu->gpr[12]; cpu->gpr[13] = cpu->gpr[3] ^ cpu->gpr[12]; + PGXP_ALU(0x006C6826u, cpu->gpr[13], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059D5Cu); #endif @@ -848163,7 +850499,8 @@ label_BFC41D54: psx_cyc_step(cpu, 0x6004u); #endif /* 0xBFC41D60: 01A27024 and $t6, $t5, $v0 */ - cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[2]; + PGXP_ALU(0x01A27024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059D60u); #endif @@ -848433,7 +850770,8 @@ label_BFC41DA4: psx_cyc_step(cpu, 0x8022u); #endif /* 0xBFC41DBC: 01E5082A slt $at, $t7, $a1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[15] < (int32_t)cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x01E5082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059DBCu); #endif @@ -848722,7 +851060,8 @@ label_BFC41DFC: psx_cyc_step(cpu, 0x122u); #endif /* 0xBFC41E08: 0105082A slt $at, $t0, $a1 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[5] ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[5]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[8] < (int32_t)cpu->gpr[5] ? 1 : 0); + PGXP_ALU(0x0105082Au, cpu->gpr[1], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059E08u); #endif @@ -848903,7 +851242,8 @@ label_BFC41E30: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC41E30: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80059E30u); #endif @@ -848911,7 +851251,8 @@ label_BFC41E30: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC41E34: 28810003 slti $at, $a0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + PGXP_ALU(0x28810003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80059E34u); #endif @@ -848919,7 +851260,8 @@ label_BFC41E30: psx_cyc_step(cpu, 0x20u); #endif /* 0xBFC41E38: 30A5FFFF andi $a1, $a1, 0xFFFF */ - cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[5]; cpu->gpr[5] = cpu->gpr[5] & 0xFFFFu; + PGXP_ALU(0x30A5FFFFu, cpu->gpr[5], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80059E38u); #endif @@ -849151,7 +851493,8 @@ label_BFC41E78: psx_cyc_step(cpu, 0x1000080u); #endif /* 0xBFC41E78: 30F80010 andi $t8, $a3, 0x10 */ - cpu->gpr[24] = cpu->gpr[7] & 0x10u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[24] = cpu->gpr[7] & 0x10u; + PGXP_ALU(0x30F80010u, cpu->gpr[24], _pgx1, 0x0010u); } #ifdef PSX_COSIM cosim_instr(0x80059E78u); #endif @@ -849169,7 +851512,8 @@ label_BFC41E78: psx_cyc_step(cpu, 0x2000080u); #endif /* 0xBFC41E80: 30F90001 andi $t9, $a3, 0x1 */ - cpu->gpr[25] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[25] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30F90001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80059E80u); #endif @@ -849210,7 +851554,8 @@ label_BFC41E84: psx_cyc_step(cpu, 0x2000080u); #endif /* 0xBFC41E88: 30F90001 andi $t9, $a3, 0x1 */ - cpu->gpr[25] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[25] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30F90001u, cpu->gpr[25], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80059E88u); #endif @@ -849238,7 +851583,8 @@ label_BFC41E8C: psx_cyc_step(cpu, 0x280u); #endif /* 0xBFC41E90: 30E91000 andi $t1, $a3, 0x1000 */ - cpu->gpr[9] = cpu->gpr[7] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[9] = cpu->gpr[7] & 0x1000u; + PGXP_ALU(0x30E91000u, cpu->gpr[9], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80059E90u); #endif @@ -849336,7 +851682,8 @@ label_BFC41EA0: psx_cyc_step(cpu, 0x280u); #endif /* 0xBFC41EA4: 30E91000 andi $t1, $a3, 0x1000 */ - cpu->gpr[9] = cpu->gpr[7] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[9] = cpu->gpr[7] & 0x1000u; + PGXP_ALU(0x30E91000u, cpu->gpr[9], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80059EA4u); #endif @@ -849368,7 +851715,8 @@ label_BFC41EA8: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC41EA8: 30E80001 andi $t0, $a3, 0x1 */ - cpu->gpr[8] = cpu->gpr[7] & 0x1u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[8] = cpu->gpr[7] & 0x1u; + PGXP_ALU(0x30E80001u, cpu->gpr[8], _pgx1, 0x0001u); } #ifdef PSX_COSIM cosim_instr(0x80059EA8u); #endif @@ -849386,7 +851734,8 @@ label_BFC41EA8: psx_cyc_step(cpu, 0x280u); #endif /* 0xBFC41EB0: 30E91000 andi $t1, $a3, 0x1000 */ - cpu->gpr[9] = cpu->gpr[7] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[9] = cpu->gpr[7] & 0x1000u; + PGXP_ALU(0x30E91000u, cpu->gpr[9], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80059EB0u); #endif @@ -849437,7 +851786,8 @@ label_BFC41EB8: psx_cyc_step(cpu, 0x280u); #endif /* 0xBFC41EB8: 30E91000 andi $t1, $a3, 0x1000 */ - cpu->gpr[9] = cpu->gpr[7] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[9] = cpu->gpr[7] & 0x1000u; + PGXP_ALU(0x30E91000u, cpu->gpr[9], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x80059EB8u); #endif @@ -849589,7 +851939,8 @@ label_BFC41ED8: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC41ED8: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80059ED8u); #endif @@ -849597,7 +851948,8 @@ label_BFC41ED8: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC41EDC: 28810003 slti $at, $a0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + PGXP_ALU(0x28810003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80059EDCu); #endif @@ -849790,7 +852142,8 @@ label_BFC41F10: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC41F14: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80059F14u); #endif @@ -849849,7 +852202,8 @@ label_BFC41F10: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC41F30: 28810003 slti $at, $a0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + PGXP_ALU(0x28810003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80059F30u); #endif @@ -849990,7 +852344,8 @@ label_BFC41F54: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC41F54: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80059F54u); #endif @@ -850058,7 +852413,8 @@ label_BFC41F54: psx_cyc_step(cpu, 0x3000001u); #endif /* 0xBFC41F74: 0300C827 nor $t9, $t8, $zero */ - cpu->gpr[25] = ~(cpu->gpr[24] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[25] = ~(cpu->gpr[24] | cpu->gpr[0]); + PGXP_ALU(0x0300C827u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059F74u); #endif @@ -850066,7 +852422,8 @@ label_BFC41F54: psx_cyc_step(cpu, 0x2004100u); #endif /* 0xBFC41F78: 01D94024 and $t0, $t6, $t9 */ - cpu->gpr[8] = cpu->gpr[14] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[14] & cpu->gpr[25]; + PGXP_ALU(0x01D94024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x80059F78u); #endif @@ -850139,7 +852496,8 @@ label_BFC41F88: psx_cyc_step(cpu, 0x10u); #endif /* 0xBFC41F88: 3084FFFF andi $a0, $a0, 0xFFFF */ - cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[4] = cpu->gpr[4] & 0xFFFFu; + PGXP_ALU(0x3084FFFFu, cpu->gpr[4], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x80059F88u); #endif @@ -850147,7 +852505,8 @@ label_BFC41F88: psx_cyc_step(cpu, 0x12u); #endif /* 0xBFC41F8C: 28810003 slti $at, $a0, 3 */ - cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + { uint32_t _pgx1 = cpu->gpr[4]; cpu->gpr[1] = (uint32_t)((int32_t)cpu->gpr[4] < (3) ? 1 : 0); + PGXP_ALU(0x28810003u, cpu->gpr[1], _pgx1, 0x0003u); } #ifdef PSX_COSIM cosim_instr(0x80059F8Cu); #endif @@ -850709,7 +853068,8 @@ label_BFC42024: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC42038: 00401027 nor $v0, $v0, $zero */ - cpu->gpr[2] = ~(cpu->gpr[2] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[2] = ~(cpu->gpr[2] | cpu->gpr[0]); + PGXP_ALU(0x00401027u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A038u); #endif @@ -852183,7 +854543,8 @@ label_BFC421E0: psx_cyc_step(cpu, 0x3000100u); #endif /* 0xBFC42210: 03194024 and $t0, $t8, $t9 */ - cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[24] & cpu->gpr[25]; + PGXP_ALU(0x03194024u, cpu->gpr[8], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A210u); #endif @@ -852191,7 +854552,8 @@ label_BFC421E0: psx_cyc_step(cpu, 0x700u); #endif /* 0xBFC42214: 01095024 and $t2, $t0, $t1 */ - cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + PGXP_ALU(0x01095024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A214u); #endif @@ -852554,7 +854916,8 @@ label_BFC4226C: psx_cyc_step(cpu, 0x11800u); #endif /* 0xBFC4227C: 020B6024 and $t4, $s0, $t3 */ - cpu->gpr[12] = cpu->gpr[16] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[16] & cpu->gpr[11]; + PGXP_ALU(0x020B6024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A27Cu); #endif @@ -852565,7 +854928,8 @@ label_BFC4226C: psx_cyc_step(cpu, 0x7000u); #endif /* 0xBFC42280: 018D7024 and $t6, $t4, $t5 */ - cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + PGXP_ALU(0x018D7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A280u); #endif @@ -852573,7 +854937,8 @@ label_BFC4226C: psx_cyc_step(cpu, 0x100C000u); #endif /* 0xBFC42284: 01CFC024 and $t8, $t6, $t7 */ - cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[15]; cpu->gpr[24] = cpu->gpr[14] & cpu->gpr[15]; + PGXP_ALU(0x01CFC024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A284u); #endif @@ -852620,7 +854985,8 @@ label_BFC42290: psx_cyc_step(cpu, 0x2010001u); #endif /* 0xBFC42290: 0200C827 nor $t9, $s0, $zero */ - cpu->gpr[25] = ~(cpu->gpr[16] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[16]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[25] = ~(cpu->gpr[16] | cpu->gpr[0]); + PGXP_ALU(0x0200C827u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A290u); #endif @@ -852875,7 +855241,8 @@ label_BFC422D8: psx_cyc_step(cpu, 0x1C00u); #endif /* 0xBFC422E8: 014B6024 and $t4, $t2, $t3 */ - cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + { uint32_t _pgx1 = cpu->gpr[10]; uint32_t _pgx2 = cpu->gpr[11]; cpu->gpr[12] = cpu->gpr[10] & cpu->gpr[11]; + PGXP_ALU(0x014B6024u, cpu->gpr[12], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A2E8u); #endif @@ -852883,7 +855250,8 @@ label_BFC422D8: psx_cyc_step(cpu, 0x7000u); #endif /* 0xBFC422EC: 018D7024 and $t6, $t4, $t5 */ - cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + { uint32_t _pgx1 = cpu->gpr[12]; uint32_t _pgx2 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[12] & cpu->gpr[13]; + PGXP_ALU(0x018D7024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A2ECu); #endif @@ -853633,7 +856001,8 @@ label_BFC423A8: psx_cyc_step(cpu, 0x180u); #endif /* 0xBFC423C0: 30E8FFFF andi $t0, $a3, 0xFFFF */ - cpu->gpr[8] = cpu->gpr[7] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[7]; cpu->gpr[8] = cpu->gpr[7] & 0xFFFFu; + PGXP_ALU(0x30E8FFFFu, cpu->gpr[8], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8005A3C0u); #endif @@ -853780,7 +856149,8 @@ label_BFC423E4: psx_cyc_step(cpu, 0x5u); #endif /* 0xBFC423F8: 00401027 nor $v0, $v0, $zero */ - cpu->gpr[2] = ~(cpu->gpr[2] | cpu->gpr[0]); + { uint32_t _pgx1 = cpu->gpr[2]; uint32_t _pgx2 = cpu->gpr[0]; cpu->gpr[2] = ~(cpu->gpr[2] | cpu->gpr[0]); + PGXP_ALU(0x00401027u, cpu->gpr[2], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A3F8u); #endif @@ -853788,7 +856158,8 @@ label_BFC423E4: psx_cyc_step(cpu, 0x4004u); #endif /* 0xBFC423FC: 304EFFFF andi $t6, $v0, 0xFFFF */ - cpu->gpr[14] = cpu->gpr[2] & 0xFFFFu; + { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[14] = cpu->gpr[2] & 0xFFFFu; + PGXP_ALU(0x304EFFFFu, cpu->gpr[14], _pgx1, 0xFFFFu); } #ifdef PSX_COSIM cosim_instr(0x8005A3FCu); #endif @@ -853799,7 +856170,8 @@ label_BFC423E4: psx_cyc_step(cpu, 0xE000u); #endif /* 0xBFC42400: 01AE7824 and $t7, $t5, $t6 */ - cpu->gpr[15] = cpu->gpr[13] & cpu->gpr[14]; + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[13] & cpu->gpr[14]; + PGXP_ALU(0x01AE7824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A400u); #endif @@ -853843,7 +856215,8 @@ label_BFC423E4: psx_cyc_step(cpu, 0x3000004u); #endif /* 0xBFC42414: 0302C824 and $t9, $t8, $v0 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[2]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[2]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[2]; + PGXP_ALU(0x0302C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A414u); #endif @@ -854416,7 +856789,8 @@ label_BFC424A8: psx_cyc_step(cpu, 0xC000u); #endif /* 0xBFC424C8: 31CF3FFF andi $t7, $t6, 0x3FFF */ - cpu->gpr[15] = cpu->gpr[14] & 0x3FFFu; + { uint32_t _pgx1 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[14] & 0x3FFFu; + PGXP_ALU(0x31CF3FFFu, cpu->gpr[15], _pgx1, 0x3FFFu); } #ifdef PSX_COSIM cosim_instr(0x8005A4C8u); #endif @@ -854471,7 +856845,8 @@ label_BFC424A8: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC424E0: 33283FFF andi $t0, $t9, 0x3FFF */ - cpu->gpr[8] = cpu->gpr[25] & 0x3FFFu; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x3FFFu; + PGXP_ALU(0x33283FFFu, cpu->gpr[8], _pgx1, 0x3FFFu); } #ifdef PSX_COSIM cosim_instr(0x8005A4E0u); #endif @@ -854514,7 +856889,8 @@ label_BFC424A8: psx_cyc_step(cpu, 0xC00u); #endif /* 0xBFC424F4: 314B3FFF andi $t3, $t2, 0x3FFF */ - cpu->gpr[11] = cpu->gpr[10] & 0x3FFFu; + { uint32_t _pgx1 = cpu->gpr[10]; cpu->gpr[11] = cpu->gpr[10] & 0x3FFFu; + PGXP_ALU(0x314B3FFFu, cpu->gpr[11], _pgx1, 0x3FFFu); } #ifdef PSX_COSIM cosim_instr(0x8005A4F4u); #endif @@ -854557,7 +856933,8 @@ label_BFC424A8: psx_cyc_step(cpu, 0x6000u); #endif /* 0xBFC42508: 31AE1000 andi $t6, $t5, 0x1000 */ - cpu->gpr[14] = cpu->gpr[13] & 0x1000u; + { uint32_t _pgx1 = cpu->gpr[13]; cpu->gpr[14] = cpu->gpr[13] & 0x1000u; + PGXP_ALU(0x31AE1000u, cpu->gpr[14], _pgx1, 0x1000u); } #ifdef PSX_COSIM cosim_instr(0x8005A508u); #endif @@ -856355,7 +858732,8 @@ label_BFC4270C: psx_cyc_step(cpu, 0x40C000u); #endif /* 0xBFC42728: 01D67824 and $t7, $t6, $s6 */ - cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[22]; + { uint32_t _pgx1 = cpu->gpr[14]; uint32_t _pgx2 = cpu->gpr[22]; cpu->gpr[15] = cpu->gpr[14] & cpu->gpr[22]; + PGXP_ALU(0x01D67824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A728u); #endif @@ -856577,7 +858955,8 @@ label_BFC4276C: psx_cyc_step(cpu, 0x3020000u); #endif /* 0xBFC42774: 0311C824 and $t9, $t8, $s1 */ - cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[17]; + { uint32_t _pgx1 = cpu->gpr[24]; uint32_t _pgx2 = cpu->gpr[17]; cpu->gpr[25] = cpu->gpr[24] & cpu->gpr[17]; + PGXP_ALU(0x0311C824u, cpu->gpr[25], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A774u); #endif @@ -856648,7 +859027,8 @@ label_BFC42780: psx_cyc_step(cpu, 0x700u); #endif /* 0xBFC4278C: 01095024 and $t2, $t0, $t1 */ - cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + { uint32_t _pgx1 = cpu->gpr[8]; uint32_t _pgx2 = cpu->gpr[9]; cpu->gpr[10] = cpu->gpr[8] & cpu->gpr[9]; + PGXP_ALU(0x01095024u, cpu->gpr[10], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A78Cu); #endif @@ -856866,7 +859246,8 @@ label_BFC427C8: psx_cyc_step(cpu, 0x406000u); #endif /* 0xBFC427D0: 01B67024 and $t6, $t5, $s6 */ - cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[22]; + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[22]; cpu->gpr[14] = cpu->gpr[13] & cpu->gpr[22]; + PGXP_ALU(0x01B67024u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A7D0u); #endif @@ -856992,7 +859373,8 @@ label_BFC427F8: psx_cyc_step(cpu, 0x1008002u); #endif /* 0xBFC42800: 01E1C024 and $t8, $t7, $at */ - cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[1]; + { uint32_t _pgx1 = cpu->gpr[15]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[24] = cpu->gpr[15] & cpu->gpr[1]; + PGXP_ALU(0x01E1C024u, cpu->gpr[24], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A800u); #endif @@ -857062,7 +859444,8 @@ label_BFC42810: psx_cyc_step(cpu, 0x2000100u); #endif /* 0xBFC42818: 33288000 andi $t0, $t9, 0x8000 */ - cpu->gpr[8] = cpu->gpr[25] & 0x8000u; + { uint32_t _pgx1 = cpu->gpr[25]; cpu->gpr[8] = cpu->gpr[25] & 0x8000u; + PGXP_ALU(0x33288000u, cpu->gpr[8], _pgx1, 0x8000u); } #ifdef PSX_COSIM cosim_instr(0x8005A818u); #endif @@ -857558,7 +859941,8 @@ label_BFC42898: psx_cyc_step(cpu, 0x6002u); #endif /* 0xBFC428B0: 01A17027 nor $t6, $t5, $at */ - cpu->gpr[14] = ~(cpu->gpr[13] | cpu->gpr[1]); + { uint32_t _pgx1 = cpu->gpr[13]; uint32_t _pgx2 = cpu->gpr[1]; cpu->gpr[14] = ~(cpu->gpr[13] | cpu->gpr[1]); + PGXP_ALU(0x01A17027u, cpu->gpr[14], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A8B0u); #endif @@ -857566,7 +859950,8 @@ label_BFC42898: psx_cyc_step(cpu, 0xC800u); #endif /* 0xBFC428B4: 016E7824 and $t7, $t3, $t6 */ - cpu->gpr[15] = cpu->gpr[11] & cpu->gpr[14]; + { uint32_t _pgx1 = cpu->gpr[11]; uint32_t _pgx2 = cpu->gpr[14]; cpu->gpr[15] = cpu->gpr[11] & cpu->gpr[14]; + PGXP_ALU(0x016E7824u, cpu->gpr[15], _pgx1, _pgx2); } #ifdef PSX_COSIM cosim_instr(0x8005A8B4u); #endif diff --git a/overlay_toolchain/bios/OpenBIOS.toml b/overlay_toolchain/bios/OpenBIOS.toml new file mode 100644 index 00000000..141da1a4 --- /dev/null +++ b/overlay_toolchain/bios/OpenBIOS.toml @@ -0,0 +1,152 @@ +# bios/OpenBIOS.toml — BIOS build profile for PCSX-Redux OpenBIOS. +# +# OpenBIOS is the PCSX-Redux project's from-scratch, MIT-licensed PS1 BIOS +# (https://github.com/grumpycoders/pcsx-redux, src/mips/openbios). MIT means +# the image is REDISTRIBUTABLE: a game verified against it ships its BIOS +# with the build and the player supplies only a disc (redistributable=true +# below removes the whole BIOS-selection surface at runtime). +# +# Pinned build (bios/openbios.bin + the ELFs the seeds derive from): +# pcsx-redux 55fbf0468345acfbe5512628a3be5c0cfe3f22e7 +# uC-sdk 69e06871824e2d62069487a7426ded09090ceb69 +# toolchain g++-mipsel-none-elf (GCC 16.1.0, static.grumpycoder.net build) +# build make -C src/mips/openbios PREFIX=mipsel-none-elf FORMAT=elf32-littlemips +# Regenerating seeds after a re-pin (--extra is REQUIRED to keep the 5 +# empirically-discovered dispatch-miss seeds; without it they are silently +# dropped and the regenerated set has 641 entries, not 646): +# tools/gen_bios_seeds_from_elf.py --profile bios/OpenBIOS.toml \ +# --elf .../openbios.elf --elf .../shell.elf \ +# --extra recompiler/seeds/openbios_dispatch_miss.json \ +# --out recompiler/seeds/openbios_elf_seeds.json +# +# The address model below was established by direct disassembly of the boot +# path (reset vector -> copy loops), each copy confirmed twice (boot + the +# warm-restart path reloading lengths from ROM constants; the shell length +# additionally confirmed by the blob's own self-relocation constants). + +[program] +name = "PCSX-Redux OpenBIOS" +id = "OPENBIOS" +rom = "bios/openbios.bin" +load_address = "0xBFC00000" +entry_pc = "0xBFC00000" +text_size = "0x80000" + +[program.image] +sha256 = "fabe498fbf224e4721f12f31b6f5fe0659205e341dc4e5c5f91b9bd1a1011c57" +license = "MIT" +redistributable = true + +[recompiler] +seeds = "recompiler/seeds/openbios_elf_seeds.json" +out_dir = "generated" +out_stem = "OpenBIOS" +strict = true + +# OpenBIOS's boot-time bulk code copies. Windows are BYTE-PROVEN against +# openbios.elf (readelf -lW program headers give the .data LMA; the embedded +# shell blob was located by content search; both ranges memcmp-verified +# ELF-content == image-content — an earlier hand-disassembly of the copy +# routines mis-read both source offsets by 0xB8/0x2C0-class deltas, which +# emitted every shell/ramtext function from shifted bytes): +# - kernel .data (VMA 0x500, WAX — code+data): LMA 0xBFC1E4D4, FileSiz +# 0x46A0, copied to RAM 0x500 at boot. Byte-verbatim -> kernel_bless. +# - shell blob (objcopy of shell.elf, linked at 0x80030000): embedded in +# .rodata at ROM 0xA500, size 0x13D44, copied to RAM 0x80030000. The +# first-crash a1=0xBFC1E244 was exactly this blob's END pointer mid-copy. +# NOT modeled, by design: +# - the 4x16-byte vector stubs copied to RAM 0x80/0xA0/0xB0/0xC0 +# (runtime-written trampolines -> dirty-RAM interp territory, rule 18); +# - the RAM->RAM A0-table move (0x4844 -> 0x200): nothing dispatches TO the +# table, discovery gets entries from ELF symbols, and runtime dispatch +# keys on the actual jump targets. +[recompiler.address_model] +normalize_mask = "0x1FFFFFFF" + +[[recompiler.address_model.copy]] +name = "Kernel ramtext" +rom_lo = "0x1FC1E4D4" +rom_hi = "0x1FC22B74" +ram_lo = "0x00000500" +runtime_base = "0x00000500" +dispatch_key = "ram" +kernel_bless = true + +[[recompiler.address_model.copy]] +name = "Shell" +rom_lo = "0x1FC0A500" +rom_hi = "0x1FC1E244" +ram_lo = "0x00030000" +runtime_base = "0x80030000" +dispatch_key = "rom" +kernel_bless = false + +# Kernel-RAM RANGES the guest's Psy-Q libapi patchers overwrite at runtime +# (CLAUDE.md rule 18; docs/dynamic_handler_install.md). See SCPH1001.toml for +# what `len` and `resume` mean. OpenBIOS declared none until 2026-09-11; the +# consequence was that its exception handler failed the kernel-bless memcmp +# from the first card access onward and interpreted for the life of the +# process — 1.22 billion instructions in one measured title. +# +# Measured on a live boot of Breath of Fire III (SLPS-00990, Psy-Q SDK 3.70) +# against the ROM source, 30 s in. The shapes are the same three the retail +# image shows, because the patchers are the game's, not the BIOS's. + +[[recompiler.install_slots]] +ram_addr = "0x000027B4" # exceptionHandler: register-save prologue +len = "0x30" # shifted two words + an inserted mfc0 v0,Cause +resume = "fallthrough" + +[[recompiler.install_slots]] +ram_addr = "0x0000281C" # stub into exceptionHandlerCardFastTrack +len = "0x10" # lui/addiu/jalr/nop over ROM zeros; installed +resume = "jalr" # on the first card access, not at boot + +[[recompiler.install_slots]] +ram_addr = "0x0000357C" # exceptionHandlerCardFastTrack: the kernel's +len = "0x10" # card handler replaced by jr into boot EXE +resume = "none" # 0x8017EAA0 (_patch_card payload) + +# NOT declared: the three pad-table words after readPadHighLevel (0x45FC, +# 0x460C, 0x461C). They are data, not instructions, so they unbless nothing +# and a range there would only widen what the verifier stops checking. + +# HLE anchors: only the boot-skip anchor is exported. deliver_event_ret is +# deliberately ABSENT (0) until the B0 event services are validated against +# this kernel's EvCB behavior (they are believed compatible — OpenBIOS +# reimplements the documented kernel ABI, EvCB anchor 0x120/0x124, TCB +# 0x108/0x110 — but believed is not verified). Absent = the kernel-call HLE +# tier is STRUCTURALLY UNAVAILABLE here and config/env cannot force it on. +# +# That refusal is scoped to kernel calls ONLY. The boot-skip is a separate axis +# gated on shell_entry_phys alone and works under pure LLE, so `bios_hle` (and +# the deprecated `fast_boot` alias) skips the boot animation and goes straight +# to the game on THIS image exactly as it does on retail SCPH-1001 — the flag +# means one thing on every BIOS. Both axes are decided in one pure place, +# psx_bios_hle_plan() (runtime/include/bios_hle_plan.h), which exists because +# deriving the boot-skip from the anchor-gated call tier silently took the skip +# away on this image (fixed 2026-07-27). +# +# shell_entry_phys was verified against the generated C (2026-07-23): +# - startShell (ELF symbol, ROM 0xBFC074DC) ends `lui $t9,0x8003; jr $t9` +# (0xBFC07534/38) — a TAIL jump to the RAM shell copy at 0x80030000 +# that goes through the dispatch trampoline, where the hook fires on +# the pre-normalize phys 0x00030000; +# - $ra at that point is the jal link 0xBFC06EA8 (startShell restores its +# stack before the tail jump), so the intercept's resume-at-$ra lands +# exactly at the shell call's continuation; +# - that continuation OVERWRITES $v0 immediately (addiu $v0,$zero,8 — a +# boot-progress POST byte), so the intercept's v0=0 is never observed, +# and the boot proceeds unconditionally to the SYSTEM.CNF/EXE load +# (gameMainThunk), exactly the retail LoadRunShell contract the skip +# models. The shell's own animation (waitVSync/flip/convexHull in +# shell.elf) is the only thing skipped. +[recompiler.runtime_exports] +shell_entry_phys = "0x00030000" + +# No [runtime] block: a BIOS profile states facts about an image, never runtime +# preferences, and load_bios_config rejects one outright. This file used to end +# with `[runtime] bios_hle = false`, which nothing read — the recompiler parsed +# it into a field with no consumers. Runtime options live in game.toml / +# settings.toml; per-image HLE capability is expressed by which anchors +# [recompiler.runtime_exports] above does and does not export. diff --git a/overlay_toolchain/bios/SCPH1001.toml b/overlay_toolchain/bios/SCPH1001.toml new file mode 100644 index 00000000..5f5b39b8 --- /dev/null +++ b/overlay_toolchain/bios/SCPH1001.toml @@ -0,0 +1,138 @@ +# bios/SCPH1001.toml — BIOS build profile for the retail Sony SCPH-1001 image. +# +# One profile per BIOS image. Consumed by `psxrecomp-bios --config`, by +# tools/regen_bios.sh (which reads rom/seeds/out_dir/out_stem from here), and +# by tools/bios_emitter_fingerprint.sh (which hashes this file, the seeds and +# the ROM into the generated/.emitter.sha staleness stamp). +# +# The .BIN image itself stays untracked (bios/* gitignore rule) — profiles are +# the only tracked contents of this directory. + +[program] +name = "Sony SCPH-1001 BIOS" +id = "SCPH-1001" +rom = "bios/SCPH1001.BIN" +load_address = "0xBFC00000" +entry_pc = "0xBFC00000" +text_size = "0x80000" + +# Declared identity. The emitter refuses to generate from any other image +# (main_bios.cpp's declared-identity gate), which is the point: the seeds in +# this profile name v2.2 function starts, and generating from a SCPH-1001 +# **v2.0** dump (CRC32 55847D8C, 1994-09-22) produced three boot halts and a +# live A0 table with 90 of 161 ROM targets uncompiled. That looked like +# missing upstream seeds and was actually a revision mismatch. An empty pin +# let it through silently. +# +# This is v2.2, 1995-09-18: CRC32 37157331, 512 KiB. +[program.image] +sha256 = "71af94d1e47a68c11e8fdb9f8368040601514a42a5a399cda48c7d3bff1e99d3" +license = "proprietary" +redistributable = false + +[recompiler] +seeds = "recompiler/seeds/phase2_ghidra_seeds.json" +out_dir = "generated" +out_stem = "SCPH1001" +strict = true + +# The BIOS's boot-time bulk copies of CODE out of ROM into RAM. Single source +# of truth for every relocation window in the recompiler AND in the C it +# emits (the generated dispatch's normalize(), the kernel-bless guard, the +# game/shell-overlap tests). Each entry is a CLAIM that the copy is +# byte-verbatim; the runtime's kernel-bless memcmp enforces it for the +# bless window. All bounds are [lo, hi) with hi EXCLUSIVE. +# +# dispatch_key = "ram": functions in the window are keyed by RAM address +# (normalize folds ROM -> RAM). +# dispatch_key = "rom": functions keep their ROM key (normalize folds the +# RAM alias back to ROM). +[recompiler.address_model] +normalize_mask = "0x1FFFFFFF" + +[[recompiler.address_model.copy]] +name = "Kernel Part 2" +rom_lo = "0x1FC10000" +rom_hi = "0x1FC18000" +ram_lo = "0x00000500" +runtime_base = "0x00000500" # KUSEG — the kernel executes uncached-region code cached at 0x500 +dispatch_key = "ram" +kernel_bless = true + +[[recompiler.address_model.copy]] +name = "Shell" +rom_lo = "0x1FC18000" +rom_hi = "0x1FC43000" +ram_lo = "0x00030000" +runtime_base = "0x80030000" # KSEG0 — LoadRunShell jumps to 0x80030000 +dispatch_key = "rom" +kernel_bless = false +# NOTE (do not "fix" without evidence): runtime/src/bios_hle.c documents the +# actual LoadRunShell copy as 0x67FF0 bytes (ROM 0xBFC18000 -> RAM 0x30000.. +# 0x97FF0). Every pre-profile window constant covered only 0x2B000 of that, +# and dirty_ram_interp.c tracks live RAM in [0x5B000,0x8F000) as an open +# class-B bug. Widening this window is a REAL BEHAVIOR CHANGE requiring its +# own evidence-backed commit — it is not a parameterization cleanup. + +# Kernel-RAM RANGES the BIOS and the game's Psy-Q libapi patchers overwrite at +# runtime (CLAUDE.md rule 18; docs/dynamic_handler_install.md). The emitter +# plants a compare-against-ROM hook at each range start so the guest's patched +# instructions execute; the runtime excludes the range from the kernel-bless +# memcmp and resumes native at the range end, so only the patched words +# interpret. +# +# `resume` says how the compiled body picks up again: "jalr" for the classic +# 4-word lui/addiu/jalr/nop stub (the call returns to ram_addr+0x10), +# "fallthrough" when the patched words ARE the function, "none" when the patch +# jumps out and never comes back. +# +# Measured on a live boot of Breath of Fire III (SLPS-00990, Psy-Q SDK 3.70) +# against the ROM source, 30 s in, identical at t+8 s — the patchers are +# _patch_gte / _patch_card / _patch_card2 / _patch_pad. Every SDK title runs +# these, so the ranges are a property of the BIOS revision and libapi release, +# not of one game. Re-measure per SDK version before trusting the numbers: +# the schema tolerates declaring the union. + +[[recompiler.install_slots]] +ram_addr = "0x00000C88" # exception handler: register-save prologue +len = "0x30" # shifted two words + an inserted mfc0 v0,Cause +resume = "fallthrough" # the patched words are the function itself + +[[recompiler.install_slots]] +ram_addr = "0x00000CF0" # SIO data-byte handler dispatch slot +len = "0x10" # lui/addiu/jalr/nop over ROM zeros +resume = "jalr" # the stub's call returns to 0x0D00 + +[[recompiler.install_slots]] +ram_addr = "0x00004964" # pad driver clear routine, 11 words NOP'd +len = "0x2C" # (RemovePatchPad / ChgclrPAD family) +resume = "fallthrough" + +[[recompiler.install_slots]] +ram_addr = "0x00004D98" # _patch_card2 payload: jalr into boot EXE +len = "0x14" # 0x8017EB6C; the ra landing word is NOP'd too, +resume = "fallthrough" # so the body resumes past it, not at +0x10 + +[[recompiler.install_slots]] +ram_addr = "0x00006444" # _patch_card payload: the kernel's card +len = "0x10" # handler replaced by jr into boot EXE +resume = "none" # 0x8017EAA0 — a jr never returns here + +# NOT declared: RAM 0x0500, one word of kernel_trampoline_0 cleared to zero +# (ROM `lui t2, 0`). It differs on every boot, but what writes it is not yet +# identified, and a range declared on a guess would tell the bless verifier to +# stop checking a word it should be checking. Rule 14: unknown is acceptable, +# guessing is not. Undeclared means that body keeps interpreting, exactly as +# it does today. + +# Per-image anchors couriered into the generated C (psx_bios_image) for the +# runtime HLE tier. Values are FACTS about this image, not tunables: the +# shell entry is where LoadRunShell (ROM 0xBFC06FF0) jumps after its copy; +# deliver_event_ret is the instruction after the kernel DeliverEvent loop's +# `jalr v0` (kernel RAM 0x1718), the $ra a delivered event callback returns +# through. Omit a key on a BIOS that has no such anchor — the runtime then +# treats that HLE feature as structurally unavailable instead of firing on a +# wrong address. +[recompiler.runtime_exports] +shell_entry_phys = "0x00030000" +deliver_event_ret = "0x80001720" diff --git a/overlay_toolchain/bios/SCPH101.toml b/overlay_toolchain/bios/SCPH101.toml new file mode 100644 index 00000000..8d18728a --- /dev/null +++ b/overlay_toolchain/bios/SCPH101.toml @@ -0,0 +1,44 @@ +# SCPH-101 (US PSOne, v4.5 05/25/00) +# Boot + kernel are byte-identical to SCPH1001 (534 seeds kept). +# Shell (ROM 0x18000+, 568 seeds) differs — runs via dirty-RAM interpreter. + +[program] +name = "SCPH101 BIOS (PSOne)" +id = "SCPH-101" +rom = "bios/US-PSOne-SCPH101.BIN" +load_address = "0xBFC00000" +entry_pc = "0xBFC00000" +text_size = "0x80000" + +[recompiler] +seeds = "recompiler/seeds/phase2_ghidra_seeds_SCPH101.json" +out_dir = "generated" +out_stem = "SCPH101" +strict = true + +# SCPH101 shares SCPH1001's A0/B0/C0 dispatch tables and kernel layout. +# The BIOS vector table ROM addresses and aliases are identical. +[[recompiler.bios_vectors]] +ram_addr = "0xA0" +index_reg = 9 +table_rom_addr = "0xBFC04300" +table_count = 0xC1 +table_ram_addr = "0x200" + +[[recompiler.bios_vectors]] +ram_addr = "0xB0" +index_reg = 9 +table_rom_addr = "0xBFC10874" +table_count = 0x44 +table_ram_addr = "0x874" + +[[recompiler.bios_vectors]] +ram_addr = "0xC0" +index_reg = 9 +table_rom_addr = "0xBFC10674" +table_count = 0x1E +table_ram_addr = "0x674" + +[[recompiler.bios_aliases]] +ram_addr = "0xCF0" +target_key = "0x641C" diff --git a/overlay_toolchain/bios/SCPH5500.toml b/overlay_toolchain/bios/SCPH5500.toml new file mode 100644 index 00000000..51408b58 --- /dev/null +++ b/overlay_toolchain/bios/SCPH5500.toml @@ -0,0 +1,142 @@ +# bios/SCPH5500.toml — BIOS build profile for the retail Sony SCPH-5500 image +# (Japan, v3.0 09/09/96). +# +# Compared byte for byte with the SCPH-1001 v2.2 image (bios/SCPH1001.toml): +# ROM [0x00000,0x00080) reset vector 24 bytes differ +# ROM [0x00080,0x18000) kernel identical +# ROM [0x18000,0x80000) shell differs +# So every kernel property below (copy windows, install slots) carries over +# unchanged. Because the reset vector differs, this image has its own seed +# list, recompiler/seeds/phase2_ghidra_seeds_SCPH5500.json: the SCPH-1001 +# corpus filtered to seeds whose 64-byte window is identical in both ROMs, +# plus the architectural vectors and this ROM's own A0/B0/C0 table targets +# (the same rule as phase2_ghidra_seeds_SCPH5552.json). The shell has no seeds +# of its own; it runs through the dirty-RAM interpreter (build with +# -DPSX_SHELLWIN_INTERP=ON), as for SCPH5552. +# +# One profile per BIOS image. Consumed by `psxrecomp-bios --config`, by +# tools/regen_bios.sh and by tools/bios_emitter_fingerprint.sh, as for +# SCPH1001.toml. The .BIN image itself stays untracked (bios/* gitignore rule). + +[program] +name = "Sony SCPH-5500 BIOS (Japan, v3.0 09/09/96)" +id = "SCPH-5500" +rom = "bios/SCPH5500.BIN" +load_address = "0xBFC00000" +entry_pc = "0xBFC00000" +text_size = "0x80000" + +# Declared identity. The emitter refuses to generate from any other image +# (main_bios.cpp's declared-identity gate). SCPH-5500 v3.0: CRC32 FF3EEB8C, +# 512 KiB. +[program.image] +sha256 = "9c0421858e217805f4abe18698afea8d5aa36ff0727eb8484944e00eb5e7eadb" +license = "proprietary" +redistributable = false + +[recompiler] +seeds = "recompiler/seeds/phase2_ghidra_seeds_SCPH5500.json" +out_dir = "generated" +out_stem = "SCPH5500" +strict = true + +# The BIOS's boot-time bulk copies of CODE out of ROM into RAM. Single source +# of truth for every relocation window in the recompiler AND in the C it +# emits (the generated dispatch's normalize(), the kernel-bless guard, the +# game/shell-overlap tests). Each entry is a CLAIM that the copy is +# byte-verbatim; the runtime's kernel-bless memcmp enforces it for the +# bless window. All bounds are [lo, hi) with hi EXCLUSIVE. +# +# dispatch_key = "ram": functions in the window are keyed by RAM address +# (normalize folds ROM -> RAM). +# dispatch_key = "rom": functions keep their ROM key (normalize folds the +# RAM alias back to ROM). +[recompiler.address_model] +normalize_mask = "0x1FFFFFFF" + +[[recompiler.address_model.copy]] +name = "Kernel Part 2" +rom_lo = "0x1FC10000" +rom_hi = "0x1FC18000" +ram_lo = "0x00000500" +runtime_base = "0x00000500" # KUSEG — the kernel executes uncached-region code cached at 0x500 +dispatch_key = "ram" +kernel_bless = true + +[[recompiler.address_model.copy]] +name = "Shell" +rom_lo = "0x1FC18000" +rom_hi = "0x1FC43000" +ram_lo = "0x00030000" +runtime_base = "0x80030000" # KSEG0 — LoadRunShell jumps to 0x80030000 +dispatch_key = "rom" +kernel_bless = false +# NOTE (do not "fix" without evidence): runtime/src/bios_hle.c documents the +# actual LoadRunShell copy as 0x67FF0 bytes (ROM 0xBFC18000 -> RAM 0x30000.. +# 0x97FF0). Every pre-profile window constant covered only 0x2B000 of that, +# and dirty_ram_interp.c tracks live RAM in [0x5B000,0x8F000) as an open +# class-B bug. Widening this window is a REAL BEHAVIOR CHANGE requiring its +# own evidence-backed commit — it is not a parameterization cleanup. + +# Kernel-RAM RANGES the BIOS and the game's Psy-Q libapi patchers overwrite at +# runtime (CLAUDE.md rule 18; docs/dynamic_handler_install.md). The emitter +# plants a compare-against-ROM hook at each range start so the guest's patched +# instructions execute; the runtime excludes the range from the kernel-bless +# memcmp and resumes native at the range end, so only the patched words +# interpret. +# +# `resume` says how the compiled body picks up again: "jalr" for the classic +# 4-word lui/addiu/jalr/nop stub (the call returns to ram_addr+0x10), +# "fallthrough" when the patched words ARE the function, "none" when the patch +# jumps out and never comes back. +# +# Measured on a live boot of Breath of Fire III (SLPS-00990, Psy-Q SDK 3.70) +# against the ROM source, 30 s in, identical at t+8 s — the patchers are +# _patch_gte / _patch_card / _patch_card2 / _patch_pad. Every SDK title runs +# these, so the ranges are a property of the BIOS revision and libapi release, +# not of one game. Re-measure per SDK version before trusting the numbers: +# the schema tolerates declaring the union. + +[[recompiler.install_slots]] +ram_addr = "0x00000C88" # exception handler: register-save prologue +len = "0x30" # shifted two words + an inserted mfc0 v0,Cause +resume = "fallthrough" # the patched words are the function itself + +[[recompiler.install_slots]] +ram_addr = "0x00000CF0" # SIO data-byte handler dispatch slot +len = "0x10" # lui/addiu/jalr/nop over ROM zeros +resume = "jalr" # the stub's call returns to 0x0D00 + +[[recompiler.install_slots]] +ram_addr = "0x00004964" # pad driver clear routine, 11 words NOP'd +len = "0x2C" # (RemovePatchPad / ChgclrPAD family) +resume = "fallthrough" + +[[recompiler.install_slots]] +ram_addr = "0x00004D98" # _patch_card2 payload: jalr into boot EXE +len = "0x14" # 0x8017EB6C; the ra landing word is NOP'd too, +resume = "fallthrough" # so the body resumes past it, not at +0x10 + +[[recompiler.install_slots]] +ram_addr = "0x00006444" # _patch_card payload: the kernel's card +len = "0x10" # handler replaced by jr into boot EXE +resume = "none" # 0x8017EAA0 — a jr never returns here + +# NOT declared: RAM 0x0500, one word of kernel_trampoline_0 cleared to zero +# (ROM `lui t2, 0`). It differs on every boot, but what writes it is not yet +# identified, and a range declared on a guess would tell the bless verifier to +# stop checking a word it should be checking. Rule 14: unknown is acceptable, +# guessing is not. Undeclared means that body keeps interpreting, exactly as +# it does today. + +# Per-image anchors couriered into the generated C (psx_bios_image) for the +# runtime HLE tier. Values are FACTS about this image, not tunables: the +# shell entry is where LoadRunShell (ROM 0xBFC06FF0) jumps after its copy; +# deliver_event_ret is the instruction after the kernel DeliverEvent loop's +# `jalr v0` (kernel RAM 0x1718), the $ra a delivered event callback returns +# through. Omit a key on a BIOS that has no such anchor — the runtime then +# treats that HLE feature as structurally unavailable instead of firing on a +# wrong address. +[recompiler.runtime_exports] +shell_entry_phys = "0x00030000" +deliver_event_ret = "0x80001720" diff --git a/overlay_toolchain/bios/SCPH5501.toml b/overlay_toolchain/bios/SCPH5501.toml new file mode 100644 index 00000000..ded9be47 --- /dev/null +++ b/overlay_toolchain/bios/SCPH5501.toml @@ -0,0 +1,141 @@ +# bios/SCPH5501.toml — BIOS build profile for the retail Sony SCPH-5501 image +# (USA, v3.0 11/18/96). +# +# Compared byte for byte with the SCPH-1001 v2.2 image (bios/SCPH1001.toml): +# ROM [0x00000,0x00080) reset vector identical +# ROM [0x00080,0x18000) kernel identical +# ROM [0x18000,0x80000) shell differs +# So every kernel property below (copy windows, install slots) carries over +# unchanged. The seed list, recompiler/seeds/phase2_ghidra_seeds_SCPH5501.json, +# is the SCPH-1001 corpus filtered to seeds whose 64-byte window is identical +# in both ROMs, plus the architectural vectors and this ROM's own A0/B0/C0 +# table targets (the same rule as phase2_ghidra_seeds_SCPH5552.json). The shell +# has no seeds of its own; it runs through the dirty-RAM interpreter (build +# with -DPSX_SHELLWIN_INTERP=ON), as for SCPH5552. +# +# One profile per BIOS image. Consumed by `psxrecomp-bios --config`, by +# tools/regen_bios.sh and by tools/bios_emitter_fingerprint.sh, as for +# SCPH1001.toml. The .BIN image itself stays untracked (bios/* gitignore rule). + +[program] +name = "Sony SCPH-5501 BIOS (USA, v3.0 11/18/96)" +id = "SCPH-5501" +rom = "bios/SCPH5501.BIN" +load_address = "0xBFC00000" +entry_pc = "0xBFC00000" +text_size = "0x80000" + +# Declared identity. The emitter refuses to generate from any other image +# (main_bios.cpp's declared-identity gate). SCPH-5501 v3.0: CRC32 8D8CB7E4, +# 512 KiB. +[program.image] +sha256 = "11052b6499e466bbf0a709b1f9cb6834a9418e66680387912451e971cf8a1fef" +license = "proprietary" +redistributable = false + +[recompiler] +seeds = "recompiler/seeds/phase2_ghidra_seeds_SCPH5501.json" +out_dir = "generated" +out_stem = "SCPH5501" +strict = true + +# The BIOS's boot-time bulk copies of CODE out of ROM into RAM. Single source +# of truth for every relocation window in the recompiler AND in the C it +# emits (the generated dispatch's normalize(), the kernel-bless guard, the +# game/shell-overlap tests). Each entry is a CLAIM that the copy is +# byte-verbatim; the runtime's kernel-bless memcmp enforces it for the +# bless window. All bounds are [lo, hi) with hi EXCLUSIVE. +# +# dispatch_key = "ram": functions in the window are keyed by RAM address +# (normalize folds ROM -> RAM). +# dispatch_key = "rom": functions keep their ROM key (normalize folds the +# RAM alias back to ROM). +[recompiler.address_model] +normalize_mask = "0x1FFFFFFF" + +[[recompiler.address_model.copy]] +name = "Kernel Part 2" +rom_lo = "0x1FC10000" +rom_hi = "0x1FC18000" +ram_lo = "0x00000500" +runtime_base = "0x00000500" # KUSEG — the kernel executes uncached-region code cached at 0x500 +dispatch_key = "ram" +kernel_bless = true + +[[recompiler.address_model.copy]] +name = "Shell" +rom_lo = "0x1FC18000" +rom_hi = "0x1FC43000" +ram_lo = "0x00030000" +runtime_base = "0x80030000" # KSEG0 — LoadRunShell jumps to 0x80030000 +dispatch_key = "rom" +kernel_bless = false +# NOTE (do not "fix" without evidence): runtime/src/bios_hle.c documents the +# actual LoadRunShell copy as 0x67FF0 bytes (ROM 0xBFC18000 -> RAM 0x30000.. +# 0x97FF0). Every pre-profile window constant covered only 0x2B000 of that, +# and dirty_ram_interp.c tracks live RAM in [0x5B000,0x8F000) as an open +# class-B bug. Widening this window is a REAL BEHAVIOR CHANGE requiring its +# own evidence-backed commit — it is not a parameterization cleanup. + +# Kernel-RAM RANGES the BIOS and the game's Psy-Q libapi patchers overwrite at +# runtime (CLAUDE.md rule 18; docs/dynamic_handler_install.md). The emitter +# plants a compare-against-ROM hook at each range start so the guest's patched +# instructions execute; the runtime excludes the range from the kernel-bless +# memcmp and resumes native at the range end, so only the patched words +# interpret. +# +# `resume` says how the compiled body picks up again: "jalr" for the classic +# 4-word lui/addiu/jalr/nop stub (the call returns to ram_addr+0x10), +# "fallthrough" when the patched words ARE the function, "none" when the patch +# jumps out and never comes back. +# +# Measured on a live boot of Breath of Fire III (SLPS-00990, Psy-Q SDK 3.70) +# against the ROM source, 30 s in, identical at t+8 s — the patchers are +# _patch_gte / _patch_card / _patch_card2 / _patch_pad. Every SDK title runs +# these, so the ranges are a property of the BIOS revision and libapi release, +# not of one game. Re-measure per SDK version before trusting the numbers: +# the schema tolerates declaring the union. + +[[recompiler.install_slots]] +ram_addr = "0x00000C88" # exception handler: register-save prologue +len = "0x30" # shifted two words + an inserted mfc0 v0,Cause +resume = "fallthrough" # the patched words are the function itself + +[[recompiler.install_slots]] +ram_addr = "0x00000CF0" # SIO data-byte handler dispatch slot +len = "0x10" # lui/addiu/jalr/nop over ROM zeros +resume = "jalr" # the stub's call returns to 0x0D00 + +[[recompiler.install_slots]] +ram_addr = "0x00004964" # pad driver clear routine, 11 words NOP'd +len = "0x2C" # (RemovePatchPad / ChgclrPAD family) +resume = "fallthrough" + +[[recompiler.install_slots]] +ram_addr = "0x00004D98" # _patch_card2 payload: jalr into boot EXE +len = "0x14" # 0x8017EB6C; the ra landing word is NOP'd too, +resume = "fallthrough" # so the body resumes past it, not at +0x10 + +[[recompiler.install_slots]] +ram_addr = "0x00006444" # _patch_card payload: the kernel's card +len = "0x10" # handler replaced by jr into boot EXE +resume = "none" # 0x8017EAA0 — a jr never returns here + +# NOT declared: RAM 0x0500, one word of kernel_trampoline_0 cleared to zero +# (ROM `lui t2, 0`). It differs on every boot, but what writes it is not yet +# identified, and a range declared on a guess would tell the bless verifier to +# stop checking a word it should be checking. Rule 14: unknown is acceptable, +# guessing is not. Undeclared means that body keeps interpreting, exactly as +# it does today. + +# Per-image anchors couriered into the generated C (psx_bios_image) for the +# runtime HLE tier. Values are FACTS about this image, not tunables: the +# shell entry is where LoadRunShell (ROM 0xBFC06FF0) jumps after its copy; +# deliver_event_ret is the instruction after the kernel DeliverEvent loop's +# `jalr v0` (kernel RAM 0x1718), the $ra a delivered event callback returns +# through. Omit a key on a BIOS that has no such anchor — the runtime then +# treats that HLE feature as structurally unavailable instead of firing on a +# wrong address. +[recompiler.runtime_exports] +shell_entry_phys = "0x00030000" +deliver_event_ret = "0x80001720" diff --git a/overlay_toolchain/bios/SCPH5552.toml b/overlay_toolchain/bios/SCPH5552.toml new file mode 100644 index 00000000..a943496e --- /dev/null +++ b/overlay_toolchain/bios/SCPH5552.toml @@ -0,0 +1,153 @@ +# bios/SCPH5552.toml — BIOS build profile for the retail Sony SCPH-5502/5552 +# (Europe) v3.0 01/06/97 image ("System ROM Version 3.0 01/06/97 E", +# SHA-256 1faaa18fa820a0225e488d9f086296b8e6c46df739666093987ff7d8fd352c09). +# +# Derived from bios/SCPH1001.toml. ROM 0x00000-0x17FFF (boot + Kernel Part 1/2) +# is byte-identical to the US SCPH-1001 v2.2 image, so every kernel anchor +# below (copy windows, install slots, deliver_event_ret, shell entry) carries +# over unchanged. Verified by direct comparison of the two dumps, each matching +# its declared identity (SCPH-1001 CRC32 37157331, SCPH-5552 CRC32 D786F0B9): +# 0x00000-0x0FFFF and 0x10000-0x17FFF identical; the shell at 0x18000-0x42FFF +# differs in 155874 bytes. +# +# Because the shell DIFFERS from the US image, this profile has no shell seeds: +# recompiler/seeds/phase2_ghidra_seeds_SCPH5552.json is the SCPH1001 corpus +# filtered through tools/filter_bios_seeds.py to the kernel region, and every +# seed in it lies below ROM 0x18000. The shell window runs through the dirty-RAM +# interpreter (build with -DPSX_SHELLWIN_INTERP=ON) until an EU-shell seed +# corpus exists. +# +# The .BIN image itself stays untracked (bios/* gitignore rule) — profiles are +# the only tracked contents of this directory. + +[program] +name = "Sony SCPH-5552 BIOS (Europe, v3.0 01/06/97)" +id = "SCPH-5552" +rom = "bios/EUR-PSX-SCPH5552.bin" +load_address = "0xBFC00000" +entry_pc = "0xBFC00000" +text_size = "0x80000" + +# Declared identity. The emitter refuses to generate from any other image +# (main_bios.cpp's declared-identity gate). Without this pin a different +# revision generates silently: the kernel seeds above name v3.0 function starts +# only because the kernel matches SCPH-1001 v2.2 byte for byte, and a dump that +# differs there would break that premise without any error. +# +# This is v3.0, 1997-01-06: CRC32 D786F0B9, 512 KiB. +[program.image] +sha256 = "1faaa18fa820a0225e488d9f086296b8e6c46df739666093987ff7d8fd352c09" +license = "proprietary" +redistributable = false + +[recompiler] +seeds = "recompiler/seeds/phase2_ghidra_seeds_SCPH5552.json" +out_dir = "generated" +out_stem = "SCPH5552" +strict = true + +# The BIOS's boot-time bulk copies of CODE out of ROM into RAM. Single source +# of truth for every relocation window in the recompiler AND in the C it +# emits (the generated dispatch's normalize(), the kernel-bless guard, the +# game/shell-overlap tests). Each entry is a CLAIM that the copy is +# byte-verbatim; the runtime's kernel-bless memcmp enforces it for the +# bless window. All bounds are [lo, hi) with hi EXCLUSIVE. +# +# dispatch_key = "ram": functions in the window are keyed by RAM address +# (normalize folds ROM -> RAM). +# dispatch_key = "rom": functions keep their ROM key (normalize folds the +# RAM alias back to ROM). +[recompiler.address_model] +normalize_mask = "0x1FFFFFFF" + +[[recompiler.address_model.copy]] +name = "Kernel Part 2" +rom_lo = "0x1FC10000" +rom_hi = "0x1FC18000" +ram_lo = "0x00000500" +runtime_base = "0x00000500" # KUSEG — the kernel executes uncached-region code cached at 0x500 +dispatch_key = "ram" +kernel_bless = true + +[[recompiler.address_model.copy]] +name = "Shell" +rom_lo = "0x1FC18000" +rom_hi = "0x1FC43000" +ram_lo = "0x00030000" +runtime_base = "0x80030000" # KSEG0 — LoadRunShell jumps to 0x80030000 +dispatch_key = "rom" +kernel_bless = false +# NOTE (do not "fix" without evidence): runtime/src/bios_hle.c documents the +# actual LoadRunShell copy as 0x67FF0 bytes (ROM 0xBFC18000 -> RAM 0x30000.. +# 0x97FF0). Every pre-profile window constant covered only 0x2B000 of that, +# and dirty_ram_interp.c tracks live RAM in [0x5B000,0x8F000) as an open +# class-B bug. Widening this window is a REAL BEHAVIOR CHANGE requiring its +# own evidence-backed commit — it is not a parameterization cleanup. + +# Kernel-RAM RANGES the BIOS and the game's Psy-Q libapi patchers overwrite at +# runtime (CLAUDE.md rule 18; docs/dynamic_handler_install.md). The emitter +# plants a compare-against-ROM hook at each range start so the guest's patched +# instructions execute; the runtime excludes the range from the kernel-bless +# memcmp and resumes native at the range end, so only the patched words +# interpret. +# +# `resume` says how the compiled body picks up again: "jalr" for the classic +# 4-word lui/addiu/jalr/nop stub (the call returns to ram_addr+0x10), +# "fallthrough" when the patched words ARE the function, "none" when the patch +# jumps out and never comes back. +# +# EVIDENCE LEVEL — read before relying on these. The five ranges were measured +# on a live SCPH-1001 boot (bios/SCPH1001.toml, Breath of Fire III, Psy-Q SDK +# 3.70). They are carried here, NOT re-measured on a live SCPH-5552 boot. The +# basis is that each range maps through Kernel Part 2 (ROM 0x10000 -> RAM +# 0x500) into bytes verified identical between the two images, so the same +# libapi patchers land on the same code. That is a strong inference, not an +# observation. Re-measure on a 5552 boot before treating a divergence here as a +# recompiler bug. + +[[recompiler.install_slots]] +ram_addr = "0x00000C88" # exception handler: register-save prologue +len = "0x30" # shifted two words + an inserted mfc0 v0,Cause +resume = "fallthrough" # the patched words are the function itself + +[[recompiler.install_slots]] +ram_addr = "0x00000CF0" # SIO data-byte handler dispatch slot +len = "0x10" # lui/addiu/jalr/nop over ROM zeros +resume = "jalr" # the stub's call returns to 0x0D00 + +[[recompiler.install_slots]] +ram_addr = "0x00004964" # pad driver clear routine, 11 words NOP'd +len = "0x2C" # (RemovePatchPad / ChgclrPAD family) +resume = "fallthrough" + +[[recompiler.install_slots]] +ram_addr = "0x00004D98" # _patch_card2 payload: jalr into boot EXE +len = "0x14" # 0x8017EB6C; the ra landing word is NOP'd too, +resume = "fallthrough" # so the body resumes past it, not at +0x10 + +[[recompiler.install_slots]] +ram_addr = "0x00006444" # _patch_card payload: the kernel's card +len = "0x10" # handler replaced by jr into boot EXE +resume = "none" # 0x8017EAA0 — a jr never returns here + +# NOT declared: RAM 0x0500, one word of kernel_trampoline_0 cleared to zero +# (ROM `lui t2, 0`). It differs on every boot, but what writes it is not yet +# identified, and a range declared on a guess would tell the bless verifier to +# stop checking a word it should be checking. Rule 14: unknown is acceptable, +# guessing is not. Undeclared means that body keeps interpreting, exactly as +# it does today. + +# Per-image anchors couriered into the generated C (psx_bios_image) for the +# runtime HLE tier. Values are FACTS about this image, not tunables: the +# shell entry is where LoadRunShell (ROM 0xBFC06FF0) jumps after its copy; +# deliver_event_ret is the instruction after the kernel DeliverEvent loop's +# `jalr v0` (kernel RAM 0x1718), the $ra a delivered event callback returns +# through. deliver_event_ret lies in the verified-identical kernel (RAM 0x1720, +# ROM 0x11220). shell_entry_phys is shell RAM, whose contents differ, but the +# address is LoadRunShell's jump target and LoadRunShell itself (ROM 0x06FF0) +# is in the identical region, so the target is the same. Omit a key on a +# BIOS that has no such anchor — the runtime then treats that HLE feature as +# structurally unavailable instead of firing on a wrong address. +[recompiler.runtime_exports] +shell_entry_phys = "0x00030000" +deliver_event_ret = "0x80001720" diff --git a/overlay_toolchain/bios_module_build.py b/overlay_toolchain/bios_module_build.py new file mode 100644 index 00000000..1b1769dd --- /dev/null +++ b/overlay_toolchain/bios_module_build.py @@ -0,0 +1,318 @@ +#!/usr/bin/env python3 +"""bios_module_build.py — build a loadable BIOS backend from the player's own +retail dump, on the player's machine. + +WHY +=== +A bundled release links only the redistributable OpenBIOS backend: the C a +retail image recompiles to is a translation of that image's code and never +ships (docs/BIOS_SELECTION.md). This script is what the runtime runs, from the +overlay toolchain beside the executable, when the player selects a retail dump: +it recompiles THAT dump with the bundled psxrecomp-bios and compiles the result +into a shared library the runtime loads as one more backend +(runtime/src/psx_bios_module.c, runtime/include/psx_bios_module.h). The same +interpreter and compiler already turn overlays streamed from the player's disc +into native code; this is that mechanism applied to the BIOS. + +CONTRACT +======== +The module is a self-contained shared library (no imports from the executable +on any platform), exporting psx_bios_module_abi / _codegen_hash / _init / +_backend (see psx_bios_module_glue.c.inc). It is compiled with the same flags +the executable's own BIOS backend uses (no debug tools, block cycles, game +dispatch present) plus the two module defines, from THREE translation units: + + _full.c generated function bodies (+ psx_bios_module.h prepended) + _dispatch.c generated dispatcher/descriptor (+ psx_bios_module.h prepended) + glue.c overlay preamble + BIOS glue (the only exports) + +The identity gate is the emitter's own: a profile pins the image's SHA-256 and +psxrecomp-bios refuses any other image, so a module can only ever be built from +the exact dump its code describes. + +USAGE (as the runtime invokes it) + python3 bios_module_build.py --dump --toolchain \ + --stem SCPH1001 --out /SCPH1001_.so --flavor 0 \ + --compiler gcc|tcc [--gcc ] [--tcc ] + +The toolchain dir is overlay_toolchain/ as tools/release_stage.py stages it +(python, psxrecomp-bios, include/, bios/*.toml, recompiler/seeds/). Each +piece can be overridden (--emitter, --include, --profiles, --seeds) so a +developer tree can run it without staging. + +Prints `PSX_BIOS_MODULE_PUBLISHED ` on success; exit 0. Any failure +leaves no file at --out and exits non-zero with the reason on stdout. +""" + +from __future__ import annotations + +import argparse +import ctypes +import hashlib +import os +import re +import shutil +import subprocess +import sys +import tempfile +import zlib + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) + +import compile_overlays as co # noqa: E402 (shared compiler driver helpers) + + +def die(msg: str) -> "NoReturn": + print(f"bios_module_build: ERROR: {msg}") + sys.exit(1) + + +def read_profile(path: str) -> dict: + """The few keys this needs from a bios/.toml (simple `key = "value"` + lines inside [program] / [program.image] / [recompiler]). No TOML library: + the pinned interpreter is the stdlib-only embeddable Python.""" + out = {"rom": "", "sha256": "", "seeds": "", "out_stem": "", "id": ""} + section = "" + with open(path, encoding="utf-8", errors="replace") as f: + for line in f: + s = line.split("#", 1)[0].strip() + if not s: + continue + m = re.match(r"^\[([^\]]+)\]$", s) + if m: + section = m.group(1).strip() + continue + m = re.match(r'^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*"([^"]*)"', s) + if not m: + continue + k, v = m.group(1), m.group(2) + if section == "program" and k == "rom": + out["rom"] = v + elif section == "program" and k == "id": + out["id"] = v + elif section == "program.image" and k == "sha256": + out["sha256"] = v.lower() + elif section == "recompiler" and k == "seeds": + out["seeds"] = v + elif section == "recompiler" and k == "out_stem": + out["out_stem"] = v + return out + + +def identity(path: str) -> tuple[int, int, str]: + with open(path, "rb") as f: + data = f.read() + return len(data), zlib.crc32(data) & 0xFFFFFFFF, hashlib.sha256(data).hexdigest() + + +MODULE_DEFINES = [ + "-DPSX_OVERLAY_DLL_BUILD", + "-DPSX_BIOS_MODULE_BUILD", + # Mirror the executable's own BIOS objects (runtime.cmake): no debug tools, + # faithful block cycles, and the game-dispatch-aware dispatcher body. + "-DPSX_NO_DEBUG_TOOLS", + "-DPSX_ENABLE_BLOCK_CYCLES=1", + "-DPSX_HAS_GAME_DISPATCH", +] + + +def compile_module(sources: list[str], out: str, include_dirs: list[str], + stem: str, flavor: int, compiler: str, gcc: str, tcc: str) -> bool: + defines = MODULE_DEFINES + [f"-DPSX_OVERLAY_FLAVOR={int(flavor)}", + f"-DPSX_BIOS_MODULE_STEM={stem}"] + if int(flavor) & 2: + defines.append("-DPSX_PGXP=1") + if compiler == "tcc": + # Same treatment compile_overlays gives a shard: strip any BOM, add the + # __builtin_ctz shim, and hand tcc BOM-free copies of the headers. + for src in sources: + with open(src, "rb") as f: + data = f.read() + if data[:3] == b"\xef\xbb\xbf": + data = data[3:] + if not data.startswith(co._TCC_COMPAT_PREFIX): + data = co._TCC_COMPAT_PREFIX + data + with open(src, "wb") as f: + f.write(data) + cmd = [tcc, "-shared", *defines, *[co.native_path(s) for s in sources], + "-o", co.native_path(out)] + for d in include_dirs: + cmd.append("-I" + co.native_path(co._bom_free_incdir(d))) + env = None + else: + env, tc_dir = co._toolchain_env(gcc) + pic = [] if co.is_windows() else ["-fPIC"] + cmd = [gcc, "-shared", *pic, "-O2", *defines, + *[co.native_path(s) for s in sources], + "-o", co.native_path(out), + *[f"-I{co.native_path(d)}" for d in include_dirs], "-lm"] + if tc_dir is None: + print(" WARNING: no gcc toolchain dir found; compile may fail to launch") + print(" compile: " + " ".join(cmd)) + r = subprocess.run(cmd, capture_output=True, text=True, env=env) + if r.returncode != 0: + msg = (r.stderr or r.stdout or "").strip() or "(no compiler output)" + print(f" COMPILE ERROR (exit {r.returncode}):\n{msg}") + return False + return True + + +def self_check(path: str, flavor: int) -> bool: + """Load the fresh module in this interpreter: proves it is self-contained + (RTLD_NOW resolves every symbol or fails) and that its ABI tag names the + flavor asked for. The host repeats the gate with its own tag.""" + try: + lib = ctypes.CDLL(co.native_path(path)) + except OSError as exc: + print(f" self-check: module does not load: {exc}") + return False + try: + abi = ctypes.c_int(lib.psx_bios_module_abi()).value + h = ctypes.c_uint32(lib.psx_bios_module_codegen_hash()).value + except AttributeError as exc: + print(f" self-check: export missing: {exc}") + return False + if (abi >> 16) & 0xFFFF != int(flavor) & 0xFFFF: + print(f" self-check: ABI flavor {(abi >> 16) & 0xFFFF} != requested {flavor}") + return False + print(f" self-check: abi=0x{abi:08x} codegen_hash=0x{h:08x} ok") + return True + + +def main(argv=None) -> int: + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--dump", required=True, help="the player's BIOS image") + ap.add_argument("--toolchain", default=HERE, help="overlay_toolchain/ dir (default: this script's dir)") + ap.add_argument("--stem", required=True, help="profile stem, e.g. SCPH1001 (bios/.toml)") + ap.add_argument("--out", required=True, help="module path to publish (.so/.dll)") + ap.add_argument("--flavor", type=int, default=0, help="PSX_OVERLAY_FLAVOR of the host build") + ap.add_argument("--compiler", choices=("gcc", "tcc"), default="gcc") + ap.add_argument("--gcc", default="gcc") + ap.add_argument("--tcc", default="tcc") + ap.add_argument("--emitter", default=None, help="psxrecomp-bios (default: /psxrecomp-bios[.exe])") + ap.add_argument("--include", default=None, help="runtime include dir (default: /include)") + ap.add_argument("--profiles", default=None, help="bios/ profiles dir (default: /bios)") + ap.add_argument("--seeds", default=None, help="seeds dir (default: /recompiler/seeds)") + ap.add_argument("--keep-work", action="store_true", help="keep the temporary emit tree (debugging)") + args = ap.parse_args(argv) + + tk = os.path.abspath(args.toolchain) + # Everything absolute: the emitter runs with cwd inside the staged work + # tree, and the compiler is handed paths from more than one directory. + emitter = os.path.abspath(args.emitter or os.path.join( + tk, "psxrecomp-bios.exe" if co.is_windows() else "psxrecomp-bios")) + include = os.path.abspath(args.include or os.path.join(tk, "include")) + profiles = os.path.abspath(args.profiles or os.path.join(tk, "bios")) + seeds_dir = os.path.abspath(args.seeds or os.path.join(tk, "recompiler", "seeds")) + args.dump = os.path.abspath(args.dump) + args.out = os.path.abspath(args.out) + for label, p in (("emitter", emitter), ("include dir", include), ("profiles dir", profiles), + ("seeds dir", seeds_dir), ("dump", args.dump)): + if not os.path.exists(p): + die(f"{label} not found: {p}") + if not re.match(r"^[A-Za-z_][A-Za-z0-9_]*$", args.stem): + die(f"bad stem {args.stem!r}") + profile_path = os.path.join(profiles, f"{args.stem}.toml") + if not os.path.isfile(profile_path): + die(f"no profile for stem {args.stem}: {profile_path}") + prof = read_profile(profile_path) + if not prof["rom"] or not prof["seeds"]: + die(f"profile {profile_path} lacks rom/seeds") + out_stem = prof["out_stem"] or args.stem + if out_stem != args.stem: + die(f"profile out_stem {out_stem!r} != --stem {args.stem!r}; the descriptor symbol must match") + + size, crc, sha = identity(args.dump) + print(f"dump: {args.dump} ({size} bytes, CRC32 {crc:08X}, SHA-256 {sha[:16]}…)") + if size != 512 * 1024: + die(f"a PlayStation BIOS image is exactly 524288 bytes (got {size})") + if prof["sha256"] and prof["sha256"] != sha: + die(f"this image is not {prof['id'] or args.stem}: profile pins SHA-256 " + f"{prof['sha256'][:16]}…, dump is {sha[:16]}…") + + seeds_src = os.path.join(seeds_dir, os.path.basename(prof["seeds"])) + if not os.path.isfile(seeds_src): + die(f"seeds file the profile names is not shipped: {seeds_src}") + + # Stage an emitter project root: the profile's rom/seeds paths are relative + # to the directory holding a .gitignore/.git/CMakeLists.txt marker + # (config_loader find_project_root), so recreate exactly that shape. + work = tempfile.mkdtemp(prefix="psx_bios_module_") + try: + with open(os.path.join(work, ".gitignore"), "w") as f: + f.write("*\n") + rom_dst = os.path.join(work, prof["rom"]) + os.makedirs(os.path.dirname(rom_dst), exist_ok=True) + shutil.copy2(args.dump, rom_dst) + seeds_dst = os.path.join(work, prof["seeds"]) + os.makedirs(os.path.dirname(seeds_dst), exist_ok=True) + shutil.copy2(seeds_src, seeds_dst) + prof_dst = os.path.join(work, "bios", f"{args.stem}.toml") + os.makedirs(os.path.dirname(prof_dst), exist_ok=True) + shutil.copy2(profile_path, prof_dst) + gen = os.path.join(work, "out") + os.makedirs(gen, exist_ok=True) + + env = os.environ.copy() + env.setdefault("PSX_CPS", "1") + cmd = [emitter, "--config", os.path.join("bios", f"{args.stem}.toml"), "--out-dir", gen] + print(" emit: " + " ".join(cmd)) + r = subprocess.run(cmd, cwd=work, capture_output=True, text=True, env=env) + if r.returncode != 0: + tail = "\n".join((r.stderr or r.stdout or "").splitlines()[-25:]) + die(f"psxrecomp-bios exited {r.returncode}:\n{tail}") + full_c = os.path.join(gen, f"{args.stem}_full.c") + disp_c = os.path.join(gen, f"{args.stem}_dispatch.c") + for p in (full_c, disp_c): + if not os.path.isfile(p): + die(f"emitter produced no {p}") + with open(disp_c, encoding="utf-8", errors="replace") as f: + if f"{args.stem}_psx_bios_backend" not in f.read(): + die("emitted dispatch defines no backend descriptor (emitter too old)") + + # Module translation units: the name mappings go before the first + # #include so psx_memory.h's g_psx_ram_mask is rewritten too. + prelude = '#include "psx_bios_module.h"\n' + for p in (full_c, disp_c): + with open(p, "rb") as f: + data = f.read() + if data[:3] == b"\xef\xbb\xbf": + data = data[3:] + with open(p, "wb") as f: + f.write(prelude.encode("utf-8") + data) + glue_c = os.path.join(gen, "glue.c") + with open(glue_c, "w", encoding="utf-8") as f: + f.write(prelude) + f.write('#include "overlay_dispatch_preamble.c.inc"\n') + f.write('#include "psx_bios_module_glue.c.inc"\n') + + out_dir = os.path.dirname(os.path.abspath(args.out)) or "." + os.makedirs(out_dir, exist_ok=True) + tmp_out = os.path.join(out_dir, "." + os.path.basename(args.out) + ".tmp") + if os.path.exists(tmp_out): + os.remove(tmp_out) + include_dirs = [include] + fmt_inc = os.path.join(tk, "lib", "fmt", "include") # dev-tree layout only + if os.path.isdir(fmt_inc): + include_dirs.append(fmt_inc) + if not compile_module([full_c, disp_c, glue_c], tmp_out, include_dirs, + args.stem, args.flavor, args.compiler, args.gcc, args.tcc): + if os.path.exists(tmp_out): + os.remove(tmp_out) + die("compile failed") + if not self_check(tmp_out, args.flavor): + os.remove(tmp_out) + die("self-check failed") + os.replace(tmp_out, args.out) + print(f"PSX_BIOS_MODULE_PUBLISHED {args.out}") + return 0 + finally: + if args.keep_work: + print(f" work tree kept: {work}") + else: + shutil.rmtree(work, ignore_errors=True) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/overlay_toolchain/compile_overlays.py b/overlay_toolchain/compile_overlays.py new file mode 100644 index 00000000..240a1255 --- /dev/null +++ b/overlay_toolchain/compile_overlays.py @@ -0,0 +1,8106 @@ +#!/usr/bin/env python3 +""" +compile_overlays.py — Offline overlay compilation primitive (B-2 / A-2 shared path). + +Reads overlay_captures.json, compiles each code overlay to a DLL, and writes +it to the cache directory. The runtime's A-1 LoadLibrary path reads from the +same cache. + +Usage: + python3 tools/compile_overlays.py \\ + --captures build-dev/overlay_captures.json \\ + --game-toml game.toml \\ + --recompiler psxrecomp/recompiler/build/psxrecomp-game.exe \\ + --runtime-include psxrecomp/runtime/include \\ + --out-dir build-dev/cache + +Each DLL is written to //.dll. +Each DLL exports: + overlay_init(dispatch_fn) — call once after LoadLibrary to wire dispatch + func_XXXXXXXX(CPUState*) — one export per compiled function entry point +""" + +import argparse +import itertools +import io +import contextlib +import contextvars +import base64 +import binascii +from bisect import bisect_left +from collections import Counter, deque +from contextlib import contextmanager, nullcontext +import glob +import hashlib +import heapq +import os +import re +import struct +import subprocess +import sys +import tempfile +import threading +import time +import uuid + + +try: + import tomllib # Python 3.11+ +except ImportError: + try: + import tomli as tomllib + except ImportError: + print("ERROR: need tomllib (Python 3.11+) or 'pip install tomli'") + sys.exit(1) + +import json +import platform +import re + + +def codegen_ver(runtime_include: str) -> int: + """Parse PSX_OVERLAY_CODEGEN_VER from overlay_api.h so the cache path version + is the SAME value the runtime (overlay_loader.c) uses — the two can't drift. + The cache is namespaced gcc//cg/, so a build with new emitter + output reads+writes a FRESH dir and never reuses a stale DLL.""" + hdr = os.path.join(runtime_include, 'overlay_api.h') + with open(hdr) as f: + m = re.search(r'#define\s+PSX_OVERLAY_CODEGEN_VER\s+(\d+)', f.read()) + if not m: + raise SystemExit(f'PSX_OVERLAY_CODEGEN_VER not found in {hdr}') + return int(m.group(1)) + + +def overlay_abi_tag(runtime_include: str, flavor: int) -> int: + """Return the exact ABI/flavor export expected from a cached shard.""" + hdr = os.path.join(runtime_include, 'overlay_api.h') + with open(hdr) as source: + match = re.search( + r'#define\s+PSX_OVERLAY_ABI_VERSION\s+(\d+)', source.read()) + if not match: + raise SystemExit(f'PSX_OVERLAY_ABI_VERSION not found in {hdr}') + return (int(match.group(1)) & 0xFFFF) | ((int(flavor) & 0xFFFF) << 16) + + +def overlay_candidate_cap(runtime_include: str) -> int: + """Return the loader's process-lifetime manifest-candidate capacity.""" + hdr = os.path.join(runtime_include, 'overlay_api.h') + with open(hdr) as source: + match = re.search( + r'#define\s+PSX_OVERLAY_CANDIDATE_CAP\s+(\d+)', source.read()) + if not match: + raise SystemExit(f'PSX_OVERLAY_CANDIDATE_CAP not found in {hdr}') + value = int(match.group(1)) + if value <= 0: + raise SystemExit(f'invalid PSX_OVERLAY_CANDIDATE_CAP in {hdr}: {value}') + return value + + +def codegen_hash(runtime_include: str) -> int: + """Parse PSX_OVERLAY_CODEGEN_HASH from the build-generated overlay_codegen_hash.h + (next to overlay_api.h). Folded into the cache path as cg_ so ANY + emitter change auto-invalidates the cache (no stale-but-cgN reuse). Falls back + to 0 when the header is absent (a tree not yet built) — matching overlay_api.h's + __has_include fallback, so the loader and compiler still agree on the path.""" + hdr = os.path.join(runtime_include, 'overlay_codegen_hash.h') + try: + with open(hdr) as f: + m = re.search(r'#define\s+PSX_OVERLAY_CODEGEN_HASH\s+0x([0-9A-Fa-f]+)', f.read()) + if m: + return int(m.group(1), 16) + except FileNotFoundError: + pass + return 0 + + +def verify_recompiler_matches_tag(recompiler: str, tag_hash: int) -> None: + """Stale-recompiler-binary guard. The cg tag hash is computed from the + EMITTER SOURCES (via --runtime-include's overlay_codegen_hash.h), but the + code is emitted by the --recompiler BINARY — nothing else ties the two. + A recompiler built before the last emitter change happily emits OLD code + that gets stamped with the CURRENT tag: read tag == write tag, content + stale (the 2026-07-01 Tomba pause-menu wedge; loaded-save scene shards + corrupted the display-list queue while every tag check passed). + + psxrecomp-game bakes the same hash at ITS build time and prints it via + --codegen-hash. Any mismatch — including a binary too old to support the + flag — is a HARD failure: rebuild the recompiler, never build shards.""" + import subprocess + try: + out = subprocess.run([recompiler, '--codegen-hash'], + capture_output=True, text=True, timeout=30) + except Exception as e: + raise SystemExit(f'FATAL: cannot execute {recompiler} for --codegen-hash ' + f'staleness check: {e}') + line = (out.stdout or '').strip().splitlines() + baked = line[0].strip() if line else '' + if out.returncode != 0 or not re.fullmatch(r'[0-9a-fA-F]{8}', baked or ''): + raise SystemExit( + f'FATAL: {recompiler} does not support --codegen-hash (or errored).\n' + f' This binary predates the stale-recompiler guard and CANNOT be\n' + f' verified against the emitter sources. Rebuild it:\n' + f' cmake --build --target psxrecomp-game') + if int(baked, 16) != tag_hash: + raise SystemExit( + f'FATAL: STALE RECOMPILER BINARY.\n' + f' {recompiler}\n' + f' was built from emitter sources hashing {baked}, but the runtime\n' + f' tree stamps cache tag hash {tag_hash:08x}. Shards it emits would\n' + f' carry the current tag with OLD codegen semantics (the silent\n' + f' stale-shard class). Rebuild the recompiler first:\n' + f' cmake --build --target psxrecomp-game') + print(f'recompiler codegen hash verified: {baked} == cg tag hash') + + +def cache_tag(runtime_include: str, recompiler: str, game_toml: str, + flavor: int = 0) -> str: + """THE cache-namespace string. Single source of truth. + + The release packagers used to rebuild this string themselves in PowerShell. + That parallel implementation went stale the moment the flavor suffix was + added: the packager derived cg__gc while this tool wrote + cg__gc_f, so its tag filter matched nothing and a + perfectly good regenerated cache staged ZERO shards (measured on Tomba 2, + 2026-09-01). Anything that needs the tag must call this, never reformat it. + + Must stay identical to overlay_loader.c scan_cache_dir(). + """ + return 'cg%d_%08x_gc%08x_f%d' % ( + codegen_ver(runtime_include), + codegen_hash(runtime_include), + overlay_config_hash(recompiler, game_toml), + int(flavor)) + + +def overlay_config_hash(recompiler: str, game_toml: str) -> int: + """Ask the recompiler for the canonical hash of config fields that affect + generated overlay code. Keeping the serializer in the shared C++ config + loader means the runtime and producer cannot disagree about which + widescreen/patch settings define a cache namespace.""" + import subprocess + try: + out = subprocess.run( + [recompiler, '--overlay-config-hash', os.path.abspath(game_toml)], + capture_output=True, text=True, timeout=30) + except Exception as e: + raise SystemExit( + f'FATAL: cannot execute {recompiler} for --overlay-config-hash: {e}') + line = (out.stdout or '').strip().splitlines() + value = line[0].strip() if line else '' + if out.returncode != 0 or not re.fullmatch(r'[0-9a-fA-F]{8}', value): + detail = (out.stderr or out.stdout or '').strip() + raise SystemExit( + f'FATAL: {recompiler} could not hash overlay codegen config.\n' + f' This binary may predate --overlay-config-hash; rebuild it.\n' + f' detail: {detail}') + return int(value, 16) + + +_TARGET_OS = None + +def set_target_os(target_os: str | None) -> None: + global _TARGET_OS + _TARGET_OS = target_os + +def is_windows() -> bool: + if _TARGET_OS == 'win': + return True + if _TARGET_OS in ('linux', 'macos'): + return False + return (os.name == 'nt' + or platform.system() == 'Windows' + or platform.system().startswith(('MSYS', 'CYGWIN', 'MINGW'))) + + +def overlay_ext() -> str: + """Use the host platform's conventional shared-library suffix.""" + return '.dll' if is_windows() else '.so' + + +def native_path(p: str) -> str: + """Absolute form of `p`, in the RUNNING interpreter's own path flavor, for + handing to native tools (gcc, tcc). Two hard-won rules live here + (2026-07-15, runtime `cmd.exe /C python` resolved to devkitPro's MSYS + python and every in-game shard compile died exit-1/empty-stderr): + + 1. ABSOLUTE is mandatory: gcc invoked from cmd.exe silently fails on + relative forward-slash paths. + 2. Do NOT translate flavors here. Under an MSYS-flavored python, POSIX + args (/f/..., /home/...) are translated to Windows form AT THE EXEC + BOUNDARY by the msys runtime using its OWN mount table — verified + correct (gcc -v showed /home/... arriving as C:/Users/...). Translating + here with `cygpath`/heuristics uses whatever foreign cygpath is first + on PATH (e.g. Git-for-Windows') and corrupts the path. The actual + silent-failure root cause was never the args — it was the child PATH + flavor (_toolchain_env below).""" + return os.path.abspath(p) + + +def cache_arch_abi() -> str: + """Canonical cache arch-abi tag, IDENTICAL to overlay_loader.c's + PSX_OVERLAY_ARCH_ABI ("-": win|linux|macos + x64|arm64|x86). + gcc DLLs are namespaced under /gcc// so same-OS + different-arch caches never comingle. Keep this + mapping in lockstep with overlay_loader.c.""" + if _TARGET_OS in ('win', 'linux', 'macos'): + os_tag = _TARGET_OS + elif is_windows(): + os_tag = 'win' + else: + os_tag = {'Darwin': 'macos'}.get(platform.system(), 'linux') + m = platform.machine().lower() + if m in ('amd64', 'x86_64', 'x64'): + arch = 'x64' + elif m in ('arm64', 'aarch64'): + arch = 'arm64' + elif m in ('i386', 'i686', 'x86'): + arch = 'x86' + else: + arch = 'unknown' + return f'{os_tag}-{arch}' + + +# --------------------------------------------------------------------------- +# Code segments (docs/SEGMENT_AWARE_CODE.md §5.7) +# --------------------------------------------------------------------------- +# The bytes of an overlay are segment-free; execution is not. A PC's segment +# (KUSEG 0x0xxxxxxx, KSEG0 0x8xxxxxxx, KSEG1 0xAxxxxxxx) is part of every link, +# EPC, I-cache tag and store-PC stamp a compiled body bakes, so a shard serves +# only the segment it was compiled for. Capture schema v3 records the segments +# each dispatch entry entered through (`dispatch_entry_segments`); a capture +# without it is KSEG0 only. This tool compiles one shard per (region, segment +# with entries): the image is compiled at `segment | phys`, so its functions, +# manifest F entries and exports are named by that VA (§5.1). KSEG0 shards keep +# their place and names in the cache tag directory, so no existing cache is +# invalidated; KUSEG and KSEG1 shards go in its seg-kuseg/ and seg-kseg1/ +# subdirectories (decision 4), under the same {phys}_{crc} filename grammar, +# and their manifests carry `S `. R records stay KSEG0-spelled byte +# extents: they validate bytes, not execution. +KUSEG, KSEG0, KSEG1 = 0x00000000, 0x80000000, 0xA0000000 +SEGMENT_MASK, PHYS_MASK = 0xE0000000, 0x1FFFFFFF +SEGMENT_NAMES = {KUSEG: 'kuseg', KSEG0: 'kseg0', KSEG1: 'kseg1'} +SEGMENT_BY_NAME = {name: seg for seg, name in SEGMENT_NAMES.items()} +SEGMENT_CACHE_SUBDIRS = {KUSEG: 'seg-kuseg', KSEG1: 'seg-kseg1'} + +# The segment of the image being compiled. Helpers that name PCs without an +# image address at hand spell them in it (_canonical_guest_addr); every +# per-image entry point below sets it for its duration (image_segment). The +# default is KSEG0, the only segment before §5.7, so a KSEG0 compile is +# unchanged. A context variable, not a global: captures compile on threads. +_IMAGE_SEGMENT = contextvars.ContextVar('psx_overlay_image_segment', + default=KSEG0) + + +def segment_of(addr: int) -> int: + return addr & SEGMENT_MASK + + +@contextmanager +def image_segment(seg: int): + if seg not in SEGMENT_NAMES: + raise ValueError(f'0x{seg:08X} is not a segment that maps RAM') + token = _IMAGE_SEGMENT.set(seg) + try: + yield seg + finally: + _IMAGE_SEGMENT.reset(token) + + +def _canonical_guest_addr(addr: int) -> int: + """``addr``'s bytes, spelled in the segment of the image being compiled.""" + return (addr & PHYS_MASK) | _IMAGE_SEGMENT.get() + + +def segment_cache_dir(cache_dir: str, seg: int) -> str: + """The directory a shard compiled for ``seg`` lives in (decision 4).""" + sub = SEGMENT_CACHE_SUBDIRS.get(seg) + return os.path.join(cache_dir, sub) if sub else cache_dir + + +def cache_dir_segment(directory: str) -> int: + """The segment of the shards in ``directory`` (overlay_loader.c's + cache_seg_from_path): a seg-kuseg/ or seg-kseg1/ directory, else KSEG0.""" + name = os.path.basename(os.path.normpath(directory)).lower() + for seg, sub in SEGMENT_CACHE_SUBDIRS.items(): + if name == sub: + return seg + return KSEG0 + + +def _respell(addr: int, seg: int) -> int: + return (addr & PHYS_MASK) | seg + + +def capture_segment_views(cap: dict, + required_segments=frozenset()) -> list[dict]: + """Split one capture record into one per segment with entries (§5.7). + + A v2 capture (no ``dispatch_entry_segments``) is KSEG0 only and is + returned unchanged, so every existing capture compiles exactly as before. + For v3, ``dispatch_entry_pcs`` keeps its v2 meaning (dispatched in any + segment, spelled at KSEG0) and ``dispatch_entry_segments`` names the + segments: {"kuseg": [...], "kseg0": [...], "kseg1": [...]}, each PC in its + own segment. A dispatch entry that no segment list names is KSEG0. + + A view is the capture seen from one segment: ``load_addr`` and every PC in + it are spelled in that segment, and its dispatch entries are that + segment's alone. The execution evidence (executed_pcs) has no segment -- + direct edges keep the entry's segment -- so each view carries all of it. + The bytes, size and guard words are shared. + + ``required_segments`` also gets a view where the record has no dispatch + entry: the segments an operator or config demand names inside it + (declared_view_segments). A record with no view at all -- execution + evidence only, which the runtime writes -- is read as a v2 reader reads + it: one KSEG0 view, so its classification, forced interiors, declared + entries and prior manifests apply exactly as before. + """ + segments = cap.get('dispatch_entry_segments') + if segments is None: + return [cap] + load = _parse_addr(cap['load_addr']) + all_entries = {a & PHYS_MASK + for a in _parse_addr_list(cap.get('dispatch_entry_pcs', []))} + by_seg = {seg: set() for seg in SEGMENT_NAMES} + labelled = set() + if not isinstance(segments, dict): + raise RuntimeError('dispatch_entry_segments must be an object') + for name, pcs in segments.items(): + seg = SEGMENT_BY_NAME.get(name) + if seg is None: + raise RuntimeError(f'dispatch_entry_segments: unknown segment {name!r}') + for pc in _parse_addr_list(pcs): + if segment_of(pc) != seg: + raise RuntimeError( + f'dispatch_entry_segments.{name}: 0x{pc:08X} is not in {name}') + by_seg[seg].add(pc & PHYS_MASK) + labelled.add(pc & PHYS_MASK) + # Entries with no segment record are KSEG0, as in a v2 capture. + by_seg[KSEG0] |= all_entries - labelled + + def respell_list(values, seg, keep=None): + out = [] + for value in _parse_addr_list(values or []): + if keep is not None and (value & PHYS_MASK) not in keep: + continue + out.append(f'0x{_respell(value, seg):08X}') + return sorted(out) + + wanted = {seg for seg, entries in by_seg.items() if entries} + wanted |= {seg for seg in required_segments if seg in by_seg} + if not wanted: + wanted = {KSEG0} + views = [] + for seg in (KSEG0, KUSEG, KSEG1): + if seg not in wanted: + continue + entries = by_seg[seg] + view = {k: v for k, v in cap.items() if k != 'dispatch_entry_segments'} + view['load_addr'] = f'0x{_respell(load, seg):08X}' + view['dispatch_entry_pcs'] = [f'0x{_respell(a, seg):08X}' + for a in sorted(entries)] + view['seeds'] = list(view['dispatch_entry_pcs']) + if 'static_dispatch_entry_pcs' in cap: + view['static_dispatch_entry_pcs'] = respell_list( + cap['static_dispatch_entry_pcs'], seg, entries) + for field in ('executed_pcs', 'observed_pcs', 'function_entry_pcs', + 'static_discovery_entry_pcs', + 'static_call_continuation_pcs'): + if field in cap: + view[field] = respell_list(cap[field], seg) + if cap.get('producer_ranges'): + view['producer_ranges'] = [ + dict(r, start=f'0x{_respell(_parse_addr(r["start"]), seg):08X}', + end=f'0x{_respell(_parse_addr(r["end"]), seg):08X}') + for r in cap['producer_ranges']] + if cap.get('static_alias_ranges'): + view['static_alias_ranges'] = [ + dict(r, entry=f'0x{_respell(_parse_addr(r["entry"]), seg):08X}', + start=f'0x{_respell(_parse_addr(r["start"]), seg):08X}', + end=f'0x{_respell(_parse_addr(r["end"]), seg):08X}') + for r in cap['static_alias_ranges']] + views.append(view) + return views + + +def declared_view_segments(cap: dict, toml_doc: dict, + forced_interiors=frozenset()) -> set[int]: + """Segments a demand from outside the capture names inside ``cap`` (§5.7). + + A ``--force-interior`` PC is KSEG0 (a physical and a KUSEG PC are the same + number), so one inside the record asks for its KSEG0 view. A game.toml + ``[[overlays]]`` table matches the load address it spells, and one without + a load address applies its entries by their own spelling, so each names + the segment it is written in. capture_segment_views() gives every such + segment a view even where the capture saw no dispatch entry, so these + demands compile as they did before captures carried segments. Byte-CRC + checks stay with the compile (_collect_toml_overlay_entries): a detached + table's view compiles nothing.""" + load = _parse_addr(cap['load_addr']) + lo = load & PHYS_MASK + hi = lo + int(cap['size']) + inside = lambda pc: lo <= (pc & PHYS_MASK) < hi + segs = {KSEG0} if any(inside(pc) for pc in forced_interiors) else set() + for ov in (toml_doc or {}).get('overlays', []) or []: + if not isinstance(ov, dict): + continue + entries = set() + for key in ('entry', 'entries', 'function_entry_pcs', 'function_entries'): + val = ov.get(key) + if isinstance(val, list): + entries.update(_parse_addr_list(val)) + elif val is not None: + entries.add(_parse_addr(val)) + ov_load = ov.get('load_addr') or ov.get('load_address') + if ov_load is not None: + ov_load = _parse_addr(ov_load) + if entries and (ov_load & PHYS_MASK) == lo: + segs.add(segment_of(ov_load)) + else: + segs.update(segment_of(pc) for pc in entries if inside(pc)) + return {seg for seg in segs if seg in SEGMENT_NAMES} + + +# --------------------------------------------------------------------------- +# Shard build accounting — make failures LOUD +# --------------------------------------------------------------------------- +# Historically a per-shard failure (recompiler error, generated-C audit reject, +# gcc/tcc compile error, dropped interior fragment) only printed a line into an +# ephemeral log and the script still exited 0. The runtime's autocompile watcher +# keys "did it work?" off the exit code, so a header change that broke EVERY +# shard looked identical to a fully-successful run: the affected code just ran +# interpreted forever. ShardStats fixes that — every build outcome is tallied +# (thread-safe, since captures compile on a pool), a SUMMARY prints at the end, +# a machine-readable PSX_SHARD_RESULT line is emitted for the runtime to parse, +# and main() exits non-zero when any shard that SHOULD have built failed. +class ShardStats: + def __init__(self): + self._lock = threading.Lock() + self.ok = 0 + self.skipped = 0 + self.capacity_fastpath = 0 + self.fail_by_class = Counter() + self.failures = [] # [(label, cls, detail), ...] (detail truncated) + + def add_ok(self, n=1): + with self._lock: + self.ok += n + + def add_skip(self, n=1): + with self._lock: + self.skipped += n + + def add_capacity_fastpath(self, n=1): + with self._lock: + self.capacity_fastpath += n + + def add_fail(self, label, cls, detail=''): + # Print immediately AND record, so the failure is visible in the live + # stream (per-worker buffered) and in the end-of-run summary. + d = (detail or '').strip().replace('\n', ' ') + if len(d) > 240: + d = d[:237] + '...' + print(f' SHARD FAIL [{cls}] {label}{(": " + d) if d else ""}') + with self._lock: + self.fail_by_class[cls] += 1 + self.failures.append((label, cls, d)) + + def total_fail(self): + with self._lock: + return sum(self.fail_by_class.values()) + + def print_summary(self): + with self._lock: + fail = sum(self.fail_by_class.values()) + print('\n=== SHARD BUILD SUMMARY ===') + print(f' built OK : {self.ok}') + print(f' skipped : {self.skipped} ' + '(cached / data-only / safe coverage loss)') + if self.capacity_fastpath: + print(f' cap-fast : {self.capacity_fastpath} cache recipe ' + 'job(s) skipped at an already-full fixed point') + print(f' FAILED : {fail}') + for cls, n in sorted(self.fail_by_class.items()): + print(f' - {cls}: {n}') + for label, cls, detail in self.failures[:40]: + print(f' ! [{cls}] {label}{(": " + detail) if detail else ""}') + if len(self.failures) > 40: + print(f' ... {len(self.failures) - 40} more') + # Stable, grep-able result line the runtime (autocompile.c) parses to + # surface shard_ok / shard_fail without depending on the exit code. + print(f'PSX_SHARD_RESULT ok={self.ok} failed={fail} ' + f'skipped={self.skipped} ' + f'capacity_fastpath={self.capacity_fastpath}') + return fail + + +# --------------------------------------------------------------------------- +# PS-EXE fake header +# --------------------------------------------------------------------------- + +# Analysis-bound tag read by the recompiler (recompiler/include/ps1_exe_parser.h, +# namespace exe_tag). Offsets are into the 2048-byte PS-EXE header, whose tail +# is zero-filled in every retail image; the 8-byte magic makes a false positive +# on a genuine EXE effectively impossible. +GUARD_TAG_MAGIC_OFFSET = 0x7E0 +GUARD_TAG_COUNT_OFFSET = 0x7E8 +GUARD_TAG_MAGIC = b'PSXRGRD1' +CAPTURE_PAGE_BYTES = 4096 + + +def capture_guard_bytes(cap: dict, size: int, label: str = '') -> int: + """Trailing bytes of a captured region that are guard words ONLY. + + overlay_capture.c write_json_window appends one coherent guard instruction + past the end of a dirty-page run so that a MIPS branch at the run's final + word (...FFC) has its architectural delay slot (...000) available. Those + bytes must stay READABLE by the recompiler and must NEVER be discovered as + code: the word after a guard word is not in the image, so a control + transfer AT the guard word could not emit its own delay slot. The + recompiler is TOLD the count (see make_psxexe) rather than inferring it. + + Precedence: + 1. the capture's explicit ``guard_bytes`` field — the writer stating its + own intent, which survives any future change to capture granularity; + 2. for captures recorded BEFORE that field existed, reconstruct from the + format invariant write_json_window has always obeyed: a dirty-page run + is a whole number of 4 KiB pages, plus one 4-byte guard word whenever + the next word is still inside RAM. ``size % 4096 == 4`` is exactly + that signature and means one guard word. + + Every OTHER shape reconstructs to zero, and that is ordinary traffic rather + than an anomaly, so this stays quiet: + * ``size % 4096 == 0`` — a page run whose guard word was suppressed + because it would have left RAM, or a pre-2026-07-25 page-exact capture. + * any other residue — a STATIC extraction, not a RAM page run. Those + records carry an exact file extent (tools/aot_overlay_spike/ + extract_generic.py; they are the ones with static_dispatch_entry_pcs / + producer_ranges) and append no guard word. MEASURED: 52 of the 946 + records in the SCUS-94454 vault are this shape, with residues from 112 + to 3996 bytes and one that is not even 4-byte aligned. + + Zero is also the fail-closed answer. If some future producer ever appends a + guard word in a shape this cannot recognise, that word is analysed as code + and the emitter's mandatory-delay-slot check refuses the transfer LOUDLY at + generation time; it never silently emits a transfer without its slot. The + way to opt in is the explicit field, not a wider guess here. + """ + declared = cap.get('guard_bytes') if cap else None + if declared is not None: + try: + guard = int(declared) + except (TypeError, ValueError): + guard = -1 + if guard in (0, 4) and guard < size: + return guard + # A malformed DECLARATION is a producer bug, unlike the shapes above. + print(f' WARNING: {label or "capture"} declares guard_bytes=' + f'{declared!r} with size {size}; ignoring (treating as 0)') + return 0 + if size % CAPTURE_PAGE_BYTES == 4 and size > 4: + return 4 + return 0 + + +def make_psxexe(load_addr: int, entry_pc: int, data: bytes, *, + guard_bytes: int) -> bytes: + """Wrap raw overlay bytes in a minimal PS-EXE header. + + ``guard_bytes`` is keyword-only and has NO default on purpose: every + producer of an overlay image must state how many of its trailing bytes are + delay-slot guard words (see capture_guard_bytes). A new call site that + forgets is a TypeError, not a silently mis-analysed shard. + """ + if guard_bytes < 0 or guard_bytes % 4 or guard_bytes >= len(data): + raise ValueError( + f'invalid guard_bytes={guard_bytes} for {len(data)}-byte image') + header = bytearray(2048) + header[0:8] = b'PS-X EXE' + struct.pack_into(' list: + """--project-root arguments for a psxrecomp-game invocation, or []. + + Every recompiler spawn below runs with cwd = dirname(game.toml), because + the seeds/captures paths in the config are relative to it. That cwd is + also where the recompiler probes for the BIOS profile when the config has + no explicit [recompiler] bios_config — and for a PACKAGED game.toml + (packaging/release/game.toml) it holds neither bios/SCPH1001.toml nor a + vendored framework one level down. Every shard then died with + "FATAL: no BIOS profile found" and the cache silently failed to build, + which is what the recipe printed by package_release.ps1 used to tell + people to run (issue #72). + + Default the root to the framework, derived from the required + --runtime-include (/runtime/include). Derivation is used ONLY + when it actually locates a profile, so this can fix a broken invocation + but never alter one that already worked. + + Every lookup is defensive: in-process callers (the test suite, the + packager's importlib entry) build a lightweight args object that carries + only the fields their recipe needs, so a missing attribute must degrade to + "pass no flag" — today's behaviour — never raise. + """ + explicit = getattr(args, 'project_root', None) + if explicit: + return ['--project-root', os.path.abspath(explicit)] + runtime_include = getattr(args, 'runtime_include', None) + if not runtime_include: + return [] + derived = os.path.abspath( + os.path.join(os.path.abspath(runtime_include), '..', '..')) + if os.path.isfile(os.path.join(derived, 'bios', 'SCPH1001.toml')): + return ['--project-root', derived] + return [] + + +BIOS_RESIDENT_PRODUCER = 'bios_resident_manifest' +BIOS_RESIDENT_MARKER = 'psxrecomp bios resident shard v1' + +# Hosted aliases are supplemental optimizations, never correctness authority. +# Keep every phase deterministically bounded so adversarial/malformed capture +# sets cannot turn one compile invocation into unbounded shard fan-out. +HOSTED_NOMINATION_CAP = 4096 +# Python selection precedes the C++ organic-block proof, so most candidates are +# expected to be rejected without publication. The emitted-identity cap below +# remains the tighter runtime-facing limit. +HOSTED_SELECTED_ALIAS_CAP = 4096 +HOSTED_SELECTED_HOST_CAP = 512 +HOSTED_BATCH_HOST_CAP = 64 +HOSTED_BATCH_ALIAS_CAP = 256 +# A terminal partition/partial-success tree over N targets has at most 2N-1 +# nodes. Budget the entire selected universe so a second invocation can never +# resume an attempt-capped suffix. +HOSTED_COMPILE_ATTEMPT_CAP = 2 * HOSTED_SELECTED_ALIAS_CAP - 1 +HOSTED_EMITTED_IDENTITY_CAP = 1024 +MANIFEST_LINE_MAX = 128 +MANIFEST_PHYSICAL_LINE_MAX = 159 +MANIFEST_ASCII_WHITESPACE = ' \t\r\v\f' +HOSTED_MANIFEST_PROVENANCE = 'hosted-v1' +ORPHAN_MANIFEST_PROVENANCE = 'orphan-v1' +NON_AUTHORITY_MANIFEST_PROVENANCES = { + HOSTED_MANIFEST_PROVENANCE, ORPHAN_MANIFEST_PROVENANCE, +} +HOSTED_MANIFEST_MARKER = ( + f'# psxrecomp overlay provenance {HOSTED_MANIFEST_PROVENANCE}') +HOSTED_UNIQUE_GUARDED_BYTE_CAP = 1024 * 1024 +# Full 8 MiB host capacity (PSX_MAIN_RAM_BACKING_BYTES): 8 MB-mod captures carry +# high-bank enhancement code and their ranges must validate. +PSX_RAM_SIZE = 8 * 1024 * 1024 + + +class ShardCandidateCapacityError(RuntimeError): + """A cache publication would exceed the runtime's fixed F-record table.""" + + +def manifest_has_hosted_provenance(manifest: str) -> bool: + """Recognize the exact compiler-owned marker under LF or CRLF records.""" + return manifest_provenance(manifest) == HOSTED_MANIFEST_PROVENANCE + + +def manifest_declares_supplemental_provenance(manifest: str) -> bool: + """Fail closed for any compiler provenance record, known or malformed.""" + prefix = '# psxrecomp overlay provenance ' + return any( + (raw_line[:-1] if raw_line.endswith('\r') else raw_line).startswith( + prefix) + for raw_line in manifest.split('\n') + ) + + +def manifest_provenance(manifest: str) -> str | None: + """Return one exact compiler-owned non-authority provenance record.""" + prefix = '# psxrecomp overlay provenance ' + found = [] + for raw_line in manifest.split('\n'): + line = raw_line[:-1] if raw_line.endswith('\r') else raw_line + if line.startswith(prefix): + found.append(line[len(prefix):]) + if len(found) != 1 or found[0] not in NON_AUTHORITY_MANIFEST_PROVENANCES: + return None + return found[0] + + +def seed_line_for_reason(addr: int, reason: str) -> str: + """Serialize one classifier reason without weakening its root contract.""" + if reason == 'DISPATCH_INTERIOR': + return f'interior 0x{addr:08X}' + if reason == 'DISPATCH_ROOT': + return f'dispatch_root 0x{addr:08X}' + if reason in ('DIRECT_JAL_TARGET', 'STATIC_INDIRECT_TARGET', + 'STATIC_BRANCH_ROOT', 'STATIC_DISCOVERY_ROOT'): + return f'call_root 0x{addr:08X}' + return f'0x{addr:08X}' + + +def update_bios_resident_marker(dll_path: str, cap: dict) -> None: + """Publish/remove the opt-in marker consumed by the runtime preloader. + + Resident BIOS helpers use a synthetic page envelope, so their filename's + region key cannot equal the dirty-run start recovered at runtime. The + marker tells the loader to register the shard at cache scan time; normal + per-function code-CRC validation remains the execution authority. + """ + marker = os.path.splitext(dll_path)[0] + '.resident' + if cap.get('producer') != BIOS_RESIDENT_PRODUCER: + try: + os.remove(marker) + except FileNotFoundError: + pass + return + payload = { + 'schema': BIOS_RESIDENT_MARKER, + 'bios_sha256': str(cap.get('bios_sha256', '')), + 'producer_name': str(cap.get('producer_name', 'BIOS resident code')), + } + serialized = json.dumps(payload, sort_keys=True) + '\n' + try: + with open(marker, 'r', encoding='utf-8') as f: + if f.read(len(serialized) + 1) == serialized: + return + except (FileNotFoundError, OSError, UnicodeError): + pass + tmp = f'{marker}.tmp.{uuid.uuid4().hex}' + try: + with open(tmp, 'w', encoding='utf-8') as f: + f.write(serialized) + os.replace(tmp, marker) + finally: + _best_effort_unlink(tmp) + + +def reconcile_bios_resident_marker(dll_path: str, cap: dict, + published: bool) -> None: + """Keep the winner's residency, while letting resident evidence self-heal. + + A losing ordinary writer must not remove a resident winner's sidecar. A + resident capture may always ensure the marker: identical region bytes make + the preserved shard equally safe to preload, and this repairs a crash + between pair publication and sidecar publication. + """ + # Once this exact canonical region identity has verified resident evidence, + # retaining the marker is safe even if an ordinary capture won the compile + # race: every function still passes the live per-range CRC guard. Never let + # an ordinary writer race a resident writer by removing that evidence. + if cap.get('producer') == BIOS_RESIDENT_PRODUCER: + update_bios_resident_marker(dll_path, cap) + + +def _parse_addr(value) -> int: + if isinstance(value, int): + return value + return int(str(value), 16) + + +def _parse_addr_list(values) -> set[int]: + out = set() + for v in values or []: + try: + out.add(_parse_addr(v)) + except (TypeError, ValueError): + pass + return out + + +def optional_enrichment_fallback_capture(cap: dict) -> dict | None: + """Return a conservative retry recipe declared by a static extractor. + + The richer recipe is always attempted first. If its generated C or host + compile is rejected, these independently proven roots preserve the safe + shard while all optional aliases and normal-mode discoveries are dropped. + """ + key = 'optional_enrichment_fallback_entry_pcs' + recipe = cap.get(key, []) + fallback = dict(cap) + if isinstance(recipe, dict): + functions = sorted(_parse_addr_list( + recipe.get('function_entry_pcs', []))) + dispatch = sorted(_parse_addr_list( + recipe.get('dispatch_entry_pcs', []))) + static = sorted(_parse_addr_list( + recipe.get('static_discovery_entry_pcs', []))) + static_dispatch = sorted(_parse_addr_list( + recipe.get('static_dispatch_entry_pcs', []))) + if not (functions or dispatch or static): + return None + fallback['function_entry_pcs'] = [ + f'0x{entry:08X}' for entry in functions] + fallback['dispatch_entry_pcs'] = [ + f'0x{entry:08X}' for entry in dispatch] + fallback['static_dispatch_entry_pcs'] = [ + f'0x{entry:08X}' for entry in static_dispatch + if entry in set(dispatch)] + fallback['static_discovery_entry_pcs'] = [ + f'0x{entry:08X}' for entry in static] + fallback['seeds'] = fallback['function_entry_pcs'] + if 'producer_ranges' in recipe: + fallback['producer_ranges'] = recipe['producer_ranges'] + if 'strict_producer_ranges' in recipe: + fallback['strict_producer_ranges'] = bool( + recipe['strict_producer_ranges']) + else: + entries = sorted(_parse_addr_list(recipe)) + if not entries: + return None + encoded = [f'0x{entry:08X}' for entry in entries] + fallback['function_entry_pcs'] = encoded + fallback['dispatch_entry_pcs'] = encoded + fallback['static_dispatch_entry_pcs'] = [] + fallback['static_discovery_entry_pcs'] = encoded + fallback['seeds'] = encoded + fallback.pop('static_alias_ranges', None) + fallback.pop('static_jump_table_proofs', None) + fallback.pop('static_call_continuation_pcs', None) + fallback.pop('_prior_aliases', None) + fallback.pop(key, None) + return fallback + + +def _word_at(data: bytes, load_addr: int, addr: int): + off = addr - load_addr + if off < 0 or off + 4 > len(data): + return None + return struct.unpack_from(' bool: + return word == 0x03E00008 + + +def _is_addiu_sp_neg(word) -> bool: + if word is None: + return False + return ((word >> 26) & 0x3F) == 0x09 \ + and ((word >> 21) & 0x1F) == 29 \ + and ((word >> 16) & 0x1F) == 29 \ + and (word & 0x8000) != 0 + + +def _is_control_flow(word) -> bool: + if word is None: + return False + op = (word >> 26) & 0x3F + fn = word & 0x3F + return (op in (0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x14, 0x15, 0x16, 0x17) or + (op == 0 and fn in (0x08, 0x09)) or + (op in (0x11, 0x12) and ((word >> 21) & 0x1F) == 0x08)) + + +def _is_valid_mips_word(word) -> bool: + if word is None or word in (0xFFFFFFFF, 0xFFFFFFFD): + return False + + op = (word >> 26) & 0x3F + fn = word & 0x3F + rt = (word >> 16) & 0x1F + + if op == 0x00: + return fn in { + 0x00, 0x02, 0x03, 0x04, 0x06, 0x07, + 0x08, 0x09, 0x0C, 0x0D, + 0x10, 0x11, 0x12, 0x13, + 0x18, 0x19, 0x1A, 0x1B, + 0x20, 0x21, 0x22, 0x23, + 0x24, 0x25, 0x26, 0x27, + 0x2A, 0x2B, + } + if op == 0x01: + return rt in (0x00, 0x01, 0x10, 0x11) + + return op in { + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x12, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, + 0x28, 0x29, 0x2A, 0x2B, 0x2E, + 0x30, 0x32, 0x38, 0x3A, + } + + +def _jump_target(pc: int, word: int) -> int: + return ((pc + 4) & 0xF0000000) | ((word & 0x03FFFFFF) << 2) + + +def _branch_target(pc: int, word: int) -> int: + imm = word & 0xFFFF + if imm & 0x8000: + imm -= 0x10000 + return pc + 4 + (imm << 2) + + +def _classify_cf(pc: int, word: int) -> tuple[str, int]: + op = (word >> 26) & 0x3F + fn = word & 0x3F + rs = (word >> 21) & 0x1F + if op == 0 and fn == 0x08: + return ('jr_ra' if rs == 31 else 'jr', 0) + if op == 0 and fn == 0x09: + return ('jalr', 0) + if op == 0x02: + return ('j', _jump_target(pc, word)) + if op == 0x03: + return ('jal', _jump_target(pc, word)) + rt = (word >> 16) & 0x1F + if op in (0x04, 0x14) and rs == rt: + return ('j', _branch_target(pc, word)) + if op == 0x05 and rs == rt: + return ('branch_never', 0) + if op == 0x15 and rs == rt: + return ('branch_never_likely', 0) + if op in (0x06, 0x16) and rs == 0: + return ('j', _branch_target(pc, word)) + if op == 0x07 and rs == 0: + return ('branch_never', 0) + if op == 0x17 and rs == 0: + return ('branch_never_likely', 0) + if op == 0x01 and rs == 0: + if rt in (0x00, 0x10): # bltz / bltzal + return ('branch_never', 0) + if rt in (0x02, 0x12): # bltzl / bltzall + return ('branch_never_likely', 0) + if rt in (0x01, 0x03): # bgez / bgezl + return ('j', _branch_target(pc, word)) + if rt in (0x11, 0x13): # bal / ball aliases: target + continuation + return ('jal', _branch_target(pc, word)) + if op in (0x11, 0x12) and rs == 0x08: + return ('branch', _branch_target(pc, word)) + if op in (0x01, 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17): + return ('branch', _branch_target(pc, word)) + return ('normal', 0) + + +def _find_jump_table_targets(data: bytes, load_addr: int, size: int, + entry: int, hard_cap: int, + jr_pc: int, jr_rs: int, + producer_range=None, proof_out=None) -> set[int]: + """Resolve one tightly bounded canonical ``sltiu``/``jr`` switch. + + This is deliberately a structural reaching-definition proof, not the old + 40-word bag-of-opcodes backscan. The accepted suffix is:: + + sltiu guard,index,count; beq guard,zero,reject; nop + sll scaled,index,2; addu address,scaled,table_base + lw target,offset(address); [nop x 0..1]; jr target + + Also accept ``sltiu; beq; lui; addiu; sll``: the LUI executes in the + guard's delay slot, then ADDIU completes the base on the in-range path. + That exact pair may not overwrite the checked index, and direct edges + may not bypass the bound (including edges from switch cases). + + ``table_base`` must be a nearest-definition LUI, optionally followed by a + nearest-definition ADDIU. The lower instruction may rename the + register (``lui v0; addiu s0,v0,lo``), as used by Ape Escape. Any other + control flow between that constant and the suffix, an inbound edge that + skips the definition, a register mismatch/clobber, or one non-local table + entry rejects the entire candidate. + """ + lo = load_addr + hi = load_addr + size + if not (entry <= jr_pc < hard_cap and 0 < jr_rs < 31): + return set() + jr_word = _word_at(data, load_addr, jr_pc) + if jr_word != ((jr_rs << 21) | 0x08): + return set() + + # Permit only the compiler's zero-or-one scheduling NOP between LW/JR. + lw_pc = jr_pc - 4 + for _ in range(1): + if _word_at(data, load_addr, lw_pc) != 0: + break + lw_pc -= 4 + lw_word = _word_at(data, load_addr, lw_pc) + if lw_word is None or ((lw_word >> 26) & 0x3F) != 0x23 \ + or ((lw_word >> 16) & 0x1F) != jr_rs: + return set() + address_reg = (lw_word >> 21) & 0x1F + if not address_reg: + return set() + lw_offset = lw_word & 0xFFFF + if lw_offset & 0x8000: + lw_offset -= 0x10000 + + addu_pc = lw_pc - 4 + addu_word = _word_at(data, load_addr, addu_pc) + if addu_word is None or ((addu_word >> 26) & 0x3F) != 0 \ + or (addu_word & 0x3F) != 0x21 \ + or ((addu_word >> 6) & 0x1F) != 0 \ + or ((addu_word >> 11) & 0x1F) != address_reg: + return set() + addu_inputs = ((addu_word >> 21) & 0x1F, + (addu_word >> 16) & 0x1F) + + sll_pc = addu_pc - 4 + sll_word = _word_at(data, load_addr, sll_pc) + if sll_word is None or ((sll_word >> 26) & 0x3F) != 0 \ + or (sll_word & 0x3F) != 0 \ + or ((sll_word >> 21) & 0x1F) != 0 \ + or ((sll_word >> 6) & 0x1F) != 2: + return set() + scaled_reg = (sll_word >> 11) & 0x1F + index_reg = (sll_word >> 16) & 0x1F + if not scaled_reg or not index_reg or scaled_reg not in addu_inputs: + return set() + table_reg = addu_inputs[1] if addu_inputs[0] == scaled_reg else addu_inputs[0] + if not table_reg or table_reg == scaled_reg: + return set() + + # The bound must guard this exact index on the sole fallthrough into SLL. + sltiu_pc = sll_pc - 12 + branch_pc = sll_pc - 8 + scheduled_base = _word_at(data, load_addr, sll_pc - 4) != 0 + if scheduled_base: + # R3000 load delay: JR must not consume the immediately preceding LW. + if lw_pc != jr_pc - 8: + return set() + sltiu_pc -= 4 + branch_pc -= 4 + upper = _word_at(data, load_addr, sll_pc - 8) + lower = _word_at(data, load_addr, sll_pc - 4) + if (upper is None or lower is None or + (upper >> 26) != 0x0F or ((upper >> 21) & 31) != 0 or + (lower >> 26) != 0x09 or ((lower >> 16) & 31) != table_reg or + ((upper >> 16) & 31) == 0 or + ((upper >> 16) & 31) != ((lower >> 21) & 31) or + index_reg in (table_reg, (upper >> 16) & 31)): + return set() + if sltiu_pc < entry or (sltiu_pc >= entry + 4 and + _is_control_flow(_word_at(data, load_addr, sltiu_pc - 4))): + return set() + sltiu_word = _word_at(data, load_addr, sltiu_pc) + branch_word = _word_at(data, load_addr, branch_pc) + if sltiu_word is None or ((sltiu_word >> 26) & 0x3F) != 0x0B \ + or ((sltiu_word >> 21) & 0x1F) != index_reg: + return set() + guard_reg = (sltiu_word >> 16) & 0x1F + table_count = sltiu_word & 0xFFFF + if not guard_reg or guard_reg == index_reg or not (1 <= table_count < 512): + return set() + if branch_word is None or ((branch_word >> 26) & 0x3F) != 0x04: + return set() + branch_rs = (branch_word >> 21) & 0x1F + branch_rt = (branch_word >> 16) & 0x1F + if {branch_rs, branch_rt} != {0, guard_reg}: + return set() + reject_target = _branch_target(branch_pc, branch_word) + if (not (entry <= reject_target < hard_cap) or + sll_pc <= reject_target < jr_pc + 8 or + (scheduled_base and sltiu_pc < reject_target < jr_pc + 8)): + return set() + + def nearest_writer(reg: int, before: int): + for pc in range(before - 4, max(entry, before - 0x80) - 1, -4): + word = _word_at(data, load_addr, pc) + if word is None: + return None + if _instruction_writes_gpr(word, reg): + return pc, word + return None + + table_writer = nearest_writer(table_reg, addu_pc) + if table_writer is None: + return set() + table_def_pc, table_def_word = table_writer + def_op = (table_def_word >> 26) & 0x3F + def_rs = (table_def_word >> 21) & 0x1F + def_rt = (table_def_word >> 16) & 0x1F + if def_op == 0x0F and def_rs == 0 and def_rt == table_reg: + constant_pc = table_def_pc + table_base = (table_def_word & 0xFFFF) << 16 + elif def_op == 0x09 and def_rt == table_reg and def_rs: + upper_writer = nearest_writer(def_rs, table_def_pc) + if upper_writer is None: + return set() + constant_pc, upper_word = upper_writer + if ((upper_word >> 26) & 0x3F) != 0x0F \ + or ((upper_word >> 21) & 0x1F) != 0 \ + or ((upper_word >> 16) & 0x1F) != def_rs: + return set() + low = table_def_word & 0xFFFF + upper = (upper_word & 0xFFFF) << 16 + if low & 0x8000: + low -= 0x10000 + table_base = (upper + low) & 0xFFFFFFFF + else: + return set() + + if scheduled_base and (constant_pc != branch_pc + 4 or + table_def_pc != sll_pc - 4): + return set() + + # Calls could clobber the proven constant. Other branches could enter the + # suffix through an unproved path. The one exact bounds branch is allowed. + for pc in range(constant_pc + 4, sll_pc, 4): + word = _word_at(data, load_addr, pc) + if word is None: + return set() + if _is_control_flow(word) and pc != branch_pc: + return set() + predecessor = _word_at(data, load_addr, constant_pc - 4) + if (constant_pc >= entry + 4 and _is_control_flow(predecessor) and + not scheduled_base): + return set() + table_base = (table_base + lw_offset) & 0xFFFFFFFF + table_end = table_base + table_count * 4 + range_lo, range_hi = producer_range or (lo, hi) + if (table_base & 3) or not (range_lo <= table_base < table_end <= range_hi): + return set() + + targets = set() + for index in range(table_count): + target = _word_at(data, load_addr, table_base + index * 4) + if (target is None or (target & 3) or + not (entry <= target < hard_cap) or + (scheduled_base and sltiu_pc < target < jr_pc + 8) or + not (range_lo <= target < range_hi) or + not _is_valid_mips_word(_word_at(data, load_addr, target))): + return set() + targets.add(target) + + # Establish which later sources are themselves reached only after the + # proven table dispatch. Such case blocks may safely loop to the suffix + # (Ape does this); an arbitrary earlier/later byte sequence may not jump + # into the protected definitions and manufacture domination. + case_reachable = set() + work = deque(targets) + while work and len(case_reachable) < 2048: + pc = work.popleft() + if (pc in case_reachable or not (entry <= pc < hard_cap) or + not (range_lo <= pc < range_hi)): + continue + word = _word_at(data, load_addr, pc) + if not _is_valid_mips_word(word): + continue + case_reachable.add(pc) + kind, target = _classify_cf(pc, word) + delay = pc + 4 + if kind == 'normal': + work.append(pc + 4) + elif kind == 'branch': + case_reachable.add(delay) + work.extend((pc + 8, target)) + elif kind == 'branch_never': + case_reachable.add(delay) + work.append(pc + 8) + elif kind == 'branch_never_likely': + work.append(pc + 8) + elif kind == 'j': + case_reachable.add(delay) + work.append(target) + elif kind in ('jal', 'jalr'): + case_reachable.add(delay) + work.append(pc + 8) + elif kind in ('jr', 'jr_ra'): + case_reachable.add(delay) + + protected_pc = sltiu_pc if scheduled_base else constant_pc + for source in range(entry, hard_cap, 4): + source_word = _word_at(data, load_addr, source) + if source_word is None: + return set() + kind, target = _classify_cf(source, source_word) + if (kind in ('branch', 'j', 'jal') and + protected_pc < target <= jr_pc and + not (protected_pc <= source <= jr_pc) and + (scheduled_base or source not in case_reachable)): + return set() + if proof_out is not None: + proof_out.append({ + 'host_entry': entry, + 'jr_pc': jr_pc, + 'table_base': table_base, + 'count': table_count, + 'targets': sorted(targets), + }) + return targets + + +def _callable_legacy_seed(data: bytes, load_addr: int, addr: int) -> bool: + """Conservative fallback for old captures that only had a `seeds` list.""" + word = _word_at(data, load_addr, addr) + prev = _word_at(data, load_addr, addr - 4) + prev8 = _word_at(data, load_addr, addr - 8) + if not _is_valid_mips_word(word): + return False + if addr == load_addr: + return True + if _is_jr_ra(prev8): + return True + return _is_addiu_sp_neg(word) and not _is_control_flow(prev) + + +def _dense_local_pointer_table(data: bytes, load_addr: int, + addr: int, count: int = 3) -> bool: + """Reject instruction-shaped data at a supposed callable target.""" + hi = load_addr + len(data) + for index in range(count): + value = _word_at(data, load_addr, addr + index * 4) + if value is None or (value & 3) or not (load_addr <= value < hi): + return False + return True + + +def _callable_direct_jal_target(data: bytes, load_addr: int, addr: int) -> bool: + """True only when a direct JAL target has independent boundary evidence.""" + return (not _dense_local_pointer_table(data, load_addr, addr) and + _callable_legacy_seed(data, load_addr, addr)) + + +def _instruction_writes_gpr(word: int, reg: int) -> bool: + if not reg: + return False + op = (word >> 26) & 0x3F + rs = (word >> 21) & 0x1F + rt = (word >> 16) & 0x1F + rd = (word >> 11) & 0x1F + fn = word & 0x3F + if op == 0: + if fn in (0x08, 0x0C, 0x0D, 0x11, 0x13, + 0x18, 0x19, 0x1A, 0x1B): + return False + return rd == reg + if op == 0x03: + return reg == 31 + if op == 0x01 and rt in (0x10, 0x11): + return reg == 31 + if op in range(0x08, 0x10) or op in range(0x20, 0x27) \ + or op in (0x30, 0x32): + return rt == reg + if op in (0x10, 0x12) and rs in (0, 2): + return rt == reg + return False + + +def _resolve_constant_transfer(data: bytes, load_addr: int, + entry: int, transfer_pc: int, + target_reg: int): + """Resolve a same-basic-block lui + addiu/ori constant feeding jr/jalr.""" + low = None + low_is_addiu = False + for count in range(1, 17): + pc = transfer_pc - count * 4 + if pc < entry: + break + word = _word_at(data, load_addr, pc) + if word is None: + break + op = (word >> 26) & 0x3F + rs = (word >> 21) & 0x1F + rt = (word >> 16) & 0x1F + if low is None and op in (0x09, 0x0D) \ + and rs == target_reg and rt == target_reg: + low = word & 0xFFFF + low_is_addiu = op == 0x09 + continue + if op == 0x0F and rt == target_reg: + # A LUI in a control-transfer delay slot is not a local reaching + # definition for the following suffix. A callee may clobber the + # register before returning at LUI+4, while a branch/jump can leave + # the linear path entirely. Fail closed without path/call proof. + predecessor = _word_at(data, load_addr, pc - 4) + if pc >= entry + 4 and _is_control_flow(predecessor): + return None + + # Reject a syntactic constant pair when a direct control-flow edge + # can enter after this LUI. Example: `j low; lui; low: addiu; + # jalr` never executes the LUI, despite looking like a pair to a + # raw backward scan. + crossed_inbound_boundary = False + for source in range(entry, transfer_pc, 4): + source_word = _word_at(data, load_addr, source) + if source_word is None: + continue + source_kind, source_target = _classify_cf(source, source_word) + if (source_kind in ('branch', 'j', 'jal') and + pc < source_target <= transfer_pc): + crossed_inbound_boundary = True + break + if crossed_inbound_boundary: + return None + + upper = (word & 0xFFFF) << 16 + if low is None: + return upper + if low_is_addiu and low & 0x8000: + low -= 0x10000 + return (upper + low) & 0xFFFFFFFF if low_is_addiu else upper | low + if _instruction_writes_gpr(word, target_reg) or _is_control_flow(word): + break + return None + + +def plausible_callable_target(data: bytes, load_addr: int, size: int, + target: int, producer_hi: int) -> bool: + """CFG proof for a cross-producer call target without a classic prologue. + + Direct calls are sufficient boundary evidence inside one linked producer. + Across a synthetic adjacent-producer envelope, additionally require a + bounded, valid CFG with a reachable return and no sequential fallthrough. + This retains real frameless exports while rejecting pointer tables/NOP + runways that only happen to decode as instructions. + """ + first = _word_at(data, load_addr, target) + if first in (None, 0) or not _is_valid_mips_word(first): + return False + if _dense_local_pointer_table(data, load_addr, target): + return False + cap = min(load_addr + size, producer_hi, target + 0x4000) + work = deque([target]) + visited = set() + saw_return = False + bad = False + + def inside(addr: int) -> bool: + return target <= addr < cap and (addr & 3) == 0 + + def add_delay(pc: int) -> None: + nonlocal bad + delay = pc + 4 + if not inside(delay): + bad = True + return + word = _word_at(data, load_addr, delay) + if not _is_valid_mips_word(word): + bad = True + else: + visited.add(delay) + + while work and not bad and len(visited) < 2048: + pc = work.popleft() + if pc in visited: + continue + if not inside(pc): + bad = True # sequential fallthrough past the bounded probe + break + word = _word_at(data, load_addr, pc) + if not _is_valid_mips_word(word): + bad = True + break + visited.add(pc) + kind, branch_target = _classify_cf(pc, word) + if kind == 'normal': + work.append(pc + 4) + elif kind == 'branch': + add_delay(pc) + work.append(pc + 8) # conditional fallthrough must remain bounded + if inside(branch_target): + work.append(branch_target) + # An out-of-probe branch target is a shared external code edge. + elif kind == 'branch_never': + add_delay(pc) + work.append(pc + 8) + elif kind == 'branch_never_likely': + work.append(pc + 8) + elif kind in ('jal', 'jalr'): + add_delay(pc) + work.append(pc + 8) + elif kind == 'j': + add_delay(pc) + if inside(branch_target): + work.append(branch_target) + # Otherwise this is a bounded tail edge. + elif kind == 'jr_ra': + add_delay(pc) + saw_return = True + elif kind == 'jr': + add_delay(pc) # bounded indirect/tail exit + + return saw_return and not bad and not work and len(visited) < 2048 + + +def _frameless_dispatch_root_proven(data: bytes, load_addr: int, size: int, + addr: int, producer_hi: int) -> bool: + """CFG proof for a dispatch entry admitted only by the word before it. + + `_callable_legacy_seed` accepts an address on three different grades of + evidence: it is the image entry, it opens a stack frame, or the word two + slots back is `jr $ra`. The third is the weak one, and it is weak exactly + where it fires most: the first word *after* a function's return is also + the first word of whatever the linker laid down next, which in these + images is routinely a pointer table, a packed record array or zero fill. + A dispatch PC there is real -- a sibling occupant of the shared band has + code at that address -- but for *this* image it is data, and promoting it + to a walk root sends the linear walk through the table to the image end. + + So require the same bounded CFG probe the discovery roots already use + when the classic prologue is absent. Failing it does not discard the + entry: the caller demotes it to DISPATCH_INTERIOR, which keeps the + dispatch evidence and the isolated-fragment demand and only declines to + start a walk there. + """ + word = _word_at(data, load_addr, addr) + prev = _word_at(data, load_addr, addr - 4) + if addr == load_addr: + return True + if _is_addiu_sp_neg(word) and not _is_control_flow(prev): + return True + return plausible_callable_target(data, load_addr, size, addr, producer_hi) + + +def _walk_overlay_function(data: bytes, load_addr: int, size: int, + entry: int, hard_cap: int, + producer_ranges=(), + allow_cross_producer_calls=True) -> dict: + lo = load_addr + hi = load_addr + size + + work = deque([entry]) + visited = set() + direct_jals = set() + static_indirect_targets = set() + call_continuations = set() + branch_targets = set() + jump_table_targets = set() + jump_table_proofs = [] + forward_branch_targets = set() + rejected_cross_producer_calls = set() + accepted_cross_producer_calls = set() + + def producer_for(addr: int): + for range_lo, range_hi in producer_ranges: + if range_lo <= addr < range_hi: + return range_lo, range_hi + return None + + entry_producer = producer_for(entry) + + def in_function(addr: int) -> bool: + return (lo <= addr < hi and entry <= addr < hard_cap and + (addr & 3) == 0 and + (not producer_ranges or + (entry_producer is not None and + producer_for(addr) == entry_producer))) + + def callable_transfer_target(source: int, target: int) -> bool: + if _dense_local_pointer_table(data, load_addr, target): + rejected_cross_producer_calls.add(target) + return False + if not producer_ranges: + return True + source_range = producer_for(source) + target_range = producer_for(target) + if source_range is None or target_range is None: + rejected_cross_producer_calls.add(target) + return False + if source_range is not None and source_range == target_range: + return True + if not allow_cross_producer_calls: + rejected_cross_producer_calls.add(target) + return False + # Adjacent-producer composites are a byte envelope, not proof that a + # call encoded by producer A is linked to arbitrary bytes at the same + # address in every producer-B variant. Cross-boundary calls therefore + # need independent local boundary evidence. This keeps real exports + # while rejecting pointer/data words that happen to be valid MIPS. + if _callable_direct_jal_target(data, load_addr, target): + accepted_cross_producer_calls.add(target) + return True + if (target_range is not None and + plausible_callable_target( + data, load_addr, size, target, target_range[1])): + accepted_cross_producer_calls.add(target) + return True + rejected_cross_producer_calls.add(target) + return False + + while work: + pc = work.popleft() + if pc in visited or not in_function(pc): + continue + word = _word_at(data, load_addr, pc) + if word is None: + continue + visited.add(pc) + kind, target = _classify_cf(pc, word) + delay = pc + 4 + + if kind == 'normal': + if in_function(pc + 4): + work.append(pc + 4) + elif kind == 'branch': + if in_function(delay): + visited.add(delay) + if in_function(pc + 8): + work.append(pc + 8) + branch_targets.add(pc + 8) + if in_function(target): + work.append(target) + branch_targets.add(target) + elif lo <= target < hi and target >= hard_cap and (target & 3) == 0: + # A reachable direct branch may jump across a sibling entry. + # Exact-entry partitioning hard-caps the current walk there, + # but the target remains mechanically proven code reachability. + forward_branch_targets.add(target) + elif kind == 'branch_never': + if in_function(delay): + visited.add(delay) + if in_function(pc + 8): + work.append(pc + 8) + branch_targets.add(pc + 8) + elif kind == 'branch_never_likely': + if in_function(pc + 8): + work.append(pc + 8) + branch_targets.add(pc + 8) + elif kind == 'j': + if in_function(delay): + visited.add(delay) + if in_function(target): + work.append(target) + branch_targets.add(target) + elif lo <= target < hi and target >= hard_cap and (target & 3) == 0: + forward_branch_targets.add(target) + elif kind == 'jal': + if in_function(delay): + visited.add(delay) + if in_function(pc + 8): + work.append(pc + 8) + branch_targets.add(pc + 8) + call_continuations.add(pc + 8) + if (lo <= target < hi and (target & 3) == 0 and + _is_valid_mips_word(_word_at(data, load_addr, target)) and + callable_transfer_target(pc, target)): + direct_jals.add(target) + elif kind == 'jalr': + if in_function(delay): + visited.add(delay) + if in_function(pc + 8): + work.append(pc + 8) + branch_targets.add(pc + 8) + call_continuations.add(pc + 8) + target_reg = (word >> 21) & 0x1F + target = _resolve_constant_transfer(data, load_addr, entry, pc, + target_reg) + if (target is not None and lo <= target < hi and (target & 3) == 0 + and callable_transfer_target(pc, target)): + static_indirect_targets.add(target) + elif kind == 'jr': + if in_function(delay): + visited.add(delay) + jr_rs = (word >> 21) & 0x1F + target = _resolve_constant_transfer(data, load_addr, entry, pc, jr_rs) + if target is not None and lo <= target < hi and (target & 3) == 0: + if in_function(target): + branch_targets.add(target) + work.append(target) + elif callable_transfer_target(pc, target): + static_indirect_targets.add(target) + else: + proofs = [] + for jt in _find_jump_table_targets(data, load_addr, size, + entry, hard_cap, pc, jr_rs, + entry_producer, proofs): + jump_table_targets.add(jt) + branch_targets.add(jt) + if in_function(jt): + work.append(jt) + jump_table_proofs.extend(proofs) + elif kind == 'jr_ra': + if in_function(delay): + visited.add(delay) + + return { + 'visited': visited, + 'direct_jals': direct_jals, + 'static_indirect_targets': static_indirect_targets, + 'call_continuations': call_continuations, + 'branch_targets': branch_targets, + 'jump_table_targets': jump_table_targets, + 'jump_table_proofs': jump_table_proofs, + 'forward_branch_targets': forward_branch_targets, + 'rejected_cross_producer_calls': rejected_cross_producer_calls, + 'accepted_cross_producer_calls': accepted_cross_producer_calls, + } + + +def _masked_region_crc(data: bytes, load_addr: int, ignore) -> int: + """CRC32 of a captured region with declared-volatile byte ranges zeroed.""" + if not ignore: + return binascii.crc32(data) & 0xFFFFFFFF + buf = bytearray(data) + hi = load_addr + len(data) + for raw in ignore: + if isinstance(raw, dict): + start, end = _parse_addr(raw['start']), _parse_addr(raw['end']) + else: + raise RuntimeError( + 'bytes_crc_ignore entries must be tables with start/end') + if not (load_addr <= start < end <= hi): + raise RuntimeError( + f'bytes_crc_ignore range 0x{start:08X}..0x{end:08X} outside ' + f'capture 0x{load_addr:08X}..0x{hi:08X}') + buf[start - load_addr:end - load_addr] = b'\0' * (end - start) + return binascii.crc32(bytes(buf)) & 0xFFFFFFFF + + +def _collect_toml_overlay_entries(toml_doc: dict, load_addr: int, crc32: int, + data: bytes = b'') -> set[int]: + entries = set() + for ov in toml_doc.get('overlays', []) or []: + if not isinstance(ov, dict): + continue + ov_load = ov.get('load_addr') or ov.get('load_address') + if ov_load is not None and _parse_addr(ov_load) != load_addr: + continue + ov_crc = ov.get('bytes_crc') or ov.get('crc32') or ov.get('crc') + if ov_crc is not None: + ignore = ov.get('bytes_crc_ignore') + live = _masked_region_crc(data, load_addr, ignore) if ignore else crc32 + if _parse_addr(ov_crc) != live: + print(f' declared entries DETACHED for 0x{load_addr:08X}: ' + f'bytes_crc=0x{_parse_addr(ov_crc):08X} but region hashes ' + f'0x{live:08X}' + f'{" (masked)" if ignore else ""} -- update game.toml', + file=sys.stderr) + continue + for key in ('entry', 'entries', 'function_entry_pcs', 'function_entries'): + if key not in ov: + continue + val = ov[key] + if isinstance(val, list): + entries.update(_parse_addr_list(val)) + else: + entries.add(_parse_addr(val)) + return entries + + +def classify_overlay_seeds(cap: dict, data: bytes, load_addr: int, size: int, + crc32: int, toml_doc: dict) -> tuple[list[str], dict]: + lo = load_addr + hi = load_addr + size + region = lambda a: lo <= a < hi and (a & 3) == 0 + producer_ranges = [] + for raw_range in cap.get('producer_ranges', []) or []: + if not isinstance(raw_range, dict): + raise RuntimeError('producer_ranges entries must be objects') + try: + range_lo = _parse_addr(raw_range['start']) + range_hi = _parse_addr(raw_range['end']) + except (KeyError, TypeError, ValueError) as exc: + raise RuntimeError(f'invalid producer_ranges entry: {raw_range}') from exc + if not (lo <= range_lo < range_hi <= hi): + raise RuntimeError( + f'producer range 0x{range_lo:08X}..0x{range_hi:08X} ' + f'outside capture 0x{lo:08X}..0x{hi:08X}') + producer_ranges.append((range_lo, range_hi)) + producer_ranges.sort() + if any(producer_ranges[i-1][1] > producer_ranges[i][0] + for i in range(1, len(producer_ranges))): + raise RuntimeError('producer_ranges overlap') + + def capture_producer_for(addr: int): + for producer_lo, producer_hi in producer_ranges: + if producer_lo <= addr < producer_hi: + return producer_lo, producer_hi + return None + + static_alias_ranges = set() + allow_cross_producer_calls = not bool(cap.get('strict_producer_ranges')) + for raw_alias in cap.get('static_alias_ranges', []) or []: + if not isinstance(raw_alias, dict): + raise RuntimeError('static_alias_ranges entries must be objects') + try: + entry = _parse_addr(raw_alias['entry']) + range_lo = _parse_addr(raw_alias['start']) + range_hi = _parse_addr(raw_alias['end']) + except (KeyError, TypeError, ValueError) as exc: + raise RuntimeError( + f'invalid static_alias_ranges entry: {raw_alias}') from exc + if not (lo <= range_lo <= entry < range_hi <= hi and + (entry & 3) == 0 and (range_lo & 3) == 0 and + (range_hi & 3) == 0): + raise RuntimeError( + f'static alias 0x{entry:08X} -> ' + f'0x{range_lo:08X}..0x{range_hi:08X} outside/misaligned for ' + f'capture 0x{lo:08X}..0x{hi:08X}') + if producer_ranges: + owners = [index for index, (producer_lo, producer_hi) in + enumerate(producer_ranges) + if (producer_lo <= range_lo < producer_hi and + producer_lo <= entry < producer_hi and + producer_lo <= range_hi - 1 < producer_hi)] + if not owners: + raise RuntimeError( + f'static alias 0x{entry:08X} crosses producer boundary') + static_alias_ranges.add((entry, range_lo, range_hi)) + + schema_keys = {'executed_pcs', 'observed_pcs', 'dispatch_entry_pcs', + 'static_dispatch_entry_pcs', 'function_entry_pcs'} + has_split_schema = any(k in cap for k in schema_keys) + + legacy_seeds = _parse_addr_list(cap.get('seeds', [])) + executed_pcs = _parse_addr_list(cap.get('executed_pcs', + cap.get('observed_pcs', + legacy_seeds if not has_split_schema else []))) + dispatch_entry_pcs = _parse_addr_list(cap.get('dispatch_entry_pcs', [])) + # New extractors preserve which dispatch entries came from a static + # export/header/jump table. Treat malformed superset values as ordinary + # unknown metadata, never as cross-variant authority. + declared_static_dispatch = _parse_addr_list( + cap.get('static_dispatch_entry_pcs', [])) + if not declared_static_dispatch <= dispatch_entry_pcs: + extra = sorted(declared_static_dispatch - dispatch_entry_pcs) + raise RuntimeError( + 'static_dispatch_entry_pcs must be a subset of ' + 'dispatch_entry_pcs: ' + + ', '.join(f'0x{addr:08X}' for addr in extra)) + static_dispatch_entries = declared_static_dispatch + captured_function_entries = _parse_addr_list(cap.get('function_entry_pcs', [])) + static_discovery_entries = _parse_addr_list( + cap.get('static_discovery_entry_pcs', [])) + toml_entries = _collect_toml_overlay_entries(toml_doc, load_addr, crc32, data) + legacy_callable_seeds = {a for a in legacy_seeds + if region(a) and _callable_legacy_seed(data, load_addr, a)} + + included: dict[int, str] = {} + excluded: dict[int, str] = {} + # Shared CFG ownership may later reject a hostless interior. Preserve its + # validated dispatch evidence separately so executed entries can still use + # the isolated, audited fragment path without truncating a shared host. + dispatch_fragment_demands = set() + fragment_hi = hi - capture_guard_bytes(cap, size) + game_text = _game_text_range(toml_doc) + + # A dispatch into dirty RAM can land on a jump-table case label. That + # proves coverage, not a callable function boundary, so discover those + # labels before promoting dispatch entries to seeds. + pre_roots = (set(legacy_callable_seeds) | set(captured_function_entries) | + set(static_discovery_entries) | set(toml_entries)) + pre_roots.update(a for a in dispatch_entry_pcs + if region(a) and _callable_legacy_seed(data, load_addr, a)) + jump_table_targets = set() + pre_roots_sorted = sorted(a for a in pre_roots if region(a)) + for i, entry in enumerate(pre_roots_sorted): + hard_cap = pre_roots_sorted[i + 1] if i + 1 < len(pre_roots_sorted) else hi + walk = _walk_overlay_function( + data, load_addr, size, entry, hard_cap, producer_ranges, + allow_cross_producer_calls) + jump_table_targets.update(walk['jump_table_targets']) + + def impossible_entry_start(addr: int) -> bool: + word = _word_at(data, load_addr, addr) + if word is None: + return True + if not _is_valid_mips_word(word): + return True + kind, target = _classify_cf(addr, word) + if kind == 'j': + return _classify_target(target, load_addr, size, game_text) == 'UNKNOWN_BAD' + if kind == 'jal' and region(target): + return not _callable_direct_jal_target(data, load_addr, target) + return False + + def include(addr: int, reason: str): + if not region(addr): + excluded[addr] = 'UNKNOWN' + return + # Composite padding has bytes but no producer identity. A root there + # would otherwise get entry_producer=None and could walk through every + # disconnected zero-fill gap as though those gaps shared ownership. + if producer_ranges and capture_producer_for(addr) is None: + excluded[addr] = 'UNKNOWN' + return + # Boundary gate: a dispatched-to PC is proof of *code reachability*, not + # of a *callable function boundary*. A jr-driven jump-table case label + # or a mid-function pointer target can be dispatched-to yet have no + # prologue and no preceding jr $ra. Promoting it to a WALK ROOT would + # truncate its host function (mid-function-seed softlock class) or run + # off into adjacent data. Such PCs are dispatch-proven code, though — + # classify them DISPATCH_INTERIOR: the recompiler emits them as + # overlapping-alias entries into their host (never walk roots). + # Invalid words stay excluded. Call-edge-proven reasons + # (DIRECT_JAL_TARGET, FUNCTION_POINTER_TARGET, TOML_DECLARED_ENTRY) are + # exempt — they carry their own proof. + # A dispatch entry that has no prologue and is callable only because a + # `jr $ra` precedes it is the head of whatever follows the last + # function, data included, so it needs the bounded CFG probe before it + # may be a walk root (_frameless_dispatch_root_proven). + if reason in ('DISPATCH_ENTRY', 'STATIC_DISPATCH_ENTRY'): + if impossible_entry_start(addr): + excluded[addr] = 'UNKNOWN' + return + if addr + 4 <= fragment_hi: + dispatch_fragment_demands.add(addr) + producer = capture_producer_for(addr) + if (addr in jump_table_targets or + not _callable_legacy_seed(data, load_addr, addr) or + not _frameless_dispatch_root_proven( + data, load_addr, size, addr, + producer[1] if producer else hi)): + included.setdefault(addr, 'DISPATCH_INTERIOR') + return + elif (reason not in ('DIRECT_JAL_TARGET', 'STATIC_INDIRECT_TARGET', + 'STATIC_BRANCH_ROOT', + 'STATIC_DISCOVERY_ROOT', + 'TOML_DECLARED_ENTRY') and + addr in jump_table_targets and + not _callable_legacy_seed(data, load_addr, addr)): + excluded[addr] = 'BRANCH_TARGET_ONLY' + return + if reason in FATAL_SEED_REASONS: + raise RuntimeError(f'BUG: refusing to include 0x{addr:08X} as {reason}') + old = included.get(addr) + if reason in ('DIRECT_JAL_TARGET', 'STATIC_INDIRECT_TARGET', + 'STATIC_BRANCH_ROOT', 'STATIC_DISCOVERY_ROOT', + 'STATIC_DISPATCH_ENTRY'): + # Static call-edge evidence outranks heuristic capture metadata. + included[addr] = reason + elif old is None or old in ('FUNCTION_POINTER_TARGET', 'DISPATCH_INTERIOR'): + included[addr] = reason + + for addr in dispatch_entry_pcs: + include(addr, ('STATIC_DISPATCH_ENTRY' + if addr in static_dispatch_entries + else 'DISPATCH_ENTRY')) + for addr in captured_function_entries: + include(addr, 'FUNCTION_POINTER_TARGET') + for addr in static_discovery_entries: + if not region(addr): + excluded[addr] = 'UNKNOWN' + elif (_callable_legacy_seed(data, load_addr, addr) or + plausible_callable_target(data, load_addr, size, addr, hi)): + include(addr, 'STATIC_DISCOVERY_ROOT') + else: + # Preserve the weaker classification. Overlay mode will perform + # its ordinary boundary recheck and fail closed if needed. + include(addr, 'FUNCTION_POINTER_TARGET') + for addr in toml_entries: + include(addr, 'TOML_DECLARED_ENTRY') + + legacy_seed_mode = bool(legacy_seeds) and not cap.get('schema') + if legacy_seed_mode: + # Old capture files used `seeds` for interpreter-observed PCs. Include + # only PCs whose surrounding bytes look callable; classify the rest + # after we know branch targets from accepted roots. + for addr in legacy_callable_seeds: + include(addr, 'FUNCTION_POINTER_TARGET') + + # Current-capture alias recipes contribute only an interior ENTRY candidate; + # their historical host range is not trusted. Final exact reachability below + # must discover a current host or the entry is dropped to the interpreter. + for addr, _range_lo, _range_hi in static_alias_ranges: + if region(addr): + included[addr] = 'DISPATCH_INTERIOR' + + # Walk roots: callable entries only. DISPATCH_INTERIOR addresses are NOT + # roots — as roots they would hard-cap (truncate) the sibling walk that + # owns them. + known = {a for a, r in included.items() if r != 'DISPATCH_INTERIOR'} + initial_known = set(known) + derived_reasons = {} + promoted_roots = set() + suppressed_derived = set() + suppression_passes = 0 + all_branch_targets = set() + kernel_window = (load_addr & 0x1FFFFFFF) < 0x10000 + + while True: + # Recompute call/branch evidence from the CURRENT partition. Evidence is + # not monotonic: a new hard cap can make an old source PC unreachable. + # Dropping stale candidates here prevents an old speculative walk from + # resurrecting a target in the final shard. + discovery_round = 0 + seen_states = {} + state_history = [] + while True: + discovery_round += 1 + state = (tuple(sorted(known)), tuple(sorted(derived_reasons))) + cycle_start = seen_states.get(state) + if discovery_round > 64 or cycle_start is not None: + unstable = set() + if cycle_start is not None: + cycle_states = state_history[cycle_start:] + known_sets = [set(item[0]) for item in cycle_states] + derived_sets = [set(item[1]) for item in cycle_states] + if known_sets: + unstable |= set.union(*known_sets) - set.intersection(*known_sets) + if derived_sets: + unstable |= (set.union(*derived_sets) - + set.intersection(*derived_sets)) + unstable_text = ','.join(f'{addr:08X}' + for addr in sorted(unstable)[:12]) + unstable -= initial_known | promoted_roots + if unstable and suppression_passes < 64: + suppression_passes += 1 + suppressed_derived.update(unstable) + print(' WARNING: ownership discovery cycle; suppressing ' + f'{len(unstable)} unstable derived roots' + + (f' ({unstable_text})' if unstable_text else '')) + known = initial_known | promoted_roots + derived_reasons = {} + discovery_round = 0 + seen_states = {} + state_history = [] + continue + print(' WARNING: ownership discovery did not converge; ' + 'falling back to explicit/dispatch roots' + + (f' (cycle={len(state_history) - cycle_start}, ' + f'unstable={unstable_text})' + if cycle_start is not None else ' (round limit)')) + known = initial_known | promoted_roots + derived_reasons = {} + break + seen_states[state] = len(state_history) + state_history.append(state) + next_reasons = {} + round_branch_targets = set() + sorted_known = sorted(known) + for index, entry in enumerate(sorted_known): + hard_cap = (sorted_known[index + 1] + if index + 1 < len(sorted_known) else hi) + walk = _walk_overlay_function( + data, load_addr, size, entry, hard_cap, producer_ranges, + allow_cross_producer_calls) + round_branch_targets.update(walk['branch_targets']) + round_branch_targets.update(walk['jump_table_targets']) + for target in walk['direct_jals']: + if (target not in initial_known and + target not in suppressed_derived): + next_reasons[target] = 'DIRECT_JAL_TARGET' + for target in walk['static_indirect_targets']: + if (target not in initial_known and + target not in suppressed_derived): + next_reasons.setdefault(target, 'STATIC_INDIRECT_TARGET') + for target in walk['forward_branch_targets']: + source_reason = (included.get(entry) or + derived_reasons.get(entry) or + ('DISPATCH_ROOT' + if entry in promoted_roots else None)) + strong_source = source_reason in ( + 'DIRECT_JAL_TARGET', 'STATIC_INDIRECT_TARGET', + 'STATIC_BRANCH_ROOT', 'STATIC_DISCOVERY_ROOT', + 'STATIC_DISPATCH_ENTRY', 'TOML_DECLARED_ENTRY', + 'DISPATCH_ROOT') + if not strong_source and not _callable_legacy_seed( + data, load_addr, entry): + continue + source_range = next( + ((rlo, rhi) for rlo, rhi in producer_ranges + if rlo <= entry < rhi), None) + target_range = next( + ((rlo, rhi) for rlo, rhi in producer_ranges + if rlo <= target < rhi), None) + if producer_ranges and source_range != target_range: + continue + producer_hi = target_range[1] if target_range else hi + if plausible_callable_target( + data, load_addr, size, target, producer_hi): + if (target not in initial_known and + target not in suppressed_derived): + next_reasons.setdefault(target, 'STATIC_BRANCH_ROOT') + + normalized = initial_known | promoted_roots | set(next_reasons) + roots = sorted(normalized) + for target in sorted(next_reasons): + if target not in normalized: + continue + index = bisect_left(roots, target) + if index == len(roots) or roots[index] != target or index == 0: + continue + owner = roots[index - 1] + hard_cap = roots[index + 1] if index + 1 < len(roots) else hi + owner_walk = _walk_overlay_function( + data, load_addr, size, owner, hard_cap, producer_ranges, + allow_cross_producer_calls) + if target in owner_walk['visited']: + normalized.remove(target) + roots.pop(index) + + if normalized == known and next_reasons == derived_reasons: + all_branch_targets = round_branch_targets + break + known = normalized + derived_reasons = next_reasons + + if not kernel_window: + break + + # Orphan promotion (see DISPATCH_ROOT in INCLUDE_REASONS): a kernel + # dispatch interior that no rooted walk covers is promoted to a + # trusted walk root. Re-enter the walk loop — the new root's walk + # may cover other interiors or discover direct-jal callees. + covered = set() + sorted_known = sorted(known) + for i, entry in enumerate(sorted_known): + hard_cap = sorted_known[i + 1] if i + 1 < len(sorted_known) else hi + walk = _walk_overlay_function( + data, load_addr, size, entry, hard_cap, producer_ranges, + allow_cross_producer_calls) + covered |= walk['visited'] + promoted = sorted(a for a, r in included.items() + if r == 'DISPATCH_INTERIOR' and a not in covered + and _is_valid_mips_word(_word_at(data, load_addr, a))) + if not promoted: + break + # Promote ONE orphan per iteration (lowest address first): its walk + # usually covers the remaining orphans, which then stay interiors and + # alias into the new root as host — rather than minting sibling roots + # that split one real function and hard-cap each other. + a = promoted[0] + included[a] = 'DISPATCH_ROOT' + promoted_roots.add(a) + known.add(a) + + # Re-walk with the final function set so the branch-target exclusion count + # matches the actual compilation boundaries. + all_branch_targets.clear() + rejected_cross_producer_calls = set() + accepted_cross_producer_calls = set() + final_covered = set() + sorted_known = sorted(known) + for i, entry in enumerate(sorted_known): + hard_cap = sorted_known[i + 1] if i + 1 < len(sorted_known) else hi + walk = _walk_overlay_function( + data, load_addr, size, entry, hard_cap, producer_ranges, + allow_cross_producer_calls) + all_branch_targets.update(walk['branch_targets']) + all_branch_targets.update(walk['jump_table_targets']) + all_branch_targets.update(walk['forward_branch_targets']) + final_covered.update(walk['visited']) + rejected_cross_producer_calls.update( + walk['rejected_cross_producer_calls']) + accepted_cross_producer_calls.update( + walk['accepted_cross_producer_calls']) + + # A DISPATCH_INTERIOR is emitted only when the final partition has a real + # CFG host for that exact PC. Reconsider every derived target after all + # later roots have settled; stale ownership falls back to a root (when it + # remains call-proven) or to the interpreter, never a hostless alias. + for addr, reason in sorted(derived_reasons.items()): + if addr in known: + include(addr, reason) + elif addr in final_covered: + included[addr] = 'DISPATCH_INTERIOR' + else: + included.pop(addr, None) + excluded[addr] = 'OBSERVED_PC_ONLY' + for addr, reason in list(included.items()): + if reason == 'DISPATCH_INTERIOR' and addr not in final_covered: + del included[addr] + excluded[addr] = ('OBSERVED_PC_ONLY' + if addr in executed_pcs else 'UNKNOWN') + + candidates = {a for a in (executed_pcs | dispatch_entry_pcs | + captured_function_entries | static_discovery_entries | + legacy_seeds | toml_entries) + if region(a)} + for addr in sorted(candidates - set(included)): + if addr in all_branch_targets or addr in jump_table_targets: + excluded[addr] = 'BRANCH_TARGET_ONLY' + elif addr in executed_pcs or addr in legacy_seeds: + excluded[addr] = 'OBSERVED_PC_ONLY' + else: + excluded[addr] = 'UNKNOWN' + + bad_included = [(a, r) for a, r in included.items() if r in FATAL_SEED_REASONS] + if bad_included: + details = ', '.join(f'0x{a:08X}:{r}' for a, r in bad_included) + raise RuntimeError(f'fatal seed classification: {details}') + + counts = Counter(included.values()) + excluded_counts = Counter(excluded.values()) + audit = { + 'load_addr': load_addr, + 'crc32': crc32, + 'lo': lo, + 'hi': hi, + 'executed_pcs': executed_pcs, + 'dispatch_entry_pcs': dispatch_entry_pcs, + 'static_dispatch_entry_pcs': static_dispatch_entries, + 'dispatch_fragment_demands': dispatch_fragment_demands, + 'function_entry_pcs': set(included), + 'included_reasons': included, + 'excluded_reasons': excluded, + 'branch_targets_excluded_count': len(all_branch_targets - set(included)), + 'counts': counts, + 'excluded_counts': excluded_counts, + 'producer_ranges': producer_ranges, + 'static_alias_ranges': static_alias_ranges, + # Every strong walk root is an exact-entry demand. These roots come from + # decoder/control-flow, callable-boundary, explicit TOML, or dispatch + # proof rather than an arbitrary observed PC. If a shared-region build + # (or a concurrent poorer winner) lacks its F entry, the post-pass can + # safely retry it in the isolated-fragment failure domain. + 'static_exact_fragment_demands': { + addr for addr, reason in included.items() + if reason in EXACT_FRAGMENT_REASONS + }, + # Only static control-flow/export evidence may nominate an address in a + # sibling byte recipe. The recipient still has to prove an existing + # CRC-valid host and the recompiler must prove a real block leader. + 'cross_variant_hosted_demands': { + addr for addr, reason in included.items() + if reason in CROSS_VARIANT_DONOR_REASONS + }, + # Alias recipes describe entry labels inside a normal-mode host. They + # need an isolated body only when the stricter shared analysis leaves + # the label outside every current code interval; aliases already inside + # a guarded body remain candidates for the future exact-resume pass. + 'static_interval_fragment_demands': { + entry for entry, _lo, _hi in static_alias_ranges + }, + 'rejected_cross_producer_calls': rejected_cross_producer_calls, + 'accepted_cross_producer_calls': accepted_cross_producer_calls, + 'static_jump_table_proofs': cap.get('static_jump_table_proofs', []), + 'static_call_continuation_pcs': _parse_addr_list( + cap.get('static_call_continuation_pcs', [])), + } + # Interior entries carry the 'interior' marker so the recompiler emits + # them as overlapping aliases, never as walk roots. Promoted kernel + # orphans carry 'dispatch_root' so the recompiler roots them without + # boundary re-verification. + seeds = [] + for range_lo, range_hi in producer_ranges: + seeds.append(f'producer_range 0x{range_lo:08X} 0x{range_hi:08X}') + for addr in sorted(accepted_cross_producer_calls): + seeds.append(f'cross_call_allow 0x{addr:08X}') + seeds.extend(seed_line_for_reason(addr, included[addr]) + for addr in sorted(included)) + return seeds, audit + + +def print_seed_audit(audit: dict) -> None: + print(f'Overlay {audit["load_addr"]:08X}_{audit["crc32"]:08X}') + print(f'Region: {audit["lo"]:08X}..{audit["hi"] - 1:08X}') + print(f'executed_pcs: {len(audit["executed_pcs"])}') + print(f'dispatch_entry_pcs: {len(audit["dispatch_entry_pcs"])}') + print(f'function_entry_pcs: {len(audit["function_entry_pcs"])}') + print(f'direct_jal_targets_included: {audit["counts"].get("DIRECT_JAL_TARGET", 0)}') + print(f'static_indirect_targets_included: {audit["counts"].get("STATIC_INDIRECT_TARGET", 0)}') + print(f'static_branch_roots_included: ' + f'{audit["counts"].get("STATIC_BRANCH_ROOT", 0)}') + print(f'static_discovery_roots_included: ' + f'{audit["counts"].get("STATIC_DISCOVERY_ROOT", 0)}') + print(f'function_pointer_targets_included: {audit["counts"].get("FUNCTION_POINTER_TARGET", 0)}') + print(f'toml_entries_included: {audit["counts"].get("TOML_DECLARED_ENTRY", 0)}') + print(f'dispatch_interior_included: {audit["counts"].get("DISPATCH_INTERIOR", 0)}') + print(f'dispatch_roots_promoted: {audit["counts"].get("DISPATCH_ROOT", 0)}') + unhosted_dispatch = (audit.get('dispatch_fragment_demands', set()) & + audit['executed_pcs']) - set(audit['included_reasons']) + print(f'unhosted_executed_dispatch_fragment_demands: {len(unhosted_dispatch)}') + print(f'cross_producer_calls_rejected: ' + f'{len(audit["rejected_cross_producer_calls"])}') + print(f'cross_producer_calls_accepted: ' + f'{len(audit["accepted_cross_producer_calls"])}') + print(f'branch_targets_excluded: {audit["branch_targets_excluded_count"]}') + print(f'observed_only_excluded: {audit["excluded_counts"].get("OBSERVED_PC_ONLY", 0)}') + print(f'unknown_excluded: {audit["excluded_counts"].get("UNKNOWN", 0)}') + for addr in sorted(audit['included_reasons']): + print(f' {addr:08X} {audit["included_reasons"][addr]}') + for addr in sorted(audit['excluded_reasons']): + reason = audit['excluded_reasons'][addr] + if reason in ('BRANCH_TARGET_ONLY', 'OBSERVED_PC_ONLY', 'UNKNOWN'): + recovery = ('; isolated fragment demand retained' + if addr in unhosted_dispatch else '') + print(f' {addr:08X} excluded: {reason}{recovery}') + + +def walk_root_seed_entries(seeds: list[str]) -> set[int]: + """Exact F entries demanded by recompiler walk-root seed records.""" + entries = set() + for seed in seeds: + parts = seed.split() + if not parts: + continue + if (parts[0] not in ('call_root', 'dispatch_root') and + not parts[0].startswith('0x')): + continue + try: + entries.add(_canonical_guest_addr(int(parts[-1], 16))) + except ValueError: + pass + return entries + + +def _game_text_range(toml_doc: dict) -> tuple[int, int]: + game = toml_doc.get('game', {}) + load = game.get('load_address') + size = game.get('text_size') + if load is None or size is None: + return (0, 0) + lo = _parse_addr(load) & 0x1FFFFFFF + hi = lo + _parse_addr(size) + return lo, hi + + +def _classify_target(addr: int, load_addr: int, size: int, + game_text: tuple[int, int]) -> str: + phys = addr & 0x1FFFFFFF + ov_lo = load_addr & 0x1FFFFFFF + ov_hi = ov_lo + size + if ov_lo <= phys < ov_hi: + return 'INSIDE_OVERLAY' + game_lo, game_hi = game_text + if game_hi > game_lo and game_lo <= phys < game_hi: + return 'MAIN_EXE' + if 0x1FC00000 <= phys < 0x1FC80000 or 0xBFC00000 <= addr < 0xBFC80000: + return 'BIOS' + return 'UNKNOWN_BAD' + + +def audit_generated_c(src: str, load_addr: int, size: int, + crc32: int, toml_doc: dict) -> dict: + defs = {int(x, 16) for x in re.findall( + r'^void func_([0-9A-Fa-f]{8})\(CPUState\* cpu\)$', src, re.MULTILINE)} + decls = {int(x, 16) for x in re.findall( + r'^void func_([0-9A-Fa-f]{8})\(CPUState\* cpu\);$', src, re.MULTILINE)} + direct_calls = [int(x, 16) for x in re.findall( + r'\bfunc_([0-9A-Fa-f]{8})\(cpu\)', src)] + literal_cba = [int(x, 16) for x in re.findall( + r'\bcall_by_address\(cpu,\s*0x([0-9A-Fa-f]{8})u?\)', src)] + unsupported_todo_addrs = {int(x, 16) for x in re.findall( + r'TODO:[^\n]*?0x([0-9A-Fa-f]{8}):', src)} + + game_text = _game_text_range(toml_doc) + ov_lo = load_addr & 0x1FFFFFFF + ov_hi = ov_lo + size + + def in_overlay(addr: int) -> bool: + phys = addr & 0x1FFFFFFF + return ov_lo <= phys < ov_hi + + unknown_bad = set() + missing_direct = set() + direct_outside = set() + for addr in direct_calls: + if not in_overlay(addr): + direct_outside.add(addr) + unknown_bad.add(addr) + elif addr not in defs: + missing_direct.add(addr) + unknown_bad.add(addr) + + cba_classes = Counter() + for addr in literal_cba: + cls = _classify_target(addr, load_addr, size, game_text) + cba_classes[cls] += 1 + if cls == 'UNKNOWN_BAD': + unknown_bad.add(addr) + + decl_without_def = {a for a in decls if in_overlay(a) and a not in defs} + called_decl_without_def = decl_without_def & set(direct_calls) + if called_decl_without_def: + unknown_bad.update(called_decl_without_def) + + report = { + 'defs': defs, + 'decls': decls, + 'direct_calls': direct_calls, + 'literal_cba': literal_cba, + 'direct_inside': sum(1 for a in direct_calls if in_overlay(a)), + 'external_cba': sum(1 for a in literal_cba if not in_overlay(a)), + 'bios_calls': cba_classes.get('BIOS', 0), + 'syscall_uses': len(re.findall(r'\bpsx_syscall\s*\(', src)), + 'unknown_dispatch_uses': len(re.findall(r'\bpsx_unknown_dispatch\s*\(', src)), + 'unsupported_todo_addrs': unsupported_todo_addrs, + 'unknown_bad': unknown_bad, + 'direct_outside': direct_outside, + 'missing_direct': missing_direct, + 'decl_without_def': decl_without_def, + 'called_decl_without_def': called_decl_without_def, + 'cba_classes': cba_classes, + } + return report + + +def print_generated_c_audit(load_addr: int, size: int, crc32: int, + report: dict) -> None: + print(f'Overlay {load_addr:08X}_{crc32:08X}') + print(f'Region: {load_addr:08X}..{load_addr + size - 1:08X}') + print(f'Function definitions: {len(report["defs"])}') + print(f'Forward declarations: {len(report["decls"])}') + print(f'Direct calls inside overlay: {report["direct_inside"]}') + print(f'External calls via call_by_address: {report["external_cba"]}') + print(f'BIOS calls: {report["bios_calls"]}') + print(f'Syscall uses: {report["syscall_uses"]}') + print(f'Unsupported instruction TODOs: {len(report["unsupported_todo_addrs"])}') + print(f'Unknown/bad targets: {len(report["unknown_bad"])}') + for addr in sorted(report['unknown_bad']): + print(f' 0x{addr:08X} UNKNOWN_BAD') + for addr in sorted(report['unsupported_todo_addrs'])[:20]: + print(f' 0x{addr:08X} UNSUPPORTED_INSTRUCTION') + if len(report['unsupported_todo_addrs']) > 20: + print(f' ... {len(report["unsupported_todo_addrs"]) - 20} more unsupported instructions') + + +# --------------------------------------------------------------------------- +# Post-process generated C for DLL compilation +# --------------------------------------------------------------------------- + +# The overlay dispatch shim / link contract is the SINGLE SOURCE OF TRUTH for +# the symbols every compiled shard links against (dispatch forwarders, GTE/WS +# hooks, cycle callbacks). It lives beside the ABI header it must agree with, +# at /overlay_dispatch_preamble.c.inc, so cmake can fold its +# content into the overlay cache tag (codegen_hash_sources.cmake) -- a change to +# the link contract then auto-invalidates the cache instead of silently +# breaking every shard compile against a moved-on runtime. Loaded once by +# load_dispatch_preamble(); patch_generated_c() reads this global. +DISPATCH_PREAMBLE = None +PREAMBLE_INC_NAME = "overlay_dispatch_preamble.c.inc" + + +def load_dispatch_preamble(runtime_include: str) -> str: + """Load the shard dispatch-shim preamble from / and + cache it in the module global. Missing is a HARD error: a shard built + without the shim links against nothing, and silently skipping it is exactly + the invisible-failure class this tooling exists to eliminate.""" + global DISPATCH_PREAMBLE + if DISPATCH_PREAMBLE is not None: + return DISPATCH_PREAMBLE + path = os.path.join(runtime_include, PREAMBLE_INC_NAME) + try: + with open(path, encoding="utf-8") as f: + DISPATCH_PREAMBLE = f.read() + except OSError as e: + raise SystemExit( + f"FATAL: cannot read overlay dispatch preamble {path}: {e}\n" + f" This file is the shard link contract and MUST ship in " + f"runtime/include. Without it no shard can be compiled.") + return DISPATCH_PREAMBLE + +def patch_generated_c(src: str, load_addr: int, size: int) -> str: + """ + Post-process psxrecomp-game's _full.c output for standalone DLL compilation: + + 1. Prepend the dispatch function-pointer preamble (before any includes). + 2. Remove forward declarations for functions outside the overlay range — + they'd be unresolved externals in the DLL. + 3. Replace direct calls to out-of-range func_XXXXXXXX(cpu) with + call_by_address(cpu, 0xXXXXXXXXu) so they go through the dispatch ptr. + 4. Export all func_XXXXXXXX symbols so the runtime can enumerate them. + """ + ov_lo = load_addr & 0x1FFFFFFF + ov_hi = ov_lo + size + + def in_overlay(addr: int) -> bool: + phys = addr & 0x1FFFFFFF + return ov_lo <= phys < ov_hi + + # 1. Insert preamble AFTER the last #include line (so CPUState is complete) + last_inc = -1 + for m in re.finditer(r'^#include\s+[<"].*[>"]\s*$', src, re.MULTILINE): + last_inc = m.end() + if last_inc == -1: + src = DISPATCH_PREAMBLE + src + else: + src = src[:last_inc] + '\n' + DISPATCH_PREAMBLE + src[last_inc:] + + # 2. Remove out-of-range forward declarations + def drop_extern(m): + addr = int(m.group(1), 16) + return '' if not in_overlay(addr) else m.group(0) + src = re.sub(r'^void func_([0-9A-Fa-f]{8})\(CPUState\* cpu\);\n', + drop_extern, src, flags=re.MULTILINE) + + # 3. Replace out-of-range direct calls with call_by_address + def fix_call(m): + addr = int(m.group(1), 16) + if in_overlay(addr): + return m.group(0) + return f'call_by_address(cpu, 0x{addr:08X}u)' + src = re.sub(r'\bfunc_([0-9A-Fa-f]{8})\(cpu\)', + fix_call, src) + + # 4. Add dllexport to every in-overlay func_XXXXXXXX definition. + # psxrecomp-game emits "void func_XXXXXXXX(CPUState* cpu)" on one line + # with "{" on the NEXT line — match the signature line alone (no ";" = definition). + def add_export(m): + addr = int(m.group(1), 16) + if not in_overlay(addr): + return m.group(0) + return ( + '#ifdef _WIN32\n__declspec(dllexport)\n#else\n' + '__attribute__((visibility("default")))\n#endif\n' + + m.group(0) + ) + src = re.sub(r'^void func_([0-9A-Fa-f]{8})\(CPUState\* cpu\)$', + add_export, src, flags=re.MULTILINE) + + return src + + +# --------------------------------------------------------------------------- +# Static (B-2) post-processing +# --------------------------------------------------------------------------- + +STATIC_PREAMBLE = """\ +/* ---- Static overlay (B-2): psx_runtime.h already provides call_by_address. */ + +""" + +def patch_generated_c_static(src: str, load_addr: int, size: int) -> tuple: + """ + Post-process psxrecomp-game's _full.c output for static binary compilation. + + Returns (patched_src, sorted_list_of_in_overlay_virt_addrs). + + Differences from DLL path: + - No overlay_api.h / OverlayCallbacks / overlay_init + - Callbacks are direct extern calls, not function pointers + - No __declspec(dllexport) — all functions have normal external linkage + - Returns function address list so caller can build the switch dispatch + """ + ov_lo = load_addr & 0x1FFFFFFF + ov_hi = ov_lo + size + + def in_overlay(addr: int) -> bool: + return ov_lo <= (addr & 0x1FFFFFFF) < ov_hi + + # 1. Insert preamble after last #include + last_inc = -1 + for m in re.finditer(r'^#include\s+[<"].*[>"]\s*$', src, re.MULTILINE): + last_inc = m.end() + if last_inc == -1: + src = STATIC_PREAMBLE + src + else: + src = src[:last_inc] + '\n' + STATIC_PREAMBLE + src[last_inc:] + + # 2. Remove out-of-range forward declarations + def drop_extern(m): + addr = int(m.group(1), 16) + return '' if not in_overlay(addr) else m.group(0) + src = re.sub(r'^void func_([0-9A-Fa-f]{8})\(CPUState\* cpu\);\n', + drop_extern, src, flags=re.MULTILINE) + + # 3. Replace out-of-range direct calls with call_by_address + def fix_call(m): + addr = int(m.group(1), 16) + if in_overlay(addr): + return m.group(0) + return f'call_by_address(cpu, 0x{addr:08X}u)' + src = re.sub(r'\bfunc_([0-9A-Fa-f]{8})\(cpu\)', fix_call, src) + + # 4. Collect in-overlay function definition addresses (no export annotation + # needed), spelled in the image's segment (§5.7). + func_virt_addrs = [] + image_seg = segment_of(load_addr) + def collect_fn(m): + addr = int(m.group(1), 16) + if in_overlay(addr): + func_virt_addrs.append(image_seg | (addr & PHYS_MASK)) + return m.group(0) + src = re.sub(r'^void func_([0-9A-Fa-f]{8})\(CPUState\* cpu\)$', + collect_fn, src, flags=re.MULTILINE) + + return src, sorted(func_virt_addrs) + + +def namespace_generated_static(src: str, namespace: str, + func_virt_addrs: list) -> tuple: + """Give one generated overlay image private C symbols. + + Static mode combines several independently-generated C files into one + translation unit. The recompiler deliberately gives each file the same + helper names, and different overlay images may define functions at the same + guest address. Namespace the four common helpers, every in-image function, + and every alias-body helper. Return the guest-entry -> C-symbol map used by + the content-validated dispatcher. + """ + func_set = set(func_virt_addrs) + + for helper in ('psx_lwl', 'psx_lwr', 'psx_swl', 'psx_swr'): + src = re.sub(rf'\b{helper}\b', f'{namespace}_{helper}', src) + + def rename_func(m): + addr = _canonical_guest_addr(int(m.group(1), 16)) + if addr not in func_set: + return m.group(0) + return f'{namespace}_func_{addr:08X}' + + src = re.sub(r'\bfunc_([0-9A-Fa-f]{8})\b', rename_func, src) + + def rename_alias(m): + addr = _canonical_guest_addr(int(m.group(1), 16)) + if addr not in func_set: + return m.group(0) + return f'{namespace}_alias_body_{addr:08X}' + + src = re.sub(r'\bpsx_alias_body_([0-9A-Fa-f]{8})\b', rename_alias, src) + symbols = {va: f'{namespace}_func_{va:08X}' for va in func_set} + return src, symbols + + +def parse_cps_continuation_owners(src: str) -> dict: + """Return compiled block entry -> owning function for generated CPS C. + + Runtime captures can prove a block label as a dispatch entry even when an + earlier capture never needed that label in the host's ``cpu->pc`` resume + switch. Static mode can add the missing switch arm and synthesize a wrapper + as long as the host's exact compiled code ranges match live RAM. + """ + definition_re = re.compile( + r'^void func_([0-9A-Fa-f]{8})\(CPUState\* cpu\)\n\{', + re.MULTILINE) + definitions = list(definition_re.finditer(src)) + owners = {} + for index, match in enumerate(definitions): + host = _canonical_guest_addr(int(match.group(1), 16)) + end = definitions[index + 1].start() if index + 1 < len(definitions) else len(src) + body = src[match.end():end] + for block in re.finditer(r'^block_([0-9A-Fa-f]{8}):', body, + re.MULTILINE): + entry = _canonical_guest_addr(int(block.group(1), 16)) + owners.setdefault(entry, host) + return owners + + +def add_cps_resume_case(src: str, host_symbol: str, + host: int, entry: int) -> tuple: + """Make ``entry`` a legal ``cpu->pc`` resume point in one native host.""" + definition = re.search( + rf'^void {re.escape(host_symbol)}\(CPUState\* cpu\)\n\{{', + src, re.MULTILINE) + if not definition: + return src, False + next_definition = re.search(r'^void [A-Za-z_][A-Za-z0-9_]*\(CPUState\* cpu\)', + src[definition.end():], re.MULTILINE) + end = (definition.end() + next_definition.start() + if next_definition else len(src)) + segment = src[definition.start():end] + if not re.search(rf'^block_{entry:08X}:', segment, re.MULTILINE): + return src, False + if f'case 0x{entry:08X}u: goto block_{entry:08X};' in segment: + return src, True + + hook = segment.find('debug_server_log_call_entry') + prologue = segment[:hook] if hook >= 0 else '' + default_match = re.search(r'^\s+default:', prologue, re.MULTILINE) + if 'if (cpu->pc != 0u)' in prologue and default_match: + insert = definition.start() + default_match.start() + indent = re.match(r'\s*', prologue[default_match.start():]).group(0) + arm = f'{indent}case 0x{entry:08X}u: goto block_{entry:08X};\n' + return src[:insert] + arm + src[insert:], True + + prologue_text = ( + '\n if (cpu->pc != 0u) {\n' + ' uint32_t _cont = cpu->pc; cpu->pc = 0;\n' + ' switch (_cont) {\n' + f' case 0x{entry:08X}u: goto block_{entry:08X};\n' + f' case 0x{host:08X}u: break; /* entry at prologue */\n' + f' default: cpu->pc = _cont; psx_native_bad_entry(cpu, ' + f'0x{host:08X}u, _cont); return;\n' + ' }\n' + ' }') + return src[:definition.end()] + prologue_text + src[definition.end():], True + + +_CPS_SIGNATURE_RE = re.compile(r'^void ([A-Za-z_][A-Za-z0-9_]*)\(CPUState\* cpu\)', + re.MULTILINE) + + +def add_cps_resume_cases(src: str, requests: list) -> tuple: + """Batch form of add_cps_resume_case(). + + requests: [(host_symbol, host, [entry, ...]), ...]. Returns + (src, {host_symbol: set(entries made legal)}). + + Per entry this applies exactly the rule add_cps_resume_case() applies -- + the block label must exist in the host's own segment, an existing arm is + left alone, otherwise the arm goes before the resume switch's ``default:`` + (or a fresh switch is created after the opening brace). The difference is + cost: the per-entry function re-scans and rebuilds the WHOLE part source + (tens of MB) for every entry, which made the post-pass quadratic -- 7,386 + wrappers on a 19 MB part took ~7 minutes. Here every function signature is + located once, each host's segment is edited in isolation, and the source + is rebuilt once. Output is byte-identical to the per-entry form. + """ + sigs = list(_CPS_SIGNATURE_RE.finditer(src)) + def_index = {} + for i, m in enumerate(sigs): + # A definition is the signature followed by "\n{"; the first one wins, + # like re.search() did. + if src.startswith('\n{', m.end()) and m.group(1) not in def_index: + def_index[m.group(1)] = i + edits = [] + ok_by_symbol = {} + for host_symbol, host, entries in requests: + i = def_index.get(host_symbol) + if i is None: + continue + m = sigs[i] + start = m.start() + def_len = (m.end() + 2) - start # through the opening brace + end = sigs[i + 1].start() if i + 1 < len(sigs) else len(src) + seg = src[start:end] + labels = set(re.findall(r'^block_[0-9A-Fa-f]{8}:', seg, re.MULTILINE)) + ok = set() + changed = False + for entry in entries: + if f'block_{entry:08X}:' not in labels: + continue + if f'case 0x{entry:08X}u: goto block_{entry:08X};' in seg: + ok.add(entry) + continue + hook = seg.find('debug_server_log_call_entry') + prologue = seg[:hook] if hook >= 0 else '' + default_match = re.search(r'^\s+default:', prologue, re.MULTILINE) + if 'if (cpu->pc != 0u)' in prologue and default_match: + insert = default_match.start() + indent = re.match(r'\s*', prologue[default_match.start():]).group(0) + arm = f'{indent}case 0x{entry:08X}u: goto block_{entry:08X};\n' + seg = seg[:insert] + arm + seg[insert:] + else: + prologue_text = ( + '\n if (cpu->pc != 0u) {\n' + ' uint32_t _cont = cpu->pc; cpu->pc = 0;\n' + ' switch (_cont) {\n' + f' case 0x{entry:08X}u: goto block_{entry:08X};\n' + f' case 0x{host:08X}u: break; /* entry at prologue */\n' + f' default: cpu->pc = _cont; psx_native_bad_entry(cpu, ' + f'0x{host:08X}u, _cont); return;\n' + ' }\n' + ' }') + seg = seg[:def_len] + prologue_text + seg[def_len:] + ok.add(entry) + changed = True + ok_by_symbol[host_symbol] = ok + if changed: + edits.append((start, end, seg)) + if edits: + edits.sort() + pieces = [] + pos = 0 + for start, end, seg in edits: + pieces.append(src[pos:start]) + pieces.append(seg) + pos = end + pieces.append(src[pos:]) + src = ''.join(pieces) + return src, ok_by_symbol + + +def generate_overlay_dispatch(variants: list) -> str: + """Generate byte-validated dispatch for all static overlay variants.""" + unique = [] + seen = set() + for variant in variants: + # The lookup keys on the exact PC, and each body is compiled for the + # segment of its PC (§5.7): a KUSEG, KSEG0 or KSEG1 entry of the same + # bytes is its own row. PC 0 is the hash table's empty marker. + if (segment_of(variant['addr']) not in SEGMENT_NAMES or + variant['addr'] == 0): + raise ValueError(f"static overlay entry 0x{variant['addr']:08X} " + "is not a KUSEG, KSEG0 or KSEG1 code PC") + ranges = tuple((lo & 0x1FFFFFFF, length) + for lo, length in variant['ranges']) + key = (variant['addr'], variant['crc'], ranges) + if key in seen: + continue + seen.add(key) + item = dict(variant) + item['ranges'] = ranges + unique.append(item) + + unique.sort(key=lambda v: (v['addr'], v['crc'], v['ranges'], v['symbol'])) + by_addr = {} + for index, variant in enumerate(unique): + variant['range_symbol'] = f'psx_ov_static_ranges_{index:05d}' + by_addr.setdefault(variant['addr'], []).append(variant) + + lines = [ + '', + '/* Auto-generated, content-validated overlay dispatch -- do not edit. */', + 'extern int psx_overlay_static_code_matches(const uint32_t *lo_len_pairs,', + ' uint32_t count,', + ' uint32_t expected_crc);', + 'static uint64_t psx_ov_static_checks = 0;', + 'static uint64_t psx_ov_static_hits = 0;', + 'static uint64_t psx_ov_static_variant_misses = 0;', + 'static uint64_t psx_ov_static_address_misses = 0;', + '', + ] + for variant in unique: + flat = [] + for lo, length in variant['ranges']: + flat.extend((f'0x{lo:08X}u', f'0x{length:X}u')) + lines.append( + f'static const uint32_t {variant["range_symbol"]}[] = ' + '{ ' + ', '.join(flat) + ' };') + + # ---- O(1) address lookup ------------------------------------------------ + # The dispatcher is consulted on EVERY interpreted entry, and the + # overwhelming majority of those calls are for addresses with no compiled + # entry at all. Measured on BoF3 during a battle-transition stall: + # ~264,000 calls/sec, of which ~1,160 out of every 1,161 found nothing. + # A `switch` over tens of thousands of sparse cases compiles to a binary + # search tree, so each of those fruitless calls walked ~log2(N) compares + # through a jump table far larger than cache -- which is why frame rate + # tracked compiled-case COUNT rather than variant chain depth, and why + # adding bands cost frame rate on screens where no overlay code ran. + # + # Replace it with a compile-time open-addressed hash table. The miss path + # -- the hot one -- becomes: hash, one load, compare, return. Two parallel + # uint32 arrays keep a miss inside a single 128 KB table: the address array + # answers "is this mine?" without touching the entry or variant arrays at + # all. Load factor is held at <= 0.5 to bound probe length. + entry_addrs = sorted(by_addr) + n_entries = len(entry_addrs) + + def hash_slot(key: int, mask: int) -> int: + """MUST stay bit-identical to psx_ov_hash_slot() emitted below.""" + h = (key >> 2) & 0xFFFFFFFF + h = (h * 0x9E3779B1) & 0xFFFFFFFF + h ^= h >> 15 + return h & mask + + bits = 4 + while (1 << bits) < max(n_entries, 1) * 2: + bits += 1 + size = 1 << bits + mask = size - 1 + + table_addr = [0] * size + table_idx = [0] * size + max_probe = 0 + for index, addr in enumerate(entry_addrs): + slot = hash_slot(addr, mask) + probe = 0 + while table_addr[slot] != 0: + assert table_addr[slot] != addr, f'duplicate entry 0x{addr:08X}' + slot = (slot + 1) & mask + probe += 1 + table_addr[slot] = addr + table_idx[slot] = index + max_probe = max(max_probe, probe) + + # Flat variant array; each entry owns a contiguous run of it. + flat_variants = [] + entry_rows = [] + for addr in entry_addrs: + entry_rows.append((addr, len(flat_variants), len(by_addr[addr]))) + flat_variants.extend(by_addr[addr]) + + def emit_table(name, values, per_line=8): + out = [f'static const uint32_t {name}[{size}] = {{'] + for i in range(0, size, per_line): + chunk = ', '.join(f'0x{v:08X}u' for v in values[i:i + per_line]) + out.append(f' {chunk},') + out.append('};') + return out + + lines += [ + '', + 'typedef void (*PsxOvFn)(CPUState *cpu);', + '', + 'typedef struct {', + ' const uint32_t *ranges;', + ' uint32_t count;', + ' uint32_t crc;', + ' PsxOvFn fn;', + '} PsxOvVariant;', + '', + 'typedef struct {', + ' uint32_t addr;', + ' uint32_t first; /* index into psx_ov_variants */', + ' uint32_t n; /* occupants compiled at this address */', + '} PsxOvEntry;', + '', + ] + + if flat_variants: + lines.append(f'static const PsxOvVariant ' + f'psx_ov_variants[{len(flat_variants)}] = {{') + for variant in flat_variants: + lines.append( + f' {{ {variant["range_symbol"]}, ' + f'{len(variant["ranges"])}u, 0x{variant["crc"]:08X}u, ' + f'{variant["symbol"]} }},') + lines.append('};') + lines.append('') + lines.append(f'static const PsxOvEntry psx_ov_entries[{n_entries}] = {{') + for addr, first, count in entry_rows: + lines.append(f' {{ 0x{addr:08X}u, {first}u, {count}u }},') + lines.append('};') + lines.append('') + lines += emit_table('psx_ov_hash_addr', table_addr) + lines.append('') + lines += emit_table('psx_ov_hash_idx', table_idx) + lines.append('') + # Resident-occupant memo. On hardware the game CD-reads a file to a + # fixed address and jal's straight into it -- identity is implicit in + # control flow and costs nothing. We rediscover it by walking a band's + # occupants and CRC-gating each. On a deep band that walk dominated: + # the memory-card screen measured 41.25 checks per hit, i.e. ~41 failed + # gates before the resident one, 4.4 M failed checks per 2 s. + # + # Remember which occupant last satisfied each address and try it first. + # Correctness is unchanged because the memo only reorders candidates -- + # every call still passes psx_overlay_static_code_matches(), so a band + # that swapped occupants fails the memo and falls into the full walk. + # The memo is a hint, never an authority. + lines.append(f'static uint16_t psx_ov_last_hit[{n_entries}];') + # Per-entry hit counters answer "did THIS image's variant run?" (for + # example a mod engine in a RAM mirror versus a menu overlay) through + # overlay_static_entries, where the global psx_ov_static_hits cannot. + lines.append(f'static uint64_t psx_ov_entry_hits[{n_entries}];') + lines.append('') + + present = sorted({segment_of(v['addr']) for v in unique} or {KSEG0}) + if present == [KSEG0]: + segment_gate = [ + ' /* Entries are the KSEG0 PCs their bodies were compiled for', + ' * (PSX_OVERLAY_CODE_SEGMENT, overlay_loader.h). A KUSEG or KSEG1', + ' * alias of the same bytes is a different architectural PC and', + ' * stays in the interpreter. */', + ' if ((addr & 0xE0000000u) != 0x80000000u) {', + ] + else: + segment_gate = [ + ' /* Entries are the exact PCs their bodies were compiled for, in', + ' * their own segment (docs/SEGMENT_AWARE_CODE.md §5.7). A PC in a', + ' * segment no body was compiled for stays in the interpreter. */', + ' if (' + ' &&\n '.join( + f'(addr & 0xE0000000u) != 0x{seg:08X}u' for seg in present) + ') {', + ] + lines += [ + f'/* {n_entries} dispatch addresses, {len(flat_variants)} variants, ' + f'{size}-slot table (load {n_entries / size:.2f}), ' + f'max probe {max_probe}. */', + f'#define PSX_OV_HASH_MASK 0x{mask:X}u', + '', + 'static inline uint32_t psx_ov_hash_slot(uint32_t key) {', + ' uint32_t h = key >> 2; /* entries are word-aligned */', + ' h *= 0x9E3779B1u;', + ' h ^= h >> 15;', + ' return h & PSX_OV_HASH_MASK;', + '}', + '', + 'void psx_overlay_static_get_stats(uint64_t *checks, uint64_t *hits,', + ' uint64_t *variant_misses,', + ' uint64_t *address_misses) {', + ' if (checks) *checks = psx_ov_static_checks;', + ' if (hits) *hits = psx_ov_static_hits;', + ' if (variant_misses) *variant_misses = psx_ov_static_variant_misses;', + ' if (address_misses) *address_misses = psx_ov_static_address_misses;', + '}', + '', + '/* Entry index of the last successful find (single-threaded dispatch). */', + 'static uint32_t psx_ov_found_entry = 0;', + '', + 'static const PsxOvVariant *psx_overlay_static_find_variant(uint32_t addr) {', + ] + segment_gate + [ + ' psx_ov_static_address_misses++;', + ' return 0;', + ' }', + ' const uint32_t key = addr;', + ] + + if not flat_variants: + lines += [ + ' (void)key;', + ' (void)psx_ov_found_entry;', + ' psx_ov_static_address_misses++;', + ' return 0;', + '}', + '', + 'int psx_overlay_static_can_dispatch(uint32_t addr) {', + ' return psx_overlay_static_find_variant(addr) != 0;', + '}', + '', + 'int psx_overlay_dispatch(CPUState *cpu, uint32_t addr) {', + ' (void)cpu;', + ' if (psx_overlay_static_find_variant(addr) == 0) return 0;', + ' return 0;', + '}', + '', + 'uint32_t psx_overlay_static_entry_count(void) { return 0u; }', + '', + 'int psx_overlay_static_entry_stats(uint32_t index, uint32_t *addr,', + ' uint32_t *variants, uint64_t *hits) {', + ' (void)index; (void)addr; (void)variants; (void)hits;', + ' return 0;', + '}', + '', + ] + return '\n'.join(lines) + + lines += [ + ' uint32_t slot = psx_ov_hash_slot(key);', + ' for (;;) {', + ' uint32_t slot_addr = psx_ov_hash_addr[slot];', + ' if (slot_addr == 0u) {', + ' /* Empty slot: this address is compiled nowhere. This is', + ' * the overwhelmingly common case -- keep it one load. */', + ' psx_ov_static_address_misses++;', + ' return 0;', + ' }', + ' if (slot_addr == key) break;', + ' slot = (slot + 1u) & PSX_OV_HASH_MASK;', + ' }', + ' {', + ' const uint32_t ei = psx_ov_hash_idx[slot];', + ' const PsxOvEntry *e = &psx_ov_entries[ei];', + ' const PsxOvVariant *base = &psx_ov_variants[e->first];', + ' const uint32_t n = e->n;', + ' uint32_t memo = psx_ov_last_hit[ei];', + ' uint32_t i;', + ' if (memo >= n) memo = 0u;', + ' /* Try the occupant that satisfied this address last time. On a', + ' * deep band this is the difference between one CRC gate and', + ' * walking every occupant. It is only a hint: the gate below', + ' * still decides, so a swapped band simply falls through. */', + ' if (n > 1u) {', + ' const PsxOvVariant *v = base + memo;', + ' psx_ov_static_checks++;', + ' if (psx_overlay_static_code_matches(v->ranges, v->count,', + ' v->crc)) {', + ' psx_ov_found_entry = ei;', + ' return v;', + ' }', + ' psx_ov_static_variant_misses++;', + ' }', + ' for (i = 0; i < n; i++) {', + ' const PsxOvVariant *v = base + i;', + ' if (n > 1u && i == memo) continue; /* already tried */', + ' psx_ov_static_checks++;', + ' if (psx_overlay_static_code_matches(v->ranges, v->count,', + ' v->crc)) {', + ' psx_ov_last_hit[ei] = (uint16_t)i;', + ' psx_ov_found_entry = ei;', + ' return v;', + ' }', + ' psx_ov_static_variant_misses++;', + ' }', + ' }', + ' /* Address is ours but no occupant is resident -> interpreter. */', + ' return 0;', + '}', + '', + 'int psx_overlay_static_can_dispatch(uint32_t addr) {', + ' return psx_overlay_static_find_variant(addr) != 0;', + '}', + '', + 'int psx_overlay_dispatch(CPUState *cpu, uint32_t addr) {', + ' const PsxOvVariant *v = psx_overlay_static_find_variant(addr);', + ' if (!v) return 0;', + ' psx_ov_static_hits++;', + ' psx_ov_entry_hits[psx_ov_found_entry]++;', + ' v->fn(cpu);', + ' return 1;', + '}', + '', + f'uint32_t psx_overlay_static_entry_count(void) {{ return {n_entries}u; }}', + '', + '/* Entry `index` (sorted by address): its address, occupant count and', + ' * dispatches served. 0 past the last entry. */', + 'int psx_overlay_static_entry_stats(uint32_t index, uint32_t *addr,', + ' uint32_t *variants, uint64_t *hits) {', + f' if (index >= {n_entries}u) return 0;', + ' if (addr) *addr = psx_ov_entries[index].addr;', + ' if (variants) *variants = psx_ov_entries[index].n;', + ' if (hits) *hits = psx_ov_entry_hits[index];', + ' return 1;', + '}', + '', + ] + return '\n'.join(lines) + + +# --------------------------------------------------------------------------- +# DLL compilation +# --------------------------------------------------------------------------- + +def parse_overlay_func_ids(src_path: str, data: bytes, load_addr: int, + size: int) -> list: + """Parse the recompiler's _full.ranges manifest and return the list of + in-overlay function identities as (ev, code_crc, ranges) tuples, where + ev = virtual entry, code_crc = AUTHORITATIVE hash of the captured code-range + bytes (the exact bytes the recompiler compiled from), and ranges is the + coalesced [(lo, len), ...] code-range list. + + This (entry, code_crc) pair is the per-function IDENTITY: the loader marks a + compiled entry callable iff live RAM matches code_crc, and overlay-cache v2 + keys build/dedup decisions on this set rather than on the whole-region CRC. + + binascii.crc32 (zlib, poly 0xEDB88320, init/final 0xFFFFFFFF) is bit-identical + to the runtime's crc32_compute, and `data` is the raw little-endian RAM image, + so the offline hash matches the runtime's hash of live RAM byte-for-byte.""" + ov_lo = load_addr & 0x1FFFFFFF + ov_hi = ov_lo + size + + def in_ov(a: int) -> bool: + return ov_lo <= (a & 0x1FFFFFFF) < ov_hi + + # Parse the recompiler manifest into [(entry, [(lo, len), ...]), ...]. + funcs: list[tuple[int, list[tuple[int, int]]]] = [] + cur = None + with open(src_path) as f: + for line in f: + s = line.split() + if not s: + continue + if s[0] == 'F': + try: + addr = int(s[1], 16) + except (IndexError, ValueError): + cur = None + continue + if in_ov(addr): + cur = (addr, []) + funcs.append(cur) + else: + cur = None + elif s[0] == 'R' and cur is not None: + try: + lo, length = int(s[1], 16), int(s[2], 16) + except (IndexError, ValueError): + continue + cur[1].append((lo, length)) + + out = [] + for entry, ranges in funcs: + if not ranges: + continue + crc = 0 + ok = True + for lo, length in ranges: + off = (lo & 0x1FFFFFFF) - ov_lo + if off < 0 or off + length > len(data): + ok = False # range outside captured bytes — can't hash reliably + break + crc = binascii.crc32(data[off:off + length], crc) + if not ok: + continue + # The entry VA in the image's segment (§5.1, §5.7). + ev = (entry & PHYS_MASK) | segment_of(load_addr) + out.append((ev, crc & 0xFFFFFFFF, ranges)) + + return out + + +def _mips_control_kind(instr: int) -> int: + """1=supported delayed transfer, 0=ordinary, -1=reserved/unsupported.""" + op = (instr >> 26) & 0x3F + if op == 0: + return int((instr & 0x3F) in (0x08, 0x09)) # JR/JALR + if op == 0x01: + return 1 if ((instr >> 16) & 0x1F) in (0x00, 0x01, 0x10, 0x11) else -1 + if op in (0x02, 0x03) or 0x04 <= op <= 0x07: + return 1 + if 0x14 <= op <= 0x17: + return -1 + if 0x10 <= op <= 0x13 and ((instr >> 21) & 0x1F) == 0x08: + return -1 + return 0 + + +def audit_func_id_delay_slots(func_ids: list, data: bytes, + load_addr: int) -> list: + """Return unsafe emitted dependency errors for exact function identities.""" + errors = [] + base = load_addr & 0x1FFFFFFF + seg = segment_of(load_addr) + for entry, _crc, ranges in func_ids: + if len(ranges) > 16: + errors.append((entry, None, + f'{len(ranges)} ranges exceed loader limit 16')) + continue + normalized = [] + malformed = False + for lo, length in ranges: + phys = lo & 0x1FFFFFFF + off = phys - base + if (phys & 3) or (length & 3) or length < 4 or \ + off < 0 or off + length > len(data): + errors.append((entry, phys | seg, + 'malformed/out-of-capture code range')) + malformed = True + break + normalized.append((phys, phys + length)) + if malformed: + continue + + def contains_word(addr: int) -> bool: + return any(lo <= addr and addr + 4 <= hi + for lo, hi in normalized) + + controls = set() + for lo, hi in normalized: + for pc in range(lo, hi, 4): + off = pc - base + instr = int.from_bytes(data[off:off + 4], 'little') + kind = _mips_control_kind(instr) + if kind < 0: + errors.append((entry, pc | seg, + 'reserved/unsupported branch encoding')) + elif kind > 0: + controls.add(pc) + if not contains_word(pc + 4): + errors.append((entry, pc | seg, + f'delay slot 0x{(pc + 4) | seg:08X} ' + 'is not identity-hashed')) + delay_pcs = {pc + 4 for pc in controls} + nested = sorted(controls & delay_pcs) + for pc in nested: + errors.append((entry, pc | seg, + 'control transfer in a delay slot')) + return errors + + +def overlay_ranges_text(func_ids: list, pair_id: int | None = None, + provenance: str | None = None) -> str: + """Serialize one loader manifest. + + ``P`` is an optional DLL/manifest publication identity. Old runtimes + ignore the unfamiliar record, while pair-aware runtimes require a matching + ``overlay_pair_id`` export whenever it is present. + """ + if provenance is not None and provenance not in \ + NON_AUTHORITY_MANIFEST_PROVENANCES: + raise ValueError(f'unsupported overlay manifest provenance: {provenance}') + out_lines = ['# psxrecomp overlay code-range manifest v2 (entry+code_crc)\n'] + if provenance is not None: + out_lines.append(f'# psxrecomp overlay provenance {provenance}\n') + # F entries are full VAs in the shard's segment (§5.7). A KUSEG or KSEG1 + # shard says so with S before its first F; a KSEG0 manifest keeps the + # pre-§5.7 text exactly (no S means KSEG0). + segments = {segment_of(ev) for ev, _crc, _ranges in func_ids} + if len(segments) > 1: + raise ValueError('one manifest names entries in several segments: ' + + ', '.join(f'0x{seg:08X}' for seg in sorted(segments))) + seg = segments.pop() if segments else KSEG0 + if seg not in SEGMENT_NAMES: + raise ValueError(f'manifest entries in segment 0x{seg:08X}, ' + 'which maps no RAM') + if seg != KSEG0: + out_lines.append(f'S {seg:08X}\n') + if pair_id is not None: + out_lines.append(f'P {pair_id & 0xFFFFFFFFFFFFFFFF:016X}\n') + for ev, crc, ranges in func_ids: + out_lines.append(f'F {ev:08X} {crc & 0xFFFFFFFF:08X}\n') + for lo, length in ranges: + # Byte extents, KSEG0-spelled in every segment's manifest. + out_lines.append( + f'R {(lo & PHYS_MASK) | KSEG0:08X} {length:X}\n') + return ''.join(out_lines) + + +def overlay_pair_id(src: str, func_ids: list, + provenance: str | None = None) -> int: + """Bind a newly compiled DLL to the exact C and range manifest it uses.""" + digest = hashlib.sha256() + digest.update(b'psxrecomp overlay pair v1\0') + digest.update(src.encode('utf-8')) + digest.update(b'\0') + digest.update(overlay_ranges_text( + func_ids, provenance=provenance).encode('ascii')) + return int.from_bytes(digest.digest()[:8], 'big') + + +def add_overlay_pair_export(src: str, pair_id: int) -> str: + """Add the optional v2-pair binding export without changing the shard ABI.""" + return src + f'''\n +PSX_OVERLAY_EXPORT uint64_t overlay_pair_id(void) {{ + return UINT64_C(0x{pair_id:016X}); +}} +''' + + +def write_overlay_ranges_from(func_ids: list, out_path: str, + pair_id: int | None = None, + provenance: str | None = None) -> int: + """Write the {phys}_{key}.ranges manifest (v2) from a func-id list produced by + parse_overlay_func_ids. Returns the number of functions written. + + Manifest v2 line format: + F one per function + R one per coalesced code range""" + with open(out_path, 'w') as f: + f.write(overlay_ranges_text(func_ids, pair_id, provenance)) + return len(func_ids) + + +def write_overlay_ranges(src_path: str, out_path: str, + data: bytes, load_addr: int, size: int) -> int: + """Back-compat wrapper: parse the recompiler manifest and write the v2 .ranges. + See parse_overlay_func_ids / write_overlay_ranges_from.""" + return write_overlay_ranges_from( + parse_overlay_func_ids(src_path, data, load_addr, size), out_path) + + +def load_region_coverage(cache_dir: str, phys_addr: int, + expected_abi: int | None = None) -> set: + """Set of (ev, code_crc) function identities already provided by built DLLs + for this region_start. The loader content-matches per function across ALL + DLLs sharing a region_start, so a function is "covered" as soon as ANY + existing .ranges for that region_start lists it with a matching code_crc. + overlay-cache v2 uses this to skip the (expensive) gcc compile when a capture + would add no new function identity (the volatile-data redundant-build case).""" + covered = set() + prefix = f'{phys_addr:08X}_' + try: + names = os.listdir(cache_dir) + except OSError: + return covered + for name in names: + if not (name.startswith(prefix) and name.endswith('.ranges')): + continue + dll_path = os.path.join( + cache_dir, os.path.splitext(name)[0] + overlay_ext()) + covered.update( + (entry, code_crc) + for entry, code_crc, _ranges in load_shard_func_ids( + dll_path, expected_abi)) + return covered + + +def _addr_in_func_ids(addr: int, func_ids: list) -> bool: + """True if addr falls inside any code range of the given func-id list.""" + a = addr & 0x1FFFFFFF + for _ev, _crc, ranges in func_ids: + for lo, length in ranges: + lo &= 0x1FFFFFFF + if lo <= a < lo + length: + return True + return False + + +def load_region_entry_set(cache_dir: str, phys_addr: int, + expected_abi: int | None = None) -> set: + """Set of phys-normalized F-line ENTRY addresses provided by ALL built DLLs + (region + fragment) for this region_start. This — not range coverage — is + the dispatchability test: native code is enterable ONLY at F entries, so a + dispatch-proven PC inside a compiled range but absent from every manifest's + F set still runs its whole chain on the interpreter (the 0x80106D7C class, + 2026-07-06: 80% of Tomba2 attract interp residue was two range-covered, + entry-less interior PCs that the range-based orphan test refused to + fragment, while the region compile skipped as 'already covered').""" + return { + entry & 0x1FFFFFFF + for entry, _crc in load_region_coverage( + cache_dir, phys_addr, expected_abi) + } + + +def parse_runtime_shard_manifest(manifest: str, + require_pair: bool = True, + expected_segment: int | None = None + ) -> tuple[int | None, list]: + """Parse only identities representable by the runtime manifest contract. + + F entries are full VAs in the manifest's segment: ``S `` before + the first F, KSEG0 when absent (§5.7). ``expected_segment`` is the segment + of the directory the shard lives in; the runtime refuses a manifest that + names another, and so does this.""" + def hex_field(token: str, max_digits: int) -> int: + if not re.fullmatch(rf'[0-9A-Fa-f]{{1,{max_digits}}}', token): + raise ValueError(f'invalid manifest hex field: {token!r}') + return int(token, 16) + + pair_ids = [] + funcs = [] + current = None + segment = None + if '\0' in manifest: + return None, [] + # Runtime reads physical records with fgets(), so only LF terminates a + # record. A trailing CR in CRLF is ordinary whitespace; a bare CR between + # directives is not a second record and must therefore fail identically. + for line in manifest.split('\n'): + if len(line) > MANIFEST_PHYSICAL_LINE_MAX: + return None, [] + cr = line.find('\r') + record_width = len(line) if cr < 0 else cr + if record_width > MANIFEST_LINE_MAX: + return None, [] + stripped = line.strip(MANIFEST_ASCII_WHITESPACE) + parts = (re.split(r'[ \t\r\v\f]+', stripped) + if stripped else []) + if not parts: + continue + if parts[0] == 'S': + if len(parts) != 2 or segment is not None or funcs: + return None, [] + try: + segment = hex_field(parts[1], 8) + except ValueError: + return None, [] + if segment not in SEGMENT_NAMES: + return None, [] + elif parts[0] == 'P': + if len(parts) != 2: + return None, [] + try: + pair_ids.append(hex_field(parts[1], 16)) + except ValueError: + return None, [] + elif parts[0] == 'F': + if len(parts) != 3: + return None, [] + try: + current = [hex_field(parts[1], 8), hex_field(parts[2], 8), []] + except ValueError: + return None, [] + if segment_of(current[0]) != (KSEG0 if segment is None else segment): + return None, [] + funcs.append(current) + elif parts[0] == 'R' and current is not None: + if len(parts) != 3: + return None, [] + try: + current[2].append((hex_field(parts[1], 8), + hex_field(parts[2], 8))) + except ValueError: + return None, [] + if len(pair_ids) > 1 or (require_pair and len(pair_ids) != 1) or not funcs: + return None, [] + if (expected_segment is not None and + (KSEG0 if segment is None else segment) != expected_segment): + return None, [] + entries = [entry & 0x1FFFFFFF for entry, _crc, _ranges in funcs] + if len(set(entries)) != len(entries): + return None, [] + for entry, _crc, ranges in funcs: + entry_phys = entry & 0x1FFFFFFF + if (not 1 <= len(ranges) <= 16 or + any(length <= 0 for _start, length in ranges) or + any((start & 0x1FFFFFFF) >= PSX_RAM_SIZE or + length > PSX_RAM_SIZE - (start & 0x1FFFFFFF) + for start, length in ranges) or + not any((start & 0x1FFFFFFF) <= entry_phys < + (start & 0x1FFFFFFF) + length + for start, length in ranges)): + return None, [] + return (pair_ids[0] if pair_ids else None, + [tuple(func) for func in funcs]) + + +def load_shard_func_ids(dll_path: str, + expected_abi: int | None = None, + include_supplemental: bool = True) -> list: + """Read one runtime-valid shard manifest as ``(entry, crc, ranges)``. + + A nonempty DLL and manifest are not enough: the pair-aware runtime rejects + a manifest whose ``P`` identity does not match the DLL export. Discovery + must apply the same validity rule before allowing a cached shard to + suppress a needed fragment. + """ + ranges_path = os.path.splitext(dll_path)[0] + '.ranges' + try: + with _shard_pair_lock(dll_path): + _recover_shard_pair_locked(dll_path) + if (not os.path.isfile(dll_path) or + os.path.getsize(dll_path) == 0 or + not os.path.isfile(ranges_path) or + os.path.getsize(ranges_path) == 0): + return [] + with open(ranges_path, encoding='ascii', newline='') as f: + manifest = f.read() + if (not include_supplemental and + manifest_declares_supplemental_provenance(manifest)): + return [] + pair_id, valid_funcs = parse_runtime_shard_manifest( + manifest, require_pair=False, + expected_segment=cache_dir_segment(os.path.dirname(dll_path))) + if (not valid_funcs or not _dll_runtime_exports_match( + dll_path, expected_abi, pair_id, + {entry for entry, _crc, _ranges in valid_funcs})): + return [] + except (OSError, UnicodeError): + return [] + return valid_funcs + + +def load_shard_entry_set(dll_path: str, + expected_abi: int | None = None) -> set: + """Phys-normalized F entries from one runtime-valid shard pair.""" + return { + entry & 0x1FFFFFFF + for entry, _crc, _ranges in load_shard_func_ids(dll_path, expected_abi) + } + + +def load_shard_code_ranges(dll_path: str, + expected_abi: int | None = None) -> list: + """Phys-normalized guarded R intervals from one runtime-valid shard pair.""" + return [ + (start & 0x1FFFFFFF, (start & 0x1FFFFFFF) + length) + for _entry, _crc, ranges in load_shard_func_ids(dll_path, expected_abi) + for start, length in ranges if length > 0 + ] + + +def load_region_current_variant_coverage(cache_dir: str, phys_addr: int, + data: bytes, load_addr: int, + size: int, + expected_abi: int | None = None + ) -> tuple[set, list]: + """Return exact entries/ranges whose manifest CRC matches ``data``. + + Shards for different byte variants share a region-start namespace. An F + entry from another variant cannot satisfy the current capture: the runtime + will reject it by code CRC. Recompute each cached function identity over + the current bytes and expose only identities the runtime can actually call. + """ + entries = set() + ranges_out = [] + prefix = f'{phys_addr:08X}_' + try: + names = os.listdir(cache_dir) + except OSError: + return entries, ranges_out + for name in names: + if not (name.startswith(prefix) and name.endswith('.ranges')): + continue + dll_path = os.path.join( + cache_dir, os.path.splitext(name)[0] + overlay_ext()) + shard_entries, shard_ranges = current_variant_func_id_coverage( + load_shard_func_ids(dll_path, expected_abi), data, load_addr, size) + entries.update(shard_entries) + ranges_out.extend(shard_ranges) + return entries, ranges_out + + +def current_variant_func_ids(func_ids: list, data: bytes, + load_addr: int, size: int) -> list: + """Retain complete identities whose guarded bytes match this image.""" + valid_ids = [] + ov_lo = load_addr & 0x1FFFFFFF + ov_hi = ov_lo + size + for entry, expected_crc, ranges in func_ids: + crc = 0 + valid = True + for start, length in ranges: + lo = start & 0x1FFFFFFF + if length <= 0 or lo < ov_lo or lo + length > ov_hi: + valid = False + break + crc = binascii.crc32(data[lo - ov_lo:lo - ov_lo + length], crc) + if valid and (crc & 0xFFFFFFFF) == (expected_crc & 0xFFFFFFFF): + candidate = [(entry, expected_crc, ranges)] + if not audit_func_id_delay_slots(candidate, data, load_addr): + valid_ids.append((entry, expected_crc, ranges)) + return valid_ids + + +def load_region_current_variant_func_ids(cache_dir: str, phys_addr: int, + data: bytes, load_addr: int, + size: int, + expected_abi: int | None = None, + include_supplemental: bool = True + ) -> list: + """Complete runtime-valid identities matching one captured byte recipe.""" + out = [] + prefix = f'{phys_addr:08X}_' + try: + names = os.listdir(cache_dir) + except OSError: + return out + for name in names: + if not (name.startswith(prefix) and name.endswith('.ranges')): + continue + dll_path = os.path.join( + cache_dir, os.path.splitext(name)[0] + overlay_ext()) + out.extend(current_variant_func_ids( + load_shard_func_ids( + dll_path, expected_abi, + include_supplemental=include_supplemental), + data, load_addr, size)) + return out + + +def current_variant_func_id_coverage(func_ids: list, data: bytes, + load_addr: int, + size: int) -> tuple[set, list]: + """Filter parsed identities to those callable for these captured bytes.""" + entries = set() + ranges_out = [] + for entry, _expected_crc, ranges in current_variant_func_ids( + func_ids, data, load_addr, size): + entries.add(entry & 0x1FFFFFFF) + ranges_out.extend( + ((start & 0x1FFFFFFF), (start & 0x1FFFFFFF) + length) + for start, length in ranges) + return entries, ranges_out + + +# --------------------------------------------------------------------------- +# Doomed-interior fail memo +# --------------------------------------------------------------------------- +# An executed orphan interior whose bytes (in THIS captured image) are data, not +# code, fails the generated-C audit EVERY time — but the fragment pass re-attempts +# it on every autocompile cycle, making the recompiler walk thousands of words of +# data and emit tens of thousands of lines of C only to reject it (measured on +# Vigilante 8: 91 interiors, ~16k walked words each, per cycle). The memo records +# which (region_phys, interior_pc, region_crc) fragments have already failed so +# later cycles SKIP them instead of re-walking. Correctness is preserved: +# - The key includes region_crc, so a DIFFERENT captured variant (different +# bytes at the same PC) is NOT memoized — it re-attempts and can succeed. +# - The memo file lives inside the cg_ cache dir, so ANY codegen/ +# contract/header change (which bumps the hash -> fresh dir -> fresh memo) +# re-attempts everything (e.g. the psx_rfe_mark_escape contract fix). +# So a memoized skip only ever elides a build that is deterministically doomed. +# Printed when a capture contributes no walk-root seed. The wording is +# deliberate: the region is NOT declared data-only -- its executed dispatch +# demands are still served by the isolated-fragment pass, which runs +# separately. Named so the two emit sites and the test cannot drift apart. +# They did: 4683e923 reworded both prints and left +# test_compile_overlays_static_split asserting the old string. +NO_SHARED_WALK_ROOT_SEEDS_SKIP = ( + 'SKIP: no shared walk-root seeds; checking fragments separately') + +INTERIOR_FAIL_MEMO = 'interior_fail_memo.txt' + + +def _interior_fail_key(phys_addr: int, interior: int, data: bytes, + load_addr: int, size: int, producer_ranges, + cross_call_allow, expected_abi: int, cps: bool, + toml_doc: dict, guard_bytes: int = 0) -> str: + """Stable identity of every input to deterministic fragment generation.""" + recipe = { + # v3 adds guard_bytes: the analysis bound is an input to generation, so + # a memo recorded under the old (guard-word-as-code) analysis must not + # suppress a retry under the corrected one. + 'schema': 'psxrecomp fragment fail key v3', + 'phys_addr': phys_addr, + 'interior': interior & 0x1FFFFFFF, + 'load_addr': load_addr, + 'size': size, + 'guard_bytes': guard_bytes, + 'data_sha256': hashlib.sha256(data).hexdigest(), + 'producer_ranges': [list(pair) for pair in producer_ranges], + 'cross_call_allow': sorted(set(cross_call_allow)), + 'overlay_abi': expected_abi, + 'cps': bool(cps), + 'toml': toml_doc, + } + digest = hashlib.sha256(json.dumps( + recipe, sort_keys=True, separators=(',', ':'), + default=str).encode('utf-8')).hexdigest()[:24] + return f'{phys_addr:08X}_{interior & 0x1FFFFFFF:08X}_{digest}' + + +def interior_failure_is_deterministic(reason: str) -> bool: + """Only guest-byte/codegen audit verdicts belong in the persistent memo.""" + return (reason.startswith(('generated-c-audit:', 'requested-entry-audit:', + 'guest-walk-audit:')) or + unsupported_guest_branch_rejection(reason)) + + +def unsupported_guest_branch_rejection(reason: str) -> bool: + """An invalid guest branch is data/unsupported code, not a tool failure. + + Other delay-slot identity failures remain fatal: missing guarded delay + words or a changed instruction identity can indicate an emitter defect. + """ + return (reason.startswith('delay-slot-identity:') and + reason.endswith(': reserved/unsupported branch encoding')) + + +def reconcile_empty_primary_scans(pending, cache_dir, expected_abi, stats): + """Accept an empty primary only if guarded fragments serve every root. + + Each capture view is checked against its own segment's shards (§5.7).""" + for label, physical, load, size, data, roots in pending: + seg = segment_of(load) + current, _ = load_region_current_variant_coverage( + segment_cache_dir(cache_dir, seg), physical, data, load, size, + expected_abi) + served = {(entry & PHYS_MASK) | seg for entry in current} + if roots and roots <= served: + print(f' primary scan recovered by guarded fragments: {label}') + stats.add_skip() + else: + stats.add_fail(label, 'no_ranges', + 'primary roots remain without guarded native coverage') + + +def optional_static_fragment_rejection(entry: int, job: dict, + reason: str) -> bool: + """Whether an unplayed speculative candidate failed safely. + + Publishing nothing is the correct outcome for a static-only candidate that + fails a deterministic byte/codegen audit. Execution evidence or an + explicit operator demand turns the same rejection into a real coverage + failure and therefore remains fatal. + """ + return (entry in job.get('static_demands', set()) and + entry not in job.get('executed', set()) and + entry not in job.get('forced', set()) and + interior_failure_is_deterministic(reason)) + + +def interior_fail_memo_action(entry: int, job: dict, force: bool) -> str: + """Choose ``retry``, ``fail``, or ``skip`` for a deterministic miss. + + Required executed/forced demands remain loud without repeating an + expensive deterministic data-as-code walk. ``--force`` explicitly retries + it; an unplayed speculative demand remains a safe skip. + """ + if force: + return 'retry' + if (entry in job.get('executed', set()) or + entry in job.get('forced', set())): + return 'fail' + return 'skip' + + +def load_interior_fail_memo(cache_dir: str) -> dict: + memo = {} + try: + with open(os.path.join(cache_dir, INTERIOR_FAIL_MEMO)) as f: + for ln in f: + ln = ln.strip() + if ln and not ln.startswith('#'): + key, _sep, reason = ln.partition('#') + memo[key.strip()] = (reason.strip() or + 'known deterministic failure') + except OSError: + pass + return memo + + +def append_interior_fail_memo(cache_dir: str, key: str, reason: str) -> None: + try: + os.makedirs(cache_dir, exist_ok=True) + with open(os.path.join(cache_dir, INTERIOR_FAIL_MEMO), 'a') as f: + f.write(f'{key} # {(reason or "").strip()[:120]}\n') + except OSError: + pass # best-effort; a memo write failure must never break the compile + + +def served_static_variant_keys(parts) -> set: + """(entry, image_crc) pairs the built static parts can dispatch. + + Coverage is per byte-variant: a part serves an address only for the image + it was compiled from, because the dispatcher's CRC gate rejects that + identity against any other resident bytes.""" + return {(variant['addr'], part['image_crc']) + for part in parts for variant in part['variants']} + + +def select_static_fragment_demands(requested_keys, parts) -> list: + """Requested (entry, image_crc) demands no built part serves, sorted. + + Keyed by (entry, image crc) and NEVER by the bare address. With address + keys, the first variant at an address -- from any capture of the band -- + marked that address served for every other capture, and the per-entry + source map kept only the last capture's bytes, so in a band with N + occupants exactly one occupant ever received isolated fragments + (BoF3 SCENARIO band, 2026-09-05: 20 sections, SCENA16 resident, all 53 of + its observed entries interpreted while every spanning piece had been + compiled from SCENA19/04/06 bytes and could never validate).""" + return sorted(set(requested_keys) - served_static_variant_keys(parts)) + + +_STATIC_IMAGE_SOURCES: dict = {} + + +def _init_static_fragment_worker(image_sources: dict) -> None: + """Pool initializer: the image table travels to each worker ONCE. + + A demand is (entry, image); thousands of demands share a few hundred + images, so pickling the bytes per job would move the whole capture set + through the pipe once per demand. Workers look images up by key.""" + global _STATIC_IMAGE_SOURCES + _STATIC_IMAGE_SOURCES = image_sources + + +def static_fragment_job(entry: int, image_key, args): + """Worker for the static isolated-fragment pass: one (entry, image). + + Module-level and self-contained so it runs in a ProcessPoolExecutor. + Returns (part or None, reason).""" + data, load_addr, size, phys_addr, guard_bytes = \ + _STATIC_IMAGE_SOURCES[image_key] + with image_segment(segment_of(load_addr)): + return generate_interior_fragment_static( + entry, data, load_addr, size, phys_addr, args, + guard_bytes=guard_bytes) + + +def generate_interior_fragment_static(interior: int, data: bytes, + load_addr: int, size: int, + phys_addr: int, args, *, + guard_bytes: int): + """Generate one isolated, exact-range-gated static interior shard. + + Returns (part, reason): part is None on failure and reason then says + why. Reasons starting with 'generated-c-audit:', 'requested-entry-audit:' + or 'guest-walk-audit:' are deterministic verdicts on these exact bytes + (the interior is data in this image) and are safe to memoize; anything + else (recompiler exit, missing output) is not.""" + with tempfile.TemporaryDirectory() as tmp: + psx = os.path.join(tmp, 'frag.psx') + with open(psx, 'wb') as f: + f.write(make_psxexe(load_addr, interior, data, + guard_bytes=guard_bytes)) + seeds_path = os.path.join(tmp, 'seeds.txt') + with open(seeds_path, 'w') as f: + f.write(f'dispatch_root 0x{interior:08X}\n') + out_dir_tmp = os.path.join(tmp, 'out') + os.makedirs(out_dir_tmp) + cmd = [args.recompiler, psx, '--seeds', seeds_path, + '--out-dir', out_dir_tmp, '--overlay', + '--ws-config', os.path.abspath(args.game_toml)] + cmd += recompiler_project_root_args(args) + sub_env = dict(os.environ) + if args.cps: + sub_env['PSX_CPS'] = '1' + result = subprocess.run( + cmd, capture_output=True, text=True, + cwd=os.path.dirname(os.path.abspath(args.game_toml)), env=sub_env) + if result.returncode != 0: + # A walk from this interior that runs off the image (a branch at + # the last word, its delay slot past the end) is the recompiler's + # own verdict that these bytes are not code from here: it throws + # rather than auditing. Deterministic for the image, so memoizable + # alongside the audit rejections. + text = (result.stderr or '') + (result.stdout or '') + walk = [ln.strip() for ln in text.splitlines() + if 'outside the input image' in ln or + 'cannot emit control flow' in ln] + if walk: + return None, 'guest-walk-audit: ' + walk[0][:160] + return None, f'recompiler: exit {result.returncode}' + + full_c = ranges_src = None + for filename in os.listdir(out_dir_tmp): + if filename.endswith('_full.c'): + full_c = os.path.join(out_dir_tmp, filename) + elif filename.endswith('_full.ranges'): + ranges_src = os.path.join(out_dir_tmp, filename) + if not full_c or not ranges_src: + return None, 'no-output: recompiler emitted no _full.c/_full.ranges' + + with open(full_c) as f: + src, func_addrs = patch_generated_c_static( + f.read(), load_addr, size) + image_crc = binascii.crc32(data) & 0xFFFFFFFF + audit = audit_generated_c(src, load_addr, size, image_crc, {}) + if audit['unknown_bad'] or audit['unsupported_todo_addrs']: + return None, (f'generated-c-audit: {len(audit["unknown_bad"])} ' + f'unknown_bad, ' + f'{len(audit["unsupported_todo_addrs"])} unsupported') + func_ids = parse_overlay_func_ids(ranges_src, data, load_addr, size) + ids_by_addr = {} + for ev, code_crc, ranges in func_ids: + ids_by_addr.setdefault(ev, []).append((code_crc, ranges)) + if set(func_addrs) - set(ids_by_addr): + return None, 'static-ranges: dispatchable function(s) lack exact ranges' + + entry = (interior & PHYS_MASK) | segment_of(load_addr) + if entry not in ids_by_addr or entry not in set(func_addrs): + return None, 'requested-entry-audit: fragment omitted its own entry' + namespace = (f'ov_frag_{phys_addr:08X}_{image_crc:08X}_' + f'{entry:08X}') + continuation_owners = parse_cps_continuation_owners(src) + src, symbols = namespace_generated_static(src, namespace, func_addrs) + variants = [] + for ev in sorted(func_addrs): + for code_crc, ranges in ids_by_addr[ev]: + variants.append({ + 'addr': ev, + 'symbol': symbols[ev], + 'crc': code_crc, + 'ranges': ranges, + }) + return { + 'src': src, + 'variants': variants, + 'namespace': namespace, + 'image_crc': image_crc, + 'func_addrs': set(func_addrs), + 'symbols': symbols, + 'ids_by_addr': ids_by_addr, + 'continuation_owners': continuation_owners, + }, 'ok' + + +def validate_overlay_func_ids(func_ids: list, + label: str = 'shard') -> str | None: + """Validate identities against the runtime's fixed manifest contract.""" + entries = [entry & 0x1FFFFFFF for entry, _crc, _ranges in func_ids] + if len(set(entries)) != len(entries): + return f'{label} contains duplicate function entries' + for entry, _crc, ranges in func_ids: + if not 1 <= len(ranges) <= 16: + return (f'{label} entry 0x{entry:08X} has {len(ranges)} ranges ' + '(runtime supports 1..16)') + if any(length <= 0 for _lo, length in ranges): + return f'{label} entry 0x{entry:08X} has an empty guarded range' + if not _addr_in_func_ids(entry, [(entry, 0, ranges)]): + return f'{label} entry 0x{entry:08X} is outside its guarded ranges' + return None + + +def validate_fragment_requested_ids(requested: set[int], frag_ids: list, + generated_defs: set[int]) -> str | None: + """Return a fail-closed reason when a fragment omitted a requested entry. + + A non-empty manifest is not sufficient: the recompiler can emit some other + reachable function while rejecting/demoting an exact requested PC. The + loader can also retain at most 16 ranges for one function. Refuse to + publish unless every requested entry has one unambiguous, runtime- + representable identity whose guarded bytes include the entry itself. + """ + for requested_entry in sorted(requested): + entry = _canonical_guest_addr(requested_entry) + if entry not in generated_defs: + return f'requested entry 0x{entry:08X} missing from generated C' + matches = [ + (ev, crc, ranges) for ev, crc, ranges in frag_ids if ev == entry + ] + if len(matches) != 1: + return (f'requested entry 0x{entry:08X} has {len(matches)} ' + 'manifest identities (expected exactly 1)') + contract_error = validate_overlay_func_ids(frag_ids, 'fragment') + if contract_error: + return contract_error + for requested_entry in sorted(requested): + entry = _canonical_guest_addr(requested_entry) + matches = [ + (ev, crc, ranges) for ev, crc, ranges in frag_ids if ev == entry + ] + if not _addr_in_func_ids(entry, matches): + return f'requested entry 0x{entry:08X} is outside its guarded ranges' + return None + + +def validate_interior_fragment_ids(interior: int, frag_ids: list, + generated_defs: set[int]) -> str | None: + """Compatibility wrapper for a singleton isolated fragment.""" + return validate_fragment_requested_ids( + {interior}, frag_ids, generated_defs) + + +def validate_hosted_fragment_ids(requested: set[int], host_specs: dict, + frag_ids: list, + generated_defs: set[int], + allow_missing_targets: bool = False + ) -> str | None: + """Require every emitted host/alias to equal its selected cached owner. + + The recompiler's host-range block boundary is only a syntactic landing-pad + check. Safety comes from this publication gate: the original host and + every added alias must reproduce the already runtime-validated owner CRC + and complete guarded-range geometry exactly. + """ + targets = {_canonical_guest_addr(entry) for entry in requested} + specs = { + _canonical_guest_addr(entry): spec + for entry, spec in host_specs.items() + } + if set(specs) != targets: + return 'hosted target/spec set mismatch' + expected_by_entry = {} + hosts = set() + for target, spec in sorted(specs.items()): + host = _canonical_guest_addr(spec['host']) + expected = _normalized_func_identity(spec['owner_identity']) + if expected[0] != host: + return f'hosted target 0x{target:08X} owner entry differs from host' + if target == host: + return f'hosted target 0x{target:08X} equals its host' + hosts.add(host) + prior = expected_by_entry.setdefault(host, expected[1:]) + if prior != expected[1:]: + return f'hosted host 0x{host:08X} has conflicting identities' + expected_by_entry[target] = expected[1:] + if targets & hosts: + return 'hosted target is also a host in the same shard' + required = targets | hosts + contract_error = validate_overlay_func_ids(frag_ids, 'hosted fragment') + if contract_error: + return contract_error + if len(frag_ids) > HOSTED_EMITTED_IDENTITY_CAP: + return (f'hosted shard emitted {len(frag_ids)} identities ' + f'(cap {HOSTED_EMITTED_IDENTITY_CAP})') + intervals = sorted( + (_canonical_guest_addr(start), + _canonical_guest_addr(start) + length) + for _entry, _crc, ranges in frag_ids + for start, length in ranges) + guarded_bytes = 0 + merged_end = None + for start, end in intervals: + if merged_end is None or start > merged_end: + guarded_bytes += end - start + merged_end = end + elif end > merged_end: + guarded_bytes += end - merged_end + merged_end = end + if guarded_bytes > HOSTED_UNIQUE_GUARDED_BYTE_CAP: + return (f'hosted shard guards {guarded_bytes} unique bytes ' + f'(cap {HOSTED_UNIQUE_GUARDED_BYTE_CAP})') + by_entry = {} + for func_id in frag_ids: + identity = _normalized_func_identity(func_id) + by_entry.setdefault(identity[0], []).append(identity) + for entry in sorted(required): + matches = by_entry.get(entry, []) + emitted = entry in generated_defs + if (allow_missing_targets and entry in targets and + not matches and not emitted): + continue + if not emitted: + return f'requested entry 0x{entry:08X} missing from generated C' + if len(matches) != 1: + return (f'hosted entry 0x{entry:08X} has {len(matches)} ' + 'normalized identities (expected exactly 1)') + if matches[0][1:] != expected_by_entry[entry]: + return (f'hosted entry 0x{entry:08X} changed selected owner ' + 'CRC/range identity') + return None + + +def hosted_fragment_served_targets(requested: set[int], frag_ids: list, + generated_defs: set[int]) -> set[int]: + """Targets actually emitted after the C++ block-leader proof.""" + manifest_entries = { + _canonical_guest_addr(entry) for entry, _crc, _ranges in frag_ids + } + return ({_canonical_guest_addr(entry) for entry in requested} & + manifest_entries & + {_canonical_guest_addr(entry) for entry in generated_defs}) + + +def make_interior_fragment_job(phys_addr: int, load_addr: int, size: int, + data: bytes, seed_audit: dict, + forced_interiors: set[int], + capture: dict | None = None) -> dict | None: + """Build one explicit fragment job without mutating the shared seed set.""" + interiors = { + a for a, reason in seed_audit['included_reasons'].items() + if reason == 'DISPATCH_INTERIOR' + } + dispatch_roots = { + a for a, reason in seed_audit['included_reasons'].items() + if reason in ('DISPATCH_ENTRY', 'STATIC_DISPATCH_ENTRY', + 'DISPATCH_ROOT') + } + executed = set(seed_audit.get('executed_pcs', set())) + # A final DISPATCH_INTERIOR needs a discovered host, but a guarded isolated + # fragment does not. Do not rebuild live demand solely from surviving + # shared seeds. Retain the existing execution gate: arbitrary seeds, + # static-only interiors, and merely observed instructions are not enough. + observed_dispatch = (set(seed_audit.get('dispatch_fragment_demands', set())) & + executed) + static_exact_demands = set( + seed_audit.get('static_exact_fragment_demands', set())) + hosted_donor_demands = set( + seed_audit.get('cross_variant_hosted_demands', set())) + static_interval_demands = set( + seed_audit.get('static_interval_fragment_demands', set())) + static_demands = static_exact_demands | static_interval_demands + region_hi = phys_addr + size + # --force-interior names a PC, so it forces the view of its own segment. + forced = { + a for a in forced_interiors + if phys_addr <= (a & 0x1FFFFFFF) < region_hi and + segment_of(a) == segment_of(load_addr) + } + if not (((interiors or dispatch_roots) and executed) or observed_dispatch or + static_demands or forced): + return None + return { + 'phys_addr': phys_addr, + 'load_addr': load_addr, + 'size': size, + 'data': data, + # Trailing delay-slot guard words in `data` (readable, not + # discoverable). Stated by the capture writer where the field exists, + # reconstructed from the page-run format otherwise. + 'guard_bytes': capture_guard_bytes( + capture, size, f'region 0x{load_addr:08X}'), + 'candidates': (interiors | dispatch_roots | observed_dispatch | + static_demands | forced), + 'executed': executed, + 'static_demands': static_demands, + 'static_exact_demands': static_exact_demands, + 'hosted_donor_demands': hosted_donor_demands, + 'included_reasons': { + addr: {reason} + for addr, reason in seed_audit['included_reasons'].items() + }, + 'static_interval_demands': static_interval_demands, + 'forced': forced, + 'producer_ranges': tuple(seed_audit['producer_ranges']), + 'cross_call_allow': tuple(seed_audit['accepted_cross_producer_calls']), + 'resident_cap': ({ + 'producer': BIOS_RESIDENT_PRODUCER, + 'bios_sha256': capture.get('bios_sha256', ''), + 'producer_name': capture.get('producer_name', 'BIOS resident code'), + } if capture and capture.get('producer') == BIOS_RESIDENT_PRODUCER + else None), + } + + +def merge_fragment_jobs_by_recipe(jobs: list[dict], + invocation_recipe=()) -> list[dict]: + """Union evidence that can safely share one byte-variant fragment recipe. + + Repeated captures of identical bytes commonly carry different observed or + static roots. Batching each capture independently would still create many + supplemental DLLs, so merge only jobs whose complete recompiler recipe is + identical. Invocation-wide ABI/flavor/CPS/TOML inputs are constant and are + therefore intentionally not repeated in this key. + """ + grouped = {} + set_fields = ( + 'candidates', 'executed', 'static_demands', + 'static_exact_demands', 'hosted_donor_demands', + 'static_interval_demands', 'forced', + ) + for job in jobs: + key = ( + job['phys_addr'], hashlib.sha256(job['data']).digest(), + job['load_addr'], job['size'], + tuple(sorted(job['producer_ranges'])), + tuple(sorted(set(job['cross_call_allow']))), + json.dumps(job.get('resident_cap'), sort_keys=True), + tuple(invocation_recipe), + ) + merged = grouped.get(key) + if merged is None: + merged = dict(job) + for field in set_fields: + merged[field] = set(job[field]) + merged['included_reasons'] = { + addr: set(reasons) + for addr, reasons in job.get('included_reasons', {}).items() + } + grouped[key] = merged + continue + for field in set_fields: + merged[field].update(job[field]) + for addr, reasons in job.get('included_reasons', {}).items(): + merged.setdefault('included_reasons', {}).setdefault( + addr, set()).update(reasons) + if merged.get('resident_cap') is None and job.get('resident_cap'): + merged['resident_cap'] = job['resident_cap'] + return [grouped[key] for key in sorted(grouped)] + + +def _normalized_func_identity(func_id) -> tuple: + entry, code_crc, ranges = func_id + return (_canonical_guest_addr(entry), code_crc & 0xFFFFFFFF, + tuple((_canonical_guest_addr(start), length) + for start, length in ranges)) + + +def _producer_for_job_addr(job: dict, addr: int): + """Return a stable producer token, treating a simple image as one producer.""" + phys = addr & 0x1FFFFFFF + ranges = job.get('producer_ranges', ()) + if not ranges: + lo = job['load_addr'] & 0x1FFFFFFF + hi = lo + job['size'] + return ('image', lo, hi) if lo <= phys < hi else None + for index, (start, end) in enumerate(ranges): + lo = start & 0x1FFFFFFF + hi = lo + (end - start) + if lo <= phys < hi: + return ('producer', index, lo, hi) + return None + + +def _preferred_host_reason(reasons) -> str | None: + """Choose one existing marker deterministically without widening trust.""" + priority = ( + 'DIRECT_JAL_TARGET', 'STATIC_INDIRECT_TARGET', + 'STATIC_BRANCH_ROOT', 'STATIC_DISCOVERY_ROOT', + 'STATIC_DISPATCH_ENTRY', 'DISPATCH_ENTRY', 'FUNCTION_POINTER_TARGET', + 'TOML_DECLARED_ENTRY', + ) + reason_set = set(reasons) & HOSTED_OWNER_REASONS + return next((reason for reason in priority if reason in reason_set), None) + + +def select_hosted_interior_demands(job: dict, donor_recipes: dict, + current_func_ids: list, + audit_out: dict | None = None) -> dict: + """Map sibling-proven targets to unique CRC-valid local host identities. + + This is deliberately fail-closed. Aliases and multi-range functions are + not eligible owners: an owner must have one exact range beginning at its F + entry, carry local root evidence, share the target's producer, and be the + sole distinct identity containing that target. + """ + donor_items = sorted(donor_recipes.items()) + nomination_dropped = max(0, len(donor_items) - HOSTED_NOMINATION_CAP) + donor_items = donor_items[:HOSTED_NOMINATION_CAP] + lo = job['load_addr'] & 0x1FFFFFFF + hi = lo + job['size'] + local_reasons = { + _canonical_guest_addr(addr): set(reasons) + for addr, reasons in job.get('included_reasons', {}).items() + } + identities = { + _normalized_func_identity(func_id) + for func_id in current_func_ids + } + rejected = Counter() + owner_intervals = [] + for identity in identities: + host, _crc, ranges = identity + reason = _preferred_host_reason(local_reasons.get(host, ())) + if reason is None: + rejected['owner_identity_no_local_root'] += 1 + continue + if len(ranges) != 1: + rejected['owner_identity_alias_or_multirange'] += 1 + continue + range_start, length = ranges[0] + if range_start != host or length <= 0: + rejected['owner_identity_not_rooted_range'] += 1 + continue + producer = _producer_for_job_addr(job, host) + if producer is None: + rejected['owner_identity_no_producer'] += 1 + continue + range_end = range_start + length + if (range_end & 0x1FFFFFFF) > producer[-1]: + rejected['owner_identity_crosses_producer_end'] += 1 + continue + owner_intervals.append( + (range_start, range_end, producer, identity, reason)) + owner_intervals.sort(key=lambda item: (item[0], item[1], item[3])) + + selected = {} + active_intervals = [] + next_interval = 0 + for raw_target, donors in donor_items: + target = _canonical_guest_addr(raw_target) + if not donors: + rejected['target_no_donor_recipe'] += 1 + continue + target_phys = target & 0x1FFFFFFF + if (target & 3) != 0 or not (lo <= target_phys < hi): + rejected['target_outside'] += 1 + continue + target_producer = _producer_for_job_addr(job, target) + if target_producer is None: + rejected['target_no_producer'] += 1 + continue + while (next_interval < len(owner_intervals) and + owner_intervals[next_interval][0] < target): + active_intervals.append(owner_intervals[next_interval]) + next_interval += 1 + active_intervals = [ + interval for interval in active_intervals + if interval[1] > target + ] + candidates = [ + (identity, reason) + for _start, _end, producer, identity, reason in active_intervals + if producer == target_producer + ] + # Multiple byte/geometry owners make runtime load order semantically + # relevant. Duplicate copies of the identical identity collapse in + # the set above; any remaining ambiguity is rejected. + if len(candidates) != 1: + rejected['target_no_unique_owner'] += 1 + continue + owner_identity, host_reason = candidates[0] + selected[target] = { + 'host': owner_identity[0], + 'owner_identity': owner_identity, + 'host_reason': host_reason, + } + bounded = {} + selected_hosts = set() + for target, spec in sorted(selected.items()): + host = _canonical_guest_addr(spec['host']) + if len(bounded) >= HOSTED_SELECTED_ALIAS_CAP: + rejected['selected_alias_cap_dropped'] += 1 + continue + if host not in selected_hosts and len( + selected_hosts) >= HOSTED_SELECTED_HOST_CAP: + rejected['selected_host_cap_dropped'] += 1 + continue + bounded[target] = spec + selected_hosts.add(host) + selected = bounded + if nomination_dropped: + rejected['nomination_cap_dropped'] += nomination_dropped + if audit_out is not None: + audit_out.clear() + audit_out.update(rejected) + audit_out['donor_targets'] = len(donor_recipes) + audit_out['current_identities'] = len(identities) + audit_out['selected'] = len(selected) + return selected + + +def organic_root_entries(func_ids) -> set[int]: + """Return entries whose identity is exactly one range rooted at entry. + + Hosted aliases reuse their owner's range, so their F entry must never gain + sibling-donor authority merely because the alias survived CRC validation. + Requiring the same geometry as hosted-owner selection also rejects a later + island in a multi-range identity from becoming a recursive donor. + """ + roots = set() + for func_id in func_ids: + entry, _crc, ranges = _normalized_func_identity(func_id) + if len(ranges) != 1: + continue + start, length = ranges[0] + if start == entry and length > 0: + roots.add(entry) + return roots + + +def recipient_sibling_proofs(donor_entries_by_recipe: dict[int, tuple], + recipient_index: int, + authority_phys_entries: set, + limit: int = HOSTED_NOMINATION_CAP + ) -> tuple[dict, bool]: + """Return the fixed first entries proven by another byte recipe. + + Each recipe's donor list is sorted once. A heap merge excludes the + recipient before applying the nomination limit. Authority coverage is also + removed before the cap because it is reconstructed deterministically on + every invocation. Supplemental coverage deliberately remains in the + returned window through *all* later selection caps (alias and host as well + as nomination); ``still_needed`` removes it only at compile time. Filtering + it here would let an unchanged rerun page into a host that was dropped by a + later cap. Duplicate addresses collapse. + """ + streams = [ + entries for index, entries in sorted(donor_entries_by_recipe.items()) + if index != recipient_index and entries + ] + if not streams or limit <= 0: + return {}, bool(streams) + nominated = [] + previous = None + have_previous = False + for entry in heapq.merge(*streams): + if have_previous and entry == previous: + continue + previous = entry + have_previous = True + if (entry & 0x1FFFFFFF) in authority_phys_entries: + continue + if len(nominated) >= limit: + return ({entry: True for entry in nominated}, True) + nominated.append(entry) + return ({entry: True for entry in nominated}, False) + + +def select_fragment_orphans(candidates: set[int], executed: set[int], + forced: set[int], static_exact: set[int], + static_interval: set[int], + current_variant_entries: set[int], + current_variant_ranges: list) -> list[int]: + """Select exact demands that the relevant current artifacts cannot serve.""" + def current_region_contains(addr): + phys = addr & 0x1FFFFFFF + return any(start <= phys < end for start, end in current_variant_ranges) + + return sorted( + addr for addr in candidates + # Every exact demand is byte-variant-specific. A same-address F from a + # different region variant cannot satisfy it because the runtime's CRC + # guard will reject that identity against the current bytes. + if (addr in forced or + (addr in static_exact and + (addr & 0x1FFFFFFF) not in current_variant_entries) or + (addr in static_interval and not current_region_contains(addr)) or + (addr in executed and + (addr & 0x1FFFFFFF) not in current_variant_entries))) + + +def select_batchable_strong_roots(static_exact: set[int], executed: set[int], + forced: set[int], static_interval: set[int], + current_variant_entries: set[int]) -> list[int]: + """Strong exact roots safe to share a supplemental failure domain.""" + batchable, _isolated = partition_strong_root_demands( + static_exact, executed, forced, static_interval, + current_variant_entries) + return batchable + + +def partition_strong_root_demands(static_exact: set[int], executed: set[int], + forced: set[int], static_interval: set[int], + current_variant_entries: set[int] + ) -> tuple[list[int], list[int]]: + """Partition every missing exact root without deferring live overlaps.""" + isolated = executed | forced | static_interval + missing = { + entry for entry in static_exact + if (entry & 0x1FFFFFFF) not in current_variant_entries + } + return (sorted(missing - isolated), sorted(missing & isolated)) + + +def compile_batched_fragment_roots(entries, compile_one, on_success, + on_singleton_failure, + still_needed=lambda _entry: True, + should_bisect=lambda _status: True, + on_batch_failure=None) -> int: + """Compile one root batch, bisecting only when the batch fails closed. + + ``compile_one`` returns the normal ``(func_ids, status)`` pair. Successful + batches stay grouped; a rejected interaction is recursively partitioned so + one bad root cannot discard good roots. Only singleton failures are exposed + to memo/accounting policy. + """ + roots = sorted(entry for entry in set(entries) if still_needed(entry)) + if not roots: + return 0 + frag_ids, status = compile_one(roots) + if frag_ids: + on_success(roots, frag_ids, status) + return 1 + if len(roots) == 1: + on_singleton_failure(roots[0], status) + return 0 + if not should_bisect(status): + if on_batch_failure is not None: + on_batch_failure(roots, status) + else: + for root in roots: + on_singleton_failure(root, status) + return 0 + middle = len(roots) // 2 + return (compile_batched_fragment_roots( + roots[:middle], compile_one, on_success, + on_singleton_failure, still_needed, should_bisect, + on_batch_failure) + + compile_batched_fragment_roots( + roots[middle:], compile_one, on_success, + on_singleton_failure, still_needed, should_bisect, + on_batch_failure)) + + +def compile_batched_hosted_aliases(hosted: dict, compile_one, on_success, + on_singleton_failure, + still_needed=lambda _entry: True, + should_bisect=lambda _status: True, + on_batch_failure=None, + attempt_cap=HOSTED_COMPILE_ATTEMPT_CAP, + stop_requested=lambda: False) -> int: + """Compile bounded host groups, splitting hosts before their targets. + + Multiple host roots can repartition one another. Exact identity validation + makes that interaction fail closed; host-group-first bisection then removes + the conflicting root without needlessly exploding every target belonging + to otherwise compatible hosts. + """ + by_host = {} + for raw_target, spec in sorted(hosted.items()): + target = _canonical_guest_addr(raw_target) + host = _canonical_guest_addr(spec['host']) + key = (host, _normalized_func_identity(spec['owner_identity']), + spec['host_reason']) + by_host.setdefault(key, []).append(target) + + # A group larger than the per-shard alias bound is split deterministically; + # each piece still carries exactly one owner identity. + groups = [] + for key, targets in sorted(by_host.items()): + unique_targets = sorted(set(targets)) + for offset in range(0, len(unique_targets), HOSTED_BATCH_ALIAS_CAP): + groups.append((key, unique_targets[ + offset:offset + HOSTED_BATCH_ALIAS_CAP])) + + chunks = [] + chunk = [] + alias_count = 0 + for group in groups: + group_aliases = len(group[1]) + if chunk and (len(chunk) >= HOSTED_BATCH_HOST_CAP or + alias_count + group_aliases > HOSTED_BATCH_ALIAS_CAP or + chunk[-1][0][0] == group[0][0]): + chunks.append(chunk) + chunk = [] + alias_count = 0 + chunk.append(group) + alias_count += group_aliases + if chunk: + chunks.append(chunk) + + attempts = 0 + + def run(group_batch): + nonlocal attempts + if stop_requested(): + return 0 + filtered = [] + for key, targets in group_batch: + needed = [entry for entry in targets if still_needed(entry)] + if needed: + filtered.append((key, needed)) + if not filtered: + return 0 + specs = {} + for (host, owner_identity, host_reason), targets in filtered: + for target in targets: + specs[target] = { + 'host': host, + 'owner_identity': owner_identity, + 'host_reason': host_reason, + } + entries = sorted(specs) + if attempts >= attempt_cap: + status = (f'hosted-entry-audit: compile attempt cap ' + f'{attempt_cap} reached') + if on_batch_failure is not None: + on_batch_failure(entries, status) + return 0 + attempts += 1 + frag_ids, status = compile_one(specs) + if frag_ids: + served = on_success(entries, frag_ids, status) + if served is None: + return 1 + served = ({_canonical_guest_addr(entry) for entry in served} & + set(entries)) + if not served: + status = ('hosted-entry-audit: successful batch reported no ' + 'requested targets') + if on_batch_failure is not None: + on_batch_failure(entries, status) + else: + for entry in entries: + on_singleton_failure(entry, status) + return 1 + missing_groups = [] + for key, targets in filtered: + missing = [entry for entry in targets if entry not in served] + if missing: + missing_groups.append((key, missing)) + if not missing_groups: + return 1 + # The recompiler may prove only a subset of a multi-target hosted + # request. Retry the deterministic remainder now; otherwise a later + # invocation would shrink the batch and accidentally page into new + # successes. Every successful retry removes at least one target and + # the global attempt cap still bounds adversarial inputs. + return 1 + run(missing_groups) + if len(filtered) > 1 and should_bisect(status): + middle = len(filtered) // 2 + return run(filtered[:middle]) + run(filtered[middle:]) + key, targets = filtered[0] + if len(targets) > 1 and should_bisect(status): + middle = len(targets) // 2 + return (run([(key, targets[:middle])]) + + run([(key, targets[middle:])])) + if len(targets) == 1: + on_singleton_failure(targets[0], status) + elif on_batch_failure is not None: + on_batch_failure(targets, status) + else: + for target in targets: + on_singleton_failure(target, status) + return 0 + + built = 0 + for chunk_groups in chunks: + if stop_requested(): + break + built += run(chunk_groups) + return built + + +def hosted_entries_still_missing(hosted: dict, current_phys_entries, + rejected_entries=()) -> list[int]: + """Return nominated aliases that still need capacity accounting.""" + covered = {int(entry) & 0x1FFFFFFF for entry in current_phys_entries} + rejected = {_canonical_guest_addr(entry) for entry in rejected_entries} + return sorted({ + _canonical_guest_addr(entry) + for entry in hosted + if ((int(entry) & 0x1FFFFFFF) not in covered and + _canonical_guest_addr(entry) not in rejected) + }) + + +def fragment_capacity_allows_entry(saturated: bool, repair_all: bool, + forced_entries, entry: int) -> bool: + """Whether capacity policy permits one fragment compile attempt. + + A saturated namespace cannot admit ordinary growth. ``--force`` still + has to reach the transactional publisher because replacing the same shard + can be capacity-neutral. ``--force-interior`` grants that exception only + to the explicitly named entry. + """ + return (not saturated or repair_all or + _canonical_guest_addr(entry) in { + _canonical_guest_addr(forced) + for forced in forced_entries + }) + + +def fragment_capacity_fastpath_eligible(saturated: bool, repair_all: bool, + jobs) -> bool: + """Whether an already-full invocation may bypass fragment owner analysis.""" + return (saturated and not repair_all and + not any(job.get('forced') for job in jobs)) + + +def fragment_batch_failure_is_partitionable(reason: str) -> bool: + """Whether retrying smaller root sets can change this failure verdict.""" + if reason.startswith('candidate-capacity: full'): + return False + if unsupported_guest_branch_rejection(reason): + return True + return reason.startswith(( + 'generated-c-audit:', 'requested-entry-audit:', + 'hosted-entry-audit:', + 'candidate-capacity:', + 'no-generated-output', 'no-func-ids', + 'fragment cache-key collision', + )) + + +def compile_fragment_batch(requested_entries, data: bytes, load_addr: int, + size: int, phys_addr: int, cache_dir: str, + args, sub_env: dict, toml_doc: dict, + producer_ranges=(), cross_call_allow=(), + hosted_owners: dict | None = None, + manifest_provenance: str | None = None, + *, guard_bytes: int): + """Compile an ISOLATED interior-entry 'island' fragment that ENTERS at an + executed orphan DISPATCH_INTERIOR PC (a host that static analysis never + discovered, e.g. an FMV driver reached via a computed jump) and covers the + recompiler's worklist-discovered reachable CFG from that PC — a single + `dispatch_root` seed; out-of-island branches become dispatcher exits. + + Emitted as its OWN _.dll so a fragment that fails the + generated-C audit is dropped ALONE and never poisons the region's trusted DLL + (separate failure domain — the invariant the earlier host-recovery attempt + violated). Safe because: dispatch_root is exempt from the boundary re-check + that would reject a mid-function start; the recompiler translates mid-function + code literally (regs from CPU state, no synthesized stack frame — the caller + already set up the frame); and the loader's per-function live-RAM CRC gate + rejects any fragment whose bytes don't match. Returns (frag_ids, status): + status 'built' or 'cached' on success (frag_ids is the func-id list), or + (None, reason) on failure/skip so the caller can tally WHY a fragment + dropped instead of the old silent None.""" + requested = sorted({ + (entry & PHYS_MASK) | segment_of(load_addr) + for entry in requested_entries + }) + if not requested: + return None, 'no-requested-entries' + if hosted_owners is not None: + hosted_specs = { + _canonical_guest_addr(entry): spec + for entry, spec in hosted_owners.items() + if _canonical_guest_addr(entry) in requested + } + if set(hosted_specs) != set(requested): + return None, 'hosted-entry-audit: target/spec set mismatch' + hosts = sorted({_canonical_guest_addr(spec['host']) + for spec in hosted_specs.values()}) + if set(hosts) & set(requested): + return None, 'hosted-entry-audit: target is also a host' + first_entry = hosts[0] + else: + hosted_specs = None + first_entry = requested[0] + with tempfile.TemporaryDirectory() as tmp: + psx = os.path.join(tmp, 'frag.psx') + with open(psx, 'wb') as f: + f.write(make_psxexe(load_addr, first_entry, data, + guard_bytes=guard_bytes)) + seeds_path = os.path.join(tmp, 'seeds.txt') + with open(seeds_path, 'w') as f: + for range_lo, range_hi in producer_ranges: + f.write(f'producer_range 0x{range_lo:08X} 0x{range_hi:08X}\n') + for target in sorted(set(cross_call_allow)): + f.write(f'cross_call_allow 0x{target:08X}\n') + if hosted_specs is None: + for entry in requested: + f.write(f'dispatch_root 0x{entry:08X}\n') + else: + host_markers = {} + for entry, spec in sorted(hosted_specs.items()): + host = _canonical_guest_addr(spec['host']) + marker = seed_line_for_reason(host, spec['host_reason']) + prior = host_markers.setdefault(host, marker) + if prior != marker: + return None, (f'hosted-entry-audit: host ' + f'0x{host:08X} has conflicting markers') + for host, marker in sorted(host_markers.items()): + f.write(marker + '\n') + for entry in requested: + host = _canonical_guest_addr(hosted_specs[entry]['host']) + f.write(f'hosted_interior 0x{entry:08X} ' + f'0x{host:08X}\n') + out_dir_tmp = os.path.join(tmp, 'out') + os.makedirs(out_dir_tmp) + cmd = [args.recompiler, psx, '--seeds', seeds_path, + '--out-dir', out_dir_tmp, '--overlay', + '--ws-config', os.path.abspath(args.game_toml)] + cmd += recompiler_project_root_args(args) + r = subprocess.run(cmd, capture_output=True, text=True, + cwd=os.path.dirname(os.path.abspath(args.game_toml)), + env=sub_env) + if r.returncode != 0: + return None, f'recompiler-error: {(r.stderr or r.stdout or "").strip()}' + full_c = ranges_src = None + for fn in os.listdir(out_dir_tmp): + if fn.endswith('_full.c'): + full_c = os.path.join(out_dir_tmp, fn) + elif fn.endswith('_full.ranges'): + ranges_src = os.path.join(out_dir_tmp, fn) + if not full_c or not ranges_src: + return None, 'no-generated-output (_full.c/_full.ranges missing)' + with open(full_c) as f: + src = patch_generated_c(f.read(), load_addr, size) + c_audit = audit_generated_c(src, load_addr, size, + binascii.crc32(data) & 0xFFFFFFFF, toml_doc) + if c_audit['unknown_bad'] or c_audit['unsupported_todo_addrs']: + # RETAIN the failed fragment's C for triage. Region shards already + # keep their _patched.c on audit failure; interior fragments used to + # return here BEFORE the (success-only) retain below, so the exact + # shards you most want to inspect — WHY did this orphan interior fail + # to lower — vanished with the temp dir. Write it out with a header + # summarizing the audit verdict so a failure is drillable, not just + # counted. (compile_overlays.py is not in the codegen hash: no reshard.) + try: + os.makedirs(cache_dir, exist_ok=True) + ub = ', '.join(f'0x{a:08X}' for a in sorted(c_audit['unknown_bad'])) + us = ', '.join(f'0x{a:08X}' + for a in sorted(c_audit['unsupported_todo_addrs'])) + header = ( + f'/* FRAGMENT AUDIT FAILED — retained for triage (not compiled).\n' + f' * requested ({len(requested)}): ' + f'{", ".join(f"0x{entry:08X}" for entry in requested)}\n' + f' * region phys : 0x{phys_addr:08X}\n' + f' * unknown_bad ({len(c_audit["unknown_bad"])}): {ub}\n' + f' * unsupported ({len(c_audit["unsupported_todo_addrs"])}): {us}\n' + f' */\n') + request_key = binascii.crc32(b''.join( + struct.pack(' \d+ projected .* > (\d+);', + capacity_error) + if match and int(match.group(1)) >= int(match.group(2)): + return None, 'candidate-capacity: full; ' + capacity_error + return None, 'candidate-capacity: ' + capacity_error + return None, 'compile-error (see COMPILE ERROR above)' + if not publication.get('published', True): + # Another process won the content-key publication race. It is a + # cache hit only when the complete pair is byte-for-byte the same + # manifest identity; a 32-bit filename-key collision must fail + # closed instead of warming coverage from our discarded staging. + cache_status = cached_shard_manifest_status( + dll_path, overlay_abi_tag(args.runtime_include, args.flavor), + overlay_ranges_text( + frag_ids, pair_id, manifest_provenance), pair_id) + if cache_status != 'match': + return None, ('fragment cache-key collision/concurrent pair: ' + 'preserved manifest does not match generated identity') + return frag_ids, 'cached' + return frag_ids, 'built' + + +def compile_interior_fragment(interior: int, data: bytes, load_addr: int, + size: int, phys_addr: int, cache_dir: str, + args, sub_env: dict, toml_doc: dict, + producer_ranges=(), cross_call_allow=(), + *, guard_bytes: int): + """Compile one isolated uncertain interior entry. + + Executed, operator-forced, and interval-only aliases deliberately use this + singleton wrapper so one speculative entry cannot poison trusted roots. + Play-free strong roots use ``compile_fragment_batch`` instead. + """ + return compile_fragment_batch( + {interior}, data, load_addr, size, phys_addr, cache_dir, args, sub_env, + toml_doc, producer_ranges, cross_call_allow, + manifest_provenance=ORPHAN_MANIFEST_PROVENANCE, + guard_bytes=guard_bytes) + + +def fragment_shard_key(func_ids: list, + provenance: str | None = None) -> int: + """Filename identity shared by fragment publication and sidecars.""" + crc = 0 + if provenance is not None: + crc = binascii.crc32( + b'psxrecomp fragment provenance\0' + + provenance.encode('ascii') + b'\0') + return binascii.crc32(b''.join( + struct.pack(' /x/... before prepending; verified live: + # POSIX-prepend rc 0, Windows-prepend rc 1. + pd = d + if os.sep == '/': + m = re.match(r'^([A-Za-z]):[\\/](.*)$', d) + if m: + pd = '/' + m.group(1).lower() + '/' + m.group(2).replace('\\', '/') + env['PATH'] = pd + os.pathsep + env.get('PATH', '') + return env, d + return env, None + + +# ---- TinyCC (tcc) overlay compile — toolchain-free user fallback ----------- +# tcc has its own built-in linker (no ld/collect2) and bundles its own headers, +# so it is self-contained. The only friction is that tcc 0.9.27 does not skip a +# UTF-8 BOM, and the recompiler's runtime headers carry one — so we feed tcc a +# BOM-stripped copy of the include dirs (used ONLY for tcc's -I; the codegen hash +# still derives from the real headers, so the cache dir matches the runtime). +_TCC_BOMFREE_INC = {} # orig include dir -> bom-stripped temp dir (memoized) +_TCC_COMPAT_PREFIX = b'''\ +#ifdef __TINYC__ +/* TinyCC 0.9.27 has no GCC __builtin_ctz. Keep this shim local to the + * disposable generated source so runtime headers and the codegen hash stay + * byte-identical across compilers. */ +static inline unsigned psx_tcc_ctz(unsigned value) { + unsigned bit = 0u; + while (((value >> bit) & 1u) == 0u) ++bit; + return bit; +} +#define __builtin_ctz(value) psx_tcc_ctz((unsigned)(value)) +#endif +''' + +def _bom_free_incdir(d: str) -> str: + d = os.path.abspath(d) + if d in _TCC_BOMFREE_INC: + return _TCC_BOMFREE_INC[d] + out = tempfile.mkdtemp(prefix='tcc_inc_') + for name in os.listdir(d): + # Headers, and the .c.inc fragments a BIOS module's glue.c includes by + # name (overlay_dispatch_preamble.c.inc, psx_bios_module_glue.c.inc). + # tcc sees only this copy, so a file left out here is "not found". + if not name.endswith(('.h', '.inc')): + continue + with open(os.path.join(d, name), 'rb') as f: + data = f.read() + if data[:3] == b'\xef\xbb\xbf': + data = data[3:] + with open(os.path.join(out, name), 'wb') as f: + f.write(data) + _TCC_BOMFREE_INC[d] = out + return out + +def _compile_dll_tcc(c_path: str, out_dll: str, include_dirs, flavor: int, + tcc: str) -> bool: + # Strip a UTF-8 BOM off the overlay C itself (tcc 0.9.27 chokes on it) and + # provide the one GCC builtin used by the shared cycle-model header. + with open(c_path, 'rb') as f: + data = f.read() + if data[:3] == b'\xef\xbb\xbf': + data = data[3:] + if not data.startswith(_TCC_COMPAT_PREFIX): + data = _TCC_COMPAT_PREFIX + data + with open(c_path, 'wb') as f: + f.write(data) + cmd = [tcc, '-shared', + '-DPSX_OVERLAY_DLL_BUILD', + # Keep TCC semantically identical to the GCC overlay path. Omitting + # these left debug_server_cyc_observe unresolved in release shards + # and disabled guest-cycle charging in every successfully linked + # TCC shard. + '-DPSX_NO_DEBUG_TOOLS', + '-DPSX_ENABLE_BLOCK_CYCLES=1', + f'-DPSX_OVERLAY_FLAVOR={int(flavor)}', + # PGXP flavor bit (overlay_api.h PSX_OVERLAY_FLAVOR_PGXP): arm the + # PGXP_*() hook macros the emitter writes into every overlay C. + *(['-DPSX_PGXP=1'] if int(flavor) & 2 else []), + native_path(c_path), '-o', native_path(out_dll)] + for d in include_dirs: + cmd.append('-I' + native_path(_bom_free_incdir(d))) + print(f' compile (tcc): {" ".join(cmd)}') + r = subprocess.run(cmd, capture_output=True, text=True) + if r.returncode != 0: + print(f' TCC COMPILE ERROR (exit {r.returncode}):\n{r.stderr or r.stdout}') + return False + return True + + +def _compile_dll_direct(c_path: str, out_dll: str, include_dirs: list[str], + gcc: str = 'gcc', flavor: int = 0, + compiler: str = 'gcc', tcc: str = 'tcc') -> bool: + import platform + # Absolute paths (interpreter flavor) for EVERY path the native compiler + # touches — see native_path's docstring for the two rules and the + # 2026-07-15 MSYS-python incident they encode. + c_path = native_path(c_path) + out_dll = native_path(out_dll) + if compiler == 'tcc': + return _compile_dll_tcc(c_path, out_dll, include_dirs, flavor, tcc) + env, tc_dir = _toolchain_env(gcc) + includes = [f'-I{native_path(d)}' for d in include_dirs] + # On Windows, DLLs use PE relocations — -fPIC triggers GCC CRT init + # that conflicts with the host process. Use -shared without -fPIC. + pic_flag = [] if is_windows() else ['-fPIC'] + cmd = [ + gcc, '-shared', *pic_flag, '-O2', + '-DPSX_OVERLAY_DLL_BUILD', + # Overlays mirror the runtime's no-debug-tools build: the emitter guards + # debug_server_cyc_observe (and friends) behind PSX_NO_DEBUG_TOOLS, and the + # shipped/native runtime is built without debug tools, so define it here too or + # the overlay emits calls to symbols the runtime doesn't have (undefined ref). + '-DPSX_NO_DEBUG_TOOLS', + # CYCLE MODEL UNIFICATION (Tomba2 logo Timer1 fork): compiled-overlay code + # MUST charge guest cycles exactly like the dirty-RAM interpreter and the + # BIOS (both built with PSX_ENABLE_BLOCK_CYCLES=1). Without this flag every + # psx_advance_cycles() in overlay code is #ifdef'd out, so a function run as + # a native overlay charges ~0 cycles while the same function run via the + # interp charges per-instruction -> timer-sensitive code (e.g. a Timer1 + # debounce) reads different values per backend and the game forks. + '-DPSX_ENABLE_BLOCK_CYCLES=1', + # Codegen-flavor tag baked into overlay_abi() (base=0). The loader + # rejects DLLs whose flavor differs from the runtime's, so a widescreen + # cache and a base cache can never cross-contaminate even if they share + # a directory (they key by guest-bytes CRC, which is flavor-blind). + f'-DPSX_OVERLAY_FLAVOR={int(flavor)}', + # PGXP flavor bit (overlay_api.h PSX_OVERLAY_FLAVOR_PGXP): arm the + # PGXP_*() hook macros the emitter writes into every overlay C. + *(['-DPSX_PGXP=1'] if int(flavor) & 2 else []), + c_path, + '-o', out_dll, + *includes, + '-lm', + ] + if tc_dir is None: + print(' WARNING: no gcc toolchain dir found (PSX_MINGW_BIN / --gcc dir / ' + 'PATH / common locations); compile will likely fail silently.') + print(f' compile: {" ".join(cmd)}') + r = subprocess.run(cmd, capture_output=True, text=True, env=env) + if r.returncode != 0: + msg = (r.stderr or r.stdout or '').strip() + if not msg: + # No compiler output at all = the compiler never really ran + # (spawn/DLL-load failure: foreign-MSYS runtime mix, bad toolchain + # dir, or non-native paths). Say so instead of printing nothing — + # an empty COMPILE ERROR is undiagnosable from the runtime's tail. + msg = ('(no compiler output — gcc likely failed to launch: ' + f'toolchain dir={tc_dir!r}, check PATH/DLL mix and that ' + 'all paths above are OS-native)') + print(f' COMPILE ERROR (exit {r.returncode}):\n{msg}') + return False + return True + + +def compile_dll(c_path: str, out_dll: str, include_dirs: list[str], + gcc: str = 'gcc', flavor: int = 0, + compiler: str = 'gcc', tcc: str = 'tcc', + func_ids: list | None = None, + pair_id: int | None = None, + preserve_existing_pair: bool = False, + expected_existing_abi: int | None = None, + publication_result: dict | None = None, + candidate_cap: int | None = None, + manifest_provenance: str | None = None) -> bool: + """Publish a shard only after all of its artifacts are complete. + + GCC and tcc write their output incrementally. If the process is interrupted + while targeting the final cache name, the next run sees that partial file + and used to skip it as if it were complete. Compile to a unique sibling. + + When ``func_ids`` is supplied, stage the range manifest too and publish the + two as one recoverable transaction. Moving the old DLL out of its loader- + visible name first means every interruption point contains either a complete + old pair, a complete new pair, or no loadable pair -- never mixed halves. + The pair ID additionally lets a pair-aware loader reject the only filesystem + TOCTOU left: an old manifest parsed immediately before the DLL rename. + """ + final_out = os.path.abspath(out_dll) + out_dir = os.path.dirname(final_out) + os.makedirs(out_dir, exist_ok=True) + if func_ids is not None and (not func_ids or pair_id is None): + print(' COMPILE ERROR: paired shard requires non-empty ranges and pair ID') + return False + if func_ids is not None and candidate_cap is not None: + try: + capacity_error = preflight_shard_candidate_capacity( + final_out, func_ids, pair_id, manifest_provenance, + expected_existing_abi, candidate_cap) + except Exception as exc: + # A failed optimization must not replace the authoritative locked + # projection after linking. Compile normally and let publication + # either admit or reject the staged pair. + print(f' capacity preflight unavailable: {exc}') + capacity_error = None + if capacity_error is not None: + if publication_result is not None: + publication_result['capacity_error'] = capacity_error + print(f' COMPILE SKIP (preflight): {capacity_error}') + return False + suffix = os.path.splitext(final_out)[1] or overlay_ext() + fd, staged = tempfile.mkstemp( + prefix=f'.{os.path.basename(final_out)}.tmp.', suffix=suffix, + dir=out_dir) + os.close(fd) + os.unlink(staged) # let the native compiler create its output normally + staged_ranges = os.path.splitext(staged)[0] + '.ranges' + try: + if not _compile_dll_direct( + c_path, staged, include_dirs, gcc=gcc, flavor=flavor, + compiler=compiler, tcc=tcc): + return False + if not os.path.isfile(staged) or os.path.getsize(staged) == 0: + print(' COMPILE ERROR: compiler reported success but emitted no DLL') + return False + if func_ids is None: + os.replace(staged, final_out) + if publication_result is not None: + publication_result['published'] = True + return True + write_overlay_ranges_from( + func_ids, staged_ranges, pair_id, manifest_provenance) + if not os.path.isfile(staged_ranges) or os.path.getsize(staged_ranges) == 0: + print(' COMPILE ERROR: range manifest staging produced no output') + return False + try: + published = publish_shard_pair( + staged, staged_ranges, final_out, + preserve_existing=preserve_existing_pair, + expected_existing_abi=expected_existing_abi, + candidate_cap=candidate_cap) + if publication_result is not None: + publication_result['published'] = published + except ShardCandidateCapacityError as exc: + if publication_result is not None: + publication_result['capacity_error'] = str(exc) + print(f' COMPILE SKIP: {exc}') + return False + except Exception as exc: + print(f' COMPILE ERROR: could not publish DLL/ranges pair: {exc}') + try: + recover_shard_pair(final_out) + except Exception as recover_exc: + print(f' COMPILE ERROR: shard-pair recovery also failed: ' + f'{recover_exc}') + return False + return True + finally: + # TinyCC emits an export-definition sidecar beside its requested DLL. + # It inherits the unique staged basename and must not accumulate in the + # content cache after either success or failure. + staged_sidecars = [os.path.splitext(staged)[0] + '.def'] + for temporary in [staged, staged_ranges, *staged_sidecars]: + try: + os.unlink(temporary) + except FileNotFoundError: + pass + + +def _shard_pair_paths(dll_path: str) -> tuple[str, str, str, str]: + dll_path = os.path.abspath(dll_path) + ranges_path = os.path.splitext(dll_path)[0] + '.ranges' + return (dll_path, ranges_path, + dll_path + '.pair-lock', dll_path + '.pair-txn.json') + + +def _unlink_if_present(path: str) -> None: + try: + os.unlink(path) + except FileNotFoundError: + pass + + +def _best_effort_unlink(path: str) -> None: + """Remove transaction debris when possible (loaded Windows DLLs may refuse).""" + try: + os.unlink(path) + except OSError: + pass + + +def _file_sha256(path: str) -> str | None: + try: + digest = hashlib.sha256() + with open(path, 'rb') as source: + for chunk in iter(lambda: source.read(1024 * 1024), b''): + digest.update(chunk) + return digest.hexdigest() + except OSError: + return None + + +def _write_json_atomic(path: str, value: dict) -> None: + directory = os.path.dirname(path) + fd, staged = tempfile.mkstemp(prefix=f'.{os.path.basename(path)}.', + suffix='.tmp', dir=directory) + try: + with os.fdopen(fd, 'w', encoding='utf-8') as out: + json.dump(value, out, sort_keys=True) + out.flush() + os.fsync(out.fileno()) + os.replace(staged, path) + finally: + _best_effort_unlink(staged) + + +@contextmanager +def _exclusive_file_lock(lock_path: str, timeout: float | None = 120.0): + """Kernel-owned cross-process lock on one permanent byte-range file. + + The lock file is intentionally permanent. OS byte-range/advisory locks are + released by the kernel when a process dies; deleting the file would create + an inode/handle split that permits two simultaneous owners. + """ + lock_path = os.path.abspath(lock_path) + os.makedirs(os.path.dirname(lock_path), exist_ok=True) + lock_file = open(lock_path, 'a+b') + if os.path.getsize(lock_path) == 0: + lock_file.write(b'\0') + lock_file.flush() + deadline = (time.monotonic() + timeout if timeout is not None else None) + acquired = False + try: + while not acquired: + try: + lock_file.seek(0) + if os.name == 'nt': + import msvcrt + msvcrt.locking(lock_file.fileno(), msvcrt.LK_NBLCK, 1) + else: + import fcntl + fcntl.flock(lock_file.fileno(), fcntl.LOCK_EX | + fcntl.LOCK_NB) + acquired = True + except OSError: + if deadline is not None and time.monotonic() >= deadline: + raise TimeoutError( + f'timed out waiting for shard-pair lock {lock_path}') + time.sleep(0.025) + yield + finally: + if acquired: + lock_file.seek(0) + if os.name == 'nt': + import msvcrt + msvcrt.locking(lock_file.fileno(), msvcrt.LK_UNLCK, 1) + else: + import fcntl + fcntl.flock(lock_file.fileno(), fcntl.LOCK_UN) + lock_file.close() + + +@contextmanager +def _shard_pair_lock(dll_path: str, timeout: float = 120.0): + """Cross-process lock for one canonical DLL/ranges filename pair.""" + _dll, _ranges, lock_path, _journal = _shard_pair_paths(dll_path) + with _exclusive_file_lock(lock_path, timeout): + yield + + +def _candidate_capacity_namespace(dll_path: str) -> tuple[str, list[str]]: + """Return the shared lock and compiler-tier dirs for one cache namespace. + + Normal caches are ``GAME/compiler/arch/cgN_hash_gcCONFIG`` (legacy tests + may still use ``cgN_hash``). The runtime candidate table is process-global, + so serialize/count every compiler tier with the same GAME/arch/cg leaf. + Tests and hand-built paths fall back to their containing directory. + + The KUSEG and KSEG1 shards of a leaf live in its seg-kuseg/ and seg-kseg1/ + subdirectories (§5.7) and take slots from the same process-global table, + so a shard there belongs to its leaf's namespace, and every namespace + lists each leaf's segment directories after the leaf. + """ + leaf = os.path.dirname(os.path.abspath(dll_path)) + if cache_dir_segment(leaf) != KSEG0: + leaf = os.path.dirname(leaf) + cg_name = os.path.basename(leaf) + arch_dir = os.path.dirname(leaf) + compiler_dir = os.path.dirname(arch_dir) + game_dir = os.path.dirname(compiler_dir) + compiler_name = os.path.basename(compiler_dir) + if (re.fullmatch(r'cg\d+_[0-9A-Fa-f]{8}(?:_gc[0-9A-Fa-f]{8})?', cg_name) and + compiler_name in ('gcc', 'tcc')): + arch_name = os.path.basename(arch_dir) + tier_dirs = [ + directory + for tier in ('gcc', 'tcc') + for directory in _with_segment_dirs( + os.path.join(game_dir, tier, arch_name, cg_name)) + ] + return (os.path.join(game_dir, '.overlay-candidate-capacity.lock'), + tier_dirs) + return (os.path.join(leaf, '.overlay-candidate-capacity.lock'), + _with_segment_dirs(leaf)) + + +def _with_segment_dirs(leaf: str) -> list[str]: + """A cache leaf, then its per-segment subdirectories (§5.7).""" + return [leaf] + [os.path.join(leaf, SEGMENT_CACHE_SUBDIRS[seg]) + for seg in (KUSEG, KSEG1)] + + +def _segment_leaf(directory: str) -> str: + """The cache leaf a (possibly per-segment) shard directory belongs to.""" + directory = os.path.abspath(directory) + if cache_dir_segment(directory) != KSEG0: + return os.path.dirname(directory) + return directory + + +def _segment_basename(path: str) -> tuple[int, str]: + """A shard's identity within one compiler tier: its segment and name. + The same {phys}_{crc} name is a different shard in each segment.""" + return (cache_dir_segment(os.path.dirname(os.path.abspath(path))), + os.path.normcase(os.path.basename(path))) + + +def cache_candidate_capacity_snapshot( + dll_path: str, expected_abi: int | None) -> tuple[int, dict]: + """Read one recovered candidate namespace under its publication lock.""" + capacity_lock, cache_dirs = _candidate_capacity_namespace(dll_path) + with _exclusive_file_lock(capacity_lock): + recover_candidate_namespace(cache_dirs) + return cache_candidate_inventory(cache_dirs, expected_abi) + + +def cache_candidate_capacity_full(dll_path: str, expected_abi: int | None, + candidate_cap: int) -> tuple[bool, int]: + """Read one serialized namespace inventory and report a saturated cache.""" + total, counts = cache_candidate_capacity_snapshot(dll_path, expected_abi) + return (total >= candidate_cap or + getattr(counts, 'raw_total', sum(counts.values())) >= + 2 * candidate_cap or + getattr(counts, 'range_link_total', 0) >= + 2 * candidate_cap * 8 or + getattr(counts, 'file_total', len(counts)) >= + RUNTIME_CACHE_FILE_CAP), total + + +def candidate_capacity_saturated_in_tier(total: int, counts: dict, + candidate_cap: int, + cache_dir: str) -> bool: + """Whether one active tier has reached any physical/runtime capacity.""" + active = os.path.normcase(_segment_leaf(cache_dir)) + saturated = (total >= candidate_cap or + getattr(counts, 'raw_total', sum(counts.values())) >= + 2 * candidate_cap or + getattr(counts, 'range_link_total', 0) >= + 2 * candidate_cap * 8 or + getattr(counts, 'file_total', len(counts)) >= + RUNTIME_CACHE_FILE_CAP) + return (saturated and bool(counts) and all( + os.path.normcase(_segment_leaf(os.path.dirname(path))) == active + for path in counts + )) + + +class CandidateInventory(dict): + """Per-selected-path counts plus the metadata needed for safe projection. + + Keep the historical ``path -> F count`` mapping API: several fixed-point + callers use its keys to decide which compiler tier owns the inventory. The + extra fields distinguish the deduplicated process-lifetime candidate cost + from physical F-row, range-link, and file costs, none of which may dedup. + """ + + def __init__(self): + super().__init__() + self.identities = {} + self.raw_counts = {} + self.range_link_counts = {} + self.raw_total = 0 + self.range_link_total = 0 + self.file_total = 0 + + +RUNTIME_CACHE_FILE_CAP = 4096 + + +def _runtime_manifest_range_link_count(funcs: list) -> int: + """Mirror LazyMan's unique 4 KiB RAM-page links for parsed F records.""" + page_count = PSX_RAM_SIZE // 4096 + total = 0 + for _entry, _crc, ranges in funcs: + seen_pages = set() + for start, length in ranges: + lo = start & 0x1FFFFFFF + hi = lo + length - 1 + p0, p1 = lo >> 12, hi >> 12 + if p0 >= page_count: + continue + p1 = min(p1, page_count - 1) + seen_pages.update(range(p0, p1 + 1)) + total += len(seen_pages) + return total + + +def _normalized_runtime_manifest_identity(manifest: str, pair_id: int | None, + funcs: list): + """Return a conservative whole-pair identity, or ``None`` if ambiguous. + + Runtime address aliases are normalized, but F and R ordering is retained: + range order participates in the guarded CRC calculation. Compiler-owned + provenance is part of the identity. Unknown/malformed provenance and + legacy manifests without P remain unique rather than being guessed equal. + """ + if pair_id is None: + return None + provenance = manifest_provenance(manifest) + if (manifest_declares_supplemental_provenance(manifest) and + provenance is None): + return None + normalized_funcs = tuple( + (entry & 0x1FFFFFFF, crc, + tuple((start & 0x1FFFFFFF, length) for start, length in ranges)) + for entry, crc, ranges in funcs + ) + return pair_id, provenance, normalized_funcs + + +def _candidate_group_identity(cache_dir: str, manifest_identity): + if manifest_identity is None: + return None + return os.path.normcase(os.path.abspath(cache_dir)), manifest_identity + + +_candidate_validation_cache_lock = threading.Lock() +_candidate_abi_cache = {} +_candidate_record_cache = {} +_candidate_rejection_witness_cache = {} + + +def _candidate_file_fingerprint(path: str): + """Return the replacement-sensitive identity of one cache artifact. + + Cache publication uses atomic replacement, so a new pair receives a new + file identity even when its size and timestamps happen to match. Keep the + timestamps as defense for in-place test/repair writes. Callers still scan + the namespace and perform the authoritative capacity projection every time; + this cache only avoids repeatedly mapping unchanged DLLs and reparsing their + unchanged manifests near the candidate ceiling. + """ + try: + stat = os.stat(path) + except OSError: + return None + return (stat.st_dev, stat.st_ino, stat.st_size, stat.st_mtime_ns, + getattr(stat, 'st_ctime_ns', None)) + + +def _candidate_cached_abi_matches(dll: str, expected_abi: int) -> bool: + path = os.path.normcase(os.path.abspath(dll)) + fingerprint = ( + expected_abi, _dll_abi_matches, + _candidate_file_fingerprint(dll), + ) + with _candidate_validation_cache_lock: + cached = _candidate_abi_cache.get(path) + if cached is not None and cached[0] == fingerprint: + return cached[1] + matched = _dll_abi_matches(dll, expected_abi) + # Do not memoize across an uncooperative in-place writer. Cooperating cache + # publishers are already excluded by the namespace lock held by callers. + if matched and fingerprint[2] == _candidate_file_fingerprint(dll): + with _candidate_validation_cache_lock: + _candidate_abi_cache[path] = (fingerprint, matched) + return matched + + +def _load_candidate_inventory_record(dll: str, + expected_abi: int | None): + """Return valid rows, identity, raw F count, and raw range-link count.""" + ranges_path = os.path.splitext(dll)[0] + '.ranges' + path = os.path.normcase(os.path.abspath(dll)) + + def fingerprint(): + return ( + expected_abi, _dll_runtime_exports_match, + _candidate_file_fingerprint(dll), + _candidate_file_fingerprint(ranges_path), + ) + + # A positive cached record is immutable under the cooperating publisher's + # atomic-replacement contract. Double-stat it before reuse; a changed or + # transaction-hidden artifact falls through to locked recovery below. + observed = fingerprint() + with _candidate_validation_cache_lock: + cached = _candidate_record_cache.get(path) + if (cached is not None and cached[0] == observed and + observed == fingerprint()): + return cached[1] + try: + with _shard_pair_lock(dll): + _recover_shard_pair_locked(dll) + if (not os.path.isfile(dll) or os.path.getsize(dll) == 0 or + not os.path.isfile(ranges_path) or + os.path.getsize(ranges_path) == 0): + return [], None, 0, 0 + observed = fingerprint() + with _candidate_validation_cache_lock: + cached = _candidate_record_cache.get(path) + if cached is not None and cached[0] == observed: + return cached[1] + with open(ranges_path, encoding='ascii', newline='') as source: + manifest = source.read() + pair_id, funcs = parse_runtime_shard_manifest( + manifest, require_pair=False, + expected_segment=cache_dir_segment(os.path.dirname(dll))) + raw_count = len(funcs) + range_link_count = _runtime_manifest_range_link_count(funcs) + if (not funcs or not _dll_runtime_exports_match( + dll, expected_abi, pair_id, + {entry for entry, _crc, _ranges in funcs})): + record = ([], None, raw_count, range_link_count) + else: + identity = _normalized_runtime_manifest_identity( + manifest, pair_id, funcs) + record = ( + funcs, + _candidate_group_identity(os.path.dirname(dll), identity), + raw_count, range_link_count) + stable = observed == fingerprint() + # Boolean DLL validation currently conflates deterministic export + # mismatch with transient LoadLibrary failure. Cache successes only + # so a one-off loader failure cannot suppress a pair indefinitely. + if stable and record[0]: + with _candidate_validation_cache_lock: + _candidate_record_cache[path] = (observed, record) + return record + except (OSError, UnicodeError): + return [], None, 0, 0 + + +def cache_candidate_inventory(cache_dirs: list[str], + expected_abi: int | None) -> tuple[int, dict]: + """Inventory runtime-selected pairs with conservative whole-pair dedup. + + Only a non-legacy P identity with the exact normalized manifest semantics + and provenance may share candidate cost, and only inside one compiler-tier + leaf. Raw manifest rows, per-F page links, and files remain undeduped. + """ + ext = overlay_ext() + canonical = re.compile( + rf'^[0-9A-Fa-f]{{8}}_[0-9A-Fa-f]{{8}}{re.escape(ext)}$') + counts = CandidateInventory() + seen_basenames = set() + ordered_dirs = [] + for path in cache_dirs: + absolute = os.path.abspath(path) + if absolute not in ordered_dirs: + ordered_dirs.append(absolute) + for cache_dir in ordered_dirs: + try: + names = sorted(os.listdir(cache_dir)) + except OSError: + continue + for name in names: + if not canonical.fullmatch(name): + continue + dll = os.path.abspath(os.path.join(cache_dir, name)) + if (expected_abi is not None and + not _candidate_cached_abi_matches(dll, expected_abi)): + # Runtime's ABI preflight removes this path from the index + # before scanning the next compiler tier, so it cannot shadow + # a valid lower-tier basename. + continue + basename = _segment_basename(dll) + if basename in seen_basenames: + continue + # Runtime scans gcc before tcc and suppresses a lower-tier path by + # basename even when the selected higher-tier pair later fails ABI + # validation. Mirror that exact candidate population here. + seen_basenames.add(basename) + funcs, identity, raw_count, range_link_count = \ + _load_candidate_inventory_record(dll, expected_abi) + counts[dll] = len(funcs) + counts.identities[dll] = identity + counts.raw_counts[dll] = raw_count + counts.range_link_counts[dll] = range_link_count + counts.raw_total = sum(counts.raw_counts.values()) + counts.range_link_total = sum(counts.range_link_counts.values()) + counts.file_total = len(counts) + seen_identities = set() + total = 0 + for path, count in counts.items(): + identity = counts.identities[path] + if identity is None or identity not in seen_identities: + total += count + if identity is not None: + seen_identities.add(identity) + return total, counts + + +def recover_candidate_namespace(cache_dirs: list[str]) -> None: + """Recover transaction-hidden canonical pairs before capacity inventory.""" + ext = overlay_ext() + journal_suffix = ext + '.pair-txn.json' + canonical = re.compile( + rf'^[0-9A-Fa-f]{{8}}_[0-9A-Fa-f]{{8}}{re.escape(ext)}$') + for cache_dir in cache_dirs: + try: + journals = sorted( + name for name in os.listdir(cache_dir) + if name.endswith(journal_suffix)) + except OSError: + continue + for name in journals: + dll_name = name[:-len('.pair-txn.json')] + if canonical.fullmatch(dll_name): + recover_shard_pair(os.path.join(cache_dir, dll_name)) + + +def _projected_cache_capacity_usage(total: int, counts: dict, + cache_dirs: list[str], final_dll: str, + staged_count: int, staged_identity=None, + staged_range_links: int = 0 + ) -> tuple[int, int, int, int]: + """Model candidate, lazy-F, range-link, and file usage.""" + final_dll = os.path.abspath(final_dll) + final_dir = os.path.normcase(os.path.dirname(final_dll)) + ranks = { + os.path.normcase(os.path.abspath(path)): index + for index, path in enumerate(cache_dirs) + } + final_rank = ranks.get(final_dir, 0) + basename = _segment_basename(final_dll) + selected_path = next(( + path for path in counts + if _segment_basename(path) == basename + ), None) + records = [(path, count, + getattr(counts, 'identities', {}).get(path), + getattr(counts, 'raw_counts', {}).get(path, count), + getattr(counts, 'range_link_counts', {}).get(path, 0)) + for path, count in counts.items()] + if selected_path is not None: + selected_rank = ranks.get( + os.path.normcase(os.path.dirname(selected_path)), 0) + if final_rank > selected_rank: + # A lower-tier publication is invisible while a same-basename + # higher tier exists. + return (total, getattr(counts, 'raw_total', sum(counts.values())), + getattr(counts, 'range_link_total', 0), + getattr(counts, 'file_total', len(counts))) + records = [record for record in records if record[0] != selected_path] + group_identity = _candidate_group_identity(final_dir, staged_identity) + records.append((final_dll, staged_count, group_identity, staged_count, + staged_range_links)) + + projected = 0 + seen_identities = set() + for _path, count, identity, _raw_count, _range_links in records: + if identity is None or identity not in seen_identities: + projected += count + if identity is not None: + seen_identities.add(identity) + return (projected, + sum(raw_count for _path, _count, _identity, raw_count, _links + in records), + sum(links for _path, _count, _identity, _raw, links in records), + len(records)) + + +def projected_cache_candidate_usage(total: int, counts: dict, + cache_dirs: list[str], final_dll: str, + staged_count: int, + staged_identity=None) -> tuple[int, int, int]: + """Compatibility API for candidate, lazy-F, and file usage.""" + projected, raw, _range_links, files = _projected_cache_capacity_usage( + total, counts, cache_dirs, final_dll, staged_count, staged_identity) + return projected, raw, files + + +def projected_cache_candidate_count(total: int, counts: dict, + cache_dirs: list[str], final_dll: str, + staged_count: int, + staged_identity=None) -> int: + """Compatibility wrapper returning process-lifetime candidate usage.""" + return projected_cache_candidate_usage( + total, counts, cache_dirs, final_dll, staged_count, + staged_identity)[0] + + +def _candidate_capacity_projection_error( + total: int, counts: dict, projected: int, projected_raw: int, + projected_range_links: int, projected_files: int, + staged_count: int, candidate_cap: int) -> str | None: + """Return the same fail-closed capacity verdict before or after linking.""" + raw_total = getattr(counts, 'raw_total', sum(counts.values())) + range_link_total = getattr(counts, 'range_link_total', 0) + file_total = getattr(counts, 'file_total', len(counts)) + if projected > candidate_cap and projected > total: + return ('overlay candidate capacity would be exceeded: ' + f'{total} existing -> {projected} projected with ' + f'{staged_count} staged > {candidate_cap}; canonical ' + 'pair preserved') + if projected_raw > 2 * candidate_cap and projected_raw > raw_total: + return ('overlay lazy-manifest capacity would be exceeded: ' + f'{raw_total} existing -> {projected_raw} projected > ' + f'{2 * candidate_cap}; canonical pair preserved') + if (projected_range_links > 2 * candidate_cap * 8 and + projected_range_links > range_link_total): + return ('overlay lazy range-link capacity would be exceeded: ' + f'{range_link_total} existing -> ' + f'{projected_range_links} projected > ' + f'{2 * candidate_cap * 8}; canonical pair preserved') + if (projected_files > RUNTIME_CACHE_FILE_CAP and + projected_files > file_total): + return ('overlay cache file capacity would be exceeded: ' + f'{file_total} existing -> {projected_files} projected > ' + f'{RUNTIME_CACHE_FILE_CAP}; canonical pair preserved') + return None + + +def preflight_shard_candidate_capacity( + final_dll: str, func_ids: list, pair_id: int, + manifest_provenance: str | None, expected_abi: int | None, + candidate_cap: int) -> str | None: + """Reject an impossible publication before invoking the native linker. + + The locked publication check remains authoritative. This early check is + deliberately one-sided: a concurrent deletion after the snapshot can only + defer safe coverage until the next invocation, while an admitted shard is + still reprojected under the namespace lock after it has been compiled. + """ + final_dll = os.path.abspath(final_dll) + capacity_lock, cache_dirs = _candidate_capacity_namespace(final_dll) + manifest = overlay_ranges_text( + func_ids, pair_id, manifest_provenance) + staged_identity = _normalized_runtime_manifest_identity( + manifest, pair_id, func_ids) + staged_range_links = _runtime_manifest_range_link_count(func_ids) + with _exclusive_file_lock(capacity_lock): + cache_dirs_key = tuple( + os.path.normcase(os.path.abspath(path)) for path in cache_dirs) + witness_key = ( + os.path.normcase(os.path.abspath(capacity_lock)), cache_dirs_key, + expected_abi, candidate_cap, _dll_abi_matches, + _dll_runtime_exports_match, + ) + with _candidate_validation_cache_lock: + witness = _candidate_rejection_witness_cache.get(witness_key) + if witness is not None: + witness_total, witness_counts = witness + witness_usage = _projected_cache_capacity_usage( + witness_total, witness_counts, cache_dirs, final_dll, + len(func_ids), staged_identity, staged_range_links) + witness_error = _candidate_capacity_projection_error( + witness_total, witness_counts, *witness_usage, + len(func_ids), candidate_cap) + if witness_error is not None: + # Reuse only a proof of impossibility. Added pairs make the + # bound stronger; deletion/replacement can merely defer safe + # optional coverage until the next command. An apparent + # admission always falls through to a fresh locked inventory. + return witness_error + recover_candidate_namespace(cache_dirs) + total, counts = cache_candidate_inventory(cache_dirs, expected_abi) + with _candidate_validation_cache_lock: + _candidate_rejection_witness_cache[witness_key] = (total, counts) + usage = _projected_cache_capacity_usage( + total, counts, cache_dirs, final_dll, len(func_ids), + staged_identity, staged_range_links) + return _candidate_capacity_projection_error( + total, counts, *usage, len(func_ids), candidate_cap) + + +def _cleanup_old_pair_debris(dll_path: str) -> None: + for path in glob.glob(os.path.abspath(dll_path) + '.pair-txn.*.old-*'): + _best_effort_unlink(path) + + +def _recover_shard_pair_locked(dll_path: str) -> None: + dll, ranges, _lock, journal_path = _shard_pair_paths(dll_path) + if not os.path.isfile(journal_path): + _cleanup_old_pair_debris(dll) + return + try: + with open(journal_path, encoding='utf-8') as source: + txn = json.load(source) + except (OSError, ValueError) as exc: + raise RuntimeError(f'cannot recover shard transaction {journal_path}: {exc}') + + required = ('backup_dll', 'backup_ranges', 'new_dll_sha256', + 'new_ranges_sha256', 'old_dll_sha256', 'old_ranges_sha256') + if txn.get('schema') != 'psxrecomp shard pair transaction v1' or any( + key not in txn for key in required): + raise RuntimeError(f'invalid shard transaction journal {journal_path}') + + backup_dll = txn['backup_dll'] + backup_ranges = txn['backup_ranges'] + token = txn.get('token', '') + if (not re.fullmatch(r'[0-9a-f]{32}', token) or + backup_dll != f'{dll}.pair-txn.{token}.old-dll' or + backup_ranges != f'{dll}.pair-txn.{token}.old-ranges'): + raise RuntimeError(f'invalid shard transaction ownership in {journal_path}') + new_complete = (_file_sha256(dll) == txn['new_dll_sha256'] and + _file_sha256(ranges) == txn['new_ranges_sha256']) + if new_complete: + # The DLL rename is the commit point. A crash before a journal phase + # update must not roll back a new DLL already paired with its exact + # manifest. Remove the journal first; old loaded-DLL backups are merely + # deferred debris and may remain locked until process exit on Windows. + _unlink_if_present(journal_path) + _best_effort_unlink(backup_dll) + _best_effort_unlink(backup_ranges) + return + + def restore(path: str, backup: str, expected_hash: str | None) -> None: + current_hash = _file_sha256(path) + if expected_hash is None: + if current_hash is not None: + _unlink_if_present(path) + return + if current_hash == expected_hash: + return + if _file_sha256(backup) != expected_hash: + raise RuntimeError( + f'cannot recover {path}: neither canonical nor backup is the old file') + if current_hash is not None: + _unlink_if_present(path) + os.replace(backup, path) + + # Restore the manifest first; restoring the DLL is the rollback commit. + restore(ranges, backup_ranges, txn['old_ranges_sha256']) + restore(dll, backup_dll, txn['old_dll_sha256']) + _unlink_if_present(journal_path) + _best_effort_unlink(backup_dll) + _best_effort_unlink(backup_ranges) + + +def recover_shard_pair(dll_path: str) -> None: + """Recover/finish a dead writer's transaction under its OS-owned lock.""" + with _shard_pair_lock(dll_path): + _recover_shard_pair_locked(dll_path) + + +def _runtime_valid_shard_pair_locked(dll: str, ranges: str, + expected_abi: int | None) -> bool: + """Mirror the pair-aware loader's minimum acceptance checks.""" + if (not os.path.isfile(dll) or os.path.getsize(dll) == 0 or + not os.path.isfile(ranges) or os.path.getsize(ranges) == 0): + return False + try: + with open(ranges, encoding='ascii', newline='') as f: + manifest = f.read() + pair_id, funcs = parse_runtime_shard_manifest( + manifest, require_pair=False, + expected_segment=cache_dir_segment(os.path.dirname(dll))) + except (OSError, UnicodeError): + return False + return (bool(funcs) and _dll_runtime_exports_match( + dll, expected_abi, pair_id, + {entry for entry, _crc, _ranges in funcs})) + + +def publish_shard_pair(staged_dll: str, staged_ranges: str, + final_dll: str, preserve_existing: bool = False, + expected_existing_abi: int | None = None, + candidate_cap: int | None = None) -> bool: + """Commit a staged pair, optionally preserving a valid concurrent winner. + + Region DLL names are keyed only by whole-region CRC. Two processes can + compile the same bytes with different discovery evidence; the later, + poorer writer must not overwrite a richer pair after that richer process + has used its own result to suppress fragment repair. First valid publisher + wins, while each process's post-pass re-reads the actual winner and emits + any exact-demand fragments it still lacks. + """ + dll, ranges, _lock, journal_path = _shard_pair_paths(final_dll) + token = uuid.uuid4().hex + backup_dll = f'{dll}.pair-txn.{token}.old-dll' + backup_ranges = f'{dll}.pair-txn.{token}.old-ranges' + + capacity_lock, cache_dirs = _candidate_capacity_namespace(dll) + capacity_guard = (_exclusive_file_lock(capacity_lock) + if candidate_cap is not None else nullcontext()) + with capacity_guard: + projected = None + staged_count = 0 + total = 0 + if candidate_cap is not None: + try: + with open(staged_ranges, encoding='ascii', newline='') as source: + staged_manifest = source.read() + staged_pair, staged_funcs = ( + parse_runtime_shard_manifest(staged_manifest)) + except (OSError, UnicodeError) as exc: + raise RuntimeError( + f'cannot read staged range manifest: {exc}') from exc + if not staged_funcs: + raise RuntimeError( + 'staged range manifest has no runtime-valid F records') + staged_count = len(staged_funcs) + recover_candidate_namespace(cache_dirs) + total, counts = cache_candidate_inventory( + cache_dirs, expected_existing_abi) + staged_identity = _normalized_runtime_manifest_identity( + staged_manifest, staged_pair, staged_funcs) + staged_range_links = _runtime_manifest_range_link_count(staged_funcs) + (projected, projected_raw, projected_range_links, + projected_files) = _projected_cache_capacity_usage( + total, counts, cache_dirs, dll, staged_count, + staged_identity, staged_range_links) + with _shard_pair_lock(dll): + _recover_shard_pair_locked(dll) + if (preserve_existing and _runtime_valid_shard_pair_locked( + dll, ranges, expected_existing_abi)): + return False + if candidate_cap is not None: + capacity_error = _candidate_capacity_projection_error( + total, counts, projected, projected_raw, + projected_range_links, projected_files, staged_count, + candidate_cap) + if capacity_error is not None: + raise ShardCandidateCapacityError(capacity_error) + txn = { + 'schema': 'psxrecomp shard pair transaction v1', + 'token': token, + 'backup_dll': backup_dll, + 'backup_ranges': backup_ranges, + 'old_dll_sha256': _file_sha256(dll), + 'old_ranges_sha256': _file_sha256(ranges), + 'new_dll_sha256': _file_sha256(staged_dll), + 'new_ranges_sha256': _file_sha256(staged_ranges), + } + if txn['new_dll_sha256'] is None or txn['new_ranges_sha256'] is None: + raise RuntimeError('staged DLL/ranges disappeared before publication') + _write_json_atomic(journal_path, txn) + try: + if txn['old_dll_sha256'] is not None: + os.replace(dll, backup_dll) + if txn['old_ranges_sha256'] is not None: + os.replace(ranges, backup_ranges) + + # The new manifest alone is inert. Publishing the DLL is the commit. + os.replace(staged_ranges, ranges) + os.replace(staged_dll, dll) + _recover_shard_pair_locked(dll) # recognizes committed hashes + except BaseException: + _recover_shard_pair_locked(dll) + raise + return True + + +def _dll_abi_matches(dll_path: str, expected_abi: int) -> bool: + """Read overlay_abi from one loaded image, then release it immediately.""" + import _ctypes + import ctypes + library = None + try: + # Shards are generated as ordinary C (cdecl). ctypes.WinDLL selects + # stdcall and can corrupt a 32-bit Windows caller's stack; CDLL is the + # correct loader on every supported host (x64 merely masks the error). + library = ctypes.CDLL(dll_path) + abi_fn = library.overlay_abi + abi_fn.argtypes = [] + abi_fn.restype = ctypes.c_int + return (abi_fn() & 0xFFFFFFFF) == (expected_abi & 0xFFFFFFFF) + except (OSError, AttributeError): + return False + finally: + if library is not None and library._handle: + handle = library._handle + library._handle = 0 + if os.name == 'nt': + _ctypes.FreeLibrary(handle) + else: + _ctypes.dlclose(handle) + + +def _dll_pair_id_matches(dll_path: str, expected_pair_id: int) -> bool: + """Read overlay_pair_id from one loaded image, then release it.""" + import _ctypes + import ctypes + library = None + try: + library = ctypes.CDLL(dll_path) + pair_fn = library.overlay_pair_id + pair_fn.argtypes = [] + pair_fn.restype = ctypes.c_uint64 + return pair_fn() == (expected_pair_id & 0xFFFFFFFFFFFFFFFF) + except (OSError, AttributeError): + return False + finally: + if library is not None and library._handle: + handle = library._handle + library._handle = 0 + if os.name == 'nt': + _ctypes.FreeLibrary(handle) + else: + _ctypes.dlclose(handle) + + +def _dll_runtime_exports_match(dll_path: str, expected_abi: int | None, + expected_pair_id: int | None, + entries: set[int]) -> bool: + """Validate the exports the runtime needs in one library mapping.""" + import _ctypes + import ctypes + library = None + try: + library = ctypes.CDLL(dll_path) + abi_fn = library.overlay_abi + abi_fn.argtypes = [] + abi_fn.restype = ctypes.c_int + if (expected_abi is not None and + (abi_fn() & 0xFFFFFFFF) != (expected_abi & 0xFFFFFFFF)): + return False + try: + pair_fn = library.overlay_pair_id + except AttributeError: + if expected_pair_id is not None: + return False + else: + if expected_pair_id is None: + return False + pair_fn.argtypes = [] + pair_fn.restype = ctypes.c_uint64 + if pair_fn() != (expected_pair_id & 0xFFFFFFFFFFFFFFFF): + return False + getattr(library, 'overlay_init') + getattr(library, 'overlay_flush_cycles') + for entry in entries: + # Exports are named by the entry's full VA (§5.1, §5.7). + getattr(library, f'func_{entry:08X}') + return True + except (OSError, AttributeError): + return False + finally: + if library is not None and library._handle: + handle = library._handle + library._handle = 0 + if os.name == 'nt': + _ctypes.FreeLibrary(handle) + else: + _ctypes.dlclose(handle) + + +def compiled_shard_complete(dll_path: str, + expected_abi: int | None = None) -> bool: + """Whether the pair satisfies the runtime's manifest/export contract.""" + return bool(load_shard_func_ids(dll_path, expected_abi)) + + +def shard_pair_files_complete(dll_path: str) -> bool: + """Filesystem-only completeness used by crash-transaction tests.""" + ranges = os.path.splitext(dll_path)[0] + '.ranges' + with _shard_pair_lock(dll_path): + _recover_shard_pair_locked(dll_path) + return (os.path.isfile(dll_path) and + os.path.getsize(dll_path) > 0 and + os.path.isfile(ranges) and + os.path.getsize(ranges) > 0) + + +def cached_shard_manifest_status(dll_path: str, expected_abi: int | None, + expected_manifest: str, + expected_pair_id: int | None = None) -> str: + """Return ``match``, ``mismatch``, or ``missing`` under the pair lock.""" + ranges = os.path.splitext(dll_path)[0] + '.ranges' + with _shard_pair_lock(dll_path): + _recover_shard_pair_locked(dll_path) + complete = (os.path.isfile(dll_path) and + os.path.getsize(dll_path) > 0 and + os.path.isfile(ranges) and + os.path.getsize(ranges) > 0) + if not complete: + return 'missing' + try: + with open(ranges) as f: + actual_manifest = f.read() + except OSError: + return 'missing' + if expected_pair_id is not None: + if (expected_abi is not None and + not _dll_abi_matches(dll_path, expected_abi)): + # A stale flavor/ABI is replaceable, not an identity collision. + return 'missing' + try: + entries = { + int(parts[1], 16) + for parts in (line.split() + for line in actual_manifest.splitlines()) + if len(parts) >= 3 and parts[0] == 'F' + } + except ValueError: + return 'mismatch' + if (not entries or not _dll_runtime_exports_match( + dll_path, None, expected_pair_id, entries)): + return 'mismatch' + elif (expected_abi is not None and + not _dll_abi_matches(dll_path, expected_abi)): + return 'missing' + return 'match' if actual_manifest == expected_manifest else 'mismatch' + + +# --------------------------------------------------------------------------- +# Main +# --------------------------------------------------------------------------- + +# --------------------------------------------------------------------------- +# Static mode (--static): per-capture worker + split output writer +# --------------------------------------------------------------------------- + +def static_capture_job(cap: dict, args, toml: dict, forced_interiors: set, + static_out: str) -> dict: + """Recompile ONE capture for static mode. Module-level and self-contained so + it can run in a worker process (ProcessPoolExecutor needs a picklable + callable and picklable arguments: the capture dict, the argparse Namespace, + the parsed game.toml, the forced-interior set). + + Nothing here touches shared state. Everything the sequential path used to + write into main()'s accumulators comes back in the result and is merged by + the caller in canonical capture order, so the emitted C is byte-identical + whether --jobs is 1 or 12. Prints go to result['log'] instead of stdout so + parallel workers never interleave. + + result: label, outcome ('ok' | 'skip' | 'fail'), fail=(class, detail), + part (the static_parts entry, or None), + requested_entries (set of (entry, image_crc)), + entry_sources ({(entry, image_crc): (data, load_addr, size, + phys_addr, guard_bytes)}), log. + + Requested entries are keyed by (entry, image crc), never by the bare + address: the dispatcher validates every variant against the exact bytes + it was compiled from, so a demand is only served by a variant built from + THIS capture's bytes. Two captures of one band that both observed an + address are two demands (see the isolated-fragment pass in main()). + """ + result = {'label': None, 'outcome': None, 'fail': None, 'part': None, + 'requested_entries': set(), 'entry_sources': {}, 'log': ''} + log = io.StringIO() + with contextlib.redirect_stdout(log): + try: + _static_capture_job(cap, args, toml, forced_interiors, static_out, + result) + finally: + result['log'] = log.getvalue() + return result + + +def _static_capture_job(cap, args, toml, forced_interiors, static_out, result): + # Runs in a worker process too, so it sets its image segment itself. + with image_segment(segment_of(int(cap['load_addr'], 16))): + _static_capture_job_in_segment(cap, args, toml, forced_interiors, + static_out, result) + + +def _static_capture_job_in_segment(cap, args, toml, forced_interiors, + static_out, result): + load_addr = int(cap['load_addr'], 16) + size = int(cap['size']) + data = base64.b64decode(cap['bytes_b64']) + crc32 = binascii.crc32(data) & 0xFFFFFFFF + phys_addr = (load_addr & 0x1FFFFFFF) + _label = f'overlay 0x{load_addr:08X} crc {crc32:08X}' + result['label'] = _label + # Trailing delay-slot guard words appended by the capture writer. + # Declared to the recompiler through the PS-EXE analysis-bound tag so + # they stay readable but are never discovered as code. + guard_bytes = capture_guard_bytes(cap, size, _label) + + def fail(cls, detail): + result['outcome'] = 'fail' + result['fail'] = (cls, detail) + + for captured_entry in _parse_addr_list(cap.get('dispatch_entry_pcs', [])): + entry = _canonical_guest_addr(captured_entry) + key = (entry, crc32) + result['requested_entries'].add(key) + result['entry_sources'][key] = ( + data, load_addr, size, phys_addr, guard_bytes) + # --force-interior is an explicit operator assertion that a live dispatch + # entry was observed even if the retained capture lost its classifier + # provenance. Bind the requested PC to this capture's exact bytes; the + # post-pass builds a content-validated isolated shard for it. + region_hi = phys_addr + size + for forced_entry in forced_interiors: + forced_phys = forced_entry & 0x1FFFFFFF + if (phys_addr <= forced_phys < region_hi and + segment_of(forced_entry) == segment_of(load_addr)): + entry = forced_entry + key = (entry, crc32) + result['requested_entries'].add(key) + result['entry_sources'][key] = ( + data, load_addr, size, phys_addr, guard_bytes) + + seeds, seed_audit = classify_overlay_seeds(cap, data, load_addr, size, + crc32, toml) + print(f'Overlay load=0x{load_addr:08X} size={size} crc32=0x{crc32:08X}' + + (f' guard={guard_bytes}B (delay-slot only, not analysed)' + if guard_bytes else '')) + print(f' seeds: {len(seeds)} mode: static -> {static_out}') + print_seed_audit(seed_audit) + + root_seeds = [ + seed for seed in seeds + if ((seed.split()[0] in ('call_root', 'dispatch_root')) or + seed.split()[0].startswith('0x')) + ] + if not root_seeds: + print(f' {NO_SHARED_WALK_ROOT_SEEDS_SKIP}\n') + result['outcome'] = 'skip' + return + + with tempfile.TemporaryDirectory() as tmp: + # Fake PS-EXE: the header entry PC becomes a walk root in the + # recompiler, so it must be a walk-root seed, never an interior one. + entry_pc = int(root_seeds[0].split()[-1], 16) + psx_path = os.path.join(tmp, f'overlay_{load_addr:08X}.psx') + with open(psx_path, 'wb') as f: + f.write(make_psxexe(load_addr, entry_pc, data, + guard_bytes=guard_bytes)) + seeds_path = os.path.join(tmp, 'seeds.txt') + with open(seeds_path, 'w') as f: + for seed in seeds: + f.write(seed + '\n') + out_dir_tmp = os.path.join(tmp, 'out') + os.makedirs(out_dir_tmp) + + # Evidence-scoped discovery (the overlay-compilation contract): compile + # only the proven entry seeds and what they reach, never a whole-byte + # sweep. Same invocation as the DLL path. + cmd = [args.recompiler, psx_path, + '--seeds', seeds_path, + '--out-dir', out_dir_tmp, + '--overlay', + '--ws-config', os.path.abspath(args.game_toml)] + cmd += recompiler_project_root_args(args) + print(f' recompile: {args.recompiler} ...{" [CPS]" if args.cps else ""}') + toml_dir = os.path.dirname(os.path.abspath(args.game_toml)) + sub_env = dict(os.environ) + if args.cps: + sub_env['PSX_CPS'] = '1' # §25: emit continuation-passing overlay C + r = subprocess.run(cmd, capture_output=True, text=True, + cwd=toml_dir, env=sub_env) + if r.returncode != 0: + print(f' RECOMPILER ERROR:\n{r.stderr or r.stdout}') + fail('recompiler', r.stderr or r.stdout) + return + + stem = os.path.basename(psx_path) + full_c = os.path.join(out_dir_tmp, stem + '_full.c') + if not os.path.exists(full_c): + candidates = [f for f in os.listdir(out_dir_tmp) if f.endswith('_full.c')] + if not candidates: + print(f' ERROR: no _full.c in {out_dir_tmp}') + fail('no_output', 'no _full.c emitted') + return + full_c = os.path.join(out_dir_tmp, candidates[0]) + with open(full_c) as f: + src = f.read() + ranges_src = None + for fn in os.listdir(out_dir_tmp): + if fn.endswith('_full.ranges'): + ranges_src = os.path.join(out_dir_tmp, fn) + break + + src, func_addrs = patch_generated_c_static(src, load_addr, size) + continuation_owners = parse_cps_continuation_owners(src) + c_audit = audit_generated_c(src, load_addr, size, crc32, toml) + print_generated_c_audit(load_addr, size, crc32, c_audit) + if c_audit['unknown_bad'] or c_audit['unsupported_todo_addrs']: + print(' GENERATED-C AUDIT FAILED\n') + fail('audit', f'{len(c_audit["unknown_bad"])} unknown_bad, ' + f'{len(c_audit["unsupported_todo_addrs"])} unsupported') + return + if not ranges_src: + print(' STATIC RANGE AUDIT FAILED: no _full.ranges manifest\n') + fail('no_ranges', 'no _full.ranges manifest') + return + + func_ids = parse_overlay_func_ids(ranges_src, data, load_addr, size) + ids_by_addr = {} + for ev, code_crc, ranges in func_ids: + ids_by_addr.setdefault(ev, []).append((code_crc, ranges)) + missing = sorted(set(func_addrs) - set(ids_by_addr)) + if missing: + sample = ', '.join(f'0x{a:08X}' for a in missing[:8]) + print(f' STATIC RANGE AUDIT FAILED: {len(missing)} ' + f'dispatchable function(s) lack exact ranges: {sample}\n') + fail('static_ranges', f'{len(missing)} funcs lack exact ranges') + return + + # Whole-image identity plus compiled-entry coverage makes the namespace + # deterministic while allowing a later, richer seed capture of + # identical bytes to coexist without symbol clashes. + cov_blob = ','.join(f'{a:08X}' for a in sorted(func_addrs)).encode() + cov_crc = binascii.crc32(cov_blob) & 0xFFFFFFFF + # A KUSEG or KSEG1 image of the same bytes links beside the KSEG0 one + # (§5.7): ov_s0_… and ov_s5_…; KSEG0 keeps its name. + seg_tag = ('' if segment_of(load_addr) == KSEG0 + else f's{segment_of(load_addr) >> 29}_') + namespace = f'ov_{seg_tag}{phys_addr:08X}_{crc32:08X}_{cov_crc:08X}' + src, symbols = namespace_generated_static(src, namespace, func_addrs) + variants = [] + for ev in sorted(func_addrs): + for code_crc, ranges in ids_by_addr[ev]: + variants.append({ + 'addr': ev, + 'symbol': symbols[ev], + 'crc': code_crc, + 'ranges': ranges, + }) + result['part'] = { + 'src': src, + 'variants': variants, + 'namespace': namespace, + 'image_crc': crc32, + 'func_addrs': set(func_addrs), + 'symbols': symbols, + 'ids_by_addr': ids_by_addr, + 'continuation_owners': continuation_owners, + } + print(f' recompiled: {len(func_addrs)} functions, ' + f'{len(variants)} exact identities\n') + result['outcome'] = 'ok' + + +STATIC_HEADER = ('/* Auto-generated overlay dispatch -- do not edit.\n' + ' * Rebuild: python3 psxrecomp/tools/compile_overlays.py --static ...\n' + ' */\n') +_STATIC_PART_RE = re.compile(r'_(\d{4})\.c$') + + +def static_part_paths(static_out: str) -> list: + """Existing split-output part files next to static_out, sorted.""" + d = os.path.dirname(static_out) or '.' + stem = os.path.splitext(os.path.basename(static_out))[0] + if not os.path.isdir(d): + return [] + out = [] + for fn in os.listdir(d): + if fn.startswith(stem + '_') and _STATIC_PART_RE.search(fn): + out.append(os.path.join(d, fn)) + return sorted(out) + + +def _write_if_changed(path: str, text: str) -> bool: + """Write only when the content differs, so an unchanged translation unit + keeps its mtime and the build system does not recompile it.""" + try: + with open(path, encoding='utf-8') as f: + if f.read() == text: + return False + except (OSError, UnicodeDecodeError): + pass + with open(path, 'w', encoding='utf-8', newline='\n') as f: + f.write(text) + return True + + +def write_static_outputs(static_out: str, parts: list, variants: list, + dispatch_src: str, single_file: bool = False) -> list: + """Emit the static overlay C. + + Default (split): `static_out` holds the content-validated dispatcher plus + an extern prototype for every compiled entry, and each part becomes its own + translation unit `_NNNN.c` beside it. Every part already carries its + own #includes and a private symbol namespace, so it compiles standalone. + The build then parallelizes across parts, and because unchanged parts are + not rewritten, only overlays whose code changed recompile. Stale parts from + a previous, larger run are deleted so a glob never links a leftover. + + single_file: the pre-split behaviour, everything in `static_out`. + + Returns the list of files that make up the output (written or unchanged). + """ + stale = static_part_paths(static_out) + if single_file: + combined = STATIC_HEADER + for part in parts: + combined += part['src'] + combined += dispatch_src + _write_if_changed(static_out, combined) + for p in stale: + os.remove(p) + return [static_out] + + d = os.path.dirname(static_out) or '.' + stem = os.path.splitext(os.path.basename(static_out))[0] + # One unit per region part, plus one unit per IMAGE for its isolated + # fragments. Fragments are per (entry, image) and a band with many + # occupants carries thousands of them (BoF3: 20k), so a unit per fragment + # would mean 20k files for the glob and 20k compiler launches. Fragment + # parts are privately namespaced, so concatenating an image's fragments + # is safe; keeping them apart from the region unit means a new fragment + # rewrites only its image's fragment unit, never the region. + units = [] # (label, [parts]) + frag_units = {} + for part in parts: + if part['namespace'].startswith('ov_frag_'): + key = part['namespace'].rsplit('_', 1)[0] # ov_frag__ + if key not in frag_units: + frag_units[key] = [key + '_fragments', []] + units.append(frag_units[key]) + frag_units[key][1].append(part) + else: + units.append([part['namespace'], [part]]) + written = [] + for index, (label, unit_parts) in enumerate(units): + path = os.path.join(d, f'{stem}_{index:04d}.c') + # No part COUNT in the header: adding or dropping an overlay must leave + # every unchanged unit byte-identical (and therefore not rebuilt). + text = (STATIC_HEADER + + f'/* Static overlay translation unit {index}: {label} */\n' + + ''.join(part['src'] for part in unit_parts)) + _write_if_changed(path, text) + written.append(path) + keep = set(written) + for p in stale: + if p not in keep: + os.remove(p) + + symbols = sorted({variant['symbol'] for variant in variants}) + main = STATIC_HEADER + main += '#include "psx_runtime.h"\n\n' + main += (f'/* Dispatcher for {len(written)} overlay translation unit(s) ' + f'({stem}_0000.c ...). Every compiled entry has external linkage ' + f'in its own unit; declare them here. */\n') + main += ''.join(f'void {sym}(CPUState *cpu);\n' for sym in symbols) + main += dispatch_src + _write_if_changed(static_out, main) + return [static_out] + written + + + +def main(): + ap = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument('--captures', default=None, + help='overlay_captures.json from the runtime. Optional: the ' + 'runtime injects PSX_OVERLAY_CAPTURES (the canonical ' + '/overlay_captures.json), which wins. Required only ' + 'for manual/offline invocation.') + ap.add_argument('--game-toml', required=True, + help='game.toml (for game_id)') + ap.add_argument('--recompiler', required=True, + help='path to psxrecomp-game.exe') + ap.add_argument('--runtime-include', required=True, + help='path to psxrecomp runtime/include dir') + ap.add_argument('--project-root', default=None, + help='root the recompiler resolves the BIOS profile against ' + '(bios/SCPH1001.toml, or /bios/SCPH1001.toml ' + 'one level down). Defaults to the framework root derived ' + 'from --runtime-include. Only needed when that ' + 'derivation is wrong, because we spawn the recompiler ' + 'with cwd = dirname(game.toml) and a PACKAGED game.toml ' + 'lives in a directory with no BIOS profile under it.') + ap.add_argument('--out-dir', default='build-dev/cache', + help='cache root dir (default: build-dev/cache)') + ap.add_argument('--gcc', default='gcc', + help='GCC binary (default: gcc)') + ap.add_argument('--compiler', choices=['gcc', 'tcc'], default='gcc', + help='overlay shard compiler: gcc (default; dev/production, ' + 'best-optimized) or tcc (bundled, toolchain-free user ' + 'fallback). tcc shards land in the tcc/ cache namespace.') + ap.add_argument('--tcc', default='tcc', + help='TinyCC binary (used when --compiler tcc)') + ap.add_argument('--force', action='store_true', + help='recompile even if output already exists') + ap.add_argument('--only-region', action='append', default=[], + help='compile only captures whose normalized load address ' + 'matches this value (repeatable; manual validation aid)') + ap.add_argument('--check', action='store_true', + help='PREFLIGHT: build every shard into a throwaway temp dir ' + '(implies --force, ignores any injected cache dir, never ' + 'touches the real cache) and report pass/fail. Answers ' + '"would this game\'s shards compile against the CURRENT ' + 'recompiler + runtime headers?" — exits non-zero if any ' + 'shard that should build fails. Use after a header/ABI ' + 'or emitter change to catch silent shard breakage.') + ap.add_argument('--force-interior', action='append', default=[], + help='also compile this virtual/physical PC as an isolated ' + 'interior fragment (repeatable; diagnostic recovery for ' + 'an observed dispatch PC whose classifier provenance was ' + 'lost after a later capture)') + ap.add_argument('--static-single-file', action='store_true', + help='with --static: emit one monolithic overlays_static.c ' + '(pre-split behaviour) instead of the dispatcher plus ' + 'one translation unit per overlay.') + ap.add_argument('--static', action='store_true', + help='B-2 mode: compile into binary (overlays_static.c) instead of DLL') + ap.add_argument('--flavor', type=int, default=0, + help='codegen flavor id baked into overlay_abi() (0=base/master; ' + 'widescreen build passes 1). The loader rejects DLLs whose ' + 'flavor != the runtime flavor, keeping caches separate.') + ap.add_argument('--cps', action='store_true', + help='continuation-passing (RECURSION_BUG.md §25): set PSX_CPS ' + 'when invoking the recompiler so overlay funcs tail-transfer ' + '+ carry an entry-switch. Must match the runtime build.') + ap.add_argument('--jobs', type=int, + default=max(1, (os.cpu_count() or 4) - 2), + help='parallel region-group workers (default: cores-2). ' + 'Captures are grouped by region start; regions are ' + 'independent (dedup coverage, prior-ranges merge, ' + 'fragments, and filenames all key on the region), ' + 'captures within one region stay ordered. 1 = the ' + 'sequential path. In --static mode each capture is an ' + 'independent recompile+audit, run in a process pool ' + 'and merged in capture order (byte-identical output ' + 'to the sequential path).') + ap.add_argument('--target-os', choices=['auto', 'win', 'linux', 'macos'], default='auto', + help='target operating system for compiled overlay shards (default: auto)') + args = ap.parse_args() + target_os = args.target_os + if target_os == 'auto': + if 'mingw' in args.gcc.lower() or 'w64' in args.gcc.lower() or args.gcc.lower().endswith('.exe'): + target_os = 'win' + else: + target_os = None + set_target_os(target_os) + # Canonicalized to KSEG0 as before (a physical and a KUSEG PC are the + # same number); a forced interior therefore forces KSEG0 views. + forced_interiors = { + (int(v, 0) & 0x1FFFFFFF) | KSEG0 + for v in args.force_interior + } + + # ---- Framework-injected cache location wins over CLI flags ---------------- + # The runtime (autocompile.c) exports PSX_OVERLAY_CACHE_DIR / PSX_OVERLAY_CAPTURES + # set to the loader's CANONICAL /cache and /overlay_captures.json. We + # honor those above --out-dir/--captures so the WRITE cache and READ captures + # are always exactly where the loader reads — no per-game config, no drift + # between dev and prod (the read/write-location divergence bug). The CLI flags + # remain the fallback for manual/offline invocation (no env set). + # --check is a preflight: it must NEVER write the real cache, so it ignores + # the injected cache dir and builds into a throwaway temp dir with --force. + _check_tmp = None + if args.check: + args.force = True + _check_tmp = tempfile.mkdtemp(prefix='shardcheck_') + args.out_dir = _check_tmp + print(f'[check] preflight build into throwaway dir: {_check_tmp}') + _env_out = None if args.check else os.environ.get('PSX_OVERLAY_CACHE_DIR') + if _env_out: + if _env_out != args.out_dir: + print(f'[cache] PSX_OVERLAY_CACHE_DIR overrides --out-dir: {_env_out}') + args.out_dir = _env_out + _env_cap = os.environ.get('PSX_OVERLAY_CAPTURES') + if _env_cap: + if _env_cap != args.captures: + print(f'[cache] PSX_OVERLAY_CAPTURES overrides --captures: {_env_cap}') + args.captures = _env_cap + # Flavor is pinned by the spawning runtime the same way as the cache + # locations: --flavor defaults to 0 (play), so an instrumented (flavor 2) + # runtime used to spawn compiles whose shards its loader then rejected — + # every overlay ran interpreted on debug builds, silently. + _env_flavor = os.environ.get('PSX_OVERLAY_FLAVOR') + if _env_flavor: + try: + _fl = int(_env_flavor, 0) + except ValueError: + _fl = None + if _fl is not None and _fl != args.flavor: + print(f'[cache] PSX_OVERLAY_FLAVOR overrides --flavor: {_fl}') + args.flavor = _fl + if not args.captures: + ap.error('no captures file: set PSX_OVERLAY_CAPTURES (runtime injects it) ' + 'or pass --captures for manual/offline use') + + # Resolve the recompiler exe and runtime-include to absolute paths up front. + # game.toml's overlay_autocompile_cmd uses paths RELATIVE to the project root + # (the runtime spawns this script via cmd.exe with cwd = project root) so the + # shipped config is portable across machines — never bake absolute paths into + # game.toml. But two Windows quirks break relative paths once we hand them off: + # 1. subprocess/CreateProcess does NOT resolve a relative *executable* + # against the child cwd (the recompiler spawn below, cwd=toml_dir), so a + # relative --recompiler fails with WinError 2 and the cache never warms. + # 2. gcc launched from cmd.exe rejects relative forward-slash -I/-c/-o paths + # (already handled inside compile_dll via os.path.abspath). + # Anchoring both here (against this process's cwd = project root, where the + # relative paths are meant to resolve) makes relative config work everywhere. + args.recompiler = os.path.abspath(args.recompiler) + args.runtime_include = os.path.abspath(args.runtime_include) + + # Load the shard link-contract preamble from runtime/include up front (hard + # error if absent). Threads/fragments read the module global thereafter. + load_dispatch_preamble(args.runtime_include) + + # Read game ID from game.toml (strip BOM if present) + with open(args.game_toml, 'rb') as f: + raw = f.read().lstrip(b'\xef\xbb\xbf') # UTF-8 BOM + toml = tomllib.loads(raw.decode('utf-8')) + game_id = toml.get('game', {}).get('id', 'UNKNOWN') + print(f'Game ID: {game_id}') + + # Stale-recompiler-binary guard — BOTH modes (static overlays are just as + # wrong when emitted by a stale binary; they simply have no tag to hide in). + verify_recompiler_matches_tag(args.recompiler, codegen_hash(args.runtime_include)) + + if args.static: + static_out = os.path.join(args.out_dir, 'overlays_static.c') + if os.path.exists(static_out) and not args.force: + print(f'SKIP: {static_out} already exists (use --force to recompile)') + return + os.makedirs(args.out_dir, exist_ok=True) + else: + # Namespaced + versioned gcc cache: + # /gcc//cg__gc/ + # (SLJIT.md §4 — no comingling; cg = codegen version so a new emitter + # build never reuses a stale DLL, old versions coexist). MUST match + # overlay_loader.c scan_cache_dir(). Pre-1.0: no legacy fallback. + cg = codegen_ver(args.runtime_include) + ch = codegen_hash(args.runtime_include) + gh = overlay_config_hash(args.recompiler, args.game_toml) + cache_dir = os.path.join(args.out_dir, game_id, args.compiler, cache_arch_abi(), + cache_tag(args.runtime_include, args.recompiler, + args.game_toml, args.flavor)) + os.makedirs(cache_dir, exist_ok=True) + print(f'Cache dir: {cache_dir} ' + f'(codegen ver {cg}, emitter {ch:08x}, config {gh:08x})') + + with open(args.captures) as f: + captures = json.load(f) + + if args.only_region: + only_regions = {int(value, 0) & 0x1FFFFFFF + for value in args.only_region} + captures = [cap for cap in captures + if (int(cap['load_addr'], 16) & 0x1FFFFFFF) in only_regions] + if not captures: + ap.error('--only-region did not match any capture') + + # One view per (capture, segment with entries), §5.7. A capture whose + # segment record is malformed is reported and not compiled. + segment_view_errors = [] + views = [] + for cap in captures: + try: + views.extend(capture_segment_views( + cap, declared_view_segments(cap, toml, forced_interiors))) + except (KeyError, TypeError, ValueError, RuntimeError) as exc: + segment_view_errors.append( + (f'overlay {cap.get("load_addr", "?")}', str(exc))) + if len(views) != len(captures) or segment_view_errors: + by_seg = Counter(SEGMENT_NAMES[segment_of(int(v['load_addr'], 16))] + for v in views) + print(f'Segment views: {len(captures)} capture(s) -> {len(views)} ' + 'view(s) (' + ', '.join(f'{n} {name}' for name, n in + sorted(by_seg.items())) + ')') + captures = views + + print(f'Captures: {len(captures)} overlay(s) to process\n') + + # B-2 static mode: accumulate privately-namespaced generated C plus exact + # per-function identities for the content-validated dispatcher. + static_parts = [] + static_requested_entries = set() + static_entry_sources = {} + + # overlay-cache v2: per-region_start function-identity coverage, so a capture + # that adds no NEW (entry, code_crc) skips the gcc compile (volatile-data + # redundant-build elimination). Lazily loaded from existing .ranges, kept warm + # in-memory and updated as we build, so repeats within one run also dedup. + region_coverage_cache = {} # phys_addr -> set((ev, code_crc)) + cov_lock = threading.Lock() # guards region_coverage_cache + its sets + # Per-region info for the post-loop interior-entry fragment pass (decoupled + # from region-compile success): (phys, load_addr, size, data, interior_pcs, + # executed_pcs). Collected right after classification so it survives a region + # whose own compile is skipped or audit-fails. + interior_frag_jobs = [] + pending_empty_primary = [] + + def _merge_static_result(res): + """Fold one static_capture_job result into the shared accumulators. + Called in canonical capture order for both the sequential and the + --jobs path, so static_parts / entry sources are order-identical.""" + if res['log']: + print(res['log'], end='') + static_requested_entries.update(res['requested_entries']) + static_entry_sources.update(res['entry_sources']) + if res['outcome'] == 'ok': + static_parts.append(res['part']) + stats.add_ok() + elif res['outcome'] == 'skip': + stats.add_skip() + else: + cls, detail = res['fail'] + stats.add_fail(res['label'], cls, detail) + + # Per-capture body, extracted so the region-parallel driver below can call + # it. All shared state is either read-only closure (args/toml/cache_dir) + # or passed per-region (region_coverage_cache / interior_frag_jobs), so a + # worker owning a region owns every mutable it touches. + def _do_capture(cap, region_coverage_cache, interior_frag_jobs, stats): + # A capture view compiles in its own segment (§5.7): helpers that name + # PCs spell them in it, and its shard lives in that segment's cache + # directory. + with image_segment(segment_of(int(cap['load_addr'], 16))): + _do_capture_in_segment(cap, region_coverage_cache, + interior_frag_jobs, stats) + + def _do_capture_in_segment(cap, region_coverage_cache, interior_frag_jobs, + stats): + load_addr = int(cap['load_addr'], 16) + size = int(cap['size']) + data = base64.b64decode(cap['bytes_b64']) + crc32 = binascii.crc32(data) & 0xFFFFFFFF + phys_addr = (load_addr & 0x1FFFFFFF) + _label = f'overlay 0x{load_addr:08X} crc {crc32:08X}' + # Trailing delay-slot guard words appended by the capture writer. + # Declared to the recompiler through the PS-EXE analysis-bound tag so + # they stay readable but are never discovered as code. + guard_bytes = capture_guard_bytes(cap, size, _label) + if args.static: + # Static mode is one self-contained job per capture (see + # static_capture_job); the sequential and --jobs paths share it. + _merge_static_result(static_capture_job( + cap, args, toml, forced_interiors, static_out)) + return + seg_cache_dir = segment_cache_dir(cache_dir, segment_of(load_addr)) + # Coverage is per segment: each segment's shards are their own. + coverage_key = (segment_of(load_addr), phys_addr) + + # Reclassify prior F entry addresses from an identical image. Callable + # entries may become current roots; other entries re-enter as dispatch + # candidates and require a current exact host. Never reuse prior R host + # ranges: later roots can repartition the same bytes incompatibly. + if not args.static: + ranges_name = f'{phys_addr:08X}_{crc32:08X}.ranges' + prior_ranges_path = os.path.join(seg_cache_dir, ranges_name) + if os.path.exists(prior_ranges_path): + prior_entries = [] + with open(prior_ranges_path) as pf: + for ln in pf: + parts = ln.split() + if parts and parts[0] == 'F': + try: + prior_entries.append(int(parts[1], 16)) + except (IndexError, ValueError): + pass + if prior_entries: + fe = _parse_addr_list(cap.get('function_entry_pcs', [])) + de = _parse_addr_list(cap.get('dispatch_entry_pcs', [])) + for a in prior_entries: + if _callable_legacy_seed(data, load_addr, a): + fe.add(a) + else: + de.add(a) + cap['function_entry_pcs'] = sorted(fe) + cap['dispatch_entry_pcs'] = sorted(de) + cap.setdefault('schema', 'merged') + print(f' merged {len(prior_entries)} prior-manifest entries ' + f'from {prior_ranges_path}') + + seeds, seed_audit = classify_overlay_seeds(cap, data, load_addr, size, + crc32, toml) + this_ids = None # region func-ids once recompiled (None if skipped early) + + # Record this region's executed dispatch-proven PCs for the decoupled + # fragment pass (runs after the loop, regardless of this region's + # compile outcome). Interiors AND callable dispatch roots both go in: + # a callable root can be starved by the DLL-already-exists skip when + # an OLDER capture of the same image bytes built this region's DLL + # before the PC became dispatch-proven (same filename, stale entry + # set — the 0x80024548 class), and the fragment pass is the demand- + # driven recovery path for exactly that. + if not args.static: + # A manual exact demand must not depend on the capture still + # retaining executed_pcs or on today's classifier assigning the PC + # DISPATCH_INTERIOR. That provenance is precisely what + # --force-interior restores. Keep it isolated from the shared + # region seed set and queue the fragment directly. + fragment_job = make_interior_fragment_job( + phys_addr, load_addr, size, data, seed_audit, + forced_interiors, cap) + if fragment_job is not None: + interior_frag_jobs.append(fragment_job) + + if not args.static: + dll_path = os.path.join(seg_cache_dir, + f'{phys_addr:08X}_{crc32:08X}{overlay_ext()}') + + print(f'Overlay load=0x{load_addr:08X} size={size} crc32=0x{crc32:08X}' + + (f' guard={guard_bytes}B (delay-slot only, not analysed)' + if guard_bytes else '')) + print(f' seeds: {len(seeds)} dll: {dll_path}') + print_seed_audit(seed_audit) + + demanded_root_entries = walk_root_seed_entries(seeds) + root_seeds = [ + seed for seed in seeds + if ((seed.split()[0] in ('call_root', 'dispatch_root')) or + seed.split()[0].startswith('0x')) + ] + if not root_seeds: + print(f' {NO_SHARED_WALK_ROOT_SEEDS_SKIP}\n') + stats.add_skip() + return + + # Cheap evidence-aware cache gate. A valid existing pair is not enough: + # a later capture can add roots for identical bytes. Skip reanalysis only + # when runtime-callable identities matching THIS byte variant already + # serve every current walk-root demand. The fragment job was queued + # above and still repairs any exact interior/static demand independently. + if not args.static and not args.force: + expected_abi = overlay_abi_tag( + args.runtime_include, args.flavor) + if cap.get('producer') == BIOS_RESIDENT_PRODUCER: + # A resident fast-path needs one canonical preloadable bundle; + # aggregate fragment coverage is insufficient because the + # sidecar names exactly one DLL stem. + current_entries, _current_ranges = ( + current_variant_func_id_coverage( + load_shard_func_ids(dll_path, expected_abi), + data, load_addr, size)) + else: + current_entries, _current_ranges = ( + load_region_current_variant_coverage( + seg_cache_dir, phys_addr, data, load_addr, size, + expected_abi)) + if demanded_root_entries <= { + _canonical_guest_addr(entry) + for entry in current_entries}: + reconcile_bios_resident_marker(dll_path, cap, False) + print(f' SKIP: runtime-valid current-byte cache serves all ' + f'{len(demanded_root_entries)} walk-root demand(s)\n') + stats.add_skip() + return + + with tempfile.TemporaryDirectory() as tmp: + # Write fake PS-EXE. The header entry PC becomes a walk root in the + # recompiler, so it must be a walk-root seed — never an 'interior' + # one. Root seed lines are either '0x...' or 'dispatch_root 0x...'. + entry_pc = int(root_seeds[0].split()[-1], 16) + psx_path = os.path.join(tmp, f'overlay_{load_addr:08X}.psx') + with open(psx_path, 'wb') as f: + f.write(make_psxexe(load_addr, entry_pc, data, + guard_bytes=guard_bytes)) + + # Write seeds file + seeds_path = os.path.join(tmp, 'seeds.txt') + with open(seeds_path, 'w') as f: + for s in seeds: + f.write(s + '\n') + + out_dir_tmp = os.path.join(tmp, 'out') + os.makedirs(out_dir_tmp) + + # Run psxrecomp-game in --overlay mode (always, for every overlay + # input). Evidence-scoped discovery: compile only the proven entry + # seeds and the code reachable from them; never whole-byte sweep + # (which decodes embedded data tables as code). Branch/jump-table + # targets stay as in-parent labels, not standalone functions. This + # is the overlay-compilation contract, not a tunable. + cmd = [args.recompiler, psx_path, + '--seeds', seeds_path, + '--out-dir', out_dir_tmp, + '--overlay', + # Forward the [widescreen] site lists so overlay-resident + # emits (backdrop screenX squash, and any sprite-tag/cull + # sites that resolve into overlay code) are applied. --ws-config + # only adopts the widescreen lists, not the game's exe/paths. + '--ws-config', os.path.abspath(args.game_toml)] + cmd += recompiler_project_root_args(args) + print(f' recompile: {args.recompiler} ...{" [CPS]" if args.cps else ""}') + toml_dir = os.path.dirname(os.path.abspath(args.game_toml)) + sub_env = dict(os.environ) + if args.cps: + sub_env['PSX_CPS'] = '1' # §25: emit continuation-passing overlay C + r = subprocess.run(cmd, capture_output=True, text=True, + cwd=toml_dir, env=sub_env) + if r.returncode != 0: + print(f' RECOMPILER ERROR:\n{r.stderr or r.stdout}') + stats.add_fail(_label, 'recompiler', r.stderr or r.stdout) + return + + # Find the generated _full.c + stem = os.path.basename(psx_path) + full_c = os.path.join(out_dir_tmp, stem + '_full.c') + if not os.path.exists(full_c): + # psxrecomp-game uses filename() not stem() + candidates = [f for f in os.listdir(out_dir_tmp) if f.endswith('_full.c')] + if not candidates: + print(f' ERROR: no _full.c in {out_dir_tmp}') + stats.add_fail(_label, 'no_output', 'no _full.c emitted') + return + full_c = os.path.join(out_dir_tmp, candidates[0]) + + with open(full_c) as f: + src = f.read() + + ranges_src = None + for fn in os.listdir(out_dir_tmp): + if fn.endswith('_full.ranges'): + ranges_src = os.path.join(out_dir_tmp, fn) + break + + # Post-process (DLL path; static mode returned early above) + src = patch_generated_c(src, load_addr, size) + c_audit = audit_generated_c(src, load_addr, size, crc32, toml) + print_generated_c_audit(load_addr, size, crc32, c_audit) + # Always save the debug copy for inspection — including on audit + # failure, so opcode gaps / boundary artifacts can be classified. + os.makedirs(os.path.dirname(dll_path), exist_ok=True) + debug_c = os.path.join(os.path.dirname(dll_path), + f'{crc32:08X}_patched.c') + with open(debug_c, 'w') as f: + f.write(src) + if c_audit['unknown_bad'] or c_audit['unsupported_todo_addrs']: + fallback = optional_enrichment_fallback_capture(cap) + if fallback is not None: + print(' OPTIONAL ENRICHMENT AUDIT REJECTED; ' + 'retrying conservative recipe\n') + _do_capture(fallback, region_coverage_cache, + interior_frag_jobs, stats) + return + print(' GENERATED-C AUDIT FAILED\n') + stats.add_fail(_label, 'audit', + f'{len(c_audit["unknown_bad"])} unknown_bad, ' + f'{len(c_audit["unsupported_todo_addrs"])} unsupported') + return + patched_c = os.path.join(tmp, 'overlay_patched.c') + with open(patched_c, 'w') as f: + f.write(src) + + # overlay-cache v2 dedup: compute this capture's per-function + # identity set BEFORE the (expensive) gcc compile. The loader + # content-matches each function by (entry, code_crc) across ALL + # DLLs at this region_start, so if every function we'd produce is + # already provided by an existing DLL, a new DLL adds nothing — + # skip the build. This is what stops volatile-data regions (a + # changing whole-region CRC over byte-identical code) from minting + # an endless pile of redundant DLLs. + this_ids = (parse_overlay_func_ids(ranges_src, data, load_addr, size) + if ranges_src else []) + delay_errors = audit_func_id_delay_slots( + this_ids, data, load_addr) + if delay_errors: + entry, pc, reason = delay_errors[0] + where = f' at 0x{pc:08X}' if pc is not None else '' + print(f' DELAY-SLOT IDENTITY AUDIT FAILED: ' + f'func 0x{entry:08X}{where}: {reason}\n') + stats.add_fail(_label, 'delay_slot_identity', reason) + return + this_set = {(ev, crc) for ev, crc, _ in this_ids} + + with cov_lock: + covered = region_coverage_cache.get(coverage_key) + if covered is None: + covered = load_region_coverage( + seg_cache_dir, phys_addr, + overlay_abi_tag(args.runtime_include, args.flavor)) + region_coverage_cache[coverage_key] = covered + fully_covered = (bool(this_set) and this_set <= covered + and not args.force + and cap.get('producer') != + BIOS_RESIDENT_PRODUCER) + if fully_covered: + print(f' SKIP: all {len(this_set)} function(s) already ' + f'covered by existing DLL(s) at this region — no new ' + f'native code to build\n') + stats.add_skip() + return + + if not this_ids: + print(' WARNING: recompiler emitted no usable _full.ranges -- ' + 'preserving any prior DLL/ranges pair; checking exact ' + 'fragment coverage after supplementation') + if cap.get('producer') == BIOS_RESIDENT_PRODUCER: + stats.add_fail(_label, 'no_ranges', + 'resident producer requires its canonical bundle') + else: + pending_empty_primary.append(( + _label, phys_addr, load_addr, size, data, + demanded_root_entries)) + return + missing_exports = { + entry for entry, _crc, _ranges in this_ids + if entry not in c_audit['defs'] + } + if missing_exports: + detail = ', '.join( + f'0x{entry:08X}' for entry in sorted(missing_exports)) + print(' GENERATED-C/MANIFEST EXPORT AUDIT FAILED: ' + f'{detail}\n') + stats.add_fail( + _label, 'manifest_exports', + f'{len(missing_exports)} manifest entries lack C definitions') + return + representability_error = validate_overlay_func_ids( + this_ids, 'region') + if representability_error: + print(' RANGE MANIFEST AUDIT FAILED: ' + f'{representability_error}\n') + stats.add_fail( + _label, 'manifest_ranges', representability_error) + return + pair_id = overlay_pair_id(src, this_ids) + src = add_overlay_pair_export(src, pair_id) + # Retained source is the exact source compiled into the DLL. + with open(patched_c, 'w') as f: + f.write(src) + + # Compile to DLL + include_dirs = [args.runtime_include] + recomp_root = os.path.dirname(os.path.dirname(args.recompiler)) + for lib_inc in ['lib/fmt/include']: + p = os.path.join(recomp_root, lib_inc) + if os.path.isdir(p): + include_dirs.append(p) + + publication = {} + success = compile_dll(patched_c, dll_path, include_dirs, + gcc=args.gcc, flavor=args.flavor, + compiler=args.compiler, tcc=args.tcc, + func_ids=this_ids, + pair_id=pair_id, + preserve_existing_pair=( + not args.force and + cap.get('producer') != + BIOS_RESIDENT_PRODUCER), + expected_existing_abi=overlay_abi_tag( + args.runtime_include, args.flavor), + publication_result=publication, + candidate_cap=overlay_candidate_cap( + args.runtime_include)) + if success: + # compile_dll transactionally published the per-entry range + # manifest beside the DLL from the same func-id list used by + # dedup. The loader keys it by the same filename stem. + ranges_out = os.path.splitext(dll_path)[0] + '.ranges' + if this_ids: + nfn = len(this_ids) + published = publication.get('published', True) + reconcile_bios_resident_marker( + dll_path, cap, published) + print(f' ranges: {nfn} functions -> {ranges_out}') + # New identities are now available for this region_start; + # keep the warm coverage set current so later captures in + # this same run dedup against them. (Parallel note: the + # check→build→update window is deliberately unlocked, so + # two concurrent captures can both build overlapping DLLs. + # That is redundancy, not corruption — the loader content- + # matches every function by (entry, code_crc) across all + # DLLs at a region.) + with cov_lock: + covered |= load_region_coverage( + seg_cache_dir, phys_addr, + overlay_abi_tag( + args.runtime_include, args.flavor)) + if published: + print(f' OK -> {dll_path}\n') + stats.add_ok() + else: + print(f' PRESERVED concurrent valid pair -> ' + f'{dll_path}\n') + stats.add_skip() + else: + print(' WARNING: recompiler emitted no _full.ranges — ' + 'loader will leave this region to the interpreter') + # A DLL with no .ranges is dead weight: the loader has no + # per-function identities to dispatch, so the region stays + # interpreted. Tally it as a failure, not a silent "OK". + stats.add_fail(_label, 'no_ranges', + 'DLL built but no _full.ranges (undispatchable)') + else: + if publication.get('capacity_error'): + print(' CACHE CAPACITY REACHED; shard left to the ' + 'interpreter\n') + stats.add_skip() + return + fallback = optional_enrichment_fallback_capture(cap) + if fallback is not None: + print(' OPTIONAL ENRICHMENT COMPILE REJECTED; ' + 'retrying conservative recipe\n') + _do_capture(fallback, region_coverage_cache, + interior_frag_jobs, stats) + return + print(f' FAILED\n') + stats.add_fail(_label, 'compile', + 'gcc/tcc compile failed (see COMPILE ERROR above)') + + # Interior-entry "island" fragments (overlay-cache v2): the FMV-driver class. + # Run as a SEPARATE pass AFTER all region compiles, so it is DECOUPLED from + # region success — an executed orphan interior gets its isolated island shard + # even if its region's trusted compile failed/audit-failed (that is the whole + # point of the separate failure domain). For each region, retain validated + # dispatch PCs even when shared CFG ownership dropped their interior seeds. + # Select those that ACTUALLY EXECUTED but that NO current DLL serves (orphan + # interiors — host never discovered, so the region can't alias them), and + # compile each as its OWN isolated _.dll that ENTERS at the + # interior PC (recovers no host). Isolated => a bad fragment fails alone and + # never poisons a region's trusted DLL. + def _do_frags(interior_frag_jobs, stats): + # Fragments compile per segment, like region shards (§5.7): a job's + # PCs, its shards and their directory are its capture view's segment. + # KSEG0 always runs (as before); the others only when they have jobs. + by_seg = {} + for job in interior_frag_jobs: + by_seg.setdefault(segment_of(job['load_addr']), []).append(job) + for seg in [KSEG0] + [s for s in (KUSEG, KSEG1) if s in by_seg]: + with image_segment(seg): + _do_frags_in_segment(by_seg.get(seg, []), stats, + segment_cache_dir(cache_dir, seg)) + + def _do_frags_in_segment(interior_frag_jobs, stats, cache_dir): + frag_env = dict(os.environ) + if args.cps: + frag_env['PSX_CPS'] = '1' + # Persistent doomed-interior memo: skip interiors already proven to fail + # audit from IDENTICAL bytes, so autocompile stops re-walking data-as-code + # every cycle. --force ignores the skip (re-attempts) for triage/debug. + fail_memo = load_interior_fail_memo(cache_dir) + memo_skipped = 0 + variant_coverage_cache = {} + expected_abi = overlay_abi_tag(args.runtime_include, args.flavor) + runtime_candidate_cap = overlay_candidate_cap(args.runtime_include) + capacity_probe = os.path.join( + cache_dir, f'00000000_00000000{overlay_ext()}') + candidate_capacity_exhausted, existing_candidates = \ + cache_candidate_capacity_full( + capacity_probe, expected_abi, runtime_candidate_cap) + if candidate_capacity_exhausted: + print(f' overlay candidate capacity already full: ' + f'{existing_candidates}/{runtime_candidate_cap}; ' + 'new fragments stay interpreted') + invocation_recipe = ( + expected_abi, int(args.flavor), bool(args.cps), args.compiler, + hashlib.sha256(json.dumps( + toml, sort_keys=True, separators=(',', ':'), + default=str).encode('utf-8')).hexdigest(), + ) + merged_jobs = merge_fragment_jobs_by_recipe( + interior_frag_jobs, invocation_recipe) + if len(merged_jobs) != len(interior_frag_jobs): + print(f' fragment recipes: merged {len(interior_frag_jobs)} capture ' + f'job(s) into {len(merged_jobs)} byte-variant recipe(s)') + + # A namespace that is already saturated cannot admit ordinary fragment + # growth. Avoid the expensive cross-variant donor/owner proof at this + # true fixed point, but preserve the only failure semantics that do not + # require that proof: a required executed demand already memoized as a + # deterministic compile failure remains loud. --force and explicit + # --force-interior work bypass this shortcut because a same-basename + # replacement can be capacity-neutral. + if fragment_capacity_fastpath_eligible( + candidate_capacity_exhausted, args.force, merged_jobs): + for job in merged_jobs: + memo_entries = {} + for entry in sorted(job['candidates']): + key = _interior_fail_key( + job['phys_addr'], entry, job['data'], + job['load_addr'], job['size'], + job['producer_ranges'], job['cross_call_allow'], + expected_abi, args.cps, toml, + job['guard_bytes']) + if key in fail_memo: + memo_entries[entry] = fail_memo[key] + if not memo_entries: + continue + current_entries, _current_ranges = \ + load_region_current_variant_coverage( + cache_dir, job['phys_addr'], job['data'], + job['load_addr'], job['size'], expected_abi) + for entry, reason in memo_entries.items(): + if (entry & 0x1FFFFFFF) in current_entries: + continue + memo_action = interior_fail_memo_action( + entry, job, args.force) + if memo_action == 'skip': + memo_skipped += 1 + stats.add_skip() + else: + stats.add_fail( + f'interior 0x{entry:08X} @region ' + f'0x{job["phys_addr"]:08X}', + 'fragment_memo', reason) + stats.add_capacity_fastpath(len(merged_jobs)) + print(f' fragment capacity fixed point: skipped donor/owner ' + f'analysis for {len(merged_jobs)} byte-variant recipe job(s); ' + 'the exact unserved hosted-demand count was intentionally ' + 'not recomputed') + if memo_skipped: + print(f' interior fail-memo: skipped {memo_skipped} ' + 'known-doomed optional interior(s)') + return + + # Global phase 1: publish every strong play-free root before freezing + # sibling donor authority. Freezing first deferred these roots until a + # second CLI invocation: the next run reloaded them from disk and could + # then nominate hosted interiors that a clean first run missed. Strong + # roots are the complete organic authority for cross-variant donors, so + # closing them for every recipe first makes an empty-cache invocation + # reproducible without allowing hosted aliases to recurse. + strong_handled_by_job = [] + for job in merged_jobs: + phys_addr = job['phys_addr'] + load_addr = job['load_addr'] + size = job['size'] + data = job['data'] + current_variant_ids = load_region_current_variant_func_ids( + cache_dir, phys_addr, data, load_addr, size, expected_abi, + include_supplemental=False) + current_variant_entries, current_variant_ranges = \ + current_variant_func_id_coverage( + current_variant_ids, data, load_addr, size) + strong_handled = set() + batch_candidates, isolated_candidates = \ + partition_strong_root_demands( + job['static_exact_demands'], job['executed'], + job['forced'], job['static_interval_demands'], + current_variant_entries) + strong_candidates = batch_candidates + isolated_candidates + batch_pending = [] + isolated_pending = [] + isolated_candidate_set = set(isolated_candidates) + for entry in strong_candidates: + key = _interior_fail_key( + phys_addr, entry, data, load_addr, size, + job['producer_ranges'], job['cross_call_allow'], + expected_abi, args.cps, toml, + job['guard_bytes']) + memo_action = interior_fail_memo_action( + entry, job, args.force) + if key in fail_memo and memo_action != 'retry': + strong_handled.add(entry) + if memo_action == 'skip': + memo_skipped += 1 + stats.add_skip() + else: + stats.add_fail( + f'interior 0x{entry:08X} @region ' + f'0x{phys_addr:08X}', + 'fragment_memo', fail_memo[key]) + continue + if entry in isolated_candidate_set: + isolated_pending.append(entry) + else: + batch_pending.append(entry) + + if candidate_capacity_exhausted: + capacity_pending = [ + entry for entry in batch_pending + isolated_pending + if not fragment_capacity_allows_entry( + True, args.force, job['forced'], entry) + ] + if capacity_pending: + print(f' strong-root supplement @0x{phys_addr:08X}: ' + f'{len(capacity_pending)} demand(s) left to ' + 'interpreter: candidate capacity full') + strong_handled.update(capacity_pending) + for _entry in capacity_pending: + stats.add_skip() + capacity_pending_set = set(capacity_pending) + batch_pending = [ + entry for entry in batch_pending + if entry not in capacity_pending_set + ] + isolated_pending = [ + entry for entry in isolated_pending + if entry not in capacity_pending_set + ] + if not batch_pending and not isolated_pending: + strong_handled_by_job.append(strong_handled) + continue + + def compile_strong_batch(entries): + return compile_fragment_batch( + entries, data, load_addr, size, phys_addr, cache_dir, + args, frag_env, toml, job['producer_ranges'], + job['cross_call_allow'], + guard_bytes=job['guard_bytes']) + + def strong_batch_success(entries, frag_ids, status): + strong_handled.update(entries) + if status == 'cached': + stats.add_skip() + else: + stats.add_ok() + for ev, _cc, ranges in frag_ids: + current_variant_entries.add(ev & 0x1FFFFFFF) + current_variant_ranges.extend( + ((start & 0x1FFFFFFF), + (start & 0x1FFFFFFF) + length) + for start, length in ranges) + current_variant_ids.extend(frag_ids) + if job.get('resident_cap'): + fragment_dll = os.path.join( + cache_dir, + f'{phys_addr:08X}_{fragment_shard_key(frag_ids):08X}' + f'{overlay_ext()}') + reconcile_bios_resident_marker( + fragment_dll, job['resident_cap'], status == 'built') + + def strong_singleton_failure(entry, status): + nonlocal candidate_capacity_exhausted + strong_handled.add(entry) + if status.startswith('candidate-capacity:'): + if status.startswith('candidate-capacity: full'): + candidate_capacity_exhausted = True + print(f' fragment 0x{entry:08X} skipped safely: ' + f'{status}') + stats.add_skip() + return + key = _interior_fail_key( + phys_addr, entry, data, load_addr, size, + job['producer_ranges'], job['cross_call_allow'], + expected_abi, args.cps, toml, + job['guard_bytes']) + optional_reject = optional_static_fragment_rejection( + entry, job, status) + if optional_reject: + print(f' static fragment 0x{entry:08X} rejected safely: ' + f'{status}') + stats.add_skip() + else: + stats.add_fail( + f'interior 0x{entry:08X} @region ' + f'0x{phys_addr:08X}', 'fragment', status) + if interior_failure_is_deterministic(status): + fail_memo[key] = status + append_interior_fail_memo(cache_dir, key, status) + + def strong_batch_failure(entries, status): + nonlocal candidate_capacity_exhausted + if status.startswith('candidate-capacity:'): + strong_handled.update(entries) + if status.startswith('candidate-capacity: full'): + candidate_capacity_exhausted = True + for _entry in entries: + stats.add_skip() + print(f' strong-root batch: {len(entries)} demand(s) ' + f'left to interpreter: {status}') + return + strong_handled.update(entries) + stats.add_fail( + f'strong-root batch ({len(entries)} entries) ' + f'@region 0x{phys_addr:08X}', + 'fragment_batch', status) + + strong_shards = compile_batched_fragment_roots( + batch_pending, compile_strong_batch, strong_batch_success, + strong_singleton_failure, + lambda entry: ((entry & 0x1FFFFFFF) not in + current_variant_entries), + fragment_batch_failure_is_partitionable, + strong_batch_failure) + # A root that is also live/forced/interval evidence retains its + # historical singleton failure domain, but still closes before the + # donor snapshot. A successful batch may incidentally cover it. + for entry in isolated_pending: + if not fragment_capacity_allows_entry( + candidate_capacity_exhausted, args.force, + job['forced'], entry): + if entry not in strong_handled: + strong_handled.add(entry) + stats.add_skip() + continue + if (entry & 0x1FFFFFFF) in current_variant_entries: + strong_handled.add(entry) + continue + frag_ids, status = compile_strong_batch([entry]) + if frag_ids: + strong_batch_success([entry], frag_ids, status) + strong_shards += 1 + else: + strong_singleton_failure(entry, status) + if strong_candidates: + print(f' strong-root supplement @0x{phys_addr:08X}: ' + f'{len(strong_candidates)} demand(s) -> ' + f'{strong_shards} batched shard(s)') + strong_handled_by_job.append(strong_handled) + + # A strong-root publication can consume the last Candidate slots. + # Re-probe under the shared namespace lock before hosted admission. + # The outer invocation lock excludes cooperating writers for the rest + # of this pass; an uncoordinated external deletion can only cause safe + # coverage loss until the next invocation. + was_capacity_exhausted = candidate_capacity_exhausted + candidate_capacity_exhausted, existing_candidates = \ + cache_candidate_capacity_full( + capacity_probe, expected_abi, runtime_candidate_cap) + if candidate_capacity_exhausted and not was_capacity_exhausted: + print(f' overlay candidate capacity reached after strong-root ' + f'closure: {existing_candidates}/{runtime_candidate_cap}; ' + 'new fragments stay interpreted') + + # Global phase 2: snapshot native coverage and authority separately. + # Coverage includes prior hosted shards so a valid alias is not rebuilt. + # Donor/owner authority excludes provenance-tagged hosted output, whose + # incidental rooted callees must not manufacture another wave on a later + # invocation. Strong roots above reconstruct durable authority first. + initial_variant_ids = [ + load_region_current_variant_func_ids( + cache_dir, job['phys_addr'], job['data'], job['load_addr'], + job['size'], expected_abi) + for job in merged_jobs + ] + initial_authority_ids = [ + load_region_current_variant_func_ids( + cache_dir, job['phys_addr'], job['data'], job['load_addr'], + job['size'], expected_abi, include_supplemental=False) + for job in merged_jobs + ] + # Build sorted sibling static-donor streams once. Each recipe needs at + # most its maximum current-entry population plus one nomination batch: + # any later address necessarily has HOSTED_NOMINATION_CAP earlier + # entries from that same sibling after a recipient filters its current + # coverage. The recipient heap-merge below applies the final cap only + # after excluding self evidence and already native entries. + hosted_donors_by_region = {} + initial_entry_bound_by_region = Counter() + for index, indexed_job in enumerate(merged_jobs): + initial_entry_bound_by_region[indexed_job['phys_addr']] = max( + initial_entry_bound_by_region[indexed_job['phys_addr']], + len({_canonical_guest_addr(entry) + for entry, _crc, _ranges in + initial_authority_ids[index]})) + hosted_donor_index_drops = Counter() + for sibling_index, sibling in enumerate(merged_jobs): + organic_entries = organic_root_entries( + initial_authority_ids[sibling_index]) + donor_entries = sorted({ + _canonical_guest_addr(entry) + for entry in sibling.get('hosted_donor_demands', set()) + if _canonical_guest_addr(entry) in organic_entries + }) + # A recipient can filter no more than its current exact entry set. + # Normal publication bounds that by the runtime cap; include the + # observed on-disk maximum as well so a legacy/manual over-cap cache + # loses coverage safely without invalidating this prefix proof. + donor_index_limit = ( + max(runtime_candidate_cap, + initial_entry_bound_by_region[sibling['phys_addr']]) + + HOSTED_NOMINATION_CAP) + dropped = max(0, len(donor_entries) - donor_index_limit) + if dropped: + hosted_donor_index_drops[sibling['phys_addr']] += dropped + hosted_donors_by_region.setdefault( + sibling['phys_addr'], {})[sibling_index] = tuple( + donor_entries[:donor_index_limit]) + for job_index, job in enumerate(merged_jobs): + phys_addr = job['phys_addr'] + load_addr = job['load_addr'] + size = job['size'] + data = job['data'] + interior_pcs = set(job['candidates']) + executed = job['executed'] + static_exact_demands = job['static_exact_demands'] + static_interval_demands = job['static_interval_demands'] + forced = job['forced'] + region_crc = binascii.crc32(data) & 0xFFFFFFFF + # ENTRY-based orphan test, not range-based: native code is + # enterable only at manifest F entries, so "inside a compiled + # range" does NOT make a dispatch target servable — a range- + # covered PC with no F entry anywhere still interps its whole + # chain on every dispatch. Demand an entry at exactly this PC. + coverage_key = (phys_addr, hashlib.sha256(data).digest(), + load_addr, size) + current_coverage = variant_coverage_cache.get(coverage_key) + current_variant_ids = list(initial_variant_ids[job_index]) + current_authority_ids = list( + initial_authority_ids[job_index]) + current_authority_entries, _authority_ranges = \ + current_variant_func_id_coverage( + current_authority_ids, data, load_addr, size) + if current_coverage is None: + current_coverage = current_variant_func_id_coverage( + current_variant_ids, data, load_addr, size) + variant_coverage_cache[coverage_key] = current_coverage + current_variant_entries, current_variant_ranges = current_coverage + + def record_fragment_success(frag_ids, status, + provenance=None): + if status == 'cached': + stats.add_skip() + else: + stats.add_ok() + for ev, _cc, ranges in frag_ids: + current_variant_entries.add(ev & 0x1FFFFFFF) + current_variant_ranges.extend( + ((start & 0x1FFFFFFF), + (start & 0x1FFFFFFF) + length) + for start, length in ranges) + current_variant_ids.extend(frag_ids) + if job.get('resident_cap'): + fragment_dll = os.path.join( + cache_dir, + f'{phys_addr:08X}_' + f'{fragment_shard_key(frag_ids, provenance):08X}' + f'{overlay_ext()}') + reconcile_bios_resident_marker( + fragment_dll, job['resident_cap'], status == 'built') + + def record_fragment_failure(entry, status): + nonlocal candidate_capacity_exhausted + if status.startswith('candidate-capacity:'): + if status.startswith('candidate-capacity: full'): + candidate_capacity_exhausted = True + print(f' fragment 0x{entry:08X} skipped safely: {status}') + stats.add_skip() + return + key = _interior_fail_key( + phys_addr, entry, data, load_addr, size, + job['producer_ranges'], job['cross_call_allow'], + expected_abi, args.cps, toml, + job['guard_bytes']) + optional_reject = optional_static_fragment_rejection( + entry, job, status) + if optional_reject: + print(f' static fragment 0x{entry:08X} rejected safely: ' + f'{status}') + stats.add_skip() + else: + stats.add_fail( + f'interior 0x{entry:08X} @region 0x{phys_addr:08X}', + 'fragment', status) + if interior_failure_is_deterministic(status): + fail_memo[key] = status + append_interior_fail_memo(cache_dir, key, status) + + strong_handled = set(strong_handled_by_job[job_index]) + + # Global phase 3: a static root proven in one captured byte recipe + # can identify an + # indirect-switch entry in a sibling recipe. Run this after local + # strong closure, so owner availability is independent of the + # poorer base-region bundle. Donor and owner authority remain + # frozen to the post-strong snapshot and cannot recurse through a + # hosted shard. Sibling bytes only nominate the address; all + # executable authority comes from this recipient's current-byte + # owner and publication audit. + sibling_proofs, sibling_proofs_truncated = \ + recipient_sibling_proofs( + hosted_donors_by_region.get(phys_addr, {}), job_index, + current_authority_entries) + hosted_audit = {} + hosted = select_hosted_interior_demands( + job, sibling_proofs, current_authority_ids, hosted_audit) + if sibling_proofs_truncated: + hosted_audit['region_nomination_cap_truncated'] = 1 + donor_index_drops = hosted_donor_index_drops.get(phys_addr, 0) + if donor_index_drops: + hosted_audit['region_donor_index_cap_dropped'] = \ + donor_index_drops + + def compile_hosted_batch(specs): + return compile_fragment_batch( + specs, data, load_addr, size, phys_addr, cache_dir, + args, frag_env, toml, job['producer_ranges'], + job['cross_call_allow'], hosted_owners=specs, + guard_bytes=job['guard_bytes']) + + hosted_rejected = set() + hosted_published = False + + def hosted_success(batch, frag_ids, status): + nonlocal hosted_published + record_fragment_success( + frag_ids, status, HOSTED_MANIFEST_PROVENANCE) + if status == 'built': + hosted_published = True + emitted = { + _canonical_guest_addr(entry) + for entry, _crc, _ranges in frag_ids + } + missing = sorted(set(batch) - emitted) + if missing: + print(f' hosted batch: {len(batch) - len(missing)}/' + f'{len(batch)} target(s) passed recipient CFG proof; ' + f'{len(missing)} retrying in smaller batches') + return set(batch) - set(missing) + + def hosted_singleton_failure(entry, status): + nonlocal candidate_capacity_exhausted + print(f' hosted interior 0x{entry:08X} rejected safely: ' + f'{status}') + if status.startswith('candidate-capacity: full'): + candidate_capacity_exhausted = True + if args.force: + stats.add_skip() + return + hosted_rejected.add(_canonical_guest_addr(entry)) + if status.startswith(( + 'generated-c-audit:', 'hosted-entry-audit:', + 'hosted-no-target:', 'candidate-capacity:', + 'no-generated-output', 'no-func-ids')): + stats.add_skip() + else: + stats.add_fail( + f'hosted interior 0x{entry:08X} ' + f'@region 0x{phys_addr:08X}', + 'hosted_fragment', status) + + def hosted_batch_failure(batch, status): + nonlocal candidate_capacity_exhausted + if status.startswith('candidate-capacity: full'): + candidate_capacity_exhausted = True + print(f' hosted batch: 0/{len(batch)} target(s) passed ' + 'recipient CFG proof; candidate capacity full') + if args.force: + for _entry in batch: + stats.add_skip() + return + hosted_rejected.update( + _canonical_guest_addr(entry) for entry in batch) + if status.startswith(( + 'hosted-no-target:', + 'hosted-entry-audit: compile attempt cap', + 'candidate-capacity:', 'no-generated-output', + 'no-func-ids')): + for _entry in batch: + stats.add_skip() + print(f' hosted batch: 0/{len(batch)} target(s) passed ' + 'recipient CFG proof; rejected safely') + return + stats.add_fail( + f'hosted-interior batch ({len(batch)} entries) ' + f'@region 0x{phys_addr:08X}', + 'hosted_fragment_batch', status) + + hosted_shards = compile_batched_hosted_aliases( + hosted, compile_hosted_batch, hosted_success, + hosted_singleton_failure, + lambda entry: ((entry & 0x1FFFFFFF) not in + current_variant_entries), + fragment_batch_failure_is_partitionable, + hosted_batch_failure, + stop_requested=lambda: ( + candidate_capacity_exhausted and not args.force)) + if hosted_published: + was_capacity_exhausted = candidate_capacity_exhausted + candidate_capacity_exhausted, existing_candidates = \ + cache_candidate_capacity_full( + capacity_probe, expected_abi, runtime_candidate_cap) + if (candidate_capacity_exhausted and + not was_capacity_exhausted): + print(f' overlay candidate capacity reached after ' + f'hosted closure: {existing_candidates}/' + f'{runtime_candidate_cap}; ordinary fragments stay ' + 'interpreted') + hosted_capacity_skipped = set() + if candidate_capacity_exhausted and not args.force: + already_accounted = hosted_rejected | { + _canonical_guest_addr(entry) for entry in strong_handled + } + capacity_missing = hosted_entries_still_missing( + hosted, current_variant_entries, already_accounted) + if capacity_missing: + hosted_capacity_skipped.update(capacity_missing) + hosted_audit['candidate_capacity_full'] = \ + len(capacity_missing) + for _entry in capacity_missing: + stats.add_skip() + if sibling_proofs: + print(f' cross-variant hosted supplement @0x{phys_addr:08X}: ' + f'{len(hosted)}/{len(sibling_proofs)} sibling-proven ' + f'target(s) had a unique current-byte local owner -> ' + f'{hosted_shards} shard(s); ' + f'audit={dict(sorted(hosted_audit.items()))}') + + orphans = select_fragment_orphans( + interior_pcs, executed, forced, static_exact_demands, + static_interval_demands, current_variant_entries, + current_variant_ranges) + orphans = [entry for entry in orphans + if (entry not in strong_handled and + _canonical_guest_addr(entry) not in + hosted_capacity_skipped)] + if not orphans: + continue + capacity_orphans = [ + entry for entry in orphans + if not fragment_capacity_allows_entry( + candidate_capacity_exhausted, args.force, + job['forced'], entry) + ] + if capacity_orphans: + print(f' orphan fragments: {len(capacity_orphans)} ' + 'demand(s) left to interpreter: candidate capacity full') + for _entry in capacity_orphans: + stats.add_skip() + capacity_orphan_set = set(capacity_orphans) + orphans = [ + entry for entry in orphans + if entry not in capacity_orphan_set + ] + if not orphans: + continue + built = 0 + for a in orphans: + # A preceding orphan can consume the final slot or receive the + # first authoritative full verdict. Stop ordinary toolchain + # work immediately while still allowing a later explicit + # capacity-neutral repair candidate. + if not fragment_capacity_allows_entry( + candidate_capacity_exhausted, args.force, + job['forced'], a): + stats.add_skip() + continue + key = _interior_fail_key( + phys_addr, a, data, load_addr, size, + job['producer_ranges'], job['cross_call_allow'], + expected_abi, args.cps, toml, + job['guard_bytes']) + memo_action = interior_fail_memo_action(a, job, args.force) + if key in fail_memo and memo_action != 'retry': + # Deterministically doomed from these exact bytes — skip the + # ~16k-word data walk. NOT a fresh failure (already counted + # when first memoized); count as a skip so the summary is honest. + if memo_action == 'skip': + memo_skipped += 1 + stats.add_skip() + else: + stats.add_fail( + f'interior 0x{a:08X} @region 0x{phys_addr:08X}', + 'fragment_memo', fail_memo[key]) + continue + frag_ids, status = compile_interior_fragment( + a, data, load_addr, size, phys_addr, cache_dir, args, + frag_env, toml, job['producer_ranges'], + job['cross_call_allow'], + guard_bytes=job['guard_bytes']) + if frag_ids: + built += 1 + record_fragment_success( + frag_ids, status, ORPHAN_MANIFEST_PROVENANCE) + else: + # An executed orphan interior that would NOT build is a real + # coverage hole: that PC's whole dispatch chain runs + # interpreted forever. Tally it loudly with the reason. + # Persist only deterministic generated-code audit verdicts; + # compiler/spawn errors and cache-pair mismatches depend on + # mutable external state and must remain retryable. + record_fragment_failure(a, status) + print(f' interior fragments @0x{phys_addr:08X}: {built}/{len(orphans)} ' + f'exact-demand orphan interior(s) -> isolated island shards') + if memo_skipped: + print(f' interior fail-memo: skipped {memo_skipped} known-doomed ' + f'interior(s) (data-as-code from identical bytes; ' + f'{INTERIOR_FAIL_MEMO})') + + # ---- Drive the capture list ------------------------------------------- + # Dynamic cache publication is deliberately canonical and sequential. A + # parallel recompile race is harmless below capacity but chooses an + # irreproducible winning subset at the hard Candidate boundary. Static + # combined-C mode has no runtime cache publication and keeps its historical + # capture order. + stats = ShardStats() + for label, detail in segment_view_errors: + print(f' SEGMENT RECORD REJECTED: {label}: {detail}') + stats.add_fail(label, 'segments', detail) + if args.static: + if args.jobs > 1 and len(captures) > 1: + # Each capture is an independent recompiler subprocess plus a + # Python-side audit/namespace pass; the latter is CPU-bound, so + # processes, not threads. pool.map yields in submission order, and + # the merge runs in that order, so the result is byte-identical to + # the sequential loop. + from concurrent.futures import ProcessPoolExecutor + print(f'Static mode: {args.jobs} worker processes, ' + f'results merged in capture order\n') + with ProcessPoolExecutor(max_workers=args.jobs) as pool: + for res in pool.map(static_capture_job, captures, + itertools.repeat(args), + itertools.repeat(toml), + itertools.repeat(forced_interiors), + itertools.repeat(static_out), + chunksize=1): + _merge_static_result(res) + else: + for cap in captures: + _do_capture(cap, region_coverage_cache, interior_frag_jobs, stats) + else: + # Publication order is part of the reproducible cache result whenever + # the process-lifetime Candidate cap can bind. Sort complete capture + # recipes and serialize whole compiler invocations in this namespace; + # a mutex around only the final rename would still admit whichever + # worker happened to arrive first at cap-minus-N. + capacity_lock, _tier_dirs = _candidate_capacity_namespace( + os.path.join(cache_dir, f'00000000_00000000{overlay_ext()}')) + invocation_lock = capacity_lock + '.invocation' + with _exclusive_file_lock(invocation_lock, timeout=None): + expected_abi = overlay_abi_tag( + args.runtime_include, args.flavor) + runtime_candidate_cap = overlay_candidate_cap( + args.runtime_include) + capacity_probe = os.path.join( + cache_dir, f'00000000_00000000{overlay_ext()}') + existing_candidates, candidate_counts = \ + cache_candidate_capacity_snapshot( + capacity_probe, expected_abi) + saturated_single_tier = candidate_capacity_saturated_in_tier( + existing_candidates, candidate_counts, + runtime_candidate_cap, cache_dir) + capacity_fixedpoint = ( + saturated_single_tier and not args.force and + not forced_interiors) + captures_to_process = captures + if capacity_fixedpoint: + # At a single-tier full namespace, ordinary compilation cannot + # publish growth and there is no lower compiler tier to promote + # with a capacity-neutral basename replacement. This is an + # intentionally coarse fixed-point result: coverage_report is + # the exact gap authority, while this invocation avoids decoding + # and sorting a potentially gigabyte-scale capture collection. + # BIOS resident bundles are the exception: normal policy lets a + # richer capture replace its canonical bundle without --force, + # and that replacement can be capacity-neutral. Process only + # these tiny captures, then re-probe before suppressing the + # gigabyte-scale ordinary collection. + resident_captures = [ + cap for cap in captures + if cap.get('producer') == BIOS_RESIDENT_PRODUCER + ] + resident_captures.sort(key=lambda cap: ( + int(cap['load_addr'], 16) & 0x1FFFFFFF, + binascii.crc32(base64.b64decode( + cap['bytes_b64'])) & 0xFFFFFFFF, + hashlib.sha256(json.dumps( + cap, sort_keys=True, separators=(',', ':'), + default=str).encode('utf-8')).digest(), + )) + for cap in resident_captures: + _do_capture( + cap, region_coverage_cache, interior_frag_jobs, stats) + resident_ids = {id(cap) for cap in resident_captures} + captures_to_process = [ + cap for cap in captures if id(cap) not in resident_ids + ] + existing_candidates, candidate_counts = \ + cache_candidate_capacity_snapshot( + capacity_probe, expected_abi) + capacity_fixedpoint = candidate_capacity_saturated_in_tier( + existing_candidates, candidate_counts, + runtime_candidate_cap, cache_dir) + if capacity_fixedpoint: + stats.add_capacity_fastpath(len(captures_to_process)) + print(f'Overlay candidate fixed point: ' + f'{existing_candidates}/{runtime_candidate_cap} ' + f'candidates in the active compiler tier; processed ' + f'{len(resident_captures)} BIOS resident recipe(s) ' + f'and skipped {len(captures_to_process)} ordinary ' + 'capture recipe(s) before byte decode. Use --force or ' + '--force-interior for capacity-neutral repair ' + 'attempts; coverage_report remains the exact gap ' + 'authority.\n') + if not capacity_fixedpoint: + captures_to_process.sort(key=lambda cap: ( + int(cap['load_addr'], 16) & 0x1FFFFFFF, + binascii.crc32(base64.b64decode( + cap['bytes_b64'])) & 0xFFFFFFFF, + hashlib.sha256(json.dumps( + cap, sort_keys=True, separators=(',', ':'), + default=str).encode('utf-8')).digest(), + )) + if args.jobs > 1: + print('Deterministic candidate-cap admission: region ' + 'recipes run in canonical order ' + '(parallel publication disabled)\n') + for cap in captures_to_process: + _do_capture( + cap, region_coverage_cache, interior_frag_jobs, stats) + _do_frags(interior_frag_jobs, stats) + + # B-2: write combined static C file + if args.static and static_parts: + # CPS can yield at every compiled block leader, not just leaders that a + # particular capture happened to observe. Give every block in every + # variant a content-gated resume wrapper. This makes static coverage + # independent of host timing / slice boundaries. + synthesized = 0 + + def synthesize_all_resume_wrappers(parts): + nonlocal synthesized + for part in parts: + done = part.setdefault('resume_entries', set()) + # Same per-entry rules as before, but the resume arms are + # inserted per HOST in one pass (add_cps_resume_cases) and the + # wrappers appended in one concatenation. Entry order is the + # sorted order the per-entry loop used, so the emitted C is + # byte-identical; the cost drops from quadratic in the part + # size to linear. + candidates = [] + by_host = {} + for entry, host in sorted(part['continuation_owners'].items()): + if entry in part['func_addrs'] or entry in done: + continue + if host not in part['ids_by_addr']: + continue + candidates.append((entry, host)) + by_host.setdefault(host, []).append(entry) + requests = [(part['symbols'][host], host, entries) + for host, entries in by_host.items()] + part['src'], ok_by_symbol = add_cps_resume_cases( + part['src'], requests) + wrappers = [] + for entry, host in candidates: + host_symbol = part['symbols'][host] + if entry not in ok_by_symbol.get(host_symbol, ()): + continue + symbol = f'{part["namespace"]}_func_{entry:08X}' + wrappers.append( + f'\n/* CPS block resume entry owned by 0x{host:08X}. */\n' + f'void {symbol}(CPUState* cpu)\n{{\n' + f' cpu->pc = 0x{entry:08X}u;\n' + f' {host_symbol}(cpu);\n' + f'}}\n') + for code_crc, ranges in part['ids_by_addr'][host]: + part['variants'].append({ + 'addr': entry, + 'symbol': symbol, + 'crc': code_crc, + 'ranges': ranges, + }) + done.add(entry) + synthesized += 1 + part['src'] += ''.join(wrappers) + + synthesize_all_resume_wrappers(static_parts) + + # Captured entries not owned by any compiled host are genuine orphan + # interiors. Compile each as an isolated dispatch-root shard, then give + # every block in those fragments the same universal resume treatment. + # + # Demands are (entry, image crc), one per capture that observed the + # address, and a demand is served only by a part built from that + # capture's bytes (select_static_fragment_demands). A band with many + # occupants therefore gets one fragment per occupant that observed the + # address -- the dispatcher's CRC gate picks the resident one. + unresolved = select_static_fragment_demands( + static_requested_entries, static_parts) + # PSX_STATIC_NO_ISOLATED=1: A/B guard -- skip the isolated-fragment pass + # entirely while testing the universal-resume machinery. + if os.environ.get('PSX_STATIC_NO_ISOLATED'): + unresolved = [] + + # Persistent doomed-fragment memo, as in the DLL path: an interior + # that is data in THIS image fails the generated-C audit every time, + # after a full recompiler walk. Band-attributed captures (an observed + # PC attached to every occupant of its band) make that the common + # case, so remember the verdict per (image bytes, interior, toml, + # cps, guard) next to the static output. --force cannot be the retry + # switch here (static mode needs it just to overwrite the output); + # --force-interior PC retries that entry, deleting the memo file + # retries everything. + fail_memo = load_interior_fail_memo(args.out_dir) + expected_abi = overlay_abi_tag(args.runtime_include, args.flavor) + forced_phys = {entry & 0x1FFFFFFF for entry in forced_interiors} + fragment_jobs = [] # (demand key, memo key, image key) + image_sources = {} # image key -> (data, load, size, phys, guard) + fragment_memo_skipped = 0 + for key in unresolved: + source = static_entry_sources.get(key) + if source is None: + continue + entry, image_crc = key + data, load_addr, size, phys_addr, guard_bytes = source + memo_key = _interior_fail_key( + phys_addr, entry, data, load_addr, size, [], [], + expected_abi, bool(args.cps), toml, guard_bytes=guard_bytes) + if (memo_key in fail_memo and + (entry & 0x1FFFFFFF) not in forced_phys): + fragment_memo_skipped += 1 + continue + # One image per segment view (§5.7): every view of a capture has + # the same bytes, phys and size, but a demand compiles against its + # own view's load address, which fixes the segment it is spelled, + # named and baked in. + image_key = (image_crc, phys_addr, size, segment_of(load_addr)) + image_sources.setdefault(image_key, source) + fragment_jobs.append((key, memo_key, image_key)) + + # Fragments are independent recompiler subprocesses; run them on the + # same pool as the regions. Results are merged in demand order and a + # result whose entry an earlier-merged part already serves for the + # same image is discarded, so the output is byte-identical to the + # sequential loop (which skipped such entries before compiling). + if fragment_jobs: + print(f'Static isolated interior fragments: {len(fragment_jobs)} ' + f'(entry, image) demand(s) over {len(image_sources)} ' + f'image(s) to compile' + + (f', {fragment_memo_skipped} known-doomed skipped' + if fragment_memo_skipped else '')) + if args.jobs > 1 and len(fragment_jobs) > 1: + from concurrent.futures import ProcessPoolExecutor + with ProcessPoolExecutor( + max_workers=args.jobs, + initializer=_init_static_fragment_worker, + initargs=(image_sources,)) as pool: + fragment_results = list(pool.map( + static_fragment_job, + [job[0][0] for job in fragment_jobs], + [job[2] for job in fragment_jobs], + itertools.repeat(args), + chunksize=8)) + else: + _init_static_fragment_worker(image_sources) + fragment_results = [static_fragment_job(key[0], image_key, args) + for key, _memo_key, image_key in fragment_jobs] + + fragment_built = 0 + fragment_rejected = 0 + fragment_failed = [] + new_fragment_parts = [] + existing_keys = served_static_variant_keys(static_parts) + for (key, memo_key, _image_key), (part, reason) in zip( + fragment_jobs, fragment_results): + if key in existing_keys: + continue + if part is None: + if interior_failure_is_deterministic(reason): + fragment_rejected += 1 + append_interior_fail_memo(args.out_dir, memo_key, reason) + else: + fragment_failed.append((key, reason)) + continue + static_parts.append(part) + new_fragment_parts.append(part) + existing_keys.update( + (variant['addr'], part['image_crc']) + for variant in part['variants']) + fragment_built += 1 + + synthesize_all_resume_wrappers(new_fragment_parts) + unresolved = select_static_fragment_demands( + static_requested_entries, static_parts) + print(f'Static universal CPS resume wrappers: {synthesized}') + print(f'Static isolated interior shards: {fragment_built}') + if fragment_rejected or fragment_memo_skipped: + # Data-as-code in that capture's bytes. Expected whenever a + # dispatch entry is attributed to more occupants of a band than + # actually ran it: safe coverage loss, never a shard failure -- + # the resident occupant's own fragment is what serves the entry. + print(f'Static fragments rejected as data in their image: ' + f'{fragment_rejected} this run (memoized), ' + f'{fragment_memo_skipped} skipped from the memo') + stats.add_skip(fragment_rejected + fragment_memo_skipped) + hard = [(key, reason) for key, reason in fragment_failed] + if hard: + sample = ', '.join(f'0x{key[0]:08X}/{key[1]:08X}' + for key, _reason in hard[:12]) + print(f'STATIC COVERAGE WARNING: {len(hard)} captured dispatch ' + f'entry(s) have no compiled body/owner (entry/image): ' + f'{sample}') + for key, reason in hard: + stats.add_fail(f'static entry 0x{key[0]:08X} image {key[1]:08X}', + 'static_unresolved', + f'captured dispatch entry with no compiled ' + f'body/owner: {reason}') + + all_variants = [] + for part in static_parts: + all_variants.extend(part['variants']) + dispatch_src = generate_overlay_dispatch(all_variants) + written = write_static_outputs(static_out, static_parts, all_variants, + dispatch_src, + single_file=args.static_single_file) + print(f'Static output: {static_out} ' + f'({len(all_variants)} exact function identities total, ' + f'{len(written)} translation unit(s))') + + # A conservative primary scan can emit no functions while exact-entry + # supplementation still serves every requested root. Decide only after + # that pass, using ABI-valid, current-byte guarded native coverage. Missing + # even one primary root remains a failure; toolchain/audit failures above + # are never cleared by this reconciliation. + # + # DLL mode only. The reconciliation reads the per-game DLL cache, and + # cache_dir is bound only on the non-static path; --static emits one + # self-contained overlays_static.c and _do_capture returns into + # static_capture_job before anything is queued. Calling it unconditionally + # raised UnboundLocalError at the very end of every --static run, after + # the output was already written, and turned a clean compile into exit 1. + if args.static: + if pending_empty_primary: + raise SystemExit( + 'internal error: --static queued %d empty-primary ' + 'reconciliation(s), but static mode has no DLL cache to ' + 'reconcile against' % len(pending_empty_primary)) + else: + reconcile_empty_primary_scans( + pending_empty_primary, cache_dir, + overlay_abi_tag(args.runtime_include, args.flavor), stats) + + # LOUD summary + machine-readable result line, then a non-zero exit when any + # shard that should have built failed. The runtime's autocompile watcher and + # any CI/dev invocation now SEE shard failures instead of a green exit 0 that + # masked a header-drift breakage. Skips (data-only / already-covered) and a + # zero-capture run are NOT failures. + n_fail = stats.print_summary() + if _check_tmp: + import shutil + shutil.rmtree(_check_tmp, ignore_errors=True) + print(f'[check] removed throwaway dir {_check_tmp}') + print('Done.') + if n_fail: + raise SystemExit(2) + + +if __name__ == '__main__': + main() diff --git a/overlay_toolchain/compiler.txt b/overlay_toolchain/compiler.txt new file mode 100644 index 00000000..29431468 --- /dev/null +++ b/overlay_toolchain/compiler.txt @@ -0,0 +1 @@ +C:\Users\Matthew\.local\share\retcomm\toolchains\cmake-clang-v1\latest\bin\clang.exe diff --git a/overlay_toolchain/include/audio_shadow.h b/overlay_toolchain/include/audio_shadow.h new file mode 100644 index 00000000..b20d4ac1 --- /dev/null +++ b/overlay_toolchain/include/audio_shadow.h @@ -0,0 +1,95 @@ +/* audio_shadow.h — engine-agnostic HLE-shadow differential verifier (C). + * + * The gate that makes a "verified-enhancement shadow" SAFE: a higher-fidelity + * re-render of a guest audio subsystem (here the PS1 SPU's ADPCM voices, free + * of the hardware Gaussian interpolation and 16-bit intermediate truncation) + * runs ALONGSIDE the canon hardware mix, never replacing it. This verifier + * decides, from the running canon stream, whether the shadow is proven enough + * to substitute, and reverts loudly the instant it stops matching: + * + * - envelope correlation + level-ratio self-check vs the canon stream + * - probation auto-gain calibration (constant mixer-scale differences) + * - prove-then-substitute, strike-then-pause, escalating re-prove + * + * The canon (hardware-modeled SPU) output stays the verify oracle; the shadow + * is never ground truth. If this verifier is wrong, the worst case is "we keep + * playing the authentic hardware mix" — it cannot corrupt output. + * + * Ported (C) from JRickey/gba-recomp crates/gba-core/src/shadow.rs via the + * gbarecomp C++ port (src/gba/audio_shadow.*) and the snesrecomp C port + * (runner/src/snes/audio_shadow.*), © Jrickey, MIT OR Apache-2.0, used with + * permission. Engine-agnostic; reused across the recomp ecosystem. + */ + +#ifndef PSXRECOMP_AUDIO_SHADOW_H +#define PSXRECOMP_AUDIO_SHADOW_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SHADOW_JUDGE_NONE = 0, /* mid-window, or canon silent (no verdict) */ + SHADOW_JUDGE_PASS = 1, /* window passed all gates */ + SHADOW_JUDGE_FAIL = 2, /* window failed (see fail_structural) */ +} ShadowJudgement; + +/* Window/decimation geometry (see the .c for the rationale). */ +#define SHADOW_DECIM 64u +#define SHADOW_WINDOW 1024u +#define SHADOW_MAX_LAG 56u + +/* Differential self-check: shadow mix vs the canon DAC stream. Polices + * STRUCTURE (same notes, same loudness, same time) via rectified-lowpassed + * envelopes, decimated and Pearson-correlated over a coarse lag range. */ +typedef struct { + float lp_x[2]; /* canon envelope follower (L,R) */ + float lp_y[2]; /* shadow envelope follower (L,R) */ + float ex[SHADOW_WINDOW][2]; /* decimated canon envelope */ + float ey[SHADOW_WINDOW][2]; /* decimated shadow envelope */ + uint32_t count; /* entries filled in ex/ey this window */ + uint32_t phase; /* decimation phase */ + uint32_t strikes; +} ShadowSelfCheck; + +/* The engine-agnostic verification state machine. */ +typedef struct { + ShadowSelfCheck check; + float gain; /* calibrated output gain (1.0 = stock scale) */ + bool calibrated; + float ratio_hist[3]; + uint32_t ratio_n; + bool proven; /* frontend substitutes only when true */ + uint32_t prove_need; + uint32_t consec_pass; + uint64_t pauses; + char reverted[160]; /* reason on each pause (caller logs + clears); "" = none */ + float last_r; + float last_ratio; + bool fail_structural; /* last Fail broke correlation at an in-band level */ +} ShadowVerifier; + +/* Zero-init then call this (sets gain=1, prove_need=1). */ +void shadow_verifier_init(ShadowVerifier* v); + +/* Feed one grid sample of (canon, shadow-check-copy) stereo pairs, both in the + * canon's normalized domain. Drives calibration, proving, strikes, pauses. */ +ShadowJudgement shadow_verifier_judge(ShadowVerifier* v, + float canon_l, float canon_r, + float chk_l, float chk_r); + +static inline float shadow_verifier_gain(const ShadowVerifier* v) { + return v->gain; +} +static inline bool shadow_verifier_proven(const ShadowVerifier* v) { + return v->proven; +} + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_AUDIO_SHADOW_H */ diff --git a/overlay_toolchain/include/audio_trace.h b/overlay_toolchain/include/audio_trace.h new file mode 100644 index 00000000..544faaed --- /dev/null +++ b/overlay_toolchain/include/audio_trace.h @@ -0,0 +1,133 @@ +/* + * audio_trace.h - audio health counters, event ring and debug PCM history. + * + * Port of the snesrecomp audio-campaign measurement harness (audio_trace.{c,h}, + * commit 67ead27 lineage) to the PSX pipeline, following the cross-system tap + * model in F:/Projects/_audio_round2/ROUND2_PLAN.md: debug-tool builds keep + * always-on ring buffers recording from process start, dumped AFTER the fact via + * TCP debug commands — never arm-then-reproduce. + * + * Taps (PSX pipeline): + * AUDIO_TAP_SPU_OUT "T1" — canonical spu_render() output @44100, recorded + * inside spu_render so every caller (pump, fade tail) is + * covered, PRE any host-side fade/mute gain. + * AUDIO_TAP_CD_IN "T2" — decoded XA/CD-DA PCM pushed onto the SPU CD + * input bus (already resampled to 44100 by the producer). + * AUDIO_TAP_HOST "T3" — the exact bytes handed to the host audio API + * (post fade ramps; what SDL_QueueAudio receives). + * + * The same module compiles into psx-beetle, where AUDIO_TAP_SPU_OUT records + * the libretro audio_batch callback — Beetle's fully-mixed reference SPU + * output — giving symmetric `audio_*` commands on ports 4370 and 4380. + * + * Threading: each tap has a single writer. Readers (debug-server thread) + * take a stable [oldest, head) snapshot; in debug-tool builds the PCM rings + * hold ~95 s at 44100, so a dump cannot be lapped mid-read in practice. + * Production PSX_NO_DEBUG_TOOLS builds keep counters/events but compile out + * PCM history and WAV dumps. Indices are C11 atomics (release on publish, + * acquire on read). + */ +#ifndef PSX_AUDIO_TRACE_H +#define PSX_AUDIO_TRACE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + AUDIO_TAP_SPU_OUT = 0, + AUDIO_TAP_CD_IN = 1, + AUDIO_TAP_HOST = 2, + AUDIO_TAP_VOICES = 3, /* T0: 24-voice sum only (pre CD mix, pre main) */ + AUDIO_TAP_COUNT = 4 +}; + +/* Event kinds. REG_WRITE covers every SPU register store (addr/value), which + * subsumes KEYON/KEYOFF/pitch/volume writes — the semantic KON ring stays in + * spu.c. The rest instrument the host delivery path. */ +enum { + AUDIO_EV_NONE = 0, + AUDIO_EV_REG_WRITE = 1, /* a=SPU reg addr, b=value */ + AUDIO_EV_RENDER = 2, /* a=frames rendered, b=host queued bytes before */ + AUDIO_EV_PUMP_SKIP = 3, /* backpressure skip; a=queued bytes */ + AUDIO_EV_UNDERRUN = 4, /* host queue empty at pump entry; a=queued bytes */ + AUDIO_EV_MUTE = 5, /* turbo mute engaged; a=fade tail frames */ + AUDIO_EV_UNMUTE = 6, /* pumping resumed; a=fade-in frames pending */ + AUDIO_EV_CD_PUSH = 7, /* a=guest-cycle clock low32, b=ring fill after */ + AUDIO_EV_DMA_WRITE = 8, /* SPU RAM DMA; a=words, b=transfer addr after */ + AUDIO_EV_XA_ZERO = 9, /* zero-run in decoded XA PCM; a=lba, + b=(stage<<28)|(start_frame<<14)|run_len. + stage 0=post-ADPCM-decode (native rate), + stage 1=post-resample+volume (44100). */ + AUDIO_EV_SINK_DROP = 10, /* turbo host sink; a=guest SPU frames discarded */ + AUDIO_EV_DMA_READ = 11, /* SPU RAM -> CPU DMA; a=words, b=dest RAM addr */ +}; + +typedef struct { + uint64_t seq; /* monotone event counter */ + uint64_t sample_idx; /* AUDIO_TAP_SPU_OUT frames produced when recorded */ + uint32_t frame; /* host-noted frame counter (vblank / retro_run) */ + uint16_t kind; + uint16_t reserved; + uint32_t a; + uint32_t b; +} AudioTraceEvent; + +typedef struct { + /* Per-tap PCM production. */ + uint64_t tap_frames[AUDIO_TAP_COUNT]; /* frames ever recorded */ + uint64_t tap_nonzero[AUDIO_TAP_COUNT]; /* frames with |L| or |R| > 0 */ + uint64_t tap_audible[AUDIO_TAP_COUNT]; /* frames with |L| or |R| > 256 (~ -42 dBFS) */ + int32_t tap_peak[AUDIO_TAP_COUNT]; /* running peak |sample| */ + /* Host pump behavior. */ + uint64_t pump_calls; + uint64_t pump_skips; /* backpressure early-outs */ + uint64_t underruns; /* pump entered with 0 queued bytes (post first audio) */ + uint32_t queue_hiwater; /* max queued bytes observed at pump entry */ + uint32_t queue_lowater; /* min queued bytes observed at pump entry (post first audio) */ + uint64_t mute_events; + uint64_t unmute_events; + /* Event ring. */ + uint64_t events_total; +} AudioTraceStats; + +void audio_trace_init(void); + +/* Record `frames` interleaved stereo s16 frames into tap `tap`. */ +void audio_trace_pcm(int tap, const int16_t *stereo, int frames); + +/* Record a pipeline event (timestamps applied internally). */ +void audio_trace_event(uint16_t kind, uint32_t a, uint32_t b); + +/* Host frame tag for event timestamps (call once per vblank / retro_run). */ +void audio_trace_note_frame(uint32_t frame); + +void audio_trace_get_stats(AudioTraceStats *out); +uint64_t audio_trace_tap_total(int tap); +uint64_t audio_trace_events_total(void); + +/* Taps default to 44100 Hz; the host tap may run at the device rate in + * bridge/pull mode. The WAV dumper stamps this rate — a mislabeled header + * silently poisons every offline A/B. */ +void audio_trace_set_tap_rate(int tap, uint32_t rate); +uint32_t audio_trace_tap_rate(int tap); + +/* Copy the most recent `max` events, oldest first. Returns count copied. */ +uint32_t audio_trace_events_get(AudioTraceEvent *out, uint32_t max); + +/* Write a tap slice as a stereo s16 WAV at the tap's rate. start=-1,count=0 + * dumps the whole currently-buffered ring. `start`/`count` are absolute frame + * indices on the tap's production timeline. Returns frames written, or -1 on + * error (unwritable path / empty ring / slice already evicted). In + * PSX_NO_DEBUG_TOOLS production builds, PCM history is not present and this + * returns -1 without creating/opening `path`. */ +int64_t audio_trace_dump_wav(int tap, const char *path, + int64_t start, uint64_t count); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_AUDIO_TRACE_H */ diff --git a/overlay_toolchain/include/autocompile.h b/overlay_toolchain/include/autocompile.h new file mode 100644 index 00000000..0db386ec --- /dev/null +++ b/overlay_toolchain/include/autocompile.h @@ -0,0 +1,74 @@ +/* autocompile.h — background overlay compile for variant-capture automation + * (step 2.8). Spawns the configured compile command (compile_overlays.py + * invocation from game.toml [runtime] overlay_autocompile_cmd) after an + * automatic capture, collects its output into an in-memory ring (no log + * files — CLAUDE.md §3; read it via the autocompile_status TCP command), + * and on success has the emu thread rescan the overlay-DLL cache so the new + * variant goes native in-session, without a restart. */ +#ifndef PSXRECOMP_AUTOCOMPILE_H +#define PSXRECOMP_AUTOCOMPILE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Store the command line + working directory. Empty cmd disables. */ +void autocompile_configure(const char *cmd, const char *cwd); +int autocompile_configured(void); + +/* Pin the canonical overlay cache dir + captures file the LOADER actually uses + * (/cache and /overlay_captures.json — computed once in main.cpp). + * autocompile injects these into every spawned compile via the environment + * (PSX_OVERLAY_CACHE_DIR / PSX_OVERLAY_CAPTURES), so the WRITE cache and the + * READ captures can never diverge from where the loader reads — for every game, + * dev or prod, gcc or tcc. compile_overlays.py / coverage_vault.py honor these + * over any CLI --out-dir/--captures. This is the single source of truth for the + * cache location: no per-game config, no drift. */ +void autocompile_set_cache_paths(const char *cache_dir, const char *captures); + +/* Probe whether a C compiler is actually reachable on PATH (gcc/cc/clang) — the + * REAL "developer machine" signal, distinct from autocompile_configured() which + * only reports that a command STRING is set (the shipped game.toml always sets + * one). overlay_backend_resolve uses this so `auto` picks gcc only when the + * toolchain can really build a shard, else tcc (toolchain-less production). + * Memoized; safe to call repeatedly. */ +int autocompile_toolchain_available(void); + +/* 1 while a compile process is running. */ +int autocompile_busy(void); + +/* Kick a compile if configured and idle. Returns 1 if started. */ +int autocompile_request(void); + +/* Emu-thread tick: applies a finished compile (cache rescan on success). + * Must be called from the same thread that owns the overlay loader. */ +void autocompile_poll_main(void); + +/* Process-shutdown teardown, emu thread only: stops the publication pipeline, + * kills the compiler process tree (job object), and JOINS the watcher and + * preparer threads — waiting out any in-flight LoadLibrary rather than + * abandoning a thread inside the Windows loader lock (which can deadlock + * ExitProcess). Safe to call in any state, including mid-run; idempotent. */ +void autocompile_shutdown(void); + +/* JSON status blob for the debug server: state, run/fail counters, last + * exit code, and the output tail. Returns bytes written. */ +int autocompile_status_json(char *out, int cap); + +/* Why overlay autocompile cannot work, or NULL if nothing is known to be wrong. + * + * When this is non-NULL, no shard will ever be compiled and overlay execution + * stays in the interpreter — the run is valid but its performance is + * meaningless. Callers that report timings should say so rather than publish a + * number measured in that state. + * + * This exists because the equivalent warnings are written to stdout and the + * shipped runtime links -mwindows, so they reach nobody. `autocompile_status` + * carries this out over the TCP debug server as "degraded"/"degraded_reason". */ +const char *autocompile_degraded_reason(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_AUTOCOMPILE_H */ diff --git a/overlay_toolchain/include/beetle_history.h b/overlay_toolchain/include/beetle_history.h new file mode 100644 index 00000000..b1467c90 --- /dev/null +++ b/overlay_toolchain/include/beetle_history.h @@ -0,0 +1,88 @@ +/* beetle_history.h — psx-beetle per-frame snapshot ring. + * + * Mirrors runtime/src/debug_server.c's PSXFrameRecord history so beetle + * exposes the SAME time-series surface as psx-runtime: history, + * get_frame, frame_range, frame_timeseries, first_failure, + * read_frame_ram, set_snapshot, get_snapshots. + * + * Capacity matches the runtime side (36000 frames ~= 10 min @ 60 Hz) + * so cross-backend tooling can assume identical retention windows. + * + * The record fields are a strict subset of PSXFrameRecord — the fields + * recomp can populate but beetle cannot (e.g. dispatch_count tied to + * psx_dispatch() call gates) are left zero and explicitly documented + * so consumers see real-vs-stub at a glance. + */ +#ifndef PSXRECOMP_BEETLE_HISTORY_H +#define PSXRECOMP_BEETLE_HISTORY_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define BEETLE_FRAME_HISTORY_CAP 36000 +#define BEETLE_RAM_SNAPSHOT_REGIONS 4 +#define BEETLE_RAM_SNAPSHOT_SIZE 128 + +typedef struct { + uint32_t frame_number; + int verify_pass; /* -1: not checked (no verify mode on beetle today) */ + int diff_count; /* 0 */ + + /* MIPS CPU state (read via PSX_CPU::GetRegister). */ + uint32_t gpr[32]; + uint32_t hi, lo; + uint32_t cop0_sr; + uint32_t cop0_cause; + uint32_t cop0_epc; + + /* Interrupt controller (IRQ_GetRegister). */ + uint32_t i_stat; + uint32_t i_mask; + + /* GPU display state (PS_GPU fields). */ + uint16_t display_area_x, display_area_y; + uint16_t display_w, display_h; + uint8_t display_disabled; + + /* SIO / pad. pad_buttons mirrors recomp's pad_buttons word. */ + uint16_t pad_buttons; + uint16_t sio_stat; + uint16_t sio_ctrl; + + /* Timing (left as stubs on beetle for now; documented). */ + uint32_t dispatch_count; + uint64_t total_dispatches; /* mirrors frame_number on beetle */ + + /* Per-frame configurable RAM snapshot regions (MainRAM byte copies). */ + uint32_t snapshot_addr[BEETLE_RAM_SNAPSHOT_REGIONS]; + uint8_t snapshot_data[BEETLE_RAM_SNAPSHOT_REGIONS][BEETLE_RAM_SNAPSHOT_SIZE]; +} BeetleFrameRecord; + +/* ---- Lifecycle hooks (called from beetle_libretro.cpp) ---- */ +void beetle_history_init(void); +void beetle_history_record_frame(void); + +/* ---- Query surface (called from beetle_debug_server.c) ---- + * All "frame" parameters are absolute frame numbers (0..s_history_count-1). + * Frames older than (s_history_count - cap) are evicted and look like + * "not available" in the per-frame APIs. */ + +void beetle_history_get_bounds(uint64_t *out_count, + uint64_t *out_oldest, + uint64_t *out_newest); + +const BeetleFrameRecord *beetle_history_get_frame(uint32_t frame); + +int beetle_history_first_failure(uint32_t *out_frame, int *out_diff_count); + +int beetle_history_set_snapshot(int slot, uint32_t addr); +int beetle_history_get_snapshot(int slot, uint32_t *out_addr, int *out_active); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_BEETLE_HISTORY_H */ diff --git a/overlay_toolchain/include/bios_hle.h b/overlay_toolchain/include/bios_hle.h new file mode 100644 index 00000000..f9547eb8 --- /dev/null +++ b/overlay_toolchain/include/bios_hle.h @@ -0,0 +1,122 @@ +/* bios_hle.h — opt-in High-Level Emulation tier for PSX BIOS kernel services. + * + * CLAUDE.md §0 AMENDMENT 2026-07-02 (the gbarecomp model, see the sibling + * gbarecomp project's src/runtime/bios_hle.h): the recompiled real + * BIOS (LLE) is the DEFAULT, the reference implementation, and the + * correctness/timing oracle. HLE is an *alternative backend*, selected + * per-game via `[runtime] bios_hle = true` in game.toml (PSX_BIOS_HLE env + * override). Every kernel service the HLE layer does not implement + * transparently falls through to the recompiled BIOS, so HLE is never + * load-bearing beyond what it covers and never becomes the oracle. + * + * Mechanism: psx_bios_hle_configure() installs (or leaves NULL) the dispatch + * hook g_psx_bios_hle_hook consulted at the top of every psx_dispatch_impl + * iteration (emitted by full_function_emitter.cpp), BEFORE any backend claims + * the target. The hook sees the pre-normalize physical address; when the + * target is a kernel service vector (0xA0/0xB0/0xC0, function number in $t1) + * and the service is implemented, the handler computes its effect directly on + * guest state (the REAL kernel structures in guest RAM — EvCB table etc., per + * docs/psx_bios_disasm.txt + the SCPH1001 kernel disassembly), charges an + * approximate cycle cost, and returns 1: the guest resumes at $ra with no + * BIOS dispatch. NULL hook (default) = pure LLE, byte-identical dispatch. + * + * Boot HLE: with the tier on (and no keep-intro opt-out) the hook also + * intercepts the first dispatch of the BIOS SHELL entry (RAM 0x30000 — the + * boot animation; LoadRunShell's indirect `0x80030000()` call always routes + * through the dispatcher) and returns immediately, so BIOS Main() proceeds + * straight to step 8 (SYSTEM.CNF + game EXE load) with kernel state built + * entirely by the REAL recompiled kernel init. The frontend runs unpaced + * (turbo) until game handoff. This is THE boot-skip mechanism; it deprecates + * the old fast_boot snapshot restore. + * + * The boot-skip is BIOS-INDEPENDENT and works under pure LLE. It needs only + * the image's shell_entry_phys anchor — nothing is synthesized, the shell call + * just returns immediately — so it fires identically on retail SCPH-1001 and + * on the bundled OpenBIOS, whose kernel-call HLE is separately (and correctly) + * refused for want of a DeliverEvent anchor. bios_hle_plan.h documents why the + * two axes must not be collapsed; deriving the skip from the granted call-HLE + * axis is exactly the bug that made the flag mean different things per BIOS. + * With the tier fully off, LLE plays the real intro. + * + * NO-STUBS STANDS: every handler here is a validated reimplementation of the + * documented kernel mechanism operating on the real guest structures — never + * a "return the answer" fake. Timing is approximate (documented limitation; + * LLE remains the timing oracle). + * + * Observability (CLAUDE.md rule 3 + the global ring-buffer rule): every hook + * decision is recorded in an always-on ring queryable over the TCP debug + * server ("hle_dump"), never armed, never polled. + */ +#ifndef PSXRECOMP_BIOS_HLE_H +#define PSXRECOMP_BIOS_HLE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct CPUState; + +/* The dispatch hook slot the generated trampoline consults (defined in + * bios_hle.c, emitted-extern by full_function_emitter.cpp). NULL = pure LLE. */ +extern int (*g_psx_bios_hle_hook)(struct CPUState* cpu, uint32_t phys); + +/* Select the BIOS backend. Call at bring-up (and again on netplay rematch + * session_reboot), after config + env resolution, before psx_scheduler_run. + * Two independent axes — decide them with psx_bios_hle_plan() (bios_hle_plan.h) + * rather than open-coding the policy at the call site: + * call_hle — service implemented kernel calls in HLE ([runtime] bios_hle); + * requires the image's deliver_event_ret anchor + * boot_skip — one-shot shell intercept ((bios_hle && !keep_intro) OR the + * deprecated fast_boot alias, which skips boot only); requires + * only the image's shell_entry_phys anchor, and is clamped to it + * here so the reported state cannot overstate what can fire + * Clears the shell-skip latch so rematch can skip again. The hook is installed + * when either axis is on; both off = NULL = pure LLE. */ +void psx_bios_hle_configure(int call_hle, int boot_skip); + +int psx_bios_hle_enabled(void); +int psx_bios_hle_boot_skip_enabled(void); +const char* psx_bios_hle_backend_name(void); /* startup banner */ + +/* True while the HLE boot-skip is driving the frontend unpaced: boot skip + * enabled and the game entry PC has not yet been dispatched. main.cpp ORs + * this into the turbo predicate so kernel init + EXE load run at host speed. */ +int psx_bios_hle_boot_turbo_active(void); + +/* ── Always-on HLE ring (queried by debug_server "hle_dump") ─────────────── */ + +enum { + PSX_HLE_ROUTE_LLE = 0, /* vector call seen, fell through to recompiled BIOS */ + PSX_HLE_ROUTE_HLE = 1, /* serviced in HLE */ + PSX_HLE_ROUTE_BOOT = 2, /* boot shell-skip fired */ +}; + +typedef struct PsxHleCallEntry { + uint64_t seq; + uint64_t cycle; /* psx_cycle_count at record time (first occurrence) */ + uint64_t cycle_last; /* psx_cycle_count of the most recent collapsed repeat */ + uint32_t vector; /* 0xA0/0xB0/0xC0, or 0x30000 for the boot skip */ + uint32_t fn; /* $t1 function number (0 for boot skip) */ + uint32_t a0, a1, a2, a3; + uint32_t ra; + uint32_t v0; /* result for HLE-serviced calls (0 otherwise) */ + uint32_t repeat; /* consecutive identical calls collapsed into this entry */ + uint32_t tcb; /* current guest thread: [[0x108]] at call time (0 if unset) */ + uint8_t route; /* PSX_HLE_ROUTE_* */ + uint8_t in_exc; /* recorded inside guest exception context */ +} PsxHleCallEntry; + +#define PSX_HLE_RING_CAP 16384 /* power of two */ + +/* Snapshot accessors: seq is the total number of records ever written; entry + * i (seq-CAP .. seq-1 valid window) returns the ring slot for that sequence. */ +uint64_t psx_hle_ring_seq(void); +const PsxHleCallEntry* psx_hle_ring_entry(uint64_t seq_index); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_BIOS_HLE_H */ diff --git a/overlay_toolchain/include/bios_hle_plan.h b/overlay_toolchain/include/bios_hle_plan.h new file mode 100644 index 00000000..5950b422 --- /dev/null +++ b/overlay_toolchain/include/bios_hle_plan.h @@ -0,0 +1,74 @@ +/* bios_hle_plan.h — the ONE place the BIOS-backend axes are decided. + * + * The HLE tier has two INDEPENDENT axes, and conflating them was a real bug: + * + * call_hle — service implemented kernel calls (B0 events) in HLE instead of + * the recompiled BIOS. Needs the per-image `deliver_event_ret` + * anchor, because a delivered callback has to return through the + * exact $ra the kernel's DeliverEvent loop uses. An image that + * does not export it CANNOT run call-HLE at all. + * + * boot_skip — the one-shot shell intercept that skips the BIOS boot animation + * and lets Main() proceed straight to SYSTEM.CNF + game EXE load. + * Needs only the per-image `shell_entry_phys` anchor, and works + * under pure LLE: nothing is synthesized, the shell call simply + * returns immediately, exactly as if the player had let the disc + * menu exit on its own. + * + * THE BUG THIS MODULE FIXES (2026-07-27). main.cpp used to force the requested + * `bios_hle` flag to false when an image exported no `deliver_event_ret` (the + * correct call-HLE decision), and THEN derived boot_skip from that already- + * mutated flag. So on OpenBIOS — which deliberately omits deliver_event_ret + * until its B0 semantics are validated, but does export shell_entry_phys — the + * player's boot-skip silently stopped working: choosing OpenBIOS sat the player + * in the boot animation while the same build on retail SCPH-1001 went straight + * to the game. One flag, two behaviours, depending on a BIOS detail no player + * can see. + * + * The rule is now explicit and image-independent: `bios_hle` (or the deprecated + * `fast_boot` alias) means "skip the BIOS boot and go to the game", on EVERY + * BIOS that exports a shell entry. Whether the same flag additionally routes + * kernel calls through HLE is a separate, anchor-gated question. + * + * Kept dependency-free (no CPUState, no psx_bios_image, no runtime globals) so + * the whole decision matrix is unit-tested directly — see + * runtime/tests/test_bios_hle_plan.c. + */ +#ifndef PSXRECOMP_BIOS_HLE_PLAN_H +#define PSXRECOMP_BIOS_HLE_PLAN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* What the config/env asked for, plus what the linked BIOS image can support. */ +typedef struct PsxBiosHleRequest { + /* ---- requested (game.toml [runtime] / settings.toml / env) ---- */ + int bios_hle; /* [runtime] bios_hle, PSX_BIOS_HLE */ + int keep_intro; /* bios_hle_keep_intro, PSX_BIOS_HLE_KEEP_INTRO */ + int fast_boot; /* deprecated alias: boot-skip only, never call-HLE */ + /* ---- capabilities of the SELECTED backend (psx_bios_image anchors) ---- */ + int have_deliver_event_ret; /* image exports the DeliverEvent $ra anchor */ + int have_shell_entry; /* image exports the shell entry PC */ + /* ---- session shape ---- */ + int have_game_entry; /* a game EXE is loaded (0 = BIOS-only run) */ +} PsxBiosHleRequest; + +typedef struct PsxBiosHlePlan { + int call_hle; /* pass to psx_bios_hle_configure() as call_hle */ + int boot_skip; /* pass to psx_bios_hle_configure() as boot_skip */ + /* Denial flags: the feature was asked for and is being refused because the + * SELECTED image cannot support it. Purely for the startup banner — a + * silent downgrade is what made the original bug invisible. */ + int call_hle_denied; + int boot_skip_denied; +} PsxBiosHlePlan; + +/* Pure function: same request in, same plan out, no globals touched. */ +PsxBiosHlePlan psx_bios_hle_plan(PsxBiosHleRequest req); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_BIOS_HLE_PLAN_H */ diff --git a/overlay_toolchain/include/boot_state.h b/overlay_toolchain/include/boot_state.h new file mode 100644 index 00000000..27a94b44 --- /dev/null +++ b/overlay_toolchain/include/boot_state.h @@ -0,0 +1,168 @@ +#ifndef PSX_BOOT_STATE_H +#define PSX_BOOT_STATE_H + +#include +#include +#include "cpu_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Boot snapshot (a.k.a. fast_boot) — a COMPLETE post-BIOS save-state. + * + * Model: first launch (and the first launch after ANY app/recompiler update) + * runs the real recompiled BIOS normally, logos and all. At the moment the BIOS + * dispatches into the game's PS-EXE entry_pc, we capture a complete hardware + * snapshot. Every subsequent launch (same build) restores that snapshot and + * presents the game's first frame — instant boot, no BIOS, no logos. + * + * This is NOT HLE: it persists the REAL hardware state produced by a real BIOS + * run, then replays it. Nothing about BIOS behaviour is synthesized. + * + * Rebuild-proof: the file carries an integrity key (below) that includes the + * codegen hash + ABI tag + codegen version. A user update changes those, so a + * stale snapshot can NEVER silently load into a new build — it is rejected and + * the next boot is a normal boot that recaptures. Graceful, automatic. + * + * Completeness is mandatory (v4 no-stub rule): a partial capture that leaves a + * subsystem at reset while CPU/RAM assume it was configured is a latent stub. + * Every mutable hardware subsystem gets a section here, and the capture is + * proven complete by diffing a restored session's frames against a normal-boot + * session's frames (see the "bootsnap" debug command). Host-side / recompiler- + * derived state (dirty-RAM bitmap, overlay tables, debug rings) is NOT + * serialized — it is re-derived from restored guest RAM on load. + */ + +#define BOOT_STATE_MAGIC 0x50535842u /* "PSXB" */ +/* v1 = incomplete RAM-only; v2 = full machine but host-struct memcpy (padding); + * v3 = little-endian field wire (portable Win/Linux/macOS ARM); + * v4 = v3 + optional zlib on large sections (section pad bit0 = compressed); + * v5 = v4 + CD-ROM Sub-Q replacement state; + * v6 = v5 + per-word GPU DMA2 linked-list progress; + * v7 = v6 + pending XA DATA_END IRQ state. */ +#define BOOT_STATE_VERSION 9u +/* v8 added allocated enhancement memory (vanilla v8-era writers kept v7); older + * runtimes must not accept enhanced snapshots while ignoring their arenas. */ +/* v9 persists the BIOS-to-game handoff latch. Engine overlays may have + * replaced the original entry code by the time a gameplay state is loaded. */ +/* v7 intentionally breaks older savestates after the CD-ROM wire grew. Reject + * them at the header before any section changes the live machine. */ +#define BOOT_STATE_VERSION_MIN_READ 7u +/* Section pad bit0: payload is u32 LE uncompressed_len + zlib deflate bytes. */ +#define BOOT_STATE_SEC_ZLIB 1u + +/* + * On-disk header (v3): nine little-endian uint32 fields at offset 0 (36 bytes), + * followed by the section stream. ALL key fields must match the running build + * or the snapshot is rejected. Do not fwrite() this struct — use pst_wire. + */ +typedef struct { + uint32_t magic; /* BOOT_STATE_MAGIC */ + uint32_t version; /* BOOT_STATE_VERSION */ + /* ---- integrity key (every field must match to accept) ---- */ + uint32_t bios_checksum; /* sum of all uint32 words in the BIOS ROM */ + uint32_t entry_pc; /* game PS-EXE entry PC */ + uint32_t codegen_hash; /* PSX_OVERLAY_CODEGEN_HASH (auto-gen by cmake) */ + int32_t abi_tag; /* PSX_OVERLAY_ABI_TAG (abi version | flavor<<16) */ + uint32_t codegen_ver; /* PSX_OVERLAY_CODEGEN_VER */ + /* ---- layout ---- */ + uint32_t section_count; /* number of sections that follow */ + uint32_t reserved; /* v8: enhancement-memory layout cookie; vanilla 0 */ +} BootStateHeader; + +#define BOOT_STATE_HEADER_WIRE_BYTES 36u + +/* + * Section stream (v3/v4): section_count records, each laid out as + * uint32_t tag; LE (one of BS_SEC_*) + * uint32_t pad; LE flags (v3: 0; v4: BOOT_STATE_SEC_ZLIB optional) + * uint64_t len; LE payload byte count + * uint8_t payload[len]; (module payloads are LE field wires too) + * When BOOT_STATE_SEC_ZLIB is set, payload = u32 LE raw_len + zlib(raw). + * Unknown tags are skipped for forward compatibility. A malformed known section + * or a missing required section on load is a hard reject (incomplete restore is + * never allowed) -> normal boot + recapture. + */ +enum { + BS_SEC_GAME_START = 0x12, /* u32 LE boolean: BIOS-to-game handoff completed */ + BS_SEC_MODMEM = 0x11, /* allocated opt-in CPU/GPU enhancement arenas */ + BS_SEC_CPU = 0x01, /* CPUState: gpr/pc/hi/lo/cop0/gte_data/gte_ctrl */ + BS_SEC_RAM = 0x02, /* 2 MB main RAM */ + BS_SEC_SPAD = 0x03, /* 1 KB scratchpad */ + BS_SEC_IRQ = 0x04, /* i_stat / i_mask / cycles_since_vblank (12B; 8B ok) */ + BS_SEC_TIMER = 0x05, /* 3 root counters (counter/mode/target/irq/frac) */ + BS_SEC_CLOCK = 0x06, /* psx_cycle_count */ + BS_SEC_GPU = 0x07, /* GPU regs: display/draw-area/offset/mask/texpage/xfer*/ + BS_SEC_VRAM = 0x08, /* 1 MB VRAM (1024x512x16) */ + BS_SEC_SPU = 0x09, /* SPU regs + 24 voice decode/ADSR state + latches */ + BS_SEC_SPURAM = 0x0A, /* 512 KB SPU RAM */ + BS_SEC_CDROM = 0x0B, /* CD-ROM controller FSM (regs/FIFOs/seek/read/pending)*/ + BS_SEC_DMA = 0x0C, /* DMA channels[7] + dpcr/dicr + async-transfer state */ + BS_SEC_SIO = 0x0D, /* SIO regs + pad-config FSM + memcard FSM */ + BS_SEC_DIRTY = 0x0E, /* dirty-RAM page bitmap (guest-written code pages) */ + BS_SEC_MDEC = 0x0F, /* MDEC command/FIFOs/quant/scale (FMV decode resume) */ + BS_SEC_ICACHE = 0x10, /* R3000A I-cache tag/valid words (1024 u32) — fetch + cost model. Host-persistent otherwise: a warm load + without it replays with the pre-load timeline's + cache, so fetch-miss cycles differ per peer/retry + and IRQ delivery lands a few wait-loop iterations + apart (MotK abort@940: fin cyc Δ8, v0 5c83/5c86 + from identical baselines). Optional on load for + old blobs (left untouched when absent). */ +}; + +/* Save a COMPLETE snapshot at game handoff. Returns 1 on success. */ +int boot_state_save(const CPUState* cpu, uint32_t bios_checksum, + uint32_t entry_pc, const char* path); + +/* Same as boot_state_save, but into a malloc'd buffer (caller frees *out_data). + * Compresses large sections (disk-oriented). */ +int boot_state_save_buffer(const CPUState* cpu, uint32_t bios_checksum, + uint32_t entry_pc, uint8_t** out_data, + size_t* out_len); + +/* In-memory ring snaps: same sections, no zlib. Load accepts either form. + * Avoids compress2 on ~3.5 MiB RAM+VRAM+SPU every live/resim snap (FPS). */ +int boot_state_save_buffer_raw(const CPUState* cpu, uint32_t bios_checksum, + uint32_t entry_pc, uint8_t** out_data, + size_t* out_len); + +/* §96 telemetry: after the latest save, how many VRAM scanlines were dirty + * and whether the incremental mirror path patched (vs full memcpy). */ +uint32_t boot_state_last_vram_dirty_rows(void); +int boot_state_last_vram_incremental(void); + +/* Drop the §96 VRAM mirror (RB shutdown / before re-enable). */ +void boot_state_vram_mirror_reset(void); + +/* Load + validate (integrity key) + restore the full machine. On any mismatch + * or incompleteness returns 0 (caller then boots normally and recaptures). */ +int boot_state_load(const char* path, uint32_t bios_checksum, + uint32_t entry_pc, CPUState* cpu); + +/* Same as boot_state_load, but from an already-buffered .pst image (netplay). */ +int boot_state_load_buffer(const uint8_t* file, size_t file_len, + uint32_t bios_checksum, uint32_t entry_pc, + CPUState* cpu); + +/* Header-only integrity check (no section inflate/apply). Returns 1 if this + * build can load the image; 0 and fills reason (when non-NULL) on reject. */ +int boot_state_check_buffer(const uint8_t* file, size_t file_len, + uint32_t bios_checksum, uint32_t entry_pc, + char* reason, size_t reason_cap); + +/* Register a deferred capture: when boot_state_trigger_capture() fires (from + * fntrace at game-start), serialize to path. One-shot. */ +void boot_state_set_capture(const char* path, uint32_t bios_checksum, + uint32_t entry_pc); + +/* Called from fntrace when the game entry PC first dispatches. */ +void boot_state_trigger_capture(const CPUState* cpu); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_BOOT_STATE_H */ diff --git a/overlay_toolchain/include/card_data_writes.h b/overlay_toolchain/include/card_data_writes.h new file mode 100644 index 00000000..1ed87910 --- /dev/null +++ b/overlay_toolchain/include/card_data_writes.h @@ -0,0 +1,70 @@ +/* + * card_data_writes.h — always-on capture of where the BIOS stores + * incoming SIO data bytes during memory-card READ_DATA. + * + * The chain handler reads each byte from 0x1F801040 (SIO_RX_DATA) and + * stores it into a destination buffer in RAM. We capture (cycle, addr, + * value, mc_state, mc_data_idx, store_pc, func_addr) for every byte + * that lands in RAM during a card data phase. + * + * Mechanism: + * - sio_read(0x1F801040) sets a "pending" flag when mc_state is in + * READ_DATA..READ_END and active_device==DEV_MEMCARD. + * - The next byte/halfword/word RAM write whose new_val matches the + * armed RX value is captured into the ring; the flag is cleared. + * - Non-matching writes between read and store don't disarm us. + * + * Ring is non-evicting up to CARD_DATA_WRITES_CAP, then keeps a + * rolling tail (so we never lose the LATEST writes). For first-32- + * read audit, this gives ~32*128=4096 byte writes — enough to see + * the full destination buffer for several consecutive reads. + */ +#ifndef PSXRECOMP_CARD_DATA_WRITES_H +#define PSXRECOMP_CARD_DATA_WRITES_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define CARD_DATA_WRITES_CAP 4096 + +typedef struct { + uint64_t seq; /* monotonic across all entries */ + uint64_t psx_cycle_count; + uint32_t addr; /* dest physical RAM address */ + uint32_t store_pc; /* g_debug_last_store_pc when stored */ + uint32_t func_addr; /* g_debug_current_func_addr */ + uint32_t value; /* value written (zero-extended) */ + uint16_t mc_state_at_read; /* mc_state at the SIO read */ + uint8_t mc_data_idx_at_read; /* mc_data_idx at the SIO read (0..127) */ + uint8_t width; /* 1, 2, or 4 */ + uint8_t slot; /* mc_slot at read */ + uint8_t pad0; + uint8_t pad1; + uint8_t pad2; +} CardDataWriteEntry; + +/* Called from sio_read(0x1F801040) inside the MC_READ_DATA..READ_END + * window. Records the byte we just delivered to BIOS so the next + * matching RAM write can be tagged. */ +void card_data_writes_arm(uint8_t value, uint16_t mc_state, + uint8_t mc_data_idx, uint8_t slot); + +/* Called from psx_write_byte/half/word. If armed and value matches + * the armed RX byte, record + disarm. Returns 1 if captured, 0 + * otherwise. */ +int card_data_writes_check(uint32_t phys, uint32_t value, uint8_t width); + +uint32_t card_data_writes_get(const CardDataWriteEntry **buf_out, + uint64_t *total_seq_out, + uint32_t *head_out); + +void card_data_writes_reset(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_CARD_DATA_WRITES_H */ diff --git a/overlay_toolchain/include/card_read_summary.h b/overlay_toolchain/include/card_read_summary.h new file mode 100644 index 00000000..8feef597 --- /dev/null +++ b/overlay_toolchain/include/card_read_summary.h @@ -0,0 +1,61 @@ +/* + * card_read_summary.h — non-evicting evidence ring for the first 32 + * completed memory-card reads. + * + * The card-txn ring (256 entries, evicting) covers recent activity + * but the long history is gone by the time we audit. This ring is + * fixed-size and STOPS recording after 32 entries, so the FIRST 32 + * successful reads post-CROSS are preserved indefinitely. + * + * Each entry captures the SIO-layer evidence at the MC_READ_END + * transition: slot/cmd/sector/checksum/first 16 bytes/cycle counts/ + * caller function. The destination RAM pointer is filled in later + * by the chain-handler trace (Phase 3). + */ +#ifndef PSXRECOMP_CARD_READ_SUMMARY_H +#define PSXRECOMP_CARD_READ_SUMMARY_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define CARD_READ_SUMMARY_CAP 32 +#define CARD_READ_SUMMARY_PEEK 16 /* bytes captured from start of buffer */ + +typedef struct { + uint64_t seq; /* monotonic; first record = 0 */ + uint64_t psx_cycle_count; /* guest cycle clock at completion */ + uint32_t current_func; /* g_debug_current_func_addr at MC_READ_END */ + uint32_t last_store_pc; /* g_debug_last_store_pc at MC_READ_END */ + uint16_t sector; + uint8_t slot; + uint8_t cmd; /* mc_cmd at completion (e.g. 0x52) */ + uint8_t checksum_card; /* simulated card's computed checksum */ + uint8_t data_idx_at_end; /* should be 128 for clean READ_END */ + uint8_t pad0; + uint8_t pad1; + uint32_t dest_ram_addr; /* filled by chain-handler trace; 0 if unknown */ + uint8_t data_peek[CARD_READ_SUMMARY_PEEK]; +} CardReadSummary; + +void card_read_summary_record(uint8_t slot, uint8_t cmd, uint16_t sector, + uint8_t checksum, uint8_t data_idx, + const uint8_t *data128); + +/* Read access for debug_server. Returns count of recorded entries. */ +uint32_t card_read_summary_get(const CardReadSummary **buf_out); + +/* Reset the ring (for clean audit re-runs). */ +void card_read_summary_reset(void); + +/* Late-fill the destination RAM pointer for the most recent record. + * Called by chain-handler trace once the BIOS commits the byte to RAM. */ +void card_read_summary_set_dest(uint32_t dest_addr); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_CARD_READ_SUMMARY_H */ diff --git a/overlay_toolchain/include/cdrom.h b/overlay_toolchain/include/cdrom.h new file mode 100644 index 00000000..5a33b389 --- /dev/null +++ b/overlay_toolchain/include/cdrom.h @@ -0,0 +1,352 @@ +#ifndef PSXRECOMP_CDROM_H +#define PSXRECOMP_CDROM_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void cdrom_init(const char* cue_path); + +/* Did cdrom_init() actually mount an image? 0 = the drive is empty. + * + * cdrom_init() is deliberately non-fatal when iso_open() fails (a BIOS-only + * target legitimately runs with no disc), so a game that was GIVEN a disc path + * whose image could not be mounted would otherwise boot straight into an empty + * drive and render nothing -- a black screen with no explanation. Callers that + * passed a real path must check this and report. */ +int cdrom_has_disc(void); +/* Disc license region for GetID ("SCEE"/"SCEA"/"SCEI"); derived from the + * mounted disc's boot serial at launch. Defaults to "SCEA" (SCPH1001). */ +void cdrom_set_disc_scex(const char scex[4]); + +/* Set disc speed multiplier immediately. divisor=0 → instant, 1 → 1x, 2 → 2x. */ +void cdrom_set_speed(int divisor); +/* Store configured game speed (applied post-BIOS via cdrom_notify_game_started). */ +void cdrom_set_game_speed(int divisor); +/* Called by fntrace on first game-range dispatch; switches to game speed. */ +void cdrom_notify_game_started(void); +/* LBA of the most recent SetLoc command (-1 if none yet). Used by the DMA + * ring buffer to correlate each sector transfer with its disc position. */ +int cdrom_get_setloc_lba(void); + +/* 'instant' per-frame sector-IRQ budget (step 3). Clamped to [1, 4096]; + * the per-sector period additionally floors at CDROM_MIN_DELAY. Writers: + * game.toml [runtime] instant_max_per_frame, the cdrom_instant_rate TCP + * command, and the turbo-through-loads predicate (step 4). */ +void cdrom_set_instant_rate(int per_frame); +int cdrom_get_instant_rate(void); + +/* Strict, config-driven warm-load route accelerator. Up to 16 routes may be + * registered after cdrom_init. A route arms only after arm_lba and activates + * only if the following SetLoc values match lbas in order. Any mismatch + * restores normal disc timing. Only non-XA read cadence is accelerated. */ +void cdrom_register_warm_route(int arm_lba, const int* lbas, int count, + int instant_max_per_frame); +void cdrom_warm_route_set_enabled(int enabled); +void cdrom_warm_route_stats_json(char* out, int cap); + +/* Passive physical-deadline -> buffer -> INT1 exposure telemetry (L1.5). + * Diagnostics only: recording never changes CD scheduling or delivery. */ +void cdrom_timing_reset(void); +void cdrom_timing_stats_json(char* out, int cap); +int cdrom_get_delivered_lba(void); + +/* Per-record view of the same ring, for localising a single lost/skipped + * sector rather than summarising thousands. */ +typedef struct CdTimingPub { + uint64_t seq; + uint64_t due_cycle; + uint64_t buffer_cycle; + uint64_t irq_arm_cycle; + uint64_t intc_cycle; + uint32_t frame; + int32_t lba; + uint8_t flags; /* CDT_* bits, mirrored in the JSON as named fields */ +} CdTimingPub; +uint64_t cdrom_timing_total(void); +int cdrom_timing_record(uint64_t seq, CdTimingPub* out); +/* Notify the guest that the mounted disc was reinserted. The controller stops + * active transfers, reports an open shell, waits two emulated seconds, then + * makes the mounted media readable. This call does not mount a different image. */ +void debug_force_cd_reinsert(void); + +/* Multi-disc support. The roster is the image set this build was made from + * (game.toml [game] discs), registered once at launch in roster order. + * + * cdrom_disc_select() mounts a different image while the game runs, through + * the same tray-open event as a reinsert, so a title that asks for its other + * disc can be answered. Returns 0 if the index is outside the roster or the + * image will not open. Indexes are 1-based, matching [disc] selected. */ +void cdrom_disc_roster_set(const char *const *paths, int count, + int selected_1based); +int cdrom_disc_roster_count(void); +int cdrom_disc_selected(void); +const char *cdrom_disc_roster_path(int index_1based); +int cdrom_disc_select(int index_1based); + +/* TOC of the image currently mounted; 0 when the drive is empty. Two images + * of a set have different TOCs, so this is how a caller confirms that a disc + * change reached the reader instead of only moving an index. */ +uint32_t cdrom_mounted_sector_count(void); +int cdrom_mounted_track_count(void); + +/* FMV auto-skip detection: cdrom_xa_stream_active() lets the frontend detect + * that streaming XA (FMV/CDDA) is in progress. The skip itself is done by the + * frontend via uncapped pacing (it does NOT alter CD timing — flooding XA + * sectors desyncs and hangs the player). */ +int cdrom_xa_stream_active(void); +/* True while a CD read is armed with XA/FMV mode bits (or XA already + * streaming). Netplay uses this to arm no-invent / refuse tip episodes + * before the first MDEC colour decode — MotK intro invent≠Start at FMV + * entry opened a tip episode into a matched black wait. */ +int cdrom_fmv_stream_pending(void); +/* Re-arm host absolute CD deadlines from restored relative delays after + * boot_state / RB snap load (read stream + pending/present dues from snap). + * Does NOT clamp delays (unlike accelerate). */ +void cdrom_resync_deadlines_after_restore(void); + +/* CD load-burst ring (always-on). One record per gap-separated run of + * delivered data sectors. `out` receives up to `max` records, newest first + * (layout matches cdrom.c's CdBurst — consumed by debug_server.c only). */ +typedef struct CdBurstRecord { + uint32_t start_frame, end_frame; + uint64_t start_ms, end_ms; + uint32_t sectors; + uint32_t rate; + uint32_t divisor; +} CdBurstRecord; +int cdrom_get_bursts(void *out, int max); +uint32_t cdrom_get_burst_total(void); + +/* True while a data-sector load is in progress (read stream active or a + * data sector delivered within the burst-gap window). XA streaming is never + * a load. Drives turbo-through-loads (step 4). */ +int cdrom_load_in_progress(void); +/* Physical non-XA data-read command state, without the logical load gap + * bridge used by cdrom_load_in_progress(). Diagnostics only. */ +int cdrom_data_read_active(void); + +/* boot_state / netplay digest — full controller FSM (sector FIFOs included). */ +uint32_t cdrom_snapshot_bytes(void); +void cdrom_snapshot_write(uint8_t *p); +int cdrom_snapshot_read(const uint8_t *p, uint32_t len); + +/* After savestate restore: clamp long CD second-response / read-start delays + * and arm a short boost window so post-load ReadTOC/seek/Init waits do not + * freeze the picture for ~1s+. Completions still fire (IRQs preserved). */ +void cdrom_accelerate_after_savestate(void); +/* Call once per host vblank while the boost window is armed. */ +void cdrom_savestate_boost_vblank(void); +/* Non-zero while boost is armed AND a CD wait is outstanding (pending + * second response or non-XA read). Lets turbo_loads unpace those waits. */ +int cdrom_savestate_cd_wait_active(void); +/* Remaining boost vblanks (0 when idle). Diagnostics / post-load probe. */ +int cdrom_savestate_boost_vblanks_remaining(void); + +/* MMIO read/write (0x1F801800-0x1F801803) */ +uint32_t cdrom_read(uint32_t addr); +void cdrom_write(uint32_t addr, uint32_t value); + +/* Advance CD-ROM state machine by guest CPU cycles. Sets i_stat IRQ_CDROM + * when a command completes or data is ready. */ +void cdrom_advance(uint32_t cycles); + +/* Cycle-budgeted precise event slicing: guest CPU cycles until a DELIVERABLE + * CD-ROM IRQ (bit2 unmasked in i_mask). UINT32_MAX if none. */ +uint32_t cdrom_cycles_to_irq(uint32_t i_mask); + +/* Legacy frame-paced entry point for interpreter/oracle builds. */ +void cdrom_tick(void); + +/* DMA channel 3 interface */ +uint32_t cdrom_dma_read(void); +int cdrom_dma_ready(void); +uint32_t cdrom_dma_sector_word_count(void); + +typedef struct CDROMDebugState { + uint64_t seq; + uint8_t index_reg; + uint8_t stat_reg; + uint8_t request_reg; + uint8_t irq_enable; + uint8_t irq_flag; + uint8_t mode_reg; + uint8_t seek_min; + uint8_t seek_sec; + uint8_t seek_sect; + uint8_t pending_cmd; + uint8_t queued_cmd; + uint8_t queued_pending; + uint8_t queued_param_count; + int has_disc; + int param_count; + int response_read; + int response_count; + int sector_read_pos; + int sector_available; + int sector_size; + int reading; + int read_min; + int read_sec; + int read_sect; + uint8_t read_cmd; + uint8_t filter_file; + uint8_t filter_channel; + uint8_t muted; + int read_delay; + /* Cycles until a held CD response is presented to INTC (0 = ready). */ + int irq_present_delay; + int pending_pending; + int pending_delay; + int pending_phase; + /* Operating disc-speed divisor (1 during BIOS; game.toml post-entry). */ + int speed_divisor; + uint32_t i_stat; + int last_sector_lba; + int last_sector_size; + uint32_t last_sector_frame; + uint8_t last_sector_mode; + uint8_t last_sector_have_raw; + /* Read-stream hold accounting: guest cycles the disc clock was frozen + * waiting on guest INT-ack / buffer drain (unfaithful pause; real discs + * never stop). Must stay 0 since the 2026-07-10 continuous-disc fix; + * nonzero = regression. */ + uint64_t read_hold_cycles; + uint64_t read_hold_events; + /* One-deep pended data-ready INT1 accounting (Beetle SetAIP analog). */ + uint64_t int1_pended; + uint64_t int1_lost; + /* Accelerated-read flow control: holds where a faster-than-hardware + * sector was deferred rather than allowed to clobber an unconsumed one. + * Nonzero is healthy (the guest was busy and the enhancement waited); + * int1_lost rising while the speed divisor != 1 is the regression. */ + /* Sector-ring tripwires: starved = a drain found its slot exhausted + * while the writer had moved on (must stay 0); dropped = an unread slot + * was overwritten because the guest fell a full ring behind. */ + uint64_t ring_starved; + uint64_t ring_dropped; + uint64_t accel_consumer_waits; + uint64_t accel_consumer_wait_cycles; + uint8_t int1_pending_now; +} CDROMDebugState; + +typedef struct CDROMSectorDebugState { + int current_available; + int current_read_pos; + int current_size; + int last_lba; + int last_size; + uint32_t last_frame; + uint8_t last_mode; + uint8_t last_have_raw; +} CDROMSectorDebugState; + +typedef struct CDROMTraceEntry { + uint64_t seq; + uint32_t addr; + uint32_t val; + uint32_t func; + uint32_t pc; + uint32_t frame; + uint32_t i_stat; + uint8_t kind; + uint8_t width; + uint8_t index_reg; + uint8_t stat_reg; + uint8_t irq_enable; + uint8_t irq_flag; + uint8_t param_count; + uint8_t response_read; + uint8_t response_count; + uint8_t sector_available; + uint8_t request_reg; + uint8_t mode_reg; + uint8_t pending_cmd; + uint8_t pending_pending; + uint8_t reading; + uint8_t read_cmd; + int sector_read_pos; + int sector_size; + int pending_delay; + int read_delay; +} CDROMTraceEntry; + +#define CDROM_TRACE_CAP (1 << 16) +#define CDROM_COMMAND_HISTORY_CAP (1 << 13) +#define CDROM_SECTOR_HISTORY_CAP (1 << 13) +#define CDROM_SECTOR_HISTORY_BYTES 128 + +typedef struct CDROMCommandHistoryEntry { + uint64_t seq; + /* Guest cycle at which this command was issued/executed. Frame numbers + * cannot separate "the guest had not asked yet" from "the command was + * queued behind an unacked INT" -- both look like one frame. */ + uint64_t cycle; + uint32_t frame; + uint32_t func; + uint32_t pc; + uint32_t i_stat; + uint8_t kind; + uint8_t cmd; + uint8_t param_count; + uint8_t params[16]; + uint8_t stat; + uint8_t request; + uint8_t irq_enable; + uint8_t irq_flag; + uint8_t mode; + uint8_t seek_min; + uint8_t seek_sec; + uint8_t seek_sect; + uint8_t read_min; + uint8_t read_sec; + uint8_t read_sect; + uint8_t read_cmd; + uint8_t reading; + uint8_t pending_cmd; + uint8_t pending_pending; + uint8_t queued_cmd; + uint8_t queued_pending; + /* Immediate response FIFO as the guest will read it (e.g. the GetTD MSF, + * the GetTN track range), so a TOC can be checked from the ring. */ + uint8_t response_count; + uint8_t response[16]; +} CDROMCommandHistoryEntry; + +typedef struct CDROMSectorHistoryEntry { + uint64_t seq; + int lba; + int size; + uint32_t frame; + uint8_t mode; + uint8_t have_raw; + uint8_t raw_mode; + uint8_t xa_file; + uint8_t xa_channel; + uint8_t xa_submode; + uint8_t xa_coding; + uint8_t data_delivered; + uint8_t xa_audio_delivered; + uint8_t skip_reason; + uint16_t bytes_len; + uint8_t bytes[CDROM_SECTOR_HISTORY_BYTES]; +} CDROMSectorHistoryEntry; + +void cdrom_debug_snapshot(CDROMDebugState* out); +uint64_t cdrom_debug_get_trace(const CDROMTraceEntry** out_entries); +void cdrom_debug_clear_trace(void); +uint64_t cdrom_debug_get_command_history(const CDROMCommandHistoryEntry** out_entries); +void cdrom_debug_clear_command_history(void); +uint32_t cdrom_debug_copy_last_sector(uint32_t offset, uint32_t len, + uint8_t* out, + CDROMSectorDebugState* state); +uint64_t cdrom_debug_get_sector_history(const CDROMSectorHistoryEntry** out_entries); +void cdrom_debug_clear_sector_history(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_CDROM_H */ diff --git a/overlay_toolchain/include/code_provider.h b/overlay_toolchain/include/code_provider.h new file mode 100644 index 00000000..a84152d9 --- /dev/null +++ b/overlay_toolchain/include/code_provider.h @@ -0,0 +1,61 @@ +/* code_provider.h — the backend-agnostic code-production seam. + * + * One interface the overlay capture/dispatch spine talks to instead of calling + * a specific backend directly. The validated gcc/tcc spawn->DLL->rescan path is + * its implementation. Everything that makes overlays correct — content-keyed + * multi-candidate dispatch, per-call live-byte validation, the self-mod + * blacklist, the coverage manifest — is backend-blind. + * + * Production is BATCH / ASYNC (request / busy / poll_main): kicked by the + * autocapture tick, spawns a compiler off-thread, applied later via a cache + * rescan on the emu thread. Seconds of latency; many fragments per run. A + * provider sets the hooks it supports and leaves the rest NULL; callers + * null-check before invoking. + * + * (The in-process sljit JIT provider — a synchronous on-miss producer with a + * compile_fragment hook — was removed 2026-07-15; it had been disabled by + * default since 2026-06-25 due to an emitter bug. Gaps gcc/tcc have not yet + * covered fall to the interpreter, the always-safe precision-over-recall floor.) + */ +#ifndef PSXRECOMP_CODE_PROVIDER_H +#define PSXRECOMP_CODE_PROVIDER_H + +#include "cpu_state.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Native shard ABI — identical to overlay_loader's OverlayFn. */ +typedef void (*CodeProviderFn)(CPUState *); + +typedef struct CodeProvider { + const char *name; /* "gcc" (spawns gcc OR tcc) */ + int (*available)(void); /* a compile cmd is configured */ + + /* Batch/async production (autocapture-driven). request() returns 1 if a + * compile was started. busy() is 1 while one is in flight. poll_main() runs + * on the emu thread to apply a finished compile (cache rescan). Any may be + * NULL on a provider that does not do batch production. */ + int (*request)(void); + int (*busy)(void); + void (*poll_main)(void); +} CodeProvider; + +/* Resolve the active backend (overlay_backend_resolve) and cache the matching + * provider. cfg_backend = [runtime] overlay_backend ("auto"|"gcc"|"tcc"| + * "auto-no-gcc", may be NULL/empty for auto); gcc_configured = + * autocompile_configured(). Call once at overlay-cache init, on the emu thread, + * before the run loop starts. */ +void code_provider_init(const char *cfg_backend, int gcc_configured); + +/* The active/primary provider (owns the batch path + default selection). Never + * NULL — defaults to the gcc provider before code_provider_init() runs. */ +const CodeProvider *code_provider_active(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_CODE_PROVIDER_H */ diff --git a/overlay_toolchain/include/color_lut.h b/overlay_toolchain/include/color_lut.h new file mode 100644 index 00000000..fc9a4691 --- /dev/null +++ b/overlay_toolchain/include/color_lut.h @@ -0,0 +1,84 @@ +/* color_lut.h — present-time screen-color simulation (BGR555 -> RGB888 LUT). + * + * PRESENT-TIME ONLY. This never touches the emulation, the VRAM the GPU + * produces, or the differential-verify path — diff_frame / oracle comparisons + * stay defined on the raw RGB888 expansion the GPU scanout produces. The LUT + * is a 32768-entry table consulted at the 15-bit-scanout -> RGB888 conversion + * step (gpu_rgb555_to_rgb888), and it defaults to Raw (exact 5->8 passthrough), + * so default behavior and every hashed/verified frame are byte-identical unless + * a screen model is opted in via PSX_SCREEN={raw,crt,composite,trinitron}. + * + * The math is first-principles CIE colorimetry (xyY->XYZ, primaries->matrix, + * Bradford adaptation, sRGB OETF) over a CRT/composite display model; it is not + * a ported shader. + * + * SCOPE / WHAT IS MODELLED vs DOCUMENTED-ONLY: + * - The 15-bit (BGR555) display path is fully covered: each scanout pixel is + * a 5-bit-per-channel index into the baked table. + * - The 24-bit (depth24, FMV) display path is NOT colour-mapped here — those + * frames already carry 8-bit-per-channel data and have no 5-bit hardware + * index to key the table on; they pass through untouched (documented). + * - The model is a REASONABLE consumer-CRT / composite approximation (SMPTE-C + * phosphors, ~2.4 display gamma, a small black lift). The real per-TV + * transfer and the composite-encoder bandwidth/notch effects are NOT + * guessed at the signal level — only a colorimetric approximation is baked. + * See docs/SHADOW_ENHANCEMENTS.md for what is approximated. + * + * ── Attribution ─────────────────────────────────────────────────── + * Ported from JRickey/gba-recomp (https://github.com/JRickey/gba-recomp), + * crates/screen/src/{color,profile,lut}.rs, via the gbarecomp C++ port + * (src/runtime/color_lut.*), © Jrickey, MIT OR Apache-2.0, used with + * permission. The C re-implementation and the CRT/composite panel models are + * ours. See THIRD_PARTY_ATTRIBUTION.md. + */ + +#ifndef PSXRECOMP_COLOR_LUT_H +#define PSXRECOMP_COLOR_LUT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Which physical display model to simulate. */ +typedef enum { + SCREEN_RAW = 0, /* 5->8 bit replication, untouched (default; passthrough) */ + SCREEN_CRT, /* generic consumer CRT (SMPTE-C phosphors, gamma ~2.4) */ + SCREEN_COMPOSITE, /* CRT via composite: same phosphors, lifted black + softer */ + SCREEN_TRINITRON, /* late near-sRGB Trinitron-class tube, clean blacks */ +} ScreenKind; + +/* Display colorspace the emitted bytes are interpreted in. */ +typedef enum { + DISPLAY_SRGB = 0, + DISPLAY_P3, +} DisplayTarget; + +/* Parse a config/env token; returns false if unrecognized. */ +bool screen_kind_from_name(const char* name, ScreenKind* out); + +typedef struct { + ScreenKind screen; /* default SCREEN_RAW */ + double darken; /* <0 = per-screen default */ + DisplayTarget target; /* default DISPLAY_SRGB */ +} ColorSettings; + +/* A baked BGR555 -> RGB888 table. Build once per settings change; apply per + * scanout pixel as one indexed lookup. Opaque to callers. */ +typedef struct ColorLut ColorLut; + +ColorLut* color_lut_create(const ColorSettings* settings); +void color_lut_destroy(ColorLut* lut); +bool color_lut_is_passthrough(const ColorLut* lut); + +/* Map one BGR555 hardware pixel (red=low 5 bits, as in PS1 VRAM) to RGB888. */ +void color_lut_map555(const ColorLut* lut, uint16_t bgr555, + uint8_t* r, uint8_t* g, uint8_t* b); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_COLOR_LUT_H */ diff --git a/overlay_toolchain/include/cosim_state.h b/overlay_toolchain/include/cosim_state.h new file mode 100644 index 00000000..04ead474 --- /dev/null +++ b/overlay_toolchain/include/cosim_state.h @@ -0,0 +1,67 @@ +/* cosim_state.h — full-architectural-state canonical hash for the first-divergence + * co-simulation oracle. See COSIM_ORACLE.md. + * + * The single correctness rule: this hash must cover EVERY piece of state that can + * influence future guest execution, and NOTHING that is host-only (pointers, padding, + * jmpbufs, fiber/malloc addresses). A missed execution-relevant field is a blind spot + * (false "no divergence"); an included host-only field is a false positive. The + * validation gates in COSIM_ORACLE.md (compiled-vs-compiled == 0, injected-divergence + * halts at the right field) exist to prove this list is exactly right. + */ +#pragma once +#include +#include "cpu_state.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* Per-subsystem sub-hashes so a mismatch localizes to a subsystem before a full + * field/byte diff. All 64-bit FNV-1a over canonical little-endian serialization. */ +typedef struct { + uint64_t cpu; /* GPRs/HI/LO/PC/COP0/GTE + micro-state (muldiv/gte/load-delay) */ + uint64_t irqctl; /* i_stat/i_mask + interrupts.c timing statics + VBLANK schedule */ + uint64_t ram; /* 2MB main RAM (incremental page-hash) */ + uint64_t scratch; /* 1KB scratchpad */ + uint64_t vram; /* 1MB VRAM (incremental page-hash) */ + uint64_t gpu; /* GPU regs + FIFO + draw budget + deadlines (boot_state blob) */ + uint64_t spu; /* SPU regs + voices + SPU RAM */ + uint64_t cdrom; /* CDROM command/FIFO/phase/next-event */ + uint64_t dma; /* DMA channel regs + in-flight/deadlines */ + uint64_t sio; /* SIO/pad/memcard transaction state */ + uint64_t timers; /* RootCounters counter/mode/target/frac/last-update */ + uint64_t clock; /* psx_cycle_count */ + uint64_t dirty; /* dirty-RAM page bitmap (affects dispatch/interp routing) */ +} CosimSubHashes; + +/* Compute the full canonical state hash of the LIVE machine (debug_cpu_ptr + globals). + * Fills `sub` (may be NULL) and returns the folded top hash. Cheap per call: RAM/VRAM + * use incremental page hashes maintained by cosim_note_ram_write/cosim_note_vram_write; + * everything else is small. */ +uint64_t cosim_state_hash(CosimSubHashes *sub); + +/* Incremental page-hash maintenance. Call from the RAM/VRAM write chokepoints in the + * cosim build: mark the touched page dirty (cheap); the page hash is recomputed lazily + * inside cosim_state_hash(). phys is the byte offset into RAM (0..2MB) / VRAM (0..1MB). */ +void cosim_note_ram_write(uint32_t phys, uint32_t nbytes); +void cosim_note_vram_write(uint32_t byte_off, uint32_t nbytes); + +/* Reset all incremental state (call once at machine init / after a full state load). */ +void cosim_state_reset(void); + +/* ---- engine (cosim.c) ---- */ +void cosim_init(void); /* start the TCP oracle server (call once at startup) */ +void cosim_block(uint32_t pc); /* block-leader pc stash (emitted + interp), reporting */ +uint32_t cosim_last_block(void); /* last block-leader pc, for diagnostic attribution */ +void cosim_tick(void); /* cycle-keyed checkpoint (called from psx_advance_cycles) */ +void cosim_instr(uint32_t pc); /* retire pending cycle checkpoints at an instruction boundary */ +uint32_t cosim_cycles_to_next_checkpoint(void); + +/* Gate-4 fault injection: after this is armed, the next cosim_state_hash perturbs one + * byte of RAM (addr) or one CPU GPR (reg 0..31, hi=32, lo=33) by XOR val, so the + * oracle MUST halt at exactly that field. Returns via the same hash path. */ +void cosim_inject_ram(uint32_t phys, uint8_t xor_val); +void cosim_inject_reg(int reg_index, uint32_t xor_val); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/cpu_state.h b/overlay_toolchain/include/cpu_state.h new file mode 100644 index 00000000..d03b97a1 --- /dev/null +++ b/overlay_toolchain/include/cpu_state.h @@ -0,0 +1,377 @@ +/* ============================================================================ + * cpu_state.h — Phase 2 runtime version + * ---------------------------------------------------------------------------- + * This is the RUNTIME version of the CPUState header. It has the same struct + * layout as generated/cpu_state.h (Phase 1a compile-only artifact) but is + * intended to be linked into a runnable binary. + * + * The generated C files (SCPH1001_full.c, SCPH1001_dispatch.c) include + * "cpu_state.h" and the build uses -I runtime/include so they find this file. + * ========================================================================== */ + +#ifndef PSXRECOMP_CPU_STATE_H +#define PSXRECOMP_CPU_STATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* (sljit shard host-helper table removed 2026-07-15 with the sljit tier.) */ + +typedef struct CPUState { + uint32_t gpr[32]; /* $0..$31; gpr[0] is hardwired zero, never written */ + uint32_t pc; /* program counter */ + uint32_t hi, lo; /* mult/div result registers */ + uint32_t cop0[32]; /* COP0 system control registers (SR, Cause, EPC, ...) */ + uint32_t gte_data[32]; /* COP2 (GTE) data registers */ + uint32_t gte_ctrl[32]; /* COP2 (GTE) control registers */ + + /* Memory access function pointers -- wired at init to psx_read/psx_write. */ + uint32_t (*read_word)(uint32_t addr); + void (*write_word)(uint32_t addr, uint32_t value); + uint16_t (*read_half)(uint32_t addr); + void (*write_half)(uint32_t addr, uint16_t value); + uint8_t (*read_byte)(uint32_t addr); + void (*write_byte)(uint32_t addr, uint8_t value); + + /* Mult/div completion deadline (absolute guest cycle). Set by MULT/MULTU/ + * DIV/DIVU to psx_cycle_count()+latency; a later MFLO/MFHI stalls (advances + * cycles) until this deadline — faithful R3000A behavior (Beetle + * muldiv_ts_done). Appended at END so prior field offsets are unchanged. */ + uint64_t muldiv_ts_done; + + /* GTE (COP2) command completion deadline (absolute guest cycle). A GTE + * command sets this to psx_cycle_count()+(cost-1) (cost from gte.cpp per-op + * returns; -1 because the COP2 instruction's own +1 base is charged + * separately). Back-to-back commands serialize (set stalls to the prior + * deadline first); any COP2 register access (MFC2/CFC2/MTC2/CTC2/LWC2/SWC2) + * stalls until it — faithful R3000A behavior (Beetle gte_ts_done). + * Appended at END so prior field offsets are unchanged. */ + uint64_t gte_ts_done; + + /* ---- R3000A load-delay pipeline interlock (Beetle ReadAbsorb/ReadFudge/ + * LDAbsorb/LDWhich) — TIMING ONLY; the load VALUE delay is handled by the + * existing load-delay correctness path. See psx_cyc.h + accuracy/ + * load_readfudge_ldabsorb.md. Models: a load's data-access cost becomes a + * per-register "give-back" (read_absorb) that following instructions consume + * instead of charging their own +1 base; plus the +2 "fudge" charged on a + * load whose predecessor committed no load. Appended at END so prior field + * offsets are unchanged (precompiled overlay DLLs bake offsets). */ + uint8_t read_absorb[33]; /* ReadAbsorb[0..31] + [32]=0x20 DO_LDS dummy slot */ + uint8_t read_absorb_which; /* ReadAbsorbWhich: GPR the last committed load wrote */ + uint8_t read_fudge; /* ReadFudge: last committed load's dest reg, or 0x20 = none */ + uint8_t ld_which_t; /* LDWhich (timing): pending load dest reg, 0x20 = none */ + uint32_t ld_absorb; /* LDAbsorb: pending load's give-back (region+completion) */ +} CPUState; + +/* Overlay DLLs batch per-instruction cycle charges in a DLL-local accumulator. + * A guest store is an observation boundary: MMIO handlers must see the cycle + * count through the store instruction, and RAM/self-modification/capture hooks + * must run after those cycles have been published to the host. Generated code + * calls this immediately before every store (and before SWL/SWR's raw read). + * Static recompiled code and the interpreter share host cycle state directly, + * so their barrier compiles to nothing. */ +#ifdef PSX_OVERLAY_DLL_BUILD +/* Kept here rather than in psx_cycles.h because cpu_state.h is the first + * generated-code include that declares the store barrier. The preamble is + * inserted after all generated includes, so both declaration and definition + * must carry the same export attribute for Clang. */ +# if defined(_WIN32) +# define PSX_OVERLAY_EXPORT __declspec(dllexport) +# else +# define PSX_OVERLAY_EXPORT __attribute__((visibility("default"))) +# endif +PSX_OVERLAY_EXPORT void overlay_flush_cycles(void); +static inline void psx_store_cycle_barrier(void) { overlay_flush_cycles(); } +#else +static inline void psx_store_cycle_barrier(void) { } +#endif + +/* Faithful exception-return (fix B) — defined in runtime/src/interrupts.c. The + * interrupted-thread resume PC is the REAL guest PC, stored in COP0.EPC and (by the + * BIOS handler) in the thread's TCB EPC slot — never a sentinel, never a single + * global — so a thread suspended mid-exception (ChangeThread) resumes at its OWN PC. + * The host longjmp escape out of the NESTED synchronous handler is keyed on "RFE + * while in_exception" (psx_rfe_mark_escape, called by the recompiled `rfe` op; + * psx_rfe_escape_check, called in the dispatch trampoline), not on pc==sentinel. + * Declared here (not psx_runtime.h) because the generated BIOS includes only this. */ +typedef enum { + PSX_EXC_ESCAPE_NONE = 0, + PSX_EXC_ESCAPE_RFE_RETURN, + PSX_EXC_ESCAPE_SYSCALL_RETURN, + PSX_EXC_ESCAPE_LEGACY_SENTINEL, +} psx_exc_escape_reason_t; + +/* The host escape token for the SYNCHRONOUS (nested) exception handler. It is a + * pure HOST control-flow marker — it must NEVER be persisted into a guest TCB as a + * thread's resume PC. If it does, that thread will resume by resolving the sentinel + * through host escape state (the multi-thread bug fix B repaired), not at its own + * code. The save/restore/fiber-entry guards in traps.c are fail-closed on this. */ +#define PSX_EXC_SENTINEL_PC 0x80000048u +extern int g_rfe_escape_pending; +extern int g_exc_escape_reason; /* psx_exc_escape_reason_t */ +extern uint32_t g_exception_real_epc; +void psx_rfe_mark_escape(void); +void psx_rfe_escape_check(CPUState* cpu); + +/* Trap trampolines — defined in runtime/src/traps.c */ +/* psx_syscall returns 1 if control transfers (cpu->pc set to a dispatch target; + * the caller must return to the trampoline), 0 for a directly-handled "void" + * syscall (Enter/ExitCriticalSection). Under CPS the generated code emits + * `if (psx_syscall(...)) return;` so a void syscall falls through to the inline + * post-syscall code (the guest's own jr $ra); legacy callers ignore the return + * value and rely on cpu->pc (0 = handled, resume at caller). */ +extern int psx_syscall(CPUState* cpu, uint32_t code); +extern void psx_arith_overflow(CPUState* cpu); +/* Mult/div completion-stall timing (psx_cycles.c). MULT/MULTU/DIV/DIVU call + * psx_muldiv_set with their latency (DIV/DIVU = 37; MULT/MULTU via the latency + * helpers, indexed on the first operand magnitude). MFLO/MFHI call + * psx_muldiv_stall, which advances guest cycles to the deadline if not yet + * reached. Faithful only with per-instruction cycle charging. */ +extern void psx_muldiv_set(CPUState* cpu, uint32_t latency); +extern void psx_muldiv_stall(CPUState* cpu); +extern uint32_t psx_mult_latency_s(uint32_t rs); /* MULT (signed) */ +extern uint32_t psx_mult_latency_u(uint32_t rs); /* MULTU (unsigned) */ + +/* GTE (COP2) per-command completion-stall timing (psx_cycles.c). gte_execute() + * calls psx_gte_set with the command's added latency (cost-1, from + * psx_gte_cmd_latency); it serializes back-to-back ops by stalling to the prior + * deadline first. Every COP2 register access calls psx_gte_stall, which advances + * guest cycles to the deadline if the op is still in flight. Faithful only with + * per-instruction cycle charging. */ +/* R3000A I-cache instruction-FETCH cost (psx_icache.h). HIT is inlined; + * MISS lives in psx_icache.c. Shared by interp + compiled emitters. */ +#include "psx_icache.h" + +extern void psx_gte_set(CPUState* cpu, uint32_t latency); +extern void psx_gte_stall(CPUState* cpu); +/* MFC2/CFC2 GTE register read: stall to the deadline AND arm the load-delay + * give-back (ld_absorb=gte_ts_done-now, ld_which_t=rt) — Beetle MFC2/CFC2. */ +extern void psx_gte_read(CPUState* cpu, uint32_t rt); +extern uint32_t psx_gte_cmd_latency(uint32_t cmd); /* cost-1 for the 6-bit op */ + +extern void psx_unaligned_access(CPUState* cpu, uint32_t addr, uint32_t pc); +extern void psx_break(CPUState* cpu, uint32_t code, uint32_t pc); +/* Fail-closed native entry guard: a function's CPS entry-switch calls this when + * dispatched at a PC that is not one of its legal entries (foreign interior PC + * from a range-ownership mismatch). The function returns without executing; the + * overlay dispatch then routes the PC to the sanctioned dirty-RAM interpreter. */ +extern void psx_native_bad_entry(CPUState* cpu, uint32_t owner, uint32_t pc); + +/* Dispatch — defined in generated/SCPH1001_dispatch.c */ +extern void psx_dispatch(CPUState* cpu, uint32_t target_addr); +extern void psx_dispatch_call(CPUState* cpu, uint32_t target_addr, uint32_t return_addr); + +/* Cycle-budgeted precise event slicing — defined in runtime/src/dirty_ram_interp.c. + * Emitted at each compiled block leader: if it returns nonzero the block ran + * through the per-instruction interpreter (interrupt taken at the exact + * architectural instruction) and cpu->pc holds a dispatchable resume point, so + * the caller must `return` without executing its compiled body. See + * PRECISE_IRQ_SLICE.md. + * + * PARKED default OFF (g_psx_precise_slice=0). The hot inline returns 0 with no + * call; PSX_PRECISE_SLICE=1 enables the impl for A/B. Every compiled block + * leader hits this — MotK VLC alone issues millions of calls/s. */ +extern int g_psx_precise_slice; +extern int psx_slice_block_impl(CPUState* cpu, uint32_t block_addr, uint32_t bcyc, int side_effects); +void psx_precise_slice_init_from_env(void); +#ifdef PSX_OVERLAY_DLL_BUILD +int psx_slice_block(CPUState* cpu, uint32_t block_addr, uint32_t bcyc, int side_effects); +#else +static inline int psx_slice_block(CPUState* cpu, uint32_t block_addr, uint32_t bcyc, int side_effects) { + if (!g_psx_precise_slice) return 0; + return psx_slice_block_impl(cpu, block_addr, bcyc, side_effects); +} +#endif + +/* Unknown dispatch — defined in runtime/src/traps.c */ +extern void psx_unknown_dispatch(CPUState* cpu, uint32_t addr, uint32_t phys); + +/* GTE (COP2) — defined in runtime/src/gte.cpp */ +extern void gte_execute(CPUState* cpu, uint32_t cmd); +/* Widescreen X-squash: display aspect num:den (4,3 = identity/off). Scales + * RTPS/RTPT screen-X around the game's OFX so a 4:3 frame stretched to the + * wide aspect shows a wider field of view. */ +extern void gte_set_display_aspect(int num, int den); +extern void gte_ws_set_suppress(int on); /* 8C: un-squash far backdrop draws */ +extern void gte_ws_configure_dome_sites(const uint32_t* sites, int count); +extern uint32_t gte_read_data(CPUState* cpu, uint8_t reg); +extern uint32_t gte_read_ctrl(CPUState* cpu, uint8_t reg); +extern void gte_write_data(CPUState* cpu, uint8_t reg, uint32_t val); +extern void gte_write_ctrl(CPUState* cpu, uint8_t reg, uint32_t val); +/* Normalize raw save-state/imported backing arrays to the architectural form + * expected by generated direct-register fast paths. This is not a guest + * register write: in particular, it preserves a computed FLAG bit 31. */ +extern void gte_canonicalize_cpu_state(CPUState* cpu); +/* Drop host-only projection/geometry provenance after a raw machine-state + * rewind or discarded speculative pass. Guest-visible GTE registers are not + * changed. */ +extern void gte_precision_timeline_invalidate(void); +/* Isolate a speculative native validation pass from host-only projection + * caches while preserving the preceding authoritative interpreter result. */ +extern void gte_precision_speculative_begin(void); +extern void gte_precision_speculative_end(void); +extern void gte_precision_store_word(uint32_t addr, uint8_t reg); +extern void gte_precision_tracking_set(int enabled); +/* Sub-pixel vertex precision ([video] geometry_correction). Enables the side + * cache that retains the 16.16 projection fraction the GTE discards when it + * saturates SXY to integer screen pixels. Guest-visible GTE state is + * unchanged — this is a visual-only enhancement, default off. */ +extern void gte_geometry_correction_set(int enabled); +extern int gte_geometry_correction_enabled(void); +/* Corrected vertices consumed since the last gte_geometry_correction_set — + * the "is this actually doing anything on this title" counter. */ +extern uint32_t gte_geometry_correction_hits(void); +/* Lookup census: attempted, hit, and the two miss classes. The position table + * is exact, so miss_unrecorded counts genuine tracking-coverage gaps. */ +extern void gte_geometry_correction_stats(uint32_t *lookups, uint32_t *hits, + uint32_t *miss_unrecorded, + uint32_t *miss_ambiguous); + +/* Exact NCLIP audit coverage: precise = all three SXY shadows are coherent and + * word-validated; fallback = native integer-only; disagreements counts cases + * where sub-pixel and guest-visible integer signs differ. MAC0 stays native. */ +extern void gte_nclip_precise_stats(uint64_t *hits, uint64_t *fallbacks, + uint64_t *disagreements); +extern int gte_nclip_native_wide_sign(int32_t native_mac0, int* sign); +extern int gte_nclip_native_wide_previous_sign(int32_t native_mac0, int* sign); +extern int psx_ws_nclip_branch(uint32_t pc, uint32_t instr, int32_t mac0, int vanilla); +/* Title-scoped widescreen cull consumer ([widescreen.cull] nclip_exact_sites). + * Returns the sign (-1/0/1) the branch at `pc` should test: the exact tracked + * NCLIP sign only when it belongs to the supplied native MAC0, otherwise the + * native sign. Counts per-site use (gte_nclip_stats.h). Does not change + * guest-visible GTE state. */ +extern int32_t gte_nclip_exact_sign(int32_t native_mac0, uint32_t pc); + +/* PGXP dataflow-shadowing hook macros (PGXP_LOAD/STORE/ALU/MULDIV/COP2). + * The emitter writes them unconditionally; they expand to real calls only + * under -DPSX_PGXP=1 (the pgxp build variant) and to ((void)0) otherwise. + * Pulled in here so every generated translation unit sees them. */ +#include "pgxp_hooks.h" + +/* ============================================================================ + * Dispatch call contract (Bug D / wild-return family fix) + * ---------------------------------------------------------------------------- + * Generated C continuations mirror the guest call graph: after `jal F`, the C + * code calls F's C function and then falls into the continuation block. Real + * hardware has only one stack; if F's flow goes wild (returns to an address + * other than the call site's $ra, or with a shifted $sp — e.g. a mid-function + * entry running an epilogue for a frame it never pushed), the hardware simply + * keeps executing wherever the guest jumped, and the interrupted caller's + * code never resumes. Our C model, by contrast, resumes the suspended C + * continuation whenever the C call returns — re-executing tails on a moved + * guest stack (the Bug A/C/D zombie family). + * + * The contract: a C continuation may run ONLY if the guest actually arrived + * at it — i.e. the callee came back with $ra == the call site's return + * address and $sp == the caller's stack pointer at the call. When the + * contract is violated, we begin a "bail" unwind: cpu->pc is set to the + * guest's true target (the wild jr's destination), g_psx_call_bail is set, + * and every generated frame returns immediately without running its + * continuation. The unwind resolves at the first enclosing call site (or + * dispatch loop) whose (return address, sp) contract matches the guest's + * arrival state; if none matches, the outermost dispatch loop clears the + * flag and tail-dispatches the wild target with a clean host stack. + * + * g_psx_call_bail is defined in runtime/src/traps.c. Overlay DLLs share + * the runtime's state through pointers wired by overlay_init (the + * PSX_OVERLAY_DLL_BUILD branch; see overlay_api.h / compile_overlays.py). + * ========================================================================== */ +#ifdef PSX_OVERLAY_DLL_BUILD +extern int *g_psx_call_bail_p; +extern uint64_t *g_psx_bail_first_p; +extern uint64_t *g_psx_bail_resolved_p; +#define g_psx_call_bail (*g_psx_call_bail_p) +#define g_psx_bail_first (*g_psx_bail_first_p) +#define g_psx_bail_resolved (*g_psx_bail_resolved_p) +/* The store-PC breadcrumb the emitter writes before every guest store is the + * runtime's, not the DLL's (ABI v24, overlay_api.h last_store_pc). */ +extern uint32_t *g_psx_last_store_pc_p; +#define g_debug_last_store_pc (*g_psx_last_store_pc_p) +#else +extern int g_psx_call_bail; +extern uint64_t g_psx_bail_first; /* contract violations detected */ +extern uint64_t g_psx_bail_resolved; /* unwinds resolved at a call site */ +extern uint64_t g_psx_bail_flattened; /* unwinds flattened at outermost */ +extern uint64_t g_psx_bail_anomaly; /* bail flag seen where impossible */ +#endif + +/* Deduped wild-return source ledger (traps.c). Not present in overlay DLLs + * (they share runtime bail state via pointers, not this recorder). */ +#ifndef PSX_OVERLAY_DLL_BUILD +extern void psx_bail_record(uint32_t site_ra, uint32_t site_sp, + uint32_t wild_pc, uint32_t guest_sp); +#endif + +/* Validate a direct call site after the callee's C return. + * Returns 1 if the caller must `return;` immediately (bail in progress), + * 0 if the continuation is valid. site_ra = the call's return address, + * site_sp = guest $sp recorded immediately before the call. + * + * The return PC is compared in full, segment included + * (docs/SEGMENT_AWARE_CODE.md §5.5): site_ra is the link the call wrote, in + * the segment of the body that made it, and a guest returning to another + * segment's alias of the call site did not return to that body. The BIOS + * dispatch loop (full_function_emitter.cpp) applies the same rule. */ +static inline int psx_call_contract(CPUState* cpu, uint32_t site_ra, + uint32_t site_sp) { + if (g_psx_call_bail) { + /* An inner frame began a bail unwind. Resolve here iff the guest's + * arrival state matches this site's contract. */ + if (cpu->pc == site_ra && cpu->gpr[29] == site_sp) { + g_psx_call_bail = 0; + g_psx_bail_resolved++; + cpu->pc = 0; + return 0; + } + return 1; + } + if (cpu->gpr[29] != site_sp || cpu->gpr[31] != site_ra) { + /* First detection: the callee C-returned but the guest did not + * return here. $ra holds the wild jr's true destination (the + * longjmp-return emission sets cpu->pc = $ra before returning, + * which is the same value). */ + g_psx_call_bail = 1; + g_psx_bail_first++; +#ifndef PSX_OVERLAY_DLL_BUILD + psx_bail_record(site_ra, site_sp, cpu->gpr[31], cpu->gpr[29]); +#endif + cpu->pc = cpu->gpr[31]; + return 1; + } + return 0; +} + +#ifdef __cplusplus +} +#endif + +/* R3000A load-delay interlock helpers (psx_cyc.h). Included LAST so CPUState is + * fully defined first; psx_cyc.h's own #include "cpu_state.h" is a guarded no-op. + * This makes the per-instruction timing API visible to EVERY generated file and + * runtime TU that includes cpu_state.h. */ +#include "psx_cyc.h" + +/* Release call-entry stamp — inlined into every generated BIOS/game TU that + * includes this header (MotK VLC entry tax). Debug builds use the out-of-line + * ring path in debug_server.c. */ +#ifdef PSX_NO_DEBUG_TOOLS +#ifdef __cplusplus +extern "C" { +#endif +extern volatile uint32_t g_psx_last_fn_entry; +#ifdef PSX_OVERLAY_DLL_BUILD +void debug_server_log_call_entry(uint32_t func_addr); +#else +static inline void debug_server_log_call_entry(uint32_t func_addr) { + g_psx_last_fn_entry = func_addr; +} +#endif +#ifdef __cplusplus +} +#endif +#endif + +#endif /* PSXRECOMP_CPU_STATE_H */ diff --git a/overlay_toolchain/include/crash_trace.h b/overlay_toolchain/include/crash_trace.h new file mode 100644 index 00000000..2c6b8a87 --- /dev/null +++ b/overlay_toolchain/include/crash_trace.h @@ -0,0 +1,43 @@ +#ifndef PSXRECOMP_CRASH_TRACE_H +#define PSXRECOMP_CRASH_TRACE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Install signal/SEH/atexit handlers. Call once early in main(). */ +void psx_crash_trace_install_handlers(void); + +/* Manually trigger a crash dump. `reason` is a short string identifying + * the trigger (e.g. "fail_fast_unknown_dispatch", "trap_crash"). On + * Windows, `seh_info` is the EXCEPTION_POINTERS* from the SEH filter or + * NULL. Writes to psx_last_run_report.json (overwrite). */ +void psx_crash_trace_dump(const char *reason, void *seh_info); + +/* Tag a deliberate exit() so the atexit report can attribute it + * (e.g. "tcp_quit", "sdl_window_close"). An "atexit" report whose + * exit_origin is still "unknown" means an untagged exit fired. */ +void psx_crash_trace_set_exit_origin(const char *origin); + +/* Terminal stop for deliberate fatal sites (unhandled MMIO access, + * trap_crash, fail-fast unknown dispatch). Writes the structured crash + * report AND a full freeze-style ring dump, then: + * - debug-tools builds: halts emulation but keeps pumping the TCP + * debug server forever so every ring buffer stays queryable + * post-mortem (ring-buffer-first: the crash state is interrogated, + * not just snapshotted). + * - PSX_NO_DEBUG_TOOLS builds: exit(1) as before. + * Never returns. */ +void psx_fatal_halt(const char *reason); + +/* Set when psx_fatal_halt fires; the freeze heartbeat includes it so an + * external reader can tell a fatal halt from a wedge. NULL = healthy. */ +extern const char *g_psx_fatal_reason; + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_CRASH_TRACE_H */ diff --git a/overlay_toolchain/include/crc32.h b/overlay_toolchain/include/crc32.h new file mode 100644 index 00000000..080de009 --- /dev/null +++ b/overlay_toolchain/include/crc32.h @@ -0,0 +1,19 @@ +#pragma once +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Compute CRC32 (IEEE 802.3) over a byte buffer. */ +uint32_t crc32_compute(const uint8_t *data, size_t len); + +/* Incremental CRC32. Start from 0xFFFFFFFF, fold each chunk through + * crc32_update, then XOR the final running value with 0xFFFFFFFF. The result + * equals crc32_compute over the concatenation of the same chunks. */ +uint32_t crc32_update(uint32_t crc, const uint8_t *data, size_t len); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/cue_sheet.h b/overlay_toolchain/include/cue_sheet.h new file mode 100644 index 00000000..7900c35d --- /dev/null +++ b/overlay_toolchain/include/cue_sheet.h @@ -0,0 +1,82 @@ +// cue_sheet.h — the single cue-sheet parser for the runtime. +// +// A .cue is the authoritative table of contents for a PS1 disc dump: it names +// the backing BINARY file(s) and the TRACK/INDEX layout (data track, CD-DA +// audio tracks, pregaps). Everything that needs to understand a cue goes +// through here so the mount path (iso_reader.cpp), the identity/verify path +// (disc_identity.cpp) and the picked-path resolver (disc_path.cpp) can never +// disagree about what a given cue describes. +// +// Parsing is deliberately permissive about surface syntax (case, quoting, +// leading whitespace) and strict about semantics: a FILE whose type is not +// BINARY is reported rather than guessed at, because WAVE/MP3 payloads have no +// fixed sector geometry and mis-mapping the TOC is worse than refusing the +// image. + +#pragma once + +#include +#include +#include +#include + +namespace PSXRecompV4 { + +// One FILE line, resolved against the cue's own directory. +struct CueFileRef { + std::string name; // exactly as written in the cue + std::filesystem::path path; // resolved (absolute where possible) + bool is_binary = false; // FILE type token was BINARY + bool exists = false; // resolved path is a real file +}; + +// One TRACK, with its INDEX times still expressed relative to the OWNING FILE +// (the cue's own convention). Converting to disc-relative LBAs needs each +// file's sector count, which only the mounting code knows. +struct CueTrackRef { + int number = 0; + bool is_audio = false; + size_t file_index = 0; // index into CueSheet::files + uint32_t index01 = 0; // track start, file-relative LBA + uint32_t index00 = 0; // pregap start, file-relative LBA + bool has_index00 = false; + // PREGAP / POSTGAP lengths in sectors. Unlike INDEX 00, these gaps are + // NOT stored in the file: the mount must insert them as silent sectors, + // shifting every later disc LBA (and the TOC) accordingly. + uint32_t pregap = 0; + uint32_t postgap = 0; +}; + +struct CueSheet { + bool opened = false; // the .cue itself was readable + + std::vector files; // in cue order + std::vector tracks; // in cue order + + // True when every FILE line named a BINARY payload that exists on disk — + // i.e. this cue can actually be mounted as written. + bool usable() const; + + // True when at least one FILE line named a non-BINARY payload. + bool has_non_binary_file() const; + + // Index of the file backing the first non-audio track, else 0. This is the + // file that carries SYSTEM.CNF / the ISO9660 header, so it is the one + // identity and CRC checks must read. + size_t data_file_index() const; +}; + +// Case-insensitive extension test. `dotted_ext` includes the dot, e.g. ".cue". +bool path_has_extension_ci(const std::filesystem::path& p, const char* dotted_ext); + +// Resolve `name` (as written in a cue) against `dir`. Falls back to a +// case-insensitive directory scan when the literal name does not exist, so a +// redump cue written on Windows still mounts on a case-sensitive filesystem. +// Returns the literal resolution when nothing matches. +std::filesystem::path resolve_cue_relative_file(const std::filesystem::path& dir, + const std::string& name); + +// Parse `cue_path`. A sheet whose `opened` is false could not be read at all. +CueSheet parse_cue_sheet(const std::filesystem::path& cue_path); + +} // namespace PSXRecompV4 diff --git a/overlay_toolchain/include/data_shards.h b/overlay_toolchain/include/data_shards.h new file mode 100644 index 00000000..92c9343c --- /dev/null +++ b/overlay_toolchain/include/data_shards.h @@ -0,0 +1,50 @@ +/* data_shards.h — memoized pure-function replay ("post-decompression shards"). + * + * Design: docs/DATA_SHARDS.md. Functions listed in game.toml [data_shards] + * funcs get a gen-time entry hook (psx_datashard_enter) and return hooks + * (psx_datashard_ret). First encounter of a (function, inputs) pair runs + * NATIVELY under a read/write recorder fed from the memory chokepoints; + * the finalized shard stores the read-set (input proof), write-set (effect), + * caller-visible register results, and the guest cycle cost. Subsequent + * encounters byte-verify the read-set against live RAM (kernel-bless style) + * and, on match, apply the write-set, restore registers, and credit the + * recorded cycles through the normal advance/IRQ machinery — guest timing + * preserved, host executes ~a memcmp+memcpy instead of the function. + * + * Purity is proven per-capture: any MMIO access, DMA write into RAM, or + * abnormal exit during the recording window poisons the capture. FMV/MDEC + * streaming is out of scope by design (user directive 2026-07-10). + */ +#ifndef PSXRECOMP_DATA_SHARDS_H +#define PSXRECOMP_DATA_SHARDS_H + +#include +#include "cpu_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Gen-time hooks (emitted by code_generator for [data_shards] funcs). */ +int psx_datashard_enter(CPUState* cpu, uint32_t key); /* 1 = replayed, return now */ +void psx_datashard_ret(CPUState* cpu); /* at the function's jr $ra */ + +/* Memory-chokepoint feeds (memory.c). Called only while g_ds_recording != 0, + * outside exception context. addr is the VIRTUAL address. */ +extern volatile int g_ds_recording; +void ds_note_read(uint32_t addr, uint32_t size); +void ds_note_write(uint32_t addr, uint32_t size); +void ds_note_mmio(uint32_t addr, int is_read); /* purity poison */ +void ds_note_dma_write(void); /* DMA wrote RAM mid-window: poison */ + +/* Runtime init (cache dir for persistence; NULL disables persistence). */ +void ds_init(const char* cache_dir, const char* game_id); + +/* Debug/TCP surface. */ +void ds_stats_json(char* buf, int cap); +void ds_set_enabled(int on); + +#ifdef __cplusplus +} +#endif +#endif /* PSXRECOMP_DATA_SHARDS_H */ diff --git a/overlay_toolchain/include/debug_server.h b/overlay_toolchain/include/debug_server.h new file mode 100644 index 00000000..ba776a17 --- /dev/null +++ b/overlay_toolchain/include/debug_server.h @@ -0,0 +1,269 @@ +/* + * debug_server.h -- TCP debug server for PSX recomp v4 + * + * Non-blocking TCP server on localhost (default port 4370). + * JSON-over-newline protocol, polled once per vblank. + * Includes a 36000-frame ring buffer for retroactive state queries. + * + * Same public API names as nesrecomp/snesrecomp debug servers + * so docs/TCP_COMMANDS.md and docs/internal/DEBUG.md documentation is + * reusable across projects. + */ +#ifndef PSXRECOMP_DEBUG_SERVER_H +#define PSXRECOMP_DEBUG_SERVER_H + +#include +#include + +#include "cpu_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* ---- Ring buffer frame record ---- */ + +#define FRAME_HISTORY_CAP 36000 /* ~10 min @ 60fps */ +#define MAX_FRAME_DIFFS 32 +#define RAM_SNAPSHOT_REGIONS 4 +#define RAM_SNAPSHOT_SIZE 128 + +typedef struct { + uint16_t addr; + uint8_t mine; + uint8_t theirs; +} FrameDiffEntry; + +typedef struct { + uint32_t frame_number; + int verify_pass; /* 1=pass, 0=fail, -1=not checked */ + int diff_count; + + /* ---- MIPS CPU state ---- */ + uint32_t gpr[32]; + uint32_t hi, lo; + uint32_t cop0_sr; + uint32_t cop0_cause; + uint32_t cop0_epc; + + /* ---- Interrupt state ---- */ + uint32_t i_stat; + uint32_t i_mask; + + /* ---- GPU display state ---- */ + uint16_t display_area_x, display_area_y; + uint16_t display_w, display_h; + uint8_t display_disabled; + + /* ---- SIO state ---- */ + uint16_t pad_buttons; + uint16_t sio_stat; + uint16_t sio_ctrl; + + /* ---- Timing ---- */ + uint32_t dispatch_count; + uint64_t total_dispatches; + + /* ---- Game-specific (filled by hook) ---- */ + uint8_t game_data[32]; + + /* ---- Last function name ---- */ + char last_func[32]; + + /* ---- Configurable RAM snapshot regions ---- */ + uint32_t snapshot_addr[RAM_SNAPSHOT_REGIONS]; + uint8_t snapshot_data[RAM_SNAPSHOT_REGIONS][RAM_SNAPSHOT_SIZE]; + + /* ---- Divergence diffs (verify mode) ---- */ + FrameDiffEntry diffs[MAX_FRAME_DIFFS]; +} PSXFrameRecord; + +/* ---- Public API (same names as NES version) ---- */ + +/* Initialize the server. Call once at startup. + * port=0 uses the default (4370). */ +void debug_server_init(int port); + +/* Current listener status for heartbeat diagnostics. error is the platform + * socket error captured by init, or 0 when the listener is active. */ +void debug_server_get_status(int *listening, int *port, int *error); + +/* Poll for incoming connections and commands. Non-blocking. + * Call once per vblank. */ +void debug_server_poll(void); + +/* FMV quiet mode suppresses high-frequency trace rings while MDEC video is + * active. The TCP command pump stays live; expensive per-dispatch/per-frame + * recording backs off so debug builds can still play FMVs at speed. */ +void debug_server_set_fmv_quiet(int quiet); +int debug_server_fmv_quiet(void); + +/* TCP serve-stall telemetry: cumulative main-thread ms spent inside + * bounded TCP sends, and clients dropped for exceeding the send budget. + * Surfaced in the freeze heartbeat / wedge dumps so a TCP-throttled run + * is never misattributed to a guest-side stall. */ +uint64_t debug_server_get_tcp_stall_ms(void); +uint32_t debug_server_get_tcp_drops(void); + +/* Record the current frame's state into the ring buffer. + * Call after vblank processing. */ +void debug_server_record_frame(void); +/* Operator capture mark (hotkey, present thread): freeze the always-on display + * and GP0 rings at this instant and save the presented native-wide frame, so a + * transient glitch can be read back afterwards over TCP (capture_mark). */ +void debug_server_capture_mark(void); + +/* Block while paused, polling TCP + SDL events. + * Call from vblank callback before frame processing. */ +void debug_server_wait_if_paused(void); + +/* Graceful shutdown. Call at exit. */ +void debug_server_shutdown(void); + +/* Check if a TCP client is connected. */ +int debug_server_is_connected(void); + +/* ---- Tier 1 reverse debugger: write trace ---- */ + +/* Current dispatch target — set by psx_dispatch() before each call. + * Captured by the write-trace hook for function attribution. */ +extern uint32_t g_debug_current_func_addr; + +/* Multi-range write-trace check. Called from memory.c write paths. + * Iterates up to 8 configurable address ranges; records matching + * writes into the 1M-entry ring buffer with function + frame attribution. */ +void debug_server_trace_write_check(uint32_t phys, uint32_t old_val, + uint32_t new_val, uint8_t width); + +/* MMIO write trace — separate ring buffer for 0x1F801xxx writes. */ +void debug_server_trace_mmio_write(uint32_t addr, uint32_t val, uint8_t width); + +/* Dispatch trace — record every function dispatched. */ +void debug_server_trace_dispatch(uint32_t func_addr); +void debug_server_trace_dispatch_return(uint32_t func_addr, CPUState *cpu); + +/* Direct-call entry hook — emitted by the recompiler at the top of every + * generated function. Release (PSX_NO_DEBUG_TOOLS): inlined in cpu_state.h + * (stamp g_psx_last_fn_entry). Debug builds use the out-of-line ring path. */ +extern volatile uint32_t g_psx_last_fn_entry; +#ifndef PSX_NO_DEBUG_TOOLS +void debug_server_log_call_entry(uint32_t func_addr); +#endif +void debug_server_log_call_entry_cpu(uint32_t func_addr, CPUState *cpu); +/* Addressable stub for overlay CPS callbacks (always out-of-line). */ +void debug_server_log_call_entry_fn(uint32_t func_addr); + +/* Last store instruction PC — set by the recompiler before every memory + * store (sb/sh/sw/swl/swr/swc2). Read by SIO/MMIO write handlers to + * attribute the writing instruction without needing a full call-stack + * walk. Stale across non-store instructions but every store updates it. */ +extern uint32_t g_debug_last_store_pc; + +/* SIO write PC tracer ring — records (pc, addr, value, byte_seq) for every + * write to SIO_DATA / SIO_CTRL / SIO_STAT. Always-on; pulled via TCP cmd + * "sio_pc_trace". */ +void debug_server_log_sio_write(uint32_t addr, uint32_t value, uint8_t width); + +/* Targeted generated-PC probe ring used for narrow control-flow diagnostics. */ +void debug_server_log_probe(uint32_t pc, CPUState *cpu); + +/* RestoreState / exception longjmp tracer. Records nonlocal exception + * control-flow events that can skip normal function epilogues. */ +void debug_server_log_restore_event(uint32_t kind, uint32_t target_pc, uint32_t jmp_val); + +/* BIOS ChangeThread / TCB context tracer. Records runtime thread switches + * and the saved register block belonging to the selected TCB. */ +void debug_server_log_thread_event(uint32_t kind, CPUState *cpu, + uint32_t current_tcb, + uint32_t target_tcb, + uint32_t target_pc); +void debug_server_log_thread_event_ex(uint32_t kind, CPUState *cpu, + uint32_t current_tcb, + uint32_t target_tcb, + uint32_t target_pc, + uintptr_t current_fiber, + uintptr_t target_fiber); + +/* Dirty-RAM dispatch break. Used by the dynamic-code interpreter to pause + * immediately when dispatch enters a configured address range, before a hot + * loop can overwrite the trace rings. */ +int debug_server_dirty_break_maybe_pause(uint32_t target, CPUState *cpu); + +/* ---- Watchpoint notifications ---- */ + +void debug_server_check_watchpoints(void); + +/* ---- Input override ---- */ + +/* Returns >= 0 if the debug server wants to override pad input, + * -1 if no override is active. Value is PS1 16-bit button mask. */ +int debug_server_get_input_override(void); + +/* Optional analog-stick override set alongside set_input (lx/ly/rx/ry, + * 0..255, 0x80 = centre). Returns 1 and fills st[lx,ly,rx,ry] when armed, + * 0 when the injection is buttons-only. */ +int debug_server_get_axis_override(unsigned char st[4]); + +/* TCP-controlled turbo mode. When enabled the frontend skips presentation and + * wall-clock pacing at vblank, matching the keyboard TAB turbo path. */ +int debug_server_turbo_enabled(void); + +/* TCP-controlled turbo mode. When enabled the frontend skips presentation and + * wall-clock pacing at vblank, matching the keyboard TAB turbo path. */ +int debug_server_turbo_enabled(void); + +/* ---- Send helpers (for extensions) ---- */ + +/* Set the CPU state pointer for register queries. Call after CPU init. */ +void debug_server_set_cpu(CPUState *cpu); + +/* Global CPU pointer — set by debug_server_set_cpu(). Available for + * hardware simulation modules that need to read CPU state (e.g. GPU + * capturing stack values during A0 uploads). */ +extern CPUState *debug_cpu_ptr; + +void debug_server_send_line(const char *json); +void debug_server_send_fmt(const char *fmt, ...); + +/* ---- Freeze auto-dump accessors ---- + * + * Called from the freeze_heartbeat thread (NOT from TCP). Each function + * writes a JSON array `[entry1,entry2,...]` of the newest `max_count` + * entries from its ring directly to the given FILE*. Caller wraps with + * the field name (e.g. "wtrace_all":[ ... ]). + * + * Thread-safety: best-effort. The heartbeat thread fires these only + * after detecting a main-thread stall, so concurrent writers are rare, + * but a wedged loop that still touches RAM could tear an entry near the + * ring head. Forensic value is in the bulk of older entries which are + * stable. */ +void debug_server_freeze_dump_wtrace_all_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_wtrace_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_mmio_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_frame_history_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_sio_pc_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_thread_trace_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_restore_trace_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_irq_check_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_first_zero_restore_json(FILE *f); +void debug_server_freeze_dump_entryint_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_cdrom_state_json(FILE *f); +void debug_server_freeze_dump_cdrom_trace_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_cdrom_sector_history_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_dma_state_json(FILE *f); +void debug_server_freeze_dump_dma_trace_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_exception_trace_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_thread_ctx_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_fn_entry_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_dirty_block_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_dirty_insn_json(FILE *f, uint32_t max_count); +void debug_server_freeze_dump_evcb_json(FILE *f, uint32_t max_count); + +/* frame_fingerprint reset_on_load: called when a savestate load completes. */ +void debug_server_note_savestate_loaded(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_DEBUG_SERVER_H */ diff --git a/overlay_toolchain/include/debug_trace_ranges.h b/overlay_toolchain/include/debug_trace_ranges.h new file mode 100644 index 00000000..5175333b --- /dev/null +++ b/overlay_toolchain/include/debug_trace_ranges.h @@ -0,0 +1,30 @@ +#ifndef PSXRECOMP_DEBUG_TRACE_RANGES_H +#define PSXRECOMP_DEBUG_TRACE_RANGES_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct PSXDebugTraceRange { + uint32_t lo; + uint32_t hi; +} PSXDebugTraceRange; + +/* + * Parse "lo,hi[;lo,hi...]" into masked-physical, half-open ranges. + * + * Returns the number of ranges, or -1 for malformed/reversed input and -2 + * when the destination is too small. Callers must discard the output on any + * negative result. + */ +int psx_debug_parse_trace_ranges(const char *spec, + PSXDebugTraceRange *ranges, + int capacity); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/device_trace.h b/overlay_toolchain/include/device_trace.h new file mode 100644 index 00000000..0274d5e2 --- /dev/null +++ b/overlay_toolchain/include/device_trace.h @@ -0,0 +1,73 @@ +/* device_trace.h — general two-process DEVICE-EVENT cycle ring. + * + * Purpose: name the device/IRQ event whose guest-cycle timing diverges between + * psx-runtime (code under test) and psx-beetle (independent oracle). Where + * parity_trace answers "which control-flow / gate-input diverged", this answers + * the level below it: "which hardware event (CD sector IRQ / DMA completion / + * RootCounter / VBlank / SPU) fired at a different guest cycle" — the producer + * of an over-fast or over-slow wait. + * + * Model (CLAUDE.md ring-buffer doctrine): ALWAYS-ON from boot, records one row + * per hardware IRQ-raise edge (the single choke point each backend funnels its + * device interrupts through — native psx_irq_raise(); Beetle mednafen + * IRQ_Assert rising edge), stamped with the deterministic guest-cycle ruler. + * A probe QUERIES the ring for a cycle window; it never arms-then-times. + * + * Generality: nothing here is title-specific. The SAME TU compiles into both + * binaries and emits IDENTICAL rows, so tools/devtrace_diff.py pulls both + * timelines and aligns them by guest cycle to find the first divergent event. + * This is the reusable device-timing audit substrate for the whole ecosystem + * (see recomp-template); the MMX6 cutscene asset-load over-fast wedge is its + * first user. + */ +#ifndef DEVICE_TRACE_H +#define DEVICE_TRACE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* IRQ source = the PSX I_STAT bit index. Identical on both backends (mednafen + * irq.h uses the same numbering). */ +typedef enum { + DEV_IRQ_VBLANK = 0, + DEV_IRQ_GPU = 1, + DEV_IRQ_CDROM = 2, + DEV_IRQ_DMA = 3, + DEV_IRQ_TIMER0 = 4, + DEV_IRQ_TIMER1 = 5, + DEV_IRQ_TIMER2 = 6, + DEV_IRQ_SIO0 = 7, + DEV_IRQ_SIO1 = 8, + DEV_IRQ_SPU = 9, + DEV_IRQ_PIO = 10, +} dev_irq_source_t; + +typedef struct { + uint64_t seq; /* monotonic event index since boot */ + uint64_t cycle; /* absolute guest CPU cycles at the raise (the ruler) */ + uint32_t frame; /* host video frame at the raise */ + uint32_t source; /* dev_irq_source_t — the I_STAT bit raised */ + uint32_t detail; /* source-specific: DMA channel / timer index / 0 */ +} DevEvent; + +void device_trace_arm(int on); /* on=1 begins recording (idempotent) */ +void device_trace_reset(void); /* clear ring (keeps armed state) */ +int device_trace_is_armed(void); /* hot-path gate: cheap one-branch check */ + +/* Record one device-IRQ raise edge. No-op unless armed. Stamps cycle+frame via + * the process's guest-cycle/frame accessors (shared with parity_trace). */ +void device_trace_note(uint32_t source, uint32_t detail); + +/* Readback: copies up to max_rows NEWEST events, oldest-first, into out[]. */ +uint32_t device_trace_get(DevEvent* out, uint32_t max_rows); +uint64_t device_trace_total(void); +const char* device_source_str(uint32_t source); + +#ifdef __cplusplus +} +#endif + +#endif /* DEVICE_TRACE_H */ diff --git a/overlay_toolchain/include/dirty_ram_interp.h b/overlay_toolchain/include/dirty_ram_interp.h new file mode 100644 index 00000000..e9a9620f --- /dev/null +++ b/overlay_toolchain/include/dirty_ram_interp.h @@ -0,0 +1,473 @@ +/* dirty_ram_interp.h — interpret-on-dispatch for install-at-runtime RAM. + * + * See CLAUDE.md Rule 18 and docs/dynamic_handler_install.md for the full + * rationale. The PS1 BIOS dynamically writes 4-instruction dispatch stubs + * into kernel RAM (notably RAM 0xCF0 for the SIO data-byte handler). A + * static recompiler can't see those bytes at compile time, so a small MIPS + * interpreter here runs them at dispatch time on the same CPUState. + * + * Scope: this is NOT a fallback for code the recompiler failed to translate. + * It runs only against PCs in pages that have been written-to since boot. + * Static-recompiled code continues to handle ROM-resident code and game + * RAM. See docs/dynamic_handler_install.md for the inline note about a + * potential future migration to runtime JIT (Option B). + */ +#ifndef PSXRECOMP_DIRTY_RAM_INTERP_H +#define PSXRECOMP_DIRTY_RAM_INTERP_H + +#include +#include +#include "psx_memory.h" +#include "cpu_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Returns 1 if `addr` lies in a dirty kernel-RAM page and the interpreter + * ran a basic block at that PC. Returns 0 if `addr` is clean (caller must + * fall back to the static dispatch table). On return with 1, cpu->pc is + * either 0 (block ended on jr $ra style return) or the target of a tail + * jump that the dispatch trampoline should re-enter. + * + * `stop_addr` is the dispatch loop's return contract (psx_dispatch_call's + * return_addr; 0 for plain tail dispatches). The interpreter's overlay + * local-flow chaining MUST NOT run past it: when a transfer (or fall- + * through) reaches stop_addr, the interpreter exits with cpu->pc == + * stop_addr so the dispatch loop returns into the suspended native + * caller. Skipping this check lets the interp execute the native + * caller's tail itself; the suspended native host frame then resumes and + * double-executes that tail against a moved guest stack, restoring + * garbage callee-saved registers (the pig-throw blue-screen/MMIO-fatal + * corruption, 2026-06-10). */ +int dirty_ram_dispatch(CPUState* cpu, uint32_t addr, uint32_t stop_addr); + +/* Replay [start_pc, stop_pc) of already-loaded guest code from the CPU state + * given: every PC in the range is interpreted from its live RAM bytes, even + * where a compiled body or a compiled resume point (the return address of a + * call) begins, so a span can start in the middle of a compiled function. + * Calls the span makes run on their normal backend and return into it. + * Returns 1 when control reaches stop_pc, 0 when it leaves the range any other + * way (a return, a jump out, a nested span) or runs past max_insns + * interpreted instructions. The range is half-open, CODE identity, one span + * at a time. A span is a replay, not a function entry: it fires no + * function-entry hooks at its own PCs and stays out of capture, alias seeding + * and per-PC entry statistics. Instruction hooks fire as in compiled code. + * Mods reach it through psx_mod_run_guest_span (render passes only). */ +int dirty_ram_run_span(CPUState* cpu, uint32_t start_pc, uint32_t stop_pc, + uint64_t max_insns); +/* Why the last span that failed stopped: 1 returned (pc 0), 2 left the range, + * 3 call-bail unwind, 4 instruction budget, 5 the interpreter declined the PC, + * 6 bad arguments or a span already open, 7 a call did not return to the + * span (`after`). `pc` is where control was. */ +typedef struct DirtyRamSpanFailure { + uint32_t reason, pc, start_pc, stop_pc; + uint32_t ra, after; /* $ra at the exit; pc after a call that did not return */ + uint64_t insns; +} DirtyRamSpanFailure; +void dirty_ram_span_last_failure(DirtyRamSpanFailure *out); +/* The open span (0,0 = none), for landings that longjmp past its exit. */ +void dirty_ram_span_get(uint32_t *lo, uint32_t *hi); +void dirty_ram_span_set(uint32_t lo, uint32_t hi); + +/* Retire a deferred R3000A load-delay writeback (see dirty_ram_interp.c). The + * interpreter defers a load's destination-register write past the delay-slot + * instruction, as hardware does; call this anywhere control leaves the + * interpreter or an exception is delivered, so no register write is dropped. */ +void dirty_ram_ld_delay_flush(CPUState* cpu); + +/* Drop a deferred load-delay writeback WITHOUT applying it. Required on + * savestate/RB restore: the snap already has architectural GPRs, and a + * host-static pending load from the pre-load timeline must not stomp them + * on the next interp step (selfcheck MotK v0=countdown vs v0=1 forks). */ +void dirty_ram_ld_delay_discard(void); + +/* Save / put back the deferred load-delay writeback exactly. For a landing + * that longjmps out of interpreted code and then resumes the interrupted + * code (the render-pass watchdog abort, render_pass.c): the pass's pending + * load must not reach the resumed timeline, and the interrupted one's must + * survive. */ +typedef struct DirtyRamLoadDelay { + uint32_t rt, val, age; + int armed; +} DirtyRamLoadDelay; +void dirty_ram_ld_delay_save(DirtyRamLoadDelay *out); +void dirty_ram_ld_delay_restore(const DirtyRamLoadDelay *in); + +/* Re-anchor host-only dirty IRQ pump ambient (entry-poll stride + 4096-insn + * gap) after snap restore. Not in boot_state — peers that drifted through FMV + * otherwise entered the post-FMV dirty wait on opposite poll phases. */ +void dirty_ram_irq_ambient_resync_after_restore(void); + +/* Overlay-cache windows — the address ranges eligible for capture, offline + * recompilation, and per-entry-validated native execution (Rule 18 code that + * does not exist in any compile-time image): + * + * Kernel RAM [0x00000, 0x10000): the BIOS part-2 image relocated to RAM + * plus install-at-runtime stubs (e.g. the SIO data-byte stub at 0xCF0). + * Dirty-tracked per CPU store (dirty_ram_mark_kernel_write). + * Overlay region [OVERLAY_REGION_FLOOR, live RAM end): game overlays loaded by + * CD DMA (dirty_ram_mark_executable_range). + * + * Main-EXE text [0x10000, OVERLAY_REGION_FLOOR): CLEAN pages are statically + * recompiled and never captured. But games that discard their boot/init code + * load gameplay overlays OVER this region (Tomba 2: hot gameplay code at + * 0x1DA88/0x24548/0x3116C, well below its 0x38800 floor). Post-baseline + * (dirty_ram_clear_image_baseline) a DIRTY page here is by definition live + * overlay code — the compiled image is stale for it — so dirty boot-text + * pages ARE a capture/candidate window (2026-07-06; before this they could + * only interpret, which dominated wall time at ~300ns/insn). + * + * The interpreter's LOCAL-FLOW gates (is_local_dirty_target / + * phys_is_overlay_flow_region) use DIRTY_RAM_KERNEL_WINDOW_END alone: only + * the kernel window stays per-block (it runs in exception context where the + * verified dispatch cadence is delicate). Native coverage for the kernel + * window comes from the overlay loader, not from interp chaining. */ +#define DIRTY_RAM_KERNEL_WINDOW_END 0x00010000u + +/* The overlay-region floor is the END of THIS game's statically-recompiled + * main-EXE text (phys). Everything at/above it is runtime-loaded overlay code, + * eligible for in-interpreter local-flow chaining and overlay-cache capture. + * + * It is a RUNTIME value (g_overlay_region_floor), NOT a compile-time constant, + * because it differs per game: Tomba 1's text ends at 0x98000 (0x10000+0x88000) + * but Tomba 2's boot EXE is only 0x28800 (text ends at 0x38800). A hardcoded + * 0x98000 misclassified Tomba 2's overlays (loaded at 0x85000+) as main-EXE + * text, forcing them onto the slow block-by-block dispatch path AND through the + * bail-prone non-local-call contract — the Whoopee-Camp splash freeze. main.cpp + * sets g_overlay_region_floor = (load_address + text_size) & 0x1FFFFFFF at game + * load; OVERLAY_REGION_FLOOR_DEFAULT applies for BIOS-only runs. */ +#define OVERLAY_REGION_FLOOR_DEFAULT 0x00098000u +extern uint32_t g_overlay_region_floor; +#define OVERLAY_REGION_FLOOR (g_overlay_region_floor) + +/* The text-image BASE (phys) = this game's main-EXE load address. The floor + * above only bounds the text from ABOVE; on its own it encodes the assumption + * that the boot EXE sits at the bottom of usable RAM, so that [KERNEL_END, + * FLOOR) is text and [FLOOR, RAM) is overlay. That holds for a load_address of + * 0x80010000 (text base == KERNEL_END, so the region below text is empty) but + * is FALSE for a boot EXE that loads HIGH and streams its gameplay code into + * the RAM BELOW itself: Klonoa loads at 0x80180000 (text 0x180000-0x18B000, + * overlays at 0x10000-0x130000), Street Fighter Alpha 3 at 0x80113B00, + * Bomberman Fantasy Race at 0x8003004C. For those the sub-text RAM was + * misclassified as main-EXE text — clear_image_baseline() wiped its dirty bits + * and the dispatch admit-heuristic refused it, so a JALR into an overlay page + * the CD DMA'd there fell through to psx_unknown_dispatch and fail-fast + * exit(1) (Klonoa, frame 687, target 0x80123D00). + * + * The overlay region is therefore BOTH sides of the text image, not just above + * it. main.cpp pins g_text_image_lo = load_address & 0x1FFFFFFF at game load; + * the default equals DIRTY_RAM_KERNEL_WINDOW_END so the below-text clause is + * empty for BIOS-only runs and for every bottom-loading game. */ +extern uint32_t g_text_image_lo; + +/* 1 iff phys is runtime-loaded overlay RAM rather than main-EXE text — either + * side of the text image. Identical to `phys >= FLOOR` whenever the game loads + * at the bottom of RAM (g_text_image_lo == KERNEL_WINDOW_END). */ +static inline int phys_is_overlay_region(uint32_t phys) { + return phys >= g_overlay_region_floor || + (phys >= DIRTY_RAM_KERNEL_WINDOW_END && phys < g_text_image_lo); +} + +/* Test whether a given physical kernel-RAM address is in a page that was + * written-to since boot. Defined in memory.c. */ +int dirty_ram_is_dirty(uint32_t phys); + +/* Kernel-image bless (memory.c). A dispatch key in the relocated kernel + * window (RAM [0x500,0x8500), the BIOS's boot-time copy of ROM 0x1FC10000+) + * may run its statically-recompiled native function IFF the live RAM bytes + * of the code reachable from it (emitter-supplied body extent) byte-match + * the ROM source. Lazily verified, cached per entry, invalidated precisely + * on writes into the body. Runtime-patched bodies (pad/SIO install stubs) + * never verify and keep interpreting — faithful either way. */ +int psx_kernel_bless_dispatchable(uint32_t phys); +/* True when a declared kernel patch range ENDS at this RAM address. The + * emitter registered that PC as a continuation key, so the interpreter hands + * straight-line flow back to static dispatch there and only the guest's + * patched words interpret (memory.c psx_bios_kernel_patch_ranges). */ +int psx_kernel_patch_range_ends_at(uint32_t phys); +void psx_kernel_bless_note_range(uint32_t phys, uint32_t len); +void psx_kernel_bless_stats(uint64_t out[8]); +void psx_kernel_bless_resync_after_restore(void); +/* Soft-return rematch / BIOS switch: drop latched SCPH↔OpenBIOS window + + * CLEAN/MISMATCH so the next kbless_on() re-reads psx_bios_image. */ +void psx_kernel_bless_reset_for_boot(void); + +/* Capture/candidate window membership. Kernel window and overlay region are + * unconditional; main-EXE text [KERNEL_WINDOW_END, FLOOR) is included only + * when the page is dirty — i.e. a gameplay overlay overwrote the boot text + * after the game-start baseline, so the bytes there are runtime overlay code + * (see the window model note above). Clean boot text never enters the window + * (it runs compiled; capturing it would violate the static-first design). */ +static inline int overlay_cache_window_contains(uint32_t phys) { + return phys < DIRTY_RAM_KERNEL_WINDOW_END + || phys >= OVERLAY_REGION_FLOOR + || dirty_ram_is_dirty(phys); +} +uint32_t dirty_ram_get_bitmap(void); +uint32_t dirty_ram_get_bitmap_word(uint32_t word_index); +uint32_t dirty_ram_get_bitmap_word_count(void); +void dirty_ram_set_bitmap_words(const uint32_t* words, uint32_t count); +/* Rematch / session_reboot: wipe host dirty tracking so dig0 matches a cold + * process (memory_init clears RAM but used to leave these bitmaps sticky). */ +void dirty_ram_reset_for_boot(void); +/* After bulk RAM restore (savestate): bump overlay page gens + lazy-miss epoch + * so native overlays re-hash against restored bytes; also drop sticky + * text_diverged/modified bitmaps (host-only — restored RAM may match ref). */ +void overlay_watch_invalidate_after_ram_restore(void); +void dirty_ram_text_guard_resync_after_restore(void); +void dirty_ram_mark_executable_range(uint32_t phys, uint32_t len); +void dirty_ram_register_text_image(uint32_t phys_lo, const uint8_t *bytes, + uint32_t len); +int dirty_ram_text_native_ok(uint32_t phys); +/* Exact CFG ranges; exec_pc clips ranges that end before the resume PC. */ +int dirty_ram_text_native_ok_ranges_from(const uint32_t *lo_len_pairs, + uint32_t count, + uint32_t exec_pc); +int dirty_ram_text_native_ok_ranges(const uint32_t *lo_len_pairs, + uint32_t count); +int dirty_ram_text_image_registered(void); +/* Bless an intentional runtime data patch (e.g. text_xlate string/glyph tables) + * into the text reference image so it is not mistaken for self-modifying code. */ +void dirty_ram_text_bless(uint32_t phys, const uint8_t *bytes, uint32_t len); +uint64_t dirty_ram_text_native_blocked(void); +uint32_t dirty_ram_text_diverged_pages(void); + +/* Counters for visibility / TCP debug. Increment in interpreter; expose + * via debug_server.c if helpful. */ +extern uint64_t g_dirty_ram_blocks_run; /* basic blocks interpreted */ +extern uint64_t g_dirty_ram_insns_run; /* instructions interpreted */ +extern uint64_t g_dirty_window_dispatches; /* interp dispatches inside a + * capture window (autocapture + * pressure signal, step 2.8) */ +extern uint64_t g_dirty_ram_aborts; /* unsupported-opcode aborts */ +extern uint64_t g_dirty_ram_guard_yields; /* long dirty loops yielded */ +extern uint64_t g_dirty_ram_unsupported_midblock; +extern uint32_t g_dirty_ram_last_unsupported_entry; +extern uint32_t g_dirty_ram_last_unsupported_entry_ra; +extern uint32_t g_dirty_ram_last_unsupported_entry_sp; +extern uint32_t g_dirty_ram_last_unsupported_insns; +extern uint32_t g_dirty_ram_last_unsupported_pc; +extern uint32_t g_dirty_ram_last_unsupported_insn; +extern const char *g_dirty_ram_last_unsupported_reason; + +/* Per-entry-PC counters. Aggregate counters above hide which install + * stubs actually fire — a single noisy spurious-dispatch site can mask + * a legitimate handler that never runs. This open-addressed table keys + * on the entry PC of each interpreted block. */ +/* 65536 -> 262144 (2026-07-03): Tomba2's Trolley attract demo interprets a + * working set past 64K distinct PCs; a full table degraded every lookup to a + * full-table scan (0.3 fps host burn in pc_table_get_or_insert_in) and + * silently truncated overlay-capture seed lists (MAX_CAPTURE_PCS aliases + * this). Probe length is bounded in pc_table_get_or_insert_in either way. */ +#define DIRTY_RAM_PC_TABLE_SIZE 262144 +typedef struct { + uint32_t pc; /* entry PC, 0 = empty slot */ + uint64_t hits; /* number of times dispatched here */ + uint64_t insns; /* total instructions executed across hits */ + uint64_t entry_hits; /* dispatches that arrived from NATIVE code (call / + * dispatch loop), not from the interpreter's own + * block-to-block chaining. `hits` conflates the two: + * below the local-flow floor every taken branch + * re-dispatches, so chain blocks dominate. entry_hits + * is the evidence stream for interior-alias seeds. */ + /* Enrichment (2026-09-05, BoF3): make a bare interpreted PC explainable + * from a session-long per_pc snapshot alone, with no offline join and no + * live-ring window. Stamped only on EXTERNAL entries (arrived from native + * dispatch, addr != chain target), which is where the value is. */ + uint32_t occ_crc; /* tier 1: psx_overlay_resident_crc_at(pc) at the last + * external entry -- the manifest CRC of the static + * variant whose code ranges span this PC (DLL path: + * last hash taken). Disambiguates a mixed band + * (0x801D0C00 carries BATTLE/ETC/SCENARIO/WORLD + * occupants) to the one actually loaded, which the + * offline enrich_pcs join cannot. 0 = nothing compiled + * spans this PC (BIOS / kernel / boot EXE). */ + uint8_t occ_ok; /* 1 = that variant validated at the time (interior + * gap inside live native code: an Axis B seed); + * 0 = it is resident but CRC-missing (data inside the + * code range rewritten, or a different section than + * the one compiled) -- the whole band runs + * interpreted and no seed will fix it. */ + uint32_t last_ext_ra;/* tier 2: gpr[31] (caller RA) at the most recent + * external entry — names the call site that reaches a + * function-pointer-table interior. This is the §9 (LOGO + * effect-handler tables) diagnosis made durable and + * session-long instead of ring-bounded; the full + * call/jalr/jr transfer split stays in the fp-log ring. */ +} DirtyRamPcEntry; +extern DirtyRamPcEntry g_dirty_ram_pc_table[DIRTY_RAM_PC_TABLE_SIZE]; +/* Every aligned main-RAM word is a possible instruction PC. Execution + * coverage only needs presence, not a hit count, so record it in a direct + * bitmap instead of probing a large hash table for every retired instruction. + * This covers every word of the host RAM backing (the old 262K-entry hash + * could saturate) -- retail 2 MiB and the opt-in 8 MiB map alike -- and is + * also the execution-verified seed source used by overlay_capture. */ +#define DIRTY_RAM_EXEC_WORD_COUNT (PSX_MAIN_RAM_BACKING_BYTES / 4u) +#define DIRTY_RAM_EXEC_BITMAP_WORDS ((DIRTY_RAM_EXEC_WORD_COUNT + 31u) / 32u) +extern uint32_t g_dirty_ram_exec_pc_bitmap[DIRTY_RAM_EXEC_BITMAP_WORDS]; +/* One bit per 4 KiB page. RAM writes use this as a one-test stale-evidence + * guard; they clear that page's capture bits rather than serializing from the + * universal store hot path. */ +#define DIRTY_RAM_EXEC_PAGE_BITMAP_WORDS \ + (((PSX_MAIN_RAM_BACKING_BYTES / 4096u) + 31u) / 32u) +extern uint32_t g_dirty_ram_exec_page_bitmap[DIRTY_RAM_EXEC_PAGE_BITMAP_WORDS]; +/* Presence-only companion for interpreted block/dispatch entries. The richer + * counter table remains for telemetry, while capture can snapshot/reset this + * compact evidence independently at overlay-generation boundaries. */ +extern uint32_t g_dirty_ram_dispatch_pc_bitmap[DIRTY_RAM_EXEC_BITMAP_WORDS]; + +/* The segment each interpreted dispatch entered through + * (docs/SEGMENT_AWARE_CODE.md §5.7). The bytes are segment-free, but a PC is + * not: a KUSEG, KSEG0 or KSEG1 entry of the same word links, traps and fetches + * in its own segment, so each needs its own compiled shard. The bitmap above + * keeps its meaning (dispatched in any segment); these siblings record which + * segments, one bit per word per segment, set at the same interpreted + * dispatch. The execution bitmap needs no segment: direct edges keep the + * entry's segment. Only the three segments that map physical memory have a + * sibling; a PC elsewhere (0x20000000-0x7FFFFFFF, KSEG2) addresses no RAM in + * Beetle and is never recorded. */ +#define PSX_CODE_SEGMENT_COUNT 3 +static inline int psx_code_segment_index(uint32_t pc) { + switch (pc & 0xE0000000u) { + case 0x00000000u: return 0; /* KUSEG */ + case 0x80000000u: return 1; /* KSEG0 */ + case 0xA0000000u: return 2; /* KSEG1 */ + default: return -1; + } +} +static inline uint32_t psx_code_segment_base(int index) { + return index == 0 ? 0x00000000u : index == 1 ? 0x80000000u : 0xA0000000u; +} +/* The names the capture JSON and the per-segment cache directories use. */ +static inline const char *psx_code_segment_name(int index) { + return index == 0 ? "kuseg" : index == 1 ? "kseg0" : "kseg1"; +} +extern uint32_t g_dirty_ram_dispatch_seg_bitmap[PSX_CODE_SEGMENT_COUNT] + [DIRTY_RAM_EXEC_BITMAP_WORDS]; + +/* Clear dispatch evidence (the any-segment bitmap and its segment siblings) + * for `nwords` bitmap words from `first_word`. Every site that drops dispatch + * evidence goes through this, so a stale segment bit can never outlive its + * any-segment bit. */ +static inline void dirty_ram_dispatch_evidence_clear(uint32_t first_word, + uint32_t nwords) { + if (first_word >= DIRTY_RAM_EXEC_BITMAP_WORDS) return; + if (nwords > DIRTY_RAM_EXEC_BITMAP_WORDS - first_word) + nwords = DIRTY_RAM_EXEC_BITMAP_WORDS - first_word; + memset(&g_dirty_ram_dispatch_pc_bitmap[first_word], 0, + (size_t)nwords * sizeof(uint32_t)); + for (int s = 0; s < PSX_CODE_SEGMENT_COUNT; s++) + memset(&g_dirty_ram_dispatch_seg_bitmap[s][first_word], 0, + (size_t)nwords * sizeof(uint32_t)); +} + +/* Block-entry ring buffer. Records every dispatch into dirty RAM with the + * caller's RA at entry, plus argument context — answers + * "who tried to JALR into this RAM stub, with what args". + * Always-on, eviction keeps memory bounded; callers query the window of + * interest (CLAUDE.md global rule on ring buffers). + * + * Limitation: this captures dispatches into RAM-resident code only. ROM + * recompiled-C → recompiled-C calls (direct C function calls in + * generated dispatch table) are NOT captured here. For BIOS shell + * investigation that's fine — shell code lives in RAM (0x800XXXXX). + * + * `ra` is cpu->gpr[31] at dispatch time. For normal JAL-style calls, + * (ra - 8) gives the caller's PC. For J/JR/tail-calls it's only a + * heuristic — treat ra as "ra_callsite_guess", not authoritative. */ +#ifdef PSX_NO_DEBUG_TOOLS +/* Keep ABI-visible one-element sentinels so crash/debug stubs still link, while + * Release does not reserve the diagnostic rings' ~227 MiB of address space. */ +#define DIRTY_RAM_BLOCK_LOG_CAP 1u +#else +#define DIRTY_RAM_BLOCK_LOG_CAP (1u << 22) /* 4M entries (~224 MiB at 56 B each). + * At ~580K dispatches/s during boot, this retains ~7s of history; at + * ~10K/s during modal idle, ~400s. Sized for retroactive press-window + * analysis without the prior 16K ring's 28-ms eviction problem. */ +#endif +typedef struct { + uint64_t seq; /* monotonic, unique per entry */ + uint32_t target; /* entry PC (RAM address) */ + uint32_t ra; /* cpu->gpr[31] at dispatch — caller's return target */ + uint32_t a0; /* cpu->gpr[4] at dispatch */ + uint32_t a1; /* cpu->gpr[5] at dispatch */ + uint32_t a2; /* cpu->gpr[6] at dispatch */ + uint32_t a3; /* cpu->gpr[7] at dispatch */ + uint32_t t0; /* cpu->gpr[8] at dispatch */ + uint32_t t1; /* cpu->gpr[9] at dispatch */ + uint32_t t2; /* cpu->gpr[10] at dispatch */ + uint32_t sp; /* cpu->gpr[29] at dispatch */ + uint32_t frame; /* s_frame_count at the time of dispatch */ +} DirtyRamBlockLogEntry; +extern DirtyRamBlockLogEntry g_dirty_ram_block_log[DIRTY_RAM_BLOCK_LOG_CAP]; +extern uint64_t g_dirty_ram_block_log_seq; + +#ifdef PSX_NO_DEBUG_TOOLS +#define DIRTY_RAM_FLOW_LOG_CAP 1u +#else +#define DIRTY_RAM_FLOW_LOG_CAP (1u << 16) +#endif +typedef struct { + uint64_t seq; + uint32_t pc; + uint32_t target; + uint32_t ra; + uint32_t a0; + uint32_t a1; + uint32_t a2; + uint32_t a3; + uint32_t sp; + uint32_t frame; +} DirtyRamFlowLogEntry; +extern DirtyRamFlowLogEntry g_dirty_ram_flow_log[DIRTY_RAM_FLOW_LOG_CAP]; +extern uint64_t g_dirty_ram_flow_log_seq; + +#ifdef PSX_NO_DEBUG_TOOLS +#define DIRTY_RAM_INSN_LOG_CAP 1u +#else +#define DIRTY_RAM_INSN_LOG_CAP (1u << 16) +#endif +typedef struct { + uint64_t seq; + uint32_t pc; + uint32_t insn; + uint32_t next_pc; + uint32_t target; + uint32_t before_s0; + uint32_t after_s0; + uint32_t sp; + uint32_t ra; + uint32_t v0; + uint32_t v1; + uint32_t a0; + uint32_t a1; + uint32_t a2; + uint32_t a3; + uint32_t t0; + uint32_t t1; + uint32_t t2; + /* Kernel scratch registers. $at is the assembler-temp that hand-written + * kernel asm uses to stash a base across a load-delay slot, and $k0/$k1 + * are the exception handlers' only free registers — i.e. exactly the state + * that matters when debugging BIOS exception/handler code, which is what + * this interpreter mostly runs. */ + uint32_t at; + uint32_t k0; + uint32_t k1; + uint32_t current_tcb; + uint32_t task_ptr; + uint32_t task_mode; + uint32_t task_submode; + uint32_t frame; + uint8_t transferred; + uint8_t pad[3]; +} DirtyRamInsnLogEntry; +extern DirtyRamInsnLogEntry g_dirty_ram_insn_log[DIRTY_RAM_INSN_LOG_CAP]; +extern uint64_t g_dirty_ram_insn_log_seq; + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_DIRTY_RAM_INTERP_H */ diff --git a/overlay_toolchain/include/disc_identity.h b/overlay_toolchain/include/disc_identity.h new file mode 100644 index 00000000..c7003eab --- /dev/null +++ b/overlay_toolchain/include/disc_identity.h @@ -0,0 +1,89 @@ +// disc_identity.h — disc-image identification + verification. +// +// Single source of truth for "is this the right disc?". Reads a .cue, raw +// .bin/.iso/.img/.car, or CHD, checks for the ISO9660 PVD, extracts the volume id and the +// PlayStation boot serial (from the actual SYSTEM.CNF directory entry, with +// an early-image scan as fallback), derives the region from the +// serial prefix, and optionally compares against an expected serial / CRC32. +// +// Also mounts the resolved path via ISOReader to capture TOC geometry +// (track count, lead-out, per-track LBAs) and a stable disc_fp fingerprint +// used by netplay peer matching — data-track CRC alone cannot catch a +// Track-01-only mount vs a full Redump multi-track cue. +// +// Used both by the runtime's launch-time disc check (runtime/src/main.cpp) +// and by the shared launcher's "Disc verified" badge, so +// the two never drift apart. + +#pragma once + +#include +#include +#include + +namespace PSXRecompV4 { + +struct DiscIdentity { + bool opened = false; // data image opened (including decoded CHD) + bool has_header = false; // ISO9660 "CD001" PVD found at a PS1 disc offset + std::string volume_id; // PVD volume identifier (trimmed), "" if none + std::string detected_serial; // serial parsed from SYSTEM.CNF BOOT line, normalized + // to the "SCUS-94236" form; "" if not found + std::string region; // "NTSC-U" | "NTSC-J" | "PAL" derived from the serial + // prefix (detected first, else expected); "" if unknown + + // Serial comparison vs the expected game id (only meaningful when one was given). + bool expected_serial_given = false; + bool serial_matches = false; // expected serial present in early disc metadata + + // Full-file CRC32 (IEEE 802.3 over the data track / image bytes). + bool crc_computed = false; + uint32_t crc = 0; + bool expected_crc_given = false; + bool crc_matches = false; + + // Mount / TOC (ISOReader on resolve_disc_path().mount). + bool from_cue = false; // mount path is a .cue + bool cue_fallback = false; // resolver fell back from a broken cue to a bin + bool upgraded_to_cue = false; // caller picked bin; mounted owning cue + bool toc_opened = false; // ISOReader::Open succeeded on mount + int track_count = 0; // >= 1 when toc_opened + uint32_t leadout_lba = 0; // iso sector count (GetTD track 0) + std::string disc_fp; // lowercase hex SHA-256 of canonical TOC + + // Netplay gate (filled when NetplayDiscExpect is applied). + bool netplay_ok = true; + std::string netplay_detail; // why netplay_ok is false + + std::string detail; // human-readable note (failure reason or extra info) +}; + +// Optional title policy from game.toml [netplay] (0 / empty = do not check). +struct NetplayDiscExpect { + bool require_cue = false; + int required_tracks = 0; // exact iso_track_count; 0 = skip + bool has_required_leadout = false; + uint32_t required_leadout_lba = 0; + std::string required_disc_fp; // exact fingerprint; empty = skip +}; + +// Identify and (optionally) verify a disc image. +// path : a .cue, raw .bin/.iso/.img/.car, or .chd image +// expected_serial : the game id, e.g. "SCUS-94236" ("" skips the serial check) +// expected_crc : full-file CRC32 to match against +// has_expected_crc : whether expected_crc is meaningful +// compute_crc : compute the full-file CRC32 (streamed; can be slow on big +// images — callers typically only request it when there is an +// expected CRC to compare against) +// netplay_expect : optional TOC / cue policy; nullptr skips netplay_ok checks +// (disc_fp / track_count are still computed when mount opens) +DiscIdentity identify_disc(const std::filesystem::path& path, + const std::string& expected_serial, + uint32_t expected_crc, bool has_expected_crc, + bool compute_crc, + const NetplayDiscExpect* netplay_expect = nullptr); + +// Apply / re-apply netplay mount policy onto an already-identified disc. +void apply_netplay_disc_expect(DiscIdentity& id, const NetplayDiscExpect& expect); + +} // namespace PSXRecompV4 diff --git a/overlay_toolchain/include/disc_path.h b/overlay_toolchain/include/disc_path.h new file mode 100644 index 00000000..6b141842 --- /dev/null +++ b/overlay_toolchain/include/disc_path.h @@ -0,0 +1,53 @@ +// disc_path.h — canonicalize whatever disc file the user actually picked. +// +// Players do not reliably know whether to hand us the .cue or the .bin, and +// both are legitimate things to find in a dump folder. Either pick must mount +// and must verify identically, so every entry point that accepts a disc path +// (game.toml [runtime] disc, --disc, the cached disc.cfg, the launcher's +// "Change Disc" picker, the first-run file dialog) routes through +// resolve_disc_path() first. +// +// The rule is "prefer the cue, but never require it": +// +// picked a .cue that resolves -> mount the cue (keeps the TOC) +// picked a .cue with a missing bin -> mount a sibling image, if one exists +// picked a raw .bin/.iso/.img/.car owned by a cue -> mount that cue +// picked a raw .bin/.iso/.img/.car with no cue -> mount it directly +// picked a .chd -> mount it directly (TOC embedded) +// +// Preferring the cue matters beyond tidiness: the cue is the only place the +// CD-DA track layout lives. Silently swapping a cue for its same-named .bin +// (which is what the runtime used to do) drops every audio track and pregap on +// a single-file multi-track dump. +// +// `data` is always the binary carrying the ISO9660 header and SYSTEM.CNF, so +// header / serial / CRC32 checks read the same bytes no matter which file the +// user picked — that is what keeps the "Disc verified" verdict stable across +// picks. + +#pragma once + +#include +#include + +namespace PSXRecompV4 { + +struct DiscPathResolution { + std::filesystem::path picked; // what the caller asked for (absolute where possible) + std::filesystem::path mount; // hand this to ISOReader::Open / cdrom_init + std::filesystem::path data; // data-track binary; read identity/CRC from this + + bool from_cue = false; // `mount` is a cue sheet + bool upgraded_to_cue = false; // caller picked a bin; we found the cue that owns it + bool cue_fallback = false; // caller picked an unusable cue; fell back to a bin + + // Human-readable note describing any substitution, "" when `mount` is just + // `picked`. Suitable for a launcher warning or a startup banner. + std::string note; +}; + +// Never fails: an unrecognizable or missing path resolves to itself, so the +// caller's existing "could not open the disc" reporting still fires. +DiscPathResolution resolve_disc_path(const std::filesystem::path& picked); + +} // namespace PSXRecompV4 diff --git a/overlay_toolchain/include/display_scanout.h b/overlay_toolchain/include/display_scanout.h new file mode 100644 index 00000000..c02968f8 --- /dev/null +++ b/overlay_toolchain/include/display_scanout.h @@ -0,0 +1,106 @@ +/* display_scanout.h — small, renderer-neutral CRTC presentation helpers. */ + +#ifndef PSXRECOMP_DISPLAY_SCANOUT_H +#define PSXRECOMP_DISPLAY_SCANOUT_H + +#include + +/* PAL active video is 288 lines per field and 576 rows when the interlaced + * display bit is set. CPU presentation buffers must preserve that full + * canvas even though PS1 VRAM itself remains 512 rows and wraps on access. */ +#define PSX_DISPLAY_PRESENT_MAX_HEIGHT 576u + +typedef struct { + uint32_t canvas_height; + uint32_t canvas_origin_y; + uint32_t source_skip_y; + uint32_t source_height; + int offset_y; + int range_set; + int valid; +} PsxDisplayVerticalLayout; + +/* Depth24 staging expands the visible source into the full active-video + * canvas. Every presentation backend must therefore consume the canvas + * height, while ordinary 15-bit display keeps its source height. */ +static inline uint32_t psx_display_present_height( + int depth24, uint32_t source_height, uint32_t canvas_height) +{ + return depth24 && canvas_height != 0u ? canvas_height : source_height; +} + +static inline uint32_t psx_display_interlaced_rows( + uint32_t rows, int interlaced) +{ + return interlaced ? rows * 2u : rows; +} + +/* Canvas-origin clipping belongs only to staged depth24 presentation. + * Ordinary 15-bit renderers read their source rectangle directly. */ +static inline uint32_t psx_display_clip_source_height( + int depth24, uint32_t source_height, uint32_t canvas_height, + uint32_t canvas_origin_y) +{ + if (!depth24) + return source_height; + if (canvas_origin_y >= canvas_height) + return 0u; + const uint32_t available = canvas_height - canvas_origin_y; + return source_height < available ? source_height : available; +} + +/* Preserve the legacy default for an unset/degenerate GP1(07h) range. A + * programmed increasing range that has no active-video intersection owns a + * zero height instead, so presentation fails closed to black. */ +static inline uint32_t psx_display_source_height( + PsxDisplayVerticalLayout layout, uint32_t fallback_height) +{ + return layout.range_set ? layout.source_height : fallback_height; +} + +/* Intersect a GP1(07h) range with the PAL or NTSC active region. The canvas + * preserves the television scanout position without discarding visible VRAM + * rows. source_skip_y owns rows before the active region; canvas_origin_y owns + * black rows before the visible source. */ +static inline PsxDisplayVerticalLayout psx_display_vertical_layout( + int pal, uint32_t raw_y1, uint32_t raw_y2) +{ + const int ymin = pal ? 20 : 16; + const int ymax = pal ? 308 : 256; + const int centre = pal ? 0xA3 : 0x88; + PsxDisplayVerticalLayout out = {0}; + int y1 = (int)raw_y1; + int y2 = (int)raw_y2; + + if (raw_y2 <= raw_y1) + return out; + out.range_set = 1; + out.canvas_height = (uint32_t)(ymax - ymin); + if (y1 < ymin) y1 = ymin; + if (y1 > ymax) y1 = ymax; + if (y2 < ymin) y2 = ymin; + if (y2 > ymax) y2 = ymax; + if (y2 <= y1) + return out; + + out.canvas_origin_y = (uint32_t)(y1 - ymin); + out.source_skip_y = raw_y1 < (uint32_t)ymin + ? (uint32_t)ymin - raw_y1 : 0u; + out.source_height = (uint32_t)(y2 - y1); + out.offset_y = ((y1 + y2) - (centre * 2)) / 2; + out.valid = 1; + return out; +} + +/* Return the vertical position of a GP1(07h) display range relative to the + * broadcast centre. Positive values move the scanout down. The limits and + * centres are the PS1 PAL/NTSC active regions documented by psx-spx. */ +static inline int psx_display_vertical_offset(int pal, uint32_t raw_y1, + uint32_t raw_y2) +{ + PsxDisplayVerticalLayout layout = psx_display_vertical_layout( + pal, raw_y1, raw_y2); + return layout.valid ? layout.offset_y : 0; +} + +#endif diff --git a/overlay_toolchain/include/dma.h b/overlay_toolchain/include/dma.h new file mode 100644 index 00000000..d6565acf --- /dev/null +++ b/overlay_toolchain/include/dma.h @@ -0,0 +1,167 @@ +/* dma.h — PS1 DMA controller simulation (Phase 3). + * + * 7 DMA channels: + * Ch0: MDEC in 0x1F801080 + * Ch1: MDEC out 0x1F801090 + * Ch2: GPU 0x1F8010A0 + * Ch3: CDROM 0x1F8010B0 + * Ch4: SPU 0x1F8010C0 + * Ch5: PIO 0x1F8010D0 + * Ch6: OTC 0x1F8010E0 + * + * Global: + * DPCR: 0x1F8010F0 (DMA control — enable bits per channel) + * DICR: 0x1F8010F4 (DMA interrupt control) + */ + +#ifndef PSXRECOMP_DMA_H +#define PSXRECOMP_DMA_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void dma_init(void); +uint32_t dma_read(uint32_t addr); +void dma_write(uint32_t addr, uint32_t val); +void dma_write_masked(uint32_t addr, uint32_t val, uint32_t mask); +void dma_advance(uint32_t cycles); +/* Cycle-budgeted precise event slicing: guest CPU cycles until a DELIVERABLE + * DMA IRQ (bit3 unmasked in i_mask). UINT32_MAX if none. */ +uint32_t dma_cycles_to_irq(uint32_t i_mask); +/* Mask-blind scheduler boundary: next DMA word movement or delayed completion, + * not merely the final IRQ. RAM-producing DMA must become visible at its + * per-word due cycle even when guest code polls ordinary RAM instead of DICR. */ +uint32_t dma_cycles_to_internal_event(void); +/* Strict deliverability form for wait-loop elision: unlike the conservative + * scheduler bound, ignores channel completions whose DICR IRQ is disabled. */ +uint32_t dma_cycles_to_deliverable_irq(uint32_t i_mask); +uint32_t dma_get_dicr(void); +uint32_t dma_get_dpcr(void); +int dma_cdrom_transfer_active(void); +int dma_gpu_linked_list_active(void); + +typedef struct DMAChannelDebugState { + uint32_t madr; + uint32_t bcr; + uint32_t chcr; + uint32_t active; + uint32_t remaining_words; + uint32_t cycles_accum; +} DMAChannelDebugState; + +typedef struct DMADebugState { + uint32_t dpcr; + uint32_t dicr; + DMAChannelDebugState channels[7]; +} DMADebugState; + +typedef struct DMATraceEntry { + uint64_t seq; + uint32_t frame; + uint32_t kind; + uint32_t channel; + uint32_t total_words; + uint32_t addr; + uint32_t val; + uint32_t mask; + uint32_t madr; + uint32_t bcr; + uint32_t chcr; + uint32_t dpcr; + uint32_t dicr_before; + uint32_t dicr_after; + uint32_t i_stat_before; + uint32_t i_stat_after; + uint32_t func; + uint32_t pc; +} DMATraceEntry; + +#define DMA_TRACE_CAP (1 << 14) +#define DMA_CDROM_HISTORY_CAP (1 << 13) +#define DMA_CDROM_HISTORY_WORDS 16 + +typedef struct DMACDROMHistoryEntry { + uint64_t seq; + uint32_t frame_start; + uint32_t frame_end; + uint32_t start_addr; + uint32_t final_addr; + uint32_t requested_words; + uint32_t moved_words; + uint32_t bcr; + uint32_t chcr; + uint32_t dpcr; + uint32_t dicr_start; + uint32_t dicr_end; + uint32_t i_stat_start; + uint32_t i_stat_end; + uint32_t func; + uint32_t pc; + int lba; + int sector_size; + int sector_read_pos_start; + int sector_read_pos_end; + uint8_t mode; + uint8_t sector_available_start; + uint8_t sector_available_end; + uint8_t completed; + uint8_t first_count; + uint8_t last_count; + uint32_t first_words[DMA_CDROM_HISTORY_WORDS]; + uint32_t last_words[DMA_CDROM_HISTORY_WORDS]; +} DMACDROMHistoryEntry; + +/* GPU (CH2) linked-list / ordering-table walk observability. + * + * These counters make DMA2 geometry loss countable without screenshots: + * - starts_dropped: the guest asked for a new OT transfer while the previous + * walk was still running. start_async_gpu_linked_list() returns early in + * that case, so a whole ordering table is never sent to GP0. + * - chcr_reads_in_walk: guest polls of CHCR(2) while the linked-list walk is + * still active, useful for distinguishing timeout loops from blind aborts. + */ +typedef struct { + uint32_t pc; /* guest PC of the CHCR store that aborted the walk */ + uint32_t chcr; /* CHCR value after that store */ + uint32_t nodes; /* ordering-table nodes walked before the abort */ + uint32_t words; /* DMA words read before the abort, including headers */ + uint32_t cycles; /* guest cycles the walk had been running */ + uint32_t polls; /* guest reads of CHCR(2) during this walk */ +} DMAGpuOtCancel; + +#define DMA_GPU_OT_CANCEL_RING 8 + +typedef struct { + uint64_t starts; + uint64_t starts_dropped; + uint64_t completes; + uint64_t cancels; + uint32_t nodes_last; + uint32_t nodes_max; + uint32_t words_last; + uint32_t words_max; + uint64_t cycles_last; + uint64_t cycles_max; + uint8_t active; + uint64_t chcr_reads_total; + uint64_t chcr_reads_in_walk; + uint32_t initiator_pc; + uint32_t cancel_ring_count; + DMAGpuOtCancel cancel_ring[DMA_GPU_OT_CANCEL_RING]; +} DMAGpuOtStats; + +uint64_t dma_debug_get_trace(const DMATraceEntry** out_entries); +void dma_debug_clear_trace(void); +void dma_debug_get_state(DMADebugState* out); +void dma_debug_get_gpu_ot_stats(DMAGpuOtStats* out); +uint64_t dma_debug_get_cdrom_history(const DMACDROMHistoryEntry** out_entries); +void dma_debug_clear_cdrom_history(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_DMA_H */ diff --git a/overlay_toolchain/include/dma_gpu_ll.h b/overlay_toolchain/include/dma_gpu_ll.h new file mode 100644 index 00000000..7454a90e --- /dev/null +++ b/overlay_toolchain/include/dma_gpu_ll.h @@ -0,0 +1,54 @@ +#ifndef PSXRECOMP_DMA_GPU_LL_H +#define PSXRECOMP_DMA_GPU_LL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + DMA_GPU_LL_PHASE_IDLE = 0, + DMA_GPU_LL_PHASE_HEADER = 1, + DMA_GPU_LL_PHASE_SETUP = 2, + DMA_GPU_LL_PHASE_PAYLOAD = 3 +}; + +typedef struct { + uint8_t active; + uint8_t phase; + uint8_t emit_node; + uint8_t hit_limit; + uint32_t start_addr; + uint32_t current_addr; + uint32_t next_addr; + uint32_t word_count; + uint32_t payload_index; + uint32_t cycles_remaining; + uint32_t nodes_processed; + uint32_t max_nodes; + uint32_t total_words; + uint32_t empty_rank; +} DMAGPULinkedList; + +typedef struct { + uint32_t (*resolve_address)(void *opaque, uint32_t address); + uint32_t (*read_word)(void *opaque, uint32_t address); + void (*observe_header)(void *opaque, uint32_t address, uint32_t header); + int (*begin_node)(void *opaque, uint32_t address, uint32_t word_count); + void (*emit_word)(void *opaque, uint32_t address, uint32_t word); + void (*complete)(void *opaque, int hit_limit); +} DMAGPULinkedListOps; + +void dma_gpu_ll_start(DMAGPULinkedList *state, uint32_t start_addr, + uint32_t max_nodes); +void dma_gpu_ll_cancel(DMAGPULinkedList *state); +uint32_t dma_gpu_ll_cycles_to_event(const DMAGPULinkedList *state); +void dma_gpu_ll_advance(DMAGPULinkedList *state, uint32_t cycles, + const DMAGPULinkedListOps *ops, void *opaque); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/draw_distance.h b/overlay_toolchain/include/draw_distance.h new file mode 100644 index 00000000..6c2517c5 --- /dev/null +++ b/overlay_toolchain/include/draw_distance.h @@ -0,0 +1,71 @@ +/* draw_distance.h - opt-in draw-distance clamps ([[draw_distance.clamp]]). + * + * Many PS1 renderers drop a primitive whose depth falls past the end of their + * ordering table: `sltiu t, z, N; beqz t, reject`. The limit protects the OT, + * so simply raising it can write past the table. A title lists such + * predicates in game.toml together with the register that carries the depth + * index and the last safe value: + * + * [[draw_distance.clamp]] + * address = "0x80061230" + * expected = "0x2C4A01C0" # sltiu t2, v0, 0x1C0 + * reg = 2 # v0 + * max = 0x1BF + * + * While a trusted mod has switched the clamps on, the listed register is + * clamped to `max` (signed) immediately before the listed instruction runs, + * so a far primitive is kept in the farthest OT slot instead of being + * dropped. Off (the default, reset at every session start) the sites run the + * original code. Main executable only: generated main-EXE code applies the + * clamp, captured overlay code at the same address keeps its own code, and + * the dirty-RAM interpreter applies it where the game's text image still + * holds the listed instruction. + * + * docs/config_schema.md "Draw-distance clamps" has the config rules. + */ +#ifndef PSX_DRAW_DISTANCE_H +#define PSX_DRAW_DISTANCE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct PSXDrawDistanceClampSite { + uint32_t address; /* any segment; stored physical */ + uint32_t expected; /* the complete instruction word at address */ + uint32_t reg; /* 1..31: a source register of `expected` */ + int32_t max; /* signed upper bound */ +} PSXDrawDistanceClampSite; + +#define PSX_DRAW_DISTANCE_CLAMP_SITES_MAX 256 + +/* Nonzero while the clamps are on. Generated main-EXE code reads it at every + * configured site. */ +extern uint32_t g_psx_draw_distance_clamp; +/* On and at least one site configured: the interpreter's per-instruction + * gate. */ +extern int g_psx_draw_distance_clamp_live; + +/* The title's sites (game config). Copied, sorted, capped at + * PSX_DRAW_DISTANCE_CLAMP_SITES_MAX (a longer list is logged). Returns the + * number kept. */ +int psx_draw_distance_set_clamp_sites(const PSXDrawDistanceClampSite *sites, + int count); +int psx_draw_distance_clamp_site_count(void); +/* The site at `pc` whose instruction is `insn`, or NULL. */ +const PSXDrawDistanceClampSite *psx_draw_distance_clamp_find(uint32_t pc, + uint32_t insn); + +/* The value the clamp leaves in the register. */ +static inline uint32_t psx_draw_distance_clamp_value(uint32_t value, + int32_t max) { + return (int32_t)value > max ? (uint32_t)max : value; +} + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_DRAW_DISTANCE_H */ diff --git a/overlay_toolchain/include/event_ring.h b/overlay_toolchain/include/event_ring.h new file mode 100644 index 00000000..a4e83f6c --- /dev/null +++ b/overlay_toolchain/include/event_ring.h @@ -0,0 +1,129 @@ +/* + * event_ring.h — Always-on unified event-timeline ring. + * + * Purpose: capture the interleaved timeline of interrupt-delivery decisions, + * I_STAT transitions, and DMA kick/complete events, each tagged with the + * current guest cycle, PC, enclosing recompiled function, current execution + * mode (native-overlay / dirty-RAM-interp / static), and the in-progress + * native overlay function. The goal is to diff two runs of the SAME route + * (native-overlay OFF vs ON) and find the FIRST interrupt/DMA ordering + * divergence relative to game code (docs/internal/PRINCIPLES.md #3, handoff Priority 2). + * + * Design: ALWAYS-ON (Release too), eviction-bounded ring. Records EDGES / + * EVENTS, never per-poll samples — native code calls psx_check_interrupts at + * every block, so polling would evict the window instantly. The interrupt + * decision path emits an event only when the decision OUTCOME changes + * (idle -> gated(reason) -> delivered), and raises/DMA are emitted at their + * source sites. Dump-on-demand; the ring survives a blue screen because the + * debug-server thread stays alive and queries it. + * + * This is OBSERVABILITY, not a fix. It does not alter timing. + */ +#ifndef PSXRECOMP_EVENT_RING_H +#define PSXRECOMP_EVENT_RING_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ALWAYS-ON in every build, production included. The ring records EDGES + * (IRQ decisions, I_STAT raises, DMA/CD/timer schedule+fire), not per-poll + * samples, so the hot-path cost is a handful of stores per device event. + * The TCP debug server is compiled into every build too (production runs + * opt the listener in via PSX_DEBUG_SERVER=1), so the ring is readable on + * the exact production binary that exhibits a bug — the Tomba 2 lost + * CD-completion race was only attributable because of this. */ +#ifndef EVENT_RING_ENABLED +#define EVENT_RING_ENABLED 1 +#endif + +/* 64K entries * 48 bytes ~= 3 MB. Covers many frames of transition activity. */ +#define EVENT_RING_CAP (1u << 16) + +typedef enum { + EV_NONE = 0, + EV_IRQ_DELIVER = 1, /* interrupt actually delivered (in_exception <- 1) */ + EV_IRQ_GATE = 2, /* pending & masked-in but blocked; detail = gate code */ + EV_ISTAT_RAISE = 3, /* known raise site fired; detail = IRQ bit */ + EV_ISTAT_CHANGE= 4, /* generic backstop: i_stat changed since last check */ + EV_DMA_KICK = 5, /* DMA transfer start; detail = channel, aux = chcr */ + EV_DMA_DONE = 6, /* DMA transfer complete; detail = channel, aux = chcr */ + EV_MODE = 7, /* execution-mode transition; mode = new mode */ + EV_DMA_SCHED = 8, /* delayed (async) completion scheduled; detail=chan, aux=chcr */ + EV_ENQ = 9, /* event SCHEDULED/queued; detail = EventSource, aux = due_cycle (or payload) */ + EV_DEQ = 10, /* event FIRED/consumed; detail = EventSource, aux = payload (type/scheduled-due) */ +} EventKind; + +/* Source id for EV_ENQ / EV_DEQ (the `detail` field). Lets us independently + * track when each event is scheduled vs when it fires — a MISSING enqueue (an + * event scheduled in the working run but never in the broken run) is the prime + * suspect for "content never loads", and is invisible if you only watch fires. */ +typedef enum { + SRC_NONE = 0, + SRC_DMA0 = 1, /* SRC_DMA0+ch for DMA channels 0..6 (1..7) */ + SRC_VBLANK = 16, /* enqueue=next VBlank scheduled, aux=due_cycle */ + SRC_CD_CMD = 17, /* enqueue=CD command issued, aux=cmd byte */ + SRC_CD_READ = 18, /* enqueue=sector read scheduled, aux=read_delay cycles */ + SRC_CD_IRQ = 19, /* dequeue=CD response/data IRQ fired, aux=cd irq type */ + SRC_CD_PEND = 20, /* enqueue=delayed CD command scheduled, aux=delay cycles */ + SRC_TIMER0 = 24, /* SRC_TIMER0+n for timers 0..2 (enqueue=armed, dequeue=fired) */ + SRC_SIO = 28, /* enqueue=shift/ack countdown armed, dequeue=SIO IRQ fired */ +} EventSource; + +/* detail codes for EV_IRQ_GATE (why a pending+masked IRQ was NOT delivered) */ +typedef enum { + GATE_NONE = 0, + GATE_IN_EXCEPTION = 1, /* already inside an exception */ + GATE_COOLDOWN = 2, /* post-exception cooldown block */ + GATE_SR_IE = 3, /* COP0 SR IEc clear (interrupts globally off) */ + GATE_SR_IM2 = 4, /* COP0 SR IM2 clear (HW int line masked) */ + GATE_CALL_DEPTH = 5, /* ape-fw: inside nested generated call, not a safe point */ + GATE_BAD_RESUME = 6, /* ape-fw: no valid guest resume PC at this check */ +} EventGateReason; + +typedef enum { + MODE_UNKNOWN = 0, + MODE_STATIC = 1, /* statically-recompiled ROM/EXE code */ + MODE_NATIVE_OVERLAY= 2, /* native overlay DLL function */ + MODE_INTERP = 3, /* dirty-RAM interpreter */ +} EventExecMode; + +typedef struct { + uint64_t seq; /* monotonic sequence */ + uint64_t cycle; /* psx_get_cycle_count() at event */ + uint32_t pc; /* g_debug_last_store_pc (best "where" signal) */ + uint32_t func; /* g_debug_current_func_addr */ + uint32_t overlay_fn; /* in-progress native overlay fn (0 if none) */ + uint32_t i_stat; + uint32_t i_mask; + uint32_t aux; /* per-kind payload: DMA events -> chcr value; else 0 */ + uint16_t kind; /* EventKind */ + uint8_t mode; /* EventExecMode at event time */ + uint8_t detail; /* channel / gate reason / IRQ bit, per kind */ +} EventEntry; + +/* Record one event. Captures cycle/pc/func/overlay_fn/i_stat/i_mask/mode from + * runtime globals internally, so call sites are a single line. No-op when the + * ring is disabled. Safe to call from any runtime path. */ +void event_ring_record(uint16_t kind, uint8_t detail); +/* As above, plus a per-kind aux payload (DMA events pass the CHCR value). */ +void event_ring_record_aux(uint16_t kind, uint8_t detail, uint32_t aux); + +/* Write the whole live window (oldest->newest) as a JSON array to `path`. + * Returns entries written, or -1 on open failure. No TCP size limit. */ +int event_ring_dump_file(const char *path); + +/* Emit a bounded JSON tail (most-recent `max_entries`, oldest->newest) into + * `out`. Returns bytes written. For quick TCP inspection. */ +int event_ring_dump_json(char *out, int cap, int max_entries); + +/* Clear the ring (e.g. to isolate a fresh window before a run). */ +void event_ring_clear(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_EVENT_RING_H */ diff --git a/overlay_toolchain/include/fntrace.h b/overlay_toolchain/include/fntrace.h new file mode 100644 index 00000000..2519d6f6 --- /dev/null +++ b/overlay_toolchain/include/fntrace.h @@ -0,0 +1,123 @@ +/* fntrace.h — always-on call ring for recomp psx_dispatch. + * + * Records every entry into psx_dispatch with the caller's argument + * registers and return address. Mirrors beetle_libretro.cpp's fntrace + * ring (same wire commands: fntrace_arm / fntrace_dump / fntrace_clear) + * so cross-process tools that already speak Beetle's protocol work + * unchanged against psx-runtime. + * + * Why "always-on" rather than arm-then-record: see CLAUDE.md global + * rule "Never time/attach for observability". The ring captures every + * dispatch from boot; arming only narrows what the dump command + * reports, never what is recorded. To investigate a window of + * interest, fntrace_dump it after the fact. + * + * Coverage: every psx_dispatch entry — both static-recompiled targets + * (ROM functions, shell-relocated functions) and dirty-RAM dispatches. + * dirty_ram_block_log overlaps with the dirty-RAM subset; this ring is + * the superset. + */ +#ifndef PSXRECOMP_FNTRACE_H +#define PSXRECOMP_FNTRACE_H + +#include +#include "cpu_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* 4M entries × 32 bytes = 128 MB RAM. At ~580K dispatches/s peak (boot) + * that's ~7s; at ~10K/s during modal idle, ~400s. Sized for press- + * window retrospectives without per-second eviction. + * Definition uses PSX_BSS so the zeros stay out of the PE image (MinGW+LTO + * otherwise stuffed this into .rdata and bloated Windows .exe by ~144MiB). */ +#define FNTRACE_RING_CAP (1u << 22) + +typedef struct { + uint32_t frame; /* s_frame_count at dispatch */ + uint32_t target; /* psx_dispatch addr argument (virtual) */ + uint32_t ra; /* cpu->gpr[31] at dispatch — caller's return PC */ + uint32_t a0; /* cpu->gpr[4] */ + uint32_t a1; /* cpu->gpr[5] */ + uint32_t a2; /* cpu->gpr[6] */ + uint32_t a3; /* cpu->gpr[7] */ + uint32_t s3; /* cpu->gpr[19] — callee-saved, useful for arg-passing chains */ + uint32_t sp; /* cpu->gpr[29] — for func_8001A954 SP/RA-lifecycle oracle */ +} FntraceEntry; + +extern FntraceEntry g_fntrace_ring[FNTRACE_RING_CAP]; +extern uint64_t g_fntrace_seq; /* monotonic; index into ring = seq % CAP */ + +/* ── Stack-domain transition ring (ALWAYS-ON, every build) ────────────────── + * One entry per dispatch whose guest SP crossed a 64 KB domain since the + * previous dispatch. Quiet in normal execution; fires at genuine stack + * switches (green-thread/coroutine restores, longjmp, kernel ChangeThread, + * crt0 stack init) — the provenance record for "who installed this SP". + * Dumped via the `sp_ring` TCP command. */ +#define SPDOM_RING_CAP 512u +typedef struct { + uint64_t seq; + uint64_t cycle; /* guest cycle at the recording dispatch */ + uint32_t prev_sp; /* sp domain execution came FROM */ + uint32_t new_sp; /* sp observed at this dispatch */ + uint32_t target; /* dispatch target (the code running on the new stack) */ + uint32_t ra; /* caller's return PC at the dispatch */ + uint32_t tcb; /* kernel current-TCB (PCB[0]) at the dispatch */ + uint32_t frame; /* s_frame_count */ +} SpDomainEntry; +extern SpDomainEntry g_spdom_ring[SPDOM_RING_CAP]; +extern uint64_t g_spdom_seq; + +/* Always-on dispatch tail ring: last N dispatches (target/ra/sp/cycle), + * recorded unconditionally so the final control-flow sequence before a death + * is always reconstructable. Dumped via `disp_ring`. */ +#define DISP_TAIL_CAP 128u +typedef struct { + uint64_t cycle; + uint32_t target; + uint32_t ra; + uint32_t sp; + uint32_t pad; +} DispTailEntry; +extern DispTailEntry g_disp_tail[DISP_TAIL_CAP]; +extern uint64_t g_disp_tail_seq; + +/* Hot path. Called from psx_dispatch on every entry. Inlinable. */ +void fntrace_record(CPUState* cpu, uint32_t target); +/* Register the game's text range for one-shot game-start detection. + * First dispatch into [lo, hi) calls cdrom_notify_game_started(). */ +void fntrace_set_game_range(uint32_t lo, uint32_t hi); +int fntrace_is_game_started(void); +/* Snapshot restore only: the handoff side effects are already in the saved + * machine. Do not clear restored RAM or capture another boot snapshot. */ +void fntrace_restore_game_started(int started); +/* One-shot game-start handoff. Idempotent — safe to call from any path + * (compiled dispatch, dirty-RAM interpreter, generated entry function). + * Performs dirty-image baseline clear, low-boot scratch clear, CD speed + * switch, and boot-state capture. */ +void fntrace_mark_game_started(CPUState* cpu); +/* Entry-pc-exact latch for the interpreter path: calls + * fntrace_mark_game_started() only when addr matches the armed game entry + * (fntrace_set_game_range lo). No-op before the range is armed and after + * the latch fires. */ +void fntrace_maybe_mark_game_started(CPUState* cpu, uint32_t addr); + +/* Arm a target filter. arm_count == 0 means "record all" (default). + * When arm_count > 0, only dispatches whose target matches one of the + * armed entries are recorded. Use for noise reduction on a hot ring. */ +#define FNTRACE_ARM_MAX 32 +void fntrace_arm(uint32_t target); /* add to arm list, or 0 to clear */ +void fntrace_arm_clear(void); +uint32_t fntrace_arm_count(void); +uint32_t fntrace_arm_get(uint32_t i); +void fntrace_arm_from_env(const char *env_name); + +/* Reset ring (clears seq, leaves storage in place). */ +void fntrace_clear(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_FNTRACE_H */ diff --git a/overlay_toolchain/include/frame_fingerprint.h b/overlay_toolchain/include/frame_fingerprint.h new file mode 100644 index 00000000..8c80ac50 --- /dev/null +++ b/overlay_toolchain/include/frame_fingerprint.h @@ -0,0 +1,113 @@ +#ifndef FRAME_FINGERPRINT_H +#define FRAME_FINGERPRINT_H + +/* Per-frame guest-write fingerprint accumulator behind the debug server's + * `frame_fingerprint` command (debug_server.c snapshots it once per frame). + * Header-only so the hash semantics are unit-tested without the server + * (runtime/tests/test_frame_fingerprint.c). + * + * Two kinds of column, because an A/B run needs both: + * + * JUDGE columns say whether two runs did the same guest-visible things: + * wcount + wsum main RAM: count and ORDER-INDEPENDENT sum of (phys,val) + * sp_*, mmio_* scratchpad / device registers: CPU-only traffic, so the + * ordered hash is program order (includes the store PC) + * quiet_count writes FMV-quiet kept out of every column + * + * LOCATOR columns help find WHERE two runs parted, but can differ while + * guest state is identical: + * wr_hash, pc_hash ORDERED rolling hashes over main RAM. DMA/device + * writes (MDEC-out, CD, SPU, GPU->RAM) land in host + * device-service order, which depends on how often a + * backend flushes cycles, so the same multiset of writes + * can arrive interleaved differently with CPU stores. + * A device write also carries the last CPU store PC. + */ + +#include + +#define PSX_FP_FNV_SEED 1469598103934665603ULL +#define PSX_FP_FNV_PRIME 1099511628211ULL + +#define PSX_FP_SCRATCH_LO 0x1F800000u +#define PSX_FP_SCRATCH_HI 0x1F8003FFu + +typedef struct PsxFrameFingerprint { + uint64_t wr_hash; /* locator: ordered (phys,val), main RAM */ + uint64_t pc_hash; /* locator: ordered store PC, main RAM */ + uint64_t wcount; /* judge: main-RAM write count */ + uint64_t wsum; /* judge: order-independent sum over main RAM */ + uint64_t mmio_hash; /* judge: ordered (addr,val,pc), device registers */ + uint64_t mmio_count; + uint64_t sp_hash; /* judge: ordered (phys,val,pc), scratchpad */ + uint64_t sp_count; + uint64_t quiet_count; /* judge: fingerprint-eligible writes FMV-quiet skipped */ +} PsxFrameFingerprint; + +#define PSX_FRAME_FINGERPRINT_INIT \ + { PSX_FP_FNV_SEED, PSX_FP_FNV_SEED, 0, 0, PSX_FP_FNV_SEED, 0, \ + PSX_FP_FNV_SEED, 0, 0 } + +/* One write's contribution to wsum: the splitmix64 finalizer of (phys,val). + * It is a bijection on the 64-bit key, so distinct (phys,val) pairs never + * share a term, and a value moved between two addresses changes the sum. + * Summing (mod 2^64) makes the column blind to order only. */ +static inline uint64_t psx_fp_write_term(uint32_t phys, uint32_t val) +{ + uint64_t z = (((uint64_t)phys << 32) | val) + 0x9E3779B97F4A7C15ULL; + z = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9ULL; + z = (z ^ (z >> 27)) * 0x94D049BB133111EBULL; + return z ^ (z >> 31); +} + +/* Main RAM (phys < ram_live_bytes) and scratchpad feed the fingerprint; + * anything else a RAM write path reports is ignored. */ +static inline int psx_fp_write_eligible(uint32_t phys, uint32_t ram_live_bytes) +{ + return phys < ram_live_bytes || + (phys >= PSX_FP_SCRATCH_LO && phys <= PSX_FP_SCRATCH_HI); +} + +static inline void psx_fp_record_write(PsxFrameFingerprint *fp, uint32_t phys, + uint32_t val, uint32_t pc, + uint32_t ram_live_bytes) +{ + if (phys >= PSX_FP_SCRATCH_LO && phys <= PSX_FP_SCRATCH_HI) { + uint64_t s = fp->sp_hash; + s = (s ^ (uint64_t)phys) * PSX_FP_FNV_PRIME; + s = (s ^ (uint64_t)val) * PSX_FP_FNV_PRIME; + s = (s ^ (uint64_t)pc) * PSX_FP_FNV_PRIME; + fp->sp_hash = s; + fp->sp_count++; + return; + } + if (phys >= ram_live_bytes) return; + uint64_t h = fp->wr_hash; + h = (h ^ (uint64_t)phys) * PSX_FP_FNV_PRIME; + h = (h ^ (uint64_t)val) * PSX_FP_FNV_PRIME; + fp->wr_hash = h; + fp->pc_hash = (fp->pc_hash ^ (uint64_t)pc) * PSX_FP_FNV_PRIME; + fp->wcount++; + fp->wsum += psx_fp_write_term(phys, val); +} + +static inline void psx_fp_record_mmio(PsxFrameFingerprint *fp, uint32_t addr, + uint32_t val, uint32_t pc) +{ + uint64_t h = fp->mmio_hash; + h = (h ^ (uint64_t)addr) * PSX_FP_FNV_PRIME; + h = (h ^ (uint64_t)val) * PSX_FP_FNV_PRIME; + h = (h ^ (uint64_t)pc) * PSX_FP_FNV_PRIME; + fp->mmio_hash = h; + fp->mmio_count++; +} + +/* A write FMV-quiet kept out of the fingerprint. Counting it makes the + * suppression visible: two runs whose quiet_count differs dropped different + * writes, so their cumulative columns stop being comparable from there on. */ +static inline void psx_fp_note_quiet(PsxFrameFingerprint *fp) +{ + fp->quiet_count++; +} + +#endif /* FRAME_FINGERPRINT_H */ diff --git a/overlay_toolchain/include/frame_interpolation.h b/overlay_toolchain/include/frame_interpolation.h new file mode 100644 index 00000000..4e80efc5 --- /dev/null +++ b/overlay_toolchain/include/frame_interpolation.h @@ -0,0 +1,93 @@ +#ifndef PSX_FRAME_INTERPOLATION_H +#define PSX_FRAME_INTERPOLATION_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct FrameInterpolationSchedule { + double source_deadline; + double next_present_deadline; + double frame_start; + double frame_end; + double target_period; + /* Blend-phase window of this source interval (begin_phase). begin() + * plans the whole 0..1 window, which is the historical behaviour. */ + double phase_lo; + double phase_hi; +} FrameInterpolationSchedule; + +/* Plan one stock guest-frame interval. Presentation deadlines remain anchored + * across calls so guest work consumes part of the interval instead of slowing + * the simulation. Returns zero when the rates or host clock are invalid. */ +int frame_interpolation_schedule_begin(FrameInterpolationSchedule *schedule, + uint64_t now, uint64_t frequency, + double source_hz, double target_hz); + +/* Return each presentation deadline in the current source interval. Alpha is + * the temporal blend position from the previous completed frame to the current + * one. Deadlines missed by more than one output period are coalesced. */ +int frame_interpolation_schedule_next(FrameInterpolationSchedule *schedule, + uint64_t now, uint64_t *deadline, + float *alpha); + +/* Same as begin(), but the returned blend alphas cover only [phase_lo, + * phase_hi] of the frame-to-frame transition (both clamped to 0..1). A game + * that flips every P VBlanks presents VBlank k (0-based since the flip) with + * the window [k/P, (k+1)/P], so one crossfade spans the whole game frame + * instead of finishing after the first VBlank and holding for the rest. + * begin() is begin_phase(0, 1). */ +int frame_interpolation_schedule_begin_phase(FrameInterpolationSchedule *schedule, + uint64_t now, uint64_t frequency, + double source_hz, double target_hz, + double phase_lo, double phase_hi); + +/* Render passes present between guest VBlanks. The next output deadline, if + * it is already due (<= now) and not later than `horizon` (host ticks), with + * stale deadlines coalesced to the newest one as begin() does. It is not + * consumed: call frame_interpolation_schedule_consume() once it is shown, so + * the next source interval simply continues after it. */ +int frame_interpolation_schedule_due(FrameInterpolationSchedule *schedule, + uint64_t now, double horizon, + uint64_t *deadline); +void frame_interpolation_schedule_consume(FrameInterpolationSchedule *schedule); + +uint64_t frame_interpolation_schedule_end( + const FrameInterpolationSchedule *schedule); +void frame_interpolation_schedule_reset(FrameInterpolationSchedule *schedule); + +/* Flip-aware blend source (psx_mod_set_frame_interpolation_source FLIP). + * Pure bookkeeping, one call per presented guest VBlank: new_frame says the + * displayed image changed (display origin moved, or the displayed rect was + * redrawn). Tracks P, the last observed flip period in VBlanks (clamped + * 1..FRAME_FLIP_PERIOD_MAX; 1 until two new frames were seen), and k, the + * VBlanks since the last new frame, and yields this VBlank's blend window + * [k/P, (k+1)/P] clamped to 0..1. A frame that arrives late holds at 1; one + * that arrives early restarts at 0 from the frame that was fully shown. */ +#define FRAME_FLIP_PERIOD_MAX 4u +typedef struct FrameFlipTracker { + uint32_t since_flip; /* VBlanks since the last new frame, before this one */ + uint32_t period; /* P */ + uint32_t frames; /* new frames seen (saturating) */ +} FrameFlipTracker; + +void frame_flip_tracker_reset(FrameFlipTracker *tracker); +/* Whether a presented VBlank shows a new guest frame (the tracker's + * new_frame): the presented geometry changed, no frame is held yet, the + * displayed rect was redrawn since the last present, or the display origin + * moved from (last_x, last_y) to (origin_x, origin_y), i.e. a flip. Anything + * else re-presents the image already held and is a duplicate. */ +int frame_flip_is_new_frame(int geometry_changed, int history_empty, + int redrawn, int origin_x, int origin_y, + int last_x, int last_y); +/* Returns k for this VBlank. */ +uint32_t frame_flip_tracker_vblank(FrameFlipTracker *tracker, int new_frame, + double *phase_lo, double *phase_hi); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/frame_pacing.h b/overlay_toolchain/include/frame_pacing.h new file mode 100644 index 00000000..44eb4313 --- /dev/null +++ b/overlay_toolchain/include/frame_pacing.h @@ -0,0 +1,62 @@ +/* + * frame_pacing.h — race-free wall-clock frame pacing. + * + * Replaces the open-coded pacing loops in main.cpp (sdl_vblank_present) + * and beetle_main.cpp. The open-coded version read the performance + * counter twice per iteration (once in the while-condition, once to + * compute the remaining time); if the deadline was crossed between the + * two reads — a preemption-sized window — the unsigned subtraction + * underflowed and SDL_Delay received a ~24.7-day argument (2^64 ticks + * * 1000 / 10 MHz, truncated to Uint32). That was the Bug B hard + * freeze: the app parks in one SDL_Delay with every counter frozen, + * wedged between `i_stat |= VBLANK` and exception delivery. + * + * Rules the implementation must keep: + * - exactly ONE counter read per decision; compare before subtract + * - the computed sleep is clamped to one frame period + * - a deadline already in the past never sleeps + */ +#ifndef FRAME_PACING_H +#define FRAME_PACING_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct FramePacer { + uint64_t next_deadline; /* perf-counter ticks; 0 = not started */ +} FramePacer; + +/* Pure decision function (unit-testable, no SDL). + * Given a single counter sample `now`, the current deadline, the counter + * frequency and the frame period (both in ticks), returns the number of + * milliseconds to sleep right now, or 0 if the caller should stop + * sleeping (deadline reached / close enough to spin). + * Never returns a value larger than one period's worth of ms + 1. */ +uint32_t frame_pacing_sleep_ms(uint64_t now, uint64_t deadline, + uint64_t freq, uint64_t period); + +/* Block until the pacer's next deadline (sleep + final sub-ms spin), + * then advance the deadline by one period. If the pacer has not started, + * or the caller fell beyond the implementation's bounded transient-catch-up + * window, re-anchor to now + period without sleeping. period_ms is the frame + * period in milliseconds (e.g. 1000.0 / 59.94). */ +void frame_pacer_wait(FramePacer *p, double period_ms); + +/* 1 while the display driver's swap block — not the pacer above — is what holds + * the guest to its vblank cadence (present_vsync_owns_cadence() in main.cpp). + * The two are XOR: when this returns 1 the frontend does not call + * frame_pacer_wait(), so the ONLY thing throttling the guest is the swap. + * + * A renderer that elides a redundant swap (unchanged front buffer) must + * therefore not do so while this is 1: the elided frame blocks on nothing, and + * a game that presents every other vblank runs at 2x. */ +int psx_present_vsync_owns_cadence(void); + +#ifdef __cplusplus +} +#endif + +#endif /* FRAME_PACING_H */ diff --git a/overlay_toolchain/include/freeze_heartbeat.h b/overlay_toolchain/include/freeze_heartbeat.h new file mode 100644 index 00000000..1d2314c6 --- /dev/null +++ b/overlay_toolchain/include/freeze_heartbeat.h @@ -0,0 +1,38 @@ +/* freeze_heartbeat.h — observability infrastructure. + * + * Starts a background thread that snapshots runtime state to + * `psx_freeze_heartbeat.json` every ~100 ms. Survives main-thread + * freezes (Windows / SDL "Not Responding") because the writer thread + * is independent of the main loop and the debug-server TCP path. + * + * Reader: any external process that reads the file. The file is + * overwritten in place — no log growth, no CLAUDE.md §3 violation. + * + * Not a fix for anything. Pure observability so we can see what state + * the runtime was in just before it stalled. + */ + +#ifndef PSXRECOMP_FREEZE_HEARTBEAT_H +#define PSXRECOMP_FREEZE_HEARTBEAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Spawn the heartbeat thread. Idempotent — second call is a no-op. + * `backend_label` is written into the heartbeat JSON as "backend" + * (e.g. "psx-runtime" or "psx-beetle") so a reader can tell which + * binary produced the file. */ +void freeze_heartbeat_start(const char *backend_label); + +/* Suppress automatic wedge classification while the host intentionally parks + * guest execution, such as save-state/rewind overlays or netplay admit waits. + * Heartbeat JSON still updates; the detector window is reset while paused so + * the first post-resume window is built only from live guest samples. */ +void freeze_heartbeat_set_paused(int paused); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_FREEZE_HEARTBEAT_H */ diff --git a/overlay_toolchain/include/game_options.h b/overlay_toolchain/include/game_options.h new file mode 100644 index 00000000..700f8a65 --- /dev/null +++ b/overlay_toolchain/include/game_options.h @@ -0,0 +1,54 @@ +/* game_options.h — persist in-RAM game config globals across launches. + * + * Some PS1 games (e.g. Tomba!) keep their OPTION-screen settings only in a RAM + * global that re-initialises to defaults every boot, with no memory-card config + * block — so the player must re-set them each launch (issue #5). This module + * persists a game-declared set of those globals to a small state file next to + * the runtime exe: it restores them shortly after boot (once the game's own + * config-init has run) and writes them back whenever they change. + * + * The fields are declared per-game in game.toml ([persist_options]); the + * addresses are guest RAM addresses (KUSEG 0x80xxxxxx) of the canonical config + * globals (pinned via consumer RE / option-screen write capture). Generic: any + * game can list its own. Runtime-only, no debug server, works in release. + */ +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Configure the persisted-options set. addrs/sizes/names/vmins/vmaxs have + * `count` entries (size is 1 or 2 bytes per field); names[i] is the field key + * written to the state file. vmins[i]/vmaxs[i] are the inclusive valid range for + * RESTORE-time validation: a saved value outside [vmin,vmax] is rejected (the + * game default is used) so a corrupt/stale file can't inject an out-of-range + * value. Pass [INT32_MIN, INT32_MAX] for a field that needs no validation. + * state_path is the absolute file to persist into. Copies what it needs; safe + * to call once at startup. count==0 disables the feature. */ +void game_options_configure(const char *state_path, + const uint32_t *addrs, + const uint8_t *sizes, + const char *const *names, + const int32_t *vmins, + const int32_t *vmaxs, + int count); + +/* Recompiler hook (called from generated code at each config global's boot-init + * store): returns the persisted value for `addr` if one was loaded, else `val` + * unchanged. This is what performs restore-at-init. */ +int psx_game_option_store(uint32_t addr, int val); + +/* Persist the current option globals to the state file. Registered via atexit, + * so a clean exit saves whatever the player last chose in the OPTION screen. */ +void game_options_save_now(void); + +/* Diagnostics: write a JSON object describing the module state (configured + * fields, whether the state file loaded, per-field loaded/current/released). + * Returns bytes written. For the debug server only. */ +int game_options_debug_json(char *out, int cap); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/gl_scale_limits.h b/overlay_toolchain/include/gl_scale_limits.h new file mode 100644 index 00000000..ce1c0831 --- /dev/null +++ b/overlay_toolchain/include/gl_scale_limits.h @@ -0,0 +1,154 @@ +/* gl_scale_limits.h — how large an internal-resolution scale the OpenGL + * backend may allocate. + * + * Pure arithmetic, no GL or SDL, so a test can pin it. The GL backend keeps the + * authoritative VRAM as one 1024*S x 512*S colour texture plus a same-size + * depth-stencil renderbuffer (gpu_gl_renderer.c). Two things bound S: + * + * - the driver's size limits: GL_MAX_TEXTURE_SIZE, GL_MAX_RENDERBUFFER_SIZE + * and GL_MAX_VIEWPORT_DIMS (the caller passes their minimum). Apple's GL + * on Metal reports 16384, so the full-VRAM surface tops out at S = 16; + * - a memory budget. On unified-memory machines this is system RAM. + * + * A request that does not fit is clamped here, never turned into a failed + * context: the old behaviour (allocation failure -> the whole GL backend fell + * back to the software renderer) lost far more than the resolution. */ +#pragma once + +#include + +#define PSX_GL_VRAM_W 1024 +#define PSX_GL_VRAM_H 512 + +/* RGBA8 colour + D24S8 depth-stencil per internal pixel. The copy scratch is + * sized lazily to the largest copy, so it is not part of the fixed cost. */ +#define PSX_GL_HR_BYTES_PER_PX 8u + +/* Default memory budget for the full-VRAM surface: 2 GiB (S = 22 by memory; + * the texture limit binds first on 16384-limit GPUs). */ +#define PSX_GL_DEFAULT_BUDGET_MB 2048u + +/* Why a scale was reduced. */ +enum { + PSX_GL_SCALE_OK = 0, + PSX_GL_SCALE_TEXTURE = 1, /* 1024*S exceeds the driver size limit */ + PSX_GL_SCALE_BUDGET = 2, /* surface exceeds the memory budget */ + PSX_GL_SCALE_CEILING = 4 /* above the compile-time ceiling */ +}; + +/* Bytes of the full-VRAM hr surface (colour + depth-stencil) at scale s. */ +static inline uint64_t psx_gl_full_vram_bytes(int s) { + if (s < 1) s = 1; + return (uint64_t)PSX_GL_VRAM_W * (uint64_t)s * + (uint64_t)PSX_GL_VRAM_H * (uint64_t)s * PSX_GL_HR_BYTES_PER_PX; +} + +/* 1 if a full-VRAM surface at scale s fits max_dim and budget_bytes. + * max_dim <= 0 means "unknown" (no size check). budget_bytes == 0 means no + * budget. */ +static inline int psx_gl_full_vram_fits(int s, int max_dim, uint64_t budget_bytes) { + if (s < 1) return 0; + if (max_dim > 0 && (int64_t)PSX_GL_VRAM_W * s > (int64_t)max_dim) return 0; + if (max_dim > 0 && (int64_t)PSX_GL_VRAM_H * s > (int64_t)max_dim) return 0; + if (budget_bytes && psx_gl_full_vram_bytes(s) > budget_bytes) return 0; + return 1; +} + +/* Largest scale <= req whose full-VRAM surface fits. Never below 1. When + * reason is non-NULL it receives a PSX_GL_SCALE_* mask of what bound it. */ +static inline int psx_gl_clamp_full_vram_scale(int req, int ceiling, int max_dim, + uint64_t budget_bytes, int *reason) { + int why = PSX_GL_SCALE_OK; + int s = req < 1 ? 1 : req; + if (ceiling > 0 && s > ceiling) { s = ceiling; why |= PSX_GL_SCALE_CEILING; } + while (s > 1) { + int tex_ok = !(max_dim > 0 && + ((int64_t)PSX_GL_VRAM_W * s > (int64_t)max_dim || + (int64_t)PSX_GL_VRAM_H * s > (int64_t)max_dim)); + int mem_ok = !(budget_bytes && psx_gl_full_vram_bytes(s) > budget_bytes); + if (tex_ok && mem_ok) break; + if (!tex_ok) why |= PSX_GL_SCALE_TEXTURE; + if (!mem_ok) why |= PSX_GL_SCALE_BUDGET; + s--; + } + if (reason) *reason = why; + return s; +} + +/* Widest native-wide surface (in native px) that fits max_dim at scale s. + * The GL wide surfaces are wide_w*S x 512*S. Returns 0 when nothing fits. */ +static inline int psx_gl_max_wide_width(int s, int max_dim) { + if (s < 1) s = 1; + if (max_dim <= 0) return 1 << 30; + if ((int64_t)PSX_GL_VRAM_H * s > (int64_t)max_dim) return 0; + return max_dim / s; +} + +/* Native-wide surface width (native px) for a display disp_w px wide at aspect + * num:den: the display plus two margins of disp_w*(3*num - 4*den)/(8*den), + * rounded exactly as gpu.c's ws_nw_configured_offset rounds them (16:9, 21:9 + * and 32:9 at 320 wide give 426, 560 and 854). */ +static inline int psx_gl_native_wide_width(int disp_w, int num, int den) { + if (disp_w <= 0 || num <= 0 || den <= 0 || + (int64_t)num * 3 <= (int64_t)den * 4) + return disp_w; + int64_t numr = (int64_t)3 * num - (int64_t)4 * den; + return disp_w + 2 * (int)(((int64_t)disp_w * numr + (int64_t)4 * den) / + ((int64_t)8 * den)); +} + +/* Narrow num:den, if needed, to the widest aspect whose native-wide surface + * is at most max_w native px (psx_gl_max_wide_width) at display width disp_w; + * 4:3 when not even one more column fits. 4*(max_w-1) : 3*disp_w rounds to at + * most max_w columns. Returns 1 when it changed num:den. */ +static inline int psx_gl_fit_wide_aspect(int disp_w, int max_w, int *num, int *den) { + if (disp_w <= 0 || max_w <= 0 || !num || !den || + psx_gl_native_wide_width(disp_w, *num, *den) <= max_w) + return 0; + int64_t n = 4, d = 3; + if (max_w - 1 > disp_w) { + n = 4 * (int64_t)(max_w - 1); + d = 3 * (int64_t)disp_w; + int64_t a = n, b = d; + while (b) { int64_t t = a % b; a = b; b = t; } + n /= a; d /= a; + } + *num = (int)n; + *den = (int)d; + return 1; +} + +/* Windowed high-resolution mode: the authoritative VRAM stays at 1x and only + * a window of the displayed columns (window_w native px, full 512-row height) + * is kept at S. Largest S <= req whose smallest useful window (min_window_w, + * e.g. a 320-px framebuffer) fits max_dim and budget_bytes. */ +static inline uint64_t psx_gl_window_bytes(int s, int window_w) { + if (s < 1) s = 1; + return (uint64_t)window_w * (uint64_t)s * (uint64_t)PSX_GL_VRAM_H * (uint64_t)s * + PSX_GL_HR_BYTES_PER_PX; +} +static inline int psx_gl_clamp_window_scale(int req, int ceiling, int max_dim, + uint64_t budget_bytes, int min_window_w) { + int s = req < 1 ? 1 : req; + if (ceiling > 0 && s > ceiling) s = ceiling; + while (s > 1) { + int dim_ok = !(max_dim > 0 && + ((int64_t)PSX_GL_VRAM_H * s > (int64_t)max_dim || + (int64_t)min_window_w * s > (int64_t)max_dim)); + int mem_ok = !(budget_bytes && psx_gl_window_bytes(s, min_window_w) > budget_bytes); + if (dim_ok && mem_ok) break; + s--; + } + return s; +} + +/* Parse a budget override in MiB (PSX_GL_VRAM_BUDGET_MB). NULL/empty/invalid + * returns the default. "0" disables the budget. */ +static inline uint64_t psx_gl_budget_bytes_from_env(const char *mb) { + uint64_t v = 0; + const char *p = mb; + if (!p || !*p) return (uint64_t)PSX_GL_DEFAULT_BUDGET_MB << 20; + while (*p >= '0' && *p <= '9') { v = v * 10u + (uint64_t)(*p - '0'); p++; if (v > (1u << 24)) break; } + if (*p) return (uint64_t)PSX_GL_DEFAULT_BUDGET_MB << 20; + return v << 20; +} diff --git a/overlay_toolchain/include/gpu.h b/overlay_toolchain/include/gpu.h new file mode 100644 index 00000000..c625b2ba --- /dev/null +++ b/overlay_toolchain/include/gpu.h @@ -0,0 +1,665 @@ +/* gpu.h — PS1 GPU hardware simulation (Phase 3). + * + * Implements GPUSTAT, GP0, GP1, and 1024x512 16-bit VRAM. + * No rendering to screen — just correct hardware state transitions. + */ + +#ifndef PSXRECOMP_GPU_H +#define PSXRECOMP_GPU_H + +#include + +typedef struct CPUState CPUState; + +#ifdef __cplusplus +extern "C" { +#endif + +void gpu_init(void); +uint32_t gpu_read_gpustat(void); /* 0x1F801814 read */ +uint32_t gpu_read_gpuread(void); /* 0x1F801810 read */ +void gpu_write_gp0(uint32_t val); /* 0x1F801810 write */ +void gpu_write_gp1(uint32_t val); /* 0x1F801814 write */ +void gpu_set_gp0_source(uint32_t addr); /* diagnostic source for next GP0 word */ +/* Linked-list provenance for the next GP0 words. `word_count == 0` identifies + * an ordering-table link node; packet nodes retain the most recently visited + * OT rank. This lets diagnostics distinguish front-layer UI packets from + * depth-sorted world packets without guessing from primitive shape. */ +void gpu_set_gp0_linked_list_node(uint32_t addr, uint32_t word_count); +void gpu_vblank_tick(void); /* Toggle LCF, called at each simulated vblank */ +/* Video standard before the first GP1(08h) (disc region: 1 = PAL). Applies + * now and on every later gpu_init(); GP1(00h) still resets to NTSC. */ +void gpu_set_power_on_video_mode(int pal); + +/* Display presentation accessors (Phase 3). */ +const uint16_t* gpu_get_vram(void); /* Pointer to 1024x512 16-bit VRAM */ + +typedef struct { + uint32_t display_x, display_y; /* VRAM start of display area (GP1(05h)) */ + uint32_t width, height; /* Derived from display mode + ranges */ + uint32_t screen_height; /* PAL/NTSC active canvas for depth24 */ + uint32_t screen_origin_y; /* Visible source origin in that canvas */ + uint32_t screen_source_skip_y; /* VRAM rows clipped above active video */ + int32_t screen_offset_y; /* GP1(07h) position relative to TV centre */ + int depth24; /* GP1(08h) display depth flag: RGB888 scanout */ + int disabled; /* GP1(03h) display disable flag */ +} GpuDisplayInfo; + +void gpu_get_display_info(GpuDisplayInfo* out); +/* Render-pass GPU register checkpoint (render_pass.c). One at a time. */ +int gpu_pass_checkpoint_save(void); +void gpu_pass_checkpoint_restore(void); +uint64_t gpu_pass_state_hash(void); + +/* Perspective-correct UV arming rate, per condition. armed/attempts is the + * real perspective coverage: attempts counts only textured triangles, so it is + * the denominator that gp0_draw (which includes untextured primitives that are + * correctly never armed) cannot provide. Diagnostic; any pointer may be NULL. */ +void gpu_texture_correction_stats(uint64_t *attempts, uint64_t *armed, + uint64_t *no_correction, + uint64_t *no_source, uint64_t *no_depth); +/* GP1(08h) bit4 — 24-bit display. Renderers skip FBO upload queues while set: + * packed RGB888 lives in the CPU mirror; treating A0 rects as 1555 FBO uploads + * both wastes bandwidth and force-flushes when UP_RECTS_MAX is hit (MotK FMV). */ +int gpu_display_is_depth24(void); +void gpu_display_pixel_rgb(const GpuDisplayInfo* di, uint32_t x, uint32_t y, + uint8_t* r, uint8_t* g, uint8_t* b); +uint32_t gpu_display_pixel_argb(const GpuDisplayInfo* di, uint32_t x, uint32_t y); +/* Batch equivalent of calling gpu_display_pixel_argb(di, x, y) for x in + * [0, count) on a depth24 (FMV) scanline — same output, far less per-pixel + * overhead. `out` must hold at least `count` uint32_t ARGB entries. */ +void gpu_depth24_present_row(const GpuDisplayInfo* di, uint32_t y, uint32_t* out, + uint32_t count); +/* Depth24: RGB columns covered by CPU→VRAM uploads since the last reset. + * Returns 0 when no uploads yet, crtc_w when coverage is full/unknown-beyond, + * else the covered RGB width. Present black-fills [limit, crtc_w) without + * shrinking the CRTC-derived draw width (avoids a flickering black pillar). */ +uint32_t gpu_depth24_rgb_limit(uint32_t display_x, uint32_t crtc_w); +void gpu_depth24_upload_span_reset(void); +/* MotK intro cuts retarget GP1(07h). While hold > 0, present should skip + * Swap (keep prior frame) so stale trailing VRAM never flashes. One tick + * per vblank; returns non-zero while the hold is still active after tick. */ +int gpu_depth24_present_hold_tick(void); +/* After savestate restore: clear ephemeral hold so the restored depth24 + * frame can present immediately (span/prev_h come from the GPU snap). */ +void gpu_depth24_on_savestate_loaded(void); +/* GP1(06h)/GP1(07h)/GP1(08h) fields for debug (gpu_state). */ +void gpu_get_crtc_debug(uint32_t *x1, uint32_t *x2, uint32_t *y1, uint32_t *y2, + uint32_t *hres1_out, uint32_t *hres2_out); +uint64_t gpu_get_gp0_count(void); /* Total GP0 writes since init */ +void gpu_get_gp0_stats(uint64_t* nop, uint64_t* fill, uint64_t* draw, uint64_t* env, uint64_t* copy); + +typedef struct { + uint32_t left, top, right, bottom; + int32_t offset_x, offset_y; +} GpuDrawArea; +void gpu_get_draw_area(GpuDrawArea* out); +/* Non-zero when the frame that just reached vblank used two side-by-side draw + * areas. Presentation-only helpers use this to expand a local split-screen + * viewport without changing the underlying framebuffer or netplay hashes. */ +int gpu_last_frame_vertical_split_screen(void); +void gpu_vertical_split_debug(int *active, int *left_age, int *right_age); +uint16_t gpu_vram_peek(int x, int y); + +/* Shaded quad vertex capture (Phase 4.5 debug). */ +typedef struct { + int32_t vx[4], vy[4]; + uint32_t color[4]; +} GpuSqCapEntry; +void gpu_arm_shaded_quad_capture(void); +int gpu_get_shaded_quad_capture(const GpuSqCapEntry** out); + +/* Per-frame GP0 command ring (always-on in debug-tool builds). + * Each entry records up to GPU_GP0_RING_MAX_WORDS command words, including + * the header; longer commands are truncated. + * Stamped with the s_frame_count value at issue time so a debug + * client can pull all commands for any frame in the ring window. + * PSX_NO_DEBUG_TOOLS builds report zero total/capacity and empty dumps/spans. */ +#define GPU_GP0_RING_MAX_WORDS 12 +typedef struct { + uint32_t frame; + uint32_t seq; + uint32_t src_addr; /* RAM/MMIO source address of command header, if known */ + uint32_t pc; /* g_debug_last_store_pc when command completes */ + uint32_t func; /* g_debug_current_func_addr at issue (executing guest fn) */ + uint32_t ra; /* guest $ra at issue: direct caller of the leaf GP0 helper */ + uint8_t opcode; + uint8_t n_words; /* total command length; >MAX means truncated */ + uint16_t ot_rank; /* linked-list OT rank, 0xFFFF outside/unknown */ + uint32_t cmd[GPU_GP0_RING_MAX_WORDS]; + /* Builder attribution (populated only for VRAM->VRAM copies, op 0x80): + * bounded guest-stack unwind of validated return addresses, innermost + * first. Lets a caller skip the libgpu funnel band and name the game-level + * routine that assembled the copy. Zero for non-copy commands. */ + uint32_t bld[6]; + uint32_t csp; /* raw guest $sp at copy time (diagnostic) */ +} GpuGp0RingEntry; + +uint64_t gpu_gp0_ring_total(void); +uint32_t gpu_gp0_ring_capacity(void); +uint32_t gpu_gp0_ring_max_words(void); +int gpu_gp0_ring_dump_frame(uint32_t frame, GpuGp0RingEntry *out, int max_out); +void gpu_gp0_ring_frame_span(uint32_t *out_oldest, uint32_t *out_newest); + +/* Vblank presentation callback — called from gpu_vblank_tick(). + * Under netplay the callback is deferred to gpu_vblank_flush_present() at + * BB / IRQ-check edges so finish_frame digests are not sampled mid-block. + * Flush also holds while sio_hold_present_for_card() so native save/load + * busy-waits are not interrupted by MotK-style BB-edge commit. */ +typedef void (*gpu_vblank_cb)(void); +void gpu_set_vblank_callback(gpu_vblank_cb cb); +void gpu_vblank_flush_present(void); +void gpu_vblank_clear_deferred_present(void); +/* Queue one deferred present (netplay RB resume when I_STAT already has + * VBlank — snap resync cleared the pending callback). */ +void gpu_vblank_arm_deferred_present(void); +/* 1 while a netplay deferred present is armed (MotK CD54 VBlank hold). */ +int gpu_vblank_present_pending(void); +/* Clear flush_present reentrancy guard before longjmp (flush_resume). */ +void gpu_vblank_release_present_flush_guard(void); + +/* Present-time screen-colour model (see color_lut.h ScreenKind: 0=raw, + * 1=crt, 2=composite, 3=trinitron). Config/launcher-driven; the PSX_SCREEN + * env var, if set, overrides this. Default 0 (raw) is byte-identical. */ +void gpu_set_screen_kind(int kind); + +/* Widescreen proportion correction (active only when aspect != 4:3 and the + * game's [widescreen] block opts in — see config_loader.h). Tagged + * character/billboard prims are re-squashed around their projected anchor; + * untagged SPRT prims (screen-space HUD/menus) around the display centre. + * psx_ws_sprite_tag is the per-prim callback the recompiler emits at the + * entry of each [widescreen] sprite_tag_funcs function. */ +/* mode: 0 = off (4:3 identity), 1 = squash (legacy hack), 2 = native-wide + * (render the wider FOV into a wider frame, present 1:1; GTE not squashed). */ +void gpu_ws_configure(int aspect_num, int aspect_den, + uint32_t sprite_anchor_addr, int hud_sprt_squash, int mode); +/* [widescreen] full_2d: opt a pure-2D sprite game into the widescreen present + * path (treat every in-game frame as gameplay, since it never tags 3D prims). */ +void gpu_ws_set_full_2d(int on); +/* Signed 16-bit camera/min/max; active is a nonzero byte. Requires bg2d hooks. + * Zero addresses disable the feature. No guest memory is written. */ +void gpu_ws_set_view_anchor(uint32_t camera, uint32_t min, uint32_t max, uint32_t active); +/* Optional authored scene bounds when native camera locks do not delimit + * visible geometry. Set before layer setup; disable when leaving the scene. + * Changes presentation only, and has no effect without view anchoring. */ +void gpu_ws_set_view_bounds_override(int enabled, int minimum, int maximum); +/* Bracket each bg2d packet producer, with its guest packet pointer. The + * independent-layer mask identifies parallax backdrops that may anchor to + * their own map edges; linked/foreground layers retain the world origin. */ +void gpu_ws_bg2d_begin_view_layer(unsigned layer, uint32_t packet, unsigned independent_mask); +void gpu_ws_bg2d_end_view_layer(unsigned layer, uint32_t packet); +/* Opt-in host-produced SPRT_16 packets, 32-byte slots in enhancement DMA RAM. + * The 16-byte standard packet is followed by signed view shift, left/right + * padding and GPU_WS_BG2D_PACKET_MAGIC, optionally ORed with MIRROR_X. + * Coordinates use signed 16-bit X; ordinary + * packets retain PS1 signed 11-bit coordinates. The guest tile loop/ring stays + * native while this arena is registered. Allocate once during mod activation. */ +void gpu_ws_bg2d_set_host_arena(uint32_t base, uint32_t size); +#define GPU_WS_BG2D_PACKET_MAGIC 0x58364247u +#define GPU_WS_BG2D_BANK_PACKET_MAGIC 0x58364248u +/* Bank packets pack signed shift in +16 low half and immutable bank ID in + * its high half. Their indices use the bank, but palettes remain live VRAM. + * Keep the original magic readable for pending packets in older snapshots. */ +#define GPU_WS_BG2D_MIRROR_X 0x80000000u +struct WsViewAnchor; +int gpu_ws_bg2d_get_view(unsigned layer, struct WsViewAnchor *view); +void gpu_ws_set_auto_ui_squash(int on); +/* [widescreen] auto_ui_anchor = "in_place": each UI run squashes about its own + * centre rather than an edge/centre third (default "edges"). */ +void gpu_ws_set_auto_ui_in_place(int on); +/* [widescreen.bg2d] Capcom 2D background tile-loop widen — hooked at the renderer's + * column-count / start-tile-col / start-screen-x instructions. Identity at 4:3 + * and in the engine's 512 hi-res mode. */ +void gpu_ws_bg2d_configure(uint32_t layer_base, uint32_t ring_base, + uint32_t map_size_addr, uint32_t layer_stride_addr, + uint32_t ring_cols, uint32_t layer_count, + uint32_t layer_struct_stride, uint32_t packet_cap); +/* Some Capcom variants (MMX5/MMX6) can compose a layer's scroll with a parent + * selected by byte +0x52. MMX4's streamer always uses each layer's own scroll. */ +void gpu_ws_bg2d_set_parent_links(int on); +int psx_ws_bg2d_cols(int base); +int psx_ws_bg2d_startcol(int col, unsigned mask); +int psx_ws_bg2d_startx(int x); +int psx_ws_bg2d_stream_left(int x); +int psx_ws_bg2d_stream_right(int x); +int psx_ws_bg2d_undercap(int counter, int native_cap); +/* MISNAMED, NOT MMX6-SPECIFIC, AND NOT SAFE TO DELETE (surveyed 2026-07-27). + * + * These read as "MMX6 compat shims" and the comment here used to say exactly + * that. They are not. They are the widescreen-2D entry points that the + * recompiler emits for ANY title with a [widescreen.bg2d] block, and live + * generated code in several non-MMX6 games links them today: + * + * psx_ws_mmx6_bg_cols/startcol/startx/stream_left/stream_right + * -> CrashBashRecomp, MegaManX5Recomp, TsumuRecomp (+ -release) + * psx_ws_mmx6_bg_undercap (below, in gpu.c) + * -> ApeEscapeRecomp, CrashBashRecomp, MegaManX4Recomp, + * MegaManX5Recomp, TsumuRecomp, Vigilante8PSXRecomp, THPS2 + * + * Each one forwards to its psx_ws_bg2d_* twin above, which is the real + * implementation. Only the NAME is historical: this began as MMX6 widescreen + * work and was generalised without renaming the emitted symbols. + * + * Deleting or renaming them breaks widescreen in every repo listed above, and + * a rename cannot be runtime-only: the names are emitted by + * recompiler/src/code_generator.cpp, which is in codegen_hash_sources.cmake, + * so changing it rolls the overlay cache tag and forces a regen + reshard of + * every title. That is the reason this is still called mmx6 in 2026. + * + * Verify before touching, don't trust this comment: grep the generated trees + * of the game repos for psx_ws_mmx6_bg_undercap and see who turns up. + */ +int psx_ws_mmx6_bg_cols(int base); +int psx_ws_mmx6_bg_startcol(int col); +int psx_ws_mmx6_bg_startx(int x); +int psx_ws_mmx6_bg_stream_left(int x); +int psx_ws_mmx6_bg_stream_right(int x); +struct CPUState; +void psx_ws_sprite_tag(struct CPUState* cpu); +/* Native-wide (mode 2) on a game frame. ws_nw_extra() is the total width the + * frame grows by, in display pixels (the present path widens the display read + * by this; 0 when native-wide is inactive). */ +int ws_native_wide_active(void); +int ws_nw_extra(void); +/* Configured per-side reveal, excluding the world-culling safety envelope. + * Available before scene classification so first-frame overlays can fit. */ +int gpu_ws_configured_x_reveal(void); +int ws_nw_present_width(void); +/* Display width (native px) the native-wide margins are derived from. */ +int gpu_ws_display_width(void); +void gpu_ws_set_netplay_local_viewport(int enabled, int slot); +int gpu_ws_netplay_local_viewport_base_x(void); +int gpu_ws_netplay_local_viewport_width(void); +/* True when the current frame must present at native 4:3 (FMV video or a + * full-2D menu/title screen), so the squash is suppressed and content drawn + * pixel-native. The present path uses the same predicate to pillarbox. */ +int gpu_ws_present_native_43(void); +/* Per-side X cull-margin (screen/world units) emitted into the game's draw- + * cull immediates by the recompiler ([widescreen.cull]); 0 unless stretching. */ +int psx_ws_x_margin(void); +void gpu_ws_set_cull_guard_pixels(int pixels); +/* Bias/range activation-window margin. This may include an additional + * resident-object lead while render/terrain paths retain psx_ws_x_margin(). */ +int psx_ws_activation_margin(void); +void gpu_ws_set_activation_guard_pixels(int pixels); +void gpu_ws_set_explicit_cull_sites(const uint32_t *bias, int nbias, + const uint32_t *slti, int nslti, + const uint32_t *range, int nrange); +void gpu_ws_set_slti_lower_cull_sites(const uint32_t *sites, int nsites); +void gpu_ws_set_negsub_cull_sites(const uint32_t *sites, int nsites); +void gpu_ws_set_vxrange_cull_sites(const uint32_t *sites, int nsites); +void gpu_ws_set_depth_cull_sites(const uint32_t *sites, int nsites); +void gpu_ws_set_plane_nx_sites(const uint32_t *sites, int nsites); +void gpu_ws_set_xclip_load_sites(const uint32_t *sites, int nsites); +/* Interpreter copies of the explicit branch kinds ([widescreen.cull] + * bltz_sites, bgez_sites, branch_keep_sites) and of clip_edge_x_load_sites + * with its screen width (clip_edge_width). Native code compiles them in. */ +void gpu_ws_set_branch_cull_sites(const uint32_t *bltz, int nbltz, + const uint32_t *bgez, int nbgez, + const uint32_t *keep, int nkeep); +void gpu_ws_set_clip_edge_x_load_sites(const uint32_t *sites, int nsites, + uint32_t width); +void gpu_ws_set_cull_keep_sites(const uint32_t *addresses, + const uint32_t *expected, + const uint32_t *results, int nsites); +void gpu_ws_set_angle_sites(const uint32_t *addresses, + const uint32_t *expected, int nsites); +/* [[widescreen.cull.scale]]: full-word-guarded SLT/SLTU sites whose rs (0) or + * rt (1) operand is a runtime +/-half_extent*z frustum bound. */ +void gpu_ws_set_cull_scale_sites(const uint32_t *addresses, + const uint32_t *expected, + const uint32_t *operands, + const uint32_t *half_extents, int nsites); +void gpu_ws_set_aspect_cone(const uint32_t *addresses, + const uint32_t *expected, + const uint32_t *cosine_thresholds, + const uint32_t *object_regs, + const uint32_t *x_regs, + const uint32_t *z_regs, + const uint32_t *y_regs, + const uint32_t *queue_guards, + int nsites, + uint32_t forward_addr, + uint32_t object_type_offset, + uint32_t hysteresis_pixels, + uint32_t queue_reserve, + const uint32_t queue_count_addrs[3], + const uint32_t queue_capacities[3], + const uint32_t queue_type_masks[3]); +int psx_ws_is_cull_bias_site(uint32_t pc); +void gpu_ws_set_bias_lower_cull_sites(const uint32_t *sites, int nsites); +int psx_ws_is_cull_bias_lower_site(uint32_t pc); +int psx_ws_is_cull_slti_site(uint32_t pc); +int psx_ws_is_cull_slti_lower_site(uint32_t pc); +int psx_ws_is_cull_negsub_site(uint32_t pc); +int psx_ws_is_cull_vxrange_site(uint32_t pc); +int psx_ws_is_cull_depth_site(uint32_t pc); +int32_t psx_ws_depth_bound(int32_t imm); +int psx_ws_is_cull_range_site(uint32_t pc); +int psx_ws_is_cull_plane_nx_site(uint32_t pc); +int32_t psx_ws_plane_nx(int32_t nx); +int psx_ws_is_cull_xclip_load_site(uint32_t pc); +uint32_t psx_ws_xclip_bound(uint32_t vanilla); +int psx_ws_is_cull_bltz_site(uint32_t pc); +int psx_ws_is_cull_bgez_site(uint32_t pc); +int psx_ws_is_cull_branch_keep_site(uint32_t pc); +void gpu_ws_set_masked_reject_sites(const uint32_t *addresses, + const uint32_t *expected, const uint32_t *masks, int count); +int psx_ws_masked_reject(uint32_t flags, uint32_t mask); +int psx_ws_masked_reject_site(uint32_t pc, uint32_t instr, + uint32_t flags, int vanilla); +int psx_ws_nclip_branch(uint32_t pc, uint32_t instr, int32_t mac0, int vanilla); +uint64_t gpu_ws_native_wide_nclip_rescues(void); +int psx_ws_is_cull_clip_edge_x_load_site(uint32_t pc); +uint32_t psx_ws_clip_edge_width(void); +uint32_t psx_ws_cull_keep_result(uint32_t vanilla, uint32_t forced); +int psx_ws_cull_keep_site(uint32_t pc, uint32_t instr, uint32_t vanilla, + uint32_t *out); +uint32_t psx_ws_angle_widen(uint32_t vanilla); +int psx_ws_angle_site(uint32_t pc, uint32_t instr, uint32_t *out); +/* bound * (half_extent + margin) / half_extent; identity at 4:3. */ +int32_t psx_ws_cull_scale(int32_t bound, int32_t half_extent); +/* Interpreter path for a configured scale site: returns 1 and the widened + * compare verdict in *out when (pc, instr) is a configured site. */ +int psx_ws_cull_scale_site(uint32_t pc, uint32_t instr, uint32_t rs_value, + uint32_t rt_value, uint32_t *out); +uint32_t psx_ws_aspect_cone_result(uint32_t site, uint32_t vanilla, + uint32_t object, int32_t x, int32_t z, + int32_t y); +int psx_ws_aspect_cone_site(CPUState *cpu, uint32_t pc, uint32_t instr, + uint32_t vanilla, uint32_t *out); +/* Scale a signed Q16 horizontal gameplay limit into the active native-wide + * game field. Identity at 4:3 / menus / FMV. */ +int32_t psx_ws_player_x_bound(int32_t vanilla); +void gpu_ws_set_signed_x_bound_sites(const uint32_t *addresses, + const uint32_t *expected, int count); +int psx_ws_is_signed_x_bound_site(uint32_t pc, uint32_t instr); +/* Widen a signed screen-pixel edge loaded by an explicitly guarded site. */ +int32_t psx_ws_screen_x_bound(int32_t vanilla); + +/* Shared render-funnel screen-X cull widening ([widescreen.cull] auto_screen_x): + * the gcc emit and the interpreter both route a flagged + * `sltiu rt, sx, 0x140/0x141` through this one helper so every overlay execution + * path widens identically. Returns the sltiu verdict (1 = keep). 0 at 4:3. */ +int psx_ws_cull_sltiu(uint32_t sx, uint32_t imm); +/* Signed-funnel variants (min/max + center±halfwidth idioms — see + * ws_cull_detect.h): right-edge widen for `slti v, minSX, W` and left-edge + * widen for the paired `bltz maxSX` reject. Identity at 4:3. */ +int psx_ws_cull_slti(uint32_t sx, uint32_t imm); +int psx_ws_cull_slti_lower(uint32_t sx, uint32_t imm); +int psx_ws_cull_bltz(uint32_t v); +/* [widescreen.cull] bgez_sites: `bgez SX, keep` keeps while SX >= -margin + * (the exact partner of bltz_sites; see ws_cull_edge.h). Identity at 4:3. */ +int psx_ws_cull_bgez(uint32_t v); +/* [widescreen.cull] clip_edge_x_load_sites: a loaded screen-X clip bound of 0 + * becomes -margin and one of `w` becomes w+margin; interior bounds and 4:3 + * are unchanged (see ws_cull_edge.h). */ +uint32_t psx_ws_clip_edge_x(uint32_t v, uint32_t w); +/* [widescreen.cull] screen_x_sites on `lui` and `bltz`: a screen X kept in the + * high half of a register. The edge `lui rt, W` becomes (W + margin) << 16 and + * the `bltz` is taken while SX < -margin (see ws_cull_edge.h). Identity at + * 4:3. */ +uint32_t psx_ws_cull_lui_hi(uint32_t imm); +int psx_ws_cull_bltz_hi(uint32_t v); +int psx_ws_cull_vxrange(uint32_t x, uint32_t imm); +/* True if a run of instruction words carries the screen-extent reject signature + * (a width compare AND a height compare from the configured immediate sets). + * Used by the interp to gate the widening to real render funnels. */ +int psx_ws_func_has_screen_cull(const uint32_t *words, int n); +/* Classify words[idx] as an X left-edge reject bltz (runtime imm sets). */ +int psx_ws_cull_bltz_at(const uint32_t *words, int n, int idx); +/* Per-game cull signature immediates ([widescreen.cull] screen_w_imms / + * screen_h_imms); defaults 0x140/0x141 + 0xE0/0xF1. */ +void gpu_ws_set_cull_imms(const uint32_t *w, int nw, const uint32_t *h, int nh); +int psx_ws_is_cull_w_imm(uint32_t imm); +/* Per-game opt-in gates for the pattern-scanned interp widen hooks + * (auto_screen_x cull + auto_backdrop preload). Default OFF: a title that + * never opted in must never have its live code pattern-scanned and rewritten. */ +void gpu_ws_set_auto_hooks(int cull_on, int backdrop_on); +int psx_ws_auto_cull_on(void); +/* Perspective-correct UV interpolation for textured world polygons + * ([video] perspective_texturing). Also turns on the SWC2 RAM-provenance + * tracking it needs, so a polygon only qualifies when every position word in + * its DMA packet was written by a GTE projection store. Default off. */ +void gpu_texture_correction_set(int enabled); +int gpu_texture_correction_enabled(void); +/* Triangles drawn with perspective-correct UVs since startup. */ +uint32_t gpu_texture_correction_hits(void); +/* GTE-activity gameplay detector ([widescreen] gte_game_mode) for 3D titles + * with no sprite-tag helper: gte.cpp notes every RTPS/RTPT projection; a frame + * that projects enough vertices is stamped as gameplay. */ +void gpu_ws_set_gte_game_mode(int on); +void gpu_ws_set_precise_nclip(int on); +void psx_ws_note_gte_project(int nverts); +/* Optional authoritative gameplay-state gate. When configured, it replaces + * heuristic gameplay classification for native-wide presentation. */ +void gpu_ws_set_gameplay_state_gate(uint32_t addr, + const uint32_t *values, int nvalues); +/* [netplay] local_viewport_state_*: a split frame counts as a vertical split + * (netplay local viewport) only while this word holds one of the values. */ +void gpu_ws_set_local_viewport_state_gate(uint32_t addr, + const uint32_t *values, int nvalues); +/* Native-wide HUD corner re-anchoring ([widescreen] nw_hud_corners): push + * outer-third screen-space HUD primitives out to the true wide-frame corners + * (they otherwise sit inset by the reveal). Runtime-only. Off by default. */ +void gpu_ws_set_nw_hud_corners(int on); +void gpu_ws_tag_hud_primitive(uint32_t primitive, int edge); +void gpu_ws_tag_world_primitive(uint32_t primitive, int is_world); +void gpu_ws_set_adaptive_backdrop_preload(int enabled); +/* Explicit native-wide HUD packet anchor from a trusted title plugin. + * `prim` is the address of the PsyQ P_TAG word; the drawn command starts at + * prim+4. anchor: -1 = left, 0 = center, +1 = right. */ +void gpu_ws_tag_hud_prim(uint32_t prim, int anchor); +/* Stretch a trusted authored background polygon about the display center in + * the native-wide output only (GL/SW). prim+4 is the command address, including + * for a command embedded inside a longer DMA packet. Only opaque polygons are + * accepted; address, full packet contents, and frame freshness are guarded. + * Tag the complete background composite before submitting its ordering table. + * The caller proves background identity/coverage; no guest data is modified. */ +void gpu_ws_tag_background_prim(uint32_t prim); +/* Always-on counters for the explicit HUD-anchor and background tag tables: + * how many tags a title plugin offered, how many were rejected at insert + * (native-wide not configured / unreadable or unsupported command), and why + * executing primitives that matched a tagged address were or were not + * honoured. TCP: {"cmd":"ws_tag_stats"}. */ +typedef struct GpuWsTagStats { + uint64_t tag_calls; + uint64_t tag_rejected; + uint64_t hit; + uint64_t stale; + uint64_t guard_mismatch; + uint32_t last_tag_frame; + uint32_t last_hit_frame; +} GpuWsTagStats; +void gpu_ws_get_tag_stats(GpuWsTagStats *hud, GpuWsTagStats *background); +/* Freeze/unfreeze the always-on GP0 command ring (capture mark). */ +void gpu_gp0_ring_set_frozen(int frozen); +/* Fresh packet tags are eligible for background classification. */ +int gpu_ws_background_stretch_active(void); +/* A tagged background can remain in a wide surface after its packet expires. + * Once used, retain full compositing until GPU reset or snapshot restoration. + * Packet freshness must never re-enable canonical-center overwrites. */ +int gpu_ws_background_requires_full_composite(void); +/* Clear synthetic margins to black over an opaque 0x64/65 rectangle's Y band + * immediately before it executes. Packet-guarded; canonical VRAM is untouched. */ +void gpu_ws_tag_black_reveal_rect(uint32_t prim); +/* Repeat an opaque, already-clipped textured rectangle into native-wide + * reveal margins only. The caller verifies the composite's source period. + * Original UVs, texel density, and canonical VRAM writes are unchanged. */ +void gpu_ws_tag_repeat_rect(uint32_t prim, int32_t period); +/* Title-identified flat screen mask: extend vertical sides or horizontal + * letterbox panels to adaptive edges, preserving the interior opening. + * Packet guarded, cleared on reset/load, inert outside native-wide gameplay. */ +void gpu_ws_tag_screen_mask_quad(uint32_t prim); +/* Title-owned flat/Gouraud radial screen mask. Render-only scale about the + * display centre; guest coordinates and timing stay unchanged. Scale >= 1, + * inert at 4:3, packet guarded and reset alongside other transient tags. */ +void gpu_ws_tag_radial_screen_mask_quad(uint32_t prim, float scale); +/* Pure emulation-thread predicate for a known native-only effect/scene. + * Nonzero forces native 4:3; zero defers. No GPU calls or guest writes inside. + * Host configuration survives reset/load; classification reads live state. */ +void gpu_ws_set_native_scene_predicate(int (*predicate)(void)); +/* Targeted alternative for sprite-heavy 2D games: corner-anchor only primitives + * whose ordering-table packet lives in the configured half-open RAM range. */ +void gpu_ws_set_nw_left_hud_packet_range(uint32_t lo, uint32_t hi); +void gpu_ws_begin_linked_list(void); +void gpu_ws_end_linked_list(void); +void gpu_ws_prepass_linked_list(uint32_t start_addr); +void gpu_ws_validate_linked_list_header(uint32_t addr, uint32_t header); +void gpu_ws_validate_linked_list_node(uint32_t addr, uint32_t num_words); +void gpu_ws_restore_linked_list_rank(uint32_t rank); +/* Native-wide full-frame 2D backdrop stretch ([widescreen] nw_backdrop): + * stretch a screen-space quad that covers the whole 4:3 framebuffer (sky + * gradient / backdrop image) to fill the wide frame, so it no longer + * pillarboxes at the reveal margins. Runtime-only. Off by default. */ +void gpu_ws_set_nw_backdrop(int on); +int gpu_ws_native_wide_projection_correction(uint64_t *vertices); +/* Native-wide flat-polygon backdrop stretch ([widescreen] nw_flat_backdrop): + * stretch untextured primitives in the wide mirror without changing the + * canonical 4:3 framebuffer. Intended for flat-colour sky/water backdrops. */ +void gpu_ws_set_nw_flat_backdrop(int on); +int gpu_ws_nw_flat_backdrop_enabled(void); +/* Stretch the title-opted textured pre-3D backdrop phase in the wide mirror. */ +void gpu_ws_set_nw_phase_backdrop(int on); + +/* Backdrop screen-X correction ([widescreen.backdrop] x_sites). The parallax + * 2D backdrop layer computes screen-X without the GTE, so it misses the + * widescreen squash; the recompiler emits this on each backdrop handler's + * final screenX store to squash it around the screen centre (identity at 4:3). + * Pulls far backdrop pieces in from past the 320px edge to cover the 16:9 FOV. */ +int psx_ws_backdrop_x(int x); + +/* Backdrop PRELOAD ([widescreen.cull] auto_backdrop). psx_ws_backdrop_preload() + * is nonzero only while native-wide widescreen is engaged (0 at 4:3 / boot / + * FMV / full-2D), so the rewrite is byte-identical when off. psx_ws_backdrop_value() + * is the one value substitution shared by the gcc emit and the + * interpreter for a detected window bound: it returns `orig` unless preload is + * engaged, in which case it forces the bound to preload the WHOLE finite tile + * row (START -> 0, END -> large sentinel pinned by the generator's high clamp to + * extent-1). Every column is submitted, so the widened 16:9 viewport never gaps; + * the generator's clamps + the byte-sized row extent keep it bounded. */ +int psx_ws_backdrop_preload(void); +uint32_t psx_ws_backdrop_value(uint32_t orig, int is_end, int window_cols); + +/* auto_backdrop diagnostic ring (always-on). The interpreter records every + * window rewrite (with the live extent / DL count / camera-X); `ws_backdrop_ring` + * dumps it. psx_ws_backdrop_ring_json() formats the recent entries into `buf` + * (returns bytes written, excluding the caller's JSON envelope). */ +void psx_ws_backdrop_ring_note(uint32_t pc, int kind, int wcols, uint32_t orig, + uint32_t finalv, int extent, int camx, int count, + uint32_t base, uint32_t dl); +int psx_ws_backdrop_ring_json(char *buf, int cap); + +/* auto_ui_squash partition dump (`ws_ui_groups`). Reports, for the last UI + * prepass, each primitive's raw key inputs (CLUT/texpage band/family via op, + * y, h) alongside its union-find root and final anchor — enough to tell whether + * two HUD primitives shared a run, and which key component split them if not. */ +int psx_ws_ui_groups_json(char *buf, int cap); + +/* Live-tunable backdrop widen amount (ws_backdrop_margin command): <0 whole-row, + * 0 off, >0 N-column widen. g_ws_bd_from_interp is the interp's one-shot + * "I will record the rich entry myself" flag (see gpu.c / dirty_ram_interp.c). */ +extern int g_ws_bd_margin; +extern int g_ws_bd_from_interp; + +/* Native-wide: nonzero if the GP0 prim currently being drawn is sprite-tagged + * (a character / Tomba / HUD element). The GL 2D-backdrop stretch uses this to + * EXCLUDE foreground sprites (only the untagged 2D backdrop is stretched). */ +int psx_ws_prim_is_tagged(void); + +/* Flower-field backdrop data-structure address range + a predicate matching the + * prim being drawn against it (gp0_cmd_source_addr ∈ [lo,hi]). The dirty-RAM + * interp sets lo/hi when the backdrop generator runs; the GL stretch gate uses + * psx_ws_prim_in_backdrop() to identify the flower-field tiles precisely. */ +extern uint32_t g_ws_backdrop_lo, g_ws_backdrop_hi; +int psx_ws_prim_in_backdrop(void); + +/* Backdrop store-site registry: the runtime registers the [widescreen.backdrop] + * x_sites here (from game.toml) so the dirty-RAM interpreter applies the same + * psx_ws_backdrop_x() squash at those `sh` PCs that the recompiler emits into + * native cache DLLs — overlay code frequently runs interpreted, where the emit + * can't reach. PCs are masked to the physical (KUSEG) range. */ +void psx_ws_set_backdrop_sites(const uint32_t* pcs, int n); +int psx_ws_is_backdrop_site(uint32_t pc); + +/* Live widescreen state for diagnostics (TCP gpu_state). All pointers + * optional. last_tag_frame/cur_frame let the caller see game_mode freshness. */ +typedef struct { + int configured; /* ws_xnum != ws_xden */ + int active; /* squash currently applied this frame */ + int game_mode; /* tagged char/billboard prim within 2 frames */ + int present_native_43; /* frame presents pillarboxed 4:3 (FMV/full-2D) */ + int x_margin; /* psx_ws_x_margin() right now */ + int activation_margin; /* psx_ws_activation_margin() right now */ + int xnum, xden; /* squash factor */ + int mode; /* 0 = off, 1 = squash, 2 = native-wide */ + int nw_extra; /* native-wide frame growth (display px), 0 if off */ + int view_anchor, view_left, view_right, view_shift, view_pad_left, view_pad_right; + uint64_t cur_frame; + uint32_t bg2d_generations; /* Game background submissions, independent of vblank. */ + uint32_t last_tag_frame; /* frame of newest tagged prim */ + uint32_t last_3d_frame; /* frame of newest shaded prim (diagnostic) */ + uint32_t gte_verts; /* RTPS/RTPT verts in the last completed frame */ + uint32_t last_world3d_frame;/* newest SUSTAINED world-scale projection frame */ + uint32_t ovh_prims; /* overhanging polys in the last completed frame */ + uint32_t last_ovh_frame; /* newest SUSTAINED polygon-overhang frame (the + 2D-only-scene classifier's world signal) */ + int auto_ui_squash; /* final-OT grouped UI correction configured */ + int auto_ui_in_place; /* runs anchor at their own centre, not thirds */ + int auto_ui_dense; /* current list classified as a dense menu */ + uint32_t auto_ui_ot_rank; /* highest populated UI rank in current list */ + uint64_t auto_ui_candidates; + uint64_t auto_ui_transforms; + uint64_t aspect_cone_calls; + uint64_t aspect_cone_43_identity; + uint64_t aspect_cone_vanilla_keep; + uint64_t aspect_cone_visible_keep; + uint64_t aspect_cone_guard_keep; + uint64_t aspect_cone_hysteresis_keep; + uint64_t aspect_cone_outside_reject; + uint64_t aspect_cone_queue_reject; + uint32_t aspect_cone_queue_highwater[3]; + uint64_t angle_calls; + uint64_t angle_43_identity; + uint32_t angle_max_vanilla; + uint32_t angle_max_widened; +} GpuWsDebug; +void gpu_ws_get_debug(GpuWsDebug* out); + +typedef struct { + uint32_t address; + uint64_t calls; + uint64_t identity_43; + uint64_t vanilla_keep; + uint64_t visible_keep; + uint64_t guard_keep; + uint64_t hysteresis_keep; + uint64_t outside_reject; + uint64_t queue_reject; +} GpuWsAspectConeSiteDebug; +/* Exact-site telemetry for separating actor-list and per-child participation + * predicates. Returns zero when address is not configured. */ +int gpu_ws_get_aspect_cone_site_debug( + uint32_t address, GpuWsAspectConeSiteDebug* out); + +/* Diagnostic: force psx_ws_x_margin() to return v (>=0) regardless of state, + * or -1 to restore the normal computed margin. For live cull-margin sweeps. */ +void gpu_ws_set_margin_override(int v); + +/* Native-wide HUD corner re-anchoring: allow TAGGED rect-family prims to + * shift too (live A/B via TCP ws_hud_mode; some HUD composites render + * through the tagged sprite funnel). */ +void gpu_ws_set_nw_hud_tag_rects(int on); + +/* Always-on draw-census ring: every drawn primitive records frame / source + * addr / camera / first-vertex screen pos, so object spawn/despawn and edge + * culls are observable in data. Dump frames [f0,f1] to a CSV file. */ +int gpu_ws_census_dump(uint32_t f0, uint32_t f1, const char *path); +void gpu_ws_census_set(int on); +uint64_t gpu_ws_census_seq(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_GPU_H */ diff --git a/overlay_toolchain/include/gpu_gl_renderer.h b/overlay_toolchain/include/gpu_gl_renderer.h new file mode 100644 index 00000000..9f6dd817 --- /dev/null +++ b/overlay_toolchain/include/gpu_gl_renderer.h @@ -0,0 +1,361 @@ +#ifndef PSX_GPU_GL_RENDERER_H +#define PSX_GPU_GL_RENDERER_H + +/* GL backend context + present entry points, called from main.cpp's window + * setup and present path when [video] renderer = "opengl". The backend's + * rasterization vtable is obtained separately via gl_backend_get() + * (gpu_render.h). SDL_Window is forward-declared (SDL typedefs it from this + * same struct tag) so this header needs no SDL include. */ + +#include +#include "gpu_projective_clip.h" + +struct SDL_Window; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Create the GL context on a window made with SDL_WINDOW_OPENGL. + * Returns 1 on success, 0 to fall back to the SDL_Renderer present path. */ +int gl_renderer_init_context(struct SDL_Window *win); +/* Select a retained immutable bank for the next textured submission; zero + * selects live VRAM. Emulation/GL owning thread only. Returns 0 if unavailable. */ +int gl_renderer_select_texture_bank(uint16_t id); +/* Retain texture indices while sampling current guest CLUTs (fades/animation). */ +int gl_renderer_select_texture_bank_live_clut(uint16_t id); +int gl_renderer_texture_banks_supported(void); + +/* Set the GL swap interval / vsync mode (1=vsync, 0=immediate, -1=adaptive). + * Safe before or after context creation; applies live when a context exists. */ +void gl_renderer_set_swap_interval(int interval); + +/* Presentation-only temporal blending. High-refresh sub-presents blend the two + * most recent stable display images on the owning render thread/context; this + * does not generate motion vectors or true intermediate object positions. */ +void gl_renderer_set_interpolation(int enabled, double host_hz, double target_hz, + double source_hz, int blend_mode); +void gl_renderer_set_interpolation_suspended(int suspended); +/* Change only the blend mode (0 linear, 1 change-adaptive, 2 hold), keeping + * the history and schedule; takes effect at the next present. */ +void gl_renderer_set_interpolation_blend(int blend_mode); +/* Blend source: 0 = every guest VBlank is a source frame (default), + * 1 = only real display flips are (psx_mod_set_frame_interpolation_source). */ +void gl_renderer_set_interpolation_source(int source); +void gl_renderer_interpolation_source_diag(int *source, uint32_t *flip_period, + uint64_t *captures, + uint64_t *duplicates); + +/* Render passes (render_pass.c; docs/RENDER_PASSES.md). The presenter is + * ready for passes: GL raster, interpolation live with the FLIP source. */ +int gl_renderer_pass_ready(void); +/* Why not: 0 ready, PSX_MOD_RENDER_PASS_NO_PRESENTER or _BACKEND + * (mod_plugins.h). A backend mode that cannot host passes reports BACKEND. */ +uint32_t gl_renderer_pass_unavailable(void); +/* Debug: make the backend decline passes (PSX_RENDER_PASS_REFUSE=1 at start, + * render_pass_refuse over TCP), as a renderer mode without them would. */ +void gl_renderer_pass_force_refuse(int on); +/* Phases the presenter will show for the frame the next flip displays. */ +uint32_t gl_renderer_pass_plan(uint32_t period_vblanks, + uint32_t shown_after_vblanks, + uint32_t *alpha_q16, uint32_t max, + uint32_t *wanted); +/* Open the VRAM transaction for rect; open_gen first captures the game's own + * image of it as a new generation. reuse_backup: the caller guarantees that + * no guest code ran since the previous pass ended (its restore left VRAM as + * backed up), so the backup of that pass is reused when it covers the same + * rect at the same scale. Returns 0 when refused (nothing changed). */ +int gl_renderer_pass_begin(int x, int y, int w, int h, int open_gen, + uint32_t period_vblanks, int reuse_backup); +/* Generations opened from now on are for a frame already on screen (1) or + * for the next flip (0, default); render_pass_gen_flip_matches. */ +void gl_renderer_pass_set_flip_shown(int shown); +/* Capture the drawn rect at alpha_q16 (keep) and roll the rect back. */ +void gl_renderer_pass_end(uint32_t alpha_q16, int keep); +uint32_t gl_renderer_pass_leaks(void); +int gl_renderer_pass_verify_vram(void); +void gl_renderer_pass_note_cost(uint64_t ticks); +/* Present output deadlines that fell due while guest code ran. */ +void gl_renderer_pass_service_presents(void); +/* promotions, presents, blended presents, expired, unmatched flips, presents + * made between VBlanks, smoothed pass cost (us), images in the shown frame, + * presents past the frame's planned end (the next flip was late; the newest + * image held), stale pass-cost estimates measured again. */ +void gl_renderer_pass_diag(uint64_t out[10]); +/* Out-of-rect VRAM writes journaled and rolled back (lifetime count). */ +uint64_t gl_renderer_pass_journaled(void); +/* Passes that reused the previous pass's VRAM backup (lifetime count). */ +uint64_t gl_renderer_pass_backups_reused(void); +/* Pass image textures allocated now (both generations) and their bytes. */ +uint32_t gl_renderer_pass_image_textures(uint64_t *bytes); +/* Debug: dump the images of the next `generations` shown frames as PNGs. */ +void gl_renderer_pass_dump_arm(const char *dir, int generations); +uint64_t gl_renderer_perf_ticks(void); +uint64_t gl_renderer_perf_frequency(void); +int gl_renderer_interpolation_owns_cadence(void); +void gl_renderer_interpolation_diag(int *enabled, int *suspended, + int *history_frames, + double *host_hz, double *target_hz, + uint64_t *swaps); +/* Cumulative CPU-upload diagnostics: calls, rects, pixels, conversion ticks, + * texture-upload ticks, FBO-draw ticks. Active only with PSX_RUNTIME_PERF_DIAG. */ +void gl_renderer_runtime_diag(uint64_t out[6]); + +/* Present an ARGB8888 image (BGRA byte order) as a letterboxed quad + swap. + * Used for 24-bit (FMV) frames and the PSX_GL_FORCE_CPU_PRESENT diagnostic. + * force_4_3 = pillarbox at native 4:3 even on a wide display aspect (FMVs + * are authored 4:3 and get no GTE squash to compensate the stretch). + * content_w: if 0 < content_w < src_w, only columns [0, content_w) are shown + * (left-aligned in the letterbox; the rest stays cleared black). Used to hide + * a trailing depth24 margin without changing CRTC width / stretching. */ +void gl_renderer_present(const uint32_t *pixels, int src_w, int src_h, int linear, + int force_4_3, int content_w); + +/* Bezel art shown in the letterbox/pillarbox margins. Takes RGBA8 pixels; the + * caller owns them and may free them on return. Passing NULL clears it. + * Returns 0 only if a texture could not be created. */ +int gl_renderer_set_bezel(const void *rgba, int w, int h); +int gl_renderer_has_bezel(void); + +/* Clear to black + swap (display-disabled frame). */ +void gl_renderer_present_blank(void); + +/* §33: re-present the last Live frame captured before Swap (or from a VRAM + * snapshot when interpolation owned the last present). Used during rollback + * resim so the window keeps a wall-clock present cadence without reading + * mid-resim VRAM. Returns 1 if a Swap happened, 0 if no hold is available. */ +int gl_renderer_present_hold_last(void); + +/* Sync the authoritative FBO down to CPU VRAM if the GPU side is ahead (else + * a no-op). Screenshots and the debug server call this before reading CPU + * VRAM. Do NOT use before 24-bit (FMV) scanout — a full readback can clobber + * packed RGB888 MDEC bytes in the CPU mirror (use flush_cpu_uploads instead). */ +void gl_renderer_sync_cpu(void); + +/* Land pending CPU→VRAM uploads into the FBO without reading the FBO back. + * Safe before 24-bit (FMV) CPU scanout of the mirror. */ +void gl_renderer_flush_cpu_uploads(void); + +/* Mark the whole display dirty, drop present-path latches, reset frame- + * interpolation history, and force the next several SwapWindow calls even if + * VRAM tiles match the last present. Call after savestate restore so a + * reloaded identical frame still reaches the window (double/triple buffer). */ +void gl_renderer_invalidate_present(void); + +/* After savestate restore: push the CPU VRAM mirror into the GL FBO. Needed + * when the load happened while GP1 depth24 was on — the normal path skips + * framebuffer-sized uploads, which also skipped the full-VRAM boot_state + * blit and left post-FMV menus without texture pages. */ +void gl_renderer_restage_vram_after_savestate(void); + +/* Netplay dual-raster: every GP0 also writes software VRAM @ 1× (snaps / + * digests / GPUREAD authority) while the OpenGL hr FBO keeps settings-scale + * SSAA for present-only. Never enables glReadPixels; CPU stays current. */ +void gl_renderer_set_cpu_auth_dual(int on); + +/* FMV present reconstruction, settings.toml [video] fmv_filter. Takes the + * config enum VIDEO_FMV_FILTER_* (0 nearest, 1 bilinear, 2 sharp, 3 bicubic). + * Only consulted while video antialiasing is on; AA off is always nearest. */ +void gl_renderer_set_fmv_filter(int cfg_value); +int gl_renderer_cpu_auth_dual(void); + +/* Post-savestate freeze probe: skip/swap/dirty-mark counters (GL present path). + * take() returns deltas since the previous take/reset. Safe no-ops when GL is + * inactive. rect_dirty tests the current present-tile dirty bits. */ +void gl_renderer_present_probe_reset(void); +void gl_renderer_present_probe_take(uint64_t *skip_delta, uint64_t *swap_delta, + uint64_t *dirty_mark_delta, + int *force_remaining); +int gl_renderer_present_rect_dirty(int disp_x, int disp_y, int w, int h); + +/* THE present path for 15-bit frames: blit the display region straight from + * the authoritative VRAM FBO into a letterboxed rect (no readback). + * Deterministic — used for every 15-bit frame. linear = filter on scale. + * force_4_3 pins to native 4:3 (15-bit MDEC FMV frames on a wide aspect). */ +void gl_renderer_present_vram(int disp_x, int disp_y, int w, int h, int linear, + int force_4_3); + +/* GPU-direct native-wide present: blit the displayed buffer's wide FBO (key = + * disp_x) straight to the window, no CPU readback. Returns 0 if no wide surface + * exists for disp_x (caller falls back to the CPU readout path). */ +int gl_renderer_present_wide_fbo(int disp_x, int disp_y, int disp_h, int linear); + +/* Display aspect for the present letterbox (default 4:3). A wide aspect + * stretches the 4:3 frame; pair with gte_set_display_aspect (cpu_state.h) + * for the widescreen field-of-view hack. */ +void gl_renderer_set_display_aspect(int num, int den); + +/* Scanline post-process (host display setting). on toggles the effect; strength + * (0..1) is the depth of the dark gap between PS1 scanlines. Applied at the + * native display-line pitch in the present/interpolation shaders, and faded in + * with output scale so it never shimmers on a sub-2x window. gl_renderer_get_ + * scanlines returns the on flag and (via out-param) the current strength. */ +void gl_renderer_set_scanlines(int on, float strength); +int gl_renderer_get_scanlines(float *strength); + +/* Presentation-only gamma adjustment. gamma = 1.0 is the identity; values + * above 1.0 lift shadow detail and values below 1.0 darken it. The adjustment + * is applied once to game content in the final GL presentation pass, including + * temporal interpolation, but not to the bezel, host OSD, black margins, or an + * already-composed hold-last image. Non-finite and out-of-range values are + * clamped to a safe range. Safe to call before GL context creation. */ +void gl_renderer_set_post_gamma(float gamma); +float gl_renderer_get_post_gamma(void); + +/* Select full native-wide mirror rendering instead of the centre-splice fast + * path. Textured edge expansion needs the complete mirror surface. */ +void gl_renderer_set_wide_fast(int on); + +/* Internal-resolution scale state of the live GL context (0 before init). */ +typedef struct GlScaleInfo { + int requested; /* scale requested before context init (gr_set_scale) */ + int effective; /* scale the hr surface was allocated at */ + int max_scale; /* largest scale this context could allocate */ + int max_dim; /* min(GL_MAX_TEXTURE_SIZE, _RENDERBUFFER_SIZE, _VIEWPORT_DIMS) */ + int clamp_reason; /* PSX_GL_SCALE_* mask (gl_scale_limits.h) */ + int alloc_retries; /* FBO allocations that failed and stepped the scale down */ + int budget_mib; /* memory budget for the hr surface (0 = none) */ + int fbo_w, fbo_h; /* hr surface size in pixels */ + int drawable_w, drawable_h; /* window drawable in pixels */ + /* Windowed high-resolution mode (true 8K on 16384-limit GPUs): the hr + * surface stays at hr_scale (1) and the displayed columns are kept at + * `effective` scale in window_tiles surfaces (more than one when + * side-by-side buffers are too wide for one). window_x/_w/_fbo_* describe + * the tile holding the last presented display. */ + int hr_scale; + int windowed; + int window_x, window_w; + int window_fbo_w, window_fbo_h; + int window_grows; /* tile allocations so far */ + int window_tiles; + int window_mib; /* all tiles */ +} GlScaleInfo; +int gl_renderer_scale_info(GlScaleInfo *out); + +/* Narrow a native-wide display aspect num:den to the widest whose surface + * this context can allocate at its internal scale (psx_gl_fit_wide_aspect; + * disp_w is the display width the margins derive from). Returns 1 when it + * changed num:den; 0, leaving it alone, before init or with no known limit. */ +int gl_renderer_fit_wide_aspect(int disp_w, int *num, int *den); + +/* Read the display rect at internal resolution from the hr FBO: (w*S) x (h*S) + * ARGB8888, top row first. Returns the pixel count, 0 if unavailable or larger + * than cap_px. Debug/verification only (screenshot_hires under GL). */ +int gl_renderer_read_display_hires(int x, int y, int w, int h, uint32_t *out, + int cap_px, int *ow, int *oh); + +void gl_renderer_shutdown(void); + +/* Diagnostics (debug server): read GPU-side VRAM without touching the CPU + * array; report coherency flags + dirty rects. fbo_peek returns 0 when the + * GL pipeline is inactive. */ +int gl_renderer_fbo_peek(int x, int y, int w, int h, uint16_t *out); +void gl_renderer_diag(int *gpu_dirty, int pending[5], int pack[5]); + +/* Always-on coherency event ring (debug server "gl_coh_ring"): every upload + * flush, fill, copy, draw bbox, pack, full readback, present, and probe + * perturbation, with rect + frame. An op that flushes internally records its + * own event AFTER the FLUSH it caused (the event after a FLUSH = trigger). */ +enum { + GL_COH_FLUSH = 1, /* CPU->FBO upload flush (pending box) */ + GL_COH_FILL = 2, /* GP0(02) fill rect */ + GL_COH_COPY_SRC = 3, /* GP0(80) copy, source rect */ + GL_COH_COPY = 4, /* GP0(80) copy, dest rect */ + GL_COH_DRAW = 5, /* drawn prim bbox (clipped to draw area) */ + GL_COH_PACK = 6, /* hr FBO -> raw mirror pack (dirty box) */ + GL_COH_ENSURE = 7, /* full FBO -> CPU VRAM readback */ + GL_COH_PRESENT = 8, /* 15-bit present blit (display rect) */ + GL_COH_UPLOAD = 9, /* bulk CPU->VRAM transfer_in dest rect */ + GL_COH_PEEK = 10, /* gl_fbo_peek probe (perturbs: flushes) */ + GL_COH_DIFF = 11, /* gl_vram_diff probe (perturbs: flushes) */ +}; + +typedef struct { + uint32_t frame; + uint8_t kind; + int16_t x0, y0, x1, y1; /* native VRAM coords, inclusive */ +} GlCohEvent; + +uint64_t gl_renderer_coh_total(void); +/* Fetch event by absolute sequence number; 0 if evicted or out of range. */ +int gl_renderer_coh_get(uint64_t seq, GlCohEvent *out); + +/* Always-on present ring (debug server "gl_present_ring"): EVERY SwapWindow — + * including blank (display-disabled) and CPU-quad presents, which the coherency + * ring does not record — with the path taken, source display rect, letterbox + * dest rect, a glGetError sample, wall-clock ms, and a backbuffer pixel sampled + * at the letterbox centre right before the swap (the ground truth for "did this + * swap present black"). */ +enum { + GL_PRES_VRAM = 0, /* 15-bit FBO blit present (gl_renderer_present_vram) */ + GL_PRES_WIDE = 1, /* native-wide FBO blit present */ + GL_PRES_CPU = 2, /* CPU-readout quad present (24-bit FMV / forced) */ + GL_PRES_BLANK = 3, /* display-disabled black present */ + GL_PRES_INTERP = 4, /* host-refresh interpolation sub-present */ +}; + +typedef struct { + uint32_t frame; /* s_frame_count at swap */ + uint32_t t_ms; /* SDL_GetTicks() at swap */ + uint8_t path; /* GL_PRES_* */ + uint8_t px_r, px_g, px_b; /* backbuffer sample at letterbox centre */ + uint16_t glerr; /* glGetError() drained just before the swap */ + int16_t dx, dy, w, h; /* source display rect (native px; 0 for blank) */ + int16_t lx, ly, lw, lh; /* letterbox dest rect (window px) */ + uint8_t src_r, src_g, src_b, src_valid; /* blit SOURCE (hr FBO) sample + * at the display-rect centre */ +} GlPresEvent; + +uint64_t gl_renderer_pres_total(void); +int gl_renderer_pres_get(uint64_t seq, GlPresEvent *out); + +/* frame_perf: aggregate the per-frame GPU/CPU phase-timing ring (debug server + * "frame_perf"). wide_filter: -1 = all frames, 0 = 4:3 present, 1 = native-wide. + * Fills out[13]: [0]=count, [1]=total_ms avg, [2]=total_ms max, [3]=emu_cpu_ms avg + * (frame minus the present call), [4]=present_wall_ms avg, [5]=scene_gpu_ms avg, + * [6]=scene_gpu_ms max, [7]=present_gpu_ms avg, [8]=present_gpu_ms max, + * [9]=scene primitives/frame avg (pre double-draw), [10]=mirror_gpu_ms avg (of + * scene_gpu, the native-wide mirror passes; GL_TIMESTAMP pairs), [11]=mirror_gpu_ms + * max, [12]=mirror passes/frame avg, [13]=CPU wall in flush_tex_batch avg, + * [14]=CPU wall in glb_wide_* avg, [15]=batches/frame avg, [16]=wide target + * sets/frame avg, [17]=wide FBO creations/frame avg. GPU phases are true + * GL_TIME_ELAPSED times (CPU-overhead independent). Returns the count. */ +int gl_renderer_perf_aggregate(int wide_filter, double out[18]); + +/* Native-wide mirror ablation (perf attribution, debug cmd gl_ws_ablate): + * 0 = normal, 1 = skip the whole mirror pass (incl. wide_clear), 2 = full mirror + * state churn without the draw calls, 3 = mirror draws stay on the hr FBO (no + * per-pass FBO rebind; diagnostic only — corrupts both surfaces' content). */ +void gl_renderer_set_ws_ablate(int mode); +int gl_renderer_get_ws_ablate(void); + +/* Cumulative textured fraction of scene primitives since boot (flat vs textured + * batching decision). Sets *out_tex_frac; returns total prim count. */ +uint64_t gl_renderer_perf_prim_split(double *out_tex_frac); +/* Counts proven projected world triangles admitted past the hardware size + * reject. Diagnostic only; they use the normal canonical and mirror passes. */ +void gl_renderer_note_wide_triangle_recovery(int enabled); +uint64_t gl_renderer_wide_triangle_recovery_count(void); +/* Exact-provenance world polygons only. Returns zero when the GPU context or + * authority policy cannot support clipping; the caller then uses its stock path. */ +int gl_renderer_projective_supported(void); +void gl_renderer_draw_projected_triangle(const PSXProjectedVertex vertices[3], + uint16_t texpage, uint16_t clut_x, uint16_t clut_y, int raw, int semi, + int perspective); +/* Cumulative textured-batch diagnostics: total, then flushes caused by + * isolation, blend-mode, mask, filter, backdrop-gate, texture-window, capacity. */ +void gl_renderer_batch_diag(uint64_t out[8]); + +/* Texture-window batching ([video] texture_window_batching; default off). + * On: textured prims with different GP0(E2h) texture windows share a batch + * (each vertex carries its window), except while mask checking is on. The + * image is the same either way; only the number of draws changes. Safe to + * call before GL context creation. */ +void gl_renderer_set_texture_window_batching(int on); +int gl_renderer_get_texture_window_batching(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_GPU_GL_RENDERER_H */ diff --git a/overlay_toolchain/include/gpu_primitive_reject.h b/overlay_toolchain/include/gpu_primitive_reject.h new file mode 100644 index 00000000..313b0c84 --- /dev/null +++ b/overlay_toolchain/include/gpu_primitive_reject.h @@ -0,0 +1,34 @@ +#ifndef PSX_GPU_PRIMITIVE_REJECT_H +#define PSX_GPU_PRIMITIVE_REJECT_H + +#include + +/* PS1 hardware primitive-size rejection. Parsed coordinates are checked before + * widescreen transforms and draw offsets; offsets do not change distances. + * Quads are tested as their two rendered triangles independently. */ +static inline int psx_gpu_triangle_oversize(const int32_t* vx, + const int32_t* vy, + int a, int b, int c) { + int32_t minx = vx[a], maxx = vx[a]; + if (vx[b] < minx) minx = vx[b]; + if (vx[b] > maxx) maxx = vx[b]; + if (vx[c] < minx) minx = vx[c]; + if (vx[c] > maxx) maxx = vx[c]; + if (maxx - minx > 1023) return 1; + + int32_t miny = vy[a], maxy = vy[a]; + if (vy[b] < miny) miny = vy[b]; + if (vy[b] > maxy) maxy = vy[b]; + if (vy[c] < miny) miny = vy[c]; + if (vy[c] > maxy) maxy = vy[c]; + return maxy - miny > 511; +} + +static inline int psx_gpu_line_oversize(int32_t x0, int32_t y0, + int32_t x1, int32_t y1) { + int32_t dx = x0 > x1 ? x0 - x1 : x1 - x0; + int32_t dy = y0 > y1 ? y0 - y1 : y1 - y0; + return dx > 1023 || dy > 511; +} + +#endif diff --git a/overlay_toolchain/include/gpu_projective_clip.h b/overlay_toolchain/include/gpu_projective_clip.h new file mode 100644 index 00000000..28d6c8c4 --- /dev/null +++ b/overlay_toolchain/include/gpu_projective_clip.h @@ -0,0 +1,52 @@ +#ifndef PSX_GPU_PROJECTIVE_CLIP_H +#define PSX_GPU_PROJECTIVE_CLIP_H + +/* Clip before dividing by signed camera depth. Attributes follow the same + * edge parameter, so clipped triangles retain their original texture plane. */ +typedef struct PSXProjectedVertex { + double x, y, z, u, v, r, g, b; +} PSXProjectedVertex; + +static inline PSXProjectedVertex psx_projective_lerp( + PSXProjectedVertex a, PSXProjectedVertex b, double t) { + PSXProjectedVertex p; +#define LERP(f) p.f = a.f + (b.f-a.f)*t + LERP(x); LERP(y); LERP(z); LERP(u); LERP(v); + LERP(r); LERP(g); LERP(b); +#undef LERP + return p; +} +static inline double psx_projective_distance(PSXProjectedVertex p, int plane, + double left, double right, double top, double bottom) { + switch (plane) { + case 0: return p.z - 1.0; + case 1: return p.x - left*p.z; + case 2: return right*p.z - p.x; + case 3: return p.y - top*p.z; + default: return bottom*p.z - p.y; + } +} +static inline int psx_projective_clip_triangle(const PSXProjectedVertex in[3], + PSXProjectedVertex out[12], double left, double right, double top, double bottom) { + PSXProjectedVertex a[12], b[12]; + int n=3; + for (int i=0;i<3;++i) a[i]=in[i]; + for (int plane=0;plane<5 && n;++plane) { + int m=0; + PSXProjectedVertex prev=a[n-1]; + double dp=psx_projective_distance(prev,plane,left,right,top,bottom); + for (int i=0;i=0)!=(dc>=0)) + b[m++]=psx_projective_lerp(prev,cur,dp/(dp-dc)); + if (dc>=0) b[m++]=cur; + prev=cur; dp=dc; + } + n=m; + for (int i=0;i + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + GR_BACKEND_SOFTWARE = 0, + GR_BACKEND_OPENGL = 1, + GR_BACKEND_VULKAN = 2 +} GrBackend; + +void gr_set_backend(GrBackend backend); /* call before gr_init() */ +GrBackend gr_backend(void); /* effective backend after init */ + +/* Lifecycle / global state */ +void gr_init(uint16_t *vram); +void gr_set_scale(int scale); +int gr_scale(void); + +/* Compile-time ceiling for the OpenGL backend's internal-resolution scale. The + * effective scale is decided at GL context init from the driver's size limits + * and a memory budget (gl_scale_limits.h), so this is only an upper bound. + * Software and Vulkan stay at SW_MAX_INTERNAL_SCALE (4). */ +#define GL_MAX_INTERNAL_SCALE 32 +void gr_set_texture_filter(int bilinear); +int gr_texture_filter(void); + +/* Per-primitive draw state */ +void gr_set_semi_transparency(int enabled, int mode); +void gr_set_mask_bits(int set_bit, int check_bit); +void gr_set_texture_window(uint32_t raw); +void gr_set_color_modulation(int r, int g, int b, int raw_texture); + +/* Sub-pixel vertex override for the NEXT triangle ([video] geometry_correction). + * x/y are signed 16.16 screen coordinates carrying the projection fraction the + * GTE discarded; the integer positions still passed to gr_draw_*_triangle + * remain authoritative for anything that must stay faithful (dirty-rect + * tracking, the software path's native VRAM write). enabled == 0 clears the + * override. Backends that do not implement it ignore the call, so the integer + * path is what they draw. The override is consumed by the next triangle. */ +void gr_set_precise_triangle(int enabled, + int32_t x0, int32_t y0, + int32_t x1, int32_t y1, + int32_t x2, int32_t y2); +/* Perspective-correct UV weights for the NEXT triangle ([video] + * perspective_texturing). q[i] is the normalized 1/z homogeneous weight at + * vertex i. enabled == 0 restores the PS1's affine UV interpolation. */ +void gr_set_perspective_triangle(int enabled, float q0, float q1, float q2); + +/* Primitives */ +void gr_fill_rect(int x, int y, int w, int h, uint16_t color); +void gr_copy_rect(int src_x, int src_y, int dst_x, int dst_y, int w, int h); +void gr_draw_flat_triangle(int x0, int y0, int x1, int y1, int x2, int y2, + uint16_t color); +void gr_draw_gouraud_triangle(int x0, int y0, uint16_t c0, + int x1, int y1, uint16_t c1, + int x2, int y2, uint16_t c2); +void gr_draw_textured_triangle(int x0, int y0, int u0, int v0, + int x1, int y1, int u1, int v1, + int x2, int y2, int u2, int v2, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage); +void gr_draw_shaded_textured_triangle(int x0, int y0, int u0, int v0, + uint32_t color0, + int x1, int y1, int u1, int v1, + uint32_t color1, + int x2, int y2, int u2, int v2, + uint32_t color2, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage, int raw_texture); +void gr_draw_flat_rect(int x, int y, int w, int h, uint16_t color); +void gr_draw_textured_rect(int x, int y, int w, int h, + int u, int v, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage); +void gr_draw_textured_rect_scaled(int x, int y, int w, int h, + int u0, int v0, int u1, int v1, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage); +void gr_draw_line(int x0, int y0, int x1, int y1, uint16_t color); +void gr_draw_shaded_line(int x0, int y0, uint16_t c0, + int x1, int y1, uint16_t c1); + +/* Display readout (present path) */ +int gr_render_display(uint32_t *out_pixels, int out_pitch, + int disp_x, int disp_y, int disp_w, int disp_h); +int gr_render_display_hires(uint32_t *out_pixels, int out_pitch, + int disp_x, int disp_y, int disp_w, int disp_h); + +/* VRAM transfers */ +void gr_vram_write(int x, int y, uint16_t pixel); +uint16_t gr_vram_read(int x, int y); +void gr_vram_transfer_in(int x, int y, int w, int h, const uint16_t *data); +void gr_vram_transfer_out(int x, int y, int w, int h, uint16_t *data); + +/* Draw area / offset */ +void gr_set_draw_area(int x1, int y1, int x2, int y2); +void gr_get_draw_area(int *x1, int *y1, int *x2, int *y2); +void gr_set_draw_offset(int x, int y); + +/* Native-wide compositor. gr_wide_supported() reports whether the active + * backend implements it; if not, the others are no-ops and the caller keeps + * the canonical present path. */ +int gr_wide_supported(void); +void gr_wide_configure(int wide_w, int offset); +/* Presentation-only origin and padding, independent of the symmetric budget. + * enabled also forbids reusing the canonical center: HUD and world may use + * different origins. Backends must flush queued draws before changing this. */ +void gr_wide_set_view(int enabled, int shift, int pad_left, int pad_right); +void gr_wide_set_target(int base_x); +void gr_wide_disable_target(void); +void gr_wide_clear(int base_x, int y, int h, uint16_t color); +/* sides: bit 0 = left synthetic margin, bit 1 = right. */ +void gr_wide_clear_margins(int base_x, int y, int h, uint16_t color, int sides); +int gr_wide_dump_full(uint32_t *out, int cap_pixels, int *ow, int *oh, int base_x); +int gr_render_wide_display(uint32_t *out, int pitch, int base_x, + int disp_y, int disp_h); + +/* ---- Backend vtable ----------------------------------------------------- + * A backend supplies the same set of functions. gpu_gl_renderer.c (Phase 2) + * provides gl_backend_get(); until it does, requesting OpenGL falls back to + * software. Members mirror the gr_* / sw_* signatures 1:1. */ +typedef struct GpuRenderBackend { + const char *name; + void (*init)(uint16_t *vram); + void (*set_scale)(int scale); + int (*scale)(void); + void (*set_texture_filter)(int bilinear); + int (*texture_filter)(void); + void (*set_semi_transparency)(int enabled, int mode); + void (*set_mask_bits)(int set_bit, int check_bit); + void (*set_texture_window)(uint32_t raw); + void (*set_color_modulation)(int r, int g, int b, int raw_texture); + /* Optional (NULL = unsupported, facade no-ops): sub-pixel vertex override + * and perspective UV weights for the next triangle. See gr_* above. */ + void (*set_precise_triangle)(int enabled, + int32_t x0, int32_t y0, + int32_t x1, int32_t y1, + int32_t x2, int32_t y2); + void (*set_perspective_triangle)(int enabled, float q0, float q1, float q2); + void (*fill_rect)(int x, int y, int w, int h, uint16_t color); + void (*copy_rect)(int src_x, int src_y, int dst_x, int dst_y, int w, int h); + void (*draw_flat_triangle)(int x0, int y0, int x1, int y1, int x2, int y2, + uint16_t color); + void (*draw_gouraud_triangle)(int x0, int y0, uint16_t c0, + int x1, int y1, uint16_t c1, + int x2, int y2, uint16_t c2); + void (*draw_textured_triangle)(int x0, int y0, int u0, int v0, + int x1, int y1, int u1, int v1, + int x2, int y2, int u2, int v2, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage); + void (*draw_shaded_textured_triangle)(int x0, int y0, int u0, int v0, + uint32_t color0, + int x1, int y1, int u1, int v1, + uint32_t color1, + int x2, int y2, int u2, int v2, + uint32_t color2, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage, int raw_texture); + void (*draw_flat_rect)(int x, int y, int w, int h, uint16_t color); + void (*draw_textured_rect)(int x, int y, int w, int h, int u, int v, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage); + void (*draw_textured_rect_scaled)(int x, int y, int w, int h, + int u0, int v0, int u1, int v1, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage); + void (*draw_line)(int x0, int y0, int x1, int y1, uint16_t color); + void (*draw_shaded_line)(int x0, int y0, uint16_t c0, + int x1, int y1, uint16_t c1); + int (*render_display)(uint32_t *out, int pitch, + int dx, int dy, int dw, int dh); + int (*render_display_hires)(uint32_t *out, int pitch, + int dx, int dy, int dw, int dh); + void (*vram_write)(int x, int y, uint16_t pixel); + uint16_t (*vram_read)(int x, int y); + void (*vram_transfer_in)(int x, int y, int w, int h, const uint16_t *data); + void (*vram_transfer_out)(int x, int y, int w, int h, uint16_t *data); + void (*set_draw_area)(int x1, int y1, int x2, int y2); + void (*get_draw_area)(int *x1, int *y1, int *x2, int *y2); + void (*set_draw_offset)(int x, int y); + /* Native-wide compositor (optional; NULL on backends without it — the + * facade then reports gr_wide_supported() == 0 and the caller keeps the + * canonical present). */ + void (*wide_configure)(int wide_w, int offset); + void (*wide_set_view)(int enabled, int shift, int pad_left, int pad_right); + void (*wide_set_target)(int base_x); + void (*wide_disable_target)(void); + void (*wide_clear)(int base_x, int y, int h, uint16_t color); + void (*wide_clear_margins)(int base_x, int y, int h, uint16_t color, int sides); + int (*render_wide_display)(uint32_t *out, int pitch, int base_x, + int disp_y, int disp_h); + /* Dump the ENTIRE wide compositor surface for base_x (all double-buffer + * bands + both margins), g_wide_w x VRAM_H. Debug/inspection only; returns + * pixel count, writes width/height to ow/oh. NULL if unsupported. */ + int (*wide_dump_full)(uint32_t *out, int cap_pixels, int *ow, int *oh, + int base_x); +} GpuRenderBackend; + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_GPU_RENDER_H */ diff --git a/overlay_toolchain/include/gpu_sw_renderer.h b/overlay_toolchain/include/gpu_sw_renderer.h new file mode 100644 index 00000000..211c2e5c --- /dev/null +++ b/overlay_toolchain/include/gpu_sw_renderer.h @@ -0,0 +1,131 @@ +#ifndef PSX_GPU_SW_RENDERER_H +#define PSX_GPU_SW_RENDERER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Maximum internal-resolution supersampling factor (linear, per axis). */ +#define SW_MAX_INTERNAL_SCALE 4 + +/* Initialize software renderer */ +void sw_renderer_init(uint16_t* vram); + +/* Internal-resolution supersampling (SSAA). + * scale == 1 : disabled, renderer behaves exactly as native VRAM only. + * scale > 1 : maintain an S*-scaled mirror of VRAM; the display reads the + * mirror (sw_render_display_hires) and the present path + * downsamples to the window. Clamped to SW_MAX_INTERNAL_SCALE. + * Must be called once after sw_renderer_init, before drawing begins. */ +void sw_renderer_set_scale(int scale); +int sw_renderer_scale(void); + +/* Visual-only high-resolution vertex override for the next triangle. Values + * are signed 16.16 screen coordinates; native VRAM still uses the integer GP0 + * positions, while the supersampled mirror consumes these fractions. */ +void sw_set_precise_triangle(int enabled, + int32_t x0, int32_t y0, + int32_t x1, int32_t y1, + int32_t x2, int32_t y2); + +/* Perspective-correct UV override for the next triangle. q values are the + * homogeneous interpolation weights associated with each screen vertex. */ +void sw_set_perspective_triangle(int enabled, + float q0, float q1, float q2); +uint32_t sw_perspective_triangle_count(void); + +/* Texture filtering. 0 = nearest (native PSX look, default), 1 = bilinear + * (smooths textures/2D backgrounds; blends in RGB after the CLUT lookup, + * transparency-aware). Independent of supersampling. */ +void sw_set_texture_filter(int bilinear); +int sw_texture_filter(void); + +/* Draw state — must be set by gpu.c before each primitive */ +void sw_set_semi_transparency(int enabled, int mode); +void sw_set_mask_bits(int set_bit, int check_bit); +void sw_set_texture_window(uint32_t raw); +void sw_set_color_modulation(int r, int g, int b, int raw_texture); + +/* Drawing primitives — called from gpu.c command processing */ +void sw_fill_rect(int x, int y, int w, int h, uint16_t color); +void sw_copy_rect(int src_x, int src_y, int dst_x, int dst_y, int w, int h); +void sw_draw_flat_triangle(int x0, int y0, int x1, int y1, int x2, int y2, + uint16_t color); +void sw_draw_gouraud_triangle(int x0, int y0, uint16_t c0, + int x1, int y1, uint16_t c1, + int x2, int y2, uint16_t c2); +void sw_draw_textured_triangle(int x0, int y0, int u0, int v0, + int x1, int y1, int u1, int v1, + int x2, int y2, int u2, int v2, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage); +void sw_draw_shaded_textured_triangle(int x0, int y0, int u0, int v0, + uint32_t color0, + int x1, int y1, int u1, int v1, + uint32_t color1, + int x2, int y2, int u2, int v2, + uint32_t color2, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage, int raw_texture); +void sw_draw_flat_rect(int x, int y, int w, int h, uint16_t color); +void sw_draw_textured_rect(int x, int y, int w, int h, + int u, int v, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage); +void sw_draw_textured_rect_scaled(int x, int y, int w, int h, + int u0, int v0, int u1, int v1, + uint16_t clut_x, uint16_t clut_y, + uint16_t texpage); +void sw_draw_line(int x0, int y0, int x1, int y1, uint16_t color); +void sw_draw_shaded_line(int x0, int y0, uint16_t c0, + int x1, int y1, uint16_t c1); + +/* Copy display region to a 32-bit RGBA buffer for SDL presentation. + Returns number of pixels written. */ +int sw_render_display(uint32_t* out_pixels, int out_pitch, + int disp_x, int disp_y, int disp_w, int disp_h); + +/* Like sw_render_display, but reads the hi-res mirror and emits the region + at (disp_w*scale x disp_h*scale). Falls back to sw_render_display when + supersampling is disabled. Returns number of pixels written. */ +int sw_render_display_hires(uint32_t* out_pixels, int out_pitch, + int disp_x, int disp_y, int disp_w, int disp_h); + +/* VRAM transfer (CPU->VRAM, VRAM->CPU) */ +void sw_vram_write(int x, int y, uint16_t pixel); +uint16_t sw_vram_read(int x, int y); +void sw_vram_transfer_in(int x, int y, int w, int h, const uint16_t* data); +void sw_vram_transfer_out(int x, int y, int w, int h, uint16_t* data); + +/* Set draw area and draw offset */ +void sw_set_draw_area(int x1, int y1, int x2, int y2); +void sw_get_draw_area(int *x1, int *y1, int *x2, int *y2); +void sw_set_draw_offset(int x, int y); + +/* Native-wide compositor (see gpu_sw_renderer.c). Canonical VRAM stays faithful; + * framebuffer draws are mirrored into independent wide surfaces keyed by buffer + * base_x. wide_w<=0 disables. set_target selects/clears the mirror per back + * buffer; render_wide_display is the present source for the displayed buffer. */ +void sw_wide_configure(int wide_w, int offset); +void sw_wide_set_view(int enabled, int shift, int pad_left, int pad_right); +void sw_wide_set_target(int base_x); +void sw_wide_disable_target(void); +void sw_wide_clear(int base_x, int y, int h, uint16_t color); +void sw_wide_clear_margins(int base_x, int y, int h, uint16_t color, int sides); +/* MMX6 native-wide reveal-column tile: rasterize a 16x16 textured tile into the + * wide surface ONLY (canonical VRAM + hi-res mirror untouched). See definition. */ +void sw_wide_emit_tile(int band_y, int x, int y, int u, int v, + uint16_t clut_x, uint16_t clut_y, uint16_t texpage, + uint32_t color24, int semi_trans, int semi_mode, int raw_texture); +int sw_render_wide_display(uint32_t* out_pixels, int out_pitch, int base_x, + int disp_y, int disp_h); +int sw_wide_dump_full(uint32_t* out, int cap_pixels, int* ow, int* oh, int base_x); +int sw_wide_width(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_GPU_SW_RENDERER_H */ diff --git a/overlay_toolchain/include/gpu_timeline.h b/overlay_toolchain/include/gpu_timeline.h new file mode 100644 index 00000000..e18f1b5d --- /dev/null +++ b/overlay_toolchain/include/gpu_timeline.h @@ -0,0 +1,52 @@ +#ifndef PSXRECOMP_GPU_TIMELINE_H +#define PSXRECOMP_GPU_TIMELINE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPU frame timeline: an always-on, guest-cycle-stamped record of the events + * that decide WHAT a present shows — vblank, display-start flips, draw-area + * changes, GPU linked-list DMA start/end, and each present (swapped or + * skipped). The GP0, display and presented-image rings are all tagged by + * frame number only, which cannot order a present against a draw inside the + * same frame; this ring can. Frozen by the capture mark. */ +#define GPU_TIMELINE_CAP 32768u /* power of two; ~40 s at typical rates */ + +typedef enum { + GTL_VBLANK = 1, /* a = lcf after toggle */ + GTL_DISP_START = 2, /* a = x, b = y (GP1 05h) */ + GTL_DRAW_AREA = 3, /* a = left, b = top (GP0 E3h) */ + GTL_LL_START = 4, /* a = OT start address */ + GTL_LL_END = 5, /* a = nodes, b = words */ + GTL_PRESENT = 6, /* a = path, b = disp_x | disp_y << 16 */ + GTL_PRESENT_SKIP = 7, /* a = path, b = disp_x | disp_y << 16 (no swap) */ + GTL_DISP_CAPTURE = 8, /* display-ring capture; b = disp_x | disp_y << 16 */ + GTL_FILL = 9, /* a = x | y << 16, b = w | h << 16 (GP0 02h) */ +} GpuTimelineKind; + +/* Present paths recorded in GTL_PRESENT/GTL_PRESENT_SKIP `a`. */ +enum { GTL_PATH_WIDE_FBO = 1, GTL_PATH_VRAM_FBO = 2, GTL_PATH_CPU = 3, + GTL_PATH_HOLD = 4 }; + +typedef struct { + uint64_t cyc; /* psx_cycle_count */ + uint32_t frame; /* s_frame_count */ + uint32_t a, b; + uint8_t kind; + uint8_t pad[3]; +} GpuTimelineEntry; + +void gpu_timeline_note(uint8_t kind, uint32_t a, uint32_t b); +void gpu_timeline_set_frozen(int frozen); +uint64_t gpu_timeline_total(void); +int gpu_timeline_get(uint64_t seq, GpuTimelineEntry *out); +const char *gpu_timeline_kind_name(uint8_t kind); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/gpu_vk_renderer.h b/overlay_toolchain/include/gpu_vk_renderer.h new file mode 100644 index 00000000..7b09ea66 --- /dev/null +++ b/overlay_toolchain/include/gpu_vk_renderer.h @@ -0,0 +1,61 @@ +#ifndef PSX_GPU_VK_RENDERER_H +#define PSX_GPU_VK_RENDERER_H + +/* gpu_vk_renderer.c — hardware Vulkan renderer backend. + * + * Selected via [video] renderer = "vulkan". Like the GL backend it is + * GPU-authoritative: VRAM lives as a Vulkan image and present blits straight + * from it to the swapchain (no per-frame readback). Vulkan is loaded ENTIRELY + * at runtime through SDL_Vulkan_LoadLibrary + vkGetInstanceProcAddr, so the exe + * has no link-time vulkan-1 dependency and gracefully falls back to software on + * a machine without a Vulkan ICD. + * + * The backend supplies its vtable through vk_backend_get() (NULL until a context + * is created and the pipeline is ready). */ + +struct SDL_Window; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Create the Vulkan instance/device/swapchain on a window made with + * SDL_WINDOW_VULKAN. Returns 1 on success, 0 to fall back to software. */ +int vk_renderer_init_context(struct SDL_Window *win); + +/* Tear down all Vulkan objects (idempotent). */ +void vk_renderer_shutdown(void); + +/* Present the displayed VRAM region straight from the GPU VRAM image to the + * swapchain (15-bit frames; deterministic, no readback). Returns 1 on success, + * 0 if the Vulkan path is inactive (caller keeps the CPU present path). */ +int vk_renderer_present_vram(int disp_x, int disp_y, int w, int h, + int linear, int force_4_3); + +/* GPU-direct native-wide present (mirrors gl_renderer_present_wide_fbo). */ +int vk_renderer_present_wide(int disp_x, int disp_y, int disp_h, int linear); + +/* Present an ARGB8888 image as a letterboxed quad (24-bit FMV frames and the + * display-disabled clear). force_4_3 pillarboxes at native 4:3. */ +void vk_renderer_present_cpu(const uint32_t *pixels, int src_w, int src_h, + int linear, int force_4_3); +void vk_renderer_present_blank(void); + +/* Sync the GPU VRAM image down into the CPU VRAM mirror (screenshots, debug + * server, 24-bit present). No-op when the Vulkan path is inactive. */ +void vk_renderer_sync_cpu(void); + +/* After savestate restore: push CPU VRAM into the Vulkan image (see GL twin). */ +void vk_renderer_restage_vram_after_savestate(void); + +/* Set the present policy: 1=tear-free, 0=IMMEDIATE (lowest latency, may tear), + * -1=MAILBOX. Tear-free prefers MAILBOX because the frontend already paces + * frames; unsupported modes fall back to FIFO (always available). */ +void vk_renderer_set_present_mode(int mode); +void vk_renderer_set_display_aspect(int num, int den); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_GPU_VK_RENDERER_H */ diff --git a/overlay_toolchain/include/gpu_vram_dirty.h b/overlay_toolchain/include/gpu_vram_dirty.h new file mode 100644 index 00000000..d34b15b5 --- /dev/null +++ b/overlay_toolchain/include/gpu_vram_dirty.h @@ -0,0 +1,64 @@ +#ifndef PSX_GPU_VRAM_DIRTY_H +#define PSX_GPU_VRAM_DIRTY_H + +/* + * Per-scanline dirty tracking for the 1024×512 CPU VRAM mirror. + * + * Enabled only while rollback netplay is live (psx_netplay_rb_start → + * shutdown). Offline / delay-sync: g_psx_vram_dirty_tracking stays 0 so + * mark_* is an inlined no-op (expect-not-taken). Used by raw ring snaps + * (§96) and as the foundation for Tier-2 dirty-region digests. + * + * A missed mark (while tracking) is silent corruption — bring-up can enable + * shadow-verify via PSX_NET_VRAM_DIRTY_VERIFY=1. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define GPU_VRAM_DIRTY_H 512u +#define GPU_VRAM_DIRTY_W 1024u + +/* 0 offline / delay-sync; 1 after psx_netplay_rb_start. */ +extern int g_psx_vram_dirty_tracking; + +void gpu_vram_dirty_set_tracking(int on); +int gpu_vram_dirty_tracking(void); + +void gpu_vram_dirty_mark_row_impl(uint32_t y); +void gpu_vram_dirty_mark_rows(uint32_t y0, uint32_t h); +void gpu_vram_dirty_mark_rect(int x, int y, int w, int h); +void gpu_vram_dirty_mark_all(void); +void gpu_vram_dirty_clear(void); + +int gpu_vram_dirty_any(void); +uint32_t gpu_vram_dirty_row_count(void); +/* 512-bit mask: bit y set ⇒ scanline y dirty. Non-owning. */ +const uint64_t *gpu_vram_dirty_mask(void); + +/* 1 if PSX_NET_VRAM_DIRTY_VERIFY is set (non-zero). */ +int gpu_vram_dirty_verify_enabled(void); + +#if defined(__GNUC__) || defined(__clang__) +# define GPU_VRAM_DIRTY_TRACKING_ON() \ + (__builtin_expect(g_psx_vram_dirty_tracking, 0)) +#else +# define GPU_VRAM_DIRTY_TRACKING_ON() (g_psx_vram_dirty_tracking) +#endif + +/* Hot path: offline compiles to load + not-taken branch, no call. */ +static inline void gpu_vram_dirty_mark_row(uint32_t y) +{ + if (!GPU_VRAM_DIRTY_TRACKING_ON()) + return; + gpu_vram_dirty_mark_row_impl(y); +} + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_GPU_VRAM_DIRTY_H */ diff --git a/overlay_toolchain/include/gte.h b/overlay_toolchain/include/gte.h new file mode 100644 index 00000000..06d6a79f --- /dev/null +++ b/overlay_toolchain/include/gte.h @@ -0,0 +1,178 @@ +#pragma once + +#include +#include + +namespace PSXRecomp { +namespace GTE { + +// PSX GTE FLAG register bit definitions +// Bit 31: Error summary (set if any of bits 30-23 or 18-13 are set) +// Bits 30-25: MAC1/2/3 positive/negative overflow (>43 bits) +// Bits 24-22: IR1/2/3 saturated +// Bits 21-19: Color R/G/B saturated +// Bit 18: SZ3/OTZ saturated +// Bit 17: Divide overflow +// Bit 16: MAC0 positive overflow +// Bit 15: MAC0 negative overflow +// Bits 14-13: SX2/SY2 saturated +// Bit 12: IR0 saturated +enum GTEFlags : uint32_t { + FLAG_MAC1_POS = 1u << 30, FLAG_MAC2_POS = 1u << 29, FLAG_MAC3_POS = 1u << 28, + FLAG_MAC1_NEG = 1u << 27, FLAG_MAC2_NEG = 1u << 26, FLAG_MAC3_NEG = 1u << 25, + FLAG_IR1_SAT = 1u << 24, FLAG_IR2_SAT = 1u << 23, FLAG_IR3_SAT = 1u << 22, + FLAG_COLOR_R = 1u << 21, FLAG_COLOR_G = 1u << 20, FLAG_COLOR_B = 1u << 19, + FLAG_SZ3_OTZ = 1u << 18, FLAG_DIV_OVF = 1u << 17, + FLAG_MAC0_POS = 1u << 16, FLAG_MAC0_NEG = 1u << 15, + FLAG_SX2_SAT = 1u << 14, FLAG_SY2_SAT = 1u << 13, + FLAG_IR0_SAT = 1u << 12, + FLAG_ERROR_MASK = 0x7F87E000u, + FLAG_ERROR_BIT = 0x80000000u, +}; + +struct GTEState { + // === Data Registers === + int16_t V0[3], V1[3], V2[3]; // Vertex vectors (s3.12) + int32_t SXY[4]; // Screen XY FIFO (packed: X low16, Y high16) + uint16_t SZ[4]; // Screen Z FIFO (unsigned 16-bit) + uint32_t RGBC; // Current input color/code register + uint32_t RGB[3]; // RGB color FIFO (RGB0..RGB2) + uint32_t RES1; // Undocumented read/write data register 23 + + // === Control Registers (matrices, vectors, config) === + int16_t RT[3][3]; // Rotation matrix (s3.12) + int32_t TR[3]; // Translation vector (32-bit) + int16_t L[3][3]; // Light source direction matrix (s3.12) + int32_t BK[3]; // Background color (32-bit) + int16_t LC[3][3]; // Light color matrix (s3.12) — replaces LR/LG/LB + int32_t FC[3]; // Far color (32-bit) + int32_t OFX, OFY; // Screen offset (s15.16) + uint16_t H; // Projection plane distance (unsigned 16-bit) + int16_t DQA; // Depth queing coefficient A (signed 16-bit) + int32_t DQB; // Depth queing coefficient B (signed 32-bit!) + int16_t ZSF3, ZSF4; // Z-scale factors (signed 16-bit) + + // === Intermediate/Result Registers === + int16_t IR0, IR1, IR2, IR3; // Intermediate results (signed 16-bit) + int32_t MAC0, MAC1, MAC2, MAC3; // Multiply-accumulate results (32-bit) + uint16_t OTZ; // Ordering table Z (unsigned 16-bit) + int32_t LZCS; // Leading zero count source (32-bit) + int32_t LZCR; // Leading zero count result (32-bit) + + // === Flag Register === + uint32_t FLAG; + + GTEState() { std::memset(this, 0, sizeof(GTEState)); } + + // --- Saturation helpers --- + + int16_t saturate_ir(int32_t value, int ir_num, bool lm = false) { + int32_t min_val = lm ? 0 : -0x8000; + if (value < min_val) { + FLAG |= (1u << (25 - ir_num)); // IR1=24, IR2=23, IR3=22 + return static_cast(min_val); + } + if (value > 0x7FFF) { + FLAG |= (1u << (25 - ir_num)); + return 0x7FFF; + } + return static_cast(value); + } + + int16_t saturate_ir0(int32_t value) { + if (value < 0) { FLAG |= FLAG_IR0_SAT; return 0; } + if (value > 0x1000) { FLAG |= FLAG_IR0_SAT; return 0x1000; } + return static_cast(value); + } + + uint8_t saturate_color(int32_t value, int component) { + if (value < 0) { FLAG |= (1u << (21 - component)); return 0; } + if (value > 255) { FLAG |= (1u << (21 - component)); return 255; } + return static_cast(value); + } + + uint16_t saturate_sz(int32_t value) { + if (value < 0) { FLAG |= FLAG_SZ3_OTZ; return 0; } + if (value > 0xFFFF) { FLAG |= FLAG_SZ3_OTZ; return 0xFFFF; } + return static_cast(value); + } + + void check_mac_overflow(int64_t value, int mac_num) { + // mac_num: 1,2,3 + if (value > 0x7FFFFFFFFFFLL) FLAG |= (1u << (31 - mac_num)); // MAC1=30, MAC2=29, MAC3=28 + if (value < -0x80000000000LL) FLAG |= (1u << (28 - mac_num)); // MAC1=27, MAC2=26, MAC3=25 + } + + void check_mac0_overflow(int64_t value) { + if (value > 0x7FFFFFFFLL) FLAG |= FLAG_MAC0_POS; + if (value < -0x80000000LL) FLAG |= FLAG_MAC0_NEG; + } + + void push_sxy(int64_t sx, int64_t sy) { + // Saturate to screen coordinates and set flags + int16_t sx_sat, sy_sat; + if (sx < -0x400) { sx_sat = -0x400; FLAG |= FLAG_SX2_SAT; } + else if (sx > 0x3FF) { sx_sat = 0x3FF; FLAG |= FLAG_SX2_SAT; } + else { sx_sat = static_cast(sx); } + if (sy < -0x400) { sy_sat = -0x400; FLAG |= FLAG_SY2_SAT; } + else if (sy > 0x3FF) { sy_sat = 0x3FF; FLAG |= FLAG_SY2_SAT; } + else { sy_sat = static_cast(sy); } + // Push FIFO + SXY[0] = SXY[1]; SXY[1] = SXY[2]; + SXY[2] = (static_cast(sy_sat & 0xFFFF) << 16) | + (static_cast(sx_sat & 0xFFFF)); + SXY[3] = SXY[2]; + } + + void push_sz(int32_t value) { + SZ[0] = SZ[1]; SZ[1] = SZ[2]; SZ[2] = SZ[3]; + SZ[3] = saturate_sz(value); + } + + void push_rgb(uint8_t r, uint8_t g, uint8_t b) { + uint8_t cd = (RGBC >> 24) & 0xFF; // Code byte from RGBC + RGB[0] = RGB[1]; RGB[1] = RGB[2]; + RGB[2] = (cd << 24) | (b << 16) | (g << 8) | r; + } + + void set_error_flag() { + if (FLAG & FLAG_ERROR_MASK) FLAG |= FLAG_ERROR_BIT; + } +}; + +// === GTE Operations === +void gte_rtps_internal(GTEState* gte, int16_t* V, bool setMac0, uint32_t instr = 0x0180001u); +void gte_rtps(GTEState* gte, uint32_t instr); +void gte_rtpt(GTEState* gte, uint32_t instr); +void gte_nclip(GTEState* gte, uint32_t instr); +void gte_avsz3(GTEState* gte, uint32_t instr); +void gte_avsz4(GTEState* gte, uint32_t instr); +void gte_nccs_internal(GTEState* gte, int16_t* V); +void gte_nccs(GTEState* gte, uint32_t instr); +void gte_ncct(GTEState* gte, uint32_t instr); +void gte_ncds_internal(GTEState* gte, int16_t* V); +void gte_ncds(GTEState* gte, uint32_t instr); +void gte_ncdt(GTEState* gte, uint32_t instr); +void gte_ncs_internal(GTEState* gte, int16_t* V); +void gte_ncs(GTEState* gte, uint32_t instr); +void gte_nct(GTEState* gte, uint32_t instr); +void gte_dpcs(GTEState* gte, uint32_t instr); +void gte_dpct(GTEState* gte, uint32_t instr); +void gte_dpcl(GTEState* gte, uint32_t instr); +void gte_intpl(GTEState* gte, uint32_t instr); +void gte_cdp(GTEState* gte, uint32_t instr); +void gte_cc(GTEState* gte, uint32_t instr); +void gte_mvmva(GTEState* gte, uint32_t instr); +void gte_op(GTEState* gte, uint32_t instr); +void gte_sqr(GTEState* gte, uint32_t instr); +void gte_gpf(GTEState* gte, uint32_t instr); +void gte_gpl(GTEState* gte, uint32_t instr); + +// Register transfer +void gte_mtc2(GTEState* gte, uint8_t reg, uint32_t value); +uint32_t gte_mfc2(GTEState* gte, uint8_t reg); +void gte_ctc2(GTEState* gte, uint8_t reg, uint32_t value); +uint32_t gte_cfc2(GTEState* gte, uint8_t reg); + +} // namespace GTE +} // namespace PSXRecomp diff --git a/overlay_toolchain/include/gte_nclip_stats.h b/overlay_toolchain/include/gte_nclip_stats.h new file mode 100644 index 00000000..2812f5b6 --- /dev/null +++ b/overlay_toolchain/include/gte_nclip_stats.h @@ -0,0 +1,60 @@ +#ifndef PSXRECOMP_GTE_NCLIP_STATS_H +#define PSXRECOMP_GTE_NCLIP_STATS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Precise-NCLIP observability (widescreen). While [widescreen] precise_nclip + * is active, every NCLIP also computes the backface sign from the UNCLAMPED + * projection (the PGXP sub-pixel shadow, validated against each SXY word; + * precise_nclip arms that transport by itself, independent of the visual + * corrections). Guest MAC0 stays native; only configured branch sites + * ([widescreen.cull] nclip_exact_sites) consume the precise sign. + * + * Always-on tables, keyed by the last guest store PC before each NCLIP (a + * producer locator inside the issuing emitter) and by branch PC (exact-site + * consumers), so a title can find which emitters + * lose triangles to the +/-1024 screen clamp before listing any site. */ + +typedef struct { + uint32_t func; /* locator: last guest store PC before the NCLIP */ + uint32_t nclips; /* NCLIPs with a precise sign available */ + uint32_t disagree; /* precise sign != native MAC0 sign */ + uint32_t saturated; /* any of the three SXY entries hit the clamp */ + uint32_t last_frame; +} GteNclipFuncStat; + +typedef struct { + uint32_t pc; /* configured exact-NCLIP branch PC */ + uint32_t evals; + uint32_t flips; /* branch decision changed by the precise sign */ + uint32_t fallbacks; /* no precise sign for this MAC0 -> native */ + uint32_t last_frame; +} GteNclipSiteStat; + +#define GTE_NCLIP_STAT_CAP 256 + +void gte_nclip_precise_stats(uint64_t *hits, uint64_t *fallbacks, + uint64_t *disagreements); +int gte_nclip_func_stats(GteNclipFuncStat *out, int max); +int gte_nclip_site_stats(GteNclipSiteStat *out, int max); +void gte_nclip_stats_reset(void); + +/* Branch consumer for exact-NCLIP sites: the sign (-1/0/1) the branch should + * test. The precise sign when it belongs to `native_mac0` (the value the + * guest just read from MAC0), else the native sign. */ +int32_t gte_nclip_exact_sign(int32_t native_mac0, uint32_t pc); + +/* Kill switch for the exact-site consumer (default on): off makes every exact + * site test the native sign, for same-build/same-state A/B and diagnosis. */ +void gte_nclip_exact_set_enabled(int on); +int gte_nclip_exact_enabled(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/guest_tty.h b/overlay_toolchain/include/guest_tty.h new file mode 100644 index 00000000..6bcade1a --- /dev/null +++ b/overlay_toolchain/include/guest_tty.h @@ -0,0 +1,23 @@ +#ifndef PSXRECOMP_GUEST_TTY_H +#define PSXRECOMP_GUEST_TTY_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Bounded observability sink for bytes emitted through the PS1 guest console. + * Writers never block. A snapshot returns the newest complete byte window and + * the monotonically increasing total number of bytes observed. */ +void psx_guest_tty_putchar(uint8_t value); +size_t psx_guest_tty_snapshot(uint8_t *out, size_t capacity, + uint64_t *total_bytes); +void psx_guest_tty_reset(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/hd_texture_pack.h b/overlay_toolchain/include/hd_texture_pack.h new file mode 100644 index 00000000..844ecc08 --- /dev/null +++ b/overlay_toolchain/include/hd_texture_pack.h @@ -0,0 +1,190 @@ +#ifndef PSXRECOMP_HD_TEXTURE_PACK_H +#define PSXRECOMP_HD_TEXTURE_PACK_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* External Beetle-style texture-pack loader and VRAM upload tracker. + * The pack payload is never copied into or owned by the executable. */ +typedef struct HdTexturePack HdTexturePack; + +enum HdTextureDepth { + HD_TEXTURE_DEPTH_4BPP = 0, + HD_TEXTURE_DEPTH_8BPP = 1, + HD_TEXTURE_DEPTH_16BPP = 2 +}; + +enum HdTextureLookupStatus { + HD_TEXTURE_LOOKUP_ERROR = -1, + HD_TEXTURE_LOOKUP_NONE = 0, + HD_TEXTURE_LOOKUP_FOUND = 1, + HD_TEXTURE_LOOKUP_AMBIGUOUS = 2 +}; + +typedef struct HdTexturePackInfo { + const char* asset_root; /* valid until hd_texture_pack_destroy */ + const char* replacement_root; /* valid until hd_texture_pack_destroy */ + size_t replacement_file_count; + size_t unique_key_count; + size_t ambiguous_key_count; + size_t logical_mapping_count; +} HdTexturePackInfo; + +typedef struct HdTexturePackEntry { + uint32_t texture_hash; + uint32_t palette_hash; + const char* replacement_path; /* valid until hd_texture_pack_destroy */ + const char* logical_path; /* empty when Hashes.ini has no mapping */ +} HdTexturePackEntry; + +/* A UV interval is inclusive. first > last means that the 8-bit texture + * coordinate wraps through 255 -> 0. page_x/page_y are VRAM word coordinates. + * vram must contain the complete 1024x512 native PSX VRAM image. */ +typedef struct HdTextureDrawQuery { + uint16_t page_x; + uint16_t page_y; + uint8_t depth; /* enum HdTextureDepth */ + uint8_t u_first; + uint8_t u_last; + uint8_t v_first; + uint8_t v_last; + uint16_t clut_x; + uint16_t clut_y; + const uint16_t* vram; + size_t vram_word_count; +} HdTextureDrawQuery; + +typedef struct HdTextureMatch { + HdTexturePackEntry entry; + uint64_t upload_serial; + uint16_t upload_width_words; + uint16_t upload_height; + uint16_t source_word_x; /* first queried word within the original upload */ + uint16_t source_y; +} HdTextureMatch; + +/* explicit_root wins. When it is NULL/empty, PSXRECOMP_HD_TEXTURE_ROOT is + * consulted. Accepts either: + * root/Hashes.ini + exactly one -texture-replacements directory, or + * the replacement directory directly (Hashes.ini is read from it or parent). + * Returns 1 on success and leaves *out_pack NULL on failure. */ +int hd_texture_pack_create(const char* explicit_root, + HdTexturePack** out_pack, + char* error, + size_t error_capacity); +void hd_texture_pack_destroy(HdTexturePack* pack); +void hd_texture_pack_get_info(const HdTexturePack* pack, + HdTexturePackInfo* out_info); + +/* Key-only lookup. Ambiguous numeric aliases (for example 1-2.png and + * 00000001-2.png) deliberately return AMBIGUOUS instead of selecting by + * directory enumeration order. */ +int hd_texture_pack_lookup(const HdTexturePack* pack, + uint32_t texture_hash, + uint32_t palette_hash, + HdTexturePackEntry* out_entry); + +/* Standard reflected IEEE CRC-32 (polynomial 0xEDB88320, initial/final XOR + * 0xFFFFFFFF), feeding each uint16_t explicitly low byte then high byte. */ +uint32_t hd_texture_crc32_words_le(const uint16_t* words, size_t word_count); + +/* Hashes the complete live CLUT: 16 entries for 4bpp or 256 for 8bpp. CLUT X + * wraps at 1024 and Y wraps at 512. 16bpp has no palette and returns zero. */ +uint32_t hd_texture_hash_clut(const uint16_t* vram, + size_t vram_word_count, + uint16_t clut_x, + uint16_t clut_y, + uint8_t depth); + +/* Upload bytes are row-major logical upload words, independent of destination + * wrapping. Tracking invalidates/splits every intersected older residency. + * Width <= 1024 and height <= 512; X/Y may wrap. */ +int hd_texture_pack_track_upload(HdTexturePack* pack, + uint16_t x, + uint16_t y, + uint16_t width_words, + uint16_t height, + const uint16_t* words, + size_t word_count, + uint32_t* out_texture_hash); +void hd_texture_pack_invalidate(HdTexturePack* pack, + uint16_t x, + uint16_t y, + uint16_t width_words, + uint16_t height); +void hd_texture_pack_reset_tracking(HdTexturePack* pack); + +/* Beetle-style upload residency is host metadata, but it is required for an + * HD replacement to keep matching after a savestate restores the same VRAM. + * The portable little-endian state below records only upload identity and the + * surviving residency fragments; decoded images and GL objects remain caches. + * save allocates with malloc (caller frees). A NULL pack serializes a valid + * empty tracker so states remain renderer-independent. check is side-effect + * free; load has strong replacement semantics and also accepts a NULL pack + * after validating the wire. */ +int hd_texture_pack_tracking_state_save(const HdTexturePack* pack, + uint8_t** out_data, + size_t* out_size); +int hd_texture_pack_tracking_state_check(const uint8_t* data, + size_t size); +int hd_texture_pack_tracking_state_load(HdTexturePack* pack, + const uint8_t* data, + size_t size); +size_t hd_texture_pack_tracking_upload_count(const HdTexturePack* pack); + +/* Matches only when one uniquely-keyed tracked upload still contains every + * word touched by the texture page/depth/UV query. Any pack-key or residency + * ambiguity falls back explicitly via HD_TEXTURE_LOOKUP_AMBIGUOUS. */ +int hd_texture_pack_match(HdTexturePack* pack, + const HdTextureDrawQuery* query, + HdTextureMatch* out_match); + +/* Live GP0 draw adapter: derives page_x/page_y/depth from the PS1 texpage word + * and applies the same deterministic residency/CLUT/UV match above. This keeps + * the renderer's texpage interpretation in the focused unit-test surface. */ +int hd_texture_pack_match_draw(HdTexturePack* pack, + uint16_t texpage, + uint16_t clut_x, + uint16_t clut_y, + uint8_t u_first, + uint8_t u_last, + uint8_t v_first, + uint8_t v_last, + const uint16_t* vram, + size_t vram_word_count, + HdTextureMatch* out_match); + +/* Optional, bounded, single-worker on-demand PNG decode cache. The request is + * asynchronous and low-priority on Windows. request_decode returns FOUND when + * already ready, NONE when queued/in flight, and ERROR for an absent, + * ambiguous, failed, or over-budget image. acquire_decoded returns FOUND only + * when ready. A lease keeps pixels alive across cache eviction and pack + * destruction; always release it with hd_texture_pixels_release. */ +typedef struct HdTexturePixels { + const uint8_t* rgba; + uint32_t width; + uint32_t height; + uint32_t stride; + void* lease; +} HdTexturePixels; + +void hd_texture_pack_set_decode_budget(HdTexturePack* pack, + size_t budget_bytes); +int hd_texture_pack_request_decode(HdTexturePack* pack, + uint32_t texture_hash, + uint32_t palette_hash); +int hd_texture_pack_acquire_decoded(HdTexturePack* pack, + uint32_t texture_hash, + uint32_t palette_hash, + HdTexturePixels* out_pixels); +void hd_texture_pixels_release(HdTexturePixels* pixels); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_HD_TEXTURE_PACK_H */ diff --git a/overlay_toolchain/include/host_keymap.h b/overlay_toolchain/include/host_keymap.h new file mode 100644 index 00000000..0f17ac95 --- /dev/null +++ b/overlay_toolchain/include/host_keymap.h @@ -0,0 +1,54 @@ +#ifndef PSX_HOST_KEYMAP_H +#define PSX_HOST_KEYMAP_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Host hotkeys from recomp-ui config.ini [KeyMap] (SDL key names + Ctrl+/Alt+/ + * Shift+ prefixes). Missing lines keep the historic runtime defaults. + */ + +typedef enum HostKeymapAction { + HOST_KEYMAP_FULLSCREEN = 0, + HOST_KEYMAP_TURBO, + HOST_KEYMAP_VOLUME_UP, + HOST_KEYMAP_VOLUME_DOWN, + HOST_KEYMAP_DISPLAY_PERF, + HOST_KEYMAP_REWIND, /* default F8 */ + HOST_KEYMAP_SAVE_STATE_MENU, /* default F7 */ + HOST_KEYMAP_SCANLINES, /* default F6 */ + HOST_KEYMAP_TURBO_TOGGLE, /* default F9; latches Turbo until pressed again */ + HOST_KEYMAP_CAPTURE_MARK, /* default Ctrl+M; freezes the debug capture rings */ + HOST_KEYMAP_ACTION_COUNT +} HostKeymapAction; + +/* Load [KeyMap] from path (NULL => no file, apply defaults only). */ +void host_keymap_load(const char *config_ini_path); + +/* 1 if (keycode, mod) matches a binding for `action`. */ +int host_keymap_match(HostKeymapAction action, int keycode, int mod); + +/* Match a key event by its logical keycode or physical scancode. SDL can + * report a layout-dependent/unknown keycode while still providing the stable + * scancode stored with the configured binding. */ +int host_keymap_match_event(HostKeymapAction action, int keycode, + int scancode, int mod); + +/* 1 if any configured bind for `action` is currently held. */ +int host_keymap_down(HostKeymapAction action, const uint8_t *keys, int mod); + +/* Format the primary bind for `action` into out (e.g. "F8", "Ctrl+R", + * "GRAVE"). Punctuation key names are tokenized for the rewind overlay font. + * Returns out, or "F8" / "" on empty action. Always NUL-terminates. */ +const char *host_keymap_label(HostKeymapAction action, char *out, size_t cap); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_HOST_KEYMAP_H */ diff --git a/overlay_toolchain/include/host_osd.h b/overlay_toolchain/include/host_osd.h new file mode 100644 index 00000000..e4e6f307 --- /dev/null +++ b/overlay_toolchain/include/host_osd.h @@ -0,0 +1,51 @@ +#ifndef PSX_HOST_OSD_H +#define PSX_HOST_OSD_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Host-only OSD (toasts + volume bar). Not part of guest VRAM / savestates. + * + * Visual overlays (toasts, volume bar, draw helpers) are compiled active only + * when RECOMP_LAUNCHER is defined (recomp-ui linked via PSX_RECOMP_UI=ON). + * host_volume_get/set/adjust still work without the launcher; adjust is silent + * when OSD is gated off. + */ + +/* Top-left text toast. duration_ms <= 0 uses 2000. */ +void host_osd_push(const char *msg, int duration_ms); + +/* Persistent top-left status text. Passing NULL/empty clears it. */ +void host_osd_set_status(const char *msg); + +/* Right-side vertical volume bar (percent clamped 0..100). */ +void host_osd_show_volume(int percent, int duration_ms); + +/* Host master volume 0..100 (applied by the audio pump). */ +int host_volume_get(void); +void host_volume_set(int percent); /* silent clamp */ +int host_volume_adjust(int delta); /* clamp, show bar, return new % */ + +/* 1 while a toast/bar is visible, or one more frame is needed to clear it. */ +int host_osd_needs_present(void); + +/* ARGB8888 images for the active overlays. Valid until the next host_osd_* + * call. Returns 1 if there are pixels to draw. After compositing both (or + * deciding neither is active), call host_osd_present_done(). */ +int host_osd_image(const uint32_t **pixels, int *w, int *h); /* text */ +int host_osd_volume_image(const uint32_t **pixels, int *w, int *h); /* bar */ +void host_osd_present_done(void); + +/* Software / SDL_Renderer path: draw overlays over the current backbuffer. */ +struct SDL_Renderer; +void host_osd_draw_sdl(struct SDL_Renderer *renderer); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_HOST_OSD_H */ diff --git a/overlay_toolchain/include/host_time.h b/overlay_toolchain/include/host_time.h new file mode 100644 index 00000000..5c9613f8 --- /dev/null +++ b/overlay_toolchain/include/host_time.h @@ -0,0 +1,25 @@ +/* + * host_time.h — cross-platform monotonic ms + high-res sleep. + * + * Windows netplay/pacing must not use GetTickCount64 / Sleep for short + * slices (coarse ~1–15.6 ms). Match recomp-net / BattleShip: QPC + waitable + * timer. Unix: CLOCK_MONOTONIC + usleep. + */ +#ifndef PSX_HOST_TIME_H +#define PSX_HOST_TIME_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +uint64_t psx_host_mono_ms(void); +void psx_host_sleep_micros(unsigned usec); +void psx_host_sleep_ms(unsigned ms); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_HOST_TIME_H */ diff --git a/overlay_toolchain/include/internal_resolution.h b/overlay_toolchain/include/internal_resolution.h new file mode 100644 index 00000000..9362d209 --- /dev/null +++ b/overlay_toolchain/include/internal_resolution.h @@ -0,0 +1,195 @@ +/* internal_resolution.h — the "Internal resolution" setting: presets, their + * persisted ids, and the integer scale each one asks the renderer for. + * + * Pure (no SDL, no GL) so both the config loader and a test can use it. + * + * VALUE ENCODING (shared with recomp-ui's Settings.internal_resolution): + * 0 unset: the legacy [video] supersampling factor stands + * 1 native (1x) + * -1 match display: the target is the monitor's pixel height + * N (N >= 2) a target output height in lines (720, 1080, ... or a + * legacy "Nx" entry expressed as reference_lines * N) + * + * SCALE. The renderer only does integer scales (the pack of the hr surface + * back to native VRAM is exact only then), so a target height becomes + * S = ceil(target_lines / reference_lines) + * clamped to [1, s_max]. reference_lines is the title's usual display height + * ([video] resolution_reference_lines, default 240): R4's races are 320x240, + * so 1080p is S = 5 (1200 lines, area-resolved to 1080) and 4K is S = 9. + * A 480-line mode (interlaced menus) renders at twice the target and is + * resolved down. The backend then clamps S again to what it can allocate. */ +#pragma once + +#include + +#define PSX_IR_UNSET 0 +#define PSX_IR_NATIVE 1 +#define PSX_IR_DISPLAY (-1) +#define PSX_IR_DEFAULT_REF_LINES 240 +/* Custom line counts accepted from config (a 16K panel is 8640 lines). */ +#define PSX_IR_MIN_LINES 2 +#define PSX_IR_MAX_LINES 8640 + +typedef struct PsxIrPreset { + const char *id; /* stable id persisted in settings.toml */ + const char *label; /* launcher label */ + int value; /* encoding above */ +} PsxIrPreset; + +static const PsxIrPreset k_psx_ir_presets[] = { + { "native", "Native", PSX_IR_NATIVE }, + { "720p", "720p", 720 }, + { "1080p", "1080p", 1080 }, + { "1440p", "1440p", 1440 }, + { "4k", "4K", 2160 }, + { "5k", "5K", 2880 }, + { "8k", "8K", 4320 }, + { "display", "Match display", PSX_IR_DISPLAY }, +}; +#define PSX_IR_PRESET_COUNT ((int)(sizeof(k_psx_ir_presets) / sizeof(k_psx_ir_presets[0]))) + +static inline int psx_ir_lower_eq(const char *a, const char *b) { + for (; *a && *b; a++, b++) { + char ca = (*a >= 'A' && *a <= 'Z') ? (char)(*a - 'A' + 'a') : *a; + if (ca != *b) return 0; + } + return *a == 0 && *b == 0; +} + +/* 1 if value is a legal encoding (unset excluded). */ +static inline int psx_ir_value_valid(int value) { + return value == PSX_IR_NATIVE || value == PSX_IR_DISPLAY || + (value >= PSX_IR_MIN_LINES && value <= PSX_IR_MAX_LINES); +} + +/* Parse a persisted value: a preset id (case-insensitive) or a decimal line + * count in [PSX_IR_MIN_LINES, PSX_IR_MAX_LINES]. Returns 1 and stores the + * value on success; 0 for anything else (the caller keeps its default). */ +static inline int psx_ir_parse(const char *s, int *out) { + if (!s || !*s) return 0; + for (int i = 0; i < PSX_IR_PRESET_COUNT; i++) + if (psx_ir_lower_eq(s, k_psx_ir_presets[i].id)) { *out = k_psx_ir_presets[i].value; return 1; } + long v = 0; + const char *p = s; + while (*p >= '0' && *p <= '9') { v = v * 10 + (*p - '0'); p++; if (v > PSX_IR_MAX_LINES) return 0; } + if (p == s || *p) return 0; + if (v < PSX_IR_MIN_LINES) return 0; /* a number is always lines, never "1 = native" */ + *out = (int)v; + return 1; +} + +/* The preset id for a value, or NULL for a custom line count (persist those + * as an integer). */ +static inline const char *psx_ir_id_for(int value) { + for (int i = 0; i < PSX_IR_PRESET_COUNT; i++) + if (k_psx_ir_presets[i].value == value) return k_psx_ir_presets[i].id; + return NULL; +} + +static inline const char *psx_ir_label_for(int value) { + for (int i = 0; i < PSX_IR_PRESET_COUNT; i++) + if (k_psx_ir_presets[i].value == value) return k_psx_ir_presets[i].label; + return NULL; +} + +/* Unclamped scale a value asks for. display_px_h <= 0 (unknown) makes Match + * display 1 until the caller can measure the monitor. */ +static inline int psx_ir_scale_for(int value, int ref_lines, int display_px_h) { + if (ref_lines < 1) ref_lines = PSX_IR_DEFAULT_REF_LINES; + int target; + if (value == PSX_IR_DISPLAY) target = display_px_h; + else if (value >= PSX_IR_MIN_LINES) target = value; + else return 1; /* native / unset */ + if (target <= ref_lines) return 1; + return (target + ref_lines - 1) / ref_lines; +} + +/* The scale to request: psx_ir_scale_for clamped to [1, s_max]. */ +static inline int psx_resolve_internal_scale(int value, int ref_lines, + int display_px_h, int s_max) { + int s = psx_ir_scale_for(value, ref_lines, display_px_h); + if (s_max >= 1 && s > s_max) s = s_max; + return s < 1 ? 1 : s; +} + +/* A legacy [video] supersampling factor as a value the launcher can show: + * the preset that resolves to the same scale (1 -> Native, 3 -> 720p, + * 5 -> 1080p, 6 -> 1440p, 9 -> 4K, 12 -> 5K, 18 -> 8K at 240 lines), + * otherwise ref_lines * n as a custom entry ("2x (480 lines)"). */ +static inline int psx_ir_from_supersampling(int n, int ref_lines) { + if (ref_lines < 1) ref_lines = PSX_IR_DEFAULT_REF_LINES; + if (n <= 1) return PSX_IR_NATIVE; + for (int i = 0; i < PSX_IR_PRESET_COUNT; i++) { + int v = k_psx_ir_presets[i].value; + if (v >= PSX_IR_MIN_LINES && psx_ir_scale_for(v, ref_lines, 0) == n) return v; + } + long lines = (long)ref_lines * n; + return lines > PSX_IR_MAX_LINES ? PSX_IR_MAX_LINES : (int)lines; +} + +/* ---- The launcher round trip ------------------------------------------------- + * The host seeds the launcher with its video state, the player may change it, + * and the host adopts what comes back. A recomp-ui built with the Internal + * resolution row (RECOMP_LAUNCHER_HAS_INTERNAL_RESOLUTION) owns the preset. + * An older one only has the legacy Supersampling row, a 1x..4x cycle that + * clamps whatever it is seeded with. There a pick in that row must win over + * any preset, and a preset the player cannot see (game.toml, a hand-edited + * settings.toml) must survive an untouched row. With no preset the round trip + * is exactly the historical one: seed the factor, take the factor back. */ +#define PSX_IR_LEGACY_SS_MAX 4 /* the legacy row's range, and settings.toml's + * supersampling for an older runtime */ + +/* The value seeded into the legacy Supersampling row. has_row: the launcher + * shows the Internal resolution row instead (the factor passes through). */ +static inline int psx_ir_launcher_seed_supersampling(int has_row, int preset, + int supersampling, + int ref_lines, + int display_px_h) { + if (has_row || preset == PSX_IR_UNSET) return supersampling; + /* The preset's scale, as near as the row can show it. */ + return psx_resolve_internal_scale(preset, ref_lines, display_px_h, + PSX_IR_LEGACY_SS_MAX); +} + +typedef struct PsxIrAdopted { + int preset; /* the preset kept (PSX_IR_UNSET: the factor stands) */ + int scale; /* the scale to request */ + int save_ss; /* settings.toml supersampling */ + int save_ir; /* settings.toml internal_resolution; PSX_IR_UNSET omits it */ +} PsxIrAdopted; + +/* What the host adopts when the launcher returns. + * has_row the launcher showed the Internal resolution row + * preset the host's preset when it seeded the launcher + * ss_seed what psx_ir_launcher_seed_supersampling returned + * ss_result the Supersampling row's value on return + * ir_result the Internal resolution row's value (has_row only) + * s_max the chosen renderer's ceiling */ +static inline PsxIrAdopted psx_ir_adopt_launcher(int has_row, int preset, + int ss_seed, int ss_result, + int ir_result, int ref_lines, + int display_px_h, int s_max) { + PsxIrAdopted a; + if (has_row) { + if (psx_ir_value_valid(ir_result)) a.preset = ir_result; + else if (preset != PSX_IR_UNSET) a.preset = preset; + else a.preset = psx_ir_from_supersampling(ss_seed < 1 ? 1 : ss_seed, ref_lines); + } else { + int shown = ss_seed < 1 ? 1 : ss_seed > PSX_IR_LEGACY_SS_MAX + ? PSX_IR_LEGACY_SS_MAX : ss_seed; + a.preset = (preset != PSX_IR_UNSET && ss_result == shown) ? preset + : PSX_IR_UNSET; + } + if (a.preset == PSX_IR_UNSET) { + a.scale = ss_result; + a.save_ss = ss_result; + a.save_ir = PSX_IR_UNSET; + } else { + a.scale = psx_resolve_internal_scale(a.preset, ref_lines, display_px_h, s_max); + /* An older runtime reading settings.toml only knows supersampling + * (1..4): leave it the nearest it can do. */ + a.save_ss = a.scale < PSX_IR_LEGACY_SS_MAX ? a.scale : PSX_IR_LEGACY_SS_MAX; + a.save_ir = a.preset; + } + return a; +} diff --git a/overlay_toolchain/include/interrupts.h b/overlay_toolchain/include/interrupts.h new file mode 100644 index 00000000..948d03ae --- /dev/null +++ b/overlay_toolchain/include/interrupts.h @@ -0,0 +1,164 @@ +#ifndef PSXRECOMP_INTERRUPTS_H +#define PSXRECOMP_INTERRUPTS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct CPUState; +/* A host adapter that preserves registers outside guest RAM is not a + * serializable continuation. Defer snapshots until it returns; scheduler + * escapes discard the scope with the abandoned host stack. */ +void psx_snapshot_host_call_begin(void); +void psx_snapshot_host_call_end(void); +void psx_snapshot_host_call_reset(void); + +/* IRQ bit positions in I_STAT/I_MASK */ +#define IRQ_VBLANK 0 +#define IRQ_GPU 1 +#define IRQ_CDROM 2 +#define IRQ_DMA 3 +#define IRQ_TIMER0 4 +#define IRQ_TIMER1 5 +#define IRQ_TIMER2 6 +#define IRQ_SIO0 7 +#define IRQ_SIO1 8 +#define IRQ_SPU 9 +#define IRQ_PIO 10 + +void interrupts_init(void); + +/* Save-state restore: re-anchor host-only IRQ pacing after psx_cycle_count is + * overwritten from a snapshot. Clears absolute-cycle cooldowns / deferred + * switches that would otherwise strand delivery until the restored clock + * catches up to the pre-load host timeline (warm-reload picture freeze). */ +void interrupts_resync_after_restore(void); + +/* Netplay diag: last VBLANK irqctx exit/restore (+ v0) for peer diff. */ +void interrupts_log_last_vblank_irqctx(const char *tag); + +/* Central IRQ-raise choke point: sets the I_STAT bit AND records the raise edge + * into the always-on device-event ring (device_trace) with the guest cycle. + * Every hardware source (VBLANK/GPU/CDROM/DMA/timers/SIO/SPU) funnels its raise + * through here so the device-timing audit sees every event from one place. + * `detail` is source-specific (DMA channel, timer index) or 0. */ +void psx_irq_raise(uint32_t bit, uint32_t detail); + +/* Called from the dispatch loop after each function returns. + * Services due scheduled edges, checks (i_stat & i_mask), and if pending + COP0 + * allows, dispatches the exception handler. */ +void psx_check_interrupts(struct CPUState* cpu); + +/* Cheap block-edge predicate for generated/native code. Device events are + * raised by psx_advance_cycles(); this reports whether the comparatively + * expensive delivery/scheduler path can have an architectural effect now. */ +int psx_interrupt_delivery_needed(const struct CPUState* cpu); +void psx_interrupt_delivery_diag(uint64_t *need_defer, uint64_t *need_irq, + uint64_t *skip_none, uint64_t *skip_sr, + uint64_t *skip_cooldown, uint64_t *skip_nested); + +/* Hot-path counters for psx_check_interrupts (monotonic). Any out_* may be NULL. + * entry = every call + * fast_sr = early return: pending I_STAT but IEc/IM2 clear + * fast_none = early return: nothing pending + * mid = total_checks (past fast paths; toward / into deliver eval) + * eval = reached irq_deliver_eval label + * irq_deliv = g_irq_deliver_count (any HW IRQ exception taken) */ +void psx_interrupt_check_path_diag(uint64_t *entry, uint64_t *fast_sr, + uint64_t *fast_none, uint64_t *mid, + uint64_t *eval, uint64_t *irq_deliv); +/* Interrupt check with the compiled guest PC to resume if a game-installed + * handler later RFEs to the sentinel outside the synchronous host window. */ +void psx_check_interrupts_at(struct CPUState* cpu, uint32_t resume_pc); +int psx_interrupts_checked_at_current_cycle(uint32_t resume_pc); +/* Dispatch-entry check for re-enterable compiled PCs. De-dupes an immediately + * preceding check at the same guest PC/cycle so generated transfers can keep + * their explicit checks while dirty/interp-to-static entries get a boundary. */ +void psx_check_interrupts_dispatch_entry(struct CPUState* cpu, uint32_t resume_pc); + +/* Accumulate emitted PSX cycles toward the next VBlank trigger. + * Called from psx_advance_cycles() so the VBlank rate is gated on + * guest cycles (correct PSX timing) rather than block-dispatch + * count (which was 5-6x too fast and squeezed game-time to ~60% of + * real). The period follows the GPU's live video standard: NTSC 564480 + * cycles (33.8688 MHz / 60), PAL 677376 (/ 50); see psx_video_timing.h. */ +void interrupts_advance_cycles(uint32_t cycles); +void interrupts_service_scheduled_events(void); +uint32_t interrupts_cycles_to_vblank(void); +/* While IRQ9 is enabled, expose the next 44.1-kHz sample as a first-class + * device deadline so the CPU can observe and acknowledge an IRQ before the + * following sample. UINT32_MAX means inactive. PSX_SPU_SAMPLE_EVENTS=0 is a + * diagnostic opt-out. */ +uint32_t psx_spu_sample_event_cycles_to_next(void); +void psx_spu_sample_event_service(void); +/* VBlank phase within the current frame (0 .. period-1). Persisted in + * BS_SEC_IRQ (and selfcheck's out-of-band latch) so resim keeps the snap's + * phase. Legacy 8-byte IRQ sections still rebase to 0 on load. */ +uint32_t interrupts_get_cycles_since_vblank(void); +void interrupts_set_cycles_since_vblank(uint32_t v); + +/* Cycle-budgeted precise event slicing: minimum guest-CPU-cycle distance to the + * next DELIVERABLE hardware interrupt (source raises its I_STAT bit AND that bit + * is unmasked in i_mask). UINT32_MAX if none scheduled. Single source of truth + * for the two-tier block executor's fast/slice decision. See PRECISE_IRQ_SLICE.md. */ +uint32_t cycles_to_next_event(void); + +/* Query whether we are currently inside an exception handler dispatch. */ +int psx_get_in_exception(void); + +/* Most recent block-leader IRQ-check guest PC / compiled resume latch. + * Used by the post-savestate freeze probe (vblank-time "where was the game"). */ +uint32_t psx_last_irq_check_pc(void); +uint32_t psx_compiled_irq_resume_pc(void); +/* True when the current IRQ poll has a materialized CPUState/register context + * matching its resume PC. Dirty-RAM synthetic pump sites may expose a committed + * resume PC for IRQ timing before the live CPUState is safe to serialize. */ +int psx_irq_resume_context_snapshot_safe(void); +int psx_irq_resume_context_snapshot_safe_at(uint32_t resume_pc); +int psx_irq_resume_context_snapshot_site(void); +uint32_t psx_irq_resume_context_snapshot_pc(void); +/* Soft-return / netplay BYE: drop sticky resume latches so rematch dig0 snaps + * cannot inherit a prior-match game PC (see pick_snap_resume_pc). */ +void psx_irq_clear_resume_latches(void); +/* Arm compiled IRQ resume before top-level flush_resume / savestate dispatch + * so a latched I_STAT cannot take LEGACY_SENTINEL with take_pc=0. */ +void psx_irq_arm_compiled_resume_pc(uint32_t pc); +uint64_t psx_last_irq_check_cycle(void); +uint64_t psx_interrupt_total_checks(void); +uint32_t psx_interrupt_fast_maintenance(void); + +/* Snapshot internal counters for the freeze_check diagnostic. Any out_* + * pointer may be NULL. All counters are monotonically non-decreasing + * (dispatch_count resets each VBlank). */ +void psx_get_freeze_diag(uint64_t *out_total_checks, + uint32_t *out_dispatch_count, + int *out_in_exception, + int *out_post_exc_cooldown, + uint64_t *out_exc_entries, + uint64_t *out_exc_reentry_blocks); + +/* longjmp back to psx_check_interrupts, unwinding the exception handler. + * Called by ReturnFromException (B0:0x17 or SYSCALL(3)) when inside + * the exception handler to model real hardware's RFE+JR $k0 unwind. */ +void psx_exception_longjmp(void); + +/* longjmp back to psx_check_interrupts for RestoreState redirection. + * + * On real hardware, RestoreState (A0:0x14) restores all GPRs from a + * save buffer and does `jr $ra`, which jumps to the restored $ra — + * abandoning the current call stack. In our model, a plain `return;` + * would go back to the C caller (the chain walker), not to $ra. + * + * This function longjmps with code 2 (vs. 1 for ReturnFromException), + * so psx_check_interrupts can re-dispatch to cpu->pc while still in + * exception context. The redirected code (e.g., VSync callback loop) + * will eventually call ReturnFromException (longjmp code 1) to exit. */ +void psx_restore_state_escape(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_INTERRUPTS_H */ diff --git a/overlay_toolchain/include/iso_reader.h b/overlay_toolchain/include/iso_reader.h new file mode 100644 index 00000000..ff75e9c3 --- /dev/null +++ b/overlay_toolchain/include/iso_reader.h @@ -0,0 +1,259 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +/** + * ISO/BIN/CUE Reader for PS1 CD-ROM images + * Session 24-25 - Validation-first approach + * + * Features: + * - Open ISO/BIN file + * - Read sectors by LBA + * - Parse ISO9660 filesystem + * - List files in directory + * - Read file contents by path + */ + +namespace PS1 { + +struct CHDState; + +/** + * Information about a file entry in the ISO filesystem + */ +struct ISOFileEntry { + std::string name; // Filename (without version suffix) + uint32_t lba; // Logical Block Address (sector number) + uint32_t size; // File size in bytes + bool is_directory; // True if this is a directory +}; + +/** + * Root directory information from Primary Volume Descriptor + */ +struct RootDirectoryInfo { + uint32_t lba; // LBA of root directory data + uint32_t size; // Size of root directory in bytes +}; + +/** + * A CD track parsed from the .cue sheet (or the synthesized single data + * track for a bare .bin/.iso). Multi-track discs can carry a + * Red Book CD-DA audio track after the data track; the CD model's TOC + * commands (GetTN/GetTD) must report them. + */ +struct CDTrack { + int number; // 1-based track number + bool is_audio; // true = CD-DA audio (Red Book); false = data + uint32_t start_lba; // disc-relative start LBA (cue INDEX 01; track 1 = 0). + // Single-FILE cues: equals the .bin-relative INDEX time. + // Multi-FILE cues (redump "(Track N).bin" dumps): the + // owning file's first disc sector plus its INDEX time. + // Either way, plus every cue PREGAP/POSTGAP before it + // (gaps the dump does not store). + uint32_t pregap_lba; // disc-relative start of the track's pregap: its cue + // PREGAP if any, else INDEX 00, else INDEX 01 +}; + +/** + * One BINARY file backing a contiguous run of disc sectors. Single-file + * images have exactly one segment; redump-style dumps have one per track + * file, concatenated in cue order to form the flat disc-sector space that + * ReadSector()/ReadRawSector() address. + */ +struct BinSegment { + std::string path; // resolved on-disk path + std::ifstream file; // opened for the reader's lifetime + uint32_t start_lba; // disc sector of this file's first stored sector + uint32_t sector_count; // sectors stored in this file + bool raw; // 2352-byte raw sectors (BIN) vs 2048 (ISO) +}; + +/** + * A contiguous run of disc sectors. A stored span maps onto sectors of one + * BinSegment; a virtual span is a cue PREGAP/POSTGAP that the dump does not + * store and that reads back as zero (silence), as the CHD path already does. + * Without PREGAP/POSTGAP lines each file is exactly one stored span, so the + * disc layout is the plain concatenation of the files. + */ +struct BinSpan { + uint32_t disc_start; // first disc-relative sector + uint32_t sector_count; + int segment; // index into segments_, or -1 for a virtual gap + uint32_t file_sector; // first sector within the segment's file +}; + +class ISOReader { +public: + /** + * Constructor + */ + ISOReader(); + + /** + * Destructor - ensures file is closed + */ + ~ISOReader(); + + /** + * Open an ISO/BIN file for reading + * @param filename Path to .iso, .bin, .img, .car, .cue, or .chd file + * @return true if opened successfully, false otherwise + */ + bool Open(const std::string& filename); + + /** + * Close the currently open file + */ + void Close(); + + /** + * Read a single sector from the ISO + * @param lba Logical Block Address (sector number) + * @param buffer Buffer to read into (must be at least 2048 bytes) + * @return true if read successfully, false otherwise + */ + bool ReadSector(uint32_t lba, uint8_t* buffer); + + /** + * Read a raw 2352-byte sector from a BIN image. + * @param lba Logical Block Address (sector number) + * @param buffer Buffer to read into (must be at least 2352 bytes) + * @return true if the image stores raw sectors and read succeeded + */ + bool ReadRawSector(uint32_t lba, uint8_t* buffer); + + /** + * Read generated or SBI-replacement subchannel Q for a disc LBA. + * SBI records intentionally carry invalid CRC data; valid is false for + * those sectors so the CD controller can retain its last valid Q packet. + */ + bool ReadSubChannelQ(uint32_t lba, uint8_t* buffer, bool* valid) const; + bool HasSubChannelReplacements() const { return !subq_replacements_.empty(); } + + /** + * Check if a file is currently open + * @return true if file is open + */ + bool IsOpen() const; + + /** + * Get volume ID from Primary Volume Descriptor + * @return Volume ID string (disc name) + */ + std::string GetVolumeID() const; + + /** + * Get the resolved path to the BIN file (set after Open()) + */ + std::string GetBinPath() const; + + /** + * Get number of addressable sectors in the mounted image. + * Raw BIN images count 2352-byte sectors; cooked ISO images count 2048-byte sectors. + */ + uint32_t GetSectorCount(); + + /** + * CD-track TOC accessors (multi-track .cue support). + * TrackCount() is >= 1 (a bare image synthesizes one data track). + * TrackStartLBA(n)/TrackPregapLBA(n)/TrackIsAudio(n) take a 1-based track number. + */ + int TrackCount() const; + uint32_t TrackStartLBA(int track) const; + uint32_t TrackPregapLBA(int track) const; + bool TrackIsAudio(int track) const; + + /** + * Get root directory information + * @return RootDirectoryInfo containing LBA and size + */ + RootDirectoryInfo GetRootDirectory() const; + + /** + * List all files in a directory + * @param path Directory path (empty string = root directory) + * @return Vector of ISOFileEntry for all files/subdirectories + */ + std::vector ListFiles(const std::string& path = ""); + + /** + * Find a file by name in the root directory + * @param path Filename to search for (e.g., "SYSTEM.CNF" or "SCUS_942.36") + * @param entry Output ISOFileEntry to populate with file info + * @return true if found, false if not found + */ + bool FindFile(const std::string& path, ISOFileEntry& entry); + + /** + * Read entire file contents into buffer + * @param path Filename to read + * @param buffer Buffer to read into (must be large enough) + * @param max_size Maximum bytes to read (buffer size limit) + * @return Number of bytes read (0 if error or file not found) + */ + size_t ReadFile(const std::string& path, uint8_t* buffer, size_t max_size); + + /** + * Get file size without reading data + * @param path Filename to query + * @return File size in bytes (0 if file not found) + */ + size_t GetFileSize(const std::string& path); + +private: + /** + * Parse the Primary Volume Descriptor (sector 16) + * Extracts volume ID and root directory information + * @return true if parsed successfully, false otherwise + */ + bool ParseVolumeDescriptor(); + + /** + * Helper: Read a 32-bit value in both-endian format (733 format) + * @param data Pointer to 8-byte both-endian value + * @return 32-bit value (reads little-endian half) + */ + uint32_t Read733(const uint8_t* data) const; + + /** + * Helper: Parse a directory record from raw sector data + * @param data Pointer to directory record data + * @param entry Output ISOFileEntry to populate + * @return true if parsed successfully, false if invalid record + */ + bool ParseDirectoryRecord(const uint8_t* data, ISOFileEntry& entry) const; + + /** + * Helper: List files in a directory given its LBA and size + * Used for subdirectory navigation + */ + std::vector ListFilesByLBA(uint32_t lba, uint32_t dir_size); + + /** + * Helper: find the span containing a disc-relative LBA. + * @return span pointer, or nullptr when lba is past the disc end + */ + const BinSpan* SpanForLBA(uint32_t lba) const; + + bool LoadSBICompanion(const std::string& image_path); + + bool is_open_; + std::string volume_id_; + std::string bin_path_; // first (data) segment; kept for callers + RootDirectoryInfo root_dir_; + std::vector tracks_; // from the .cue TOC; >=1 entry after Open() + std::vector segments_; // cue FILE entries in disc order; >=1 after Open() + std::vector spans_; // disc layout over segments_ + cue gaps + uint32_t disc_sector_count_ = 0; // BIN/CUE: end of the last span + std::unique_ptr chd_; // present only for a directly mounted CHD + std::unordered_map> subq_replacements_; +}; + +} // namespace PS1 diff --git a/overlay_toolchain/include/kernel_patch_ranges.h b/overlay_toolchain/include/kernel_patch_ranges.h new file mode 100644 index 00000000..5d1a3b39 --- /dev/null +++ b/overlay_toolchain/include/kernel_patch_ranges.h @@ -0,0 +1,58 @@ +/* kernel_patch_ranges.h — the pure half of the kernel patch-range mechanism. + * + * The guest legitimately overwrites words inside compiled BIOS kernel bodies + * at boot: the Psy-Q libapi patchers (_patch_gte / _patch_card / _patch_card2 + * / _patch_pad) and the BIOS's own install stubs. Those ranges are declared + * per image by [[recompiler.install_slots]] and emitted next to the kernel + * body table (psx_bios_image.h, PsxKernelPatchRange). + * + * These two functions are the whole decision, kept free of runtime globals so + * they can be tested directly (runtime/tests/test_kernel_patch_ranges.c). + * memory.c wraps them with its snapshotted window constants; dirty_ram_interp.c + * reads the second one through that wrapper. + * + * Rule 18: the patched words still execute, on the dirty-RAM interpreter, + * exactly as the guest wrote them. Nothing here synthesises behaviour — it + * only decides which backend runs which words. + */ +#ifndef PSX_KERNEL_PATCH_RANGES_H +#define PSX_KERNEL_PATCH_RANGES_H + +#include + +#include "psx_bios_image.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Compare live kernel RAM [lo, hi) against its ROM source, SKIPPING every + * declared patch range that intersects it. Returns 0 when every compared + * segment matches (memcmp's "equal" sense), non-zero otherwise. + * + * ram/rom point at the two images; `ram_lo` is the RAM address that + * rom[rom_off] corresponds to, so a byte at RAM address a is ram[a] and + * rom[rom_off + (a - ram_lo)]. `ranges` must be sorted by lo and + * non-overlapping (BiosAddressModel::from_config validates and sorts, so a + * malformed profile cannot reach here). `skips_out`, when non-null, is + * incremented once per skipped segment. + * + * A body with NO intersecting range degenerates to a single memcmp of the + * whole extent — the original behaviour, unchanged. */ +int psx_kernel_patch_cmp(const PsxKernelPatchRange *ranges, uint32_t n, + const uint8_t *ram, const uint8_t *rom, + uint32_t ram_lo, uint32_t rom_off, + uint32_t lo, uint32_t hi, + uint64_t *skips_out); + +/* Does a declared range END at this RAM address? The emitter registered each + * range's hi as a continuation key, so the interpreter hands straight-line + * flow back to static dispatch there and only the patched words interpret. */ +int psx_kernel_patch_ends_at(const PsxKernelPatchRange *ranges, uint32_t n, + uint32_t phys); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_KERNEL_PATCH_RANGES_H */ diff --git a/overlay_toolchain/include/latency_ring.h b/overlay_toolchain/include/latency_ring.h new file mode 100644 index 00000000..4b593d8b --- /dev/null +++ b/overlay_toolchain/include/latency_ring.h @@ -0,0 +1,68 @@ +#ifndef PSX_LATENCY_RING_H +#define PSX_LATENCY_RING_H + +/* Always-on input->photon latency ring. + * + * Every present cycle (one sdl_vblank_present call) stamps a QPC timestamp at + * a few fixed stages. The ring records continuously from process start so a + * probe can QUERY a window of recent frames after the fact (never arm-then- + * capture). It is backend-agnostic: the GL and Vulkan present paths both mark + * the same SWAP_BEGIN/SWAP_END boundary, so their latency is directly + * comparable. Query through the debug server ("latency" command). + * + * Single writer (the emu/vblank thread) marks; the debug-server IO thread reads + * best-effort. Timestamps are monotonic and a torn read only blurs one frame's + * diagnostic, so no locking is used (matches the other always-on rings). */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + LAT_INPUT = 0, /* pad state sampled into SIO for this cycle */ + LAT_PACED, /* frame_pacer_wait() returned (wall-clock cap done) */ + LAT_SWAP_BEGIN, /* immediately before the backend present/swap */ + LAT_SWAP_END, /* immediately after the present/swap returned */ + LAT_STAGE_COUNT +} LatencyStage; + +/* Begin a new frame slot and stamp LAT_INPUT. Call once per cycle, at the + * point input is sampled. Advances the ring head. */ +void latency_ring_frame_begin(void); + +/* Stamp the current frame slot at `stage` (no-op for LAT_INPUT — use + * latency_ring_frame_begin for that). */ +void latency_ring_mark(LatencyStage stage); + +/* Re-stamp the current slot's LAT_INPUT to now. Used by the low-latency + * present path, which re-samples the pad AFTER the pacer wait: the input the + * CPU actually reads is this later one, so input_to_swap must measure from it. + * (With this active, input_to_paced is negative and drops out of the summary.) */ +void latency_ring_restamp_input(void); + +/* Note which present backend produced the most recent swaps ("opengl", + * "software", "vulkan"). Reported in the summary so a comparison is labelled. */ +void latency_ring_set_backend(const char *name); + +/* Note the effective present mode / swap interval for the summary label + * (e.g. 1 = vsync, 0 = immediate, -1 = adaptive; other backends pass their + * own code). Purely descriptive. */ +void latency_ring_set_present_mode(int mode); + +/* JSON summary over the last `window` completed frames (clamped): mean/min/max/ + * p50/p95 in microseconds of frame_period, input->swap, and swap_block (the + * present/swap blocking time — the key vsync/queue-latency signal). Writes a + * brace-delimited object into buf; returns bytes written (excluding NUL). */ +int latency_ring_summary_json(char *buf, int buf_size, int window); + +/* JSON array of the last `max_frames` raw frame records (timestamps in + * microseconds relative to the oldest reported frame). */ +int latency_ring_dump_json(char *buf, int buf_size, int max_frames); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_LATENCY_RING_H */ diff --git a/overlay_toolchain/include/launcher_device.h b/overlay_toolchain/include/launcher_device.h new file mode 100644 index 00000000..5d57a793 --- /dev/null +++ b/overlay_toolchain/include/launcher_device.h @@ -0,0 +1,85 @@ +// launcher_device.h - controller-source conversion at the recomp-ui C ABI. + +#pragma once + +#include +#include +#include + +namespace PSXRecompV4 { + +inline std::string trim_launcher_device(const std::string& device) { + const auto first = std::find_if_not(device.begin(), device.end(), + [](unsigned char c) { return std::isspace(c) != 0; }); + const auto last = std::find_if_not(device.rbegin(), device.rend(), + [](unsigned char c) { return std::isspace(c) != 0; }).base(); + return first < last ? std::string(first, last) : std::string(); +} + +inline std::string normalize_launcher_device(const std::string& device) { + std::string normalized = trim_launcher_device(device); + std::transform(normalized.begin(), normalized.end(), normalized.begin(), + [](unsigned char c) { return static_cast(std::tolower(c)); }); + return normalized; +} + +inline int launcher_source_from_device(const std::string& device) { + const std::string normalized = normalize_launcher_device(device); + if (normalized.empty() || normalized == "none") return 0; + if (normalized == "keyboard") return 1; + return 2; +} + +inline std::string launcher_device_from_source( + int source, const std::string& previous_device) { + if (source <= 0) return "none"; + if (source == 1) return "keyboard"; + + // recomp-ui's C ABI currently returns a source category, not the selected + // controller GUID. Preserve an existing gamepad/GUID assignment; when the + // user switched from None/Keyboard, persist the runtime's first-pad alias. + if (launcher_source_from_device(previous_device) == 2) { + return trim_launcher_device(previous_device); + } + return "gamepad"; +} + +// Pad mode for one seat on the way OUT of the launcher. +// +// Three sources of truth have to be reconciled, and they have a strict +// precedence: +// +// 1. A trusted mod's controller-mode override +// (psx_mod_set_controller_mode_override, runtime/include/mod_plugins.h). +// A game plugin that declared the pad type its patched code needs +// outranks everything else. Pass -1 when no override is active. +// 2. game.toml [controller] lock_mode. A locked title supports exactly one +// pad type, and the launcher HIDES its pad-mode selector for such a +// title -- so whatever came back in ls.pad_mode[] for that seat was +// never a player choice and must not be believed. +// 3. What the launcher returned. +// +// Both launcher-exit readback loops in runtime/src/main.cpp call this, and +// both call it BEFORE the seat's mode is written to settings.toml, so an +// unsupported mode can never be persisted either. +// +// Note what is deliberately NOT here: a keyboard seat is not forced to +// DIGITAL. It already behaves as a plain digital pad -- effective_player_mode() +// reports DIGITAL for any seat whose kind is keyboard, whatever this value +// says -- so overwriting the stored mode bought nothing and cost a durable +// corruption. A release install defaults Player 1 to the keyboard, and a +// locked title has no selector with which to repair the value, so an +// ANALOG-locked dual-analog game (Ape Escape) reached its DualShock as an +// SCPH-1080: sio.c took the 4-byte pad_response_len branch, right stick dead +// and left stick folded onto the D-pad. The matching launcher-side coercion is +// fixed in recomp-ui's launcher_model.c. +inline int resolve_player_mode_after_launcher(int launcher_mode, + bool lock_mode, + int locked_mode, + int mod_override_mode) { + if (mod_override_mode >= 0) return mod_override_mode; + if (lock_mode) return locked_mode; + return launcher_mode; +} + +} // namespace PSXRecompV4 diff --git a/overlay_toolchain/include/load_accel.h b/overlay_toolchain/include/load_accel.h new file mode 100644 index 00000000..3610899b --- /dev/null +++ b/overlay_toolchain/include/load_accel.h @@ -0,0 +1,40 @@ +/* load_accel.h -- opt-in, verified load-time acceleration primitives. */ +#ifndef PSXRECOMP_LOAD_ACCEL_H +#define PSXRECOMP_LOAD_ACCEL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct CPUState; + +int psx_vsync_query_hle_enter(struct CPUState* cpu, uint32_t func, + uint32_t counter_addr, uint32_t gpustat_ptr_addr, + uint32_t timer1_ptr_addr, + uint32_t timer1_cache_addr); +/* Runtime configure + dispatch-time try (works without per-func codegen emit). + * Call configure once from game.toml load; dispatch calls try before entry->fn. */ +void psx_vsync_query_hle_configure(uint32_t func, uint32_t counter_addr, + uint32_t gpustat_ptr_addr, + uint32_t timer1_ptr_addr, + uint32_t timer1_cache_addr); +int psx_vsync_query_hle_try(struct CPUState* cpu, uint32_t dispatch_addr); +void psx_vsync_query_hle_set_enabled(int on); +void psx_vsync_query_hle_set_horizon_enabled(int on); +void psx_vsync_query_hle_set_extra_horizon_enabled(int on); +/* When set, any VSync(-1) may event-horizon while CD is busy (not only listed + * return PCs). MotK FMV polls hit many sites; the 16-site allowlist left ~99% + * of query calls without a guest-time skip. */ +void psx_vsync_query_hle_set_horizon_any(int on); +void psx_vsync_query_hle_add_event_horizon_site(uint32_t return_pc); +void psx_vsync_query_hle_add_extra_event_horizon_site(uint32_t return_pc); +void psx_vsync_query_hle_stats_json(char* buf, int cap); +/* Cumulative VSync(-1) event-horizon skips (for post-load probe deltas). */ +void psx_vsync_query_hle_horizon_totals(uint64_t *hits, uint64_t *cycles); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/include/load_transition_ring.h b/overlay_toolchain/include/load_transition_ring.h new file mode 100644 index 00000000..0dd4385e --- /dev/null +++ b/overlay_toolchain/include/load_transition_ring.h @@ -0,0 +1,29 @@ +#ifndef PSXRECOMP_LOAD_TRANSITION_RING_H +#define PSXRECOMP_LOAD_TRANSITION_RING_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Host-side load/pacing edge telemetry. An entry is appended whenever the + * physical CD read state, bridged logical-load predicate, or turbo state + * changes. This is deliberately observational: it does not alter pacing. */ +typedef struct { + uint32_t frame; + uint32_t host_ms; + uint16_t load_run; + uint8_t read_active; + uint8_t load_active; + uint8_t turbo_active; +} LoadTransitionEntry; + +uint64_t load_transition_total(void); +int load_transition_get(uint64_t seq, LoadTransitionEntry *out); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_LOAD_TRANSITION_RING_H */ diff --git a/overlay_toolchain/include/lockstep.h b/overlay_toolchain/include/lockstep.h new file mode 100644 index 00000000..56e0b9e9 --- /dev/null +++ b/overlay_toolchain/include/lockstep.h @@ -0,0 +1,87 @@ +/* lockstep.h — #2 lockstep "unit-test interp" comparator. + * + * Per-basic-block differential check: the compiled block runs (RECORD mode, + * its memory ops captured), then the SAME block is re-interpreted from the + * same entry state (REPLAY mode, memory ops fed from the recorded trace so the + * replay is side-effect-free and MMIO-safe). If the interp replay reads a + * different address, writes a different value, or ends with different + * registers, that block's compiled output is wrong -> the exact codegen defect. + * If NO block ever diverges, the regression is timing/IRQ-phase, not codegen. + * + * Dev tooling only: the per-block hook is debug_server_cyc_observe, which is + * PSX_NO_DEBUG_TOOLS-stripped in release builds. Window-gated (frame range) so + * it's off (full speed) outside the region of interest. + */ +#pragma once +#include +#include "cpu_state.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* 0=off, 1=record (compiled block running), 2=replay (interp re-run). */ +extern int g_ls_mode; +/* 1 while replaying: cycle/icache accounting no-ops so the replay never + * perturbs real global timing state. */ +extern int g_ls_replay_active; + +/* Side-effect-free whole-call trace used by the overlay differential gate. + * RECORD executes the interpreter authoritatively and records every memory + * operation. REPLAY feeds the recorded reads to native code and verifies + * writes without touching RAM, scratchpad, or MMIO a second time. These calls + * are deliberately single-owner/non-nestable; a false return fails the + * comparison closed. */ +int ls_shadow_record_begin(void); +int ls_shadow_record_end(uint32_t *ops, int *saw_exception); +int ls_shadow_replay_begin(void); +int ls_shadow_replay_end(uint32_t *ops, int *mismatch_kind, + uint32_t *pc, uint32_t *addr, + uint32_t *expected, uint32_t *actual); +void ls_shadow_abort(void); +/* A recorded effect the replay cannot reproduce fails the record closed (the + * comparison is skipped, as for a device touch). memory.c calls it for a + * cache-isolated store: its I-cache effect depends on BIU state, and the + * replay neither writes the BIU nor stores. No-op outside a shadow record. */ +void ls_shadow_record_unreplayable(void); + +/* Memory chokepoint hooks, called from the psx_read_ and psx_write_ funcs. */ +uint32_t ls_read_hook(uint32_t addr, int size, uint32_t real_val); +void ls_write_hook(uint32_t addr, int size, uint32_t val); + +/* Per-basic-block-leader entry, called from debug_server_cyc_observe. */ +void ls_at_leader(uint32_t leader_phys, CPUState *cpu); + +/* Dispatch-segment comparator: wraps one clean psx_dispatch_game_compiled() + * invocation and replays the same callable through exec_one until it reaches + * the same returned cpu->pc. This measures the native CPS unit, not just one + * basic block. */ +void ls_func_enter(uint32_t entry_pc, CPUState *cpu); +void ls_func_exit(uint32_t entry_pc, CPUState *cpu, int handled); +void ls_func_set_window(uint32_t frame_lo, uint32_t frame_hi); +void ls_func_set_record_only(int on); + +/* Called at real IRQ exception entry. Function-scope comparisons skip segments + * that delivered an interrupt, keeping codegen/tooling checks separate from + * event-phase behavior. */ +void ls_note_exception_entry(void); + +/* Suppress lockstep memory recording while runtime/debug observers read guest + * RAM for diagnostics. These reads are not guest instructions and must not + * become part of the compiled-vs-interp trace. */ +void ls_suppress_begin(void); +void ls_suppress_end(void); + +/* Arm the comparator over a guest-frame window [lo,hi]. hi==0 => disabled. */ +void ls_set_window(uint32_t frame_lo, uint32_t frame_hi); + +/* Diagnostic: record blocks but skip the inline replay (to test whether the + * inline replay, not recording, is what perturbs the run). */ +void ls_set_record_only(int on); + +/* Drain the first-divergence record as JSON into buf. Returns bytes written. */ +int ls_get_diverge_json(char *buf, int buflen); +int ls_get_func_json(char *buf, int buflen); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/mdec.h b/overlay_toolchain/include/mdec.h new file mode 100644 index 00000000..b2e5993f --- /dev/null +++ b/overlay_toolchain/include/mdec.h @@ -0,0 +1,95 @@ +#ifndef PSXRECOMP_MDEC_H +#define PSXRECOMP_MDEC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void mdec_init(void); +uint32_t mdec_read(uint32_t addr); +void mdec_write(uint32_t addr, uint32_t value); + +void mdec_dma_write_word(uint32_t value); +uint32_t mdec_dma_read_word(void); +/* Contiguous LE bursts — bit-identical to N× word helpers; MotK FMV DMA. */ +uint32_t mdec_dma_write_words(const uint32_t *src, uint32_t max_words); +uint32_t mdec_dma_read_words(uint32_t *dst, uint32_t max_words); +int mdec_dma_write_ready(void); +int mdec_dma_read_ready(void); + +/* FMV detector: nonzero if a colour (15/24-bit) MDEC decode ran within the + * last `within_frames` vblanks. Streamed video decodes continuously; the + * widescreen present pins such frames to native 4:3 (FMVs are authored 4:3 + * and get no GTE squash to compensate the stretch). */ +int mdec_recently_active(uint32_t within_frames); +/* Guest cycles since last colour decode; UINT64_MAX if never / reset. */ +uint64_t mdec_color_age_cycles(void); + +typedef struct MDECDebugState { + uint32_t command; + uint32_t expected_halfwords; + uint32_t input_count; + uint32_t output_size; + uint32_t output_pos; + uint32_t output_depth; + uint32_t output_signed; + uint32_t output_bit15; + uint32_t busy; + uint32_t input_full; + uint32_t enable_dma_in; + uint32_t enable_dma_out; + uint32_t last_status; + uint32_t decode_macroblocks; + uint32_t decode_blocks; + uint32_t decode_stop_reason; + uint32_t decode_input_pos; + uint32_t decode_input_end; + uint32_t dma_in_words; + uint32_t dma_out_words; + uint32_t dma_read_underflows; +} MDECDebugState; + +typedef struct MDECDebugEvent { + uint64_t seq; + uint32_t frame; + uint32_t kind; + uint32_t value; + uint32_t command; + uint32_t input_count; + uint32_t expected_halfwords; + uint32_t output_size; + uint32_t output_pos; + uint32_t macroblocks; + uint32_t blocks; + uint32_t stop_reason; + uint32_t underruns; +} MDECDebugEvent; + +/* Monotonic decode-invocation counter — frontend FMV detector samples this + * per display-frame to detect active MDEC video (FMV) vs idle. */ +uint32_t mdec_get_decode_count(void); + +void mdec_debug_get_state(MDECDebugState *out); +uint64_t mdec_debug_get_event_total(void); +uint32_t mdec_debug_copy_events(uint64_t seq_lo, uint64_t seq_hi, + MDECDebugEvent *out, uint32_t max_count); +void mdec_debug_clear(void); +void mdec_debug_dma_in_start(uint32_t addr, uint32_t words); +void mdec_debug_dma_in_end(uint32_t addr, uint32_t words); +void mdec_debug_dma_out_start(uint32_t addr, uint32_t words); +void mdec_debug_dma_out_end(uint32_t addr, uint32_t words); + +/* boot_state / savestate: full MDEC FIFO + tables (required for FMV resume). */ +uint32_t mdec_snapshot_bytes(void); +void mdec_snapshot_write(uint8_t *p); +int mdec_snapshot_read(const uint8_t *p, uint32_t len); +/* 1 iff mdec_snapshot_read(p, len) would accept the section; mutates nothing. */ +int mdec_snapshot_validate(const uint8_t *p, uint32_t len); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_MDEC_H */ diff --git a/overlay_toolchain/include/memcard.h b/overlay_toolchain/include/memcard.h new file mode 100644 index 00000000..1fe62fc5 --- /dev/null +++ b/overlay_toolchain/include/memcard.h @@ -0,0 +1,97 @@ +#ifndef PSXRECOMP_MEMCARD_H +#define PSXRECOMP_MEMCARD_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define MEMCARD_SIZE (128 * 1024) /* 128KB per card */ +#define MEMCARD_SECTOR_SIZE 128 +#define MEMCARD_SECTORS 1024 + +/* Initialize memcard subsystem. dir = directory for .mcd files (can be NULL). + * Loads (or formats+creates) card1.mcd / card2.mcd in `dir` for both slots. */ +void memcard_init(const char* dir); + +/* Per-slot configuration for memcard_init_slots(). */ +typedef struct { + const char* path; /* explicit .mcd path; NULL => derive /card.mcd */ + int enabled; /* 0 => slot is empty (no card inserted, never present) */ +} MemcardSlotConfig; + +/* Initialize memcard subsystem with per-slot paths + enable flags. A disabled + * slot is left absent (memcard_is_present() returns 0, SIO reports no device). + * An enabled slot loads its file, or formats+creates it if missing. `dir` is + * only used to derive default paths for slots whose path is NULL. */ +void memcard_init_slots(const char* dir, const MemcardSlotConfig slots[2]); + +/* Stateless on-disk introspection (used by the launcher before boot). Parses a + * .mcd file's directory frames without touching the live card array. */ +typedef struct { + int exists; /* file present and readable */ + int valid; /* 128KB and "MC" magic in frame 0 */ + int used_blocks; /* directory frames in use (0..15) */ + int total_blocks; /* always 15 */ + uint8_t block_used[15];/* per-block: 1 = occupied, 0 = free */ + long long mtime; /* file mtime (unix seconds); 0 if unknown */ + long long size_bytes; /* on-disk file size */ +} MemcardSummary; + +/* Parse `path` into `out`. Returns 0 always (out->exists/valid report failure). + * Returns -1 only for a NULL argument. */ +int memcard_summary_path(const char* path, MemcardSummary* out); + +/* Write a freshly formatted (blank) 128KB card image to `path`, creating or + * overwriting it. Returns 0 on success, -1 on I/O failure. */ +int memcard_format_file(const char* path); + +/* Read/write 128-byte sectors */ +int memcard_read_sector(int card, int sector, uint8_t* buf); +int memcard_write_sector(int card, int sector, const uint8_t* buf); + +/* Flush pending writes to disk */ +void memcard_flush(int card); +void memcard_flush_all(void); + +/* Check if card is present */ +int memcard_is_present(int card); + +/* Debug accessors: file path used for slot, magic at offset 0..1, total bytes loaded. + * Returns 0 on success, -1 if slot index is out of range. */ +int memcard_debug_info(int card, const char **path_out, + uint8_t magic_out[2], int *present_out, + int *dirty_out); + +/* Copy raw bytes out of the in-memory card image. Used by the debug server + * to verify that what the runtime loaded matches the on-disk file. + * Returns the number of bytes copied (0 if slot empty / range invalid). */ +int memcard_debug_read_buffer(int card, uint32_t offset, uint32_t len, + uint8_t *dst); + +/* Export / import a full 128KB card image (present cards only for export). + * import marks dirty and flushes to the bound filepath. Returns 0 on success. */ +int memcard_export_raw(int card, uint8_t *dst); +int memcard_import_raw(int card, const uint8_t *src); + +/* Redirect on-disk paths for both slots (e.g. guest netplay sandbox) without + * reloading RAM. Subsequent flushes write to the new paths. Returns 0. */ +int memcard_rebind_dir(const char *dir); + +/* Restore explicit per-slot filepaths (from a prior snapshot). NULL path skips. */ +int memcard_rebind_paths(const char *path0, const char *path1); + +/* Rebind ONE slot's on-disk path without touching RAM. An empty/NULL path + * unbinds the slot (no file, not present) — the way to put back a slot the + * player had disabled after a sandbox bound it. Returns 0, -1 on bad slot. */ +int memcard_rebind_path(int card, const char *path); + +/* Reload in-memory images from the currently bound filepaths (0 = ok). */ +int memcard_reload_bound(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_MEMCARD_H */ diff --git a/overlay_toolchain/include/mod_media.h b/overlay_toolchain/include/mod_media.h new file mode 100644 index 00000000..dc551898 --- /dev/null +++ b/overlay_toolchain/include/mod_media.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace PSXRecompV4 { + +/* Canonical bytes are an immutable, engine-owned snapshot. Plugins never + * reopen the selected file after verification. The PSX domain contains the + * first data track's 2048-byte sector payloads, excluding CD audio. */ +bool load_mod_media(const std::filesystem::path& path, + const std::string& format, uint64_t expected_size, + const std::string& expected_sha256, + std::shared_ptr>& bytes, + std::string* error = nullptr); + +} // namespace PSXRecompV4 diff --git a/overlay_toolchain/include/mod_memory.h b/overlay_toolchain/include/mod_memory.h new file mode 100644 index 00000000..93c8de19 --- /dev/null +++ b/overlay_toolchain/include/mod_memory.h @@ -0,0 +1,68 @@ +#ifndef PSXRECOMP_MOD_MEMORY_H +#define PSXRECOMP_MOD_MEMORY_H + +#include +#include "psx_memory.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GPU linked-list tags carry only 24 address bits. Trusted enhancements that + * need a larger primitive arena use this otherwise-unmapped 8 MiB aperture so + * their CPU pointers survive the tag truncation. Nothing is mapped until an + * enhancement explicitly allocates from it. + */ +#define PSX_MOD_GPU_DMA_APERTURE_BASE 0x00800000u +#define PSX_MOD_GPU_DMA_APERTURE_SIZE (8u * 1024u * 1024u) +#define PSX_MOD_GPU_DMA_GUEST_BASE 0x80800000u + +static inline int psx_mod_gpu_dma_aperture_offset_for( + uint32_t address, uint32_t width, uint32_t used, uint32_t *offset) { + /* CPU addresses retain all physical bits after KSEG normalization. The + * BIOS at 0x1FC00000 must never alias the enhancement aperture. + * DMA callers pass an already-truncated 24-bit tag separately below. */ + uint32_t canonical = address & 0x1FFFFFFFu; + uint32_t off; + if (canonical < PSX_MOD_GPU_DMA_APERTURE_BASE || + canonical >= 0x01000000u || used > PSX_MOD_GPU_DMA_APERTURE_SIZE) + return 0; + off = canonical - PSX_MOD_GPU_DMA_APERTURE_BASE; + if (off > used || width > used - off) return 0; + if (offset) *offset = off; + return 1; +} + +/* + * Fold DMA addresses through live main RAM unless the address is inside the + * portion of the enhancement aperture that has actually been allocated. + */ +static inline uint32_t psx_mod_gpu_dma_resolve_address_for( + uint32_t address, uint32_t used) { + uint32_t canonical = address & 0x00FFFFFCu; + if (psx_mod_gpu_dma_aperture_offset_for( + canonical, 4u, used, (uint32_t *)0)) + return canonical; + /* 24-bit tag bits above the 8 MiB decode window are ignored, then the + * live geometry folds (retail: exactly the DMAC's 0x1FFFFC). */ + return psx_ram_canonical_offset(canonical) & ~3u; +} + +uint32_t psx_mod_gpu_dma_memory_alloc(uint32_t size, uint32_t alignment); +uint32_t psx_mod_gpu_dma_resolve_address(uint32_t address); +uint32_t psx_mod_memory_alloc(uint32_t size, uint32_t alignment); +/* Allocations are fixed during activation. Snapshot allocated bytes, never + * host pointers; immutable host assets are reconstructed separately. */ +uint32_t psx_mod_memory_snapshot_bytes(void); +void psx_mod_memory_snapshot_write(uint8_t* out); +int psx_mod_memory_snapshot_read(const uint8_t* data, uint32_t size); +/* 1 iff psx_mod_memory_snapshot_read would accept the section; mutates nothing. */ +int psx_mod_memory_snapshot_validate(const uint8_t* data, uint32_t size); +uint32_t psx_mod_memory_layout_cookie(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/mod_packages.h b/overlay_toolchain/include/mod_packages.h new file mode 100644 index 00000000..57ab8476 --- /dev/null +++ b/overlay_toolchain/include/mod_packages.h @@ -0,0 +1,580 @@ +#pragma once + +#include "mod_plugins.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace PSXRecompV4 { + +/* How finished a feature is, and therefore who is allowed to see it. + * + * Stable ships and is offered to everyone. Experimental ships, badged, and is + * default-off: it works, but has not been validated on this title. Developer + * does not ship at all -- contributors reach those features by cloning the + * repo and building locally. + * + * This lives on the FEATURE, not the package. A package is the trust and + * installation boundary; how finished one of its features is has nothing to do + * with that, and tying the two forced a whole catalog down to the maturity of + * its least finished feature. A package may still declare a channel, which its + * features inherit unless they state their own. */ +enum class ModChannel { + Stable = 0, + Experimental = 1, + Developer = 2, +}; + +/* Whether this build may see developer-channel features. A local build may; a + * CI/release build may not, which is what "developer does not ship" means in + * practice. runtime.cmake defines PSX_MOD_DEVELOPER_CHANNEL for local builds. */ +#if defined(PSX_MOD_DEVELOPER_CHANNEL) && PSX_MOD_DEVELOPER_CHANNEL +inline constexpr bool kDeveloperChannelDefault = true; +#else +inline constexpr bool kDeveloperChannelDefault = false; +#endif + +const char* mod_channel_name(ModChannel channel); +bool mod_channel_from_name(const std::string& name, ModChannel& out); + +enum class ModOptionType { + Boolean, + Choice, + Integer, +}; + +struct ModChoice { + std::string value; + std::string label; +}; + +struct ModOption { + std::string feature_id; + std::string id; + std::string label; + std::string description; + std::string group; + ModOptionType type = ModOptionType::Boolean; + std::string default_value; + int64_t min_value = 0; + int64_t max_value = 0; + int64_t step = 1; + std::vector choices; + /* Optional id of a BOOLEAN option in the same feature that overrides this + * one. While that option is true this control is inert: the launcher greys + * it out and plugins ignore its value. Models "tick Instant and the speed + * box stops mattering" without inventing a second widget type. */ + std::string disabled_by; +}; + +struct ModFeature { + std::string id; + std::string name; + std::string author; + std::string description; + std::string group = "General"; + ModChannel channel = ModChannel::Stable; + bool default_enabled = false; + bool hidden = false; + bool legacy = false; +}; + +enum class ModConstraintKind { + OrderedInteger, + RequiresFeature, +}; + +enum class ModConstraintDirection { + Nondecreasing, + Nonincreasing, +}; + +struct ModConstraint { + std::string feature_id; + ModConstraintKind kind = ModConstraintKind::OrderedInteger; + ModConstraintDirection direction = + ModConstraintDirection::Nondecreasing; + std::vector options; + std::string required_feature_id; + std::string required_option_id; + std::string required_value; +}; + +struct ModRequirement { + std::string id; + std::string version; +}; + +/* A feature of this package that needs a feature of ANOTHER package while a + * condition on its own options holds (manifest [[requirement]], format 7). + * + * Package-level [[dependency]] is unconditional, and an in-package + * requires_feature constraint cannot name another package. This is the + * missing shape: "Extras = Full needs psx.enhancement.8mb-ram/8mb-ram". The + * required feature is DERIVED for the session -- resolve() activates it even + * when it is hidden or disabled in state.toml -- and is never written to + * state.toml, because the player did not choose it. A requirement that cannot + * be met (package absent, excluded, wrong version, feature missing) fails the + * plan loudly; it never runs the requiring selection without it. */ +struct ModFeatureRequirement { + std::string feature_id; /* the requiring feature (owner) */ + std::string package_id; /* the package that provides it */ + std::string version = "*"; /* same range syntax as [[dependency]] */ + std::string required_feature_id; /* feature of package_id to activate */ + std::map when; /* owner's option conditions */ +}; + +struct ModTarget { + std::string game_id; + std::string exe_sha256; + std::string disc_sha256; +}; + +enum class ModPatchTarget { + MainExe, + DiscRaw, + DiscUser, +}; + +enum class ModValueEncoding { + U8, + U16LE, + U32LE, + MipsLuiOriU32, +}; + +enum class ModIntegerPredicateOp { + Equal, + NotEqual, + Less, + LessEqual, + Greater, + GreaterEqual, +}; + +struct ModIntegerPredicate { + bool present = false; + std::string option; + ModIntegerPredicateOp op = ModIntegerPredicateOp::Equal; + int64_t value = 0; +}; + +struct ModPatchField { + uint64_t offset = 0; + std::vector replacement; + std::string replace_from_option; + ModValueEncoding replace_encoding = ModValueEncoding::U8; + int64_t replace_addend = 0; +}; + +struct ModPatch { + std::string feature_id; + ModPatchTarget target = ModPatchTarget::MainExe; + uint64_t location = 0; /* guest address or canonical disc-stream byte offset */ + std::vector expected; + std::vector replacement; + std::string replace_from_option; + ModValueEncoding replace_encoding = ModValueEncoding::U8; + uint64_t replace_offset = 0; + int64_t replace_addend = 0; + bool replace_omit_when_default = false; + std::string when_option; + std::string when_value; + std::map when; + ModIntegerPredicate when_integer; + std::vector fields; + int64_t order = 0; +}; + +struct ModOverlay { + std::string feature_id; + ModPatchTarget target = ModPatchTarget::DiscRaw; + uint64_t location = 0; + std::filesystem::path file; + std::string sha256; + std::string expected_sha256; + uint64_t size = 0; + std::map when; + struct FeaturePredicate { + bool present = false; + std::string package_id; + std::string feature_id; + bool enabled = true; + } when_feature; + int64_t order = 0; +}; + +struct ModPlugin { + std::string feature_id; + std::string id; + std::map when; + int64_t order = 0; +}; + +struct ModResource { + std::string feature_id; + std::string id; + std::string label; + std::string description; + std::string file_patterns; + std::string file_description; + std::string format = "file"; + bool required = false; + uint64_t size = 0; + std::string sha256; +}; + +struct ModDerivedDisc { + std::string kind = "vcdiff"; + std::filesystem::path patch; + std::string patch_sha256; + uint64_t output_size = 0; + std::string output_sha256; + std::string when_option; + std::string when_value; + std::map when; +}; + +struct ModAuthorLink { + std::string name; + std::string url; +}; + +/* Where a package's files came from, and therefore who owns them on disk. + * + * Bundled packages are build output: the framework and the title stage them + * into /mods/bundled, which every build wipes and re-stages. Nothing the + * player owns may live there. Installed packages are written by the launcher + * into /mods/installed and are never touched by a build. + * + * Before this split there was one /mods/packages tree serving both roles, + * so a rebuild deleted every mod the player had installed. */ +enum class ModPackageOrigin { + Bundled, + Installed, +}; + +struct ModPackage { + uint32_t format_version = 0; + std::string id; + std::string version; + std::string name; + std::string author; + std::vector author_links; + std::string description; + std::string license; + std::string source_name; + std::string source_url; + std::string resolver = "declarative"; + std::string save_compatibility = "shared"; + /* Default channel for features that do not declare their own. */ + ModChannel channel = ModChannel::Stable; + ModPackageOrigin origin = ModPackageOrigin::Installed; + /* Set when an installed package of the same id shadows a bundled one. */ + bool shadows_bundled = false; + std::filesystem::path root; + std::vector targets; + std::vector dependencies; + std::vector conflicts; + std::vector features; + std::vector options; + std::vector constraints; + std::vector requirements; + std::vector patches; + std::vector overlays; + std::vector plugins; + std::vector resources; + std::vector derived_discs; +}; + +struct ModFeatureSelection { + bool enabled = false; + bool has_enabled = false; + std::map values; + std::map resources; +}; + +struct ModSelection { + /* v1 migration state. Feature-style manifests do not use these fields. */ + bool enabled = false; + std::string version; + std::map values; + std::map features; +}; + +struct ModResolution { + bool ok = false; + std::string fingerprint; + std::vector ordered; + struct Write { + struct Field { + uint64_t offset = 0; + std::vector replacement; + }; + ModPatchTarget target = ModPatchTarget::MainExe; + uint64_t location = 0; + std::vector expected; + std::vector replacement; + std::vector fields; + std::string package_id; + std::string feature_id; + }; + std::vector writes; + struct Overlay { + ModPatchTarget target = ModPatchTarget::DiscRaw; + uint64_t location = 0; + std::vector payload; + std::string payload_sha256; + std::string expected_sha256; + std::string package_id; + std::string feature_id; + }; + std::vector overlays; + struct DerivedDisc { + std::string kind; + std::filesystem::path patch; + std::string patch_sha256; + uint64_t output_size = 0; + std::string output_sha256; + std::string package_id; + }; + std::vector derived_discs; + struct Plugin { + std::string id; + std::string package_id; + std::string feature_id; + }; + std::vector plugins; + struct Resource { + std::string package_id; + std::string feature_id; + std::string id; + std::filesystem::path path; + std::string format; + std::string sha256; + std::shared_ptr> bytes; + }; + std::vector resources; + struct Diagnostic { + std::string message; + std::string resource; + std::string package_id; + std::string feature_id; + std::string other_package_id; + std::string other_feature_id; + }; + std::vector diagnostics; + /* Features the plan activates because an active [[requirement]] needs + * them, not because state.toml enables them. One entry per derived + * feature (the first requirement that activated it). */ + struct ImplicitFeature { + std::string package_id; + std::string feature_id; + std::string required_by_package_id; + std::string required_by_feature_id; + }; + std::vector implicit_features; + /* The selection the plan was built from: state.toml's selection plus the + * implicit activations above. Plugins read option values from this, so a + * committed plan and the values its plugins observe cannot disagree. */ + std::map selections; + std::vector errors; +}; + +struct ModBuiltinResolverContext { + const std::map* active_packages = nullptr; + const std::map* selections = nullptr; +}; + +using ModBuiltinResolver = std::function& writes, + std::vector& errors)>; + +class ModPackageManager { +public: + explicit ModPackageManager(std::filesystem::path mods_root = {}); + + void set_root(std::filesystem::path mods_root); + const std::filesystem::path& root() const { return root_; } + /* Developer-channel features are stripped at scan and install time unless + * this is set. Defaults to kDeveloperChannelDefault; tests set it + * explicitly so they exercise both a local and a release build. */ + void set_developer_channel_visible(bool visible) { + developer_channel_ = visible; + } + bool developer_channel_visible() const { return developer_channel_; } + + /* Build-owned catalog: wiped and re-staged by every build. */ + std::filesystem::path bundled_root() const { return root_ / "bundled"; } + /* Launcher-owned catalog: a build never touches this tree. */ + std::filesystem::path installed_root() const { return root_ / "installed"; } + + bool scan(std::string* error = nullptr); + bool load_state(std::string* error = nullptr); + bool save_state(std::string* error = nullptr) const; + + bool install_archive(const std::filesystem::path& archive, + std::string* installed_id = nullptr, + std::string* installed_version = nullptr, + std::string* error = nullptr); + bool remove_version(const std::string& id, const std::string& version, + std::string* error = nullptr); + + bool set_enabled(const std::string& id, bool enabled, std::string* error = nullptr); + bool select_version(const std::string& id, const std::string& version, + std::string* error = nullptr); + bool set_option(const std::string& id, const std::string& option, + const std::string& value, std::string* error = nullptr); + bool set_feature_enabled(const std::string& package_id, + const std::string& feature_id, bool enabled, + std::string* error = nullptr); + bool set_feature_option(const std::string& package_id, + const std::string& feature_id, + const std::string& option_id, + const std::string& value, + std::string* error = nullptr); + bool set_feature_resource_path(const std::string& package_id, + const std::string& feature_id, + const std::string& resource_id, + const std::filesystem::path& path, + std::string* error = nullptr); + + const std::map>& packages() const { + return packages_; + } + const std::map& selections() const { return selections_; } + const ModPackage* selected_package(const std::string& id) const; + const ModFeature* selected_feature(const std::string& package_id, + const std::string& feature_id) const; + bool feature_enabled(const std::string& package_id, + const std::string& feature_id) const; + std::string feature_option_value(const std::string& package_id, + const std::string& feature_id, + const std::string& option_id) const; + std::filesystem::path feature_resource_path( + const std::string& package_id, + const std::string& feature_id, + const std::string& resource_id) const; + /* True when an active [[requirement]] activates this feature for the + * session although state.toml does not enable it. feature_enabled() keeps + * answering for the player's own choice, which is what the launcher shows + * and what save_state() persists. */ + bool feature_implicitly_enabled(const std::string& package_id, + const std::string& feature_id) const; + /* An option value as a resolved plan sees it (plan.selections), for + * plugins running under that plan. */ + std::string feature_option_value(const ModResolution& plan, + const std::string& package_id, + const std::string& feature_id, + const std::string& option_id) const; + + ModResolution resolve(const std::string& game_id, + const std::string& exe_sha256 = {}, + const std::string& disc_sha256 = {}) const; + + static bool read_manifest(const std::filesystem::path& path, ModPackage& out, + std::string* error = nullptr); + + /* Manifests that failed to parse during the last scan(), as + * ": ". A package that cannot be read must never vanish + * silently -- the launcher surfaces these so a mod author sees why their + * package is absent from the list. */ + const std::vector& scan_errors() const { return scan_errors_; } + + /* Package ids that mods/state.toml carries a selection for but that no + * catalog root holds -- a package the player removed, a developer-only + * package a release build stripped, or a framework builtin the title + * excludes (EXCLUDE_BUILTIN_MODS). Such a selection is DORMANT: resolve() + * never visits it, so it contributes nothing to the plan, and save_state() + * keeps it verbatim so the choice returns if the package ever does. The + * runtime names these once at startup instead of dropping them silently. */ + std::vector dormant_selections() const; + +private: + /* One-time move of a pre-split /mods/packages tree into the two + * owned roots. Anything the build also staged into bundled/ is dropped; + * everything else is the player's and moves to installed/. */ + void migrate_legacy_root(); + bool scan_root(const std::filesystem::path& packages_root, + ModPackageOrigin origin, std::string* error); + /* selections_ plus every feature an active [[requirement]] derives, + * iterated to a fixed point (a derived feature may carry requirements of + * its own). Unmet requirements are reported through errors/diagnostics. + * Never touches selections_: derived activations are not player choices. */ + std::map effective_selections( + std::vector* implicit, + std::vector* diagnostics, + std::vector* errors) const; + + std::filesystem::path root_; + bool developer_channel_ = kDeveloperChannelDefault; + std::vector scan_errors_; + std::map> packages_; + std::map selections_; +}; + +bool mod_register_builtin_resolver(const std::string& id, ModBuiltinResolver resolver); +void mod_clear_builtin_resolvers_for_tests(); +bool mod_register_activation_plugin(const std::string& id, void (*callback)(void)); +bool mod_register_vblank_plugin(const std::string& id, void (*callback)(void)); +bool mod_register_savestate_plugin(const std::string& id, void (*callback)(void)); +void mod_invoke_savestate_plugin(const std::string& id); +/* A function-entry hook is a trusted implementation like the others: manifests + * select it by id, and it runs only while a resolved plan activates that id. */ +bool mod_register_function_entry_plugin(const std::string& id, uint32_t address, + PSXModFunctionEntryCallback callback); +bool mod_register_function_filter_plugin(const std::string& id, uint32_t address, + PSXModFunctionFilterCallback callback); +bool mod_register_guest_function_plugin(const std::string& id, uint32_t address, + PSXModFunctionEntryCallback callback); +bool mod_plugin_registered(const std::string& id); +void mod_invoke_activation_plugin(const std::string& id); +void mod_invoke_vblank_plugin(const std::string& id); +struct ModFunctionEntryHook { + uint32_t address = 0; + PSXModFunctionEntryCallback callback = nullptr; + PSXModFunctionFilterCallback filter = nullptr; +}; +/* Hooks one implementation registered, in registration order. mod_runtime + * flattens these into an address table when the plan's plugins activate. */ +std::vector mod_function_entry_hooks(const std::string& id); +std::vector mod_guest_functions(const std::string& id); +struct ModInstructionHook { + uint32_t address, expected; + PSXModFunctionEntryCallback callback; +}; +bool mod_register_instruction_plugin(const std::string& id, uint32_t address, + uint32_t expected, PSXModFunctionEntryCallback callback); +std::vector mod_instruction_hooks(const std::string& id); +void mod_clear_plugins_for_tests(); + +/* Every id a trusted implementation registered (activation, vblank or + * function-entry), sorted. */ +std::vector mod_registered_plugin_ids(); + +/* Registered implementations that no manifest under `manifest_roots` declares + * as a [[plugin]] id. The resolved plan activates plugins by manifest id only, + * so such an implementation can never run: a hook registered under a sub-id + * ("x.widescreen.hud") is silently dead while its package ("x.widescreen") + * resolves cleanly. Roots are searched recursively for manifest.toml; pass the + * AUTHORED trees (title mods/preloaded, framework mods/builtin) so developer + * packages a release catalog strips still count as declarations. Manifests + * that fail to parse are reported through `errors`. */ +struct ModPluginAudit { + std::vector undeclared; /* registered, never declared */ + std::vector declared; /* every manifest [[plugin]] id */ + std::vector errors; + size_t manifests = 0; +}; +ModPluginAudit mod_audit_registered_plugins( + const std::vector& manifest_roots); + +} // namespace PSXRecompV4 diff --git a/overlay_toolchain/include/mod_plugins.h b/overlay_toolchain/include/mod_plugins.h new file mode 100644 index 00000000..0046a14d --- /dev/null +++ b/overlay_toolchain/include/mod_plugins.h @@ -0,0 +1,631 @@ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*PSXModVBlankCallback)(void); +typedef void (*PSXModActivationCallback)(void); +struct CPUState; +typedef void (*PSXModFunctionEntryCallback)(struct CPUState* cpu, + uint32_t address); +/* Return nonzero to finish this opt-in function with the callback's return + * registers. The runtime publishes pc=$ra; zero executes the original body. */ +typedef int (*PSXModFunctionFilterCallback)(struct CPUState* cpu, + uint32_t address); + +/* + * Register a trusted, statically linked plugin implementation. Package + * manifests select implementations by this stable id; archives never provide + * native code or symbol names. + */ +int psx_mod_register_activation_plugin(const char* id, + PSXModActivationCallback callback); +int psx_mod_register_vblank_plugin(const char* id, + PSXModVBlankCallback callback); +/* Runs after successful guest-state restore, before the restored PC resumes. + * Rebind host hooks here; do not advance guest gameplay as a VBlank would. */ +int psx_mod_register_savestate_plugin(const char* id, + PSXModActivationCallback callback); +int psx_mod_register_function_entry_plugin( + const char* id, uint32_t address, PSXModFunctionEntryCallback callback); +/* Mod-defined guest functions have no original machine-code body. Addresses + * must be aligned and in physical 0x0F000000..0x0FFFFFFF (an unused bus range), + * never hardware/BIOS/game text. Only statically linked code can register one; + * the active package plan owns its availability and resource context. Address + * aliases share one globally unique registration. The callback supplies the + * full function behavior; return publishes $ra through normal dispatch. */ +int psx_mod_register_guest_function_plugin( + const char* id, uint32_t address, PSXModFunctionEntryCallback callback); +int psx_mod_dispatch_guest_function(struct CPUState* cpu, uint32_t address); +extern uint32_t g_psx_mod_guest_functions; +/* Run immediately before a configured instruction, including delay slots. + * The complete instruction word must match both registration and live RAM. + * Callbacks may update registers/data but cannot redirect PC, finish a guest + * function, or re-enter guest execution (pending load/branch state is live). + * Native emits opt in with [recompiler] mod_instruction_sites; dirty-RAM + * execution uses the same guarded table. Inactive plans are inert. */ +int psx_mod_register_instruction_plugin(const char* id, uint32_t address, + uint32_t expected, PSXModFunctionEntryCallback callback); +void psx_mod_instruction(struct CPUState* cpu, uint32_t address, uint32_t instruction); +extern uint32_t g_psx_mod_instruction_hooks; +/* Called from generated functions listed by the game config and from every + * interpreted entry, so the hook contract does not depend on the backend. + * Hooks match by code address (segment bits ignored) and run only for plugins + * the active plan resolved; the table is rebuilt at plugin activation. */ +int psx_mod_register_function_filter_plugin( + const char* id, uint32_t address, PSXModFunctionFilterCallback callback); +int psx_mod_function_entry(struct CPUState* cpu, uint32_t address); +/* Complete a guest function from its trusted entry callback after supplying + * its full result. Valid only for that callback's CPU. Publishes pc=$ra and + * prevents the original body from executing. Nested callbacks have separate + * completion scopes; requests outside an entry callback return zero. */ +int psx_mod_finish_function(struct CPUState* cpu); +/* Active function-entry hook count (0 = none). Hot callers test it before the + * call, so a run without an active hook pays one load per interpreted entry. */ +extern uint32_t g_psx_mod_function_entry_hooks; + +/* Always-on named event counters for trusted plugins (observability, not + * logging): e.g. how often each guard in a hook rejected. `name` should be a + * string literal of the form "."; up to 128 distinct names are + * kept, further names are counted in an overflow bucket. Emulation-thread only. + * TCP: {"cmd":"mod_counters"} lists every counter with its last frame. */ +void psx_mod_counter_add(const char* name, uint32_t delta); +/* Presentation-only filtering: 0 nearest, 1 bilinear, 2 stable minification. + * Mode 2 uses a bounded palette-aware footprint for proven 3D polygons on + * OpenGL; untracked UI stays nearest. Other backends use bilinear. A session + * reset restores the player's configured filter. */ +void psx_mod_set_texture_filter(int mode); +/* Entry callbacks can make nested guest calls while retaining host registers. + * Save/load and rewind must wait until that host context has returned. */ +int psx_mod_function_entry_active(void); + +/* Narrow guest services available to trusted plugin callbacks. */ +int psx_mod_game_started(void); +/* Read an original mounted-disc file without changing guest CD state/timing. + * Emulation-thread callbacks only. NULL buffer + zero capacity queries size; + * otherwise capacity must hold the entire file. Active sector mods apply. */ +int psx_mod_read_disc_file(const char* path, void* buffer, uint32_t capacity, + uint32_t* size); +/* Experimental retained-texture service (currently OpenGL only). IDs are + * nonzero, stable game-owned identities, NOT GL names. Banks are immutable + * 16-bit PS1 texels/indices with a caller-selected row pitch (width). + * A missing bank may be reconstructed from original assets by the resolver, + * including when a restored DMA queue refers to a previously unseen level. */ +typedef int (*PSXModTextureBankResolver)(uint16_t id); +int psx_mod_texture_banks_supported(void); +int psx_mod_define_texture_bank(uint16_t id, uint32_t width, uint32_t height, + const uint16_t* pixels); +void psx_mod_set_texture_bank_resolver(PSXModTextureBankResolver resolver); +/* Default-off GL optimization: batch immutable-bank semi triangles in painter + * order on the single-pass dual-source path only. Ordinary VRAM, subtractive + * blending and destination-mask checks retain per-primitive isolation. Call + * from activation or an emulation-thread render boundary. */ +void psx_mod_set_texture_bank_batching(int enabled); +/* A dedicated GPU-DMA packet arena. Only GT3 commands sourced from this + * allocation interpret C1/C2's otherwise-unused high bytes as a bank ID: + * id = (C1 >> 24) | ((C2 >> 24) << 8). ID zero uses ordinary VRAM. The rest + * of the packet is standard GP0, retaining OT order, palettes and STP blend. + * Optional 40-byte suffix after the 40-byte tagged GT3: u32 magic 0x48545031, + * three IEEE float 1/z weights, six IEEE float x/y coordinates. This enables + * precise perspective rendering without transient host-pointer side tables. + * Allocate during activation; do not mix stock game packets into this arena. */ +uint32_t psx_mod_alloc_texture_packet_memory(uint32_t size, uint32_t alignment); +uint8_t psx_mod_read_byte(uint32_t address); +void psx_mod_write_byte(uint32_t address, uint8_t value); +uint16_t psx_mod_read_half(uint32_t address); +void psx_mod_write_half(uint32_t address, uint16_t value); +uint32_t psx_mod_read_word(uint32_t address); +void psx_mod_write_word(uint32_t address, uint32_t value); +/* + * Replace one guest instruction and route that address through the runtime's + * executable-RAM path. Use this instead of psx_mod_write_word for code so a + * restored save state cannot leave the compiled instruction stale. + */ +void psx_mod_write_code_word(uint32_t address, uint32_t value); + +/* + * Allocate opt-in enhancement memory from Expansion 1. Until the first + * allocation, the region remains hardware-faithful open bus. The returned + * KSEG0 address is accessible through normal generated guest loads. + */ +uint32_t psx_mod_alloc_guest_memory(uint32_t size, uint32_t alignment); + +/* + * Allocate guest memory that is also addressable by 24-bit GPU linked-list + * tags. This is intended for opt-in enhanced primitive/ordering-table arenas; + * without an allocation the aperture remains unmapped and DMA stays faithful. + */ +uint32_t psx_mod_alloc_gpu_dma_memory(uint32_t size, uint32_t alignment); + +/* + * Opt into expanded 8 MiB main RAM for this launch. Default runtime behavior + * remains stock 2 MiB mirroring unless a trusted activation plugin requests + * this before memory_init(). + */ +int psx_mod_set_main_ram_8mb(int enabled); + +/* World-culling envelope in native game pixels, including safety guards. */ +int32_t psx_mod_widescreen_x_margin(void); +/* Configured per-side visible reveal, excluding culling guards; zero at 4:3. + * Use for screen-space layout, including the first frame of a new scene. */ +int32_t psx_mod_widescreen_view_x_margin(void); + +/* Opt into render-only recovery of saturated horizontal GTE projections in + * native-wide gameplay. Requires exact packet-address/word provenance and + * depth; never changes guest SXY, vertical coordinates, or the 4:3 path. */ +void psx_mod_set_native_wide_projection_correction(int enabled); +/* Separately qualify near-camera world clipping for a title. The GL path + * carries signed, unclamped projection through exact PGXP word transport, + * clips at the camera/view planes, and preserves ordered GPU/VRAM writes. + * Requires projection correction above; 4:3, software and untracked UI stay + * on their existing paths. No architectural GTE or gameplay changes. */ +void psx_mod_set_native_wide_near_clip(int enabled); +/* Bind render-only NCLIP branch consumers to full instruction words. These + * recover winding only when valid horizontal projections saturated; guest + * MAC0 and flags remain architectural. Empty registration disables the sites. */ +void psx_mod_set_native_wide_nclip_sites(const uint32_t* addresses, + const uint32_t* expected, int count); +/* After registering sites, bind a verified first-of-two quad branch to the + * preceding NCLIP result. Exact address/word must match an existing site; + * registering the base site list again resets every site to the latest result. */ +void psx_mod_set_native_wide_nclip_previous_site(uint32_t address, uint32_t expected); + +/* Mark a guest GPU packet (P_TAG address) as persistent screen-space HUD. + * edge = -1 left, +1 right, 0 clears a reused packet's tag. The native-wide + * compositor translates it by the live reveal, excluding culling guards. + * Guest coordinates, world sprites, and native 4:3 remain unchanged. */ +void psx_mod_tag_hud_primitive(uint32_t primitive, int edge); +/* Packet-guarded screen-space anchor: -1 left, +1 right, 0 stays centred. + * Unlike the legacy role tag above, zero explicitly protects centred text + * from automatic layout transforms. Word immediately before the GP0 colour + * command; for a compound E1+SPRT packet this is its E1 word (P_TAG+4). */ +void psx_mod_anchor_hud_primitive(uint32_t primitive, int edge); +/* Screen-space masks identified by their title's producer, P_TAG addresses. + * Flat panels extend only their exterior boundaries. Radial flat/Gouraud + * quads scale around the display centre for an aspect-aware iris transition. + * Both services are render-only, word guarded and inert at native 4:3. */ +void psx_mod_tag_screen_mask_quad(uint32_t primitive); +void psx_mod_tag_radial_screen_mask_quad(uint32_t primitive, float scale); +/* Exclude a known world packet from screen-space backdrop stretching, even + * if it sorts before the first shaded polygon. Zero clears a recycled tag. */ +void psx_mod_tag_world_primitive(uint32_t primitive, int is_world); +/* Enable aspect-derived column selection for a title that opted into the + * auto_backdrop detector. No effect on titles that did not opt in. */ +void psx_mod_set_adaptive_backdrop_preload(int enabled); + +/* + * Width, in native game pixels, of the picture the guest is currently + * scanning out -- the same value the presenter uses, derived from the display + * mode and the GP1(06h) horizontal range. + * + * Why this exists: a plugin that draws its own overlay primitives needs to + * know where the right-hand edge of the screen is, and it cannot work that + * out for itself. GPUSTAT carries the horizontal-resolution bits, so a plugin + * can recover the coarse MODE width (256/320/512/640, or 368), but the + * visible width also depends on the GP1(06h) X1/X2 range, which is write-only + * and mirrored nowhere the plugin can read. Ape Escape is the worked example: + * it scans out 384 while its mode width is 368, and a plugin that assumed the + * usual 320 put its HUD row 68 pixels short of the edge. + * + * Returns 0 if the display geometry is not yet established, in which case the + * caller should skip drawing rather than substitute a guess. + */ +uint32_t psx_mod_display_width(void); + +/* Height companion to psx_mod_display_width(); same conventions. */ +uint32_t psx_mod_display_height(void); + +/* Opt-in presentation hold for a game that retains its previous framebuffer + * while loading. The pure, cheap emulation-thread predicate returns HOLD + * only while that SAME scene remains displayed; no GPU/API recursion allowed. + * RELEASE resumes normal classification immediately. UNTIL_FLIP releases a + * prior HOLD only once the displayed VRAM origin changes: useful when drawing + * the next backbuffer finishes before it becomes visible. UNTIL_FLIP without + * a prior HOLD does nothing. Do not use it for in-place scene replacements. + * Native-wide retains its prior wide/4:3 classification, never stretches art + * and never overrides FMV. NULL removes the opt-in. Host history is discarded + * on GPU reset/savestate restore, so loading a frozen scene cannot recreate + * missing widescreen strips. This does not change guest rendering or memory. */ +typedef int (*PSXModRetainedScenePredicate)(void); +enum { + PSX_MOD_SCENE_RELEASE = 0, + PSX_MOD_SCENE_HOLD = 1, + PSX_MOD_SCENE_UNTIL_FLIP = 2 +}; +void psx_mod_set_retained_scene_predicate(PSXModRetainedScenePredicate predicate); + +/* Opt-in supplemental native-wide world classifier. A nonzero result marks a + * known, rendered 3D scene (for example a real-time intro) as world content even + * when a game's gameplay-state allowlist excludes it. Zero defers to the normal + * classifier; NULL removes the callback. Only native-wide mode consults it. + * FMV and retained-frame presentation rules still apply. The pure, cheap callback + * runs on the emulation thread: no GPU calls, allocation or guest-state writes. + * Registration is host configuration, not savestate data. No default behavior + * changes and no extra geometry is generated by this service. */ +typedef int (*PSXModWorldScenePredicate)(void); +void psx_mod_set_world_scene_predicate(PSXModWorldScenePredicate predicate); + +/* + * Read the committed value of one of this package's declared options, as the + * player left it in the launcher (or the manifest default when untouched). + * Writes a NUL-terminated string into `out` and returns 1; returns 0 with + * out[0] = '\0' when the plan is not committed, the ids do not resolve, or the + * value does not fit — the caller then applies its own default rather than + * treating an empty string as a selection. + * + * Why this exists: the manifest schema already carries typed, validated, + * launcher-rendered, persisted options ([[option]] boolean/choice/integer), but + * an activation callback takes no arguments and had no way to read them, so a + * trusted plugin could only ever be an on/off switch. A parameterised feature + * then had to be modelled as one feature per value — and `constraint` only + * expresses ordered_integer WITHIN a feature, so those pseudo-features could + * not even be made mutually exclusive. This closes that gap: one feature, one + * option, the plugin reads what was chosen. + * + * Ids are passed explicitly because registration is by plugin id alone and the + * callback carries no package/feature context. + */ +int psx_mod_option_value(const char* package_id, const char* feature_id, + const char* option_id, char* out, uint32_t out_size); +/* + * Read the committed owner-selected path for a resource declared by the + * package feature whose trusted plugin is currently running. Returns 0 when + * the feature has no selected path for that resource; plugins then leave the + * stock presentation unchanged. + */ +int psx_mod_current_resource_path(const char* resource_id, + char* out, uint32_t out_size); +/* Read-only canonical media verified by the engine for this plugin's owning + * package/feature. The pointer lives until the committed plan is replaced or + * cleared. Available only during that plugin's callbacks; returns 0 for an + * ordinary unverified resource, an inactive feature, or a different owner. */ +int psx_mod_current_resource_bytes(const char* resource_id, + const uint8_t** bytes, uint64_t* size); + +/* Append raw Mode-2 sectors (2336 bytes, starting with the XA subheader) + * from a verified resource owned by this activation callback. Returns their + * native CD LBA in first_lba. Registration is deterministic, append-only and + * rejected outside activation, for invalid ranges or beyond 99:59:74. + * The immutable committed snapshot remains mounted until the plan changes; + * no host path or donor data is saved into guest RAM/savestates. */ +int psx_mod_append_disc_extent(const char* resource_id, uint64_t byte_offset, + uint32_t sector_count, uint32_t* first_lba); + +/* Display aspects have no framework ceiling: the native-wide surfaces size + * themselves from the live width, and each title caps its own view at what + * it has validated (fixed ratio, or the adaptive maximum below). Requests + * must be at least native 4:3, with numerator and denominator in 1..99. */ + +/* + * Request a fixed host display aspect before renderer/window initialization. + * Intended for activation callbacks that move a game's widescreen enhancement + * out of generic Settings and into its mod catalog. + */ +int psx_mod_set_fixed_display_aspect(uint32_t numerator, + uint32_t denominator); +/* + * Request resize-driven widescreen, capped at the supplied maximum aspect. + * Pass (0, 0) for Fit to window with no upper aspect limit. Both modes retain + * the native 4:3 minimum; a single zero is invalid. + * The current fixed aspect continues to shape the initial game window, so a + * plugin may select that first with psx_mod_set_fixed_display_aspect(). + */ +int psx_mod_set_adaptive_display_aspect(uint32_t max_numerator, + uint32_t max_denominator); +/* + * Set the wall-clock cadence of simulated guest VBlanks. A value of zero + * removes frontend pacing; 60 and higher request that many native guest + * update opportunities per host second. This intentionally changes whole- + * machine realtime speed and is for experimental game-owned frame-rate mods. + */ +int psx_mod_set_native_vblank_rate(uint32_t frames_per_second); + +/* + * Enable presentation-only frame interpolation while leaving guest VBlank, + * game logic, timers, and audio at their stock cadence. The OpenGL presenter + * temporally blends completed guest frames at the requested output rate on its + * owning render thread/context. It does not derive motion vectors or generate + * true intermediate object positions. + * A value of zero follows the measured host-display refresh rate. + */ +int psx_mod_set_frame_interpolation(uint32_t frames_per_second); +/* + * Choose how the OpenGL presenter combines completed frames. Linear is a + * full-frame crossfade. Motion-adaptive retains temporal blending for + * small temporal changes but switches large changes cleanly to reduce the + * double-image trails produced by moving objects. + */ +enum { + PSX_MOD_FRAME_INTERPOLATION_LINEAR = 0, + PSX_MOD_FRAME_INTERPOLATION_MOTION_ADAPTIVE = 1, + /* No crossfade: every output frame repeats the newest game frame. For a + * plugin that supplies its own in-between images with render passes + * (below); wherever it has none, the output matches stock timing and + * nothing is shown later than the game shows it. */ + PSX_MOD_FRAME_INTERPOLATION_HOLD = 2 +}; +/* Usually called from activation. It may also be called later from the + * emulation thread (a function-entry hook or VBlank callback), e.g. to swap + * HOLD for a crossfade while render passes are unavailable; the OpenGL + * presenter then uses the new mode from its next present. */ +int psx_mod_set_frame_interpolation_blend(uint32_t blend_mode); +/* + * Choose what the OpenGL presenter treats as a new source frame. VBLANK (the + * default, reset at every session start) treats every guest VBlank as one, + * which suits games that flip every VBlank. FLIP rotates the blend history + * only when the guest really flips (the displayed VRAM origin moves, or the + * displayed rect is redrawn) and spreads each crossfade over the measured + * flip period (1..4 VBlanks). A 30 Hz game then blends across its whole frame + * instead of blending for one VBlank and holding for the next. Guest timing + * is unchanged either way. + */ +enum { + PSX_MOD_FRAME_SOURCE_VBLANK = 0, + PSX_MOD_FRAME_SOURCE_FLIP = 1 +}; +int psx_mod_set_frame_interpolation_source(uint32_t source); + +/* + * Host-timed render passes: true in-between frames for a game whose logic + * runs slower than the presentation rate. Default off: nothing happens unless + * a trusted plugin calls these. OpenGL, frame interpolation enabled with the + * FLIP source, never in netplay, rollback, rewind, fast-forward (manual, + * turbo-through-loads, FMV auto-skip) or while the presenter is suspended + * (FMV); psx_mod_render_pass_plan() returns 0 then, and + * psx_mod_render_pass_status() says why. + * + * Call both from an emulation-thread function-entry hook placed where the + * game has finished its logic for game frame N+1 but the display still has to + * flip to frame N (for a PsyQ double-buffered loop: the VSync(0) that precedes + * PutDispEnv). Each pass runs `fn`, which may call guest functions with + * psx_dispatch_call() to draw an intermediate image of the scene. While it + * runs, guest time is frozen: cycles are counted but no device advances, no + * interrupt is delivered and GPU DMA completes synchronously; SPU, CD, timer + * and other device stores are dropped (counted). Afterwards CPU state + * (including the GTE), RAM, scratchpad, I-cache tags, interrupt, timer, DMA + * and GPU registers, and the VRAM rect are exactly as before: the pass's only + * product is the image of the rect, which the presenter shows at `alpha_q16` + * of the way through frame N's time on screen (Q16, 0 = frame N's own image). + * The display rect is the one the next flip shows (its DISPENV); the pass may + * draw only inside it. + */ +/* Returns nonzero to keep the image, 0 to discard it (state is restored + * either way). */ +typedef int (*PSXModRenderPassFn)(struct CPUState* cpu, void* user, + uint32_t alpha_q16); +typedef struct PSXModRenderPass { + uint32_t struct_size; /* sizeof(PSXModRenderPass) */ + uint32_t alpha_q16; /* a phase returned by the plan */ + uint16_t x, y, w, h; /* VRAM display rect the pass draws */ +} PSXModRenderPass; +/* + * Phases (Q16, ascending, excluding 0) at which the presenter will actually + * show frame N: its output deadlines during the `period_vblanks` guest VBlanks + * the frame stays on screen, starting after `shown_after_vblanks` more + * VBlank presents (R4 at its VSync(0) entry: 1 -- the next VBlank still shows + * the previous frame). When the host cannot afford them all, an evenly spread + * subset is returned and the presenter crossfades the gaps. The first + * psx_mod_render_pass() after a plan captures frame N's own image. Returns 0 + * when passes are unavailable or unaffordable. + */ +uint32_t psx_mod_render_pass_plan(uint32_t period_vblanks, + uint32_t shown_after_vblanks, + uint32_t* alpha_q16, uint32_t max); +/* Returns 1 when the pass ran and its image was queued, 0 when it was refused + * or rolled back (state is restored either way). */ +int psx_mod_render_pass(struct CPUState* cpu, const PSXModRenderPass* pass, + PSXModRenderPassFn fn, void* user); +/* + * Why passes cannot run right now, the host-time budget aside (a plan that + * returns 0 while this says READY was shed for time). A plugin that relies on + * passes uses it to fall back, e.g. to a crossfade with + * psx_mod_set_frame_interpolation_blend(), while the reason lasts. + * NO_PRESENTER, BACKEND and DISABLED persist; the others are transient. + */ +enum { + PSX_MOD_RENDER_PASS_READY = 0, + /* Not OpenGL, interpolation off or suspended (FMV), or not the FLIP + * source. */ + PSX_MOD_RENDER_PASS_NO_PRESENTER = 1, + /* The renderer declines passes in its current mode. */ + PSX_MOD_RENDER_PASS_BACKEND = 2, + /* Switched off for this session after repeated faults. */ + PSX_MOD_RENDER_PASS_DISABLED = 3, + /* Netplay, rollback, rewind, load/save replay or self-check resim. */ + PSX_MOD_RENDER_PASS_SESSION = 4, + /* Fast-forward, turbo-through-loads or FMV auto-skip is running. */ + PSX_MOD_RENDER_PASS_FAST_FORWARD = 5, + /* Inside an exception, a pass or a GPU DMA walk, or the presenter has not + * captured a frame since its history restarted (display mode change). */ + PSX_MOD_RENDER_PASS_BUSY = 6 +}; +uint32_t psx_mod_render_pass_status(void); + +/* + * When the game flips relative to the pass point. PENDING (default, reset at + * every session start): the pass rect is the one the next flip will show -- + * the PsyQ VSync(0)-then-PutDispEnv loop, whose frame N is drawn and waits. + * SHOWN: the game flips each frame as soon as it is drawn (for example + * PutDispEnv in a VBlank callback armed by the DrawSync callback), so by the + * time frame N+1's logic is done frame N is already on screen. The pass rect + * is then that on-screen rect, and frame N's own image and its in-between + * images are shown from the game's next flip on: one game frame later than + * the game shows them, as a host interpolator with one frame of history + * would. Set it from activation, before the first plan. + */ +enum { + PSX_MOD_RENDER_PASS_FLIP_PENDING = 0, + PSX_MOD_RENDER_PASS_FLIP_SHOWN = 1 +}; +int psx_mod_set_render_pass_flip(uint32_t mode); + +/* + * The per-frame plumbing every frame-rate plugin repeats (render_pass_frame.c). + * Blending the game state itself: render_pass_motion.h. + * + * Activation: read a choice option holding "display" (follow the measured + * display refresh) or a frame rate, and select the FLIP source, HOLD blend, + * `flip_mode` and that rate. Returns 0 if any setting was refused. + */ +int psx_mod_activate_render_pass_rate(const char* package, const char* feature, + const char* option, uint32_t flip_mode); +typedef struct PSXModRenderPassFrame { + uint32_t struct_size; /* sizeof(PSXModRenderPassFrame) */ + uint32_t period_vblanks; /* VBlanks this game frame stays on screen */ + uint32_t shown_after_vblanks; /* VBlank presents before it is shown */ + uint16_t x, y, w, h; /* VRAM rect the passes draw */ +} PSXModRenderPassFrame; +/* + * Plan this game frame's passes and run `fn` at each phase. While passes are + * unavailable for a lasting reason (BACKEND, DISABLED) the presenter is + * switched to a motion-adaptive crossfade, and back to HOLD once they return. + * Returns how many passes produced an image. + */ +uint32_t psx_mod_render_pass_frame(struct CPUState* cpu, + const PSXModRenderPassFrame* frame, + PSXModRenderPassFn fn, void* user); + +/* + * Replay part of an already-loaded guest function inside a render pass: + * run from start_pc with the CPU state given until control reaches stop_pc. + * Every PC in [start_pc, stop_pc) is interpreted from its RAM bytes, so the + * span may start anywhere in a compiled function, including just after one + * of its calls; calls the span makes run normally and return into it. + * A plugin uses this to redraw with the game's own frame code, branches and + * all, from registers it captured at start_pc during the real frame (an + * instruction hook), instead of re-implementing that code's call sequence. + * Returns 1 when stop_pc is reached; 0 when control leaves the range another + * way (a return or jump out, a nested span), after 1M interpreted + * instructions, or outside a pass. The pass restores the machine either way. + * Both PCs are 4-aligned, in one segment, start_pc < stop_pc. + */ +int psx_mod_run_guest_span(struct CPUState* cpu, uint32_t start_pc, + uint32_t stop_pc); +int psx_mod_set_auto_skip_fmv(int enabled); +/* + * Draw still artwork behind the game image in OpenGL letterbox/pillarbox + * margins. The image path is an owner-selected mod resource; with no enabled + * mod/resource path, the margins remain the historical black clear. + * An absolute path is used unchanged. A relative path (e.g. "bezels/x.png" + * for artwork a title stages beside its binary) is resolved against the + * executable's directory, never the current working directory, when the + * artwork is loaded. + */ +int psx_mod_set_bezel_artwork(const char* path); + +/* + * Upper bounds for the two loading-speed knobs below. Both are generous on + * purpose: games surface them to players as free-form integers, and neither + * can corrupt guest state (see the notes on each setter). They exist to reject + * nonsense, not to curate a list of "blessed" speeds. + */ +#define PSX_MOD_LOAD_ACCEL_MAX 1024u +#define PSX_MOD_DISC_SPEED_MAX 1024u + +/* + * Accelerate only the wall-clock pacing of sustained non-XA data loads while + * preserving every guest VBlank, CD deadline, interrupt, and callback. + * wall_clock_multiplier accepts 1..PSX_MOD_LOAD_ACCEL_MAX, or zero for + * uncapped host speed (1 is a no-op, i.e. authentic pacing). + * release_frames controls how many guest frames acceleration may remain active + * after the load predicate clears; zero is the precise/speedrun-safe policy. + */ +int psx_mod_set_load_acceleration(uint32_t wall_clock_multiplier, + uint32_t release_frames); + +/* + * Select guest-visible CD timing for a game-owned loading feature. divisor + * divides the emulated sector delay, so it IS the speed multiplier: 1 is + * authentic timing, higher is faster, up to PSX_MOD_DISC_SPEED_MAX. Zero + * selects the bounded "instant" scheduler, and instant_max_per_frame (1..256) + * applies only in that case. cdrom.c floors the divided delay at + * CDROM_MIN_DELAY and leaves XA streaming at authentic timing, so no value + * here can produce a zero-delay storm or speed up FMV audio. Unlike host load + * acceleration this changes WHEN the guest receives CD interrupts and can + * expose game timing bugs, which is why it is a separate, opt-in knob. + */ +int psx_mod_set_disc_speed(uint32_t divisor, + uint32_t instant_max_per_frame); + +/* + * Turn the title's [[draw_distance.clamp]] sites on or off for this session + * (draw_distance.h): a far primitive the game would drop past the end of its + * ordering table is kept in the farthest slot instead. Returns 1 when the + * title configured sites, 0 when it has none (the call then changes nothing + * the guest sees). Off by default and reset to off at every session start; + * it adds guest work, so call it from activation, never in netplay. + */ +int psx_mod_set_draw_distance_clamp(int enabled); +int psx_mod_draw_distance_clamp_enabled(void); + +/* Controller presentation values exposed to trusted game-owned plugins. */ +enum { + PSX_MOD_CONTROLLER_ANALOG = 1, + PSX_MOD_CONTROLLER_DIGITAL = 2 +}; +/* + * Per-sample input facts for an opt-in controller presentation policy. The + * runtime owns SDL sampling and SIO delivery; the game-owned plugin owns only + * the policy decision of whether this sample should present as DualShock + * analog or a digital pad. + */ +typedef struct PSXModControllerInput { + uint32_t struct_size; + uint32_t player; + uint32_t sio_slot; + uint32_t configured_mode; + uint32_t current_mode; + uint32_t stick_active; + uint32_t dpad_active; + uint32_t buttons; + uint32_t lx; + uint32_t ly; + uint32_t rx; + uint32_t ry; +} PSXModControllerInput; +typedef uint32_t (*PSXModControllerPresentationCallback)( + const PSXModControllerInput* input); +/* + * Override one player's resolved controller presentation mode for this launch. + * This is intentionally a trusted-plugin API, not a generic launcher setting. + */ +int psx_mod_set_controller_mode_override(uint32_t player, + uint32_t controller_mode); +/* + * Let a game-owned plugin choose analog/digital presentation for one player on + * every input sample. The initial mode is used for boot/hotplug before the + * first sample. config_capable should be non-zero when the selected policy may + * present a DualShock, even if a later sample currently reports digital. + */ +int psx_mod_set_controller_presentation_policy( + uint32_t player, + PSXModControllerPresentationCallback callback, + uint32_t initial_mode, + int config_capable); + +/* + * Register a C plugin before main() on the compilers supported by the runtime. + * The registry itself uses function-local initialization, so constructor order + * between game sources and the framework is safe. + */ +#if defined(_MSC_VER) +#pragma section(".CRT$XCU", read) +#define PSX_MOD_CONSTRUCTOR(name) \ + static void __cdecl name(void); \ + __declspec(allocate(".CRT$XCU")) \ + static void (__cdecl* name##_constructor)(void) = name; \ + static void __cdecl name(void) +#elif defined(__GNUC__) || defined(__clang__) +#define PSX_MOD_CONSTRUCTOR(name) \ + static void name(void) __attribute__((constructor)); \ + static void name(void) +#else +#error "PSX mod plugin registration needs a supported constructor mechanism" +#endif + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/mod_runtime.h b/overlay_toolchain/include/mod_runtime.h new file mode 100644 index 00000000..4d6672dd --- /dev/null +++ b/overlay_toolchain/include/mod_runtime.h @@ -0,0 +1,63 @@ +#pragma once + +#include + +#ifdef __cplusplus +#include +#include +#if defined(RECOMP_LAUNCHER) +#include "recomp_launcher.h" +#endif + +namespace PSXRecompV4 { + +bool mod_runtime_initialize(const std::filesystem::path& root, + const std::string& game_id, + uint32_t game_entry_pc, + const std::filesystem::path& exe_path = {}, + std::string* error = nullptr); +bool mod_runtime_commit(const std::filesystem::path& disc_path = {}, + std::string* error = nullptr); +/* Drop the in-session mod plan for a netplay launch without rewriting the + * user's persisted offline selection on disk. Netplay is always vanilla for + * now (no synced mod plans). */ +bool mod_runtime_clear_for_netplay(std::string* error = nullptr); +const std::string& mod_runtime_fingerprint(); +const std::filesystem::path& mod_runtime_effective_disc_path(); + +#if defined(RECOMP_LAUNCHER) +const ::RecompLauncherCModProvider* mod_runtime_launcher_provider(); +/* [runtime] hide_hidden_mod_features: the launcher never presents a hidden + * feature (recomp-ui RecompLauncherCModProvider::hide_hidden_features). */ +void mod_runtime_set_hide_hidden_features(bool hide); +#endif + +} // namespace PSXRecompV4 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Called before a guest dispatch. Applies the complete main-EXE plan + * transactionally on the first dispatch to the configured entry point. */ +void mod_runtime_on_dispatch(uint32_t target); +/* A full-machine savestate restores guest RAM after the initial entry-point + * application. Reapply the already-validated main-EXE plan so the current + * enabled mod selection remains authoritative after the restore. */ +void mod_runtime_on_savestate_loaded(void); +/* Invokes activation callbacks for the committed plan. Call after the final + * launcher commit and before renderer/window initialization. */ +void mod_runtime_activate_plugins(void); +void mod_runtime_on_vblank(void); +void mod_runtime_patch_disc_sector(uint32_t lba, int raw_sector, + uint8_t* bytes, uint32_t size); +void mod_runtime_enable_disc_patches(void); +int mod_runtime_read_disc_extent(uint32_t lba, int raw_sector, + uint8_t* bytes, uint32_t size); +uint32_t mod_runtime_disc_extent_start(void); +uint32_t mod_runtime_disc_sector_count(uint32_t base_count); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/mod_session_baseline.h b/overlay_toolchain/include/mod_session_baseline.h new file mode 100644 index 00000000..ff00b873 --- /dev/null +++ b/overlay_toolchain/include/mod_session_baseline.h @@ -0,0 +1,58 @@ +#ifndef PSXRECOMP_MOD_SESSION_BASELINE_H +#define PSXRECOMP_MOD_SESSION_BASELINE_H + +/* + * First-call capture / later-call restore for the scalar host settings a + * trusted plugin's psx_mod_* setters can change and no launcher control owns + * (vsync, frame interpolation and its rate, automatic FMV skipping, and the + * frame periods native VBlank pacing overrides). reset_mod_owned_presentation() + * in main.cpp runs this at every session start; it lives here so a unit test + * (runtime/tests/test_mod_session_baseline.c) drives the same code. + * + * The first call records the live values -- settings.toml, environment + * overrides such as PSX_VSYNC, and the launcher are resolved by then -- and + * writes nothing back, so the first session keeps exactly what the player + * configured. Later calls write that record back over the live values. + */ + +typedef struct PSXModSessionScalars { + int video_vsync; + int frame_interpolation; + int frame_interpolation_fps; + int auto_skip_fmv; + double guest_frame_period_ms; + double frame_period_ms; +} PSXModSessionScalars; + +typedef struct PSXModSessionBaseline { + int captured; + PSXModSessionScalars values; +} PSXModSessionBaseline; + +/* + * native_vblank_forced: psx_mod_set_native_vblank_rate() owns the frame + * periods. Only then are they restored; otherwise the video-standard follower + * owns them (the guest's GP1(08h) mode), and a restore would undo a PAL/NTSC + * switch. Returns 1 when this call captured (nothing written), 0 when it + * restored. + */ +static inline int psx_mod_session_baseline_apply(PSXModSessionBaseline* base, + PSXModSessionScalars* live, + int native_vblank_forced) { + if (!base->captured) { + base->captured = 1; + base->values = *live; + return 1; + } + live->video_vsync = base->values.video_vsync; + live->frame_interpolation = base->values.frame_interpolation; + live->frame_interpolation_fps = base->values.frame_interpolation_fps; + live->auto_skip_fmv = base->values.auto_skip_fmv; + if (native_vblank_forced) { + live->guest_frame_period_ms = base->values.guest_frame_period_ms; + live->frame_period_ms = base->values.frame_period_ms; + } + return 0; +} + +#endif diff --git a/overlay_toolchain/include/mod_texture_banks.h b/overlay_toolchain/include/mod_texture_banks.h new file mode 100644 index 00000000..ed80c0a3 --- /dev/null +++ b/overlay_toolchain/include/mod_texture_banks.h @@ -0,0 +1,12 @@ +#pragma once +#include +#ifdef __cplusplus +extern "C" { +#endif +const uint16_t* mod_texture_bank_pixels(uint16_t id, uint32_t* width, uint32_t* height); +uint16_t mod_texture_packet_bank(uint32_t source, const uint32_t* words, uint32_t count); +int mod_texture_packet_precision(uint32_t source, float q[3], float xy[6]); +int mod_texture_bank_batchable(int immutable, int mask_check, int semi); +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/nd_intro_ot.h b/overlay_toolchain/include/nd_intro_ot.h new file mode 100644 index 00000000..71a50553 --- /dev/null +++ b/overlay_toolchain/include/nd_intro_ot.h @@ -0,0 +1,24 @@ +/* nd_intro_ot.h — CTR Naughty Dog intro OT helpers (debug / accuracy shims). */ +#ifndef PSXRECOMP_ND_INTRO_OT_H +#define PSXRECOMP_ND_INTRO_OT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Last WoodEmit batch OT base (model+228). Prefer digit-rain tags. */ +void psx_nd_note_wood_batch_ot(uint32_t base); +void psx_nd_note_wood_batch_ot_tagged(uint32_t base, uint32_t tag); +uint32_t psx_nd_wood_batch_ot(void); + +/* Sibling-scene bump hint at s4+0xb4 (captured at NdIntroSiblingRtptEmit). */ +void psx_nd_note_sibling_ot_hint(uint32_t base); +uint32_t psx_nd_sibling_ot_hint(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/netplay_bios_settle.h b/overlay_toolchain/include/netplay_bios_settle.h new file mode 100644 index 00000000..e59d1d63 --- /dev/null +++ b/overlay_toolchain/include/netplay_bios_settle.h @@ -0,0 +1,83 @@ +/* netplay_bios_settle.h — which BIOS every peer boots for a netplay match. + * + * Each seat offers what it can boot: the bundled OpenBIOS and/or one retail + * image, named by the CRC-32 of the file it would actually load. The host + * settles one BIOS for the room from those offers and sends the result to + * every peer, which then boots only that image. + * + * The wire token for retail is still "scph1001" so older peers read it, but it + * means "the retail image named by retail_crc", not SCPH-1001. Before this rule + * the token was the whole identity: an SCPH-5552 peer and an SCPH-1001 peer + * both offered "scph1001", each booted its own dump, and the rollback boot + * digest never matched. + * + * Rule (netplay_bios_settle): + * 1. Retail is possible only when every seat offered a retail image and all + * the CRCs are equal. A seat with no offer, no dump, or no CRC (an older + * client) makes retail impossible. + * 2. Retail wins when it is possible and the host prefers it, or when nobody + * prefers OpenBIOS. + * 3. Otherwise OpenBIOS, when every seat that sent an offer links it. A seat + * with no offer is an older client and is assumed to link it, as before. + * 4. Otherwise retail, if it is possible. + * 5. Otherwise there is no BIOS every seat can boot: the host must not start. + */ +#ifndef NETPLAY_BIOS_SETTLE_H +#define NETPLAY_BIOS_SETTLE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct NetplayBiosSeat { + int offered; /* 0 = no offer received (older client / not ready) */ + int can_openbios; /* links the bundled OpenBIOS backend */ + int can_retail; /* has a retail dump a linked backend accepts */ + int prefer_openbios; /* the player picked OpenBIOS */ + uint32_t retail_crc; /* CRC-32 of the retail file it would boot; 0 = not sent */ + int is_host; +} NetplayBiosSeat; + +enum { + NETPLAY_BIOS_OPENBIOS = 0, + NETPLAY_BIOS_RETAIL = 1, + NETPLAY_BIOS_NONE = 2 /* no BIOS every seat can boot */ +}; + +typedef struct NetplayBiosSettle { + int kind; /* NETPLAY_BIOS_* */ + uint32_t retail_crc; /* RETAIL: the image every seat boots */ + /* NONE: two seats that cannot share a retail image (-1 when unused). + * seat_b is -1 when seat_a simply has no usable retail offer. */ + int seat_a; + int seat_b; +} NetplayBiosSettle; + +NetplayBiosSettle netplay_bios_settle(const NetplayBiosSeat *seats, int count); + +/* Wire token for a settled kind: "openbios", "scph1001" (retail), or "". */ +const char *netplay_bios_token(int kind); + +/* retail_crc on the wire: eight lowercase hex digits, "" for 0. */ +void netplay_bios_format_crc(uint32_t crc, char *out, size_t cap); +/* Parses eight hex digits (surrounding spaces allowed). Returns 0 for + * anything else, which callers treat as "not sent". */ +uint32_t netplay_bios_parse_crc(const char *text); + +/* Short player-facing name for a retail image CRC ("SCPH-5552"), or the CRC + * in hex ("BIOS d786f0b9") when the image is not in psx_bios_known_images.h. */ +void netplay_bios_describe_crc(uint32_t crc, char *out, size_t cap); + +/* One line explaining a NONE result, for the launcher's status line. */ +void netplay_bios_describe_refusal(const NetplayBiosSettle *s, + const NetplayBiosSeat *seats, int count, + char *out, size_t cap); + +#ifdef __cplusplus +} +#endif + +#endif /* NETPLAY_BIOS_SETTLE_H */ diff --git a/overlay_toolchain/include/netplay_exit_reason.h b/overlay_toolchain/include/netplay_exit_reason.h new file mode 100644 index 00000000..2dc90991 --- /dev/null +++ b/overlay_toolchain/include/netplay_exit_reason.h @@ -0,0 +1,72 @@ +/* netplay_exit_reason.h — why a netplay match ended, in words. + * + * A match that ends early returns every player to the lobby. The runtime knew + * why (netplay_soft_exit's origin) but only printed it to stdout, so players + * saw the lobby again with no reason. These map an origin to one sentence for + * the launcher's status line, and decide when a boot-digest mismatch is final. + */ +#ifndef NETPLAY_EXIT_REASON_H +#define NETPLAY_EXIT_REASON_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* The player-facing sentence for a netplay_soft_exit origin, or NULL when the + * player ended the match themselves (window close, Escape) or the origin is + * unknown. */ +const char *netplay_exit_reason_text(const char *origin); + +/* The rollback boot digests of the two peers are both known and different. + * The peers booted differently, and waiting does not fix that; before this change + * only the generic 20 s admit-stall watchdog ended it. The mismatch is final + * once the same pair of digests has held for grace_ms (the short wait lets a + * stale peer digest be replaced, and the peer reach the same verdict). + * mismatch_since_ms is 0 when there is no mismatch. */ +int netplay_boot_mismatch_final(uint32_t mismatch_since_ms, uint32_t now_ms, + uint32_t grace_ms); + +#define NETPLAY_BOOT_MISMATCH_GRACE_MS 3000u + +/* Why a netplay start failed, in one sentence. The start reported + * every failure as "built without recomp-net, or bind/peer invalid": a player + * whose system held the port read first that the build had no netplay. + * `start_rc` is psx_netplay_start's result, `has_netplay` whether the build + * has the netplay library. For a LAN start (-3) the caller does the library's + * steps again and passes what it found: `bind_probe` and, for a refused bind + * or socket, the system's error number and text. The sentence says a cause + * only when the system's answer names one: + * address in use (Windows 10048, Linux 98, macOS 48): another program or + * the system holds the port, choose another port; + * access denied (Windows 10013, POSIX 13): the system does not allow the + * port (a range Windows keeps for Hyper-V or WSL, a port below 1024 + * elsewhere), choose another port; + * address not available (Windows 10049, Linux 99, macOS 49): the listen + * address is not one of this computer's, check the listen address; + * any other number: the number and the system's text, no cause. + * The peer address is named only when the listen address opened and the peer + * address cannot be read. The build is named only when it has no netplay. + * Every sentence fits the lobby client's last_error. */ +enum { + NETPLAY_BIND_NOT_TRIED = -1, /* not a LAN start, or a build without the library */ + NETPLAY_BIND_OK = 0, /* listen address opened, peer address reads well */ + NETPLAY_BIND_FAILED = 1, /* the system refused the bind */ + NETPLAY_BIND_BAD_ADDRESS = 2, /* the listen address is not "address:port", or its name is unknown */ + NETPLAY_BIND_NO_SOCKET = 3, /* the system made no socket */ + NETPLAY_BIND_PEER_BAD = 4 /* listen address opened; the peer address cannot be read */ +}; +#define NETPLAY_START_FAILURE_CAP 192 +void netplay_start_failure_text(int start_rc, int has_netplay, + const char *bind_hostport, + const char *peer_hostport, int bind_probe, + int sys_error, const char *sys_text, + char *out, size_t cap); + +#ifdef __cplusplus +} +#endif + +#endif /* NETPLAY_EXIT_REASON_H */ diff --git a/overlay_toolchain/include/netplay_hash_confirm.h b/overlay_toolchain/include/netplay_hash_confirm.h new file mode 100644 index 00000000..20b8ffcc --- /dev/null +++ b/overlay_toolchain/include/netplay_hash_confirm.h @@ -0,0 +1,33 @@ +#ifndef PSX_NETPLAY_HASH_CONFIRM_H +#define PSX_NETPLAY_HASH_CONFIRM_H + +/* + * MotK compatibility shim → recomp-net hash_confirm. + * Prefer rnet_hc_* in new code. + */ + +#include "recomp_net/hash_confirm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define NETPLAY_HC_RING RNET_HC_RING +typedef RNetHashConfirm NetplayHashConfirm; + +#define netplay_hc_reset rnet_hc_reset +#define netplay_hc_prime_after rnet_hc_prime_after +#define netplay_hc_note_local rnet_hc_note_local +#define netplay_hc_note_peer rnet_hc_note_peer +#define netplay_hc_resolved_through rnet_hc_resolved_through +#define netplay_hc_confirm_through rnet_hc_confirm_through +#define netplay_hc_local_digest rnet_hc_local_digest +#define netplay_hc_peer_digest rnet_hc_peer_digest +#define netplay_hc_peek_mismatch rnet_hc_peek_mismatch +#define netplay_hc_heal_stale_gap rnet_hc_heal_stale_gap + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_NETPLAY_HASH_CONFIRM_H */ diff --git a/overlay_toolchain/include/netplay_input_hist.h b/overlay_toolchain/include/netplay_input_hist.h new file mode 100644 index 00000000..8c6aa4d8 --- /dev/null +++ b/overlay_toolchain/include/netplay_input_hist.h @@ -0,0 +1,43 @@ +#ifndef PSX_NETPLAY_INPUT_HIST_H +#define PSX_NETPLAY_INPUT_HIST_H + +/* + * MotK input history: portable ring/invent in recomp-net; PSX pad + * conversion stays in netplay_input_hist.c. + */ + +#if defined(PSX_HAS_RECOMP_NET) + +#include + +#include "psx_netplay.h" +#include "recomp_net/input_hist.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define NETPLAY_INPUT_HIST_DEPTH RNET_INPUT_HIST_DEPTH +#define NETPLAY_INPUT_HIST_MAX_SLOTS RNET_INPUT_HIST_MAX_SLOTS +typedef RNetInputHist NetplayInputHist; + +#define netplay_ih_reset rnet_ih_reset +#define netplay_ih_frame_to_contract rnet_ih_frame_to_contract +#define netplay_ih_put rnet_ih_put +#define netplay_ih_get rnet_ih_get +#define netplay_ih_invent_hold_last rnet_ih_invent_hold_last +#define netplay_ih_invent_idle rnet_ih_invent_idle +#define netplay_ih_promote rnet_ih_promote + +/* PsxNetPad ↔ RNetRbFrame (LX/LY only; RX/RY stay on the pad blob path). */ +void netplay_ih_pad_to_frame(const PsxNetPad *pad, uint32_t tick, uint8_t predicted, + RNetRbFrame *out); +void netplay_ih_frame_to_pad(const RNetRbFrame *frame, PsxNetPad *pad); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_HAS_RECOMP_NET */ + +#endif /* PSX_NETPLAY_INPUT_HIST_H */ diff --git a/overlay_toolchain/include/netplay_rb_post.h b/overlay_toolchain/include/netplay_rb_post.h new file mode 100644 index 00000000..3b9a5887 --- /dev/null +++ b/overlay_toolchain/include/netplay_rb_post.h @@ -0,0 +1,20 @@ +#ifndef PSX_NETPLAY_RB_POST_H +#define PSX_NETPLAY_RB_POST_H + +/* + * MotK compatibility shim → recomp-net rb_post tip filter. + */ + +#include "recomp_net/rb_post.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define netplay_rb_peer_post_tip_ok rnet_rb_peer_post_tip_ok + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_NETPLAY_RB_POST_H */ diff --git a/overlay_toolchain/include/netplay_snap_ring.h b/overlay_toolchain/include/netplay_snap_ring.h new file mode 100644 index 00000000..ba4bb176 --- /dev/null +++ b/overlay_toolchain/include/netplay_snap_ring.h @@ -0,0 +1,48 @@ +#ifndef PSX_NETPLAY_SNAP_RING_H +#define PSX_NETPLAY_SNAP_RING_H + +/* + * MotK snap ring: opaque blob ring from retcomm-rbengine; save/load wrap + * boot_state serialize (PSX-specific). + */ + +#include +#include + +#include "cpu_state.h" +#include "retcomm_rbengine/snap_ring.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define NETPLAY_SNAP_RING_DEFAULT_DEPTH RBE_SNAP_RING_DEFAULT_DEPTH +typedef RbeSnapRing NetplaySnapRing; + +#define netplay_snap_ring_create rbe_snap_ring_create +#define netplay_snap_ring_destroy rbe_snap_ring_destroy +#define netplay_snap_ring_clear rbe_snap_ring_clear +#define netplay_snap_ring_depth rbe_snap_ring_depth +#define netplay_snap_ring_count rbe_snap_ring_count +#define netplay_snap_ring_has rbe_snap_ring_has +#define netplay_snap_ring_store rbe_snap_ring_store +#define netplay_snap_ring_peek rbe_snap_ring_peek +#define netplay_snap_ring_drop_after rbe_snap_ring_drop_after +#define netplay_snap_ring_drop_tick rbe_snap_ring_drop_tick +#define netplay_snap_ring_oldest_tick rbe_snap_ring_oldest_tick +#define netplay_snap_ring_newest_tick rbe_snap_ring_newest_tick + +/* Serialize live machine into the ring at tick (overwrites same tick). */ +int netplay_snap_ring_save(NetplaySnapRing *r, uint32_t tick, + const CPUState *cpu, uint32_t bios_checksum, + uint32_t entry_pc); + +/* Restore machine from the snap at tick. Returns 0 if missing/reject. */ +int netplay_snap_ring_load(NetplaySnapRing *r, uint32_t tick, CPUState *cpu, + uint32_t bios_checksum, uint32_t entry_pc); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_NETPLAY_SNAP_RING_H */ diff --git a/overlay_toolchain/include/netplay_state_digest.h b/overlay_toolchain/include/netplay_state_digest.h new file mode 100644 index 00000000..8e9da454 --- /dev/null +++ b/overlay_toolchain/include/netplay_state_digest.h @@ -0,0 +1,70 @@ +#ifndef PSX_NETPLAY_STATE_DIGEST_H +#define PSX_NETPLAY_STATE_DIGEST_H + +/* + * Compact state digests for rollback hash_confirm / FRAME_COMMIT / POST. + * + * Core = CPU + RAM + IRQ/timers/clock + dirty bitmap — invent hash_confirm. + * AV = GPU regs + VRAM — baseline/POST also require this (GL/VK readback forks + * VRAM while core still matches; pin zlib sizes were the symptom). + * CDROM digest: live dig audit + folded into baseline dig_c with aux + * (matched core/av/aux with divergent CD was loading doomed Replay snaps). + * Baseline dig_c (ext) also folds scratchpad + DMA + SIO — pin zlib skew + * with matched core/av/aux/cd was ungated bus state. + * Master = crc(core, cd) for combined logging only. + */ + +#include +#include "cpu_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Partition CRCs folded into netplay_core_digest — for first-diverge diags. */ +typedef struct NetplayCoreParts { + uint32_t cpu; /* gpr + pc + hi/lo + status/cause/epc + GTE */ + uint32_t clock_irq; /* cycle count + i_stat/i_mask */ + uint32_t timers; /* timer snapshot */ + uint32_t ram; /* 2 MiB main RAM */ + uint32_t dirty; /* dirty-RAM bitmap words */ + uint32_t core; /* full core (same as netplay_core_digest) */ +} NetplayCoreParts; + +uint32_t netplay_core_digest(const CPUState* cpu); +void netplay_core_digest_parts(const CPUState* cpu, NetplayCoreParts* out); +uint32_t netplay_master_digest(const CPUState* cpu); +uint32_t netplay_cdrom_digest(void); +uint32_t netplay_av_digest(void); /* GPU + VRAM */ +/* SPU regs+RAM and MDEC — in snaps but not core/av; pin zlib skew with matched + * core/av was this. Baseline dig_c / live dig carry aux. + * MDEC snap age is guest-cycle relative (not host s_frame_count). + * PSX_RB_SPU_DIG_REGS_ONLY=1: netplay_spu_digest skips 512 KiB SPU RAM (A/B + * whether Win↔Linux aux forks in reverb/capture RAM vs voice regs). */ +uint32_t netplay_spu_regs_digest(void); /* regs/voices/tail only — no SPU RAM */ +uint32_t netplay_spu_digest(void); +uint32_t netplay_mdec_digest(void); +uint32_t netplay_aux_digest(void); /* crc(spu, mdec) */ +uint32_t netplay_spad_digest(void); /* 1 KiB scratchpad */ +uint32_t netplay_dma_digest(void); +uint32_t netplay_sio_digest(void); + +/* SIO snapshot section CRCs — which subsystem forked a resim (a single SIO + * digest could not say). Sections mirror sio_snap_emit order. + * netplay_sio_digest / baseline_ext fold only through fsm_pace (not meta). */ +typedef struct NetplaySioParts { + uint32_t regs; /* tx/rx/stat/mode/ctrl/baud */ + uint32_t pads; /* pad_analog/connected/state/response/config/type_req */ + uint32_t mc; /* memcard working vars + both slot FSMs + active_device */ + uint32_t pace; /* shift/ack/irq countdown — guest-visible timing */ + uint32_t meta; /* irq source/slot/delay/byte_seq (host audit only) */ +} NetplaySioParts; +void netplay_sio_digest_parts(NetplaySioParts *out); +/* Baseline dig_c: crc(aux, cd, spad, dma, sio). Refuse doomed Replay. */ +uint32_t netplay_baseline_ext_digest(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_NETPLAY_STATE_DIGEST_H */ diff --git a/overlay_toolchain/include/overlay_api.h b/overlay_toolchain/include/overlay_api.h new file mode 100644 index 00000000..fca6c108 --- /dev/null +++ b/overlay_toolchain/include/overlay_api.h @@ -0,0 +1,404 @@ +#ifndef OVERLAY_API_H +#define OVERLAY_API_H + +/* Shared ABI between psx-runtime.exe and overlay DLLs. + * + * After LoadLibrary, the runtime calls overlay_init() with this struct. + * The DLL stores the pointers and routes all cross-module calls through them. + */ + +#include "cpu_state.h" +#include "pgxp_hooks.h" +#include + +/* ABI version exported by every overlay DLL as `overlay_abi()`. The loader + * rejects (and deletes, so autocompile regenerates) any DLL whose version + * doesn't match — including all pre-versioning DLLs, which lack the export. + * + * v2: dispatch call-contract (Bug D family) — DLL call sites carry (ra, sp) + * contract checks and share the runtime's bail state via the appended + * callback pointers below. + * v3: widescreen backdrop screenX squash ([widescreen.backdrop] x_sites) — + * overlay backdrop handlers now emit psx_ws_backdrop_x() at their screenX + * store. This is an EMIT-content change (not a struct-ABI change), but the + * version is the cache discriminator: bumping it forces the loader to + * reject pre-backdrop DLLs so autocompile regenerates them with the squash. + * (The deferred follow-up is to auto-derive this tag from a hash of the + * widescreen config + emit headers; until then it's a manual bump.) + * v4: widescreen backdrop column PRELOAD ([widescreen.cull] auto_backdrop) — + * overlay backdrop generators now emit psx_ws_backdrop_value() at the + * window START/END finalize, and the callback struct grows a + * ws_backdrop_value pointer (appended last). Bumping rejects pre-preload + * DLLs (which lack both the emit and a host that supplies the callback). */ +/* v5: psx_syscall callback return type void->int (CPS, RECURSION_BUG.md §25); + * overlays compiled under CPS emit `if (psx_syscall(...)) return;`. */ +/* v7: advance_cycles callback added; overlays now built with + * PSX_ENABLE_BLOCK_CYCLES and charge the shared host cycle/timer timeline. + * Bumping rejects stale DLLs that charged no cycles (Tomba2 Timer1 fork). */ +/* v8: check_interrupts_at callback added so generated native overlay block + * checks can provide the real guest resume PC for async RFE recovery. + * v9: faithful-timing callbacks (cyc_load, icache_fetch, muldiv, mult_latency, + * gte, slice_block) so overlay code built with PSX_ENABLE_BLOCK_CYCLES links + * against the runtime's real timing impls (the cycle-accuracy rearchitecture). + * v10: GTE special-register accessors (gte_read_data/gte_read_ctrl/ + * gte_write_data/gte_write_ctrl) — the emitter emits direct calls for + * masked, aliased, read-only, precision-sensitive, flag/IR, and derived + * GTE regs; GTE-heavy overlays failed to LINK without shims (undefined + * gte_read_ctrl), silently blocking new coverage. */ +/* v22: game_text_native_ok callback - the emitter emits a direct + * psx_game_text_native_ok() stale-static guard (code_generator.cpp, at + * block entry and before every direct jal). The function is DEFINED IN THE + * GENERATED DISPATCH SHARD, which lives in the executable, so an overlay + * DLL cannot see it: 107 of 109 shard failures on the 2026-09-02 Tomba 2 + * framework bump were `undefined reference to psx_game_text_native_ok`. + * Exactly the rfe / gte_read_ctrl / gte_precision_store_word class again - + * an emitter gained a runtime call without the overlay ABI gaining the + * shim, and the only symptom is shards that silently fail to build so the + * code runs interpreted forever. NULL-guarded: a host predating v22 makes + * the shim return 0, which routes the guest through the dispatcher instead + * of native code - slower, never wrong. */ +/* v11 batches per-instruction cycle charges inside overlay DLLs and flushes at + * block/device/store boundaries, removing a cross-DLL callback per instruction + * without changing the shared guest-cycle timeline. */ +/* v12: rfe_mark_escape callback — the emitter emits psx_rfe_mark_escape() at + * every `rfe` (code_generator.cpp COP0 case), including in overlay-resident + * exception-context code (Tomba kernel-window overlays hit this). It mutates + * the runtime's shared RFE-pending escape state (interrupts.c), so the DLL + * MUST forward — a local no-op would swallow exception returns. Without the + * shim any rfe-containing overlay fails to LINK (undefined psx_rfe_mark_escape) + * and that variant runs interpreted forever — the gte_read_ctrl class again. */ +/* v13: ws_player_x_bound callback — the emitter rewrites a configured + * [widescreen] signed_x_bound LUI site into psx_ws_player_x_bound(vanilla) + * (code_generator.cpp; Einhander native-wide player bounds, 28165d6), + * INCLUDING in overlay-resident code (the site loop runs in overlay_mode + * too). The clamp computes against the host's live widescreen state (gpu.c), + * so the DLL must forward; without the shim any shard containing a bound + * site fails to LINK (undefined psx_ws_player_x_bound) and runs interpreted + * forever — the rfe/gte_read_ctrl class again. Identity fallback (vanilla) + * on a NULL host pointer keeps a v13 DLL correct (4:3) on an older host. */ +/* v14: gte_precision_store_word forwarder — the emitter emits a direct call for + * every swc2 (GTE store-word); stateful runtime code (gte.cpp) so the DLL + * must forward or fail to LINK. Surfaced by full static overlay coverage + * (play-captured shards rarely compiled a swc2). Appended last; ABI bump + * to 14 rejects any pre-shim DLL. */ +/* v15 histories existed independently on pre-integration branches: + * - generated stores call psx_store_cycle_barrier() before any host-visible + * write or SWL/SWR read-modify-write; + * - ws_depth_bound forwarder for configured aspect-scaled far-bound sites. + * v16: combines both ABI additions and rejects either stale v15 cache line. */ +/* v17: ws_plane_nx forwarder for configured side frustum-plane normal-X + * cull sites. Appended last; NULL preserves the vanilla normal. */ +/* v18: ws_xclip_bound forwarder for configured per-primitive X-reject + * bound-load cull sites. Appended last; NULL preserves the vanilla + * loaded value. */ +/* v19: ws_cull_keep_result forwarder for full-word-guarded object/model + * participation comparisons. The verdict depends on the host's live + * widescreen margin; NULL preserves the vanilla comparison. */ +/* v20: ws_aspect_cone_result forwarder for camera-horizontal, aspect-aware + * model participation with queue-safe guard/hysteresis policy. */ +/* v21: ws_angle_widen forwarder for exact, aspect-scaled 12-bit terrain + * frustum half-angle constants. */ +/* (PGXP, no version bump): OverlayCallbacks grew an appended-last PGXPHooks + * table pointer (pgxp_hooks.h). Only pgxp-flavour shards (compiled with + * -DPSX_PGXP=1, PSX_OVERLAY_FLAVOR_PGXP set) reference the psx_pgxp_* + * forwarders, and the flavor half of the ABI tag already rejects any + * host/DLL flavor mix — base-flavour DLLs and hosts are untouched, so + * the version stays. The emit-content change (PGXP_*() macros in all + * generated C) is covered by the codegen hash + CODEGEN_VER below. */ +/* v23: native overlay forwarding for signed screen bounds and mod entry hooks. */ +/* v24: last_store_pc pointer. The emitter writes g_debug_last_store_pc before + * every guest store, and the runtime reads it in every build: memory.c's + * store filters key on it, and debug tooling attributes writes with it. + * DLLs used to keep a private copy, so an overlay store left the host's + * value naming an older store. The DLL now writes through this pointer + * (cpu_state.h maps the name in PSX_OVERLAY_DLL_BUILD). */ +/* v25: function-entry callbacks may return an opt-in filter result while + * retaining the v24 last_store_pc pointer. */ +/* Master line: + * v26: guarded packed-coordinate rejection callback, preserving the selected + * rejection axes while the native-wide renderer clips horizontal margins. + * v27: full-word-bound native-wide winding branch callback. + * v28: guarded instruction callbacks and scoped guest-function completion. + * release/native-rendering-20261003 line (independently numbered v26..v29): + * ws_cull_scale and gte_nclip_exact_sign forwarders, completion-returning + * entry hooks, guarded pre-instruction callback. + * v30: the two lines merged. OverlayCallbacks keeps the master layout, which + * already holds every release-line callback; shards built against either + * v28 or v29 are rejected and recompiled. */ +#define PSX_OVERLAY_ABI_VERSION 30 + +/* Process-lifetime overlay candidate capacity. Every accepted manifest F + * record consumes one slot, even when another DLL carries an identical + * (entry, CRC, ranges) identity. Offline publishers parse this same literal + * before adding a cache pair so compiler-side accounting cannot drift from + * the loader's fixed arrays. */ +#define PSX_OVERLAY_CANDIDATE_CAP 32768 + +/* Codegen flavor of the recompiled output the overlays + runtime were built + * against. Overlays are keyed in the cache by guest-bytes CRC, which is + * flavor-BLIND — the same guest overlay yields the same filename whether it was + * compiled by the base recompiler or a variant (e.g. widescreen, which emits + * extra runtime symbols + GTE adjustments). Without a flavor tag a widescreen + * DLL and a base DLL for the same overlay collide. The flavor is folded into + * overlay_abi() (high 16 bits) so the loader's existing ABI gate rejects (and + * regenerates) any DLL whose flavor differs from the running build's, keeping + * caches separate even in a shared directory. + * + * Base/master MUST stay 0 so the tag == PSX_OVERLAY_ABI_VERSION (backward + * compatible with all existing base-flavor DLLs). A variant build overrides it + * (e.g. -DPSX_OVERLAY_FLAVOR=1 for widescreen) for BOTH the runtime and + * compile_overlays.py (its --flavor arg). */ +#ifndef PSX_OVERLAY_FLAVOR +#define PSX_OVERLAY_FLAVOR 0 +#endif + +/* Flavor bits (compose bitwise; base = 0): + * 1 — widescreen variant codegen + * 2 — PGXP precision shadowing (-DPSX_PGXP=1 objects; pgxp_hooks.h) */ +#define PSX_OVERLAY_FLAVOR_WIDESCREEN 1 +#define PSX_OVERLAY_FLAVOR_PGXP 2 + +/* Combined tag exported by overlay_abi() and checked by the loader. */ +#define PSX_OVERLAY_ABI_TAG \ + ((int)((PSX_OVERLAY_ABI_VERSION & 0xFFFF) | ((PSX_OVERLAY_FLAVOR & 0xFFFF) << 16))) + +/* Codegen version — bumped whenever the recompiler emits DIFFERENT bytes for the + * same guest overlay WITHOUT an ABI change (the load-time overlay_abi() gate only + * catches ABI/flavor changes; a pure-emitter change produces a different DLL the + * gate would happily accept). The cache is namespaced by this version + * (gcc//cg/), so a build with new codegen writes + reads a FRESH + * directory and never reuses a stale DLL; old versions coexist on disk (no + * auto-delete — a user who downgrades still finds their matching cache). Python + * (compile_overlays.py) parses this same constant from this header, so the two + * sides can never drift. BUMP THIS when you change code_generator.cpp emit in a + * way that alters overlay output (e.g. the auto_screen_x widescreen widening). + * 1: baseline + auto_screen_x render-funnel cull via psx_ws_cull_sltiu. + * 2: + auto_backdrop far-backdrop column preload via psx_ws_backdrop_value. + * 3: auto_backdrop switched to camera-tracked window WIDENING + * (psx_ws_backdrop_value gains a window_cols arg). + * 4: continuation-passing (PSX_CPS, RECURSION_BUG.md §25) — overlay funcs + * tail-transfer + carry an entry-switch; the loader routes continuations. + * Fresh namespace so CPS DLLs never reuse a legacy (unit-model) cg3 DLL. + * 6: + overlay store boundaries flush DLL-local pending cycles before host + * read/write side effects (SB/SH/SW/SWL/SWR/SWC2), configured negsub, + * masked-16-bit screen-X, and depth cull emits. + * 7: + configured side-plane normal-X (plane_nx) cull emit. + * 8: + configured per-primitive bound-load (xclip) cull emit. + * 9: + full-word-guarded object/model participation compare emit. + * 10: + PGXP dataflow-shadowing PGXP_*() macro emission at loads/stores/ + * COP2 transfers/precision-carrying ALU ops (pgxp_hooks.h; no-ops in + * base-flavour objects, real hooks under -DPSX_PGXP=1). */ +/* 11: ABI v23 screen-bound and mod-entry forwarders; use a fresh cache path + * so packaged pairs cannot be hidden by an older user cache on first boot. */ +/* 13: merge adaptive backdrop v12: independent quotient consumers, proven + * copied/biased camera inputs, and two biased bounds for terrain strips. */ +/* 14 (master): guarded saturation-aware NCLIP branch consumers and ABI v27 + * forwarding. 15 (master): see history. + * 14-16 (release/native-rendering-20261003): [[widescreen.cull.scale]] + * register-register frustum-edge emit; exact/keep NCLIP sites for every + * sign-branch shape. + * 17: the two lines merged (master exact-NCLIP emission, release keep-site + * shapes and cull-scale sites). */ +#define PSX_OVERLAY_CODEGEN_VER 17 + +/* Auto codegen hash (generated by hash_codegen.cmake from the recompiler codegen + * sources). Folded into the cache PATH next to cg (gcc//cg_/) + * so ANY emitter change auto-invalidates the cache, even within the same manual + * PSX_OVERLAY_CODEGEN_VER — closing the stale-but-cgN reuse that caused the v0.3.0 + * black screen. The build writes overlay_codegen_hash.h (gitignored) into this + * dir; a fresh checkout without it falls back to 0 (== old single-cgN behaviour) + * until the first build. compile_overlays.py reads the same value, so the loader + * and the compiler always agree on the path. */ +#if defined(__has_include) +# if __has_include("overlay_codegen_hash.h") +# include "overlay_codegen_hash.h" +# endif +#endif +#ifndef PSX_OVERLAY_CODEGEN_HASH +# define PSX_OVERLAY_CODEGEN_HASH 0u +#endif + +/* Named so consumers that only forward the table (overlay_loader.h, + * psx_bios_module.h) can declare `struct OverlayCallbacks` without pulling + * this header in. Layout unchanged. */ +typedef struct OverlayCallbacks { + /* Core dispatch: routes call_by_address() and out-of-overlay jal */ + void (*dispatch_call)(CPUState *cpu, uint32_t addr, uint32_t ra); + /* Interrupt check: called after every function return in overlay */ + void (*check_interrupts)(CPUState *cpu); + /* Interrupt check with the guest PC that should resume if a game-installed + * handler later RFEs to the sentinel outside the synchronous host window. */ + void (*check_interrupts_at)(CPUState *cpu, uint32_t resume_pc); + /* Guest-cycle accounting (ABI v7): block-cycle charge. Overlay code built + * with PSX_ENABLE_BLOCK_CYCLES must charge the SAME shared host cycle/timer + * timeline as the dirty-RAM interpreter and the BIOS, or timer-sensitive + * code reads different values per backend (Tomba2 logo Timer1 fork). */ + void (*advance_cycles)(uint32_t cycles); + /* GTE coprocessor 2 execution */ + void (*gte_execute)(CPUState *cpu, uint32_t cmd); + /* MIPS syscall (break/syscall instructions). Returns 1 if control + * transfers (cpu->pc set), 0 for a directly-handled void syscall. See + * cpu_state.h. The signature changed with CPS (RECURSION_BUG.md §25), so + * PSX_OVERLAY_ABI_VERSION was bumped to reject stale overlay caches. */ + int (*psx_syscall)(CPUState *cpu, uint32_t code); + /* Unresolved dispatch target */ + void (*psx_unknown_dispatch)(CPUState *cpu, uint32_t addr, uint32_t phys); + /* Debug instrumentation: called at every function entry (may be NULL) */ + void (*log_call_entry)(uint32_t func_addr); + /* RestoreState/ReturnFromException longjmp escape (interrupts.c). The + * recompiler emits this at longjmp-return sites in exception-context + * kernel code (the install-slot / kernel-window class). Appended LAST: + * overlay_init copies the struct by value, so older DLLs built against + * the shorter struct simply never read this member. */ + void (*psx_restore_state_escape)(void); + /* Call-contract state shared with the runtime (ABI v2; see the contract + * model in cpu_state.h). DLL code reads the bail flag and bumps the + * counters through these pointers. */ + int *call_bail_flag; + uint64_t *bail_first; + uint64_t *bail_resolved; + /* Widescreen hooks (ABI v3). The recompiler can emit psx_ws_* calls into + * OVERLAY code (backdrop screenX squash; and, for other games, sprite-tag + * or cull sites that resolve into overlays). These compute against the + * host's live widescreen state (gpu.c), so the DLL forwards to the runtime + * through these. Appended LAST (struct grows back-compatibly); may be NULL + * on a host that predates them — the DLL glue falls back to identity. */ + int (*ws_backdrop_x)(int x); + int (*ws_x_margin)(void); + void (*ws_sprite_tag)(CPUState *cpu); + /* Widescreen backdrop column-preload value substitution (ABI v4). Overlay + * backdrop generators call this at a detected window START/END bound; the + * runtime returns `orig` unless native-wide is engaged, in which case it + * widens the camera-tracked window by the 16:9 reveal (START -> orig-margin, + * END -> orig+margin; margin scales with window_cols). Appended LAST (struct + * grows back-compatibly); may be NULL on a host that predates it — the DLL + * glue falls back to orig. */ + uint32_t (*ws_backdrop_value)(uint32_t orig, int is_end, int window_cols); + /* Fail-closed native entry guard (ABI v6). The generated CPS entry-switch + * calls this when the function is dispatched at a PC that is not one of its + * legal entries (a foreign interior PC from a range-ownership mismatch); the + * function returns without executing and the runtime routes the PC to the + * sanctioned dirty-RAM interpreter. Appended LAST (struct grows back- + * compatibly); may be NULL on a host that predates it. */ + void (*psx_native_bad_entry)(CPUState *cpu, uint32_t owner, uint32_t pc); + /* Faithful-timing functions (ABI v9). The cycle-accuracy + due-cycle-scheduler + * rearchitecture made the recompiler emit these into OVERLAY code too (block-cycle + * mode). They touch shared runtime state (guest RAM, the global cycle counter, the + * I-cache tag array, the mul/div & GTE completion deadlines, the precise-slice + * interp), so the DLL MUST forward them to the runtime — a local copy would diverge + * from the interp/BIOS timeline (the exact class the cosim guards). Appended LAST + * (struct grows back-compatibly); the ABI bump to 9 rejects any pre-timing cache. */ + uint32_t (*cyc_load_word)(CPUState *cpu, uint32_t addr, uint32_t rt, uint32_t reg_mask); + uint16_t (*cyc_load_half)(CPUState *cpu, uint32_t addr, uint32_t rt, uint32_t reg_mask); + uint8_t (*cyc_load_byte)(CPUState *cpu, uint32_t addr, uint32_t rt, uint32_t reg_mask); + uint32_t (*cyc_lwc2_read)(CPUState *cpu, uint32_t addr); + void (*icache_fetch)(CPUState *cpu, uint32_t addr); + void (*muldiv_set)(CPUState *cpu, uint32_t latency); + void (*muldiv_stall)(CPUState *cpu); + uint32_t (*mult_latency_s)(uint32_t rs); + uint32_t (*mult_latency_u)(uint32_t rs); + void (*gte_stall)(CPUState *cpu); + void (*gte_read)(CPUState *cpu, uint32_t rt); + int (*slice_block)(CPUState *cpu, uint32_t block_addr, uint32_t bcyc, int side_effects); + /* GTE special-register accessors (ABI v10). The emitter routes mfc2/cfc2/ + * mtc2/ctc2 on flag/IR/derived registers through these (code_generator.cpp + * COP2 case) — a GTE-heavy overlay (Tomba2 lava/Trolley attract demos) + * emits direct calls and its DLL link fails without shims (undefined + * gte_read_ctrl — the class that silently blocked ALL new overlay coverage + * after the v9 caches rotated). Appended last; ABI bump to 10 rejects any + * pre-shim DLL. */ + uint32_t (*gte_read_data)(CPUState *cpu, uint8_t reg); + uint32_t (*gte_read_ctrl)(CPUState *cpu, uint8_t reg); + void (*gte_write_data)(CPUState *cpu, uint8_t reg, uint32_t value); + void (*gte_write_ctrl)(CPUState *cpu, uint8_t reg, uint32_t value); + /* RFE escape marker (ABI v12; see the version-history note above). + * Appended last; forwards unconditionally — v12 hosts always supply it + * and the ABI gate rejects DLL/host mixes that don't. */ + void (*rfe_mark_escape)(void); + /* Typed native-wide signed player-X bound (ABI v13; see the version-history + * note above). Computes against the host's live widescreen state (gpu.c + * psx_ws_player_x_bound). Appended last; may be NULL on a host that + * predates it — the DLL glue falls back to the vanilla constant (4:3). */ + int32_t (*ws_player_x_bound)(int32_t vanilla); + /* Sub-pixel GTE precision-store tracker (ABI v14; see version-history note + * above). The emitter emits a direct gte_precision_store_word() call for + * every swc2 (GTE store-word); it is stateful runtime code (gte.cpp) so the + * DLL must forward. Without the shim any shard containing a swc2 fails to + * LINK (undefined gte_precision_store_word) and runs interpreted forever — + * the rfe/gte_read_ctrl class again. Surfaced by full static overlay + * coverage (play-captured shards rarely compiled a swc2). Appended last; + * may be NULL on a host that predates it — the shim no-ops (precision + * tracking is a widescreen enhancement, off by default). */ + void (*gte_precision_store_word)(uint32_t addr, uint8_t reg); + /* Aspect-scaled far-bound helper (ABI v15). Runtime-state dependent, so + * overlay code forwards to the host; NULL preserves the vanilla bound. */ + int32_t (*ws_depth_bound)(int32_t imm); + /* Side frustum-plane normal-X helper (ABI v17). Runtime-state dependent, + * so overlay code forwards to the host; NULL preserves the vanilla + * normal. */ + int32_t (*ws_plane_nx)(int32_t nx); + + /* Per-primitive X-reject bound-load helper (ABI v18). Runtime-state + * dependent, so overlay code forwards to the host; NULL preserves the + * vanilla loaded value. */ + uint32_t (*ws_xclip_bound)(uint32_t vanilla); + + /* Guarded object/model participation comparison helper (ABI v19). + * Runtime-state dependent; NULL preserves the vanilla comparison. */ + uint32_t (*ws_cull_keep_result)(uint32_t vanilla, uint32_t forced); + + /* Aspect-aware model-participation cone helper (ABI v20). */ + uint32_t (*ws_aspect_cone_result)(uint32_t site, uint32_t vanilla, + uint32_t object, int32_t x, + int32_t z, int32_t y); + + /* Aspect-scaled terrain-frustum angle helper (ABI v21). */ + uint32_t (*ws_angle_widen)(uint32_t vanilla); + + /* Stale-static guard (ABI v22; see the version-history note above). + * Defined by the generated dispatch shard in the executable, so overlay + * DLLs must forward. Appended last; may be NULL on a host that predates + * it - the shim then returns 0 and the guest takes the dispatcher path. */ + int (*game_text_native_ok)(uint32_t addr); + + /* PGXP dataflow-shadowing hook table (pgxp_hooks.h). Only pgxp-flavour + * shards (PSX_OVERLAY_FLAVOR pgxp bit, compiled with -DPSX_PGXP=1) emit + * calls to psx_pgxp_*; their preamble forwards through this table. Base- + * flavour shards never reference it. Appended LAST; NULL on an older host + * no-ops every hook — precision shadowing is visual-only, never + * load-bearing. The ABI version bump that arms this ships with the + * emitter change (Phase 2 of docs/ENHANCEMENTS.md G1 value propagation). */ + const PGXPHooks *pgxp; + int32_t (*ws_screen_x_bound)(int32_t vanilla); + int (*mod_function_entry)(CPUState *cpu, uint32_t address); + /* The host's g_debug_last_store_pc (ABI v24; see the version-history note + * above). Overlay stores write it exactly as static and interpreted stores + * do. NULL leaves the DLL writing a private copy nothing reads. */ + uint32_t *last_store_pc; + int (*ws_masked_reject)(uint32_t flags, uint32_t mask); + int (*ws_nclip_branch)(uint32_t pc, uint32_t instr, int32_t mac0, int vanilla); + /* Frustum-edge bound scale helper (ABI v24). */ + int32_t (*ws_cull_scale)(int32_t bound, int32_t half_extent); + /* Exact-NCLIP branch sign (ABI v25). */ + int32_t (*nclip_exact_sign)(int32_t native_mac0, uint32_t pc); + /* Guarded pre-instruction mod callback (ABI v27). */ + void (*mod_instruction)(CPUState*, uint32_t, uint32_t); +} OverlayCallbacks; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported by every overlay DLL. Call once after LoadLibrary. */ +#ifdef _WIN32 +__declspec(dllexport) +#else +__attribute__((visibility("default"))) +#endif +void overlay_init(const OverlayCallbacks *cbs); + +#ifdef __cplusplus +} +#endif + +#endif /* OVERLAY_API_H */ diff --git a/overlay_toolchain/include/overlay_backend.h b/overlay_toolchain/include/overlay_backend.h new file mode 100644 index 00000000..b930bb51 --- /dev/null +++ b/overlay_toolchain/include/overlay_backend.h @@ -0,0 +1,58 @@ +#ifndef OVERLAY_BACKEND_H +#define OVERLAY_BACKEND_H + +/* overlay_backend — compiler-NEUTRAL overlay tier-selection policy. + * + * This is NOT specific to any one producer. It decides which native overlay + * tier fills a gap, in priority order: + * + * static > gcc shard > tcc shard > interp + * + * - gcc: spawn-gcc -> overlay DLL. The developer / production "holy grail" + * (best-optimized; the shards shipped in releases). + * - tcc: spawn-tcc -> overlay DLL. Bundled, toolchain-free user fallback that + * fills regions the shipped gcc cache misses on a machine without gcc. + * + * (The in-process sljit JIT tier was removed 2026-07-15 — it mis-compiled and + * had been gated off since 2026-06-25. Uncovered gaps fall to the interpreter.) + * + * gcc and tcc go through the IDENTICAL pipeline (recompiler -> C -> compiler -> + * DLL -> loader); they differ only in the compiler binary the autocompile + * command runs. So both map to the same in-runtime "code provider" (the + * autocompile spawn) — see code_provider.c — and which compiler runs is chosen + * here by the resolved backend. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + OVERLAY_BACKEND_AUTO = 0, /* gcc if a gcc toolchain is present, else tcc */ + OVERLAY_BACKEND_GCC = 1, /* force spawn-gcc->DLL (dev / production shards) */ + /* value 2 was OVERLAY_BACKEND_SLJIT (removed 2026-07-15) */ + OVERLAY_BACKEND_TCC = 3, /* spawn-tcc->DLL (bundled, toolchain-free fallback) */ + OVERLAY_BACKEND_AUTO_NO_GCC = 4 /* dev/test: resolve like AUTO but pretend no gcc toolchain + * (gcc shards still LOAD; gaps fill via tcc) — simulate a + * toolchain-less user box on a dev machine. */ +} OverlayBackend; + +/* Resolve the effective backend once at startup. `gcc_toolchain_available` is 1 + * when a gcc toolchain is actually reachable AND a compile command is wired (a + * real dev/production box). Precedence: env PSX_OVERLAY_BACKEND > game.toml + * [runtime] overlay_backend (`cfg`) > AUTO. AUTO -> gcc if the toolchain is + * present, else tcc. AUTO_NO_GCC -> tcc regardless (the simulate-user mode). + * The result is cached + logged. */ +OverlayBackend overlay_backend_resolve(const char *cfg, int gcc_toolchain_available); + +/* The cached resolution (OVERLAY_BACKEND_AUTO until resolve() runs). */ +OverlayBackend overlay_backend_active(void); + +/* "auto" | "gcc" | "tcc" | "auto-no-gcc". */ +const char *overlay_backend_name(OverlayBackend b); + +#ifdef __cplusplus +} +#endif + +#endif /* OVERLAY_BACKEND_H */ diff --git a/overlay_toolchain/include/overlay_capture.h b/overlay_toolchain/include/overlay_capture.h new file mode 100644 index 00000000..579e2aa2 --- /dev/null +++ b/overlay_toolchain/include/overlay_capture.h @@ -0,0 +1,88 @@ +#ifndef OVERLAY_CAPTURE_H +#define OVERLAY_CAPTURE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* overlay_capture — B-1 implementation of the overlay capture set. + * + * On every CD DMA completion into game-code RAM (dest < 0x1C0000), the runtime + * calls overlay_capture_on_dma(). The in-memory DMA set tracks the current + * image; executed outgoing variants are preserved as coherent immutable + * snapshots before replacement. At clean process exit, + * overlay_capture_write_json() writes the latest coherent manifest too. + */ + +/* Call once at startup (before the run loop) with the exe directory. + * Sets the output path for overlay_captures.json. Capture is not yet + * active — it activates automatically on the first post-game DMA transfer. */ +void overlay_capture_set_out_dir(const char *out_dir); + +/* Set the canonical capture manifest path directly. The runtime also keeps an + * immutable additive history in .d/ for future shard regeneration. */ +int overlay_capture_set_path(const char *path); + +/* Legacy init alias kept for compatibility; same as set_out_dir. */ +void overlay_capture_init(const char *out_dir); + +/* Enable/disable overlay capture. Off by default; main() enables it only when + * the overlay cache is turned on in [runtime] config. When disabled, + * overlay_capture_on_dma() and overlay_capture_write_json() are no-ops. */ +void overlay_capture_set_enabled(int enabled); + +/* Opt-in durable history. When enabled, every changed coherent latest snapshot + * is appended to overlay_captures.addendum.jsonl beside the executable. If + * persist_dir is non-empty, the same snapshot is also copied atomically to one + * new immutable JSON file there. game_id is used only in safe filenames. */ +void overlay_capture_configure_history(int enabled, const char *persist_dir, + const char *game_id); + +/* Call from dma.c execute_ch3_cdrom() after every forward CH3 transfer with + * load_start < 0x1C0000 and fntrace_is_game_started(). + * load_addr is the physical RAM destination, size is byte count, + * bytes points to the RAM buffer at that address (already written by DMA). */ +void overlay_capture_on_dma(uint32_t load_addr, uint32_t size, + const uint8_t *bytes); + +/* Called before a to-RAM CD DMA overwrites its destination. If that span held + * executed code, journal the coherent outgoing bytes/evidence first. */ +void overlay_capture_before_dma(uint32_t load_addr, uint32_t size); + +/* Write overlay_captures.json to the directory supplied at init time. + * Safe to call even if no overlays were captured (writes nothing). + * Called from shutdown_runtime() in main.cpp. */ +void overlay_capture_write_json(void); +/* Join any background snapshot writer before process shutdown. */ +void overlay_capture_wait_pending(void); + +/* Returns number of unique overlays captured so far. */ +int overlay_capture_count(void); + +/* Variant-capture automation (step 2.8): per-vblank tick that fires an + * automatic capture + background compile when the dirty-RAM interpreter + * shows sustained pressure inside a capture window (an uncovered variant + * being executed) at a coherent (not-loading) moment. Enabled by main() + * when [runtime] overlay_autocompile_cmd is configured. */ +void overlay_autocapture_set_enabled(int on); +void overlay_autocapture_tick(void); +/* Join any in-flight atomic writer before the final shutdown snapshot. */ +void overlay_autocapture_shutdown(void); +void overlay_autocapture_get_status(int *enabled, uint32_t *triggers, + uint64_t *last_delta); + +/* Compute CRC32 of the DMA-time bytes for the region [region_start, + * region_start+region_size). Zero-filled for gaps between DMA blocks, + * exactly as overlay_captures.json bytes_b64 is assembled. Use this + * in overlay_loader to build a consistent DLL filename without reading + * live RAM (which has scatter-load gap contamination). */ +uint32_t overlay_capture_get_region_crc(uint32_t region_start, + uint32_t region_size); + +#ifdef __cplusplus +} +#endif + +#endif /* OVERLAY_CAPTURE_H */ diff --git a/overlay_toolchain/include/overlay_dispatch_preamble.c.inc b/overlay_toolchain/include/overlay_dispatch_preamble.c.inc new file mode 100644 index 00000000..9a0dca67 --- /dev/null +++ b/overlay_toolchain/include/overlay_dispatch_preamble.c.inc @@ -0,0 +1,342 @@ +#include "overlay_api.h" +#include "ws_cull_edge.h" /* psx_ws_cull_bgez / psx_ws_clip_edge_x math */ + +/* ---- Overlay dispatch shim (inserted by compile_overlays.py) ----------- */ +static OverlayCallbacks g_cbs; +static uint32_t s_pending_cycles; + +PSX_OVERLAY_EXPORT void overlay_flush_cycles(void) { + uint32_t cycles = s_pending_cycles; + s_pending_cycles = 0; + if (cycles && g_cbs.advance_cycles) g_cbs.advance_cycles(cycles); +} + +/* Call-contract state (ABI v2): generated code reads/bumps the runtime's + * bail state through these pointers (cpu_state.h PSX_OVERLAY_DLL_BUILD + * branch). They start at local dummies so a pre-init call can't fault. */ +static int s_bail_dummy; +static uint64_t s_ctr_dummy0, s_ctr_dummy1; +int *g_psx_call_bail_p = &s_bail_dummy; +uint64_t *g_psx_bail_first_p = &s_ctr_dummy0; +uint64_t *g_psx_bail_resolved_p = &s_ctr_dummy1; +/* g_debug_last_store_pc (ABI v24): cpu_state.h maps the emitter's writes to + * *g_psx_last_store_pc_p. The runtime reads the value in every build (memory.c + * store filters, write attribution), so overlay_init points this at the host's + * copy; the local one only catches a store made before init or on a NULL host. */ +static uint32_t s_last_store_pc_local; +uint32_t *g_psx_last_store_pc_p = &s_last_store_pc_local; + +PSX_OVERLAY_EXPORT int overlay_abi(void) { + return PSX_OVERLAY_ABI_VERSION | (PSX_OVERLAY_FLAVOR << 16); +} + +PSX_OVERLAY_EXPORT void overlay_init(const OverlayCallbacks *cbs) { + g_cbs = *cbs; + if (g_cbs.call_bail_flag) g_psx_call_bail_p = g_cbs.call_bail_flag; + if (g_cbs.bail_first) g_psx_bail_first_p = g_cbs.bail_first; + if (g_cbs.bail_resolved) g_psx_bail_resolved_p = g_cbs.bail_resolved; + g_psx_last_store_pc_p = g_cbs.last_store_pc ? g_cbs.last_store_pc + : &s_last_store_pc_local; +} + +void psx_dispatch_call(CPUState *cpu, uint32_t addr, uint32_t ra) { + overlay_flush_cycles(); + (void)ra; + g_cbs.dispatch_call(cpu, addr, cpu->gpr[31]); +} +void psx_check_interrupts(CPUState *cpu) { + overlay_flush_cycles(); + g_cbs.check_interrupts(cpu); +} +void psx_check_interrupts_at(CPUState *cpu, uint32_t resume_pc) { + overlay_flush_cycles(); + if (g_cbs.check_interrupts_at) g_cbs.check_interrupts_at(cpu, resume_pc); + else g_cbs.check_interrupts(cpu); +} +void psx_advance_cycles(uint32_t cycles) { + if (cycles > UINT32_MAX - s_pending_cycles) overlay_flush_cycles(); + s_pending_cycles += cycles; +} +void gte_execute(CPUState *cpu, uint32_t cmd) { + overlay_flush_cycles(); + g_cbs.gte_execute(cpu, cmd); +} +int psx_syscall(CPUState *cpu, uint32_t code) { + overlay_flush_cycles(); + return g_cbs.psx_syscall(cpu, code); +} +void psx_native_bad_entry(CPUState *cpu, uint32_t owner, uint32_t pc) { + overlay_flush_cycles(); + if (g_cbs.psx_native_bad_entry) g_cbs.psx_native_bad_entry(cpu, owner, pc); +} +void psx_unknown_dispatch(CPUState *cpu, uint32_t addr, uint32_t phys) { + overlay_flush_cycles(); + g_cbs.psx_unknown_dispatch(cpu, addr, phys); +} +void debug_server_log_call_entry(uint32_t func_addr) { + if (g_cbs.log_call_entry) g_cbs.log_call_entry(func_addr); +} +void psx_restore_state_escape(void) { + overlay_flush_cycles(); + if (g_cbs.psx_restore_state_escape) g_cbs.psx_restore_state_escape(); +} +/* RFE escape marker (ABI v12): emitted at every `rfe`, including in + * overlay-resident exception-context code. Mutates the runtime's shared + * RFE-pending state, so it MUST forward (a local no-op would swallow + * exception returns). Unconditional — v12 hosts always supply it; the + * ABI gate rejects mixes that don't. */ +void psx_rfe_mark_escape(void) { + overlay_flush_cycles(); + g_cbs.rfe_mark_escape(); +} +/* Stale-static guard (ABI v22). The emitter emits this at block entry and + * before every direct jal, but it is DEFINED IN THE GENERATED DISPATCH SHARD + * (executable side), so an overlay DLL cannot resolve it without this shim. + * Its absence is what made 107 shards fail to link on the 2026-09-02 bump. + * NULL-guarded: returning 0 sends the guest down the dispatcher path, which is + * slower but never wrong -- the opposite choice (returning 1) would let an + * overlay run native code the guard was trying to reject. */ +int psx_game_text_native_ok(uint32_t addr) { + return g_cbs.game_text_native_ok ? g_cbs.game_text_native_ok(addr) : 0; +} +/* Faithful-timing functions (ABI v9): overlay code built with PSX_ENABLE_BLOCK_CYCLES + * emits these; forward to the runtime's real impls so native overlays charge cycles on + * the SAME timeline as the interp/BIOS (a local copy would diverge). NULL-guarded so a + * v9 DLL stays safe on a host that predates a given callback. */ +uint32_t psx_cyc_load_word(CPUState *cpu, uint32_t addr, uint32_t rt, uint32_t reg_mask) { + overlay_flush_cycles(); + return g_cbs.cyc_load_word ? g_cbs.cyc_load_word(cpu, addr, rt, reg_mask) : cpu->read_word(addr); +} +uint16_t psx_cyc_load_half(CPUState *cpu, uint32_t addr, uint32_t rt, uint32_t reg_mask) { + overlay_flush_cycles(); + return g_cbs.cyc_load_half ? g_cbs.cyc_load_half(cpu, addr, rt, reg_mask) : cpu->read_half(addr); +} +uint8_t psx_cyc_load_byte(CPUState *cpu, uint32_t addr, uint32_t rt, uint32_t reg_mask) { + overlay_flush_cycles(); + return g_cbs.cyc_load_byte ? g_cbs.cyc_load_byte(cpu, addr, rt, reg_mask) : cpu->read_byte(addr); +} +uint32_t psx_cyc_lwc2_read(CPUState *cpu, uint32_t addr) { + overlay_flush_cycles(); + return g_cbs.cyc_lwc2_read ? g_cbs.cyc_lwc2_read(cpu, addr) : cpu->read_word(addr); +} +void psx_icache_fetch(CPUState *cpu, uint32_t addr) { + overlay_flush_cycles(); + if (g_cbs.icache_fetch) g_cbs.icache_fetch(cpu, addr); +} +void psx_muldiv_set(CPUState *cpu, uint32_t latency) { + overlay_flush_cycles(); + if (g_cbs.muldiv_set) g_cbs.muldiv_set(cpu, latency); +} +void psx_muldiv_stall(CPUState *cpu) { + overlay_flush_cycles(); + if (g_cbs.muldiv_stall) g_cbs.muldiv_stall(cpu); +} +uint32_t psx_mult_latency_s(uint32_t rs) { + return g_cbs.mult_latency_s ? g_cbs.mult_latency_s(rs) : 0u; +} +uint32_t psx_mult_latency_u(uint32_t rs) { + return g_cbs.mult_latency_u ? g_cbs.mult_latency_u(rs) : 0u; +} +void psx_gte_stall(CPUState *cpu) { + overlay_flush_cycles(); + if (g_cbs.gte_stall) g_cbs.gte_stall(cpu); +} +void psx_gte_read(CPUState *cpu, uint32_t rt) { + overlay_flush_cycles(); + if (g_cbs.gte_read) g_cbs.gte_read(cpu, rt); +} +int psx_slice_block(CPUState *cpu, uint32_t block_addr, uint32_t bcyc, int side_effects) { + overlay_flush_cycles(); + return g_cbs.slice_block ? g_cbs.slice_block(cpu, block_addr, bcyc, side_effects) : 0; +} +/* GTE special-register accessors (ABI v10). The emitter routes masked, + * sign-extended, aliased/FIFO, read-only, precision-sensitive, flag/IR, and + * derived registers through these as DIRECT calls, so any + * GTE-heavy overlay (Tomba2 lava / Trolley attract demos) fails to link + * without them — undefined gte_read_ctrl was the signature that silently + * blocked all new overlay coverage. GTE state is SHARED runtime state; a + * local fallback would fork that timeline, so these forward + * unconditionally (ABI v10 hosts always supply them; the v10 gate rejects + * DLL/host mixes that don't). + * Proven bit-transparent registers retain direct CPUState-array fast paths; + * the shared emitter classification header is the source of truth. */ +uint32_t gte_read_data(CPUState *cpu, uint8_t reg) { + overlay_flush_cycles(); + return g_cbs.gte_read_data(cpu, reg); +} +uint32_t gte_read_ctrl(CPUState *cpu, uint8_t reg) { + overlay_flush_cycles(); + return g_cbs.gte_read_ctrl(cpu, reg); +} +void gte_write_data(CPUState *cpu, uint8_t reg, uint32_t value) { + overlay_flush_cycles(); + g_cbs.gte_write_data(cpu, reg, value); +} +void gte_write_ctrl(CPUState *cpu, uint8_t reg, uint32_t value) { + overlay_flush_cycles(); + g_cbs.gte_write_ctrl(cpu, reg, value); +} +/* Widescreen hooks (ABI v3): forward to the runtime's live widescreen state. + * Identity fallback if the host predates the callbacks (NULL) — so a v3 DLL + * stays correct (4:3) on an older host. */ +int psx_ws_backdrop_x(int x) { + return g_cbs.ws_backdrop_x ? g_cbs.ws_backdrop_x(x) : (int)(short)x; +} +int psx_ws_x_margin(void) { + return g_cbs.ws_x_margin ? g_cbs.ws_x_margin() : 0; +} +/* Shared render-funnel screen-X cull widening ([widescreen.cull] auto_screen_x). + * The recompiler emits `rt = psx_ws_cull_sltiu(sx, imm)` at every width-compare + * cull site, INCLUDING in overlay-resident code, so the overlay DLL must define + * it or it fails to link (undefined reference) -> no native shard -> that overlay + * variant runs interpreted forever (the dwarf-village-style lag). Self-contained: + * depends only on psx_ws_x_margin() above. Identity at 4:3 (margin 0). MUST stay + * byte-for-byte identical to gpu.c psx_ws_cull_sltiu. */ +int psx_ws_cull_sltiu(uint32_t sx, uint32_t imm) { + int m = psx_ws_x_margin(); + return ((uint32_t)((int32_t)(int16_t)(uint16_t)sx + m) + < (uint32_t)((int32_t)imm + 2 * m)) ? 1 : 0; +} +/* Signed-funnel variants (min/max + center±halfwidth idioms). Same contract: + * self-contained, identity at margin 0, MUST stay byte-for-byte identical to + * the gpu.c implementations. */ +int psx_ws_cull_slti(uint32_t sx, uint32_t imm) { + return ((int32_t)sx < (int32_t)imm + psx_ws_x_margin()) ? 1 : 0; +} +int psx_ws_cull_slti_lower(uint32_t sx, uint32_t imm) { + int32_t bound = (int32_t)(int16_t)(uint16_t)imm; + return ((int32_t)sx < bound - psx_ws_x_margin()) ? 1 : 0; +} +int psx_ws_cull_bltz(uint32_t v) { + return ((int32_t)v < -psx_ws_x_margin()) ? 1 : 0; +} +/* [widescreen.cull] bgez_sites and clip_edge_x_load_sites. The emitter writes + * these at a listed address whose instruction matches in overlay code too, so + * the shard must define them. Same math as gpu.c: both call the pure helpers + * in ws_cull_edge.h (stdint-only), over psx_ws_x_margin() above. */ +int psx_ws_cull_bgez(uint32_t v) { + return psx_ws_cull_bgez_value((int32_t)v, psx_ws_x_margin()); +} +uint32_t psx_ws_clip_edge_x(uint32_t v, uint32_t w) { + return psx_ws_clip_edge_x_value(v, w, psx_ws_x_margin()); +} +/* [widescreen.cull] screen_x_sites on `lui` and `bltz` (a screen X in the high + * half of a register). Emitted in overlay code at a listed address whose + * instruction matches, so the shard must define them. Same math as gpu.c. */ +uint32_t psx_ws_cull_lui_hi(uint32_t imm) { + return psx_ws_cull_lui_hi_value(imm, psx_ws_x_margin()); +} +int psx_ws_cull_bltz_hi(uint32_t v) { + return psx_ws_cull_bltz_hi_value(v, psx_ws_x_margin()); +} +int psx_ws_cull_vxrange(uint32_t x, uint32_t imm) { + int32_t margin = psx_ws_x_margin(); + uint32_t bound = (uint32_t)(int32_t)(int16_t)(uint16_t)imm; + return (((x + (uint32_t)margin) & 0xFFFFu) < + (bound + 2u * (uint32_t)margin)) ? 1 : 0; +} +void psx_ws_sprite_tag(CPUState *cpu) { + if (g_cbs.ws_sprite_tag) g_cbs.ws_sprite_tag(cpu); +} +/* Widescreen backdrop column-preload value (ABI v4). Identity fallback if the + * host predates the callback, so the DLL stays correct (4:3) on an older host. */ +uint32_t psx_ws_backdrop_value(uint32_t orig, int is_end, int window_cols) { + return g_cbs.ws_backdrop_value ? g_cbs.ws_backdrop_value(orig, is_end, window_cols) : orig; +} +/* Typed native-wide signed player-X bound (ABI v13). The emitter rewrites a + * configured [widescreen] signed_x_bound LUI site into + * psx_ws_player_x_bound(vanilla) (Einhander player bounds), including in + * overlay-resident code, so the DLL must define it or the shard fails to link + * (undefined reference — the rfe/gte_read_ctrl class). Computes against the + * host's live widescreen state; identity fallback (the vanilla constant, i.e. + * 4:3 behavior) if the host predates the callback. */ +int32_t psx_ws_player_x_bound(int32_t vanilla) { + return g_cbs.ws_player_x_bound ? g_cbs.ws_player_x_bound(vanilla) : vanilla; +} +int32_t psx_ws_screen_x_bound(int32_t vanilla) { + return g_cbs.ws_screen_x_bound ? g_cbs.ws_screen_x_bound(vanilla) : vanilla; +} +void psx_mod_instruction(CPUState *cpu, uint32_t address, uint32_t word) { + overlay_flush_cycles(); + if (g_cbs.mod_instruction) g_cbs.mod_instruction(cpu, address, word); +} +int psx_mod_function_entry(CPUState *cpu, uint32_t address) { + overlay_flush_cycles(); + return g_cbs.mod_function_entry ? g_cbs.mod_function_entry(cpu, address) : 0; +} +int32_t psx_ws_depth_bound(int32_t imm) { + return g_cbs.ws_depth_bound ? g_cbs.ws_depth_bound(imm) : imm; +} +int32_t psx_ws_plane_nx(int32_t nx) { + return g_cbs.ws_plane_nx ? g_cbs.ws_plane_nx(nx) : nx; +} +uint32_t psx_ws_xclip_bound(uint32_t vanilla) { + return g_cbs.ws_xclip_bound ? g_cbs.ws_xclip_bound(vanilla) : vanilla; +} +uint32_t psx_ws_cull_keep_result(uint32_t vanilla, uint32_t forced) { + return g_cbs.ws_cull_keep_result + ? g_cbs.ws_cull_keep_result(vanilla, forced) + : vanilla; +} +int psx_ws_masked_reject(uint32_t flags, uint32_t mask) { + return g_cbs.ws_masked_reject ? g_cbs.ws_masked_reject(flags, mask) : flags != 0u; +} +int psx_ws_nclip_branch(uint32_t pc, uint32_t instr, int32_t mac0, int vanilla) { + return g_cbs.ws_nclip_branch ? g_cbs.ws_nclip_branch(pc, instr, mac0, vanilla) : vanilla; +} +uint32_t psx_ws_aspect_cone_result(uint32_t site, uint32_t vanilla, + uint32_t object, int32_t x, int32_t z, + int32_t y) { + return g_cbs.ws_aspect_cone_result + ? g_cbs.ws_aspect_cone_result(site, vanilla, object, x, z, y) + : vanilla; +} +uint32_t psx_ws_angle_widen(uint32_t vanilla) { + return g_cbs.ws_angle_widen + ? g_cbs.ws_angle_widen(vanilla) + : vanilla; +} +int32_t psx_ws_cull_scale(int32_t bound, int32_t half_extent) { + return g_cbs.ws_cull_scale + ? g_cbs.ws_cull_scale(bound, half_extent) + : bound; +} +int32_t gte_nclip_exact_sign(int32_t native_mac0, uint32_t pc) { + return g_cbs.nclip_exact_sign + ? g_cbs.nclip_exact_sign(native_mac0, pc) + : (native_mac0 < 0 ? -1 : (native_mac0 > 0 ? 1 : 0)); +} +/* Sub-pixel GTE precision-store tracker (ABI v14). The emitter emits a direct + * gte_precision_store_word() call for every swc2 (GTE store-word), including in + * overlay-resident code, so the DLL must define it or the shard fails to link + * (undefined reference — the rfe/gte_read_ctrl class). Forwards to the host's + * stateful tracker (gte.cpp); no-op if the host predates the callback + * (precision tracking is a widescreen enhancement, off by default — 4:3 + * behavior is unaffected). */ +void gte_precision_store_word(uint32_t addr, uint8_t reg) { + if (g_cbs.gte_precision_store_word) g_cbs.gte_precision_store_word(addr, reg); +} +#if defined(PSX_PGXP) && PSX_PGXP +/* PGXP dataflow-shadowing hooks (pgxp_hooks.h; docs/ENHANCEMENTS.md G1.10). Only a + * pgxp-flavour shard (compiled -DPSX_PGXP=1, flavor bit set) references these + * — base-flavour shards preprocess the PGXP_*() macros away, so this block is + * compiled out of them entirely. Forwards to the host engine through the + * appended-last table; every hook no-ops on a host that predates it + * (precision shadowing is visual-only, never load-bearing). */ +void psx_pgxp_load(struct CPUState *cpu, uint32_t instr, uint32_t addr, uint32_t value) { + if (g_cbs.pgxp && g_cbs.pgxp->load) g_cbs.pgxp->load(cpu, instr, addr, value); +} +void psx_pgxp_store(struct CPUState *cpu, uint32_t instr, uint32_t addr, uint32_t value) { + if (g_cbs.pgxp && g_cbs.pgxp->store) g_cbs.pgxp->store(cpu, instr, addr, value); +} +void psx_pgxp_alu(struct CPUState *cpu, uint32_t instr, uint32_t result, uint32_t s1, uint32_t s2) { + if (g_cbs.pgxp && g_cbs.pgxp->alu) g_cbs.pgxp->alu(cpu, instr, result, s1, s2); +} +void psx_pgxp_muldiv(struct CPUState *cpu, uint32_t instr, uint32_t hi, uint32_t lo, uint32_t s1, uint32_t s2) { + if (g_cbs.pgxp && g_cbs.pgxp->muldiv) g_cbs.pgxp->muldiv(cpu, instr, hi, lo, s1, s2); +} +void psx_pgxp_cop2(struct CPUState *cpu, uint32_t instr, uint32_t value, uint32_t addr) { + if (g_cbs.pgxp && g_cbs.pgxp->cop2) g_cbs.pgxp->cop2(cpu, instr, value, addr); +} +#endif /* PSX_PGXP */ +/* ----------------------------------------------------------------------- */ diff --git a/overlay_toolchain/include/overlay_loader.h b/overlay_toolchain/include/overlay_loader.h new file mode 100644 index 00000000..ed954d4c --- /dev/null +++ b/overlay_toolchain/include/overlay_loader.h @@ -0,0 +1,192 @@ +#ifndef OVERLAY_LOADER_H +#define OVERLAY_LOADER_H + +/* overlay_loader — A-1 runtime overlay DLL cache and dynamic dispatch. + * + * On CD DMA completion (overlay_capture_on_dma), the loader checks whether + * a cached DLL exists for the overlay bytes. If it does, it LoadLibrary's + * the DLL, calls overlay_init() to wire callbacks, enumerates func_XXXXXXXX + * exports, and registers each in the dynamic dispatch table. + * + * dirty_ram_dispatch calls overlay_loader_dispatch() before the interpreter, + * so compiled overlay functions get priority over interpretation. + */ + +#include "cpu_state.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* The segment an overlay shard is compiled for unless its manifest says + * otherwise (docs/SEGMENT_AWARE_CODE.md §5.7). Captures record their bytes and + * dispatch_entry_pcs at the KSEG0 address (overlay_capture.c), and a manifest + * without an S record keys its entries there. The emitter bakes a shard's + * segment into every PC it makes: the $ra a jal/jalr writes, its jump and + * exception-resume PCs, its I-cache fetch tags and its store-PC stamps. The + * same bytes reached through KUSEG or KSEG1 run at a different architectural + * PC (a different link value; KSEG1 is uncached), so capture records each + * dispatch's segment, compile_overlays.py builds a shard per segment with + * entries (KUSEG and KSEG1 ones in the seg-kuseg/ and seg-kseg1/ cache + * subdirectories), and a shard runs only for PCs in its own segment; a PC with + * no shard of its segment is interpreted at its own PC. (OpenBIOS's exception + * path enters its RAM patch slots at KUSEG.) */ +#define PSX_OVERLAY_CODE_SEGMENT 0x80000000u +static inline int psx_overlay_code_segment_pc(uint32_t pc) { + return (pc & 0xE0000000u) == PSX_OVERLAY_CODE_SEGMENT; +} + +/* Called at game handoff to set the cache root directory and game ID. + * cache_dir: absolute path to the cache root (e.g. "build-dev/cache") + * game_id: product code (e.g. "SCUS-94236") */ +/* Host callback table handed to every loaded module (overlay shards and BIOS + * modules alike). Safe before overlay_loader_init. */ +struct OverlayCallbacks; +const struct OverlayCallbacks *overlay_loader_callbacks(void); + +/* "-" of this build (PSX_OVERLAY_ARCH_ABI), the cache layout's + * arch-abi segment. Also keyed into the BIOS module cache. */ +const char *overlay_loader_arch_abi(void); + +void overlay_loader_init(const char *cache_dir, const char *game_id, + uint32_t config_hash); + +/* Per-function native-disable for small timing-sensitive overlay routines. + * Addresses may be KUSEG/KSEG0/KSEG1; the loader keys by physical address. */ +int overlay_loader_native_block_add(uint32_t addr); + +/* (sljit removed 2026-07-15: overlay_loader_apply_live_policy was declared + * here to resolve the sljit live-execution policy after code_provider_init.) */ + +/* Called from overlay_capture_on_dma after the capture-set insert. + * Computes CRC32 of bytes, checks cache, loads DLL if present. + * load_addr: physical RAM address, size/bytes: the transferred data. */ +void overlay_loader_check_cache(uint32_t load_addr, uint32_t size, + const uint8_t *bytes); + +/* Called from dirty_ram_dispatch before the interpreter. + * Returns 1 and calls the compiled function if addr is registered, + * 0 if not found (fall through to interpreter). */ +int overlay_loader_dispatch(CPUState *cpu, uint32_t addr); + +/* Freeze new DLL discovery/load (lazy try_load_region, live publish commit, + * rescan). Already-registered natives keep running. Required for rollback + * resim / selfcheck: overlay registration is host-only and not in the snap, + * so a load mid-pass#1 that is visible at the start of pass#2 forks BB-edge + * IRQ cadence (matched clocks, mismatched GPRs). */ +void overlay_loader_set_load_freeze(int freeze); +int overlay_loader_load_frozen(void); + +/* Drop the negative lazy-lookup memo (host-only). Call on snap restore so + * resim#1 and resim#2 take the same dispatch path. */ +void overlay_loader_clear_lazy_miss(void); + +/* After RAM restore: bust overlay candidate gen fast-path + static-match + * cache so native vs interp is re-decided against restored bytes. */ +void overlay_loader_resync_validation_after_restore(void); + +/* Step 2.8: re-scan the cache dir for DLLs compiled after init and clear the + * checked-regions memo so the next dispatch reconsiders the cache. Idempotent + * (loaded DLLs stay loaded); emu thread only. */ +void overlay_loader_rescan(void); + +/* Two-phase live publication: the compile-output watcher maps a freshly + * published image off the emulation thread, then the emulation thread performs + * callback wiring, manifest validation, and candidate registration. The opaque + * object owns exactly one speculative library reference until commit/discard. */ +typedef struct OverlayPreparedImage OverlayPreparedImage; +OverlayPreparedImage *overlay_loader_prepare_published(const char *dll_path); +int overlay_loader_commit_published(OverlayPreparedImage *image); +void overlay_loader_discard_prepared(OverlayPreparedImage *image); + +/* True if the cache holds _.{dll,so}. */ +int overlay_loader_has_cached_crc(uint32_t region_start, uint32_t crc); + +/* Returns number of functions currently registered in the dynamic table. */ +int overlay_loader_registered_count(void); + +/* Returns full loader state for TCP diagnostics. */ +void overlay_loader_get_status(int *active, int *registered, + int *regions_checked, + char *cache_dir_out, int cache_dir_len, + char *game_id_out, int game_id_len, + uint32_t *checked_out, int checked_max, + int *checked_written, + uint32_t *last_crc_out, int *last_file_found_out); + +/* Most recent loader event string (DLL load success/failure). Surfaced via + * the overlay_loader_status TCP command — no stderr logging (Rule 3). */ +const char *overlay_loader_last_msg(void); + +/* Inc3 §8.5: a write into the code range of a currently-executing native + * overlay entry cannot be recovered lazily — that entry is permanently + * blacklisted to the interpreter. Called from the psx_write_* store path + * (memory.c) only when the written page is a watched overlay code page. */ +void overlay_loader_active_write_check(uint32_t phys, uint32_t size); +/* Invalidate negative lazy-lookups after a write to manifested code pages. */ +void overlay_loader_note_code_write(void); + +/* Inc3 counters, surfaced via overlay_loader_status (field meanings remapped + * to the per-entry model — see overlay_loader.c getters). */ +void overlay_loader_get_counters(uint32_t *loads, uint32_t *invalidations, + uint32_t *unregistered, + uint64_t *disp_native, uint64_t *disp_interp, + uint64_t *stale_blocked, + uint32_t *last_write_pc, + uint32_t *last_write_addr, + uint32_t *last_write_size, + int *regions, uint32_t *revalidations); +void overlay_loader_get_load_timing(uint64_t *total_us, uint64_t *max_us, + uint64_t *last_us); +/* Opt-in PSX_RUNTIME_PERF_DIAG sampler: returns and clears the hottest native + * owner since the preceding call. Counts owner activations, INCLUDING CPS + * continuations, not guest function invocations (use fntrace for entries). + * The bounded direct-mapped sampler can undercount on collision; it cannot + * inflate a count. Disabled runs pay no table update cost. */ +void overlay_loader_take_hot_native(uint32_t *pc, uint64_t *calls); +/* Exact shadow-differential summary for opt-in perf diagnostics. */ +void overlay_loader_get_shadow_summary(uint64_t *calls, uint64_t *divergences, + uint32_t *first_divergence_pc); + +void overlay_loader_get_reload_debug(int *r0_valid, uint32_t *r0_writes, + uint32_t *r0_fn_lo, uint32_t *r0_fn_hi, + uint32_t *r0_crc_live, + uint32_t *reval_attempts, + uint32_t *reval_crc_miss, + uint32_t *last_reval_crc); + +/* Dispatches that skipped the per-dispatch code-range crc32 via the unchanged + * page-generation fast path (overlay-cache v2 P2). */ +uint64_t overlay_loader_gen_fastpath(void); +int overlay_loader_range_link_count(void); +int overlay_loader_range_index_overflow(void); +int overlay_loader_lazy_manifest_count(void); +int overlay_loader_lazy_manifest_overflow(void); +uint64_t overlay_loader_candidate_overflow(void); +uint64_t overlay_loader_pair_aliases(void); +/* KUSEG/KSEG1 (and unmapped-segment) dispatches the loader left to the + * interpreter: no shard compiled for their segment is cached or valid yet + * (docs/SEGMENT_AWARE_CODE.md §5.7). Capture records their segment, so a + * warm cache takes this to 0. */ +uint64_t overlay_loader_segment_alias_interp(void); +/* KUSEG/KSEG1 dispatches run natively by a shard compiled for their segment. */ +uint64_t overlay_loader_segment_native(void); +int overlay_loader_dump_lazy_at(uint32_t addr, char *out, int cap); + +/* Overlay CI wrapper early-return attribution (PSX_POST_LOAD_PROBE). */ +void overlay_loader_get_ci_skip_diag(uint64_t *unit, uint64_t *supp, + uint64_t *none, uint64_t *sr, + uint64_t *deliv, uint64_t *enter); +int overlay_loader_call_unit_depth(void); +/* Native-shard nesting (active-candidate stack depth, in-progress entry), + * saved before and restored after a landing that longjmps out of a shard + * and resumes the interrupted code (render_pass.c watchdog abort). */ +void overlay_loader_native_nesting(int *active_depth, uint32_t *inprogress); +void overlay_loader_set_native_nesting(int active_depth, uint32_t inprogress); + +#ifdef __cplusplus +} +#endif + +#endif /* OVERLAY_LOADER_H */ diff --git a/overlay_toolchain/include/overlay_path_canon.h b/overlay_toolchain/include/overlay_path_canon.h new file mode 100644 index 00000000..bfebc7c0 --- /dev/null +++ b/overlay_toolchain/include/overlay_path_canon.h @@ -0,0 +1,39 @@ +/* overlay_path_canon.h — filesystem-resolved path canonicalization for the + * overlay cache's confinement boundary. A lexical prefix check can never be + * made correct against `..` segments or reparse points (symlinks/junctions): + * the only sound comparison resolves BOTH sides through the filesystem, the + * same way LoadLibrary/dlopen will resolve them, and prefix-checks the + * results. All functions fail CLOSED (0) on any resolution error. */ +#ifndef PSXRECOMP_OVERLAY_PATH_CANON_H +#define PSXRECOMP_OVERLAY_PATH_CANON_H + +#include + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Resolve `path` (file or directory; must exist) to its final normalized + * form — `..`, short names, and every reparse point resolved. Returns 1 and + * NUL-terminates `out` on success; 0 on any failure (missing, inaccessible, + * result longer than cap). */ +int overlay_path_canonicalize(const char *path, char *out, size_t cap); + +#ifdef _WIN32 +/* Same resolution from an already-open handle. Lets a caller open the file + * with restrictive sharing FIRST and validate the canonical identity of the + * object it actually holds — closing the validate-then-swap (TOCTOU) window + * before LoadLibrary. */ +int overlay_path_canonicalize_handle(HANDLE h, char *out, size_t cap); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_OVERLAY_PATH_CANON_H */ diff --git a/overlay_toolchain/include/overlay_posix.h b/overlay_toolchain/include/overlay_posix.h new file mode 100644 index 00000000..ffcfc81a --- /dev/null +++ b/overlay_toolchain/include/overlay_posix.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Parsed legacy _ or immutable + * __.{dll,so} cache filename. The parser is shared by the + * Windows and POSIX directory walkers so both platforms reject partial hex + * fields and lookalike suffixes identically. */ +typedef struct PsxOverlayCacheFile { + char name[40]; + char path[768]; + uint32_t region_start; + uint32_t content_crc; + uint64_t mtime; +} PsxOverlayCacheFile; + +typedef int (*PsxOverlayCacheVisitor)(const PsxOverlayCacheFile *file, + void *opaque); + +int psx_overlay_cache_name_parse(const char *name, uint32_t *region_start, + uint32_t *content_crc); + +/* POSIX helpers used by overlay_loader.c and its focused regression test. + * The Windows build provides inert stubs; it keeps using Win32 enumeration and + * LoadLibrary while still sharing the strict filename parser above. */ +int psx_overlay_posix_scan_cache_dir(const char *dir, + PsxOverlayCacheVisitor visitor, + void *opaque); +int psx_overlay_posix_find_other_cache_tag(const char *base_dir, + const char *expected_tag, + char *found_tag, + size_t found_tag_size); +void *psx_overlay_posix_library_open(const char *path, char *error, + size_t error_size); +void *psx_overlay_posix_library_symbol(void *handle, const char *name); +void *psx_overlay_posix_library_entry(void *handle, uint32_t entry); +void psx_overlay_posix_library_close(void *handle); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/parity_trace.h b/overlay_toolchain/include/parity_trace.h new file mode 100644 index 00000000..ef022cf0 --- /dev/null +++ b/overlay_toolchain/include/parity_trace.h @@ -0,0 +1,127 @@ +/* parity_trace.h — general two-process control-flow parity trace. + * + * Purpose: end the "somewhere upstream" blindness. A thread/TCB-scoped, + * freeze-on-trigger ring with an IDENTICAL struct + JSON wire format on BOTH + * psx-runtime (code under test) and psx-beetle (independent oracle), so a + * generic sequence-diff tool (tools/parity_diff.py) can locate the FIRST logical + * divergence between the two timelines — not a frame diff (docs/internal/PRINCIPLES.md "find + * the first divergence" + "is the value WRONG or is the behavior MISSING"). + * + * Model (CLAUDE.md ring-buffer doctrine): armed from boot (so the pre-divergence + * window is always covered — never arm-then-time), records one row per relevant + * control event while current_tcb == watched_tcb (or all TCBs if watched==0), + * and LATCHES (freezes) the moment a configured trigger target is dispatched, so + * the lead-up to the wedge survives instead of being evicted by the wedge loop. + * + * Generality: point it at any watched TCB + freeze trigger + up to six watch-word + * addresses. The MMX6 cutscene→gameplay freeze is the first user, but nothing + * here is MMX6-specific — it is the reusable substrate for a functional-parity + * audit between recomp and oracle. + */ +#ifndef PARITY_TRACE_H +#define PARITY_TRACE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PARITY_KIND_DISPATCH = 0, /* psx_dispatch iteration (per-leader) */ + PARITY_KIND_CHANGETHREAD, /* syscall-3 ChangeThread decision point */ + PARITY_KIND_RFE, /* ReturnFromException */ + PARITY_KIND_YIELD, /* scheduler cross-thread switch committed */ + PARITY_KIND_SAVE, /* context saved to a TCB */ + PARITY_KIND_RESTORE, /* context restored from a TCB */ + PARITY_KIND_TRIGGER, /* the freeze trigger fired (final row) */ +} parity_kind_t; + +#define PARITY_WATCH_MAX 6 + +typedef struct { + uint64_t seq; + uint32_t frame; + uint32_t kind; + uint64_t cycle; /* absolute guest CPU cycles since boot (the deterministic + * ruler; native psx_get_cycle_count / Beetle + * beetle_core_get_guest_cycles — directly comparable) */ + uint32_t current_tcb; + uint32_t pc; + uint32_t ra; + uint32_t sp; + uint32_t epc; /* resume PC read from watched TCB (epc slot) */ + uint32_t tcb_state; /* state/status word read from watched TCB */ + uint32_t target; /* dispatch / switch target */ + uint32_t watch[PARITY_WATCH_MAX]; + /* Per-watch-word LAST-WRITER provenance (set by parity_trace_note_write): + * the exact store PC, guest cycle, frame, and (approx) writing TCB of the + * most recent write to each watch word. This is what turns "the value + * diverged" into "who/when produced the divergent value" — diff these across + * native vs Beetle to name the early producer of a gate input. */ + uint32_t watch_wpc[PARITY_WATCH_MAX]; + uint64_t watch_wcycle[PARITY_WATCH_MAX]; + uint32_t watch_wframe[PARITY_WATCH_MAX]; + uint32_t watch_wtcb[PARITY_WATCH_MAX]; +} ParityEntry; + +/* Each process supplies its own RAM reader (recomp: cpu->read_word; Beetle: + * PS_CPU peek). ctx is passed back verbatim. */ +typedef uint32_t (*parity_read_word_fn)(void* ctx, uint32_t addr); + +/* Configure. watched_tcb==0 => record all TCBs. trigger_target==0 => no freeze. + * tcb_epc_off / tcb_state_off are watched-TCB-relative byte offsets (PSX BIOS: + * epc slot = tcb+0x88, state word = tcb+0x00). watch_addrs/watch_count: up to + * PARITY_WATCH_MAX guest word addresses snapshotted on every row. Does not arm. */ +void parity_trace_config(uint32_t watched_tcb, uint32_t trigger_target, + uint32_t tcb_epc_off, uint32_t tcb_state_off, + const uint32_t* watch_addrs, int watch_count); +void parity_trace_arm(int on); /* on=1 begins recording (idempotent) */ +void parity_trace_reset(void); /* clear ring + unfreeze (keeps config) */ +int parity_trace_is_armed(void); /* hot-path gate: cheap one-branch check */ +int parity_trace_is_frozen(void); + +/* Record one event. read_word+ctx source current_tcb (via TCBH 0x108), the + * watched-TCB epc/state, and the watch words. No-op unless armed, not frozen, + * and (watched==0 || current_tcb==watched). Latches on target==trigger. */ +void parity_trace_record(parity_kind_t kind, uint32_t pc, uint32_t ra, + uint32_t sp, uint32_t target, + parity_read_word_fn read_word, void* ctx); + +/* Note a guest memory write so the per-watch-word last-writer table stays + * current. addr may be guest-virtual or physical (masked internally); width is + * the access size in bytes (1/2/4); writer_pc is the EXACT store instruction PC + * (native: g_debug_last_store_pc; Beetle: the store pc from the wtrace hook). + * Updates a watch slot iff [addr,addr+width) overlaps that watch word. No-op + * unless armed and not frozen. Called from BOTH processes' write paths so the + * provenance is directly comparable. The writing TCB is taken from the most + * recent recorded control event (a cheap, accurate-in-practice approximation — + * the writer is the running thread). */ +void parity_trace_note_write(uint32_t addr, uint32_t width, uint32_t writer_pc); + +/* Read-side counterpart of parity_trace_note_write: record the EXACT load PC that + * last consumed each watch word (read provenance), so a diverging value can be + * traced to the last reader as well as the last writer. addr may be guest-virtual + * or physical (masked internally); value is the loaded word; reader_pc is the load + * instruction PC. No-op unless armed and not frozen. Called from both processes' + * read paths so read provenance is directly comparable. */ +void parity_trace_note_read(uint32_t addr, uint32_t value, uint32_t reader_pc); + +/* Readback (matches the beetle_fntrace_get pattern): copies up to max_rows + * NEWEST entries, oldest-first, into out[]; returns the count copied. */ +uint32_t parity_trace_get(ParityEntry* out, uint32_t max_rows); +uint64_t parity_trace_total(void); +const char* parity_kind_str(uint32_t kind); + +/* Readback for the dedicated READ ring (parity_trace_note_read). Same shape as + * parity_trace_get/total: newest rows oldest-first. Each row's pc = load PC, + * epc = read address, target/watch[slot] = loaded value, watch_w* = the last + * writer of that word at read time. Backs the debug server's parity_dump reads=1. */ +uint32_t parity_trace_reads_get(ParityEntry* out, uint32_t max_rows); +uint64_t parity_trace_reads_total(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PARITY_TRACE_H */ diff --git a/overlay_toolchain/include/pgxp.h b/overlay_toolchain/include/pgxp.h new file mode 100644 index 00000000..6c06b9c8 --- /dev/null +++ b/overlay_toolchain/include/pgxp.h @@ -0,0 +1,340 @@ +#ifndef PGXP_H +#define PGXP_H + +/* PGXP value-propagation engine — runtime-internal API (pgxp.cpp). + * + * The engine shadows every 32-bit word of guest RAM/scratchpad, every GPR, + * and every GTE data register with the sub-pixel projection it carries + * (screen X/Y in 16.16 plus the projected SZ depth). The GTE fills shadows at + * RTPS/RTPT; the psx_pgxp_* hooks (pgxp_hooks.h) move them along with the + * data; the GPU asks for the precise position of each GP0 vertex word by the + * packet's RAM address, validated against the actual word — never guessed + * from the rounded position (the measured G1.4 dead end). + * + * Guest-visible state is NEVER touched: shadows are host-only, dropped on + * savestate/rewind, and suppressed during speculative validation passes. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* --- lifecycle / configuration ------------------------------------------ */ + +/* Master arm. Allocates the RAM shadow lazily; fails closed (stays disabled) + * if the allocation fails. Idempotent. */ +void pgxp_set_enabled(int enabled); +int pgxp_enabled(void); +/* Armed and not inside a suppression bracket (speculative/replay pass): + * whether the hooks record anything right now. */ +int pgxp_active(void); + +/* Tier-2 propagation through CPU arithmetic (default off, like the reference + * implementations' default). Off is SAFE — value validation already stops + * stale shadows — it only bounds coverage. Live-tunable (TCP). */ +void pgxp_set_cpu_mode(int enabled); +int pgxp_cpu_mode(void); + +/* Reject a precise position whose sub-pixel offset from the native integer + * position exceeds this many pixels. < 0 disables the clamp (default). */ +void pgxp_set_tolerance(float pixels); +float pgxp_tolerance(void); + +/* Position-cache fallback tier (docs/ENHANCEMENTS.md G1.4/G1.11). On (the + * default, unchanged behaviour): a vertex with no validated dataflow shadow + * may take the sub-pixel fraction of the projection last cached at its integer + * screen position. Off ("dataflow only"): such a vertex draws native, and + * gte.cpp stops filling the cache. A title whose build carries the PGXP hooks + * reaches near-total dataflow coverage, so for it the cache only adds wrong + * fractions to CPU-built 2D polygons that happen to share a position with + * some unrelated 3D vertex. Live-tunable. */ +void pgxp_set_position_fallback(int enabled); +int pgxp_position_fallback(void); + +/* Preserve projection precision (docs/ENHANCEMENTS.md G1.11). Off (the + * default): RTPS/RTPT shadow the pre-truncation position the GTE itself + * computes from the integer IR1/IR2 and its UNR divide, so the shadow always + * truncates to the guest's SXY. On: they shadow the exact projection of the + * vertex, from the unshifted MACs (12 more fractional bits than IR/SZ3) and a + * true divide (pgxp_project_precise), which removes the residual wobble of + * near geometry. Guest-visible SXY, MAC0 and FLAG are unchanged either way. + * Because that position can then differ from the guest integer by more than + * the fraction, truncation agreement becomes a window (PGXP_PPP_AGREE_*) and + * a vertex at the GTE's saturation limit must still agree exactly. One + * consumer is not visual: [widescreen] precise_nclip takes its branch sign + * from these shadows, so in a title that sets both, that (already + * non-faithful) widescreen sign follows the exact projection too. */ +void pgxp_set_preserve_projection(int enabled); +int pgxp_preserve_projection(void); + +/* Truncation-agreement window under preserve-projection, in whole pixels: + * accept -BELOW < precise - native < ABOVE. For a value-validated shadow + * whose packet half is neither at the GTE saturation limit nor wrapped by the + * GPU's 11-bit parse (both of which need exact agreement), the guest + * integer is the IR path's floor of the same projection, so the difference is + * bounded by the IR path's own error: the dropped fraction (< 1 px), IR1/IR2 + * truncation times H/SZ3 (< 2 px without divide overflow), and SZ3's + * truncation scaling the offset from the screen centre by up to + * |offset|/SZ3. The window is a sanity bound over that, not a filter of + * correct vertices: for R4 (H = 290) every on-screen vertex lies within it + * (measured range -1.9 .. 2.6 px), and what it rejects is an extreme near + * vertex far off-screen, which then draws where the hardware puts it. */ +#define PGXP_PPP_AGREE_BELOW 4 +#define PGXP_PPP_AGREE_ABOVE 5 + +/* The exact projection for preserve-projection mode, in the 16.16 screen + * space of the IR path. Inputs are RTPS's unshifted 44-bit MAC1..3, the shift + * (12 for sf=1), the IR1/IR2 the GTE stored, the SZ3 it pushed, H, OFX/OFY + * and the horizontal widescreen factor x_num/x_den the IR path applied (1/1 + * when none). Returns 1 with the position in x16/y16 when the vertex + * qualifies (sf=1, IR1/IR2 not saturated, SZ3 not saturated and nonzero, and + * no divide overflow: H < 2*SZ3), else 0 and the caller keeps the IR path. */ +int pgxp_project_precise(int64_t mac1, int64_t mac2, int64_t mac3, int shift, + int32_t ir1, int32_t ir2, uint32_t sz3, uint32_t h, + int32_t ofx, int32_t ofy, int64_t x_num, int64_t x_den, + int32_t *x16, int32_t *y16); + +/* Whether an exact projection may be the shadow of the SXY word `packed`: + * the consumer's truncation agreement (the PGXP_PPP_AGREE_* window, exact at + * the saturation limits) on both halves. When it fails, RTPS keeps the IR + * path's shadow, which always agrees, so the vertex still draws precise + * instead of being rejected at the GPU. Counts ppp_produced on accept and + * ppp_window_fallback on reject. */ +int pgxp_ppp_accept(int32_t x16, int32_t y16, uint32_t packed); + +/* Precise culling (docs/ENHANCEMENTS.md G1.12). Off (the default): NCLIP is + * exactly the hardware's. On, while geometry correction is armed: when the + * three SXY FIFO shadows are live, describe the current register words and + * pass the same acceptance the GPU applies when it draws them, and the sign + * of their exact determinant differs from the integer one, NCLIP's MAC0 + * takes the exact sign (magnitude: the exact doubled area rounded, at least + * 1). A game that culls on that sign then keeps the sub-pixel faces PGXP + * draws with positive area -- the far road rows a native zero-area test + * drops, which open gaps between their precisely placed neighbours -- and + * drops the slivers whose drawn winding is reversed. This CHANGES + * guest-visible MAC0 and so guest control flow: only the mod arms it + * (netplay clears the mod), and gte.cpp holds it off in every pass that is + * compared against another execution (overlay shadow diff, speculative and + * replay passes). Live-tunable over TCP. */ +void pgxp_set_culling(int enabled); +int pgxp_culling(void); + +/* NCLIP's exact determinant from the SXY0..2 register shadows, in 2^-32 + * px^2 units (16.16 times 16.16). Returns 1 when all three shadows are live, + * carry the register words in sxy[] and pass the GPU consumer's truncation + * agreement and tolerance clamp; else 0. Counts nclip_precise. */ +int pgxp_gte_nclip_precise(const uint32_t sxy[3], int64_t *cross); + +/* Mod-owned request (the framework's psx.enhancement.pgxp package). + * + * The mod's activation runs at session start, before main.cpp's renderer + * setup, and that setup applies the [video] baseline (geometry_correction, + * perspective_texturing, pgxp_cpu_mode). An activation that armed the + * corrections directly was switched straight back off there. So the + * activation only records a request, and the session arming + * (psx_pgxp_session_arm, pgxp_session.h) takes it -- reads and clears it -- + * and combines it with the baseline. A request therefore lives only from one + * session's activation to that session's arming: a later session whose plan + * is empty (netplay, or the mod disabled) cannot inherit it. + * reset_mod_owned_presentation() also clears it at every session start. */ +void pgxp_mod_request(int enabled, int cpu_mode, int culling); +/* Returns nonzero when this session's plan asked for PGXP; *cpu_mode and + * *culling (either may be NULL) receive the mod's options. */ +int pgxp_mod_requested(int *cpu_mode, int *culling); +/* pgxp_mod_requested, then clears the request. */ +int pgxp_mod_request_take(int *cpu_mode, int *culling); + +/* Drop all shadows (savestate load, raw RAM restore, timeline breaks). + * O(1) via generation bump. Deferred while suppressed. */ +void pgxp_invalidate_all(void); + +/* Counted suppression bracket for speculative native-validation passes and + * the GTE replay sandbox: hooks and producers no-op inside it. */ +void pgxp_suppress_begin(void); +void pgxp_suppress_end(void); + +/* --- GTE producer (gte.cpp) ---------------------------------------------- */ + +/* Called at the RTPS/RTPT projection with the pre-truncation 16.16 screen + * coordinates, the projected depth (SZ3), and the packed SXY word the guest + * sees. Shifts the shadow FIFO exactly like push_sxy (regs 12..15). */ +void pgxp_gte_push_sxy(int32_t x16, int32_t y16, uint16_t sz3, uint32_t packed); + +/* Host-only homogeneous screen projection, before SZ/SXY/divider saturation. + * x/z and y/z are screen pixels; signed z retains camera-plane crossings. + * Exact full-word copies carry it. Arithmetic/partial writes invalidate it. */ +typedef struct PGXPProjection { float x, y, z, near_z; } PGXPProjection; +void pgxp_set_projection_tracking(int enabled); +int pgxp_projection_tracking(void); +void pgxp_gte_set_projection(const PGXPProjection *projection); +int pgxp_load_projection(uint32_t addr, uint32_t packed, PGXPProjection *out); +int pgxp_get_gte_projection(uint32_t index, uint32_t packed, PGXPProjection *out); + +/* Current SXY FIFO shadow (index 0..3 selects GTE data regs 12..15). + * Returns nonzero when the shadow is live and carries X/Y precision. */ +int pgxp_get_gte_sxy(uint32_t index, int32_t *x16, int32_t *y16); +/* Validate-on-read variant: check!=0 additionally requires the shadow's packed + * word to equal expect (the live guest SXY word). Sign consumers must use this + * form so stale FIFO shadows fail closed to native integer behavior. */ +int pgxp_get_gte_sxy_checked(uint32_t index, uint32_t expect, int check, + int32_t *x16, int32_t *y16); + +/* Guest write to a GTE data register outside gte_execute (MTC2/CTC2 handled + * by psx_pgxp_cop2; this is for direct gte_write_data paths): reg 15 performs + * the SXYP FIFO push on the shadows, others just invalidate/overwrite. */ +void pgxp_gte_reg_written(int reg, uint32_t value); + +/* --- GPU consumer (gpu.c) ------------------------------------------------ */ + +enum { + PGXP_SRC_NATIVE = 0, /* no shadow — caller uses the parsed integers */ + PGXP_SRC_FALLBACK = 1, /* position-cache fallback (never carries depth)*/ + PGXP_SRC_DATAFLOW = 2, /* address-keyed shadow, value-validated */ +}; + +/* Precise position for one GP0 vertex word. + * addr guest address the word was DMA'd from, or 0xFFFFFFFF if + * unknown (immediate GP0 writes) — skips the dataflow tier. + * packet_word the actual word (validation key). + * int_x/int_y the natively parsed 11-bit positions (pre-draw-offset). + * On DATAFLOW/FALLBACK, *x16/*y16 hold the sub-pixel position (16.16, same + * coordinate space as the packet halves); *sz is the projected depth or 0. + * Safeguards applied here: the integer part must match the native parse + * (truncation agreement; a bounded window under preserve-projection) and the + * tolerance clamp. The fallback tier is skipped when position fallback is + * off. */ +int pgxp_get_precise_vertex(uint32_t addr, uint32_t packet_word, + int32_t int_x, int32_t int_y, + int32_t *x16, int32_t *y16, uint16_t *sz); + +/* Same decision as pgxp_get_precise_vertex, without counting it in the stats + * (the caller looks the vertex up again when it draws). */ +int pgxp_probe_precise_vertex(uint32_t addr, uint32_t packet_word, + int32_t int_x, int32_t int_y); + +/* --- observability -------------------------------------------------------- */ + +typedef struct PGXPStats { + uint64_t lookups; /* pgxp_get_precise_vertex calls */ + uint64_t dataflow_hit; + uint64_t fallback_hit; + uint64_t native; + uint64_t value_mismatch; /* shadow present but wrong word (stale) */ + uint64_t trunc_reject; /* integer part disagreed with native parse */ + uint64_t tolerance_reject; + uint64_t w_valid; /* lookups that also carried a usable depth */ + uint64_t produced; /* RTPS/RTPT projections pushed into shadows */ + uint64_t swc2_stores; /* GTE reg shadows copied to RAM shadows */ + uint64_t ppp_produced; /* of those, shadowed with the exact projection */ + uint64_t ppp_window_fallback;/* exact projection outside the agreement + * window: shadowed with the IR path instead */ + /* Geometry-corrected triangles by how many of their 3 vertices came out + * precise (gpu.c prepare_precise_triangle). `mixed` is the mesh-cracking + * exposure of docs/ENHANCEMENTS.md G1.1: an edge between a precise and a + * native vertex can disagree with its neighbour by the dropped fraction. */ + uint64_t tri_precise; /* all three precise */ + uint64_t tri_mixed; /* one or two precise */ + uint64_t tri_native; /* none precise */ + /* Textured quads that are axis-aligned rectangles in integer screen space + * (and in UV) whose four vertices are all dataflow-precise, so they were + * drawn as two precise triangles instead of the native 2D rectangle + * shortcut; rect_partial: such rectangles with 1..3 precise vertices, + * which keep the shortcut (drawing them as triangles would mix). */ + uint64_t rect_bypass; + uint64_t rect_partial; + /* NCLIPs while geometry correction is armed (docs/ENHANCEMENTS.md G1.12): + * nclip_precise had an exact determinant; nclip_disagree: its sign (non- + * zero) differs from the integer MAC0's, so the game's cull decision on + * that face disagrees with the face PGXP draws -- the crack exposure that + * tri_* cannot see, because a culled face draws no triangle at all; + * nclip_corrected: of those, MAC0 replaced by precise culling. */ + uint64_t nclip_precise; + uint64_t nclip_disagree; + uint64_t nclip_corrected; + /* pgxp_load_precise_word outcomes (perspective texturing, per vertex): + * which check refused the depth. untracked = no shadow for that address in + * this generation; mismatch = shadow describes a different word; partial = + * only one half carries a projection; no_z = projection without depth. */ + uint64_t word_lookups; + uint64_t word_hit; + uint64_t word_untracked; + uint64_t word_mismatch; + uint64_t word_partial; + uint64_t word_no_z; +} PGXPStats; + +void pgxp_get_stats(PGXPStats *out); +/* Count one geometry-corrected triangle with `precise` (0..3) precise + * vertices. */ +void pgxp_note_triangle(int precise); +/* One rectangle-shortcut quad sent down the triangle path (all_precise) or + * kept on the shortcut with only some precise vertices. */ +void pgxp_note_rect_bypass(int all_precise); +/* One NCLIP whose exact sign disagreed with MAC0, and whether MAC0 was + * corrected. */ +void pgxp_note_nclip(int disagree, int corrected); + +/* --- gte.cpp forwarding surface (v14 ABI compat) -------------------------- */ + +/* SWC2 site: copy the GTE register shadow (regs 12..15) to the RAM shadow. */ +void pgxp_store_gte_reg(uint32_t addr, uint8_t reg); + +/* Address-keyed precise-word lookup (perspective texturing path). Returns + * nonzero when the tracked word matches `packed` AND carries a depth. */ +int pgxp_load_precise_word(uint32_t addr, uint32_t packed, + int32_t *x16, int32_t *y16, uint16_t *z); + +/* Render-pass checkpoint: journal every shadow a sandboxed pass mutates and + * put the shadows back when the sandbox restores the machine. Use through + * gte_precision_checkpoint_begin / _rollback (which also cover gte.cpp). */ +void pgxp_checkpoint_begin(void); +void pgxp_checkpoint_rollback(void); + +/* Refused precise-word lookups, newest at (seq - 1) % cap (TCP pgxp_miss_ring). */ +enum { + PGXP_MISS_UNTRACKED = 1, + PGXP_MISS_MISMATCH = 2, + PGXP_MISS_PARTIAL = 3, + PGXP_MISS_NO_Z = 4 +}; +#define PGXP_MISS_RING_CAP 8192u +typedef struct PGXPWordMiss { + uint64_t seq; + uint32_t addr; /* packet word address (canonical RAM offset) */ + uint32_t packet; /* the word the GPU consumed */ + uint32_t shadow_value; /* the word the shadow describes */ + uint8_t shadow_flags; /* 1 = X, 2 = Y, 4 = Z */ + uint8_t live; /* shadow belongs to the current generation */ + uint8_t reason; /* PGXP_MISS_* */ +} PGXPWordMiss; +/* Returns the total number of misses ever recorded. */ +uint64_t pgxp_word_miss_ring(const PGXPWordMiss **ring, uint32_t *cap); + +/* Debug read of one shadow slot (TCP pgxp_shadow). `space`: 0 = guest + * address (RAM / scratchpad), 1 = GPR index (32 = HI, 33 = LO), 2 = GTE data + * register. Returns 0 when the slot does not exist; *live says whether it + * belongs to the current generation. */ +int pgxp_debug_shadow(int space, uint32_t key, int *live, uint32_t *value, + uint32_t *flags, int32_t *x16, int32_t *y16, + uint16_t *z); + +/* --- test accessors (always compiled; trivial) ---------------------------- */ + +/* index 0..3 selects the SXY0..SXYP register shadow (GTE data regs 12..15). */ +void pgxp_test_seed_gte_sxy(uint32_t index, uint32_t packed, + int32_t x16, int32_t y16, uint16_t z, int valid); +void pgxp_test_get_gte_sxy(uint32_t index, uint32_t *packed, + int32_t *x16, int32_t *y16, uint16_t *z, + uint8_t *valid); +uint32_t pgxp_test_generation(void); +uint32_t pgxp_test_suppress_depth(void); +int pgxp_test_active(void); +void pgxp_test_set_generation(uint32_t gen); + +#ifdef __cplusplus +} +#endif + +#endif /* PGXP_H */ diff --git a/overlay_toolchain/include/pgxp_hooks.h b/overlay_toolchain/include/pgxp_hooks.h new file mode 100644 index 00000000..df9d3075 --- /dev/null +++ b/overlay_toolchain/include/pgxp_hooks.h @@ -0,0 +1,93 @@ +#ifndef PGXP_HOOKS_H +#define PGXP_HOOKS_H + +/* PGXP dataflow-shadowing hook surface (docs/ENHANCEMENTS.md G1.2/G1.3). + * + * The runtime keeps a host-only "shadow" of sub-pixel GTE projection results + * and follows them BY PROVENANCE as the game moves them through registers and + * RAM into a GP0 packet (pgxp.cpp). Generated code participates by calling + * these hooks after the guest operation completes. + * + * Gating model (the G1.3 decision): the emitter writes PGXP_*() macro + * invocations unconditionally; this header expands them to real calls only + * when the translation unit is compiled with -DPSX_PGXP=1 (the pgxp build + * variant). In the base variant the macros expand to ((void)0), so base + * objects compile to exactly the pre-feature code — the feature costs nothing + * unless a title links the pgxp target. + * + * RULES for emit sites: + * - Macro arguments MUST be side-effect free (they vanish in base builds). + * - Hooks run AFTER the guest architectural effect (value = what actually + * loaded/stored/resulted), so the shadow can validate against reality. + * - `cpu` must be in scope at every emit site (it always is in generated C). + * + * The interpreters (dirty_ram_interp.c, psx_interpreter.c) call the + * psx_pgxp_* functions directly — they are runtime code compiled once, and + * every hook early-outs on a single global when the feature is off. + * + * Overlay DLLs cannot link runtime symbols directly; they forward through the + * PGXPHooks table below (OverlayCallbacks.pgxp, overlay_api.h). A NULL table + * no-ops every hook — precision shadowing is a visual enhancement, never + * load-bearing. + * + * LICENSING: this is a clean-room implementation of the publicly documented + * PGXP technique (psx-spx, public design write-ups). Do NOT port code from + * the vendored duckstation/ (CC BY-NC-ND) or beetle-psx/ (GPL) trees; they + * are black-box behavioral oracles only. See docs/ENHANCEMENTS.md G1. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct CPUState; + +/* Funnel entry points (implemented in runtime/src/pgxp.cpp). The raw + * instruction word carries the op/rs/rt/rd/imm decode so the emitted call is + * uniform per class; `value` is the architectural result of the operation. + * + * load: rt <- [addr]; value = loaded word/half/byte (post-extension) + * store: [addr] <- rt; value = the stored word/half/byte + * alu: rd/rt <- op(s1, s2); result = the written value (also LUI, HILO + * moves and MOVE idioms — the body decodes the class from instr) + * muldiv: HI/LO <- op(s1, s2) + * cop2: MFC2/CFC2/MTC2/CTC2 (addr = 0) and LWC2/SWC2 (addr = guest addr); + * value = the transferred word + */ +void psx_pgxp_load (struct CPUState *cpu, uint32_t instr, uint32_t addr, uint32_t value); +void psx_pgxp_store (struct CPUState *cpu, uint32_t instr, uint32_t addr, uint32_t value); +void psx_pgxp_alu (struct CPUState *cpu, uint32_t instr, uint32_t result, uint32_t s1, uint32_t s2); +void psx_pgxp_muldiv(struct CPUState *cpu, uint32_t instr, uint32_t hi, uint32_t lo, uint32_t s1, uint32_t s2); +void psx_pgxp_cop2 (struct CPUState *cpu, uint32_t instr, uint32_t value, uint32_t addr); + +/* Forwarder table for overlay DLLs (OverlayCallbacks.pgxp). Appended-last + * member semantics apply: a NULL pointer (older host) means "no shadowing". */ +typedef struct PGXPHooks { + void (*load) (struct CPUState *cpu, uint32_t instr, uint32_t addr, uint32_t value); + void (*store) (struct CPUState *cpu, uint32_t instr, uint32_t addr, uint32_t value); + void (*alu) (struct CPUState *cpu, uint32_t instr, uint32_t result, uint32_t s1, uint32_t s2); + void (*muldiv)(struct CPUState *cpu, uint32_t instr, uint32_t hi, uint32_t lo, uint32_t s1, uint32_t s2); + void (*cop2) (struct CPUState *cpu, uint32_t instr, uint32_t value, uint32_t addr); +} PGXPHooks; + +#if defined(PSX_PGXP) && PSX_PGXP +#define PGXP_LOAD(instr, addr, val) psx_pgxp_load(cpu, (instr), (addr), (val)) +#define PGXP_STORE(instr, addr, val) psx_pgxp_store(cpu, (instr), (addr), (val)) +#define PGXP_ALU(instr, res, s1, s2) psx_pgxp_alu(cpu, (instr), (res), (s1), (s2)) +#define PGXP_MULDIV(instr, hi, lo, s1, s2) psx_pgxp_muldiv(cpu, (instr), (hi), (lo), (s1), (s2)) +#define PGXP_COP2(instr, val, addr) psx_pgxp_cop2(cpu, (instr), (val), (addr)) +#else +#define PGXP_LOAD(instr, addr, val) ((void)0) +#define PGXP_STORE(instr, addr, val) ((void)0) +#define PGXP_ALU(instr, res, s1, s2) ((void)0) +#define PGXP_MULDIV(instr, hi, lo, s1, s2) ((void)0) +#define PGXP_COP2(instr, val, addr) ((void)0) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PGXP_HOOKS_H */ diff --git a/overlay_toolchain/include/pgxp_session.h b/overlay_toolchain/include/pgxp_session.h new file mode 100644 index 00000000..7d72f6b7 --- /dev/null +++ b/overlay_toolchain/include/pgxp_session.h @@ -0,0 +1,122 @@ +#ifndef PSXRECOMP_PGXP_SESSION_H +#define PSXRECOMP_PGXP_SESSION_H + +/* + * Which PGXP corrections a session arms (docs/ENHANCEMENTS.md G1.11/G1.12). + * + * main.cpp drives the whole lifecycle through the two functions at the end of + * this header, compiled from src/pgxp_session.cpp, which + * runtime/tests/test_pgxp_session.cpp links and drives the same way: + * + * reset_mod_owned_presentation() -> psx_pgxp_session_reset() + * mod_runtime_activate_plugins() -> psx.enhancement.pgxp's activation + * records pgxp_mod_request(...) + * renderer setup (session_reboot) -> psx_pgxp_session_arm(&config, ...) + * + * The arm TAKES the mod request (reads and clears it), so a request lives only + * from one session's activation to that session's arming. A later session + * with an empty plan -- netplay clears it, or the player disabled the mod -- + * cannot inherit it, even if the reset were skipped. + * + * Inputs, in order of precedence: + * 1. env_*: the validation overrides PSX_GEOMETRY_CORRECTION, + * PSX_PERSPECTIVE_TEXTURING, PSX_PGXP_CPU_MODE and PSX_PGXP_CULLING (-1 + * when unset, else 0 or 1). They win over everything, so an A/B run can + * switch PGXP off under an enabled mod. + * 2. video_* OR mod_*: the [video] baseline (game.toml, then settings.toml + * and the launcher) and the psx.enhancement.pgxp request this session's + * activation recorded. Either one arms a correction. With mod_only + * ([video] pgxp_mod_only, a title that ships PGXP through the mod) the + * baseline is ignored and the mod is the one switch. + * + * The mod arms both geometry and texture correction; its CPU-mode option adds + * tier-2 propagation and its culling option precise culling. Precise culling + * changes guest-visible NCLIP results, so it has no [video] key (netplay does + * not clear [video]); it needs geometry correction. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct PSXPgxpSessionInputs { + int video_geometry; + int video_texture; + int video_cpu_mode; + int env_geometry; + int env_texture; + int env_cpu_mode; + int env_culling; + int mod_enabled; + int mod_cpu_mode; + int mod_culling; + int mod_only; +} PSXPgxpSessionInputs; + +typedef struct PSXPgxpSessionArm { + int geometry; + int texture; + int cpu_mode; + int culling; +} PSXPgxpSessionArm; + +static inline int psx_pgxp_session_pick(int env, int baseline, int mod) { + if (env >= 0) return env ? 1 : 0; + return (baseline || mod) ? 1 : 0; +} + +static inline PSXPgxpSessionArm psx_pgxp_session_resolve( + const PSXPgxpSessionInputs* in) { + PSXPgxpSessionArm arm; + const int use_video = in->mod_only ? 0 : 1; + arm.geometry = psx_pgxp_session_pick(in->env_geometry, + use_video && in->video_geometry, + in->mod_enabled); + arm.texture = psx_pgxp_session_pick(in->env_texture, + use_video && in->video_texture, + in->mod_enabled); + arm.cpu_mode = psx_pgxp_session_pick(in->env_cpu_mode, + use_video && in->video_cpu_mode, + in->mod_enabled && in->mod_cpu_mode); + arm.culling = arm.geometry && + psx_pgxp_session_pick(in->env_culling, 0, + in->mod_enabled && in->mod_culling); + return arm; +} + +/* Parse one of the env overrides: unset -> -1, "0" or empty -> 0, else 1 + * (the rule the runtime has always used for them). */ +static inline int psx_pgxp_session_env_flag(const char* value) { + if (!value) return -1; + return (*value && *value != '0') ? 1 : 0; +} + +/* The [video] PGXP settings main.cpp hands the arming: the player's baseline + * (game.toml, then settings.toml and the launcher) and the title's tuning + * keys. */ +typedef struct PSXPgxpSessionConfig { + int video_geometry; + int video_texture; + int video_cpu_mode; + float tolerance; + int position_fallback; + int preserve_projection; + int mod_only; +} PSXPgxpSessionConfig; + +/* Session start, before plugin activation: forget any mod request. */ +void psx_pgxp_session_reset(void); + +/* The renderer setup's arming, once per session after activation: reads the + * env overrides, takes the mod request, resolves, and applies the result to + * the engine (gte_geometry_correction_set, gpu_texture_correction_set, + * pgxp_set_cpu_mode / _culling) along with the tuning keys. `used` (may be + * NULL) receives the inputs it resolved from. */ +PSXPgxpSessionArm psx_pgxp_session_arm(const PSXPgxpSessionConfig* config, + PSXPgxpSessionInputs* used); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/present_image_ring.h b/overlay_toolchain/include/present_image_ring.h new file mode 100644 index 00000000..33746b48 --- /dev/null +++ b/overlay_toolchain/include/present_image_ring.h @@ -0,0 +1,55 @@ +#ifndef PSXRECOMP_PRESENT_IMAGE_RING_H +#define PSXRECOMP_PRESENT_IMAGE_RING_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Presented-image ring: a small copy of EVERY frame actually shown in the + * window (after compositing, letterbox included, before host OSD), for about + * ten seconds. Complements the display ring (canonical VRAM, ~1 s) for + * glitches that live only in presentation — native-wide compositing, frame + * interpolation, held frames — and that last a frame or two, so a single + * screenshot cannot catch them. Always-on in debug-tools builds + * (PSX_PRESENT_IMAGE_RING=0 disables); frozen by the capture mark. + * + * Entries are RGB565, PRESENT_IMAGE_RING_H rows tall, width following the + * window aspect (capped at PRESENT_IMAGE_RING_MAX_W). */ +#define PRESENT_IMAGE_RING_CAP 600 +#define PRESENT_IMAGE_RING_H 120 +#define PRESENT_IMAGE_RING_MAX_W 720 + +/* Thumbnail width for a window of ww x wh pixels. */ +int present_image_ring_thumb_w(int ww, int wh); + +/* 1 while capture is enabled and not frozen (callers skip the downscale). */ +int present_image_ring_accepting(void); + +/* Record one presented frame. `rgba` is 8-bit R,G,B,(A) per pixel, `pitch` + * bytes per row; `bottom_up` = rows stored bottom-first (GL readback). The + * image must already be w x PRESENT_IMAGE_RING_H. */ +void present_image_ring_push(uint32_t frame, const uint8_t *rgba, int w, + int pitch, int bottom_up); + +/* Box-downscale an ARGB8888 CPU present buffer (0xAARRGGBB, sw x sh) into a + * thumbnail and record it. Software / CPU-present path. */ +void present_image_ring_push_argb(uint32_t frame, const uint32_t *argb, + int sw, int sh, int src_pitch_px); + +void present_image_ring_set_frozen(int frozen); +int present_image_ring_frozen(void); + +/* Oldest/newest recorded frame numbers and how many entries are valid. */ +void present_image_ring_span(uint32_t *oldest, uint32_t *newest, int *count); + +/* Copy entry for `frame` as RGB888 top-down into a malloc'd buffer the + * caller frees. Returns 0 if the frame is not in the ring. */ +int present_image_ring_get_rgb(uint32_t frame, uint8_t **rgb, int *w, int *h); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/present_ring.h b/overlay_toolchain/include/present_ring.h new file mode 100644 index 00000000..81615941 --- /dev/null +++ b/overlay_toolchain/include/present_ring.h @@ -0,0 +1,48 @@ +#ifndef PSXRECOMP_PRESENT_RING_H +#define PSXRECOMP_PRESENT_RING_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Present-classification ring: one entry per present decision in + * sdl_vblank_present, for EVERY backend (software, GL, Vulkan). Records how + * the frame was classified (FMV/full-2D 4:3 pillarbox, native-wide, or the + * canonical read) and whether a native-wide present fell back to the + * canonical width — the fallback is invisible on screen except as a + * horizontal stretch, so it must be observable in data. Always-on; queried + * via the TCP debug server "present_ring" command. */ + +typedef enum { + PRES_PATH_BLANK = 0, /* display disabled — blank frame */ + PRES_PATH_NATIVE_43 = 1, /* FMV / full-2D frame, 4:3 pillarbox */ + PRES_PATH_WIDE = 2, /* native-wide surface (canonical + EXTRA) */ + PRES_PATH_CANONICAL = 3, /* canonical read; stretches when the window + is wider than the display aspect */ +} PresPath; + +typedef struct { + uint32_t frame; /* s_frame_count at present time */ + uint16_t disp_w, disp_h;/* GPU display size */ + uint16_t present_w; /* width actually presented */ + uint16_t nw_extra; /* native-wide growth configured this frame */ + uint8_t path; /* PresPath */ + uint8_t wide_fellback; /* wide present attempted but surface missing */ + uint8_t game_mode; /* ws gameplay-vs-2D classification */ + uint8_t native_43; /* gpu_ws_present_native_43() at present time */ + int32_t tag_delta; /* frames since newest sprite tag (clamped) */ + uint16_t gte_verts; /* RTPS/RTPT verts, last completed frame */ + uint16_t ovh_prims; /* overhanging polys, last completed frame (the + 2D-only-scene classifier's world signal) */ +} PresRingEntry; + +uint64_t present_ring_total(void); +int present_ring_get(uint64_t seq, PresRingEntry* out); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_PRESENT_RING_H */ diff --git a/overlay_toolchain/include/pst_wire.h b/overlay_toolchain/include/pst_wire.h new file mode 100644 index 00000000..0eb16531 --- /dev/null +++ b/overlay_toolchain/include/pst_wire.h @@ -0,0 +1,191 @@ +/* pst_wire.h — little-endian field cursors for portable .pst / boot_state blobs. + * + * Never memcpy whole host structs that may contain padding. Emit fixed-width + * LE primitives so Win/Linux x86_64 and macOS ARM produce identical bytes. + */ +#ifndef PSX_PST_WIRE_H +#define PSX_PST_WIRE_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct PstW { + uint8_t *p; + uint8_t *end; + size_t written; /* advances even when p==NULL (size probe) */ +} PstW; + +typedef struct PstR { + const uint8_t *p; + const uint8_t *end; +} PstR; + +static inline void pst_w_init(PstW *w, uint8_t *buf, size_t cap) { + w->p = buf; + w->end = buf ? buf + cap : NULL; + w->written = 0; +} + +static inline void pst_r_init(PstR *r, const uint8_t *buf, size_t len) { + r->p = buf; + r->end = buf + len; +} + +static inline int pst_w_bytes(PstW *w, const void *src, size_t n) { + if (!w) return 0; + if (w->p) { + if (!w->end || (size_t)(w->end - w->p) < n) return 0; + if (n && src) memcpy(w->p, src, n); + w->p += n; + } + w->written += n; + return 1; +} + +static inline int pst_r_bytes(PstR *r, void *dst, size_t n) { + if (!r || !r->p || (size_t)(r->end - r->p) < n) return 0; + if (n && dst) memcpy(dst, r->p, n); + r->p += n; + return 1; +} + +static inline int pst_w_u8(PstW *w, uint8_t v) { return pst_w_bytes(w, &v, 1); } +static inline int pst_r_u8(PstR *r, uint8_t *v) { return pst_r_bytes(r, v, 1); } + +static inline int pst_w_u16(PstW *w, uint16_t v) { + uint8_t b[2] = { (uint8_t)v, (uint8_t)(v >> 8) }; + return pst_w_bytes(w, b, 2); +} +static inline int pst_r_u16(PstR *r, uint16_t *v) { + uint8_t b[2]; + if (!pst_r_bytes(r, b, 2)) return 0; + if (v) *v = (uint16_t)b[0] | ((uint16_t)b[1] << 8); + return 1; +} + +static inline int pst_w_u32(PstW *w, uint32_t v) { + uint8_t b[4] = { + (uint8_t)v, (uint8_t)(v >> 8), (uint8_t)(v >> 16), (uint8_t)(v >> 24) + }; + return pst_w_bytes(w, b, 4); +} +static inline int pst_r_u32(PstR *r, uint32_t *v) { + uint8_t b[4]; + if (!pst_r_bytes(r, b, 4)) return 0; + if (v) + *v = (uint32_t)b[0] | ((uint32_t)b[1] << 8) | + ((uint32_t)b[2] << 16) | ((uint32_t)b[3] << 24); + return 1; +} + +static inline int pst_w_u64(PstW *w, uint64_t v) { + uint8_t b[8]; + for (int i = 0; i < 8; i++) b[i] = (uint8_t)(v >> (8 * i)); + return pst_w_bytes(w, b, 8); +} +static inline int pst_r_u64(PstR *r, uint64_t *v) { + uint8_t b[8]; + if (!pst_r_bytes(r, b, 8)) return 0; + if (v) { + uint64_t x = 0; + for (int i = 0; i < 8; i++) x |= (uint64_t)b[i] << (8 * i); + *v = x; + } + return 1; +} + +static inline int pst_w_i16(PstW *w, int16_t v) { return pst_w_u16(w, (uint16_t)v); } +static inline int pst_r_i16(PstR *r, int16_t *v) { + uint16_t u; + if (!pst_r_u16(r, &u)) return 0; + if (v) *v = (int16_t)u; + return 1; +} + +static inline int pst_w_i32(PstW *w, int32_t v) { return pst_w_u32(w, (uint32_t)v); } +static inline int pst_r_i32(PstR *r, int32_t *v) { + uint32_t u; + if (!pst_r_u32(r, &u)) return 0; + if (v) *v = (int32_t)u; + return 1; +} + +/* bool / flag → single byte 0/1 */ +static inline int pst_w_bool(PstW *w, int v) { + return pst_w_u8(w, v ? 1u : 0u); +} +static inline int pst_r_bool(PstR *r, int *v) { + uint8_t b; + if (!pst_r_u8(r, &b)) return 0; + if (v) *v = b ? 1 : 0; + return 1; +} + +/* LE-encode a host POD field: 1/2/4/8-byte scalar, or array of those units. */ +static inline int pst_w_pod(PstW *w, const void *src, size_t nbytes, size_t elem) { + const uint8_t *s = (const uint8_t *)src; + if (!elem || (nbytes % elem) != 0) return 0; + if (elem == 1) return pst_w_bytes(w, src, nbytes); +#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) + /* Host LE: wire bytes match native POD layout — skip per-element swizzle. */ + if (elem == 2 || elem == 4 || elem == 8) + return pst_w_bytes(w, src, nbytes); +#endif + for (size_t off = 0; off < nbytes; off += elem) { + if (elem == 2) { + uint16_t v; + memcpy(&v, s + off, 2); + if (!pst_w_u16(w, v)) return 0; + } else if (elem == 4) { + uint32_t v; + memcpy(&v, s + off, 4); + if (!pst_w_u32(w, v)) return 0; + } else if (elem == 8) { + uint64_t v; + memcpy(&v, s + off, 8); + if (!pst_w_u64(w, v)) return 0; + } else { + return 0; + } + } + return 1; +} + +static inline int pst_r_pod(PstR *r, void *dst, size_t nbytes, size_t elem) { + uint8_t *d = (uint8_t *)dst; + if (!elem || (nbytes % elem) != 0) return 0; + if (elem == 1) return pst_r_bytes(r, dst, nbytes); +#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) + if (elem == 2 || elem == 4 || elem == 8) + return pst_r_bytes(r, dst, nbytes); +#endif + for (size_t off = 0; off < nbytes; off += elem) { + if (elem == 2) { + uint16_t v; + if (!pst_r_u16(r, &v)) return 0; + memcpy(d + off, &v, 2); + } else if (elem == 4) { + uint32_t v; + if (!pst_r_u32(r, &v)) return 0; + memcpy(d + off, &v, 4); + } else if (elem == 8) { + uint64_t v; + if (!pst_r_u64(r, &v)) return 0; + memcpy(d + off, &v, 8); + } else { + return 0; + } + } + return 1; +} + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_PST_WIRE_H */ diff --git a/overlay_toolchain/include/psx_align.h b/overlay_toolchain/include/psx_align.h new file mode 100644 index 00000000..4dd4de61 --- /dev/null +++ b/overlay_toolchain/include/psx_align.h @@ -0,0 +1,25 @@ +/* psx_align.h — portable alignment attribute for SIMD scratch buffers. + * + * The SSE2/NEON kernels store to local scratch arrays with aligned stores + * (_mm_store_si128 and friends), so the alignment is load-bearing, not a + * hint: an under-aligned destination faults. + * + * GCC/Clang spell this __attribute__((aligned(n))); MSVC spells it + * __declspec(align(n)). Both are valid in prefix position on a declaration, + * which is the one placement the two spellings share -- hence the macro is + * written to be used as a prefix: + * + * PSX_ALIGN(16) int32_t tmp[4]; + */ +#ifndef PSXRECOMP_PSX_ALIGN_H +#define PSXRECOMP_PSX_ALIGN_H + +#if defined(_MSC_VER) && !defined(__clang__) +#define PSX_ALIGN(n) __declspec(align(n)) +#elif defined(__GNUC__) || defined(__clang__) +#define PSX_ALIGN(n) __attribute__((aligned(n))) +#else +#define PSX_ALIGN(n) _Alignas(n) +#endif + +#endif /* PSXRECOMP_PSX_ALIGN_H */ diff --git a/overlay_toolchain/include/psx_bios_backend.h b/overlay_toolchain/include/psx_bios_backend.h new file mode 100644 index 00000000..8d525d1f --- /dev/null +++ b/overlay_toolchain/include/psx_bios_backend.h @@ -0,0 +1,105 @@ +/* psx_bios_backend.h — the routing seam between the runtime and whichever + * recompiled BIOS is active. + * + * Every build links more than one recompiled BIOS (bundled OpenBIOS plus a + * retail image). Each one exports exactly ONE symbol — its backend descriptor, + * named _psx_bios_backend — and everything else it defines is either + * static or stem-prefixed, so the images cannot collide at link time. + * + * The runtime picks a backend at startup (docs/BIOS_SELECTION.md: no explicit + * player choice -> OpenBIOS; an explicit, identity-matching choice -> that + * image) and publishes it as psx_bios_active. + * + * Callers do not go through this struct. The unprefixed psx_dispatch() / + * psx_dispatch_call() the game's generated C and the runtime already call are + * thin forwarders (psx_bios_backend.c) that route to the active backend, and + * psx_bios_image is assigned from it at selection time — so adding a second + * BIOS changed no call sites. + * + * Adding another BIOS later is one more descriptor and one more registry + * entry; it is not another round of symbol collisions. + */ +#ifndef PSX_BIOS_BACKEND_H +#define PSX_BIOS_BACKEND_H + +#include + +#include "psx_bios_image.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct CPUState; + +typedef struct PsxBiosBackend { + /* Identity, kernel-bless window and HLE anchors for this image. Copied + * into the global psx_bios_image when this backend is selected. */ + const PsxBiosImageInfo *image; + + /* Dispatch entry points for this image. */ + void (*dispatch)(struct CPUState *cpu, uint32_t addr); + void (*dispatch_call)(struct CPUState *cpu, uint32_t addr, + uint32_t return_addr); + + /* Kernel body-extent table used by the kernel-image bless mechanism + * (memory.c). Published as psx_bios_kernel_bodies/_count on selection. + * + * The native call-stub table is deliberately absent: it is only read by + * the generated dispatch itself, so it stays static there. */ + const PsxKernelBody *kernel_bodies; + uint32_t kernel_body_count; + + /* Kernel-RAM ranges the guest legitimately patches at runtime, from this + * image's [[recompiler.install_slots]] (psx_bios_image.h). The bless + * verifier skips them and the dirty-RAM interpreter resumes native at + * each range's hi. Null/0 for an image that declares no slots. */ + const PsxKernelPatchRange *kernel_patch_ranges; + uint32_t kernel_patch_range_count; +} PsxBiosBackend; + +/* Dispatch nesting depth, shared by every backend (psx_bios_backend.c). */ +extern int g_psx_dispatch_depth; + +/* The backend in use. Null before psx_bios_select() runs; every forwarder and + * every consumer of psx_bios_image depends on it being set first. */ +extern const PsxBiosBackend *psx_bios_active; + +/* Backends compiled into this binary, in preference order (bundled OpenBIOS + * first). Emitted by the build as psx_bios_registry.c. */ +extern const PsxBiosBackend *const psx_bios_builtin_registry[]; +extern const uint32_t psx_bios_builtin_registry_count; + +/* The live registry: the builtins plus any backend registered at run time + * (a BIOS module built from the player's dump, psx_bios_module.h). Walk it + * only after psx_bios_registry_seeded_count() or any lookup below has run; + * the count is 0 until then in a process that never looked. */ +extern const PsxBiosBackend *psx_bios_registry[]; +extern uint32_t psx_bios_registry_count; +uint32_t psx_bios_registry_seeded_count(void); + +/* Add a backend loaded at run time. Idempotent for a pointer already present; + * 0 when the table is full or the descriptor has no image. */ +int psx_bios_register(const PsxBiosBackend *backend); + +/* Look up a compiled-in backend by its profile id ("SCPH-1001", "OPENBIOS"). + * Null if this build does not carry it. */ +const PsxBiosBackend *psx_bios_find(const char *image_id); + +/* Select a backend and publish it (also assigns the global psx_bios_image). + * Returns 0 if backend is null. */ +int psx_bios_activate(const PsxBiosBackend *backend); + +/* The bundled, redistributable backend (image_bundled != 0), or null if this + * build has none. */ +const PsxBiosBackend *psx_bios_bundled(void); + +/* True if a player-supplied image is meaningful for this build (some linked + * backend is not the bundled one). */ +int psx_bios_has_selectable(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_BIOS_BACKEND_H */ diff --git a/overlay_toolchain/include/psx_bios_image.h b/overlay_toolchain/include/psx_bios_image.h new file mode 100644 index 00000000..b2ae401d --- /dev/null +++ b/overlay_toolchain/include/psx_bios_image.h @@ -0,0 +1,102 @@ +/* psx_bios_image.h — the linked recompiled BIOS describes itself. + * + * The generated _dispatch.c DEFINES these symbols; the runtime READS + * them instead of hardcoding per-image constants (memory.c's old + * KBLESS_RAM_LO/HI/ROM_OFF, bios_hle.c's old PSX_SHELL_ENTRY_PHYS / + * KADDR_DELIVER_RET). Because the values are emitted next to the code they + * describe — couriered verbatim from the BIOS profile by the emitter — they + * cannot disagree with the linked BIOS. Same seam as psx_bios_kernel_bodies. + * + * A zero value means "this BIOS has no such thing" (no kernel-bless window, + * no shell boot-skip entry, no DeliverEvent HLE return): consumers must treat + * zero as structurally-unavailable, never as address 0. + */ +#ifndef PSX_BIOS_IMAGE_H +#define PSX_BIOS_IMAGE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Kernel body-extent table for the kernel-image bless mechanism (memory.c). + * Emitted by full_function_emitter.cpp next to psx_bios_image. */ +typedef struct { + uint32_t key; /* dispatch key (RAM, normalized) */ + uint32_t body_lo; /* RAM extent of code reachable from key */ + uint32_t body_hi; /* exclusive */ +} PsxKernelBody; + +/* Kernel-RAM ranges the guest is EXPECTED to overwrite at runtime: the Psy-Q + * libapi patchers (_patch_gte / _patch_card / _patch_card2 / _patch_pad) and + * the BIOS's own install stubs rewrite words inside compiled kernel bodies at + * boot. Declared per image by [[recompiler.install_slots]] and emitted next to + * the body table. + * + * Two consumers, one table: + * - memory.c's bless verifier compares a body in segments that SKIP these + * ranges, so a body with a live patch inside it can still run native. + * - dirty_ram_interp.c surfaces back to static dispatch when straight-line + * interpretation reaches a range's `hi`, which the emitter registered as a + * continuation key. Only the patched words themselves interpret. + * + * This is not HLE: the guest's patched instructions still execute as written, + * on the dirty-RAM interpreter. Only the code AROUND them changes backend. */ +typedef struct { + uint32_t lo; /* RAM extent of the patched words [lo, hi) */ + uint32_t hi; /* exclusive; also the native resume key */ +} PsxKernelPatchRange; + +/* Published from the ACTIVE backend at selection (psx_bios_backend.c), + * hence a pointer rather than an array: a build links more than one + * recompiled BIOS and each carries its own table. Indexing is unchanged + * for consumers. */ +extern const PsxKernelBody *psx_bios_kernel_bodies; +extern uint32_t psx_bios_kernel_body_count; +extern const PsxKernelPatchRange *psx_bios_kernel_patch_ranges; +extern uint32_t psx_bios_kernel_patch_range_count; + +/* Native call-stub extents (A0/B0/C0). Layout shared with the generated + * dispatch, which keeps its own static table. */ +typedef struct { + uint32_t key; + uint32_t body_lo; + uint32_t body_hi; +} PsxNativeStub; + +typedef struct { + /* Kernel-bless window (profile address_model copy with kernel_bless): + * RAM [kbless_ram_lo, kbless_ram_hi) is the BIOS's boot-time verbatim + * copy of ROM file offset kbless_rom_off. All zero = no bless window. */ + uint32_t kbless_ram_lo; + uint32_t kbless_ram_hi; + uint32_t kbless_rom_off; + + /* HLE anchors (profile [recompiler.runtime_exports]); 0 = unavailable. */ + uint32_t shell_entry_phys; /* boot-skip trigger (bios_hle.c) */ + uint32_t deliver_event_ret; /* $ra after the kernel DeliverEvent jalr */ + + /* Image identity, computed from the ROM bytes at emit time. */ + uint32_t image_size; /* bytes */ + uint32_t image_crc32; /* IEEE CRC-32 (zlib) */ + uint32_t image_wordsum; /* sum of LE u32 words (savestate checksum) */ + const char* image_sha256; /* 64 lowercase hex chars */ + const char* image_id; /* profile [program] id, e.g. "SCPH-1001" */ + + /* Profile [program.image] redistributable: the BIOS ships WITH the game + * (e.g. OpenBIOS, MIT). The runtime then resolves the bundled image + * next to the build and hides the entire BIOS-selection surface + * (no picker, no bios.cfg, no launcher row). */ + int image_bundled; +} PsxBiosImageInfo; + +/* Assigned from the active backend at selection; not const for that + * reason. Reads are unchanged. */ +extern PsxBiosImageInfo psx_bios_image; + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_BIOS_IMAGE_H */ diff --git a/overlay_toolchain/include/psx_bios_known_images.h b/overlay_toolchain/include/psx_bios_known_images.h new file mode 100644 index 00000000..27f3bb0c --- /dev/null +++ b/overlay_toolchain/include/psx_bios_known_images.h @@ -0,0 +1,108 @@ +/* psx_bios_known_images.h — identities of the retail BIOS images this + * framework ships a build profile for. + * + * A *built* host asks its linked backends (psx_bios_registry) which image it + * accepts. A *setup* host has no linked backend — that is what makes it a + * setup host — so first-run discovery, bios.cfg seeding and picker copy had + * nowhere to look and hardcoded SCPH-1001. Any kit pinning another image via + * PSXRECOMP_BIOS_STEM / recompiler.bios_config (every wave-3 kit pins + * SCPH5552) then refused to auto-discover a perfectly good dump and told the + * player their BIOS was the wrong one. + * + * Keep in sync with bios/.toml. A stem absent from this table still + * builds and runs; it only loses first-run auto-discovery and falls back to + * asking the player, which is safe. + */ +#ifndef PSX_BIOS_KNOWN_IMAGES_H +#define PSX_BIOS_KNOWN_IMAGES_H + +#include +#include + +/* Set by runtime.cmake from PSXRECOMP_BIOS_STEM. */ +#ifndef PSX_EXPECTED_BIOS_STEM +#define PSX_EXPECTED_BIOS_STEM "SCPH1001" +#endif + +typedef struct PsxKnownBiosImage { + const char* stem; /* generated/_dispatch.c, bios/.toml */ + const char* id; /* profile id, e.g. "SCPH-5552" */ + uint32_t crc32; /* IEEE CRC-32 (zlib/Ethernet) over the whole image */ + uint32_t size; /* bytes */ +} PsxKnownBiosImage; + +/* Each entry verified two ways: against the dump itself, and against the + * identity the recompiler emits into generated/_dispatch.c. */ +static const PsxKnownBiosImage psx_known_bios_images[] = { + { "SCPH1001", "SCPH-1001", 0x37157331u, 524288u }, + { "SCPH5500", "SCPH-5500", 0xFF3EEB8Cu, 524288u }, + { "SCPH5501", "SCPH-5501", 0x8D8CB7E4u, 524288u }, + { "SCPH5552", "SCPH-5552", 0xD786F0B9u, 524288u }, +}; + +static inline const PsxKnownBiosImage* psx_known_bios_by_stem(const char* stem) { + size_t i; + if (!stem || !stem[0]) + return 0; + for (i = 0; i < sizeof(psx_known_bios_images) / sizeof(psx_known_bios_images[0]); ++i) { + if (strcmp(psx_known_bios_images[i].stem, stem) == 0) + return &psx_known_bios_images[i]; + } + return 0; +} + +/* The retail image THIS build was configured for, or NULL when the pinned + * stem is not in the table. Callers must handle NULL by asking the player + * rather than assuming SCPH-1001. */ +static inline const PsxKnownBiosImage* psx_expected_bios(void) { + return psx_known_bios_by_stem(PSX_EXPECTED_BIOS_STEM); +} + +/* A short label for the pinned image, for player-facing copy: "SCPH5552.BIN". + * Falls back to the raw stem when the identity is not in the table. */ +static inline const char* psx_expected_bios_label(void) { + static char label[40]; + if (!label[0]) { + const PsxKnownBiosImage* e = psx_expected_bios(); + const char* stem = e ? e->stem : PSX_EXPECTED_BIOS_STEM; + size_t n = strlen(stem); + if (n > sizeof(label) - 5) + n = sizeof(label) - 5; + memcpy(label, stem, n); + memcpy(label + n, ".BIN", 5); + } + return label; +} + +/* Filename spellings worth probing for during first-run discovery, + * written into out[0..n). Covers the stem and the dashed profile id, each in + * upper and lower case: SCPH5552.BIN, scph5552.bin, SCPH-5552.BIN, ... */ +static inline int psx_known_bios_filenames(const PsxKnownBiosImage* img, + char out[][32], int cap) { + const char* bases[2]; + int n = 0, b, lower; + if (!img) + return 0; + bases[0] = img->stem; + bases[1] = img->id; + for (b = 0; b < 2; ++b) { + for (lower = 0; lower < 2; ++lower) { + const char* ext = lower ? "bin" : "BIN"; + size_t i, len = strlen(bases[b]); + char* dst; + if (n >= cap || len + 5 > 32) + continue; + dst = out[n++]; + for (i = 0; i < len; ++i) { + char c = bases[b][i]; + dst[i] = (char)(lower && c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c); + } + dst[len] = '.'; + memcpy(dst + len + 1, ext, 3); + dst[len + 4] = 0; + } + } + return n; +} + +#endif /* PSX_BIOS_KNOWN_IMAGES_H */ diff --git a/overlay_toolchain/include/psx_bios_module.h b/overlay_toolchain/include/psx_bios_module.h new file mode 100644 index 00000000..5170dfbe --- /dev/null +++ b/overlay_toolchain/include/psx_bios_module.h @@ -0,0 +1,188 @@ +/* psx_bios_module.h — a recompiled BIOS backend as a separately loaded module. + * + * WHY. A bundled release links only the redistributable OpenBIOS backend: the + * C a retail image recompiles to is a translation of that image's code, so it + * never ships (docs/BIOS_SELECTION.md, docs/ci/BUNDLED_RELEASES.md). For a + * player who owns a retail dump, the release therefore builds that backend on + * THEIR machine, from THEIR dump, with the overlay toolchain the release + * already carries — the same mechanism that turns overlays streamed from the + * player's disc into native code — and loads it here as a shared library. + * + * THE CONTRACT. A BIOS module is an overlay-style self-contained library. It + * imports nothing from the executable (the executable exports no symbols on + * any platform); every call back into the runtime goes through two callback + * tables handed over at init: + * + * OverlayCallbacks (overlay_api.h) — the part a BIOS shares with + * overlay shards: cycles, loads, + * GTE, syscall, dispatch_call… + * PsxBiosModuleCallbacks (this header) — what only a BIOS dispatcher + * needs: traps, the dirty-RAM + * and kernel-bless probes, and + * the runtime globals the + * generated dispatch reads and + * writes (through pointers). + * + * The generated C is compiled UNCHANGED with -DPSX_OVERLAY_DLL_BUILD (so the + * inline RAM-load and cycle fast paths in cpu_state.h / psx_cyc.h / + * psx_cycles.h become out-of-line calls the glue forwards) plus + * -DPSX_BIOS_MODULE_BUILD, with this header prepended: the mapping block + * below renames the handful of runtime globals the emitter declares `extern` + * to pointer dereferences, exactly as cpu_state.h does for the bail state. + * A macro'd `extern T g_x;` becomes `extern T (*g_x_p);`, which is the + * pointer's own declaration — no per-symbol shim is needed in the C. + * + * The module exports four functions (psx_bios_module_glue.c.inc): + * int psx_bios_module_abi(void) == PSX_BIOS_MODULE_ABI_TAG + * uint32_t psx_bios_module_codegen_hash(void) == PSX_OVERLAY_CODEGEN_HASH + * int psx_bios_module_init(const OverlayCallbacks*, const PsxBiosModuleCallbacks*) + * const PsxBiosBackend *psx_bios_module_backend(void) + * and is otherwise opaque. The host (runtime/src/psx_bios_module.c) gates a + * load on the first two, calls init, then registers the descriptor with + * psx_bios_register() so every existing selection path sees it as one more + * linked backend. + * + * ABI. Bump PSX_BIOS_MODULE_ABI_VERSION whenever PsxBiosModuleCallbacks + * changes shape, a mapping is added, or the glue's forwarding semantics + * change. Append-only growth of the table is still a bump: a module built + * against a shorter table must not be handed a longer one it never checks. + * The cache directory name carries this version, the codegen hash, and the + * flavor, so a stale module is never even opened. + */ +#ifndef PSX_BIOS_MODULE_H +#define PSX_BIOS_MODULE_H + +#include +#include + +/* ---- Name mappings (module build only) ------------------------------------- + * Pure #defines, deliberately with no declarations: each generated `extern` + * line, and psx_memory.h's own `extern uint32_t g_psx_ram_mask;`, declares + * the pointer with the right type once the name is rewritten. Prepended by + * tools/bios_module_build.py before the first #include, so psx_memory.h sees + * the g_psx_ram_mask mapping too (the emitted normalize() masks with it). */ +#if defined(PSX_BIOS_MODULE_BUILD) +/* The one global the emitter uses without its own extern line (cpu_state.h + * declares it only outside PSX_OVERLAY_DLL_BUILD), so declare the pointer. */ +extern uint64_t *g_psx_bm_bail_flattened_p; +# define g_psx_bios_hle_hook (*g_psx_bm_hle_hook_p) +# define g_psx_dispatch_depth (*g_psx_bm_dispatch_depth_p) +# define g_dispatch_static_hits (*g_psx_bm_static_hits_p) +# define g_debug_current_func_addr (*g_psx_bm_current_func_addr_p) +# define g_psx_bail_flattened (*g_psx_bm_bail_flattened_p) +# define g_psx_ram_mask (*g_psx_bm_ram_mask_p) +# define s_frame_count (*g_psx_bm_frame_count_p) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct CPUState; +struct OverlayCallbacks; +struct PsxBiosBackend; + +#define PSX_BIOS_MODULE_ABI_VERSION 1 + +/* Combined tag: ABI version (low 16) | codegen flavor (high 16), like + * PSX_OVERLAY_ABI_TAG. The flavor comes from the same -DPSX_OVERLAY_FLAVOR + * the executable was built with; the glue and the host both evaluate it. */ +#ifndef PSX_OVERLAY_FLAVOR +#define PSX_OVERLAY_FLAVOR 0 +#endif +#define PSX_BIOS_MODULE_ABI_TAG \ + ((int)((PSX_BIOS_MODULE_ABI_VERSION & 0xFFFF) | ((PSX_OVERLAY_FLAVOR & 0xFFFF) << 16))) + +/* What the BIOS dispatcher needs beyond OverlayCallbacks. Function members + * are the runtime's real implementations; pointer members alias the + * runtime's globals so a module read/write is the runtime's read/write. */ +typedef struct PsxBiosModuleCallbacks { + uint32_t size; /* sizeof(PsxBiosModuleCallbacks) on the host side */ + + /* Traps (runtime/src/traps.c; strict_translator emits these). */ + void (*arith_overflow)(struct CPUState *cpu); + void (*brk)(struct CPUState *cpu, uint32_t code, uint32_t pc); + void (*unaligned_access)(struct CPUState *cpu, uint32_t addr, uint32_t pc); + void (*rfe_escape_check)(struct CPUState *cpu); + + /* Dispatch probes the generated dispatcher consults per iteration. */ + int (*dirty_ram_dispatch)(struct CPUState *cpu, uint32_t addr, uint32_t stop_addr); + int (*dirty_ram_is_dirty)(uint32_t phys); + int (*dirty_ram_text_native_ok)(uint32_t phys); + int (*kernel_bless_dispatchable)(uint32_t phys); + int (*game_address_in_text)(uint32_t addr); + int (*fntrace_is_game_started)(void); + void (*fntrace_record)(struct CPUState *cpu, uint32_t target); + void (*trace_dispatch)(uint32_t func_addr); + /* Retail images emit probe sites (SCPH-1001 does; OpenBIOS does not). */ + void (*log_probe)(uint32_t pc, struct CPUState *cpu); + /* Segment-aware dispatch: a PC served by another segment's home body is + * recorded in the runtime's segment-miss ring (psx_segment_miss.h). */ + void (*segment_miss_record_kind)(uint32_t addr, uint32_t home, uint32_t ra, + uint32_t sp, uint32_t frame, uint32_t kind); + + /* Runtime-owned state the dispatcher reads/writes. Never NULL from a + * host at this ABI; the glue keeps local dummies for a pre-init call. */ + int (**hle_hook)(struct CPUState *cpu, uint32_t phys); /* bios_hle.c */ + int *dispatch_depth; /* psx_bios_backend.c */ + uint64_t *static_hits; /* generated game dispatch counter */ + uint32_t *current_func_addr; /* debug_server.c */ + uint64_t *bail_flattened; /* traps.c */ + uint32_t *ram_mask; /* psx_ram_geometry.c (live 2/8 MiB) */ + uint64_t *frame_count; /* debug_server.c s_frame_count (miss records) */ +} PsxBiosModuleCallbacks; + +/* ---- Host side (runtime/src/psx_bios_module.c) ----------------------------- */ +#if !defined(PSX_BIOS_MODULE_BUILD) + +/* Can this process turn a retail dump into a loaded backend? True when a + * bundled backend is linked (this is a product build, not a setup host) and + * the overlay toolchain is present beside the executable. */ +int psx_bios_module_supported(const char *exe_dir); + +/* The profile identity a dump of this size/CRC would build with, or NULL + * when no shipped profile matches (then no module can be built). */ +const char *psx_bios_module_known_id(uint32_t crc32, uint32_t size); + +/* Load a previously built module for this dump if one is cached, else build + * it with the toolchain (blocking; seconds with tcc, minutes with gcc on a + * large image), then load and register it. Returns the registered backend + * or NULL with `err` filled. `exe_dir` is the executable's directory; the + * cache lives under /cache/bios/. */ +const struct PsxBiosBackend *psx_bios_module_acquire(const char *dump_path, + const char *exe_dir, + int allow_build, + char *err, size_t err_cap); + +/* 1 when a module for this dump is already built and cached (no build + * needed to select it), 0 otherwise or when the dump is not a known image. */ +int psx_bios_module_is_cached(const char *dump_path, const char *exe_dir); + +/* Cached module path for a dump identity, whether or not it exists. */ +int psx_bios_module_cache_path(const char *exe_dir, const char *stem, + uint32_t crc32, char *out, size_t cap); + +/* Load one module file: ABI + codegen-hash gate, init, register. */ +const struct PsxBiosBackend *psx_bios_module_load(const char *path, + char *err, size_t err_cap); + +/* Callback tables the host hands to a module (also used by the test host). */ +void psx_bios_module_fill_callbacks(PsxBiosModuleCallbacks *out); + +/* Last build/load diagnostic line, for logs and the launcher. */ +const char *psx_bios_module_last_message(void); + +/* Progress sink for a build in flight (launcher progress modal). pct is 0..1 + * when a stage boundary is known, negative otherwise; msg is the builder's + * current line. Called on the thread running psx_bios_module_acquire. NULL + * clears it. */ +typedef void (*PsxBiosModuleProgressFn)(void *ctx, float pct, const char *msg); +void psx_bios_module_set_progress(PsxBiosModuleProgressFn fn, void *ctx); + +#endif /* !PSX_BIOS_MODULE_BUILD */ + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_BIOS_MODULE_H */ diff --git a/overlay_toolchain/include/psx_bios_module_glue.c.inc b/overlay_toolchain/include/psx_bios_module_glue.c.inc new file mode 100644 index 00000000..e43e57cd --- /dev/null +++ b/overlay_toolchain/include/psx_bios_module_glue.c.inc @@ -0,0 +1,127 @@ +/* psx_bios_module_glue.c.inc — the module side of a loadable BIOS backend. + * + * Compiled ONCE per module as its own translation unit by + * tools/bios_module_build.py, after overlay_dispatch_preamble.c.inc (which + * defines g_cbs, overlay_flush_cycles and every forwarder a BIOS shares with + * overlay shards). This file adds what only a BIOS dispatcher needs — see + * psx_bios_module.h — and the four exported entry points. + * + * Contract: nothing here may reach a runtime symbol directly. Every call and + * every global goes through g_bcbs / g_cbs, or through the pointers the + * generated C's macro-rewritten externs declare. PSX_BIOS_MODULE_STEM is the + * image stem (-DPSX_BIOS_MODULE_STEM=SCPH1001) and names the descriptor the + * generated dispatch exports. + */ +#include "psx_bios_backend.h" +#include "psx_bios_module.h" + +#ifndef PSX_BIOS_MODULE_STEM +#error "PSX_BIOS_MODULE_STEM must name the image stem (e.g. -DPSX_BIOS_MODULE_STEM=SCPH1001)" +#endif +#define PSX_BM_CAT2(a, b) a##b +#define PSX_BM_CAT(a, b) PSX_BM_CAT2(a, b) +#define PSX_BM_DESCRIPTOR PSX_BM_CAT(PSX_BIOS_MODULE_STEM, _psx_bios_backend) + +extern const PsxBiosBackend PSX_BM_DESCRIPTOR; + +static PsxBiosModuleCallbacks g_bcbs; + +/* Local dummies so a call before init cannot fault; init repoints them. */ +static int (*s_hle_hook_dummy)(CPUState *cpu, uint32_t phys); +static int s_depth_dummy; +static uint64_t s_hits_dummy; +static uint32_t s_func_addr_dummy; +static uint64_t s_flattened_dummy; +static uint32_t s_ram_mask_dummy = 0x1FFFFFu; +static uint64_t s_frame_count_dummy; + +/* The pointers the generated C declares (via the psx_bios_module.h name + * mappings): `extern int g_psx_dispatch_depth;` became + * `extern int (*g_psx_bm_dispatch_depth_p);`, and so on. Defined here. */ +int (**g_psx_bm_hle_hook_p)(CPUState *cpu, uint32_t phys) = &s_hle_hook_dummy; +int *g_psx_bm_dispatch_depth_p = &s_depth_dummy; +uint64_t *g_psx_bm_static_hits_p = &s_hits_dummy; +uint32_t *g_psx_bm_current_func_addr_p = &s_func_addr_dummy; +uint64_t *g_psx_bm_bail_flattened_p = &s_flattened_dummy; +uint32_t *g_psx_bm_ram_mask_p = &s_ram_mask_dummy; +uint64_t *g_psx_bm_frame_count_p = &s_frame_count_dummy; + +/* ---- Forwarders for what OverlayCallbacks does not carry ----------------- */ +void psx_arith_overflow(CPUState *cpu) { + overlay_flush_cycles(); + if (g_bcbs.arith_overflow) g_bcbs.arith_overflow(cpu); +} +void psx_break(CPUState *cpu, uint32_t code, uint32_t pc) { + overlay_flush_cycles(); + if (g_bcbs.brk) g_bcbs.brk(cpu, code, pc); +} +void psx_unaligned_access(CPUState *cpu, uint32_t addr, uint32_t pc) { + overlay_flush_cycles(); + if (g_bcbs.unaligned_access) g_bcbs.unaligned_access(cpu, addr, pc); +} +void psx_rfe_escape_check(CPUState *cpu) { + overlay_flush_cycles(); + if (g_bcbs.rfe_escape_check) g_bcbs.rfe_escape_check(cpu); +} +int dirty_ram_dispatch(CPUState *cpu, uint32_t addr, uint32_t stop_addr) { + overlay_flush_cycles(); + return g_bcbs.dirty_ram_dispatch ? g_bcbs.dirty_ram_dispatch(cpu, addr, stop_addr) : 0; +} +int dirty_ram_is_dirty(uint32_t phys) { + return g_bcbs.dirty_ram_is_dirty ? g_bcbs.dirty_ram_is_dirty(phys) : 0; +} +int dirty_ram_text_native_ok(uint32_t phys) { + return g_bcbs.dirty_ram_text_native_ok ? g_bcbs.dirty_ram_text_native_ok(phys) : 0; +} +int psx_kernel_bless_dispatchable(uint32_t phys) { + return g_bcbs.kernel_bless_dispatchable ? g_bcbs.kernel_bless_dispatchable(phys) : 0; +} +int psx_game_address_in_text(uint32_t addr) { + return g_bcbs.game_address_in_text ? g_bcbs.game_address_in_text(addr) : 0; +} +int fntrace_is_game_started(void) { + return g_bcbs.fntrace_is_game_started ? g_bcbs.fntrace_is_game_started() : 0; +} +void fntrace_record(CPUState *cpu, uint32_t target) { + if (g_bcbs.fntrace_record) g_bcbs.fntrace_record(cpu, target); +} +void debug_server_trace_dispatch(uint32_t func_addr) { + if (g_bcbs.trace_dispatch) g_bcbs.trace_dispatch(func_addr); +} +void debug_server_log_probe(uint32_t pc, CPUState *cpu) { + if (g_bcbs.log_probe) g_bcbs.log_probe(pc, cpu); +} +void psx_segment_miss_record_kind(uint32_t addr, uint32_t home, uint32_t ra, + uint32_t sp, uint32_t frame, uint32_t kind) { + if (g_bcbs.segment_miss_record_kind) + g_bcbs.segment_miss_record_kind(addr, home, ra, sp, frame, kind); +} + +/* ---- Exports ------------------------------------------------------------- */ +PSX_OVERLAY_EXPORT int psx_bios_module_abi(void) { + return PSX_BIOS_MODULE_ABI_TAG; +} +PSX_OVERLAY_EXPORT uint32_t psx_bios_module_codegen_hash(void) { + return (uint32_t)PSX_OVERLAY_CODEGEN_HASH; +} +PSX_OVERLAY_EXPORT int psx_bios_module_init(const OverlayCallbacks *cbs, + const PsxBiosModuleCallbacks *bcbs) { + if (!cbs || !bcbs) return 0; + /* The host's table must be at least as long as ours: a shorter one would + * leave our tail members reading past its end. The ABI tag already pins + * the version; this is the belt to that suspender. */ + if (bcbs->size < sizeof(PsxBiosModuleCallbacks)) return 0; + overlay_init(cbs); + g_bcbs = *bcbs; + if (g_bcbs.hle_hook) g_psx_bm_hle_hook_p = g_bcbs.hle_hook; + if (g_bcbs.dispatch_depth) g_psx_bm_dispatch_depth_p = g_bcbs.dispatch_depth; + if (g_bcbs.static_hits) g_psx_bm_static_hits_p = g_bcbs.static_hits; + if (g_bcbs.current_func_addr) g_psx_bm_current_func_addr_p = g_bcbs.current_func_addr; + if (g_bcbs.bail_flattened) g_psx_bm_bail_flattened_p = g_bcbs.bail_flattened; + if (g_bcbs.ram_mask) g_psx_bm_ram_mask_p = g_bcbs.ram_mask; + if (g_bcbs.frame_count) g_psx_bm_frame_count_p = g_bcbs.frame_count; + return 1; +} +PSX_OVERLAY_EXPORT const PsxBiosBackend *psx_bios_module_backend(void) { + return &PSX_BM_DESCRIPTOR; +} diff --git a/overlay_toolchain/include/psx_bss.h b/overlay_toolchain/include/psx_bss.h new file mode 100644 index 00000000..d903df9c --- /dev/null +++ b/overlay_toolchain/include/psx_bss.h @@ -0,0 +1,24 @@ +/* psx_bss.h — force large zero-init objects into BSS (not stored in the PE). + * + * MinGW + LTO has been observed to place multi‑MiB uninitialized globals into + * .rdata as literal zeros, bloating release .exe size by ~100+ MiB (e.g. + * g_fntrace_ring). Explicit .bss placement keeps them RAM-only on disk. + * + * Mach-O requires "segment,section" (not ELF ".bss"); Apple Clang rejects + * section(".bss") at compile time. + */ +#ifndef PSXRECOMP_PSX_BSS_H +#define PSXRECOMP_PSX_BSS_H + +#if defined(__APPLE__) +#define PSX_BSS __attribute__((section("__DATA,__bss"))) +#elif defined(__GNUC__) || defined(__clang__) +#define PSX_BSS __attribute__((section(".bss"))) +#elif defined(_MSC_VER) +/* MSVC already puts uninitialized globals in .bss by default. */ +#define PSX_BSS +#else +#define PSX_BSS +#endif + +#endif /* PSXRECOMP_PSX_BSS_H */ diff --git a/overlay_toolchain/include/psx_cyc.h b/overlay_toolchain/include/psx_cyc.h new file mode 100644 index 00000000..d5fb196e --- /dev/null +++ b/overlay_toolchain/include/psx_cyc.h @@ -0,0 +1,313 @@ +/* psx_cyc.h — R3000A load-delay pipeline interlock (ReadAbsorb / ReadFudge / + * LDAbsorb / LDWhich). TIMING ONLY — the load VALUE delay is handled by the + * existing load-delay correctness path; this models only the CPU cycle cost. + * + * FAITHFUL_TIMING_PLAN.md / accuracy/load_readfudge_ldabsorb.md. Transcribed + * (facts, not code) from the in-tree Beetle oracle + * psxrecomp/beetle-psx/mednafen/psx/cpu.cpp (RunReal §1 base 795-798, GPR_DEPRES + * 702-705, DO_LDS 800, ReadMemory 364-451) and libretro.cpp (main-RAM read wait + * = +3, libretro.cpp:884). Every backend — the dirty-RAM interpreter and BOTH + * static emitters (code_generator.cpp, full_function_emitter.cpp/strict_translator.cpp) + * — accounts guest CPU cycles THROUGH THESE HELPERS so they can never disagree. + * + * Model (per retired instruction, in program order): + * §1 base : if(ReadAbsorb[ReadAbsorbWhich]) ReadAbsorb[ReadAbsorbWhich]--; + * else timestamp++; -- a pending load's give-back is + * consumed INSTEAD of the +1 base (pipeline write-back overlap). + * deps : for each GPR this opcode reads/writes, ReadAbsorb[reg]=0 (ends a + * give-back when the loaded value is used). ReadAbsorb[0] preserved. + * DO_LDS : commit the PREVIOUS instruction's pending load TIMING: + * ReadAbsorb[LDWhich]=LDAbsorb; ReadFudge=LDWhich; ...; LDWhich=0x20. + * load only : ReadMemory — clear the current give-back slot, charge the +2 fudge + * iff the predecessor committed no load (ReadFudge==0x20), charge the + * region wait (main RAM +3) + completion (+2 CPU / +1 LWC2); the + * (region+completion) becomes this load's LDAbsorb give-back, armed on + * LDWhich=rt for the NEXT instruction's DO_LDS to commit. + */ +#ifndef PSX_CYC_H +#define PSX_CYC_H + +#include +#include +#if defined(_MSC_VER) +#include /* MSVC intrinsics: _BitScanForward (no __builtin_ctz) */ +#endif +#include "cpu_state.h" /* CPUState (guard-safe: cpu_state.h includes us last) */ +#include "psx_cycles.h" /* inline psx_advance_cycles */ +#include "psx_memory.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Load-charge batching (MotK VLC): cache the nearer of the next device + * deadline or a 64-cycle soft publication limit once per batch. Generated + * GCC/Clang blocks may defer to their IRQ edge; MMIO also flushes. Pipeline + * state still updates per instruction, and guest totals at barriers match. */ +enum { PSX_CYC_BATCH_SOFT = 64u }; + +#if defined(PSX_OVERLAY_DLL_BUILD) +/* The overlay shim already batches cycle charges until a host callback edge. */ +static inline void psx_cyc_bb_defer_begin(void) { } +static inline void psx_cyc_bb_defer_end(void) { } +static inline void psx_cyc_bb_defer_flush(void) { overlay_flush_cycles(); } +static inline void psx_cyc_local_begin(uint32_t *acc) { (void)acc; } +static inline void psx_cyc_local_end(void) { } +#else +static inline void psx_cyc_bb_defer_begin(void) { g_psx_cyc_bb_defer++; } +static inline void psx_cyc_bb_defer_end(void) { + if (g_psx_cyc_bb_defer > 0) g_psx_cyc_bb_defer--; + if (g_psx_cyc_bb_defer == 0) psx_cyc_batch_flush(); +} +static inline void psx_cyc_bb_defer_flush(void) { psx_cyc_batch_flush(); } + +/* Install a function-local charge sink (MotK VLC leaves). Soft-cap publish + * at 1<<28 so uint32 cannot wrap; IRQ/MMIO still go through batch_flush. */ +static inline void psx_cyc_local_begin(uint32_t *acc) { +#if !defined(PSX_COSIM) + if (acc) *acc = 0; + g_psx_cyc_local_acc = acc; +#else + (void)acc; +#endif +} +static inline void psx_cyc_local_end(void) { +#if !defined(PSX_COSIM) + psx_cyc_local_publish(); + g_psx_cyc_local_acc = NULL; +#endif +} +#endif + +#if defined(__GNUC__) || defined(__clang__) +static inline void psx_cyc_bb_defer_cleanup(int *guard) { + (void)guard; + psx_cyc_bb_defer_end(); +} +static inline void psx_cyc_local_cleanup(uint32_t **guard) { + (void)guard; + psx_cyc_local_end(); +} +#endif + +static inline void psx_cyc_charge(uint32_t cycles) { + if (cycles == 0u) return; +#if defined(PSX_OVERLAY_DLL_BUILD) + psx_advance_cycles(cycles); +#else +#if defined(__GNUC__) || defined(__clang__) + if (__builtin_expect(g_ls_replay_active | g_event_step_conservative, 0)) { +#else + if (g_ls_replay_active || g_event_step_conservative) { +#endif + psx_advance_cycles(cycles); + return; + } + if (psx_in_device_service) { + psx_cycle_count += (uint64_t)cycles; + return; + } +#if !defined(PSX_COSIM) + /* Emitter-gated VLC path: stack local, no deadline probe. */ + if (g_psx_cyc_local_acc) { + uint32_t prior = *g_psx_cyc_local_acc; + if (cycles <= UINT32_MAX - prior && (prior + cycles) < (1u << 28)) { + *g_psx_cyc_local_acc = prior + cycles; + return; + } + *g_psx_cyc_local_acc = 0; + { + uint32_t *saved = g_psx_cyc_local_acc; + g_psx_cyc_local_acc = NULL; + if (prior) psx_advance_cycles(prior); + g_psx_cyc_local_acc = saved; + } + *g_psx_cyc_local_acc = cycles; + return; + } + { + uint32_t prior = g_psx_cyc_batch; + uint32_t sum = prior + cycles; + if (sum >= prior) { /* no uint32 wrap */ + if (g_psx_cyc_bb_defer > 0) { + g_psx_cyc_batch = sum; + return; + } + if (prior == 0u) { + uint64_t room = 0u; + if (psx_next_service_cycle > psx_cycle_count) + room = psx_next_service_cycle - psx_cycle_count; + g_psx_cyc_batch_limit = room == 0u ? 1u : + (room < (uint64_t)PSX_CYC_BATCH_SOFT + ? (uint32_t)room : (uint32_t)PSX_CYC_BATCH_SOFT); + } + if (sum < g_psx_cyc_batch_limit) { + g_psx_cyc_batch = sum; + return; + } + } + } +#endif + psx_advance_cycles(cycles); /* publishes any pending batch first */ +#endif +} + +/* §1 base (Beetle cpu.cpp:795-798). */ +static inline void psx_cyc_base(CPUState* cpu) { + uint8_t w = cpu->read_absorb_which; + if (cpu->read_absorb[w]) cpu->read_absorb[w]--; + else psx_cyc_charge(1u); +} + +/* GPR_DEPRES (Beetle cpu.cpp:702-705): zero ReadAbsorb[n] for every source/dest + * GPR of this instruction, preserving ReadAbsorb[0] (skipping bit 0 == Beetle's + * save/restore of ReadAbsorb[0]). */ +static inline void psx_cyc_deps(CPUState* cpu, uint32_t reg_mask) { + reg_mask &= 0xFFFFFFFEu; /* never touch ReadAbsorb[0] */ + if (reg_mask && (reg_mask & (reg_mask - 1u)) == 0u) { +#if defined(_MSC_VER) + unsigned long n; + _BitScanForward(&n, reg_mask); + cpu->read_absorb[(unsigned)n] = 0u; +#else + cpu->read_absorb[(unsigned)__builtin_ctz(reg_mask)] = 0u; +#endif + return; + } + while (reg_mask) { +#if defined(_MSC_VER) + unsigned long _psx_ctz_idx; + _BitScanForward(&_psx_ctz_idx, reg_mask); + unsigned n = (unsigned)_psx_ctz_idx; +#else + unsigned n = (unsigned)__builtin_ctz(reg_mask); +#endif + cpu->read_absorb[n] = 0u; + reg_mask &= reg_mask - 1u; + } +} + +/* DO_LDS timing-commit (Beetle cpu.cpp:800). LDWhich==0x20 (no pending) writes the + * dummy slot read_absorb[32] and sets read_fudge=0x20 (=> next load gets +2 fudge). */ +static inline void psx_cyc_lds(CPUState* cpu) { + uint8_t lw = cpu->ld_which_t; + cpu->read_absorb[lw] = (uint8_t)cpu->ld_absorb; + cpu->read_fudge = lw; + cpu->read_absorb_which = (uint8_t)(cpu->read_absorb_which | (lw & 0x1Fu)); + cpu->ld_which_t = 0x20u; +} + +/* Full per-instruction interlock for a NON-CPU-load instruction (ALU, shift, + * branch, jump, store, COP control, LWC2/SWC2 pre-step, mult/div, mfhi/mflo, ...). + * reg_mask from psx_cyc_dep_res_mask(). MUST be emitted BEFORE the instruction + * body so §1 precedes any muldiv/GTE deadline stall in the body (Beetle order). */ +static inline void psx_cyc_step(CPUState* cpu, uint32_t reg_mask) { + psx_cyc_base(cpu); + psx_cyc_deps(cpu, reg_mask); + psx_cyc_lds(cpu); +} + +/* The GPR dep+res bitmask used by psx_cyc_step lives in psx_instr_cost.h + * (psx_cyc_dep_res_mask) — a standalone pure function shared by the emitters + * (gen-time literal) and the interpreter (runtime), with no CPUState dependency. */ + +/* Main-RAM base + load-delay gate (memory.c). Inlined load helpers use these + * so MotK VLC / decode hot paths avoid an out-of-line call per LW/LH. */ +extern uint8_t *g_psx_ram; +extern int g_psx_load_delay; +extern int g_ls_mode; +extern volatile int g_ds_recording; +int psx_load_delay_enabled(void); +uint32_t psx_cyc_load_word_slow(CPUState* cpu, uint32_t addr, uint32_t rt, uint32_t reg_mask); +uint16_t psx_cyc_load_half_slow(CPUState* cpu, uint32_t addr, uint32_t rt, uint32_t reg_mask); + +/* Overlay DLLs route timed loads through the host callback shim so they share + * runtime timing and memory state. Normal generated code keeps the main-RAM + * fast path inline. */ +#if defined(PSX_OVERLAY_DLL_BUILD) +uint32_t psx_cyc_load_word(CPUState* cpu, uint32_t addr, + uint32_t rt, uint32_t reg_mask); +uint16_t psx_cyc_load_half(CPUState* cpu, uint32_t addr, + uint32_t rt, uint32_t reg_mask); +#else +/* CPU data load value+timing. Full Beetle sequence for main RAM is inlined; + * MMIO / lockstep / data-shard fall through to *_slow in memory.c. */ +static inline uint32_t psx_cyc_load_word(CPUState* cpu, uint32_t addr, + uint32_t rt, uint32_t reg_mask) { +#ifdef PSX_ENABLE_BLOCK_CYCLES + uint32_t phys = addr & 0x1FFFFFFFu; + if (g_ls_mode == 0 && !g_ds_recording && phys < 0x00800000u) { + if (g_psx_load_delay < 0) (void)psx_load_delay_enabled(); + if (g_psx_load_delay) { + psx_cyc_base(cpu); + psx_cyc_deps(cpu, reg_mask); + if (cpu->ld_which_t == rt) cpu->ld_which_t = 0u; + psx_cyc_lds(cpu); + cpu->read_absorb[cpu->read_absorb_which] = 0u; + cpu->read_absorb_which = 0u; + uint32_t fudge = (uint32_t)((cpu->read_fudge >> 4) & 2u); + cpu->ld_absorb = 5u; /* main-RAM wait 3 + completion 2 */ + psx_cyc_charge(fudge + 5u); + cpu->ld_which_t = (uint8_t)rt; + } + uint32_t value; + memcpy(&value, g_psx_ram + (phys & g_psx_ram_mask), sizeof(value)); + return value; + } + return psx_cyc_load_word_slow(cpu, addr, rt, reg_mask); +#else + (void)cpu; (void)rt; (void)reg_mask; + extern uint32_t psx_read_word(uint32_t a); + return psx_read_word(addr); +#endif +} + +static inline uint16_t psx_cyc_load_half(CPUState* cpu, uint32_t addr, + uint32_t rt, uint32_t reg_mask) { +#ifdef PSX_ENABLE_BLOCK_CYCLES + uint32_t phys = addr & 0x1FFFFFFFu; + if (g_ls_mode == 0 && !g_ds_recording && phys < 0x00800000u) { + if (g_psx_load_delay < 0) (void)psx_load_delay_enabled(); + if (g_psx_load_delay) { + psx_cyc_base(cpu); + psx_cyc_deps(cpu, reg_mask); + if (cpu->ld_which_t == rt) cpu->ld_which_t = 0u; + psx_cyc_lds(cpu); + cpu->read_absorb[cpu->read_absorb_which] = 0u; + cpu->read_absorb_which = 0u; + uint32_t fudge = (uint32_t)((cpu->read_fudge >> 4) & 2u); + cpu->ld_absorb = 5u; + psx_cyc_charge(fudge + 5u); + cpu->ld_which_t = (uint8_t)rt; + } + uint16_t value; + memcpy(&value, g_psx_ram + (phys & g_psx_ram_mask), sizeof(value)); + return value; + } + return psx_cyc_load_half_slow(cpu, addr, rt, reg_mask); +#else + (void)cpu; (void)rt; (void)reg_mask; + extern uint16_t psx_read_half(uint32_t a); + return psx_read_half(addr); +#endif +} +#endif + +extern uint8_t psx_cyc_load_byte(CPUState* cpu, uint32_t addr, uint32_t rt, uint32_t reg_mask); + +/* Charge the exact timing/pipeline effects of a 32-bit CPU load without + * invoking the memory handler. Enhancement HLE may use this only when static + * analysis proves the loaded value and read side effects are unobservable. */ +extern void psx_cyc_load_word_timing_only(CPUState* cpu, uint32_t addr, + uint32_t rt, uint32_t reg_mask); + +/* LWC2 (GTE load) ReadMemory timing only (completion +1, NO LDWhich arm — the dest + * is a GTE register). Call AFTER psx_cyc_step(cpu,0) (§1+DO_LDS) and psx_gte_stall. + * Returns the raw 32-bit value. */ +extern uint32_t psx_cyc_lwc2_read(CPUState* cpu, uint32_t addr); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_CYC_H */ diff --git a/overlay_toolchain/include/psx_cycle_freeze.h b/overlay_toolchain/include/psx_cycle_freeze.h new file mode 100644 index 00000000..ba300bb0 --- /dev/null +++ b/overlay_toolchain/include/psx_cycle_freeze.h @@ -0,0 +1,49 @@ +#ifndef PSX_CYCLE_FREEZE_H +#define PSX_CYCLE_FREEZE_H + +/* Render-pass time freeze (render_pass.c, docs/RENDER_PASSES.md). + * + * Runtime-only: generated and overlay code never sees this header. It is kept + * out of psx_cycles.h on purpose, because psx_cycles.h is part of the + * overlay codegen hash (runtime/codegen_hash_sources.cmake) and any change to + * it invalidates every title's overlay cache and savestates. The freeze is + * enforced in psx_cycles.c's out-of-line service paths, which generated code + * already reaches through psx_cycles.h. + * + * While g_psx_render_pass_active is set, guest cycles are still counted (GTE + * and mult/div deadlines keep working) but devices are never serviced, no + * VBlank or device event fires and no interrupt is delivered; end() puts + * every clock value back exactly, so the pass consumed no guest time. A pass + * that runs longer than `watchdog_cycles` calls `overrun` (which must not + * return into the guest; render_pass.c longjmps out of the pass). */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern int g_psx_render_pass_active; +typedef struct PsxCycleFreeze { + uint64_t cycle_count; + uint64_t next_service; + uint64_t fast_limit; + uint32_t batch; + uint32_t batch_limit; + uint32_t *local_acc; + uint32_t local_acc_value; + int in_device_service; + /* Generated functions bump g_psx_cyc_bb_defer on entry and drop it in a + * cleanup handler, which a longjmp out of the pass (the watchdog) skips: + * end() puts the interrupted code's depth back. */ + int bb_defer; +} PsxCycleFreeze; +int psx_cycle_freeze_begin(PsxCycleFreeze *save, uint64_t watchdog_cycles, + void (*overrun)(void)); +void psx_cycle_freeze_end(const PsxCycleFreeze *save); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/psx_cycles.h b/overlay_toolchain/include/psx_cycles.h new file mode 100644 index 00000000..e2e0cbf1 --- /dev/null +++ b/overlay_toolchain/include/psx_cycles.h @@ -0,0 +1,197 @@ +#ifndef PSXRECOMP_PSX_CYCLES_H +#define PSXRECOMP_PSX_CYCLES_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* PSX guest CPU cycle clock — the single source of truth for guest- + * visible time. Peripherals derive all schedules from this counter. */ +extern uint64_t psx_cycle_count; + +/* Deadline-device model bookkeeping (written by psx_cycles.c). Hot path + * reads these from the inlined psx_advance_cycles below. */ +extern uint64_t psx_next_service_cycle; /* absolute; 0 = dirty / recompute */ +extern int psx_in_device_service; /* re-entrancy guard */ +extern int g_event_step_conservative; + +/* Diagnostic replay clock: advance the CPU-visible guest clock without + * servicing devices, then restore the authoritative live clock afterward. + * Used only while g_ls_replay_active is set. */ +int psx_cycle_replay_begin(uint64_t start_cycle); +uint64_t psx_cycle_replay_end(void); + +/* Transactional I-cache view for the overlay differential harness. The + * interpreter keeps the authoritative post-call cache; native replay starts + * from the saved entry tags, mutates a temporary view, then restores live. */ +int psx_icache_shadow_record_begin(void); +int psx_icache_shadow_replay_begin(void); +void psx_icache_shadow_replay_end(void); +void psx_icache_shadow_abort(void); + +/* Event-deadline device model: catch every device up to the charged + * guest-cycle position and force a deadline recompute. memory.c calls + * this at the top of every device-MMIO read/write. */ +void psx_devices_mmio_sync(void); +void psx_devices_service_to_now(void); + +/* Rare/slow advance path (COSIM, conservative 1-cycle stepping, lockstep). */ +void psx_advance_cycles_slow(uint32_t cycles); + +/* Sparse throttle fires (watchdog / PC sample) — not on the per-charge path. */ +extern uint32_t psx_watchdog_throttle; +extern uint32_t psx_pc_sample_throttle; +void psx_cycles_watchdog_fire(void); +void psx_cycles_pc_sample_fire(void); + +/* Lockstep replay flag (defined in dirty_ram_interp.c). */ +extern int g_ls_replay_active; + +/* Deferred under-deadline charges (MotK VLC load-charge batching). + * psx_cyc_charge accumulates here; publish via psx_cyc_batch_flush / + * psx_advance_cycles before IRQ checks, MMIO, or any cycle read that must + * match the published counter. Guest totals at those barriers are unchanged. */ +extern uint32_t g_psx_cyc_batch; +extern uint32_t g_psx_cyc_batch_limit; + +/* GCC/Clang-generated functions can defer deadline probes within a basic + * block. Interrupt/MMIO edges still publish the accumulated guest cycles. */ +extern int g_psx_cyc_bb_defer; + +/* Emitter-level VLC load-charge batching: when non-NULL, psx_cyc_charge + * accumulates into *g_psx_cyc_local_acc instead of g_psx_cyc_batch. Publish + * via psx_cyc_local_publish / psx_cyc_batch_flush before IRQ/MMIO barriers. */ +extern uint32_t *g_psx_cyc_local_acc; + +/* Advance guest time. Overlay DLLs forward this through their callback shim; + * normal runtime/generated code keeps the common production path inlined. */ +#if defined(PSX_OVERLAY_DLL_BUILD) +void psx_advance_cycles(uint32_t cycles); +#else +/* The common production path is inlined: bump the + * counter and only service devices when the next event deadline is due. + * Guest-visible timing is unchanged (service_to_now replays exact events). + * + * Watchdog / PC-sample throttles live in psx_devices_service_to_now (fired + * on the HARD_CAP / event cadence, ≥ every 16K guest cycles) — not on every + * per-instruction charge. MotK VLC issues millions of advances/s; two add+ + * branch pairs there were pure host tax. */ +static inline void psx_advance_cycles(uint32_t cycles) { +#if !defined(PSX_COSIM) + if (g_psx_cyc_batch) { + uint32_t b = g_psx_cyc_batch; + g_psx_cyc_batch = 0; + g_psx_cyc_batch_limit = 0; + if (cycles <= UINT32_MAX - b) cycles += b; + else { + /* Extreme: publish b first, then continue with cycles. */ + psx_cycle_count += (uint64_t)b; + if (!psx_in_device_service && + (psx_next_service_cycle == 0u || + psx_cycle_count >= psx_next_service_cycle)) { + psx_devices_service_to_now(); + } + } + } +#endif + if (cycles == 0u) return; +#if defined(PSX_COSIM) + psx_advance_cycles_slow(cycles); + return; +#else +#if defined(__GNUC__) || defined(__clang__) + if (__builtin_expect(g_ls_replay_active | g_event_step_conservative, 0)) { +#else + if (g_ls_replay_active || g_event_step_conservative) { +#endif + psx_advance_cycles_slow(cycles); + return; + } + if (psx_in_device_service) { + psx_cycle_count += (uint64_t)cycles; + return; + } + psx_cycle_count += (uint64_t)cycles; + if (psx_next_service_cycle == 0u || + psx_cycle_count >= psx_next_service_cycle) { + psx_devices_service_to_now(); + } +#endif +} +#endif + +/* Publish deferred charges (IRQ edge / MMIO / savestate). Overlay DLLs keep + * their pending total in the callback shim rather than these host globals. */ +#if defined(PSX_OVERLAY_DLL_BUILD) +PSX_OVERLAY_EXPORT void overlay_flush_cycles(void); +static inline void psx_cyc_local_publish(void) { } +static inline void psx_cyc_batch_flush(void) { overlay_flush_cycles(); } +#else +/* Publish function-local charges into the normal batch/advance path while + * keeping the local pointer installed (nested charges resume locally). */ +static inline void psx_cyc_local_publish(void) { +#if !defined(PSX_COSIM) + uint32_t *acc = g_psx_cyc_local_acc; + if (!acc) return; + uint32_t v = *acc; + if (!v) return; + *acc = 0; + g_psx_cyc_local_acc = NULL; + psx_advance_cycles(v); + g_psx_cyc_local_acc = acc; +#endif +} + +static inline void psx_cyc_batch_flush(void) { +#if !defined(PSX_COSIM) + psx_cyc_local_publish(); + uint32_t b = g_psx_cyc_batch; + if (!b) return; + g_psx_cyc_batch = 0; + g_psx_cyc_batch_limit = 0; + psx_advance_cycles(b); +#endif +} +#endif + +/* Read accessor for telemetry (includes deferred batch). */ +uint64_t psx_get_cycle_count(void); + +/* Idle-loop cycle skip (see psx_cycles.c "Idle-loop cycle skip"). */ +struct CPUState; +void psx_idle_note_check(struct CPUState *cpu, uint32_t check_pc); +int psx_idle_skip_is_enabled(void); +/* Cycles until the nearest IRQ-observable device event (mask-aware); the bound an idle skip may not cross. */ +uint32_t psx_idle_cycles_to_next_observable_event(void); +extern int g_idle_skip_enabled; +extern uint64_t g_idle_skip_count; +extern uint64_t g_idle_skip_cycles; +extern uint32_t g_idle_skip_last_pc; +extern uint32_t g_idle_skip_last_quantum; + +/* Post-load probe cycle diagnostics (optional; main.cpp soft-load tooling). */ +extern int g_plp_cycle_diag; +extern uint64_t g_plp_adv_calls; +extern uint32_t g_plp_adv_max_chunk; +extern uint64_t g_plp_adv_sum; +extern uint64_t g_plp_svc_calls; + +/* Save-state restore: re-anchor the deadline device model after psx_cycle_count + * is overwritten from a snapshot. Pass the live CPU so GTE/muldiv completion + * stamps and load-absorb give-back are rewound with the guest clock. */ +void psx_cycles_resync_after_restore(struct CPUState *cpu); + +/* Soft rematch / session_reboot: zero the guest clock and deadline bookkeeping. + * Soft-exit longjmps out of vblank (inside psx_devices_service_to_now) leave + * psx_in_device_service stuck at 1 and a huge leftover cycle count — without + * this reset the next match never services devices or fires vblanks. */ +void psx_cycles_reset_for_boot(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_PSX_CYCLES_H */ diff --git a/overlay_toolchain/include/psx_fiber.h b/overlay_toolchain/include/psx_fiber.h new file mode 100644 index 00000000..bce986a8 --- /dev/null +++ b/overlay_toolchain/include/psx_fiber.h @@ -0,0 +1,55 @@ +/* + * psx_fiber.h — cross-platform cooperative fibers for the BIOS thread + * scheduler (traps.c) and exception-deferral (interrupts.c). + * + * The PS1 BIOS manages its own threads (TCBs) and switches between them + * cooperatively; the runtime mirrors each BIOS thread with a host fiber so + * the recompiled C for a suspended thread keeps its own native call stack + * across a ChangeThread. The CD-boot handoff in particular depends on this: + * a thread issues a CD command, WaitEvent-blocks, and the scheduler must be + * able to resume a *different* thread's previously-suspended stack — which + * requires real separate stacks, not nested dispatch. + * + * Backends: + * - Windows: the Win32 Fiber API (ConvertThreadToFiber / CreateFiber / + * SwitchToFiber / DeleteFiber). Behavior is identical to the original. + * - POSIX (macOS/Linux): ucontext (makecontext / swapcontext). + * + * Cooperative, single-threaded: exactly one fiber runs at a time and all + * switches are explicit. psx_fiber_current() is the GetCurrentFiber analog. + */ +#ifndef PSX_FIBER_H +#define PSX_FIBER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* psx_fiber_t; +typedef void (*psx_fiber_entry)(void* arg); + +/* Make the current thread a fiber so it can switch to others. Idempotent; + * returns the handle for the current thread's fiber. Call before the first + * psx_fiber_switch on this thread. */ +psx_fiber_t psx_fiber_convert_thread(void); + +/* The currently-executing fiber (GetCurrentFiber analog). */ +psx_fiber_t psx_fiber_current(void); + +/* Create a fiber with its own stack. It does not run until switched to. */ +psx_fiber_t psx_fiber_create(size_t stack_size, psx_fiber_entry entry, void* arg); + +/* Switch execution to target; the caller is suspended until switched back. */ +void psx_fiber_switch(psx_fiber_t target); + +/* Destroy a fiber created by psx_fiber_create and free its stack. Must not + * be the currently-running fiber. */ +void psx_fiber_destroy(psx_fiber_t fiber); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_FIBER_H */ diff --git a/overlay_toolchain/include/psx_icache.h b/overlay_toolchain/include/psx_icache.h new file mode 100644 index 00000000..e45b9381 --- /dev/null +++ b/overlay_toolchain/include/psx_icache.h @@ -0,0 +1,56 @@ +#ifndef PSXRECOMP_PSX_ICACHE_H +#define PSXRECOMP_PSX_ICACHE_H + +#include "cpu_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern uint32_t g_psx_icache_tv[1024]; +extern int g_psx_icache_active; +extern int g_ls_replay_active; +void psx_icache_reset(void); +void psx_icache_fetch(CPUState *cpu, uint32_t addr); +void psx_icache_fetch_miss(CPUState *cpu, uint32_t addr); + +/* BIU / cache control (0xFFFE0130) bits the cache model reads; names and values + * as Beetle's cpu.cpp BIU_* defines. */ +#define PSX_BIU_ICACHE_ENABLE 0x800u /* BIU_ENABLE_ICACHE_S1 */ +#define PSX_BIU_DCACHE_ENABLE 0x080u /* BIU_ENABLE_DCACHE */ +#define PSX_BIU_TAG_TEST 0x004u /* BIU_TAG_TEST_MODE */ +#define PSX_BIU_INVALIDATE 0x002u /* BIU_INVALIDATE_MODE */ +#define PSX_BIU_LOCK 0x001u /* BIU_LOCK_MODE */ + +/* A CPU store made while SR.IsC is set, applied to the I-cache model: the + * I-cache half of Beetle PS_CPU::WriteMemory's IsC branch. With the I-cache + * enabled and a tag-test, invalidate or lock mode bit set, the store rewrites + * the tag and valid bits of the four words of its line; that is how FlushCache + * (A 44h) invalidates the cache. `biu` is the current 0xFFFE0130 value and + * `value` the stored register value (only its low byte lanes matter). */ +void psx_icache_isc_store(uint32_t biu, uint32_t addr, uint32_t value); + +/* Keep the interpreter's steady-state tag hit inside its translation unit. + * Misses use the shared slow path, preserving exact cache evolution/timing. */ +static inline void psx_icache_fetch_interp(CPUState *cpu, uint32_t addr) { +#ifdef PSX_ENABLE_BLOCK_CYCLES + if (g_ls_replay_active) return; + if (g_psx_icache_active < 0) { + psx_icache_fetch(cpu, addr); + return; + } + if (!g_psx_icache_active) return; + uint32_t idx = (addr & 0xFFCu) >> 2; + if (g_psx_icache_tv[idx] == addr) return; + psx_icache_fetch_miss(cpu, addr); +#else + (void)cpu; + (void)addr; +#endif +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/psx_instr_cost.h b/overlay_toolchain/include/psx_instr_cost.h new file mode 100644 index 00000000..7686af85 --- /dev/null +++ b/overlay_toolchain/include/psx_instr_cost.h @@ -0,0 +1,181 @@ +/* psx_instr_cost.h — SINGLE SOURCE OF TRUTH for R3000A guest CPU cycle cost. + * + * FAITHFUL_TIMING_PLAN.md P3/Stage-2. Both execution backends — the dirty-RAM + * interpreter (runtime/src/dirty_ram_interp.c) and the static recompiler + * (recompiler/src/code_generator.cpp, which sums this over a block at gen time + * to fold it into one compile-time block charge) — MUST account guest cycles + * THROUGH THIS FUNCTION so they can never disagree (the -8 drift class). + * + * STAGE 1 (now): identity, 1 cycle per instruction. This is the proven baseline + * both backends already used, so routing them through here is BEHAVIOR-PRESERVING + * (a regen must be byte-identical) and merely establishes the seam. + * + * STAGE 2 (next): replace the body with the documented R3000A model, transcribed + * (facts, not code) from the in-tree oracle psxrecomp/beetle-psx/mednafen/psx/ + * (cpu.cpp MULT_Tab/muldiv, gte.cpp GTE_Instruction per-command table) and + * psx-spx, each value VERIFIED against Beetle at runtime before it is trusted. + * Memory-access wait-states are charged separately in the psx_read/write path + * (they are address/region-dependent, not knowable from the opcode alone), so + * this function returns ONLY the CPU instruction/execute base cost. Keep that + * split clean in both backends to avoid double-counting. + * + * Header is plain C (static inline) so both the C runtime and the C++ recompiler + * can include it as the one definition. + */ +#ifndef PSX_INSTR_COST_H +#define PSX_INSTR_COST_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Guest CPU cycle cost for one retired instruction. `insn` is the raw 32-bit MIPS + * word. Transcribed from the in-tree Beetle oracle (mednafen psx/cpu.cpp) + psx-spx; + * each component verified against Beetle via the cyc_watch DELTA gate + * (FAITHFUL_TIMING_PLAN.md §3c). Both backends consume this one function. + * + * DATA-MEMORY ACCESS IS *NOT* CHARGED HERE — it lives in the load-delay interlock. + * Guest CPU data loads route through psx_cyc_load_* (runtime/src/memory.c, declared + * in psx_cyc.h), which charges the Beetle ReadMemory cost address-keyed (main RAM + * region +3, completion +2, scratchpad +0) as the LDAbsorb give-back, plus the +2 + * ReadFudge — exactly like PS_CPU::ReadMemory, NOT in the opcode dispatch. The + * opcode word alone cannot know the target region (RAM vs scratchpad vs MMIO), so a + * per-opcode load surcharge HERE is wrong by construction and would double-count. + * NOTE: in per-instruction mode (the default) the §1 base is charged by psx_cyc_base + * (psx_cyc.h), not by this function — psx_instr_base_cycles is only the block-mode + * (PSX_CODEGEN_CYCLE_PER_INSN=0) fallback sum and the dep/res mask seed below. + * + * HISTORY: Stage-2 #1a (commit 2ef47bd) returned 3 for loads / 2 for LWC2 + * ("1 execute + 2 data-access"). The BIOS-kernel cycle ruler (region + * [0x80001C5C→0x80001CA4]) proved this double-counts: native charged the 2 + * loads +2 each HERE *and* +6 each in memory.c (8 over base), reconciling the + * opaque 0x80017FC4 window only because that over-charge masked the entirely- + * unmodeled divu→mflo stall. Reverted to pure execute base (this header's own + * stated contract). The real Stage-2 components are EXECUTE-pipeline latencies + * (mult/div stall, GTE per-command) added here, and CALIBRATING the memory-path + * wait-state (memory.c) per Beetle region — each Δ-gated on the ruler. */ +static inline uint32_t psx_instr_base_cycles(uint32_t insn) { + (void)insn; + return 1u; /* pure CPU execute base; data access charged in memory.c */ +} + +/* GPR dep+res bitmask (bit n => GPR n) for one MIPS-I instruction, transcribed + * from the Beetle oracle's per-opcode GPR_DEP/GPR_RES (cpu.cpp). Drives the + * load-delay interlock's GPR_DEPRES step (psx_cyc_step / psx_cyc_load_*, psx_cyc.h) + * — the give-back ends when a following instruction reads/writes the loaded reg. + * For CPU loads this returns the source (rs) ONLY: the dest rt is the delayed-load + * target (armed via LDWhich), not a GPR_RES. Pure (insn-only) so the static emitters + * fold it to a literal at gen-time and the interpreter calls it at runtime. */ +static inline uint32_t psx_cyc_dep_res_mask(uint32_t insn) { + enum { + PSX_CYC_ROLE_RS = 1u, + PSX_CYC_ROLE_RT = 2u, + PSX_CYC_ROLE_RD = 4u, + PSX_CYC_ROLE_R31 = 8u + }; + /* The interpreter already dispatches on opcode/funct to execute the + * instruction. Repeating that work here with nested switches made the + * load-delay interlock a second decoder in every non-load hot path. These + * tables encode the same register roles in O(1); static emitters still call + * this single shared helper and therefore retain the same generated masks. */ + static const uint8_t op_roles[64] = { + 0, PSX_CYC_ROLE_RS, 0, PSX_CYC_ROLE_R31, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS, PSX_CYC_ROLE_RS, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RT, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + PSX_CYC_ROLE_RS, PSX_CYC_ROLE_RS, PSX_CYC_ROLE_RS, + PSX_CYC_ROLE_RS, PSX_CYC_ROLE_RS, PSX_CYC_ROLE_RS, + PSX_CYC_ROLE_RS, 0, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + 0, 0, PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 + }; + static const uint8_t special_roles[64] = { + PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, 0, + PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, 0, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RD, + 0, 0, 0, 0, 0, 0, + PSX_CYC_ROLE_RD, PSX_CYC_ROLE_RS, + PSX_CYC_ROLE_RD, PSX_CYC_ROLE_RS, + 0, 0, 0, 0, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT, + 0, 0, 0, 0, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + 0, 0, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + PSX_CYC_ROLE_RS | PSX_CYC_ROLE_RT | PSX_CYC_ROLE_RD, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 + }; + uint32_t op = insn >> 26; + uint32_t rs = (insn >> 21) & 0x1Fu; + uint32_t rt = (insn >> 16) & 0x1Fu; + uint32_t rd = (insn >> 11) & 0x1Fu; + uint32_t roles = op_roles[op]; + if (op == 0u) + roles = special_roles[insn & 0x3Fu]; + else if (op == 1u && (rt & 0x1Eu) == 0x10u) + roles |= PSX_CYC_ROLE_R31; + return ((0u - ((roles & PSX_CYC_ROLE_RS) != 0u)) & (1u << rs)) | + ((0u - ((roles & PSX_CYC_ROLE_RT) != 0u)) & (1u << rt)) | + ((0u - ((roles & PSX_CYC_ROLE_RD) != 0u)) & (1u << rd)) | + ((0u - ((roles & PSX_CYC_ROLE_R31) != 0u)) & (1u << 31)); +} + +/* 1 iff an instruction fetch at virtual address `pc` bypasses the I-cache. + * Transcribed from Beetle PS_CPU::ReadInstruction (the in-tree cpu.cpp:534-601 + * that psx_icache.c follows): a fetch at 0xA0000000 or above (KSEG1, and KSEG2 + * above it) never hits and never fills a line. Each such fetch costs +4 and + * clears the pending load give-back, on EVERY instruction. + * + * One definition for three users: + * - psx_icache.c charges the uncached fetch with it; + * - the dirty-RAM interpreter reaches that charge by fetching at every PC; + * - both static emitters (code_generator.cpp, full_function_emitter.cpp) use it + * to emit a fetch charge before every instruction whose runtime PC is + * uncached. Cached code keeps the line-leader rule, where intra-line + * fall-through followers are guaranteed hits. + * BIU bit 11 (cache disable) is run-time state, not an address property. + * Neither psx_icache.c nor the interpreter models it yet + * (ACCURACY_BURNDOWN axis 4). */ +static inline int psx_fetch_uncached(uint32_t pc) { + return pc >= 0xA0000000u; +} + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_INSTR_COST_H */ diff --git a/overlay_toolchain/include/psx_interpreter.h b/overlay_toolchain/include/psx_interpreter.h new file mode 100644 index 00000000..c4073b87 --- /dev/null +++ b/overlay_toolchain/include/psx_interpreter.h @@ -0,0 +1,63 @@ +/* psx_interpreter.h — R3000A interpreter for oracle builds. + * + * Oracle-only: provides a cycle-accurate reference implementation + * of the PSX CPU. Shares the same CPUState and memory bus as the + * recompiled native build. The native build links stub_interpreter.c + * instead (all functions are no-ops). + * + * Follows the Genesis/clown68000 pattern: two CMake targets from one + * source tree, gated by PSX_ORACLE_BUILD. + */ + +#ifndef PSXRECOMP_PSX_INTERPRETER_H +#define PSXRECOMP_PSX_INTERPRETER_H + +#include "cpu_state.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Initialize interpreter state. Call once after CPUState is allocated. */ +void interp_init(CPUState* cpu); + +/* Drop host-static pending load-delay (not in boot_state). See + * dirty_ram_ld_delay_discard — same restore contract for the debug interp. */ +void interp_ld_delay_discard(void); + +/* Execute exactly `count` instructions. Returns number actually executed + * (may be less if a breakpoint fires). */ +uint32_t interp_step(CPUState* cpu, uint32_t count); + +/* Run until breakpoint, halt, or max_instructions reached. */ +uint32_t interp_run(CPUState* cpu, uint32_t max_instructions); + +/* Check if interpreter hit a breakpoint on the last run. */ +int interp_hit_breakpoint(void); + +/* --- PC breakpoints --- */ +int interp_break_add(uint32_t pc); /* returns slot, or -1 */ +int interp_break_remove(uint32_t pc); /* returns 1 if removed */ +void interp_break_clear_all(void); + +/* --- Per-instruction trace ring --- */ +typedef struct { + uint32_t pc; + uint32_t gpr[32]; + uint32_t hi, lo; + uint32_t cop0_sr, cop0_cause, cop0_epc; + uint32_t insn; /* raw instruction word */ + uint64_t seq; /* monotonic sequence number */ +} InterpTraceEntry; + +void interp_trace_enable(int on); +uint64_t interp_trace_count(void); +/* Get entry by index into ring (0 = oldest available). Returns NULL if OOB. */ +const InterpTraceEntry* interp_trace_get(uint32_t ring_idx); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_PSX_INTERPRETER_H */ diff --git a/overlay_toolchain/include/psx_keybinds.h b/overlay_toolchain/include/psx_keybinds.h new file mode 100644 index 00000000..9d9072bd --- /dev/null +++ b/overlay_toolchain/include/psx_keybinds.h @@ -0,0 +1,110 @@ +#pragma once +#include +#include "psx_sdl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * psx_keybinds — configurable KEYBOARD -> PlayStation DualShock keybinds. + * + * INI-driven, generated next to the exe as `keybinds.ini` on first run. Covers + * every DualShock input: the D-pad, the four face buttons (Cross/Circle/ + * Square/Triangle), the shoulders (L1/L2/R1/R2), Start/Select, the stick + * clicks (L3/R3), and — for the keyboard analog path — the left and right + * analog-stick directions. Each input maps to one SDL_Scancode; "None" + * (SDL_SCANCODE_UNKNOWN) leaves it unbound. + * + * This is the KEYBOARD map only. Game-controller (gamepad) button mapping is a + * separate concern handled by input.ini (see main.cpp load_input_config). + * + * Up to PSXKB_MAX_PLAYERS keyboard players (P1..P5). Every player ships with the + * same default keyboard map (the framework's historical P1 layout); "Reset to + * Defaults" restores that map for any slot. Simultaneous multi-keyboard play + * still needs distinct binds per slot — only one physical keyboard. + * + * The launcher's Controls page edits these live through the rebind API below + * (get/set/reset/save) and persists to the same keybinds.ini; the runtime + * re-reads the file at startup via psx_keybinds_init. + */ + +#define PSXKB_MAX_PLAYERS 5 + +/* Button indices — stable order, matches the order keybinds.ini writes and the + * order the launcher's rebind chips are laid out. Keep in sync with kButtons[] + * in psx_keybinds.c. */ +enum PsxKeybindButton { + PSX_KB_UP = 0, PSX_KB_DOWN, PSX_KB_LEFT, PSX_KB_RIGHT, + PSX_KB_CROSS, PSX_KB_CIRCLE, PSX_KB_SQUARE, PSX_KB_TRIANGLE, + PSX_KB_L1, PSX_KB_R1, PSX_KB_L2, PSX_KB_R2, + PSX_KB_L3, PSX_KB_R3, + PSX_KB_START, PSX_KB_SELECT, + PSX_KB_LS_UP, PSX_KB_LS_DOWN, PSX_KB_LS_LEFT, PSX_KB_LS_RIGHT, + PSX_KB_RS_UP, PSX_KB_RS_DOWN, PSX_KB_RS_LEFT, PSX_KB_RS_RIGHT, + PSX_KB_COUNT +}; + +typedef struct { + SDL_Scancode up, down, left, right; + SDL_Scancode cross, circle, square, triangle; + SDL_Scancode l1, r1, l2, r2; + SDL_Scancode l3, r3; + SDL_Scancode start, select; + SDL_Scancode ls_up, ls_down, ls_left, ls_right; /* left analog stick */ + SDL_Scancode rs_up, rs_down, rs_left, rs_right; /* right analog stick */ +} PsxPlayerBinds; + +typedef struct { + PsxPlayerBinds player[PSXKB_MAX_PLAYERS]; /* [0]=P1 .. [4]=P5 */ +} PsxKeyBinds; + +/* Initialize from /keybinds.ini. Generates a default file if one does + * not exist. exe_path may be NULL/argv[0]/the exe directory itself — the .ini is + * placed in that file's directory (or the path itself when it is a directory). */ +void psx_keybinds_init(const char *exe_path); + +/* Read-only view of the current bindings. */ +const PsxKeyBinds *psx_keybinds_get(void); + +/* ── Runtime read helpers (keyboard -> PSX pad), player is 1..PSXKB_MAX_PLAYERS */ + +/* Build the 16-bit ACTIVE-LOW PSX button word for `player` from the SDL + * keyboard state (bits per the standard PSX pad word; unbound inputs never + * assert). Returns 0xFFFF (all released) if `keys` is NULL or player is out of + * range. AND this into the pad word (an unpressed source leaves bits high). */ +uint16_t psx_keybinds_pad_word(const uint8_t *keys, int player); + +/* Fill analog-stick bytes (0x80 centred): out[0]=LX, out[1]=LY, out[2]=RX, + * out[3]=RY, from the player's stick-direction binds. A bound direction held + * drives that axis to the extreme (0x00 / 0xFF). Untouched axes stay centred. + * Only overwrites axes that have a live bound press, so callers can pre-seed. */ +void psx_keybinds_sticks(const uint8_t *keys, int player, uint8_t out[4]); + +/* True if any of the player's D-pad direction binds is currently held (used by + * the hybrid pad-mode auto-switch: a D-pad press flips the pad to digital). */ +int psx_keybinds_dpad_active(const uint8_t *keys, int player); + +/* ── Rebind API (launcher Controls page) ──────────────────────────────────── */ +/* Buttons are indexed 0..PSX_KB_COUNT-1 (see PsxKeybindButton). Scancodes, not + * keycodes (keybinds.ini stores SDL scancode names). Players are 1-based. */ +int psx_keybinds_button_count(void); +const char *psx_keybinds_button_name(int button); /* "up".."rs_right" */ +const char *psx_keybinds_button_label(int button); /* pretty, e.g. "Cross" */ +SDL_Scancode psx_keybinds_get_button(int player, int button); +void psx_keybinds_set_button(int player, int button, SDL_Scancode sc); +/* Alternate (secondary) binding per control: both the primary and the alt + * assert the input (e.g. cross = X, Mouse1). Stored in keybinds.ini as a + * comma-separated second name; SDL_SCANCODE_UNKNOWN = no alt. */ +SDL_Scancode psx_keybinds_get_button_alt(int player, int button); +void psx_keybinds_set_button_alt(int player, int button, SDL_Scancode sc); +/* Reset one player's bindings to the shared built-in primary defaults and + * clear that player's alternate bindings. */ +void psx_keybinds_reset_player(int player); +/* Persist the current bindings to keybinds.ini (path resolved by + * psx_keybinds_init; call that first). */ +void psx_keybinds_save(void); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/psx_lobby_client.h b/overlay_toolchain/include/psx_lobby_client.h new file mode 100644 index 00000000..0831dbb3 --- /dev/null +++ b/overlay_toolchain/include/psx_lobby_client.h @@ -0,0 +1,664 @@ +#ifndef PSX_LOBBY_CLIENT_H +#define PSX_LOBBY_CLIENT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PSX_LOBBY_ID_LEN 40 +#define PSX_LOBBY_NAME_LEN 64 +#define PSX_LOBBY_VERSION_LEN 32 +#define PSX_LOBBY_ENDPOINT_LEN 64 +#define PSX_LOBBY_MAX_LIST 32 +/* Player seats this framework can seat. Was what PSX_LOBBY_MAX_MEMBERS meant + * before a lobby held anything that was not a player. */ +#define PSX_LOBBY_MAX_PLAYERS 8 +/* Spectator seats a host may open, a separate pool on top of the players -- + * so a full eight-player room can still be watched. */ +#define PSX_LOBBY_MAX_SPECTATORS 4 +/* Rows in the membership table: both tables land in it, tagged by role. */ +#define PSX_LOBBY_MAX_MEMBERS (PSX_LOBBY_MAX_PLAYERS + PSX_LOBBY_MAX_SPECTATORS) + +/* Seat indices are one namespace, matching the server: below the base is a + * player seat, at or above it is `index - base` in the gallery. The server + * republishes its own base in every lobby_update; this is the compiled-in + * default for an update that arrives without one. */ +#define PSX_LOBBY_SPECTATOR_SLOT_BASE 64 +#define PSX_LOBBY_MAX_LAN_EPS 4 +#define PSX_LOBBY_LANG_LEN 16 + +#ifndef PSX_GAME_VERSION +#define PSX_GAME_VERSION "dev" +#endif + +typedef struct PsxLobbyRow { + char lobby_id[PSX_LOBBY_ID_LEN]; + char name[PSX_LOBBY_NAME_LEN]; + char game_name[PSX_LOBBY_NAME_LEN]; + char game_version[PSX_LOBBY_VERSION_LEN]; + int player_count; + int max_slots; + int has_password; + /* Host UDP endpoint from the server list (for one-shot latency probes). */ + char host_endpoint[PSX_LOBBY_ENDPOINT_LEN]; + /* Legacy hub lan_endpoints (compat). Prefer local UDP beacon by lobby_id. */ + char lan_endpoints[PSX_LOBBY_MAX_LAN_EPS][PSX_LOBBY_ENDPOINT_LEN]; + int lan_count; + /* Round-trip ms to a reachable candidate; -1 unknown / timed out. */ + int latency_ms; + /* Host's country (alpha-2) from the server's GeoIP; "" unknown. */ + char host_country[4]; + /* Gallery: 0 = none; else how many watch out of how many seats. */ + int allow_spectators; + int max_spectators; + int spectator_count; +} PsxLobbyRow; + +/* One player connected to the hub (the lobby_list `players` array). */ +typedef struct PsxLobbyOnlinePlayer { + char player_id[PSX_LOBBY_ID_LEN]; + char display_name[PSX_LOBBY_NAME_LEN]; + char country[4]; + char lobby_id[PSX_LOBBY_ID_LEN]; + char lobby_name[PSX_LOBBY_NAME_LEN]; + int hosting; + /* First 8 characters of the player's connection id: enough to tell + * "which row is me" without publishing whole ids to browsers. */ + char tag[12]; + /* The title that player is browsing for; rows of other titles are + * dropped at parse time when this client has a game identity. */ + char game_name[PSX_LOBBY_NAME_LEN]; + /* Opaque, stable id for the ACCOUNT behind this connection; "" for a + * guest. The server's own row key, published so a client-side block + * list can survive the other player reconnecting or renaming. A key, + * never a label: nothing renders it. */ + char account[PSX_LOBBY_ID_LEN]; +} PsxLobbyOnlinePlayer; +#define PSX_LOBBY_MAX_ONLINE 64 + +typedef struct PsxLobbyMember { + /* Seat index in the shared namespace: a player seat, or + * spectator_slot_base + gallery index. Pass it back to kick / move as-is. */ + int slot; + char player_id[PSX_LOBBY_ID_LEN]; + char display_name[PSX_LOBBY_NAME_LEN]; + int ready; + /* 1 when this row is in the gallery. Read this rather than comparing + * `slot` against a base: the base is the server's to choose. */ + int is_spectator; + /* Peer BIOS capability from set_ready bios_offer (0 if legacy/missing). */ + int bios_offer_valid; + int bios_can_openbios; /* linked OpenBIOS backend */ + int bios_can_scph1001; /* linked retail + validated dump available */ + int bios_prefer_openbios; /* explicit OpenBIOS pick (not retail) */ + /* CRC-32 of the retail image this seat would boot (bios_offer.retail_crc); + * 0 = not sent (older client). See netplay_bios_settle.h. */ + uint32_t bios_retail_crc; + /* Peer memory-card offer from set_ready memcard_offer (0 if legacy). */ + int memcard_offer_valid; + int memcard_has_card; /* a slot-1 card is enabled locally */ + int memcard_share; /* peer opted in to bring it to the match */ + /* Country (alpha-2) from the server's GeoIP; "" unknown. */ + char country[4]; + /* Account key behind this seat; "" for a guest. See + * PsxLobbyOnlinePlayer.account. */ + char account[PSX_LOBBY_ID_LEN]; + /* Host-relay room: this guest's latest path_report ("direct" | "fail" | + * "relay"), "" when none, and whether the server still trusts it at start + * (recomp-net-server WS_LOBBY.md "Host relay"). */ + char path[8]; + int path_fresh; +} PsxLobbyMember; + +/* + * Local BIOS capability advertised on set_ready (see docs/BIOS_SELECTION.md + * netplay settle rule). Updated by the host runtime via psx_lobby_set_bios_offer. + */ +typedef struct PsxLobbyBiosOffer { + int valid; + int can_openbios; + int can_scph1001; + int prefer_openbios; /* 1 = OpenBIOS selected; 0 = retail / willing SCPH */ + /* CRC-32 of the retail file this peer would boot for a retail match; + * 0 when can_scph1001 is 0. The settle compares these, not the token. */ + uint32_t retail_crc; +} PsxLobbyBiosOffer; + +/* + * Local memory-card offer advertised on set_ready. `has_card` says whether a + * slot-1 card is enabled here; `share` is the player's opt-in to bring it. + * Meaningful for seat 1 (whose card becomes the match's slot-2 card); other + * seats may advertise it harmlessly. + */ +typedef struct PsxLobbyMemcardOffer { + int valid; + int has_card; + int share; +} PsxLobbyMemcardOffer; + +/* One lobby chat line (WS op:chat, echoed by the server to everyone seated, + * sender included — so the ring is the room's order, not ours). */ +#define PSX_LOBBY_CHAT_TEXT_LEN 256 +#define PSX_LOBBY_CHAT_RING 64 +typedef struct PsxLobbyChatMsg { + char player_id[PSX_LOBBY_ID_LEN]; + char from[PSX_LOBBY_NAME_LEN]; + char text[PSX_LOBBY_CHAT_TEXT_LEN]; + /* The SERVER's id for this line, and what psx_lobby_report_chat names. + * Empty for a system line, a locally generated one, and anything from a + * server too old to assign one -- none of which can be reported, because + * there is no referent both sides agree on. + * + * A report carries this and NOT the text: the server writes down what it + * relayed under this id. Sending the words would let a client fabricate a + * message and have somebody sanctioned for it. */ + char mid[40]; + /* Account key of the sender; "" for a guest or a system line. What an + * ignore/block keys on, so it outlives a rename. */ + char account[PSX_LOBBY_ID_LEN]; + int is_local; + int is_system; + uint32_t seq; +} PsxLobbyChatMsg; + +/* + * Host-authoritative sim settings negotiated over the lobby. + * Guests apply these on launch so both peers boot with matching caps. + */ +typedef struct PsxLobbyMatchCaps { + int valid; /* 1 when a host blob was received / set */ + int aspect_num; /* e.g. 4, 16, 21 */ + int aspect_den; /* e.g. 3, 9 */ + int turbo_loads; /* 0/1 */ + int bios_hle; /* 0/1 */ + int fast_boot; /* 0/1 */ + int auto_skip_fmv; /* 0/1 */ + int input_delay; /* recomp-net delay frames (D) */ + int input_prediction; /* invent runway frames (P); rollback only */ + int force_input_relay; /* 0/1 — server input relay (vs P2P) */ + /* 0/1 -- host: ask for the HOST RELAY (match_caps.relay = "host"): the + * host carries the match on its own UDP port and guests dial it; the + * server falls back to its relay unless every guest proved the path + * (recomp_net/host_relay.h). Guests read it to know the room asks. */ + int relay_host; + int force_turn; /* 0/1 — ICE relay-only (Force TURN for UDP) */ + int rollback; /* 0/1 — invent/rollback netplay (default on) */ + /* DualShock-on-multitap-tap hack (0/1). Host-authoritative for the match. */ + int multitap_analog; + /* Host allows seat 1 to bring its own memory card (default 1; absent + * field = 1). The lobby icon is lit only when this AND seat 1's offer + * (has_card && share) hold. */ + int guest_memcard; + /* Settled at start by the host: 1 = seat 1's card IS used this match. + * Peers launch from this, never from their own view of the seat table, + * so a toggle racing the start cannot split the room. */ + int guest_memcard_active; + char language[PSX_LOBBY_LANG_LEN]; + /* Settled match BIOS: "openbios" | "scph1001" | "" (unset / legacy). + * "scph1001" means "the retail image named by session_bios_crc". */ + char session_bios[16]; + /* Retail match: CRC-32 of the image every peer boots. 0 = not sent (an + * older host); peers then accept any retail dump, as before. */ + uint32_t session_bios_crc; +} PsxLobbyMatchCaps; + +typedef struct PsxLobbyJoinInfo { + int ok; + char lobby_id[PSX_LOBBY_ID_LEN]; + uint32_t session_id; + int local_slot; + char host_endpoint[PSX_LOBBY_ENDPOINT_LEN]; + char guest_endpoint[PSX_LOBBY_ENDPOINT_LEN]; + char bind_hostport[PSX_LOBBY_ENDPOINT_LEN]; + char peer_hostport[PSX_LOBBY_ENDPOINT_LEN]; + int player_count; + int max_slots; + /* 1 when this client holds a gallery seat: it runs the match and shows it, + * and contributes no input to anybody. */ + int local_is_spectator; + /* Host opt-in, echoed by the server. 0 when the server predates + * spectators, which is why every spectator control is gated on it. */ + int allow_spectators; + int max_spectators; + int spectator_count; + int spectator_slot_base; + /* Where the gallery starts in the RELAY's slot space -- a different + * namespace from the lobby seat index above, and the one the engine needs. + * The relay forwards nothing from a slot at or beyond its player count, so + * this is the number that makes a spectator unable to send. */ + int spectator_relay_base; + /* Launch: the host watches from the gallery but runs the match from + * session slot 0 (pad muted); player seats sit at lobby seat + 1. */ + int host_spectates; + /* Launch: transport "host" -- no relay_endpoint; the host carries the + * match on host_endpoint (its advertised public port); guests dial it. + * force_input_relay is 0. The host binds bind_hostport and accepts the + * guest (2 seats) or hubs (3+). */ + int transport_host; + /* A server code (need_password | bad_password | …) or, from + * psx_lobby_set_last_error, one sentence the launcher shows as is. */ + char last_error[192]; +} PsxLobbyJoinInfo; + +/* Default URL when PSX_NET_LOBBY_URL unset. Order: + * 1) env PSX_NET_LOBBY_URL + * 2) compile-time PSX_NET_LOBBY_DEFAULT_URL (title CMake / scaffold) + * 3) ws://netplay.retcomm.net:8765 */ +const char *psx_lobby_default_url(void); + +int psx_lobby_connect(const char *ws_url); /* 0 = connected or connect started */ +void psx_lobby_disconnect(void); +int psx_lobby_connected(void); +/* 1 while DNS/TCP/WebSocket upgrade runs off the UI thread. */ +int psx_lobby_connecting(void); + +void psx_lobby_set_display_name(const char *name); +const char *psx_lobby_display_name(void); +const char *psx_lobby_player_id(void); + +/* Non-blocking pump — call every frame from the launcher. */ +void psx_lobby_pump(void); + +/* + * Title + release pin used for create/join matching and list filters. + * Defaults: game_name empty (no name filter), game_version PSX_GAME_VERSION. + * List: Release pins filter by exact game_version; "dev" lists all versions + * of the title (join still requires an exact version match). + */ +void psx_lobby_set_game_identity(const char *game_name, const char *game_version); +const char *psx_lobby_game_version(void); + +/* + * TOC fingerprint (lowercase hex SHA-256 from DiscIdentity::disc_fp). + * Sent on create/join so the lobby server can reject mismatched mounts + * (e.g. Track-01-only vs full multi-track cue). Empty disables the check + * on the server for that peer (legacy clients); modern clients always set it + * after a successful disc verify. + */ +void psx_lobby_set_disc_fp(const char *disc_fp); +const char *psx_lobby_disc_fp(void); + +/* Default max_slots for create (clamped 2..8, default 2). */ +void psx_lobby_set_max_slots(int max_slots); + +void psx_lobby_request_list(void); +int psx_lobby_list_count(void); +int psx_lobby_list_get(int index, PsxLobbyRow *out); +/* Players connected to the hub, refreshed with every lobby_list. */ +int psx_lobby_online_count(void); +int psx_lobby_online_get(int index, PsxLobbyOnlinePlayer *out); + +/* + * Create lobby. host_bind e.g. "0.0.0.0:7777". password may be NULL/empty. + * game_version NULL/empty → identity / PSX_GAME_VERSION / "dev". + * match_caps may be NULL (legacy); when non-NULL and valid, sent to the server + * so guests join with the host's sim settings. + * Returns 0 if request sent; poll psx_lobby_join_info() / in_lobby(). + */ +int psx_lobby_create(const char *name, const char *game_name, + const char *game_version, + const char *password, const char *host_bind, + const PsxLobbyMatchCaps *match_caps); + +int psx_lobby_join(const char *lobby_id, const char *password, + const char *guest_bind); + +int psx_lobby_leave(void); + +/* ---- spectators -------------------------------------------------------- + * + * A gallery seat runs the match locally, in sync, and contributes nothing. + * The lobby server enforces the "contributes nothing" half at its UDP relay; + * this side enforces the rest -- no Ready vote, no controller reaching the sim. + * + * Every one of these reads 0 against a server that predates spectators, so a + * caller that gates its UI on allow_spectators degrades to the old lobby. */ + +/* Host: open a gallery on the NEXT create. Sticky, like the max_slots + * default -- create carries whatever this was last set to. */ +void psx_lobby_set_allow_spectators(int allow); +/* What the toggle is set to, for the UI to render: what the host ASKED for. */ +int psx_lobby_allow_spectators_pref(void); +/* What the current lobby actually has (server-echoed), not what was asked. + * These disagree whenever the server predates spectators -- exactly the case + * the UI must not offer a gallery in. */ +int psx_lobby_allow_spectators(void); +int psx_lobby_max_spectators(void); +int psx_lobby_spectator_count(void); +/* 1 when THIS client is in the gallery. The one call the engine needs. */ +int psx_lobby_local_is_spectator(void); +/* Base of the gallery half of the seat namespace, as the server reports it. */ +int psx_lobby_spectator_slot_base(void); +/* Seat index for gallery position `index`, for move / kick; <0 out of range. */ +int psx_lobby_spectator_slot(int index); +/* This client's slot in the RELAY's namespace, for RNetConfig.wire_slot. + * -1 when not a spectator or the server published no relay base -- and a + * spectator without one must not launch, because sending as a player slot is + * exactly what it must not do. */ +int psx_lobby_local_wire_slot(void); +/* 1 when `slot` addresses a seat in either table -- the shared guard the + * kick / move entry points use, so a gallery index is not rejected as if it + * were out of range. */ +int psx_lobby_seat_valid(int slot); + +/* Host-only: remove the player in `slot` (not the host / self). */ +int psx_lobby_kick(int slot); + +/* Host-only: swap/move a seated player between slots (server broadcasts update). */ +int psx_lobby_move_member(int from_slot, int to_slot); + +int psx_lobby_in_lobby(void); +int psx_lobby_is_host(void); +/* Host's player_id from the last create/lobby_update (empty if unknown). */ +const char *psx_lobby_host_player_id(void); +/* Filled after create/join/lobby_update; peer endpoints for PsxNetplayConfig. */ +const PsxLobbyJoinInfo *psx_lobby_join_info(void); + +/* Latest host match_caps (valid==0 until create/join/launch delivers one). */ +const PsxLobbyMatchCaps *psx_lobby_match_caps(void); + +/* Host: push updated caps while in lobby (clears ready via lobby_update). */ +int psx_lobby_set_match_caps(const PsxLobbyMatchCaps *caps); + +/* Host relay (recomp_net/host_relay.h), driven from psx_lobby_pump while + * seated online in a room whose caps ask for it: the host holds the game port + * (UPnP / NAT-PMP / STUN), advertises it with set_host_endpoint and answers + * probes; guests probe it and send path_report. The pref is the HOST's + * default for rooms it creates (recomp-ui owns the setting; default on). */ +void psx_lobby_set_relay_host_pref(int on); +int psx_lobby_relay_host_pref(void); +struct RNetHostRelayStatus; +int psx_lobby_host_relay_status(struct RNetHostRelayStatus *out); +void psx_lobby_host_relay_release_port(void); + +/* Live member table from lobby_update (and create/join). */ +int psx_lobby_member_count(void); +int psx_lobby_member_get(int index, PsxLobbyMember *out); + +/* Waiting-room RTT in ms *to* `slot`, or -1 if unknown / local seat. + * Prefers ICE/TURN data-channel RTT when the lobby probe completes + * (CGNAT / Force TURN); else direct UDP rnet_rtt_probe. Stored as + * max(local, peer REPORT) so an optimistic guest sample cannot undercut + * delay. Not the lobby WebSocket RTT. */ +int psx_lobby_member_latency_ms(int slot); + +/* True when member.player_id matches psx_lobby_host_player_id(). + * Prefer this over `slot == 0` — seats can move. */ +int psx_lobby_member_is_host(const PsxLobbyMember *member); + +/* + * ICE signaling relay (MotK WS op:signal). text is SDP/candidate (max 2047). + * send returns 0 if queued/written; poll returns 1 when an inbound signal was + * copied out (LOCAL_* types as emitted by the peer — remap to REMOTE_* before + * rnet_session_push_signal). + */ +int psx_lobby_send_signal(int type, int flag, const char *text); +int psx_lobby_poll_signal(int *type, int *flag, char *text, size_t text_cap); +/* Drop queued ICE SDP/candidates (soft-return / rematch hygiene). */ +void psx_lobby_clear_signals(void); +/* When 0, inbound ICE op:signal is discarded (lobby / post-match). Launch + * re-enables so early peer offers are kept until netplay drains them. */ +void psx_lobby_set_ice_signal_accept(int accept); + +/* + * Coturn / ICE credentials minted by the WS lobby + * (`get_turn_credentials` → `turn_credentials`). Valid until disconnect or TTL. + * Strings are stable until the next successful mint or disconnect — safe to + * pass into RNetIceConfig for juice_create. + */ +typedef struct PsxLobbyTurnCredentials { + int valid; /* 1 when ok mint cached and not expired */ + char stun_host[128]; + int stun_port; + char turn_host[128]; + int turn_port; + char username[192]; + char password[128]; + uint32_t ttl_secs; +} PsxLobbyTurnCredentials; + +/* Queue WS get_turn_credentials. Returns 0 if sent/queued. */ +int psx_lobby_request_turn_credentials(void); +/* Non-NULL; valid==0 when unavailable / expired / STUN-only. */ +const PsxLobbyTurnCredentials *psx_lobby_turn_credentials(void); + +/* Local ready flag (from last lobby_update matching our player_id). */ +int psx_lobby_local_ready(void); +/* True when every seated player is ready and player_count >= 2. */ +int psx_lobby_all_ready(void); + +/* Toggle ready in the current lobby (attaches current bios_offer). */ +int psx_lobby_set_ready(int ready); +/* The set_ready / start messages exactly as this client sends them (into msg, + * 0 = ok). The Retro hub forwards them verbatim for a seat it holds. */ +int psx_lobby_ready_message(int ready, char *msg, size_t cap); +int psx_lobby_start_message(const PsxLobbyMatchCaps *caps, char *msg, size_t cap); +/* A match the Retro hub negotiated (retcomm-launcher docs/NETPLAY_HANDOFF.md). + * replay_room adopts the record's identity, seat and room messages as if they + * had arrived on this client's socket; ingest_record also adopts its launch, + * after which launch_pending, join_info and match_caps answer as for an + * in-game match. 0 = adopted; else `why` says why. handoff_active: 1 once a + * record was ingested (the match ends the process, not back into a lobby). */ +int psx_lobby_replay_room(const char *record, char *why, size_t why_cap); +int psx_lobby_ingest_record(const char *record, char *why, size_t why_cap); +int psx_lobby_handoff_active(void); +/* A string field of a JSON object (the client's own reader); 1 = found. */ +int psx_lobby_json_str(const char *json, const char *key, char *out, size_t cap); + +/* Local BIOS offer used on the next set_ready (and included in settle). */ +void psx_lobby_set_bios_offer(const PsxLobbyBiosOffer *offer); +const PsxLobbyBiosOffer *psx_lobby_bios_offer(void); +/* Local memory-card offer (attached to set_ready alongside bios_offer). */ +void psx_lobby_set_memcard_offer(const PsxLobbyMemcardOffer *offer); +const PsxLobbyMemcardOffer *psx_lobby_memcard_offer(void); + +/* Seat self-service (server ops seat_move / seat_swap_request / + * seat_swap_answer). A player may move itself to a FREE player seat; taking + * an occupied one asks its occupant, who answers from the prompt. + * seat_move_self(to) : 0 queued; a refusal comes back as a lobby error + * seat_swap_request(to) : 0 queued; outgoing() then reports the answer + * seat_swap_incoming : 1 while somebody is asking THIS player + * seat_swap_respond(ok) : answer (and drop) the incoming ask + * seat_swap_outgoing : 0 idle, 1 waiting, 2 accepted, -1 declined + * seat_swap_clear : back to idle after showing a finished result */ +int psx_lobby_seat_move_self(int to_slot); +int psx_lobby_seat_swap_request(int target_slot); +int psx_lobby_seat_swap_incoming(char *who, size_t who_cap, int *from_slot); +int psx_lobby_seat_swap_respond(int accept); +int psx_lobby_seat_swap_outgoing(void); +void psx_lobby_seat_swap_clear(void); + +/* Lobby chat. send: 0 when queued (the line appears via the server echo). + * count/get read the ring, oldest first; cleared on create/join/leave. */ +/* Report chat lines for moderation. Same contract on every console -- the + * frame is built by recomp-net (recomp_net/chat_report.h), which is also where + * the RNET_REPORT_* categories live; this only says where we are and sends it. + * + * `mids` are PsxLobbyChatMsg.mid values, several at once because harassment is + * usually a burst rather than a line. Entries with an empty id are skipped. + * The text is never sent: see PsxLobbyChatMsg.mid. + * + * 0 when handed to the server, which is not the same as accepted -- it refuses + * an expired line, a guest's line, your own, and anything over the rate + * limit. */ +int psx_lobby_report_chat(const char *const *mids, int mid_count, + const char *reason, const char *note); + +int psx_lobby_send_chat(const char *text); + +/* Server chat: per-game, outside any room (op server_chat). Its own ring, + * cleared on disconnect; lines are masked on arrival like lobby chat. */ +int psx_lobby_send_server_chat(const char *text); +int psx_lobby_server_chat_count(void); +int psx_lobby_server_chat_get(int index, PsxLobbyChatMsg *out); +int psx_lobby_chat_count(void); +int psx_lobby_chat_get(int index, PsxLobbyChatMsg *out); +void psx_lobby_chat_clear(void); + +/* + * Settle session BIOS from seated peers' bios_offer (+ local offer), by the + * rule in netplay_bios_settle.h: retail only when every seat offers the same + * retail image CRC; else OpenBIOS when every seat links it. + * Returns 0 and writes "openbios" or "scph1001" into out (and the retail CRC + * into *out_crc, 0 for OpenBIOS). Returns 1 when no BIOS suits every seat: + * out is "", and why (when non-NULL) says which images differ; the host must + * not start. Returns -1 on bad arguments. + */ +int psx_lobby_settle_session_bios(char *out, size_t out_cap, uint32_t *out_crc, + char *why, size_t why_cap); + +/* + * Put one sentence on the launcher's status line (through last_error, which + * the launcher shows as "Lobby error: "). NULL or "" clears it. + */ +void psx_lobby_set_last_error(const char *text); + +/* + * Host: ask server to broadcast launch. When match_caps is non-NULL and valid, + * it is attached to start so launch freezes the latest host settings. + */ +int psx_lobby_request_start(const PsxLobbyMatchCaps *match_caps); + +/* + * Set when server sends op:launch. Both host and guests should boot netplay. + * Cleared by psx_lobby_clear_launch_pending() after consuming. + */ +int psx_lobby_launch_pending(void); +void psx_lobby_clear_launch_pending(void); + +/* After soft-return / rematch: allow waiting-room ICE/UDP RTT probes again. + * Launch suspends them so they cannot steal match ICE signaling. */ +void psx_lobby_resume_waiting_room_rtt(void); + +/* + * Tell the server which accounts this player has blocked. + * + * ';'-separated opaque account ids, replacing the whole set -- the client's + * own file (recomp-ui moderation.ini) is the authority, so an unblock needs + * no separate op. NULL/"" clears. + * + * Sent to the SERVER rather than applied only here, because two of the three + * things a block has to do cannot be done from this side: the matchmaker must + * not pair the two, and the blocked player must not see or be able to join + * the blocker's room. A client can hide what it was sent; it cannot know it + * was blocked by somebody else, and that is the direction that matters. + * + * The server holds the list for the life of a connection and never persists + * it; recomp-ui re-sends it on every reconnect. + */ +int psx_lobby_set_blocks(const char *accounts); + +/* -- Automatch -------------------------------------------------------------- + * + * Server-run pairing: the player asks for a match and the SERVER creates the + * room, is its host, and owns its match_caps from a named ruleset. Protocol: + * recomp-net-server docs/AUTOMATCH.md. Everything downstream of the pairing + * is the ordinary `joined` / `lobby_update` / `launch` path already in this + * file, so this adds a queue and an accept gate and nothing else. + * + * Requires a signed-in account: the accept gate charges a dodge cooldown, and + * a cost that reconnecting erases is not a cost. + * + * Same shape as the SNES client (snes_lobby_client.h), on purpose: the host + * adapter in main.cpp is then a one-line translation per entry point. + */ +#define PSX_LOBBY_MAX_RULESETS 8 +#define PSX_LOBBY_RULESET_ID_LEN 48 +#define PSX_LOBBY_RULESET_LABEL_LEN 64 +#define PSX_LOBBY_CAPS_SUMMARY_LEN 128 + +/* One queue type this server offers for this title. */ +typedef struct PsxLobbyRuleset { + char id[PSX_LOBBY_RULESET_ID_LEN]; + char label[PSX_LOBBY_RULESET_LABEL_LEN]; + /* Server-derived one-liner ("Delay 2 - Rollback on"). Derived from the + * caps rather than authored, so it cannot drift from what the match + * runs. The caps themselves arrive with `joined` like any host's. */ + char caps_summary[PSX_LOBBY_CAPS_SUMMARY_LEN]; + /* Empty = any release may queue (still only pooling with its own). */ + char game_version[PSX_LOBBY_VERSION_LEN]; + int max_slots; +} PsxLobbyRuleset; + +/* Matches RECOMP_LAUNCHER_AUTOMATCH_* so the host layer can hand these + * straight to the launcher without a translation table that could drift. */ +enum { + PSX_LOBBY_AUTOMATCH_IDLE = 0, + PSX_LOBBY_AUTOMATCH_QUEUED = 1, + PSX_LOBBY_AUTOMATCH_FOUND = 2, + PSX_LOBBY_AUTOMATCH_ACCEPTED = 3, + PSX_LOBBY_AUTOMATCH_FAILED = 4 +}; + +/* The offer on the table while state is FOUND. */ +typedef struct PsxLobbyAutomatchFound { + char opponent[PSX_LOBBY_NAME_LEN]; + /* Discord @username: display names are not unique, so this is the + * disambiguator. "" when the server did not say. */ + char opponent_username[PSX_LOBBY_NAME_LEN]; + char opponent_country[4]; + char ruleset_id[PSX_LOBBY_RULESET_ID_LEN]; + char ruleset_label[PSX_LOBBY_RULESET_LABEL_LEN]; + int est_rtt_ms; /* the pair's estimate: rtt_a + rtt_b; <0 unknown */ + int accept_secs; /* seconds left to answer, recomputed per read */ +} PsxLobbyAutomatchFound; + +/* Ask the server what queues it offers for this title. Answered into + * psx_lobby_automatch_ruleset_count/get; 0 of them means automatch is off + * here. Refuses to re-send while one is outstanding. */ +int psx_lobby_automatch_request_rulesets(void); +/* 1 once the server has answered with at least one ruleset. Not having + * asked yet is "no": the button must not be offered on an assumption. */ +int psx_lobby_automatch_available(void); +int psx_lobby_automatch_ruleset_count(void); +int psx_lobby_automatch_ruleset_get(int index, PsxLobbyRuleset *out); + +/* + * Join the queue. `ruleset_id` NULL/"" takes the first one. + * + * `mods_enabled` is the caller's assertion that a SIM-AFFECTING mod feature is + * on locally, beyond whatever the ruleset itself imposes. The server refuses a + * true with mods_not_pooled and cannot check it -- the assertion exists so a + * modified client makes a deliberate false statement rather than exploiting + * an omission (AUTOMATCH.md 5). The host layer decides it; this file only + * carries it. `mod_exempt` is ';'-separated evidence for cosmetic exemptions + * (NULL or "" = none), sent as a JSON array for the server to check. + * + * 0 = sent. <0 = refused locally (not connected, no fingerprint, already + * queued). A server refusal arrives asynchronously as state FAILED with a + * reason in psx_lobby_automatch_error(). + */ +int psx_lobby_automatch_queue(const char *ruleset_id, int mods_enabled, + const char *mod_exempt); +int psx_lobby_automatch_cancel(void); +int psx_lobby_automatch_state(void); +int psx_lobby_automatch_queued_secs(void); +int psx_lobby_automatch_pool(void); +int psx_lobby_automatch_found_get(PsxLobbyAutomatchFound *out); +/* accept != 0 accepts; 0 declines and takes the dodge strike. */ +int psx_lobby_automatch_accept(int accept); +/* + * Non-zero while the room this client is seated in was created by AUTOMATCH. + * + * A human-hosted room is somebody's room: it survives the match, and staying + * seated is how a rematch happens. An automatch room is the server's, it is + * created at both-accept and is not joinable by anyone, and there is no host + * to rematch with -- so staying in it leaves the player parked in a room that + * can never fill, and the server refuses their next ticket with + * `already_in_lobby`. Cleared by leaving, and by anything else that ends the + * seating. + */ +int psx_lobby_automatch_room(void); +/* Refuse a queue locally, with the reason the player sees. For when the HOST + * already knows the server would bounce the ticket. */ +void psx_lobby_automatch_refuse_local(const char *why); +const char *psx_lobby_automatch_error(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_LOBBY_CLIENT_H */ diff --git a/overlay_toolchain/include/psx_memory.h b/overlay_toolchain/include/psx_memory.h new file mode 100644 index 00000000..07c9a7ae --- /dev/null +++ b/overlay_toolchain/include/psx_memory.h @@ -0,0 +1,101 @@ +#ifndef PSXRECOMP_PSX_MEMORY_H +#define PSXRECOMP_PSX_MEMORY_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* One main-RAM geometry contract for every runtime subsystem. + * + * Retail DRAM is 2 MiB, mirrored four times across the 8 MiB decode window + * (physical 0x00000000-0x007FFFFF of every segment). The opt-in 8 MB main RAM + * enhancement (builtin mod psx.enhancement.8mb-ram) switches the LIVE geometry + * to unique decoding of the whole window before memory_init(); with the mod + * off the live geometry is retail and every helper below folds exactly as + * retail hardware does. The geometry is one mask, latched once per boot: the + * retail fold is `phys & 0x1FFFFF`, the expanded map `phys & 0x7FFFFF`. + * + * Two identities, never mixed: + * BYTES -- where an address's data lives: psx_ram_map_read / + * psx_ram_canonical_offset / psx_ram_resolve fold through the live mask. + * Every RAM access, DMA cursor, dirty/watch page and code-range CRC uses it. + * CODE -- which compiled body may run at a PC: the segment-stripped address + * (addr & 0x1FFFFFFF), NEVER mirror-folded. A compiled function bakes its + * own PCs into $ra/EPC/branch targets, so running the body compiled for + * 0x80180000 at a 0x80780000 PC would hand the guest a different $ra than + * hardware does. Architectural state (PC, $ra, EPC) is never folded; a PC + * in a retail mirror executes the folded bytes with its own address. + * (One pre-existing exception is kept bit-identical: the BIOS dispatch + * table's emitted normalize() still folds retail mirrors onto its RAM + * keys, via `& g_psx_ram_mask`; the 8 MB map does not fold.) + * + * Host storage indexed by a RAM offset is sized with PSX_MAIN_RAM_BACKING_BYTES + * (the largest geometry); bounds that describe the guest-visible RAM use the + * live size (psx_ram_live_bytes()). Serialized/digested RAM state covers the + * live size only, so retail savestates and netplay digests are unchanged. */ +#define PSX_MAIN_RAM_RETAIL_BYTES 0x00200000u +#define PSX_MAIN_RAM_EXPANDED_BYTES 0x00800000u +#define PSX_MAIN_RAM_WINDOW_BYTES 0x00800000u +#define PSX_MAIN_RAM_BACKING_BYTES PSX_MAIN_RAM_EXPANDED_BYTES + +/* Live geometry (psx_ram_geometry.c). Retail until a trusted activation plugin + * requests expanded RAM (psx_mod_set_main_ram_8mb) and memory_init() applies + * it. g_psx_ram_mask == g_psx_ram_size - 1 always. */ +extern uint32_t g_psx_ram_size; +extern uint32_t g_psx_ram_mask; + +uint32_t memory_get_ram_bytes(void); +int psx_ram_8mb_active(void); +void psx_ram_reset_size_request(void); +/* memory_init(): latch the requested geometry for this boot. */ +void psx_ram_apply_size_request(void); + +static inline uint32_t psx_ram_live_bytes(void) { return g_psx_ram_size; } + +/* BYTE offset of a physical address. Inside the decode window it folds through + * the live mask; addresses at/above the window are returned unchanged (not + * RAM), so callers may pass any physical address. */ +static inline uint32_t psx_ram_map_read(uint32_t phys) { + phys &= 0x1FFFFFFFu; + return phys < PSX_MAIN_RAM_WINDOW_BYTES ? (phys & g_psx_ram_mask) : phys; +} + +static inline uint32_t psx_ram_map_write(uint32_t phys) { + return psx_ram_map_read(phys); +} + +/* Strip KUSEG/KSEG0/KSEG1 and fold within the 8 MiB DRAM decode window through + * the live mask. Bits above the window are ignored (DMAC-style 24-bit keys). */ +static inline uint32_t psx_ram_canonical_offset(uint32_t address) { + return address & (PSX_MAIN_RAM_WINDOW_BYTES - 1u) & g_psx_ram_mask; +} + +/* Resolve [address, address+width) to a live RAM offset. Fails for anything + * outside the decode window, zero width, or a span past the live RAM end + * (retail: a span crossing a 2 MiB mirror boundary has no contiguous bytes). */ +static inline int psx_ram_resolve(uint32_t address, uint32_t width, + uint32_t *offset) { + const uint32_t phys = address & 0x1FFFFFFFu; + uint32_t off; + if (phys >= PSX_MAIN_RAM_WINDOW_BYTES || width == 0u) return 0; + off = phys & g_psx_ram_mask; + if (width > g_psx_ram_size - off) return 0; + if (offset) *offset = off; + return 1; +} + +/* Stores made by the host rather than the guest CPU (mods, FMV skip, debug + * pokes, enhancement fills). They take the psx_write_* path but are never + * cache-isolated: while SR.IsC is set they still reach memory, as DMA does, + * instead of acting on the caches as a CPU store would (memory.c isc_store). */ +void psx_host_write_word(uint32_t addr, uint32_t val); +void psx_host_write_half(uint32_t addr, uint16_t val); +void psx_host_write_byte(uint32_t addr, uint8_t val); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/psx_netplay.h b/overlay_toolchain/include/psx_netplay.h new file mode 100644 index 00000000..124d4542 --- /dev/null +++ b/overlay_toolchain/include/psx_netplay.h @@ -0,0 +1,330 @@ +#ifndef PSX_NETPLAY_H +#define PSX_NETPLAY_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Delay-sync netplay facade over recomp-net (LAN UDP or MotK ICE). + * Online hosted lobbies use ICE + WS signaling; Direct IP / LAN stay on UDP. + * + * Lockstep contract (matches recomp-net host_integration.md): + * wait_admit (publish pads for tick T) → guest runs frame T → + * finish_frame (advance) → wait_admit for T+1 → … + * Guest must NOT run while linking or while try_admit fails. + * + * Input ownership: + * - Each peer stages one local device sample; recomp-net maps it onto + * that peer's local_slot (slot 0 = sim P1, slot 1 = sim P2). Transport + * host/client role is determined by peer_hostport, not by local_slot. + * - input_player selects which host PlayerInput to sample; -1 = auto + * (prefer g_players[local_slot] if assigned, else player 0). + * - While active, publish / release_pads is the sole SIO writer. + * - Every session slot stays plugged for in-game N-player detect. + * - slot_count >= 3 enables SCPH-1070 multitap (sio_set_multitap). + * + * Pad blob (8 bytes): + * [0..1] buttons LE u16 (PSX active-low) + * [2] lx [3] ly [4] rx [5] ry + * [6] analog (0/1) + * [7] connected (always 1) + */ + +#define PSX_NETPLAY_PAD_BYTES 8 + +typedef struct PsxNetPad { + uint16_t buttons; + uint8_t lx, ly, rx, ry; + uint8_t analog; + uint8_t connected; +} PsxNetPad; + +typedef struct PsxNetplayConfig { + int enabled; + int local_slot; /* 0 .. slot_count-1 */ + /* 1 = spectator: simulate the match, display it, contribute nothing. + * The session owns no seat (RNetConfig.local_slot == slot_count) and is + * never sampled for input, so the local pads never enter the pipeline at + * all -- the only version of "cannot affect the game" that survives a + * spectator with a controller in their hands. */ + int spectator; + /* Spectator only: slot in the input relay's namespace, at or above the + * relay's player count. Required when spectator is set; it is what makes + * the relay refuse to forward anything this peer sends. */ + int spectator_wire_slot; + /* 1 = the host watches from the gallery: it is still session slot 0 + * (the seat every host-only path keys on) but its pad is muted and no + * controller port is mapped to it; session slot s >= 1 drives pad + * port s - 1. slot_count then includes the host's silent slot, so it + * may reach PSX_MAX_PLAYERS + 1. Env PSX_NET_HOST_SPECTATES=1. */ + int host_spectates; + /* Session slot -> controller port (-1 = none), when port_map_valid. The + * lobby host is always session slot 0 whatever seat it holds; the other + * players follow in seat order and drive the port of their lobby seat. + * Without it: identity, or slot - 1 with host_spectates. */ + int port_map_valid; + int port_of_slot[9]; + int slot_count; /* 2 .. PSX_MAX_PLAYERS (+1 with host_spectates) */ + int player_count; /* seated players at launch (0 = use slot_count) */ + /* Bit i = lobby seat i occupied. 0 = all seats occupied (legacy). Sparse + * rooms (moved seats leaving a hole) must set this so recomp-net does not + * wait forever on empty remotes. */ + uint32_t occupied_mask; + int input_player; /* host device index; -1 = auto */ + int input_delay; + /* Rollback invent runway (phase_lock / P). Clamped 2..16. Unused in delay-sync. */ + int input_prediction; + int force_input_relay; /* 1 = lobby UDP SFU star (from launch) */ + /* 1 = the launch said transport "host": an online room whose host + * carries the match on bind_hostport; guests dial peer_hostport. Takes + * the LAN / hub transport path, not the server-relay one. */ + int transport_host; + int force_turn; /* 1 = ICE relay-only (Force TURN for UDP) */ + /* 0 = auto (MotK room → ICE, else LAN), 1 = force ICE, 2 = force LAN. + * Env PSX_NET_TRANSPORT=lan|ice overrides. */ + int transport; + /* 0 = delay-sync, 1 = rollback invent/contract (lobby default on). + * Env PSX_NET_MODE=delay|rollback overrides. */ + int rollback; + /* 1 = seat 1 brings its own memory card: before the host's card broadcast, + * seat 1 uploads its LOCAL slot-1 card to the host, which installs it as + * the match's slot-2 card; every peer then receives it in the usual SRAM + * blob. Both the host's real slot-2 card and seat 1's real cards are + * left untouched (host sandboxes slot 2; guests already sandbox both). + * Must be identical on every peer (the lobby decides it at start). + * Env PSX_NET_GUEST_MEMCARD=1 overrides. */ + int guest_memcard; + uint32_t session_id; + char bind_hostport[64]; + char peer_hostport[64]; +} PsxNetplayConfig; + +void psx_netplay_config_defaults(PsxNetplayConfig *cfg); +void psx_netplay_apply_env(PsxNetplayConfig *cfg); + +int psx_netplay_active(void); +int psx_netplay_is_running(void); +/* "ice" | "lan" | "none" */ +const char *psx_netplay_transport_name(void); +/* 1 when ICE agent reached FAILED (online path). */ +int psx_netplay_ice_failed(void); +/* Optional JSONL samples when PSX_NET_DIAG=1 (saves/netplay/net_diag.jsonl). */ +void psx_netplay_diag_tick(void); +int psx_netplay_local_slot(void); +/* 1 while this build is watching rather than playing. */ +int psx_netplay_is_spectator(void); +/* 1 when the local peer is the host running the match from the gallery. */ +int psx_netplay_host_spectates(void); +/* Resolved host player index used for local capture. */ +int psx_netplay_input_player(void); +uint32_t psx_netplay_sim_tick(void); + +/* + * Snapshot for diagnostic dumps (starvation_dump.jsonl meta, etc.). + * arch_out: "off" | "p2p" | "host_relay" | "server_relay" (never NULL when + * arch_cap > 0). Returns 1 when netplay is/was configured this run. + */ +int psx_netplay_diag_snapshot(char *arch_out, size_t arch_cap, + int *max_players_out, int *player_count_out); + +int psx_netplay_start(const PsxNetplayConfig *cfg); +void psx_netplay_shutdown(void); +/* Soft-return rematch / new lobby opponent: make host sim state match a cold + * process peer. Call from session_reboot (rematch) and after BYE teardown. + * Does not replace device *_init — orchestrates sticky host statics. */ +void psx_netplay_cold_reset(void); + +/* + * After savestate_configure + memcard_init: refresh RB integrity keys from + * savestate (host + guest — start() ran before configure), then guest-only + * redirect .pst/.mcd writes to saves/netplay/ so host sync never touches + * personal saves. + */ +void psx_netplay_bind_guest_saves(void); + +/* 1 if this peer is sim authority (local_slot == 0). */ +int psx_netplay_is_host(void); + +/* + * Host-only save/load orchestration (hash probe → transfer on miss). + * Returns 1 if the request was accepted/ignored-as-guest, 0 if netplay inactive. + */ +int psx_netplay_request_save(int slot); +int psx_netplay_request_load(int slot); + +/* 1 while a save/load/memcard probe, chunk transfer, or post-load ready owns + * the clock (long admit timeout, no peer-silence kick, FPS suppressed). */ +int psx_netplay_in_load_barrier(void); + +/* 1 once after a staged netplay load apply failed (stale .pst / mismatch). + * Clears. Caller should soft-exit to lobby — do not keep waiting on the barrier. */ +int psx_netplay_consume_load_apply_failed(void); + +/* Stage local pad for the current sim tick. Ignored once that tick is latched. + * Always refreshes the live physical snapshot (see live_pad_buttons). */ +void psx_netplay_stage_local(const PsxNetPad *pad); + +/* PSX_RB_PAD_TRACE=1: host capture checkpoint (card / SDL Start / fallback). + * Call from capture_local_human_pad each sample; no-op when trace off. */ +void psx_netplay_pad_trace_dev(int card, int fallback, int sdl_start, + uint16_t buttons); + +/* + * Start cadence bisect (PSX_START_BISECT=1): every-sample pipeline log for + * offline vs online. Does not change debounce. Optional feature kills + * (one at a time) for Stage-3 isolation — see ROLLBACK_MOTK_HOOKUP.md. + * + * PSX_START_BISECT_NO_GC_UPDATE_IN_ADMIT=1 + * PSX_START_BISECT_NO_TIPHOLD_CAPTURE=1 + * PSX_START_BISECT_NO_CATCHUP=1 + * PSX_START_BISECT_NO_REPLAY_PRODUCE=1 + * PSX_START_BISECT_SPIN=1 — also log raw SDL on admit spins (dense) + */ +int psx_start_bisect_enabled(void); +int psx_start_bisect_no_gc_update_in_admit(void); +int psx_start_bisect_no_tiphold_capture(void); +int psx_start_bisect_no_catchup(void); +int psx_start_bisect_no_replay_produce(void); +int psx_start_bisect_spin_log(void); +/* path: SDL|cap|stage|tip|sio|spin — start bits are 1=pressed (active-low decoded). */ +void psx_start_bisect_log(const char *path, uint32_t sim, int sdl_start, + int cap_start, int deb_start, int sio_start, + int latched, int tip_hold, int resim); + +/* + * Start consumer bisect (PSX_START_CONSUMER=1): log the Start bit SIO presents + * to the guest each sim frame (offline present sample / online publish apply). + * Compare offline vs online timelines — not SDL. edge=↓|↑|- . + */ +int psx_start_consumer_enabled(void); +/* Offline: bump once per sample_pad_into_sio; returned value is the frame id. */ +uint32_t psx_start_consumer_offline_frame(void); +void psx_start_consumer_note(int slot, uint32_t sim, uint16_t buttons); + +/* 1 while linking or before this sim tick's local pad is latched. */ +int psx_netplay_needs_local_sample(void); + +/* Latest physical local buttons (0xFFFF idle). TipHold SAFETY/quiet must use + * this — staged/delay-ring peeks stay frozen while sim is invent-capped. */ +int psx_netplay_live_pad_buttons(uint16_t *out); + +/* 1 if INPUT_CONFIRM hash disagreement stalled the session. */ +int psx_netplay_input_desync(uint32_t *tick, uint32_t *local_hash, uint32_t *remote_hash); + +/* 1 if peer sent BYE or went silent for ~timeout_ms (default 1500). + * Pass 0 for BYE-only (load barrier / LINKING before HELLO). */ +int psx_netplay_peer_disconnected(uint32_t timeout_ms); + +/* Re-arm RUNNING silence clock after a pump (admit barrier entry). */ +void psx_netplay_touch_peer_liveness(void); + +/* RUNNING peer_disconnected timeout. 0 = BYE-only (early sim / boot tip wait / + * pcap_freeze — rematch dig0 can exceed 1.5s without INPUT). */ +uint32_t psx_netplay_running_liveness_timeout_ms(void); + +/* + * Ingress / lobby / INPUT retransmit without try_admit. Used while the + * delay-sync starvation latch holds for remote runway refill. + */ +void psx_netplay_pump(void); + +/* + * Pump + try_admit for the current sim tick. On success, publish has written + * SIO and a finish_frame() is owed after the guest completes that tick. + * Returns 1 if admitted, 0 if caller must keep polling (linking / wait). + * Does NOT advance the session clock. + * + * After sustained admit misses, latches starvation (pump-only) until + * remote_lead >= D for a few frames, then arms a recovery catch-up boost. + * Env: PSX_NET_STARVATION_ENTER_FRAMES, EXIT_FRAMES, EXIT_HR_LEAD. + */ +int psx_netplay_poll_admit(void); + +/* Call after the guest finishes the admitted tick (vblank boundary). */ +void psx_netplay_finish_frame(void); + +/* highest_remote_wire - sim_tick (0 if inactive; can be negative). */ +int psx_netplay_remote_lead(void); +/* Session input delay frames (default 2 when inactive). */ +int psx_netplay_input_delay(void); + +/* Clear timesync pegged-streak at episode/tip-hold boundaries so resim cost + * cannot look like WAN transit and trip adaptive-off (see §22). */ +void psx_netplay_timesync_on_episode_boundary(void); + +/* + * Extra headroom for post-starvation / behind-peer catch-up + * (min(16, max(0, remote_lead - D, recovery_burst))). + * Host should skip wall-clock pace while this is > 0, then call + * psx_netplay_catchup_consume_frame() once per skipped pace. + */ +int psx_netplay_catchup_budget(void); +void psx_netplay_catchup_consume_frame(void); + +/* Park the admit barrier until a peer datagram may be ready (or timeout). */ +void psx_netplay_wait_recv(int timeout_ms); + +/* Diagnostics for a stuck admit barrier (stall name, sim tick, remote lead). */ +void psx_netplay_admit_wait_info(char *stall_out, size_t stall_cap, + uint32_t *sim_tick_out, int *lead_out); + +/* Normalize sticks (deadzone → center) for stabler cross-device blobs. */ +void psx_netplay_normalize_pad(PsxNetPad *pad); + +void psx_netplay_release_pads(void); + +/* + * Bind the live CPUState for per-frame master digests (FRAME_COMMIT). + * Call once after CPU init (alongside debug_server_set_cpu). + */ +struct CPUState; +void psx_netplay_bind_cpu(struct CPUState *cpu); + +/* Highest sim tick whose master digest matched the peer (0 if none). */ +uint32_t psx_netplay_resolved_through(void); +/* 1 if peer master-hash watermark covers tick (hash_confirm_promote). */ +int psx_netplay_hash_confirm_through(uint32_t tick); + +/* 1 when PSX_NET_MODE=rollback (invent + input contract path). */ +int psx_netplay_rollback_mode(void); + +/* Safe BB-edge snap save/load (call beside savestate_poll when !in_exception). */ +void psx_netplay_poll_snap(struct CPUState *cpu, uint32_t resume_pc); +/* 1 while a rollback episode is resimulating (mute audio / skip wall pacer). */ +int psx_netplay_is_resimulating(void); + +/* §63: reset host pad-edge trackers after snap load (guest SIO restored). */ +void psx_netplay_on_rb_snap_loaded(void); + +/* §64: restart hc-fork persist/retry clocks after tip-extend abandon so a + * second recovery episode cannot open on the same Live tick. */ +void psx_netplay_hc_fork_recovery_restart(void); +/* §102: drop pending hc-fork bookkeeping (peer-ahead NACK already scheduled + * a light tip reopen — do not open a deep SPAN recovery). */ +void psx_netplay_hc_fork_recovery_clear(void); + +/* §93 P1 bisect: PSX_RB_CD_BISECT=1 (optional =LO-HI, default 150-250) logs + * per-tick CD/MDEC/clk crumbs + CD cmd ISSUE/QUEUE/DONE timeline (cdrom.c; + * includes stat/resp FIFO + GetTN tracks / GetTD td_lba). + * Arm N more ticks after a media flush_resume. */ +void psx_netplay_cd_bisect_arm(uint32_t from_sim, uint32_t ticks); +/* 1 when CD bisect env is on and sim is in the fixed or post-media arm window. */ +int psx_netplay_cd_bisect_active(void); + +/* Netplay GPU lock: CPU-authoritative VRAM (software raster) so snaps/digests + * are peer-identical. If OpenGL was requested, keep the GL context for + * present-only (CPU scanout → gl_renderer_present) — never glReadPixels. + * Sim is forced to internal scale 1 (no SW SSAA hi-res mirror); present may + * still upscale via GL/SDL filter. Vulkan still falls back to pure software + * present. Implemented in main.cpp. */ +void psx_frontend_netplay_force_sw_gpu(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_NETPLAY_H */ diff --git a/overlay_toolchain/include/psx_netplay_rb.h b/overlay_toolchain/include/psx_netplay_rb.h new file mode 100644 index 00000000..c08f7438 --- /dev/null +++ b/overlay_toolchain/include/psx_netplay_rb.h @@ -0,0 +1,264 @@ +#ifndef PSX_NETPLAY_RB_H +#define PSX_NETPLAY_RB_H + +/* + * MotK rollback episode + snap-ring host (PSX_NET_MODE=rollback). + * Delay-sync path never calls these. + */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct CPUState; +struct RNetSession; +/* Alias Rbe* — not `struct Netplay*`; that tag is a distinct incomplete type + * from `typedef RNetHashConfirm NetplayHashConfirm` in the MotK shims. */ +typedef struct RNetInputHist NetplayInputHist; +typedef struct RNetHashConfirm NetplayHashConfirm; + +typedef struct PsxNetplayRbBindings { + struct RNetSession **session; + struct CPUState **cpu; + NetplayInputHist *ih; + NetplayHashConfirm *hc; + uint32_t *bios_checksum; + uint32_t *entry_pc; + int *slot_count; + int *local_slot; + int *input_delay; + void (*publish_sio)(uint32_t tick); /* publish history or sealed rows to SIO */ + void (*apply_frame_slot)(int slot, uint32_t tick, uint16_t buttons, + int8_t sx, int8_t sy, uint8_t analog); +} PsxNetplayRbBindings; + +void psx_netplay_rb_bind(const PsxNetplayRbBindings *b); +void psx_netplay_rb_start(void); +void psx_netplay_rb_shutdown(void); +/* Soft-return / rematch: wipe RB host residue that rb_shutdown leaves + * (follow-NACK, tip-dense FIFO, episode wire, dig0 latch). Safe with no session. */ +void psx_netplay_rb_cold_reset(void); + +/* Safe BB-edge poll (mirror savestate_poll). Saves pending snap / applies load + * without longjmp. Call psx_netplay_rb_flush_resume() afterward from a C BB-edge + * (or after all C++ RAII in the vblank path has been destroyed). */ +void psx_netplay_rb_poll(struct CPUState *cpu, uint32_t resume_pc); + +/* If a baseline snap was applied without resume, longjmp to the scheduler + * (same as savestate_poll). No-op when nothing is pending. Never returns on + * success. */ +void psx_netplay_rb_flush_resume(void); + +/* 1 after flush_resume longjmp until finish_frame / abort — top-level + * dispatch has no native call chain under the resume PC. */ +int psx_netplay_rb_top_level_resume_active(void); + +/* After outermost psx_dispatch returns pc==0 following an RB resume: retry + * at $ra / sticky BB if safe. Returns 1 and arms RESUME_CURRENT via out_pc. */ +int psx_netplay_rb_recover_null_pc(struct CPUState *cpu, uint32_t *out_pc); + +/* After a live tick completes: request snap at tick for next safe poll. */ +void psx_netplay_rb_request_snap(uint32_t tick); + +/* Initiator: start episode from invent/contract rewind. + * Returns 1 if an episode opened, 0 if refused (no snap, already active, + * abort/storm cooldown, FMV lockstep, …). On refuse, reconcile should promote + * wire (or tip-extend if active). Clean commit does not arm cooldown. */ +int psx_netplay_rb_begin_rewind(uint32_t mismatch_tick, int slot); + +/* Active episode: grow target / resign sealed rows for a late wire edge + * (press+release coalesce). Host must promote wire into hist first. + * Returns 1 if the correction was absorbed into the current episode. */ +int psx_netplay_rb_tip_extend(uint32_t mismatch_tick, int slot); + +/* 1 while begin_rewind is suppressed (cooldown after abort / realign). */ +int psx_netplay_rb_rewind_suppressed(void); + +/* 1 during depth24 / recent MDEC / short post-FMV settle — MotK FMV. + * Post-FMV digest lockstep no longer blocks invent (§26). */ +int psx_netplay_rb_fmv_defer_rewind(void); + +/* 1 while depth24 or recent MDEC (not settle). */ +int psx_netplay_rb_fmv_media_active(void); + +/* 1 during FMV media + post-FMV lockstep MIN (§26/§113) — admit waits for + * remote wire through loading tip+1 (not settle-only). Ticks FMV→settle→MIN. + * Also 1 while §93 MAX-unmatched DESYNC invent-hold is armed (expires). + * §111: post-FMV heal sticky invent-hold only while remote_lead > 0. */ +int psx_netplay_rb_lockstep_no_invent(void); + +/* 1 while sim is still inside the short post-FMV settle tail (before MIN). */ +int psx_netplay_rb_fmv_settle_active(void); + +/* §93/§94: 1 while MAX-unmatched DESYNC invent-hold is armed (not media/settle). + * Stall tag should say fmv_desync_hold, not fmv_settle. */ +int psx_netplay_rb_fmv_desync_hold(void); + +/* §94: drop invent-hold after a successful netplay SAVE (tip hole refill) or + * when the hold expires. Episode media-range refuse is unchanged. */ +void psx_netplay_rb_clear_fmv_desync_hold(const char *why); + +/* §109: next begin_rewind is an apply-only MEDIA_KF heal (target=load). + * Call from hc-fork / resim-diverge escalate before begin_rewind. + * §114: tip+1 verify-span abandoned (platform nondet); heal Live arms + * invent-off + KF stream instead of lockstep RELEASE. */ +void psx_netplay_rb_request_post_fmv_heal_kf(void); + +/* §110: 1 while post-FMV lockstep, DESYNC hold, or heal sticky — hc-fork + * may open apply-only KF even when invent is held. */ +int psx_netplay_rb_post_fmv_heal_eligible(void); + +/* §111: 1 while heal sticky window is live (invent hold may be tip-lead only). */ +int psx_netplay_rb_post_fmv_heal_sticky(void); + +/* §115: 1 if this tip+1 fork was accepted (HC primed past it) — hc-fork / + * begin must not re-open apply-only heal for it. */ +int psx_netplay_rb_platform_fork_accepted(uint32_t fork_tick); + +/* §93: 1 if tick sits in the last FMV media bout / settle tail (or DESYNC + * hold). Begin/follow/hc-fork must not open episodes that load there. + * §97 MEDIA_KF (default on): returns 0 for media-range — episodes allowed. */ +int psx_netplay_rb_fmv_episode_unsafe(uint32_t tick); + +/* §97: guest probe reply — 1 if local snap at episode load matches size/crc. */ +int psx_netplay_rb_media_kf_probe_match(uint32_t size, uint32_t crc); +/* §97: apply RB_KF state blob (or host finish). Returns 1 if handled. */ +int psx_netplay_rb_media_kf_on_ready(const void *data, size_t size); +/* §100: 1 while a MEDIA-KF episode is waiting on probe/transfer/pin (sim + * stalled — present should hold-last so the intro FMV does not freeze). */ +int psx_netplay_rb_media_kf_busy(void); + +/* Mid-guest resim pump: abort if Replay has made no finish_frame progress. + * Full rb_pump stays admit/present-edge only (host-asymmetric). */ +void psx_netplay_rb_poll_replay_stall(void); + +/* 1 once after abort/realign cooldown arm — reconcile should promote all late + * wire without opening another episode (clears invent poison). */ +int psx_netplay_rb_take_promote_sweep(void); + +/* 1 after FMV lockstep RELEASE while sim < dense_until (UNLOCK_GRACE). + * Invent is already allowed (§26); reconcile should soft-promote invent→ + * release mispredicts here so sticky hold-last D-pad does not open tip + * episodes into the title/menu. */ +int psx_netplay_rb_fmv_unlock_grace_active(void); + +/* Drain peer RB_* + drive Seal/Baseline/Replay/Verify. Call from pump. */ +void psx_netplay_rb_pump(void); + +/* 1 while Live should not leave dig0: local dig0 not published yet, or peer + * dig0 not received. Latches open once both digests match (sticky latches — + * HC ring may age tick-0 out; must not re-stall after sync). */ +int psx_netplay_rb_boot_dig0_gate(void); +/* psx_host_mono_ms() since when the peers' boot digests have been known and + * different (the same pair throughout), or 0. The watchdog ends the match once + * that has lasted NETPLAY_BOOT_MISMATCH_GRACE_MS: the peers booted different + * BIOS images or boot settings, and waiting cannot fix it. */ +uint32_t psx_netplay_rb_boot_dig0_mismatch_since_ms(void); +/* Record dig0 cores outside the HC ring (emit / peer FC drain). */ +void psx_netplay_rb_boot_dig0_note_local(uint32_t core); +void psx_netplay_rb_boot_dig0_note_peer(uint32_t core); + +/* 1 while episode is active (seal/baseline/replay/verify). */ +int psx_netplay_rb_active(void); +int psx_netplay_rb_is_resimulating(void); +int psx_netplay_rb_tip_holding(void); + +/* Episode tip (target_tick) while an episode is active; 0 if none. */ +uint32_t psx_netplay_rb_episode_target(void); + +/* TipHold Live invent slack past tip (tip_seal_slack). Stall invent beyond. + * Returns 0 while a deferred tip-hold rereplay is pending (§80 park Live). */ +uint32_t psx_netplay_rb_tip_hold_invent_slack(void); + +/* 1 while TipHold has batched tip-extend rereplay waiting for flush (§66/§80). */ +int psx_netplay_rb_tip_hold_rereplay_pending(void); + +/* POST tip we deferred from (0 if none). Admit parks Live here (§81). */ +uint32_t psx_netplay_rb_tip_hold_rereplay_from(void); + +/* TipHold coalesce runway (tip_runway). Host scans wire tip+1..tip+runway for + * release edges when Live is stalled at invent-cap. */ +uint32_t psx_netplay_rb_tip_runway(void); + +/* §34: while TipHold cannot tip-extend/begin an already-seen wire edge, + * block wall-clock quiet finalize (release must not be dropped by commit). */ +void psx_netplay_rb_tip_hold_block_quiet(int block); + +/* 1 if a peer FRAME_COMMIT should be dropped (TipHold invent still on the + * wire after tip-extend hc_prime). Call from FRAME_COMMIT drain. */ +int psx_netplay_rb_ignore_peer_frame_commit(uint32_t tick, uint32_t hash); + +/* FRAME_COMMIT mismatch during Replay — abort before a false POST commit. + * Returns 1 if an episode was aborted. */ +int psx_netplay_rb_abort_resim_core_mismatch(uint32_t tick, uint32_t local_core, + uint32_t peer_core); +/* 1 while a baseline/realign snap load is queued or resume is deferred — + * poll_admit must stall (do not run live invent). */ +int psx_netplay_rb_load_pending(void); + +/* §71: nonzero while choose_load is bisecting below a failed baseline load + * (g_bl_fork_cap). hc-fork recovery must not reopen into the same doomed + * snap ladder every 32 ticks. */ +uint32_t psx_netplay_rb_baseline_fork_cap(void); + +/* + * During resim: publish sealed inputs for current sim tick and admit. + * Returns 1 if guest should run this tick, 0 to wait (seal/baseline). + */ +int psx_netplay_rb_try_admit(void); + +/* After guest frame during resim: advance episode clock; may commit. */ +void psx_netplay_rb_finish_frame(void); + +/* §47: greatest contiguous confirmed tick T such that every seat has a + * confirmed (non-predicted) row for every tick from `from_tick` through T. + * If `from_tick` itself is incomplete, returns from_tick-1 (or 0). + * Pass from_tick = replay_sim + 1. */ +uint32_t psx_netplay_rb_confirmed_frontier(uint32_t from_tick); + +/* Contiguous confirmed ticks still ahead of current sim (0 = exhausted). */ +uint32_t psx_netplay_rb_confirmed_remaining(void); + +/* §47 ownership step: tip-extend toward contiguous frontier while Replay + * owns progress. Call after reconcile during resim (before finish_frame). */ +void psx_netplay_rb_ownership_step(void); + +/* Present-edge digest prep: copy `in` → `out` and clear PC. At vblank + * finish_frame the host often parks cpu->pc=0 while a peer may still hold a + * live BB PC; sticky substitutes were host-local and forked dig_cpu with + * matched RAM/clk. GPRs/COP0/cycles remain. */ +void psx_netplay_rb_cpu_for_present_digest(struct CPUState *out, + const struct CPUState *in); + +/* Diag */ +uint32_t psx_netplay_rb_episode_count(void); +int psx_netplay_rb_phase(void); /* RNetRbPhase cast to int */ +uint32_t psx_netplay_rb_snap_count(void); + +/* Ticks armed into Replay since the last call (counter resets on read). Used + * by the host [FPS] line (PSX_NETPLAY_TIMING=1) to report what fraction of + * the window was spent resimulating vs running Live. */ +uint64_t psx_netplay_rb_take_replay_ticks(void); +/* §56: cumulative replay ticks (never reset) — scheduler scorecard deltas. */ +uint64_t psx_netplay_rb_replay_ticks_total(void); + +/* Live network-latency estimate (ms), EMA'd from the POST handshake's own + * send/receive timestamps each episode commit; 0 = no episode has round- + * tripped yet this session. Used by np_invent_grace_stall() (psx_netplay.c) + * to size its "wait before hold-last invent" budget from actual measured + * link latency instead of the local sim's own tick-to-tick cadence — see + * docs/ROLLBACK_MOTK_HOOKUP.md section 12. */ +uint32_t psx_netplay_rb_rtt_estimate_ms(void); + +/* Sticky BB-edge resume PC (MotK wait-loop canonicalize). Used by + * gpu_vblank_flush_present when IRQ resume latches are 0. */ +uint32_t psx_netplay_rb_sticky_bb_pc(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_NETPLAY_RB_H */ diff --git a/overlay_toolchain/include/psx_netplay_sched.h b/overlay_toolchain/include/psx_netplay_sched.h new file mode 100644 index 00000000..8cbe9347 --- /dev/null +++ b/overlay_toolchain/include/psx_netplay_sched.h @@ -0,0 +1,112 @@ +/* psx_netplay_sched.h — MotK facade over recomp-net (rnet_sched_*). + * + * Policy lives in lib/recomp-net. This header keeps the historical + * np_sched_* / PsxNpSchedBridge surface; MotK dig0/FMV/RTT enter through + * gates in psx_netplay_sched.c. + * + * Env knobs: RBE_RB_* (preferred) with MotK PSX_RB_* fallback in recomp-net. + * + * The scheduler's job (design contract, 2026-08-02): + * - keep both peers at the same simulation time (mispredict-driven pacing, + * pcap freeze); + * - keep the delay cushion FULL (consume at wire = sim, produce at + * wire = sim + D — see np_sched_wire_for_sim; prediction is an emergency + * brake, not a steady state); + * - spend prediction only on genuine runway starvation, and recover back + * to zero prediction afterwards (cushion rebuild); + * - resolve D from measured link latency (np_sched auto-delay) instead of + * paying for phase error with prediction. + */ +#ifndef PSX_NETPLAY_SCHED_H +#define PSX_NETPLAY_SCHED_H + +#include + +/* Full session types only when recomp-net is linked. Stub builds keep opaque + * pointers so this header stays includable with PSX_NETPLAY=OFF. */ +#if defined(PSX_HAS_RECOMP_NET) +#include "recomp_net/session.h" +#else +typedef struct RNetSession RNetSession; +typedef struct RNetSessionStats RNetSessionStats; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Live pointers into psx_netplay.c state (session may repoint on restart). */ +typedef struct PsxNpSchedBridge { + RNetSession **session; + int *input_delay; /* committed D, ticks */ + int *input_prediction; /* P cap, ticks */ + int *local_slot; + /* Sticky for the session (from launch cfg / PSX_NET_FORCE_TURN). */ + int force_turn; /* 1 = ICE relay-only — auto-delay floor applies */ +} PsxNpSchedBridge; + +void np_sched_bind(const PsxNpSchedBridge *bridge); + +/* Clear session-scoped pacing/invent state (cushion rebuild, pcap freeze, + * timesync debt, tip cadence). Soft-return rematch reuses the process; without + * this, a mid-match episode can leave cushion_rebuild/debt armed and freeze + * the next session after lockstep armed. Called from np_sched_bind. */ +void np_sched_reset_session(void); + +/* sim→wire CONSUMPTION mapping. §44 real delay (default): guest tick T plays + * the wire row T; the local sample taken at admit(T) is stored at wire T+D + * (rnet_session_prepare_local_tip), so a press surfaces D ticks later and the + * peer's row for T arrived ~D ticks minus transit before it is needed — a + * real cushion. PSX_RB_ZERO_DELAY=1 restores the legacy mapping (T plays + * wire T+D, the sample taken the same admit: zero local latency, zero + * cushion, permanent pred_depth 1 — the pre-§44 behavior). */ +uint32_t np_sched_wire_for_sim(uint32_t sim_tick); +int np_sched_real_delay_enabled(void); + +/* Mid-session DELAY_SYNC commit → mirror into *input_delay. */ +void np_sched_sync_delay_from_session(void); + +/* Pre-admit gate, in original np_try_admit_rollback order: tip cadence + * tracking, timesync throttle (live only), lead sampling, runway/phase logs, + * cushion-rebuild clearing, auto-delay resolution. Returns 1 = stall this + * admit (pacing debt), 0 = proceed. */ +int np_sched_pre_admit(uint32_t sim, uint32_t wire, const RNetSessionStats *st); + +/* Remote row missing at `wire` for `slot`. Returns 1 = stall the admit + * (grace/freeze/cushion wait), 0 = invent hold-last now (*reason_out set, + * telemetry already recorded). */ +int np_sched_on_remote_miss(int slot, uint32_t sim, uint32_t wire, + const RNetSessionStats *st, int pred, + const char **reason_out); + +/* Remote row present at the consumption wire (gap1 grace paid off). */ +void np_sched_note_remote_hit(void); + +/* End of a successful admit: leave pcap freeze, flush periodic stats. */ +void np_sched_post_admit(int any_invent); + +/* MotK-side admit stall tag for barrier logs. Rollback never calls + * rnet_session_try_admit, so rnet last_stall stays "ok" while MotK invent / + * FMV lockstep / wire-hole stalls. Cleared on successful admit. */ +void np_sched_set_admit_stall(const char *tag); +void np_sched_clear_admit_stall(void); +const char *np_sched_admit_stall_tag(void); /* "" if none */ + +/* Reconcile caught a genuine mispredict (published != wire) that rode `age` + * ticks before being caught — feeds the pacing debt of the ahead peer. */ +void np_sched_note_mispredict(uint32_t age); + +/* Episode boundary (commit/abort): clear the pegged-streak off-guard and arm + * cushion rebuild. (Public alias: psx_netplay_timesync_on_episode_boundary.) */ +void np_sched_note_episode_boundary(void); + +/* §83 C: after baseline-abort Live realign, allow invent despite absurd + * remote_lead for a short window so recovery can catch up (soak: lead=500 + * refuse invent → crawl). Tip-hold ring-age absurd leads stay blocked. */ +void np_sched_arm_absurd_invent_catchup(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_NETPLAY_SCHED_H */ diff --git a/overlay_toolchain/include/psx_rewind.h b/overlay_toolchain/include/psx_rewind.h new file mode 100644 index 00000000..23cf98b3 --- /dev/null +++ b/overlay_toolchain/include/psx_rewind.h @@ -0,0 +1,73 @@ +#ifndef PSX_REWIND_H +#define PSX_REWIND_H + +/* + * Local rewind ring + bottom filmstrip overlay (host only). + * + * Uses retcomm-rbengine snap_ring + boot_state blobs. Separate from netplay + * g_snaps. Disabled while psx_netplay_active(). + * + * Keyboard: F8 (config.ini [KeyMap] Rewind). Controller: View/Back or L3. + * While open: D-pad / left-stick Left/Right, Cross load, Circle/Back close. + * + * OFF by default. The ring holds up to 200 whole-machine snapshots (2 MB RAM + + * 1 MB VRAM + 512 KB SPU RAM each) and captures one every rewind_interval + * frames, which is not a cost to hand a low-end host for a feature a session + * may never open. Turn it on in settings.toml or the launcher's Display card. + * + * Env: PSX_REWIND=1 enables, PSX_REWIND=0 disables; either outranks the UI. + * PSX_REWIND_INTERVAL (1/4/8/12/15, default 15); + * PSX_REWIND_FMV_INTERVAL (frames while depth24/MDEC/XA, default 4); + * PSX_REWIND_DEPTH (50/100/150/200, default 50, max 200). + * settings.toml [video] rewind / rewind_depth / rewind_interval (env still wins). + */ + +#include +#include "cpu_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Snap count kept in the local rewind ring. UI values: 25 / 50 / 75 / 100. */ +void psx_rewind_set_depth(uint32_t depth); +void psx_rewind_set_interval(uint32_t interval); +/* Settings/launcher preference. Call before psx_rewind_configure(); to change + * it mid-session, call this then configure() (on) or shutdown() (off). */ +void psx_rewind_set_enabled(int enabled); + +void psx_rewind_configure(uint32_t bios_checksum, uint32_t entry_pc); +void psx_rewind_shutdown(void); + +int psx_rewind_enabled(void); +int psx_rewind_is_open(void); +/* 1 while open or slide animation still visible. */ +int psx_rewind_needs_present(void); + +/* Guest vblank: bump frame counter / schedule capture when not paused. */ +void psx_rewind_note_frame(void); + +/* Safe BB-edge (beside savestate_poll): capture due snap / apply load. */ +void psx_rewind_poll(CPUState *cpu, uint32_t resume_pc); + +int psx_rewind_toggle(void); /* open/close; 1 if state changed */ +int psx_rewind_cancel(void); /* close without load */ +int psx_rewind_accept(void); /* stage load of selected snap */ +void psx_rewind_move(int delta); /* -1 / +1 selection */ + +/* Edge-triggered nav with repeat. *_down is 1 while held. */ +void psx_rewind_nav_held(int left_down, int right_down, int accept_down, + int cancel_down, uint32_t now_ms); + +void psx_rewind_present_tick(uint32_t now_ms); + +/* Bottom-panel ARGB8888 (little-endian). Valid until next rewind call. */ +int psx_rewind_overlay_image(const uint32_t **pixels, int *w, int *h); +/* 0..1 slide (0 = off-screen below, 1 = docked). */ +float psx_rewind_slide(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_REWIND_H */ diff --git a/overlay_toolchain/include/psx_runtime.h b/overlay_toolchain/include/psx_runtime.h new file mode 100644 index 00000000..f1106268 --- /dev/null +++ b/overlay_toolchain/include/psx_runtime.h @@ -0,0 +1,24 @@ +#ifndef PSXRECOMP_PSX_RUNTIME_H +#define PSXRECOMP_PSX_RUNTIME_H + +#include "cpu_state.h" +#include "debug_server.h" +#include "interrupts.h" +#include "psx_cycles.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Fix B exception-return escape state + helpers are declared in cpu_state.h + * (the lowest common header the generated BIOS/game both include). */ + +static inline void call_by_address(CPUState* cpu, uint32_t addr) { + psx_dispatch_call(cpu, addr, cpu->gpr[31]); +} + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_PSX_RUNTIME_H */ diff --git a/overlay_toolchain/include/psx_savestate_menu.h b/overlay_toolchain/include/psx_savestate_menu.h new file mode 100644 index 00000000..0de01e33 --- /dev/null +++ b/overlay_toolchain/include/psx_savestate_menu.h @@ -0,0 +1,19 @@ +#ifndef PSX_SAVESTATE_MENU_H +#define PSX_SAVESTATE_MENU_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void psx_savestate_menu_set_state(int open, int selected_slot); +void psx_savestate_menu_note_slots_changed(void); +int psx_savestate_menu_needs_present(void); +int psx_savestate_menu_overlay_image(const uint32_t **pixels, int *w, int *h); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_SAVESTATE_MENU_H */ diff --git a/overlay_toolchain/include/psx_scheduler.h b/overlay_toolchain/include/psx_scheduler.h new file mode 100644 index 00000000..7127ae30 --- /dev/null +++ b/overlay_toolchain/include/psx_scheduler.h @@ -0,0 +1,127 @@ +/* psx_scheduler.h — deterministic TCB cooperative-thread scheduler (carve-out). + * + * Replaces the non-deterministic host-fiber bridge (traps.c + * psx_change_thread_fiber / psx_thread_fiber_entry, which maps each guest + * thread to a Win32/ucontext fiber and overloads cpu->pc=0 as a host-control + * signal) with a structured, deterministic scheduler that operates on the REAL + * guest TCB structures. + * + * Rationale (see HLE_SCHEDULER_CARVEOUT_PLAN.md + CLAUDE.md §0 AMENDMENT): the + * PS1 BIOS scheduler is pure-TCB — a thread's entire context (GPRs + guest SP + + * EPC) lives in its TCB; a "thread switch" is just changing which TCB + * dword_108->entry points to (ExceptionHandler 0xC80 / ReturnFromException + * 0xF40, docs/psx_bios_disasm.txt). There is NO stack switch on real hardware, + * so host fibers were never semantically required — they exist only because a + * recompiled infinite-loop function never returns to its native caller. Because + * guest control flow here is dispatch-based (tail-call trampoline + every- + * block-leader re-entry), a thread switch can instead be a deterministic + * unwind-to-scheduler + re-dispatch-the-target's-EPC. + * + * INVARIANT this design lives or dies on: guest thread context lives ONLY in + * CPUState / RAM / the TCB reg array — NEVER in a host fiber stack, generated + * C locals, a pc=0 sentinel, or a global resume PC. A yield/switch/RFE may + * unwind the host stack ONLY after all guest-visible state is committed and the + * resume PC is dispatchable, and only at a block-leader boundary. + * + * ── SCAFFOLDING (plan steps 1-2) ────────────────────────────────────────── + * This header + the matching definitions in traps.c are INERT: the host-fiber + * bridge (psx_change_thread_fiber) is still authoritative. Later steps wire the + * outer scheduler loop and structured escapes in to replace it. + */ +#ifndef PSX_SCHEDULER_H +#define PSX_SCHEDULER_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Structured scheduler-escape reasons — replaces the overloaded cpu->pc=0 + * host-control sentinel. The outer scheduler loop reads the reason after each + * psx_dispatch returns to decide what to run next. */ +typedef enum { + PSX_RUN_CONTINUE = 0, /* dispatch returned normally; keep running the current thread */ + PSX_RUN_YIELD_TO_TCB, /* ChangeThread / cross-thread RFE: switch to g_sched_escape.target_tcb */ + PSX_RUN_RESUME_CURRENT, /* same-thread RFE: re-dispatch the current thread at resume_pc */ + PSX_RUN_GUEST_EXIT, /* a guest thread legitimately ended */ + PSX_RUN_RETURN_TO_LOBBY, /* netplay soft-exit: tear down match, keep lobby WS */ + PSX_RUN_FATAL, /* invariant violation — fail closed, never silently continue */ +} psx_run_reason_t; + +typedef struct { + psx_run_reason_t reason; + uint32_t target_tcb; /* for PSX_RUN_YIELD_TO_TCB */ + uint32_t resume_pc; /* the dispatchable resume PC the escape commits */ +} psx_sched_escape_t; + +/* The single outer-scheduler escape target + its escape descriptor. A + * yield/switch/RFE commits all guest-visible state to CPUState/RAM/TCB, fills + * g_sched_escape, and longjmp(g_scheduler_jmpbuf, 1)s here. (Wired in a later + * step; defined inert in traps.c for now.) */ +extern jmp_buf g_scheduler_jmpbuf; +extern psx_sched_escape_t g_sched_escape; + +/* Deferred cooperative thread switch (Ape Escape memcard fix #2). Thin exports + * over the scheduler's private TCB save/restore + PCB[0] accessors, so the + * interrupt path can re-save a deferred thread cleanly and re-point the kernel + * current-thread pointer at the outermost dispatch boundary. See traps.c. */ +struct CPUState; +void psx_sched_save_context(struct CPUState* cpu, uint32_t tcb, uint32_t resume_pc); +void psx_sched_set_current_tcb(struct CPUState* cpu, uint32_t tcb); +uint32_t psx_sched_current_tcb(struct CPUState* cpu); + +/* Fail-closed guard: is `pc` a valid, dispatchable guest resume point? A TCB + * EPC / resume PC that is NOT dispatchable (0, the exception sentinel, or not a + * known function/re-enterable block-leader entry) is an invariant violation — + * the scheduler must fail loudly rather than dispatch into nothing (the old + * pc=0 silent fiber-recreate pathology). */ +int psx_is_dispatchable(uint32_t pc); + +/* The outer scheduler trampoline. Replaces the bare top-level psx_dispatch() + * call in main.cpp: dispatch the current thread until it yields via a + * structured escape (longjmp to g_scheduler_jmpbuf), then run whatever the + * escape selected. Returns ONLY on an abnormal top-level exit (the outermost + * dispatch saw cpu->pc==0 with no escape pending) — main.cpp's existing + * exit-diagnostic dump then runs. Forward-declared for main.cpp (C++). */ +struct CPUState; +void psx_scheduler_run(struct CPUState* cpu); + +/* + * Soft-exit netplay back to the lobby UI. Sets PSX_RUN_RETURN_TO_LOBBY and + * longjmps out of the scheduler when inside psx_scheduler_run; otherwise just + * latches the flag for the caller to observe. Safe from the netplay barrier. + */ +void psx_request_return_to_lobby(void); +int psx_return_to_lobby_requested(void); +void psx_clear_return_to_lobby(void); + +/* Save-state restore: unwind to psx_scheduler_run and re-dispatch resume_pc + * (the restored CPUState's PC). Call on the scheduler fiber at a block-leader + * boundary, in_exception == 0. Never returns (longjmp). Arms top-level + * resume (see below) for the first post-resume frame. */ +void psx_scheduler_resume_at(uint32_t resume_pc); + +/* After resume_at, dispatch is top-level — there is no abandoned mid-block + * native chain under the resume PC. Sentinel same-thread RFE must not publish + * pc=0 / "continue live chain" (that is GUEST_EXIT). Active until the first + * finish_frame / explicit clear. Shared by savestate, selfcheck, and RB. */ +int psx_scheduler_top_level_resume_active(void); +void psx_scheduler_top_level_resume_clear(void); + +/* HLE-tier standing subsystem replacement (CLAUDE.md §0 amendments + * 2026-06-29 + 2026-07-02). 1 = deterministic TCB scheduler (default, both + * BIOS backends — the LLE host-fiber bridge it replaces is non-deterministic); + * 0 = legacy host-fiber bridge. Default from [runtime] hle_scheduler via + * psx_hle_scheduler_set_default (call before any dispatch); env + * PSX_HLE_SCHEDULER wins over config. Latched at first query; the mode cannot + * change mid-run. */ +void psx_hle_scheduler_set_default(int on); +int psx_hle_scheduler_enabled(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_SCHEDULER_H */ diff --git a/overlay_toolchain/include/psx_sdl.h b/overlay_toolchain/include/psx_sdl.h new file mode 100644 index 00000000..343ff113 --- /dev/null +++ b/overlay_toolchain/include/psx_sdl.h @@ -0,0 +1,272 @@ +#pragma once + +/* + * Runtime-facing SDL compatibility seam. + * + * PSXRecomp uses SDL3 by default, while PSX_SDL_BACKEND=SDL2 keeps the + * previous implementation available for comparison and older platforms. + */ +#if defined(PSX_SDL3) + +#define SDL_ENABLE_OLD_NAMES +#define SDL_FUNCTION_POINTER_IS_VOID_POINTER +#include + +#ifndef SDL_WINDOW_SHOWN +#define SDL_WINDOW_SHOWN 0 +#endif +#ifndef SDL_WINDOW_FULLSCREEN_DESKTOP +#define SDL_WINDOW_FULLSCREEN_DESKTOP SDL_WINDOW_FULLSCREEN +#endif +#ifndef SDL_RENDERER_ACCELERATED +#define SDL_RENDERER_ACCELERATED 0x00000001u +#endif +#ifndef SDL_RENDERER_PRESENTVSYNC +#define SDL_RENDERER_PRESENTVSYNC 0x00000002u +#endif +#ifndef SDL_RENDERER_SOFTWARE +#define SDL_RENDERER_SOFTWARE 0x00000004u +#endif +#ifndef SDL_MUTEX_TIMEDOUT +#define SDL_MUTEX_TIMEDOUT 1 +#endif +#ifndef SDL_HINT_RENDER_SCALE_QUALITY +#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY" +#endif + +static inline int psx_sdl_init(SDL_InitFlags flags) +{ + return SDL_Init(flags) ? 0 : -1; +} + +static inline int psx_sdl_init_subsystem(SDL_InitFlags flags) +{ + return SDL_InitSubSystem(flags) ? 0 : -1; +} + +static inline SDL_Window *psx_sdl_create_window( + const char *title, int x, int y, int w, int h, Uint64 flags) +{ + (void)x; + (void)y; + return SDL_CreateWindow(title, w, h, (SDL_WindowFlags)flags); +} + +static inline SDL_Renderer *psx_sdl_create_renderer( + SDL_Window *window, int driver_index, Uint32 flags) +{ + (void)driver_index; + SDL_Renderer *renderer = SDL_CreateRenderer(window, NULL); + if (renderer && (flags & SDL_RENDERER_PRESENTVSYNC)) { + (void)SDL_SetRenderVSync(renderer, 1); + } + return renderer; +} + +static inline int psx_sdl_render_set_logical_size( + SDL_Renderer *renderer, int w, int h) +{ + return SDL_SetRenderLogicalPresentation( + renderer, w, h, SDL_LOGICAL_PRESENTATION_LETTERBOX) + ? 0 + : -1; +} + +static inline int psx_sdl_render_copy( + SDL_Renderer *renderer, SDL_Texture *texture, + const SDL_Rect *src, const SDL_Rect *dst) +{ + SDL_FRect srcf; + SDL_FRect dstf; + const SDL_FRect *srcp = NULL; + const SDL_FRect *dstp = NULL; + if (src) { + srcf.x = (float)src->x; + srcf.y = (float)src->y; + srcf.w = (float)src->w; + srcf.h = (float)src->h; + srcp = &srcf; + } + if (dst) { + dstf.x = (float)dst->x; + dstf.y = (float)dst->y; + dstf.w = (float)dst->w; + dstf.h = (float)dst->h; + dstp = &dstf; + } + return SDL_RenderTexture(renderer, texture, srcp, dstp) ? 0 : -1; +} + +static inline int psx_sdl_render_set_vsync( + SDL_Renderer *renderer, int enabled) +{ + return SDL_SetRenderVSync(renderer, enabled) ? 0 : -1; +} + +static inline int psx_sdl_gl_make_current( + SDL_Window *window, SDL_GLContext context) +{ + return SDL_GL_MakeCurrent(window, context) ? 0 : -1; +} + +static inline int psx_sdl_gl_set_swap_interval(int interval) +{ + return SDL_GL_SetSwapInterval(interval) ? 0 : -1; +} + +static inline void psx_sdl_gl_get_drawable_size( + SDL_Window *window, int *w, int *h) +{ + (void)SDL_GetWindowSizeInPixels(window, w, h); +} + +static inline int psx_sdl_get_display_usable_bounds( + SDL_DisplayID display, SDL_Rect *bounds) +{ + if (!display) display = SDL_GetPrimaryDisplay(); + return SDL_GetDisplayUsableBounds(display, bounds) ? 0 : -1; +} + +static inline int psx_sdl_get_current_display_mode( + SDL_DisplayID display, SDL_DisplayMode *mode) +{ + if (!display) display = SDL_GetPrimaryDisplay(); + const SDL_DisplayMode *current = SDL_GetCurrentDisplayMode(display); + if (!current) return -1; + *mode = *current; + return 0; +} + +/* Opt-in high-pixel-density game window. Without it, SDL3 on a Retina Mac + * gives the GL context a drawable in POINTS (half the panel resolution) and + * the compositor stretches it, so any internal resolution above that is + * averaged away. Only set when the player chose an internal resolution. */ +#define PSX_SDL_WINDOW_HIGH_DENSITY SDL_WINDOW_HIGH_PIXEL_DENSITY + +/* Pixel height of the display a window is on (the primary display when the + * window is NULL), for "Match display". 0 when unknown. */ +static inline int psx_sdl_display_pixel_height(SDL_Window *window) +{ + SDL_DisplayID display = window ? SDL_GetDisplayForWindow(window) : 0; + if (!display) display = SDL_GetPrimaryDisplay(); + if (!display) return 0; + const SDL_DisplayMode *mode = SDL_GetCurrentDisplayMode(display); + if (!mode || mode->h <= 0) return 0; + float density = mode->pixel_density > 0.0f ? mode->pixel_density : 1.0f; + return (int)((float)mode->h * density + 0.5f); +} + +static inline const Uint8 *psx_sdl_get_keyboard_state(int *count) +{ + return (const Uint8 *)(const void *)SDL_GetKeyboardState(count); +} + +static inline SDL_JoystickID psx_sdl_joystick_id_for_index(int index) +{ + int count = 0; + SDL_JoystickID result = 0; + SDL_JoystickID *ids = SDL_GetJoysticks(&count); + if (ids && index >= 0 && index < count) result = ids[index]; + SDL_free(ids); + return result; +} + +static inline int psx_sdl_num_joysticks(void) +{ + int count = 0; + SDL_JoystickID *ids = SDL_GetJoysticks(&count); + SDL_free(ids); + return count; +} + +static inline bool psx_sdl_is_game_controller(int index) +{ + SDL_JoystickID id = psx_sdl_joystick_id_for_index(index); + return id && SDL_IsGamepad(id); +} + +static inline SDL_Gamepad *psx_sdl_game_controller_open(int index) +{ + SDL_JoystickID id = psx_sdl_joystick_id_for_index(index); + return id ? SDL_OpenGamepad(id) : NULL; +} + +static inline SDL_GUID psx_sdl_joystick_get_device_guid(int index) +{ + return SDL_GetJoystickGUIDForID(psx_sdl_joystick_id_for_index(index)); +} + +static inline SDL_JoystickID psx_sdl_joystick_get_device_instance_id(int index) +{ + return psx_sdl_joystick_id_for_index(index); +} + +static inline void psx_sdl_joystick_get_guid_string( + SDL_GUID guid, char *buffer, int buffer_size) +{ + SDL_GUIDToString(guid, buffer, buffer_size); +} + +static inline int psx_sdl_cond_wait_timeout( + SDL_Condition *condition, SDL_Mutex *mutex, Sint32 timeout_ms) +{ + return SDL_WaitConditionTimeout(condition, mutex, timeout_ms) + ? 0 + : SDL_MUTEX_TIMEDOUT; +} + +#undef SDL_Init +#define SDL_Init psx_sdl_init +#undef SDL_InitSubSystem +#define SDL_InitSubSystem psx_sdl_init_subsystem +#undef SDL_CreateWindow +#define SDL_CreateWindow psx_sdl_create_window +#undef SDL_CreateRenderer +#define SDL_CreateRenderer psx_sdl_create_renderer +#undef SDL_RenderSetLogicalSize +#define SDL_RenderSetLogicalSize psx_sdl_render_set_logical_size +#undef SDL_RenderCopy +#define SDL_RenderCopy psx_sdl_render_copy +#undef SDL_RenderSetVSync +#define SDL_RenderSetVSync psx_sdl_render_set_vsync +#undef SDL_GL_MakeCurrent +#define SDL_GL_MakeCurrent psx_sdl_gl_make_current +#undef SDL_GL_SetSwapInterval +#define SDL_GL_SetSwapInterval psx_sdl_gl_set_swap_interval +#define SDL_GL_GetDrawableSize psx_sdl_gl_get_drawable_size +#undef SDL_GetDisplayUsableBounds +#define SDL_GetDisplayUsableBounds psx_sdl_get_display_usable_bounds +#undef SDL_GetCurrentDisplayMode +#define SDL_GetCurrentDisplayMode psx_sdl_get_current_display_mode +#undef SDL_GetKeyboardState +#define SDL_GetKeyboardState psx_sdl_get_keyboard_state +#define SDL_NumJoysticks psx_sdl_num_joysticks +#undef SDL_IsGameController +#define SDL_IsGameController psx_sdl_is_game_controller +#undef SDL_GameControllerOpen +#define SDL_GameControllerOpen psx_sdl_game_controller_open +#undef SDL_JoystickGetDeviceGUID +#define SDL_JoystickGetDeviceGUID psx_sdl_joystick_get_device_guid +#undef SDL_JoystickGetDeviceInstanceID +#define SDL_JoystickGetDeviceInstanceID psx_sdl_joystick_get_device_instance_id +#undef SDL_JoystickGetGUIDString +#define SDL_JoystickGetGUIDString psx_sdl_joystick_get_guid_string +#undef SDL_CondWaitTimeout +#define SDL_CondWaitTimeout psx_sdl_cond_wait_timeout + +#else + +#include + +#define PSX_SDL_WINDOW_HIGH_DENSITY SDL_WINDOW_ALLOW_HIGHDPI + +static inline int psx_sdl_display_pixel_height(SDL_Window *window) +{ + int index = window ? SDL_GetWindowDisplayIndex(window) : 0; + SDL_DisplayMode mode; + if (index < 0) index = 0; + if (SDL_GetCurrentDisplayMode(index, &mode) != 0 || mode.h <= 0) return 0; + return mode.h; +} + +#endif diff --git a/overlay_toolchain/include/psx_sdl_audio.h b/overlay_toolchain/include/psx_sdl_audio.h new file mode 100644 index 00000000..a2055e83 --- /dev/null +++ b/overlay_toolchain/include/psx_sdl_audio.h @@ -0,0 +1,34 @@ +#pragma once + +#include "psx_sdl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (SDLCALL *PsxSdlAudioCallback)(void *userdata, Uint8 *stream, int len); + +typedef struct PsxSdlAudioSpec { + int freq; + SDL_AudioFormat format; + Uint8 channels; + Uint16 samples; + int allow_frequency_change; + PsxSdlAudioCallback callback; + void *userdata; +} PsxSdlAudioSpec; + +SDL_AudioDeviceID psx_sdl_audio_open( + const PsxSdlAudioSpec *want, PsxSdlAudioSpec *have); +int psx_sdl_audio_resume(SDL_AudioDeviceID device); +void psx_sdl_audio_close(SDL_AudioDeviceID device); +void psx_sdl_audio_clear(SDL_AudioDeviceID device); +Uint32 psx_sdl_audio_queued_size(SDL_AudioDeviceID device); +int psx_sdl_audio_queue( + SDL_AudioDeviceID device, const void *data, Uint32 bytes); +void psx_sdl_audio_lock(SDL_AudioDeviceID device); +void psx_sdl_audio_unlock(SDL_AudioDeviceID device); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/psx_segment_miss.h b/overlay_toolchain/include/psx_segment_miss.h new file mode 100644 index 00000000..fe18aadb --- /dev/null +++ b/overlay_toolchain/include/psx_segment_miss.h @@ -0,0 +1,92 @@ +#ifndef PSX_SEGMENT_MISS_H +#define PSX_SEGMENT_MISS_H + +/* Segment misses in static game code (docs/SEGMENT_AWARE_CODE.md §5.5; §10 + * decision 2: interpret loudly until the title is regenerated), and in the + * compiled BIOS (§5.4). + * + * A PC carries a segment (KUSEG 0x0..., KSEG0 0x8..., KSEG1 0xA...), and the + * game dispatch table is keyed by the full PC: each compiled body bakes the + * links, EPCs, fetch tags and store PCs of the segment it was compiled for. + * A PC whose physical word has a row only in another segment (a KSEG1 alias + * of KUSEG-linked text, a KSEG0 call into it) therefore has no body of its + * own. Dispatch interprets it through the clean-text-miss path and records it + * here, with the full PC and the row that exists, so a run names each + * (segment, entry) that needs a segment-qualified seed (§5.4). Visible over + * TCP (`segment_misses`, `dispatch_stats`) and in psx_last_run_report.json. */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + uint64_t seq; + uint32_t addr; /* the PC that has no body of its own */ + uint32_t home; /* the compiled row at the same physical word */ + uint32_t ra; + uint32_t sp; + uint32_t frame; + uint32_t kind; /* PSX_SEGMENT_MISS_GAME or PSX_SEGMENT_MISS_BIOS */ +} PsxSegmentMissEntry; + +#define PSX_SEGMENT_MISS_RING_CAP 4096u /* power of two */ +#define PSX_SEGMENT_MISS_UNIQUE_CAP 1024u + +/* The other segment's PC with a compiled row at addr's physical word, or 0 + * when there is none (addr itself is not consulted). KUSEG, KSEG0 and KSEG1 + * are tried in that order. is_entry is the game dispatch's + * psx_game_is_function_entry. */ +uint32_t psx_segment_miss_home(uint32_t addr, int (*is_entry)(uint32_t)); + +/* What a segment miss ran. GAME: static game text, interpreted at its own + * PC (§5.5). BIOS: a relocated BIOS window (kernel, shell) or the ROM entered + * in another segment than the one its body was compiled for, with no segment + * variant of its own. The BIOS dispatch is keyed by the normalized address, + * so the window's home body ran, with its own segment's links, EPCs, fetch + * tags and store PCs; the fix is a segment-qualified seed in the BIOS seeds + * file (§5.4), not in the game's. */ +#define PSX_SEGMENT_MISS_GAME 0u +#define PSX_SEGMENT_MISS_BIOS 1u + +/* Record one segment miss of static game code (kind GAME). */ +void psx_segment_miss_record(uint32_t addr, uint32_t home, uint32_t ra, + uint32_t sp, uint32_t frame); + +/* Record one segment miss of either kind. A PC keeps the kind it was first + * recorded with in the per-PC counts. */ +void psx_segment_miss_record_kind(uint32_t addr, uint32_t home, uint32_t ra, + uint32_t sp, uint32_t frame, uint32_t kind); + +/* The dispatch hook: dirty_ram_dispatch_inner calls this for every clean + * game-text miss (a PC in the EXE's text that no compiled body ran). It + * records a segment miss when addr has no row of its own but another + * segment's alias does, and returns that row; otherwise (addr has a row, e.g. + * its bytes diverged, or no segment has one: an interior PC) it records + * nothing and returns 0. */ +uint32_t psx_segment_miss_note(uint32_t addr, int (*is_entry)(uint32_t), + uint32_t ra, uint32_t sp, uint32_t frame); + +uint64_t psx_segment_miss_total(void); +uint32_t psx_segment_miss_unique(void); + +/* The i-th recorded entry, i < total; only the last RING_CAP are kept. */ +PsxSegmentMissEntry psx_segment_miss_get(uint64_t seq); + +/* Per-PC counts, highest first: up to max rows, returns the number written. + * Counts are exact for the first UNIQUE_CAP distinct PCs; later new PCs are + * counted in the total and the ring only. Any output array may be NULL. */ +uint32_t psx_segment_miss_summary(uint32_t *addrs, uint32_t *homes, + uint64_t *counts, uint32_t *kinds, uint32_t max); + +/* "game" or "bios", for reports. */ +const char *psx_segment_miss_kind_name(uint32_t kind); + +void psx_segment_miss_reset(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_SEGMENT_MISS_H */ diff --git a/overlay_toolchain/include/psx_selfcheck.h b/overlay_toolchain/include/psx_selfcheck.h new file mode 100644 index 00000000..467233bf --- /dev/null +++ b/overlay_toolchain/include/psx_selfcheck.h @@ -0,0 +1,96 @@ +#ifndef PSX_SELFCHECK_H +#define PSX_SELFCHECK_H + +/* + * Solo rollback resim self-check (PSX_RB_SELFCHECK=1, offline only). + * + * Periodically during normal offline play: snapshot the machine at a safe + * BB edge, keep playing N ticks while recording the per-boundary pad rows + * the sampler applied to SIO plus the full netplay digest partitions, then + * rewind to the snapshot and resim the same rows, comparing digests at every + * boundary. Any live-vs-resim fork is exactly the class of determinism bug + * that otherwise only surfaces as a doomed netplay episode in a two-peer + * soak (SIO pace, GTE fold, present-edge PC, v0 restore, ...). + * + * Uses the same machinery as netplay rollback: boot_state raw buffer snaps, + * netplay_state_digest partitions, RB restore recipe (cycle/IRQ resync, SPU + * CD FIFO reset, NO cdrom_accelerate, light frontend hook). No recomp-net + * dependency; fully offline, single process. + * + * Env: + * PSX_RB_SELFCHECK=1 enable + * PSX_RB_SELFCHECK_INTERVAL=N boundaries between windows (default 600) + * PSX_RB_SELFCHECK_SPAN=N window length in boundaries (default 32) + * PSX_RB_SELFCHECK_FAULT=1 corrupt one recorded digest per window to + * prove the comparator/report path + * PSX_RB_SELFCHECK_PRIME=N throwaway resims before counted passes + * (default 1, max 4) — clears live-RECORD ambient + * PSX_RB_SELFCHECK_MASH=1 synthetic fighter-style button spam on live + * boundaries (IDLE/SAVE_WAIT/RECORD). Recorded + * rows replay during resim. Headless-safe. + * PSX_RB_SELFCHECK_MASH_SEED=N xorshift seed (default 0xC0FFEE) + * PSX_RB_SELFCHECK_MASH_RATE=N % chance to start a new press/release each + * boundary when not mid-hold (default 75) + * + * Verdict = warm resim#2 vs #3 (peer episode path). Cold #1 vs #2 is dig only. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct CPUState; + +/* Startup bind (after savestate_configure; needs HLE scheduler for the + * rewind longjmp). Reads env; no-op unless PSX_RB_SELFCHECK=1. */ +void psx_selfcheck_init(struct CPUState *cpu, uint32_t bios_checksum, + uint32_t entry_pc); + +int psx_selfcheck_enabled(void); + +/* 1 while a window is open (record/replay/load). Offline GPU present stays + * immediate — full BB-edge present-defer skews clk/tim between warm peers. */ +int psx_selfcheck_defer_present(void); + +/* 1 while the resim replay is running: skip wall pacer / host audio pump / + * host CD boost exactly like netplay resim. */ +int psx_selfcheck_resim_active(void); + +/* 1 during replay: main.cpp must skip live pad sampling entirely (the + * self-check republishes the recorded rows itself). */ +int psx_selfcheck_replay_input(void); + +/* 1 during record or replay: main.cpp must skip the mid-frame low-latency + * input re-sample so pads stay boundary-latched (netplay tick semantics). */ +int psx_selfcheck_input_locked(void); + +/* Offline pad sampler notes what it applied to SIO this boundary (called + * from apply_pad_slot_to_sio / apply_input_override_to_sio). */ +void psx_selfcheck_note_pad(int slot, uint16_t buttons, uint8_t lx, uint8_t ly, + uint8_t rx, uint8_t ry, uint8_t analog); + +/* 1 when mash owns this boundary's P1 pad word (active-low). Latched once + * per offline vblank so mid-frame resampling sees a stable word. */ +int psx_selfcheck_mash_override(uint16_t *out_buttons); + +/* Once per offline vblank boundary, after pad sampling (main.cpp present + * body). defer_window!=0 postpones opening a new window (e.g. multitap + * arming still pending). */ +void psx_selfcheck_finish_frame(int defer_window); + +/* Safe BB-edge poll (beside savestate_poll in interrupts.c): performs the + * deferred snapshot save. Loads only as a fallback when span-end flush did + * not run (e.g. headless paths that skip present). Near-free when idle. */ +void psx_selfcheck_poll(struct CPUState *cpu, uint32_t resume_pc); + +/* After present-body C++ RAII: if a window span just ended, rewind+resume + * immediately at that VBlank boundary (no post-span BB tail). Longjmps. */ +void psx_selfcheck_flush_load(void); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_SELFCHECK_H */ diff --git a/overlay_toolchain/include/psx_sha256.h b/overlay_toolchain/include/psx_sha256.h new file mode 100644 index 00000000..0b3e5abc --- /dev/null +++ b/overlay_toolchain/include/psx_sha256.h @@ -0,0 +1,24 @@ +#pragma once +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct psx_sha256_ctx { + uint32_t h[8]; + uint64_t total; + uint8_t buffer[64]; + size_t buffered; +} psx_sha256_ctx; + +/* Self-contained public-domain SHA-256 implementation. */ +void psx_sha256_init(psx_sha256_ctx* ctx); +void psx_sha256_update(psx_sha256_ctx* ctx, const uint8_t* data, size_t len); +void psx_sha256_final(psx_sha256_ctx* ctx, uint8_t out[32]); +void psx_sha256_compute(const uint8_t *data, size_t len, uint8_t out[32]); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/psx_stick.h b/overlay_toolchain/include/psx_stick.h new file mode 100644 index 00000000..6349dfb8 --- /dev/null +++ b/overlay_toolchain/include/psx_stick.h @@ -0,0 +1,26 @@ +#ifndef PSX_STICK_H +#define PSX_STICK_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Convert one SDL stick vector to the two unsigned DualShock axis bytes. + * + * deadzone and anti_deadzone use SDL's 0..32767 radial magnitude scale. + * Values inside deadzone are centred. Outside it, magnitude is remapped from + * anti_deadzone to full travel while direction is preserved. anti_deadzone=0 + * is an ordinary rescaled radial deadzone. + */ +void psx_stick_to_dualshock(int16_t x, int16_t y, + int deadzone, int anti_deadzone, + uint8_t *out_x, uint8_t *out_y); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/psx_vblank_clock.h b/overlay_toolchain/include/psx_vblank_clock.h new file mode 100644 index 00000000..a8816ecb --- /dev/null +++ b/overlay_toolchain/include/psx_vblank_clock.h @@ -0,0 +1,36 @@ +#ifndef PSXRECOMP_PSX_VBLANK_CLOCK_H +#define PSXRECOMP_PSX_VBLANK_CLOCK_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exact rational native-cycle period generator. `fraction` is the remainder + * after selecting `current_cycles`, which makes the five fields complete + * deterministic save-state data once the configured ratio is fixed. */ +typedef struct PSXVBlankClock { + uint32_t period_floor; + uint32_t period_remainder; + uint32_t period_denominator; + uint32_t fraction; + uint32_t current_cycles; +} PSXVBlankClock; + +int psx_vblank_clock_configure(PSXVBlankClock *clock, + uint64_t period_numerator, + uint32_t period_denominator); +void psx_vblank_clock_next(PSXVBlankClock *clock); +int psx_vblank_clock_restore_fraction(PSXVBlankClock *clock, + uint32_t fraction); +uint64_t psx_vblank_clock_cycles_for_frames_ceil( + const PSXVBlankClock *clock, uint32_t frames); +uint64_t psx_vblank_clock_frames_for_cycles_floor( + const PSXVBlankClock *clock, uint64_t cycles); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/psx_video_timing.h b/overlay_toolchain/include/psx_video_timing.h new file mode 100644 index 00000000..1769fd13 --- /dev/null +++ b/overlay_toolchain/include/psx_video_timing.h @@ -0,0 +1,71 @@ +#ifndef PSXRECOMP_PSX_VIDEO_TIMING_H +#define PSXRECOMP_PSX_VIDEO_TIMING_H + +/* Frame timing follows the GPU's live video standard. + * + * On hardware the scanline count per frame (NTSC 263 / PAL 314) and so the + * VBlank rate come from GP1(08h) bit 3, whatever the console or disc region. + * The GPU reports every change of that bit here (GP1(08h), GP1(00h) reset, + * power-on, snapshot restore); VBlank scheduling (interrupts.c), the Timer 1 + * HBlank clock (timers.c) and host frame pacing (main.cpp) all read it. + * + * The frame period is live: the frame in progress ends once its elapsed + * cycles reach the CURRENT standard's period, the way a scanline counter + * running against the new line total would end the field. From the next + * frame on the period is exactly the new standard's. No extra state is + * needed across savestates: the GPU snapshot carries the mode bit. + * + * The periods keep the framework's round 60/50 Hz constants so NTSC timing + * is bit-identical to the region-only model this replaces. */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PSX_VBLANK_CYCLES_NTSC 564480u /* 33.8688 MHz / 60 Hz */ +#define PSX_VBLANK_CYCLES_PAL 677376u /* 33.8688 MHz / 50 Hz */ +#define PSX_LINES_PER_FRAME_NTSC 263u +#define PSX_LINES_PER_FRAME_PAL 314u +/* Timer 1 HBlank clock: one frame's cycles spread over its scanlines, + * truncated (NTSC 564480 / 263 = 2146, PAL 677376 / 314 = 2157). */ +#define PSX_HBLANK_CYCLES_NTSC (PSX_VBLANK_CYCLES_NTSC / PSX_LINES_PER_FRAME_NTSC) +#define PSX_HBLANK_CYCLES_PAL (PSX_VBLANK_CYCLES_PAL / PSX_LINES_PER_FRAME_PAL) + +/* Live values for the current standard. Written only through + * psx_video_timing_set_pal(); read on hot paths. */ +extern uint32_t g_psx_vblank_cycles; +extern uint32_t g_psx_hblank_cycles; +extern uint32_t g_psx_lines_per_frame; + +/* GP1(08h) display-mode word -> 1 when bit 3 selects PAL. */ +static inline int psx_gp1_display_mode_is_pal(uint32_t word) { + return (int)((word >> 3) & 1u); +} + +/* Select the video standard. Returns 1 when it changed. */ +int psx_video_timing_set_pal(int pal); +int psx_video_timing_is_pal(void); +/* Bumped on every change; host-side observers (pacing) compare it. */ +uint32_t psx_video_timing_generation(void); + +/* VBlank edge bookkeeping on the cycles elapsed since the last edge. */ +static inline int psx_vblank_edge_due(uint32_t cycles_since_vblank) { + return cycles_since_vblank >= g_psx_vblank_cycles; +} +static inline uint32_t psx_vblank_cycles_to_edge(uint32_t cycles_since_vblank) { + return cycles_since_vblank >= g_psx_vblank_cycles + ? 0u : g_psx_vblank_cycles - cycles_since_vblank; +} +/* Consume one due edge. Subtracts one period rather than resetting to 0 so + * cycle overshoot carries into the next frame. */ +static inline void psx_vblank_consume_edge(uint32_t *cycles_since_vblank) { + *cycles_since_vblank -= g_psx_vblank_cycles; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/psx_window_icon.h b/overlay_toolchain/include/psx_window_icon.h new file mode 100644 index 00000000..d98d95e6 --- /dev/null +++ b/overlay_toolchain/include/psx_window_icon.h @@ -0,0 +1,23 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +struct SDL_Window; + +/* Load assets/psxrecomp.png beside the exe (or SDL base path) and apply as + * the window / taskbar icon. No-op when the PNG is missing. */ +void psx_apply_window_icon(struct SDL_Window *window, const char *argv0); + +/* The resolved path psx_apply_window_icon() would use, or "" when no icon PNG + * was found. Exists so the launcher can carry the SAME icon as the game + * window: recomp-ui takes a host-supplied path (GameInfo.window_icon_path) + * rather than repeating this search, which is what stops the two from + * drifting apart the next time the search order changes. The result is cached + * on first call and the returned pointer stays valid for the process. */ +const char *psx_window_icon_path(const char *argv0); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/render_pass.h b/overlay_toolchain/include/render_pass.h new file mode 100644 index 00000000..87736a2c --- /dev/null +++ b/overlay_toolchain/include/render_pass.h @@ -0,0 +1,63 @@ +#ifndef PSX_RENDER_PASS_H +#define PSX_RENDER_PASS_H + +/* Host-timed render passes: runtime side of psx_mod_render_pass_plan() and + * psx_mod_render_pass() (mod_plugins.h). See docs/RENDER_PASSES.md. */ + +#include + +#include "psx_cycle_freeze.h" /* g_psx_render_pass_active, the time freeze */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Stores a pass may not make (memory.c render_pass_store): they would escape + * the restore, so they are dropped and counted per device class. */ +enum { + RENDER_PASS_DROP_SPU = 0, + RENDER_PASS_DROP_CD, + RENDER_PASS_DROP_TIMER, + RENDER_PASS_DROP_DMA, /* DMA channels other than GPU (2) and OTC (6) */ + RENDER_PASS_DROP_GPU, /* GP1 commands other than DMA mode / info */ + RENDER_PASS_DROP_OTHER, /* SIO, MDEC, memory control, mod arenas, ... */ + RENDER_PASS_DROP_CLASSES +}; +extern uint64_t g_render_pass_dropped_writes[RENDER_PASS_DROP_CLASSES]; + +typedef struct RenderPassStats { + uint64_t plans; /* psx_mod_render_pass_plan calls that planned >= 1 */ + uint64_t planned; /* phases planned (after shedding) */ + uint64_t wanted; /* phases wanted before shedding */ + uint64_t refused; /* plan calls that returned 0 while enabled */ + uint64_t passes; /* passes run to completion and presented */ + uint64_t aborted; /* passes rolled back by a fault */ + uint64_t discarded; /* passes whose plugin declined the image */ + uint64_t watchdog; /* of which: guest-cycle watchdog overruns */ + uint64_t vram_leaks; /* GPU writes outside the declared rect (dropped) */ + uint64_t nesting_repairs; /* aborts whose skipped exits the restore undid */ + uint64_t verify_checks; /* PSX_RENDER_PASS_VERIFY comparisons */ + uint64_t verify_mismatch; /* ... that found a difference */ + uint64_t spans; /* psx_mod_run_guest_span calls that reached stop */ + uint64_t span_failures; /* ... that left the span or overran */ + uint64_t dropped[RENDER_PASS_DROP_CLASSES]; + double last_pass_ms; /* host time of the last pass (sandbox + draw) */ + double avg_pass_ms; /* smoothed */ + double avg_begin_ms; /* smoothed: VRAM backup + checkpoint */ + double avg_guest_ms; /* smoothed: the plugin's guest draw code */ + double avg_end_ms; /* smoothed: GPU flush, capture, VRAM restore */ + double avg_restore_ms; /* smoothed: machine state restore */ + uint64_t guest_cycles_last; /* guest cycles the last pass executed */ + int disabled; /* sticky: passes disabled after repeated faults */ + int watchdog_flag; /* internal: the current pass overran */ +} RenderPassStats; + +void render_pass_get_stats(RenderPassStats *out); +/* Clears counters and the sticky fault latch (new mod session). */ +void render_pass_reset_session(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/render_pass_motion.h b/overlay_toolchain/include/render_pass_motion.h new file mode 100644 index 00000000..c28ddc3b --- /dev/null +++ b/overlay_toolchain/include/render_pass_motion.h @@ -0,0 +1,123 @@ +#ifndef PSX_RENDER_PASS_MOTION_H +#define PSX_RENDER_PASS_MOTION_H +/* + * Motion kit for render-pass plugins (docs/RENDER_PASSES.md, "Blending game + * state"). A pass redraws the scene with the game's own code between two + * logic ticks; what makes the image an in-between one is the game state the + * draw code reads, placed part of the way from the previous tick to the + * current one. This kit owns that part for any title: + * + * per game frame, at the plugin's capture point + * psx_motion_begin(set, tick) the game's logic tick counter + * psx_motion_track(set, kind, addr, identity) for each value the draw + * code reads (object matrices, + * positions, angles, the camera) + * psx_motion_prepare(set, &limits, &stats) pair with the previous frame + * in each pass + * psx_motion_apply(set, alpha) write the blends into guest RAM + * psx_motion_blend_at(set, addr, ...) or blend one value a hook hands on + * + * Values are matched by address AND identity: game objects are heap blocks, + * and a freed address reused by another object must never blend between the + * two. A value that moved further than the limits allow in the ticks between + * the frames was placed (respawn, teleport, camera cut), not moved; it keeps + * its current value, as do values without history. Nothing is written + * outside psx_motion_apply, which a pass's sandbox rolls back. + * + * Guest RAM is read and written through psx_mod_read_* / psx_mod_write_*. + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* What lives at a tracked address (guest RAM layout). */ +enum { + /* PsyQ MATRIX: 3x3 s16 rotation in 4.12 at +0x00..+0x11, s32 t[3] at + * +0x14. Rotation slerps when both rows are orthonormal, otherwise it + * blends elementwise; translation blends linearly. */ + PSX_MOTION_MATRIX = 1, + /* Only the translation of a MATRIX (+0x14..+0x1F): for matrices whose + * rotation the draw code rebuilds itself (billboards). */ + PSX_MOTION_MATRIX_TRANSLATION = 2, + PSX_MOTION_VECTOR = 3, /* s32 x, y, z */ + PSX_MOTION_SVECTOR = 4, /* s16 x, y, z */ + /* s16 x, y, z angles, 4096 per turn: each blends along the shorter arc. */ + PSX_MOTION_ANGLES = 5, + PSX_MOTION_SCALAR = 6, /* s32 */ + /* A bare 3x3 s16 rotation in 4.12 (18 bytes), blended like a MATRIX's; + * pair it with a VECTOR / SVECTOR kind wherever its translation lives + * (skeleton pose records, matrices stored apart from their position). */ + PSX_MOTION_ROTATION = 7 +}; + +typedef struct PSXMotionLimits { + /* Distance one value may move per logic tick and still blend + * (translation, VECTOR, SVECTOR, SCALAR, in the game's units). */ + double move_per_tick; + /* Rotation between the two frames beyond which a value snaps + * (MATRIX rotation, ANGLES). 0 means pi (any turn up to a half turn). */ + double turn_radians; +} PSXMotionLimits; + +typedef struct PSXMotionStats { + uint32_t tracked; /* values captured this frame */ + uint32_t blended; /* ... that will blend */ + uint32_t placed; /* ... that moved or turned past the limits */ + uint32_t unmatched; /* ... new, or a different identity at the address */ + uint32_t ticks; /* logic ticks between the two frames (0 = no history) */ +} PSXMotionStats; + +typedef struct PSXMotionMatrix { + int16_t r[9]; + int32_t t[3]; +} PSXMotionMatrix; + +typedef struct PSXMotionSet PSXMotionSet; + +PSXMotionSet* psx_motion_set_create(uint32_t capacity); +void psx_motion_set_destroy(PSXMotionSet* set); + +/* Start this frame's capture. `tick` is the game's logic tick counter at + * this frame; the previous capture becomes the history. */ +void psx_motion_begin(PSXMotionSet* set, uint32_t tick); +/* Record the value of `kind` at `addr` as the draw code will read it. + * `identity` names what lives there (psx_motion_identity of its type, + * handler, model...). One value per (addr, kind) per frame; a repeat + * replaces the earlier one. Returns 0 when the set is full. */ +int psx_motion_track(PSXMotionSet* set, uint32_t kind, uint32_t addr, + uint32_t identity); +/* Pair this capture with the previous one. Returns how many values will + * blend. History counts only when it is the capture just before this one + * with 1..8 ticks between them; otherwise nothing blends. */ +uint32_t psx_motion_prepare(PSXMotionSet* set, const PSXMotionLimits* limits, + PSXMotionStats* stats); +/* Write every prepared value at t (0 = previous frame, 1 = this frame). */ +void psx_motion_apply(const PSXMotionSet* set, double t); +/* Blend one prepared value at t into `out` without writing guest RAM: + * a PSXMotionMatrix for the MATRIX kinds and ROTATION (translation 0), int32_t[3] for VECTOR / SVECTOR / + * ANGLES, int32_t for SCALAR. Returns 0 when that value does not blend this + * frame (out then holds its current value) or was not tracked (out + * untouched, returns -1). */ +int psx_motion_blend_at(const PSXMotionSet* set, uint32_t kind, uint32_t addr, + double t, void* out); +/* Forget all history (scene change, load, a frame the plugin skipped). */ +void psx_motion_invalidate(PSXMotionSet* set); + +/* Mix up to three words into an identity tag. */ +uint32_t psx_motion_identity(uint32_t a, uint32_t b, uint32_t c); + +/* The math, for plugins that blend values the set does not hold. Returns 0 + * when the rotation turned past turn_radians (out = b). */ +int psx_motion_blend_matrix(const PSXMotionMatrix* a, const PSXMotionMatrix* b, + double t, double turn_radians, + PSXMotionMatrix* out); +void psx_motion_read_matrix(uint32_t addr, PSXMotionMatrix* out); +void psx_motion_write_matrix(uint32_t addr, const PSXMotionMatrix* m, + int rotation); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/include/render_pass_plan.h b/overlay_toolchain/include/render_pass_plan.h new file mode 100644 index 00000000..72b5ee5b --- /dev/null +++ b/overlay_toolchain/include/render_pass_plan.h @@ -0,0 +1,199 @@ +#ifndef PSX_RENDER_PASS_PLAN_H +#define PSX_RENDER_PASS_PLAN_H + +/* Pure planning and selection math for host-timed render passes + * (render_pass.c, gpu_gl_renderer.c). No runtime state; unit-tested by + * runtime/tests/test_render_pass_plan.c. + * + * Vocabulary. A game frame F is first presented at host tick `frame_start` + * and stays on screen for `frame_length` host ticks (its flip period in guest + * VBlanks times the presenter's source period). Phase p in [0, 1) is the + * position inside that window. Phase 0 is the game's own image of F; a pass + * rendered at phase a shows the game state a of the way from F to the next + * frame. Phases are carried as Q16 (65536 = 1). */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define RENDER_PASS_MAX_PHASES 16u + +typedef struct RenderPassPlanInput { + double next_deadline; /* the presenter's next output deadline (ticks) */ + double target_period; /* ticks per output frame; <= 0 = unknown */ + double frame_start; /* predicted first-present tick of the frame */ + double frame_length; /* ticks the frame stays on screen */ + double pass_cost; /* smoothed host ticks per pass; 0 = unknown: + with a budget, one pass is planned until one + has been measured */ + double budget; /* host ticks the passes may use; < 0 = unlimited */ + uint32_t max; /* caller's array capacity */ +} RenderPassPlanInput; + +/* Fill alpha_q16[] with the ascending phases the presenter will show during + * the frame (the output deadlines that fall strictly inside it, excluding + * ones within 1/64 of phase 0, which the game's own image already covers). + * When the budget cannot pay for all of them, an evenly spread subset is + * returned; while the pass cost is unknown that subset is one phase, since + * passes run on the emulation thread. *wanted (optional) receives the + * unshed count. Returns the count (0 when nothing is wanted or affordable). */ +uint32_t render_pass_plan_phases(const RenderPassPlanInput *in, + uint32_t *alpha_q16, uint32_t *wanted); + +/* Pick what to show at phase p (0..1+) from a frame's rendered items. + * phases[0..n) are ascending Q16 phases, phases[0] == 0 being the game's + * image. Sets *lo and *hi (item indices) and *t (blend weight of hi, 0..1): + * inside [phases[i], phases[i+1]] the two neighbours are blended; past the + * last item it is held (nothing newer exists yet). Returns 0 when n == 0. */ +int render_pass_select(const uint32_t *phases, uint32_t n, double p, + uint32_t *lo, uint32_t *hi, float *t); + +/* How long a promoted generation stays on screen without the next flip, in + * frame lengths (phase units), before it expires. */ +#define RENDER_PASS_GEN_HOLD_MAX 4.0 + +/* What a promoted generation shows at phase p: render_pass_select, except + * that it expires (returns 0) past RENDER_PASS_GEN_HOLD_MAX or for a p that + * is not a number. Phase 1 and beyond means the next flip is late (the game + * frame lasts longer than the plan assumed, e.g. a lagging tick): the newest + * image holds, as a late stock frame would, and the presenter never falls + * back to its own capture of the frame, which is older (phase 0). Only a + * game that stops flipping for several frame lengths gets that back. */ +int render_pass_gen_select(const uint32_t *phases, uint32_t n, double p, + uint32_t *lo, uint32_t *hi, float *t); + +/* Is the flip the FLIP source just saw the one a pending generation waits + * for? A generation built for the next flip (`shown` 0, the canonical PsyQ + * VSync-then-PutDispEnv point) waits for the display to flip to its own rect. + * One built for a frame already on screen (`shown` 1: the game flips each + * frame as soon as it is drawn) waits for the next flip, to any other rect; + * its images then show one game frame late. Either way the presented + * geometry must still be the one the generation was captured at. */ +int render_pass_gen_flip_matches(int shown, int gen_x, int gen_y, + int gen_source, int gen_w, int gen_h, + int flip_x, int flip_y, int flip_source, + int flip_w, int flip_h); + +/* Exponential moving average used for the per-pass host cost. */ +double render_pass_ema(double current, double sample); + +/* Smoothed host cost of one pass at one presented image size (the renderer + * starts a new one when the size changes). Fed one sample per pass. + * + * - `allocated`: the pass created textures or framebuffers (first use, a + * size change). That one-time cost says nothing about the next pass -- at + * a high internal resolution the first passes cost several times the + * steady state -- and a plan that sheds every pass for time never + * measures again, so such a sample is left out, at most + * RENDER_PASS_ALLOC_SKIPS times in a row (any kept sample resets that). + * - Warm-up: the first RENDER_PASS_COST_WARMUP kept samples seed the average + * with their median, so one slow pass (a busy host at the first race + * frame) cannot price passes out. Until then the estimate is 0 (unknown), + * for which a plan asks for one pass (render_pass_plan_phases). + * - Then an exponential moving average (render_pass_ema). + * - Re-measuring (render_pass_cost_note_plan): only passes that run are + * measured, so an estimate that prices every plan out is never corrected + * by one -- and the first passes of a race can all run in a transient + * (a busy host, code seen for the first time) that costs several times the + * steady state. An estimate no pass has been measured against for + * `rewarm_after` plans (RENDER_PASS_REWARM_MIN, about a second of 30 Hz + * frames) restarts the warm-up. When the new median is more than + * RENDER_PASS_REWARM_STALE of the old estimate, the old one was right -- a + * size that is truly too expensive, or a machine at its limit -- and the + * next wait doubles, up to RENDER_PASS_REWARM_MAX; a stale estimate found + * keeps the wait at the minimum. */ +#define RENDER_PASS_ALLOC_SKIPS 8u +#define RENDER_PASS_COST_WARMUP 3u +#define RENDER_PASS_REWARM_MIN 30u +#define RENDER_PASS_REWARM_MAX 960u +#define RENDER_PASS_REWARM_STALE 0.75 +typedef struct RenderPassCost { + double ema; + double warm[RENDER_PASS_COST_WARMUP]; + unsigned kept; /* kept samples, saturating at WARMUP */ + unsigned skips; /* allocating samples left out in a row */ + unsigned unsampled; /* plans since the last kept sample */ + unsigned rewarm_after; /* 0 = RENDER_PASS_REWARM_MIN */ + double rewarm_from; /* estimate being re-measured; 0 = none */ +} RenderPassCost; +void render_pass_cost_add(RenderPassCost *cost, double sample, int allocated); +/* Host ticks per pass for planning; 0 while the cost is unknown. */ +double render_pass_cost_estimate(const RenderPassCost *cost); +/* Call once per plan that wanted passes at this cost's image size. Returns 1 + * when the plan found the estimate stale and restarted the warm-up. */ +int render_pass_cost_note_plan(RenderPassCost *cost); + +/* Next frame's pass budget from the last frame: the host time the presenter + * spent idle-waiting plus the time passes used, scaled by `share` (0..1) and + * clamped to [0, frame_length]. No history (both zero) -> share of the frame. */ +double render_pass_budget(double idle_ticks, double pass_ticks, + double frame_length, double share); + +/* Store policy inside a pass (memory.c): -1 = the MMIO store may reach its + * device (GP0; GP1 DMA mode 0x04 / info 0x10; GPU and OTC DMA channels; + * DPCR/DICR; I_STAT/I_MASK -- all restored after the pass), otherwise the + * RENDER_PASS_DROP_* class it is dropped and counted under (render_pass.h). */ +int render_pass_mmio_class(uint32_t phys, uint32_t val, uint32_t width); + +/* One guest store made inside a pass (memory.c render_pass_store): RAM and + * scratchpad are written directly, bypassing every live-timeline observer; + * MMIO reaches `mmio_write` only when render_pass_mmio_class allows it; KSEG2 + * (cache control), mod memory, expansion and ROM are dropped. Returns -1 when + * the store was made (or absorbed: an isolated-cache store changes nothing a + * pass restores), else the RENDER_PASS_DROP_* class it was dropped under, + * which the caller counts. */ +typedef struct RenderPassStoreTarget { + uint8_t *ram; /* main RAM backing store */ + uint32_t ram_size; /* LIVE geometry, a power of two: 2 MiB retail + (mirrored 4x in the 8 MiB window) or 8 MiB + (psx_ram_live_bytes()) */ + uint8_t *scratchpad; + uint32_t scratchpad_size; + int isolate_cache; /* COP0 SR IsC is set */ + void (*mmio_write)(uint32_t phys, uint32_t val, uint32_t width); +} RenderPassStoreTarget; +int render_pass_store_to(const RenderPassStoreTarget *t, uint32_t addr, + uint32_t val, uint32_t width); + +/* VRAM journal for a pass's writes outside its display rect + * (gpu_gl_renderer.c pass_refuse_write): the CPU-side policy and the CPU VRAM + * rows. The renderer keeps the matching GPU copies per entry. */ +/* Jersey Devil streams more than 16 small texture/CLUT rectangles in a draw. + * Keep the transaction bounded, but allow the complete set to roll back. */ +#define RENDER_PASS_JOURNAL_MAX 64 +enum { + RENDER_PASS_VRAM_ALLOW = 0, /* inside the rect, empty, or already journaled */ + RENDER_PASS_VRAM_JOURNAL = 1, /* outside: back up, then allow */ + RENDER_PASS_VRAM_REFUSE = 2 /* outside and cannot be journaled */ +}; +typedef struct RenderPassJournal { + int n; + int x[RENDER_PASS_JOURNAL_MAX], y[RENDER_PASS_JOURNAL_MAX]; + int w[RENDER_PASS_JOURNAL_MAX], h[RENDER_PASS_JOURNAL_MAX]; + uint16_t *rows[RENDER_PASS_JOURNAL_MAX]; + size_t cap[RENDER_PASS_JOURNAL_MAX]; +} RenderPassJournal; +/* Clip the write (*x, *y, *w, *h) to vram_w x vram_h and decide it against + * the pass rect (px, py, pw, ph) and the journal. can_journal = 0 refuses + * every outside write. */ +int render_pass_vram_policy(const RenderPassJournal *j, int px, int py, + int pw, int ph, int vram_w, int vram_h, + int can_journal, int *x, int *y, int *w, int *h); +/* Record the CPU rows of rect (x, y, w, h) of vram (vram_w halfwords per + * row) as the next entry. Returns its index, or -1 when full / out of + * memory (nothing recorded). */ +int render_pass_journal_add(RenderPassJournal *j, const uint16_t *vram, + int vram_w, int x, int y, int w, int h); +/* Put every entry's rows back, newest first, and empty the journal. */ +void render_pass_journal_rollback(RenderPassJournal *j, uint16_t *vram, + int vram_w); +void render_pass_journal_free(RenderPassJournal *j); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/render_pass_projection.h b/overlay_toolchain/include/render_pass_projection.h new file mode 100644 index 00000000..cd8189a2 --- /dev/null +++ b/overlay_toolchain/include/render_pass_projection.h @@ -0,0 +1,32 @@ +#pragma once +#include +#ifdef __cplusplus +extern "C" { +#endif +struct CPUState; +typedef struct PSXProjectionHistory PSXProjectionHistory; +typedef struct PSXProjectionStats { + uint32_t captured, matched, changed, unmatched, discontinuities, overflow, replayed; +} PSXProjectionStats; +/* Capture the final model/view transforms that the game actually projects. + * Replay uses the same guest draw code, with interpolated transforms only for + * identified vertices. Unmatched vertices and camera cuts keep current state. + * A history belongs to one game drawing section; emulation thread only. */ +PSXProjectionHistory* psx_projection_create(uint32_t capacity); +void psx_projection_destroy(PSXProjectionHistory* history); +void psx_projection_invalidate(PSXProjectionHistory* history); +void psx_projection_reset_session(void); +void psx_projection_capture_begin(PSXProjectionHistory* history); +void psx_projection_capture_end(PSXProjectionHistory* history, uint32_t ticks, + double max_translation_per_tick); +void psx_projection_replay_begin(PSXProjectionHistory* history, uint32_t alpha_q16); +void psx_projection_replay_end(PSXProjectionHistory* history); +void psx_projection_stats(const PSXProjectionHistory* history, PSXProjectionStats* out); +/* GTE bridge: before RTPS/RTPT imports its registers. Returns nonzero only + * when a render pass temporarily replaced rotation/translation. The bridge + * restores those eight control registers after exporting command results. */ +int psx_projection_command(struct CPUState* cpu, uint32_t command); +extern int (*g_psx_projection_command)(struct CPUState*, uint32_t); +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/savestate.h b/overlay_toolchain/include/savestate.h new file mode 100644 index 00000000..0a4d9505 --- /dev/null +++ b/overlay_toolchain/include/savestate.h @@ -0,0 +1,156 @@ +#ifndef PSX_SAVESTATE_H +#define PSX_SAVESTATE_H + +#include +#include +#include "cpu_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * User save states (F7 save-state menu by default; 12 slots). + * + * A thin wrapper over boot_state.c's complete full-machine serializer + * (boot_state_save / boot_state_load — CPU/RAM/scratchpad/VRAM/SPU/CDROM/DMA/SIO/ + * timers/IRQ/clock/dirty-bitmap). Format is BOOT_STATE_VERSION 3: little-endian + * field wires portable across Win/Linux/macOS ARM (see pst_wire.h). Integrity + * key still rejects incompatible builds. The only additions here are: per-slot paths, + * deferred execution at a safe block-leader boundary (so cpu->pc is a valid + * resume PC and in_exception == 0), and a restore that unwinds to the scheduler + * and re-dispatches (psx_scheduler_resume_at). + */ + +#define SAVESTATE_SLOTS 12 +#define SAVESTATE_THUMB_W 128 +#define SAVESTATE_THUMB_H 96 + +/* Configure the slot directory + integrity key (from main, after config load). + * + * When bios_token is non-empty (e.g. "openbios" / "scph1001"): + * dir is the per-game memcard/save ROOT; slots land at + * //state__slotNN.pst. + * Loose legacy /state_*.pst files are migrated once by .pst header + * bios_checksum (openbios_wordsum → openbios/; else → scph1001/). + * + * When bios_token is NULL/empty: dir is used as-is (netplay guest sandbox / + * leave restore of an already-scoped path). */ +void savestate_configure(const char* dir, uint32_t bios_checksum, uint32_t entry_pc, + const char* bios_token, uint32_t openbios_wordsum); + +/* Scope savestates to one disc of a multi-image set. The disc appears as a + * token in the slot FILENAME inside the existing BIOS directory: + * //state__disc_slot.pst. Call before + * savestate_configure(). + * + * A savestate is whole-machine state, so restoring one taken on disc 2 while + * disc 1 is mounted resumes a guest that believes it is reading disc 2 -- the + * slot list gives no hint, because every disc of a set shares one entry_pc and + * the existing key is entry_pc. The BIOS stays a directory because a state is + * invalid across BIOS images whatever disc it came from; the disc only has to + * not collide within one, which a filename token does without another level to + * browse, back up and migrate. + * + * disc_number is 1-based; 0 disables scoping. Single-disc titles must pass 0 + * so their existing paths are untouched. */ +void savestate_set_disc_scope(int disc_number); + +/* Current slot directory (empty if not configured). */ +const char* savestate_dir(void); + +/* Memcard/save root remembered from the last bios-scoped configure + * (empty until a non-empty bios_token was passed). */ +const char* savestate_root_dir(void); + +/* Last bios_token / openbios_wordsum from a bios-scoped configure + * (token empty when never scoped; used to restore after netplay sandbox). */ +const char* savestate_bios_token(void); +uint32_t savestate_openbios_wordsum(void); + +/* Integrity key last passed to savestate_configure (for sandbox rebind). */ +void savestate_get_integrity(uint32_t* bios_checksum, uint32_t* entry_pc); + +/* Build the on-disk path for slot [0..SAVESTATE_SLOTS-1]. Returns 1 on success. */ +int savestate_slot_path(int slot, char* out, size_t cap); + +/* Read/write a slot file (malloc'd buffer for read). Returns 1 on success. */ +int savestate_read_slot(int slot, uint8_t** data_out, size_t* size_out); +int savestate_write_slot(int slot, const void* data, size_t size); + +/* 1 if the slot file exists and is non-empty. */ +int savestate_slot_exists(int slot); + +/* Slot file modified time, seconds since the Unix epoch. */ +int savestate_slot_mtime(int slot, int64_t* out_time); + +/* Per-slot screenshot thumbnails captured after a successful save. */ +int savestate_capture_thumb(int slot); +int savestate_read_thumb(int slot, uint32_t* out_argb, + int out_w, int out_h); + +/* 1 if the slot .pst header matches this build's integrity key (BIOS/entry/ + * codegen). 0 + optional reason when missing or stale — use before netplay + * load probe so incompatible saves never enter the post-load barrier. */ +int savestate_slot_compatible(int slot, char* reason, size_t reason_cap); + +/* Stage a save/load of slot [0..SAVESTATE_SLOTS-1]. Executed at the next safe + * boundary by savestate_poll (called every block from psx_check_interrupts). + * Safe to call from the SDL key handler or a debug-server command. + * Returns 1 if staged, 0 if refused (not configured, bad slot, LLE load, or + * netplay guest — only the match host may initiate user save/load). */ +int savestate_request_save(int slot); +int savestate_request_load(int slot); + +/* Netplay follow-host sync only. Bypasses the guest user-initiation guard so + * the guest can write/apply the host-authoritative slot during probe/transfer. */ +int savestate_request_save_protocol(int slot); +int savestate_request_load_protocol(int slot); + +/* Netplay LOAD transfer: stage an in-memory .pst (no disk write). Copied + * internally; applied by savestate_poll like a normal slot load. */ +int savestate_request_load_blob_protocol(const void* data, size_t size); + +/* 1 while a staged save/load has not yet been consumed by savestate_poll. */ +int savestate_pending(void); + +/* Machine-readable lifecycle receipt for deterministic debug harnesses. */ +void savestate_status_json(char* buf, size_t cap); + +/* 1 once after a successful load restore (before scheduler longjmp). Clears. */ +int savestate_take_load_completed(void); + +/* 1 once after a staged load failed in savestate_poll (missing/mismatched). + * Clears. Netplay uses this to abort the load barrier instead of hanging. */ +int savestate_take_load_failed(void); + +/* 1 once after a staged save failed in savestate_poll (no safe resume PC, + * I/O error, etc.). Clears. Netplay aborts SAVE coord instead of transferring + * a stale/null-PC .pst. */ +int savestate_take_save_failed(void); + +/* Resume PC stamped into the last successful slot save (0 if none / failed). */ +uint32_t savestate_last_save_pc(void); + +/* Frontend hook (main.cpp): restage VRAM present path after a successful load. */ +void psx_frontend_on_savestate_loaded(void); +/* Rollback snap apply: depth24 hold clear + restage without FMV cutover thrash. */ +void psx_frontend_on_rb_snap_loaded(void); + +/* Frontend hook (main.cpp): host OSD toast after a user save/load settles. + * is_load: 0 = save, 1 = load. slot is 0-based. ok: 1 on success. */ +void psx_frontend_on_savestate_notify(int is_load, int slot, int ok); +/* Frontend hook (main.cpp): a user save/load was refused before it was staged + * (so no notify follows). `reason` is short, plain text for the OSD. */ +void psx_frontend_on_savestate_refused(int is_load, int slot, const char *reason); + +/* Called every block from psx_check_interrupts (in_exception == 0). If a save is + * pending, serialize with cpu->pc = resume_pc; if a load is pending, restore and + * longjmp to the scheduler (never returns in that case). Near-free when idle. */ +void savestate_poll(CPUState* cpu, uint32_t resume_pc); + +#ifdef __cplusplus +} +#endif + +#endif /* PSX_SAVESTATE_H */ diff --git a/overlay_toolchain/include/sbi_registry.h b/overlay_toolchain/include/sbi_registry.h new file mode 100644 index 00000000..ba1d2b82 --- /dev/null +++ b/overlay_toolchain/include/sbi_registry.h @@ -0,0 +1,5 @@ +// Generated by tools/generate_sbi_registry.py. Metadata only; no SBI records. +#pragma once +static constexpr SbiRequirement kSbiRequirements[] = { + {712491360ULL, "dc3f29d7f7046fbdc85e8c376721a8880567f0cda309a52ee5da875ae9e40157", "ada8877a2a964eff2743d53cc043be0b7b148469b60de82fd1069f32700670eb", "Resident Evil 3: Nemesis", "SLES-02529"}, +}; diff --git a/overlay_toolchain/include/sbi_setup.h b/overlay_toolchain/include/sbi_setup.h new file mode 100644 index 00000000..7c4c698b --- /dev/null +++ b/overlay_toolchain/include/sbi_setup.h @@ -0,0 +1,142 @@ +// Launcher input validation only. The guest/runtime SBI reader is unchanged. +#pragma once +#include "psx_sha256.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace PSXRecompV4 { +struct SbiRequirement { + uint64_t size; + const char* data_sha256; + const char* sbi_sha256; + const char* title; + const char* serial; +}; +#include "sbi_registry.h" + +struct SbiSetupResult { + bool required = false; + bool ready = true; + std::string message; +}; + +inline std::string sbi_setup_hash(const std::filesystem::path& path) { + std::ifstream input(path, std::ios::binary); + if (!input) return {}; + psx_sha256_ctx ctx; + psx_sha256_init(&ctx); + std::array buffer; + while (input) { + input.read(reinterpret_cast(buffer.data()), buffer.size()); + psx_sha256_update(&ctx, buffer.data(), static_cast(input.gcount())); + } + if (!input.eof()) return {}; + uint8_t digest[32]; + psx_sha256_final(&ctx, digest); + std::string result; + for (auto byte : digest) { + result += "0123456789abcdef"[byte >> 4]; + result += "0123456789abcdef"[byte & 15]; + } + return result; +} + +inline SbiSetupResult check_sbi_setup( + const std::filesystem::path& data_track, const std::filesystem::path& mounted_image, + const SbiRequirement* requirements = kSbiRequirements, + size_t count = sizeof(kSbiRequirements) / sizeof(kSbiRequirements[0])) { + std::error_code error; + const auto size = std::filesystem::file_size(data_track, error); + if (error) return {}; // Existing disc validation owns unreadable media. + std::string data_hash; + for (size_t i = 0; i < count; ++i) { + const auto& rule = requirements[i]; + if (size != rule.size) continue; + if (data_hash.empty()) data_hash = sbi_setup_hash(data_track); + if (data_hash != rule.data_sha256) continue; + auto companion = mounted_image; + companion.replace_extension(".sbi"); + const bool exists = std::filesystem::is_regular_file(companion, error); + if (exists && sbi_setup_hash(companion) == rule.sbi_sha256) + return {true, true, {}}; + std::string message = std::string(rule.title) + " (" + rule.serial + ") needs a matching SBI file.\n\n"; + message += exists ? "The selected disc's SBI file does not match this supported revision.\n\n" + : "The SBI file is missing. It contains disc subchannel data required by this revision.\n\n"; + message += "Place your lawfully obtained matching SBI file here:\n" + companion.string(); + message += "\n\nThen select the disc again. Play remains blocked until the file matches." + "\nSetup does not supply or download SBI files."; + return {true, false, message}; + } + return {}; // Unknown revision, not proof that subchannels are complete. +} +// Stage only CUE metadata and the companion. The user's disc stays untouched. +inline std::filesystem::path import_sbi_setup( + const std::filesystem::path& data, const std::filesystem::path& mounted, + const std::filesystem::path& selected, const std::filesystem::path& destination, + const SbiRequirement* rules = kSbiRequirements, + size_t count = sizeof(kSbiRequirements) / sizeof(kSbiRequirements[0])) { + namespace fs = std::filesystem; + std::error_code ec; + const auto size = fs::file_size(data, ec); + if (ec) throw std::runtime_error("Select a readable disc first."); + const SbiRequirement* matched = nullptr; + std::string hash; + for (size_t i = 0; i < count; ++i) { + if (rules[i].size != size) continue; + if (hash.empty()) hash = sbi_setup_hash(data); + if (hash == rules[i].data_sha256) { matched = &rules[i]; break; } + } + if (!matched) throw std::runtime_error("The selected disc has no supported SBI requirement."); + if (sbi_setup_hash(selected) != matched->sbi_sha256) + throw std::runtime_error("This SBI file does not match the selected disc. Select its matching SBI file."); + std::string cue; + auto extension = mounted.extension().string(); + for (auto& c : extension) c = static_cast(std::tolower(static_cast(c))); + if (extension == ".cue") { + std::ifstream input(mounted); + if (!input) throw std::runtime_error("Cannot read the selected CUE file."); + const std::regex file_line(R"re(^(\s*FILE\s+)(?:"([^"]+)"|(\S+))(\s+.*)$)re", std::regex::icase); + std::string line; bool found = false; + while (std::getline(input, line)) { + if (!line.empty() && line.back() == '\r') line.pop_back(); + std::smatch match; + if (std::regex_match(line, match, file_line)) { + fs::path track(match[2].matched ? match[2].str() : match[3].str()); + if (track.is_relative()) track = mounted.parent_path() / track; + track = fs::absolute(track).lexically_normal(); + if (!fs::is_regular_file(track)) throw std::runtime_error("A CUE track file is missing."); + line = match[1].str() + "\"" + track.generic_string() + "\"" + match[4].str(); + found = true; + } + cue += line + "\n"; + } + if (!input.eof() || !found) throw std::runtime_error("Cannot import this CUE file."); + } else if (extension == ".bin") { + cue = "FILE \"" + fs::absolute(data).generic_string() + "\" BINARY\n TRACK 01 MODE2/2352\n INDEX 01 00:00:00\n"; + } else throw std::runtime_error("Select this disc's CUE or BIN file first."); + // Unique directory avoids replacing any existing disc or companion. + fs::create_directories(destination); + fs::path folder; + for (unsigned n = 1; n != 100000; ++n) { + auto candidate = destination / ("disc-" + std::to_string(n)); + if (fs::create_directory(candidate)) { folder = candidate; break; } + } + if (folder.empty()) throw std::runtime_error("Cannot create the SBI input folder."); + try { + fs::copy_file(selected, folder / "disc.sbi"); + if (sbi_setup_hash(folder / "disc.sbi") != matched->sbi_sha256) + throw std::runtime_error("The SBI file changed during import. Select it again."); + std::ofstream output(folder / "disc.cue", std::ios::binary); + output << cue; + output.close(); + if (!output) throw std::runtime_error("Cannot save the imported CUE file."); + } catch (...) { fs::remove_all(folder, ec); throw; } + return fs::absolute(folder / "disc.cue"); +} +} // namespace PSXRecompV4 diff --git a/overlay_toolchain/include/sio.h b/overlay_toolchain/include/sio.h new file mode 100644 index 00000000..ab17fd6b --- /dev/null +++ b/overlay_toolchain/include/sio.h @@ -0,0 +1,349 @@ +#ifndef PSXRECOMP_SIO_H +#define PSXRECOMP_SIO_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Logical pad count. Default 2 (port1=pad0, port2=pad1). + * PSX_MAX_PLAYERS 5..7: one SCPH-1070 (sio_set_multitap_port) + opposite pad. + * PSX_MAX_PLAYERS 8: dual multitap (port1 pads 0–3, port2 pads 4–7). */ +#ifndef PSX_MAX_PLAYERS +#define PSX_MAX_PLAYERS 2 +#endif +#if PSX_MAX_PLAYERS < 1 || PSX_MAX_PLAYERS > 8 +#error "PSX_MAX_PLAYERS must be in 1..8" +#endif + +/* Per-pad table initializer: repeat one element PSX_MAX_PLAYERS times. + * + * static uint16_t pad_buttons[PSX_MAX_PLAYERS] = { PSX_PAD_INIT(0xFFFF) }; + * + * GNU's [0 ... PSX_MAX_PLAYERS - 1] = x range designator says this in one + * token, but it is a GCC extension with no MSVC equivalent, so the element + * list is expanded by the preprocessor instead. Each PSX_PAD_REP_n is written + * flat rather than recursively so no nested macro call is involved and the + * expansion is identical under both the conforming and the traditional MSVC + * preprocessor. Variadic so a braced element ({ 0x80, 0x80, 0x80, 0x80 }) + * survives argument splitting. The 1..8 bound above is what makes the ladder + * finite; a value outside it fails the #error before reaching an undefined + * PSX_PAD_REP_n. The count always matches the array extent because both are + * spelled PSX_MAX_PLAYERS. */ +#define PSX_PAD_REP_1(...) __VA_ARGS__ +#define PSX_PAD_REP_2(...) __VA_ARGS__, __VA_ARGS__ +#define PSX_PAD_REP_3(...) __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ +#define PSX_PAD_REP_4(...) __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ +#define PSX_PAD_REP_5(...) \ + __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ +#define PSX_PAD_REP_6(...) \ + __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, \ + __VA_ARGS__ +#define PSX_PAD_REP_7(...) \ + __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, \ + __VA_ARGS__, __VA_ARGS__ +#define PSX_PAD_REP_8(...) \ + __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, \ + __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ +/* Two layers so PSX_MAX_PLAYERS expands to its value before the ## paste. */ +#define PSX_PAD_REP_JOIN(n, ...) PSX_PAD_REP_##n(__VA_ARGS__) +#define PSX_PAD_REP_EXPAND(n, ...) PSX_PAD_REP_JOIN(n, __VA_ARGS__) +#define PSX_PAD_INIT(...) PSX_PAD_REP_EXPAND(PSX_MAX_PLAYERS, __VA_ARGS__) + +/* SIO0 register base: 0x1F801040 */ +#define SIO_BASE 0x1F801040 + +/* Phase 1.0c-v2: cycle-paced SIO model. Default 1 enables the dispatch- + * loop quantum tick (gated by g_sio_timing_active). Set to 0 to revert + * to legacy access-paced behavior across all callers. */ +#ifndef SIO_MODEL_CYCLE_PACED +#define SIO_MODEL_CYCLE_PACED 1 +#endif + +void sio_init(void); + +/* MMIO read/write (0x1F801040-0x1F80104E) */ +uint32_t sio_read(uint32_t addr); +void sio_write(uint32_t addr, uint32_t value); + +/* Advance SIO timing by `cycles` PSX cycles. + * + * In cycle-paced mode (SIO_MODEL_CYCLE_PACED=1, default in 1.0c+): walks + * shift-complete and ACK-fire events scheduled in cycles ahead. In 1.0c + * the shifter is never armed (TX path still synchronous), so the body + * is effectively inert. Phase 1.0d will route TX through the shifter. + * + * The legacy access-paced IRQ countdown body always runs and is the + * actual IRQ delivery mechanism in 1.0c. */ +void sio_tick(int cycles); + +/* Convenience: advance SIO by the dispatch-loop quantum. Called from + * psx_check_interrupts inside !in_exception, gated by g_sio_timing_active + * (no-op when no SIO cycle-paced work is pending). No-op under macro=0. */ +void sio_tick_quantum(void); + +/* Hot-path active guard. Set to 1 when sio_shift / sio_pending_ack / + * buffer arms; cleared when all three empty. */ +extern volatile int g_sio_timing_active; + +/* Phase 1.0e-e1: peripheral-only cycle advance. Drives shifter+ack + * scheduler. Does NOT touch the legacy sio_irq_pending/countdown. Safe + * to call from psx_advance_cycles per emitted block. No-op when + * g_sio_timing_active is 0. */ +void sio_advance(uint32_t cycles); + +/* Cycle-budgeted precise event slicing: guest CPU cycles until a DELIVERABLE + * SIO IRQ (bit7 unmasked in i_mask). UINT32_MAX if none. */ +uint32_t sio_cycles_to_irq(uint32_t i_mask); + +/* Telemetry counters for sio_advance. */ +uint64_t sio_get_advance_called(void); +uint64_t sio_get_advance_with_work(void); + +/* SCPH-1070 multitap. Off by default. When enabled (PSX_MAX_PLAYERS>=5): + * multitap_port==0 (console Port 1): tap on phys0 → logical pads 0–3, + * phys1 → logical 4. + * multitap_port==1 (console Port 2): phys0 → logical 0, tap on phys1 → + * logical pads 1–4 (Bomberman Party Edition and a few others). + * Bulk 0x80 responses follow the real TAP/REQ latch (psx-spx): REQ=1 in the + * third command byte arms the *next* transfer; empty tap slots are fine. */ +void sio_set_multitap(int enabled); +int sio_get_multitap(void); +/* phys_port: 0 = console Port 1, 1 = console Port 2. Default 0. */ +void sio_set_multitap_port(int phys_port); +int sio_get_multitap_port(void); +/* Tomba-only legacy pad config path ([controller] legacy_pad_config). */ +void sio_set_legacy_cfg(int enabled); +int sio_get_legacy_cfg(void); +/* 1 when multitap is armed and `logical_slot` is a tap pad (not the lone + * pad on the opposite console port). SCPH-1070 taps are treated as plain + * digital controllers (0x41) by default — DualShock/analog on a tap is not + * reliable across titles. Opt in with sio_set_multitap_analog(1) (hack). */ +int sio_pad_on_multitap(int logical_slot); +/* Opt-in DualShock-on-tap hack. Off by default. When on, tap seats may + * report 0x73 + stick bytes in multitap bulk status (and host/netplay + * sampling stops forcing digital). game.toml [controller] multitap_analog / + * settings.toml / lobby match_caps may enable this. */ +void sio_set_multitap_analog(int enabled); +int sio_get_multitap_analog(void); + +/* Update pad button state. Buttons use PS1 convention: 0=pressed, 1=released. + Bit layout: SELECT, L3, R3, START, UP, RIGHT, DOWN, LEFT, + L2, R2, L1, R1, TRIANGLE, CIRCLE, CROSS, SQUARE + sio_set_pad_state targets logical pad 0; the _slot form targets + logical pad 0 .. PSX_MAX_PLAYERS-1. */ +void sio_set_pad_state(uint16_t buttons); +void sio_set_pad_state_slot(int slot, uint16_t buttons); + +/* Set the analog stick state + pad type for a logical pad. enabled selects the + * emulated pad: 0 = digital (poll id 0x41), 1 = DualShock/analog (poll id + * 0x73, with the four 0..255 stick axes appended; 0x80 = centred). */ +void sio_set_pad_analog(int slot, int enabled, + uint8_t lx, uint8_t ly, uint8_t rx, uint8_t ry); + +/* Per-frame input plumbing for the coherent-DualShock model. Update the sticks + * every frame with sio_set_pad_sticks; change the reported pad type with + * sio_request_pad_type (the emulated "analog button"), which is applied + * atomically at the next idle, non-config bus boundary so a hybrid stick/d-pad + * flip can never split a poll or a config handshake. Do NOT call + * sio_set_pad_analog every frame for the type — that is for boot/hotplug only. */ +void sio_set_pad_sticks(int slot, uint8_t lx, uint8_t ly, uint8_t rx, uint8_t ry); +void sio_request_pad_type(int slot, int analog); + +/* Connect / disconnect a logical pad (0 .. PSX_MAX_PLAYERS-1). By default no + * pads are connected during initial BIOS boot. */ +void sio_connect_pad(int slot); +void sio_set_pad_connected(int slot, int connected); + +/* Netplay / rematch: force a peer-identical pad topology + idle bus. + * Immediate digital (not deferred type_req), connected seats 0..slot_count-1, + * pad FSM IDLE, cleared response buffer. Call at session start and before + * dig0 snap so baseline_ext/sio pads cannot fork on local DualShock vs + * keyboard seeding. */ +void sio_netplay_canonicalize_session_pads(int slot_count); + +/* Declare whether the pad on a logical slot is a config-capable DualShock (1) + * or a plain digital controller (0). A real digital controller (SCPH-1080, + * poll id 0x41) does NOT answer the config-mode commands (0x43/0x44/0x45/ + * 0x46/0x47/0x4C/0x4D/0x4F) — it returns hi-z / no ACK, so a game's pad + * driver classifies it as digital-only and just polls with 0x42. A DualShock + * answers them. Set from the per-player pad mode (DIGITAL => 0, ANALOG/HYBRID + * => 1) at boot/hotplug. Default is 1 (config-capable) so existing + * analog/hybrid behaviour is unchanged. */ +void sio_set_pad_config_capable(int slot, int capable); + +/* Read the raw DualShock motor state selected by the guest's 0x4D rumble map + * and most recent 0x42 poll. `small` is the fixed-strength high-frequency + * motor byte; `large` is the variable-strength low-frequency motor byte. + * The frontend translates these values to its host controller API. */ +void sio_get_pad_rumble(int slot, uint8_t *small, uint8_t *large); + +/* Return current pad button state (for debug server). _slot targets a logical + * pad 0 .. PSX_MAX_PLAYERS-1. */ +uint16_t sio_get_pad_buttons(void); +uint16_t sio_get_pad_buttons_slot(int slot); + +/* Side-effect-FREE SIO register peeks for the debug/observability path ONLY. + * NEVER use these for the guest bus — the guest must call sio_read() (which keeps + * its hardware side effects: sio_tick, ACK-clear, RX-FIFO-pop). These let the + * debug server sample SIO without perturbing the pad/memcard handshake. */ +uint16_t sio_peek_stat(void); +uint16_t sio_peek_ctrl(void); +uint8_t sio_peek_rx_data(void); + +/* Debug accessors: is a logical pad connected, and is it in analog mode. */ +int sio_get_pad_connected(int slot); +int sio_get_pad_analog(int slot); +void sio_get_pad_sticks(int slot, uint8_t out[4]); + +/* ---- SIO byte-level trace ring buffer ---- + * 1M entries × ~28 B ≈ 32 MB. At ~600 byte/sec that's ~30 min of history. */ +#define SIO_TRACE_CAP (1 << 20) + +typedef struct { + uint32_t seq; /* monotonic sequence number */ + uint8_t tx; /* byte written to TX */ + uint8_t rx; /* byte produced in RX */ + uint8_t mc_state_pre; /* mc_state BEFORE processing */ + uint8_t mc_state_post; /* mc_state AFTER processing */ + uint8_t dev_pre; /* active_device BEFORE (0=NONE,1=PAD,2=MC) */ + uint8_t dev_post; /* active_device AFTER */ + uint16_t ctrl; /* CTRL register value */ + uint32_t func_addr; /* g_debug_current_func_addr */ + uint8_t was_abort; /* 1 if this byte caused mc_state abort */ + uint8_t irq_countdown; /* sio_irq_countdown at entry */ + uint8_t in_exception; /* psx_get_in_exception() at time of byte */ + uint8_t counter_7514; /* RAM[0x7514] at time of byte */ + uint32_t cop0_sr; /* COP0 SR at time of byte (IEc=bit0, IM2=bit10) */ + /* Saved slot states captured AT TRACE TIME (after the byte was processed + * and any mc_save/load_slot has run). Lets the audit show whether a + * SELECT-deassert preserved state into the next 0x81. */ + uint8_t slot0_state; + uint8_t slot1_state; +} SioTraceEntry; + +/* Get pointer to ring buffer and current write index. + * Returns number of entries ever written (seq of next write). */ +uint32_t sio_get_trace(const SioTraceEntry **buf_out, int *write_idx_out); + +/* Current SIO byte sequence — used by SIO PC tracer for cross-referencing. */ +uint32_t sio_get_seq(void); + +/* Returns 1 if a memcard protocol exchange is in progress on either + * slot. Callers (notably the VBlank scheduler) use this to defer + * interrupt delivery so the BIOS's pad polling routine — which fires + * from the VBlank handler — doesn't preempt an in-flight card + * transaction by issuing 0x01 on the SIO bus mid-read. */ +int sio_card_protocol_active(void); + +/* Post-probe handoff ring: diagnostic device state only, no guest-RAM probes. */ +typedef struct { + uint8_t kind; /* 1=probe_abort 2=b7_set 3=b7_clear 4=tx 5=card_ack */ + uint8_t byte; + uint16_t imask; + uint32_t pc; + uint32_t func; + uint32_t ctrl; + uint32_t stat; + uint32_t card_state; + uint64_t cyc; +} SioCardHandoffEntry; +const SioCardHandoffEntry *sio_get_card_handoff(int *idx_out, int *count_out); +int sio_card_handoff_cap(void); +int sio_card_handoff_armed(void); +void sio_card_handoff_on_imask(uint32_t old_mask, uint32_t new_mask); + +/* Netplay deferred-present coexistence: 1 while native memcard SIO is + * busy and still making progress. Callers keep s_present_pending and + * retry later so BB-edge finish_frame does not run mid card busy-wait + * (Ape Escape empty-starfield wedge; same class of risk on other titles). + * Returns 0 after ~10 VBlanks with no SIO seq progress so a wedged card + * FSM cannot stall commit forever (mirrors VBlank-for-SIO stale escape). */ +int sio_hold_present_for_card(void); + +/* Snapshot SIO IRQ-pacing internals for the freeze_check diagnostic. */ +void sio_get_freeze_diag(int *out_irq_pending, int *out_irq_countdown, + uint16_t *out_sio_stat, uint16_t *out_sio_ctrl, + int *out_card_active); + +/* ---- Card transaction ring buffer ---- + * + * One entry per card protocol transaction (0x81 → terminal state / abort). + * Always-on. 64K entries × ~544 B ≈ 35 MB — holds tens of minutes of card + * activity at typical detection-cycle rates. */ +#define SIO_TXN_CAP (1 << 16) +#define SIO_TXN_MAX_BYTES 256 + +typedef enum { + SIO_TXN_END_OPEN = 0, /* still in progress (only on the live txn) */ + SIO_TXN_END_SUCCESS = 1, /* mc_state reached IDLE via natural progression */ + SIO_TXN_END_ABORT_RESELECT= 2, /* 0x81 received while txn already non-IDLE */ + SIO_TXN_END_ABORT_RESET = 3, /* CTRL.RESET written */ + SIO_TXN_END_ABORT_SLOT = 4, /* slot mismatch reset (DEV_NONE non-0x81 path) */ + SIO_TXN_END_ABORT_BAD_CMD = 5, /* CMD byte not 0x52/0x57/0x53 */ + SIO_TXN_END_ABORT_OTHER = 6, /* state machine fell through */ +} SioTxnEndReason; + +typedef struct { + uint32_t txn_seq; /* monotonic transaction id */ + uint32_t start_byte_seq; /* SIO byte ring seq at first byte of txn */ + uint32_t end_byte_seq; /* SIO byte ring seq at last byte (inclusive) */ + uint32_t start_func; /* g_debug_current_func_addr at first byte */ + uint32_t end_func; /* g_debug_current_func_addr at last byte */ + uint8_t slot; /* mc_slot when txn opened */ + uint8_t cmd; /* 0x52/0x57/0x53 once observed; 0 before */ + uint16_t sector; /* 0xFFFF if address phase not reached */ + uint16_t ack_count; /* SIO ACKs returned during txn */ + uint8_t terminal_state; /* mc_state at termination */ + uint8_t end_reason; /* SioTxnEndReason */ + uint16_t byte_count; /* total bytes processed (may exceed MAX_BYTES) */ + uint8_t tx[SIO_TXN_MAX_BYTES]; + uint8_t rx[SIO_TXN_MAX_BYTES]; +} SioTxnEntry; + +/* Returns ring buffer + next-write index + whether a live txn is currently + * open. The live txn (when open_out=1) is NOT yet in the ring; query + * sio_get_card_txn_live() if you want it too. Total seq = number of CLOSED + * transactions ever recorded. */ +uint32_t sio_get_card_txns(const SioTxnEntry **buf_out, int *write_idx_out, int *open_out); + +/* Returns pointer to live (open) txn, or NULL if none. Lifetime: pointer + * is valid until the next sio_process_byte call. */ +const SioTxnEntry *sio_get_card_txn_live(void); + +/* ---- SIO IRQ #7 delivery ring ---- + * + * Captures every time IRQ #7 (SIO0) is raised into I_STAT. Always-on. + * 1M entries × ~64 B ≈ 64 MB — holds tens of minutes of IRQ history. */ +#define SIO_IRQ_RING_CAP (1 << 20) + +typedef enum { + SIO_IRQ_SRC_UNKNOWN = 0, + SIO_IRQ_SRC_CARD_ACK = 1, /* IRQ from card-side ACK after card byte */ + SIO_IRQ_SRC_PAD_ACK = 2, /* IRQ from pad-side ACK after pad byte */ +} SioIrqSource; + +typedef struct { + uint32_t seq; + uint32_t byte_seq; /* corresponding sio_trace_seq when this IRQ was scheduled */ + uint32_t i_stat_before; /* I_STAT just before raising bit 7 */ + uint32_t i_stat_after; /* I_STAT immediately after */ + uint32_t mc_state; /* mc_state at time of fire */ + uint32_t active_device; /* DEV_NONE/PAD/MEMCARD at time of fire */ + uint32_t ctrl; /* sio_ctrl at fire */ + uint32_t func_addr; /* g_debug_current_func_addr at fire */ + uint32_t counter_7514; /* card chain counter byte at fire */ + uint8_t source; /* SioIrqSource */ + uint8_t slot; /* selected_slot at fire */ + uint8_t delay_applied; /* the SIO_IRQ_DELAY_* value used */ + uint8_t pad; +} SioIrqEntry; + +uint32_t sio_get_irq_ring(const SioIrqEntry **buf_out, int *write_idx_out); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_SIO_H */ diff --git a/overlay_toolchain/include/spu.h b/overlay_toolchain/include/spu.h new file mode 100644 index 00000000..31bf7b96 --- /dev/null +++ b/overlay_toolchain/include/spu.h @@ -0,0 +1,191 @@ +#ifndef PSXRECOMP_SPU_H +#define PSXRECOMP_SPU_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void spu_init(void); +void spu_render(int16_t* out_stereo, int frames); + +typedef struct SpuDebugInfo { + uint32_t ctrl; + uint32_t active_mask; + int16_t main_l; + int16_t main_r; + int16_t cd_l; + int16_t cd_r; + uint32_t key_on_count; + uint64_t render_frames; + uint64_t nonzero_frames; + int32_t last_peak; + int32_t peak; + uint32_t cd_frames; + uint64_t cd_push_frames; + uint64_t cd_overflow_frames; + uint64_t cd_underflow_frames; +} SpuDebugInfo; + +void spu_debug_info(SpuDebugInfo* out); + +/* ---- Per-voice register snapshot. Mirrors the fields the Beetle oracle + * exposes via PS_SPU::GetRegister(GSREG_V0_*) so both backends produce a + * structurally-identical spu_voices payload that diff tooling can compare. */ +typedef struct SpuVoiceState { + int active; /* our internal "is voicing" flag (no ADSR yet) */ + uint16_t vol_ctrl_l; /* raw voice reg 0 */ + uint16_t vol_ctrl_r; /* raw voice reg 1 */ + uint16_t pitch; /* raw voice reg 2 */ + uint16_t start_lo; /* raw voice reg 3 (start_addr >> 3) */ + uint16_t adsr_lo; /* raw voice reg 5 */ + uint16_t adsr_hi; /* raw voice reg 6 */ + uint16_t loop_lo; /* raw voice reg 7 (loop_addr >> 3) */ + uint32_t cur_addr; /* current decode pointer (byte addr in SPU RAM) */ + uint32_t repeat_addr; /* effective loop point (byte addr in SPU RAM) */ + uint8_t last_flags; /* flag byte from most recently decoded block */ + uint8_t sample_idx; /* position inside the current 28-sample block */ + uint16_t phase; /* sub-sample phase counter (0..0x1000) */ + uint16_t env_level; /* live ADSR envelope level (0..0x7FFF) */ + uint8_t adsr_phase; /* 0=attack 1=decay 2=sustain 3=release */ + int16_t vol_cur_l; /* live effective L volume (sweep-aware, full int16) */ + int16_t vol_cur_r; /* live effective R volume (sweep-aware, full int16) */ +} SpuVoiceState; + +typedef struct SpuGlobalState { + uint16_t ctrl; /* SPUCONT (0x1F801DAA) */ + uint16_t main_vol_l; /* raw 0x1F801D80 */ + uint16_t main_vol_r; /* raw 0x1F801D82 */ + uint32_t kon_latch; /* last 24-bit KEYON value */ + uint32_t koff_latch; /* last 24-bit KEYOFF value */ + uint32_t pmon; /* pitch mod (0x1F801D90/92) */ + uint32_t non; /* noise mode (0x1F801D94/96) */ + uint32_t eon; /* reverb mode (0x1F801D98/9A) */ + uint32_t endx; /* end-block reached latch (0x1F801D9C/9E) */ + uint32_t active_mask; /* recomp-local "still voicing" mask */ + + /* ---- SPU DSP fidelity state (issue #103: IRQ/reverb/noise/sweeps) ---- */ + uint16_t irq_flag; /* SPU IRQ latch (mirrors SPUSTAT bit 6) */ + uint16_t reverb_on; /* SPUCNT bit 7 (reverb work-area write enable) */ + uint32_t irq_addr; /* IRQ address as a BYTE address (reg 0x1F801DA4 << 3) */ + uint32_t reverb_mbase; /* reverb work area start, byte address (mBASE << 3) */ + uint32_t reverb_cur; /* current reverb buffer address (byte, advances @22050Hz) */ + uint32_t capture_pos; /* capture-buffer write offset (0..0x3FE, wraps at 0x400) */ + uint16_t noise_lfsr; /* live noise shift register value */ + uint16_t noise_pad; /* reserved / alignment */ + uint32_t sweep_l_mask; /* voices whose LEFT volume register is in sweep mode */ + uint32_t sweep_r_mask; /* voices whose RIGHT volume register is in sweep mode */ + uint32_t sweep_main; /* bit0 = main L in sweep mode, bit1 = main R */ +} SpuGlobalState; + +void spu_get_voice_state(int voice, SpuVoiceState* out); +void spu_get_global_state(SpuGlobalState* out); +/* SPUCNT (0x1F801DAA) alone. The sample-event scheduler gates on one ctrl bit + * per device-service call; building the full SpuGlobalState there (register + * sweep + three 24-voice loops) was ~40% of emu-thread time during the Capcom + * FMV's MMIO-polling loop (gdb-sampled 2026-09-01). */ +uint16_t spu_ctrl_read(void); +/* Debug peek into SPU sample RAM (spu_ram TCP command). */ +uint32_t spu_ram_peek(uint32_t addr, uint8_t *out, uint32_t len); + +/* ---- Always-on per-voice event ring. Records KEYON, KEYOFF, voice + * end-flag-stop and end-flag-loop events with a frame timestamp. Allocated + * at spu_init; never armed/disarmed. Query the window of interest. */ +typedef enum { + SPU_EV_KEYON = 1, + SPU_EV_KEYOFF = 2, + SPU_EV_END_STOP = 3, /* loop_end without repeat → voice silenced */ + SPU_EV_END_LOOP = 4, /* loop_end with repeat → cur_addr=repeat_addr */ + SPU_EV_IRQ = 5 /* SPU RAM IRQ-address hit → I_STAT bit 9 raised; + voice=0xFF (not voice-attributable), addr=byte + address that matched */ +} SpuEventKind; + +typedef struct SpuEvent { + uint64_t seq; + uint32_t frame; + uint8_t kind; + uint8_t voice; + uint16_t pitch; + uint32_t addr; /* start_addr for KEYON; cur_addr for KEYOFF/END_*; repeat_addr for END_LOOP */ + uint16_t adsr_lo; + uint16_t adsr_hi; + uint16_t vol_l; + uint16_t vol_r; +} SpuEvent; + +uint64_t spu_event_total(void); +uint32_t spu_event_get(SpuEvent* out, uint32_t max_count); /* most recent up to max_count */ +void spu_event_reset(void); + +/* MMIO read/write (0x1F801C00-0x1F801FFF) */ +uint32_t spu_read(uint32_t addr); +void spu_write(uint32_t addr, uint32_t value); + +/* DMA channel 4 interface. spu_dma_read reads one 32-bit word from SPU RAM + * at the current transfer address, advances the address by 4, and runs the + * SPU IRQ-address check (SPU RAM -> CPU direction, DICR direction bit 0). */ +void spu_dma_write(uint32_t word); +uint32_t spu_dma_read(void); +int spu_dma_ready(void); + +/* CD-ROM XA/CDDA input path. Samples are stereo 44.1 kHz PCM entering the + * SPU CD input bus; SPU control bit 0 and CD volume registers gate output. */ +void spu_cd_audio_push(const int16_t* stereo, int frames); +void spu_cd_audio_reset(void); + +/* Get pointer to SPU RAM for direct access (512KB) */ +const uint8_t* spu_get_ram(void); + +/* ---- Verified-enhancement shadow tap (consumed by spu_shadow.c) --------- + * + * Present-time, opt-in float SPU re-render. When the shadow is enabled, + * spu_render fills a per-output-frame, per-voice tap with the exact inputs the + * canon used (the 4 decoded samples bracketing the sub-sample phase, the + * fractional phase, envelope level, and per-voice + main volumes). The shadow + * re-interpolates these in float. The layout MUST match spu.c's internal + * SpuShadowVoiceTap / SpuShadowFrameTap. */ +#define SPU_SHADOW_MAX_VOICES 24 + +typedef struct { + int16_t s[4]; /* decoded samples sample_idx-1 .. +2 (block-edge clamped) */ + float frac; /* fractional sub-sample phase in [0,1) */ + uint16_t env; /* env_level (0..0x7FFF) */ + int16_t vol_l; /* per-voice L volume, 1.14 scale (effective int16 >> 1) */ + int16_t vol_r; /* per-voice R volume, same scale */ + uint8_t active; +} SpuShadowVoiceTapPub; + +typedef struct { + SpuShadowVoiceTapPub voice[SPU_SHADOW_MAX_VOICES]; + int16_t main_l; + int16_t main_r; + int enabled; +} SpuShadowFrameTapPub; + +/* Pointer to the tap array (SpuShadowFrameTapPub[]) and the number of valid + * frames filled by the most recent spu_render block. */ +const void* spu_shadow_tap_buffer(void); +int spu_shadow_tap_count(void); + +uint32_t spu_snapshot_bytes(void); +void spu_snapshot_write(uint8_t *p); +int spu_snapshot_read(const uint8_t *p, uint32_t len); +uint8_t *spu_get_ram_ptr(void); +uint32_t spu_get_ram_bytes(void); + +/* Split digests of the snap wire (regs / voices / DSP tail) for Win↔Linux + * aux bisect. PSX_RB_SPU_PARTS=1 prints these on rb live dig. */ +typedef struct SpuSnapPartDigests { + uint32_t regs; + uint32_t voices; + uint32_t tail; +} SpuSnapPartDigests; +void spu_snapshot_part_digests(SpuSnapPartDigests *out); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_SPU_H */ diff --git a/overlay_toolchain/include/spu_gauss.h b/overlay_toolchain/include/spu_gauss.h new file mode 100644 index 00000000..8b933c44 --- /dev/null +++ b/overlay_toolchain/include/spu_gauss.h @@ -0,0 +1,104 @@ +/* spu_gauss.h - PS1 SPU hardware Gaussian interpolation table (512 entries). + * Values from No$PSX docs / DuckStation core/spu.cpp (SPU::Voice::Interpolate). + * Usage, with i = (phase >> 4) & 0xFF and s[0]=current, s[-1..-3]=history: + * out = (g[0x0FF-i]*s[-3] + g[0x1FF-i]*s[-2] + g[0x100+i]*s[-1] + g[i]*s[0]) >> 15 + */ +#ifndef PSX_SPU_GAUSS_H +#define PSX_SPU_GAUSS_H +#include +static const int16_t spu_gauss_table[512] = { + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + 0, 0, 0, 0, 0, 0, 0, 1, + 1, 1, 1, 2, 2, 2, 3, 3, + 3, 4, 4, 5, 5, 6, 7, 7, + 8, 9, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 21, 22, 24, + 25, 27, 28, 30, 32, 33, 35, 37, + 39, 41, 44, 46, 48, 51, 53, 56, + 58, 61, 64, 67, 70, 73, 77, 80, + 84, 87, 91, 95, 99, 103, 107, 111, + 116, 120, 125, 130, 135, 140, 145, 150, + 156, 161, 167, 173, 179, 186, 192, 199, + 205, 212, 219, 227, 234, 242, 250, 257, + 266, 274, 283, 291, 300, 309, 319, 328, + 338, 348, 358, 369, 379, 390, 401, 412, + 424, 436, 448, 460, 473, 485, 498, 512, + 525, 539, 553, 567, 582, 597, 612, 627, + 643, 659, 675, 692, 708, 726, 743, 761, + 779, 797, 816, 835, 854, 874, 894, 914, + 935, 956, 977, 999, 1020, 1043, 1066, 1089, + 1112, 1136, 1160, 1184, 1209, 1234, 1260, 1286, + 1312, 1339, 1366, 1394, 1422, 1450, 1479, 1508, + 1537, 1567, 1598, 1628, 1660, 1691, 1723, 1756, + 1789, 1822, 1856, 1890, 1924, 1959, 1995, 2031, + 2067, 2104, 2141, 2179, 2217, 2256, 2295, 2334, + 2374, 2415, 2456, 2497, 2539, 2582, 2624, 2668, + 2712, 2756, 2801, 2846, 2892, 2938, 2985, 3032, + 3079, 3128, 3176, 3225, 3275, 3325, 3376, 3427, + 3479, 3531, 3584, 3637, 3691, 3745, 3799, 3855, + 3910, 3967, 4023, 4081, 4138, 4197, 4255, 4315, + 4374, 4435, 4495, 4557, 4619, 4681, 4744, 4807, + 4871, 4935, 5000, 5065, 5131, 5197, 5264, 5332, + 5399, 5468, 5536, 5606, 5676, 5746, 5817, 5888, + 5959, 6032, 6104, 6177, 6251, 6325, 6400, 6475, + 6550, 6626, 6702, 6779, 6856, 6934, 7012, 7091, + 7170, 7249, 7329, 7409, 7490, 7571, 7653, 7735, + 7817, 7900, 7983, 8066, 8150, 8234, 8319, 8404, + 8489, 8575, 8661, 8748, 8834, 8922, 9009, 9097, + 9185, 9273, 9362, 9451, 9541, 9630, 9720, 9811, + 9901, 9992, 10083, 10174, 10266, 10358, 10450, 10542, + 10635, 10727, 10820, 10913, 11007, 11100, 11194, 11288, + 11382, 11476, 11571, 11665, 11760, 11855, 11950, 12045, + 12140, 12236, 12331, 12427, 12522, 12618, 12714, 12809, + 12905, 13001, 13097, 13193, 13289, 13385, 13481, 13577, + 13673, 13769, 13865, 13961, 14056, 14152, 14248, 14343, + 14439, 14534, 14630, 14725, 14820, 14915, 15010, 15104, + 15199, 15293, 15387, 15481, 15575, 15669, 15762, 15855, + 15948, 16041, 16133, 16226, 16317, 16409, 16500, 16592, + 16682, 16773, 16863, 16953, 17042, 17131, 17220, 17308, + 17396, 17484, 17571, 17658, 17744, 17830, 17916, 18001, + 18086, 18170, 18254, 18337, 18420, 18502, 18584, 18665, + 18746, 18826, 18905, 18985, 19063, 19141, 19219, 19295, + 19372, 19447, 19522, 19597, 19671, 19744, 19816, 19888, + 19959, 20030, 20100, 20169, 20238, 20306, 20373, 20439, + 20505, 20570, 20634, 20698, 20760, 20822, 20884, 20944, + 21004, 21063, 21121, 21178, 21235, 21290, 21345, 21399, + 21452, 21505, 21556, 21607, 21657, 21706, 21754, 21801, + 21848, 21893, 21938, 21982, 22025, 22066, 22107, 22148, + 22187, 22225, 22262, 22299, 22334, 22369, 22402, 22435, + 22467, 22498, 22527, 22556, 22584, 22611, 22637, 22662, + 22686, 22709, 22731, 22752, 22772, 22791, 22809, 22826, + 22842, 22857, 22872, 22885, 22897, 22908, 22918, 22927, + 22935, 22942, 22948, 22953, 22957, 22960, 22962, 22963, +}; + +/* Interpolate the current decoded sample using the SPU's four-tap Gaussian + * filter. previous[] is the final three samples from the preceding ADPCM + * block, oldest first; sample_index must address samples[]. */ +static inline int16_t spu_gaussian_interpolate(const int16_t previous[3], + const int16_t samples[28], + int sample_index, + uint32_t phase) +{ + const int gaussian_index = (int)((phase >> 4) & 0xFFu); + static const int tap_offset[4] = { 3, 2, 1, 0 }; + int32_t accumulator = 0; + + for (int tap = 0; tap < 4; ++tap) { + const int offset = sample_index - tap_offset[tap]; + const int16_t sample = offset >= 0 ? samples[offset] + : previous[3 + offset]; + int coefficient_index; + switch (tap) { + case 0: coefficient_index = 0x0FF - gaussian_index; break; + case 1: coefficient_index = 0x1FF - gaussian_index; break; + case 2: coefficient_index = 0x100 + gaussian_index; break; + default: coefficient_index = gaussian_index; break; + } + accumulator += (int32_t)spu_gauss_table[coefficient_index] * sample; + } + + return (int16_t)(accumulator >> 15); +} +#endif /* PSX_SPU_GAUSS_H */ diff --git a/overlay_toolchain/include/spu_shadow.h b/overlay_toolchain/include/spu_shadow.h new file mode 100644 index 00000000..e4ffbafc --- /dev/null +++ b/overlay_toolchain/include/spu_shadow.h @@ -0,0 +1,77 @@ +/* spu_shadow.h — verified-enhancement float re-render of the SPU voice mix. + * + * A higher-fidelity reimplementation of the PS1 SPU's per-voice ADPCM playback + * that runs ALONGSIDE the faithful spu.c hardware model. Where the hardware + * resamples each voice with a 4-point Gaussian table (deliberately muffled) and + * truncates the mix to int16 at every step, the shadow keeps everything in + * float and resamples with a 4-point cubic (Catmull-Rom) kernel — no muffling, + * no intermediate requantization. + * + * It is NOT ground truth. The canon spu.c mix stays the authoritative output + * AND the verify oracle. The shadow is fed, sample-for-sample, into a + * ShadowVerifier against the canon stream; it only substitutes after a proven + * window and reverts LOUDLY (logs DEGRADED) the instant correlation/level + * breaks. Opt-in via PSX_AUDIO_SHADOW=1, default OFF — with it off, spu_render + * output is byte-identical to upstream (this module is never entered). + * + * This file consumes the live per-voice state that spu.c already maintains via + * a small read-only accessor (spu_shadow_voice_snapshot); it does not duplicate + * the SPU register decode. ADSR envelope, key-on/off, and SPU RAM contents all + * come from the canon model, so the shadow can never diverge in WHICH note + * plays — only in the interpolation/headroom of HOW it is rendered. + * + * See docs/internal/PRINCIPLES.md "Verified-Enhancement HLE Is Allowed; Load-Bearing HLE Is + * Not" and docs/SHADOW_ENHANCEMENTS.md. ShadowVerifier attribution: see + * audio_shadow.h. + */ + +#ifndef PSXRECOMP_SPU_SHADOW_H +#define PSXRECOMP_SPU_SHADOW_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Config/launcher gate. Sets the enable state the feature uses when the + * PSX_AUDIO_SHADOW env var is NOT set (env still wins for debug). Call before + * spu_init() so spu_shadow_reset() records the right state. Default OFF. */ +void spu_shadow_set_enabled(int on); + +/* Returns true if the shadow is enabled. Precedence: PSX_AUDIO_SHADOW env + * (if set) overrides the config value set via spu_shadow_set_enabled(). */ +bool spu_shadow_enabled(void); + +/* Called once per spu_init() to (re)create verifier + per-voice resampler + * state. Cheap; safe to call when disabled (no-op). */ +void spu_shadow_reset(void); + +/* Drive the shadow for one render block. `canon` is the int16 stereo mix that + * spu.c just produced (frames*2 samples, the authoritative output). The shadow + * re-renders the same block in float from live voice state, feeds (canon, + * shadow) to the verifier per frame, and — only while proven — overwrites + * `canon` in place with the float mix (clamped to int16). If the verifier + * reverts, it logs a DEGRADED line and leaves `canon` untouched. + * + * No-op (canon untouched, byte-identical) when the feature is disabled. */ +void spu_shadow_process(int16_t* canon, int frames); + +/* Diagnostics for the debug server / tests. */ +typedef struct { + int enabled; + int proven; + uint64_t pauses; + float last_r; /* last window correlation */ + float last_ratio; /* last window level ratio */ + float gain; /* calibrated shadow gain */ + char last_revert[160]; +} SpuShadowInfo; +void spu_shadow_get_info(SpuShadowInfo* out); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_SPU_SHADOW_H */ diff --git a/overlay_toolchain/include/starvation_ring.h b/overlay_toolchain/include/starvation_ring.h new file mode 100644 index 00000000..ed2baf18 --- /dev/null +++ b/overlay_toolchain/include/starvation_ring.h @@ -0,0 +1,143 @@ +/* + * starvation_ring.h — Always-on diagnostic ring for capturing SIO/MMIO + * state immediately before a TCP-starvation hang. + * + * Phase 1.0e-e2 debug aid. Scope: diagnostic-only. Records every SIO MMIO + * event (TX_DATA write, RX read, STAT read, CTRL write) plus a snapshot + * of all SIO bus state at that moment. Watchdog monitors host wall-clock + * since last debug_server_poll; if it exceeds a threshold, the ring is + * flushed to disk and the process aborts cleanly so the dump survives. + * + * NOT for permanent use. Disabled by setting STARVATION_RING_ENABLED=0. + */ +#ifndef PSXRECOMP_STARVATION_RING_H +#define PSXRECOMP_STARVATION_RING_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef STARVATION_RING_ENABLED +# ifdef PSX_NO_DEBUG_TOOLS +# define STARVATION_RING_ENABLED 0 +# else +# define STARVATION_RING_ENABLED 1 +# endif +#endif + +#define STARVATION_RING_CAP (1 << 14) /* 16K entries */ + +typedef enum { + SR_EVT_NONE = 0, + SR_EVT_TX_DATA_WRITE = 1, + SR_EVT_RX_DATA_READ = 2, + SR_EVT_STAT_READ = 3, + SR_EVT_CTRL_WRITE = 4, + SR_EVT_MODE_WRITE = 5, + SR_EVT_BAUD_WRITE = 6, + SR_EVT_SHIFT_START = 7, + SR_EVT_BUFFER_LOAD = 8, + SR_EVT_TX_DROPPED = 9, + SR_EVT_SHIFT_DONE = 10, + SR_EVT_ACK_FIRE = 11, + SR_EVT_SELECT_ASSERT = 12, + SR_EVT_SELECT_DEASS = 13, + SR_EVT_RESET = 14, + SR_EVT_PC_SAMPLE = 15, /* periodic PC sample, no MMIO event */ +} StarvationEventKind; + +typedef struct { + uint64_t seq; /* monotonic sequence */ + uint64_t psx_cycle_count; /* guest cycle clock at event */ + uint64_t host_us; /* host monotonic time in microseconds */ + uint32_t current_func; /* g_debug_current_func_addr */ + uint32_t last_store_pc; /* g_debug_last_store_pc */ + uint16_t sio_ctrl; + uint16_t sio_stat; + uint8_t tx_data; /* on TX_DATA writes; else 0 */ + uint8_t rx_data; /* on RX_DATA reads; else 0 */ + uint8_t kind; /* StarvationEventKind */ + uint8_t in_exception; + uint8_t shift_active; + uint8_t tx_buffered; + uint8_t pending_ack; + uint8_t bus_owner; /* SioBusOwner */ + uint8_t active_device; /* DEV_NONE/PAD/MEMCARD */ + uint8_t mc_state; + uint8_t pad_state; + uint8_t selected_slot; + uint8_t g_sio_timing_active; + uint8_t tx_rdy_visible; /* (sio_stat & 1) at event time */ + uint8_t tx_em_visible; /* (sio_stat & 4) at event time */ + uint8_t pad8; + uint16_t pad16; + int shift_remaining; /* cycles left on shifter */ + int ack_remaining; /* cycles left on ack */ + uint32_t bus_byte_index; + uint32_t i_stat; + uint32_t i_mask; +} StarvationEntry; + +void starvation_ring_record(uint8_t kind, uint8_t tx, uint8_t rx, + uint16_t ctrl, uint16_t stat, + int shift_active, int shift_remaining, + int tx_buffered, int pending_ack, + int ack_remaining, + uint8_t bus_owner, uint32_t bus_byte_index, + uint8_t active_device, uint8_t mc_state, + uint8_t pad_state, uint8_t selected_slot, + int g_sio_timing_active); + +/* Watchdog: call from debug_server_poll() to refresh the heartbeat. + * If too much wall-time passes without a refresh AND the BIOS is + * actively running (post-boot), the ring is dumped and the process + * aborts. */ +void starvation_watchdog_heartbeat(void); + +/* Run watchdog check from a hot path (e.g. psx_advance_cycles). */ +void starvation_watchdog_check(void); + +/* Pure staleness decision behind starvation_watchdog_check(), exposed so a + * unit test can pin it without linking the ring. + * + * The heartbeat is stamped from two threads (emu thread per vblank, and the + * debug-server IO thread on every send() chunk), while the check runs on the + * emu thread. A stamp landing between the check's clock sample and its + * heartbeat load makes `last > now`; the old open-coded `now - last` wrapped + * to ~1.8e19, beat any threshold, and exited a healthy runtime (BoF3 + * 2026-09-02: 402 us of real staleness tripped a 4 s watchdog). Callers must + * therefore load `last` BEFORE sampling `now`, and this function refuses a + * negative gap by construction. Returns 1 when the watchdog should fire. + * `timeout == 0` disables it; `last == 0` means "no heartbeat yet". */ +static inline int starvation_watchdog_stale(uint64_t last, uint64_t now, + uint64_t timeout) { + if (last == 0 || timeout == 0) return 0; + if (now <= last) return 0; + return (now - last) > timeout; +} + +/* Manual dump-to-file (for testing / TCP probe). Filename can be NULL. */ +void starvation_ring_dump(const char *path); + +/* Rematch / session_reboot: clear ring + watchdog so a prior match cannot + * poison the next dump or leave s_dump_done set. */ +void starvation_ring_reset(void); + +/* Periodic PC sample. Caller responsible for throttling. */ +void starvation_ring_pc_sample(void); + +/* Ring query (TCP `starv_ring`): total events recorded so far, and a copy + * of the entry with sequence number `seq` (0 = first ever). Returns 1 and + * fills *out when `seq` is still resident in the ring; 0 when evicted or + * not yet written. Same-thread with the writers (emu/main thread), so the + * copy is tear-free. */ +uint64_t starvation_ring_total(void); +int starvation_ring_get(uint64_t seq, StarvationEntry *out); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_STARVATION_RING_H */ diff --git a/overlay_toolchain/include/text_xlate.h b/overlay_toolchain/include/text_xlate.h new file mode 100644 index 00000000..7cc42900 --- /dev/null +++ b/overlay_toolchain/include/text_xlate.h @@ -0,0 +1,96 @@ +/* text_xlate.h — on-the-fly string translation / localization (framework). + * + * A reusable psxrecomp feature: capture the game's source strings from guest + * memory and substitute translated bytes on the fly so a JP-only title can be + * played in the target language. See docs/STRING_TRANSLATION.md for the design. + * + * Mechanism (all always-on, hung off the psx_dispatch chokepoint): + * - CAPTURE: on every dispatch, scan the arg registers for pointers to source + * text records (encoding-profile validated). Every distinct record is hashed + * (FNV-1a64) and recorded into an in-memory inventory ring queryable over the + * TCP debug server (the "enumerate every string" authoring source). Never + * arm-then-run — the ring records from boot; the debug command queries it. + * - APPLY: when an arg points at a record present in the loaded translation + * table, transcode the target-language string to the game's glyph codes, + * write it into transient guest-stack scratch (below $sp), and repoint the + * arg register — the ORIGINAL draw routine then renders the replacement. + * KV-gated, so a stray pointer that isn't in the table is left untouched. + * - GLYPH-LABEL PATCH: UI text drawn glyph-by-glyph from a fixed-stride, + * space-padded EXE table (level/stage names) has no string pointer and no + * terminator, so the arg-scan hook can never see it. Instead each confirmed + * slot is patched in guest RAM once the EXE region is resident: verify the + * expected JP bytes are present, then overwrite exactly the slot width with + * target-language fullwidth Shift-JIS re-padded to that width. The game's own + * per-glyph routine then draws the translation. Fed by [[glyph_label]] TOML + * entries; gated on language; never spills past the confirmed slot bounds. + * - VRAM-STRIP PATCH: some UI text is PRE-RENDERED PIXELS in a texture asset + * (e.g. Tsumu's HUD labels live in the glyph-sheet image the game uploads to + * VRAM and samples with quads) — there are no glyph codes anywhere, so + * neither hook above can ever see it. Instead the patch rides the game's own + * upload: on completion of every CPU→VRAM image transfer (GP0 0xA0) any + * configured rect contained in the upload is verified against its expected + * JP pixels and, only on an exact match, rewritten with the target-language + * pixels through the same renderer write path (software/GL/supersample + * coherent). Re-applies automatically whenever the game re-uploads the + * asset — this is a source-path patch, not a one-shot VRAM poke. Fed by + * [[vram_patch]] TOML entries; gated on language; verify-before-patch. + * + * Encoding is abstracted behind an EncodingProfile (validator + terminator rules + * + UTF-8 -> glyph transcoder) selected per title; Tsumu uses the shift_jis + * profile. No generated-code edits, no regen: the hook is called from + * fntrace_record (runtime source), so it works in Release. + */ +#ifndef PSXRECOMP_TEXT_XLATE_H +#define PSXRECOMP_TEXT_XLATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct CPUState; + +/* Called at the top of every psx_dispatch iteration (from fntrace_record), + * BEFORE the target function runs, with cpu->gpr[4..7] holding this call's + * args. Cheap no-op when the module is uninitialised or disarmed. */ +void text_xlate_on_dispatch(struct CPUState* cpu, uint32_t target); + +/* One-time init. Loads every translations/ *.toml under project_root and + * selects the active `language` column. language "jp"/"off"/"" (or no tables) + * disables APPLY; CAPTURE still runs (always-on inventory). The PSX_LANG env + * var overrides `language` when set. Safe to call once at startup; copies what + * it needs. */ +void text_xlate_init(const char* project_root, const char* language); + +/* Switch the active language and reload the translation tables. For the launcher: + * text_xlate_init runs at config-load (before the launcher), so the launcher's + * chosen language is re-applied through this after it returns. "jp"/"off"/"" + * disables APPLY (untranslated native game). PSX_LANG env still wins if set. + * No-op if `language` matches the already-active one. Thread-safe. */ +void text_xlate_set_language(const char* language); + +/* Called by the GPU on completion of every CPU→VRAM image upload (GP0 0xA0) + * with the upload rect in VRAM halfword coords. Applies any [[vram_patch]] + * whose rect is contained in the upload (verify-then-patch). Cheap no-op when + * no patches are loaded or the language is off. */ +void text_xlate_vram_upload(int x, int y, int w, int h); + +/* Debug-server surface (observability; no log files — Rule 3). subcmd: + * "stats" -> counters (calls, hits, distinct captured, table size, lang) + * "dump" -> JSON array of every captured record {hash, addr, pc, len, + * count, translated, sjis_hex} — the authoring inventory + * "todo" -> JSON array of captured records with NO table entry yet + * "glyph" -> JSON array of per-glyph label RAM-patch slots {addr, width, + * patched, en} — status of the glyph-label source-patch layer + * "vpatch" -> force-apply every [[vram_patch]] against current VRAM (verify + * still gates each) + per-patch status {x,y,w,h,applied} + * "reload" -> re-read the translation table from disk + * Returns bytes written into out (<= cap). */ +int text_xlate_debug_json(const char* subcmd, char* out, int cap); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_TEXT_XLATE_H */ diff --git a/overlay_toolchain/include/timers.h b/overlay_toolchain/include/timers.h new file mode 100644 index 00000000..3f67ff7c --- /dev/null +++ b/overlay_toolchain/include/timers.h @@ -0,0 +1,39 @@ +#ifndef PSXRECOMP_TIMERS_H +#define PSXRECOMP_TIMERS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TIMER_BASE 0x1F801100 + +void timers_init(void); +void timers_get_snapshot(uint16_t counter[3], uint32_t mode[3], + uint16_t target[3], int32_t irq_line[3], + uint32_t frac[3]); +void timers_set_snapshot(const uint16_t counter[3], const uint32_t mode[3], + const uint16_t target[3], const int32_t irq_line[3], + const uint32_t frac[3]); + +/* MMIO read/write for 0x1F801100..0x1F80112F. + * Accepts 16-bit or 32-bit access (caller zero-extends). */ +uint32_t timers_read(uint32_t addr); +void timers_write(uint32_t addr, uint32_t value); + +/* Advance all timers by guest CPU cycles. Used by native block-cycle builds. */ +void timers_advance(uint32_t cycles); + +/* Cycle-budgeted precise event slicing: guest CPU cycles until a timer raises a + * DELIVERABLE IRQ (unmasked in i_mask + mode-armed). UINT32_MAX if none. */ +uint32_t timers_cycles_to_irq(uint32_t i_mask); + +/* Legacy coarse tick used by interpreter/oracle builds. */ +void timers_tick(int cycles); + +#ifdef __cplusplus +} +#endif + +#endif /* PSXRECOMP_TIMERS_H */ diff --git a/overlay_toolchain/include/window_fullscreen.h b/overlay_toolchain/include/window_fullscreen.h new file mode 100644 index 00000000..2a74dd5c --- /dev/null +++ b/overlay_toolchain/include/window_fullscreen.h @@ -0,0 +1,98 @@ +#pragma once + +#include "psx_sdl.h" + +/* On Windows/SDL3, borderless stays a normal desktop-sized window. Other + * window managers retain native desktop fullscreen (Wayland owns placement). */ +struct PsxWindowFullscreen { + int mode = 0; + int x = 0, y = 0, width = 0, height = 0; + bool maximized = false; + bool bordered = true; + bool resizable = true; + bool cursor_visible = true; +}; + +static inline int psx_window_fullscreen_set(SDL_Window* window, + PsxWindowFullscreen* state, int mode) +{ + if (!window || !state || mode < 0 || mode > 2) return -1; + if (state->mode == mode) return 0; + if (state->mode == 0) { + const auto flags = SDL_GetWindowFlags(window); + state->maximized = (flags & SDL_WINDOW_MAXIMIZED) != 0; + state->bordered = (flags & SDL_WINDOW_BORDERLESS) == 0; + state->resizable = (flags & SDL_WINDOW_RESIZABLE) != 0; + if (state->maximized) { + SDL_RestoreWindow(window); +#if defined(PSX_SDL3) + SDL_SyncWindow(window); +#endif + } + SDL_GetWindowPosition(window, &state->x, &state->y); + SDL_GetWindowSize(window, &state->width, &state->height); +#if defined(PSX_SDL3) + state->cursor_visible = SDL_CursorVisible(); +#else + state->cursor_visible = SDL_ShowCursor(SDL_QUERY) == SDL_ENABLE; +#endif + } + + SDL_Rect desktop{}; +#if defined(PSX_SDL3) + const SDL_DisplayID display = SDL_GetDisplayForWindow(window); + if (mode == 1 && (!display || !SDL_GetDisplayBounds(display, &desktop))) return -1; + SDL_DisplayMode exclusive{}; + if (mode == 2) { + const SDL_DisplayMode* current = SDL_GetDesktopDisplayMode(display); + if (!current || !SDL_GetClosestFullscreenDisplayMode(display, current->w, + current->h, current->refresh_rate, true, &exclusive)) return -1; + } + if (!SDL_SetWindowFullscreen(window, false)) return -1; + if (!SDL_SetWindowFullscreenMode(window, mode == 2 ? &exclusive : nullptr)) return -1; +#else + const int display = SDL_GetWindowDisplayIndex(window); + if (mode == 1 && (display < 0 || SDL_GetDisplayBounds(display, &desktop) != 0)) return -1; + if (SDL_SetWindowFullscreen(window, 0) != 0) return -1; +#endif + /* Maximized windows can ignore manual geometry; restore before resizing. */ + SDL_RestoreWindow(window); +#if defined(PSX_SDL3) + SDL_SyncWindow(window); +#endif + if (mode == 1) { +#if defined(_WIN32) && defined(PSX_SDL3) + SDL_SetWindowBordered(window, SDL_FALSE); + SDL_SetWindowResizable(window, SDL_FALSE); + SDL_SetWindowPosition(window, desktop.x, desktop.y); + SDL_SetWindowSize(window, desktop.w, desktop.h); + SDL_SyncWindow(window); +#elif defined(PSX_SDL3) + if (!SDL_SetWindowFullscreen(window, true)) return -1; +#else + if (SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) return -1; +#endif + } else { + SDL_SetWindowBordered(window, state->bordered ? SDL_TRUE : SDL_FALSE); + SDL_SetWindowResizable(window, state->resizable ? SDL_TRUE : SDL_FALSE); + SDL_SetWindowSize(window, state->width, state->height); + SDL_SetWindowPosition(window, state->x, state->y); + if (mode == 2) { +#if defined(PSX_SDL3) + if (!SDL_SetWindowFullscreen(window, true)) return -1; +#else + if (SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN) != 0) return -1; +#endif + } else if (state->maximized) { + SDL_MaximizeWindow(window); + } + } + state->mode = mode; +#if defined(PSX_SDL3) + if (mode || !state->cursor_visible) SDL_HideCursor(); + else SDL_ShowCursor(); +#else + SDL_ShowCursor(mode || !state->cursor_visible ? SDL_DISABLE : SDL_ENABLE); +#endif + return 0; +} diff --git a/overlay_toolchain/include/window_size.h b/overlay_toolchain/include/window_size.h new file mode 100644 index 00000000..febe87b7 --- /dev/null +++ b/overlay_toolchain/include/window_size.h @@ -0,0 +1,42 @@ +/* window_size.h — the game window's opening size. + * + * Pure arithmetic over the display's usable bounds, kept out of main.cpp so a + * test can pin it without SDL. + * + * An explicit width (game.toml / settings.toml / launcher) is honoured, + * clamped to the usable area. With no width, the window opens at a whole + * multiple of the PS1's native 240 lines that takes about two thirds of the + * usable height: a normal window that scales with the panel, instead of a + * maximised one that covers the desktop. The multiple is computed from + * physical pixels (the runtime is per-monitor DPI aware), so a 4K or 8K + * panel still gets a proportionally large image. */ +#pragma once + +#define PSX_WINDOW_NATIVE_LINES 240 +#define PSX_WINDOW_DEFAULT_HEIGHT_NUM 2 /* default height <= 2/3 of usable */ +#define PSX_WINDOW_DEFAULT_HEIGHT_DEN 3 +#define PSX_WINDOW_MIN_WIDTH 640 + +/* In: *w = requested width (<= 0 means no explicit choice). have_bounds / + * bounds_w / bounds_h = the display's usable area. num:den = present aspect. + * Out: *w, *h = the client size to open. */ +static inline void psx_window_size(int* w, int* h, int num, int den, + int have_bounds, int bounds_w, int bounds_h) { + int width = *w; + if (width <= 0) { + int scale = 2; + if (have_bounds) { + scale = (bounds_h * PSX_WINDOW_DEFAULT_HEIGHT_NUM) / + (PSX_WINDOW_DEFAULT_HEIGHT_DEN * PSX_WINDOW_NATIVE_LINES); + if (scale < 2) scale = 2; + } + width = PSX_WINDOW_NATIVE_LINES * scale * num / den; + } + if (width < PSX_WINDOW_MIN_WIDTH) width = PSX_WINDOW_MIN_WIDTH; + if (have_bounds) { + if (width > bounds_w) width = bounds_w; + if (width * den / num > bounds_h) width = bounds_h * num / den; + } + *w = width; + *h = width * den / num; +} diff --git a/overlay_toolchain/include/ws_aspect_cone_math.h b/overlay_toolchain/include/ws_aspect_cone_math.h new file mode 100644 index 00000000..abb3adac --- /dev/null +++ b/overlay_toolchain/include/ws_aspect_cone_math.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Test whether a camera-relative vector is inside a rectangular view cone. + * + * Coordinates use Tomba 2's X,Z,Y ordering. The camera forward vector is Q12. + * `threshold` is the game's Q10 cosine threshold (the SLTI immediate after its + * normalized dot product). `extent_pixels` expands only the horizontal + * half-angle from the vanilla 160-pixel half-width; the vertical half-angle is + * unchanged. + */ +int psx_ws_aspect_cone_contains(int32_t x, int32_t z, int32_t y, + int32_t fx, int32_t fz, int32_t fy, + uint32_t threshold, int extent_pixels); + +/* Widen a positive PSX 12-bit angular half-extent by the same horizontal + * projection scale used by a 320-wide 4:3 viewport. `extent_pixels` is the + * extra per-side reveal (including any configured guard). Identity is exact + * when extent_pixels is zero. Results stay below a 90-degree half-angle. */ +uint32_t psx_ws_widen_angle_q12(uint32_t vanilla, int extent_pixels); + +#ifdef __cplusplus +} +#endif diff --git a/overlay_toolchain/include/ws_backdrop_detect.h b/overlay_toolchain/include/ws_backdrop_detect.h new file mode 100644 index 00000000..98cf0c2e --- /dev/null +++ b/overlay_toolchain/include/ws_backdrop_detect.h @@ -0,0 +1,349 @@ +#ifndef PSX_WS_BACKDROP_DETECT_H +#define PSX_WS_BACKDROP_DETECT_H +/* ============================================================================ + * Generic widescreen BACKDROP-PRELOAD detector ([widescreen.cull] auto_backdrop) + * + * Self-contained (depends only on ) so ONE implementation is shared + * verbatim by the recompiler (C++) and the runtime interpreter + * (C). Having a single source of truth matters here: a false positive corrupts + * unrelated overlay codegen (see BACKDROP_PRELOAD.md §risk), so the gate must be + * identical on every path. + * + * WHAT IT FINDS + * ------------- + * PSX scrollers generate a far-background tile row one CAMERA-WINDOWED column + * range per frame. The generator divides the camera world-X by 80 to a column + * index and emits a small window [START, END] of columns around it: + * + * lui M,0x6666 ; ori M,M,0x6667 ; M = 0x66666667 (/80 reciprocal) + * lh/lhu D,0x176(base) ; D = camera world-X (offset 0x176) + * [addiu/addu D, D, Koff] ; optional per-layer parallax bias + * mult D, M + * mfhi H ; sra Q,H,5 ; subu/addu Q,Q,sign ; Q = camX / 80 (the quotient) + * move rStart, Q ; START finalize (offset 0) + * addiu rEnd, Q, N ; END delta (offset N) + * + * for (col = START; col <= END; col++) emit one tile from a finite table + * + * In 16:9 the window slides with the camera, so the revealed margin shows void. + * The fix WIDENS the camera-tracked window by exactly the 16:9 reveal: pull the + * START bound a little left and push the END bound a little right, by a margin + * proportional to the window width (the revealed fraction of the screen). This + * draws only the now-visible columns — NOT the whole finite row — so there is no + * overdraw (an early "force START=0 / END=full-row" version lagged on long rows + * and capped short on rows > the fixed cap). The generator's own low/high clamps + * still bound the widened window at the level edges. + * + * THE TWO REWRITE SITES (per window) + * ---------------------------------- + * Two independent affine consumers finalize bounds: `move rX,Q` (offset 0) + * or `addiu rX,Q,bias`. Both may be biased when a table packs multiple strips. + * Which is START and which is END is NOT + * fixed by move-vs-addiu — it is decided by the generator's clamp tail and is + * captured generically by OFFSET ORDERING: the smaller signed offset is the + * START (left) bound, the larger is the END (right) bound. Verified on Tomba's + * village (FUN_80116a28: a2=START/a3=END, +8) and flower-field (s2=START/s1=END; + * one window has the addiu at offset -18 acting as START with the move as END). + * The window width in columns is the DIFFERENCE between offsets — recorded so + * the runtime sizes the widen margin to the reveal. + * + * The actual value substitution is done at runtime by psx_ws_backdrop_value() + * (gpu.c): identity unless native-wide widescreen is engaged, so 4:3 stays + * byte-identical. It returns orig-margin for a START site and orig+margin for an + * END site. This detector only locates the addresses + the window width. + * + * VALIDATION IS PER-MULT AND LOCAL (backward), not forward-accumulated: the /96 + * magic is sometimes established in a shared branch-delay slot, so register + * state from one branch leg would bleed into another under a forward scan. Each + * candidate `mult` is gated by a bounded backward scan for (a) the exact magic + * load into one operand and (b) a 0x176 camera load into the other operand. + * ========================================================================== */ +#include + +enum { + WS_BD_NONE = 0, + WS_BD_START = 1, /* the window's left (smaller-offset) bound -> orig - margin */ + WS_BD_END = 2 /* the window's right (larger-offset) bound -> orig + margin */ +}; + +typedef struct { + uint32_t pc; /* absolute guest address of the instruction to rewrite */ + int kind; /* WS_BD_START | WS_BD_END */ + int window_cols; /* window width in columns (|addiu offset|), drives the widen margin */ +} WsBackdropSite; + +/* Backward def/use proof for the dividend. Some strips reuse a camera value + * loaded for a preceding strip, or keep &scratchpad.camera_x in a saved reg. + * Follow copies/biases, not just a matching load somewhere in the lookback. */ +static inline int psx_ws_bd_written_reg(uint32_t w) { + unsigned op = w >> 26, fn = w & 63u; + if (!op) { + if (fn <= 7u || fn == 9u || fn == 0x10u || fn == 0x12u || + (fn >= 0x20u && fn <= 0x2Bu)) return (int)((w >> 11) & 31u); + } else if ((op >= 8u && op <= 15u) || (op >= 0x20u && op <= 0x26u) || + ((op == 0x10u || op == 0x12u) && ((w >> 21) & 31u) < 3u)) { + return (int)((w >> 16) & 31u); + } else if (op == 3u) return 31; + return -1; +} + +/* An unconditional jump before a block means the lexically preceding arm + * does not reach it. Follow a unique local conditional predecessor (including + * its delay slot), never borrow definitions from the skipped arm. */ +static inline int psx_ws_bd_predecessor(const uint32_t* words, int boundary, int lo) { + int found = -1; + for (int b = boundary - 3; b >= lo; --b) { + unsigned op = words[b] >> 26; + if ((op == 1u || (op >= 4u && op <= 7u)) && + b + 1 + (int)(int16_t)words[b] == boundary) { + if (found >= 0) return -1; + found = b; + } + } + return found; +} + +static inline int psx_ws_bd_constant(const uint32_t* words, int before, int lo, + unsigned reg, unsigned depth, uint32_t* value) { + if (!reg) { *value = 0; return 1; } + if (!depth) return 0; + for (int b = before - 1; b >= lo; --b) { + if (b > lo && (words[b - 1] >> 26) == 2u) { + int pred = psx_ws_bd_predecessor(words, b + 1, lo); + return pred >= 0 && psx_ws_bd_constant(words, pred + 2, lo, + reg, depth - 1, value); + } + uint32_t w = words[b], op = w >> 26, fn = w & 63u; + unsigned rs = (w >> 21) & 31u, rt = (w >> 16) & 31u; + /* A call may clobber every caller-saved register. */ + if ((op == 3u || (!op && fn == 9u)) && (reg < 16u || reg > 23u)) return 0; + if (psx_ws_bd_written_reg(w) != (int)reg) continue; + if (op == 15u) { *value = w << 16; return 1; } + uint32_t source; + if ((op == 9u || op == 13u) && + psx_ws_bd_constant(words, b, lo, rs, depth - 1, &source)) { + *value = op == 13u ? source | (w & 0xFFFFu) + : source + (uint32_t)(int32_t)(int16_t)w; + return 1; + } + if (!op && (fn == 0x21u || fn == 0x25u) && (!rs || !rt)) + return psx_ws_bd_constant(words, b, lo, rs ? rs : rt, depth - 1, value); + return 0; + } + return 0; +} + +static inline int psx_ws_bd_camera(const uint32_t* words, int before, int lo, + unsigned reg, unsigned depth) { + if (!reg || !depth) return 0; + for (int b = before - 1; b >= lo; --b) { + if (b > lo && (words[b - 1] >> 26) == 2u) { + int pred = psx_ws_bd_predecessor(words, b + 1, lo); + return pred >= 0 && psx_ws_bd_camera(words, pred + 2, lo, reg, depth - 1); + } + uint32_t w = words[b], op = w >> 26, fn = w & 63u; + unsigned rs = (w >> 21) & 31u, rt = (w >> 16) & 31u; + if ((op == 3u || (!op && fn == 9u)) && (reg < 16u || reg > 23u)) return 0; + if (psx_ws_bd_written_reg(w) != (int)reg) continue; + if (op == 0x21u || op == 0x25u) { + uint32_t base; + return psx_ws_bd_constant(words, b, lo, rs, 4, &base) && + base + (uint32_t)(int32_t)(int16_t)w == 0x1F800176u; + } + if (op == 9u || op == 8u) + return psx_ws_bd_camera(words, b, lo, rs, depth - 1); + if (!op && (fn == 0x21u || fn == 0x25u || fn == 0x23u)) { + /* OR is only a copy. SUBU permits camera - bias, never bias - camera. */ + if (fn == 0x25u && rs && rt) return 0; + return psx_ws_bd_camera(words, b, lo, rs, depth - 1) || + (fn != 0x23u && psx_ws_bd_camera(words, b, lo, rt, depth - 1)); + } + return 0; /* nearest definition is not a proven camera-derived value */ + } + return 0; +} + +/* Scan `n` instruction words starting at guest address `base_pc` for backdrop + * column-window generators and record the START/END rewrite sites. Returns the + * number of sites written to `out` (capped at `max_sites`). Pure: the result + * depends only on the instruction bytes, so the recompiler (full-function + * words) and the runtime (a window around a PC) derive identical sites. */ +static inline int psx_ws_find_backdrop_windows(const uint32_t *words, int n, + uint32_t base_pc, + WsBackdropSite *out, int max_sites) +{ + int count = 0; + if (!words || n <= 0 || !out || max_sites <= 0) return 0; + + for (int i = 0; i < n; i++) { + uint32_t w = words[i]; + /* mult rs,rt : SPECIAL(op 0) funct 0x18 (signed multiply) */ + if ((w >> 26) != 0u || (w & 0x3Fu) != 0x18u) continue; + uint32_t op_rs = (w >> 21) & 31u; + uint32_t op_rt = (w >> 16) & 31u; + + /* One operand is the /96 magic, the other the camera-X dividend. Try + * both assignments; validate each by a bounded local backward scan. */ + for (int swap = 0; swap < 2; swap++) { + uint32_t M = swap ? op_rt : op_rs; /* magic candidate */ + uint32_t D = swap ? op_rs : op_rt; /* dividend candidate */ + if (M == D) continue; + + int blo = i - 48; if (blo < 0) blo = 0; + uint32_t magic; + if (!psx_ws_bd_constant(words, i, blo, M, 4, &magic) || + magic != 0x66666667u || !psx_ws_bd_camera(words, i, blo, D, 8)) continue; + + /* Forward divide tail: mfhi H -> sra Q,H,5. Bail on a control + * transfer before the tail (the divide is straight-line). */ + int hi_reg = -1, quot = -1, jdiv = -1; + int fhi = i + 1 + 16; if (fhi > n) fhi = n; + for (int f = i + 1; f < fhi; f++) { + uint32_t fw = words[f]; + uint32_t fop = fw >> 26; + uint32_t ffn = fw & 0x3Fu; + uint32_t frd = (fw >> 11) & 31u; + uint32_t frt = (fw >> 16) & 31u; + uint32_t fsa = (fw >> 6) & 31u; + if (fop == 0u && ffn == 0x10u) { hi_reg = (int)frd; continue; } /* mfhi rd */ + if (hi_reg >= 0 && fop == 0u && ffn == 0x03u && (int)frt == hi_reg && fsa == 5u) { + quot = (int)frd; jdiv = f; break; /* sra quot,hi,5 */ + } + if (fop == 0x02u || fop == 0x03u || fop == 0x04u || fop == 0x05u || + fop == 0x06u || fop == 0x07u || fop == 0x01u || + (fop == 0u && (ffn == 0x08u || ffn == 0x09u))) break; /* j/jal/branch/jr/jalr */ + } + if (quot < 0) continue; + + /* Both bounds must independently read the intact quotient. A + * dependent addiu can instead be a layer-table bias (Tomba's +28 + * after a clamp), NOT a window end. Independently shifting both + * results is also wrong if one consumes the already-shifted other + * bound. Leave those ambiguous shapes unchanged. */ + int cur = quot, move_dest = -1; + uint32_t move_pc = 0, addiu_pc = 0; + /* Historical names: move is the first affine bound, addiu the + * second. Either may now have a nonzero table-segment bias. */ + int have_move = 0, have_addiu = 0, move_n = 0, addiu_n = 0; + int fend = jdiv + 1 + 8; if (fend > n) fend = n; + for (int f = jdiv + 1; f < fend && !(have_move && have_addiu); f++) { + uint32_t fw = words[f]; + uint32_t fop = fw >> 26; + uint32_t ffn = fw & 0x3Fu; + uint32_t frd = (fw >> 11) & 31u; + uint32_t frt = (fw >> 16) & 31u; + uint32_t frs = (fw >> 21) & 31u; + int fsimm = (int)(int16_t)(uint16_t)(fw & 0xFFFFu); + uint32_t pc = base_pc + (uint32_t)f * 4u; + + /* A jump's delay slot still executes in this block. Never + * scan beyond it into an unrelated branch leg. Conditional + * clamps are not part of the independent-bound pattern. */ + if (fop == 0x02u) { + if (fend > f + 2) fend = f + 2; + continue; + } + if (fop == 0x03u || (fop >= 0x04u && fop <= 0x07u) || + fop == 0x01u || (fop == 0u && (ffn == 0x08u || ffn == 0x09u))) break; + + if (fop == 0u && (ffn == 0x21u || ffn == 0x25u)) { /* addu/or */ + int src = -1; + if (frt == 0u && frs != 0u) src = (int)frs; /* move rD, rS (rT == $0) */ + else if (frs == 0u && frt != 0u) src = (int)frt; /* move rD, rT (rS == $0) */ + if (src == cur) { + if ((int)frd == cur) break; + /* Some rows first clamp the signed quotient to zero + * and add a table-segment bias. Recognize the COMPLETE + * diamond, then match the real bounds after its join: + * move T,Q; sll Q,Q,16; bgez Q,+3; addiu Q,T,bias; + * move T,zero; addiu Q,T,bias; . + * Neither the temporary move nor bias is a bound. */ + if (!have_move && !have_addiu && f + 6 < n && + words[f + 1] == ((uint32_t)cur << 16 | (uint32_t)cur << 11 | 16u << 6) && + words[f + 2] == (0x04010003u | (uint32_t)cur << 21) && + (words[f + 3] & 0xFFFF0000u) == + (0x24000000u | frd << 21 | (uint32_t)cur << 16) && + words[f + 4] == (frd << 11 | 0x21u) && + words[f + 5] == words[f + 3]) { + f += 5; + fend = f + 1 + 8; + if (fend > n) fend = n; + continue; + } + if (!have_move) { + move_pc = pc; move_dest = (int)frd; move_n = 0; have_move = 1; + } else if ((int)frd != move_dest) { + addiu_pc = pc; addiu_n = 0; have_addiu = 1; + } + continue; + } + if (ffn == 0x21u && frs != 0u && frt != 0u && + ((int)frs == cur || (int)frt == cur)) { /* addu sign correction */ + if (have_move || have_addiu) break; + cur = (int)frd; continue; + } + } + if (fop == 0u && ffn == 0x23u && + ((int)frs == cur || (int)frt == cur)) { /* subu sign correction */ + if (have_move || have_addiu) break; + cur = (int)frd; continue; + } + if ((fop == 0x09u || fop == 0x08u) && /* addiu/addi rD, Q, N */ + (int)frs == cur && (!have_move || (int)frt != move_dest)) { + if (!have_move) { + if ((int)frt == cur) break; /* quotient bias, not a bound */ + move_pc = pc; move_dest = (int)frt; move_n = fsimm; have_move = 1; + } else if (!have_addiu) { + addiu_pc = pc; addiu_n = fsimm; have_addiu = 1; + } + continue; + } + /* An unrecognized overwrite invalidates the tracked value. */ + if ((fop == 0u && ((int)frd == cur || (int)frd == move_dest)) || + ((fop >= 0x08u && fop <= 0x0Fu) && + ((int)frt == cur || (int)frt == move_dest))) break; + } + if (!have_move || !have_addiu || addiu_n == move_n) continue; + + /* Role by relative offset, not the absolute table-segment bias. */ + int delta = addiu_n - move_n; + int move_kind = (delta > 0) ? WS_BD_START : WS_BD_END; + int addiu_kind = (delta > 0) ? WS_BD_END : WS_BD_START; + int wcols = delta < 0 ? -delta : delta; + + for (int s = 0; s < 2; s++) { + uint32_t spc = s ? addiu_pc : move_pc; + int sk = s ? addiu_kind : move_kind; + int dup = 0; + for (int q = 0; q < count; q++) if (out[q].pc == spc) { dup = 1; break; } + if (!dup && count < max_sites) { + out[count].pc = spc; out[count].kind = sk; + out[count].window_cols = wcols; count++; + } + } + break; /* this mult handled; do not try the other operand assignment */ + } + } + return count; +} + +/* Convenience: return the rewrite kind for a single guest PC by scanning a + * window of words (the runtime passes a window around the PC), and output the + * window width in columns via *out_cols. Returns WS_BD_NONE / WS_BD_START / + * WS_BD_END. */ +static inline int psx_ws_backdrop_kind_at(const uint32_t *words, int n, + uint32_t base_pc, uint32_t pc, + int *out_cols) +{ + WsBackdropSite sites[32]; + int ns = psx_ws_find_backdrop_windows(words, n, base_pc, sites, 32); + for (int i = 0; i < ns; i++) + if (sites[i].pc == pc) { + if (out_cols) *out_cols = sites[i].window_cols; + return sites[i].kind; + } + if (out_cols) *out_cols = 0; + return WS_BD_NONE; +} + +#endif /* PSX_WS_BACKDROP_DETECT_H */ diff --git a/overlay_toolchain/include/ws_backdrop_margin.h b/overlay_toolchain/include/ws_backdrop_margin.h new file mode 100644 index 00000000..fa52eca0 --- /dev/null +++ b/overlay_toolchain/include/ws_backdrop_margin.h @@ -0,0 +1,28 @@ +#ifndef PSX_WS_BACKDROP_MARGIN_H +#define PSX_WS_BACKDROP_MARGIN_H +#include + +/* Round outward: even a partial newly visible column must be submitted. The + * caller includes its screen-space guard in reveal_pixels. The guest's own + * row clamps still enforce finite level bounds. */ +static inline int psx_ws_backdrop_columns(int window_columns, int reveal_pixels, + int native_width) { + if (window_columns <= 0 || reveal_pixels <= 0 || native_width <= 0) return 0; + int64_t columns = ((int64_t)window_columns * reveal_pixels + native_width - 1) + / native_width; + /* The detector's consumers narrow to signed 16-bit indices. More than + * 0x3fff extra columns cannot reveal anything further in byte-count rows. */ + return columns > 0x3fff ? 0x3fff : (int)columns; +} + +/* Some segmented rows clamp START before their final table bias. Widening + * that final bound must not bypass index zero or wrap the signed-16-bit END + * before the guest's finite-table upper clamp executes. */ +static inline uint32_t psx_ws_backdrop_bound(uint32_t orig, int is_end, int margin) { + int64_t value = (int32_t)orig; + value += is_end ? margin : -margin; + if (value < 0) value = 0; + if (value > 0x7fff) value = 0x7fff; + return (uint32_t)value; +} +#endif diff --git a/overlay_toolchain/include/ws_cull_detect.h b/overlay_toolchain/include/ws_cull_detect.h new file mode 100644 index 00000000..dfc3400b --- /dev/null +++ b/overlay_toolchain/include/ws_cull_detect.h @@ -0,0 +1,120 @@ +#ifndef PSX_WS_CULL_DETECT_H +#define PSX_WS_CULL_DETECT_H +/* ============================================================================ + * Generic widescreen SCREEN-EXTENT CULL detector ([widescreen.cull] + * auto_screen_x) + * + * Self-contained (depends only on ) so ONE implementation is shared + * verbatim by the recompiler (C++) and the runtime interpreter + * (C) — the widen must be identical on every execution path or the backends + * diverge (same contract as ws_backdrop_detect.h). + * + * WHAT IT FINDS + * ------------- + * A GTE render funnel trivially rejects a primitive whose projected vertices + * all fall outside the screen. Titles express the horizontal reject three ways + * (immediates are per-game: Tomba tests X < 0x140/0x141 on a 320 display, Ape + * Escape tests X < 0x181 on its 368 display — configured via + * [widescreen.cull] screen_w_imms / screen_h_imms): + * + * (1) UNSIGNED PER-VERTEX (Tomba, Ape sprite path): + * sltiu v, SX, W ; SX loaded lhu / masked andi 0xFFFF + * One compare covers both edges (off-left SX wraps to a large unsigned). + * Widened by psx_ws_cull_sltiu(): window [-m, W+m). + * + * (2) SIGNED MIN/MAX (Ape tri/quad funnel): + * bltz maxSX, reject ; all verts left of 0 + * _slti v, minSX, W ; (delay slot) all verts right of W-1 + * The right bound widens via psx_ws_cull_slti() (W+m); the LEFT bound is + * the bare bltz, widened via psx_ws_cull_bltz() (reject only when + * maxSX < -m). The X pair is discriminated from the identically-shaped Y + * pair by the delay-slot immediate (W-set vs H-set). + * + * (3) SIGNED CENTER±HALFWIDTH (Ape billboard funnel): + * addu t, cx, r + * bltz t, reject ; cx + r < 0 (fully left) + * _ + * subu t, cx, r + * slti v, t, W ; cx - r >= W (fully right) + * The bltz is recognised by the addu immediately before it whose (rs,rt) + * pair reappears in a subu feeding a W-immediate slti a few words later. + * + * A function/window QUALIFIES only when it contains BOTH a width compare + * (slti/sltiu, imm in the W set) and a height compare (imm in the H set) — the + * screen-extent signature. A lone width-immediate compare elsewhere stays + * vanilla. + * + * All widen helpers are identity at margin 0 (4:3 / boot / menu / FMV), so the + * transformed code is bit-for-bit the vanilla verdict outside native-wide. + * ========================================================================== */ +#include + +static inline int psx_ws_cull_imm_in(uint32_t imm, const uint32_t *set, int n) { + for (int i = 0; i < n; i++) + if (set[i] == imm) return 1; + return 0; +} + +/* is words[i] a slti (0x0A) or sltiu (0x0B) with an immediate in `set`? */ +static inline int psx_ws_cull_is_slt_imm(uint32_t w, const uint32_t *set, int n) { + uint32_t op = w >> 26; + if (op != 0x0Au && op != 0x0Bu) return 0; + return psx_ws_cull_imm_in(w & 0xFFFFu, set, n); +} + +/* Screen-extent signature over an instruction window: at least one W compare + * AND one H compare (slti or sltiu). Pure — identical verdicts on the + * recompiler's full-function scan and the runtime's ±window scan. */ +static inline int psx_ws_cull_scan(const uint32_t *words, int n, + const uint32_t *w_imms, int nw, + const uint32_t *h_imms, int nh) { + int has_x = 0, has_y = 0; + for (int i = 0; i < n; i++) { + uint32_t w = words[i]; + uint32_t op = w >> 26; + if (op != 0x0Au && op != 0x0Bu) continue; + uint32_t im = w & 0xFFFFu; + if (psx_ws_cull_imm_in(im, w_imms, nw)) has_x = 1; + else if (psx_ws_cull_imm_in(im, h_imms, nh)) has_y = 1; + if (has_x && has_y) return 1; + } + return 0; +} + +/* Classify words[idx] as an X LEFT-EDGE reject bltz (idiom 2 or 3 above). + * Caller must already have qualified the surrounding window via + * psx_ws_cull_scan. Returns 1 iff the bltz belongs to a width reject. */ +static inline int psx_ws_cull_bltz_here(const uint32_t *words, int n, int idx, + const uint32_t *w_imms, int nw) { + if (idx < 0 || idx >= n) return 0; + uint32_t w = words[idx]; + if ((w >> 26) != 0x01u || ((w >> 16) & 0x1Fu) != 0x00u) return 0; /* bltz only */ + uint32_t bltz_rs = (w >> 21) & 0x1Fu; + + /* Idiom 2: the width slti/sltiu sits in the bltz's delay slot. (The Y pair + * has the same shape with an H immediate — excluded by the W-set test.) */ + if (idx + 1 < n && psx_ws_cull_is_slt_imm(words[idx + 1], w_imms, nw)) + return 1; + + /* Idiom 3: addu t,x,y immediately before; a subu with the same (x,y) pair + * within the next few words feeds a W-immediate slti/sltiu right after. */ + if (idx >= 1) { + uint32_t p = words[idx - 1]; + if ((p >> 26) == 0x00u && (p & 0x3Fu) == 0x21u && /* addu */ + ((p >> 11) & 0x1Fu) == bltz_rs) { /* rd feeds bltz */ + uint32_t ax = (p >> 21) & 0x1Fu, ay = (p >> 16) & 0x1Fu; + for (int j = idx + 1; j <= idx + 4 && j < n; j++) { + uint32_t s = words[j]; + if ((s >> 26) == 0x00u && (s & 0x3Fu) == 0x23u && /* subu */ + ((s >> 21) & 0x1Fu) == ax && ((s >> 16) & 0x1Fu) == ay) { + for (int k = j + 1; k <= j + 2 && k < n; k++) + if (psx_ws_cull_is_slt_imm(words[k], w_imms, nw)) + return 1; + } + } + } + } + return 0; +} + +#endif /* PSX_WS_CULL_DETECT_H */ diff --git a/overlay_toolchain/include/ws_cull_edge.h b/overlay_toolchain/include/ws_cull_edge.h new file mode 100644 index 00000000..43ea28cb --- /dev/null +++ b/overlay_toolchain/include/ws_cull_edge.h @@ -0,0 +1,98 @@ +#ifndef PSX_WS_CULL_EDGE_H +#define PSX_WS_CULL_EDGE_H +/* ============================================================================ + * Exact screen-X edge widening for explicit [widescreen.cull] site kinds + * + * Self-contained (depends only on ) so one implementation is shared + * by the runtime helpers in gpu.c (native code and the dirty-RAM interpreter + * both call those) and by the recompiler's unit test. + * + * `m` is the live per-side reveal, psx_ws_x_margin(): zero at 4:3, so every + * function is the identity there and faithful builds are unchanged. + * + * bgez_sites -- `bgez SX, keep` in a signed per-vertex left-edge chain: + * + * bgez x0, keep ; any vertex with SX >= 0 keeps the primitive + * bgez x1, keep + * bgez x2, keep + * bltz x3, reject ; only reached when x0..x2 < 0 + * + * The final `bltz` is the existing bltz_sites kind (reject iff SX < -m). On + * its own it is not exact: a quad with x0 in [-m, 0) and x3 < -m is still + * rejected, although vertex 0 lies in the revealed band. Widening every + * `bgez` to SX >= -m restores "reject iff every vertex is left of -m". + * + * clip_edge_x_load_sites -- a load of a screen-X clip bound (lh/lhu/lw) that + * a renderer compares its projected vertices against: + * + * lh xmax, 0x70(a0) ; e.g. a scratchpad clip rectangle + * slt at, xmax, SX ; ... reject if every SX > xmax + * + * A bound equal to the screen's left edge (0) moves to -m and one equal to + * its right edge (W) moves to W+m. Any other value is an interior viewport + * edge (a rear-view mirror, one half of a split screen) and stays unchanged, + * so interior viewports keep their vanilla culls while full-width viewports + * widen on each side that touches the display edge. + * + * screen_x_sites on `lui` and `bltz` -- a screen X kept in the high half of + * a register (`SX << 16`), as a renderer does when it tests the sign of + * differences and masks whole points at once: + * + * lui edge, W ; right screen edge as W << 16 + * sll x, sx, 16 + * sub t, x, edge ; t >= 0: the point is right of the screen + * ... + * bltz x, outside ; the point is left of the screen + * + * The `lui` moves to (W + m) << 16 and the `bltz` is taken only while + * SX < -m. bltz_sites does not fit this `bltz`: it compares the whole + * register with -m, and every negative `SX << 16` is far below that. + * ========================================================================== */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* bgez predicate (1 = branch taken = keep) for a signed screen X. */ +static inline int psx_ws_cull_bgez_value(int32_t v, int32_t m) +{ + return v >= -(m > 0 ? m : 0); +} + +/* Widened clip bound. `v` is the loaded value as the guest sees it + * (sign-extended for lh, zero-extended for lhu). The result is a signed + * 32-bit screen X in two's complement. */ +static inline uint32_t psx_ws_clip_edge_x_value(uint32_t v, uint32_t w, + int32_t m) +{ + if (m <= 0) return v; + if (v == 0u) return (uint32_t)(-m); + if (v == w) return (uint32_t)((int32_t)w + m); + return v; +} + +/* Widened value of `lui rt, imm` when imm is a screen-X edge in pixels: a + * right edge (imm > 0) moves right by m, a left edge (imm < 0) moves left by + * m. `imm` is the 16-bit immediate as encoded. */ +static inline uint32_t psx_ws_cull_lui_hi_value(uint32_t imm, int32_t m) +{ + int32_t edge = (int32_t)(int16_t)(uint16_t)imm; + if (m > 0) { + if (edge > 0) edge += m; + else if (edge < 0) edge -= m; + } + return (uint32_t)edge << 16; +} + +/* bltz predicate (1 = branch taken = outside) for a screen X in the high + * half of `v`: taken while SX < -m. */ +static inline int psx_ws_cull_bltz_hi_value(uint32_t v, int32_t m) +{ + return (int32_t)v < -((m > 0 ? m : 0) * 65536); +} + +#ifdef __cplusplus +} +#endif +#endif /* PSX_WS_CULL_EDGE_H */ diff --git a/overlay_toolchain/include/ws_hud_anchor.h b/overlay_toolchain/include/ws_hud_anchor.h new file mode 100644 index 00000000..40480f23 --- /dev/null +++ b/overlay_toolchain/include/ws_hud_anchor.h @@ -0,0 +1,130 @@ +#ifndef PSXRECOMP_WS_HUD_ANCHOR_H +#define PSXRECOMP_WS_HUD_ANCHOR_H + +#include "ws_prepass_guard.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Large screen-space composites can exceed 256 packets (MMX6 Ilumina). + * Keep both pending display buffers' pieces anchored together. */ +#define WS_HUD_ANCHOR_TABLE_SIZE 4096u +#define WS_HUD_ANCHOR_PROBES 8u +#define WS_HUD_ANCHOR_FRESH_FRAMES 2u + +typedef struct { + uint32_t command_addr; + uint32_t frame; + int8_t anchor; + uint8_t used; + WsPrepassPacketGuard guard; +} WsHudAnchorTag; + +static inline int ws_hud_anchor_clamp(int anchor) { + if (anchor < 0) return -1; + if (anchor > 0) return 1; + return 0; +} + +static inline int32_t ws_hud_anchor_native_delta(int native_active, + int32_t offset, + int anchor) { + if (!native_active || offset <= 0) return 0; + return (int32_t)ws_hud_anchor_clamp(anchor) * offset; +} + +static inline int32_t ws_hud_anchor_apply_native_x(int32_t x, + int native_active, + int32_t offset, + int anchor) { + return x + ws_hud_anchor_native_delta(native_active, offset, anchor); +} + +static inline uint32_t ws_hud_anchor_slot(uint32_t command_addr) { + return (command_addr >> 2) & (WS_HUD_ANCHOR_TABLE_SIZE - 1u); +} + +static inline void ws_hud_anchor_clear(WsHudAnchorTag *tags, + uint32_t count) { + if (!tags) return; + for (uint32_t i = 0; i < count; i++) + tags[i].used = 0; +} + +static inline void ws_hud_anchor_insert(WsHudAnchorTag *tags, uint32_t count, + uint32_t command_addr, int anchor, + const WsPrepassPacketGuard *guard, + uint32_t frame) { + if (!tags || !count || !guard) return; + uint32_t idx = ws_hud_anchor_slot(command_addr) & (count - 1u); + uint32_t victim = idx; + for (uint32_t i = 0; i < WS_HUD_ANCHOR_PROBES && i < count; i++) { + uint32_t j = (idx + i) & (count - 1u); + WsHudAnchorTag *tag = &tags[j]; + if (!tag->used || tag->command_addr == command_addr) { + victim = j; + break; + } + if (frame - tag->frame > WS_HUD_ANCHOR_FRESH_FRAMES) + victim = j; + } + tags[victim].used = 1; + tags[victim].command_addr = command_addr; + tags[victim].frame = frame; + tags[victim].anchor = (int8_t)ws_hud_anchor_clamp(anchor); + tags[victim].guard = *guard; +} + +/* Lookup outcome, so callers can keep always-on counters that say WHY a tagged + * primitive was or was not honoured (absent, expired, or packet rewritten). */ +enum { + WS_HUD_ANCHOR_HIT = 1, + WS_HUD_ANCHOR_ABSENT = 0, + WS_HUD_ANCHOR_STALE = -1, + WS_HUD_ANCHOR_GUARD_MISMATCH = -2 +}; + +static inline int ws_hud_anchor_lookup_result(const WsHudAnchorTag *tags, + uint32_t count, + uint32_t command_addr, + const uint32_t *words, + uint32_t word_count, + uint32_t frame, + int *out_anchor) { + if (!tags || !count || !words) return WS_HUD_ANCHOR_ABSENT; + uint32_t idx = ws_hud_anchor_slot(command_addr) & (count - 1u); + for (uint32_t i = 0; i < WS_HUD_ANCHOR_PROBES && i < count; i++) { + const WsHudAnchorTag *tag = &tags[(idx + i) & (count - 1u)]; + if (!tag->used || tag->command_addr != command_addr) + continue; + if (tag->frame > frame || + frame - tag->frame > WS_HUD_ANCHOR_FRESH_FRAMES) + return WS_HUD_ANCHOR_STALE; + if (!ws_prepass_packet_matches(&tag->guard, words, word_count)) + return WS_HUD_ANCHOR_GUARD_MISMATCH; + if (out_anchor) *out_anchor = tag->anchor; + return WS_HUD_ANCHOR_HIT; + } + return WS_HUD_ANCHOR_ABSENT; +} + +static inline int ws_hud_anchor_lookup(const WsHudAnchorTag *tags, + uint32_t count, + uint32_t command_addr, + const uint32_t *words, + uint32_t word_count, + uint32_t frame, + int *out_anchor) { + return ws_hud_anchor_lookup_result(tags, count, command_addr, words, + word_count, frame, out_anchor) == + WS_HUD_ANCHOR_HIT; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/ws_masked_reject.h b/overlay_toolchain/include/ws_masked_reject.h new file mode 100644 index 00000000..246df452 --- /dev/null +++ b/overlay_toolchain/include/ws_masked_reject.h @@ -0,0 +1,9 @@ +#pragma once +#include + +/* Preserve the native reject at 4:3; in the wider render target retain the + * axes proved meaningful by the game adapter. No guest flags are modified. */ +static inline int psx_ws_masked_reject_value(uint32_t flags, uint32_t mask, + int margin) { + return (margin > 0 ? (flags & mask) : flags) != 0u; +} diff --git a/overlay_toolchain/include/ws_prepass_guard.h b/overlay_toolchain/include/ws_prepass_guard.h new file mode 100644 index 00000000..d4058f5d --- /dev/null +++ b/overlay_toolchain/include/ws_prepass_guard.h @@ -0,0 +1,50 @@ +#ifndef PSXRECOMP_WS_PREPASS_GUARD_H +#define PSXRECOMP_WS_PREPASS_GUARD_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + uint32_t word_count; + uint64_t fingerprint; +} WsPrepassPacketGuard; + +static inline uint64_t ws_prepass_packet_fingerprint(const uint32_t *words, + uint32_t word_count) { + uint64_t hash = UINT64_C(1469598103934665603); + for (uint32_t i = 0; i < word_count; i++) { + uint32_t word = words[i]; + for (unsigned shift = 0; shift < 32; shift += 8) { + hash ^= (uint8_t)(word >> shift); + hash *= UINT64_C(1099511628211); + } + } + hash ^= word_count; + hash *= UINT64_C(1099511628211); + return hash; +} + +static inline WsPrepassPacketGuard ws_prepass_packet_guard( + const uint32_t *words, uint32_t word_count) { + WsPrepassPacketGuard guard; + guard.word_count = word_count; + guard.fingerprint = ws_prepass_packet_fingerprint(words, word_count); + return guard; +} + +static inline int ws_prepass_packet_matches(const WsPrepassPacketGuard *guard, + const uint32_t *words, + uint32_t word_count) { + return guard && guard->word_count == word_count && + guard->fingerprint == + ws_prepass_packet_fingerprint(words, word_count); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/ws_primitive_roles.h b/overlay_toolchain/include/ws_primitive_roles.h new file mode 100644 index 00000000..e3ba25a0 --- /dev/null +++ b/overlay_toolchain/include/ws_primitive_roles.h @@ -0,0 +1,48 @@ +#ifndef PSX_WS_PRIMITIVE_ROLES_H +#define PSX_WS_PRIMITIVE_ROLES_H +#include +#include +#include "psx_memory.h" + +/* Title-supplied packet identity, independent of draw order and sprite tags. + * Keys name PsyQ P_TAG headers; GPU lookup names the following command word. */ +#define WS_ROLE_BUCKETS 4096u +typedef struct { + uint32_t key, stamp; + int8_t hud_edge; + uint8_t world; +} WsPrimitiveRole; + +static inline WsPrimitiveRole* ws_role_write(WsPrimitiveRole* tags, + uint32_t primitive, uint32_t now) { + uint32_t key = psx_ram_canonical_offset(primitive) & ~3u; + if (!key) return NULL; + uint32_t slot = (key >> 2) & (WS_ROLE_BUCKETS - 1u), victim = slot; + for (unsigned i = 0; i < 4; ++i) { + uint32_t j = (slot + i) & (WS_ROLE_BUCKETS - 1u); + if (tags[j].key == key || !tags[j].key) { victim = j; break; } + if (now - tags[j].stamp > 2u) victim = j; + } + WsPrimitiveRole* tag = &tags[victim]; + if (tag->key != key || tag->stamp != now) { + tag->hud_edge = 0; + tag->world = 0; + } + tag->key = key; + tag->stamp = now; + return tag; +} + +static inline const WsPrimitiveRole* ws_role_read(const WsPrimitiveRole* tags, + uint32_t source, uint32_t now) { + if (source == 0xFFFFFFFFu) return NULL; + uint32_t key = psx_ram_canonical_offset(source - 4u) & ~3u; + if (!key) return NULL; + uint32_t slot = (key >> 2) & (WS_ROLE_BUCKETS - 1u); + for (unsigned i = 0; i < 4; ++i) { + const WsPrimitiveRole* tag = &tags[(slot + i) & (WS_ROLE_BUCKETS - 1u)]; + if (tag->key == key && now - tag->stamp <= 2u) return tag; + } + return NULL; +} +#endif diff --git a/overlay_toolchain/include/ws_radial_screen_mask.h b/overlay_toolchain/include/ws_radial_screen_mask.h new file mode 100644 index 00000000..f2b103ea --- /dev/null +++ b/overlay_toolchain/include/ws_radial_screen_mask.h @@ -0,0 +1,55 @@ +#ifndef PSXRECOMP_WS_RADIAL_SCREEN_MASK_H +#define PSXRECOMP_WS_RADIAL_SCREEN_MASK_H +#include "ws_hud_anchor.h" +#include + +/* Explicit title-owned screen-space rings, never a world-geometry heuristic. + * Independent packet guards let adjacent solid and feathered ring segments + * share one scale without allowing an arena's next use to inherit the effect. */ +#define WS_RADIAL_MASK_TAG_COUNT 256u +typedef struct { + WsHudAnchorTag packet; + float scale; +} WsRadialScreenMaskTag; + +static inline void ws_radial_mask_clear(WsRadialScreenMaskTag *tags) { + for (unsigned i=0; i 64.f) return; + unsigned slot=(key >> 2) & (WS_RADIAL_MASK_TAG_COUNT-1u), victim=slot; + for (unsigned i=0; iused || p->command_addr==key) { victim=j; break; } + if (frame-p->frame > WS_HUD_ANCHOR_FRESH_FRAMES) victim=j; + } + tags[victim].packet=(WsHudAnchorTag){.command_addr=key, .frame=frame, + .used=1, .guard=*guard}; + tags[victim].scale=scale; +} +static inline int ws_radial_mask_lookup(const WsRadialScreenMaskTag *tags, + uint32_t key, const uint32_t *words, uint32_t count, uint32_t frame, + float *scale) { + unsigned slot=(key >> 2)&(WS_RADIAL_MASK_TAG_COUNT-1u); + for (unsigned i=0; ipacket.used || t->packet.command_addr != key) continue; + if (framepacket.frame || frame-t->packet.frame>WS_HUD_ANCHOR_FRESH_FRAMES || + !ws_prepass_packet_matches(&t->packet.guard,words,count)) return 0; + *scale=t->scale; + return 1; + } + return 0; +} +static inline void ws_radial_mask_transform(int32_t x[4], int32_t y[4], + int width, int height, float scale) { + if (width<=0 || height<=0 || !isfinite(scale) || scale<1.f || scale>64.f) return; + double cx=width*.5, cy=height*.5; + for (unsigned i=0; i<4; ++i) { + x[i]=(int32_t)llround(cx+(x[i]-cx)*scale); + y[i]=(int32_t)llround(cy+(y[i]-cy)*scale); + } +} +#endif diff --git a/overlay_toolchain/include/ws_repeat_rect.h b/overlay_toolchain/include/ws_repeat_rect.h new file mode 100644 index 00000000..01883e1e --- /dev/null +++ b/overlay_toolchain/include/ws_repeat_rect.h @@ -0,0 +1,186 @@ +#ifndef PSXRECOMP_WS_REPEAT_RECT_H +#define PSXRECOMP_WS_REPEAT_RECT_H + +#include "ws_prepass_guard.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define WS_REPEAT_RECT_TAG_TABLE_SIZE 256u +#define WS_REPEAT_RECT_TAG_PROBES 8u +#define WS_REPEAT_RECT_TAG_FRESH_FRAMES 2u +#define WS_REPEAT_RECT_MAX_SCAN 128 + +typedef struct { + int32_t x; + int32_t u; + int32_t w; +} WsRepeatSpan; + +typedef struct { + uint32_t command_addr; + uint32_t frame; + int32_t period; + uint8_t used; + WsPrepassPacketGuard guard; +} WsRepeatRectTag; + +static inline int ws_repeat_rect_valid_inputs(int32_t x, int32_t u, int32_t w, + int32_t period, + int32_t canonical_left, + int32_t canonical_width, + int32_t margin, int capacity) { + return x >= -8192 && x <= 8192 && + u >= 0 && u <= 255 && + w >= 1 && w <= 256 && + u + w <= 256 && + period >= 1 && period <= 4096 && + canonical_left >= 0 && canonical_left <= 1023 && + canonical_width >= 1 && canonical_width <= 1024 && + margin >= 0 && margin <= 2048 && + capacity >= 0; +} + +static inline int64_t ws_repeat_rect_floor_div(int64_t num, int64_t den) { + int64_t q = num / den; + int64_t r = num % den; + return (r != 0 && ((r < 0) != (den < 0))) ? q - 1 : q; +} + +static inline int64_t ws_repeat_rect_ceil_div(int64_t num, int64_t den) { + return -ws_repeat_rect_floor_div(-num, den); +} + +static inline int ws_repeat_rect_append_span(WsRepeatSpan *out, int capacity, + int write, int count, + int64_t rect_x, int32_t rect_u, + int32_t rect_w, + int64_t band_left, + int64_t band_right) { + int64_t rect_left = rect_x; + int64_t rect_right = rect_x + rect_w; + int64_t clip_left = rect_left > band_left ? rect_left : band_left; + int64_t clip_right = rect_right < band_right ? rect_right : band_right; + if (clip_left >= clip_right) + return count; + + if (write && count < capacity) { + out[count].x = (int32_t)clip_left; + out[count].u = rect_u + (int32_t)(clip_left - rect_left); + out[count].w = (int32_t)(clip_right - clip_left); + } + return count + 1; +} + +static inline int ws_repeat_rect_spans(int32_t x, int32_t u, int32_t w, + int32_t period, + int32_t canonical_left, + int32_t canonical_width, + int32_t margin, WsRepeatSpan *out, + int capacity) { + if (!ws_repeat_rect_valid_inputs(x, u, w, period, canonical_left, + canonical_width, margin, capacity)) + return 0; + if (margin == 0) + return 0; + if (!out) + return 0; + + int64_t left = canonical_left; + int64_t right = left + canonical_width; + int64_t scan_left = left - margin; + int64_t scan_right = right + margin; + int64_t n_min = ws_repeat_rect_ceil_div(scan_left - w + 1 - x, period); + int64_t n_max = ws_repeat_rect_floor_div(scan_right - 1 - x, period); + if (n_max < n_min) + return 0; + if (n_max - n_min + 1 > WS_REPEAT_RECT_MAX_SCAN) + return 0; + + int count = 0; + for (int pass = 0; pass < 2; pass++) { + int write = pass != 0; + count = 0; + for (int64_t n = n_min; n <= n_max; n++) { + int64_t rect_x = (int64_t)x + n * (int64_t)period; + count = ws_repeat_rect_append_span(out, capacity, write, count, + rect_x, u, w, scan_left, left); + count = ws_repeat_rect_append_span(out, capacity, write, count, + rect_x, u, w, right, + scan_right); + if (!write && count > capacity) + return 0; + } + } + + return count; +} + +static inline uint32_t ws_repeat_rect_tag_slot(uint32_t command_addr) { + return (command_addr >> 2) & (WS_REPEAT_RECT_TAG_TABLE_SIZE - 1u); +} + +static inline void ws_repeat_rect_tag_clear(WsRepeatRectTag *tags) { + if (!tags) return; + for (uint32_t i = 0; i < WS_REPEAT_RECT_TAG_TABLE_SIZE; i++) + tags[i].used = 0; +} + +static inline void ws_repeat_rect_tag_insert(WsRepeatRectTag *tags, + uint32_t command_addr, + int32_t period, + const WsPrepassPacketGuard *guard, + uint32_t frame) { + if (!tags || !guard || period <= 0) + return; + uint32_t idx = ws_repeat_rect_tag_slot(command_addr); + uint32_t victim = idx; + for (uint32_t i = 0; i < WS_REPEAT_RECT_TAG_PROBES; i++) { + uint32_t j = (idx + i) & (WS_REPEAT_RECT_TAG_TABLE_SIZE - 1u); + WsRepeatRectTag *tag = &tags[j]; + if (!tag->used || tag->command_addr == command_addr) { + victim = j; + break; + } + if (frame - tag->frame > WS_REPEAT_RECT_TAG_FRESH_FRAMES) + victim = j; + } + + tags[victim].used = 1; + tags[victim].command_addr = command_addr; + tags[victim].frame = frame; + tags[victim].period = period; + tags[victim].guard = *guard; +} + +static inline int32_t ws_repeat_rect_tag_lookup(const WsRepeatRectTag *tags, + uint32_t command_addr, + const uint32_t *words, + uint32_t word_count, + uint32_t frame) { + if (!tags || !words) + return 0; + uint32_t idx = ws_repeat_rect_tag_slot(command_addr); + for (uint32_t i = 0; i < WS_REPEAT_RECT_TAG_PROBES; i++) { + const WsRepeatRectTag *tag = + &tags[(idx + i) & (WS_REPEAT_RECT_TAG_TABLE_SIZE - 1u)]; + if (!tag->used || tag->command_addr != command_addr) + continue; + if (tag->frame > frame || + frame - tag->frame > WS_REPEAT_RECT_TAG_FRESH_FRAMES) + return 0; + if (!ws_prepass_packet_matches(&tag->guard, words, word_count)) + return 0; + return tag->period; + } + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/ws_scene_hold.h b/overlay_toolchain/include/ws_scene_hold.h new file mode 100644 index 00000000..1ad55744 --- /dev/null +++ b/overlay_toolchain/include/ws_scene_hold.h @@ -0,0 +1,35 @@ +#pragma once +#include + +/* Host presentation history, not guest hardware state. Never serialize it: + * a restored canonical framebuffer cannot reconstruct discarded wide strips. */ +typedef struct WsSceneHold { + int valid, native_43, awaiting_flip; + uint32_t held_origin; +} WsSceneHold; +static inline void ws_scene_hold_reset(WsSceneHold* state) { + state->valid = 0; state->native_43 = 1; state->awaiting_flip = 0; + state->held_origin = 0; +} +static inline int ws_scene_hold_classify(WsSceneHold* state, int hold, + int native_43, int fmv, + uint32_t display_origin) { + /* FMV always wins, and cannot seed a later wide retained scene. */ + if (fmv) { + state->valid = 1; state->native_43 = 1; + state->awaiting_flip = 0; + return 1; + } + if (hold == 1) { + state->held_origin = display_origin; + state->awaiting_flip = 1; + } else if (hold != 1) { + /* 2: the backbuffer is ready, but not necessarily on screen yet. */ + hold = hold == 2 && state->awaiting_flip && + display_origin == state->held_origin; + if (!hold) state->awaiting_flip = 0; + } + if (hold && state->valid) return state->native_43; + state->valid = 1; state->native_43 = native_43 != 0; + return state->native_43; +} diff --git a/overlay_toolchain/include/ws_scene_latch.h b/overlay_toolchain/include/ws_scene_latch.h new file mode 100644 index 00000000..67f0d41e --- /dev/null +++ b/overlay_toolchain/include/ws_scene_latch.h @@ -0,0 +1,28 @@ +#ifndef PSX_WS_SCENE_LATCH_H +#define PSX_WS_SCENE_LATCH_H +#include + +/* Overhang proves there is revealable world content. Projection activity can + * maintain that proof, but MUST NOT establish it: 2D room jingles also use GTE. + * The CPU/GTE can build a frame across multiple vblanks before submitting any + * terrain packets, so gaps in GP0 overhang are not evidence of a scene change. */ +typedef struct { + uint32_t last_frame, last_activity; + int initialized, confirmed; +} WsSceneLatch; + +static inline int ws_scene_is_2d(WsSceneLatch* state, uint32_t frame, + int confirmed_overhang, int projecting_world, + uint32_t grace) { + if (state->initialized && (int32_t)(frame - state->last_frame) < 0) + state->confirmed = 0; + state->initialized = 1; + state->last_frame = frame; + if (confirmed_overhang) state->confirmed = 1; + if (confirmed_overhang || (state->confirmed && projecting_world)) + state->last_activity = frame; + if (state->confirmed && frame - state->last_activity > grace) + state->confirmed = 0; + return !state->confirmed; +} +#endif diff --git a/overlay_toolchain/include/ws_screen_mask.h b/overlay_toolchain/include/ws_screen_mask.h new file mode 100644 index 00000000..8d11a152 --- /dev/null +++ b/overlay_toolchain/include/ws_screen_mask.h @@ -0,0 +1,54 @@ +#ifndef PSXRECOMP_WS_SCREEN_MASK_H +#define PSXRECOMP_WS_SCREEN_MASK_H +#include + +/* Extend only an off-screen vertical boundary of a title-identified mask. + * The interior/slanted light boundary stays at its original coordinates. + * Result is wholly outside canonical VRAM; no triangle size limit applies. */ +typedef struct { int x, y, w, h; } WsScreenMaskBand; +static inline int ws_screen_mask_band(const int32_t x[4], const int32_t y[4], + int width, int height, int margin, + WsScreenMaskBand *out) { + if (!out || width <= 0 || height <= 0 || margin <= 0 || + y[0] != y[1] || y[2] != y[3] || y[0] != 0 || y[2] != height) + return 0; + if (x[0] == x[2] && x[0] <= 0 && x[1] > x[0] && x[3] > x[0] && + x[0] > -margin) { + *out = (WsScreenMaskBand){-margin, 0, margin + x[0], height}; + return 1; + } + if (x[1] == x[3] && x[1] >= width && x[0] < x[1] && x[2] < x[1] && + x[1] < width + margin) { + *out = (WsScreenMaskBand){x[1], 0, width + margin - x[1], height}; + return 1; + } + return 0; +} + +/* A tagged horizontal letterbox panel covers the native width but only the + * top or bottom of the picture. Extend both outer edges, keeping its animated + * height and leaving the opening alone. Full-screen filters use the renderer's + * existing single-rectangle path instead, avoiding a second blend in the sides. + * At most two disjoint bands are returned, all outside canonical VRAM. */ +static inline int ws_screen_mask_bands(const int32_t x[4], const int32_t y[4], + int width, int height, int margin, + WsScreenMaskBand out[2]) { + if (!out || width <= 0 || height <= 0 || margin <= 0) return 0; + if (x[0] == x[2] && x[1] == x[3] && + y[0] == y[1] && y[2] == y[3] && + x[0] <= 0 && x[1] >= width && y[2] > y[0]) { + if (y[0] <= 0 && y[2] >= height) return 0; + if (y[0] <= 0 || y[2] >= height) { + int count = 0; + if (x[0] > -margin) + out[count++] = (WsScreenMaskBand){-margin, y[0], + margin + x[0], y[2] - y[0]}; + if (x[1] < width + margin) + out[count++] = (WsScreenMaskBand){x[1], y[0], + width + margin - x[1], y[2] - y[0]}; + return count; + } + } + return ws_screen_mask_band(x, y, width, height, margin, out); +} +#endif diff --git a/overlay_toolchain/include/ws_ui_group.h b/overlay_toolchain/include/ws_ui_group.h new file mode 100644 index 00000000..090be814 --- /dev/null +++ b/overlay_toolchain/include/ws_ui_group.h @@ -0,0 +1,59 @@ +#ifndef PSXRECOMP_WS_UI_GROUP_H +#define PSXRECOMP_WS_UI_GROUP_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define WS_UI_GROUP_JOIN_GAP 24 + +/* Vertical slack, in scanlines, still counted as "stacked on" rather than + * "somewhere else on screen". A readout drawn as a label directly above its + * box leaves a one-pixel seam; the nearest thing that must NOT join is the + * other end of the screen, ~200 scanlines away. */ +#define WS_UI_GROUP_STACK_GAP 4 + +typedef struct { + uint32_t key; + int32_t x; + int32_t width; + /* Vertical extent, needed to tell "drawn on top of each other" (one visual + * element) from "happens to share screen columns" (the top-left lap counter + * and the bottom-left lap timer). Grouping only ever produces a HORIZONTAL + * anchor, but deciding the grouping is a 2-D question. */ + int32_t y; + int32_t height; + int32_t anchor; + /* Diagnostic only: index of the union-find representative this item + * merged into, so an observer can tell "these two share an anchor because + * they are one run" from "these two happen to land on the same third". + * Anchor equality cannot distinguish those — there are only three anchor + * values — and that distinction is the whole question when a HUD element + * splits apart under the squash. Written by ws_ui_group_assign; never read + * by the transform path. */ + uint32_t root; +} WsUiGroupItem; + +/* Assign one anchor to each complete spatial run. Items with the same + * texture/row key join when their horizontal intervals touch or are separated + * by at most WS_UI_GROUP_JOIN_GAP pixels. This is intentionally a whole-frame + * operation: animated text is coherent on its first frame, not one frame late. + * + * The anchor is the run's thirds anchor (left edge, centre, right edge), or + * with in_place the run's own centre, so it keeps the position the stretched + * 4:3 layout gives it. in_place is for HUD widgets whose GTE-projected parts + * (never corrected) must stay registered with their flat quads. */ +void ws_ui_group_assign(WsUiGroupItem *items, size_t count, + int32_t display_width, int dense_menu, int in_place); + +int32_t ws_ui_anchor_for_bounds(int32_t x, int32_t width, + int32_t display_width); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/include/ws_view_anchor.h b/overlay_toolchain/include/ws_view_anchor.h new file mode 100644 index 00000000..e4fccaa3 --- /dev/null +++ b/overlay_toolchain/include/ws_view_anchor.h @@ -0,0 +1,29 @@ +#ifndef PSX_WS_VIEW_ANCHOR_H +#define PSX_WS_VIEW_ANCHOR_H + +/* Host presentation geometry. Camera bounds describe the native view's left + * edge; the room's right edge is camera_max + native_width. */ +typedef struct WsViewAnchor { + int left, right; + int shift; + int pad_left, pad_right; +} WsViewAnchor; + +static inline WsViewAnchor ws_view_anchor(int extra, int camera, + int camera_min, int camera_max) { + WsViewAnchor v = {extra, extra, 0, 0, 0}; + if (extra <= 0 || camera_min > camera_max || + camera < camera_min || camera > camera_max) return v; + int avail_left = camera - camera_min; + int avail_right = camera_max - camera; + int total = 2 * extra; + v.left = avail_left < extra ? avail_left : extra; + v.right = avail_right < total - v.left ? avail_right : total - v.left; + v.left = avail_left < total - v.right ? avail_left : total - v.right; + int padding = total - v.left - v.right; + v.pad_left = padding / 2; + v.pad_right = padding - v.pad_left; + v.shift = v.left + v.pad_left - extra; + return v; +} +#endif diff --git a/overlay_toolchain/psxrecomp-bios.exe b/overlay_toolchain/psxrecomp-bios.exe new file mode 100644 index 00000000..09abf607 Binary files /dev/null and b/overlay_toolchain/psxrecomp-bios.exe differ diff --git a/overlay_toolchain/psxrecomp-game.exe b/overlay_toolchain/psxrecomp-game.exe new file mode 100644 index 00000000..2f3c8b69 Binary files /dev/null and b/overlay_toolchain/psxrecomp-game.exe differ diff --git a/overlay_toolchain/python/LICENSE.txt b/overlay_toolchain/python/LICENSE.txt new file mode 100644 index 00000000..89bc3480 --- /dev/null +++ b/overlay_toolchain/python/LICENSE.txt @@ -0,0 +1,645 @@ +A. HISTORY OF THE SOFTWARE +========================== + +Python was created in the early 1990s by Guido van Rossum at Stichting +Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands +as a successor of a language called ABC. Guido remains Python's +principal author, although it includes many contributions from others. + +In 1995, Guido continued his work on Python at the Corporation for +National Research Initiatives (CNRI, see https://www.cnri.reston.va.us) +in Reston, Virginia where he released several versions of the +software. + +In May 2000, Guido and the Python core development team moved to +BeOpen.com to form the BeOpen PythonLabs team. In October of the same +year, the PythonLabs team moved to Digital Creations, which became +Zope Corporation. In 2001, the Python Software Foundation (PSF, see +https://www.python.org/psf/) was formed, a non-profit organization +created specifically to own Python-related Intellectual Property. +Zope Corporation was a sponsoring member of the PSF. + +All Python releases are Open Source (see https://opensource.org for +the Open Source Definition). Historically, most, but not all, Python +releases have also been GPL-compatible; the table below summarizes +the various releases. + + Release Derived Year Owner GPL- + from compatible? (1) + + 0.9.0 thru 1.2 1991-1995 CWI yes + 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes + 1.6 1.5.2 2000 CNRI no + 2.0 1.6 2000 BeOpen.com no + 1.6.1 1.6 2001 CNRI yes (2) + 2.1 2.0+1.6.1 2001 PSF no + 2.0.1 2.0+1.6.1 2001 PSF yes + 2.1.1 2.1+2.0.1 2001 PSF yes + 2.1.2 2.1.1 2002 PSF yes + 2.1.3 2.1.2 2002 PSF yes + 2.2 and above 2.1.1 2001-now PSF yes + +Footnotes: + +(1) GPL-compatible doesn't mean that we're distributing Python under + the GPL. All Python licenses, unlike the GPL, let you distribute + a modified version without making your changes open source. The + GPL-compatible licenses make it possible to combine Python with + other software that is released under the GPL; the others don't. + +(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, + because its license has a choice of law clause. According to + CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 + is "not incompatible" with the GPL. + +Thanks to the many outside volunteers who have worked under Guido's +direction to make these releases possible. + + +B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON +=============================================================== + +Python software and documentation are licensed under the +Python Software Foundation License Version 2. + +Starting with Python 3.8.6, examples, recipes, and other code in +the documentation are dual licensed under the PSF License Version 2 +and the Zero-Clause BSD license. + +Some software incorporated into Python is under different licenses. +The licenses are listed with code falling under that license. + + +PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 +-------------------------------------------- + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using this software ("Python") in source or binary form and +its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF hereby +grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, +analyze, test, perform and/or display publicly, prepare derivative works, +distribute, and otherwise use Python alone or in any derivative version, +provided, however, that PSF's License Agreement and PSF's notice of copyright, +i.e., "Copyright (c) 2001-2024 Python Software Foundation; All Rights Reserved" +are retained in Python alone or in any derivative version prepared by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python. + +4. PSF is making Python available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 +------------------------------------------- + +BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 + +1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an +office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the +Individual or Organization ("Licensee") accessing and otherwise using +this software in source or binary form and its associated +documentation ("the Software"). + +2. Subject to the terms and conditions of this BeOpen Python License +Agreement, BeOpen hereby grants Licensee a non-exclusive, +royalty-free, world-wide license to reproduce, analyze, test, perform +and/or display publicly, prepare derivative works, distribute, and +otherwise use the Software alone or in any derivative version, +provided, however, that the BeOpen Python License is retained in the +Software, alone or in any derivative version prepared by Licensee. + +3. BeOpen is making the Software available to Licensee on an "AS IS" +basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE +SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS +AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY +DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +5. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +6. This License Agreement shall be governed by and interpreted in all +respects by the law of the State of California, excluding conflict of +law provisions. Nothing in this License Agreement shall be deemed to +create any relationship of agency, partnership, or joint venture +between BeOpen and Licensee. This License Agreement does not grant +permission to use BeOpen trademarks or trade names in a trademark +sense to endorse or promote products or services of Licensee, or any +third party. As an exception, the "BeOpen Python" logos available at +http://www.pythonlabs.com/logos.html may be used according to the +permissions granted on that web page. + +7. By copying, installing or otherwise using the software, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 +--------------------------------------- + +1. This LICENSE AGREEMENT is between the Corporation for National +Research Initiatives, having an office at 1895 Preston White Drive, +Reston, VA 20191 ("CNRI"), and the Individual or Organization +("Licensee") accessing and otherwise using Python 1.6.1 software in +source or binary form and its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, CNRI +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 1.6.1 +alone or in any derivative version, provided, however, that CNRI's +License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) +1995-2001 Corporation for National Research Initiatives; All Rights +Reserved" are retained in Python 1.6.1 alone or in any derivative +version prepared by Licensee. Alternately, in lieu of CNRI's License +Agreement, Licensee may substitute the following text (omitting the +quotes): "Python 1.6.1 is made available subject to the terms and +conditions in CNRI's License Agreement. This Agreement together with +Python 1.6.1 may be located on the internet using the following +unique, persistent identifier (known as a handle): 1895.22/1013. This +Agreement may also be obtained from a proxy server on the internet +using the following URL: http://hdl.handle.net/1895.22/1013". + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 1.6.1 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 1.6.1. + +4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" +basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. This License Agreement shall be governed by the federal +intellectual property law of the United States, including without +limitation the federal copyright law, and, to the extent such +U.S. federal law does not apply, by the law of the Commonwealth of +Virginia, excluding Virginia's conflict of law provisions. +Notwithstanding the foregoing, with regard to derivative works based +on Python 1.6.1 that incorporate non-separable material that was +previously distributed under the GNU General Public License (GPL), the +law of the Commonwealth of Virginia shall govern this License +Agreement only as to issues arising under or with respect to +Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this +License Agreement shall be deemed to create any relationship of +agency, partnership, or joint venture between CNRI and Licensee. This +License Agreement does not grant permission to use CNRI trademarks or +trade name in a trademark sense to endorse or promote products or +services of Licensee, or any third party. + +8. By clicking on the "ACCEPT" button where indicated, or by copying, +installing or otherwise using Python 1.6.1, Licensee agrees to be +bound by the terms and conditions of this License Agreement. + + ACCEPT + + +CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 +-------------------------------------------------- + +Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, +The Netherlands. All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION +---------------------------------------------------------------------- + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + + + +Additional Conditions for this Windows binary build +--------------------------------------------------- + +This program is linked with and uses Microsoft Distributable Code, +copyrighted by Microsoft Corporation. The Microsoft Distributable Code +is embedded in each .exe, .dll and .pyd file as a result of running +the code through a linker. + +If you further distribute programs that include the Microsoft +Distributable Code, you must comply with the restrictions on +distribution specified by Microsoft. In particular, you must require +distributors and external end users to agree to terms that protect the +Microsoft Distributable Code at least as much as Microsoft's own +requirements for the Distributable Code. See Microsoft's documentation +(included in its developer tools and on its website at microsoft.com) +for specific details. + +Redistribution of the Windows binary build of the Python interpreter +complies with this agreement, provided that you do not: + +- alter any copyright, trademark or patent notice in Microsoft's +Distributable Code; + +- use Microsoft's trademarks in your programs' names or in a way that +suggests your programs come from or are endorsed by Microsoft; + +- distribute Microsoft's Distributable Code to run on a platform other +than Microsoft operating systems, run-time technologies or application +platforms; or + +- include Microsoft Distributable Code in malicious, deceptive or +unlawful programs. + +These restrictions apply only to the Microsoft Distributable Code as +defined above, not to Python itself or any programs running on the +Python interpreter. The redistribution of the Python interpreter and +libraries is governed by the Python Software License included with this +file, or by other licenses as marked. + + + +-------------------------------------------------------------------------- + +This program, "bzip2", the associated library "libbzip2", and all +documentation, are copyright (C) 1996-2019 Julian R Seward. All +rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Julian Seward, jseward@acm.org +bzip2/libbzip2 version 1.0.8 of 13 July 2019 + +-------------------------------------------------------------------------- + +libffi - Copyright (c) 1996-2022 Anthony Green, Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + +This software is copyrighted by the Regents of the University of +California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState +Corporation and other parties. The following terms apply to all files +associated with the software unless explicitly disclaimed in +individual files. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +MODIFICATIONS. + +GOVERNMENT USE: If you are acquiring this software on behalf of the +U.S. government, the Government shall have only "Restricted Rights" +in the software and related documentation as defined in the Federal +Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you +are acquiring the software on behalf of the Department of Defense, the +software shall be classified as "Commercial Computer Software" and the +Government shall have only "Restricted Rights" as defined in Clause +252.227-7014 (b) (3) of DFARs. Notwithstanding the foregoing, the +authors grant the U.S. Government and others acting in its behalf +permission to use and distribute the software in accordance with the +terms specified in this license. + +This software is copyrighted by the Regents of the University of +California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState +Corporation, Apple Inc. and other parties. The following terms apply to +all files associated with the software unless explicitly disclaimed in +individual files. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +MODIFICATIONS. + +GOVERNMENT USE: If you are acquiring this software on behalf of the +U.S. government, the Government shall have only "Restricted Rights" +in the software and related documentation as defined in the Federal +Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you +are acquiring the software on behalf of the Department of Defense, the +software shall be classified as "Commercial Computer Software" and the +Government shall have only "Restricted Rights" as defined in Clause +252.227-7013 (b) (3) of DFARs. Notwithstanding the foregoing, the +authors grant the U.S. Government and others acting in its behalf +permission to use and distribute the software in accordance with the +terms specified in this license. + diff --git a/overlay_toolchain/python/_asyncio.pyd b/overlay_toolchain/python/_asyncio.pyd new file mode 100644 index 00000000..28268071 Binary files /dev/null and b/overlay_toolchain/python/_asyncio.pyd differ diff --git a/overlay_toolchain/python/_bz2.pyd b/overlay_toolchain/python/_bz2.pyd new file mode 100644 index 00000000..d7b70c6c Binary files /dev/null and b/overlay_toolchain/python/_bz2.pyd differ diff --git a/overlay_toolchain/python/_ctypes.pyd b/overlay_toolchain/python/_ctypes.pyd new file mode 100644 index 00000000..abfdafd4 Binary files /dev/null and b/overlay_toolchain/python/_ctypes.pyd differ diff --git a/overlay_toolchain/python/_decimal.pyd b/overlay_toolchain/python/_decimal.pyd new file mode 100644 index 00000000..c9906b58 Binary files /dev/null and b/overlay_toolchain/python/_decimal.pyd differ diff --git a/overlay_toolchain/python/_elementtree.pyd b/overlay_toolchain/python/_elementtree.pyd new file mode 100644 index 00000000..fb4c5f25 Binary files /dev/null and b/overlay_toolchain/python/_elementtree.pyd differ diff --git a/overlay_toolchain/python/_hashlib.pyd b/overlay_toolchain/python/_hashlib.pyd new file mode 100644 index 00000000..9478531f Binary files /dev/null and b/overlay_toolchain/python/_hashlib.pyd differ diff --git a/overlay_toolchain/python/_lzma.pyd b/overlay_toolchain/python/_lzma.pyd new file mode 100644 index 00000000..bae5a565 Binary files /dev/null and b/overlay_toolchain/python/_lzma.pyd differ diff --git a/overlay_toolchain/python/_multiprocessing.pyd b/overlay_toolchain/python/_multiprocessing.pyd new file mode 100644 index 00000000..2f399ff3 Binary files /dev/null and b/overlay_toolchain/python/_multiprocessing.pyd differ diff --git a/overlay_toolchain/python/_overlapped.pyd b/overlay_toolchain/python/_overlapped.pyd new file mode 100644 index 00000000..1124765c Binary files /dev/null and b/overlay_toolchain/python/_overlapped.pyd differ diff --git a/overlay_toolchain/python/_queue.pyd b/overlay_toolchain/python/_queue.pyd new file mode 100644 index 00000000..6fa771a9 Binary files /dev/null and b/overlay_toolchain/python/_queue.pyd differ diff --git a/overlay_toolchain/python/_socket.pyd b/overlay_toolchain/python/_socket.pyd new file mode 100644 index 00000000..a598acb2 Binary files /dev/null and b/overlay_toolchain/python/_socket.pyd differ diff --git a/overlay_toolchain/python/_sqlite3.pyd b/overlay_toolchain/python/_sqlite3.pyd new file mode 100644 index 00000000..174aea7a Binary files /dev/null and b/overlay_toolchain/python/_sqlite3.pyd differ diff --git a/overlay_toolchain/python/_ssl.pyd b/overlay_toolchain/python/_ssl.pyd new file mode 100644 index 00000000..389186b6 Binary files /dev/null and b/overlay_toolchain/python/_ssl.pyd differ diff --git a/overlay_toolchain/python/_uuid.pyd b/overlay_toolchain/python/_uuid.pyd new file mode 100644 index 00000000..4b05aaf3 Binary files /dev/null and b/overlay_toolchain/python/_uuid.pyd differ diff --git a/overlay_toolchain/python/_wmi.pyd b/overlay_toolchain/python/_wmi.pyd new file mode 100644 index 00000000..fc442387 Binary files /dev/null and b/overlay_toolchain/python/_wmi.pyd differ diff --git a/overlay_toolchain/python/_zoneinfo.pyd b/overlay_toolchain/python/_zoneinfo.pyd new file mode 100644 index 00000000..4749e80e Binary files /dev/null and b/overlay_toolchain/python/_zoneinfo.pyd differ diff --git a/overlay_toolchain/python/libcrypto-3.dll b/overlay_toolchain/python/libcrypto-3.dll new file mode 100644 index 00000000..778f4edf Binary files /dev/null and b/overlay_toolchain/python/libcrypto-3.dll differ diff --git a/overlay_toolchain/python/libffi-8.dll b/overlay_toolchain/python/libffi-8.dll new file mode 100644 index 00000000..8ebbbe8d Binary files /dev/null and b/overlay_toolchain/python/libffi-8.dll differ diff --git a/overlay_toolchain/python/libssl-3.dll b/overlay_toolchain/python/libssl-3.dll new file mode 100644 index 00000000..569658b7 Binary files /dev/null and b/overlay_toolchain/python/libssl-3.dll differ diff --git a/overlay_toolchain/python/pyexpat.pyd b/overlay_toolchain/python/pyexpat.pyd new file mode 100644 index 00000000..b9586ba6 Binary files /dev/null and b/overlay_toolchain/python/pyexpat.pyd differ diff --git a/overlay_toolchain/python/python.cat b/overlay_toolchain/python/python.cat new file mode 100644 index 00000000..4dd1a375 Binary files /dev/null and b/overlay_toolchain/python/python.cat differ diff --git a/overlay_toolchain/python/python.exe b/overlay_toolchain/python/python.exe new file mode 100644 index 00000000..e93de81c Binary files /dev/null and b/overlay_toolchain/python/python.exe differ diff --git a/overlay_toolchain/python/python3.dll b/overlay_toolchain/python/python3.dll new file mode 100644 index 00000000..6b9a7fad Binary files /dev/null and b/overlay_toolchain/python/python3.dll differ diff --git a/overlay_toolchain/python/python313._pth b/overlay_toolchain/python/python313._pth new file mode 100644 index 00000000..7254fcf5 --- /dev/null +++ b/overlay_toolchain/python/python313._pth @@ -0,0 +1,5 @@ +python313.zip +. + +# Uncomment to run site.main() automatically +#import site diff --git a/overlay_toolchain/python/python313.dll b/overlay_toolchain/python/python313.dll new file mode 100644 index 00000000..b04d70f5 Binary files /dev/null and b/overlay_toolchain/python/python313.dll differ diff --git a/overlay_toolchain/python/pythonw.exe b/overlay_toolchain/python/pythonw.exe new file mode 100644 index 00000000..3661c902 Binary files /dev/null and b/overlay_toolchain/python/pythonw.exe differ diff --git a/overlay_toolchain/python/select.pyd b/overlay_toolchain/python/select.pyd new file mode 100644 index 00000000..cf0fac47 Binary files /dev/null and b/overlay_toolchain/python/select.pyd differ diff --git a/overlay_toolchain/python/sqlite3.dll b/overlay_toolchain/python/sqlite3.dll new file mode 100644 index 00000000..e86d34dc Binary files /dev/null and b/overlay_toolchain/python/sqlite3.dll differ diff --git a/overlay_toolchain/python/unicodedata.pyd b/overlay_toolchain/python/unicodedata.pyd new file mode 100644 index 00000000..6eadb85c Binary files /dev/null and b/overlay_toolchain/python/unicodedata.pyd differ diff --git a/overlay_toolchain/python/vcruntime140.dll b/overlay_toolchain/python/vcruntime140.dll new file mode 100644 index 00000000..53f15372 Binary files /dev/null and b/overlay_toolchain/python/vcruntime140.dll differ diff --git a/overlay_toolchain/python/vcruntime140_1.dll b/overlay_toolchain/python/vcruntime140_1.dll new file mode 100644 index 00000000..53a24953 Binary files /dev/null and b/overlay_toolchain/python/vcruntime140_1.dll differ diff --git a/overlay_toolchain/python/winsound.pyd b/overlay_toolchain/python/winsound.pyd new file mode 100644 index 00000000..01052bab Binary files /dev/null and b/overlay_toolchain/python/winsound.pyd differ diff --git a/overlay_toolchain/recompiler/seeds/dispatch_miss_seeds.json b/overlay_toolchain/recompiler/seeds/dispatch_miss_seeds.json new file mode 100644 index 00000000..5b446e2a --- /dev/null +++ b/overlay_toolchain/recompiler/seeds/dispatch_miss_seeds.json @@ -0,0 +1,251 @@ +{ + "schema": "psxrecomp-v4 dispatch-miss seeds", + "source": "runtime dispatch miss log \u00e2\u20ac\u201d functions called indirectly (JALR / function pointer tables)", + "note": "These functions have no static JAL callers and cannot be found by transitive discovery. They are reached at runtime via BIOS API dispatch tables (A0/B0/C0 vectors) or other indirect call mechanisms.", + "seeds": [ + { + "address": "0xBFC42380", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC42844", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC38AD4", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC42A90", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC42A10", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC27FB0", + "rationale": "dispatch miss: Kernel Part 2 function, indirect call" + }, + { + "address": "0xBFC36D48", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC38AA4", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC1E3AC", + "rationale": "dispatch miss: Shell function, called in vblank loop" + }, + { + "address": "0xBFC3045C", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30470", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30484", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30498", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30554", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30560", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC3056C", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30578", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC36DD0", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC11840", + "rationale": "dispatch miss: KP2 function, indirect call" + }, + { + "address": "0xBFC36DF8", + "rationale": "dispatch miss: Shell function, indirect call" + }, + { + "address": "0xBFC11524", + "rationale": "dispatch miss: KP2 secondary entry point for exception handler, mid-function split of func_00001A00, called during VBlank" + }, + { + "address": "0xBFC11610", + "rationale": "dispatch miss: KP2 function, tail-call target from 0xBFC11524 exception handler path" + }, + { + "address": "0xBFC14A54", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain BUSY-writer at RAM 0x4F54; alias rule RAM=ROM-0xBFC10000+0x500. Reached via JAL inside FUN_bfc147f4; never emitted as standalone entry." + }, + { + "address": "0xBFC158D0", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-0 BUSY writer at RAM 0x5DD0; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC158D8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-1 BUSY writer at RAM 0x5DD8; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC159F4", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x02 OPEN to [0x7568+slot] at RAM 0x5EF4. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry \u00e2\u20ac\u201d without this the gate never clears." + }, + { + "address": "0xBFC15AA8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x04 OPEN to [0x7568+slot] at RAM 0x5FA8. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry \u00e2\u20ac\u201d paired with 0xBFC159F4." + }, + { + "address": "0xBFC04910", + "rationale": "Tomba boot dispatch miss after licensed PlayStation screen. Verified in Ghidra/runtime disassembly as a standalone BIOS init routine between 0xBFC048D0 and 0xBFC04ABC, with return at 0xBFC04A98 and table data reference from 0xBFC04554." + }, + { + "address": "0xBFC04850", + "rationale": "Tomba boot dispatch miss after seeding 0xBFC04910. Verified in Ghidra/runtime disassembly as a standalone BIOS callback-list init routine between 0xBFC0472C and 0xBFC048D0, with return at 0xBFC048C8 and table data reference from 0xBFC04588." + }, + { + "address": "0xBFC079F8", + "rationale": "Tomba boot dispatch miss after game callback coverage fixes. Verified in Ghidra as a tiny BIOS table leaf routine (sw a0,0(sp); jr ra; clear v0) referenced by data at 0xBFC04484 and 0xBFC0E30C." + }, + { + "address": "0xBFC15F1C", + "rationale": "dirty_ram hot: SIO/PAD interrupt handler entry point (RAM 0x641C), called via jalr. 10852+ hits/frame across internal branch targets (0x641C, 0x6430, 0x6444, 0x6458, 0x650C, 0x6514, 0x658C, 0x6594). Seeding entry only; CFG discovers internal labels." + }, + { + "address": "0xBFC02934", + "rationale": "kernel jump-table target: A0:0F (unresolved (see psx-spx A0 table)) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03200", + "rationale": "kernel jump-table target: A0:16 (strncat) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC034D0", + "rationale": "kernel jump-table target: A0:1C (atob helper) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03514", + "rationale": "kernel jump-table target: A0:1D (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0357C", + "rationale": "kernel jump-table target: A0:1E (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC035C0", + "rationale": "kernel jump-table target: A0:1F (abs) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03628", + "rationale": "kernel jump-table target: A0:20 (labs) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03694", + "rationale": "kernel jump-table target: A0:21 (atoi) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC036FC", + "rationale": "kernel jump-table target: A0:22 (atol) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03894", + "rationale": "kernel jump-table target: A0:24 (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC01B08", + "rationale": "kernel jump-table target: A0:29 (bcmp) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02B8C", + "rationale": "kernel jump-table target: A0:2B (memset) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02BC8", + "rationale": "kernel jump-table target: A0:2C (memmove) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02C50", + "rationale": "kernel jump-table target: A0:2D (memcmp) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02230", + "rationale": "kernel jump-table target: A0:30 (rand-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC021A0", + "rationale": "kernel jump-table target: A0:37 (rand-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8E0", + "rationale": "kernel jump-table target: A0:40 (SystemErrorUnresolvedException) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04120", + "rationale": "kernel jump-table target: A0:4D (ChangeClearRCnt-adjacent) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8F0", + "rationale": "kernel jump-table target: A0:4F (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D900", + "rationale": "kernel jump-table target: A0:50 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D910", + "rationale": "kernel jump-table target: A0:52 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D920", + "rationale": "kernel jump-table target: A0:53 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0B0C4", + "rationale": "kernel jump-table target: A0:6F (card/dev service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04AA0", + "rationale": "kernel jump-table target: A0:94 (card-adjacent service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D930", + "rationale": "kernel jump-table target: A0:9A (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D940", + "rationale": "kernel jump-table target: A0:9B (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06750", + "rationale": "kernel jump-table target: A0:9C (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06728", + "rationale": "kernel jump-table target: A0:9D (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC050DC", + "rationale": "kernel jump-table target: A0:9E (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D4F0", + "rationale": "kernel jump-table target: A0:B4 (GetSystemInfo-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + } + ] +} \ No newline at end of file diff --git a/overlay_toolchain/recompiler/seeds/openbios_dispatch_miss.json b/overlay_toolchain/recompiler/seeds/openbios_dispatch_miss.json new file mode 100644 index 00000000..a5b5f888 --- /dev/null +++ b/overlay_toolchain/recompiler/seeds/openbios_dispatch_miss.json @@ -0,0 +1,37 @@ +{ + "schema": "psxrecomp phase2 seeds", + "source": "empirical dispatch-miss loop for the OpenBIOS profile - addresses observed as FAIL-FAST unknown dispatch at runtime, merged by gen_bios_seeds_from_elf.py --extra. Same loop as SCPH1001's dispatch_miss_seeds.json.", + "seed_count": 6, + "seeds": [ + { + "address": "0xBFC095F8", + "label": "osDbgPrintf_rodata_guard", + "rationale": "Hard-cap osDbgPrintf (0xBFC091EC) before embedded rodata/pointer table; emit walked into SPECIAL 0x3C data and stubbed the whole function (FAIL-FAST rematch OpenBIOS boot)." + }, + { + "address": "0xBFC0B39C", + "label": "miss_BFC0B39C", + "rationale": "empirical FAIL-FAST unknown dispatch during OpenBIOS bring-up boot loop" + }, + { + "address": "0xBFC0B3E0", + "label": "miss_BFC0B3E0", + "rationale": "empirical FAIL-FAST unknown dispatch during OpenBIOS bring-up boot loop" + }, + { + "address": "0xBFC0B410", + "label": "miss_BFC0B410", + "rationale": "empirical FAIL-FAST unknown dispatch during OpenBIOS bring-up boot loop" + }, + { + "address": "0xBFC0D070", + "label": "miss_BFC0D070", + "rationale": "empirical FAIL-FAST unknown dispatch during OpenBIOS bring-up boot loop" + }, + { + "address": "0xBFC0D08C", + "label": "miss_BFC0D08C", + "rationale": "empirical FAIL-FAST unknown dispatch during OpenBIOS bring-up boot loop" + } + ] +} diff --git a/overlay_toolchain/recompiler/seeds/openbios_elf_seeds.json b/overlay_toolchain/recompiler/seeds/openbios_elf_seeds.json new file mode 100644 index 00000000..9addc76b --- /dev/null +++ b/overlay_toolchain/recompiler/seeds/openbios_elf_seeds.json @@ -0,0 +1,3242 @@ +{ + "schema": "psxrecomp phase2 seeds", + "source": "gen_bios_seeds_from_elf.py over openbios.elf, shell.elf + 5 empirical seeds from openbios_dispatch_miss.json", + "seed_count": 647, + "seeds": [ + { + "address": "0xBFC00000", + "label": "elf_entry_openbios_elf", + "rationale": "ELF entry point (e_entry) of openbios.elf" + }, + { + "address": "0xBFC00084", + "label": "exit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00144", + "label": "main", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0019C", + "label": "init_main_thread", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC001AC", + "label": "_boot", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0039C", + "label": "buComputeSectorChecksum", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC003C4", + "label": "buVerifySectorChecksum", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC003F8", + "label": "buValidateEntryAndCorrect", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00514", + "label": "filterInner", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00520", + "label": "filterFirst", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0052C", + "label": "buReallocateBrokenSectorAndRetry", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC006C8", + "label": "buFormat", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00894", + "label": "buInit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00C48", + "label": "initBackupUnit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00CFC", + "label": "cardInfo", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00D60", + "label": "buWriteTOCInternal.isra.0", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00E98", + "label": "buFinishAndTrigger", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00EE0", + "label": "buLowLevelOpCompleted", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC00F8C", + "label": "code_ptr_BFC00F8C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC00FB0", + "label": "code_ptr_BFC00FB0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC00FB8", + "label": "code_ptr_BFC00FB8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC010C4", + "label": "code_ptr_BFC010C4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC010D0", + "label": "code_ptr_BFC010D0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC01124", + "label": "code_ptr_BFC01124", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC011E0", + "label": "code_ptr_BFC011E0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC0153C", + "label": "code_ptr_BFC0153C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC01570", + "label": "buLowLevelOpError1", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC015E0", + "label": "buLowLevelOpError2", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC01650", + "label": "buLowLevelOpError3", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC016C0", + "label": "buReadTOC", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0175C", + "label": "buWriteTOC", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC017C0", + "label": "buSetAutoFormat", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC017D0", + "label": "dev_bu_close", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC01830", + "label": "buDevInit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC019B4", + "label": "dev_bu_format", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC01A44", + "label": "dev_bu_undelete", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC01A84", + "label": "buNextFileInternal", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC01BC4", + "label": "dev_bu_open", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC01EEC", + "label": "dev_bu_erase", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC02144", + "label": "dev_bu_nextFile", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC02258", + "label": "dev_bu_firstFile", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC023C8", + "label": "dev_bu_rename", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC02554", + "label": "dev_bu_deinit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC02594", + "label": "buRelativeToAbsoluteSector", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC025EC", + "label": "buGetReallocated", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC02640", + "label": "dev_bu_read", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC029A4", + "label": "dev_bu_write", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC02DD8", + "label": "addMemoryCardDevice", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC02DEC", + "label": "deinitCDRom", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC02E70", + "label": "initializeCDRomHandlersAndEvents", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC02FB8", + "label": "initCDRom", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03000", + "label": "cdromBlockGetStatus", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC030BC", + "label": "addCDRomDevice", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC030D0", + "label": "strcat.isra.0", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0310C", + "label": "findDirectoryEntryForFilename", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03404", + "label": "cdromReadPathTable", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC035B4", + "label": "dev_cd_open", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC036E0", + "label": "dev_cd_read", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC037F0", + "label": "dev_cd_nextFile", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC038FC", + "label": "dev_cd_firstFile", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03A30", + "label": "dev_cd_chdir", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03A78", + "label": "cdromBlockReading", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03CEC", + "label": "getLastCDRomError", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03D0C", + "label": "setCDRomIRQAutoAck", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03D28", + "label": "enqueueCDRomHandlers", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03DA0", + "label": "dequeueCDRomHandlers", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03DE0", + "label": "Krom2Offset", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03E70", + "label": "Krom2RawAdd", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03F00", + "label": "firstFile", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03FB0", + "label": "nextFile", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC03FD4", + "label": "format", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04080", + "label": "setupFileIO", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0414C", + "label": "getDeviceStatus", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0415C", + "label": "setDeviceStatus", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04168", + "label": "printInstalledDevices", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC041D0", + "label": "findDevice", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04270", + "label": "removeDevice", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04304", + "label": "getFileFromHandle", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04330", + "label": "ioabortraw", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04348", + "label": "ioAbortWithMsg", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04374", + "label": "findEmptyFile", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC043D0", + "label": "splitFilepathAndFindDevice", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC044D0", + "label": "cdevscan", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04538", + "label": "psxexit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0459C", + "label": "isFileConsole", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC045E0", + "label": "addDevice", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04668", + "label": "xprintfcallback", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC046C0", + "label": "psxopen", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04790", + "label": "psxlseek", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04840", + "label": "psxread", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04974", + "label": "psxwrite", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04AA8", + "label": "psxclose", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04B2C", + "label": "reopenStdio", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04B84", + "label": "installStdIo", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04C0C", + "label": "psxioctl", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04CBC", + "label": "psxgetc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04CF0", + "label": "psxputc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04D1C", + "label": "psxputchar", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04DA0", + "label": "psxgetchar", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04DCC", + "label": "psxgets", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04F1C", + "label": "psxputs", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04F64", + "label": "psxprintf", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC04FA4", + "label": "psxrename", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC050DC", + "label": "psxerase", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05190", + "label": "GPU_send", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC051A0", + "label": "GPU_abort", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC051CC", + "label": "GPU_timeout", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC051F8", + "label": "GPU_dw", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC052E4", + "label": "GPU_getStatus", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC052F4", + "label": "GPU_sync", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC053C4", + "label": "GPU_mem2vram", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05474", + "label": "GPU_cw", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC054A0", + "label": "GPU_cwb", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC054F4", + "label": "GPU_sendPackets", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05578", + "label": "initEvents", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05600", + "label": "getFreeEvCBSlot", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05648", + "label": "openEvent", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC056B4", + "label": "enableEvent", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC056EC", + "label": "disableEvent", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05724", + "label": "closeEvent", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0574C", + "label": "testEvent", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0578C", + "label": "waitEvent", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC057F0", + "label": "flushCache", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05858", + "label": "toupper", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05878", + "label": "tolower", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05894", + "label": "memchr", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC058C8", + "label": "strcat", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0590C", + "label": "strcpy", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05930", + "label": "strncpy", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0596C", + "label": "strchr", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0599C", + "label": "strrchr", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC059CC", + "label": "strlen", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC059F4", + "label": "strncat", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05A44", + "label": "strcmp", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05A68", + "label": "strncmp", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05AA4", + "label": "strstr", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05AFC", + "label": "installHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05B24", + "label": "installKernelHandlers", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05B64", + "label": "installExceptionHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05B74", + "label": "setDefaultExceptionJmpBuf", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05B88", + "label": "setExceptionJmpBuf", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05B94", + "label": "clearFileError", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05B9C", + "label": "getOpenBiosApiVersionImpl", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05BA4", + "label": "getOpenBiosBuildIdImpl", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05BB0", + "label": "getB0table", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05BD8", + "label": "getC0table", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05C00", + "label": "atoi", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05C0C", + "label": "atol", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05C14", + "label": "patchA0table", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05C8C", + "label": "unimplemented", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05E10", + "label": "copyDataAndInitializeBSS", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05E54", + "label": "copyA0table", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05E6C", + "label": "psxdummy", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05E74", + "label": "psxtodigit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05EC4", + "label": "psxabs", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05ED4", + "label": "psxatob", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05F08", + "label": "psxstrpbrk", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05F48", + "label": "psxstrspn", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC05FA8", + "label": "psxstrcspn", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06008", + "label": "psxstrtok", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0604C", + "label": "psxbcopy", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06084", + "label": "psxbzero", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC060C4", + "label": "psxbcmp", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC060E4", + "label": "psxrand", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06110", + "label": "psxsrand", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0611C", + "label": "psxlsearch", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06180", + "label": "psxbsearch", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06220", + "label": "getSystemInfo", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06248", + "label": "code_ptr_BFC06248", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC06254", + "label": "code_ptr_BFC06254", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC06260", + "label": "code_ptr_BFC06260", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC06270", + "label": "code_ptr_BFC06270", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC06278", + "label": "code_ptr_BFC06278", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC06288", + "label": "code_ptr_BFC06288", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC06290", + "label": "code_ptr_BFC06290", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC06298", + "label": "code_ptr_BFC06298", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC062A0", + "label": "code_ptr_BFC062A0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC062A8", + "label": "setMemSize", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06324", + "label": "readHeader", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0637C", + "label": "loadExeHeader", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC063E4", + "label": "loadExe", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0648C", + "label": "loadAndExec", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06634", + "label": "exec", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC066B0", + "label": "psxsetjmp", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC066EC", + "label": "psxlongjmp", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06728", + "label": "initThreads", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06834", + "label": "getFreeTCBslot", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0688C", + "label": "openThread", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC068F8", + "label": "closeThread", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06924", + "label": "changeThread", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06950", + "label": "exceptionVector", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06960", + "label": "A0Vector", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06970", + "label": "B0Vector", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06980", + "label": "C0Vector", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06990", + "label": "romsyscall_printf", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0699C", + "label": "isspace", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC069B8", + "label": "strncmp", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC069F4", + "label": "muteSpu", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06A10", + "label": "fatal", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06A38", + "label": "initHandlersArray.constprop.0", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06A8C", + "label": "strcpy.isra.0", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06AA8", + "label": "strcat.isra.0", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06AE4", + "label": "findWordItem.constprop.0", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06C54", + "label": "gameMainThunk", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC06C7C", + "label": "boot", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07390", + "label": "bootThunk", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC073E0", + "label": "setConfiguration", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC073F8", + "label": "getConfiguration", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07424", + "label": "drawSplashScreen", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0742C", + "label": "runExp1PreHook", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07484", + "label": "runExp1PostHook", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC074DC", + "label": "startShell", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07578", + "label": "mcResetStatus", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07604", + "label": "mcWaitForStatus", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0767C", + "label": "mcWaitForStatusAndReturnIndex", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07704", + "label": "patch_remove_ChgclrPAD", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07714", + "label": "patch_disable_slotChangeOnAbort", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07724", + "label": "patch_send_pad", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07734", + "label": "patch_startPad", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07744", + "label": "patch_stopPad", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07750", + "label": "mcAllowNewCard", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07760", + "label": "mcReadSector", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07808", + "label": "mcWriteSector", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC078B0", + "label": "cardInfoInternal", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07944", + "label": "mcGetLastDevice", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07968", + "label": "dev_tty_init", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC079C8", + "label": "dev_tty_open", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07A24", + "label": "ttyGetChar", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07A74", + "label": "dev_tty_action", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07CA4", + "label": "dev_tty_ioctl", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07D94", + "label": "addConsoleDevice", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07DA8", + "label": "addDummyConsoleDevice", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07DBC", + "label": "patch_hash", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC07E84", + "label": "patch_hook", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08060", + "label": "clear_card_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08068", + "label": "custom_handler_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08070", + "label": "initgun_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08078", + "label": "patch_card_info_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0809C", + "label": "patch_card_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC080A4", + "label": "patch_card_2_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC080AC", + "label": "patch_card2_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC080D0", + "label": "patch_card2_2_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC080F4", + "label": "patch_gte_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC080FC", + "label": "patch_gte_2_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08104", + "label": "patch_gte_3_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0810C", + "label": "patch_pad_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0817C", + "label": "patch_pad_2_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC081EC", + "label": "patch_pad_3_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08220", + "label": "remove_ChgclrPAD_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08254", + "label": "remove_ChgclrPAD_2_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08288", + "label": "send_pad_1_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC082DC", + "label": "send_pad_2_execute", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08330", + "label": "BoardConsoleInit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08338", + "label": "BoardConsolePuts", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08360", + "label": "BoardConsolePutc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08370", + "label": "BoardEarlyInit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08378", + "label": "BoardInit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08380", + "label": "BoardLateInit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08388", + "label": "BoardShutdown", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08390", + "label": "BoardExceptionHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08398", + "label": "cpu_early_init", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC083A0", + "label": "cpu_init", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC083A8", + "label": "cpu_late_init", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC083B0", + "label": "__sinit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC083B8", + "label": "libc_init", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08478", + "label": "qsort", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC085D8", + "label": "memcpy", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08604", + "label": "memmove", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08674", + "label": "memcmp", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC086C4", + "label": "memset", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC086E8", + "label": "strtol", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC088F0", + "label": "vxprintf", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC08C58", + "label": "code_ptr_BFC08C58", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC08C9C", + "label": "code_ptr_BFC08C9C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC08F38", + "label": "code_ptr_BFC08F38", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC08F4C", + "label": "code_ptr_BFC08F4C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC08F64", + "label": "code_ptr_BFC08F64", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC08F80", + "label": "code_ptr_BFC08F80", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC08FD4", + "label": "code_ptr_BFC08FD4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC09028", + "label": "code_ptr_BFC09028", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC09108", + "label": "_exit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC0912C", + "label": "_ucsdk_start", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC09198", + "label": "dbgput", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC091E0", + "label": "dbgput.constprop.0", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC091EC", + "label": "osDbgPrintf", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC095F8", + "label": "osDbgPrintf_rodata_guard", + "rationale": "Hard-cap osDbgPrintf (0xBFC091EC) before embedded rodata/pointer table; emit walked into SPECIAL 0x3C data and stubbed the whole function (FAIL-FAST rematch OpenBIOS boot)." + }, + { + "address": "0xBFC0A500", + "label": "elf_entry_shell_elf", + "rationale": "ELF entry point (e_entry) of shell.elf" + }, + { + "address": "0xBFC0A564", + "label": "main", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B160", + "label": "memset", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B184", + "label": "startDmaOneSector", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B218", + "label": "initCD", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B250", + "label": "isCDError", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B280", + "label": "isCDSuccess", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B298", + "label": "isCDAudio", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B2B0", + "label": "checkCD", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B378", + "label": "code_ptr_BFC0B378", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B39C", + "label": "miss_BFC0B39C", + "rationale": "empirical dispatch-miss seed merged from openbios_dispatch_miss.json" + }, + { + "address": "0xBFC0B3E0", + "label": "miss_BFC0B3E0", + "rationale": "empirical dispatch-miss seed merged from openbios_dispatch_miss.json" + }, + { + "address": "0xBFC0B410", + "label": "miss_BFC0B410", + "rationale": "empirical dispatch-miss seed merged from openbios_dispatch_miss.json" + }, + { + "address": "0xBFC0B484", + "label": "code_ptr_BFC0B484", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B4D0", + "label": "code_ptr_BFC0B4D0", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B514", + "label": "code_ptr_BFC0B514", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B538", + "label": "code_ptr_BFC0B538", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B558", + "label": "code_ptr_BFC0B558", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B594", + "label": "code_ptr_BFC0B594", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B760", + "label": "code_ptr_BFC0B760", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B7A0", + "label": "code_ptr_BFC0B7A0", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B7D4", + "label": "code_ptr_BFC0B7D4", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B7EC", + "label": "code_ptr_BFC0B7EC", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B810", + "label": "code_ptr_BFC0B810", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B844", + "label": "code_ptr_BFC0B844", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B868", + "label": "code_ptr_BFC0B868", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B880", + "label": "code_ptr_BFC0B880", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B888", + "label": "code_ptr_BFC0B888", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0B8CC", + "label": "generateCosTable", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B928", + "label": "waitGPU", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0B94C", + "label": "flip", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0BAA8", + "label": "waitVSync", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0BB94", + "label": "initGPU", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0BC24", + "label": "orientation", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0BC88", + "label": "compare", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0BD6C", + "label": "qsort", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0BEAC", + "label": "convexHull", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0C0DC", + "label": "sendGPUVertex", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0C110", + "label": "startLerp", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0C2AC", + "label": "idle", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0C2C8", + "label": "lerpC.isra.0", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0C354", + "label": "dCos", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0C3C0", + "label": "generateRotationMatrix3D", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0C4A8", + "label": "multiplyMatrix3D", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0C828", + "label": "scaleMatrix3D", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0C970", + "label": "matrixVertexMul3D", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CAB0", + "label": "matrixVertexMul3Dz", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CB20", + "label": "dDiv", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CC40", + "label": "initSPU", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CC98", + "label": "checkSPU", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CD74", + "label": "uninitSPU", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CD8C", + "label": "spuSchedulePing", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CDEC", + "label": "spuScheduleIdle", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CE20", + "label": "spuScheduleOutro", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CE78", + "label": "spuScheduleError", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CE9C", + "label": "SPUInit", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CF14", + "label": "SPUResetVoice", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CF50", + "label": "SPUSetVoiceVolume", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CF90", + "label": "SPUWaitIdle", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0CFC0", + "label": "MOD_SetBPM", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0D024", + "label": "MOD_UpdateEffect", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0D070", + "label": "miss_BFC0D070", + "rationale": "empirical dispatch-miss seed merged from openbios_dispatch_miss.json" + }, + { + "address": "0xBFC0D08C", + "label": "miss_BFC0D08C", + "rationale": "empirical dispatch-miss seed merged from openbios_dispatch_miss.json" + }, + { + "address": "0xBFC0D0A4", + "label": "code_ptr_BFC0D0A4", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D11C", + "label": "code_ptr_BFC0D11C", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D174", + "label": "code_ptr_BFC0D174", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D198", + "label": "code_ptr_BFC0D198", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D1B8", + "label": "code_ptr_BFC0D1B8", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D214", + "label": "code_ptr_BFC0D214", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D29C", + "label": "code_ptr_BFC0D29C", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D2F8", + "label": "code_ptr_BFC0D2F8", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D3A8", + "label": "code_ptr_BFC0D3A8", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D4A0", + "label": "code_ptr_BFC0D4A0", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D4DC", + "label": "code_ptr_BFC0D4DC", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0D588", + "label": "SPUUploadInstruments.constprop.0", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0D624", + "label": "MOD_Check", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0D698", + "label": "loadInternal", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0D884", + "label": "MOD_Load", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0D88C", + "label": "MOD_Silence", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0D8C4", + "label": "MOD_Poll", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC0DD00", + "label": "code_ptr_BFC0DD00", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DD34", + "label": "code_ptr_BFC0DD34", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DD48", + "label": "code_ptr_BFC0DD48", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DD84", + "label": "code_ptr_BFC0DD84", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DDC0", + "label": "code_ptr_BFC0DDC0", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DDD0", + "label": "code_ptr_BFC0DDD0", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DDF0", + "label": "code_ptr_BFC0DDF0", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DE50", + "label": "code_ptr_BFC0DE50", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DE70", + "label": "code_ptr_BFC0DE70", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DEA0", + "label": "code_ptr_BFC0DEA0", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DEF4", + "label": "code_ptr_BFC0DEF4", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DF00", + "label": "code_ptr_BFC0DF00", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DF18", + "label": "code_ptr_BFC0DF18", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DF30", + "label": "code_ptr_BFC0DF30", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DF68", + "label": "code_ptr_BFC0DF68", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DF80", + "label": "code_ptr_BFC0DF80", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DFAC", + "label": "code_ptr_BFC0DFAC", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DFD4", + "label": "code_ptr_BFC0DFD4", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0DFDC", + "label": "code_ptr_BFC0DFDC", + "rationale": "code pointer in a data section of shell.elf" + }, + { + "address": "0xBFC0E050", + "label": "ramsyscall_printf", + "rationale": "ELF STT_FUNC symbol from shell.elf" + }, + { + "address": "0xBFC1E514", + "label": "fastMemset", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1E6CC", + "label": "cdromUndeliverAllExceptAckAndRdy", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1E6E0", + "label": "code_ptr_BFC1E6E0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E748", + "label": "cdromUndeliverAll", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1E7D4", + "label": "code_ptr_BFC1E7D4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E7DC", + "label": "code_ptr_BFC1E7DC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E7E4", + "label": "initiateDMA", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1E7E8", + "label": "code_ptr_BFC1E7E8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E7F0", + "label": "code_ptr_BFC1E7F0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E7F4", + "label": "code_ptr_BFC1E7F4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E80C", + "label": "code_ptr_BFC1E80C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E810", + "label": "code_ptr_BFC1E810", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E814", + "label": "code_ptr_BFC1E814", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E834", + "label": "code_ptr_BFC1E834", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E848", + "label": "code_ptr_BFC1E848", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1E8CC", + "label": "genericErrorState", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1E91C", + "label": "demuteAck", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1E94C", + "label": "cdromDMAVerifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1E9E8", + "label": "cdromIOHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1EA24", + "label": "cdromDMAHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1EA60", + "label": "cdromIOVerifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1EB50", + "label": "code_ptr_BFC1EB50", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EBD4", + "label": "code_ptr_BFC1EBD4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EBD8", + "label": "code_ptr_BFC1EBD8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EBDC", + "label": "code_ptr_BFC1EBDC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EBE8", + "label": "code_ptr_BFC1EBE8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EBEC", + "label": "code_ptr_BFC1EBEC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EBF0", + "label": "code_ptr_BFC1EBF0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EBF8", + "label": "code_ptr_BFC1EBF8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EC0C", + "label": "code_ptr_BFC1EC0C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EC10", + "label": "code_ptr_BFC1EC10", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EC14", + "label": "code_ptr_BFC1EC14", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EC20", + "label": "code_ptr_BFC1EC20", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EC30", + "label": "code_ptr_BFC1EC30", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EC34", + "label": "code_ptr_BFC1EC34", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EC44", + "label": "code_ptr_BFC1EC44", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EC94", + "label": "code_ptr_BFC1EC94", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1ECA0", + "label": "code_ptr_BFC1ECA0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1ECD4", + "label": "code_ptr_BFC1ECD4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1ECDC", + "label": "code_ptr_BFC1ECDC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EDC4", + "label": "code_ptr_BFC1EDC4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EED4", + "label": "code_ptr_BFC1EED4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EEE4", + "label": "code_ptr_BFC1EEE4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EEFC", + "label": "code_ptr_BFC1EEFC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EF04", + "label": "code_ptr_BFC1EF04", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EF14", + "label": "code_ptr_BFC1EF14", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EF24", + "label": "code_ptr_BFC1EF24", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EF34", + "label": "code_ptr_BFC1EF34", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EFC4", + "label": "code_ptr_BFC1EFC4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EFCC", + "label": "code_ptr_BFC1EFCC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EFD4", + "label": "code_ptr_BFC1EFD4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EFD8", + "label": "code_ptr_BFC1EFD8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EFDC", + "label": "code_ptr_BFC1EFDC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EFE4", + "label": "code_ptr_BFC1EFE4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EFEC", + "label": "code_ptr_BFC1EFEC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EFF0", + "label": "code_ptr_BFC1EFF0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1EFF4", + "label": "code_ptr_BFC1EFF4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F004", + "label": "code_ptr_BFC1F004", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F010", + "label": "code_ptr_BFC1F010", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F014", + "label": "code_ptr_BFC1F014", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F034", + "label": "code_ptr_BFC1F034", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F0C4", + "label": "code_ptr_BFC1F0C4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F0FC", + "label": "code_ptr_BFC1F0FC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F1F0", + "label": "code_ptr_BFC1F1F0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F290", + "label": "cdromSeekL", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1F36C", + "label": "cdromGetStatus", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1F3C8", + "label": "cdromRead", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1F3F0", + "label": "code_ptr_BFC1F3F0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F408", + "label": "code_ptr_BFC1F408", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F49C", + "label": "cdromSetMode", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1F510", + "label": "resetAllCDRomIRQs", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1F54C", + "label": "enableAllCDRomIRQs", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1F568", + "label": "cdromInnerInit", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1F6B8", + "label": "IRQVerifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1F7D4", + "label": "code_ptr_BFC1F7D4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F7D8", + "label": "code_ptr_BFC1F7D8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F7DC", + "label": "code_ptr_BFC1F7DC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F7E0", + "label": "code_ptr_BFC1F7E0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F7E4", + "label": "code_ptr_BFC1F7E4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F7E8", + "label": "code_ptr_BFC1F7E8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F7EC", + "label": "code_ptr_BFC1F7EC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F7F4", + "label": "code_ptr_BFC1F7F4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F804", + "label": "code_ptr_BFC1F804", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F808", + "label": "code_ptr_BFC1F808", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F80C", + "label": "code_ptr_BFC1F80C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F814", + "label": "code_ptr_BFC1F814", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F818", + "label": "code_ptr_BFC1F818", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F81C", + "label": "code_ptr_BFC1F81C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F824", + "label": "code_ptr_BFC1F824", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F834", + "label": "code_ptr_BFC1F834", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F844", + "label": "code_ptr_BFC1F844", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F84C", + "label": "code_ptr_BFC1F84C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1F854", + "label": "code_ptr_BFC1F854", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FA48", + "label": "T3verifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FAA0", + "label": "T2verifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FAF8", + "label": "T1verifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FB50", + "label": "T0verifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FBA4", + "label": "T3handler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FBD4", + "label": "code_ptr_BFC1FBD4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FBD8", + "label": "T2handler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FBE8", + "label": "code_ptr_BFC1FBE8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FBEC", + "label": "code_ptr_BFC1FBEC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FBF0", + "label": "code_ptr_BFC1FBF0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FC08", + "label": "code_ptr_BFC1FC08", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FC0C", + "label": "T1handler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FC18", + "label": "code_ptr_BFC1FC18", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FC1C", + "label": "code_ptr_BFC1FC1C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FC20", + "label": "code_ptr_BFC1FC20", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FC2C", + "label": "code_ptr_BFC1FC2C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FC40", + "label": "T0handler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FC44", + "label": "code_ptr_BFC1FC44", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FC4C", + "label": "code_ptr_BFC1FC4C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FC74", + "label": "enqueueIrqHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FC9C", + "label": "setIrqAutoAck", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FCB4", + "label": "enqueueRCntIrqs", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FD58", + "label": "setTimerAutoAck", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FD74", + "label": "getTimer", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FD98", + "label": "initTimer", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FDF8", + "label": "enableTimerIRQ", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FE2C", + "label": "disableTimerIRQ", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FE60", + "label": "restartTimer", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FE8C", + "label": "sysEnqIntRP", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FEB0", + "label": "sysDeqIntRP", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FF40", + "label": "syscallVerifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC1FFD4", + "label": "code_ptr_BFC1FFD4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FFD8", + "label": "code_ptr_BFC1FFD8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FFDC", + "label": "code_ptr_BFC1FFDC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FFE0", + "label": "code_ptr_BFC1FFE0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FFE4", + "label": "code_ptr_BFC1FFE4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FFE8", + "label": "code_ptr_BFC1FFE8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC1FFF4", + "label": "code_ptr_BFC1FFF4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20004", + "label": "code_ptr_BFC20004", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20010", + "label": "code_ptr_BFC20010", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20014", + "label": "code_ptr_BFC20014", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20018", + "label": "code_ptr_BFC20018", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC2002C", + "label": "code_ptr_BFC2002C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20034", + "label": "code_ptr_BFC20034", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20044", + "label": "code_ptr_BFC20044", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20050", + "label": "enqueueSyscallHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC2005C", + "label": "multi_malloc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20184", + "label": "multi_free", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC202DC", + "label": "multi_realloc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC204F4", + "label": "code_ptr_BFC204F4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20554", + "label": "user_malloc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC2055C", + "label": "user_free", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20564", + "label": "user_realloc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC2056C", + "label": "user_initheap", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC2059C", + "label": "kern_malloc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC205A4", + "label": "kern_free", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC205AC", + "label": "kern_realloc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC205B4", + "label": "kern_initheap", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC205E4", + "label": "deliverEvent", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC206B8", + "label": "undeliverEvent", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20730", + "label": "wrapper_calloc", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20770", + "label": "getCop0CauseAndEPC", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20780", + "label": "exceptionHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC207E4", + "label": "code_ptr_BFC207E4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20940", + "label": "code_ptr_BFC20940", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC209A0", + "label": "returnFromException", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20A54", + "label": "A0Handler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20A74", + "label": "B0Handler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20A94", + "label": "C0Handler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20AB4", + "label": "OBHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20AD0", + "label": "unimplementedThunk", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20AE8", + "label": "ramsyscall_printf", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20AF4", + "label": "busyloop", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20B30", + "label": "mcReadHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20B80", + "label": "code_ptr_BFC20B80", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20BEC", + "label": "code_ptr_BFC20BEC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20C20", + "label": "code_ptr_BFC20C20", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20CCC", + "label": "code_ptr_BFC20CCC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20D00", + "label": "code_ptr_BFC20D00", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20D34", + "label": "code_ptr_BFC20D34", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20D48", + "label": "code_ptr_BFC20D48", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20D5C", + "label": "code_ptr_BFC20D5C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20D8C", + "label": "code_ptr_BFC20D8C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20DA0", + "label": "code_ptr_BFC20DA0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20DFC", + "label": "code_ptr_BFC20DFC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20E48", + "label": "code_ptr_BFC20E48", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20EA4", + "label": "code_ptr_BFC20EA4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20F18", + "label": "mcWriteHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC20F70", + "label": "code_ptr_BFC20F70", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20FD4", + "label": "code_ptr_BFC20FD4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20FD8", + "label": "code_ptr_BFC20FD8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20FDC", + "label": "code_ptr_BFC20FDC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20FE0", + "label": "code_ptr_BFC20FE0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20FE4", + "label": "code_ptr_BFC20FE4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20FE8", + "label": "code_ptr_BFC20FE8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC20FEC", + "label": "code_ptr_BFC20FEC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21004", + "label": "code_ptr_BFC21004", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21014", + "label": "code_ptr_BFC21014", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC2101C", + "label": "code_ptr_BFC2101C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21020", + "label": "code_ptr_BFC21020", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC2102C", + "label": "code_ptr_BFC2102C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21034", + "label": "code_ptr_BFC21034", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21044", + "label": "code_ptr_BFC21044", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC2104C", + "label": "code_ptr_BFC2104C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC210C0", + "label": "code_ptr_BFC210C0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC210F4", + "label": "code_ptr_BFC210F4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21104", + "label": "code_ptr_BFC21104", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC2113C", + "label": "code_ptr_BFC2113C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21190", + "label": "code_ptr_BFC21190", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC211B8", + "label": "code_ptr_BFC211B8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC211CC", + "label": "code_ptr_BFC211CC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC211FC", + "label": "code_ptr_BFC211FC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC212E0", + "label": "mcInfoHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC214E0", + "label": "getCardStatus", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC214F8", + "label": "waitCardStatus", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC21528", + "label": "exceptionHandlerCardFastTrack", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC216AC", + "label": "mcVerifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC216F0", + "label": "sio0Verifier", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC2171C", + "label": "padAbort", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC21794", + "label": "setupSIO0", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC217E4", + "label": "code_ptr_BFC217E4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21808", + "label": "mcHandler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC2180C", + "label": "code_ptr_BFC2180C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21844", + "label": "code_ptr_BFC21844", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC2190C", + "label": "code_ptr_BFC2190C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21A04", + "label": "code_ptr_BFC21A04", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21A20", + "label": "readPad.isra.0", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC21BD4", + "label": "code_ptr_BFC21BD4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21BDC", + "label": "code_ptr_BFC21BDC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21BE4", + "label": "code_ptr_BFC21BE4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21BEC", + "label": "code_ptr_BFC21BEC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21BFC", + "label": "code_ptr_BFC21BFC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21C04", + "label": "code_ptr_BFC21C04", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21C0C", + "label": "code_ptr_BFC21C0C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21C14", + "label": "code_ptr_BFC21C14", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21C1C", + "label": "code_ptr_BFC21C1C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21C20", + "label": "code_ptr_BFC21C20", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21C34", + "label": "code_ptr_BFC21C34", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21C44", + "label": "code_ptr_BFC21C44", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21E20", + "label": "code_ptr_BFC21E20", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21E40", + "label": "sio0Handler", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC21FD4", + "label": "code_ptr_BFC21FD4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21FD8", + "label": "code_ptr_BFC21FD8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21FDC", + "label": "code_ptr_BFC21FDC", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21FE0", + "label": "code_ptr_BFC21FE0", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21FE4", + "label": "code_ptr_BFC21FE4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC21FF4", + "label": "code_ptr_BFC21FF4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC22004", + "label": "code_ptr_BFC22004", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC22014", + "label": "code_ptr_BFC22014", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC22020", + "label": "code_ptr_BFC22020", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC22034", + "label": "code_ptr_BFC22034", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC22074", + "label": "setSIO0AutoAck", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC22084", + "label": "patch_setPadOutputData", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC22098", + "label": "initPad", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC2218C", + "label": "startPad", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC22208", + "label": "stopPad", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC2224C", + "label": "initCard", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC22330", + "label": "startCard", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC223B0", + "label": "stopCard", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC223E8", + "label": "code_ptr_BFC223E8", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC223FC", + "label": "alterUserPadData", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC2240C", + "label": "code_ptr_BFC2240C", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC22414", + "label": "code_ptr_BFC22414", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC2249C", + "label": "initPadHighLevel", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC22578", + "label": "readPadHighLevel", + "rationale": "ELF STT_FUNC symbol from openbios.elf" + }, + { + "address": "0xBFC22674", + "label": "code_ptr_BFC22674", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC227D4", + "label": "code_ptr_BFC227D4", + "rationale": "code pointer in a data section of openbios.elf" + }, + { + "address": "0xBFC227E4", + "label": "code_ptr_BFC227E4", + "rationale": "code pointer in a data section of openbios.elf" + } + ] +} diff --git a/overlay_toolchain/recompiler/seeds/phase1c_seeds.json b/overlay_toolchain/recompiler/seeds/phase1c_seeds.json new file mode 100644 index 00000000..2c41d0b8 --- /dev/null +++ b/overlay_toolchain/recompiler/seeds/phase1c_seeds.json @@ -0,0 +1,22 @@ +{ + "schema": "psxrecomp-v4 phase1c seeds v1", + "seeds": [ + { + "address": "0xBFC00000", + "label": "reset_vector", + "rationale": "MIPS R3000A reset vector; first instruction executed after power-on" + }, + { + "address": "0xBFC00180", + "label": "general_exception_bev1", + "rationale": "BEV=1 general exception vector; active during early BIOS init before BEV is cleared" + } + ], + "excluded": [ + { + "address": "0xBFC00100", + "label": "utlb_miss_bev1", + "rationale": "R3000 UTLB-miss vector when BEV=1. PS1 R3000A has no TLB; address is never executed. Bytes at 0xBFC00108 are the ASCII string 'Sony Computer Entertainment Inc.' — walking from here produces garbage opcodes. Proven invalid by Phase 1b inventory walker." + } + ] +} diff --git a/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds.json b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds.json new file mode 100644 index 00000000..992dd313 --- /dev/null +++ b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds.json @@ -0,0 +1,5453 @@ +{ + "schema": "psxrecomp phase2 seeds", + "source": "generated/ghidra_function_starts.json + phase1c seeds + dispatch_miss_seeds + preserved manual", + "seed_count": 1072, + "seeds": [ + { + "address": "0xBFC00000", + "label": "reset_vector", + "rationale": "MIPS R3000A reset vector" + }, + { + "address": "0xBFC00180", + "label": "general_exception_bev1", + "rationale": "BEV=1 general exception vector" + }, + { + "address": "0xBFC00420", + "label": "ghidra_BFC00420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00678", + "label": "ghidra_BFC00678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006A8", + "label": "ghidra_BFC006A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006D8", + "label": "ghidra_BFC006D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00778", + "label": "ghidra_BFC00778", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00810", + "label": "ghidra_BFC00810", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC008A0", + "label": "ghidra_BFC008A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00944", + "label": "ghidra_BFC00944", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00B7C", + "label": "ghidra_BFC00B7C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00DA0", + "label": "ghidra_BFC00DA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC018E0", + "label": "ghidra_BFC018E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01920", + "label": "ghidra_BFC01920", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01A60", + "label": "ghidra_BFC01A60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01A90", + "label": "ghidra_BFC01A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01ACC", + "label": "ghidra_BFC01ACC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01B80", + "label": "ghidra_BFC01B80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01C8C", + "label": "ghidra_BFC01C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01E5C", + "label": "ghidra_BFC01E5C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC020F0", + "label": "ghidra_BFC020F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02104", + "label": "ghidra_BFC02104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02240", + "label": "ghidra_BFC02240", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0227C", + "label": "ghidra_BFC0227C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC022C0", + "label": "ghidra_BFC022C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02324", + "label": "ghidra_BFC02324", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02590", + "label": "ghidra_BFC02590", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC025B0", + "label": "ghidra_BFC025B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02738", + "label": "ghidra_BFC02738", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02950", + "label": "ghidra_BFC02950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02AF0", + "label": "ghidra_BFC02AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B10", + "label": "ghidra_BFC02B10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B50", + "label": "ghidra_BFC02B50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02CC0", + "label": "ghidra_BFC02CC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02D20", + "label": "ghidra_BFC02D20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02DAC", + "label": "ghidra_BFC02DAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EA0", + "label": "ghidra_BFC02EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EDC", + "label": "ghidra_BFC02EDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02F20", + "label": "ghidra_BFC02F20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03098", + "label": "ghidra_BFC03098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03104", + "label": "ghidra_BFC03104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03190", + "label": "ghidra_BFC03190", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03288", + "label": "ghidra_BFC03288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03310", + "label": "ghidra_BFC03310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC033C8", + "label": "ghidra_BFC033C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03418", + "label": "ghidra_BFC03418", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03494", + "label": "ghidra_BFC03494", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03764", + "label": "ghidra_BFC03764", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03910", + "label": "ghidra_BFC03910", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03968", + "label": "ghidra_BFC03968", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03978", + "label": "ghidra_BFC03978", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03990", + "label": "ghidra_BFC03990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC039B0", + "label": "ghidra_BFC039B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03A18", + "label": "ghidra_BFC03A18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03AA4", + "label": "ghidra_BFC03AA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03C90", + "label": "ghidra_BFC03C90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03CF0", + "label": "ghidra_BFC03CF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03D80", + "label": "ghidra_BFC03D80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03EA0", + "label": "ghidra_BFC03EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03F8C", + "label": "ghidra_BFC03F8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FAC", + "label": "ghidra_BFC03FAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FE0", + "label": "ghidra_BFC03FE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0403C", + "label": "ghidra_BFC0403C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC040EC", + "label": "ghidra_BFC040EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04138", + "label": "ghidra_BFC04138", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04260", + "label": "ghidra_BFC04260", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042A0", + "label": "ghidra_BFC042A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042D0", + "label": "ghidra_BFC042D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04610", + "label": "ghidra_BFC04610", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04678", + "label": "ghidra_BFC04678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0472C", + "label": "ghidra_BFC0472C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC048D0", + "label": "ghidra_BFC048D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04ABC", + "label": "ghidra_BFC04ABC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04BC4", + "label": "ghidra_BFC04BC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04C38", + "label": "ghidra_BFC04C38", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04D50", + "label": "ghidra_BFC04D50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04DEC", + "label": "ghidra_BFC04DEC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04FBC", + "label": "ghidra_BFC04FBC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0506C", + "label": "ghidra_BFC0506C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050A4", + "label": "ghidra_BFC050A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050FC", + "label": "ghidra_BFC050FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05120", + "label": "ghidra_BFC05120", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05194", + "label": "ghidra_BFC05194", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05558", + "label": "ghidra_BFC05558", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC057B0", + "label": "ghidra_BFC057B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0593C", + "label": "ghidra_BFC0593C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05A44", + "label": "ghidra_BFC05A44", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C18", + "label": "ghidra_BFC05C18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C50", + "label": "ghidra_BFC05C50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05D04", + "label": "ghidra_BFC05D04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DB0", + "label": "ghidra_BFC05DB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DF4", + "label": "ghidra_BFC05DF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05E58", + "label": "ghidra_BFC05E58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05F08", + "label": "ghidra_BFC05F08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06010", + "label": "ghidra_BFC06010", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06038", + "label": "ghidra_BFC06038", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC060DC", + "label": "ghidra_BFC060DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0615C", + "label": "ghidra_BFC0615C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061A0", + "label": "ghidra_BFC061A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061D4", + "label": "ghidra_BFC061D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06218", + "label": "ghidra_BFC06218", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06288", + "label": "ghidra_BFC06288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC062CC", + "label": "ghidra_BFC062CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC063CC", + "label": "ghidra_BFC063CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC064D8", + "label": "ghidra_BFC064D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06548", + "label": "ghidra_BFC06548", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC065C0", + "label": "ghidra_BFC065C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0661C", + "label": "ghidra_BFC0661C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06680", + "label": "ghidra_BFC06680", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06700", + "label": "ghidra_BFC06700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06784", + "label": "ghidra_BFC06784", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC067E8", + "label": "ghidra_BFC067E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06CA4", + "label": "ghidra_BFC06CA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06EC4", + "label": "ghidra_BFC06EC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06F28", + "label": "ghidra_BFC06F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FA4", + "label": "ghidra_BFC06FA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FF0", + "label": "ghidra_BFC06FF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0703C", + "label": "ghidra_BFC0703C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC070AC", + "label": "ghidra_BFC070AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0711C", + "label": "ghidra_BFC0711C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07148", + "label": "ghidra_BFC07148", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC071A0", + "label": "ghidra_BFC071A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC072B8", + "label": "ghidra_BFC072B8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07330", + "label": "ghidra_BFC07330", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07370", + "label": "ghidra_BFC07370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC073A0", + "label": "ghidra_BFC073A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07410", + "label": "ghidra_BFC07410", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07664", + "label": "ghidra_BFC07664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07700", + "label": "ghidra_BFC07700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC078A4", + "label": "ghidra_BFC078A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07A04", + "label": "ghidra_BFC07A04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07B88", + "label": "ghidra_BFC07B88", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07C1C", + "label": "ghidra_BFC07C1C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07F28", + "label": "ghidra_BFC07F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08020", + "label": "ghidra_BFC08020", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08098", + "label": "ghidra_BFC08098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC081FC", + "label": "ghidra_BFC081FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08354", + "label": "ghidra_BFC08354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC083CC", + "label": "ghidra_BFC083CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085B0", + "label": "ghidra_BFC085B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085D4", + "label": "ghidra_BFC085D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086B0", + "label": "ghidra_BFC086B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086EC", + "label": "ghidra_BFC086EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08720", + "label": "ghidra_BFC08720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC087C4", + "label": "ghidra_BFC087C4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0884C", + "label": "ghidra_BFC0884C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC088A0", + "label": "ghidra_BFC088A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0895C", + "label": "ghidra_BFC0895C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC089C0", + "label": "ghidra_BFC089C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08B3C", + "label": "ghidra_BFC08B3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08FFC", + "label": "ghidra_BFC08FFC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09144", + "label": "ghidra_BFC09144", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC091CC", + "label": "ghidra_BFC091CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC092EC", + "label": "ghidra_BFC092EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09540", + "label": "ghidra_BFC09540", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09598", + "label": "ghidra_BFC09598", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09720", + "label": "ghidra_BFC09720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC098A8", + "label": "ghidra_BFC098A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09914", + "label": "ghidra_BFC09914", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0994C", + "label": "ghidra_BFC0994C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0996C", + "label": "ghidra_BFC0996C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09CDC", + "label": "ghidra_BFC09CDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09D3C", + "label": "ghidra_BFC09D3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A080", + "label": "ghidra_BFC0A080", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A3D4", + "label": "ghidra_BFC0A3D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A43C", + "label": "ghidra_BFC0A43C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A4B4", + "label": "ghidra_BFC0A4B4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A5E4", + "label": "ghidra_BFC0A5E4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A754", + "label": "ghidra_BFC0A754", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A8BC", + "label": "ghidra_BFC0A8BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AB60", + "label": "ghidra_BFC0AB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AD08", + "label": "ghidra_BFC0AD08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B0D0", + "label": "ghidra_BFC0B0D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B170", + "label": "ghidra_BFC0B170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B394", + "label": "ghidra_BFC0B394", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B54C", + "label": "ghidra_BFC0B54C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5A0", + "label": "ghidra_BFC0B5A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5F4", + "label": "ghidra_BFC0B5F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B648", + "label": "ghidra_BFC0B648", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0BFF0", + "label": "ghidra_BFC0BFF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C048", + "label": "ghidra_BFC0C048", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C0DC", + "label": "ghidra_BFC0C0DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C140", + "label": "ghidra_BFC0C140", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C1FC", + "label": "ghidra_BFC0C1FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C220", + "label": "ghidra_BFC0C220", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C248", + "label": "ghidra_BFC0C248", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C270", + "label": "ghidra_BFC0C270", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C298", + "label": "ghidra_BFC0C298", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2C0", + "label": "ghidra_BFC0C2C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2E8", + "label": "ghidra_BFC0C2E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C318", + "label": "ghidra_BFC0C318", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C354", + "label": "ghidra_BFC0C354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C580", + "label": "ghidra_BFC0C580", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C720", + "label": "ghidra_BFC0C720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C830", + "label": "ghidra_BFC0C830", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C890", + "label": "ghidra_BFC0C890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C9CC", + "label": "ghidra_BFC0C9CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CAB4", + "label": "ghidra_BFC0CAB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CC68", + "label": "ghidra_BFC0CC68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CD80", + "label": "ghidra_BFC0CD80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CF84", + "label": "ghidra_BFC0CF84", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D0CC", + "label": "ghidra_BFC0D0CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D11C", + "label": "ghidra_BFC0D11C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D34C", + "label": "ghidra_BFC0D34C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D4CC", + "label": "ghidra_BFC0D4CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D570", + "label": "ghidra_BFC0D570", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D600", + "label": "ghidra_BFC0D600", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D640", + "label": "ghidra_BFC0D640", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D664", + "label": "ghidra_BFC0D664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D688", + "label": "ghidra_BFC0D688", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D72C", + "label": "ghidra_BFC0D72C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D7BC", + "label": "ghidra_BFC0D7BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D850", + "label": "ghidra_BFC0D850", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D880", + "label": "ghidra_BFC0D880", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D890", + "label": "ghidra_BFC0D890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8A0", + "label": "ghidra_BFC0D8A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8B0", + "label": "ghidra_BFC0D8B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8C0", + "label": "ghidra_BFC0D8C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8D0", + "label": "ghidra_BFC0D8D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D950", + "label": "ghidra_BFC0D950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D960", + "label": "ghidra_BFC0D960", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D970", + "label": "ghidra_BFC0D970", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D980", + "label": "ghidra_BFC0D980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D990", + "label": "ghidra_BFC0D990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9A0", + "label": "ghidra_BFC0D9A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9B0", + "label": "ghidra_BFC0D9B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9C0", + "label": "ghidra_BFC0D9C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9D0", + "label": "ghidra_BFC0D9D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9E0", + "label": "ghidra_BFC0D9E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9F0", + "label": "ghidra_BFC0D9F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA00", + "label": "ghidra_BFC0DA00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA10", + "label": "ghidra_BFC0DA10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA20", + "label": "ghidra_BFC0DA20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA30", + "label": "ghidra_BFC0DA30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA40", + "label": "ghidra_BFC0DA40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA50", + "label": "ghidra_BFC0DA50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA60", + "label": "ghidra_BFC0DA60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAA0", + "label": "ghidra_BFC0DAA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAB0", + "label": "ghidra_BFC0DAB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAC0", + "label": "ghidra_BFC0DAC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAD0", + "label": "ghidra_BFC0DAD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAE0", + "label": "ghidra_BFC0DAE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAF0", + "label": "ghidra_BFC0DAF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB00", + "label": "ghidra_BFC0DB00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB10", + "label": "ghidra_BFC0DB10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB20", + "label": "ghidra_BFC0DB20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB30", + "label": "ghidra_BFC0DB30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB40", + "label": "ghidra_BFC0DB40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB50", + "label": "ghidra_BFC0DB50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB60", + "label": "ghidra_BFC0DB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB70", + "label": "ghidra_BFC0DB70", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB80", + "label": "ghidra_BFC0DB80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB90", + "label": "ghidra_BFC0DB90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBA0", + "label": "ghidra_BFC0DBA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBB0", + "label": "ghidra_BFC0DBB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBC0", + "label": "ghidra_BFC0DBC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBD0", + "label": "ghidra_BFC0DBD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBE0", + "label": "ghidra_BFC0DBE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBF0", + "label": "ghidra_BFC0DBF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC00", + "label": "ghidra_BFC0DC00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC10", + "label": "ghidra_BFC0DC10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC20", + "label": "ghidra_BFC0DC20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC30", + "label": "ghidra_BFC0DC30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC40", + "label": "ghidra_BFC0DC40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC50", + "label": "ghidra_BFC0DC50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC10C74", + "label": "ghidra_BFC10C74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11008", + "label": "ghidra_BFC11008", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11294", + "label": "ghidra_BFC11294", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC112F4", + "label": "ghidra_BFC112F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11358", + "label": "ghidra_BFC11358", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC113BC", + "label": "ghidra_BFC113BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11420", + "label": "ghidra_BFC11420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11458", + "label": "ghidra_BFC11458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11490", + "label": "ghidra_BFC11490", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC114C8", + "label": "ghidra_BFC114C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11500", + "label": "ghidra_BFC11500", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11620", + "label": "ghidra_BFC11620", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1188C", + "label": "ghidra_BFC1188C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11B18", + "label": "ghidra_BFC11B18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11C8C", + "label": "ghidra_BFC11C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11F58", + "label": "ghidra_BFC11F58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC122C0", + "label": "ghidra_BFC122C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12370", + "label": "ghidra_BFC12370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12408", + "label": "ghidra_BFC12408", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12458", + "label": "ghidra_BFC12458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12564", + "label": "ghidra_BFC12564", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12628", + "label": "ghidra_BFC12628", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12794", + "label": "ghidra_BFC12794", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12900", + "label": "ghidra_BFC12900", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12998", + "label": "ghidra_BFC12998", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC129FC", + "label": "ghidra_BFC129FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12AC8", + "label": "ghidra_BFC12AC8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B00", + "label": "ghidra_BFC12B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B60", + "label": "ghidra_BFC12B60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12C08", + "label": "ghidra_BFC12C08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12CE8", + "label": "ghidra_BFC12CE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12F6C", + "label": "ghidra_BFC12F6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12FB4", + "label": "ghidra_BFC12FB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13070", + "label": "ghidra_BFC13070", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC130AC", + "label": "ghidra_BFC130AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13178", + "label": "ghidra_BFC13178", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13244", + "label": "ghidra_BFC13244", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13310", + "label": "ghidra_BFC13310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC133D8", + "label": "ghidra_BFC133D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC134A4", + "label": "ghidra_BFC134A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC135AC", + "label": "ghidra_BFC135AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC137E0", + "label": "ghidra_BFC137E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13980", + "label": "ghidra_BFC13980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13AF0", + "label": "ghidra_BFC13AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B24", + "label": "ghidra_BFC13B24", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B6C", + "label": "ghidra_BFC13B6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C34", + "label": "ghidra_BFC13C34", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C64", + "label": "ghidra_BFC13C64", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E04", + "label": "ghidra_BFC13E04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E60", + "label": "ghidra_BFC13E60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13EE8", + "label": "ghidra_BFC13EE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13F98", + "label": "ghidra_BFC13F98", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC144BC", + "label": "ghidra_BFC144BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC145C8", + "label": "ghidra_BFC145C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14690", + "label": "ghidra_BFC14690", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14710", + "label": "ghidra_BFC14710", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14770", + "label": "ghidra_BFC14770", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC147F4", + "label": "ghidra_BFC147F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14A90", + "label": "ghidra_BFC14A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14B00", + "label": "ghidra_BFC14B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14CF4", + "label": "ghidra_BFC14CF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC158A8", + "label": "ghidra_BFC158A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC15B9C", + "label": "ghidra_BFC15B9C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC16170", + "label": "ghidra_BFC16170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC18254", + "label": "ghidra_BFC18254", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC18684", + "label": "ghidra_BFC18684", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC18798", + "label": "ghidra_BFC18798", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC188F0", + "label": "ghidra_BFC188F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC18990", + "label": "ghidra_BFC18990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC18D10", + "label": "ghidra_BFC18D10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC192E4", + "label": "ghidra_BFC192E4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC193C0", + "label": "ghidra_BFC193C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1952C", + "label": "ghidra_BFC1952C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC19630", + "label": "ghidra_BFC19630", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC196D4", + "label": "ghidra_BFC196D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC19A58", + "label": "ghidra_BFC19A58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC19DF4", + "label": "ghidra_BFC19DF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1A15C", + "label": "ghidra_BFC1A15C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1A17C", + "label": "ghidra_BFC1A17C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1A19C", + "label": "ghidra_BFC1A19C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1A430", + "label": "ghidra_BFC1A430", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1A5B0", + "label": "ghidra_BFC1A5B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1A6EC", + "label": "ghidra_BFC1A6EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1AA90", + "label": "ghidra_BFC1AA90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1AC68", + "label": "ghidra_BFC1AC68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1AE68", + "label": "ghidra_BFC1AE68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1B7E0", + "label": "ghidra_BFC1B7E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1BD68", + "label": "ghidra_BFC1BD68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1BEE0", + "label": "ghidra_BFC1BEE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1BF44", + "label": "ghidra_BFC1BF44", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1C130", + "label": "ghidra_BFC1C130", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1C4C0", + "label": "ghidra_BFC1C4C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1C78C", + "label": "ghidra_BFC1C78C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1C8EC", + "label": "ghidra_BFC1C8EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1C9B4", + "label": "ghidra_BFC1C9B4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1CAF0", + "label": "ghidra_BFC1CAF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1CBAC", + "label": "ghidra_BFC1CBAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1CDD8", + "label": "ghidra_BFC1CDD8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1DBF4", + "label": "ghidra_BFC1DBF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1DDD8", + "label": "ghidra_BFC1DDD8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1DF50", + "label": "ghidra_BFC1DF50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1E0C4", + "label": "ghidra_BFC1E0C4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1E10C", + "label": "ghidra_BFC1E10C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1E3CC", + "label": "ghidra_BFC1E3CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1F6AC", + "label": "ghidra_BFC1F6AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1F980", + "label": "ghidra_BFC1F980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1FFA8", + "label": "ghidra_BFC1FFA8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20338", + "label": "ghidra_BFC20338", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2069C", + "label": "ghidra_BFC2069C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20BE4", + "label": "ghidra_BFC20BE4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20C64", + "label": "ghidra_BFC20C64", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20CE4", + "label": "ghidra_BFC20CE4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20D4C", + "label": "ghidra_BFC20D4C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20DB4", + "label": "ghidra_BFC20DB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20E10", + "label": "ghidra_BFC20E10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20E6C", + "label": "ghidra_BFC20E6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20EC8", + "label": "ghidra_BFC20EC8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20F24", + "label": "ghidra_BFC20F24", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20F8C", + "label": "ghidra_BFC20F8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC20FE8", + "label": "ghidra_BFC20FE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC21044", + "label": "ghidra_BFC21044", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC210C0", + "label": "ghidra_BFC210C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC21128", + "label": "ghidra_BFC21128", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC21184", + "label": "ghidra_BFC21184", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC21200", + "label": "ghidra_BFC21200", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2125C", + "label": "ghidra_BFC2125C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC212C4", + "label": "ghidra_BFC212C4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC21320", + "label": "ghidra_BFC21320", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC213A4", + "label": "ghidra_BFC213A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC213FC", + "label": "ghidra_BFC213FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC214B0", + "label": "ghidra_BFC214B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC218CC", + "label": "ghidra_BFC218CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2193C", + "label": "ghidra_BFC2193C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC21A9C", + "label": "ghidra_BFC21A9C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC22164", + "label": "ghidra_BFC22164", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC226D0", + "label": "ghidra_BFC226D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC228D8", + "label": "ghidra_BFC228D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC22B80", + "label": "ghidra_BFC22B80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC22E1C", + "label": "ghidra_BFC22E1C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC22E90", + "label": "ghidra_BFC22E90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC23078", + "label": "ghidra_BFC23078", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC230C4", + "label": "ghidra_BFC230C4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2311C", + "label": "ghidra_BFC2311C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC232DC", + "label": "ghidra_BFC232DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC23500", + "label": "ghidra_BFC23500", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC23524", + "label": "ghidra_BFC23524", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC23D3C", + "label": "ghidra_BFC23D3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC24288", + "label": "ghidra_BFC24288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC24418", + "label": "ghidra_BFC24418", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC24640", + "label": "ghidra_BFC24640", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC24A48", + "label": "ghidra_BFC24A48", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC24F00", + "label": "ghidra_BFC24F00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC251A8", + "label": "ghidra_BFC251A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC25200", + "label": "ghidra_BFC25200", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC252BC", + "label": "ghidra_BFC252BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2531C", + "label": "ghidra_BFC2531C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC25390", + "label": "ghidra_BFC25390", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC254B0", + "label": "ghidra_BFC254B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC25558", + "label": "ghidra_BFC25558", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC25754", + "label": "ghidra_BFC25754", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC25B74", + "label": "ghidra_BFC25B74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC25CC0", + "label": "ghidra_BFC25CC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC25D8C", + "label": "ghidra_BFC25D8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC25E8C", + "label": "ghidra_BFC25E8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC25EF8", + "label": "ghidra_BFC25EF8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2632C", + "label": "ghidra_BFC2632C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2644C", + "label": "ghidra_BFC2644C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC264A0", + "label": "ghidra_BFC264A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC26550", + "label": "ghidra_BFC26550", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC265C0", + "label": "ghidra_BFC265C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC26610", + "label": "ghidra_BFC26610", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC26670", + "label": "ghidra_BFC26670", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC266B0", + "label": "ghidra_BFC266B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC268EC", + "label": "ghidra_BFC268EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC26C10", + "label": "ghidra_BFC26C10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC26E64", + "label": "ghidra_BFC26E64", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27190", + "label": "ghidra_BFC27190", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC273E4", + "label": "ghidra_BFC273E4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27868", + "label": "ghidra_BFC27868", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27910", + "label": "ghidra_BFC27910", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27A2C", + "label": "ghidra_BFC27A2C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27B24", + "label": "ghidra_BFC27B24", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27BDC", + "label": "ghidra_BFC27BDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27CC8", + "label": "ghidra_BFC27CC8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27DB0", + "label": "ghidra_BFC27DB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27E68", + "label": "ghidra_BFC27E68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27E88", + "label": "ghidra_BFC27E88", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC27EB4", + "label": "ghidra_BFC27EB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC28064", + "label": "ghidra_BFC28064", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC28490", + "label": "ghidra_BFC28490", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC284F0", + "label": "ghidra_BFC284F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2886C", + "label": "ghidra_BFC2886C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC28B84", + "label": "ghidra_BFC28B84", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC29770", + "label": "ghidra_BFC29770", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC29AE0", + "label": "ghidra_BFC29AE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC29FE8", + "label": "ghidra_BFC29FE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2A31C", + "label": "ghidra_BFC2A31C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2ACD0", + "label": "ghidra_BFC2ACD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2BF1C", + "label": "ghidra_BFC2BF1C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2BF74", + "label": "ghidra_BFC2BF74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2C2F0", + "label": "ghidra_BFC2C2F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2C3E0", + "label": "ghidra_BFC2C3E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2CA9C", + "label": "ghidra_BFC2CA9C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2CAE0", + "label": "ghidra_BFC2CAE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2CB24", + "label": "ghidra_BFC2CB24", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2CB80", + "label": "ghidra_BFC2CB80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2CC10", + "label": "ghidra_BFC2CC10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2CCC4", + "label": "ghidra_BFC2CCC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2CE08", + "label": "ghidra_BFC2CE08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2CF54", + "label": "ghidra_BFC2CF54", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2D0E0", + "label": "ghidra_BFC2D0E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2E44C", + "label": "ghidra_BFC2E44C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2E600", + "label": "ghidra_BFC2E600", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2E65C", + "label": "ghidra_BFC2E65C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2ED1C", + "label": "ghidra_BFC2ED1C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2EE6C", + "label": "ghidra_BFC2EE6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2EF40", + "label": "ghidra_BFC2EF40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2F210", + "label": "ghidra_BFC2F210", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2F618", + "label": "ghidra_BFC2F618", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2F65C", + "label": "ghidra_BFC2F65C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2F718", + "label": "ghidra_BFC2F718", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2F808", + "label": "ghidra_BFC2F808", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2F85C", + "label": "ghidra_BFC2F85C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2F8AC", + "label": "ghidra_BFC2F8AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2FCC4", + "label": "ghidra_BFC2FCC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC2FE6C", + "label": "ghidra_BFC2FE6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3010C", + "label": "ghidra_BFC3010C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3015C", + "label": "ghidra_BFC3015C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC301AC", + "label": "ghidra_BFC301AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3022C", + "label": "ghidra_BFC3022C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3029C", + "label": "ghidra_BFC3029C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC302BC", + "label": "ghidra_BFC302BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3031C", + "label": "ghidra_BFC3031C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC30350", + "label": "ghidra_BFC30350", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3079C", + "label": "ghidra_BFC3079C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC30868", + "label": "ghidra_BFC30868", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC30960", + "label": "ghidra_BFC30960", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC30A80", + "label": "ghidra_BFC30A80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC30DF0", + "label": "ghidra_BFC30DF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31194", + "label": "ghidra_BFC31194", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31380", + "label": "ghidra_BFC31380", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC313EC", + "label": "ghidra_BFC313EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31448", + "label": "ghidra_BFC31448", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31580", + "label": "ghidra_BFC31580", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31638", + "label": "ghidra_BFC31638", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC317D0", + "label": "ghidra_BFC317D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31968", + "label": "ghidra_BFC31968", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31C64", + "label": "ghidra_BFC31C64", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31D14", + "label": "ghidra_BFC31D14", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31DC4", + "label": "ghidra_BFC31DC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC31E74", + "label": "ghidra_BFC31E74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC322E4", + "label": "ghidra_BFC322E4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC32410", + "label": "ghidra_BFC32410", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC32450", + "label": "ghidra_BFC32450", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3255C", + "label": "ghidra_BFC3255C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC32724", + "label": "ghidra_BFC32724", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC32820", + "label": "ghidra_BFC32820", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC328F4", + "label": "ghidra_BFC328F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC329F0", + "label": "ghidra_BFC329F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC32CCC", + "label": "ghidra_BFC32CCC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC33138", + "label": "ghidra_BFC33138", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC331A0", + "label": "ghidra_BFC331A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC33358", + "label": "ghidra_BFC33358", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC33400", + "label": "ghidra_BFC33400", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC34160", + "label": "ghidra_BFC34160", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC34304", + "label": "ghidra_BFC34304", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC344A4", + "label": "ghidra_BFC344A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC345F4", + "label": "ghidra_BFC345F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC34748", + "label": "ghidra_BFC34748", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC34898", + "label": "ghidra_BFC34898", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC34B58", + "label": "ghidra_BFC34B58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC36CF0", + "label": "ghidra_BFC36CF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC36D1C", + "label": "ghidra_BFC36D1C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC36EC0", + "label": "ghidra_BFC36EC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC36F90", + "label": "ghidra_BFC36F90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37028", + "label": "ghidra_BFC37028", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37070", + "label": "ghidra_BFC37070", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC370A0", + "label": "ghidra_BFC370A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC370F4", + "label": "ghidra_BFC370F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37130", + "label": "ghidra_BFC37130", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3716C", + "label": "ghidra_BFC3716C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37334", + "label": "ghidra_BFC37334", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37368", + "label": "ghidra_BFC37368", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC373E0", + "label": "ghidra_BFC373E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37434", + "label": "ghidra_BFC37434", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC374BC", + "label": "ghidra_BFC374BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC374EC", + "label": "ghidra_BFC374EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37838", + "label": "ghidra_BFC37838", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37868", + "label": "ghidra_BFC37868", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC378B4", + "label": "ghidra_BFC378B4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37908", + "label": "ghidra_BFC37908", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37998", + "label": "ghidra_BFC37998", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37A4C", + "label": "ghidra_BFC37A4C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC37AC4", + "label": "ghidra_BFC37AC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC38204", + "label": "ghidra_BFC38204", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC382E0", + "label": "ghidra_BFC382E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC38524", + "label": "ghidra_BFC38524", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC387D4", + "label": "ghidra_BFC387D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC38A7C", + "label": "ghidra_BFC38A7C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC38BE8", + "label": "ghidra_BFC38BE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC38C68", + "label": "ghidra_BFC38C68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC38DAC", + "label": "ghidra_BFC38DAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC39080", + "label": "ghidra_BFC39080", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC39410", + "label": "ghidra_BFC39410", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC394EC", + "label": "ghidra_BFC394EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3954C", + "label": "ghidra_BFC3954C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC39630", + "label": "ghidra_BFC39630", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC396E8", + "label": "ghidra_BFC396E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC39D38", + "label": "ghidra_BFC39D38", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC39E84", + "label": "ghidra_BFC39E84", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC39FE4", + "label": "ghidra_BFC39FE4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3A094", + "label": "ghidra_BFC3A094", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3A228", + "label": "ghidra_BFC3A228", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3A2C0", + "label": "ghidra_BFC3A2C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3AAC4", + "label": "ghidra_BFC3AAC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3AD68", + "label": "ghidra_BFC3AD68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3B054", + "label": "ghidra_BFC3B054", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3B30C", + "label": "ghidra_BFC3B30C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3B368", + "label": "ghidra_BFC3B368", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3B85C", + "label": "ghidra_BFC3B85C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3B93C", + "label": "ghidra_BFC3B93C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3BA74", + "label": "ghidra_BFC3BA74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3BD78", + "label": "ghidra_BFC3BD78", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3BD98", + "label": "ghidra_BFC3BD98", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3BE6C", + "label": "ghidra_BFC3BE6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3BF10", + "label": "ghidra_BFC3BF10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3C060", + "label": "ghidra_BFC3C060", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3C140", + "label": "ghidra_BFC3C140", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3C428", + "label": "ghidra_BFC3C428", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3C4E0", + "label": "ghidra_BFC3C4E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3C710", + "label": "ghidra_BFC3C710", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3D810", + "label": "ghidra_BFC3D810", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3D8C0", + "label": "ghidra_BFC3D8C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3DF20", + "label": "ghidra_BFC3DF20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3E020", + "label": "ghidra_BFC3E020", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3E110", + "label": "ghidra_BFC3E110", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3E980", + "label": "ghidra_BFC3E980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3ED40", + "label": "ghidra_BFC3ED40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3EDB4", + "label": "ghidra_BFC3EDB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3EFF0", + "label": "ghidra_BFC3EFF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F1B8", + "label": "ghidra_BFC3F1B8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F2B4", + "label": "ghidra_BFC3F2B4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F484", + "label": "ghidra_BFC3F484", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F4F0", + "label": "ghidra_BFC3F4F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F570", + "label": "ghidra_BFC3F570", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F5D8", + "label": "ghidra_BFC3F5D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F6F0", + "label": "ghidra_BFC3F6F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F7E8", + "label": "ghidra_BFC3F7E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F8E4", + "label": "ghidra_BFC3F8E4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3F9AC", + "label": "ghidra_BFC3F9AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3FA10", + "label": "ghidra_BFC3FA10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3FAEC", + "label": "ghidra_BFC3FAEC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3FB74", + "label": "ghidra_BFC3FB74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3FC50", + "label": "ghidra_BFC3FC50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3FD0C", + "label": "ghidra_BFC3FD0C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3FDC8", + "label": "ghidra_BFC3FDC8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3FE60", + "label": "ghidra_BFC3FE60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC3FF40", + "label": "ghidra_BFC3FF40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC40034", + "label": "ghidra_BFC40034", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC400DC", + "label": "ghidra_BFC400DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC40184", + "label": "ghidra_BFC40184", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC40260", + "label": "ghidra_BFC40260", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC402DC", + "label": "ghidra_BFC402DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC40484", + "label": "ghidra_BFC40484", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC40628", + "label": "ghidra_BFC40628", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC406E0", + "label": "ghidra_BFC406E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC40700", + "label": "ghidra_BFC40700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC407B8", + "label": "ghidra_BFC407B8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC40B68", + "label": "ghidra_BFC40B68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC40DE8", + "label": "ghidra_BFC40DE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC40F34", + "label": "ghidra_BFC40F34", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC4102C", + "label": "ghidra_BFC4102C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41200", + "label": "ghidra_BFC41200", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41258", + "label": "ghidra_BFC41258", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC413B0", + "label": "ghidra_BFC413B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC413F4", + "label": "ghidra_BFC413F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41458", + "label": "ghidra_BFC41458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41520", + "label": "ghidra_BFC41520", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41648", + "label": "ghidra_BFC41648", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41670", + "label": "ghidra_BFC41670", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41708", + "label": "ghidra_BFC41708", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC417CC", + "label": "ghidra_BFC417CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41848", + "label": "ghidra_BFC41848", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC418C4", + "label": "ghidra_BFC418C4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC4192C", + "label": "ghidra_BFC4192C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41A44", + "label": "ghidra_BFC41A44", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41C80", + "label": "ghidra_BFC41C80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC41DA4", + "label": "ghidra_BFC41DA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC42014", + "label": "ghidra_BFC42014", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC4203C", + "label": "ghidra_BFC4203C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC42060", + "label": "ghidra_BFC42060", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC42090", + "label": "ghidra_BFC42090", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC420C0", + "label": "ghidra_BFC420C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC420F0", + "label": "ghidra_BFC420F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC42120", + "label": "ghidra_BFC42120", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC42160", + "label": "ghidra_BFC42160", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC42424", + "label": "ghidra_BFC42424", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC424A8", + "label": "ghidra_BFC424A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC42540", + "label": "ghidra_BFC42540", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC425FC", + "label": "ghidra_BFC425FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC42640", + "label": "ghidra_BFC42640", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC426DC", + "label": "ghidra_BFC426DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC4270C", + "label": "ghidra_BFC4270C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC42380", + "label": "dmiss_BFC42380", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC42844", + "label": "dmiss_BFC42844", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC38AD4", + "label": "dmiss_BFC38AD4", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC42A90", + "label": "dmiss_BFC42A90", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC42A10", + "label": "dmiss_BFC42A10", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC27FB0", + "label": "dmiss_BFC27FB0", + "rationale": "dispatch miss: Kernel Part 2 function, indirect call" + }, + { + "address": "0xBFC36D48", + "label": "dmiss_BFC36D48", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC38AA4", + "label": "dmiss_BFC38AA4", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC1E3AC", + "label": "dmiss_BFC1E3AC", + "rationale": "dispatch miss: Shell function, called in vblank loop" + }, + { + "address": "0xBFC3045C", + "label": "dmiss_BFC3045C", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30470", + "label": "dmiss_BFC30470", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30484", + "label": "dmiss_BFC30484", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30498", + "label": "dmiss_BFC30498", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30554", + "label": "dmiss_BFC30554", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30560", + "label": "dmiss_BFC30560", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC3056C", + "label": "dmiss_BFC3056C", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC30578", + "label": "dmiss_BFC30578", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC36DD0", + "label": "dmiss_BFC36DD0", + "rationale": "dispatch miss: Shell function, indirect call via table" + }, + { + "address": "0xBFC11840", + "label": "dmiss_BFC11840", + "rationale": "dispatch miss: KP2 function, indirect call" + }, + { + "address": "0xBFC36DF8", + "label": "dmiss_BFC36DF8", + "rationale": "dispatch miss: Shell function, indirect call" + }, + { + "address": "0xBFC11524", + "label": "dmiss_BFC11524", + "rationale": "dispatch miss: KP2 secondary entry point for exception handler, mid-function split of func_00001A00, called during VBlank" + }, + { + "address": "0xBFC11610", + "label": "dmiss_BFC11610", + "rationale": "dispatch miss: KP2 function, tail-call target from 0xBFC11524 exception handler path" + }, + { + "address": "0xBFC14A54", + "label": "dmiss_BFC14A54", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain BUSY-writer at RAM 0x4F54; alias rule RAM=ROM-0xBFC10000+0x500. Reached via JAL inside FUN_bfc147f4; never emitted as standalone entry." + }, + { + "address": "0xBFC158D0", + "label": "dmiss_BFC158D0", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-0 BUSY writer at RAM 0x5DD0; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC158D8", + "label": "dmiss_BFC158D8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-1 BUSY writer at RAM 0x5DD8; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC159F4", + "label": "dmiss_BFC159F4", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x02 OPEN to [0x7568+slot] at RAM 0x5EF4. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry \u00e2\u20ac\u201d without this the gate never clears." + }, + { + "address": "0xBFC15AA8", + "label": "dmiss_BFC15AA8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x04 OPEN to [0x7568+slot] at RAM 0x5FA8. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry \u00e2\u20ac\u201d paired with 0xBFC159F4." + }, + { + "address": "0xBFC04910", + "label": "dmiss_BFC04910", + "rationale": "Tomba boot dispatch miss after licensed PlayStation screen. Verified in Ghidra/runtime disassembly as a standalone BIOS init routine between 0xBFC048D0 and 0xBFC04ABC, with return at 0xBFC04A98 and table data reference from 0xBFC04554." + }, + { + "address": "0xBFC04850", + "label": "dmiss_BFC04850", + "rationale": "Tomba boot dispatch miss after seeding 0xBFC04910. Verified in Ghidra/runtime disassembly as a standalone BIOS callback-list init routine between 0xBFC0472C and 0xBFC048D0, with return at 0xBFC048C8 and table data reference from 0xBFC04588." + }, + { + "address": "0xBFC079F8", + "label": "dmiss_BFC079F8", + "rationale": "Tomba boot dispatch miss after game callback coverage fixes. Verified in Ghidra as a tiny BIOS table leaf routine (sw a0,0(sp); jr ra; clear v0) referenced by data at 0xBFC04484 and 0xBFC0E30C." + }, + { + "address": "0xBFC15F1C", + "label": "dmiss_BFC15F1C", + "rationale": "dirty_ram hot: SIO/PAD interrupt handler entry point (RAM 0x641C), called via jalr. 10852+ hits/frame across internal branch targets (0x641C, 0x6430, 0x6444, 0x6458, 0x650C, 0x6514, 0x658C, 0x6594). Seeding entry only; CFG discovers internal labels." + }, + { + "address": "0xBFC0193C", + "label": "cache_flush_continuation", + "rationale": "Jump target of cache-flush jr k0 at BFC01938" + }, + { + "address": "0xBFC01E24", + "label": "SysInitMemory", + "rationale": "Dispatch miss during boot \u00e2\u20ac\u201d kernel init function" + }, + { + "address": "0xBFC02200", + "label": "jal_BFC02200", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC02918", + "label": "card_copy_dispatch_miss_2026_05_05", + "rationale": "Runtime dispatch miss: 8 hits during YES/NO COPY confirm execution. BANDAID per user permission." + }, + { + "address": "0xBFC03FC0", + "label": "jal_BFC03FC0", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC06FDC", + "label": "indirect_BFC06FDC", + "rationale": "Reached via indirect dispatch during boot" + }, + { + "address": "0xBFC09890", + "label": "card_cmd_is_not_read", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x52; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x52 READ). Sibling of 0xBFC0989C." + }, + { + "address": "0xBFC0989C", + "label": "card_cmd_is_not_write_2026_05_09", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x51; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x51 WRITE). Sibling of 0xBFC09890. Discovery missed it because it sits between 0xBFC09898 (end of 0xBFC09890) and 0xBFC098A8 (next discovered fn). Called via JALR at 0xBFC09788 in func_1FC09598 \u00e2\u20ac\u201d without this seed, JALR dispatches to unknown, write predicate returns junk via uninitialized v0, BIOS COPY silently no-ops the SIO write protocol (60 misses per copy, no 0x57 ever sent). Earlier bisect (2026-05-05) said this crashed; that was before the predicate-init fix and dispatch-miss class fixes. Retry 2026-05-09." + }, + { + "address": "0xBFC0BA8C", + "label": "bios_BA8C", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0C1DC", + "label": "bios_C1DC", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0DA70", + "label": "jal_BFC0DA70", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA80", + "label": "jal_BFC0DA80", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA90", + "label": "jal_BFC0DA90", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC10000", + "label": "kernel_trampoline_0", + "rationale": "Trampoline to FileOpen (0x598)" + }, + { + "address": "0xBFC10010", + "label": "kernel_trampoline_1", + "rationale": "Trampoline to FileRead (0x5C4)" + }, + { + "address": "0xBFC10020", + "label": "kernel_trampoline_2", + "rationale": "Trampoline to FileClose (0x5E0)" + }, + { + "address": "0xBFC10030", + "label": "kernel_trampoline_3", + "rationale": "Trampoline to 0x600" + }, + { + "address": "0xBFC10040", + "label": "kernel_memcpy", + "rationale": "ROM-to-RAM and RAM clear routine" + }, + { + "address": "0xBFC10098", + "label": "kernel_bzero", + "rationale": "RAM clear routine (to 0xBFC100BC)" + }, + { + "address": "0xBFC100C4", + "label": "a0_vector_dispatch", + "rationale": "A0 function table dispatch" + }, + { + "address": "0xBFC100E0", + "label": "b0_vector_dispatch", + "rationale": "B0 function table dispatch" + }, + { + "address": "0xBFC10100", + "label": "c0_vector_dispatch", + "rationale": "C0 function table dispatch" + }, + { + "address": "0xBFC10120", + "label": "kernel_get_cause", + "rationale": "mfc0 v0,Cause; jr ra" + }, + { + "address": "0xBFC10130", + "label": "kernel_get_sr", + "rationale": "mfc0 v0,SR; jr ra" + }, + { + "address": "0xBFC10140", + "label": "kernel_set_sr", + "rationale": "mtc0 a0,SR; jr ra" + }, + { + "address": "0xBFC10150", + "label": "kernel_syscall", + "rationale": "syscall; jr ra" + }, + { + "address": "0xBFC1015C", + "label": "kernel_get_c0_table", + "rationale": "Returns C0 table pointer" + }, + { + "address": "0xBFC10168", + "label": "kernel_get_b0_table", + "rationale": "Returns B0 table pointer" + }, + { + "address": "0xBFC10174", + "label": "kernel_BFC10174", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10780", + "label": "rmiss_BFC10780", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC109A0", + "label": "kernel_BFC109A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC109B0", + "label": "kernel_BFC109B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A20", + "label": "kernel_BFC10A20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A2C", + "label": "kernel_BFC10A2C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A40", + "label": "kernel_BFC10A40", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10B30", + "label": "rmiss_BFC10B30", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10BB8", + "label": "kernel_BFC10BB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE0", + "label": "kernel_BFC10BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE4", + "label": "rmiss_BFC10BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10C3C", + "label": "kernel_BFC10C3C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F08", + "label": "kernel_BFC10F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F20", + "label": "kernel_BFC10F20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F44", + "label": "kernel_BFC10F44", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC110D8", + "label": "kernel_BFC110D8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC110F8", + "label": "kernel_BFC110F8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11114", + "label": "kernel_BFC11114", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111AC", + "label": "kernel_BFC111AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111C4", + "label": "kernel_BFC111C4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111E4", + "label": "kernel_BFC111E4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1121C", + "label": "kernel_BFC1121C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11228", + "label": "kernel_BFC11228", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1125C", + "label": "kernel_BFC1125C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11274", + "label": "kernel_BFC11274", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1152C", + "label": "rmiss_BFC1152C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11560", + "label": "rmiss_BFC11560", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115E8", + "label": "rmiss_BFC115E8", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115FC", + "label": "rmiss_BFC115FC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11644", + "label": "kernel_BFC11644", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1175C", + "label": "kernel_BFC1175C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11800", + "label": "kernel_BFC11800", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11870", + "label": "kernel_BFC11870", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1191C", + "label": "kernel_BFC1191C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11944", + "label": "kernel_BFC11944", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11980", + "label": "kernel_BFC11980", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11998", + "label": "kernel_BFC11998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC119C8", + "label": "kernel_BFC119C8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A04", + "label": "kernel_BFC11A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A10", + "label": "kernel_BFC11A10", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A4C", + "label": "kernel_BFC11A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A88", + "label": "kernel_BFC11A88", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11AFC", + "label": "kernel_BFC11AFC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11BA8", + "label": "kernel_BFC11BA8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11BD4", + "label": "kernel_BFC11BD4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C14", + "label": "kernel_BFC11C14", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C24", + "label": "kernel_BFC11C24", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C50", + "label": "kernel_BFC11C50", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C68", + "label": "kernel_BFC11C68", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12224", + "label": "kernel_BFC12224", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1228C", + "label": "kernel_BFC1228C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC122A0", + "label": "kernel_BFC122A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC129EC", + "label": "kernel_BFC129EC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BC8", + "label": "kernel_BFC12BC8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE0", + "label": "kernel_BFC12BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE4", + "label": "rmiss_BFC12BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC12EA4", + "label": "kernel_BFC12EA4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1302C", + "label": "kernel_BFC1302C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC130A4", + "label": "kernel_BFC130A4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13570", + "label": "kernel_BFC13570", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1372C", + "label": "kernel_BFC1372C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1376C", + "label": "rmiss_BFC1376C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137B4", + "label": "indirect_BFC137B4", + "rationale": "Reached via indirect dispatch during boot (kernel relocated)" + }, + { + "address": "0xBFC137BC", + "label": "rmiss_BFC137BC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137D0", + "label": "kernel_ram_function", + "rationale": "Dispatch miss at 0xBFC137D0 (phys 0x00003CD0) \u00e2\u20ac\u201d 3 misses. Kernel RAM function." + }, + { + "address": "0xBFC138AC", + "label": "kernel_BFC138AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1395C", + "label": "kernel_BFC1395C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13968", + "label": "kernel_BFC13968", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13A04", + "label": "kernel_BFC13A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13ED0", + "label": "kernel_BFC13ED0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13F5C", + "label": "kernel_BFC13F5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1454C", + "label": "kernel_BFC1454C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14588", + "label": "kernel_BFC14588", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14594", + "label": "kernel_BFC14594", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14670", + "label": "kernel_BFC14670", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14754", + "label": "kernel_BFC14754", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14764", + "label": "kernel_BFC14764", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1483C", + "label": "kernel_BFC1483C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1484C", + "label": "kernel_BFC1484C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14864", + "label": "kernel_BFC14864", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1486C", + "label": "kernel_BFC1486C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15188", + "label": "kernel_BFC15188", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC151E8", + "label": "kernel_56E8", + "rationale": "Kernel function at RAM 0x56E8. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15268", + "label": "kernel_5768", + "rationale": "Kernel function at RAM 0x5768. Cascade from input path seeds." + }, + { + "address": "0xBFC1529C", + "label": "kernel_579C", + "rationale": "Kernel function at RAM 0x579C. Cascade from input path." + }, + { + "address": "0xBFC15334", + "label": "kernel_5834", + "rationale": "Kernel function at RAM 0x5834. Cascade." + }, + { + "address": "0xBFC15370", + "label": "kernel_5870", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC153B4", + "label": "kernel_58B4", + "rationale": "Kernel (CARD driver) function at RAM 0x58B4. Cascade." + }, + { + "address": "0xBFC153E8", + "label": "kernel_58E8", + "rationale": "Kernel (CARD driver) function at RAM 0x58E8. Cascade." + }, + { + "address": "0xBFC15418", + "label": "kernel_5918", + "rationale": "Kernel (CARD driver) leaf function at RAM 0x5918. Cascade." + }, + { + "address": "0xBFC15454", + "label": "kernel_5954", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15490", + "label": "kernel_5990", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC154CC", + "label": "kernel_59CC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15500", + "label": "kernel_5A00", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15508", + "label": "kernel_5A08", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15544", + "label": "kernel_5A44", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15558", + "label": "kernel_5A58", + "rationale": "CARD read chain state 12 (data-byte-store): SIO_RX -> a1[0x7F], XOR-updates checksum at 0x7560+slot*4, returns v0=0. Targeted by jump table at RAM 0x6c98 entry 12." + }, + { + "address": "0xBFC15580", + "label": "kernel_5A80", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155B0", + "label": "kernel_5AB0", + "rationale": "CARD read chain state 13 (data-loop completion): reads byte vs checksum at 0x7560+slot*4, polls SIO_STAT for RX_RDY, reads END byte; v0=1 if 'G' else v0=-1. Targeted by jump table at RAM 0x6c98 entry 13." + }, + { + "address": "0xBFC155BC", + "label": "kernel_5ABC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155F8", + "label": "kernel_5AF8", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15634", + "label": "kernel_5B34", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15650", + "label": "kernel_5B50", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15654", + "label": "kernel_5B54", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15664", + "label": "kernel_BFC15664", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC156A4", + "label": "kernel_5BA4", + "rationale": "Kernel function at RAM 0x5BA4. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15724", + "label": "kernel_5C24", + "rationale": "Kernel function at RAM 0x5C24. Cascade from input path seeds." + }, + { + "address": "0xBFC15758", + "label": "kernel_5C58", + "rationale": "Kernel function at RAM 0x5C58. Cascade." + }, + { + "address": "0xBFC15848", + "label": "kernel_5D48", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC15894", + "label": "kernel_5D94", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15898", + "label": "kernel_5D98", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC15930", + "label": "kernel_BFC15930", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15950", + "label": "kernel_BFC15950", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15998", + "label": "kernel_BFC15998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15A04", + "label": "kernel_BFC15A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15A4C", + "label": "kernel_BFC15A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AB8", + "label": "kernel_BFC15AB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AF0", + "label": "kernel_BFC15AF0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B5C", + "label": "kernel_BFC15B5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B70", + "label": "kernel_BFC15B70", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15CC4", + "label": "kernel_BFC15CC4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15E90", + "label": "kernel_BFC15E90", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15EBC", + "label": "kernel_BFC15EBC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15F08", + "label": "kernel_BFC15F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1609C", + "label": "kernel_BFC1609C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16690", + "label": "kernel_BFC16690", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166A0", + "label": "kernel_BFC166A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166B0", + "label": "kernel_BFC166B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166C0", + "label": "kernel_BFC166C0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166D0", + "label": "kernel_BFC166D0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166E0", + "label": "kernel_BFC166E0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166F0", + "label": "kernel_BFC166F0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16700", + "label": "kernel_BFC16700", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16710", + "label": "kernel_BFC16710", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16720", + "label": "kernel_BFC16720", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC18000", + "label": "shell_entry", + "rationale": "Shell entry point at BFC18000, copied to RAM 0x80030000" + }, + { + "address": "0xBFC18788", + "label": "kernel_BFC18788", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC188B4", + "label": "kernel_BFC188B4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC19FD0", + "label": "shell_input_handler_2", + "rationale": "Second shell input handler at RAM 0x80031FD0. Similar to BFC1A050. Dispatch miss after adding BFC1A050." + }, + { + "address": "0xBFC1A050", + "label": "shell_input_handler", + "rationale": "Shell function called via RAM 0x80032050 after pad input detected. Dispatch miss blocked shell from processing button presses." + }, + { + "address": "0xBFC1A1BC", + "label": "modal_stub_dispatch_miss", + "rationale": "Runtime dispatch miss confirmed 2026-05-05: psx_unknown_dispatch hit during YES/NO COPY confirm modal CROSS press. Beetle wtrace+fntrace shows this PC fires on modal close via JAL caller_pc=0x8004673C. Ghidra function discovery missed it. BANDAID per user permission \u00e2\u20ac\u201d should be replaced by an improved heuristic that catches this gap." + }, + { + "address": "0xBFC1E3C0", + "label": "sio_event_opener_epilogue", + "rationale": "Epilogue fragment at BFC1E3C0 (addiu sp,sp,0x18; jr ra; nop). Reached via branch from SIO state machine. Dispatch miss after fall-through fix exposed new code paths." + }, + { + "address": "0xBFC210F0", + "label": "shell_handler_BFC210F0", + "rationale": "Recomp TCB saved PC - handler function" + }, + { + "address": "0xBFC304AC", + "label": "trampoline_BFC304AC", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC30584", + "label": "trampoline_BFC30584", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC336F0", + "label": "gte_cop2_init", + "rationale": "GTE/COP2 initialization: enables COP2 in SR, sets COP2 control registers. Contains COP2 instructions (Phase 5). Reached after fall-through fix." + }, + { + "address": "0xBFC33758", + "label": "gte_lib_BFC33758", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC337AC", + "label": "gte_lib_BFC337AC", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33800", + "label": "gte_lib_BFC33800", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC3388C", + "label": "gte_lib_BFC3388C", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33918", + "label": "gte_lib_BFC33918", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33978", + "label": "gte_lib_BFC33978", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33AB8", + "label": "gte_lib_BFC33AB8", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33B80", + "label": "gte_lib_BFC33B80", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33C04", + "label": "gte_lib_BFC33C04", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33C84", + "label": "gte_lib_BFC33C84", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33C90", + "label": "trampoline_BFC33C90", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC33CC0", + "label": "jal_BFC33CC0", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC33D1C", + "label": "trampoline_BFC33D1C", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC33D24", + "label": "gte_lib_BFC33D24", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33DA4", + "label": "gte_lib_BFC33DA4", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33E20", + "label": "gte_lib_BFC33E20", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33E80", + "label": "gte_lib_BFC33E80", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33E90", + "label": "gte_lib_BFC33E90", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33EA0", + "label": "gte_lib_BFC33EA0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33EC0", + "label": "gte_lib_BFC33EC0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33ECC", + "label": "gte_lib_BFC33ECC", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33EE0", + "label": "gte_lib_BFC33EE0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33EF4", + "label": "gte_lib_BFC33EF4", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33F40", + "label": "gte_lib_BFC33F40", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33F54", + "label": "gte_lib_BFC33F54", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33F6C", + "label": "gte_lib_BFC33F6C", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33F80", + "label": "gte_lib_BFC33F80", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33F94", + "label": "gte_lib_BFC33F94", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33FA8", + "label": "gte_lib_BFC33FA8", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33FF0", + "label": "gte_lib_BFC33FF0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC33FFC", + "label": "gte_lib_BFC33FFC", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34008", + "label": "gte_lib_BFC34008", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC3401C", + "label": "gte_lib_BFC3401C", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34028", + "label": "gte_lib_BFC34028", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC3403C", + "label": "gte_lib_BFC3403C", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34054", + "label": "gte_lib_BFC34054", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34068", + "label": "gte_lib_BFC34068", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC3407C", + "label": "gte_lib_BFC3407C", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34088", + "label": "gte_lib_BFC34088", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC3409C", + "label": "gte_lib_BFC3409C", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC340CC", + "label": "gte_lib_BFC340CC", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC340D8", + "label": "gte_lib_BFC340D8", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC340E4", + "label": "gte_lib_BFC340E4", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34104", + "label": "gte_lib_BFC34104", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34110", + "label": "gte_lib_BFC34110", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34924", + "label": "gte_lib_BFC34924", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34928", + "label": "gte_lib_BFC34928", + "rationale": "GTE library sub-entry. Cascade from batch." + }, + { + "address": "0xBFC34954", + "label": "gte_lib_BFC34954", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34958", + "label": "gte_lib_BFC34958", + "rationale": "GTE library sub-entry. Cascade." + }, + { + "address": "0xBFC34980", + "label": "gte_lib_BFC34980", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34984", + "label": "gte_lib_BFC34984", + "rationale": "GTE library sub-entry. Cascade." + }, + { + "address": "0xBFC34A04", + "label": "gte_lib_BFC34A04", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34A08", + "label": "gte_lib_BFC34A08", + "rationale": "GTE library sub-entry. Cascade from batch." + }, + { + "address": "0xBFC34A30", + "label": "gte_lib_BFC34A30", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34A34", + "label": "gte_lib_BFC34A34", + "rationale": "GTE library sub-entry. Cascade." + }, + { + "address": "0xBFC34A60", + "label": "gte_lib_BFC34A60", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34A64", + "label": "gte_lib_BFC34A64", + "rationale": "GTE library sub-entry. Cascade." + }, + { + "address": "0xBFC34A90", + "label": "gte_lib_BFC34A90", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34AA0", + "label": "gte_lib_BFC34AA0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34B08", + "label": "gte_lib_BFC34B08", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34E00", + "name": "gte_lib_BFC34E00" + }, + { + "address": "0xBFC34EC0", + "label": "gte_lib_BFC34EC0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34EC4", + "label": "gte_lib_BFC34EC4", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC34FA0", + "label": "gte_lib_BFC34FA0", + "rationale": "GTE math library function missed by adjacent batch discovery; contains the BFC34FF8-BFC350C4 MVMVA/SWC2 helper used by the BIOS disc logo screen." + }, + { + "address": "0xBFC35128", + "label": "gte_lib_BFC35128", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC3524C", + "label": "gte_lib_BFC3524C", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35348", + "label": "gte_lib_BFC35348", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35470", + "label": "gte_lib_BFC35470", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35598", + "label": "gte_lib_BFC35598", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35698", + "label": "gte_lib_BFC35698", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC357C4", + "label": "gte_lib_BFC357C4", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC3582C", + "label": "gte_lib_BFC3582C", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC3586C", + "name": "gte_lib_BFC3586C" + }, + { + "address": "0xBFC35890", + "label": "gte_lib_BFC35890", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC359B4", + "name": "gte_lib_BFC359B4" + }, + { + "address": "0xBFC35AD8", + "name": "gte_lib_BFC35AD8" + }, + { + "address": "0xBFC35B08", + "name": "gte_lib_BFC35B08" + }, + { + "address": "0xBFC35B38", + "name": "gte_lib_BFC35B38" + }, + { + "address": "0xBFC35B68", + "name": "gte_lib_BFC35B68" + }, + { + "address": "0xBFC35B88", + "label": "gte_lib_BFC35B88", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35BC4", + "label": "gte_lib_BFC35BC4", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35C28", + "label": "gte_lib_BFC35C28", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35C60", + "label": "gte_lib_BFC35C60", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35CC8", + "label": "gte_lib_BFC35CC8", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35D10", + "label": "gte_lib_BFC35D10", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35D58", + "label": "gte_lib_BFC35D58", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35DA0", + "label": "gte_lib_BFC35DA0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35DD4", + "label": "gte_lib_BFC35DD4", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35E30", + "label": "gte_lib_BFC35E30", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35E64", + "label": "gte_lib_BFC35E64", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35E98", + "label": "gte_lib_BFC35E98", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35EC0", + "label": "gte_lib_BFC35EC0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35EEC", + "label": "gte_lib_BFC35EEC", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35F18", + "label": "gte_lib_BFC35F18", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35F38", + "label": "gte_lib_BFC35F38", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35F78", + "label": "gte_lib_BFC35F78", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35FA0", + "label": "gte_lib_BFC35FA0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC35FD0", + "label": "gte_lib_BFC35FD0", + "rationale": "GTE math library function. Batch-discovered from BFC33000-BFC36000." + }, + { + "address": "0xBFC36000", + "name": "gte_lib_BFC36000" + }, + { + "address": "0xBFC36024", + "name": "gte_lib_BFC36024" + }, + { + "address": "0xBFC36068", + "name": "gte_lib_BFC36068" + }, + { + "address": "0xBFC36094", + "name": "gte_lib_BFC36094" + }, + { + "address": "0xBFC360E0", + "name": "gte_lib_BFC360E0" + }, + { + "address": "0xBFC36104", + "name": "gte_lib_BFC36104" + }, + { + "address": "0xBFC3614C", + "name": "gte_lib_BFC3614C" + }, + { + "address": "0xBFC36178", + "name": "gte_lib_BFC36178" + }, + { + "address": "0xBFC361A0", + "name": "gte_lib_BFC361A0" + }, + { + "address": "0xBFC361CC", + "name": "gte_lib_BFC361CC" + }, + { + "address": "0xBFC361F4", + "name": "gte_lib_BFC361F4" + }, + { + "address": "0xBFC3621C", + "name": "gte_lib_BFC3621C" + }, + { + "address": "0xBFC36244", + "name": "gte_lib_BFC36244" + }, + { + "address": "0xBFC3625C", + "name": "gte_lib_BFC3625C" + }, + { + "address": "0xBFC36280", + "name": "gte_lib_BFC36280" + }, + { + "address": "0xBFC36294", + "name": "gte_lib_BFC36294" + }, + { + "address": "0xBFC362BC", + "name": "gte_lib_BFC362BC" + }, + { + "address": "0xBFC362D0", + "name": "gte_lib_BFC362D0" + }, + { + "address": "0xBFC3632C", + "name": "gte_lib_BFC3632C" + }, + { + "address": "0xBFC36388", + "name": "gte_lib_BFC36388" + }, + { + "address": "0xBFC363A0", + "name": "gte_lib_BFC363A0" + }, + { + "address": "0xBFC363F0", + "name": "gte_lib_BFC363F0" + }, + { + "address": "0xBFC36458", + "name": "gte_lib_BFC36458" + }, + { + "address": "0xBFC364DC", + "name": "gte_lib_BFC364DC" + }, + { + "address": "0xBFC3653C", + "name": "gte_lib_BFC3653C" + }, + { + "address": "0xBFC365C4", + "name": "gte_lib_BFC365C4" + }, + { + "address": "0xBFC365F8", + "name": "gte_lib_BFC365F8" + }, + { + "address": "0xBFC36684", + "name": "gte_lib_BFC36684" + }, + { + "address": "0xBFC36740", + "name": "gte_lib_BFC36740" + }, + { + "address": "0xBFC367D4", + "name": "gte_lib_BFC367D4" + }, + { + "address": "0xBFC36880", + "name": "gte_lib_BFC36880" + }, + { + "address": "0xBFC36940", + "name": "gte_lib_BFC36940" + }, + { + "address": "0xBFC36998", + "name": "gte_lib_BFC36998" + }, + { + "address": "0xBFC36A3C", + "name": "gte_lib_BFC36A3C" + }, + { + "address": "0xBFC36B14", + "name": "gte_lib_BFC36B14" + }, + { + "address": "0xBFC36BEC", + "name": "gte_lib_BFC36BEC" + }, + { + "address": "0xBFC36C60", + "name": "gte_lib_BFC36C60" + }, + { + "address": "0xBFC36CA4", + "name": "gte_lib_BFC36CA4" + }, + { + "address": "0xBFC36FF0", + "name": "gte_lib_BFC36FF0" + }, + { + "address": "0xBFC38AF0", + "label": "shell_hot_function", + "rationale": "Dispatch miss at 0x80050AF0 (phys 0x1FC38AF0) \u00e2\u20ac\u201d 178 misses. Hot shell function during rendering loop." + }, + { + "address": "0xBFC41D18", + "label": "shell_3d_callback_BFC41D18", + "rationale": "DuckStation oracle TCB saved PC - shell 3D rendering callback" + }, + { + "address": "0xBFC41DC8", + "label": "dispatch_miss_0xBFC41DC8", + "rationale": "Phase 4.5 dispatch miss from 3D rendering seeds" + }, + { + "address": "0xBFC41DFC", + "label": "shell_3d_callback_BFC41DFC", + "rationale": "DuckStation oracle TCB saved EPC - shell 3D rendering" + }, + { + "address": "0xBFC41E14", + "label": "dispatch_miss_0xBFC41E14", + "rationale": "Phase 4.5 dispatch miss from 3D rendering seeds" + }, + { + "address": "0xBFC41FC0", + "label": "shell_InitRCnt_setup", + "rationale": "Undiscovered function: calls B0:0x15 (InitRCnt) with arg 0x20000001. Only reachable via indirect jalr from shell init table. Missing seed causes VSync counter to never increment." + }, + { + "address": "0xBFC421D8", + "label": "shell_vblank_restore_entry", + "rationale": "Mid-function entry: SaveState/RestoreState (A0:0x13/0x14) longjmp target inside func_1FC42160; after RestoreState returns v0!=0 the callback loop runs" + }, + { + "address": "0xBFC4226C", + "label": "shell_vblank_callback_loop", + "rationale": "Mid-function entry point inside func_1FC42160. The BIOS shell jumps here directly to walk VBlank callbacks, bypassing the init-gate at the function top. Needed for VSync counter increment." + }, + { + "address": "0xBFC42308", + "label": "shell_42308", + "rationale": "Shell function near VSync callback area. Dispatch miss from input path." + }, + { + "address": "0xBFC4231C", + "label": "shell_vblank_init_body", + "rationale": "Mid-function entry: SaveState returns v0=0 \u00e2\u2020\u2019 BEQ at 0xBFC421D8 taken \u00e2\u2020\u2019 callback table setup at 0xBFC4231C. Split from func_1FC42160" + }, + { + "address": "0xBFC42370", + "label": "shell_vblank_epilogue", + "rationale": "Mid-function entry: func_1FC42160 epilogue (restore ra/sp, return). Branch target from BNE at 0xBFC4216C when init flag is set" + }, + { + "address": "0xBFC425BC", + "label": "vblank_chain_handler", + "rationale": "VBlank chain handler: the ONLY instruction in the entire BIOS ROM that stores to 0x80079D9C (VSync counter) is at 0xBFC425E0, inside this 15-instruction function at 0xBFC425BC. Function reads counter, increments it, optionally calls user callback at *0x800DFF40. Not reachable via any JAL/literal/lui in ROM \u00e2\u20ac\u201d installed at runtime by kernel chain-registration code. Missing seed means counter-increment code is never recompiled, so even if kernel installs the handler pointer it cannot dispatch to recompiled code." + }, + { + "address": "0xBFC428D0", + "label": "trampoline_BFC428D0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC428E0", + "label": "trampoline_BFC428E0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC428F0", + "label": "trampoline_BFC428F0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42900", + "label": "trampoline_BFC42900", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42910", + "label": "shell_post_callback_cleanup", + "rationale": "Called from func_1FC42160 after 256-iteration callback countdown expires; was dispatch miss" + }, + { + "address": "0xBFC42920", + "label": "trampoline_BFC42920", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42930", + "label": "trampoline_BFC42930", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42940", + "label": "trampoline_BFC42940", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42950", + "label": "trampoline_BFC42950", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42960", + "label": "trampoline_BFC42960", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42970", + "label": "trampoline_BFC42970", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42980", + "label": "trampoline_BFC42980", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42990", + "label": "trampoline_BFC42990", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC429A0", + "label": "trampoline_BFC429A0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC429B0", + "label": "trampoline_BFC429B0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC429C0", + "label": "trampoline_BFC429C0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC429D0", + "label": "trampoline_BFC429D0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC429E0", + "label": "trampoline_BFC429E0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC429F0", + "label": "trampoline_BFC429F0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42A00", + "label": "trampoline_BFC42A00", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42A20", + "label": "trampoline_BFC42A20", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42A30", + "label": "trampoline_BFC42A30", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42A40", + "label": "trampoline_BFC42A40", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42A50", + "label": "trampoline_BFC42A50", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42A60", + "label": "trampoline_BFC42A60", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42A70", + "label": "trampoline_BFC42A70", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42A80", + "label": "trampoline_BFC42A80", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42AA0", + "label": "trampoline_BFC42AA0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42AB0", + "label": "trampoline_BFC42AB0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42AC0", + "label": "trampoline_BFC42AC0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42AD0", + "label": "trampoline_BFC42AD0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42AE0", + "label": "trampoline_BFC42AE0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42AF0", + "label": "trampoline_BFC42AF0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B00", + "label": "trampoline_BFC42B00", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B10", + "label": "trampoline_BFC42B10", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B20", + "label": "trampoline_BFC42B20", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B30", + "label": "trampoline_BFC42B30", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B40", + "label": "trampoline_BFC42B40", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B50", + "label": "trampoline_BFC42B50", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B60", + "label": "trampoline_BFC42B60", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B70", + "label": "trampoline_BFC42B70", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B80", + "label": "trampoline_BFC42B80", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42B90", + "label": "trampoline_BFC42B90", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42BA0", + "label": "shell_vblank_dispatch", + "rationale": "Called from chain-E004 verify (func_1FC40700) via jal 0x8005ABA0. Walks VBlank callback chain \u00e2\u2020\u2019 calls VSync counter incrementer. Missing seed blocks VSync counter from incrementing." + }, + { + "address": "0xBFC42BB0", + "label": "trampoline_BFC42BB0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42BC0", + "label": "trampoline_BFC42BC0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42BD0", + "label": "trampoline_BFC42BD0", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC42BE0", + "label": "shell_vblank_process", + "rationale": "Called from chain-E004 verify (jal 0x8005ABE0). Also called from shell main loop to process VBlank events. Missing seed causes VBlank callback chain to never execute." + }, + { + "address": "0xBFC42BF0", + "label": "shell_register_callback", + "rationale": "Called from func_1FC42160 init path at 0xBFC42330 to register VBlank callbacks; missing seed caused callback table corruption" + }, + { + "address": "0xBFC42C00", + "label": "trampoline_BFC42C00", + "rationale": "audit-detected dispatch miss \u2014 A0/B0/C0 syscall trampoline" + }, + { + "address": "0xBFC02934", + "rationale": "kernel jump-table target: A0:0F (unresolved (see psx-spx A0 table)) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03200", + "rationale": "kernel jump-table target: A0:16 (strncat) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC034D0", + "rationale": "kernel jump-table target: A0:1C (atob helper) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03514", + "rationale": "kernel jump-table target: A0:1D (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0357C", + "rationale": "kernel jump-table target: A0:1E (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC035C0", + "rationale": "kernel jump-table target: A0:1F (abs) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03628", + "rationale": "kernel jump-table target: A0:20 (labs) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03694", + "rationale": "kernel jump-table target: A0:21 (atoi) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC036FC", + "rationale": "kernel jump-table target: A0:22 (atol) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03894", + "rationale": "kernel jump-table target: A0:24 (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC01B08", + "rationale": "kernel jump-table target: A0:29 (bcmp) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02B8C", + "rationale": "kernel jump-table target: A0:2B (memset) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02BC8", + "rationale": "kernel jump-table target: A0:2C (memmove) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02C50", + "rationale": "kernel jump-table target: A0:2D (memcmp) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02230", + "rationale": "kernel jump-table target: A0:30 (rand-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC021A0", + "rationale": "kernel jump-table target: A0:37 (rand-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8E0", + "rationale": "kernel jump-table target: A0:40 (SystemErrorUnresolvedException) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04120", + "rationale": "kernel jump-table target: A0:4D (ChangeClearRCnt-adjacent) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8F0", + "rationale": "kernel jump-table target: A0:4F (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D900", + "rationale": "kernel jump-table target: A0:50 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D910", + "rationale": "kernel jump-table target: A0:52 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D920", + "rationale": "kernel jump-table target: A0:53 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0B0C4", + "rationale": "kernel jump-table target: A0:6F (card/dev service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04AA0", + "rationale": "kernel jump-table target: A0:94 (card-adjacent service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D930", + "rationale": "kernel jump-table target: A0:9A (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D940", + "rationale": "kernel jump-table target: A0:9B (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06750", + "rationale": "kernel jump-table target: A0:9C (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06728", + "rationale": "kernel jump-table target: A0:9D (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC050DC", + "rationale": "kernel jump-table target: A0:9E (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D4F0", + "rationale": "kernel jump-table target: A0:B4 (GetSystemInfo-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xA0000500", + "label": "kernel_entry_kseg1", + "rationale": "segment-qualified seed (docs/SEGMENT_AWARE_CODE.md \u00a75.4): the reset code enters the relocated kernel through its uncached alias (lui $a0,0xA000; addiu $a0,$a0,0x500; jr $a0 at ROM 0xBFC0044C-0xBFC00454). Compiles a KSEG1 variant of kernel_trampoline_0 (ROM 0xBFC10000, runtime 0x00000500) that charges an uncached fetch per instruction, as Beetle does (20 cycles against the cached body's 11)." + } + ], + "excluded": [ + { + "address": "0xBFC00100", + "label": "utlb_miss_bev1", + "rationale": "R3000 UTLB-miss vector; PS1 has no TLB; never executed" + } + ] +} \ No newline at end of file diff --git a/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH101.json b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH101.json new file mode 100644 index 00000000..aa5b1311 --- /dev/null +++ b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH101.json @@ -0,0 +1,2654 @@ +{ + "schema": "psxrecomp phase2 seeds", + "source": "phase2_ghidra_seeds.json filtered vs SCPH101 ROM (64-byte window)", + "seed_count": 534, + "seeds": [ + { + "address": "0xBFC00000", + "label": "reset_vector", + "rationale": "MIPS R3000A reset vector" + }, + { + "address": "0xBFC00180", + "label": "general_exception_bev1", + "rationale": "BEV=1 general exception vector" + }, + { + "address": "0xBFC00420", + "label": "ghidra_BFC00420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00678", + "label": "ghidra_BFC00678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006A8", + "label": "ghidra_BFC006A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006D8", + "label": "ghidra_BFC006D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00778", + "label": "ghidra_BFC00778", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00810", + "label": "ghidra_BFC00810", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC008A0", + "label": "ghidra_BFC008A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00944", + "label": "ghidra_BFC00944", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00B7C", + "label": "ghidra_BFC00B7C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00DA0", + "label": "ghidra_BFC00DA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC018E0", + "label": "ghidra_BFC018E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01920", + "label": "ghidra_BFC01920", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01A60", + "label": "ghidra_BFC01A60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01A90", + "label": "ghidra_BFC01A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01ACC", + "label": "ghidra_BFC01ACC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01B80", + "label": "ghidra_BFC01B80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01C8C", + "label": "ghidra_BFC01C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01E5C", + "label": "ghidra_BFC01E5C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC020F0", + "label": "ghidra_BFC020F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02104", + "label": "ghidra_BFC02104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02240", + "label": "ghidra_BFC02240", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0227C", + "label": "ghidra_BFC0227C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC022C0", + "label": "ghidra_BFC022C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02324", + "label": "ghidra_BFC02324", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02590", + "label": "ghidra_BFC02590", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC025B0", + "label": "ghidra_BFC025B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02738", + "label": "ghidra_BFC02738", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02950", + "label": "ghidra_BFC02950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02AF0", + "label": "ghidra_BFC02AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B10", + "label": "ghidra_BFC02B10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B50", + "label": "ghidra_BFC02B50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02CC0", + "label": "ghidra_BFC02CC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02D20", + "label": "ghidra_BFC02D20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02DAC", + "label": "ghidra_BFC02DAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EA0", + "label": "ghidra_BFC02EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EDC", + "label": "ghidra_BFC02EDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02F20", + "label": "ghidra_BFC02F20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03098", + "label": "ghidra_BFC03098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03104", + "label": "ghidra_BFC03104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03190", + "label": "ghidra_BFC03190", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03288", + "label": "ghidra_BFC03288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03310", + "label": "ghidra_BFC03310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC033C8", + "label": "ghidra_BFC033C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03418", + "label": "ghidra_BFC03418", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03494", + "label": "ghidra_BFC03494", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03764", + "label": "ghidra_BFC03764", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03910", + "label": "ghidra_BFC03910", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03968", + "label": "ghidra_BFC03968", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03978", + "label": "ghidra_BFC03978", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03990", + "label": "ghidra_BFC03990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC039B0", + "label": "ghidra_BFC039B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03A18", + "label": "ghidra_BFC03A18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03AA4", + "label": "ghidra_BFC03AA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03C90", + "label": "ghidra_BFC03C90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03CF0", + "label": "ghidra_BFC03CF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03D80", + "label": "ghidra_BFC03D80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03EA0", + "label": "ghidra_BFC03EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03F8C", + "label": "ghidra_BFC03F8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FAC", + "label": "ghidra_BFC03FAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FE0", + "label": "ghidra_BFC03FE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0403C", + "label": "ghidra_BFC0403C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC040EC", + "label": "ghidra_BFC040EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04138", + "label": "ghidra_BFC04138", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04260", + "label": "ghidra_BFC04260", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042A0", + "label": "ghidra_BFC042A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042D0", + "label": "ghidra_BFC042D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04610", + "label": "ghidra_BFC04610", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04678", + "label": "ghidra_BFC04678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0472C", + "label": "ghidra_BFC0472C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC048D0", + "label": "ghidra_BFC048D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04ABC", + "label": "ghidra_BFC04ABC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04BC4", + "label": "ghidra_BFC04BC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04C38", + "label": "ghidra_BFC04C38", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04D50", + "label": "ghidra_BFC04D50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04DEC", + "label": "ghidra_BFC04DEC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04FBC", + "label": "ghidra_BFC04FBC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0506C", + "label": "ghidra_BFC0506C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050A4", + "label": "ghidra_BFC050A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050FC", + "label": "ghidra_BFC050FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05120", + "label": "ghidra_BFC05120", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05194", + "label": "ghidra_BFC05194", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05558", + "label": "ghidra_BFC05558", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC057B0", + "label": "ghidra_BFC057B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0593C", + "label": "ghidra_BFC0593C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05A44", + "label": "ghidra_BFC05A44", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C18", + "label": "ghidra_BFC05C18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C50", + "label": "ghidra_BFC05C50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05D04", + "label": "ghidra_BFC05D04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DB0", + "label": "ghidra_BFC05DB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DF4", + "label": "ghidra_BFC05DF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05E58", + "label": "ghidra_BFC05E58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05F08", + "label": "ghidra_BFC05F08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06010", + "label": "ghidra_BFC06010", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06038", + "label": "ghidra_BFC06038", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC060DC", + "label": "ghidra_BFC060DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0615C", + "label": "ghidra_BFC0615C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061A0", + "label": "ghidra_BFC061A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061D4", + "label": "ghidra_BFC061D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06218", + "label": "ghidra_BFC06218", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06288", + "label": "ghidra_BFC06288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC062CC", + "label": "ghidra_BFC062CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC063CC", + "label": "ghidra_BFC063CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC064D8", + "label": "ghidra_BFC064D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06548", + "label": "ghidra_BFC06548", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC065C0", + "label": "ghidra_BFC065C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0661C", + "label": "ghidra_BFC0661C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06680", + "label": "ghidra_BFC06680", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06700", + "label": "ghidra_BFC06700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06784", + "label": "ghidra_BFC06784", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC067E8", + "label": "ghidra_BFC067E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06CA4", + "label": "ghidra_BFC06CA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06EC4", + "label": "ghidra_BFC06EC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06F28", + "label": "ghidra_BFC06F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FA4", + "label": "ghidra_BFC06FA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FF0", + "label": "ghidra_BFC06FF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0703C", + "label": "ghidra_BFC0703C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC070AC", + "label": "ghidra_BFC070AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0711C", + "label": "ghidra_BFC0711C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07148", + "label": "ghidra_BFC07148", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC071A0", + "label": "ghidra_BFC071A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC072B8", + "label": "ghidra_BFC072B8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07330", + "label": "ghidra_BFC07330", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07370", + "label": "ghidra_BFC07370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC073A0", + "label": "ghidra_BFC073A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07410", + "label": "ghidra_BFC07410", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07664", + "label": "ghidra_BFC07664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07700", + "label": "ghidra_BFC07700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC078A4", + "label": "ghidra_BFC078A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07A04", + "label": "ghidra_BFC07A04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07B88", + "label": "ghidra_BFC07B88", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07C1C", + "label": "ghidra_BFC07C1C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07F28", + "label": "ghidra_BFC07F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08020", + "label": "ghidra_BFC08020", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08098", + "label": "ghidra_BFC08098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC081FC", + "label": "ghidra_BFC081FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08354", + "label": "ghidra_BFC08354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC083CC", + "label": "ghidra_BFC083CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085B0", + "label": "ghidra_BFC085B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085D4", + "label": "ghidra_BFC085D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086B0", + "label": "ghidra_BFC086B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086EC", + "label": "ghidra_BFC086EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08720", + "label": "ghidra_BFC08720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC087C4", + "label": "ghidra_BFC087C4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0884C", + "label": "ghidra_BFC0884C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC088A0", + "label": "ghidra_BFC088A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0895C", + "label": "ghidra_BFC0895C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC089C0", + "label": "ghidra_BFC089C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08B3C", + "label": "ghidra_BFC08B3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08FFC", + "label": "ghidra_BFC08FFC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09144", + "label": "ghidra_BFC09144", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC091CC", + "label": "ghidra_BFC091CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC092EC", + "label": "ghidra_BFC092EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09540", + "label": "ghidra_BFC09540", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09598", + "label": "ghidra_BFC09598", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09720", + "label": "ghidra_BFC09720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC098A8", + "label": "ghidra_BFC098A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09914", + "label": "ghidra_BFC09914", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0994C", + "label": "ghidra_BFC0994C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0996C", + "label": "ghidra_BFC0996C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09CDC", + "label": "ghidra_BFC09CDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09D3C", + "label": "ghidra_BFC09D3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A080", + "label": "ghidra_BFC0A080", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A3D4", + "label": "ghidra_BFC0A3D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A43C", + "label": "ghidra_BFC0A43C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A4B4", + "label": "ghidra_BFC0A4B4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A5E4", + "label": "ghidra_BFC0A5E4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A754", + "label": "ghidra_BFC0A754", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A8BC", + "label": "ghidra_BFC0A8BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AB60", + "label": "ghidra_BFC0AB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AD08", + "label": "ghidra_BFC0AD08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B0D0", + "label": "ghidra_BFC0B0D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B170", + "label": "ghidra_BFC0B170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B394", + "label": "ghidra_BFC0B394", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B54C", + "label": "ghidra_BFC0B54C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5A0", + "label": "ghidra_BFC0B5A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5F4", + "label": "ghidra_BFC0B5F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B648", + "label": "ghidra_BFC0B648", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0BFF0", + "label": "ghidra_BFC0BFF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C048", + "label": "ghidra_BFC0C048", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C0DC", + "label": "ghidra_BFC0C0DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C140", + "label": "ghidra_BFC0C140", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C1FC", + "label": "ghidra_BFC0C1FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C220", + "label": "ghidra_BFC0C220", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C248", + "label": "ghidra_BFC0C248", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C270", + "label": "ghidra_BFC0C270", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C298", + "label": "ghidra_BFC0C298", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2C0", + "label": "ghidra_BFC0C2C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2E8", + "label": "ghidra_BFC0C2E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C318", + "label": "ghidra_BFC0C318", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C354", + "label": "ghidra_BFC0C354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C580", + "label": "ghidra_BFC0C580", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C720", + "label": "ghidra_BFC0C720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C830", + "label": "ghidra_BFC0C830", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C890", + "label": "ghidra_BFC0C890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C9CC", + "label": "ghidra_BFC0C9CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CAB4", + "label": "ghidra_BFC0CAB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CC68", + "label": "ghidra_BFC0CC68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CD80", + "label": "ghidra_BFC0CD80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CF84", + "label": "ghidra_BFC0CF84", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D0CC", + "label": "ghidra_BFC0D0CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D11C", + "label": "ghidra_BFC0D11C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D34C", + "label": "ghidra_BFC0D34C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D4CC", + "label": "ghidra_BFC0D4CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D570", + "label": "ghidra_BFC0D570", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D600", + "label": "ghidra_BFC0D600", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D640", + "label": "ghidra_BFC0D640", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D664", + "label": "ghidra_BFC0D664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D688", + "label": "ghidra_BFC0D688", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D72C", + "label": "ghidra_BFC0D72C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D7BC", + "label": "ghidra_BFC0D7BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D850", + "label": "ghidra_BFC0D850", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D880", + "label": "ghidra_BFC0D880", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D890", + "label": "ghidra_BFC0D890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8A0", + "label": "ghidra_BFC0D8A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8B0", + "label": "ghidra_BFC0D8B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8C0", + "label": "ghidra_BFC0D8C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8D0", + "label": "ghidra_BFC0D8D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D950", + "label": "ghidra_BFC0D950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D960", + "label": "ghidra_BFC0D960", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D970", + "label": "ghidra_BFC0D970", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D980", + "label": "ghidra_BFC0D980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D990", + "label": "ghidra_BFC0D990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9A0", + "label": "ghidra_BFC0D9A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9B0", + "label": "ghidra_BFC0D9B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9C0", + "label": "ghidra_BFC0D9C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9D0", + "label": "ghidra_BFC0D9D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9E0", + "label": "ghidra_BFC0D9E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9F0", + "label": "ghidra_BFC0D9F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA00", + "label": "ghidra_BFC0DA00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA10", + "label": "ghidra_BFC0DA10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA20", + "label": "ghidra_BFC0DA20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA30", + "label": "ghidra_BFC0DA30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA40", + "label": "ghidra_BFC0DA40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA50", + "label": "ghidra_BFC0DA50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA60", + "label": "ghidra_BFC0DA60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAA0", + "label": "ghidra_BFC0DAA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAB0", + "label": "ghidra_BFC0DAB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAC0", + "label": "ghidra_BFC0DAC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAD0", + "label": "ghidra_BFC0DAD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAE0", + "label": "ghidra_BFC0DAE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAF0", + "label": "ghidra_BFC0DAF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB00", + "label": "ghidra_BFC0DB00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB10", + "label": "ghidra_BFC0DB10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB20", + "label": "ghidra_BFC0DB20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB30", + "label": "ghidra_BFC0DB30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB40", + "label": "ghidra_BFC0DB40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB50", + "label": "ghidra_BFC0DB50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB60", + "label": "ghidra_BFC0DB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB70", + "label": "ghidra_BFC0DB70", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB80", + "label": "ghidra_BFC0DB80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB90", + "label": "ghidra_BFC0DB90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBA0", + "label": "ghidra_BFC0DBA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBB0", + "label": "ghidra_BFC0DBB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBC0", + "label": "ghidra_BFC0DBC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBD0", + "label": "ghidra_BFC0DBD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBE0", + "label": "ghidra_BFC0DBE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBF0", + "label": "ghidra_BFC0DBF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC00", + "label": "ghidra_BFC0DC00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC10", + "label": "ghidra_BFC0DC10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC20", + "label": "ghidra_BFC0DC20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC30", + "label": "ghidra_BFC0DC30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC40", + "label": "ghidra_BFC0DC40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC50", + "label": "ghidra_BFC0DC50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC10C74", + "label": "ghidra_BFC10C74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11008", + "label": "ghidra_BFC11008", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11294", + "label": "ghidra_BFC11294", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC112F4", + "label": "ghidra_BFC112F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11358", + "label": "ghidra_BFC11358", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC113BC", + "label": "ghidra_BFC113BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11420", + "label": "ghidra_BFC11420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11458", + "label": "ghidra_BFC11458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11490", + "label": "ghidra_BFC11490", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC114C8", + "label": "ghidra_BFC114C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11500", + "label": "ghidra_BFC11500", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11620", + "label": "ghidra_BFC11620", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1188C", + "label": "ghidra_BFC1188C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11B18", + "label": "ghidra_BFC11B18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11C8C", + "label": "ghidra_BFC11C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11F58", + "label": "ghidra_BFC11F58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC122C0", + "label": "ghidra_BFC122C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12370", + "label": "ghidra_BFC12370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12408", + "label": "ghidra_BFC12408", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12458", + "label": "ghidra_BFC12458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12564", + "label": "ghidra_BFC12564", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12628", + "label": "ghidra_BFC12628", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12794", + "label": "ghidra_BFC12794", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12900", + "label": "ghidra_BFC12900", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12998", + "label": "ghidra_BFC12998", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC129FC", + "label": "ghidra_BFC129FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12AC8", + "label": "ghidra_BFC12AC8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B00", + "label": "ghidra_BFC12B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B60", + "label": "ghidra_BFC12B60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12C08", + "label": "ghidra_BFC12C08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12CE8", + "label": "ghidra_BFC12CE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12F6C", + "label": "ghidra_BFC12F6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12FB4", + "label": "ghidra_BFC12FB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13070", + "label": "ghidra_BFC13070", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC130AC", + "label": "ghidra_BFC130AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13178", + "label": "ghidra_BFC13178", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13244", + "label": "ghidra_BFC13244", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13310", + "label": "ghidra_BFC13310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC133D8", + "label": "ghidra_BFC133D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC134A4", + "label": "ghidra_BFC134A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC135AC", + "label": "ghidra_BFC135AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC137E0", + "label": "ghidra_BFC137E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13980", + "label": "ghidra_BFC13980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13AF0", + "label": "ghidra_BFC13AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B24", + "label": "ghidra_BFC13B24", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B6C", + "label": "ghidra_BFC13B6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C34", + "label": "ghidra_BFC13C34", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C64", + "label": "ghidra_BFC13C64", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E04", + "label": "ghidra_BFC13E04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E60", + "label": "ghidra_BFC13E60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13EE8", + "label": "ghidra_BFC13EE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13F98", + "label": "ghidra_BFC13F98", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC144BC", + "label": "ghidra_BFC144BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC145C8", + "label": "ghidra_BFC145C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14690", + "label": "ghidra_BFC14690", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14710", + "label": "ghidra_BFC14710", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14770", + "label": "ghidra_BFC14770", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC147F4", + "label": "ghidra_BFC147F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14A90", + "label": "ghidra_BFC14A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14B00", + "label": "ghidra_BFC14B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14CF4", + "label": "ghidra_BFC14CF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC158A8", + "label": "ghidra_BFC158A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC15B9C", + "label": "ghidra_BFC15B9C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC16170", + "label": "ghidra_BFC16170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11840", + "label": "dmiss_BFC11840", + "rationale": "dispatch miss: KP2 function, indirect call" + }, + { + "address": "0xBFC11524", + "label": "dmiss_BFC11524", + "rationale": "dispatch miss: KP2 secondary entry point for exception handler, mid-function split of func_00001A00, called during VBlank" + }, + { + "address": "0xBFC11610", + "label": "dmiss_BFC11610", + "rationale": "dispatch miss: KP2 function, tail-call target from 0xBFC11524 exception handler path" + }, + { + "address": "0xBFC14A54", + "label": "dmiss_BFC14A54", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain BUSY-writer at RAM 0x4F54; alias rule RAM=ROM-0xBFC10000+0x500. Reached via JAL inside FUN_bfc147f4; never emitted as standalone entry." + }, + { + "address": "0xBFC158D0", + "label": "dmiss_BFC158D0", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-0 BUSY writer at RAM 0x5DD0; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC158D8", + "label": "dmiss_BFC158D8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-1 BUSY writer at RAM 0x5DD8; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC159F4", + "label": "dmiss_BFC159F4", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x02 OPEN to [0x7568+slot] at RAM 0x5EF4. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry \u00e2\u20ac\u201d without this the gate never clears." + }, + { + "address": "0xBFC15AA8", + "label": "dmiss_BFC15AA8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x04 OPEN to [0x7568+slot] at RAM 0x5FA8. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry \u00e2\u20ac\u201d paired with 0xBFC159F4." + }, + { + "address": "0xBFC04910", + "label": "dmiss_BFC04910", + "rationale": "Tomba boot dispatch miss after licensed PlayStation screen. Verified in Ghidra/runtime disassembly as a standalone BIOS init routine between 0xBFC048D0 and 0xBFC04ABC, with return at 0xBFC04A98 and table data reference from 0xBFC04554." + }, + { + "address": "0xBFC04850", + "label": "dmiss_BFC04850", + "rationale": "Tomba boot dispatch miss after seeding 0xBFC04910. Verified in Ghidra/runtime disassembly as a standalone BIOS callback-list init routine between 0xBFC0472C and 0xBFC048D0, with return at 0xBFC048C8 and table data reference from 0xBFC04588." + }, + { + "address": "0xBFC079F8", + "label": "dmiss_BFC079F8", + "rationale": "Tomba boot dispatch miss after game callback coverage fixes. Verified in Ghidra as a tiny BIOS table leaf routine (sw a0,0(sp); jr ra; clear v0) referenced by data at 0xBFC04484 and 0xBFC0E30C." + }, + { + "address": "0xBFC15F1C", + "label": "dmiss_BFC15F1C", + "rationale": "dirty_ram hot: SIO/PAD interrupt handler entry point (RAM 0x641C), called via jalr. 10852+ hits/frame across internal branch targets (0x641C, 0x6430, 0x6444, 0x6458, 0x650C, 0x6514, 0x658C, 0x6594). Seeding entry only; CFG discovers internal labels." + }, + { + "address": "0xBFC0193C", + "label": "cache_flush_continuation", + "rationale": "Jump target of cache-flush jr k0 at BFC01938" + }, + { + "address": "0xBFC01E24", + "label": "SysInitMemory", + "rationale": "Dispatch miss during boot \u00e2\u20ac\u201d kernel init function" + }, + { + "address": "0xBFC02200", + "label": "jal_BFC02200", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC02918", + "label": "card_copy_dispatch_miss_2026_05_05", + "rationale": "Runtime dispatch miss: 8 hits during YES/NO COPY confirm execution. BANDAID per user permission." + }, + { + "address": "0xBFC03FC0", + "label": "jal_BFC03FC0", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC06FDC", + "label": "indirect_BFC06FDC", + "rationale": "Reached via indirect dispatch during boot" + }, + { + "address": "0xBFC09890", + "label": "card_cmd_is_not_read", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x52; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x52 READ). Sibling of 0xBFC0989C." + }, + { + "address": "0xBFC0989C", + "label": "card_cmd_is_not_write_2026_05_09", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x51; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x51 WRITE). Sibling of 0xBFC09890. Discovery missed it because it sits between 0xBFC09898 (end of 0xBFC09890) and 0xBFC098A8 (next discovered fn). Called via JALR at 0xBFC09788 in func_1FC09598 \u00e2\u20ac\u201d without this seed, JALR dispatches to unknown, write predicate returns junk via uninitialized v0, BIOS COPY silently no-ops the SIO write protocol (60 misses per copy, no 0x57 ever sent). Earlier bisect (2026-05-05) said this crashed; that was before the predicate-init fix and dispatch-miss class fixes. Retry 2026-05-09." + }, + { + "address": "0xBFC0BA8C", + "label": "bios_BA8C", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0C1DC", + "label": "bios_C1DC", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0DA70", + "label": "jal_BFC0DA70", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA80", + "label": "jal_BFC0DA80", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA90", + "label": "jal_BFC0DA90", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC10000", + "label": "kernel_trampoline_0", + "rationale": "Trampoline to FileOpen (0x598)" + }, + { + "address": "0xBFC10010", + "label": "kernel_trampoline_1", + "rationale": "Trampoline to FileRead (0x5C4)" + }, + { + "address": "0xBFC10020", + "label": "kernel_trampoline_2", + "rationale": "Trampoline to FileClose (0x5E0)" + }, + { + "address": "0xBFC10030", + "label": "kernel_trampoline_3", + "rationale": "Trampoline to 0x600" + }, + { + "address": "0xBFC10040", + "label": "kernel_memcpy", + "rationale": "ROM-to-RAM and RAM clear routine" + }, + { + "address": "0xBFC10098", + "label": "kernel_bzero", + "rationale": "RAM clear routine (to 0xBFC100BC)" + }, + { + "address": "0xBFC100C4", + "label": "a0_vector_dispatch", + "rationale": "A0 function table dispatch" + }, + { + "address": "0xBFC100E0", + "label": "b0_vector_dispatch", + "rationale": "B0 function table dispatch" + }, + { + "address": "0xBFC10100", + "label": "c0_vector_dispatch", + "rationale": "C0 function table dispatch" + }, + { + "address": "0xBFC10120", + "label": "kernel_get_cause", + "rationale": "mfc0 v0,Cause; jr ra" + }, + { + "address": "0xBFC10130", + "label": "kernel_get_sr", + "rationale": "mfc0 v0,SR; jr ra" + }, + { + "address": "0xBFC10140", + "label": "kernel_set_sr", + "rationale": "mtc0 a0,SR; jr ra" + }, + { + "address": "0xBFC10150", + "label": "kernel_syscall", + "rationale": "syscall; jr ra" + }, + { + "address": "0xBFC1015C", + "label": "kernel_get_c0_table", + "rationale": "Returns C0 table pointer" + }, + { + "address": "0xBFC10168", + "label": "kernel_get_b0_table", + "rationale": "Returns B0 table pointer" + }, + { + "address": "0xBFC10174", + "label": "kernel_BFC10174", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10780", + "label": "rmiss_BFC10780", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC109A0", + "label": "kernel_BFC109A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC109B0", + "label": "kernel_BFC109B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A20", + "label": "kernel_BFC10A20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A2C", + "label": "kernel_BFC10A2C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A40", + "label": "kernel_BFC10A40", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10B30", + "label": "rmiss_BFC10B30", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10BB8", + "label": "kernel_BFC10BB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE0", + "label": "kernel_BFC10BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE4", + "label": "rmiss_BFC10BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10C3C", + "label": "kernel_BFC10C3C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F08", + "label": "kernel_BFC10F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F20", + "label": "kernel_BFC10F20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F44", + "label": "kernel_BFC10F44", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC110D8", + "label": "kernel_BFC110D8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC110F8", + "label": "kernel_BFC110F8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11114", + "label": "kernel_BFC11114", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111AC", + "label": "kernel_BFC111AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111C4", + "label": "kernel_BFC111C4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111E4", + "label": "kernel_BFC111E4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1121C", + "label": "kernel_BFC1121C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11228", + "label": "kernel_BFC11228", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1125C", + "label": "kernel_BFC1125C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11274", + "label": "kernel_BFC11274", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1152C", + "label": "rmiss_BFC1152C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11560", + "label": "rmiss_BFC11560", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115E8", + "label": "rmiss_BFC115E8", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115FC", + "label": "rmiss_BFC115FC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11644", + "label": "kernel_BFC11644", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1175C", + "label": "kernel_BFC1175C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11800", + "label": "kernel_BFC11800", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11870", + "label": "kernel_BFC11870", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1191C", + "label": "kernel_BFC1191C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11944", + "label": "kernel_BFC11944", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11980", + "label": "kernel_BFC11980", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11998", + "label": "kernel_BFC11998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC119C8", + "label": "kernel_BFC119C8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A04", + "label": "kernel_BFC11A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A10", + "label": "kernel_BFC11A10", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A4C", + "label": "kernel_BFC11A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A88", + "label": "kernel_BFC11A88", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11AFC", + "label": "kernel_BFC11AFC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11BA8", + "label": "kernel_BFC11BA8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11BD4", + "label": "kernel_BFC11BD4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C14", + "label": "kernel_BFC11C14", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C24", + "label": "kernel_BFC11C24", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C50", + "label": "kernel_BFC11C50", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C68", + "label": "kernel_BFC11C68", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12224", + "label": "kernel_BFC12224", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1228C", + "label": "kernel_BFC1228C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC122A0", + "label": "kernel_BFC122A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC129EC", + "label": "kernel_BFC129EC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BC8", + "label": "kernel_BFC12BC8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE0", + "label": "kernel_BFC12BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE4", + "label": "rmiss_BFC12BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC12EA4", + "label": "kernel_BFC12EA4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1302C", + "label": "kernel_BFC1302C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC130A4", + "label": "kernel_BFC130A4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13570", + "label": "kernel_BFC13570", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1372C", + "label": "kernel_BFC1372C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1376C", + "label": "rmiss_BFC1376C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137B4", + "label": "indirect_BFC137B4", + "rationale": "Reached via indirect dispatch during boot (kernel relocated)" + }, + { + "address": "0xBFC137BC", + "label": "rmiss_BFC137BC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137D0", + "label": "kernel_ram_function", + "rationale": "Dispatch miss at 0xBFC137D0 (phys 0x00003CD0) \u00e2\u20ac\u201d 3 misses. Kernel RAM function." + }, + { + "address": "0xBFC138AC", + "label": "kernel_BFC138AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1395C", + "label": "kernel_BFC1395C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13968", + "label": "kernel_BFC13968", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13A04", + "label": "kernel_BFC13A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13ED0", + "label": "kernel_BFC13ED0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13F5C", + "label": "kernel_BFC13F5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1454C", + "label": "kernel_BFC1454C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14588", + "label": "kernel_BFC14588", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14594", + "label": "kernel_BFC14594", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14670", + "label": "kernel_BFC14670", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14754", + "label": "kernel_BFC14754", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14764", + "label": "kernel_BFC14764", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1483C", + "label": "kernel_BFC1483C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1484C", + "label": "kernel_BFC1484C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14864", + "label": "kernel_BFC14864", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1486C", + "label": "kernel_BFC1486C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15188", + "label": "kernel_BFC15188", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC151E8", + "label": "kernel_56E8", + "rationale": "Kernel function at RAM 0x56E8. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15268", + "label": "kernel_5768", + "rationale": "Kernel function at RAM 0x5768. Cascade from input path seeds." + }, + { + "address": "0xBFC1529C", + "label": "kernel_579C", + "rationale": "Kernel function at RAM 0x579C. Cascade from input path." + }, + { + "address": "0xBFC15334", + "label": "kernel_5834", + "rationale": "Kernel function at RAM 0x5834. Cascade." + }, + { + "address": "0xBFC15370", + "label": "kernel_5870", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC153B4", + "label": "kernel_58B4", + "rationale": "Kernel (CARD driver) function at RAM 0x58B4. Cascade." + }, + { + "address": "0xBFC153E8", + "label": "kernel_58E8", + "rationale": "Kernel (CARD driver) function at RAM 0x58E8. Cascade." + }, + { + "address": "0xBFC15418", + "label": "kernel_5918", + "rationale": "Kernel (CARD driver) leaf function at RAM 0x5918. Cascade." + }, + { + "address": "0xBFC15454", + "label": "kernel_5954", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15490", + "label": "kernel_5990", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC154CC", + "label": "kernel_59CC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15500", + "label": "kernel_5A00", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15508", + "label": "kernel_5A08", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15544", + "label": "kernel_5A44", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15558", + "label": "kernel_5A58", + "rationale": "CARD read chain state 12 (data-byte-store): SIO_RX -> a1[0x7F], XOR-updates checksum at 0x7560+slot*4, returns v0=0. Targeted by jump table at RAM 0x6c98 entry 12." + }, + { + "address": "0xBFC15580", + "label": "kernel_5A80", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155B0", + "label": "kernel_5AB0", + "rationale": "CARD read chain state 13 (data-loop completion): reads byte vs checksum at 0x7560+slot*4, polls SIO_STAT for RX_RDY, reads END byte; v0=1 if 'G' else v0=-1. Targeted by jump table at RAM 0x6c98 entry 13." + }, + { + "address": "0xBFC155BC", + "label": "kernel_5ABC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155F8", + "label": "kernel_5AF8", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15634", + "label": "kernel_5B34", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15650", + "label": "kernel_5B50", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15654", + "label": "kernel_5B54", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15664", + "label": "kernel_BFC15664", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC156A4", + "label": "kernel_5BA4", + "rationale": "Kernel function at RAM 0x5BA4. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15724", + "label": "kernel_5C24", + "rationale": "Kernel function at RAM 0x5C24. Cascade from input path seeds." + }, + { + "address": "0xBFC15758", + "label": "kernel_5C58", + "rationale": "Kernel function at RAM 0x5C58. Cascade." + }, + { + "address": "0xBFC15848", + "label": "kernel_5D48", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC15894", + "label": "kernel_5D94", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15898", + "label": "kernel_5D98", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC15930", + "label": "kernel_BFC15930", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15950", + "label": "kernel_BFC15950", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15998", + "label": "kernel_BFC15998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15A04", + "label": "kernel_BFC15A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15A4C", + "label": "kernel_BFC15A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AB8", + "label": "kernel_BFC15AB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AF0", + "label": "kernel_BFC15AF0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B5C", + "label": "kernel_BFC15B5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B70", + "label": "kernel_BFC15B70", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15CC4", + "label": "kernel_BFC15CC4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15E90", + "label": "kernel_BFC15E90", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15EBC", + "label": "kernel_BFC15EBC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15F08", + "label": "kernel_BFC15F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1609C", + "label": "kernel_BFC1609C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16690", + "label": "kernel_BFC16690", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166A0", + "label": "kernel_BFC166A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166B0", + "label": "kernel_BFC166B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166C0", + "label": "kernel_BFC166C0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166D0", + "label": "kernel_BFC166D0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166E0", + "label": "kernel_BFC166E0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166F0", + "label": "kernel_BFC166F0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16700", + "label": "kernel_BFC16700", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16710", + "label": "kernel_BFC16710", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16720", + "label": "kernel_BFC16720", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC02934", + "rationale": "kernel jump-table target: A0:0F (unresolved (see psx-spx A0 table)) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03200", + "rationale": "kernel jump-table target: A0:16 (strncat) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC034D0", + "rationale": "kernel jump-table target: A0:1C (atob helper) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03514", + "rationale": "kernel jump-table target: A0:1D (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0357C", + "rationale": "kernel jump-table target: A0:1E (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC035C0", + "rationale": "kernel jump-table target: A0:1F (abs) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03628", + "rationale": "kernel jump-table target: A0:20 (labs) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03694", + "rationale": "kernel jump-table target: A0:21 (atoi) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC036FC", + "rationale": "kernel jump-table target: A0:22 (atol) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03894", + "rationale": "kernel jump-table target: A0:24 (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC01B08", + "rationale": "kernel jump-table target: A0:29 (bcmp) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02B8C", + "rationale": "kernel jump-table target: A0:2B (memset) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02BC8", + "rationale": "kernel jump-table target: A0:2C (memmove) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02C50", + "rationale": "kernel jump-table target: A0:2D (memcmp) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02230", + "rationale": "kernel jump-table target: A0:30 (rand-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC021A0", + "rationale": "kernel jump-table target: A0:37 (rand-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8E0", + "rationale": "kernel jump-table target: A0:40 (SystemErrorUnresolvedException) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04120", + "rationale": "kernel jump-table target: A0:4D (ChangeClearRCnt-adjacent) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8F0", + "rationale": "kernel jump-table target: A0:4F (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D900", + "rationale": "kernel jump-table target: A0:50 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D910", + "rationale": "kernel jump-table target: A0:52 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D920", + "rationale": "kernel jump-table target: A0:53 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0B0C4", + "rationale": "kernel jump-table target: A0:6F (card/dev service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04AA0", + "rationale": "kernel jump-table target: A0:94 (card-adjacent service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D930", + "rationale": "kernel jump-table target: A0:9A (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D940", + "rationale": "kernel jump-table target: A0:9B (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06750", + "rationale": "kernel jump-table target: A0:9C (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06728", + "rationale": "kernel jump-table target: A0:9D (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC050DC", + "rationale": "kernel jump-table target: A0:9E (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D4F0", + "rationale": "kernel jump-table target: A0:B4 (GetSystemInfo-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + } + ], + "excluded": [ + { + "address": "0xBFC00100", + "label": "utlb_miss_bev1", + "rationale": "R3000 UTLB-miss vector; PS1 has no TLB; never executed" + } + ] +} \ No newline at end of file diff --git a/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH5500.json b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH5500.json new file mode 100644 index 00000000..4c1133a8 --- /dev/null +++ b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH5500.json @@ -0,0 +1,2692 @@ +{ + "schema": "psxrecomp phase2 seeds", + "source": "phase2_ghidra_seeds.json filtered vs SCPH5500 ROM (64-byte window); reference ROM sha256 71af94d1e47a68c11e8fdb9f8368040601514a42a5a399cda48c7d3bff1e99d3; target ROM sha256 9c0421858e217805f4abe18698afea8d5aa36ff0727eb8484944e00eb5e7eadb; kept 534 dropped 569; plus 6 SCPH5500 kernel_table targets", + "seed_count": 540, + "seeds": [ + { + "address": "0xBFC00000", + "label": "reset_vector", + "rationale": "MIPS R3000A reset vector", + "provenance": "vector" + }, + { + "address": "0xBFC00180", + "label": "general_exception_bev1", + "rationale": "BEV=1 general exception vector", + "provenance": "vector" + }, + { + "address": "0xBFC00420", + "label": "ghidra_BFC00420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00678", + "label": "ghidra_BFC00678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006A8", + "label": "ghidra_BFC006A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006D8", + "label": "ghidra_BFC006D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00778", + "label": "ghidra_BFC00778", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00810", + "label": "ghidra_BFC00810", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC008A0", + "label": "ghidra_BFC008A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00944", + "label": "ghidra_BFC00944", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00B7C", + "label": "ghidra_BFC00B7C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00DA0", + "label": "ghidra_BFC00DA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC018E0", + "label": "ghidra_BFC018E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01920", + "label": "ghidra_BFC01920", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0193C", + "label": "cache_flush_continuation", + "rationale": "Jump target of cache-flush jr k0 at BFC01938" + }, + { + "address": "0xBFC01A60", + "label": "ghidra_BFC01A60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01A90", + "label": "ghidra_BFC01A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01ACC", + "label": "ghidra_BFC01ACC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01B08", + "rationale": "kernel jump-table target: A0:29 (bcmp) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC01B80", + "label": "ghidra_BFC01B80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01C8C", + "label": "ghidra_BFC01C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01E24", + "label": "SysInitMemory", + "rationale": "Dispatch miss during boot — kernel init function" + }, + { + "address": "0xBFC01E5C", + "label": "ghidra_BFC01E5C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC020F0", + "label": "ghidra_BFC020F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02104", + "label": "ghidra_BFC02104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC021A0", + "rationale": "kernel jump-table target: A0:37 (rand-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02200", + "label": "jal_BFC02200", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC02230", + "rationale": "kernel jump-table target: A0:30 (rand-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02240", + "label": "ghidra_BFC02240", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0227C", + "label": "ghidra_BFC0227C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC022C0", + "label": "ghidra_BFC022C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02324", + "label": "ghidra_BFC02324", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02590", + "label": "ghidra_BFC02590", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC025B0", + "label": "ghidra_BFC025B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02738", + "label": "ghidra_BFC02738", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02918", + "label": "card_copy_dispatch_miss_2026_05_05", + "rationale": "Runtime dispatch miss: 8 hits during YES/NO COPY confirm execution. BANDAID per user permission." + }, + { + "address": "0xBFC02934", + "rationale": "kernel jump-table target: A0:0F (unresolved (see psx-spx A0 table)) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02950", + "label": "ghidra_BFC02950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02AF0", + "label": "ghidra_BFC02AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B10", + "label": "ghidra_BFC02B10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B50", + "label": "ghidra_BFC02B50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B8C", + "rationale": "kernel jump-table target: A0:2B (memset) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02BC8", + "rationale": "kernel jump-table target: A0:2C (memmove) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02C50", + "rationale": "kernel jump-table target: A0:2D (memcmp) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02CC0", + "label": "ghidra_BFC02CC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02D20", + "label": "ghidra_BFC02D20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02DAC", + "label": "ghidra_BFC02DAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EA0", + "label": "ghidra_BFC02EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EDC", + "label": "ghidra_BFC02EDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02F20", + "label": "ghidra_BFC02F20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03098", + "label": "ghidra_BFC03098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03104", + "label": "ghidra_BFC03104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03190", + "label": "ghidra_BFC03190", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03200", + "rationale": "kernel jump-table target: A0:16 (strncat) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03288", + "label": "ghidra_BFC03288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03310", + "label": "ghidra_BFC03310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC033C8", + "label": "ghidra_BFC033C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03418", + "label": "ghidra_BFC03418", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03494", + "label": "ghidra_BFC03494", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC034D0", + "rationale": "kernel jump-table target: A0:1C (atob helper) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03514", + "rationale": "kernel jump-table target: A0:1D (strtol-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0357C", + "rationale": "kernel jump-table target: A0:1E (strtol-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC035C0", + "rationale": "kernel jump-table target: A0:1F (abs) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03628", + "rationale": "kernel jump-table target: A0:20 (labs) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03694", + "rationale": "kernel jump-table target: A0:21 (atoi) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC036FC", + "rationale": "kernel jump-table target: A0:22 (atol) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03764", + "label": "ghidra_BFC03764", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03894", + "rationale": "kernel jump-table target: A0:24 (strtol-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03910", + "label": "ghidra_BFC03910", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03968", + "label": "ghidra_BFC03968", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03978", + "label": "ghidra_BFC03978", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03990", + "label": "ghidra_BFC03990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC039B0", + "label": "ghidra_BFC039B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03A18", + "label": "ghidra_BFC03A18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03AA4", + "label": "ghidra_BFC03AA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03C90", + "label": "ghidra_BFC03C90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03CF0", + "label": "ghidra_BFC03CF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03D80", + "label": "ghidra_BFC03D80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03EA0", + "label": "ghidra_BFC03EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03F8C", + "label": "ghidra_BFC03F8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FAC", + "label": "ghidra_BFC03FAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FC0", + "label": "jal_BFC03FC0", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC03FE0", + "label": "ghidra_BFC03FE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0403C", + "label": "ghidra_BFC0403C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC040EC", + "label": "ghidra_BFC040EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04120", + "rationale": "kernel jump-table target: A0:4D (ChangeClearRCnt-adjacent) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04138", + "label": "ghidra_BFC04138", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04260", + "label": "ghidra_BFC04260", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042A0", + "label": "ghidra_BFC042A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042D0", + "label": "ghidra_BFC042D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04610", + "label": "ghidra_BFC04610", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04678", + "label": "ghidra_BFC04678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0472C", + "label": "ghidra_BFC0472C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04850", + "label": "dmiss_BFC04850", + "rationale": "Tomba boot dispatch miss after seeding 0xBFC04910. Verified in Ghidra/runtime disassembly as a standalone BIOS callback-list init routine between 0xBFC0472C and 0xBFC048D0, with return at 0xBFC048C8 and table data reference from 0xBFC04588." + }, + { + "address": "0xBFC048D0", + "label": "ghidra_BFC048D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04910", + "label": "dmiss_BFC04910", + "rationale": "Tomba boot dispatch miss after licensed PlayStation screen. Verified in Ghidra/runtime disassembly as a standalone BIOS init routine between 0xBFC048D0 and 0xBFC04ABC, with return at 0xBFC04A98 and table data reference from 0xBFC04554." + }, + { + "address": "0xBFC04AA0", + "rationale": "kernel jump-table target: A0:94 (card-adjacent service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04ABC", + "label": "ghidra_BFC04ABC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04BC4", + "label": "ghidra_BFC04BC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04C38", + "label": "ghidra_BFC04C38", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04D50", + "label": "ghidra_BFC04D50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04DEC", + "label": "ghidra_BFC04DEC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04FBC", + "label": "ghidra_BFC04FBC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0506C", + "label": "ghidra_BFC0506C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050A4", + "label": "ghidra_BFC050A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050DC", + "rationale": "kernel jump-table target: A0:9E (kernel service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC050FC", + "label": "ghidra_BFC050FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05120", + "label": "ghidra_BFC05120", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05194", + "label": "ghidra_BFC05194", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05558", + "label": "ghidra_BFC05558", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC057B0", + "label": "ghidra_BFC057B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0593C", + "label": "ghidra_BFC0593C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05A44", + "label": "ghidra_BFC05A44", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C18", + "label": "ghidra_BFC05C18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C50", + "label": "ghidra_BFC05C50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05D04", + "label": "ghidra_BFC05D04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DB0", + "label": "ghidra_BFC05DB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DF4", + "label": "ghidra_BFC05DF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05E58", + "label": "ghidra_BFC05E58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05F08", + "label": "ghidra_BFC05F08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06010", + "label": "ghidra_BFC06010", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06038", + "label": "ghidra_BFC06038", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC060DC", + "label": "ghidra_BFC060DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0615C", + "label": "ghidra_BFC0615C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061A0", + "label": "ghidra_BFC061A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061D4", + "label": "ghidra_BFC061D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06218", + "label": "ghidra_BFC06218", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06288", + "label": "ghidra_BFC06288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC062CC", + "label": "ghidra_BFC062CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC063CC", + "label": "ghidra_BFC063CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC064D8", + "label": "ghidra_BFC064D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06548", + "label": "ghidra_BFC06548", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC065C0", + "label": "ghidra_BFC065C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0661C", + "label": "ghidra_BFC0661C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06680", + "label": "ghidra_BFC06680", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06700", + "label": "ghidra_BFC06700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06728", + "rationale": "kernel jump-table target: A0:9D (kernel service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06750", + "rationale": "kernel jump-table target: A0:9C (kernel service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06784", + "label": "ghidra_BFC06784", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC067E8", + "label": "ghidra_BFC067E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06CA4", + "label": "ghidra_BFC06CA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06EC4", + "label": "ghidra_BFC06EC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06F28", + "label": "ghidra_BFC06F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FA4", + "label": "ghidra_BFC06FA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FDC", + "label": "indirect_BFC06FDC", + "rationale": "Reached via indirect dispatch during boot" + }, + { + "address": "0xBFC06FF0", + "label": "ghidra_BFC06FF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0703C", + "label": "ghidra_BFC0703C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC070AC", + "label": "ghidra_BFC070AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0711C", + "label": "ghidra_BFC0711C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07148", + "label": "ghidra_BFC07148", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC071A0", + "label": "ghidra_BFC071A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC072B8", + "label": "ghidra_BFC072B8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07330", + "label": "ghidra_BFC07330", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07370", + "label": "ghidra_BFC07370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC073A0", + "label": "ghidra_BFC073A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07410", + "label": "ghidra_BFC07410", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07664", + "label": "ghidra_BFC07664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07700", + "label": "ghidra_BFC07700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC078A4", + "label": "ghidra_BFC078A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC079F8", + "label": "dmiss_BFC079F8", + "rationale": "Tomba boot dispatch miss after game callback coverage fixes. Verified in Ghidra as a tiny BIOS table leaf routine (sw a0,0(sp); jr ra; clear v0) referenced by data at 0xBFC04484 and 0xBFC0E30C." + }, + { + "address": "0xBFC07A04", + "label": "ghidra_BFC07A04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07B88", + "label": "ghidra_BFC07B88", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07C1C", + "label": "ghidra_BFC07C1C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07F28", + "label": "ghidra_BFC07F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08020", + "label": "ghidra_BFC08020", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08098", + "label": "ghidra_BFC08098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC081FC", + "label": "ghidra_BFC081FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08354", + "label": "ghidra_BFC08354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC083CC", + "label": "ghidra_BFC083CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085B0", + "label": "ghidra_BFC085B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085D4", + "label": "ghidra_BFC085D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086B0", + "label": "ghidra_BFC086B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086EC", + "label": "ghidra_BFC086EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08720", + "label": "ghidra_BFC08720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC087C4", + "label": "ghidra_BFC087C4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0884C", + "label": "ghidra_BFC0884C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC088A0", + "label": "ghidra_BFC088A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0895C", + "label": "ghidra_BFC0895C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC089C0", + "label": "ghidra_BFC089C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08B3C", + "label": "ghidra_BFC08B3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08FFC", + "label": "ghidra_BFC08FFC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09144", + "label": "ghidra_BFC09144", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC091CC", + "label": "ghidra_BFC091CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC092EC", + "label": "ghidra_BFC092EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09540", + "label": "ghidra_BFC09540", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09598", + "label": "ghidra_BFC09598", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09720", + "label": "ghidra_BFC09720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09890", + "label": "card_cmd_is_not_read", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x52; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x52 READ). Sibling of 0xBFC0989C." + }, + { + "address": "0xBFC0989C", + "label": "card_cmd_is_not_write_2026_05_09", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x51; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x51 WRITE). Sibling of 0xBFC09890. Discovery missed it because it sits between 0xBFC09898 (end of 0xBFC09890) and 0xBFC098A8 (next discovered fn). Called via JALR at 0xBFC09788 in func_1FC09598 — without this seed, JALR dispatches to unknown, write predicate returns junk via uninitialized v0, BIOS COPY silently no-ops the SIO write protocol (60 misses per copy, no 0x57 ever sent). Earlier bisect (2026-05-05) said this crashed; that was before the predicate-init fix and dispatch-miss class fixes. Retry 2026-05-09." + }, + { + "address": "0xBFC098A8", + "label": "ghidra_BFC098A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09914", + "label": "ghidra_BFC09914", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0994C", + "label": "ghidra_BFC0994C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0996C", + "label": "ghidra_BFC0996C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09CDC", + "label": "ghidra_BFC09CDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09D3C", + "label": "ghidra_BFC09D3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A080", + "label": "ghidra_BFC0A080", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A3D4", + "label": "ghidra_BFC0A3D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A43C", + "label": "ghidra_BFC0A43C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A4B4", + "label": "ghidra_BFC0A4B4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A5E4", + "label": "ghidra_BFC0A5E4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A754", + "label": "ghidra_BFC0A754", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A8BC", + "label": "ghidra_BFC0A8BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AB60", + "label": "ghidra_BFC0AB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AD08", + "label": "ghidra_BFC0AD08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B0C4", + "rationale": "kernel jump-table target: A0:6F (card/dev service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0B0D0", + "label": "ghidra_BFC0B0D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B170", + "label": "ghidra_BFC0B170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B394", + "label": "ghidra_BFC0B394", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B54C", + "label": "ghidra_BFC0B54C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5A0", + "label": "ghidra_BFC0B5A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5F4", + "label": "ghidra_BFC0B5F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B648", + "label": "ghidra_BFC0B648", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0BA8C", + "label": "bios_BA8C", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0BFF0", + "label": "ghidra_BFC0BFF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C048", + "label": "ghidra_BFC0C048", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C0DC", + "label": "ghidra_BFC0C0DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C140", + "label": "ghidra_BFC0C140", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C1DC", + "label": "bios_C1DC", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0C1FC", + "label": "ghidra_BFC0C1FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C220", + "label": "ghidra_BFC0C220", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C248", + "label": "ghidra_BFC0C248", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C270", + "label": "ghidra_BFC0C270", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C298", + "label": "ghidra_BFC0C298", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2C0", + "label": "ghidra_BFC0C2C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2E8", + "label": "ghidra_BFC0C2E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C318", + "label": "ghidra_BFC0C318", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C354", + "label": "ghidra_BFC0C354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C580", + "label": "ghidra_BFC0C580", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C720", + "label": "ghidra_BFC0C720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C830", + "label": "ghidra_BFC0C830", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C890", + "label": "ghidra_BFC0C890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C9CC", + "label": "ghidra_BFC0C9CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CAB4", + "label": "ghidra_BFC0CAB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CC68", + "label": "ghidra_BFC0CC68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CD80", + "label": "ghidra_BFC0CD80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CF84", + "label": "ghidra_BFC0CF84", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D0CC", + "label": "ghidra_BFC0D0CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D11C", + "label": "ghidra_BFC0D11C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D34C", + "label": "ghidra_BFC0D34C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D4CC", + "label": "ghidra_BFC0D4CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D4F0", + "rationale": "kernel jump-table target: A0:B4 (GetSystemInfo-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D570", + "label": "ghidra_BFC0D570", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D600", + "label": "ghidra_BFC0D600", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D640", + "label": "ghidra_BFC0D640", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D664", + "label": "ghidra_BFC0D664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D688", + "label": "ghidra_BFC0D688", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D72C", + "label": "ghidra_BFC0D72C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D7BC", + "label": "ghidra_BFC0D7BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D850", + "label": "ghidra_BFC0D850", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D880", + "label": "ghidra_BFC0D880", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D890", + "label": "ghidra_BFC0D890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8A0", + "label": "ghidra_BFC0D8A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8B0", + "label": "ghidra_BFC0D8B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8C0", + "label": "ghidra_BFC0D8C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8D0", + "label": "ghidra_BFC0D8D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8E0", + "rationale": "kernel jump-table target: A0:40 (SystemErrorUnresolvedException) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8F0", + "rationale": "kernel jump-table target: A0:4F (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D900", + "rationale": "kernel jump-table target: A0:50 (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D910", + "rationale": "kernel jump-table target: A0:52 (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D920", + "rationale": "kernel jump-table target: A0:53 (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D930", + "rationale": "kernel jump-table target: A0:9A (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D940", + "rationale": "kernel jump-table target: A0:9B (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D950", + "label": "ghidra_BFC0D950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D960", + "label": "ghidra_BFC0D960", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D970", + "label": "ghidra_BFC0D970", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D980", + "label": "ghidra_BFC0D980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D990", + "label": "ghidra_BFC0D990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9A0", + "label": "ghidra_BFC0D9A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9B0", + "label": "ghidra_BFC0D9B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9C0", + "label": "ghidra_BFC0D9C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9D0", + "label": "ghidra_BFC0D9D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9E0", + "label": "ghidra_BFC0D9E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9F0", + "label": "ghidra_BFC0D9F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA00", + "label": "ghidra_BFC0DA00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA10", + "label": "ghidra_BFC0DA10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA20", + "label": "ghidra_BFC0DA20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA30", + "label": "ghidra_BFC0DA30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA40", + "label": "ghidra_BFC0DA40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA50", + "label": "ghidra_BFC0DA50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA60", + "label": "ghidra_BFC0DA60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA70", + "label": "jal_BFC0DA70", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA80", + "label": "jal_BFC0DA80", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA90", + "label": "jal_BFC0DA90", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DAA0", + "label": "ghidra_BFC0DAA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAB0", + "label": "ghidra_BFC0DAB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAC0", + "label": "ghidra_BFC0DAC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAD0", + "label": "ghidra_BFC0DAD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAE0", + "label": "ghidra_BFC0DAE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAF0", + "label": "ghidra_BFC0DAF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB00", + "label": "ghidra_BFC0DB00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB10", + "label": "ghidra_BFC0DB10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB20", + "label": "ghidra_BFC0DB20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB30", + "label": "ghidra_BFC0DB30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB40", + "label": "ghidra_BFC0DB40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB50", + "label": "ghidra_BFC0DB50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB60", + "label": "ghidra_BFC0DB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB70", + "label": "ghidra_BFC0DB70", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB80", + "label": "ghidra_BFC0DB80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB90", + "label": "ghidra_BFC0DB90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBA0", + "label": "ghidra_BFC0DBA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBB0", + "label": "ghidra_BFC0DBB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBC0", + "label": "ghidra_BFC0DBC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBD0", + "label": "ghidra_BFC0DBD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBE0", + "label": "ghidra_BFC0DBE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBF0", + "label": "ghidra_BFC0DBF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC00", + "label": "ghidra_BFC0DC00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC10", + "label": "ghidra_BFC0DC10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC20", + "label": "ghidra_BFC0DC20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC30", + "label": "ghidra_BFC0DC30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC40", + "label": "ghidra_BFC0DC40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC50", + "label": "ghidra_BFC0DC50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC10000", + "label": "kernel_trampoline_0", + "rationale": "Trampoline to FileOpen (0x598)" + }, + { + "address": "0xBFC10010", + "label": "kernel_trampoline_1", + "rationale": "Trampoline to FileRead (0x5C4)" + }, + { + "address": "0xBFC10020", + "label": "kernel_trampoline_2", + "rationale": "Trampoline to FileClose (0x5E0)" + }, + { + "address": "0xBFC10030", + "label": "kernel_trampoline_3", + "rationale": "Trampoline to 0x600" + }, + { + "address": "0xBFC10040", + "label": "kernel_memcpy", + "rationale": "ROM-to-RAM and RAM clear routine" + }, + { + "address": "0xBFC10098", + "label": "kernel_bzero", + "rationale": "RAM clear routine (to 0xBFC100BC)" + }, + { + "address": "0xBFC100C4", + "label": "a0_vector_dispatch", + "rationale": "A0 function table dispatch" + }, + { + "address": "0xBFC100E0", + "label": "b0_vector_dispatch", + "rationale": "B0 function table dispatch" + }, + { + "address": "0xBFC10100", + "label": "c0_vector_dispatch", + "rationale": "C0 function table dispatch" + }, + { + "address": "0xBFC10120", + "label": "kernel_get_cause", + "rationale": "mfc0 v0,Cause; jr ra" + }, + { + "address": "0xBFC10130", + "label": "kernel_get_sr", + "rationale": "mfc0 v0,SR; jr ra" + }, + { + "address": "0xBFC10140", + "label": "kernel_set_sr", + "rationale": "mtc0 a0,SR; jr ra" + }, + { + "address": "0xBFC10150", + "label": "kernel_syscall", + "rationale": "syscall; jr ra" + }, + { + "address": "0xBFC1015C", + "label": "kernel_get_c0_table", + "rationale": "Returns C0 table pointer" + }, + { + "address": "0xBFC10168", + "label": "kernel_get_b0_table", + "rationale": "Returns B0 table pointer" + }, + { + "address": "0xBFC10174", + "label": "kernel_BFC10174", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10780", + "label": "rmiss_BFC10780", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC109A0", + "label": "kernel_BFC109A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC109B0", + "label": "kernel_BFC109B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A20", + "label": "kernel_BFC10A20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A2C", + "label": "kernel_BFC10A2C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A40", + "label": "kernel_BFC10A40", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10B30", + "label": "rmiss_BFC10B30", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10BB8", + "label": "kernel_BFC10BB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE0", + "label": "kernel_BFC10BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE4", + "label": "rmiss_BFC10BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10C3C", + "label": "kernel_BFC10C3C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10C74", + "label": "ghidra_BFC10C74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC10F08", + "label": "kernel_BFC10F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F20", + "label": "kernel_BFC10F20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F44", + "label": "kernel_BFC10F44", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11008", + "label": "ghidra_BFC11008", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC110D8", + "label": "kernel_BFC110D8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC110F8", + "label": "kernel_BFC110F8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11114", + "label": "kernel_BFC11114", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111AC", + "label": "kernel_BFC111AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111C4", + "label": "kernel_BFC111C4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111E4", + "label": "kernel_BFC111E4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1121C", + "label": "kernel_BFC1121C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11228", + "label": "kernel_BFC11228", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1125C", + "label": "kernel_BFC1125C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11274", + "label": "kernel_BFC11274", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11294", + "label": "ghidra_BFC11294", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC112F4", + "label": "ghidra_BFC112F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11358", + "label": "ghidra_BFC11358", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC113BC", + "label": "ghidra_BFC113BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11420", + "label": "ghidra_BFC11420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11458", + "label": "ghidra_BFC11458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11490", + "label": "ghidra_BFC11490", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC114C8", + "label": "ghidra_BFC114C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11500", + "label": "ghidra_BFC11500", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11524", + "label": "dmiss_BFC11524", + "rationale": "dispatch miss: KP2 secondary entry point for exception handler, mid-function split of func_00001A00, called during VBlank" + }, + { + "address": "0xBFC1152C", + "label": "rmiss_BFC1152C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11560", + "label": "rmiss_BFC11560", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115E8", + "label": "rmiss_BFC115E8", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115FC", + "label": "rmiss_BFC115FC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11610", + "label": "dmiss_BFC11610", + "rationale": "dispatch miss: KP2 function, tail-call target from 0xBFC11524 exception handler path" + }, + { + "address": "0xBFC11620", + "label": "ghidra_BFC11620", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11644", + "label": "kernel_BFC11644", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1175C", + "label": "kernel_BFC1175C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11800", + "label": "kernel_BFC11800", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11840", + "label": "dmiss_BFC11840", + "rationale": "dispatch miss: KP2 function, indirect call" + }, + { + "address": "0xBFC11870", + "label": "kernel_BFC11870", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1188C", + "label": "ghidra_BFC1188C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1191C", + "label": "kernel_BFC1191C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11944", + "label": "kernel_BFC11944", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11980", + "label": "kernel_BFC11980", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11998", + "label": "kernel_BFC11998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC119C8", + "label": "kernel_BFC119C8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A04", + "label": "kernel_BFC11A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A10", + "label": "kernel_BFC11A10", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A4C", + "label": "kernel_BFC11A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A88", + "label": "kernel_BFC11A88", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11AFC", + "label": "kernel_BFC11AFC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11B18", + "label": "ghidra_BFC11B18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11BA8", + "label": "kernel_BFC11BA8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11BD4", + "label": "kernel_BFC11BD4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C14", + "label": "kernel_BFC11C14", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C24", + "label": "kernel_BFC11C24", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C50", + "label": "kernel_BFC11C50", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C68", + "label": "kernel_BFC11C68", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C8C", + "label": "ghidra_BFC11C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11F58", + "label": "ghidra_BFC11F58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12224", + "label": "kernel_BFC12224", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1228C", + "label": "kernel_BFC1228C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC122A0", + "label": "kernel_BFC122A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC122C0", + "label": "ghidra_BFC122C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12370", + "label": "ghidra_BFC12370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12408", + "label": "ghidra_BFC12408", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12458", + "label": "ghidra_BFC12458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12564", + "label": "ghidra_BFC12564", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12628", + "label": "ghidra_BFC12628", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12794", + "label": "ghidra_BFC12794", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12900", + "label": "ghidra_BFC12900", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12998", + "label": "ghidra_BFC12998", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC129EC", + "label": "kernel_BFC129EC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC129FC", + "label": "ghidra_BFC129FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12AC8", + "label": "ghidra_BFC12AC8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B00", + "label": "ghidra_BFC12B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B60", + "label": "ghidra_BFC12B60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12BC8", + "label": "kernel_BFC12BC8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE0", + "label": "kernel_BFC12BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE4", + "label": "rmiss_BFC12BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC12C08", + "label": "ghidra_BFC12C08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12CE8", + "label": "ghidra_BFC12CE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12EA4", + "label": "kernel_BFC12EA4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12F6C", + "label": "ghidra_BFC12F6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12FB4", + "label": "ghidra_BFC12FB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1302C", + "label": "kernel_BFC1302C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13070", + "label": "ghidra_BFC13070", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC130A4", + "label": "kernel_BFC130A4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC130AC", + "label": "ghidra_BFC130AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13178", + "label": "ghidra_BFC13178", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13244", + "label": "ghidra_BFC13244", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13310", + "label": "ghidra_BFC13310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC133D8", + "label": "ghidra_BFC133D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC134A4", + "label": "ghidra_BFC134A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13570", + "label": "kernel_BFC13570", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC135AC", + "label": "ghidra_BFC135AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1372C", + "label": "kernel_BFC1372C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1376C", + "label": "rmiss_BFC1376C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137B4", + "label": "indirect_BFC137B4", + "rationale": "Reached via indirect dispatch during boot (kernel relocated)" + }, + { + "address": "0xBFC137BC", + "label": "rmiss_BFC137BC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137D0", + "label": "kernel_ram_function", + "rationale": "Dispatch miss at 0xBFC137D0 (phys 0x00003CD0) — 3 misses. Kernel RAM function." + }, + { + "address": "0xBFC137E0", + "label": "ghidra_BFC137E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC138AC", + "label": "kernel_BFC138AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1395C", + "label": "kernel_BFC1395C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13968", + "label": "kernel_BFC13968", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13980", + "label": "ghidra_BFC13980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13A04", + "label": "kernel_BFC13A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13AF0", + "label": "ghidra_BFC13AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B24", + "label": "ghidra_BFC13B24", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B6C", + "label": "ghidra_BFC13B6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C34", + "label": "ghidra_BFC13C34", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C64", + "label": "ghidra_BFC13C64", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E04", + "label": "ghidra_BFC13E04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E60", + "label": "ghidra_BFC13E60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13ED0", + "label": "kernel_BFC13ED0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13EE8", + "label": "ghidra_BFC13EE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13F5C", + "label": "kernel_BFC13F5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13F98", + "label": "ghidra_BFC13F98", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC144BC", + "label": "ghidra_BFC144BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1454C", + "label": "kernel_BFC1454C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14588", + "label": "kernel_BFC14588", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14594", + "label": "kernel_BFC14594", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC145C8", + "label": "ghidra_BFC145C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14670", + "label": "kernel_BFC14670", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14690", + "label": "ghidra_BFC14690", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14710", + "label": "ghidra_BFC14710", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14754", + "label": "kernel_BFC14754", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14764", + "label": "kernel_BFC14764", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14770", + "label": "ghidra_BFC14770", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC147F4", + "label": "ghidra_BFC147F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1483C", + "label": "kernel_BFC1483C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1484C", + "label": "kernel_BFC1484C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14864", + "label": "kernel_BFC14864", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1486C", + "label": "kernel_BFC1486C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14A54", + "label": "dmiss_BFC14A54", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain BUSY-writer at RAM 0x4F54; alias rule RAM=ROM-0xBFC10000+0x500. Reached via JAL inside FUN_bfc147f4; never emitted as standalone entry." + }, + { + "address": "0xBFC14A90", + "label": "ghidra_BFC14A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14B00", + "label": "ghidra_BFC14B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14CF4", + "label": "ghidra_BFC14CF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC15188", + "label": "kernel_BFC15188", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC151E8", + "label": "kernel_56E8", + "rationale": "Kernel function at RAM 0x56E8. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15268", + "label": "kernel_5768", + "rationale": "Kernel function at RAM 0x5768. Cascade from input path seeds." + }, + { + "address": "0xBFC1529C", + "label": "kernel_579C", + "rationale": "Kernel function at RAM 0x579C. Cascade from input path." + }, + { + "address": "0xBFC15334", + "label": "kernel_5834", + "rationale": "Kernel function at RAM 0x5834. Cascade." + }, + { + "address": "0xBFC15370", + "label": "kernel_5870", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC153B4", + "label": "kernel_58B4", + "rationale": "Kernel (CARD driver) function at RAM 0x58B4. Cascade." + }, + { + "address": "0xBFC153E8", + "label": "kernel_58E8", + "rationale": "Kernel (CARD driver) function at RAM 0x58E8. Cascade." + }, + { + "address": "0xBFC15418", + "label": "kernel_5918", + "rationale": "Kernel (CARD driver) leaf function at RAM 0x5918. Cascade." + }, + { + "address": "0xBFC15454", + "label": "kernel_5954", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15490", + "label": "kernel_5990", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC154CC", + "label": "kernel_59CC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15500", + "label": "kernel_5A00", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15508", + "label": "kernel_5A08", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15544", + "label": "kernel_5A44", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15558", + "label": "kernel_5A58", + "rationale": "CARD read chain state 12 (data-byte-store): SIO_RX -> a1[0x7F], XOR-updates checksum at 0x7560+slot*4, returns v0=0. Targeted by jump table at RAM 0x6c98 entry 12." + }, + { + "address": "0xBFC15580", + "label": "kernel_5A80", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155B0", + "label": "kernel_5AB0", + "rationale": "CARD read chain state 13 (data-loop completion): reads byte vs checksum at 0x7560+slot*4, polls SIO_STAT for RX_RDY, reads END byte; v0=1 if 'G' else v0=-1. Targeted by jump table at RAM 0x6c98 entry 13." + }, + { + "address": "0xBFC155BC", + "label": "kernel_5ABC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155F8", + "label": "kernel_5AF8", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15634", + "label": "kernel_5B34", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15650", + "label": "kernel_5B50", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15654", + "label": "kernel_5B54", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15664", + "label": "kernel_BFC15664", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC156A4", + "label": "kernel_5BA4", + "rationale": "Kernel function at RAM 0x5BA4. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15724", + "label": "kernel_5C24", + "rationale": "Kernel function at RAM 0x5C24. Cascade from input path seeds." + }, + { + "address": "0xBFC15758", + "label": "kernel_5C58", + "rationale": "Kernel function at RAM 0x5C58. Cascade." + }, + { + "address": "0xBFC15848", + "label": "kernel_5D48", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC15894", + "label": "kernel_5D94", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15898", + "label": "kernel_5D98", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC158A8", + "label": "ghidra_BFC158A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC158D0", + "label": "dmiss_BFC158D0", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-0 BUSY writer at RAM 0x5DD0; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC158D8", + "label": "dmiss_BFC158D8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-1 BUSY writer at RAM 0x5DD8; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC15930", + "label": "kernel_BFC15930", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15950", + "label": "kernel_BFC15950", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15998", + "label": "kernel_BFC15998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC159F4", + "label": "dmiss_BFC159F4", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x02 OPEN to [0x7568+slot] at RAM 0x5EF4. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry — without this the gate never clears." + }, + { + "address": "0xBFC15A04", + "label": "kernel_BFC15A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15A4C", + "label": "kernel_BFC15A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AA8", + "label": "dmiss_BFC15AA8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x04 OPEN to [0x7568+slot] at RAM 0x5FA8. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry — paired with 0xBFC159F4." + }, + { + "address": "0xBFC15AB8", + "label": "kernel_BFC15AB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AF0", + "label": "kernel_BFC15AF0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B5C", + "label": "kernel_BFC15B5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B70", + "label": "kernel_BFC15B70", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B9C", + "label": "ghidra_BFC15B9C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC15CC4", + "label": "kernel_BFC15CC4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15E90", + "label": "kernel_BFC15E90", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15EBC", + "label": "kernel_BFC15EBC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15F08", + "label": "kernel_BFC15F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15F1C", + "label": "dmiss_BFC15F1C", + "rationale": "dirty_ram hot: SIO/PAD interrupt handler entry point (RAM 0x641C), called via jalr. 10852+ hits/frame across internal branch targets (0x641C, 0x6430, 0x6444, 0x6458, 0x650C, 0x6514, 0x658C, 0x6594). Seeding entry only; CFG discovers internal labels." + }, + { + "address": "0xBFC1609C", + "label": "kernel_BFC1609C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC160E0", + "label": "ktab_BFC160E0", + "rationale": "kernel call table B0:51 target (SCPH5500 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16170", + "label": "ghidra_BFC16170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC16550", + "label": "ktab_BFC16550", + "rationale": "kernel call table B0:52 target (SCPH5500 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16560", + "label": "ktab_BFC16560", + "rationale": "kernel call table B0:5A target (SCPH5500 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16690", + "label": "kernel_BFC16690", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166A0", + "label": "kernel_BFC166A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166B0", + "label": "kernel_BFC166B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166C0", + "label": "kernel_BFC166C0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166D0", + "label": "kernel_BFC166D0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166E0", + "label": "kernel_BFC166E0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166F0", + "label": "kernel_BFC166F0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16700", + "label": "kernel_BFC16700", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16710", + "label": "kernel_BFC16710", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16720", + "label": "kernel_BFC16720", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16730", + "label": "ktab_BFC16730", + "rationale": "kernel call table B0:23 target (SCPH5500 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16740", + "label": "ktab_BFC16740", + "rationale": "kernel call table B0:2A target (SCPH5500 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16750", + "label": "ktab_BFC16750", + "rationale": "kernel call table B0:2B target (SCPH5500 ROM)", + "provenance": "kernel_table" + } + ], + "excluded": [ + { + "address": "0xBFC00100", + "label": "utlb_miss_bev1", + "rationale": "R3000 UTLB-miss vector; PS1 has no TLB; never executed" + } + ] +} diff --git a/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH5501.json b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH5501.json new file mode 100644 index 00000000..20078b5d --- /dev/null +++ b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH5501.json @@ -0,0 +1,2692 @@ +{ + "schema": "psxrecomp phase2 seeds", + "source": "phase2_ghidra_seeds.json filtered vs SCPH5501 ROM (64-byte window); reference ROM sha256 71af94d1e47a68c11e8fdb9f8368040601514a42a5a399cda48c7d3bff1e99d3; target ROM sha256 11052b6499e466bbf0a709b1f9cb6834a9418e66680387912451e971cf8a1fef; kept 534 dropped 569; plus 6 SCPH5501 kernel_table targets", + "seed_count": 540, + "seeds": [ + { + "address": "0xBFC00000", + "label": "reset_vector", + "rationale": "MIPS R3000A reset vector", + "provenance": "vector" + }, + { + "address": "0xBFC00180", + "label": "general_exception_bev1", + "rationale": "BEV=1 general exception vector", + "provenance": "vector" + }, + { + "address": "0xBFC00420", + "label": "ghidra_BFC00420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00678", + "label": "ghidra_BFC00678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006A8", + "label": "ghidra_BFC006A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006D8", + "label": "ghidra_BFC006D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00778", + "label": "ghidra_BFC00778", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00810", + "label": "ghidra_BFC00810", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC008A0", + "label": "ghidra_BFC008A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00944", + "label": "ghidra_BFC00944", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00B7C", + "label": "ghidra_BFC00B7C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00DA0", + "label": "ghidra_BFC00DA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC018E0", + "label": "ghidra_BFC018E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01920", + "label": "ghidra_BFC01920", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0193C", + "label": "cache_flush_continuation", + "rationale": "Jump target of cache-flush jr k0 at BFC01938" + }, + { + "address": "0xBFC01A60", + "label": "ghidra_BFC01A60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01A90", + "label": "ghidra_BFC01A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01ACC", + "label": "ghidra_BFC01ACC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01B08", + "rationale": "kernel jump-table target: A0:29 (bcmp) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC01B80", + "label": "ghidra_BFC01B80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01C8C", + "label": "ghidra_BFC01C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01E24", + "label": "SysInitMemory", + "rationale": "Dispatch miss during boot — kernel init function" + }, + { + "address": "0xBFC01E5C", + "label": "ghidra_BFC01E5C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC020F0", + "label": "ghidra_BFC020F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02104", + "label": "ghidra_BFC02104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC021A0", + "rationale": "kernel jump-table target: A0:37 (rand-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02200", + "label": "jal_BFC02200", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC02230", + "rationale": "kernel jump-table target: A0:30 (rand-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02240", + "label": "ghidra_BFC02240", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0227C", + "label": "ghidra_BFC0227C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC022C0", + "label": "ghidra_BFC022C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02324", + "label": "ghidra_BFC02324", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02590", + "label": "ghidra_BFC02590", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC025B0", + "label": "ghidra_BFC025B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02738", + "label": "ghidra_BFC02738", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02918", + "label": "card_copy_dispatch_miss_2026_05_05", + "rationale": "Runtime dispatch miss: 8 hits during YES/NO COPY confirm execution. BANDAID per user permission." + }, + { + "address": "0xBFC02934", + "rationale": "kernel jump-table target: A0:0F (unresolved (see psx-spx A0 table)) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02950", + "label": "ghidra_BFC02950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02AF0", + "label": "ghidra_BFC02AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B10", + "label": "ghidra_BFC02B10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B50", + "label": "ghidra_BFC02B50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B8C", + "rationale": "kernel jump-table target: A0:2B (memset) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02BC8", + "rationale": "kernel jump-table target: A0:2C (memmove) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02C50", + "rationale": "kernel jump-table target: A0:2D (memcmp) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02CC0", + "label": "ghidra_BFC02CC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02D20", + "label": "ghidra_BFC02D20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02DAC", + "label": "ghidra_BFC02DAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EA0", + "label": "ghidra_BFC02EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EDC", + "label": "ghidra_BFC02EDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02F20", + "label": "ghidra_BFC02F20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03098", + "label": "ghidra_BFC03098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03104", + "label": "ghidra_BFC03104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03190", + "label": "ghidra_BFC03190", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03200", + "rationale": "kernel jump-table target: A0:16 (strncat) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03288", + "label": "ghidra_BFC03288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03310", + "label": "ghidra_BFC03310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC033C8", + "label": "ghidra_BFC033C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03418", + "label": "ghidra_BFC03418", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03494", + "label": "ghidra_BFC03494", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC034D0", + "rationale": "kernel jump-table target: A0:1C (atob helper) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03514", + "rationale": "kernel jump-table target: A0:1D (strtol-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0357C", + "rationale": "kernel jump-table target: A0:1E (strtol-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC035C0", + "rationale": "kernel jump-table target: A0:1F (abs) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03628", + "rationale": "kernel jump-table target: A0:20 (labs) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03694", + "rationale": "kernel jump-table target: A0:21 (atoi) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC036FC", + "rationale": "kernel jump-table target: A0:22 (atol) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03764", + "label": "ghidra_BFC03764", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03894", + "rationale": "kernel jump-table target: A0:24 (strtol-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03910", + "label": "ghidra_BFC03910", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03968", + "label": "ghidra_BFC03968", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03978", + "label": "ghidra_BFC03978", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03990", + "label": "ghidra_BFC03990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC039B0", + "label": "ghidra_BFC039B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03A18", + "label": "ghidra_BFC03A18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03AA4", + "label": "ghidra_BFC03AA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03C90", + "label": "ghidra_BFC03C90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03CF0", + "label": "ghidra_BFC03CF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03D80", + "label": "ghidra_BFC03D80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03EA0", + "label": "ghidra_BFC03EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03F8C", + "label": "ghidra_BFC03F8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FAC", + "label": "ghidra_BFC03FAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FC0", + "label": "jal_BFC03FC0", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC03FE0", + "label": "ghidra_BFC03FE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0403C", + "label": "ghidra_BFC0403C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC040EC", + "label": "ghidra_BFC040EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04120", + "rationale": "kernel jump-table target: A0:4D (ChangeClearRCnt-adjacent) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04138", + "label": "ghidra_BFC04138", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04260", + "label": "ghidra_BFC04260", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042A0", + "label": "ghidra_BFC042A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042D0", + "label": "ghidra_BFC042D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04610", + "label": "ghidra_BFC04610", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04678", + "label": "ghidra_BFC04678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0472C", + "label": "ghidra_BFC0472C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04850", + "label": "dmiss_BFC04850", + "rationale": "Tomba boot dispatch miss after seeding 0xBFC04910. Verified in Ghidra/runtime disassembly as a standalone BIOS callback-list init routine between 0xBFC0472C and 0xBFC048D0, with return at 0xBFC048C8 and table data reference from 0xBFC04588." + }, + { + "address": "0xBFC048D0", + "label": "ghidra_BFC048D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04910", + "label": "dmiss_BFC04910", + "rationale": "Tomba boot dispatch miss after licensed PlayStation screen. Verified in Ghidra/runtime disassembly as a standalone BIOS init routine between 0xBFC048D0 and 0xBFC04ABC, with return at 0xBFC04A98 and table data reference from 0xBFC04554." + }, + { + "address": "0xBFC04AA0", + "rationale": "kernel jump-table target: A0:94 (card-adjacent service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04ABC", + "label": "ghidra_BFC04ABC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04BC4", + "label": "ghidra_BFC04BC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04C38", + "label": "ghidra_BFC04C38", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04D50", + "label": "ghidra_BFC04D50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04DEC", + "label": "ghidra_BFC04DEC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04FBC", + "label": "ghidra_BFC04FBC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0506C", + "label": "ghidra_BFC0506C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050A4", + "label": "ghidra_BFC050A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050DC", + "rationale": "kernel jump-table target: A0:9E (kernel service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC050FC", + "label": "ghidra_BFC050FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05120", + "label": "ghidra_BFC05120", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05194", + "label": "ghidra_BFC05194", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05558", + "label": "ghidra_BFC05558", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC057B0", + "label": "ghidra_BFC057B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0593C", + "label": "ghidra_BFC0593C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05A44", + "label": "ghidra_BFC05A44", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C18", + "label": "ghidra_BFC05C18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C50", + "label": "ghidra_BFC05C50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05D04", + "label": "ghidra_BFC05D04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DB0", + "label": "ghidra_BFC05DB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DF4", + "label": "ghidra_BFC05DF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05E58", + "label": "ghidra_BFC05E58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05F08", + "label": "ghidra_BFC05F08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06010", + "label": "ghidra_BFC06010", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06038", + "label": "ghidra_BFC06038", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC060DC", + "label": "ghidra_BFC060DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0615C", + "label": "ghidra_BFC0615C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061A0", + "label": "ghidra_BFC061A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061D4", + "label": "ghidra_BFC061D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06218", + "label": "ghidra_BFC06218", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06288", + "label": "ghidra_BFC06288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC062CC", + "label": "ghidra_BFC062CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC063CC", + "label": "ghidra_BFC063CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC064D8", + "label": "ghidra_BFC064D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06548", + "label": "ghidra_BFC06548", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC065C0", + "label": "ghidra_BFC065C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0661C", + "label": "ghidra_BFC0661C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06680", + "label": "ghidra_BFC06680", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06700", + "label": "ghidra_BFC06700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06728", + "rationale": "kernel jump-table target: A0:9D (kernel service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06750", + "rationale": "kernel jump-table target: A0:9C (kernel service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06784", + "label": "ghidra_BFC06784", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC067E8", + "label": "ghidra_BFC067E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06CA4", + "label": "ghidra_BFC06CA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06EC4", + "label": "ghidra_BFC06EC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06F28", + "label": "ghidra_BFC06F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FA4", + "label": "ghidra_BFC06FA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FDC", + "label": "indirect_BFC06FDC", + "rationale": "Reached via indirect dispatch during boot" + }, + { + "address": "0xBFC06FF0", + "label": "ghidra_BFC06FF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0703C", + "label": "ghidra_BFC0703C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC070AC", + "label": "ghidra_BFC070AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0711C", + "label": "ghidra_BFC0711C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07148", + "label": "ghidra_BFC07148", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC071A0", + "label": "ghidra_BFC071A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC072B8", + "label": "ghidra_BFC072B8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07330", + "label": "ghidra_BFC07330", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07370", + "label": "ghidra_BFC07370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC073A0", + "label": "ghidra_BFC073A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07410", + "label": "ghidra_BFC07410", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07664", + "label": "ghidra_BFC07664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07700", + "label": "ghidra_BFC07700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC078A4", + "label": "ghidra_BFC078A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC079F8", + "label": "dmiss_BFC079F8", + "rationale": "Tomba boot dispatch miss after game callback coverage fixes. Verified in Ghidra as a tiny BIOS table leaf routine (sw a0,0(sp); jr ra; clear v0) referenced by data at 0xBFC04484 and 0xBFC0E30C." + }, + { + "address": "0xBFC07A04", + "label": "ghidra_BFC07A04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07B88", + "label": "ghidra_BFC07B88", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07C1C", + "label": "ghidra_BFC07C1C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07F28", + "label": "ghidra_BFC07F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08020", + "label": "ghidra_BFC08020", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08098", + "label": "ghidra_BFC08098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC081FC", + "label": "ghidra_BFC081FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08354", + "label": "ghidra_BFC08354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC083CC", + "label": "ghidra_BFC083CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085B0", + "label": "ghidra_BFC085B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085D4", + "label": "ghidra_BFC085D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086B0", + "label": "ghidra_BFC086B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086EC", + "label": "ghidra_BFC086EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08720", + "label": "ghidra_BFC08720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC087C4", + "label": "ghidra_BFC087C4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0884C", + "label": "ghidra_BFC0884C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC088A0", + "label": "ghidra_BFC088A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0895C", + "label": "ghidra_BFC0895C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC089C0", + "label": "ghidra_BFC089C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08B3C", + "label": "ghidra_BFC08B3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08FFC", + "label": "ghidra_BFC08FFC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09144", + "label": "ghidra_BFC09144", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC091CC", + "label": "ghidra_BFC091CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC092EC", + "label": "ghidra_BFC092EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09540", + "label": "ghidra_BFC09540", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09598", + "label": "ghidra_BFC09598", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09720", + "label": "ghidra_BFC09720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09890", + "label": "card_cmd_is_not_read", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x52; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x52 READ). Sibling of 0xBFC0989C." + }, + { + "address": "0xBFC0989C", + "label": "card_cmd_is_not_write_2026_05_09", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x51; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x51 WRITE). Sibling of 0xBFC09890. Discovery missed it because it sits between 0xBFC09898 (end of 0xBFC09890) and 0xBFC098A8 (next discovered fn). Called via JALR at 0xBFC09788 in func_1FC09598 — without this seed, JALR dispatches to unknown, write predicate returns junk via uninitialized v0, BIOS COPY silently no-ops the SIO write protocol (60 misses per copy, no 0x57 ever sent). Earlier bisect (2026-05-05) said this crashed; that was before the predicate-init fix and dispatch-miss class fixes. Retry 2026-05-09." + }, + { + "address": "0xBFC098A8", + "label": "ghidra_BFC098A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09914", + "label": "ghidra_BFC09914", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0994C", + "label": "ghidra_BFC0994C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0996C", + "label": "ghidra_BFC0996C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09CDC", + "label": "ghidra_BFC09CDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09D3C", + "label": "ghidra_BFC09D3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A080", + "label": "ghidra_BFC0A080", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A3D4", + "label": "ghidra_BFC0A3D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A43C", + "label": "ghidra_BFC0A43C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A4B4", + "label": "ghidra_BFC0A4B4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A5E4", + "label": "ghidra_BFC0A5E4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A754", + "label": "ghidra_BFC0A754", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A8BC", + "label": "ghidra_BFC0A8BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AB60", + "label": "ghidra_BFC0AB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AD08", + "label": "ghidra_BFC0AD08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B0C4", + "rationale": "kernel jump-table target: A0:6F (card/dev service) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0B0D0", + "label": "ghidra_BFC0B0D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B170", + "label": "ghidra_BFC0B170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B394", + "label": "ghidra_BFC0B394", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B54C", + "label": "ghidra_BFC0B54C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5A0", + "label": "ghidra_BFC0B5A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5F4", + "label": "ghidra_BFC0B5F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B648", + "label": "ghidra_BFC0B648", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0BA8C", + "label": "bios_BA8C", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0BFF0", + "label": "ghidra_BFC0BFF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C048", + "label": "ghidra_BFC0C048", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C0DC", + "label": "ghidra_BFC0C0DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C140", + "label": "ghidra_BFC0C140", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C1DC", + "label": "bios_C1DC", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0C1FC", + "label": "ghidra_BFC0C1FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C220", + "label": "ghidra_BFC0C220", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C248", + "label": "ghidra_BFC0C248", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C270", + "label": "ghidra_BFC0C270", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C298", + "label": "ghidra_BFC0C298", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2C0", + "label": "ghidra_BFC0C2C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2E8", + "label": "ghidra_BFC0C2E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C318", + "label": "ghidra_BFC0C318", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C354", + "label": "ghidra_BFC0C354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C580", + "label": "ghidra_BFC0C580", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C720", + "label": "ghidra_BFC0C720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C830", + "label": "ghidra_BFC0C830", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C890", + "label": "ghidra_BFC0C890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C9CC", + "label": "ghidra_BFC0C9CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CAB4", + "label": "ghidra_BFC0CAB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CC68", + "label": "ghidra_BFC0CC68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CD80", + "label": "ghidra_BFC0CD80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CF84", + "label": "ghidra_BFC0CF84", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D0CC", + "label": "ghidra_BFC0D0CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D11C", + "label": "ghidra_BFC0D11C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D34C", + "label": "ghidra_BFC0D34C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D4CC", + "label": "ghidra_BFC0D4CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D4F0", + "rationale": "kernel jump-table target: A0:B4 (GetSystemInfo-family) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D570", + "label": "ghidra_BFC0D570", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D600", + "label": "ghidra_BFC0D600", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D640", + "label": "ghidra_BFC0D640", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D664", + "label": "ghidra_BFC0D664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D688", + "label": "ghidra_BFC0D688", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D72C", + "label": "ghidra_BFC0D72C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D7BC", + "label": "ghidra_BFC0D7BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D850", + "label": "ghidra_BFC0D850", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D880", + "label": "ghidra_BFC0D880", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D890", + "label": "ghidra_BFC0D890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8A0", + "label": "ghidra_BFC0D8A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8B0", + "label": "ghidra_BFC0D8B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8C0", + "label": "ghidra_BFC0D8C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8D0", + "label": "ghidra_BFC0D8D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8E0", + "rationale": "kernel jump-table target: A0:40 (SystemErrorUnresolvedException) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8F0", + "rationale": "kernel jump-table target: A0:4F (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D900", + "rationale": "kernel jump-table target: A0:50 (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D910", + "rationale": "kernel jump-table target: A0:52 (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D920", + "rationale": "kernel jump-table target: A0:53 (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D930", + "rationale": "kernel jump-table target: A0:9A (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D940", + "rationale": "kernel jump-table target: A0:9B (stub/ret) — ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D950", + "label": "ghidra_BFC0D950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D960", + "label": "ghidra_BFC0D960", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D970", + "label": "ghidra_BFC0D970", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D980", + "label": "ghidra_BFC0D980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D990", + "label": "ghidra_BFC0D990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9A0", + "label": "ghidra_BFC0D9A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9B0", + "label": "ghidra_BFC0D9B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9C0", + "label": "ghidra_BFC0D9C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9D0", + "label": "ghidra_BFC0D9D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9E0", + "label": "ghidra_BFC0D9E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9F0", + "label": "ghidra_BFC0D9F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA00", + "label": "ghidra_BFC0DA00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA10", + "label": "ghidra_BFC0DA10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA20", + "label": "ghidra_BFC0DA20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA30", + "label": "ghidra_BFC0DA30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA40", + "label": "ghidra_BFC0DA40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA50", + "label": "ghidra_BFC0DA50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA60", + "label": "ghidra_BFC0DA60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA70", + "label": "jal_BFC0DA70", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA80", + "label": "jal_BFC0DA80", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA90", + "label": "jal_BFC0DA90", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DAA0", + "label": "ghidra_BFC0DAA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAB0", + "label": "ghidra_BFC0DAB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAC0", + "label": "ghidra_BFC0DAC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAD0", + "label": "ghidra_BFC0DAD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAE0", + "label": "ghidra_BFC0DAE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAF0", + "label": "ghidra_BFC0DAF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB00", + "label": "ghidra_BFC0DB00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB10", + "label": "ghidra_BFC0DB10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB20", + "label": "ghidra_BFC0DB20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB30", + "label": "ghidra_BFC0DB30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB40", + "label": "ghidra_BFC0DB40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB50", + "label": "ghidra_BFC0DB50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB60", + "label": "ghidra_BFC0DB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB70", + "label": "ghidra_BFC0DB70", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB80", + "label": "ghidra_BFC0DB80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB90", + "label": "ghidra_BFC0DB90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBA0", + "label": "ghidra_BFC0DBA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBB0", + "label": "ghidra_BFC0DBB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBC0", + "label": "ghidra_BFC0DBC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBD0", + "label": "ghidra_BFC0DBD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBE0", + "label": "ghidra_BFC0DBE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBF0", + "label": "ghidra_BFC0DBF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC00", + "label": "ghidra_BFC0DC00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC10", + "label": "ghidra_BFC0DC10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC20", + "label": "ghidra_BFC0DC20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC30", + "label": "ghidra_BFC0DC30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC40", + "label": "ghidra_BFC0DC40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC50", + "label": "ghidra_BFC0DC50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC10000", + "label": "kernel_trampoline_0", + "rationale": "Trampoline to FileOpen (0x598)" + }, + { + "address": "0xBFC10010", + "label": "kernel_trampoline_1", + "rationale": "Trampoline to FileRead (0x5C4)" + }, + { + "address": "0xBFC10020", + "label": "kernel_trampoline_2", + "rationale": "Trampoline to FileClose (0x5E0)" + }, + { + "address": "0xBFC10030", + "label": "kernel_trampoline_3", + "rationale": "Trampoline to 0x600" + }, + { + "address": "0xBFC10040", + "label": "kernel_memcpy", + "rationale": "ROM-to-RAM and RAM clear routine" + }, + { + "address": "0xBFC10098", + "label": "kernel_bzero", + "rationale": "RAM clear routine (to 0xBFC100BC)" + }, + { + "address": "0xBFC100C4", + "label": "a0_vector_dispatch", + "rationale": "A0 function table dispatch" + }, + { + "address": "0xBFC100E0", + "label": "b0_vector_dispatch", + "rationale": "B0 function table dispatch" + }, + { + "address": "0xBFC10100", + "label": "c0_vector_dispatch", + "rationale": "C0 function table dispatch" + }, + { + "address": "0xBFC10120", + "label": "kernel_get_cause", + "rationale": "mfc0 v0,Cause; jr ra" + }, + { + "address": "0xBFC10130", + "label": "kernel_get_sr", + "rationale": "mfc0 v0,SR; jr ra" + }, + { + "address": "0xBFC10140", + "label": "kernel_set_sr", + "rationale": "mtc0 a0,SR; jr ra" + }, + { + "address": "0xBFC10150", + "label": "kernel_syscall", + "rationale": "syscall; jr ra" + }, + { + "address": "0xBFC1015C", + "label": "kernel_get_c0_table", + "rationale": "Returns C0 table pointer" + }, + { + "address": "0xBFC10168", + "label": "kernel_get_b0_table", + "rationale": "Returns B0 table pointer" + }, + { + "address": "0xBFC10174", + "label": "kernel_BFC10174", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10780", + "label": "rmiss_BFC10780", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC109A0", + "label": "kernel_BFC109A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC109B0", + "label": "kernel_BFC109B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A20", + "label": "kernel_BFC10A20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A2C", + "label": "kernel_BFC10A2C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A40", + "label": "kernel_BFC10A40", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10B30", + "label": "rmiss_BFC10B30", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10BB8", + "label": "kernel_BFC10BB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE0", + "label": "kernel_BFC10BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE4", + "label": "rmiss_BFC10BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10C3C", + "label": "kernel_BFC10C3C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10C74", + "label": "ghidra_BFC10C74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC10F08", + "label": "kernel_BFC10F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F20", + "label": "kernel_BFC10F20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F44", + "label": "kernel_BFC10F44", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11008", + "label": "ghidra_BFC11008", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC110D8", + "label": "kernel_BFC110D8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC110F8", + "label": "kernel_BFC110F8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11114", + "label": "kernel_BFC11114", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111AC", + "label": "kernel_BFC111AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111C4", + "label": "kernel_BFC111C4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111E4", + "label": "kernel_BFC111E4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1121C", + "label": "kernel_BFC1121C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11228", + "label": "kernel_BFC11228", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1125C", + "label": "kernel_BFC1125C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11274", + "label": "kernel_BFC11274", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11294", + "label": "ghidra_BFC11294", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC112F4", + "label": "ghidra_BFC112F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11358", + "label": "ghidra_BFC11358", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC113BC", + "label": "ghidra_BFC113BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11420", + "label": "ghidra_BFC11420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11458", + "label": "ghidra_BFC11458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11490", + "label": "ghidra_BFC11490", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC114C8", + "label": "ghidra_BFC114C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11500", + "label": "ghidra_BFC11500", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11524", + "label": "dmiss_BFC11524", + "rationale": "dispatch miss: KP2 secondary entry point for exception handler, mid-function split of func_00001A00, called during VBlank" + }, + { + "address": "0xBFC1152C", + "label": "rmiss_BFC1152C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11560", + "label": "rmiss_BFC11560", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115E8", + "label": "rmiss_BFC115E8", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115FC", + "label": "rmiss_BFC115FC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11610", + "label": "dmiss_BFC11610", + "rationale": "dispatch miss: KP2 function, tail-call target from 0xBFC11524 exception handler path" + }, + { + "address": "0xBFC11620", + "label": "ghidra_BFC11620", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11644", + "label": "kernel_BFC11644", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1175C", + "label": "kernel_BFC1175C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11800", + "label": "kernel_BFC11800", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11840", + "label": "dmiss_BFC11840", + "rationale": "dispatch miss: KP2 function, indirect call" + }, + { + "address": "0xBFC11870", + "label": "kernel_BFC11870", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1188C", + "label": "ghidra_BFC1188C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1191C", + "label": "kernel_BFC1191C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11944", + "label": "kernel_BFC11944", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11980", + "label": "kernel_BFC11980", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11998", + "label": "kernel_BFC11998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC119C8", + "label": "kernel_BFC119C8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A04", + "label": "kernel_BFC11A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A10", + "label": "kernel_BFC11A10", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A4C", + "label": "kernel_BFC11A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A88", + "label": "kernel_BFC11A88", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11AFC", + "label": "kernel_BFC11AFC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11B18", + "label": "ghidra_BFC11B18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11BA8", + "label": "kernel_BFC11BA8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11BD4", + "label": "kernel_BFC11BD4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C14", + "label": "kernel_BFC11C14", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C24", + "label": "kernel_BFC11C24", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C50", + "label": "kernel_BFC11C50", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C68", + "label": "kernel_BFC11C68", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C8C", + "label": "ghidra_BFC11C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11F58", + "label": "ghidra_BFC11F58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12224", + "label": "kernel_BFC12224", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1228C", + "label": "kernel_BFC1228C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC122A0", + "label": "kernel_BFC122A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC122C0", + "label": "ghidra_BFC122C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12370", + "label": "ghidra_BFC12370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12408", + "label": "ghidra_BFC12408", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12458", + "label": "ghidra_BFC12458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12564", + "label": "ghidra_BFC12564", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12628", + "label": "ghidra_BFC12628", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12794", + "label": "ghidra_BFC12794", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12900", + "label": "ghidra_BFC12900", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12998", + "label": "ghidra_BFC12998", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC129EC", + "label": "kernel_BFC129EC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC129FC", + "label": "ghidra_BFC129FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12AC8", + "label": "ghidra_BFC12AC8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B00", + "label": "ghidra_BFC12B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B60", + "label": "ghidra_BFC12B60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12BC8", + "label": "kernel_BFC12BC8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE0", + "label": "kernel_BFC12BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE4", + "label": "rmiss_BFC12BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC12C08", + "label": "ghidra_BFC12C08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12CE8", + "label": "ghidra_BFC12CE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12EA4", + "label": "kernel_BFC12EA4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12F6C", + "label": "ghidra_BFC12F6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12FB4", + "label": "ghidra_BFC12FB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1302C", + "label": "kernel_BFC1302C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13070", + "label": "ghidra_BFC13070", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC130A4", + "label": "kernel_BFC130A4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC130AC", + "label": "ghidra_BFC130AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13178", + "label": "ghidra_BFC13178", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13244", + "label": "ghidra_BFC13244", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13310", + "label": "ghidra_BFC13310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC133D8", + "label": "ghidra_BFC133D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC134A4", + "label": "ghidra_BFC134A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13570", + "label": "kernel_BFC13570", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC135AC", + "label": "ghidra_BFC135AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1372C", + "label": "kernel_BFC1372C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1376C", + "label": "rmiss_BFC1376C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137B4", + "label": "indirect_BFC137B4", + "rationale": "Reached via indirect dispatch during boot (kernel relocated)" + }, + { + "address": "0xBFC137BC", + "label": "rmiss_BFC137BC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137D0", + "label": "kernel_ram_function", + "rationale": "Dispatch miss at 0xBFC137D0 (phys 0x00003CD0) — 3 misses. Kernel RAM function." + }, + { + "address": "0xBFC137E0", + "label": "ghidra_BFC137E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC138AC", + "label": "kernel_BFC138AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1395C", + "label": "kernel_BFC1395C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13968", + "label": "kernel_BFC13968", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13980", + "label": "ghidra_BFC13980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13A04", + "label": "kernel_BFC13A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13AF0", + "label": "ghidra_BFC13AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B24", + "label": "ghidra_BFC13B24", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B6C", + "label": "ghidra_BFC13B6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C34", + "label": "ghidra_BFC13C34", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C64", + "label": "ghidra_BFC13C64", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E04", + "label": "ghidra_BFC13E04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E60", + "label": "ghidra_BFC13E60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13ED0", + "label": "kernel_BFC13ED0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13EE8", + "label": "ghidra_BFC13EE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13F5C", + "label": "kernel_BFC13F5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13F98", + "label": "ghidra_BFC13F98", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC144BC", + "label": "ghidra_BFC144BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1454C", + "label": "kernel_BFC1454C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14588", + "label": "kernel_BFC14588", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14594", + "label": "kernel_BFC14594", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC145C8", + "label": "ghidra_BFC145C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14670", + "label": "kernel_BFC14670", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14690", + "label": "ghidra_BFC14690", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14710", + "label": "ghidra_BFC14710", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14754", + "label": "kernel_BFC14754", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14764", + "label": "kernel_BFC14764", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14770", + "label": "ghidra_BFC14770", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC147F4", + "label": "ghidra_BFC147F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1483C", + "label": "kernel_BFC1483C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1484C", + "label": "kernel_BFC1484C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14864", + "label": "kernel_BFC14864", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1486C", + "label": "kernel_BFC1486C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14A54", + "label": "dmiss_BFC14A54", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain BUSY-writer at RAM 0x4F54; alias rule RAM=ROM-0xBFC10000+0x500. Reached via JAL inside FUN_bfc147f4; never emitted as standalone entry." + }, + { + "address": "0xBFC14A90", + "label": "ghidra_BFC14A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14B00", + "label": "ghidra_BFC14B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14CF4", + "label": "ghidra_BFC14CF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC15188", + "label": "kernel_BFC15188", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC151E8", + "label": "kernel_56E8", + "rationale": "Kernel function at RAM 0x56E8. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15268", + "label": "kernel_5768", + "rationale": "Kernel function at RAM 0x5768. Cascade from input path seeds." + }, + { + "address": "0xBFC1529C", + "label": "kernel_579C", + "rationale": "Kernel function at RAM 0x579C. Cascade from input path." + }, + { + "address": "0xBFC15334", + "label": "kernel_5834", + "rationale": "Kernel function at RAM 0x5834. Cascade." + }, + { + "address": "0xBFC15370", + "label": "kernel_5870", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC153B4", + "label": "kernel_58B4", + "rationale": "Kernel (CARD driver) function at RAM 0x58B4. Cascade." + }, + { + "address": "0xBFC153E8", + "label": "kernel_58E8", + "rationale": "Kernel (CARD driver) function at RAM 0x58E8. Cascade." + }, + { + "address": "0xBFC15418", + "label": "kernel_5918", + "rationale": "Kernel (CARD driver) leaf function at RAM 0x5918. Cascade." + }, + { + "address": "0xBFC15454", + "label": "kernel_5954", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15490", + "label": "kernel_5990", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC154CC", + "label": "kernel_59CC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15500", + "label": "kernel_5A00", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15508", + "label": "kernel_5A08", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15544", + "label": "kernel_5A44", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15558", + "label": "kernel_5A58", + "rationale": "CARD read chain state 12 (data-byte-store): SIO_RX -> a1[0x7F], XOR-updates checksum at 0x7560+slot*4, returns v0=0. Targeted by jump table at RAM 0x6c98 entry 12." + }, + { + "address": "0xBFC15580", + "label": "kernel_5A80", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155B0", + "label": "kernel_5AB0", + "rationale": "CARD read chain state 13 (data-loop completion): reads byte vs checksum at 0x7560+slot*4, polls SIO_STAT for RX_RDY, reads END byte; v0=1 if 'G' else v0=-1. Targeted by jump table at RAM 0x6c98 entry 13." + }, + { + "address": "0xBFC155BC", + "label": "kernel_5ABC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155F8", + "label": "kernel_5AF8", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15634", + "label": "kernel_5B34", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15650", + "label": "kernel_5B50", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15654", + "label": "kernel_5B54", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15664", + "label": "kernel_BFC15664", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC156A4", + "label": "kernel_5BA4", + "rationale": "Kernel function at RAM 0x5BA4. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15724", + "label": "kernel_5C24", + "rationale": "Kernel function at RAM 0x5C24. Cascade from input path seeds." + }, + { + "address": "0xBFC15758", + "label": "kernel_5C58", + "rationale": "Kernel function at RAM 0x5C58. Cascade." + }, + { + "address": "0xBFC15848", + "label": "kernel_5D48", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC15894", + "label": "kernel_5D94", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15898", + "label": "kernel_5D98", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC158A8", + "label": "ghidra_BFC158A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC158D0", + "label": "dmiss_BFC158D0", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-0 BUSY writer at RAM 0x5DD0; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC158D8", + "label": "dmiss_BFC158D8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-1 BUSY writer at RAM 0x5DD8; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC15930", + "label": "kernel_BFC15930", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15950", + "label": "kernel_BFC15950", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15998", + "label": "kernel_BFC15998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC159F4", + "label": "dmiss_BFC159F4", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x02 OPEN to [0x7568+slot] at RAM 0x5EF4. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry — without this the gate never clears." + }, + { + "address": "0xBFC15A04", + "label": "kernel_BFC15A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15A4C", + "label": "kernel_BFC15A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AA8", + "label": "dmiss_BFC15AA8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x04 OPEN to [0x7568+slot] at RAM 0x5FA8. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry — paired with 0xBFC159F4." + }, + { + "address": "0xBFC15AB8", + "label": "kernel_BFC15AB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AF0", + "label": "kernel_BFC15AF0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B5C", + "label": "kernel_BFC15B5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B70", + "label": "kernel_BFC15B70", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B9C", + "label": "ghidra_BFC15B9C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC15CC4", + "label": "kernel_BFC15CC4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15E90", + "label": "kernel_BFC15E90", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15EBC", + "label": "kernel_BFC15EBC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15F08", + "label": "kernel_BFC15F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15F1C", + "label": "dmiss_BFC15F1C", + "rationale": "dirty_ram hot: SIO/PAD interrupt handler entry point (RAM 0x641C), called via jalr. 10852+ hits/frame across internal branch targets (0x641C, 0x6430, 0x6444, 0x6458, 0x650C, 0x6514, 0x658C, 0x6594). Seeding entry only; CFG discovers internal labels." + }, + { + "address": "0xBFC1609C", + "label": "kernel_BFC1609C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC160E0", + "label": "ktab_BFC160E0", + "rationale": "kernel call table B0:51 target (SCPH5501 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16170", + "label": "ghidra_BFC16170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC16550", + "label": "ktab_BFC16550", + "rationale": "kernel call table B0:52 target (SCPH5501 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16560", + "label": "ktab_BFC16560", + "rationale": "kernel call table B0:5A target (SCPH5501 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16690", + "label": "kernel_BFC16690", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166A0", + "label": "kernel_BFC166A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166B0", + "label": "kernel_BFC166B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166C0", + "label": "kernel_BFC166C0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166D0", + "label": "kernel_BFC166D0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166E0", + "label": "kernel_BFC166E0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166F0", + "label": "kernel_BFC166F0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16700", + "label": "kernel_BFC16700", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16710", + "label": "kernel_BFC16710", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16720", + "label": "kernel_BFC16720", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16730", + "label": "ktab_BFC16730", + "rationale": "kernel call table B0:23 target (SCPH5501 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16740", + "label": "ktab_BFC16740", + "rationale": "kernel call table B0:2A target (SCPH5501 ROM)", + "provenance": "kernel_table" + }, + { + "address": "0xBFC16750", + "label": "ktab_BFC16750", + "rationale": "kernel call table B0:2B target (SCPH5501 ROM)", + "provenance": "kernel_table" + } + ], + "excluded": [ + { + "address": "0xBFC00100", + "label": "utlb_miss_bev1", + "rationale": "R3000 UTLB-miss vector; PS1 has no TLB; never executed" + } + ] +} diff --git a/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH5552.json b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH5552.json new file mode 100644 index 00000000..35f7ba8b --- /dev/null +++ b/overlay_toolchain/recompiler/seeds/phase2_ghidra_seeds_SCPH5552.json @@ -0,0 +1,2654 @@ +{ + "schema": "psxrecomp phase2 seeds", + "source": "phase2_ghidra_seeds.json filtered vs SCPH5552 ROM (64-byte window)", + "seed_count": 534, + "seeds": [ + { + "address": "0xBFC00000", + "label": "reset_vector", + "rationale": "MIPS R3000A reset vector" + }, + { + "address": "0xBFC00180", + "label": "general_exception_bev1", + "rationale": "BEV=1 general exception vector" + }, + { + "address": "0xBFC00420", + "label": "ghidra_BFC00420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00678", + "label": "ghidra_BFC00678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006A8", + "label": "ghidra_BFC006A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC006D8", + "label": "ghidra_BFC006D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00778", + "label": "ghidra_BFC00778", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00810", + "label": "ghidra_BFC00810", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC008A0", + "label": "ghidra_BFC008A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00944", + "label": "ghidra_BFC00944", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00B7C", + "label": "ghidra_BFC00B7C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC00DA0", + "label": "ghidra_BFC00DA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC018E0", + "label": "ghidra_BFC018E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01920", + "label": "ghidra_BFC01920", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01A60", + "label": "ghidra_BFC01A60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01A90", + "label": "ghidra_BFC01A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01ACC", + "label": "ghidra_BFC01ACC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01B80", + "label": "ghidra_BFC01B80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01C8C", + "label": "ghidra_BFC01C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC01E5C", + "label": "ghidra_BFC01E5C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC020F0", + "label": "ghidra_BFC020F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02104", + "label": "ghidra_BFC02104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02240", + "label": "ghidra_BFC02240", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0227C", + "label": "ghidra_BFC0227C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC022C0", + "label": "ghidra_BFC022C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02324", + "label": "ghidra_BFC02324", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02590", + "label": "ghidra_BFC02590", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC025B0", + "label": "ghidra_BFC025B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02738", + "label": "ghidra_BFC02738", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02950", + "label": "ghidra_BFC02950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02AF0", + "label": "ghidra_BFC02AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B10", + "label": "ghidra_BFC02B10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02B50", + "label": "ghidra_BFC02B50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02CC0", + "label": "ghidra_BFC02CC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02D20", + "label": "ghidra_BFC02D20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02DAC", + "label": "ghidra_BFC02DAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EA0", + "label": "ghidra_BFC02EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02EDC", + "label": "ghidra_BFC02EDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC02F20", + "label": "ghidra_BFC02F20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03098", + "label": "ghidra_BFC03098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03104", + "label": "ghidra_BFC03104", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03190", + "label": "ghidra_BFC03190", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03288", + "label": "ghidra_BFC03288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03310", + "label": "ghidra_BFC03310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC033C8", + "label": "ghidra_BFC033C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03418", + "label": "ghidra_BFC03418", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03494", + "label": "ghidra_BFC03494", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03764", + "label": "ghidra_BFC03764", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03910", + "label": "ghidra_BFC03910", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03968", + "label": "ghidra_BFC03968", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03978", + "label": "ghidra_BFC03978", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03990", + "label": "ghidra_BFC03990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC039B0", + "label": "ghidra_BFC039B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03A18", + "label": "ghidra_BFC03A18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03AA4", + "label": "ghidra_BFC03AA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03C90", + "label": "ghidra_BFC03C90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03CF0", + "label": "ghidra_BFC03CF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03D80", + "label": "ghidra_BFC03D80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03EA0", + "label": "ghidra_BFC03EA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03F8C", + "label": "ghidra_BFC03F8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FAC", + "label": "ghidra_BFC03FAC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC03FE0", + "label": "ghidra_BFC03FE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0403C", + "label": "ghidra_BFC0403C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC040EC", + "label": "ghidra_BFC040EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04138", + "label": "ghidra_BFC04138", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04260", + "label": "ghidra_BFC04260", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042A0", + "label": "ghidra_BFC042A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC042D0", + "label": "ghidra_BFC042D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04610", + "label": "ghidra_BFC04610", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04678", + "label": "ghidra_BFC04678", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0472C", + "label": "ghidra_BFC0472C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC048D0", + "label": "ghidra_BFC048D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04ABC", + "label": "ghidra_BFC04ABC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04BC4", + "label": "ghidra_BFC04BC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04C38", + "label": "ghidra_BFC04C38", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04D50", + "label": "ghidra_BFC04D50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04DEC", + "label": "ghidra_BFC04DEC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC04FBC", + "label": "ghidra_BFC04FBC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0506C", + "label": "ghidra_BFC0506C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050A4", + "label": "ghidra_BFC050A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC050FC", + "label": "ghidra_BFC050FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05120", + "label": "ghidra_BFC05120", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05194", + "label": "ghidra_BFC05194", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05558", + "label": "ghidra_BFC05558", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC057B0", + "label": "ghidra_BFC057B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0593C", + "label": "ghidra_BFC0593C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05A44", + "label": "ghidra_BFC05A44", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C18", + "label": "ghidra_BFC05C18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05C50", + "label": "ghidra_BFC05C50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05D04", + "label": "ghidra_BFC05D04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DB0", + "label": "ghidra_BFC05DB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05DF4", + "label": "ghidra_BFC05DF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05E58", + "label": "ghidra_BFC05E58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC05F08", + "label": "ghidra_BFC05F08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06010", + "label": "ghidra_BFC06010", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06038", + "label": "ghidra_BFC06038", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC060DC", + "label": "ghidra_BFC060DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0615C", + "label": "ghidra_BFC0615C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061A0", + "label": "ghidra_BFC061A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC061D4", + "label": "ghidra_BFC061D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06218", + "label": "ghidra_BFC06218", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06288", + "label": "ghidra_BFC06288", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC062CC", + "label": "ghidra_BFC062CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC063CC", + "label": "ghidra_BFC063CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC064D8", + "label": "ghidra_BFC064D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06548", + "label": "ghidra_BFC06548", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC065C0", + "label": "ghidra_BFC065C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0661C", + "label": "ghidra_BFC0661C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06680", + "label": "ghidra_BFC06680", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06700", + "label": "ghidra_BFC06700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06784", + "label": "ghidra_BFC06784", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC067E8", + "label": "ghidra_BFC067E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06CA4", + "label": "ghidra_BFC06CA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06EC4", + "label": "ghidra_BFC06EC4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06F28", + "label": "ghidra_BFC06F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FA4", + "label": "ghidra_BFC06FA4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC06FF0", + "label": "ghidra_BFC06FF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0703C", + "label": "ghidra_BFC0703C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC070AC", + "label": "ghidra_BFC070AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0711C", + "label": "ghidra_BFC0711C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07148", + "label": "ghidra_BFC07148", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC071A0", + "label": "ghidra_BFC071A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC072B8", + "label": "ghidra_BFC072B8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07330", + "label": "ghidra_BFC07330", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07370", + "label": "ghidra_BFC07370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC073A0", + "label": "ghidra_BFC073A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07410", + "label": "ghidra_BFC07410", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07664", + "label": "ghidra_BFC07664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07700", + "label": "ghidra_BFC07700", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC078A4", + "label": "ghidra_BFC078A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07A04", + "label": "ghidra_BFC07A04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07B88", + "label": "ghidra_BFC07B88", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07C1C", + "label": "ghidra_BFC07C1C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC07F28", + "label": "ghidra_BFC07F28", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08020", + "label": "ghidra_BFC08020", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08098", + "label": "ghidra_BFC08098", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC081FC", + "label": "ghidra_BFC081FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08354", + "label": "ghidra_BFC08354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC083CC", + "label": "ghidra_BFC083CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085B0", + "label": "ghidra_BFC085B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC085D4", + "label": "ghidra_BFC085D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086B0", + "label": "ghidra_BFC086B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC086EC", + "label": "ghidra_BFC086EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08720", + "label": "ghidra_BFC08720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC087C4", + "label": "ghidra_BFC087C4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0884C", + "label": "ghidra_BFC0884C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC088A0", + "label": "ghidra_BFC088A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0895C", + "label": "ghidra_BFC0895C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC089C0", + "label": "ghidra_BFC089C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08B3C", + "label": "ghidra_BFC08B3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC08FFC", + "label": "ghidra_BFC08FFC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09144", + "label": "ghidra_BFC09144", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC091CC", + "label": "ghidra_BFC091CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC092EC", + "label": "ghidra_BFC092EC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09540", + "label": "ghidra_BFC09540", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09598", + "label": "ghidra_BFC09598", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09720", + "label": "ghidra_BFC09720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC098A8", + "label": "ghidra_BFC098A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09914", + "label": "ghidra_BFC09914", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0994C", + "label": "ghidra_BFC0994C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0996C", + "label": "ghidra_BFC0996C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09CDC", + "label": "ghidra_BFC09CDC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC09D3C", + "label": "ghidra_BFC09D3C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A080", + "label": "ghidra_BFC0A080", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A3D4", + "label": "ghidra_BFC0A3D4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A43C", + "label": "ghidra_BFC0A43C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A4B4", + "label": "ghidra_BFC0A4B4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A5E4", + "label": "ghidra_BFC0A5E4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A754", + "label": "ghidra_BFC0A754", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0A8BC", + "label": "ghidra_BFC0A8BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AB60", + "label": "ghidra_BFC0AB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0AD08", + "label": "ghidra_BFC0AD08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B0D0", + "label": "ghidra_BFC0B0D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B170", + "label": "ghidra_BFC0B170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B394", + "label": "ghidra_BFC0B394", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B54C", + "label": "ghidra_BFC0B54C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5A0", + "label": "ghidra_BFC0B5A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B5F4", + "label": "ghidra_BFC0B5F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0B648", + "label": "ghidra_BFC0B648", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0BFF0", + "label": "ghidra_BFC0BFF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C048", + "label": "ghidra_BFC0C048", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C0DC", + "label": "ghidra_BFC0C0DC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C140", + "label": "ghidra_BFC0C140", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C1FC", + "label": "ghidra_BFC0C1FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C220", + "label": "ghidra_BFC0C220", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C248", + "label": "ghidra_BFC0C248", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C270", + "label": "ghidra_BFC0C270", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C298", + "label": "ghidra_BFC0C298", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2C0", + "label": "ghidra_BFC0C2C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C2E8", + "label": "ghidra_BFC0C2E8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C318", + "label": "ghidra_BFC0C318", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C354", + "label": "ghidra_BFC0C354", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C580", + "label": "ghidra_BFC0C580", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C720", + "label": "ghidra_BFC0C720", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C830", + "label": "ghidra_BFC0C830", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C890", + "label": "ghidra_BFC0C890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0C9CC", + "label": "ghidra_BFC0C9CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CAB4", + "label": "ghidra_BFC0CAB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CC68", + "label": "ghidra_BFC0CC68", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CD80", + "label": "ghidra_BFC0CD80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0CF84", + "label": "ghidra_BFC0CF84", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D0CC", + "label": "ghidra_BFC0D0CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D11C", + "label": "ghidra_BFC0D11C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D34C", + "label": "ghidra_BFC0D34C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D4CC", + "label": "ghidra_BFC0D4CC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D570", + "label": "ghidra_BFC0D570", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D600", + "label": "ghidra_BFC0D600", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D640", + "label": "ghidra_BFC0D640", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D664", + "label": "ghidra_BFC0D664", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D688", + "label": "ghidra_BFC0D688", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D72C", + "label": "ghidra_BFC0D72C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D7BC", + "label": "ghidra_BFC0D7BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D850", + "label": "ghidra_BFC0D850", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D880", + "label": "ghidra_BFC0D880", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D890", + "label": "ghidra_BFC0D890", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8A0", + "label": "ghidra_BFC0D8A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8B0", + "label": "ghidra_BFC0D8B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8C0", + "label": "ghidra_BFC0D8C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D8D0", + "label": "ghidra_BFC0D8D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D950", + "label": "ghidra_BFC0D950", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D960", + "label": "ghidra_BFC0D960", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D970", + "label": "ghidra_BFC0D970", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D980", + "label": "ghidra_BFC0D980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D990", + "label": "ghidra_BFC0D990", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9A0", + "label": "ghidra_BFC0D9A0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9B0", + "label": "ghidra_BFC0D9B0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9C0", + "label": "ghidra_BFC0D9C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9D0", + "label": "ghidra_BFC0D9D0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9E0", + "label": "ghidra_BFC0D9E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0D9F0", + "label": "ghidra_BFC0D9F0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA00", + "label": "ghidra_BFC0DA00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA10", + "label": "ghidra_BFC0DA10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA20", + "label": "ghidra_BFC0DA20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA30", + "label": "ghidra_BFC0DA30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA40", + "label": "ghidra_BFC0DA40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA50", + "label": "ghidra_BFC0DA50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DA60", + "label": "ghidra_BFC0DA60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAA0", + "label": "ghidra_BFC0DAA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAB0", + "label": "ghidra_BFC0DAB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAC0", + "label": "ghidra_BFC0DAC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAD0", + "label": "ghidra_BFC0DAD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAE0", + "label": "ghidra_BFC0DAE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DAF0", + "label": "ghidra_BFC0DAF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB00", + "label": "ghidra_BFC0DB00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB10", + "label": "ghidra_BFC0DB10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB20", + "label": "ghidra_BFC0DB20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB30", + "label": "ghidra_BFC0DB30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB40", + "label": "ghidra_BFC0DB40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB50", + "label": "ghidra_BFC0DB50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB60", + "label": "ghidra_BFC0DB60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB70", + "label": "ghidra_BFC0DB70", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB80", + "label": "ghidra_BFC0DB80", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DB90", + "label": "ghidra_BFC0DB90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBA0", + "label": "ghidra_BFC0DBA0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBB0", + "label": "ghidra_BFC0DBB0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBC0", + "label": "ghidra_BFC0DBC0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBD0", + "label": "ghidra_BFC0DBD0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBE0", + "label": "ghidra_BFC0DBE0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DBF0", + "label": "ghidra_BFC0DBF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC00", + "label": "ghidra_BFC0DC00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC10", + "label": "ghidra_BFC0DC10", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC20", + "label": "ghidra_BFC0DC20", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC30", + "label": "ghidra_BFC0DC30", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC40", + "label": "ghidra_BFC0DC40", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC0DC50", + "label": "ghidra_BFC0DC50", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC10C74", + "label": "ghidra_BFC10C74", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11008", + "label": "ghidra_BFC11008", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11294", + "label": "ghidra_BFC11294", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC112F4", + "label": "ghidra_BFC112F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11358", + "label": "ghidra_BFC11358", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC113BC", + "label": "ghidra_BFC113BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11420", + "label": "ghidra_BFC11420", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11458", + "label": "ghidra_BFC11458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11490", + "label": "ghidra_BFC11490", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC114C8", + "label": "ghidra_BFC114C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11500", + "label": "ghidra_BFC11500", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11620", + "label": "ghidra_BFC11620", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC1188C", + "label": "ghidra_BFC1188C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11B18", + "label": "ghidra_BFC11B18", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11C8C", + "label": "ghidra_BFC11C8C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11F58", + "label": "ghidra_BFC11F58", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC122C0", + "label": "ghidra_BFC122C0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12370", + "label": "ghidra_BFC12370", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12408", + "label": "ghidra_BFC12408", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12458", + "label": "ghidra_BFC12458", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12564", + "label": "ghidra_BFC12564", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12628", + "label": "ghidra_BFC12628", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12794", + "label": "ghidra_BFC12794", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12900", + "label": "ghidra_BFC12900", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12998", + "label": "ghidra_BFC12998", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC129FC", + "label": "ghidra_BFC129FC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12AC8", + "label": "ghidra_BFC12AC8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B00", + "label": "ghidra_BFC12B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12B60", + "label": "ghidra_BFC12B60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12C08", + "label": "ghidra_BFC12C08", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12CE8", + "label": "ghidra_BFC12CE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12F6C", + "label": "ghidra_BFC12F6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC12FB4", + "label": "ghidra_BFC12FB4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13070", + "label": "ghidra_BFC13070", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC130AC", + "label": "ghidra_BFC130AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13178", + "label": "ghidra_BFC13178", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13244", + "label": "ghidra_BFC13244", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13310", + "label": "ghidra_BFC13310", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC133D8", + "label": "ghidra_BFC133D8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC134A4", + "label": "ghidra_BFC134A4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC135AC", + "label": "ghidra_BFC135AC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC137E0", + "label": "ghidra_BFC137E0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13980", + "label": "ghidra_BFC13980", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13AF0", + "label": "ghidra_BFC13AF0", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B24", + "label": "ghidra_BFC13B24", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13B6C", + "label": "ghidra_BFC13B6C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C34", + "label": "ghidra_BFC13C34", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13C64", + "label": "ghidra_BFC13C64", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E04", + "label": "ghidra_BFC13E04", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13E60", + "label": "ghidra_BFC13E60", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13EE8", + "label": "ghidra_BFC13EE8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC13F98", + "label": "ghidra_BFC13F98", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC144BC", + "label": "ghidra_BFC144BC", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC145C8", + "label": "ghidra_BFC145C8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14690", + "label": "ghidra_BFC14690", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14710", + "label": "ghidra_BFC14710", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14770", + "label": "ghidra_BFC14770", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC147F4", + "label": "ghidra_BFC147F4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14A90", + "label": "ghidra_BFC14A90", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14B00", + "label": "ghidra_BFC14B00", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC14CF4", + "label": "ghidra_BFC14CF4", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC158A8", + "label": "ghidra_BFC158A8", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC15B9C", + "label": "ghidra_BFC15B9C", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC16170", + "label": "ghidra_BFC16170", + "rationale": "Ghidra function start" + }, + { + "address": "0xBFC11840", + "label": "dmiss_BFC11840", + "rationale": "dispatch miss: KP2 function, indirect call" + }, + { + "address": "0xBFC11524", + "label": "dmiss_BFC11524", + "rationale": "dispatch miss: KP2 secondary entry point for exception handler, mid-function split of func_00001A00, called during VBlank" + }, + { + "address": "0xBFC11610", + "label": "dmiss_BFC11610", + "rationale": "dispatch miss: KP2 function, tail-call target from 0xBFC11524 exception handler path" + }, + { + "address": "0xBFC14A54", + "label": "dmiss_BFC14A54", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain BUSY-writer at RAM 0x4F54; alias rule RAM=ROM-0xBFC10000+0x500. Reached via JAL inside FUN_bfc147f4; never emitted as standalone entry." + }, + { + "address": "0xBFC158D0", + "label": "dmiss_BFC158D0", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-0 BUSY writer at RAM 0x5DD0; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC158D8", + "label": "dmiss_BFC158D8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain init slot-1 BUSY writer at RAM 0x5DD8; alias RAM=ROM-0xBFC10000+0x500. Inside FUN_bfc158a8 body." + }, + { + "address": "0xBFC159F4", + "label": "dmiss_BFC159F4", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x02 OPEN to [0x7568+slot] at RAM 0x5EF4. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry \u00e2\u20ac\u201d without this the gate never clears." + }, + { + "address": "0xBFC15AA8", + "label": "dmiss_BFC15AA8", + "rationale": "dispatch miss (Beetle wtrace, docs/CASE_A_AOT_GAP.md): chain step handler that writes 0x04 OPEN to [0x7568+slot] at RAM 0x5FA8. Indirect-jr target from RAM 0x6c98 jump table; alias RAM=ROM-0xBFC10000+0x500. KEY entry \u00e2\u20ac\u201d paired with 0xBFC159F4." + }, + { + "address": "0xBFC04910", + "label": "dmiss_BFC04910", + "rationale": "Tomba boot dispatch miss after licensed PlayStation screen. Verified in Ghidra/runtime disassembly as a standalone BIOS init routine between 0xBFC048D0 and 0xBFC04ABC, with return at 0xBFC04A98 and table data reference from 0xBFC04554." + }, + { + "address": "0xBFC04850", + "label": "dmiss_BFC04850", + "rationale": "Tomba boot dispatch miss after seeding 0xBFC04910. Verified in Ghidra/runtime disassembly as a standalone BIOS callback-list init routine between 0xBFC0472C and 0xBFC048D0, with return at 0xBFC048C8 and table data reference from 0xBFC04588." + }, + { + "address": "0xBFC079F8", + "label": "dmiss_BFC079F8", + "rationale": "Tomba boot dispatch miss after game callback coverage fixes. Verified in Ghidra as a tiny BIOS table leaf routine (sw a0,0(sp); jr ra; clear v0) referenced by data at 0xBFC04484 and 0xBFC0E30C." + }, + { + "address": "0xBFC15F1C", + "label": "dmiss_BFC15F1C", + "rationale": "dirty_ram hot: SIO/PAD interrupt handler entry point (RAM 0x641C), called via jalr. 10852+ hits/frame across internal branch targets (0x641C, 0x6430, 0x6444, 0x6458, 0x650C, 0x6514, 0x658C, 0x6594). Seeding entry only; CFG discovers internal labels." + }, + { + "address": "0xBFC0193C", + "label": "cache_flush_continuation", + "rationale": "Jump target of cache-flush jr k0 at BFC01938" + }, + { + "address": "0xBFC01E24", + "label": "SysInitMemory", + "rationale": "Dispatch miss during boot \u00e2\u20ac\u201d kernel init function" + }, + { + "address": "0xBFC02200", + "label": "jal_BFC02200", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC02918", + "label": "card_copy_dispatch_miss_2026_05_05", + "rationale": "Runtime dispatch miss: 8 hits during YES/NO COPY confirm execution. BANDAID per user permission." + }, + { + "address": "0xBFC03FC0", + "label": "jal_BFC03FC0", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC06FDC", + "label": "indirect_BFC06FDC", + "rationale": "Reached via indirect dispatch during boot" + }, + { + "address": "0xBFC09890", + "label": "card_cmd_is_not_read", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x52; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x52 READ). Sibling of 0xBFC0989C." + }, + { + "address": "0xBFC0989C", + "label": "card_cmd_is_not_write_2026_05_09", + "rationale": "3-instruction predicate function: xori $v0,$a0,0x51; jr $ra; sltu $v0,$0,$v0. Returns ($a0 != 0x51 WRITE). Sibling of 0xBFC09890. Discovery missed it because it sits between 0xBFC09898 (end of 0xBFC09890) and 0xBFC098A8 (next discovered fn). Called via JALR at 0xBFC09788 in func_1FC09598 \u00e2\u20ac\u201d without this seed, JALR dispatches to unknown, write predicate returns junk via uninitialized v0, BIOS COPY silently no-ops the SIO write protocol (60 misses per copy, no 0x57 ever sent). Earlier bisect (2026-05-05) said this crashed; that was before the predicate-init fix and dispatch-miss class fixes. Retry 2026-05-09." + }, + { + "address": "0xBFC0BA8C", + "label": "bios_BA8C", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0C1DC", + "label": "bios_C1DC", + "rationale": "BIOS boot code function. Dispatch miss from shell input path." + }, + { + "address": "0xBFC0DA70", + "label": "jal_BFC0DA70", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA80", + "label": "jal_BFC0DA80", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC0DA90", + "label": "jal_BFC0DA90", + "rationale": "JAL target from code region" + }, + { + "address": "0xBFC10000", + "label": "kernel_trampoline_0", + "rationale": "Trampoline to FileOpen (0x598)" + }, + { + "address": "0xBFC10010", + "label": "kernel_trampoline_1", + "rationale": "Trampoline to FileRead (0x5C4)" + }, + { + "address": "0xBFC10020", + "label": "kernel_trampoline_2", + "rationale": "Trampoline to FileClose (0x5E0)" + }, + { + "address": "0xBFC10030", + "label": "kernel_trampoline_3", + "rationale": "Trampoline to 0x600" + }, + { + "address": "0xBFC10040", + "label": "kernel_memcpy", + "rationale": "ROM-to-RAM and RAM clear routine" + }, + { + "address": "0xBFC10098", + "label": "kernel_bzero", + "rationale": "RAM clear routine (to 0xBFC100BC)" + }, + { + "address": "0xBFC100C4", + "label": "a0_vector_dispatch", + "rationale": "A0 function table dispatch" + }, + { + "address": "0xBFC100E0", + "label": "b0_vector_dispatch", + "rationale": "B0 function table dispatch" + }, + { + "address": "0xBFC10100", + "label": "c0_vector_dispatch", + "rationale": "C0 function table dispatch" + }, + { + "address": "0xBFC10120", + "label": "kernel_get_cause", + "rationale": "mfc0 v0,Cause; jr ra" + }, + { + "address": "0xBFC10130", + "label": "kernel_get_sr", + "rationale": "mfc0 v0,SR; jr ra" + }, + { + "address": "0xBFC10140", + "label": "kernel_set_sr", + "rationale": "mtc0 a0,SR; jr ra" + }, + { + "address": "0xBFC10150", + "label": "kernel_syscall", + "rationale": "syscall; jr ra" + }, + { + "address": "0xBFC1015C", + "label": "kernel_get_c0_table", + "rationale": "Returns C0 table pointer" + }, + { + "address": "0xBFC10168", + "label": "kernel_get_b0_table", + "rationale": "Returns B0 table pointer" + }, + { + "address": "0xBFC10174", + "label": "kernel_BFC10174", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10780", + "label": "rmiss_BFC10780", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC109A0", + "label": "kernel_BFC109A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC109B0", + "label": "kernel_BFC109B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A20", + "label": "kernel_BFC10A20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A2C", + "label": "kernel_BFC10A2C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10A40", + "label": "kernel_BFC10A40", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10B30", + "label": "rmiss_BFC10B30", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10BB8", + "label": "kernel_BFC10BB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE0", + "label": "kernel_BFC10BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10BE4", + "label": "rmiss_BFC10BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC10C3C", + "label": "kernel_BFC10C3C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F08", + "label": "kernel_BFC10F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F20", + "label": "kernel_BFC10F20", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC10F44", + "label": "kernel_BFC10F44", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC110D8", + "label": "kernel_BFC110D8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC110F8", + "label": "kernel_BFC110F8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11114", + "label": "kernel_BFC11114", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111AC", + "label": "kernel_BFC111AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111C4", + "label": "kernel_BFC111C4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC111E4", + "label": "kernel_BFC111E4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1121C", + "label": "kernel_BFC1121C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11228", + "label": "kernel_BFC11228", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1125C", + "label": "kernel_BFC1125C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11274", + "label": "kernel_BFC11274", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1152C", + "label": "rmiss_BFC1152C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11560", + "label": "rmiss_BFC11560", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115E8", + "label": "rmiss_BFC115E8", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC115FC", + "label": "rmiss_BFC115FC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC11644", + "label": "kernel_BFC11644", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1175C", + "label": "kernel_BFC1175C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11800", + "label": "kernel_BFC11800", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11870", + "label": "kernel_BFC11870", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1191C", + "label": "kernel_BFC1191C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11944", + "label": "kernel_BFC11944", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11980", + "label": "kernel_BFC11980", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11998", + "label": "kernel_BFC11998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC119C8", + "label": "kernel_BFC119C8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A04", + "label": "kernel_BFC11A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A10", + "label": "kernel_BFC11A10", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A4C", + "label": "kernel_BFC11A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11A88", + "label": "kernel_BFC11A88", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11AFC", + "label": "kernel_BFC11AFC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11BA8", + "label": "kernel_BFC11BA8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11BD4", + "label": "kernel_BFC11BD4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C14", + "label": "kernel_BFC11C14", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C24", + "label": "kernel_BFC11C24", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C50", + "label": "kernel_BFC11C50", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC11C68", + "label": "kernel_BFC11C68", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12224", + "label": "kernel_BFC12224", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1228C", + "label": "kernel_BFC1228C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC122A0", + "label": "kernel_BFC122A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC129EC", + "label": "kernel_BFC129EC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BC8", + "label": "kernel_BFC12BC8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE0", + "label": "kernel_BFC12BE0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC12BE4", + "label": "rmiss_BFC12BE4", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC12EA4", + "label": "kernel_BFC12EA4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1302C", + "label": "kernel_BFC1302C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC130A4", + "label": "kernel_BFC130A4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13570", + "label": "kernel_BFC13570", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1372C", + "label": "kernel_BFC1372C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1376C", + "label": "rmiss_BFC1376C", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137B4", + "label": "indirect_BFC137B4", + "rationale": "Reached via indirect dispatch during boot (kernel relocated)" + }, + { + "address": "0xBFC137BC", + "label": "rmiss_BFC137BC", + "rationale": "runtime dispatch miss" + }, + { + "address": "0xBFC137D0", + "label": "kernel_ram_function", + "rationale": "Dispatch miss at 0xBFC137D0 (phys 0x00003CD0) \u00e2\u20ac\u201d 3 misses. Kernel RAM function." + }, + { + "address": "0xBFC138AC", + "label": "kernel_BFC138AC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1395C", + "label": "kernel_BFC1395C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13968", + "label": "kernel_BFC13968", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13A04", + "label": "kernel_BFC13A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13ED0", + "label": "kernel_BFC13ED0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC13F5C", + "label": "kernel_BFC13F5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1454C", + "label": "kernel_BFC1454C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14588", + "label": "kernel_BFC14588", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14594", + "label": "kernel_BFC14594", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14670", + "label": "kernel_BFC14670", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14754", + "label": "kernel_BFC14754", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14764", + "label": "kernel_BFC14764", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1483C", + "label": "kernel_BFC1483C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1484C", + "label": "kernel_BFC1484C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC14864", + "label": "kernel_BFC14864", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1486C", + "label": "kernel_BFC1486C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15188", + "label": "kernel_BFC15188", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC151E8", + "label": "kernel_56E8", + "rationale": "Kernel function at RAM 0x56E8. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15268", + "label": "kernel_5768", + "rationale": "Kernel function at RAM 0x5768. Cascade from input path seeds." + }, + { + "address": "0xBFC1529C", + "label": "kernel_579C", + "rationale": "Kernel function at RAM 0x579C. Cascade from input path." + }, + { + "address": "0xBFC15334", + "label": "kernel_5834", + "rationale": "Kernel function at RAM 0x5834. Cascade." + }, + { + "address": "0xBFC15370", + "label": "kernel_5870", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC153B4", + "label": "kernel_58B4", + "rationale": "Kernel (CARD driver) function at RAM 0x58B4. Cascade." + }, + { + "address": "0xBFC153E8", + "label": "kernel_58E8", + "rationale": "Kernel (CARD driver) function at RAM 0x58E8. Cascade." + }, + { + "address": "0xBFC15418", + "label": "kernel_5918", + "rationale": "Kernel (CARD driver) leaf function at RAM 0x5918. Cascade." + }, + { + "address": "0xBFC15454", + "label": "kernel_5954", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15490", + "label": "kernel_5990", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC154CC", + "label": "kernel_59CC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15500", + "label": "kernel_5A00", + "rationale": "CARD driver cascade." + }, + { + "address": "0xBFC15508", + "label": "kernel_5A08", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15544", + "label": "kernel_5A44", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15558", + "label": "kernel_5A58", + "rationale": "CARD read chain state 12 (data-byte-store): SIO_RX -> a1[0x7F], XOR-updates checksum at 0x7560+slot*4, returns v0=0. Targeted by jump table at RAM 0x6c98 entry 12." + }, + { + "address": "0xBFC15580", + "label": "kernel_5A80", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155B0", + "label": "kernel_5AB0", + "rationale": "CARD read chain state 13 (data-loop completion): reads byte vs checksum at 0x7560+slot*4, polls SIO_STAT for RX_RDY, reads END byte; v0=1 if 'G' else v0=-1. Targeted by jump table at RAM 0x6c98 entry 13." + }, + { + "address": "0xBFC155BC", + "label": "kernel_5ABC", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC155F8", + "label": "kernel_5AF8", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15634", + "label": "kernel_5B34", + "rationale": "CARD driver cascade (predicted)." + }, + { + "address": "0xBFC15650", + "label": "kernel_5B50", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15654", + "label": "kernel_5B54", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15664", + "label": "kernel_BFC15664", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC156A4", + "label": "kernel_5BA4", + "rationale": "Kernel function at RAM 0x5BA4. Dispatch miss from shell input path." + }, + { + "address": "0xBFC15724", + "label": "kernel_5C24", + "rationale": "Kernel function at RAM 0x5C24. Cascade from input path seeds." + }, + { + "address": "0xBFC15758", + "label": "kernel_5C58", + "rationale": "Kernel function at RAM 0x5C58. Cascade." + }, + { + "address": "0xBFC15848", + "label": "kernel_5D48", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC15894", + "label": "kernel_5D94", + "rationale": "Kernel function. Cascade from input path." + }, + { + "address": "0xBFC15898", + "label": "kernel_5D98", + "rationale": "Kernel (CARD driver) function. Cascade." + }, + { + "address": "0xBFC15930", + "label": "kernel_BFC15930", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15950", + "label": "kernel_BFC15950", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15998", + "label": "kernel_BFC15998", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15A04", + "label": "kernel_BFC15A04", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15A4C", + "label": "kernel_BFC15A4C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AB8", + "label": "kernel_BFC15AB8", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15AF0", + "label": "kernel_BFC15AF0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B5C", + "label": "kernel_BFC15B5C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15B70", + "label": "kernel_BFC15B70", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15CC4", + "label": "kernel_BFC15CC4", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15E90", + "label": "kernel_BFC15E90", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15EBC", + "label": "kernel_BFC15EBC", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC15F08", + "label": "kernel_BFC15F08", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC1609C", + "label": "kernel_BFC1609C", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16690", + "label": "kernel_BFC16690", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166A0", + "label": "kernel_BFC166A0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166B0", + "label": "kernel_BFC166B0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166C0", + "label": "kernel_BFC166C0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166D0", + "label": "kernel_BFC166D0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166E0", + "label": "kernel_BFC166E0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC166F0", + "label": "kernel_BFC166F0", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16700", + "label": "kernel_BFC16700", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16710", + "label": "kernel_BFC16710", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC16720", + "label": "kernel_BFC16720", + "rationale": "Kernel ROM function (auto-discovered from tables/boundaries)" + }, + { + "address": "0xBFC02934", + "rationale": "kernel jump-table target: A0:0F (unresolved (see psx-spx A0 table)) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03200", + "rationale": "kernel jump-table target: A0:16 (strncat) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC034D0", + "rationale": "kernel jump-table target: A0:1C (atob helper) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03514", + "rationale": "kernel jump-table target: A0:1D (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0357C", + "rationale": "kernel jump-table target: A0:1E (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC035C0", + "rationale": "kernel jump-table target: A0:1F (abs) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03628", + "rationale": "kernel jump-table target: A0:20 (labs) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03694", + "rationale": "kernel jump-table target: A0:21 (atoi) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC036FC", + "rationale": "kernel jump-table target: A0:22 (atol) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC03894", + "rationale": "kernel jump-table target: A0:24 (strtol-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC01B08", + "rationale": "kernel jump-table target: A0:29 (bcmp) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02B8C", + "rationale": "kernel jump-table target: A0:2B (memset) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02BC8", + "rationale": "kernel jump-table target: A0:2C (memmove) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02C50", + "rationale": "kernel jump-table target: A0:2D (memcmp) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC02230", + "rationale": "kernel jump-table target: A0:30 (rand-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC021A0", + "rationale": "kernel jump-table target: A0:37 (rand-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8E0", + "rationale": "kernel jump-table target: A0:40 (SystemErrorUnresolvedException) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04120", + "rationale": "kernel jump-table target: A0:4D (ChangeClearRCnt-adjacent) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D8F0", + "rationale": "kernel jump-table target: A0:4F (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D900", + "rationale": "kernel jump-table target: A0:50 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D910", + "rationale": "kernel jump-table target: A0:52 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D920", + "rationale": "kernel jump-table target: A0:53 (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0B0C4", + "rationale": "kernel jump-table target: A0:6F (card/dev service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC04AA0", + "rationale": "kernel jump-table target: A0:94 (card-adjacent service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D930", + "rationale": "kernel jump-table target: A0:9A (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D940", + "rationale": "kernel jump-table target: A0:9B (stub/ret) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06750", + "rationale": "kernel jump-table target: A0:9C (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC06728", + "rationale": "kernel jump-table target: A0:9D (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC050DC", + "rationale": "kernel jump-table target: A0:9E (kernel service) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + }, + { + "address": "0xBFC0D4F0", + "rationale": "kernel jump-table target: A0:B4 (GetSystemInfo-family) \u2014 ROM-resident entry of the post-init A0/B0/C0 tables (read from live kernel RAM 0x200/0x874/0x674); reachable only through the vector table, invisible to transitive discovery. Class found via MMX6 card-check: A0:2B memset dispatch-missed silently, killing the save-scan (2026-07-02)." + } + ], + "excluded": [ + { + "address": "0xBFC00100", + "label": "utlb_miss_bev1", + "rationale": "R3000 UTLB-miss vector; PS1 has no TLB; never executed" + } + ] +} \ No newline at end of file diff --git a/overlay_toolchain/tcc/COPYING b/overlay_toolchain/tcc/COPYING new file mode 100644 index 00000000..d47d8aac --- /dev/null +++ b/overlay_toolchain/tcc/COPYING @@ -0,0 +1,518 @@ +TinyCC (Tiny C Compiler) 0.9.27 +Copyright (C) 2001-2004 Fabrice Bellard and the TinyCC contributors. + +Release packages for Windows bundle the unmodified upstream TinyCC 0.9.27 +win64 binary distribution under overlay_toolchain/tcc/ (tcc.exe, libtcc.dll, +its headers and runtime library). It runs as a separate program that compiles +overlay shards on the player's machine; the game does not link against it. + +TinyCC is licensed under the GNU Lesser General Public License, version 2.1, +reproduced below. Source code for this exact version: + https://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27.tar.bz2 +Binary distribution shipped (SHA-256 34a721949a2583fdff725312da092fa0f5f1f284b702e6f811c6954714faabb2): + https://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27-win64-bin.zip +Project home: https://bellard.org/tcc/ + +------------------------------------------------------------------------------ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Moe Ghoul, President of Vice + +That's all there is to it! diff --git a/overlay_toolchain/tcc/doc/tcc-doc.html b/overlay_toolchain/tcc/doc/tcc-doc.html new file mode 100644 index 00000000..a15247ed --- /dev/null +++ b/overlay_toolchain/tcc/doc/tcc-doc.html @@ -0,0 +1,1744 @@ + + + + +Tiny C Compiler Reference Documentation + + + + + + + + + + + + + + + + + +

Tiny C Compiler Reference Documentation

+ + + + +

Table of Contents

+ + + + + +
+

+Next: , Previous: , Up: (dir)   [Contents][Index]

+
+ +

Tiny C Compiler Reference Documentation

+ +

This manual documents version 0.9.27 of the Tiny C Compiler. +

+ + + + + + + + + + + + +
+ +
+

+Next: , Up: Top   [Contents][Index]

+
+ +

1 Introduction

+ +

TinyCC (aka TCC) is a small but hyper fast C compiler. Unlike other C +compilers, it is meant to be self-relying: you do not need an +external assembler or linker because TCC does that for you. +

+

TCC compiles so fast that even for big projects Makefiles may +not be necessary. +

+

TCC not only supports ANSI C, but also most of the new ISO C99 +standard and many GNUC extensions including inline assembly. +

+

TCC can also be used to make C scripts, i.e. pieces of C source +that you run as a Perl or Python script. Compilation is so fast that +your script will be as fast as if it was an executable. +

+

TCC can also automatically generate memory and bound checks +(see Bounds) while allowing all C pointers operations. TCC can do +these checks even if non patched libraries are used. +

+

With libtcc, you can use TCC as a backend for dynamic code +generation (see Libtcc). +

+

TCC mainly supports the i386 target on Linux and Windows. There are alpha +ports for the ARM (arm-tcc) and the TMS320C67xx targets +(c67-tcc). More information about the ARM port is available at +http://lists.gnu.org/archive/html/tinycc-devel/2003-10/msg00044.html. +

+

For usage on Windows, see also tcc-win32.txt. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

2 Command line invocation

+ + +

2.1 Quick start

+ +
+
usage: tcc [options] [infile1 infile2…] [-run infile args…]
+
+ +

TCC options are a very much like gcc options. The main difference is that TCC +can also execute directly the resulting program and give it runtime +arguments. +

+

Here are some examples to understand the logic: +

+
+
‘tcc -run a.c’
+

Compile a.c and execute it directly +

+
+
‘tcc -run a.c arg1’
+

Compile a.c and execute it directly. arg1 is given as first argument to +the main() of a.c. +

+
+
‘tcc a.c -run b.c arg1’
+

Compile a.c and b.c, link them together and execute them. arg1 is given +as first argument to the main() of the resulting program. +

+
+
‘tcc -o myprog a.c b.c’
+

Compile a.c and b.c, link them and generate the executable myprog. +

+
+
‘tcc -o myprog a.o b.o’
+

link a.o and b.o together and generate the executable myprog. +

+
+
‘tcc -c a.c’
+

Compile a.c and generate object file a.o. +

+
+
‘tcc -c asmfile.S’
+

Preprocess with C preprocess and assemble asmfile.S and generate +object file asmfile.o. +

+
+
‘tcc -c asmfile.s’
+

Assemble (but not preprocess) asmfile.s and generate object file +asmfile.o. +

+
+
‘tcc -r -o ab.o a.c b.c’
+

Compile a.c and b.c, link them together and generate the object file ab.o. +

+
+
+ +

Scripting: +

+

TCC can be invoked from scripts, just as shell scripts. You just +need to add #!/usr/local/bin/tcc -run at the start of your C source: +

+
+
#!/usr/local/bin/tcc -run
+#include <stdio.h>
+
+int main() 
+{
+    printf("Hello World\n");
+    return 0;
+}
+
+ +

TCC can read C source code from standard input when - is used in +place of infile. Example: +

+
+
echo 'main(){puts("hello");}' | tcc -run -
+
+ + +

2.2 Option summary

+ +

General Options: +

+
+
-c
+

Generate an object file. +

+
+
-o outfile
+

Put object file, executable, or dll into output file outfile. +

+
+
-run source [args...]
+

Compile file source and run it with the command line arguments +args. In order to be able to give more than one argument to a +script, several TCC options can be given after the +-run option, separated by spaces: +

+
tcc "-run -L/usr/X11R6/lib -lX11" ex4.c
+
+

In a script, it gives the following header: +

+
#!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11
+
+ +
+
-v
+

Display TCC version. +

+
+
-vv
+

Show included files. As sole argument, print search dirs. -vvv shows tries too. +

+
+
-bench
+

Display compilation statistics. +

+
+
+ +

Preprocessor options: +

+
+
-Idir
+

Specify an additional include path. Include paths are searched in the +order they are specified. +

+

System include paths are always searched after. The default system +include paths are: /usr/local/include, /usr/include +and PREFIX/lib/tcc/include. (PREFIX is usually +/usr or /usr/local). +

+
+
-Dsym[=val]
+

Define preprocessor symbol ‘sym’ to +val. If val is not present, its value is ‘1’. Function-like macros can +also be defined: -DF(a)=a+1 +

+
+
-Usym
+

Undefine preprocessor symbol ‘sym’. +

+
+
-E
+

Preprocess only, to stdout or file (with -o). +

+
+
+ +

Compilation flags: +

+

Note: each of the following options has a negative form beginning with +-fno-. +

+
+
-funsigned-char
+

Let the char type be unsigned. +

+
+
-fsigned-char
+

Let the char type be signed. +

+
+
-fno-common
+

Do not generate common symbols for uninitialized data. +

+
+
-fleading-underscore
+

Add a leading underscore at the beginning of each C symbol. +

+
+
-fms-extensions
+

Allow a MS C compiler extensions to the language. Currently this +assumes a nested named structure declaration without an identifier +behaves like an unnamed one. +

+
+
-fdollars-in-identifiers
+

Allow dollar signs in identifiers +

+
+
+ +

Warning options: +

+
+
-w
+

Disable all warnings. +

+
+
+ +

Note: each of the following warning options has a negative form beginning with +-Wno-. +

+
+
-Wimplicit-function-declaration
+

Warn about implicit function declaration. +

+
+
-Wunsupported
+

Warn about unsupported GCC features that are ignored by TCC. +

+
+
-Wwrite-strings
+

Make string constants be of type const char * instead of char +*. +

+
+
-Werror
+

Abort compilation if warnings are issued. +

+
+
-Wall
+

Activate all warnings, except -Werror, -Wunusupported and +-Wwrite-strings. +

+
+
+ +

Linker options: +

+
+
-Ldir
+

Specify an additional static library path for the -l option. The +default library paths are /usr/local/lib, /usr/lib and /lib. +

+
+
-lxxx
+

Link your program with dynamic library libxxx.so or static library +libxxx.a. The library is searched in the paths specified by the +-L option and LIBRARY_PATH variable. +

+
+
-Bdir
+

Set the path where the tcc internal libraries (and include files) can be +found (default is PREFIX/lib/tcc). +

+
+
-shared
+

Generate a shared library instead of an executable. +

+
+
-soname name
+

set name for shared library to be used at runtime +

+
+
-static
+

Generate a statically linked executable (default is a shared linked +executable). +

+
+
-rdynamic
+

Export global symbols to the dynamic linker. It is useful when a library +opened with dlopen() needs to access executable symbols. +

+
+
-r
+

Generate an object file combining all input files. +

+
+
-Wl,-rpath=path
+

Put custom search path for dynamic libraries into executable. +

+
+
-Wl,--enable-new-dtags
+

When putting a custom search path for dynamic libraries into the executable, +create the new ELF dynamic tag DT_RUNPATH instead of the old legacy DT_RPATH. +

+
+
-Wl,--oformat=fmt
+

Use fmt as output format. The supported output formats are: +

+
elf32-i386
+

ELF output format (default) +

+
binary
+

Binary image (only for executable output) +

+
coff
+

COFF output format (only for executable output for TMS320C67xx target) +

+
+ +
+
-Wl,-subsystem=console/gui/wince/...
+

Set type for PE (Windows) executables. +

+
+
-Wl,-[Ttext=# | section-alignment=# | file-alignment=# | image-base=# | stack=#]
+

Modify executable layout. +

+
+
-Wl,-Bsymbolic
+

Set DT_SYMBOLIC tag. +

+
+
-Wl,-(no-)whole-archive
+

Turn on/off linking of all objects in archives. +

+
+
+ +

Debugger options: +

+
+
-g
+

Generate run time debug information so that you get clear run time +error messages: test.c:68: in function 'test5()': dereferencing +invalid pointer instead of the laconic Segmentation +fault. +

+
+
-b
+

Generate additional support code to check +memory allocations and array/pointer bounds. -g is implied. Note +that the generated code is slower and bigger in this case. +

+

Note: -b is only available on i386 when using libtcc for the moment. +

+
+
-bt N
+

Display N callers in stack traces. This is useful with -g or +-b. +

+
+
+ +

Misc options: +

+
+
-MD
+

Generate makefile fragment with dependencies. +

+
+
-MF depfile
+

Use depfile as output for -MD. +

+
+
-print-search-dirs
+

Print the configured installation directory and a list of library +and include directories tcc will search. +

+
+
-dumpversion
+

Print version. +

+
+
+ +

Target specific options: +

+
+
-mms-bitfields
+

Use an algorithm for bitfield alignment consistent with MSVC. Default is +gcc’s algorithm. +

+
+
-mfloat-abi (ARM only)
+

Select the float ABI. Possible values: softfp and hard +

+
+
-mno-sse
+

Do not use sse registers on x86_64 +

+
+
-m32, -m64
+

Pass command line to the i386/x86_64 cross compiler. +

+
+
+ +

Note: GCC options -Ox, -fx and -mx are +ignored. +

+

Environment variables that affect how tcc operates. +

+
+
CPATH
+
C_INCLUDE_PATH
+

A colon-separated list of directories searched for include files, +directories given with -I are searched first. +

+
+
LIBRARY_PATH
+

A colon-separated list of directories searched for libraries for the +-l option, directories given with -L are searched first. +

+
+
+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

3 C language support

+ + +

3.1 ANSI C

+ +

TCC implements all the ANSI C standard, including structure bit fields +and floating point numbers (long double, double, and +float fully supported). +

+ +

3.2 ISOC99 extensions

+ +

TCC implements many features of the new C standard: ISO C99. Currently +missing items are: complex and imaginary numbers. +

+

Currently implemented ISOC99 features: +

+
    +
  • variable length arrays. + +
  • 64 bit long long types are fully supported. + +
  • The boolean type _Bool is supported. + +
  • __func__ is a string variable containing the current +function name. + +
  • Variadic macros: __VA_ARGS__ can be used for + function-like macros: +
    +
        #define dprintf(level, __VA_ARGS__) printf(__VA_ARGS__)
    +
    + +

    dprintf can then be used with a variable number of parameters. +

    +
  • Declarations can appear anywhere in a block (as in C++). + +
  • Array and struct/union elements can be initialized in any order by + using designators: +
    +
        struct { int x, y; } st[10] = { [0].x = 1, [0].y = 2 };
    +
    +    int tab[10] = { 1, 2, [5] = 5, [9] = 9};
    +
    + +
  • Compound initializers are supported: +
    +
        int *p = (int []){ 1, 2, 3 };
    +
    +

    to initialize a pointer pointing to an initialized array. The same +works for structures and strings. +

    +
  • Hexadecimal floating point constants are supported: +
    +
              double d = 0x1234p10;
    +
    + +

    is the same as writing +

    +
              double d = 4771840.0;
    +
    + +
  • inline keyword is ignored. + +
  • restrict keyword is ignored. +
+ + +

3.3 GNU C extensions

+ +

TCC implements some GNU C extensions: +

+
    +
  • array designators can be used without ’=’: +
    +
        int a[10] = { [0] 1, [5] 2, 3, 4 };
    +
    + +
  • Structure field designators can be a label: +
    +
        struct { int x, y; } st = { x: 1, y: 1};
    +
    +

    instead of +

    +
        struct { int x, y; } st = { .x = 1, .y = 1};
    +
    + +
  • \e is ASCII character 27. + +
  • case ranges : ranges can be used in cases: +
    +
        switch(a) {
    +    case 1 … 9:
    +          printf("range 1 to 9\n");
    +          break;
    +    default:
    +          printf("unexpected\n");
    +          break;
    +    }
    +
    + + + + + + + + + + +
  • The keyword __attribute__ is handled to specify variable or +function attributes. The following attributes are supported: +
      +
    • aligned(n): align a variable or a structure field to n bytes +(must be a power of two). + +
    • packed: force alignment of a variable or a structure field to + 1. + +
    • section(name): generate function or data in assembly section +name (name is a string containing the section name) instead of the default +section. + +
    • unused: specify that the variable or the function is unused. + +
    • cdecl: use standard C calling convention (default). + +
    • stdcall: use Pascal-like calling convention. + +
    • regparm(n): use fast i386 calling convention. n must be +between 1 and 3. The first n function parameters are respectively put in +registers %eax, %edx and %ecx. + +
    • dllexport: export function from dll/executable (win32 only) + +
    + +

    Here are some examples: +

    +
        int a __attribute__ ((aligned(8), section(".mysection")));
    +
    + +

    align variable a to 8 bytes and put it in section .mysection. +

    +
    +
        int my_add(int a, int b) __attribute__ ((section(".mycodesection"))) 
    +    {
    +        return a + b;
    +    }
    +
    + +

    generate function my_add in section .mycodesection. +

    +
  • GNU style variadic macros: +
    +
        #define dprintf(fmt, args…) printf(fmt, ## args)
    +
    +    dprintf("no arg\n");
    +    dprintf("one arg %d\n", 1);
    +
    + +
  • __FUNCTION__ is interpreted as C99 __func__ +(so it has not exactly the same semantics as string literal GNUC +where it is a string literal). + +
  • The __alignof__ keyword can be used as sizeof +to get the alignment of a type or an expression. + +
  • The typeof(x) returns the type of x. +x is an expression or a type. + +
  • Computed gotos: &&label returns a pointer of type +void * on the goto label label. goto *expr can be +used to jump on the pointer resulting from expr. + +
  • Inline assembly with asm instruction: + + + +
    +
    static inline void * my_memcpy(void * to, const void * from, size_t n)
    +{
    +int d0, d1, d2;
    +__asm__ __volatile__(
    +        "rep ; movsl\n\t"
    +        "testb $2,%b4\n\t"
    +        "je 1f\n\t"
    +        "movsw\n"
    +        "1:\ttestb $1,%b4\n\t"
    +        "je 2f\n\t"
    +        "movsb\n"
    +        "2:"
    +        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
    +        :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
    +        : "memory");
    +return (to);
    +}
    +
    + + +

    TCC includes its own x86 inline assembler with a gas-like (GNU +assembler) syntax. No intermediate files are generated. GCC 3.x named +operands are supported. +

    +
  • __builtin_types_compatible_p() and __builtin_constant_p() +are supported. + +
  • #pragma pack is supported for win32 compatibility. + +
+ + +

3.4 TinyCC extensions

+ +
    +
  • __TINYC__ is a predefined macro to indicate that you use TCC. + +
  • #! at the start of a line is ignored to allow scripting. + +
  • Binary digits can be entered (0b101 instead of +5). + +
  • __BOUNDS_CHECKING_ON is defined if bound checking is activated. + +
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

4 TinyCC Assembler

+ +

Since version 0.9.16, TinyCC integrates its own assembler. TinyCC +assembler supports a gas-like syntax (GNU assembler). You can +deactivate assembler support if you want a smaller TinyCC executable +(the C compiler does not rely on the assembler). +

+

TinyCC Assembler is used to handle files with .S (C +preprocessed assembler) and .s extensions. It is also used to +handle the GNU inline assembler with the asm keyword. +

+ +

4.1 Syntax

+ +

TinyCC Assembler supports most of the gas syntax. The tokens are the +same as C. +

+
    +
  • C and C++ comments are supported. + +
  • Identifiers are the same as C, so you cannot use ’.’ or ’$’. + +
  • Only 32 bit integer numbers are supported. + +
+ + +

4.2 Expressions

+ +
    +
  • Integers in decimal, octal and hexa are supported. + +
  • Unary operators: +, -, ~. + +
  • Binary operators in decreasing priority order: + +
      +
    1. *, /, % +
    2. &, |, ^ +
    3. +, - +
    + +
  • A value is either an absolute number or a label plus an offset. +All operators accept absolute values except ’+’ and ’-’. ’+’ or ’-’ can be +used to add an offset to a label. ’-’ supports two labels only if they +are the same or if they are both defined and in the same section. + +
+ + +

4.3 Labels

+ +
    +
  • All labels are considered as local, except undefined ones. + +
  • Numeric labels can be used as local gas-like labels. +They can be defined several times in the same source. Use ’b’ +(backward) or ’f’ (forward) as suffix to reference them: + +
    +
     1:
    +      jmp 1b /* jump to '1' label before */
    +      jmp 1f /* jump to '1' label after */
    + 1:
    +
    + +
+ + +

4.4 Directives

+ + + + + + + + + + + + + + + + + + + + + + + + +

All directives are preceded by a ’.’. The following directives are +supported: +

+
    +
  • .align n[,value] +
  • .skip n[,value] +
  • .space n[,value] +
  • .byte value1[,...] +
  • .word value1[,...] +
  • .short value1[,...] +
  • .int value1[,...] +
  • .long value1[,...] +
  • .quad immediate_value1[,...] +
  • .globl symbol +
  • .global symbol +
  • .section section +
  • .text +
  • .data +
  • .bss +
  • .fill repeat[,size[,value]] +
  • .org n +
  • .previous +
  • .string string[,...] +
  • .asciz string[,...] +
  • .ascii string[,...] +
+ + +

4.5 X86 Assembler

+ + +

All X86 opcodes are supported. Only ATT syntax is supported (source +then destination operand order). If no size suffix is given, TinyCC +tries to guess it from the operand sizes. +

+

Currently, MMX opcodes are supported but not SSE ones. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

5 TinyCC Linker

+ + + +

5.1 ELF file generation

+ + +

TCC can directly output relocatable ELF files (object files), +executable ELF files and dynamic ELF libraries without relying on an +external linker. +

+

Dynamic ELF libraries can be output but the C compiler does not generate +position independent code (PIC). It means that the dynamic library +code generated by TCC cannot be factorized among processes yet. +

+

TCC linker eliminates unreferenced object code in libraries. A single pass is +done on the object and library list, so the order in which object files and +libraries are specified is important (same constraint as GNU ld). No grouping +options (--start-group and --end-group) are supported. +

+ +

5.2 ELF file loader

+ +

TCC can load ELF object files, archives (.a files) and dynamic +libraries (.so). +

+ +

5.3 PE-i386 file generation

+ + +

TCC for Windows supports the native Win32 executable file format (PE-i386). It +generates EXE files (console and gui) and DLL files. +

+

For usage on Windows, see also tcc-win32.txt. +

+ +

5.4 GNU Linker Scripts

+ + + + + + + +

Because on many Linux systems some dynamic libraries (such as +/usr/lib/libc.so) are in fact GNU ld link scripts (horrible!), +the TCC linker also supports a subset of GNU ld scripts. +

+

The GROUP and FILE commands are supported. OUTPUT_FORMAT +and TARGET are ignored. +

+

Example from /usr/lib/libc.so: +

+
/* GNU ld script
+   Use the shared library, but some functions are only in
+   the static library, so try that secondarily.  */
+GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
+
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

6 TinyCC Memory and Bound checks

+ + + +

This feature is activated with the -b (see Invoke). +

+

Note that pointer size is unchanged and that code generated +with bound checks is fully compatible with unchecked +code. When a pointer comes from unchecked code, it is assumed to be +valid. Even very obscure C code with casts should work correctly. +

+

For more information about the ideas behind this method, see +http://www.doc.ic.ac.uk/~phjk/BoundsChecking.html. +

+

Here are some examples of caught errors: +

+
+
Invalid range with standard string function:
+
+
{
+    char tab[10];
+    memset(tab, 0, 11);
+}
+
+ +
+
Out of bounds-error in global or local arrays:
+
+
{
+    int tab[10];
+    for(i=0;i<11;i++) {
+        sum += tab[i];
+    }
+}
+
+ +
+
Out of bounds-error in malloc’ed data:
+
+
{
+    int *tab;
+    tab = malloc(20 * sizeof(int));
+    for(i=0;i<21;i++) {
+        sum += tab4[i];
+    }
+    free(tab);
+}
+
+ +
+
Access of freed memory:
+
+
{
+    int *tab;
+    tab = malloc(20 * sizeof(int));
+    free(tab);
+    for(i=0;i<20;i++) {
+        sum += tab4[i];
+    }
+}
+
+ +
+
Double free:
+
+
{
+    int *tab;
+    tab = malloc(20 * sizeof(int));
+    free(tab);
+    free(tab);
+}
+
+ +
+
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

7 The libtcc library

+ +

The libtcc library enables you to use TCC as a backend for +dynamic code generation. +

+

Read the libtcc.h to have an overview of the API. Read +libtcc_test.c to have a very simple example. +

+

The idea consists in giving a C string containing the program you want +to compile directly to libtcc. Then you can access to any global +symbol (function or variable) defined. +

+
+ +
+

+Previous: , Up: Top   [Contents][Index]

+
+ +

8 Developer’s guide

+ +

This chapter gives some hints to understand how TCC works. You can skip +it if you do not intend to modify the TCC code. +

+ +

8.1 File reading

+ +

The BufferedFile structure contains the context needed to read a +file, including the current line number. tcc_open() opens a new +file and tcc_close() closes it. inp() returns the next +character. +

+ +

8.2 Lexer

+ +

next() reads the next token in the current +file. next_nomacro() reads the next token without macro +expansion. +

+

tok contains the current token (see TOK_xxx) +constants. Identifiers and keywords are also keywords. tokc +contains additional infos about the token (for example a constant value +if number or string token). +

+ +

8.3 Parser

+ +

The parser is hardcoded (yacc is not necessary). It does only one pass, +except: +

+
    +
  • For initialized arrays with unknown size, a first pass +is done to count the number of elements. + +
  • For architectures where arguments are evaluated in +reverse order, a first pass is done to reverse the argument order. + +
+ + +

8.4 Types

+ +

The types are stored in a single ’int’ variable. It was chosen in the +first stages of development when tcc was much simpler. Now, it may not +be the best solution. +

+
+
#define VT_INT        0  /* integer type */
+#define VT_BYTE       1  /* signed byte type */
+#define VT_SHORT      2  /* short type */
+#define VT_VOID       3  /* void type */
+#define VT_PTR        4  /* pointer */
+#define VT_ENUM       5  /* enum definition */
+#define VT_FUNC       6  /* function type */
+#define VT_STRUCT     7  /* struct/union definition */
+#define VT_FLOAT      8  /* IEEE float */
+#define VT_DOUBLE     9  /* IEEE double */
+#define VT_LDOUBLE   10  /* IEEE long double */
+#define VT_BOOL      11  /* ISOC99 boolean type */
+#define VT_LLONG     12  /* 64 bit integer */
+#define VT_LONG      13  /* long integer (NEVER USED as type, only
+                            during parsing) */
+#define VT_BTYPE      0x000f /* mask for basic type */
+#define VT_UNSIGNED   0x0010  /* unsigned type */
+#define VT_ARRAY      0x0020  /* array type (also has VT_PTR) */
+#define VT_VLA        0x20000 /* VLA type (also has VT_PTR and VT_ARRAY) */
+#define VT_BITFIELD   0x0040  /* bitfield modifier */
+#define VT_CONSTANT   0x0800  /* const modifier */
+#define VT_VOLATILE   0x1000  /* volatile modifier */
+#define VT_DEFSIGN    0x2000  /* signed type */
+
+#define VT_STRUCT_SHIFT 18   /* structure/enum name shift (14 bits left) */
+
+ +

When a reference to another type is needed (for pointers, functions and +structures), the 32 - VT_STRUCT_SHIFT high order bits are used to +store an identifier reference. +

+

The VT_UNSIGNED flag can be set for chars, shorts, ints and long +longs. +

+

Arrays are considered as pointers VT_PTR with the flag +VT_ARRAY set. Variable length arrays are considered as special +arrays and have flag VT_VLA set instead of VT_ARRAY. +

+

The VT_BITFIELD flag can be set for chars, shorts, ints and long +longs. If it is set, then the bitfield position is stored from bits +VT_STRUCT_SHIFT to VT_STRUCT_SHIFT + 5 and the bit field size is stored +from bits VT_STRUCT_SHIFT + 6 to VT_STRUCT_SHIFT + 11. +

+

VT_LONG is never used except during parsing. +

+

During parsing, the storage of an object is also stored in the type +integer: +

+
+
#define VT_EXTERN  0x00000080  /* extern definition */
+#define VT_STATIC  0x00000100  /* static variable */
+#define VT_TYPEDEF 0x00000200  /* typedef definition */
+#define VT_INLINE  0x00000400  /* inline definition */
+#define VT_IMPORT  0x00004000  /* win32: extern data imported from dll */
+#define VT_EXPORT  0x00008000  /* win32: data exported from dll */
+#define VT_WEAK    0x00010000  /* win32: data exported from dll */
+
+ + +

8.5 Symbols

+ +

All symbols are stored in hashed symbol stacks. Each symbol stack +contains Sym structures. +

+

Sym.v contains the symbol name (remember +an identifier is also a token, so a string is never necessary to store +it). Sym.t gives the type of the symbol. Sym.r is usually +the register in which the corresponding variable is stored. Sym.c is +usually a constant associated to the symbol like its address for normal +symbols, and the number of entries for symbols representing arrays. +Variable length array types use Sym.c as a location on the stack +which holds the runtime sizeof for the type. +

+

Four main symbol stacks are defined: +

+
+
define_stack
+

for the macros (#defines). +

+
+
global_stack
+

for the global variables, functions and types. +

+
+
local_stack
+

for the local variables, functions and types. +

+
+
global_label_stack
+

for the local labels (for goto). +

+
+
label_stack
+

for GCC block local labels (see the __label__ keyword). +

+
+
+ +

sym_push() is used to add a new symbol in the local symbol +stack. If no local symbol stack is active, it is added in the global +symbol stack. +

+

sym_pop(st,b) pops symbols from the symbol stack st until +the symbol b is on the top of stack. If b is NULL, the stack +is emptied. +

+

sym_find(v) return the symbol associated to the identifier +v. The local stack is searched first from top to bottom, then the +global stack. +

+ +

8.6 Sections

+ +

The generated code and data are written in sections. The structure +Section contains all the necessary information for a given +section. new_section() creates a new section. ELF file semantics +is assumed for each section. +

+

The following sections are predefined: +

+
+
text_section
+

is the section containing the generated code. ind contains the +current position in the code section. +

+
+
data_section
+

contains initialized data +

+
+
bss_section
+

contains uninitialized data +

+
+
bounds_section
+
lbounds_section
+

are used when bound checking is activated +

+
+
stab_section
+
stabstr_section
+

are used when debugging is active to store debug information +

+
+
symtab_section
+
strtab_section
+

contain the exported symbols (currently only used for debugging). +

+
+
+ + +

8.7 Code generation

+ + + +

8.7.1 Introduction

+ +

The TCC code generator directly generates linked binary code in one +pass. It is rather unusual these days (see gcc for example which +generates text assembly), but it can be very fast and surprisingly +little complicated. +

+

The TCC code generator is register based. Optimization is only done at +the expression level. No intermediate representation of expression is +kept except the current values stored in the value stack. +

+

On x86, three temporary registers are used. When more registers are +needed, one register is spilled into a new temporary variable on the stack. +

+ +

8.7.2 The value stack

+ + +

When an expression is parsed, its value is pushed on the value stack +(vstack). The top of the value stack is vtop. Each value +stack entry is the structure SValue. +

+

SValue.t is the type. SValue.r indicates how the value is +currently stored in the generated code. It is usually a CPU register +index (REG_xxx constants), but additional values and flags are +defined: +

+
+
#define VT_CONST     0x00f0
+#define VT_LLOCAL    0x00f1
+#define VT_LOCAL     0x00f2
+#define VT_CMP       0x00f3
+#define VT_JMP       0x00f4
+#define VT_JMPI      0x00f5
+#define VT_LVAL      0x0100
+#define VT_SYM       0x0200
+#define VT_MUSTCAST  0x0400
+#define VT_MUSTBOUND 0x0800
+#define VT_BOUNDED   0x8000
+#define VT_LVAL_BYTE     0x1000
+#define VT_LVAL_SHORT    0x2000
+#define VT_LVAL_UNSIGNED 0x4000
+#define VT_LVAL_TYPE     (VT_LVAL_BYTE | VT_LVAL_SHORT | VT_LVAL_UNSIGNED)
+
+ +
+
VT_CONST
+

indicates that the value is a constant. It is stored in the union +SValue.c, depending on its type. +

+
+
VT_LOCAL
+

indicates a local variable pointer at offset SValue.c.i in the +stack. +

+
+
VT_CMP
+

indicates that the value is actually stored in the CPU flags (i.e. the +value is the consequence of a test). The value is either 0 or 1. The +actual CPU flags used is indicated in SValue.c.i. +

+

If any code is generated which destroys the CPU flags, this value MUST be +put in a normal register. +

+
+
VT_JMP
+
VT_JMPI
+

indicates that the value is the consequence of a conditional jump. For VT_JMP, +it is 1 if the jump is taken, 0 otherwise. For VT_JMPI it is inverted. +

+

These values are used to compile the || and && logical +operators. +

+

If any code is generated, this value MUST be put in a normal +register. Otherwise, the generated code won’t be executed if the jump is +taken. +

+
+
VT_LVAL
+

is a flag indicating that the value is actually an lvalue (left value of +an assignment). It means that the value stored is actually a pointer to +the wanted value. +

+

Understanding the use VT_LVAL is very important if you want to +understand how TCC works. +

+
+
VT_LVAL_BYTE
+
VT_LVAL_SHORT
+
VT_LVAL_UNSIGNED
+

if the lvalue has an integer type, then these flags give its real +type. The type alone is not enough in case of cast optimisations. +

+
+
VT_LLOCAL
+

is a saved lvalue on the stack. VT_LVAL must also be set with +VT_LLOCAL. VT_LLOCAL can arise when a VT_LVAL in +a register has to be saved to the stack, or it can come from an +architecture-specific calling convention. +

+
+
VT_MUSTCAST
+

indicates that a cast to the value type must be performed if the value +is used (lazy casting). +

+
+
VT_SYM
+

indicates that the symbol SValue.sym must be added to the constant. +

+
+
VT_MUSTBOUND
+
VT_BOUNDED
+

are only used for optional bound checking. +

+
+
+ + +

8.7.3 Manipulating the value stack

+ + +

vsetc() and vset() pushes a new value on the value +stack. If the previous vtop was stored in a very unsafe place(for +example in the CPU flags), then some code is generated to put the +previous vtop in a safe storage. +

+

vpop() pops vtop. In some cases, it also generates cleanup +code (for example if stacked floating point registers are used as on +x86). +

+

The gv(rc) function generates code to evaluate vtop (the +top value of the stack) into registers. rc selects in which +register class the value should be put. gv() is the most +important function of the code generator. +

+

gv2() is the same as gv() but for the top two stack +entries. +

+ +

8.7.4 CPU dependent code generation

+ +

See the i386-gen.c file to have an example. +

+
+
load()
+

must generate the code needed to load a stack value into a register. +

+
+
store()
+

must generate the code needed to store a register into a stack value +lvalue. +

+
+
gfunc_start()
+
gfunc_param()
+
gfunc_call()
+

should generate a function call +

+
+
gfunc_prolog()
+
gfunc_epilog()
+

should generate a function prolog/epilog. +

+
+
gen_opi(op)
+

must generate the binary integer operation op on the two top +entries of the stack which are guaranteed to contain integer types. +

+

The result value should be put on the stack. +

+
+
gen_opf(op)
+

same as gen_opi() for floating point operations. The two top +entries of the stack are guaranteed to contain floating point values of +same types. +

+
+
gen_cvt_itof()
+

integer to floating point conversion. +

+
+
gen_cvt_ftoi()
+

floating point to integer conversion. +

+
+
gen_cvt_ftof()
+

floating point to floating point of different size conversion. +

+
+
gen_bounded_ptr_add()
+
gen_bounded_ptr_deref()
+

are only used for bounds checking. +

+
+
+ + +

8.8 Optimizations done

+ + + + + + + +

Constant propagation is done for all operations. Multiplications and +divisions are optimized to shifts when appropriate. Comparison +operators are optimized by maintaining a special cache for the +processor flags. &&, || and ! are optimized by maintaining a special +’jump target’ value. No other jump optimization is currently performed +because it would require to store the code in a more abstract fashion. +

+ +

Concept Index

+
Jump to:   _ +   +
+A +   +B +   +C +   +D +   +E +   +F +   +G +   +I +   +J +   +L +   +M +   +O +   +P +   +Q +   +R +   +S +   +T +   +U +   +V +   +W +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

_
__asm__: Clang

A
align directive: asm
aligned attribute: Clang
ascii directive: asm
asciz directive: asm
assembler: asm
assembler directives: asm
assembly, inline: Clang

B
bound checks: Bounds
bss directive: asm
byte directive: asm

C
caching processor flags: devel
cdecl attribute: Clang
code generation: devel
comparison operators: devel
constant propagation: devel
CPU dependent: devel

D
data directive: asm
directives, assembler: asm
dllexport attribute: Clang

E
ELF: linker

F
FILE, linker command: linker
fill directive: asm
flags, caching: devel

G
gas: Clang
global directive: asm
globl directive: asm
GROUP, linker command: linker

I
inline assembly: Clang
int directive: asm

J
jump optimization: devel

L
linker: linker
linker scripts: linker
long directive: asm

M
memory checks: Bounds

O
optimizations: devel
org directive: asm
OUTPUT_FORMAT, linker command: linker

P
packed attribute: Clang
PE-i386: linker
previous directive: asm

Q
quad directive: asm

R
regparm attribute: Clang

S
scripts, linker: linker
section attribute: Clang
section directive: asm
short directive: asm
skip directive: asm
space directive: asm
stdcall attribute: Clang
strength reduction: devel
string directive: asm

T
TARGET, linker command: linker
text directive: asm

U
unused attribute: Clang

V
value stack: devel
value stack, introduction: devel

W
word directive: asm

+
Jump to:   _ +   +
+A +   +B +   +C +   +D +   +E +   +F +   +G +   +I +   +J +   +L +   +M +   +O +   +P +   +Q +   +R +   +S +   +T +   +U +   +V +   +W +   +
+ +
+ + + + + diff --git a/overlay_toolchain/tcc/doc/tcc-win32.txt b/overlay_toolchain/tcc/doc/tcc-win32.txt new file mode 100644 index 00000000..ab730073 --- /dev/null +++ b/overlay_toolchain/tcc/doc/tcc-win32.txt @@ -0,0 +1,168 @@ + + TinyCC + ====== + + This file contains specific information for usage of TinyCC + under MS-Windows. See tcc-doc.html to have all the features. + + + Installation from the binary ZIP package: + ----------------------------------------- + Unzip the package to a directory of your choice. + + + Set the system PATH: + -------------------- + To be able to invoke the compiler from everywhere on your computer by + just typing "tcc", please add the directory containing tcc.exe to your + system PATH. + + + Include and library search paths + -------------------------------- + On windows, the standard "include" and "lib" directories are searched + relatively from the location of the executables (tcc.exe, libtcc.dll). + + + Examples: + --------- + Open a console window (DOS box) and 'cd' to the examples directory. + + For the 'Fibonacci' example type: + + tcc fib.c + + For the 'Hello Windows' GUI example type: + + tcc hello_win.c + + For the 'Hello DLL' example type + + tcc -shared dll.c + tcc -impdef dll.dll (optional) + tcc hello_dll.c dll.def + + + Using libtcc as JIT compiler in your program + -------------------------------------------- + Check out the 'libtcc_test' example: + + - Running it from source: + tcc -I libtcc libtcc/libtcc.def -run examples/libtcc_test.c + + - Compiling with TCC: + tcc examples/libtcc_test.c -I libtcc libtcc/libtcc.def + + - Compiling with MinGW: + gcc examples/libtcc_test.c -I libtcc libtcc.dll -o libtcc_test.exe + + - Compiling with MSVC: + lib /def:libtcc\libtcc.def /out:libtcc.lib + cl /MD examples/libtcc_test.c -I libtcc libtcc.lib + + + Import Definition Files: + ------------------------ + To link with Windows system DLLs, TCC uses import definition + files (.def) instead of libraries. + + The now built-in 'tiny_impdef' program may be used to make + additional .def files for any DLL. For example + + tcc -impdef [-v] opengl32.dll [-o opengl32.def] + + Put opengl32.def into the tcc/lib directory. Specify -lopengl32 at + the TCC commandline to link a program that uses opengl32.dll. + + + Header Files: + ------------- + The system header files (except _mingw.h) are from the MinGW + distribution: + + http://www.mingw.org/ + + From the windows headers, only a minimal set is included. If you need + more, get MinGW's "w32api" package. Extract the files from "include" + into your "tcc/include/winapi" directory. + + + Resource Files: + --------------- + TCC can link windows resources in coff format as generated by MinGW's + windres.exe. For example: + + windres -O coff app.rc -o appres.o + tcc app.c appres.o -o app.exe + + + Tiny Libmaker: + -------------- + The now built-in tiny_libmaker tool by Timovj Lahde can be used as + 'ar' replacement to make a library from several object files: + + tcc -ar [rcsv] library objectfiles ... + + + Compilation from source: + ------------------------ + * You can use the MinGW and MSYS tools available at + http://www.mingw.org + http://www.mingw-w64.org + http://www.msys2.org + + Untar the TCC archive and type in the MSYS shell: + ./configure [--prefix installpath] + make + make install + + The default install location is c:\Program Files\tcc + + Cygwin can be used too with its mingw cross-compiler installed: + ./configure --cross-prefix=i686-w64-mingw32- + (the prefix may vary) + + * Alternatively you can compile TCC with just GCC from MinGW using + > build-tcc.bat (from the win32 directory) + + Also MSVC can be used with the "VSTools Developer Command Prompt": + > build-tcc.bat -c cl + + or with an existing tcc (needs to be in a different directory) + > build-tcc.bat -c some-tcc-dir\tcc.exe + + Also you can copy/install everything into another directory: + > build-tcc.bat -i + + Limitations: + ------------ + - On the object file level, currently TCC supports only the ELF format, + not COFF as used by MinGW and MSVC. It is not possible to exchange + object files or libraries between TCC and these compilers. + + However libraries for TCC from objects by TCC can be made using + tcc -ar lib.a files.o ,,, + + - No leading underscore is generated in the ELF symbols. + + Documentation and License: + -------------------------- + TCC is distributed under the GNU Lesser General Public License. (See + COPYING file or http://www.gnu.org/licenses/lgpl-2.1.html) + + TinyCC homepage is at: + + http://fabrice.bellard.free.fr/tcc/ + + + WinAPI Help and 3rd-party tools: + -------------------------------- + The Windows API documentation (Win95) in a single .hlp file is + available on the lcc-win32 site as "win32hlp.exe" or from other + locations as "win32hlp_big.zip". + + A nice RAD tool to create windows resources (dialog boxes etc.) is + "ResEd", available at the RadASM website. + + + --- grischka diff --git a/overlay_toolchain/tcc/examples/dll.c b/overlay_toolchain/tcc/examples/dll.c new file mode 100644 index 00000000..052a0564 --- /dev/null +++ b/overlay_toolchain/tcc/examples/dll.c @@ -0,0 +1,13 @@ +//+--------------------------------------------------------------------------- +// +// dll.c - Windows DLL example - dynamically linked part +// + +#include + +__declspec(dllexport) const char *hello_data = "(not set)"; + +__declspec(dllexport) void hello_func (void) +{ + MessageBox (0, hello_data, "From DLL", MB_ICONINFORMATION); +} diff --git a/overlay_toolchain/tcc/examples/fib.c b/overlay_toolchain/tcc/examples/fib.c new file mode 100644 index 00000000..8da26bce --- /dev/null +++ b/overlay_toolchain/tcc/examples/fib.c @@ -0,0 +1,24 @@ +#include +#include // atoi() + +int fib(n) +{ + if (n <= 2) + return 1; + else + return fib(n-1) + fib(n-2); +} + +int main(int argc, char **argv) +{ + int n; + if (argc < 2) { + printf("usage: fib n\n" + "Compute nth Fibonacci number\n"); + return 1; + } + + n = atoi(argv[1]); + printf("fib(%d) = %d\n", n, fib(n)); + return 0; +} diff --git a/overlay_toolchain/tcc/examples/hello_dll.c b/overlay_toolchain/tcc/examples/hello_dll.c new file mode 100644 index 00000000..4813c5b9 --- /dev/null +++ b/overlay_toolchain/tcc/examples/hello_dll.c @@ -0,0 +1,20 @@ +//+--------------------------------------------------------------------------- +// +// HELLO_DLL.C - Windows DLL example - main application part +// + +#include + +void hello_func (void); +__declspec(dllimport) extern const char *hello_data; + +int WINAPI WinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + hello_data = "Hello World!"; + hello_func(); + return 0; +} diff --git a/overlay_toolchain/tcc/examples/hello_win.c b/overlay_toolchain/tcc/examples/hello_win.c new file mode 100644 index 00000000..96546e41 --- /dev/null +++ b/overlay_toolchain/tcc/examples/hello_win.c @@ -0,0 +1,163 @@ +//+--------------------------------------------------------------------------- +// +// HELLO_WIN.C - Windows GUI 'Hello World!' Example +// +//+--------------------------------------------------------------------------- + +#include + +#define APPNAME "HELLO_WIN" + +char szAppName[] = APPNAME; // The name of this application +char szTitle[] = APPNAME; // The title bar text +const char *pWindowText; + +void CenterWindow(HWND hWnd); + +//+--------------------------------------------------------------------------- +// +// Function: WndProc +// +// Synopsis: very unusual type of function - gets called by system to +// process windows messages. +// +// Arguments: same as always. +//---------------------------------------------------------------------------- + +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) { + + // ----------------------- first and last + case WM_CREATE: + CenterWindow(hwnd); + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + + // ----------------------- get out of it... + case WM_RBUTTONUP: + DestroyWindow(hwnd); + break; + + case WM_KEYDOWN: + if (VK_ESCAPE == wParam) + DestroyWindow(hwnd); + break; + + // ----------------------- display our minimal info + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc; + RECT rc; + hdc = BeginPaint(hwnd, &ps); + + GetClientRect(hwnd, &rc); + SetTextColor(hdc, RGB(240,240,96)); + SetBkMode(hdc, TRANSPARENT); + DrawText(hdc, pWindowText, -1, &rc, DT_CENTER|DT_SINGLELINE|DT_VCENTER); + + EndPaint(hwnd, &ps); + break; + } + + // ----------------------- let windows do all other stuff + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + return 0; +} + +//+--------------------------------------------------------------------------- +// +// Function: WinMain +// +// Synopsis: standard entrypoint for GUI Win32 apps +// +//---------------------------------------------------------------------------- +int APIENTRY WinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow + ) +{ + MSG msg; + WNDCLASS wc; + HWND hwnd; + + pWindowText = lpCmdLine[0] ? lpCmdLine : "Hello Windows!"; + + // Fill in window class structure with parameters that describe + // the main window. + + ZeroMemory(&wc, sizeof wc); + wc.hInstance = hInstance; + wc.lpszClassName = szAppName; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW; + wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + + if (FALSE == RegisterClass(&wc)) + return 0; + + // create the browser + hwnd = CreateWindow( + szAppName, + szTitle, + WS_OVERLAPPEDWINDOW|WS_VISIBLE, + CW_USEDEFAULT, + CW_USEDEFAULT, + 360,//CW_USEDEFAULT, + 240,//CW_USEDEFAULT, + 0, + 0, + hInstance, + 0); + + if (NULL == hwnd) + return 0; + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0) > 0) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return msg.wParam; +} + +//+--------------------------------------------------------------------------- + +//+--------------------------------------------------------------------------- + +void CenterWindow(HWND hwnd_self) +{ + HWND hwnd_parent; + RECT rw_self, rc_parent, rw_parent; + int xpos, ypos; + + hwnd_parent = GetParent(hwnd_self); + if (NULL == hwnd_parent) + hwnd_parent = GetDesktopWindow(); + + GetWindowRect(hwnd_parent, &rw_parent); + GetClientRect(hwnd_parent, &rc_parent); + GetWindowRect(hwnd_self, &rw_self); + + xpos = rw_parent.left + (rc_parent.right + rw_self.left - rw_self.right) / 2; + ypos = rw_parent.top + (rc_parent.bottom + rw_self.top - rw_self.bottom) / 2; + + SetWindowPos( + hwnd_self, NULL, + xpos, ypos, 0, 0, + SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE + ); +} + +//+--------------------------------------------------------------------------- diff --git a/overlay_toolchain/tcc/examples/libtcc_test.c b/overlay_toolchain/tcc/examples/libtcc_test.c new file mode 100644 index 00000000..480d3148 --- /dev/null +++ b/overlay_toolchain/tcc/examples/libtcc_test.c @@ -0,0 +1,96 @@ +/* + * Simple Test program for libtcc + * + * libtcc can be useful to use tcc as a "backend" for a code generator. + */ +#include +#include +#include + +#include "libtcc.h" + +/* this function is called by the generated code */ +int add(int a, int b) +{ + return a + b; +} + +/* this strinc is referenced by the generated code */ +const char hello[] = "Hello World!"; + +char my_program[] = +"#include \n" /* include the "Simple libc header for TCC" */ +"extern int add(int a, int b);\n" +"#ifdef _WIN32\n" /* dynamically linked data needs 'dllimport' */ +" __attribute__((dllimport))\n" +"#endif\n" +"extern const char hello[];\n" +"int fib(int n)\n" +"{\n" +" if (n <= 2)\n" +" return 1;\n" +" else\n" +" return fib(n-1) + fib(n-2);\n" +"}\n" +"\n" +"int foo(int n)\n" +"{\n" +" printf(\"%s\\n\", hello);\n" +" printf(\"fib(%d) = %d\\n\", n, fib(n));\n" +" printf(\"add(%d, %d) = %d\\n\", n, 2 * n, add(n, 2 * n));\n" +" return 0;\n" +"}\n"; + +int main(int argc, char **argv) +{ + TCCState *s; + int i; + int (*func)(int); + + s = tcc_new(); + if (!s) { + fprintf(stderr, "Could not create tcc state\n"); + exit(1); + } + + /* if tcclib.h and libtcc1.a are not installed, where can we find them */ + for (i = 1; i < argc; ++i) { + char *a = argv[i]; + if (a[0] == '-') { + if (a[1] == 'B') + tcc_set_lib_path(s, a+2); + else if (a[1] == 'I') + tcc_add_include_path(s, a+2); + else if (a[1] == 'L') + tcc_add_library_path(s, a+2); + } + } + + /* MUST BE CALLED before any compilation */ + tcc_set_output_type(s, TCC_OUTPUT_MEMORY); + + if (tcc_compile_string(s, my_program) == -1) + return 1; + + /* as a test, we add symbols that the compiled program can use. + You may also open a dll with tcc_add_dll() and use symbols from that */ + tcc_add_symbol(s, "add", add); + tcc_add_symbol(s, "hello", hello); + + /* relocate the code */ + if (tcc_relocate(s, TCC_RELOCATE_AUTO) < 0) + return 1; + + /* get entry symbol */ + func = tcc_get_symbol(s, "foo"); + if (!func) + return 1; + + /* run the code */ + func(32); + + /* delete the state */ + tcc_delete(s); + + return 0; +} diff --git a/overlay_toolchain/tcc/i386-win32-tcc.exe b/overlay_toolchain/tcc/i386-win32-tcc.exe new file mode 100644 index 00000000..9f985670 Binary files /dev/null and b/overlay_toolchain/tcc/i386-win32-tcc.exe differ diff --git a/overlay_toolchain/tcc/include/_mingw.h b/overlay_toolchain/tcc/include/_mingw.h new file mode 100644 index 00000000..2fc97987 --- /dev/null +++ b/overlay_toolchain/tcc/include/_mingw.h @@ -0,0 +1,170 @@ +/* + * _mingw.h + * + * This file is for TinyCC and not part of the Mingw32 package. + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +#ifndef __MINGW_H +#define __MINGW_H + +/* some winapi files define these before including _mingw.h --> */ +#undef __cdecl +#undef _X86_ +#undef WIN32 +/* <-- */ + +#include +#include + +#define __int8 char +#define __int16 short +#define __int32 int +#define __int64 long long +#define _HAVE_INT64 + +#define __cdecl +#define __declspec(x) __attribute__((x)) +#define __unaligned __attribute__((packed)) +#define __fastcall __attribute__((fastcall)) + +#define __MSVCRT__ 1 +#undef _MSVCRT_ +#define __MINGW_IMPORT extern __declspec(dllimport) +#define __MINGW_ATTRIB_NORETURN +#define __MINGW_ATTRIB_CONST +#define __MINGW_ATTRIB_DEPRECATED +#define __MINGW_ATTRIB_MALLOC +#define __MINGW_ATTRIB_PURE +#define __MINGW_ATTRIB_NONNULL(arg) +#define __MINGW_NOTHROW +#define __GNUC_VA_LIST + +#define _CRTIMP extern +#define __CRT_INLINE extern __inline__ + +#define _CRT_ALIGN(x) __attribute__((aligned(x))) +#define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) +#define _CRT_PACKING 8 +#define __CRT_UNALIGNED +#define _CONST_RETURN + +#ifndef _TRUNCATE +#define _TRUNCATE ((size_t)-1) +#endif + +#define __CRT_STRINGIZE(_Value) #_Value +#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value) +#define __CRT_WIDE(_String) L ## _String +#define _CRT_WIDE(_String) __CRT_WIDE(_String) + +#ifdef _WIN64 +#define __stdcall +#define _AMD64_ 1 +#define __x86_64 1 +#define _M_X64 100 /* Visual Studio */ +#define _M_AMD64 100 /* Visual Studio */ +#define USE_MINGW_SETJMP_TWO_ARGS +#define mingw_getsp tinyc_getbp +#define __TRY__ +#else +#define __stdcall __attribute__((__stdcall__)) +#define _X86_ 1 +#define _M_IX86 300 /* Visual Studio */ +#define WIN32 1 +#define _USE_32BIT_TIME_T +#ifdef __arm__ +#define __TRY__ +#else +#define __TRY__ void __try__(void**), *_sehrec[6]; __try__(_sehrec); +#endif +#endif + +/* in stddef.h */ +#define _SIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#define _PTRDIFF_T_DEFINED +#define _WCHAR_T_DEFINED +#define _UINTPTR_T_DEFINED +#define _INTPTR_T_DEFINED +#define _INTEGRAL_MAX_BITS 64 + +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED +typedef long __time32_t; +#endif + +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +typedef long long __time64_t; +#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T +typedef __time32_t time_t; +#else +typedef __time64_t time_t; +#endif +#endif + +#ifndef _WCTYPE_T_DEFINED +#define _WCTYPE_T_DEFINED +typedef wchar_t wctype_t; +#endif + +#ifndef _WINT_T +#define _WINT_T +typedef __WINT_TYPE__ wint_t; +#endif + +typedef int errno_t; +#define _ERRCODE_DEFINED + +typedef struct threadlocaleinfostruct *pthreadlocinfo; +typedef struct threadmbcinfostruct *pthreadmbcinfo; +typedef struct localeinfo_struct _locale_tstruct,*_locale_t; + +/* for winapi */ +#define _ANONYMOUS_UNION +#define _ANONYMOUS_STRUCT +#define DECLSPEC_NORETURN +#define DECLARE_STDCALL_P(type) __stdcall type +#define NOSERVICE 1 +#define NOMCX 1 +#define NOIME 1 +#define __INTRIN_H_ +#ifndef DUMMYUNIONNAME +# define DUMMYUNIONNAME +# define DUMMYUNIONNAME1 +# define DUMMYUNIONNAME2 +# define DUMMYUNIONNAME3 +# define DUMMYUNIONNAME4 +# define DUMMYUNIONNAME5 +#endif +#ifndef DUMMYSTRUCTNAME +# define DUMMYSTRUCTNAME +#endif +#ifndef WINVER +# define WINVER 0x0502 +#endif +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x502 +#endif + +#define __C89_NAMELESS +#define __MINGW_EXTENSION +#define WINAPI_FAMILY_PARTITION(X) 1 +#define MINGW_HAS_SECURE_API + +#endif /* __MINGW_H */ diff --git a/overlay_toolchain/tcc/include/assert.h b/overlay_toolchain/tcc/include/assert.h new file mode 100644 index 00000000..466d4571 --- /dev/null +++ b/overlay_toolchain/tcc/include/assert.h @@ -0,0 +1,57 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef __ASSERT_H_ +#define __ASSERT_H_ + +#include <_mingw.h> +#ifdef __cplusplus +#include +#endif + +#ifdef NDEBUG +#ifndef assert +#define assert(_Expression) ((void)0) +#endif +#else + +#ifndef _CRT_TERMINATE_DEFINED +#define _CRT_TERMINATE_DEFINED + void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; + _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; +#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ +/* C99 function name */ +void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; +__CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) +{ _exit(status); } +#endif + +#pragma push_macro("abort") +#undef abort + void __cdecl __declspec(noreturn) abort(void); +#pragma pop_macro("abort") + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line); +extern void __cdecl _assert(const char *, const char *, unsigned); + +#ifdef __cplusplus +} +#endif + +#ifndef assert +//#define assert(_Expression) (void)((!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0)) +#define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__)) +#endif + +#endif + +#endif diff --git a/overlay_toolchain/tcc/include/conio.h b/overlay_toolchain/tcc/include/conio.h new file mode 100644 index 00000000..39f779eb --- /dev/null +++ b/overlay_toolchain/tcc/include/conio.h @@ -0,0 +1,409 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_CONIO +#define _INC_CONIO + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP char *_cgets(char *_Buffer); + _CRTIMP int __cdecl _cprintf(const char *_Format,...); + _CRTIMP int __cdecl _cputs(const char *_Str); + _CRTIMP int __cdecl _cscanf(const char *_Format,...); + _CRTIMP int __cdecl _cscanf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _getch(void); + _CRTIMP int __cdecl _getche(void); + _CRTIMP int __cdecl _vcprintf(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_p(const char *_Format,...); + _CRTIMP int __cdecl _vcprintf_p(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_p_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _kbhit(void); + +#if defined(_X86_) && !defined(__x86_64) + int __cdecl _inp(unsigned short); + unsigned short __cdecl _inpw(unsigned short); + unsigned long __cdecl _inpd(unsigned short); + int __cdecl _outp(unsigned short,int); + unsigned short __cdecl _outpw(unsigned short,unsigned short); + unsigned long __cdecl _outpd(unsigned short,unsigned long); +#endif + + _CRTIMP int __cdecl _putch(int _Ch); + _CRTIMP int __cdecl _ungetch(int _Ch); + _CRTIMP int __cdecl _getch_nolock(void); + _CRTIMP int __cdecl _getche_nolock(void); + _CRTIMP int __cdecl _putch_nolock(int _Ch); + _CRTIMP int __cdecl _ungetch_nolock(int _Ch); + +#ifndef _WCONIO_DEFINED +#define _WCONIO_DEFINED + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + + _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _getwch(void); + _CRTIMP wint_t __cdecl _getwche(void); + _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh); + _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh); + _CRTIMP int __cdecl _cputws(const wchar_t *_String); + _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP wint_t __cdecl _putwch_nolock(wchar_t _WCh); + _CRTIMP wint_t __cdecl _getwch_nolock(void); + _CRTIMP wint_t __cdecl _getwche_nolock(void); + _CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh); +#endif + +#ifndef NO_OLDNAMES + char *__cdecl cgets(char *_Buffer); + int __cdecl cprintf(const char *_Format,...); + int __cdecl cputs(const char *_Str); + int __cdecl cscanf(const char *_Format,...); + int __cdecl getch(void); + int __cdecl getche(void); + int __cdecl kbhit(void); + int __cdecl putch(int _Ch); + int __cdecl ungetch(int _Ch); + +#if (defined(_X86_) && !defined(__x86_64)) + int __cdecl inp(unsigned short); + unsigned short __cdecl inpw(unsigned short); + int __cdecl outp(unsigned short,int); + unsigned short __cdecl outpw(unsigned short,unsigned short); +#endif + + /* I/O intrin functions. */ + __CRT_INLINE unsigned char __inbyte(unsigned short Port) + { + unsigned char value; + __asm__ __volatile__ ("inb %w1,%b0" + : "=a" (value) + : "Nd" (Port)); + return value; + } + __CRT_INLINE unsigned short __inword(unsigned short Port) + { + unsigned short value; + __asm__ __volatile__ ("inw %w1,%w0" + : "=a" (value) + : "Nd" (Port)); + return value; + } + __CRT_INLINE unsigned long __indword(unsigned short Port) + { + unsigned long value; + __asm__ __volatile__ ("inl %w1,%0" + : "=a" (value) + : "Nd" (Port)); + return value; + } + __CRT_INLINE void __outbyte(unsigned short Port,unsigned char Data) + { + __asm__ __volatile__ ("outb %b0,%w1" + : + : "a" (Data), "Nd" (Port)); + } + __CRT_INLINE void __outword(unsigned short Port,unsigned short Data) + { + __asm__ __volatile__ ("outw %w0,%w1" + : + : "a" (Data), "Nd" (Port)); + } + __CRT_INLINE void __outdword(unsigned short Port,unsigned long Data) + { + __asm__ __volatile__ ("outl %0,%w1" + : + : "a" (Data), "Nd" (Port)); + } + __CRT_INLINE void __inbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; insb " + : "=D" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + __CRT_INLINE void __inwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; insw " + : "=D" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + __CRT_INLINE void __indwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; insl " + : "=D" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + + __CRT_INLINE void __outbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; outsb " + : "=S" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + __CRT_INLINE void __outwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; outsw " + : "=S" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + __CRT_INLINE void __outdwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count) + { + __asm__ __volatile__ ( + "cld ; rep ; outsl " + : "=S" (Buffer), "=c" (Count) + : "d"(Port), "0"(Buffer), "1" (Count) + ); + } + + __CRT_INLINE unsigned __int64 __readcr0(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr0, %[value]" + : [value] "=q" (value)); + return value; + } + + /* Register sizes are different between 32/64 bit mode. So we have to do this for _WIN64 and _WIN32 + separately. */ + +#ifdef _WIN64 + __CRT_INLINE void __writecr0(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr0" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned __int64 __readcr2(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr2, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr2(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr2" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned __int64 __readcr3(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr3, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr3(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr3" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned __int64 __readcr4(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr4, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr4(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr4" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned __int64 __readcr8(void) + { + unsigned __int64 value; + __asm__ __volatile__ ( + "mov %%cr8, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr8(unsigned __int64 Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr8" + : + : [Data] "q" (Data) + : "memory"); + } + +#elif defined(_WIN32) + + __CRT_INLINE void __writecr0(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr0" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned long __readcr2(void) + { + unsigned long value; + __asm__ __volatile__ ( + "mov %%cr2, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr2(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr2" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned long __readcr3(void) + { + unsigned long value; + __asm__ __volatile__ ( + "mov %%cr3, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr3(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr3" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned long __readcr4(void) + { + unsigned long value; + __asm__ __volatile__ ( + "mov %%cr4, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr4(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr4" + : + : [Data] "q" (Data) + : "memory"); + } + + __CRT_INLINE unsigned long __readcr8(void) + { + unsigned long value; __asm__ __volatile__ ( + "mov %%cr8, %[value]" + : [value] "=q" (value)); + return value; + } + + __CRT_INLINE void __writecr8(unsigned Data) + { + __asm__ __volatile__ ( + "mov %[Data], %%cr8" + : + : [Data] "q" (Data) + : "memory"); + } + +#endif + + __CRT_INLINE unsigned __int64 __readmsr(unsigned long msr) + { + unsigned __int64 val1, val2; + __asm__ __volatile__( + "rdmsr" + : "=a" (val1), "=d" (val2) + : "c" (msr)); + return val1 | (val2 << 32); + } + + __CRT_INLINE void __writemsr (unsigned long msr, unsigned __int64 Value) + { + unsigned long val1 = Value, val2 = Value >> 32; + __asm__ __volatile__ ( + "wrmsr" + : + : "c" (msr), "a" (val1), "d" (val2)); + } + + __CRT_INLINE unsigned __int64 __rdtsc(void) + { + unsigned __int64 val1, val2; + __asm__ __volatile__ ( + "rdtsc" + : "=a" (val1), "=d" (val2)); + return val1 | (val2 << 32); + } + + __CRT_INLINE void __cpuid(int CPUInfo[4], int InfoType) + { + __asm__ __volatile__ ( + "cpuid" + : "=a" (CPUInfo [0]), "=b" (CPUInfo [1]), "=c" (CPUInfo [2]), "=d" (CPUInfo [3]) + : "a" (InfoType)); + } + +#endif + +#ifdef __cplusplus +} +#endif + +#include + +#endif diff --git a/overlay_toolchain/tcc/include/ctype.h b/overlay_toolchain/tcc/include/ctype.h new file mode 100644 index 00000000..7e901002 --- /dev/null +++ b/overlay_toolchain/tcc/include/ctype.h @@ -0,0 +1,281 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_CTYPE +#define _INC_CTYPE + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() +#ifdef _MSVCRT_ +#define __pctype_func() (_pctype) +#else +#define __pctype_func() (*_imp___pctype) +#endif +#endif + +#ifndef _pctype +#ifdef _MSVCRT_ + extern unsigned short *_pctype; +#else + extern unsigned short **_imp___pctype; +#define _pctype (*_imp___pctype) +#endif +#endif + +#endif +#endif + +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#ifndef _wctype +#ifdef _MSVCRT_ + extern unsigned short *_wctype; +#else + extern unsigned short **_imp___wctype; +#define _wctype (*_imp___wctype) +#endif +#endif +#ifdef _MSVCRT_ +#define __pwctype_func() (_pwctype) +#ifndef _pwctype + extern unsigned short *_pwctype; +#endif +#else +#define __pwctype_func() (*_imp___pwctype) +#ifndef _pwctype + extern unsigned short **_imp___pwctype; +#define _pwctype (*_imp___pwctype) +#endif +#endif +#endif +#endif + + /* CRT stuff */ +#if 1 + extern const unsigned char __newclmap[]; + extern const unsigned char __newcumap[]; + extern pthreadlocinfo __ptlocinfo; + extern pthreadmbcinfo __ptmbcinfo; + extern int __globallocalestatus; + extern int __locale_changed; + extern struct threadlocaleinfostruct __initiallocinfo; + extern _locale_tstruct __initiallocalestructinfo; + pthreadlocinfo __cdecl __updatetlocinfo(void); + pthreadmbcinfo __cdecl __updatetmbcinfo(void); +#endif + +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 + +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 + +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) + +#ifndef _CTYPE_DEFINED +#define _CTYPE_DEFINED + + _CRTIMP int __cdecl _isctype(int _C,int _Type); + _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); + _CRTIMP int __cdecl isalpha(int _C); + _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isupper(int _C); + _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl islower(int _C); + _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isdigit(int _C); + _CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isxdigit(int _C); + _CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isspace(int _C); + _CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl ispunct(int _C); + _CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isalnum(int _C); + _CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isprint(int _C); + _CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isgraph(int _C); + _CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl iscntrl(int _C); + _CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl toupper(int _C); + _CRTIMP int __cdecl tolower(int _C); + _CRTIMP int __cdecl _tolower(int _C); + _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _toupper(int _C); + _CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl __isascii(int _C); + _CRTIMP int __cdecl __toascii(int _C); + _CRTIMP int __cdecl __iscsymf(int _C); + _CRTIMP int __cdecl __iscsym(int _C); + +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) +int __cdecl isblank(int _C); +#endif +#endif + +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED + + int __cdecl iswalpha(wint_t _C); + _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); + int __cdecl iswupper(wint_t _C); + _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); + int __cdecl iswlower(wint_t _C); + _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswdigit(wint_t _C); + _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswxdigit(wint_t _C); + _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswspace(wint_t _C); + _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); + int __cdecl iswpunct(wint_t _C); + _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); + int __cdecl iswalnum(wint_t _C); + _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); + int __cdecl iswprint(wint_t _C); + _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); + int __cdecl iswgraph(wint_t _C); + _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); + int __cdecl iswcntrl(wint_t _C); + _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); + int __cdecl iswascii(wint_t _C); + int __cdecl isleadbyte(int _C); + _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); + wint_t __cdecl towupper(wint_t _C); + _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); + wint_t __cdecl towlower(wint_t _C); + _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswctype(wint_t _C,wctype_t _Type); + _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsymf(wint_t _C); + _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsym(wint_t _C); + _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); + int __cdecl is_wctype(wint_t _C,wctype_t _Type); + +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) +int __cdecl iswblank(wint_t _C); +#endif +#endif + +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef MB_CUR_MAX +#define MB_CUR_MAX ___mb_cur_max_func() +#ifndef __mb_cur_max +#ifdef _MSVCRT_ + extern int __mb_cur_max; +#else +#define __mb_cur_max (*_imp____mb_cur_max) + extern int *_imp____mb_cur_max; +#endif +#endif +#ifdef _MSVCRT_ +#define ___mb_cur_max_func() (__mb_cur_max) +#else +#define ___mb_cur_max_func() (*_imp____mb_cur_max) +#endif +#endif + +#define __chvalidchk(a,b) (__PCTYPE_FUNC[(a)] & (b)) +#define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[_Char] & (_Flag)) +#define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale)) +#define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale) +#define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale) +#define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale) +#define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale) +#define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale) +#define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale) +#define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale) +#define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale) +#define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale) +#define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale) +#define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale) +#define _tolower(_Char) ((_Char)-'A'+'a') +#define _toupper(_Char) ((_Char)-'a'+'A') +#define __isascii(_Char) ((unsigned)(_Char) < 0x80) +#define __toascii(_Char) ((_Char) & 0x7f) + +#ifndef _WCTYPE_INLINE_DEFINED +#define _WCTYPE_INLINE_DEFINED + +#undef _CRT_WCTYPE_NOINLINE +#ifndef __cplusplus +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) +#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) +#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) +#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) +#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) +#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) +#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) +#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) +#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) +#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) +#endif +#endif + +#define __iscsymf(_c) (isalpha(_c) || ((_c)=='_')) +#define __iscsym(_c) (isalnum(_c) || ((_c)=='_')) +#define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_')) +#define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_')) +#define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_')) +#define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_')) +#define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_')) +#define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_')) +#endif + +#ifndef NO_OLDNAMES +#ifndef _CTYPE_DEFINED + int __cdecl isascii(int _C); + int __cdecl toascii(int _C); + int __cdecl iscsymf(int _C); + int __cdecl iscsym(int _C); +#else +#define isascii __isascii +#define toascii __toascii +#define iscsymf __iscsymf +#define iscsym __iscsym +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/dir.h b/overlay_toolchain/tcc/include/dir.h new file mode 100644 index 00000000..f38f750d --- /dev/null +++ b/overlay_toolchain/tcc/include/dir.h @@ -0,0 +1,31 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * dir.h + * + * This file OBSOLESCENT and only provided for backward compatibility. + * Please use io.h instead. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * Mumit Khan + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +#include + diff --git a/overlay_toolchain/tcc/include/direct.h b/overlay_toolchain/tcc/include/direct.h new file mode 100644 index 00000000..99ce69db --- /dev/null +++ b/overlay_toolchain/tcc/include/direct.h @@ -0,0 +1,68 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_DIRECT +#define _INC_DIRECT + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _DISKFREE_T_DEFINED +#define _DISKFREE_T_DEFINED + struct _diskfree_t { + unsigned total_clusters; + unsigned avail_clusters; + unsigned sectors_per_cluster; + unsigned bytes_per_sector; + }; +#endif + + _CRTIMP char *__cdecl _getcwd(char *_DstBuf,int _SizeInBytes); + _CRTIMP char *__cdecl _getdcwd(int _Drive,char *_DstBuf,int _SizeInBytes); + char *__cdecl _getdcwd_nolock(int _Drive,char *_DstBuf,int _SizeInBytes); + _CRTIMP int __cdecl _chdir(const char *_Path); + _CRTIMP int __cdecl _mkdir(const char *_Path); + _CRTIMP int __cdecl _rmdir(const char *_Path); + _CRTIMP int __cdecl _chdrive(int _Drive); + _CRTIMP int __cdecl _getdrive(void); + _CRTIMP unsigned long __cdecl _getdrives(void); + +#ifndef _GETDISKFREE_DEFINED +#define _GETDISKFREE_DEFINED + _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); +#endif + +#ifndef _WDIRECT_DEFINED +#define _WDIRECT_DEFINED + _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); +#endif + +#ifndef NO_OLDNAMES + +#define diskfree_t _diskfree_t + + char *__cdecl getcwd(char *_DstBuf,int _SizeInBytes); + int __cdecl chdir(const char *_Path); + int __cdecl mkdir(const char *_Path); + int __cdecl rmdir(const char *_Path); +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/overlay_toolchain/tcc/include/dirent.h b/overlay_toolchain/tcc/include/dirent.h new file mode 100644 index 00000000..cd31f59e --- /dev/null +++ b/overlay_toolchain/tcc/include/dirent.h @@ -0,0 +1,135 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* All the headers include this file. */ +#include <_mingw.h> + +#ifndef __STRICT_ANSI__ + +#ifndef _DIRENT_H_ +#define _DIRENT_H_ + + +#pragma pack(push,_CRT_PACKING) + +#include + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + + struct dirent + { + long d_ino; /* Always zero. */ + unsigned short d_reclen; /* Always zero. */ + unsigned short d_namlen; /* Length of name in d_name. */ + char* d_name; /* File name. */ + /* NOTE: The name in the dirent structure points to the name in the + * finddata_t structure in the DIR. */ + }; + + /* + * This is an internal data structure. Good programmers will not use it + * except as an argument to one of the functions below. + * dd_stat field is now int (was short in older versions). + */ + typedef struct + { + /* disk transfer area for this dir */ + struct _finddata_t dd_dta; + + /* dirent struct to return from dir (NOTE: this makes this thread + * safe as long as only one thread uses a particular DIR struct at + * a time) */ + struct dirent dd_dir; + + /* _findnext handle */ + long dd_handle; + + /* + * Status of search: + * 0 = not started yet (next entry to read is first entry) + * -1 = off the end + * positive = 0 based index of next entry + */ + int dd_stat; + + /* given path for dir with search pattern (struct is extended) */ + char dd_name[1]; + } DIR; + + DIR* __cdecl opendir (const char*); + struct dirent* __cdecl readdir (DIR*); + int __cdecl closedir (DIR*); + void __cdecl rewinddir (DIR*); + long __cdecl telldir (DIR*); + void __cdecl seekdir (DIR*, long); + + + /* wide char versions */ + + struct _wdirent + { + long d_ino; /* Always zero. */ + unsigned short d_reclen; /* Always zero. */ + unsigned short d_namlen; /* Length of name in d_name. */ + wchar_t* d_name; /* File name. */ + /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */ + }; + + /* + * This is an internal data structure. Good programmers will not use it + * except as an argument to one of the functions below. + */ + typedef struct + { + /* disk transfer area for this dir */ + struct _wfinddata_t dd_dta; + + /* dirent struct to return from dir (NOTE: this makes this thread + * safe as long as only one thread uses a particular DIR struct at + * a time) */ + struct _wdirent dd_dir; + + /* _findnext handle */ + long dd_handle; + + /* + * Status of search: + * 0 = not started yet (next entry to read is first entry) + * -1 = off the end + * positive = 0 based index of next entry + */ + int dd_stat; + + /* given path for dir with search pattern (struct is extended) */ + wchar_t dd_name[1]; + } _WDIR; + + + + _WDIR* __cdecl _wopendir (const wchar_t*); + struct _wdirent* __cdecl _wreaddir (_WDIR*); + int __cdecl _wclosedir (_WDIR*); + void __cdecl _wrewinddir (_WDIR*); + long __cdecl _wtelldir (_WDIR*); + void __cdecl _wseekdir (_WDIR*, long); + + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#pragma pack(pop) + +#endif /* Not _DIRENT_H_ */ + + +#endif /* Not __STRICT_ANSI__ */ + diff --git a/overlay_toolchain/tcc/include/dos.h b/overlay_toolchain/tcc/include/dos.h new file mode 100644 index 00000000..294e8fe1 --- /dev/null +++ b/overlay_toolchain/tcc/include/dos.h @@ -0,0 +1,55 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_DOS +#define _INC_DOS + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _DISKFREE_T_DEFINED +#define _DISKFREE_T_DEFINED + + struct _diskfree_t { + unsigned total_clusters; + unsigned avail_clusters; + unsigned sectors_per_cluster; + unsigned bytes_per_sector; + }; +#endif + +#define _A_NORMAL 0x00 +#define _A_RDONLY 0x01 +#define _A_HIDDEN 0x02 +#define _A_SYSTEM 0x04 +#define _A_SUBDIR 0x10 +#define _A_ARCH 0x20 + +#ifndef _GETDISKFREE_DEFINED +#define _GETDISKFREE_DEFINED + _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); +#endif + +#if (defined(_X86_) && !defined(__x86_64)) + void __cdecl _disable(void); + void __cdecl _enable(void); +#endif + +#ifndef NO_OLDNAMES +#define diskfree_t _diskfree_t +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/overlay_toolchain/tcc/include/errno.h b/overlay_toolchain/tcc/include/errno.h new file mode 100644 index 00000000..c2df0158 --- /dev/null +++ b/overlay_toolchain/tcc/include/errno.h @@ -0,0 +1,75 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_ERRNO +#define _INC_ERRNO + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRT_ERRNO_DEFINED +#define _CRT_ERRNO_DEFINED + _CRTIMP extern int *__cdecl _errno(void); +#define errno (*_errno()) + + errno_t __cdecl _set_errno(int _Value); + errno_t __cdecl _get_errno(int *_Value); +#endif + +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define EDEADLK 36 +#define ENAMETOOLONG 38 +#define ENOLCK 39 +#define ENOSYS 40 +#define ENOTEMPTY 41 + +#ifndef RC_INVOKED +#if !defined(_SECURECRT_ERRCODE_VALUES_DEFINED) +#define _SECURECRT_ERRCODE_VALUES_DEFINED +#define EINVAL 22 +#define ERANGE 34 +#define EILSEQ 42 +#define STRUNCATE 80 +#endif +#endif + +#define EDEADLOCK EDEADLK + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/excpt.h b/overlay_toolchain/tcc/include/excpt.h new file mode 100644 index 00000000..26cc9437 --- /dev/null +++ b/overlay_toolchain/tcc/include/excpt.h @@ -0,0 +1,123 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_EXCPT +#define _INC_EXCPT + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + + struct _EXCEPTION_POINTERS; + +#ifndef EXCEPTION_DISPOSITION +#define EXCEPTION_DISPOSITION int +#endif +#define ExceptionContinueExecution 0 +#define ExceptionContinueSearch 1 +#define ExceptionNestedException 2 +#define ExceptionCollidedUnwind 3 + +#if (defined(_X86_) && !defined(__x86_64)) + struct _EXCEPTION_RECORD; + struct _CONTEXT; + + EXCEPTION_DISPOSITION __cdecl _except_handler(struct _EXCEPTION_RECORD *_ExceptionRecord,void *_EstablisherFrame,struct _CONTEXT *_ContextRecord,void *_DispatcherContext); +#elif defined(__ia64__) + + typedef struct _EXCEPTION_POINTERS *Exception_info_ptr; + struct _EXCEPTION_RECORD; + struct _CONTEXT; + struct _DISPATCHER_CONTEXT; + + _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler (struct _EXCEPTION_RECORD *_ExceptionRecord,unsigned __int64 _MemoryStackFp,unsigned __int64 _BackingStoreFp,struct _CONTEXT *_ContextRecord,struct _DISPATCHER_CONTEXT *_DispatcherContext,unsigned __int64 _GlobalPointer); +#elif defined(__x86_64) + + struct _EXCEPTION_RECORD; + struct _CONTEXT; +#endif + +#define GetExceptionCode _exception_code +#define exception_code _exception_code +#define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info +#define exception_info (struct _EXCEPTION_POINTERS *)_exception_info +#define AbnormalTermination _abnormal_termination +#define abnormal_termination _abnormal_termination + + unsigned long __cdecl _exception_code(void); + void *__cdecl _exception_info(void); + int __cdecl _abnormal_termination(void); + +#define EXCEPTION_EXECUTE_HANDLER 1 +#define EXCEPTION_CONTINUE_SEARCH 0 +#define EXCEPTION_CONTINUE_EXECUTION -1 + + /* CRT stuff */ + typedef void (__cdecl * _PHNDLR)(int); + + struct _XCPT_ACTION { + unsigned long XcptNum; + int SigNum; + _PHNDLR XcptAction; + }; + + extern struct _XCPT_ACTION _XcptActTab[]; + extern int _XcptActTabCount; + extern int _XcptActTabSize; + extern int _First_FPE_Indx; + extern int _Num_FPE; + + int __cdecl __CppXcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); + int __cdecl _XcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); + + /* + * The type of function that is expected as an exception handler to be + * installed with _try1. + */ + typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); + +#ifndef HAVE_NO_SEH + /* + * This is not entirely necessary, but it is the structure installed by + * the _try1 primitive below. + */ + typedef struct _EXCEPTION_REGISTRATION { + struct _EXCEPTION_REGISTRATION *prev; + EXCEPTION_DISPOSITION (*handler)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); + } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION; + + typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD; + typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD; +#endif + +#if (defined(_X86_) && !defined(__x86_64)) +#define __try1(pHandler) \ + __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler)); + +#define __except1 \ + __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \ + : : : "%eax"); +#elif defined(__x86_64) +#define __try1(pHandler) \ + __asm__ ("pushq %0;pushq %%gs:0;movq %%rsp,%%gs:0;" : : "g" (pHandler)); + +#define __except1 \ + __asm__ ("movq (%%rsp),%%rax;movq %%rax,%%gs:0;addq $16,%%rsp;" \ + : : : "%rax"); +#else +#define __try1(pHandler) +#define __except1 +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/overlay_toolchain/tcc/include/fcntl.h b/overlay_toolchain/tcc/include/fcntl.h new file mode 100644 index 00000000..9202b08c --- /dev/null +++ b/overlay_toolchain/tcc/include/fcntl.h @@ -0,0 +1,52 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#include + +#ifndef _INC_FCNTL +#define _INC_FCNTL + +#define _O_RDONLY 0x0000 +#define _O_WRONLY 0x0001 +#define _O_RDWR 0x0002 +#define _O_APPEND 0x0008 +#define _O_CREAT 0x0100 +#define _O_TRUNC 0x0200 +#define _O_EXCL 0x0400 +#define _O_TEXT 0x4000 +#define _O_BINARY 0x8000 +#define _O_WTEXT 0x10000 +#define _O_U16TEXT 0x20000 +#define _O_U8TEXT 0x40000 +#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) + +#define _O_RAW _O_BINARY +#define _O_NOINHERIT 0x0080 +#define _O_TEMPORARY 0x0040 +#define _O_SHORT_LIVED 0x1000 + +#define _O_SEQUENTIAL 0x0020 +#define _O_RANDOM 0x0010 + +#if !defined(NO_OLDNAMES) || defined(_POSIX) +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_APPEND _O_APPEND +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_EXCL _O_EXCL +#define O_TEXT _O_TEXT +#define O_BINARY _O_BINARY +#define O_RAW _O_BINARY +#define O_TEMPORARY _O_TEMPORARY +#define O_NOINHERIT _O_NOINHERIT +#define O_SEQUENTIAL _O_SEQUENTIAL +#define O_RANDOM _O_RANDOM +#define O_ACCMODE _O_ACCMODE +#endif +#endif diff --git a/overlay_toolchain/tcc/include/fenv.h b/overlay_toolchain/tcc/include/fenv.h new file mode 100644 index 00000000..258f3a5d --- /dev/null +++ b/overlay_toolchain/tcc/include/fenv.h @@ -0,0 +1,108 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _FENV_H_ +#define _FENV_H_ + +#include <_mingw.h> + +/* FPU status word exception flags */ +#define FE_INVALID 0x01 +#define FE_DENORMAL 0x02 +#define FE_DIVBYZERO 0x04 +#define FE_OVERFLOW 0x08 +#define FE_UNDERFLOW 0x10 +#define FE_INEXACT 0x20 +#define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \ + | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) + +/* FPU control word rounding flags */ +#define FE_TONEAREST 0x0000 +#define FE_DOWNWARD 0x0400 +#define FE_UPWARD 0x0800 +#define FE_TOWARDZERO 0x0c00 + +/* The MXCSR exception flags are the same as the + FE flags. */ +#define __MXCSR_EXCEPT_FLAG_SHIFT 0 + +/* How much to shift FE status word exception flags + to get MXCSR rounding flags, */ +#define __MXCSR_ROUND_FLAG_SHIFT 3 + +#ifndef RC_INVOKED +/* + For now, support only for the basic abstraction of flags that are + either set or clear. fexcept_t could be structure that holds more + info about the fp environment. +*/ +typedef unsigned short fexcept_t; + +/* This 32-byte struct represents the entire floating point + environment as stored by fnstenv or fstenv, augmented by + the contents of the MXCSR register, as stored by stmxcsr + (if CPU supports it). */ +typedef struct +{ + unsigned short __control_word; + unsigned short __unused0; + unsigned short __status_word; + unsigned short __unused1; + unsigned short __tag_word; + unsigned short __unused2; + unsigned int __ip_offset; /* instruction pointer offset */ + unsigned short __ip_selector; + unsigned short __opcode; + unsigned int __data_offset; + unsigned short __data_selector; + unsigned short __unused3; + unsigned int __mxcsr; /* contents of the MXCSR register */ +} fenv_t; + + +/*The C99 standard (7.6.9) allows us to define implementation-specific macros for + different fp environments */ + +/* The default Intel x87 floating point environment (64-bit mantissa) */ +#define FE_PC64_ENV ((const fenv_t *)-1) + +/* The floating point environment set by MSVCRT _fpreset (53-bit mantissa) */ +#define FE_PC53_ENV ((const fenv_t *)-2) + +/* The FE_DFL_ENV macro is required by standard. + fesetenv will use the environment set at app startup.*/ +#define FE_DFL_ENV ((const fenv_t *) 0) + +#ifdef __cplusplus +extern "C" { +#endif + +/*TODO: Some of these could be inlined */ +/* 7.6.2 Exception */ + +extern int __cdecl feclearexcept (int); +extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts); +extern int __cdecl feraiseexcept (int excepts ); +extern int __cdecl fesetexceptflag (const fexcept_t *, int); +extern int __cdecl fetestexcept (int excepts); + +/* 7.6.3 Rounding */ + +extern int __cdecl fegetround (void); +extern int __cdecl fesetround (int mode); + +/* 7.6.4 Environment */ + +extern int __cdecl fegetenv(fenv_t * envp); +extern int __cdecl fesetenv(const fenv_t * ); +extern int __cdecl feupdateenv(const fenv_t *); +extern int __cdecl feholdexcept(fenv_t *); + +#ifdef __cplusplus +} +#endif +#endif /* Not RC_INVOKED */ + +#endif /* ndef _FENV_H */ diff --git a/overlay_toolchain/tcc/include/float.h b/overlay_toolchain/tcc/include/float.h new file mode 100644 index 00000000..f16f1f0c --- /dev/null +++ b/overlay_toolchain/tcc/include/float.h @@ -0,0 +1,57 @@ +#ifndef _FLOAT_H_ +#define _FLOAT_H_ + +#define FLT_RADIX 2 + +/* IEEE float */ +#define FLT_MANT_DIG 24 +#define FLT_DIG 6 +#define FLT_ROUNDS 1 +#define FLT_EPSILON 1.19209290e-07F +#define FLT_MIN_EXP (-125) +#define FLT_MIN 1.17549435e-38F +#define FLT_MIN_10_EXP (-37) +#define FLT_MAX_EXP 128 +#define FLT_MAX 3.40282347e+38F +#define FLT_MAX_10_EXP 38 + +/* IEEE double */ +#define DBL_MANT_DIG 53 +#define DBL_DIG 15 +#define DBL_EPSILON 2.2204460492503131e-16 +#define DBL_MIN_EXP (-1021) +#define DBL_MIN 2.2250738585072014e-308 +#define DBL_MIN_10_EXP (-307) +#define DBL_MAX_EXP 1024 +#define DBL_MAX 1.7976931348623157e+308 +#define DBL_MAX_10_EXP 308 + +/* horrible intel long double */ +#if defined __i386__ || defined __x86_64__ + +#define LDBL_MANT_DIG 64 +#define LDBL_DIG 18 +#define LDBL_EPSILON 1.08420217248550443401e-19L +#define LDBL_MIN_EXP (-16381) +#define LDBL_MIN 3.36210314311209350626e-4932L +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_EXP 16384 +#define LDBL_MAX 1.18973149535723176502e+4932L +#define LDBL_MAX_10_EXP 4932 + +#else + +/* same as IEEE double */ +#define LDBL_MANT_DIG 53 +#define LDBL_DIG 15 +#define LDBL_EPSILON 2.2204460492503131e-16 +#define LDBL_MIN_EXP (-1021) +#define LDBL_MIN 2.2250738585072014e-308 +#define LDBL_MIN_10_EXP (-307) +#define LDBL_MAX_EXP 1024 +#define LDBL_MAX 1.7976931348623157e+308 +#define LDBL_MAX_10_EXP 308 + +#endif + +#endif /* _FLOAT_H_ */ diff --git a/overlay_toolchain/tcc/include/inttypes.h b/overlay_toolchain/tcc/include/inttypes.h new file mode 100644 index 00000000..73600919 --- /dev/null +++ b/overlay_toolchain/tcc/include/inttypes.h @@ -0,0 +1,297 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* 7.8 Format conversion of integer types */ + +#ifndef _INTTYPES_H_ +#define _INTTYPES_H_ + +#include <_mingw.h> +#include +#define __need_wchar_t +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + intmax_t quot; + intmax_t rem; + } imaxdiv_t; + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) + +/* 7.8.1 Macros for format specifiers + * + * MS runtime does not yet understand C9x standard "ll" + * length specifier. It appears to treat "ll" as "l". + * The non-standard I64 length specifier causes warning in GCC, + * but understood by MS runtime functions. + */ + +/* fprintf macros for signed types */ +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 "I64d" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "d" +#define PRIdLEAST64 "I64d" + +#define PRIdFAST8 "d" +#define PRIdFAST16 "d" +#define PRIdFAST32 "d" +#define PRIdFAST64 "I64d" + +#define PRIdMAX "I64d" + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 "I64i" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "i" +#define PRIiLEAST64 "I64i" + +#define PRIiFAST8 "i" +#define PRIiFAST16 "i" +#define PRIiFAST32 "i" +#define PRIiFAST64 "I64i" + +#define PRIiMAX "I64i" + +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 "I64o" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "o" +#define PRIoLEAST64 "I64o" + +#define PRIoFAST8 "o" +#define PRIoFAST16 "o" +#define PRIoFAST32 "o" +#define PRIoFAST64 "I64o" + +#define PRIoMAX "I64o" + +/* fprintf macros for unsigned types */ +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 "I64u" + + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "u" +#define PRIuLEAST64 "I64u" + +#define PRIuFAST8 "u" +#define PRIuFAST16 "u" +#define PRIuFAST32 "u" +#define PRIuFAST64 "I64u" + +#define PRIuMAX "I64u" + +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 "I64x" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "x" +#define PRIxLEAST64 "I64x" + +#define PRIxFAST8 "x" +#define PRIxFAST16 "x" +#define PRIxFAST32 "x" +#define PRIxFAST64 "I64x" + +#define PRIxMAX "I64x" + +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 "I64X" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "X" +#define PRIXLEAST64 "I64X" + +#define PRIXFAST8 "X" +#define PRIXFAST16 "X" +#define PRIXFAST32 "X" +#define PRIXFAST64 "I64X" + +#define PRIXMAX "I64X" + +/* + * fscanf macros for signed int types + * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t + * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have + * no length identifiers + */ + +#define SCNd16 "hd" +#define SCNd32 "d" +#define SCNd64 "I64d" + +#define SCNdLEAST16 "hd" +#define SCNdLEAST32 "d" +#define SCNdLEAST64 "I64d" + +#define SCNdFAST16 "hd" +#define SCNdFAST32 "d" +#define SCNdFAST64 "I64d" + +#define SCNdMAX "I64d" + +#define SCNi16 "hi" +#define SCNi32 "i" +#define SCNi64 "I64i" + +#define SCNiLEAST16 "hi" +#define SCNiLEAST32 "i" +#define SCNiLEAST64 "I64i" + +#define SCNiFAST16 "hi" +#define SCNiFAST32 "i" +#define SCNiFAST64 "I64i" + +#define SCNiMAX "I64i" + +#define SCNo16 "ho" +#define SCNo32 "o" +#define SCNo64 "I64o" + +#define SCNoLEAST16 "ho" +#define SCNoLEAST32 "o" +#define SCNoLEAST64 "I64o" + +#define SCNoFAST16 "ho" +#define SCNoFAST32 "o" +#define SCNoFAST64 "I64o" + +#define SCNoMAX "I64o" + +#define SCNx16 "hx" +#define SCNx32 "x" +#define SCNx64 "I64x" + +#define SCNxLEAST16 "hx" +#define SCNxLEAST32 "x" +#define SCNxLEAST64 "I64x" + +#define SCNxFAST16 "hx" +#define SCNxFAST32 "x" +#define SCNxFAST64 "I64x" + +#define SCNxMAX "I64x" + +/* fscanf macros for unsigned int types */ + +#define SCNu16 "hu" +#define SCNu32 "u" +#define SCNu64 "I64u" + +#define SCNuLEAST16 "hu" +#define SCNuLEAST32 "u" +#define SCNuLEAST64 "I64u" + +#define SCNuFAST16 "hu" +#define SCNuFAST32 "u" +#define SCNuFAST64 "I64u" + +#define SCNuMAX "I64u" + +#ifdef _WIN64 +#define PRIdPTR "I64d" +#define PRIiPTR "I64i" +#define PRIoPTR "I64o" +#define PRIuPTR "I64u" +#define PRIxPTR "I64x" +#define PRIXPTR "I64X" +#define SCNdPTR "I64d" +#define SCNiPTR "I64i" +#define SCNoPTR "I64o" +#define SCNxPTR "I64x" +#define SCNuPTR "I64u" +#else +#define PRIdPTR "d" +#define PRIiPTR "i" +#define PRIoPTR "o" +#define PRIuPTR "u" +#define PRIxPTR "x" +#define PRIXPTR "X" +#define SCNdPTR "d" +#define SCNiPTR "i" +#define SCNoPTR "o" +#define SCNxPTR "x" +#define SCNuPTR "u" +#endif + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +/* + * no length modifier for char types prior to C9x + * MS runtime scanf appears to treat "hh" as "h" + */ + +/* signed char */ +#define SCNd8 "hhd" +#define SCNdLEAST8 "hhd" +#define SCNdFAST8 "hhd" + +#define SCNi8 "hhi" +#define SCNiLEAST8 "hhi" +#define SCNiFAST8 "hhi" + +#define SCNo8 "hho" +#define SCNoLEAST8 "hho" +#define SCNoFAST8 "hho" + +#define SCNx8 "hhx" +#define SCNxLEAST8 "hhx" +#define SCNxFAST8 "hhx" + +/* unsigned char */ +#define SCNu8 "hhu" +#define SCNuLEAST8 "hhu" +#define SCNuFAST8 "hhu" +#endif /* __STDC_VERSION__ >= 199901 */ + +#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ + +intmax_t __cdecl imaxabs (intmax_t j); +__CRT_INLINE intmax_t __cdecl imaxabs (intmax_t j) + {return (j >= 0 ? j : -j);} +imaxdiv_t __cdecl imaxdiv (intmax_t numer, intmax_t denom); + +/* 7.8.2 Conversion functions for greatest-width integer types */ + +intmax_t __cdecl strtoimax (const char* __restrict__ nptr, + char** __restrict__ endptr, int base); +uintmax_t __cdecl strtoumax (const char* __restrict__ nptr, + char** __restrict__ endptr, int base); + +intmax_t __cdecl wcstoimax (const wchar_t* __restrict__ nptr, + wchar_t** __restrict__ endptr, int base); +uintmax_t __cdecl wcstoumax (const wchar_t* __restrict__ nptr, + wchar_t** __restrict__ endptr, int base); + +#ifdef __cplusplus +} +#endif + +#endif /* ndef _INTTYPES_H */ diff --git a/overlay_toolchain/tcc/include/io.h b/overlay_toolchain/tcc/include/io.h new file mode 100644 index 00000000..e2aeec3d --- /dev/null +++ b/overlay_toolchain/tcc/include/io.h @@ -0,0 +1,418 @@ + +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _IO_H_ +#define _IO_H_ + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifndef _POSIX_ + +#ifdef __cplusplus +extern "C" { +#endif + +_CRTIMP char* __cdecl _getcwd (char*, int); +#ifndef _FSIZE_T_DEFINED + typedef unsigned long _fsize_t; +#define _FSIZE_T_DEFINED +#endif + +#ifndef _FINDDATA_T_DEFINED + + struct _finddata32_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + _fsize_t size; + char name[260]; + }; + +/*#if _INTEGRAL_MAX_BITS >= 64*/ + + struct _finddata32i64_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + __int64 size; + char name[260]; + }; + + struct _finddata64i32_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + _fsize_t size; + char name[260]; + }; + + struct __finddata64_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + __int64 size; + char name[260]; + }; +/* #endif */ + +#ifdef _USE_32BIT_TIME_T +#define _finddata_t _finddata32_t +#define _finddatai64_t _finddata32i64_t + +#ifdef _WIN64 +#define _findfirst _findfirst32 +#define _findnext _findnext32 +#else +#define _findfirst32 _findfirst +#define _findnext32 _findnext +#endif +#define _findfirsti64 _findfirst32i64 +#define _findnexti64 _findnext32i64 +#else +#define _finddata_t _finddata64i32_t +#define _finddatai64_t __finddata64_t + +#define _findfirst _findfirst64i32 +#define _findnext _findnext64i32 +#define _findfirsti64 _findfirst64 +#define _findnexti64 _findnext64 +#endif + +#define _FINDDATA_T_DEFINED +#endif + +#ifndef _WFINDDATA_T_DEFINED + + struct _wfinddata32_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + _fsize_t size; + wchar_t name[260]; + }; + +/* #if _INTEGRAL_MAX_BITS >= 64 */ + + struct _wfinddata32i64_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + __int64 size; + wchar_t name[260]; + }; + + struct _wfinddata64i32_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + _fsize_t size; + wchar_t name[260]; + }; + + struct _wfinddata64_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + __int64 size; + wchar_t name[260]; + }; +/* #endif */ + +#ifdef _USE_32BIT_TIME_T +#define _wfinddata_t _wfinddata32_t +#define _wfinddatai64_t _wfinddata32i64_t + +#define _wfindfirst _wfindfirst32 +#define _wfindnext _wfindnext32 +#define _wfindfirsti64 _wfindfirst32i64 +#define _wfindnexti64 _wfindnext32i64 +#else +#define _wfinddata_t _wfinddata64i32_t +#define _wfinddatai64_t _wfinddata64_t + +#define _wfindfirst _wfindfirst64i32 +#define _wfindnext _wfindnext64i32 +#define _wfindfirsti64 _wfindfirst64 +#define _wfindnexti64 _wfindnext64 +#endif + +#define _WFINDDATA_T_DEFINED +#endif + +#define _A_NORMAL 0x00 +#define _A_RDONLY 0x01 +#define _A_HIDDEN 0x02 +#define _A_SYSTEM 0x04 +#define _A_SUBDIR 0x10 +#define _A_ARCH 0x20 + +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +#undef size_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int size_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 size_t; +#endif +#else + typedef unsigned int size_t; +#endif +#endif + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef int ssize_t; +#endif +#endif + +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif + +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int _off64_t __attribute__ ((mode (DI))); +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef int off64_t __attribute__ ((mode (DI))); +#endif +#else + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif +#endif + + /* Some defines for _access nAccessMode (MS doesn't define them, but + * it doesn't seem to hurt to add them). */ +#define F_OK 0 /* Check for file existence */ +#define X_OK 1 /* Check for execute permission. */ +#define W_OK 2 /* Check for write permission */ +#define R_OK 4 /* Check for read permission */ + + _CRTIMP int __cdecl _access(const char *_Filename,int _AccessMode); + _CRTIMP int __cdecl _chmod(const char *_Filename,int _Mode); + _CRTIMP int __cdecl _chsize(int _FileHandle,long _Size); + _CRTIMP int __cdecl _close(int _FileHandle); + _CRTIMP int __cdecl _commit(int _FileHandle); + _CRTIMP int __cdecl _creat(const char *_Filename,int _PermissionMode); + _CRTIMP int __cdecl _dup(int _FileHandle); + _CRTIMP int __cdecl _dup2(int _FileHandleSrc,int _FileHandleDst); + _CRTIMP int __cdecl _eof(int _FileHandle); + _CRTIMP long __cdecl _filelength(int _FileHandle); + _CRTIMP intptr_t __cdecl _findfirst32(const char *_Filename,struct _finddata32_t *_FindData); + _CRTIMP int __cdecl _findnext32(intptr_t _FindHandle,struct _finddata32_t *_FindData); + _CRTIMP int __cdecl _findclose(intptr_t _FindHandle); + _CRTIMP int __cdecl _isatty(int _FileHandle); + _CRTIMP int __cdecl _locking(int _FileHandle,int _LockMode,long _NumOfBytes); + _CRTIMP long __cdecl _lseek(int _FileHandle,long _Offset,int _Origin); + _off64_t lseek64(int fd,_off64_t offset, int whence); + _CRTIMP char *__cdecl _mktemp(char *_TemplateName); + _CRTIMP int __cdecl _pipe(int *_PtHandles,unsigned int _PipeSize,int _TextMode); + _CRTIMP int __cdecl _read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount); + +#ifndef _CRT_DIRECTORY_DEFINED +#define _CRT_DIRECTORY_DEFINED + int __cdecl remove(const char *_Filename); + int __cdecl rename(const char *_OldFilename,const char *_NewFilename); + _CRTIMP int __cdecl _unlink(const char *_Filename); +#ifndef NO_OLDNAMES + int __cdecl unlink(const char *_Filename); +#endif +#endif + + _CRTIMP int __cdecl _setmode(int _FileHandle,int _Mode); + _CRTIMP long __cdecl _tell(int _FileHandle); + _CRTIMP int __cdecl _umask(int _Mode); + _CRTIMP int __cdecl _write(int _FileHandle,const void *_Buf,unsigned int _MaxCharCount); + +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP __int64 __cdecl _filelengthi64(int _FileHandle); + _CRTIMP intptr_t __cdecl _findfirst32i64(const char *_Filename,struct _finddata32i64_t *_FindData); + _CRTIMP intptr_t __cdecl _findfirst64(const char *_Filename,struct __finddata64_t *_FindData); +#ifdef __cplusplus +#include +#endif + intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData); + __CRT_INLINE intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData) + { + struct __finddata64_t fd; + intptr_t ret = _findfirst64(_Filename,&fd); + _FindData->attrib=fd.attrib; + _FindData->time_create=fd.time_create; + _FindData->time_access=fd.time_access; + _FindData->time_write=fd.time_write; + _FindData->size=(_fsize_t) fd.size; + strncpy(_FindData->name,fd.name,260); + return ret; + } + _CRTIMP int __cdecl _findnext32i64(intptr_t _FindHandle,struct _finddata32i64_t *_FindData); + _CRTIMP int __cdecl _findnext64(intptr_t _FindHandle,struct __finddata64_t *_FindData); + int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData); + __CRT_INLINE int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData) + { + struct __finddata64_t fd; + int ret = _findnext64(_FindHandle,&fd); + _FindData->attrib=fd.attrib; + _FindData->time_create=fd.time_create; + _FindData->time_access=fd.time_access; + _FindData->time_write=fd.time_write; + _FindData->size=(_fsize_t) fd.size; + strncpy(_FindData->name,fd.name,260); + return ret; + } + __int64 __cdecl _lseeki64(int _FileHandle,__int64 _Offset,int _Origin); + __int64 __cdecl _telli64(int _FileHandle); +#endif +#ifndef NO_OLDNAMES + +#ifndef _UWIN + int __cdecl chdir (const char *); + char *__cdecl getcwd (char *, int); + int __cdecl mkdir (const char *); + char *__cdecl mktemp(char *); + int __cdecl rmdir (const char*); + int __cdecl chmod (const char *, int); +#endif /* _UWIN */ + +#endif /* Not NO_OLDNAMES */ + + _CRTIMP errno_t __cdecl _sopen_s(int *_FileHandle,const char *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode); + +#ifndef __cplusplus + _CRTIMP int __cdecl _open(const char *_Filename,int _OpenFlag,...); + _CRTIMP int __cdecl _sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...); +#else + extern "C++" _CRTIMP int __cdecl _open(const char *_Filename,int _Openflag,int _PermissionMode = 0); + extern "C++" _CRTIMP int __cdecl _sopen(const char *_Filename,int _Openflag,int _ShareFlag,int _PermissionMode = 0); +#endif + +#ifndef _WIO_DEFINED +#define _WIO_DEFINED + _CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode); + _CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode); + _CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode); + _CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wunlink(const wchar_t *_Filename); + _CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename); + _CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName); + +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData); + intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData); + _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData); + _CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData); + int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData); + _CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData); +#endif + + _CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag); + +#if !defined(__cplusplus) || !(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,...); + _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...); +#else + extern "C++" _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,int _PermissionMode = 0); + extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0); +#endif + +#endif + + int __cdecl __lock_fhandle(int _Filehandle); + void __cdecl _unlock_fhandle(int _Filehandle); + _CRTIMP intptr_t __cdecl _get_osfhandle(int _FileHandle); + _CRTIMP int __cdecl _open_osfhandle(intptr_t _OSFileHandle,int _Flags); + +#ifndef NO_OLDNAMES + int __cdecl access(const char *_Filename,int _AccessMode); + int __cdecl chmod(const char *_Filename,int _AccessMode); + int __cdecl chsize(int _FileHandle,long _Size); + int __cdecl close(int _FileHandle); + int __cdecl creat(const char *_Filename,int _PermissionMode); + int __cdecl dup(int _FileHandle); + int __cdecl dup2(int _FileHandleSrc,int _FileHandleDst); + int __cdecl eof(int _FileHandle); + long __cdecl filelength(int _FileHandle); + int __cdecl isatty(int _FileHandle); + int __cdecl locking(int _FileHandle,int _LockMode,long _NumOfBytes); + long __cdecl lseek(int _FileHandle,long _Offset,int _Origin); + char *__cdecl mktemp(char *_TemplateName); + int __cdecl open(const char *_Filename,int _OpenFlag,...); + int __cdecl read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount); + int __cdecl setmode(int _FileHandle,int _Mode); + int __cdecl sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...); + long __cdecl tell(int _FileHandle); + int __cdecl umask(int _Mode); + int __cdecl write(int _Filehandle,const void *_Buf,unsigned int _MaxCharCount); +#endif + +#ifdef __cplusplus +} +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Misc stuff */ +char *getlogin(void); +#ifdef __USE_MINGW_ALARM +unsigned int alarm(unsigned int seconds); +#endif + +#ifdef __USE_MINGW_ACCESS +/* Old versions of MSVCRT access() just ignored X_OK, while the version + shipped with Vista, returns an error code. This will restore the + old behaviour */ +static inline int __mingw_access (const char *__fname, int __mode) { + return _access (__fname, __mode & ~X_OK); +} + +#define access(__f,__m) __mingw_access (__f, __m) +#endif + + +#ifdef __cplusplus +} +#endif + + +#pragma pack(pop) + +#include + +#endif /* End _IO_H_ */ + diff --git a/overlay_toolchain/tcc/include/limits.h b/overlay_toolchain/tcc/include/limits.h new file mode 100644 index 00000000..fafb04a4 --- /dev/null +++ b/overlay_toolchain/tcc/include/limits.h @@ -0,0 +1,111 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#ifndef _INC_LIMITS +#define _INC_LIMITS + +/* +* File system limits +* +* TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the +* same as FILENAME_MAX and FOPEN_MAX from stdio.h? +* NOTE: Apparently the actual size of PATH_MAX is 260, but a space is +* required for the NUL. TODO: Test? +*/ +#define PATH_MAX (259) + +#define CHAR_BIT 8 +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 +#define UCHAR_MAX 0xff + +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX + +#define MB_LEN_MAX 5 +#define SHRT_MIN (-32768) +#define SHRT_MAX 32767 +#define USHRT_MAX 0xffff +#define INT_MIN (-2147483647 - 1) +#define INT_MAX 2147483647 +#define UINT_MAX 0xffffffff +#define LONG_MIN (-2147483647L - 1) +#define LONG_MAX 2147483647L +#define ULONG_MAX 0xffffffffUL +#define LLONG_MAX 9223372036854775807ll +#define LLONG_MIN (-9223372036854775807ll - 1) +#define ULLONG_MAX 0xffffffffffffffffull + +#if _INTEGRAL_MAX_BITS >= 8 +#define _I8_MIN (-127 - 1) +#define _I8_MAX 127i8 +#define _UI8_MAX 0xffu +#endif + +#if _INTEGRAL_MAX_BITS >= 16 +#define _I16_MIN (-32767 - 1) +#define _I16_MAX 32767i16 +#define _UI16_MAX 0xffffu +#endif + +#if _INTEGRAL_MAX_BITS >= 32 +#define _I32_MIN (-2147483647 - 1) +#define _I32_MAX 2147483647 +#define _UI32_MAX 0xffffffffu +#endif + +#if defined(__GNUC__) +#undef LONG_LONG_MAX +#define LONG_LONG_MAX 9223372036854775807ll +#undef LONG_LONG_MIN +#define LONG_LONG_MIN (-LONG_LONG_MAX-1) +#undef ULONG_LONG_MAX +#define ULONG_LONG_MAX (2ull * LONG_LONG_MAX + 1ull) +#endif + +#if _INTEGRAL_MAX_BITS >= 64 +#define _I64_MIN (-9223372036854775807ll - 1) +#define _I64_MAX 9223372036854775807ll +#define _UI64_MAX 0xffffffffffffffffull +#endif + +#ifndef SIZE_MAX +#ifdef _WIN64 +#define SIZE_MAX _UI64_MAX +#else +#define SIZE_MAX UINT_MAX +#endif +#endif + +#ifdef _POSIX_ +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 6 +#define _POSIX_LINK_MAX 8 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_NAME_MAX 14 +#define _POSIX_NGROUPS_MAX 0 +#define _POSIX_OPEN_MAX 16 +#define _POSIX_PATH_MAX 255 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_TZNAME_MAX 3 +#define ARG_MAX 14500 +#define LINK_MAX 1024 +#define MAX_CANON _POSIX_MAX_CANON +#define MAX_INPUT _POSIX_MAX_INPUT +#define NAME_MAX 255 +#define NGROUPS_MAX 16 +#define OPEN_MAX 32 +#define PATH_MAX 512 +#define PIPE_BUF _POSIX_PIPE_BUF +#define SSIZE_MAX _POSIX_SSIZE_MAX +#define STREAM_MAX 20 +#define TZNAME_MAX 10 +#endif +#endif diff --git a/overlay_toolchain/tcc/include/locale.h b/overlay_toolchain/tcc/include/locale.h new file mode 100644 index 00000000..686aa9ba --- /dev/null +++ b/overlay_toolchain/tcc/include/locale.h @@ -0,0 +1,91 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_LOCALE +#define _INC_LOCALE + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_MONETARY 3 +#define LC_NUMERIC 4 +#define LC_TIME 5 + +#define LC_MIN LC_ALL +#define LC_MAX LC_TIME + +#ifndef _LCONV_DEFINED +#define _LCONV_DEFINED + struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + }; +#endif + +#ifndef _CONFIG_LOCALE_SWT +#define _CONFIG_LOCALE_SWT + +#define _ENABLE_PER_THREAD_LOCALE 0x1 +#define _DISABLE_PER_THREAD_LOCALE 0x2 +#define _ENABLE_PER_THREAD_LOCALE_GLOBAL 0x10 +#define _DISABLE_PER_THREAD_LOCALE_GLOBAL 0x20 +#define _ENABLE_PER_THREAD_LOCALE_NEW 0x100 +#define _DISABLE_PER_THREAD_LOCALE_NEW 0x200 + +#endif + + int __cdecl _configthreadlocale(int _Flag); + char *__cdecl setlocale(int _Category,const char *_Locale); + _CRTIMP struct lconv *__cdecl localeconv(void); + _locale_t __cdecl _get_current_locale(void); + _locale_t __cdecl _create_locale(int _Category,const char *_Locale); + void __cdecl _free_locale(_locale_t _Locale); + _locale_t __cdecl __get_current_locale(void); + _locale_t __cdecl __create_locale(int _Category,const char *_Locale); + void __cdecl __free_locale(_locale_t _Locale); + +#ifndef _WLOCALE_DEFINED +#define _WLOCALE_DEFINED + _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/overlay_toolchain/tcc/include/malloc.h b/overlay_toolchain/tcc/include/malloc.h new file mode 100644 index 00000000..fc783a8e --- /dev/null +++ b/overlay_toolchain/tcc/include/malloc.h @@ -0,0 +1,181 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _MALLOC_H_ +#define _MALLOC_H_ + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifndef _MM_MALLOC_H_INCLUDED +#define _MM_MALLOC_H_INCLUDED +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN64 +#define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0 +#else +#define _HEAP_MAXREQ 0xFFFFFFE0 +#endif + +#ifndef _STATIC_ASSERT +#define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1]) +#endif + +/* Return codes for _heapwalk() */ +#define _HEAPEMPTY (-1) +#define _HEAPOK (-2) +#define _HEAPBADBEGIN (-3) +#define _HEAPBADNODE (-4) +#define _HEAPEND (-5) +#define _HEAPBADPTR (-6) + +/* Values for _heapinfo.useflag */ +#define _FREEENTRY 0 +#define _USEDENTRY 1 + +#ifndef _HEAPINFO_DEFINED +#define _HEAPINFO_DEFINED + /* The structure used to walk through the heap with _heapwalk. */ + typedef struct _heapinfo { + int *_pentry; + size_t _size; + int _useflag; + } _HEAPINFO; +#endif + + extern unsigned int _amblksiz; + +#define _mm_free(a) _aligned_free(a) +#define _mm_malloc(a,b) _aligned_malloc(a,b) + +#ifndef _CRT_ALLOCATION_DEFINED +#define _CRT_ALLOCATION_DEFINED + void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements); + void __cdecl free(void *_Memory); + void *__cdecl malloc(size_t _Size); + void *__cdecl realloc(void *_Memory,size_t _NewSize); + _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size); + /* _CRTIMP void __cdecl _aligned_free(void *_Memory); + _CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment); */ + _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset); +#endif + +#define _MAX_WAIT_MALLOC_CRT 60000 + + _CRTIMP int __cdecl _resetstkoflw (void); + _CRTIMP unsigned long __cdecl _set_malloc_crt_max_wait(unsigned long _NewValue); + + _CRTIMP void *__cdecl _expand(void *_Memory,size_t _NewSize); + _CRTIMP size_t __cdecl _msize(void *_Memory); +#ifdef __GNUC__ +#undef _alloca +#define _alloca(x) __builtin_alloca((x)) +#else + /* tcc implements alloca internally and exposes it (since commit d778bde7). + /* alloca is declared at include/stddef.h (which is distributed with tcc). + */ +#ifdef _alloca +#undef _alloca +#endif +#define _alloca(x) alloca((x)) +#endif + _CRTIMP size_t __cdecl _get_sbh_threshold(void); + _CRTIMP int __cdecl _set_sbh_threshold(size_t _NewValue); + _CRTIMP errno_t __cdecl _set_amblksiz(size_t _Value); + _CRTIMP errno_t __cdecl _get_amblksiz(size_t *_Value); + _CRTIMP int __cdecl _heapadd(void *_Memory,size_t _Size); + _CRTIMP int __cdecl _heapchk(void); + _CRTIMP int __cdecl _heapmin(void); + _CRTIMP int __cdecl _heapset(unsigned int _Fill); + _CRTIMP int __cdecl _heapwalk(_HEAPINFO *_EntryInfo); + _CRTIMP size_t __cdecl _heapused(size_t *_Used,size_t *_Commit); + _CRTIMP intptr_t __cdecl _get_heap_handle(void); + +#define _ALLOCA_S_THRESHOLD 1024 +#define _ALLOCA_S_STACK_MARKER 0xCCCC +#define _ALLOCA_S_HEAP_MARKER 0xDDDD + +#if(defined(_X86_) && !defined(__x86_64)) +#define _ALLOCA_S_MARKER_SIZE 8 +#elif defined(__ia64__) || defined(__x86_64) +#define _ALLOCA_S_MARKER_SIZE 16 +#endif + +#if !defined(RC_INVOKED) + static __inline void *_MarkAllocaS(void *_Ptr,unsigned int _Marker) { + if(_Ptr) { + *((unsigned int*)_Ptr) = _Marker; + _Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE; + } + return _Ptr; + } +#endif + +#undef _malloca +#define _malloca(size) \ + ((((size) + _ALLOCA_S_MARKER_SIZE) <= _ALLOCA_S_THRESHOLD) ? \ + _MarkAllocaS(_alloca((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_STACK_MARKER) : \ + _MarkAllocaS(malloc((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_HEAP_MARKER)) +#undef _FREEA_INLINE +#define _FREEA_INLINE + +#ifndef RC_INVOKED +#undef _freea + static __inline void __cdecl _freea(void *_Memory) { + unsigned int _Marker; + if(_Memory) { + _Memory = (char*)_Memory - _ALLOCA_S_MARKER_SIZE; + _Marker = *(unsigned int *)_Memory; + if(_Marker==_ALLOCA_S_HEAP_MARKER) { + free(_Memory); + } +#ifdef _ASSERTE + else if(_Marker!=_ALLOCA_S_STACK_MARKER) { + _ASSERTE(("Corrupted pointer passed to _freea",0)); + } +#endif + } + } +#endif /* RC_INVOKED */ + +#ifndef NO_OLDNAMES +#ifdef __GNUC__ +#undef alloca +#define alloca(x) __builtin_alloca((x)) +#endif +#endif + +#ifdef HEAPHOOK +#ifndef _HEAPHOOK_DEFINED +#define _HEAPHOOK_DEFINED + typedef int (__cdecl *_HEAPHOOK)(int,size_t,void *,void **); +#endif + + _CRTIMP _HEAPHOOK __cdecl _setheaphook(_HEAPHOOK _NewHook); + +#define _HEAP_MALLOC 1 +#define _HEAP_CALLOC 2 +#define _HEAP_FREE 3 +#define _HEAP_REALLOC 4 +#define _HEAP_MSIZE 5 +#define _HEAP_EXPAND 6 +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#endif /* _MALLOC_H_ */ diff --git a/overlay_toolchain/tcc/include/math.h b/overlay_toolchain/tcc/include/math.h new file mode 100644 index 00000000..74add20e --- /dev/null +++ b/overlay_toolchain/tcc/include/math.h @@ -0,0 +1,737 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _MATH_H_ +#define _MATH_H_ + +#if __GNUC__ >= 3 +#pragma GCC system_header +#endif + +#include <_mingw.h> + +struct exception; + +#pragma pack(push,_CRT_PACKING) + +#define _DOMAIN 1 +#define _SING 2 +#define _OVERFLOW 3 +#define _UNDERFLOW 4 +#define _TLOSS 5 +#define _PLOSS 6 + +#ifndef __STRICT_ANSI__ +#ifndef NO_OLDNAMES +#define DOMAIN _DOMAIN +#define SING _SING +#define OVERFLOW _OVERFLOW +#define UNDERFLOW _UNDERFLOW +#define TLOSS _TLOSS +#define PLOSS _PLOSS +#endif +#endif + +#ifndef __STRICT_ANSI__ +#define M_E 2.71828182845904523536 +#define M_LOG2E 1.44269504088896340736 +#define M_LOG10E 0.434294481903251827651 +#define M_LN2 0.693147180559945309417 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.785398163397448309616 +#define M_1_PI 0.318309886183790671538 +#define M_2_PI 0.636619772367581343076 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.707106781186547524401 +#endif + +#ifndef __STRICT_ANSI__ +/* See also float.h */ +#ifndef __MINGW_FPCLASS_DEFINED +#define __MINGW_FPCLASS_DEFINED 1 +#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ +#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ +#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ +#define _FPCLASS_NN 0x0008 /* Negative Normal */ +#define _FPCLASS_ND 0x0010 /* Negative Denormal */ +#define _FPCLASS_NZ 0x0020 /* Negative Zero */ +#define _FPCLASS_PZ 0x0040 /* Positive Zero */ +#define _FPCLASS_PD 0x0080 /* Positive Denormal */ +#define _FPCLASS_PN 0x0100 /* Positive Normal */ +#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _EXCEPTION_DEFINED +#define _EXCEPTION_DEFINED + struct _exception { + int type; + char *name; + double arg1; + double arg2; + double retval; + }; +#endif + +#ifndef _COMPLEX_DEFINED +#define _COMPLEX_DEFINED + struct _complex { + double x,y; + }; +#endif + +#define EDOM 33 +#define ERANGE 34 + +#ifndef _HUGE +#ifdef _MSVCRT_ + extern double *_HUGE; +#else + extern double *_imp___HUGE; +#define _HUGE (*_imp___HUGE) +#endif +#endif + +#define HUGE_VAL _HUGE + +#ifndef _CRT_ABS_DEFINED +#define _CRT_ABS_DEFINED + int __cdecl abs(int _X); + long __cdecl labs(long _X); +#endif + double __cdecl acos(double _X); + double __cdecl asin(double _X); + double __cdecl atan(double _X); + double __cdecl atan2(double _Y,double _X); +#ifndef _SIGN_DEFINED +#define _SIGN_DEFINED + _CRTIMP double __cdecl _copysign (double _Number,double _Sign); + _CRTIMP double __cdecl _chgsign (double _X); +#endif + double __cdecl cos(double _X); + double __cdecl cosh(double _X); + double __cdecl exp(double _X); + double __cdecl expm1(double _X); + double __cdecl fabs(double _X); + double __cdecl fmod(double _X,double _Y); + double __cdecl log(double _X); + double __cdecl log10(double _X); + double __cdecl pow(double _X,double _Y); + double __cdecl sin(double _X); + double __cdecl sinh(double _X); + double __cdecl tan(double _X); + double __cdecl tanh(double _X); + double __cdecl sqrt(double _X); +#ifndef _CRT_ATOF_DEFINED +#define _CRT_ATOF_DEFINED + double __cdecl atof(const char *_String); + double __cdecl _atof_l(const char *_String,_locale_t _Locale); +#endif + + _CRTIMP double __cdecl _cabs(struct _complex _ComplexA); + double __cdecl ceil(double _X); + double __cdecl floor(double _X); + double __cdecl frexp(double _X,int *_Y); + double __cdecl _hypot(double _X,double _Y); + _CRTIMP double __cdecl _j0(double _X); + _CRTIMP double __cdecl _j1(double _X); + _CRTIMP double __cdecl _jn(int _X,double _Y); + double __cdecl ldexp(double _X,int _Y); +#ifndef _CRT_MATHERR_DEFINED +#define _CRT_MATHERR_DEFINED + int __cdecl _matherr(struct _exception *_Except); +#endif + double __cdecl modf(double _X,double *_Y); + _CRTIMP double __cdecl _y0(double _X); + _CRTIMP double __cdecl _y1(double _X); + _CRTIMP double __cdecl _yn(int _X,double _Y); + +#if(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _set_SSE2_enable(int _Flag); + /* from libmingwex */ + float __cdecl _hypotf(float _X,float _Y); +#endif + + float frexpf(float _X,int *_Y); + float __cdecl ldexpf(float _X,int _Y); + long double __cdecl ldexpl(long double _X,int _Y); + float __cdecl acosf(float _X); + float __cdecl asinf(float _X); + float __cdecl atanf(float _X); + float __cdecl atan2f(float _X,float _Y); + float __cdecl cosf(float _X); + float __cdecl sinf(float _X); + float __cdecl tanf(float _X); + float __cdecl coshf(float _X); + float __cdecl sinhf(float _X); + float __cdecl tanhf(float _X); + float __cdecl expf(float _X); + float __cdecl expm1f(float _X); + float __cdecl logf(float _X); + float __cdecl log10f(float _X); + float __cdecl modff(float _X,float *_Y); + float __cdecl powf(float _X,float _Y); + float __cdecl sqrtf(float _X); + float __cdecl ceilf(float _X); + float __cdecl floorf(float _X); + float __cdecl fmodf(float _X,float _Y); + float __cdecl _hypotf(float _X,float _Y); + float __cdecl fabsf(float _X); +#if !defined(__ia64__) + /* from libmingwex */ + float __cdecl _copysignf (float _Number,float _Sign); + float __cdecl _chgsignf (float _X); + float __cdecl _logbf(float _X); + float __cdecl _nextafterf(float _X,float _Y); + int __cdecl _finitef(float _X); + int __cdecl _isnanf(float _X); + int __cdecl _fpclassf(float _X); +#endif + +#ifndef __cplusplus + __CRT_INLINE long double __cdecl fabsl (long double x) + { + long double res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } +#define _hypotl(x,y) ((long double)_hypot((double)(x),(double)(y))) +#define _matherrl _matherr + __CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign((double)(_Number)); } + __CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign((double)(_Number),(double)(_Sign)); } + __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); } + +#if !defined (__ia64__) + __CRT_INLINE float __cdecl fabsf (float x) + { + float res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + + __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); } +#endif +#else + // cplusplus + __CRT_INLINE long double __cdecl fabsl (long double x) + { + long double res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + __CRT_INLINE long double modfl(long double _X,long double *_Y) { + double _Di,_Df = modf((double)_X,&_Di); + *_Y = (long double)_Di; + return (_Df); + } + __CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign(static_cast(_Number)); } + __CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign(static_cast(_Number),static_cast(_Sign)); } + __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); } +#ifndef __ia64__ + __CRT_INLINE float __cdecl fabsf (float x) + { + float res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); } +#ifndef __x86_64 + __CRT_INLINE float acosf(float _X) { return ((float)acos((double)_X)); } + __CRT_INLINE float asinf(float _X) { return ((float)asin((double)_X)); } + __CRT_INLINE float atanf(float _X) { return ((float)atan((double)_X)); } + __CRT_INLINE float atan2f(float _X,float _Y) { return ((float)atan2((double)_X,(double)_Y)); } + __CRT_INLINE float ceilf(float _X) { return ((float)ceil((double)_X)); } + __CRT_INLINE float cosf(float _X) { return ((float)cos((double)_X)); } + __CRT_INLINE float coshf(float _X) { return ((float)cosh((double)_X)); } + __CRT_INLINE float expf(float _X) { return ((float)exp((double)_X)); } + __CRT_INLINE float floorf(float _X) { return ((float)floor((double)_X)); } + __CRT_INLINE float fmodf(float _X,float _Y) { return ((float)fmod((double)_X,(double)_Y)); } + __CRT_INLINE float logf(float _X) { return ((float)log((double)_X)); } + __CRT_INLINE float log10f(float _X) { return ((float)log10((double)_X)); } + __CRT_INLINE float modff(float _X,float *_Y) { + double _Di,_Df = modf((double)_X,&_Di); + *_Y = (float)_Di; + return ((float)_Df); + } + __CRT_INLINE float powf(float _X,float _Y) { return ((float)pow((double)_X,(double)_Y)); } + __CRT_INLINE float sinf(float _X) { return ((float)sin((double)_X)); } + __CRT_INLINE float sinhf(float _X) { return ((float)sinh((double)_X)); } + __CRT_INLINE float sqrtf(float _X) { return ((float)sqrt((double)_X)); } + __CRT_INLINE float tanf(float _X) { return ((float)tan((double)_X)); } + __CRT_INLINE float tanhf(float _X) { return ((float)tanh((double)_X)); } +#endif +#endif +#endif + +#ifndef NO_OLDNAMES +#define matherr _matherr + +#define HUGE _HUGE + /* double __cdecl cabs(struct _complex _X); */ + double __cdecl hypot(double _X,double _Y); + _CRTIMP double __cdecl j0(double _X); + _CRTIMP double __cdecl j1(double _X); + _CRTIMP double __cdecl jn(int _X,double _Y); + _CRTIMP double __cdecl y0(double _X); + _CRTIMP double __cdecl y1(double _X); + _CRTIMP double __cdecl yn(int _X,double _Y); +#endif + +#ifndef __NO_ISOCEXT +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ + || !defined __STRICT_ANSI__ || defined __GLIBCPP__ + +#define NAN (0.0F/0.0F) +#define HUGE_VALF (1.0F/0.0F) +#define HUGE_VALL (1.0L/0.0L) +#define INFINITY (1.0F/0.0F) + + +#define FP_NAN 0x0100 +#define FP_NORMAL 0x0400 +#define FP_INFINITE (FP_NAN | FP_NORMAL) +#define FP_ZERO 0x4000 +#define FP_SUBNORMAL (FP_NORMAL | FP_ZERO) + /* 0x0200 is signbit mask */ + + + /* + We can't __CRT_INLINE float or double, because we want to ensure truncation + to semantic type before classification. + (A normal long double value might become subnormal when + converted to double, and zero when converted to float.) + */ + + extern int __cdecl __fpclassifyf (float); + extern int __cdecl __fpclassify (double); + extern int __cdecl __fpclassifyl (long double); + +/* Implemented at tcc/tcc_libm.h */ +#define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \ + : sizeof (x) == sizeof (double) ? __fpclassify (x) \ + : __fpclassifyl (x)) + + /* 7.12.3.2 */ +#define isfinite(x) ((fpclassify(x) & FP_NAN) == 0) + + /* 7.12.3.3 */ +#define isinf(x) (fpclassify(x) == FP_INFINITE) + + /* 7.12.3.4 */ + /* We don't need to worry about truncation here: + A NaN stays a NaN. */ +#define isnan(x) (fpclassify(x) == FP_NAN) + + /* 7.12.3.5 */ +#define isnormal(x) (fpclassify(x) == FP_NORMAL) + + /* 7.12.3.6 The signbit macro */ + + extern int __cdecl __signbitf (float); + extern int __cdecl __signbit (double); + extern int __cdecl __signbitl (long double); + +/* Implemented at tcc/tcc_libm.h */ +#define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \ + : sizeof (x) == sizeof (double) ? __signbit (x) \ + : __signbitl (x)) + + extern double __cdecl exp2(double); + extern float __cdecl exp2f(float); + extern long double __cdecl exp2l(long double); + +#define FP_ILOGB0 ((int)0x80000000) +#define FP_ILOGBNAN ((int)0x80000000) + extern int __cdecl ilogb (double); + extern int __cdecl ilogbf (float); + extern int __cdecl ilogbl (long double); + + extern double __cdecl log1p(double); + extern float __cdecl log1pf(float); + extern long double __cdecl log1pl(long double); + + extern double __cdecl log2 (double); + extern float __cdecl log2f (float); + extern long double __cdecl log2l (long double); + + extern double __cdecl logb (double); + extern float __cdecl logbf (float); + extern long double __cdecl logbl (long double); + + __CRT_INLINE double __cdecl logb (double x) + { + double res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } + + __CRT_INLINE float __cdecl logbf (float x) + { + float res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } + + __CRT_INLINE long double __cdecl logbl (long double x) + { + long double res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } + + extern long double __cdecl modfl (long double, long double*); + + /* 7.12.6.13 */ + extern double __cdecl scalbn (double, int); + extern float __cdecl scalbnf (float, int); + extern long double __cdecl scalbnl (long double, int); + + extern double __cdecl scalbln (double, long); + extern float __cdecl scalblnf (float, long); + extern long double __cdecl scalblnl (long double, long); + + /* 7.12.7.1 */ + /* Implementations adapted from Cephes versions */ + extern double __cdecl cbrt (double); + extern float __cdecl cbrtf (float); + extern long double __cdecl cbrtl (long double); + + __CRT_INLINE float __cdecl hypotf (float x, float y) + { return (float) hypot (x, y);} + extern long double __cdecl hypotl (long double, long double); + + extern long double __cdecl powl (long double, long double); + extern long double __cdecl expl(long double); + extern long double __cdecl expm1l(long double); + extern long double __cdecl coshl(long double); + extern long double __cdecl fabsl (long double); + extern long double __cdecl acosl(long double); + extern long double __cdecl asinl(long double); + extern long double __cdecl atanl(long double); + extern long double __cdecl atan2l(long double,long double); + extern long double __cdecl sinhl(long double); + extern long double __cdecl tanhl(long double); + + /* 7.12.8.1 The erf functions */ + extern double __cdecl erf (double); + extern float __cdecl erff (float); + /* TODO + extern long double __cdecl erfl (long double); + */ + + /* 7.12.8.2 The erfc functions */ + extern double __cdecl erfc (double); + extern float __cdecl erfcf (float); + /* TODO + extern long double __cdecl erfcl (long double); + */ + + /* 7.12.8.3 The lgamma functions */ + extern double __cdecl lgamma (double); + extern float __cdecl lgammaf (float); + extern long double __cdecl lgammal (long double); + + /* 7.12.8.4 The tgamma functions */ + extern double __cdecl tgamma (double); + extern float __cdecl tgammaf (float); + extern long double __cdecl tgammal (long double); + + extern long double __cdecl ceill (long double); + extern long double __cdecl floorl (long double); + extern long double __cdecl frexpl(long double,int *); + extern long double __cdecl log10l(long double); + extern long double __cdecl logl(long double); + extern long double __cdecl cosl(long double); + extern long double __cdecl sinl(long double); + extern long double __cdecl tanl(long double); + extern long double sqrtl(long double); + + /* 7.12.9.3 */ + extern double __cdecl nearbyint ( double); + extern float __cdecl nearbyintf (float); + extern long double __cdecl nearbyintl (long double); + + /* 7.12.9.4 */ + /* round, using fpu control word settings */ + __CRT_INLINE double __cdecl rint (double x) + { + double retval; + __asm__ ( + "fldl %1\n" + "frndint \n" + "fstl %0\n" : "=m" (retval) : "m" (x)); + return retval; + } + + __CRT_INLINE float __cdecl rintf (float x) + { + float retval; + __asm__ ( + "flds %1\n" + "frndint \n" + "fsts %0\n" : "=m" (retval) : "m" (x)); + return retval; + } + + __CRT_INLINE long double __cdecl rintl (long double x) + { + long double retval; + __asm__ ( + "fldt %1\n" + "frndint \n" + "fstt %0\n" : "=m" (retval) : "m" (x)); + return retval; + } + + /* 7.12.9.5 */ + __CRT_INLINE long __cdecl lrint (double x) + { + long retval; + __asm__ __volatile__ \ + ("fldl %1\n" \ + "fistpl %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long __cdecl lrintf (float x) + { + long retval; + __asm__ __volatile__ \ + ("flds %1\n" \ + "fistpl %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long __cdecl lrintl (long double x) + { + long retval; + __asm__ __volatile__ \ + ("fldt %1\n" \ + "fistpl %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long long __cdecl llrint (double x) + { + long long retval; + __asm__ __volatile__ \ + ("fldl %1\n" \ + "fistpll %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long long __cdecl llrintf (float x) + { + long long retval; + __asm__ __volatile__ \ + ("flds %1\n" \ + "fistpll %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + __CRT_INLINE long long __cdecl llrintl (long double x) + { + long long retval; + __asm__ __volatile__ \ + ("fldt %1\n" \ + "fistpll %0" : "=m" (retval) : "m" (x)); \ + return retval; + } + + #define FE_TONEAREST 0x0000 + #define FE_DOWNWARD 0x0400 + #define FE_UPWARD 0x0800 + #define FE_TOWARDZERO 0x0c00 + + __CRT_INLINE double trunc (double _x) + { + double retval; + unsigned short saved_cw; + unsigned short tmp_cw; + __asm__ ("fnstcw %0;" : "=m" (saved_cw)); /* save FPU control word */ + tmp_cw = (saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)) + | FE_TOWARDZERO; + __asm__ ("fldcw %0;" : : "m" (tmp_cw)); + __asm__ ("fldl %1;" + "frndint;" + "fstl %0;" : "=m" (retval) : "m" (_x)); /* round towards zero */ + __asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */ + return retval; + } + + /* 7.12.9.6 */ + /* round away from zero, regardless of fpu control word settings */ + extern double __cdecl round (double); + extern float __cdecl roundf (float); + extern long double __cdecl roundl (long double); + + /* 7.12.9.7 */ + extern long __cdecl lround (double); + extern long __cdecl lroundf (float); + extern long __cdecl lroundl (long double); + + extern long long __cdecl llround (double); + extern long long __cdecl llroundf (float); + extern long long __cdecl llroundl (long double); + + /* 7.12.9.8 */ + /* round towards zero, regardless of fpu control word settings */ + extern double __cdecl trunc (double); + extern float __cdecl truncf (float); + extern long double __cdecl truncl (long double); + + extern long double __cdecl fmodl (long double, long double); + + /* 7.12.10.2 */ + extern double __cdecl remainder (double, double); + extern float __cdecl remainderf (float, float); + extern long double __cdecl remainderl (long double, long double); + + /* 7.12.10.3 */ + extern double __cdecl remquo(double, double, int *); + extern float __cdecl remquof(float, float, int *); + extern long double __cdecl remquol(long double, long double, int *); + + /* 7.12.11.1 */ + extern double __cdecl copysign (double, double); /* in libmoldname.a */ + extern float __cdecl copysignf (float, float); + extern long double __cdecl copysignl (long double, long double); + + /* 7.12.11.2 Return a NaN */ + extern double __cdecl nan(const char *tagp); + extern float __cdecl nanf(const char *tagp); + extern long double __cdecl nanl(const char *tagp); + +#ifndef __STRICT_ANSI__ +#define _nan() nan("") +#define _nanf() nanf("") +#define _nanl() nanl("") +#endif + + /* 7.12.11.3 */ + extern double __cdecl nextafter (double, double); /* in libmoldname.a */ + extern float __cdecl nextafterf (float, float); + extern long double __cdecl nextafterl (long double, long double); + + /* 7.12.11.4 The nexttoward functions: TODO */ + + /* 7.12.12.1 */ + /* x > y ? (x - y) : 0.0 */ + extern double __cdecl fdim (double x, double y); + extern float __cdecl fdimf (float x, float y); + extern long double __cdecl fdiml (long double x, long double y); + + /* fmax and fmin. + NaN arguments are treated as missing data: if one argument is a NaN + and the other numeric, then these functions choose the numeric + value. */ + + /* 7.12.12.2 */ + extern double __cdecl fmax (double, double); + extern float __cdecl fmaxf (float, float); + extern long double __cdecl fmaxl (long double, long double); + + /* 7.12.12.3 */ + extern double __cdecl fmin (double, double); + extern float __cdecl fminf (float, float); + extern long double __cdecl fminl (long double, long double); + + /* 7.12.13.1 */ + /* return x * y + z as a ternary op */ + extern double __cdecl fma (double, double, double); + extern float __cdecl fmaf (float, float, float); + extern long double __cdecl fmal (long double, long double, long double); + + +#if 0 // gr: duplicate, see below + /* 7.12.14 */ + /* + * With these functions, comparisons involving quiet NaNs set the FP + * condition code to "unordered". The IEEE floating-point spec + * dictates that the result of floating-point comparisons should be + * false whenever a NaN is involved, with the exception of the != op, + * which always returns true: yes, (NaN != NaN) is true). + */ + +#if __GNUC__ >= 3 + +#define isgreater(x, y) __builtin_isgreater(x, y) +#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) +#define isless(x, y) __builtin_isless(x, y) +#define islessequal(x, y) __builtin_islessequal(x, y) +#define islessgreater(x, y) __builtin_islessgreater(x, y) +#define isunordered(x, y) __builtin_isunordered(x, y) + +#else + /* helper */ + __CRT_INLINE int __cdecl + __fp_unordered_compare (long double x, long double y){ + unsigned short retval; + __asm__ ("fucom %%st(1);" + "fnstsw;": "=a" (retval) : "t" (x), "u" (y)); + return retval; + } + +#define isgreater(x, y) ((__fp_unordered_compare(x, y) \ + & 0x4500) == 0) +#define isless(x, y) ((__fp_unordered_compare (y, x) \ + & 0x4500) == 0) +#define isgreaterequal(x, y) ((__fp_unordered_compare (x, y) \ + & FP_INFINITE) == 0) +#define islessequal(x, y) ((__fp_unordered_compare(y, x) \ + & FP_INFINITE) == 0) +#define islessgreater(x, y) ((__fp_unordered_compare(x, y) \ + & FP_SUBNORMAL) == 0) +#define isunordered(x, y) ((__fp_unordered_compare(x, y) \ + & 0x4500) == 0x4500) + +#endif +#endif //0 + + +#endif /* __STDC_VERSION__ >= 199901L */ +#endif /* __NO_ISOCEXT */ + +#ifdef __cplusplus +} +extern "C++" { + template inline _Ty _Pow_int(_Ty _X,int _Y) { + unsigned int _N; + if(_Y >= 0) _N = (unsigned int)_Y; + else _N = (unsigned int)(-_Y); + for(_Ty _Z = _Ty(1);;_X *= _X) { + if((_N & 1)!=0) _Z *= _X; + if((_N >>= 1)==0) return (_Y < 0 ? _Ty(1) / _Z : _Z); + } + } +} +#endif + +#pragma pack(pop) + +/* 7.12.14 */ +/* + * With these functions, comparisons involving quiet NaNs set the FP + * condition code to "unordered". The IEEE floating-point spec + * dictates that the result of floating-point comparisons should be + * false whenever a NaN is involved, with the exception of the != op, + * which always returns true: yes, (NaN != NaN) is true). + */ + +/* Mini libm (inline __fpclassify*, __signbit* and variants) */ +#include "tcc/tcc_libm.h" + +#endif /* End _MATH_H_ */ + diff --git a/overlay_toolchain/tcc/include/mem.h b/overlay_toolchain/tcc/include/mem.h new file mode 100644 index 00000000..25520235 --- /dev/null +++ b/overlay_toolchain/tcc/include/mem.h @@ -0,0 +1,13 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * This file is part of the Mingw32 package. + * + * mem.h maps to string.h + */ +#ifndef __STRICT_ANSI__ +#include +#endif diff --git a/overlay_toolchain/tcc/include/memory.h b/overlay_toolchain/tcc/include/memory.h new file mode 100644 index 00000000..90d88aed --- /dev/null +++ b/overlay_toolchain/tcc/include/memory.h @@ -0,0 +1,40 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_MEMORY +#define _INC_MEMORY + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CONST_RETURN +#define _CONST_RETURN +#endif + +#define _WConst_return _CONST_RETURN + +#ifndef _CRT_MEMORY_DEFINED +#define _CRT_MEMORY_DEFINED + _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); + _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); + _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); + _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); + int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); + void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); + void *__cdecl memset(void *_Dst,int _Val,size_t _Size); + +#ifndef NO_OLDNAMES + void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); + int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/process.h b/overlay_toolchain/tcc/include/process.h new file mode 100644 index 00000000..dadaf2b7 --- /dev/null +++ b/overlay_toolchain/tcc/include/process.h @@ -0,0 +1,176 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_PROCESS +#define _INC_PROCESS + +#include <_mingw.h> + +/* Includes a definition of _pid_t and pid_t */ +#include + +#ifndef _POSIX_ +#ifdef __cplusplus +extern "C" { +#endif + +#define _P_WAIT 0 +#define _P_NOWAIT 1 +#define _OLD_P_OVERLAY 2 +#define _P_NOWAITO 3 +#define _P_DETACH 4 +#define _P_OVERLAY 2 + +#define _WAIT_CHILD 0 +#define _WAIT_GRANDCHILD 1 + + _CRTIMP uintptr_t __cdecl _beginthread(void (__cdecl *_StartAddress) (void *),unsigned _StackSize,void *_ArgList); + _CRTIMP void __cdecl _endthread(void); + _CRTIMP uintptr_t __cdecl _beginthreadex(void *_Security,unsigned _StackSize,unsigned (__stdcall *_StartAddress) (void *),void *_ArgList,unsigned _InitFlag,unsigned *_ThrdAddr); + _CRTIMP void __cdecl _endthreadex(unsigned _Retval); + +#ifndef _CRT_TERMINATE_DEFINED +#define _CRT_TERMINATE_DEFINED + void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; + _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; + +#pragma push_macro("abort") +#undef abort + void __cdecl __declspec(noreturn) abort(void); +#pragma pop_macro("abort") + +#endif + + _CRTIMP void __cdecl __MINGW_NOTHROW _cexit(void); + _CRTIMP void __cdecl __MINGW_NOTHROW _c_exit(void); + _CRTIMP int __cdecl _getpid(void); + _CRTIMP intptr_t __cdecl _cwait(int *_TermStat,intptr_t _ProcHandle,int _Action); + _CRTIMP intptr_t __cdecl _execl(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execle(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execlp(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execlpe(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execv(const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _execve(const char *_Filename,const char *const *_ArgList,const char *const *_Env); + _CRTIMP intptr_t __cdecl _execvp(const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _execvpe(const char *_Filename,const char *const *_ArgList,const char *const *_Env); + _CRTIMP intptr_t __cdecl _spawnl(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnle(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnlp(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnlpe(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _spawnve(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); + _CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _spawnvpe(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); + +#ifndef _CRT_SYSTEM_DEFINED +#define _CRT_SYSTEM_DEFINED + int __cdecl system(const char *_Command); +#endif + +#ifndef _WPROCESS_DEFINED +#define _WPROCESS_DEFINED + _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif +#endif + + void __cdecl __security_init_cookie(void); +#if (defined(_X86_) && !defined(__x86_64)) + void __fastcall __security_check_cookie(uintptr_t _StackCookie); + __declspec(noreturn) void __cdecl __report_gsfailure(void); +#else + void __cdecl __security_check_cookie(uintptr_t _StackCookie); + __declspec(noreturn) void __cdecl __report_gsfailure(uintptr_t _StackCookie); +#endif + extern uintptr_t __security_cookie; + + intptr_t __cdecl _loaddll(char *_Filename); + int __cdecl _unloaddll(intptr_t _Handle); + int (__cdecl *__cdecl _getdllprocaddr(intptr_t _Handle,char *_ProcedureName,intptr_t _Ordinal))(void); + +#ifdef _DECL_DLLMAIN +#ifdef _WINDOWS_ + WINBOOL WINAPI DllMain(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); + WINBOOL WINAPI _CRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); + WINBOOL WINAPI _wCRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); + extern WINBOOL (WINAPI *const _pRawDllMain)(HANDLE,DWORD,LPVOID); +#else + int __stdcall DllMain(void *_HDllHandle,unsigned _Reason,void *_Reserved); + int __stdcall _CRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); + int __stdcall _wCRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); + extern int (__stdcall *const _pRawDllMain)(void *,unsigned,void *); +#endif +#endif + +#ifndef NO_OLDNAMES +#define P_WAIT _P_WAIT +#define P_NOWAIT _P_NOWAIT +#define P_OVERLAY _P_OVERLAY +#define OLD_P_OVERLAY _OLD_P_OVERLAY +#define P_NOWAITO _P_NOWAITO +#define P_DETACH _P_DETACH +#define WAIT_CHILD _WAIT_CHILD +#define WAIT_GRANDCHILD _WAIT_GRANDCHILD + + intptr_t __cdecl cwait(int *_TermStat,intptr_t _ProcHandle,int _Action); +#ifdef __GNUC__ + int __cdecl execl(const char *_Filename,const char *_ArgList,...); + int __cdecl execle(const char *_Filename,const char *_ArgList,...); + int __cdecl execlp(const char *_Filename,const char *_ArgList,...); + int __cdecl execlpe(const char *_Filename,const char *_ArgList,...); +#else + intptr_t __cdecl execl(const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl execle(const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl execlp(const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl execlpe(const char *_Filename,const char *_ArgList,...); +#endif + intptr_t __cdecl spawnl(int,const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl spawnle(int,const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl spawnlp(int,const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl spawnlpe(int,const char *_Filename,const char *_ArgList,...); + int __cdecl getpid(void); +#ifdef __GNUC__ + /* Those methods are predefined by gcc builtins to return int. So to prevent + stupid warnings, define them in POSIX way. This is save, because those + methods do not return in success case, so that the return value is not + really dependent to its scalar width. */ + int __cdecl execv(const char *_Filename,const char *const _ArgList[]); + int __cdecl execve(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); + int __cdecl execvp(const char *_Filename,const char *const _ArgList[]); + int __cdecl execvpe(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); +#else + intptr_t __cdecl execv(const char *_Filename,const char *const _ArgList[]); + intptr_t __cdecl execve(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); + intptr_t __cdecl execvp(const char *_Filename,const char *const _ArgList[]); + intptr_t __cdecl execvpe(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); +#endif + intptr_t __cdecl spawnv(int,const char *_Filename,const char *const _ArgList[]); + intptr_t __cdecl spawnve(int,const char *_Filename,const char *const _ArgList[],const char *const _Env[]); + intptr_t __cdecl spawnvp(int,const char *_Filename,const char *const _ArgList[]); + intptr_t __cdecl spawnvpe(int,const char *_Filename,const char *const _ArgList[],char *const _Env[]); +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/conio_s.h b/overlay_toolchain/tcc/include/sec_api/conio_s.h new file mode 100644 index 00000000..98d97ba2 --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/conio_s.h @@ -0,0 +1,42 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _INC_CONIO_S +#define _INC_CONIO_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _cgets_s(char *_Buffer,size_t _Size,size_t *_SizeRead); + _CRTIMP int __cdecl _cprintf_s(const char *_Format,...); + _CRTIMP int __cdecl _cscanf_s(const char *_Format,...); + _CRTIMP int __cdecl _cscanf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_s(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + +#ifndef _WCONIO_DEFINED_S +#define _WCONIO_DEFINED_S + _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); + _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/crtdbg_s.h b/overlay_toolchain/tcc/include/sec_api/crtdbg_s.h new file mode 100644 index 00000000..4598b4f7 --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/crtdbg_s.h @@ -0,0 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _INC_CRTDBG_S +#define _INC_CRTDBG_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#define _dupenv_s_dbg(ps1,size,s2,t,f,l) _dupenv_s(ps1,size,s2) +#define _wdupenv_s_dbg(ps1,size,s2,t,f,l) _wdupenv_s(ps1,size,s2) + +#endif + +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/io_s.h b/overlay_toolchain/tcc/include/sec_api/io_s.h new file mode 100644 index 00000000..ec565a61 --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/io_s.h @@ -0,0 +1,33 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_IO_S +#define _INC_IO_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _access_s(const char *_Filename,int _AccessMode); + _CRTIMP errno_t __cdecl _chsize_s(int _FileHandle,__int64 _Size); + _CRTIMP errno_t __cdecl _mktemp_s(char *_TemplateName,size_t _Size); + _CRTIMP errno_t __cdecl _umask_s(int _NewMode,int *_OldMode); + +#ifndef _WIO_S_DEFINED +#define _WIO_S_DEFINED + _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); + _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/mbstring_s.h b/overlay_toolchain/tcc/include/sec_api/mbstring_s.h new file mode 100644 index 00000000..6b2b188f --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/mbstring_s.h @@ -0,0 +1,52 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_MBSTRING_S +#define _INC_MBSTRING_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _MBSTRING_S_DEFINED +#define _MBSTRING_S_DEFINED + _CRTIMP errno_t __cdecl _mbscat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); + _CRTIMP errno_t __cdecl _mbscat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbscpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); + _CRTIMP errno_t __cdecl _mbscpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbslwr_s(unsigned char *_Str,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _mbslwr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnbcat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnbcat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnbcpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnbcpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnbset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnbset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsncat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsncat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsncpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsncpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val); + _CRTIMP errno_t __cdecl _mbsset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbstok_s(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context); + _CRTIMP unsigned char *__cdecl _mbstok_s_l(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsupr_s(unsigned char *_Str,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _mbsupr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbccpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src); + _CRTIMP errno_t __cdecl _mbccpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src,_locale_t _Locale); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/search_s.h b/overlay_toolchain/tcc/include/sec_api/search_s.h new file mode 100644 index 00000000..cae89989 --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/search_s.h @@ -0,0 +1,25 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SEARCH_S +#define _INC_SEARCH_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP void *__cdecl _lfind_s(const void *_Key,const void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); + _CRTIMP void *__cdecl _lsearch_s(const void *_Key,void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/stdio_s.h b/overlay_toolchain/tcc/include/sec_api/stdio_s.h new file mode 100644 index 00000000..c9b803b1 --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/stdio_s.h @@ -0,0 +1,145 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDIO_S +#define _INC_STDIO_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _STDIO_S_DEFINED +#define _STDIO_S_DEFINED + _CRTIMP errno_t __cdecl clearerr_s(FILE *_File); + int __cdecl fprintf_s(FILE *_File,const char *_Format,...); + size_t __cdecl fread_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File); + _CRTIMP int __cdecl _fscanf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + int __cdecl printf_s(const char *_Format,...); + _CRTIMP int __cdecl _scanf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scanf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _snprintf_c(char *_DstBuf,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _vsnprintf_c(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); + int __cdecl sprintf_s(char *_DstBuf,size_t _DstSize,const char *_Format,...); + _CRTIMP int __cdecl _fscanf_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _sscanf_l(const char *_Src,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _sscanf_s_l(const char *_Src,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snscanf_s(const char *_Src,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _snscanf_l(const char *_Src,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snscanf_s_l(const char *_Src,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + int __cdecl vfprintf_s(FILE *_File,const char *_Format,va_list _ArgList); + int __cdecl vprintf_s(const char *_Format,va_list _ArgList); + int __cdecl vsnprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vsnprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,va_list _ArgList); + int __cdecl vsprintf_s(char *_DstBuf,size_t _Size,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _fprintf_p(FILE *_File,const char *_Format,...); + _CRTIMP int __cdecl _printf_p(const char *_Format,...); + _CRTIMP int __cdecl _sprintf_p(char *_Dst,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _vfprintf_p(FILE *_File,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vprintf_p(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vsprintf_p(char *_Dst,size_t _MaxCount,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _scprintf_p(const char *_Format,...); + _CRTIMP int __cdecl _vscprintf_p(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _printf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _printf_p_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fprintf_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _fprintf_p_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfprintf_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vfprintf_p_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _sprintf_l(char *_DstBuf,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _sprintf_p_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsprintf_l(char *_DstBuf,const char *_Format,_locale_t,va_list _ArgList); + _CRTIMP int __cdecl _vsprintf_p_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _scprintf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scprintf_p_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vscprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vscprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _printf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fprintf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfprintf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _sprintf_s_l(char *_DstBuf,size_t _DstSize,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsprintf_s_l(char *_DstBuf,size_t _DstSize,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snprintf_s_l(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnprintf_s_l(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snprintf_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snprintf_c_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnprintf_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vsnprintf_c_l(char *_DstBuf,size_t _MaxCount,const char *,_locale_t _Locale,va_list _ArgList); + +#ifndef _WSTDIO_S_DEFINED +#define _WSTDIO_S_DEFINED + _CRTIMP wchar_t *__cdecl _getws_s(wchar_t *_Str,size_t _SizeInWords); + int __cdecl fwprintf_s(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf_s(const wchar_t *_Format,...); + int __cdecl vwprintf_s(const wchar_t *_Format,va_list _ArgList); + int __cdecl swprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,...); + int __cdecl vswprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwscanf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swscanf_s_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf_s(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf_s_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP errno_t __cdecl _wfopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP errno_t __cdecl _wfreopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); + _CRTIMP errno_t __cdecl _wtmpnam_s(wchar_t *_DstBuf,size_t _SizeInWords); + _CRTIMP int __cdecl _fwprintf_p(FILE *_File,const wchar_t *_Format,...); + _CRTIMP int __cdecl _wprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vfwprintf_p(FILE *_File,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vscwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _fwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vfwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vswprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vscwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl __swprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,...); + _CRTIMP int __cdecl __vswprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,va_list _Args); + _CRTIMP int __cdecl _vscwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwscanf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swscanf_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wscanf_l(const wchar_t *_Format,_locale_t _Locale,...); +#endif +#endif + + _CRTIMP size_t __cdecl _fread_nolock_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File); + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/stdlib_s.h b/overlay_toolchain/tcc/include/sec_api/stdlib_s.h new file mode 100644 index 00000000..f98262cc --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/stdlib_s.h @@ -0,0 +1,67 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDLIB_S +#define _INC_STDLIB_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _dupenv_s(char **_PBuffer,size_t *_PBufferSizeInBytes,const char *_VarName); + _CRTIMP errno_t __cdecl _itoa_s(int _Value,char *_DstBuf,size_t _Size,int _Radix); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _i64toa_s(__int64 _Val,char *_DstBuf,size_t _Size,int _Radix); + _CRTIMP errno_t __cdecl _ui64toa_s(unsigned __int64 _Val,char *_DstBuf,size_t _Size,int _Radix); +#endif + _CRTIMP errno_t __cdecl _ltoa_s(long _Val,char *_DstBuf,size_t _Size,int _Radix); + _CRTIMP errno_t __cdecl mbstowcs_s(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbstowcs_s_l(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _ultoa_s(unsigned long _Val,char *_DstBuf,size_t _Size,int _Radix); + _CRTIMP errno_t __cdecl _wctomb_s_l(int *_SizeConverted,char *_MbCh,size_t _SizeInBytes,wchar_t _WCh,_locale_t _Locale); + _CRTIMP errno_t __cdecl wcstombs_s(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes); + _CRTIMP errno_t __cdecl _wcstombs_s_l(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes,_locale_t _Locale); + +#ifndef _WSTDLIB_S_DEFINED +#define _WSTDLIB_S_DEFINED + _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); + _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); +#endif +#endif + +#ifndef _POSIX_ + _CRTIMP errno_t __cdecl _ecvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDights,int *_PtDec,int *_PtSign); + _CRTIMP errno_t __cdecl _fcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); + _CRTIMP errno_t __cdecl _gcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDigits); + _CRTIMP errno_t __cdecl _makepath_s(char *_PathResult,size_t _Size,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); + _CRTIMP errno_t __cdecl _putenv_s(const char *_Name,const char *_Value); + _CRTIMP errno_t __cdecl _searchenv_s(const char *_Filename,const char *_EnvVar,char *_ResultPath,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _splitpath_s(const char *_FullPath,char *_Drive,size_t _DriveSize,char *_Dir,size_t _DirSize,char *_Filename,size_t _FilenameSize,char *_Ext,size_t _ExtSize); + +#ifndef _WSTDLIBP_S_DEFINED +#define _WSTDLIBP_S_DEFINED + _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); + _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); + _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/stralign_s.h b/overlay_toolchain/tcc/include/sec_api/stralign_s.h new file mode 100644 index 00000000..5b78f586 --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/stralign_s.h @@ -0,0 +1,30 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef __STRALIGN_H_S_ +#define __STRALIGN_H_S_ + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(I_X86_) && defined(_WSTRING_S_DEFINED) +#if defined(__cplusplus) && defined(_WConst_Return) + static __inline PUWSTR ua_wcscpy_s(PUWSTR Destination,size_t DestinationSize,PCUWSTR Source) { + if(WSTR_ALIGNED(Source) && WSTR_ALIGNED(Destination)) return (wcscpy_s((PWSTR)Destination,DestinationSize,(PCWSTR)Source)==0 ? Destination : NULL); + return uaw_wcscpy((PCUWSTR)String,Character); + } +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/string_s.h b/overlay_toolchain/tcc/include/sec_api/string_s.h new file mode 100644 index 00000000..9db70e77 --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/string_s.h @@ -0,0 +1,41 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STRING_S +#define _INC_STRING_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _strset_s(char *_Dst,size_t _DstSize,int _Value); + _CRTIMP errno_t __cdecl _strerror_s(char *_Buf,size_t _SizeInBytes,const char *_ErrMsg); + _CRTIMP errno_t __cdecl _strlwr_s(char *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _strlwr_s_l(char *_Str,size_t _Size,_locale_t _Locale); + _CRTIMP errno_t __cdecl _strnset_s(char *_Str,size_t _Size,int _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _strupr_s(char *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _strupr_s_l(char *_Str,size_t _Size,_locale_t _Locale); +#ifndef _WSTRING_S_DEFINED +#define _WSTRING_S_DEFINED + _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); + _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); + _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); + _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); + _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); + _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/sys/timeb_s.h b/overlay_toolchain/tcc/include/sec_api/sys/timeb_s.h new file mode 100644 index 00000000..af5ef098 --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/sys/timeb_s.h @@ -0,0 +1,34 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _TIMEB_H_S +#define _TIMEB_H_S + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef _USE_32BIT_TIME_T +#define _ftime_s _ftime32_s +#else +#define _ftime_s _ftime64_s +#endif + + _CRTIMP errno_t __cdecl _ftime32_s(struct __timeb32 *_Time); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _ftime64_s(struct __timeb64 *_Time); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/tchar_s.h b/overlay_toolchain/tcc/include/sec_api/tchar_s.h new file mode 100644 index 00000000..343d348e --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/tchar_s.h @@ -0,0 +1,266 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_TCHAR_S +#define _INC_TCHAR_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _UNICODE + +#define _tprintf_s wprintf_s +#define _tprintf_s_l _wprintf_s_l +#define _tcprintf_s _cwprintf_s +#define _tcprintf_s_l _cwprintf_s_l +#define _vtcprintf_s _vcwprintf_s +#define _vtcprintf_s_l _vcwprintf_s_l +#define _ftprintf_s fwprintf_s +#define _ftprintf_s_l _fwprintf_s_l +#define _stprintf_s swprintf_s +#define _stprintf_s_l _swprintf_s_l +#define _sntprintf_s _snwprintf_s +#define _sntprintf_s_l _snwprintf_s_l +#define _vtprintf_s vwprintf_s +#define _vtprintf_s_l _vwprintf_s_l +#define _vftprintf_s vfwprintf_s +#define _vftprintf_s_l _vfwprintf_s_l +#define _vstprintf_s vswprintf_s +#define _vstprintf_s_l _vswprintf_s_l +#define _vsntprintf_s _vsnwprintf_s +#define _vsntprintf_s_l _vsnwprintf_s_l + +#define _tscanf_s wscanf_s +#define _tscanf_s_l _wscanf_s_l +#define _tcscanf_s _cwscanf_s +#define _tcscanf_s_l _cwscanf_s_l +#define _ftscanf_s fwscanf_s +#define _ftscanf_s_l _fwscanf_s_l +#define _stscanf_s swscanf_s +#define _stscanf_s_l _swscanf_s_l +#define _sntscanf_s _snwscanf_s +#define _sntscanf_s_l _snwscanf_s_l + +#define _cgetts_s _cgetws_s +#define _getts_s _getws_s + +#define _itot_s _itow_s +#define _ltot_s _ltow_s +#define _ultot_s _ultow_s +#define _i64tot_s _i64tow_s +#define _ui64tot_s _ui64tow_s + +#define _tcscat_s wcscat_s +#define _tcscpy_s wcscpy_s +#define _tcsncat_s wcsncat_s +#define _tcsncat_s_l _wcsncat_s_l +#define _tcsncpy_s wcsncpy_s +#define _tcsncpy_s_l _wcsncpy_s_l +#define _tcstok_s wcstok_s +#define _tcstok_s_l _wcstok_s_l +#define _tcserror_s _wcserror_s +#define __tcserror_s __wcserror_s + +#define _tcsnset_s _wcsnset_s +#define _tcsnset_s_l _wcsnset_s_l +#define _tcsset_s _wcsset_s +#define _tcsset_s_l _wcsset_s_l + +#define _tasctime_s _wasctime_s +#define _tctime_s _wctime_s +#define _tctime32_s _wctime32_s +#define _tctime64_s _wctime64_s +#define _tstrdate_s _wstrdate_s +#define _tstrtime_s _wstrtime_s + +#define _tgetenv_s _wgetenv_s +#define _tdupenv_s _wdupenv_s +#define _tmakepath_s _wmakepath_s +#define _tputenv_s _wputenv_s +#define _tsearchenv_s _wsearchenv_s +#define _tsplitpath_s _wsplitpath_s + +#define _tfopen_s _wfopen_s +#define _tfreopen_s _wfreopen_s +#define _ttmpnam_s _wtmpnam_s +#define _taccess_s _waccess_s +#define _tmktemp_s _wmktemp_s + +#define _tcsnccat_s wcsncat_s +#define _tcsnccat_s_l _wcsncat_s_l +#define _tcsnccpy_s wcsncpy_s +#define _tcsnccpy_s_l _wcsncpy_s_l + +#define _tcslwr_s _wcslwr_s +#define _tcslwr_s_l _wcslwr_s_l +#define _tcsupr_s _wcsupr_s +#define _tcsupr_s_l _wcsupr_s_l + +#define _wcstok_s_l(_String,_Delimiters,_Current_position,_Locale) (wcstok_s(_String,_Delimiters,_Current_position)) +#define _wcsnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_wcsnset_s(_Destination,_Destination_size_chars,_Value,_Count)) +#define _wcsset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_wcsset_s(_Destination,_Destination_size_chars,_Value)) + +#else + +#define _tprintf_s printf_s +#define _tprintf_s_l _printf_s_l +#define _tcprintf_s _cprintf_s +#define _tcprintf_s_l _cprintf_s_l +#define _vtcprintf_s _vcprintf_s +#define _vtcprintf_s_l _vcprintf_s_l +#define _ftprintf_s fprintf_s +#define _ftprintf_s_l _fprintf_s_l +#define _stprintf_s sprintf_s +#define _stprintf_s_l _sprintf_s_l +#define _sntprintf_s _snprintf_s +#define _sntprintf_s_l _snprintf_s_l +#define _vtprintf_s vprintf_s +#define _vtprintf_s_l _vprintf_s_l +#define _vftprintf_s vfprintf_s +#define _vftprintf_s_l _vfprintf_s_l +#define _vstprintf_s vsprintf_s +#define _vstprintf_s_l _vsprintf_s_l +#define _vsntprintf_s _vsnprintf_s +#define _vsntprintf_s_l _vsnprintf_s_l +#define _tscanf_s scanf_s +#define _tscanf_s_l _scanf_s_l +#define _tcscanf_s _cscanf_s +#define _tcscanf_s_l _cscanf_s_l +#define _ftscanf_s fscanf_s +#define _ftscanf_s_l _fscanf_s_l +#define _stscanf_s sscanf_s +#define _stscanf_s_l _sscanf_s_l +#define _sntscanf_s _snscanf_s +#define _sntscanf_s_l _snscanf_s_l + +#define _getts_s gets_s +#define _cgetts_s _cgets_s +#define _itot_s _itoa_s +#define _ltot_s _ltoa_s +#define _ultot_s _ultoa_s +#define _i64tot_s _i64toa_s +#define _ui64tot_s _ui64toa_s + +#define _tcscat_s strcat_s +#define _tcscpy_s strcpy_s +#define _tcserror_s strerror_s +#define __tcserror_s _strerror_s + +#define _tasctime_s asctime_s +#define _tctime_s ctime_s +#define _tctime32_s _ctime32_s +#define _tctime64_s _ctime64_s +#define _tstrdate_s _strdate_s +#define _tstrtime_s _strtime_s + +#define _tgetenv_s getenv_s +#define _tdupenv_s _dupenv_s +#define _tmakepath_s _makepath_s +#define _tputenv_s _putenv_s +#define _tsearchenv_s _searchenv_s +#define _tsplitpath_s _splitpath_s + +#define _tfopen_s fopen_s +#define _tfreopen_s freopen_s +#define _ttmpnam_s tmpnam_s +#define _tmktemp_s _mktemp_s + +#ifndef _POSIX_ +#define _taccess_s _access_s +#endif + +#define _tsopen_s _sopen_s + +#ifdef _MBCS + +#ifdef _MB_MAP_DIRECT + +#define _tcsncat_s _mbsnbcat_s +#define _tcsncat_s_l _mbsnbcat_s_l +#define _tcsncpy_s _mbsnbcpy_s +#define _tcsncpy_s_l _mbsnbcpy_s_l +#define _tcstok_s _mbstok_s +#define _tcstok_s_l _mbstok_s_l + +#define _tcsnset_s _mbsnbset_s +#define _tcsnset_s_l _mbsnbset_s_l +#define _tcsset_s _mbsset_s +#define _tcsset_s_l _mbsset_s_l + +#define _tcsnccat_s _mbsncat_s +#define _tcsnccat_s_l _mbsncat_s_l +#define _tcsnccpy_s _mbsncpy_s +#define _tcsnccpy_s_l _mbsncpy_s_l +#define _tcsncset_s _mbsnset_s +#define _tcsncset_s_l _mbsnset_s_l + +#define _tcslwr_s _mbslwr_s +#define _tcslwr_s_l _mbslwr_s_l +#define _tcsupr_s _mbsupr_s +#define _tcsupr_s_l _mbsupr_s_l + +#define _tccpy_s _mbccpy_s +#define _tccpy_s_l _mbccpy_s_l +#else + + _CRTIMP char *__cdecl _tcsncat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsncpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcstok_s(char *_Str,const char *_Delim,char **_Context); + _CRTIMP char *__cdecl _tcstok_s_l(char *_Str,const char *_Delim,char **_Context,_locale_t _Locale); + _CRTIMP errno_t __cdecl _tcsset_s(char *_Str,size_t _SizeInChars,unsigned int _Val); + _CRTIMP errno_t __cdecl _tcsset_s_l(char *_Str,size_t _SizeInChars,unsigned int,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcslwr_s(char *_Str,size_t _SizeInChars); + _CRTIMP char *__cdecl _tcslwr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsupr_s(char *_Str,size_t _SizeInChars); + _CRTIMP char *__cdecl _tcsupr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale); + +#endif + +#else + +#define _tcsncat_s strncat_s +#define _tcsncat_s_l _strncat_s_l +#define _tcsncpy_s strncpy_s +#define _tcsncpy_s_l _strncpy_s_l +#define _tcstok_s strtok_s +#define _tcstok_s_l _strtok_s_l + +#define _tcsnset_s _strnset_s +#define _tcsnset_s_l _strnset_s_l +#define _tcsset_s _strset_s +#define _tcsset_s _strset_s +#define _tcsset_s_l _strset_s_l + +#define _tcsnccat_s strncat_s +#define _tcsnccat_s_l _strncat_s_l +#define _tcsnccpy_s strncpy_s +#define _tcsnccpy_s_l _strncpy_s_l + +#define _tcslwr_s _strlwr_s +#define _tcslwr_s_l _strlwr_s_l +#define _tcsupr_s _strupr_s +#define _tcsupr_s_l _strupr_s_l + +#define _strnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_strnset_s(_Destination,_Destination_size_chars,_Value,_Count)) +#define _strset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_strset_s(_Destination,_Destination_size_chars,_Value)) +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/time_s.h b/overlay_toolchain/tcc/include/sec_api/time_s.h new file mode 100644 index 00000000..9603b94f --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/time_s.h @@ -0,0 +1,61 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _TIME_H__S +#define _TIME_H__S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _ctime32_s(char *_Buf,size_t _SizeInBytes,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _gmtime32_s(struct tm *_Tm,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _localtime32_s(struct tm *_Tm,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _strdate_s(char *_Buf,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _strtime_s(char *_Buf ,size_t _SizeInBytes); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _ctime64_s(char *_Buf,size_t _SizeInBytes,const __time64_t *_Time); + _CRTIMP errno_t __cdecl _gmtime64_s(struct tm *_Tm,const __time64_t *_Time); + _CRTIMP errno_t __cdecl _localtime64_s(struct tm *_Tm,const __time64_t *_Time); +#endif + +#ifndef _WTIME_S_DEFINED +#define _WTIME_S_DEFINED + _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); + _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) +#define _INC_WTIME_S_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } +#else +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } +#endif +#endif +#endif + +#ifndef RC_INVOKED +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); } +#else +__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); } +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/overlay_toolchain/tcc/include/sec_api/wchar_s.h b/overlay_toolchain/tcc/include/sec_api/wchar_s.h new file mode 100644 index 00000000..94251aa8 --- /dev/null +++ b/overlay_toolchain/tcc/include/sec_api/wchar_s.h @@ -0,0 +1,128 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_WCHAR_S +#define _INC_WCHAR_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WIO_S_DEFINED +#define _WIO_S_DEFINED + _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); + _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); +#endif + +#ifndef _WCONIO_S_DEFINED +#define _WCONIO_S_DEFINED + _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); + _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); +#endif + +#ifndef _WSTDIO_S_DEFINED +#define _WSTDIO_S_DEFINED + _CRTIMP wchar_t *__cdecl _getws_s(wchar_t *_Str,size_t _SizeInWords); + int __cdecl fwprintf_s(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf_s(const wchar_t *_Format,...); + int __cdecl vfwprintf_s(FILE *_File,const wchar_t *_Format,va_list _ArgList); + int __cdecl vwprintf_s(const wchar_t *_Format,va_list _ArgList); + int __cdecl swprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,...); + int __cdecl vswprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwscanf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swscanf_s_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf_s(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf_s_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP errno_t __cdecl _wfopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP errno_t __cdecl _wfreopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); + _CRTIMP errno_t __cdecl _wtmpnam_s(wchar_t *_DstBuf,size_t _SizeInWords); +#endif + +#ifndef _WSTDLIB_S_DEFINED +#define _WSTDLIB_S_DEFINED + _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); + _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); +#endif +#endif + +#ifndef _POSIX_ +#ifndef _WSTDLIBP_S_DEFINED +#define _WSTDLIBP_S_DEFINED + _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); + _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); + _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); +#endif +#endif + +#ifndef _WSTRING_S_DEFINED +#define _WSTRING_S_DEFINED + _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); + _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); + _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); + _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); + _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); + _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); +#endif + +#ifndef _WTIME_S_DEFINED +#define _WTIME_S_DEFINED + _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); + _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) +#define _INC_WTIME_S_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } +#else +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } +#endif +#endif +#endif + + _CRTIMP errno_t __cdecl mbsrtowcs_s(size_t *_Retval,wchar_t *_Dst,size_t _SizeInWords,const char **_PSrc,size_t _N,mbstate_t *_State); + _CRTIMP errno_t __cdecl wcrtomb_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,wchar_t _Ch,mbstate_t *_State); + _CRTIMP errno_t __cdecl wcsrtombs_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,const wchar_t **_Src,size_t _Size,mbstate_t *_State); + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/overlay_toolchain/tcc/include/setjmp.h b/overlay_toolchain/tcc/include/setjmp.h new file mode 100644 index 00000000..e4f142a3 --- /dev/null +++ b/overlay_toolchain/tcc/include/setjmp.h @@ -0,0 +1,160 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SETJMP +#define _INC_SETJMP + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#if (defined(_X86_) && !defined(__x86_64)) + +#define _JBLEN 16 +#define _JBTYPE int + + typedef struct __JUMP_BUFFER { + unsigned long Ebp; + unsigned long Ebx; + unsigned long Edi; + unsigned long Esi; + unsigned long Esp; + unsigned long Eip; + unsigned long Registration; + unsigned long TryLevel; + unsigned long Cookie; + unsigned long UnwindFunc; + unsigned long UnwindData[6]; + } _JUMP_BUFFER; +#elif defined(__ia64__) + typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { + __int64 LowPart; + __int64 HighPart; + } SETJMP_FLOAT128; + +#define _JBLEN 33 + typedef SETJMP_FLOAT128 _JBTYPE; + + typedef struct __JUMP_BUFFER { + + unsigned long iAReserved[6]; + + unsigned long Registration; + unsigned long TryLevel; + unsigned long Cookie; + unsigned long UnwindFunc; + + unsigned long UnwindData[6]; + + SETJMP_FLOAT128 FltS0; + SETJMP_FLOAT128 FltS1; + SETJMP_FLOAT128 FltS2; + SETJMP_FLOAT128 FltS3; + SETJMP_FLOAT128 FltS4; + SETJMP_FLOAT128 FltS5; + SETJMP_FLOAT128 FltS6; + SETJMP_FLOAT128 FltS7; + SETJMP_FLOAT128 FltS8; + SETJMP_FLOAT128 FltS9; + SETJMP_FLOAT128 FltS10; + SETJMP_FLOAT128 FltS11; + SETJMP_FLOAT128 FltS12; + SETJMP_FLOAT128 FltS13; + SETJMP_FLOAT128 FltS14; + SETJMP_FLOAT128 FltS15; + SETJMP_FLOAT128 FltS16; + SETJMP_FLOAT128 FltS17; + SETJMP_FLOAT128 FltS18; + SETJMP_FLOAT128 FltS19; + __int64 FPSR; + __int64 StIIP; + __int64 BrS0; + __int64 BrS1; + __int64 BrS2; + __int64 BrS3; + __int64 BrS4; + __int64 IntS0; + __int64 IntS1; + __int64 IntS2; + __int64 IntS3; + __int64 RsBSP; + __int64 RsPFS; + __int64 ApUNAT; + __int64 ApLC; + __int64 IntSp; + __int64 IntNats; + __int64 Preds; + + } _JUMP_BUFFER; +#elif defined(__x86_64) + typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { + unsigned __int64 Part[2]; + } SETJMP_FLOAT128; + +#define _JBLEN 16 + typedef SETJMP_FLOAT128 _JBTYPE; + + typedef struct _JUMP_BUFFER { + unsigned __int64 Frame; + unsigned __int64 Rbx; + unsigned __int64 Rsp; + unsigned __int64 Rbp; + unsigned __int64 Rsi; + unsigned __int64 Rdi; + unsigned __int64 R12; + unsigned __int64 R13; + unsigned __int64 R14; + unsigned __int64 R15; + unsigned __int64 Rip; + unsigned __int64 Spare; + SETJMP_FLOAT128 Xmm6; + SETJMP_FLOAT128 Xmm7; + SETJMP_FLOAT128 Xmm8; + SETJMP_FLOAT128 Xmm9; + SETJMP_FLOAT128 Xmm10; + SETJMP_FLOAT128 Xmm11; + SETJMP_FLOAT128 Xmm12; + SETJMP_FLOAT128 Xmm13; + SETJMP_FLOAT128 Xmm14; + SETJMP_FLOAT128 Xmm15; + } _JUMP_BUFFER; +#endif +#ifndef _JMP_BUF_DEFINED + typedef _JBTYPE jmp_buf[_JBLEN]; +#define _JMP_BUF_DEFINED +#endif + + void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void); + +#ifdef USE_MINGW_SETJMP_TWO_ARGS +#ifndef _INC_SETJMPEX +#define setjmp(BUF) _setjmp((BUF),mingw_getsp()) + int __cdecl __attribute__ ((__nothrow__)) _setjmp(jmp_buf _Buf,void *_Ctx); +#else +#undef setjmp +#define setjmp(BUF) _setjmpex((BUF),mingw_getsp()) +#define setjmpex(BUF) _setjmpex((BUF),mingw_getsp()) + int __cdecl __attribute__ ((__nothrow__)) _setjmpex(jmp_buf _Buf,void *_Ctx); +#endif +#else +#ifndef _INC_SETJMPEX +#define setjmp _setjmp +#endif + int __cdecl __attribute__ ((__nothrow__)) setjmp(jmp_buf _Buf); +#endif + + __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/; + __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value); + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/overlay_toolchain/tcc/include/share.h b/overlay_toolchain/tcc/include/share.h new file mode 100644 index 00000000..358855fe --- /dev/null +++ b/overlay_toolchain/tcc/include/share.h @@ -0,0 +1,28 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SHARE +#define _INC_SHARE + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#define _SH_COMPAT 0x00 +#define _SH_DENYRW 0x10 +#define _SH_DENYWR 0x20 +#define _SH_DENYRD 0x30 +#define _SH_DENYNO 0x40 +#define _SH_SECURE 0x80 + +#ifndef NO_OLDNAMES +#define SH_COMPAT _SH_COMPAT +#define SH_DENYRW _SH_DENYRW +#define SH_DENYWR _SH_DENYWR +#define SH_DENYRD _SH_DENYRD +#define SH_DENYNO _SH_DENYNO +#endif + +#endif diff --git a/overlay_toolchain/tcc/include/signal.h b/overlay_toolchain/tcc/include/signal.h new file mode 100644 index 00000000..a518f6b3 --- /dev/null +++ b/overlay_toolchain/tcc/include/signal.h @@ -0,0 +1,63 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SIGNAL +#define _INC_SIGNAL + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SIG_ATOMIC_T_DEFINED +#define _SIG_ATOMIC_T_DEFINED + typedef int sig_atomic_t; +#endif + +#define NSIG 23 + +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGIOT 6 /* IOT instruction */ +#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#ifdef __USE_MINGW_ALARM +#define SIGALRM 14 /* alarm clock */ +#endif +#define SIGTERM 15 +#define SIGBREAK 21 +#define SIGABRT2 22 + +#define SIGABRT_COMPAT 6 + + typedef void (*__p_sig_fn_t)(int); + +#define SIG_DFL (__p_sig_fn_t)0 +#define SIG_IGN (__p_sig_fn_t)1 +#define SIG_GET (__p_sig_fn_t)2 +#define SIG_SGE (__p_sig_fn_t)3 +#define SIG_ACK (__p_sig_fn_t)4 +#define SIG_ERR (__p_sig_fn_t)-1 + + extern void **__cdecl __pxcptinfoptrs(void); +#define _pxcptinfoptrs (*__pxcptinfoptrs()) + + __p_sig_fn_t __cdecl signal(int _SigNum,__p_sig_fn_t _Func); + int __cdecl raise(int _SigNum); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/stdarg.h b/overlay_toolchain/tcc/include/stdarg.h new file mode 100644 index 00000000..10ce733b --- /dev/null +++ b/overlay_toolchain/tcc/include/stdarg.h @@ -0,0 +1,79 @@ +#ifndef _STDARG_H +#define _STDARG_H + +#ifdef __x86_64__ +#ifndef _WIN64 + +//This should be in sync with the declaration on our lib/libtcc1.c +/* GCC compatible definition of va_list. */ +typedef struct { + unsigned int gp_offset; + unsigned int fp_offset; + union { + unsigned int overflow_offset; + char *overflow_arg_area; + }; + char *reg_save_area; +} __va_list_struct; + +typedef __va_list_struct va_list[1]; + +void __va_start(__va_list_struct *ap, void *fp); +void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align); + +#define va_start(ap, last) __va_start(ap, __builtin_frame_address(0)) +#define va_arg(ap, type) \ + (*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type), __alignof__(type)))) +#define va_copy(dest, src) (*(dest) = *(src)) +#define va_end(ap) + +/* avoid conflicting definition for va_list on Macs. */ +#define _VA_LIST_T + +#else /* _WIN64 */ +typedef char *va_list; +#define va_start(ap,last) __builtin_va_start(ap,last) +#define va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \ + ? **(t **)((ap += 8) - 8) : *(t *)((ap += 8) - 8)) +#define va_copy(dest, src) ((dest) = (src)) +#define va_end(ap) +#endif + +#elif __arm__ +typedef char *va_list; +#define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x) +#define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \ + & ~(_tcc_alignof(type) - 1)) +#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3) +#define va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \ + &~3), *(type *)(ap - ((sizeof(type)+3)&~3))) +#define va_copy(dest, src) (dest) = (src) +#define va_end(ap) + +#elif defined(__aarch64__) +typedef struct { + void *__stack; + void *__gr_top; + void *__vr_top; + int __gr_offs; + int __vr_offs; +} va_list; +#define va_start(ap, last) __va_start(ap, last) +#define va_arg(ap, type) __va_arg(ap, type) +#define va_end(ap) +#define va_copy(dest, src) ((dest) = (src)) + +#else /* __i386__ */ +typedef char *va_list; +/* only correct for i386 */ +#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3) +#define va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3))) +#define va_copy(dest, src) (dest) = (src) +#define va_end(ap) +#endif + +/* fix a buggy dependency on GCC in libio.h */ +typedef va_list __gnuc_va_list; +#define _VA_LIST_DEFINED + +#endif /* _STDARG_H */ diff --git a/overlay_toolchain/tcc/include/stdbool.h b/overlay_toolchain/tcc/include/stdbool.h new file mode 100644 index 00000000..d2ee446e --- /dev/null +++ b/overlay_toolchain/tcc/include/stdbool.h @@ -0,0 +1,11 @@ +#ifndef _STDBOOL_H +#define _STDBOOL_H + +/* ISOC99 boolean */ + +#define bool _Bool +#define true 1 +#define false 0 +#define __bool_true_false_are_defined 1 + +#endif /* _STDBOOL_H */ diff --git a/overlay_toolchain/tcc/include/stddef.h b/overlay_toolchain/tcc/include/stddef.h new file mode 100644 index 00000000..694d5037 --- /dev/null +++ b/overlay_toolchain/tcc/include/stddef.h @@ -0,0 +1,54 @@ +#ifndef _STDDEF_H +#define _STDDEF_H + +typedef __SIZE_TYPE__ size_t; +typedef __PTRDIFF_TYPE__ ssize_t; +typedef __WCHAR_TYPE__ wchar_t; +typedef __PTRDIFF_TYPE__ ptrdiff_t; +typedef __PTRDIFF_TYPE__ intptr_t; +typedef __SIZE_TYPE__ uintptr_t; + +#ifndef __int8_t_defined +#define __int8_t_defined +typedef signed char int8_t; +typedef signed short int int16_t; +typedef signed int int32_t; +#ifdef __LP64__ +typedef signed long int int64_t; +#else +typedef signed long long int int64_t; +#endif +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +#ifdef __LP64__ +typedef unsigned long int uint64_t; +#else +typedef unsigned long long int uint64_t; +#endif +#endif + +#ifndef NULL +#define NULL ((void*)0) +#endif + +#define offsetof(type, field) ((size_t)&((type *)0)->field) + +void *alloca(size_t size); + +#endif + +/* Older glibc require a wint_t from (when requested + by __need_wint_t, as otherwise stddef.h isn't allowed to + define this type). Note that this must be outside the normal + _STDDEF_H guard, so that it works even when we've included the file + already (without requiring wint_t). Some other libs define _WINT_T + if they've already provided that type, so we can use that as guard. + TCC defines __WINT_TYPE__ for us. */ +#if defined (__need_wint_t) +#ifndef _WINT_T +#define _WINT_T +typedef __WINT_TYPE__ wint_t; +#endif +#undef __need_wint_t +#endif diff --git a/overlay_toolchain/tcc/include/stdint.h b/overlay_toolchain/tcc/include/stdint.h new file mode 100644 index 00000000..cde32b6e --- /dev/null +++ b/overlay_toolchain/tcc/include/stdint.h @@ -0,0 +1,212 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* ISO C9x 7.18 Integer types + * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794) + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * Contributor: Danny Smith + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Date: 2000-12-02 + */ + + +#ifndef _STDINT_H +#define _STDINT_H + +#include <_mingw.h> + +#define __need_wint_t +#define __need_wchar_t +#include "stddef.h" + +#ifndef __int8_t_defined +#define __int8_t_defined +/* 7.18.1.1 Exact-width integer types */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned uint32_t; +typedef long long int64_t; +typedef unsigned long long uint64_t; +#endif + +/* 7.18.1.2 Minimum-width integer types */ +typedef signed char int_least8_t; +typedef unsigned char uint_least8_t; +typedef short int_least16_t; +typedef unsigned short uint_least16_t; +typedef int int_least32_t; +typedef unsigned uint_least32_t; +typedef long long int_least64_t; +typedef unsigned long long uint_least64_t; + +/* 7.18.1.3 Fastest minimum-width integer types + * Not actually guaranteed to be fastest for all purposes + * Here we use the exact-width types for 8 and 16-bit ints. + */ +typedef char int_fast8_t; +typedef unsigned char uint_fast8_t; +typedef short int_fast16_t; +typedef unsigned short uint_fast16_t; +typedef int int_fast32_t; +typedef unsigned int uint_fast32_t; +typedef long long int_fast64_t; +typedef unsigned long long uint_fast64_t; + +/* 7.18.1.5 Greatest-width integer types */ +typedef long long intmax_t; +typedef unsigned long long uintmax_t; + +/* 7.18.2 Limits of specified-width integer types */ +#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) + +/* 7.18.2.1 Limits of exact-width integer types */ +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647 - 1) +#define INT64_MIN (-9223372036854775807LL - 1) + +#define INT8_MAX 127 +#define INT16_MAX 32767 +#define INT32_MAX 2147483647 +#define INT64_MAX 9223372036854775807LL + +#define UINT8_MAX 0xff /* 255U */ +#define UINT16_MAX 0xffff /* 65535U */ +#define UINT32_MAX 0xffffffff /* 4294967295U */ +#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ + +/* 7.18.2.2 Limits of minimum-width integer types */ +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN + +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX + +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +/* 7.18.2.3 Limits of fastest minimum-width integer types */ +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST64_MIN INT64_MIN + +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MAX INT64_MAX + +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +/* 7.18.2.4 Limits of integer types capable of holding + object pointers */ +#ifdef _WIN64 +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#else +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#endif + +/* 7.18.2.5 Limits of greatest-width integer types */ +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +/* 7.18.3 Limits of other integer types */ +#ifdef _WIN64 +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX +#else +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#endif + +#define SIG_ATOMIC_MIN INT32_MIN +#define SIG_ATOMIC_MAX INT32_MAX + +#ifndef SIZE_MAX +#ifdef _WIN64 +#define SIZE_MAX UINT64_MAX +#else +#define SIZE_MAX UINT32_MAX +#endif +#endif + +#ifndef WCHAR_MIN /* also in wchar.h */ +#define WCHAR_MIN 0 +#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ +#endif + +/* + * wint_t is unsigned short for compatibility with MS runtime + */ +#define WINT_MIN 0 +#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */ + +#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ + + +/* 7.18.4 Macros for integer constants */ +#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS) + +/* 7.18.4.1 Macros for minimum-width integer constants + + According to Douglas Gwyn : + "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC + 9899:1999 as initially published, the expansion was required + to be an integer constant of precisely matching type, which + is impossible to accomplish for the shorter types on most + platforms, because C99 provides no standard way to designate + an integer constant with width less than that of type int. + TC1 changed this to require just an integer constant + *expression* with *promoted* type." + + The trick used here is from Clive D W Feather. +*/ + +#define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val)) +#define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val)) +#define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val)) +/* The 'trick' doesn't work in C89 for long long because, without + suffix, (val) will be evaluated as int, not intmax_t */ +#define INT64_C(val) val##LL + +#define UINT8_C(val) (UINT_LEAST8_MAX-UINT_LEAST8_MAX+(val)) +#define UINT16_C(val) (UINT_LEAST16_MAX-UINT_LEAST16_MAX+(val)) +#define UINT32_C(val) (UINT_LEAST32_MAX-UINT_LEAST32_MAX+(val)) +#define UINT64_C(val) val##ULL + +/* 7.18.4.2 Macros for greatest-width integer constants */ +#define INTMAX_C(val) val##LL +#define UINTMAX_C(val) val##ULL + +#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ + +#endif diff --git a/overlay_toolchain/tcc/include/stdio.h b/overlay_toolchain/tcc/include/stdio.h new file mode 100644 index 00000000..da887936 --- /dev/null +++ b/overlay_toolchain/tcc/include/stdio.h @@ -0,0 +1,429 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDIO +#define _INC_STDIO + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#define BUFSIZ 512 +#define _NFILE _NSTREAM_ +#define _NSTREAM_ 512 +#define _IOB_ENTRIES 20 +#define EOF (-1) + +#ifndef _FILE_DEFINED + struct _iobuf { + char *_ptr; + int _cnt; + char *_base; + int _flag; + int _file; + int _charbuf; + int _bufsiz; + char *_tmpfname; + }; + typedef struct _iobuf FILE; +#define _FILE_DEFINED +#endif + +#ifdef _POSIX_ +#define _P_tmpdir "/" +#define _wP_tmpdir L"/" +#else +#define _P_tmpdir "\\" +#define _wP_tmpdir L"\\" +#endif + +#define L_tmpnam (sizeof(_P_tmpdir) + 12) + +#ifdef _POSIX_ +#define L_ctermid 9 +#define L_cuserid 32 +#endif + +#define SEEK_CUR 1 +#define SEEK_END 2 +#define SEEK_SET 0 + +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +#define FILENAME_MAX 260 +#define FOPEN_MAX 20 +#define _SYS_OPEN 20 +#define TMP_MAX 32767 + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif + +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif + +#ifndef _STDIO_DEFINED +#ifdef _WIN64 + _CRTIMP FILE *__cdecl __iob_func(void); +#else +#ifdef _MSVCRT_ +extern FILE _iob[]; /* A pointer to an array of FILE */ +#define __iob_func() (_iob) +#else +extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */ +#define __iob_func() (*_imp___iob) +#define _iob __iob_func() +#endif +#endif +#endif + +#ifndef _FPOS_T_DEFINED +#define _FPOS_T_DEFINED +#undef _FPOSOFF + +#if (!defined(NO_OLDNAMES) || defined(__GNUC__)) && _INTEGRAL_MAX_BITS >= 64 + typedef __int64 fpos_t; +#define _FPOSOFF(fp) ((long)(fp)) +#else + typedef long long fpos_t; +#define _FPOSOFF(fp) ((long)(fp)) +#endif + +#endif + +#ifndef _STDSTREAM_DEFINED +#define _STDSTREAM_DEFINED + +#define stdin (&__iob_func()[0]) +#define stdout (&__iob_func()[1]) +#define stderr (&__iob_func()[2]) +#endif + +#define _IOREAD 0x0001 +#define _IOWRT 0x0002 + +#define _IOFBF 0x0000 +#define _IOLBF 0x0040 +#define _IONBF 0x0004 + +#define _IOMYBUF 0x0008 +#define _IOEOF 0x0010 +#define _IOERR 0x0020 +#define _IOSTRG 0x0040 +#define _IORW 0x0080 +#ifdef _POSIX_ +#define _IOAPPEND 0x0200 +#endif + +#define _TWO_DIGIT_EXPONENT 0x1 + +#ifndef _STDIO_DEFINED + + _CRTIMP int __cdecl _filbuf(FILE *_File); + _CRTIMP int __cdecl _flsbuf(int _Ch,FILE *_File); +#ifdef _POSIX_ + _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode); +#else + _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode,int _ShFlag); +#endif + void __cdecl clearerr(FILE *_File); + int __cdecl fclose(FILE *_File); + _CRTIMP int __cdecl _fcloseall(void); +#ifdef _POSIX_ + FILE *__cdecl fdopen(int _FileHandle,const char *_Mode); +#else + _CRTIMP FILE *__cdecl _fdopen(int _FileHandle,const char *_Mode); +#endif + int __cdecl feof(FILE *_File); + int __cdecl ferror(FILE *_File); + int __cdecl fflush(FILE *_File); + int __cdecl fgetc(FILE *_File); + _CRTIMP int __cdecl _fgetchar(void); + int __cdecl fgetpos(FILE *_File ,fpos_t *_Pos); + char *__cdecl fgets(char *_Buf,int _MaxCount,FILE *_File); +#ifdef _POSIX_ + int __cdecl fileno(FILE *_File); +#else + _CRTIMP int __cdecl _fileno(FILE *_File); +#endif + _CRTIMP char *__cdecl _tempnam(const char *_DirName,const char *_FilePrefix); + _CRTIMP int __cdecl _flushall(void); + FILE *__cdecl fopen(const char *_Filename,const char *_Mode); + FILE *fopen64(const char *filename,const char *mode); + int __cdecl fprintf(FILE *_File,const char *_Format,...); + int __cdecl fputc(int _Ch,FILE *_File); + _CRTIMP int __cdecl _fputchar(int _Ch); + int __cdecl fputs(const char *_Str,FILE *_File); + size_t __cdecl fread(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File); + FILE *__cdecl freopen(const char *_Filename,const char *_Mode,FILE *_File); + int __cdecl fscanf(FILE *_File,const char *_Format,...); + int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos); + int __cdecl fseek(FILE *_File,long _Offset,int _Origin); + int fseeko64(FILE* stream, _off64_t offset, int whence); + long __cdecl ftell(FILE *_File); + _off64_t ftello64(FILE * stream); + int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin); + __int64 __cdecl _ftelli64(FILE *_File); + size_t __cdecl fwrite(const void *_Str,size_t _Size,size_t _Count,FILE *_File); + int __cdecl getc(FILE *_File); + int __cdecl getchar(void); + _CRTIMP int __cdecl _getmaxstdio(void); + char *__cdecl gets(char *_Buffer); + int __cdecl _getw(FILE *_File); +#ifndef _CRT_PERROR_DEFINED +#define _CRT_PERROR_DEFINED + void __cdecl perror(const char *_ErrMsg); +#endif + _CRTIMP int __cdecl _pclose(FILE *_File); + _CRTIMP FILE *__cdecl _popen(const char *_Command,const char *_Mode); +#if !defined(NO_OLDNAMES) && !defined(popen) +#define popen _popen +#define pclose _pclose +#endif + int __cdecl printf(const char *_Format,...); + int __cdecl putc(int _Ch,FILE *_File); + int __cdecl putchar(int _Ch); + int __cdecl puts(const char *_Str); + _CRTIMP int __cdecl _putw(int _Word,FILE *_File); +#ifndef _CRT_DIRECTORY_DEFINED +#define _CRT_DIRECTORY_DEFINED + int __cdecl remove(const char *_Filename); + int __cdecl rename(const char *_OldFilename,const char *_NewFilename); + _CRTIMP int __cdecl _unlink(const char *_Filename); +#ifndef NO_OLDNAMES + int __cdecl unlink(const char *_Filename); +#endif +#endif + void __cdecl rewind(FILE *_File); + _CRTIMP int __cdecl _rmtmp(void); + int __cdecl scanf(const char *_Format,...); + void __cdecl setbuf(FILE *_File,char *_Buffer); + _CRTIMP int __cdecl _setmaxstdio(int _Max); + _CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format); + _CRTIMP unsigned int __cdecl _get_output_format(void); + int __cdecl setvbuf(FILE *_File,char *_Buf,int _Mode,size_t _Size); + _CRTIMP int __cdecl _scprintf(const char *_Format,...); + int __cdecl sscanf(const char *_Src,const char *_Format,...); + _CRTIMP int __cdecl _snscanf(const char *_Src,size_t _MaxCount,const char *_Format,...); + FILE *__cdecl tmpfile(void); + char *__cdecl tmpnam(char *_Buffer); + int __cdecl ungetc(int _Ch,FILE *_File); + int __cdecl vfprintf(FILE *_File,const char *_Format,va_list _ArgList); + int __cdecl vprintf(const char *_Format,va_list _ArgList); + /* Make sure macros are not defined. */ +#pragma push_macro("vsnprintf") +#pragma push_macro("snprintf") +# undef vsnprintf +# undef snprintf + extern + __attribute__((format(gnu_printf, 3, 0))) __attribute__((nonnull (3))) + int __mingw_vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); + extern + __attribute__((format(gnu_printf, 3, 4))) __attribute__((nonnull (3))) + int __mingw_snprintf(char* s, size_t n, const char* format, ...); + int __cdecl vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snprintf(char *_Dest,size_t _Count,const char *_Format,...); + _CRTIMP int __cdecl _vsnprintf(char *_Dest,size_t _Count,const char *_Format,va_list _Args); + int __cdecl sprintf(char *_Dest,const char *_Format,...); + int __cdecl vsprintf(char *_Dest,const char *_Format,va_list _Args); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ + int __cdecl snprintf(char* s, size_t n, const char* format, ...); + __CRT_INLINE int __cdecl vsnprintf (char* s, size_t n, const char* format,va_list arg) { + return _vsnprintf ( s, n, format, arg); + } + int __cdecl vscanf(const char * Format, va_list argp); + int __cdecl vfscanf (FILE * fp, const char * Format,va_list argp); + int __cdecl vsscanf (const char * _Str,const char * Format,va_list argp); +#endif +/* Restore may prior defined macros snprintf/vsnprintf. */ +#pragma pop_macro("snprintf") +#pragma pop_macro("vsnprintf") +/* Check if vsnprintf and snprintf are defaulting to gnu-style. */ +# if defined(USE_MINGW_GNU_SNPRINTF) && USE_MINGW_GNU_SNPRINTF +# ifndef vsnprint +# define vsnprintf __mingw_vsnprintf +# endif +# ifndef snprintf +# define snprintf __mingw_snprintf +# endif +# endif + _CRTIMP int __cdecl _vscprintf(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _set_printf_count_output(int _Value); + _CRTIMP int __cdecl _get_printf_count_output(void); + +#ifndef _WSTDIO_DEFINED + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifdef _POSIX_ + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); +#else + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); +#endif + wint_t __cdecl fgetwc(FILE *_File); + _CRTIMP wint_t __cdecl _fgetwchar(void); + wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); + wint_t __cdecl getwc(FILE *_File); + wint_t __cdecl getwchar(void); + wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); + wint_t __cdecl putwchar(wchar_t _Ch); + wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); + wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File); + int __cdecl fputws(const wchar_t *_Str,FILE *_File); + _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String); + _CRTIMP int __cdecl _putws(const wchar_t *_Str); + int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...); + int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList); + int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...); + _CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list); + _CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ + int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...); + __CRT_INLINE int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, va_list arg) { return _vsnwprintf(s,n,format,arg); } + int __cdecl vwscanf (const wchar_t *, va_list); + int __cdecl vfwscanf (FILE *,const wchar_t *,va_list); + int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list); +#endif + _CRTIMP int __cdecl _swprintf(wchar_t *_Dest,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args); + +#ifndef RC_INVOKED +#include +#endif + +#ifdef _CRT_NON_CONFORMING_SWPRINTFS +#ifndef __cplusplus +#define swprintf _swprintf +#define vswprintf _vswprintf +#define _swprintf_l __swprintf_l +#define _vswprintf_l __vswprintf_l +#endif +#endif + + _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); + _CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList); + int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...); + int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + int __cdecl wscanf(const wchar_t *_Format,...); + _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfopen(const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); +#if !defined(NO_OLDNAMES) && !defined(wpopen) +#define wpopen _wpopen +#endif + _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); + _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); + _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); + +#undef _CRT_GETPUTWCHAR_NOINLINE + +#if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) +#define getwchar() fgetwc(stdin) +#define putwchar(_c) fputwc((_c),stdout) +#else + __CRT_INLINE wint_t __cdecl getwchar() { return (fgetwc(stdin)); } + __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) { return (fputwc(_C,stdout)); } +#endif + +#define getwc(_stm) fgetwc(_stm) +#define putwc(_c,_stm) fputwc(_c,_stm) +#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) +#define _getwc_nolock(_stm) _fgetwc_nolock(_stm) + +#define _WSTDIO_DEFINED +#endif + +#define _STDIO_DEFINED +#endif + +#define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) +#define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream))) +#define _getc_nolock(_stream) _fgetc_nolock(_stream) +#define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream) +#define _getchar_nolock() _getc_nolock(stdin) +#define _putchar_nolock(_c) _putc_nolock((_c),stdout) +#define _getwchar_nolock() _getwc_nolock(stdin) +#define _putwchar_nolock(_c) _putwc_nolock((_c),stdout) + + _CRTIMP void __cdecl _lock_file(FILE *_File); + _CRTIMP void __cdecl _unlock_file(FILE *_File); + _CRTIMP int __cdecl _fclose_nolock(FILE *_File); + _CRTIMP int __cdecl _fflush_nolock(FILE *_File); + _CRTIMP size_t __cdecl _fread_nolock(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File); + _CRTIMP int __cdecl _fseek_nolock(FILE *_File,long _Offset,int _Origin); + _CRTIMP long __cdecl _ftell_nolock(FILE *_File); + _CRTIMP int __cdecl _fseeki64_nolock(FILE *_File,__int64 _Offset,int _Origin); + _CRTIMP __int64 __cdecl _ftelli64_nolock(FILE *_File); + _CRTIMP size_t __cdecl _fwrite_nolock(const void *_DstBuf,size_t _Size,size_t _Count,FILE *_File); + _CRTIMP int __cdecl _ungetc_nolock(int _Ch,FILE *_File); + +#if !defined(NO_OLDNAMES) || !defined(_POSIX) +#define P_tmpdir _P_tmpdir +#define SYS_OPEN _SYS_OPEN + + char *__cdecl tempnam(const char *_Directory,const char *_FilePrefix); + int __cdecl fcloseall(void); + FILE *__cdecl fdopen(int _FileHandle,const char *_Format); + int __cdecl fgetchar(void); + int __cdecl fileno(FILE *_File); + int __cdecl flushall(void); + int __cdecl fputchar(int _Ch); + int __cdecl getw(FILE *_File); + int __cdecl putw(int _Ch,FILE *_File); + int __cdecl rmtmp(void); +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include + +#endif diff --git a/overlay_toolchain/tcc/include/stdlib.h b/overlay_toolchain/tcc/include/stdlib.h new file mode 100644 index 00000000..96765b29 --- /dev/null +++ b/overlay_toolchain/tcc/include/stdlib.h @@ -0,0 +1,580 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDLIB +#define _INC_STDLIB + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 + +#ifndef _ONEXIT_T_DEFINED +#define _ONEXIT_T_DEFINED + + typedef int (__cdecl *_onexit_t)(void); + +#ifndef NO_OLDNAMES +#define onexit_t _onexit_t +#endif +#endif + +#ifndef _DIV_T_DEFINED +#define _DIV_T_DEFINED + + typedef struct _div_t { + int quot; + int rem; + } div_t; + + typedef struct _ldiv_t { + long quot; + long rem; + } ldiv_t; +#endif + +#ifndef _CRT_DOUBLE_DEC +#define _CRT_DOUBLE_DEC + +#pragma pack(4) + typedef struct { + unsigned char ld[10]; + } _LDOUBLE; +#pragma pack() + +#define _PTR_LD(x) ((unsigned char *)(&(x)->ld)) + + typedef struct { + double x; + } _CRT_DOUBLE; + + typedef struct { + float f; + } _CRT_FLOAT; + +#pragma push_macro("long") +#undef long + + typedef struct { + long double x; + } _LONGDOUBLE; + +#pragma pop_macro("long") + +#pragma pack(4) + typedef struct { + unsigned char ld12[12]; + } _LDBL12; +#pragma pack() +#endif + +#define RAND_MAX 0x7fff + +#ifndef MB_CUR_MAX +#define MB_CUR_MAX ___mb_cur_max_func() +#ifndef __mb_cur_max +#ifdef _MSVCRT_ + extern int __mb_cur_max; +#else +#define __mb_cur_max (*_imp____mb_cur_max) + extern int *_imp____mb_cur_max; +#endif +#endif +#ifdef _MSVCRT_ + extern int __mbcur_max; +#define ___mb_cur_max_func() (__mb_cur_max) +#else + extern int* _imp____mbcur_max; +#define ___mb_cur_max_func() (*_imp____mb_cur_max) +#endif +#endif + +#define __max(a,b) (((a) > (b)) ? (a) : (b)) +#define __min(a,b) (((a) < (b)) ? (a) : (b)) + +#define _MAX_PATH 260 +#define _MAX_DRIVE 3 +#define _MAX_DIR 256 +#define _MAX_FNAME 256 +#define _MAX_EXT 256 + +#define _OUT_TO_DEFAULT 0 +#define _OUT_TO_STDERR 1 +#define _OUT_TO_MSGBOX 2 +#define _REPORT_ERRMODE 3 + +#define _WRITE_ABORT_MSG 0x1 +#define _CALL_REPORTFAULT 0x2 + +#define _MAX_ENV 32767 + + typedef void (__cdecl *_purecall_handler)(void); + + _CRTIMP _purecall_handler __cdecl _set_purecall_handler(_purecall_handler _Handler); + _CRTIMP _purecall_handler __cdecl _get_purecall_handler(void); + + typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t); + _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler); + _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void); + +#ifndef _CRT_ERRNO_DEFINED +#define _CRT_ERRNO_DEFINED + _CRTIMP extern int *__cdecl _errno(void); +#define errno (*_errno()) + errno_t __cdecl _set_errno(int _Value); + errno_t __cdecl _get_errno(int *_Value); +#endif + _CRTIMP unsigned long *__cdecl __doserrno(void); +#define _doserrno (*__doserrno()) + errno_t __cdecl _set_doserrno(unsigned long _Value); + errno_t __cdecl _get_doserrno(unsigned long *_Value); +#ifdef _MSVCRT_ + extern char *_sys_errlist[]; + extern int _sys_nerr; +#else + _CRTIMP char *_sys_errlist[1]; + _CRTIMP int _sys_nerr; +#endif +#if (defined(_X86_) && !defined(__x86_64)) + _CRTIMP int *__cdecl __p___argc(void); + _CRTIMP char ***__cdecl __p___argv(void); + _CRTIMP wchar_t ***__cdecl __p___wargv(void); + _CRTIMP char ***__cdecl __p__environ(void); + _CRTIMP wchar_t ***__cdecl __p__wenviron(void); + _CRTIMP char **__cdecl __p__pgmptr(void); + _CRTIMP wchar_t **__cdecl __p__wpgmptr(void); +#endif +#ifndef __argc +#ifdef _MSVCRT_ + extern int __argc; +#else +#define __argc (*_imp____argc) + extern int *_imp____argc; +#endif +#endif +#ifndef __argv +#ifdef _MSVCRT_ + extern char **__argv; +#else +#define __argv (*_imp____argv) + extern char ***_imp____argv; +#endif +#endif +#ifndef __wargv +#ifdef _MSVCRT_ + extern wchar_t **__wargv; +#else +#define __wargv (*_imp____wargv) + extern wchar_t ***_imp____wargv; +#endif +#endif + +#ifdef _POSIX_ + extern char **environ; +#else +#ifndef _environ +#ifdef _MSVCRT_ + extern char **_environ; +#else +#define _environ (*_imp___environ) + extern char ***_imp___environ; +#endif +#endif + +#ifndef _wenviron +#ifdef _MSVCRT_ + extern wchar_t **_wenviron; +#else +#define _wenviron (*_imp___wenviron) + extern wchar_t ***_imp___wenviron; +#endif +#endif +#endif +#ifndef _pgmptr +#ifdef _MSVCRT_ + extern char *_pgmptr; +#else +#define _pgmptr (*_imp___pgmptr) + extern char **_imp___pgmptr; +#endif +#endif + +#ifndef _wpgmptr +#ifdef _MSVCRT_ + extern wchar_t *_wpgmptr; +#else +#define _wpgmptr (*_imp___wpgmptr) + extern wchar_t **_imp___wpgmptr; +#endif +#endif + errno_t __cdecl _get_pgmptr(char **_Value); + errno_t __cdecl _get_wpgmptr(wchar_t **_Value); +#ifndef _fmode +#ifdef _MSVCRT_ + extern int _fmode; +#else +#define _fmode (*_imp___fmode) + extern int *_imp___fmode; +#endif +#endif + _CRTIMP errno_t __cdecl _set_fmode(int _Mode); + _CRTIMP errno_t __cdecl _get_fmode(int *_PMode); + +#ifndef _osplatform +#ifdef _MSVCRT_ + extern unsigned int _osplatform; +#else +#define _osplatform (*_imp___osplatform) + extern unsigned int *_imp___osplatform; +#endif +#endif + +#ifndef _osver +#ifdef _MSVCRT_ + extern unsigned int _osver; +#else +#define _osver (*_imp___osver) + extern unsigned int *_imp___osver; +#endif +#endif + +#ifndef _winver +#ifdef _MSVCRT_ + extern unsigned int _winver; +#else +#define _winver (*_imp___winver) + extern unsigned int *_imp___winver; +#endif +#endif + +#ifndef _winmajor +#ifdef _MSVCRT_ + extern unsigned int _winmajor; +#else +#define _winmajor (*_imp___winmajor) + extern unsigned int *_imp___winmajor; +#endif +#endif + +#ifndef _winminor +#ifdef _MSVCRT_ + extern unsigned int _winminor; +#else +#define _winminor (*_imp___winminor) + extern unsigned int *_imp___winminor; +#endif +#endif + + errno_t __cdecl _get_osplatform(unsigned int *_Value); + errno_t __cdecl _get_osver(unsigned int *_Value); + errno_t __cdecl _get_winver(unsigned int *_Value); + errno_t __cdecl _get_winmajor(unsigned int *_Value); + errno_t __cdecl _get_winminor(unsigned int *_Value); +#ifndef _countof +#ifndef __cplusplus +#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) +#else + extern "C++" { + template char (*__countof_helper(UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray]; +#define _countof(_Array) sizeof(*__countof_helper(_Array)) + } +#endif +#endif + +#ifndef _CRT_TERMINATE_DEFINED +#define _CRT_TERMINATE_DEFINED + void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; + _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; +#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ + /* C99 function name */ + void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; + __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) + { _exit(status); } +#endif + +#pragma push_macro("abort") +#undef abort + void __cdecl __declspec(noreturn) abort(void); +#pragma pop_macro("abort") + +#endif + + _CRTIMP unsigned int __cdecl _set_abort_behavior(unsigned int _Flags,unsigned int _Mask); + +#ifndef _CRT_ABS_DEFINED +#define _CRT_ABS_DEFINED + int __cdecl abs(int _X); + long __cdecl labs(long _X); +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + __int64 __cdecl _abs64(__int64); +#endif + int __cdecl atexit(void (__cdecl *)(void)); +#ifndef _CRT_ATOF_DEFINED +#define _CRT_ATOF_DEFINED + double __cdecl atof(const char *_String); + double __cdecl _atof_l(const char *_String,_locale_t _Locale); +#endif + int __cdecl atoi(const char *_Str); + _CRTIMP int __cdecl _atoi_l(const char *_Str,_locale_t _Locale); + long __cdecl atol(const char *_Str); + _CRTIMP long __cdecl _atol_l(const char *_Str,_locale_t _Locale); +#ifndef _CRT_ALGO_DEFINED +#define _CRT_ALGO_DEFINED + void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); + void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); +#endif + unsigned short __cdecl _byteswap_ushort(unsigned short _Short); + /*unsigned long __cdecl _byteswap_ulong (unsigned long _Long); */ +#if _INTEGRAL_MAX_BITS >= 64 + unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 _Int64); +#endif + div_t __cdecl div(int _Numerator,int _Denominator); + char *__cdecl getenv(const char *_VarName); + _CRTIMP char *__cdecl _itoa(int _Value,char *_Dest,int _Radix); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP char *__cdecl _i64toa(__int64 _Val,char *_DstBuf,int _Radix); + _CRTIMP char *__cdecl _ui64toa(unsigned __int64 _Val,char *_DstBuf,int _Radix); + _CRTIMP __int64 __cdecl _atoi64(const char *_String); + _CRTIMP __int64 __cdecl _atoi64_l(const char *_String,_locale_t _Locale); + _CRTIMP __int64 __cdecl _strtoi64(const char *_String,char **_EndPtr,int _Radix); + _CRTIMP __int64 __cdecl _strtoi64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP unsigned __int64 __cdecl _strtoui64(const char *_String,char **_EndPtr,int _Radix); + _CRTIMP unsigned __int64 __cdecl _strtoui64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale); +#endif + ldiv_t __cdecl ldiv(long _Numerator,long _Denominator); + _CRTIMP char *__cdecl _ltoa(long _Value,char *_Dest,int _Radix); + int __cdecl mblen(const char *_Ch,size_t _MaxCount); + _CRTIMP int __cdecl _mblen_l(const char *_Ch,size_t _MaxCount,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbstrlen(const char *_Str); + _CRTIMP size_t __cdecl _mbstrlen_l(const char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbstrnlen(const char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _mbstrnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale); + int __cdecl mbtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes); + _CRTIMP int __cdecl _mbtowc_l(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes,_locale_t _Locale); + size_t __cdecl mbstowcs(wchar_t *_Dest,const char *_Source,size_t _MaxCount); + _CRTIMP size_t __cdecl _mbstowcs_l(wchar_t *_Dest,const char *_Source,size_t _MaxCount,_locale_t _Locale); + int __cdecl rand(void); + _CRTIMP int __cdecl _set_error_mode(int _Mode); + void __cdecl srand(unsigned int _Seed); + double __cdecl strtod(const char *_Str,char **_EndPtr); + float __cdecl strtof(const char *nptr, char **endptr); +#if !defined __NO_ISOCEXT /* in libmingwex.a */ + float __cdecl strtof (const char * __restrict__, char ** __restrict__); + long double __cdecl strtold(const char * __restrict__, char ** __restrict__); +#endif /* __NO_ISOCEXT */ + _CRTIMP double __cdecl _strtod_l(const char *_Str,char **_EndPtr,_locale_t _Locale); + long __cdecl strtol(const char *_Str,char **_EndPtr,int _Radix); + _CRTIMP long __cdecl _strtol_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale); + unsigned long __cdecl strtoul(const char *_Str,char **_EndPtr,int _Radix); + _CRTIMP unsigned long __cdecl _strtoul_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale); +#ifndef _CRT_SYSTEM_DEFINED +#define _CRT_SYSTEM_DEFINED + int __cdecl system(const char *_Command); +#endif + _CRTIMP char *__cdecl _ultoa(unsigned long _Value,char *_Dest,int _Radix); + int __cdecl wctomb(char *_MbCh,wchar_t _WCh); + _CRTIMP int __cdecl _wctomb_l(char *_MbCh,wchar_t _WCh,_locale_t _Locale); + size_t __cdecl wcstombs(char *_Dest,const wchar_t *_Source,size_t _MaxCount); + _CRTIMP size_t __cdecl _wcstombs_l(char *_Dest,const wchar_t *_Source,size_t _MaxCount,_locale_t _Locale); + +#ifndef _CRT_ALLOCATION_DEFINED +#define _CRT_ALLOCATION_DEFINED + void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements); + void __cdecl free(void *_Memory); + void *__cdecl malloc(size_t _Size); + void *__cdecl realloc(void *_Memory,size_t _NewSize); + _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size); + //_CRTIMP void __cdecl _aligned_free(void *_Memory); + //_CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset); +#endif + +#ifndef _WSTDLIB_DEFINED +#define _WSTDLIB_DEFINED + + _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix); + double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr); + float __cdecl wcstof(const wchar_t *nptr, wchar_t **endptr); +#if !defined __NO_ISOCEXT /* in libmingwex.a */ + float __cdecl wcstof( const wchar_t * __restrict__, wchar_t ** __restrict__); + long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t ** __restrict__); +#endif /* __NO_ISOCEXT */ + _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale); + long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif + _CRTIMP double __cdecl _wtof(const wchar_t *_Str); + _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _wtoi(const wchar_t *_Str); + _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP long __cdecl _wtol(const wchar_t *_Str); + _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale); + +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str); + _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str ,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); +#endif +#endif + +#ifndef _POSIX_ +#define _CVTBUFSIZE (309+40) + _CRTIMP char *__cdecl _fullpath(char *_FullPath,const char *_Path,size_t _SizeInBytes); + _CRTIMP char *__cdecl _ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign); + _CRTIMP char *__cdecl _fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); + _CRTIMP char *__cdecl _gcvt(double _Val,int _NumOfDigits,char *_DstBuf); + _CRTIMP int __cdecl _atodbl(_CRT_DOUBLE *_Result,char *_Str); + _CRTIMP int __cdecl _atoldbl(_LDOUBLE *_Result,char *_Str); + _CRTIMP int __cdecl _atoflt(_CRT_FLOAT *_Result,char *_Str); + _CRTIMP int __cdecl _atodbl_l(_CRT_DOUBLE *_Result,char *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _atoldbl_l(_LDOUBLE *_Result,char *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _atoflt_l(_CRT_FLOAT *_Result,char *_Str,_locale_t _Locale); + unsigned long __cdecl _lrotl(unsigned long _Val,int _Shift); + unsigned long __cdecl _lrotr(unsigned long _Val,int _Shift); + _CRTIMP void __cdecl _makepath(char *_Path,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); + _onexit_t __cdecl _onexit(_onexit_t _Func); + +#ifndef _CRT_PERROR_DEFINED +#define _CRT_PERROR_DEFINED + void __cdecl perror(const char *_ErrMsg); +#endif + _CRTIMP int __cdecl _putenv(const char *_EnvString); + unsigned int __cdecl _rotl(unsigned int _Val,int _Shift); +#if _INTEGRAL_MAX_BITS >= 64 + unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val,int _Shift); +#endif + unsigned int __cdecl _rotr(unsigned int _Val,int _Shift); +#if _INTEGRAL_MAX_BITS >= 64 + unsigned __int64 __cdecl _rotr64(unsigned __int64 _Val,int _Shift); +#endif + _CRTIMP void __cdecl _searchenv(const char *_Filename,const char *_EnvVar,char *_ResultPath); + _CRTIMP void __cdecl _splitpath(const char *_FullPath,char *_Drive,char *_Dir,char *_Filename,char *_Ext); + _CRTIMP void __cdecl _swab(char *_Buf1,char *_Buf2,int _SizeInBytes); + +#ifndef _WSTDLIBP_DEFINED +#define _WSTDLIBP_DEFINED + _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords); + _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString); + _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath); + _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext); +#endif + + _CRTIMP void __cdecl _beep(unsigned _Frequency,unsigned _Duration) __MINGW_ATTRIB_DEPRECATED; + /* Not to be confused with _set_error_mode (int). */ + _CRTIMP void __cdecl _seterrormode(int _Mode) __MINGW_ATTRIB_DEPRECATED; + _CRTIMP void __cdecl _sleep(unsigned long _Duration) __MINGW_ATTRIB_DEPRECATED; +#endif + +#ifndef NO_OLDNAMES +#ifndef _POSIX_ +#if 0 +#ifndef __cplusplus +#ifndef NOMINMAX +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#endif +#endif +#endif + +#define sys_errlist _sys_errlist +#define sys_nerr _sys_nerr +#define environ _environ + char *__cdecl ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign); + char *__cdecl fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); + char *__cdecl gcvt(double _Val,int _NumOfDigits,char *_DstBuf); + char *__cdecl itoa(int _Val,char *_DstBuf,int _Radix); + char *__cdecl ltoa(long _Val,char *_DstBuf,int _Radix); + int __cdecl putenv(const char *_EnvString); + void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes); + char *__cdecl ultoa(unsigned long _Val,char *_Dstbuf,int _Radix); + onexit_t __cdecl onexit(onexit_t _Func); +#endif +#endif + +#if !defined __NO_ISOCEXT /* externs in static libmingwex.a */ + + typedef struct { long long quot, rem; } lldiv_t; + + lldiv_t __cdecl lldiv(long long, long long); + + __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); } + + long long __cdecl strtoll(const char* __restrict__, char** __restrict, int); + unsigned long long __cdecl strtoull(const char* __restrict__, char** __restrict__, int); + + /* these are stubs for MS _i64 versions */ + long long __cdecl atoll (const char *); + +#ifndef __STRICT_ANSI__ + long long __cdecl wtoll (const wchar_t *); + char *__cdecl lltoa (long long, char *, int); + char *__cdecl ulltoa (unsigned long long , char *, int); + wchar_t *__cdecl lltow (long long, wchar_t *, int); + wchar_t *__cdecl ulltow (unsigned long long, wchar_t *, int); + + /* __CRT_INLINE using non-ansi functions */ + __CRT_INLINE long long __cdecl atoll (const char * _c) { return _atoi64 (_c); } + __CRT_INLINE char *__cdecl lltoa (long long _n, char * _c, int _i) { return _i64toa (_n, _c, _i); } + __CRT_INLINE char *__cdecl ulltoa (unsigned long long _n, char * _c, int _i) { return _ui64toa (_n, _c, _i); } + __CRT_INLINE long long __cdecl wtoll (const wchar_t * _w) { return _wtoi64 (_w); } + __CRT_INLINE wchar_t *__cdecl lltow (long long _n, wchar_t * _w, int _i) { return _i64tow (_n, _w, _i); } + __CRT_INLINE wchar_t *__cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); } +#endif /* (__STRICT_ANSI__) */ + +#endif /* !__NO_ISOCEXT */ + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include +#include + +#endif diff --git a/overlay_toolchain/tcc/include/string.h b/overlay_toolchain/tcc/include/string.h new file mode 100644 index 00000000..3249dc3b --- /dev/null +++ b/overlay_toolchain/tcc/include/string.h @@ -0,0 +1,164 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STRING +#define _INC_STRING + +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _NLSCMP_DEFINED +#define _NLSCMP_DEFINED +#define _NLSCMPERROR 2147483647 +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define _WConst_return _CONST_RETURN + +#ifndef _CRT_MEMORY_DEFINED +#define _CRT_MEMORY_DEFINED + _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); + _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); + _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); + _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); + int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); + void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); + void *__cdecl memset(void *_Dst,int _Val,size_t _Size); +#ifndef NO_OLDNAMES + void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); + int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); +#endif +#endif + char *__cdecl _strset(char *_Str,int _Val); + char *__cdecl strcpy(char *_Dest,const char *_Source); + char *__cdecl strcat(char *_Dest,const char *_Source); + int __cdecl strcmp(const char *_Str1,const char *_Str2); + size_t __cdecl strlen(const char *_Str); +#if 0 + size_t __cdecl strnlen(const char *_Str,size_t _MaxCount); +#endif + void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size); + _CRTIMP char *__cdecl _strdup(const char *_Src); + _CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val); + _CRTIMP int __cdecl _stricmp(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _strcmpi(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _stricmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + int __cdecl strcoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _strcoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _stricoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _stricoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _strncoll (const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _strnicoll (const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + size_t __cdecl strcspn(const char *_Str,const char *_Control); + _CRTIMP char *__cdecl _strerror(const char *_ErrMsg); + char *__cdecl strerror(int); + _CRTIMP char *__cdecl _strlwr(char *_String); + char *strlwr_l(char *_String,_locale_t _Locale); + char *__cdecl strncat(char *_Dest,const char *_Source,size_t _Count); + int __cdecl strncmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + char *strncpy(char *_Dest,const char *_Source,size_t _Count); + _CRTIMP char *__cdecl _strnset(char *_Str,int _Val,size_t _MaxCount); + _CONST_RETURN char *__cdecl strpbrk(const char *_Str,const char *_Control); + _CONST_RETURN char *__cdecl strrchr(const char *_Str,int _Ch); + _CRTIMP char *__cdecl _strrev(char *_Str); + size_t __cdecl strspn(const char *_Str,const char *_Control); + _CONST_RETURN char *__cdecl strstr(const char *_Str,const char *_SubStr); + char *__cdecl strtok(char *_Str,const char *_Delim); + _CRTIMP char *__cdecl _strupr(char *_String); + _CRTIMP char *_strupr_l(char *_String,_locale_t _Locale); + size_t __cdecl strxfrm(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP size_t __cdecl _strxfrm_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + +#ifndef NO_OLDNAMES + char *__cdecl strdup(const char *_Src); + int __cdecl strcmpi(const char *_Str1,const char *_Str2); + int __cdecl stricmp(const char *_Str1,const char *_Str2); + char *__cdecl strlwr(char *_Str); + int __cdecl strnicmp(const char *_Str1,const char *_Str,size_t _MaxCount); + __CRT_INLINE int __cdecl strncasecmp (const char *__sz1, const char *__sz2, size_t __sizeMaxCompare) { return _strnicmp (__sz1, __sz2, __sizeMaxCompare); } + __CRT_INLINE int __cdecl strcasecmp (const char *__sz1, const char *__sz2) { return _stricmp (__sz1, __sz2); } + char *__cdecl strnset(char *_Str,int _Val,size_t _MaxCount); + char *__cdecl strrev(char *_Str); + char *__cdecl strset(char *_Str,int _Val); + char *__cdecl strupr(char *_Str); +#endif + +#ifndef _WSTRING_DEFINED +#define _WSTRING_DEFINED + + _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); + wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); + _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); + int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); + wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); + size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); + size_t __cdecl wcslen(const wchar_t *_Str); + size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); + wchar_t *wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); + size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr); + wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim); + _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum); + _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str); + _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str); + _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val); + _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String); + _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String); + _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale); + size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount); + _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale); + int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + +#ifndef NO_OLDNAMES + wchar_t *__cdecl wcsdup(const wchar_t *_Str); +#define wcswcs wcsstr + int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + wchar_t *__cdecl wcsrev(wchar_t *_Str); + wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val); + wchar_t *__cdecl wcslwr(wchar_t *_Str); + wchar_t *__cdecl wcsupr(wchar_t *_Str); + int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/overlay_toolchain/tcc/include/sys/fcntl.h b/overlay_toolchain/tcc/include/sys/fcntl.h new file mode 100644 index 00000000..29fd55a1 --- /dev/null +++ b/overlay_toolchain/tcc/include/sys/fcntl.h @@ -0,0 +1,13 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * This file is part of the Mingw32 package. + * + * This fcntl.h maps to the root fcntl.h + */ +#ifndef __STRICT_ANSI__ +#include +#endif diff --git a/overlay_toolchain/tcc/include/sys/file.h b/overlay_toolchain/tcc/include/sys/file.h new file mode 100644 index 00000000..370f352d --- /dev/null +++ b/overlay_toolchain/tcc/include/sys/file.h @@ -0,0 +1,14 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * This file is part of the Mingw32 package. + * + * This file.h maps to the root fcntl.h + * TODO? + */ +#ifndef __STRICT_ANSI__ +#include +#endif diff --git a/overlay_toolchain/tcc/include/sys/locking.h b/overlay_toolchain/tcc/include/sys/locking.h new file mode 100644 index 00000000..e3fc85b3 --- /dev/null +++ b/overlay_toolchain/tcc/include/sys/locking.h @@ -0,0 +1,30 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_LOCKING +#define _INC_LOCKING + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +/* All the headers include this file. */ +#include <_mingw.h> + +#define _LK_UNLCK 0 +#define _LK_LOCK 1 +#define _LK_NBLCK 2 +#define _LK_RLCK 3 +#define _LK_NBRLCK 4 + +#ifndef NO_OLDNAMES +#define LK_UNLCK _LK_UNLCK +#define LK_LOCK _LK_LOCK +#define LK_NBLCK _LK_NBLCK +#define LK_RLCK _LK_RLCK +#define LK_NBRLCK _LK_NBRLCK +#endif + +#endif diff --git a/overlay_toolchain/tcc/include/sys/stat.h b/overlay_toolchain/tcc/include/sys/stat.h new file mode 100644 index 00000000..344d4a24 --- /dev/null +++ b/overlay_toolchain/tcc/include/sys/stat.h @@ -0,0 +1,290 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STAT +#define _INC_STAT + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <_mingw.h> +#include + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#include + +#ifndef __TINYC__ /* gr */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif +#endif + +#ifndef _TIME32_T_DEFINED + typedef long __time32_t; +#define _TIME32_T_DEFINED +#endif + +#ifndef _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +#define _TIME64_T_DEFINED +#endif + +#ifndef _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#define _TIME_T_DEFINED +#endif + +#ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + +#ifndef _STAT_DEFINED + +#ifdef _USE_32BIT_TIME_T +#ifndef _WIN64 +#define _fstat32 _fstat +#define _stat32 _stat +#define _wstat32 _wstat +#else +#define _fstat _fstat32 +#define _stat _stat32 +#define _wstat _wstat32 +#endif +#define _fstati64 _fstat32i64 +#define _stati64 _stat32i64 +#define _wstati64 _wstat32i64 +#else +#define _fstat _fstat64i32 +#define _fstati64 _fstat64 +#define _stat _stat64i32 +#define _stati64 _stat64 +#define _wstat _wstat64i32 +#define _wstati64 _wstat64 +#endif + + struct _stat32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + +#ifndef NO_OLDNAMES + struct stat { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; + }; +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + struct _stat32i64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + + struct _stat64i32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; + + struct _stat64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; +#endif + +#define __stat64 _stat64 + +#define _STAT_DEFINED +#endif + +#define _S_IFMT 0xF000 +#define _S_IFDIR 0x4000 +#define _S_IFCHR 0x2000 +#define _S_IFIFO 0x1000 +#define _S_IFREG 0x8000 +#define _S_IREAD 0x0100 +#define _S_IWRITE 0x0080 +#define _S_IEXEC 0x0040 + + _CRTIMP int __cdecl _fstat32(int _FileDes,struct _stat32 *_Stat); + _CRTIMP int __cdecl _stat32(const char *_Name,struct _stat32 *_Stat); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat); + _CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat); + int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat); + __CRT_INLINE int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat) + { + struct _stat64 st; + int ret=_fstat64(_FileDes,&st); + _Stat->st_dev=st.st_dev; + _Stat->st_ino=st.st_ino; + _Stat->st_mode=st.st_mode; + _Stat->st_nlink=st.st_nlink; + _Stat->st_uid=st.st_uid; + _Stat->st_gid=st.st_gid; + _Stat->st_rdev=st.st_rdev; + _Stat->st_size=(_off_t) st.st_size; + _Stat->st_atime=st.st_atime; + _Stat->st_mtime=st.st_mtime; + _Stat->st_ctime=st.st_ctime; + return ret; + } + _CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat); + _CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat); + int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat); + __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat) + { + struct _stat64 st; + int ret=_stat64(_Name,&st); + _Stat->st_dev=st.st_dev; + _Stat->st_ino=st.st_ino; + _Stat->st_mode=st.st_mode; + _Stat->st_nlink=st.st_nlink; + _Stat->st_uid=st.st_uid; + _Stat->st_gid=st.st_gid; + _Stat->st_rdev=st.st_rdev; + _Stat->st_size=(_off_t) st.st_size; + _Stat->st_atime=st.st_atime; + _Stat->st_mtime=st.st_mtime; + _Stat->st_ctime=st.st_ctime; + return ret; + } +#endif + +#ifndef _WSTAT_DEFINED +#define _WSTAT_DEFINED + _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); + int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); + _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); +#endif +#endif + +#ifndef NO_OLDNAMES +#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ + +#define S_IFMT _S_IFMT +#define S_IFDIR _S_IFDIR +#define S_IFCHR _S_IFCHR +#define S_IFREG _S_IFREG +#define S_IREAD _S_IREAD +#define S_IWRITE _S_IWRITE +#define S_IEXEC _S_IEXEC +#define S_IFIFO _S_IFIFO +#define S_IFBLK _S_IFBLK + +#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) +#define _S_IXUSR _S_IEXEC +#define _S_IWUSR _S_IWRITE + +#define S_IRWXU _S_IRWXU +#define S_IXUSR _S_IXUSR +#define S_IWUSR _S_IWUSR +#define S_IRUSR _S_IRUSR +#define _S_IRUSR _S_IREAD + +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) + +#endif + +#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) +int __cdecl stat(const char *_Filename,struct stat *_Stat); +int __cdecl fstat(int _Desc,struct stat *_Stat); +int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat); +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { + return _fstat32(_Desc,(struct _stat32 *)_Stat); +} +__CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { + return _stat32(_Filename,(struct _stat32 *)_Stat); +} +#else +__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { + return _fstat64i32(_Desc,(struct _stat64i32 *)_Stat); +} +__CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { + return _stat64i32(_Filename,(struct _stat64i32 *)_Stat); +} +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/overlay_toolchain/tcc/include/sys/time.h b/overlay_toolchain/tcc/include/sys/time.h new file mode 100644 index 00000000..8ccab831 --- /dev/null +++ b/overlay_toolchain/tcc/include/sys/time.h @@ -0,0 +1,69 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __STRICT_ANSI__ +#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ +#define _TIMEVAL_DEFINED +struct timeval { + long tv_sec; + long tv_usec; +}; +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec != (uvp)->tv_sec) ? \ + ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ + ((tvp)->tv_usec cmp (uvp)->tv_usec)) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif /* _TIMEVAL_DEFINED */ + +#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ +#define _TIMEZONE_DEFINED +/* Provided for compatibility with code that assumes that + the presence of gettimeofday function implies a definition + of struct timezone. */ +struct timezone +{ + int tz_minuteswest; /* of Greenwich */ + int tz_dsttime; /* type of dst correction to apply */ +}; + + extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); + +#endif + +/* + Implementation as per: + The Open Group Base Specifications, Issue 6 + IEEE Std 1003.1, 2004 Edition + + The timezone pointer arg is ignored. Errors are ignored. +*/ +#ifndef _GETTIMEOFDAY_DEFINED +#define _GETTIMEOFDAY_DEFINED +int __cdecl gettimeofday(struct timeval *__restrict__, + void *__restrict__ /* tzp (unused) */); +#endif + +#endif /* __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif + +/* Adding timespec definition. */ +#include + + +#endif /* _SYS_TIME_H_ */ diff --git a/overlay_toolchain/tcc/include/sys/timeb.h b/overlay_toolchain/tcc/include/sys/timeb.h new file mode 100644 index 00000000..34837738 --- /dev/null +++ b/overlay_toolchain/tcc/include/sys/timeb.h @@ -0,0 +1,133 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _TIMEB_H_ +#define _TIMEB_H_ + +#include <_mingw.h> + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#ifndef __TINYC__ /* gr */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif +#endif + +#ifndef _TIME32_T_DEFINED + typedef long __time32_t; +#define _TIME32_T_DEFINED +#endif + +#ifndef _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +#define _TIME64_T_DEFINED +#endif + +#ifndef _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#define _TIME_T_DEFINED +#endif + +#ifndef _TIMEB_DEFINED +#define _TIMEB_DEFINED + + struct __timeb32 { + __time32_t time; + unsigned short millitm; + short timezone; + short dstflag; + }; + +#ifndef NO_OLDNAMES + struct timeb { + time_t time; + unsigned short millitm; + short timezone; + short dstflag; + }; +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + struct __timeb64 { + __time64_t time; + unsigned short millitm; + short timezone; + short dstflag; + }; +#endif + +#ifdef _USE_32BIT_TIME_T +#define _timeb __timeb32 +//gr #define _ftime _ftime32 +#define _ftime32 _ftime +#else +#define _timeb __timeb64 +#define _ftime _ftime64 +#endif +#endif + + _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time); +#endif + +#ifndef _TIMESPEC_DEFINED +#define _TIMESPEC_DEFINED +struct timespec { + time_t tv_sec; /* Seconds */ + long tv_nsec; /* Nanoseconds */ +}; + +struct itimerspec { + struct timespec it_interval; /* Timer period */ + struct timespec it_value; /* Timer expiration */ +}; +#endif + +#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { + _ftime32((struct __timeb32 *)_Tmb); +} +#else +__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { + _ftime64((struct __timeb64 *)_Tmb); +} +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include +#endif diff --git a/overlay_toolchain/tcc/include/sys/types.h b/overlay_toolchain/tcc/include/sys/types.h new file mode 100644 index 00000000..7379b0f1 --- /dev/null +++ b/overlay_toolchain/tcc/include/sys/types.h @@ -0,0 +1,118 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_TYPES +#define _INC_TYPES + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <_mingw.h> + +#ifndef __TINYC__ /* gr */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif +#endif + +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED +typedef long __time32_t; +#endif + +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 +typedef __int64 __time64_t; +#endif +#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T +typedef __time32_t time_t; +#else +typedef __time64_t time_t; +#endif +#endif + +#ifndef _INO_T_DEFINED +#define _INO_T_DEFINED +typedef unsigned short _ino_t; +#ifndef NO_OLDNAMES +typedef unsigned short ino_t; +#endif +#endif + +#ifndef _DEV_T_DEFINED +#define _DEV_T_DEFINED +typedef unsigned int _dev_t; +#ifndef NO_OLDNAMES +typedef unsigned int dev_t; +#endif +#endif + +#ifndef _PID_T_ +#define _PID_T_ +#ifndef _WIN64 +typedef int _pid_t; +#else +typedef __int64 _pid_t; +#endif + +#ifndef NO_OLDNAMES +typedef _pid_t pid_t; +#endif +#endif /* Not _PID_T_ */ + +#ifndef _MODE_T_ +#define _MODE_T_ +typedef unsigned short _mode_t; + +#ifndef NO_OLDNAMES +typedef _mode_t mode_t; +#endif +#endif /* Not _MODE_T_ */ + +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif + +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif + +#ifndef _TIMESPEC_DEFINED +#define _TIMESPEC_DEFINED +struct timespec { + time_t tv_sec; /* Seconds */ + long tv_nsec; /* Nanoseconds */ +}; + +struct itimerspec { + struct timespec it_interval; /* Timer period */ + struct timespec it_value; /* Timer expiration */ +}; +#endif + +#endif diff --git a/overlay_toolchain/tcc/include/sys/unistd.h b/overlay_toolchain/tcc/include/sys/unistd.h new file mode 100644 index 00000000..31006d32 --- /dev/null +++ b/overlay_toolchain/tcc/include/sys/unistd.h @@ -0,0 +1,14 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +/* + * This file is part of the Mingw32 package. + * + * unistd.h maps (roughly) to io.h + */ +#ifndef __STRICT_ANSI__ +#include +#endif + diff --git a/overlay_toolchain/tcc/include/sys/utime.h b/overlay_toolchain/tcc/include/sys/utime.h new file mode 100644 index 00000000..fec8304f --- /dev/null +++ b/overlay_toolchain/tcc/include/sys/utime.h @@ -0,0 +1,146 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_UTIME +#define _INC_UTIME + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + +#ifndef __TINYC__ /* gr */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif +#endif + +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED + typedef long __time32_t; +#endif + +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#endif + +#ifndef _UTIMBUF_DEFINED +#define _UTIMBUF_DEFINED + + struct _utimbuf { + time_t actime; + time_t modtime; + }; + + struct __utimbuf32 { + __time32_t actime; + __time32_t modtime; + }; + +#if _INTEGRAL_MAX_BITS >= 64 + struct __utimbuf64 { + __time64_t actime; + __time64_t modtime; + }; +#endif + +#ifndef NO_OLDNAMES + struct utimbuf { + time_t actime; + time_t modtime; + }; + + struct utimbuf32 { + __time32_t actime; + __time32_t modtime; + }; +#endif +#endif + + _CRTIMP int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Time); + _CRTIMP int __cdecl _futime32(int _FileDes,struct __utimbuf32 *_Time); + _CRTIMP int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Time); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _utime64(const char *_Filename,struct __utimbuf64 *_Time); + _CRTIMP int __cdecl _futime64(int _FileDes,struct __utimbuf64 *_Time); + _CRTIMP int __cdecl _wutime64(const wchar_t *_Filename,struct __utimbuf64 *_Time); +#endif + +#ifndef RC_INVOKED +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { + return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { + return _futime32(_Desc,(struct __utimbuf32 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { + return _wutime32(_Filename,(struct __utimbuf32 *)_Utimbuf); +} +#else +__CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { + return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { + return _futime64(_Desc,(struct __utimbuf64 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { + return _wutime64(_Filename,(struct __utimbuf64 *)_Utimbuf); +} +#endif + +#ifndef NO_OLDNAMES +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { + return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); +} +#else +__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { + return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); +} +#endif +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/overlay_toolchain/tcc/include/tcc/tcc_libm.h b/overlay_toolchain/tcc/include/tcc/tcc_libm.h new file mode 100644 index 00000000..0a62e6fb --- /dev/null +++ b/overlay_toolchain/tcc/include/tcc/tcc_libm.h @@ -0,0 +1,201 @@ +#ifndef _TCC_LIBM_H_ +#define _TCC_LIBM_H_ + +#include "../math.h" + +/* TCC uses 8 bytes for double and long double, so effectively the l variants + * are never used. For now, they just run the normal (double) variant. + */ + +/* + * most of the code in this file is taken from MUSL rs-1.0 (MIT license) + * - musl-libc: http://git.musl-libc.org/cgit/musl/tree/src/math?h=rs-1.0 + * - License: http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT?h=rs-1.0 + */ + +/******************************************************************************* + Start of code based on MUSL +*******************************************************************************/ +/* +musl as a whole is licensed under the following standard MIT license: + +---------------------------------------------------------------------- +Copyright © 2005-2014 Rich Felker, et al. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +---------------------------------------------------------------------- +*/ + +/* fpclassify */ + +__CRT_INLINE int __cdecl __fpclassify (double x) { + union {double f; uint64_t i;} u = {x}; + int e = u.i>>52 & 0x7ff; + if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; + if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; + return FP_NORMAL; +} + +__CRT_INLINE int __cdecl __fpclassifyf (float x) { + union {float f; uint32_t i;} u = {x}; + int e = u.i>>23 & 0xff; + if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; + if (e==0xff) return u.i<<9 ? FP_NAN : FP_INFINITE; + return FP_NORMAL; +} + +__CRT_INLINE int __cdecl __fpclassifyl (long double x) { + return __fpclassify(x); +} + + +/* signbit */ + +__CRT_INLINE int __cdecl __signbit (double x) { + union {double d; uint64_t i;} y = { x }; + return y.i>>63; +} + +__CRT_INLINE int __cdecl __signbitf (float x) { + union {float f; uint32_t i; } y = { x }; + return y.i>>31; +} + +__CRT_INLINE int __cdecl __signbitl (long double x) { + return __signbit(x); +} + + +/* fmin*, fmax* */ + +#define TCCFP_FMIN_EVAL (isnan(x) ? y : \ + isnan(y) ? x : \ + (signbit(x) != signbit(y)) ? (signbit(x) ? x : y) : \ + x < y ? x : y) + +__CRT_INLINE double __cdecl fmin (double x, double y) { + return TCCFP_FMIN_EVAL; +} + +__CRT_INLINE float __cdecl fminf (float x, float y) { + return TCCFP_FMIN_EVAL; +} + +__CRT_INLINE long double __cdecl fminl (long double x, long double y) { + return TCCFP_FMIN_EVAL; +} + +#define TCCFP_FMAX_EVAL (isnan(x) ? y : \ + isnan(y) ? x : \ + (signbit(x) != signbit(y)) ? (signbit(x) ? y : x) : \ + x < y ? y : x) + +__CRT_INLINE double __cdecl fmax (double x, double y) { + return TCCFP_FMAX_EVAL; +} + +__CRT_INLINE float __cdecl fmaxf (float x, float y) { + return TCCFP_FMAX_EVAL; +} + +__CRT_INLINE long double __cdecl fmaxl (long double x, long double y) { + return TCCFP_FMAX_EVAL; +} + + +/* *round* */ + +#define TCCFP_FORCE_EVAL(x) do { \ +if (sizeof(x) == sizeof(float)) { \ + volatile float __x; \ + __x = (x); \ +} else if (sizeof(x) == sizeof(double)) { \ + volatile double __x; \ + __x = (x); \ +} else { \ + volatile long double __x; \ + __x = (x); \ +} \ +} while(0) + +__CRT_INLINE double __cdecl round (double x) { + union {double f; uint64_t i;} u = {x}; + int e = u.i >> 52 & 0x7ff; + double y; + + if (e >= 0x3ff+52) + return x; + if (u.i >> 63) + x = -x; + if (e < 0x3ff-1) { + /* raise inexact if x!=0 */ + TCCFP_FORCE_EVAL(x + 0x1p52); + return 0*u.f; + } + y = (double)(x + 0x1p52) - 0x1p52 - x; + if (y > 0.5) + y = y + x - 1; + else if (y <= -0.5) + y = y + x + 1; + else + y = y + x; + if (u.i >> 63) + y = -y; + return y; +} + +__CRT_INLINE long __cdecl lround (double x) { + return round(x); +} + +__CRT_INLINE long long __cdecl llround (double x) { + return round(x); +} + +__CRT_INLINE float __cdecl roundf (float x) { + return round(x); +} + +__CRT_INLINE long __cdecl lroundf (float x) { + return round(x); +} + +__CRT_INLINE long long __cdecl llroundf (float x) { + return round(x); +} + +__CRT_INLINE long double __cdecl roundl (long double x) { + return round(x); +} + +__CRT_INLINE long __cdecl lroundl (long double x) { + return round(x); +} + +__CRT_INLINE long long __cdecl llroundl (long double x) { + return round(x); +} + + +/******************************************************************************* + End of code based on MUSL +*******************************************************************************/ + +#endif /* _TCC_LIBM_H_ */ diff --git a/overlay_toolchain/tcc/include/tcclib.h b/overlay_toolchain/tcc/include/tcclib.h new file mode 100644 index 00000000..8d59e4c9 --- /dev/null +++ b/overlay_toolchain/tcc/include/tcclib.h @@ -0,0 +1,80 @@ +/* Simple libc header for TCC + * + * Add any function you want from the libc there. This file is here + * only for your convenience so that you do not need to put the whole + * glibc include files on your floppy disk + */ +#ifndef _TCCLIB_H +#define _TCCLIB_H + +#include +#include + +/* stdlib.h */ +void *calloc(size_t nmemb, size_t size); +void *malloc(size_t size); +void free(void *ptr); +void *realloc(void *ptr, size_t size); +int atoi(const char *nptr); +long int strtol(const char *nptr, char **endptr, int base); +unsigned long int strtoul(const char *nptr, char **endptr, int base); +void exit(int); + +/* stdio.h */ +typedef struct __FILE FILE; +#define EOF (-1) +extern FILE *stdin; +extern FILE *stdout; +extern FILE *stderr; +FILE *fopen(const char *path, const char *mode); +FILE *fdopen(int fildes, const char *mode); +FILE *freopen(const char *path, const char *mode, FILE *stream); +int fclose(FILE *stream); +size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); +size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream); +int fgetc(FILE *stream); +char *fgets(char *s, int size, FILE *stream); +int getc(FILE *stream); +int getchar(void); +char *gets(char *s); +int ungetc(int c, FILE *stream); +int fflush(FILE *stream); +int putchar (int c); + +int printf(const char *format, ...); +int fprintf(FILE *stream, const char *format, ...); +int sprintf(char *str, const char *format, ...); +int snprintf(char *str, size_t size, const char *format, ...); +int asprintf(char **strp, const char *format, ...); +int dprintf(int fd, const char *format, ...); +int vprintf(const char *format, va_list ap); +int vfprintf(FILE *stream, const char *format, va_list ap); +int vsprintf(char *str, const char *format, va_list ap); +int vsnprintf(char *str, size_t size, const char *format, va_list ap); +int vasprintf(char **strp, const char *format, va_list ap); +int vdprintf(int fd, const char *format, va_list ap); + +void perror(const char *s); + +/* string.h */ +char *strcat(char *dest, const char *src); +char *strchr(const char *s, int c); +char *strrchr(const char *s, int c); +char *strcpy(char *dest, const char *src); +void *memcpy(void *dest, const void *src, size_t n); +void *memmove(void *dest, const void *src, size_t n); +void *memset(void *s, int c, size_t n); +char *strdup(const char *s); +size_t strlen(const char *s); + +/* dlfcn.h */ +#define RTLD_LAZY 0x001 +#define RTLD_NOW 0x002 +#define RTLD_GLOBAL 0x100 + +void *dlopen(const char *filename, int flag); +const char *dlerror(void); +void *dlsym(void *handle, char *symbol); +int dlclose(void *handle); + +#endif /* _TCCLIB_H */ diff --git a/overlay_toolchain/tcc/include/tchar.h b/overlay_toolchain/tcc/include/tchar.h new file mode 100644 index 00000000..cd44beca --- /dev/null +++ b/overlay_toolchain/tcc/include/tchar.h @@ -0,0 +1,1102 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#ifndef _INC_TCHAR +#define _INC_TCHAR + +#ifdef _STRSAFE_H_INCLUDED_ +#error Need to include strsafe.h after tchar.h +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define _ftcscat _tcscat +#define _ftcschr _tcschr +#define _ftcscpy _tcscpy +#define _ftcscspn _tcscspn +#define _ftcslen _tcslen +#define _ftcsncat _tcsncat +#define _ftcsncpy _tcsncpy +#define _ftcspbrk _tcspbrk +#define _ftcsrchr _tcsrchr +#define _ftcsspn _tcsspn +#define _ftcsstr _tcsstr +#define _ftcstok _tcstok + +#define _ftcsdup _tcsdup +#define _ftcsnset _tcsnset +#define _ftcsrev _tcsrev +#define _ftcsset _tcsset + +#define _ftcscmp _tcscmp +#define _ftcsicmp _tcsicmp +#define _ftcsnccmp _tcsnccmp +#define _ftcsncmp _tcsncmp +#define _ftcsncicmp _tcsncicmp +#define _ftcsnicmp _tcsnicmp + +#define _ftcscoll _tcscoll +#define _ftcsicoll _tcsicoll +#define _ftcsnccoll _tcsnccoll +#define _ftcsncoll _tcsncoll +#define _ftcsncicoll _tcsncicoll +#define _ftcsnicoll _tcsnicoll + +#define _ftcsclen _tcsclen +#define _ftcsnccat _tcsnccat +#define _ftcsnccpy _tcsnccpy +#define _ftcsncset _tcsncset + +#define _ftcsdec _tcsdec +#define _ftcsinc _tcsinc +#define _ftcsnbcnt _tcsnbcnt +#define _ftcsnccnt _tcsnccnt +#define _ftcsnextc _tcsnextc +#define _ftcsninc _tcsninc +#define _ftcsspnp _tcsspnp + +#define _ftcslwr _tcslwr +#define _ftcsupr _tcsupr + +#define _ftclen _tclen +#define _ftccpy _tccpy +#define _ftccmp _tccmp + +#ifndef _CONST_RETURN +#ifdef __cplusplus +#define _CONST_RETURN const +#define _CRT_CONST_CORRECT_OVERLOADS +#else +#define _CONST_RETURN +#endif +#endif + +#define _WConst_return _CONST_RETURN + +#ifdef _UNICODE + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WCTYPE_T_DEFINED +#define _WCTYPE_T_DEFINED + typedef unsigned short wint_t; + typedef unsigned short wctype_t; +#endif + +#ifndef __TCHAR_DEFINED +#define __TCHAR_DEFINED + typedef wchar_t _TCHAR; + typedef wchar_t _TSCHAR; + typedef wchar_t _TUCHAR; + typedef wchar_t _TXCHAR; + typedef wint_t _TINT; +#endif + +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED +#ifndef NO_OLDNAMES + typedef wchar_t TCHAR; +#endif +#endif + +#define _TEOF WEOF + +#define __T(x) L##x + +#define _tmain wmain +#define _tWinMain wWinMain +#define _tenviron _wenviron +#define __targv __wargv + +#define _tprintf wprintf +#define _tprintf_l _wprintf_l +#define _tprintf_p _wprintf_p +#define _tprintf_p_l _wprintf_p_l +#define _tcprintf _cwprintf +#define _tcprintf_l _cwprintf_l +#define _tcprintf_p _cwprintf_p +#define _tcprintf_p_l _cwprintf_p_l +#define _vtcprintf _vcwprintf +#define _vtcprintf_l _vcwprintf_l +#define _vtcprintf_p _vcwprintf_p +#define _vtcprintf_p_l _vcwprintf_p_l +#define _ftprintf fwprintf +#define _ftprintf_l _fwprintf_l +#define _ftprintf_p _fwprintf_p +#define _ftprintf_p_l _fwprintf_p_l +#define _stprintf swprintf +#define _stprintf_l __swprintf_l +#define _stprintf_p _swprintf_p +#define _stprintf_p_l _swprintf_p_l +#define _sctprintf _scwprintf +#define _sctprintf_l _scwprintf_l +#define _sctprintf_p _scwprintf_p +#define _sctprintf_p_l _scwprintf_p_l +#define _sntprintf _snwprintf +#define _sntprintf_l _snwprintf_l +#define _vtprintf vwprintf +#define _vtprintf_l _vwprintf_l +#define _vtprintf_p _vwprintf_p +#define _vtprintf_p_l _vwprintf_p_l +#define _vftprintf vfwprintf +#define _vftprintf_l _vfwprintf_l +#define _vftprintf_p _vfwprintf_p +#define _vftprintf_p_l _vfwprintf_p_l +#define _vstprintf vswprintf +#define _vstprintf_l _vswprintf_l +#define _vstprintf_p _vswprintf_p +#define _vstprintf_p_l _vswprintf_p_l +#define _vsctprintf _vscwprintf +#define _vsctprintf_l _vscwprintf_l +#define _vsctprintf_p _vscwprintf_p +#define _vsctprintf_p_l _vscwprintf_p_l +#define _vsntprintf _vsnwprintf +#define _vsntprintf_l _vsnwprintf_l + +#define _tscanf wscanf +#define _tscanf_l _wscanf_l +#define _tcscanf _cwscanf +#define _tcscanf_l _cwscanf_l +#define _ftscanf fwscanf +#define _ftscanf_l _fwscanf_l +#define _stscanf swscanf +#define _stscanf_l _swscanf_l +#define _sntscanf _snwscanf +#define _sntscanf_l _snwscanf_l + +#define _fgettc fgetwc +#define _fgettc_nolock _fgetwc_nolock +#define _fgettchar _fgetwchar +#define _fgetts fgetws +#define _fputtc fputwc +#define _fputtc_nolock _fputwc_nolock +#define _fputtchar _fputwchar +#define _fputts fputws +#define _cputts _cputws +#define _cgetts _cgetws +#define _gettc getwc +#define _gettc_nolock _getwc_nolock +#define _gettch _getwch +#define _gettch_nolock _getwch_nolock +#define _gettche _getwche +#define _gettche_nolock _getwche_nolock +#define _gettchar getwchar +#define _gettchar_nolock _getwchar_nolock +#define _getts _getws +#define _puttc putwc +#define _puttc_nolock _putwc_nolock +#define _puttchar putwchar +#define _puttchar_nolock _putwchar_nolock +#define _puttch _putwch +#define _puttch_nolock _putwch_nolock +#define _putts _putws +#define _ungettc ungetwc +#define _ungettc_nolock _ungetwc_nolock +#define _ungettch _ungetwch +#define _ungettch_nolock _ungetwch_nolock + +#define _tcstod wcstod +#define _tcstol wcstol +#define _tcstoul wcstoul +#define _tcstoi64 _wcstoi64 +#define _tcstoui64 _wcstoui64 +#define _tstof _wtof +#define _tstol _wtol +#define _tstoi _wtoi +#define _tstoi64 _wtoi64 +#define _tcstod_l _wcstod_l +#define _tcstol_l _wcstol_l +#define _tcstoul_l _wcstoul_l +#define _tcstoi64_l _wcstoi64_l +#define _tcstoui64_l _wcstoui64_l +#define _tstof_l _wtof_l +#define _tstol_l _wtol_l +#define _tstoi_l _wtoi_l +#define _tstoi64_l _wtoi64_l + +#define _itot _itow +#define _ltot _ltow +#define _ultot _ultow +#define _ttoi _wtoi +#define _ttol _wtol + +#define _ttoi64 _wtoi64 +#define _i64tot _i64tow +#define _ui64tot _ui64tow + +#define _tcscat wcscat +#define _tcschr wcschr +#define _tcscpy wcscpy +#define _tcscspn wcscspn +#define _tcslen wcslen +#define _tcsnlen wcsnlen +#define _tcsncat wcsncat +#define _tcsncat_l _wcsncat_l +#define _tcsncpy wcsncpy +#define _tcsncpy_l _wcsncpy_l +#define _tcspbrk wcspbrk +#define _tcsrchr wcsrchr +#define _tcsspn wcsspn +#define _tcsstr wcsstr +#define _tcstok wcstok +#define _tcstok_l _wcstok_l +#define _tcserror _wcserror +#define __tcserror __wcserror + +#define _tcsdup _wcsdup +#define _tcsnset _wcsnset +#define _tcsnset_l _wcsnset_l +#define _tcsrev _wcsrev +#define _tcsset _wcsset +#define _tcsset_l _wcsset_l + +#define _tcscmp wcscmp +#define _tcsicmp _wcsicmp +#define _tcsicmp_l _wcsicmp_l +#define _tcsnccmp wcsncmp +#define _tcsncmp wcsncmp +#define _tcsncicmp _wcsnicmp +#define _tcsncicmp_l _wcsnicmp_l +#define _tcsnicmp _wcsnicmp +#define _tcsnicmp_l _wcsnicmp_l + +#define _tcscoll wcscoll +#define _tcscoll_l _wcscoll_l +#define _tcsicoll _wcsicoll +#define _tcsicoll_l _wcsicoll_l +#define _tcsnccoll _wcsncoll +#define _tcsnccoll_l _wcsncoll_l +#define _tcsncoll _wcsncoll +#define _tcsncoll_l _wcsncoll_l +#define _tcsncicoll _wcsnicoll +#define _tcsncicoll_l _wcsnicoll_l +#define _tcsnicoll _wcsnicoll +#define _tcsnicoll_l _wcsnicoll_l + +#define _texecl _wexecl +#define _texecle _wexecle +#define _texeclp _wexeclp +#define _texeclpe _wexeclpe +#define _texecv _wexecv +#define _texecve _wexecve +#define _texecvp _wexecvp +#define _texecvpe _wexecvpe + +#define _tspawnl _wspawnl +#define _tspawnle _wspawnle +#define _tspawnlp _wspawnlp +#define _tspawnlpe _wspawnlpe +#define _tspawnv _wspawnv +#define _tspawnve _wspawnve +#define _tspawnvp _wspawnvp +#define _tspawnvp _wspawnvp +#define _tspawnvpe _wspawnvpe + +#define _tsystem _wsystem + +#define _tasctime _wasctime +#define _tctime _wctime +#define _tctime32 _wctime32 +#define _tctime64 _wctime64 +#define _tstrdate _wstrdate +#define _tstrtime _wstrtime +#define _tutime _wutime +#define _tutime32 _wutime32 +#define _tutime64 _wutime64 +#define _tcsftime wcsftime +#define _tcsftime_l _wcsftime_l + +#define _tchdir _wchdir +#define _tgetcwd _wgetcwd +#define _tgetdcwd _wgetdcwd +#define _tgetdcwd_nolock _wgetdcwd_nolock +#define _tmkdir _wmkdir +#define _trmdir _wrmdir + +#define _tfullpath _wfullpath +#define _tgetenv _wgetenv +#define _tmakepath _wmakepath +#define _tpgmptr _wpgmptr +#define _get_tpgmptr _get_wpgmptr +#define _tputenv _wputenv +#define _tsearchenv _wsearchenv +#define _tsplitpath _wsplitpath + +#define _tfdopen _wfdopen +#define _tfsopen _wfsopen +#define _tfopen _wfopen +#define _tfreopen _wfreopen +#define _tperror _wperror +#define _tpopen _wpopen +#define _ttempnam _wtempnam +#define _ttmpnam _wtmpnam + +#define _taccess _waccess +#define _tchmod _wchmod +#define _tcreat _wcreat +#define _tfindfirst _wfindfirst +#define _tfindfirst32 _wfindfirst32 +#define _tfindfirst64 _wfindfirst64 +#define _tfindfirsti64 _wfindfirsti64 +#define _tfindfirst32i64 _wfindfirst32i64 +#define _tfindfirst64i32 _wfindfirst64i32 +#define _tfindnext _wfindnext +#define _tfindnext32 _wfindnext32 +#define _tfindnext64 _wfindnext64 +#define _tfindnexti64 _wfindnexti64 +#define _tfindnext32i64 _wfindnext32i64 +#define _tfindnext64i32 _wfindnext64i32 +#define _tmktemp _wmktemp +#define _topen _wopen +#define _tremove _wremove +#define _trename _wrename +#define _tsopen _wsopen +#define _tunlink _wunlink + +#define _tfinddata_t _wfinddata_t +#define _tfinddata32_t _wfinddata32_t +#define _tfinddata64_t _wfinddata64_t +#define _tfinddatai64_t _wfinddatai64_t +#define _tfinddata32i64_t _wfinddata32i64_t +#define _tfinddata64i32_t _wfinddata64i32_t + +#define _tstat _wstat +#define _tstat32 _wstat32 +#define _tstat32i64 _wstat32i64 +#define _tstat64 _wstat64 +#define _tstat64i32 _wstat64i32 +#define _tstati64 _wstati64 + +#define _tsetlocale _wsetlocale + +#define _tcsclen wcslen +#define _tcscnlen wcsnlen +#define _tcsclen_l(_String,_Locale) wcslen(_String) +#define _tcscnlen_l(_String,_Max_count,_Locale) wcsnlen_l((_String),(_Max_count)) +#define _tcsnccat wcsncat +#define _tcsnccat_l _wcsncat_l +#define _tcsnccpy wcsncpy +#define _tcsnccpy_l _wcsncpy_l +#define _tcsncset _wcsnset + +#define _tcsdec _wcsdec +#define _tcsinc _wcsinc +#define _tcsnbcnt _wcsncnt +#define _tcsnccnt _wcsncnt +#define _tcsnextc _wcsnextc +#define _tcsninc _wcsninc +#define _tcsspnp _wcsspnp + +#define _tcslwr _wcslwr +#define _tcslwr_l _wcslwr_l +#define _tcsupr _wcsupr +#define _tcsupr_l _wcsupr_l +#define _tcsxfrm wcsxfrm +#define _tcsxfrm_l _wcsxfrm_l + +#define _tclen(_pc) (1) +#define _tccpy(_pc1,_cpc2) ((*(_pc1) = *(_cpc2))) +#define _tccmp(_cpc1,_cpc2) ((*(_cpc1))-(*(_cpc2))) + +#define _istalnum iswalnum +#define _istalnum_l _iswalnum_l +#define _istalpha iswalpha +#define _istalpha_l _iswalpha_l +#define _istascii iswascii +#define _istcntrl iswcntrl +#define _istcntrl_l _iswcntrl_l +#define _istdigit iswdigit +#define _istdigit_l _iswdigit_l +#define _istgraph iswgraph +#define _istgraph_l _iswgraph_l +#define _istlower iswlower +#define _istlower_l _iswlower_l +#define _istprint iswprint +#define _istprint_l _iswprint_l +#define _istpunct iswpunct +#define _istpunct_l _iswpunct_l +#define _istspace iswspace +#define _istspace_l _iswspace_l +#define _istupper iswupper +#define _istupper_l _iswupper_l +#define _istxdigit iswxdigit +#define _istxdigit_l _iswxdigit_l + +#define _totupper towupper +#define _totupper_l _towupper_l +#define _totlower towlower +#define _totlower_l _towlower_l + +#define _istlegal(_Char) (1) +#define _istlead(_Char) (0) +#define _istleadbyte(_Char) (0) +#define _istleadbyte_l(_Char,_Locale) (0) + +#define _wcsdec(_cpc1,_cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1) +#define _wcsinc(_pc) ((_pc)+1) +#define _wcsnextc(_cpc) ((unsigned int) *(_cpc)) +#define _wcsninc(_pc,_sz) (((_pc)+(_sz))) + _CRTIMP size_t __cdecl __wcsncnt(const wchar_t *_Str,size_t _MaxCount); +#define _wcsncnt(_cpc,_sz) (__wcsncnt(_cpc,_sz)) +#define _wcsspnp(_cpc1,_cpc2) (!_cpc1 ? NULL : ((*((_cpc1)+wcsspn(_cpc1,_cpc2))) ? ((_cpc1)+wcsspn(_cpc1,_cpc2)) : NULL)) +#define _wcsncpy_l(_Destination,_Source,_Count,_Locale) (wcsncpy(_Destination,_Source,_Count)) +#define _wcsncat_l(_Destination,_Source,_Count,_Locale) (wcsncat(_Destination,_Source,_Count)) +#define _wcstok_l(_String,_Delimiters,_Locale) (wcstok(_String,_Delimiters)) +#define _wcsnset_l(_Destination,_Value,_Count,_Locale) (_wcsnset(_Destination,_Value,_Count)) +#define _wcsset_l(_Destination,_Value,_Locale) (_wcsset(_Destination,_Value)) + + /* dirent structures and functions */ +#define _tdirent _wdirent +#define _TDIR _WDIR +#define _topendir _wopendir +#define _tclosedir _wclosedir +#define _treaddir _wreaddir +#define _trewinddir _wrewinddir +#define _ttelldir _wtelldir +#define _tseekdir _wseekdir + +#else + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define _TEOF EOF + +#define __T(x) x + +#define _tmain main +#define _tWinMain WinMain +#ifdef _POSIX_ +#define _tenviron environ +#else +#define _tenviron _environ +#endif +#define __targv __argv + +#define _tprintf printf +#define _tprintf_l _printf_l +#define _tprintf_p _printf_p +#define _tprintf_p_l _printf_p_l +#define _tcprintf _cprintf +#define _tcprintf_l _cprintf_l +#define _tcprintf_p _cprintf_p +#define _tcprintf_p_l _cprintf_p_l +#define _vtcprintf _vcprintf +#define _vtcprintf_l _vcprintf_l +#define _vtcprintf_p _vcprintf_p +#define _vtcprintf_p_l _vcprintf_p_l +#define _ftprintf fprintf +#define _ftprintf_l _fprintf_l +#define _ftprintf_p _fprintf_p +#define _ftprintf_p_l _fprintf_p_l +#define _stprintf sprintf +#define _stprintf_l _sprintf_l +#define _stprintf_p _sprintf_p +#define _stprintf_p_l _sprintf_p_l +#define _sctprintf _scprintf +#define _sctprintf_l _scprintf_l +#define _sctprintf_p _scprintf_p +#define _sctprintf_p_l _scprintf_p_l +#define _sntprintf _snprintf +#define _sntprintf_l _snprintf_l +#define _vtprintf vprintf +#define _vtprintf_l _vprintf_l +#define _vtprintf_p _vprintf_p +#define _vtprintf_p_l _vprintf_p_l +#define _vftprintf vfprintf +#define _vftprintf_l _vfprintf_l +#define _vftprintf_p _vfprintf_p +#define _vftprintf_p_l _vfprintf_p_l +#define _vstprintf vsprintf +#define _vstprintf_l _vsprintf_l +#define _vstprintf_p _vsprintf_p +#define _vstprintf_p_l _vsprintf_p_l +#define _vsctprintf _vscprintf +#define _vsctprintf_l _vscprintf_l +#define _vsctprintf_p _vscprintf_p +#define _vsctprintf_p_l _vscprintf_p_l +#define _vsntprintf _vsnprintf +#define _vsntprintf_l _vsnprintf_l + +#define _tscanf scanf +#define _tscanf_l _scanf_l +#define _tcscanf _cscanf +#define _tcscanf_l _cscanf_l +#define _ftscanf fscanf +#define _ftscanf_l _fscanf_l +#define _stscanf sscanf +#define _stscanf_l _sscanf_l +#define _sntscanf _snscanf +#define _sntscanf_l _snscanf_l + +#define _fgettc fgetc +#define _fgettc_nolock _fgetc_nolock +#define _fgettchar _fgetchar +#define _fgetts fgets +#define _fputtc fputc +#define _fputtc_nolock _fputc_nolock +#define _fputtchar _fputchar +#define _fputts fputs +#define _cputts _cputs +#define _gettc getc +#define _gettc_nolock _getc_nolock +#define _gettch _getch +#define _gettch_nolock _getch_nolock +#define _gettche _getche +#define _gettche_nolock _getche_nolock +#define _gettchar getchar +#define _gettchar_nolock _getchar_nolock +#define _getts gets +#define _cgetts _cgets +#define _puttc putc +#define _puttc_nolock _putc_nolock +#define _puttchar putchar +#define _puttchar_nolock _putchar_nolock +#define _puttch _putch +#define _puttch_nolock _putch_nolock +#define _putts puts +#define _ungettc ungetc +#define _ungettc_nolock _ungetc_nolock +#define _ungettch _ungetch +#define _ungettch_nolock _ungetch_nolock + +#define _tcstod strtod +#define _tcstol strtol +#define _tcstoul strtoul +#define _tstof atof +#define _tstol atol +#define _tstoi atoi +#define _tstoi64 _atoi64 +#define _tcstod_l _strtod_l +#define _tcstol_l _strtol_l +#define _tcstoul_l _strtoul_l +#define _tstof_l _atof_l +#define _tstol_l _atol_l +#define _tstoi_l _atoi_l +#define _tstoi64_l _atoi64_l + +#define _itot _itoa +#define _ltot _ltoa +#define _ultot _ultoa +#define _ttoi atoi +#define _ttol atol + +#define _ttoi64 _atoi64 +#define _tcstoi64 _strtoi64 +#define _tcstoi64_l _strtoi64_l +#define _tcstoui64 _strtoui64 +#define _tcstoui64_l _strtoui64_l +#define _i64tot _i64toa +#define _ui64tot _ui64toa + +#define _tcscat strcat +#define _tcscpy strcpy +#define _tcsdup _strdup +#define _tcslen strlen +#if 0 +#define _tcsnlen strnlen +#endif +#define _tcsxfrm strxfrm +#define _tcsxfrm_l _strxfrm_l +#define _tcserror strerror +#define __tcserror _strerror + +#define _texecl _execl +#define _texecle _execle +#define _texeclp _execlp +#define _texeclpe _execlpe +#define _texecv _execv +#define _texecve _execve +#define _texecvp _execvp +#define _texecvpe _execvpe + +#define _tspawnl _spawnl +#define _tspawnle _spawnle +#define _tspawnlp _spawnlp +#define _tspawnlpe _spawnlpe +#define _tspawnv _spawnv +#define _tspawnve _spawnve +#define _tspawnvp _spawnvp +#define _tspawnvpe _spawnvpe + +#define _tsystem system + +#define _tasctime asctime +#define _tctime ctime +#define _tctime32 _ctime32 +#define _tctime64 _ctime64 +#define _tstrdate _strdate +#define _tstrtime _strtime +#define _tutime _utime +#define _tutime32 _utime32 +#define _tutime64 _utime64 +#define _tcsftime strftime +#define _tcsftime_l _strftime_l + +#define _tchdir _chdir +#define _tgetcwd _getcwd +#define _tgetdcwd _getdcwd +#define _tgetdcwd_nolock _getdcwd_nolock +#define _tmkdir _mkdir +#define _trmdir _rmdir + +#define _tfullpath _fullpath +#define _tgetenv getenv +#define _tmakepath _makepath +#define _tpgmptr _pgmptr +#define _get_tpgmptr _get_pgmptr +#define _tputenv _putenv +#define _tsearchenv _searchenv +#define _tsplitpath _splitpath + +#ifdef _POSIX_ +#define _tfdopen fdopen +#else +#define _tfdopen _fdopen +#endif +#define _tfsopen _fsopen +#define _tfopen fopen +#define _tfreopen freopen +#define _tperror perror +#define _tpopen _popen +#define _ttempnam _tempnam +#define _ttmpnam tmpnam + +#define _tchmod _chmod +#define _tcreat _creat +#define _tfindfirst _findfirst +#define _tfindfirst32 _findfirst32 +#define _tfindfirst64 _findfirst64 +#define _tfindfirsti64 _findfirsti64 +#define _tfindfirst32i64 _findfirst32i64 +#define _tfindfirst64i32 _findfirst64i32 +#define _tfindnext _findnext +#define _tfindnext32 _findnext32 +#define _tfindnext64 _findnext64 +#define _tfindnexti64 _findnexti64 +#define _tfindnext32i64 _findnext32i64 +#define _tfindnext64i32 _findnext64i32 +#define _tmktemp _mktemp + +#ifdef _POSIX_ +#define _topen open +#define _taccess access +#else +#define _topen _open +#define _taccess _access +#endif + +#define _tremove remove +#define _trename rename +#define _tsopen _sopen +#define _tunlink _unlink + +#define _tfinddata_t _finddata_t +#define _tfinddata32_t _finddata32_t +#define _tfinddata64_t __finddata64_t +#define _tfinddatai64_t _finddatai64_t +#define _tfinddata32i64_t _finddata32i64_t +#define _tfinddata64i32_t _finddata64i32_t + +#define _istascii __isascii +#define _istcntrl iscntrl +#define _istcntrl_l _iscntrl_l +#define _istxdigit isxdigit +#define _istxdigit_l _isxdigit_l + +#define _tstat _stat +#define _tstat32 _stat32 +#define _tstat32i64 _stat32i64 +#define _tstat64 _stat64 +#define _tstat64i32 _stat64i32 +#define _tstati64 _stati64 + +#define _tsetlocale setlocale + +#ifdef _MBCS + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __TCHAR_DEFINED + typedef char _TCHAR; + typedef signed char _TSCHAR; + typedef unsigned char _TUCHAR; + typedef unsigned char _TXCHAR; + typedef unsigned int _TINT; +#define __TCHAR_DEFINED +#endif + +#ifndef _TCHAR_DEFINED +#ifndef NO_OLDNAMES + typedef char TCHAR; +#endif +#define _TCHAR_DEFINED +#endif + +#ifdef _MB_MAP_DIRECT + +#define _tcschr _mbschr +#define _tcscspn _mbscspn +#define _tcsncat _mbsnbcat +#define _tcsncat_l _mbsnbcat_l +#define _tcsncpy _mbsnbcpy +#define _tcsncpy_l _mbsnbcpy_l +#define _tcspbrk _mbspbrk +#define _tcsrchr _mbsrchr +#define _tcsspn _mbsspn +#define _tcsstr _mbsstr +#define _tcstok _mbstok +#define _tcstok_l _mbstok_l + +#define _tcsnset _mbsnbset +#define _tcsnset_l _mbsnbset_l +#define _tcsrev _mbsrev +#define _tcsset _mbsset +#define _tcsset_l _mbsset_l + +#define _tcscmp _mbscmp +#define _tcsicmp _mbsicmp +#define _tcsicmp_l _mbsicmp_l +#define _tcsnccmp _mbsncmp +#define _tcsncmp _mbsnbcmp +#define _tcsncicmp _mbsnicmp +#define _tcsncicmp_l _mbsnicmp_l +#define _tcsnicmp _mbsnbicmp +#define _tcsnicmp_l _mbsnbicmp_l + +#define _tcscoll _mbscoll +#define _tcscoll_l _mbscoll_l +#define _tcsicoll _mbsicoll +#define _tcsicoll_l _mbsicoll_l +#define _tcsnccoll _mbsncoll +#define _tcsnccoll_l _mbsncoll_l +#define _tcsncoll _mbsnbcoll +#define _tcsncoll_l _mbsnbcoll_l +#define _tcsncicoll _mbsnicoll +#define _tcsncicoll_l _mbsnicoll_l +#define _tcsnicoll _mbsnbicoll +#define _tcsnicoll_l _mbsnbicoll_l + +#define _tcsclen _mbslen +#define _tcscnlen _mbsnlen +#define _tcsclen_l _mbslen_l +#define _tcscnlen_l _mbsnlen_l +#define _tcsnccat _mbsncat +#define _tcsnccat_l _mbsncat_l +#define _tcsnccpy _mbsncpy +#define _tcsnccpy_l _mbsncpy_l +#define _tcsncset _mbsnset +#define _tcsncset_l _mbsnset_l + +#define _tcsdec _mbsdec +#define _tcsinc _mbsinc +#define _tcsnbcnt _mbsnbcnt +#define _tcsnccnt _mbsnccnt +#define _tcsnextc _mbsnextc +#define _tcsninc _mbsninc +#define _tcsspnp _mbsspnp + +#define _tcslwr _mbslwr +#define _tcslwr_l _mbslwr_l +#define _tcsupr _mbsupr +#define _tcsupr_l _mbsupr_l + +#define _tclen _mbclen +#define _tccpy _mbccpy +#define _tccpy_l _mbccpy_l +#else + + _CRTIMP _CONST_RETURN char *__cdecl _tcschr(const char *_Str,unsigned int _Val); + _CRTIMP size_t __cdecl _tcscspn(const char *_Str,const char *_Control); + _CRTIMP char *__cdecl _tcsncat(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsncpy(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP _CONST_RETURN char *__cdecl _tcspbrk(const char *_Str,const char *_Control); + _CRTIMP _CONST_RETURN char *__cdecl _tcsrchr(const char *_Str,unsigned int _Ch); + _CRTIMP size_t __cdecl _tcsspn(const char *_Str,const char *_Control); + _CRTIMP _CONST_RETURN char *__cdecl _tcsstr(const char *_Str,const char *_Substr); + _CRTIMP char *__cdecl _tcstok(char *_Str,const char *_Delim); + _CRTIMP char *__cdecl _tcstok_l(char *_Str,const char *_Delim,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnset(char *_Str,unsigned int _Val,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsrev(char *_Str); + _CRTIMP char *__cdecl _tcsset(char *_Str,unsigned int _Val); + _CRTIMP char *__cdecl _tcsset_l(char *_Str,unsigned int _Val,_locale_t _Locale); + _CRTIMP int __cdecl _tcscmp(const char *_Str1,const char *_Str); + _CRTIMP int __cdecl _tcsicmp(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _tcsicmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnccmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcscoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _tcscoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _tcsicoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _tcsicoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnccoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsnccoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsncoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsncicoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnicoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP size_t __cdecl _tcsclen(const char *_Str); + _CRTIMP size_t __cdecl _tcscnlen(const char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _tcsclen_l(const char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _tcscnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccat(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccpy(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsncset(char *_Str,unsigned int _Val,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsdec(const char *_Start,const char *_Pos); + _CRTIMP char *__cdecl _tcsinc(const char *_Ptr); + _CRTIMP size_t __cdecl _tcsnbcnt(const char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _tcsnccnt(const char *_Str,size_t _MaxCount); + _CRTIMP unsigned int __cdecl _tcsnextc (const char *_Str); + _CRTIMP char *__cdecl _tcsninc(const char *_Ptr,size_t _Count); + _CRTIMP char *__cdecl _tcsspnp(const char *_Str1,const char *_Str2); + _CRTIMP char *__cdecl _tcslwr(char *_Str); + _CRTIMP char *__cdecl _tcslwr_l(char *_Str,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsupr(char *_Str); + _CRTIMP char *__cdecl _tcsupr_l(char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _tclen(const char *_Str); + _CRTIMP void __cdecl _tccpy(char *_DstCh,const char *_SrcCh); + +#ifdef __cplusplus +#ifndef _CPP_TCHAR_INLINES_DEFINED +#define _CPP_TCHAR_INLINES_DEFINED + extern "C++" { + extern inline char *__cdecl _tcschr(char *_S,unsigned int _C) { return ((char *)_tcschr((const char *)_S,_C)); } + extern inline char *__cdecl _tcspbrk(char *_S,const char *_P) { return ((char *)_tcspbrk((const char *)_S,_P)); } + extern inline char *__cdecl _tcsrchr(char *_S,unsigned int _C) { return ((char *)_tcsrchr((const char *)_S,_C)); } + extern inline char *__cdecl _tcsstr(char *_S,const char *_P) { return ((char *)_tcsstr((const char *)_S,_P)); } + } +#endif +#endif +#endif + +#define _tccmp(_cp1,_cp2) _tcsnccmp(_cp1,_cp2,1) + +#define _istalnum _ismbcalnum +#define _istalnum_l _ismbcalnum_l +#define _istalpha _ismbcalpha +#define _istalpha_l _ismbcalpha_l +#define _istdigit _ismbcdigit +#define _istdigit_l _ismbcdigit_l +#define _istgraph _ismbcgraph +#define _istgraph_l _ismbcgraph_l +#define _istlegal _ismbclegal +#define _istlegal_l _ismbclegal_l +#define _istlower _ismbclower +#define _istlower_l _ismbclower_l +#define _istprint _ismbcprint +#define _istprint_l _ismbcprint_l +#define _istpunct _ismbcpunct +#define _istpunct_l _ismbcpunct_l +#define _istspace _ismbcspace +#define _istspace_l _ismbcspace_l +#define _istupper _ismbcupper +#define _istupper_l _ismbcupper_l + +#define _totupper _mbctoupper +#define _totupper_l _mbctoupper_l +#define _totlower _mbctolower +#define _totlower_l _mbctolower_l + +#define _istlead _ismbblead +#define _istleadbyte isleadbyte +#define _istleadbyte_l _isleadbyte_l +#else + +#ifndef __TCHAR_DEFINED +#define __TCHAR_DEFINED + typedef char _TCHAR; + typedef signed char _TSCHAR; + typedef unsigned char _TUCHAR; + typedef char _TXCHAR; + typedef int _TINT; +#endif + +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED +#ifndef NO_OLDNAMES + typedef char TCHAR; +#endif +#endif + +#define _tcschr strchr +#define _tcscspn strcspn +#define _tcsncat strncat +#define _tcsncat_l _strncat_l +#define _tcsncpy strncpy +#define _tcsncpy_l _strncpy_l +#define _tcspbrk strpbrk +#define _tcsrchr strrchr +#define _tcsspn strspn +#define _tcsstr strstr +#define _tcstok strtok +#define _tcstok_l _strtok_l + +#define _tcsnset _strnset +#define _tcsnset_l _strnset_l +#define _tcsrev _strrev +#define _tcsset _strset + +#define _tcscmp strcmp +#define _tcsicmp _stricmp +#define _tcsicmp_l _stricmp_l +#define _tcsnccmp strncmp +#define _tcsncmp strncmp +#define _tcsncicmp _strnicmp +#define _tcsncicmp_l _strnicmp_l +#define _tcsnicmp _strnicmp +#define _tcsnicmp_l _strnicmp_l + +#define _tcscoll strcoll +#define _tcscoll_l _strcoll_l +#define _tcsicoll _stricoll +#define _tcsicoll_l _stricoll_l +#define _tcsnccoll _strncoll +#define _tcsnccoll_l _strncoll_l +#define _tcsncoll _strncoll +#define _tcsncoll_l _strncoll_l +#define _tcsncicoll _strnicoll +#define _tcsncicoll_l _strnicoll_l +#define _tcsnicoll _strnicoll +#define _tcsnicoll_l _strnicoll_l + +#define _tcsclen strlen +#define _tcscnlen strnlen +#define _tcsclen_l(_String,_Locale) strlen(_String) +#define _tcscnlen_l(_String,_Max_count,_Locale) strnlen_l((_String),(_Max_count)) +#define _tcsnccat strncat +#define _tcsnccat_l _strncat_l +#define _tcsnccpy strncpy +#define _tcsnccpy_l _strncpy_l +#define _tcsncset _strnset + +#define _tcsdec _strdec +#define _tcsinc _strinc +#define _tcsnbcnt _strncnt +#define _tcsnccnt _strncnt +#define _tcsnextc _strnextc +#define _tcsninc _strninc +#define _tcsspnp _strspnp + +#define _tcslwr _strlwr +#define _tcslwr_l _strlwr_l +#define _tcsupr _strupr +#define _tcsupr_l _strupr_l +#define _tcsxfrm strxfrm +#define _tcsxfrm_l _strxfrm_l + +#define _istlead(_Char) (0) +#define _istleadbyte(_Char) (0) +#define _istleadbyte_l(_Char,_Locale) (0) + +#define _tclen(_pc) (1) +#define _tccpy(_pc1,_cpc2) (*(_pc1) = *(_cpc2)) +#define _tccmp(_cpc1,_cpc2) (((unsigned char)*(_cpc1))-((unsigned char)*(_cpc2))) + + /* dirent structures and functions */ +#define _tdirent dirent +#define _TDIR DIR +#define _topendir opendir +#define _tclosedir closedir +#define _treaddir readdir +#define _trewinddir rewinddir +#define _ttelldir telldir +#define _tseekdir seekdir + +#define _istalnum isalnum +#define _istalnum_l _isalnum_l +#define _istalpha isalpha +#define _istalpha_l _isalpha_l +#define _istdigit isdigit +#define _istdigit_l _isdigit_l +#define _istgraph isgraph +#define _istgraph_l _isgraph_l +#define _istlower islower +#define _istlower_l _islower_l +#define _istprint isprint +#define _istprint_l _isprint_l +#define _istpunct ispunct +#define _istpunct_l _ispunct_l +#define _istspace isspace +#define _istspace_l _isspace_l +#define _istupper isupper +#define _istupper_l _isupper_l + +#define _totupper toupper +#define _totupper_l _toupper_l +#define _totlower tolower +#define _totlower_l _tolower_l + +#define _istlegal(_c) (1) + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define _strdec(_cpc1,_cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1) +#define _strinc(_pc) ((_pc)+1) +#define _strnextc(_cpc) ((unsigned int) *(const unsigned char *)(_cpc)) +#define _strninc(_pc,_sz) (((_pc)+(_sz))) + _CRTIMP size_t __cdecl __strncnt(const char *_Str,size_t _Cnt); +#define _strncnt(_cpc,_sz) (__strncnt(_cpc,_sz)) +#define _strspnp(_cpc1,_cpc2) (!_cpc1 ? NULL : ((*((_cpc1)+strspn(_cpc1,_cpc2))) ? ((_cpc1)+strspn(_cpc1,_cpc2)) : NULL)) + +#define _strncpy_l(_Destination,_Source,_Count,_Locale) (strncpy(_Destination,_Source,_Count)) +#define _strncat_l(_Destination,_Source,_Count,_Locale) (strncat(_Destination,_Source,_Count)) +#define _strtok_l(_String,_Delimiters,_Locale) (strtok(_String,_Delimiters)) +#define _strnset_l(_Destination,_Value,_Count,_Locale) (_strnset(_Destination,_Value,_Count)) +#define _strset_l(_Destination,_Value,_Locale) (_strset(_Destination,_Value)) +#endif +#endif + +#define _T(x) __T(x) +#define _TEXT(x) __T(x) + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/overlay_toolchain/tcc/include/time.h b/overlay_toolchain/tcc/include/time.h new file mode 100644 index 00000000..6c72e266 --- /dev/null +++ b/overlay_toolchain/tcc/include/time.h @@ -0,0 +1,287 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _TIME_H_ +#define _TIME_H_ + +#include <_mingw.h> + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#ifndef _WCHAR_T_DEFINED +#define _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#endif + +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED + typedef long __time32_t; +#endif + +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int _time64_t __attribute__ ((mode (DI))); +#else + typedef __int64 __time64_t; +#endif +#endif +#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#endif + +#ifndef _CLOCK_T_DEFINED +#define _CLOCK_T_DEFINED + typedef long clock_t; +#endif + +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +#undef size_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int size_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 size_t; +#endif +#else + typedef unsigned int size_t; +#endif +#endif + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef int ssize_t; +#endif +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#ifdef _USE_32BIT_TIME_T +#define _localtime32 localtime +#define _difftime32 difftime +#define _ctime32 ctime +#define _gmtime32 gmtime +#define _mktime32 mktime +#define _time32 time +#endif + +#ifndef _TM_DEFINED +#define _TM_DEFINED + struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + }; +#endif + +#define CLOCKS_PER_SEC 1000 + + __MINGW_IMPORT int _daylight; + __MINGW_IMPORT long _dstbias; + __MINGW_IMPORT long _timezone; + __MINGW_IMPORT char * _tzname[2]; + _CRTIMP errno_t __cdecl _get_daylight(int *_Daylight); + _CRTIMP errno_t __cdecl _get_dstbias(long *_Daylight_savings_bias); + _CRTIMP errno_t __cdecl _get_timezone(long *_Timezone); + _CRTIMP errno_t __cdecl _get_tzname(size_t *_ReturnValue,char *_Buffer,size_t _SizeInBytes,int _Index); + char *__cdecl asctime(const struct tm *_Tm); + _CRTIMP char *__cdecl _ctime32(const __time32_t *_Time); + clock_t __cdecl clock(void); + _CRTIMP double __cdecl _difftime32(__time32_t _Time1,__time32_t _Time2); + _CRTIMP struct tm *__cdecl _gmtime32(const __time32_t *_Time); + _CRTIMP struct tm *__cdecl _localtime32(const __time32_t *_Time); + size_t __cdecl strftime(char *_Buf,size_t _SizeInBytes,const char *_Format,const struct tm *_Tm); + _CRTIMP size_t __cdecl _strftime_l(char *_Buf,size_t _Max_size,const char *_Format,const struct tm *_Tm,_locale_t _Locale); + _CRTIMP char *__cdecl _strdate(char *_Buffer); + _CRTIMP char *__cdecl _strtime(char *_Buffer); + _CRTIMP __time32_t __cdecl _time32(__time32_t *_Time); + _CRTIMP __time32_t __cdecl _mktime32(struct tm *_Tm); + _CRTIMP __time32_t __cdecl _mkgmtime32(struct tm *_Tm); +#if defined (_POSIX_) || defined(__GNUC__) + void __cdecl tzset(void); +#else + _CRTIMP void __cdecl _tzset(void); +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2); + _CRTIMP char *__cdecl _ctime64(const __time64_t *_Time); + _CRTIMP struct tm *__cdecl _gmtime64(const __time64_t *_Time); + _CRTIMP struct tm *__cdecl _localtime64(const __time64_t *_Time); + _CRTIMP __time64_t __cdecl _mktime64(struct tm *_Tm); + _CRTIMP __time64_t __cdecl _mkgmtime64(struct tm *_Tm); + _CRTIMP __time64_t __cdecl _time64(__time64_t *_Time); +#endif + unsigned __cdecl _getsystime(struct tm *_Tm); + unsigned __cdecl _setsystime(struct tm *_Tm,unsigned _MilliSec); + +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int size_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 size_t; +#endif +#else + typedef unsigned long size_t; +#endif +#endif + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef long ssize_t; +#endif +#endif + +#ifndef _WTIME_DEFINED + _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm); + _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time); + size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm); + _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer); + _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL) +#define _INC_WTIME_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); } +#else +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); } +#endif +#endif + +#define _WTIME_DEFINED +#endif + +#ifndef RC_INVOKED +double __cdecl difftime(time_t _Time1,time_t _Time2); +char *__cdecl ctime(const time_t *_Time); +struct tm *__cdecl gmtime(const time_t *_Time); +struct tm *__cdecl localtime(const time_t *_Time); +struct tm *__cdecl localtime_r(const time_t *_Time,struct tm *); + +time_t __cdecl mktime(struct tm *_Tm); +time_t __cdecl _mkgmtime(struct tm *_Tm); +time_t __cdecl time(time_t *_Time); + +#ifdef _USE_32BIT_TIME_T +#if 0 +__CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); } +__CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime32(_Time); } +__CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime32(_Time); } +__CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime32(_Time); } +__CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime32(_Tm); } +__CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime32(_Tm); } +__CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time32(_Time); } +#endif +#else +__CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); } +__CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime64(_Time); } +__CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime64(_Time); } +__CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime64(_Time); } +__CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime64(_Tm); } +__CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); } +__CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); } +#endif +#endif + +#if !defined(NO_OLDNAMES) || defined(_POSIX) +#define CLK_TCK CLOCKS_PER_SEC + + __MINGW_IMPORT int daylight; + __MINGW_IMPORT long dstbias; + __MINGW_IMPORT long timezone; + __MINGW_IMPORT char *tzname[2]; + void __cdecl tzset(void); +#endif + +#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ +#define _TIMEVAL_DEFINED +struct timeval { + long tv_sec; + long tv_usec; +}; +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp,uvp,cmp) ((tvp)->tv_sec cmp (uvp)->tv_sec || (tvp)->tv_sec==(uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif /* _TIMEVAL_DEFINED */ + +#ifndef __STRICT_ANSI__ +#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ +#define _TIMEZONE_DEFINED +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + + extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); +#endif +#endif /* __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include + +/* Adding timespec definition. */ +#include + +#endif /* End _TIME_H_ */ + diff --git a/overlay_toolchain/tcc/include/vadefs.h b/overlay_toolchain/tcc/include/vadefs.h new file mode 100644 index 00000000..749b0bdd --- /dev/null +++ b/overlay_toolchain/tcc/include/vadefs.h @@ -0,0 +1,11 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_VADEFS +#define _INC_VADEFS + +//!__TINYC__: GNUC specific stuff removed + +#endif diff --git a/overlay_toolchain/tcc/include/values.h b/overlay_toolchain/tcc/include/values.h new file mode 100644 index 00000000..1cd643ce --- /dev/null +++ b/overlay_toolchain/tcc/include/values.h @@ -0,0 +1,4 @@ +/* + * TODO: Nothing here yet. Should provide UNIX compatibility constants + * comparable to those in limits.h and float.h. + */ diff --git a/overlay_toolchain/tcc/include/varargs.h b/overlay_toolchain/tcc/include/varargs.h new file mode 100644 index 00000000..d614366e --- /dev/null +++ b/overlay_toolchain/tcc/include/varargs.h @@ -0,0 +1,12 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _VARARGS_H +#define _VARARGS_H + +#error "TinyCC no longer implements ." +#error "Revise your code to use ." + +#endif diff --git a/overlay_toolchain/tcc/include/wchar.h b/overlay_toolchain/tcc/include/wchar.h new file mode 100644 index 00000000..389196fa --- /dev/null +++ b/overlay_toolchain/tcc/include/wchar.h @@ -0,0 +1,873 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_WCHAR +#define _INC_WCHAR + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WCHAR_MIN /* also at stdint.h */ +#define WCHAR_MIN 0 +#define WCHAR_MAX ((wchar_t) -1) /* UINT16_MAX */ +#endif + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + typedef __builtin_va_list __gnuc_va_list; +#endif + +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED + typedef __gnuc_va_list va_list; +#endif + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifndef _FILE_DEFINED + struct _iobuf { + char *_ptr; + int _cnt; + char *_base; + int _flag; + int _file; + int _charbuf; + int _bufsiz; + char *_tmpfname; + }; + typedef struct _iobuf FILE; +#define _FILE_DEFINED +#endif + +#ifndef _STDIO_DEFINED +#ifdef _WIN64 + _CRTIMP FILE *__cdecl __iob_func(void); +#else +#ifdef _MSVCRT_ +extern FILE _iob[]; /* A pointer to an array of FILE */ +#define __iob_func() (_iob) +#else +extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */ +#define __iob_func() (*_imp___iob) +#define _iob __iob_func() +#endif +#endif + +#define _iob __iob_func() +#endif + +#ifndef _STDSTREAM_DEFINED +#define stdin (&__iob_func()[0]) +#define stdout (&__iob_func()[1]) +#define stderr (&__iob_func()[2]) +#define _STDSTREAM_DEFINED +#endif + +#ifndef _FSIZE_T_DEFINED + typedef unsigned long _fsize_t; +#define _FSIZE_T_DEFINED +#endif + +#ifndef _WFINDDATA_T_DEFINED + struct _wfinddata32_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + _fsize_t size; + wchar_t name[260]; + }; + +/* #if _INTEGRAL_MAX_BITS >= 64 */ + + struct _wfinddata32i64_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + __int64 size; + wchar_t name[260]; + }; + + struct _wfinddata64i32_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + _fsize_t size; + wchar_t name[260]; + }; + + struct _wfinddata64_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + __int64 size; + wchar_t name[260]; + }; +/* #endif */ + +#ifdef _USE_32BIT_TIME_T +#define _wfinddata_t _wfinddata32_t +#define _wfinddatai64_t _wfinddata32i64_t + +#define _wfindfirst _wfindfirst32 +#define _wfindnext _wfindnext32 +#define _wfindfirsti64 _wfindfirst32i64 +#define _wfindnexti64 _wfindnext32i64 +#else +#define _wfinddata_t _wfinddata64i32_t +#define _wfinddatai64_t _wfinddata64_t + +#define _wfindfirst _wfindfirst64i32 +#define _wfindnext _wfindnext64i32 +#define _wfindfirsti64 _wfindfirst64 +#define _wfindnexti64 _wfindnext64 +#endif + +#define _WFINDDATA_T_DEFINED +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#ifndef _CONST_RETURN +#define _CONST_RETURN +#endif + +#define _WConst_return _CONST_RETURN + +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() +#ifdef _MSVCRT_ +#define __pctype_func() (_pctype) +#else +#define __pctype_func() (*_imp___pctype) +#endif +#endif + +#ifndef _pctype +#ifdef _MSVCRT_ + extern unsigned short *_pctype; +#else + extern unsigned short **_imp___pctype; +#define _pctype (*_imp___pctype) +#endif +#endif +#endif +#endif + +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#ifndef _wctype +#ifdef _MSVCRT_ + extern unsigned short *_wctype; +#else + extern unsigned short **_imp___wctype; +#define _wctype (*_imp___wctype) +#endif +#endif + +#ifdef _MSVCRT_ +#define __pwctype_func() (_pwctype) +#else +#define __pwctype_func() (*_imp___pwctype) +#endif + +#ifndef _pwctype +#ifdef _MSVCRT_ + extern unsigned short *_pwctype; +#else + extern unsigned short **_imp___pwctype; +#define _pwctype (*_imp___pwctype) +#endif +#endif + +#endif +#endif + +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 + +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 + +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) + +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED + + int __cdecl iswalpha(wint_t _C); + _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); + int __cdecl iswupper(wint_t _C); + _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); + int __cdecl iswlower(wint_t _C); + _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswdigit(wint_t _C); + _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswxdigit(wint_t _C); + _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswspace(wint_t _C); + _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); + int __cdecl iswpunct(wint_t _C); + _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); + int __cdecl iswalnum(wint_t _C); + _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); + int __cdecl iswprint(wint_t _C); + _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); + int __cdecl iswgraph(wint_t _C); + _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); + int __cdecl iswcntrl(wint_t _C); + _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); + int __cdecl iswascii(wint_t _C); + int __cdecl isleadbyte(int _C); + _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); + wint_t __cdecl towupper(wint_t _C); + _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); + wint_t __cdecl towlower(wint_t _C); + _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswctype(wint_t _C,wctype_t _Type); + _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsymf(wint_t _C); + _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsym(wint_t _C); + _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); + int __cdecl is_wctype(wint_t _C,wctype_t _Type); +#endif + +#ifndef _WDIRECT_DEFINED +#define _WDIRECT_DEFINED + + _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); +#endif + +#ifndef _WIO_DEFINED +#define _WIO_DEFINED + + _CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode); + _CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode); + _CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode); + _CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wunlink(const wchar_t *_Filename); + _CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename); + _CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData); + intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData); + _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData); + _CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData); + int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData); + _CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData); +#endif + _CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag); +#if !defined(__cplusplus) || !(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,...); + _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...); +#else + extern "C++" _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,int _PermissionMode = 0); + extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0); +#endif +#endif + +#ifndef _WLOCALE_DEFINED +#define _WLOCALE_DEFINED + _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); +#endif + +#ifndef _WPROCESS_DEFINED +#define _WPROCESS_DEFINED + + _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif +#endif + +#ifndef _WCTYPE_INLINE_DEFINED +#undef _CRT_WCTYPE_NOINLINE +#if !defined(__cplusplus) || defined(_CRT_WCTYPE_NOINLINE) +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) + +#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) +#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) +#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) +#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) +#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) +#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) +#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) +#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) +#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) +#ifndef _CTYPE_DISABLE_MACROS +#define isleadbyte(_c) (__PCTYPE_FUNC[(unsigned char)(_c)] & _LEADBYTE) +#endif +#endif +#define _WCTYPE_INLINE_DEFINED +#endif + +#if !defined(_POSIX_) || defined(__GNUC__) +#ifndef _INO_T_DEFINED +#define _INO_T_DEFINED + typedef unsigned short _ino_t; +#ifndef NO_OLDNAMES + typedef unsigned short ino_t; +#endif +#endif + +#ifndef _DEV_T_DEFINED +#define _DEV_T_DEFINED + typedef unsigned int _dev_t; +#ifndef NO_OLDNAMES + typedef unsigned int dev_t; +#endif +#endif + +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif + +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif + +#ifndef _STAT_DEFINED +#define _STAT_DEFINED + +#ifdef _USE_32BIT_TIME_T +#ifdef WIN64 +#define _fstat _fstat32 +#define _stat _stat32 +#define _wstat _wstat32 +#else +#define _fstat32 _fstat +#define _stat32 _stat +#define _wstat32 _wstat +#endif +#define _fstati64 _fstat32i64 +#define _stati64 _stat32i64 +#define _wstati64 _wstat32i64 +#else +#define _fstat _fstat64i32 +#define _fstati64 _fstat64 +#define _stat _stat64i32 +#define _stati64 _stat64 +#define _wstat _wstat64i32 +#define _wstati64 _wstat64 +#endif + + struct _stat32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + +#ifndef NO_OLDNAMES + struct stat { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; + }; +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + + struct _stat32i64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + + struct _stat64i32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; + + struct _stat64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; +#endif + +#define __stat64 _stat64 + +#endif + +#ifndef _WSTAT_DEFINED +#define _WSTAT_DEFINED + + _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); + int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); + _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); +#endif +#endif +#endif + +#ifndef _WCONIO_DEFINED +#define _WCONIO_DEFINED + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + + _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _getwch(void); + _CRTIMP wint_t __cdecl _getwche(void); + _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh); + _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh); + _CRTIMP int __cdecl _cputws(const wchar_t *_String); + _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList); + + _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + wint_t __cdecl _putwch_nolock(wchar_t _WCh); + wint_t __cdecl _getwch_nolock(void); + wint_t __cdecl _getwche_nolock(void); + wint_t __cdecl _ungetwch_nolock(wint_t _WCh); +#endif + +#ifndef _WSTDIO_DEFINED +#define _WSTDIO_DEFINED + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifdef _POSIX_ + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); +#else + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); +#endif + + wint_t __cdecl fgetwc(FILE *_File); + _CRTIMP wint_t __cdecl _fgetwchar(void); + wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); + wint_t __cdecl getwc(FILE *_File); + wint_t __cdecl getwchar(void); + wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); + wint_t __cdecl putwchar(wchar_t _Ch); + wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); + wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File); + int __cdecl fputws(const wchar_t *_Str,FILE *_File); + _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String); + _CRTIMP int __cdecl _putws(const wchar_t *_Str); + int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...); + int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList); + int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...); + _CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list); + _CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ + int __cdecl snwprintf (wchar_t *s, size_t n, const wchar_t * format, ...); + __CRT_INLINE int __cdecl vsnwprintf (wchar_t *s, size_t n, const wchar_t *format, va_list arg) { return _vsnwprintf(s,n,format,arg); } + int __cdecl vwscanf (const wchar_t *, va_list); + int __cdecl vfwscanf (FILE *,const wchar_t *,va_list); + int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list); +#endif + _CRTIMP int __cdecl _fwprintf_p(FILE *_File,const wchar_t *_Format,...); + _CRTIMP int __cdecl _wprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vfwprintf_p(FILE *_File,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vscwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _fwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vfwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vswprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vscwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf(wchar_t *_Dest,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args); + _CRTIMP int __cdecl __swprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,...); + _CRTIMP int __cdecl __vswprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,va_list _Args); +#ifndef RC_INVOKED +#include +#endif + +#ifdef _CRT_NON_CONFORMING_SWPRINTFS +#ifndef __cplusplus +#define swprintf _swprintf +#define vswprintf _vswprintf +#define _swprintf_l __swprintf_l +#define _vswprintf_l __vswprintf_l +#endif +#endif + + _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); + _CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vscwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...); + _CRTIMP int __cdecl _fwscanf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...); + _CRTIMP int __cdecl _swscanf_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + int __cdecl wscanf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _wscanf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfopen(const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); + +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); +#if !defined(NO_OLDNAMES) && !defined(wpopen) +#define wpopen _wpopen +#endif + _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); + _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); + _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); + +#undef _CRT_GETPUTWCHAR_NOINLINE + +#if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) +#define getwchar() fgetwc(stdin) +#define putwchar(_c) fputwc((_c),stdout) +#else + __CRT_INLINE wint_t __cdecl getwchar() {return (fgetwc(stdin)); } + __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) {return (fputwc(_C,stdout)); } +#endif + +#define getwc(_stm) fgetwc(_stm) +#define putwc(_c,_stm) fputwc(_c,_stm) +#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) +#define _getwc_nolock(_c) _fgetwc_nolock(_c) +#endif + +#ifndef _WSTDLIB_DEFINED +#define _WSTDLIB_DEFINED + + _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix); + double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr); + _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale); + float __cdecl wcstof( const wchar_t *nptr, wchar_t **endptr); +#if !defined __NO_ISOCEXT /* in libmingwex.a */ + float __cdecl wcstof (const wchar_t * __restrict__, wchar_t ** __restrict__); + long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); +#endif /* __NO_ISOCEXT */ + long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif + _CRTIMP double __cdecl _wtof(const wchar_t *_Str); + _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _wtoi(const wchar_t *_Str); + _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP long __cdecl _wtol(const wchar_t *_Str); + _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale); + +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str); + _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); +#endif +#endif + +#ifndef _POSIX_ +#ifndef _WSTDLIBP_DEFINED +#define _WSTDLIBP_DEFINED + _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords); + _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString); + _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath); + _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext); +#endif +#endif + +#ifndef _WSTRING_DEFINED +#define _WSTRING_DEFINED + _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); + wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); + _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); + int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); + wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); + size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); + size_t __cdecl wcslen(const wchar_t *_Str); + size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); + wchar_t *__cdecl wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *__cdecl wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); + size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr); + wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim); + _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum); + _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str); + _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str); + _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val); + _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String); + _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String); + _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale); + size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount); + _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale); + int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + +#ifndef NO_OLDNAMES + wchar_t *__cdecl wcsdup(const wchar_t *_Str); +#define wcswcs wcsstr + int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + wchar_t *__cdecl wcsrev(wchar_t *_Str); + wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val); + wchar_t *__cdecl wcslwr(wchar_t *_Str); + wchar_t *__cdecl wcsupr(wchar_t *_Str); + int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); +#endif +#endif + +#ifndef _TM_DEFINED +#define _TM_DEFINED + struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + }; +#endif + +#ifndef _WTIME_DEFINED +#define _WTIME_DEFINED + + _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm); + _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time); + size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm); + _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer); + _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL) +#define _INC_WTIME_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); } +#else +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); } +#endif +#endif +#endif + + typedef int mbstate_t; + typedef wchar_t _Wint_t; + + wint_t __cdecl btowc(int); + size_t __cdecl mbrlen(const char *_Ch,size_t _SizeInBytes,mbstate_t *_State); + size_t __cdecl mbrtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SizeInBytes,mbstate_t *_State); + size_t __cdecl mbsrtowcs(wchar_t *_Dest,const char **_PSrc,size_t _Count,mbstate_t *_State); + size_t __cdecl wcrtomb(char *_Dest,wchar_t _Source,mbstate_t *_State); + size_t __cdecl wcsrtombs(char *_Dest,const wchar_t **_PSource,size_t _Count,mbstate_t *_State); + int __cdecl wctob(wint_t _WCh); + +#ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */ + wchar_t *__cdecl wmemset(wchar_t *s, wchar_t c, size_t n); + _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *s, wchar_t c, size_t n); + int wmemcmp(const wchar_t *s1, const wchar_t *s2,size_t n); + wchar_t *__cdecl wmemcpy(wchar_t *s1,const wchar_t *s2,size_t n); + wchar_t *__cdecl wmemmove(wchar_t *s1, const wchar_t *s2, size_t n); + long long __cdecl wcstoll(const wchar_t *nptr,wchar_t **endptr, int base); + unsigned long long __cdecl wcstoull(const wchar_t *nptr,wchar_t **endptr, int base); +#endif /* __NO_ISOCEXT */ + + void *__cdecl memmove(void *_Dst,const void *_Src,size_t _MaxCount); + void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _MaxCount); + __CRT_INLINE int __cdecl fwide(FILE *_F,int _M) { (void)_F; return (_M); } + __CRT_INLINE int __cdecl mbsinit(const mbstate_t *_P) { return (!_P || *_P==0); } + __CRT_INLINE _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *_S,wchar_t _C,size_t _N) { for (;0<_N;++_S,--_N) if (*_S==_C) return (_CONST_RETURN wchar_t *)(_S); return (0); } + __CRT_INLINE int __cdecl wmemcmp(const wchar_t *_S1,const wchar_t *_S2,size_t _N) { for (; 0 < _N; ++_S1,++_S2,--_N) if (*_S1!=*_S2) return (*_S1 < *_S2 ? -1 : +1); return (0); } + __CRT_INLINE wchar_t *__cdecl wmemcpy(wchar_t *_S1,const wchar_t *_S2,size_t _N) { return (wchar_t *)memcpy(_S1,_S2,_N*sizeof(wchar_t)); } + __CRT_INLINE wchar_t *__cdecl wmemmove(wchar_t *_S1,const wchar_t *_S2,size_t _N) { return (wchar_t *)memmove(_S1,_S2,_N*sizeof(wchar_t)); } + __CRT_INLINE wchar_t *__cdecl wmemset(wchar_t *_S,wchar_t _C,size_t _N) { + wchar_t *_Su = _S; + for (;0<_N;++_Su,--_N) { + *_Su = _C; + } + return (_S); + } +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include +#endif diff --git a/overlay_toolchain/tcc/include/wctype.h b/overlay_toolchain/tcc/include/wctype.h new file mode 100644 index 00000000..a44cb384 --- /dev/null +++ b/overlay_toolchain/tcc/include/wctype.h @@ -0,0 +1,172 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_WCTYPE +#define _INC_WCTYPE + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif + +#ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + +#ifndef _WCTYPE_T_DEFINED + typedef unsigned short wint_t; + typedef unsigned short wctype_t; +#define _WCTYPE_T_DEFINED +#endif + +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() +#ifdef _MSVCRT_ +#define __pctype_func() (_pctype) +#else +#define __pctype_func() (*_imp___pctype) +#endif +#endif + +#ifndef _pctype +#ifdef _MSVCRT_ + extern unsigned short *_pctype; +#else + extern unsigned short **_imp___pctype; +#define _pctype (*_imp___pctype) +#endif +#endif + +#endif +#endif + +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#ifndef _wctype +#ifdef _MSVCRT_ + extern unsigned short *_wctype; +#else + extern unsigned short **_imp___wctype; +#define _wctype (*_imp___wctype) +#endif +#endif + +#ifndef _pwctype +#ifdef _MSVCRT_ + extern unsigned short *_pwctype; +#else + extern unsigned short **_imp___pwctype; +#define _pwctype (*_imp___pwctype) +#define __pwctype_func() (*_imp___pwctype) +#endif +#endif +#endif +#endif + +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 + +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 + +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) + +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED + + int __cdecl iswalpha(wint_t); + int __cdecl iswupper(wint_t); + int __cdecl iswlower(wint_t); + int __cdecl iswdigit(wint_t); + int __cdecl iswxdigit(wint_t); + int __cdecl iswspace(wint_t); + int __cdecl iswpunct(wint_t); + int __cdecl iswalnum(wint_t); + int __cdecl iswprint(wint_t); + int __cdecl iswgraph(wint_t); + int __cdecl iswcntrl(wint_t); + int __cdecl iswascii(wint_t); + int __cdecl isleadbyte(int); + wint_t __cdecl towupper(wint_t); + wint_t __cdecl towlower(wint_t); + int __cdecl iswctype(wint_t,wctype_t); + _CRTIMP int __cdecl __iswcsymf(wint_t); + _CRTIMP int __cdecl __iswcsym(wint_t); + int __cdecl is_wctype(wint_t,wctype_t); +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) +int __cdecl isblank(int _C); +#endif +#endif + +#ifndef _WCTYPE_INLINE_DEFINED +#define _WCTYPE_INLINE_DEFINED +#ifndef __cplusplus +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) +#define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE) +#else + __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); } + __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); } + __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); } + __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); } + __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); } + __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); } + __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); } + __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); } + __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); } + __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); } + __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); } + __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); } + __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); } +#endif +#endif + + typedef wchar_t wctrans_t; + wint_t __cdecl towctrans(wint_t,wctrans_t); + wctrans_t __cdecl wctrans(const char *); + wctype_t __cdecl wctype(const char *); + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/overlay_toolchain/tcc/include/winapi/basetsd.h b/overlay_toolchain/tcc/include/winapi/basetsd.h new file mode 100644 index 00000000..47d78c4c --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/basetsd.h @@ -0,0 +1,149 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _BASETSD_H_ +#define _BASETSD_H_ + +#if (defined(__x86_64) || defined(__ia64__)) && !defined(RC_INVOKED) +typedef unsigned __int64 POINTER_64_INT; +#else +typedef unsigned long POINTER_64_INT; +#endif + +#define POINTER_32 +#define POINTER_64 +#define FIRMWARE_PTR + +#ifdef __cplusplus +extern "C" { +#endif + + typedef signed char INT8,*PINT8; + typedef signed short INT16,*PINT16; + typedef signed int INT32,*PINT32; + typedef signed __int64 INT64,*PINT64; + typedef unsigned char UINT8,*PUINT8; + typedef unsigned short UINT16,*PUINT16; + typedef unsigned int UINT32,*PUINT32; + typedef unsigned __int64 UINT64,*PUINT64; + typedef signed int LONG32,*PLONG32; + typedef unsigned int ULONG32,*PULONG32; + typedef unsigned int DWORD32,*PDWORD32; + +#ifndef _W64 +#define _W64 +#endif + +#ifdef _WIN64 + typedef __int64 INT_PTR,*PINT_PTR; + typedef unsigned __int64 UINT_PTR,*PUINT_PTR; + typedef __int64 LONG_PTR,*PLONG_PTR; + typedef unsigned __int64 ULONG_PTR,*PULONG_PTR; +#define __int3264 __int64 +#else + typedef int INT_PTR,*PINT_PTR; + typedef unsigned int UINT_PTR,*PUINT_PTR; + typedef long LONG_PTR,*PLONG_PTR; + typedef unsigned long ULONG_PTR,*PULONG_PTR; +#define __int3264 __int32 +#endif + +#ifdef _WIN64 +#define ADDRESS_TAG_BIT 0x40000000000ULL + typedef __int64 SHANDLE_PTR; + typedef unsigned __int64 HANDLE_PTR; + typedef unsigned int UHALF_PTR,*PUHALF_PTR; + typedef int HALF_PTR,*PHALF_PTR; + + static __inline unsigned long HandleToULong(const void *h) { return((unsigned long) (ULONG_PTR) h); } + static __inline long HandleToLong(const void *h) { return((long) (LONG_PTR) h); } + static __inline void *ULongToHandle(const unsigned long h) { return((void *) (UINT_PTR) h); } + static __inline void *LongToHandle(const long h) { return((void *) (INT_PTR) h); } + static __inline unsigned long PtrToUlong(const void *p) { return((unsigned long) (ULONG_PTR) p); } + static __inline unsigned int PtrToUint(const void *p) { return((unsigned int) (UINT_PTR) p); } + static __inline unsigned short PtrToUshort(const void *p) { return((unsigned short) (unsigned long) (ULONG_PTR) p); } + static __inline long PtrToLong(const void *p) { return((long) (LONG_PTR) p); } + static __inline int PtrToInt(const void *p) { return((int) (INT_PTR) p); } + static __inline short PtrToShort(const void *p) { return((short) (long) (LONG_PTR) p); } + static __inline void *IntToPtr(const int i) { return((void *)(INT_PTR)i); } + static __inline void *UIntToPtr(const unsigned int ui) { return((void *)(UINT_PTR)ui); } + static __inline void *LongToPtr(const long l) { return((void *)(LONG_PTR)l); } + static __inline void *ULongToPtr(const unsigned long ul) { return((void *)(ULONG_PTR)ul); } + +#define PtrToPtr64(p) ((void *) p) +#define Ptr64ToPtr(p) ((void *) p) +#define HandleToHandle64(h) (PtrToPtr64(h)) +#define Handle64ToHandle(h) (Ptr64ToPtr(h)) + + static __inline void *Ptr32ToPtr(const void *p) { return (void *)p; } + static __inline void *Handle32ToHandle(const void *h) { return((void *) h); } + static __inline void *PtrToPtr32(const void *p) { return((void *) (ULONG_PTR) p); } + +#define HandleToHandle32(h) (PtrToPtr32(h)) +#else + +#define ADDRESS_TAG_BIT 0x80000000UL + + typedef unsigned short UHALF_PTR,*PUHALF_PTR; + typedef short HALF_PTR,*PHALF_PTR; + typedef long SHANDLE_PTR; + typedef unsigned long HANDLE_PTR; + +#define HandleToULong(h) ((ULONG)(ULONG_PTR)(h)) +#define HandleToLong(h) ((LONG)(LONG_PTR) (h)) +#define ULongToHandle(ul) ((HANDLE)(ULONG_PTR) (ul)) +#define LongToHandle(h) ((HANDLE)(LONG_PTR) (h)) +#define PtrToUlong(p) ((ULONG)(ULONG_PTR) (p)) +#define PtrToLong(p) ((LONG)(LONG_PTR) (p)) +#define PtrToUint(p) ((UINT)(UINT_PTR) (p)) +#define PtrToInt(p) ((INT)(INT_PTR) (p)) +#define PtrToUshort(p) ((unsigned short)(ULONG_PTR)(p)) +#define PtrToShort(p) ((short)(LONG_PTR)(p)) +#define IntToPtr(i) ((VOID *)(INT_PTR)((int)i)) +#define UIntToPtr(ui) ((VOID *)(UINT_PTR)((unsigned int)ui)) +#define LongToPtr(l) ((VOID *)(LONG_PTR)((long)l)) +#define ULongToPtr(ul) ((VOID *)(ULONG_PTR)((unsigned long)ul)) + + static __inline void *PtrToPtr64(const void *p) { return((void *) (ULONG_PTR)p); } + static __inline void *Ptr64ToPtr(const void *p) { return((void *) (ULONG_PTR) p); } + static __inline void *HandleToHandle64(const void *h) { return((void *) h); } + static __inline void *Handle64ToHandle(const void *h) { return((void *) (ULONG_PTR) h); } + +#define Ptr32ToPtr(p) ((void *) p) +#define Handle32ToHandle(h) (Ptr32ToPtr(h)) +#define PtrToPtr32(p) ((void *) p) +#define HandleToHandle32(h) (PtrToPtr32(h)) +#endif + +#define HandleToUlong(h) HandleToULong(h) +#define UlongToHandle(ul) ULongToHandle(ul) +#define UlongToPtr(ul) ULongToPtr(ul) +#define UintToPtr(ui) UIntToPtr(ui) + +#define MAXUINT_PTR (~((UINT_PTR)0)) +#define MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1)) +#define MININT_PTR (~MAXINT_PTR) + +#define MAXULONG_PTR (~((ULONG_PTR)0)) +#define MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1)) +#define MINLONG_PTR (~MAXLONG_PTR) + +#define MAXUHALF_PTR ((UHALF_PTR)~0) +#define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1)) +#define MINHALF_PTR (~MAXHALF_PTR) + + typedef ULONG_PTR SIZE_T,*PSIZE_T; + typedef LONG_PTR SSIZE_T,*PSSIZE_T; + typedef ULONG_PTR DWORD_PTR,*PDWORD_PTR; + typedef __int64 LONG64,*PLONG64; + typedef unsigned __int64 ULONG64,*PULONG64; + typedef unsigned __int64 DWORD64,*PDWORD64; + typedef ULONG_PTR KAFFINITY; + typedef KAFFINITY *PKAFFINITY; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/basetyps.h b/overlay_toolchain/tcc/include/winapi/basetyps.h new file mode 100644 index 00000000..376665e7 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/basetyps.h @@ -0,0 +1,85 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !defined(_BASETYPS_H_) +#define _BASETYPS_H_ + +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C extern +#endif + +#define STDMETHODCALLTYPE WINAPI +#define STDMETHODVCALLTYPE __cdecl + +#define STDAPICALLTYPE WINAPI +#define STDAPIVCALLTYPE __cdecl + +#define STDAPI EXTERN_C HRESULT WINAPI +#define STDAPI_(type) EXTERN_C type WINAPI + +#define STDMETHODIMP HRESULT WINAPI +#define STDMETHODIMP_(type) type WINAPI + +#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE +#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE + +#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE +#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE + +#if defined(__cplusplus) && !defined(CINTERFACE) + +#define __STRUCT__ struct +#define STDMETHOD(method) virtual HRESULT WINAPI method +#define STDMETHOD_(type,method) virtual type WINAPI method +#define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method +#define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method +#define PURE = 0 +#define THIS_ +#define THIS void +#define DECLARE_INTERFACE(iface) __STRUCT__ iface +#define DECLARE_INTERFACE_(iface,baseiface) __STRUCT__ iface : public baseiface +#else + +#ifndef __OBJC__ +#define interface struct +#endif + +#define STDMETHOD(method) HRESULT (WINAPI *method) +#define STDMETHOD_(type,method) type (WINAPI *method) +#define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method) +#define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method) + +#define PURE +#define THIS_ INTERFACE *This, +#define THIS INTERFACE *This +#ifdef CONST_VTABLE +#define DECLARE_INTERFACE(iface) typedef struct iface { \ + const struct iface##Vtbl *lpVtbl; } iface; \ + typedef const struct iface##Vtbl iface##Vtbl; \ + const struct iface##Vtbl +#else +#define DECLARE_INTERFACE(iface) typedef struct iface { \ + struct iface##Vtbl *lpVtbl; \ + } iface; \ + typedef struct iface##Vtbl iface##Vtbl; \ + struct iface##Vtbl +#endif +#define DECLARE_INTERFACE_(iface,baseiface) DECLARE_INTERFACE(iface) +#endif + +#include + +#ifndef _ERROR_STATUS_T_DEFINED +#define _ERROR_STATUS_T_DEFINED +typedef unsigned long error_status_t; +#endif + +#ifndef _WCHAR_T_DEFINED +typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/guiddef.h b/overlay_toolchain/tcc/include/winapi/guiddef.h new file mode 100644 index 00000000..4e7909a9 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/guiddef.h @@ -0,0 +1,156 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef GUID_DEFINED +#define GUID_DEFINED +typedef struct _GUID { + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[8 ]; +} GUID; +#endif + +#ifndef UUID_DEFINED +#define UUID_DEFINED +typedef GUID UUID; +#endif + +#ifndef FAR +#define FAR +#endif + +#ifndef DECLSPEC_SELECTANY +#define DECLSPEC_SELECTANY __declspec(selectany) +#endif + +#ifndef EXTERN_C +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C extern +#endif +#endif + +#ifdef DEFINE_GUID +#undef DEFINE_GUID +#endif + +#ifdef INITGUID +#ifdef __cplusplus +#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } +#else +#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } +#endif +#else +#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID name +#endif + +#define DEFINE_OLEGUID(name,l,w1,w2) DEFINE_GUID(name,l,w1,w2,0xC0,0,0,0,0,0,0,0x46) + +#ifndef _GUIDDEF_H_ +#define _GUIDDEF_H_ + +#ifndef __LPGUID_DEFINED__ +#define __LPGUID_DEFINED__ +typedef GUID *LPGUID; +#endif + +#ifndef __LPCGUID_DEFINED__ +#define __LPCGUID_DEFINED__ +typedef const GUID *LPCGUID; +#endif + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef GUID IID; +typedef IID *LPIID; +#define IID_NULL GUID_NULL +#define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) +typedef GUID CLSID; +typedef CLSID *LPCLSID; +#define CLSID_NULL GUID_NULL +#define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) +typedef GUID FMTID; +typedef FMTID *LPFMTID; +#define FMTID_NULL GUID_NULL +#define IsEqualFMTID(rfmtid1,rfmtid2) IsEqualGUID(rfmtid1,rfmtid2) + +#ifdef __midl_proxy +#define __MIDL_CONST +#else +#define __MIDL_CONST const +#endif + +#ifndef _REFGUID_DEFINED +#define _REFGUID_DEFINED +#ifdef __cplusplus +#define REFGUID const GUID & +#else +#define REFGUID const GUID *__MIDL_CONST +#endif +#endif + +#ifndef _REFIID_DEFINED +#define _REFIID_DEFINED +#ifdef __cplusplus +#define REFIID const IID & +#else +#define REFIID const IID *__MIDL_CONST +#endif +#endif + +#ifndef _REFCLSID_DEFINED +#define _REFCLSID_DEFINED +#ifdef __cplusplus +#define REFCLSID const IID & +#else +#define REFCLSID const IID *__MIDL_CONST +#endif +#endif + +#ifndef _REFFMTID_DEFINED +#define _REFFMTID_DEFINED +#ifdef __cplusplus +#define REFFMTID const IID & +#else +#define REFFMTID const IID *__MIDL_CONST +#endif +#endif +#endif + +#ifndef _SYS_GUID_OPERATORS_ +#define _SYS_GUID_OPERATORS_ +#include + +#ifdef __cplusplus +__inline int InlineIsEqualGUID(REFGUID rguid1,REFGUID rguid2) { + return (((unsigned long *) &rguid1)[0]==((unsigned long *) &rguid2)[0] && ((unsigned long *) &rguid1)[1]==((unsigned long *) &rguid2)[1] && + ((unsigned long *) &rguid1)[2]==((unsigned long *) &rguid2)[2] && ((unsigned long *) &rguid1)[3]==((unsigned long *) &rguid2)[3]); +} +__inline int IsEqualGUID(REFGUID rguid1,REFGUID rguid2) { return !memcmp(&rguid1,&rguid2,sizeof(GUID)); } +#else +#define InlineIsEqualGUID(rguid1,rguid2) (((unsigned long *) rguid1)[0]==((unsigned long *) rguid2)[0] && ((unsigned long *) rguid1)[1]==((unsigned long *) rguid2)[1] && ((unsigned long *) rguid1)[2]==((unsigned long *) rguid2)[2] && ((unsigned long *) rguid1)[3]==((unsigned long *) rguid2)[3]) +#define IsEqualGUID(rguid1,rguid2) (!memcmp(rguid1,rguid2,sizeof(GUID))) +#endif + +#ifdef __INLINE_ISEQUAL_GUID +#undef IsEqualGUID +#define IsEqualGUID(rguid1,rguid2) InlineIsEqualGUID(rguid1,rguid2) +#endif + +#define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) +#define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) + +#if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_ +#define _SYS_GUID_OPERATOR_EQ_ +#ifdef __cplusplus +__inline int operator==(REFGUID guidOne,REFGUID guidOther) { return IsEqualGUID(guidOne,guidOther); } +__inline int operator!=(REFGUID guidOne,REFGUID guidOther) { return !(guidOne==guidOther); } +#endif +#endif +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/poppack.h b/overlay_toolchain/tcc/include/winapi/poppack.h new file mode 100644 index 00000000..b08cba22 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/poppack.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(pop) +#endif diff --git a/overlay_toolchain/tcc/include/winapi/pshpack1.h b/overlay_toolchain/tcc/include/winapi/pshpack1.h new file mode 100644 index 00000000..d18d9e85 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/pshpack1.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(push,1) +#endif diff --git a/overlay_toolchain/tcc/include/winapi/pshpack2.h b/overlay_toolchain/tcc/include/winapi/pshpack2.h new file mode 100644 index 00000000..7de16fd3 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/pshpack2.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(push,2) +#endif diff --git a/overlay_toolchain/tcc/include/winapi/pshpack4.h b/overlay_toolchain/tcc/include/winapi/pshpack4.h new file mode 100644 index 00000000..1c8e61d7 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/pshpack4.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(push,4) +#endif diff --git a/overlay_toolchain/tcc/include/winapi/pshpack8.h b/overlay_toolchain/tcc/include/winapi/pshpack8.h new file mode 100644 index 00000000..70a3c7f7 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/pshpack8.h @@ -0,0 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#if !(defined(lint) || defined(RC_INVOKED)) +#pragma pack(push,8) +#endif diff --git a/overlay_toolchain/tcc/include/winapi/winbase.h b/overlay_toolchain/tcc/include/winapi/winbase.h new file mode 100644 index 00000000..4a38006e --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/winbase.h @@ -0,0 +1,2951 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINBASE_ +#define _WINBASE_ + +#define WINADVAPI DECLSPEC_IMPORT +#define WINBASEAPI DECLSPEC_IMPORT +#define ZAWPROXYAPI DECLSPEC_IMPORT + +#ifdef __cplusplus +extern "C" { +#endif + +#define DefineHandleTable(w) ((w),TRUE) +#define LimitEmsPages(dw) +#define SetSwapAreaSize(w) (w) +#define LockSegment(w) GlobalFix((HANDLE)(w)) +#define UnlockSegment(w) GlobalUnfix((HANDLE)(w)) +#define GetCurrentTime() GetTickCount() + +#define Yield() + +#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1) +#define INVALID_FILE_SIZE ((DWORD)0xffffffff) +#define INVALID_SET_FILE_POINTER ((DWORD)-1) +#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) + +#define FILE_BEGIN 0 +#define FILE_CURRENT 1 +#define FILE_END 2 + +#define TIME_ZONE_ID_INVALID ((DWORD)0xffffffff) + +#define WAIT_FAILED ((DWORD)0xffffffff) +#define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0) +#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) + 0) +#define WAIT_ABANDONED_0 ((STATUS_ABANDONED_WAIT_0) + 0) +#define WAIT_IO_COMPLETION STATUS_USER_APC +#define STILL_ACTIVE STATUS_PENDING +#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION +#define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT +#define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT +#define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP +#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED +#define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND +#define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO +#define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT +#define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION +#define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW +#define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK +#define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW +#define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO +#define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW +#define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION +#define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR +#define EXCEPTION_ILLEGAL_INSTRUCTION STATUS_ILLEGAL_INSTRUCTION +#define EXCEPTION_NONCONTINUABLE_EXCEPTION STATUS_NONCONTINUABLE_EXCEPTION +#define EXCEPTION_STACK_OVERFLOW STATUS_STACK_OVERFLOW +#define EXCEPTION_INVALID_DISPOSITION STATUS_INVALID_DISPOSITION +#define EXCEPTION_GUARD_PAGE STATUS_GUARD_PAGE_VIOLATION +#define EXCEPTION_INVALID_HANDLE STATUS_INVALID_HANDLE +#define EXCEPTION_POSSIBLE_DEADLOCK STATUS_POSSIBLE_DEADLOCK +#define CONTROL_C_EXIT STATUS_CONTROL_C_EXIT +#define MoveMemory RtlMoveMemory +#define CopyMemory RtlCopyMemory +#define FillMemory RtlFillMemory +#define ZeroMemory RtlZeroMemory +#define SecureZeroMemory RtlSecureZeroMemory + +#define FILE_FLAG_WRITE_THROUGH 0x80000000 +#define FILE_FLAG_OVERLAPPED 0x40000000 +#define FILE_FLAG_NO_BUFFERING 0x20000000 +#define FILE_FLAG_RANDOM_ACCESS 0x10000000 +#define FILE_FLAG_SEQUENTIAL_SCAN 0x8000000 +#define FILE_FLAG_DELETE_ON_CLOSE 0x4000000 +#define FILE_FLAG_BACKUP_SEMANTICS 0x2000000 +#define FILE_FLAG_POSIX_SEMANTICS 0x1000000 +#define FILE_FLAG_OPEN_REPARSE_POINT 0x200000 +#define FILE_FLAG_OPEN_NO_RECALL 0x100000 +#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x80000 + +#define CREATE_NEW 1 +#define CREATE_ALWAYS 2 +#define OPEN_EXISTING 3 +#define OPEN_ALWAYS 4 +#define TRUNCATE_EXISTING 5 + +#define PROGRESS_CONTINUE 0 +#define PROGRESS_CANCEL 1 +#define PROGRESS_STOP 2 +#define PROGRESS_QUIET 3 + +#define CALLBACK_CHUNK_FINISHED 0x0 +#define CALLBACK_STREAM_SWITCH 0x1 + +#define COPY_FILE_FAIL_IF_EXISTS 0x1 +#define COPY_FILE_RESTARTABLE 0x2 +#define COPY_FILE_OPEN_SOURCE_FOR_WRITE 0x4 +#define COPY_FILE_ALLOW_DECRYPTED_DESTINATION 0x8 + +#define REPLACEFILE_WRITE_THROUGH 0x1 +#define REPLACEFILE_IGNORE_MERGE_ERRORS 0x2 + +#define PIPE_ACCESS_INBOUND 0x1 +#define PIPE_ACCESS_OUTBOUND 0x2 +#define PIPE_ACCESS_DUPLEX 0x3 + +#define PIPE_CLIENT_END 0x0 +#define PIPE_SERVER_END 0x1 + +#define PIPE_WAIT 0x0 +#define PIPE_NOWAIT 0x1 +#define PIPE_READMODE_BYTE 0x0 +#define PIPE_READMODE_MESSAGE 0x2 +#define PIPE_TYPE_BYTE 0x0 +#define PIPE_TYPE_MESSAGE 0x4 + +#define PIPE_UNLIMITED_INSTANCES 255 + +#define SECURITY_ANONYMOUS (SecurityAnonymous << 16) +#define SECURITY_IDENTIFICATION (SecurityIdentification << 16) +#define SECURITY_IMPERSONATION (SecurityImpersonation << 16) +#define SECURITY_DELEGATION (SecurityDelegation << 16) + +#define SECURITY_CONTEXT_TRACKING 0x40000 +#define SECURITY_EFFECTIVE_ONLY 0x80000 + +#define SECURITY_SQOS_PRESENT 0x100000 +#define SECURITY_VALID_SQOS_FLAGS 0x1f0000 + + typedef struct _OVERLAPPED { + ULONG_PTR Internal; + ULONG_PTR InternalHigh; + union { + struct { + DWORD Offset; + DWORD OffsetHigh; + }; + PVOID Pointer; + }; + HANDLE hEvent; + } OVERLAPPED,*LPOVERLAPPED; + + typedef struct _SECURITY_ATTRIBUTES { + DWORD nLength; + LPVOID lpSecurityDescriptor; + WINBOOL bInheritHandle; + } SECURITY_ATTRIBUTES,*PSECURITY_ATTRIBUTES,*LPSECURITY_ATTRIBUTES; + + typedef struct _PROCESS_INFORMATION { + HANDLE hProcess; + HANDLE hThread; + DWORD dwProcessId; + DWORD dwThreadId; + } PROCESS_INFORMATION,*PPROCESS_INFORMATION,*LPPROCESS_INFORMATION; + +#ifndef _FILETIME_ +#define _FILETIME_ + typedef struct _FILETIME { + DWORD dwLowDateTime; + DWORD dwHighDateTime; + } FILETIME,*PFILETIME,*LPFILETIME; +#endif + + typedef struct _SYSTEMTIME { + WORD wYear; + WORD wMonth; + WORD wDayOfWeek; + WORD wDay; + WORD wHour; + WORD wMinute; + WORD wSecond; + WORD wMilliseconds; + } SYSTEMTIME,*PSYSTEMTIME,*LPSYSTEMTIME; + + typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter); + typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; + typedef VOID (WINAPI *PFIBER_START_ROUTINE)(LPVOID lpFiberParameter); + typedef PFIBER_START_ROUTINE LPFIBER_START_ROUTINE; + + typedef RTL_CRITICAL_SECTION CRITICAL_SECTION; + typedef PRTL_CRITICAL_SECTION PCRITICAL_SECTION; + typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION; + typedef RTL_CRITICAL_SECTION_DEBUG CRITICAL_SECTION_DEBUG; + typedef PRTL_CRITICAL_SECTION_DEBUG PCRITICAL_SECTION_DEBUG; + typedef PRTL_CRITICAL_SECTION_DEBUG LPCRITICAL_SECTION_DEBUG; + + WINBASEAPI PVOID WINAPI EncodePointer(PVOID Ptr); + WINBASEAPI PVOID WINAPI DecodePointer(PVOID Ptr); + WINBASEAPI PVOID WINAPI EncodeSystemPointer(PVOID Ptr); + WINBASEAPI PVOID WINAPI DecodeSystemPointer(PVOID Ptr); + +#ifdef I_X86_ + typedef PLDT_ENTRY LPLDT_ENTRY; +#else + typedef LPVOID LPLDT_ENTRY; +#endif + +#define MUTEX_MODIFY_STATE MUTANT_QUERY_STATE +#define MUTEX_ALL_ACCESS MUTANT_ALL_ACCESS + +#define SP_SERIALCOMM ((DWORD)0x1) + +#define PST_UNSPECIFIED ((DWORD)0x0) +#define PST_RS232 ((DWORD)0x1) +#define PST_PARALLELPORT ((DWORD)0x2) +#define PST_RS422 ((DWORD)0x3) +#define PST_RS423 ((DWORD)0x4) +#define PST_RS449 ((DWORD)0x5) +#define PST_MODEM ((DWORD)0x6) +#define PST_FAX ((DWORD)0x21) +#define PST_SCANNER ((DWORD)0x22) +#define PST_NETWORK_BRIDGE ((DWORD)0x100) +#define PST_LAT ((DWORD)0x101) +#define PST_TCPIP_TELNET ((DWORD)0x102) +#define PST_X25 ((DWORD)0x103) + +#define PCF_DTRDSR ((DWORD)0x1) +#define PCF_RTSCTS ((DWORD)0x2) +#define PCF_RLSD ((DWORD)0x4) +#define PCF_PARITY_CHECK ((DWORD)0x8) +#define PCF_XONXOFF ((DWORD)0x10) +#define PCF_SETXCHAR ((DWORD)0x20) +#define PCF_TOTALTIMEOUTS ((DWORD)0x40) +#define PCF_INTTIMEOUTS ((DWORD)0x80) +#define PCF_SPECIALCHARS ((DWORD)0x100) +#define PCF_16BITMODE ((DWORD)0x200) + +#define SP_PARITY ((DWORD)0x1) +#define SP_BAUD ((DWORD)0x2) +#define SP_DATABITS ((DWORD)0x4) +#define SP_STOPBITS ((DWORD)0x8) +#define SP_HANDSHAKING ((DWORD)0x10) +#define SP_PARITY_CHECK ((DWORD)0x20) +#define SP_RLSD ((DWORD)0x40) + +#define BAUD_075 ((DWORD)0x1) +#define BAUD_110 ((DWORD)0x2) +#define BAUD_134_5 ((DWORD)0x4) +#define BAUD_150 ((DWORD)0x8) +#define BAUD_300 ((DWORD)0x10) +#define BAUD_600 ((DWORD)0x20) +#define BAUD_1200 ((DWORD)0x40) +#define BAUD_1800 ((DWORD)0x80) +#define BAUD_2400 ((DWORD)0x100) +#define BAUD_4800 ((DWORD)0x200) +#define BAUD_7200 ((DWORD)0x400) +#define BAUD_9600 ((DWORD)0x800) +#define BAUD_14400 ((DWORD)0x1000) +#define BAUD_19200 ((DWORD)0x2000) +#define BAUD_38400 ((DWORD)0x4000) +#define BAUD_56K ((DWORD)0x8000) +#define BAUD_128K ((DWORD)0x10000) +#define BAUD_115200 ((DWORD)0x20000) +#define BAUD_57600 ((DWORD)0x40000) +#define BAUD_USER ((DWORD)0x10000000) + +#define DATABITS_5 ((WORD)0x1) +#define DATABITS_6 ((WORD)0x2) +#define DATABITS_7 ((WORD)0x4) +#define DATABITS_8 ((WORD)0x8) +#define DATABITS_16 ((WORD)0x10) +#define DATABITS_16X ((WORD)0x20) + +#define STOPBITS_10 ((WORD)0x1) +#define STOPBITS_15 ((WORD)0x2) +#define STOPBITS_20 ((WORD)0x4) +#define PARITY_NONE ((WORD)0x100) +#define PARITY_ODD ((WORD)0x200) +#define PARITY_EVEN ((WORD)0x400) +#define PARITY_MARK ((WORD)0x800) +#define PARITY_SPACE ((WORD)0x1000) + + typedef struct _COMMPROP { + WORD wPacketLength; + WORD wPacketVersion; + DWORD dwServiceMask; + DWORD dwReserved1; + DWORD dwMaxTxQueue; + DWORD dwMaxRxQueue; + DWORD dwMaxBaud; + DWORD dwProvSubType; + DWORD dwProvCapabilities; + DWORD dwSettableParams; + DWORD dwSettableBaud; + WORD wSettableData; + WORD wSettableStopParity; + DWORD dwCurrentTxQueue; + DWORD dwCurrentRxQueue; + DWORD dwProvSpec1; + DWORD dwProvSpec2; + WCHAR wcProvChar[1]; + } COMMPROP,*LPCOMMPROP; + +#define COMMPROP_INITIALIZED ((DWORD)0xE73CF52E) + + typedef struct _COMSTAT { + DWORD fCtsHold : 1; + DWORD fDsrHold : 1; + DWORD fRlsdHold : 1; + DWORD fXoffHold : 1; + DWORD fXoffSent : 1; + DWORD fEof : 1; + DWORD fTxim : 1; + DWORD fReserved : 25; + DWORD cbInQue; + DWORD cbOutQue; + } COMSTAT,*LPCOMSTAT; + +#define DTR_CONTROL_DISABLE 0x0 +#define DTR_CONTROL_ENABLE 0x1 +#define DTR_CONTROL_HANDSHAKE 0x2 + +#define RTS_CONTROL_DISABLE 0x0 +#define RTS_CONTROL_ENABLE 0x1 +#define RTS_CONTROL_HANDSHAKE 0x2 +#define RTS_CONTROL_TOGGLE 0x3 + + typedef struct _DCB { + DWORD DCBlength; + DWORD BaudRate; + DWORD fBinary: 1; + DWORD fParity: 1; + DWORD fOutxCtsFlow:1; + DWORD fOutxDsrFlow:1; + DWORD fDtrControl:2; + DWORD fDsrSensitivity:1; + DWORD fTXContinueOnXoff: 1; + DWORD fOutX: 1; + DWORD fInX: 1; + DWORD fErrorChar: 1; + DWORD fNull: 1; + DWORD fRtsControl:2; + DWORD fAbortOnError:1; + DWORD fDummy2:17; + WORD wReserved; + WORD XonLim; + WORD XoffLim; + BYTE ByteSize; + BYTE Parity; + BYTE StopBits; + char XonChar; + char XoffChar; + char ErrorChar; + char EofChar; + char EvtChar; + WORD wReserved1; + } DCB,*LPDCB; + + typedef struct _COMMTIMEOUTS { + DWORD ReadIntervalTimeout; + DWORD ReadTotalTimeoutMultiplier; + DWORD ReadTotalTimeoutConstant; + DWORD WriteTotalTimeoutMultiplier; + DWORD WriteTotalTimeoutConstant; + } COMMTIMEOUTS,*LPCOMMTIMEOUTS; + + typedef struct _COMMCONFIG { + DWORD dwSize; + WORD wVersion; + WORD wReserved; + DCB dcb; + DWORD dwProviderSubType; + DWORD dwProviderOffset; + DWORD dwProviderSize; + WCHAR wcProviderData[1]; + } COMMCONFIG,*LPCOMMCONFIG; + + typedef struct _SYSTEM_INFO { + union { + DWORD dwOemId; + struct { + WORD wProcessorArchitecture; + WORD wReserved; + }; + }; + DWORD dwPageSize; + LPVOID lpMinimumApplicationAddress; + LPVOID lpMaximumApplicationAddress; + DWORD_PTR dwActiveProcessorMask; + DWORD dwNumberOfProcessors; + DWORD dwProcessorType; + DWORD dwAllocationGranularity; + WORD wProcessorLevel; + WORD wProcessorRevision; + } SYSTEM_INFO,*LPSYSTEM_INFO; + +#define FreeModule(hLibModule) FreeLibrary((hLibModule)) +#define MakeProcInstance(lpProc,hInstance) (lpProc) +#define FreeProcInstance(lpProc) (lpProc) + +#define GMEM_FIXED 0x0 +#define GMEM_MOVEABLE 0x2 +#define GMEM_NOCOMPACT 0x10 +#define GMEM_NODISCARD 0x20 +#define GMEM_ZEROINIT 0x40 +#define GMEM_MODIFY 0x80 +#define GMEM_DISCARDABLE 0x100 +#define GMEM_NOT_BANKED 0x1000 +#define GMEM_SHARE 0x2000 +#define GMEM_DDESHARE 0x2000 +#define GMEM_NOTIFY 0x4000 +#define GMEM_LOWER GMEM_NOT_BANKED +#define GMEM_VALID_FLAGS 0x7F72 +#define GMEM_INVALID_HANDLE 0x8000 + +#define GHND (GMEM_MOVEABLE | GMEM_ZEROINIT) +#define GPTR (GMEM_FIXED | GMEM_ZEROINIT) + +#define GlobalLRUNewest(h) ((HANDLE)(h)) +#define GlobalLRUOldest(h) ((HANDLE)(h)) +#define GlobalDiscard(h) GlobalReAlloc((h),0,GMEM_MOVEABLE) + +#define GMEM_DISCARDED 0x4000 +#define GMEM_LOCKCOUNT 0xff + + typedef struct _MEMORYSTATUS { + DWORD dwLength; + DWORD dwMemoryLoad; + SIZE_T dwTotalPhys; + SIZE_T dwAvailPhys; + SIZE_T dwTotalPageFile; + SIZE_T dwAvailPageFile; + SIZE_T dwTotalVirtual; + SIZE_T dwAvailVirtual; + } MEMORYSTATUS,*LPMEMORYSTATUS; + +#define LMEM_FIXED 0x0 +#define LMEM_MOVEABLE 0x2 +#define LMEM_NOCOMPACT 0x10 +#define LMEM_NODISCARD 0x20 +#define LMEM_ZEROINIT 0x40 +#define LMEM_MODIFY 0x80 +#define LMEM_DISCARDABLE 0xf00 +#define LMEM_VALID_FLAGS 0xf72 +#define LMEM_INVALID_HANDLE 0x8000 + +#define LHND (LMEM_MOVEABLE | LMEM_ZEROINIT) +#define LPTR (LMEM_FIXED | LMEM_ZEROINIT) + +#define NONZEROLHND (LMEM_MOVEABLE) +#define NONZEROLPTR (LMEM_FIXED) + +#define LocalDiscard(h) LocalReAlloc((h),0,LMEM_MOVEABLE) + +#define LMEM_DISCARDED 0x4000 +#define LMEM_LOCKCOUNT 0xff + +#define DEBUG_PROCESS 0x1 +#define DEBUG_ONLY_THIS_PROCESS 0x2 +#define CREATE_SUSPENDED 0x4 +#define DETACHED_PROCESS 0x8 +#define CREATE_NEW_CONSOLE 0x10 +#define NORMAL_PRIORITY_CLASS 0x20 +#define IDLE_PRIORITY_CLASS 0x40 +#define HIGH_PRIORITY_CLASS 0x80 +#define REALTIME_PRIORITY_CLASS 0x100 +#define CREATE_NEW_PROCESS_GROUP 0x200 +#define CREATE_UNICODE_ENVIRONMENT 0x400 +#define CREATE_SEPARATE_WOW_VDM 0x800 +#define CREATE_SHARED_WOW_VDM 0x1000 +#define CREATE_FORCEDOS 0x2000 +#define BELOW_NORMAL_PRIORITY_CLASS 0x4000 +#define ABOVE_NORMAL_PRIORITY_CLASS 0x8000 +#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x10000 + +#define CREATE_BREAKAWAY_FROM_JOB 0x1000000 +#define CREATE_PRESERVE_CODE_AUTHZ_LEVEL 0x2000000 + +#define CREATE_DEFAULT_ERROR_MODE 0x4000000 +#define CREATE_NO_WINDOW 0x8000000 + +#define PROFILE_USER 0x10000000 +#define PROFILE_KERNEL 0x20000000 +#define PROFILE_SERVER 0x40000000 + +#define CREATE_IGNORE_SYSTEM_DEFAULT 0x80000000 + +#define THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN +#define THREAD_PRIORITY_BELOW_NORMAL (THREAD_PRIORITY_LOWEST+1) +#define THREAD_PRIORITY_NORMAL 0 +#define THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX +#define THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST-1) +#define THREAD_PRIORITY_ERROR_RETURN (MAXLONG) + +#define THREAD_PRIORITY_TIME_CRITICAL THREAD_BASE_PRIORITY_LOWRT +#define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE + +#define EXCEPTION_DEBUG_EVENT 1 +#define CREATE_THREAD_DEBUG_EVENT 2 +#define CREATE_PROCESS_DEBUG_EVENT 3 +#define EXIT_THREAD_DEBUG_EVENT 4 +#define EXIT_PROCESS_DEBUG_EVENT 5 +#define LOAD_DLL_DEBUG_EVENT 6 +#define UNLOAD_DLL_DEBUG_EVENT 7 +#define OUTPUT_DEBUG_STRING_EVENT 8 +#define RIP_EVENT 9 + + typedef struct _EXCEPTION_DEBUG_INFO { + EXCEPTION_RECORD ExceptionRecord; + DWORD dwFirstChance; + } EXCEPTION_DEBUG_INFO,*LPEXCEPTION_DEBUG_INFO; + + typedef struct _CREATE_THREAD_DEBUG_INFO { + HANDLE hThread; + LPVOID lpThreadLocalBase; + LPTHREAD_START_ROUTINE lpStartAddress; + } CREATE_THREAD_DEBUG_INFO,*LPCREATE_THREAD_DEBUG_INFO; + + typedef struct _CREATE_PROCESS_DEBUG_INFO { + HANDLE hFile; + HANDLE hProcess; + HANDLE hThread; + LPVOID lpBaseOfImage; + DWORD dwDebugInfoFileOffset; + DWORD nDebugInfoSize; + LPVOID lpThreadLocalBase; + LPTHREAD_START_ROUTINE lpStartAddress; + LPVOID lpImageName; + WORD fUnicode; + } CREATE_PROCESS_DEBUG_INFO,*LPCREATE_PROCESS_DEBUG_INFO; + + typedef struct _EXIT_THREAD_DEBUG_INFO { + DWORD dwExitCode; + } EXIT_THREAD_DEBUG_INFO,*LPEXIT_THREAD_DEBUG_INFO; + + typedef struct _EXIT_PROCESS_DEBUG_INFO { + DWORD dwExitCode; + } EXIT_PROCESS_DEBUG_INFO,*LPEXIT_PROCESS_DEBUG_INFO; + + typedef struct _LOAD_DLL_DEBUG_INFO { + HANDLE hFile; + LPVOID lpBaseOfDll; + DWORD dwDebugInfoFileOffset; + DWORD nDebugInfoSize; + LPVOID lpImageName; + WORD fUnicode; + } LOAD_DLL_DEBUG_INFO,*LPLOAD_DLL_DEBUG_INFO; + + typedef struct _UNLOAD_DLL_DEBUG_INFO { + LPVOID lpBaseOfDll; + } UNLOAD_DLL_DEBUG_INFO,*LPUNLOAD_DLL_DEBUG_INFO; + + typedef struct _OUTPUT_DEBUG_STRING_INFO { + LPSTR lpDebugStringData; + WORD fUnicode; + WORD nDebugStringLength; + } OUTPUT_DEBUG_STRING_INFO,*LPOUTPUT_DEBUG_STRING_INFO; + + typedef struct _RIP_INFO { + DWORD dwError; + DWORD dwType; + } RIP_INFO,*LPRIP_INFO; + + typedef struct _DEBUG_EVENT { + DWORD dwDebugEventCode; + DWORD dwProcessId; + DWORD dwThreadId; + union { + EXCEPTION_DEBUG_INFO Exception; + CREATE_THREAD_DEBUG_INFO CreateThread; + CREATE_PROCESS_DEBUG_INFO CreateProcessInfo; + EXIT_THREAD_DEBUG_INFO ExitThread; + EXIT_PROCESS_DEBUG_INFO ExitProcess; + LOAD_DLL_DEBUG_INFO LoadDll; + UNLOAD_DLL_DEBUG_INFO UnloadDll; + OUTPUT_DEBUG_STRING_INFO DebugString; + RIP_INFO RipInfo; + } u; + } DEBUG_EVENT,*LPDEBUG_EVENT; + + typedef PCONTEXT LPCONTEXT; + typedef PEXCEPTION_RECORD LPEXCEPTION_RECORD; + typedef PEXCEPTION_POINTERS LPEXCEPTION_POINTERS; + +#define DRIVE_UNKNOWN 0 +#define DRIVE_NO_ROOT_DIR 1 +#define DRIVE_REMOVABLE 2 +#define DRIVE_FIXED 3 +#define DRIVE_REMOTE 4 +#define DRIVE_CDROM 5 +#define DRIVE_RAMDISK 6 + +#define GetFreeSpace(w) (0x100000L) +#define FILE_TYPE_UNKNOWN 0x0 +#define FILE_TYPE_DISK 0x1 +#define FILE_TYPE_CHAR 0x2 +#define FILE_TYPE_PIPE 0x3 +#define FILE_TYPE_REMOTE 0x8000 + +#define STD_INPUT_HANDLE ((DWORD)-10) +#define STD_OUTPUT_HANDLE ((DWORD)-11) +#define STD_ERROR_HANDLE ((DWORD)-12) + +#define NOPARITY 0 +#define ODDPARITY 1 +#define EVENPARITY 2 +#define MARKPARITY 3 +#define SPACEPARITY 4 + +#define ONESTOPBIT 0 +#define ONE5STOPBITS 1 +#define TWOSTOPBITS 2 + +#define IGNORE 0 +#define INFINITE 0xffffffff + +#define CBR_110 110 +#define CBR_300 300 +#define CBR_600 600 +#define CBR_1200 1200 +#define CBR_2400 2400 +#define CBR_4800 4800 +#define CBR_9600 9600 +#define CBR_14400 14400 +#define CBR_19200 19200 +#define CBR_38400 38400 +#define CBR_56000 56000 +#define CBR_57600 57600 +#define CBR_115200 115200 +#define CBR_128000 128000 +#define CBR_256000 256000 + +#define CE_RXOVER 0x1 +#define CE_OVERRUN 0x2 +#define CE_RXPARITY 0x4 +#define CE_FRAME 0x8 +#define CE_BREAK 0x10 +#define CE_TXFULL 0x100 +#define CE_PTO 0x200 +#define CE_IOE 0x400 +#define CE_DNS 0x800 +#define CE_OOP 0x1000 +#define CE_MODE 0x8000 + +#define IE_BADID (-1) +#define IE_OPEN (-2) +#define IE_NOPEN (-3) +#define IE_MEMORY (-4) +#define IE_DEFAULT (-5) +#define IE_HARDWARE (-10) +#define IE_BYTESIZE (-11) +#define IE_BAUDRATE (-12) + +#define EV_RXCHAR 0x1 +#define EV_RXFLAG 0x2 +#define EV_TXEMPTY 0x4 +#define EV_CTS 0x8 +#define EV_DSR 0x10 +#define EV_RLSD 0x20 +#define EV_BREAK 0x40 +#define EV_ERR 0x80 +#define EV_RING 0x100 +#define EV_PERR 0x200 +#define EV_RX80FULL 0x400 +#define EV_EVENT1 0x800 +#define EV_EVENT2 0x1000 + +#define SETXOFF 1 +#define SETXON 2 +#define SETRTS 3 +#define CLRRTS 4 +#define SETDTR 5 +#define CLRDTR 6 +#define RESETDEV 7 +#define SETBREAK 8 +#define CLRBREAK 9 + +#define PURGE_TXABORT 0x1 +#define PURGE_RXABORT 0x2 +#define PURGE_TXCLEAR 0x4 +#define PURGE_RXCLEAR 0x8 + +#define LPTx 0x80 + +#define MS_CTS_ON ((DWORD)0x10) +#define MS_DSR_ON ((DWORD)0x20) +#define MS_RING_ON ((DWORD)0x40) +#define MS_RLSD_ON ((DWORD)0x80) + +#define S_QUEUEEMPTY 0 +#define S_THRESHOLD 1 +#define S_ALLTHRESHOLD 2 + +#define S_NORMAL 0 +#define S_LEGATO 1 +#define S_STACCATO 2 + +#define S_PERIOD512 0 +#define S_PERIOD1024 1 +#define S_PERIOD2048 2 +#define S_PERIODVOICE 3 +#define S_WHITE512 4 +#define S_WHITE1024 5 +#define S_WHITE2048 6 +#define S_WHITEVOICE 7 + +#define S_SERDVNA (-1) +#define S_SEROFM (-2) +#define S_SERMACT (-3) +#define S_SERQFUL (-4) +#define S_SERBDNT (-5) +#define S_SERDLN (-6) +#define S_SERDCC (-7) +#define S_SERDTP (-8) +#define S_SERDVL (-9) +#define S_SERDMD (-10) +#define S_SERDSH (-11) +#define S_SERDPT (-12) +#define S_SERDFQ (-13) +#define S_SERDDR (-14) +#define S_SERDSR (-15) +#define S_SERDST (-16) + +#define NMPWAIT_WAIT_FOREVER 0xffffffff +#define NMPWAIT_NOWAIT 0x1 +#define NMPWAIT_USE_DEFAULT_WAIT 0x0 + +#define FS_CASE_IS_PRESERVED FILE_CASE_PRESERVED_NAMES +#define FS_CASE_SENSITIVE FILE_CASE_SENSITIVE_SEARCH +#define FS_UNICODE_STORED_ON_DISK FILE_UNICODE_ON_DISK +#define FS_PERSISTENT_ACLS FILE_PERSISTENT_ACLS +#define FS_VOL_IS_COMPRESSED FILE_VOLUME_IS_COMPRESSED +#define FS_FILE_COMPRESSION FILE_FILE_COMPRESSION +#define FS_FILE_ENCRYPTION FILE_SUPPORTS_ENCRYPTION + +#define FILE_MAP_COPY SECTION_QUERY +#define FILE_MAP_WRITE SECTION_MAP_WRITE +#define FILE_MAP_READ SECTION_MAP_READ +#define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS +#define FILE_MAP_EXECUTE SECTION_MAP_EXECUTE_EXPLICIT + +#define OF_READ 0x0 +#define OF_WRITE 0x1 +#define OF_READWRITE 0x2 +#define OF_SHARE_COMPAT 0x0 +#define OF_SHARE_EXCLUSIVE 0x10 +#define OF_SHARE_DENY_WRITE 0x20 +#define OF_SHARE_DENY_READ 0x30 +#define OF_SHARE_DENY_NONE 0x40 +#define OF_PARSE 0x100 +#define OF_DELETE 0x200 +#define OF_VERIFY 0x400 +#define OF_CANCEL 0x800 +#define OF_CREATE 0x1000 +#define OF_PROMPT 0x2000 +#define OF_EXIST 0x4000 +#define OF_REOPEN 0x8000 + +#define OFS_MAXPATHNAME 128 + typedef struct _OFSTRUCT { + BYTE cBytes; + BYTE fFixedDisk; + WORD nErrCode; + WORD Reserved1; + WORD Reserved2; + CHAR szPathName[OFS_MAXPATHNAME]; + } OFSTRUCT,*LPOFSTRUCT,*POFSTRUCT; + +#ifndef NOWINBASEINTERLOCK + +#ifndef _NTOS_ + +#if defined(__ia64__) && !defined(RC_INVOKED) + +#define InterlockedIncrement _InterlockedIncrement +#define InterlockedIncrementAcquire _InterlockedIncrement_acq +#define InterlockedIncrementRelease _InterlockedIncrement_rel +#define InterlockedDecrement _InterlockedDecrement +#define InterlockedDecrementAcquire _InterlockedDecrement_acq +#define InterlockedDecrementRelease _InterlockedDecrement_rel +#define InterlockedExchange _InterlockedExchange +#define InterlockedExchangeAdd _InterlockedExchangeAdd +#define InterlockedCompareExchange _InterlockedCompareExchange +#define InterlockedCompareExchangeAcquire _InterlockedCompareExchange_acq +#define InterlockedCompareExchangeRelease _InterlockedCompareExchange_rel +#define InterlockedExchangePointer _InterlockedExchangePointer +#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer_rel +#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer_acq + +#define InterlockedIncrement64 _InterlockedIncrement64 +#define InterlockedDecrement64 _InterlockedDecrement64 +#define InterlockedExchange64 _InterlockedExchange64 +#define InterlockedExchangeAcquire64 _InterlockedExchange64_acq +#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 +#define InterlockedCompareExchange64 _InterlockedCompareExchange64 +#define InterlockedCompareExchangeAcquire64 _InterlockedCompareExchange64_acq +#define InterlockedCompareExchangeRelease64 _InterlockedCompareExchange64_rel + + LONGLONG __cdecl InterlockedIncrement64(LONGLONG volatile *Addend); + LONGLONG __cdecl InterlockedDecrement64(LONGLONG volatile *Addend); + LONG __cdecl InterlockedIncrementAcquire(LONG volatile *Addend); + LONG __cdecl InterlockedDecrementAcquire(LONG volatile *Addend); + LONG __cdecl InterlockedIncrementRelease(LONG volatile *Addend); + LONG __cdecl InterlockedDecrementRelease(LONG volatile *Addend); + LONGLONG __cdecl InterlockedExchange64 (LONGLONG volatile *Target,LONGLONG Value); + LONGLONG __cdecl InterlockedExchangeAcquire64 (LONGLONG volatile *Target,LONGLONG Value); + LONGLONG __cdecl InterlockedExchangeAdd64 (LONGLONG volatile *Addend,LONGLONG Value); + LONGLONG __cdecl InterlockedCompareExchange64 (LONGLONG volatile *Destination,LONGLONG ExChange,LONGLONG Comperand); + LONGLONG __cdecl InterlockedCompareExchangeAcquire64 (LONGLONG volatile *Destination,LONGLONG ExChange,LONGLONG Comperand); + LONGLONG __cdecl InterlockedCompareExchangeRelease64 (LONGLONG volatile *Destination,LONGLONG ExChange,LONGLONG Comperand); + LONG __cdecl InterlockedIncrement(LONG volatile *lpAddend); + LONG __cdecl InterlockedDecrement(LONG volatile *lpAddend); + LONG __cdecl InterlockedExchange(LONG volatile *Target,LONG Value); + LONG __cdecl InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); + LONG __cdecl InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand); + LONG __cdecl InterlockedCompareExchangeRelease(LONG volatile *Destination,LONG ExChange,LONG Comperand); + LONG __cdecl InterlockedCompareExchangeAcquire(LONG volatile *Destination,LONG ExChange,LONG Comperand); + PVOID __cdecl InterlockedExchangePointer(PVOID volatile *Target,PVOID Value); + PVOID __cdecl InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand); + PVOID __cdecl InterlockedCompareExchangePointerAcquire(PVOID volatile *Destination,PVOID Exchange,PVOID Comperand); + PVOID __cdecl InterlockedCompareExchangePointerRelease(PVOID volatile *Destination,PVOID Exchange,PVOID Comperand); + +#ifndef InterlockedAnd +#define InterlockedAnd InterlockedAnd_Inline + __CRT_INLINE LONG InterlockedAnd_Inline(LONG volatile *Target,LONG Set) { + LONG i; + LONG j; + j = *Target; + do { + i = j; + j = InterlockedCompareExchange(Target,i & Set,i); + } while(i!=j); + return j; + } +#endif + +#ifndef InterlockedOr +#define InterlockedOr InterlockedOr_Inline + + __CRT_INLINE LONG InterlockedOr_Inline(LONG volatile *Target,LONG Set) { + LONG i; + LONG j; + j = *Target; + do { + i = j; + j = InterlockedCompareExchange(Target,i | Set,i); + } while(i!=j); + return j; + } +#endif + +#ifndef InterlockedXor +#define InterlockedXor InterlockedXor_Inline + + __CRT_INLINE LONG InterlockedXor_Inline(LONG volatile *Target,LONG Set) { + LONG i; + LONG j; + j = *Target; + do { + i = j; + j = InterlockedCompareExchange(Target,i ^ Set,i); + } while(i!=j); + return j; + } +#endif + +#ifndef !defined (InterlockedAnd64) +#define InterlockedAnd64 InterlockedAnd64_Inline + + __CRT_INLINE LONGLONG InterlockedAnd64_Inline (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old & Value,Old)!=Old); + return Old; + } +#endif + +#ifndef InterlockedOr64 +#define InterlockedOr64 InterlockedOr64_Inline + + __CRT_INLINE LONGLONG InterlockedOr64_Inline (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old | Value,Old)!=Old); + return Old; + } +#endif + +#ifndef InterlockedXor64 +#define InterlockedXor64 InterlockedXor64_Inline + + __CRT_INLINE LONGLONG InterlockedXor64_Inline (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old ^ Value,Old)!=Old); + return Old; + } +#endif + +#ifndef InterlockedBitTestAndSet +#define InterlockedBitTestAndSet InterlockedBitTestAndSet_Inline + + __CRT_INLINE BOOLEAN InterlockedBitTestAndSet_Inline(LONG *Base,LONG Bit) { + LONG tBit; + tBit = 1<<(Bit & (sizeof (*Base)*8-1)); + return (BOOLEAN)((InterlockedOr(&Base[Bit/(sizeof(*Base)*8)],tBit)&tBit)!=0); + } +#endif + +#ifndef InterlockedBitTestAndReset +#define InterlockedBitTestAndReset InterlockedBitTestAndReset_Inline + + __CRT_INLINE BOOLEAN InterlockedBitTestAndReset_Inline(LONG *Base,LONG Bit) { + LONG tBit; + tBit = 1<<(Bit & (sizeof (*Base)*8-1)); + return (BOOLEAN)((InterlockedAnd(&Base[Bit/(sizeof(*Base)*8)],~tBit)&tBit)!=0); + } +#endif + +#ifndef InterlockedBitTestAndComplement +#define InterlockedBitTestAndComplement InterlockedBitTestAndComplement_Inline + + __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement_Inline(LONG *Base,LONG Bit) { + LONG tBit; + tBit = 1<<(Bit & (sizeof (*Base)*8-1)); + return (BOOLEAN)((InterlockedXor(&Base[Bit/(sizeof(*Base)*8)],tBit)&tBit)!=0); + } +#endif +#elif defined(__x86_64) && !defined(RC_INVOKED) + +#define InterlockedIncrement _InterlockedIncrement +#define InterlockedIncrementAcquire InterlockedIncrement +#define InterlockedIncrementRelease InterlockedIncrement +#define InterlockedDecrement _InterlockedDecrement +#define InterlockedDecrementAcquire InterlockedDecrement +#define InterlockedDecrementRelease InterlockedDecrement +#define InterlockedExchange _InterlockedExchange +#define InterlockedExchangeAdd _InterlockedExchangeAdd +#define InterlockedCompareExchange _InterlockedCompareExchange +#define InterlockedCompareExchangeAcquire InterlockedCompareExchange +#define InterlockedCompareExchangeRelease InterlockedCompareExchange +#define InterlockedExchangePointer _InterlockedExchangePointer +#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer +#define InterlockedAnd64 _InterlockedAnd64 +#define InterlockedOr64 _InterlockedOr64 +#define InterlockedXor64 _InterlockedXor64 +#define InterlockedIncrement64 _InterlockedIncrement64 +#define InterlockedDecrement64 _InterlockedDecrement64 +#define InterlockedExchange64 _InterlockedExchange64 +#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 +#define InterlockedCompareExchange64 _InterlockedCompareExchange64 +#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 +#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 + + LONG InterlockedIncrement(LONG volatile *Addend); + LONG InterlockedDecrement(LONG volatile *Addend); + LONG InterlockedExchange(LONG volatile *Target,LONG Value); + LONG InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); + LONG InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand); + PVOID InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID Exchange,PVOID Comperand); + PVOID InterlockedExchangePointer(PVOID volatile *Target,PVOID Value); + LONG64 InterlockedAnd64(LONG64 volatile *Destination,LONG64 Value); + LONG64 InterlockedOr64(LONG64 volatile *Destination,LONG64 Value); + LONG64 InterlockedXor64(LONG64 volatile *Destination,LONG64 Value); + LONG64 InterlockedIncrement64(LONG64 volatile *Addend); + LONG64 InterlockedDecrement64(LONG64 volatile *Addend); + LONG64 InterlockedExchange64(LONG64 volatile *Target,LONG64 Value); + LONG64 InterlockedExchangeAdd64(LONG64 volatile *Addend,LONG64 Value); + LONG64 InterlockedCompareExchange64(LONG64 volatile *Destination,LONG64 ExChange,LONG64 Comperand); +#else + LONG WINAPI InterlockedIncrement(LONG volatile *lpAddend); + LONG WINAPI InterlockedDecrement(LONG volatile *lpAddend); + LONG WINAPI InterlockedExchange(LONG volatile *Target,LONG Value); + +#define InterlockedExchangePointer(Target,Value) (PVOID)InterlockedExchange((PLONG)(Target),(LONG)(Value)) + + LONG WINAPI InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); + LONG WINAPI InterlockedCompareExchange(LONG volatile *Destination,LONG Exchange,LONG Comperand); + LONGLONG WINAPI InterlockedCompareExchange64(LONGLONG volatile *Destination,LONGLONG Exchange,LONGLONG Comperand); + + __CRT_INLINE LONGLONG InterlockedAnd64 (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old & Value,Old)!=Old); + return Old; + } + + __CRT_INLINE LONGLONG InterlockedOr64 (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old | Value,Old)!=Old); + return Old; + } + + __CRT_INLINE LONGLONG InterlockedXor64 (LONGLONG volatile *Destination,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Destination; + } while(InterlockedCompareExchange64(Destination,Old ^ Value,Old)!=Old); + + return Old; + } + + __CRT_INLINE LONGLONG InterlockedIncrement64(LONGLONG volatile *Addend) { + LONGLONG Old; + do { + Old = *Addend; + } while(InterlockedCompareExchange64(Addend,Old + 1,Old)!=Old); + return Old + 1; + } + + __CRT_INLINE LONGLONG InterlockedDecrement64(LONGLONG volatile *Addend) { + LONGLONG Old; + do { + Old = *Addend; + } while(InterlockedCompareExchange64(Addend,Old - 1,Old)!=Old); + return Old - 1; + } + + __CRT_INLINE LONGLONG InterlockedExchange64(LONGLONG volatile *Target,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Target; + } while(InterlockedCompareExchange64(Target,Value,Old)!=Old); + return Old; + } + + __CRT_INLINE LONGLONG InterlockedExchangeAdd64(LONGLONG volatile *Addend,LONGLONG Value) { + LONGLONG Old; + do { + Old = *Addend; + } while(InterlockedCompareExchange64(Addend,Old + Value,Old)!=Old); + return Old; + } + +#ifdef __cplusplus + __CRT_INLINE PVOID __cdecl __InlineInterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand) { + return((PVOID)(LONG_PTR)InterlockedCompareExchange((LONG volatile *)Destination,(LONG)(LONG_PTR)ExChange,(LONG)(LONG_PTR)Comperand)); + } +#define InterlockedCompareExchangePointer __InlineInterlockedCompareExchangePointer +#else +#define InterlockedCompareExchangePointer(Destination,ExChange,Comperand)(PVOID)(LONG_PTR)InterlockedCompareExchange((LONG volatile *)(Destination),(LONG)(LONG_PTR)(ExChange),(LONG)(LONG_PTR)(Comperand)) +#endif + +#define InterlockedIncrementAcquire InterlockedIncrement +#define InterlockedIncrementRelease InterlockedIncrement +#define InterlockedDecrementAcquire InterlockedDecrement +#define InterlockedDecrementRelease InterlockedDecrement +#define InterlockedIncrementAcquire InterlockedIncrement +#define InterlockedIncrementRelease InterlockedIncrement +#define InterlockedCompareExchangeAcquire InterlockedCompareExchange +#define InterlockedCompareExchangeRelease InterlockedCompareExchange +#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 +#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 +#define InterlockedCompareExchangePointerAcquire InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerRelease InterlockedCompareExchangePointer +#endif + +#if defined(_SLIST_HEADER_) && !defined(_NTOSP_) + WINBASEAPI VOID WINAPI InitializeSListHead(PSLIST_HEADER ListHead); + WINBASEAPI PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead); + WINBASEAPI PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER ListHead,PSLIST_ENTRY ListEntry); + WINBASEAPI PSLIST_ENTRY WINAPI InterlockedFlushSList(PSLIST_HEADER ListHead); + WINBASEAPI USHORT WINAPI QueryDepthSList(PSLIST_HEADER ListHead); +#endif +#endif +#endif + + WINBASEAPI WINBOOL WINAPI FreeResource(HGLOBAL hResData); + WINBASEAPI LPVOID WINAPI LockResource(HGLOBAL hResData); + +#define UnlockResource(hResData) ((hResData),0) +#define MAXINTATOM 0xC000 +#define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i))) +#define INVALID_ATOM ((ATOM)0) + + int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd); + WINBASEAPI WINBOOL WINAPI FreeLibrary(HMODULE hLibModule); + WINBASEAPI DECLSPEC_NORETURN VOID WINAPI FreeLibraryAndExitThread(HMODULE hLibModule,DWORD dwExitCode); + WINBASEAPI WINBOOL WINAPI DisableThreadLibraryCalls(HMODULE hLibModule); + WINBASEAPI FARPROC WINAPI GetProcAddress(HMODULE hModule,LPCSTR lpProcName); + WINBASEAPI DWORD WINAPI GetVersion(VOID); + WINBASEAPI HGLOBAL WINAPI GlobalAlloc(UINT uFlags,SIZE_T dwBytes); + WINBASEAPI HGLOBAL WINAPI GlobalReAlloc(HGLOBAL hMem,SIZE_T dwBytes,UINT uFlags); + WINBASEAPI SIZE_T WINAPI GlobalSize(HGLOBAL hMem); + WINBASEAPI UINT WINAPI GlobalFlags(HGLOBAL hMem); + WINBASEAPI LPVOID WINAPI GlobalLock(HGLOBAL hMem); + WINBASEAPI HGLOBAL WINAPI GlobalHandle(LPCVOID pMem); + WINBASEAPI WINBOOL WINAPI GlobalUnlock(HGLOBAL hMem); + WINBASEAPI HGLOBAL WINAPI GlobalFree(HGLOBAL hMem); + WINBASEAPI SIZE_T WINAPI GlobalCompact(DWORD dwMinFree); + WINBASEAPI VOID WINAPI GlobalFix(HGLOBAL hMem); + WINBASEAPI VOID WINAPI GlobalUnfix(HGLOBAL hMem); + WINBASEAPI LPVOID WINAPI GlobalWire(HGLOBAL hMem); + WINBASEAPI WINBOOL WINAPI GlobalUnWire(HGLOBAL hMem); + WINBASEAPI VOID WINAPI GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer); + + typedef struct _MEMORYSTATUSEX { + DWORD dwLength; + DWORD dwMemoryLoad; + DWORDLONG ullTotalPhys; + DWORDLONG ullAvailPhys; + DWORDLONG ullTotalPageFile; + DWORDLONG ullAvailPageFile; + DWORDLONG ullTotalVirtual; + DWORDLONG ullAvailVirtual; + DWORDLONG ullAvailExtendedVirtual; + } MEMORYSTATUSEX,*LPMEMORYSTATUSEX; + + WINBASEAPI WINBOOL WINAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer); + WINBASEAPI HLOCAL WINAPI LocalAlloc(UINT uFlags,SIZE_T uBytes); + WINBASEAPI HLOCAL WINAPI LocalReAlloc(HLOCAL hMem,SIZE_T uBytes,UINT uFlags); + WINBASEAPI LPVOID WINAPI LocalLock(HLOCAL hMem); + WINBASEAPI HLOCAL WINAPI LocalHandle(LPCVOID pMem); + WINBASEAPI WINBOOL WINAPI LocalUnlock(HLOCAL hMem); + WINBASEAPI SIZE_T WINAPI LocalSize(HLOCAL hMem); + WINBASEAPI UINT WINAPI LocalFlags(HLOCAL hMem); + WINBASEAPI HLOCAL WINAPI LocalFree(HLOCAL hMem); + WINBASEAPI SIZE_T WINAPI LocalShrink(HLOCAL hMem,UINT cbNewSize); + WINBASEAPI SIZE_T WINAPI LocalCompact(UINT uMinFree); + WINBASEAPI WINBOOL WINAPI FlushInstructionCache(HANDLE hProcess,LPCVOID lpBaseAddress,SIZE_T dwSize); + WINBASEAPI LPVOID WINAPI VirtualAlloc(LPVOID lpAddress,SIZE_T dwSize,DWORD flAllocationType,DWORD flProtect); + WINBASEAPI WINBOOL WINAPI VirtualFree(LPVOID lpAddress,SIZE_T dwSize,DWORD dwFreeType); + WINBASEAPI WINBOOL WINAPI VirtualProtect(LPVOID lpAddress,SIZE_T dwSize,DWORD flNewProtect,PDWORD lpflOldProtect); + WINBASEAPI SIZE_T WINAPI VirtualQuery(LPCVOID lpAddress,PMEMORY_BASIC_INFORMATION lpBuffer,SIZE_T dwLength); + WINBASEAPI LPVOID WINAPI VirtualAllocEx(HANDLE hProcess,LPVOID lpAddress,SIZE_T dwSize,DWORD flAllocationType,DWORD flProtect); + WINBASEAPI UINT WINAPI GetWriteWatch(DWORD dwFlags,PVOID lpBaseAddress,SIZE_T dwRegionSize,PVOID *lpAddresses,ULONG_PTR *lpdwCount,PULONG lpdwGranularity); + WINBASEAPI UINT WINAPI ResetWriteWatch(LPVOID lpBaseAddress,SIZE_T dwRegionSize); + WINBASEAPI SIZE_T WINAPI GetLargePageMinimum(VOID); + WINBASEAPI UINT WINAPI EnumSystemFirmwareTables(DWORD FirmwareTableProviderSignature,PVOID pFirmwareTableEnumBuffer,DWORD BufferSize); + WINBASEAPI UINT WINAPI GetSystemFirmwareTable(DWORD FirmwareTableProviderSignature,DWORD FirmwareTableID,PVOID pFirmwareTableBuffer,DWORD BufferSize); + WINBASEAPI WINBOOL WINAPI VirtualFreeEx(HANDLE hProcess,LPVOID lpAddress,SIZE_T dwSize,DWORD dwFreeType); + WINBASEAPI WINBOOL WINAPI VirtualProtectEx(HANDLE hProcess,LPVOID lpAddress,SIZE_T dwSize,DWORD flNewProtect,PDWORD lpflOldProtect); + WINBASEAPI SIZE_T WINAPI VirtualQueryEx(HANDLE hProcess,LPCVOID lpAddress,PMEMORY_BASIC_INFORMATION lpBuffer,SIZE_T dwLength); + WINBASEAPI HANDLE WINAPI HeapCreate(DWORD flOptions,SIZE_T dwInitialSize,SIZE_T dwMaximumSize); + WINBASEAPI WINBOOL WINAPI HeapDestroy(HANDLE hHeap); + WINBASEAPI LPVOID WINAPI HeapAlloc(HANDLE hHeap,DWORD dwFlags,SIZE_T dwBytes); + WINBASEAPI LPVOID WINAPI HeapReAlloc(HANDLE hHeap,DWORD dwFlags,LPVOID lpMem,SIZE_T dwBytes); + WINBASEAPI WINBOOL WINAPI HeapFree(HANDLE hHeap,DWORD dwFlags,LPVOID lpMem); + WINBASEAPI SIZE_T WINAPI HeapSize(HANDLE hHeap,DWORD dwFlags,LPCVOID lpMem); + WINBASEAPI WINBOOL WINAPI HeapValidate(HANDLE hHeap,DWORD dwFlags,LPCVOID lpMem); + WINBASEAPI SIZE_T WINAPI HeapCompact(HANDLE hHeap,DWORD dwFlags); + WINBASEAPI HANDLE WINAPI GetProcessHeap(VOID); + WINBASEAPI DWORD WINAPI GetProcessHeaps(DWORD NumberOfHeaps,PHANDLE ProcessHeaps); + + typedef struct _PROCESS_HEAP_ENTRY { + PVOID lpData; + DWORD cbData; + BYTE cbOverhead; + BYTE iRegionIndex; + WORD wFlags; + union { + struct { + HANDLE hMem; + DWORD dwReserved[3]; + } Block; + struct { + DWORD dwCommittedSize; + DWORD dwUnCommittedSize; + LPVOID lpFirstBlock; + LPVOID lpLastBlock; + } Region; + }; + } PROCESS_HEAP_ENTRY,*LPPROCESS_HEAP_ENTRY,*PPROCESS_HEAP_ENTRY; + +#define PROCESS_HEAP_REGION 0x1 +#define PROCESS_HEAP_UNCOMMITTED_RANGE 0x2 +#define PROCESS_HEAP_ENTRY_BUSY 0x4 +#define PROCESS_HEAP_ENTRY_MOVEABLE 0x10 +#define PROCESS_HEAP_ENTRY_DDESHARE 0x20 + + WINBASEAPI WINBOOL WINAPI HeapLock(HANDLE hHeap); + WINBASEAPI WINBOOL WINAPI HeapUnlock(HANDLE hHeap); + WINBASEAPI WINBOOL WINAPI HeapWalk(HANDLE hHeap,LPPROCESS_HEAP_ENTRY lpEntry); + WINBASEAPI WINBOOL WINAPI HeapSetInformation(HANDLE HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength); + WINBASEAPI WINBOOL WINAPI HeapQueryInformation(HANDLE HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength); + +#define SCS_32BIT_BINARY 0 +#define SCS_DOS_BINARY 1 +#define SCS_WOW_BINARY 2 +#define SCS_PIF_BINARY 3 +#define SCS_POSIX_BINARY 4 +#define SCS_OS216_BINARY 5 +#define SCS_64BIT_BINARY 6 + +#ifdef UNICODE +#define GetBinaryType GetBinaryTypeW +#define GetShortPathName GetShortPathNameW +#define GetLongPathName GetLongPathNameW +#define GetEnvironmentStrings GetEnvironmentStringsW +#define SetEnvironmentStrings SetEnvironmentStringsW +#define FreeEnvironmentStrings FreeEnvironmentStringsW +#else +#define GetBinaryType GetBinaryTypeA +#define GetShortPathName GetShortPathNameA +#define GetLongPathName GetLongPathNameA +#define GetEnvironmentStringsA GetEnvironmentStrings +#define SetEnvironmentStrings SetEnvironmentStringsA +#define FreeEnvironmentStrings FreeEnvironmentStringsA +#endif + +#ifdef _WIN64 +#define SCS_THIS_PLATFORM_BINARY SCS_64BIT_BINARY +#else +#define SCS_THIS_PLATFORM_BINARY SCS_32BIT_BINARY +#endif + + WINBASEAPI WINBOOL WINAPI GetBinaryTypeA(LPCSTR lpApplicationName,LPDWORD lpBinaryType); + WINBASEAPI WINBOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName,LPDWORD lpBinaryType); + WINBASEAPI DWORD WINAPI GetShortPathNameA(LPCSTR lpszLongPath,LPSTR lpszShortPath,DWORD cchBuffer); + WINBASEAPI DWORD WINAPI GetShortPathNameW(LPCWSTR lpszLongPath,LPWSTR lpszShortPath,DWORD cchBuffer); + WINBASEAPI DWORD WINAPI GetLongPathNameA(LPCSTR lpszShortPath,LPSTR lpszLongPath,DWORD cchBuffer); + WINBASEAPI DWORD WINAPI GetLongPathNameW(LPCWSTR lpszShortPath,LPWSTR lpszLongPath,DWORD cchBuffer); + WINBASEAPI WINBOOL WINAPI GetProcessAffinityMask(HANDLE hProcess,PDWORD_PTR lpProcessAffinityMask,PDWORD_PTR lpSystemAffinityMask); + WINBASEAPI WINBOOL WINAPI SetProcessAffinityMask(HANDLE hProcess,DWORD_PTR dwProcessAffinityMask); + WINBASEAPI WINBOOL WINAPI GetProcessHandleCount(HANDLE hProcess,PDWORD pdwHandleCount); + WINBASEAPI WINBOOL WINAPI GetProcessTimes(HANDLE hProcess,LPFILETIME lpCreationTime,LPFILETIME lpExitTime,LPFILETIME lpKernelTime,LPFILETIME lpUserTime); + WINBASEAPI WINBOOL WINAPI GetProcessIoCounters(HANDLE hProcess,PIO_COUNTERS lpIoCounters); + WINBASEAPI WINBOOL WINAPI GetProcessWorkingSetSize(HANDLE hProcess,PSIZE_T lpMinimumWorkingSetSize,PSIZE_T lpMaximumWorkingSetSize); + WINBASEAPI WINBOOL WINAPI GetProcessWorkingSetSizeEx(HANDLE hProcess,PSIZE_T lpMinimumWorkingSetSize,PSIZE_T lpMaximumWorkingSetSize,PDWORD Flags); + WINBASEAPI WINBOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess,SIZE_T dwMinimumWorkingSetSize,SIZE_T dwMaximumWorkingSetSize); + WINBASEAPI WINBOOL WINAPI SetProcessWorkingSetSizeEx(HANDLE hProcess,SIZE_T dwMinimumWorkingSetSize,SIZE_T dwMaximumWorkingSetSize,DWORD Flags); + WINBASEAPI HANDLE WINAPI OpenProcess(DWORD dwDesiredAccess,WINBOOL bInheritHandle,DWORD dwProcessId); + WINBASEAPI HANDLE WINAPI GetCurrentProcess(VOID); + WINBASEAPI DWORD WINAPI GetCurrentProcessId(VOID); + WINBASEAPI DECLSPEC_NORETURN VOID WINAPI ExitProcess(UINT uExitCode); + WINBASEAPI WINBOOL WINAPI TerminateProcess(HANDLE hProcess,UINT uExitCode); + WINBASEAPI WINBOOL WINAPI GetExitCodeProcess(HANDLE hProcess,LPDWORD lpExitCode); + WINBASEAPI VOID WINAPI FatalExit(int ExitCode); + /* WINBASEAPI LPCH WINAPI GetEnvironmentStrings(VOID); */ + WINBASEAPI LPWCH WINAPI GetEnvironmentStringsW(VOID); + WINBASEAPI WINBOOL WINAPI SetEnvironmentStringsA(LPCH NewEnvironment); + WINBASEAPI WINBOOL WINAPI SetEnvironmentStringsW(LPWCH NewEnvironment); + WINBASEAPI WINBOOL WINAPI FreeEnvironmentStringsA(LPCH); + WINBASEAPI WINBOOL WINAPI FreeEnvironmentStringsW(LPWCH); + WINBASEAPI VOID WINAPI RaiseException(DWORD dwExceptionCode,DWORD dwExceptionFlags,DWORD nNumberOfArguments,CONST ULONG_PTR *lpArguments); + WINBASEAPI LONG WINAPI UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo); + + typedef LONG (WINAPI *PTOP_LEVEL_EXCEPTION_FILTER)(struct _EXCEPTION_POINTERS *ExceptionInfo); + typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; + + WINBASEAPI LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter); + +#define FIBER_FLAG_FLOAT_SWITCH 0x1 + + WINBASEAPI LPVOID WINAPI CreateFiber(SIZE_T dwStackSize,LPFIBER_START_ROUTINE lpStartAddress,LPVOID lpParameter); + WINBASEAPI LPVOID WINAPI CreateFiberEx(SIZE_T dwStackCommitSize,SIZE_T dwStackReserveSize,DWORD dwFlags,LPFIBER_START_ROUTINE lpStartAddress,LPVOID lpParameter); + WINBASEAPI VOID WINAPI DeleteFiber(LPVOID lpFiber); + WINBASEAPI LPVOID WINAPI ConvertThreadToFiber(LPVOID lpParameter); + WINBASEAPI LPVOID WINAPI ConvertThreadToFiberEx(LPVOID lpParameter,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI ConvertFiberToThread(VOID); + WINBASEAPI VOID WINAPI SwitchToFiber(LPVOID lpFiber); + WINBASEAPI WINBOOL WINAPI SwitchToThread(VOID); + WINBASEAPI HANDLE WINAPI CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes,SIZE_T dwStackSize,LPTHREAD_START_ROUTINE lpStartAddress,LPVOID lpParameter,DWORD dwCreationFlags,LPDWORD lpThreadId); + WINBASEAPI HANDLE WINAPI CreateRemoteThread(HANDLE hProcess,LPSECURITY_ATTRIBUTES lpThreadAttributes,SIZE_T dwStackSize,LPTHREAD_START_ROUTINE lpStartAddress,LPVOID lpParameter,DWORD dwCreationFlags,LPDWORD lpThreadId); + WINBASEAPI HANDLE WINAPI GetCurrentThread(VOID); + WINBASEAPI DWORD WINAPI GetCurrentThreadId(VOID); + WINBASEAPI WINBOOL WINAPI SetThreadStackGuarantee (PULONG StackSizeInBytes); + WINBASEAPI DWORD WINAPI GetProcessIdOfThread(HANDLE Thread); + WINBASEAPI DWORD WINAPI GetThreadId(HANDLE Thread); + WINBASEAPI DWORD WINAPI GetProcessId(HANDLE Process); + WINBASEAPI DWORD WINAPI GetCurrentProcessorNumber(VOID); + WINBASEAPI DWORD_PTR WINAPI SetThreadAffinityMask(HANDLE hThread,DWORD_PTR dwThreadAffinityMask); + WINBASEAPI DWORD WINAPI SetThreadIdealProcessor(HANDLE hThread,DWORD dwIdealProcessor); + WINBASEAPI WINBOOL WINAPI SetProcessPriorityBoost(HANDLE hProcess,WINBOOL bDisablePriorityBoost); + WINBASEAPI WINBOOL WINAPI GetProcessPriorityBoost(HANDLE hProcess,PBOOL pDisablePriorityBoost); + WINBASEAPI WINBOOL WINAPI RequestWakeupLatency(LATENCY_TIME latency); + WINBASEAPI WINBOOL WINAPI IsSystemResumeAutomatic(VOID); + WINBASEAPI HANDLE WINAPI OpenThread(DWORD dwDesiredAccess,WINBOOL bInheritHandle,DWORD dwThreadId); + WINBASEAPI WINBOOL WINAPI SetThreadPriority(HANDLE hThread,int nPriority); + WINBASEAPI WINBOOL WINAPI SetThreadPriorityBoost(HANDLE hThread,WINBOOL bDisablePriorityBoost); + WINBASEAPI WINBOOL WINAPI GetThreadPriorityBoost(HANDLE hThread,PBOOL pDisablePriorityBoost); + WINBASEAPI int WINAPI GetThreadPriority(HANDLE hThread); + WINBASEAPI WINBOOL WINAPI GetThreadTimes(HANDLE hThread,LPFILETIME lpCreationTime,LPFILETIME lpExitTime,LPFILETIME lpKernelTime,LPFILETIME lpUserTime); + WINBASEAPI WINBOOL WINAPI GetThreadIOPendingFlag(HANDLE hThread,PBOOL lpIOIsPending); + WINBASEAPI DECLSPEC_NORETURN VOID WINAPI ExitThread(DWORD dwExitCode); + WINBASEAPI WINBOOL WINAPI TerminateThread(HANDLE hThread,DWORD dwExitCode); + WINBASEAPI WINBOOL WINAPI GetExitCodeThread(HANDLE hThread,LPDWORD lpExitCode); + WINBASEAPI WINBOOL WINAPI GetThreadSelectorEntry(HANDLE hThread,DWORD dwSelector,LPLDT_ENTRY lpSelectorEntry); + WINBASEAPI EXECUTION_STATE WINAPI SetThreadExecutionState(EXECUTION_STATE esFlags); + WINBASEAPI DWORD WINAPI GetLastError(VOID); + WINBASEAPI VOID WINAPI SetLastError(DWORD dwErrCode); + +#ifndef RC_INVOKED +#ifdef WINBASE_DECLARE_RESTORE_LAST_ERROR + WINBASEAPI VOID WINAPI RestoreLastError(DWORD dwErrCode); + + typedef VOID (WINAPI *PRESTORE_LAST_ERROR)(DWORD); + +#define RESTORE_LAST_ERROR_NAME_A "RestoreLastError" +#define RESTORE_LAST_ERROR_NAME_W L"RestoreLastError" +#define RESTORE_LAST_ERROR_NAME TEXT("RestoreLastError") +#endif +#endif + +#define HasOverlappedIoCompleted(lpOverlapped) (((DWORD)(lpOverlapped)->Internal)!=STATUS_PENDING) + + WINBASEAPI WINBOOL WINAPI GetOverlappedResult(HANDLE hFile,LPOVERLAPPED lpOverlapped,LPDWORD lpNumberOfBytesTransferred,WINBOOL bWait); + WINBASEAPI HANDLE WINAPI CreateIoCompletionPort(HANDLE FileHandle,HANDLE ExistingCompletionPort,ULONG_PTR CompletionKey,DWORD NumberOfConcurrentThreads); + WINBASEAPI WINBOOL WINAPI GetQueuedCompletionStatus(HANDLE CompletionPort,LPDWORD lpNumberOfBytesTransferred,PULONG_PTR lpCompletionKey,LPOVERLAPPED *lpOverlapped,DWORD dwMilliseconds); + WINBASEAPI WINBOOL WINAPI PostQueuedCompletionStatus(HANDLE CompletionPort,DWORD dwNumberOfBytesTransferred,ULONG_PTR dwCompletionKey,LPOVERLAPPED lpOverlapped); + +#define SEM_FAILCRITICALERRORS 0x1 +#define SEM_NOGPFAULTERRORBOX 0x2 +#define SEM_NOALIGNMENTFAULTEXCEPT 0x4 +#define SEM_NOOPENFILEERRORBOX 0x8000 + + WINBASEAPI UINT WINAPI SetErrorMode(UINT uMode); + WINBASEAPI WINBOOL WINAPI ReadProcessMemory(HANDLE hProcess,LPCVOID lpBaseAddress,LPVOID lpBuffer,SIZE_T nSize,SIZE_T *lpNumberOfBytesRead); + WINBASEAPI WINBOOL WINAPI WriteProcessMemory(HANDLE hProcess,LPVOID lpBaseAddress,LPCVOID lpBuffer,SIZE_T nSize,SIZE_T *lpNumberOfBytesWritten); + WINBASEAPI WINBOOL WINAPI GetThreadContext(HANDLE hThread,LPCONTEXT lpContext); + WINBASEAPI WINBOOL WINAPI SetThreadContext(HANDLE hThread,CONST CONTEXT *lpContext); + WINBASEAPI DWORD WINAPI SuspendThread(HANDLE hThread); + WINBASEAPI DWORD WINAPI ResumeThread(HANDLE hThread); + + typedef VOID (WINAPI *PAPCFUNC)(ULONG_PTR dwParam); + + WINBASEAPI DWORD WINAPI QueueUserAPC(PAPCFUNC pfnAPC,HANDLE hThread,ULONG_PTR dwData); + WINBASEAPI WINBOOL WINAPI IsDebuggerPresent(VOID); + WINBASEAPI WINBOOL WINAPI CheckRemoteDebuggerPresent(HANDLE hProcess,PBOOL pbDebuggerPresent); + WINBASEAPI VOID WINAPI DebugBreak(VOID); + WINBASEAPI WINBOOL WINAPI WaitForDebugEvent(LPDEBUG_EVENT lpDebugEvent,DWORD dwMilliseconds); + WINBASEAPI WINBOOL WINAPI ContinueDebugEvent(DWORD dwProcessId,DWORD dwThreadId,DWORD dwContinueStatus); + WINBASEAPI WINBOOL WINAPI DebugActiveProcess(DWORD dwProcessId); + WINBASEAPI WINBOOL WINAPI DebugActiveProcessStop(DWORD dwProcessId); + WINBASEAPI WINBOOL WINAPI DebugSetProcessKillOnExit(WINBOOL KillOnExit); + WINBASEAPI WINBOOL WINAPI DebugBreakProcess(HANDLE Process); + WINBASEAPI VOID WINAPI InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI VOID WINAPI EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI VOID WINAPI LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI WINBOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION lpCriticalSection,DWORD dwSpinCount); + WINBASEAPI DWORD WINAPI SetCriticalSectionSpinCount(LPCRITICAL_SECTION lpCriticalSection,DWORD dwSpinCount); + WINBASEAPI WINBOOL WINAPI TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI VOID WINAPI DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection); + WINBASEAPI WINBOOL WINAPI SetEvent(HANDLE hEvent); + WINBASEAPI WINBOOL WINAPI ResetEvent(HANDLE hEvent); + WINBASEAPI WINBOOL WINAPI PulseEvent(HANDLE hEvent); + WINBASEAPI WINBOOL WINAPI ReleaseSemaphore(HANDLE hSemaphore,LONG lReleaseCount,LPLONG lpPreviousCount); + WINBASEAPI WINBOOL WINAPI ReleaseMutex(HANDLE hMutex); + WINBASEAPI DWORD WINAPI WaitForSingleObject(HANDLE hHandle,DWORD dwMilliseconds); + WINBASEAPI DWORD WINAPI WaitForMultipleObjects(DWORD nCount,CONST HANDLE *lpHandles,WINBOOL bWaitAll,DWORD dwMilliseconds); + WINBASEAPI VOID WINAPI Sleep(DWORD dwMilliseconds); + WINBASEAPI HGLOBAL WINAPI LoadResource(HMODULE hModule,HRSRC hResInfo); + WINBASEAPI DWORD WINAPI SizeofResource(HMODULE hModule,HRSRC hResInfo); + WINBASEAPI ATOM WINAPI GlobalDeleteAtom(ATOM nAtom); + WINBASEAPI WINBOOL WINAPI InitAtomTable(DWORD nSize); + WINBASEAPI ATOM WINAPI DeleteAtom(ATOM nAtom); + WINBASEAPI UINT WINAPI SetHandleCount(UINT uNumber); + WINBASEAPI DWORD WINAPI GetLogicalDrives(VOID); + WINBASEAPI WINBOOL WINAPI LockFile(HANDLE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,DWORD nNumberOfBytesToLockLow,DWORD nNumberOfBytesToLockHigh); + WINBASEAPI WINBOOL WINAPI UnlockFile(HANDLE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh); + WINBASEAPI WINBOOL WINAPI LockFileEx(HANDLE hFile,DWORD dwFlags,DWORD dwReserved,DWORD nNumberOfBytesToLockLow,DWORD nNumberOfBytesToLockHigh,LPOVERLAPPED lpOverlapped); + +#define LOCKFILE_FAIL_IMMEDIATELY 0x1 +#define LOCKFILE_EXCLUSIVE_LOCK 0x2 + + WINBASEAPI WINBOOL WINAPI UnlockFileEx(HANDLE hFile,DWORD dwReserved,DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh,LPOVERLAPPED lpOverlapped); + + typedef struct _BY_HANDLE_FILE_INFORMATION { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD dwVolumeSerialNumber; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD nNumberOfLinks; + DWORD nFileIndexHigh; + DWORD nFileIndexLow; + } BY_HANDLE_FILE_INFORMATION,*PBY_HANDLE_FILE_INFORMATION,*LPBY_HANDLE_FILE_INFORMATION; + +#ifdef UNICODE +#define SetFileShortName SetFileShortNameW +#else +#define SetFileShortName SetFileShortNameA +#endif + + WINBASEAPI WINBOOL WINAPI GetFileInformationByHandle(HANDLE hFile,LPBY_HANDLE_FILE_INFORMATION lpFileInformation); + WINBASEAPI DWORD WINAPI GetFileType(HANDLE hFile); + WINBASEAPI DWORD WINAPI GetFileSize(HANDLE hFile,LPDWORD lpFileSizeHigh); + WINBASEAPI WINBOOL WINAPI GetFileSizeEx(HANDLE hFile,PLARGE_INTEGER lpFileSize); + WINBASEAPI HANDLE WINAPI GetStdHandle(DWORD nStdHandle); + WINBASEAPI WINBOOL WINAPI SetStdHandle(DWORD nStdHandle,HANDLE hHandle); + WINBASEAPI WINBOOL WINAPI WriteFile(HANDLE hFile,LPCVOID lpBuffer,DWORD nNumberOfBytesToWrite,LPDWORD lpNumberOfBytesWritten,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI ReadFile(HANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI FlushFileBuffers(HANDLE hFile); + WINBASEAPI WINBOOL WINAPI DeviceIoControl(HANDLE hDevice,DWORD dwIoControlCode,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesReturned,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI RequestDeviceWakeup(HANDLE hDevice); + WINBASEAPI WINBOOL WINAPI CancelDeviceWakeupRequest(HANDLE hDevice); + WINBASEAPI WINBOOL WINAPI GetDevicePowerState(HANDLE hDevice,WINBOOL *pfOn); + WINBASEAPI WINBOOL WINAPI SetMessageWaitingIndicator(HANDLE hMsgIndicator,ULONG ulMsgCount); + WINBASEAPI WINBOOL WINAPI SetEndOfFile(HANDLE hFile); + WINBASEAPI DWORD WINAPI SetFilePointer(HANDLE hFile,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); + WINBASEAPI WINBOOL WINAPI SetFilePointerEx(HANDLE hFile,LARGE_INTEGER liDistanceToMove,PLARGE_INTEGER lpNewFilePointer,DWORD dwMoveMethod); + WINBASEAPI WINBOOL WINAPI FindClose(HANDLE hFindFile); + WINBASEAPI WINBOOL WINAPI GetFileTime(HANDLE hFile,LPFILETIME lpCreationTime,LPFILETIME lpLastAccessTime,LPFILETIME lpLastWriteTime); + WINBASEAPI WINBOOL WINAPI SetFileTime(HANDLE hFile,CONST FILETIME *lpCreationTime,CONST FILETIME *lpLastAccessTime,CONST FILETIME *lpLastWriteTime); + WINBASEAPI WINBOOL WINAPI SetFileValidData(HANDLE hFile,LONGLONG ValidDataLength); + WINBASEAPI WINBOOL WINAPI SetFileShortNameA(HANDLE hFile,LPCSTR lpShortName); + WINBASEAPI WINBOOL WINAPI SetFileShortNameW(HANDLE hFile,LPCWSTR lpShortName); + WINBASEAPI WINBOOL WINAPI CloseHandle(HANDLE hObject); + WINBASEAPI WINBOOL WINAPI DuplicateHandle(HANDLE hSourceProcessHandle,HANDLE hSourceHandle,HANDLE hTargetProcessHandle,LPHANDLE lpTargetHandle,DWORD dwDesiredAccess,WINBOOL bInheritHandle,DWORD dwOptions); + WINBASEAPI WINBOOL WINAPI GetHandleInformation(HANDLE hObject,LPDWORD lpdwFlags); + WINBASEAPI WINBOOL WINAPI SetHandleInformation(HANDLE hObject,DWORD dwMask,DWORD dwFlags); + +#define HANDLE_FLAG_INHERIT 0x1 +#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x2 + +#define HINSTANCE_ERROR 32 + + WINBASEAPI DWORD WINAPI LoadModule(LPCSTR lpModuleName,LPVOID lpParameterBlock); + WINBASEAPI UINT WINAPI WinExec(LPCSTR lpCmdLine,UINT uCmdShow); + WINBASEAPI WINBOOL WINAPI ClearCommBreak(HANDLE hFile); + WINBASEAPI WINBOOL WINAPI ClearCommError(HANDLE hFile,LPDWORD lpErrors,LPCOMSTAT lpStat); + WINBASEAPI WINBOOL WINAPI SetupComm(HANDLE hFile,DWORD dwInQueue,DWORD dwOutQueue); + WINBASEAPI WINBOOL WINAPI EscapeCommFunction(HANDLE hFile,DWORD dwFunc); + WINBASEAPI WINBOOL WINAPI GetCommConfig(HANDLE hCommDev,LPCOMMCONFIG lpCC,LPDWORD lpdwSize); + WINBASEAPI WINBOOL WINAPI GetCommMask(HANDLE hFile,LPDWORD lpEvtMask); + WINBASEAPI WINBOOL WINAPI GetCommProperties(HANDLE hFile,LPCOMMPROP lpCommProp); + WINBASEAPI WINBOOL WINAPI GetCommModemStatus(HANDLE hFile,LPDWORD lpModemStat); + WINBASEAPI WINBOOL WINAPI GetCommState(HANDLE hFile,LPDCB lpDCB); + WINBASEAPI WINBOOL WINAPI GetCommTimeouts(HANDLE hFile,LPCOMMTIMEOUTS lpCommTimeouts); + WINBASEAPI WINBOOL WINAPI PurgeComm(HANDLE hFile,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI SetCommBreak(HANDLE hFile); + WINBASEAPI WINBOOL WINAPI SetCommConfig(HANDLE hCommDev,LPCOMMCONFIG lpCC,DWORD dwSize); + WINBASEAPI WINBOOL WINAPI SetCommMask(HANDLE hFile,DWORD dwEvtMask); + WINBASEAPI WINBOOL WINAPI SetCommState(HANDLE hFile,LPDCB lpDCB); + WINBASEAPI WINBOOL WINAPI SetCommTimeouts(HANDLE hFile,LPCOMMTIMEOUTS lpCommTimeouts); + WINBASEAPI WINBOOL WINAPI TransmitCommChar(HANDLE hFile,char cChar); + WINBASEAPI WINBOOL WINAPI WaitCommEvent(HANDLE hFile,LPDWORD lpEvtMask,LPOVERLAPPED lpOverlapped); + WINBASEAPI DWORD WINAPI SetTapePosition(HANDLE hDevice,DWORD dwPositionMethod,DWORD dwPartition,DWORD dwOffsetLow,DWORD dwOffsetHigh,WINBOOL bImmediate); + WINBASEAPI DWORD WINAPI GetTapePosition(HANDLE hDevice,DWORD dwPositionType,LPDWORD lpdwPartition,LPDWORD lpdwOffsetLow,LPDWORD lpdwOffsetHigh); + WINBASEAPI DWORD WINAPI PrepareTape(HANDLE hDevice,DWORD dwOperation,WINBOOL bImmediate); + WINBASEAPI DWORD WINAPI EraseTape(HANDLE hDevice,DWORD dwEraseType,WINBOOL bImmediate); + WINBASEAPI DWORD WINAPI CreateTapePartition(HANDLE hDevice,DWORD dwPartitionMethod,DWORD dwCount,DWORD dwSize); + WINBASEAPI DWORD WINAPI WriteTapemark(HANDLE hDevice,DWORD dwTapemarkType,DWORD dwTapemarkCount,WINBOOL bImmediate); + WINBASEAPI DWORD WINAPI GetTapeStatus(HANDLE hDevice); + WINBASEAPI DWORD WINAPI GetTapeParameters(HANDLE hDevice,DWORD dwOperation,LPDWORD lpdwSize,LPVOID lpTapeInformation); + +#define GET_TAPE_MEDIA_INFORMATION 0 +#define GET_TAPE_DRIVE_INFORMATION 1 + + WINBASEAPI DWORD WINAPI SetTapeParameters(HANDLE hDevice,DWORD dwOperation,LPVOID lpTapeInformation); + +#define SET_TAPE_MEDIA_INFORMATION 0 +#define SET_TAPE_DRIVE_INFORMATION 1 + + WINBASEAPI WINBOOL WINAPI Beep(DWORD dwFreq,DWORD dwDuration); + WINBASEAPI int WINAPI MulDiv(int nNumber,int nNumerator,int nDenominator); + WINBASEAPI VOID WINAPI GetSystemTime(LPSYSTEMTIME lpSystemTime); + WINBASEAPI VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime); + WINBASEAPI WINBOOL WINAPI SetSystemTime(CONST SYSTEMTIME *lpSystemTime); + WINBASEAPI VOID WINAPI GetLocalTime(LPSYSTEMTIME lpSystemTime); + WINBASEAPI WINBOOL WINAPI SetLocalTime(CONST SYSTEMTIME *lpSystemTime); + WINBASEAPI VOID WINAPI GetSystemInfo(LPSYSTEM_INFO lpSystemInfo); + WINBASEAPI WINBOOL WINAPI SetSystemFileCacheSize(SIZE_T MinimumFileCacheSize,SIZE_T MaximumFileCacheSize,DWORD Flags); + WINBASEAPI WINBOOL WINAPI GetSystemFileCacheSize(PSIZE_T lpMinimumFileCacheSize,PSIZE_T lpMaximumFileCacheSize,PDWORD lpFlags); + WINBASEAPI WINBOOL WINAPI GetSystemRegistryQuota(PDWORD pdwQuotaAllowed,PDWORD pdwQuotaUsed); + WINBOOL WINAPI GetSystemTimes(LPFILETIME lpIdleTime,LPFILETIME lpKernelTime,LPFILETIME lpUserTime); + WINBASEAPI VOID WINAPI GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo); + WINBASEAPI WINBOOL WINAPI IsProcessorFeaturePresent(DWORD ProcessorFeature); + + typedef struct _TIME_ZONE_INFORMATION { + LONG Bias; + WCHAR StandardName[32]; + SYSTEMTIME StandardDate; + LONG StandardBias; + WCHAR DaylightName[32]; + SYSTEMTIME DaylightDate; + LONG DaylightBias; + } TIME_ZONE_INFORMATION,*PTIME_ZONE_INFORMATION,*LPTIME_ZONE_INFORMATION; + +#ifdef UNICODE +#define FormatMessage FormatMessageW +#else +#define FormatMessage FormatMessageA +#endif + + WINBASEAPI WINBOOL WINAPI SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation,LPSYSTEMTIME lpUniversalTime,LPSYSTEMTIME lpLocalTime); + WINBASEAPI WINBOOL WINAPI TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation,LPSYSTEMTIME lpLocalTime,LPSYSTEMTIME lpUniversalTime); + WINBASEAPI DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation); + WINBASEAPI WINBOOL WINAPI SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation); + WINBASEAPI WINBOOL WINAPI SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime,LPFILETIME lpFileTime); + WINBASEAPI WINBOOL WINAPI FileTimeToLocalFileTime(CONST FILETIME *lpFileTime,LPFILETIME lpLocalFileTime); + WINBASEAPI WINBOOL WINAPI LocalFileTimeToFileTime(CONST FILETIME *lpLocalFileTime,LPFILETIME lpFileTime); + WINBASEAPI WINBOOL WINAPI FileTimeToSystemTime(CONST FILETIME *lpFileTime,LPSYSTEMTIME lpSystemTime); + WINBASEAPI LONG WINAPI CompareFileTime(CONST FILETIME *lpFileTime1,CONST FILETIME *lpFileTime2); + WINBASEAPI WINBOOL WINAPI FileTimeToDosDateTime(CONST FILETIME *lpFileTime,LPWORD lpFatDate,LPWORD lpFatTime); + WINBASEAPI WINBOOL WINAPI DosDateTimeToFileTime(WORD wFatDate,WORD wFatTime,LPFILETIME lpFileTime); + WINBASEAPI DWORD WINAPI GetTickCount(VOID); + WINBASEAPI WINBOOL WINAPI SetSystemTimeAdjustment(DWORD dwTimeAdjustment,WINBOOL bTimeAdjustmentDisabled); + WINBASEAPI WINBOOL WINAPI GetSystemTimeAdjustment(PDWORD lpTimeAdjustment,PDWORD lpTimeIncrement,PBOOL lpTimeAdjustmentDisabled); + WINBASEAPI DWORD WINAPI FormatMessageA(DWORD dwFlags,LPCVOID lpSource,DWORD dwMessageId,DWORD dwLanguageId,LPSTR lpBuffer,DWORD nSize,va_list *Arguments); + WINBASEAPI DWORD WINAPI FormatMessageW(DWORD dwFlags,LPCVOID lpSource,DWORD dwMessageId,DWORD dwLanguageId,LPWSTR lpBuffer,DWORD nSize,va_list *Arguments); + +#define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x100 +#define FORMAT_MESSAGE_IGNORE_INSERTS 0x200 +#define FORMAT_MESSAGE_FROM_STRING 0x400 +#define FORMAT_MESSAGE_FROM_HMODULE 0x800 +#define FORMAT_MESSAGE_FROM_SYSTEM 0x1000 +#define FORMAT_MESSAGE_ARGUMENT_ARRAY 0x2000 +#define FORMAT_MESSAGE_MAX_WIDTH_MASK 0xff + +#ifdef UNICODE +#define CreateMailslot CreateMailslotW +#define EncryptFile EncryptFileW +#define DecryptFile DecryptFileW +#define FileEncryptionStatus FileEncryptionStatusW +#else +#define CreateMailslot CreateMailslotA +#define EncryptFile EncryptFileA +#define DecryptFile DecryptFileA +#define FileEncryptionStatus FileEncryptionStatusA +#endif + + WINBASEAPI WINBOOL WINAPI CreatePipe(PHANDLE hReadPipe,PHANDLE hWritePipe,LPSECURITY_ATTRIBUTES lpPipeAttributes,DWORD nSize); + WINBASEAPI WINBOOL WINAPI ConnectNamedPipe(HANDLE hNamedPipe,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI DisconnectNamedPipe(HANDLE hNamedPipe); + WINBASEAPI WINBOOL WINAPI SetNamedPipeHandleState(HANDLE hNamedPipe,LPDWORD lpMode,LPDWORD lpMaxCollectionCount,LPDWORD lpCollectDataTimeout); + WINBASEAPI WINBOOL WINAPI GetNamedPipeInfo(HANDLE hNamedPipe,LPDWORD lpFlags,LPDWORD lpOutBufferSize,LPDWORD lpInBufferSize,LPDWORD lpMaxInstances); + WINBASEAPI WINBOOL WINAPI PeekNamedPipe(HANDLE hNamedPipe,LPVOID lpBuffer,DWORD nBufferSize,LPDWORD lpBytesRead,LPDWORD lpTotalBytesAvail,LPDWORD lpBytesLeftThisMessage); + WINBASEAPI WINBOOL WINAPI TransactNamedPipe(HANDLE hNamedPipe,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesRead,LPOVERLAPPED lpOverlapped); + WINBASEAPI HANDLE WINAPI CreateMailslotA(LPCSTR lpName,DWORD nMaxMessageSize,DWORD lReadTimeout,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI HANDLE WINAPI CreateMailslotW(LPCWSTR lpName,DWORD nMaxMessageSize,DWORD lReadTimeout,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI GetMailslotInfo(HANDLE hMailslot,LPDWORD lpMaxMessageSize,LPDWORD lpNextSize,LPDWORD lpMessageCount,LPDWORD lpReadTimeout); + WINBASEAPI WINBOOL WINAPI SetMailslotInfo(HANDLE hMailslot,DWORD lReadTimeout); + WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE hFileMappingObject,DWORD dwDesiredAccess,DWORD dwFileOffsetHigh,DWORD dwFileOffsetLow,SIZE_T dwNumberOfBytesToMap); + WINBASEAPI WINBOOL WINAPI FlushViewOfFile(LPCVOID lpBaseAddress,SIZE_T dwNumberOfBytesToFlush); + WINBASEAPI WINBOOL WINAPI UnmapViewOfFile(LPCVOID lpBaseAddress); + WINADVAPI WINBOOL WINAPI EncryptFileA(LPCSTR lpFileName); + WINADVAPI WINBOOL WINAPI EncryptFileW(LPCWSTR lpFileName); + WINADVAPI WINBOOL WINAPI DecryptFileA(LPCSTR lpFileName,DWORD dwReserved); + WINADVAPI WINBOOL WINAPI DecryptFileW(LPCWSTR lpFileName,DWORD dwReserved); + +#define FILE_ENCRYPTABLE 0 +#define FILE_IS_ENCRYPTED 1 +#define FILE_SYSTEM_ATTR 2 +#define FILE_ROOT_DIR 3 +#define FILE_SYSTEM_DIR 4 +#define FILE_UNKNOWN 5 +#define FILE_SYSTEM_NOT_SUPPORT 6 +#define FILE_USER_DISALLOWED 7 +#define FILE_READ_ONLY 8 +#define FILE_DIR_DISALLOWED 9 + + WINADVAPI WINBOOL WINAPI FileEncryptionStatusA(LPCSTR lpFileName,LPDWORD lpStatus); + WINADVAPI WINBOOL WINAPI FileEncryptionStatusW(LPCWSTR lpFileName,LPDWORD lpStatus); + +#define EFS_USE_RECOVERY_KEYS (0x1) + + typedef DWORD (WINAPI *PFE_EXPORT_FUNC)(PBYTE pbData,PVOID pvCallbackContext,ULONG ulLength); + typedef DWORD (WINAPI *PFE_IMPORT_FUNC)(PBYTE pbData,PVOID pvCallbackContext,PULONG ulLength); + +#define CREATE_FOR_IMPORT (1) +#define CREATE_FOR_DIR (2) +#define OVERWRITE_HIDDEN (4) + +#ifdef UNICODE +#define OpenEncryptedFileRaw OpenEncryptedFileRawW +#define lstrcmp lstrcmpW +#define lstrcmpi lstrcmpiW +#define lstrcpyn lstrcpynW +#define lstrcpy lstrcpyW +#define lstrcat lstrcatW +#define lstrlen lstrlenW +#else +#define OpenEncryptedFileRaw OpenEncryptedFileRawA +#define lstrcmp lstrcmpA +#define lstrcmpi lstrcmpiA +#define lstrcpyn lstrcpynA +#define lstrcpy lstrcpyA +#define lstrcat lstrcatA +#define lstrlen lstrlenA +#endif + + WINADVAPI DWORD WINAPI OpenEncryptedFileRawA(LPCSTR lpFileName,ULONG ulFlags,PVOID *pvContext); + WINADVAPI DWORD WINAPI OpenEncryptedFileRawW(LPCWSTR lpFileName,ULONG ulFlags,PVOID *pvContext); + WINADVAPI DWORD WINAPI ReadEncryptedFileRaw(PFE_EXPORT_FUNC pfExportCallback,PVOID pvCallbackContext,PVOID pvContext); + WINADVAPI DWORD WINAPI WriteEncryptedFileRaw(PFE_IMPORT_FUNC pfImportCallback,PVOID pvCallbackContext,PVOID pvContext); + WINADVAPI VOID WINAPI CloseEncryptedFileRaw(PVOID pvContext); + WINBASEAPI int WINAPI lstrcmpA(LPCSTR lpString1,LPCSTR lpString2); + WINBASEAPI int WINAPI lstrcmpW(LPCWSTR lpString1,LPCWSTR lpString2); + WINBASEAPI int WINAPI lstrcmpiA(LPCSTR lpString1,LPCSTR lpString2); + WINBASEAPI int WINAPI lstrcmpiW(LPCWSTR lpString1,LPCWSTR lpString2); + WINBASEAPI LPSTR WINAPI lstrcpynA(LPSTR lpString1,LPCSTR lpString2,int iMaxLength); + WINBASEAPI LPWSTR WINAPI lstrcpynW(LPWSTR lpString1,LPCWSTR lpString2,int iMaxLength); + WINBASEAPI LPSTR WINAPI lstrcpyA(LPSTR lpString1,LPCSTR lpString2); + WINBASEAPI LPWSTR WINAPI lstrcpyW(LPWSTR lpString1,LPCWSTR lpString2); + WINBASEAPI LPSTR WINAPI lstrcatA(LPSTR lpString1,LPCSTR lpString2); + WINBASEAPI LPWSTR WINAPI lstrcatW(LPWSTR lpString1,LPCWSTR lpString2); + WINBASEAPI int WINAPI lstrlenA(LPCSTR lpString); + WINBASEAPI int WINAPI lstrlenW(LPCWSTR lpString); + WINBASEAPI HFILE WINAPI OpenFile(LPCSTR lpFileName,LPOFSTRUCT lpReOpenBuff,UINT uStyle); + WINBASEAPI HFILE WINAPI _lopen(LPCSTR lpPathName,int iReadWrite); + WINBASEAPI HFILE WINAPI _lcreat(LPCSTR lpPathName,int iAttribute); + WINBASEAPI UINT WINAPI _lread(HFILE hFile,LPVOID lpBuffer,UINT uBytes); + WINBASEAPI UINT WINAPI _lwrite(HFILE hFile,LPCCH lpBuffer,UINT uBytes); + WINBASEAPI long WINAPI _hread(HFILE hFile,LPVOID lpBuffer,long lBytes); + WINBASEAPI long WINAPI _hwrite(HFILE hFile,LPCCH lpBuffer,long lBytes); + WINBASEAPI HFILE WINAPI _lclose(HFILE hFile); + WINBASEAPI LONG WINAPI _llseek(HFILE hFile,LONG lOffset,int iOrigin); + WINADVAPI WINBOOL WINAPI IsTextUnicode(CONST VOID *lpv,int iSize,LPINT lpiResult); + +#define FLS_OUT_OF_INDEXES ((DWORD)0xffffffff) + + WINBASEAPI DWORD WINAPI FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback); + WINBASEAPI PVOID WINAPI FlsGetValue(DWORD dwFlsIndex); + WINBASEAPI WINBOOL WINAPI FlsSetValue(DWORD dwFlsIndex,PVOID lpFlsData); + WINBASEAPI WINBOOL WINAPI FlsFree(DWORD dwFlsIndex); + +#define TLS_OUT_OF_INDEXES ((DWORD)0xffffffff) + + WINBASEAPI DWORD WINAPI TlsAlloc(VOID); + WINBASEAPI LPVOID WINAPI TlsGetValue(DWORD dwTlsIndex); + WINBASEAPI WINBOOL WINAPI TlsSetValue(DWORD dwTlsIndex,LPVOID lpTlsValue); + WINBASEAPI WINBOOL WINAPI TlsFree(DWORD dwTlsIndex); + + typedef VOID (WINAPI *LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode,DWORD dwNumberOfBytesTransfered,LPOVERLAPPED lpOverlapped); + + WINBASEAPI DWORD WINAPI SleepEx(DWORD dwMilliseconds,WINBOOL bAlertable); + WINBASEAPI DWORD WINAPI WaitForSingleObjectEx(HANDLE hHandle,DWORD dwMilliseconds,WINBOOL bAlertable); + WINBASEAPI DWORD WINAPI WaitForMultipleObjectsEx(DWORD nCount,CONST HANDLE *lpHandles,WINBOOL bWaitAll,DWORD dwMilliseconds,WINBOOL bAlertable); + WINBASEAPI DWORD WINAPI SignalObjectAndWait(HANDLE hObjectToSignal,HANDLE hObjectToWaitOn,DWORD dwMilliseconds,WINBOOL bAlertable); + WINBASEAPI WINBOOL WINAPI ReadFileEx(HANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPOVERLAPPED lpOverlapped,LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); + WINBASEAPI WINBOOL WINAPI WriteFileEx(HANDLE hFile,LPCVOID lpBuffer,DWORD nNumberOfBytesToWrite,LPOVERLAPPED lpOverlapped,LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); + WINBASEAPI WINBOOL WINAPI BackupRead(HANDLE hFile,LPBYTE lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,WINBOOL bAbort,WINBOOL bProcessSecurity,LPVOID *lpContext); + WINBASEAPI WINBOOL WINAPI BackupSeek(HANDLE hFile,DWORD dwLowBytesToSeek,DWORD dwHighBytesToSeek,LPDWORD lpdwLowByteSeeked,LPDWORD lpdwHighByteSeeked,LPVOID *lpContext); + WINBASEAPI WINBOOL WINAPI BackupWrite(HANDLE hFile,LPBYTE lpBuffer,DWORD nNumberOfBytesToWrite,LPDWORD lpNumberOfBytesWritten,WINBOOL bAbort,WINBOOL bProcessSecurity,LPVOID *lpContext); + + typedef struct _WIN32_STREAM_ID { + DWORD dwStreamId; + DWORD dwStreamAttributes; + LARGE_INTEGER Size; + DWORD dwStreamNameSize; + WCHAR cStreamName[ANYSIZE_ARRAY]; + } WIN32_STREAM_ID,*LPWIN32_STREAM_ID; + +#define BACKUP_INVALID 0x0 +#define BACKUP_DATA 0x1 +#define BACKUP_EA_DATA 0x2 +#define BACKUP_SECURITY_DATA 0x3 +#define BACKUP_ALTERNATE_DATA 0x4 +#define BACKUP_LINK 0x5 +#define BACKUP_PROPERTY_DATA 0x6 +#define BACKUP_OBJECT_ID 0x7 +#define BACKUP_REPARSE_DATA 0x8 +#define BACKUP_SPARSE_BLOCK 0x9 + +#define STREAM_NORMAL_ATTRIBUTE 0x0 +#define STREAM_MODIFIED_WHEN_READ 0x1 +#define STREAM_CONTAINS_SECURITY 0x2 +#define STREAM_CONTAINS_PROPERTIES 0x4 +#define STREAM_SPARSE_ATTRIBUTE 0x8 + + WINBASEAPI WINBOOL WINAPI ReadFileScatter(HANDLE hFile,FILE_SEGMENT_ELEMENT aSegmentArray[],DWORD nNumberOfBytesToRead,LPDWORD lpReserved,LPOVERLAPPED lpOverlapped); + WINBASEAPI WINBOOL WINAPI WriteFileGather(HANDLE hFile,FILE_SEGMENT_ELEMENT aSegmentArray[],DWORD nNumberOfBytesToWrite,LPDWORD lpReserved,LPOVERLAPPED lpOverlapped); + +#define STARTF_USESHOWWINDOW 0x1 +#define STARTF_USESIZE 0x2 +#define STARTF_USEPOSITION 0x4 +#define STARTF_USECOUNTCHARS 0x8 +#define STARTF_USEFILLATTRIBUTE 0x10 +#define STARTF_RUNFULLSCREEN 0x20 +#define STARTF_FORCEONFEEDBACK 0x40 +#define STARTF_FORCEOFFFEEDBACK 0x80 +#define STARTF_USESTDHANDLES 0x100 + +#define STARTF_USEHOTKEY 0x200 + + typedef struct _STARTUPINFOA { + DWORD cb; + LPSTR lpReserved; + LPSTR lpDesktop; + LPSTR lpTitle; + DWORD dwX; + DWORD dwY; + DWORD dwXSize; + DWORD dwYSize; + DWORD dwXCountChars; + DWORD dwYCountChars; + DWORD dwFillAttribute; + DWORD dwFlags; + WORD wShowWindow; + WORD cbReserved2; + LPBYTE lpReserved2; + HANDLE hStdInput; + HANDLE hStdOutput; + HANDLE hStdError; + } STARTUPINFOA,*LPSTARTUPINFOA; + + typedef struct _STARTUPINFOW { + DWORD cb; + LPWSTR lpReserved; + LPWSTR lpDesktop; + LPWSTR lpTitle; + DWORD dwX; + DWORD dwY; + DWORD dwXSize; + DWORD dwYSize; + DWORD dwXCountChars; + DWORD dwYCountChars; + DWORD dwFillAttribute; + DWORD dwFlags; + WORD wShowWindow; + WORD cbReserved2; + LPBYTE lpReserved2; + HANDLE hStdInput; + HANDLE hStdOutput; + HANDLE hStdError; + } STARTUPINFOW,*LPSTARTUPINFOW; + +#ifdef UNICODE + typedef STARTUPINFOW STARTUPINFO; + typedef LPSTARTUPINFOW LPSTARTUPINFO; +#else + typedef STARTUPINFOA STARTUPINFO; + typedef LPSTARTUPINFOA LPSTARTUPINFO; +#endif + +#define SHUTDOWN_NORETRY 0x1 + + typedef struct _WIN32_FIND_DATAA { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD dwReserved0; + DWORD dwReserved1; + CHAR cFileName[MAX_PATH]; + CHAR cAlternateFileName[14]; + } WIN32_FIND_DATAA,*PWIN32_FIND_DATAA,*LPWIN32_FIND_DATAA; + + typedef struct _WIN32_FIND_DATAW { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD dwReserved0; + DWORD dwReserved1; + WCHAR cFileName[MAX_PATH]; + WCHAR cAlternateFileName[14]; + } WIN32_FIND_DATAW,*PWIN32_FIND_DATAW,*LPWIN32_FIND_DATAW; + +#ifdef UNICODE + typedef WIN32_FIND_DATAW WIN32_FIND_DATA; + typedef PWIN32_FIND_DATAW PWIN32_FIND_DATA; + typedef LPWIN32_FIND_DATAW LPWIN32_FIND_DATA; +#else + typedef WIN32_FIND_DATAA WIN32_FIND_DATA; + typedef PWIN32_FIND_DATAA PWIN32_FIND_DATA; + typedef LPWIN32_FIND_DATAA LPWIN32_FIND_DATA; +#endif + + typedef struct _WIN32_FILE_ATTRIBUTE_DATA { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + } WIN32_FILE_ATTRIBUTE_DATA,*LPWIN32_FILE_ATTRIBUTE_DATA; + +#ifdef UNICODE +#define CreateMutex CreateMutexW +#define OpenMutex OpenMutexW +#define CreateEvent CreateEventW +#define OpenEvent OpenEventW +#define CreateSemaphore CreateSemaphoreW +#define OpenSemaphore OpenSemaphoreW +#else +#define CreateMutex CreateMutexA +#define OpenMutex OpenMutexA +#define CreateEvent CreateEventA +#define OpenEvent OpenEventA +#define CreateSemaphore CreateSemaphoreA +#define OpenSemaphore OpenSemaphoreA +#endif + + WINBASEAPI HANDLE WINAPI CreateMutexA(LPSECURITY_ATTRIBUTES lpMutexAttributes,WINBOOL bInitialOwner,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateMutexW(LPSECURITY_ATTRIBUTES lpMutexAttributes,WINBOOL bInitialOwner,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenMutexA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenMutexW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes,WINBOOL bManualReset,WINBOOL bInitialState,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes,WINBOOL bManualReset,WINBOOL bInitialState,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenEventA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenEventW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,LONG lInitialCount,LONG lMaximumCount,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,LONG lInitialCount,LONG lMaximumCount,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenSemaphoreA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenSemaphoreW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + + typedef VOID (WINAPI *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue); + +#ifdef UNICODE +#define CreateWaitableTimer CreateWaitableTimerW +#define OpenWaitableTimer OpenWaitableTimerW +#define CreateFileMapping CreateFileMappingW +#define OpenFileMapping OpenFileMappingW +#define GetLogicalDriveStrings GetLogicalDriveStringsW +#define LoadLibrary LoadLibraryW +#define LoadLibraryEx LoadLibraryExW +#define GetModuleFileName GetModuleFileNameW +#define GetModuleHandle GetModuleHandleW +#else +#define CreateWaitableTimer CreateWaitableTimerA +#define OpenWaitableTimer OpenWaitableTimerA +#define CreateFileMapping CreateFileMappingA +#define OpenFileMapping OpenFileMappingA +#define GetLogicalDriveStrings GetLogicalDriveStringsA +#define LoadLibrary LoadLibraryA +#define LoadLibraryEx LoadLibraryExA +#define GetModuleFileName GetModuleFileNameA +#define GetModuleHandle GetModuleHandleA +#endif + + WINBASEAPI HANDLE WINAPI CreateWaitableTimerA(LPSECURITY_ATTRIBUTES lpTimerAttributes,WINBOOL bManualReset,LPCSTR lpTimerName); + WINBASEAPI HANDLE WINAPI CreateWaitableTimerW(LPSECURITY_ATTRIBUTES lpTimerAttributes,WINBOOL bManualReset,LPCWSTR lpTimerName); + WINBASEAPI HANDLE WINAPI OpenWaitableTimerA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpTimerName); + WINBASEAPI HANDLE WINAPI OpenWaitableTimerW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpTimerName); + WINBASEAPI WINBOOL WINAPI SetWaitableTimer(HANDLE hTimer,const LARGE_INTEGER *lpDueTime,LONG lPeriod,PTIMERAPCROUTINE pfnCompletionRoutine,LPVOID lpArgToCompletionRoutine,WINBOOL fResume); + WINBASEAPI WINBOOL WINAPI CancelWaitableTimer(HANDLE hTimer); + WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE hFile,LPSECURITY_ATTRIBUTES lpFileMappingAttributes,DWORD flProtect,DWORD dwMaximumSizeHigh,DWORD dwMaximumSizeLow,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE hFile,LPSECURITY_ATTRIBUTES lpFileMappingAttributes,DWORD flProtect,DWORD dwMaximumSizeHigh,DWORD dwMaximumSizeLow,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenFileMappingA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenFileMappingW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + WINBASEAPI DWORD WINAPI GetLogicalDriveStringsA(DWORD nBufferLength,LPSTR lpBuffer); + WINBASEAPI DWORD WINAPI GetLogicalDriveStringsW(DWORD nBufferLength,LPWSTR lpBuffer); + + typedef enum _MEMORY_RESOURCE_NOTIFICATION_TYPE { + LowMemoryResourceNotification,HighMemoryResourceNotification + } MEMORY_RESOURCE_NOTIFICATION_TYPE; + + WINBASEAPI HANDLE WINAPI CreateMemoryResourceNotification(MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType); + WINBASEAPI WINBOOL WINAPI QueryMemoryResourceNotification(HANDLE ResourceNotificationHandle,PBOOL ResourceState); + WINBASEAPI HMODULE WINAPI LoadLibraryA(LPCSTR lpLibFileName); + WINBASEAPI HMODULE WINAPI LoadLibraryW(LPCWSTR lpLibFileName); + WINBASEAPI HMODULE WINAPI LoadLibraryExA(LPCSTR lpLibFileName,HANDLE hFile,DWORD dwFlags); + WINBASEAPI HMODULE WINAPI LoadLibraryExW(LPCWSTR lpLibFileName,HANDLE hFile,DWORD dwFlags); + +#define DONT_RESOLVE_DLL_REFERENCES 0x1 +#define LOAD_LIBRARY_AS_DATAFILE 0x2 +#define LOAD_WITH_ALTERED_SEARCH_PATH 0x8 +#define LOAD_IGNORE_CODE_AUTHZ_LEVEL 0x10 +#define LOAD_LINRARY_AS_IMAGE_RESOURCE 0x20 +#define LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE 0x40 + + WINBASEAPI DWORD WINAPI GetModuleFileNameA(HMODULE hModule,LPCH lpFilename,DWORD nSize); + WINBASEAPI DWORD WINAPI GetModuleFileNameW(HMODULE hModule,LPWCH lpFilename,DWORD nSize); + WINBASEAPI HMODULE WINAPI GetModuleHandleA(LPCSTR lpModuleName); + WINBASEAPI HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName); + +#ifndef RC_INVOKED +#define GET_MODULE_HANDLE_EX_FLAG_PIN (0x1) +#define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT (0x2) +#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS (0x4) + + typedef WINBOOL (WINAPI *PGET_MODULE_HANDLE_EXA)(DWORD dwFlags,LPCSTR lpModuleName,HMODULE *phModule); + typedef WINBOOL (WINAPI *PGET_MODULE_HANDLE_EXW)(DWORD dwFlags,LPCWSTR lpModuleName,HMODULE *phModule); + +#ifdef UNICODE +#define PGET_MODULE_HANDLE_EX PGET_MODULE_HANDLE_EXW +#define GetModuleHandleEx GetModuleHandleExW +#else +#define PGET_MODULE_HANDLE_EX PGET_MODULE_HANDLE_EXA +#define GetModuleHandleEx GetModuleHandleExA +#endif + + WINBASEAPI WINBOOL WINAPI GetModuleHandleExA(DWORD dwFlags,LPCSTR lpModuleName,HMODULE *phModule); + WINBASEAPI WINBOOL WINAPI GetModuleHandleExW(DWORD dwFlags,LPCWSTR lpModuleName,HMODULE *phModule); +#endif + +#ifdef UNICODE +#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW +#define CreateProcess CreateProcessW +#define FatalAppExit FatalAppExitW +#define GetStartupInfo GetStartupInfoW +#define GetCommandLine GetCommandLineW +#define GetEnvironmentVariable GetEnvironmentVariableW +#define SetEnvironmentVariable SetEnvironmentVariableW +#define ExpandEnvironmentStrings ExpandEnvironmentStringsW +#define GetFirmwareEnvironmentVariable GetFirmwareEnvironmentVariableW +#define SetFirmwareEnvironmentVariable SetFirmwareEnvironmentVariableW +#define OutputDebugString OutputDebugStringW +#define FindResource FindResourceW +#define FindResourceEx FindResourceExW +#else +#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA +#define CreateProcess CreateProcessA +#define FatalAppExit FatalAppExitA +#define GetStartupInfo GetStartupInfoA +#define GetCommandLine GetCommandLineA +#define GetEnvironmentVariable GetEnvironmentVariableA +#define SetEnvironmentVariable SetEnvironmentVariableA +#define ExpandEnvironmentStrings ExpandEnvironmentStringsA +#define GetFirmwareEnvironmentVariable GetFirmwareEnvironmentVariableA +#define SetFirmwareEnvironmentVariable SetFirmwareEnvironmentVariableA +#define OutputDebugString OutputDebugStringA +#define FindResource FindResourceA +#define FindResourceEx FindResourceExA +#endif + + WINBASEAPI WINBOOL WINAPI NeedCurrentDirectoryForExePathA(LPCSTR ExeName); + WINBASEAPI WINBOOL WINAPI NeedCurrentDirectoryForExePathW(LPCWSTR ExeName); + WINBASEAPI WINBOOL WINAPI CreateProcessA(LPCSTR lpApplicationName,LPSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCSTR lpCurrentDirectory,LPSTARTUPINFOA lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINBASEAPI WINBOOL WINAPI CreateProcessW(LPCWSTR lpApplicationName,LPWSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINBASEAPI DWORD WINAPI AddLocalAlternateComputerNameA(LPCSTR lpDnsFQHostname,ULONG ulFlags); + WINBASEAPI DWORD WINAPI AddLocalAlternateComputerNameW(LPCWSTR lpDnsFQHostname,ULONG ulFlags); + WINBASEAPI WINBOOL WINAPI SetProcessShutdownParameters(DWORD dwLevel,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI GetProcessShutdownParameters(LPDWORD lpdwLevel,LPDWORD lpdwFlags); + WINBASEAPI DWORD WINAPI GetProcessVersion(DWORD ProcessId); + WINBASEAPI VOID WINAPI FatalAppExitA(UINT uAction,LPCSTR lpMessageText); + WINBASEAPI VOID WINAPI FatalAppExitW(UINT uAction,LPCWSTR lpMessageText); + WINBASEAPI VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo); + WINBASEAPI VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo); + WINBASEAPI LPSTR WINAPI GetCommandLineA(VOID); + WINBASEAPI LPWSTR WINAPI GetCommandLineW(VOID); + WINBASEAPI DWORD WINAPI GetEnvironmentVariableA(LPCSTR lpName,LPSTR lpBuffer,DWORD nSize); + WINBASEAPI DWORD WINAPI GetEnvironmentVariableW(LPCWSTR lpName,LPWSTR lpBuffer,DWORD nSize); + WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableA(LPCSTR lpName,LPCSTR lpValue); + WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableW(LPCWSTR lpName,LPCWSTR lpValue); + WINBASEAPI DWORD WINAPI ExpandEnvironmentStringsA(LPCSTR lpSrc,LPSTR lpDst,DWORD nSize); + WINBASEAPI DWORD WINAPI ExpandEnvironmentStringsW(LPCWSTR lpSrc,LPWSTR lpDst,DWORD nSize); + WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR lpName,LPCSTR lpGuid,PVOID pBuffer,DWORD nSize); + WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR lpName,LPCWSTR lpGuid,PVOID pBuffer,DWORD nSize); + WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableA(LPCSTR lpName,LPCSTR lpGuid,PVOID pValue,DWORD nSize); + WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableW(LPCWSTR lpName,LPCWSTR lpGuid,PVOID pValue,DWORD nSize); + WINBASEAPI VOID WINAPI OutputDebugStringA(LPCSTR lpOutputString); + WINBASEAPI VOID WINAPI OutputDebugStringW(LPCWSTR lpOutputString); + WINBASEAPI HRSRC WINAPI FindResourceA(HMODULE hModule,LPCSTR lpName,LPCSTR lpType); + WINBASEAPI HRSRC WINAPI FindResourceW(HMODULE hModule,LPCWSTR lpName,LPCWSTR lpType); + WINBASEAPI HRSRC WINAPI FindResourceExA(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,WORD wLanguage); + WINBASEAPI HRSRC WINAPI FindResourceExW(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,WORD wLanguage); + +#ifdef UNICODE +#define ENUMRESTYPEPROC ENUMRESTYPEPROCW +#define ENUMRESNAMEPROC ENUMRESNAMEPROCW +#define ENUMRESLANGPROC ENUMRESLANGPROCW +#define EnumResourceTypes EnumResourceTypesW +#define EnumResourceNames EnumResourceNamesW +#define EnumResourceLanguages EnumResourceLanguagesW +#define BeginUpdateResource BeginUpdateResourceW +#define UpdateResource UpdateResourceW +#define EndUpdateResource EndUpdateResourceW +#define GlobalAddAtom GlobalAddAtomW +#define GlobalFindAtom GlobalFindAtomW +#define GlobalGetAtomName GlobalGetAtomNameW +#define AddAtom AddAtomW +#define FindAtom FindAtomW +#define GetAtomName GetAtomNameW +#define GetProfileInt GetProfileIntW +#define GetProfileString GetProfileStringW +#define WriteProfileString WriteProfileStringW +#define GetProfileSection GetProfileSectionW +#define WriteProfileSection WriteProfileSectionW +#define GetPrivateProfileInt GetPrivateProfileIntW +#define GetPrivateProfileString GetPrivateProfileStringW +#define WritePrivateProfileString WritePrivateProfileStringW +#define GetPrivateProfileSection GetPrivateProfileSectionW +#define WritePrivateProfileSection WritePrivateProfileSectionW +#define GetPrivateProfileSectionNames GetPrivateProfileSectionNamesW +#define GetPrivateProfileStruct GetPrivateProfileStructW +#define WritePrivateProfileStruct WritePrivateProfileStructW +#define GetDriveType GetDriveTypeW +#define GetSystemDirectory GetSystemDirectoryW +#define GetTempPath GetTempPathW +#define GetTempFileName GetTempFileNameW +#define GetWindowsDirectory GetWindowsDirectoryW +#define GetSystemWindowsDirectory GetSystemWindowsDirectoryW +#define AddLocalAlternateComputerName AddLocalAlternateComputerNameW +#else +#define ENUMRESTYPEPROC ENUMRESTYPEPROCA +#define ENUMRESNAMEPROC ENUMRESNAMEPROCA +#define ENUMRESLANGPROC ENUMRESLANGPROCA +#define EnumResourceTypes EnumResourceTypesA +#define EnumResourceNames EnumResourceNamesA +#define EnumResourceLanguages EnumResourceLanguagesA +#define BeginUpdateResource BeginUpdateResourceA +#define UpdateResource UpdateResourceA +#define EndUpdateResource EndUpdateResourceA +#define GlobalAddAtom GlobalAddAtomA +#define GlobalFindAtom GlobalFindAtomA +#define GlobalGetAtomName GlobalGetAtomNameA +#define AddAtom AddAtomA +#define FindAtom FindAtomA +#define GetAtomName GetAtomNameA +#define GetProfileInt GetProfileIntA +#define GetProfileString GetProfileStringA +#define WriteProfileString WriteProfileStringA +#define GetProfileSection GetProfileSectionA +#define WriteProfileSection WriteProfileSectionA +#define GetPrivateProfileInt GetPrivateProfileIntA +#define GetPrivateProfileString GetPrivateProfileStringA +#define WritePrivateProfileString WritePrivateProfileStringA +#define GetPrivateProfileSection GetPrivateProfileSectionA +#define WritePrivateProfileSection WritePrivateProfileSectionA +#define GetPrivateProfileSectionNames GetPrivateProfileSectionNamesA +#define GetPrivateProfileStruct GetPrivateProfileStructA +#define WritePrivateProfileStruct WritePrivateProfileStructA +#define GetDriveType GetDriveTypeA +#define GetSystemDirectory GetSystemDirectoryA +#define GetTempPath GetTempPathA +#define GetTempFileName GetTempFileNameA +#define GetWindowsDirectory GetWindowsDirectoryA +#define GetSystemWindowsDirectory GetSystemWindowsDirectoryA +#define AddLocalAlternateComputerName AddLocalAlternateComputerNameA +#endif + + typedef WINBOOL (CALLBACK *ENUMRESTYPEPROCA)(HMODULE hModule,LPSTR lpType,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESTYPEPROCW)(HMODULE hModule,LPWSTR lpType,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESNAMEPROCA)(HMODULE hModule,LPCSTR lpType,LPSTR lpName,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESNAMEPROCW)(HMODULE hModule,LPCWSTR lpType,LPWSTR lpName,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESLANGPROCA)(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,WORD wLanguage,LONG_PTR lParam); + typedef WINBOOL (CALLBACK *ENUMRESLANGPROCW)(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,WORD wLanguage,LONG_PTR lParam); + + WINBASEAPI WINBOOL WINAPI EnumResourceTypesA(HMODULE hModule,ENUMRESTYPEPROCA lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceTypesW(HMODULE hModule,ENUMRESTYPEPROCW lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceNamesA(HMODULE hModule,LPCSTR lpType,ENUMRESNAMEPROCA lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceNamesW(HMODULE hModule,LPCWSTR lpType,ENUMRESNAMEPROCW lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesA(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,ENUMRESLANGPROCA lpEnumFunc,LONG_PTR lParam); + WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesW(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,ENUMRESLANGPROCW lpEnumFunc,LONG_PTR lParam); + WINBASEAPI HANDLE WINAPI BeginUpdateResourceA(LPCSTR pFileName,WINBOOL bDeleteExistingResources); + WINBASEAPI HANDLE WINAPI BeginUpdateResourceW(LPCWSTR pFileName,WINBOOL bDeleteExistingResources); + WINBASEAPI WINBOOL WINAPI UpdateResourceA(HANDLE hUpdate,LPCSTR lpType,LPCSTR lpName,WORD wLanguage,LPVOID lpData,DWORD cb); + WINBASEAPI WINBOOL WINAPI UpdateResourceW(HANDLE hUpdate,LPCWSTR lpType,LPCWSTR lpName,WORD wLanguage,LPVOID lpData,DWORD cb); + WINBASEAPI WINBOOL WINAPI EndUpdateResourceA(HANDLE hUpdate,WINBOOL fDiscard); + WINBASEAPI WINBOOL WINAPI EndUpdateResourceW(HANDLE hUpdate,WINBOOL fDiscard); + WINBASEAPI ATOM WINAPI GlobalAddAtomA(LPCSTR lpString); + WINBASEAPI ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString); + WINBASEAPI ATOM WINAPI GlobalFindAtomA(LPCSTR lpString); + WINBASEAPI ATOM WINAPI GlobalFindAtomW(LPCWSTR lpString); + WINBASEAPI UINT WINAPI GlobalGetAtomNameA(ATOM nAtom,LPSTR lpBuffer,int nSize); + WINBASEAPI UINT WINAPI GlobalGetAtomNameW(ATOM nAtom,LPWSTR lpBuffer,int nSize); + WINBASEAPI ATOM WINAPI AddAtomA(LPCSTR lpString); + WINBASEAPI ATOM WINAPI AddAtomW(LPCWSTR lpString); + WINBASEAPI ATOM WINAPI FindAtomA(LPCSTR lpString); + WINBASEAPI ATOM WINAPI FindAtomW(LPCWSTR lpString); + WINBASEAPI UINT WINAPI GetAtomNameA(ATOM nAtom,LPSTR lpBuffer,int nSize); + WINBASEAPI UINT WINAPI GetAtomNameW(ATOM nAtom,LPWSTR lpBuffer,int nSize); + WINBASEAPI UINT WINAPI GetProfileIntA(LPCSTR lpAppName,LPCSTR lpKeyName,INT nDefault); + WINBASEAPI UINT WINAPI GetProfileIntW(LPCWSTR lpAppName,LPCWSTR lpKeyName,INT nDefault); + WINBASEAPI DWORD WINAPI GetProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault,LPSTR lpReturnedString,DWORD nSize); + WINBASEAPI DWORD WINAPI GetProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpDefault,LPWSTR lpReturnedString,DWORD nSize); + WINBASEAPI WINBOOL WINAPI WriteProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpString); + WINBASEAPI WINBOOL WINAPI WriteProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString); + WINBASEAPI DWORD WINAPI GetProfileSectionA(LPCSTR lpAppName,LPSTR lpReturnedString,DWORD nSize); + WINBASEAPI DWORD WINAPI GetProfileSectionW(LPCWSTR lpAppName,LPWSTR lpReturnedString,DWORD nSize); + WINBASEAPI WINBOOL WINAPI WriteProfileSectionA(LPCSTR lpAppName,LPCSTR lpString); + WINBASEAPI WINBOOL WINAPI WriteProfileSectionW(LPCWSTR lpAppName,LPCWSTR lpString); + WINBASEAPI UINT WINAPI GetPrivateProfileIntA(LPCSTR lpAppName,LPCSTR lpKeyName,INT nDefault,LPCSTR lpFileName); + WINBASEAPI UINT WINAPI GetPrivateProfileIntW(LPCWSTR lpAppName,LPCWSTR lpKeyName,INT nDefault,LPCWSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault,LPSTR lpReturnedString,DWORD nSize,LPCSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpDefault,LPWSTR lpReturnedString,DWORD nSize,LPCWSTR lpFileName); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpString,LPCSTR lpFileName); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString,LPCWSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileSectionA(LPCSTR lpAppName,LPSTR lpReturnedString,DWORD nSize,LPCSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileSectionW(LPCWSTR lpAppName,LPWSTR lpReturnedString,DWORD nSize,LPCWSTR lpFileName); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileSectionA(LPCSTR lpAppName,LPCSTR lpString,LPCSTR lpFileName); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileSectionW(LPCWSTR lpAppName,LPCWSTR lpString,LPCWSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileSectionNamesA(LPSTR lpszReturnBuffer,DWORD nSize,LPCSTR lpFileName); + WINBASEAPI DWORD WINAPI GetPrivateProfileSectionNamesW(LPWSTR lpszReturnBuffer,DWORD nSize,LPCWSTR lpFileName); + WINBASEAPI WINBOOL WINAPI GetPrivateProfileStructA(LPCSTR lpszSection,LPCSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCSTR szFile); + WINBASEAPI WINBOOL WINAPI GetPrivateProfileStructW(LPCWSTR lpszSection,LPCWSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCWSTR szFile); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileStructA(LPCSTR lpszSection,LPCSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCSTR szFile); + WINBASEAPI WINBOOL WINAPI WritePrivateProfileStructW(LPCWSTR lpszSection,LPCWSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCWSTR szFile); + WINBASEAPI UINT WINAPI GetDriveTypeA(LPCSTR lpRootPathName); + WINBASEAPI UINT WINAPI GetDriveTypeW(LPCWSTR lpRootPathName); + WINBASEAPI UINT WINAPI GetSystemDirectoryA(LPSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetSystemDirectoryW(LPWSTR lpBuffer,UINT uSize); + WINBASEAPI DWORD WINAPI GetTempPathA(DWORD nBufferLength,LPSTR lpBuffer); + WINBASEAPI DWORD WINAPI GetTempPathW(DWORD nBufferLength,LPWSTR lpBuffer); + WINBASEAPI UINT WINAPI GetTempFileNameA(LPCSTR lpPathName,LPCSTR lpPrefixString,UINT uUnique,LPSTR lpTempFileName); + WINBASEAPI UINT WINAPI GetTempFileNameW(LPCWSTR lpPathName,LPCWSTR lpPrefixString,UINT uUnique,LPWSTR lpTempFileName); + WINBASEAPI UINT WINAPI GetWindowsDirectoryA(LPSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetWindowsDirectoryW(LPWSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryA(LPSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryW(LPWSTR lpBuffer,UINT uSize); + +#ifndef RC_INVOKED +#ifdef UNICODE +#define GetSystemWow64Directory GetSystemWow64DirectoryW +#else +#define GetSystemWow64Directory GetSystemWow64DirectoryA +#endif + + WINBASEAPI UINT WINAPI GetSystemWow64DirectoryA(LPSTR lpBuffer,UINT uSize); + WINBASEAPI UINT WINAPI GetSystemWow64DirectoryW(LPWSTR lpBuffer,UINT uSize); + WINBASEAPI BOOLEAN WINAPI Wow64EnableWow64FsRedirection(BOOLEAN Wow64FsEnableRedirection); + WINBASEAPI WINBOOL WINAPI Wow64DisableWow64FsRedirection(PVOID *OldValue); + WINBASEAPI WINBOOL WINAPI Wow64RevertWow64FsRedirection(PVOID OlValue); + + typedef UINT (WINAPI *PGET_SYSTEM_WOW64_DIRECTORY_A)(LPSTR lpBuffer,UINT uSize); + typedef UINT (WINAPI *PGET_SYSTEM_WOW64_DIRECTORY_W)(LPWSTR lpBuffer,UINT uSize); + +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A "GetSystemWow64DirectoryA" +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W L"GetSystemWow64DirectoryA" +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T TEXT("GetSystemWow64DirectoryA") +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A "GetSystemWow64DirectoryW" +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W L"GetSystemWow64DirectoryW" +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T TEXT("GetSystemWow64DirectoryW") + +#ifdef UNICODE +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T +#else +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W +#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T +#endif +#endif + +#ifdef UNICODE +#define SetCurrentDirectory SetCurrentDirectoryW +#define GetCurrentDirectory GetCurrentDirectoryW +#define SetDllDirectory SetDllDirectoryW +#define GetDllDirectory GetDllDirectoryW +#define GetDiskFreeSpace GetDiskFreeSpaceW +#define GetDiskFreeSpaceEx GetDiskFreeSpaceExW +#define CreateDirectory CreateDirectoryW +#define CreateDirectoryEx CreateDirectoryExW +#define RemoveDirectory RemoveDirectoryW +#define GetFullPathName GetFullPathNameW +#define DefineDosDevice DefineDosDeviceW +#define QueryDosDevice QueryDosDeviceW +#define CreateFile CreateFileW +#define SetFileAttributes SetFileAttributesW +#define GetFileAttributes GetFileAttributesW +#else +#define SetCurrentDirectory SetCurrentDirectoryA +#define GetCurrentDirectory GetCurrentDirectoryA +#define SetDllDirectory SetDllDirectoryA +#define GetDllDirectory GetDllDirectoryA +#define GetDiskFreeSpace GetDiskFreeSpaceA +#define GetDiskFreeSpaceEx GetDiskFreeSpaceExA +#define CreateDirectory CreateDirectoryA +#define CreateDirectoryEx CreateDirectoryExA +#define RemoveDirectory RemoveDirectoryA +#define GetFullPathName GetFullPathNameA +#define DefineDosDevice DefineDosDeviceA +#define QueryDosDevice QueryDosDeviceA +#define CreateFile CreateFileA +#define SetFileAttributes SetFileAttributesA +#define GetFileAttributes GetFileAttributesA +#endif + + WINBASEAPI WINBOOL WINAPI SetCurrentDirectoryA(LPCSTR lpPathName); + WINBASEAPI WINBOOL WINAPI SetCurrentDirectoryW(LPCWSTR lpPathName); + WINBASEAPI DWORD WINAPI GetCurrentDirectoryA(DWORD nBufferLength,LPSTR lpBuffer); + WINBASEAPI DWORD WINAPI GetCurrentDirectoryW(DWORD nBufferLength,LPWSTR lpBuffer); + WINBASEAPI WINBOOL WINAPI SetDllDirectoryA(LPCSTR lpPathName); + WINBASEAPI WINBOOL WINAPI SetDllDirectoryW(LPCWSTR lpPathName); + WINBASEAPI DWORD WINAPI GetDllDirectoryA(DWORD nBufferLength,LPSTR lpBuffer); + WINBASEAPI DWORD WINAPI GetDllDirectoryW(DWORD nBufferLength,LPWSTR lpBuffer); + WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceA(LPCSTR lpRootPathName,LPDWORD lpSectorsPerCluster,LPDWORD lpBytesPerSector,LPDWORD lpNumberOfFreeClusters,LPDWORD lpTotalNumberOfClusters); + WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceW(LPCWSTR lpRootPathName,LPDWORD lpSectorsPerCluster,LPDWORD lpBytesPerSector,LPDWORD lpNumberOfFreeClusters,LPDWORD lpTotalNumberOfClusters); + WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceExA(LPCSTR lpDirectoryName,PULARGE_INTEGER lpFreeBytesAvailableToCaller,PULARGE_INTEGER lpTotalNumberOfBytes,PULARGE_INTEGER lpTotalNumberOfFreeBytes); + WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceExW(LPCWSTR lpDirectoryName,PULARGE_INTEGER lpFreeBytesAvailableToCaller,PULARGE_INTEGER lpTotalNumberOfBytes,PULARGE_INTEGER lpTotalNumberOfFreeBytes); + WINBASEAPI WINBOOL WINAPI CreateDirectoryA(LPCSTR lpPathName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI CreateDirectoryW(LPCWSTR lpPathName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI CreateDirectoryExA(LPCSTR lpTemplateDirectory,LPCSTR lpNewDirectory,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI CreateDirectoryExW(LPCWSTR lpTemplateDirectory,LPCWSTR lpNewDirectory,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI RemoveDirectoryA(LPCSTR lpPathName); + WINBASEAPI WINBOOL WINAPI RemoveDirectoryW(LPCWSTR lpPathName); + WINBASEAPI DWORD WINAPI GetFullPathNameA(LPCSTR lpFileName,DWORD nBufferLength,LPSTR lpBuffer,LPSTR *lpFilePart); + WINBASEAPI DWORD WINAPI GetFullPathNameW(LPCWSTR lpFileName,DWORD nBufferLength,LPWSTR lpBuffer,LPWSTR *lpFilePart); + +#define DDD_RAW_TARGET_PATH 0x1 +#define DDD_REMOVE_DEFINITION 0x2 +#define DDD_EXACT_MATCH_ON_REMOVE 0x4 +#define DDD_NO_BROADCAST_SYSTEM 0x8 +#define DDD_LUID_BROADCAST_DRIVE 0x10 + + WINBASEAPI WINBOOL WINAPI DefineDosDeviceA(DWORD dwFlags,LPCSTR lpDeviceName,LPCSTR lpTargetPath); + WINBASEAPI WINBOOL WINAPI DefineDosDeviceW(DWORD dwFlags,LPCWSTR lpDeviceName,LPCWSTR lpTargetPath); + WINBASEAPI DWORD WINAPI QueryDosDeviceA(LPCSTR lpDeviceName,LPSTR lpTargetPath,DWORD ucchMax); + WINBASEAPI DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName,LPWSTR lpTargetPath,DWORD ucchMax); + +#define EXPAND_LOCAL_DRIVES + + WINBASEAPI HANDLE WINAPI CreateFileA(LPCSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition,DWORD dwFlagsAndAttributes,HANDLE hTemplateFile); + WINBASEAPI HANDLE WINAPI CreateFileW(LPCWSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition,DWORD dwFlagsAndAttributes,HANDLE hTemplateFile); + WINBASEAPI HANDLE WINAPI ReOpenFile(HANDLE hOriginalFile,DWORD dwDesiredAccess,DWORD dwShareMode,DWORD dwFlagsAndAttributes); + WINBASEAPI WINBOOL WINAPI SetFileAttributesA(LPCSTR lpFileName,DWORD dwFileAttributes); + WINBASEAPI WINBOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName,DWORD dwFileAttributes); + WINBASEAPI DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName); + WINBASEAPI DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName); + + typedef enum _GET_FILEEX_INFO_LEVELS { + GetFileExInfoStandard,GetFileExMaxInfoLevel + } GET_FILEEX_INFO_LEVELS; + +#ifdef UNICODE +#define GetFileAttributesEx GetFileAttributesExW +#define GetCompressedFileSize GetCompressedFileSizeW +#define DeleteFile DeleteFileW +#define CheckNameLegalDOS8Dot3 CheckNameLegalDOS8Dot3W +#else +#define GetFileAttributesEx GetFileAttributesExA +#define GetCompressedFileSize GetCompressedFileSizeA +#define DeleteFile DeleteFileA +#define CheckNameLegalDOS8Dot3 CheckNameLegalDOS8Dot3A +#endif + + WINBASEAPI WINBOOL WINAPI GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation); + WINBASEAPI WINBOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation); + WINBASEAPI DWORD WINAPI GetCompressedFileSizeA(LPCSTR lpFileName,LPDWORD lpFileSizeHigh); + WINBASEAPI DWORD WINAPI GetCompressedFileSizeW(LPCWSTR lpFileName,LPDWORD lpFileSizeHigh); + WINBASEAPI WINBOOL WINAPI DeleteFileA(LPCSTR lpFileName); + WINBASEAPI WINBOOL WINAPI DeleteFileW(LPCWSTR lpFileName); + WINBASEAPI WINBOOL WINAPI CheckNameLegalDOS8Dot3A(LPCSTR lpName,LPSTR lpOemName,DWORD OemNameSize,PBOOL pbNameContainsSpaces,PBOOL pbNameLegal); + WINBASEAPI WINBOOL WINAPI CheckNameLegalDOS8Dot3W(LPCWSTR lpName,LPSTR lpOemName,DWORD OemNameSize,PBOOL pbNameContainsSpaces,PBOOL pbNameLegal); + + typedef enum _FINDEX_INFO_LEVELS { + FindExInfoStandard,FindExInfoMaxInfoLevel + } FINDEX_INFO_LEVELS; + + typedef enum _FINDEX_SEARCH_OPS { + FindExSearchNameMatch,FindExSearchLimitToDirectories,FindExSearchLimitToDevices,FindExSearchMaxSearchOp + } FINDEX_SEARCH_OPS; + +#define FIND_FIRST_EX_CASE_SENSITIVE 0x1 + +#ifdef UNICODE +#define FindFirstFileEx FindFirstFileExW +#define FindFirstFile FindFirstFileW +#define FindNextFile FindNextFileW +#define SearchPath SearchPathW +#define CopyFile CopyFileW +#define CopyFileEx CopyFileExW +#define MoveFile MoveFileW +#define MoveFileEx MoveFileExW +#define MoveFileWithProgress MoveFileWithProgressW +#define ReplaceFile ReplaceFileW +#define CreateHardLink CreateHardLinkW +#define CreateNamedPipe CreateNamedPipeW +#define GetNamedPipeHandleState GetNamedPipeHandleStateW +#define CallNamedPipe CallNamedPipeW +#define WaitNamedPipe WaitNamedPipeW +#define SetVolumeLabel SetVolumeLabelW +#define GetVolumeInformation GetVolumeInformationW +#define ClearEventLog ClearEventLogW +#define BackupEventLog BackupEventLogW +#define OpenEventLog OpenEventLogW +#define RegisterEventSource RegisterEventSourceW +#define OpenBackupEventLog OpenBackupEventLogW +#define ReadEventLog ReadEventLogW +#define ReportEvent ReportEventW +#define AccessCheckAndAuditAlarm AccessCheckAndAuditAlarmW +#define AccessCheckByTypeAndAuditAlarm AccessCheckByTypeAndAuditAlarmW +#define AccessCheckByTypeResultListAndAuditAlarm AccessCheckByTypeResultListAndAuditAlarmW +#define AccessCheckByTypeResultListAndAuditAlarmByHandle AccessCheckByTypeResultListAndAuditAlarmByHandleW +#define ObjectOpenAuditAlarm ObjectOpenAuditAlarmW +#define ObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmW +#define ObjectCloseAuditAlarm ObjectCloseAuditAlarmW +#define ObjectDeleteAuditAlarm ObjectDeleteAuditAlarmW +#define PrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmW +#define SetFileSecurity SetFileSecurityW +#define GetFileSecurity GetFileSecurityW +#define FindFirstChangeNotification FindFirstChangeNotificationW +#define IsBadStringPtr IsBadStringPtrW +#define LookupAccountSid LookupAccountSidW +#define LookupAccountName LookupAccountNameW +#define LookupPrivilegeValue LookupPrivilegeValueW +#define LookupPrivilegeName LookupPrivilegeNameW +#define LookupPrivilegeDisplayName LookupPrivilegeDisplayNameW +#define BuildCommDCB BuildCommDCBW +#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsW +#define CommConfigDialog CommConfigDialogW +#define GetDefaultCommConfig GetDefaultCommConfigW +#define SetDefaultCommConfig SetDefaultCommConfigW +#define GetComputerName GetComputerNameW +#define SetComputerName SetComputerNameW +#define GetComputerNameEx GetComputerNameExW +#define SetComputerNameEx SetComputerNameExW +#define DnsHostnameToComputerName DnsHostnameToComputerNameW +#define GetUserName GetUserNameW +#else +#define FindFirstFileEx FindFirstFileExA +#define FindFirstFile FindFirstFileA +#define FindNextFile FindNextFileA +#define SearchPath SearchPathA +#define CopyFile CopyFileA +#define CopyFileEx CopyFileExA +#define MoveFile MoveFileA +#define MoveFileEx MoveFileExA +#define MoveFileWithProgress MoveFileWithProgressA +#define ReplaceFile ReplaceFileA +#define CreateHardLink CreateHardLinkA +#define CreateNamedPipe CreateNamedPipeA +#define GetNamedPipeHandleState GetNamedPipeHandleStateA +#define CallNamedPipe CallNamedPipeA +#define WaitNamedPipe WaitNamedPipeA +#define SetVolumeLabel SetVolumeLabelA +#define GetVolumeInformation GetVolumeInformationA +#define ClearEventLog ClearEventLogA +#define BackupEventLog BackupEventLogA +#define OpenEventLog OpenEventLogA +#define RegisterEventSource RegisterEventSourceA +#define OpenBackupEventLog OpenBackupEventLogA +#define ReadEventLog ReadEventLogA +#define ReportEvent ReportEventA +#define AccessCheckAndAuditAlarm AccessCheckAndAuditAlarmA +#define AccessCheckByTypeAndAuditAlarm AccessCheckByTypeAndAuditAlarmA +#define AccessCheckByTypeResultListAndAuditAlarm AccessCheckByTypeResultListAndAuditAlarmA +#define AccessCheckByTypeResultListAndAuditAlarmByHandle AccessCheckByTypeResultListAndAuditAlarmByHandleA +#define ObjectOpenAuditAlarm ObjectOpenAuditAlarmA +#define ObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmA +#define ObjectCloseAuditAlarm ObjectCloseAuditAlarmA +#define ObjectDeleteAuditAlarm ObjectDeleteAuditAlarmA +#define PrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmA +#define SetFileSecurity SetFileSecurityA +#define GetFileSecurity GetFileSecurityA +#define FindFirstChangeNotification FindFirstChangeNotificationA +#define IsBadStringPtr IsBadStringPtrA +#define LookupAccountSid LookupAccountSidA +#define LookupAccountName LookupAccountNameA +#define LookupPrivilegeValue LookupPrivilegeValueA +#define LookupPrivilegeName LookupPrivilegeNameA +#define LookupPrivilegeDisplayName LookupPrivilegeDisplayNameA +#define BuildCommDCB BuildCommDCBA +#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsA +#define CommConfigDialog CommConfigDialogA +#define GetDefaultCommConfig GetDefaultCommConfigA +#define SetDefaultCommConfig SetDefaultCommConfigA +#define GetComputerName GetComputerNameA +#define SetComputerName SetComputerNameA +#define GetComputerNameEx GetComputerNameExA +#define SetComputerNameEx SetComputerNameExA +#define DnsHostnameToComputerName DnsHostnameToComputerNameA +#define GetUserName GetUserNameA +#endif + + WINBASEAPI HANDLE WINAPI FindFirstFileExA(LPCSTR lpFileName,FINDEX_INFO_LEVELS fInfoLevelId,LPVOID lpFindFileData,FINDEX_SEARCH_OPS fSearchOp,LPVOID lpSearchFilter,DWORD dwAdditionalFlags); + WINBASEAPI HANDLE WINAPI FindFirstFileExW(LPCWSTR lpFileName,FINDEX_INFO_LEVELS fInfoLevelId,LPVOID lpFindFileData,FINDEX_SEARCH_OPS fSearchOp,LPVOID lpSearchFilter,DWORD dwAdditionalFlags); + WINBASEAPI HANDLE WINAPI FindFirstFileA(LPCSTR lpFileName,LPWIN32_FIND_DATAA lpFindFileData); + WINBASEAPI HANDLE WINAPI FindFirstFileW(LPCWSTR lpFileName,LPWIN32_FIND_DATAW lpFindFileData); + WINBASEAPI WINBOOL WINAPI FindNextFileA(HANDLE hFindFile,LPWIN32_FIND_DATAA lpFindFileData); + WINBASEAPI WINBOOL WINAPI FindNextFileW(HANDLE hFindFile,LPWIN32_FIND_DATAW lpFindFileData); + WINBASEAPI DWORD WINAPI SearchPathA(LPCSTR lpPath,LPCSTR lpFileName,LPCSTR lpExtension,DWORD nBufferLength,LPSTR lpBuffer,LPSTR *lpFilePart); + WINBASEAPI DWORD WINAPI SearchPathW(LPCWSTR lpPath,LPCWSTR lpFileName,LPCWSTR lpExtension,DWORD nBufferLength,LPWSTR lpBuffer,LPWSTR *lpFilePart); + WINBASEAPI WINBOOL WINAPI CopyFileA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,WINBOOL bFailIfExists); + WINBASEAPI WINBOOL WINAPI CopyFileW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,WINBOOL bFailIfExists); + + typedef DWORD (WINAPI *LPPROGRESS_ROUTINE)(LARGE_INTEGER TotalFileSize,LARGE_INTEGER TotalBytesTransferred,LARGE_INTEGER StreamSize,LARGE_INTEGER StreamBytesTransferred,DWORD dwStreamNumber,DWORD dwCallbackReason,HANDLE hSourceFile,HANDLE hDestinationFile,LPVOID lpData); + + WINBASEAPI WINBOOL WINAPI CopyFileExA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,LPBOOL pbCancel,DWORD dwCopyFlags); + WINBASEAPI WINBOOL WINAPI CopyFileExW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,LPBOOL pbCancel,DWORD dwCopyFlags); + WINBASEAPI WINBOOL WINAPI MoveFileA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName); + WINBASEAPI WINBOOL WINAPI MoveFileW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName); + WINBASEAPI WINBOOL WINAPI MoveFileExA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI MoveFileExW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI MoveFileWithProgressA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,DWORD dwFlags); + WINBASEAPI WINBOOL WINAPI MoveFileWithProgressW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,DWORD dwFlags); + +#define MOVEFILE_REPLACE_EXISTING 0x1 +#define MOVEFILE_COPY_ALLOWED 0x2 +#define MOVEFILE_DELAY_UNTIL_REBOOT 0x4 +#define MOVEFILE_WRITE_THROUGH 0x8 +#define MOVEFILE_CREATE_HARDLINK 0x10 +#define MOVEFILE_FAIL_IF_NOT_TRACKABLE 0x20 + + WINBASEAPI WINBOOL WINAPI ReplaceFileA(LPCSTR lpReplacedFileName,LPCSTR lpReplacementFileName,LPCSTR lpBackupFileName,DWORD dwReplaceFlags,LPVOID lpExclude,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI ReplaceFileW(LPCWSTR lpReplacedFileName,LPCWSTR lpReplacementFileName,LPCWSTR lpBackupFileName,DWORD dwReplaceFlags,LPVOID lpExclude,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI CreateHardLinkA(LPCSTR lpFileName,LPCSTR lpExistingFileName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI CreateHardLinkW(LPCWSTR lpFileName,LPCWSTR lpExistingFileName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + + typedef enum _STREAM_INFO_LEVELS { + FindStreamInfoStandard,FindStreamInfoMaxInfoLevel + } STREAM_INFO_LEVELS; + + typedef struct _WIN32_FIND_STREAM_DATA { + LARGE_INTEGER StreamSize; + WCHAR cStreamName[MAX_PATH + 36]; + } WIN32_FIND_STREAM_DATA,*PWIN32_FIND_STREAM_DATA; + + HANDLE WINAPI FindFirstStreamW(LPCWSTR lpFileName,STREAM_INFO_LEVELS InfoLevel,LPVOID lpFindStreamData,DWORD dwFlags); + WINBOOL WINAPI FindNextStreamW(HANDLE hFindStream,LPVOID lpFindStreamData); + WINBASEAPI HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName,DWORD dwOpenMode,DWORD dwPipeMode,DWORD nMaxInstances,DWORD nOutBufferSize,DWORD nInBufferSize,DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI HANDLE WINAPI CreateNamedPipeW(LPCWSTR lpName,DWORD dwOpenMode,DWORD dwPipeMode,DWORD nMaxInstances,DWORD nOutBufferSize,DWORD nInBufferSize,DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateA(HANDLE hNamedPipe,LPDWORD lpState,LPDWORD lpCurInstances,LPDWORD lpMaxCollectionCount,LPDWORD lpCollectDataTimeout,LPSTR lpUserName,DWORD nMaxUserNameSize); + WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateW(HANDLE hNamedPipe,LPDWORD lpState,LPDWORD lpCurInstances,LPDWORD lpMaxCollectionCount,LPDWORD lpCollectDataTimeout,LPWSTR lpUserName,DWORD nMaxUserNameSize); + WINBASEAPI WINBOOL WINAPI CallNamedPipeA(LPCSTR lpNamedPipeName,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesRead,DWORD nTimeOut); + WINBASEAPI WINBOOL WINAPI CallNamedPipeW(LPCWSTR lpNamedPipeName,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesRead,DWORD nTimeOut); + WINBASEAPI WINBOOL WINAPI WaitNamedPipeA(LPCSTR lpNamedPipeName,DWORD nTimeOut); + WINBASEAPI WINBOOL WINAPI WaitNamedPipeW(LPCWSTR lpNamedPipeName,DWORD nTimeOut); + WINBASEAPI WINBOOL WINAPI SetVolumeLabelA(LPCSTR lpRootPathName,LPCSTR lpVolumeName); + WINBASEAPI WINBOOL WINAPI SetVolumeLabelW(LPCWSTR lpRootPathName,LPCWSTR lpVolumeName); + WINBASEAPI VOID WINAPI SetFileApisToOEM(VOID); + WINBASEAPI VOID WINAPI SetFileApisToANSI(VOID); + WINBASEAPI WINBOOL WINAPI AreFileApisANSI(VOID); + WINBASEAPI WINBOOL WINAPI GetVolumeInformationA(LPCSTR lpRootPathName,LPSTR lpVolumeNameBuffer,DWORD nVolumeNameSize,LPDWORD lpVolumeSerialNumber,LPDWORD lpMaximumComponentLength,LPDWORD lpFileSystemFlags,LPSTR lpFileSystemNameBuffer,DWORD nFileSystemNameSize); + WINBASEAPI WINBOOL WINAPI GetVolumeInformationW(LPCWSTR lpRootPathName,LPWSTR lpVolumeNameBuffer,DWORD nVolumeNameSize,LPDWORD lpVolumeSerialNumber,LPDWORD lpMaximumComponentLength,LPDWORD lpFileSystemFlags,LPWSTR lpFileSystemNameBuffer,DWORD nFileSystemNameSize); + WINBASEAPI WINBOOL WINAPI CancelIo(HANDLE hFile); + WINADVAPI WINBOOL WINAPI ClearEventLogA(HANDLE hEventLog,LPCSTR lpBackupFileName); + WINADVAPI WINBOOL WINAPI ClearEventLogW(HANDLE hEventLog,LPCWSTR lpBackupFileName); + WINADVAPI WINBOOL WINAPI BackupEventLogA(HANDLE hEventLog,LPCSTR lpBackupFileName); + WINADVAPI WINBOOL WINAPI BackupEventLogW(HANDLE hEventLog,LPCWSTR lpBackupFileName); + WINADVAPI WINBOOL WINAPI CloseEventLog(HANDLE hEventLog); + WINADVAPI WINBOOL WINAPI DeregisterEventSource(HANDLE hEventLog); + WINADVAPI WINBOOL WINAPI NotifyChangeEventLog(HANDLE hEventLog,HANDLE hEvent); + WINADVAPI WINBOOL WINAPI GetNumberOfEventLogRecords(HANDLE hEventLog,PDWORD NumberOfRecords); + WINADVAPI WINBOOL WINAPI GetOldestEventLogRecord(HANDLE hEventLog,PDWORD OldestRecord); + WINADVAPI HANDLE WINAPI OpenEventLogA(LPCSTR lpUNCServerName,LPCSTR lpSourceName); + WINADVAPI HANDLE WINAPI OpenEventLogW(LPCWSTR lpUNCServerName,LPCWSTR lpSourceName); + WINADVAPI HANDLE WINAPI RegisterEventSourceA(LPCSTR lpUNCServerName,LPCSTR lpSourceName); + WINADVAPI HANDLE WINAPI RegisterEventSourceW(LPCWSTR lpUNCServerName,LPCWSTR lpSourceName); + WINADVAPI HANDLE WINAPI OpenBackupEventLogA(LPCSTR lpUNCServerName,LPCSTR lpFileName); + WINADVAPI HANDLE WINAPI OpenBackupEventLogW(LPCWSTR lpUNCServerName,LPCWSTR lpFileName); + WINADVAPI WINBOOL WINAPI ReadEventLogA(HANDLE hEventLog,DWORD dwReadFlags,DWORD dwRecordOffset,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,DWORD *pnBytesRead,DWORD *pnMinNumberOfBytesNeeded); + WINADVAPI WINBOOL WINAPI ReadEventLogW(HANDLE hEventLog,DWORD dwReadFlags,DWORD dwRecordOffset,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,DWORD *pnBytesRead,DWORD *pnMinNumberOfBytesNeeded); + WINADVAPI WINBOOL WINAPI ReportEventA(HANDLE hEventLog,WORD wType,WORD wCategory,DWORD dwEventID,PSID lpUserSid,WORD wNumStrings,DWORD dwDataSize,LPCSTR *lpStrings,LPVOID lpRawData); + WINADVAPI WINBOOL WINAPI ReportEventW(HANDLE hEventLog,WORD wType,WORD wCategory,DWORD dwEventID,PSID lpUserSid,WORD wNumStrings,DWORD dwDataSize,LPCWSTR *lpStrings,LPVOID lpRawData); + +#define EVENTLOG_FULL_INFO 0 + + typedef struct _EVENTLOG_FULL_INFORMATION { + DWORD dwFull; + } EVENTLOG_FULL_INFORMATION,*LPEVENTLOG_FULL_INFORMATION; + + WINADVAPI WINBOOL WINAPI GetEventLogInformation(HANDLE hEventLog,DWORD dwInfoLevel,LPVOID lpBuffer,DWORD cbBufSize,LPDWORD pcbBytesNeeded); + WINADVAPI WINBOOL WINAPI DuplicateToken(HANDLE ExistingTokenHandle,SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,PHANDLE DuplicateTokenHandle); + WINADVAPI WINBOOL WINAPI GetKernelObjectSecurity(HANDLE Handle,SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD nLength,LPDWORD lpnLengthNeeded); + WINADVAPI WINBOOL WINAPI ImpersonateNamedPipeClient(HANDLE hNamedPipe); + WINADVAPI WINBOOL WINAPI ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel); + WINADVAPI WINBOOL WINAPI RevertToSelf(VOID); + WINADVAPI WINBOOL WINAPI SetThreadToken (PHANDLE Thread,HANDLE Token); + WINADVAPI WINBOOL WINAPI AccessCheck(PSECURITY_DESCRIPTOR pSecurityDescriptor,HANDLE ClientToken,DWORD DesiredAccess,PGENERIC_MAPPING GenericMapping,PPRIVILEGE_SET PrivilegeSet,LPDWORD PrivilegeSetLength,LPDWORD GrantedAccess,LPBOOL AccessStatus); + WINADVAPI WINBOOL WINAPI AccessCheckByType(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID PrincipalSelfSid,HANDLE ClientToken,DWORD DesiredAccess,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,PPRIVILEGE_SET PrivilegeSet,LPDWORD PrivilegeSetLength,LPDWORD GrantedAccess,LPBOOL AccessStatus); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultList(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID PrincipalSelfSid,HANDLE ClientToken,DWORD DesiredAccess,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,PPRIVILEGE_SET PrivilegeSet,LPDWORD PrivilegeSetLength,LPDWORD GrantedAccessList,LPDWORD AccessStatusList); + WINADVAPI WINBOOL WINAPI OpenProcessToken(HANDLE ProcessHandle,DWORD DesiredAccess,PHANDLE TokenHandle); + WINADVAPI WINBOOL WINAPI OpenThreadToken(HANDLE ThreadHandle,DWORD DesiredAccess,WINBOOL OpenAsSelf,PHANDLE TokenHandle); + WINADVAPI WINBOOL WINAPI GetTokenInformation(HANDLE TokenHandle,TOKEN_INFORMATION_CLASS TokenInformationClass,LPVOID TokenInformation,DWORD TokenInformationLength,PDWORD ReturnLength); + WINADVAPI WINBOOL WINAPI SetTokenInformation(HANDLE TokenHandle,TOKEN_INFORMATION_CLASS TokenInformationClass,LPVOID TokenInformation,DWORD TokenInformationLength); + WINADVAPI WINBOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle,WINBOOL DisableAllPrivileges,PTOKEN_PRIVILEGES NewState,DWORD BufferLength,PTOKEN_PRIVILEGES PreviousState,PDWORD ReturnLength); + WINADVAPI WINBOOL WINAPI AdjustTokenGroups(HANDLE TokenHandle,WINBOOL ResetToDefault,PTOKEN_GROUPS NewState,DWORD BufferLength,PTOKEN_GROUPS PreviousState,PDWORD ReturnLength); + WINADVAPI WINBOOL WINAPI PrivilegeCheck(HANDLE ClientToken,PPRIVILEGE_SET RequiredPrivileges,LPBOOL pfResult); + WINADVAPI WINBOOL WINAPI AccessCheckAndAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPSTR ObjectTypeName,LPSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,DWORD DesiredAccess,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckAndAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPWSTR ObjectTypeName,LPWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,DWORD DesiredAccess,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeAndAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPCSTR ObjectTypeName,LPCSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeAndAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPCWSTR ObjectTypeName,LPCWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPCSTR ObjectTypeName,LPCSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPCWSTR ObjectTypeName,LPCWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmByHandleA(LPCSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,LPCSTR ObjectTypeName,LPCSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmByHandleW(LPCWSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,LPCWSTR ObjectTypeName,LPCWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectOpenAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPSTR ObjectTypeName,LPSTR ObjectName,PSECURITY_DESCRIPTOR pSecurityDescriptor,HANDLE ClientToken,DWORD DesiredAccess,DWORD GrantedAccess,PPRIVILEGE_SET Privileges,WINBOOL ObjectCreation,WINBOOL AccessGranted,LPBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectOpenAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPWSTR ObjectTypeName,LPWSTR ObjectName,PSECURITY_DESCRIPTOR pSecurityDescriptor,HANDLE ClientToken,DWORD DesiredAccess,DWORD GrantedAccess,PPRIVILEGE_SET Privileges,WINBOOL ObjectCreation,WINBOOL AccessGranted,LPBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectPrivilegeAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,DWORD DesiredAccess,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); + WINADVAPI WINBOOL WINAPI ObjectPrivilegeAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,DWORD DesiredAccess,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); + WINADVAPI WINBOOL WINAPI ObjectCloseAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectCloseAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectDeleteAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI ObjectDeleteAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); + WINADVAPI WINBOOL WINAPI PrivilegedServiceAuditAlarmA(LPCSTR SubsystemName,LPCSTR ServiceName,HANDLE ClientToken,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); + WINADVAPI WINBOOL WINAPI PrivilegedServiceAuditAlarmW(LPCWSTR SubsystemName,LPCWSTR ServiceName,HANDLE ClientToken,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); + WINADVAPI WINBOOL WINAPI IsWellKnownSid(PSID pSid,WELL_KNOWN_SID_TYPE WellKnownSidType); + WINADVAPI WINBOOL WINAPI CreateWellKnownSid(WELL_KNOWN_SID_TYPE WellKnownSidType,PSID DomainSid,PSID pSid,DWORD *cbSid); + WINADVAPI WINBOOL WINAPI EqualDomainSid(PSID pSid1,PSID pSid2,WINBOOL *pfEqual); + WINADVAPI WINBOOL WINAPI GetWindowsAccountDomainSid(PSID pSid,PSID pDomainSid,DWORD *cbDomainSid); + WINADVAPI WINBOOL WINAPI IsValidSid(PSID pSid); + WINADVAPI WINBOOL WINAPI EqualSid(PSID pSid1,PSID pSid2); + WINADVAPI WINBOOL WINAPI EqualPrefixSid(PSID pSid1,PSID pSid2); + WINADVAPI DWORD WINAPI GetSidLengthRequired (UCHAR nSubAuthorityCount); + WINADVAPI WINBOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,BYTE nSubAuthorityCount,DWORD nSubAuthority0,DWORD nSubAuthority1,DWORD nSubAuthority2,DWORD nSubAuthority3,DWORD nSubAuthority4,DWORD nSubAuthority5,DWORD nSubAuthority6,DWORD nSubAuthority7,PSID *pSid); + WINADVAPI PVOID WINAPI FreeSid(PSID pSid); + WINADVAPI WINBOOL WINAPI InitializeSid(PSID Sid,PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,BYTE nSubAuthorityCount); + WINADVAPI PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID pSid); + WINADVAPI PDWORD WINAPI GetSidSubAuthority(PSID pSid,DWORD nSubAuthority); + WINADVAPI PUCHAR WINAPI GetSidSubAuthorityCount(PSID pSid); + WINADVAPI DWORD WINAPI GetLengthSid(PSID pSid); + WINADVAPI WINBOOL WINAPI CopySid(DWORD nDestinationSidLength,PSID pDestinationSid,PSID pSourceSid); + WINADVAPI WINBOOL WINAPI AreAllAccessesGranted(DWORD GrantedAccess,DWORD DesiredAccess); + WINADVAPI WINBOOL WINAPI AreAnyAccessesGranted(DWORD GrantedAccess,DWORD DesiredAccess); + WINADVAPI VOID WINAPI MapGenericMask(PDWORD AccessMask,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI IsValidAcl(PACL pAcl); + WINADVAPI WINBOOL WINAPI InitializeAcl(PACL pAcl,DWORD nAclLength,DWORD dwAclRevision); + WINADVAPI WINBOOL WINAPI GetAclInformation(PACL pAcl,LPVOID pAclInformation,DWORD nAclInformationLength,ACL_INFORMATION_CLASS dwAclInformationClass); + WINADVAPI WINBOOL WINAPI SetAclInformation(PACL pAcl,LPVOID pAclInformation,DWORD nAclInformationLength,ACL_INFORMATION_CLASS dwAclInformationClass); + WINADVAPI WINBOOL WINAPI AddAce(PACL pAcl,DWORD dwAceRevision,DWORD dwStartingAceIndex,LPVOID pAceList,DWORD nAceListLength); + WINADVAPI WINBOOL WINAPI DeleteAce(PACL pAcl,DWORD dwAceIndex); + WINADVAPI WINBOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce); + WINADVAPI WINBOOL WINAPI AddAccessAllowedAce(PACL pAcl,DWORD dwAceRevision,DWORD AccessMask,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAccessAllowedAceEx(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAccessDeniedAce(PACL pAcl,DWORD dwAceRevision,DWORD AccessMask,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAccessDeniedAceEx(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAuditAccessAce(PACL pAcl,DWORD dwAceRevision,DWORD dwAccessMask,PSID pSid,WINBOOL bAuditSuccess,WINBOOL bAuditFailure); + WINADVAPI WINBOOL WINAPI AddAuditAccessAceEx(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD dwAccessMask,PSID pSid,WINBOOL bAuditSuccess,WINBOOL bAuditFailure); + WINADVAPI WINBOOL WINAPI AddAccessAllowedObjectAce(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,GUID *ObjectTypeGuid,GUID *InheritedObjectTypeGuid,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAccessDeniedObjectAce(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,GUID *ObjectTypeGuid,GUID *InheritedObjectTypeGuid,PSID pSid); + WINADVAPI WINBOOL WINAPI AddAuditAccessObjectAce(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,GUID *ObjectTypeGuid,GUID *InheritedObjectTypeGuid,PSID pSid,WINBOOL bAuditSuccess,WINBOOL bAuditFailure); + WINADVAPI WINBOOL WINAPI FindFirstFreeAce(PACL pAcl,LPVOID *pAce); + WINADVAPI WINBOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD dwRevision); + WINADVAPI WINBOOL WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI DWORD WINAPI GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSECURITY_DESCRIPTOR_CONTROL pControl,LPDWORD lpdwRevision); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,WINBOOL bDaclPresent,PACL pDacl,WINBOOL bDaclDefaulted); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,LPBOOL lpbDaclPresent,PACL *pDacl,LPBOOL lpbDaclDefaulted); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,WINBOOL bSaclPresent,PACL pSacl,WINBOOL bSaclDefaulted); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,LPBOOL lpbSaclPresent,PACL *pSacl,LPBOOL lpbSaclDefaulted); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID pOwner,WINBOOL bOwnerDefaulted); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID *pOwner,LPBOOL lpbOwnerDefaulted); + WINADVAPI WINBOOL WINAPI SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID pGroup,WINBOOL bGroupDefaulted); + WINADVAPI WINBOOL WINAPI GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID *pGroup,LPBOOL lpbGroupDefaulted); + WINADVAPI DWORD WINAPI SetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,PUCHAR RMControl); + WINADVAPI DWORD WINAPI GetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,PUCHAR RMControl); + WINADVAPI WINBOOL WINAPI CreatePrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CreatorDescriptor,PSECURITY_DESCRIPTOR *NewDescriptor,WINBOOL IsDirectoryObject,HANDLE Token,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI ConvertToAutoInheritPrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CurrentSecurityDescriptor,PSECURITY_DESCRIPTOR *NewSecurityDescriptor,GUID *ObjectType,BOOLEAN IsDirectoryObject,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI CreatePrivateObjectSecurityEx(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CreatorDescriptor,PSECURITY_DESCRIPTOR *NewDescriptor,GUID *ObjectType,WINBOOL IsContainerObject,ULONG AutoInheritFlags,HANDLE Token,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI CreatePrivateObjectSecurityWithMultipleInheritance(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CreatorDescriptor,PSECURITY_DESCRIPTOR *NewDescriptor,GUID **ObjectTypes,ULONG GuidCount,WINBOOL IsContainerObject,ULONG AutoInheritFlags,HANDLE Token,PGENERIC_MAPPING GenericMapping); + WINADVAPI WINBOOL WINAPI SetPrivateObjectSecurity (SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR ModificationDescriptor,PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,PGENERIC_MAPPING GenericMapping,HANDLE Token); + WINADVAPI WINBOOL WINAPI SetPrivateObjectSecurityEx (SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR ModificationDescriptor,PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,ULONG AutoInheritFlags,PGENERIC_MAPPING GenericMapping,HANDLE Token); + WINADVAPI WINBOOL WINAPI GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR ResultantDescriptor,DWORD DescriptorLength,PDWORD ReturnLength); + WINADVAPI WINBOOL WINAPI DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR *ObjectDescriptor); + WINADVAPI WINBOOL WINAPI MakeSelfRelativeSD(PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,LPDWORD lpdwBufferLength); + WINADVAPI WINBOOL WINAPI MakeAbsoluteSD(PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,LPDWORD lpdwAbsoluteSecurityDescriptorSize,PACL pDacl,LPDWORD lpdwDaclSize,PACL pSacl,LPDWORD lpdwSaclSize,PSID pOwner,LPDWORD lpdwOwnerSize,PSID pPrimaryGroup,LPDWORD lpdwPrimaryGroupSize); + WINADVAPI WINBOOL WINAPI MakeAbsoluteSD2(PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,LPDWORD lpdwBufferSize); + WINADVAPI WINBOOL WINAPI SetFileSecurityA(LPCSTR lpFileName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI WINBOOL WINAPI SetFileSecurityW(LPCWSTR lpFileName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI WINBOOL WINAPI GetFileSecurityA(LPCSTR lpFileName,SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD nLength,LPDWORD lpnLengthNeeded); + WINADVAPI WINBOOL WINAPI GetFileSecurityW(LPCWSTR lpFileName,SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD nLength,LPDWORD lpnLengthNeeded); + WINADVAPI WINBOOL WINAPI SetKernelObjectSecurity(HANDLE Handle,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR SecurityDescriptor); + WINBASEAPI HANDLE WINAPI FindFirstChangeNotificationA(LPCSTR lpPathName,WINBOOL bWatchSubtree,DWORD dwNotifyFilter); + WINBASEAPI HANDLE WINAPI FindFirstChangeNotificationW(LPCWSTR lpPathName,WINBOOL bWatchSubtree,DWORD dwNotifyFilter); + WINBASEAPI WINBOOL WINAPI FindNextChangeNotification(HANDLE hChangeHandle); + WINBASEAPI WINBOOL WINAPI FindCloseChangeNotification(HANDLE hChangeHandle); + WINBASEAPI WINBOOL WINAPI ReadDirectoryChangesW(HANDLE hDirectory,LPVOID lpBuffer,DWORD nBufferLength,WINBOOL bWatchSubtree,DWORD dwNotifyFilter,LPDWORD lpBytesReturned,LPOVERLAPPED lpOverlapped,LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); + WINBASEAPI WINBOOL WINAPI VirtualLock(LPVOID lpAddress,SIZE_T dwSize); + WINBASEAPI WINBOOL WINAPI VirtualUnlock(LPVOID lpAddress,SIZE_T dwSize); + WINBASEAPI LPVOID WINAPI MapViewOfFileEx(HANDLE hFileMappingObject,DWORD dwDesiredAccess,DWORD dwFileOffsetHigh,DWORD dwFileOffsetLow,SIZE_T dwNumberOfBytesToMap,LPVOID lpBaseAddress); + WINBASEAPI WINBOOL WINAPI SetPriorityClass(HANDLE hProcess,DWORD dwPriorityClass); + WINBASEAPI DWORD WINAPI GetPriorityClass(HANDLE hProcess); + WINBASEAPI WINBOOL WINAPI IsBadReadPtr(CONST VOID *lp,UINT_PTR ucb); + WINBASEAPI WINBOOL WINAPI IsBadWritePtr(LPVOID lp,UINT_PTR ucb); + WINBASEAPI WINBOOL WINAPI IsBadHugeReadPtr(CONST VOID *lp,UINT_PTR ucb); + WINBASEAPI WINBOOL WINAPI IsBadHugeWritePtr(LPVOID lp,UINT_PTR ucb); + WINBASEAPI WINBOOL WINAPI IsBadCodePtr(FARPROC lpfn); + WINBASEAPI WINBOOL WINAPI IsBadStringPtrA(LPCSTR lpsz,UINT_PTR ucchMax); + WINBASEAPI WINBOOL WINAPI IsBadStringPtrW(LPCWSTR lpsz,UINT_PTR ucchMax); + WINADVAPI WINBOOL WINAPI LookupAccountSidA(LPCSTR lpSystemName,PSID Sid,LPSTR Name,LPDWORD cchName,LPSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); + WINADVAPI WINBOOL WINAPI LookupAccountSidW(LPCWSTR lpSystemName,PSID Sid,LPWSTR Name,LPDWORD cchName,LPWSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); + WINADVAPI WINBOOL WINAPI LookupAccountNameA(LPCSTR lpSystemName,LPCSTR lpAccountName,PSID Sid,LPDWORD cbSid,LPSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); + WINADVAPI WINBOOL WINAPI LookupAccountNameW(LPCWSTR lpSystemName,LPCWSTR lpAccountName,PSID Sid,LPDWORD cbSid,LPWSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); + WINADVAPI WINBOOL WINAPI LookupPrivilegeValueA(LPCSTR lpSystemName,LPCSTR lpName,PLUID lpLuid); + WINADVAPI WINBOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName,LPCWSTR lpName,PLUID lpLuid); + WINADVAPI WINBOOL WINAPI LookupPrivilegeNameA(LPCSTR lpSystemName,PLUID lpLuid,LPSTR lpName,LPDWORD cchName); + WINADVAPI WINBOOL WINAPI LookupPrivilegeNameW(LPCWSTR lpSystemName,PLUID lpLuid,LPWSTR lpName,LPDWORD cchName); + WINADVAPI WINBOOL WINAPI LookupPrivilegeDisplayNameA(LPCSTR lpSystemName,LPCSTR lpName,LPSTR lpDisplayName,LPDWORD cchDisplayName,LPDWORD lpLanguageId); + WINADVAPI WINBOOL WINAPI LookupPrivilegeDisplayNameW(LPCWSTR lpSystemName,LPCWSTR lpName,LPWSTR lpDisplayName,LPDWORD cchDisplayName,LPDWORD lpLanguageId); + WINADVAPI WINBOOL WINAPI AllocateLocallyUniqueId(PLUID Luid); + WINBASEAPI WINBOOL WINAPI BuildCommDCBA(LPCSTR lpDef,LPDCB lpDCB); + WINBASEAPI WINBOOL WINAPI BuildCommDCBW(LPCWSTR lpDef,LPDCB lpDCB); + WINBASEAPI WINBOOL WINAPI BuildCommDCBAndTimeoutsA(LPCSTR lpDef,LPDCB lpDCB,LPCOMMTIMEOUTS lpCommTimeouts); + WINBASEAPI WINBOOL WINAPI BuildCommDCBAndTimeoutsW(LPCWSTR lpDef,LPDCB lpDCB,LPCOMMTIMEOUTS lpCommTimeouts); + WINBASEAPI WINBOOL WINAPI CommConfigDialogA(LPCSTR lpszName,HWND hWnd,LPCOMMCONFIG lpCC); + WINBASEAPI WINBOOL WINAPI CommConfigDialogW(LPCWSTR lpszName,HWND hWnd,LPCOMMCONFIG lpCC); + WINBASEAPI WINBOOL WINAPI GetDefaultCommConfigA(LPCSTR lpszName,LPCOMMCONFIG lpCC,LPDWORD lpdwSize); + WINBASEAPI WINBOOL WINAPI GetDefaultCommConfigW(LPCWSTR lpszName,LPCOMMCONFIG lpCC,LPDWORD lpdwSize); + WINBASEAPI WINBOOL WINAPI SetDefaultCommConfigA(LPCSTR lpszName,LPCOMMCONFIG lpCC,DWORD dwSize); + WINBASEAPI WINBOOL WINAPI SetDefaultCommConfigW(LPCWSTR lpszName,LPCOMMCONFIG lpCC,DWORD dwSize); + +#define MAX_COMPUTERNAME_LENGTH 15 + + WINBASEAPI WINBOOL WINAPI GetComputerNameA(LPSTR lpBuffer,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI GetComputerNameW(LPWSTR lpBuffer,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI SetComputerNameA(LPCSTR lpComputerName); + WINBASEAPI WINBOOL WINAPI SetComputerNameW(LPCWSTR lpComputerName); + + typedef enum _COMPUTER_NAME_FORMAT { + ComputerNameNetBIOS,ComputerNameDnsHostname,ComputerNameDnsDomain,ComputerNameDnsFullyQualified,ComputerNamePhysicalNetBIOS,ComputerNamePhysicalDnsHostname,ComputerNamePhysicalDnsDomain,ComputerNamePhysicalDnsFullyQualified,ComputerNameMax + } COMPUTER_NAME_FORMAT; + + WINBASEAPI WINBOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT NameType,LPSTR lpBuffer,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT NameType,LPWSTR lpBuffer,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI SetComputerNameExA(COMPUTER_NAME_FORMAT NameType,LPCSTR lpBuffer); + WINBASEAPI WINBOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType,LPCWSTR lpBuffer); + WINBASEAPI WINBOOL WINAPI DnsHostnameToComputerNameA(LPCSTR Hostname,LPSTR ComputerName,LPDWORD nSize); + WINBASEAPI WINBOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR Hostname,LPWSTR ComputerName,LPDWORD nSize); + WINADVAPI WINBOOL WINAPI GetUserNameA(LPSTR lpBuffer,LPDWORD pcbBuffer); + WINADVAPI WINBOOL WINAPI GetUserNameW(LPWSTR lpBuffer,LPDWORD pcbBuffer); + +#define LOGON32_LOGON_INTERACTIVE 2 +#define LOGON32_LOGON_NETWORK 3 +#define LOGON32_LOGON_BATCH 4 +#define LOGON32_LOGON_SERVICE 5 +#define LOGON32_LOGON_UNLOCK 7 +#define LOGON32_LOGON_NETWORK_CLEARTEXT 8 +#define LOGON32_LOGON_NEW_CREDENTIALS 9 + +#define LOGON32_PROVIDER_DEFAULT 0 +#define LOGON32_PROVIDER_WINNT35 1 +#define LOGON32_PROVIDER_WINNT40 2 +#define LOGON32_PROVIDER_WINNT50 3 + +#ifdef UNICODE +#define LogonUser LogonUserW +#define LogonUserEx LogonUserExW +#define CreateProcessAsUser CreateProcessAsUserW +#else +#define LogonUser LogonUserA +#define LogonUserEx LogonUserExA +#define CreateProcessAsUser CreateProcessAsUserA +#endif + + WINADVAPI WINBOOL WINAPI LogonUserA(LPCSTR lpszUsername,LPCSTR lpszDomain,LPCSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken); + WINADVAPI WINBOOL WINAPI LogonUserW(LPCWSTR lpszUsername,LPCWSTR lpszDomain,LPCWSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken); + WINADVAPI WINBOOL WINAPI LogonUserExA(LPCSTR lpszUsername,LPCSTR lpszDomain,LPCSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken,PSID *ppLogonSid,PVOID *ppProfileBuffer,LPDWORD pdwProfileLength,PQUOTA_LIMITS pQuotaLimits); + WINADVAPI WINBOOL WINAPI LogonUserExW(LPCWSTR lpszUsername,LPCWSTR lpszDomain,LPCWSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken,PSID *ppLogonSid,PVOID *ppProfileBuffer,LPDWORD pdwProfileLength,PQUOTA_LIMITS pQuotaLimits); + WINADVAPI WINBOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken); + WINADVAPI WINBOOL WINAPI CreateProcessAsUserA(HANDLE hToken,LPCSTR lpApplicationName,LPSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCSTR lpCurrentDirectory,LPSTARTUPINFOA lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINADVAPI WINBOOL WINAPI CreateProcessAsUserW(HANDLE hToken,LPCWSTR lpApplicationName,LPWSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + +#define LOGON_WITH_PROFILE 0x1 +#define LOGON_NETCREDENTIALS_ONLY 0x2 +#define LOGON_ZERO_PASSWORD_BUFFER 0x80000000 + + WINADVAPI WINBOOL WINAPI CreateProcessWithLogonW(LPCWSTR lpUsername,LPCWSTR lpDomain,LPCWSTR lpPassword,DWORD dwLogonFlags,LPCWSTR lpApplicationName,LPWSTR lpCommandLine,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINADVAPI WINBOOL WINAPI CreateProcessWithTokenW(HANDLE hToken,DWORD dwLogonFlags,LPCWSTR lpApplicationName,LPWSTR lpCommandLine,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); + WINADVAPI WINBOOL WINAPI ImpersonateAnonymousToken(HANDLE ThreadHandle); + WINADVAPI WINBOOL WINAPI DuplicateTokenEx(HANDLE hExistingToken,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpTokenAttributes,SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,TOKEN_TYPE TokenType,PHANDLE phNewToken); + WINADVAPI WINBOOL WINAPI CreateRestrictedToken(HANDLE ExistingTokenHandle,DWORD Flags,DWORD DisableSidCount,PSID_AND_ATTRIBUTES SidsToDisable,DWORD DeletePrivilegeCount,PLUID_AND_ATTRIBUTES PrivilegesToDelete,DWORD RestrictedSidCount,PSID_AND_ATTRIBUTES SidsToRestrict,PHANDLE NewTokenHandle); + WINADVAPI WINBOOL WINAPI IsTokenRestricted(HANDLE TokenHandle); + WINADVAPI WINBOOL WINAPI IsTokenUntrusted(HANDLE TokenHandle); + WINADVAPI WINBOOL WINAPI CheckTokenMembership(HANDLE TokenHandle,PSID SidToCheck,PBOOL IsMember); + + typedef WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK; + + WINBASEAPI WINBOOL WINAPI RegisterWaitForSingleObject(PHANDLE phNewWaitObject,HANDLE hObject,WAITORTIMERCALLBACK Callback,PVOID Context,ULONG dwMilliseconds,ULONG dwFlags); + WINBASEAPI HANDLE WINAPI RegisterWaitForSingleObjectEx(HANDLE hObject,WAITORTIMERCALLBACK Callback,PVOID Context,ULONG dwMilliseconds,ULONG dwFlags); + WINBASEAPI WINBOOL WINAPI UnregisterWait(HANDLE WaitHandle); + WINBASEAPI WINBOOL WINAPI UnregisterWaitEx(HANDLE WaitHandle,HANDLE CompletionEvent); + WINBASEAPI WINBOOL WINAPI QueueUserWorkItem(LPTHREAD_START_ROUTINE Function,PVOID Context,ULONG Flags); + WINBASEAPI WINBOOL WINAPI BindIoCompletionCallback(HANDLE FileHandle,LPOVERLAPPED_COMPLETION_ROUTINE Function,ULONG Flags); + WINBASEAPI HANDLE WINAPI CreateTimerQueue(VOID); + WINBASEAPI WINBOOL WINAPI CreateTimerQueueTimer(PHANDLE phNewTimer,HANDLE TimerQueue,WAITORTIMERCALLBACK Callback,PVOID Parameter,DWORD DueTime,DWORD Period,ULONG Flags); + WINBASEAPI WINBOOL WINAPI ChangeTimerQueueTimer(HANDLE TimerQueue,HANDLE Timer,ULONG DueTime,ULONG Period); + WINBASEAPI WINBOOL WINAPI DeleteTimerQueueTimer(HANDLE TimerQueue,HANDLE Timer,HANDLE CompletionEvent); + WINBASEAPI WINBOOL WINAPI DeleteTimerQueueEx(HANDLE TimerQueue,HANDLE CompletionEvent); + WINBASEAPI HANDLE WINAPI SetTimerQueueTimer(HANDLE TimerQueue,WAITORTIMERCALLBACK Callback,PVOID Parameter,DWORD DueTime,DWORD Period,WINBOOL PreferIo); + WINBASEAPI WINBOOL WINAPI CancelTimerQueueTimer(HANDLE TimerQueue,HANDLE Timer); + WINBASEAPI WINBOOL WINAPI DeleteTimerQueue(HANDLE TimerQueue); + +#define HW_PROFILE_GUIDLEN 39 +#define MAX_PROFILE_LEN 80 + +#define DOCKINFO_UNDOCKED (0x1) +#define DOCKINFO_DOCKED (0x2) +#define DOCKINFO_USER_SUPPLIED (0x4) +#define DOCKINFO_USER_UNDOCKED (DOCKINFO_USER_SUPPLIED | DOCKINFO_UNDOCKED) +#define DOCKINFO_USER_DOCKED (DOCKINFO_USER_SUPPLIED | DOCKINFO_DOCKED) + + typedef struct tagHW_PROFILE_INFOA { + DWORD dwDockInfo; + CHAR szHwProfileGuid[HW_PROFILE_GUIDLEN]; + CHAR szHwProfileName[MAX_PROFILE_LEN]; + } HW_PROFILE_INFOA,*LPHW_PROFILE_INFOA; + + typedef struct tagHW_PROFILE_INFOW { + DWORD dwDockInfo; + WCHAR szHwProfileGuid[HW_PROFILE_GUIDLEN]; + WCHAR szHwProfileName[MAX_PROFILE_LEN]; + } HW_PROFILE_INFOW,*LPHW_PROFILE_INFOW; + +#ifdef UNICODE + typedef HW_PROFILE_INFOW HW_PROFILE_INFO; + typedef LPHW_PROFILE_INFOW LPHW_PROFILE_INFO; +#else + typedef HW_PROFILE_INFOA HW_PROFILE_INFO; + typedef LPHW_PROFILE_INFOA LPHW_PROFILE_INFO; +#endif + +#ifdef UNICODE +#define GetCurrentHwProfile GetCurrentHwProfileW +#define GetVersionEx GetVersionExW +#define VerifyVersionInfo VerifyVersionInfoW +#else +#define GetCurrentHwProfile GetCurrentHwProfileA +#define GetVersionEx GetVersionExA +#define VerifyVersionInfo VerifyVersionInfoA +#endif + + WINADVAPI WINBOOL WINAPI GetCurrentHwProfileA (LPHW_PROFILE_INFOA lpHwProfileInfo); + WINADVAPI WINBOOL WINAPI GetCurrentHwProfileW (LPHW_PROFILE_INFOW lpHwProfileInfo); + WINBASEAPI WINBOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount); + WINBASEAPI WINBOOL WINAPI QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency); + WINBASEAPI WINBOOL WINAPI GetVersionExA(LPOSVERSIONINFOA lpVersionInformation); + WINBASEAPI WINBOOL WINAPI GetVersionExW(LPOSVERSIONINFOW lpVersionInformation); + WINBASEAPI WINBOOL WINAPI VerifyVersionInfoA(LPOSVERSIONINFOEXA lpVersionInformation,DWORD dwTypeMask,DWORDLONG dwlConditionMask); + WINBASEAPI WINBOOL WINAPI VerifyVersionInfoW(LPOSVERSIONINFOEXW lpVersionInformation,DWORD dwTypeMask,DWORDLONG dwlConditionMask); + +#include + +#define TC_NORMAL 0 +#define TC_HARDERR 1 +#define TC_GP_TRAP 2 +#define TC_SIGNAL 3 + +#define AC_LINE_OFFLINE 0x0 +#define AC_LINE_ONLINE 0x1 +#define AC_LINE_BACKUP_POWER 0x2 +#define AC_LINE_UNKNOWN 0xff + +#define BATTERY_FLAG_HIGH 0x1 +#define BATTERY_FLAG_LOW 0x2 +#define BATTERY_FLAG_CRITICAL 0x4 +#define BATTERY_FLAG_CHARGING 0x8 +#define BATTERY_FLAG_NO_BATTERY 0x80 +#define BATTERY_FLAG_UNKNOWN 0xff + +#define BATTERY_PERCENTAGE_UNKNOWN 0xff + +#define BATTERY_LIFE_UNKNOWN 0xffffffff + + typedef struct _SYSTEM_POWER_STATUS { + BYTE ACLineStatus; + BYTE BatteryFlag; + BYTE BatteryLifePercent; + BYTE Reserved1; + DWORD BatteryLifeTime; + DWORD BatteryFullLifeTime; + } SYSTEM_POWER_STATUS,*LPSYSTEM_POWER_STATUS; + +#ifdef UNICODE +#define CreateJobObject CreateJobObjectW +#define OpenJobObject OpenJobObjectW +#define FindFirstVolume FindFirstVolumeW +#define FindNextVolume FindNextVolumeW +#define FindFirstVolumeMountPoint FindFirstVolumeMountPointW +#define FindNextVolumeMountPoint FindNextVolumeMountPointW +#define SetVolumeMountPoint SetVolumeMountPointW +#define DeleteVolumeMountPoint DeleteVolumeMountPointW +#define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointW +#define GetVolumePathName GetVolumePathNameW +#define GetVolumePathNamesForVolumeName GetVolumePathNamesForVolumeNameW +#else +#define CreateJobObject CreateJobObjectA +#define OpenJobObject OpenJobObjectA +#define FindFirstVolume FindFirstVolumeA +#define FindNextVolume FindNextVolumeA +#define FindFirstVolumeMountPoint FindFirstVolumeMountPointA +#define FindNextVolumeMountPoint FindNextVolumeMountPointA +#define SetVolumeMountPoint SetVolumeMountPointA +#define DeleteVolumeMountPoint DeleteVolumeMountPointA +#define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointA +#define GetVolumePathName GetVolumePathNameA +#define GetVolumePathNamesForVolumeName GetVolumePathNamesForVolumeNameA +#endif + + WINBOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS lpSystemPowerStatus); + WINBOOL WINAPI SetSystemPowerState(WINBOOL fSuspend,WINBOOL fForce); + WINBASEAPI WINBOOL WINAPI AllocateUserPhysicalPages(HANDLE hProcess,PULONG_PTR NumberOfPages,PULONG_PTR PageArray); + WINBASEAPI WINBOOL WINAPI FreeUserPhysicalPages(HANDLE hProcess,PULONG_PTR NumberOfPages,PULONG_PTR PageArray); + WINBASEAPI WINBOOL WINAPI MapUserPhysicalPages(PVOID VirtualAddress,ULONG_PTR NumberOfPages,PULONG_PTR PageArray); + WINBASEAPI WINBOOL WINAPI MapUserPhysicalPagesScatter(PVOID *VirtualAddresses,ULONG_PTR NumberOfPages,PULONG_PTR PageArray); + WINBASEAPI HANDLE WINAPI CreateJobObjectA(LPSECURITY_ATTRIBUTES lpJobAttributes,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes,LPCWSTR lpName); + WINBASEAPI HANDLE WINAPI OpenJobObjectA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); + WINBASEAPI HANDLE WINAPI OpenJobObjectW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); + WINBASEAPI WINBOOL WINAPI AssignProcessToJobObject(HANDLE hJob,HANDLE hProcess); + WINBASEAPI WINBOOL WINAPI TerminateJobObject(HANDLE hJob,UINT uExitCode); + WINBASEAPI WINBOOL WINAPI QueryInformationJobObject(HANDLE hJob,JOBOBJECTINFOCLASS JobObjectInformationClass,LPVOID lpJobObjectInformation,DWORD cbJobObjectInformationLength,LPDWORD lpReturnLength); + WINBASEAPI WINBOOL WINAPI SetInformationJobObject(HANDLE hJob,JOBOBJECTINFOCLASS JobObjectInformationClass,LPVOID lpJobObjectInformation,DWORD cbJobObjectInformationLength); + WINBASEAPI WINBOOL WINAPI IsProcessInJob(HANDLE ProcessHandle,HANDLE JobHandle,PBOOL Result); + WINBASEAPI WINBOOL WINAPI CreateJobSet(ULONG NumJob,PJOB_SET_ARRAY UserJobSet,ULONG Flags); + WINBASEAPI PVOID WINAPI AddVectoredExceptionHandler (ULONG First,PVECTORED_EXCEPTION_HANDLER Handler); + WINBASEAPI ULONG WINAPI RemoveVectoredExceptionHandler(PVOID Handle); + WINBASEAPI PVOID WINAPI AddVectoredContinueHandler (ULONG First,PVECTORED_EXCEPTION_HANDLER Handler); + WINBASEAPI ULONG WINAPI RemoveVectoredContinueHandler(PVOID Handle); + WINBASEAPI HANDLE WINAPI FindFirstVolumeA(LPSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI HANDLE WINAPI FindFirstVolumeW(LPWSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindNextVolumeA(HANDLE hFindVolume,LPSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindNextVolumeW(HANDLE hFindVolume,LPWSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindVolumeClose(HANDLE hFindVolume); + WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointA(LPCSTR lpszRootPathName,LPSTR lpszVolumeMountPoint,DWORD cchBufferLength); + WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointW(LPCWSTR lpszRootPathName,LPWSTR lpszVolumeMountPoint,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindNextVolumeMountPointA(HANDLE hFindVolumeMountPoint,LPSTR lpszVolumeMountPoint,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindNextVolumeMountPointW(HANDLE hFindVolumeMountPoint,LPWSTR lpszVolumeMountPoint,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI FindVolumeMountPointClose(HANDLE hFindVolumeMountPoint); + WINBASEAPI WINBOOL WINAPI SetVolumeMountPointA(LPCSTR lpszVolumeMountPoint,LPCSTR lpszVolumeName); + WINBASEAPI WINBOOL WINAPI SetVolumeMountPointW(LPCWSTR lpszVolumeMountPoint,LPCWSTR lpszVolumeName); + WINBASEAPI WINBOOL WINAPI DeleteVolumeMountPointA(LPCSTR lpszVolumeMountPoint); + WINBASEAPI WINBOOL WINAPI DeleteVolumeMountPointW(LPCWSTR lpszVolumeMountPoint); + WINBASEAPI WINBOOL WINAPI GetVolumeNameForVolumeMountPointA(LPCSTR lpszVolumeMountPoint,LPSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI GetVolumeNameForVolumeMountPointW(LPCWSTR lpszVolumeMountPoint,LPWSTR lpszVolumeName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI GetVolumePathNameA(LPCSTR lpszFileName,LPSTR lpszVolumePathName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI GetVolumePathNameW(LPCWSTR lpszFileName,LPWSTR lpszVolumePathName,DWORD cchBufferLength); + WINBASEAPI WINBOOL WINAPI GetVolumePathNamesForVolumeNameA(LPCSTR lpszVolumeName,LPCH lpszVolumePathNames,DWORD cchBufferLength,PDWORD lpcchReturnLength); + WINBASEAPI WINBOOL WINAPI GetVolumePathNamesForVolumeNameW(LPCWSTR lpszVolumeName,LPWCH lpszVolumePathNames,DWORD cchBufferLength,PDWORD lpcchReturnLength); + +#define ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID 0x1 +#define ACTCTX_FLAG_LANGID_VALID 0x2 +#define ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID 0x4 +#define ACTCTX_FLAG_RESOURCE_NAME_VALID 0x8 +#define ACTCTX_FLAG_SET_PROCESS_DEFAULT 0x10 +#define ACTCTX_FLAG_APPLICATION_NAME_VALID 0x20 +#define ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF 0x40 +#define ACTCTX_FLAG_HMODULE_VALID 0x80 + + typedef struct tagACTCTXA { + ULONG cbSize; + DWORD dwFlags; + LPCSTR lpSource; + USHORT wProcessorArchitecture; + LANGID wLangId; + LPCSTR lpAssemblyDirectory; + LPCSTR lpResourceName; + LPCSTR lpApplicationName; + HMODULE hModule; + } ACTCTXA,*PACTCTXA; + + typedef struct tagACTCTXW { + ULONG cbSize; + DWORD dwFlags; + LPCWSTR lpSource; + USHORT wProcessorArchitecture; + LANGID wLangId; + LPCWSTR lpAssemblyDirectory; + LPCWSTR lpResourceName; + LPCWSTR lpApplicationName; + HMODULE hModule; + } ACTCTXW,*PACTCTXW; + + typedef const ACTCTXA *PCACTCTXA; + typedef const ACTCTXW *PCACTCTXW; + +#ifdef UNICODE + typedef ACTCTXW ACTCTX; + typedef PACTCTXW PACTCTX; + typedef PCACTCTXW PCACTCTX; +#else + typedef ACTCTXA ACTCTX; + typedef PACTCTXA PACTCTX; + typedef PCACTCTXA PCACTCTX; +#endif + +#ifdef UNICODE +#define CreateActCtx CreateActCtxW +#else +#define CreateActCtx CreateActCtxA +#endif + + WINBASEAPI HANDLE WINAPI CreateActCtxA(PCACTCTXA pActCtx); + WINBASEAPI HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx); + WINBASEAPI VOID WINAPI AddRefActCtx(HANDLE hActCtx); + WINBASEAPI VOID WINAPI ReleaseActCtx(HANDLE hActCtx); + WINBASEAPI WINBOOL WINAPI ZombifyActCtx(HANDLE hActCtx); + WINBASEAPI WINBOOL WINAPI ActivateActCtx(HANDLE hActCtx,ULONG_PTR *lpCookie); + +#define DEACTIVATE_ACTCTX_FLAG_FORCE_EARLY_DEACTIVATION (0x1) + + WINBASEAPI WINBOOL WINAPI DeactivateActCtx(DWORD dwFlags,ULONG_PTR ulCookie); + WINBASEAPI WINBOOL WINAPI GetCurrentActCtx(HANDLE *lphActCtx); + + typedef struct tagACTCTX_SECTION_KEYED_DATA_2600 { + ULONG cbSize; + ULONG ulDataFormatVersion; + PVOID lpData; + ULONG ulLength; + PVOID lpSectionGlobalData; + ULONG ulSectionGlobalDataLength; + PVOID lpSectionBase; + ULONG ulSectionTotalLength; + HANDLE hActCtx; + ULONG ulAssemblyRosterIndex; + } ACTCTX_SECTION_KEYED_DATA_2600,*PACTCTX_SECTION_KEYED_DATA_2600; + + typedef const ACTCTX_SECTION_KEYED_DATA_2600 *PCACTCTX_SECTION_KEYED_DATA_2600; + + typedef struct tagACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA { + PVOID lpInformation; + PVOID lpSectionBase; + ULONG ulSectionLength; + PVOID lpSectionGlobalDataBase; + ULONG ulSectionGlobalDataLength; + } ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA,*PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; + + typedef const ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA *PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; + + typedef struct tagACTCTX_SECTION_KEYED_DATA { + ULONG cbSize; + ULONG ulDataFormatVersion; + PVOID lpData; + ULONG ulLength; + PVOID lpSectionGlobalData; + ULONG ulSectionGlobalDataLength; + PVOID lpSectionBase; + ULONG ulSectionTotalLength; + HANDLE hActCtx; + ULONG ulAssemblyRosterIndex; + + ULONG ulFlags; + ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA AssemblyMetadata; + } ACTCTX_SECTION_KEYED_DATA,*PACTCTX_SECTION_KEYED_DATA; + + typedef const ACTCTX_SECTION_KEYED_DATA *PCACTCTX_SECTION_KEYED_DATA; + +#define FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX 0x1 +#define FIND_ACTCTX_SECTION_KEY_RETURN_FLAGS 0x2 +#define FIND_ACTCTX_SECTION_KEY_RETURN_ASSEMBLY_METADATA 0x4 + +#ifdef UNICODE +#define FindActCtxSectionString FindActCtxSectionStringW +#else +#define FindActCtxSectionString FindActCtxSectionStringA +#endif + + WINBASEAPI WINBOOL WINAPI FindActCtxSectionStringA(DWORD dwFlags,const GUID *lpExtensionGuid,ULONG ulSectionId,LPCSTR lpStringToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); + WINBASEAPI WINBOOL WINAPI FindActCtxSectionStringW(DWORD dwFlags,const GUID *lpExtensionGuid,ULONG ulSectionId,LPCWSTR lpStringToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); + WINBASEAPI WINBOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags,const GUID *lpExtensionGuid,ULONG ulSectionId,const GUID *lpGuidToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); + +#ifndef RC_INVOKED +#ifndef ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED + + typedef struct _ACTIVATION_CONTEXT_BASIC_INFORMATION { + HANDLE hActCtx; + DWORD dwFlags; + } ACTIVATION_CONTEXT_BASIC_INFORMATION,*PACTIVATION_CONTEXT_BASIC_INFORMATION; + + typedef const struct _ACTIVATION_CONTEXT_BASIC_INFORMATION *PCACTIVATION_CONTEXT_BASIC_INFORMATION; + +#define ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED 1 +#endif +#endif + +#define QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX 0x4 +#define QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE 0x8 +#define QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS 0x10 +#define QUERY_ACTCTX_FLAG_NO_ADDREF 0x80000000 + + WINBASEAPI WINBOOL WINAPI QueryActCtxW(DWORD dwFlags,HANDLE hActCtx,PVOID pvSubInstance,ULONG ulInfoClass,PVOID pvBuffer,SIZE_T cbBuffer,SIZE_T *pcbWrittenOrRequired); + + typedef WINBOOL (WINAPI *PQUERYACTCTXW_FUNC)(DWORD dwFlags,HANDLE hActCtx,PVOID pvSubInstance,ULONG ulInfoClass,PVOID pvBuffer,SIZE_T cbBuffer,SIZE_T *pcbWrittenOrRequired); + + WINBASEAPI WINBOOL WINAPI ProcessIdToSessionId(DWORD dwProcessId,DWORD *pSessionId); + WINBASEAPI DWORD WINAPI WTSGetActiveConsoleSessionId(); + WINBASEAPI WINBOOL WINAPI IsWow64Process(HANDLE hProcess,PBOOL Wow64Process); + WINBASEAPI WINBOOL WINAPI GetLogicalProcessorInformation(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer,PDWORD ReturnedLength); + WINBASEAPI WINBOOL WINAPI GetNumaHighestNodeNumber(PULONG HighestNodeNumber); + WINBASEAPI WINBOOL WINAPI GetNumaProcessorNode(UCHAR Processor,PUCHAR NodeNumber); + WINBASEAPI WINBOOL WINAPI GetNumaNodeProcessorMask(UCHAR Node,PULONGLONG ProcessorMask); + WINBASEAPI WINBOOL WINAPI GetNumaAvailableMemoryNode(UCHAR Node,PULONGLONG AvailableBytes); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/wincon.h b/overlay_toolchain/tcc/include/winapi/wincon.h new file mode 100644 index 00000000..a3501ee7 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/wincon.h @@ -0,0 +1,301 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINCON_ +#define _WINCON_ + +#ifdef __cplusplus +extern "C" { +#endif + + typedef struct _COORD { + SHORT X; + SHORT Y; + } COORD,*PCOORD; + + typedef struct _SMALL_RECT { + SHORT Left; + SHORT Top; + SHORT Right; + SHORT Bottom; + } SMALL_RECT,*PSMALL_RECT; + + typedef struct _KEY_EVENT_RECORD { + WINBOOL bKeyDown; + WORD wRepeatCount; + WORD wVirtualKeyCode; + WORD wVirtualScanCode; + union { + WCHAR UnicodeChar; + CHAR AsciiChar; + } uChar; + DWORD dwControlKeyState; + } KEY_EVENT_RECORD,*PKEY_EVENT_RECORD; + +#define RIGHT_ALT_PRESSED 0x1 +#define LEFT_ALT_PRESSED 0x2 +#define RIGHT_CTRL_PRESSED 0x4 +#define LEFT_CTRL_PRESSED 0x8 +#define SHIFT_PRESSED 0x10 +#define NUMLOCK_ON 0x20 +#define SCROLLLOCK_ON 0x40 +#define CAPSLOCK_ON 0x80 +#define ENHANCED_KEY 0x100 +#define NLS_DBCSCHAR 0x10000 +#define NLS_ALPHANUMERIC 0x0 +#define NLS_KATAKANA 0x20000 +#define NLS_HIRAGANA 0x40000 +#define NLS_ROMAN 0x400000 +#define NLS_IME_CONVERSION 0x800000 +#define NLS_IME_DISABLE 0x20000000 + + typedef struct _MOUSE_EVENT_RECORD { + COORD dwMousePosition; + DWORD dwButtonState; + DWORD dwControlKeyState; + DWORD dwEventFlags; + } MOUSE_EVENT_RECORD,*PMOUSE_EVENT_RECORD; + +#define FROM_LEFT_1ST_BUTTON_PRESSED 0x1 +#define RIGHTMOST_BUTTON_PRESSED 0x2 +#define FROM_LEFT_2ND_BUTTON_PRESSED 0x4 +#define FROM_LEFT_3RD_BUTTON_PRESSED 0x8 +#define FROM_LEFT_4TH_BUTTON_PRESSED 0x10 + +#define MOUSE_MOVED 0x1 +#define DOUBLE_CLICK 0x2 +#define MOUSE_WHEELED 0x4 + + typedef struct _WINDOW_BUFFER_SIZE_RECORD { + COORD dwSize; + } WINDOW_BUFFER_SIZE_RECORD,*PWINDOW_BUFFER_SIZE_RECORD; + + typedef struct _MENU_EVENT_RECORD { + UINT dwCommandId; + } MENU_EVENT_RECORD,*PMENU_EVENT_RECORD; + + typedef struct _FOCUS_EVENT_RECORD { + WINBOOL bSetFocus; + } FOCUS_EVENT_RECORD,*PFOCUS_EVENT_RECORD; + + typedef struct _INPUT_RECORD { + WORD EventType; + union { + KEY_EVENT_RECORD KeyEvent; + MOUSE_EVENT_RECORD MouseEvent; + WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent; + MENU_EVENT_RECORD MenuEvent; + FOCUS_EVENT_RECORD FocusEvent; + } Event; + } INPUT_RECORD,*PINPUT_RECORD; + +#define KEY_EVENT 0x1 +#define MOUSE_EVENT 0x2 +#define WINDOW_BUFFER_SIZE_EVENT 0x4 +#define MENU_EVENT 0x8 +#define FOCUS_EVENT 0x10 + + typedef struct _CHAR_INFO { + union { + WCHAR UnicodeChar; + CHAR AsciiChar; + } Char; + WORD Attributes; + } CHAR_INFO,*PCHAR_INFO; + +#define FOREGROUND_BLUE 0x1 +#define FOREGROUND_GREEN 0x2 +#define FOREGROUND_RED 0x4 +#define FOREGROUND_INTENSITY 0x8 +#define BACKGROUND_BLUE 0x10 +#define BACKGROUND_GREEN 0x20 +#define BACKGROUND_RED 0x40 +#define BACKGROUND_INTENSITY 0x80 +#define COMMON_LVB_LEADING_BYTE 0x100 +#define COMMON_LVB_TRAILING_BYTE 0x200 +#define COMMON_LVB_GRID_HORIZONTAL 0x400 +#define COMMON_LVB_GRID_LVERTICAL 0x800 +#define COMMON_LVB_GRID_RVERTICAL 0x1000 +#define COMMON_LVB_REVERSE_VIDEO 0x4000 +#define COMMON_LVB_UNDERSCORE 0x8000 + +#define COMMON_LVB_SBCSDBCS 0x300 + + typedef struct _CONSOLE_SCREEN_BUFFER_INFO { + COORD dwSize; + COORD dwCursorPosition; + WORD wAttributes; + SMALL_RECT srWindow; + COORD dwMaximumWindowSize; + } CONSOLE_SCREEN_BUFFER_INFO,*PCONSOLE_SCREEN_BUFFER_INFO; + + typedef struct _CONSOLE_CURSOR_INFO { + DWORD dwSize; + WINBOOL bVisible; + } CONSOLE_CURSOR_INFO,*PCONSOLE_CURSOR_INFO; + + typedef struct _CONSOLE_FONT_INFO { + DWORD nFont; + COORD dwFontSize; + } CONSOLE_FONT_INFO,*PCONSOLE_FONT_INFO; + + typedef struct _CONSOLE_SELECTION_INFO { + DWORD dwFlags; + COORD dwSelectionAnchor; + SMALL_RECT srSelection; + } CONSOLE_SELECTION_INFO,*PCONSOLE_SELECTION_INFO; + +#define CONSOLE_NO_SELECTION 0x0 +#define CONSOLE_SELECTION_IN_PROGRESS 0x1 +#define CONSOLE_SELECTION_NOT_EMPTY 0x2 +#define CONSOLE_MOUSE_SELECTION 0x4 +#define CONSOLE_MOUSE_DOWN 0x8 + + typedef WINBOOL (WINAPI *PHANDLER_ROUTINE)(DWORD CtrlType); + +#define CTRL_C_EVENT 0 +#define CTRL_BREAK_EVENT 1 +#define CTRL_CLOSE_EVENT 2 + +#define CTRL_LOGOFF_EVENT 5 +#define CTRL_SHUTDOWN_EVENT 6 + +#define ENABLE_PROCESSED_INPUT 0x1 +#define ENABLE_LINE_INPUT 0x2 +#define ENABLE_ECHO_INPUT 0x4 +#define ENABLE_WINDOW_INPUT 0x8 +#define ENABLE_MOUSE_INPUT 0x10 + +#define ENABLE_PROCESSED_OUTPUT 0x1 +#define ENABLE_WRAP_AT_EOL_OUTPUT 0x2 + +#ifdef UNICODE +#define PeekConsoleInput PeekConsoleInputW +#define ReadConsoleInput ReadConsoleInputW +#define WriteConsoleInput WriteConsoleInputW +#define ReadConsoleOutput ReadConsoleOutputW +#define WriteConsoleOutput WriteConsoleOutputW +#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW +#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW +#define FillConsoleOutputCharacter FillConsoleOutputCharacterW +#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW +#define GetConsoleTitle GetConsoleTitleW +#define SetConsoleTitle SetConsoleTitleW +#define ReadConsole ReadConsoleW +#define WriteConsole WriteConsoleW +#define AddConsoleAlias AddConsoleAliasW +#define GetConsoleAlias GetConsoleAliasW +#define GetConsoleAliasesLength GetConsoleAliasesLengthW +#define GetConsoleAliasExesLength GetConsoleAliasExesLengthW +#define GetConsoleAliases GetConsoleAliasesW +#define GetConsoleAliasExes GetConsoleAliasExesW +#else +#define PeekConsoleInput PeekConsoleInputA +#define ReadConsoleInput ReadConsoleInputA +#define WriteConsoleInput WriteConsoleInputA +#define ReadConsoleOutput ReadConsoleOutputA +#define WriteConsoleOutput WriteConsoleOutputA +#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA +#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA +#define FillConsoleOutputCharacter FillConsoleOutputCharacterA +#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA +#define GetConsoleTitle GetConsoleTitleA +#define SetConsoleTitle SetConsoleTitleA +#define ReadConsole ReadConsoleA +#define WriteConsole WriteConsoleA +#define AddConsoleAlias AddConsoleAliasA +#define GetConsoleAlias GetConsoleAliasA +#define GetConsoleAliasesLength GetConsoleAliasesLengthA +#define GetConsoleAliasExesLength GetConsoleAliasExesLengthA +#define GetConsoleAliases GetConsoleAliasesA +#define GetConsoleAliasExes GetConsoleAliasExesA +#endif + + WINBASEAPI WINBOOL WINAPI PeekConsoleInputA(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); + WINBASEAPI WINBOOL WINAPI PeekConsoleInputW(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); + WINBASEAPI WINBOOL WINAPI ReadConsoleInputA(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); + WINBASEAPI WINBOOL WINAPI ReadConsoleInputW(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); + WINBASEAPI WINBOOL WINAPI WriteConsoleInputA(HANDLE hConsoleInput,CONST INPUT_RECORD *lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsWritten); + WINBASEAPI WINBOOL WINAPI WriteConsoleInputW(HANDLE hConsoleInput,CONST INPUT_RECORD *lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsWritten); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputA(HANDLE hConsoleOutput,PCHAR_INFO lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpReadRegion); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputW(HANDLE hConsoleOutput,PCHAR_INFO lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpReadRegion); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputA(HANDLE hConsoleOutput,CONST CHAR_INFO *lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpWriteRegion); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputW(HANDLE hConsoleOutput,CONST CHAR_INFO *lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpWriteRegion); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputCharacterA(HANDLE hConsoleOutput,LPSTR lpCharacter,DWORD nLength,COORD dwReadCoord,LPDWORD lpNumberOfCharsRead); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputCharacterW(HANDLE hConsoleOutput,LPWSTR lpCharacter,DWORD nLength,COORD dwReadCoord,LPDWORD lpNumberOfCharsRead); + WINBASEAPI WINBOOL WINAPI ReadConsoleOutputAttribute(HANDLE hConsoleOutput,LPWORD lpAttribute,DWORD nLength,COORD dwReadCoord,LPDWORD lpNumberOfAttrsRead); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput,LPCSTR lpCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputCharacterW(HANDLE hConsoleOutput,LPCWSTR lpCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); + WINBASEAPI WINBOOL WINAPI WriteConsoleOutputAttribute(HANDLE hConsoleOutput,CONST WORD *lpAttribute,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfAttrsWritten); + WINBASEAPI WINBOOL WINAPI FillConsoleOutputCharacterA(HANDLE hConsoleOutput,CHAR cCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); + WINBASEAPI WINBOOL WINAPI FillConsoleOutputCharacterW(HANDLE hConsoleOutput,WCHAR cCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); + WINBASEAPI WINBOOL WINAPI FillConsoleOutputAttribute(HANDLE hConsoleOutput,WORD wAttribute,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfAttrsWritten); + WINBASEAPI WINBOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle,LPDWORD lpMode); + WINBASEAPI WINBOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE hConsoleInput,LPDWORD lpNumberOfEvents); + WINBASEAPI WINBOOL WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); + WINBASEAPI COORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput); + WINBASEAPI WINBOOL WINAPI GetConsoleCursorInfo(HANDLE hConsoleOutput,PCONSOLE_CURSOR_INFO lpConsoleCursorInfo); + WINBASEAPI WINBOOL WINAPI GetCurrentConsoleFont(HANDLE hConsoleOutput,WINBOOL bMaximumWindow,PCONSOLE_FONT_INFO lpConsoleCurrentFont); + WINBASEAPI COORD WINAPI GetConsoleFontSize(HANDLE hConsoleOutput,DWORD nFont); + WINBASEAPI WINBOOL WINAPI GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo); + WINBASEAPI WINBOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD lpNumberOfMouseButtons); + WINBASEAPI WINBOOL WINAPI SetConsoleMode(HANDLE hConsoleHandle,DWORD dwMode); + WINBASEAPI WINBOOL WINAPI SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput); + WINBASEAPI WINBOOL WINAPI FlushConsoleInputBuffer(HANDLE hConsoleInput); + WINBASEAPI WINBOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput,COORD dwSize); + WINBASEAPI WINBOOL WINAPI SetConsoleCursorPosition(HANDLE hConsoleOutput,COORD dwCursorPosition); + WINBASEAPI WINBOOL WINAPI SetConsoleCursorInfo(HANDLE hConsoleOutput,CONST CONSOLE_CURSOR_INFO *lpConsoleCursorInfo); + WINBASEAPI WINBOOL WINAPI ScrollConsoleScreenBufferA(HANDLE hConsoleOutput,CONST SMALL_RECT *lpScrollRectangle,CONST SMALL_RECT *lpClipRectangle,COORD dwDestinationOrigin,CONST CHAR_INFO *lpFill); + WINBASEAPI WINBOOL WINAPI ScrollConsoleScreenBufferW(HANDLE hConsoleOutput,CONST SMALL_RECT *lpScrollRectangle,CONST SMALL_RECT *lpClipRectangle,COORD dwDestinationOrigin,CONST CHAR_INFO *lpFill); + WINBASEAPI WINBOOL WINAPI SetConsoleWindowInfo(HANDLE hConsoleOutput,WINBOOL bAbsolute,CONST SMALL_RECT *lpConsoleWindow); + WINBASEAPI WINBOOL WINAPI SetConsoleTextAttribute(HANDLE hConsoleOutput,WORD wAttributes); + WINBASEAPI WINBOOL WINAPI SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine,WINBOOL Add); + WINBASEAPI WINBOOL WINAPI GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,DWORD dwProcessGroupId); + WINBASEAPI WINBOOL WINAPI AllocConsole(VOID); + WINBASEAPI WINBOOL WINAPI FreeConsole(VOID); + WINBASEAPI WINBOOL WINAPI AttachConsole(DWORD dwProcessId); + +#define ATTACH_PARENT_PROCESS ((DWORD)-1) + + WINBASEAPI DWORD WINAPI GetConsoleTitleA(LPSTR lpConsoleTitle,DWORD nSize); + WINBASEAPI DWORD WINAPI GetConsoleTitleW(LPWSTR lpConsoleTitle,DWORD nSize); + WINBASEAPI WINBOOL WINAPI SetConsoleTitleA(LPCSTR lpConsoleTitle); + WINBASEAPI WINBOOL WINAPI SetConsoleTitleW(LPCWSTR lpConsoleTitle); + WINBASEAPI WINBOOL WINAPI ReadConsoleA(HANDLE hConsoleInput,LPVOID lpBuffer,DWORD nNumberOfCharsToRead,LPDWORD lpNumberOfCharsRead,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI ReadConsoleW(HANDLE hConsoleInput,LPVOID lpBuffer,DWORD nNumberOfCharsToRead,LPDWORD lpNumberOfCharsRead,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI WriteConsoleA(HANDLE hConsoleOutput,CONST VOID *lpBuffer,DWORD nNumberOfCharsToWrite,LPDWORD lpNumberOfCharsWritten,LPVOID lpReserved); + WINBASEAPI WINBOOL WINAPI WriteConsoleW(HANDLE hConsoleOutput,CONST VOID *lpBuffer,DWORD nNumberOfCharsToWrite,LPDWORD lpNumberOfCharsWritten,LPVOID lpReserved); + +#define CONSOLE_TEXTMODE_BUFFER 1 + + WINBASEAPI HANDLE WINAPI CreateConsoleScreenBuffer(DWORD dwDesiredAccess,DWORD dwShareMode,CONST SECURITY_ATTRIBUTES *lpSecurityAttributes,DWORD dwFlags,LPVOID lpScreenBufferData); + WINBASEAPI UINT WINAPI GetConsoleCP(VOID); + WINBASEAPI WINBOOL WINAPI SetConsoleCP(UINT wCodePageID); + WINBASEAPI UINT WINAPI GetConsoleOutputCP(VOID); + WINBASEAPI WINBOOL WINAPI SetConsoleOutputCP(UINT wCodePageID); + +#define CONSOLE_FULLSCREEN 1 +#define CONSOLE_FULLSCREEN_HARDWARE 2 + + WINBASEAPI WINBOOL WINAPI GetConsoleDisplayMode(LPDWORD lpModeFlags); + WINBASEAPI HWND WINAPI GetConsoleWindow(VOID); + WINBASEAPI DWORD WINAPI GetConsoleProcessList(LPDWORD lpdwProcessList,DWORD dwProcessCount); + WINBASEAPI WINBOOL WINAPI AddConsoleAliasA(LPSTR Source,LPSTR Target,LPSTR ExeName); + WINBASEAPI WINBOOL WINAPI AddConsoleAliasW(LPWSTR Source,LPWSTR Target,LPWSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasA(LPSTR Source,LPSTR TargetBuffer,DWORD TargetBufferLength,LPSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasW(LPWSTR Source,LPWSTR TargetBuffer,DWORD TargetBufferLength,LPWSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthA(LPSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthA(VOID); + WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthW(VOID); + WINBASEAPI DWORD WINAPI GetConsoleAliasesA(LPSTR AliasBuffer,DWORD AliasBufferLength,LPSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasesW(LPWSTR AliasBuffer,DWORD AliasBufferLength,LPWSTR ExeName); + WINBASEAPI DWORD WINAPI GetConsoleAliasExesA(LPSTR ExeNameBuffer,DWORD ExeNameBufferLength); + WINBASEAPI DWORD WINAPI GetConsoleAliasExesW(LPWSTR ExeNameBuffer,DWORD ExeNameBufferLength); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/windef.h b/overlay_toolchain/tcc/include/winapi/windef.h new file mode 100644 index 00000000..d63bdef1 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/windef.h @@ -0,0 +1,293 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINDEF_ +#define _WINDEF_ + +#ifndef STRICT +#define STRICT 1 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#ifndef BASETYPES +#define BASETYPES + typedef unsigned long ULONG; + typedef ULONG *PULONG; + typedef unsigned short USHORT; + typedef USHORT *PUSHORT; + typedef unsigned char UCHAR; + typedef UCHAR *PUCHAR; + typedef char *PSZ; +#endif + +#define MAX_PATH 260 + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef IN +#define IN +#endif + +#ifndef OUT +#define OUT +#endif + +#ifndef OPTIONAL +#define OPTIONAL +#endif + +#undef far +#undef near +#undef pascal + +#define far +#define near +#define pascal __stdcall + +#define cdecl +#ifndef CDECL +#define CDECL +#endif +#ifndef CALLBACK +#define CALLBACK __stdcall +#endif +#ifndef WINAPI +#define WINAPI __stdcall +#endif +#define WINAPIV __cdecl +#define APIENTRY WINAPI +#define APIPRIVATE WINAPI +#define PASCAL WINAPI +#define WINAPI_INLINE WINAPI + +#undef FAR +#undef NEAR +#define FAR +#define NEAR +#ifndef CONST +#define CONST const +#endif + + typedef unsigned long DWORD; + typedef int WINBOOL; +#define BOOL WINBOOL + typedef unsigned char BYTE; + typedef unsigned short WORD; + typedef float FLOAT; + typedef FLOAT *PFLOAT; + typedef WINBOOL *PBOOL; + typedef WINBOOL *LPBOOL; + typedef BYTE *PBYTE; + typedef BYTE *LPBYTE; + typedef int *PINT; + typedef int *LPINT; + typedef WORD *PWORD; + typedef WORD *LPWORD; + typedef long *LPLONG; + typedef DWORD *PDWORD; + typedef DWORD *LPDWORD; + typedef void *LPVOID; +# ifndef _LPCVOID_DEFINED +#define _LPCVOID_DEFINED +typedef CONST void *LPCVOID; +#endif + typedef int INT; + typedef unsigned int UINT; + typedef unsigned int *PUINT; + +#ifndef NT_INCLUDED +#include +#endif + +//gr #include + + typedef UINT_PTR WPARAM; + typedef LONG_PTR LPARAM; + typedef LONG_PTR LRESULT; + +#ifndef __cplusplus +#ifndef NOMINMAX +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#endif +#endif + +#define MAKEWORD(a,b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8)) +#define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16)) +#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff)) +#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) +#define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff)) +#define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) + +#ifndef WIN_INTERNAL + DECLARE_HANDLE (HWND); + DECLARE_HANDLE (HHOOK); +#ifdef WINABLE + DECLARE_HANDLE (HEVENT); +#endif +#endif + + typedef WORD ATOM; + + typedef HANDLE *SPHANDLE; + typedef HANDLE *LPHANDLE; + typedef HANDLE HGLOBAL; + typedef HANDLE HLOCAL; + typedef HANDLE GLOBALHANDLE; + typedef HANDLE LOCALHANDLE; +#ifdef _WIN64 + typedef INT_PTR (WINAPI *FARPROC)(); + typedef INT_PTR (WINAPI *NEARPROC)(); + typedef INT_PTR (WINAPI *PROC)(); +#else + typedef int (WINAPI *FARPROC)(); + typedef int (WINAPI *NEARPROC)(); + typedef int (WINAPI *PROC)(); +#endif + + typedef void *HGDIOBJ; + + DECLARE_HANDLE(HKEY); + typedef HKEY *PHKEY; + + DECLARE_HANDLE(HACCEL); + DECLARE_HANDLE(HBITMAP); + DECLARE_HANDLE(HBRUSH); + DECLARE_HANDLE(HCOLORSPACE); + DECLARE_HANDLE(HDC); + DECLARE_HANDLE(HGLRC); + DECLARE_HANDLE(HDESK); + DECLARE_HANDLE(HENHMETAFILE); + DECLARE_HANDLE(HFONT); + DECLARE_HANDLE(HICON); + DECLARE_HANDLE(HMENU); + DECLARE_HANDLE(HMETAFILE); + DECLARE_HANDLE(HINSTANCE); + typedef HINSTANCE HMODULE; + DECLARE_HANDLE(HPALETTE); + DECLARE_HANDLE(HPEN); + DECLARE_HANDLE(HRGN); + DECLARE_HANDLE(HRSRC); + DECLARE_HANDLE(HSTR); + DECLARE_HANDLE(HTASK); + DECLARE_HANDLE(HWINSTA); + DECLARE_HANDLE(HKL); + DECLARE_HANDLE(HMONITOR); + DECLARE_HANDLE(HWINEVENTHOOK); + DECLARE_HANDLE(HUMPD); + + typedef int HFILE; + typedef HICON HCURSOR; + typedef DWORD COLORREF; + typedef DWORD *LPCOLORREF; + +#define HFILE_ERROR ((HFILE)-1) + + typedef struct tagRECT { + LONG left; + LONG top; + LONG right; + LONG bottom; + } RECT,*PRECT,*NPRECT,*LPRECT; + + typedef const RECT *LPCRECT; + + typedef struct _RECTL { + LONG left; + LONG top; + LONG right; + LONG bottom; + } RECTL,*PRECTL,*LPRECTL; + + typedef const RECTL *LPCRECTL; + + typedef struct tagPOINT { + LONG x; + LONG y; + } POINT,*PPOINT,*NPPOINT,*LPPOINT; + + typedef struct _POINTL { + LONG x; + LONG y; + } POINTL,*PPOINTL; + + typedef struct tagSIZE { + LONG cx; + LONG cy; + } SIZE,*PSIZE,*LPSIZE; + + typedef SIZE SIZEL; + typedef SIZE *PSIZEL,*LPSIZEL; + + typedef struct tagPOINTS { + SHORT x; + SHORT y; + } POINTS,*PPOINTS,*LPPOINTS; + + typedef struct _FILETIME { + DWORD dwLowDateTime; + DWORD dwHighDateTime; + } FILETIME,*PFILETIME,*LPFILETIME; +#define _FILETIME_ + +#define DM_UPDATE 1 +#define DM_COPY 2 +#define DM_PROMPT 4 +#define DM_MODIFY 8 + +#define DM_IN_BUFFER DM_MODIFY +#define DM_IN_PROMPT DM_PROMPT +#define DM_OUT_BUFFER DM_COPY +#define DM_OUT_DEFAULT DM_UPDATE + +#define DC_FIELDS 1 +#define DC_PAPERS 2 +#define DC_PAPERSIZE 3 +#define DC_MINEXTENT 4 +#define DC_MAXEXTENT 5 +#define DC_BINS 6 +#define DC_DUPLEX 7 +#define DC_SIZE 8 +#define DC_EXTRA 9 +#define DC_VERSION 10 +#define DC_DRIVER 11 +#define DC_BINNAMES 12 +#define DC_ENUMRESOLUTIONS 13 +#define DC_FILEDEPENDENCIES 14 +#define DC_TRUETYPE 15 +#define DC_PAPERNAMES 16 +#define DC_ORIENTATION 17 +#define DC_COPIES 18 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/windows.h b/overlay_toolchain/tcc/include/winapi/windows.h new file mode 100644 index 00000000..2660d7f0 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/windows.h @@ -0,0 +1,127 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINDOWS_ +#define _WINDOWS_ + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#include <_mingw.h> + +#ifndef _INC_WINDOWS +#define _INC_WINDOWS + +#if defined(RC_INVOKED) && !defined(NOWINRES) + +#include +#else + +#ifdef RC_INVOKED +#define NOATOM +#define NOGDI +#define NOGDICAPMASKS +#define NOMETAFILE +#define NOMINMAX +#define NOMSG +#define NOOPENFILE +#define NORASTEROPS +#define NOSCROLL +#define NOSOUND +#define NOSYSMETRICS +#define NOTEXTMETRIC +#define NOWH +#define NOCOMM +#define NOKANJI +#define NOCRYPT +#define NOMCX +#endif + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && (defined(_X86_) && !defined(__x86_64)) +#define I_X86_ +#endif + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(__x86_64) +#define _AMD64_ +#endif + +#if !defined(I_X86_) && !(defined(_X86_) && !defined(__x86_64)) && !defined(_AMD64_) && defined(__ia64__) +#if !defined(_IA64_) +#define _IA64_ +#endif +#endif + +#ifndef RC_INVOKED +#include +#include +#endif + +#include +#include +#include +#include +//gr #include +#include +#include +#include +//gr #include + +#ifndef WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef NOCRYPT +#include +#include +#include +#endif + +#ifndef NOUSER +#ifndef NOGDI +#include +#ifdef INC_OLE1 +#include +#else +#include +#endif +#include +#endif +#endif +#endif + +//gr #include + +#ifdef INC_OLE2 +#include +#endif + +#ifndef NOSERVICE +#include +#endif + +#ifndef NOMCX +#include +#endif + +#ifndef NOIME +#include +#endif + +#endif +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/winerror.h b/overlay_toolchain/tcc/include/winapi/winerror.h new file mode 100644 index 00000000..77d85edc --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/winerror.h @@ -0,0 +1,3166 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINERROR_ +#define _WINERROR_ + +#define FACILITY_WINDOWSUPDATE 36 +#define FACILITY_WINDOWS_CE 24 +#define FACILITY_WINDOWS 8 +#define FACILITY_URT 19 +#define FACILITY_UMI 22 +#define FACILITY_SXS 23 +#define FACILITY_STORAGE 3 +#define FACILITY_STATE_MANAGEMENT 34 +#define FACILITY_SSPI 9 +#define FACILITY_SCARD 16 +#define FACILITY_SETUPAPI 15 +#define FACILITY_SECURITY 9 +#define FACILITY_RPC 1 +#define FACILITY_WIN32 7 +#define FACILITY_CONTROL 10 +#define FACILITY_NULL 0 +#define FACILITY_METADIRECTORY 35 +#define FACILITY_MSMQ 14 +#define FACILITY_MEDIASERVER 13 +#define FACILITY_INTERNET 12 +#define FACILITY_ITF 4 +#define FACILITY_HTTP 25 +#define FACILITY_DPLAY 21 +#define FACILITY_DISPATCH 2 +#define FACILITY_DIRECTORYSERVICE 37 +#define FACILITY_CONFIGURATION 33 +#define FACILITY_COMPLUS 17 +#define FACILITY_CERT 11 +#define FACILITY_BACKGROUNDCOPY 32 +#define FACILITY_ACS 20 +#define FACILITY_AAF 18 +#define ERROR_SUCCESS 0L +#define NO_ERROR 0L +#define SEC_E_OK ((HRESULT)0x00000000L) +#define ERROR_INVALID_FUNCTION 1L +#define ERROR_FILE_NOT_FOUND 2L +#define ERROR_PATH_NOT_FOUND 3L +#define ERROR_TOO_MANY_OPEN_FILES 4L +#define ERROR_ACCESS_DENIED 5L +#define ERROR_INVALID_HANDLE 6L +#define ERROR_ARENA_TRASHED 7L +#define ERROR_NOT_ENOUGH_MEMORY 8L +#define ERROR_INVALID_BLOCK 9L +#define ERROR_BAD_ENVIRONMENT 10L +#define ERROR_BAD_FORMAT 11L +#define ERROR_INVALID_ACCESS 12L +#define ERROR_INVALID_DATA 13L +#define ERROR_OUTOFMEMORY 14L +#define ERROR_INVALID_DRIVE 15L +#define ERROR_CURRENT_DIRECTORY 16L +#define ERROR_NOT_SAME_DEVICE 17L +#define ERROR_NO_MORE_FILES 18L +#define ERROR_WRITE_PROTECT 19L +#define ERROR_BAD_UNIT 20L +#define ERROR_NOT_READY 21L +#define ERROR_BAD_COMMAND 22L +#define ERROR_CRC 23L +#define ERROR_BAD_LENGTH 24L +#define ERROR_SEEK 25L +#define ERROR_NOT_DOS_DISK 26L +#define ERROR_SECTOR_NOT_FOUND 27L +#define ERROR_OUT_OF_PAPER 28L +#define ERROR_WRITE_FAULT 29L +#define ERROR_READ_FAULT 30L +#define ERROR_GEN_FAILURE 31L +#define ERROR_SHARING_VIOLATION 32L +#define ERROR_LOCK_VIOLATION 33L +#define ERROR_WRONG_DISK 34L +#define ERROR_SHARING_BUFFER_EXCEEDED 36L +#define ERROR_HANDLE_EOF 38L +#define ERROR_HANDLE_DISK_FULL 39L +#define ERROR_NOT_SUPPORTED 50L +#define ERROR_REM_NOT_LIST 51L +#define ERROR_DUP_NAME 52L +#define ERROR_BAD_NETPATH 53L +#define ERROR_NETWORK_BUSY 54L +#define ERROR_DEV_NOT_EXIST 55L +#define ERROR_TOO_MANY_CMDS 56L +#define ERROR_ADAP_HDW_ERR 57L +#define ERROR_BAD_NET_RESP 58L +#define ERROR_UNEXP_NET_ERR 59L +#define ERROR_BAD_REM_ADAP 60L +#define ERROR_PRINTQ_FULL 61L +#define ERROR_NO_SPOOL_SPACE 62L +#define ERROR_PRINT_CANCELLED 63L +#define ERROR_NETNAME_DELETED 64L +#define ERROR_NETWORK_ACCESS_DENIED 65L +#define ERROR_BAD_DEV_TYPE 66L +#define ERROR_BAD_NET_NAME 67L +#define ERROR_TOO_MANY_NAMES 68L +#define ERROR_TOO_MANY_SESS 69L +#define ERROR_SHARING_PAUSED 70L +#define ERROR_REQ_NOT_ACCEP 71L +#define ERROR_REDIR_PAUSED 72L +#define ERROR_FILE_EXISTS 80L +#define ERROR_CANNOT_MAKE 82L +#define ERROR_FAIL_I24 83L +#define ERROR_OUT_OF_STRUCTURES 84L +#define ERROR_ALREADY_ASSIGNED 85L +#define ERROR_INVALID_PASSWORD 86L +#define ERROR_INVALID_PARAMETER 87L +#define ERROR_NET_WRITE_FAULT 88L +#define ERROR_NO_PROC_SLOTS 89L +#define ERROR_TOO_MANY_SEMAPHORES 100L +#define ERROR_EXCL_SEM_ALREADY_OWNED 101L +#define ERROR_SEM_IS_SET 102L +#define ERROR_TOO_MANY_SEM_REQUESTS 103L +#define ERROR_INVALID_AT_INTERRUPT_TIME 104L +#define ERROR_SEM_OWNER_DIED 105L +#define ERROR_SEM_USER_LIMIT 106L +#define ERROR_DISK_CHANGE 107L +#define ERROR_DRIVE_LOCKED 108L +#define ERROR_BROKEN_PIPE 109L +#define ERROR_OPEN_FAILED 110L +#define ERROR_BUFFER_OVERFLOW 111L +#define ERROR_DISK_FULL 112L +#define ERROR_NO_MORE_SEARCH_HANDLES 113L +#define ERROR_INVALID_TARGET_HANDLE 114L +#define ERROR_INVALID_CATEGORY 117L +#define ERROR_INVALID_VERIFY_SWITCH 118L +#define ERROR_BAD_DRIVER_LEVEL 119L +#define ERROR_CALL_NOT_IMPLEMENTED 120L +#define ERROR_SEM_TIMEOUT 121L +#define ERROR_INSUFFICIENT_BUFFER 122L +#define ERROR_INVALID_NAME 123L +#define ERROR_INVALID_LEVEL 124L +#define ERROR_NO_VOLUME_LABEL 125L +#define ERROR_MOD_NOT_FOUND 126L +#define ERROR_PROC_NOT_FOUND 127L +#define ERROR_WAIT_NO_CHILDREN 128L +#define ERROR_CHILD_NOT_COMPLETE 129L +#define ERROR_DIRECT_ACCESS_HANDLE 130L +#define ERROR_NEGATIVE_SEEK 131L +#define ERROR_SEEK_ON_DEVICE 132L +#define ERROR_IS_JOIN_TARGET 133L +#define ERROR_IS_JOINED 134L +#define ERROR_IS_SUBSTED 135L +#define ERROR_NOT_JOINED 136L +#define ERROR_NOT_SUBSTED 137L +#define ERROR_JOIN_TO_JOIN 138L +#define ERROR_SUBST_TO_SUBST 139L +#define ERROR_JOIN_TO_SUBST 140L +#define ERROR_SUBST_TO_JOIN 141L +#define ERROR_BUSY_DRIVE 142L +#define ERROR_SAME_DRIVE 143L +#define ERROR_DIR_NOT_ROOT 144L +#define ERROR_DIR_NOT_EMPTY 145L +#define ERROR_IS_SUBST_PATH 146L +#define ERROR_IS_JOIN_PATH 147L +#define ERROR_PATH_BUSY 148L +#define ERROR_IS_SUBST_TARGET 149L +#define ERROR_SYSTEM_TRACE 150L +#define ERROR_INVALID_EVENT_COUNT 151L +#define ERROR_TOO_MANY_MUXWAITERS 152L +#define ERROR_INVALID_LIST_FORMAT 153L +#define ERROR_LABEL_TOO_LONG 154L +#define ERROR_TOO_MANY_TCBS 155L +#define ERROR_SIGNAL_REFUSED 156L +#define ERROR_DISCARDED 157L +#define ERROR_NOT_LOCKED 158L +#define ERROR_BAD_THREADID_ADDR 159L +#define ERROR_BAD_ARGUMENTS 160L +#define ERROR_BAD_PATHNAME 161L +#define ERROR_SIGNAL_PENDING 162L +#define ERROR_MAX_THRDS_REACHED 164L +#define ERROR_LOCK_FAILED 167L +#define ERROR_BUSY 170L +#define ERROR_CANCEL_VIOLATION 173L +#define ERROR_ATOMIC_LOCKS_NOT_SUPPORTED 174L +#define ERROR_INVALID_SEGMENT_NUMBER 180L +#define ERROR_INVALID_ORDINAL 182L +#define ERROR_ALREADY_EXISTS 183L +#define ERROR_INVALID_FLAG_NUMBER 186L +#define ERROR_SEM_NOT_FOUND 187L +#define ERROR_INVALID_STARTING_CODESEG 188L +#define ERROR_INVALID_STACKSEG 189L +#define ERROR_INVALID_MODULETYPE 190L +#define ERROR_INVALID_EXE_SIGNATURE 191L +#define ERROR_EXE_MARKED_INVALID 192L +#define ERROR_BAD_EXE_FORMAT 193L +#define ERROR_ITERATED_DATA_EXCEEDS_64k 194L +#define ERROR_INVALID_MINALLOCSIZE 195L +#define ERROR_DYNLINK_FROM_INVALID_RING 196L +#define ERROR_IOPL_NOT_ENABLED 197L +#define ERROR_INVALID_SEGDPL 198L +#define ERROR_AUTODATASEG_EXCEEDS_64k 199L +#define ERROR_RING2SEG_MUST_BE_MOVABLE 200L +#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201L +#define ERROR_INFLOOP_IN_RELOC_CHAIN 202L +#define ERROR_ENVVAR_NOT_FOUND 203L +#define ERROR_NO_SIGNAL_SENT 205L +#define ERROR_FILENAME_EXCED_RANGE 206L +#define ERROR_RING2_STACK_IN_USE 207L +#define ERROR_META_EXPANSION_TOO_LONG 208L +#define ERROR_INVALID_SIGNAL_NUMBER 209L +#define ERROR_THREAD_1_INACTIVE 210L +#define ERROR_LOCKED 212L +#define ERROR_TOO_MANY_MODULES 214L +#define ERROR_NESTING_NOT_ALLOWED 215L +#define ERROR_EXE_MACHINE_TYPE_MISMATCH 216L +#define ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY 217L +#define ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY 218L +#define ERROR_BAD_PIPE 230L +#define ERROR_PIPE_BUSY 231L +#define ERROR_NO_DATA 232L +#define ERROR_PIPE_NOT_CONNECTED 233L +#define ERROR_MORE_DATA 234L +#define ERROR_VC_DISCONNECTED 240L +#define ERROR_INVALID_EA_NAME 254L +#define ERROR_EA_LIST_INCONSISTENT 255L +#define WAIT_TIMEOUT 258L +#define ERROR_NO_MORE_ITEMS 259L +#define ERROR_CANNOT_COPY 266L +#define ERROR_DIRECTORY 267L +#define ERROR_EAS_DIDNT_FIT 275L +#define ERROR_EA_FILE_CORRUPT 276L +#define ERROR_EA_TABLE_FULL 277L +#define ERROR_INVALID_EA_HANDLE 278L +#define ERROR_EAS_NOT_SUPPORTED 282L +#define ERROR_NOT_OWNER 288L +#define ERROR_TOO_MANY_POSTS 298L +#define ERROR_PARTIAL_COPY 299L +#define ERROR_OPLOCK_NOT_GRANTED 300L +#define ERROR_INVALID_OPLOCK_PROTOCOL 301L +#define ERROR_DISK_TOO_FRAGMENTED 302L +#define ERROR_DELETE_PENDING 303L +#define ERROR_MR_MID_NOT_FOUND 317L +#define ERROR_SCOPE_NOT_FOUND 318L +#define ERROR_INVALID_ADDRESS 487L +#define ERROR_ARITHMETIC_OVERFLOW 534L +#define ERROR_PIPE_CONNECTED 535L +#define ERROR_PIPE_LISTENING 536L +#define ERROR_EA_ACCESS_DENIED 994L +#define ERROR_OPERATION_ABORTED 995L +#define ERROR_IO_INCOMPLETE 996L +#define ERROR_IO_PENDING 997L +#define ERROR_NOACCESS 998L +#define ERROR_SWAPERROR 999L +#define ERROR_STACK_OVERFLOW 1001L +#define ERROR_INVALID_MESSAGE 1002L +#define ERROR_CAN_NOT_COMPLETE 1003L +#define ERROR_INVALID_FLAGS 1004L +#define ERROR_UNRECOGNIZED_VOLUME 1005L +#define ERROR_FILE_INVALID 1006L +#define ERROR_FULLSCREEN_MODE 1007L +#define ERROR_NO_TOKEN 1008L +#define ERROR_BADDB 1009L +#define ERROR_BADKEY 1010L +#define ERROR_CANTOPEN 1011L +#define ERROR_CANTREAD 1012L +#define ERROR_CANTWRITE 1013L +#define ERROR_REGISTRY_RECOVERED 1014L +#define ERROR_REGISTRY_CORRUPT 1015L +#define ERROR_REGISTRY_IO_FAILED 1016L +#define ERROR_NOT_REGISTRY_FILE 1017L +#define ERROR_KEY_DELETED 1018L +#define ERROR_NO_LOG_SPACE 1019L +#define ERROR_KEY_HAS_CHILDREN 1020L +#define ERROR_CHILD_MUST_BE_VOLATILE 1021L +#define ERROR_NOTIFY_ENUM_DIR 1022L +#define ERROR_DEPENDENT_SERVICES_RUNNING 1051L +#define ERROR_INVALID_SERVICE_CONTROL 1052L +#define ERROR_SERVICE_REQUEST_TIMEOUT 1053L +#define ERROR_SERVICE_NO_THREAD 1054L +#define ERROR_SERVICE_DATABASE_LOCKED 1055L +#define ERROR_SERVICE_ALREADY_RUNNING 1056L +#define ERROR_INVALID_SERVICE_ACCOUNT 1057L +#define ERROR_SERVICE_DISABLED 1058L +#define ERROR_CIRCULAR_DEPENDENCY 1059L +#define ERROR_SERVICE_DOES_NOT_EXIST 1060L +#define ERROR_SERVICE_CANNOT_ACCEPT_CTRL 1061L +#define ERROR_SERVICE_NOT_ACTIVE 1062L +#define ERROR_FAILED_SERVICE_CONTROLLER_CONNECT 1063L +#define ERROR_EXCEPTION_IN_SERVICE 1064L +#define ERROR_DATABASE_DOES_NOT_EXIST 1065L +#define ERROR_SERVICE_SPECIFIC_ERROR 1066L +#define ERROR_PROCESS_ABORTED 1067L +#define ERROR_SERVICE_DEPENDENCY_FAIL 1068L +#define ERROR_SERVICE_LOGON_FAILED 1069L +#define ERROR_SERVICE_START_HANG 1070L +#define ERROR_INVALID_SERVICE_LOCK 1071L +#define ERROR_SERVICE_MARKED_FOR_DELETE 1072L +#define ERROR_SERVICE_EXISTS 1073L +#define ERROR_ALREADY_RUNNING_LKG 1074L +#define ERROR_SERVICE_DEPENDENCY_DELETED 1075L +#define ERROR_BOOT_ALREADY_ACCEPTED 1076L +#define ERROR_SERVICE_NEVER_STARTED 1077L +#define ERROR_DUPLICATE_SERVICE_NAME 1078L +#define ERROR_DIFFERENT_SERVICE_ACCOUNT 1079L +#define ERROR_CANNOT_DETECT_DRIVER_FAILURE 1080L +#define ERROR_CANNOT_DETECT_PROCESS_ABORT 1081L +#define ERROR_NO_RECOVERY_PROGRAM 1082L +#define ERROR_SERVICE_NOT_IN_EXE 1083L +#define ERROR_NOT_SAFEBOOT_SERVICE 1084L +#define ERROR_END_OF_MEDIA 1100L +#define ERROR_FILEMARK_DETECTED 1101L +#define ERROR_BEGINNING_OF_MEDIA 1102L +#define ERROR_SETMARK_DETECTED 1103L +#define ERROR_NO_DATA_DETECTED 1104L +#define ERROR_PARTITION_FAILURE 1105L +#define ERROR_INVALID_BLOCK_LENGTH 1106L +#define ERROR_DEVICE_NOT_PARTITIONED 1107L +#define ERROR_UNABLE_TO_LOCK_MEDIA 1108L +#define ERROR_UNABLE_TO_UNLOAD_MEDIA 1109L +#define ERROR_MEDIA_CHANGED 1110L +#define ERROR_BUS_RESET 1111L +#define ERROR_NO_MEDIA_IN_DRIVE 1112L +#define ERROR_NO_UNICODE_TRANSLATION 1113L +#define ERROR_DLL_INIT_FAILED 1114L +#define ERROR_SHUTDOWN_IN_PROGRESS 1115L +#define ERROR_NO_SHUTDOWN_IN_PROGRESS 1116L +#define ERROR_IO_DEVICE 1117L +#define ERROR_SERIAL_NO_DEVICE 1118L +#define ERROR_IRQ_BUSY 1119L +#define ERROR_MORE_WRITES 1120L +#define ERROR_COUNTER_TIMEOUT 1121L +#define ERROR_FLOPPY_ID_MARK_NOT_FOUND 1122L +#define ERROR_FLOPPY_WRONG_CYLINDER 1123L +#define ERROR_FLOPPY_UNKNOWN_ERROR 1124L +#define ERROR_FLOPPY_BAD_REGISTERS 1125L +#define ERROR_DISK_RECALIBRATE_FAILED 1126L +#define ERROR_DISK_OPERATION_FAILED 1127L +#define ERROR_DISK_RESET_FAILED 1128L +#define ERROR_EOM_OVERFLOW 1129L +#define ERROR_NOT_ENOUGH_SERVER_MEMORY 1130L +#define ERROR_POSSIBLE_DEADLOCK 1131L +#define ERROR_MAPPED_ALIGNMENT 1132L +#define ERROR_SET_POWER_STATE_VETOED 1140L +#define ERROR_SET_POWER_STATE_FAILED 1141L +#define ERROR_TOO_MANY_LINKS 1142L +#define ERROR_OLD_WIN_VERSION 1150L +#define ERROR_APP_WRONG_OS 1151L +#define ERROR_SINGLE_INSTANCE_APP 1152L +#define ERROR_RMODE_APP 1153L +#define ERROR_INVALID_DLL 1154L +#define ERROR_NO_ASSOCIATION 1155L +#define ERROR_DDE_FAIL 1156L +#define ERROR_DLL_NOT_FOUND 1157L +#define ERROR_NO_MORE_USER_HANDLES 1158L +#define ERROR_MESSAGE_SYNC_ONLY 1159L +#define ERROR_SOURCE_ELEMENT_EMPTY 1160L +#define ERROR_DESTINATION_ELEMENT_FULL 1161L +#define ERROR_ILLEGAL_ELEMENT_ADDRESS 1162L +#define ERROR_MAGAZINE_NOT_PRESENT 1163L +#define ERROR_DEVICE_REINITIALIZATION_NEEDED 1164L +#define ERROR_DEVICE_REQUIRES_CLEANING 1165L +#define ERROR_DEVICE_DOOR_OPEN 1166L +#define ERROR_DEVICE_NOT_CONNECTED 1167L +#define ERROR_NOT_FOUND 1168L +#define ERROR_NO_MATCH 1169L +#define ERROR_SET_NOT_FOUND 1170L +#define ERROR_POINT_NOT_FOUND 1171L +#define ERROR_NO_TRACKING_SERVICE 1172L +#define ERROR_NO_VOLUME_ID 1173L +#define ERROR_UNABLE_TO_REMOVE_REPLACED 1175L +#define ERROR_UNABLE_TO_MOVE_REPLACEMENT 1176L +#define ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 1177L +#define ERROR_JOURNAL_DELETE_IN_PROGRESS 1178L +#define ERROR_JOURNAL_NOT_ACTIVE 1179L +#define ERROR_POTENTIAL_FILE_FOUND 1180L +#define ERROR_JOURNAL_ENTRY_DELETED 1181L +#define ERROR_BAD_DEVICE 1200L +#define ERROR_CONNECTION_UNAVAIL 1201L +#define ERROR_DEVICE_ALREADY_REMEMBERED 1202L +#define ERROR_NO_NET_OR_BAD_PATH 1203L +#define ERROR_BAD_PROVIDER 1204L +#define ERROR_CANNOT_OPEN_PROFILE 1205L +#define ERROR_BAD_PROFILE 1206L +#define ERROR_NOT_CONTAINER 1207L +#define ERROR_EXTENDED_ERROR 1208L +#define ERROR_INVALID_GROUPNAME 1209L +#define ERROR_INVALID_COMPUTERNAME 1210L +#define ERROR_INVALID_EVENTNAME 1211L +#define ERROR_INVALID_DOMAINNAME 1212L +#define ERROR_INVALID_SERVICENAME 1213L +#define ERROR_INVALID_NETNAME 1214L +#define ERROR_INVALID_SHARENAME 1215L +#define ERROR_INVALID_PASSWORDNAME 1216L +#define ERROR_INVALID_MESSAGENAME 1217L +#define ERROR_INVALID_MESSAGEDEST 1218L +#define ERROR_SESSION_CREDENTIAL_CONFLICT 1219L +#define ERROR_REMOTE_SESSION_LIMIT_EXCEEDED 1220L +#define ERROR_DUP_DOMAINNAME 1221L +#define ERROR_NO_NETWORK 1222L +#define ERROR_CANCELLED 1223L +#define ERROR_USER_MAPPED_FILE 1224L +#define ERROR_CONNECTION_REFUSED 1225L +#define ERROR_GRACEFUL_DISCONNECT 1226L +#define ERROR_ADDRESS_ALREADY_ASSOCIATED 1227L +#define ERROR_ADDRESS_NOT_ASSOCIATED 1228L +#define ERROR_CONNECTION_INVALID 1229L +#define ERROR_CONNECTION_ACTIVE 1230L +#define ERROR_NETWORK_UNREACHABLE 1231L +#define ERROR_HOST_UNREACHABLE 1232L +#define ERROR_PROTOCOL_UNREACHABLE 1233L +#define ERROR_PORT_UNREACHABLE 1234L +#define ERROR_REQUEST_ABORTED 1235L +#define ERROR_CONNECTION_ABORTED 1236L +#define ERROR_RETRY 1237L +#define ERROR_CONNECTION_COUNT_LIMIT 1238L +#define ERROR_LOGIN_TIME_RESTRICTION 1239L +#define ERROR_LOGIN_WKSTA_RESTRICTION 1240L +#define ERROR_INCORRECT_ADDRESS 1241L +#define ERROR_ALREADY_REGISTERED 1242L +#define ERROR_SERVICE_NOT_FOUND 1243L +#define ERROR_NOT_AUTHENTICATED 1244L +#define ERROR_NOT_LOGGED_ON 1245L +#define ERROR_CONTINUE 1246L +#define ERROR_ALREADY_INITIALIZED 1247L +#define ERROR_NO_MORE_DEVICES 1248L +#define ERROR_NO_SUCH_SITE 1249L +#define ERROR_DOMAIN_CONTROLLER_EXISTS 1250L +#define ERROR_ONLY_IF_CONNECTED 1251L +#define ERROR_OVERRIDE_NOCHANGES 1252L +#define ERROR_BAD_USER_PROFILE 1253L +#define ERROR_NOT_SUPPORTED_ON_SBS 1254L +#define ERROR_SERVER_SHUTDOWN_IN_PROGRESS 1255L +#define ERROR_HOST_DOWN 1256L +#define ERROR_NON_ACCOUNT_SID 1257L +#define ERROR_NON_DOMAIN_SID 1258L +#define ERROR_APPHELP_BLOCK 1259L +#define ERROR_ACCESS_DISABLED_BY_POLICY 1260L +#define ERROR_REG_NAT_CONSUMPTION 1261L +#define ERROR_CSCSHARE_OFFLINE 1262L +#define ERROR_PKINIT_FAILURE 1263L +#define ERROR_SMARTCARD_SUBSYSTEM_FAILURE 1264L +#define ERROR_DOWNGRADE_DETECTED 1265L +#define ERROR_MACHINE_LOCKED 1271L +#define ERROR_CALLBACK_SUPPLIED_INVALID_DATA 1273L +#define ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED 1274L +#define ERROR_DRIVER_BLOCKED 1275L +#define ERROR_INVALID_IMPORT_OF_NON_DLL 1276L +#define ERROR_ACCESS_DISABLED_WEBBLADE 1277L +#define ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER 1278L +#define ERROR_RECOVERY_FAILURE 1279L +#define ERROR_ALREADY_FIBER 1280L +#define ERROR_ALREADY_THREAD 1281L +#define ERROR_STACK_BUFFER_OVERRUN 1282L +#define ERROR_PARAMETER_QUOTA_EXCEEDED 1283L +#define ERROR_DEBUGGER_INACTIVE 1284L +#define ERROR_DELAY_LOAD_FAILED 1285L +#define ERROR_VDM_DISALLOWED 1286L +#define ERROR_UNIDENTIFIED_ERROR 1287L +#define ERROR_NOT_ALL_ASSIGNED 1300L +#define ERROR_SOME_NOT_MAPPED 1301L +#define ERROR_NO_QUOTAS_FOR_ACCOUNT 1302L +#define ERROR_LOCAL_USER_SESSION_KEY 1303L +#define ERROR_NULL_LM_PASSWORD 1304L +#define ERROR_UNKNOWN_REVISION 1305L +#define ERROR_REVISION_MISMATCH 1306L +#define ERROR_INVALID_OWNER 1307L +#define ERROR_INVALID_PRIMARY_GROUP 1308L +#define ERROR_NO_IMPERSONATION_TOKEN 1309L +#define ERROR_CANT_DISABLE_MANDATORY 1310L +#define ERROR_NO_LOGON_SERVERS 1311L +#define ERROR_NO_SUCH_LOGON_SESSION 1312L +#define ERROR_NO_SUCH_PRIVILEGE 1313L +#define ERROR_PRIVILEGE_NOT_HELD 1314L +#define ERROR_INVALID_ACCOUNT_NAME 1315L +#define ERROR_USER_EXISTS 1316L +#define ERROR_NO_SUCH_USER 1317L +#define ERROR_GROUP_EXISTS 1318L +#define ERROR_NO_SUCH_GROUP 1319L +#define ERROR_MEMBER_IN_GROUP 1320L +#define ERROR_MEMBER_NOT_IN_GROUP 1321L +#define ERROR_LAST_ADMIN 1322L +#define ERROR_WRONG_PASSWORD 1323L +#define ERROR_ILL_FORMED_PASSWORD 1324L +#define ERROR_PASSWORD_RESTRICTION 1325L +#define ERROR_LOGON_FAILURE 1326L +#define ERROR_ACCOUNT_RESTRICTION 1327L +#define ERROR_INVALID_LOGON_HOURS 1328L +#define ERROR_INVALID_WORKSTATION 1329L +#define ERROR_PASSWORD_EXPIRED 1330L +#define ERROR_ACCOUNT_DISABLED 1331L +#define ERROR_NONE_MAPPED 1332L +#define ERROR_TOO_MANY_LUIDS_REQUESTED 1333L +#define ERROR_LUIDS_EXHAUSTED 1334L +#define ERROR_INVALID_SUB_AUTHORITY 1335L +#define ERROR_INVALID_ACL 1336L +#define ERROR_INVALID_SID 1337L +#define ERROR_INVALID_SECURITY_DESCR 1338L +#define ERROR_BAD_INHERITANCE_ACL 1340L +#define ERROR_SERVER_DISABLED 1341L +#define ERROR_SERVER_NOT_DISABLED 1342L +#define ERROR_INVALID_ID_AUTHORITY 1343L +#define ERROR_ALLOTTED_SPACE_EXCEEDED 1344L +#define ERROR_INVALID_GROUP_ATTRIBUTES 1345L +#define ERROR_BAD_IMPERSONATION_LEVEL 1346L +#define ERROR_CANT_OPEN_ANONYMOUS 1347L +#define ERROR_BAD_VALIDATION_CLASS 1348L +#define ERROR_BAD_TOKEN_TYPE 1349L +#define ERROR_NO_SECURITY_ON_OBJECT 1350L +#define ERROR_CANT_ACCESS_DOMAIN_INFO 1351L +#define ERROR_INVALID_SERVER_STATE 1352L +#define ERROR_INVALID_DOMAIN_STATE 1353L +#define ERROR_INVALID_DOMAIN_ROLE 1354L +#define ERROR_NO_SUCH_DOMAIN 1355L +#define ERROR_DOMAIN_EXISTS 1356L +#define ERROR_DOMAIN_LIMIT_EXCEEDED 1357L +#define ERROR_INTERNAL_DB_CORRUPTION 1358L +#define ERROR_INTERNAL_ERROR 1359L +#define ERROR_GENERIC_NOT_MAPPED 1360L +#define ERROR_BAD_DESCRIPTOR_FORMAT 1361L +#define ERROR_NOT_LOGON_PROCESS 1362L +#define ERROR_LOGON_SESSION_EXISTS 1363L +#define ERROR_NO_SUCH_PACKAGE 1364L +#define ERROR_BAD_LOGON_SESSION_STATE 1365L +#define ERROR_LOGON_SESSION_COLLISION 1366L +#define ERROR_INVALID_LOGON_TYPE 1367L +#define ERROR_CANNOT_IMPERSONATE 1368L +#define ERROR_RXACT_INVALID_STATE 1369L +#define ERROR_RXACT_COMMIT_FAILURE 1370L +#define ERROR_SPECIAL_ACCOUNT 1371L +#define ERROR_SPECIAL_GROUP 1372L +#define ERROR_SPECIAL_USER 1373L +#define ERROR_MEMBERS_PRIMARY_GROUP 1374L +#define ERROR_TOKEN_ALREADY_IN_USE 1375L +#define ERROR_NO_SUCH_ALIAS 1376L +#define ERROR_MEMBER_NOT_IN_ALIAS 1377L +#define ERROR_MEMBER_IN_ALIAS 1378L +#define ERROR_ALIAS_EXISTS 1379L +#define ERROR_LOGON_NOT_GRANTED 1380L +#define ERROR_TOO_MANY_SECRETS 1381L +#define ERROR_SECRET_TOO_LONG 1382L +#define ERROR_INTERNAL_DB_ERROR 1383L +#define ERROR_TOO_MANY_CONTEXT_IDS 1384L +#define ERROR_LOGON_TYPE_NOT_GRANTED 1385L +#define ERROR_NT_CROSS_ENCRYPTION_REQUIRED 1386L +#define ERROR_NO_SUCH_MEMBER 1387L +#define ERROR_INVALID_MEMBER 1388L +#define ERROR_TOO_MANY_SIDS 1389L +#define ERROR_LM_CROSS_ENCRYPTION_REQUIRED 1390L +#define ERROR_NO_INHERITANCE 1391L +#define ERROR_FILE_CORRUPT 1392L +#define ERROR_DISK_CORRUPT 1393L +#define ERROR_NO_USER_SESSION_KEY 1394L +#define ERROR_LICENSE_QUOTA_EXCEEDED 1395L +#define ERROR_WRONG_TARGET_NAME 1396L +#define ERROR_MUTUAL_AUTH_FAILED 1397L +#define ERROR_TIME_SKEW 1398L +#define ERROR_CURRENT_DOMAIN_NOT_ALLOWED 1399L +#define ERROR_INVALID_WINDOW_HANDLE 1400L +#define ERROR_INVALID_MENU_HANDLE 1401L +#define ERROR_INVALID_CURSOR_HANDLE 1402L +#define ERROR_INVALID_ACCEL_HANDLE 1403L +#define ERROR_INVALID_HOOK_HANDLE 1404L +#define ERROR_INVALID_DWP_HANDLE 1405L +#define ERROR_TLW_WITH_WSCHILD 1406L +#define ERROR_CANNOT_FIND_WND_CLASS 1407L +#define ERROR_WINDOW_OF_OTHER_THREAD 1408L +#define ERROR_HOTKEY_ALREADY_REGISTERED 1409L +#define ERROR_CLASS_ALREADY_EXISTS 1410L +#define ERROR_CLASS_DOES_NOT_EXIST 1411L +#define ERROR_CLASS_HAS_WINDOWS 1412L +#define ERROR_INVALID_INDEX 1413L +#define ERROR_INVALID_ICON_HANDLE 1414L +#define ERROR_PRIVATE_DIALOG_INDEX 1415L +#define ERROR_LISTBOX_ID_NOT_FOUND 1416L +#define ERROR_NO_WILDCARD_CHARACTERS 1417L +#define ERROR_CLIPBOARD_NOT_OPEN 1418L +#define ERROR_HOTKEY_NOT_REGISTERED 1419L +#define ERROR_WINDOW_NOT_DIALOG 1420L +#define ERROR_CONTROL_ID_NOT_FOUND 1421L +#define ERROR_INVALID_COMBOBOX_MESSAGE 1422L +#define ERROR_WINDOW_NOT_COMBOBOX 1423L +#define ERROR_INVALID_EDIT_HEIGHT 1424L +#define ERROR_DC_NOT_FOUND 1425L +#define ERROR_INVALID_HOOK_FILTER 1426L +#define ERROR_INVALID_FILTER_PROC 1427L +#define ERROR_HOOK_NEEDS_HMOD 1428L +#define ERROR_GLOBAL_ONLY_HOOK 1429L +#define ERROR_JOURNAL_HOOK_SET 1430L +#define ERROR_HOOK_NOT_INSTALLED 1431L +#define ERROR_INVALID_LB_MESSAGE 1432L +#define ERROR_SETCOUNT_ON_BAD_LB 1433L +#define ERROR_LB_WITHOUT_TABSTOPS 1434L +#define ERROR_DESTROY_OBJECT_OF_OTHER_THREAD 1435L +#define ERROR_CHILD_WINDOW_MENU 1436L +#define ERROR_NO_SYSTEM_MENU 1437L +#define ERROR_INVALID_MSGBOX_STYLE 1438L +#define ERROR_INVALID_SPI_VALUE 1439L +#define ERROR_SCREEN_ALREADY_LOCKED 1440L +#define ERROR_HWNDS_HAVE_DIFF_PARENT 1441L +#define ERROR_NOT_CHILD_WINDOW 1442L +#define ERROR_INVALID_GW_COMMAND 1443L +#define ERROR_INVALID_THREAD_ID 1444L +#define ERROR_NON_MDICHILD_WINDOW 1445L +#define ERROR_POPUP_ALREADY_ACTIVE 1446L +#define ERROR_NO_SCROLLBARS 1447L +#define ERROR_INVALID_SCROLLBAR_RANGE 1448L +#define ERROR_INVALID_SHOWWIN_COMMAND 1449L +#define ERROR_NO_SYSTEM_RESOURCES 1450L +#define ERROR_NONPAGED_SYSTEM_RESOURCES 1451L +#define ERROR_PAGED_SYSTEM_RESOURCES 1452L +#define ERROR_WORKING_SET_QUOTA 1453L +#define ERROR_PAGEFILE_QUOTA 1454L +#define ERROR_COMMITMENT_LIMIT 1455L +#define ERROR_MENU_ITEM_NOT_FOUND 1456L +#define ERROR_INVALID_KEYBOARD_HANDLE 1457L +#define ERROR_HOOK_TYPE_NOT_ALLOWED 1458L +#define ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION 1459L +#define ERROR_TIMEOUT 1460L +#define ERROR_INVALID_MONITOR_HANDLE 1461L +#define ERROR_INCORRECT_SIZE 1462L +#define ERROR_EVENTLOG_FILE_CORRUPT 1500L +#define ERROR_EVENTLOG_CANT_START 1501L +#define ERROR_LOG_FILE_FULL 1502L +#define ERROR_EVENTLOG_FILE_CHANGED 1503L +#define ERROR_INSTALL_SERVICE_FAILURE 1601L +#define ERROR_INSTALL_USEREXIT 1602L +#define ERROR_INSTALL_FAILURE 1603L +#define ERROR_INSTALL_SUSPEND 1604L +#define ERROR_UNKNOWN_PRODUCT 1605L +#define ERROR_UNKNOWN_FEATURE 1606L +#define ERROR_UNKNOWN_COMPONENT 1607L +#define ERROR_UNKNOWN_PROPERTY 1608L +#define ERROR_INVALID_HANDLE_STATE 1609L +#define ERROR_BAD_CONFIGURATION 1610L +#define ERROR_INDEX_ABSENT 1611L +#define ERROR_INSTALL_SOURCE_ABSENT 1612L +#define ERROR_INSTALL_PACKAGE_VERSION 1613L +#define ERROR_PRODUCT_UNINSTALLED 1614L +#define ERROR_BAD_QUERY_SYNTAX 1615L +#define ERROR_INVALID_FIELD 1616L +#define ERROR_DEVICE_REMOVED 1617L +#define ERROR_INSTALL_ALREADY_RUNNING 1618L +#define ERROR_INSTALL_PACKAGE_OPEN_FAILED 1619L +#define ERROR_INSTALL_PACKAGE_INVALID 1620L +#define ERROR_INSTALL_UI_FAILURE 1621L +#define ERROR_INSTALL_LOG_FAILURE 1622L +#define ERROR_INSTALL_LANGUAGE_UNSUPPORTED 1623L +#define ERROR_INSTALL_TRANSFORM_FAILURE 1624L +#define ERROR_INSTALL_PACKAGE_REJECTED 1625L +#define ERROR_FUNCTION_NOT_CALLED 1626L +#define ERROR_FUNCTION_FAILED 1627L +#define ERROR_INVALID_TABLE 1628L +#define ERROR_DATATYPE_MISMATCH 1629L +#define ERROR_UNSUPPORTED_TYPE 1630L +#define ERROR_CREATE_FAILED 1631L +#define ERROR_INSTALL_TEMP_UNWRITABLE 1632L +#define ERROR_INSTALL_PLATFORM_UNSUPPORTED 1633L +#define ERROR_INSTALL_NOTUSED 1634L +#define ERROR_PATCH_PACKAGE_OPEN_FAILED 1635L +#define ERROR_PATCH_PACKAGE_INVALID 1636L +#define ERROR_PATCH_PACKAGE_UNSUPPORTED 1637L +#define ERROR_PRODUCT_VERSION 1638L +#define ERROR_INVALID_COMMAND_LINE 1639L +#define ERROR_INSTALL_REMOTE_DISALLOWED 1640L +#define ERROR_SUCCESS_REBOOT_INITIATED 1641L +#define ERROR_PATCH_TARGET_NOT_FOUND 1642L +#define ERROR_PATCH_PACKAGE_REJECTED 1643L +#define ERROR_INSTALL_TRANSFORM_REJECTED 1644L +#define ERROR_INSTALL_REMOTE_PROHIBITED 1645L +#define RPC_S_INVALID_STRING_BINDING 1700L +#define RPC_S_WRONG_KIND_OF_BINDING 1701L +#define RPC_S_INVALID_BINDING 1702L +#define RPC_S_PROTSEQ_NOT_SUPPORTED 1703L +#define RPC_S_INVALID_RPC_PROTSEQ 1704L +#define RPC_S_INVALID_STRING_UUID 1705L +#define RPC_S_INVALID_ENDPOINT_FORMAT 1706L +#define RPC_S_INVALID_NET_ADDR 1707L +#define RPC_S_NO_ENDPOINT_FOUND 1708L +#define RPC_S_INVALID_TIMEOUT 1709L +#define RPC_S_OBJECT_NOT_FOUND 1710L +#define RPC_S_ALREADY_REGISTERED 1711L +#define RPC_S_TYPE_ALREADY_REGISTERED 1712L +#define RPC_S_ALREADY_LISTENING 1713L +#define RPC_S_NO_PROTSEQS_REGISTERED 1714L +#define RPC_S_NOT_LISTENING 1715L +#define RPC_S_UNKNOWN_MGR_TYPE 1716L +#define RPC_S_UNKNOWN_IF 1717L +#define RPC_S_NO_BINDINGS 1718L +#define RPC_S_NO_PROTSEQS 1719L +#define RPC_S_CANT_CREATE_ENDPOINT 1720L +#define RPC_S_OUT_OF_RESOURCES 1721L +#define RPC_S_SERVER_UNAVAILABLE 1722L +#define RPC_S_SERVER_TOO_BUSY 1723L +#define RPC_S_INVALID_NETWORK_OPTIONS 1724L +#define RPC_S_NO_CALL_ACTIVE 1725L +#define RPC_S_CALL_FAILED 1726L +#define RPC_S_CALL_FAILED_DNE 1727L +#define RPC_S_PROTOCOL_ERROR 1728L +#define RPC_S_UNSUPPORTED_TRANS_SYN 1730L +#define RPC_S_UNSUPPORTED_TYPE 1732L +#define RPC_S_INVALID_TAG 1733L +#define RPC_S_INVALID_BOUND 1734L +#define RPC_S_NO_ENTRY_NAME 1735L +#define RPC_S_INVALID_NAME_SYNTAX 1736L +#define RPC_S_UNSUPPORTED_NAME_SYNTAX 1737L +#define RPC_S_UUID_NO_ADDRESS 1739L +#define RPC_S_DUPLICATE_ENDPOINT 1740L +#define RPC_S_UNKNOWN_AUTHN_TYPE 1741L +#define RPC_S_MAX_CALLS_TOO_SMALL 1742L +#define RPC_S_STRING_TOO_LONG 1743L +#define RPC_S_PROTSEQ_NOT_FOUND 1744L +#define RPC_S_PROCNUM_OUT_OF_RANGE 1745L +#define RPC_S_BINDING_HAS_NO_AUTH 1746L +#define RPC_S_UNKNOWN_AUTHN_SERVICE 1747L +#define RPC_S_UNKNOWN_AUTHN_LEVEL 1748L +#define RPC_S_INVALID_AUTH_IDENTITY 1749L +#define RPC_S_UNKNOWN_AUTHZ_SERVICE 1750L +#define EPT_S_INVALID_ENTRY 1751L +#define EPT_S_CANT_PERFORM_OP 1752L +#define EPT_S_NOT_REGISTERED 1753L +#define RPC_S_NOTHING_TO_EXPORT 1754L +#define RPC_S_INCOMPLETE_NAME 1755L +#define RPC_S_INVALID_VERS_OPTION 1756L +#define RPC_S_NO_MORE_MEMBERS 1757L +#define RPC_S_NOT_ALL_OBJS_UNEXPORTED 1758L +#define RPC_S_INTERFACE_NOT_FOUND 1759L +#define RPC_S_ENTRY_ALREADY_EXISTS 1760L +#define RPC_S_ENTRY_NOT_FOUND 1761L +#define RPC_S_NAME_SERVICE_UNAVAILABLE 1762L +#define RPC_S_INVALID_NAF_ID 1763L +#define RPC_S_CANNOT_SUPPORT 1764L +#define RPC_S_NO_CONTEXT_AVAILABLE 1765L +#define RPC_S_INTERNAL_ERROR 1766L +#define RPC_S_ZERO_DIVIDE 1767L +#define RPC_S_ADDRESS_ERROR 1768L +#define RPC_S_FP_DIV_ZERO 1769L +#define RPC_S_FP_UNDERFLOW 1770L +#define RPC_S_FP_OVERFLOW 1771L +#define RPC_X_NO_MORE_ENTRIES 1772L +#define RPC_X_SS_CHAR_TRANS_OPEN_FAIL 1773L +#define RPC_X_SS_CHAR_TRANS_SHORT_FILE 1774L +#define RPC_X_SS_IN_NULL_CONTEXT 1775L +#define RPC_X_SS_CONTEXT_DAMAGED 1777L +#define RPC_X_SS_HANDLES_MISMATCH 1778L +#define RPC_X_SS_CANNOT_GET_CALL_HANDLE 1779L +#define RPC_X_NULL_REF_POINTER 1780L +#define RPC_X_ENUM_VALUE_OUT_OF_RANGE 1781L +#define RPC_X_BYTE_COUNT_TOO_SMALL 1782L +#define RPC_X_BAD_STUB_DATA 1783L +#define ERROR_INVALID_USER_BUFFER 1784L +#define ERROR_UNRECOGNIZED_MEDIA 1785L +#define ERROR_NO_TRUST_LSA_SECRET 1786L +#define ERROR_NO_TRUST_SAM_ACCOUNT 1787L +#define ERROR_TRUSTED_DOMAIN_FAILURE 1788L +#define ERROR_TRUSTED_RELATIONSHIP_FAILURE 1789L +#define ERROR_TRUST_FAILURE 1790L +#define RPC_S_CALL_IN_PROGRESS 1791L +#define ERROR_NETLOGON_NOT_STARTED 1792L +#define ERROR_ACCOUNT_EXPIRED 1793L +#define ERROR_REDIRECTOR_HAS_OPEN_HANDLES 1794L +#define ERROR_PRINTER_DRIVER_ALREADY_INSTALLED 1795L +#define ERROR_UNKNOWN_PORT 1796L +#define ERROR_UNKNOWN_PRINTER_DRIVER 1797L +#define ERROR_UNKNOWN_PRINTPROCESSOR 1798L +#define ERROR_INVALID_SEPARATOR_FILE 1799L +#define ERROR_INVALID_PRIORITY 1800L +#define ERROR_INVALID_PRINTER_NAME 1801L +#define ERROR_PRINTER_ALREADY_EXISTS 1802L +#define ERROR_INVALID_PRINTER_COMMAND 1803L +#define ERROR_INVALID_DATATYPE 1804L +#define ERROR_INVALID_ENVIRONMENT 1805L +#define RPC_S_NO_MORE_BINDINGS 1806L +#define ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 1807L +#define ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT 1808L +#define ERROR_NOLOGON_SERVER_TRUST_ACCOUNT 1809L +#define ERROR_DOMAIN_TRUST_INCONSISTENT 1810L +#define ERROR_SERVER_HAS_OPEN_HANDLES 1811L +#define ERROR_RESOURCE_DATA_NOT_FOUND 1812L +#define ERROR_RESOURCE_TYPE_NOT_FOUND 1813L +#define ERROR_RESOURCE_NAME_NOT_FOUND 1814L +#define ERROR_RESOURCE_LANG_NOT_FOUND 1815L +#define ERROR_NOT_ENOUGH_QUOTA 1816L +#define RPC_S_NO_INTERFACES 1817L +#define RPC_S_CALL_CANCELLED 1818L +#define RPC_S_BINDING_INCOMPLETE 1819L +#define RPC_S_COMM_FAILURE 1820L +#define RPC_S_UNSUPPORTED_AUTHN_LEVEL 1821L +#define RPC_S_NO_PRINC_NAME 1822L +#define RPC_S_NOT_RPC_ERROR 1823L +#define RPC_S_UUID_LOCAL_ONLY 1824L +#define RPC_S_SEC_PKG_ERROR 1825L +#define RPC_S_NOT_CANCELLED 1826L +#define RPC_X_INVALID_ES_ACTION 1827L +#define RPC_X_WRONG_ES_VERSION 1828L +#define RPC_X_WRONG_STUB_VERSION 1829L +#define RPC_X_INVALID_PIPE_OBJECT 1830L +#define RPC_X_WRONG_PIPE_ORDER 1831L +#define RPC_X_WRONG_PIPE_VERSION 1832L +#define RPC_S_GROUP_MEMBER_NOT_FOUND 1898L +#define EPT_S_CANT_CREATE 1899L +#define RPC_S_INVALID_OBJECT 1900L +#define ERROR_INVALID_TIME 1901L +#define ERROR_INVALID_FORM_NAME 1902L +#define ERROR_INVALID_FORM_SIZE 1903L +#define ERROR_ALREADY_WAITING 1904L +#define ERROR_PRINTER_DELETED 1905L +#define ERROR_INVALID_PRINTER_STATE 1906L +#define ERROR_PASSWORD_MUST_CHANGE 1907L +#define ERROR_DOMAIN_CONTROLLER_NOT_FOUND 1908L +#define ERROR_ACCOUNT_LOCKED_OUT 1909L +#define OR_INVALID_OXID 1910L +#define OR_INVALID_OID 1911L +#define OR_INVALID_SET 1912L +#define RPC_S_SEND_INCOMPLETE 1913L +#define RPC_S_INVALID_ASYNC_HANDLE 1914L +#define RPC_S_INVALID_ASYNC_CALL 1915L +#define RPC_X_PIPE_CLOSED 1916L +#define RPC_X_PIPE_DISCIPLINE_ERROR 1917L +#define RPC_X_PIPE_EMPTY 1918L +#define ERROR_NO_SITENAME 1919L +#define ERROR_CANT_ACCESS_FILE 1920L +#define ERROR_CANT_RESOLVE_FILENAME 1921L +#define RPC_S_ENTRY_TYPE_MISMATCH 1922L +#define RPC_S_NOT_ALL_OBJS_EXPORTED 1923L +#define RPC_S_INTERFACE_NOT_EXPORTED 1924L +#define RPC_S_PROFILE_NOT_ADDED 1925L +#define RPC_S_PRF_ELT_NOT_ADDED 1926L +#define RPC_S_PRF_ELT_NOT_REMOVED 1927L +#define RPC_S_GRP_ELT_NOT_ADDED 1928L +#define RPC_S_GRP_ELT_NOT_REMOVED 1929L +#define ERROR_KM_DRIVER_BLOCKED 1930L +#define ERROR_CONTEXT_EXPIRED 1931L +#define ERROR_PER_USER_TRUST_QUOTA_EXCEEDED 1932L +#define ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED 1933L +#define ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED 1934L +#define ERROR_AUTHENTICATION_FIREWALL_FAILED 1935L +#define ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED 1936L +#define ERROR_INVALID_PIXEL_FORMAT 2000L +#define ERROR_BAD_DRIVER 2001L +#define ERROR_INVALID_WINDOW_STYLE 2002L +#define ERROR_METAFILE_NOT_SUPPORTED 2003L +#define ERROR_TRANSFORM_NOT_SUPPORTED 2004L +#define ERROR_CLIPPING_NOT_SUPPORTED 2005L +#define ERROR_INVALID_CMM 2010L +#define ERROR_INVALID_PROFILE 2011L +#define ERROR_TAG_NOT_FOUND 2012L +#define ERROR_TAG_NOT_PRESENT 2013L +#define ERROR_DUPLICATE_TAG 2014L +#define ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE 2015L +#define ERROR_PROFILE_NOT_FOUND 2016L +#define ERROR_INVALID_COLORSPACE 2017L +#define ERROR_ICM_NOT_ENABLED 2018L +#define ERROR_DELETING_ICM_XFORM 2019L +#define ERROR_INVALID_TRANSFORM 2020L +#define ERROR_COLORSPACE_MISMATCH 2021L +#define ERROR_INVALID_COLORINDEX 2022L +#define ERROR_CONNECTED_OTHER_PASSWORD 2108L +#define ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT 2109L +#define ERROR_BAD_USERNAME 2202L +#define ERROR_NOT_CONNECTED 2250L +#define ERROR_OPEN_FILES 2401L +#define ERROR_ACTIVE_CONNECTIONS 2402L +#define ERROR_DEVICE_IN_USE 2404L +#define ERROR_UNKNOWN_PRINT_MONITOR 3000L +#define ERROR_PRINTER_DRIVER_IN_USE 3001L +#define ERROR_SPOOL_FILE_NOT_FOUND 3002L +#define ERROR_SPL_NO_STARTDOC 3003L +#define ERROR_SPL_NO_ADDJOB 3004L +#define ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED 3005L +#define ERROR_PRINT_MONITOR_ALREADY_INSTALLED 3006L +#define ERROR_INVALID_PRINT_MONITOR 3007L +#define ERROR_PRINT_MONITOR_IN_USE 3008L +#define ERROR_PRINTER_HAS_JOBS_QUEUED 3009L +#define ERROR_SUCCESS_REBOOT_REQUIRED 3010L +#define ERROR_SUCCESS_RESTART_REQUIRED 3011L +#define ERROR_PRINTER_NOT_FOUND 3012L +#define ERROR_PRINTER_DRIVER_WARNED 3013L +#define ERROR_PRINTER_DRIVER_BLOCKED 3014L +#define ERROR_WINS_INTERNAL 4000L +#define ERROR_CAN_NOT_DEL_LOCAL_WINS 4001L +#define ERROR_STATIC_INIT 4002L +#define ERROR_INC_BACKUP 4003L +#define ERROR_FULL_BACKUP 4004L +#define ERROR_REC_NON_EXISTENT 4005L +#define ERROR_RPL_NOT_ALLOWED 4006L +#define ERROR_DHCP_ADDRESS_CONFLICT 4100L +#define ERROR_WMI_GUID_NOT_FOUND 4200L +#define ERROR_WMI_INSTANCE_NOT_FOUND 4201L +#define ERROR_WMI_ITEMID_NOT_FOUND 4202L +#define ERROR_WMI_TRY_AGAIN 4203L +#define ERROR_WMI_DP_NOT_FOUND 4204L +#define ERROR_WMI_UNRESOLVED_INSTANCE_REF 4205L +#define ERROR_WMI_ALREADY_ENABLED 4206L +#define ERROR_WMI_GUID_DISCONNECTED 4207L +#define ERROR_WMI_SERVER_UNAVAILABLE 4208L +#define ERROR_WMI_DP_FAILED 4209L +#define ERROR_WMI_INVALID_MOF 4210L +#define ERROR_WMI_INVALID_REGINFO 4211L +#define ERROR_WMI_ALREADY_DISABLED 4212L +#define ERROR_WMI_READ_ONLY 4213L +#define ERROR_WMI_SET_FAILURE 4214L +#define ERROR_INVALID_MEDIA 4300L +#define ERROR_INVALID_LIBRARY 4301L +#define ERROR_INVALID_MEDIA_POOL 4302L +#define ERROR_DRIVE_MEDIA_MISMATCH 4303L +#define ERROR_MEDIA_OFFLINE 4304L +#define ERROR_LIBRARY_OFFLINE 4305L +#define ERROR_EMPTY 4306L +#define ERROR_NOT_EMPTY 4307L +#define ERROR_MEDIA_UNAVAILABLE 4308L +#define ERROR_RESOURCE_DISABLED 4309L +#define ERROR_INVALID_CLEANER 4310L +#define ERROR_UNABLE_TO_CLEAN 4311L +#define ERROR_OBJECT_NOT_FOUND 4312L +#define ERROR_DATABASE_FAILURE 4313L +#define ERROR_DATABASE_FULL 4314L +#define ERROR_MEDIA_INCOMPATIBLE 4315L +#define ERROR_RESOURCE_NOT_PRESENT 4316L +#define ERROR_INVALID_OPERATION 4317L +#define ERROR_MEDIA_NOT_AVAILABLE 4318L +#define ERROR_DEVICE_NOT_AVAILABLE 4319L +#define ERROR_REQUEST_REFUSED 4320L +#define ERROR_INVALID_DRIVE_OBJECT 4321L +#define ERROR_LIBRARY_FULL 4322L +#define ERROR_MEDIUM_NOT_ACCESSIBLE 4323L +#define ERROR_UNABLE_TO_LOAD_MEDIUM 4324L +#define ERROR_UNABLE_TO_INVENTORY_DRIVE 4325L +#define ERROR_UNABLE_TO_INVENTORY_SLOT 4326L +#define ERROR_UNABLE_TO_INVENTORY_TRANSPORT 4327L +#define ERROR_TRANSPORT_FULL 4328L +#define ERROR_CONTROLLING_IEPORT 4329L +#define ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA 4330L +#define ERROR_CLEANER_SLOT_SET 4331L +#define ERROR_CLEANER_SLOT_NOT_SET 4332L +#define ERROR_CLEANER_CARTRIDGE_SPENT 4333L +#define ERROR_UNEXPECTED_OMID 4334L +#define ERROR_CANT_DELETE_LAST_ITEM 4335L +#define ERROR_MESSAGE_EXCEEDS_MAX_SIZE 4336L +#define ERROR_VOLUME_CONTAINS_SYS_FILES 4337L +#define ERROR_INDIGENOUS_TYPE 4338L +#define ERROR_NO_SUPPORTING_DRIVES 4339L +#define ERROR_CLEANER_CARTRIDGE_INSTALLED 4340L +#define ERROR_IEPORT_FULL 4341L +#define ERROR_FILE_OFFLINE 4350L +#define ERROR_REMOTE_STORAGE_NOT_ACTIVE 4351L +#define ERROR_REMOTE_STORAGE_MEDIA_ERROR 4352L +#define ERROR_NOT_A_REPARSE_POINT 4390L +#define ERROR_REPARSE_ATTRIBUTE_CONFLICT 4391L +#define ERROR_INVALID_REPARSE_DATA 4392L +#define ERROR_REPARSE_TAG_INVALID 4393L +#define ERROR_REPARSE_TAG_MISMATCH 4394L +#define ERROR_VOLUME_NOT_SIS_ENABLED 4500L +#define ERROR_DEPENDENT_RESOURCE_EXISTS 5001L +#define ERROR_DEPENDENCY_NOT_FOUND 5002L +#define ERROR_DEPENDENCY_ALREADY_EXISTS 5003L +#define ERROR_RESOURCE_NOT_ONLINE 5004L +#define ERROR_HOST_NODE_NOT_AVAILABLE 5005L +#define ERROR_RESOURCE_NOT_AVAILABLE 5006L +#define ERROR_RESOURCE_NOT_FOUND 5007L +#define ERROR_SHUTDOWN_CLUSTER 5008L +#define ERROR_CANT_EVICT_ACTIVE_NODE 5009L +#define ERROR_OBJECT_ALREADY_EXISTS 5010L +#define ERROR_OBJECT_IN_LIST 5011L +#define ERROR_GROUP_NOT_AVAILABLE 5012L +#define ERROR_GROUP_NOT_FOUND 5013L +#define ERROR_GROUP_NOT_ONLINE 5014L +#define ERROR_HOST_NODE_NOT_RESOURCE_OWNER 5015L +#define ERROR_HOST_NODE_NOT_GROUP_OWNER 5016L +#define ERROR_RESMON_CREATE_FAILED 5017L +#define ERROR_RESMON_ONLINE_FAILED 5018L +#define ERROR_RESOURCE_ONLINE 5019L +#define ERROR_QUORUM_RESOURCE 5020L +#define ERROR_NOT_QUORUM_CAPABLE 5021L +#define ERROR_CLUSTER_SHUTTING_DOWN 5022L +#define ERROR_INVALID_STATE 5023L +#define ERROR_RESOURCE_PROPERTIES_STORED 5024L +#define ERROR_NOT_QUORUM_CLASS 5025L +#define ERROR_CORE_RESOURCE 5026L +#define ERROR_QUORUM_RESOURCE_ONLINE_FAILED 5027L +#define ERROR_QUORUMLOG_OPEN_FAILED 5028L +#define ERROR_CLUSTERLOG_CORRUPT 5029L +#define ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE 5030L +#define ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE 5031L +#define ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND 5032L +#define ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE 5033L +#define ERROR_QUORUM_OWNER_ALIVE 5034L +#define ERROR_NETWORK_NOT_AVAILABLE 5035L +#define ERROR_NODE_NOT_AVAILABLE 5036L +#define ERROR_ALL_NODES_NOT_AVAILABLE 5037L +#define ERROR_RESOURCE_FAILED 5038L +#define ERROR_CLUSTER_INVALID_NODE 5039L +#define ERROR_CLUSTER_NODE_EXISTS 5040L +#define ERROR_CLUSTER_JOIN_IN_PROGRESS 5041L +#define ERROR_CLUSTER_NODE_NOT_FOUND 5042L +#define ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND 5043L +#define ERROR_CLUSTER_NETWORK_EXISTS 5044L +#define ERROR_CLUSTER_NETWORK_NOT_FOUND 5045L +#define ERROR_CLUSTER_NETINTERFACE_EXISTS 5046L +#define ERROR_CLUSTER_NETINTERFACE_NOT_FOUND 5047L +#define ERROR_CLUSTER_INVALID_REQUEST 5048L +#define ERROR_CLUSTER_INVALID_NETWORK_PROVIDER 5049L +#define ERROR_CLUSTER_NODE_DOWN 5050L +#define ERROR_CLUSTER_NODE_UNREACHABLE 5051L +#define ERROR_CLUSTER_NODE_NOT_MEMBER 5052L +#define ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS 5053L +#define ERROR_CLUSTER_INVALID_NETWORK 5054L +#define ERROR_CLUSTER_NODE_UP 5056L +#define ERROR_CLUSTER_IPADDR_IN_USE 5057L +#define ERROR_CLUSTER_NODE_NOT_PAUSED 5058L +#define ERROR_CLUSTER_NO_SECURITY_CONTEXT 5059L +#define ERROR_CLUSTER_NETWORK_NOT_INTERNAL 5060L +#define ERROR_CLUSTER_NODE_ALREADY_UP 5061L +#define ERROR_CLUSTER_NODE_ALREADY_DOWN 5062L +#define ERROR_CLUSTER_NETWORK_ALREADY_ONLINE 5063L +#define ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE 5064L +#define ERROR_CLUSTER_NODE_ALREADY_MEMBER 5065L +#define ERROR_CLUSTER_LAST_INTERNAL_NETWORK 5066L +#define ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS 5067L +#define ERROR_INVALID_OPERATION_ON_QUORUM 5068L +#define ERROR_DEPENDENCY_NOT_ALLOWED 5069L +#define ERROR_CLUSTER_NODE_PAUSED 5070L +#define ERROR_NODE_CANT_HOST_RESOURCE 5071L +#define ERROR_CLUSTER_NODE_NOT_READY 5072L +#define ERROR_CLUSTER_NODE_SHUTTING_DOWN 5073L +#define ERROR_CLUSTER_JOIN_ABORTED 5074L +#define ERROR_CLUSTER_INCOMPATIBLE_VERSIONS 5075L +#define ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED 5076L +#define ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED 5077L +#define ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND 5078L +#define ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED 5079L +#define ERROR_CLUSTER_RESNAME_NOT_FOUND 5080L +#define ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED 5081L +#define ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST 5082L +#define ERROR_CLUSTER_DATABASE_SEQMISMATCH 5083L +#define ERROR_RESMON_INVALID_STATE 5084L +#define ERROR_CLUSTER_GUM_NOT_LOCKER 5085L +#define ERROR_QUORUM_DISK_NOT_FOUND 5086L +#define ERROR_DATABASE_BACKUP_CORRUPT 5087L +#define ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT 5088L +#define ERROR_RESOURCE_PROPERTY_UNCHANGEABLE 5089L +#define ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE 5890L +#define ERROR_CLUSTER_QUORUMLOG_NOT_FOUND 5891L +#define ERROR_CLUSTER_MEMBERSHIP_HALT 5892L +#define ERROR_CLUSTER_INSTANCE_ID_MISMATCH 5893L +#define ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP 5894L +#define ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH 5895L +#define ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP 5896L +#define ERROR_CLUSTER_PARAMETER_MISMATCH 5897L +#define ERROR_NODE_CANNOT_BE_CLUSTERED 5898L +#define ERROR_CLUSTER_WRONG_OS_VERSION 5899L +#define ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME 5900L +#define ERROR_CLUSCFG_ALREADY_COMMITTED 5901L +#define ERROR_CLUSCFG_ROLLBACK_FAILED 5902L +#define ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT 5903L +#define ERROR_CLUSTER_OLD_VERSION 5904L +#define ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME 5905L +#define ERROR_ENCRYPTION_FAILED 6000L +#define ERROR_DECRYPTION_FAILED 6001L +#define ERROR_FILE_ENCRYPTED 6002L +#define ERROR_NO_RECOVERY_POLICY 6003L +#define ERROR_NO_EFS 6004L +#define ERROR_WRONG_EFS 6005L +#define ERROR_NO_USER_KEYS 6006L +#define ERROR_FILE_NOT_ENCRYPTED 6007L +#define ERROR_NOT_EXPORT_FORMAT 6008L +#define ERROR_FILE_READ_ONLY 6009L +#define ERROR_DIR_EFS_DISALLOWED 6010L +#define ERROR_EFS_SERVER_NOT_TRUSTED 6011L +#define ERROR_BAD_RECOVERY_POLICY 6012L +#define ERROR_EFS_ALG_BLOB_TOO_BIG 6013L +#define ERROR_VOLUME_NOT_SUPPORT_EFS 6014L +#define ERROR_EFS_DISABLED 6015L +#define ERROR_EFS_VERSION_NOT_SUPPORT 6016L +#define ERROR_NO_BROWSER_SERVERS_FOUND 6118L +#define SCHED_E_SERVICE_NOT_LOCALSYSTEM 6200L +#define ERROR_CTX_WINSTATION_NAME_INVALID 7001L +#define ERROR_CTX_INVALID_PD 7002L +#define ERROR_CTX_PD_NOT_FOUND 7003L +#define ERROR_CTX_WD_NOT_FOUND 7004L +#define ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY 7005L +#define ERROR_CTX_SERVICE_NAME_COLLISION 7006L +#define ERROR_CTX_CLOSE_PENDING 7007L +#define ERROR_CTX_NO_OUTBUF 7008L +#define ERROR_CTX_MODEM_INF_NOT_FOUND 7009L +#define ERROR_CTX_INVALID_MODEMNAME 7010L +#define ERROR_CTX_MODEM_RESPONSE_ERROR 7011L +#define ERROR_CTX_MODEM_RESPONSE_TIMEOUT 7012L +#define ERROR_CTX_MODEM_RESPONSE_NO_CARRIER 7013L +#define ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE 7014L +#define ERROR_CTX_MODEM_RESPONSE_BUSY 7015L +#define ERROR_CTX_MODEM_RESPONSE_VOICE 7016L +#define ERROR_CTX_TD_ERROR 7017L +#define ERROR_CTX_WINSTATION_NOT_FOUND 7022L +#define ERROR_CTX_WINSTATION_ALREADY_EXISTS 7023L +#define ERROR_CTX_WINSTATION_BUSY 7024L +#define ERROR_CTX_BAD_VIDEO_MODE 7025L +#define ERROR_CTX_GRAPHICS_INVALID 7035L +#define ERROR_CTX_LOGON_DISABLED 7037L +#define ERROR_CTX_NOT_CONSOLE 7038L +#define ERROR_CTX_CLIENT_QUERY_TIMEOUT 7040L +#define ERROR_CTX_CONSOLE_DISCONNECT 7041L +#define ERROR_CTX_CONSOLE_CONNECT 7042L +#define ERROR_CTX_SHADOW_DENIED 7044L +#define ERROR_CTX_WINSTATION_ACCESS_DENIED 7045L +#define ERROR_CTX_INVALID_WD 7049L +#define ERROR_CTX_SHADOW_INVALID 7050L +#define ERROR_CTX_SHADOW_DISABLED 7051L +#define ERROR_CTX_CLIENT_LICENSE_IN_USE 7052L +#define ERROR_CTX_CLIENT_LICENSE_NOT_SET 7053L +#define ERROR_CTX_LICENSE_NOT_AVAILABLE 7054L +#define ERROR_CTX_LICENSE_CLIENT_INVALID 7055L +#define ERROR_CTX_LICENSE_EXPIRED 7056L +#define ERROR_CTX_SHADOW_NOT_RUNNING 7057L +#define ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE 7058L +#define ERROR_ACTIVATION_COUNT_EXCEEDED 7059L +#define FRS_ERR_INVALID_API_SEQUENCE 8001L +#define FRS_ERR_STARTING_SERVICE 8002L +#define FRS_ERR_STOPPING_SERVICE 8003L +#define FRS_ERR_INTERNAL_API 8004L +#define FRS_ERR_INTERNAL 8005L +#define FRS_ERR_SERVICE_COMM 8006L +#define FRS_ERR_INSUFFICIENT_PRIV 8007L +#define FRS_ERR_AUTHENTICATION 8008L +#define FRS_ERR_PARENT_INSUFFICIENT_PRIV 8009L +#define FRS_ERR_PARENT_AUTHENTICATION 8010L +#define FRS_ERR_CHILD_TO_PARENT_COMM 8011L +#define FRS_ERR_PARENT_TO_CHILD_COMM 8012L +#define FRS_ERR_SYSVOL_POPULATE 8013L +#define FRS_ERR_SYSVOL_POPULATE_TIMEOUT 8014L +#define FRS_ERR_SYSVOL_IS_BUSY 8015L +#define FRS_ERR_SYSVOL_DEMOTE 8016L +#define FRS_ERR_INVALID_SERVICE_PARAMETER 8017L +#define DS_S_SUCCESS NO_ERROR +#define ERROR_DS_NOT_INSTALLED 8200L +#define ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY 8201L +#define ERROR_DS_NO_ATTRIBUTE_OR_VALUE 8202L +#define ERROR_DS_INVALID_ATTRIBUTE_SYNTAX 8203L +#define ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED 8204L +#define ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS 8205L +#define ERROR_DS_BUSY 8206L +#define ERROR_DS_UNAVAILABLE 8207L +#define ERROR_DS_NO_RIDS_ALLOCATED 8208L +#define ERROR_DS_NO_MORE_RIDS 8209L +#define ERROR_DS_INCORRECT_ROLE_OWNER 8210L +#define ERROR_DS_RIDMGR_INIT_ERROR 8211L +#define ERROR_DS_OBJ_CLASS_VIOLATION 8212L +#define ERROR_DS_CANT_ON_NON_LEAF 8213L +#define ERROR_DS_CANT_ON_RDN 8214L +#define ERROR_DS_CANT_MOD_OBJ_CLASS 8215L +#define ERROR_DS_CROSS_DOM_MOVE_ERROR 8216L +#define ERROR_DS_GC_NOT_AVAILABLE 8217L +#define ERROR_SHARED_POLICY 8218L +#define ERROR_POLICY_OBJECT_NOT_FOUND 8219L +#define ERROR_POLICY_ONLY_IN_DS 8220L +#define ERROR_PROMOTION_ACTIVE 8221L +#define ERROR_NO_PROMOTION_ACTIVE 8222L +#define ERROR_DS_OPERATIONS_ERROR 8224L +#define ERROR_DS_PROTOCOL_ERROR 8225L +#define ERROR_DS_TIMELIMIT_EXCEEDED 8226L +#define ERROR_DS_SIZELIMIT_EXCEEDED 8227L +#define ERROR_DS_ADMIN_LIMIT_EXCEEDED 8228L +#define ERROR_DS_COMPARE_FALSE 8229L +#define ERROR_DS_COMPARE_TRUE 8230L +#define ERROR_DS_AUTH_METHOD_NOT_SUPPORTED 8231L +#define ERROR_DS_STRONG_AUTH_REQUIRED 8232L +#define ERROR_DS_INAPPROPRIATE_AUTH 8233L +#define ERROR_DS_AUTH_UNKNOWN 8234L +#define ERROR_DS_REFERRAL 8235L +#define ERROR_DS_UNAVAILABLE_CRIT_EXTENSION 8236L +#define ERROR_DS_CONFIDENTIALITY_REQUIRED 8237L +#define ERROR_DS_INAPPROPRIATE_MATCHING 8238L +#define ERROR_DS_CONSTRAINT_VIOLATION 8239L +#define ERROR_DS_NO_SUCH_OBJECT 8240L +#define ERROR_DS_ALIAS_PROBLEM 8241L +#define ERROR_DS_INVALID_DN_SYNTAX 8242L +#define ERROR_DS_IS_LEAF 8243L +#define ERROR_DS_ALIAS_DEREF_PROBLEM 8244L +#define ERROR_DS_UNWILLING_TO_PERFORM 8245L +#define ERROR_DS_LOOP_DETECT 8246L +#define ERROR_DS_NAMING_VIOLATION 8247L +#define ERROR_DS_OBJECT_RESULTS_TOO_LARGE 8248L +#define ERROR_DS_AFFECTS_MULTIPLE_DSAS 8249L +#define ERROR_DS_SERVER_DOWN 8250L +#define ERROR_DS_LOCAL_ERROR 8251L +#define ERROR_DS_ENCODING_ERROR 8252L +#define ERROR_DS_DECODING_ERROR 8253L +#define ERROR_DS_FILTER_UNKNOWN 8254L +#define ERROR_DS_PARAM_ERROR 8255L +#define ERROR_DS_NOT_SUPPORTED 8256L +#define ERROR_DS_NO_RESULTS_RETURNED 8257L +#define ERROR_DS_CONTROL_NOT_FOUND 8258L +#define ERROR_DS_CLIENT_LOOP 8259L +#define ERROR_DS_REFERRAL_LIMIT_EXCEEDED 8260L +#define ERROR_DS_SORT_CONTROL_MISSING 8261L +#define ERROR_DS_OFFSET_RANGE_ERROR 8262L +#define ERROR_DS_ROOT_MUST_BE_NC 8301L +#define ERROR_DS_ADD_REPLICA_INHIBITED 8302L +#define ERROR_DS_ATT_NOT_DEF_IN_SCHEMA 8303L +#define ERROR_DS_MAX_OBJ_SIZE_EXCEEDED 8304L +#define ERROR_DS_OBJ_STRING_NAME_EXISTS 8305L +#define ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA 8306L +#define ERROR_DS_RDN_DOESNT_MATCH_SCHEMA 8307L +#define ERROR_DS_NO_REQUESTED_ATTS_FOUND 8308L +#define ERROR_DS_USER_BUFFER_TO_SMALL 8309L +#define ERROR_DS_ATT_IS_NOT_ON_OBJ 8310L +#define ERROR_DS_ILLEGAL_MOD_OPERATION 8311L +#define ERROR_DS_OBJ_TOO_LARGE 8312L +#define ERROR_DS_BAD_INSTANCE_TYPE 8313L +#define ERROR_DS_MASTERDSA_REQUIRED 8314L +#define ERROR_DS_OBJECT_CLASS_REQUIRED 8315L +#define ERROR_DS_MISSING_REQUIRED_ATT 8316L +#define ERROR_DS_ATT_NOT_DEF_FOR_CLASS 8317L +#define ERROR_DS_ATT_ALREADY_EXISTS 8318L +#define ERROR_DS_CANT_ADD_ATT_VALUES 8320L +#define ERROR_DS_SINGLE_VALUE_CONSTRAINT 8321L +#define ERROR_DS_RANGE_CONSTRAINT 8322L +#define ERROR_DS_ATT_VAL_ALREADY_EXISTS 8323L +#define ERROR_DS_CANT_REM_MISSING_ATT 8324L +#define ERROR_DS_CANT_REM_MISSING_ATT_VAL 8325L +#define ERROR_DS_ROOT_CANT_BE_SUBREF 8326L +#define ERROR_DS_NO_CHAINING 8327L +#define ERROR_DS_NO_CHAINED_EVAL 8328L +#define ERROR_DS_NO_PARENT_OBJECT 8329L +#define ERROR_DS_PARENT_IS_AN_ALIAS 8330L +#define ERROR_DS_CANT_MIX_MASTER_AND_REPS 8331L +#define ERROR_DS_CHILDREN_EXIST 8332L +#define ERROR_DS_OBJ_NOT_FOUND 8333L +#define ERROR_DS_ALIASED_OBJ_MISSING 8334L +#define ERROR_DS_BAD_NAME_SYNTAX 8335L +#define ERROR_DS_ALIAS_POINTS_TO_ALIAS 8336L +#define ERROR_DS_CANT_DEREF_ALIAS 8337L +#define ERROR_DS_OUT_OF_SCOPE 8338L +#define ERROR_DS_OBJECT_BEING_REMOVED 8339L +#define ERROR_DS_CANT_DELETE_DSA_OBJ 8340L +#define ERROR_DS_GENERIC_ERROR 8341L +#define ERROR_DS_DSA_MUST_BE_INT_MASTER 8342L +#define ERROR_DS_CLASS_NOT_DSA 8343L +#define ERROR_DS_INSUFF_ACCESS_RIGHTS 8344L +#define ERROR_DS_ILLEGAL_SUPERIOR 8345L +#define ERROR_DS_ATTRIBUTE_OWNED_BY_SAM 8346L +#define ERROR_DS_NAME_TOO_MANY_PARTS 8347L +#define ERROR_DS_NAME_TOO_LONG 8348L +#define ERROR_DS_NAME_VALUE_TOO_LONG 8349L +#define ERROR_DS_NAME_UNPARSEABLE 8350L +#define ERROR_DS_NAME_TYPE_UNKNOWN 8351L +#define ERROR_DS_NOT_AN_OBJECT 8352L +#define ERROR_DS_SEC_DESC_TOO_SHORT 8353L +#define ERROR_DS_SEC_DESC_INVALID 8354L +#define ERROR_DS_NO_DELETED_NAME 8355L +#define ERROR_DS_SUBREF_MUST_HAVE_PARENT 8356L +#define ERROR_DS_NCNAME_MUST_BE_NC 8357L +#define ERROR_DS_CANT_ADD_SYSTEM_ONLY 8358L +#define ERROR_DS_CLASS_MUST_BE_CONCRETE 8359L +#define ERROR_DS_INVALID_DMD 8360L +#define ERROR_DS_OBJ_GUID_EXISTS 8361L +#define ERROR_DS_NOT_ON_BACKLINK 8362L +#define ERROR_DS_NO_CROSSREF_FOR_NC 8363L +#define ERROR_DS_SHUTTING_DOWN 8364L +#define ERROR_DS_UNKNOWN_OPERATION 8365L +#define ERROR_DS_INVALID_ROLE_OWNER 8366L +#define ERROR_DS_COULDNT_CONTACT_FSMO 8367L +#define ERROR_DS_CROSS_NC_DN_RENAME 8368L +#define ERROR_DS_CANT_MOD_SYSTEM_ONLY 8369L +#define ERROR_DS_REPLICATOR_ONLY 8370L +#define ERROR_DS_OBJ_CLASS_NOT_DEFINED 8371L +#define ERROR_DS_OBJ_CLASS_NOT_SUBCLASS 8372L +#define ERROR_DS_NAME_REFERENCE_INVALID 8373L +#define ERROR_DS_CROSS_REF_EXISTS 8374L +#define ERROR_DS_CANT_DEL_MASTER_CROSSREF 8375L +#define ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD 8376L +#define ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX 8377L +#define ERROR_DS_DUP_RDN 8378L +#define ERROR_DS_DUP_OID 8379L +#define ERROR_DS_DUP_MAPI_ID 8380L +#define ERROR_DS_DUP_SCHEMA_ID_GUID 8381L +#define ERROR_DS_DUP_LDAP_DISPLAY_NAME 8382L +#define ERROR_DS_SEMANTIC_ATT_TEST 8383L +#define ERROR_DS_SYNTAX_MISMATCH 8384L +#define ERROR_DS_EXISTS_IN_MUST_HAVE 8385L +#define ERROR_DS_EXISTS_IN_MAY_HAVE 8386L +#define ERROR_DS_NONEXISTENT_MAY_HAVE 8387L +#define ERROR_DS_NONEXISTENT_MUST_HAVE 8388L +#define ERROR_DS_AUX_CLS_TEST_FAIL 8389L +#define ERROR_DS_NONEXISTENT_POSS_SUP 8390L +#define ERROR_DS_SUB_CLS_TEST_FAIL 8391L +#define ERROR_DS_BAD_RDN_ATT_ID_SYNTAX 8392L +#define ERROR_DS_EXISTS_IN_AUX_CLS 8393L +#define ERROR_DS_EXISTS_IN_SUB_CLS 8394L +#define ERROR_DS_EXISTS_IN_POSS_SUP 8395L +#define ERROR_DS_RECALCSCHEMA_FAILED 8396L +#define ERROR_DS_TREE_DELETE_NOT_FINISHED 8397L +#define ERROR_DS_CANT_DELETE 8398L +#define ERROR_DS_ATT_SCHEMA_REQ_ID 8399L +#define ERROR_DS_BAD_ATT_SCHEMA_SYNTAX 8400L +#define ERROR_DS_CANT_CACHE_ATT 8401L +#define ERROR_DS_CANT_CACHE_CLASS 8402L +#define ERROR_DS_CANT_REMOVE_ATT_CACHE 8403L +#define ERROR_DS_CANT_REMOVE_CLASS_CACHE 8404L +#define ERROR_DS_CANT_RETRIEVE_DN 8405L +#define ERROR_DS_MISSING_SUPREF 8406L +#define ERROR_DS_CANT_RETRIEVE_INSTANCE 8407L +#define ERROR_DS_CODE_INCONSISTENCY 8408L +#define ERROR_DS_DATABASE_ERROR 8409L +#define ERROR_DS_GOVERNSID_MISSING 8410L +#define ERROR_DS_MISSING_EXPECTED_ATT 8411L +#define ERROR_DS_NCNAME_MISSING_CR_REF 8412L +#define ERROR_DS_SECURITY_CHECKING_ERROR 8413L +#define ERROR_DS_SCHEMA_NOT_LOADED 8414L +#define ERROR_DS_SCHEMA_ALLOC_FAILED 8415L +#define ERROR_DS_ATT_SCHEMA_REQ_SYNTAX 8416L +#define ERROR_DS_GCVERIFY_ERROR 8417L +#define ERROR_DS_DRA_SCHEMA_MISMATCH 8418L +#define ERROR_DS_CANT_FIND_DSA_OBJ 8419L +#define ERROR_DS_CANT_FIND_EXPECTED_NC 8420L +#define ERROR_DS_CANT_FIND_NC_IN_CACHE 8421L +#define ERROR_DS_CANT_RETRIEVE_CHILD 8422L +#define ERROR_DS_SECURITY_ILLEGAL_MODIFY 8423L +#define ERROR_DS_CANT_REPLACE_HIDDEN_REC 8424L +#define ERROR_DS_BAD_HIERARCHY_FILE 8425L +#define ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED 8426L +#define ERROR_DS_CONFIG_PARAM_MISSING 8427L +#define ERROR_DS_COUNTING_AB_INDICES_FAILED 8428L +#define ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED 8429L +#define ERROR_DS_INTERNAL_FAILURE 8430L +#define ERROR_DS_UNKNOWN_ERROR 8431L +#define ERROR_DS_ROOT_REQUIRES_CLASS_TOP 8432L +#define ERROR_DS_REFUSING_FSMO_ROLES 8433L +#define ERROR_DS_MISSING_FSMO_SETTINGS 8434L +#define ERROR_DS_UNABLE_TO_SURRENDER_ROLES 8435L +#define ERROR_DS_DRA_GENERIC 8436L +#define ERROR_DS_DRA_INVALID_PARAMETER 8437L +#define ERROR_DS_DRA_BUSY 8438L +#define ERROR_DS_DRA_BAD_DN 8439L +#define ERROR_DS_DRA_BAD_NC 8440L +#define ERROR_DS_DRA_DN_EXISTS 8441L +#define ERROR_DS_DRA_INTERNAL_ERROR 8442L +#define ERROR_DS_DRA_INCONSISTENT_DIT 8443L +#define ERROR_DS_DRA_CONNECTION_FAILED 8444L +#define ERROR_DS_DRA_BAD_INSTANCE_TYPE 8445L +#define ERROR_DS_DRA_OUT_OF_MEM 8446L +#define ERROR_DS_DRA_MAIL_PROBLEM 8447L +#define ERROR_DS_DRA_REF_ALREADY_EXISTS 8448L +#define ERROR_DS_DRA_REF_NOT_FOUND 8449L +#define ERROR_DS_DRA_OBJ_IS_REP_SOURCE 8450L +#define ERROR_DS_DRA_DB_ERROR 8451L +#define ERROR_DS_DRA_NO_REPLICA 8452L +#define ERROR_DS_DRA_ACCESS_DENIED 8453L +#define ERROR_DS_DRA_NOT_SUPPORTED 8454L +#define ERROR_DS_DRA_RPC_CANCELLED 8455L +#define ERROR_DS_DRA_SOURCE_DISABLED 8456L +#define ERROR_DS_DRA_SINK_DISABLED 8457L +#define ERROR_DS_DRA_NAME_COLLISION 8458L +#define ERROR_DS_DRA_SOURCE_REINSTALLED 8459L +#define ERROR_DS_DRA_MISSING_PARENT 8460L +#define ERROR_DS_DRA_PREEMPTED 8461L +#define ERROR_DS_DRA_ABANDON_SYNC 8462L +#define ERROR_DS_DRA_SHUTDOWN 8463L +#define ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET 8464L +#define ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA 8465L +#define ERROR_DS_DRA_EXTN_CONNECTION_FAILED 8466L +#define ERROR_DS_INSTALL_SCHEMA_MISMATCH 8467L +#define ERROR_DS_DUP_LINK_ID 8468L +#define ERROR_DS_NAME_ERROR_RESOLVING 8469L +#define ERROR_DS_NAME_ERROR_NOT_FOUND 8470L +#define ERROR_DS_NAME_ERROR_NOT_UNIQUE 8471L +#define ERROR_DS_NAME_ERROR_NO_MAPPING 8472L +#define ERROR_DS_NAME_ERROR_DOMAIN_ONLY 8473L +#define ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING 8474L +#define ERROR_DS_CONSTRUCTED_ATT_MOD 8475L +#define ERROR_DS_WRONG_OM_OBJ_CLASS 8476L +#define ERROR_DS_DRA_REPL_PENDING 8477L +#define ERROR_DS_DS_REQUIRED 8478L +#define ERROR_DS_INVALID_LDAP_DISPLAY_NAME 8479L +#define ERROR_DS_NON_BASE_SEARCH 8480L +#define ERROR_DS_CANT_RETRIEVE_ATTS 8481L +#define ERROR_DS_BACKLINK_WITHOUT_LINK 8482L +#define ERROR_DS_EPOCH_MISMATCH 8483L +#define ERROR_DS_SRC_NAME_MISMATCH 8484L +#define ERROR_DS_SRC_AND_DST_NC_IDENTICAL 8485L +#define ERROR_DS_DST_NC_MISMATCH 8486L +#define ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC 8487L +#define ERROR_DS_SRC_GUID_MISMATCH 8488L +#define ERROR_DS_CANT_MOVE_DELETED_OBJECT 8489L +#define ERROR_DS_PDC_OPERATION_IN_PROGRESS 8490L +#define ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD 8491L +#define ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION 8492L +#define ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS 8493L +#define ERROR_DS_NC_MUST_HAVE_NC_PARENT 8494L +#define ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE 8495L +#define ERROR_DS_DST_DOMAIN_NOT_NATIVE 8496L +#define ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER 8497L +#define ERROR_DS_CANT_MOVE_ACCOUNT_GROUP 8498L +#define ERROR_DS_CANT_MOVE_RESOURCE_GROUP 8499L +#define ERROR_DS_INVALID_SEARCH_FLAG 8500L +#define ERROR_DS_NO_TREE_DELETE_ABOVE_NC 8501L +#define ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE 8502L +#define ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE 8503L +#define ERROR_DS_SAM_INIT_FAILURE 8504L +#define ERROR_DS_SENSITIVE_GROUP_VIOLATION 8505L +#define ERROR_DS_CANT_MOD_PRIMARYGROUPID 8506L +#define ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD 8507L +#define ERROR_DS_NONSAFE_SCHEMA_CHANGE 8508L +#define ERROR_DS_SCHEMA_UPDATE_DISALLOWED 8509L +#define ERROR_DS_CANT_CREATE_UNDER_SCHEMA 8510L +#define ERROR_DS_INSTALL_NO_SRC_SCH_VERSION 8511L +#define ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE 8512L +#define ERROR_DS_INVALID_GROUP_TYPE 8513L +#define ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN 8514L +#define ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN 8515L +#define ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER 8516L +#define ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER 8517L +#define ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER 8518L +#define ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER 8519L +#define ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER 8520L +#define ERROR_DS_HAVE_PRIMARY_MEMBERS 8521L +#define ERROR_DS_STRING_SD_CONVERSION_FAILED 8522L +#define ERROR_DS_NAMING_MASTER_GC 8523L +#define ERROR_DS_DNS_LOOKUP_FAILURE 8524L +#define ERROR_DS_COULDNT_UPDATE_SPNS 8525L +#define ERROR_DS_CANT_RETRIEVE_SD 8526L +#define ERROR_DS_KEY_NOT_UNIQUE 8527L +#define ERROR_DS_WRONG_LINKED_ATT_SYNTAX 8528L +#define ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD 8529L +#define ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY 8530L +#define ERROR_DS_CANT_START 8531L +#define ERROR_DS_INIT_FAILURE 8532L +#define ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION 8533L +#define ERROR_DS_SOURCE_DOMAIN_IN_FOREST 8534L +#define ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST 8535L +#define ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED 8536L +#define ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN 8537L +#define ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER 8538L +#define ERROR_DS_SRC_SID_EXISTS_IN_FOREST 8539L +#define ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH 8540L +#define ERROR_SAM_INIT_FAILURE 8541L +#define ERROR_DS_DRA_SCHEMA_INFO_SHIP 8542L +#define ERROR_DS_DRA_SCHEMA_CONFLICT 8543L +#define ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT 8544L +#define ERROR_DS_DRA_OBJ_NC_MISMATCH 8545L +#define ERROR_DS_NC_STILL_HAS_DSAS 8546L +#define ERROR_DS_GC_REQUIRED 8547L +#define ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY 8548L +#define ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS 8549L +#define ERROR_DS_CANT_ADD_TO_GC 8550L +#define ERROR_DS_NO_CHECKPOINT_WITH_PDC 8551L +#define ERROR_DS_SOURCE_AUDITING_NOT_ENABLED 8552L +#define ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC 8553L +#define ERROR_DS_INVALID_NAME_FOR_SPN 8554L +#define ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS 8555L +#define ERROR_DS_UNICODEPWD_NOT_IN_QUOTES 8556L +#define ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED 8557L +#define ERROR_DS_MUST_BE_RUN_ON_DST_DC 8558L +#define ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER 8559L +#define ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ 8560L +#define ERROR_DS_INIT_FAILURE_CONSOLE 8561L +#define ERROR_DS_SAM_INIT_FAILURE_CONSOLE 8562L +#define ERROR_DS_FOREST_VERSION_TOO_HIGH 8563L +#define ERROR_DS_DOMAIN_VERSION_TOO_HIGH 8564L +#define ERROR_DS_FOREST_VERSION_TOO_LOW 8565L +#define ERROR_DS_DOMAIN_VERSION_TOO_LOW 8566L +#define ERROR_DS_INCOMPATIBLE_VERSION 8567L +#define ERROR_DS_LOW_DSA_VERSION 8568L +#define ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN 8569L +#define ERROR_DS_NOT_SUPPORTED_SORT_ORDER 8570L +#define ERROR_DS_NAME_NOT_UNIQUE 8571L +#define ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 8572L +#define ERROR_DS_OUT_OF_VERSION_STORE 8573L +#define ERROR_DS_INCOMPATIBLE_CONTROLS_USED 8574L +#define ERROR_DS_NO_REF_DOMAIN 8575L +#define ERROR_DS_RESERVED_LINK_ID 8576L +#define ERROR_DS_LINK_ID_NOT_AVAILABLE 8577L +#define ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER 8578L +#define ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE 8579L +#define ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC 8580L +#define ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG 8581L +#define ERROR_DS_MODIFYDN_WRONG_GRANDPARENT 8582L +#define ERROR_DS_NAME_ERROR_TRUST_REFERRAL 8583L +#define ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER 8584L +#define ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD 8585L +#define ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 8586L +#define ERROR_DS_THREAD_LIMIT_EXCEEDED 8587L +#define ERROR_DS_NOT_CLOSEST 8588L +#define ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF 8589L +#define ERROR_DS_SINGLE_USER_MODE_FAILED 8590L +#define ERROR_DS_NTDSCRIPT_SYNTAX_ERROR 8591L +#define ERROR_DS_NTDSCRIPT_PROCESS_ERROR 8592L +#define ERROR_DS_DIFFERENT_REPL_EPOCHS 8593L +#define ERROR_DS_DRS_EXTENSIONS_CHANGED 8594L +#define ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR 8595L +#define ERROR_DS_NO_MSDS_INTID 8596L +#define ERROR_DS_DUP_MSDS_INTID 8597L +#define ERROR_DS_EXISTS_IN_RDNATTID 8598L +#define ERROR_DS_AUTHORIZATION_FAILED 8599L +#define ERROR_DS_INVALID_SCRIPT 8600L +#define ERROR_DS_REMOTE_CROSSREF_OP_FAILED 8601L +#define ERROR_DS_CROSS_REF_BUSY 8602L +#define ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN 8603L +#define ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC 8604L +#define ERROR_DS_DUPLICATE_ID_FOUND 8605L +#define ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT 8606L +#define ERROR_DS_GROUP_CONVERSION_ERROR 8607L +#define ERROR_DS_CANT_MOVE_APP_BASIC_GROUP 8608L +#define ERROR_DS_CANT_MOVE_APP_QUERY_GROUP 8609L +#define ERROR_DS_ROLE_NOT_VERIFIED 8610L +#define ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL 8611L +#define ERROR_DS_DOMAIN_RENAME_IN_PROGRESS 8612L +#define ERROR_DS_EXISTING_AD_CHILD_NC 8613L +#define ERROR_DS_REPL_LIFETIME_EXCEEDED 8614L +#define ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER 8615L +#define ERROR_DS_LDAP_SEND_QUEUE_FULL 8616L +#define ERROR_DS_DRA_OUT_SCHEDULE_WINDOW 8617L +#define DNS_ERROR_RESPONSE_CODES_BASE 9000 +#define DNS_ERROR_RCODE_NO_ERROR NO_ERROR +#define DNS_ERROR_MASK 0x00002328 +#define DNS_ERROR_RCODE_FORMAT_ERROR 9001L +#define DNS_ERROR_RCODE_SERVER_FAILURE 9002L +#define DNS_ERROR_RCODE_NAME_ERROR 9003L +#define DNS_ERROR_RCODE_NOT_IMPLEMENTED 9004L +#define DNS_ERROR_RCODE_REFUSED 9005L +#define DNS_ERROR_RCODE_YXDOMAIN 9006L +#define DNS_ERROR_RCODE_YXRRSET 9007L +#define DNS_ERROR_RCODE_NXRRSET 9008L +#define DNS_ERROR_RCODE_NOTAUTH 9009L +#define DNS_ERROR_RCODE_NOTZONE 9010L +#define DNS_ERROR_RCODE_BADSIG 9016L +#define DNS_ERROR_RCODE_BADKEY 9017L +#define DNS_ERROR_RCODE_BADTIME 9018L +#define DNS_ERROR_RCODE_LAST DNS_ERROR_RCODE_BADTIME +#define DNS_ERROR_PACKET_FMT_BASE 9500 +#define DNS_INFO_NO_RECORDS 9501L +#define DNS_ERROR_BAD_PACKET 9502L +#define DNS_ERROR_NO_PACKET 9503L +#define DNS_ERROR_RCODE 9504L +#define DNS_ERROR_UNSECURE_PACKET 9505L +#define DNS_STATUS_PACKET_UNSECURE DNS_ERROR_UNSECURE_PACKET +#define DNS_ERROR_NO_MEMORY ERROR_OUTOFMEMORY +#define DNS_ERROR_INVALID_NAME ERROR_INVALID_NAME +#define DNS_ERROR_INVALID_DATA ERROR_INVALID_DATA +#define DNS_ERROR_GENERAL_API_BASE 9550 +#define DNS_ERROR_INVALID_TYPE 9551L +#define DNS_ERROR_INVALID_IP_ADDRESS 9552L +#define DNS_ERROR_INVALID_PROPERTY 9553L +#define DNS_ERROR_TRY_AGAIN_LATER 9554L +#define DNS_ERROR_NOT_UNIQUE 9555L +#define DNS_ERROR_NON_RFC_NAME 9556L +#define DNS_STATUS_FQDN 9557L +#define DNS_STATUS_DOTTED_NAME 9558L +#define DNS_STATUS_SINGLE_PART_NAME 9559L +#define DNS_ERROR_INVALID_NAME_CHAR 9560L +#define DNS_ERROR_NUMERIC_NAME 9561L +#define DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER 9562L +#define DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION 9563L +#define DNS_ERROR_CANNOT_FIND_ROOT_HINTS 9564L +#define DNS_ERROR_INCONSISTENT_ROOT_HINTS 9565L +#define DNS_ERROR_ZONE_BASE 9600 +#define DNS_ERROR_ZONE_DOES_NOT_EXIST 9601L +#define DNS_ERROR_NO_ZONE_INFO 9602L +#define DNS_ERROR_INVALID_ZONE_OPERATION 9603L +#define DNS_ERROR_ZONE_CONFIGURATION_ERROR 9604L +#define DNS_ERROR_ZONE_HAS_NO_SOA_RECORD 9605L +#define DNS_ERROR_ZONE_HAS_NO_NS_RECORDS 9606L +#define DNS_ERROR_ZONE_LOCKED 9607L +#define DNS_ERROR_ZONE_CREATION_FAILED 9608L +#define DNS_ERROR_ZONE_ALREADY_EXISTS 9609L +#define DNS_ERROR_AUTOZONE_ALREADY_EXISTS 9610L +#define DNS_ERROR_INVALID_ZONE_TYPE 9611L +#define DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP 9612L +#define DNS_ERROR_ZONE_NOT_SECONDARY 9613L +#define DNS_ERROR_NEED_SECONDARY_ADDRESSES 9614L +#define DNS_ERROR_WINS_INIT_FAILED 9615L +#define DNS_ERROR_NEED_WINS_SERVERS 9616L +#define DNS_ERROR_NBSTAT_INIT_FAILED 9617L +#define DNS_ERROR_SOA_DELETE_INVALID 9618L +#define DNS_ERROR_FORWARDER_ALREADY_EXISTS 9619L +#define DNS_ERROR_ZONE_REQUIRES_MASTER_IP 9620L +#define DNS_ERROR_ZONE_IS_SHUTDOWN 9621L +#define DNS_ERROR_DATAFILE_BASE 9650 +#define DNS_ERROR_PRIMARY_REQUIRES_DATAFILE 9651L +#define DNS_ERROR_INVALID_DATAFILE_NAME 9652L +#define DNS_ERROR_DATAFILE_OPEN_FAILURE 9653L +#define DNS_ERROR_FILE_WRITEBACK_FAILED 9654L +#define DNS_ERROR_DATAFILE_PARSING 9655L +#define DNS_ERROR_DATABASE_BASE 9700 +#define DNS_ERROR_RECORD_DOES_NOT_EXIST 9701L +#define DNS_ERROR_RECORD_FORMAT 9702L +#define DNS_ERROR_NODE_CREATION_FAILED 9703L +#define DNS_ERROR_UNKNOWN_RECORD_TYPE 9704L +#define DNS_ERROR_RECORD_TIMED_OUT 9705L +#define DNS_ERROR_NAME_NOT_IN_ZONE 9706L +#define DNS_ERROR_CNAME_LOOP 9707L +#define DNS_ERROR_NODE_IS_CNAME 9708L +#define DNS_ERROR_CNAME_COLLISION 9709L +#define DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT 9710L +#define DNS_ERROR_RECORD_ALREADY_EXISTS 9711L +#define DNS_ERROR_SECONDARY_DATA 9712L +#define DNS_ERROR_NO_CREATE_CACHE_DATA 9713L +#define DNS_ERROR_NAME_DOES_NOT_EXIST 9714L +#define DNS_WARNING_PTR_CREATE_FAILED 9715L +#define DNS_WARNING_DOMAIN_UNDELETED 9716L +#define DNS_ERROR_DS_UNAVAILABLE 9717L +#define DNS_ERROR_DS_ZONE_ALREADY_EXISTS 9718L +#define DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE 9719L +#define DNS_ERROR_OPERATION_BASE 9750 +#define DNS_INFO_AXFR_COMPLETE 9751L +#define DNS_ERROR_AXFR 9752L +#define DNS_INFO_ADDED_LOCAL_WINS 9753L +#define DNS_ERROR_SECURE_BASE 9800 +#define DNS_STATUS_CONTINUE_NEEDED 9801L +#define DNS_ERROR_SETUP_BASE 9850 +#define DNS_ERROR_NO_TCPIP 9851L +#define DNS_ERROR_NO_DNS_SERVERS 9852L +#define DNS_ERROR_DP_BASE 9900 +#define DNS_ERROR_DP_DOES_NOT_EXIST 9901L +#define DNS_ERROR_DP_ALREADY_EXISTS 9902L +#define DNS_ERROR_DP_NOT_ENLISTED 9903L +#define DNS_ERROR_DP_ALREADY_ENLISTED 9904L +#define DNS_ERROR_DP_NOT_AVAILABLE 9905L +#define DNS_ERROR_DP_FSMO_ERROR 9906L + +#ifndef WSABASEERR +#define WSABASEERR 10000 +#define WSAEINTR 10004L +#define WSAEBADF 10009L +#define WSAEACCES 10013L +#define WSAEFAULT 10014L +#define WSAEINVAL 10022L +#define WSAEMFILE 10024L +#define WSAEWOULDBLOCK 10035L +#define WSAEINPROGRESS 10036L +#define WSAEALREADY 10037L +#define WSAENOTSOCK 10038L +#define WSAEDESTADDRREQ 10039L +#define WSAEMSGSIZE 10040L +#define WSAEPROTOTYPE 10041L +#define WSAENOPROTOOPT 10042L +#define WSAEPROTONOSUPPORT 10043L +#define WSAESOCKTNOSUPPORT 10044L +#define WSAEOPNOTSUPP 10045L +#define WSAEPFNOSUPPORT 10046L +#define WSAEAFNOSUPPORT 10047L +#define WSAEADDRINUSE 10048L +#define WSAEADDRNOTAVAIL 10049L +#define WSAENETDOWN 10050L +#define WSAENETUNREACH 10051L +#define WSAENETRESET 10052L +#define WSAECONNABORTED 10053L +#define WSAECONNRESET 10054L +#define WSAENOBUFS 10055L +#define WSAEISCONN 10056L +#define WSAENOTCONN 10057L +#define WSAESHUTDOWN 10058L +#define WSAETOOMANYREFS 10059L +#define WSAETIMEDOUT 10060L +#define WSAECONNREFUSED 10061L +#define WSAELOOP 10062L +#define WSAENAMETOOLONG 10063L +#define WSAEHOSTDOWN 10064L +#define WSAEHOSTUNREACH 10065L +#define WSAENOTEMPTY 10066L +#define WSAEPROCLIM 10067L +#define WSAEUSERS 10068L +#define WSAEDQUOT 10069L +#define WSAESTALE 10070L +#define WSAEREMOTE 10071L +#define WSASYSNOTREADY 10091L +#define WSAVERNOTSUPPORTED 10092L +#define WSANOTINITIALISED 10093L +#define WSAEDISCON 10101L +#define WSAENOMORE 10102L +#define WSAECANCELLED 10103L +#define WSAEINVALIDPROCTABLE 10104L +#define WSAEINVALIDPROVIDER 10105L +#define WSAEPROVIDERFAILEDINIT 10106L +#define WSASYSCALLFAILURE 10107L +#define WSASERVICE_NOT_FOUND 10108L +#define WSATYPE_NOT_FOUND 10109L +#define WSA_E_NO_MORE 10110L +#define WSA_E_CANCELLED 10111L +#define WSAEREFUSED 10112L +#ifndef WSAHOST_NOT_FOUND +#define WSAHOST_NOT_FOUND 11001L +#endif +#ifndef WSATRY_AGAIN +#define WSATRY_AGAIN 11002L +#endif +#ifndef WSANO_RECOVERY +#define WSANO_RECOVERY 11003L +#endif +#ifndef WSANO_DATA +#define WSANO_DATA 11004L +#endif +#ifndef WSA_QOS_RECEIVERS +#define WSA_QOS_RECEIVERS 11005L +#endif +#ifndef WSA_QOS_SENDERS +#define WSA_QOS_SENDERS 11006L +#endif +#ifndef WSA_QOS_NO_SENDERS +#define WSA_QOS_NO_SENDERS 11007L +#endif +#ifndef WSA_QOS_NO_RECEIVERS +#define WSA_QOS_NO_RECEIVERS 11008L +#endif +#ifndef WSA_QOS_REQUEST_CONFIRMED +#define WSA_QOS_REQUEST_CONFIRMED 11009L +#endif +#ifndef WSA_QOS_ADMISSION_FAILURE +#define WSA_QOS_ADMISSION_FAILURE 11010L +#endif +#ifndef WSA_QOS_POLICY_FAILURE +#define WSA_QOS_POLICY_FAILURE 11011L +#endif +#ifndef WSA_QOS_BAD_STYLE +#define WSA_QOS_BAD_STYLE 11012L +#endif +#ifndef WSA_QOS_BAD_OBJECT +#define WSA_QOS_BAD_OBJECT 11013L +#endif +#ifndef WSA_QOS_TRAFFIC_CTRL_ERROR +#define WSA_QOS_TRAFFIC_CTRL_ERROR 11014L +#endif +#ifndef WSA_QOS_GENERIC_ERROR +#define WSA_QOS_GENERIC_ERROR 11015L +#endif +#ifndef WSA_QOS_ESERVICETYPE +#define WSA_QOS_ESERVICETYPE 11016L +#endif +#ifndef WSA_QOS_EFLOWSPEC +#define WSA_QOS_EFLOWSPEC 11017L +#endif +#ifndef WSA_QOS_EPROVSPECBUF +#define WSA_QOS_EPROVSPECBUF 11018L +#endif +#ifndef WSA_QOS_EFILTERSTYLE +#define WSA_QOS_EFILTERSTYLE 11019L +#endif +#ifndef WSA_QOS_EFILTERTYPE +#define WSA_QOS_EFILTERTYPE 11020L +#endif +#ifndef WSA_QOS_EFILTERCOUNT +#define WSA_QOS_EFILTERCOUNT 11021L +#endif +#ifndef WSA_QOS_EOBJLENGTH +#define WSA_QOS_EOBJLENGTH 11022L +#endif +#ifndef WSA_QOS_EFLOWCOUNT +#define WSA_QOS_EFLOWCOUNT 11023L +#endif +#ifndef WSA_QOS_EUNKNOWNPSOBJ +#define WSA_QOS_EUNKNOWNPSOBJ 11024L +#endif +#ifndef WSA_QOS_EPOLICYOBJ +#define WSA_QOS_EPOLICYOBJ 11025L +#endif +#ifndef WSA_QOS_EFLOWDESC +#define WSA_QOS_EFLOWDESC 11026L +#endif +#ifndef WSA_QOS_EPSFLOWSPEC +#define WSA_QOS_EPSFLOWSPEC 11027L +#endif +#ifndef WSA_QOS_EPSFILTERSPEC +#define WSA_QOS_EPSFILTERSPEC 11028L +#endif +#ifndef WSA_QOS_ESDMODEOBJ +#define WSA_QOS_ESDMODEOBJ 11029L +#endif +#ifndef WSA_QOS_ESHAPERATEOBJ +#define WSA_QOS_ESHAPERATEOBJ 11030L +#endif +#ifndef WSA_QOS_RESERVED_PETYPE +#define WSA_QOS_RESERVED_PETYPE 11031L +#endif +#endif /* WSABASEERR */ + +#define ERROR_SXS_SECTION_NOT_FOUND 14000L +#define ERROR_SXS_CANT_GEN_ACTCTX 14001L +#define ERROR_SXS_INVALID_ACTCTXDATA_FORMAT 14002L +#define ERROR_SXS_ASSEMBLY_NOT_FOUND 14003L +#define ERROR_SXS_MANIFEST_FORMAT_ERROR 14004L +#define ERROR_SXS_MANIFEST_PARSE_ERROR 14005L +#define ERROR_SXS_ACTIVATION_CONTEXT_DISABLED 14006L +#define ERROR_SXS_KEY_NOT_FOUND 14007L +#define ERROR_SXS_VERSION_CONFLICT 14008L +#define ERROR_SXS_WRONG_SECTION_TYPE 14009L +#define ERROR_SXS_THREAD_QUERIES_DISABLED 14010L +#define ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET 14011L +#define ERROR_SXS_UNKNOWN_ENCODING_GROUP 14012L +#define ERROR_SXS_UNKNOWN_ENCODING 14013L +#define ERROR_SXS_INVALID_XML_NAMESPACE_URI 14014L +#define ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED 14015L +#define ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED 14016L +#define ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE 14017L +#define ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE 14018L +#define ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE 14019L +#define ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT 14020L +#define ERROR_SXS_DUPLICATE_DLL_NAME 14021L +#define ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME 14022L +#define ERROR_SXS_DUPLICATE_CLSID 14023L +#define ERROR_SXS_DUPLICATE_IID 14024L +#define ERROR_SXS_DUPLICATE_TLBID 14025L +#define ERROR_SXS_DUPLICATE_PROGID 14026L +#define ERROR_SXS_DUPLICATE_ASSEMBLY_NAME 14027L +#define ERROR_SXS_FILE_HASH_MISMATCH 14028L +#define ERROR_SXS_POLICY_PARSE_ERROR 14029L +#define ERROR_SXS_XML_E_MISSINGQUOTE 14030L +#define ERROR_SXS_XML_E_COMMENTSYNTAX 14031L +#define ERROR_SXS_XML_E_BADSTARTNAMECHAR 14032L +#define ERROR_SXS_XML_E_BADNAMECHAR 14033L +#define ERROR_SXS_XML_E_BADCHARINSTRING 14034L +#define ERROR_SXS_XML_E_XMLDECLSYNTAX 14035L +#define ERROR_SXS_XML_E_BADCHARDATA 14036L +#define ERROR_SXS_XML_E_MISSINGWHITESPACE 14037L +#define ERROR_SXS_XML_E_EXPECTINGTAGEND 14038L +#define ERROR_SXS_XML_E_MISSINGSEMICOLON 14039L +#define ERROR_SXS_XML_E_UNBALANCEDPAREN 14040L +#define ERROR_SXS_XML_E_INTERNALERROR 14041L +#define ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE 14042L +#define ERROR_SXS_XML_E_INCOMPLETE_ENCODING 14043L +#define ERROR_SXS_XML_E_MISSING_PAREN 14044L +#define ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE 14045L +#define ERROR_SXS_XML_E_MULTIPLE_COLONS 14046L +#define ERROR_SXS_XML_E_INVALID_DECIMAL 14047L +#define ERROR_SXS_XML_E_INVALID_HEXIDECIMAL 14048L +#define ERROR_SXS_XML_E_INVALID_UNICODE 14049L +#define ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK 14050L +#define ERROR_SXS_XML_E_UNEXPECTEDENDTAG 14051L +#define ERROR_SXS_XML_E_UNCLOSEDTAG 14052L +#define ERROR_SXS_XML_E_DUPLICATEATTRIBUTE 14053L +#define ERROR_SXS_XML_E_MULTIPLEROOTS 14054L +#define ERROR_SXS_XML_E_INVALIDATROOTLEVEL 14055L +#define ERROR_SXS_XML_E_BADXMLDECL 14056L +#define ERROR_SXS_XML_E_MISSINGROOT 14057L +#define ERROR_SXS_XML_E_UNEXPECTEDEOF 14058L +#define ERROR_SXS_XML_E_BADPEREFINSUBSET 14059L +#define ERROR_SXS_XML_E_UNCLOSEDSTARTTAG 14060L +#define ERROR_SXS_XML_E_UNCLOSEDENDTAG 14061L +#define ERROR_SXS_XML_E_UNCLOSEDSTRING 14062L +#define ERROR_SXS_XML_E_UNCLOSEDCOMMENT 14063L +#define ERROR_SXS_XML_E_UNCLOSEDDECL 14064L +#define ERROR_SXS_XML_E_UNCLOSEDCDATA 14065L +#define ERROR_SXS_XML_E_RESERVEDNAMESPACE 14066L +#define ERROR_SXS_XML_E_INVALIDENCODING 14067L +#define ERROR_SXS_XML_E_INVALIDSWITCH 14068L +#define ERROR_SXS_XML_E_BADXMLCASE 14069L +#define ERROR_SXS_XML_E_INVALID_STANDALONE 14070L +#define ERROR_SXS_XML_E_UNEXPECTED_STANDALONE 14071L +#define ERROR_SXS_XML_E_INVALID_VERSION 14072L +#define ERROR_SXS_XML_E_MISSINGEQUALS 14073L +#define ERROR_SXS_PROTECTION_RECOVERY_FAILED 14074L +#define ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT 14075L +#define ERROR_SXS_PROTECTION_CATALOG_NOT_VALID 14076L +#define ERROR_SXS_UNTRANSLATABLE_HRESULT 14077L +#define ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING 14078L +#define ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE 14079L +#define ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME 14080L +#define ERROR_IPSEC_QM_POLICY_EXISTS 13000L +#define ERROR_IPSEC_QM_POLICY_NOT_FOUND 13001L +#define ERROR_IPSEC_QM_POLICY_IN_USE 13002L +#define ERROR_IPSEC_MM_POLICY_EXISTS 13003L +#define ERROR_IPSEC_MM_POLICY_NOT_FOUND 13004L +#define ERROR_IPSEC_MM_POLICY_IN_USE 13005L +#define ERROR_IPSEC_MM_FILTER_EXISTS 13006L +#define ERROR_IPSEC_MM_FILTER_NOT_FOUND 13007L +#define ERROR_IPSEC_TRANSPORT_FILTER_EXISTS 13008L +#define ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND 13009L +#define ERROR_IPSEC_MM_AUTH_EXISTS 13010L +#define ERROR_IPSEC_MM_AUTH_NOT_FOUND 13011L +#define ERROR_IPSEC_MM_AUTH_IN_USE 13012L +#define ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND 13013L +#define ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND 13014L +#define ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND 13015L +#define ERROR_IPSEC_TUNNEL_FILTER_EXISTS 13016L +#define ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND 13017L +#define ERROR_IPSEC_MM_FILTER_PENDING_DELETION 13018L +#define ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION 13019L +#define ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION 13020L +#define ERROR_IPSEC_MM_POLICY_PENDING_DELETION 13021L +#define ERROR_IPSEC_MM_AUTH_PENDING_DELETION 13022L +#define ERROR_IPSEC_QM_POLICY_PENDING_DELETION 13023L +#define WARNING_IPSEC_MM_POLICY_PRUNED 13024L +#define WARNING_IPSEC_QM_POLICY_PRUNED 13025L +#define ERROR_IPSEC_IKE_NEG_STATUS_BEGIN 13800L +#define ERROR_IPSEC_IKE_AUTH_FAIL 13801L +#define ERROR_IPSEC_IKE_ATTRIB_FAIL 13802L +#define ERROR_IPSEC_IKE_NEGOTIATION_PENDING 13803L +#define ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR 13804L +#define ERROR_IPSEC_IKE_TIMED_OUT 13805L +#define ERROR_IPSEC_IKE_NO_CERT 13806L +#define ERROR_IPSEC_IKE_SA_DELETED 13807L +#define ERROR_IPSEC_IKE_SA_REAPED 13808L +#define ERROR_IPSEC_IKE_MM_ACQUIRE_DROP 13809L +#define ERROR_IPSEC_IKE_QM_ACQUIRE_DROP 13810L +#define ERROR_IPSEC_IKE_QUEUE_DROP_MM 13811L +#define ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM 13812L +#define ERROR_IPSEC_IKE_DROP_NO_RESPONSE 13813L +#define ERROR_IPSEC_IKE_MM_DELAY_DROP 13814L +#define ERROR_IPSEC_IKE_QM_DELAY_DROP 13815L +#define ERROR_IPSEC_IKE_ERROR 13816L +#define ERROR_IPSEC_IKE_CRL_FAILED 13817L +#define ERROR_IPSEC_IKE_INVALID_KEY_USAGE 13818L +#define ERROR_IPSEC_IKE_INVALID_CERT_TYPE 13819L +#define ERROR_IPSEC_IKE_NO_PRIVATE_KEY 13820L +#define ERROR_IPSEC_IKE_DH_FAIL 13822L +#define ERROR_IPSEC_IKE_INVALID_HEADER 13824L +#define ERROR_IPSEC_IKE_NO_POLICY 13825L +#define ERROR_IPSEC_IKE_INVALID_SIGNATURE 13826L +#define ERROR_IPSEC_IKE_KERBEROS_ERROR 13827L +#define ERROR_IPSEC_IKE_NO_PUBLIC_KEY 13828L +#define ERROR_IPSEC_IKE_PROCESS_ERR 13829L +#define ERROR_IPSEC_IKE_PROCESS_ERR_SA 13830L +#define ERROR_IPSEC_IKE_PROCESS_ERR_PROP 13831L +#define ERROR_IPSEC_IKE_PROCESS_ERR_TRANS 13832L +#define ERROR_IPSEC_IKE_PROCESS_ERR_KE 13833L +#define ERROR_IPSEC_IKE_PROCESS_ERR_ID 13834L +#define ERROR_IPSEC_IKE_PROCESS_ERR_CERT 13835L +#define ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ 13836L +#define ERROR_IPSEC_IKE_PROCESS_ERR_HASH 13837L +#define ERROR_IPSEC_IKE_PROCESS_ERR_SIG 13838L +#define ERROR_IPSEC_IKE_PROCESS_ERR_NONCE 13839L +#define ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY 13840L +#define ERROR_IPSEC_IKE_PROCESS_ERR_DELETE 13841L +#define ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR 13842L +#define ERROR_IPSEC_IKE_INVALID_PAYLOAD 13843L +#define ERROR_IPSEC_IKE_LOAD_SOFT_SA 13844L +#define ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN 13845L +#define ERROR_IPSEC_IKE_INVALID_COOKIE 13846L +#define ERROR_IPSEC_IKE_NO_PEER_CERT 13847L +#define ERROR_IPSEC_IKE_PEER_CRL_FAILED 13848L +#define ERROR_IPSEC_IKE_POLICY_CHANGE 13849L +#define ERROR_IPSEC_IKE_NO_MM_POLICY 13850L +#define ERROR_IPSEC_IKE_NOTCBPRIV 13851L +#define ERROR_IPSEC_IKE_SECLOADFAIL 13852L +#define ERROR_IPSEC_IKE_FAILSSPINIT 13853L +#define ERROR_IPSEC_IKE_FAILQUERYSSP 13854L +#define ERROR_IPSEC_IKE_SRVACQFAIL 13855L +#define ERROR_IPSEC_IKE_SRVQUERYCRED 13856L +#define ERROR_IPSEC_IKE_GETSPIFAIL 13857L +#define ERROR_IPSEC_IKE_INVALID_FILTER 13858L +#define ERROR_IPSEC_IKE_OUT_OF_MEMORY 13859L +#define ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED 13860L +#define ERROR_IPSEC_IKE_INVALID_POLICY 13861L +#define ERROR_IPSEC_IKE_UNKNOWN_DOI 13862L +#define ERROR_IPSEC_IKE_INVALID_SITUATION 13863L +#define ERROR_IPSEC_IKE_DH_FAILURE 13864L +#define ERROR_IPSEC_IKE_INVALID_GROUP 13865L +#define ERROR_IPSEC_IKE_ENCRYPT 13866L +#define ERROR_IPSEC_IKE_DECRYPT 13867L +#define ERROR_IPSEC_IKE_POLICY_MATCH 13868L +#define ERROR_IPSEC_IKE_UNSUPPORTED_ID 13869L +#define ERROR_IPSEC_IKE_INVALID_HASH 13870L +#define ERROR_IPSEC_IKE_INVALID_HASH_ALG 13871L +#define ERROR_IPSEC_IKE_INVALID_HASH_SIZE 13872L +#define ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG 13873L +#define ERROR_IPSEC_IKE_INVALID_AUTH_ALG 13874L +#define ERROR_IPSEC_IKE_INVALID_SIG 13875L +#define ERROR_IPSEC_IKE_LOAD_FAILED 13876L +#define ERROR_IPSEC_IKE_RPC_DELETE 13877L +#define ERROR_IPSEC_IKE_BENIGN_REINIT 13878L +#define ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY 13879L +#define ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN 13881L +#define ERROR_IPSEC_IKE_MM_LIMIT 13882L +#define ERROR_IPSEC_IKE_NEGOTIATION_DISABLED 13883L +#define ERROR_IPSEC_IKE_NEG_STATUS_END 13884L +#define SEVERITY_SUCCESS 0 +#define SEVERITY_ERROR 1 +#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) +#define FAILED(hr) ((HRESULT)(hr) < 0) +#define IS_ERROR(Status) ((unsigned long)(Status) >> 31==SEVERITY_ERROR) +#define HRESULT_CODE(hr) ((hr) & 0xFFFF) +#define SCODE_CODE(sc) ((sc) & 0xFFFF) +#define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff) +#define SCODE_FACILITY(sc) (((sc) >> 16) & 0x1fff) +#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1) +#define SCODE_SEVERITY(sc) (((sc) >> 31) & 0x1) +#define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) +#define MAKE_SCODE(sev,fac,code) ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) +#define FACILITY_NT_BIT 0x10000000 +#define __HRESULT_FROM_WIN32(x) ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000))) +#ifdef INLINE_HRESULT_FROM_WIN32 +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED +typedef long HRESULT; +#endif +__CRT_INLINE HRESULT HRESULT_FROM_WIN32(long x) { return x <= 0 ? (HRESULT)x : (HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000);} +#else +#define HRESULT_FROM_WIN32(x) __HRESULT_FROM_WIN32(x) +#endif +#define HRESULT_FROM_NT(x) ((HRESULT) ((x) | FACILITY_NT_BIT)) +#define GetScode(hr) ((SCODE) (hr)) +#define ResultFromScode(sc) ((HRESULT) (sc)) +#define PropagateResult(hrPrevious,scBase) ((HRESULT) scBase) +#ifdef RC_INVOKED +#define _HRESULT_TYPEDEF_(_sc) _sc +#else +#define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc) +#endif +#define NOERROR 0 +#define E_UNEXPECTED _HRESULT_TYPEDEF_(0x8000FFFFL) +#define E_NOTIMPL _HRESULT_TYPEDEF_(0x80004001L) +#define E_OUTOFMEMORY _HRESULT_TYPEDEF_(0x8007000EL) +#define E_INVALIDARG _HRESULT_TYPEDEF_(0x80070057L) +#define E_NOINTERFACE _HRESULT_TYPEDEF_(0x80004002L) +#define E_POINTER _HRESULT_TYPEDEF_(0x80004003L) +#define E_HANDLE _HRESULT_TYPEDEF_(0x80070006L) +#define E_ABORT _HRESULT_TYPEDEF_(0x80004004L) +#define E_FAIL _HRESULT_TYPEDEF_(0x80004005L) +#define E_ACCESSDENIED _HRESULT_TYPEDEF_(0x80070005L) +#define E_PENDING _HRESULT_TYPEDEF_(0x8000000AL) +#define CO_E_INIT_TLS _HRESULT_TYPEDEF_(0x80004006L) +#define CO_E_INIT_SHARED_ALLOCATOR _HRESULT_TYPEDEF_(0x80004007L) +#define CO_E_INIT_MEMORY_ALLOCATOR _HRESULT_TYPEDEF_(0x80004008L) +#define CO_E_INIT_CLASS_CACHE _HRESULT_TYPEDEF_(0x80004009L) +#define CO_E_INIT_RPC_CHANNEL _HRESULT_TYPEDEF_(0x8000400AL) +#define CO_E_INIT_TLS_SET_CHANNEL_CONTROL _HRESULT_TYPEDEF_(0x8000400BL) +#define CO_E_INIT_TLS_CHANNEL_CONTROL _HRESULT_TYPEDEF_(0x8000400CL) +#define CO_E_INIT_UNACCEPTED_USER_ALLOCATOR _HRESULT_TYPEDEF_(0x8000400DL) +#define CO_E_INIT_SCM_MUTEX_EXISTS _HRESULT_TYPEDEF_(0x8000400EL) +#define CO_E_INIT_SCM_FILE_MAPPING_EXISTS _HRESULT_TYPEDEF_(0x8000400FL) +#define CO_E_INIT_SCM_MAP_VIEW_OF_FILE _HRESULT_TYPEDEF_(0x80004010L) +#define CO_E_INIT_SCM_EXEC_FAILURE _HRESULT_TYPEDEF_(0x80004011L) +#define CO_E_INIT_ONLY_SINGLE_THREADED _HRESULT_TYPEDEF_(0x80004012L) +#define CO_E_CANT_REMOTE _HRESULT_TYPEDEF_(0x80004013L) +#define CO_E_BAD_SERVER_NAME _HRESULT_TYPEDEF_(0x80004014L) +#define CO_E_WRONG_SERVER_IDENTITY _HRESULT_TYPEDEF_(0x80004015L) +#define CO_E_OLE1DDE_DISABLED _HRESULT_TYPEDEF_(0x80004016L) +#define CO_E_RUNAS_SYNTAX _HRESULT_TYPEDEF_(0x80004017L) +#define CO_E_CREATEPROCESS_FAILURE _HRESULT_TYPEDEF_(0x80004018L) +#define CO_E_RUNAS_CREATEPROCESS_FAILURE _HRESULT_TYPEDEF_(0x80004019L) +#define CO_E_RUNAS_LOGON_FAILURE _HRESULT_TYPEDEF_(0x8000401AL) +#define CO_E_LAUNCH_PERMSSION_DENIED _HRESULT_TYPEDEF_(0x8000401BL) +#define CO_E_START_SERVICE_FAILURE _HRESULT_TYPEDEF_(0x8000401CL) +#define CO_E_REMOTE_COMMUNICATION_FAILURE _HRESULT_TYPEDEF_(0x8000401DL) +#define CO_E_SERVER_START_TIMEOUT _HRESULT_TYPEDEF_(0x8000401EL) +#define CO_E_CLSREG_INCONSISTENT _HRESULT_TYPEDEF_(0x8000401FL) +#define CO_E_IIDREG_INCONSISTENT _HRESULT_TYPEDEF_(0x80004020L) +#define CO_E_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x80004021L) +#define CO_E_RELOAD_DLL _HRESULT_TYPEDEF_(0x80004022L) +#define CO_E_MSI_ERROR _HRESULT_TYPEDEF_(0x80004023L) +#define CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT _HRESULT_TYPEDEF_(0x80004024L) +#define CO_E_SERVER_PAUSED _HRESULT_TYPEDEF_(0x80004025L) +#define CO_E_SERVER_NOT_PAUSED _HRESULT_TYPEDEF_(0x80004026L) +#define CO_E_CLASS_DISABLED _HRESULT_TYPEDEF_(0x80004027L) +#define CO_E_CLRNOTAVAILABLE _HRESULT_TYPEDEF_(0x80004028L) +#define CO_E_ASYNC_WORK_REJECTED _HRESULT_TYPEDEF_(0x80004029L) +#define CO_E_SERVER_INIT_TIMEOUT _HRESULT_TYPEDEF_(0x8000402AL) +#define CO_E_NO_SECCTX_IN_ACTIVATE _HRESULT_TYPEDEF_(0x8000402BL) +#define CO_E_TRACKER_CONFIG _HRESULT_TYPEDEF_(0x80004030L) +#define CO_E_THREADPOOL_CONFIG _HRESULT_TYPEDEF_(0x80004031L) +#define CO_E_SXS_CONFIG _HRESULT_TYPEDEF_(0x80004032L) +#define CO_E_MALFORMED_SPN _HRESULT_TYPEDEF_(0x80004033L) +#define S_OK ((HRESULT)0x00000000L) +#define S_FALSE ((HRESULT)0x00000001L) +#define OLE_E_FIRST ((HRESULT)0x80040000L) +#define OLE_E_LAST ((HRESULT)0x800400FFL) +#define OLE_S_FIRST ((HRESULT)0x00040000L) +#define OLE_S_LAST ((HRESULT)0x000400FFL) +#define OLE_E_OLEVERB _HRESULT_TYPEDEF_(0x80040000L) +#define OLE_E_ADVF _HRESULT_TYPEDEF_(0x80040001L) +#define OLE_E_ENUM_NOMORE _HRESULT_TYPEDEF_(0x80040002L) +#define OLE_E_ADVISENOTSUPPORTED _HRESULT_TYPEDEF_(0x80040003L) +#define OLE_E_NOCONNECTION _HRESULT_TYPEDEF_(0x80040004L) +#define OLE_E_NOTRUNNING _HRESULT_TYPEDEF_(0x80040005L) +#define OLE_E_NOCACHE _HRESULT_TYPEDEF_(0x80040006L) +#define OLE_E_BLANK _HRESULT_TYPEDEF_(0x80040007L) +#define OLE_E_CLASSDIFF _HRESULT_TYPEDEF_(0x80040008L) +#define OLE_E_CANT_GETMONIKER _HRESULT_TYPEDEF_(0x80040009L) +#define OLE_E_CANT_BINDTOSOURCE _HRESULT_TYPEDEF_(0x8004000AL) +#define OLE_E_STATIC _HRESULT_TYPEDEF_(0x8004000BL) +#define OLE_E_PROMPTSAVECANCELLED _HRESULT_TYPEDEF_(0x8004000CL) +#define OLE_E_INVALIDRECT _HRESULT_TYPEDEF_(0x8004000DL) +#define OLE_E_WRONGCOMPOBJ _HRESULT_TYPEDEF_(0x8004000EL) +#define OLE_E_INVALIDHWND _HRESULT_TYPEDEF_(0x8004000FL) +#define OLE_E_NOT_INPLACEACTIVE _HRESULT_TYPEDEF_(0x80040010L) +#define OLE_E_CANTCONVERT _HRESULT_TYPEDEF_(0x80040011L) +#define OLE_E_NOSTORAGE _HRESULT_TYPEDEF_(0x80040012L) +#define DV_E_FORMATETC _HRESULT_TYPEDEF_(0x80040064L) +#define DV_E_DVTARGETDEVICE _HRESULT_TYPEDEF_(0x80040065L) +#define DV_E_STGMEDIUM _HRESULT_TYPEDEF_(0x80040066L) +#define DV_E_STATDATA _HRESULT_TYPEDEF_(0x80040067L) +#define DV_E_LINDEX _HRESULT_TYPEDEF_(0x80040068L) +#define DV_E_TYMED _HRESULT_TYPEDEF_(0x80040069L) +#define DV_E_CLIPFORMAT _HRESULT_TYPEDEF_(0x8004006AL) +#define DV_E_DVASPECT _HRESULT_TYPEDEF_(0x8004006BL) +#define DV_E_DVTARGETDEVICE_SIZE _HRESULT_TYPEDEF_(0x8004006CL) +#define DV_E_NOIVIEWOBJECT _HRESULT_TYPEDEF_(0x8004006DL) +#define DRAGDROP_E_FIRST 0x80040100L +#define DRAGDROP_E_LAST 0x8004010FL +#define DRAGDROP_S_FIRST 0x00040100L +#define DRAGDROP_S_LAST 0x0004010FL +#define DRAGDROP_E_NOTREGISTERED _HRESULT_TYPEDEF_(0x80040100L) +#define DRAGDROP_E_ALREADYREGISTERED _HRESULT_TYPEDEF_(0x80040101L) +#define DRAGDROP_E_INVALIDHWND _HRESULT_TYPEDEF_(0x80040102L) +#define CLASSFACTORY_E_FIRST 0x80040110L +#define CLASSFACTORY_E_LAST 0x8004011FL +#define CLASSFACTORY_S_FIRST 0x00040110L +#define CLASSFACTORY_S_LAST 0x0004011FL +#define CLASS_E_NOAGGREGATION _HRESULT_TYPEDEF_(0x80040110L) +#define CLASS_E_CLASSNOTAVAILABLE _HRESULT_TYPEDEF_(0x80040111L) +#define CLASS_E_NOTLICENSED _HRESULT_TYPEDEF_(0x80040112L) +#define MARSHAL_E_FIRST 0x80040120L +#define MARSHAL_E_LAST 0x8004012FL +#define MARSHAL_S_FIRST 0x00040120L +#define MARSHAL_S_LAST 0x0004012FL +#define DATA_E_FIRST 0x80040130L +#define DATA_E_LAST 0x8004013FL +#define DATA_S_FIRST 0x00040130L +#define DATA_S_LAST 0x0004013FL +#define VIEW_E_FIRST 0x80040140L +#define VIEW_E_LAST 0x8004014FL +#define VIEW_S_FIRST 0x00040140L +#define VIEW_S_LAST 0x0004014FL +#define VIEW_E_DRAW _HRESULT_TYPEDEF_(0x80040140L) +#define REGDB_E_FIRST 0x80040150L +#define REGDB_E_LAST 0x8004015FL +#define REGDB_S_FIRST 0x00040150L +#define REGDB_S_LAST 0x0004015FL +#define REGDB_E_READREGDB _HRESULT_TYPEDEF_(0x80040150L) +#define REGDB_E_WRITEREGDB _HRESULT_TYPEDEF_(0x80040151L) +#define REGDB_E_KEYMISSING _HRESULT_TYPEDEF_(0x80040152L) +#define REGDB_E_INVALIDVALUE _HRESULT_TYPEDEF_(0x80040153L) +#define REGDB_E_CLASSNOTREG _HRESULT_TYPEDEF_(0x80040154L) +#define REGDB_E_IIDNOTREG _HRESULT_TYPEDEF_(0x80040155L) +#define REGDB_E_BADTHREADINGMODEL _HRESULT_TYPEDEF_(0x80040156L) +#define CAT_E_FIRST 0x80040160L +#define CAT_E_LAST 0x80040161L +#define CAT_E_CATIDNOEXIST _HRESULT_TYPEDEF_(0x80040160L) +#define CAT_E_NODESCRIPTION _HRESULT_TYPEDEF_(0x80040161L) +#define CS_E_FIRST 0x80040164L +#define CS_E_LAST 0x8004016FL +#define CS_E_PACKAGE_NOTFOUND _HRESULT_TYPEDEF_(0x80040164L) +#define CS_E_NOT_DELETABLE _HRESULT_TYPEDEF_(0x80040165L) +#define CS_E_CLASS_NOTFOUND _HRESULT_TYPEDEF_(0x80040166L) +#define CS_E_INVALID_VERSION _HRESULT_TYPEDEF_(0x80040167L) +#define CS_E_NO_CLASSSTORE _HRESULT_TYPEDEF_(0x80040168L) +#define CS_E_OBJECT_NOTFOUND _HRESULT_TYPEDEF_(0x80040169L) +#define CS_E_OBJECT_ALREADY_EXISTS _HRESULT_TYPEDEF_(0x8004016AL) +#define CS_E_INVALID_PATH _HRESULT_TYPEDEF_(0x8004016BL) +#define CS_E_NETWORK_ERROR _HRESULT_TYPEDEF_(0x8004016CL) +#define CS_E_ADMIN_LIMIT_EXCEEDED _HRESULT_TYPEDEF_(0x8004016DL) +#define CS_E_SCHEMA_MISMATCH _HRESULT_TYPEDEF_(0x8004016EL) +#define CS_E_INTERNAL_ERROR _HRESULT_TYPEDEF_(0x8004016FL) +#define CACHE_E_FIRST 0x80040170L +#define CACHE_E_LAST 0x8004017FL +#define CACHE_S_FIRST 0x00040170L +#define CACHE_S_LAST 0x0004017FL +#define CACHE_E_NOCACHE_UPDATED _HRESULT_TYPEDEF_(0x80040170L) +#define OLEOBJ_E_FIRST 0x80040180L +#define OLEOBJ_E_LAST 0x8004018FL +#define OLEOBJ_S_FIRST 0x00040180L +#define OLEOBJ_S_LAST 0x0004018FL +#define OLEOBJ_E_NOVERBS _HRESULT_TYPEDEF_(0x80040180L) +#define OLEOBJ_E_INVALIDVERB _HRESULT_TYPEDEF_(0x80040181L) +#define CLIENTSITE_E_FIRST 0x80040190L +#define CLIENTSITE_E_LAST 0x8004019FL +#define CLIENTSITE_S_FIRST 0x00040190L +#define CLIENTSITE_S_LAST 0x0004019FL +#define INPLACE_E_NOTUNDOABLE _HRESULT_TYPEDEF_(0x800401A0L) +#define INPLACE_E_NOTOOLSPACE _HRESULT_TYPEDEF_(0x800401A1L) +#define INPLACE_E_FIRST 0x800401A0L +#define INPLACE_E_LAST 0x800401AFL +#define INPLACE_S_FIRST 0x000401A0L +#define INPLACE_S_LAST 0x000401AFL +#define ENUM_E_FIRST 0x800401B0L +#define ENUM_E_LAST 0x800401BFL +#define ENUM_S_FIRST 0x000401B0L +#define ENUM_S_LAST 0x000401BFL +#define CONVERT10_E_FIRST 0x800401C0L +#define CONVERT10_E_LAST 0x800401CFL +#define CONVERT10_S_FIRST 0x000401C0L +#define CONVERT10_S_LAST 0x000401CFL +#define CONVERT10_E_OLESTREAM_GET _HRESULT_TYPEDEF_(0x800401C0L) +#define CONVERT10_E_OLESTREAM_PUT _HRESULT_TYPEDEF_(0x800401C1L) +#define CONVERT10_E_OLESTREAM_FMT _HRESULT_TYPEDEF_(0x800401C2L) +#define CONVERT10_E_OLESTREAM_BITMAP_TO_DIB _HRESULT_TYPEDEF_(0x800401C3L) +#define CONVERT10_E_STG_FMT _HRESULT_TYPEDEF_(0x800401C4L) +#define CONVERT10_E_STG_NO_STD_STREAM _HRESULT_TYPEDEF_(0x800401C5L) +#define CONVERT10_E_STG_DIB_TO_BITMAP _HRESULT_TYPEDEF_(0x800401C6L) +#define CLIPBRD_E_FIRST 0x800401D0L +#define CLIPBRD_E_LAST 0x800401DFL +#define CLIPBRD_S_FIRST 0x000401D0L +#define CLIPBRD_S_LAST 0x000401DFL +#define CLIPBRD_E_CANT_OPEN _HRESULT_TYPEDEF_(0x800401D0L) +#define CLIPBRD_E_CANT_EMPTY _HRESULT_TYPEDEF_(0x800401D1L) +#define CLIPBRD_E_CANT_SET _HRESULT_TYPEDEF_(0x800401D2L) +#define CLIPBRD_E_BAD_DATA _HRESULT_TYPEDEF_(0x800401D3L) +#define CLIPBRD_E_CANT_CLOSE _HRESULT_TYPEDEF_(0x800401D4L) +#define MK_E_FIRST 0x800401E0L +#define MK_E_LAST 0x800401EFL +#define MK_S_FIRST 0x000401E0L +#define MK_S_LAST 0x000401EFL +#define MK_E_CONNECTMANUALLY _HRESULT_TYPEDEF_(0x800401E0L) +#define MK_E_EXCEEDEDDEADLINE _HRESULT_TYPEDEF_(0x800401E1L) +#define MK_E_NEEDGENERIC _HRESULT_TYPEDEF_(0x800401E2L) +#define MK_E_UNAVAILABLE _HRESULT_TYPEDEF_(0x800401E3L) +#define MK_E_SYNTAX _HRESULT_TYPEDEF_(0x800401E4L) +#define MK_E_NOOBJECT _HRESULT_TYPEDEF_(0x800401E5L) +#define MK_E_INVALIDEXTENSION _HRESULT_TYPEDEF_(0x800401E6L) +#define MK_E_INTERMEDIATEINTERFACENOTSUPPORTED _HRESULT_TYPEDEF_(0x800401E7L) +#define MK_E_NOTBINDABLE _HRESULT_TYPEDEF_(0x800401E8L) +#define MK_E_NOTBOUND _HRESULT_TYPEDEF_(0x800401E9L) +#define MK_E_CANTOPENFILE _HRESULT_TYPEDEF_(0x800401EAL) +#define MK_E_MUSTBOTHERUSER _HRESULT_TYPEDEF_(0x800401EBL) +#define MK_E_NOINVERSE _HRESULT_TYPEDEF_(0x800401ECL) +#define MK_E_NOSTORAGE _HRESULT_TYPEDEF_(0x800401EDL) +#define MK_E_NOPREFIX _HRESULT_TYPEDEF_(0x800401EEL) +#define MK_E_ENUMERATION_FAILED _HRESULT_TYPEDEF_(0x800401EFL) +#define CO_E_FIRST 0x800401F0L +#define CO_E_LAST 0x800401FFL +#define CO_S_FIRST 0x000401F0L +#define CO_S_LAST 0x000401FFL +#define CO_E_NOTINITIALIZED _HRESULT_TYPEDEF_(0x800401F0L) +#define CO_E_ALREADYINITIALIZED _HRESULT_TYPEDEF_(0x800401F1L) +#define CO_E_CANTDETERMINECLASS _HRESULT_TYPEDEF_(0x800401F2L) +#define CO_E_CLASSSTRING _HRESULT_TYPEDEF_(0x800401F3L) +#define CO_E_IIDSTRING _HRESULT_TYPEDEF_(0x800401F4L) +#define CO_E_APPNOTFOUND _HRESULT_TYPEDEF_(0x800401F5L) +#define CO_E_APPSINGLEUSE _HRESULT_TYPEDEF_(0x800401F6L) +#define CO_E_ERRORINAPP _HRESULT_TYPEDEF_(0x800401F7L) +#define CO_E_DLLNOTFOUND _HRESULT_TYPEDEF_(0x800401F8L) +#define CO_E_ERRORINDLL _HRESULT_TYPEDEF_(0x800401F9L) +#define CO_E_WRONGOSFORAPP _HRESULT_TYPEDEF_(0x800401FAL) +#define CO_E_OBJNOTREG _HRESULT_TYPEDEF_(0x800401FBL) +#define CO_E_OBJISREG _HRESULT_TYPEDEF_(0x800401FCL) +#define CO_E_OBJNOTCONNECTED _HRESULT_TYPEDEF_(0x800401FDL) +#define CO_E_APPDIDNTREG _HRESULT_TYPEDEF_(0x800401FEL) +#define CO_E_RELEASED _HRESULT_TYPEDEF_(0x800401FFL) +#define EVENT_E_FIRST 0x80040200L +#define EVENT_E_LAST 0x8004021FL +#define EVENT_S_FIRST 0x00040200L +#define EVENT_S_LAST 0x0004021FL +#define EVENT_S_SOME_SUBSCRIBERS_FAILED _HRESULT_TYPEDEF_(0x00040200L) +#define EVENT_E_ALL_SUBSCRIBERS_FAILED _HRESULT_TYPEDEF_(0x80040201L) +#define EVENT_S_NOSUBSCRIBERS _HRESULT_TYPEDEF_(0x00040202L) +#define EVENT_E_QUERYSYNTAX _HRESULT_TYPEDEF_(0x80040203L) +#define EVENT_E_QUERYFIELD _HRESULT_TYPEDEF_(0x80040204L) +#define EVENT_E_INTERNALEXCEPTION _HRESULT_TYPEDEF_(0x80040205L) +#define EVENT_E_INTERNALERROR _HRESULT_TYPEDEF_(0x80040206L) +#define EVENT_E_INVALID_PER_USER_SID _HRESULT_TYPEDEF_(0x80040207L) +#define EVENT_E_USER_EXCEPTION _HRESULT_TYPEDEF_(0x80040208L) +#define EVENT_E_TOO_MANY_METHODS _HRESULT_TYPEDEF_(0x80040209L) +#define EVENT_E_MISSING_EVENTCLASS _HRESULT_TYPEDEF_(0x8004020AL) +#define EVENT_E_NOT_ALL_REMOVED _HRESULT_TYPEDEF_(0x8004020BL) +#define EVENT_E_COMPLUS_NOT_INSTALLED _HRESULT_TYPEDEF_(0x8004020CL) +#define EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT _HRESULT_TYPEDEF_(0x8004020DL) +#define EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT _HRESULT_TYPEDEF_(0x8004020EL) +#define EVENT_E_INVALID_EVENT_CLASS_PARTITION _HRESULT_TYPEDEF_(0x8004020FL) +#define EVENT_E_PER_USER_SID_NOT_LOGGED_ON _HRESULT_TYPEDEF_(0x80040210L) +#define XACT_E_FIRST 0x8004D000 +#define XACT_E_LAST 0x8004D029 +#define XACT_S_FIRST 0x0004D000 +#define XACT_S_LAST 0x0004D010 +#define XACT_E_ALREADYOTHERSINGLEPHASE _HRESULT_TYPEDEF_(0x8004D000L) +#define XACT_E_CANTRETAIN _HRESULT_TYPEDEF_(0x8004D001L) +#define XACT_E_COMMITFAILED _HRESULT_TYPEDEF_(0x8004D002L) +#define XACT_E_COMMITPREVENTED _HRESULT_TYPEDEF_(0x8004D003L) +#define XACT_E_HEURISTICABORT _HRESULT_TYPEDEF_(0x8004D004L) +#define XACT_E_HEURISTICCOMMIT _HRESULT_TYPEDEF_(0x8004D005L) +#define XACT_E_HEURISTICDAMAGE _HRESULT_TYPEDEF_(0x8004D006L) +#define XACT_E_HEURISTICDANGER _HRESULT_TYPEDEF_(0x8004D007L) +#define XACT_E_ISOLATIONLEVEL _HRESULT_TYPEDEF_(0x8004D008L) +#define XACT_E_NOASYNC _HRESULT_TYPEDEF_(0x8004D009L) +#define XACT_E_NOENLIST _HRESULT_TYPEDEF_(0x8004D00AL) +#define XACT_E_NOISORETAIN _HRESULT_TYPEDEF_(0x8004D00BL) +#define XACT_E_NORESOURCE _HRESULT_TYPEDEF_(0x8004D00CL) +#define XACT_E_NOTCURRENT _HRESULT_TYPEDEF_(0x8004D00DL) +#define XACT_E_NOTRANSACTION _HRESULT_TYPEDEF_(0x8004D00EL) +#define XACT_E_NOTSUPPORTED _HRESULT_TYPEDEF_(0x8004D00FL) +#define XACT_E_UNKNOWNRMGRID _HRESULT_TYPEDEF_(0x8004D010L) +#define XACT_E_WRONGSTATE _HRESULT_TYPEDEF_(0x8004D011L) +#define XACT_E_WRONGUOW _HRESULT_TYPEDEF_(0x8004D012L) +#define XACT_E_XTIONEXISTS _HRESULT_TYPEDEF_(0x8004D013L) +#define XACT_E_NOIMPORTOBJECT _HRESULT_TYPEDEF_(0x8004D014L) +#define XACT_E_INVALIDCOOKIE _HRESULT_TYPEDEF_(0x8004D015L) +#define XACT_E_INDOUBT _HRESULT_TYPEDEF_(0x8004D016L) +#define XACT_E_NOTIMEOUT _HRESULT_TYPEDEF_(0x8004D017L) +#define XACT_E_ALREADYINPROGRESS _HRESULT_TYPEDEF_(0x8004D018L) +#define XACT_E_ABORTED _HRESULT_TYPEDEF_(0x8004D019L) +#define XACT_E_LOGFULL _HRESULT_TYPEDEF_(0x8004D01AL) +#define XACT_E_TMNOTAVAILABLE _HRESULT_TYPEDEF_(0x8004D01BL) +#define XACT_E_CONNECTION_DOWN _HRESULT_TYPEDEF_(0x8004D01CL) +#define XACT_E_CONNECTION_DENIED _HRESULT_TYPEDEF_(0x8004D01DL) +#define XACT_E_REENLISTTIMEOUT _HRESULT_TYPEDEF_(0x8004D01EL) +#define XACT_E_TIP_CONNECT_FAILED _HRESULT_TYPEDEF_(0x8004D01FL) +#define XACT_E_TIP_PROTOCOL_ERROR _HRESULT_TYPEDEF_(0x8004D020L) +#define XACT_E_TIP_PULL_FAILED _HRESULT_TYPEDEF_(0x8004D021L) +#define XACT_E_DEST_TMNOTAVAILABLE _HRESULT_TYPEDEF_(0x8004D022L) +#define XACT_E_TIP_DISABLED _HRESULT_TYPEDEF_(0x8004D023L) +#define XACT_E_NETWORK_TX_DISABLED _HRESULT_TYPEDEF_(0x8004D024L) +#define XACT_E_PARTNER_NETWORK_TX_DISABLED _HRESULT_TYPEDEF_(0x8004D025L) +#define XACT_E_XA_TX_DISABLED _HRESULT_TYPEDEF_(0x8004D026L) +#define XACT_E_UNABLE_TO_READ_DTC_CONFIG _HRESULT_TYPEDEF_(0x8004D027L) +#define XACT_E_UNABLE_TO_LOAD_DTC_PROXY _HRESULT_TYPEDEF_(0x8004D028L) +#define XACT_E_ABORTING _HRESULT_TYPEDEF_(0x8004D029L) +#define XACT_E_CLERKNOTFOUND _HRESULT_TYPEDEF_(0x8004D080L) +#define XACT_E_CLERKEXISTS _HRESULT_TYPEDEF_(0x8004D081L) +#define XACT_E_RECOVERYINPROGRESS _HRESULT_TYPEDEF_(0x8004D082L) +#define XACT_E_TRANSACTIONCLOSED _HRESULT_TYPEDEF_(0x8004D083L) +#define XACT_E_INVALIDLSN _HRESULT_TYPEDEF_(0x8004D084L) +#define XACT_E_REPLAYREQUEST _HRESULT_TYPEDEF_(0x8004D085L) +#define XACT_S_ASYNC _HRESULT_TYPEDEF_(0x0004D000L) +#define XACT_S_DEFECT _HRESULT_TYPEDEF_(0x0004D001L) +#define XACT_S_READONLY _HRESULT_TYPEDEF_(0x0004D002L) +#define XACT_S_SOMENORETAIN _HRESULT_TYPEDEF_(0x0004D003L) +#define XACT_S_OKINFORM _HRESULT_TYPEDEF_(0x0004D004L) +#define XACT_S_MADECHANGESCONTENT _HRESULT_TYPEDEF_(0x0004D005L) +#define XACT_S_MADECHANGESINFORM _HRESULT_TYPEDEF_(0x0004D006L) +#define XACT_S_ALLNORETAIN _HRESULT_TYPEDEF_(0x0004D007L) +#define XACT_S_ABORTING _HRESULT_TYPEDEF_(0x0004D008L) +#define XACT_S_SINGLEPHASE _HRESULT_TYPEDEF_(0x0004D009L) +#define XACT_S_LOCALLY_OK _HRESULT_TYPEDEF_(0x0004D00AL) +#define XACT_S_LASTRESOURCEMANAGER _HRESULT_TYPEDEF_(0x0004D010L) +#define CONTEXT_E_FIRST 0x8004E000L +#define CONTEXT_E_LAST 0x8004E02FL +#define CONTEXT_S_FIRST 0x0004E000L +#define CONTEXT_S_LAST 0x0004E02FL +#define CONTEXT_E_ABORTED _HRESULT_TYPEDEF_(0x8004E002L) +#define CONTEXT_E_ABORTING _HRESULT_TYPEDEF_(0x8004E003L) +#define CONTEXT_E_NOCONTEXT _HRESULT_TYPEDEF_(0x8004E004L) +#define CONTEXT_E_WOULD_DEADLOCK _HRESULT_TYPEDEF_(0x8004E005L) +#define CONTEXT_E_SYNCH_TIMEOUT _HRESULT_TYPEDEF_(0x8004E006L) +#define CONTEXT_E_OLDREF _HRESULT_TYPEDEF_(0x8004E007L) +#define CONTEXT_E_ROLENOTFOUND _HRESULT_TYPEDEF_(0x8004E00CL) +#define CONTEXT_E_TMNOTAVAILABLE _HRESULT_TYPEDEF_(0x8004E00FL) +#define CO_E_ACTIVATIONFAILED _HRESULT_TYPEDEF_(0x8004E021L) +#define CO_E_ACTIVATIONFAILED_EVENTLOGGED _HRESULT_TYPEDEF_(0x8004E022L) +#define CO_E_ACTIVATIONFAILED_CATALOGERROR _HRESULT_TYPEDEF_(0x8004E023L) +#define CO_E_ACTIVATIONFAILED_TIMEOUT _HRESULT_TYPEDEF_(0x8004E024L) +#define CO_E_INITIALIZATIONFAILED _HRESULT_TYPEDEF_(0x8004E025L) +#define CONTEXT_E_NOJIT _HRESULT_TYPEDEF_(0x8004E026L) +#define CONTEXT_E_NOTRANSACTION _HRESULT_TYPEDEF_(0x8004E027L) +#define CO_E_THREADINGMODEL_CHANGED _HRESULT_TYPEDEF_(0x8004E028L) +#define CO_E_NOIISINTRINSICS _HRESULT_TYPEDEF_(0x8004E029L) +#define CO_E_NOCOOKIES _HRESULT_TYPEDEF_(0x8004E02AL) +#define CO_E_DBERROR _HRESULT_TYPEDEF_(0x8004E02BL) +#define CO_E_NOTPOOLED _HRESULT_TYPEDEF_(0x8004E02CL) +#define CO_E_NOTCONSTRUCTED _HRESULT_TYPEDEF_(0x8004E02DL) +#define CO_E_NOSYNCHRONIZATION _HRESULT_TYPEDEF_(0x8004E02EL) +#define CO_E_ISOLEVELMISMATCH _HRESULT_TYPEDEF_(0x8004E02FL) +#define OLE_S_USEREG _HRESULT_TYPEDEF_(0x00040000L) +#define OLE_S_STATIC _HRESULT_TYPEDEF_(0x00040001L) +#define OLE_S_MAC_CLIPFORMAT _HRESULT_TYPEDEF_(0x00040002L) +#define DRAGDROP_S_DROP _HRESULT_TYPEDEF_(0x00040100L) +#define DRAGDROP_S_CANCEL _HRESULT_TYPEDEF_(0x00040101L) +#define DRAGDROP_S_USEDEFAULTCURSORS _HRESULT_TYPEDEF_(0x00040102L) +#define DATA_S_SAMEFORMATETC _HRESULT_TYPEDEF_(0x00040130L) +#define VIEW_S_ALREADY_FROZEN _HRESULT_TYPEDEF_(0x00040140L) +#define CACHE_S_FORMATETC_NOTSUPPORTED _HRESULT_TYPEDEF_(0x00040170L) +#define CACHE_S_SAMECACHE _HRESULT_TYPEDEF_(0x00040171L) +#define CACHE_S_SOMECACHES_NOTUPDATED _HRESULT_TYPEDEF_(0x00040172L) +#define OLEOBJ_S_INVALIDVERB _HRESULT_TYPEDEF_(0x00040180L) +#define OLEOBJ_S_CANNOT_DOVERB_NOW _HRESULT_TYPEDEF_(0x00040181L) +#define OLEOBJ_S_INVALIDHWND _HRESULT_TYPEDEF_(0x00040182L) +#define INPLACE_S_TRUNCATED _HRESULT_TYPEDEF_(0x000401A0L) +#define CONVERT10_S_NO_PRESENTATION _HRESULT_TYPEDEF_(0x000401C0L) +#define MK_S_REDUCED_TO_SELF _HRESULT_TYPEDEF_(0x000401E2L) +#define MK_S_ME _HRESULT_TYPEDEF_(0x000401E4L) +#define MK_S_HIM _HRESULT_TYPEDEF_(0x000401E5L) +#define MK_S_US _HRESULT_TYPEDEF_(0x000401E6L) +#define MK_S_MONIKERALREADYREGISTERED _HRESULT_TYPEDEF_(0x000401E7L) +#define SCHED_S_TASK_READY _HRESULT_TYPEDEF_(0x00041300L) +#define SCHED_S_TASK_RUNNING _HRESULT_TYPEDEF_(0x00041301L) +#define SCHED_S_TASK_DISABLED _HRESULT_TYPEDEF_(0x00041302L) +#define SCHED_S_TASK_HAS_NOT_RUN _HRESULT_TYPEDEF_(0x00041303L) +#define SCHED_S_TASK_NO_MORE_RUNS _HRESULT_TYPEDEF_(0x00041304L) +#define SCHED_S_TASK_NOT_SCHEDULED _HRESULT_TYPEDEF_(0x00041305L) +#define SCHED_S_TASK_TERMINATED _HRESULT_TYPEDEF_(0x00041306L) +#define SCHED_S_TASK_NO_VALID_TRIGGERS _HRESULT_TYPEDEF_(0x00041307L) +#define SCHED_S_EVENT_TRIGGER _HRESULT_TYPEDEF_(0x00041308L) +#define SCHED_E_TRIGGER_NOT_FOUND _HRESULT_TYPEDEF_(0x80041309L) +#define SCHED_E_TASK_NOT_READY _HRESULT_TYPEDEF_(0x8004130AL) +#define SCHED_E_TASK_NOT_RUNNING _HRESULT_TYPEDEF_(0x8004130BL) +#define SCHED_E_SERVICE_NOT_INSTALLED _HRESULT_TYPEDEF_(0x8004130CL) +#define SCHED_E_CANNOT_OPEN_TASK _HRESULT_TYPEDEF_(0x8004130DL) +#define SCHED_E_INVALID_TASK _HRESULT_TYPEDEF_(0x8004130EL) +#define SCHED_E_ACCOUNT_INFORMATION_NOT_SET _HRESULT_TYPEDEF_(0x8004130FL) +#define SCHED_E_ACCOUNT_NAME_NOT_FOUND _HRESULT_TYPEDEF_(0x80041310L) +#define SCHED_E_ACCOUNT_DBASE_CORRUPT _HRESULT_TYPEDEF_(0x80041311L) +#define SCHED_E_NO_SECURITY_SERVICES _HRESULT_TYPEDEF_(0x80041312L) +#define SCHED_E_UNKNOWN_OBJECT_VERSION _HRESULT_TYPEDEF_(0x80041313L) +#define SCHED_E_UNSUPPORTED_ACCOUNT_OPTION _HRESULT_TYPEDEF_(0x80041314L) +#define SCHED_E_SERVICE_NOT_RUNNING _HRESULT_TYPEDEF_(0x80041315L) +#define CO_E_CLASS_CREATE_FAILED _HRESULT_TYPEDEF_(0x80080001L) +#define CO_E_SCM_ERROR _HRESULT_TYPEDEF_(0x80080002L) +#define CO_E_SCM_RPC_FAILURE _HRESULT_TYPEDEF_(0x80080003L) +#define CO_E_BAD_PATH _HRESULT_TYPEDEF_(0x80080004L) +#define CO_E_SERVER_EXEC_FAILURE _HRESULT_TYPEDEF_(0x80080005L) +#define CO_E_OBJSRV_RPC_FAILURE _HRESULT_TYPEDEF_(0x80080006L) +#define MK_E_NO_NORMALIZED _HRESULT_TYPEDEF_(0x80080007L) +#define CO_E_SERVER_STOPPING _HRESULT_TYPEDEF_(0x80080008L) +#define MEM_E_INVALID_ROOT _HRESULT_TYPEDEF_(0x80080009L) +#define MEM_E_INVALID_LINK _HRESULT_TYPEDEF_(0x80080010L) +#define MEM_E_INVALID_SIZE _HRESULT_TYPEDEF_(0x80080011L) +#define CO_S_NOTALLINTERFACES _HRESULT_TYPEDEF_(0x00080012L) +#define CO_S_MACHINENAMENOTFOUND _HRESULT_TYPEDEF_(0x00080013L) +#define DISP_E_UNKNOWNINTERFACE _HRESULT_TYPEDEF_(0x80020001L) +#define DISP_E_MEMBERNOTFOUND _HRESULT_TYPEDEF_(0x80020003L) +#define DISP_E_PARAMNOTFOUND _HRESULT_TYPEDEF_(0x80020004L) +#define DISP_E_TYPEMISMATCH _HRESULT_TYPEDEF_(0x80020005L) +#define DISP_E_UNKNOWNNAME _HRESULT_TYPEDEF_(0x80020006L) +#define DISP_E_NONAMEDARGS _HRESULT_TYPEDEF_(0x80020007L) +#define DISP_E_BADVARTYPE _HRESULT_TYPEDEF_(0x80020008L) +#define DISP_E_EXCEPTION _HRESULT_TYPEDEF_(0x80020009L) +#define DISP_E_OVERFLOW _HRESULT_TYPEDEF_(0x8002000AL) +#define DISP_E_BADINDEX _HRESULT_TYPEDEF_(0x8002000BL) +#define DISP_E_UNKNOWNLCID _HRESULT_TYPEDEF_(0x8002000CL) +#define DISP_E_ARRAYISLOCKED _HRESULT_TYPEDEF_(0x8002000DL) +#define DISP_E_BADPARAMCOUNT _HRESULT_TYPEDEF_(0x8002000EL) +#define DISP_E_PARAMNOTOPTIONAL _HRESULT_TYPEDEF_(0x8002000FL) +#define DISP_E_BADCALLEE _HRESULT_TYPEDEF_(0x80020010L) +#define DISP_E_NOTACOLLECTION _HRESULT_TYPEDEF_(0x80020011L) +#define DISP_E_DIVBYZERO _HRESULT_TYPEDEF_(0x80020012L) +#define DISP_E_BUFFERTOOSMALL _HRESULT_TYPEDEF_(0x80020013L) +#define TYPE_E_BUFFERTOOSMALL _HRESULT_TYPEDEF_(0x80028016L) +#define TYPE_E_FIELDNOTFOUND _HRESULT_TYPEDEF_(0x80028017L) +#define TYPE_E_INVDATAREAD _HRESULT_TYPEDEF_(0x80028018L) +#define TYPE_E_UNSUPFORMAT _HRESULT_TYPEDEF_(0x80028019L) +#define TYPE_E_REGISTRYACCESS _HRESULT_TYPEDEF_(0x8002801CL) +#define TYPE_E_LIBNOTREGISTERED _HRESULT_TYPEDEF_(0x8002801DL) +#define TYPE_E_UNDEFINEDTYPE _HRESULT_TYPEDEF_(0x80028027L) +#define TYPE_E_QUALIFIEDNAMEDISALLOWED _HRESULT_TYPEDEF_(0x80028028L) +#define TYPE_E_INVALIDSTATE _HRESULT_TYPEDEF_(0x80028029L) +#define TYPE_E_WRONGTYPEKIND _HRESULT_TYPEDEF_(0x8002802AL) +#define TYPE_E_ELEMENTNOTFOUND _HRESULT_TYPEDEF_(0x8002802BL) +#define TYPE_E_AMBIGUOUSNAME _HRESULT_TYPEDEF_(0x8002802CL) +#define TYPE_E_NAMECONFLICT _HRESULT_TYPEDEF_(0x8002802DL) +#define TYPE_E_UNKNOWNLCID _HRESULT_TYPEDEF_(0x8002802EL) +#define TYPE_E_DLLFUNCTIONNOTFOUND _HRESULT_TYPEDEF_(0x8002802FL) +#define TYPE_E_BADMODULEKIND _HRESULT_TYPEDEF_(0x800288BDL) +#define TYPE_E_SIZETOOBIG _HRESULT_TYPEDEF_(0x800288C5L) +#define TYPE_E_DUPLICATEID _HRESULT_TYPEDEF_(0x800288C6L) +#define TYPE_E_INVALIDID _HRESULT_TYPEDEF_(0x800288CFL) +#define TYPE_E_TYPEMISMATCH _HRESULT_TYPEDEF_(0x80028CA0L) +#define TYPE_E_OUTOFBOUNDS _HRESULT_TYPEDEF_(0x80028CA1L) +#define TYPE_E_IOERROR _HRESULT_TYPEDEF_(0x80028CA2L) +#define TYPE_E_CANTCREATETMPFILE _HRESULT_TYPEDEF_(0x80028CA3L) +#define TYPE_E_CANTLOADLIBRARY _HRESULT_TYPEDEF_(0x80029C4AL) +#define TYPE_E_INCONSISTENTPROPFUNCS _HRESULT_TYPEDEF_(0x80029C83L) +#define TYPE_E_CIRCULARTYPE _HRESULT_TYPEDEF_(0x80029C84L) +#define STG_E_INVALIDFUNCTION _HRESULT_TYPEDEF_(0x80030001L) +#define STG_E_FILENOTFOUND _HRESULT_TYPEDEF_(0x80030002L) +#define STG_E_PATHNOTFOUND _HRESULT_TYPEDEF_(0x80030003L) +#define STG_E_TOOMANYOPENFILES _HRESULT_TYPEDEF_(0x80030004L) +#define STG_E_ACCESSDENIED _HRESULT_TYPEDEF_(0x80030005L) +#define STG_E_INVALIDHANDLE _HRESULT_TYPEDEF_(0x80030006L) +#define STG_E_INSUFFICIENTMEMORY _HRESULT_TYPEDEF_(0x80030008L) +#define STG_E_INVALIDPOINTER _HRESULT_TYPEDEF_(0x80030009L) +#define STG_E_NOMOREFILES _HRESULT_TYPEDEF_(0x80030012L) +#define STG_E_DISKISWRITEPROTECTED _HRESULT_TYPEDEF_(0x80030013L) +#define STG_E_SEEKERROR _HRESULT_TYPEDEF_(0x80030019L) +#define STG_E_WRITEFAULT _HRESULT_TYPEDEF_(0x8003001DL) +#define STG_E_READFAULT _HRESULT_TYPEDEF_(0x8003001EL) +#define STG_E_SHAREVIOLATION _HRESULT_TYPEDEF_(0x80030020L) +#define STG_E_LOCKVIOLATION _HRESULT_TYPEDEF_(0x80030021L) +#define STG_E_FILEALREADYEXISTS _HRESULT_TYPEDEF_(0x80030050L) +#define STG_E_INVALIDPARAMETER _HRESULT_TYPEDEF_(0x80030057L) +#define STG_E_MEDIUMFULL _HRESULT_TYPEDEF_(0x80030070L) +#define STG_E_PROPSETMISMATCHED _HRESULT_TYPEDEF_(0x800300F0L) +#define STG_E_ABNORMALAPIEXIT _HRESULT_TYPEDEF_(0x800300FAL) +#define STG_E_INVALIDHEADER _HRESULT_TYPEDEF_(0x800300FBL) +#define STG_E_INVALIDNAME _HRESULT_TYPEDEF_(0x800300FCL) +#define STG_E_UNKNOWN _HRESULT_TYPEDEF_(0x800300FDL) +#define STG_E_UNIMPLEMENTEDFUNCTION _HRESULT_TYPEDEF_(0x800300FEL) +#define STG_E_INVALIDFLAG _HRESULT_TYPEDEF_(0x800300FFL) +#define STG_E_INUSE _HRESULT_TYPEDEF_(0x80030100L) +#define STG_E_NOTCURRENT _HRESULT_TYPEDEF_(0x80030101L) +#define STG_E_REVERTED _HRESULT_TYPEDEF_(0x80030102L) +#define STG_E_CANTSAVE _HRESULT_TYPEDEF_(0x80030103L) +#define STG_E_OLDFORMAT _HRESULT_TYPEDEF_(0x80030104L) +#define STG_E_OLDDLL _HRESULT_TYPEDEF_(0x80030105L) +#define STG_E_SHAREREQUIRED _HRESULT_TYPEDEF_(0x80030106L) +#define STG_E_NOTFILEBASEDSTORAGE _HRESULT_TYPEDEF_(0x80030107L) +#define STG_E_EXTANTMARSHALLINGS _HRESULT_TYPEDEF_(0x80030108L) +#define STG_E_DOCFILECORRUPT _HRESULT_TYPEDEF_(0x80030109L) +#define STG_E_BADBASEADDRESS _HRESULT_TYPEDEF_(0x80030110L) +#define STG_E_DOCFILETOOLARGE _HRESULT_TYPEDEF_(0x80030111L) +#define STG_E_NOTSIMPLEFORMAT _HRESULT_TYPEDEF_(0x80030112L) +#define STG_E_INCOMPLETE _HRESULT_TYPEDEF_(0x80030201L) +#define STG_E_TERMINATED _HRESULT_TYPEDEF_(0x80030202L) +#define STG_S_CONVERTED _HRESULT_TYPEDEF_(0x00030200L) +#define STG_S_BLOCK _HRESULT_TYPEDEF_(0x00030201L) +#define STG_S_RETRYNOW _HRESULT_TYPEDEF_(0x00030202L) +#define STG_S_MONITORING _HRESULT_TYPEDEF_(0x00030203L) +#define STG_S_MULTIPLEOPENS _HRESULT_TYPEDEF_(0x00030204L) +#define STG_S_CONSOLIDATIONFAILED _HRESULT_TYPEDEF_(0x00030205L) +#define STG_S_CANNOTCONSOLIDATE _HRESULT_TYPEDEF_(0x00030206L) +#define STG_E_STATUS_COPY_PROTECTION_FAILURE _HRESULT_TYPEDEF_(0x80030305L) +#define STG_E_CSS_AUTHENTICATION_FAILURE _HRESULT_TYPEDEF_(0x80030306L) +#define STG_E_CSS_KEY_NOT_PRESENT _HRESULT_TYPEDEF_(0x80030307L) +#define STG_E_CSS_KEY_NOT_ESTABLISHED _HRESULT_TYPEDEF_(0x80030308L) +#define STG_E_CSS_SCRAMBLED_SECTOR _HRESULT_TYPEDEF_(0x80030309L) +#define STG_E_CSS_REGION_MISMATCH _HRESULT_TYPEDEF_(0x8003030AL) +#define STG_E_RESETS_EXHAUSTED _HRESULT_TYPEDEF_(0x8003030BL) +#define RPC_E_CALL_REJECTED _HRESULT_TYPEDEF_(0x80010001L) +#define RPC_E_CALL_CANCELED _HRESULT_TYPEDEF_(0x80010002L) +#define RPC_E_CANTPOST_INSENDCALL _HRESULT_TYPEDEF_(0x80010003L) +#define RPC_E_CANTCALLOUT_INASYNCCALL _HRESULT_TYPEDEF_(0x80010004L) +#define RPC_E_CANTCALLOUT_INEXTERNALCALL _HRESULT_TYPEDEF_(0x80010005L) +#define RPC_E_CONNECTION_TERMINATED _HRESULT_TYPEDEF_(0x80010006L) +#define RPC_E_SERVER_DIED _HRESULT_TYPEDEF_(0x80010007L) +#define RPC_E_CLIENT_DIED _HRESULT_TYPEDEF_(0x80010008L) +#define RPC_E_INVALID_DATAPACKET _HRESULT_TYPEDEF_(0x80010009L) +#define RPC_E_CANTTRANSMIT_CALL _HRESULT_TYPEDEF_(0x8001000AL) +#define RPC_E_CLIENT_CANTMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000BL) +#define RPC_E_CLIENT_CANTUNMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000CL) +#define RPC_E_SERVER_CANTMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000DL) +#define RPC_E_SERVER_CANTUNMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000EL) +#define RPC_E_INVALID_DATA _HRESULT_TYPEDEF_(0x8001000FL) +#define RPC_E_INVALID_PARAMETER _HRESULT_TYPEDEF_(0x80010010L) +#define RPC_E_CANTCALLOUT_AGAIN _HRESULT_TYPEDEF_(0x80010011L) +#define RPC_E_SERVER_DIED_DNE _HRESULT_TYPEDEF_(0x80010012L) +#define RPC_E_SYS_CALL_FAILED _HRESULT_TYPEDEF_(0x80010100L) +#define RPC_E_OUT_OF_RESOURCES _HRESULT_TYPEDEF_(0x80010101L) +#define RPC_E_ATTEMPTED_MULTITHREAD _HRESULT_TYPEDEF_(0x80010102L) +#define RPC_E_NOT_REGISTERED _HRESULT_TYPEDEF_(0x80010103L) +#define RPC_E_FAULT _HRESULT_TYPEDEF_(0x80010104L) +#define RPC_E_SERVERFAULT _HRESULT_TYPEDEF_(0x80010105L) +#define RPC_E_CHANGED_MODE _HRESULT_TYPEDEF_(0x80010106L) +#define RPC_E_INVALIDMETHOD _HRESULT_TYPEDEF_(0x80010107L) +#define RPC_E_DISCONNECTED _HRESULT_TYPEDEF_(0x80010108L) +#define RPC_E_RETRY _HRESULT_TYPEDEF_(0x80010109L) +#define RPC_E_SERVERCALL_RETRYLATER _HRESULT_TYPEDEF_(0x8001010AL) +#define RPC_E_SERVERCALL_REJECTED _HRESULT_TYPEDEF_(0x8001010BL) +#define RPC_E_INVALID_CALLDATA _HRESULT_TYPEDEF_(0x8001010CL) +#define RPC_E_CANTCALLOUT_ININPUTSYNCCALL _HRESULT_TYPEDEF_(0x8001010DL) +#define RPC_E_WRONG_THREAD _HRESULT_TYPEDEF_(0x8001010EL) +#define RPC_E_THREAD_NOT_INIT _HRESULT_TYPEDEF_(0x8001010FL) +#define RPC_E_VERSION_MISMATCH _HRESULT_TYPEDEF_(0x80010110L) +#define RPC_E_INVALID_HEADER _HRESULT_TYPEDEF_(0x80010111L) +#define RPC_E_INVALID_EXTENSION _HRESULT_TYPEDEF_(0x80010112L) +#define RPC_E_INVALID_IPID _HRESULT_TYPEDEF_(0x80010113L) +#define RPC_E_INVALID_OBJECT _HRESULT_TYPEDEF_(0x80010114L) +#define RPC_S_CALLPENDING _HRESULT_TYPEDEF_(0x80010115L) +#define RPC_S_WAITONTIMER _HRESULT_TYPEDEF_(0x80010116L) +#define RPC_E_CALL_COMPLETE _HRESULT_TYPEDEF_(0x80010117L) +#define RPC_E_UNSECURE_CALL _HRESULT_TYPEDEF_(0x80010118L) +#define RPC_E_TOO_LATE _HRESULT_TYPEDEF_(0x80010119L) +#define RPC_E_NO_GOOD_SECURITY_PACKAGES _HRESULT_TYPEDEF_(0x8001011AL) +#define RPC_E_ACCESS_DENIED _HRESULT_TYPEDEF_(0x8001011BL) +#define RPC_E_REMOTE_DISABLED _HRESULT_TYPEDEF_(0x8001011CL) +#define RPC_E_INVALID_OBJREF _HRESULT_TYPEDEF_(0x8001011DL) +#define RPC_E_NO_CONTEXT _HRESULT_TYPEDEF_(0x8001011EL) +#define RPC_E_TIMEOUT _HRESULT_TYPEDEF_(0x8001011FL) +#define RPC_E_NO_SYNC _HRESULT_TYPEDEF_(0x80010120L) +#define RPC_E_FULLSIC_REQUIRED _HRESULT_TYPEDEF_(0x80010121L) +#define RPC_E_INVALID_STD_NAME _HRESULT_TYPEDEF_(0x80010122L) +#define CO_E_FAILEDTOIMPERSONATE _HRESULT_TYPEDEF_(0x80010123L) +#define CO_E_FAILEDTOGETSECCTX _HRESULT_TYPEDEF_(0x80010124L) +#define CO_E_FAILEDTOOPENTHREADTOKEN _HRESULT_TYPEDEF_(0x80010125L) +#define CO_E_FAILEDTOGETTOKENINFO _HRESULT_TYPEDEF_(0x80010126L) +#define CO_E_TRUSTEEDOESNTMATCHCLIENT _HRESULT_TYPEDEF_(0x80010127L) +#define CO_E_FAILEDTOQUERYCLIENTBLANKET _HRESULT_TYPEDEF_(0x80010128L) +#define CO_E_FAILEDTOSETDACL _HRESULT_TYPEDEF_(0x80010129L) +#define CO_E_ACCESSCHECKFAILED _HRESULT_TYPEDEF_(0x8001012AL) +#define CO_E_NETACCESSAPIFAILED _HRESULT_TYPEDEF_(0x8001012BL) +#define CO_E_WRONGTRUSTEENAMESYNTAX _HRESULT_TYPEDEF_(0x8001012CL) +#define CO_E_INVALIDSID _HRESULT_TYPEDEF_(0x8001012DL) +#define CO_E_CONVERSIONFAILED _HRESULT_TYPEDEF_(0x8001012EL) +#define CO_E_NOMATCHINGSIDFOUND _HRESULT_TYPEDEF_(0x8001012FL) +#define CO_E_LOOKUPACCSIDFAILED _HRESULT_TYPEDEF_(0x80010130L) +#define CO_E_NOMATCHINGNAMEFOUND _HRESULT_TYPEDEF_(0x80010131L) +#define CO_E_LOOKUPACCNAMEFAILED _HRESULT_TYPEDEF_(0x80010132L) +#define CO_E_SETSERLHNDLFAILED _HRESULT_TYPEDEF_(0x80010133L) +#define CO_E_FAILEDTOGETWINDIR _HRESULT_TYPEDEF_(0x80010134L) +#define CO_E_PATHTOOLONG _HRESULT_TYPEDEF_(0x80010135L) +#define CO_E_FAILEDTOGENUUID _HRESULT_TYPEDEF_(0x80010136L) +#define CO_E_FAILEDTOCREATEFILE _HRESULT_TYPEDEF_(0x80010137L) +#define CO_E_FAILEDTOCLOSEHANDLE _HRESULT_TYPEDEF_(0x80010138L) +#define CO_E_EXCEEDSYSACLLIMIT _HRESULT_TYPEDEF_(0x80010139L) +#define CO_E_ACESINWRONGORDER _HRESULT_TYPEDEF_(0x8001013AL) +#define CO_E_INCOMPATIBLESTREAMVERSION _HRESULT_TYPEDEF_(0x8001013BL) +#define CO_E_FAILEDTOOPENPROCESSTOKEN _HRESULT_TYPEDEF_(0x8001013CL) +#define CO_E_DECODEFAILED _HRESULT_TYPEDEF_(0x8001013DL) +#define CO_E_ACNOTINITIALIZED _HRESULT_TYPEDEF_(0x8001013FL) +#define CO_E_CANCEL_DISABLED _HRESULT_TYPEDEF_(0x80010140L) +#define RPC_E_UNEXPECTED _HRESULT_TYPEDEF_(0x8001FFFFL) +#define ERROR_AUDITING_DISABLED _HRESULT_TYPEDEF_(0xC0090001L) +#define ERROR_ALL_SIDS_FILTERED _HRESULT_TYPEDEF_(0xC0090002L) +#define NTE_BAD_UID _HRESULT_TYPEDEF_(0x80090001L) +#define NTE_BAD_HASH _HRESULT_TYPEDEF_(0x80090002L) +#define NTE_BAD_KEY _HRESULT_TYPEDEF_(0x80090003L) +#define NTE_BAD_LEN _HRESULT_TYPEDEF_(0x80090004L) +#define NTE_BAD_DATA _HRESULT_TYPEDEF_(0x80090005L) +#define NTE_BAD_SIGNATURE _HRESULT_TYPEDEF_(0x80090006L) +#define NTE_BAD_VER _HRESULT_TYPEDEF_(0x80090007L) +#define NTE_BAD_ALGID _HRESULT_TYPEDEF_(0x80090008L) +#define NTE_BAD_FLAGS _HRESULT_TYPEDEF_(0x80090009L) +#define NTE_BAD_TYPE _HRESULT_TYPEDEF_(0x8009000AL) +#define NTE_BAD_KEY_STATE _HRESULT_TYPEDEF_(0x8009000BL) +#define NTE_BAD_HASH_STATE _HRESULT_TYPEDEF_(0x8009000CL) +#define NTE_NO_KEY _HRESULT_TYPEDEF_(0x8009000DL) +#define NTE_NO_MEMORY _HRESULT_TYPEDEF_(0x8009000EL) +#define NTE_EXISTS _HRESULT_TYPEDEF_(0x8009000FL) +#define NTE_PERM _HRESULT_TYPEDEF_(0x80090010L) +#define NTE_NOT_FOUND _HRESULT_TYPEDEF_(0x80090011L) +#define NTE_DOUBLE_ENCRYPT _HRESULT_TYPEDEF_(0x80090012L) +#define NTE_BAD_PROVIDER _HRESULT_TYPEDEF_(0x80090013L) +#define NTE_BAD_PROV_TYPE _HRESULT_TYPEDEF_(0x80090014L) +#define NTE_BAD_PUBLIC_KEY _HRESULT_TYPEDEF_(0x80090015L) +#define NTE_BAD_KEYSET _HRESULT_TYPEDEF_(0x80090016L) +#define NTE_PROV_TYPE_NOT_DEF _HRESULT_TYPEDEF_(0x80090017L) +#define NTE_PROV_TYPE_ENTRY_BAD _HRESULT_TYPEDEF_(0x80090018L) +#define NTE_KEYSET_NOT_DEF _HRESULT_TYPEDEF_(0x80090019L) +#define NTE_KEYSET_ENTRY_BAD _HRESULT_TYPEDEF_(0x8009001AL) +#define NTE_PROV_TYPE_NO_MATCH _HRESULT_TYPEDEF_(0x8009001BL) +#define NTE_SIGNATURE_FILE_BAD _HRESULT_TYPEDEF_(0x8009001CL) +#define NTE_PROVIDER_DLL_FAIL _HRESULT_TYPEDEF_(0x8009001DL) +#define NTE_PROV_DLL_NOT_FOUND _HRESULT_TYPEDEF_(0x8009001EL) +#define NTE_BAD_KEYSET_PARAM _HRESULT_TYPEDEF_(0x8009001FL) +#define NTE_FAIL _HRESULT_TYPEDEF_(0x80090020L) +#define NTE_SYS_ERR _HRESULT_TYPEDEF_(0x80090021L) +#define NTE_SILENT_CONTEXT _HRESULT_TYPEDEF_(0x80090022L) +#define NTE_TOKEN_KEYSET_STORAGE_FULL _HRESULT_TYPEDEF_(0x80090023L) +#define NTE_TEMPORARY_PROFILE _HRESULT_TYPEDEF_(0x80090024L) +#define NTE_FIXEDPARAMETER _HRESULT_TYPEDEF_(0x80090025L) +#define SEC_E_INSUFFICIENT_MEMORY _HRESULT_TYPEDEF_(0x80090300L) +#define SEC_E_INVALID_HANDLE _HRESULT_TYPEDEF_(0x80090301L) +#define SEC_E_UNSUPPORTED_FUNCTION _HRESULT_TYPEDEF_(0x80090302L) +#define SEC_E_TARGET_UNKNOWN _HRESULT_TYPEDEF_(0x80090303L) +#define SEC_E_INTERNAL_ERROR _HRESULT_TYPEDEF_(0x80090304L) +#define SEC_E_SECPKG_NOT_FOUND _HRESULT_TYPEDEF_(0x80090305L) +#define SEC_E_NOT_OWNER _HRESULT_TYPEDEF_(0x80090306L) +#define SEC_E_CANNOT_INSTALL _HRESULT_TYPEDEF_(0x80090307L) +#define SEC_E_INVALID_TOKEN _HRESULT_TYPEDEF_(0x80090308L) +#define SEC_E_CANNOT_PACK _HRESULT_TYPEDEF_(0x80090309L) +#define SEC_E_QOP_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009030AL) +#define SEC_E_NO_IMPERSONATION _HRESULT_TYPEDEF_(0x8009030BL) +#define SEC_E_LOGON_DENIED _HRESULT_TYPEDEF_(0x8009030CL) +#define SEC_E_UNKNOWN_CREDENTIALS _HRESULT_TYPEDEF_(0x8009030DL) +#define SEC_E_NO_CREDENTIALS _HRESULT_TYPEDEF_(0x8009030EL) +#define SEC_E_MESSAGE_ALTERED _HRESULT_TYPEDEF_(0x8009030FL) +#define SEC_E_OUT_OF_SEQUENCE _HRESULT_TYPEDEF_(0x80090310L) +#define SEC_E_NO_AUTHENTICATING_AUTHORITY _HRESULT_TYPEDEF_(0x80090311L) +#define SEC_I_CONTINUE_NEEDED _HRESULT_TYPEDEF_(0x00090312L) +#define SEC_I_COMPLETE_NEEDED _HRESULT_TYPEDEF_(0x00090313L) +#define SEC_I_COMPLETE_AND_CONTINUE _HRESULT_TYPEDEF_(0x00090314L) +#define SEC_I_LOCAL_LOGON _HRESULT_TYPEDEF_(0x00090315L) +#define SEC_E_BAD_PKGID _HRESULT_TYPEDEF_(0x80090316L) +#define SEC_E_CONTEXT_EXPIRED _HRESULT_TYPEDEF_(0x80090317L) +#define SEC_I_CONTEXT_EXPIRED _HRESULT_TYPEDEF_(0x00090317L) +#define SEC_E_INCOMPLETE_MESSAGE _HRESULT_TYPEDEF_(0x80090318L) +#define SEC_E_INCOMPLETE_CREDENTIALS _HRESULT_TYPEDEF_(0x80090320L) +#define SEC_E_BUFFER_TOO_SMALL _HRESULT_TYPEDEF_(0x80090321L) +#define SEC_I_INCOMPLETE_CREDENTIALS _HRESULT_TYPEDEF_(0x00090320L) +#define SEC_I_RENEGOTIATE _HRESULT_TYPEDEF_(0x00090321L) +#define SEC_E_WRONG_PRINCIPAL _HRESULT_TYPEDEF_(0x80090322L) +#define SEC_I_NO_LSA_CONTEXT _HRESULT_TYPEDEF_(0x00090323L) +#define SEC_E_TIME_SKEW _HRESULT_TYPEDEF_(0x80090324L) +#define SEC_E_UNTRUSTED_ROOT _HRESULT_TYPEDEF_(0x80090325L) +#define SEC_E_ILLEGAL_MESSAGE _HRESULT_TYPEDEF_(0x80090326L) +#define SEC_E_CERT_UNKNOWN _HRESULT_TYPEDEF_(0x80090327L) +#define SEC_E_CERT_EXPIRED _HRESULT_TYPEDEF_(0x80090328L) +#define SEC_E_ENCRYPT_FAILURE _HRESULT_TYPEDEF_(0x80090329L) +#define SEC_E_DECRYPT_FAILURE _HRESULT_TYPEDEF_(0x80090330L) +#define SEC_E_ALGORITHM_MISMATCH _HRESULT_TYPEDEF_(0x80090331L) +#define SEC_E_SECURITY_QOS_FAILED _HRESULT_TYPEDEF_(0x80090332L) +#define SEC_E_UNFINISHED_CONTEXT_DELETED _HRESULT_TYPEDEF_(0x80090333L) +#define SEC_E_NO_TGT_REPLY _HRESULT_TYPEDEF_(0x80090334L) +#define SEC_E_NO_IP_ADDRESSES _HRESULT_TYPEDEF_(0x80090335L) +#define SEC_E_WRONG_CREDENTIAL_HANDLE _HRESULT_TYPEDEF_(0x80090336L) +#define SEC_E_CRYPTO_SYSTEM_INVALID _HRESULT_TYPEDEF_(0x80090337L) +#define SEC_E_MAX_REFERRALS_EXCEEDED _HRESULT_TYPEDEF_(0x80090338L) +#define SEC_E_MUST_BE_KDC _HRESULT_TYPEDEF_(0x80090339L) +#define SEC_E_STRONG_CRYPTO_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009033AL) +#define SEC_E_TOO_MANY_PRINCIPALS _HRESULT_TYPEDEF_(0x8009033BL) +#define SEC_E_NO_PA_DATA _HRESULT_TYPEDEF_(0x8009033CL) +#define SEC_E_PKINIT_NAME_MISMATCH _HRESULT_TYPEDEF_(0x8009033DL) +#define SEC_E_SMARTCARD_LOGON_REQUIRED _HRESULT_TYPEDEF_(0x8009033EL) +#define SEC_E_SHUTDOWN_IN_PROGRESS _HRESULT_TYPEDEF_(0x8009033FL) +#define SEC_E_KDC_INVALID_REQUEST _HRESULT_TYPEDEF_(0x80090340L) +#define SEC_E_KDC_UNABLE_TO_REFER _HRESULT_TYPEDEF_(0x80090341L) +#define SEC_E_KDC_UNKNOWN_ETYPE _HRESULT_TYPEDEF_(0x80090342L) +#define SEC_E_UNSUPPORTED_PREAUTH _HRESULT_TYPEDEF_(0x80090343L) +#define SEC_E_DELEGATION_REQUIRED _HRESULT_TYPEDEF_(0x80090345L) +#define SEC_E_BAD_BINDINGS _HRESULT_TYPEDEF_(0x80090346L) +#define SEC_E_MULTIPLE_ACCOUNTS _HRESULT_TYPEDEF_(0x80090347L) +#define SEC_E_NO_KERB_KEY _HRESULT_TYPEDEF_(0x80090348L) +#define SEC_E_CERT_WRONG_USAGE _HRESULT_TYPEDEF_(0x80090349L) +#define SEC_E_DOWNGRADE_DETECTED _HRESULT_TYPEDEF_(0x80090350L) +#define SEC_E_SMARTCARD_CERT_REVOKED _HRESULT_TYPEDEF_(0x80090351L) +#define SEC_E_ISSUING_CA_UNTRUSTED _HRESULT_TYPEDEF_(0x80090352L) +#define SEC_E_REVOCATION_OFFLINE_C _HRESULT_TYPEDEF_(0x80090353L) +#define SEC_E_PKINIT_CLIENT_FAILURE _HRESULT_TYPEDEF_(0x80090354L) +#define SEC_E_SMARTCARD_CERT_EXPIRED _HRESULT_TYPEDEF_(0x80090355L) +#define SEC_E_NO_S4U_PROT_SUPPORT _HRESULT_TYPEDEF_(0x80090356L) +#define SEC_E_CROSSREALM_DELEGATION_FAILURE _HRESULT_TYPEDEF_(0x80090357L) +#define SEC_E_REVOCATION_OFFLINE_KDC _HRESULT_TYPEDEF_(0x80090358L) +#define SEC_E_ISSUING_CA_UNTRUSTED_KDC _HRESULT_TYPEDEF_(0x80090359L) +#define SEC_E_KDC_CERT_EXPIRED _HRESULT_TYPEDEF_(0x8009035AL) +#define SEC_E_KDC_CERT_REVOKED _HRESULT_TYPEDEF_(0x8009035BL) +#define SEC_E_NO_SPM SEC_E_INTERNAL_ERROR +#define SEC_E_NOT_SUPPORTED SEC_E_UNSUPPORTED_FUNCTION +#define CRYPT_E_MSG_ERROR _HRESULT_TYPEDEF_(0x80091001L) +#define CRYPT_E_UNKNOWN_ALGO _HRESULT_TYPEDEF_(0x80091002L) +#define CRYPT_E_OID_FORMAT _HRESULT_TYPEDEF_(0x80091003L) +#define CRYPT_E_INVALID_MSG_TYPE _HRESULT_TYPEDEF_(0x80091004L) +#define CRYPT_E_UNEXPECTED_ENCODING _HRESULT_TYPEDEF_(0x80091005L) +#define CRYPT_E_AUTH_ATTR_MISSING _HRESULT_TYPEDEF_(0x80091006L) +#define CRYPT_E_HASH_VALUE _HRESULT_TYPEDEF_(0x80091007L) +#define CRYPT_E_INVALID_INDEX _HRESULT_TYPEDEF_(0x80091008L) +#define CRYPT_E_ALREADY_DECRYPTED _HRESULT_TYPEDEF_(0x80091009L) +#define CRYPT_E_NOT_DECRYPTED _HRESULT_TYPEDEF_(0x8009100AL) +#define CRYPT_E_RECIPIENT_NOT_FOUND _HRESULT_TYPEDEF_(0x8009100BL) +#define CRYPT_E_CONTROL_TYPE _HRESULT_TYPEDEF_(0x8009100CL) +#define CRYPT_E_ISSUER_SERIALNUMBER _HRESULT_TYPEDEF_(0x8009100DL) +#define CRYPT_E_SIGNER_NOT_FOUND _HRESULT_TYPEDEF_(0x8009100EL) +#define CRYPT_E_ATTRIBUTES_MISSING _HRESULT_TYPEDEF_(0x8009100FL) +#define CRYPT_E_STREAM_MSG_NOT_READY _HRESULT_TYPEDEF_(0x80091010L) +#define CRYPT_E_STREAM_INSUFFICIENT_DATA _HRESULT_TYPEDEF_(0x80091011L) +#define CRYPT_I_NEW_PROTECTION_REQUIRED _HRESULT_TYPEDEF_(0x00091012L) +#define CRYPT_E_BAD_LEN _HRESULT_TYPEDEF_(0x80092001L) +#define CRYPT_E_BAD_ENCODE _HRESULT_TYPEDEF_(0x80092002L) +#define CRYPT_E_FILE_ERROR _HRESULT_TYPEDEF_(0x80092003L) +#define CRYPT_E_NOT_FOUND _HRESULT_TYPEDEF_(0x80092004L) +#define CRYPT_E_EXISTS _HRESULT_TYPEDEF_(0x80092005L) +#define CRYPT_E_NO_PROVIDER _HRESULT_TYPEDEF_(0x80092006L) +#define CRYPT_E_SELF_SIGNED _HRESULT_TYPEDEF_(0x80092007L) +#define CRYPT_E_DELETED_PREV _HRESULT_TYPEDEF_(0x80092008L) +#define CRYPT_E_NO_MATCH _HRESULT_TYPEDEF_(0x80092009L) +#define CRYPT_E_UNEXPECTED_MSG_TYPE _HRESULT_TYPEDEF_(0x8009200AL) +#define CRYPT_E_NO_KEY_PROPERTY _HRESULT_TYPEDEF_(0x8009200BL) +#define CRYPT_E_NO_DECRYPT_CERT _HRESULT_TYPEDEF_(0x8009200CL) +#define CRYPT_E_BAD_MSG _HRESULT_TYPEDEF_(0x8009200DL) +#define CRYPT_E_NO_SIGNER _HRESULT_TYPEDEF_(0x8009200EL) +#define CRYPT_E_PENDING_CLOSE _HRESULT_TYPEDEF_(0x8009200FL) +#define CRYPT_E_REVOKED _HRESULT_TYPEDEF_(0x80092010L) +#define CRYPT_E_NO_REVOCATION_DLL _HRESULT_TYPEDEF_(0x80092011L) +#define CRYPT_E_NO_REVOCATION_CHECK _HRESULT_TYPEDEF_(0x80092012L) +#define CRYPT_E_REVOCATION_OFFLINE _HRESULT_TYPEDEF_(0x80092013L) +#define CRYPT_E_NOT_IN_REVOCATION_DATABASE _HRESULT_TYPEDEF_(0x80092014L) +#define CRYPT_E_INVALID_NUMERIC_STRING _HRESULT_TYPEDEF_(0x80092020L) +#define CRYPT_E_INVALID_PRINTABLE_STRING _HRESULT_TYPEDEF_(0x80092021L) +#define CRYPT_E_INVALID_IA5_STRING _HRESULT_TYPEDEF_(0x80092022L) +#define CRYPT_E_INVALID_X500_STRING _HRESULT_TYPEDEF_(0x80092023L) +#define CRYPT_E_NOT_CHAR_STRING _HRESULT_TYPEDEF_(0x80092024L) +#define CRYPT_E_FILERESIZED _HRESULT_TYPEDEF_(0x80092025L) +#define CRYPT_E_SECURITY_SETTINGS _HRESULT_TYPEDEF_(0x80092026L) +#define CRYPT_E_NO_VERIFY_USAGE_DLL _HRESULT_TYPEDEF_(0x80092027L) +#define CRYPT_E_NO_VERIFY_USAGE_CHECK _HRESULT_TYPEDEF_(0x80092028L) +#define CRYPT_E_VERIFY_USAGE_OFFLINE _HRESULT_TYPEDEF_(0x80092029L) +#define CRYPT_E_NOT_IN_CTL _HRESULT_TYPEDEF_(0x8009202AL) +#define CRYPT_E_NO_TRUSTED_SIGNER _HRESULT_TYPEDEF_(0x8009202BL) +#define CRYPT_E_MISSING_PUBKEY_PARA _HRESULT_TYPEDEF_(0x8009202CL) +#define CRYPT_E_OSS_ERROR _HRESULT_TYPEDEF_(0x80093000L) +#define OSS_MORE_BUF _HRESULT_TYPEDEF_(0x80093001L) +#define OSS_NEGATIVE_UINTEGER _HRESULT_TYPEDEF_(0x80093002L) +#define OSS_PDU_RANGE _HRESULT_TYPEDEF_(0x80093003L) +#define OSS_MORE_INPUT _HRESULT_TYPEDEF_(0x80093004L) +#define OSS_DATA_ERROR _HRESULT_TYPEDEF_(0x80093005L) +#define OSS_BAD_ARG _HRESULT_TYPEDEF_(0x80093006L) +#define OSS_BAD_VERSION _HRESULT_TYPEDEF_(0x80093007L) +#define OSS_OUT_MEMORY _HRESULT_TYPEDEF_(0x80093008L) +#define OSS_PDU_MISMATCH _HRESULT_TYPEDEF_(0x80093009L) +#define OSS_LIMITED _HRESULT_TYPEDEF_(0x8009300AL) +#define OSS_BAD_PTR _HRESULT_TYPEDEF_(0x8009300BL) +#define OSS_BAD_TIME _HRESULT_TYPEDEF_(0x8009300CL) +#define OSS_INDEFINITE_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009300DL) +#define OSS_MEM_ERROR _HRESULT_TYPEDEF_(0x8009300EL) +#define OSS_BAD_TABLE _HRESULT_TYPEDEF_(0x8009300FL) +#define OSS_TOO_LONG _HRESULT_TYPEDEF_(0x80093010L) +#define OSS_CONSTRAINT_VIOLATED _HRESULT_TYPEDEF_(0x80093011L) +#define OSS_FATAL_ERROR _HRESULT_TYPEDEF_(0x80093012L) +#define OSS_ACCESS_SERIALIZATION_ERROR _HRESULT_TYPEDEF_(0x80093013L) +#define OSS_NULL_TBL _HRESULT_TYPEDEF_(0x80093014L) +#define OSS_NULL_FCN _HRESULT_TYPEDEF_(0x80093015L) +#define OSS_BAD_ENCRULES _HRESULT_TYPEDEF_(0x80093016L) +#define OSS_UNAVAIL_ENCRULES _HRESULT_TYPEDEF_(0x80093017L) +#define OSS_CANT_OPEN_TRACE_WINDOW _HRESULT_TYPEDEF_(0x80093018L) +#define OSS_UNIMPLEMENTED _HRESULT_TYPEDEF_(0x80093019L) +#define OSS_OID_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009301AL) +#define OSS_CANT_OPEN_TRACE_FILE _HRESULT_TYPEDEF_(0x8009301BL) +#define OSS_TRACE_FILE_ALREADY_OPEN _HRESULT_TYPEDEF_(0x8009301CL) +#define OSS_TABLE_MISMATCH _HRESULT_TYPEDEF_(0x8009301DL) +#define OSS_TYPE_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009301EL) +#define OSS_REAL_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009301FL) +#define OSS_REAL_CODE_NOT_LINKED _HRESULT_TYPEDEF_(0x80093020L) +#define OSS_OUT_OF_RANGE _HRESULT_TYPEDEF_(0x80093021L) +#define OSS_COPIER_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093022L) +#define OSS_CONSTRAINT_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093023L) +#define OSS_COMPARATOR_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093024L) +#define OSS_COMPARATOR_CODE_NOT_LINKED _HRESULT_TYPEDEF_(0x80093025L) +#define OSS_MEM_MGR_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093026L) +#define OSS_PDV_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093027L) +#define OSS_PDV_CODE_NOT_LINKED _HRESULT_TYPEDEF_(0x80093028L) +#define OSS_API_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093029L) +#define OSS_BERDER_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009302AL) +#define OSS_PER_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009302BL) +#define OSS_OPEN_TYPE_ERROR _HRESULT_TYPEDEF_(0x8009302CL) +#define OSS_MUTEX_NOT_CREATED _HRESULT_TYPEDEF_(0x8009302DL) +#define OSS_CANT_CLOSE_TRACE_FILE _HRESULT_TYPEDEF_(0x8009302EL) +#define CRYPT_E_ASN1_ERROR _HRESULT_TYPEDEF_(0x80093100L) +#define CRYPT_E_ASN1_INTERNAL _HRESULT_TYPEDEF_(0x80093101L) +#define CRYPT_E_ASN1_EOD _HRESULT_TYPEDEF_(0x80093102L) +#define CRYPT_E_ASN1_CORRUPT _HRESULT_TYPEDEF_(0x80093103L) +#define CRYPT_E_ASN1_LARGE _HRESULT_TYPEDEF_(0x80093104L) +#define CRYPT_E_ASN1_CONSTRAINT _HRESULT_TYPEDEF_(0x80093105L) +#define CRYPT_E_ASN1_MEMORY _HRESULT_TYPEDEF_(0x80093106L) +#define CRYPT_E_ASN1_OVERFLOW _HRESULT_TYPEDEF_(0x80093107L) +#define CRYPT_E_ASN1_BADPDU _HRESULT_TYPEDEF_(0x80093108L) +#define CRYPT_E_ASN1_BADARGS _HRESULT_TYPEDEF_(0x80093109L) +#define CRYPT_E_ASN1_BADREAL _HRESULT_TYPEDEF_(0x8009310AL) +#define CRYPT_E_ASN1_BADTAG _HRESULT_TYPEDEF_(0x8009310BL) +#define CRYPT_E_ASN1_CHOICE _HRESULT_TYPEDEF_(0x8009310CL) +#define CRYPT_E_ASN1_RULE _HRESULT_TYPEDEF_(0x8009310DL) +#define CRYPT_E_ASN1_UTF8 _HRESULT_TYPEDEF_(0x8009310EL) +#define CRYPT_E_ASN1_PDU_TYPE _HRESULT_TYPEDEF_(0x80093133L) +#define CRYPT_E_ASN1_NYI _HRESULT_TYPEDEF_(0x80093134L) +#define CRYPT_E_ASN1_EXTENDED _HRESULT_TYPEDEF_(0x80093201L) +#define CRYPT_E_ASN1_NOEOD _HRESULT_TYPEDEF_(0x80093202L) +#define CERTSRV_E_BAD_REQUESTSUBJECT _HRESULT_TYPEDEF_(0x80094001L) +#define CERTSRV_E_NO_REQUEST _HRESULT_TYPEDEF_(0x80094002L) +#define CERTSRV_E_BAD_REQUESTSTATUS _HRESULT_TYPEDEF_(0x80094003L) +#define CERTSRV_E_PROPERTY_EMPTY _HRESULT_TYPEDEF_(0x80094004L) +#define CERTSRV_E_INVALID_CA_CERTIFICATE _HRESULT_TYPEDEF_(0x80094005L) +#define CERTSRV_E_SERVER_SUSPENDED _HRESULT_TYPEDEF_(0x80094006L) +#define CERTSRV_E_ENCODING_LENGTH _HRESULT_TYPEDEF_(0x80094007L) +#define CERTSRV_E_ROLECONFLICT _HRESULT_TYPEDEF_(0x80094008L) +#define CERTSRV_E_RESTRICTEDOFFICER _HRESULT_TYPEDEF_(0x80094009L) +#define CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED _HRESULT_TYPEDEF_(0x8009400AL) +#define CERTSRV_E_NO_VALID_KRA _HRESULT_TYPEDEF_(0x8009400BL) +#define CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL _HRESULT_TYPEDEF_(0x8009400CL) +#define CERTSRV_E_NO_CAADMIN_DEFINED _HRESULT_TYPEDEF_(0x8009400DL) +#define CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE _HRESULT_TYPEDEF_(0x8009400EL) +#define CERTSRV_E_NO_DB_SESSIONS _HRESULT_TYPEDEF_(0x8009400FL) +#define CERTSRV_E_ALIGNMENT_FAULT _HRESULT_TYPEDEF_(0x80094010L) +#define CERTSRV_E_ENROLL_DENIED _HRESULT_TYPEDEF_(0x80094011L) +#define CERTSRV_E_TEMPLATE_DENIED _HRESULT_TYPEDEF_(0x80094012L) +#define CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE _HRESULT_TYPEDEF_(0x80094013L) +#define CERTSRV_E_UNSUPPORTED_CERT_TYPE _HRESULT_TYPEDEF_(0x80094800L) +#define CERTSRV_E_NO_CERT_TYPE _HRESULT_TYPEDEF_(0x80094801L) +#define CERTSRV_E_TEMPLATE_CONFLICT _HRESULT_TYPEDEF_(0x80094802L) +#define CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED _HRESULT_TYPEDEF_(0x80094803L) +#define CERTSRV_E_ARCHIVED_KEY_REQUIRED _HRESULT_TYPEDEF_(0x80094804L) +#define CERTSRV_E_SMIME_REQUIRED _HRESULT_TYPEDEF_(0x80094805L) +#define CERTSRV_E_BAD_RENEWAL_SUBJECT _HRESULT_TYPEDEF_(0x80094806L) +#define CERTSRV_E_BAD_TEMPLATE_VERSION _HRESULT_TYPEDEF_(0x80094807L) +#define CERTSRV_E_TEMPLATE_POLICY_REQUIRED _HRESULT_TYPEDEF_(0x80094808L) +#define CERTSRV_E_SIGNATURE_POLICY_REQUIRED _HRESULT_TYPEDEF_(0x80094809L) +#define CERTSRV_E_SIGNATURE_COUNT _HRESULT_TYPEDEF_(0x8009480AL) +#define CERTSRV_E_SIGNATURE_REJECTED _HRESULT_TYPEDEF_(0x8009480BL) +#define CERTSRV_E_ISSUANCE_POLICY_REQUIRED _HRESULT_TYPEDEF_(0x8009480CL) +#define CERTSRV_E_SUBJECT_UPN_REQUIRED _HRESULT_TYPEDEF_(0x8009480DL) +#define CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED _HRESULT_TYPEDEF_(0x8009480EL) +#define CERTSRV_E_SUBJECT_DNS_REQUIRED _HRESULT_TYPEDEF_(0x8009480FL) +#define CERTSRV_E_ARCHIVED_KEY_UNEXPECTED _HRESULT_TYPEDEF_(0x80094810L) +#define CERTSRV_E_KEY_LENGTH _HRESULT_TYPEDEF_(0x80094811L) +#define CERTSRV_E_SUBJECT_EMAIL_REQUIRED _HRESULT_TYPEDEF_(0x80094812L) +#define CERTSRV_E_UNKNOWN_CERT_TYPE _HRESULT_TYPEDEF_(0x80094813L) +#define CERTSRV_E_CERT_TYPE_OVERLAP _HRESULT_TYPEDEF_(0x80094814L) +#define XENROLL_E_KEY_NOT_EXPORTABLE _HRESULT_TYPEDEF_(0x80095000L) +#define XENROLL_E_CANNOT_ADD_ROOT_CERT _HRESULT_TYPEDEF_(0x80095001L) +#define XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND _HRESULT_TYPEDEF_(0x80095002L) +#define XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH _HRESULT_TYPEDEF_(0x80095003L) +#define XENROLL_E_RESPONSE_KA_HASH_MISMATCH _HRESULT_TYPEDEF_(0x80095004L) +#define XENROLL_E_KEYSPEC_SMIME_MISMATCH _HRESULT_TYPEDEF_(0x80095005L) +#define TRUST_E_SYSTEM_ERROR _HRESULT_TYPEDEF_(0x80096001L) +#define TRUST_E_NO_SIGNER_CERT _HRESULT_TYPEDEF_(0x80096002L) +#define TRUST_E_COUNTER_SIGNER _HRESULT_TYPEDEF_(0x80096003L) +#define TRUST_E_CERT_SIGNATURE _HRESULT_TYPEDEF_(0x80096004L) +#define TRUST_E_TIME_STAMP _HRESULT_TYPEDEF_(0x80096005L) +#define TRUST_E_BAD_DIGEST _HRESULT_TYPEDEF_(0x80096010L) +#define TRUST_E_BASIC_CONSTRAINTS _HRESULT_TYPEDEF_(0x80096019L) +#define TRUST_E_FINANCIAL_CRITERIA _HRESULT_TYPEDEF_(0x8009601EL) +#define MSSIPOTF_E_OUTOFMEMRANGE _HRESULT_TYPEDEF_(0x80097001L) +#define MSSIPOTF_E_CANTGETOBJECT _HRESULT_TYPEDEF_(0x80097002L) +#define MSSIPOTF_E_NOHEADTABLE _HRESULT_TYPEDEF_(0x80097003L) +#define MSSIPOTF_E_BAD_MAGICNUMBER _HRESULT_TYPEDEF_(0x80097004L) +#define MSSIPOTF_E_BAD_OFFSET_TABLE _HRESULT_TYPEDEF_(0x80097005L) +#define MSSIPOTF_E_TABLE_TAGORDER _HRESULT_TYPEDEF_(0x80097006L) +#define MSSIPOTF_E_TABLE_LONGWORD _HRESULT_TYPEDEF_(0x80097007L) +#define MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT _HRESULT_TYPEDEF_(0x80097008L) +#define MSSIPOTF_E_TABLES_OVERLAP _HRESULT_TYPEDEF_(0x80097009L) +#define MSSIPOTF_E_TABLE_PADBYTES _HRESULT_TYPEDEF_(0x8009700AL) +#define MSSIPOTF_E_FILETOOSMALL _HRESULT_TYPEDEF_(0x8009700BL) +#define MSSIPOTF_E_TABLE_CHECKSUM _HRESULT_TYPEDEF_(0x8009700CL) +#define MSSIPOTF_E_FILE_CHECKSUM _HRESULT_TYPEDEF_(0x8009700DL) +#define MSSIPOTF_E_FAILED_POLICY _HRESULT_TYPEDEF_(0x80097010L) +#define MSSIPOTF_E_FAILED_HINTS_CHECK _HRESULT_TYPEDEF_(0x80097011L) +#define MSSIPOTF_E_NOT_OPENTYPE _HRESULT_TYPEDEF_(0x80097012L) +#define MSSIPOTF_E_FILE _HRESULT_TYPEDEF_(0x80097013L) +#define MSSIPOTF_E_CRYPT _HRESULT_TYPEDEF_(0x80097014L) +#define MSSIPOTF_E_BADVERSION _HRESULT_TYPEDEF_(0x80097015L) +#define MSSIPOTF_E_DSIG_STRUCTURE _HRESULT_TYPEDEF_(0x80097016L) +#define MSSIPOTF_E_PCONST_CHECK _HRESULT_TYPEDEF_(0x80097017L) +#define MSSIPOTF_E_STRUCTURE _HRESULT_TYPEDEF_(0x80097018L) +#define NTE_OP_OK 0 +#define TRUST_E_PROVIDER_UNKNOWN _HRESULT_TYPEDEF_(0x800B0001L) +#define TRUST_E_ACTION_UNKNOWN _HRESULT_TYPEDEF_(0x800B0002L) +#define TRUST_E_SUBJECT_FORM_UNKNOWN _HRESULT_TYPEDEF_(0x800B0003L) +#define TRUST_E_SUBJECT_NOT_TRUSTED _HRESULT_TYPEDEF_(0x800B0004L) +#define DIGSIG_E_ENCODE _HRESULT_TYPEDEF_(0x800B0005L) +#define DIGSIG_E_DECODE _HRESULT_TYPEDEF_(0x800B0006L) +#define DIGSIG_E_EXTENSIBILITY _HRESULT_TYPEDEF_(0x800B0007L) +#define DIGSIG_E_CRYPTO _HRESULT_TYPEDEF_(0x800B0008L) +#define PERSIST_E_SIZEDEFINITE _HRESULT_TYPEDEF_(0x800B0009L) +#define PERSIST_E_SIZEINDEFINITE _HRESULT_TYPEDEF_(0x800B000AL) +#define PERSIST_E_NOTSELFSIZING _HRESULT_TYPEDEF_(0x800B000BL) +#define TRUST_E_NOSIGNATURE _HRESULT_TYPEDEF_(0x800B0100L) +#define CERT_E_EXPIRED _HRESULT_TYPEDEF_(0x800B0101L) +#define CERT_E_VALIDITYPERIODNESTING _HRESULT_TYPEDEF_(0x800B0102L) +#define CERT_E_ROLE _HRESULT_TYPEDEF_(0x800B0103L) +#define CERT_E_PATHLENCONST _HRESULT_TYPEDEF_(0x800B0104L) +#define CERT_E_CRITICAL _HRESULT_TYPEDEF_(0x800B0105L) +#define CERT_E_PURPOSE _HRESULT_TYPEDEF_(0x800B0106L) +#define CERT_E_ISSUERCHAINING _HRESULT_TYPEDEF_(0x800B0107L) +#define CERT_E_MALFORMED _HRESULT_TYPEDEF_(0x800B0108L) +#define CERT_E_UNTRUSTEDROOT _HRESULT_TYPEDEF_(0x800B0109L) +#define CERT_E_CHAINING _HRESULT_TYPEDEF_(0x800B010AL) +#define TRUST_E_FAIL _HRESULT_TYPEDEF_(0x800B010BL) +#define CERT_E_REVOKED _HRESULT_TYPEDEF_(0x800B010CL) +#define CERT_E_UNTRUSTEDTESTROOT _HRESULT_TYPEDEF_(0x800B010DL) +#define CERT_E_REVOCATION_FAILURE _HRESULT_TYPEDEF_(0x800B010EL) +#define CERT_E_CN_NO_MATCH _HRESULT_TYPEDEF_(0x800B010FL) +#define CERT_E_WRONG_USAGE _HRESULT_TYPEDEF_(0x800B0110L) +#define TRUST_E_EXPLICIT_DISTRUST _HRESULT_TYPEDEF_(0x800B0111L) +#define CERT_E_UNTRUSTEDCA _HRESULT_TYPEDEF_(0x800B0112L) +#define CERT_E_INVALID_POLICY _HRESULT_TYPEDEF_(0x800B0113L) +#define CERT_E_INVALID_NAME _HRESULT_TYPEDEF_(0x800B0114L) +#define HRESULT_FROM_SETUPAPI(x) ((((x) & (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR))==(APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR)) ? ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_SETUPAPI << 16) | 0x80000000)) : HRESULT_FROM_WIN32(x)) +#define SPAPI_E_EXPECTED_SECTION_NAME _HRESULT_TYPEDEF_(0x800F0000L) +#define SPAPI_E_BAD_SECTION_NAME_LINE _HRESULT_TYPEDEF_(0x800F0001L) +#define SPAPI_E_SECTION_NAME_TOO_LONG _HRESULT_TYPEDEF_(0x800F0002L) +#define SPAPI_E_GENERAL_SYNTAX _HRESULT_TYPEDEF_(0x800F0003L) +#define SPAPI_E_WRONG_INF_STYLE _HRESULT_TYPEDEF_(0x800F0100L) +#define SPAPI_E_SECTION_NOT_FOUND _HRESULT_TYPEDEF_(0x800F0101L) +#define SPAPI_E_LINE_NOT_FOUND _HRESULT_TYPEDEF_(0x800F0102L) +#define SPAPI_E_NO_BACKUP _HRESULT_TYPEDEF_(0x800F0103L) +#define SPAPI_E_NO_ASSOCIATED_CLASS _HRESULT_TYPEDEF_(0x800F0200L) +#define SPAPI_E_CLASS_MISMATCH _HRESULT_TYPEDEF_(0x800F0201L) +#define SPAPI_E_DUPLICATE_FOUND _HRESULT_TYPEDEF_(0x800F0202L) +#define SPAPI_E_NO_DRIVER_SELECTED _HRESULT_TYPEDEF_(0x800F0203L) +#define SPAPI_E_KEY_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x800F0204L) +#define SPAPI_E_INVALID_DEVINST_NAME _HRESULT_TYPEDEF_(0x800F0205L) +#define SPAPI_E_INVALID_CLASS _HRESULT_TYPEDEF_(0x800F0206L) +#define SPAPI_E_DEVINST_ALREADY_EXISTS _HRESULT_TYPEDEF_(0x800F0207L) +#define SPAPI_E_DEVINFO_NOT_REGISTERED _HRESULT_TYPEDEF_(0x800F0208L) +#define SPAPI_E_INVALID_REG_PROPERTY _HRESULT_TYPEDEF_(0x800F0209L) +#define SPAPI_E_NO_INF _HRESULT_TYPEDEF_(0x800F020AL) +#define SPAPI_E_NO_SUCH_DEVINST _HRESULT_TYPEDEF_(0x800F020BL) +#define SPAPI_E_CANT_LOAD_CLASS_ICON _HRESULT_TYPEDEF_(0x800F020CL) +#define SPAPI_E_INVALID_CLASS_INSTALLER _HRESULT_TYPEDEF_(0x800F020DL) +#define SPAPI_E_DI_DO_DEFAULT _HRESULT_TYPEDEF_(0x800F020EL) +#define SPAPI_E_DI_NOFILECOPY _HRESULT_TYPEDEF_(0x800F020FL) +#define SPAPI_E_INVALID_HWPROFILE _HRESULT_TYPEDEF_(0x800F0210L) +#define SPAPI_E_NO_DEVICE_SELECTED _HRESULT_TYPEDEF_(0x800F0211L) +#define SPAPI_E_DEVINFO_LIST_LOCKED _HRESULT_TYPEDEF_(0x800F0212L) +#define SPAPI_E_DEVINFO_DATA_LOCKED _HRESULT_TYPEDEF_(0x800F0213L) +#define SPAPI_E_DI_BAD_PATH _HRESULT_TYPEDEF_(0x800F0214L) +#define SPAPI_E_NO_CLASSINSTALL_PARAMS _HRESULT_TYPEDEF_(0x800F0215L) +#define SPAPI_E_FILEQUEUE_LOCKED _HRESULT_TYPEDEF_(0x800F0216L) +#define SPAPI_E_BAD_SERVICE_INSTALLSECT _HRESULT_TYPEDEF_(0x800F0217L) +#define SPAPI_E_NO_CLASS_DRIVER_LIST _HRESULT_TYPEDEF_(0x800F0218L) +#define SPAPI_E_NO_ASSOCIATED_SERVICE _HRESULT_TYPEDEF_(0x800F0219L) +#define SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE _HRESULT_TYPEDEF_(0x800F021AL) +#define SPAPI_E_DEVICE_INTERFACE_ACTIVE _HRESULT_TYPEDEF_(0x800F021BL) +#define SPAPI_E_DEVICE_INTERFACE_REMOVED _HRESULT_TYPEDEF_(0x800F021CL) +#define SPAPI_E_BAD_INTERFACE_INSTALLSECT _HRESULT_TYPEDEF_(0x800F021DL) +#define SPAPI_E_NO_SUCH_INTERFACE_CLASS _HRESULT_TYPEDEF_(0x800F021EL) +#define SPAPI_E_INVALID_REFERENCE_STRING _HRESULT_TYPEDEF_(0x800F021FL) +#define SPAPI_E_INVALID_MACHINENAME _HRESULT_TYPEDEF_(0x800F0220L) +#define SPAPI_E_REMOTE_COMM_FAILURE _HRESULT_TYPEDEF_(0x800F0221L) +#define SPAPI_E_MACHINE_UNAVAILABLE _HRESULT_TYPEDEF_(0x800F0222L) +#define SPAPI_E_NO_CONFIGMGR_SERVICES _HRESULT_TYPEDEF_(0x800F0223L) +#define SPAPI_E_INVALID_PROPPAGE_PROVIDER _HRESULT_TYPEDEF_(0x800F0224L) +#define SPAPI_E_NO_SUCH_DEVICE_INTERFACE _HRESULT_TYPEDEF_(0x800F0225L) +#define SPAPI_E_DI_POSTPROCESSING_REQUIRED _HRESULT_TYPEDEF_(0x800F0226L) +#define SPAPI_E_INVALID_COINSTALLER _HRESULT_TYPEDEF_(0x800F0227L) +#define SPAPI_E_NO_COMPAT_DRIVERS _HRESULT_TYPEDEF_(0x800F0228L) +#define SPAPI_E_NO_DEVICE_ICON _HRESULT_TYPEDEF_(0x800F0229L) +#define SPAPI_E_INVALID_INF_LOGCONFIG _HRESULT_TYPEDEF_(0x800F022AL) +#define SPAPI_E_DI_DONT_INSTALL _HRESULT_TYPEDEF_(0x800F022BL) +#define SPAPI_E_INVALID_FILTER_DRIVER _HRESULT_TYPEDEF_(0x800F022CL) +#define SPAPI_E_NON_WINDOWS_NT_DRIVER _HRESULT_TYPEDEF_(0x800F022DL) +#define SPAPI_E_NON_WINDOWS_DRIVER _HRESULT_TYPEDEF_(0x800F022EL) +#define SPAPI_E_NO_CATALOG_FOR_OEM_INF _HRESULT_TYPEDEF_(0x800F022FL) +#define SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE _HRESULT_TYPEDEF_(0x800F0230L) +#define SPAPI_E_NOT_DISABLEABLE _HRESULT_TYPEDEF_(0x800F0231L) +#define SPAPI_E_CANT_REMOVE_DEVINST _HRESULT_TYPEDEF_(0x800F0232L) +#define SPAPI_E_INVALID_TARGET _HRESULT_TYPEDEF_(0x800F0233L) +#define SPAPI_E_DRIVER_NONNATIVE _HRESULT_TYPEDEF_(0x800F0234L) +#define SPAPI_E_IN_WOW64 _HRESULT_TYPEDEF_(0x800F0235L) +#define SPAPI_E_SET_SYSTEM_RESTORE_POINT _HRESULT_TYPEDEF_(0x800F0236L) +#define SPAPI_E_INCORRECTLY_COPIED_INF _HRESULT_TYPEDEF_(0x800F0237L) +#define SPAPI_E_SCE_DISABLED _HRESULT_TYPEDEF_(0x800F0238L) +#define SPAPI_E_UNKNOWN_EXCEPTION _HRESULT_TYPEDEF_(0x800F0239L) +#define SPAPI_E_PNP_REGISTRY_ERROR _HRESULT_TYPEDEF_(0x800F023AL) +#define SPAPI_E_REMOTE_REQUEST_UNSUPPORTED _HRESULT_TYPEDEF_(0x800F023BL) +#define SPAPI_E_NOT_AN_INSTALLED_OEM_INF _HRESULT_TYPEDEF_(0x800F023CL) +#define SPAPI_E_INF_IN_USE_BY_DEVICES _HRESULT_TYPEDEF_(0x800F023DL) +#define SPAPI_E_DI_FUNCTION_OBSOLETE _HRESULT_TYPEDEF_(0x800F023EL) +#define SPAPI_E_NO_AUTHENTICODE_CATALOG _HRESULT_TYPEDEF_(0x800F023FL) +#define SPAPI_E_AUTHENTICODE_DISALLOWED _HRESULT_TYPEDEF_(0x800F0240L) +#define SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER _HRESULT_TYPEDEF_(0x800F0241L) +#define SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED _HRESULT_TYPEDEF_(0x800F0242L) +#define SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED _HRESULT_TYPEDEF_(0x800F0243L) +#define SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH _HRESULT_TYPEDEF_(0x800F0244L) +#define SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE _HRESULT_TYPEDEF_(0x800F0245L) +#define SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW _HRESULT_TYPEDEF_(0x800F0300L) +#define SPAPI_E_ERROR_NOT_INSTALLED _HRESULT_TYPEDEF_(0x800F1000L) +#define SCARD_S_SUCCESS NO_ERROR +#define SCARD_F_INTERNAL_ERROR _HRESULT_TYPEDEF_(0x80100001L) +#define SCARD_E_CANCELLED _HRESULT_TYPEDEF_(0x80100002L) +#define SCARD_E_INVALID_HANDLE _HRESULT_TYPEDEF_(0x80100003L) +#define SCARD_E_INVALID_PARAMETER _HRESULT_TYPEDEF_(0x80100004L) +#define SCARD_E_INVALID_TARGET _HRESULT_TYPEDEF_(0x80100005L) +#define SCARD_E_NO_MEMORY _HRESULT_TYPEDEF_(0x80100006L) +#define SCARD_F_WAITED_TOO_LONG _HRESULT_TYPEDEF_(0x80100007L) +#define SCARD_E_INSUFFICIENT_BUFFER _HRESULT_TYPEDEF_(0x80100008L) +#define SCARD_E_UNKNOWN_READER _HRESULT_TYPEDEF_(0x80100009L) +#define SCARD_E_TIMEOUT _HRESULT_TYPEDEF_(0x8010000AL) +#define SCARD_E_SHARING_VIOLATION _HRESULT_TYPEDEF_(0x8010000BL) +#define SCARD_E_NO_SMARTCARD _HRESULT_TYPEDEF_(0x8010000CL) +#define SCARD_E_UNKNOWN_CARD _HRESULT_TYPEDEF_(0x8010000DL) +#define SCARD_E_CANT_DISPOSE _HRESULT_TYPEDEF_(0x8010000EL) +#define SCARD_E_PROTO_MISMATCH _HRESULT_TYPEDEF_(0x8010000FL) +#define SCARD_E_NOT_READY _HRESULT_TYPEDEF_(0x80100010L) +#define SCARD_E_INVALID_VALUE _HRESULT_TYPEDEF_(0x80100011L) +#define SCARD_E_SYSTEM_CANCELLED _HRESULT_TYPEDEF_(0x80100012L) +#define SCARD_F_COMM_ERROR _HRESULT_TYPEDEF_(0x80100013L) +#define SCARD_F_UNKNOWN_ERROR _HRESULT_TYPEDEF_(0x80100014L) +#define SCARD_E_INVALID_ATR _HRESULT_TYPEDEF_(0x80100015L) +#define SCARD_E_NOT_TRANSACTED _HRESULT_TYPEDEF_(0x80100016L) +#define SCARD_E_READER_UNAVAILABLE _HRESULT_TYPEDEF_(0x80100017L) +#define SCARD_P_SHUTDOWN _HRESULT_TYPEDEF_(0x80100018L) +#define SCARD_E_PCI_TOO_SMALL _HRESULT_TYPEDEF_(0x80100019L) +#define SCARD_E_READER_UNSUPPORTED _HRESULT_TYPEDEF_(0x8010001AL) +#define SCARD_E_DUPLICATE_READER _HRESULT_TYPEDEF_(0x8010001BL) +#define SCARD_E_CARD_UNSUPPORTED _HRESULT_TYPEDEF_(0x8010001CL) +#define SCARD_E_NO_SERVICE _HRESULT_TYPEDEF_(0x8010001DL) +#define SCARD_E_SERVICE_STOPPED _HRESULT_TYPEDEF_(0x8010001EL) +#define SCARD_E_UNEXPECTED _HRESULT_TYPEDEF_(0x8010001FL) +#define SCARD_E_ICC_INSTALLATION _HRESULT_TYPEDEF_(0x80100020L) +#define SCARD_E_ICC_CREATEORDER _HRESULT_TYPEDEF_(0x80100021L) +#define SCARD_E_UNSUPPORTED_FEATURE _HRESULT_TYPEDEF_(0x80100022L) +#define SCARD_E_DIR_NOT_FOUND _HRESULT_TYPEDEF_(0x80100023L) +#define SCARD_E_FILE_NOT_FOUND _HRESULT_TYPEDEF_(0x80100024L) +#define SCARD_E_NO_DIR _HRESULT_TYPEDEF_(0x80100025L) +#define SCARD_E_NO_FILE _HRESULT_TYPEDEF_(0x80100026L) +#define SCARD_E_NO_ACCESS _HRESULT_TYPEDEF_(0x80100027L) +#define SCARD_E_WRITE_TOO_MANY _HRESULT_TYPEDEF_(0x80100028L) +#define SCARD_E_BAD_SEEK _HRESULT_TYPEDEF_(0x80100029L) +#define SCARD_E_INVALID_CHV _HRESULT_TYPEDEF_(0x8010002AL) +#define SCARD_E_UNKNOWN_RES_MNG _HRESULT_TYPEDEF_(0x8010002BL) +#define SCARD_E_NO_SUCH_CERTIFICATE _HRESULT_TYPEDEF_(0x8010002CL) +#define SCARD_E_CERTIFICATE_UNAVAILABLE _HRESULT_TYPEDEF_(0x8010002DL) +#define SCARD_E_NO_READERS_AVAILABLE _HRESULT_TYPEDEF_(0x8010002EL) +#define SCARD_E_COMM_DATA_LOST _HRESULT_TYPEDEF_(0x8010002FL) +#define SCARD_E_NO_KEY_CONTAINER _HRESULT_TYPEDEF_(0x80100030L) +#define SCARD_E_SERVER_TOO_BUSY _HRESULT_TYPEDEF_(0x80100031L) +#define SCARD_W_UNSUPPORTED_CARD _HRESULT_TYPEDEF_(0x80100065L) +#define SCARD_W_UNRESPONSIVE_CARD _HRESULT_TYPEDEF_(0x80100066L) +#define SCARD_W_UNPOWERED_CARD _HRESULT_TYPEDEF_(0x80100067L) +#define SCARD_W_RESET_CARD _HRESULT_TYPEDEF_(0x80100068L) +#define SCARD_W_REMOVED_CARD _HRESULT_TYPEDEF_(0x80100069L) +#define SCARD_W_SECURITY_VIOLATION _HRESULT_TYPEDEF_(0x8010006AL) +#define SCARD_W_WRONG_CHV _HRESULT_TYPEDEF_(0x8010006BL) +#define SCARD_W_CHV_BLOCKED _HRESULT_TYPEDEF_(0x8010006CL) +#define SCARD_W_EOF _HRESULT_TYPEDEF_(0x8010006DL) +#define SCARD_W_CANCELLED_BY_USER _HRESULT_TYPEDEF_(0x8010006EL) +#define SCARD_W_CARD_NOT_AUTHENTICATED _HRESULT_TYPEDEF_(0x8010006FL) +#define COMADMIN_E_OBJECTERRORS _HRESULT_TYPEDEF_(0x80110401L) +#define COMADMIN_E_OBJECTINVALID _HRESULT_TYPEDEF_(0x80110402L) +#define COMADMIN_E_KEYMISSING _HRESULT_TYPEDEF_(0x80110403L) +#define COMADMIN_E_ALREADYINSTALLED _HRESULT_TYPEDEF_(0x80110404L) +#define COMADMIN_E_APP_FILE_WRITEFAIL _HRESULT_TYPEDEF_(0x80110407L) +#define COMADMIN_E_APP_FILE_READFAIL _HRESULT_TYPEDEF_(0x80110408L) +#define COMADMIN_E_APP_FILE_VERSION _HRESULT_TYPEDEF_(0x80110409L) +#define COMADMIN_E_BADPATH _HRESULT_TYPEDEF_(0x8011040AL) +#define COMADMIN_E_APPLICATIONEXISTS _HRESULT_TYPEDEF_(0x8011040BL) +#define COMADMIN_E_ROLEEXISTS _HRESULT_TYPEDEF_(0x8011040CL) +#define COMADMIN_E_CANTCOPYFILE _HRESULT_TYPEDEF_(0x8011040DL) +#define COMADMIN_E_NOUSER _HRESULT_TYPEDEF_(0x8011040FL) +#define COMADMIN_E_INVALIDUSERIDS _HRESULT_TYPEDEF_(0x80110410L) +#define COMADMIN_E_NOREGISTRYCLSID _HRESULT_TYPEDEF_(0x80110411L) +#define COMADMIN_E_BADREGISTRYPROGID _HRESULT_TYPEDEF_(0x80110412L) +#define COMADMIN_E_AUTHENTICATIONLEVEL _HRESULT_TYPEDEF_(0x80110413L) +#define COMADMIN_E_USERPASSWDNOTVALID _HRESULT_TYPEDEF_(0x80110414L) +#define COMADMIN_E_CLSIDORIIDMISMATCH _HRESULT_TYPEDEF_(0x80110418L) +#define COMADMIN_E_REMOTEINTERFACE _HRESULT_TYPEDEF_(0x80110419L) +#define COMADMIN_E_DLLREGISTERSERVER _HRESULT_TYPEDEF_(0x8011041AL) +#define COMADMIN_E_NOSERVERSHARE _HRESULT_TYPEDEF_(0x8011041BL) +#define COMADMIN_E_DLLLOADFAILED _HRESULT_TYPEDEF_(0x8011041DL) +#define COMADMIN_E_BADREGISTRYLIBID _HRESULT_TYPEDEF_(0x8011041EL) +#define COMADMIN_E_APPDIRNOTFOUND _HRESULT_TYPEDEF_(0x8011041FL) +#define COMADMIN_E_REGISTRARFAILED _HRESULT_TYPEDEF_(0x80110423L) +#define COMADMIN_E_COMPFILE_DOESNOTEXIST _HRESULT_TYPEDEF_(0x80110424L) +#define COMADMIN_E_COMPFILE_LOADDLLFAIL _HRESULT_TYPEDEF_(0x80110425L) +#define COMADMIN_E_COMPFILE_GETCLASSOBJ _HRESULT_TYPEDEF_(0x80110426L) +#define COMADMIN_E_COMPFILE_CLASSNOTAVAIL _HRESULT_TYPEDEF_(0x80110427L) +#define COMADMIN_E_COMPFILE_BADTLB _HRESULT_TYPEDEF_(0x80110428L) +#define COMADMIN_E_COMPFILE_NOTINSTALLABLE _HRESULT_TYPEDEF_(0x80110429L) +#define COMADMIN_E_NOTCHANGEABLE _HRESULT_TYPEDEF_(0x8011042AL) +#define COMADMIN_E_NOTDELETEABLE _HRESULT_TYPEDEF_(0x8011042BL) +#define COMADMIN_E_SESSION _HRESULT_TYPEDEF_(0x8011042CL) +#define COMADMIN_E_COMP_MOVE_LOCKED _HRESULT_TYPEDEF_(0x8011042DL) +#define COMADMIN_E_COMP_MOVE_BAD_DEST _HRESULT_TYPEDEF_(0x8011042EL) +#define COMADMIN_E_REGISTERTLB _HRESULT_TYPEDEF_(0x80110430L) +#define COMADMIN_E_SYSTEMAPP _HRESULT_TYPEDEF_(0x80110433L) +#define COMADMIN_E_COMPFILE_NOREGISTRAR _HRESULT_TYPEDEF_(0x80110434L) +#define COMADMIN_E_COREQCOMPINSTALLED _HRESULT_TYPEDEF_(0x80110435L) +#define COMADMIN_E_SERVICENOTINSTALLED _HRESULT_TYPEDEF_(0x80110436L) +#define COMADMIN_E_PROPERTYSAVEFAILED _HRESULT_TYPEDEF_(0x80110437L) +#define COMADMIN_E_OBJECTEXISTS _HRESULT_TYPEDEF_(0x80110438L) +#define COMADMIN_E_COMPONENTEXISTS _HRESULT_TYPEDEF_(0x80110439L) +#define COMADMIN_E_REGFILE_CORRUPT _HRESULT_TYPEDEF_(0x8011043BL) +#define COMADMIN_E_PROPERTY_OVERFLOW _HRESULT_TYPEDEF_(0x8011043CL) +#define COMADMIN_E_NOTINREGISTRY _HRESULT_TYPEDEF_(0x8011043EL) +#define COMADMIN_E_OBJECTNOTPOOLABLE _HRESULT_TYPEDEF_(0x8011043FL) +#define COMADMIN_E_APPLID_MATCHES_CLSID _HRESULT_TYPEDEF_(0x80110446L) +#define COMADMIN_E_ROLE_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x80110447L) +#define COMADMIN_E_START_APP_NEEDS_COMPONENTS _HRESULT_TYPEDEF_(0x80110448L) +#define COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM _HRESULT_TYPEDEF_(0x80110449L) +#define COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY _HRESULT_TYPEDEF_(0x8011044AL) +#define COMADMIN_E_CAN_NOT_START_APP _HRESULT_TYPEDEF_(0x8011044BL) +#define COMADMIN_E_CAN_NOT_EXPORT_SYS_APP _HRESULT_TYPEDEF_(0x8011044CL) +#define COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT _HRESULT_TYPEDEF_(0x8011044DL) +#define COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER _HRESULT_TYPEDEF_(0x8011044EL) +#define COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE _HRESULT_TYPEDEF_(0x8011044FL) +#define COMADMIN_E_BASE_PARTITION_ONLY _HRESULT_TYPEDEF_(0x80110450L) +#define COMADMIN_E_START_APP_DISABLED _HRESULT_TYPEDEF_(0x80110451L) +#define COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME _HRESULT_TYPEDEF_(0x80110457L) +#define COMADMIN_E_CAT_INVALID_PARTITION_NAME _HRESULT_TYPEDEF_(0x80110458L) +#define COMADMIN_E_CAT_PARTITION_IN_USE _HRESULT_TYPEDEF_(0x80110459L) +#define COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES _HRESULT_TYPEDEF_(0x8011045AL) +#define COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED _HRESULT_TYPEDEF_(0x8011045BL) +#define COMADMIN_E_AMBIGUOUS_APPLICATION_NAME _HRESULT_TYPEDEF_(0x8011045CL) +#define COMADMIN_E_AMBIGUOUS_PARTITION_NAME _HRESULT_TYPEDEF_(0x8011045DL) +#define COMADMIN_E_REGDB_NOTINITIALIZED _HRESULT_TYPEDEF_(0x80110472L) +#define COMADMIN_E_REGDB_NOTOPEN _HRESULT_TYPEDEF_(0x80110473L) +#define COMADMIN_E_REGDB_SYSTEMERR _HRESULT_TYPEDEF_(0x80110474L) +#define COMADMIN_E_REGDB_ALREADYRUNNING _HRESULT_TYPEDEF_(0x80110475L) +#define COMADMIN_E_MIG_VERSIONNOTSUPPORTED _HRESULT_TYPEDEF_(0x80110480L) +#define COMADMIN_E_MIG_SCHEMANOTFOUND _HRESULT_TYPEDEF_(0x80110481L) +#define COMADMIN_E_CAT_BITNESSMISMATCH _HRESULT_TYPEDEF_(0x80110482L) +#define COMADMIN_E_CAT_UNACCEPTABLEBITNESS _HRESULT_TYPEDEF_(0x80110483L) +#define COMADMIN_E_CAT_WRONGAPPBITNESS _HRESULT_TYPEDEF_(0x80110484L) +#define COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x80110485L) +#define COMADMIN_E_CAT_SERVERFAULT _HRESULT_TYPEDEF_(0x80110486L) +#define COMQC_E_APPLICATION_NOT_QUEUED _HRESULT_TYPEDEF_(0x80110600L) +#define COMQC_E_NO_QUEUEABLE_INTERFACES _HRESULT_TYPEDEF_(0x80110601L) +#define COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE _HRESULT_TYPEDEF_(0x80110602L) +#define COMQC_E_NO_IPERSISTSTREAM _HRESULT_TYPEDEF_(0x80110603L) +#define COMQC_E_BAD_MESSAGE _HRESULT_TYPEDEF_(0x80110604L) +#define COMQC_E_UNAUTHENTICATED _HRESULT_TYPEDEF_(0x80110605L) +#define COMQC_E_UNTRUSTED_ENQUEUER _HRESULT_TYPEDEF_(0x80110606L) +#define MSDTC_E_DUPLICATE_RESOURCE _HRESULT_TYPEDEF_(0x80110701L) +#define COMADMIN_E_OBJECT_PARENT_MISSING _HRESULT_TYPEDEF_(0x80110808L) +#define COMADMIN_E_OBJECT_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x80110809L) +#define COMADMIN_E_APP_NOT_RUNNING _HRESULT_TYPEDEF_(0x8011080AL) +#define COMADMIN_E_INVALID_PARTITION _HRESULT_TYPEDEF_(0x8011080BL) +#define COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE _HRESULT_TYPEDEF_(0x8011080DL) +#define COMADMIN_E_USER_IN_SET _HRESULT_TYPEDEF_(0x8011080EL) +#define COMADMIN_E_CANTRECYCLELIBRARYAPPS _HRESULT_TYPEDEF_(0x8011080FL) +#define COMADMIN_E_CANTRECYCLESERVICEAPPS _HRESULT_TYPEDEF_(0x80110811L) +#define COMADMIN_E_PROCESSALREADYRECYCLED _HRESULT_TYPEDEF_(0x80110812L) +#define COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED _HRESULT_TYPEDEF_(0x80110813L) +#define COMADMIN_E_CANTMAKEINPROCSERVICE _HRESULT_TYPEDEF_(0x80110814L) +#define COMADMIN_E_PROGIDINUSEBYCLSID _HRESULT_TYPEDEF_(0x80110815L) +#define COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET _HRESULT_TYPEDEF_(0x80110816L) +#define COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED _HRESULT_TYPEDEF_(0x80110817L) +#define COMADMIN_E_PARTITION_ACCESSDENIED _HRESULT_TYPEDEF_(0x80110818L) +#define COMADMIN_E_PARTITION_MSI_ONLY _HRESULT_TYPEDEF_(0x80110819L) +#define COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT _HRESULT_TYPEDEF_(0x8011081AL) +#define COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS _HRESULT_TYPEDEF_(0x8011081BL) +#define COMADMIN_E_COMP_MOVE_SOURCE _HRESULT_TYPEDEF_(0x8011081CL) +#define COMADMIN_E_COMP_MOVE_DEST _HRESULT_TYPEDEF_(0x8011081DL) +#define COMADMIN_E_COMP_MOVE_PRIVATE _HRESULT_TYPEDEF_(0x8011081EL) +#define COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET _HRESULT_TYPEDEF_(0x8011081FL) +#define COMADMIN_E_CANNOT_ALIAS_EVENTCLASS _HRESULT_TYPEDEF_(0x80110820L) +#define COMADMIN_E_PRIVATE_ACCESSDENIED _HRESULT_TYPEDEF_(0x80110821L) +#define COMADMIN_E_SAFERINVALID _HRESULT_TYPEDEF_(0x80110822L) +#define COMADMIN_E_REGISTRY_ACCESSDENIED _HRESULT_TYPEDEF_(0x80110823L) +#define COMADMIN_E_PARTITIONS_DISABLED _HRESULT_TYPEDEF_(0x80110824L) +#endif /* _WINERROR_ */ diff --git a/overlay_toolchain/tcc/include/winapi/wingdi.h b/overlay_toolchain/tcc/include/winapi/wingdi.h new file mode 100644 index 00000000..63d38917 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/wingdi.h @@ -0,0 +1,4080 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINGDI_ +#define _WINGDI_ + +#define WINGDIAPI DECLSPEC_IMPORT +#define WINSPOOLAPI DECLSPEC_IMPORT + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#ifndef NOGDI +#ifndef NORASTEROPS +#define R2_BLACK 1 +#define R2_NOTMERGEPEN 2 +#define R2_MASKNOTPEN 3 +#define R2_NOTCOPYPEN 4 +#define R2_MASKPENNOT 5 +#define R2_NOT 6 +#define R2_XORPEN 7 +#define R2_NOTMASKPEN 8 +#define R2_MASKPEN 9 +#define R2_NOTXORPEN 10 +#define R2_NOP 11 +#define R2_MERGENOTPEN 12 +#define R2_COPYPEN 13 +#define R2_MERGEPENNOT 14 +#define R2_MERGEPEN 15 +#define R2_WHITE 16 +#define R2_LAST 16 + +#define SRCCOPY (DWORD)0x00CC0020 +#define SRCPAINT (DWORD)0x00EE0086 +#define SRCAND (DWORD)0x008800C6 +#define SRCINVERT (DWORD)0x00660046 +#define SRCERASE (DWORD)0x00440328 +#define NOTSRCCOPY (DWORD)0x00330008 +#define NOTSRCERASE (DWORD)0x001100A6 +#define MERGECOPY (DWORD)0x00C000CA +#define MERGEPAINT (DWORD)0x00BB0226 +#define PATCOPY (DWORD)0x00F00021 +#define PATPAINT (DWORD)0x00FB0A09 +#define PATINVERT (DWORD)0x005A0049 +#define DSTINVERT (DWORD)0x00550009 +#define BLACKNESS (DWORD)0x00000042 +#define WHITENESS (DWORD)0x00FF0062 +#define NOMIRRORBITMAP (DWORD)0x80000000 +#define CAPTUREBLT (DWORD)0x40000000 +#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) +#endif + +#define GDI_ERROR (0xFFFFFFFFL) +#define HGDI_ERROR (LongToHandle(0xFFFFFFFFL)) + +#define ERROR 0 +#define NULLREGION 1 +#define SIMPLEREGION 2 +#define COMPLEXREGION 3 +#define RGN_ERROR ERROR + +#define RGN_AND 1 +#define RGN_OR 2 +#define RGN_XOR 3 +#define RGN_DIFF 4 +#define RGN_COPY 5 +#define RGN_MIN RGN_AND +#define RGN_MAX RGN_COPY + +#define BLACKONWHITE 1 +#define WHITEONBLACK 2 +#define COLORONCOLOR 3 +#define HALFTONE 4 +#define MAXSTRETCHBLTMODE 4 + +#define STRETCH_ANDSCANS BLACKONWHITE +#define STRETCH_ORSCANS WHITEONBLACK +#define STRETCH_DELETESCANS COLORONCOLOR +#define STRETCH_HALFTONE HALFTONE + +#define ALTERNATE 1 +#define WINDING 2 +#define POLYFILL_LAST 2 + +#define LAYOUT_RTL 0x00000001 +#define LAYOUT_BTT 0x00000002 +#define LAYOUT_VBH 0x00000004 +#define LAYOUT_ORIENTATIONMASK (LAYOUT_RTL | LAYOUT_BTT | LAYOUT_VBH) +#define LAYOUT_BITMAPORIENTATIONPRESERVED 0x00000008 + +#define TA_NOUPDATECP 0 +#define TA_UPDATECP 1 + +#define TA_LEFT 0 +#define TA_RIGHT 2 +#define TA_CENTER 6 + +#define TA_TOP 0 +#define TA_BOTTOM 8 +#define TA_BASELINE 24 +#define TA_RTLREADING 256 +#define TA_MASK (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING) + +#define VTA_BASELINE TA_BASELINE +#define VTA_LEFT TA_BOTTOM +#define VTA_RIGHT TA_TOP +#define VTA_CENTER TA_CENTER +#define VTA_BOTTOM TA_RIGHT +#define VTA_TOP TA_LEFT + +#define ETO_OPAQUE 0x0002 +#define ETO_CLIPPED 0x0004 +#define ETO_GLYPH_INDEX 0x0010 +#define ETO_RTLREADING 0x0080 +#define ETO_NUMERICSLOCAL 0x0400 +#define ETO_NUMERICSLATIN 0x0800 +#define ETO_IGNORELANGUAGE 0x1000 +#define ETO_PDY 0x2000 + +#define ASPECT_FILTERING 0x0001 + +#define DCB_RESET 0x0001 +#define DCB_ACCUMULATE 0x0002 +#define DCB_DIRTY DCB_ACCUMULATE +#define DCB_SET (DCB_RESET | DCB_ACCUMULATE) +#define DCB_ENABLE 0x0004 +#define DCB_DISABLE 0x0008 + +#ifndef NOMETAFILE + +#define META_SETBKCOLOR 0x0201 +#define META_SETBKMODE 0x0102 +#define META_SETMAPMODE 0x0103 +#define META_SETROP2 0x0104 +#define META_SETRELABS 0x0105 +#define META_SETPOLYFILLMODE 0x0106 +#define META_SETSTRETCHBLTMODE 0x0107 +#define META_SETTEXTCHAREXTRA 0x0108 +#define META_SETTEXTCOLOR 0x0209 +#define META_SETTEXTJUSTIFICATION 0x020A +#define META_SETWINDOWORG 0x020B +#define META_SETWINDOWEXT 0x020C +#define META_SETVIEWPORTORG 0x020D +#define META_SETVIEWPORTEXT 0x020E +#define META_OFFSETWINDOWORG 0x020F +#define META_SCALEWINDOWEXT 0x0410 +#define META_OFFSETVIEWPORTORG 0x0211 +#define META_SCALEVIEWPORTEXT 0x0412 +#define META_LINETO 0x0213 +#define META_MOVETO 0x0214 +#define META_EXCLUDECLIPRECT 0x0415 +#define META_INTERSECTCLIPRECT 0x0416 +#define META_ARC 0x0817 +#define META_ELLIPSE 0x0418 +#define META_FLOODFILL 0x0419 +#define META_PIE 0x081A +#define META_RECTANGLE 0x041B +#define META_ROUNDRECT 0x061C +#define META_PATBLT 0x061D +#define META_SAVEDC 0x001E +#define META_SETPIXEL 0x041F +#define META_OFFSETCLIPRGN 0x0220 +#define META_TEXTOUT 0x0521 +#define META_BITBLT 0x0922 +#define META_STRETCHBLT 0x0B23 +#define META_POLYGON 0x0324 +#define META_POLYLINE 0x0325 +#define META_ESCAPE 0x0626 +#define META_RESTOREDC 0x0127 +#define META_FILLREGION 0x0228 +#define META_FRAMEREGION 0x0429 +#define META_INVERTREGION 0x012A +#define META_PAINTREGION 0x012B +#define META_SELECTCLIPREGION 0x012C +#define META_SELECTOBJECT 0x012D +#define META_SETTEXTALIGN 0x012E +#define META_CHORD 0x0830 +#define META_SETMAPPERFLAGS 0x0231 +#define META_EXTTEXTOUT 0x0a32 +#define META_SETDIBTODEV 0x0d33 +#define META_SELECTPALETTE 0x0234 +#define META_REALIZEPALETTE 0x0035 +#define META_ANIMATEPALETTE 0x0436 +#define META_SETPALENTRIES 0x0037 +#define META_POLYPOLYGON 0x0538 +#define META_RESIZEPALETTE 0x0139 +#define META_DIBBITBLT 0x0940 +#define META_DIBSTRETCHBLT 0x0b41 +#define META_DIBCREATEPATTERNBRUSH 0x0142 +#define META_STRETCHDIB 0x0f43 +#define META_EXTFLOODFILL 0x0548 +#define META_SETLAYOUT 0x0149 +#define META_DELETEOBJECT 0x01f0 +#define META_CREATEPALETTE 0x00f7 +#define META_CREATEPATTERNBRUSH 0x01F9 +#define META_CREATEPENINDIRECT 0x02FA +#define META_CREATEFONTINDIRECT 0x02FB +#define META_CREATEBRUSHINDIRECT 0x02FC +#define META_CREATEREGION 0x06FF + + typedef struct _DRAWPATRECT { + POINT ptPosition; + POINT ptSize; + WORD wStyle; + WORD wPattern; + } DRAWPATRECT,*PDRAWPATRECT; +#endif + +#define NEWFRAME 1 +#define ABORTDOC 2 +#define NEXTBAND 3 +#define SETCOLORTABLE 4 +#define GETCOLORTABLE 5 +#define FLUSHOUTPUT 6 +#define DRAFTMODE 7 +#define QUERYESCSUPPORT 8 +#define SETABORTPROC 9 +#define STARTDOC 10 +#define ENDDOC 11 +#define GETPHYSPAGESIZE 12 +#define GETPRINTINGOFFSET 13 +#define GETSCALINGFACTOR 14 +#define MFCOMMENT 15 +#define GETPENWIDTH 16 +#define SETCOPYCOUNT 17 +#define SELECTPAPERSOURCE 18 +#define DEVICEDATA 19 +#define PASSTHROUGH 19 +#define GETTECHNOLGY 20 +#define GETTECHNOLOGY 20 +#define SETLINECAP 21 +#define SETLINEJOIN 22 +#define SETMITERLIMIT 23 +#define BANDINFO 24 +#define DRAWPATTERNRECT 25 +#define GETVECTORPENSIZE 26 +#define GETVECTORBRUSHSIZE 27 +#define ENABLEDUPLEX 28 +#define GETSETPAPERBINS 29 +#define GETSETPRINTORIENT 30 +#define ENUMPAPERBINS 31 +#define SETDIBSCALING 32 +#define EPSPRINTING 33 +#define ENUMPAPERMETRICS 34 +#define GETSETPAPERMETRICS 35 +#define POSTSCRIPT_DATA 37 +#define POSTSCRIPT_IGNORE 38 +#define MOUSETRAILS 39 +#define GETDEVICEUNITS 42 + +#define GETEXTENDEDTEXTMETRICS 256 +#define GETEXTENTTABLE 257 +#define GETPAIRKERNTABLE 258 +#define GETTRACKKERNTABLE 259 +#define EXTTEXTOUT 512 +#define GETFACENAME 513 +#define DOWNLOADFACE 514 +#define ENABLERELATIVEWIDTHS 768 +#define ENABLEPAIRKERNING 769 +#define SETKERNTRACK 770 +#define SETALLJUSTVALUES 771 +#define SETCHARSET 772 + +#define STRETCHBLT 2048 +#define METAFILE_DRIVER 2049 +#define GETSETSCREENPARAMS 3072 +#define QUERYDIBSUPPORT 3073 +#define BEGIN_PATH 4096 +#define CLIP_TO_PATH 4097 +#define END_PATH 4098 +#define EXT_DEVICE_CAPS 4099 +#define RESTORE_CTM 4100 +#define SAVE_CTM 4101 +#define SET_ARC_DIRECTION 4102 +#define SET_BACKGROUND_COLOR 4103 +#define SET_POLY_MODE 4104 +#define SET_SCREEN_ANGLE 4105 +#define SET_SPREAD 4106 +#define TRANSFORM_CTM 4107 +#define SET_CLIP_BOX 4108 +#define SET_BOUNDS 4109 +#define SET_MIRROR_MODE 4110 +#define OPENCHANNEL 4110 +#define DOWNLOADHEADER 4111 +#define CLOSECHANNEL 4112 +#define POSTSCRIPT_PASSTHROUGH 4115 +#define ENCAPSULATED_POSTSCRIPT 4116 + +#define POSTSCRIPT_IDENTIFY 4117 +#define POSTSCRIPT_INJECTION 4118 + +#define CHECKJPEGFORMAT 4119 +#define CHECKPNGFORMAT 4120 + +#define GET_PS_FEATURESETTING 4121 + +#define SPCLPASSTHROUGH2 4568 + +#define PSIDENT_GDICENTRIC 0 +#define PSIDENT_PSCENTRIC 1 + + typedef struct _PSINJECTDATA { + DWORD DataBytes; + WORD InjectionPoint; + WORD PageNumber; + } PSINJECTDATA,*PPSINJECTDATA; + +#define PSINJECT_BEGINSTREAM 1 +#define PSINJECT_PSADOBE 2 +#define PSINJECT_PAGESATEND 3 +#define PSINJECT_PAGES 4 + +#define PSINJECT_DOCNEEDEDRES 5 +#define PSINJECT_DOCSUPPLIEDRES 6 +#define PSINJECT_PAGEORDER 7 +#define PSINJECT_ORIENTATION 8 +#define PSINJECT_BOUNDINGBOX 9 +#define PSINJECT_DOCUMENTPROCESSCOLORS 10 + +#define PSINJECT_COMMENTS 11 +#define PSINJECT_BEGINDEFAULTS 12 +#define PSINJECT_ENDDEFAULTS 13 +#define PSINJECT_BEGINPROLOG 14 +#define PSINJECT_ENDPROLOG 15 +#define PSINJECT_BEGINSETUP 16 +#define PSINJECT_ENDSETUP 17 +#define PSINJECT_TRAILER 18 +#define PSINJECT_EOF 19 +#define PSINJECT_ENDSTREAM 20 +#define PSINJECT_DOCUMENTPROCESSCOLORSATEND 21 + +#define PSINJECT_PAGENUMBER 100 +#define PSINJECT_BEGINPAGESETUP 101 +#define PSINJECT_ENDPAGESETUP 102 +#define PSINJECT_PAGETRAILER 103 +#define PSINJECT_PLATECOLOR 104 + +#define PSINJECT_SHOWPAGE 105 +#define PSINJECT_PAGEBBOX 106 +#define PSINJECT_ENDPAGECOMMENTS 107 + +#define PSINJECT_VMSAVE 200 +#define PSINJECT_VMRESTORE 201 + +#define FEATURESETTING_NUP 0 +#define FEATURESETTING_OUTPUT 1 +#define FEATURESETTING_PSLEVEL 2 +#define FEATURESETTING_CUSTPAPER 3 +#define FEATURESETTING_MIRROR 4 +#define FEATURESETTING_NEGATIVE 5 +#define FEATURESETTING_PROTOCOL 6 + +#define FEATURESETTING_PRIVATE_BEGIN 0x1000 +#define FEATURESETTING_PRIVATE_END 0x1FFF + + typedef struct _PSFEATURE_OUTPUT { + WINBOOL bPageIndependent; + WINBOOL bSetPageDevice; + } PSFEATURE_OUTPUT,*PPSFEATURE_OUTPUT; + + typedef struct _PSFEATURE_CUSTPAPER { + LONG lOrientation; + LONG lWidth; + LONG lHeight; + LONG lWidthOffset; + LONG lHeightOffset; + } PSFEATURE_CUSTPAPER,*PPSFEATURE_CUSTPAPER; + +#define PSPROTOCOL_ASCII 0 +#define PSPROTOCOL_BCP 1 +#define PSPROTOCOL_TBCP 2 +#define PSPROTOCOL_BINARY 3 + +#define QDI_SETDIBITS 1 +#define QDI_GETDIBITS 2 +#define QDI_DIBTOSCREEN 4 +#define QDI_STRETCHDIB 8 + +#define SP_NOTREPORTED 0x4000 +#define SP_ERROR (-1) +#define SP_APPABORT (-2) +#define SP_USERABORT (-3) +#define SP_OUTOFDISK (-4) +#define SP_OUTOFMEMORY (-5) + +#define PR_JOBSTATUS 0x0000 + +#define OBJ_PEN 1 +#define OBJ_BRUSH 2 +#define OBJ_DC 3 +#define OBJ_METADC 4 +#define OBJ_PAL 5 +#define OBJ_FONT 6 +#define OBJ_BITMAP 7 +#define OBJ_REGION 8 +#define OBJ_METAFILE 9 +#define OBJ_MEMDC 10 +#define OBJ_EXTPEN 11 +#define OBJ_ENHMETADC 12 +#define OBJ_ENHMETAFILE 13 +#define OBJ_COLORSPACE 14 + +#define MWT_IDENTITY 1 +#define MWT_LEFTMULTIPLY 2 +#define MWT_RIGHTMULTIPLY 3 + +#define MWT_MIN MWT_IDENTITY +#define MWT_MAX MWT_RIGHTMULTIPLY + +#define _XFORM_ + typedef struct tagXFORM { + FLOAT eM11; + FLOAT eM12; + FLOAT eM21; + FLOAT eM22; + FLOAT eDx; + FLOAT eDy; + } XFORM,*PXFORM,*LPXFORM; + + typedef struct tagBITMAP { + LONG bmType; + LONG bmWidth; + LONG bmHeight; + LONG bmWidthBytes; + WORD bmPlanes; + WORD bmBitsPixel; + LPVOID bmBits; + } BITMAP,*PBITMAP,*NPBITMAP,*LPBITMAP; + +#include + typedef struct tagRGBTRIPLE { + BYTE rgbtBlue; + BYTE rgbtGreen; + BYTE rgbtRed; + } RGBTRIPLE; +#include + + typedef struct tagRGBQUAD { + BYTE rgbBlue; + BYTE rgbGreen; + BYTE rgbRed; + BYTE rgbReserved; + } RGBQUAD; + typedef RGBQUAD *LPRGBQUAD; + +#define CS_ENABLE 0x00000001L +#define CS_DISABLE 0x00000002L +#define CS_DELETE_TRANSFORM 0x00000003L + +//!__TINYC__: #define LCS_SIGNATURE 'PSOC' +//!__TINYC__: #define LCS_sRGB 'sRGB' +//!__TINYC__: #define LCS_WINDOWS_COLOR_SPACE 'Win ' + + typedef LONG LCSCSTYPE; +#define LCS_CALIBRATED_RGB 0x00000000L + + typedef LONG LCSGAMUTMATCH; +#define LCS_GM_BUSINESS 0x00000001L +#define LCS_GM_GRAPHICS 0x00000002L +#define LCS_GM_IMAGES 0x00000004L +#define LCS_GM_ABS_COLORIMETRIC 0x00000008L + +#define CM_OUT_OF_GAMUT 255 +#define CM_IN_GAMUT 0 + +#define ICM_ADDPROFILE 1 +#define ICM_DELETEPROFILE 2 +#define ICM_QUERYPROFILE 3 +#define ICM_SETDEFAULTPROFILE 4 +#define ICM_REGISTERICMATCHER 5 +#define ICM_UNREGISTERICMATCHER 6 +#define ICM_QUERYMATCH 7 + +#define GetKValue(cmyk) ((BYTE)(cmyk)) +#define GetYValue(cmyk) ((BYTE)((cmyk)>> 8)) +#define GetMValue(cmyk) ((BYTE)((cmyk)>>16)) +#define GetCValue(cmyk) ((BYTE)((cmyk)>>24)) + +#define CMYK(c,m,y,k) ((COLORREF)((((BYTE)(k)|((WORD)((BYTE)(y))<<8))|(((DWORD)(BYTE)(m))<<16))|(((DWORD)(BYTE)(c))<<24))) + + typedef long FXPT16DOT16,*LPFXPT16DOT16; + typedef long FXPT2DOT30,*LPFXPT2DOT30; + + typedef struct tagCIEXYZ { + FXPT2DOT30 ciexyzX; + FXPT2DOT30 ciexyzY; + FXPT2DOT30 ciexyzZ; + } CIEXYZ; + typedef CIEXYZ *LPCIEXYZ; + + typedef struct tagICEXYZTRIPLE { + CIEXYZ ciexyzRed; + CIEXYZ ciexyzGreen; + CIEXYZ ciexyzBlue; + } CIEXYZTRIPLE; + + typedef CIEXYZTRIPLE *LPCIEXYZTRIPLE; + + typedef struct tagLOGCOLORSPACEA { + DWORD lcsSignature; + DWORD lcsVersion; + DWORD lcsSize; + LCSCSTYPE lcsCSType; + LCSGAMUTMATCH lcsIntent; + CIEXYZTRIPLE lcsEndpoints; + DWORD lcsGammaRed; + DWORD lcsGammaGreen; + DWORD lcsGammaBlue; + CHAR lcsFilename[MAX_PATH]; + } LOGCOLORSPACEA,*LPLOGCOLORSPACEA; + + typedef struct tagLOGCOLORSPACEW { + DWORD lcsSignature; + DWORD lcsVersion; + DWORD lcsSize; + LCSCSTYPE lcsCSType; + LCSGAMUTMATCH lcsIntent; + CIEXYZTRIPLE lcsEndpoints; + DWORD lcsGammaRed; + DWORD lcsGammaGreen; + DWORD lcsGammaBlue; + WCHAR lcsFilename[MAX_PATH]; + } LOGCOLORSPACEW,*LPLOGCOLORSPACEW; + +#ifdef UNICODE + typedef LOGCOLORSPACEW LOGCOLORSPACE; + typedef LPLOGCOLORSPACEW LPLOGCOLORSPACE; +#else + typedef LOGCOLORSPACEA LOGCOLORSPACE; + typedef LPLOGCOLORSPACEA LPLOGCOLORSPACE; +#endif + + typedef struct tagBITMAPCOREHEADER { + DWORD bcSize; + WORD bcWidth; + WORD bcHeight; + WORD bcPlanes; + WORD bcBitCount; + } BITMAPCOREHEADER,*LPBITMAPCOREHEADER,*PBITMAPCOREHEADER; + + typedef struct tagBITMAPINFOHEADER { + DWORD biSize; + LONG biWidth; + LONG biHeight; + WORD biPlanes; + WORD biBitCount; + DWORD biCompression; + DWORD biSizeImage; + LONG biXPelsPerMeter; + LONG biYPelsPerMeter; + DWORD biClrUsed; + DWORD biClrImportant; + } BITMAPINFOHEADER,*LPBITMAPINFOHEADER,*PBITMAPINFOHEADER; + + typedef struct { + DWORD bV4Size; + LONG bV4Width; + LONG bV4Height; + WORD bV4Planes; + WORD bV4BitCount; + DWORD bV4V4Compression; + DWORD bV4SizeImage; + LONG bV4XPelsPerMeter; + LONG bV4YPelsPerMeter; + DWORD bV4ClrUsed; + DWORD bV4ClrImportant; + DWORD bV4RedMask; + DWORD bV4GreenMask; + DWORD bV4BlueMask; + DWORD bV4AlphaMask; + DWORD bV4CSType; + CIEXYZTRIPLE bV4Endpoints; + DWORD bV4GammaRed; + DWORD bV4GammaGreen; + DWORD bV4GammaBlue; + } BITMAPV4HEADER,*LPBITMAPV4HEADER,*PBITMAPV4HEADER; + + typedef struct { + DWORD bV5Size; + LONG bV5Width; + LONG bV5Height; + WORD bV5Planes; + WORD bV5BitCount; + DWORD bV5Compression; + DWORD bV5SizeImage; + LONG bV5XPelsPerMeter; + LONG bV5YPelsPerMeter; + DWORD bV5ClrUsed; + DWORD bV5ClrImportant; + DWORD bV5RedMask; + DWORD bV5GreenMask; + DWORD bV5BlueMask; + DWORD bV5AlphaMask; + DWORD bV5CSType; + CIEXYZTRIPLE bV5Endpoints; + DWORD bV5GammaRed; + DWORD bV5GammaGreen; + DWORD bV5GammaBlue; + DWORD bV5Intent; + DWORD bV5ProfileData; + DWORD bV5ProfileSize; + DWORD bV5Reserved; + } BITMAPV5HEADER,*LPBITMAPV5HEADER,*PBITMAPV5HEADER; + +//!__TINYC__: #define PROFILE_LINKED 'LINK' +//!__TINYC__: #define PROFILE_EMBEDDED 'MBED' + +#define BI_RGB 0L +#define BI_RLE8 1L +#define BI_RLE4 2L +#define BI_BITFIELDS 3L +#define BI_JPEG 4L +#define BI_PNG 5L + + typedef struct tagBITMAPINFO { + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[1]; + } BITMAPINFO,*LPBITMAPINFO,*PBITMAPINFO; + + typedef struct tagBITMAPCOREINFO { + BITMAPCOREHEADER bmciHeader; + RGBTRIPLE bmciColors[1]; + } BITMAPCOREINFO,*LPBITMAPCOREINFO,*PBITMAPCOREINFO; + +#include + typedef struct tagBITMAPFILEHEADER { + WORD bfType; + DWORD bfSize; + WORD bfReserved1; + WORD bfReserved2; + DWORD bfOffBits; + } BITMAPFILEHEADER,*LPBITMAPFILEHEADER,*PBITMAPFILEHEADER; +#include + +#define MAKEPOINTS(l) (*((POINTS *)&(l))) + +#ifndef NOFONTSIG + typedef struct tagFONTSIGNATURE { + DWORD fsUsb[4]; + DWORD fsCsb[2]; + } FONTSIGNATURE,*PFONTSIGNATURE,*LPFONTSIGNATURE; + + typedef struct tagCHARSETINFO { + UINT ciCharset; + UINT ciACP; + FONTSIGNATURE fs; + } CHARSETINFO,*PCHARSETINFO,*NPCHARSETINFO,*LPCHARSETINFO; + +#define TCI_SRCCHARSET 1 +#define TCI_SRCCODEPAGE 2 +#define TCI_SRCFONTSIG 3 +#define TCI_SRCLOCALE 0x1000 + + typedef struct tagLOCALESIGNATURE { + DWORD lsUsb[4]; + DWORD lsCsbDefault[2]; + DWORD lsCsbSupported[2]; + } LOCALESIGNATURE,*PLOCALESIGNATURE,*LPLOCALESIGNATURE; +#endif + + +#ifndef NOMETAFILE + typedef struct tagHANDLETABLE { + HGDIOBJ objectHandle[1]; + } HANDLETABLE,*PHANDLETABLE,*LPHANDLETABLE; + + typedef struct tagMETARECORD { + DWORD rdSize; + WORD rdFunction; + WORD rdParm[1]; + } METARECORD; + typedef struct tagMETARECORD UNALIGNED *PMETARECORD; + typedef struct tagMETARECORD UNALIGNED *LPMETARECORD; + + typedef struct tagMETAFILEPICT { + LONG mm; + LONG xExt; + LONG yExt; + HMETAFILE hMF; + } METAFILEPICT,*LPMETAFILEPICT; + +#include + typedef struct tagMETAHEADER { + WORD mtType; + WORD mtHeaderSize; + WORD mtVersion; + DWORD mtSize; + WORD mtNoObjects; + DWORD mtMaxRecord; + WORD mtNoParameters; + } METAHEADER; + typedef struct tagMETAHEADER UNALIGNED *PMETAHEADER; + typedef struct tagMETAHEADER UNALIGNED *LPMETAHEADER; + +#include + + typedef struct tagENHMETARECORD { + DWORD iType; + DWORD nSize; + DWORD dParm[1]; + } ENHMETARECORD,*PENHMETARECORD,*LPENHMETARECORD; + + typedef struct tagENHMETAHEADER { + DWORD iType; + DWORD nSize; + RECTL rclBounds; + RECTL rclFrame; + DWORD dSignature; + DWORD nVersion; + DWORD nBytes; + DWORD nRecords; + WORD nHandles; + WORD sReserved; + DWORD nDescription; + DWORD offDescription; + DWORD nPalEntries; + SIZEL szlDevice; + SIZEL szlMillimeters; + DWORD cbPixelFormat; + DWORD offPixelFormat; + DWORD bOpenGL; + SIZEL szlMicrometers; + } ENHMETAHEADER,*PENHMETAHEADER,*LPENHMETAHEADER; +#endif + +#ifndef NOTEXTMETRIC +#define TMPF_FIXED_PITCH 0x01 +#define TMPF_VECTOR 0x02 +#define TMPF_DEVICE 0x08 +#define TMPF_TRUETYPE 0x04 + +#ifdef UNICODE + typedef WCHAR BCHAR; +#else + typedef BYTE BCHAR; +#endif + +#ifndef _TEXTMETRIC_DEFINED +#define _TEXTMETRIC_DEFINED + typedef struct tagTEXTMETRICA { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + BYTE tmFirstChar; + BYTE tmLastChar; + BYTE tmDefaultChar; + BYTE tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; + } TEXTMETRICA,*PTEXTMETRICA,*NPTEXTMETRICA,*LPTEXTMETRICA; + + typedef struct tagTEXTMETRICW { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + WCHAR tmFirstChar; + WCHAR tmLastChar; + WCHAR tmDefaultChar; + WCHAR tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; + } TEXTMETRICW,*PTEXTMETRICW,*NPTEXTMETRICW,*LPTEXTMETRICW; +#ifdef UNICODE + typedef TEXTMETRICW TEXTMETRIC; + typedef PTEXTMETRICW PTEXTMETRIC; + typedef NPTEXTMETRICW NPTEXTMETRIC; + typedef LPTEXTMETRICW LPTEXTMETRIC; +#else + typedef TEXTMETRICA TEXTMETRIC; + typedef PTEXTMETRICA PTEXTMETRIC; + typedef NPTEXTMETRICA NPTEXTMETRIC; + typedef LPTEXTMETRICA LPTEXTMETRIC; +#endif +#endif + +#define NTM_REGULAR 0x00000040L +#define NTM_BOLD 0x00000020L +#define NTM_ITALIC 0x00000001L + +#define NTM_NONNEGATIVE_AC 0x00010000 +#define NTM_PS_OPENTYPE 0x00020000 +#define NTM_TT_OPENTYPE 0x00040000 +#define NTM_MULTIPLEMASTER 0x00080000 +#define NTM_TYPE1 0x00100000 +#define NTM_DSIG 0x00200000 + +#include + typedef struct tagNEWTEXTMETRICA { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + BYTE tmFirstChar; + BYTE tmLastChar; + BYTE tmDefaultChar; + BYTE tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; + DWORD ntmFlags; + UINT ntmSizeEM; + UINT ntmCellHeight; + UINT ntmAvgWidth; + } NEWTEXTMETRICA,*PNEWTEXTMETRICA,*NPNEWTEXTMETRICA,*LPNEWTEXTMETRICA; + + typedef struct tagNEWTEXTMETRICW { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + WCHAR tmFirstChar; + WCHAR tmLastChar; + WCHAR tmDefaultChar; + WCHAR tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; + DWORD ntmFlags; + UINT ntmSizeEM; + UINT ntmCellHeight; + UINT ntmAvgWidth; + } NEWTEXTMETRICW,*PNEWTEXTMETRICW,*NPNEWTEXTMETRICW,*LPNEWTEXTMETRICW; +#ifdef UNICODE + typedef NEWTEXTMETRICW NEWTEXTMETRIC; + typedef PNEWTEXTMETRICW PNEWTEXTMETRIC; + typedef NPNEWTEXTMETRICW NPNEWTEXTMETRIC; + typedef LPNEWTEXTMETRICW LPNEWTEXTMETRIC; +#else + typedef NEWTEXTMETRICA NEWTEXTMETRIC; + typedef PNEWTEXTMETRICA PNEWTEXTMETRIC; + typedef NPNEWTEXTMETRICA NPNEWTEXTMETRIC; + typedef LPNEWTEXTMETRICA LPNEWTEXTMETRIC; +#endif +#include + + typedef struct tagNEWTEXTMETRICEXA { + NEWTEXTMETRICA ntmTm; + FONTSIGNATURE ntmFontSig; + } NEWTEXTMETRICEXA; + + typedef struct tagNEWTEXTMETRICEXW { + NEWTEXTMETRICW ntmTm; + FONTSIGNATURE ntmFontSig; + } NEWTEXTMETRICEXW; +#ifdef UNICODE + typedef NEWTEXTMETRICEXW NEWTEXTMETRICEX; +#else + typedef NEWTEXTMETRICEXA NEWTEXTMETRICEX; +#endif +#endif + + typedef struct tagPELARRAY { + LONG paXCount; + LONG paYCount; + LONG paXExt; + LONG paYExt; + BYTE paRGBs; + } PELARRAY,*PPELARRAY,*NPPELARRAY,*LPPELARRAY; + + typedef struct tagLOGBRUSH { + UINT lbStyle; + COLORREF lbColor; + ULONG_PTR lbHatch; + } LOGBRUSH,*PLOGBRUSH,*NPLOGBRUSH,*LPLOGBRUSH; + + typedef struct tagLOGBRUSH32 { + UINT lbStyle; + COLORREF lbColor; + ULONG lbHatch; + } LOGBRUSH32,*PLOGBRUSH32,*NPLOGBRUSH32,*LPLOGBRUSH32; + + typedef LOGBRUSH PATTERN; + typedef PATTERN *PPATTERN; + typedef PATTERN *NPPATTERN; + typedef PATTERN *LPPATTERN; + + typedef struct tagLOGPEN { + UINT lopnStyle; + POINT lopnWidth; + COLORREF lopnColor; + } LOGPEN,*PLOGPEN,*NPLOGPEN,*LPLOGPEN; + + typedef struct tagEXTLOGPEN { + DWORD elpPenStyle; + DWORD elpWidth; + UINT elpBrushStyle; + COLORREF elpColor; + ULONG_PTR elpHatch; + DWORD elpNumEntries; + DWORD elpStyleEntry[1]; + } EXTLOGPEN,*PEXTLOGPEN,*NPEXTLOGPEN,*LPEXTLOGPEN; + +#ifndef _PALETTEENTRY_DEFINED +#define _PALETTEENTRY_DEFINED + typedef struct tagPALETTEENTRY { + BYTE peRed; + BYTE peGreen; + BYTE peBlue; + BYTE peFlags; + } PALETTEENTRY,*PPALETTEENTRY,*LPPALETTEENTRY; +#endif + +#ifndef _LOGPALETTE_DEFINED +#define _LOGPALETTE_DEFINED + + typedef struct tagLOGPALETTE { + WORD palVersion; + WORD palNumEntries; + PALETTEENTRY palPalEntry[1]; + } LOGPALETTE,*PLOGPALETTE,*NPLOGPALETTE,*LPLOGPALETTE; +#endif + +#define LF_FACESIZE 32 + + typedef struct tagLOGFONTA { + LONG lfHeight; + LONG lfWidth; + LONG lfEscapement; + LONG lfOrientation; + LONG lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + CHAR lfFaceName[LF_FACESIZE]; + } LOGFONTA,*PLOGFONTA,*NPLOGFONTA,*LPLOGFONTA; + + typedef struct tagLOGFONTW { + LONG lfHeight; + LONG lfWidth; + LONG lfEscapement; + LONG lfOrientation; + LONG lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + WCHAR lfFaceName[LF_FACESIZE]; + } LOGFONTW,*PLOGFONTW,*NPLOGFONTW,*LPLOGFONTW; +#ifdef UNICODE + typedef LOGFONTW LOGFONT; + typedef PLOGFONTW PLOGFONT; + typedef NPLOGFONTW NPLOGFONT; + typedef LPLOGFONTW LPLOGFONT; +#else + typedef LOGFONTA LOGFONT; + typedef PLOGFONTA PLOGFONT; + typedef NPLOGFONTA NPLOGFONT; + typedef LPLOGFONTA LPLOGFONT; +#endif + +#define LF_FULLFACESIZE 64 + + typedef struct tagENUMLOGFONTA { + LOGFONTA elfLogFont; + BYTE elfFullName[LF_FULLFACESIZE]; + BYTE elfStyle[LF_FACESIZE]; + } ENUMLOGFONTA,*LPENUMLOGFONTA; + + typedef struct tagENUMLOGFONTW { + LOGFONTW elfLogFont; + WCHAR elfFullName[LF_FULLFACESIZE]; + WCHAR elfStyle[LF_FACESIZE]; + } ENUMLOGFONTW,*LPENUMLOGFONTW; +#ifdef UNICODE + typedef ENUMLOGFONTW ENUMLOGFONT; + typedef LPENUMLOGFONTW LPENUMLOGFONT; +#else + typedef ENUMLOGFONTA ENUMLOGFONT; + typedef LPENUMLOGFONTA LPENUMLOGFONT; +#endif + + typedef struct tagENUMLOGFONTEXA { + LOGFONTA elfLogFont; + BYTE elfFullName[LF_FULLFACESIZE]; + BYTE elfStyle[LF_FACESIZE]; + BYTE elfScript[LF_FACESIZE]; + } ENUMLOGFONTEXA,*LPENUMLOGFONTEXA; + + typedef struct tagENUMLOGFONTEXW { + LOGFONTW elfLogFont; + WCHAR elfFullName[LF_FULLFACESIZE]; + WCHAR elfStyle[LF_FACESIZE]; + WCHAR elfScript[LF_FACESIZE]; + } ENUMLOGFONTEXW,*LPENUMLOGFONTEXW; +#ifdef UNICODE + typedef ENUMLOGFONTEXW ENUMLOGFONTEX; + typedef LPENUMLOGFONTEXW LPENUMLOGFONTEX; +#else + typedef ENUMLOGFONTEXA ENUMLOGFONTEX; + typedef LPENUMLOGFONTEXA LPENUMLOGFONTEX; +#endif + +#define OUT_DEFAULT_PRECIS 0 +#define OUT_STRING_PRECIS 1 +#define OUT_CHARACTER_PRECIS 2 +#define OUT_STROKE_PRECIS 3 +#define OUT_TT_PRECIS 4 +#define OUT_DEVICE_PRECIS 5 +#define OUT_RASTER_PRECIS 6 +#define OUT_TT_ONLY_PRECIS 7 +#define OUT_OUTLINE_PRECIS 8 +#define OUT_SCREEN_OUTLINE_PRECIS 9 +#define OUT_PS_ONLY_PRECIS 10 + +#define CLIP_DEFAULT_PRECIS 0 +#define CLIP_CHARACTER_PRECIS 1 +#define CLIP_STROKE_PRECIS 2 +#define CLIP_MASK 0xf +#define CLIP_LH_ANGLES (1<<4) +#define CLIP_TT_ALWAYS (2<<4) +#define CLIP_DFA_DISABLE (4<<4) +#define CLIP_EMBEDDED (8<<4) + +#define DEFAULT_QUALITY 0 +#define DRAFT_QUALITY 1 +#define PROOF_QUALITY 2 +#define NONANTIALIASED_QUALITY 3 +#define ANTIALIASED_QUALITY 4 + +#define CLEARTYPE_QUALITY 5 +#define CLEARTYPE_NATURAL_QUALITY 6 + +#define DEFAULT_PITCH 0 +#define FIXED_PITCH 1 +#define VARIABLE_PITCH 2 +#define MONO_FONT 8 + +#define ANSI_CHARSET 0 +#define DEFAULT_CHARSET 1 +#define SYMBOL_CHARSET 2 +#define SHIFTJIS_CHARSET 128 +#define HANGEUL_CHARSET 129 +#define HANGUL_CHARSET 129 +#define GB2312_CHARSET 134 +#define CHINESEBIG5_CHARSET 136 +#define OEM_CHARSET 255 +#define JOHAB_CHARSET 130 +#define HEBREW_CHARSET 177 +#define ARABIC_CHARSET 178 +#define GREEK_CHARSET 161 +#define TURKISH_CHARSET 162 +#define VIETNAMESE_CHARSET 163 +#define THAI_CHARSET 222 +#define EASTEUROPE_CHARSET 238 +#define RUSSIAN_CHARSET 204 + +#define MAC_CHARSET 77 +#define BALTIC_CHARSET 186 + +#define FS_LATIN1 0x00000001L +#define FS_LATIN2 0x00000002L +#define FS_CYRILLIC 0x00000004L +#define FS_GREEK 0x00000008L +#define FS_TURKISH 0x00000010L +#define FS_HEBREW 0x00000020L +#define FS_ARABIC 0x00000040L +#define FS_BALTIC 0x00000080L +#define FS_VIETNAMESE 0x00000100L +#define FS_THAI 0x00010000L +#define FS_JISJAPAN 0x00020000L +#define FS_CHINESESIMP 0x00040000L +#define FS_WANSUNG 0x00080000L +#define FS_CHINESETRAD 0x00100000L +#define FS_JOHAB 0x00200000L +#define FS_SYMBOL 0x80000000L + +#define FF_DONTCARE (0<<4) +#define FF_ROMAN (1<<4) + +#define FF_SWISS (2<<4) + +#define FF_MODERN (3<<4) + +#define FF_SCRIPT (4<<4) +#define FF_DECORATIVE (5<<4) + +#define FW_DONTCARE 0 +#define FW_THIN 100 +#define FW_EXTRALIGHT 200 +#define FW_LIGHT 300 +#define FW_NORMAL 400 +#define FW_MEDIUM 500 +#define FW_SEMIBOLD 600 +#define FW_BOLD 700 +#define FW_EXTRABOLD 800 +#define FW_HEAVY 900 + +#define FW_ULTRALIGHT FW_EXTRALIGHT +#define FW_REGULAR FW_NORMAL +#define FW_DEMIBOLD FW_SEMIBOLD +#define FW_ULTRABOLD FW_EXTRABOLD +#define FW_BLACK FW_HEAVY + +#define PANOSE_COUNT 10 +#define PAN_FAMILYTYPE_INDEX 0 +#define PAN_SERIFSTYLE_INDEX 1 +#define PAN_WEIGHT_INDEX 2 +#define PAN_PROPORTION_INDEX 3 +#define PAN_CONTRAST_INDEX 4 +#define PAN_STROKEVARIATION_INDEX 5 +#define PAN_ARMSTYLE_INDEX 6 +#define PAN_LETTERFORM_INDEX 7 +#define PAN_MIDLINE_INDEX 8 +#define PAN_XHEIGHT_INDEX 9 + +#define PAN_CULTURE_LATIN 0 + + typedef struct tagPANOSE { + BYTE bFamilyType; + BYTE bSerifStyle; + BYTE bWeight; + BYTE bProportion; + BYTE bContrast; + BYTE bStrokeVariation; + BYTE bArmStyle; + BYTE bLetterform; + BYTE bMidline; + BYTE bXHeight; + } PANOSE,*LPPANOSE; + +#define PAN_ANY 0 +#define PAN_NO_FIT 1 + +#define PAN_FAMILY_TEXT_DISPLAY 2 +#define PAN_FAMILY_SCRIPT 3 +#define PAN_FAMILY_DECORATIVE 4 +#define PAN_FAMILY_PICTORIAL 5 + +#define PAN_SERIF_COVE 2 +#define PAN_SERIF_OBTUSE_COVE 3 +#define PAN_SERIF_SQUARE_COVE 4 +#define PAN_SERIF_OBTUSE_SQUARE_COVE 5 +#define PAN_SERIF_SQUARE 6 +#define PAN_SERIF_THIN 7 +#define PAN_SERIF_BONE 8 +#define PAN_SERIF_EXAGGERATED 9 +#define PAN_SERIF_TRIANGLE 10 +#define PAN_SERIF_NORMAL_SANS 11 +#define PAN_SERIF_OBTUSE_SANS 12 +#define PAN_SERIF_PERP_SANS 13 +#define PAN_SERIF_FLARED 14 +#define PAN_SERIF_ROUNDED 15 + +#define PAN_WEIGHT_VERY_LIGHT 2 +#define PAN_WEIGHT_LIGHT 3 +#define PAN_WEIGHT_THIN 4 +#define PAN_WEIGHT_BOOK 5 +#define PAN_WEIGHT_MEDIUM 6 +#define PAN_WEIGHT_DEMI 7 +#define PAN_WEIGHT_BOLD 8 +#define PAN_WEIGHT_HEAVY 9 +#define PAN_WEIGHT_BLACK 10 +#define PAN_WEIGHT_NORD 11 + +#define PAN_PROP_OLD_STYLE 2 +#define PAN_PROP_MODERN 3 +#define PAN_PROP_EVEN_WIDTH 4 +#define PAN_PROP_EXPANDED 5 +#define PAN_PROP_CONDENSED 6 +#define PAN_PROP_VERY_EXPANDED 7 +#define PAN_PROP_VERY_CONDENSED 8 +#define PAN_PROP_MONOSPACED 9 + +#define PAN_CONTRAST_NONE 2 +#define PAN_CONTRAST_VERY_LOW 3 +#define PAN_CONTRAST_LOW 4 +#define PAN_CONTRAST_MEDIUM_LOW 5 +#define PAN_CONTRAST_MEDIUM 6 +#define PAN_CONTRAST_MEDIUM_HIGH 7 +#define PAN_CONTRAST_HIGH 8 +#define PAN_CONTRAST_VERY_HIGH 9 + +#define PAN_STROKE_GRADUAL_DIAG 2 +#define PAN_STROKE_GRADUAL_TRAN 3 +#define PAN_STROKE_GRADUAL_VERT 4 +#define PAN_STROKE_GRADUAL_HORZ 5 +#define PAN_STROKE_RAPID_VERT 6 +#define PAN_STROKE_RAPID_HORZ 7 +#define PAN_STROKE_INSTANT_VERT 8 + +#define PAN_STRAIGHT_ARMS_HORZ 2 +#define PAN_STRAIGHT_ARMS_WEDGE 3 +#define PAN_STRAIGHT_ARMS_VERT 4 +#define PAN_STRAIGHT_ARMS_SINGLE_SERIF 5 +#define PAN_STRAIGHT_ARMS_DOUBLE_SERIF 6 +#define PAN_BENT_ARMS_HORZ 7 +#define PAN_BENT_ARMS_WEDGE 8 +#define PAN_BENT_ARMS_VERT 9 +#define PAN_BENT_ARMS_SINGLE_SERIF 10 +#define PAN_BENT_ARMS_DOUBLE_SERIF 11 + +#define PAN_LETT_NORMAL_CONTACT 2 +#define PAN_LETT_NORMAL_WEIGHTED 3 +#define PAN_LETT_NORMAL_BOXED 4 +#define PAN_LETT_NORMAL_FLATTENED 5 +#define PAN_LETT_NORMAL_ROUNDED 6 +#define PAN_LETT_NORMAL_OFF_CENTER 7 +#define PAN_LETT_NORMAL_SQUARE 8 +#define PAN_LETT_OBLIQUE_CONTACT 9 +#define PAN_LETT_OBLIQUE_WEIGHTED 10 +#define PAN_LETT_OBLIQUE_BOXED 11 +#define PAN_LETT_OBLIQUE_FLATTENED 12 +#define PAN_LETT_OBLIQUE_ROUNDED 13 +#define PAN_LETT_OBLIQUE_OFF_CENTER 14 +#define PAN_LETT_OBLIQUE_SQUARE 15 + +#define PAN_MIDLINE_STANDARD_TRIMMED 2 +#define PAN_MIDLINE_STANDARD_POINTED 3 +#define PAN_MIDLINE_STANDARD_SERIFED 4 +#define PAN_MIDLINE_HIGH_TRIMMED 5 +#define PAN_MIDLINE_HIGH_POINTED 6 +#define PAN_MIDLINE_HIGH_SERIFED 7 +#define PAN_MIDLINE_CONSTANT_TRIMMED 8 +#define PAN_MIDLINE_CONSTANT_POINTED 9 +#define PAN_MIDLINE_CONSTANT_SERIFED 10 +#define PAN_MIDLINE_LOW_TRIMMED 11 +#define PAN_MIDLINE_LOW_POINTED 12 +#define PAN_MIDLINE_LOW_SERIFED 13 + +#define PAN_XHEIGHT_CONSTANT_SMALL 2 +#define PAN_XHEIGHT_CONSTANT_STD 3 +#define PAN_XHEIGHT_CONSTANT_LARGE 4 +#define PAN_XHEIGHT_DUCKING_SMALL 5 +#define PAN_XHEIGHT_DUCKING_STD 6 +#define PAN_XHEIGHT_DUCKING_LARGE 7 + +#define ELF_VENDOR_SIZE 4 + + typedef struct tagEXTLOGFONTA { + LOGFONTA elfLogFont; + BYTE elfFullName[LF_FULLFACESIZE]; + BYTE elfStyle[LF_FACESIZE]; + DWORD elfVersion; + DWORD elfStyleSize; + DWORD elfMatch; + DWORD elfReserved; + BYTE elfVendorId[ELF_VENDOR_SIZE]; + DWORD elfCulture; + PANOSE elfPanose; + } EXTLOGFONTA,*PEXTLOGFONTA,*NPEXTLOGFONTA,*LPEXTLOGFONTA; + + typedef struct tagEXTLOGFONTW { + LOGFONTW elfLogFont; + WCHAR elfFullName[LF_FULLFACESIZE]; + WCHAR elfStyle[LF_FACESIZE]; + DWORD elfVersion; + DWORD elfStyleSize; + DWORD elfMatch; + DWORD elfReserved; + BYTE elfVendorId[ELF_VENDOR_SIZE]; + DWORD elfCulture; + PANOSE elfPanose; + } EXTLOGFONTW,*PEXTLOGFONTW,*NPEXTLOGFONTW,*LPEXTLOGFONTW; +#ifdef UNICODE + typedef EXTLOGFONTW EXTLOGFONT; + typedef PEXTLOGFONTW PEXTLOGFONT; + typedef NPEXTLOGFONTW NPEXTLOGFONT; + typedef LPEXTLOGFONTW LPEXTLOGFONT; +#else + typedef EXTLOGFONTA EXTLOGFONT; + typedef PEXTLOGFONTA PEXTLOGFONT; + typedef NPEXTLOGFONTA NPEXTLOGFONT; + typedef LPEXTLOGFONTA LPEXTLOGFONT; +#endif + +#define ELF_VERSION 0 +#define ELF_CULTURE_LATIN 0 + +#define RASTER_FONTTYPE 0x0001 +#define DEVICE_FONTTYPE 0x002 +#define TRUETYPE_FONTTYPE 0x004 + +#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) +#define PALETTERGB(r,g,b) (0x02000000 | RGB(r,g,b)) +#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) + +#define PC_RESERVED 0x01 +#define PC_EXPLICIT 0x02 +#define PC_NOCOLLAPSE 0x04 + +#define GetRValue(rgb) (LOBYTE(rgb)) +#define GetGValue(rgb) (LOBYTE(((WORD)(rgb)) >> 8)) +#define GetBValue(rgb) (LOBYTE((rgb)>>16)) + +#define TRANSPARENT 1 +#define OPAQUE 2 +#define BKMODE_LAST 2 + +#define GM_COMPATIBLE 1 +#define GM_ADVANCED 2 +#define GM_LAST 2 + +#define PT_CLOSEFIGURE 0x01 +#define PT_LINETO 0x02 +#define PT_BEZIERTO 0x04 +#define PT_MOVETO 0x06 + +#define MM_TEXT 1 +#define MM_LOMETRIC 2 +#define MM_HIMETRIC 3 +#define MM_LOENGLISH 4 +#define MM_HIENGLISH 5 +#define MM_TWIPS 6 +#define MM_ISOTROPIC 7 +#define MM_ANISOTROPIC 8 + +#define MM_MIN MM_TEXT +#define MM_MAX MM_ANISOTROPIC +#define MM_MAX_FIXEDSCALE MM_TWIPS + +#define ABSOLUTE 1 +#define RELATIVE 2 + +#define WHITE_BRUSH 0 +#define LTGRAY_BRUSH 1 +#define GRAY_BRUSH 2 +#define DKGRAY_BRUSH 3 +#define BLACK_BRUSH 4 +#define NULL_BRUSH 5 +#define HOLLOW_BRUSH NULL_BRUSH +#define WHITE_PEN 6 +#define BLACK_PEN 7 +#define NULL_PEN 8 +#define OEM_FIXED_FONT 10 +#define ANSI_FIXED_FONT 11 +#define ANSI_VAR_FONT 12 +#define SYSTEM_FONT 13 +#define DEVICE_DEFAULT_FONT 14 +#define DEFAULT_PALETTE 15 +#define SYSTEM_FIXED_FONT 16 + +#define DEFAULT_GUI_FONT 17 + +#define DC_BRUSH 18 +#define DC_PEN 19 + +#define STOCK_LAST 19 + +#define CLR_INVALID 0xFFFFFFFF + +#define BS_SOLID 0 +#define BS_NULL 1 +#define BS_HOLLOW BS_NULL +#define BS_HATCHED 2 +#define BS_PATTERN 3 +#define BS_INDEXED 4 +#define BS_DIBPATTERN 5 +#define BS_DIBPATTERNPT 6 +#define BS_PATTERN8X8 7 +#define BS_DIBPATTERN8X8 8 +#define BS_MONOPATTERN 9 + +#define HS_HORIZONTAL 0 +#define HS_VERTICAL 1 +#define HS_FDIAGONAL 2 +#define HS_BDIAGONAL 3 +#define HS_CROSS 4 +#define HS_DIAGCROSS 5 + +#define PS_SOLID 0 +#define PS_DASH 1 +#define PS_DOT 2 +#define PS_DASHDOT 3 +#define PS_DASHDOTDOT 4 +#define PS_NULL 5 +#define PS_INSIDEFRAME 6 +#define PS_USERSTYLE 7 +#define PS_ALTERNATE 8 +#define PS_STYLE_MASK 0x0000000F + +#define PS_ENDCAP_ROUND 0x00000000 +#define PS_ENDCAP_SQUARE 0x00000100 +#define PS_ENDCAP_FLAT 0x00000200 +#define PS_ENDCAP_MASK 0x00000F00 + +#define PS_JOIN_ROUND 0x00000000 +#define PS_JOIN_BEVEL 0x00001000 +#define PS_JOIN_MITER 0x00002000 +#define PS_JOIN_MASK 0x0000F000 + +#define PS_COSMETIC 0x00000000 +#define PS_GEOMETRIC 0x00010000 +#define PS_TYPE_MASK 0x000F0000 + +#define AD_COUNTERCLOCKWISE 1 +#define AD_CLOCKWISE 2 + +#define DRIVERVERSION 0 +#define TECHNOLOGY 2 +#define HORZSIZE 4 +#define VERTSIZE 6 +#define HORZRES 8 +#define VERTRES 10 +#define BITSPIXEL 12 +#define PLANES 14 +#define NUMBRUSHES 16 +#define NUMPENS 18 +#define NUMMARKERS 20 +#define NUMFONTS 22 +#define NUMCOLORS 24 +#define PDEVICESIZE 26 +#define CURVECAPS 28 +#define LINECAPS 30 +#define POLYGONALCAPS 32 +#define TEXTCAPS 34 +#define CLIPCAPS 36 +#define RASTERCAPS 38 +#define ASPECTX 40 +#define ASPECTY 42 +#define ASPECTXY 44 + +#define LOGPIXELSX 88 +#define LOGPIXELSY 90 + +#define SIZEPALETTE 104 +#define NUMRESERVED 106 +#define COLORRES 108 + +#define PHYSICALWIDTH 110 +#define PHYSICALHEIGHT 111 +#define PHYSICALOFFSETX 112 +#define PHYSICALOFFSETY 113 +#define SCALINGFACTORX 114 +#define SCALINGFACTORY 115 + +#define VREFRESH 116 + +#define DESKTOPVERTRES 117 + +#define DESKTOPHORZRES 118 + +#define BLTALIGNMENT 119 + +#define SHADEBLENDCAPS 120 +#define COLORMGMTCAPS 121 + +#ifndef NOGDICAPMASKS +#define DT_PLOTTER 0 +#define DT_RASDISPLAY 1 +#define DT_RASPRINTER 2 +#define DT_RASCAMERA 3 +#define DT_CHARSTREAM 4 +#define DT_METAFILE 5 +#define DT_DISPFILE 6 + +#define CC_NONE 0 +#define CC_CIRCLES 1 +#define CC_PIE 2 +#define CC_CHORD 4 +#define CC_ELLIPSES 8 +#define CC_WIDE 16 +#define CC_STYLED 32 +#define CC_WIDESTYLED 64 +#define CC_INTERIORS 128 +#define CC_ROUNDRECT 256 + +#define LC_NONE 0 +#define LC_POLYLINE 2 +#define LC_MARKER 4 +#define LC_POLYMARKER 8 +#define LC_WIDE 16 +#define LC_STYLED 32 +#define LC_WIDESTYLED 64 +#define LC_INTERIORS 128 + +#define PC_NONE 0 +#define PC_POLYGON 1 +#define PC_RECTANGLE 2 +#define PC_WINDPOLYGON 4 +#define PC_TRAPEZOID 4 +#define PC_SCANLINE 8 +#define PC_WIDE 16 +#define PC_STYLED 32 +#define PC_WIDESTYLED 64 +#define PC_INTERIORS 128 +#define PC_POLYPOLYGON 256 +#define PC_PATHS 512 + +#define CP_NONE 0 +#define CP_RECTANGLE 1 +#define CP_REGION 2 + +#define TC_OP_CHARACTER 0x00000001 +#define TC_OP_STROKE 0x00000002 +#define TC_CP_STROKE 0x00000004 +#define TC_CR_90 0x00000008 +#define TC_CR_ANY 0x00000010 +#define TC_SF_X_YINDEP 0x00000020 +#define TC_SA_DOUBLE 0x00000040 +#define TC_SA_INTEGER 0x00000080 +#define TC_SA_CONTIN 0x00000100 +#define TC_EA_DOUBLE 0x00000200 +#define TC_IA_ABLE 0x00000400 +#define TC_UA_ABLE 0x00000800 +#define TC_SO_ABLE 0x00001000 +#define TC_RA_ABLE 0x00002000 +#define TC_VA_ABLE 0x00004000 +#define TC_RESERVED 0x00008000 +#define TC_SCROLLBLT 0x00010000 +#endif + +#define RC_NONE +#define RC_BITBLT 1 +#define RC_BANDING 2 +#define RC_SCALING 4 +#define RC_BITMAP64 8 +#define RC_GDI20_OUTPUT 0x0010 +#define RC_GDI20_STATE 0x0020 +#define RC_SAVEBITMAP 0x0040 +#define RC_DI_BITMAP 0x0080 +#define RC_PALETTE 0x0100 +#define RC_DIBTODEV 0x0200 +#define RC_BIGFONT 0x0400 +#define RC_STRETCHBLT 0x0800 +#define RC_FLOODFILL 0x1000 +#define RC_STRETCHDIB 0x2000 +#define RC_OP_DX_OUTPUT 0x4000 +#define RC_DEVBITS 0x8000 + +#define SB_NONE 0x00000000 +#define SB_CONST_ALPHA 0x00000001 +#define SB_PIXEL_ALPHA 0x00000002 +#define SB_PREMULT_ALPHA 0x00000004 + +#define SB_GRAD_RECT 0x00000010 +#define SB_GRAD_TRI 0x00000020 + +#define CM_NONE 0x00000000 +#define CM_DEVICE_ICM 0x00000001 +#define CM_GAMMA_RAMP 0x00000002 +#define CM_CMYK_COLOR 0x00000004 + +#define DIB_RGB_COLORS 0 +#define DIB_PAL_COLORS 1 + +#define SYSPAL_ERROR 0 +#define SYSPAL_STATIC 1 +#define SYSPAL_NOSTATIC 2 +#define SYSPAL_NOSTATIC256 3 + +#define CBM_INIT 0x04L + +#define FLOODFILLBORDER 0 +#define FLOODFILLSURFACE 1 + +#define CCHDEVICENAME 32 + +#define CCHFORMNAME 32 + + typedef struct _devicemodeA { + BYTE dmDeviceName[CCHDEVICENAME]; + WORD dmSpecVersion; + WORD dmDriverVersion; + WORD dmSize; + WORD dmDriverExtra; + DWORD dmFields; + union { + struct { + short dmOrientation; + short dmPaperSize; + short dmPaperLength; + short dmPaperWidth; + short dmScale; + short dmCopies; + short dmDefaultSource; + short dmPrintQuality; + }; + struct { + POINTL dmPosition; + DWORD dmDisplayOrientation; + DWORD dmDisplayFixedOutput; + }; + }; + short dmColor; + short dmDuplex; + short dmYResolution; + short dmTTOption; + short dmCollate; + BYTE dmFormName[CCHFORMNAME]; + WORD dmLogPixels; + DWORD dmBitsPerPel; + DWORD dmPelsWidth; + DWORD dmPelsHeight; + union { + DWORD dmDisplayFlags; + DWORD dmNup; + }; + DWORD dmDisplayFrequency; + DWORD dmICMMethod; + DWORD dmICMIntent; + DWORD dmMediaType; + DWORD dmDitherType; + DWORD dmReserved1; + DWORD dmReserved2; + DWORD dmPanningWidth; + DWORD dmPanningHeight; + } DEVMODEA,*PDEVMODEA,*NPDEVMODEA,*LPDEVMODEA; + + typedef struct _devicemodeW { + WCHAR dmDeviceName[CCHDEVICENAME]; + WORD dmSpecVersion; + WORD dmDriverVersion; + WORD dmSize; + WORD dmDriverExtra; + DWORD dmFields; + union { + struct { + short dmOrientation; + short dmPaperSize; + short dmPaperLength; + short dmPaperWidth; + short dmScale; + short dmCopies; + short dmDefaultSource; + short dmPrintQuality; + }; + struct { + POINTL dmPosition; + DWORD dmDisplayOrientation; + DWORD dmDisplayFixedOutput; + }; + }; + short dmColor; + short dmDuplex; + short dmYResolution; + short dmTTOption; + short dmCollate; + WCHAR dmFormName[CCHFORMNAME]; + WORD dmLogPixels; + DWORD dmBitsPerPel; + DWORD dmPelsWidth; + DWORD dmPelsHeight; + union { + DWORD dmDisplayFlags; + DWORD dmNup; + }; + DWORD dmDisplayFrequency; + DWORD dmICMMethod; + DWORD dmICMIntent; + DWORD dmMediaType; + DWORD dmDitherType; + DWORD dmReserved1; + DWORD dmReserved2; + DWORD dmPanningWidth; + DWORD dmPanningHeight; + } DEVMODEW,*PDEVMODEW,*NPDEVMODEW,*LPDEVMODEW; +#ifdef UNICODE + typedef DEVMODEW DEVMODE; + typedef PDEVMODEW PDEVMODE; + typedef NPDEVMODEW NPDEVMODE; + typedef LPDEVMODEW LPDEVMODE; +#else + typedef DEVMODEA DEVMODE; + typedef PDEVMODEA PDEVMODE; + typedef NPDEVMODEA NPDEVMODE; + typedef LPDEVMODEA LPDEVMODE; +#endif + +#define DM_SPECVERSION 0x0401 + +#define DM_ORIENTATION 0x00000001L +#define DM_PAPERSIZE 0x00000002L +#define DM_PAPERLENGTH 0x00000004L +#define DM_PAPERWIDTH 0x00000008L +#define DM_SCALE 0x00000010L +#define DM_POSITION 0x00000020L +#define DM_NUP 0x00000040L +#define DM_DISPLAYORIENTATION 0x00000080L +#define DM_COPIES 0x00000100L +#define DM_DEFAULTSOURCE 0x00000200L +#define DM_PRINTQUALITY 0x00000400L +#define DM_COLOR 0x00000800L +#define DM_DUPLEX 0x00001000L +#define DM_YRESOLUTION 0x00002000L +#define DM_TTOPTION 0x00004000L +#define DM_COLLATE 0x00008000L +#define DM_FORMNAME 0x00010000L +#define DM_LOGPIXELS 0x00020000L +#define DM_BITSPERPEL 0x00040000L +#define DM_PELSWIDTH 0x00080000L +#define DM_PELSHEIGHT 0x00100000L +#define DM_DISPLAYFLAGS 0x00200000L +#define DM_DISPLAYFREQUENCY 0x00400000L +#define DM_ICMMETHOD 0x00800000L +#define DM_ICMINTENT 0x01000000L +#define DM_MEDIATYPE 0x02000000L +#define DM_DITHERTYPE 0x04000000L +#define DM_PANNINGWIDTH 0x08000000L +#define DM_PANNINGHEIGHT 0x10000000L +#define DM_DISPLAYFIXEDOUTPUT 0x20000000L + +#define DMORIENT_PORTRAIT 1 +#define DMORIENT_LANDSCAPE 2 + +#define DMPAPER_FIRST DMPAPER_LETTER +#define DMPAPER_LETTER 1 +#define DMPAPER_LETTERSMALL 2 +#define DMPAPER_TABLOID 3 +#define DMPAPER_LEDGER 4 +#define DMPAPER_LEGAL 5 +#define DMPAPER_STATEMENT 6 +#define DMPAPER_EXECUTIVE 7 +#define DMPAPER_A3 8 +#define DMPAPER_A4 9 +#define DMPAPER_A4SMALL 10 +#define DMPAPER_A5 11 +#define DMPAPER_B4 12 +#define DMPAPER_B5 13 +#define DMPAPER_FOLIO 14 +#define DMPAPER_QUARTO 15 +#define DMPAPER_10X14 16 +#define DMPAPER_11X17 17 +#define DMPAPER_NOTE 18 +#define DMPAPER_ENV_9 19 +#define DMPAPER_ENV_10 20 +#define DMPAPER_ENV_11 21 +#define DMPAPER_ENV_12 22 +#define DMPAPER_ENV_14 23 +#define DMPAPER_CSHEET 24 +#define DMPAPER_DSHEET 25 +#define DMPAPER_ESHEET 26 +#define DMPAPER_ENV_DL 27 +#define DMPAPER_ENV_C5 28 +#define DMPAPER_ENV_C3 29 +#define DMPAPER_ENV_C4 30 +#define DMPAPER_ENV_C6 31 +#define DMPAPER_ENV_C65 32 +#define DMPAPER_ENV_B4 33 +#define DMPAPER_ENV_B5 34 +#define DMPAPER_ENV_B6 35 +#define DMPAPER_ENV_ITALY 36 +#define DMPAPER_ENV_MONARCH 37 +#define DMPAPER_ENV_PERSONAL 38 +#define DMPAPER_FANFOLD_US 39 +#define DMPAPER_FANFOLD_STD_GERMAN 40 +#define DMPAPER_FANFOLD_LGL_GERMAN 41 +#define DMPAPER_ISO_B4 42 +#define DMPAPER_JAPANESE_POSTCARD 43 +#define DMPAPER_9X11 44 +#define DMPAPER_10X11 45 +#define DMPAPER_15X11 46 +#define DMPAPER_ENV_INVITE 47 +#define DMPAPER_RESERVED_48 48 +#define DMPAPER_RESERVED_49 49 +#define DMPAPER_LETTER_EXTRA 50 +#define DMPAPER_LEGAL_EXTRA 51 +#define DMPAPER_TABLOID_EXTRA 52 +#define DMPAPER_A4_EXTRA 53 +#define DMPAPER_LETTER_TRANSVERSE 54 +#define DMPAPER_A4_TRANSVERSE 55 +#define DMPAPER_LETTER_EXTRA_TRANSVERSE 56 +#define DMPAPER_A_PLUS 57 +#define DMPAPER_B_PLUS 58 +#define DMPAPER_LETTER_PLUS 59 +#define DMPAPER_A4_PLUS 60 +#define DMPAPER_A5_TRANSVERSE 61 +#define DMPAPER_B5_TRANSVERSE 62 +#define DMPAPER_A3_EXTRA 63 +#define DMPAPER_A5_EXTRA 64 +#define DMPAPER_B5_EXTRA 65 +#define DMPAPER_A2 66 +#define DMPAPER_A3_TRANSVERSE 67 +#define DMPAPER_A3_EXTRA_TRANSVERSE 68 +#define DMPAPER_DBL_JAPANESE_POSTCARD 69 +#define DMPAPER_A6 70 +#define DMPAPER_JENV_KAKU2 71 +#define DMPAPER_JENV_KAKU3 72 +#define DMPAPER_JENV_CHOU3 73 +#define DMPAPER_JENV_CHOU4 74 +#define DMPAPER_LETTER_ROTATED 75 +#define DMPAPER_A3_ROTATED 76 +#define DMPAPER_A4_ROTATED 77 +#define DMPAPER_A5_ROTATED 78 +#define DMPAPER_B4_JIS_ROTATED 79 +#define DMPAPER_B5_JIS_ROTATED 80 +#define DMPAPER_JAPANESE_POSTCARD_ROTATED 81 +#define DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED 82 +#define DMPAPER_A6_ROTATED 83 +#define DMPAPER_JENV_KAKU2_ROTATED 84 +#define DMPAPER_JENV_KAKU3_ROTATED 85 +#define DMPAPER_JENV_CHOU3_ROTATED 86 +#define DMPAPER_JENV_CHOU4_ROTATED 87 +#define DMPAPER_B6_JIS 88 +#define DMPAPER_B6_JIS_ROTATED 89 +#define DMPAPER_12X11 90 +#define DMPAPER_JENV_YOU4 91 +#define DMPAPER_JENV_YOU4_ROTATED 92 +#define DMPAPER_P16K 93 +#define DMPAPER_P32K 94 +#define DMPAPER_P32KBIG 95 +#define DMPAPER_PENV_1 96 +#define DMPAPER_PENV_2 97 +#define DMPAPER_PENV_3 98 +#define DMPAPER_PENV_4 99 +#define DMPAPER_PENV_5 100 +#define DMPAPER_PENV_6 101 +#define DMPAPER_PENV_7 102 +#define DMPAPER_PENV_8 103 +#define DMPAPER_PENV_9 104 +#define DMPAPER_PENV_10 105 +#define DMPAPER_P16K_ROTATED 106 +#define DMPAPER_P32K_ROTATED 107 +#define DMPAPER_P32KBIG_ROTATED 108 +#define DMPAPER_PENV_1_ROTATED 109 +#define DMPAPER_PENV_2_ROTATED 110 +#define DMPAPER_PENV_3_ROTATED 111 +#define DMPAPER_PENV_4_ROTATED 112 +#define DMPAPER_PENV_5_ROTATED 113 +#define DMPAPER_PENV_6_ROTATED 114 +#define DMPAPER_PENV_7_ROTATED 115 +#define DMPAPER_PENV_8_ROTATED 116 +#define DMPAPER_PENV_9_ROTATED 117 +#define DMPAPER_PENV_10_ROTATED 118 + +#define DMPAPER_LAST DMPAPER_PENV_10_ROTATED + +#define DMPAPER_USER 256 + +#define DMBIN_FIRST DMBIN_UPPER +#define DMBIN_UPPER 1 +#define DMBIN_ONLYONE 1 +#define DMBIN_LOWER 2 +#define DMBIN_MIDDLE 3 +#define DMBIN_MANUAL 4 +#define DMBIN_ENVELOPE 5 +#define DMBIN_ENVMANUAL 6 +#define DMBIN_AUTO 7 +#define DMBIN_TRACTOR 8 +#define DMBIN_SMALLFMT 9 +#define DMBIN_LARGEFMT 10 +#define DMBIN_LARGECAPACITY 11 +#define DMBIN_CASSETTE 14 +#define DMBIN_FORMSOURCE 15 +#define DMBIN_LAST DMBIN_FORMSOURCE + +#define DMBIN_USER 256 + +#define DMRES_DRAFT (-1) +#define DMRES_LOW (-2) +#define DMRES_MEDIUM (-3) +#define DMRES_HIGH (-4) + +#define DMCOLOR_MONOCHROME 1 +#define DMCOLOR_COLOR 2 + +#define DMDUP_SIMPLEX 1 +#define DMDUP_VERTICAL 2 +#define DMDUP_HORIZONTAL 3 + +#define DMTT_BITMAP 1 +#define DMTT_DOWNLOAD 2 +#define DMTT_SUBDEV 3 +#define DMTT_DOWNLOAD_OUTLINE 4 + +#define DMCOLLATE_FALSE 0 +#define DMCOLLATE_TRUE 1 + +#define DMDO_DEFAULT 0 +#define DMDO_90 1 +#define DMDO_180 2 +#define DMDO_270 3 + +#define DMDFO_DEFAULT 0 +#define DMDFO_STRETCH 1 +#define DMDFO_CENTER 2 + +#define DMDISPLAYFLAGS_TEXTMODE 0x00000004 + +#define DMNUP_SYSTEM 1 +#define DMNUP_ONEUP 2 + +#define DMICMMETHOD_NONE 1 +#define DMICMMETHOD_SYSTEM 2 +#define DMICMMETHOD_DRIVER 3 +#define DMICMMETHOD_DEVICE 4 + +#define DMICMMETHOD_USER 256 + +#define DMICM_SATURATE 1 +#define DMICM_CONTRAST 2 +#define DMICM_COLORIMETRIC 3 +#define DMICM_ABS_COLORIMETRIC 4 + +#define DMICM_USER 256 + +#define DMMEDIA_STANDARD 1 +#define DMMEDIA_TRANSPARENCY 2 +#define DMMEDIA_GLOSSY 3 + +#define DMMEDIA_USER 256 + +#define DMDITHER_NONE 1 +#define DMDITHER_COARSE 2 +#define DMDITHER_FINE 3 +#define DMDITHER_LINEART 4 +#define DMDITHER_ERRORDIFFUSION 5 +#define DMDITHER_RESERVED6 6 +#define DMDITHER_RESERVED7 7 +#define DMDITHER_RESERVED8 8 +#define DMDITHER_RESERVED9 9 +#define DMDITHER_GRAYSCALE 10 + +#define DMDITHER_USER 256 + + typedef struct _DISPLAY_DEVICEA { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD StateFlags; + CHAR DeviceID[128]; + CHAR DeviceKey[128]; + } DISPLAY_DEVICEA,*PDISPLAY_DEVICEA,*LPDISPLAY_DEVICEA; + typedef struct _DISPLAY_DEVICEW { + DWORD cb; + WCHAR DeviceName[32]; + WCHAR DeviceString[128]; + DWORD StateFlags; + WCHAR DeviceID[128]; + WCHAR DeviceKey[128]; + } DISPLAY_DEVICEW,*PDISPLAY_DEVICEW,*LPDISPLAY_DEVICEW; +#ifdef UNICODE + typedef DISPLAY_DEVICEW DISPLAY_DEVICE; + typedef PDISPLAY_DEVICEW PDISPLAY_DEVICE; + typedef LPDISPLAY_DEVICEW LPDISPLAY_DEVICE; +#else + typedef DISPLAY_DEVICEA DISPLAY_DEVICE; + typedef PDISPLAY_DEVICEA PDISPLAY_DEVICE; + typedef LPDISPLAY_DEVICEA LPDISPLAY_DEVICE; +#endif + +#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP 0x00000001 +#define DISPLAY_DEVICE_MULTI_DRIVER 0x00000002 +#define DISPLAY_DEVICE_PRIMARY_DEVICE 0x00000004 +#define DISPLAY_DEVICE_MIRRORING_DRIVER 0x00000008 +#define DISPLAY_DEVICE_VGA_COMPATIBLE 0x00000010 +#define DISPLAY_DEVICE_REMOVABLE 0x00000020 +#define DISPLAY_DEVICE_MODESPRUNED 0x08000000 +#define DISPLAY_DEVICE_REMOTE 0x04000000 +#define DISPLAY_DEVICE_DISCONNECT 0x02000000 + +#define DISPLAY_DEVICE_ACTIVE 0x00000001 +#define DISPLAY_DEVICE_ATTACHED 0x00000002 + +#define RDH_RECTANGLES 1 + + typedef struct _RGNDATAHEADER { + DWORD dwSize; + DWORD iType; + DWORD nCount; + DWORD nRgnSize; + RECT rcBound; + } RGNDATAHEADER,*PRGNDATAHEADER; + + typedef struct _RGNDATA { + RGNDATAHEADER rdh; + char Buffer[1]; + } RGNDATA,*PRGNDATA,*NPRGNDATA,*LPRGNDATA; + +#define SYSRGN 4 + + typedef struct _ABC { + int abcA; + UINT abcB; + int abcC; + } ABC,*PABC,*NPABC,*LPABC; + + typedef struct _ABCFLOAT { + FLOAT abcfA; + FLOAT abcfB; + FLOAT abcfC; + } ABCFLOAT,*PABCFLOAT,*NPABCFLOAT,*LPABCFLOAT; + +#ifndef NOTEXTMETRIC + + typedef struct _OUTLINETEXTMETRICA { + UINT otmSize; + TEXTMETRICA otmTextMetrics; + BYTE otmFiller; + PANOSE otmPanoseNumber; + UINT otmfsSelection; + UINT otmfsType; + int otmsCharSlopeRise; + int otmsCharSlopeRun; + int otmItalicAngle; + UINT otmEMSquare; + int otmAscent; + int otmDescent; + UINT otmLineGap; + UINT otmsCapEmHeight; + UINT otmsXHeight; + RECT otmrcFontBox; + int otmMacAscent; + int otmMacDescent; + UINT otmMacLineGap; + UINT otmusMinimumPPEM; + POINT otmptSubscriptSize; + POINT otmptSubscriptOffset; + POINT otmptSuperscriptSize; + POINT otmptSuperscriptOffset; + UINT otmsStrikeoutSize; + int otmsStrikeoutPosition; + int otmsUnderscoreSize; + int otmsUnderscorePosition; + PSTR otmpFamilyName; + PSTR otmpFaceName; + PSTR otmpStyleName; + PSTR otmpFullName; + } OUTLINETEXTMETRICA,*POUTLINETEXTMETRICA,*NPOUTLINETEXTMETRICA,*LPOUTLINETEXTMETRICA; + + typedef struct _OUTLINETEXTMETRICW { + UINT otmSize; + TEXTMETRICW otmTextMetrics; + BYTE otmFiller; + PANOSE otmPanoseNumber; + UINT otmfsSelection; + UINT otmfsType; + int otmsCharSlopeRise; + int otmsCharSlopeRun; + int otmItalicAngle; + UINT otmEMSquare; + int otmAscent; + int otmDescent; + UINT otmLineGap; + UINT otmsCapEmHeight; + UINT otmsXHeight; + RECT otmrcFontBox; + int otmMacAscent; + int otmMacDescent; + UINT otmMacLineGap; + UINT otmusMinimumPPEM; + POINT otmptSubscriptSize; + POINT otmptSubscriptOffset; + POINT otmptSuperscriptSize; + POINT otmptSuperscriptOffset; + UINT otmsStrikeoutSize; + int otmsStrikeoutPosition; + int otmsUnderscoreSize; + int otmsUnderscorePosition; + PSTR otmpFamilyName; + PSTR otmpFaceName; + PSTR otmpStyleName; + PSTR otmpFullName; + } OUTLINETEXTMETRICW,*POUTLINETEXTMETRICW,*NPOUTLINETEXTMETRICW,*LPOUTLINETEXTMETRICW; +#ifdef UNICODE + typedef OUTLINETEXTMETRICW OUTLINETEXTMETRIC; + typedef POUTLINETEXTMETRICW POUTLINETEXTMETRIC; + typedef NPOUTLINETEXTMETRICW NPOUTLINETEXTMETRIC; + typedef LPOUTLINETEXTMETRICW LPOUTLINETEXTMETRIC; +#else + typedef OUTLINETEXTMETRICA OUTLINETEXTMETRIC; + typedef POUTLINETEXTMETRICA POUTLINETEXTMETRIC; + typedef NPOUTLINETEXTMETRICA NPOUTLINETEXTMETRIC; + typedef LPOUTLINETEXTMETRICA LPOUTLINETEXTMETRIC; +#endif +#endif + + typedef struct tagPOLYTEXTA { + int x; + int y; + UINT n; + LPCSTR lpstr; + UINT uiFlags; + RECT rcl; + int *pdx; + } POLYTEXTA,*PPOLYTEXTA,*NPPOLYTEXTA,*LPPOLYTEXTA; + + typedef struct tagPOLYTEXTW { + int x; + int y; + UINT n; + LPCWSTR lpstr; + UINT uiFlags; + RECT rcl; + int *pdx; + } POLYTEXTW,*PPOLYTEXTW,*NPPOLYTEXTW,*LPPOLYTEXTW; +#ifdef UNICODE + typedef POLYTEXTW POLYTEXT; + typedef PPOLYTEXTW PPOLYTEXT; + typedef NPPOLYTEXTW NPPOLYTEXT; + typedef LPPOLYTEXTW LPPOLYTEXT; +#else + typedef POLYTEXTA POLYTEXT; + typedef PPOLYTEXTA PPOLYTEXT; + typedef NPPOLYTEXTA NPPOLYTEXT; + typedef LPPOLYTEXTA LPPOLYTEXT; +#endif + + typedef struct _FIXED { + WORD fract; + short value; + } FIXED; + + typedef struct _MAT2 { + FIXED eM11; + FIXED eM12; + FIXED eM21; + FIXED eM22; + } MAT2,*LPMAT2; + + typedef struct _GLYPHMETRICS { + UINT gmBlackBoxX; + UINT gmBlackBoxY; + POINT gmptGlyphOrigin; + short gmCellIncX; + short gmCellIncY; + } GLYPHMETRICS,*LPGLYPHMETRICS; + +#define GGO_METRICS 0 +#define GGO_BITMAP 1 +#define GGO_NATIVE 2 +#define GGO_BEZIER 3 + +#define GGO_GRAY2_BITMAP 4 +#define GGO_GRAY4_BITMAP 5 +#define GGO_GRAY8_BITMAP 6 +#define GGO_GLYPH_INDEX 0x0080 +#define GGO_UNHINTED 0x0100 + +#define TT_POLYGON_TYPE 24 + +#define TT_PRIM_LINE 1 +#define TT_PRIM_QSPLINE 2 +#define TT_PRIM_CSPLINE 3 + + typedef struct tagPOINTFX { + FIXED x; + FIXED y; + } POINTFX,*LPPOINTFX; + + typedef struct tagTTPOLYCURVE { + WORD wType; + WORD cpfx; + POINTFX apfx[1]; + } TTPOLYCURVE,*LPTTPOLYCURVE; + + typedef struct tagTTPOLYGONHEADER { + DWORD cb; + DWORD dwType; + POINTFX pfxStart; + } TTPOLYGONHEADER,*LPTTPOLYGONHEADER; + +#define GCP_DBCS 0x0001 +#define GCP_REORDER 0x0002 +#define GCP_USEKERNING 0x0008 +#define GCP_GLYPHSHAPE 0x0010 +#define GCP_LIGATE 0x0020 + +#define GCP_DIACRITIC 0x0100 +#define GCP_KASHIDA 0x0400 +#define GCP_ERROR 0x8000 +#define FLI_MASK 0x103B + +#define GCP_JUSTIFY 0x00010000L + +#define FLI_GLYPHS 0x00040000L +#define GCP_CLASSIN 0x00080000L +#define GCP_MAXEXTENT 0x00100000L +#define GCP_JUSTIFYIN 0x00200000L +#define GCP_DISPLAYZWG 0x00400000L +#define GCP_SYMSWAPOFF 0x00800000L +#define GCP_NUMERICOVERRIDE 0x01000000L +#define GCP_NEUTRALOVERRIDE 0x02000000L +#define GCP_NUMERICSLATIN 0x04000000L +#define GCP_NUMERICSLOCAL 0x08000000L + +#define GCPCLASS_LATIN 1 +#define GCPCLASS_HEBREW 2 +#define GCPCLASS_ARABIC 2 +#define GCPCLASS_NEUTRAL 3 +#define GCPCLASS_LOCALNUMBER 4 +#define GCPCLASS_LATINNUMBER 5 +#define GCPCLASS_LATINNUMERICTERMINATOR 6 +#define GCPCLASS_LATINNUMERICSEPARATOR 7 +#define GCPCLASS_NUMERICSEPARATOR 8 +#define GCPCLASS_PREBOUNDLTR 0x80 +#define GCPCLASS_PREBOUNDRTL 0x40 +#define GCPCLASS_POSTBOUNDLTR 0x20 +#define GCPCLASS_POSTBOUNDRTL 0x10 + +#define GCPGLYPH_LINKBEFORE 0x8000 +#define GCPGLYPH_LINKAFTER 0x4000 + + typedef struct tagGCP_RESULTSA { + DWORD lStructSize; + LPSTR lpOutString; + UINT *lpOrder; + int *lpDx; + int *lpCaretPos; + LPSTR lpClass; + LPWSTR lpGlyphs; + UINT nGlyphs; + int nMaxFit; + } GCP_RESULTSA,*LPGCP_RESULTSA; + typedef struct tagGCP_RESULTSW { + DWORD lStructSize; + LPWSTR lpOutString; + UINT *lpOrder; + int *lpDx; + int *lpCaretPos; + LPSTR lpClass; + LPWSTR lpGlyphs; + UINT nGlyphs; + int nMaxFit; + } GCP_RESULTSW,*LPGCP_RESULTSW; +#ifdef UNICODE + typedef GCP_RESULTSW GCP_RESULTS; + typedef LPGCP_RESULTSW LPGCP_RESULTS; +#else + typedef GCP_RESULTSA GCP_RESULTS; + typedef LPGCP_RESULTSA LPGCP_RESULTS; +#endif + + typedef struct _RASTERIZER_STATUS { + short nSize; + short wFlags; + short nLanguageID; + } RASTERIZER_STATUS,*LPRASTERIZER_STATUS; + +#define TT_AVAILABLE 0x0001 +#define TT_ENABLED 0x0002 + + typedef struct tagPIXELFORMATDESCRIPTOR { + WORD nSize; + WORD nVersion; + DWORD dwFlags; + BYTE iPixelType; + BYTE cColorBits; + BYTE cRedBits; + BYTE cRedShift; + BYTE cGreenBits; + BYTE cGreenShift; + BYTE cBlueBits; + BYTE cBlueShift; + BYTE cAlphaBits; + BYTE cAlphaShift; + BYTE cAccumBits; + BYTE cAccumRedBits; + BYTE cAccumGreenBits; + BYTE cAccumBlueBits; + BYTE cAccumAlphaBits; + BYTE cDepthBits; + BYTE cStencilBits; + BYTE cAuxBuffers; + BYTE iLayerType; + BYTE bReserved; + DWORD dwLayerMask; + DWORD dwVisibleMask; + DWORD dwDamageMask; + } PIXELFORMATDESCRIPTOR,*PPIXELFORMATDESCRIPTOR,*LPPIXELFORMATDESCRIPTOR; + +#define PFD_TYPE_RGBA 0 +#define PFD_TYPE_COLORINDEX 1 + +#define PFD_MAIN_PLANE 0 +#define PFD_OVERLAY_PLANE 1 +#define PFD_UNDERLAY_PLANE (-1) + +#define PFD_DOUBLEBUFFER 0x00000001 +#define PFD_STEREO 0x00000002 +#define PFD_DRAW_TO_WINDOW 0x00000004 +#define PFD_DRAW_TO_BITMAP 0x00000008 +#define PFD_SUPPORT_GDI 0x00000010 +#define PFD_SUPPORT_OPENGL 0x00000020 +#define PFD_GENERIC_FORMAT 0x00000040 +#define PFD_NEED_PALETTE 0x00000080 +#define PFD_NEED_SYSTEM_PALETTE 0x00000100 +#define PFD_SWAP_EXCHANGE 0x00000200 +#define PFD_SWAP_COPY 0x00000400 +#define PFD_SWAP_LAYER_BUFFERS 0x00000800 +#define PFD_GENERIC_ACCELERATED 0x00001000 +#define PFD_SUPPORT_DIRECTDRAW 0x00002000 + +#define PFD_DEPTH_DONTCARE 0x20000000 +#define PFD_DOUBLEBUFFER_DONTCARE 0x40000000 +#define PFD_STEREO_DONTCARE 0x80000000 + +#ifndef NOTEXTMETRIC + typedef int (CALLBACK *OLDFONTENUMPROCA)(CONST LOGFONTA *,CONST TEXTMETRICA *,DWORD,LPARAM); + typedef int (CALLBACK *OLDFONTENUMPROCW)(CONST LOGFONTW *,CONST TEXTMETRICW *,DWORD,LPARAM); +#ifdef UNICODE +#define OLDFONTENUMPROC OLDFONTENUMPROCW +#else +#define OLDFONTENUMPROC OLDFONTENUMPROCA +#endif +#else + typedef int (CALLBACK *OLDFONTENUMPROCA)(CONST LOGFONTA *,CONST VOID *,DWORD,LPARAM); + typedef int (CALLBACK *OLDFONTENUMPROCW)(CONST LOGFONTW *,CONST VOID *,DWORD,LPARAM); +#ifdef UNICODE +#define OLDFONTENUMPROC OLDFONTENUMPROCW +#else +#define OLDFONTENUMPROC OLDFONTENUMPROCA +#endif +#endif + + typedef OLDFONTENUMPROCA FONTENUMPROCA; + typedef OLDFONTENUMPROCW FONTENUMPROCW; +#ifdef UNICODE + typedef FONTENUMPROCW FONTENUMPROC; +#else + typedef FONTENUMPROCA FONTENUMPROC; +#endif + + typedef int (CALLBACK *GOBJENUMPROC)(LPVOID,LPARAM); + typedef VOID (CALLBACK *LINEDDAPROC)(int,int,LPARAM); + +#ifdef UNICODE +#define AddFontResource AddFontResourceW +#define CopyMetaFile CopyMetaFileW +#define CreateDC CreateDCW +#define CreateFontIndirect CreateFontIndirectW +#define CreateFont CreateFontW +#define CreateIC CreateICW +#define CreateMetaFile CreateMetaFileW +#define CreateScalableFontResource CreateScalableFontResourceW +#else +#define AddFontResource AddFontResourceA +#define CopyMetaFile CopyMetaFileA +#define CreateDC CreateDCA +#define CreateFontIndirect CreateFontIndirectA +#define CreateFont CreateFontA +#define CreateIC CreateICA +#define CreateMetaFile CreateMetaFileA +#define CreateScalableFontResource CreateScalableFontResourceA +#endif + + WINGDIAPI int WINAPI AddFontResourceA(LPCSTR); + WINGDIAPI int WINAPI AddFontResourceW(LPCWSTR); + WINGDIAPI WINBOOL WINAPI AnimatePalette(HPALETTE hPal,UINT iStartIndex,UINT cEntries,CONST PALETTEENTRY *ppe); + WINGDIAPI WINBOOL WINAPI Arc(HDC hdc,int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4); + WINGDIAPI WINBOOL WINAPI BitBlt(HDC hdc,int x,int y,int cx,int cy,HDC hdcSrc,int x1,int y1,DWORD rop); + WINGDIAPI WINBOOL WINAPI CancelDC(HDC hdc); + WINGDIAPI WINBOOL WINAPI Chord(HDC hdc,int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4); + WINGDIAPI int WINAPI ChoosePixelFormat(HDC hdc,CONST PIXELFORMATDESCRIPTOR *ppfd); + WINGDIAPI HMETAFILE WINAPI CloseMetaFile(HDC hdc); + WINGDIAPI int WINAPI CombineRgn(HRGN hrgnDst,HRGN hrgnSrc1,HRGN hrgnSrc2,int iMode); + WINGDIAPI HMETAFILE WINAPI CopyMetaFileA(HMETAFILE,LPCSTR); + WINGDIAPI HMETAFILE WINAPI CopyMetaFileW(HMETAFILE,LPCWSTR); + WINGDIAPI HBITMAP WINAPI CreateBitmap(int nWidth,int nHeight,UINT nPlanes,UINT nBitCount,CONST VOID *lpBits); + WINGDIAPI HBITMAP WINAPI CreateBitmapIndirect(CONST BITMAP *pbm); + WINGDIAPI HBRUSH WINAPI CreateBrushIndirect(CONST LOGBRUSH *plbrush); + WINGDIAPI HBITMAP WINAPI CreateCompatibleBitmap(HDC hdc,int cx,int cy); + WINGDIAPI HBITMAP WINAPI CreateDiscardableBitmap(HDC hdc,int cx,int cy); + WINGDIAPI HDC WINAPI CreateCompatibleDC(HDC hdc); + WINGDIAPI HDC WINAPI CreateDCA(LPCSTR pwszDriver,LPCSTR pwszDevice,LPCSTR pszPort,CONST DEVMODEA *pdm); + WINGDIAPI HDC WINAPI CreateDCW(LPCWSTR pwszDriver,LPCWSTR pwszDevice,LPCWSTR pszPort,CONST DEVMODEW *pdm); + WINGDIAPI HBITMAP WINAPI CreateDIBitmap(HDC hdc,CONST BITMAPINFOHEADER *pbmih,DWORD flInit,CONST VOID *pjBits,CONST BITMAPINFO *pbmi,UINT iUsage); + WINGDIAPI HBRUSH WINAPI CreateDIBPatternBrush(HGLOBAL h,UINT iUsage); + WINGDIAPI HBRUSH WINAPI CreateDIBPatternBrushPt(CONST VOID *lpPackedDIB,UINT iUsage); + WINGDIAPI HRGN WINAPI CreateEllipticRgn(int x1,int y1,int x2,int y2); + WINGDIAPI HRGN WINAPI CreateEllipticRgnIndirect(CONST RECT *lprect); + WINGDIAPI HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf); + WINGDIAPI HFONT WINAPI CreateFontIndirectW(CONST LOGFONTW *lplf); + WINGDIAPI HFONT WINAPI CreateFontA(int cHeight,int cWidth,int cEscapement,int cOrientation,int cWeight,DWORD bItalic,DWORD bUnderline,DWORD bStrikeOut,DWORD iCharSet,DWORD iOutPrecision,DWORD iClipPrecision,DWORD iQuality,DWORD iPitchAndFamily,LPCSTR pszFaceName); + WINGDIAPI HFONT WINAPI CreateFontW(int cHeight,int cWidth,int cEscapement,int cOrientation,int cWeight,DWORD bItalic,DWORD bUnderline,DWORD bStrikeOut,DWORD iCharSet,DWORD iOutPrecision,DWORD iClipPrecision,DWORD iQuality,DWORD iPitchAndFamily,LPCWSTR pszFaceName); + WINGDIAPI HBRUSH WINAPI CreateHatchBrush(int iHatch,COLORREF color); + WINGDIAPI HDC WINAPI CreateICA(LPCSTR pszDriver,LPCSTR pszDevice,LPCSTR pszPort,CONST DEVMODEA *pdm); + WINGDIAPI HDC WINAPI CreateICW(LPCWSTR pszDriver,LPCWSTR pszDevice,LPCWSTR pszPort,CONST DEVMODEW *pdm); + WINGDIAPI HDC WINAPI CreateMetaFileA(LPCSTR pszFile); + WINGDIAPI HDC WINAPI CreateMetaFileW(LPCWSTR pszFile); + WINGDIAPI HPALETTE WINAPI CreatePalette(CONST LOGPALETTE *plpal); + WINGDIAPI HPEN WINAPI CreatePen(int iStyle,int cWidth,COLORREF color); + WINGDIAPI HPEN WINAPI CreatePenIndirect(CONST LOGPEN *plpen); + WINGDIAPI HRGN WINAPI CreatePolyPolygonRgn(CONST POINT *pptl,CONST INT *pc,int cPoly,int iMode); + WINGDIAPI HBRUSH WINAPI CreatePatternBrush(HBITMAP hbm); + WINGDIAPI HRGN WINAPI CreateRectRgn(int x1,int y1,int x2,int y2); + WINGDIAPI HRGN WINAPI CreateRectRgnIndirect(CONST RECT *lprect); + WINGDIAPI HRGN WINAPI CreateRoundRectRgn(int x1,int y1,int x2,int y2,int w,int h); + WINGDIAPI WINBOOL WINAPI CreateScalableFontResourceA(DWORD fdwHidden,LPCSTR lpszFont,LPCSTR lpszFile,LPCSTR lpszPath); + WINGDIAPI WINBOOL WINAPI CreateScalableFontResourceW(DWORD fdwHidden,LPCWSTR lpszFont,LPCWSTR lpszFile,LPCWSTR lpszPath); + WINGDIAPI HBRUSH WINAPI CreateSolidBrush(COLORREF color); + WINGDIAPI WINBOOL WINAPI DeleteDC(HDC hdc); + WINGDIAPI WINBOOL WINAPI DeleteMetaFile(HMETAFILE hmf); + WINGDIAPI WINBOOL WINAPI DeleteObject(HGDIOBJ ho); + WINGDIAPI int WINAPI DescribePixelFormat(HDC hdc,int iPixelFormat,UINT nBytes,LPPIXELFORMATDESCRIPTOR ppfd); + + typedef UINT (CALLBACK *LPFNDEVMODE)(HWND,HMODULE,LPDEVMODE,LPSTR,LPSTR,LPDEVMODE,LPSTR,UINT); + typedef DWORD (CALLBACK *LPFNDEVCAPS)(LPSTR,LPSTR,UINT,LPSTR,LPDEVMODE); + +#define DM_UPDATE 1 +#define DM_COPY 2 +#define DM_PROMPT 4 +#define DM_MODIFY 8 + +#define DM_IN_BUFFER DM_MODIFY +#define DM_IN_PROMPT DM_PROMPT +#define DM_OUT_BUFFER DM_COPY +#define DM_OUT_DEFAULT DM_UPDATE + +#define DC_FIELDS 1 +#define DC_PAPERS 2 +#define DC_PAPERSIZE 3 +#define DC_MINEXTENT 4 +#define DC_MAXEXTENT 5 +#define DC_BINS 6 +#define DC_DUPLEX 7 +#define DC_SIZE 8 +#define DC_EXTRA 9 +#define DC_VERSION 10 +#define DC_DRIVER 11 +#define DC_BINNAMES 12 +#define DC_ENUMRESOLUTIONS 13 +#define DC_FILEDEPENDENCIES 14 +#define DC_TRUETYPE 15 +#define DC_PAPERNAMES 16 +#define DC_ORIENTATION 17 +#define DC_COPIES 18 +#define DC_BINADJUST 19 +#define DC_EMF_COMPLIANT 20 +#define DC_DATATYPE_PRODUCED 21 +#define DC_COLLATE 22 +#define DC_MANUFACTURER 23 +#define DC_MODEL 24 +#define DC_PERSONALITY 25 +#define DC_PRINTRATE 26 +#define DC_PRINTRATEUNIT 27 +#define PRINTRATEUNIT_PPM 1 +#define PRINTRATEUNIT_CPS 2 +#define PRINTRATEUNIT_LPM 3 +#define PRINTRATEUNIT_IPM 4 +#define DC_PRINTERMEM 28 +#define DC_MEDIAREADY 29 +#define DC_STAPLE 30 +#define DC_PRINTRATEPPM 31 +#define DC_COLORDEVICE 32 +#define DC_NUP 33 +#define DC_MEDIATYPENAMES 34 +#define DC_MEDIATYPES 35 + +#define DCTT_BITMAP 0x0000001L +#define DCTT_DOWNLOAD 0x0000002L +#define DCTT_SUBDEV 0x0000004L +#define DCTT_DOWNLOAD_OUTLINE 0x0000008L + +#define DCBA_FACEUPNONE 0x0000 +#define DCBA_FACEUPCENTER 0x0001 +#define DCBA_FACEUPLEFT 0x0002 +#define DCBA_FACEUPRIGHT 0x0003 +#define DCBA_FACEDOWNNONE 0x0100 +#define DCBA_FACEDOWNCENTER 0x0101 +#define DCBA_FACEDOWNLEFT 0x0102 +#define DCBA_FACEDOWNRIGHT 0x0103 + +#ifdef UNICODE +#define DeviceCapabilities DeviceCapabilitiesW +#define EnumFontFamiliesEx EnumFontFamiliesExW +#define EnumFontFamilies EnumFontFamiliesW +#define EnumFonts EnumFontsW +#define GetCharWidth GetCharWidthW +#define GetCharWidth32 GetCharWidth32W +#define GetCharWidthFloat GetCharWidthFloatW +#define GetCharABCWidths GetCharABCWidthsW +#define GetCharABCWidthsFloat GetCharABCWidthsFloatW +#define GetGlyphOutline GetGlyphOutlineW +#define GetMetaFile GetMetaFileW +#else +#define DeviceCapabilities DeviceCapabilitiesA +#define EnumFontFamiliesEx EnumFontFamiliesExA +#define EnumFontFamilies EnumFontFamiliesA +#define EnumFonts EnumFontsA +#define GetCharWidth GetCharWidthA +#define GetCharWidth32 GetCharWidth32A +#define GetCharWidthFloat GetCharWidthFloatA +#define GetCharABCWidths GetCharABCWidthsA +#define GetCharABCWidthsFloat GetCharABCWidthsFloatA +#define GetGlyphOutline GetGlyphOutlineA +#define GetMetaFile GetMetaFileA +#endif + + WINSPOOLAPI int WINAPI DeviceCapabilitiesA(LPCSTR pDevice,LPCSTR pPort,WORD fwCapability,LPSTR pOutput,CONST DEVMODEA *pDevMode); + WINSPOOLAPI int WINAPI DeviceCapabilitiesW(LPCWSTR pDevice,LPCWSTR pPort,WORD fwCapability,LPWSTR pOutput,CONST DEVMODEW *pDevMode); + WINGDIAPI int WINAPI DrawEscape(HDC hdc,int iEscape,int cjIn,LPCSTR lpIn); + WINGDIAPI WINBOOL WINAPI Ellipse(HDC hdc,int left,int top,int right,int bottom); + WINGDIAPI int WINAPI EnumFontFamiliesExA(HDC hdc,LPLOGFONTA lpLogfont,FONTENUMPROCA lpProc,LPARAM lParam,DWORD dwFlags); + WINGDIAPI int WINAPI EnumFontFamiliesExW(HDC hdc,LPLOGFONTW lpLogfont,FONTENUMPROCW lpProc,LPARAM lParam,DWORD dwFlags); + WINGDIAPI int WINAPI EnumFontFamiliesA(HDC hdc,LPCSTR lpLogfont,FONTENUMPROCA lpProc,LPARAM lParam); + WINGDIAPI int WINAPI EnumFontFamiliesW(HDC hdc,LPCWSTR lpLogfont,FONTENUMPROCW lpProc,LPARAM lParam); + WINGDIAPI int WINAPI EnumFontsA(HDC hdc,LPCSTR lpLogfont,FONTENUMPROCA lpProc,LPARAM lParam); + WINGDIAPI int WINAPI EnumFontsW(HDC hdc,LPCWSTR lpLogfont,FONTENUMPROCW lpProc,LPARAM lParam); + WINGDIAPI int WINAPI EnumObjects(HDC hdc,int nType,GOBJENUMPROC lpFunc,LPARAM lParam); + WINGDIAPI WINBOOL WINAPI EqualRgn(HRGN hrgn1,HRGN hrgn2); + WINGDIAPI int WINAPI Escape(HDC hdc,int iEscape,int cjIn,LPCSTR pvIn,LPVOID pvOut); + WINGDIAPI int WINAPI ExtEscape(HDC hdc,int iEscape,int cjInput,LPCSTR lpInData,int cjOutput,LPSTR lpOutData); + WINGDIAPI int WINAPI ExcludeClipRect(HDC hdc,int left,int top,int right,int bottom); + WINGDIAPI HRGN WINAPI ExtCreateRegion(CONST XFORM *lpx,DWORD nCount,CONST RGNDATA *lpData); + WINGDIAPI WINBOOL WINAPI ExtFloodFill(HDC hdc,int x,int y,COLORREF color,UINT type); + WINGDIAPI WINBOOL WINAPI FillRgn(HDC hdc,HRGN hrgn,HBRUSH hbr); + WINGDIAPI WINBOOL WINAPI FloodFill(HDC hdc,int x,int y,COLORREF color); + WINGDIAPI WINBOOL WINAPI FrameRgn(HDC hdc,HRGN hrgn,HBRUSH hbr,int w,int h); + WINGDIAPI int WINAPI GetROP2(HDC hdc); + WINGDIAPI WINBOOL WINAPI GetAspectRatioFilterEx(HDC hdc,LPSIZE lpsize); + WINGDIAPI COLORREF WINAPI GetBkColor(HDC hdc); + WINGDIAPI COLORREF WINAPI GetDCBrushColor(HDC hdc); + WINGDIAPI COLORREF WINAPI GetDCPenColor(HDC hdc); + WINGDIAPI int WINAPI GetBkMode(HDC hdc); + WINGDIAPI LONG WINAPI GetBitmapBits(HBITMAP hbit,LONG cb,LPVOID lpvBits); + WINGDIAPI WINBOOL WINAPI GetBitmapDimensionEx(HBITMAP hbit,LPSIZE lpsize); + WINGDIAPI UINT WINAPI GetBoundsRect(HDC hdc,LPRECT lprect,UINT flags); + WINGDIAPI WINBOOL WINAPI GetBrushOrgEx(HDC hdc,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI GetCharWidthA(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidthW(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidth32A(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidth32W(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidthFloatA(HDC hdc,UINT iFirst,UINT iLast,PFLOAT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharWidthFloatW(HDC hdc,UINT iFirst,UINT iLast,PFLOAT lpBuffer); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsA(HDC hdc,UINT wFirst,UINT wLast,LPABC lpABC); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsW(HDC hdc,UINT wFirst,UINT wLast,LPABC lpABC); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsFloatA(HDC hdc,UINT iFirst,UINT iLast,LPABCFLOAT lpABC); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsFloatW(HDC hdc,UINT iFirst,UINT iLast,LPABCFLOAT lpABC); + WINGDIAPI int WINAPI GetClipBox(HDC hdc,LPRECT lprect); + WINGDIAPI int WINAPI GetClipRgn(HDC hdc,HRGN hrgn); + WINGDIAPI int WINAPI GetMetaRgn(HDC hdc,HRGN hrgn); + WINGDIAPI HGDIOBJ WINAPI GetCurrentObject(HDC hdc,UINT type); + WINGDIAPI WINBOOL WINAPI GetCurrentPositionEx(HDC hdc,LPPOINT lppt); + WINGDIAPI int WINAPI GetDeviceCaps(HDC hdc,int index); + WINGDIAPI int WINAPI GetDIBits(HDC hdc,HBITMAP hbm,UINT start,UINT cLines,LPVOID lpvBits,LPBITMAPINFO lpbmi,UINT usage); + WINGDIAPI DWORD WINAPI GetFontData (HDC hdc,DWORD dwTable,DWORD dwOffset,PVOID pvBuffer,DWORD cjBuffer); + WINGDIAPI DWORD WINAPI GetGlyphOutlineA(HDC hdc,UINT uChar,UINT fuFormat,LPGLYPHMETRICS lpgm,DWORD cjBuffer,LPVOID pvBuffer,CONST MAT2 *lpmat2); + WINGDIAPI DWORD WINAPI GetGlyphOutlineW(HDC hdc,UINT uChar,UINT fuFormat,LPGLYPHMETRICS lpgm,DWORD cjBuffer,LPVOID pvBuffer,CONST MAT2 *lpmat2); + WINGDIAPI int WINAPI GetGraphicsMode(HDC hdc); + WINGDIAPI int WINAPI GetMapMode(HDC hdc); + WINGDIAPI UINT WINAPI GetMetaFileBitsEx(HMETAFILE hMF,UINT cbBuffer,LPVOID lpData); + WINGDIAPI HMETAFILE WINAPI GetMetaFileA(LPCSTR lpName); + WINGDIAPI HMETAFILE WINAPI GetMetaFileW(LPCWSTR lpName); + WINGDIAPI COLORREF WINAPI GetNearestColor(HDC hdc,COLORREF color); + WINGDIAPI UINT WINAPI GetNearestPaletteIndex(HPALETTE h,COLORREF color); + WINGDIAPI DWORD WINAPI GetObjectType(HGDIOBJ h); + +#ifndef NOTEXTMETRIC +#ifdef UNICODE +#define GetOutlineTextMetrics GetOutlineTextMetricsW +#else +#define GetOutlineTextMetrics GetOutlineTextMetricsA +#endif + + WINGDIAPI UINT WINAPI GetOutlineTextMetricsA(HDC hdc,UINT cjCopy,LPOUTLINETEXTMETRICA potm); + WINGDIAPI UINT WINAPI GetOutlineTextMetricsW(HDC hdc,UINT cjCopy,LPOUTLINETEXTMETRICW potm); +#endif + +#ifdef UNICODE +#define GetTextExtentPoint GetTextExtentPointW +#define GetTextExtentPoint32 GetTextExtentPoint32W +#define GetTextExtentExPoint GetTextExtentExPointW +#define GetCharacterPlacement GetCharacterPlacementW +#else +#define GetTextExtentPoint GetTextExtentPointA +#define GetTextExtentPoint32 GetTextExtentPoint32A +#define GetTextExtentExPoint GetTextExtentExPointA +#define GetCharacterPlacement GetCharacterPlacementA +#endif + + WINGDIAPI UINT WINAPI GetPaletteEntries(HPALETTE hpal,UINT iStart,UINT cEntries,LPPALETTEENTRY pPalEntries); + WINGDIAPI COLORREF WINAPI GetPixel(HDC hdc,int x,int y); + WINGDIAPI int WINAPI GetPixelFormat(HDC hdc); + WINGDIAPI int WINAPI GetPolyFillMode(HDC hdc); + WINGDIAPI WINBOOL WINAPI GetRasterizerCaps(LPRASTERIZER_STATUS lpraststat,UINT cjBytes); + WINGDIAPI int WINAPI GetRandomRgn (HDC hdc,HRGN hrgn,INT i); + WINGDIAPI DWORD WINAPI GetRegionData(HRGN hrgn,DWORD nCount,LPRGNDATA lpRgnData); + WINGDIAPI int WINAPI GetRgnBox(HRGN hrgn,LPRECT lprc); + WINGDIAPI HGDIOBJ WINAPI GetStockObject(int i); + WINGDIAPI int WINAPI GetStretchBltMode(HDC hdc); + WINGDIAPI UINT WINAPI GetSystemPaletteEntries(HDC hdc,UINT iStart,UINT cEntries,LPPALETTEENTRY pPalEntries); + WINGDIAPI UINT WINAPI GetSystemPaletteUse(HDC hdc); + WINGDIAPI int WINAPI GetTextCharacterExtra(HDC hdc); + WINGDIAPI UINT WINAPI GetTextAlign(HDC hdc); + WINGDIAPI COLORREF WINAPI GetTextColor(HDC hdc); + WINGDIAPI WINBOOL WINAPI GetTextExtentPointA(HDC hdc,LPCSTR lpString,int c,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI GetTextExtentPointW(HDC hdc,LPCWSTR lpString,int c,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI GetTextExtentPoint32A(HDC hdc,LPCSTR lpString,int c,LPSIZE psizl); + WINGDIAPI WINBOOL WINAPI GetTextExtentPoint32W(HDC hdc,LPCWSTR lpString,int c,LPSIZE psizl); + WINGDIAPI WINBOOL WINAPI GetTextExtentExPointA(HDC hdc,LPCSTR lpszString,int cchString,int nMaxExtent,LPINT lpnFit,LPINT lpnDx,LPSIZE lpSize); + WINGDIAPI WINBOOL WINAPI GetTextExtentExPointW(HDC hdc,LPCWSTR lpszString,int cchString,int nMaxExtent,LPINT lpnFit,LPINT lpnDx,LPSIZE lpSize); + WINGDIAPI int WINAPI GetTextCharset(HDC hdc); + WINGDIAPI int WINAPI GetTextCharsetInfo(HDC hdc,LPFONTSIGNATURE lpSig,DWORD dwFlags); + WINGDIAPI WINBOOL WINAPI TranslateCharsetInfo(DWORD *lpSrc,LPCHARSETINFO lpCs,DWORD dwFlags); + WINGDIAPI DWORD WINAPI GetFontLanguageInfo(HDC hdc); + WINGDIAPI DWORD WINAPI GetCharacterPlacementA(HDC hdc,LPCSTR lpString,int nCount,int nMexExtent,LPGCP_RESULTSA lpResults,DWORD dwFlags); + WINGDIAPI DWORD WINAPI GetCharacterPlacementW(HDC hdc,LPCWSTR lpString,int nCount,int nMexExtent,LPGCP_RESULTSW lpResults,DWORD dwFlags); + + typedef struct tagWCRANGE { + WCHAR wcLow; + USHORT cGlyphs; + } WCRANGE,*PWCRANGE,*LPWCRANGE; + + typedef struct tagGLYPHSET { + DWORD cbThis; + DWORD flAccel; + DWORD cGlyphsSupported; + DWORD cRanges; + WCRANGE ranges[1]; + } GLYPHSET,*PGLYPHSET,*LPGLYPHSET; + +#define GS_8BIT_INDICES 0x00000001 + +#define GGI_MARK_NONEXISTING_GLYPHS 0X0001 + +#ifdef UNICODE +#define GetGlyphIndices GetGlyphIndicesW +#else +#define GetGlyphIndices GetGlyphIndicesA +#endif + + WINGDIAPI DWORD WINAPI GetFontUnicodeRanges(HDC hdc,LPGLYPHSET lpgs); + WINGDIAPI DWORD WINAPI GetGlyphIndicesA(HDC hdc,LPCSTR lpstr,int c,LPWORD pgi,DWORD fl); + WINGDIAPI DWORD WINAPI GetGlyphIndicesW(HDC hdc,LPCWSTR lpstr,int c,LPWORD pgi,DWORD fl); + WINGDIAPI WINBOOL WINAPI GetTextExtentPointI(HDC hdc,LPWORD pgiIn,int cgi,LPSIZE psize); + WINGDIAPI WINBOOL WINAPI GetTextExtentExPointI (HDC hdc,LPWORD lpwszString,int cwchString,int nMaxExtent,LPINT lpnFit,LPINT lpnDx,LPSIZE lpSize); + WINGDIAPI WINBOOL WINAPI GetCharWidthI(HDC hdc,UINT giFirst,UINT cgi,LPWORD pgi,LPINT piWidths); + WINGDIAPI WINBOOL WINAPI GetCharABCWidthsI(HDC hdc,UINT giFirst,UINT cgi,LPWORD pgi,LPABC pabc); + +#define STAMP_DESIGNVECTOR (0x8000000 + 'd' + ('v' << 8)) +#define STAMP_AXESLIST (0x8000000 + 'a' + ('l' << 8)) +#define MM_MAX_NUMAXES 16 + + typedef struct tagDESIGNVECTOR { + DWORD dvReserved; + DWORD dvNumAxes; + LONG dvValues[MM_MAX_NUMAXES]; + } DESIGNVECTOR,*PDESIGNVECTOR,*LPDESIGNVECTOR; + +#ifdef UNICODE +#define AddFontResourceEx AddFontResourceExW +#define RemoveFontResourceEx RemoveFontResourceExW +#else +#define AddFontResourceEx AddFontResourceExA +#define RemoveFontResourceEx RemoveFontResourceExA +#endif + + WINGDIAPI int WINAPI AddFontResourceExA(LPCSTR name,DWORD fl,PVOID res); + WINGDIAPI int WINAPI AddFontResourceExW(LPCWSTR name,DWORD fl,PVOID res); + WINGDIAPI WINBOOL WINAPI RemoveFontResourceExA(LPCSTR name,DWORD fl,PVOID pdv); + WINGDIAPI WINBOOL WINAPI RemoveFontResourceExW(LPCWSTR name,DWORD fl,PVOID pdv); + WINGDIAPI HANDLE WINAPI AddFontMemResourceEx(PVOID pFileView,DWORD cjSize,PVOID pvResrved,DWORD *pNumFonts); + WINGDIAPI WINBOOL WINAPI RemoveFontMemResourceEx(HANDLE h); + +#define FR_PRIVATE 0x10 +#define FR_NOT_ENUM 0x20 + +#define MM_MAX_AXES_NAMELEN 16 + + typedef struct tagAXISINFOA { + LONG axMinValue; + LONG axMaxValue; + BYTE axAxisName[MM_MAX_AXES_NAMELEN]; + } AXISINFOA,*PAXISINFOA,*LPAXISINFOA; + + typedef struct tagAXISINFOW { + LONG axMinValue; + LONG axMaxValue; + WCHAR axAxisName[MM_MAX_AXES_NAMELEN]; + } AXISINFOW,*PAXISINFOW,*LPAXISINFOW; +#ifdef UNICODE + typedef AXISINFOW AXISINFO; + typedef PAXISINFOW PAXISINFO; + typedef LPAXISINFOW LPAXISINFO; +#else + typedef AXISINFOA AXISINFO; + typedef PAXISINFOA PAXISINFO; + typedef LPAXISINFOA LPAXISINFO; +#endif + + typedef struct tagAXESLISTA { + DWORD axlReserved; + DWORD axlNumAxes; + AXISINFOA axlAxisInfo[MM_MAX_NUMAXES]; + } AXESLISTA,*PAXESLISTA,*LPAXESLISTA; + + typedef struct tagAXESLISTW { + DWORD axlReserved; + DWORD axlNumAxes; + AXISINFOW axlAxisInfo[MM_MAX_NUMAXES]; + } AXESLISTW,*PAXESLISTW,*LPAXESLISTW; +#ifdef UNICODE + typedef AXESLISTW AXESLIST; + typedef PAXESLISTW PAXESLIST; + typedef LPAXESLISTW LPAXESLIST; +#else + typedef AXESLISTA AXESLIST; + typedef PAXESLISTA PAXESLIST; + typedef LPAXESLISTA LPAXESLIST; +#endif + + typedef struct tagENUMLOGFONTEXDVA { + ENUMLOGFONTEXA elfEnumLogfontEx; + DESIGNVECTOR elfDesignVector; + } ENUMLOGFONTEXDVA,*PENUMLOGFONTEXDVA,*LPENUMLOGFONTEXDVA; + + typedef struct tagENUMLOGFONTEXDVW { + ENUMLOGFONTEXW elfEnumLogfontEx; + DESIGNVECTOR elfDesignVector; + } ENUMLOGFONTEXDVW,*PENUMLOGFONTEXDVW,*LPENUMLOGFONTEXDVW; +#ifdef UNICODE + typedef ENUMLOGFONTEXDVW ENUMLOGFONTEXDV; + typedef PENUMLOGFONTEXDVW PENUMLOGFONTEXDV; + typedef LPENUMLOGFONTEXDVW LPENUMLOGFONTEXDV; +#else + typedef ENUMLOGFONTEXDVA ENUMLOGFONTEXDV; + typedef PENUMLOGFONTEXDVA PENUMLOGFONTEXDV; + typedef LPENUMLOGFONTEXDVA LPENUMLOGFONTEXDV; +#endif + +#ifdef UNICODE +#define CreateFontIndirectEx CreateFontIndirectExW +#else +#define CreateFontIndirectEx CreateFontIndirectExA +#endif + + WINGDIAPI HFONT WINAPI CreateFontIndirectExA(CONST ENUMLOGFONTEXDVA *); + WINGDIAPI HFONT WINAPI CreateFontIndirectExW(CONST ENUMLOGFONTEXDVW *); + +#ifndef NOTEXTMETRIC + typedef struct tagENUMTEXTMETRICA { + NEWTEXTMETRICEXA etmNewTextMetricEx; + AXESLISTA etmAxesList; + } ENUMTEXTMETRICA,*PENUMTEXTMETRICA,*LPENUMTEXTMETRICA; + typedef struct tagENUMTEXTMETRICW + { + NEWTEXTMETRICEXW etmNewTextMetricEx; + AXESLISTW etmAxesList; + } ENUMTEXTMETRICW,*PENUMTEXTMETRICW,*LPENUMTEXTMETRICW; +#ifdef UNICODE + typedef ENUMTEXTMETRICW ENUMTEXTMETRIC; + typedef PENUMTEXTMETRICW PENUMTEXTMETRIC; + typedef LPENUMTEXTMETRICW LPENUMTEXTMETRIC; +#else + typedef ENUMTEXTMETRICA ENUMTEXTMETRIC; + typedef PENUMTEXTMETRICA PENUMTEXTMETRIC; + typedef LPENUMTEXTMETRICA LPENUMTEXTMETRIC; +#endif +#endif + +#ifdef UNICODE +#define ResetDC ResetDCW +#define RemoveFontResource RemoveFontResourceW +#else +#define ResetDC ResetDCA +#define RemoveFontResource RemoveFontResourceA +#endif + + WINGDIAPI WINBOOL WINAPI GetViewportExtEx(HDC hdc,LPSIZE lpsize); + WINGDIAPI WINBOOL WINAPI GetViewportOrgEx(HDC hdc,LPPOINT lppoint); + WINGDIAPI WINBOOL WINAPI GetWindowExtEx(HDC hdc,LPSIZE lpsize); + WINGDIAPI WINBOOL WINAPI GetWindowOrgEx(HDC hdc,LPPOINT lppoint); + WINGDIAPI int WINAPI IntersectClipRect(HDC hdc,int left,int top,int right,int bottom); + WINGDIAPI WINBOOL WINAPI InvertRgn(HDC hdc,HRGN hrgn); + WINGDIAPI WINBOOL WINAPI LineDDA(int xStart,int yStart,int xEnd,int yEnd,LINEDDAPROC lpProc,LPARAM data); + WINGDIAPI WINBOOL WINAPI LineTo(HDC hdc,int x,int y); + WINGDIAPI WINBOOL WINAPI MaskBlt(HDC hdcDest,int xDest,int yDest,int width,int height,HDC hdcSrc,int xSrc,int ySrc,HBITMAP hbmMask,int xMask,int yMask,DWORD rop); + WINGDIAPI WINBOOL WINAPI PlgBlt(HDC hdcDest,CONST POINT *lpPoint,HDC hdcSrc,int xSrc,int ySrc,int width,int height,HBITMAP hbmMask,int xMask,int yMask); + WINGDIAPI int WINAPI OffsetClipRgn(HDC hdc,int x,int y); + WINGDIAPI int WINAPI OffsetRgn(HRGN hrgn,int x,int y); + WINGDIAPI WINBOOL WINAPI PatBlt(HDC hdc,int x,int y,int w,int h,DWORD rop); + WINGDIAPI WINBOOL WINAPI Pie(HDC hdc,int left,int top,int right,int bottom,int xr1,int yr1,int xr2,int yr2); + WINGDIAPI WINBOOL WINAPI PlayMetaFile(HDC hdc,HMETAFILE hmf); + WINGDIAPI WINBOOL WINAPI PaintRgn(HDC hdc,HRGN hrgn); + WINGDIAPI WINBOOL WINAPI PolyPolygon(HDC hdc,CONST POINT *apt,CONST INT *asz,int csz); + WINGDIAPI WINBOOL WINAPI PtInRegion(HRGN hrgn,int x,int y); + WINGDIAPI WINBOOL WINAPI PtVisible(HDC hdc,int x,int y); + WINGDIAPI WINBOOL WINAPI RectInRegion(HRGN hrgn,CONST RECT *lprect); + WINGDIAPI WINBOOL WINAPI RectVisible(HDC hdc,CONST RECT *lprect); + WINGDIAPI WINBOOL WINAPI Rectangle(HDC hdc,int left,int top,int right,int bottom); + WINGDIAPI WINBOOL WINAPI RestoreDC(HDC hdc,int nSavedDC); + WINGDIAPI HDC WINAPI ResetDCA(HDC hdc,CONST DEVMODEA *lpdm); + WINGDIAPI HDC WINAPI ResetDCW(HDC hdc,CONST DEVMODEW *lpdm); + WINGDIAPI UINT WINAPI RealizePalette(HDC hdc); + WINGDIAPI WINBOOL WINAPI RemoveFontResourceA(LPCSTR lpFileName); + WINGDIAPI WINBOOL WINAPI RemoveFontResourceW(LPCWSTR lpFileName); + WINGDIAPI WINBOOL WINAPI RoundRect(HDC hdc,int left,int top,int right,int bottom,int width,int height); + WINGDIAPI WINBOOL WINAPI ResizePalette(HPALETTE hpal,UINT n); + WINGDIAPI int WINAPI SaveDC(HDC hdc); + WINGDIAPI int WINAPI SelectClipRgn(HDC hdc,HRGN hrgn); + WINGDIAPI int WINAPI ExtSelectClipRgn(HDC hdc,HRGN hrgn,int mode); + WINGDIAPI int WINAPI SetMetaRgn(HDC hdc); + WINGDIAPI HGDIOBJ WINAPI SelectObject(HDC hdc,HGDIOBJ h); + WINGDIAPI HPALETTE WINAPI SelectPalette(HDC hdc,HPALETTE hPal,WINBOOL bForceBkgd); + WINGDIAPI COLORREF WINAPI SetBkColor(HDC hdc,COLORREF color); + WINGDIAPI COLORREF WINAPI SetDCBrushColor(HDC hdc,COLORREF color); + WINGDIAPI COLORREF WINAPI SetDCPenColor(HDC hdc,COLORREF color); + WINGDIAPI int WINAPI SetBkMode(HDC hdc,int mode); + WINGDIAPI LONG WINAPI SetBitmapBits(HBITMAP hbm,DWORD cb,CONST VOID *pvBits); + WINGDIAPI UINT WINAPI SetBoundsRect(HDC hdc,CONST RECT *lprect,UINT flags); + WINGDIAPI int WINAPI SetDIBits(HDC hdc,HBITMAP hbm,UINT start,UINT cLines,CONST VOID *lpBits,CONST BITMAPINFO *lpbmi,UINT ColorUse); + WINGDIAPI int WINAPI SetDIBitsToDevice(HDC hdc,int xDest,int yDest,DWORD w,DWORD h,int xSrc,int ySrc,UINT StartScan,UINT cLines,CONST VOID *lpvBits,CONST BITMAPINFO *lpbmi,UINT ColorUse); + WINGDIAPI DWORD WINAPI SetMapperFlags(HDC hdc,DWORD flags); + WINGDIAPI int WINAPI SetGraphicsMode(HDC hdc,int iMode); + WINGDIAPI int WINAPI SetMapMode(HDC hdc,int iMode); + WINGDIAPI DWORD WINAPI SetLayout(HDC hdc,DWORD l); + WINGDIAPI DWORD WINAPI GetLayout(HDC hdc); + WINGDIAPI HMETAFILE WINAPI SetMetaFileBitsEx(UINT cbBuffer,CONST BYTE *lpData); + WINGDIAPI UINT WINAPI SetPaletteEntries(HPALETTE hpal,UINT iStart,UINT cEntries,CONST PALETTEENTRY *pPalEntries); + WINGDIAPI COLORREF WINAPI SetPixel(HDC hdc,int x,int y,COLORREF color); + WINGDIAPI WINBOOL WINAPI SetPixelV(HDC hdc,int x,int y,COLORREF color); + WINGDIAPI WINBOOL WINAPI SetPixelFormat(HDC hdc,int format,CONST PIXELFORMATDESCRIPTOR *ppfd); + WINGDIAPI int WINAPI SetPolyFillMode(HDC hdc,int mode); + WINGDIAPI WINBOOL WINAPI StretchBlt(HDC hdcDest,int xDest,int yDest,int wDest,int hDest,HDC hdcSrc,int xSrc,int ySrc,int wSrc,int hSrc,DWORD rop); + WINGDIAPI WINBOOL WINAPI SetRectRgn(HRGN hrgn,int left,int top,int right,int bottom); + WINGDIAPI int WINAPI StretchDIBits(HDC hdc,int xDest,int yDest,int DestWidth,int DestHeight,int xSrc,int ySrc,int SrcWidth,int SrcHeight,CONST VOID *lpBits,CONST BITMAPINFO *lpbmi,UINT iUsage,DWORD rop); + WINGDIAPI int WINAPI SetROP2(HDC hdc,int rop2); + WINGDIAPI int WINAPI SetStretchBltMode(HDC hdc,int mode); + WINGDIAPI UINT WINAPI SetSystemPaletteUse(HDC hdc,UINT use); + WINGDIAPI int WINAPI SetTextCharacterExtra(HDC hdc,int extra); + WINGDIAPI COLORREF WINAPI SetTextColor(HDC hdc,COLORREF color); + WINGDIAPI UINT WINAPI SetTextAlign(HDC hdc,UINT align); + WINGDIAPI WINBOOL WINAPI SetTextJustification(HDC hdc,int extra,int count); + WINGDIAPI WINBOOL WINAPI UpdateColors(HDC hdc); + + typedef USHORT COLOR16; + + typedef struct _TRIVERTEX { + LONG x; + LONG y; + COLOR16 Red; + COLOR16 Green; + COLOR16 Blue; + COLOR16 Alpha; + } TRIVERTEX,*PTRIVERTEX,*LPTRIVERTEX; + + typedef struct _GRADIENT_TRIANGLE { + ULONG Vertex1; + ULONG Vertex2; + ULONG Vertex3; + } GRADIENT_TRIANGLE,*PGRADIENT_TRIANGLE,*LPGRADIENT_TRIANGLE; + + typedef struct _GRADIENT_RECT { + ULONG UpperLeft; + ULONG LowerRight; + } GRADIENT_RECT,*PGRADIENT_RECT,*LPGRADIENT_RECT; + + typedef struct _BLENDFUNCTION { + BYTE BlendOp; + BYTE BlendFlags; + BYTE SourceConstantAlpha; + BYTE AlphaFormat; + } BLENDFUNCTION,*PBLENDFUNCTION; + +#define AC_SRC_OVER 0x00 +#define AC_SRC_ALPHA 0x01 + + WINGDIAPI WINBOOL WINAPI AlphaBlend(HDC hdcDest,int xoriginDest,int yoriginDest,int wDest,int hDest,HDC hdcSrc,int xoriginSrc,int yoriginSrc,int wSrc,int hSrc,BLENDFUNCTION ftn); + WINGDIAPI WINBOOL WINAPI TransparentBlt(HDC hdcDest,int xoriginDest,int yoriginDest,int wDest,int hDest,HDC hdcSrc,int xoriginSrc,int yoriginSrc,int wSrc,int hSrc,UINT crTransparent); + +#define GRADIENT_FILL_RECT_H 0x00000000 +#define GRADIENT_FILL_RECT_V 0x00000001 +#define GRADIENT_FILL_TRIANGLE 0x00000002 +#define GRADIENT_FILL_OP_FLAG 0x000000ff + + WINGDIAPI WINBOOL WINAPI GradientFill(HDC hdc,PTRIVERTEX pVertex,ULONG nVertex,PVOID pMesh,ULONG nMesh,ULONG ulMode); + +#ifndef NOMETAFILE + +#ifdef UNICODE +#define CopyEnhMetaFile CopyEnhMetaFileW +#define CreateEnhMetaFile CreateEnhMetaFileW +#define GetEnhMetaFile GetEnhMetaFileW +#define GetEnhMetaFileDescription GetEnhMetaFileDescriptionW +#else +#define CopyEnhMetaFile CopyEnhMetaFileA +#define CreateEnhMetaFile CreateEnhMetaFileA +#define GetEnhMetaFile GetEnhMetaFileA +#define GetEnhMetaFileDescription GetEnhMetaFileDescriptionA +#endif + + WINGDIAPI WINBOOL WINAPI PlayMetaFileRecord(HDC hdc,LPHANDLETABLE lpHandleTable,LPMETARECORD lpMR,UINT noObjs); + + typedef int (CALLBACK *MFENUMPROC)(HDC hdc,HANDLETABLE *lpht,METARECORD *lpMR,int nObj,LPARAM param); + + WINGDIAPI WINBOOL WINAPI EnumMetaFile(HDC hdc,HMETAFILE hmf,MFENUMPROC proc,LPARAM param); + + typedef int (CALLBACK *ENHMFENUMPROC)(HDC hdc,HANDLETABLE *lpht,CONST ENHMETARECORD *lpmr,int hHandles,LPARAM data); + + WINGDIAPI HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc); + WINGDIAPI HENHMETAFILE WINAPI CopyEnhMetaFileA(HENHMETAFILE hEnh,LPCSTR lpFileName); + WINGDIAPI HENHMETAFILE WINAPI CopyEnhMetaFileW(HENHMETAFILE hEnh,LPCWSTR lpFileName); + WINGDIAPI HDC WINAPI CreateEnhMetaFileA(HDC hdc,LPCSTR lpFilename,CONST RECT *lprc,LPCSTR lpDesc); + WINGDIAPI HDC WINAPI CreateEnhMetaFileW(HDC hdc,LPCWSTR lpFilename,CONST RECT *lprc,LPCWSTR lpDesc); + WINGDIAPI WINBOOL WINAPI DeleteEnhMetaFile(HENHMETAFILE hmf); + WINGDIAPI WINBOOL WINAPI EnumEnhMetaFile(HDC hdc,HENHMETAFILE hmf,ENHMFENUMPROC proc,LPVOID param,CONST RECT *lpRect); + WINGDIAPI HENHMETAFILE WINAPI GetEnhMetaFileA(LPCSTR lpName); + WINGDIAPI HENHMETAFILE WINAPI GetEnhMetaFileW(LPCWSTR lpName); + WINGDIAPI UINT WINAPI GetEnhMetaFileBits(HENHMETAFILE hEMF,UINT nSize,LPBYTE lpData); + WINGDIAPI UINT WINAPI GetEnhMetaFileDescriptionA(HENHMETAFILE hemf,UINT cchBuffer,LPSTR lpDescription); + WINGDIAPI UINT WINAPI GetEnhMetaFileDescriptionW(HENHMETAFILE hemf,UINT cchBuffer,LPWSTR lpDescription); + WINGDIAPI UINT WINAPI GetEnhMetaFileHeader(HENHMETAFILE hemf,UINT nSize,LPENHMETAHEADER lpEnhMetaHeader); + WINGDIAPI UINT WINAPI GetEnhMetaFilePaletteEntries(HENHMETAFILE hemf,UINT nNumEntries,LPPALETTEENTRY lpPaletteEntries); + WINGDIAPI UINT WINAPI GetEnhMetaFilePixelFormat(HENHMETAFILE hemf,UINT cbBuffer,PIXELFORMATDESCRIPTOR *ppfd); + WINGDIAPI UINT WINAPI GetWinMetaFileBits(HENHMETAFILE hemf,UINT cbData16,LPBYTE pData16,INT iMapMode,HDC hdcRef); + WINGDIAPI WINBOOL WINAPI PlayEnhMetaFile(HDC hdc,HENHMETAFILE hmf,CONST RECT *lprect); + WINGDIAPI WINBOOL WINAPI PlayEnhMetaFileRecord(HDC hdc,LPHANDLETABLE pht,CONST ENHMETARECORD *pmr,UINT cht); + WINGDIAPI HENHMETAFILE WINAPI SetEnhMetaFileBits(UINT nSize,CONST BYTE *pb); + WINGDIAPI HENHMETAFILE WINAPI SetWinMetaFileBits(UINT nSize,CONST BYTE *lpMeta16Data,HDC hdcRef,CONST METAFILEPICT *lpMFP); + WINGDIAPI WINBOOL WINAPI GdiComment(HDC hdc,UINT nSize,CONST BYTE *lpData); +#endif + +#ifndef NOTEXTMETRIC +#ifdef UNICODE +#define GetTextMetrics GetTextMetricsW +#else +#define GetTextMetrics GetTextMetricsA +#endif + + WINGDIAPI WINBOOL WINAPI GetTextMetricsA(HDC hdc,LPTEXTMETRICA lptm); + WINGDIAPI WINBOOL WINAPI GetTextMetricsW(HDC hdc,LPTEXTMETRICW lptm); +#endif + + typedef struct tagDIBSECTION { + BITMAP dsBm; + BITMAPINFOHEADER dsBmih; + DWORD dsBitfields[3]; + HANDLE dshSection; + DWORD dsOffset; + } DIBSECTION,*LPDIBSECTION,*PDIBSECTION; + + WINGDIAPI WINBOOL WINAPI AngleArc(HDC hdc,int x,int y,DWORD r,FLOAT StartAngle,FLOAT SweepAngle); + WINGDIAPI WINBOOL WINAPI PolyPolyline(HDC hdc,CONST POINT *apt,CONST DWORD *asz,DWORD csz); + WINGDIAPI WINBOOL WINAPI GetWorldTransform(HDC hdc,LPXFORM lpxf); + WINGDIAPI WINBOOL WINAPI SetWorldTransform(HDC hdc,CONST XFORM *lpxf); + WINGDIAPI WINBOOL WINAPI ModifyWorldTransform(HDC hdc,CONST XFORM *lpxf,DWORD mode); + WINGDIAPI WINBOOL WINAPI CombineTransform(LPXFORM lpxfOut,CONST XFORM *lpxf1,CONST XFORM *lpxf2); + WINGDIAPI HBITMAP WINAPI CreateDIBSection(HDC hdc,CONST BITMAPINFO *lpbmi,UINT usage,VOID **ppvBits,HANDLE hSection,DWORD offset); + WINGDIAPI UINT WINAPI GetDIBColorTable(HDC hdc,UINT iStart,UINT cEntries,RGBQUAD *prgbq); + WINGDIAPI UINT WINAPI SetDIBColorTable(HDC hdc,UINT iStart,UINT cEntries,CONST RGBQUAD *prgbq); + +#define CA_NEGATIVE 0x0001 +#define CA_LOG_FILTER 0x0002 + +#define ILLUMINANT_DEVICE_DEFAULT 0 +#define ILLUMINANT_A 1 +#define ILLUMINANT_B 2 +#define ILLUMINANT_C 3 +#define ILLUMINANT_D50 4 +#define ILLUMINANT_D55 5 +#define ILLUMINANT_D65 6 +#define ILLUMINANT_D75 7 +#define ILLUMINANT_F2 8 +#define ILLUMINANT_MAX_INDEX ILLUMINANT_F2 + +#define ILLUMINANT_TUNGSTEN ILLUMINANT_A +#define ILLUMINANT_DAYLIGHT ILLUMINANT_C +#define ILLUMINANT_FLUORESCENT ILLUMINANT_F2 +#define ILLUMINANT_NTSC ILLUMINANT_C + +#define RGB_GAMMA_MIN (WORD)02500 +#define RGB_GAMMA_MAX (WORD)65000 + +#define REFERENCE_WHITE_MIN (WORD)6000 +#define REFERENCE_WHITE_MAX (WORD)10000 +#define REFERENCE_BLACK_MIN (WORD)0 +#define REFERENCE_BLACK_MAX (WORD)4000 + +#define COLOR_ADJ_MIN (SHORT)-100 +#define COLOR_ADJ_MAX (SHORT)100 + + typedef struct tagCOLORADJUSTMENT { + WORD caSize; + WORD caFlags; + WORD caIlluminantIndex; + WORD caRedGamma; + WORD caGreenGamma; + WORD caBlueGamma; + WORD caReferenceBlack; + WORD caReferenceWhite; + SHORT caContrast; + SHORT caBrightness; + SHORT caColorfulness; + SHORT caRedGreenTint; + } COLORADJUSTMENT,*PCOLORADJUSTMENT,*LPCOLORADJUSTMENT; + + WINGDIAPI WINBOOL WINAPI SetColorAdjustment(HDC hdc,CONST COLORADJUSTMENT *lpca); + WINGDIAPI WINBOOL WINAPI GetColorAdjustment(HDC hdc,LPCOLORADJUSTMENT lpca); + WINGDIAPI HPALETTE WINAPI CreateHalftonePalette(HDC hdc); + + typedef WINBOOL (CALLBACK *ABORTPROC)(HDC,int); + + typedef struct _DOCINFOA { + int cbSize; + LPCSTR lpszDocName; + LPCSTR lpszOutput; + LPCSTR lpszDatatype; + DWORD fwType; + } DOCINFOA,*LPDOCINFOA; + + typedef struct _DOCINFOW { + int cbSize; + LPCWSTR lpszDocName; + LPCWSTR lpszOutput; + LPCWSTR lpszDatatype; + DWORD fwType; + } DOCINFOW,*LPDOCINFOW; + +#ifdef UNICODE + typedef DOCINFOW DOCINFO; + typedef LPDOCINFOW LPDOCINFO; +#else + typedef DOCINFOA DOCINFO; + typedef LPDOCINFOA LPDOCINFO; +#endif + +#define DI_APPBANDING 0x00000001 +#define DI_ROPS_READ_DESTINATION 0x00000002 + +#ifdef UNICODE +#define StartDoc StartDocW +#define GetObject GetObjectW +#define TextOut TextOutW +#define ExtTextOut ExtTextOutW +#define PolyTextOut PolyTextOutW +#define GetTextFace GetTextFaceW +#else +#define StartDoc StartDocA +#define GetObject GetObjectA +#define TextOut TextOutA +#define ExtTextOut ExtTextOutA +#define PolyTextOut PolyTextOutA +#define GetTextFace GetTextFaceA +#endif + + WINGDIAPI int WINAPI StartDocA(HDC hdc,CONST DOCINFOA *lpdi); + WINGDIAPI int WINAPI StartDocW(HDC hdc,CONST DOCINFOW *lpdi); + WINGDIAPI int WINAPI EndDoc(HDC hdc); + WINGDIAPI int WINAPI StartPage(HDC hdc); + WINGDIAPI int WINAPI EndPage(HDC hdc); + WINGDIAPI int WINAPI AbortDoc(HDC hdc); + WINGDIAPI int WINAPI SetAbortProc(HDC hdc,ABORTPROC proc); + WINGDIAPI WINBOOL WINAPI AbortPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI ArcTo(HDC hdc,int left,int top,int right,int bottom,int xr1,int yr1,int xr2,int yr2); + WINGDIAPI WINBOOL WINAPI BeginPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI CloseFigure(HDC hdc); + WINGDIAPI WINBOOL WINAPI EndPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI FillPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI FlattenPath(HDC hdc); + WINGDIAPI int WINAPI GetPath(HDC hdc,LPPOINT apt,LPBYTE aj,int cpt); + WINGDIAPI HRGN WINAPI PathToRegion(HDC hdc); + WINGDIAPI WINBOOL WINAPI PolyDraw(HDC hdc,CONST POINT *apt,CONST BYTE *aj,int cpt); + WINGDIAPI WINBOOL WINAPI SelectClipPath(HDC hdc,int mode); + WINGDIAPI int WINAPI SetArcDirection(HDC hdc,int dir); + WINGDIAPI WINBOOL WINAPI SetMiterLimit(HDC hdc,FLOAT limit,PFLOAT old); + WINGDIAPI WINBOOL WINAPI StrokeAndFillPath(HDC hdc); + WINGDIAPI WINBOOL WINAPI StrokePath(HDC hdc); + WINGDIAPI WINBOOL WINAPI WidenPath(HDC hdc); + WINGDIAPI HPEN WINAPI ExtCreatePen(DWORD iPenStyle,DWORD cWidth,CONST LOGBRUSH *plbrush,DWORD cStyle,CONST DWORD *pstyle); + WINGDIAPI WINBOOL WINAPI GetMiterLimit(HDC hdc,PFLOAT plimit); + WINGDIAPI int WINAPI GetArcDirection(HDC hdc); + WINGDIAPI int WINAPI GetObjectA(HANDLE h,int c,LPVOID pv); + WINGDIAPI int WINAPI GetObjectW(HANDLE h,int c,LPVOID pv); + WINGDIAPI WINBOOL WINAPI MoveToEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI TextOutA(HDC hdc,int x,int y,LPCSTR lpString,int c); + WINGDIAPI WINBOOL WINAPI TextOutW(HDC hdc,int x,int y,LPCWSTR lpString,int c); + WINGDIAPI WINBOOL WINAPI ExtTextOutA(HDC hdc,int x,int y,UINT options,CONST RECT *lprect,LPCSTR lpString,UINT c,CONST INT *lpDx); + WINGDIAPI WINBOOL WINAPI ExtTextOutW(HDC hdc,int x,int y,UINT options,CONST RECT *lprect,LPCWSTR lpString,UINT c,CONST INT *lpDx); + WINGDIAPI WINBOOL WINAPI PolyTextOutA(HDC hdc,CONST POLYTEXTA *ppt,int nstrings); + WINGDIAPI WINBOOL WINAPI PolyTextOutW(HDC hdc,CONST POLYTEXTW *ppt,int nstrings); + WINGDIAPI HRGN WINAPI CreatePolygonRgn(CONST POINT *pptl,int cPoint,int iMode); + WINGDIAPI WINBOOL WINAPI DPtoLP(HDC hdc,LPPOINT lppt,int c); + WINGDIAPI WINBOOL WINAPI LPtoDP(HDC hdc,LPPOINT lppt,int c); + WINGDIAPI WINBOOL WINAPI Polygon(HDC hdc,CONST POINT *apt,int cpt); + WINGDIAPI WINBOOL WINAPI Polyline(HDC hdc,CONST POINT *apt,int cpt); + WINGDIAPI WINBOOL WINAPI PolyBezier(HDC hdc,CONST POINT *apt,DWORD cpt); + WINGDIAPI WINBOOL WINAPI PolyBezierTo(HDC hdc,CONST POINT *apt,DWORD cpt); + WINGDIAPI WINBOOL WINAPI PolylineTo(HDC hdc,CONST POINT *apt,DWORD cpt); + WINGDIAPI WINBOOL WINAPI SetViewportExtEx(HDC hdc,int x,int y,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI SetViewportOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI SetWindowExtEx(HDC hdc,int x,int y,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI SetWindowOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI OffsetViewportOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI OffsetWindowOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI ScaleViewportExtEx(HDC hdc,int xn,int dx,int yn,int yd,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI ScaleWindowExtEx(HDC hdc,int xn,int xd,int yn,int yd,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI SetBitmapDimensionEx(HBITMAP hbm,int w,int h,LPSIZE lpsz); + WINGDIAPI WINBOOL WINAPI SetBrushOrgEx(HDC hdc,int x,int y,LPPOINT lppt); + WINGDIAPI int WINAPI GetTextFaceA(HDC hdc,int c,LPSTR lpName); + WINGDIAPI int WINAPI GetTextFaceW(HDC hdc,int c,LPWSTR lpName); + +#define FONTMAPPER_MAX 10 + + typedef struct tagKERNINGPAIR { + WORD wFirst; + WORD wSecond; + int iKernAmount; + } KERNINGPAIR,*LPKERNINGPAIR; + +#ifdef UNICODE +#define GetKerningPairs GetKerningPairsW +#else +#define GetKerningPairs GetKerningPairsA +#endif + + WINGDIAPI DWORD WINAPI GetKerningPairsA(HDC hdc,DWORD nPairs,LPKERNINGPAIR lpKernPair); + WINGDIAPI DWORD WINAPI GetKerningPairsW(HDC hdc,DWORD nPairs,LPKERNINGPAIR lpKernPair); + WINGDIAPI WINBOOL WINAPI GetDCOrgEx(HDC hdc,LPPOINT lppt); + WINGDIAPI WINBOOL WINAPI FixBrushOrgEx(HDC hdc,int x,int y,LPPOINT ptl); + WINGDIAPI WINBOOL WINAPI UnrealizeObject(HGDIOBJ h); + WINGDIAPI WINBOOL WINAPI GdiFlush(); + WINGDIAPI DWORD WINAPI GdiSetBatchLimit(DWORD dw); + WINGDIAPI DWORD WINAPI GdiGetBatchLimit(); + +#define ICM_OFF 1 +#define ICM_ON 2 +#define ICM_QUERY 3 +#define ICM_DONE_OUTSIDEDC 4 + + typedef int (CALLBACK *ICMENUMPROCA)(LPSTR,LPARAM); + typedef int (CALLBACK *ICMENUMPROCW)(LPWSTR,LPARAM); + +#ifdef UNICODE +#define ICMENUMPROC ICMENUMPROCW +#define EnumICMProfiles EnumICMProfilesW +#define UpdateICMRegKey UpdateICMRegKeyW +#define GetLogColorSpace GetLogColorSpaceW +#define CreateColorSpace CreateColorSpaceW +#define GetICMProfile GetICMProfileW +#define SetICMProfile SetICMProfileW +#else +#define ICMENUMPROC ICMENUMPROCA +#define EnumICMProfiles EnumICMProfilesA +#define UpdateICMRegKey UpdateICMRegKeyA +#define GetLogColorSpace GetLogColorSpaceA +#define CreateColorSpace CreateColorSpaceA +#define GetICMProfile GetICMProfileA +#define SetICMProfile SetICMProfileA +#endif + + WINGDIAPI int WINAPI SetICMMode(HDC hdc,int mode); + WINGDIAPI WINBOOL WINAPI CheckColorsInGamut(HDC hdc,LPVOID lpRGBTriple,LPVOID dlpBuffer,DWORD nCount); + WINGDIAPI HCOLORSPACE WINAPI GetColorSpace(HDC hdc); + WINGDIAPI WINBOOL WINAPI GetLogColorSpaceA(HCOLORSPACE hColorSpace,LPLOGCOLORSPACEA lpBuffer,DWORD nSize); + WINGDIAPI WINBOOL WINAPI GetLogColorSpaceW(HCOLORSPACE hColorSpace,LPLOGCOLORSPACEW lpBuffer,DWORD nSize); + WINGDIAPI HCOLORSPACE WINAPI CreateColorSpaceA(LPLOGCOLORSPACEA lplcs); + WINGDIAPI HCOLORSPACE WINAPI CreateColorSpaceW(LPLOGCOLORSPACEW lplcs); + WINGDIAPI HCOLORSPACE WINAPI SetColorSpace(HDC hdc,HCOLORSPACE hcs); + WINGDIAPI WINBOOL WINAPI DeleteColorSpace(HCOLORSPACE hcs); + WINGDIAPI WINBOOL WINAPI GetICMProfileA(HDC hdc,LPDWORD pBufSize,LPSTR pszFilename); + WINGDIAPI WINBOOL WINAPI GetICMProfileW(HDC hdc,LPDWORD pBufSize,LPWSTR pszFilename); + WINGDIAPI WINBOOL WINAPI SetICMProfileA(HDC hdc,LPSTR lpFileName); + WINGDIAPI WINBOOL WINAPI SetICMProfileW(HDC hdc,LPWSTR lpFileName); + WINGDIAPI WINBOOL WINAPI GetDeviceGammaRamp(HDC hdc,LPVOID lpRamp); + WINGDIAPI WINBOOL WINAPI SetDeviceGammaRamp(HDC hdc,LPVOID lpRamp); + WINGDIAPI WINBOOL WINAPI ColorMatchToTarget(HDC hdc,HDC hdcTarget,DWORD action); + WINGDIAPI int WINAPI EnumICMProfilesA(HDC hdc,ICMENUMPROCA proc,LPARAM param); + WINGDIAPI int WINAPI EnumICMProfilesW(HDC hdc,ICMENUMPROCW proc,LPARAM param); + WINGDIAPI WINBOOL WINAPI UpdateICMRegKeyA(DWORD reserved,LPSTR lpszCMID,LPSTR lpszFileName,UINT command); + WINGDIAPI WINBOOL WINAPI UpdateICMRegKeyW(DWORD reserved,LPWSTR lpszCMID,LPWSTR lpszFileName,UINT command); + WINGDIAPI WINBOOL WINAPI ColorCorrectPalette(HDC hdc,HPALETTE hPal,DWORD deFirst,DWORD num); + +#ifndef NOMETAFILE + +#define ENHMETA_SIGNATURE 0x464D4520 +#define ENHMETA_STOCK_OBJECT 0x80000000 + +#define EMR_HEADER 1 +#define EMR_POLYBEZIER 2 +#define EMR_POLYGON 3 +#define EMR_POLYLINE 4 +#define EMR_POLYBEZIERTO 5 +#define EMR_POLYLINETO 6 +#define EMR_POLYPOLYLINE 7 +#define EMR_POLYPOLYGON 8 +#define EMR_SETWINDOWEXTEX 9 +#define EMR_SETWINDOWORGEX 10 +#define EMR_SETVIEWPORTEXTEX 11 +#define EMR_SETVIEWPORTORGEX 12 +#define EMR_SETBRUSHORGEX 13 +#define EMR_EOF 14 +#define EMR_SETPIXELV 15 +#define EMR_SETMAPPERFLAGS 16 +#define EMR_SETMAPMODE 17 +#define EMR_SETBKMODE 18 +#define EMR_SETPOLYFILLMODE 19 +#define EMR_SETROP2 20 +#define EMR_SETSTRETCHBLTMODE 21 +#define EMR_SETTEXTALIGN 22 +#define EMR_SETCOLORADJUSTMENT 23 +#define EMR_SETTEXTCOLOR 24 +#define EMR_SETBKCOLOR 25 +#define EMR_OFFSETCLIPRGN 26 +#define EMR_MOVETOEX 27 +#define EMR_SETMETARGN 28 +#define EMR_EXCLUDECLIPRECT 29 +#define EMR_INTERSECTCLIPRECT 30 +#define EMR_SCALEVIEWPORTEXTEX 31 +#define EMR_SCALEWINDOWEXTEX 32 +#define EMR_SAVEDC 33 +#define EMR_RESTOREDC 34 +#define EMR_SETWORLDTRANSFORM 35 +#define EMR_MODIFYWORLDTRANSFORM 36 +#define EMR_SELECTOBJECT 37 +#define EMR_CREATEPEN 38 +#define EMR_CREATEBRUSHINDIRECT 39 +#define EMR_DELETEOBJECT 40 +#define EMR_ANGLEARC 41 +#define EMR_ELLIPSE 42 +#define EMR_RECTANGLE 43 +#define EMR_ROUNDRECT 44 +#define EMR_ARC 45 +#define EMR_CHORD 46 +#define EMR_PIE 47 +#define EMR_SELECTPALETTE 48 +#define EMR_CREATEPALETTE 49 +#define EMR_SETPALETTEENTRIES 50 +#define EMR_RESIZEPALETTE 51 +#define EMR_REALIZEPALETTE 52 +#define EMR_EXTFLOODFILL 53 +#define EMR_LINETO 54 +#define EMR_ARCTO 55 +#define EMR_POLYDRAW 56 +#define EMR_SETARCDIRECTION 57 +#define EMR_SETMITERLIMIT 58 +#define EMR_BEGINPATH 59 +#define EMR_ENDPATH 60 +#define EMR_CLOSEFIGURE 61 +#define EMR_FILLPATH 62 +#define EMR_STROKEANDFILLPATH 63 +#define EMR_STROKEPATH 64 +#define EMR_FLATTENPATH 65 +#define EMR_WIDENPATH 66 +#define EMR_SELECTCLIPPATH 67 +#define EMR_ABORTPATH 68 + +#define EMR_GDICOMMENT 70 +#define EMR_FILLRGN 71 +#define EMR_FRAMERGN 72 +#define EMR_INVERTRGN 73 +#define EMR_PAINTRGN 74 +#define EMR_EXTSELECTCLIPRGN 75 +#define EMR_BITBLT 76 +#define EMR_STRETCHBLT 77 +#define EMR_MASKBLT 78 +#define EMR_PLGBLT 79 +#define EMR_SETDIBITSTODEVICE 80 +#define EMR_STRETCHDIBITS 81 +#define EMR_EXTCREATEFONTINDIRECTW 82 +#define EMR_EXTTEXTOUTA 83 +#define EMR_EXTTEXTOUTW 84 +#define EMR_POLYBEZIER16 85 +#define EMR_POLYGON16 86 +#define EMR_POLYLINE16 87 +#define EMR_POLYBEZIERTO16 88 +#define EMR_POLYLINETO16 89 +#define EMR_POLYPOLYLINE16 90 +#define EMR_POLYPOLYGON16 91 +#define EMR_POLYDRAW16 92 +#define EMR_CREATEMONOBRUSH 93 +#define EMR_CREATEDIBPATTERNBRUSHPT 94 +#define EMR_EXTCREATEPEN 95 +#define EMR_POLYTEXTOUTA 96 +#define EMR_POLYTEXTOUTW 97 + +#define EMR_SETICMMODE 98 +#define EMR_CREATECOLORSPACE 99 +#define EMR_SETCOLORSPACE 100 +#define EMR_DELETECOLORSPACE 101 +#define EMR_GLSRECORD 102 +#define EMR_GLSBOUNDEDRECORD 103 +#define EMR_PIXELFORMAT 104 +#define EMR_RESERVED_105 105 +#define EMR_RESERVED_106 106 +#define EMR_RESERVED_107 107 +#define EMR_RESERVED_108 108 +#define EMR_RESERVED_109 109 +#define EMR_RESERVED_110 110 +#define EMR_COLORCORRECTPALETTE 111 +#define EMR_SETICMPROFILEA 112 +#define EMR_SETICMPROFILEW 113 +#define EMR_ALPHABLEND 114 +#define EMR_SETLAYOUT 115 +#define EMR_TRANSPARENTBLT 116 +#define EMR_RESERVED_117 117 +#define EMR_GRADIENTFILL 118 +#define EMR_RESERVED_119 119 +#define EMR_RESERVED_120 120 +#define EMR_COLORMATCHTOTARGETW 121 +#define EMR_CREATECOLORSPACEW 122 + +#define EMR_MIN 1 + +#define EMR_MAX 122 + + typedef struct tagEMR { + DWORD iType; + DWORD nSize; + } EMR,*PEMR; + + typedef struct tagEMRTEXT { + POINTL ptlReference; + DWORD nChars; + DWORD offString; + DWORD fOptions; + RECTL rcl; + DWORD offDx; + } EMRTEXT,*PEMRTEXT; + + typedef struct tagABORTPATH { + EMR emr; + } EMRABORTPATH,*PEMRABORTPATH,EMRBEGINPATH,*PEMRBEGINPATH,EMRENDPATH,*PEMRENDPATH,EMRCLOSEFIGURE,*PEMRCLOSEFIGURE,EMRFLATTENPATH,*PEMRFLATTENPATH,EMRWIDENPATH,*PEMRWIDENPATH,EMRSETMETARGN,*PEMRSETMETARGN,EMRSAVEDC,*PEMRSAVEDC,EMRREALIZEPALETTE,*PEMRREALIZEPALETTE; + + typedef struct tagEMRSELECTCLIPPATH { + EMR emr; + DWORD iMode; + } EMRSELECTCLIPPATH,*PEMRSELECTCLIPPATH,EMRSETBKMODE,*PEMRSETBKMODE,EMRSETMAPMODE,*PEMRSETMAPMODE,EMRSETLAYOUT,*PEMRSETLAYOUT, + EMRSETPOLYFILLMODE,*PEMRSETPOLYFILLMODE,EMRSETROP2,*PEMRSETROP2,EMRSETSTRETCHBLTMODE,*PEMRSETSTRETCHBLTMODE,EMRSETICMMODE, + *PEMRSETICMMODE,EMRSETTEXTALIGN,*PEMRSETTEXTALIGN; + + typedef struct tagEMRSETMITERLIMIT { + EMR emr; + FLOAT eMiterLimit; + } EMRSETMITERLIMIT,*PEMRSETMITERLIMIT; + + typedef struct tagEMRRESTOREDC { + EMR emr; + LONG iRelative; + } EMRRESTOREDC,*PEMRRESTOREDC; + + typedef struct tagEMRSETARCDIRECTION { + EMR emr; + DWORD iArcDirection; + + } EMRSETARCDIRECTION,*PEMRSETARCDIRECTION; + + typedef struct tagEMRSETMAPPERFLAGS { + EMR emr; + DWORD dwFlags; + } EMRSETMAPPERFLAGS,*PEMRSETMAPPERFLAGS; + + typedef struct tagEMRSETTEXTCOLOR { + EMR emr; + COLORREF crColor; + } EMRSETBKCOLOR,*PEMRSETBKCOLOR,EMRSETTEXTCOLOR,*PEMRSETTEXTCOLOR; + + typedef struct tagEMRSELECTOBJECT { + EMR emr; + DWORD ihObject; + } EMRSELECTOBJECT,*PEMRSELECTOBJECT,EMRDELETEOBJECT,*PEMRDELETEOBJECT; + + typedef struct tagEMRSELECTPALETTE { + EMR emr; + DWORD ihPal; + } EMRSELECTPALETTE,*PEMRSELECTPALETTE; + + typedef struct tagEMRRESIZEPALETTE { + EMR emr; + DWORD ihPal; + DWORD cEntries; + } EMRRESIZEPALETTE,*PEMRRESIZEPALETTE; + + typedef struct tagEMRSETPALETTEENTRIES { + EMR emr; + DWORD ihPal; + DWORD iStart; + DWORD cEntries; + PALETTEENTRY aPalEntries[1]; + } EMRSETPALETTEENTRIES,*PEMRSETPALETTEENTRIES; + + typedef struct tagEMRSETCOLORADJUSTMENT { + EMR emr; + COLORADJUSTMENT ColorAdjustment; + } EMRSETCOLORADJUSTMENT,*PEMRSETCOLORADJUSTMENT; + + typedef struct tagEMRGDICOMMENT { + EMR emr; + DWORD cbData; + BYTE Data[1]; + } EMRGDICOMMENT,*PEMRGDICOMMENT; + + typedef struct tagEMREOF { + EMR emr; + DWORD nPalEntries; + DWORD offPalEntries; + DWORD nSizeLast; + } EMREOF,*PEMREOF; + + typedef struct tagEMRLINETO { + EMR emr; + POINTL ptl; + } EMRLINETO,*PEMRLINETO,EMRMOVETOEX,*PEMRMOVETOEX; + + typedef struct tagEMROFFSETCLIPRGN { + EMR emr; + POINTL ptlOffset; + } EMROFFSETCLIPRGN,*PEMROFFSETCLIPRGN; + + typedef struct tagEMRFILLPATH { + EMR emr; + RECTL rclBounds; + } EMRFILLPATH,*PEMRFILLPATH,EMRSTROKEANDFILLPATH,*PEMRSTROKEANDFILLPATH,EMRSTROKEPATH,*PEMRSTROKEPATH; + + typedef struct tagEMREXCLUDECLIPRECT { + EMR emr; + RECTL rclClip; + } EMREXCLUDECLIPRECT,*PEMREXCLUDECLIPRECT,EMRINTERSECTCLIPRECT,*PEMRINTERSECTCLIPRECT; + + typedef struct tagEMRSETVIEWPORTORGEX { + EMR emr; + POINTL ptlOrigin; + } EMRSETVIEWPORTORGEX,*PEMRSETVIEWPORTORGEX,EMRSETWINDOWORGEX,*PEMRSETWINDOWORGEX,EMRSETBRUSHORGEX,*PEMRSETBRUSHORGEX; + + typedef struct tagEMRSETVIEWPORTEXTEX { + EMR emr; + SIZEL szlExtent; + } EMRSETVIEWPORTEXTEX,*PEMRSETVIEWPORTEXTEX,EMRSETWINDOWEXTEX,*PEMRSETWINDOWEXTEX; + + typedef struct tagEMRSCALEVIEWPORTEXTEX { + EMR emr; + LONG xNum; + LONG xDenom; + LONG yNum; + LONG yDenom; + } EMRSCALEVIEWPORTEXTEX,*PEMRSCALEVIEWPORTEXTEX,EMRSCALEWINDOWEXTEX,*PEMRSCALEWINDOWEXTEX; + + typedef struct tagEMRSETWORLDTRANSFORM { + EMR emr; + XFORM xform; + } EMRSETWORLDTRANSFORM,*PEMRSETWORLDTRANSFORM; + + typedef struct tagEMRMODIFYWORLDTRANSFORM { + EMR emr; + XFORM xform; + DWORD iMode; + } EMRMODIFYWORLDTRANSFORM,*PEMRMODIFYWORLDTRANSFORM; + + typedef struct tagEMRSETPIXELV { + EMR emr; + POINTL ptlPixel; + COLORREF crColor; + } EMRSETPIXELV,*PEMRSETPIXELV; + + typedef struct tagEMREXTFLOODFILL { + EMR emr; + POINTL ptlStart; + COLORREF crColor; + DWORD iMode; + } EMREXTFLOODFILL,*PEMREXTFLOODFILL; + + typedef struct tagEMRELLIPSE { + EMR emr; + RECTL rclBox; + } EMRELLIPSE,*PEMRELLIPSE,EMRRECTANGLE,*PEMRRECTANGLE; + + typedef struct tagEMRROUNDRECT { + EMR emr; + RECTL rclBox; + SIZEL szlCorner; + } EMRROUNDRECT,*PEMRROUNDRECT; + + typedef struct tagEMRARC { + EMR emr; + RECTL rclBox; + POINTL ptlStart; + POINTL ptlEnd; + } EMRARC,*PEMRARC,EMRARCTO,*PEMRARCTO,EMRCHORD,*PEMRCHORD,EMRPIE,*PEMRPIE; + + typedef struct tagEMRANGLEARC { + EMR emr; + POINTL ptlCenter; + DWORD nRadius; + FLOAT eStartAngle; + FLOAT eSweepAngle; + } EMRANGLEARC,*PEMRANGLEARC; + + typedef struct tagEMRPOLYLINE { + EMR emr; + RECTL rclBounds; + DWORD cptl; + POINTL aptl[1]; + } EMRPOLYLINE,*PEMRPOLYLINE,EMRPOLYBEZIER,*PEMRPOLYBEZIER,EMRPOLYGON,*PEMRPOLYGON,EMRPOLYBEZIERTO,*PEMRPOLYBEZIERTO,EMRPOLYLINETO,*PEMRPOLYLINETO; + + typedef struct tagEMRPOLYLINE16 { + EMR emr; + RECTL rclBounds; + DWORD cpts; + POINTS apts[1]; + } EMRPOLYLINE16,*PEMRPOLYLINE16,EMRPOLYBEZIER16,*PEMRPOLYBEZIER16,EMRPOLYGON16,*PEMRPOLYGON16,EMRPOLYBEZIERTO16,*PEMRPOLYBEZIERTO16,EMRPOLYLINETO16,*PEMRPOLYLINETO16; + + typedef struct tagEMRPOLYDRAW { + EMR emr; + RECTL rclBounds; + DWORD cptl; + POINTL aptl[1]; + BYTE abTypes[1]; + } EMRPOLYDRAW,*PEMRPOLYDRAW; + + typedef struct tagEMRPOLYDRAW16 { + EMR emr; + RECTL rclBounds; + DWORD cpts; + POINTS apts[1]; + BYTE abTypes[1]; + } EMRPOLYDRAW16,*PEMRPOLYDRAW16; + + typedef struct tagEMRPOLYPOLYLINE { + EMR emr; + RECTL rclBounds; + DWORD nPolys; + DWORD cptl; + DWORD aPolyCounts[1]; + POINTL aptl[1]; + } EMRPOLYPOLYLINE,*PEMRPOLYPOLYLINE,EMRPOLYPOLYGON,*PEMRPOLYPOLYGON; + + typedef struct tagEMRPOLYPOLYLINE16 { + EMR emr; + RECTL rclBounds; + DWORD nPolys; + DWORD cpts; + DWORD aPolyCounts[1]; + POINTS apts[1]; + } EMRPOLYPOLYLINE16,*PEMRPOLYPOLYLINE16,EMRPOLYPOLYGON16,*PEMRPOLYPOLYGON16; + + typedef struct tagEMRINVERTRGN { + EMR emr; + RECTL rclBounds; + DWORD cbRgnData; + BYTE RgnData[1]; + } EMRINVERTRGN,*PEMRINVERTRGN,EMRPAINTRGN,*PEMRPAINTRGN; + + typedef struct tagEMRFILLRGN { + EMR emr; + RECTL rclBounds; + DWORD cbRgnData; + DWORD ihBrush; + BYTE RgnData[1]; + } EMRFILLRGN,*PEMRFILLRGN; + + typedef struct tagEMRFRAMERGN { + EMR emr; + RECTL rclBounds; + DWORD cbRgnData; + DWORD ihBrush; + SIZEL szlStroke; + BYTE RgnData[1]; + } EMRFRAMERGN,*PEMRFRAMERGN; + + typedef struct tagEMREXTSELECTCLIPRGN { + EMR emr; + DWORD cbRgnData; + DWORD iMode; + BYTE RgnData[1]; + } EMREXTSELECTCLIPRGN,*PEMREXTSELECTCLIPRGN; + + typedef struct tagEMREXTTEXTOUTA { + EMR emr; + RECTL rclBounds; + DWORD iGraphicsMode; + FLOAT exScale; + FLOAT eyScale; + EMRTEXT emrtext; + } EMREXTTEXTOUTA,*PEMREXTTEXTOUTA,EMREXTTEXTOUTW,*PEMREXTTEXTOUTW; + + typedef struct tagEMRPOLYTEXTOUTA { + EMR emr; + RECTL rclBounds; + DWORD iGraphicsMode; + FLOAT exScale; + FLOAT eyScale; + LONG cStrings; + EMRTEXT aemrtext[1]; + } EMRPOLYTEXTOUTA,*PEMRPOLYTEXTOUTA,EMRPOLYTEXTOUTW,*PEMRPOLYTEXTOUTW; + + typedef struct tagEMRBITBLT { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + } EMRBITBLT,*PEMRBITBLT; + + typedef struct tagEMRSTRETCHBLT { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG cxSrc; + LONG cySrc; + } EMRSTRETCHBLT,*PEMRSTRETCHBLT; + + typedef struct tagEMRMASKBLT { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG xMask; + LONG yMask; + DWORD iUsageMask; + DWORD offBmiMask; + DWORD cbBmiMask; + DWORD offBitsMask; + DWORD cbBitsMask; + } EMRMASKBLT,*PEMRMASKBLT; + + typedef struct tagEMRPLGBLT { + EMR emr; + RECTL rclBounds; + POINTL aptlDest[3]; + LONG xSrc; + LONG ySrc; + LONG cxSrc; + LONG cySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG xMask; + LONG yMask; + DWORD iUsageMask; + DWORD offBmiMask; + DWORD cbBmiMask; + DWORD offBitsMask; + DWORD cbBitsMask; + } EMRPLGBLT,*PEMRPLGBLT; + + typedef struct tagEMRSETDIBITSTODEVICE { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG xSrc; + LONG ySrc; + LONG cxSrc; + LONG cySrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + DWORD iUsageSrc; + DWORD iStartScan; + DWORD cScans; + } EMRSETDIBITSTODEVICE,*PEMRSETDIBITSTODEVICE; + + typedef struct tagEMRSTRETCHDIBITS { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG xSrc; + LONG ySrc; + LONG cxSrc; + LONG cySrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + DWORD iUsageSrc; + DWORD dwRop; + LONG cxDest; + LONG cyDest; + } EMRSTRETCHDIBITS,*PEMRSTRETCHDIBITS; + + typedef struct tagEMREXTCREATEFONTINDIRECTW { + EMR emr; + DWORD ihFont; + EXTLOGFONTW elfw; + } EMREXTCREATEFONTINDIRECTW,*PEMREXTCREATEFONTINDIRECTW; + + typedef struct tagEMRCREATEPALETTE { + EMR emr; + DWORD ihPal; + LOGPALETTE lgpl; + } EMRCREATEPALETTE,*PEMRCREATEPALETTE; + + typedef struct tagEMRCREATEPEN { + EMR emr; + DWORD ihPen; + LOGPEN lopn; + } EMRCREATEPEN,*PEMRCREATEPEN; + + typedef struct tagEMREXTCREATEPEN { + EMR emr; + DWORD ihPen; + DWORD offBmi; + DWORD cbBmi; + DWORD offBits; + DWORD cbBits; + EXTLOGPEN elp; + } EMREXTCREATEPEN,*PEMREXTCREATEPEN; + + typedef struct tagEMRCREATEBRUSHINDIRECT { + EMR emr; + DWORD ihBrush; + LOGBRUSH32 lb; + } EMRCREATEBRUSHINDIRECT,*PEMRCREATEBRUSHINDIRECT; + + typedef struct tagEMRCREATEMONOBRUSH { + EMR emr; + DWORD ihBrush; + DWORD iUsage; + DWORD offBmi; + DWORD cbBmi; + DWORD offBits; + DWORD cbBits; + } EMRCREATEMONOBRUSH,*PEMRCREATEMONOBRUSH; + + typedef struct tagEMRCREATEDIBPATTERNBRUSHPT { + EMR emr; + DWORD ihBrush; + DWORD iUsage; + DWORD offBmi; + DWORD cbBmi; + DWORD offBits; + DWORD cbBits; + } EMRCREATEDIBPATTERNBRUSHPT,*PEMRCREATEDIBPATTERNBRUSHPT; + + typedef struct tagEMRFORMAT { + DWORD dSignature; + DWORD nVersion; + DWORD cbData; + DWORD offData; + } EMRFORMAT,*PEMRFORMAT; + + typedef struct tagEMRGLSRECORD { + EMR emr; + DWORD cbData; + BYTE Data[1]; + } EMRGLSRECORD,*PEMRGLSRECORD; + + typedef struct tagEMRGLSBOUNDEDRECORD { + EMR emr; + RECTL rclBounds; + DWORD cbData; + BYTE Data[1]; + } EMRGLSBOUNDEDRECORD,*PEMRGLSBOUNDEDRECORD; + + typedef struct tagEMRPIXELFORMAT { + EMR emr; + PIXELFORMATDESCRIPTOR pfd; + } EMRPIXELFORMAT,*PEMRPIXELFORMAT; + + typedef struct tagEMRCREATECOLORSPACE { + EMR emr; + DWORD ihCS; + LOGCOLORSPACEA lcs; + } EMRCREATECOLORSPACE,*PEMRCREATECOLORSPACE; + + typedef struct tagEMRSETCOLORSPACE { + EMR emr; + DWORD ihCS; + } EMRSETCOLORSPACE,*PEMRSETCOLORSPACE,EMRSELECTCOLORSPACE,*PEMRSELECTCOLORSPACE,EMRDELETECOLORSPACE,*PEMRDELETECOLORSPACE; + + typedef struct tagEMREXTESCAPE { + EMR emr; + INT iEscape; + INT cbEscData; + BYTE EscData[1]; + } EMREXTESCAPE,*PEMREXTESCAPE,EMRDRAWESCAPE,*PEMRDRAWESCAPE; + + typedef struct tagEMRNAMEDESCAPE { + EMR emr; + INT iEscape; + INT cbDriver; + INT cbEscData; + BYTE EscData[1]; + } EMRNAMEDESCAPE,*PEMRNAMEDESCAPE; + +#define SETICMPROFILE_EMBEDED 0x00000001 + + typedef struct tagEMRSETICMPROFILE { + EMR emr; + DWORD dwFlags; + DWORD cbName; + DWORD cbData; + BYTE Data[1]; + } EMRSETICMPROFILE,*PEMRSETICMPROFILE,EMRSETICMPROFILEA,*PEMRSETICMPROFILEA,EMRSETICMPROFILEW,*PEMRSETICMPROFILEW; + +#define CREATECOLORSPACE_EMBEDED 0x00000001 + + typedef struct tagEMRCREATECOLORSPACEW { + EMR emr; + DWORD ihCS; + LOGCOLORSPACEW lcs; + DWORD dwFlags; + DWORD cbData; + BYTE Data[1]; + } EMRCREATECOLORSPACEW,*PEMRCREATECOLORSPACEW; + +#define COLORMATCHTOTARGET_EMBEDED 0x00000001 + + typedef struct tagCOLORMATCHTOTARGET { + EMR emr; + DWORD dwAction; + DWORD dwFlags; + DWORD cbName; + DWORD cbData; + BYTE Data[1]; + } EMRCOLORMATCHTOTARGET,*PEMRCOLORMATCHTOTARGET; + + typedef struct tagCOLORCORRECTPALETTE { + EMR emr; + DWORD ihPalette; + DWORD nFirstEntry; + DWORD nPalEntries; + DWORD nReserved; + } EMRCOLORCORRECTPALETTE,*PEMRCOLORCORRECTPALETTE; + + typedef struct tagEMRALPHABLEND { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG cxSrc; + LONG cySrc; + } EMRALPHABLEND,*PEMRALPHABLEND; + + typedef struct tagEMRGRADIENTFILL { + EMR emr; + RECTL rclBounds; + DWORD nVer; + DWORD nTri; + ULONG ulMode; + TRIVERTEX Ver[1]; + } EMRGRADIENTFILL,*PEMRGRADIENTFILL; + + typedef struct tagEMRTRANSPARENTBLT { + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG cxSrc; + LONG cySrc; + } EMRTRANSPARENTBLT,*PEMRTRANSPARENTBLT; + +#define GDICOMMENT_IDENTIFIER 0x43494447 +#define GDICOMMENT_WINDOWS_METAFILE 0x80000001 +#define GDICOMMENT_BEGINGROUP 0x00000002 +#define GDICOMMENT_ENDGROUP 0x00000003 +#define GDICOMMENT_MULTIFORMATS 0x40000004 +#define EPS_SIGNATURE 0x46535045 +#define GDICOMMENT_UNICODE_STRING 0x00000040 +#define GDICOMMENT_UNICODE_END 0x00000080 +#endif + +#ifdef UNICODE +#define wglUseFontBitmaps wglUseFontBitmapsW +#else +#define wglUseFontBitmaps wglUseFontBitmapsA +#endif + + WINGDIAPI WINBOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT); + WINGDIAPI HGLRC WINAPI wglCreateContext(HDC); + WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int); + WINGDIAPI WINBOOL WINAPI wglDeleteContext(HGLRC); + WINGDIAPI HGLRC WINAPI wglGetCurrentContext(VOID); + WINGDIAPI HDC WINAPI wglGetCurrentDC(VOID); + WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR); + WINGDIAPI WINBOOL WINAPI wglMakeCurrent(HDC,HGLRC); + WINGDIAPI WINBOOL WINAPI wglShareLists(HGLRC,HGLRC); + WINGDIAPI WINBOOL WINAPI wglUseFontBitmapsA(HDC,DWORD,DWORD,DWORD); + WINGDIAPI WINBOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD); + WINGDIAPI WINBOOL WINAPI SwapBuffers(HDC); + + typedef struct _POINTFLOAT { + FLOAT x; + FLOAT y; + } POINTFLOAT,*PPOINTFLOAT; + + typedef struct _GLYPHMETRICSFLOAT { + FLOAT gmfBlackBoxX; + FLOAT gmfBlackBoxY; + POINTFLOAT gmfptGlyphOrigin; + FLOAT gmfCellIncX; + FLOAT gmfCellIncY; + } GLYPHMETRICSFLOAT,*PGLYPHMETRICSFLOAT,*LPGLYPHMETRICSFLOAT; + +#define WGL_FONT_LINES 0 +#define WGL_FONT_POLYGONS 1 + +#ifdef UNICODE +#define wglUseFontOutlines wglUseFontOutlinesW +#else +#define wglUseFontOutlines wglUseFontOutlinesA +#endif + + WINGDIAPI WINBOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); + WINGDIAPI WINBOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); + + typedef struct tagLAYERPLANEDESCRIPTOR { + WORD nSize; + WORD nVersion; + DWORD dwFlags; + BYTE iPixelType; + BYTE cColorBits; + BYTE cRedBits; + BYTE cRedShift; + BYTE cGreenBits; + BYTE cGreenShift; + BYTE cBlueBits; + BYTE cBlueShift; + BYTE cAlphaBits; + BYTE cAlphaShift; + BYTE cAccumBits; + BYTE cAccumRedBits; + BYTE cAccumGreenBits; + BYTE cAccumBlueBits; + BYTE cAccumAlphaBits; + BYTE cDepthBits; + BYTE cStencilBits; + BYTE cAuxBuffers; + BYTE iLayerPlane; + BYTE bReserved; + COLORREF crTransparent; + } LAYERPLANEDESCRIPTOR,*PLAYERPLANEDESCRIPTOR,*LPLAYERPLANEDESCRIPTOR; + +#define LPD_DOUBLEBUFFER 0x00000001 +#define LPD_STEREO 0x00000002 +#define LPD_SUPPORT_GDI 0x00000010 +#define LPD_SUPPORT_OPENGL 0x00000020 +#define LPD_SHARE_DEPTH 0x00000040 +#define LPD_SHARE_STENCIL 0x00000080 +#define LPD_SHARE_ACCUM 0x00000100 +#define LPD_SWAP_EXCHANGE 0x00000200 +#define LPD_SWAP_COPY 0x00000400 +#define LPD_TRANSPARENT 0x00001000 + +#define LPD_TYPE_RGBA 0 +#define LPD_TYPE_COLORINDEX 1 + +#define WGL_SWAP_MAIN_PLANE 0x00000001 +#define WGL_SWAP_OVERLAY1 0x00000002 +#define WGL_SWAP_OVERLAY2 0x00000004 +#define WGL_SWAP_OVERLAY3 0x00000008 +#define WGL_SWAP_OVERLAY4 0x00000010 +#define WGL_SWAP_OVERLAY5 0x00000020 +#define WGL_SWAP_OVERLAY6 0x00000040 +#define WGL_SWAP_OVERLAY7 0x00000080 +#define WGL_SWAP_OVERLAY8 0x00000100 +#define WGL_SWAP_OVERLAY9 0x00000200 +#define WGL_SWAP_OVERLAY10 0x00000400 +#define WGL_SWAP_OVERLAY11 0x00000800 +#define WGL_SWAP_OVERLAY12 0x00001000 +#define WGL_SWAP_OVERLAY13 0x00002000 +#define WGL_SWAP_OVERLAY14 0x00004000 +#define WGL_SWAP_OVERLAY15 0x00008000 +#define WGL_SWAP_UNDERLAY1 0x00010000 +#define WGL_SWAP_UNDERLAY2 0x00020000 +#define WGL_SWAP_UNDERLAY3 0x00040000 +#define WGL_SWAP_UNDERLAY4 0x00080000 +#define WGL_SWAP_UNDERLAY5 0x00100000 +#define WGL_SWAP_UNDERLAY6 0x00200000 +#define WGL_SWAP_UNDERLAY7 0x00400000 +#define WGL_SWAP_UNDERLAY8 0x00800000 +#define WGL_SWAP_UNDERLAY9 0x01000000 +#define WGL_SWAP_UNDERLAY10 0x02000000 +#define WGL_SWAP_UNDERLAY11 0x04000000 +#define WGL_SWAP_UNDERLAY12 0x08000000 +#define WGL_SWAP_UNDERLAY13 0x10000000 +#define WGL_SWAP_UNDERLAY14 0x20000000 +#define WGL_SWAP_UNDERLAY15 0x40000000 + + WINGDIAPI WINBOOL WINAPI wglDescribeLayerPlane(HDC,int,int,UINT,LPLAYERPLANEDESCRIPTOR); + WINGDIAPI int WINAPI wglSetLayerPaletteEntries(HDC,int,int,int,CONST COLORREF *); + WINGDIAPI int WINAPI wglGetLayerPaletteEntries(HDC,int,int,int,COLORREF *); + WINGDIAPI WINBOOL WINAPI wglRealizeLayerPalette(HDC,int,WINBOOL); + WINGDIAPI WINBOOL WINAPI wglSwapLayerBuffers(HDC,UINT); + + typedef struct _WGLSWAP { + HDC hdc; + UINT uiFlags; + } WGLSWAP,*PWGLSWAP,*LPWGLSWAP; + +#define WGL_SWAPMULTIPLE_MAX 16 + + WINGDIAPI DWORD WINAPI wglSwapMultipleBuffers(UINT,CONST WGLSWAP *); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/winnt.h b/overlay_toolchain/tcc/include/winapi/winnt.h new file mode 100644 index 00000000..4cf685d2 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/winnt.h @@ -0,0 +1,5835 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINNT_ +#define _WINNT_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#define ANYSIZE_ARRAY 1 + +//gr #include + +#define RESTRICTED_POINTER + +#ifndef __CRT_UNALIGNED +#define __CRT_UNALIGNED +#endif + +#if defined(__ia64__) || defined(__x86_64) +#define UNALIGNED __CRT_UNALIGNED +#ifdef _WIN64 +#define UNALIGNED64 __CRT_UNALIGNED +#else +#define UNALIGNED64 +#endif +#else +#define UNALIGNED +#define UNALIGNED64 +#endif + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && (defined(_X86_) && !defined(__x86_64)) +#define I_X86_ +#endif + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(__x86_64) +#define _AMD64_ +#endif + +#if !defined(I_X86_) && !(defined(_X86_) && !defined(__x86_64)) && !defined(_AMD64_) && defined(__ia64__) +#if !defined(_IA64_) +#define _IA64_ +#endif +#endif + + +#ifdef _WIN64 +#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG) +#define MEMORY_ALLOCATION_ALIGNMENT 16 +#else +#define MAX_NATURAL_ALIGNMENT sizeof(DWORD) +#define MEMORY_ALLOCATION_ALIGNMENT 8 +#endif + +#ifdef __cplusplus +#define TYPE_ALIGNMENT(t) __alignof__ (t) +#else +#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; },test) +#endif + +#ifdef _WIN64 +#ifdef _AMD64_ +#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD) +#elif defined(_IA64_) +#define PROBE_ALIGNMENT(_s) (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD)) +#else +#error No Target Architecture +#endif +#define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD) +#else +#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD) +#endif + +#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] + +#include + +#if defined(_X86_) || defined(__ia64__) || defined(__x86_64) +#define DECLSPEC_IMPORT __declspec(dllimport) +#else +#define DECLSPEC_IMPORT +#endif + +#ifndef DECLSPEC_NORETURN +#define DECLSPEC_NORETURN __declspec(noreturn) +#endif + +#ifndef DECLSPEC_ALIGN +#define DECLSPEC_ALIGN(x) __attribute__ ((aligned(x))) +#endif + +#ifndef SYSTEM_CACHE_ALIGNMENT_SIZE +#if defined(_AMD64_) || defined(I_X86_) +#define SYSTEM_CACHE_ALIGNMENT_SIZE 64 +#else +#define SYSTEM_CACHE_ALIGNMENT_SIZE 128 +#endif +#endif + +#ifndef DECLSPEC_CACHEALIGN +#define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE) +#endif + +#ifndef DECLSPEC_UUID +#define DECLSPEC_UUID(x) +#endif + +#ifndef DECLSPEC_NOVTABLE +#define DECLSPEC_NOVTABLE +#endif + +#ifndef DECLSPEC_SELECTANY +#define DECLSPEC_SELECTANY __declspec(selectany) +#endif + +#ifndef NOP_FUNCTION +#define NOP_FUNCTION (void)0 +#endif + +#ifndef DECLSPEC_NOINLINE +#define DECLSPEC_NOINLINE +#endif + +#ifndef FORCEINLINE +#define FORCEINLINE static __inline__ +#endif + +#ifndef DECLSPEC_DEPRECATED +#define DECLSPEC_DEPRECATED __declspec(deprecated) +#define DEPRECATE_SUPPORTED +#endif + +#define DECLSPEC_DEPRECATED_DDK +#define PRAGMA_DEPRECATED_DDK 0 + + typedef void *PVOID; + typedef void *PVOID64; + +#define NTAPI __stdcall +#define NTSYSAPI DECLSPEC_IMPORT +#define NTSYSCALLAPI DECLSPEC_IMPORT + +#ifndef VOID +#define VOID void + typedef char CHAR; + typedef short SHORT; + typedef long LONG; +#endif + + typedef wchar_t WCHAR; + typedef WCHAR *PWCHAR,*LPWCH,*PWCH; + typedef CONST WCHAR *LPCWCH,*PCWCH; + typedef WCHAR *NWPSTR,*LPWSTR,*PWSTR; + typedef PWSTR *PZPWSTR; + typedef CONST PWSTR *PCZPWSTR; + typedef WCHAR UNALIGNED *LPUWSTR,*PUWSTR; + typedef CONST WCHAR *LPCWSTR,*PCWSTR; + typedef PCWSTR *PZPCWSTR; + typedef CONST WCHAR UNALIGNED *LPCUWSTR,*PCUWSTR; + typedef CHAR *PCHAR,*LPCH,*PCH; + typedef CONST CHAR *LPCCH,*PCCH; + typedef CHAR *NPSTR,*LPSTR,*PSTR; + typedef PSTR *PZPSTR; + typedef CONST PSTR *PCZPSTR; + typedef CONST CHAR *LPCSTR,*PCSTR; + typedef PCSTR *PZPCSTR; + +#ifdef UNICODE +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED + typedef WCHAR TCHAR,*PTCHAR; + typedef WCHAR TBYTE ,*PTBYTE; +#endif + + typedef LPWSTR LPTCH,PTCH; + typedef LPWSTR PTSTR,LPTSTR; + typedef LPCWSTR PCTSTR,LPCTSTR; + typedef LPUWSTR PUTSTR,LPUTSTR; + typedef LPCUWSTR PCUTSTR,LPCUTSTR; + typedef LPWSTR LP; +#define __TEXT(quote) L##quote +#else +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED + typedef char TCHAR,*PTCHAR; + typedef unsigned char TBYTE ,*PTBYTE; +#endif + + typedef LPSTR LPTCH,PTCH; + typedef LPSTR PTSTR,LPTSTR,PUTSTR,LPUTSTR; + typedef LPCSTR PCTSTR,LPCTSTR,PCUTSTR,LPCUTSTR; +#define __TEXT(quote) quote +#endif + +#define TEXT(quote) __TEXT(quote) + + typedef SHORT *PSHORT; + typedef LONG *PLONG; + + typedef void *HANDLE; +#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name + typedef HANDLE *PHANDLE; + + typedef BYTE FCHAR; + typedef WORD FSHORT; + typedef DWORD FLONG; + +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED + typedef LONG HRESULT; +#endif + +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C extern +#endif + +#define STDMETHODCALLTYPE WINAPI +#define STDMETHODVCALLTYPE __cdecl +#define STDAPICALLTYPE WINAPI +#define STDAPIVCALLTYPE __cdecl +#define STDAPI EXTERN_C HRESULT WINAPI +#define STDAPI_(type) EXTERN_C type WINAPI +#define STDMETHODIMP HRESULT WINAPI +#define STDMETHODIMP_(type) type WINAPI +#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE +#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE +#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE +#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE + + typedef char CCHAR; +#ifndef _LCID_DEFINED +#define _LCID_DEFINED +typedef DWORD LCID; +#endif + typedef PDWORD PLCID; +#ifndef _LANGID_DEFINED +#define _LANGID_DEFINED + typedef WORD LANGID; +#endif +#define APPLICATION_ERROR_MASK 0x20000000 +#define ERROR_SEVERITY_SUCCESS 0x00000000 +#define ERROR_SEVERITY_INFORMATIONAL 0x40000000 +#define ERROR_SEVERITY_WARNING 0x80000000 +#define ERROR_SEVERITY_ERROR 0xC0000000 + +#ifdef __ia64__ + __declspec(align(16)) +#endif + typedef struct _FLOAT128 { + __int64 LowPart; + __int64 HighPart; + } FLOAT128; + + typedef FLOAT128 *PFLOAT128; + +#define _ULONGLONG_ +#if((!(defined(_X86_) && !defined(__x86_64)) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64))) + typedef __int64 LONGLONG; + typedef unsigned __int64 ULONGLONG; + +#define MAXLONGLONG (0x7fffffffffffffff) +#else + + typedef double LONGLONG; + typedef double ULONGLONG; +#endif + + typedef LONGLONG *PLONGLONG; + typedef ULONGLONG *PULONGLONG; + + typedef LONGLONG USN; + + typedef union _LARGE_INTEGER { + struct { + DWORD LowPart; + LONG HighPart; + }; + struct { + DWORD LowPart; + LONG HighPart; + } u; + LONGLONG QuadPart; + } LARGE_INTEGER; + + typedef LARGE_INTEGER *PLARGE_INTEGER; + + typedef union _ULARGE_INTEGER { + struct { + DWORD LowPart; + DWORD HighPart; + }; + struct { + DWORD LowPart; + DWORD HighPart; + } u; + ULONGLONG QuadPart; + } ULARGE_INTEGER; + + typedef ULARGE_INTEGER *PULARGE_INTEGER; + + typedef struct _LUID { + DWORD LowPart; + LONG HighPart; + } LUID,*PLUID; + +#define _DWORDLONG_ + typedef ULONGLONG DWORDLONG; + typedef DWORDLONG *PDWORDLONG; + +#ifdef RC_INVOKED +#define Int32x32To64(a,b) ((LONGLONG)((LONG)(a)) *(LONGLONG)((LONG)(b))) +#define UInt32x32To64(a,b) ((ULONGLONG)((DWORD)(a)) *(ULONGLONG)((DWORD)(b))) +#define Int64ShrlMod32(a,b) ((ULONGLONG)(a) >> (b)) +#elif (defined(_X86_) && !defined(__x86_64)) +#define Int32x32To64(a,b) (LONGLONG)((LONGLONG)(LONG)(a) *(LONG)(b)) +#define UInt32x32To64(a,b) (ULONGLONG)((ULONGLONG)(DWORD)(a) *(DWORD)(b)) +#define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b)) +#elif defined(__ia64__) || defined(__x86_64) +#define Int32x32To64(a,b) ((LONGLONG)((LONG)(a)) *(LONGLONG)((LONG)(b))) +#define UInt32x32To64(a,b) ((ULONGLONG)((DWORD)(a)) *(ULONGLONG)((DWORD)(b))) +#define Int64ShrlMod32(a,b) ((ULONGLONG)(a) >> (b)) +#else +#error Must define a target architecture. +#endif + +#define Int64ShraMod32(a,b) ((LONGLONG)(a) >> (b)) +#define Int64ShllMod32(a,b) ((ULONGLONG)(a) << (b)) + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef __x86_64 + +#define RotateLeft8 _rotl8 +#define RotateLeft16 _rotl16 +#define RotateRight8 _rotr8 +#define RotateRight16 _rotr16 + + unsigned char __cdecl _rotl8(unsigned char Value,unsigned char Shift); + unsigned short __cdecl _rotl16(unsigned short Value,unsigned char Shift); + unsigned char __cdecl _rotr8(unsigned char Value,unsigned char Shift); + unsigned short __cdecl _rotr16(unsigned short Value,unsigned char Shift); +#endif + +#define RotateLeft32 _rotl +#define RotateLeft64 _rotl64 +#define RotateRight32 _rotr +#define RotateRight64 _rotr64 + + unsigned int __cdecl _rotl(unsigned int Value,int Shift); + unsigned __int64 __cdecl _rotl64(unsigned __int64 Value,int Shift); + unsigned int __cdecl _rotr(unsigned int Value,int Shift); + unsigned __int64 __cdecl _rotr64(unsigned __int64 Value,int Shift); +#ifdef __cplusplus + } +#endif + +#define ANSI_NULL ((CHAR)0) +#define UNICODE_NULL ((WCHAR)0) +#define UNICODE_STRING_MAX_BYTES ((WORD) 65534) +#define UNICODE_STRING_MAX_CHARS (32767) + +#ifndef _BOOLEAN_ +#define _BOOLEAN_ + typedef BYTE BOOLEAN; +#endif + typedef BOOLEAN *PBOOLEAN; + + typedef struct _LIST_ENTRY { + struct _LIST_ENTRY *Flink; + struct _LIST_ENTRY *Blink; + } LIST_ENTRY,*PLIST_ENTRY,*RESTRICTED_POINTER PRLIST_ENTRY; + + typedef struct _SINGLE_LIST_ENTRY { + struct _SINGLE_LIST_ENTRY *Next; + } SINGLE_LIST_ENTRY,*PSINGLE_LIST_ENTRY; + + typedef struct LIST_ENTRY32 { + DWORD Flink; + DWORD Blink; + } LIST_ENTRY32; + typedef LIST_ENTRY32 *PLIST_ENTRY32; + + typedef struct LIST_ENTRY64 { + ULONGLONG Flink; + ULONGLONG Blink; + } LIST_ENTRY64; + typedef LIST_ENTRY64 *PLIST_ENTRY64; + +#include + +#ifndef __OBJECTID_DEFINED +#define __OBJECTID_DEFINED + typedef struct _OBJECTID { + GUID Lineage; + DWORD Uniquifier; + } OBJECTID; +#endif + +#define MINCHAR 0x80 +#define MAXCHAR 0x7f +#define MINSHORT 0x8000 +#define MAXSHORT 0x7fff +#define MINLONG 0x80000000 +#define MAXLONG 0x7fffffff +#define MAXBYTE 0xff +#define MAXWORD 0xffff +#define MAXDWORD 0xffffffff + +#define FIELD_OFFSET(type,field) ((LONG)(LONG_PTR)&(((type *)0)->field)) +#define RTL_FIELD_SIZE(type,field) (sizeof(((type *)0)->field)) +#define RTL_SIZEOF_THROUGH_FIELD(type,field) (FIELD_OFFSET(type,field) + RTL_FIELD_SIZE(type,field)) +#define RTL_CONTAINS_FIELD(Struct,Size,Field) ((((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size))) +#define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0])) +#define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A) + +#ifdef ENABLE_RTL_NUMBER_OF_V2 +#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A) +#else +#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A) +#endif + +#define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A) +#define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A) + +#define RTL_FIELD_TYPE(type,field) (((type*)0)->field) +#define RTL_NUMBER_OF_FIELD(type,field) (RTL_NUMBER_OF(RTL_FIELD_TYPE(type,field))) +#define RTL_PADDING_BETWEEN_FIELDS(T,F1,F2) ((FIELD_OFFSET(T,F2) > FIELD_OFFSET(T,F1)) ? (FIELD_OFFSET(T,F2) - FIELD_OFFSET(T,F1) - RTL_FIELD_SIZE(T,F1)) : (FIELD_OFFSET(T,F1) - FIELD_OFFSET(T,F2) - RTL_FIELD_SIZE(T,F2))) + +#ifdef __cplusplus +#define RTL_CONST_CAST(type) const_cast +#else +#define RTL_CONST_CAST(type) (type) +#endif + +#define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) *8) +#define RTL_BITS_OF_FIELD(type,field) (RTL_BITS_OF(RTL_FIELD_TYPE(type,field))) +#define CONTAINING_RECORD(address,type,field) ((type *)((PCHAR)(address) - (ULONG_PTR)(&((type *)0)->field))) + +#define VER_SERVER_NT 0x80000000 +#define VER_WORKSTATION_NT 0x40000000 +#define VER_SUITE_SMALLBUSINESS 0x00000001 +#define VER_SUITE_ENTERPRISE 0x00000002 +#define VER_SUITE_BACKOFFICE 0x00000004 +#define VER_SUITE_COMMUNICATIONS 0x00000008 +#define VER_SUITE_TERMINAL 0x00000010 +#define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020 +#define VER_SUITE_EMBEDDEDNT 0x00000040 +#define VER_SUITE_DATACENTER 0x00000080 +#define VER_SUITE_SINGLEUSERTS 0x00000100 +#define VER_SUITE_PERSONAL 0x00000200 +#define VER_SUITE_BLADE 0x00000400 +#define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800 +#define VER_SUITE_SECURITY_APPLIANCE 0x00001000 +#define VER_SUITE_STORAGE_SERVER 0x00002000 +#define VER_SUITE_COMPUTE_SERVER 0x00004000 + +#define PRODUCT_UNDEFINED 0x0 + +#define PRODUCT_ULTIMATE 0x1 +#define PRODUCT_HOME_BASIC 0x2 +#define PRODUCT_HOME_PREMIUM 0x3 +#define PRODUCT_ENTERPRISE 0x4 +#define PRODUCT_HOME_BASIC_N 0x5 +#define PRODUCT_BUSINESS 0x6 +#define PRODUCT_STANDARD_SERVER 0x7 +#define PRODUCT_DATACENTER_SERVER 0x8 +#define PRODUCT_SMALLBUSINESS_SERVER 0x9 +#define PRODUCT_ENTERPRISE_SERVER 0xa +#define PRODUCT_STARTER 0xb +#define PRODUCT_DATACENTER_SERVER_CORE 0xc +#define PRODUCT_STANDARD_SERVER_CORE 0xd +#define PRODUCT_ENTERPRISE_SERVER_CORE 0xe +#define PRODUCT_ENTERPRISE_SERVER_IA64 0xf +#define PRODUCT_BUSINESS_N 0x10 +#define PRODUCT_WEB_SERVER 0x11 +#define PRODUCT_CLUSTER_SERVER 0x12 +#define PRODUCT_HOME_SERVER 0x13 +#define PRODUCT_STORAGE_EXPRESS_SERVER 0x14 +#define PRODUCT_STORAGE_STANDARD_SERVER 0x15 +#define PRODUCT_STORAGE_WORKGROUP_SERVER 0x16 +#define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x17 +#define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x18 +#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x19 + +#define PRODUCT_UNLICENSED 0xabcdabcd + +#define LANG_NEUTRAL 0x00 +#define LANG_INVARIANT 0x7f + +#define LANG_AFRIKAANS 0x36 +#define LANG_ALBANIAN 0x1c +#define LANG_ALSATIAN 0x84 +#define LANG_AMHARIC 0x5e +#define LANG_ARABIC 0x01 +#define LANG_ARMENIAN 0x2b +#define LANG_ASSAMESE 0x4d +#define LANG_AZERI 0x2c +#define LANG_BASHKIR 0x6d +#define LANG_BASQUE 0x2d +#define LANG_BELARUSIAN 0x23 +#define LANG_BENGALI 0x45 +#define LANG_BRETON 0x7e +#define LANG_BOSNIAN 0x1a +#define LANG_BOSNIAN_NEUTRAL 0x781a +#define LANG_BULGARIAN 0x02 +#define LANG_CATALAN 0x03 +#define LANG_CHINESE 0x04 +#define LANG_CHINESE_SIMPLIFIED 0x04 +#define LANG_CHINESE_TRADITIONAL 0x7c04 +#define LANG_CORSICAN 0x83 +#define LANG_CROATIAN 0x1a +#define LANG_CZECH 0x05 +#define LANG_DANISH 0x06 +#define LANG_DARI 0x8c +#define LANG_DIVEHI 0x65 +#define LANG_DUTCH 0x13 +#define LANG_ENGLISH 0x09 +#define LANG_ESTONIAN 0x25 +#define LANG_FAEROESE 0x38 +#define LANG_FARSI 0x29 +#define LANG_FILIPINO 0x64 +#define LANG_FINNISH 0x0b +#define LANG_FRENCH 0x0c +#define LANG_FRISIAN 0x62 +#define LANG_GALICIAN 0x56 +#define LANG_GEORGIAN 0x37 +#define LANG_GERMAN 0x07 +#define LANG_GREEK 0x08 +#define LANG_GREENLANDIC 0x6f +#define LANG_GUJARATI 0x47 +#define LANG_HAUSA 0x68 +#define LANG_HEBREW 0x0d +#define LANG_HINDI 0x39 +#define LANG_HUNGARIAN 0x0e +#define LANG_ICELANDIC 0x0f +#define LANG_IGBO 0x70 +#define LANG_INDONESIAN 0x21 +#define LANG_INUKTITUT 0x5d +#define LANG_IRISH 0x3c +#define LANG_ITALIAN 0x10 +#define LANG_JAPANESE 0x11 +#define LANG_KANNADA 0x4b +#define LANG_KASHMIRI 0x60 +#define LANG_KAZAK 0x3f +#define LANG_KHMER 0x53 +#define LANG_KICHE 0x86 +#define LANG_KINYARWANDA 0x87 +#define LANG_KONKANI 0x57 +#define LANG_KOREAN 0x12 +#define LANG_KYRGYZ 0x40 +#define LANG_LAO 0x54 +#define LANG_LATVIAN 0x26 +#define LANG_LITHUANIAN 0x27 +#define LANG_LOWER_SORBIAN 0x2e +#define LANG_LUXEMBOURGISH 0x6e +#define LANG_MACEDONIAN 0x2f +#define LANG_MALAY 0x3e +#define LANG_MALAYALAM 0x4c +#define LANG_MALTESE 0x3a +#define LANG_MANIPURI 0x58 +#define LANG_MAORI 0x81 +#define LANG_MAPUDUNGUN 0x7a +#define LANG_MARATHI 0x4e +#define LANG_MOHAWK 0x7c +#define LANG_MONGOLIAN 0x50 +#define LANG_NEPALI 0x61 +#define LANG_NORWEGIAN 0x14 +#define LANG_OCCITAN 0x82 +#define LANG_ORIYA 0x48 +#define LANG_PASHTO 0x63 +#define LANG_PERSIAN 0x29 +#define LANG_POLISH 0x15 +#define LANG_PORTUGUESE 0x16 +#define LANG_PUNJABI 0x46 +#define LANG_QUECHUA 0x6b +#define LANG_ROMANIAN 0x18 +#define LANG_RUSSIAN 0x19 +#define LANG_SAMI 0x3b +#define LANG_ROMANSH 0x17 +#define LANG_SANSKRIT 0x4f +#define LANG_SERBIAN 0x1a +#define LANG_SERBIAN_NEUTRAL 0x7c1a +#define LANG_SINDHI 0x59 +#define LANG_SINHALESE 0x5b +#define LANG_SLOVAK 0x1b +#define LANG_SLOVENIAN 0x24 +#define LANG_SOTHO 0x6c +#define LANG_SPANISH 0x0a +#define LANG_SWAHILI 0x41 +#define LANG_SWEDISH 0x1d +#define LANG_SYRIAC 0x5a +#define LANG_TAJIK 0x28 +#define LANG_TAMAZIGHT 0x5f +#define LANG_TAMIL 0x49 +#define LANG_TATAR 0x44 +#define LANG_TELUGU 0x4a +#define LANG_THAI 0x1e +#define LANG_TIBETAN 0x51 +#define LANG_TIGRIGNA 0x73 +#define LANG_TSWANA 0x32 +#define LANG_TURKISH 0x1f +#define LANG_TURKMEN 0x42 +#define LANG_UIGHUR 0x80 +#define LANG_UKRAINIAN 0x22 +#define LANG_UPPER_SORBIAN 0x2e +#define LANG_URDU 0x20 +#define LANG_UZBEK 0x43 +#define LANG_VIETNAMESE 0x2a +#define LANG_WELSH 0x52 +#define LANG_WOLOF 0x88 +#define LANG_XHOSA 0x34 +#define LANG_YAKUT 0x85 +#define LANG_YI 0x78 +#define LANG_YORUBA 0x6a +#define LANG_ZULU 0x35 + +#define SUBLANG_NEUTRAL 0x0 +#define SUBLANG_DEFAULT 0x1 +#define SUBLANG_SYS_DEFAULT 0x2 +#define SUBLANG_CUSTOM_DEFAULT 0x3 +#define SUBLANG_CUSTOM_UNSPECIFIED 0x4 +#define SUBLANG_UI_CUSTOM_DEFAULT 0x5 + +#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +#define SUBLANG_ARABIC_IRAQ 0x02 +#define SUBLANG_ARABIC_EGYPT 0x03 +#define SUBLANG_ARABIC_LIBYA 0x04 +#define SUBLANG_ARABIC_ALGERIA 0x05 +#define SUBLANG_ARABIC_MOROCCO 0x06 +#define SUBLANG_ARABIC_TUNISIA 0x07 +#define SUBLANG_ARABIC_OMAN 0x08 +#define SUBLANG_ARABIC_YEMEN 0x09 +#define SUBLANG_ARABIC_SYRIA 0x0a +#define SUBLANG_ARABIC_JORDAN 0x0b +#define SUBLANG_ARABIC_LEBANON 0x0c +#define SUBLANG_ARABIC_KUWAIT 0x0d +#define SUBLANG_ARABIC_UAE 0x0e +#define SUBLANG_ARABIC_BAHRAIN 0x0f +#define SUBLANG_ARABIC_QATAR 0x10 +#define SUBLANG_AZERI_LATIN 0x01 +#define SUBLANG_AZERI_CYRILLIC 0x02 +#define SUBLANG_CHINESE_TRADITIONAL 0x01 +#define SUBLANG_CHINESE_SIMPLIFIED 0x02 +#define SUBLANG_CHINESE_HONGKONG 0x03 +#define SUBLANG_CHINESE_SINGAPORE 0x04 +#define SUBLANG_CHINESE_MACAU 0x05 +#define SUBLANG_DUTCH 0x01 +#define SUBLANG_DUTCH_BELGIAN 0x02 +#define SUBLANG_ENGLISH_US 0x01 +#define SUBLANG_ENGLISH_UK 0x02 +#define SUBLANG_ENGLISH_AUS 0x03 +#define SUBLANG_ENGLISH_CAN 0x04 +#define SUBLANG_ENGLISH_NZ 0x05 +#define SUBLANG_ENGLISH_EIRE 0x06 +#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 +#define SUBLANG_ENGLISH_JAMAICA 0x08 +#define SUBLANG_ENGLISH_CARIBBEAN 0x09 +#define SUBLANG_ENGLISH_BELIZE 0x0a +#define SUBLANG_ENGLISH_TRINIDAD 0x0b +#define SUBLANG_ENGLISH_ZIMBABWE 0x0c +#define SUBLANG_ENGLISH_PHILIPPINES 0x0d +#define SUBLANG_FRENCH 0x01 +#define SUBLANG_FRENCH_BELGIAN 0x02 +#define SUBLANG_FRENCH_CANADIAN 0x03 +#define SUBLANG_FRENCH_SWISS 0x04 +#define SUBLANG_FRENCH_LUXEMBOURG 0x05 +#define SUBLANG_FRENCH_MONACO 0x06 +#define SUBLANG_GERMAN 0x01 +#define SUBLANG_GERMAN_SWISS 0x02 +#define SUBLANG_GERMAN_AUSTRIAN 0x03 +#define SUBLANG_GERMAN_LUXEMBOURG 0x04 +#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 +#define SUBLANG_ITALIAN 0x01 +#define SUBLANG_ITALIAN_SWISS 0x02 +#define SUBLANG_KASHMIRI_SASIA 0x02 +#define SUBLANG_KASHMIRI_INDIA 0x02 +#define SUBLANG_KOREAN 0x01 +#define SUBLANG_LITHUANIAN 0x01 +#define SUBLANG_MALAY_MALAYSIA 0x01 +#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 +#define SUBLANG_NEPALI_INDIA 0x02 +#define SUBLANG_NORWEGIAN_BOKMAL 0x01 +#define SUBLANG_NORWEGIAN_NYNORSK 0x02 +#define SUBLANG_PORTUGUESE 0x02 +#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 +#define SUBLANG_SERBIAN_LATIN 0x02 +#define SUBLANG_SERBIAN_CYRILLIC 0x03 +#define SUBLANG_SPANISH 0x01 +#define SUBLANG_SPANISH_MEXICAN 0x02 +#define SUBLANG_SPANISH_MODERN 0x03 +#define SUBLANG_SPANISH_GUATEMALA 0x04 +#define SUBLANG_SPANISH_COSTA_RICA 0x05 +#define SUBLANG_SPANISH_PANAMA 0x06 +#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 +#define SUBLANG_SPANISH_VENEZUELA 0x08 +#define SUBLANG_SPANISH_COLOMBIA 0x09 +#define SUBLANG_SPANISH_PERU 0x0a +#define SUBLANG_SPANISH_ARGENTINA 0x0b +#define SUBLANG_SPANISH_ECUADOR 0x0c +#define SUBLANG_SPANISH_CHILE 0x0d +#define SUBLANG_SPANISH_URUGUAY 0x0e +#define SUBLANG_SPANISH_PARAGUAY 0x0f +#define SUBLANG_SPANISH_BOLIVIA 0x10 +#define SUBLANG_SPANISH_EL_SALVADOR 0x11 +#define SUBLANG_SPANISH_HONDURAS 0x12 +#define SUBLANG_SPANISH_NICARAGUA 0x13 +#define SUBLANG_SPANISH_PUERTO_RICO 0x14 +#define SUBLANG_SWEDISH 0x01 +#define SUBLANG_SWEDISH_FINLAND 0x02 +#define SUBLANG_URDU_PAKISTAN 0x01 +#define SUBLANG_URDU_INDIA 0x02 +#define SUBLANG_UZBEK_LATIN 0x01 +#define SUBLANG_UZBEK_CYRILLIC 0x02 + +#define SORT_DEFAULT 0x0 +#define SORT_INVARIANT_MATH 0x1 + +#define SORT_JAPANESE_XJIS 0x0 +#define SORT_JAPANESE_UNICODE 0x1 +#define SORT_JAPANESE_RADICALSTROKE 0x4 + +#define SORT_CHINESE_BIG5 0x0 +#define SORT_CHINESE_PRCP 0x0 +#define SORT_CHINESE_UNICODE 0x1 +#define SORT_CHINESE_PRC 0x2 +#define SORT_CHINESE_BOPOMOFO 0x3 + +#define SORT_KOREAN_KSC 0x0 +#define SORT_KOREAN_UNICODE 0x1 + +#define SORT_GERMAN_PHONE_BOOK 0x1 + +#define SORT_HUNGARIAN_DEFAULT 0x0 +#define SORT_HUNGARIAN_TECHNICAL 0x1 + +#define SORT_GEORGIAN_TRADITIONAL 0x0 +#define SORT_GEORGIAN_MODERN 0x1 + +#define MAKELANGID(p,s) ((((WORD)(s)) << 10) | (WORD)(p)) +#define PRIMARYLANGID(lgid) ((WORD)(lgid) & 0x3ff) +#define SUBLANGID(lgid) ((WORD)(lgid) >> 10) + +#define NLS_VALID_LOCALE_MASK 0x000fffff + +#define MAKELCID(lgid,srtid) ((DWORD)((((DWORD)((WORD)(srtid))) << 16) | ((DWORD)((WORD)(lgid))))) +#define MAKESORTLCID(lgid,srtid,ver) ((DWORD)((MAKELCID(lgid,srtid)) | (((DWORD)((WORD)(ver))) << 20))) +#define LANGIDFROMLCID(lcid) ((WORD)(lcid)) +#define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0xf)) +#define SORTVERSIONFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 20) & 0xf)) + +#define LOCALE_NAME_MAX_LENGTH 85 +#define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT)) +#define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT)) + +#define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT,SORT_DEFAULT)) +#define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT,SORT_DEFAULT)) + +#define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT)) + +#define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT)) +#define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT)) +#define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT)) + +#define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT)) + +#define UNREFERENCED_PARAMETER(P) (P) +#define DBG_UNREFERENCED_PARAMETER(P) (P) +#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V) + +#define DEFAULT_UNREACHABLE + +#ifndef WIN32_NO_STATUS +#define STATUS_WAIT_0 ((DWORD)0x00000000L) +#define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080L) +#define STATUS_USER_APC ((DWORD)0x000000C0L) +#define STATUS_TIMEOUT ((DWORD)0x00000102L) +#define STATUS_PENDING ((DWORD)0x00000103L) +#define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001L) +#define DBG_CONTINUE ((DWORD)0x00010002L) +#define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005L) +#define DBG_TERMINATE_THREAD ((DWORD)0x40010003L) +#define DBG_TERMINATE_PROCESS ((DWORD)0x40010004L) +#define DBG_CONTROL_C ((DWORD)0x40010005L) +#define DBG_CONTROL_BREAK ((DWORD)0x40010008L) +#define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009L) +#define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001L) +#define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002L) +#define STATUS_BREAKPOINT ((DWORD)0x80000003L) +#define STATUS_SINGLE_STEP ((DWORD)0x80000004L) +#define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001L) +#define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005L) +#define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006L) +#define STATUS_INVALID_HANDLE ((DWORD)0xC0000008L) +#define STATUS_NO_MEMORY ((DWORD)0xC0000017L) +#define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001DL) +#define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025L) +#define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026L) +#define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008CL) +#define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008DL) +#define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008EL) +#define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008FL) +#define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090L) +#define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091L) +#define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092L) +#define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093L) +#define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094L) +#define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095L) +#define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096L) +#define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FDL) +#define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013AL) +#define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4L) +#define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5L) +#define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9L) +#define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000FL) +#define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010L) +#endif + +#define MAXIMUM_WAIT_OBJECTS 64 +#define MAXIMUM_SUSPEND_COUNT MAXCHAR + + typedef ULONG_PTR KSPIN_LOCK; + typedef KSPIN_LOCK *PKSPIN_LOCK; + +#ifdef _AMD64_ + +#if defined(__x86_64) && !defined(RC_INVOKED) + +#ifdef __cplusplus + extern "C" { +#endif + +#define BitTest _bittest +#define BitTestAndComplement _bittestandcomplement +#define BitTestAndSet _bittestandset +#define BitTestAndReset _bittestandreset +#define InterlockedBitTestAndSet _interlockedbittestandset +#define InterlockedBitTestAndReset _interlockedbittestandreset +#define BitTest64 _bittest64 +#define BitTestAndComplement64 _bittestandcomplement64 +#define BitTestAndSet64 _bittestandset64 +#define BitTestAndReset64 _bittestandreset64 +#define InterlockedBitTestAndSet64 _interlockedbittestandset64 +#define InterlockedBitTestAndReset64 _interlockedbittestandreset64 + + __CRT_INLINE BOOLEAN _bittest(LONG const *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandcomplement(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("btcl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement(LONG *Base,LONG Bit) { + int old = 0; + __asm__ __volatile__("lock ; btcl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Bit)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandset(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandreset(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _interlockedbittestandset(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("lock ; btsl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _interlockedbittestandreset(LONG *Base,LONG Offset) { + int old = 0; + __asm__ __volatile__("lock ; btrl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittest64(LONG64 const *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("btq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandcomplement64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("btcq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandset64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("btsq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _bittestandreset64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("btrq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _interlockedbittestandset64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("lock ; btsq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } + __CRT_INLINE BOOLEAN _interlockedbittestandreset64(LONG64 *Base,LONG64 Offset) { + int old = 0; + __asm__ __volatile__("lock ; btrq %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long long *) Base)) + :"Ir" (Offset)); + return (BOOLEAN) (old!=0); + } +#define BitScanForward _BitScanForward +#define BitScanReverse _BitScanReverse +#define BitScanForward64 _BitScanForward64 +#define BitScanReverse64 _BitScanReverse64 + + __CRT_INLINE BOOLEAN _BitScanForward(DWORD *Index,DWORD Mask) { + __asm__ __volatile__("bsfl %1,%0" : "=r" (Mask),"=m" ((*(volatile long *)Index))); + return Mask!=0; + } + __CRT_INLINE BOOLEAN _BitScanReverse(DWORD *Index,DWORD Mask) { + __asm__ __volatile__("bsrl %1,%0" : "=r" (Mask),"=m" ((*(volatile long *)Index))); + return Mask!=0; + } + __CRT_INLINE BOOLEAN _BitScanForward64(DWORD *Index,DWORD64 Mask) { + __asm__ __volatile__("bsfq %1,%0" : "=r" (Mask),"=m" ((*(volatile long long *)Index))); + return Mask!=0; + } + __CRT_INLINE BOOLEAN _BitScanReverse64(DWORD *Index,DWORD64 Mask) { + __asm__ __volatile__("bsrq %1,%0" : "=r" (Mask),"=m" ((*(volatile long long *)Index))); + return Mask!=0; + } + +#define InterlockedIncrement16 _InterlockedIncrement16 +#define InterlockedDecrement16 _InterlockedDecrement16 +#define InterlockedCompareExchange16 _InterlockedCompareExchange16 + +#define InterlockedAnd _InterlockedAnd +#define InterlockedOr _InterlockedOr +#define InterlockedXor _InterlockedXor +#define InterlockedIncrement _InterlockedIncrement +#define InterlockedIncrementAcquire InterlockedIncrement +#define InterlockedIncrementRelease InterlockedIncrement +#define InterlockedDecrement _InterlockedDecrement +#define InterlockedDecrementAcquire InterlockedDecrement +#define InterlockedDecrementRelease InterlockedDecrement +#define InterlockedAdd _InterlockedAdd +#define InterlockedExchange _InterlockedExchange +#define InterlockedExchangeAdd _InterlockedExchangeAdd +#define InterlockedCompareExchange _InterlockedCompareExchange +#define InterlockedCompareExchangeAcquire InterlockedCompareExchange +#define InterlockedCompareExchangeRelease InterlockedCompareExchange + +#define InterlockedAnd64 _InterlockedAnd64 +#define InterlockedAndAffinity InterlockedAnd64 +#define InterlockedOr64 _InterlockedOr64 +#define InterlockedOrAffinity InterlockedOr64 +#define InterlockedXor64 _InterlockedXor64 +#define InterlockedIncrement64 _InterlockedIncrement64 +#define InterlockedDecrement64 _InterlockedDecrement64 +#define InterlockedAdd64 _InterlockedAdd64 +#define InterlockedExchange64 _InterlockedExchange64 +#define InterlockedExchangeAcquire64 InterlockedExchange64 +#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 +#define InterlockedCompareExchange64 _InterlockedCompareExchange64 +#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 +#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 + +#define InterlockedExchangePointer _InterlockedExchangePointer +#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer + +#define InterlockedExchangeAddSizeT(a,b) InterlockedExchangeAdd64((LONG64 *)a,b) +#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONG64 *)a) +#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONG64 *)a) + + __CRT_INLINE SHORT InterlockedIncrement16(SHORT volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; addw $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE SHORT InterlockedDecrement16(SHORT volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; subw $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE SHORT InterlockedCompareExchange16(SHORT volatile *Destination,SHORT ExChange,SHORT Comperand) { + SHORT prev; + __asm__ __volatile__("lock ; cmpxchgw %w1,%2" + :"=a"(prev) + :"q"(ExChange), "m"(*Destination), "0"(Comperand) + : "memory"); + return prev; + } + __CRT_INLINE LONG InterlockedAnd(LONG volatile *Destination,LONG Value) { + __asm__ __volatile__("lock ; andl %0,%1" + : :"r"(Value),"m"(*Destination) + : "memory"); + return *Destination; + } + __CRT_INLINE LONG InterlockedOr(LONG volatile *Destination,LONG Value) { + __asm__ __volatile__("lock ; orl %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + __CRT_INLINE LONG InterlockedXor(LONG volatile *Destination,LONG Value) { + __asm__ __volatile__("lock ; xorl %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + // $$$$ + __CRT_INLINE LONG64 InterlockedAnd64(LONG64 volatile *Destination,LONG64 Value) { + __asm__ __volatile__("lock ; andq %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + __CRT_INLINE LONG64 InterlockedOr64(LONG64 volatile *Destination,LONG64 Value) { + __asm__ __volatile__("lock ; orq %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + __CRT_INLINE LONG64 InterlockedXor64(LONG64 volatile *Destination,LONG64 Value) { + __asm__ __volatile__("lock ; xorq %0,%1" + : : "r"(Value),"m"(*Destination) : "memory"); + return *Destination; + } + __CRT_INLINE LONG InterlockedIncrement(LONG volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; addl $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE LONG InterlockedDecrement(LONG volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; subl $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE LONG InterlockedExchange(LONG volatile *Target,LONG Value) { + __asm__ __volatile("lock ; xchgl %0,%1" + : "=r"(Value) + : "m"(*Target),"0"(Value) + : "memory"); + return Value; + } + LONG InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); + +#ifndef _X86AMD64_ + __CRT_INLINE LONG InterlockedAdd(LONG volatile *Addend,LONG Value) { return InterlockedExchangeAdd(Addend,Value) + Value; } +#endif + __CRT_INLINE LONG InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand) { + LONG prev; + __asm__ __volatile__("lock ; cmpxchgl %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory"); + return prev; + } + __CRT_INLINE LONG64 InterlockedIncrement64(LONG64 volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; addq $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE LONG64 InterlockedDecrement64(LONG64 volatile *Addend) { + unsigned char c; + unsigned char s; + __asm__ __volatile__( + "lock ; subq $1,%0; sete %1 ; sets %2" + :"=m" (*Addend), "=qm" (c), "=qm" (s) + :"m" (*Addend) : "memory"); + return (c != 0 ? 0 : (s != 0 ? -1 : 1)); + } + __CRT_INLINE LONG64 InterlockedExchange64(LONG64 volatile *Target,LONG64 Value) { + __asm__ __volatile("lock ; xchgq %0,%1" + : "=r"(Value) + : "m"(*Target),"0"(Value) + : "memory"); + return Value; + } + LONG64 InterlockedExchangeAdd64(LONG64 volatile *Addend,LONG64 Value); + +#ifndef _X86AMD64_ + __CRT_INLINE LONG64 InterlockedAdd64(LONG64 volatile *Addend,LONG64 Value) { return InterlockedExchangeAdd64(Addend,Value) + Value; } +#endif + + __CRT_INLINE LONG64 InterlockedCompareExchange64(LONG64 volatile *Destination,LONG64 ExChange,LONG64 Comperand) { + LONG64 prev; + __asm__ __volatile__("lock ; cmpxchgq %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory"); + return prev; + } + __CRT_INLINE PVOID InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand) { + PVOID prev; + __asm__ __volatile__("lock ; cmpxchgq %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory"); + return prev; + } + __CRT_INLINE PVOID InterlockedExchangePointer(PVOID volatile *Target,PVOID Value) { + __asm__ __volatile("lock ; xchgq %0,%1" + : "=r"(Value) + : "m"(*Target),"0"(Value) + : "memory"); + return Value; + } + +#define CacheLineFlush(Address) _mm_clflush(Address) + + VOID _ReadWriteBarrier(VOID); + +#define FastFence __faststorefence +#define LoadFence _mm_lfence +#define MemoryFence _mm_mfence +#define StoreFence _mm_sfence + + VOID __faststorefence(VOID); + VOID _m_prefetchw(volatile CONST VOID *Source); + +//!__TINYC__: #include + +#define YieldProcessor _mm_pause +#define MemoryBarrier __faststorefence +#define PreFetchCacheLine(l,a) _mm_prefetch((CHAR CONST *) a,l) +#define PrefetchForWrite(p) _m_prefetchw(p) +#define ReadForWriteAccess(p) (_m_prefetchw(p),*(p)) + +#define PF_TEMPORAL_LEVEL_1 _MM_HINT_T0 +#define PF_TEMPORAL_LEVEL_2 _MM_HINT_T1 +#define PF_TEMPORAL_LEVEL_3 _MM_HINT_T2 +#define PF_NON_TEMPORAL_LEVEL_ALL _MM_HINT_NTA + +#define ReadMxCsr _mm_getcsr +#define WriteMxCsr _mm_setcsr + + VOID __int2c(VOID); + +#define DbgRaiseAssertionFailure() __int2c() +#define GetCallersEflags() __getcallerseflags() + + unsigned __int32 __getcallerseflags(VOID); + +#define GetSegmentLimit __segmentlimit + + DWORD __segmentlimit(DWORD Selector); + +#define ReadTimeStampCounter() __rdtsc() + + DWORD64 __rdtsc(VOID); + VOID __movsb(PBYTE Destination,BYTE const *Source,SIZE_T Count); + VOID __movsw(PWORD Destination,WORD const *Source,SIZE_T Count); + VOID __movsd(PDWORD Destination,DWORD const *Source,SIZE_T Count); + VOID __movsq(PDWORD64 Destination,DWORD64 const *Source,SIZE_T Count); + VOID __stosb(PBYTE Destination,BYTE Value,SIZE_T Count); + VOID __stosw(PWORD Destination,WORD Value,SIZE_T Count); + VOID __stosd(PDWORD Destination,DWORD Value,SIZE_T Count); + VOID __stosq(PDWORD64 Destination,DWORD64 Value,SIZE_T Count); + +#define MultiplyHigh __mulh +#define UnsignedMultiplyHigh __umulh + + LONGLONG MultiplyHigh(LONGLONG Multiplier,LONGLONG Multiplicand); + ULONGLONG UnsignedMultiplyHigh(ULONGLONG Multiplier,ULONGLONG Multiplicand); + +#define ShiftLeft128 __shiftleft128 +#define ShiftRight128 __shiftright128 + + DWORD64 ShiftLeft128(DWORD64 LowPart,DWORD64 HighPart,BYTE Shift); + DWORD64 ShiftRight128(DWORD64 LowPart,DWORD64 HighPart,BYTE Shift); + +#define Multiply128 _mul128 + + LONG64 Multiply128(LONG64 Multiplier,LONG64 Multiplicand,LONG64 *HighProduct); + +#define UnsignedMultiply128 _umul128 + + DWORD64 UnsignedMultiply128(DWORD64 Multiplier,DWORD64 Multiplicand,DWORD64 *HighProduct); + + __CRT_INLINE LONG64 MultiplyExtract128(LONG64 Multiplier,LONG64 Multiplicand,BYTE Shift) { + LONG64 extractedProduct; + LONG64 highProduct; + LONG64 lowProduct; + lowProduct = Multiply128(Multiplier,Multiplicand,&highProduct); + extractedProduct = (LONG64)ShiftRight128((LONG64)lowProduct,(LONG64)highProduct,Shift); + return extractedProduct; + } + + __CRT_INLINE DWORD64 UnsignedMultiplyExtract128(DWORD64 Multiplier,DWORD64 Multiplicand,BYTE Shift) { + DWORD64 extractedProduct; + DWORD64 highProduct; + DWORD64 lowProduct; + lowProduct = UnsignedMultiply128(Multiplier,Multiplicand,&highProduct); + extractedProduct = ShiftRight128(lowProduct,highProduct,Shift); + return extractedProduct; + } + + __CRT_INLINE BYTE __readgsbyte(DWORD Offset) { + BYTE ret; + __asm__ volatile ("movb %%gs:%1,%0" + : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + return ret; + } + __CRT_INLINE WORD __readgsword(DWORD Offset) { + WORD ret; + __asm__ volatile ("movw %%gs:%1,%0" + : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + return ret; + } + __CRT_INLINE DWORD __readgsdword(DWORD Offset) { + DWORD ret; + __asm__ volatile ("movl %%gs:%1,%0" + : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + return ret; + } + __CRT_INLINE DWORD64 __readgsqword(DWORD Offset) { + void *ret; + __asm__ volatile ("movq %%gs:%1,%0" + : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + return (DWORD64) ret; + } + __CRT_INLINE VOID __writegsbyte(DWORD Offset,BYTE Data) { + __asm__ volatile ("movb %0,%%gs:%1" + : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + } + __CRT_INLINE VOID __writegsword(DWORD Offset,WORD Data) { + __asm__ volatile ("movw %0,%%gs:%1" + : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + } + __CRT_INLINE VOID __writegsdword(DWORD Offset,DWORD Data) { + __asm__ volatile ("movl %0,%%gs:%1" + : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + } + __CRT_INLINE VOID __writegsqword(DWORD Offset,DWORD64 Data) { + __asm__ volatile ("movq %0,%%gs:%1" + : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); + } + +#ifdef __cplusplus + } +#endif +#endif + +#define EXCEPTION_READ_FAULT 0 +#define EXCEPTION_WRITE_FAULT 1 +#define EXCEPTION_EXECUTE_FAULT 8 + +#if !defined(RC_INVOKED) + +#define CONTEXT_AMD64 0x100000 + +#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L) +#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L) +#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L) +#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L) +#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L) + +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) +#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS) + +#define CONTEXT_EXCEPTION_ACTIVE 0x8000000 +#define CONTEXT_SERVICE_ACTIVE 0x10000000 +#define CONTEXT_EXCEPTION_REQUEST 0x40000000 +#define CONTEXT_EXCEPTION_REPORTING 0x80000000 +#endif + +#define INITIAL_MXCSR 0x1f80 +#define INITIAL_FPCSR 0x027f + + typedef DECLSPEC_ALIGN(16) struct _M128A { + ULONGLONG Low; + LONGLONG High; + } M128A,*PM128A; + + typedef struct _XMM_SAVE_AREA32 { + WORD ControlWord; + WORD StatusWord; + BYTE TagWord; + BYTE Reserved1; + WORD ErrorOpcode; + DWORD ErrorOffset; + WORD ErrorSelector; + WORD Reserved2; + DWORD DataOffset; + WORD DataSelector; + WORD Reserved3; + DWORD MxCsr; + DWORD MxCsr_Mask; + M128A FloatRegisters[8]; + M128A XmmRegisters[16]; + BYTE Reserved4[96]; + } XMM_SAVE_AREA32,*PXMM_SAVE_AREA32; + +#define LEGACY_SAVE_AREA_LENGTH sizeof(XMM_SAVE_AREA32) + + typedef DECLSPEC_ALIGN(16) struct _CONTEXT { + DWORD64 P1Home; + DWORD64 P2Home; + DWORD64 P3Home; + DWORD64 P4Home; + DWORD64 P5Home; + DWORD64 P6Home; + DWORD ContextFlags; + DWORD MxCsr; + WORD SegCs; + WORD SegDs; + WORD SegEs; + WORD SegFs; + WORD SegGs; + WORD SegSs; + DWORD EFlags; + DWORD64 Dr0; + DWORD64 Dr1; + DWORD64 Dr2; + DWORD64 Dr3; + DWORD64 Dr6; + DWORD64 Dr7; + DWORD64 Rax; + DWORD64 Rcx; + DWORD64 Rdx; + DWORD64 Rbx; + DWORD64 Rsp; + DWORD64 Rbp; + DWORD64 Rsi; + DWORD64 Rdi; + DWORD64 R8; + DWORD64 R9; + DWORD64 R10; + DWORD64 R11; + DWORD64 R12; + DWORD64 R13; + DWORD64 R14; + DWORD64 R15; + DWORD64 Rip; + union { + XMM_SAVE_AREA32 FltSave; + XMM_SAVE_AREA32 FloatSave; + struct { + M128A Header[2]; + M128A Legacy[8]; + M128A Xmm0; + M128A Xmm1; + M128A Xmm2; + M128A Xmm3; + M128A Xmm4; + M128A Xmm5; + M128A Xmm6; + M128A Xmm7; + M128A Xmm8; + M128A Xmm9; + M128A Xmm10; + M128A Xmm11; + M128A Xmm12; + M128A Xmm13; + M128A Xmm14; + M128A Xmm15; + }; + }; + M128A VectorRegister[26]; + DWORD64 VectorControl; + DWORD64 DebugControl; + DWORD64 LastBranchToRip; + DWORD64 LastBranchFromRip; + DWORD64 LastExceptionToRip; + DWORD64 LastExceptionFromRip; + } CONTEXT,*PCONTEXT; + +#define RUNTIME_FUNCTION_INDIRECT 0x1 + + typedef struct _RUNTIME_FUNCTION { + DWORD BeginAddress; + DWORD EndAddress; + DWORD UnwindData; + } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION; + + typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 ControlPc,PVOID Context); + typedef DWORD (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(HANDLE Process,PVOID TableAddress,PDWORD Entries,PRUNTIME_FUNCTION *Functions); + +#define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback" + + NTSYSAPI VOID __cdecl RtlRestoreContext (PCONTEXT ContextRecord,struct _EXCEPTION_RECORD *ExceptionRecord); + NTSYSAPI BOOLEAN __cdecl RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,DWORD EntryCount,DWORD64 BaseAddress); + NTSYSAPI BOOLEAN __cdecl RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,DWORD64 BaseAddress,DWORD Length,PGET_RUNTIME_FUNCTION_CALLBACK Callback,PVOID Context,PCWSTR OutOfProcessCallbackDll); + NTSYSAPI BOOLEAN __cdecl RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable); +#endif + +#ifdef I_X86_ +#if(defined(_X86_) && !defined(__x86_64)) && !defined(RC_INVOKED) +#ifdef __cplusplus + extern "C" { +#endif + + __CRT_INLINE BOOLEAN InterlockedBitTestAndSet(LONG *Base,LONG Bit) { + int old = 0; + __asm__ __volatile__("lock ; btsl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Bit)); + return (BOOLEAN) (old!=0); + } + + __CRT_INLINE BOOLEAN InterlockedBitTestAndReset(LONG *Base,LONG Bit) { + int old = 0; + __asm__ __volatile__("lock ; btrl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Bit)); + return (BOOLEAN) (old!=0); + } + + __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement(LONG *Base,LONG Bit) { + int old = 0; + __asm__ __volatile__("lock ; btcl %2,%1\n\tsbbl %0,%0 " + :"=r" (old),"=m" ((*(volatile long *) Base)) + :"Ir" (Bit)); + return (BOOLEAN) (old!=0); + } + +#ifdef _PREFIX_ + BYTE __readfsbyte(DWORD Offset); + WORD __readfsword(DWORD Offset); + DWORD __readfsdword(DWORD Offset); + VOID __writefsbyte(DWORD Offset,BYTE Data); + VOID __writefsword(DWORD Offset,WORD Data); + VOID __writefsdword(DWORD Offset,DWORD Data); +#endif + +#ifdef __cplusplus + } +#endif +#endif + +#if(defined(_X86_) && !defined(__x86_64)) + __CRT_INLINE VOID MemoryBarrier(VOID) { + LONG Barrier; + __asm__ __volatile__("xchgl %eax,%0 " + :"=r" (Barrier)); + } +#define YieldProcessor() __asm__ __volatile__("rep nop "); + +#define PreFetchCacheLine(l,a) +#define ReadForWriteAccess(p) (*(p)) + +#define PF_TEMPORAL_LEVEL_1 +#define PF_NON_TEMPORAL_LEVEL_ALL + + __CRT_INLINE VOID DbgRaiseAssertionFailure(void) { + __asm__ __volatile__("int 0x2c "); + } + PVOID GetCurrentFiber(void); + __CRT_INLINE PVOID GetCurrentFiber(void) + { + void *ret; + __asm__ volatile ("movl %%fs:0x10,%0" + : "=r" (ret)); + return ret; + } + PVOID GetFiberData(void); + __CRT_INLINE PVOID GetFiberData(void) + { + void *ret; + __asm__ volatile ("movl %%fs:0x10,%0\n" + "movl (%0),%0" + : "=r" (ret)); + return ret; + } +#endif + +#define EXCEPTION_READ_FAULT 0 +#define EXCEPTION_WRITE_FAULT 1 +#define EXCEPTION_EXECUTE_FAULT 8 + +#define SIZE_OF_80387_REGISTERS 80 + +#if !defined(RC_INVOKED) + +#define CONTEXT_i386 0x00010000 +#define CONTEXT_i486 0x00010000 + +#define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L) +#define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L) +#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L) +#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L) +#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) +#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x00000020L) + +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS) + +#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS) +#endif + +#define MAXIMUM_SUPPORTED_EXTENSION 512 + + typedef struct _FLOATING_SAVE_AREA { + DWORD ControlWord; + DWORD StatusWord; + DWORD TagWord; + DWORD ErrorOffset; + DWORD ErrorSelector; + DWORD DataOffset; + DWORD DataSelector; + BYTE RegisterArea[SIZE_OF_80387_REGISTERS]; + DWORD Cr0NpxState; + } FLOATING_SAVE_AREA; + + typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA; + + typedef struct _CONTEXT { + DWORD ContextFlags; + DWORD Dr0; + DWORD Dr1; + DWORD Dr2; + DWORD Dr3; + DWORD Dr6; + DWORD Dr7; + FLOATING_SAVE_AREA FloatSave; + DWORD SegGs; + DWORD SegFs; + DWORD SegEs; + DWORD SegDs; + + DWORD Edi; + DWORD Esi; + DWORD Ebx; + DWORD Edx; + DWORD Ecx; + DWORD Eax; + DWORD Ebp; + DWORD Eip; + DWORD SegCs; + DWORD EFlags; + DWORD Esp; + DWORD SegSs; + BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; + } CONTEXT; + + typedef CONTEXT *PCONTEXT; +#endif + +#ifndef _LDT_ENTRY_DEFINED +#define _LDT_ENTRY_DEFINED + + typedef struct _LDT_ENTRY { + WORD LimitLow; + WORD BaseLow; + union { + struct { + BYTE BaseMid; + BYTE Flags1; + BYTE Flags2; + BYTE BaseHi; + } Bytes; + struct { + DWORD BaseMid : 8; + DWORD Type : 5; + DWORD Dpl : 2; + DWORD Pres : 1; + DWORD LimitHi : 4; + DWORD Sys : 1; + DWORD Reserved_0 : 1; + DWORD Default_Big : 1; + DWORD Granularity : 1; + DWORD BaseHi : 8; + } Bits; + } HighWord; + } LDT_ENTRY,*PLDT_ENTRY; +#endif + +#if defined(__ia64__) && !defined(RC_INVOKED) + +#ifdef __cplusplus + extern "C" { +#endif + + BOOLEAN BitScanForward64(DWORD *Index,DWORD64 Mask); + BOOLEAN BitScanReverse64(DWORD *Index,DWORD64 Mask); + +#ifdef __cplusplus + } +#endif +#endif + +#if !defined(GENUTIL) && !defined(_GENIA64_) && defined(_IA64_) + + void *_cdecl _rdteb(void); +#ifdef __ia64__ + +#define NtCurrentTeb() ((struct _TEB *)_rdteb()) +#define GetCurrentFiber() (((PNT_TIB)NtCurrentTeb())->FiberData) +#define GetFiberData() (*(PVOID *)(GetCurrentFiber())) + +#ifdef __cplusplus + extern "C" { +#endif + + void __break(int); + void __yield(void); + void __mf(void); + void __lfetch(int Level,VOID CONST *Address); + void __lfetchfault(int Level,VOID CONST *Address); + void __lfetch_excl(int Level,VOID CONST *Address); + void __lfetchfault_excl(int Level,VOID CONST *Address); + +#define MD_LFHINT_NONE 0x00 +#define MD_LFHINT_NT1 0x01 +#define MD_LFHINT_NT2 0x02 +#define MD_LFHINT_NTA 0x03 + +#ifdef __cplusplus + } +#endif + +#define YieldProcessor __yield +#define MemoryBarrier __mf +#define PreFetchCacheLine __lfetch +#define ReadForWriteAccess(p) (*(p)) +#define DbgRaiseAssertionFailure() __break(ASSERT_BREAKPOINT) + +#define PF_TEMPORAL_LEVEL_1 MD_LFHINT_NONE +#define PF_NON_TEMPORAL_LEVEL_ALL MD_LFHINT_NTA + +#define UnsignedMultiplyHigh __UMULH + + ULONGLONG UnsignedMultiplyHigh(ULONGLONG Multiplier,ULONGLONG Multiplicand); +#else + struct _TEB *NtCurrentTeb(void); +#endif +#endif + +#ifdef _IA64_ + +#define EXCEPTION_READ_FAULT 0 +#define EXCEPTION_WRITE_FAULT 1 +#define EXCEPTION_EXECUTE_FAULT 2 + +#if !defined(RC_INVOKED) + +#define CONTEXT_IA64 0x00080000 + +#define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001L) +#define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002L) +#define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004L) +#define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008L) +#define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010L) +#define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020L) + +#define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT) +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL) +#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL) + +#define CONTEXT_EXCEPTION_ACTIVE 0x8000000 +#define CONTEXT_SERVICE_ACTIVE 0x10000000 +#define CONTEXT_EXCEPTION_REQUEST 0x40000000 +#define CONTEXT_EXCEPTION_REPORTING 0x80000000 +#endif + + typedef struct _CONTEXT { + DWORD ContextFlags; + DWORD Fill1[3]; + ULONGLONG DbI0; + ULONGLONG DbI1; + ULONGLONG DbI2; + ULONGLONG DbI3; + ULONGLONG DbI4; + ULONGLONG DbI5; + ULONGLONG DbI6; + ULONGLONG DbI7; + ULONGLONG DbD0; + ULONGLONG DbD1; + ULONGLONG DbD2; + ULONGLONG DbD3; + ULONGLONG DbD4; + ULONGLONG DbD5; + ULONGLONG DbD6; + ULONGLONG DbD7; + FLOAT128 FltS0; + FLOAT128 FltS1; + FLOAT128 FltS2; + FLOAT128 FltS3; + FLOAT128 FltT0; + FLOAT128 FltT1; + FLOAT128 FltT2; + FLOAT128 FltT3; + FLOAT128 FltT4; + FLOAT128 FltT5; + FLOAT128 FltT6; + FLOAT128 FltT7; + FLOAT128 FltT8; + FLOAT128 FltT9; + FLOAT128 FltS4; + FLOAT128 FltS5; + FLOAT128 FltS6; + FLOAT128 FltS7; + FLOAT128 FltS8; + FLOAT128 FltS9; + FLOAT128 FltS10; + FLOAT128 FltS11; + FLOAT128 FltS12; + FLOAT128 FltS13; + FLOAT128 FltS14; + FLOAT128 FltS15; + FLOAT128 FltS16; + FLOAT128 FltS17; + FLOAT128 FltS18; + FLOAT128 FltS19; + FLOAT128 FltF32; + FLOAT128 FltF33; + FLOAT128 FltF34; + FLOAT128 FltF35; + FLOAT128 FltF36; + FLOAT128 FltF37; + FLOAT128 FltF38; + FLOAT128 FltF39; + FLOAT128 FltF40; + FLOAT128 FltF41; + FLOAT128 FltF42; + FLOAT128 FltF43; + FLOAT128 FltF44; + FLOAT128 FltF45; + FLOAT128 FltF46; + FLOAT128 FltF47; + FLOAT128 FltF48; + FLOAT128 FltF49; + FLOAT128 FltF50; + FLOAT128 FltF51; + FLOAT128 FltF52; + FLOAT128 FltF53; + FLOAT128 FltF54; + FLOAT128 FltF55; + FLOAT128 FltF56; + FLOAT128 FltF57; + FLOAT128 FltF58; + FLOAT128 FltF59; + FLOAT128 FltF60; + FLOAT128 FltF61; + FLOAT128 FltF62; + FLOAT128 FltF63; + FLOAT128 FltF64; + FLOAT128 FltF65; + FLOAT128 FltF66; + FLOAT128 FltF67; + FLOAT128 FltF68; + FLOAT128 FltF69; + FLOAT128 FltF70; + FLOAT128 FltF71; + FLOAT128 FltF72; + FLOAT128 FltF73; + FLOAT128 FltF74; + FLOAT128 FltF75; + FLOAT128 FltF76; + FLOAT128 FltF77; + FLOAT128 FltF78; + FLOAT128 FltF79; + FLOAT128 FltF80; + FLOAT128 FltF81; + FLOAT128 FltF82; + FLOAT128 FltF83; + FLOAT128 FltF84; + FLOAT128 FltF85; + FLOAT128 FltF86; + FLOAT128 FltF87; + FLOAT128 FltF88; + FLOAT128 FltF89; + FLOAT128 FltF90; + FLOAT128 FltF91; + FLOAT128 FltF92; + FLOAT128 FltF93; + FLOAT128 FltF94; + FLOAT128 FltF95; + FLOAT128 FltF96; + FLOAT128 FltF97; + FLOAT128 FltF98; + FLOAT128 FltF99; + FLOAT128 FltF100; + FLOAT128 FltF101; + FLOAT128 FltF102; + FLOAT128 FltF103; + FLOAT128 FltF104; + FLOAT128 FltF105; + FLOAT128 FltF106; + FLOAT128 FltF107; + FLOAT128 FltF108; + FLOAT128 FltF109; + FLOAT128 FltF110; + FLOAT128 FltF111; + FLOAT128 FltF112; + FLOAT128 FltF113; + FLOAT128 FltF114; + FLOAT128 FltF115; + FLOAT128 FltF116; + FLOAT128 FltF117; + FLOAT128 FltF118; + FLOAT128 FltF119; + FLOAT128 FltF120; + FLOAT128 FltF121; + FLOAT128 FltF122; + FLOAT128 FltF123; + FLOAT128 FltF124; + FLOAT128 FltF125; + FLOAT128 FltF126; + FLOAT128 FltF127; + ULONGLONG StFPSR; + ULONGLONG IntGp; + ULONGLONG IntT0; + ULONGLONG IntT1; + ULONGLONG IntS0; + ULONGLONG IntS1; + ULONGLONG IntS2; + ULONGLONG IntS3; + ULONGLONG IntV0; + ULONGLONG IntT2; + ULONGLONG IntT3; + ULONGLONG IntT4; + ULONGLONG IntSp; + ULONGLONG IntTeb; + ULONGLONG IntT5; + ULONGLONG IntT6; + ULONGLONG IntT7; + ULONGLONG IntT8; + ULONGLONG IntT9; + ULONGLONG IntT10; + ULONGLONG IntT11; + ULONGLONG IntT12; + ULONGLONG IntT13; + ULONGLONG IntT14; + ULONGLONG IntT15; + ULONGLONG IntT16; + ULONGLONG IntT17; + ULONGLONG IntT18; + ULONGLONG IntT19; + ULONGLONG IntT20; + ULONGLONG IntT21; + ULONGLONG IntT22; + ULONGLONG IntNats; + ULONGLONG Preds; + ULONGLONG BrRp; + ULONGLONG BrS0; + ULONGLONG BrS1; + ULONGLONG BrS2; + ULONGLONG BrS3; + ULONGLONG BrS4; + ULONGLONG BrT0; + ULONGLONG BrT1; + ULONGLONG ApUNAT; + ULONGLONG ApLC; + ULONGLONG ApEC; + ULONGLONG ApCCV; + ULONGLONG ApDCR; + ULONGLONG RsPFS; + ULONGLONG RsBSP; + ULONGLONG RsBSPSTORE; + ULONGLONG RsRSC; + ULONGLONG RsRNAT; + ULONGLONG StIPSR; + ULONGLONG StIIP; + ULONGLONG StIFS; + ULONGLONG StFCR; + ULONGLONG Eflag; + ULONGLONG SegCSD; + ULONGLONG SegSSD; + ULONGLONG Cflag; + ULONGLONG StFSR; + ULONGLONG StFIR; + ULONGLONG StFDR; + ULONGLONG UNUSEDPACK; + } CONTEXT,*PCONTEXT; + + typedef struct _PLABEL_DESCRIPTOR { + ULONGLONG EntryPoint; + ULONGLONG GlobalPointer; + } PLABEL_DESCRIPTOR,*PPLABEL_DESCRIPTOR; + + typedef struct _RUNTIME_FUNCTION { + DWORD BeginAddress; + DWORD EndAddress; + DWORD UnwindInfoAddress; + } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION; + + typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 ControlPc,PVOID Context); + typedef DWORD (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(HANDLE Process,PVOID TableAddress,PDWORD Entries,PRUNTIME_FUNCTION *Functions); + +#define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback" + + BOOLEAN RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,DWORD EntryCount,ULONGLONG BaseAddress,ULONGLONG TargetGp); + BOOLEAN RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,DWORD64 BaseAddress,DWORD Length,DWORD64 TargetGp,PGET_RUNTIME_FUNCTION_CALLBACK Callback,PVOID Context,PCWSTR OutOfProcessCallbackDll); + BOOLEAN RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable); + VOID RtlRestoreContext (PCONTEXT ContextRecord,struct _EXCEPTION_RECORD *ExceptionRecord); + VOID __jump_unwind(ULONGLONG TargetMsFrame,ULONGLONG TargetBsFrame,ULONGLONG TargetPc); +#endif + +#define EXCEPTION_NONCONTINUABLE 0x1 +#define EXCEPTION_MAXIMUM_PARAMETERS 15 + + typedef struct _EXCEPTION_RECORD { + DWORD ExceptionCode; + DWORD ExceptionFlags; + struct _EXCEPTION_RECORD *ExceptionRecord; + PVOID ExceptionAddress; + DWORD NumberParameters; + ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; + } EXCEPTION_RECORD; + + typedef EXCEPTION_RECORD *PEXCEPTION_RECORD; + + typedef struct _EXCEPTION_RECORD32 { + DWORD ExceptionCode; + DWORD ExceptionFlags; + DWORD ExceptionRecord; + DWORD ExceptionAddress; + DWORD NumberParameters; + DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; + } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32; + + typedef struct _EXCEPTION_RECORD64 { + DWORD ExceptionCode; + DWORD ExceptionFlags; + DWORD64 ExceptionRecord; + DWORD64 ExceptionAddress; + DWORD NumberParameters; + DWORD __unusedAlignment; + DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; + } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64; + + typedef struct _EXCEPTION_POINTERS { + PEXCEPTION_RECORD ExceptionRecord; + PCONTEXT ContextRecord; + } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS; + +#ifdef __x86_64 + + typedef EXCEPTION_DISPOSITION NTAPI EXCEPTION_ROUTINE (struct _EXCEPTION_RECORD *ExceptionRecord, PVOID EstablisherFrame, struct _CONTEXT *ContextRecord, PVOID DispatcherContext); +#ifndef __PEXCEPTION_ROUTINE_DEFINED +#define __PEXCEPTION_ROUTINE_DEFINED + typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE; +#endif + + /* http://msdn.microsoft.com/en-us/library/ms680597(VS.85).aspx */ + +#define UNWIND_HISTORY_TABLE_SIZE 12 + + typedef struct _UNWIND_HISTORY_TABLE_ENTRY { + ULONG64 ImageBase; + PRUNTIME_FUNCTION FunctionEntry; + } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY; + +#define UNWIND_HISTORY_TABLE_NONE 0 +#define UNWIND_HISTORY_TABLE_GLOBAL 1 +#define UNWIND_HISTORY_TABLE_LOCAL 2 + + typedef struct _UNWIND_HISTORY_TABLE { + ULONG Count; + UCHAR Search; + ULONG64 LowAddress; + ULONG64 HighAddress; + UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE]; + } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE; + + /* http://msdn.microsoft.com/en-us/library/b6sf5kbd(VS.80).aspx */ + + struct _DISPATCHER_CONTEXT; + typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT; + typedef struct _DISPATCHER_CONTEXT *PDISPATCHER_CONTEXT; + + struct _DISPATCHER_CONTEXT { + ULONG64 ControlPc; + ULONG64 ImageBase; + PRUNTIME_FUNCTION FunctionEntry; + ULONG64 EstablisherFrame; + ULONG64 TargetIp; + PCONTEXT ContextRecord; + PEXCEPTION_ROUTINE LanguageHandler; + PVOID HandlerData; + /* http://www.nynaeve.net/?p=99 */ + PUNWIND_HISTORY_TABLE HistoryTable; + ULONG ScopeIndex; + ULONG Fill0; + }; + + /* http://msdn.microsoft.com/en-us/library/ms680617(VS.85).aspx */ + + typedef struct _KNONVOLATILE_CONTEXT_POINTERS + { + PM128A FloatingContext[16]; + PULONG64 IntegerContext[16]; + } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; +#endif /* defined(__x86_64) */ + + typedef PVOID PACCESS_TOKEN; + typedef PVOID PSECURITY_DESCRIPTOR; + typedef PVOID PSID; + + typedef DWORD ACCESS_MASK; + typedef ACCESS_MASK *PACCESS_MASK; + +#define DELETE (0x00010000L) +#define READ_CONTROL (0x00020000L) +#define WRITE_DAC (0x00040000L) +#define WRITE_OWNER (0x00080000L) +#define SYNCHRONIZE (0x00100000L) + +#define STANDARD_RIGHTS_REQUIRED (0x000F0000L) +#define STANDARD_RIGHTS_READ (READ_CONTROL) +#define STANDARD_RIGHTS_WRITE (READ_CONTROL) +#define STANDARD_RIGHTS_EXECUTE (READ_CONTROL) +#define STANDARD_RIGHTS_ALL (0x001F0000L) + +#define SPECIFIC_RIGHTS_ALL (0x0000FFFFL) + +#define ACCESS_SYSTEM_SECURITY (0x01000000L) + +#define MAXIMUM_ALLOWED (0x02000000L) + +#define GENERIC_READ (0x80000000L) +#define GENERIC_WRITE (0x40000000L) +#define GENERIC_EXECUTE (0x20000000L) +#define GENERIC_ALL (0x10000000L) + + typedef struct _GENERIC_MAPPING { + ACCESS_MASK GenericRead; + ACCESS_MASK GenericWrite; + ACCESS_MASK GenericExecute; + ACCESS_MASK GenericAll; + } GENERIC_MAPPING; + typedef GENERIC_MAPPING *PGENERIC_MAPPING; + +#include + + typedef struct _LUID_AND_ATTRIBUTES { + LUID Luid; + DWORD Attributes; + } LUID_AND_ATTRIBUTES,*PLUID_AND_ATTRIBUTES; + typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; + typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY; + +#include + +#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED +#define SID_IDENTIFIER_AUTHORITY_DEFINED + typedef struct _SID_IDENTIFIER_AUTHORITY { + BYTE Value[6]; + } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY; +#endif + +#ifndef SID_DEFINED +#define SID_DEFINED + typedef struct _SID { + BYTE Revision; + BYTE SubAuthorityCount; + SID_IDENTIFIER_AUTHORITY IdentifierAuthority; + DWORD SubAuthority[ANYSIZE_ARRAY]; + } SID,*PISID; +#endif + +#define SID_REVISION (1) +#define SID_MAX_SUB_AUTHORITIES (15) +#define SID_RECOMMENDED_SUB_AUTHORITIES (1) + +#define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES *sizeof(DWORD))) + + typedef enum _SID_NAME_USE { + SidTypeUser = 1,SidTypeGroup,SidTypeDomain,SidTypeAlias,SidTypeWellKnownGroup,SidTypeDeletedAccount,SidTypeInvalid,SidTypeUnknown,SidTypeComputer + } SID_NAME_USE,*PSID_NAME_USE; + + typedef struct _SID_AND_ATTRIBUTES { + PSID Sid; + DWORD Attributes; + } SID_AND_ATTRIBUTES,*PSID_AND_ATTRIBUTES; + + typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; + typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY; + +#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0} +#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1} +#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2} +#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3} +#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4} +#define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9} + +#define SECURITY_NULL_RID (0x00000000L) +#define SECURITY_WORLD_RID (0x00000000L) +#define SECURITY_LOCAL_RID (0x00000000L) + +#define SECURITY_CREATOR_OWNER_RID (0x00000000L) +#define SECURITY_CREATOR_GROUP_RID (0x00000001L) + +#define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L) +#define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L) + +#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5} + +#define SECURITY_DIALUP_RID (0x00000001L) +#define SECURITY_NETWORK_RID (0x00000002L) +#define SECURITY_BATCH_RID (0x00000003L) +#define SECURITY_INTERACTIVE_RID (0x00000004L) +#define SECURITY_LOGON_IDS_RID (0x00000005L) +#define SECURITY_LOGON_IDS_RID_COUNT (3L) +#define SECURITY_SERVICE_RID (0x00000006L) +#define SECURITY_ANONYMOUS_LOGON_RID (0x00000007L) +#define SECURITY_PROXY_RID (0x00000008L) +#define SECURITY_ENTERPRISE_CONTROLLERS_RID (0x00000009L) +#define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID +#define SECURITY_PRINCIPAL_SELF_RID (0x0000000AL) +#define SECURITY_AUTHENTICATED_USER_RID (0x0000000BL) +#define SECURITY_RESTRICTED_CODE_RID (0x0000000CL) +#define SECURITY_TERMINAL_SERVER_RID (0x0000000DL) +#define SECURITY_REMOTE_LOGON_RID (0x0000000EL) +#define SECURITY_THIS_ORGANIZATION_RID (0x0000000FL) +#define SECURITY_IUSER_RID (0x00000011L) + +#define SECURITY_LOCAL_SYSTEM_RID (0x00000012L) +#define SECURITY_LOCAL_SERVICE_RID (0x00000013L) +#define SECURITY_NETWORK_SERVICE_RID (0x00000014L) + +#define SECURITY_NT_NON_UNIQUE (0x00000015L) +#define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT (3L) + +#define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID (0x00000016L) + +#define SECURITY_BUILTIN_DOMAIN_RID (0x00000020L) +#define SECURITY_WRITE_RESTRICTED_CODE_RID (0x00000021L) + +#define SECURITY_PACKAGE_BASE_RID (0x00000040L) +#define SECURITY_PACKAGE_RID_COUNT (2L) +#define SECURITY_PACKAGE_NTLM_RID (0x0000000AL) +#define SECURITY_PACKAGE_SCHANNEL_RID (0x0000000EL) +#define SECURITY_PACKAGE_DIGEST_RID (0x00000015L) + +#define SECURITY_SERVICE_ID_BASE_RID (0x00000050L) +#define SECURITY_SERVICE_ID_RID_COUNT (6L) + +#define SECURITY_RESERVED_ID_BASE_RID (0x00000051L) + +#define SECURITY_MAX_ALWAYS_FILTERED (0x000003E7L) +#define SECURITY_MIN_NEVER_FILTERED (0x000003E8L) + +#define SECURITY_OTHER_ORGANIZATION_RID (0x000003E8L) + +#define FOREST_USER_RID_MAX (0x000001F3L) + +#define DOMAIN_USER_RID_ADMIN (0x000001F4L) +#define DOMAIN_USER_RID_GUEST (0x000001F5L) +#define DOMAIN_USER_RID_KRBTGT (0x000001F6L) + +#define DOMAIN_USER_RID_MAX (0x000003E7L) + +#define DOMAIN_GROUP_RID_ADMINS (0x00000200L) +#define DOMAIN_GROUP_RID_USERS (0x00000201L) +#define DOMAIN_GROUP_RID_GUESTS (0x00000202L) +#define DOMAIN_GROUP_RID_COMPUTERS (0x00000203L) +#define DOMAIN_GROUP_RID_CONTROLLERS (0x00000204L) +#define DOMAIN_GROUP_RID_CERT_ADMINS (0x00000205L) +#define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L) +#define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L) +#define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L) +#define DOMAIN_GROUP_RID_READONLY_CONTROLLERS (0x00000209L) + +#define DOMAIN_ALIAS_RID_ADMINS (0x00000220L) +#define DOMAIN_ALIAS_RID_USERS (0x00000221L) +#define DOMAIN_ALIAS_RID_GUESTS (0x00000222L) +#define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L) + +#define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L) +#define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L) +#define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L) +#define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L) + +#define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L) +#define DOMAIN_ALIAS_RID_RAS_SERVERS (0x00000229L) +#define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS (0x0000022AL) +#define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS (0x0000022BL) +#define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS (0x0000022CL) +#define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS (0x0000022DL) + +#define DOMAIN_ALIAS_RID_MONITORING_USERS (0x0000022EL) +#define DOMAIN_ALIAS_RID_LOGGING_USERS (0x0000022FL) +#define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS (0x00000230L) +#define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS (0x00000231L) +#define DOMAIN_ALIAS_RID_DCOM_USERS (0x00000232L) + +#define DOMAIN_ALIAS_RID_IUSERS (0x00000238L) +#define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS (0x00000239L) +#define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP (0x0000023BL) +#define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP (0x0000023CL) +#define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP (0x0000023DL) + +#define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16} +#define SECURITY_MANDATORY_UNTRUSTED_RID (0x00000000L) +#define SECURITY_MANDATORY_LOW_RID (0x00001000L) +#define SECURITY_MANDATORY_MEDIUM_RID (0x00002000L) +#define SECURITY_MANDATORY_HIGH_RID (0x00003000L) +#define SECURITY_MANDATORY_SYSTEM_RID (0x00004000L) +#define SECURITY_MANDATORY_PROTECTED_PROCESS_RID (0x00005000L) + +#define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID + +#define MANDATORY_LEVEL_TO_MANDATORY_RID(IL) (IL * 0x1000) + + typedef enum { + WinNullSid = 0,WinWorldSid = 1,WinLocalSid = 2,WinCreatorOwnerSid = 3,WinCreatorGroupSid = 4,WinCreatorOwnerServerSid = 5,WinCreatorGroupServerSid = 6,WinNtAuthoritySid = 7,WinDialupSid = 8,WinNetworkSid = 9,WinBatchSid = 10,WinInteractiveSid = 11,WinServiceSid = 12,WinAnonymousSid = 13,WinProxySid = 14,WinEnterpriseControllersSid = 15,WinSelfSid = 16,WinAuthenticatedUserSid = 17,WinRestrictedCodeSid = 18,WinTerminalServerSid = 19,WinRemoteLogonIdSid = 20,WinLogonIdsSid = 21,WinLocalSystemSid = 22,WinLocalServiceSid = 23,WinNetworkServiceSid = 24,WinBuiltinDomainSid = 25,WinBuiltinAdministratorsSid = 26,WinBuiltinUsersSid = 27,WinBuiltinGuestsSid = 28,WinBuiltinPowerUsersSid = 29,WinBuiltinAccountOperatorsSid = 30,WinBuiltinSystemOperatorsSid = 31,WinBuiltinPrintOperatorsSid = 32,WinBuiltinBackupOperatorsSid = 33,WinBuiltinReplicatorSid = 34,WinBuiltinPreWindows2000CompatibleAccessSid = 35,WinBuiltinRemoteDesktopUsersSid = 36,WinBuiltinNetworkConfigurationOperatorsSid = 37,WinAccountAdministratorSid = 38,WinAccountGuestSid = 39,WinAccountKrbtgtSid = 40,WinAccountDomainAdminsSid = 41,WinAccountDomainUsersSid = 42,WinAccountDomainGuestsSid = 43,WinAccountComputersSid = 44,WinAccountControllersSid = 45,WinAccountCertAdminsSid = 46,WinAccountSchemaAdminsSid = 47,WinAccountEnterpriseAdminsSid = 48,WinAccountPolicyAdminsSid = 49,WinAccountRasAndIasServersSid = 50,WinNTLMAuthenticationSid = 51,WinDigestAuthenticationSid = 52,WinSChannelAuthenticationSid = 53,WinThisOrganizationSid = 54,WinOtherOrganizationSid = 55,WinBuiltinIncomingForestTrustBuildersSid = 56,WinBuiltinPerfMonitoringUsersSid = 57,WinBuiltinPerfLoggingUsersSid = 58,WinBuiltinAuthorizationAccessSid = 59,WinBuiltinTerminalServerLicenseServersSid = 60,WinBuiltinDCOMUsersSid = 61 + } WELL_KNOWN_SID_TYPE; + +#define SYSTEM_LUID { 0x3E7,0x0 } +#define ANONYMOUS_LOGON_LUID { 0x3e6,0x0 } +#define LOCALSERVICE_LUID { 0x3e5,0x0 } +#define NETWORKSERVICE_LUID { 0x3e4,0x0 } +#define IUSER_LUID { 0x3e3, 0x0 } + +#define SE_GROUP_MANDATORY (0x00000001L) +#define SE_GROUP_ENABLED_BY_DEFAULT (0x00000002L) +#define SE_GROUP_ENABLED (0x00000004L) +#define SE_GROUP_OWNER (0x00000008L) +#define SE_GROUP_USE_FOR_DENY_ONLY (0x00000010L) +#define SE_GROUP_INTEGRITY (0x00000020L) +#define SE_GROUP_INTEGRITY_ENABLED (0x00000040L) +#define SE_GROUP_LOGON_ID (0xC0000000L) +#define SE_GROUP_RESOURCE (0x20000000L) + +#define ACL_REVISION (2) +#define ACL_REVISION_DS (4) + +#define ACL_REVISION1 (1) +#define MIN_ACL_REVISION ACL_REVISION2 +#define ACL_REVISION2 (2) +#define ACL_REVISION3 (3) +#define ACL_REVISION4 (4) +#define MAX_ACL_REVISION ACL_REVISION4 + + typedef struct _ACL { + BYTE AclRevision; + BYTE Sbz1; + WORD AclSize; + WORD AceCount; + WORD Sbz2; + } ACL; + typedef ACL *PACL; + + typedef struct _ACE_HEADER { + BYTE AceType; + BYTE AceFlags; + WORD AceSize; + } ACE_HEADER; + typedef ACE_HEADER *PACE_HEADER; + +#define ACCESS_MIN_MS_ACE_TYPE (0x0) +#define ACCESS_ALLOWED_ACE_TYPE (0x0) +#define ACCESS_DENIED_ACE_TYPE (0x1) +#define SYSTEM_AUDIT_ACE_TYPE (0x2) +#define SYSTEM_ALARM_ACE_TYPE (0x3) +#define ACCESS_MAX_MS_V2_ACE_TYPE (0x3) + +#define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4) +#define ACCESS_MAX_MS_V3_ACE_TYPE (0x4) + +#define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5) +#define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5) +#define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6) +#define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7) +#define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8) +#define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8) + +#define ACCESS_MAX_MS_V4_ACE_TYPE (0x8) +#define ACCESS_MAX_MS_ACE_TYPE (0x8) + +#define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9) +#define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA) +#define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB) +#define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC) +#define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD) +#define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE) +#define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF) +#define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10) + +#define SYSTEM_MANDATORY_LABEL_ACE_TYPE (0x11) +#define ACCESS_MAX_MS_V5_ACE_TYPE (0x11) + +#define OBJECT_INHERIT_ACE (0x1) +#define CONTAINER_INHERIT_ACE (0x2) +#define NO_PROPAGATE_INHERIT_ACE (0x4) +#define INHERIT_ONLY_ACE (0x8) +#define INHERITED_ACE (0x10) +#define VALID_INHERIT_FLAGS (0x1F) + +#define SUCCESSFUL_ACCESS_ACE_FLAG (0x40) +#define FAILED_ACCESS_ACE_FLAG (0x80) + + typedef struct _ACCESS_ALLOWED_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + } ACCESS_ALLOWED_ACE; + + typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE; + + typedef struct _ACCESS_DENIED_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + } ACCESS_DENIED_ACE; + typedef ACCESS_DENIED_ACE *PACCESS_DENIED_ACE; + + typedef struct _SYSTEM_AUDIT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + } SYSTEM_AUDIT_ACE; + typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE; + + typedef struct _SYSTEM_ALARM_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + } SYSTEM_ALARM_ACE; + typedef SYSTEM_ALARM_ACE *PSYSTEM_ALARM_ACE; + + typedef struct _ACCESS_ALLOWED_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE; + + typedef struct _ACCESS_DENIED_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE; + + typedef struct _SYSTEM_AUDIT_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE; + + typedef struct _SYSTEM_ALARM_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE; + + typedef struct _ACCESS_ALLOWED_CALLBACK_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + + } ACCESS_ALLOWED_CALLBACK_ACE,*PACCESS_ALLOWED_CALLBACK_ACE; + + typedef struct _ACCESS_DENIED_CALLBACK_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + + } ACCESS_DENIED_CALLBACK_ACE,*PACCESS_DENIED_CALLBACK_ACE; + + typedef struct _SYSTEM_AUDIT_CALLBACK_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + + } SYSTEM_AUDIT_CALLBACK_ACE,*PSYSTEM_AUDIT_CALLBACK_ACE; + + typedef struct _SYSTEM_ALARM_CALLBACK_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; + + } SYSTEM_ALARM_CALLBACK_ACE,*PSYSTEM_ALARM_CALLBACK_ACE; + + typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + + } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE,*PACCESS_ALLOWED_CALLBACK_OBJECT_ACE; + + typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + + } ACCESS_DENIED_CALLBACK_OBJECT_ACE,*PACCESS_DENIED_CALLBACK_OBJECT_ACE; + + typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + + } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE,*PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE; + + typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD Flags; + GUID ObjectType; + GUID InheritedObjectType; + DWORD SidStart; + + } SYSTEM_ALARM_CALLBACK_OBJECT_ACE,*PSYSTEM_ALARM_CALLBACK_OBJECT_ACE; + +#define ACE_OBJECT_TYPE_PRESENT 0x1 +#define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2 + + typedef enum _ACL_INFORMATION_CLASS { + AclRevisionInformation = 1,AclSizeInformation + } ACL_INFORMATION_CLASS; + + typedef struct _ACL_REVISION_INFORMATION { + DWORD AclRevision; + } ACL_REVISION_INFORMATION; + typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION; + + typedef struct _ACL_SIZE_INFORMATION { + DWORD AceCount; + DWORD AclBytesInUse; + DWORD AclBytesFree; + } ACL_SIZE_INFORMATION; + typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION; + +#define SECURITY_DESCRIPTOR_REVISION (1) +#define SECURITY_DESCRIPTOR_REVISION1 (1) + +#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR)) + + typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL; + +#define SE_OWNER_DEFAULTED (0x0001) +#define SE_GROUP_DEFAULTED (0x0002) +#define SE_DACL_PRESENT (0x0004) +#define SE_DACL_DEFAULTED (0x0008) +#define SE_SACL_PRESENT (0x0010) +#define SE_SACL_DEFAULTED (0x0020) +#define SE_DACL_AUTO_INHERIT_REQ (0x0100) +#define SE_SACL_AUTO_INHERIT_REQ (0x0200) +#define SE_DACL_AUTO_INHERITED (0x0400) +#define SE_SACL_AUTO_INHERITED (0x0800) +#define SE_DACL_PROTECTED (0x1000) +#define SE_SACL_PROTECTED (0x2000) +#define SE_RM_CONTROL_VALID (0x4000) +#define SE_SELF_RELATIVE (0x8000) + + typedef struct _SECURITY_DESCRIPTOR_RELATIVE { + BYTE Revision; + BYTE Sbz1; + SECURITY_DESCRIPTOR_CONTROL Control; + DWORD Owner; + DWORD Group; + DWORD Sacl; + DWORD Dacl; + } SECURITY_DESCRIPTOR_RELATIVE,*PISECURITY_DESCRIPTOR_RELATIVE; + + typedef struct _SECURITY_DESCRIPTOR { + BYTE Revision; + BYTE Sbz1; + SECURITY_DESCRIPTOR_CONTROL Control; + PSID Owner; + PSID Group; + PACL Sacl; + PACL Dacl; + + } SECURITY_DESCRIPTOR,*PISECURITY_DESCRIPTOR; + + typedef struct _OBJECT_TYPE_LIST { + WORD Level; + WORD Sbz; + GUID *ObjectType; + } OBJECT_TYPE_LIST,*POBJECT_TYPE_LIST; + +#define ACCESS_OBJECT_GUID 0 +#define ACCESS_PROPERTY_SET_GUID 1 +#define ACCESS_PROPERTY_GUID 2 + +#define ACCESS_MAX_LEVEL 4 + + typedef enum _AUDIT_EVENT_TYPE { + AuditEventObjectAccess,AuditEventDirectoryServiceAccess + } AUDIT_EVENT_TYPE,*PAUDIT_EVENT_TYPE; + +#define AUDIT_ALLOW_NO_PRIVILEGE 0x1 + +#define ACCESS_DS_SOURCE_A "DS" +#define ACCESS_DS_SOURCE_W L"DS" +#define ACCESS_DS_OBJECT_TYPE_NAME_A "Directory Service Object" +#define ACCESS_DS_OBJECT_TYPE_NAME_W L"Directory Service Object" + +#define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L) +#define SE_PRIVILEGE_ENABLED (0x00000002L) +#define SE_PRIVILEGE_REMOVED (0X00000004L) +#define SE_PRIVILEGE_USED_FOR_ACCESS (0x80000000L) + +#define PRIVILEGE_SET_ALL_NECESSARY (1) + + typedef struct _PRIVILEGE_SET { + DWORD PrivilegeCount; + DWORD Control; + LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]; + } PRIVILEGE_SET,*PPRIVILEGE_SET; + +#define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege") +#define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege") +#define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege") +#define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege") +#define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege") +#define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege") +#define SE_TCB_NAME TEXT("SeTcbPrivilege") +#define SE_SECURITY_NAME TEXT("SeSecurityPrivilege") +#define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege") +#define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege") +#define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege") +#define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege") +#define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege") +#define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege") +#define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege") +#define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege") +#define SE_BACKUP_NAME TEXT("SeBackupPrivilege") +#define SE_RESTORE_NAME TEXT("SeRestorePrivilege") +#define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege") +#define SE_DEBUG_NAME TEXT("SeDebugPrivilege") +#define SE_AUDIT_NAME TEXT("SeAuditPrivilege") +#define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege") +#define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege") +#define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege") +#define SE_UNDOCK_NAME TEXT("SeUndockPrivilege") +#define SE_SYNC_AGENT_NAME TEXT("SeSyncAgentPrivilege") +#define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege") +#define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege") +#define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege") +#define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege") + + typedef enum _SECURITY_IMPERSONATION_LEVEL { + SecurityAnonymous,SecurityIdentification,SecurityImpersonation,SecurityDelegation + } SECURITY_IMPERSONATION_LEVEL,*PSECURITY_IMPERSONATION_LEVEL; + +#define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation +#define SECURITY_MIN_IMPERSONATION_LEVEL SecurityAnonymous +#define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation +#define VALID_IMPERSONATION_LEVEL(L) (((L) >= SECURITY_MIN_IMPERSONATION_LEVEL) && ((L) <= SECURITY_MAX_IMPERSONATION_LEVEL)) + +#define TOKEN_ASSIGN_PRIMARY (0x0001) +#define TOKEN_DUPLICATE (0x0002) +#define TOKEN_IMPERSONATE (0x0004) +#define TOKEN_QUERY (0x0008) +#define TOKEN_QUERY_SOURCE (0x0010) +#define TOKEN_ADJUST_PRIVILEGES (0x0020) +#define TOKEN_ADJUST_GROUPS (0x0040) +#define TOKEN_ADJUST_DEFAULT (0x0080) +#define TOKEN_ADJUST_SESSIONID (0x0100) + +#define TOKEN_ALL_ACCESS_P (STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE | TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT) +#define TOKEN_ALL_ACCESS (TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID) +#define TOKEN_READ (STANDARD_RIGHTS_READ | TOKEN_QUERY) + +#define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT) + +#define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE) + + typedef enum _TOKEN_TYPE { + TokenPrimary = 1,TokenImpersonation + } TOKEN_TYPE; + typedef TOKEN_TYPE *PTOKEN_TYPE; + + typedef enum _TOKEN_INFORMATION_CLASS { + TokenUser = 1,TokenGroups,TokenPrivileges,TokenOwner,TokenPrimaryGroup,TokenDefaultDacl,TokenSource,TokenType,TokenImpersonationLevel, + TokenStatistics,TokenRestrictedSids,TokenSessionId,TokenGroupsAndPrivileges,TokenSessionReference,TokenSandBoxInert,TokenAuditPolicy, + TokenOrigin,MaxTokenInfoClass + } TOKEN_INFORMATION_CLASS,*PTOKEN_INFORMATION_CLASS; + + typedef struct _TOKEN_USER { + SID_AND_ATTRIBUTES User; + } TOKEN_USER,*PTOKEN_USER; + + typedef struct _TOKEN_GROUPS { + DWORD GroupCount; + SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]; + } TOKEN_GROUPS,*PTOKEN_GROUPS; + + typedef struct _TOKEN_PRIVILEGES { + DWORD PrivilegeCount; + LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; + } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES; + + typedef struct _TOKEN_OWNER { + PSID Owner; + } TOKEN_OWNER,*PTOKEN_OWNER; + + typedef struct _TOKEN_PRIMARY_GROUP { + PSID PrimaryGroup; + } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP; + + typedef struct _TOKEN_DEFAULT_DACL { + PACL DefaultDacl; + } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL; + + typedef struct _TOKEN_GROUPS_AND_PRIVILEGES { + DWORD SidCount; + DWORD SidLength; + PSID_AND_ATTRIBUTES Sids; + DWORD RestrictedSidCount; + DWORD RestrictedSidLength; + PSID_AND_ATTRIBUTES RestrictedSids; + DWORD PrivilegeCount; + DWORD PrivilegeLength; + PLUID_AND_ATTRIBUTES Privileges; + LUID AuthenticationId; + } TOKEN_GROUPS_AND_PRIVILEGES,*PTOKEN_GROUPS_AND_PRIVILEGES; + +#define TOKEN_AUDIT_SUCCESS_INCLUDE 0x1 +#define TOKEN_AUDIT_SUCCESS_EXCLUDE 0x2 +#define TOKEN_AUDIT_FAILURE_INCLUDE 0x4 +#define TOKEN_AUDIT_FAILURE_EXCLUDE 0x8 + +#define VALID_AUDIT_POLICY_BITS (TOKEN_AUDIT_SUCCESS_INCLUDE | TOKEN_AUDIT_SUCCESS_EXCLUDE | TOKEN_AUDIT_FAILURE_INCLUDE | TOKEN_AUDIT_FAILURE_EXCLUDE) +#define VALID_TOKEN_AUDIT_POLICY_ELEMENT(P) ((((P).PolicyMask & ~VALID_AUDIT_POLICY_BITS)==0) && ((P).Category <= AuditEventMaxType)) + + typedef struct _TOKEN_AUDIT_POLICY_ELEMENT { + DWORD Category; + DWORD PolicyMask; + } TOKEN_AUDIT_POLICY_ELEMENT,*PTOKEN_AUDIT_POLICY_ELEMENT; + + typedef struct _TOKEN_AUDIT_POLICY { + DWORD PolicyCount; + TOKEN_AUDIT_POLICY_ELEMENT Policy[ANYSIZE_ARRAY]; + } TOKEN_AUDIT_POLICY,*PTOKEN_AUDIT_POLICY; + +#define PER_USER_AUDITING_POLICY_SIZE(p) (sizeof(TOKEN_AUDIT_POLICY) + (((p)->PolicyCount > ANYSIZE_ARRAY) ? (sizeof(TOKEN_AUDIT_POLICY_ELEMENT) *((p)->PolicyCount - ANYSIZE_ARRAY)) : 0)) +#define PER_USER_AUDITING_POLICY_SIZE_BY_COUNT(C) (sizeof(TOKEN_AUDIT_POLICY) + (((C) > ANYSIZE_ARRAY) ? (sizeof(TOKEN_AUDIT_POLICY_ELEMENT) *((C) - ANYSIZE_ARRAY)) : 0)) + +#define TOKEN_SOURCE_LENGTH 8 + + typedef struct _TOKEN_SOURCE { + CHAR SourceName[TOKEN_SOURCE_LENGTH]; + LUID SourceIdentifier; + } TOKEN_SOURCE,*PTOKEN_SOURCE; + + typedef struct _TOKEN_STATISTICS { + LUID TokenId; + LUID AuthenticationId; + LARGE_INTEGER ExpirationTime; + TOKEN_TYPE TokenType; + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; + DWORD DynamicCharged; + DWORD DynamicAvailable; + DWORD GroupCount; + DWORD PrivilegeCount; + LUID ModifiedId; + } TOKEN_STATISTICS,*PTOKEN_STATISTICS; + + typedef struct _TOKEN_CONTROL { + LUID TokenId; + LUID AuthenticationId; + LUID ModifiedId; + TOKEN_SOURCE TokenSource; + } TOKEN_CONTROL,*PTOKEN_CONTROL; + + typedef struct _TOKEN_ORIGIN { + LUID OriginatingLogonSession; + } TOKEN_ORIGIN,*PTOKEN_ORIGIN; + +#define SECURITY_DYNAMIC_TRACKING (TRUE) +#define SECURITY_STATIC_TRACKING (FALSE) + + typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,*PSECURITY_CONTEXT_TRACKING_MODE; + + typedef struct _SECURITY_QUALITY_OF_SERVICE { + DWORD Length; + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; + SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; + BOOLEAN EffectiveOnly; + } SECURITY_QUALITY_OF_SERVICE,*PSECURITY_QUALITY_OF_SERVICE; + + typedef struct _SE_IMPERSONATION_STATE { + PACCESS_TOKEN Token; + BOOLEAN CopyOnOpen; + BOOLEAN EffectiveOnly; + SECURITY_IMPERSONATION_LEVEL Level; + } SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE; + +#define DISABLE_MAX_PRIVILEGE 0x1 +#define SANDBOX_INERT 0x2 + + typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION; + +#define OWNER_SECURITY_INFORMATION (0x00000001L) +#define GROUP_SECURITY_INFORMATION (0x00000002L) +#define DACL_SECURITY_INFORMATION (0x00000004L) +#define SACL_SECURITY_INFORMATION (0x00000008L) + +#define PROTECTED_DACL_SECURITY_INFORMATION (0x80000000L) +#define PROTECTED_SACL_SECURITY_INFORMATION (0x40000000L) +#define UNPROTECTED_DACL_SECURITY_INFORMATION (0x20000000L) +#define UNPROTECTED_SACL_SECURITY_INFORMATION (0x10000000L) + +#define PROCESS_TERMINATE (0x0001) +#define PROCESS_CREATE_THREAD (0x0002) +#define PROCESS_SET_SESSIONID (0x0004) +#define PROCESS_VM_OPERATION (0x0008) +#define PROCESS_VM_READ (0x0010) +#define PROCESS_VM_WRITE (0x0020) +#define PROCESS_DUP_HANDLE (0x0040) +#define PROCESS_CREATE_PROCESS (0x0080) +#define PROCESS_SET_QUOTA (0x0100) +#define PROCESS_SET_INFORMATION (0x0200) +#define PROCESS_QUERY_INFORMATION (0x0400) +#define PROCESS_SUSPEND_RESUME (0x0800) +#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF) + +#ifdef _WIN64 +#define MAXIMUM_PROCESSORS 64 +#else +#define MAXIMUM_PROCESSORS 32 +#endif + +#define THREAD_TERMINATE (0x0001) +#define THREAD_SUSPEND_RESUME (0x0002) +#define THREAD_GET_CONTEXT (0x0008) +#define THREAD_SET_CONTEXT (0x0010) +#define THREAD_SET_INFORMATION (0x0020) +#define THREAD_QUERY_INFORMATION (0x0040) +#define THREAD_SET_THREAD_TOKEN (0x0080) +#define THREAD_IMPERSONATE (0x0100) +#define THREAD_DIRECT_IMPERSONATION (0x0200) + +#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3FF) + +#define JOB_OBJECT_ASSIGN_PROCESS (0x0001) +#define JOB_OBJECT_SET_ATTRIBUTES (0x0002) +#define JOB_OBJECT_QUERY (0x0004) +#define JOB_OBJECT_TERMINATE (0x0008) +#define JOB_OBJECT_SET_SECURITY_ATTRIBUTES (0x0010) +#define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1F) + + typedef struct _JOB_SET_ARRAY { + HANDLE JobHandle; + DWORD MemberLevel; + DWORD Flags; + } JOB_SET_ARRAY,*PJOB_SET_ARRAY; + +#define FLS_MAXIMUM_AVAILABLE 128 +#define TLS_MINIMUM_AVAILABLE 64 + +#ifndef _NT_TIB_DEFINED +#define _NT_TIB_DEFINED + typedef struct _NT_TIB { + struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; + PVOID StackBase; + PVOID StackLimit; + PVOID SubSystemTib; + union { + PVOID FiberData; + DWORD Version; + }; + PVOID ArbitraryUserPointer; + struct _NT_TIB *Self; + } NT_TIB; + typedef NT_TIB *PNT_TIB; +#endif + + typedef struct _NT_TIB32 { + DWORD ExceptionList; + DWORD StackBase; + DWORD StackLimit; + DWORD SubSystemTib; + union { + DWORD FiberData; + DWORD Version; + }; + DWORD ArbitraryUserPointer; + DWORD Self; + } NT_TIB32,*PNT_TIB32; + + typedef struct _NT_TIB64 { + DWORD64 ExceptionList; + DWORD64 StackBase; + DWORD64 StackLimit; + DWORD64 SubSystemTib; + union { + DWORD64 FiberData; + DWORD Version; + }; + DWORD64 ArbitraryUserPointer; + DWORD64 Self; + } NT_TIB64,*PNT_TIB64; + +#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) +#define WX86 +#endif + +#define THREAD_BASE_PRIORITY_LOWRT 15 +#define THREAD_BASE_PRIORITY_MAX 2 +#define THREAD_BASE_PRIORITY_MIN (-2) +#define THREAD_BASE_PRIORITY_IDLE (-15) + + typedef struct _QUOTA_LIMITS { + SIZE_T PagedPoolLimit; + SIZE_T NonPagedPoolLimit; + SIZE_T MinimumWorkingSetSize; + SIZE_T MaximumWorkingSetSize; + SIZE_T PagefileLimit; + LARGE_INTEGER TimeLimit; + } QUOTA_LIMITS,*PQUOTA_LIMITS; + +#define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001 +#define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002 +#define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004 +#define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008 + + typedef struct _QUOTA_LIMITS_EX { + SIZE_T PagedPoolLimit; + SIZE_T NonPagedPoolLimit; + SIZE_T MinimumWorkingSetSize; + SIZE_T MaximumWorkingSetSize; + SIZE_T PagefileLimit; + LARGE_INTEGER TimeLimit; + SIZE_T Reserved1; + SIZE_T Reserved2; + SIZE_T Reserved3; + SIZE_T Reserved4; + DWORD Flags; + DWORD Reserved5; + } QUOTA_LIMITS_EX,*PQUOTA_LIMITS_EX; + + typedef struct _IO_COUNTERS { + ULONGLONG ReadOperationCount; + ULONGLONG WriteOperationCount; + ULONGLONG OtherOperationCount; + ULONGLONG ReadTransferCount; + ULONGLONG WriteTransferCount; + ULONGLONG OtherTransferCount; + } IO_COUNTERS; + typedef IO_COUNTERS *PIO_COUNTERS; + + typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION { + LARGE_INTEGER TotalUserTime; + LARGE_INTEGER TotalKernelTime; + LARGE_INTEGER ThisPeriodTotalUserTime; + LARGE_INTEGER ThisPeriodTotalKernelTime; + DWORD TotalPageFaultCount; + DWORD TotalProcesses; + DWORD ActiveProcesses; + DWORD TotalTerminatedProcesses; + } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION; + + typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION { + LARGE_INTEGER PerProcessUserTimeLimit; + LARGE_INTEGER PerJobUserTimeLimit; + DWORD LimitFlags; + SIZE_T MinimumWorkingSetSize; + SIZE_T MaximumWorkingSetSize; + DWORD ActiveProcessLimit; + ULONG_PTR Affinity; + DWORD PriorityClass; + DWORD SchedulingClass; + } JOBOBJECT_BASIC_LIMIT_INFORMATION,*PJOBOBJECT_BASIC_LIMIT_INFORMATION; + + typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION { + JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; + IO_COUNTERS IoInfo; + SIZE_T ProcessMemoryLimit; + SIZE_T JobMemoryLimit; + SIZE_T PeakProcessMemoryUsed; + SIZE_T PeakJobMemoryUsed; + } JOBOBJECT_EXTENDED_LIMIT_INFORMATION,*PJOBOBJECT_EXTENDED_LIMIT_INFORMATION; + + typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST { + DWORD NumberOfAssignedProcesses; + DWORD NumberOfProcessIdsInList; + ULONG_PTR ProcessIdList[1]; + } JOBOBJECT_BASIC_PROCESS_ID_LIST,*PJOBOBJECT_BASIC_PROCESS_ID_LIST; + + typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS { + DWORD UIRestrictionsClass; + } JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS; + + typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION { + DWORD SecurityLimitFlags; + HANDLE JobToken; + PTOKEN_GROUPS SidsToDisable; + PTOKEN_PRIVILEGES PrivilegesToDelete; + PTOKEN_GROUPS RestrictedSids; + } JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION; + + typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION { + DWORD EndOfJobTimeAction; + } JOBOBJECT_END_OF_JOB_TIME_INFORMATION,*PJOBOBJECT_END_OF_JOB_TIME_INFORMATION; + + typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT { + PVOID CompletionKey; + HANDLE CompletionPort; + } JOBOBJECT_ASSOCIATE_COMPLETION_PORT,*PJOBOBJECT_ASSOCIATE_COMPLETION_PORT; + + typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION { + JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo; + IO_COUNTERS IoInfo; + } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION; + + typedef struct _JOBOBJECT_JOBSET_INFORMATION { + DWORD MemberLevel; + } JOBOBJECT_JOBSET_INFORMATION,*PJOBOBJECT_JOBSET_INFORMATION; + +#define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0 +#define JOB_OBJECT_POST_AT_END_OF_JOB 1 + +#define JOB_OBJECT_MSG_END_OF_JOB_TIME 1 +#define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2 +#define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3 +#define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4 +#define JOB_OBJECT_MSG_NEW_PROCESS 6 +#define JOB_OBJECT_MSG_EXIT_PROCESS 7 +#define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8 +#define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9 +#define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10 + +#define JOB_OBJECT_LIMIT_WORKINGSET 0x00000001 +#define JOB_OBJECT_LIMIT_PROCESS_TIME 0x00000002 +#define JOB_OBJECT_LIMIT_JOB_TIME 0x00000004 +#define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x00000008 +#define JOB_OBJECT_LIMIT_AFFINITY 0x00000010 +#define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x00000020 +#define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x00000040 +#define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x00000080 + +#define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100 +#define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200 +#define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400 +#define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800 +#define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000 +#define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000 + +#define JOB_OBJECT_LIMIT_RESERVED2 0x00004000 +#define JOB_OBJECT_LIMIT_RESERVED3 0x00008000 +#define JOB_OBJECT_LIMIT_RESERVED4 0x00010000 +#define JOB_OBJECT_LIMIT_RESERVED5 0x00020000 +#define JOB_OBJECT_LIMIT_RESERVED6 0x00040000 + +#define JOB_OBJECT_LIMIT_VALID_FLAGS 0x0007ffff + +#define JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS 0x000000ff +#define JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS 0x00003fff +#define JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS 0x0007ffff + +#define JOB_OBJECT_UILIMIT_NONE 0x00000000 + +#define JOB_OBJECT_UILIMIT_HANDLES 0x00000001 +#define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x00000002 +#define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x00000004 +#define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x00000008 +#define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x00000010 +#define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x00000020 +#define JOB_OBJECT_UILIMIT_DESKTOP 0x00000040 +#define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x00000080 + +#define JOB_OBJECT_UILIMIT_ALL 0x000000FF + +#define JOB_OBJECT_UI_VALID_FLAGS 0x000000FF + +#define JOB_OBJECT_SECURITY_NO_ADMIN 0x00000001 +#define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x00000002 +#define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x00000004 +#define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x00000008 + +#define JOB_OBJECT_SECURITY_VALID_FLAGS 0x0000000f + + typedef enum _JOBOBJECTINFOCLASS { + JobObjectBasicAccountingInformation = 1,JobObjectBasicLimitInformation,JobObjectBasicProcessIdList,JobObjectBasicUIRestrictions, + JobObjectSecurityLimitInformation,JobObjectEndOfJobTimeInformation,JobObjectAssociateCompletionPortInformation, + JobObjectBasicAndIoAccountingInformation,JobObjectExtendedLimitInformation,JobObjectJobSetInformation,MaxJobObjectInfoClass + } JOBOBJECTINFOCLASS; + +#define EVENT_MODIFY_STATE 0x0002 +#define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) + +#define MUTANT_QUERY_STATE 0x0001 + +#define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE| MUTANT_QUERY_STATE) +#define SEMAPHORE_MODIFY_STATE 0x0002 +#define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) + +#define TIMER_QUERY_STATE 0x0001 +#define TIMER_MODIFY_STATE 0x0002 + +#define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE| TIMER_QUERY_STATE|TIMER_MODIFY_STATE) + +#define TIME_ZONE_ID_UNKNOWN 0 +#define TIME_ZONE_ID_STANDARD 1 +#define TIME_ZONE_ID_DAYLIGHT 2 + + typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP { + RelationProcessorCore,RelationNumaNode,RelationCache + } LOGICAL_PROCESSOR_RELATIONSHIP; + +#define LTP_PC_SMT 0x1 + + typedef enum _PROCESSOR_CACHE_TYPE { + CacheUnified,CacheInstruction,CacheData,CacheTrace + } PROCESSOR_CACHE_TYPE; + +#define CACHE_FULLY_ASSOCIATIVE 0xFF + + typedef struct _CACHE_DESCRIPTOR { + BYTE Level; + BYTE Associativity; + WORD LineSize; + DWORD Size; + PROCESSOR_CACHE_TYPE Type; + } CACHE_DESCRIPTOR,*PCACHE_DESCRIPTOR; + + typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION { + ULONG_PTR ProcessorMask; + LOGICAL_PROCESSOR_RELATIONSHIP Relationship; + union { + struct { + BYTE Flags; + } ProcessorCore; + struct { + DWORD NodeNumber; + } NumaNode; + CACHE_DESCRIPTOR Cache; + ULONGLONG Reserved[2]; + }; + } SYSTEM_LOGICAL_PROCESSOR_INFORMATION,*PSYSTEM_LOGICAL_PROCESSOR_INFORMATION; + +#define PROCESSOR_INTEL_386 386 +#define PROCESSOR_INTEL_486 486 +#define PROCESSOR_INTEL_PENTIUM 586 +#define PROCESSOR_INTEL_IA64 2200 +#define PROCESSOR_AMD_X8664 8664 +#define PROCESSOR_MIPS_R4000 4000 +#define PROCESSOR_ALPHA_21064 21064 +#define PROCESSOR_PPC_601 601 +#define PROCESSOR_PPC_603 603 +#define PROCESSOR_PPC_604 604 +#define PROCESSOR_PPC_620 620 +#define PROCESSOR_HITACHI_SH3 10003 +#define PROCESSOR_HITACHI_SH3E 10004 +#define PROCESSOR_HITACHI_SH4 10005 +#define PROCESSOR_MOTOROLA_821 821 +#define PROCESSOR_SHx_SH3 103 +#define PROCESSOR_SHx_SH4 104 +#define PROCESSOR_STRONGARM 2577 +#define PROCESSOR_ARM720 1824 +#define PROCESSOR_ARM820 2080 +#define PROCESSOR_ARM920 2336 +#define PROCESSOR_ARM_7TDMI 70001 +#define PROCESSOR_OPTIL 0x494f + +#define PROCESSOR_ARCHITECTURE_INTEL 0 +#define PROCESSOR_ARCHITECTURE_MIPS 1 +#define PROCESSOR_ARCHITECTURE_ALPHA 2 +#define PROCESSOR_ARCHITECTURE_PPC 3 +#define PROCESSOR_ARCHITECTURE_SHX 4 +#define PROCESSOR_ARCHITECTURE_ARM 5 +#define PROCESSOR_ARCHITECTURE_IA64 6 +#define PROCESSOR_ARCHITECTURE_ALPHA64 7 +#define PROCESSOR_ARCHITECTURE_MSIL 8 +#define PROCESSOR_ARCHITECTURE_AMD64 9 +#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10 + +#define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF + +#define PF_FLOATING_POINT_PRECISION_ERRATA 0 +#define PF_FLOATING_POINT_EMULATED 1 +#define PF_COMPARE_EXCHANGE_DOUBLE 2 +#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 +#define PF_PPC_MOVEMEM_64BIT_OK 4 +#define PF_ALPHA_BYTE_INSTRUCTIONS 5 +#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 +#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 +#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 +#define PF_PAE_ENABLED 9 +#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 +#define PF_SSE_DAZ_MODE_AVAILABLE 11 +#define PF_NX_ENABLED 12 + + typedef struct _MEMORY_BASIC_INFORMATION { + PVOID BaseAddress; + PVOID AllocationBase; + DWORD AllocationProtect; + SIZE_T RegionSize; + DWORD State; + DWORD Protect; + DWORD Type; + } MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION; + + typedef struct _MEMORY_BASIC_INFORMATION32 { + DWORD BaseAddress; + DWORD AllocationBase; + DWORD AllocationProtect; + DWORD RegionSize; + DWORD State; + DWORD Protect; + DWORD Type; + } MEMORY_BASIC_INFORMATION32,*PMEMORY_BASIC_INFORMATION32; + + typedef DECLSPEC_ALIGN(16) struct _MEMORY_BASIC_INFORMATION64 { + ULONGLONG BaseAddress; + ULONGLONG AllocationBase; + DWORD AllocationProtect; + DWORD __alignment1; + ULONGLONG RegionSize; + DWORD State; + DWORD Protect; + DWORD Type; + DWORD __alignment2; + } MEMORY_BASIC_INFORMATION64,*PMEMORY_BASIC_INFORMATION64; + +#define SECTION_QUERY 0x0001 +#define SECTION_MAP_WRITE 0x0002 +#define SECTION_MAP_READ 0x0004 +#define SECTION_MAP_EXECUTE 0x0008 +#define SECTION_EXTEND_SIZE 0x0010 +#define SECTION_MAP_EXECUTE_EXPLICIT 0x0020 + +#define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY| SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE) +#define PAGE_NOACCESS 0x01 +#define PAGE_READONLY 0x02 +#define PAGE_READWRITE 0x04 +#define PAGE_WRITECOPY 0x08 +#define PAGE_EXECUTE 0x10 +#define PAGE_EXECUTE_READ 0x20 +#define PAGE_EXECUTE_READWRITE 0x40 +#define PAGE_EXECUTE_WRITECOPY 0x80 +#define PAGE_GUARD 0x100 +#define PAGE_NOCACHE 0x200 +#define PAGE_WRITECOMBINE 0x400 +#define MEM_COMMIT 0x1000 +#define MEM_RESERVE 0x2000 +#define MEM_DECOMMIT 0x4000 +#define MEM_RELEASE 0x8000 +#define MEM_FREE 0x10000 +#define MEM_PRIVATE 0x20000 +#define MEM_MAPPED 0x40000 +#define MEM_RESET 0x80000 +#define MEM_TOP_DOWN 0x100000 +#define MEM_WRITE_WATCH 0x200000 +#define MEM_PHYSICAL 0x400000 +#define MEM_LARGE_PAGES 0x20000000 +#define MEM_4MB_PAGES 0x80000000 +#define SEC_FILE 0x800000 +#define SEC_IMAGE 0x1000000 +#define SEC_RESERVE 0x4000000 +#define SEC_COMMIT 0x8000000 +#define SEC_NOCACHE 0x10000000 +#define SEC_LARGE_PAGES 0x80000000 +#define MEM_IMAGE SEC_IMAGE +#define WRITE_WATCH_FLAG_RESET 0x01 + +#define FILE_READ_DATA (0x0001) +#define FILE_LIST_DIRECTORY (0x0001) + +#define FILE_WRITE_DATA (0x0002) +#define FILE_ADD_FILE (0x0002) + +#define FILE_APPEND_DATA (0x0004) +#define FILE_ADD_SUBDIRECTORY (0x0004) +#define FILE_CREATE_PIPE_INSTANCE (0x0004) + +#define FILE_READ_EA (0x0008) + +#define FILE_WRITE_EA (0x0010) + +#define FILE_EXECUTE (0x0020) +#define FILE_TRAVERSE (0x0020) + +#define FILE_DELETE_CHILD (0x0040) + +#define FILE_READ_ATTRIBUTES (0x0080) + +#define FILE_WRITE_ATTRIBUTES (0x0100) + +#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) +#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE) +#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE) +#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE) + +#define FILE_SHARE_READ 0x00000001 +#define FILE_SHARE_WRITE 0x00000002 +#define FILE_SHARE_DELETE 0x00000004 +#define FILE_ATTRIBUTE_READONLY 0x00000001 +#define FILE_ATTRIBUTE_HIDDEN 0x00000002 +#define FILE_ATTRIBUTE_SYSTEM 0x00000004 +#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 +#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 +#define FILE_ATTRIBUTE_DEVICE 0x00000040 +#define FILE_ATTRIBUTE_NORMAL 0x00000080 +#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 +#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 +#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 +#define FILE_ATTRIBUTE_COMPRESSED 0x00000800 +#define FILE_ATTRIBUTE_OFFLINE 0x00001000 +#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 +#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 +#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 +#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 +#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 +#define FILE_NOTIFY_CHANGE_SIZE 0x00000008 +#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 +#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 +#define FILE_NOTIFY_CHANGE_CREATION 0x00000040 +#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 +#define FILE_ACTION_ADDED 0x00000001 +#define FILE_ACTION_REMOVED 0x00000002 +#define FILE_ACTION_MODIFIED 0x00000003 +#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 +#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 +#define MAILSLOT_NO_MESSAGE ((DWORD)-1) +#define MAILSLOT_WAIT_FOREVER ((DWORD)-1) +#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 +#define FILE_CASE_PRESERVED_NAMES 0x00000002 +#define FILE_UNICODE_ON_DISK 0x00000004 +#define FILE_PERSISTENT_ACLS 0x00000008 +#define FILE_FILE_COMPRESSION 0x00000010 +#define FILE_VOLUME_QUOTAS 0x00000020 +#define FILE_SUPPORTS_SPARSE_FILES 0x00000040 +#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 +#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 +#define FILE_VOLUME_IS_COMPRESSED 0x00008000 +#define FILE_SUPPORTS_OBJECT_IDS 0x00010000 +#define FILE_SUPPORTS_ENCRYPTION 0x00020000 +#define FILE_NAMED_STREAMS 0x00040000 +#define FILE_READ_ONLY_VOLUME 0x00080000 + + typedef struct _FILE_NOTIFY_INFORMATION { + DWORD NextEntryOffset; + DWORD Action; + DWORD FileNameLength; + WCHAR FileName[1]; + } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION; + + typedef union _FILE_SEGMENT_ELEMENT { + PVOID64 Buffer; + ULONGLONG Alignment; + }FILE_SEGMENT_ELEMENT,*PFILE_SEGMENT_ELEMENT; + + typedef struct _REPARSE_GUID_DATA_BUFFER { + DWORD ReparseTag; + WORD ReparseDataLength; + WORD Reserved; + GUID ReparseGuid; + struct { + BYTE DataBuffer[1]; + } GenericReparseBuffer; + } REPARSE_GUID_DATA_BUFFER,*PREPARSE_GUID_DATA_BUFFER; + +#define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER,GenericReparseBuffer) + +#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 *1024) + +#define IO_REPARSE_TAG_RESERVED_ZERO (0) +#define IO_REPARSE_TAG_RESERVED_ONE (1) + +#define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE + +#define IsReparseTagMicrosoft(_tag) (((_tag) & 0x80000000)) +#define IsReparseTagNameSurrogate(_tag) (((_tag) & 0x20000000)) + +#define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L) +#define IO_REPARSE_TAG_HSM (0xC0000004L) +#define IO_REPARSE_TAG_SIS (0x80000007L) +#define IO_REPARSE_TAG_DFS (0x8000000AL) +#define IO_REPARSE_TAG_FILTER_MANAGER (0x8000000BL) +#define IO_COMPLETION_MODIFY_STATE 0x0002 +#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) +#define DUPLICATE_CLOSE_SOURCE 0x00000001 +#define DUPLICATE_SAME_ACCESS 0x00000002 + + typedef enum _SYSTEM_POWER_STATE { + PowerSystemUnspecified = 0,PowerSystemWorking = 1,PowerSystemSleeping1 = 2,PowerSystemSleeping2 = 3,PowerSystemSleeping3 = 4,PowerSystemHibernate = 5,PowerSystemShutdown = 6,PowerSystemMaximum = 7 + } SYSTEM_POWER_STATE,*PSYSTEM_POWER_STATE; + +#define POWER_SYSTEM_MAXIMUM 7 + + typedef enum { + PowerActionNone = 0,PowerActionReserved,PowerActionSleep,PowerActionHibernate,PowerActionShutdown,PowerActionShutdownReset,PowerActionShutdownOff,PowerActionWarmEject + } POWER_ACTION,*PPOWER_ACTION; + + typedef enum _DEVICE_POWER_STATE { + PowerDeviceUnspecified = 0,PowerDeviceD0,PowerDeviceD1,PowerDeviceD2,PowerDeviceD3,PowerDeviceMaximum + } DEVICE_POWER_STATE,*PDEVICE_POWER_STATE; + +#define ES_SYSTEM_REQUIRED ((DWORD)0x00000001) +#define ES_DISPLAY_REQUIRED ((DWORD)0x00000002) +#define ES_USER_PRESENT ((DWORD)0x00000004) +#define ES_CONTINUOUS ((DWORD)0x80000000) + + typedef DWORD EXECUTION_STATE; + + typedef enum { + LT_DONT_CARE,LT_LOWEST_LATENCY + } LATENCY_TIME; + +#define PDCAP_D0_SUPPORTED 0x00000001 +#define PDCAP_D1_SUPPORTED 0x00000002 +#define PDCAP_D2_SUPPORTED 0x00000004 +#define PDCAP_D3_SUPPORTED 0x00000008 +#define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010 +#define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020 +#define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040 +#define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080 +#define PDCAP_WARM_EJECT_SUPPORTED 0x00000100 + + typedef struct CM_Power_Data_s { + DWORD PD_Size; + DEVICE_POWER_STATE PD_MostRecentPowerState; + DWORD PD_Capabilities; + DWORD PD_D1Latency; + DWORD PD_D2Latency; + DWORD PD_D3Latency; + DEVICE_POWER_STATE PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM]; + SYSTEM_POWER_STATE PD_DeepestSystemWake; + } CM_POWER_DATA,*PCM_POWER_DATA; + + typedef enum { + SystemPowerPolicyAc,SystemPowerPolicyDc,VerifySystemPolicyAc,VerifySystemPolicyDc,SystemPowerCapabilities,SystemBatteryState,SystemPowerStateHandler,ProcessorStateHandler,SystemPowerPolicyCurrent,AdministratorPowerPolicy,SystemReserveHiberFile,ProcessorInformation,SystemPowerInformation,ProcessorStateHandler2,LastWakeTime,LastSleepTime,SystemExecutionState,SystemPowerStateNotifyHandler,ProcessorPowerPolicyAc,ProcessorPowerPolicyDc,VerifyProcessorPowerPolicyAc,VerifyProcessorPowerPolicyDc,ProcessorPowerPolicyCurrent,SystemPowerStateLogging,SystemPowerLoggingEntry + } POWER_INFORMATION_LEVEL; + + typedef struct { + DWORD Granularity; + DWORD Capacity; + } BATTERY_REPORTING_SCALE,*PBATTERY_REPORTING_SCALE; + + typedef struct { + POWER_ACTION Action; + DWORD Flags; + DWORD EventCode; + } POWER_ACTION_POLICY,*PPOWER_ACTION_POLICY; + +#define POWER_ACTION_QUERY_ALLOWED 0x00000001 +#define POWER_ACTION_UI_ALLOWED 0x00000002 +#define POWER_ACTION_OVERRIDE_APPS 0x00000004 +#define POWER_ACTION_LIGHTEST_FIRST 0x10000000 +#define POWER_ACTION_LOCK_CONSOLE 0x20000000 +#define POWER_ACTION_DISABLE_WAKES 0x40000000 +#define POWER_ACTION_CRITICAL 0x80000000 + +#define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001 +#define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002 +#define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004 +#define POWER_USER_NOTIFY_BUTTON 0x00000008 +#define POWER_USER_NOTIFY_SHUTDOWN 0x00000010 +#define POWER_FORCE_TRIGGER_RESET 0x80000000 + + typedef struct { + BOOLEAN Enable; + BYTE Spare[3]; + DWORD BatteryLevel; + POWER_ACTION_POLICY PowerPolicy; + SYSTEM_POWER_STATE MinSystemState; + } SYSTEM_POWER_LEVEL,*PSYSTEM_POWER_LEVEL; + +#define NUM_DISCHARGE_POLICIES 4 +#define DISCHARGE_POLICY_CRITICAL 0 +#define DISCHARGE_POLICY_LOW 1 + +#define PO_THROTTLE_NONE 0 +#define PO_THROTTLE_CONSTANT 1 +#define PO_THROTTLE_DEGRADE 2 +#define PO_THROTTLE_ADAPTIVE 3 +#define PO_THROTTLE_MAXIMUM 4 + + typedef struct _SYSTEM_POWER_POLICY { + DWORD Revision; + POWER_ACTION_POLICY PowerButton; + POWER_ACTION_POLICY SleepButton; + POWER_ACTION_POLICY LidClose; + SYSTEM_POWER_STATE LidOpenWake; + DWORD Reserved; + POWER_ACTION_POLICY Idle; + DWORD IdleTimeout; + BYTE IdleSensitivity; + BYTE DynamicThrottle; + BYTE Spare2[2]; + SYSTEM_POWER_STATE MinSleep; + SYSTEM_POWER_STATE MaxSleep; + SYSTEM_POWER_STATE ReducedLatencySleep; + DWORD WinLogonFlags; + DWORD Spare3; + DWORD DozeS4Timeout; + DWORD BroadcastCapacityResolution; + SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES]; + DWORD VideoTimeout; + BOOLEAN VideoDimDisplay; + DWORD VideoReserved[3]; + DWORD SpindownTimeout; + BOOLEAN OptimizeForPower; + BYTE FanThrottleTolerance; + BYTE ForcedThrottle; + BYTE MinThrottle; + POWER_ACTION_POLICY OverThrottled; + } SYSTEM_POWER_POLICY,*PSYSTEM_POWER_POLICY; + + typedef struct _PROCESSOR_POWER_POLICY_INFO { + DWORD TimeCheck; + DWORD DemoteLimit; + DWORD PromoteLimit; + BYTE DemotePercent; + BYTE PromotePercent; + BYTE Spare[2]; + DWORD AllowDemotion:1; + DWORD AllowPromotion:1; + DWORD Reserved:30; + } PROCESSOR_POWER_POLICY_INFO,*PPROCESSOR_POWER_POLICY_INFO; + + typedef struct _PROCESSOR_POWER_POLICY { + DWORD Revision; + BYTE DynamicThrottle; + BYTE Spare[3]; + DWORD DisableCStates:1; + DWORD Reserved:31; + DWORD PolicyCount; + PROCESSOR_POWER_POLICY_INFO Policy[3]; + } PROCESSOR_POWER_POLICY,*PPROCESSOR_POWER_POLICY; + + typedef struct _ADMINISTRATOR_POWER_POLICY { + SYSTEM_POWER_STATE MinSleep; + SYSTEM_POWER_STATE MaxSleep; + DWORD MinVideoTimeout; + DWORD MaxVideoTimeout; + DWORD MinSpindownTimeout; + DWORD MaxSpindownTimeout; + } ADMINISTRATOR_POWER_POLICY,*PADMINISTRATOR_POWER_POLICY; + + typedef struct { + BOOLEAN PowerButtonPresent; + BOOLEAN SleepButtonPresent; + BOOLEAN LidPresent; + BOOLEAN SystemS1; + BOOLEAN SystemS2; + BOOLEAN SystemS3; + BOOLEAN SystemS4; + BOOLEAN SystemS5; + BOOLEAN HiberFilePresent; + BOOLEAN FullWake; + BOOLEAN VideoDimPresent; + BOOLEAN ApmPresent; + BOOLEAN UpsPresent; + BOOLEAN ThermalControl; + BOOLEAN ProcessorThrottle; + BYTE ProcessorMinThrottle; + BYTE ProcessorMaxThrottle; + BYTE spare2[4]; + BOOLEAN DiskSpinDown; + BYTE spare3[8]; + BOOLEAN SystemBatteriesPresent; + BOOLEAN BatteriesAreShortTerm; + BATTERY_REPORTING_SCALE BatteryScale[3]; + SYSTEM_POWER_STATE AcOnLineWake; + SYSTEM_POWER_STATE SoftLidWake; + SYSTEM_POWER_STATE RtcWake; + SYSTEM_POWER_STATE MinDeviceWakeState; + SYSTEM_POWER_STATE DefaultLowLatencyWake; + } SYSTEM_POWER_CAPABILITIES,*PSYSTEM_POWER_CAPABILITIES; + + typedef struct { + BOOLEAN AcOnLine; + BOOLEAN BatteryPresent; + BOOLEAN Charging; + BOOLEAN Discharging; + BOOLEAN Spare1[4]; + DWORD MaxCapacity; + DWORD RemainingCapacity; + DWORD Rate; + DWORD EstimatedTime; + DWORD DefaultAlert1; + DWORD DefaultAlert2; + } SYSTEM_BATTERY_STATE,*PSYSTEM_BATTERY_STATE; + +#include "pshpack4.h" + +#define IMAGE_DOS_SIGNATURE 0x5A4D +#define IMAGE_OS2_SIGNATURE 0x454E +#define IMAGE_OS2_SIGNATURE_LE 0x454C +#define IMAGE_VXD_SIGNATURE 0x454C +#define IMAGE_NT_SIGNATURE 0x00004550 + +#include "pshpack2.h" + + typedef struct _IMAGE_DOS_HEADER { + WORD e_magic; + WORD e_cblp; + WORD e_cp; + WORD e_crlc; + WORD e_cparhdr; + WORD e_minalloc; + WORD e_maxalloc; + WORD e_ss; + WORD e_sp; + WORD e_csum; + WORD e_ip; + WORD e_cs; + WORD e_lfarlc; + WORD e_ovno; + WORD e_res[4]; + WORD e_oemid; + WORD e_oeminfo; + WORD e_res2[10]; + LONG e_lfanew; + } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER; + + typedef struct _IMAGE_OS2_HEADER { + WORD ne_magic; + CHAR ne_ver; + CHAR ne_rev; + WORD ne_enttab; + WORD ne_cbenttab; + LONG ne_crc; + WORD ne_flags; + WORD ne_autodata; + WORD ne_heap; + WORD ne_stack; + LONG ne_csip; + LONG ne_sssp; + WORD ne_cseg; + WORD ne_cmod; + WORD ne_cbnrestab; + WORD ne_segtab; + WORD ne_rsrctab; + WORD ne_restab; + WORD ne_modtab; + WORD ne_imptab; + LONG ne_nrestab; + WORD ne_cmovent; + WORD ne_align; + WORD ne_cres; + BYTE ne_exetyp; + BYTE ne_flagsothers; + WORD ne_pretthunks; + WORD ne_psegrefbytes; + WORD ne_swaparea; + WORD ne_expver; + } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER; + + typedef struct _IMAGE_VXD_HEADER { + WORD e32_magic; + BYTE e32_border; + BYTE e32_worder; + DWORD e32_level; + WORD e32_cpu; + WORD e32_os; + DWORD e32_ver; + DWORD e32_mflags; + DWORD e32_mpages; + DWORD e32_startobj; + DWORD e32_eip; + DWORD e32_stackobj; + DWORD e32_esp; + DWORD e32_pagesize; + DWORD e32_lastpagesize; + DWORD e32_fixupsize; + DWORD e32_fixupsum; + DWORD e32_ldrsize; + DWORD e32_ldrsum; + DWORD e32_objtab; + DWORD e32_objcnt; + DWORD e32_objmap; + DWORD e32_itermap; + DWORD e32_rsrctab; + DWORD e32_rsrccnt; + DWORD e32_restab; + DWORD e32_enttab; + DWORD e32_dirtab; + DWORD e32_dircnt; + DWORD e32_fpagetab; + DWORD e32_frectab; + DWORD e32_impmod; + DWORD e32_impmodcnt; + DWORD e32_impproc; + DWORD e32_pagesum; + DWORD e32_datapage; + DWORD e32_preload; + DWORD e32_nrestab; + DWORD e32_cbnrestab; + DWORD e32_nressum; + DWORD e32_autodata; + DWORD e32_debuginfo; + DWORD e32_debuglen; + DWORD e32_instpreload; + DWORD e32_instdemand; + DWORD e32_heapsize; + BYTE e32_res3[12]; + DWORD e32_winresoff; + DWORD e32_winreslen; + WORD e32_devid; + WORD e32_ddkver; + } IMAGE_VXD_HEADER,*PIMAGE_VXD_HEADER; + +#include "poppack.h" + + typedef struct _IMAGE_FILE_HEADER { + WORD Machine; + WORD NumberOfSections; + DWORD TimeDateStamp; + DWORD PointerToSymbolTable; + DWORD NumberOfSymbols; + WORD SizeOfOptionalHeader; + WORD Characteristics; + } IMAGE_FILE_HEADER,*PIMAGE_FILE_HEADER; + +#define IMAGE_SIZEOF_FILE_HEADER 20 + +#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 +#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 +#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 +#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 +#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010 +#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 +#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 +#define IMAGE_FILE_32BIT_MACHINE 0x0100 +#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 +#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400 +#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800 +#define IMAGE_FILE_SYSTEM 0x1000 +#define IMAGE_FILE_DLL 0x2000 +#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000 +#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 + +#define IMAGE_FILE_MACHINE_UNKNOWN 0 +#define IMAGE_FILE_MACHINE_I386 0x014c +#define IMAGE_FILE_MACHINE_R3000 0x0162 +#define IMAGE_FILE_MACHINE_R4000 0x0166 +#define IMAGE_FILE_MACHINE_R10000 0x0168 +#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 +#define IMAGE_FILE_MACHINE_ALPHA 0x0184 +#define IMAGE_FILE_MACHINE_SH3 0x01a2 +#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3 +#define IMAGE_FILE_MACHINE_SH3E 0x01a4 +#define IMAGE_FILE_MACHINE_SH4 0x01a6 +#define IMAGE_FILE_MACHINE_SH5 0x01a8 +#define IMAGE_FILE_MACHINE_ARM 0x01c0 +#define IMAGE_FILE_MACHINE_THUMB 0x01c2 +#define IMAGE_FILE_MACHINE_AM33 0x01d3 +#define IMAGE_FILE_MACHINE_POWERPC 0x01F0 +#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 +#define IMAGE_FILE_MACHINE_IA64 0x0200 +#define IMAGE_FILE_MACHINE_MIPS16 0x0266 +#define IMAGE_FILE_MACHINE_ALPHA64 0x0284 +#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 +#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 +#define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64 +#define IMAGE_FILE_MACHINE_TRICORE 0x0520 +#define IMAGE_FILE_MACHINE_CEF 0x0CEF +#define IMAGE_FILE_MACHINE_EBC 0x0EBC +#define IMAGE_FILE_MACHINE_AMD64 0x8664 +#define IMAGE_FILE_MACHINE_M32R 0x9041 +#define IMAGE_FILE_MACHINE_CEE 0xC0EE + + typedef struct _IMAGE_DATA_DIRECTORY { + DWORD VirtualAddress; + DWORD Size; + } IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY; + +#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 + + typedef struct _IMAGE_OPTIONAL_HEADER { + + WORD Magic; + BYTE MajorLinkerVersion; + BYTE MinorLinkerVersion; + DWORD SizeOfCode; + DWORD SizeOfInitializedData; + DWORD SizeOfUninitializedData; + DWORD AddressOfEntryPoint; + DWORD BaseOfCode; + DWORD BaseOfData; + DWORD ImageBase; + DWORD SectionAlignment; + DWORD FileAlignment; + WORD MajorOperatingSystemVersion; + WORD MinorOperatingSystemVersion; + WORD MajorImageVersion; + WORD MinorImageVersion; + WORD MajorSubsystemVersion; + WORD MinorSubsystemVersion; + DWORD Win32VersionValue; + DWORD SizeOfImage; + DWORD SizeOfHeaders; + DWORD CheckSum; + WORD Subsystem; + WORD DllCharacteristics; + DWORD SizeOfStackReserve; + DWORD SizeOfStackCommit; + DWORD SizeOfHeapReserve; + DWORD SizeOfHeapCommit; + DWORD LoaderFlags; + DWORD NumberOfRvaAndSizes; + IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; + } IMAGE_OPTIONAL_HEADER32,*PIMAGE_OPTIONAL_HEADER32; + + typedef struct _IMAGE_ROM_OPTIONAL_HEADER { + WORD Magic; + BYTE MajorLinkerVersion; + BYTE MinorLinkerVersion; + DWORD SizeOfCode; + DWORD SizeOfInitializedData; + DWORD SizeOfUninitializedData; + DWORD AddressOfEntryPoint; + DWORD BaseOfCode; + DWORD BaseOfData; + DWORD BaseOfBss; + DWORD GprMask; + DWORD CprMask[4]; + DWORD GpValue; + } IMAGE_ROM_OPTIONAL_HEADER,*PIMAGE_ROM_OPTIONAL_HEADER; + + typedef struct _IMAGE_OPTIONAL_HEADER64 { + WORD Magic; + BYTE MajorLinkerVersion; + BYTE MinorLinkerVersion; + DWORD SizeOfCode; + DWORD SizeOfInitializedData; + DWORD SizeOfUninitializedData; + DWORD AddressOfEntryPoint; + DWORD BaseOfCode; + ULONGLONG ImageBase; + DWORD SectionAlignment; + DWORD FileAlignment; + WORD MajorOperatingSystemVersion; + WORD MinorOperatingSystemVersion; + WORD MajorImageVersion; + WORD MinorImageVersion; + WORD MajorSubsystemVersion; + WORD MinorSubsystemVersion; + DWORD Win32VersionValue; + DWORD SizeOfImage; + DWORD SizeOfHeaders; + DWORD CheckSum; + WORD Subsystem; + WORD DllCharacteristics; + ULONGLONG SizeOfStackReserve; + ULONGLONG SizeOfStackCommit; + ULONGLONG SizeOfHeapReserve; + ULONGLONG SizeOfHeapCommit; + DWORD LoaderFlags; + DWORD NumberOfRvaAndSizes; + IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; + } IMAGE_OPTIONAL_HEADER64,*PIMAGE_OPTIONAL_HEADER64; + +#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 +#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 +#define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224 +#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240 + +#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b +#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b +#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 + +#ifdef _WIN64 + typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER; + typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER; +#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER +#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC +#else + typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER; + typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER; +#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER +#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC +#endif + + typedef struct _IMAGE_NT_HEADERS64 { + DWORD Signature; + IMAGE_FILE_HEADER FileHeader; + IMAGE_OPTIONAL_HEADER64 OptionalHeader; + } IMAGE_NT_HEADERS64,*PIMAGE_NT_HEADERS64; + + typedef struct _IMAGE_NT_HEADERS { + DWORD Signature; + IMAGE_FILE_HEADER FileHeader; + IMAGE_OPTIONAL_HEADER32 OptionalHeader; + } IMAGE_NT_HEADERS32,*PIMAGE_NT_HEADERS32; + + typedef struct _IMAGE_ROM_HEADERS { + IMAGE_FILE_HEADER FileHeader; + IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; + } IMAGE_ROM_HEADERS,*PIMAGE_ROM_HEADERS; + +#ifdef _WIN64 + typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS; + typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS; +#else + typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS; + typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS; +#endif + +#define IMAGE_FIRST_SECTION(ntheader) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)ntheader + FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader) + ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader)) + +#define IMAGE_SUBSYSTEM_UNKNOWN 0 +#define IMAGE_SUBSYSTEM_NATIVE 1 +#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 +#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 +#define IMAGE_SUBSYSTEM_OS2_CUI 5 +#define IMAGE_SUBSYSTEM_POSIX_CUI 7 +#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 +#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 +#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 +#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 +#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 +#define IMAGE_SUBSYSTEM_EFI_ROM 13 +#define IMAGE_SUBSYSTEM_XBOX 14 + +#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200 +#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400 +#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 +#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 +#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 + +#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 +#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 +#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 +#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 +#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 +#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 +#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 + +#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7 +#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 +#define IMAGE_DIRECTORY_ENTRY_TLS 9 +#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 +#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 +#define IMAGE_DIRECTORY_ENTRY_IAT 12 +#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13 +#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 + + typedef struct ANON_OBJECT_HEADER { + WORD Sig1; + WORD Sig2; + WORD Version; + WORD Machine; + DWORD TimeDateStamp; + CLSID ClassID; + DWORD SizeOfData; + } ANON_OBJECT_HEADER; + +#define IMAGE_SIZEOF_SHORT_NAME 8 + + typedef struct _IMAGE_SECTION_HEADER { + BYTE Name[IMAGE_SIZEOF_SHORT_NAME]; + union { + DWORD PhysicalAddress; + DWORD VirtualSize; + } Misc; + DWORD VirtualAddress; + DWORD SizeOfRawData; + DWORD PointerToRawData; + DWORD PointerToRelocations; + DWORD PointerToLinenumbers; + WORD NumberOfRelocations; + WORD NumberOfLinenumbers; + DWORD Characteristics; + } IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER; + +#define IMAGE_SIZEOF_SECTION_HEADER 40 + +#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 + +#define IMAGE_SCN_CNT_CODE 0x00000020 +#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 +#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 +#define IMAGE_SCN_LNK_OTHER 0x00000100 +#define IMAGE_SCN_LNK_INFO 0x00000200 +#define IMAGE_SCN_LNK_REMOVE 0x00000800 +#define IMAGE_SCN_LNK_COMDAT 0x00001000 +#define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000 +#define IMAGE_SCN_GPREL 0x00008000 +#define IMAGE_SCN_MEM_FARDATA 0x00008000 +#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 +#define IMAGE_SCN_MEM_16BIT 0x00020000 +#define IMAGE_SCN_MEM_LOCKED 0x00040000 +#define IMAGE_SCN_MEM_PRELOAD 0x00080000 + +#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 +#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 +#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 +#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 +#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 +#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 +#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 +#define IMAGE_SCN_ALIGN_128BYTES 0x00800000 +#define IMAGE_SCN_ALIGN_256BYTES 0x00900000 +#define IMAGE_SCN_ALIGN_512BYTES 0x00A00000 +#define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000 +#define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000 +#define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000 +#define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000 + +#define IMAGE_SCN_ALIGN_MASK 0x00F00000 + +#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 +#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 +#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 +#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 +#define IMAGE_SCN_MEM_SHARED 0x10000000 +#define IMAGE_SCN_MEM_EXECUTE 0x20000000 +#define IMAGE_SCN_MEM_READ 0x40000000 +#define IMAGE_SCN_MEM_WRITE 0x80000000 + +#define IMAGE_SCN_SCALE_INDEX 0x00000001 + +#include "pshpack2.h" + + typedef struct _IMAGE_SYMBOL { + union { + BYTE ShortName[8]; + struct { + DWORD Short; + DWORD Long; + } Name; + DWORD LongName[2]; + } N; + DWORD Value; + SHORT SectionNumber; + WORD Type; + BYTE StorageClass; + BYTE NumberOfAuxSymbols; + } IMAGE_SYMBOL; + typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL; + +#define IMAGE_SIZEOF_SYMBOL 18 + +#define IMAGE_SYM_UNDEFINED (SHORT)0 +#define IMAGE_SYM_ABSOLUTE (SHORT)-1 +#define IMAGE_SYM_DEBUG (SHORT)-2 +#define IMAGE_SYM_SECTION_MAX 0xFEFF + +#define IMAGE_SYM_TYPE_NULL 0x0000 +#define IMAGE_SYM_TYPE_VOID 0x0001 +#define IMAGE_SYM_TYPE_CHAR 0x0002 +#define IMAGE_SYM_TYPE_SHORT 0x0003 +#define IMAGE_SYM_TYPE_INT 0x0004 +#define IMAGE_SYM_TYPE_LONG 0x0005 +#define IMAGE_SYM_TYPE_FLOAT 0x0006 +#define IMAGE_SYM_TYPE_DOUBLE 0x0007 +#define IMAGE_SYM_TYPE_STRUCT 0x0008 +#define IMAGE_SYM_TYPE_UNION 0x0009 +#define IMAGE_SYM_TYPE_ENUM 0x000A +#define IMAGE_SYM_TYPE_MOE 0x000B +#define IMAGE_SYM_TYPE_BYTE 0x000C +#define IMAGE_SYM_TYPE_WORD 0x000D +#define IMAGE_SYM_TYPE_UINT 0x000E +#define IMAGE_SYM_TYPE_DWORD 0x000F +#define IMAGE_SYM_TYPE_PCODE 0x8000 + +#define IMAGE_SYM_DTYPE_NULL 0 +#define IMAGE_SYM_DTYPE_POINTER 1 +#define IMAGE_SYM_DTYPE_FUNCTION 2 +#define IMAGE_SYM_DTYPE_ARRAY 3 + +#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE)-1 +#define IMAGE_SYM_CLASS_NULL 0x0000 +#define IMAGE_SYM_CLASS_AUTOMATIC 0x0001 +#define IMAGE_SYM_CLASS_EXTERNAL 0x0002 +#define IMAGE_SYM_CLASS_STATIC 0x0003 +#define IMAGE_SYM_CLASS_REGISTER 0x0004 +#define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005 +#define IMAGE_SYM_CLASS_LABEL 0x0006 +#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007 +#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008 +#define IMAGE_SYM_CLASS_ARGUMENT 0x0009 +#define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A +#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B +#define IMAGE_SYM_CLASS_UNION_TAG 0x000C +#define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D +#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E +#define IMAGE_SYM_CLASS_ENUM_TAG 0x000F +#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010 +#define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011 +#define IMAGE_SYM_CLASS_BIT_FIELD 0x0012 +#define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044 +#define IMAGE_SYM_CLASS_BLOCK 0x0064 +#define IMAGE_SYM_CLASS_FUNCTION 0x0065 +#define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066 +#define IMAGE_SYM_CLASS_FILE 0x0067 +#define IMAGE_SYM_CLASS_SECTION 0x0068 +#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069 +#define IMAGE_SYM_CLASS_CLR_TOKEN 0x006B + +#define N_BTMASK 0x000F +#define N_TMASK 0x0030 +#define N_TMASK1 0x00C0 +#define N_TMASK2 0x00F0 +#define N_BTSHFT 4 +#define N_TSHIFT 2 + +#define BTYPE(x) ((x) & N_BTMASK) + +#ifndef ISPTR +#define ISPTR(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_POINTER << N_BTSHFT)) +#endif + +#ifndef ISFCN +#define ISFCN(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT)) +#endif + +#ifndef ISARY +#define ISARY(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT)) +#endif + +#ifndef ISTAG +#define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG) +#endif + +#ifndef INCREF +#define INCREF(x) ((((x)&~N_BTMASK)<>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) +#endif + + typedef union _IMAGE_AUX_SYMBOL { + struct { + DWORD TagIndex; + union { + struct { + WORD Linenumber; + WORD Size; + } LnSz; + DWORD TotalSize; + } Misc; + union { + struct { + DWORD PointerToLinenumber; + DWORD PointerToNextFunction; + } Function; + struct { + WORD Dimension[4]; + } Array; + } FcnAry; + WORD TvIndex; + } Sym; + struct { + BYTE Name[IMAGE_SIZEOF_SYMBOL]; + } File; + struct { + DWORD Length; + WORD NumberOfRelocations; + WORD NumberOfLinenumbers; + DWORD CheckSum; + SHORT Number; + BYTE Selection; + } Section; + } IMAGE_AUX_SYMBOL; + typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL; + +#define IMAGE_SIZEOF_AUX_SYMBOL 18 + + typedef enum IMAGE_AUX_SYMBOL_TYPE { + IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1 + } IMAGE_AUX_SYMBOL_TYPE; + +#include + + typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF { + BYTE bAuxType; + BYTE bReserved; + DWORD SymbolTableIndex; + BYTE rgbReserved[12]; + } IMAGE_AUX_SYMBOL_TOKEN_DEF; + + typedef IMAGE_AUX_SYMBOL_TOKEN_DEF UNALIGNED *PIMAGE_AUX_SYMBOL_TOKEN_DEF; + +#include + +#define IMAGE_COMDAT_SELECT_NODUPLICATES 1 +#define IMAGE_COMDAT_SELECT_ANY 2 +#define IMAGE_COMDAT_SELECT_SAME_SIZE 3 +#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 +#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 +#define IMAGE_COMDAT_SELECT_LARGEST 6 +#define IMAGE_COMDAT_SELECT_NEWEST 7 + +#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 +#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 +#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 + + typedef struct _IMAGE_RELOCATION { + union { + DWORD VirtualAddress; + DWORD RelocCount; + }; + DWORD SymbolTableIndex; + WORD Type; + } IMAGE_RELOCATION; + typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION; + +#define IMAGE_SIZEOF_RELOCATION 10 + +#define IMAGE_REL_I386_ABSOLUTE 0x0000 +#define IMAGE_REL_I386_DIR16 0x0001 +#define IMAGE_REL_I386_REL16 0x0002 +#define IMAGE_REL_I386_DIR32 0x0006 +#define IMAGE_REL_I386_DIR32NB 0x0007 +#define IMAGE_REL_I386_SEG12 0x0009 +#define IMAGE_REL_I386_SECTION 0x000A +#define IMAGE_REL_I386_SECREL 0x000B +#define IMAGE_REL_I386_TOKEN 0x000C +#define IMAGE_REL_I386_SECREL7 0x000D +#define IMAGE_REL_I386_REL32 0x0014 + +#define IMAGE_REL_MIPS_ABSOLUTE 0x0000 +#define IMAGE_REL_MIPS_REFHALF 0x0001 +#define IMAGE_REL_MIPS_REFWORD 0x0002 +#define IMAGE_REL_MIPS_JMPADDR 0x0003 +#define IMAGE_REL_MIPS_REFHI 0x0004 +#define IMAGE_REL_MIPS_REFLO 0x0005 +#define IMAGE_REL_MIPS_GPREL 0x0006 +#define IMAGE_REL_MIPS_LITERAL 0x0007 +#define IMAGE_REL_MIPS_SECTION 0x000A +#define IMAGE_REL_MIPS_SECREL 0x000B +#define IMAGE_REL_MIPS_SECRELLO 0x000C +#define IMAGE_REL_MIPS_SECRELHI 0x000D +#define IMAGE_REL_MIPS_TOKEN 0x000E +#define IMAGE_REL_MIPS_JMPADDR16 0x0010 +#define IMAGE_REL_MIPS_REFWORDNB 0x0022 +#define IMAGE_REL_MIPS_PAIR 0x0025 + +#define IMAGE_REL_ALPHA_ABSOLUTE 0x0000 +#define IMAGE_REL_ALPHA_REFLONG 0x0001 +#define IMAGE_REL_ALPHA_REFQUAD 0x0002 +#define IMAGE_REL_ALPHA_GPREL32 0x0003 +#define IMAGE_REL_ALPHA_LITERAL 0x0004 +#define IMAGE_REL_ALPHA_LITUSE 0x0005 +#define IMAGE_REL_ALPHA_GPDISP 0x0006 +#define IMAGE_REL_ALPHA_BRADDR 0x0007 +#define IMAGE_REL_ALPHA_HINT 0x0008 +#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009 +#define IMAGE_REL_ALPHA_REFHI 0x000A +#define IMAGE_REL_ALPHA_REFLO 0x000B +#define IMAGE_REL_ALPHA_PAIR 0x000C +#define IMAGE_REL_ALPHA_MATCH 0x000D +#define IMAGE_REL_ALPHA_SECTION 0x000E +#define IMAGE_REL_ALPHA_SECREL 0x000F +#define IMAGE_REL_ALPHA_REFLONGNB 0x0010 +#define IMAGE_REL_ALPHA_SECRELLO 0x0011 +#define IMAGE_REL_ALPHA_SECRELHI 0x0012 +#define IMAGE_REL_ALPHA_REFQ3 0x0013 +#define IMAGE_REL_ALPHA_REFQ2 0x0014 +#define IMAGE_REL_ALPHA_REFQ1 0x0015 +#define IMAGE_REL_ALPHA_GPRELLO 0x0016 +#define IMAGE_REL_ALPHA_GPRELHI 0x0017 + +#define IMAGE_REL_PPC_ABSOLUTE 0x0000 +#define IMAGE_REL_PPC_ADDR64 0x0001 +#define IMAGE_REL_PPC_ADDR32 0x0002 +#define IMAGE_REL_PPC_ADDR24 0x0003 +#define IMAGE_REL_PPC_ADDR16 0x0004 +#define IMAGE_REL_PPC_ADDR14 0x0005 +#define IMAGE_REL_PPC_REL24 0x0006 +#define IMAGE_REL_PPC_REL14 0x0007 +#define IMAGE_REL_PPC_TOCREL16 0x0008 +#define IMAGE_REL_PPC_TOCREL14 0x0009 +#define IMAGE_REL_PPC_ADDR32NB 0x000A +#define IMAGE_REL_PPC_SECREL 0x000B +#define IMAGE_REL_PPC_SECTION 0x000C +#define IMAGE_REL_PPC_IFGLUE 0x000D +#define IMAGE_REL_PPC_IMGLUE 0x000E +#define IMAGE_REL_PPC_SECREL16 0x000F +#define IMAGE_REL_PPC_REFHI 0x0010 +#define IMAGE_REL_PPC_REFLO 0x0011 +#define IMAGE_REL_PPC_PAIR 0x0012 +#define IMAGE_REL_PPC_SECRELLO 0x0013 +#define IMAGE_REL_PPC_SECRELHI 0x0014 +#define IMAGE_REL_PPC_GPREL 0x0015 +#define IMAGE_REL_PPC_TOKEN 0x0016 +#define IMAGE_REL_PPC_TYPEMASK 0x00FF +#define IMAGE_REL_PPC_NEG 0x0100 +#define IMAGE_REL_PPC_BRTAKEN 0x0200 +#define IMAGE_REL_PPC_BRNTAKEN 0x0400 +#define IMAGE_REL_PPC_TOCDEFN 0x0800 + +#define IMAGE_REL_SH3_ABSOLUTE 0x0000 +#define IMAGE_REL_SH3_DIRECT16 0x0001 +#define IMAGE_REL_SH3_DIRECT32 0x0002 +#define IMAGE_REL_SH3_DIRECT8 0x0003 +#define IMAGE_REL_SH3_DIRECT8_WORD 0x0004 +#define IMAGE_REL_SH3_DIRECT8_LONG 0x0005 +#define IMAGE_REL_SH3_DIRECT4 0x0006 +#define IMAGE_REL_SH3_DIRECT4_WORD 0x0007 +#define IMAGE_REL_SH3_DIRECT4_LONG 0x0008 +#define IMAGE_REL_SH3_PCREL8_WORD 0x0009 +#define IMAGE_REL_SH3_PCREL8_LONG 0x000A +#define IMAGE_REL_SH3_PCREL12_WORD 0x000B +#define IMAGE_REL_SH3_STARTOF_SECTION 0x000C +#define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D +#define IMAGE_REL_SH3_SECTION 0x000E +#define IMAGE_REL_SH3_SECREL 0x000F +#define IMAGE_REL_SH3_DIRECT32_NB 0x0010 +#define IMAGE_REL_SH3_GPREL4_LONG 0x0011 +#define IMAGE_REL_SH3_TOKEN 0x0012 + +#define IMAGE_REL_SHM_PCRELPT 0x0013 +#define IMAGE_REL_SHM_REFLO 0x0014 +#define IMAGE_REL_SHM_REFHALF 0x0015 +#define IMAGE_REL_SHM_RELLO 0x0016 +#define IMAGE_REL_SHM_RELHALF 0x0017 +#define IMAGE_REL_SHM_PAIR 0x0018 + +#define IMAGE_REL_SH_NOMODE 0x8000 + +#define IMAGE_REL_ARM_ABSOLUTE 0x0000 +#define IMAGE_REL_ARM_ADDR32 0x0001 +#define IMAGE_REL_ARM_ADDR32NB 0x0002 +#define IMAGE_REL_ARM_BRANCH24 0x0003 +#define IMAGE_REL_ARM_BRANCH11 0x0004 +#define IMAGE_REL_ARM_TOKEN 0x0005 +#define IMAGE_REL_ARM_GPREL12 0x0006 +#define IMAGE_REL_ARM_GPREL7 0x0007 +#define IMAGE_REL_ARM_BLX24 0x0008 +#define IMAGE_REL_ARM_BLX11 0x0009 +#define IMAGE_REL_ARM_SECTION 0x000E +#define IMAGE_REL_ARM_SECREL 0x000F + +#define IMAGE_REL_AM_ABSOLUTE 0x0000 +#define IMAGE_REL_AM_ADDR32 0x0001 +#define IMAGE_REL_AM_ADDR32NB 0x0002 +#define IMAGE_REL_AM_CALL32 0x0003 +#define IMAGE_REL_AM_FUNCINFO 0x0004 +#define IMAGE_REL_AM_REL32_1 0x0005 +#define IMAGE_REL_AM_REL32_2 0x0006 +#define IMAGE_REL_AM_SECREL 0x0007 +#define IMAGE_REL_AM_SECTION 0x0008 +#define IMAGE_REL_AM_TOKEN 0x0009 + +#define IMAGE_REL_AMD64_ABSOLUTE 0x0000 +#define IMAGE_REL_AMD64_ADDR64 0x0001 +#define IMAGE_REL_AMD64_ADDR32 0x0002 +#define IMAGE_REL_AMD64_ADDR32NB 0x0003 +#define IMAGE_REL_AMD64_REL32 0x0004 +#define IMAGE_REL_AMD64_REL32_1 0x0005 +#define IMAGE_REL_AMD64_REL32_2 0x0006 +#define IMAGE_REL_AMD64_REL32_3 0x0007 +#define IMAGE_REL_AMD64_REL32_4 0x0008 +#define IMAGE_REL_AMD64_REL32_5 0x0009 +#define IMAGE_REL_AMD64_SECTION 0x000A +#define IMAGE_REL_AMD64_SECREL 0x000B +#define IMAGE_REL_AMD64_SECREL7 0x000C +#define IMAGE_REL_AMD64_TOKEN 0x000D +#define IMAGE_REL_AMD64_SREL32 0x000E +#define IMAGE_REL_AMD64_PAIR 0x000F +#define IMAGE_REL_AMD64_SSPAN32 0x0010 + +#define IMAGE_REL_IA64_ABSOLUTE 0x0000 +#define IMAGE_REL_IA64_IMM14 0x0001 +#define IMAGE_REL_IA64_IMM22 0x0002 +#define IMAGE_REL_IA64_IMM64 0x0003 +#define IMAGE_REL_IA64_DIR32 0x0004 +#define IMAGE_REL_IA64_DIR64 0x0005 +#define IMAGE_REL_IA64_PCREL21B 0x0006 +#define IMAGE_REL_IA64_PCREL21M 0x0007 +#define IMAGE_REL_IA64_PCREL21F 0x0008 +#define IMAGE_REL_IA64_GPREL22 0x0009 +#define IMAGE_REL_IA64_LTOFF22 0x000A +#define IMAGE_REL_IA64_SECTION 0x000B +#define IMAGE_REL_IA64_SECREL22 0x000C +#define IMAGE_REL_IA64_SECREL64I 0x000D +#define IMAGE_REL_IA64_SECREL32 0x000E + +#define IMAGE_REL_IA64_DIR32NB 0x0010 +#define IMAGE_REL_IA64_SREL14 0x0011 +#define IMAGE_REL_IA64_SREL22 0x0012 +#define IMAGE_REL_IA64_SREL32 0x0013 +#define IMAGE_REL_IA64_UREL32 0x0014 +#define IMAGE_REL_IA64_PCREL60X 0x0015 +#define IMAGE_REL_IA64_PCREL60B 0x0016 +#define IMAGE_REL_IA64_PCREL60F 0x0017 +#define IMAGE_REL_IA64_PCREL60I 0x0018 +#define IMAGE_REL_IA64_PCREL60M 0x0019 +#define IMAGE_REL_IA64_IMMGPREL64 0x001A +#define IMAGE_REL_IA64_TOKEN 0x001B +#define IMAGE_REL_IA64_GPREL32 0x001C +#define IMAGE_REL_IA64_ADDEND 0x001F + +#define IMAGE_REL_CEF_ABSOLUTE 0x0000 +#define IMAGE_REL_CEF_ADDR32 0x0001 +#define IMAGE_REL_CEF_ADDR64 0x0002 +#define IMAGE_REL_CEF_ADDR32NB 0x0003 +#define IMAGE_REL_CEF_SECTION 0x0004 +#define IMAGE_REL_CEF_SECREL 0x0005 +#define IMAGE_REL_CEF_TOKEN 0x0006 + +#define IMAGE_REL_CEE_ABSOLUTE 0x0000 +#define IMAGE_REL_CEE_ADDR32 0x0001 +#define IMAGE_REL_CEE_ADDR64 0x0002 +#define IMAGE_REL_CEE_ADDR32NB 0x0003 +#define IMAGE_REL_CEE_SECTION 0x0004 +#define IMAGE_REL_CEE_SECREL 0x0005 +#define IMAGE_REL_CEE_TOKEN 0x0006 + +#define IMAGE_REL_M32R_ABSOLUTE 0x0000 +#define IMAGE_REL_M32R_ADDR32 0x0001 +#define IMAGE_REL_M32R_ADDR32NB 0x0002 +#define IMAGE_REL_M32R_ADDR24 0x0003 +#define IMAGE_REL_M32R_GPREL16 0x0004 +#define IMAGE_REL_M32R_PCREL24 0x0005 +#define IMAGE_REL_M32R_PCREL16 0x0006 +#define IMAGE_REL_M32R_PCREL8 0x0007 +#define IMAGE_REL_M32R_REFHALF 0x0008 +#define IMAGE_REL_M32R_REFHI 0x0009 +#define IMAGE_REL_M32R_REFLO 0x000A +#define IMAGE_REL_M32R_PAIR 0x000B +#define IMAGE_REL_M32R_SECTION 0x000C +#define IMAGE_REL_M32R_SECREL32 0x000D +#define IMAGE_REL_M32R_TOKEN 0x000E + +#define EXT_IMM64(Value,Address,Size,InstPos,ValPos) Value |= (((ULONGLONG)((*(Address) >> InstPos) & (((ULONGLONG)1 << Size) - 1))) << ValPos) +#define INS_IMM64(Value,Address,Size,InstPos,ValPos) *(PDWORD)Address = (*(PDWORD)Address & ~(((1 << Size) - 1) << InstPos)) | ((DWORD)((((ULONGLONG)Value >> ValPos) & (((ULONGLONG)1 << Size) - 1))) << InstPos) + +#define EMARCH_ENC_I17_IMM7B_INST_WORD_X 3 +#define EMARCH_ENC_I17_IMM7B_SIZE_X 7 +#define EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X 4 +#define EMARCH_ENC_I17_IMM7B_VAL_POS_X 0 + +#define EMARCH_ENC_I17_IMM9D_INST_WORD_X 3 +#define EMARCH_ENC_I17_IMM9D_SIZE_X 9 +#define EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X 18 +#define EMARCH_ENC_I17_IMM9D_VAL_POS_X 7 + +#define EMARCH_ENC_I17_IMM5C_INST_WORD_X 3 +#define EMARCH_ENC_I17_IMM5C_SIZE_X 5 +#define EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X 13 +#define EMARCH_ENC_I17_IMM5C_VAL_POS_X 16 + +#define EMARCH_ENC_I17_IC_INST_WORD_X 3 +#define EMARCH_ENC_I17_IC_SIZE_X 1 +#define EMARCH_ENC_I17_IC_INST_WORD_POS_X 12 +#define EMARCH_ENC_I17_IC_VAL_POS_X 21 + +#define EMARCH_ENC_I17_IMM41a_INST_WORD_X 1 +#define EMARCH_ENC_I17_IMM41a_SIZE_X 10 +#define EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X 14 +#define EMARCH_ENC_I17_IMM41a_VAL_POS_X 22 + +#define EMARCH_ENC_I17_IMM41b_INST_WORD_X 1 +#define EMARCH_ENC_I17_IMM41b_SIZE_X 8 +#define EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X 24 +#define EMARCH_ENC_I17_IMM41b_VAL_POS_X 32 + +#define EMARCH_ENC_I17_IMM41c_INST_WORD_X 2 +#define EMARCH_ENC_I17_IMM41c_SIZE_X 23 +#define EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X 0 +#define EMARCH_ENC_I17_IMM41c_VAL_POS_X 40 + +#define EMARCH_ENC_I17_SIGN_INST_WORD_X 3 +#define EMARCH_ENC_I17_SIGN_SIZE_X 1 +#define EMARCH_ENC_I17_SIGN_INST_WORD_POS_X 27 +#define EMARCH_ENC_I17_SIGN_VAL_POS_X 63 + +#define X3_OPCODE_INST_WORD_X 3 +#define X3_OPCODE_SIZE_X 4 +#define X3_OPCODE_INST_WORD_POS_X 28 +#define X3_OPCODE_SIGN_VAL_POS_X 0 + +#define X3_I_INST_WORD_X 3 +#define X3_I_SIZE_X 1 +#define X3_I_INST_WORD_POS_X 27 +#define X3_I_SIGN_VAL_POS_X 59 + +#define X3_D_WH_INST_WORD_X 3 +#define X3_D_WH_SIZE_X 3 +#define X3_D_WH_INST_WORD_POS_X 24 +#define X3_D_WH_SIGN_VAL_POS_X 0 + +#define X3_IMM20_INST_WORD_X 3 +#define X3_IMM20_SIZE_X 20 +#define X3_IMM20_INST_WORD_POS_X 4 +#define X3_IMM20_SIGN_VAL_POS_X 0 + +#define X3_IMM39_1_INST_WORD_X 2 +#define X3_IMM39_1_SIZE_X 23 +#define X3_IMM39_1_INST_WORD_POS_X 0 +#define X3_IMM39_1_SIGN_VAL_POS_X 36 + +#define X3_IMM39_2_INST_WORD_X 1 +#define X3_IMM39_2_SIZE_X 16 +#define X3_IMM39_2_INST_WORD_POS_X 16 +#define X3_IMM39_2_SIGN_VAL_POS_X 20 + +#define X3_P_INST_WORD_X 3 +#define X3_P_SIZE_X 4 +#define X3_P_INST_WORD_POS_X 0 +#define X3_P_SIGN_VAL_POS_X 0 + +#define X3_TMPLT_INST_WORD_X 0 +#define X3_TMPLT_SIZE_X 4 +#define X3_TMPLT_INST_WORD_POS_X 0 +#define X3_TMPLT_SIGN_VAL_POS_X 0 + +#define X3_BTYPE_QP_INST_WORD_X 2 +#define X3_BTYPE_QP_SIZE_X 9 +#define X3_BTYPE_QP_INST_WORD_POS_X 23 +#define X3_BTYPE_QP_INST_VAL_POS_X 0 + +#define X3_EMPTY_INST_WORD_X 1 +#define X3_EMPTY_SIZE_X 2 +#define X3_EMPTY_INST_WORD_POS_X 14 +#define X3_EMPTY_INST_VAL_POS_X 0 + + typedef struct _IMAGE_LINENUMBER { + union { + DWORD SymbolTableIndex; + DWORD VirtualAddress; + } Type; + WORD Linenumber; + } IMAGE_LINENUMBER; + typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER; + +#define IMAGE_SIZEOF_LINENUMBER 6 + +#include "poppack.h" + + typedef struct _IMAGE_BASE_RELOCATION { + DWORD VirtualAddress; + DWORD SizeOfBlock; + + } IMAGE_BASE_RELOCATION; + typedef IMAGE_BASE_RELOCATION UNALIGNED *PIMAGE_BASE_RELOCATION; + +#define IMAGE_SIZEOF_BASE_RELOCATION 8 + +#define IMAGE_REL_BASED_ABSOLUTE 0 +#define IMAGE_REL_BASED_HIGH 1 +#define IMAGE_REL_BASED_LOW 2 +#define IMAGE_REL_BASED_HIGHLOW 3 +#define IMAGE_REL_BASED_HIGHADJ 4 +#define IMAGE_REL_BASED_MIPS_JMPADDR 5 +#define IMAGE_REL_BASED_MIPS_JMPADDR16 9 +#define IMAGE_REL_BASED_IA64_IMM64 9 +#define IMAGE_REL_BASED_DIR64 10 + +#define IMAGE_ARCHIVE_START_SIZE 8 +#define IMAGE_ARCHIVE_START "!\n" +#define IMAGE_ARCHIVE_END "`\n" +#define IMAGE_ARCHIVE_PAD "\n" +#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " +#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " + + typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { + BYTE Name[16]; + BYTE Date[12]; + BYTE UserID[6]; + BYTE GroupID[6]; + BYTE Mode[8]; + BYTE Size[10]; + BYTE EndHeader[2]; + } IMAGE_ARCHIVE_MEMBER_HEADER,*PIMAGE_ARCHIVE_MEMBER_HEADER; + +#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 + + typedef struct _IMAGE_EXPORT_DIRECTORY { + DWORD Characteristics; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + DWORD Name; + DWORD Base; + DWORD NumberOfFunctions; + DWORD NumberOfNames; + DWORD AddressOfFunctions; + DWORD AddressOfNames; + DWORD AddressOfNameOrdinals; + } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY; + + typedef struct _IMAGE_IMPORT_BY_NAME { + WORD Hint; + BYTE Name[1]; + } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME; + +#include "pshpack8.h" + + typedef struct _IMAGE_THUNK_DATA64 { + union { + ULONGLONG ForwarderString; + ULONGLONG Function; + ULONGLONG Ordinal; + ULONGLONG AddressOfData; + } u1; + } IMAGE_THUNK_DATA64; + typedef IMAGE_THUNK_DATA64 *PIMAGE_THUNK_DATA64; + +#include "poppack.h" + + typedef struct _IMAGE_THUNK_DATA32 { + union { + DWORD ForwarderString; + DWORD Function; + DWORD Ordinal; + DWORD AddressOfData; + } u1; + } IMAGE_THUNK_DATA32; + typedef IMAGE_THUNK_DATA32 *PIMAGE_THUNK_DATA32; + +#define IMAGE_ORDINAL_FLAG64 0x8000000000000000ull +#define IMAGE_ORDINAL_FLAG32 0x80000000 +#define IMAGE_ORDINAL64(Ordinal) (Ordinal & 0xffffull) +#define IMAGE_ORDINAL32(Ordinal) (Ordinal & 0xffff) +#define IMAGE_SNAP_BY_ORDINAL64(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG64)!=0) +#define IMAGE_SNAP_BY_ORDINAL32(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG32)!=0) + + typedef VOID + (NTAPI *PIMAGE_TLS_CALLBACK)(PVOID DllHandle,DWORD Reason,PVOID Reserved); + + typedef struct _IMAGE_TLS_DIRECTORY64 { + ULONGLONG StartAddressOfRawData; + ULONGLONG EndAddressOfRawData; + ULONGLONG AddressOfIndex; + ULONGLONG AddressOfCallBacks; + DWORD SizeOfZeroFill; + DWORD Characteristics; + } IMAGE_TLS_DIRECTORY64; + typedef IMAGE_TLS_DIRECTORY64 *PIMAGE_TLS_DIRECTORY64; + + typedef struct _IMAGE_TLS_DIRECTORY32 { + DWORD StartAddressOfRawData; + DWORD EndAddressOfRawData; + DWORD AddressOfIndex; + DWORD AddressOfCallBacks; + DWORD SizeOfZeroFill; + DWORD Characteristics; + } IMAGE_TLS_DIRECTORY32; + typedef IMAGE_TLS_DIRECTORY32 *PIMAGE_TLS_DIRECTORY32; + +#ifdef _WIN64 +#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64 +#define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal) + typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA; + typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA; +#define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal) + typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY; + typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY; +#else +#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32 +#define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal) + typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA; + typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA; +#define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal) + typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY; + typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY; +#endif + + typedef struct _IMAGE_IMPORT_DESCRIPTOR { + union { + DWORD Characteristics; + DWORD OriginalFirstThunk; + }; + DWORD TimeDateStamp; + + DWORD ForwarderChain; + DWORD Name; + DWORD FirstThunk; + } IMAGE_IMPORT_DESCRIPTOR; + typedef IMAGE_IMPORT_DESCRIPTOR UNALIGNED *PIMAGE_IMPORT_DESCRIPTOR; + + typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR { + DWORD TimeDateStamp; + WORD OffsetModuleName; + WORD NumberOfModuleForwarderRefs; + } IMAGE_BOUND_IMPORT_DESCRIPTOR,*PIMAGE_BOUND_IMPORT_DESCRIPTOR; + + typedef struct _IMAGE_BOUND_FORWARDER_REF { + DWORD TimeDateStamp; + WORD OffsetModuleName; + WORD Reserved; + } IMAGE_BOUND_FORWARDER_REF,*PIMAGE_BOUND_FORWARDER_REF; + + typedef struct _IMAGE_RESOURCE_DIRECTORY { + DWORD Characteristics; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + WORD NumberOfNamedEntries; + WORD NumberOfIdEntries; + } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY; + +#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000 +#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000 + + typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { + union { + struct { + DWORD NameOffset:31; + DWORD NameIsString:1; + }; + DWORD Name; + WORD Id; + }; + union { + DWORD OffsetToData; + struct { + DWORD OffsetToDirectory:31; + DWORD DataIsDirectory:1; + }; + }; + } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY; + + typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING { + WORD Length; + CHAR NameString[1]; + } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING; + + typedef struct _IMAGE_RESOURCE_DIR_STRING_U { + WORD Length; + WCHAR NameString[1]; + } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U; + + typedef struct _IMAGE_RESOURCE_DATA_ENTRY { + DWORD OffsetToData; + DWORD Size; + DWORD CodePage; + DWORD Reserved; + } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY; + + typedef struct { + DWORD Size; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + DWORD GlobalFlagsClear; + DWORD GlobalFlagsSet; + DWORD CriticalSectionDefaultTimeout; + DWORD DeCommitFreeBlockThreshold; + DWORD DeCommitTotalFreeThreshold; + DWORD LockPrefixTable; + DWORD MaximumAllocationSize; + DWORD VirtualMemoryThreshold; + DWORD ProcessHeapFlags; + DWORD ProcessAffinityMask; + WORD CSDVersion; + WORD Reserved1; + DWORD EditList; + DWORD SecurityCookie; + DWORD SEHandlerTable; + DWORD SEHandlerCount; + } IMAGE_LOAD_CONFIG_DIRECTORY32,*PIMAGE_LOAD_CONFIG_DIRECTORY32; + + typedef struct { + DWORD Size; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + DWORD GlobalFlagsClear; + DWORD GlobalFlagsSet; + DWORD CriticalSectionDefaultTimeout; + ULONGLONG DeCommitFreeBlockThreshold; + ULONGLONG DeCommitTotalFreeThreshold; + ULONGLONG LockPrefixTable; + ULONGLONG MaximumAllocationSize; + ULONGLONG VirtualMemoryThreshold; + ULONGLONG ProcessAffinityMask; + DWORD ProcessHeapFlags; + WORD CSDVersion; + WORD Reserved1; + ULONGLONG EditList; + ULONGLONG SecurityCookie; + ULONGLONG SEHandlerTable; + ULONGLONG SEHandlerCount; + } IMAGE_LOAD_CONFIG_DIRECTORY64,*PIMAGE_LOAD_CONFIG_DIRECTORY64; + +#ifdef _WIN64 + typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY; + typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY; +#else + typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY; + typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY; +#endif + + typedef struct _IMAGE_CE_RUNTIME_FUNCTION_ENTRY { + DWORD FuncStart; + DWORD PrologLen : 8; + DWORD FuncLen : 22; + DWORD ThirtyTwoBit : 1; + DWORD ExceptionFlag : 1; + } IMAGE_CE_RUNTIME_FUNCTION_ENTRY,*PIMAGE_CE_RUNTIME_FUNCTION_ENTRY; + + typedef struct _IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY { + ULONGLONG BeginAddress; + ULONGLONG EndAddress; + ULONGLONG ExceptionHandler; + ULONGLONG HandlerData; + ULONGLONG PrologEndAddress; + } IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY,*PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY; + + typedef struct _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY { + DWORD BeginAddress; + DWORD EndAddress; + DWORD ExceptionHandler; + DWORD HandlerData; + DWORD PrologEndAddress; + } IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY,*PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY; + + typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY { + DWORD BeginAddress; + DWORD EndAddress; + DWORD UnwindInfoAddress; + } _IMAGE_RUNTIME_FUNCTION_ENTRY,*_PIMAGE_RUNTIME_FUNCTION_ENTRY; + + typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_IA64_RUNTIME_FUNCTION_ENTRY; + typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY; + + typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_RUNTIME_FUNCTION_ENTRY; + typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_RUNTIME_FUNCTION_ENTRY; + + typedef struct _IMAGE_DEBUG_DIRECTORY { + DWORD Characteristics; + DWORD TimeDateStamp; + WORD MajorVersion; + WORD MinorVersion; + DWORD Type; + DWORD SizeOfData; + DWORD AddressOfRawData; + DWORD PointerToRawData; + } IMAGE_DEBUG_DIRECTORY,*PIMAGE_DEBUG_DIRECTORY; + +#define IMAGE_DEBUG_TYPE_UNKNOWN 0 +#define IMAGE_DEBUG_TYPE_COFF 1 +#define IMAGE_DEBUG_TYPE_CODEVIEW 2 +#define IMAGE_DEBUG_TYPE_FPO 3 +#define IMAGE_DEBUG_TYPE_MISC 4 +#define IMAGE_DEBUG_TYPE_EXCEPTION 5 +#define IMAGE_DEBUG_TYPE_FIXUP 6 +#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7 +#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8 +#define IMAGE_DEBUG_TYPE_BORLAND 9 +#define IMAGE_DEBUG_TYPE_RESERVED10 10 +#define IMAGE_DEBUG_TYPE_CLSID 11 + + typedef struct _IMAGE_COFF_SYMBOLS_HEADER { + DWORD NumberOfSymbols; + DWORD LvaToFirstSymbol; + DWORD NumberOfLinenumbers; + DWORD LvaToFirstLinenumber; + DWORD RvaToFirstByteOfCode; + DWORD RvaToLastByteOfCode; + DWORD RvaToFirstByteOfData; + DWORD RvaToLastByteOfData; + } IMAGE_COFF_SYMBOLS_HEADER,*PIMAGE_COFF_SYMBOLS_HEADER; + +#define FRAME_FPO 0 +#define FRAME_TRAP 1 +#define FRAME_TSS 2 +#define FRAME_NONFPO 3 + + typedef struct _FPO_DATA { + DWORD ulOffStart; + DWORD cbProcSize; + DWORD cdwLocals; + WORD cdwParams; + WORD cbProlog : 8; + WORD cbRegs : 3; + WORD fHasSEH : 1; + WORD fUseBP : 1; + WORD reserved : 1; + WORD cbFrame : 2; + } FPO_DATA,*PFPO_DATA; +#define SIZEOF_RFPO_DATA 16 + +#define IMAGE_DEBUG_MISC_EXENAME 1 + + typedef struct _IMAGE_DEBUG_MISC { + DWORD DataType; + DWORD Length; + BOOLEAN Unicode; + BYTE Reserved[3]; + BYTE Data[1]; + } IMAGE_DEBUG_MISC,*PIMAGE_DEBUG_MISC; + + typedef struct _IMAGE_FUNCTION_ENTRY { + DWORD StartingAddress; + DWORD EndingAddress; + DWORD EndOfPrologue; + } IMAGE_FUNCTION_ENTRY,*PIMAGE_FUNCTION_ENTRY; + + typedef struct _IMAGE_FUNCTION_ENTRY64 { + ULONGLONG StartingAddress; + ULONGLONG EndingAddress; + union { + ULONGLONG EndOfPrologue; + ULONGLONG UnwindInfoAddress; + }; + } IMAGE_FUNCTION_ENTRY64,*PIMAGE_FUNCTION_ENTRY64; + + typedef struct _IMAGE_SEPARATE_DEBUG_HEADER { + WORD Signature; + WORD Flags; + WORD Machine; + WORD Characteristics; + DWORD TimeDateStamp; + DWORD CheckSum; + DWORD ImageBase; + DWORD SizeOfImage; + DWORD NumberOfSections; + DWORD ExportedNamesSize; + DWORD DebugDirectorySize; + DWORD SectionAlignment; + DWORD Reserved[2]; + } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER; + + typedef struct _NON_PAGED_DEBUG_INFO { + WORD Signature; + WORD Flags; + DWORD Size; + WORD Machine; + WORD Characteristics; + DWORD TimeDateStamp; + DWORD CheckSum; + DWORD SizeOfImage; + ULONGLONG ImageBase; + + } NON_PAGED_DEBUG_INFO,*PNON_PAGED_DEBUG_INFO; + +#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944 +#define NON_PAGED_DEBUG_SIGNATURE 0x494E + +#define IMAGE_SEPARATE_DEBUG_FLAGS_MASK 0x8000 +#define IMAGE_SEPARATE_DEBUG_MISMATCH 0x8000 + + typedef struct _ImageArchitectureHeader { + unsigned int AmaskValue: 1; + int Adummy1 :7; + unsigned int AmaskShift: 8; + int Adummy2 :16; + DWORD FirstEntryRVA; + } IMAGE_ARCHITECTURE_HEADER,*PIMAGE_ARCHITECTURE_HEADER; + + typedef struct _ImageArchitectureEntry { + DWORD FixupInstRVA; + DWORD NewInst; + } IMAGE_ARCHITECTURE_ENTRY,*PIMAGE_ARCHITECTURE_ENTRY; + +#include "poppack.h" + +#define IMPORT_OBJECT_HDR_SIG2 0xffff + + typedef struct IMPORT_OBJECT_HEADER { + WORD Sig1; + WORD Sig2; + WORD Version; + WORD Machine; + DWORD TimeDateStamp; + DWORD SizeOfData; + union { + WORD Ordinal; + WORD Hint; + }; + WORD Type : 2; + WORD NameType : 3; + WORD Reserved : 11; + } IMPORT_OBJECT_HEADER; + + typedef enum IMPORT_OBJECT_TYPE { + IMPORT_OBJECT_CODE = 0,IMPORT_OBJECT_DATA = 1,IMPORT_OBJECT_CONST = 2 + } IMPORT_OBJECT_TYPE; + + typedef enum IMPORT_OBJECT_NAME_TYPE { + IMPORT_OBJECT_ORDINAL = 0,IMPORT_OBJECT_NAME = 1,IMPORT_OBJECT_NAME_NO_PREFIX = 2,IMPORT_OBJECT_NAME_UNDECORATE = 3 + } IMPORT_OBJECT_NAME_TYPE; + +#ifndef __IMAGE_COR20_HEADER_DEFINED__ +#define __IMAGE_COR20_HEADER_DEFINED__ + typedef enum ReplacesCorHdrNumericDefines { + COMIMAGE_FLAGS_ILONLY =0x00000001,COMIMAGE_FLAGS_32BITREQUIRED =0x00000002,COMIMAGE_FLAGS_IL_LIBRARY =0x00000004, + COMIMAGE_FLAGS_STRONGNAMESIGNED =0x00000008,COMIMAGE_FLAGS_TRACKDEBUGDATA =0x00010000,COR_VERSION_MAJOR_V2 =2, + COR_VERSION_MAJOR =COR_VERSION_MAJOR_V2,COR_VERSION_MINOR =0,COR_DELETED_NAME_LENGTH =8,COR_VTABLEGAP_NAME_LENGTH =8, + NATIVE_TYPE_MAX_CB =1,COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE=0xFF,IMAGE_COR_MIH_METHODRVA =0x01,IMAGE_COR_MIH_EHRVA =0x02, + IMAGE_COR_MIH_BASICBLOCK =0x08,COR_VTABLE_32BIT =0x01,COR_VTABLE_64BIT =0x02,COR_VTABLE_FROM_UNMANAGED =0x04, + COR_VTABLE_CALL_MOST_DERIVED =0x10,IMAGE_COR_EATJ_THUNK_SIZE =32,MAX_CLASS_NAME =1024,MAX_PACKAGE_NAME =1024 + } ReplacesCorHdrNumericDefines; + + typedef struct IMAGE_COR20_HEADER { + DWORD cb; + WORD MajorRuntimeVersion; + WORD MinorRuntimeVersion; + IMAGE_DATA_DIRECTORY MetaData; + DWORD Flags; + DWORD EntryPointToken; + IMAGE_DATA_DIRECTORY Resources; + IMAGE_DATA_DIRECTORY StrongNameSignature; + IMAGE_DATA_DIRECTORY CodeManagerTable; + IMAGE_DATA_DIRECTORY VTableFixups; + IMAGE_DATA_DIRECTORY ExportAddressTableJumps; + IMAGE_DATA_DIRECTORY ManagedNativeHeader; + } IMAGE_COR20_HEADER,*PIMAGE_COR20_HEADER; +#endif + +#if defined (__x86_64) + NTSYSAPI PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry (DWORD64 ControlPc, PDWORD64 ImageBase, PUNWIND_HISTORY_TABLE HistoryTable); + NTSYSAPI VOID NTAPI RtlUnwindEx (PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable); +#endif + +#include + +#ifndef _SLIST_HEADER_ +#define _SLIST_HEADER_ + +#ifdef _WIN64 + typedef struct _SLIST_ENTRY *PSLIST_ENTRY; + typedef DECLSPEC_ALIGN(16) struct _SLIST_ENTRY { + PSLIST_ENTRY Next; + } SLIST_ENTRY; +#else + +#define SLIST_ENTRY SINGLE_LIST_ENTRY +#define _SLIST_ENTRY _SINGLE_LIST_ENTRY +#define PSLIST_ENTRY PSINGLE_LIST_ENTRY +#endif + +#if defined(_WIN64) + + typedef DECLSPEC_ALIGN(16) struct _SLIST_HEADER { + ULONGLONG Alignment; + ULONGLONG Region; + } SLIST_HEADER; + + typedef struct _SLIST_HEADER *PSLIST_HEADER; +#else + + typedef union _SLIST_HEADER { + ULONGLONG Alignment; + struct { + SLIST_ENTRY Next; + WORD Depth; + WORD Sequence; + }; + } SLIST_HEADER,*PSLIST_HEADER; +#endif +#endif + + NTSYSAPI VOID NTAPI RtlInitializeSListHead(PSLIST_HEADER ListHead); + NTSYSAPI PSLIST_ENTRY NTAPI RtlFirstEntrySList(const SLIST_HEADER *ListHead); + NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedPopEntrySList(PSLIST_HEADER ListHead); + NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedPushEntrySList(PSLIST_HEADER ListHead,PSLIST_ENTRY ListEntry); + NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedFlushSList(PSLIST_HEADER ListHead); + NTSYSAPI WORD NTAPI RtlQueryDepthSList(PSLIST_HEADER ListHead); + +#define HEAP_NO_SERIALIZE 0x00000001 +#define HEAP_GROWABLE 0x00000002 +#define HEAP_GENERATE_EXCEPTIONS 0x00000004 +#define HEAP_ZERO_MEMORY 0x00000008 +#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010 +#define HEAP_TAIL_CHECKING_ENABLED 0x00000020 +#define HEAP_FREE_CHECKING_ENABLED 0x00000040 +#define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080 +#define HEAP_CREATE_ALIGN_16 0x00010000 +#define HEAP_CREATE_ENABLE_TRACING 0x00020000 +#define HEAP_CREATE_ENABLE_EXECUTE 0x00040000 +#define HEAP_MAXIMUM_TAG 0x0FFF +#define HEAP_PSEUDO_TAG_FLAG 0x8000 +#define HEAP_TAG_SHIFT 18 +#define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b) + ((o) << 18))) + + NTSYSAPI VOID NTAPI RtlCaptureContext(PCONTEXT ContextRecord); + +#define IS_TEXT_UNICODE_ASCII16 0x0001 +#define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010 + +#define IS_TEXT_UNICODE_STATISTICS 0x0002 +#define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020 + +#define IS_TEXT_UNICODE_CONTROLS 0x0004 +#define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040 + +#define IS_TEXT_UNICODE_SIGNATURE 0x0008 +#define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080 + +#define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100 +#define IS_TEXT_UNICODE_ODD_LENGTH 0x0200 +#define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400 +#define IS_TEXT_UNICODE_NULL_BYTES 0x1000 + +#define IS_TEXT_UNICODE_UNICODE_MASK 0x000F +#define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0 +#define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00 +#define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000 + +#define COMPRESSION_FORMAT_NONE (0x0000) +#define COMPRESSION_FORMAT_DEFAULT (0x0001) +#define COMPRESSION_FORMAT_LZNT1 (0x0002) +#define COMPRESSION_ENGINE_STANDARD (0x0000) +#define COMPRESSION_ENGINE_MAXIMUM (0x0100) +#define COMPRESSION_ENGINE_HIBER (0x0200) + +#if _DBG_MEMCPY_INLINE_ && !defined(_MEMCPY_INLINE_) && !defined(_CRTBLD) +#define _MEMCPY_INLINE_ + __CRT_INLINE PVOID __cdecl memcpy_inline(void *dst,const void *src,size_t size) { + if(((char *)dst > (char *)src) && ((char *)dst < ((char *)src + size))) { + __debugbreak(); + } + return memcpy(dst,src,size); + } +#define memcpy memcpy_inline +#endif + + NTSYSAPI SIZE_T NTAPI RtlCompareMemory(const VOID *Source1,const VOID *Source2,SIZE_T Length); + +#define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length))) +#define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length)) +#define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length)) +#define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length)) +#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length)) + + __CRT_INLINE PVOID RtlSecureZeroMemory(PVOID ptr,SIZE_T cnt) { + volatile char *vptr =(volatile char *)ptr; +#ifdef __x86_64 + __stosb((PBYTE)((DWORD64)vptr),0,cnt); +#else + while(cnt) { + *vptr = 0; + vptr++; + cnt--; + } +#endif + return ptr; + } + + typedef struct _MESSAGE_RESOURCE_ENTRY { + WORD Length; + WORD Flags; + BYTE Text[1]; + } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY; + +#define MESSAGE_RESOURCE_UNICODE 0x0001 + + typedef struct _MESSAGE_RESOURCE_BLOCK { + DWORD LowId; + DWORD HighId; + DWORD OffsetToEntries; + } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK; + + typedef struct _MESSAGE_RESOURCE_DATA { + DWORD NumberOfBlocks; + MESSAGE_RESOURCE_BLOCK Blocks[1]; + } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA; + + typedef struct _OSVERSIONINFOA { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + CHAR szCSDVersion[128]; + } OSVERSIONINFOA,*POSVERSIONINFOA,*LPOSVERSIONINFOA; + + typedef struct _OSVERSIONINFOW { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + WCHAR szCSDVersion[128]; + } OSVERSIONINFOW,*POSVERSIONINFOW,*LPOSVERSIONINFOW,RTL_OSVERSIONINFOW,*PRTL_OSVERSIONINFOW; + +#ifdef UNICODE + typedef OSVERSIONINFOW OSVERSIONINFO; + typedef POSVERSIONINFOW POSVERSIONINFO; + typedef LPOSVERSIONINFOW LPOSVERSIONINFO; +#else + typedef OSVERSIONINFOA OSVERSIONINFO; + typedef POSVERSIONINFOA POSVERSIONINFO; + typedef LPOSVERSIONINFOA LPOSVERSIONINFO; +#endif + + typedef struct _OSVERSIONINFOEXA { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + CHAR szCSDVersion[128]; + WORD wServicePackMajor; + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; + BYTE wReserved; + } OSVERSIONINFOEXA,*POSVERSIONINFOEXA,*LPOSVERSIONINFOEXA; + + typedef struct _OSVERSIONINFOEXW { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + WCHAR szCSDVersion[128]; + WORD wServicePackMajor; + WORD wServicePackMinor; + WORD wSuiteMask; + BYTE wProductType; + BYTE wReserved; + } OSVERSIONINFOEXW,*POSVERSIONINFOEXW,*LPOSVERSIONINFOEXW,RTL_OSVERSIONINFOEXW,*PRTL_OSVERSIONINFOEXW; +#ifdef UNICODE + typedef OSVERSIONINFOEXW OSVERSIONINFOEX; + typedef POSVERSIONINFOEXW POSVERSIONINFOEX; + typedef LPOSVERSIONINFOEXW LPOSVERSIONINFOEX; +#else + typedef OSVERSIONINFOEXA OSVERSIONINFOEX; + typedef POSVERSIONINFOEXA POSVERSIONINFOEX; + typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX; +#endif + +#define VER_EQUAL 1 +#define VER_GREATER 2 +#define VER_GREATER_EQUAL 3 +#define VER_LESS 4 +#define VER_LESS_EQUAL 5 +#define VER_AND 6 +#define VER_OR 7 + +#define VER_CONDITION_MASK 7 +#define VER_NUM_BITS_PER_CONDITION_MASK 3 + +#define VER_MINORVERSION 0x0000001 +#define VER_MAJORVERSION 0x0000002 +#define VER_BUILDNUMBER 0x0000004 +#define VER_PLATFORMID 0x0000008 +#define VER_SERVICEPACKMINOR 0x0000010 +#define VER_SERVICEPACKMAJOR 0x0000020 +#define VER_SUITENAME 0x0000040 +#define VER_PRODUCT_TYPE 0x0000080 + +#define VER_NT_WORKSTATION 0x0000001 +#define VER_NT_DOMAIN_CONTROLLER 0x0000002 +#define VER_NT_SERVER 0x0000003 + +#define VER_PLATFORM_WIN32s 0 +#define VER_PLATFORM_WIN32_WINDOWS 1 +#define VER_PLATFORM_WIN32_NT 2 + +#define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_))) + + NTSYSAPI ULONGLONG NTAPI VerSetConditionMask(ULONGLONG ConditionMask,DWORD TypeMask,BYTE Condition); + + typedef struct _RTL_CRITICAL_SECTION_DEBUG { + WORD Type; + WORD CreatorBackTraceIndex; + struct _RTL_CRITICAL_SECTION *CriticalSection; + LIST_ENTRY ProcessLocksList; + DWORD EntryCount; + DWORD ContentionCount; + DWORD Spare[2]; + } RTL_CRITICAL_SECTION_DEBUG,*PRTL_CRITICAL_SECTION_DEBUG,RTL_RESOURCE_DEBUG,*PRTL_RESOURCE_DEBUG; + +#define RTL_CRITSECT_TYPE 0 +#define RTL_RESOURCE_TYPE 1 + + typedef struct _RTL_CRITICAL_SECTION { + PRTL_CRITICAL_SECTION_DEBUG DebugInfo; + LONG LockCount; + LONG RecursionCount; + HANDLE OwningThread; + HANDLE LockSemaphore; + ULONG_PTR SpinCount; + } RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION; + + typedef VOID (NTAPI *RTL_VERIFIER_DLL_LOAD_CALLBACK) (PWSTR DllName,PVOID DllBase,SIZE_T DllSize,PVOID Reserved); + typedef VOID (NTAPI *RTL_VERIFIER_DLL_UNLOAD_CALLBACK) (PWSTR DllName,PVOID DllBase,SIZE_T DllSize,PVOID Reserved); + typedef VOID (NTAPI *RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK)(PVOID AllocationBase,SIZE_T AllocationSize); + + typedef struct _RTL_VERIFIER_THUNK_DESCRIPTOR { + PCHAR ThunkName; + PVOID ThunkOldAddress; + PVOID ThunkNewAddress; + } RTL_VERIFIER_THUNK_DESCRIPTOR,*PRTL_VERIFIER_THUNK_DESCRIPTOR; + + typedef struct _RTL_VERIFIER_DLL_DESCRIPTOR { + PWCHAR DllName; + DWORD DllFlags; + PVOID DllAddress; + PRTL_VERIFIER_THUNK_DESCRIPTOR DllThunks; + } RTL_VERIFIER_DLL_DESCRIPTOR,*PRTL_VERIFIER_DLL_DESCRIPTOR; + + typedef struct _RTL_VERIFIER_PROVIDER_DESCRIPTOR { + DWORD Length; + PRTL_VERIFIER_DLL_DESCRIPTOR ProviderDlls; + RTL_VERIFIER_DLL_LOAD_CALLBACK ProviderDllLoadCallback; + RTL_VERIFIER_DLL_UNLOAD_CALLBACK ProviderDllUnloadCallback; + PWSTR VerifierImage; + DWORD VerifierFlags; + DWORD VerifierDebug; + PVOID RtlpGetStackTraceAddress; + PVOID RtlpDebugPageHeapCreate; + PVOID RtlpDebugPageHeapDestroy; + RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK ProviderNtdllHeapFreeCallback; + } RTL_VERIFIER_PROVIDER_DESCRIPTOR,*PRTL_VERIFIER_PROVIDER_DESCRIPTOR; + +#define RTL_VRF_FLG_FULL_PAGE_HEAP 0x00000001 +#define RTL_VRF_FLG_RESERVED_DONOTUSE 0x00000002 +#define RTL_VRF_FLG_HANDLE_CHECKS 0x00000004 +#define RTL_VRF_FLG_STACK_CHECKS 0x00000008 +#define RTL_VRF_FLG_APPCOMPAT_CHECKS 0x00000010 +#define RTL_VRF_FLG_TLS_CHECKS 0x00000020 +#define RTL_VRF_FLG_DIRTY_STACKS 0x00000040 +#define RTL_VRF_FLG_RPC_CHECKS 0x00000080 +#define RTL_VRF_FLG_COM_CHECKS 0x00000100 +#define RTL_VRF_FLG_DANGEROUS_APIS 0x00000200 +#define RTL_VRF_FLG_RACE_CHECKS 0x00000400 +#define RTL_VRF_FLG_DEADLOCK_CHECKS 0x00000800 +#define RTL_VRF_FLG_FIRST_CHANCE_EXCEPTION_CHECKS 0x00001000 +#define RTL_VRF_FLG_VIRTUAL_MEM_CHECKS 0x00002000 +#define RTL_VRF_FLG_ENABLE_LOGGING 0x00004000 +#define RTL_VRF_FLG_FAST_FILL_HEAP 0x00008000 +#define RTL_VRF_FLG_VIRTUAL_SPACE_TRACKING 0x00010000 +#define RTL_VRF_FLG_ENABLED_SYSTEM_WIDE 0x00020000 +#define RTL_VRF_FLG_MISCELLANEOUS_CHECKS 0x00020000 +#define RTL_VRF_FLG_LOCK_CHECKS 0x00040000 + +#define APPLICATION_VERIFIER_INTERNAL_ERROR 0x80000000 +#define APPLICATION_VERIFIER_INTERNAL_WARNING 0x40000000 +#define APPLICATION_VERIFIER_NO_BREAK 0x20000000 +#define APPLICATION_VERIFIER_CONTINUABLE_BREAK 0x10000000 + +#define APPLICATION_VERIFIER_UNKNOWN_ERROR 0x0001 +#define APPLICATION_VERIFIER_ACCESS_VIOLATION 0x0002 +#define APPLICATION_VERIFIER_UNSYNCHRONIZED_ACCESS 0x0003 +#define APPLICATION_VERIFIER_EXTREME_SIZE_REQUEST 0x0004 +#define APPLICATION_VERIFIER_BAD_HEAP_HANDLE 0x0005 +#define APPLICATION_VERIFIER_SWITCHED_HEAP_HANDLE 0x0006 +#define APPLICATION_VERIFIER_DOUBLE_FREE 0x0007 +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK 0x0008 +#define APPLICATION_VERIFIER_DESTROY_PROCESS_HEAP 0x0009 +#define APPLICATION_VERIFIER_UNEXPECTED_EXCEPTION 0x000A +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_EXCEPTION_RAISED_FOR_HEADER 0x000B +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_EXCEPTION_RAISED_FOR_PROBING 0x000C +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_HEADER 0x000D +#define APPLICATION_VERIFIER_CORRUPTED_FREED_HEAP_BLOCK 0x000E +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_SUFFIX 0x000F +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_START_STAMP 0x0010 +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_END_STAMP 0x0011 +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_PREFIX 0x0012 +#define APPLICATION_VERIFIER_FIRST_CHANCE_ACCESS_VIOLATION 0x0013 +#define APPLICATION_VERIFIER_CORRUPTED_HEAP_LIST 0x0014 + +#define APPLICATION_VERIFIER_TERMINATE_THREAD_CALL 0x0100 +#define APPLICATION_VERIFIER_STACK_OVERFLOW 0x0101 +#define APPLICATION_VERIFIER_INVALID_EXIT_PROCESS_CALL 0x0102 + +#define APPLICATION_VERIFIER_EXIT_THREAD_OWNS_LOCK 0x0200 +#define APPLICATION_VERIFIER_LOCK_IN_UNLOADED_DLL 0x0201 +#define APPLICATION_VERIFIER_LOCK_IN_FREED_HEAP 0x0202 +#define APPLICATION_VERIFIER_LOCK_DOUBLE_INITIALIZE 0x0203 +#define APPLICATION_VERIFIER_LOCK_IN_FREED_MEMORY 0x0204 +#define APPLICATION_VERIFIER_LOCK_CORRUPTED 0x0205 +#define APPLICATION_VERIFIER_LOCK_INVALID_OWNER 0x0206 +#define APPLICATION_VERIFIER_LOCK_INVALID_RECURSION_COUNT 0x0207 +#define APPLICATION_VERIFIER_LOCK_INVALID_LOCK_COUNT 0x0208 +#define APPLICATION_VERIFIER_LOCK_OVER_RELEASED 0x0209 +#define APPLICATION_VERIFIER_LOCK_NOT_INITIALIZED 0x0210 +#define APPLICATION_VERIFIER_LOCK_ALREADY_INITIALIZED 0x0211 +#define APPLICATION_VERIFIER_LOCK_IN_FREED_VMEM 0x0212 +#define APPLICATION_VERIFIER_LOCK_IN_UNMAPPED_MEM 0x0213 +#define APPLICATION_VERIFIER_THREAD_NOT_LOCK_OWNER 0x0214 + +#define APPLICATION_VERIFIER_INVALID_HANDLE 0x0300 +#define APPLICATION_VERIFIER_INVALID_TLS_VALUE 0x0301 +#define APPLICATION_VERIFIER_INCORRECT_WAIT_CALL 0x0302 +#define APPLICATION_VERIFIER_NULL_HANDLE 0x0303 +#define APPLICATION_VERIFIER_WAIT_IN_DLLMAIN 0x0304 + +#define APPLICATION_VERIFIER_COM_ERROR 0x0400 +#define APPLICATION_VERIFIER_COM_API_IN_DLLMAIN 0x0401 +#define APPLICATION_VERIFIER_COM_UNHANDLED_EXCEPTION 0x0402 +#define APPLICATION_VERIFIER_COM_UNBALANCED_COINIT 0x0403 +#define APPLICATION_VERIFIER_COM_UNBALANCED_OLEINIT 0x0404 +#define APPLICATION_VERIFIER_COM_UNBALANCED_SWC 0x0405 +#define APPLICATION_VERIFIER_COM_NULL_DACL 0x0406 +#define APPLICATION_VERIFIER_COM_UNSAFE_IMPERSONATION 0x0407 +#define APPLICATION_VERIFIER_COM_SMUGGLED_WRAPPER 0x0408 +#define APPLICATION_VERIFIER_COM_SMUGGLED_PROXY 0x0409 +#define APPLICATION_VERIFIER_COM_CF_SUCCESS_WITH_NULL 0x040A +#define APPLICATION_VERIFIER_COM_GCO_SUCCESS_WITH_NULL 0x040B +#define APPLICATION_VERIFIER_COM_OBJECT_IN_FREED_MEMORY 0x040C +#define APPLICATION_VERIFIER_COM_OBJECT_IN_UNLOADED_DLL 0x040D +#define APPLICATION_VERIFIER_COM_VTBL_IN_FREED_MEMORY 0x040E +#define APPLICATION_VERIFIER_COM_VTBL_IN_UNLOADED_DLL 0x040F +#define APPLICATION_VERIFIER_COM_HOLDING_LOCKS_ON_CALL 0x0410 + +#define APPLICATION_VERIFIER_RPC_ERROR 0x0500 + +#define APPLICATION_VERIFIER_INVALID_FREEMEM 0x0600 +#define APPLICATION_VERIFIER_INVALID_ALLOCMEM 0x0601 +#define APPLICATION_VERIFIER_INVALID_MAPVIEW 0x0602 +#define APPLICATION_VERIFIER_PROBE_INVALID_ADDRESS 0x0603 +#define APPLICATION_VERIFIER_PROBE_FREE_MEM 0x0604 +#define APPLICATION_VERIFIER_PROBE_GUARD_PAGE 0x0605 +#define APPLICATION_VERIFIER_PROBE_NULL 0x0606 +#define APPLICATION_VERIFIER_PROBE_INVALID_START_OR_SIZE 0x0607 +#define APPLICATION_VERIFIER_SIZE_HEAP_UNEXPECTED_EXCEPTION 0x0618 + +#define VERIFIER_STOP(Code,Msg,P1,S1,P2,S2,P3,S3,P4,S4) { RtlApplicationVerifierStop ((Code),(Msg),(ULONG_PTR)(P1),(S1),(ULONG_PTR)(P2),(S2),(ULONG_PTR)(P3),(S3),(ULONG_PTR)(P4),(S4)); } + + VOID NTAPI RtlApplicationVerifierStop(ULONG_PTR Code,PSTR Message,ULONG_PTR Param1,PSTR Description1,ULONG_PTR Param2,PSTR Description2,ULONG_PTR Param3,PSTR Description3,ULONG_PTR Param4,PSTR Description4); + + typedef LONG (NTAPI *PVECTORED_EXCEPTION_HANDLER)(struct _EXCEPTION_POINTERS *ExceptionInfo); +#define SEF_DACL_AUTO_INHERIT 0x01 +#define SEF_SACL_AUTO_INHERIT 0x02 +#define SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT 0x04 +#define SEF_AVOID_PRIVILEGE_CHECK 0x08 +#define SEF_AVOID_OWNER_CHECK 0x10 +#define SEF_DEFAULT_OWNER_FROM_PARENT 0x20 +#define SEF_DEFAULT_GROUP_FROM_PARENT 0x40 + + typedef enum _HEAP_INFORMATION_CLASS { + HeapCompatibilityInformation + } HEAP_INFORMATION_CLASS; + + NTSYSAPI DWORD NTAPI RtlSetHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength); + NTSYSAPI DWORD NTAPI RtlQueryHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength); + DWORD NTAPI RtlMultipleAllocateHeap(PVOID HeapHandle,DWORD Flags,SIZE_T Size,DWORD Count,PVOID *Array); + DWORD NTAPI RtlMultipleFreeHeap(PVOID HeapHandle,DWORD Flags,DWORD Count,PVOID *Array); + +#define WT_EXECUTEDEFAULT 0x00000000 +#define WT_EXECUTEINIOTHREAD 0x00000001 +#define WT_EXECUTEINUITHREAD 0x00000002 +#define WT_EXECUTEINWAITTHREAD 0x00000004 +#define WT_EXECUTEONLYONCE 0x00000008 +#define WT_EXECUTEINTIMERTHREAD 0x00000020 +#define WT_EXECUTELONGFUNCTION 0x00000010 +#define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040 +#define WT_EXECUTEINPERSISTENTTHREAD 0x00000080 +#define WT_TRANSFER_IMPERSONATION 0x00000100 +#define WT_SET_MAX_THREADPOOL_THREADS(Flags,Limit) ((Flags) |= (Limit)<<16) + typedef VOID (NTAPI *WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN); + typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID); + typedef VOID (NTAPI *APC_CALLBACK_FUNCTION)(DWORD ,PVOID,PVOID); + typedef + VOID + (NTAPI *PFLS_CALLBACK_FUNCTION)(PVOID lpFlsData); +#define WT_EXECUTEINLONGTHREAD 0x00000010 +#define WT_EXECUTEDELETEWAIT 0x00000008 + + typedef enum _ACTIVATION_CONTEXT_INFO_CLASS { + ActivationContextBasicInformation = 1,ActivationContextDetailedInformation = 2,AssemblyDetailedInformationInActivationContext = 3,FileInformationInAssemblyOfAssemblyInActivationContext = 4,MaxActivationContextInfoClass,AssemblyDetailedInformationInActivationContxt = 3,FileInformationInAssemblyOfAssemblyInActivationContxt = 4 + } ACTIVATION_CONTEXT_INFO_CLASS; + +#define ACTIVATIONCONTEXTINFOCLASS ACTIVATION_CONTEXT_INFO_CLASS + + typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX { + DWORD ulAssemblyIndex; + DWORD ulFileIndexInAssembly; + } ACTIVATION_CONTEXT_QUERY_INDEX,*PACTIVATION_CONTEXT_QUERY_INDEX; + + typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX; + +#define ACTIVATION_CONTEXT_PATH_TYPE_NONE (1) +#define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE (2) +#define ACTIVATION_CONTEXT_PATH_TYPE_URL (3) +#define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF (4) + + typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION { + DWORD ulFlags; + DWORD ulFilenameLength; + DWORD ulPathLength; + + PCWSTR lpFileName; + PCWSTR lpFilePath; + } ASSEMBLY_FILE_DETAILED_INFORMATION,*PASSEMBLY_FILE_DETAILED_INFORMATION; + typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION; + +#define _ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION _ASSEMBLY_FILE_DETAILED_INFORMATION +#define ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION ASSEMBLY_FILE_DETAILED_INFORMATION +#define PASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION PASSEMBLY_FILE_DETAILED_INFORMATION +#define PCASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION PCASSEMBLY_FILE_DETAILED_INFORMATION + + typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION { + DWORD ulFlags; + DWORD ulEncodedAssemblyIdentityLength; + DWORD ulManifestPathType; + DWORD ulManifestPathLength; + LARGE_INTEGER liManifestLastWriteTime; + DWORD ulPolicyPathType; + DWORD ulPolicyPathLength; + LARGE_INTEGER liPolicyLastWriteTime; + DWORD ulMetadataSatelliteRosterIndex; + DWORD ulManifestVersionMajor; + DWORD ulManifestVersionMinor; + DWORD ulPolicyVersionMajor; + DWORD ulPolicyVersionMinor; + DWORD ulAssemblyDirectoryNameLength; + PCWSTR lpAssemblyEncodedAssemblyIdentity; + PCWSTR lpAssemblyManifestPath; + PCWSTR lpAssemblyPolicyPath; + PCWSTR lpAssemblyDirectoryName; + DWORD ulFileCount; + } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; + + typedef const struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; + + typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION { + DWORD dwFlags; + DWORD ulFormatVersion; + DWORD ulAssemblyCount; + DWORD ulRootManifestPathType; + DWORD ulRootManifestPathChars; + DWORD ulRootConfigurationPathType; + DWORD ulRootConfigurationPathChars; + DWORD ulAppDirPathType; + DWORD ulAppDirPathChars; + PCWSTR lpRootManifestPath; + PCWSTR lpRootConfigurationPath; + PCWSTR lpAppDirPath; + } ACTIVATION_CONTEXT_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_DETAILED_INFORMATION; + + typedef const struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION; + +#define DLL_PROCESS_ATTACH 1 +#define DLL_THREAD_ATTACH 2 +#define DLL_THREAD_DETACH 3 +#define DLL_PROCESS_DETACH 0 +#define DLL_PROCESS_VERIFIER 4 + +#define EVENTLOG_SEQUENTIAL_READ 0x0001 +#define EVENTLOG_SEEK_READ 0x0002 +#define EVENTLOG_FORWARDS_READ 0x0004 +#define EVENTLOG_BACKWARDS_READ 0x0008 + +#define EVENTLOG_SUCCESS 0x0000 +#define EVENTLOG_ERROR_TYPE 0x0001 +#define EVENTLOG_WARNING_TYPE 0x0002 +#define EVENTLOG_INFORMATION_TYPE 0x0004 +#define EVENTLOG_AUDIT_SUCCESS 0x0008 +#define EVENTLOG_AUDIT_FAILURE 0x0010 + +#define EVENTLOG_START_PAIRED_EVENT 0x0001 +#define EVENTLOG_END_PAIRED_EVENT 0x0002 +#define EVENTLOG_END_ALL_PAIRED_EVENTS 0x0004 +#define EVENTLOG_PAIRED_EVENT_ACTIVE 0x0008 +#define EVENTLOG_PAIRED_EVENT_INACTIVE 0x0010 + + typedef struct _EVENTLOGRECORD { + DWORD Length; + DWORD Reserved; + DWORD RecordNumber; + DWORD TimeGenerated; + DWORD TimeWritten; + DWORD EventID; + WORD EventType; + WORD NumStrings; + WORD EventCategory; + WORD ReservedFlags; + DWORD ClosingRecordNumber; + DWORD StringOffset; + DWORD UserSidLength; + DWORD UserSidOffset; + DWORD DataLength; + DWORD DataOffset; + } EVENTLOGRECORD,*PEVENTLOGRECORD; + +#define MAXLOGICALLOGNAMESIZE 256 + + typedef struct _EVENTSFORLOGFILE{ + DWORD ulSize; + WCHAR szLogicalLogFile[MAXLOGICALLOGNAMESIZE]; + DWORD ulNumRecords; + EVENTLOGRECORD pEventLogRecords[]; + } EVENTSFORLOGFILE,*PEVENTSFORLOGFILE; + + typedef struct _PACKEDEVENTINFO{ + DWORD ulSize; + DWORD ulNumEventsForLogFile; + DWORD ulOffsets[]; + } PACKEDEVENTINFO,*PPACKEDEVENTINFO; + +#define KEY_QUERY_VALUE (0x0001) +#define KEY_SET_VALUE (0x0002) +#define KEY_CREATE_SUB_KEY (0x0004) +#define KEY_ENUMERATE_SUB_KEYS (0x0008) +#define KEY_NOTIFY (0x0010) +#define KEY_CREATE_LINK (0x0020) +#define KEY_WOW64_32KEY (0x0200) +#define KEY_WOW64_64KEY (0x0100) +#define KEY_WOW64_RES (0x0300) + +#define KEY_READ ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~SYNCHRONIZE)) +#define KEY_WRITE ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE)) +#define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE)) +#define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL | KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY | KEY_CREATE_LINK) & (~SYNCHRONIZE)) +#define REG_OPTION_RESERVED (0x00000000L) + +#define REG_OPTION_NON_VOLATILE (0x00000000L) +#define REG_OPTION_VOLATILE (0x00000001L) +#define REG_OPTION_CREATE_LINK (0x00000002L) +#define REG_OPTION_BACKUP_RESTORE (0x00000004L) +#define REG_OPTION_OPEN_LINK (0x00000008L) +#define REG_LEGAL_OPTION (REG_OPTION_RESERVED | REG_OPTION_NON_VOLATILE | REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK | REG_OPTION_BACKUP_RESTORE | REG_OPTION_OPEN_LINK) +#define REG_CREATED_NEW_KEY (0x00000001L) +#define REG_OPENED_EXISTING_KEY (0x00000002L) +#define REG_STANDARD_FORMAT 1 +#define REG_LATEST_FORMAT 2 +#define REG_NO_COMPRESSION 4 +#define REG_WHOLE_HIVE_VOLATILE (0x00000001L) +#define REG_REFRESH_HIVE (0x00000002L) +#define REG_NO_LAZY_FLUSH (0x00000004L) +#define REG_FORCE_RESTORE (0x00000008L) +#define REG_FORCE_UNLOAD 1 + +#define REG_NOTIFY_CHANGE_NAME (0x00000001L) +#define REG_NOTIFY_CHANGE_ATTRIBUTES (0x00000002L) +#define REG_NOTIFY_CHANGE_LAST_SET (0x00000004L) +#define REG_NOTIFY_CHANGE_SECURITY (0x00000008L) + +#define REG_LEGAL_CHANGE_FILTER (REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_SECURITY) + +#define REG_NONE (0) +#define REG_SZ (1) +#define REG_EXPAND_SZ (2) + +#define REG_BINARY (3) +#define REG_DWORD (4) +#define REG_DWORD_LITTLE_ENDIAN (4) +#define REG_DWORD_BIG_ENDIAN (5) +#define REG_LINK (6) +#define REG_MULTI_SZ (7) +#define REG_RESOURCE_LIST (8) +#define REG_FULL_RESOURCE_DESCRIPTOR (9) +#define REG_RESOURCE_REQUIREMENTS_LIST (10) +#define REG_QWORD (11) +#define REG_QWORD_LITTLE_ENDIAN (11) + +#define SERVICE_KERNEL_DRIVER 0x00000001 +#define SERVICE_FILE_SYSTEM_DRIVER 0x00000002 +#define SERVICE_ADAPTER 0x00000004 +#define SERVICE_RECOGNIZER_DRIVER 0x00000008 + +#define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | SERVICE_RECOGNIZER_DRIVER) + +#define SERVICE_WIN32_OWN_PROCESS 0x00000010 +#define SERVICE_WIN32_SHARE_PROCESS 0x00000020 +#define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS) + +#define SERVICE_INTERACTIVE_PROCESS 0x00000100 + +#define SERVICE_TYPE_ALL (SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS) + +#define SERVICE_BOOT_START 0x00000000 +#define SERVICE_SYSTEM_START 0x00000001 +#define SERVICE_AUTO_START 0x00000002 +#define SERVICE_DEMAND_START 0x00000003 +#define SERVICE_DISABLED 0x00000004 + +#define SERVICE_ERROR_IGNORE 0x00000000 +#define SERVICE_ERROR_NORMAL 0x00000001 +#define SERVICE_ERROR_SEVERE 0x00000002 +#define SERVICE_ERROR_CRITICAL 0x00000003 + + typedef enum _CM_SERVICE_NODE_TYPE { + DriverType = SERVICE_KERNEL_DRIVER,FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS, + Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,AdapterType = SERVICE_ADAPTER,RecognizerType = SERVICE_RECOGNIZER_DRIVER + } SERVICE_NODE_TYPE; + + typedef enum _CM_SERVICE_LOAD_TYPE { + BootLoad = SERVICE_BOOT_START,SystemLoad = SERVICE_SYSTEM_START,AutoLoad = SERVICE_AUTO_START,DemandLoad = SERVICE_DEMAND_START, + DisableLoad = SERVICE_DISABLED + } SERVICE_LOAD_TYPE; + + typedef enum _CM_ERROR_CONTROL_TYPE { + IgnoreError = SERVICE_ERROR_IGNORE,NormalError = SERVICE_ERROR_NORMAL,SevereError = SERVICE_ERROR_SEVERE,CriticalError = SERVICE_ERROR_CRITICAL + } SERVICE_ERROR_TYPE; + +#define TAPE_ERASE_SHORT 0L +#define TAPE_ERASE_LONG 1L + + typedef struct _TAPE_ERASE { + DWORD Type; + BOOLEAN Immediate; + } TAPE_ERASE,*PTAPE_ERASE; + +#define TAPE_LOAD 0L +#define TAPE_UNLOAD 1L +#define TAPE_TENSION 2L +#define TAPE_LOCK 3L +#define TAPE_UNLOCK 4L +#define TAPE_FORMAT 5L + + typedef struct _TAPE_PREPARE { + DWORD Operation; + BOOLEAN Immediate; + } TAPE_PREPARE,*PTAPE_PREPARE; + +#define TAPE_SETMARKS 0L +#define TAPE_FILEMARKS 1L +#define TAPE_SHORT_FILEMARKS 2L +#define TAPE_LONG_FILEMARKS 3L + + typedef struct _TAPE_WRITE_MARKS { + DWORD Type; + DWORD Count; + BOOLEAN Immediate; + } TAPE_WRITE_MARKS,*PTAPE_WRITE_MARKS; + +#define TAPE_ABSOLUTE_POSITION 0L +#define TAPE_LOGICAL_POSITION 1L +#define TAPE_PSEUDO_LOGICAL_POSITION 2L + + typedef struct _TAPE_GET_POSITION { + DWORD Type; + DWORD Partition; + LARGE_INTEGER Offset; + } TAPE_GET_POSITION,*PTAPE_GET_POSITION; + +#define TAPE_REWIND 0L +#define TAPE_ABSOLUTE_BLOCK 1L +#define TAPE_LOGICAL_BLOCK 2L +#define TAPE_PSEUDO_LOGICAL_BLOCK 3L +#define TAPE_SPACE_END_OF_DATA 4L +#define TAPE_SPACE_RELATIVE_BLOCKS 5L +#define TAPE_SPACE_FILEMARKS 6L +#define TAPE_SPACE_SEQUENTIAL_FMKS 7L +#define TAPE_SPACE_SETMARKS 8L +#define TAPE_SPACE_SEQUENTIAL_SMKS 9L + + typedef struct _TAPE_SET_POSITION { + DWORD Method; + DWORD Partition; + LARGE_INTEGER Offset; + BOOLEAN Immediate; + } TAPE_SET_POSITION,*PTAPE_SET_POSITION; + +#define TAPE_DRIVE_FIXED 0x00000001 +#define TAPE_DRIVE_SELECT 0x00000002 +#define TAPE_DRIVE_INITIATOR 0x00000004 + +#define TAPE_DRIVE_ERASE_SHORT 0x00000010 +#define TAPE_DRIVE_ERASE_LONG 0x00000020 +#define TAPE_DRIVE_ERASE_BOP_ONLY 0x00000040 +#define TAPE_DRIVE_ERASE_IMMEDIATE 0x00000080 + +#define TAPE_DRIVE_TAPE_CAPACITY 0x00000100 +#define TAPE_DRIVE_TAPE_REMAINING 0x00000200 +#define TAPE_DRIVE_FIXED_BLOCK 0x00000400 +#define TAPE_DRIVE_VARIABLE_BLOCK 0x00000800 + +#define TAPE_DRIVE_WRITE_PROTECT 0x00001000 +#define TAPE_DRIVE_EOT_WZ_SIZE 0x00002000 + +#define TAPE_DRIVE_ECC 0x00010000 +#define TAPE_DRIVE_COMPRESSION 0x00020000 +#define TAPE_DRIVE_PADDING 0x00040000 +#define TAPE_DRIVE_REPORT_SMKS 0x00080000 + +#define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000 +#define TAPE_DRIVE_GET_LOGICAL_BLK 0x00200000 +#define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x00400000 + +#define TAPE_DRIVE_EJECT_MEDIA 0x01000000 +#define TAPE_DRIVE_CLEAN_REQUESTS 0x02000000 +#define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x04000000 + +#define TAPE_DRIVE_RESERVED_BIT 0x80000000 + +#define TAPE_DRIVE_LOAD_UNLOAD 0x80000001 +#define TAPE_DRIVE_TENSION 0x80000002 +#define TAPE_DRIVE_LOCK_UNLOCK 0x80000004 +#define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008 + +#define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010 +#define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020 +#define TAPE_DRIVE_TENSION_IMMED 0x80000040 +#define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080 + +#define TAPE_DRIVE_SET_ECC 0x80000100 +#define TAPE_DRIVE_SET_COMPRESSION 0x80000200 +#define TAPE_DRIVE_SET_PADDING 0x80000400 +#define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800 + +#define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000 +#define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000 +#define TAPE_DRIVE_LOGICAL_BLK 0x80004000 +#define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000 + +#define TAPE_DRIVE_END_OF_DATA 0x80010000 +#define TAPE_DRIVE_RELATIVE_BLKS 0x80020000 +#define TAPE_DRIVE_FILEMARKS 0x80040000 +#define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000 + +#define TAPE_DRIVE_SETMARKS 0x80100000 +#define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000 +#define TAPE_DRIVE_REVERSE_POSITION 0x80400000 +#define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000 + +#define TAPE_DRIVE_WRITE_SETMARKS 0x81000000 +#define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000 +#define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000 +#define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000 + +#define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000 +#define TAPE_DRIVE_FORMAT 0xA0000000 +#define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000 +#define TAPE_DRIVE_HIGH_FEATURES 0x80000000 + + typedef struct _TAPE_GET_DRIVE_PARAMETERS { + BOOLEAN ECC; + BOOLEAN Compression; + BOOLEAN DataPadding; + BOOLEAN ReportSetmarks; + DWORD DefaultBlockSize; + DWORD MaximumBlockSize; + DWORD MinimumBlockSize; + DWORD MaximumPartitionCount; + DWORD FeaturesLow; + DWORD FeaturesHigh; + DWORD EOTWarningZoneSize; + } TAPE_GET_DRIVE_PARAMETERS,*PTAPE_GET_DRIVE_PARAMETERS; + + typedef struct _TAPE_SET_DRIVE_PARAMETERS { + BOOLEAN ECC; + BOOLEAN Compression; + BOOLEAN DataPadding; + BOOLEAN ReportSetmarks; + DWORD EOTWarningZoneSize; + } TAPE_SET_DRIVE_PARAMETERS,*PTAPE_SET_DRIVE_PARAMETERS; + + typedef struct _TAPE_GET_MEDIA_PARAMETERS { + LARGE_INTEGER Capacity; + LARGE_INTEGER Remaining; + DWORD BlockSize; + DWORD PartitionCount; + BOOLEAN WriteProtected; + } TAPE_GET_MEDIA_PARAMETERS,*PTAPE_GET_MEDIA_PARAMETERS; + + typedef struct _TAPE_SET_MEDIA_PARAMETERS { + DWORD BlockSize; + } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS; + +#define TAPE_FIXED_PARTITIONS 0L +#define TAPE_SELECT_PARTITIONS 1L +#define TAPE_INITIATOR_PARTITIONS 2L + + typedef struct _TAPE_CREATE_PARTITION { + DWORD Method; + DWORD Count; + DWORD Size; + } TAPE_CREATE_PARTITION,*PTAPE_CREATE_PARTITION; + +#define TAPE_QUERY_DRIVE_PARAMETERS 0L +#define TAPE_QUERY_MEDIA_CAPACITY 1L +#define TAPE_CHECK_FOR_DRIVE_PROBLEM 2L +#define TAPE_QUERY_IO_ERROR_DATA 3L +#define TAPE_QUERY_DEVICE_ERROR_DATA 4L + + typedef struct _TAPE_WMI_OPERATIONS { + DWORD Method; + DWORD DataBufferSize; + PVOID DataBuffer; + } TAPE_WMI_OPERATIONS,*PTAPE_WMI_OPERATIONS; + + typedef enum _TAPE_DRIVE_PROBLEM_TYPE { + TapeDriveProblemNone,TapeDriveReadWriteWarning,TapeDriveReadWriteError,TapeDriveReadWarning,TapeDriveWriteWarning,TapeDriveReadError,TapeDriveWriteError,TapeDriveHardwareError,TapeDriveUnsupportedMedia,TapeDriveScsiConnectionError,TapeDriveTimetoClean,TapeDriveCleanDriveNow,TapeDriveMediaLifeExpired,TapeDriveSnappedTape + } TAPE_DRIVE_PROBLEM_TYPE; + +#if defined(__x86_64) + __CRT_INLINE struct _TEB *NtCurrentTeb(VOID) { return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB,Self)); } + __CRT_INLINE PVOID GetCurrentFiber(VOID) { return(PVOID)__readgsqword(FIELD_OFFSET(NT_TIB,FiberData)); } + __CRT_INLINE PVOID GetFiberData(VOID) { + return *(PVOID *)GetCurrentFiber(); + } +#endif + +#if(defined(_X86_) && !defined(__x86_64)) +#define PcTeb 0x18 + __CRT_INLINE struct _TEB *NtCurrentTeb(void) { + struct _TEB *ret; + __asm__ volatile ("movl %%fs:0x18,%0" + : "=r" (ret)); + return ret; + } +#endif + +#define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION (1) +#define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION (2) +#define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION (3) +#define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION (4) +#define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION (5) +#define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION (6) +#define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION (7) +#define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE (8) +#define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES (9) +#define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS (10) + +#ifdef __cplusplus + } +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/winreg.h b/overlay_toolchain/tcc/include/winapi/winreg.h new file mode 100644 index 00000000..f158d282 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/winreg.h @@ -0,0 +1,272 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINREG_ +#define _WINREG_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#define RRF_RT_REG_NONE 0x00000001 +#define RRF_RT_REG_SZ 0x00000002 +#define RRF_RT_REG_EXPAND_SZ 0x00000004 +#define RRF_RT_REG_BINARY 0x00000008 +#define RRF_RT_REG_DWORD 0x00000010 +#define RRF_RT_REG_MULTI_SZ 0x00000020 +#define RRF_RT_REG_QWORD 0x00000040 + +#define RRF_RT_DWORD (RRF_RT_REG_BINARY | RRF_RT_REG_DWORD) +#define RRF_RT_QWORD (RRF_RT_REG_BINARY | RRF_RT_REG_QWORD) +#define RRF_RT_ANY 0x0000ffff + +#define RRF_NOEXPAND 0x10000000 +#define RRF_ZEROONFAILURE 0x20000000 + + typedef ACCESS_MASK REGSAM; + +#define HKEY_CLASSES_ROOT ((HKEY) (ULONG_PTR)((LONG)0x80000000)) +#define HKEY_CURRENT_USER ((HKEY) (ULONG_PTR)((LONG)0x80000001)) +#define HKEY_LOCAL_MACHINE ((HKEY) (ULONG_PTR)((LONG)0x80000002)) +#define HKEY_USERS ((HKEY) (ULONG_PTR)((LONG)0x80000003)) +#define HKEY_PERFORMANCE_DATA ((HKEY) (ULONG_PTR)((LONG)0x80000004)) +#define HKEY_PERFORMANCE_TEXT ((HKEY) (ULONG_PTR)((LONG)0x80000050)) +#define HKEY_PERFORMANCE_NLSTEXT ((HKEY) (ULONG_PTR)((LONG)0x80000060)) +#define HKEY_CURRENT_CONFIG ((HKEY) (ULONG_PTR)((LONG)0x80000005)) +#define HKEY_DYN_DATA ((HKEY) (ULONG_PTR)((LONG)0x80000006)) + +#define REG_SECURE_CONNECTION 1 + +#ifndef _PROVIDER_STRUCTS_DEFINED +#define _PROVIDER_STRUCTS_DEFINED + +#define PROVIDER_KEEPS_VALUE_LENGTH 0x1 + struct val_context { + int valuelen; + LPVOID value_context; + LPVOID val_buff_ptr; + }; + + typedef struct val_context *PVALCONTEXT; + + typedef struct pvalueA { + LPSTR pv_valuename; + int pv_valuelen; + LPVOID pv_value_context; + DWORD pv_type; + }PVALUEA,*PPVALUEA; + + typedef struct pvalueW { + LPWSTR pv_valuename; + int pv_valuelen; + LPVOID pv_value_context; + DWORD pv_type; + }PVALUEW,*PPVALUEW; + +#ifdef UNICODE + typedef PVALUEW PVALUE; + typedef PPVALUEW PPVALUE; +#else + typedef PVALUEA PVALUE; + typedef PPVALUEA PPVALUE; +#endif + + typedef DWORD __cdecl QUERYHANDLER(LPVOID keycontext,PVALCONTEXT val_list,DWORD num_vals,LPVOID outputbuffer,DWORD *total_outlen,DWORD input_blen); + + typedef QUERYHANDLER *PQUERYHANDLER; + + typedef struct provider_info { + PQUERYHANDLER pi_R0_1val; + PQUERYHANDLER pi_R0_allvals; + PQUERYHANDLER pi_R3_1val; + PQUERYHANDLER pi_R3_allvals; + DWORD pi_flags; + LPVOID pi_key_context; + } REG_PROVIDER; + + typedef struct provider_info *PPROVIDER; + + typedef struct value_entA { + LPSTR ve_valuename; + DWORD ve_valuelen; + DWORD_PTR ve_valueptr; + DWORD ve_type; + } VALENTA,*PVALENTA; + + typedef struct value_entW { + LPWSTR ve_valuename; + DWORD ve_valuelen; + DWORD_PTR ve_valueptr; + DWORD ve_type; + } VALENTW,*PVALENTW; + +#ifdef UNICODE + typedef VALENTW VALENT; + typedef PVALENTW PVALENT; +#else + typedef VALENTA VALENT; + typedef PVALENTA PVALENT; +#endif +#endif + +#define WIN31_CLASS NULL + +#ifdef UNICODE +#define RegConnectRegistry RegConnectRegistryW +#define RegConnectRegistryEx RegConnectRegistryExW +#define RegCreateKey RegCreateKeyW +#define RegCreateKeyEx RegCreateKeyExW +#define RegDeleteKey RegDeleteKeyW +#define RegDeleteKeyEx RegDeleteKeyExW +#define RegDeleteValue RegDeleteValueW +#define RegEnumKey RegEnumKeyW +#define RegEnumKeyEx RegEnumKeyExW +#define RegEnumValue RegEnumValueW +#define RegLoadKey RegLoadKeyW +#define RegOpenKey RegOpenKeyW +#define RegOpenKeyEx RegOpenKeyExW +#define RegQueryInfoKey RegQueryInfoKeyW +#define RegQueryValue RegQueryValueW +#define RegQueryMultipleValues RegQueryMultipleValuesW +#define RegQueryValueEx RegQueryValueExW +#define RegReplaceKey RegReplaceKeyW +#define RegRestoreKey RegRestoreKeyW +#define RegSaveKey RegSaveKeyW +#define RegSetValue RegSetValueW +#define RegSetValueEx RegSetValueExW +#define RegUnLoadKey RegUnLoadKeyW +#define RegGetValue RegGetValueW +#define InitiateSystemShutdown InitiateSystemShutdownW +#define AbortSystemShutdown AbortSystemShutdownW +#else +#define RegConnectRegistry RegConnectRegistryA +#define RegConnectRegistryEx RegConnectRegistryExA +#define RegCreateKey RegCreateKeyA +#define RegCreateKeyEx RegCreateKeyExA +#define RegDeleteKey RegDeleteKeyA +#define RegDeleteKeyEx RegDeleteKeyExA +#define RegDeleteValue RegDeleteValueA +#define RegEnumKey RegEnumKeyA +#define RegEnumKeyEx RegEnumKeyExA +#define RegEnumValue RegEnumValueA +#define RegLoadKey RegLoadKeyA +#define RegOpenKey RegOpenKeyA +#define RegOpenKeyEx RegOpenKeyExA +#define RegQueryInfoKey RegQueryInfoKeyA +#define RegQueryValue RegQueryValueA +#define RegQueryMultipleValues RegQueryMultipleValuesA +#define RegQueryValueEx RegQueryValueExA +#define RegReplaceKey RegReplaceKeyA +#define RegRestoreKey RegRestoreKeyA +#define RegSaveKey RegSaveKeyA +#define RegSetValue RegSetValueA +#define RegSetValueEx RegSetValueExA +#define RegUnLoadKey RegUnLoadKeyA +#define RegGetValue RegGetValueA +#define InitiateSystemShutdown InitiateSystemShutdownA +#define AbortSystemShutdown AbortSystemShutdownA +#endif + + WINADVAPI LONG WINAPI RegCloseKey(HKEY hKey); + WINADVAPI LONG WINAPI RegOverridePredefKey(HKEY hKey,HKEY hNewHKey); + WINADVAPI LONG WINAPI RegOpenUserClassesRoot(HANDLE hToken,DWORD dwOptions,REGSAM samDesired,PHKEY phkResult); + WINADVAPI LONG WINAPI RegOpenCurrentUser(REGSAM samDesired,PHKEY phkResult); + WINADVAPI LONG WINAPI RegDisablePredefinedCache(); + WINADVAPI LONG WINAPI RegConnectRegistryA(LPCSTR lpMachineName,HKEY hKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegConnectRegistryW(LPCWSTR lpMachineName,HKEY hKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegConnectRegistryExA(LPCSTR lpMachineName,HKEY hKey,ULONG Flags,PHKEY phkResult); + WINADVAPI LONG WINAPI RegConnectRegistryExW(LPCWSTR lpMachineName,HKEY hKey,ULONG Flags,PHKEY phkResult); + WINADVAPI LONG WINAPI RegCreateKeyA(HKEY hKey,LPCSTR lpSubKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegCreateKeyW(HKEY hKey,LPCWSTR lpSubKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegCreateKeyExA(HKEY hKey,LPCSTR lpSubKey,DWORD Reserved,LPSTR lpClass,DWORD dwOptions,REGSAM samDesired,LPSECURITY_ATTRIBUTES lpSecurityAttributes,PHKEY phkResult,LPDWORD lpdwDisposition); + WINADVAPI LONG WINAPI RegCreateKeyExW(HKEY hKey,LPCWSTR lpSubKey,DWORD Reserved,LPWSTR lpClass,DWORD dwOptions,REGSAM samDesired,LPSECURITY_ATTRIBUTES lpSecurityAttributes,PHKEY phkResult,LPDWORD lpdwDisposition); + WINADVAPI LONG WINAPI RegDeleteKeyA(HKEY hKey,LPCSTR lpSubKey); + WINADVAPI LONG WINAPI RegDeleteKeyW(HKEY hKey,LPCWSTR lpSubKey); + WINADVAPI LONG WINAPI RegDeleteKeyExA(HKEY hKey,LPCSTR lpSubKey,REGSAM samDesired,DWORD Reserved); + WINADVAPI LONG WINAPI RegDeleteKeyExW(HKEY hKey,LPCWSTR lpSubKey,REGSAM samDesired,DWORD Reserved); + WINADVAPI LONG WINAPI RegDisableReflectionKey(HKEY hBase); + WINADVAPI LONG WINAPI RegEnableReflectionKey(HKEY hBase); + WINADVAPI LONG WINAPI RegQueryReflectionKey(HKEY hBase,WINBOOL *bIsReflectionDisabled); + WINADVAPI LONG WINAPI RegDeleteValueA(HKEY hKey,LPCSTR lpValueName); + WINADVAPI LONG WINAPI RegDeleteValueW(HKEY hKey,LPCWSTR lpValueName); + WINADVAPI LONG WINAPI RegEnumKeyA(HKEY hKey,DWORD dwIndex,LPSTR lpName,DWORD cchName); + WINADVAPI LONG WINAPI RegEnumKeyW(HKEY hKey,DWORD dwIndex,LPWSTR lpName,DWORD cchName); + WINADVAPI LONG WINAPI RegEnumKeyExA(HKEY hKey,DWORD dwIndex,LPSTR lpName,LPDWORD lpcchName,LPDWORD lpReserved,LPSTR lpClass,LPDWORD lpcchClass,PFILETIME lpftLastWriteTime); + WINADVAPI LONG WINAPI RegEnumKeyExW(HKEY hKey,DWORD dwIndex,LPWSTR lpName,LPDWORD lpcchName,LPDWORD lpReserved,LPWSTR lpClass,LPDWORD lpcchClass,PFILETIME lpftLastWriteTime); + WINADVAPI LONG WINAPI RegEnumValueA(HKEY hKey,DWORD dwIndex,LPSTR lpValueName,LPDWORD lpcchValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); + WINADVAPI LONG WINAPI RegEnumValueW(HKEY hKey,DWORD dwIndex,LPWSTR lpValueName,LPDWORD lpcchValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); + WINADVAPI LONG WINAPI RegFlushKey(HKEY hKey); + WINADVAPI LONG WINAPI RegGetKeySecurity(HKEY hKey,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,LPDWORD lpcbSecurityDescriptor); + WINADVAPI LONG WINAPI RegLoadKeyA(HKEY hKey,LPCSTR lpSubKey,LPCSTR lpFile); + WINADVAPI LONG WINAPI RegLoadKeyW(HKEY hKey,LPCWSTR lpSubKey,LPCWSTR lpFile); + WINADVAPI LONG WINAPI RegNotifyChangeKeyValue(HKEY hKey,WINBOOL bWatchSubtree,DWORD dwNotifyFilter,HANDLE hEvent,WINBOOL fAsynchronous); + WINADVAPI LONG WINAPI RegOpenKeyA(HKEY hKey,LPCSTR lpSubKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegOpenKeyW(HKEY hKey,LPCWSTR lpSubKey,PHKEY phkResult); + WINADVAPI LONG WINAPI RegOpenKeyExA(HKEY hKey,LPCSTR lpSubKey,DWORD ulOptions,REGSAM samDesired,PHKEY phkResult); + WINADVAPI LONG WINAPI RegOpenKeyExW(HKEY hKey,LPCWSTR lpSubKey,DWORD ulOptions,REGSAM samDesired,PHKEY phkResult); + WINADVAPI LONG WINAPI RegQueryInfoKeyA(HKEY hKey,LPSTR lpClass,LPDWORD lpcchClass,LPDWORD lpReserved,LPDWORD lpcSubKeys,LPDWORD lpcbMaxSubKeyLen,LPDWORD lpcbMaxClassLen,LPDWORD lpcValues,LPDWORD lpcbMaxValueNameLen,LPDWORD lpcbMaxValueLen,LPDWORD lpcbSecurityDescriptor,PFILETIME lpftLastWriteTime); + WINADVAPI LONG WINAPI RegQueryInfoKeyW(HKEY hKey,LPWSTR lpClass,LPDWORD lpcchClass,LPDWORD lpReserved,LPDWORD lpcSubKeys,LPDWORD lpcbMaxSubKeyLen,LPDWORD lpcbMaxClassLen,LPDWORD lpcValues,LPDWORD lpcbMaxValueNameLen,LPDWORD lpcbMaxValueLen,LPDWORD lpcbSecurityDescriptor,PFILETIME lpftLastWriteTime); + WINADVAPI LONG WINAPI RegQueryValueA(HKEY hKey,LPCSTR lpSubKey,LPSTR lpData,PLONG lpcbData); + WINADVAPI LONG WINAPI RegQueryValueW(HKEY hKey,LPCWSTR lpSubKey,LPWSTR lpData,PLONG lpcbData); + WINADVAPI LONG WINAPI RegQueryMultipleValuesA(HKEY hKey,PVALENTA val_list,DWORD num_vals,LPSTR lpValueBuf,LPDWORD ldwTotsize); + WINADVAPI LONG WINAPI RegQueryMultipleValuesW(HKEY hKey,PVALENTW val_list,DWORD num_vals,LPWSTR lpValueBuf,LPDWORD ldwTotsize); + WINADVAPI LONG WINAPI RegQueryValueExA(HKEY hKey,LPCSTR lpValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); + WINADVAPI LONG WINAPI RegQueryValueExW(HKEY hKey,LPCWSTR lpValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); + WINADVAPI LONG WINAPI RegReplaceKeyA(HKEY hKey,LPCSTR lpSubKey,LPCSTR lpNewFile,LPCSTR lpOldFile); + WINADVAPI LONG WINAPI RegReplaceKeyW(HKEY hKey,LPCWSTR lpSubKey,LPCWSTR lpNewFile,LPCWSTR lpOldFile); + WINADVAPI LONG WINAPI RegRestoreKeyA(HKEY hKey,LPCSTR lpFile,DWORD dwFlags); + WINADVAPI LONG WINAPI RegRestoreKeyW(HKEY hKey,LPCWSTR lpFile,DWORD dwFlags); + WINADVAPI LONG WINAPI RegSaveKeyA(HKEY hKey,LPCSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINADVAPI LONG WINAPI RegSaveKeyW(HKEY hKey,LPCWSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + WINADVAPI LONG WINAPI RegSetKeySecurity(HKEY hKey,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor); + WINADVAPI LONG WINAPI RegSetValueA(HKEY hKey,LPCSTR lpSubKey,DWORD dwType,LPCSTR lpData,DWORD cbData); + WINADVAPI LONG WINAPI RegSetValueW(HKEY hKey,LPCWSTR lpSubKey,DWORD dwType,LPCWSTR lpData,DWORD cbData); + WINADVAPI LONG WINAPI RegSetValueExA(HKEY hKey,LPCSTR lpValueName,DWORD Reserved,DWORD dwType,CONST BYTE *lpData,DWORD cbData); + WINADVAPI LONG WINAPI RegSetValueExW(HKEY hKey,LPCWSTR lpValueName,DWORD Reserved,DWORD dwType,CONST BYTE *lpData,DWORD cbData); + WINADVAPI LONG WINAPI RegUnLoadKeyA(HKEY hKey,LPCSTR lpSubKey); + WINADVAPI LONG WINAPI RegUnLoadKeyW(HKEY hKey,LPCWSTR lpSubKey); + WINADVAPI LONG WINAPI RegGetValueA(HKEY hkey,LPCSTR lpSubKey,LPCSTR lpValue,DWORD dwFlags,LPDWORD pdwType,PVOID pvData,LPDWORD pcbData); + WINADVAPI LONG WINAPI RegGetValueW(HKEY hkey,LPCWSTR lpSubKey,LPCWSTR lpValue,DWORD dwFlags,LPDWORD pdwType,PVOID pvData,LPDWORD pcbData); + WINADVAPI WINBOOL WINAPI InitiateSystemShutdownA(LPSTR lpMachineName,LPSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown); + WINADVAPI WINBOOL WINAPI InitiateSystemShutdownW(LPWSTR lpMachineName,LPWSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown); + WINADVAPI WINBOOL WINAPI AbortSystemShutdownA(LPSTR lpMachineName); + WINADVAPI WINBOOL WINAPI AbortSystemShutdownW(LPWSTR lpMachineName); + +//gr #include + +#define REASON_SWINSTALL SHTDN_REASON_MAJOR_SOFTWARE|SHTDN_REASON_MINOR_INSTALLATION +#define REASON_HWINSTALL SHTDN_REASON_MAJOR_HARDWARE|SHTDN_REASON_MINOR_INSTALLATION +#define REASON_SERVICEHANG SHTDN_REASON_MAJOR_SOFTWARE|SHTDN_REASON_MINOR_HUNG +#define REASON_UNSTABLE SHTDN_REASON_MAJOR_SYSTEM|SHTDN_REASON_MINOR_UNSTABLE +#define REASON_SWHWRECONF SHTDN_REASON_MAJOR_SOFTWARE|SHTDN_REASON_MINOR_RECONFIG +#define REASON_OTHER SHTDN_REASON_MAJOR_OTHER|SHTDN_REASON_MINOR_OTHER +#define REASON_UNKNOWN SHTDN_REASON_UNKNOWN +#define REASON_LEGACY_API SHTDN_REASON_LEGACY_API +#define REASON_PLANNED_FLAG SHTDN_REASON_FLAG_PLANNED + +#define MAX_SHUTDOWN_TIMEOUT (10*365*24*60*60) + +#ifdef UNICODE +#define InitiateSystemShutdownEx InitiateSystemShutdownExW +#define RegSaveKeyEx RegSaveKeyExW +#else +#define InitiateSystemShutdownEx InitiateSystemShutdownExA +#define RegSaveKeyEx RegSaveKeyExA +#endif + + WINADVAPI WINBOOL WINAPI InitiateSystemShutdownExA(LPSTR lpMachineName,LPSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown,DWORD dwReason); + WINADVAPI WINBOOL WINAPI InitiateSystemShutdownExW(LPWSTR lpMachineName,LPWSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown,DWORD dwReason); + WINADVAPI LONG WINAPI RegSaveKeyExA(HKEY hKey,LPCSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD Flags); + WINADVAPI LONG WINAPI RegSaveKeyExW(HKEY hKey,LPCWSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD Flags); + WINADVAPI LONG WINAPI Wow64Win32ApiEntry (DWORD dwFuncNumber,DWORD dwFlag,DWORD dwRes); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/winuser.h b/overlay_toolchain/tcc/include/winapi/winuser.h new file mode 100644 index 00000000..4cd9ffb5 --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/winuser.h @@ -0,0 +1,5651 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _WINUSER_ +#define _WINUSER_ + +#define WINUSERAPI DECLSPEC_IMPORT + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#include + +#ifndef NOUSER + typedef HANDLE HDWP; + typedef VOID MENUTEMPLATEA; + typedef VOID MENUTEMPLATEW; + typedef PVOID LPMENUTEMPLATEA; + typedef PVOID LPMENUTEMPLATEW; + +#ifdef UNICODE + typedef MENUTEMPLATEW MENUTEMPLATE; + typedef LPMENUTEMPLATEW LPMENUTEMPLATE; +#else + typedef MENUTEMPLATEA MENUTEMPLATE; + typedef LPMENUTEMPLATEA LPMENUTEMPLATE; +#endif + + typedef LRESULT (CALLBACK *WNDPROC)(HWND,UINT,WPARAM,LPARAM); + typedef INT_PTR (CALLBACK *DLGPROC)(HWND,UINT,WPARAM,LPARAM); + typedef VOID (CALLBACK *TIMERPROC)(HWND,UINT,UINT_PTR,DWORD); + typedef WINBOOL (CALLBACK *GRAYSTRINGPROC)(HDC,LPARAM,int); + typedef WINBOOL (CALLBACK *WNDENUMPROC)(HWND,LPARAM); + typedef LRESULT (CALLBACK *HOOKPROC)(int code,WPARAM wParam,LPARAM lParam); + typedef VOID (CALLBACK *SENDASYNCPROC)(HWND,UINT,ULONG_PTR,LRESULT); + typedef WINBOOL (CALLBACK *PROPENUMPROCA)(HWND,LPCSTR,HANDLE); + typedef WINBOOL (CALLBACK *PROPENUMPROCW)(HWND,LPCWSTR,HANDLE); + typedef WINBOOL (CALLBACK *PROPENUMPROCEXA)(HWND,LPSTR,HANDLE,ULONG_PTR); + typedef WINBOOL (CALLBACK *PROPENUMPROCEXW)(HWND,LPWSTR,HANDLE,ULONG_PTR); + typedef int (CALLBACK *EDITWORDBREAKPROCA)(LPSTR lpch,int ichCurrent,int cch,int code); + typedef int (CALLBACK *EDITWORDBREAKPROCW)(LPWSTR lpch,int ichCurrent,int cch,int code); + typedef WINBOOL (CALLBACK *DRAWSTATEPROC)(HDC hdc,LPARAM lData,WPARAM wData,int cx,int cy); + +#ifdef UNICODE + typedef PROPENUMPROCW PROPENUMPROC; + typedef PROPENUMPROCEXW PROPENUMPROCEX; + typedef EDITWORDBREAKPROCW EDITWORDBREAKPROC; +#else + typedef PROPENUMPROCA PROPENUMPROC; + typedef PROPENUMPROCEXA PROPENUMPROCEX; + typedef EDITWORDBREAKPROCA EDITWORDBREAKPROC; +#endif + + typedef WINBOOL (CALLBACK *NAMEENUMPROCA)(LPSTR,LPARAM); + typedef WINBOOL (CALLBACK *NAMEENUMPROCW)(LPWSTR,LPARAM); + typedef NAMEENUMPROCA WINSTAENUMPROCA; + typedef NAMEENUMPROCA DESKTOPENUMPROCA; + typedef NAMEENUMPROCW WINSTAENUMPROCW; + typedef NAMEENUMPROCW DESKTOPENUMPROCW; + +#ifdef UNICODE + typedef WINSTAENUMPROCW WINSTAENUMPROC; + typedef DESKTOPENUMPROCW DESKTOPENUMPROC; +#else + typedef WINSTAENUMPROCA WINSTAENUMPROC; + typedef DESKTOPENUMPROCA DESKTOPENUMPROC; +#endif + +#define IS_INTRESOURCE(_r) ((((ULONG_PTR)(_r)) >> 16)==0) +#define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i)))) +#define MAKEINTRESOURCEW(i) ((LPWSTR)((ULONG_PTR)((WORD)(i)))) +#ifdef UNICODE +#define MAKEINTRESOURCE MAKEINTRESOURCEW +#else +#define MAKEINTRESOURCE MAKEINTRESOURCEA +#endif + +#ifndef NORESOURCE + +#define RT_CURSOR MAKEINTRESOURCE(1) +#define RT_BITMAP MAKEINTRESOURCE(2) +#define RT_ICON MAKEINTRESOURCE(3) +#define RT_MENU MAKEINTRESOURCE(4) +#define RT_DIALOG MAKEINTRESOURCE(5) +#define RT_STRING MAKEINTRESOURCE(6) +#define RT_FONTDIR MAKEINTRESOURCE(7) +#define RT_FONT MAKEINTRESOURCE(8) +#define RT_ACCELERATOR MAKEINTRESOURCE(9) +#define RT_RCDATA MAKEINTRESOURCE(10) +#define RT_MESSAGETABLE MAKEINTRESOURCE(11) + +#define DIFFERENCE 11 +#define RT_GROUP_CURSOR MAKEINTRESOURCE((ULONG_PTR)RT_CURSOR + DIFFERENCE) +#define RT_GROUP_ICON MAKEINTRESOURCE((ULONG_PTR)RT_ICON + DIFFERENCE) +#define RT_VERSION MAKEINTRESOURCE(16) +#define RT_DLGINCLUDE MAKEINTRESOURCE(17) +#define RT_PLUGPLAY MAKEINTRESOURCE(19) +#define RT_VXD MAKEINTRESOURCE(20) +#define RT_ANICURSOR MAKEINTRESOURCE(21) +#define RT_ANIICON MAKEINTRESOURCE(22) +#define RT_HTML MAKEINTRESOURCE(23) +#ifdef RC_INVOKED +#define RT_MANIFEST 24 +#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 +#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2 +#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3 +#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID 1 +#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID 16 +#else +#define RT_MANIFEST MAKEINTRESOURCE(24) +#define CREATEPROCESS_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(1) +#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(2) +#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(3) +#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(1) +#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(16) +#endif +#endif + +#ifdef UNICODE +#define wvsprintf wvsprintfW +#define wsprintf wsprintfW +#else +#define wvsprintf wvsprintfA +#define wsprintf wsprintfA +#endif + + WINUSERAPI int WINAPI wvsprintfA(LPSTR,LPCSTR,va_list arglist); + WINUSERAPI int WINAPI wvsprintfW(LPWSTR,LPCWSTR,va_list arglist); + WINUSERAPI int WINAPIV wsprintfA(LPSTR,LPCSTR,...); + WINUSERAPI int WINAPIV wsprintfW(LPWSTR,LPCWSTR,...); + +#define SETWALLPAPER_DEFAULT ((LPWSTR)-1) + +#ifndef NOSCROLL +#define SB_HORZ 0 +#define SB_VERT 1 +#define SB_CTL 2 +#define SB_BOTH 3 + +#define SB_LINEUP 0 +#define SB_LINELEFT 0 +#define SB_LINEDOWN 1 +#define SB_LINERIGHT 1 +#define SB_PAGEUP 2 +#define SB_PAGELEFT 2 +#define SB_PAGEDOWN 3 +#define SB_PAGERIGHT 3 +#define SB_THUMBPOSITION 4 +#define SB_THUMBTRACK 5 +#define SB_TOP 6 +#define SB_LEFT 6 +#define SB_BOTTOM 7 +#define SB_RIGHT 7 +#define SB_ENDSCROLL 8 +#endif + +#ifndef NOSHOWWINDOW +#define SW_HIDE 0 +#define SW_SHOWNORMAL 1 +#define SW_NORMAL 1 +#define SW_SHOWMINIMIZED 2 +#define SW_SHOWMAXIMIZED 3 +#define SW_MAXIMIZE 3 +#define SW_SHOWNOACTIVATE 4 +#define SW_SHOW 5 +#define SW_MINIMIZE 6 +#define SW_SHOWMINNOACTIVE 7 +#define SW_SHOWNA 8 +#define SW_RESTORE 9 +#define SW_SHOWDEFAULT 10 +#define SW_FORCEMINIMIZE 11 +#define SW_MAX 11 + +#define HIDE_WINDOW 0 +#define SHOW_OPENWINDOW 1 +#define SHOW_ICONWINDOW 2 +#define SHOW_FULLSCREEN 3 +#define SHOW_OPENNOACTIVATE 4 + +#define SW_PARENTCLOSING 1 +#define SW_OTHERZOOM 2 +#define SW_PARENTOPENING 3 +#define SW_OTHERUNZOOM 4 +#endif + +#define AW_HOR_POSITIVE 0x00000001 +#define AW_HOR_NEGATIVE 0x00000002 +#define AW_VER_POSITIVE 0x00000004 +#define AW_VER_NEGATIVE 0x00000008 +#define AW_CENTER 0x00000010 +#define AW_HIDE 0x00010000 +#define AW_ACTIVATE 0x00020000 +#define AW_SLIDE 0x00040000 +#define AW_BLEND 0x00080000 + +#define KF_EXTENDED 0x0100 +#define KF_DLGMODE 0x0800 +#define KF_MENUMODE 0x1000 +#define KF_ALTDOWN 0x2000 +#define KF_REPEAT 0x4000 +#define KF_UP 0x8000 + +#ifndef NOVIRTUALKEYCODES + +#define VK_LBUTTON 0x01 +#define VK_RBUTTON 0x02 +#define VK_CANCEL 0x03 +#define VK_MBUTTON 0x04 +#define VK_XBUTTON1 0x05 +#define VK_XBUTTON2 0x06 +#define VK_BACK 0x08 +#define VK_TAB 0x09 +#define VK_CLEAR 0x0C +#define VK_RETURN 0x0D +#define VK_SHIFT 0x10 +#define VK_CONTROL 0x11 +#define VK_MENU 0x12 +#define VK_PAUSE 0x13 +#define VK_CAPITAL 0x14 +#define VK_KANA 0x15 +#define VK_HANGEUL 0x15 +#define VK_HANGUL 0x15 +#define VK_JUNJA 0x17 +#define VK_FINAL 0x18 +#define VK_HANJA 0x19 +#define VK_KANJI 0x19 +#define VK_ESCAPE 0x1B +#define VK_CONVERT 0x1C +#define VK_NONCONVERT 0x1D +#define VK_ACCEPT 0x1E +#define VK_MODECHANGE 0x1F +#define VK_SPACE 0x20 +#define VK_PRIOR 0x21 +#define VK_NEXT 0x22 +#define VK_END 0x23 +#define VK_HOME 0x24 +#define VK_LEFT 0x25 +#define VK_UP 0x26 +#define VK_RIGHT 0x27 +#define VK_DOWN 0x28 +#define VK_SELECT 0x29 +#define VK_PRINT 0x2A +#define VK_EXECUTE 0x2B +#define VK_SNAPSHOT 0x2C +#define VK_INSERT 0x2D +#define VK_DELETE 0x2E +#define VK_HELP 0x2F + +#define VK_LWIN 0x5B +#define VK_RWIN 0x5C +#define VK_APPS 0x5D +#define VK_SLEEP 0x5F +#define VK_NUMPAD0 0x60 +#define VK_NUMPAD1 0x61 +#define VK_NUMPAD2 0x62 +#define VK_NUMPAD3 0x63 +#define VK_NUMPAD4 0x64 +#define VK_NUMPAD5 0x65 +#define VK_NUMPAD6 0x66 +#define VK_NUMPAD7 0x67 +#define VK_NUMPAD8 0x68 +#define VK_NUMPAD9 0x69 +#define VK_MULTIPLY 0x6A +#define VK_ADD 0x6B +#define VK_SEPARATOR 0x6C +#define VK_SUBTRACT 0x6D +#define VK_DECIMAL 0x6E +#define VK_DIVIDE 0x6F +#define VK_F1 0x70 +#define VK_F2 0x71 +#define VK_F3 0x72 +#define VK_F4 0x73 +#define VK_F5 0x74 +#define VK_F6 0x75 +#define VK_F7 0x76 +#define VK_F8 0x77 +#define VK_F9 0x78 +#define VK_F10 0x79 +#define VK_F11 0x7A +#define VK_F12 0x7B +#define VK_F13 0x7C +#define VK_F14 0x7D +#define VK_F15 0x7E +#define VK_F16 0x7F +#define VK_F17 0x80 +#define VK_F18 0x81 +#define VK_F19 0x82 +#define VK_F20 0x83 +#define VK_F21 0x84 +#define VK_F22 0x85 +#define VK_F23 0x86 +#define VK_F24 0x87 +#define VK_NUMLOCK 0x90 +#define VK_SCROLL 0x91 +#define VK_OEM_NEC_EQUAL 0x92 +#define VK_OEM_FJ_JISHO 0x92 +#define VK_OEM_FJ_MASSHOU 0x93 +#define VK_OEM_FJ_TOUROKU 0x94 +#define VK_OEM_FJ_LOYA 0x95 +#define VK_OEM_FJ_ROYA 0x96 +#define VK_LSHIFT 0xA0 +#define VK_RSHIFT 0xA1 +#define VK_LCONTROL 0xA2 +#define VK_RCONTROL 0xA3 +#define VK_LMENU 0xA4 +#define VK_RMENU 0xA5 +#define VK_BROWSER_BACK 0xA6 +#define VK_BROWSER_FORWARD 0xA7 +#define VK_BROWSER_REFRESH 0xA8 +#define VK_BROWSER_STOP 0xA9 +#define VK_BROWSER_SEARCH 0xAA +#define VK_BROWSER_FAVORITES 0xAB +#define VK_BROWSER_HOME 0xAC +#define VK_VOLUME_MUTE 0xAD +#define VK_VOLUME_DOWN 0xAE +#define VK_VOLUME_UP 0xAF +#define VK_MEDIA_NEXT_TRACK 0xB0 +#define VK_MEDIA_PREV_TRACK 0xB1 +#define VK_MEDIA_STOP 0xB2 +#define VK_MEDIA_PLAY_PAUSE 0xB3 +#define VK_LAUNCH_MAIL 0xB4 +#define VK_LAUNCH_MEDIA_SELECT 0xB5 +#define VK_LAUNCH_APP1 0xB6 +#define VK_LAUNCH_APP2 0xB7 +#define VK_OEM_1 0xBA +#define VK_OEM_PLUS 0xBB +#define VK_OEM_COMMA 0xBC +#define VK_OEM_MINUS 0xBD +#define VK_OEM_PERIOD 0xBE +#define VK_OEM_2 0xBF +#define VK_OEM_3 0xC0 +#define VK_OEM_4 0xDB +#define VK_OEM_5 0xDC +#define VK_OEM_6 0xDD +#define VK_OEM_7 0xDE +#define VK_OEM_8 0xDF +#define VK_OEM_AX 0xE1 +#define VK_OEM_102 0xE2 +#define VK_ICO_HELP 0xE3 +#define VK_ICO_00 0xE4 +#define VK_PROCESSKEY 0xE5 +#define VK_ICO_CLEAR 0xE6 +#define VK_PACKET 0xE7 +#define VK_OEM_RESET 0xE9 +#define VK_OEM_JUMP 0xEA +#define VK_OEM_PA1 0xEB +#define VK_OEM_PA2 0xEC +#define VK_OEM_PA3 0xED +#define VK_OEM_WSCTRL 0xEE +#define VK_OEM_CUSEL 0xEF +#define VK_OEM_ATTN 0xF0 +#define VK_OEM_FINISH 0xF1 +#define VK_OEM_COPY 0xF2 +#define VK_OEM_AUTO 0xF3 +#define VK_OEM_ENLW 0xF4 +#define VK_OEM_BACKTAB 0xF5 +#define VK_ATTN 0xF6 +#define VK_CRSEL 0xF7 +#define VK_EXSEL 0xF8 +#define VK_EREOF 0xF9 +#define VK_PLAY 0xFA +#define VK_ZOOM 0xFB +#define VK_NONAME 0xFC +#define VK_PA1 0xFD +#define VK_OEM_CLEAR 0xFE +#endif + +#ifndef NOWH + +#define WH_MIN (-1) +#define WH_MSGFILTER (-1) +#define WH_JOURNALRECORD 0 +#define WH_JOURNALPLAYBACK 1 +#define WH_KEYBOARD 2 +#define WH_GETMESSAGE 3 +#define WH_CALLWNDPROC 4 +#define WH_CBT 5 +#define WH_SYSMSGFILTER 6 +#define WH_MOUSE 7 +#define WH_HARDWARE 8 +#define WH_DEBUG 9 +#define WH_SHELL 10 +#define WH_FOREGROUNDIDLE 11 +#define WH_CALLWNDPROCRET 12 + +#define WH_KEYBOARD_LL 13 +#define WH_MOUSE_LL 14 + +#define WH_MAX 14 + +#define WH_MINHOOK WH_MIN +#define WH_MAXHOOK WH_MAX + +#define HC_ACTION 0 +#define HC_GETNEXT 1 +#define HC_SKIP 2 +#define HC_NOREMOVE 3 +#define HC_NOREM HC_NOREMOVE +#define HC_SYSMODALON 4 +#define HC_SYSMODALOFF 5 + +#define HCBT_MOVESIZE 0 +#define HCBT_MINMAX 1 +#define HCBT_QS 2 +#define HCBT_CREATEWND 3 +#define HCBT_DESTROYWND 4 +#define HCBT_ACTIVATE 5 +#define HCBT_CLICKSKIPPED 6 +#define HCBT_KEYSKIPPED 7 +#define HCBT_SYSCOMMAND 8 +#define HCBT_SETFOCUS 9 + + typedef struct tagCBT_CREATEWNDA { + struct tagCREATESTRUCTA *lpcs; + HWND hwndInsertAfter; + } CBT_CREATEWNDA,*LPCBT_CREATEWNDA; + + typedef struct tagCBT_CREATEWNDW { + struct tagCREATESTRUCTW *lpcs; + HWND hwndInsertAfter; + } CBT_CREATEWNDW,*LPCBT_CREATEWNDW; +#ifdef UNICODE + typedef CBT_CREATEWNDW CBT_CREATEWND; + typedef LPCBT_CREATEWNDW LPCBT_CREATEWND; +#else + typedef CBT_CREATEWNDA CBT_CREATEWND; + typedef LPCBT_CREATEWNDA LPCBT_CREATEWND; +#endif + + typedef struct tagCBTACTIVATESTRUCT + { + WINBOOL fMouse; + HWND hWndActive; + } CBTACTIVATESTRUCT,*LPCBTACTIVATESTRUCT; + + typedef struct tagWTSSESSION_NOTIFICATION { + DWORD cbSize; + DWORD dwSessionId; + + } WTSSESSION_NOTIFICATION,*PWTSSESSION_NOTIFICATION; + +#define WTS_CONSOLE_CONNECT 0x1 +#define WTS_CONSOLE_DISCONNECT 0x2 +#define WTS_REMOTE_CONNECT 0x3 +#define WTS_REMOTE_DISCONNECT 0x4 +#define WTS_SESSION_LOGON 0x5 +#define WTS_SESSION_LOGOFF 0x6 +#define WTS_SESSION_LOCK 0x7 +#define WTS_SESSION_UNLOCK 0x8 +#define WTS_SESSION_REMOTE_CONTROL 0x9 + +#define MSGF_DIALOGBOX 0 +#define MSGF_MESSAGEBOX 1 +#define MSGF_MENU 2 +#define MSGF_SCROLLBAR 5 +#define MSGF_NEXTWINDOW 6 +#define MSGF_MAX 8 +#define MSGF_USER 4096 + +#define HSHELL_WINDOWCREATED 1 +#define HSHELL_WINDOWDESTROYED 2 +#define HSHELL_ACTIVATESHELLWINDOW 3 + +#define HSHELL_WINDOWACTIVATED 4 +#define HSHELL_GETMINRECT 5 +#define HSHELL_REDRAW 6 +#define HSHELL_TASKMAN 7 +#define HSHELL_LANGUAGE 8 +#define HSHELL_SYSMENU 9 +#define HSHELL_ENDTASK 10 +#define HSHELL_ACCESSIBILITYSTATE 11 +#define HSHELL_APPCOMMAND 12 +#define HSHELL_WINDOWREPLACED 13 +#define HSHELL_WINDOWREPLACING 14 +#define HSHELL_HIGHBIT 0x8000 +#define HSHELL_FLASH (HSHELL_REDRAW|HSHELL_HIGHBIT) +#define HSHELL_RUDEAPPACTIVATED (HSHELL_WINDOWACTIVATED|HSHELL_HIGHBIT) + +#define ACCESS_STICKYKEYS 0x0001 +#define ACCESS_FILTERKEYS 0x0002 +#define ACCESS_MOUSEKEYS 0x0003 + +#define APPCOMMAND_BROWSER_BACKWARD 1 +#define APPCOMMAND_BROWSER_FORWARD 2 +#define APPCOMMAND_BROWSER_REFRESH 3 +#define APPCOMMAND_BROWSER_STOP 4 +#define APPCOMMAND_BROWSER_SEARCH 5 +#define APPCOMMAND_BROWSER_FAVORITES 6 +#define APPCOMMAND_BROWSER_HOME 7 +#define APPCOMMAND_VOLUME_MUTE 8 +#define APPCOMMAND_VOLUME_DOWN 9 +#define APPCOMMAND_VOLUME_UP 10 +#define APPCOMMAND_MEDIA_NEXTTRACK 11 +#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12 +#define APPCOMMAND_MEDIA_STOP 13 +#define APPCOMMAND_MEDIA_PLAY_PAUSE 14 +#define APPCOMMAND_LAUNCH_MAIL 15 +#define APPCOMMAND_LAUNCH_MEDIA_SELECT 16 +#define APPCOMMAND_LAUNCH_APP1 17 +#define APPCOMMAND_LAUNCH_APP2 18 +#define APPCOMMAND_BASS_DOWN 19 +#define APPCOMMAND_BASS_BOOST 20 +#define APPCOMMAND_BASS_UP 21 +#define APPCOMMAND_TREBLE_DOWN 22 +#define APPCOMMAND_TREBLE_UP 23 +#define APPCOMMAND_MICROPHONE_VOLUME_MUTE 24 +#define APPCOMMAND_MICROPHONE_VOLUME_DOWN 25 +#define APPCOMMAND_MICROPHONE_VOLUME_UP 26 +#define APPCOMMAND_HELP 27 +#define APPCOMMAND_FIND 28 +#define APPCOMMAND_NEW 29 +#define APPCOMMAND_OPEN 30 +#define APPCOMMAND_CLOSE 31 +#define APPCOMMAND_SAVE 32 +#define APPCOMMAND_PRINT 33 +#define APPCOMMAND_UNDO 34 +#define APPCOMMAND_REDO 35 +#define APPCOMMAND_COPY 36 +#define APPCOMMAND_CUT 37 +#define APPCOMMAND_PASTE 38 +#define APPCOMMAND_REPLY_TO_MAIL 39 +#define APPCOMMAND_FORWARD_MAIL 40 +#define APPCOMMAND_SEND_MAIL 41 +#define APPCOMMAND_SPELL_CHECK 42 +#define APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE 43 +#define APPCOMMAND_MIC_ON_OFF_TOGGLE 44 +#define APPCOMMAND_CORRECTION_LIST 45 +#define APPCOMMAND_MEDIA_PLAY 46 +#define APPCOMMAND_MEDIA_PAUSE 47 +#define APPCOMMAND_MEDIA_RECORD 48 +#define APPCOMMAND_MEDIA_FAST_FORWARD 49 +#define APPCOMMAND_MEDIA_REWIND 50 +#define APPCOMMAND_MEDIA_CHANNEL_UP 51 +#define APPCOMMAND_MEDIA_CHANNEL_DOWN 52 + +#define FAPPCOMMAND_MOUSE 0x8000 +#define FAPPCOMMAND_KEY 0 +#define FAPPCOMMAND_OEM 0x1000 +#define FAPPCOMMAND_MASK 0xF000 + +#define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK)) +#define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK)) +#define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM +#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam)) +#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam) + + typedef struct { + HWND hwnd; + RECT rc; + } SHELLHOOKINFO,*LPSHELLHOOKINFO; + + typedef struct tagEVENTMSG { + UINT message; + UINT paramL; + UINT paramH; + DWORD time; + HWND hwnd; + } EVENTMSG,*PEVENTMSGMSG,*NPEVENTMSGMSG,*LPEVENTMSGMSG; + + typedef struct tagEVENTMSG *PEVENTMSG,*NPEVENTMSG,*LPEVENTMSG; + + typedef struct tagCWPSTRUCT { + LPARAM lParam; + WPARAM wParam; + UINT message; + HWND hwnd; + } CWPSTRUCT,*PCWPSTRUCT,*NPCWPSTRUCT,*LPCWPSTRUCT; + + typedef struct tagCWPRETSTRUCT { + LRESULT lResult; + LPARAM lParam; + WPARAM wParam; + UINT message; + HWND hwnd; + } CWPRETSTRUCT,*PCWPRETSTRUCT,*NPCWPRETSTRUCT,*LPCWPRETSTRUCT; + +#define LLKHF_EXTENDED (KF_EXTENDED >> 8) +#define LLKHF_INJECTED 0x00000010 +#define LLKHF_ALTDOWN (KF_ALTDOWN >> 8) +#define LLKHF_UP (KF_UP >> 8) + +#define LLMHF_INJECTED 0x00000001 + + typedef struct tagKBDLLHOOKSTRUCT { + DWORD vkCode; + DWORD scanCode; + DWORD flags; + DWORD time; + ULONG_PTR dwExtraInfo; + } KBDLLHOOKSTRUCT,*LPKBDLLHOOKSTRUCT,*PKBDLLHOOKSTRUCT; + + typedef struct tagMSLLHOOKSTRUCT { + POINT pt; + DWORD mouseData; + DWORD flags; + DWORD time; + ULONG_PTR dwExtraInfo; + } MSLLHOOKSTRUCT,*LPMSLLHOOKSTRUCT,*PMSLLHOOKSTRUCT; + + typedef struct tagDEBUGHOOKINFO { + DWORD idThread; + DWORD idThreadInstaller; + LPARAM lParam; + WPARAM wParam; + int code; + } DEBUGHOOKINFO,*PDEBUGHOOKINFO,*NPDEBUGHOOKINFO,*LPDEBUGHOOKINFO; + + typedef struct tagMOUSEHOOKSTRUCT { + POINT pt; + HWND hwnd; + UINT wHitTestCode; + ULONG_PTR dwExtraInfo; + } MOUSEHOOKSTRUCT,*LPMOUSEHOOKSTRUCT,*PMOUSEHOOKSTRUCT; + +#ifdef __cplusplus + typedef struct tagMOUSEHOOKSTRUCTEX : public tagMOUSEHOOKSTRUCT { + DWORD mouseData; + } MOUSEHOOKSTRUCTEX,*LPMOUSEHOOKSTRUCTEX,*PMOUSEHOOKSTRUCTEX; +#else + typedef struct tagMOUSEHOOKSTRUCTEX { + MOUSEHOOKSTRUCT _unnamed; + DWORD mouseData; + } MOUSEHOOKSTRUCTEX,*LPMOUSEHOOKSTRUCTEX,*PMOUSEHOOKSTRUCTEX; +#endif + + typedef struct tagHARDWAREHOOKSTRUCT { + HWND hwnd; + UINT message; + WPARAM wParam; + LPARAM lParam; + } HARDWAREHOOKSTRUCT,*LPHARDWAREHOOKSTRUCT,*PHARDWAREHOOKSTRUCT; +#endif + +#define HKL_PREV 0 +#define HKL_NEXT 1 + +#define KLF_ACTIVATE 0x00000001 +#define KLF_SUBSTITUTE_OK 0x00000002 +#define KLF_REORDER 0x00000008 +#define KLF_REPLACELANG 0x00000010 +#define KLF_NOTELLSHELL 0x00000080 +#define KLF_SETFORPROCESS 0x00000100 +#define KLF_SHIFTLOCK 0x00010000 +#define KLF_RESET 0x40000000 + +#define INPUTLANGCHANGE_SYSCHARSET 0x0001 +#define INPUTLANGCHANGE_FORWARD 0x0002 +#define INPUTLANGCHANGE_BACKWARD 0x0004 + +#define KL_NAMELENGTH 9 + +#ifdef UNICODE +#define LoadKeyboardLayout LoadKeyboardLayoutW +#define GetKeyboardLayoutName GetKeyboardLayoutNameW +#else +#define LoadKeyboardLayout LoadKeyboardLayoutA +#define GetKeyboardLayoutName GetKeyboardLayoutNameA +#endif + + WINUSERAPI HKL WINAPI LoadKeyboardLayoutA(LPCSTR pwszKLID,UINT Flags); + WINUSERAPI HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID,UINT Flags); + WINUSERAPI HKL WINAPI ActivateKeyboardLayout(HKL hkl,UINT Flags); + WINUSERAPI int WINAPI ToUnicodeEx(UINT wVirtKey,UINT wScanCode,CONST BYTE *lpKeyState,LPWSTR pwszBuff,int cchBuff,UINT wFlags,HKL dwhkl); + WINUSERAPI WINBOOL WINAPI UnloadKeyboardLayout(HKL hkl); + WINUSERAPI WINBOOL WINAPI GetKeyboardLayoutNameA(LPSTR pwszKLID); + WINUSERAPI WINBOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID); + WINUSERAPI int WINAPI GetKeyboardLayoutList(int nBuff,HKL *lpList); + WINUSERAPI HKL WINAPI GetKeyboardLayout(DWORD idThread); + + typedef struct tagMOUSEMOVEPOINT { + int x; + int y; + DWORD time; + ULONG_PTR dwExtraInfo; + } MOUSEMOVEPOINT,*PMOUSEMOVEPOINT,*LPMOUSEMOVEPOINT; + +#define GMMP_USE_DISPLAY_POINTS 1 +#define GMMP_USE_HIGH_RESOLUTION_POINTS 2 + + WINUSERAPI int WINAPI GetMouseMovePointsEx(UINT cbSize,LPMOUSEMOVEPOINT lppt,LPMOUSEMOVEPOINT lpptBuf,int nBufPoints,DWORD resolution); + +#ifndef NODESKTOP + +#define DESKTOP_READOBJECTS 0x0001L +#define DESKTOP_CREATEWINDOW 0x0002L +#define DESKTOP_CREATEMENU 0x0004L +#define DESKTOP_HOOKCONTROL 0x0008L +#define DESKTOP_JOURNALRECORD 0x0010L +#define DESKTOP_JOURNALPLAYBACK 0x0020L +#define DESKTOP_ENUMERATE 0x0040L +#define DESKTOP_WRITEOBJECTS 0x0080L +#define DESKTOP_SWITCHDESKTOP 0x0100L + +#define DF_ALLOWOTHERACCOUNTHOOK 0x0001L + +#ifdef _WINGDI_ +#ifndef NOGDI +#ifdef UNICODE +#define CreateDesktop CreateDesktopW +#else +#define CreateDesktop CreateDesktopA +#endif + + WINUSERAPI HDESK WINAPI CreateDesktopA(LPCSTR lpszDesktop,LPCSTR lpszDevice,LPDEVMODEA pDevmode,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); + WINUSERAPI HDESK WINAPI CreateDesktopW(LPCWSTR lpszDesktop,LPCWSTR lpszDevice,LPDEVMODEW pDevmode,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); +#endif +#endif + +#ifdef UNICODE +#define OpenDesktop OpenDesktopW +#define EnumDesktops EnumDesktopsW +#else +#define OpenDesktop OpenDesktopA +#define EnumDesktops EnumDesktopsA +#endif + + WINUSERAPI HDESK WINAPI OpenDesktopA(LPCSTR lpszDesktop,DWORD dwFlags,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI HDESK WINAPI OpenDesktopW(LPCWSTR lpszDesktop,DWORD dwFlags,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI HDESK WINAPI OpenInputDesktop(DWORD dwFlags,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI WINBOOL WINAPI EnumDesktopsA(HWINSTA hwinsta,DESKTOPENUMPROCA lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI EnumDesktopsW(HWINSTA hwinsta,DESKTOPENUMPROCW lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI EnumDesktopWindows(HDESK hDesktop,WNDENUMPROC lpfn,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI SwitchDesktop(HDESK hDesktop); + WINUSERAPI WINBOOL WINAPI SetThreadDesktop(HDESK hDesktop); + WINUSERAPI WINBOOL WINAPI CloseDesktop(HDESK hDesktop); + WINUSERAPI HDESK WINAPI GetThreadDesktop(DWORD dwThreadId); +#endif + +#ifndef NOWINDOWSTATION +#define WINSTA_ENUMDESKTOPS 0x0001L +#define WINSTA_READATTRIBUTES 0x0002L +#define WINSTA_ACCESSCLIPBOARD 0x0004L +#define WINSTA_CREATEDESKTOP 0x0008L +#define WINSTA_WRITEATTRIBUTES 0x0010L +#define WINSTA_ACCESSGLOBALATOMS 0x0020L +#define WINSTA_EXITWINDOWS 0x0040L +#define WINSTA_ENUMERATE 0x0100L +#define WINSTA_READSCREEN 0x0200L +#define WINSTA_ALL_ACCESS (WINSTA_ENUMDESKTOPS | WINSTA_READATTRIBUTES | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS | WINSTA_ENUMERATE | WINSTA_READSCREEN) + +#define CWF_CREATE_ONLY 0x0001L + +#define WSF_VISIBLE 0x0001L + +#ifdef UNICODE +#define CreateWindowStation CreateWindowStationW +#define OpenWindowStation OpenWindowStationW +#define EnumWindowStations EnumWindowStationsW +#else +#define CreateWindowStation CreateWindowStationA +#define OpenWindowStation OpenWindowStationA +#define EnumWindowStations EnumWindowStationsA +#endif + + WINUSERAPI HWINSTA WINAPI CreateWindowStationA(LPCSTR lpwinsta,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); + WINUSERAPI HWINSTA WINAPI CreateWindowStationW(LPCWSTR lpwinsta,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); + WINUSERAPI HWINSTA WINAPI OpenWindowStationA(LPCSTR lpszWinSta,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI HWINSTA WINAPI OpenWindowStationW(LPCWSTR lpszWinSta,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); + WINUSERAPI WINBOOL WINAPI EnumWindowStationsA(WINSTAENUMPROCA lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI EnumWindowStationsW(WINSTAENUMPROCW lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI CloseWindowStation(HWINSTA hWinSta); + WINUSERAPI WINBOOL WINAPI SetProcessWindowStation(HWINSTA hWinSta); + WINUSERAPI HWINSTA WINAPI GetProcessWindowStation(VOID); +#endif + +#ifndef NOSECURITY + WINUSERAPI WINBOOL WINAPI SetUserObjectSecurity(HANDLE hObj,PSECURITY_INFORMATION pSIRequested,PSECURITY_DESCRIPTOR pSID); + WINUSERAPI WINBOOL WINAPI GetUserObjectSecurity(HANDLE hObj,PSECURITY_INFORMATION pSIRequested,PSECURITY_DESCRIPTOR pSID,DWORD nLength,LPDWORD lpnLengthNeeded); + +#define UOI_FLAGS 1 +#define UOI_NAME 2 +#define UOI_TYPE 3 +#define UOI_USER_SID 4 + + typedef struct tagUSEROBJECTFLAGS { + WINBOOL fInherit; + WINBOOL fReserved; + DWORD dwFlags; + } USEROBJECTFLAGS,*PUSEROBJECTFLAGS; + +#ifdef UNICODE +#define GetUserObjectInformation GetUserObjectInformationW +#define SetUserObjectInformation SetUserObjectInformationW +#else +#define GetUserObjectInformation GetUserObjectInformationA +#define SetUserObjectInformation SetUserObjectInformationA +#endif + + WINUSERAPI WINBOOL WINAPI GetUserObjectInformationA(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength,LPDWORD lpnLengthNeeded); + WINUSERAPI WINBOOL WINAPI GetUserObjectInformationW(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength,LPDWORD lpnLengthNeeded); + WINUSERAPI WINBOOL WINAPI SetUserObjectInformationA(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength); + WINUSERAPI WINBOOL WINAPI SetUserObjectInformationW(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength); +#endif + + typedef struct tagWNDCLASSEXA { + UINT cbSize; + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HINSTANCE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCSTR lpszMenuName; + LPCSTR lpszClassName; + HICON hIconSm; + } WNDCLASSEXA,*PWNDCLASSEXA,*NPWNDCLASSEXA,*LPWNDCLASSEXA; + + typedef struct tagWNDCLASSEXW { + UINT cbSize; + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HINSTANCE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCWSTR lpszMenuName; + LPCWSTR lpszClassName; + + HICON hIconSm; + } WNDCLASSEXW,*PWNDCLASSEXW,*NPWNDCLASSEXW,*LPWNDCLASSEXW; + +#ifdef UNICODE + typedef WNDCLASSEXW WNDCLASSEX; + typedef PWNDCLASSEXW PWNDCLASSEX; + typedef NPWNDCLASSEXW NPWNDCLASSEX; + typedef LPWNDCLASSEXW LPWNDCLASSEX; +#else + typedef WNDCLASSEXA WNDCLASSEX; + typedef PWNDCLASSEXA PWNDCLASSEX; + typedef NPWNDCLASSEXA NPWNDCLASSEX; + typedef LPWNDCLASSEXA LPWNDCLASSEX; +#endif + + typedef struct tagWNDCLASSA { + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HINSTANCE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCSTR lpszMenuName; + LPCSTR lpszClassName; + } WNDCLASSA,*PWNDCLASSA,*NPWNDCLASSA,*LPWNDCLASSA; + + typedef struct tagWNDCLASSW { + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HINSTANCE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCWSTR lpszMenuName; + LPCWSTR lpszClassName; + } WNDCLASSW,*PWNDCLASSW,*NPWNDCLASSW,*LPWNDCLASSW; + +#ifdef UNICODE + typedef WNDCLASSW WNDCLASS; + typedef PWNDCLASSW PWNDCLASS; + typedef NPWNDCLASSW NPWNDCLASS; + typedef LPWNDCLASSW LPWNDCLASS; +#else + typedef WNDCLASSA WNDCLASS; + typedef PWNDCLASSA PWNDCLASS; + typedef NPWNDCLASSA NPWNDCLASS; + typedef LPWNDCLASSA LPWNDCLASS; +#endif + + WINUSERAPI WINBOOL WINAPI IsHungAppWindow(HWND hwnd); + WINUSERAPI VOID WINAPI DisableProcessWindowsGhosting(VOID); + +#ifndef NOMSG + typedef struct tagMSG { + HWND hwnd; + UINT message; + WPARAM wParam; + LPARAM lParam; + DWORD time; + POINT pt; + } MSG,*PMSG,*NPMSG,*LPMSG; + +#define POINTSTOPOINT(pt,pts) { (pt).x = (LONG)(SHORT)LOWORD(*(LONG*)&pts); (pt).y = (LONG)(SHORT)HIWORD(*(LONG*)&pts); } + +#define POINTTOPOINTS(pt) (MAKELONG((short)((pt).x),(short)((pt).y))) +#define MAKEWPARAM(l,h) ((WPARAM)(DWORD)MAKELONG(l,h)) +#define MAKELPARAM(l,h) ((LPARAM)(DWORD)MAKELONG(l,h)) +#define MAKELRESULT(l,h) ((LRESULT)(DWORD)MAKELONG(l,h)) +#endif + +#ifndef NOWINOFFSETS +#define GWL_WNDPROC (-4) +#define GWL_HINSTANCE (-6) +#define GWL_HWNDPARENT (-8) +#define GWL_STYLE (-16) +#define GWL_EXSTYLE (-20) +#define GWL_USERDATA (-21) +#define GWL_ID (-12) + +#ifdef _WIN64 +#undef GWL_WNDPROC +#undef GWL_HINSTANCE +#undef GWL_HWNDPARENT +#undef GWL_USERDATA +#endif + +#define GWLP_WNDPROC (-4) +#define GWLP_HINSTANCE (-6) +#define GWLP_HWNDPARENT (-8) +#define GWLP_USERDATA (-21) +#define GWLP_ID (-12) + +#define GCL_MENUNAME (-8) +#define GCL_HBRBACKGROUND (-10) +#define GCL_HCURSOR (-12) +#define GCL_HICON (-14) +#define GCL_HMODULE (-16) +#define GCL_CBWNDEXTRA (-18) +#define GCL_CBCLSEXTRA (-20) +#define GCL_WNDPROC (-24) +#define GCL_STYLE (-26) +#define GCW_ATOM (-32) +#define GCL_HICONSM (-34) + +#ifdef _WIN64 + +#undef GCL_MENUNAME +#undef GCL_HBRBACKGROUND +#undef GCL_HCURSOR +#undef GCL_HICON +#undef GCL_HMODULE +#undef GCL_WNDPROC +#undef GCL_HICONSM +#endif + +#define GCLP_MENUNAME (-8) +#define GCLP_HBRBACKGROUND (-10) +#define GCLP_HCURSOR (-12) +#define GCLP_HICON (-14) +#define GCLP_HMODULE (-16) +#define GCLP_WNDPROC (-24) +#define GCLP_HICONSM (-34) +#endif + +#ifndef NOWINMESSAGES + +#define WM_NULL 0x0000 +#define WM_CREATE 0x0001 +#define WM_DESTROY 0x0002 +#define WM_MOVE 0x0003 +#define WM_SIZE 0x0005 + +#define WM_ACTIVATE 0x0006 + +#define WA_INACTIVE 0 +#define WA_ACTIVE 1 +#define WA_CLICKACTIVE 2 + +#define WM_SETFOCUS 0x0007 +#define WM_KILLFOCUS 0x0008 +#define WM_ENABLE 0x000A +#define WM_SETREDRAW 0x000B +#define WM_SETTEXT 0x000C +#define WM_GETTEXT 0x000D +#define WM_GETTEXTLENGTH 0x000E +#define WM_PAINT 0x000F +#define WM_CLOSE 0x0010 +#ifndef _WIN32_WCE +#define WM_QUERYENDSESSION 0x0011 +#define WM_QUERYOPEN 0x0013 +#define WM_ENDSESSION 0x0016 +#endif +#define WM_QUIT 0x0012 +#define WM_ERASEBKGND 0x0014 +#define WM_SYSCOLORCHANGE 0x0015 +#define WM_SHOWWINDOW 0x0018 +#define WM_WININICHANGE 0x001A +#define WM_SETTINGCHANGE WM_WININICHANGE +#define WM_DEVMODECHANGE 0x001B +#define WM_ACTIVATEAPP 0x001C +#define WM_FONTCHANGE 0x001D +#define WM_TIMECHANGE 0x001E +#define WM_CANCELMODE 0x001F +#define WM_SETCURSOR 0x0020 +#define WM_MOUSEACTIVATE 0x0021 +#define WM_CHILDACTIVATE 0x0022 +#define WM_QUEUESYNC 0x0023 + +#define WM_GETMINMAXINFO 0x0024 + + typedef struct tagMINMAXINFO { + POINT ptReserved; + POINT ptMaxSize; + POINT ptMaxPosition; + POINT ptMinTrackSize; + POINT ptMaxTrackSize; + } MINMAXINFO,*PMINMAXINFO,*LPMINMAXINFO; + +#define WM_PAINTICON 0x0026 +#define WM_ICONERASEBKGND 0x0027 +#define WM_NEXTDLGCTL 0x0028 +#define WM_SPOOLERSTATUS 0x002A +#define WM_DRAWITEM 0x002B +#define WM_MEASUREITEM 0x002C +#define WM_DELETEITEM 0x002D +#define WM_VKEYTOITEM 0x002E +#define WM_CHARTOITEM 0x002F +#define WM_SETFONT 0x0030 +#define WM_GETFONT 0x0031 +#define WM_SETHOTKEY 0x0032 +#define WM_GETHOTKEY 0x0033 +#define WM_QUERYDRAGICON 0x0037 +#define WM_COMPAREITEM 0x0039 +#ifndef _WIN32_WCE +#define WM_GETOBJECT 0x003D +#endif +#define WM_COMPACTING 0x0041 +#define WM_COMMNOTIFY 0x0044 +#define WM_WINDOWPOSCHANGING 0x0046 +#define WM_WINDOWPOSCHANGED 0x0047 + +#define WM_POWER 0x0048 + +#define PWR_OK 1 +#define PWR_FAIL (-1) +#define PWR_SUSPENDREQUEST 1 +#define PWR_SUSPENDRESUME 2 +#define PWR_CRITICALRESUME 3 + +#define WM_COPYDATA 0x004A +#define WM_CANCELJOURNAL 0x004B + + typedef struct tagCOPYDATASTRUCT { + ULONG_PTR dwData; + DWORD cbData; + PVOID lpData; + } COPYDATASTRUCT,*PCOPYDATASTRUCT; + + typedef struct tagMDINEXTMENU { + HMENU hmenuIn; + HMENU hmenuNext; + HWND hwndNext; + } MDINEXTMENU,*PMDINEXTMENU,*LPMDINEXTMENU; + +#define WM_NOTIFY 0x004E +#define WM_INPUTLANGCHANGEREQUEST 0x0050 +#define WM_INPUTLANGCHANGE 0x0051 +#define WM_TCARD 0x0052 +#define WM_HELP 0x0053 +#define WM_USERCHANGED 0x0054 +#define WM_NOTIFYFORMAT 0x0055 + +#define NFR_ANSI 1 +#define NFR_UNICODE 2 +#define NF_QUERY 3 +#define NF_REQUERY 4 + +#define WM_CONTEXTMENU 0x007B +#define WM_STYLECHANGING 0x007C +#define WM_STYLECHANGED 0x007D +#define WM_DISPLAYCHANGE 0x007E +#define WM_GETICON 0x007F +#define WM_SETICON 0x0080 + +#define WM_NCCREATE 0x0081 +#define WM_NCDESTROY 0x0082 +#define WM_NCCALCSIZE 0x0083 +#define WM_NCHITTEST 0x0084 +#define WM_NCPAINT 0x0085 +#define WM_NCACTIVATE 0x0086 +#define WM_GETDLGCODE 0x0087 +#ifndef _WIN32_WCE +#define WM_SYNCPAINT 0x0088 +#endif +#define WM_NCMOUSEMOVE 0x00A0 +#define WM_NCLBUTTONDOWN 0x00A1 +#define WM_NCLBUTTONUP 0x00A2 +#define WM_NCLBUTTONDBLCLK 0x00A3 +#define WM_NCRBUTTONDOWN 0x00A4 +#define WM_NCRBUTTONUP 0x00A5 +#define WM_NCRBUTTONDBLCLK 0x00A6 +#define WM_NCMBUTTONDOWN 0x00A7 +#define WM_NCMBUTTONUP 0x00A8 +#define WM_NCMBUTTONDBLCLK 0x00A9 + +#define WM_NCXBUTTONDOWN 0x00AB +#define WM_NCXBUTTONUP 0x00AC +#define WM_NCXBUTTONDBLCLK 0x00AD +#define WM_INPUT 0x00FF +#define WM_KEYFIRST 0x0100 +#define WM_KEYDOWN 0x0100 +#define WM_KEYUP 0x0101 +#define WM_CHAR 0x0102 +#define WM_DEADCHAR 0x0103 +#define WM_SYSKEYDOWN 0x0104 +#define WM_SYSKEYUP 0x0105 +#define WM_SYSCHAR 0x0106 +#define WM_SYSDEADCHAR 0x0107 +#define WM_UNICHAR 0x0109 +#define WM_KEYLAST 0x0109 +#define UNICODE_NOCHAR 0xFFFF +#define WM_IME_STARTCOMPOSITION 0x010D +#define WM_IME_ENDCOMPOSITION 0x010E +#define WM_IME_COMPOSITION 0x010F +#define WM_IME_KEYLAST 0x010F +#define WM_INITDIALOG 0x0110 +#define WM_COMMAND 0x0111 +#define WM_SYSCOMMAND 0x0112 +#define WM_TIMER 0x0113 +#define WM_HSCROLL 0x0114 +#define WM_VSCROLL 0x0115 +#define WM_INITMENU 0x0116 +#define WM_INITMENUPOPUP 0x0117 +#define WM_MENUSELECT 0x011F +#define WM_MENUCHAR 0x0120 +#define WM_ENTERIDLE 0x0121 +#ifndef _WIN32_WCE +#define WM_MENURBUTTONUP 0x0122 +#define WM_MENUDRAG 0x0123 +#define WM_MENUGETOBJECT 0x0124 +#define WM_UNINITMENUPOPUP 0x0125 +#define WM_MENUCOMMAND 0x0126 + +#ifndef _WIN32_WCE +#define WM_CHANGEUISTATE 0x0127 +#define WM_UPDATEUISTATE 0x0128 +#define WM_QUERYUISTATE 0x0129 + +#define UIS_SET 1 +#define UIS_CLEAR 2 +#define UIS_INITIALIZE 3 + +#define UISF_HIDEFOCUS 0x1 +#define UISF_HIDEACCEL 0x2 +#define UISF_ACTIVE 0x4 +#endif +#endif + +#define WM_CTLCOLORMSGBOX 0x0132 +#define WM_CTLCOLOREDIT 0x0133 +#define WM_CTLCOLORLISTBOX 0x0134 +#define WM_CTLCOLORBTN 0x0135 +#define WM_CTLCOLORDLG 0x0136 +#define WM_CTLCOLORSCROLLBAR 0x0137 +#define WM_CTLCOLORSTATIC 0x0138 +#define MN_GETHMENU 0x01E1 + +#define WM_MOUSEFIRST 0x0200 +#define WM_MOUSEMOVE 0x0200 +#define WM_LBUTTONDOWN 0x0201 +#define WM_LBUTTONUP 0x0202 +#define WM_LBUTTONDBLCLK 0x0203 +#define WM_RBUTTONDOWN 0x0204 +#define WM_RBUTTONUP 0x0205 +#define WM_RBUTTONDBLCLK 0x0206 +#define WM_MBUTTONDOWN 0x0207 +#define WM_MBUTTONUP 0x0208 +#define WM_MBUTTONDBLCLK 0x0209 +#define WM_MOUSEWHEEL 0x020A +#define WM_XBUTTONDOWN 0x020B +#define WM_XBUTTONUP 0x020C +#define WM_XBUTTONDBLCLK 0x020D +#define WM_MOUSELAST 0x020D + +#define WHEEL_DELTA 120 +#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) + +#define WHEEL_PAGESCROLL (UINT_MAX) + +#define GET_KEYSTATE_WPARAM(wParam) (LOWORD(wParam)) +#define GET_NCHITTEST_WPARAM(wParam) ((short)LOWORD(wParam)) +#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) + +#define XBUTTON1 0x0001 +#define XBUTTON2 0x0002 + +#define WM_PARENTNOTIFY 0x0210 +#define WM_ENTERMENULOOP 0x0211 +#define WM_EXITMENULOOP 0x0212 + +#define WM_NEXTMENU 0x0213 +#define WM_SIZING 0x0214 +#define WM_CAPTURECHANGED 0x0215 +#define WM_MOVING 0x0216 + +#define WM_POWERBROADCAST 0x0218 + +#ifndef _WIN32_WCE +#define PBT_APMQUERYSUSPEND 0x0000 +#define PBT_APMQUERYSTANDBY 0x0001 + +#define PBT_APMQUERYSUSPENDFAILED 0x0002 +#define PBT_APMQUERYSTANDBYFAILED 0x0003 + +#define PBT_APMSUSPEND 0x0004 +#define PBT_APMSTANDBY 0x0005 + +#define PBT_APMRESUMECRITICAL 0x0006 +#define PBT_APMRESUMESUSPEND 0x0007 +#define PBT_APMRESUMESTANDBY 0x0008 + +#define PBTF_APMRESUMEFROMFAILURE 0x00000001 + +#define PBT_APMBATTERYLOW 0x0009 +#define PBT_APMPOWERSTATUSCHANGE 0x000A + +#define PBT_APMOEMEVENT 0x000B +#define PBT_APMRESUMEAUTOMATIC 0x0012 +#endif + +#define WM_DEVICECHANGE 0x0219 + +#define WM_MDICREATE 0x0220 +#define WM_MDIDESTROY 0x0221 +#define WM_MDIACTIVATE 0x0222 +#define WM_MDIRESTORE 0x0223 +#define WM_MDINEXT 0x0224 +#define WM_MDIMAXIMIZE 0x0225 +#define WM_MDITILE 0x0226 +#define WM_MDICASCADE 0x0227 +#define WM_MDIICONARRANGE 0x0228 +#define WM_MDIGETACTIVE 0x0229 + +#define WM_MDISETMENU 0x0230 +#define WM_ENTERSIZEMOVE 0x0231 +#define WM_EXITSIZEMOVE 0x0232 +#define WM_DROPFILES 0x0233 +#define WM_MDIREFRESHMENU 0x0234 + +#define WM_IME_SETCONTEXT 0x0281 +#define WM_IME_NOTIFY 0x0282 +#define WM_IME_CONTROL 0x0283 +#define WM_IME_COMPOSITIONFULL 0x0284 +#define WM_IME_SELECT 0x0285 +#define WM_IME_CHAR 0x0286 +#define WM_IME_REQUEST 0x0288 +#define WM_IME_KEYDOWN 0x0290 +#define WM_IME_KEYUP 0x0291 + +#define WM_MOUSEHOVER 0x02A1 +#define WM_MOUSELEAVE 0x02A3 +#define WM_NCMOUSEHOVER 0x02A0 +#define WM_NCMOUSELEAVE 0x02A2 +#define WM_WTSSESSION_CHANGE 0x02B1 +#define WM_TABLET_FIRST 0x02c0 +#define WM_TABLET_LAST 0x02df +#define WM_CUT 0x0300 +#define WM_COPY 0x0301 +#define WM_PASTE 0x0302 +#define WM_CLEAR 0x0303 +#define WM_UNDO 0x0304 +#define WM_RENDERFORMAT 0x0305 +#define WM_RENDERALLFORMATS 0x0306 +#define WM_DESTROYCLIPBOARD 0x0307 +#define WM_DRAWCLIPBOARD 0x0308 +#define WM_PAINTCLIPBOARD 0x0309 +#define WM_VSCROLLCLIPBOARD 0x030A +#define WM_SIZECLIPBOARD 0x030B +#define WM_ASKCBFORMATNAME 0x030C +#define WM_CHANGECBCHAIN 0x030D +#define WM_HSCROLLCLIPBOARD 0x030E +#define WM_QUERYNEWPALETTE 0x030F +#define WM_PALETTEISCHANGING 0x0310 +#define WM_PALETTECHANGED 0x0311 +#define WM_HOTKEY 0x0312 +#define WM_PRINT 0x0317 +#define WM_PRINTCLIENT 0x0318 +#define WM_APPCOMMAND 0x0319 +#define WM_THEMECHANGED 0x031A +#define WM_HANDHELDFIRST 0x0358 +#define WM_HANDHELDLAST 0x035F +#define WM_AFXFIRST 0x0360 +#define WM_AFXLAST 0x037F +#define WM_PENWINFIRST 0x0380 +#define WM_PENWINLAST 0x038F +#define WM_APP 0x8000 +#define WM_USER 0x0400 + +#define WMSZ_LEFT 1 +#define WMSZ_RIGHT 2 +#define WMSZ_TOP 3 +#define WMSZ_TOPLEFT 4 +#define WMSZ_TOPRIGHT 5 +#define WMSZ_BOTTOM 6 +#define WMSZ_BOTTOMLEFT 7 +#define WMSZ_BOTTOMRIGHT 8 + +#ifndef NONCMESSAGES + +#define HTERROR (-2) +#define HTTRANSPARENT (-1) +#define HTNOWHERE 0 +#define HTCLIENT 1 +#define HTCAPTION 2 +#define HTSYSMENU 3 +#define HTGROWBOX 4 +#define HTSIZE HTGROWBOX +#define HTMENU 5 +#define HTHSCROLL 6 +#define HTVSCROLL 7 +#define HTMINBUTTON 8 +#define HTMAXBUTTON 9 +#define HTLEFT 10 +#define HTRIGHT 11 +#define HTTOP 12 +#define HTTOPLEFT 13 +#define HTTOPRIGHT 14 +#define HTBOTTOM 15 +#define HTBOTTOMLEFT 16 +#define HTBOTTOMRIGHT 17 +#define HTBORDER 18 +#define HTREDUCE HTMINBUTTON +#define HTZOOM HTMAXBUTTON +#define HTSIZEFIRST HTLEFT +#define HTSIZELAST HTBOTTOMRIGHT +#define HTOBJECT 19 +#define HTCLOSE 20 +#define HTHELP 21 + +#define SMTO_NORMAL 0x0000 +#define SMTO_BLOCK 0x0001 +#define SMTO_ABORTIFHUNG 0x0002 +#define SMTO_NOTIMEOUTIFNOTHUNG 0x0008 +#endif + +#define MA_ACTIVATE 1 +#define MA_ACTIVATEANDEAT 2 +#define MA_NOACTIVATE 3 +#define MA_NOACTIVATEANDEAT 4 + +#define ICON_SMALL 0 +#define ICON_BIG 1 +#define ICON_SMALL2 2 + +#ifdef UNICODE +#define RegisterWindowMessage RegisterWindowMessageW +#else +#define RegisterWindowMessage RegisterWindowMessageA +#endif + + WINUSERAPI UINT WINAPI RegisterWindowMessageA(LPCSTR lpString); + WINUSERAPI UINT WINAPI RegisterWindowMessageW(LPCWSTR lpString); + +#define SIZE_RESTORED 0 +#define SIZE_MINIMIZED 1 +#define SIZE_MAXIMIZED 2 +#define SIZE_MAXSHOW 3 +#define SIZE_MAXHIDE 4 + +#define SIZENORMAL SIZE_RESTORED +#define SIZEICONIC SIZE_MINIMIZED +#define SIZEFULLSCREEN SIZE_MAXIMIZED +#define SIZEZOOMSHOW SIZE_MAXSHOW +#define SIZEZOOMHIDE SIZE_MAXHIDE + + typedef struct tagWINDOWPOS { + HWND hwnd; + HWND hwndInsertAfter; + int x; + int y; + int cx; + int cy; + UINT flags; + } WINDOWPOS,*LPWINDOWPOS,*PWINDOWPOS; + + typedef struct tagNCCALCSIZE_PARAMS { + RECT rgrc[3]; + PWINDOWPOS lppos; + } NCCALCSIZE_PARAMS,*LPNCCALCSIZE_PARAMS; + +#define WVR_ALIGNTOP 0x0010 +#define WVR_ALIGNLEFT 0x0020 +#define WVR_ALIGNBOTTOM 0x0040 +#define WVR_ALIGNRIGHT 0x0080 +#define WVR_HREDRAW 0x0100 +#define WVR_VREDRAW 0x0200 +#define WVR_REDRAW (WVR_HREDRAW | WVR_VREDRAW) +#define WVR_VALIDRECTS 0x0400 + +#ifndef NOKEYSTATES + +#define MK_LBUTTON 0x0001 +#define MK_RBUTTON 0x0002 +#define MK_SHIFT 0x0004 +#define MK_CONTROL 0x0008 +#define MK_MBUTTON 0x0010 +#define MK_XBUTTON1 0x0020 +#define MK_XBUTTON2 0x0040 +#endif + +#ifndef NOTRACKMOUSEEVENT +#define TME_HOVER 0x00000001 +#define TME_LEAVE 0x00000002 +#define TME_NONCLIENT 0x00000010 +#define TME_QUERY 0x40000000 +#define TME_CANCEL 0x80000000 + +#define HOVER_DEFAULT 0xFFFFFFFF +#endif + + typedef struct tagTRACKMOUSEEVENT { + DWORD cbSize; + DWORD dwFlags; + HWND hwndTrack; + DWORD dwHoverTime; + } TRACKMOUSEEVENT,*LPTRACKMOUSEEVENT; + + WINUSERAPI WINBOOL WINAPI TrackMouseEvent(LPTRACKMOUSEEVENT lpEventTrack); +#endif + +#ifndef NOWINSTYLES + +#define WS_OVERLAPPED 0x00000000L +#define WS_POPUP 0x80000000L +#define WS_CHILD 0x40000000L +#define WS_MINIMIZE 0x20000000L +#define WS_VISIBLE 0x10000000L +#define WS_DISABLED 0x08000000L +#define WS_CLIPSIBLINGS 0x04000000L +#define WS_CLIPCHILDREN 0x02000000L +#define WS_MAXIMIZE 0x01000000L +#define WS_CAPTION 0x00C00000L +#define WS_BORDER 0x00800000L +#define WS_DLGFRAME 0x00400000L +#define WS_VSCROLL 0x00200000L +#define WS_HSCROLL 0x00100000L +#define WS_SYSMENU 0x00080000L +#define WS_THICKFRAME 0x00040000L +#define WS_GROUP 0x00020000L +#define WS_TABSTOP 0x00010000L +#define WS_MINIMIZEBOX 0x00020000L +#define WS_MAXIMIZEBOX 0x00010000L +#define WS_TILED WS_OVERLAPPED +#define WS_ICONIC WS_MINIMIZE +#define WS_SIZEBOX WS_THICKFRAME +#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW +#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX) +#define WS_POPUPWINDOW (WS_POPUP | WS_BORDER | WS_SYSMENU) +#define WS_CHILDWINDOW (WS_CHILD) + +#define WS_EX_DLGMODALFRAME 0x00000001L +#define WS_EX_NOPARENTNOTIFY 0x00000004L +#define WS_EX_TOPMOST 0x00000008L +#define WS_EX_ACCEPTFILES 0x00000010L +#define WS_EX_TRANSPARENT 0x00000020L +#define WS_EX_MDICHILD 0x00000040L +#define WS_EX_TOOLWINDOW 0x00000080L +#define WS_EX_WINDOWEDGE 0x00000100L +#define WS_EX_CLIENTEDGE 0x00000200L +#define WS_EX_CONTEXTHELP 0x00000400L +#define WS_EX_RIGHT 0x00001000L +#define WS_EX_LEFT 0x00000000L +#define WS_EX_RTLREADING 0x00002000L +#define WS_EX_LTRREADING 0x00000000L +#define WS_EX_LEFTSCROLLBAR 0x00004000L +#define WS_EX_RIGHTSCROLLBAR 0x00000000L +#define WS_EX_CONTROLPARENT 0x00010000L +#define WS_EX_STATICEDGE 0x00020000L +#define WS_EX_APPWINDOW 0x00040000L +#define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE) +#define WS_EX_PALETTEWINDOW (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST) +#define WS_EX_LAYERED 0x00080000 +#define WS_EX_NOINHERITLAYOUT 0x00100000L +#define WS_EX_LAYOUTRTL 0x00400000L +#define WS_EX_COMPOSITED 0x02000000L +#define WS_EX_NOACTIVATE 0x08000000L + +#define CS_VREDRAW 0x0001 +#define CS_HREDRAW 0x0002 +#define CS_DBLCLKS 0x0008 +#define CS_OWNDC 0x0020 +#define CS_CLASSDC 0x0040 +#define CS_PARENTDC 0x0080 +#define CS_NOCLOSE 0x0200 +#define CS_SAVEBITS 0x0800 +#define CS_BYTEALIGNCLIENT 0x1000 +#define CS_BYTEALIGNWINDOW 0x2000 +#define CS_GLOBALCLASS 0x4000 +#define CS_IME 0x00010000 +#define CS_DROPSHADOW 0x00020000 +#endif + +#define PRF_CHECKVISIBLE 0x00000001L +#define PRF_NONCLIENT 0x00000002L +#define PRF_CLIENT 0x00000004L +#define PRF_ERASEBKGND 0x00000008L +#define PRF_CHILDREN 0x00000010L +#define PRF_OWNED 0x00000020L + +#define BDR_RAISEDOUTER 0x0001 +#define BDR_SUNKENOUTER 0x0002 +#define BDR_RAISEDINNER 0x0004 +#define BDR_SUNKENINNER 0x0008 + +#define BDR_OUTER (BDR_RAISEDOUTER | BDR_SUNKENOUTER) +#define BDR_INNER (BDR_RAISEDINNER | BDR_SUNKENINNER) +#define BDR_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER) +#define BDR_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER) + +#define EDGE_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER) +#define EDGE_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER) +#define EDGE_ETCHED (BDR_SUNKENOUTER | BDR_RAISEDINNER) +#define EDGE_BUMP (BDR_RAISEDOUTER | BDR_SUNKENINNER) + +#define BF_LEFT 0x0001 +#define BF_TOP 0x0002 +#define BF_RIGHT 0x0004 +#define BF_BOTTOM 0x0008 + +#define BF_TOPLEFT (BF_TOP | BF_LEFT) +#define BF_TOPRIGHT (BF_TOP | BF_RIGHT) +#define BF_BOTTOMLEFT (BF_BOTTOM | BF_LEFT) +#define BF_BOTTOMRIGHT (BF_BOTTOM | BF_RIGHT) +#define BF_RECT (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM) + +#define BF_DIAGONAL 0x0010 + +#define BF_DIAGONAL_ENDTOPRIGHT (BF_DIAGONAL | BF_TOP | BF_RIGHT) +#define BF_DIAGONAL_ENDTOPLEFT (BF_DIAGONAL | BF_TOP | BF_LEFT) +#define BF_DIAGONAL_ENDBOTTOMLEFT (BF_DIAGONAL | BF_BOTTOM | BF_LEFT) +#define BF_DIAGONAL_ENDBOTTOMRIGHT (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT) + +#define BF_MIDDLE 0x0800 +#define BF_SOFT 0x1000 +#define BF_ADJUST 0x2000 +#define BF_FLAT 0x4000 +#define BF_MONO 0x8000 + + WINUSERAPI WINBOOL WINAPI DrawEdge(HDC hdc,LPRECT qrc,UINT edge,UINT grfFlags); + +#define DFC_CAPTION 1 +#define DFC_MENU 2 +#define DFC_SCROLL 3 +#define DFC_BUTTON 4 +#define DFC_POPUPMENU 5 + +#define DFCS_CAPTIONCLOSE 0x0000 +#define DFCS_CAPTIONMIN 0x0001 +#define DFCS_CAPTIONMAX 0x0002 +#define DFCS_CAPTIONRESTORE 0x0003 +#define DFCS_CAPTIONHELP 0x0004 + +#define DFCS_MENUARROW 0x0000 +#define DFCS_MENUCHECK 0x0001 +#define DFCS_MENUBULLET 0x0002 +#define DFCS_MENUARROWRIGHT 0x0004 +#define DFCS_SCROLLUP 0x0000 +#define DFCS_SCROLLDOWN 0x0001 +#define DFCS_SCROLLLEFT 0x0002 +#define DFCS_SCROLLRIGHT 0x0003 +#define DFCS_SCROLLCOMBOBOX 0x0005 +#define DFCS_SCROLLSIZEGRIP 0x0008 +#define DFCS_SCROLLSIZEGRIPRIGHT 0x0010 + +#define DFCS_BUTTONCHECK 0x0000 +#define DFCS_BUTTONRADIOIMAGE 0x0001 +#define DFCS_BUTTONRADIOMASK 0x0002 +#define DFCS_BUTTONRADIO 0x0004 +#define DFCS_BUTTON3STATE 0x0008 +#define DFCS_BUTTONPUSH 0x0010 + +#define DFCS_INACTIVE 0x0100 +#define DFCS_PUSHED 0x0200 +#define DFCS_CHECKED 0x0400 + +#define DFCS_TRANSPARENT 0x0800 +#define DFCS_HOT 0x1000 + +#define DFCS_ADJUSTRECT 0x2000 +#define DFCS_FLAT 0x4000 +#define DFCS_MONO 0x8000 + + WINUSERAPI WINBOOL WINAPI DrawFrameControl(HDC,LPRECT,UINT,UINT); + +#define DC_ACTIVE 0x0001 +#define DC_SMALLCAP 0x0002 +#define DC_ICON 0x0004 +#define DC_TEXT 0x0008 +#define DC_INBUTTON 0x0010 +#define DC_GRADIENT 0x0020 +#define DC_BUTTONS 0x1000 + + WINUSERAPI WINBOOL WINAPI DrawCaption(HWND hwnd,HDC hdc,CONST RECT *lprect,UINT flags); + +#define IDANI_OPEN 1 +#define IDANI_CAPTION 3 + + WINUSERAPI WINBOOL WINAPI DrawAnimatedRects(HWND hwnd,int idAni,CONST RECT *lprcFrom,CONST RECT *lprcTo); + +#ifndef NOCLIPBOARD + +#define CF_TEXT 1 +#define CF_BITMAP 2 +#define CF_METAFILEPICT 3 +#define CF_SYLK 4 +#define CF_DIF 5 +#define CF_TIFF 6 +#define CF_OEMTEXT 7 +#define CF_DIB 8 +#define CF_PALETTE 9 +#define CF_PENDATA 10 +#define CF_RIFF 11 +#define CF_WAVE 12 +#define CF_UNICODETEXT 13 +#define CF_ENHMETAFILE 14 +#define CF_HDROP 15 +#define CF_LOCALE 16 +#define CF_DIBV5 17 +#define CF_MAX 18 + +#define CF_OWNERDISPLAY 0x0080 +#define CF_DSPTEXT 0x0081 +#define CF_DSPBITMAP 0x0082 +#define CF_DSPMETAFILEPICT 0x0083 +#define CF_DSPENHMETAFILE 0x008E + +#define CF_PRIVATEFIRST 0x0200 +#define CF_PRIVATELAST 0x02FF + +#define CF_GDIOBJFIRST 0x0300 +#define CF_GDIOBJLAST 0x03FF +#endif + +#define FVIRTKEY TRUE +#define FNOINVERT 0x02 +#define FSHIFT 0x04 +#define FCONTROL 0x08 +#define FALT 0x10 + + typedef struct tagACCEL { + BYTE fVirt; + WORD key; + WORD cmd; + } ACCEL,*LPACCEL; + + typedef struct tagPAINTSTRUCT { + HDC hdc; + WINBOOL fErase; + RECT rcPaint; + WINBOOL fRestore; + WINBOOL fIncUpdate; + BYTE rgbReserved[32]; + } PAINTSTRUCT,*PPAINTSTRUCT,*NPPAINTSTRUCT,*LPPAINTSTRUCT; + + typedef struct tagCREATESTRUCTA { + LPVOID lpCreateParams; + HINSTANCE hInstance; + HMENU hMenu; + HWND hwndParent; + int cy; + int cx; + int y; + int x; + LONG style; + LPCSTR lpszName; + LPCSTR lpszClass; + DWORD dwExStyle; + } CREATESTRUCTA,*LPCREATESTRUCTA; + + typedef struct tagCREATESTRUCTW { + LPVOID lpCreateParams; + HINSTANCE hInstance; + HMENU hMenu; + HWND hwndParent; + int cy; + int cx; + int y; + int x; + LONG style; + LPCWSTR lpszName; + LPCWSTR lpszClass; + DWORD dwExStyle; + } CREATESTRUCTW,*LPCREATESTRUCTW; + +#ifdef UNICODE + typedef CREATESTRUCTW CREATESTRUCT; + typedef LPCREATESTRUCTW LPCREATESTRUCT; +#else + typedef CREATESTRUCTA CREATESTRUCT; + typedef LPCREATESTRUCTA LPCREATESTRUCT; +#endif + + typedef struct tagWINDOWPLACEMENT { + UINT length; + UINT flags; + UINT showCmd; + POINT ptMinPosition; + POINT ptMaxPosition; + RECT rcNormalPosition; + } WINDOWPLACEMENT; + typedef WINDOWPLACEMENT *PWINDOWPLACEMENT,*LPWINDOWPLACEMENT; + +#define WPF_SETMINPOSITION 0x0001 +#define WPF_RESTORETOMAXIMIZED 0x0002 +#define WPF_ASYNCWINDOWPLACEMENT 0x0004 + + typedef struct tagNMHDR { + HWND hwndFrom; + UINT_PTR idFrom; + UINT code; + } NMHDR; + + typedef NMHDR *LPNMHDR; + + typedef struct tagSTYLESTRUCT { + DWORD styleOld; + DWORD styleNew; + } STYLESTRUCT,*LPSTYLESTRUCT; + +#define ODT_MENU 1 +#define ODT_LISTBOX 2 +#define ODT_COMBOBOX 3 +#define ODT_BUTTON 4 +#define ODT_STATIC 5 + +#define ODA_DRAWENTIRE 0x0001 +#define ODA_SELECT 0x0002 +#define ODA_FOCUS 0x0004 + +#define ODS_SELECTED 0x0001 +#define ODS_GRAYED 0x0002 +#define ODS_DISABLED 0x0004 +#define ODS_CHECKED 0x0008 +#define ODS_FOCUS 0x0010 +#define ODS_DEFAULT 0x0020 +#define ODS_COMBOBOXEDIT 0x1000 +#define ODS_HOTLIGHT 0x0040 +#define ODS_INACTIVE 0x0080 +#define ODS_NOACCEL 0x0100 +#define ODS_NOFOCUSRECT 0x0200 + + typedef struct tagMEASUREITEMSTRUCT { + UINT CtlType; + UINT CtlID; + UINT itemID; + UINT itemWidth; + UINT itemHeight; + ULONG_PTR itemData; + } MEASUREITEMSTRUCT,*PMEASUREITEMSTRUCT,*LPMEASUREITEMSTRUCT; + + typedef struct tagDRAWITEMSTRUCT { + UINT CtlType; + UINT CtlID; + UINT itemID; + UINT itemAction; + UINT itemState; + HWND hwndItem; + HDC hDC; + RECT rcItem; + ULONG_PTR itemData; + } DRAWITEMSTRUCT,*PDRAWITEMSTRUCT,*LPDRAWITEMSTRUCT; + + typedef struct tagDELETEITEMSTRUCT { + UINT CtlType; + UINT CtlID; + UINT itemID; + HWND hwndItem; + ULONG_PTR itemData; + } DELETEITEMSTRUCT,*PDELETEITEMSTRUCT,*LPDELETEITEMSTRUCT; + + typedef struct tagCOMPAREITEMSTRUCT { + UINT CtlType; + UINT CtlID; + HWND hwndItem; + UINT itemID1; + ULONG_PTR itemData1; + UINT itemID2; + ULONG_PTR itemData2; + DWORD dwLocaleId; + } COMPAREITEMSTRUCT,*PCOMPAREITEMSTRUCT,*LPCOMPAREITEMSTRUCT; + +#ifndef NOMSG +#ifdef UNICODE +#define GetMessage GetMessageW +#define DispatchMessage DispatchMessageW +#define PeekMessage PeekMessageW +#else +#define GetMessage GetMessageA +#define DispatchMessage DispatchMessageA +#define PeekMessage PeekMessageA +#endif + + WINUSERAPI WINBOOL WINAPI GetMessageA(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax); + WINUSERAPI WINBOOL WINAPI GetMessageW(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax); + WINUSERAPI WINBOOL WINAPI TranslateMessage(CONST MSG *lpMsg); + WINUSERAPI LRESULT WINAPI DispatchMessageA(CONST MSG *lpMsg); + WINUSERAPI LRESULT WINAPI DispatchMessageW(CONST MSG *lpMsg); + WINUSERAPI WINBOOL WINAPI SetMessageQueue(int cMessagesMax); + WINUSERAPI WINBOOL WINAPI PeekMessageA(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax,UINT wRemoveMsg); + WINUSERAPI WINBOOL WINAPI PeekMessageW(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax,UINT wRemoveMsg); + +#define PM_NOREMOVE 0x0000 +#define PM_REMOVE 0x0001 +#define PM_NOYIELD 0x0002 +#define PM_QS_INPUT (QS_INPUT << 16) +#define PM_QS_POSTMESSAGE ((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16) +#define PM_QS_PAINT (QS_PAINT << 16) +#define PM_QS_SENDMESSAGE (QS_SENDMESSAGE << 16) +#endif + + WINUSERAPI WINBOOL WINAPI RegisterHotKey(HWND hWnd,int id,UINT fsModifiers,UINT vk); + WINUSERAPI WINBOOL WINAPI UnregisterHotKey(HWND hWnd,int id); + +#define MOD_ALT 0x0001 +#define MOD_CONTROL 0x0002 +#define MOD_SHIFT 0x0004 +#define MOD_WIN 0x0008 + +#define IDHOT_SNAPWINDOW (-1) +#define IDHOT_SNAPDESKTOP (-2) + +#ifdef WIN_INTERNAL +#ifndef LSTRING +#define NOLSTRING +#endif +#ifndef LFILEIO +#define NOLFILEIO +#endif +#endif + +#define ENDSESSION_LOGOFF 0x80000000 + +#define EWX_LOGOFF 0 +#define EWX_SHUTDOWN 0x00000001 +#define EWX_REBOOT 0x00000002 +#define EWX_FORCE 0x00000004 +#define EWX_POWEROFF 0x00000008 +#define EWX_FORCEIFHUNG 0x00000010 + +#define ExitWindows(dwReserved,Code) ExitWindowsEx(EWX_LOGOFF,0xFFFFFFFF) + +#ifdef UNICODE +#define SendMessage SendMessageW +#define SendMessageTimeout SendMessageTimeoutW +#define SendNotifyMessage SendNotifyMessageW +#define SendMessageCallback SendMessageCallbackW +#else +#define SendMessage SendMessageA +#define SendMessageTimeout SendMessageTimeoutA +#define SendNotifyMessage SendNotifyMessageA +#define SendMessageCallback SendMessageCallbackA +#endif + + WINUSERAPI WINBOOL WINAPI ExitWindowsEx(UINT uFlags,DWORD dwReason); + WINUSERAPI WINBOOL WINAPI SwapMouseButton(WINBOOL fSwap); + WINUSERAPI DWORD WINAPI GetMessagePos(VOID); + WINUSERAPI LONG WINAPI GetMessageTime(VOID); + WINUSERAPI LPARAM WINAPI GetMessageExtraInfo(VOID); + WINUSERAPI WINBOOL WINAPI IsWow64Message(VOID); + WINUSERAPI LPARAM WINAPI SetMessageExtraInfo(LPARAM lParam); + WINUSERAPI LRESULT WINAPI SendMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI SendMessageW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI SendMessageTimeoutA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,UINT fuFlags,UINT uTimeout,PDWORD_PTR lpdwResult); + WINUSERAPI LRESULT WINAPI SendMessageTimeoutW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,UINT fuFlags,UINT uTimeout,PDWORD_PTR lpdwResult); + WINUSERAPI WINBOOL WINAPI SendNotifyMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI SendNotifyMessageW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI SendMessageCallbackA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,SENDASYNCPROC lpResultCallBack,ULONG_PTR dwData); + WINUSERAPI WINBOOL WINAPI SendMessageCallbackW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,SENDASYNCPROC lpResultCallBack,ULONG_PTR dwData); + + typedef struct { + UINT cbSize; + HDESK hdesk; + HWND hwnd; + LUID luid; + } BSMINFO,*PBSMINFO; + +#ifdef UNICODE +#define BroadcastSystemMessageEx BroadcastSystemMessageExW +#define BroadcastSystemMessage BroadcastSystemMessageW +#else +#define BroadcastSystemMessageEx BroadcastSystemMessageExA +#define BroadcastSystemMessage BroadcastSystemMessageA +#endif + + WINUSERAPI long WINAPI BroadcastSystemMessageExA(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam,PBSMINFO pbsmInfo); + WINUSERAPI long WINAPI BroadcastSystemMessageExW(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam,PBSMINFO pbsmInfo); + WINUSERAPI long WINAPI BroadcastSystemMessageA(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI long WINAPI BroadcastSystemMessageW(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam); + +#define BSM_ALLCOMPONENTS 0x00000000 +#define BSM_VXDS 0x00000001 +#define BSM_NETDRIVER 0x00000002 +#define BSM_INSTALLABLEDRIVERS 0x00000004 +#define BSM_APPLICATIONS 0x00000008 +#define BSM_ALLDESKTOPS 0x00000010 + +#define BSF_QUERY 0x00000001 +#define BSF_IGNORECURRENTTASK 0x00000002 +#define BSF_FLUSHDISK 0x00000004 +#define BSF_NOHANG 0x00000008 +#define BSF_POSTMESSAGE 0x00000010 +#define BSF_FORCEIFHUNG 0x00000020 +#define BSF_NOTIMEOUTIFNOTHUNG 0x00000040 +#define BSF_ALLOWSFW 0x00000080 +#define BSF_SENDNOTIFYMESSAGE 0x00000100 +#define BSF_RETURNHDESK 0x00000200 +#define BSF_LUID 0x00000400 + +#define BROADCAST_QUERY_DENY 0x424D5144 + + typedef PVOID HDEVNOTIFY; + typedef HDEVNOTIFY *PHDEVNOTIFY; + +#define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000 +#define DEVICE_NOTIFY_SERVICE_HANDLE 0x00000001 +#define DEVICE_NOTIFY_ALL_INTERFACE_CLASSES 0x00000004 + +#ifdef UNICODE +#define RegisterDeviceNotification RegisterDeviceNotificationW +#define PostMessage PostMessageW +#define PostThreadMessage PostThreadMessageW +#define PostAppMessage PostAppMessageW +#define DefWindowProc DefWindowProcW +#define CallWindowProc CallWindowProcW +#define RegisterClass RegisterClassW +#define UnregisterClass UnregisterClassW +#define GetClassInfo GetClassInfoW +#define RegisterClassEx RegisterClassExW +#define GetClassInfoEx GetClassInfoExW +#else +#define RegisterDeviceNotification RegisterDeviceNotificationA +#define PostMessage PostMessageA +#define PostThreadMessage PostThreadMessageA +#define PostAppMessage PostAppMessageA +#define DefWindowProc DefWindowProcA +#define CallWindowProc CallWindowProcA +#define RegisterClass RegisterClassA +#define UnregisterClass UnregisterClassA +#define GetClassInfo GetClassInfoA +#define RegisterClassEx RegisterClassExA +#define GetClassInfoEx GetClassInfoExA +#endif + + WINUSERAPI HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE hRecipient,LPVOID NotificationFilter,DWORD Flags); + WINUSERAPI HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE hRecipient,LPVOID NotificationFilter,DWORD Flags); + WINUSERAPI WINBOOL WINAPI UnregisterDeviceNotification(HDEVNOTIFY Handle); + WINUSERAPI WINBOOL WINAPI PostMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI PostMessageW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI PostThreadMessageA(DWORD idThread,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI PostThreadMessageW(DWORD idThread,UINT Msg,WPARAM wParam,LPARAM lParam); +#define PostAppMessageA(idThread,wMsg,wParam,lParam) PostThreadMessageA((DWORD)idThread,wMsg,wParam,lParam) +#define PostAppMessageW(idThread,wMsg,wParam,lParam) PostThreadMessageW((DWORD)idThread,wMsg,wParam,lParam) + +#define HWND_BROADCAST ((HWND)0xffff) +#define HWND_MESSAGE ((HWND)-3) + + WINUSERAPI WINBOOL WINAPI AttachThreadInput(DWORD idAttach,DWORD idAttachTo,WINBOOL fAttach); + WINUSERAPI WINBOOL WINAPI ReplyMessage(LRESULT lResult); + WINUSERAPI WINBOOL WINAPI WaitMessage(VOID); + WINUSERAPI DWORD WINAPI WaitForInputIdle(HANDLE hProcess,DWORD dwMilliseconds); + WINUSERAPI LRESULT WINAPI DefWindowProcA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefWindowProcW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI VOID WINAPI PostQuitMessage(int nExitCode); + WINUSERAPI LRESULT WINAPI CallWindowProcA(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI CallWindowProcW(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI InSendMessage(VOID); + WINUSERAPI DWORD WINAPI InSendMessageEx(LPVOID lpReserved); + +#define ISMEX_NOSEND 0x00000000 +#define ISMEX_SEND 0x00000001 +#define ISMEX_NOTIFY 0x00000002 +#define ISMEX_CALLBACK 0x00000004 +#define ISMEX_REPLIED 0x00000008 + + WINUSERAPI UINT WINAPI GetDoubleClickTime(VOID); + WINUSERAPI WINBOOL WINAPI SetDoubleClickTime(UINT); + WINUSERAPI ATOM WINAPI RegisterClassA(CONST WNDCLASSA *lpWndClass); + WINUSERAPI ATOM WINAPI RegisterClassW(CONST WNDCLASSW *lpWndClass); + WINUSERAPI WINBOOL WINAPI UnregisterClassA(LPCSTR lpClassName,HINSTANCE hInstance); + WINUSERAPI WINBOOL WINAPI UnregisterClassW(LPCWSTR lpClassName,HINSTANCE hInstance); + WINUSERAPI WINBOOL WINAPI GetClassInfoA(HINSTANCE hInstance,LPCSTR lpClassName,LPWNDCLASSA lpWndClass); + WINUSERAPI WINBOOL WINAPI GetClassInfoW(HINSTANCE hInstance,LPCWSTR lpClassName,LPWNDCLASSW lpWndClass); + WINUSERAPI ATOM WINAPI RegisterClassExA(CONST WNDCLASSEXA *); + WINUSERAPI ATOM WINAPI RegisterClassExW(CONST WNDCLASSEXW *); + WINUSERAPI WINBOOL WINAPI GetClassInfoExA(HINSTANCE hInstance,LPCSTR lpszClass,LPWNDCLASSEXA lpwcx); + WINUSERAPI WINBOOL WINAPI GetClassInfoExW(HINSTANCE hInstance,LPCWSTR lpszClass,LPWNDCLASSEXW lpwcx); + +#define CW_USEDEFAULT ((int)0x80000000) + +#define HWND_DESKTOP ((HWND)0) + + typedef BOOLEAN (WINAPI *PREGISTERCLASSNAMEW)(LPCWSTR); + +#ifdef UNICODE +#define CreateWindowEx CreateWindowExW +#define CreateWindow CreateWindowW +#else +#define CreateWindowEx CreateWindowExA +#define CreateWindow CreateWindowA +#endif + + WINUSERAPI HWND WINAPI CreateWindowExA(DWORD dwExStyle,LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam); + WINUSERAPI HWND WINAPI CreateWindowExW(DWORD dwExStyle,LPCWSTR lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam); +#define CreateWindowA(lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) CreateWindowExA(0L,lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) +#define CreateWindowW(lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) CreateWindowExW(0L,lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) + WINUSERAPI WINBOOL WINAPI IsWindow(HWND hWnd); + WINUSERAPI WINBOOL WINAPI IsMenu(HMENU hMenu); + WINUSERAPI WINBOOL WINAPI IsChild(HWND hWndParent,HWND hWnd); + WINUSERAPI WINBOOL WINAPI DestroyWindow(HWND hWnd); + WINUSERAPI WINBOOL WINAPI ShowWindow(HWND hWnd,int nCmdShow); + WINUSERAPI WINBOOL WINAPI AnimateWindow(HWND hWnd,DWORD dwTime,DWORD dwFlags); + +#if defined(_WINGDI_) && !defined(NOGDI) + WINUSERAPI WINBOOL WINAPI UpdateLayeredWindow(HWND hWnd,HDC hdcDst,POINT *pptDst,SIZE *psize,HDC hdcSrc,POINT *pptSrc,COLORREF crKey,BLENDFUNCTION *pblend,DWORD dwFlags); + + typedef struct tagUPDATELAYEREDWINDOWINFO { + DWORD cbSize; + HDC hdcDst; + POINT CONST *pptDst; + SIZE CONST *psize; + HDC hdcSrc; + POINT CONST *pptSrc; + COLORREF crKey; + BLENDFUNCTION CONST *pblend; + DWORD dwFlags; + RECT CONST *prcDirty; + } UPDATELAYEREDWINDOWINFO,*PUPDATELAYEREDWINDOWINFO; + + WINUSERAPI WINBOOL WINAPI UpdateLayeredWindowIndirect(HWND hWnd,UPDATELAYEREDWINDOWINFO CONST *pULWInfo); + WINUSERAPI WINBOOL WINAPI GetLayeredWindowAttributes(HWND hwnd,COLORREF *pcrKey,BYTE *pbAlpha,DWORD *pdwFlags); + +#define PW_CLIENTONLY 0x00000001 + + WINUSERAPI WINBOOL WINAPI PrintWindow(HWND hwnd,HDC hdcBlt,UINT nFlags); + WINUSERAPI WINBOOL WINAPI SetLayeredWindowAttributes(HWND hwnd,COLORREF crKey,BYTE bAlpha,DWORD dwFlags); + +#define LWA_COLORKEY 0x00000001 +#define LWA_ALPHA 0x00000002 + +#define ULW_COLORKEY 0x00000001 +#define ULW_ALPHA 0x00000002 +#define ULW_OPAQUE 0x00000004 + +#define ULW_EX_NORESIZE 0x00000008 + + WINUSERAPI WINBOOL WINAPI ShowWindowAsync(HWND hWnd,int nCmdShow); + WINUSERAPI WINBOOL WINAPI FlashWindow(HWND hWnd,WINBOOL bInvert); + + typedef struct { + UINT cbSize; + HWND hwnd; + DWORD dwFlags; + UINT uCount; + DWORD dwTimeout; + } FLASHWINFO,*PFLASHWINFO; + + WINUSERAPI WINBOOL WINAPI FlashWindowEx(PFLASHWINFO pfwi); + +#define FLASHW_STOP 0 +#define FLASHW_CAPTION 0x00000001 +#define FLASHW_TRAY 0x00000002 +#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY) +#define FLASHW_TIMER 0x00000004 +#define FLASHW_TIMERNOFG 0x0000000C + + WINUSERAPI WINBOOL WINAPI ShowOwnedPopups(HWND hWnd,WINBOOL fShow); + WINUSERAPI WINBOOL WINAPI OpenIcon(HWND hWnd); + WINUSERAPI WINBOOL WINAPI CloseWindow(HWND hWnd); + WINUSERAPI WINBOOL WINAPI MoveWindow(HWND hWnd,int X,int Y,int nWidth,int nHeight,WINBOOL bRepaint); + WINUSERAPI WINBOOL WINAPI SetWindowPos(HWND hWnd,HWND hWndInsertAfter,int X,int Y,int cx,int cy,UINT uFlags); + WINUSERAPI WINBOOL WINAPI GetWindowPlacement(HWND hWnd,WINDOWPLACEMENT *lpwndpl); + WINUSERAPI WINBOOL WINAPI SetWindowPlacement(HWND hWnd,CONST WINDOWPLACEMENT *lpwndpl); + +#ifndef NODEFERWINDOWPOS + WINUSERAPI HDWP WINAPI BeginDeferWindowPos(int nNumWindows); + WINUSERAPI HDWP WINAPI DeferWindowPos(HDWP hWinPosInfo,HWND hWnd,HWND hWndInsertAfter,int x,int y,int cx,int cy,UINT uFlags); + WINUSERAPI WINBOOL WINAPI EndDeferWindowPos(HDWP hWinPosInfo); +#endif + + WINUSERAPI WINBOOL WINAPI IsWindowVisible(HWND hWnd); + WINUSERAPI WINBOOL WINAPI IsIconic(HWND hWnd); + WINUSERAPI WINBOOL WINAPI AnyPopup(VOID); + WINUSERAPI WINBOOL WINAPI BringWindowToTop(HWND hWnd); + WINUSERAPI WINBOOL WINAPI IsZoomed(HWND hWnd); + +#define SWP_NOSIZE 0x0001 +#define SWP_NOMOVE 0x0002 +#define SWP_NOZORDER 0x0004 +#define SWP_NOREDRAW 0x0008 +#define SWP_NOACTIVATE 0x0010 +#define SWP_FRAMECHANGED 0x0020 +#define SWP_SHOWWINDOW 0x0040 +#define SWP_HIDEWINDOW 0x0080 +#define SWP_NOCOPYBITS 0x0100 +#define SWP_NOOWNERZORDER 0x0200 +#define SWP_NOSENDCHANGING 0x0400 + +#define SWP_DRAWFRAME SWP_FRAMECHANGED +#define SWP_NOREPOSITION SWP_NOOWNERZORDER +#define SWP_DEFERERASE 0x2000 +#define SWP_ASYNCWINDOWPOS 0x4000 + +#define HWND_TOP ((HWND)0) +#define HWND_BOTTOM ((HWND)1) +#define HWND_TOPMOST ((HWND)-1) +#define HWND_NOTOPMOST ((HWND)-2) + +#ifndef NOCTLMGR + +#include + + typedef struct { + DWORD style; + DWORD dwExtendedStyle; + WORD cdit; + short x; + short y; + short cx; + short cy; + } DLGTEMPLATE; + + typedef DLGTEMPLATE *LPDLGTEMPLATEA; + typedef DLGTEMPLATE *LPDLGTEMPLATEW; + +#ifdef UNICODE + typedef LPDLGTEMPLATEW LPDLGTEMPLATE; +#else + typedef LPDLGTEMPLATEA LPDLGTEMPLATE; +#endif + + typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEA; + typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEW; + +#ifdef UNICODE + typedef LPCDLGTEMPLATEW LPCDLGTEMPLATE; +#else + typedef LPCDLGTEMPLATEA LPCDLGTEMPLATE; +#endif + + typedef struct { + DWORD style; + DWORD dwExtendedStyle; + short x; + short y; + short cx; + short cy; + WORD id; + } DLGITEMTEMPLATE; + + typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEA; + typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEW; + +#ifdef UNICODE + typedef PDLGITEMTEMPLATEW PDLGITEMTEMPLATE; +#else + typedef PDLGITEMTEMPLATEA PDLGITEMTEMPLATE; +#endif + + typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEA; + typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEW; + +#ifdef UNICODE + typedef LPDLGITEMTEMPLATEW LPDLGITEMTEMPLATE; +#else + typedef LPDLGITEMTEMPLATEA LPDLGITEMTEMPLATE; +#endif + +#include + +#ifdef UNICODE +#define CreateDialogParam CreateDialogParamW +#define CreateDialogIndirectParam CreateDialogIndirectParamW +#define CreateDialog CreateDialogW +#define CreateDialogIndirect CreateDialogIndirectW +#define DialogBoxParam DialogBoxParamW +#define DialogBoxIndirectParam DialogBoxIndirectParamW +#define DialogBox DialogBoxW +#define DialogBoxIndirect DialogBoxIndirectW +#define SetDlgItemText SetDlgItemTextW +#define GetDlgItemText GetDlgItemTextW +#define SendDlgItemMessage SendDlgItemMessageW +#define DefDlgProc DefDlgProcW +#else +#define CreateDialogParam CreateDialogParamA +#define CreateDialogIndirectParam CreateDialogIndirectParamA +#define CreateDialog CreateDialogA +#define CreateDialogIndirect CreateDialogIndirectA +#define DialogBoxParam DialogBoxParamA +#define DialogBoxIndirectParam DialogBoxIndirectParamA +#define DialogBox DialogBoxA +#define DialogBoxIndirect DialogBoxIndirectA +#define SetDlgItemText SetDlgItemTextA +#define GetDlgItemText GetDlgItemTextA +#define SendDlgItemMessage SendDlgItemMessageA +#define DefDlgProc DefDlgProcA +#endif + + WINUSERAPI HWND WINAPI CreateDialogParamA(HINSTANCE hInstance,LPCSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI HWND WINAPI CreateDialogParamW(HINSTANCE hInstance,LPCWSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI HWND WINAPI CreateDialogIndirectParamA(HINSTANCE hInstance,LPCDLGTEMPLATEA lpTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI HWND WINAPI CreateDialogIndirectParamW(HINSTANCE hInstance,LPCDLGTEMPLATEW lpTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); +#define CreateDialogA(hInstance,lpName,hWndParent,lpDialogFunc) CreateDialogParamA(hInstance,lpName,hWndParent,lpDialogFunc,0L) +#define CreateDialogW(hInstance,lpName,hWndParent,lpDialogFunc) CreateDialogParamW(hInstance,lpName,hWndParent,lpDialogFunc,0L) +#define CreateDialogIndirectA(hInstance,lpTemplate,hWndParent,lpDialogFunc) CreateDialogIndirectParamA(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) +#define CreateDialogIndirectW(hInstance,lpTemplate,hWndParent,lpDialogFunc) CreateDialogIndirectParamW(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) + WINUSERAPI INT_PTR WINAPI DialogBoxParamA(HINSTANCE hInstance,LPCSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI INT_PTR WINAPI DialogBoxParamW(HINSTANCE hInstance,LPCWSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI INT_PTR WINAPI DialogBoxIndirectParamA(HINSTANCE hInstance,LPCDLGTEMPLATEA hDialogTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); + WINUSERAPI INT_PTR WINAPI DialogBoxIndirectParamW(HINSTANCE hInstance,LPCDLGTEMPLATEW hDialogTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); +#define DialogBoxA(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxParamA(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) +#define DialogBoxW(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxParamW(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) +#define DialogBoxIndirectA(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxIndirectParamA(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) +#define DialogBoxIndirectW(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxIndirectParamW(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) + WINUSERAPI WINBOOL WINAPI EndDialog(HWND hDlg,INT_PTR nResult); + WINUSERAPI HWND WINAPI GetDlgItem(HWND hDlg,int nIDDlgItem); + WINUSERAPI WINBOOL WINAPI SetDlgItemInt(HWND hDlg,int nIDDlgItem,UINT uValue,WINBOOL bSigned); + WINUSERAPI UINT WINAPI GetDlgItemInt(HWND hDlg,int nIDDlgItem,WINBOOL *lpTranslated,WINBOOL bSigned); + WINUSERAPI WINBOOL WINAPI SetDlgItemTextA(HWND hDlg,int nIDDlgItem,LPCSTR lpString); + WINUSERAPI WINBOOL WINAPI SetDlgItemTextW(HWND hDlg,int nIDDlgItem,LPCWSTR lpString); + WINUSERAPI UINT WINAPI GetDlgItemTextA(HWND hDlg,int nIDDlgItem,LPSTR lpString,int cchMax); + WINUSERAPI UINT WINAPI GetDlgItemTextW(HWND hDlg,int nIDDlgItem,LPWSTR lpString,int cchMax); + WINUSERAPI WINBOOL WINAPI CheckDlgButton(HWND hDlg,int nIDButton,UINT uCheck); + WINUSERAPI WINBOOL WINAPI CheckRadioButton(HWND hDlg,int nIDFirstButton,int nIDLastButton,int nIDCheckButton); + WINUSERAPI UINT WINAPI IsDlgButtonChecked(HWND hDlg,int nIDButton); + WINUSERAPI LRESULT WINAPI SendDlgItemMessageA(HWND hDlg,int nIDDlgItem,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI SendDlgItemMessageW(HWND hDlg,int nIDDlgItem,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI HWND WINAPI GetNextDlgGroupItem(HWND hDlg,HWND hCtl,WINBOOL bPrevious); + WINUSERAPI HWND WINAPI GetNextDlgTabItem(HWND hDlg,HWND hCtl,WINBOOL bPrevious); + WINUSERAPI int WINAPI GetDlgCtrlID(HWND hWnd); + WINUSERAPI long WINAPI GetDialogBaseUnits(VOID); + WINUSERAPI LRESULT WINAPI DefDlgProcA(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefDlgProcW(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam); + +#define DLGWINDOWEXTRA 30 +#endif + +#ifndef NOMSG + +#ifdef UNICODE +#define CallMsgFilter CallMsgFilterW +#else +#define CallMsgFilter CallMsgFilterA +#endif + + WINUSERAPI WINBOOL WINAPI CallMsgFilterA(LPMSG lpMsg,int nCode); + WINUSERAPI WINBOOL WINAPI CallMsgFilterW(LPMSG lpMsg,int nCode); +#endif + +#ifndef NOCLIPBOARD + +#ifdef UNICODE +#define RegisterClipboardFormat RegisterClipboardFormatW +#define GetClipboardFormatName GetClipboardFormatNameW +#else +#define RegisterClipboardFormat RegisterClipboardFormatA +#define GetClipboardFormatName GetClipboardFormatNameA +#endif + + WINUSERAPI WINBOOL WINAPI OpenClipboard(HWND hWndNewOwner); + WINUSERAPI WINBOOL WINAPI CloseClipboard(VOID); + WINUSERAPI DWORD WINAPI GetClipboardSequenceNumber(VOID); + WINUSERAPI HWND WINAPI GetClipboardOwner(VOID); + WINUSERAPI HWND WINAPI SetClipboardViewer(HWND hWndNewViewer); + WINUSERAPI HWND WINAPI GetClipboardViewer(VOID); + WINUSERAPI WINBOOL WINAPI ChangeClipboardChain(HWND hWndRemove,HWND hWndNewNext); + WINUSERAPI HANDLE WINAPI SetClipboardData(UINT uFormat,HANDLE hMem); + WINUSERAPI HANDLE WINAPI GetClipboardData(UINT uFormat); + WINUSERAPI UINT WINAPI RegisterClipboardFormatA(LPCSTR lpszFormat); + WINUSERAPI UINT WINAPI RegisterClipboardFormatW(LPCWSTR lpszFormat); + WINUSERAPI int WINAPI CountClipboardFormats(VOID); + WINUSERAPI UINT WINAPI EnumClipboardFormats(UINT format); + WINUSERAPI int WINAPI GetClipboardFormatNameA(UINT format,LPSTR lpszFormatName,int cchMaxCount); + WINUSERAPI int WINAPI GetClipboardFormatNameW(UINT format,LPWSTR lpszFormatName,int cchMaxCount); + WINUSERAPI WINBOOL WINAPI EmptyClipboard(VOID); + WINUSERAPI WINBOOL WINAPI IsClipboardFormatAvailable(UINT format); + WINUSERAPI int WINAPI GetPriorityClipboardFormat(UINT *paFormatPriorityList,int cFormats); + WINUSERAPI HWND WINAPI GetOpenClipboardWindow(VOID); +#endif + +#ifdef UNICODE +#define CharToOem CharToOemW +#define OemToChar OemToCharW +#define CharToOemBuff CharToOemBuffW +#define OemToCharBuff OemToCharBuffW +#define CharUpper CharUpperW +#define CharUpperBuff CharUpperBuffW +#define CharLower CharLowerW +#define CharLowerBuff CharLowerBuffW +#define CharNext CharNextW +#define CharPrev CharPrevW +#else +#define CharToOem CharToOemA +#define OemToChar OemToCharA +#define CharToOemBuff CharToOemBuffA +#define OemToCharBuff OemToCharBuffA +#define CharUpper CharUpperA +#define CharUpperBuff CharUpperBuffA +#define CharLower CharLowerA +#define CharLowerBuff CharLowerBuffA +#define CharNext CharNextA +#define CharPrev CharPrevA +#endif + + WINUSERAPI WINBOOL WINAPI CharToOemA(LPCSTR lpszSrc,LPSTR lpszDst); + WINUSERAPI WINBOOL WINAPI CharToOemW(LPCWSTR lpszSrc,LPSTR lpszDst); + WINUSERAPI WINBOOL WINAPI OemToCharA(LPCSTR lpszSrc,LPSTR lpszDst); + WINUSERAPI WINBOOL WINAPI OemToCharW(LPCSTR lpszSrc,LPWSTR lpszDst); + WINUSERAPI WINBOOL WINAPI CharToOemBuffA(LPCSTR lpszSrc,LPSTR lpszDst,DWORD cchDstLength); + WINUSERAPI WINBOOL WINAPI CharToOemBuffW(LPCWSTR lpszSrc,LPSTR lpszDst,DWORD cchDstLength); + WINUSERAPI WINBOOL WINAPI OemToCharBuffA(LPCSTR lpszSrc,LPSTR lpszDst,DWORD cchDstLength); + WINUSERAPI WINBOOL WINAPI OemToCharBuffW(LPCSTR lpszSrc,LPWSTR lpszDst,DWORD cchDstLength); + WINUSERAPI LPSTR WINAPI CharUpperA(LPSTR lpsz); + WINUSERAPI LPWSTR WINAPI CharUpperW(LPWSTR lpsz); + WINUSERAPI DWORD WINAPI CharUpperBuffA(LPSTR lpsz,DWORD cchLength); + WINUSERAPI DWORD WINAPI CharUpperBuffW(LPWSTR lpsz,DWORD cchLength); + WINUSERAPI LPSTR WINAPI CharLowerA(LPSTR lpsz); + WINUSERAPI LPWSTR WINAPI CharLowerW(LPWSTR lpsz); + WINUSERAPI DWORD WINAPI CharLowerBuffA(LPSTR lpsz,DWORD cchLength); + WINUSERAPI DWORD WINAPI CharLowerBuffW(LPWSTR lpsz,DWORD cchLength); + WINUSERAPI LPSTR WINAPI CharNextA(LPCSTR lpsz); + WINUSERAPI LPWSTR WINAPI CharNextW(LPCWSTR lpsz); + WINUSERAPI LPSTR WINAPI CharPrevA(LPCSTR lpszStart,LPCSTR lpszCurrent); + WINUSERAPI LPWSTR WINAPI CharPrevW(LPCWSTR lpszStart,LPCWSTR lpszCurrent); + WINUSERAPI LPSTR WINAPI CharNextExA(WORD CodePage,LPCSTR lpCurrentChar,DWORD dwFlags); + WINUSERAPI LPSTR WINAPI CharPrevExA(WORD CodePage,LPCSTR lpStart,LPCSTR lpCurrentChar,DWORD dwFlags); + +#define AnsiToOem CharToOemA +#define OemToAnsi OemToCharA +#define AnsiToOemBuff CharToOemBuffA +#define OemToAnsiBuff OemToCharBuffA +#define AnsiUpper CharUpperA +#define AnsiUpperBuff CharUpperBuffA +#define AnsiLower CharLowerA +#define AnsiLowerBuff CharLowerBuffA +#define AnsiNext CharNextA +#define AnsiPrev CharPrevA + +#ifndef NOLANGUAGE + +#ifdef UNICODE +#define IsCharAlpha IsCharAlphaW +#define IsCharAlphaNumeric IsCharAlphaNumericW +#define IsCharUpper IsCharUpperW +#define IsCharLower IsCharLowerW +#else +#define IsCharAlpha IsCharAlphaA +#define IsCharAlphaNumeric IsCharAlphaNumericA +#define IsCharUpper IsCharUpperA +#define IsCharLower IsCharLowerA +#endif + + WINUSERAPI WINBOOL WINAPI IsCharAlphaA(CHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharAlphaW(WCHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharAlphaNumericA(CHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharAlphaNumericW(WCHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharUpperA(CHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharUpperW(WCHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharLowerA(CHAR ch); + WINUSERAPI WINBOOL WINAPI IsCharLowerW(WCHAR ch); +#endif + +#ifdef UNICODE +#define GetKeyNameText GetKeyNameTextW +#define VkKeyScan VkKeyScanW +#define VkKeyScanEx VkKeyScanExW +#else +#define GetKeyNameText GetKeyNameTextA +#define VkKeyScan VkKeyScanA +#define VkKeyScanEx VkKeyScanExA +#endif + + WINUSERAPI HWND WINAPI SetFocus(HWND hWnd); + WINUSERAPI HWND WINAPI GetActiveWindow(VOID); + WINUSERAPI HWND WINAPI GetFocus(VOID); + WINUSERAPI UINT WINAPI GetKBCodePage(VOID); + WINUSERAPI SHORT WINAPI GetKeyState(int nVirtKey); + WINUSERAPI SHORT WINAPI GetAsyncKeyState(int vKey); + WINUSERAPI WINBOOL WINAPI GetKeyboardState(PBYTE lpKeyState); + WINUSERAPI WINBOOL WINAPI SetKeyboardState(LPBYTE lpKeyState); + WINUSERAPI int WINAPI GetKeyNameTextA(LONG lParam,LPSTR lpString,int cchSize); + WINUSERAPI int WINAPI GetKeyNameTextW(LONG lParam,LPWSTR lpString,int cchSize); + WINUSERAPI int WINAPI GetKeyboardType(int nTypeFlag); + WINUSERAPI int WINAPI ToAscii(UINT uVirtKey,UINT uScanCode,CONST BYTE *lpKeyState,LPWORD lpChar,UINT uFlags); + WINUSERAPI int WINAPI ToAsciiEx(UINT uVirtKey,UINT uScanCode,CONST BYTE *lpKeyState,LPWORD lpChar,UINT uFlags,HKL dwhkl); + WINUSERAPI int WINAPI ToUnicode(UINT wVirtKey,UINT wScanCode,CONST BYTE *lpKeyState,LPWSTR pwszBuff,int cchBuff,UINT wFlags); + WINUSERAPI DWORD WINAPI OemKeyScan(WORD wOemChar); + WINUSERAPI SHORT WINAPI VkKeyScanA(CHAR ch); + WINUSERAPI SHORT WINAPI VkKeyScanW(WCHAR ch); + WINUSERAPI SHORT WINAPI VkKeyScanExA(CHAR ch,HKL dwhkl); + WINUSERAPI SHORT WINAPI VkKeyScanExW(WCHAR ch,HKL dwhkl); + +#define KEYEVENTF_EXTENDEDKEY 0x0001 +#define KEYEVENTF_KEYUP 0x0002 +#define KEYEVENTF_UNICODE 0x0004 +#define KEYEVENTF_SCANCODE 0x0008 + + WINUSERAPI VOID WINAPI keybd_event(BYTE bVk,BYTE bScan,DWORD dwFlags,ULONG_PTR dwExtraInfo); + +#define MOUSEEVENTF_MOVE 0x0001 +#define MOUSEEVENTF_LEFTDOWN 0x0002 +#define MOUSEEVENTF_LEFTUP 0x0004 +#define MOUSEEVENTF_RIGHTDOWN 0x0008 +#define MOUSEEVENTF_RIGHTUP 0x0010 +#define MOUSEEVENTF_MIDDLEDOWN 0x0020 +#define MOUSEEVENTF_MIDDLEUP 0x0040 +#define MOUSEEVENTF_XDOWN 0x0080 +#define MOUSEEVENTF_XUP 0x0100 +#define MOUSEEVENTF_WHEEL 0x0800 +#define MOUSEEVENTF_VIRTUALDESK 0x4000 +#define MOUSEEVENTF_ABSOLUTE 0x8000 + + WINUSERAPI VOID WINAPI mouse_event(DWORD dwFlags,DWORD dx,DWORD dy,DWORD dwData,ULONG_PTR dwExtraInfo); + + typedef struct tagMOUSEINPUT { + LONG dx; + LONG dy; + DWORD mouseData; + DWORD dwFlags; + DWORD time; + ULONG_PTR dwExtraInfo; + } MOUSEINPUT,*PMOUSEINPUT,*LPMOUSEINPUT; + + typedef struct tagKEYBDINPUT { + WORD wVk; + WORD wScan; + DWORD dwFlags; + DWORD time; + ULONG_PTR dwExtraInfo; + } KEYBDINPUT,*PKEYBDINPUT,*LPKEYBDINPUT; + + typedef struct tagHARDWAREINPUT { + DWORD uMsg; + WORD wParamL; + WORD wParamH; + } HARDWAREINPUT,*PHARDWAREINPUT,*LPHARDWAREINPUT; + +#define INPUT_MOUSE 0 +#define INPUT_KEYBOARD 1 +#define INPUT_HARDWARE 2 + + typedef struct tagINPUT { + DWORD type; + union { + MOUSEINPUT mi; + KEYBDINPUT ki; + HARDWAREINPUT hi; + }; + } INPUT,*PINPUT,*LPINPUT; + + WINUSERAPI UINT WINAPI SendInput(UINT cInputs,LPINPUT pInputs,int cbSize); + + typedef struct tagLASTINPUTINFO { + UINT cbSize; + DWORD dwTime; + } LASTINPUTINFO,*PLASTINPUTINFO; + +#ifdef UNICODE +#define MapVirtualKey MapVirtualKeyW +#define MapVirtualKeyEx MapVirtualKeyExW +#else +#define MapVirtualKey MapVirtualKeyA +#define MapVirtualKeyEx MapVirtualKeyExA +#endif + + WINUSERAPI WINBOOL WINAPI GetLastInputInfo(PLASTINPUTINFO plii); + WINUSERAPI UINT WINAPI MapVirtualKeyA(UINT uCode,UINT uMapType); + WINUSERAPI UINT WINAPI MapVirtualKeyW(UINT uCode,UINT uMapType); + WINUSERAPI UINT WINAPI MapVirtualKeyExA(UINT uCode,UINT uMapType,HKL dwhkl); + WINUSERAPI UINT WINAPI MapVirtualKeyExW(UINT uCode,UINT uMapType,HKL dwhkl); + WINUSERAPI WINBOOL WINAPI GetInputState(VOID); + WINUSERAPI DWORD WINAPI GetQueueStatus(UINT flags); + WINUSERAPI HWND WINAPI GetCapture(VOID); + WINUSERAPI HWND WINAPI SetCapture(HWND hWnd); + WINUSERAPI WINBOOL WINAPI ReleaseCapture(VOID); + WINUSERAPI DWORD WINAPI MsgWaitForMultipleObjects(DWORD nCount,CONST HANDLE *pHandles,WINBOOL fWaitAll,DWORD dwMilliseconds,DWORD dwWakeMask); + WINUSERAPI DWORD WINAPI MsgWaitForMultipleObjectsEx(DWORD nCount,CONST HANDLE *pHandles,DWORD dwMilliseconds,DWORD dwWakeMask,DWORD dwFlags); + +#define MWMO_WAITALL 0x0001 +#define MWMO_ALERTABLE 0x0002 +#define MWMO_INPUTAVAILABLE 0x0004 + +#define QS_KEY 0x0001 +#define QS_MOUSEMOVE 0x0002 +#define QS_MOUSEBUTTON 0x0004 +#define QS_POSTMESSAGE 0x0008 +#define QS_TIMER 0x0010 +#define QS_PAINT 0x0020 +#define QS_SENDMESSAGE 0x0040 +#define QS_HOTKEY 0x0080 +#define QS_ALLPOSTMESSAGE 0x0100 +#define QS_RAWINPUT 0x0400 +#define QS_MOUSE (QS_MOUSEMOVE | QS_MOUSEBUTTON) +#define QS_INPUT (QS_MOUSE | QS_KEY | QS_RAWINPUT) +#define QS_ALLEVENTS (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY) +#define QS_ALLINPUT (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE) + +#define USER_TIMER_MAXIMUM 0x7FFFFFFF +#define USER_TIMER_MINIMUM 0x0000000A + +#ifdef UNICODE +#define LoadAccelerators LoadAcceleratorsW +#define CreateAcceleratorTable CreateAcceleratorTableW +#define CopyAcceleratorTable CopyAcceleratorTableW +#else +#define LoadAccelerators LoadAcceleratorsA +#define CreateAcceleratorTable CreateAcceleratorTableA +#define CopyAcceleratorTable CopyAcceleratorTableA +#endif + + WINUSERAPI UINT_PTR WINAPI SetTimer(HWND hWnd,UINT_PTR nIDEvent,UINT uElapse,TIMERPROC lpTimerFunc); + WINUSERAPI WINBOOL WINAPI KillTimer(HWND hWnd,UINT_PTR uIDEvent); + WINUSERAPI WINBOOL WINAPI IsWindowUnicode(HWND hWnd); + WINUSERAPI WINBOOL WINAPI EnableWindow(HWND hWnd,WINBOOL bEnable); + WINUSERAPI WINBOOL WINAPI IsWindowEnabled(HWND hWnd); + WINUSERAPI HACCEL WINAPI LoadAcceleratorsA(HINSTANCE hInstance,LPCSTR lpTableName); + WINUSERAPI HACCEL WINAPI LoadAcceleratorsW(HINSTANCE hInstance,LPCWSTR lpTableName); + WINUSERAPI HACCEL WINAPI CreateAcceleratorTableA(LPACCEL paccel,int cAccel); + WINUSERAPI HACCEL WINAPI CreateAcceleratorTableW(LPACCEL paccel,int cAccel); + WINUSERAPI WINBOOL WINAPI DestroyAcceleratorTable(HACCEL hAccel); + WINUSERAPI int WINAPI CopyAcceleratorTableA(HACCEL hAccelSrc,LPACCEL lpAccelDst,int cAccelEntries); + WINUSERAPI int WINAPI CopyAcceleratorTableW(HACCEL hAccelSrc,LPACCEL lpAccelDst,int cAccelEntries); + +#ifndef NOMSG + +#ifdef UNICODE +#define TranslateAccelerator TranslateAcceleratorW +#else +#define TranslateAccelerator TranslateAcceleratorA +#endif + + WINUSERAPI int WINAPI TranslateAcceleratorA(HWND hWnd,HACCEL hAccTable,LPMSG lpMsg); + WINUSERAPI int WINAPI TranslateAcceleratorW(HWND hWnd,HACCEL hAccTable,LPMSG lpMsg); +#endif + +#ifndef NOSYSMETRICS + +#define SM_CXSCREEN 0 +#define SM_CYSCREEN 1 +#define SM_CXVSCROLL 2 +#define SM_CYHSCROLL 3 +#define SM_CYCAPTION 4 +#define SM_CXBORDER 5 +#define SM_CYBORDER 6 +#define SM_CXDLGFRAME 7 +#define SM_CYDLGFRAME 8 +#define SM_CYVTHUMB 9 +#define SM_CXHTHUMB 10 +#define SM_CXICON 11 +#define SM_CYICON 12 +#define SM_CXCURSOR 13 +#define SM_CYCURSOR 14 +#define SM_CYMENU 15 +#define SM_CXFULLSCREEN 16 +#define SM_CYFULLSCREEN 17 +#define SM_CYKANJIWINDOW 18 +#define SM_MOUSEPRESENT 19 +#define SM_CYVSCROLL 20 +#define SM_CXHSCROLL 21 +#define SM_DEBUG 22 +#define SM_SWAPBUTTON 23 +#define SM_RESERVED1 24 +#define SM_RESERVED2 25 +#define SM_RESERVED3 26 +#define SM_RESERVED4 27 +#define SM_CXMIN 28 +#define SM_CYMIN 29 +#define SM_CXSIZE 30 +#define SM_CYSIZE 31 +#define SM_CXFRAME 32 +#define SM_CYFRAME 33 +#define SM_CXMINTRACK 34 +#define SM_CYMINTRACK 35 +#define SM_CXDOUBLECLK 36 +#define SM_CYDOUBLECLK 37 +#define SM_CXICONSPACING 38 +#define SM_CYICONSPACING 39 +#define SM_MENUDROPALIGNMENT 40 +#define SM_PENWINDOWS 41 +#define SM_DBCSENABLED 42 +#define SM_CMOUSEBUTTONS 43 + +#define SM_CXFIXEDFRAME SM_CXDLGFRAME +#define SM_CYFIXEDFRAME SM_CYDLGFRAME +#define SM_CXSIZEFRAME SM_CXFRAME +#define SM_CYSIZEFRAME SM_CYFRAME + +#define SM_SECURE 44 +#define SM_CXEDGE 45 +#define SM_CYEDGE 46 +#define SM_CXMINSPACING 47 +#define SM_CYMINSPACING 48 +#define SM_CXSMICON 49 +#define SM_CYSMICON 50 +#define SM_CYSMCAPTION 51 +#define SM_CXSMSIZE 52 +#define SM_CYSMSIZE 53 +#define SM_CXMENUSIZE 54 +#define SM_CYMENUSIZE 55 +#define SM_ARRANGE 56 +#define SM_CXMINIMIZED 57 +#define SM_CYMINIMIZED 58 +#define SM_CXMAXTRACK 59 +#define SM_CYMAXTRACK 60 +#define SM_CXMAXIMIZED 61 +#define SM_CYMAXIMIZED 62 +#define SM_NETWORK 63 +#define SM_CLEANBOOT 67 +#define SM_CXDRAG 68 +#define SM_CYDRAG 69 +#define SM_SHOWSOUNDS 70 +#define SM_CXMENUCHECK 71 +#define SM_CYMENUCHECK 72 +#define SM_SLOWMACHINE 73 +#define SM_MIDEASTENABLED 74 +#define SM_MOUSEWHEELPRESENT 75 +#define SM_XVIRTUALSCREEN 76 +#define SM_YVIRTUALSCREEN 77 +#define SM_CXVIRTUALSCREEN 78 +#define SM_CYVIRTUALSCREEN 79 +#define SM_CMONITORS 80 +#define SM_SAMEDISPLAYFORMAT 81 +#define SM_IMMENABLED 82 +#define SM_CXFOCUSBORDER 83 +#define SM_CYFOCUSBORDER 84 +#define SM_TABLETPC 86 +#define SM_MEDIACENTER 87 +#define SM_STARTER 88 +#define SM_SERVERR2 89 +#define SM_CMETRICS 90 +#define SM_REMOTESESSION 0x1000 +#define SM_SHUTTINGDOWN 0x2000 +#define SM_REMOTECONTROL 0x2001 +#define SM_CARETBLINKINGENABLED 0x2002 + + WINUSERAPI int WINAPI GetSystemMetrics(int nIndex); +#endif + +#ifndef NOMENUS + +#ifdef UNICODE +#define LoadMenu LoadMenuW +#define LoadMenuIndirect LoadMenuIndirectW +#define ChangeMenu ChangeMenuW +#define GetMenuString GetMenuStringW +#define InsertMenu InsertMenuW +#define AppendMenu AppendMenuW +#define ModifyMenu ModifyMenuW +#else +#define LoadMenu LoadMenuA +#define LoadMenuIndirect LoadMenuIndirectA +#define ChangeMenu ChangeMenuA +#define GetMenuString GetMenuStringA +#define InsertMenu InsertMenuA +#define AppendMenu AppendMenuA +#define ModifyMenu ModifyMenuA +#endif + + WINUSERAPI HMENU WINAPI LoadMenuA(HINSTANCE hInstance,LPCSTR lpMenuName); + WINUSERAPI HMENU WINAPI LoadMenuW(HINSTANCE hInstance,LPCWSTR lpMenuName); + WINUSERAPI HMENU WINAPI LoadMenuIndirectA(CONST MENUTEMPLATEA *lpMenuTemplate); + WINUSERAPI HMENU WINAPI LoadMenuIndirectW(CONST MENUTEMPLATEW *lpMenuTemplate); + WINUSERAPI HMENU WINAPI GetMenu(HWND hWnd); + WINUSERAPI WINBOOL WINAPI SetMenu(HWND hWnd,HMENU hMenu); + WINUSERAPI WINBOOL WINAPI ChangeMenuA(HMENU hMenu,UINT cmd,LPCSTR lpszNewItem,UINT cmdInsert,UINT flags); + WINUSERAPI WINBOOL WINAPI ChangeMenuW(HMENU hMenu,UINT cmd,LPCWSTR lpszNewItem,UINT cmdInsert,UINT flags); + WINUSERAPI WINBOOL WINAPI HiliteMenuItem(HWND hWnd,HMENU hMenu,UINT uIDHiliteItem,UINT uHilite); + WINUSERAPI int WINAPI GetMenuStringA(HMENU hMenu,UINT uIDItem,LPSTR lpString,int cchMax,UINT flags); + WINUSERAPI int WINAPI GetMenuStringW(HMENU hMenu,UINT uIDItem,LPWSTR lpString,int cchMax,UINT flags); + WINUSERAPI UINT WINAPI GetMenuState(HMENU hMenu,UINT uId,UINT uFlags); + WINUSERAPI WINBOOL WINAPI DrawMenuBar(HWND hWnd); + +#define PMB_ACTIVE 0x00000001 + + WINUSERAPI HMENU WINAPI GetSystemMenu(HWND hWnd,WINBOOL bRevert); + WINUSERAPI HMENU WINAPI CreateMenu(VOID); + WINUSERAPI HMENU WINAPI CreatePopupMenu(VOID); + WINUSERAPI WINBOOL WINAPI DestroyMenu(HMENU hMenu); + WINUSERAPI DWORD WINAPI CheckMenuItem(HMENU hMenu,UINT uIDCheckItem,UINT uCheck); + WINUSERAPI WINBOOL WINAPI EnableMenuItem(HMENU hMenu,UINT uIDEnableItem,UINT uEnable); + WINUSERAPI HMENU WINAPI GetSubMenu(HMENU hMenu,int nPos); + WINUSERAPI UINT WINAPI GetMenuItemID(HMENU hMenu,int nPos); + WINUSERAPI int WINAPI GetMenuItemCount(HMENU hMenu); + WINUSERAPI WINBOOL WINAPI InsertMenuA(HMENU hMenu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI InsertMenuW(HMENU hMenu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCWSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI AppendMenuA(HMENU hMenu,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI AppendMenuW(HMENU hMenu,UINT uFlags,UINT_PTR uIDNewItem,LPCWSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI ModifyMenuA(HMENU hMnu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI ModifyMenuW(HMENU hMnu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCWSTR lpNewItem); + WINUSERAPI WINBOOL WINAPI RemoveMenu(HMENU hMenu,UINT uPosition,UINT uFlags); + WINUSERAPI WINBOOL WINAPI DeleteMenu(HMENU hMenu,UINT uPosition,UINT uFlags); + WINUSERAPI WINBOOL WINAPI SetMenuItemBitmaps(HMENU hMenu,UINT uPosition,UINT uFlags,HBITMAP hBitmapUnchecked,HBITMAP hBitmapChecked); + WINUSERAPI LONG WINAPI GetMenuCheckMarkDimensions(VOID); + WINUSERAPI WINBOOL WINAPI TrackPopupMenu(HMENU hMenu,UINT uFlags,int x,int y,int nReserved,HWND hWnd,CONST RECT *prcRect); + +#define MNC_IGNORE 0 +#define MNC_CLOSE 1 +#define MNC_EXECUTE 2 +#define MNC_SELECT 3 + + typedef struct tagTPMPARAMS { + UINT cbSize; + RECT rcExclude; + } TPMPARAMS; + + typedef TPMPARAMS *LPTPMPARAMS; + + WINUSERAPI WINBOOL WINAPI TrackPopupMenuEx(HMENU,UINT,int,int,HWND,LPTPMPARAMS); + +#define MNS_NOCHECK 0x80000000 +#define MNS_MODELESS 0x40000000 +#define MNS_DRAGDROP 0x20000000 +#define MNS_AUTODISMISS 0x10000000 +#define MNS_NOTIFYBYPOS 0x08000000 +#define MNS_CHECKORBMP 0x04000000 + +#define MIM_MAXHEIGHT 0x00000001 +#define MIM_BACKGROUND 0x00000002 +#define MIM_HELPID 0x00000004 +#define MIM_MENUDATA 0x00000008 +#define MIM_STYLE 0x00000010 +#define MIM_APPLYTOSUBMENUS 0x80000000 + + typedef struct tagMENUINFO { + DWORD cbSize; + DWORD fMask; + DWORD dwStyle; + UINT cyMax; + HBRUSH hbrBack; + DWORD dwContextHelpID; + ULONG_PTR dwMenuData; + } MENUINFO,*LPMENUINFO; + + typedef MENUINFO CONST *LPCMENUINFO; + + WINUSERAPI WINBOOL WINAPI GetMenuInfo(HMENU,LPMENUINFO); + WINUSERAPI WINBOOL WINAPI SetMenuInfo(HMENU,LPCMENUINFO); + WINUSERAPI WINBOOL WINAPI EndMenu(VOID); + +#define MND_CONTINUE 0 +#define MND_ENDMENU 1 + + typedef struct tagMENUGETOBJECTINFO { + DWORD dwFlags; + UINT uPos; + HMENU hmenu; + PVOID riid; + PVOID pvObj; + } MENUGETOBJECTINFO,*PMENUGETOBJECTINFO; + +#define MNGOF_TOPGAP 0x00000001 +#define MNGOF_BOTTOMGAP 0x00000002 + +#define MNGO_NOINTERFACE 0x00000000 +#define MNGO_NOERROR 0x00000001 + +#define MIIM_STATE 0x00000001 +#define MIIM_ID 0x00000002 +#define MIIM_SUBMENU 0x00000004 +#define MIIM_CHECKMARKS 0x00000008 +#define MIIM_TYPE 0x00000010 +#define MIIM_DATA 0x00000020 + +#define MIIM_STRING 0x00000040 +#define MIIM_BITMAP 0x00000080 +#define MIIM_FTYPE 0x00000100 + +#define HBMMENU_CALLBACK ((HBITMAP) -1) +#define HBMMENU_SYSTEM ((HBITMAP) 1) +#define HBMMENU_MBAR_RESTORE ((HBITMAP) 2) +#define HBMMENU_MBAR_MINIMIZE ((HBITMAP) 3) +#define HBMMENU_MBAR_CLOSE ((HBITMAP) 5) +#define HBMMENU_MBAR_CLOSE_D ((HBITMAP) 6) +#define HBMMENU_MBAR_MINIMIZE_D ((HBITMAP) 7) +#define HBMMENU_POPUP_CLOSE ((HBITMAP) 8) +#define HBMMENU_POPUP_RESTORE ((HBITMAP) 9) +#define HBMMENU_POPUP_MAXIMIZE ((HBITMAP) 10) +#define HBMMENU_POPUP_MINIMIZE ((HBITMAP) 11) + + typedef struct tagMENUITEMINFOA { + UINT cbSize; + UINT fMask; + UINT fType; + UINT fState; + UINT wID; + HMENU hSubMenu; + HBITMAP hbmpChecked; + HBITMAP hbmpUnchecked; + ULONG_PTR dwItemData; + LPSTR dwTypeData; + UINT cch; + HBITMAP hbmpItem; + } MENUITEMINFOA,*LPMENUITEMINFOA; + + typedef struct tagMENUITEMINFOW { + UINT cbSize; + UINT fMask; + UINT fType; + UINT fState; + UINT wID; + HMENU hSubMenu; + HBITMAP hbmpChecked; + HBITMAP hbmpUnchecked; + ULONG_PTR dwItemData; + LPWSTR dwTypeData; + UINT cch; + HBITMAP hbmpItem; + } MENUITEMINFOW,*LPMENUITEMINFOW; + +#ifdef UNICODE + typedef MENUITEMINFOW MENUITEMINFO; + typedef LPMENUITEMINFOW LPMENUITEMINFO; +#else + typedef MENUITEMINFOA MENUITEMINFO; + typedef LPMENUITEMINFOA LPMENUITEMINFO; +#endif + typedef MENUITEMINFOA CONST *LPCMENUITEMINFOA; + typedef MENUITEMINFOW CONST *LPCMENUITEMINFOW; +#ifdef UNICODE + typedef LPCMENUITEMINFOW LPCMENUITEMINFO; +#else + typedef LPCMENUITEMINFOA LPCMENUITEMINFO; +#endif + +#ifdef UNICODE +#define InsertMenuItem InsertMenuItemW +#define GetMenuItemInfo GetMenuItemInfoW +#define SetMenuItemInfo SetMenuItemInfoW +#else +#define InsertMenuItem InsertMenuItemA +#define GetMenuItemInfo GetMenuItemInfoA +#define SetMenuItemInfo SetMenuItemInfoA +#endif + + WINUSERAPI WINBOOL WINAPI InsertMenuItemA(HMENU hmenu,UINT item,WINBOOL fByPosition,LPCMENUITEMINFOA lpmi); + WINUSERAPI WINBOOL WINAPI InsertMenuItemW(HMENU hmenu,UINT item,WINBOOL fByPosition,LPCMENUITEMINFOW lpmi); + WINUSERAPI WINBOOL WINAPI GetMenuItemInfoA(HMENU hmenu,UINT item,WINBOOL fByPosition,LPMENUITEMINFOA lpmii); + WINUSERAPI WINBOOL WINAPI GetMenuItemInfoW(HMENU hmenu,UINT item,WINBOOL fByPosition,LPMENUITEMINFOW lpmii); + WINUSERAPI WINBOOL WINAPI SetMenuItemInfoA(HMENU hmenu,UINT item,WINBOOL fByPositon,LPCMENUITEMINFOA lpmii); + WINUSERAPI WINBOOL WINAPI SetMenuItemInfoW(HMENU hmenu,UINT item,WINBOOL fByPositon,LPCMENUITEMINFOW lpmii); + +#define GMDI_USEDISABLED 0x0001L +#define GMDI_GOINTOPOPUPS 0x0002L + + WINUSERAPI UINT WINAPI GetMenuDefaultItem(HMENU hMenu,UINT fByPos,UINT gmdiFlags); + WINUSERAPI WINBOOL WINAPI SetMenuDefaultItem(HMENU hMenu,UINT uItem,UINT fByPos); + WINUSERAPI WINBOOL WINAPI GetMenuItemRect(HWND hWnd,HMENU hMenu,UINT uItem,LPRECT lprcItem); + WINUSERAPI int WINAPI MenuItemFromPoint(HWND hWnd,HMENU hMenu,POINT ptScreen); + +#define TPM_LEFTBUTTON 0x0000L +#define TPM_RIGHTBUTTON 0x0002L +#define TPM_LEFTALIGN 0x0000L +#define TPM_CENTERALIGN 0x0004L +#define TPM_RIGHTALIGN 0x0008L +#define TPM_TOPALIGN 0x0000L +#define TPM_VCENTERALIGN 0x0010L +#define TPM_BOTTOMALIGN 0x0020L + +#define TPM_HORIZONTAL 0x0000L +#define TPM_VERTICAL 0x0040L +#define TPM_NONOTIFY 0x0080L +#define TPM_RETURNCMD 0x0100L +#define TPM_RECURSE 0x0001L +#define TPM_HORPOSANIMATION 0x0400L +#define TPM_HORNEGANIMATION 0x0800L +#define TPM_VERPOSANIMATION 0x1000L +#define TPM_VERNEGANIMATION 0x2000L +#define TPM_NOANIMATION 0x4000L +#define TPM_LAYOUTRTL 0x8000L +#endif + + typedef struct tagDROPSTRUCT { + HWND hwndSource; + HWND hwndSink; + DWORD wFmt; + ULONG_PTR dwData; + POINT ptDrop; + DWORD dwControlData; + } DROPSTRUCT,*PDROPSTRUCT,*LPDROPSTRUCT; + +#define DOF_EXECUTABLE 0x8001 +#define DOF_DOCUMENT 0x8002 +#define DOF_DIRECTORY 0x8003 +#define DOF_MULTIPLE 0x8004 +#define DOF_PROGMAN 0x0001 +#define DOF_SHELLDATA 0x0002 + +#define DO_DROPFILE 0x454C4946L +#define DO_PRINTFILE 0x544E5250L + + WINUSERAPI DWORD WINAPI DragObject(HWND hwndParent,HWND hwndFrom,UINT fmt,ULONG_PTR data,HCURSOR hcur); + WINUSERAPI WINBOOL WINAPI DragDetect(HWND hwnd,POINT pt); + WINUSERAPI WINBOOL WINAPI DrawIcon(HDC hDC,int X,int Y,HICON hIcon); + +#ifndef NODRAWTEXT + +#define DT_TOP 0x00000000 +#define DT_LEFT 0x00000000 +#define DT_CENTER 0x00000001 +#define DT_RIGHT 0x00000002 +#define DT_VCENTER 0x00000004 +#define DT_BOTTOM 0x00000008 +#define DT_WORDBREAK 0x00000010 +#define DT_SINGLELINE 0x00000020 +#define DT_EXPANDTABS 0x00000040 +#define DT_TABSTOP 0x00000080 +#define DT_NOCLIP 0x00000100 +#define DT_EXTERNALLEADING 0x00000200 +#define DT_CALCRECT 0x00000400 +#define DT_NOPREFIX 0x00000800 +#define DT_INTERNAL 0x00001000 + +#define DT_EDITCONTROL 0x00002000 +#define DT_PATH_ELLIPSIS 0x00004000 +#define DT_END_ELLIPSIS 0x00008000 +#define DT_MODIFYSTRING 0x00010000 +#define DT_RTLREADING 0x00020000 +#define DT_WORD_ELLIPSIS 0x00040000 +#define DT_NOFULLWIDTHCHARBREAK 0x00080000 +#define DT_HIDEPREFIX 0x00100000 +#define DT_PREFIXONLY 0x00200000 + + typedef struct tagDRAWTEXTPARAMS { + UINT cbSize; + int iTabLength; + int iLeftMargin; + int iRightMargin; + UINT uiLengthDrawn; + } DRAWTEXTPARAMS,*LPDRAWTEXTPARAMS; + +#ifdef UNICODE +#define DrawText DrawTextW +#define DrawTextEx DrawTextExW +#else +#define DrawText DrawTextA +#define DrawTextEx DrawTextExA +#endif + + WINUSERAPI int WINAPI DrawTextA(HDC hdc,LPCSTR lpchText,int cchText,LPRECT lprc,UINT format); + WINUSERAPI int WINAPI DrawTextW(HDC hdc,LPCWSTR lpchText,int cchText,LPRECT lprc,UINT format); + WINUSERAPI int WINAPI DrawTextExA(HDC hdc,LPSTR lpchText,int cchText,LPRECT lprc,UINT format,LPDRAWTEXTPARAMS lpdtp); + WINUSERAPI int WINAPI DrawTextExW(HDC hdc,LPWSTR lpchText,int cchText,LPRECT lprc,UINT format,LPDRAWTEXTPARAMS lpdtp); +#endif + +#ifdef UNICODE +#define GrayString GrayStringW +#define DrawState DrawStateW +#define TabbedTextOut TabbedTextOutW +#define GetTabbedTextExtent GetTabbedTextExtentW +#else +#define GrayString GrayStringA +#define DrawState DrawStateA +#define TabbedTextOut TabbedTextOutA +#define GetTabbedTextExtent GetTabbedTextExtentA +#endif + + WINUSERAPI WINBOOL WINAPI GrayStringA(HDC hDC,HBRUSH hBrush,GRAYSTRINGPROC lpOutputFunc,LPARAM lpData,int nCount,int X,int Y,int nWidth,int nHeight); + WINUSERAPI WINBOOL WINAPI GrayStringW(HDC hDC,HBRUSH hBrush,GRAYSTRINGPROC lpOutputFunc,LPARAM lpData,int nCount,int X,int Y,int nWidth,int nHeight); + +#define DST_COMPLEX 0x0000 +#define DST_TEXT 0x0001 +#define DST_PREFIXTEXT 0x0002 +#define DST_ICON 0x0003 +#define DST_BITMAP 0x0004 + +#define DSS_NORMAL 0x0000 +#define DSS_UNION 0x0010 +#define DSS_DISABLED 0x0020 +#define DSS_MONO 0x0080 +#define DSS_HIDEPREFIX 0x0200 +#define DSS_PREFIXONLY 0x0400 +#define DSS_RIGHT 0x8000 + + WINUSERAPI WINBOOL WINAPI DrawStateA(HDC hdc,HBRUSH hbrFore,DRAWSTATEPROC qfnCallBack,LPARAM lData,WPARAM wData,int x,int y,int cx,int cy,UINT uFlags); + WINUSERAPI WINBOOL WINAPI DrawStateW(HDC hdc,HBRUSH hbrFore,DRAWSTATEPROC qfnCallBack,LPARAM lData,WPARAM wData,int x,int y,int cx,int cy,UINT uFlags); + WINUSERAPI LONG WINAPI TabbedTextOutA(HDC hdc,int x,int y,LPCSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions,int nTabOrigin); + WINUSERAPI LONG WINAPI TabbedTextOutW(HDC hdc,int x,int y,LPCWSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions,int nTabOrigin); + WINUSERAPI DWORD WINAPI GetTabbedTextExtentA(HDC hdc,LPCSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions); + WINUSERAPI DWORD WINAPI GetTabbedTextExtentW(HDC hdc,LPCWSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions); + WINUSERAPI WINBOOL WINAPI UpdateWindow(HWND hWnd); + WINUSERAPI HWND WINAPI SetActiveWindow(HWND hWnd); + WINUSERAPI HWND WINAPI GetForegroundWindow(VOID); + WINUSERAPI WINBOOL WINAPI PaintDesktop(HDC hdc); + WINUSERAPI VOID WINAPI SwitchToThisWindow(HWND hwnd,WINBOOL fUnknown); + WINUSERAPI WINBOOL WINAPI SetForegroundWindow(HWND hWnd); + WINUSERAPI WINBOOL WINAPI AllowSetForegroundWindow(DWORD dwProcessId); + +#define ASFW_ANY ((DWORD)-1) + + WINUSERAPI WINBOOL WINAPI LockSetForegroundWindow(UINT uLockCode); + +#define LSFW_LOCK 1 +#define LSFW_UNLOCK 2 + + WINUSERAPI HWND WINAPI WindowFromDC(HDC hDC); + WINUSERAPI HDC WINAPI GetDC(HWND hWnd); + WINUSERAPI HDC WINAPI GetDCEx(HWND hWnd,HRGN hrgnClip,DWORD flags); + +#define DCX_WINDOW 0x00000001L +#define DCX_CACHE 0x00000002L +#define DCX_NORESETATTRS 0x00000004L +#define DCX_CLIPCHILDREN 0x00000008L +#define DCX_CLIPSIBLINGS 0x00000010L +#define DCX_PARENTCLIP 0x00000020L +#define DCX_EXCLUDERGN 0x00000040L +#define DCX_INTERSECTRGN 0x00000080L +#define DCX_EXCLUDEUPDATE 0x00000100L +#define DCX_INTERSECTUPDATE 0x00000200L +#define DCX_LOCKWINDOWUPDATE 0x00000400L + +#define DCX_VALIDATE 0x00200000L + + WINUSERAPI HDC WINAPI GetWindowDC(HWND hWnd); + WINUSERAPI int WINAPI ReleaseDC(HWND hWnd,HDC hDC); + WINUSERAPI HDC WINAPI BeginPaint(HWND hWnd,LPPAINTSTRUCT lpPaint); + WINUSERAPI WINBOOL WINAPI EndPaint(HWND hWnd,CONST PAINTSTRUCT *lpPaint); + WINUSERAPI WINBOOL WINAPI GetUpdateRect(HWND hWnd,LPRECT lpRect,WINBOOL bErase); + WINUSERAPI int WINAPI GetUpdateRgn(HWND hWnd,HRGN hRgn,WINBOOL bErase); + WINUSERAPI int WINAPI SetWindowRgn(HWND hWnd,HRGN hRgn,WINBOOL bRedraw); + WINUSERAPI int WINAPI GetWindowRgn(HWND hWnd,HRGN hRgn); + WINUSERAPI int WINAPI GetWindowRgnBox(HWND hWnd,LPRECT lprc); + WINUSERAPI int WINAPI ExcludeUpdateRgn(HDC hDC,HWND hWnd); + WINUSERAPI WINBOOL WINAPI InvalidateRect(HWND hWnd,CONST RECT *lpRect,WINBOOL bErase); + WINUSERAPI WINBOOL WINAPI ValidateRect(HWND hWnd,CONST RECT *lpRect); + WINUSERAPI WINBOOL WINAPI InvalidateRgn(HWND hWnd,HRGN hRgn,WINBOOL bErase); + WINUSERAPI WINBOOL WINAPI ValidateRgn(HWND hWnd,HRGN hRgn); + WINUSERAPI WINBOOL WINAPI RedrawWindow(HWND hWnd,CONST RECT *lprcUpdate,HRGN hrgnUpdate,UINT flags); + +#define RDW_INVALIDATE 0x0001 +#define RDW_INTERNALPAINT 0x0002 +#define RDW_ERASE 0x0004 + +#define RDW_VALIDATE 0x0008 +#define RDW_NOINTERNALPAINT 0x0010 +#define RDW_NOERASE 0x0020 + +#define RDW_NOCHILDREN 0x0040 +#define RDW_ALLCHILDREN 0x0080 + +#define RDW_UPDATENOW 0x0100 +#define RDW_ERASENOW 0x0200 + +#define RDW_FRAME 0x0400 +#define RDW_NOFRAME 0x0800 + + WINUSERAPI WINBOOL WINAPI LockWindowUpdate(HWND hWndLock); + WINUSERAPI WINBOOL WINAPI ScrollWindow(HWND hWnd,int XAmount,int YAmount,CONST RECT *lpRect,CONST RECT *lpClipRect); + WINUSERAPI WINBOOL WINAPI ScrollDC(HDC hDC,int dx,int dy,CONST RECT *lprcScroll,CONST RECT *lprcClip,HRGN hrgnUpdate,LPRECT lprcUpdate); + WINUSERAPI int WINAPI ScrollWindowEx(HWND hWnd,int dx,int dy,CONST RECT *prcScroll,CONST RECT *prcClip,HRGN hrgnUpdate,LPRECT prcUpdate,UINT flags); + +#define SW_SCROLLCHILDREN 0x0001 +#define SW_INVALIDATE 0x0002 +#define SW_ERASE 0x0004 +#define SW_SMOOTHSCROLL 0x0010 + +#ifndef NOSCROLL + WINUSERAPI int WINAPI SetScrollPos(HWND hWnd,int nBar,int nPos,WINBOOL bRedraw); + WINUSERAPI int WINAPI GetScrollPos(HWND hWnd,int nBar); + WINUSERAPI WINBOOL WINAPI SetScrollRange(HWND hWnd,int nBar,int nMinPos,int nMaxPos,WINBOOL bRedraw); + WINUSERAPI WINBOOL WINAPI GetScrollRange(HWND hWnd,int nBar,LPINT lpMinPos,LPINT lpMaxPos); + WINUSERAPI WINBOOL WINAPI ShowScrollBar(HWND hWnd,int wBar,WINBOOL bShow); + WINUSERAPI WINBOOL WINAPI EnableScrollBar(HWND hWnd,UINT wSBflags,UINT wArrows); + +#define ESB_ENABLE_BOTH 0x0000 +#define ESB_DISABLE_BOTH 0x0003 + +#define ESB_DISABLE_LEFT 0x0001 +#define ESB_DISABLE_RIGHT 0x0002 + +#define ESB_DISABLE_UP 0x0001 +#define ESB_DISABLE_DOWN 0x0002 + +#define ESB_DISABLE_LTUP ESB_DISABLE_LEFT +#define ESB_DISABLE_RTDN ESB_DISABLE_RIGHT +#endif + +#ifdef UNICODE +#define SetProp SetPropW +#define GetProp GetPropW +#define RemoveProp RemovePropW +#define EnumPropsEx EnumPropsExW +#define EnumProps EnumPropsW +#define SetWindowText SetWindowTextW +#define GetWindowText GetWindowTextW +#define GetWindowTextLength GetWindowTextLengthW +#else +#define SetProp SetPropA +#define GetProp GetPropA +#define RemoveProp RemovePropA +#define EnumPropsEx EnumPropsExA +#define EnumProps EnumPropsA +#define SetWindowText SetWindowTextA +#define GetWindowText GetWindowTextA +#define GetWindowTextLength GetWindowTextLengthA +#endif + + WINUSERAPI WINBOOL WINAPI SetPropA(HWND hWnd,LPCSTR lpString,HANDLE hData); + WINUSERAPI WINBOOL WINAPI SetPropW(HWND hWnd,LPCWSTR lpString,HANDLE hData); + WINUSERAPI HANDLE WINAPI GetPropA(HWND hWnd,LPCSTR lpString); + WINUSERAPI HANDLE WINAPI GetPropW(HWND hWnd,LPCWSTR lpString); + WINUSERAPI HANDLE WINAPI RemovePropA(HWND hWnd,LPCSTR lpString); + WINUSERAPI HANDLE WINAPI RemovePropW(HWND hWnd,LPCWSTR lpString); + WINUSERAPI int WINAPI EnumPropsExA(HWND hWnd,PROPENUMPROCEXA lpEnumFunc,LPARAM lParam); + WINUSERAPI int WINAPI EnumPropsExW(HWND hWnd,PROPENUMPROCEXW lpEnumFunc,LPARAM lParam); + WINUSERAPI int WINAPI EnumPropsA(HWND hWnd,PROPENUMPROCA lpEnumFunc); + WINUSERAPI int WINAPI EnumPropsW(HWND hWnd,PROPENUMPROCW lpEnumFunc); + WINUSERAPI WINBOOL WINAPI SetWindowTextA(HWND hWnd,LPCSTR lpString); + WINUSERAPI WINBOOL WINAPI SetWindowTextW(HWND hWnd,LPCWSTR lpString); + WINUSERAPI int WINAPI GetWindowTextA(HWND hWnd,LPSTR lpString,int nMaxCount); + WINUSERAPI int WINAPI GetWindowTextW(HWND hWnd,LPWSTR lpString,int nMaxCount); + WINUSERAPI int WINAPI GetWindowTextLengthA(HWND hWnd); + WINUSERAPI int WINAPI GetWindowTextLengthW(HWND hWnd); + WINUSERAPI WINBOOL WINAPI GetClientRect(HWND hWnd,LPRECT lpRect); + WINUSERAPI WINBOOL WINAPI GetWindowRect(HWND hWnd,LPRECT lpRect); + WINUSERAPI WINBOOL WINAPI AdjustWindowRect(LPRECT lpRect,DWORD dwStyle,WINBOOL bMenu); + WINUSERAPI WINBOOL WINAPI AdjustWindowRectEx(LPRECT lpRect,DWORD dwStyle,WINBOOL bMenu,DWORD dwExStyle); + +#define HELPINFO_WINDOW 0x0001 +#define HELPINFO_MENUITEM 0x0002 + + typedef struct tagHELPINFO { + UINT cbSize; + int iContextType; + int iCtrlId; + HANDLE hItemHandle; + DWORD_PTR dwContextId; + POINT MousePos; + } HELPINFO,*LPHELPINFO; + + WINUSERAPI WINBOOL WINAPI SetWindowContextHelpId(HWND,DWORD); + WINUSERAPI DWORD WINAPI GetWindowContextHelpId(HWND); + WINUSERAPI WINBOOL WINAPI SetMenuContextHelpId(HMENU,DWORD); + WINUSERAPI DWORD WINAPI GetMenuContextHelpId(HMENU); + +#ifndef NOMB + +#define MB_OK 0x00000000L +#define MB_OKCANCEL 0x00000001L +#define MB_ABORTRETRYIGNORE 0x00000002L +#define MB_YESNOCANCEL 0x00000003L +#define MB_YESNO 0x00000004L +#define MB_RETRYCANCEL 0x00000005L +#define MB_CANCELTRYCONTINUE 0x00000006L +#define MB_ICONHAND 0x00000010L +#define MB_ICONQUESTION 0x00000020L +#define MB_ICONEXCLAMATION 0x00000030L +#define MB_ICONASTERISK 0x00000040L +#define MB_USERICON 0x00000080L +#define MB_ICONWARNING MB_ICONEXCLAMATION +#define MB_ICONERROR MB_ICONHAND +#define MB_ICONINFORMATION MB_ICONASTERISK +#define MB_ICONSTOP MB_ICONHAND +#define MB_DEFBUTTON1 0x00000000L +#define MB_DEFBUTTON2 0x00000100L +#define MB_DEFBUTTON3 0x00000200L +#define MB_DEFBUTTON4 0x00000300L +#define MB_APPLMODAL 0x00000000L +#define MB_SYSTEMMODAL 0x00001000L +#define MB_TASKMODAL 0x00002000L +#define MB_HELP 0x00004000L +#define MB_NOFOCUS 0x00008000L +#define MB_SETFOREGROUND 0x00010000L +#define MB_DEFAULT_DESKTOP_ONLY 0x00020000L +#define MB_TOPMOST 0x00040000L +#define MB_RIGHT 0x00080000L +#define MB_RTLREADING 0x00100000L +#define MB_SERVICE_NOTIFICATION 0x00200000L +#define MB_SERVICE_NOTIFICATION_NT3X 0x00040000L +#define MB_TYPEMASK 0x0000000FL +#define MB_ICONMASK 0x000000F0L +#define MB_DEFMASK 0x00000F00L +#define MB_MODEMASK 0x00003000L +#define MB_MISCMASK 0x0000C000L + +#ifdef UNICODE +#define MessageBox MessageBoxW +#define MessageBoxEx MessageBoxExW +#else +#define MessageBox MessageBoxA +#define MessageBoxEx MessageBoxExA +#endif + + WINUSERAPI int WINAPI MessageBoxA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType); + WINUSERAPI int WINAPI MessageBoxW(HWND hWnd,LPCWSTR lpText,LPCWSTR lpCaption,UINT uType); + WINUSERAPI int WINAPI MessageBoxExA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType,WORD wLanguageId); + WINUSERAPI int WINAPI MessageBoxExW(HWND hWnd,LPCWSTR lpText,LPCWSTR lpCaption,UINT uType,WORD wLanguageId); + + typedef VOID (CALLBACK *MSGBOXCALLBACK)(LPHELPINFO lpHelpInfo); + + typedef struct tagMSGBOXPARAMSA { + UINT cbSize; + HWND hwndOwner; + HINSTANCE hInstance; + LPCSTR lpszText; + LPCSTR lpszCaption; + DWORD dwStyle; + LPCSTR lpszIcon; + DWORD_PTR dwContextHelpId; + MSGBOXCALLBACK lpfnMsgBoxCallback; + DWORD dwLanguageId; + } MSGBOXPARAMSA,*PMSGBOXPARAMSA,*LPMSGBOXPARAMSA; + + typedef struct tagMSGBOXPARAMSW { + UINT cbSize; + HWND hwndOwner; + HINSTANCE hInstance; + LPCWSTR lpszText; + LPCWSTR lpszCaption; + DWORD dwStyle; + LPCWSTR lpszIcon; + DWORD_PTR dwContextHelpId; + MSGBOXCALLBACK lpfnMsgBoxCallback; + DWORD dwLanguageId; + } MSGBOXPARAMSW,*PMSGBOXPARAMSW,*LPMSGBOXPARAMSW; + +#ifdef UNICODE + typedef MSGBOXPARAMSW MSGBOXPARAMS; + typedef PMSGBOXPARAMSW PMSGBOXPARAMS; + typedef LPMSGBOXPARAMSW LPMSGBOXPARAMS; +#else + typedef MSGBOXPARAMSA MSGBOXPARAMS; + typedef PMSGBOXPARAMSA PMSGBOXPARAMS; + typedef LPMSGBOXPARAMSA LPMSGBOXPARAMS; +#endif + +#ifdef UNICODE +#define MessageBoxIndirect MessageBoxIndirectW +#else +#define MessageBoxIndirect MessageBoxIndirectA +#endif + + WINUSERAPI int WINAPI MessageBoxIndirectA(CONST MSGBOXPARAMSA *lpmbp); + WINUSERAPI int WINAPI MessageBoxIndirectW(CONST MSGBOXPARAMSW *lpmbp); + WINUSERAPI WINBOOL WINAPI MessageBeep(UINT uType); +#endif + + WINUSERAPI int WINAPI ShowCursor(WINBOOL bShow); + WINUSERAPI WINBOOL WINAPI SetCursorPos(int X,int Y); + WINUSERAPI HCURSOR WINAPI SetCursor(HCURSOR hCursor); + WINUSERAPI WINBOOL WINAPI GetCursorPos(LPPOINT lpPoint); + WINUSERAPI WINBOOL WINAPI ClipCursor(CONST RECT *lpRect); + WINUSERAPI WINBOOL WINAPI GetClipCursor(LPRECT lpRect); + WINUSERAPI HCURSOR WINAPI GetCursor(VOID); + WINUSERAPI WINBOOL WINAPI CreateCaret(HWND hWnd,HBITMAP hBitmap,int nWidth,int nHeight); + WINUSERAPI UINT WINAPI GetCaretBlinkTime(VOID); + WINUSERAPI WINBOOL WINAPI SetCaretBlinkTime(UINT uMSeconds); + WINUSERAPI WINBOOL WINAPI DestroyCaret(VOID); + WINUSERAPI WINBOOL WINAPI HideCaret(HWND hWnd); + WINUSERAPI WINBOOL WINAPI ShowCaret(HWND hWnd); + WINUSERAPI WINBOOL WINAPI SetCaretPos(int X,int Y); + WINUSERAPI WINBOOL WINAPI GetCaretPos(LPPOINT lpPoint); + WINUSERAPI WINBOOL WINAPI ClientToScreen(HWND hWnd,LPPOINT lpPoint); + WINUSERAPI WINBOOL WINAPI ScreenToClient(HWND hWnd,LPPOINT lpPoint); + WINUSERAPI int WINAPI MapWindowPoints(HWND hWndFrom,HWND hWndTo,LPPOINT lpPoints,UINT cPoints); + WINUSERAPI HWND WINAPI WindowFromPoint(POINT Point); + WINUSERAPI HWND WINAPI ChildWindowFromPoint(HWND hWndParent,POINT Point); + +#define CWP_ALL 0x0000 +#define CWP_SKIPINVISIBLE 0x0001 +#define CWP_SKIPDISABLED 0x0002 +#define CWP_SKIPTRANSPARENT 0x0004 + + WINUSERAPI HWND WINAPI ChildWindowFromPointEx(HWND hwnd,POINT pt,UINT flags); + +#ifndef NOCOLOR + +#define CTLCOLOR_MSGBOX 0 +#define CTLCOLOR_EDIT 1 +#define CTLCOLOR_LISTBOX 2 +#define CTLCOLOR_BTN 3 +#define CTLCOLOR_DLG 4 +#define CTLCOLOR_SCROLLBAR 5 +#define CTLCOLOR_STATIC 6 +#define CTLCOLOR_MAX 7 + +#define COLOR_SCROLLBAR 0 +#define COLOR_BACKGROUND 1 +#define COLOR_ACTIVECAPTION 2 +#define COLOR_INACTIVECAPTION 3 +#define COLOR_MENU 4 +#define COLOR_WINDOW 5 +#define COLOR_WINDOWFRAME 6 +#define COLOR_MENUTEXT 7 +#define COLOR_WINDOWTEXT 8 +#define COLOR_CAPTIONTEXT 9 +#define COLOR_ACTIVEBORDER 10 +#define COLOR_INACTIVEBORDER 11 +#define COLOR_APPWORKSPACE 12 +#define COLOR_HIGHLIGHT 13 +#define COLOR_HIGHLIGHTTEXT 14 +#define COLOR_BTNFACE 15 +#define COLOR_BTNSHADOW 16 +#define COLOR_GRAYTEXT 17 +#define COLOR_BTNTEXT 18 +#define COLOR_INACTIVECAPTIONTEXT 19 +#define COLOR_BTNHIGHLIGHT 20 + +#define COLOR_3DDKSHADOW 21 +#define COLOR_3DLIGHT 22 +#define COLOR_INFOTEXT 23 +#define COLOR_INFOBK 24 + +#define COLOR_HOTLIGHT 26 +#define COLOR_GRADIENTACTIVECAPTION 27 +#define COLOR_GRADIENTINACTIVECAPTION 28 +#define COLOR_MENUHILIGHT 29 +#define COLOR_MENUBAR 30 + +#define COLOR_DESKTOP COLOR_BACKGROUND +#define COLOR_3DFACE COLOR_BTNFACE +#define COLOR_3DSHADOW COLOR_BTNSHADOW +#define COLOR_3DHIGHLIGHT COLOR_BTNHIGHLIGHT +#define COLOR_3DHILIGHT COLOR_BTNHIGHLIGHT +#define COLOR_BTNHILIGHT COLOR_BTNHIGHLIGHT + + WINUSERAPI DWORD WINAPI GetSysColor(int nIndex); + WINUSERAPI HBRUSH WINAPI GetSysColorBrush(int nIndex); + WINUSERAPI WINBOOL WINAPI SetSysColors(int cElements,CONST INT *lpaElements,CONST COLORREF *lpaRgbValues); +#endif + + WINUSERAPI WINBOOL WINAPI DrawFocusRect(HDC hDC,CONST RECT *lprc); + WINUSERAPI int WINAPI FillRect(HDC hDC,CONST RECT *lprc,HBRUSH hbr); + WINUSERAPI int WINAPI FrameRect(HDC hDC,CONST RECT *lprc,HBRUSH hbr); + WINUSERAPI WINBOOL WINAPI InvertRect(HDC hDC,CONST RECT *lprc); + WINUSERAPI WINBOOL WINAPI SetRect(LPRECT lprc,int xLeft,int yTop,int xRight,int yBottom); + WINUSERAPI WINBOOL WINAPI SetRectEmpty(LPRECT lprc); + WINUSERAPI WINBOOL WINAPI CopyRect(LPRECT lprcDst,CONST RECT *lprcSrc); + WINUSERAPI WINBOOL WINAPI InflateRect(LPRECT lprc,int dx,int dy); + WINUSERAPI WINBOOL WINAPI IntersectRect(LPRECT lprcDst,CONST RECT *lprcSrc1,CONST RECT *lprcSrc2); + WINUSERAPI WINBOOL WINAPI UnionRect(LPRECT lprcDst,CONST RECT *lprcSrc1,CONST RECT *lprcSrc2); + WINUSERAPI WINBOOL WINAPI SubtractRect(LPRECT lprcDst,CONST RECT *lprcSrc1,CONST RECT *lprcSrc2); + WINUSERAPI WINBOOL WINAPI OffsetRect(LPRECT lprc,int dx,int dy); + WINUSERAPI WINBOOL WINAPI IsRectEmpty(CONST RECT *lprc); + WINUSERAPI WINBOOL WINAPI EqualRect(CONST RECT *lprc1,CONST RECT *lprc2); + WINUSERAPI WINBOOL WINAPI PtInRect(CONST RECT *lprc,POINT pt); + +#ifndef NOWINOFFSETS + +#ifdef UNICODE +#define GetWindowLong GetWindowLongW +#define SetWindowLong SetWindowLongW +#else +#define GetWindowLong GetWindowLongA +#define SetWindowLong SetWindowLongA +#endif + + WINUSERAPI WORD WINAPI GetWindowWord(HWND hWnd,int nIndex); + WINUSERAPI WORD WINAPI SetWindowWord(HWND hWnd,int nIndex,WORD wNewWord); + WINUSERAPI LONG WINAPI GetWindowLongA(HWND hWnd,int nIndex); + WINUSERAPI LONG WINAPI GetWindowLongW(HWND hWnd,int nIndex); + WINUSERAPI LONG WINAPI SetWindowLongA(HWND hWnd,int nIndex,LONG dwNewLong); + WINUSERAPI LONG WINAPI SetWindowLongW(HWND hWnd,int nIndex,LONG dwNewLong); + +#ifdef _WIN64 + +#ifdef UNICODE +#define GetWindowLongPtr GetWindowLongPtrW +#define SetWindowLongPtr SetWindowLongPtrW +#else +#define GetWindowLongPtr GetWindowLongPtrA +#define SetWindowLongPtr SetWindowLongPtrA +#endif + + WINUSERAPI LONG_PTR WINAPI GetWindowLongPtrA(HWND hWnd,int nIndex); + WINUSERAPI LONG_PTR WINAPI GetWindowLongPtrW(HWND hWnd,int nIndex); + WINUSERAPI LONG_PTR WINAPI SetWindowLongPtrA(HWND hWnd,int nIndex,LONG_PTR dwNewLong); + WINUSERAPI LONG_PTR WINAPI SetWindowLongPtrW(HWND hWnd,int nIndex,LONG_PTR dwNewLong); +#else + +#ifdef UNICODE +#define GetWindowLongPtr GetWindowLongPtrW +#define SetWindowLongPtr SetWindowLongPtrW +#else +#define GetWindowLongPtr GetWindowLongPtrA +#define SetWindowLongPtr SetWindowLongPtrA +#endif + +#define GetWindowLongPtrA GetWindowLongA +#define GetWindowLongPtrW GetWindowLongW +#define SetWindowLongPtrA SetWindowLongA +#define SetWindowLongPtrW SetWindowLongW +#endif + +#ifdef UNICODE +#define GetClassLong GetClassLongW +#define SetClassLong SetClassLongW +#else +#define GetClassLong GetClassLongA +#define SetClassLong SetClassLongA +#endif + + WINUSERAPI WORD WINAPI GetClassWord(HWND hWnd,int nIndex); + WINUSERAPI WORD WINAPI SetClassWord(HWND hWnd,int nIndex,WORD wNewWord); + WINUSERAPI DWORD WINAPI GetClassLongA(HWND hWnd,int nIndex); + WINUSERAPI DWORD WINAPI GetClassLongW(HWND hWnd,int nIndex); + WINUSERAPI DWORD WINAPI SetClassLongA(HWND hWnd,int nIndex,LONG dwNewLong); + WINUSERAPI DWORD WINAPI SetClassLongW(HWND hWnd,int nIndex,LONG dwNewLong); + +#ifdef _WIN64 + +#ifdef UNICODE +#define GetClassLongPtr GetClassLongPtrW +#define SetClassLongPtr SetClassLongPtrW +#else +#define GetClassLongPtr GetClassLongPtrA +#define SetClassLongPtr SetClassLongPtrA +#endif + + WINUSERAPI ULONG_PTR WINAPI GetClassLongPtrA(HWND hWnd,int nIndex); + WINUSERAPI ULONG_PTR WINAPI GetClassLongPtrW(HWND hWnd,int nIndex); + WINUSERAPI ULONG_PTR WINAPI SetClassLongPtrA(HWND hWnd,int nIndex,LONG_PTR dwNewLong); + WINUSERAPI ULONG_PTR WINAPI SetClassLongPtrW(HWND hWnd,int nIndex,LONG_PTR dwNewLong); +#else +#ifdef UNICODE +#define GetClassLongPtr GetClassLongPtrW +#define SetClassLongPtr SetClassLongPtrW +#else +#define GetClassLongPtr GetClassLongPtrA +#define SetClassLongPtr SetClassLongPtrA +#endif + +#define GetClassLongPtrA GetClassLongA +#define GetClassLongPtrW GetClassLongW +#define SetClassLongPtrA SetClassLongA +#define SetClassLongPtrW SetClassLongW +#endif +#endif + +#ifdef UNICODE +#define FindWindow FindWindowW +#define FindWindowEx FindWindowExW +#define GetClassName GetClassNameW +#else +#define FindWindow FindWindowA +#define FindWindowEx FindWindowExA +#define GetClassName GetClassNameA +#endif + + WINUSERAPI WINBOOL WINAPI GetProcessDefaultLayout(DWORD *pdwDefaultLayout); + WINUSERAPI WINBOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout); + WINUSERAPI HWND WINAPI GetDesktopWindow(VOID); + WINUSERAPI HWND WINAPI GetParent(HWND hWnd); + WINUSERAPI HWND WINAPI SetParent(HWND hWndChild,HWND hWndNewParent); + WINUSERAPI WINBOOL WINAPI EnumChildWindows(HWND hWndParent,WNDENUMPROC lpEnumFunc,LPARAM lParam); + WINUSERAPI HWND WINAPI FindWindowA(LPCSTR lpClassName,LPCSTR lpWindowName); + WINUSERAPI HWND WINAPI FindWindowW(LPCWSTR lpClassName,LPCWSTR lpWindowName); + WINUSERAPI HWND WINAPI FindWindowExA(HWND hWndParent,HWND hWndChildAfter,LPCSTR lpszClass,LPCSTR lpszWindow); + WINUSERAPI HWND WINAPI FindWindowExW(HWND hWndParent,HWND hWndChildAfter,LPCWSTR lpszClass,LPCWSTR lpszWindow); + WINUSERAPI HWND WINAPI GetShellWindow(VOID); + WINUSERAPI WINBOOL WINAPI RegisterShellHookWindow(HWND hwnd); + WINUSERAPI WINBOOL WINAPI DeregisterShellHookWindow(HWND hwnd); + WINUSERAPI WINBOOL WINAPI EnumWindows(WNDENUMPROC lpEnumFunc,LPARAM lParam); + WINUSERAPI WINBOOL WINAPI EnumThreadWindows(DWORD dwThreadId,WNDENUMPROC lpfn,LPARAM lParam); + +#define EnumTaskWindows(hTask,lpfn,lParam) EnumThreadWindows(HandleToUlong(hTask),lpfn,lParam) + + WINUSERAPI int WINAPI GetClassNameA(HWND hWnd,LPSTR lpClassName,int nMaxCount); + WINUSERAPI int WINAPI GetClassNameW(HWND hWnd,LPWSTR lpClassName,int nMaxCount); + WINUSERAPI HWND WINAPI GetTopWindow(HWND hWnd); + +#define GetNextWindow(hWnd,wCmd) GetWindow(hWnd,wCmd) +#define GetSysModalWindow() (NULL) +#define SetSysModalWindow(hWnd) (NULL) + + WINUSERAPI DWORD WINAPI GetWindowThreadProcessId(HWND hWnd,LPDWORD lpdwProcessId); + WINUSERAPI WINBOOL WINAPI IsGUIThread(WINBOOL bConvert); + +#define GetWindowTask(hWnd) ((HANDLE)(DWORD_PTR)GetWindowThreadProcessId(hWnd,NULL)) + + WINUSERAPI HWND WINAPI GetLastActivePopup(HWND hWnd); + +#define GW_HWNDFIRST 0 +#define GW_HWNDLAST 1 +#define GW_HWNDNEXT 2 +#define GW_HWNDPREV 3 +#define GW_OWNER 4 +#define GW_CHILD 5 +#define GW_ENABLEDPOPUP 6 +#define GW_MAX 6 + + WINUSERAPI HWND WINAPI GetWindow(HWND hWnd,UINT uCmd); + +#ifndef NOWH + +#ifdef UNICODE +#define SetWindowsHook SetWindowsHookW +#define SetWindowsHookEx SetWindowsHookExW +#else +#define SetWindowsHook SetWindowsHookA +#define SetWindowsHookEx SetWindowsHookExA +#endif + + WINUSERAPI HHOOK WINAPI SetWindowsHookA(int nFilterType,HOOKPROC pfnFilterProc); + WINUSERAPI HHOOK WINAPI SetWindowsHookW(int nFilterType,HOOKPROC pfnFilterProc); + WINUSERAPI WINBOOL WINAPI UnhookWindowsHook(int nCode,HOOKPROC pfnFilterProc); + WINUSERAPI HHOOK WINAPI SetWindowsHookExA(int idHook,HOOKPROC lpfn,HINSTANCE hmod,DWORD dwThreadId); + WINUSERAPI HHOOK WINAPI SetWindowsHookExW(int idHook,HOOKPROC lpfn,HINSTANCE hmod,DWORD dwThreadId); + WINUSERAPI WINBOOL WINAPI UnhookWindowsHookEx(HHOOK hhk); + WINUSERAPI LRESULT WINAPI CallNextHookEx(HHOOK hhk,int nCode,WPARAM wParam,LPARAM lParam); +#define DefHookProc(nCode,wParam,lParam,phhk) CallNextHookEx(*phhk,nCode,wParam,lParam) +#endif + +#ifndef NOMENUS + +#define MF_INSERT 0x00000000L +#define MF_CHANGE 0x00000080L +#define MF_APPEND 0x00000100L +#define MF_DELETE 0x00000200L +#define MF_REMOVE 0x00001000L +#define MF_BYCOMMAND 0x00000000L +#define MF_BYPOSITION 0x00000400L +#define MF_SEPARATOR 0x00000800L +#define MF_ENABLED 0x00000000L +#define MF_GRAYED 0x00000001L +#define MF_DISABLED 0x00000002L +#define MF_UNCHECKED 0x00000000L +#define MF_CHECKED 0x00000008L +#define MF_USECHECKBITMAPS 0x00000200L +#define MF_STRING 0x00000000L +#define MF_BITMAP 0x00000004L +#define MF_OWNERDRAW 0x00000100L +#define MF_POPUP 0x00000010L +#define MF_MENUBARBREAK 0x00000020L +#define MF_MENUBREAK 0x00000040L +#define MF_UNHILITE 0x00000000L +#define MF_HILITE 0x00000080L +#define MF_DEFAULT 0x00001000L +#define MF_SYSMENU 0x00002000L +#define MF_HELP 0x00004000L +#define MF_RIGHTJUSTIFY 0x00004000L +#define MF_MOUSESELECT 0x00008000L +#define MF_END 0x00000080L + +#define MFT_STRING MF_STRING +#define MFT_BITMAP MF_BITMAP +#define MFT_MENUBARBREAK MF_MENUBARBREAK +#define MFT_MENUBREAK MF_MENUBREAK +#define MFT_OWNERDRAW MF_OWNERDRAW +#define MFT_RADIOCHECK 0x00000200L +#define MFT_SEPARATOR MF_SEPARATOR +#define MFT_RIGHTORDER 0x00002000L +#define MFT_RIGHTJUSTIFY MF_RIGHTJUSTIFY + +#define MFS_GRAYED 0x00000003L +#define MFS_DISABLED MFS_GRAYED +#define MFS_CHECKED MF_CHECKED +#define MFS_HILITE MF_HILITE +#define MFS_ENABLED MF_ENABLED +#define MFS_UNCHECKED MF_UNCHECKED +#define MFS_UNHILITE MF_UNHILITE +#define MFS_DEFAULT MF_DEFAULT + + WINUSERAPI WINBOOL WINAPI CheckMenuRadioItem(HMENU hmenu,UINT first,UINT last,UINT check,UINT flags); + + typedef struct { + WORD versionNumber; + WORD offset; + } MENUITEMTEMPLATEHEADER,*PMENUITEMTEMPLATEHEADER; + + typedef struct { + WORD mtOption; + WORD mtID; + WCHAR mtString[1]; + } MENUITEMTEMPLATE,*PMENUITEMTEMPLATE; +#define MF_END 0x00000080L +#endif + +#ifndef NOSYSCOMMANDS + +#define SC_SIZE 0xF000 +#define SC_MOVE 0xF010 +#define SC_MINIMIZE 0xF020 +#define SC_MAXIMIZE 0xF030 +#define SC_NEXTWINDOW 0xF040 +#define SC_PREVWINDOW 0xF050 +#define SC_CLOSE 0xF060 +#define SC_VSCROLL 0xF070 +#define SC_HSCROLL 0xF080 +#define SC_MOUSEMENU 0xF090 +#define SC_KEYMENU 0xF100 +#define SC_ARRANGE 0xF110 +#define SC_RESTORE 0xF120 +#define SC_TASKLIST 0xF130 +#define SC_SCREENSAVE 0xF140 +#define SC_HOTKEY 0xF150 +#define SC_DEFAULT 0xF160 +#define SC_MONITORPOWER 0xF170 +#define SC_CONTEXTHELP 0xF180 +#define SC_SEPARATOR 0xF00F +#define SC_ICON SC_MINIMIZE +#define SC_ZOOM SC_MAXIMIZE +#endif + +#ifdef UNICODE +#define LoadBitmap LoadBitmapW +#define LoadCursor LoadCursorW +#define LoadCursorFromFile LoadCursorFromFileW +#else +#define LoadBitmap LoadBitmapA +#define LoadCursor LoadCursorA +#define LoadCursorFromFile LoadCursorFromFileA +#endif + + WINUSERAPI HBITMAP WINAPI LoadBitmapA(HINSTANCE hInstance,LPCSTR lpBitmapName); + WINUSERAPI HBITMAP WINAPI LoadBitmapW(HINSTANCE hInstance,LPCWSTR lpBitmapName); + WINUSERAPI HCURSOR WINAPI LoadCursorA(HINSTANCE hInstance,LPCSTR lpCursorName); + WINUSERAPI HCURSOR WINAPI LoadCursorW(HINSTANCE hInstance,LPCWSTR lpCursorName); + WINUSERAPI HCURSOR WINAPI LoadCursorFromFileA(LPCSTR lpFileName); + WINUSERAPI HCURSOR WINAPI LoadCursorFromFileW(LPCWSTR lpFileName); + WINUSERAPI HCURSOR WINAPI CreateCursor(HINSTANCE hInst,int xHotSpot,int yHotSpot,int nWidth,int nHeight,CONST VOID *pvANDPlane,CONST VOID *pvXORPlane); + WINUSERAPI WINBOOL WINAPI DestroyCursor(HCURSOR hCursor); + +#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur))) + +#define IDC_ARROW MAKEINTRESOURCE(32512) +#define IDC_IBEAM MAKEINTRESOURCE(32513) +#define IDC_WAIT MAKEINTRESOURCE(32514) +#define IDC_CROSS MAKEINTRESOURCE(32515) +#define IDC_UPARROW MAKEINTRESOURCE(32516) +#define IDC_SIZE MAKEINTRESOURCE(32640) +#define IDC_ICON MAKEINTRESOURCE(32641) +#define IDC_SIZENWSE MAKEINTRESOURCE(32642) +#define IDC_SIZENESW MAKEINTRESOURCE(32643) +#define IDC_SIZEWE MAKEINTRESOURCE(32644) +#define IDC_SIZENS MAKEINTRESOURCE(32645) +#define IDC_SIZEALL MAKEINTRESOURCE(32646) +#define IDC_NO MAKEINTRESOURCE(32648) +#define IDC_HAND MAKEINTRESOURCE(32649) +#define IDC_APPSTARTING MAKEINTRESOURCE(32650) +#define IDC_HELP MAKEINTRESOURCE(32651) + + WINUSERAPI WINBOOL WINAPI SetSystemCursor(HCURSOR hcur,DWORD id); + + typedef struct _ICONINFO { + WINBOOL fIcon; + DWORD xHotspot; + DWORD yHotspot; + HBITMAP hbmMask; + HBITMAP hbmColor; + } ICONINFO; + typedef ICONINFO *PICONINFO; + +#ifdef UNICODE +#define LoadIcon LoadIconW +#define PrivateExtractIcons PrivateExtractIconsW +#else +#define LoadIcon LoadIconA +#define PrivateExtractIcons PrivateExtractIconsA +#endif + + WINUSERAPI HICON WINAPI LoadIconA(HINSTANCE hInstance,LPCSTR lpIconName); + WINUSERAPI HICON WINAPI LoadIconW(HINSTANCE hInstance,LPCWSTR lpIconName); + WINUSERAPI UINT WINAPI PrivateExtractIconsA(LPCSTR szFileName,int nIconIndex,int cxIcon,int cyIcon,HICON *phicon,UINT *piconid,UINT nIcons,UINT flags); + WINUSERAPI UINT WINAPI PrivateExtractIconsW(LPCWSTR szFileName,int nIconIndex,int cxIcon,int cyIcon,HICON *phicon,UINT *piconid,UINT nIcons,UINT flags); + WINUSERAPI HICON WINAPI CreateIcon(HINSTANCE hInstance,int nWidth,int nHeight,BYTE cPlanes,BYTE cBitsPixel,CONST BYTE *lpbANDbits,CONST BYTE *lpbXORbits); + WINUSERAPI WINBOOL WINAPI DestroyIcon(HICON hIcon); + WINUSERAPI int WINAPI LookupIconIdFromDirectory(PBYTE presbits,WINBOOL fIcon); + WINUSERAPI int WINAPI LookupIconIdFromDirectoryEx(PBYTE presbits,WINBOOL fIcon,int cxDesired,int cyDesired,UINT Flags); + WINUSERAPI HICON WINAPI CreateIconFromResource(PBYTE presbits,DWORD dwResSize,WINBOOL fIcon,DWORD dwVer); + WINUSERAPI HICON WINAPI CreateIconFromResourceEx(PBYTE presbits,DWORD dwResSize,WINBOOL fIcon,DWORD dwVer,int cxDesired,int cyDesired,UINT Flags); + + typedef struct tagCURSORSHAPE { + int xHotSpot; + int yHotSpot; + int cx; + int cy; + int cbWidth; + BYTE Planes; + BYTE BitsPixel; + } CURSORSHAPE,*LPCURSORSHAPE; + +#define IMAGE_BITMAP 0 +#define IMAGE_ICON 1 +#define IMAGE_CURSOR 2 +#define IMAGE_ENHMETAFILE 3 + +#define LR_DEFAULTCOLOR 0x0000 +#define LR_MONOCHROME 0x0001 +#define LR_COLOR 0x0002 +#define LR_COPYRETURNORG 0x0004 +#define LR_COPYDELETEORG 0x0008 +#define LR_LOADFROMFILE 0x0010 +#define LR_LOADTRANSPARENT 0x0020 +#define LR_DEFAULTSIZE 0x0040 +#define LR_VGACOLOR 0x0080 +#define LR_LOADMAP3DCOLORS 0x1000 +#define LR_CREATEDIBSECTION 0x2000 +#define LR_COPYFROMRESOURCE 0x4000 +#define LR_SHARED 0x8000 + +#ifdef UNICODE +#define LoadImage LoadImageW +#else +#define LoadImage LoadImageA +#endif + + WINUSERAPI HANDLE WINAPI LoadImageA(HINSTANCE hInst,LPCSTR name,UINT type,int cx,int cy,UINT fuLoad); + WINUSERAPI HANDLE WINAPI LoadImageW(HINSTANCE hInst,LPCWSTR name,UINT type,int cx,int cy,UINT fuLoad); + WINUSERAPI HANDLE WINAPI CopyImage(HANDLE h,UINT type,int cx,int cy,UINT flags); + +#define DI_MASK 0x0001 +#define DI_IMAGE 0x0002 +#define DI_NORMAL 0x0003 +#define DI_COMPAT 0x0004 +#define DI_DEFAULTSIZE 0x0008 +#define DI_NOMIRROR 0x0010 + + WINUSERAPI WINBOOL WINAPI DrawIconEx(HDC hdc,int xLeft,int yTop,HICON hIcon,int cxWidth,int cyWidth,UINT istepIfAniCur,HBRUSH hbrFlickerFreeDraw,UINT diFlags); + WINUSERAPI HICON WINAPI CreateIconIndirect(PICONINFO piconinfo); + WINUSERAPI HICON WINAPI CopyIcon(HICON hIcon); + WINUSERAPI WINBOOL WINAPI GetIconInfo(HICON hIcon,PICONINFO piconinfo); + +#define RES_ICON 1 +#define RES_CURSOR 2 + +#ifdef OEMRESOURCE + +#define OBM_CLOSE 32754 +#define OBM_UPARROW 32753 +#define OBM_DNARROW 32752 +#define OBM_RGARROW 32751 +#define OBM_LFARROW 32750 +#define OBM_REDUCE 32749 +#define OBM_ZOOM 32748 +#define OBM_RESTORE 32747 +#define OBM_REDUCED 32746 +#define OBM_ZOOMD 32745 +#define OBM_RESTORED 32744 +#define OBM_UPARROWD 32743 +#define OBM_DNARROWD 32742 +#define OBM_RGARROWD 32741 +#define OBM_LFARROWD 32740 +#define OBM_MNARROW 32739 +#define OBM_COMBO 32738 +#define OBM_UPARROWI 32737 +#define OBM_DNARROWI 32736 +#define OBM_RGARROWI 32735 +#define OBM_LFARROWI 32734 + +#define OBM_OLD_CLOSE 32767 +#define OBM_SIZE 32766 +#define OBM_OLD_UPARROW 32765 +#define OBM_OLD_DNARROW 32764 +#define OBM_OLD_RGARROW 32763 +#define OBM_OLD_LFARROW 32762 +#define OBM_BTSIZE 32761 +#define OBM_CHECK 32760 +#define OBM_CHECKBOXES 32759 +#define OBM_BTNCORNERS 32758 +#define OBM_OLD_REDUCE 32757 +#define OBM_OLD_ZOOM 32756 +#define OBM_OLD_RESTORE 32755 + +#define OCR_NORMAL 32512 +#define OCR_IBEAM 32513 +#define OCR_WAIT 32514 +#define OCR_CROSS 32515 +#define OCR_UP 32516 +#define OCR_SIZE 32640 +#define OCR_ICON 32641 +#define OCR_SIZENWSE 32642 +#define OCR_SIZENESW 32643 +#define OCR_SIZEWE 32644 +#define OCR_SIZENS 32645 +#define OCR_SIZEALL 32646 +#define OCR_ICOCUR 32647 +#define OCR_NO 32648 +#define OCR_HAND 32649 +#define OCR_APPSTARTING 32650 + +#define OIC_SAMPLE 32512 +#define OIC_HAND 32513 +#define OIC_QUES 32514 +#define OIC_BANG 32515 +#define OIC_NOTE 32516 +#define OIC_WINLOGO 32517 +#define OIC_WARNING OIC_BANG +#define OIC_ERROR OIC_HAND +#define OIC_INFORMATION OIC_NOTE +#endif + +#define ORD_LANGDRIVER 1 + +#ifndef NOICONS + +#ifdef RC_INVOKED +#define IDI_APPLICATION 32512 +#define IDI_HAND 32513 +#define IDI_QUESTION 32514 +#define IDI_EXCLAMATION 32515 +#define IDI_ASTERISK 32516 +#define IDI_WINLOGO 32517 +#else +#define IDI_APPLICATION MAKEINTRESOURCE(32512) +#define IDI_HAND MAKEINTRESOURCE(32513) +#define IDI_QUESTION MAKEINTRESOURCE(32514) +#define IDI_EXCLAMATION MAKEINTRESOURCE(32515) +#define IDI_ASTERISK MAKEINTRESOURCE(32516) +#define IDI_WINLOGO MAKEINTRESOURCE(32517) +#endif + +#define IDI_WARNING IDI_EXCLAMATION +#define IDI_ERROR IDI_HAND +#define IDI_INFORMATION IDI_ASTERISK +#endif + +#ifdef UNICODE +#define LoadString LoadStringW +#else +#define LoadString LoadStringA +#endif + + WINUSERAPI int WINAPI LoadStringA(HINSTANCE hInstance,UINT uID,LPSTR lpBuffer,int cchBufferMax); + WINUSERAPI int WINAPI LoadStringW(HINSTANCE hInstance,UINT uID,LPWSTR lpBuffer,int cchBufferMax); + +#define IDOK 1 +#define IDCANCEL 2 +#define IDABORT 3 +#define IDRETRY 4 +#define IDIGNORE 5 +#define IDYES 6 +#define IDNO 7 +#define IDCLOSE 8 +#define IDHELP 9 +#define IDTRYAGAIN 10 +#define IDCONTINUE 11 + +#ifndef IDTIMEOUT +#define IDTIMEOUT 32000 +#endif + +#ifndef NOCTLMGR + +#ifndef NOWINSTYLES +#define ES_LEFT 0x0000L +#define ES_CENTER 0x0001L +#define ES_RIGHT 0x0002L +#define ES_MULTILINE 0x0004L +#define ES_UPPERCASE 0x0008L +#define ES_LOWERCASE 0x0010L +#define ES_PASSWORD 0x0020L +#define ES_AUTOVSCROLL 0x0040L +#define ES_AUTOHSCROLL 0x0080L +#define ES_NOHIDESEL 0x0100L +#define ES_OEMCONVERT 0x0400L +#define ES_READONLY 0x0800L +#define ES_WANTRETURN 0x1000L +#define ES_NUMBER 0x2000L +#endif + +#define EN_SETFOCUS 0x0100 +#define EN_KILLFOCUS 0x0200 +#define EN_CHANGE 0x0300 +#define EN_UPDATE 0x0400 +#define EN_ERRSPACE 0x0500 +#define EN_MAXTEXT 0x0501 +#define EN_HSCROLL 0x0601 +#define EN_VSCROLL 0x0602 +#define EN_ALIGN_LTR_EC 0x0700 +#define EN_ALIGN_RTL_EC 0x0701 + +#define EC_LEFTMARGIN 0x0001 +#define EC_RIGHTMARGIN 0x0002 +#define EC_USEFONTINFO 0xffff + +#define EMSIS_COMPOSITIONSTRING 0x0001 + +#define EIMES_GETCOMPSTRATONCE 0x0001 +#define EIMES_CANCELCOMPSTRINFOCUS 0x0002 +#define EIMES_COMPLETECOMPSTRKILLFOCUS 0x0004 + +#ifndef NOWINMESSAGES + +#define EM_GETSEL 0x00B0 +#define EM_SETSEL 0x00B1 +#define EM_GETRECT 0x00B2 +#define EM_SETRECT 0x00B3 +#define EM_SETRECTNP 0x00B4 +#define EM_SCROLL 0x00B5 +#define EM_LINESCROLL 0x00B6 +#define EM_SCROLLCARET 0x00B7 +#define EM_GETMODIFY 0x00B8 +#define EM_SETMODIFY 0x00B9 +#define EM_GETLINECOUNT 0x00BA +#define EM_LINEINDEX 0x00BB +#define EM_SETHANDLE 0x00BC +#define EM_GETHANDLE 0x00BD +#define EM_GETTHUMB 0x00BE +#define EM_LINELENGTH 0x00C1 +#define EM_REPLACESEL 0x00C2 +#define EM_GETLINE 0x00C4 +#define EM_LIMITTEXT 0x00C5 +#define EM_CANUNDO 0x00C6 +#define EM_UNDO 0x00C7 +#define EM_FMTLINES 0x00C8 +#define EM_LINEFROMCHAR 0x00C9 +#define EM_SETTABSTOPS 0x00CB +#define EM_SETPASSWORDCHAR 0x00CC +#define EM_EMPTYUNDOBUFFER 0x00CD +#define EM_GETFIRSTVISIBLELINE 0x00CE +#define EM_SETREADONLY 0x00CF +#define EM_SETWORDBREAKPROC 0x00D0 +#define EM_GETWORDBREAKPROC 0x00D1 +#define EM_GETPASSWORDCHAR 0x00D2 +#define EM_SETMARGINS 0x00D3 +#define EM_GETMARGINS 0x00D4 +#define EM_SETLIMITTEXT EM_LIMITTEXT +#define EM_GETLIMITTEXT 0x00D5 +#define EM_POSFROMCHAR 0x00D6 +#define EM_CHARFROMPOS 0x00D7 +#define EM_SETIMESTATUS 0x00D8 +#define EM_GETIMESTATUS 0x00D9 +#endif + +#define WB_LEFT 0 +#define WB_RIGHT 1 +#define WB_ISDELIMITER 2 + +#define BS_PUSHBUTTON 0x00000000L +#define BS_DEFPUSHBUTTON 0x00000001L +#define BS_CHECKBOX 0x00000002L +#define BS_AUTOCHECKBOX 0x00000003L +#define BS_RADIOBUTTON 0x00000004L +#define BS_3STATE 0x00000005L +#define BS_AUTO3STATE 0x00000006L +#define BS_GROUPBOX 0x00000007L +#define BS_USERBUTTON 0x00000008L +#define BS_AUTORADIOBUTTON 0x00000009L +#define BS_PUSHBOX 0x0000000AL +#define BS_OWNERDRAW 0x0000000BL +#define BS_TYPEMASK 0x0000000FL +#define BS_LEFTTEXT 0x00000020L +#define BS_TEXT 0x00000000L +#define BS_ICON 0x00000040L +#define BS_BITMAP 0x00000080L +#define BS_LEFT 0x00000100L +#define BS_RIGHT 0x00000200L +#define BS_CENTER 0x00000300L +#define BS_TOP 0x00000400L +#define BS_BOTTOM 0x00000800L +#define BS_VCENTER 0x00000C00L +#define BS_PUSHLIKE 0x00001000L +#define BS_MULTILINE 0x00002000L +#define BS_NOTIFY 0x00004000L +#define BS_FLAT 0x00008000L +#define BS_RIGHTBUTTON BS_LEFTTEXT + +#define BN_CLICKED 0 +#define BN_PAINT 1 +#define BN_HILITE 2 +#define BN_UNHILITE 3 +#define BN_DISABLE 4 +#define BN_DOUBLECLICKED 5 +#define BN_PUSHED BN_HILITE +#define BN_UNPUSHED BN_UNHILITE +#define BN_DBLCLK BN_DOUBLECLICKED +#define BN_SETFOCUS 6 +#define BN_KILLFOCUS 7 + +#define BM_GETCHECK 0x00F0 +#define BM_SETCHECK 0x00F1 +#define BM_GETSTATE 0x00F2 +#define BM_SETSTATE 0x00F3 +#define BM_SETSTYLE 0x00F4 +#define BM_CLICK 0x00F5 +#define BM_GETIMAGE 0x00F6 +#define BM_SETIMAGE 0x00F7 + +#define BST_UNCHECKED 0x0000 +#define BST_CHECKED 0x0001 +#define BST_INDETERMINATE 0x0002 +#define BST_PUSHED 0x0004 +#define BST_FOCUS 0x0008 + +#define SS_LEFT 0x00000000L +#define SS_CENTER 0x00000001L +#define SS_RIGHT 0x00000002L +#define SS_ICON 0x00000003L +#define SS_BLACKRECT 0x00000004L +#define SS_GRAYRECT 0x00000005L +#define SS_WHITERECT 0x00000006L +#define SS_BLACKFRAME 0x00000007L +#define SS_GRAYFRAME 0x00000008L +#define SS_WHITEFRAME 0x00000009L +#define SS_USERITEM 0x0000000AL +#define SS_SIMPLE 0x0000000BL +#define SS_LEFTNOWORDWRAP 0x0000000CL +#define SS_OWNERDRAW 0x0000000DL +#define SS_BITMAP 0x0000000EL +#define SS_ENHMETAFILE 0x0000000FL +#define SS_ETCHEDHORZ 0x00000010L +#define SS_ETCHEDVERT 0x00000011L +#define SS_ETCHEDFRAME 0x00000012L +#define SS_TYPEMASK 0x0000001FL +#define SS_REALSIZECONTROL 0x00000040L +#define SS_NOPREFIX 0x00000080L +#define SS_NOTIFY 0x00000100L +#define SS_CENTERIMAGE 0x00000200L +#define SS_RIGHTJUST 0x00000400L +#define SS_REALSIZEIMAGE 0x00000800L +#define SS_SUNKEN 0x00001000L +#define SS_EDITCONTROL 0x00002000L +#define SS_ENDELLIPSIS 0x00004000L +#define SS_PATHELLIPSIS 0x00008000L +#define SS_WORDELLIPSIS 0x0000C000L +#define SS_ELLIPSISMASK 0x0000C000L + +#ifndef NOWINMESSAGES + +#define STM_SETICON 0x0170 +#define STM_GETICON 0x0171 +#define STM_SETIMAGE 0x0172 +#define STM_GETIMAGE 0x0173 +#define STN_CLICKED 0 +#define STN_DBLCLK 1 +#define STN_ENABLE 2 +#define STN_DISABLE 3 +#define STM_MSGMAX 0x0174 +#endif + +#define WC_DIALOG (MAKEINTATOM(0x8002)) + +#define DWL_MSGRESULT 0 +#define DWL_DLGPROC 4 +#define DWL_USER 8 + +#ifdef _WIN64 + +#undef DWL_MSGRESULT +#undef DWL_DLGPROC +#undef DWL_USER +#endif + +#define DWLP_MSGRESULT 0 +#define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT) +#define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC) + +#ifndef NOMSG + +#ifdef UNICODE +#define IsDialogMessage IsDialogMessageW +#else +#define IsDialogMessage IsDialogMessageA +#endif + + WINUSERAPI WINBOOL WINAPI IsDialogMessageA(HWND hDlg,LPMSG lpMsg); + WINUSERAPI WINBOOL WINAPI IsDialogMessageW(HWND hDlg,LPMSG lpMsg); +#endif + +#ifdef UNICODE +#define DlgDirList DlgDirListW +#define DlgDirSelectEx DlgDirSelectExW +#define DlgDirListComboBox DlgDirListComboBoxW +#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExW +#else +#define DlgDirList DlgDirListA +#define DlgDirSelectEx DlgDirSelectExA +#define DlgDirListComboBox DlgDirListComboBoxA +#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExA +#endif + + WINUSERAPI WINBOOL WINAPI MapDialogRect(HWND hDlg,LPRECT lpRect); + WINUSERAPI int WINAPI DlgDirListA(HWND hDlg,LPSTR lpPathSpec,int nIDListBox,int nIDStaticPath,UINT uFileType); + WINUSERAPI int WINAPI DlgDirListW(HWND hDlg,LPWSTR lpPathSpec,int nIDListBox,int nIDStaticPath,UINT uFileType); + +#define DDL_READWRITE 0x0000 +#define DDL_READONLY 0x0001 +#define DDL_HIDDEN 0x0002 +#define DDL_SYSTEM 0x0004 +#define DDL_DIRECTORY 0x0010 +#define DDL_ARCHIVE 0x0020 + +#define DDL_POSTMSGS 0x2000 +#define DDL_DRIVES 0x4000 +#define DDL_EXCLUSIVE 0x8000 + + WINUSERAPI WINBOOL WINAPI DlgDirSelectExA(HWND hwndDlg,LPSTR lpString,int chCount,int idListBox); + WINUSERAPI WINBOOL WINAPI DlgDirSelectExW(HWND hwndDlg,LPWSTR lpString,int chCount,int idListBox); + WINUSERAPI int WINAPI DlgDirListComboBoxA(HWND hDlg,LPSTR lpPathSpec,int nIDComboBox,int nIDStaticPath,UINT uFiletype); + WINUSERAPI int WINAPI DlgDirListComboBoxW(HWND hDlg,LPWSTR lpPathSpec,int nIDComboBox,int nIDStaticPath,UINT uFiletype); + WINUSERAPI WINBOOL WINAPI DlgDirSelectComboBoxExA(HWND hwndDlg,LPSTR lpString,int cchOut,int idComboBox); + WINUSERAPI WINBOOL WINAPI DlgDirSelectComboBoxExW(HWND hwndDlg,LPWSTR lpString,int cchOut,int idComboBox); + +#define DS_ABSALIGN 0x01L +#define DS_SYSMODAL 0x02L +#define DS_LOCALEDIT 0x20L +#define DS_SETFONT 0x40L +#define DS_MODALFRAME 0x80L +#define DS_NOIDLEMSG 0x100L +#define DS_SETFOREGROUND 0x200L + +#define DS_3DLOOK 0x0004L +#define DS_FIXEDSYS 0x0008L +#define DS_NOFAILCREATE 0x0010L +#define DS_CONTROL 0x0400L +#define DS_CENTER 0x0800L +#define DS_CENTERMOUSE 0x1000L +#define DS_CONTEXTHELP 0x2000L + +#define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS) + +#if(_WIN32_WCE >= 0x0500) +#define DS_USEPIXELS 0x8000L +#endif + +#define DM_GETDEFID (WM_USER+0) +#define DM_SETDEFID (WM_USER+1) +#define DM_REPOSITION (WM_USER+2) + +#define DC_HASDEFID 0x534B + +#define DLGC_WANTARROWS 0x0001 +#define DLGC_WANTTAB 0x0002 +#define DLGC_WANTALLKEYS 0x0004 +#define DLGC_WANTMESSAGE 0x0004 +#define DLGC_HASSETSEL 0x0008 +#define DLGC_DEFPUSHBUTTON 0x0010 +#define DLGC_UNDEFPUSHBUTTON 0x0020 +#define DLGC_RADIOBUTTON 0x0040 +#define DLGC_WANTCHARS 0x0080 +#define DLGC_STATIC 0x0100 +#define DLGC_BUTTON 0x2000 + +#define LB_CTLCODE 0L + +#define LB_OKAY 0 +#define LB_ERR (-1) +#define LB_ERRSPACE (-2) + +#define LBN_ERRSPACE (-2) +#define LBN_SELCHANGE 1 +#define LBN_DBLCLK 2 +#define LBN_SELCANCEL 3 +#define LBN_SETFOCUS 4 +#define LBN_KILLFOCUS 5 + +#ifndef NOWINMESSAGES + +#define LB_ADDSTRING 0x0180 +#define LB_INSERTSTRING 0x0181 +#define LB_DELETESTRING 0x0182 +#define LB_SELITEMRANGEEX 0x0183 +#define LB_RESETCONTENT 0x0184 +#define LB_SETSEL 0x0185 +#define LB_SETCURSEL 0x0186 +#define LB_GETSEL 0x0187 +#define LB_GETCURSEL 0x0188 +#define LB_GETTEXT 0x0189 +#define LB_GETTEXTLEN 0x018A +#define LB_GETCOUNT 0x018B +#define LB_SELECTSTRING 0x018C +#define LB_DIR 0x018D +#define LB_GETTOPINDEX 0x018E +#define LB_FINDSTRING 0x018F +#define LB_GETSELCOUNT 0x0190 +#define LB_GETSELITEMS 0x0191 +#define LB_SETTABSTOPS 0x0192 +#define LB_GETHORIZONTALEXTENT 0x0193 +#define LB_SETHORIZONTALEXTENT 0x0194 +#define LB_SETCOLUMNWIDTH 0x0195 +#define LB_ADDFILE 0x0196 +#define LB_SETTOPINDEX 0x0197 +#define LB_GETITEMRECT 0x0198 +#define LB_GETITEMDATA 0x0199 +#define LB_SETITEMDATA 0x019A +#define LB_SELITEMRANGE 0x019B +#define LB_SETANCHORINDEX 0x019C +#define LB_GETANCHORINDEX 0x019D +#define LB_SETCARETINDEX 0x019E +#define LB_GETCARETINDEX 0x019F +#define LB_SETITEMHEIGHT 0x01A0 +#define LB_GETITEMHEIGHT 0x01A1 +#define LB_FINDSTRINGEXACT 0x01A2 +#define LB_SETLOCALE 0x01A5 +#define LB_GETLOCALE 0x01A6 +#define LB_SETCOUNT 0x01A7 +#define LB_INITSTORAGE 0x01A8 +#define LB_ITEMFROMPOINT 0x01A9 +#if(_WIN32_WCE >= 0x0400) +#define LB_MULTIPLEADDSTRING 0x01B1 +#endif +#define LB_GETLISTBOXINFO 0x01B2 +#define LB_MSGMAX 0x01B3 +#endif + +#ifndef NOWINSTYLES + +#define LBS_NOTIFY 0x0001L +#define LBS_SORT 0x0002L +#define LBS_NOREDRAW 0x0004L +#define LBS_MULTIPLESEL 0x0008L +#define LBS_OWNERDRAWFIXED 0x0010L +#define LBS_OWNERDRAWVARIABLE 0x0020L +#define LBS_HASSTRINGS 0x0040L +#define LBS_USETABSTOPS 0x0080L +#define LBS_NOINTEGRALHEIGHT 0x0100L +#define LBS_MULTICOLUMN 0x0200L +#define LBS_WANTKEYBOARDINPUT 0x0400L +#define LBS_EXTENDEDSEL 0x0800L +#define LBS_DISABLENOSCROLL 0x1000L +#define LBS_NODATA 0x2000L +#define LBS_NOSEL 0x4000L +#define LBS_COMBOBOX 0x8000L + +#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER) +#endif + +#define CB_OKAY 0 +#define CB_ERR (-1) +#define CB_ERRSPACE (-2) + +#define CBN_ERRSPACE (-1) +#define CBN_SELCHANGE 1 +#define CBN_DBLCLK 2 +#define CBN_SETFOCUS 3 +#define CBN_KILLFOCUS 4 +#define CBN_EDITCHANGE 5 +#define CBN_EDITUPDATE 6 +#define CBN_DROPDOWN 7 +#define CBN_CLOSEUP 8 +#define CBN_SELENDOK 9 +#define CBN_SELENDCANCEL 10 + +#ifndef NOWINSTYLES + +#define CBS_SIMPLE 0x0001L +#define CBS_DROPDOWN 0x0002L +#define CBS_DROPDOWNLIST 0x0003L +#define CBS_OWNERDRAWFIXED 0x0010L +#define CBS_OWNERDRAWVARIABLE 0x0020L +#define CBS_AUTOHSCROLL 0x0040L +#define CBS_OEMCONVERT 0x0080L +#define CBS_SORT 0x0100L +#define CBS_HASSTRINGS 0x0200L +#define CBS_NOINTEGRALHEIGHT 0x0400L +#define CBS_DISABLENOSCROLL 0x0800L +#define CBS_UPPERCASE 0x2000L +#define CBS_LOWERCASE 0x4000L +#endif + +#ifndef NOWINMESSAGES +#define CB_GETEDITSEL 0x0140 +#define CB_LIMITTEXT 0x0141 +#define CB_SETEDITSEL 0x0142 +#define CB_ADDSTRING 0x0143 +#define CB_DELETESTRING 0x0144 +#define CB_DIR 0x0145 +#define CB_GETCOUNT 0x0146 +#define CB_GETCURSEL 0x0147 +#define CB_GETLBTEXT 0x0148 +#define CB_GETLBTEXTLEN 0x0149 +#define CB_INSERTSTRING 0x014A +#define CB_RESETCONTENT 0x014B +#define CB_FINDSTRING 0x014C +#define CB_SELECTSTRING 0x014D +#define CB_SETCURSEL 0x014E +#define CB_SHOWDROPDOWN 0x014F +#define CB_GETITEMDATA 0x0150 +#define CB_SETITEMDATA 0x0151 +#define CB_GETDROPPEDCONTROLRECT 0x0152 +#define CB_SETITEMHEIGHT 0x0153 +#define CB_GETITEMHEIGHT 0x0154 +#define CB_SETEXTENDEDUI 0x0155 +#define CB_GETEXTENDEDUI 0x0156 +#define CB_GETDROPPEDSTATE 0x0157 +#define CB_FINDSTRINGEXACT 0x0158 +#define CB_SETLOCALE 0x0159 +#define CB_GETLOCALE 0x015A +#define CB_GETTOPINDEX 0x015b +#define CB_SETTOPINDEX 0x015c +#define CB_GETHORIZONTALEXTENT 0x015d +#define CB_SETHORIZONTALEXTENT 0x015e +#define CB_GETDROPPEDWIDTH 0x015f +#define CB_SETDROPPEDWIDTH 0x0160 +#define CB_INITSTORAGE 0x0161 +#if(_WIN32_WCE >= 0x0400) +#define CB_MULTIPLEADDSTRING 0x0163 +#endif +#define CB_GETCOMBOBOXINFO 0x0164 +#define CB_MSGMAX 0x0165 +#endif + +#ifndef NOWINSTYLES + +#define SBS_HORZ 0x0000L +#define SBS_VERT 0x0001L +#define SBS_TOPALIGN 0x0002L +#define SBS_LEFTALIGN 0x0002L +#define SBS_BOTTOMALIGN 0x0004L +#define SBS_RIGHTALIGN 0x0004L +#define SBS_SIZEBOXTOPLEFTALIGN 0x0002L +#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L +#define SBS_SIZEBOX 0x0008L +#define SBS_SIZEGRIP 0x0010L +#endif + +#ifndef NOWINMESSAGES +#define SBM_SETPOS 0x00E0 +#define SBM_GETPOS 0x00E1 +#define SBM_SETRANGE 0x00E2 +#define SBM_SETRANGEREDRAW 0x00E6 +#define SBM_GETRANGE 0x00E3 +#define SBM_ENABLE_ARROWS 0x00E4 +#define SBM_SETSCROLLINFO 0x00E9 +#define SBM_GETSCROLLINFO 0x00EA +#define SBM_GETSCROLLBARINFO 0x00EB + +#define SIF_RANGE 0x0001 +#define SIF_PAGE 0x0002 +#define SIF_POS 0x0004 +#define SIF_DISABLENOSCROLL 0x0008 +#define SIF_TRACKPOS 0x0010 +#define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS) + + typedef struct tagSCROLLINFO { + UINT cbSize; + UINT fMask; + int nMin; + int nMax; + UINT nPage; + int nPos; + int nTrackPos; + } SCROLLINFO,*LPSCROLLINFO; + typedef SCROLLINFO CONST *LPCSCROLLINFO; + + WINUSERAPI int WINAPI SetScrollInfo(HWND hwnd,int nBar,LPCSCROLLINFO lpsi,WINBOOL redraw); + WINUSERAPI WINBOOL WINAPI GetScrollInfo(HWND hwnd,int nBar,LPSCROLLINFO lpsi); +#endif +#endif + +#ifndef NOMDI + +#define MDIS_ALLCHILDSTYLES 0x0001 + +#define MDITILE_VERTICAL 0x0000 +#define MDITILE_HORIZONTAL 0x0001 +#define MDITILE_SKIPDISABLED 0x0002 +#define MDITILE_ZORDER 0x0004 + + typedef struct tagMDICREATESTRUCTA { + LPCSTR szClass; + LPCSTR szTitle; + HANDLE hOwner; + int x; + int y; + int cx; + int cy; + DWORD style; + LPARAM lParam; + } MDICREATESTRUCTA,*LPMDICREATESTRUCTA; + + typedef struct tagMDICREATESTRUCTW { + LPCWSTR szClass; + LPCWSTR szTitle; + HANDLE hOwner; + int x; + int y; + int cx; + int cy; + DWORD style; + LPARAM lParam; + } MDICREATESTRUCTW,*LPMDICREATESTRUCTW; + +#ifdef UNICODE + typedef MDICREATESTRUCTW MDICREATESTRUCT; + typedef LPMDICREATESTRUCTW LPMDICREATESTRUCT; +#else + typedef MDICREATESTRUCTA MDICREATESTRUCT; + typedef LPMDICREATESTRUCTA LPMDICREATESTRUCT; +#endif + + typedef struct tagCLIENTCREATESTRUCT { + HANDLE hWindowMenu; + UINT idFirstChild; + } CLIENTCREATESTRUCT,*LPCLIENTCREATESTRUCT; + +#ifdef UNICODE +#define DefFrameProc DefFrameProcW +#define DefMDIChildProc DefMDIChildProcW +#define CreateMDIWindow CreateMDIWindowW +#else +#define DefFrameProc DefFrameProcA +#define DefMDIChildProc DefMDIChildProcA +#define CreateMDIWindow CreateMDIWindowA +#endif + + WINUSERAPI LRESULT WINAPI DefFrameProcA(HWND hWnd,HWND hWndMDIClient,UINT uMsg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefFrameProcW(HWND hWnd,HWND hWndMDIClient,UINT uMsg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefMDIChildProcA(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); + WINUSERAPI LRESULT WINAPI DefMDIChildProcW(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); + +#ifndef NOMSG + WINUSERAPI WINBOOL WINAPI TranslateMDISysAccel(HWND hWndClient,LPMSG lpMsg); +#endif + + WINUSERAPI UINT WINAPI ArrangeIconicWindows(HWND hWnd); + WINUSERAPI HWND WINAPI CreateMDIWindowA(LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HINSTANCE hInstance,LPARAM lParam); + WINUSERAPI HWND WINAPI CreateMDIWindowW(LPCWSTR lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HINSTANCE hInstance,LPARAM lParam); + WINUSERAPI WORD WINAPI TileWindows(HWND hwndParent,UINT wHow,CONST RECT *lpRect,UINT cKids,const HWND *lpKids); + WINUSERAPI WORD WINAPI CascadeWindows(HWND hwndParent,UINT wHow,CONST RECT *lpRect,UINT cKids,const HWND *lpKids); +#endif +#endif + +#ifndef NOHELP + + typedef DWORD HELPPOLY; + typedef struct tagMULTIKEYHELPA { + DWORD mkSize; + CHAR mkKeylist; + CHAR szKeyphrase[1]; + } MULTIKEYHELPA,*PMULTIKEYHELPA,*LPMULTIKEYHELPA; + + typedef struct tagMULTIKEYHELPW { + DWORD mkSize; + WCHAR mkKeylist; + WCHAR szKeyphrase[1]; + } MULTIKEYHELPW,*PMULTIKEYHELPW,*LPMULTIKEYHELPW; + +#ifdef UNICODE + typedef MULTIKEYHELPW MULTIKEYHELP; + typedef PMULTIKEYHELPW PMULTIKEYHELP; + typedef LPMULTIKEYHELPW LPMULTIKEYHELP; +#else + typedef MULTIKEYHELPA MULTIKEYHELP; + typedef PMULTIKEYHELPA PMULTIKEYHELP; + typedef LPMULTIKEYHELPA LPMULTIKEYHELP; +#endif + + typedef struct tagHELPWININFOA { + int wStructSize; + int x; + int y; + int dx; + int dy; + int wMax; + CHAR rgchMember[2]; + } HELPWININFOA,*PHELPWININFOA,*LPHELPWININFOA; + + typedef struct tagHELPWININFOW { + int wStructSize; + int x; + int y; + int dx; + int dy; + int wMax; + WCHAR rgchMember[2]; + } HELPWININFOW,*PHELPWININFOW,*LPHELPWININFOW; + +#ifdef UNICODE + typedef HELPWININFOW HELPWININFO; + typedef PHELPWININFOW PHELPWININFO; + typedef LPHELPWININFOW LPHELPWININFO; +#else + typedef HELPWININFOA HELPWININFO; + typedef PHELPWININFOA PHELPWININFO; + typedef LPHELPWININFOA LPHELPWININFO; +#endif + +#define HELP_CONTEXT 0x0001L +#define HELP_QUIT 0x0002L +#define HELP_INDEX 0x0003L +#define HELP_CONTENTS 0x0003L +#define HELP_HELPONHELP 0x0004L +#define HELP_SETINDEX 0x0005L +#define HELP_SETCONTENTS 0x0005L +#define HELP_CONTEXTPOPUP 0x0008L +#define HELP_FORCEFILE 0x0009L +#define HELP_KEY 0x0101L +#define HELP_COMMAND 0x0102L +#define HELP_PARTIALKEY 0x0105L +#define HELP_MULTIKEY 0x0201L +#define HELP_SETWINPOS 0x0203L +#define HELP_CONTEXTMENU 0x000a +#define HELP_FINDER 0x000b +#define HELP_WM_HELP 0x000c +#define HELP_SETPOPUP_POS 0x000d + +#define HELP_TCARD 0x8000 +#define HELP_TCARD_DATA 0x0010 +#define HELP_TCARD_OTHER_CALLER 0x0011 + +#define IDH_NO_HELP 28440 +#define IDH_MISSING_CONTEXT 28441 +#define IDH_GENERIC_HELP_BUTTON 28442 +#define IDH_OK 28443 +#define IDH_CANCEL 28444 +#define IDH_HELP 28445 + +#ifdef UNICODE +#define WinHelp WinHelpW +#else +#define WinHelp WinHelpA +#endif + + WINUSERAPI WINBOOL WINAPI WinHelpA(HWND hWndMain,LPCSTR lpszHelp,UINT uCommand,ULONG_PTR dwData); + WINUSERAPI WINBOOL WINAPI WinHelpW(HWND hWndMain,LPCWSTR lpszHelp,UINT uCommand,ULONG_PTR dwData); +#endif + +#define GR_GDIOBJECTS 0 +#define GR_USEROBJECTS 1 + + WINUSERAPI DWORD WINAPI GetGuiResources(HANDLE hProcess,DWORD uiFlags); + +#ifndef NOSYSPARAMSINFO + +#define SPI_GETBEEP 0x0001 +#define SPI_SETBEEP 0x0002 +#define SPI_GETMOUSE 0x0003 +#define SPI_SETMOUSE 0x0004 +#define SPI_GETBORDER 0x0005 +#define SPI_SETBORDER 0x0006 +#define SPI_GETKEYBOARDSPEED 0x000A +#define SPI_SETKEYBOARDSPEED 0x000B +#define SPI_LANGDRIVER 0x000C +#define SPI_ICONHORIZONTALSPACING 0x000D +#define SPI_GETSCREENSAVETIMEOUT 0x000E +#define SPI_SETSCREENSAVETIMEOUT 0x000F +#define SPI_GETSCREENSAVEACTIVE 0x0010 +#define SPI_SETSCREENSAVEACTIVE 0x0011 +#define SPI_GETGRIDGRANULARITY 0x0012 +#define SPI_SETGRIDGRANULARITY 0x0013 +#define SPI_SETDESKWALLPAPER 0x0014 +#define SPI_SETDESKPATTERN 0x0015 +#define SPI_GETKEYBOARDDELAY 0x0016 +#define SPI_SETKEYBOARDDELAY 0x0017 +#define SPI_ICONVERTICALSPACING 0x0018 +#define SPI_GETICONTITLEWRAP 0x0019 +#define SPI_SETICONTITLEWRAP 0x001A +#define SPI_GETMENUDROPALIGNMENT 0x001B +#define SPI_SETMENUDROPALIGNMENT 0x001C +#define SPI_SETDOUBLECLKWIDTH 0x001D +#define SPI_SETDOUBLECLKHEIGHT 0x001E +#define SPI_GETICONTITLELOGFONT 0x001F +#define SPI_SETDOUBLECLICKTIME 0x0020 +#define SPI_SETMOUSEBUTTONSWAP 0x0021 +#define SPI_SETICONTITLELOGFONT 0x0022 +#define SPI_GETFASTTASKSWITCH 0x0023 +#define SPI_SETFASTTASKSWITCH 0x0024 +#define SPI_SETDRAGFULLWINDOWS 0x0025 +#define SPI_GETDRAGFULLWINDOWS 0x0026 +#define SPI_GETNONCLIENTMETRICS 0x0029 +#define SPI_SETNONCLIENTMETRICS 0x002A +#define SPI_GETMINIMIZEDMETRICS 0x002B +#define SPI_SETMINIMIZEDMETRICS 0x002C +#define SPI_GETICONMETRICS 0x002D +#define SPI_SETICONMETRICS 0x002E +#define SPI_SETWORKAREA 0x002F +#define SPI_GETWORKAREA 0x0030 +#define SPI_SETPENWINDOWS 0x0031 + +#define SPI_GETHIGHCONTRAST 0x0042 +#define SPI_SETHIGHCONTRAST 0x0043 +#define SPI_GETKEYBOARDPREF 0x0044 +#define SPI_SETKEYBOARDPREF 0x0045 +#define SPI_GETSCREENREADER 0x0046 +#define SPI_SETSCREENREADER 0x0047 +#define SPI_GETANIMATION 0x0048 +#define SPI_SETANIMATION 0x0049 +#define SPI_GETFONTSMOOTHING 0x004A +#define SPI_SETFONTSMOOTHING 0x004B +#define SPI_SETDRAGWIDTH 0x004C +#define SPI_SETDRAGHEIGHT 0x004D +#define SPI_SETHANDHELD 0x004E +#define SPI_GETLOWPOWERTIMEOUT 0x004F +#define SPI_GETPOWEROFFTIMEOUT 0x0050 +#define SPI_SETLOWPOWERTIMEOUT 0x0051 +#define SPI_SETPOWEROFFTIMEOUT 0x0052 +#define SPI_GETLOWPOWERACTIVE 0x0053 +#define SPI_GETPOWEROFFACTIVE 0x0054 +#define SPI_SETLOWPOWERACTIVE 0x0055 +#define SPI_SETPOWEROFFACTIVE 0x0056 +#define SPI_SETCURSORS 0x0057 +#define SPI_SETICONS 0x0058 +#define SPI_GETDEFAULTINPUTLANG 0x0059 +#define SPI_SETDEFAULTINPUTLANG 0x005A +#define SPI_SETLANGTOGGLE 0x005B +#define SPI_GETWINDOWSEXTENSION 0x005C +#define SPI_SETMOUSETRAILS 0x005D +#define SPI_GETMOUSETRAILS 0x005E +#define SPI_SETSCREENSAVERRUNNING 0x0061 +#define SPI_SCREENSAVERRUNNING SPI_SETSCREENSAVERRUNNING +#define SPI_GETFILTERKEYS 0x0032 +#define SPI_SETFILTERKEYS 0x0033 +#define SPI_GETTOGGLEKEYS 0x0034 +#define SPI_SETTOGGLEKEYS 0x0035 +#define SPI_GETMOUSEKEYS 0x0036 +#define SPI_SETMOUSEKEYS 0x0037 +#define SPI_GETSHOWSOUNDS 0x0038 +#define SPI_SETSHOWSOUNDS 0x0039 +#define SPI_GETSTICKYKEYS 0x003A +#define SPI_SETSTICKYKEYS 0x003B +#define SPI_GETACCESSTIMEOUT 0x003C +#define SPI_SETACCESSTIMEOUT 0x003D +#define SPI_GETSERIALKEYS 0x003E +#define SPI_SETSERIALKEYS 0x003F +#define SPI_GETSOUNDSENTRY 0x0040 +#define SPI_SETSOUNDSENTRY 0x0041 +#define SPI_GETSNAPTODEFBUTTON 0x005F +#define SPI_SETSNAPTODEFBUTTON 0x0060 +#define SPI_GETMOUSEHOVERWIDTH 0x0062 +#define SPI_SETMOUSEHOVERWIDTH 0x0063 +#define SPI_GETMOUSEHOVERHEIGHT 0x0064 +#define SPI_SETMOUSEHOVERHEIGHT 0x0065 +#define SPI_GETMOUSEHOVERTIME 0x0066 +#define SPI_SETMOUSEHOVERTIME 0x0067 +#define SPI_GETWHEELSCROLLLINES 0x0068 +#define SPI_SETWHEELSCROLLLINES 0x0069 +#define SPI_GETMENUSHOWDELAY 0x006A +#define SPI_SETMENUSHOWDELAY 0x006B +#define SPI_GETSHOWIMEUI 0x006E +#define SPI_SETSHOWIMEUI 0x006F +#define SPI_GETMOUSESPEED 0x0070 +#define SPI_SETMOUSESPEED 0x0071 +#define SPI_GETSCREENSAVERRUNNING 0x0072 +#define SPI_GETDESKWALLPAPER 0x0073 + +#define SPI_GETACTIVEWINDOWTRACKING 0x1000 +#define SPI_SETACTIVEWINDOWTRACKING 0x1001 +#define SPI_GETMENUANIMATION 0x1002 +#define SPI_SETMENUANIMATION 0x1003 +#define SPI_GETCOMBOBOXANIMATION 0x1004 +#define SPI_SETCOMBOBOXANIMATION 0x1005 +#define SPI_GETLISTBOXSMOOTHSCROLLING 0x1006 +#define SPI_SETLISTBOXSMOOTHSCROLLING 0x1007 +#define SPI_GETGRADIENTCAPTIONS 0x1008 +#define SPI_SETGRADIENTCAPTIONS 0x1009 +#define SPI_GETKEYBOARDCUES 0x100A +#define SPI_SETKEYBOARDCUES 0x100B +#define SPI_GETMENUUNDERLINES SPI_GETKEYBOARDCUES +#define SPI_SETMENUUNDERLINES SPI_SETKEYBOARDCUES +#define SPI_GETACTIVEWNDTRKZORDER 0x100C +#define SPI_SETACTIVEWNDTRKZORDER 0x100D +#define SPI_GETHOTTRACKING 0x100E +#define SPI_SETHOTTRACKING 0x100F +#define SPI_GETMENUFADE 0x1012 +#define SPI_SETMENUFADE 0x1013 +#define SPI_GETSELECTIONFADE 0x1014 +#define SPI_SETSELECTIONFADE 0x1015 +#define SPI_GETTOOLTIPANIMATION 0x1016 +#define SPI_SETTOOLTIPANIMATION 0x1017 +#define SPI_GETTOOLTIPFADE 0x1018 +#define SPI_SETTOOLTIPFADE 0x1019 +#define SPI_GETCURSORSHADOW 0x101A +#define SPI_SETCURSORSHADOW 0x101B +#define SPI_GETMOUSESONAR 0x101C +#define SPI_SETMOUSESONAR 0x101D +#define SPI_GETMOUSECLICKLOCK 0x101E +#define SPI_SETMOUSECLICKLOCK 0x101F +#define SPI_GETMOUSEVANISH 0x1020 +#define SPI_SETMOUSEVANISH 0x1021 +#define SPI_GETFLATMENU 0x1022 +#define SPI_SETFLATMENU 0x1023 +#define SPI_GETDROPSHADOW 0x1024 +#define SPI_SETDROPSHADOW 0x1025 +#define SPI_GETBLOCKSENDINPUTRESETS 0x1026 +#define SPI_SETBLOCKSENDINPUTRESETS 0x1027 +#define SPI_GETUIEFFECTS 0x103E +#define SPI_SETUIEFFECTS 0x103F +#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000 +#define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001 +#define SPI_GETACTIVEWNDTRKTIMEOUT 0x2002 +#define SPI_SETACTIVEWNDTRKTIMEOUT 0x2003 +#define SPI_GETFOREGROUNDFLASHCOUNT 0x2004 +#define SPI_SETFOREGROUNDFLASHCOUNT 0x2005 +#define SPI_GETCARETWIDTH 0x2006 +#define SPI_SETCARETWIDTH 0x2007 +#define SPI_GETMOUSECLICKLOCKTIME 0x2008 +#define SPI_SETMOUSECLICKLOCKTIME 0x2009 +#define SPI_GETFONTSMOOTHINGTYPE 0x200A +#define SPI_SETFONTSMOOTHINGTYPE 0x200B + +#define FE_FONTSMOOTHINGSTANDARD 0x0001 +#define FE_FONTSMOOTHINGCLEARTYPE 0x0002 +#define FE_FONTSMOOTHINGDOCKING 0x8000 + +#define SPI_GETFONTSMOOTHINGCONTRAST 0x200C +#define SPI_SETFONTSMOOTHINGCONTRAST 0x200D +#define SPI_GETFOCUSBORDERWIDTH 0x200E +#define SPI_SETFOCUSBORDERWIDTH 0x200F +#define SPI_GETFOCUSBORDERHEIGHT 0x2010 +#define SPI_SETFOCUSBORDERHEIGHT 0x2011 +#define SPI_GETFONTSMOOTHINGORIENTATION 0x2012 +#define SPI_SETFONTSMOOTHINGORIENTATION 0x2013 + +#define FE_FONTSMOOTHINGORIENTATIONBGR 0x0000 +#define FE_FONTSMOOTHINGORIENTATIONRGB 0x0001 + +#define SPIF_UPDATEINIFILE 0x0001 +#define SPIF_SENDWININICHANGE 0x0002 +#define SPIF_SENDCHANGE SPIF_SENDWININICHANGE + +#define METRICS_USEDEFAULT -1 +#ifdef _WINGDI_ +#ifndef NOGDI + typedef struct tagNONCLIENTMETRICSA { + UINT cbSize; + int iBorderWidth; + int iScrollWidth; + int iScrollHeight; + int iCaptionWidth; + int iCaptionHeight; + LOGFONTA lfCaptionFont; + int iSmCaptionWidth; + int iSmCaptionHeight; + LOGFONTA lfSmCaptionFont; + int iMenuWidth; + int iMenuHeight; + LOGFONTA lfMenuFont; + LOGFONTA lfStatusFont; + LOGFONTA lfMessageFont; + } NONCLIENTMETRICSA,*PNONCLIENTMETRICSA,*LPNONCLIENTMETRICSA; + + typedef struct tagNONCLIENTMETRICSW { + UINT cbSize; + int iBorderWidth; + int iScrollWidth; + int iScrollHeight; + int iCaptionWidth; + int iCaptionHeight; + LOGFONTW lfCaptionFont; + int iSmCaptionWidth; + int iSmCaptionHeight; + LOGFONTW lfSmCaptionFont; + int iMenuWidth; + int iMenuHeight; + LOGFONTW lfMenuFont; + LOGFONTW lfStatusFont; + LOGFONTW lfMessageFont; + } NONCLIENTMETRICSW,*PNONCLIENTMETRICSW,*LPNONCLIENTMETRICSW; + +#ifdef UNICODE + typedef NONCLIENTMETRICSW NONCLIENTMETRICS; + typedef PNONCLIENTMETRICSW PNONCLIENTMETRICS; + typedef LPNONCLIENTMETRICSW LPNONCLIENTMETRICS; +#else + typedef NONCLIENTMETRICSA NONCLIENTMETRICS; + typedef PNONCLIENTMETRICSA PNONCLIENTMETRICS; + typedef LPNONCLIENTMETRICSA LPNONCLIENTMETRICS; +#endif +#endif +#endif + +#define ARW_BOTTOMLEFT 0x0000L +#define ARW_BOTTOMRIGHT 0x0001L +#define ARW_TOPLEFT 0x0002L +#define ARW_TOPRIGHT 0x0003L +#define ARW_STARTMASK 0x0003L +#define ARW_STARTRIGHT 0x0001L +#define ARW_STARTTOP 0x0002L + +#define ARW_LEFT 0x0000L +#define ARW_RIGHT 0x0000L +#define ARW_UP 0x0004L +#define ARW_DOWN 0x0004L +#define ARW_HIDE 0x0008L + + typedef struct tagMINIMIZEDMETRICS { + UINT cbSize; + int iWidth; + int iHorzGap; + int iVertGap; + int iArrange; + } MINIMIZEDMETRICS,*PMINIMIZEDMETRICS,*LPMINIMIZEDMETRICS; + +#ifdef _WINGDI_ +#ifndef NOGDI + typedef struct tagICONMETRICSA { + UINT cbSize; + int iHorzSpacing; + int iVertSpacing; + int iTitleWrap; + LOGFONTA lfFont; + } ICONMETRICSA,*PICONMETRICSA,*LPICONMETRICSA; + + typedef struct tagICONMETRICSW { + UINT cbSize; + int iHorzSpacing; + int iVertSpacing; + int iTitleWrap; + LOGFONTW lfFont; + } ICONMETRICSW,*PICONMETRICSW,*LPICONMETRICSW; + +#ifdef UNICODE + typedef ICONMETRICSW ICONMETRICS; + typedef PICONMETRICSW PICONMETRICS; + typedef LPICONMETRICSW LPICONMETRICS; +#else + typedef ICONMETRICSA ICONMETRICS; + typedef PICONMETRICSA PICONMETRICS; + typedef LPICONMETRICSA LPICONMETRICS; +#endif +#endif +#endif + + typedef struct tagANIMATIONINFO { + UINT cbSize; + int iMinAnimate; + } ANIMATIONINFO,*LPANIMATIONINFO; + + typedef struct tagSERIALKEYSA { + UINT cbSize; + DWORD dwFlags; + LPSTR lpszActivePort; + LPSTR lpszPort; + UINT iBaudRate; + UINT iPortState; + UINT iActive; + } SERIALKEYSA,*LPSERIALKEYSA; + + typedef struct tagSERIALKEYSW { + UINT cbSize; + DWORD dwFlags; + LPWSTR lpszActivePort; + LPWSTR lpszPort; + UINT iBaudRate; + UINT iPortState; + UINT iActive; + } SERIALKEYSW,*LPSERIALKEYSW; + +#ifdef UNICODE + typedef SERIALKEYSW SERIALKEYS; + typedef LPSERIALKEYSW LPSERIALKEYS; +#else + typedef SERIALKEYSA SERIALKEYS; + typedef LPSERIALKEYSA LPSERIALKEYS; +#endif + +#define SERKF_SERIALKEYSON 0x00000001 +#define SERKF_AVAILABLE 0x00000002 +#define SERKF_INDICATOR 0x00000004 + + typedef struct tagHIGHCONTRASTA { + UINT cbSize; + DWORD dwFlags; + LPSTR lpszDefaultScheme; + } HIGHCONTRASTA,*LPHIGHCONTRASTA; + + typedef struct tagHIGHCONTRASTW { + UINT cbSize; + DWORD dwFlags; + LPWSTR lpszDefaultScheme; + } HIGHCONTRASTW,*LPHIGHCONTRASTW; + +#ifdef UNICODE + typedef HIGHCONTRASTW HIGHCONTRAST; + typedef LPHIGHCONTRASTW LPHIGHCONTRAST; +#else + typedef HIGHCONTRASTA HIGHCONTRAST; + typedef LPHIGHCONTRASTA LPHIGHCONTRAST; +#endif + +#define HCF_HIGHCONTRASTON 0x00000001 +#define HCF_AVAILABLE 0x00000002 +#define HCF_HOTKEYACTIVE 0x00000004 +#define HCF_CONFIRMHOTKEY 0x00000008 +#define HCF_HOTKEYSOUND 0x00000010 +#define HCF_INDICATOR 0x00000020 +#define HCF_HOTKEYAVAILABLE 0x00000040 +#define HCF_LOGONDESKTOP 0x00000100 +#define HCF_DEFAULTDESKTOP 0x00000200 + +#define CDS_UPDATEREGISTRY 0x00000001 +#define CDS_TEST 0x00000002 +#define CDS_FULLSCREEN 0x00000004 +#define CDS_GLOBAL 0x00000008 +#define CDS_SET_PRIMARY 0x00000010 +#define CDS_VIDEOPARAMETERS 0x00000020 +#define CDS_RESET 0x40000000 +#define CDS_NORESET 0x10000000 + +//gr #include + +#define DISP_CHANGE_SUCCESSFUL 0 +#define DISP_CHANGE_RESTART 1 +#define DISP_CHANGE_FAILED -1 +#define DISP_CHANGE_BADMODE -2 +#define DISP_CHANGE_NOTUPDATED -3 +#define DISP_CHANGE_BADFLAGS -4 +#define DISP_CHANGE_BADPARAM -5 +#define DISP_CHANGE_BADDUALVIEW -6 + +#ifdef _WINGDI_ +#ifndef NOGDI + +#ifdef UNICODE +#define ChangeDisplaySettings ChangeDisplaySettingsW +#define ChangeDisplaySettingsEx ChangeDisplaySettingsExW +#define EnumDisplaySettings EnumDisplaySettingsW +#define EnumDisplaySettingsEx EnumDisplaySettingsExW +#define EnumDisplayDevices EnumDisplayDevicesW +#else +#define ChangeDisplaySettings ChangeDisplaySettingsA +#define ChangeDisplaySettingsEx ChangeDisplaySettingsExA +#define EnumDisplaySettings EnumDisplaySettingsA +#define EnumDisplaySettingsEx EnumDisplaySettingsExA +#define EnumDisplayDevices EnumDisplayDevicesA +#endif + + WINUSERAPI LONG WINAPI ChangeDisplaySettingsA(LPDEVMODEA lpDevMode,DWORD dwFlags); + WINUSERAPI LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW lpDevMode,DWORD dwFlags); + WINUSERAPI LONG WINAPI ChangeDisplaySettingsExA(LPCSTR lpszDeviceName,LPDEVMODEA lpDevMode,HWND hwnd,DWORD dwflags,LPVOID lParam); + WINUSERAPI LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName,LPDEVMODEW lpDevMode,HWND hwnd,DWORD dwflags,LPVOID lParam); + +#define ENUM_CURRENT_SETTINGS ((DWORD)-1) +#define ENUM_REGISTRY_SETTINGS ((DWORD)-2) + + WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsA(LPCSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEA lpDevMode); + WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsW(LPCWSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEW lpDevMode); + WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEA lpDevMode,DWORD dwFlags); + WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEW lpDevMode,DWORD dwFlags); + +#define EDS_RAWMODE 0x00000002 + + WINUSERAPI WINBOOL WINAPI EnumDisplayDevicesA(LPCSTR lpDevice,DWORD iDevNum,PDISPLAY_DEVICEA lpDisplayDevice,DWORD dwFlags); + WINUSERAPI WINBOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice,DWORD iDevNum,PDISPLAY_DEVICEW lpDisplayDevice,DWORD dwFlags); +#endif +#endif + +#ifdef UNICODE +#define SystemParametersInfo SystemParametersInfoW +#else +#define SystemParametersInfo SystemParametersInfoA +#endif + + WINUSERAPI WINBOOL WINAPI SystemParametersInfoA(UINT uiAction,UINT uiParam,PVOID pvParam,UINT fWinIni); + WINUSERAPI WINBOOL WINAPI SystemParametersInfoW(UINT uiAction,UINT uiParam,PVOID pvParam,UINT fWinIni); +#endif + + typedef struct tagFILTERKEYS { + UINT cbSize; + DWORD dwFlags; + DWORD iWaitMSec; + DWORD iDelayMSec; + DWORD iRepeatMSec; + DWORD iBounceMSec; + } FILTERKEYS,*LPFILTERKEYS; + +#define FKF_FILTERKEYSON 0x00000001 +#define FKF_AVAILABLE 0x00000002 +#define FKF_HOTKEYACTIVE 0x00000004 +#define FKF_CONFIRMHOTKEY 0x00000008 +#define FKF_HOTKEYSOUND 0x00000010 +#define FKF_INDICATOR 0x00000020 +#define FKF_CLICKON 0x00000040 + + typedef struct tagSTICKYKEYS { + UINT cbSize; + DWORD dwFlags; + } STICKYKEYS,*LPSTICKYKEYS; + +#define SKF_STICKYKEYSON 0x00000001 +#define SKF_AVAILABLE 0x00000002 +#define SKF_HOTKEYACTIVE 0x00000004 +#define SKF_CONFIRMHOTKEY 0x00000008 +#define SKF_HOTKEYSOUND 0x00000010 +#define SKF_INDICATOR 0x00000020 +#define SKF_AUDIBLEFEEDBACK 0x00000040 +#define SKF_TRISTATE 0x00000080 +#define SKF_TWOKEYSOFF 0x00000100 +#define SKF_LALTLATCHED 0x10000000 +#define SKF_LCTLLATCHED 0x04000000 +#define SKF_LSHIFTLATCHED 0x01000000 +#define SKF_RALTLATCHED 0x20000000 +#define SKF_RCTLLATCHED 0x08000000 +#define SKF_RSHIFTLATCHED 0x02000000 +#define SKF_LWINLATCHED 0x40000000 +#define SKF_RWINLATCHED 0x80000000 +#define SKF_LALTLOCKED 0x00100000 +#define SKF_LCTLLOCKED 0x00040000 +#define SKF_LSHIFTLOCKED 0x00010000 +#define SKF_RALTLOCKED 0x00200000 +#define SKF_RCTLLOCKED 0x00080000 +#define SKF_RSHIFTLOCKED 0x00020000 +#define SKF_LWINLOCKED 0x00400000 +#define SKF_RWINLOCKED 0x00800000 + + typedef struct tagMOUSEKEYS { + UINT cbSize; + DWORD dwFlags; + DWORD iMaxSpeed; + DWORD iTimeToMaxSpeed; + DWORD iCtrlSpeed; + DWORD dwReserved1; + DWORD dwReserved2; + } MOUSEKEYS,*LPMOUSEKEYS; + +#define MKF_MOUSEKEYSON 0x00000001 +#define MKF_AVAILABLE 0x00000002 +#define MKF_HOTKEYACTIVE 0x00000004 +#define MKF_CONFIRMHOTKEY 0x00000008 +#define MKF_HOTKEYSOUND 0x00000010 +#define MKF_INDICATOR 0x00000020 +#define MKF_MODIFIERS 0x00000040 +#define MKF_REPLACENUMBERS 0x00000080 +#define MKF_LEFTBUTTONSEL 0x10000000 +#define MKF_RIGHTBUTTONSEL 0x20000000 +#define MKF_LEFTBUTTONDOWN 0x01000000 +#define MKF_RIGHTBUTTONDOWN 0x02000000 +#define MKF_MOUSEMODE 0x80000000 + + typedef struct tagACCESSTIMEOUT { + UINT cbSize; + DWORD dwFlags; + DWORD iTimeOutMSec; + } ACCESSTIMEOUT,*LPACCESSTIMEOUT; + +#define ATF_TIMEOUTON 0x00000001 +#define ATF_ONOFFFEEDBACK 0x00000002 + +#define SSGF_NONE 0 +#define SSGF_DISPLAY 3 + +#define SSTF_NONE 0 +#define SSTF_CHARS 1 +#define SSTF_BORDER 2 +#define SSTF_DISPLAY 3 + +#define SSWF_NONE 0 +#define SSWF_TITLE 1 +#define SSWF_WINDOW 2 +#define SSWF_DISPLAY 3 +#define SSWF_CUSTOM 4 + + typedef struct tagSOUNDSENTRYA { + UINT cbSize; + DWORD dwFlags; + DWORD iFSTextEffect; + DWORD iFSTextEffectMSec; + DWORD iFSTextEffectColorBits; + DWORD iFSGrafEffect; + DWORD iFSGrafEffectMSec; + DWORD iFSGrafEffectColor; + DWORD iWindowsEffect; + DWORD iWindowsEffectMSec; + LPSTR lpszWindowsEffectDLL; + DWORD iWindowsEffectOrdinal; + } SOUNDSENTRYA,*LPSOUNDSENTRYA; + + typedef struct tagSOUNDSENTRYW { + UINT cbSize; + DWORD dwFlags; + DWORD iFSTextEffect; + DWORD iFSTextEffectMSec; + DWORD iFSTextEffectColorBits; + DWORD iFSGrafEffect; + DWORD iFSGrafEffectMSec; + DWORD iFSGrafEffectColor; + DWORD iWindowsEffect; + DWORD iWindowsEffectMSec; + LPWSTR lpszWindowsEffectDLL; + DWORD iWindowsEffectOrdinal; + } SOUNDSENTRYW,*LPSOUNDSENTRYW; + +#ifdef UNICODE + typedef SOUNDSENTRYW SOUNDSENTRY; + typedef LPSOUNDSENTRYW LPSOUNDSENTRY; +#else + typedef SOUNDSENTRYA SOUNDSENTRY; + typedef LPSOUNDSENTRYA LPSOUNDSENTRY; +#endif + +#define SSF_SOUNDSENTRYON 0x00000001 +#define SSF_AVAILABLE 0x00000002 +#define SSF_INDICATOR 0x00000004 + + typedef struct tagTOGGLEKEYS { + UINT cbSize; + DWORD dwFlags; + } TOGGLEKEYS,*LPTOGGLEKEYS; + +#define TKF_TOGGLEKEYSON 0x00000001 +#define TKF_AVAILABLE 0x00000002 +#define TKF_HOTKEYACTIVE 0x00000004 +#define TKF_CONFIRMHOTKEY 0x00000008 +#define TKF_HOTKEYSOUND 0x00000010 +#define TKF_INDICATOR 0x00000020 + + WINUSERAPI VOID WINAPI SetDebugErrorLevel(DWORD dwLevel); + +#define SLE_ERROR 0x00000001 +#define SLE_MINORERROR 0x00000002 +#define SLE_WARNING 0x00000003 + + WINUSERAPI VOID WINAPI SetLastErrorEx(DWORD dwErrCode,DWORD dwType); + WINUSERAPI int WINAPI InternalGetWindowText(HWND hWnd,LPWSTR pString,int cchMaxCount); + +#ifdef WINNT + WINUSERAPI WINBOOL WINAPI EndTask(HWND hWnd,WINBOOL fShutDown,WINBOOL fForce); +#endif + +#define MONITOR_DEFAULTTONULL 0x00000000 +#define MONITOR_DEFAULTTOPRIMARY 0x00000001 +#define MONITOR_DEFAULTTONEAREST 0x00000002 + + WINUSERAPI HMONITOR WINAPI MonitorFromPoint(POINT pt,DWORD dwFlags); + WINUSERAPI HMONITOR WINAPI MonitorFromRect(LPCRECT lprc,DWORD dwFlags); + WINUSERAPI HMONITOR WINAPI MonitorFromWindow(HWND hwnd,DWORD dwFlags); + +#define MONITORINFOF_PRIMARY 0x00000001 + +#ifndef CCHDEVICENAME +#define CCHDEVICENAME 32 +#endif + + typedef struct tagMONITORINFO { + DWORD cbSize; + RECT rcMonitor; + RECT rcWork; + DWORD dwFlags; + } MONITORINFO,*LPMONITORINFO; + +#ifdef __cplusplus + typedef struct tagMONITORINFOEXA : public tagMONITORINFO { + CHAR szDevice[CCHDEVICENAME]; + } MONITORINFOEXA,*LPMONITORINFOEXA; + + typedef struct tagMONITORINFOEXW : public tagMONITORINFO { + WCHAR szDevice[CCHDEVICENAME]; + } MONITORINFOEXW,*LPMONITORINFOEXW; + +#ifdef UNICODE + typedef MONITORINFOEXW MONITORINFOEX; + typedef LPMONITORINFOEXW LPMONITORINFOEX; +#else + typedef MONITORINFOEXA MONITORINFOEX; + typedef LPMONITORINFOEXA LPMONITORINFOEX; +#endif +#else + typedef struct tagMONITORINFOEXA { + MONITORINFO mi; + CHAR szDevice[CCHDEVICENAME]; + } MONITORINFOEXA,*LPMONITORINFOEXA; + + typedef struct tagMONITORINFOEXW { + MONITORINFO mi; + WCHAR szDevice[CCHDEVICENAME]; + } MONITORINFOEXW,*LPMONITORINFOEXW; +#ifdef UNICODE + typedef MONITORINFOEXW MONITORINFOEX; + typedef LPMONITORINFOEXW LPMONITORINFOEX; +#else + typedef MONITORINFOEXA MONITORINFOEX; + typedef LPMONITORINFOEXA LPMONITORINFOEX; +#endif +#endif + +#ifdef UNICODE +#define GetMonitorInfo GetMonitorInfoW +#else +#define GetMonitorInfo GetMonitorInfoA +#endif + + WINUSERAPI WINBOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor,LPMONITORINFO lpmi); + WINUSERAPI WINBOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor,LPMONITORINFO lpmi); + + typedef WINBOOL (CALLBACK *MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM); + + WINUSERAPI WINBOOL WINAPI EnumDisplayMonitors(HDC hdc,LPCRECT lprcClip,MONITORENUMPROC lpfnEnum,LPARAM dwData); + +#ifndef NOWINABLE + WINUSERAPI VOID WINAPI NotifyWinEvent(DWORD event,HWND hwnd,LONG idObject,LONG idChild); + + typedef VOID (CALLBACK *WINEVENTPROC)(HWINEVENTHOOK hWinEventHook,DWORD event,HWND hwnd,LONG idObject,LONG idChild,DWORD idEventThread,DWORD dwmsEventTime); + + WINUSERAPI HWINEVENTHOOK WINAPI SetWinEventHook(DWORD eventMin,DWORD eventMax,HMODULE hmodWinEventProc,WINEVENTPROC pfnWinEventProc,DWORD idProcess,DWORD idThread,DWORD dwFlags); + WINUSERAPI WINBOOL WINAPI IsWinEventHookInstalled(DWORD event); + +#define WINEVENT_OUTOFCONTEXT 0x0000 +#define WINEVENT_SKIPOWNTHREAD 0x0001 +#define WINEVENT_SKIPOWNPROCESS 0x0002 +#define WINEVENT_INCONTEXT 0x0004 + + WINUSERAPI WINBOOL WINAPI UnhookWinEvent(HWINEVENTHOOK hWinEventHook); + +#define CHILDID_SELF 0 +#define INDEXID_OBJECT 0 +#define INDEXID_CONTAINER 0 + +#define OBJID_WINDOW ((LONG)0x00000000) +#define OBJID_SYSMENU ((LONG)0xFFFFFFFF) +#define OBJID_TITLEBAR ((LONG)0xFFFFFFFE) +#define OBJID_MENU ((LONG)0xFFFFFFFD) +#define OBJID_CLIENT ((LONG)0xFFFFFFFC) +#define OBJID_VSCROLL ((LONG)0xFFFFFFFB) +#define OBJID_HSCROLL ((LONG)0xFFFFFFFA) +#define OBJID_SIZEGRIP ((LONG)0xFFFFFFF9) +#define OBJID_CARET ((LONG)0xFFFFFFF8) +#define OBJID_CURSOR ((LONG)0xFFFFFFF7) +#define OBJID_ALERT ((LONG)0xFFFFFFF6) +#define OBJID_SOUND ((LONG)0xFFFFFFF5) +#define OBJID_QUERYCLASSNAMEIDX ((LONG)0xFFFFFFF4) +#define OBJID_NATIVEOM ((LONG)0xFFFFFFF0) + +#define EVENT_MIN 0x00000001 +#define EVENT_MAX 0x7FFFFFFF + +#define EVENT_SYSTEM_SOUND 0x0001 +#define EVENT_SYSTEM_ALERT 0x0002 +#define EVENT_SYSTEM_FOREGROUND 0x0003 +#define EVENT_SYSTEM_MENUSTART 0x0004 +#define EVENT_SYSTEM_MENUEND 0x0005 +#define EVENT_SYSTEM_MENUPOPUPSTART 0x0006 +#define EVENT_SYSTEM_MENUPOPUPEND 0x0007 +#define EVENT_SYSTEM_CAPTURESTART 0x0008 +#define EVENT_SYSTEM_CAPTUREEND 0x0009 +#define EVENT_SYSTEM_MOVESIZESTART 0x000A +#define EVENT_SYSTEM_MOVESIZEEND 0x000B +#define EVENT_SYSTEM_CONTEXTHELPSTART 0x000C +#define EVENT_SYSTEM_CONTEXTHELPEND 0x000D +#define EVENT_SYSTEM_DRAGDROPSTART 0x000E +#define EVENT_SYSTEM_DRAGDROPEND 0x000F +#define EVENT_SYSTEM_DIALOGSTART 0x0010 +#define EVENT_SYSTEM_DIALOGEND 0x0011 +#define EVENT_SYSTEM_SCROLLINGSTART 0x0012 +#define EVENT_SYSTEM_SCROLLINGEND 0x0013 +#define EVENT_SYSTEM_SWITCHSTART 0x0014 +#define EVENT_SYSTEM_SWITCHEND 0x0015 +#define EVENT_SYSTEM_MINIMIZESTART 0x0016 +#define EVENT_SYSTEM_MINIMIZEEND 0x0017 + +#define EVENT_CONSOLE_CARET 0x4001 +#define EVENT_CONSOLE_UPDATE_REGION 0x4002 +#define EVENT_CONSOLE_UPDATE_SIMPLE 0x4003 +#define EVENT_CONSOLE_UPDATE_SCROLL 0x4004 +#define EVENT_CONSOLE_LAYOUT 0x4005 +#define EVENT_CONSOLE_START_APPLICATION 0x4006 +#define EVENT_CONSOLE_END_APPLICATION 0x4007 + +#define CONSOLE_APPLICATION_16BIT 0x0001 + +#define CONSOLE_CARET_SELECTION 0x0001 +#define CONSOLE_CARET_VISIBLE 0x0002 + +#define EVENT_OBJECT_CREATE 0x8000 +#define EVENT_OBJECT_DESTROY 0x8001 +#define EVENT_OBJECT_SHOW 0x8002 +#define EVENT_OBJECT_HIDE 0x8003 +#define EVENT_OBJECT_REORDER 0x8004 + +#define EVENT_OBJECT_FOCUS 0x8005 +#define EVENT_OBJECT_SELECTION 0x8006 +#define EVENT_OBJECT_SELECTIONADD 0x8007 +#define EVENT_OBJECT_SELECTIONREMOVE 0x8008 +#define EVENT_OBJECT_SELECTIONWITHIN 0x8009 + +#define EVENT_OBJECT_STATECHANGE 0x800A + +#define EVENT_OBJECT_LOCATIONCHANGE 0x800B + +#define EVENT_OBJECT_NAMECHANGE 0x800C +#define EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D +#define EVENT_OBJECT_VALUECHANGE 0x800E +#define EVENT_OBJECT_PARENTCHANGE 0x800F +#define EVENT_OBJECT_HELPCHANGE 0x8010 +#define EVENT_OBJECT_DEFACTIONCHANGE 0x8011 +#define EVENT_OBJECT_ACCELERATORCHANGE 0x8012 + +#define SOUND_SYSTEM_STARTUP 1 +#define SOUND_SYSTEM_SHUTDOWN 2 +#define SOUND_SYSTEM_BEEP 3 +#define SOUND_SYSTEM_ERROR 4 +#define SOUND_SYSTEM_QUESTION 5 +#define SOUND_SYSTEM_WARNING 6 +#define SOUND_SYSTEM_INFORMATION 7 +#define SOUND_SYSTEM_MAXIMIZE 8 +#define SOUND_SYSTEM_MINIMIZE 9 +#define SOUND_SYSTEM_RESTOREUP 10 +#define SOUND_SYSTEM_RESTOREDOWN 11 +#define SOUND_SYSTEM_APPSTART 12 +#define SOUND_SYSTEM_FAULT 13 +#define SOUND_SYSTEM_APPEND 14 +#define SOUND_SYSTEM_MENUCOMMAND 15 +#define SOUND_SYSTEM_MENUPOPUP 16 +#define CSOUND_SYSTEM 16 + +#define ALERT_SYSTEM_INFORMATIONAL 1 +#define ALERT_SYSTEM_WARNING 2 +#define ALERT_SYSTEM_ERROR 3 +#define ALERT_SYSTEM_QUERY 4 +#define ALERT_SYSTEM_CRITICAL 5 +#define CALERT_SYSTEM 6 + + typedef struct tagGUITHREADINFO { + DWORD cbSize; + DWORD flags; + HWND hwndActive; + HWND hwndFocus; + HWND hwndCapture; + HWND hwndMenuOwner; + HWND hwndMoveSize; + HWND hwndCaret; + RECT rcCaret; + } GUITHREADINFO,*PGUITHREADINFO,*LPGUITHREADINFO; + +#define GUI_CARETBLINKING 0x00000001 +#define GUI_INMOVESIZE 0x00000002 +#define GUI_INMENUMODE 0x00000004 +#define GUI_SYSTEMMENUMODE 0x00000008 +#define GUI_POPUPMENUMODE 0x00000010 +#define GUI_16BITTASK 0x00000020 + +#ifdef UNICODE +#define GetWindowModuleFileName GetWindowModuleFileNameW +#else +#define GetWindowModuleFileName GetWindowModuleFileNameA +#endif + + WINUSERAPI WINBOOL WINAPI GetGUIThreadInfo(DWORD idThread,PGUITHREADINFO pgui); + WINUSERAPI UINT WINAPI GetWindowModuleFileNameA(HWND hwnd,LPSTR pszFileName,UINT cchFileNameMax); + WINUSERAPI UINT WINAPI GetWindowModuleFileNameW(HWND hwnd,LPWSTR pszFileName,UINT cchFileNameMax); + +#ifndef NO_STATE_FLAGS +#define STATE_SYSTEM_UNAVAILABLE 0x00000001 +#define STATE_SYSTEM_SELECTED 0x00000002 +#define STATE_SYSTEM_FOCUSED 0x00000004 +#define STATE_SYSTEM_PRESSED 0x00000008 +#define STATE_SYSTEM_CHECKED 0x00000010 +#define STATE_SYSTEM_MIXED 0x00000020 +#define STATE_SYSTEM_INDETERMINATE STATE_SYSTEM_MIXED +#define STATE_SYSTEM_READONLY 0x00000040 +#define STATE_SYSTEM_HOTTRACKED 0x00000080 +#define STATE_SYSTEM_DEFAULT 0x00000100 +#define STATE_SYSTEM_EXPANDED 0x00000200 +#define STATE_SYSTEM_COLLAPSED 0x00000400 +#define STATE_SYSTEM_BUSY 0x00000800 +#define STATE_SYSTEM_FLOATING 0x00001000 +#define STATE_SYSTEM_MARQUEED 0x00002000 +#define STATE_SYSTEM_ANIMATED 0x00004000 +#define STATE_SYSTEM_INVISIBLE 0x00008000 +#define STATE_SYSTEM_OFFSCREEN 0x00010000 +#define STATE_SYSTEM_SIZEABLE 0x00020000 +#define STATE_SYSTEM_MOVEABLE 0x00040000 +#define STATE_SYSTEM_SELFVOICING 0x00080000 +#define STATE_SYSTEM_FOCUSABLE 0x00100000 +#define STATE_SYSTEM_SELECTABLE 0x00200000 +#define STATE_SYSTEM_LINKED 0x00400000 +#define STATE_SYSTEM_TRAVERSED 0x00800000 +#define STATE_SYSTEM_MULTISELECTABLE 0x01000000 +#define STATE_SYSTEM_EXTSELECTABLE 0x02000000 +#define STATE_SYSTEM_ALERT_LOW 0x04000000 +#define STATE_SYSTEM_ALERT_MEDIUM 0x08000000 +#define STATE_SYSTEM_ALERT_HIGH 0x10000000 +#define STATE_SYSTEM_PROTECTED 0x20000000 +#define STATE_SYSTEM_VALID 0x3FFFFFFF +#endif + +#define CCHILDREN_TITLEBAR 5 +#define CCHILDREN_SCROLLBAR 5 + + typedef struct tagCURSORINFO { + DWORD cbSize; + DWORD flags; + HCURSOR hCursor; + POINT ptScreenPos; + } CURSORINFO,*PCURSORINFO,*LPCURSORINFO; + +#define CURSOR_SHOWING 0x00000001 + + WINUSERAPI WINBOOL WINAPI GetCursorInfo(PCURSORINFO pci); + + typedef struct tagWINDOWINFO { + DWORD cbSize; + RECT rcWindow; + RECT rcClient; + DWORD dwStyle; + DWORD dwExStyle; + DWORD dwWindowStatus; + UINT cxWindowBorders; + UINT cyWindowBorders; + ATOM atomWindowType; + WORD wCreatorVersion; + } WINDOWINFO,*PWINDOWINFO,*LPWINDOWINFO; + +#define WS_ACTIVECAPTION 0x0001 + + WINUSERAPI WINBOOL WINAPI GetWindowInfo(HWND hwnd,PWINDOWINFO pwi); + + typedef struct tagTITLEBARINFO { + DWORD cbSize; + RECT rcTitleBar; + DWORD rgstate[CCHILDREN_TITLEBAR + 1]; + } TITLEBARINFO,*PTITLEBARINFO,*LPTITLEBARINFO; + + WINUSERAPI WINBOOL WINAPI GetTitleBarInfo(HWND hwnd,PTITLEBARINFO pti); + + typedef struct tagMENUBARINFO { + DWORD cbSize; + RECT rcBar; + HMENU hMenu; + HWND hwndMenu; + WINBOOL fBarFocused:1; + WINBOOL fFocused:1; + } MENUBARINFO,*PMENUBARINFO,*LPMENUBARINFO; + + WINUSERAPI WINBOOL WINAPI GetMenuBarInfo(HWND hwnd,LONG idObject,LONG idItem,PMENUBARINFO pmbi); + + typedef struct tagSCROLLBARINFO { + DWORD cbSize; + RECT rcScrollBar; + int dxyLineButton; + int xyThumbTop; + int xyThumbBottom; + int reserved; + DWORD rgstate[CCHILDREN_SCROLLBAR + 1]; + } SCROLLBARINFO,*PSCROLLBARINFO,*LPSCROLLBARINFO; + + WINUSERAPI WINBOOL WINAPI GetScrollBarInfo(HWND hwnd,LONG idObject,PSCROLLBARINFO psbi); + + typedef struct tagCOMBOBOXINFO { + DWORD cbSize; + RECT rcItem; + RECT rcButton; + DWORD stateButton; + HWND hwndCombo; + HWND hwndItem; + HWND hwndList; + } COMBOBOXINFO,*PCOMBOBOXINFO,*LPCOMBOBOXINFO; + + WINUSERAPI WINBOOL WINAPI GetComboBoxInfo(HWND hwndCombo,PCOMBOBOXINFO pcbi); + +#define GA_PARENT 1 +#define GA_ROOT 2 +#define GA_ROOTOWNER 3 + + WINUSERAPI HWND WINAPI GetAncestor(HWND hwnd,UINT gaFlags); + WINUSERAPI HWND WINAPI RealChildWindowFromPoint(HWND hwndParent,POINT ptParentClientCoords); + WINUSERAPI UINT WINAPI RealGetWindowClassA(HWND hwnd,LPSTR ptszClassName,UINT cchClassNameMax); + WINUSERAPI UINT WINAPI RealGetWindowClassW(HWND hwnd,LPWSTR ptszClassName,UINT cchClassNameMax); +#ifdef UNICODE +#define RealGetWindowClass RealGetWindowClassW +#else +#define RealGetWindowClass RealGetWindowClassA +#endif + + typedef struct tagALTTABINFO { + DWORD cbSize; + int cItems; + int cColumns; + int cRows; + int iColFocus; + int iRowFocus; + int cxItem; + int cyItem; + POINT ptStart; + } ALTTABINFO,*PALTTABINFO,*LPALTTABINFO; + +#ifdef UNICODE +#define GetAltTabInfo GetAltTabInfoW +#else +#define GetAltTabInfo GetAltTabInfoA +#endif + + WINUSERAPI WINBOOL WINAPI GetAltTabInfoA(HWND hwnd,int iItem,PALTTABINFO pati,LPSTR pszItemText,UINT cchItemText); + WINUSERAPI WINBOOL WINAPI GetAltTabInfoW(HWND hwnd,int iItem,PALTTABINFO pati,LPWSTR pszItemText,UINT cchItemText); + WINUSERAPI DWORD WINAPI GetListBoxInfo(HWND hwnd); +#endif + + WINUSERAPI WINBOOL WINAPI LockWorkStation(VOID); + WINUSERAPI WINBOOL WINAPI UserHandleGrantAccess(HANDLE hUserHandle,HANDLE hJob,WINBOOL bGrant); + + DECLARE_HANDLE(HRAWINPUT); + +#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff) + +#define RIM_INPUT 0 +#define RIM_INPUTSINK 1 + + typedef struct tagRAWINPUTHEADER { + DWORD dwType; + DWORD dwSize; + HANDLE hDevice; + WPARAM wParam; + } RAWINPUTHEADER,*PRAWINPUTHEADER,*LPRAWINPUTHEADER; + +#define RIM_TYPEMOUSE 0 +#define RIM_TYPEKEYBOARD 1 +#define RIM_TYPEHID 2 + + typedef struct tagRAWMOUSE { + USHORT usFlags; + union { + ULONG ulButtons; + struct { + USHORT usButtonFlags; + USHORT usButtonData; + }; + }; + ULONG ulRawButtons; + LONG lLastX; + LONG lLastY; + ULONG ulExtraInformation; + } RAWMOUSE,*PRAWMOUSE,*LPRAWMOUSE; + +#define RI_MOUSE_LEFT_BUTTON_DOWN 0x0001 +#define RI_MOUSE_LEFT_BUTTON_UP 0x0002 +#define RI_MOUSE_RIGHT_BUTTON_DOWN 0x0004 +#define RI_MOUSE_RIGHT_BUTTON_UP 0x0008 +#define RI_MOUSE_MIDDLE_BUTTON_DOWN 0x0010 +#define RI_MOUSE_MIDDLE_BUTTON_UP 0x0020 + +#define RI_MOUSE_BUTTON_1_DOWN RI_MOUSE_LEFT_BUTTON_DOWN +#define RI_MOUSE_BUTTON_1_UP RI_MOUSE_LEFT_BUTTON_UP +#define RI_MOUSE_BUTTON_2_DOWN RI_MOUSE_RIGHT_BUTTON_DOWN +#define RI_MOUSE_BUTTON_2_UP RI_MOUSE_RIGHT_BUTTON_UP +#define RI_MOUSE_BUTTON_3_DOWN RI_MOUSE_MIDDLE_BUTTON_DOWN +#define RI_MOUSE_BUTTON_3_UP RI_MOUSE_MIDDLE_BUTTON_UP + +#define RI_MOUSE_BUTTON_4_DOWN 0x0040 +#define RI_MOUSE_BUTTON_4_UP 0x0080 +#define RI_MOUSE_BUTTON_5_DOWN 0x0100 +#define RI_MOUSE_BUTTON_5_UP 0x0200 + +#define RI_MOUSE_WHEEL 0x0400 + +#define MOUSE_MOVE_RELATIVE 0 +#define MOUSE_MOVE_ABSOLUTE 1 +#define MOUSE_VIRTUAL_DESKTOP 0x02 +#define MOUSE_ATTRIBUTES_CHANGED 0x04 + + typedef struct tagRAWKEYBOARD { + USHORT MakeCode; + USHORT Flags; + USHORT Reserved; + USHORT VKey; + UINT Message; + ULONG ExtraInformation; + } RAWKEYBOARD,*PRAWKEYBOARD,*LPRAWKEYBOARD; + +#define KEYBOARD_OVERRUN_MAKE_CODE 0xFF + +#define RI_KEY_MAKE 0 +#define RI_KEY_BREAK 1 +#define RI_KEY_E0 2 +#define RI_KEY_E1 4 +#define RI_KEY_TERMSRV_SET_LED 8 +#define RI_KEY_TERMSRV_SHADOW 0x10 + + typedef struct tagRAWHID { + DWORD dwSizeHid; + DWORD dwCount; + BYTE bRawData[1]; + } RAWHID,*PRAWHID,*LPRAWHID; + + typedef struct tagRAWINPUT { + RAWINPUTHEADER header; + union { + RAWMOUSE mouse; + RAWKEYBOARD keyboard; + RAWHID hid; + } data; + } RAWINPUT,*PRAWINPUT,*LPRAWINPUT; + +#ifdef _WIN64 +#define RAWINPUT_ALIGN(x) (((x) + sizeof(QWORD) - 1) & ~(sizeof(QWORD) - 1)) +#else +#define RAWINPUT_ALIGN(x) (((x) + sizeof(DWORD) - 1) & ~(sizeof(DWORD) - 1)) +#endif + +#define NEXTRAWINPUTBLOCK(ptr) ((PRAWINPUT)RAWINPUT_ALIGN((ULONG_PTR)((PBYTE)(ptr) + (ptr)->header.dwSize))) + +#define RID_INPUT 0x10000003 +#define RID_HEADER 0x10000005 + + WINUSERAPI UINT WINAPI GetRawInputData(HRAWINPUT hRawInput,UINT uiCommand,LPVOID pData,PUINT pcbSize,UINT cbSizeHeader); + +#define RIDI_PREPARSEDDATA 0x20000005 +#define RIDI_DEVICENAME 0x20000007 +#define RIDI_DEVICEINFO 0x2000000b + + typedef struct tagRID_DEVICE_INFO_MOUSE { + DWORD dwId; + DWORD dwNumberOfButtons; + DWORD dwSampleRate; + } RID_DEVICE_INFO_MOUSE,*PRID_DEVICE_INFO_MOUSE; + + typedef struct tagRID_DEVICE_INFO_KEYBOARD { + DWORD dwType; + DWORD dwSubType; + DWORD dwKeyboardMode; + DWORD dwNumberOfFunctionKeys; + DWORD dwNumberOfIndicators; + DWORD dwNumberOfKeysTotal; + } RID_DEVICE_INFO_KEYBOARD,*PRID_DEVICE_INFO_KEYBOARD; + + typedef struct tagRID_DEVICE_INFO_HID { + DWORD dwVendorId; + DWORD dwProductId; + DWORD dwVersionNumber; + USHORT usUsagePage; + USHORT usUsage; + } RID_DEVICE_INFO_HID,*PRID_DEVICE_INFO_HID; + + typedef struct tagRID_DEVICE_INFO { + DWORD cbSize; + DWORD dwType; + union { + RID_DEVICE_INFO_MOUSE mouse; + RID_DEVICE_INFO_KEYBOARD keyboard; + RID_DEVICE_INFO_HID hid; + }; + } RID_DEVICE_INFO,*PRID_DEVICE_INFO,*LPRID_DEVICE_INFO; + +#ifdef UNICODE +#define GetRawInputDeviceInfo GetRawInputDeviceInfoW +#else +#define GetRawInputDeviceInfo GetRawInputDeviceInfoA +#endif + + WINUSERAPI UINT WINAPI GetRawInputDeviceInfoA(HANDLE hDevice,UINT uiCommand,LPVOID pData,PUINT pcbSize); + WINUSERAPI UINT WINAPI GetRawInputDeviceInfoW(HANDLE hDevice,UINT uiCommand,LPVOID pData,PUINT pcbSize); + WINUSERAPI UINT WINAPI GetRawInputBuffer(PRAWINPUT pData,PUINT pcbSize,UINT cbSizeHeader); + + typedef struct tagRAWINPUTDEVICE { + USHORT usUsagePage; + USHORT usUsage; + DWORD dwFlags; + HWND hwndTarget; + } RAWINPUTDEVICE,*PRAWINPUTDEVICE,*LPRAWINPUTDEVICE; + + typedef CONST RAWINPUTDEVICE *PCRAWINPUTDEVICE; + +#define RIDEV_REMOVE 0x00000001 +#define RIDEV_EXCLUDE 0x00000010 +#define RIDEV_PAGEONLY 0x00000020 +#define RIDEV_NOLEGACY 0x00000030 +#define RIDEV_INPUTSINK 0x00000100 +#define RIDEV_CAPTUREMOUSE 0x00000200 +#define RIDEV_NOHOTKEYS 0x00000200 +#define RIDEV_APPKEYS 0x00000400 +#define RIDEV_EXMODEMASK 0x000000F0 +#define RIDEV_EXMODE(mode) ((mode) & RIDEV_EXMODEMASK) + + WINUSERAPI WINBOOL WINAPI RegisterRawInputDevices(PCRAWINPUTDEVICE pRawInputDevices,UINT uiNumDevices,UINT cbSize); + WINUSERAPI UINT WINAPI GetRegisteredRawInputDevices(PRAWINPUTDEVICE pRawInputDevices,PUINT puiNumDevices,UINT cbSize); + + typedef struct tagRAWINPUTDEVICELIST { + HANDLE hDevice; + DWORD dwType; + } RAWINPUTDEVICELIST,*PRAWINPUTDEVICELIST; + + WINUSERAPI UINT WINAPI GetRawInputDeviceList(PRAWINPUTDEVICELIST pRawInputDeviceList,PUINT puiNumDevices,UINT cbSize); + WINUSERAPI LRESULT WINAPI DefRawInputProc(PRAWINPUT *paRawInput,INT nInput,UINT cbSizeHeader); + +#endif /* NOUSER */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/include/winapi/winver.h b/overlay_toolchain/tcc/include/winapi/winver.h new file mode 100644 index 00000000..5c0f036b --- /dev/null +++ b/overlay_toolchain/tcc/include/winapi/winver.h @@ -0,0 +1,160 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef VER_H +#define VER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define VS_FILE_INFO RT_VERSION +#define VS_VERSION_INFO 1 +#define VS_USER_DEFINED 100 + +#define VS_FFI_SIGNATURE 0xFEEF04BDL +#define VS_FFI_STRUCVERSION 0x00010000L +#define VS_FFI_FILEFLAGSMASK 0x0000003FL + +#define VS_FF_DEBUG 0x00000001L +#define VS_FF_PRERELEASE 0x00000002L +#define VS_FF_PATCHED 0x00000004L +#define VS_FF_PRIVATEBUILD 0x00000008L +#define VS_FF_INFOINFERRED 0x00000010L +#define VS_FF_SPECIALBUILD 0x00000020L + +#define VOS_UNKNOWN 0x00000000L +#define VOS_DOS 0x00010000L +#define VOS_OS216 0x00020000L +#define VOS_OS232 0x00030000L +#define VOS_NT 0x00040000L +#define VOS_WINCE 0x00050000L + +#define VOS__BASE 0x00000000L +#define VOS__WINDOWS16 0x00000001L +#define VOS__PM16 0x00000002L +#define VOS__PM32 0x00000003L +#define VOS__WINDOWS32 0x00000004L + +#define VOS_DOS_WINDOWS16 0x00010001L +#define VOS_DOS_WINDOWS32 0x00010004L +#define VOS_OS216_PM16 0x00020002L +#define VOS_OS232_PM32 0x00030003L +#define VOS_NT_WINDOWS32 0x00040004L + +#define VFT_UNKNOWN 0x00000000L +#define VFT_APP 0x00000001L +#define VFT_DLL 0x00000002L +#define VFT_DRV 0x00000003L +#define VFT_FONT 0x00000004L +#define VFT_VXD 0x00000005L +#define VFT_STATIC_LIB 0x00000007L + +#define VFT2_UNKNOWN 0x00000000L +#define VFT2_DRV_PRINTER 0x00000001L +#define VFT2_DRV_KEYBOARD 0x00000002L +#define VFT2_DRV_LANGUAGE 0x00000003L +#define VFT2_DRV_DISPLAY 0x00000004L +#define VFT2_DRV_MOUSE 0x00000005L +#define VFT2_DRV_NETWORK 0x00000006L +#define VFT2_DRV_SYSTEM 0x00000007L +#define VFT2_DRV_INSTALLABLE 0x00000008L +#define VFT2_DRV_SOUND 0x00000009L +#define VFT2_DRV_COMM 0x0000000AL +#define VFT2_DRV_INPUTMETHOD 0x0000000BL +#define VFT2_DRV_VERSIONED_PRINTER 0x0000000CL + +#define VFT2_FONT_RASTER 0x00000001L +#define VFT2_FONT_VECTOR 0x00000002L +#define VFT2_FONT_TRUETYPE 0x00000003L + +#define VFFF_ISSHAREDFILE 0x0001 + +#define VFF_CURNEDEST 0x0001 +#define VFF_FILEINUSE 0x0002 +#define VFF_BUFFTOOSMALL 0x0004 + +#define VIFF_FORCEINSTALL 0x0001 +#define VIFF_DONTDELETEOLD 0x0002 + +#define VIF_TEMPFILE 0x00000001L +#define VIF_MISMATCH 0x00000002L +#define VIF_SRCOLD 0x00000004L + +#define VIF_DIFFLANG 0x00000008L +#define VIF_DIFFCODEPG 0x00000010L +#define VIF_DIFFTYPE 0x00000020L + +#define VIF_WRITEPROT 0x00000040L +#define VIF_FILEINUSE 0x00000080L +#define VIF_OUTOFSPACE 0x00000100L +#define VIF_ACCESSVIOLATION 0x00000200L +#define VIF_SHARINGVIOLATION 0x00000400L +#define VIF_CANNOTCREATE 0x00000800L +#define VIF_CANNOTDELETE 0x00001000L +#define VIF_CANNOTRENAME 0x00002000L +#define VIF_CANNOTDELETECUR 0x00004000L +#define VIF_OUTOFMEMORY 0x00008000L + +#define VIF_CANNOTREADSRC 0x00010000L +#define VIF_CANNOTREADDST 0x00020000L + +#define VIF_BUFFTOOSMALL 0x00040000L +#define VIF_CANNOTLOADLZ32 0x00080000L +#define VIF_CANNOTLOADCABINET 0x00100000L + +#ifndef RC_INVOKED + + typedef struct tagVS_FIXEDFILEINFO + { + DWORD dwSignature; + DWORD dwStrucVersion; + DWORD dwFileVersionMS; + DWORD dwFileVersionLS; + DWORD dwProductVersionMS; + DWORD dwProductVersionLS; + DWORD dwFileFlagsMask; + DWORD dwFileFlags; + DWORD dwFileOS; + DWORD dwFileType; + DWORD dwFileSubtype; + DWORD dwFileDateMS; + DWORD dwFileDateLS; + } VS_FIXEDFILEINFO; + +#ifdef UNICODE +#define VerFindFile VerFindFileW +#define VerInstallFile VerInstallFileW +#define GetFileVersionInfoSize GetFileVersionInfoSizeW +#define GetFileVersionInfo GetFileVersionInfoW +#define VerLanguageName VerLanguageNameW +#define VerQueryValue VerQueryValueW +#else +#define VerFindFile VerFindFileA +#define VerInstallFile VerInstallFileA +#define GetFileVersionInfoSize GetFileVersionInfoSizeA +#define GetFileVersionInfo GetFileVersionInfoA +#define VerLanguageName VerLanguageNameA +#define VerQueryValue VerQueryValueA +#endif + + DWORD WINAPI VerFindFileA(DWORD uFlags,LPSTR szFileName,LPSTR szWinDir,LPSTR szAppDir,LPSTR szCurDir,PUINT lpuCurDirLen,LPSTR szDestDir,PUINT lpuDestDirLen); + DWORD WINAPI VerFindFileW(DWORD uFlags,LPWSTR szFileName,LPWSTR szWinDir,LPWSTR szAppDir,LPWSTR szCurDir,PUINT lpuCurDirLen,LPWSTR szDestDir,PUINT lpuDestDirLen); + DWORD WINAPI VerInstallFileA(DWORD uFlags,LPSTR szSrcFileName,LPSTR szDestFileName,LPSTR szSrcDir,LPSTR szDestDir,LPSTR szCurDir,LPSTR szTmpFile,PUINT lpuTmpFileLen); + DWORD WINAPI VerInstallFileW(DWORD uFlags,LPWSTR szSrcFileName,LPWSTR szDestFileName,LPWSTR szSrcDir,LPWSTR szDestDir,LPWSTR szCurDir,LPWSTR szTmpFile,PUINT lpuTmpFileLen); + DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR lptstrFilename,LPDWORD lpdwHandle); + DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR lptstrFilename,LPDWORD lpdwHandle); + WINBOOL WINAPI GetFileVersionInfoA(LPCSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); + WINBOOL WINAPI GetFileVersionInfoW(LPCWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); + DWORD WINAPI VerLanguageNameA(DWORD wLang,LPSTR szLang,DWORD nSize); + DWORD WINAPI VerLanguageNameW(DWORD wLang,LPWSTR szLang,DWORD nSize); + WINBOOL WINAPI VerQueryValueA(const LPVOID pBlock,LPSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); + WINBOOL WINAPI VerQueryValueW(const LPVOID pBlock,LPWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/overlay_toolchain/tcc/lib/gdi32.def b/overlay_toolchain/tcc/lib/gdi32.def new file mode 100644 index 00000000..02766da4 --- /dev/null +++ b/overlay_toolchain/tcc/lib/gdi32.def @@ -0,0 +1,337 @@ +LIBRARY gdi32.dll + +EXPORTS +AbortDoc +AbortPath +AddFontResourceA +AddFontResourceW +AngleArc +AnimatePalette +Arc +ArcTo +BeginPath +BitBlt +ByeByeGDI +CancelDC +CheckColorsInGamut +ChoosePixelFormat +Chord +CloseEnhMetaFile +CloseFigure +CloseMetaFile +ColorCorrectPalette +ColorMatchToTarget +CombineRgn +CombineTransform +CopyEnhMetaFileA +CopyEnhMetaFileW +CopyMetaFileA +CopyMetaFileW +CreateBitmap +CreateBitmapIndirect +CreateBrushIndirect +CreateColorSpaceA +CreateColorSpaceW +CreateCompatibleBitmap +CreateCompatibleDC +CreateDCA +CreateDCW +CreateDIBPatternBrush +CreateDIBPatternBrushPt +CreateDIBSection +CreateDIBitmap +CreateDiscardableBitmap +CreateEllipticRgn +CreateEllipticRgnIndirect +CreateEnhMetaFileA +CreateEnhMetaFileW +CreateFontA +CreateFontIndirectA +CreateFontIndirectW +CreateFontW +CreateHalftonePalette +CreateHatchBrush +CreateICA +CreateICW +CreateMetaFileA +CreateMetaFileW +CreatePalette +CreatePatternBrush +CreatePen +CreatePenIndirect +CreatePolyPolygonRgn +CreatePolygonRgn +CreateRectRgn +CreateRectRgnIndirect +CreateRoundRectRgn +CreateScalableFontResourceA +CreateScalableFontResourceW +CreateSolidBrush +DPtoLP +DeleteColorSpace +DeleteDC +DeleteEnhMetaFile +DeleteMetaFile +DeleteObject +DescribePixelFormat +DeviceCapabilitiesEx +DeviceCapabilitiesExA +DeviceCapabilitiesExW +DrawEscape +Ellipse +EnableEUDC +EndDoc +EndPage +EndPath +EnumEnhMetaFile +EnumFontFamiliesA +EnumFontFamiliesExA +EnumFontFamiliesExW +EnumFontFamiliesW +EnumFontsA +EnumFontsW +EnumICMProfilesA +EnumICMProfilesW +EnumMetaFile +EnumObjects +EqualRgn +Escape +ExcludeClipRect +ExtCreatePen +ExtCreateRegion +ExtEscape +ExtFloodFill +ExtSelectClipRgn +ExtTextOutA +ExtTextOutW +FillPath +FillRgn +FixBrushOrgEx +FlattenPath +FloodFill +FrameRgn +GdiComment +GdiFlush +GdiGetBatchLimit +GdiPlayDCScript +GdiPlayJournal +GdiPlayScript +GdiSetBatchLimit +GetArcDirection +GetAspectRatioFilterEx +GetBitmapBits +GetBitmapDimensionEx +GetBkColor +GetBkMode +GetBoundsRect +GetBrushOrgEx +GetCharABCWidthsA +GetCharABCWidthsFloatA +GetCharABCWidthsFloatW +GetCharABCWidthsW +GetCharWidth32A +GetCharWidth32W +GetCharWidthA +GetCharWidthFloatA +GetCharWidthFloatW +GetCharWidthW +GetCharacterPlacementA +GetCharacterPlacementW +GetClipBox +GetClipRgn +GetColorAdjustment +GetColorSpace +GetCurrentObject +GetCurrentPositionEx +GetDCOrgEx +GetDIBColorTable +GetDIBits +GetDeviceCaps +GetDeviceGammaRamp +GetEnhMetaFileA +GetEnhMetaFileBits +GetEnhMetaFileDescriptionA +GetEnhMetaFileDescriptionW +GetEnhMetaFileHeader +GetEnhMetaFilePaletteEntries +GetEnhMetaFileW +GetFontData +GetFontLanguageInfo +GetFontResourceInfo +GetGlyphOutline +GetGlyphOutlineA +GetGlyphOutlineW +GetGraphicsMode +GetICMProfileA +GetICMProfileW +GetKerningPairs +GetKerningPairsA +GetKerningPairsW +GetLayout +GetLogColorSpaceA +GetLogColorSpaceW +GetMapMode +GetMetaFileA +GetMetaFileBitsEx +GetMetaFileW +GetMetaRgn +GetMiterLimit +GetNearestColor +GetNearestPaletteIndex +GetObjectA +GetObjectType +GetObjectW +GetOutlineTextMetricsA +GetOutlineTextMetricsW +GetPaletteEntries +GetPath +GetPixel +GetPixelFormat +GetPolyFillMode +GetROP2 +GetRandomRgn +GetRasterizerCaps +GetRegionData +GetRgnBox +GetStockObject +GetStretchBltMode +GetSystemPaletteEntries +GetSystemPaletteUse +GetTextAlign +GetTextCharacterExtra +GetTextCharset +GetTextCharsetInfo +GetTextColor +GetTextExtentExPointA +GetTextExtentExPointW +GetTextExtentPoint32A +GetTextExtentPoint32W +GetTextExtentPointA +GetTextExtentPointW +GetTextFaceA +GetTextFaceW +GetTextMetricsA +GetTextMetricsW +GetViewportExtEx +GetViewportOrgEx +GetWinMetaFileBits +GetWindowExtEx +GetWindowOrgEx +GetWorldTransform +IntersectClipRect +InvertRgn +LPtoDP +LineDDA +LineTo +MaskBlt +ModifyWorldTransform +MoveToEx +OffsetClipRgn +OffsetRgn +OffsetViewportOrgEx +OffsetWindowOrgEx +PaintRgn +PatBlt +PathToRegion +Pie +PlayEnhMetaFile +PlayEnhMetaFileRecord +PlayMetaFile +PlayMetaFileRecord +PlgBlt +PolyBezier +PolyBezierTo +PolyDraw +PolyPolygon +PolyPolyline +PolyTextOutA +PolyTextOutW +Polygon +Polyline +PolylineTo +PtInRegion +PtVisible +RealizePalette +RectInRegion +RectVisible +Rectangle +RemoveFontResourceA +RemoveFontResourceW +ResetDCA +ResetDCW +ResizePalette +RestoreDC +RoundRect +SaveDC +ScaleViewportExtEx +ScaleWindowExtEx +SelectClipPath +SelectClipRgn +SelectObject +SelectPalette +SetAbortProc +SetArcDirection +SetBitmapBits +SetBitmapDimensionEx +SetBkColor +SetBkMode +SetBoundsRect +SetBrushOrgEx +SetColorAdjustment +SetColorSpace +SetDIBColorTable +SetDIBits +SetDIBitsToDevice +SetDeviceGammaRamp +SetEnhMetaFileBits +SetFontEnumeration +SetGraphicsMode +SetICMMode +SetICMProfileA +SetICMProfileW +SetLayout +SetMagicColors +SetMapMode +SetMapperFlags +SetMetaFileBitsEx +SetMetaRgn +SetMiterLimit +SetObjectOwner +SetPaletteEntries +SetPixel +SetPixelFormat +SetPixelV +SetPolyFillMode +SetROP2 +SetRectRgn +SetStretchBltMode +SetSystemPaletteUse +SetTextAlign +SetTextCharacterExtra +SetTextColor +SetTextJustification +SetViewportExtEx +SetViewportOrgEx +SetWinMetaFileBits +SetWindowExtEx +SetWindowOrgEx +SetWorldTransform +StartDocA +StartDocW +StartPage +StretchBlt +StretchDIBits +StrokeAndFillPath +StrokePath +SwapBuffers +TextOutA +TextOutW +TranslateCharsetInfo +UnrealizeObject +UpdateColors +UpdateICMRegKeyA +UpdateICMRegKeyW +WidenPath +gdiPlaySpoolStream +pfnRealizePalette +pfnSelectPalette diff --git a/overlay_toolchain/tcc/lib/kernel32.def b/overlay_toolchain/tcc/lib/kernel32.def new file mode 100644 index 00000000..f03e17ba --- /dev/null +++ b/overlay_toolchain/tcc/lib/kernel32.def @@ -0,0 +1,770 @@ +LIBRARY kernel32.dll + +EXPORTS +AddAtomA +AddAtomW +AllocConsole +AllocLSCallback +AllocSLCallback +AreFileApisANSI +BackupRead +BackupSeek +BackupWrite +Beep +BeginUpdateResourceA +BeginUpdateResourceW +BuildCommDCBA +BuildCommDCBAndTimeoutsA +BuildCommDCBAndTimeoutsW +BuildCommDCBW +CallNamedPipeA +CallNamedPipeW +Callback12 +Callback16 +Callback20 +Callback24 +Callback28 +Callback32 +Callback36 +Callback4 +Callback40 +Callback44 +Callback48 +Callback52 +Callback56 +Callback60 +Callback64 +Callback8 +CancelDeviceWakeupRequest +CancelIo +CancelWaitableTimer +ClearCommBreak +ClearCommError +CloseHandle +CloseProfileUserMapping +CloseSystemHandle +CommConfigDialogA +CommConfigDialogW +CompareFileTime +CompareStringA +CompareStringW +ConnectNamedPipe +ContinueDebugEvent +ConvertDefaultLocale +ConvertThreadToFiber +ConvertToGlobalHandle +CopyFileA +CopyFileExA +CopyFileExW +CopyFileW +CreateConsoleScreenBuffer +CreateDirectoryA +CreateDirectoryExA +CreateDirectoryExW +CreateDirectoryW +CreateEventA +CreateEventW +CreateFiber +CreateFileA +CreateFileMappingA +CreateFileMappingW +CreateFileW +CreateIoCompletionPort +CreateKernelThread +CreateMailslotA +CreateMailslotW +CreateMutexA +CreateMutexW +CreateNamedPipeA +CreateNamedPipeW +CreatePipe +CreateProcessA +CreateProcessW +CreateRemoteThread +CreateSemaphoreA +CreateSemaphoreW +CreateSocketHandle +CreateTapePartition +CreateThread +CreateToolhelp32Snapshot +CreateWaitableTimerA +CreateWaitableTimerW +DebugActiveProcess +DebugBreak +DefineDosDeviceA +DefineDosDeviceW +DeleteAtom +DeleteCriticalSection +DeleteFiber +DeleteFileA +DeleteFileW +DeviceIoControl +DisableThreadLibraryCalls +DisconnectNamedPipe +DosDateTimeToFileTime +DuplicateHandle +EndUpdateResourceA +EndUpdateResourceW +EnterCriticalSection +EnumCalendarInfoA +EnumCalendarInfoExA +EnumCalendarInfoExW +EnumCalendarInfoW +EnumDateFormatsA +EnumDateFormatsExA +EnumDateFormatsExW +EnumDateFormatsW +EnumLanguageGroupLocalesA +EnumLanguageGroupLocalesW +EnumResourceLanguagesA +EnumResourceLanguagesW +EnumResourceNamesA +EnumResourceNamesW +EnumResourceTypesA +EnumResourceTypesW +EnumSystemCodePagesA +EnumSystemCodePagesW +EnumSystemGeoID +EnumSystemLanguageGroupsA +EnumSystemLanguageGroupsW +EnumSystemLocalesA +EnumSystemLocalesW +EnumTimeFormatsA +EnumTimeFormatsW +EnumUILanguagesA +EnumUILanguagesW +EraseTape +EscapeCommFunction +ExitProcess +ExitThread +ExpandEnvironmentStringsA +ExpandEnvironmentStringsW +FT_Exit0 +FT_Exit12 +FT_Exit16 +FT_Exit20 +FT_Exit24 +FT_Exit28 +FT_Exit32 +FT_Exit36 +FT_Exit4 +FT_Exit40 +FT_Exit44 +FT_Exit48 +FT_Exit52 +FT_Exit56 +FT_Exit8 +FT_Prolog +FT_Thunk +FatalAppExitA +FatalAppExitW +FatalExit +FileTimeToDosDateTime +FileTimeToLocalFileTime +FileTimeToSystemTime +FillConsoleOutputAttribute +FillConsoleOutputCharacterA +FillConsoleOutputCharacterW +FindAtomA +FindAtomW +FindClose +FindCloseChangeNotification +FindFirstChangeNotificationA +FindFirstChangeNotificationW +FindFirstFileA +FindFirstFileExA +FindFirstFileExW +FindFirstFileW +FindNextChangeNotification +FindNextFileA +FindNextFileW +FindResourceA +FindResourceExA +FindResourceExW +FindResourceW +FlushConsoleInputBuffer +FlushFileBuffers +FlushInstructionCache +FlushViewOfFile +FoldStringA +FoldStringW +FormatMessageA +FormatMessageW +FreeConsole +FreeEnvironmentStringsA +FreeEnvironmentStringsW +FreeLSCallback +FreeLibrary +FreeLibraryAndExitThread +FreeResource +FreeSLCallback +GenerateConsoleCtrlEvent +GetACP +GetAtomNameA +GetAtomNameW +GetBinaryType +GetBinaryTypeA +GetBinaryTypeW +GetCPInfo +GetCPInfoExA +GetCPInfoExW +GetCalendarInfoA +GetCalendarInfoW +GetCommConfig +GetCommMask +GetCommModemStatus +GetCommProperties +GetCommState +GetCommTimeouts +GetCommandLineA +GetCommandLineW +GetCompressedFileSizeA +GetCompressedFileSizeW +GetComputerNameA +GetComputerNameW +GetConsoleCP +GetConsoleCursorInfo +GetConsoleMode +GetConsoleOutputCP +GetConsoleScreenBufferInfo +GetConsoleTitleA +GetConsoleTitleW +GetCurrencyFormatA +GetCurrencyFormatW +GetCurrentDirectoryA +GetCurrentDirectoryW +GetCurrentProcess +GetCurrentProcessId +GetCurrentThread +GetCurrentThreadId +GetDateFormatA +GetDateFormatW +GetDaylightFlag +GetDefaultCommConfigA +GetDefaultCommConfigW +GetDevicePowerState +GetDiskFreeSpaceA +GetDiskFreeSpaceExA +GetDiskFreeSpaceExW +GetDiskFreeSpaceW +GetDriveTypeA +GetDriveTypeW +GetEnvironmentStrings +GetEnvironmentStringsA +GetEnvironmentStringsW +GetEnvironmentVariableA +GetEnvironmentVariableW +GetErrorMode +GetExitCodeProcess +GetExitCodeThread +GetFileAttributesA +GetFileAttributesExA +GetFileAttributesExW +GetFileAttributesW +GetFileInformationByHandle +GetFileSize +GetFileTime +GetFileType +GetFullPathNameA +GetFullPathNameW +GetGeoInfoA +GetGeoInfoW +GetHandleContext +GetHandleInformation +GetLSCallbackTarget +GetLSCallbackTemplate +GetLargestConsoleWindowSize +GetLastError +GetLocalTime +GetLocaleInfoA +GetLocaleInfoW +GetLogicalDriveStringsA +GetLogicalDriveStringsW +GetLogicalDrives +GetLongPathNameA +GetLongPathNameW +GetMailslotInfo +GetModuleFileNameA +GetModuleFileNameW +GetModuleHandleA +GetModuleHandleW +GetModuleHandleExA +GetModuleHandleExW +GetNamedPipeHandleStateA +GetNamedPipeHandleStateW +GetNamedPipeInfo +GetNumberFormatA +GetNumberFormatW +GetNumberOfConsoleInputEvents +GetNumberOfConsoleMouseButtons +GetOEMCP +GetOverlappedResult +GetPriorityClass +GetPrivateProfileIntA +GetPrivateProfileIntW +GetPrivateProfileSectionA +GetPrivateProfileSectionNamesA +GetPrivateProfileSectionNamesW +GetPrivateProfileSectionW +GetPrivateProfileStringA +GetPrivateProfileStringW +GetPrivateProfileStructA +GetPrivateProfileStructW +GetProcAddress +GetProcessAffinityMask +GetProcessFlags +GetProcessHeap +GetProcessHeaps +GetProcessPriorityBoost +GetProcessShutdownParameters +GetProcessTimes +GetProcessVersion +GetProcessWorkingSetSize +GetProductName +GetProfileIntA +GetProfileIntW +GetProfileSectionA +GetProfileSectionW +GetProfileStringA +GetProfileStringW +GetQueuedCompletionStatus +GetSLCallbackTarget +GetSLCallbackTemplate +GetShortPathNameA +GetShortPathNameW +GetStartupInfoA +GetStartupInfoW +GetStdHandle +GetStringTypeA +GetStringTypeExA +GetStringTypeExW +GetStringTypeW +GetSystemDefaultLCID +GetSystemDefaultLangID +GetSystemDefaultUILanguage +GetSystemDirectoryA +GetSystemDirectoryW +GetSystemInfo +GetSystemPowerStatus +GetSystemTime +GetSystemTimeAdjustment +GetSystemTimeAsFileTime +GetTapeParameters +GetTapePosition +GetTapeStatus +GetTempFileNameA +GetTempFileNameW +GetTempPathA +GetTempPathW +GetThreadContext +GetThreadLocale +GetThreadPriority +GetThreadPriorityBoost +GetThreadSelectorEntry +GetThreadTimes +GetTickCount +GetTimeFormatA +GetTimeFormatW +GetTimeZoneInformation +GetUserDefaultLCID +GetUserDefaultLangID +GetUserDefaultUILanguage +GetUserGeoID +GetVersion +GetVersionExA +GetVersionExW +GetVolumeInformationA +GetVolumeInformationW +GetWindowsDirectoryA +GetWindowsDirectoryW +GetWriteWatch +GlobalAddAtomA +GlobalAddAtomW +GlobalAlloc +GlobalCompact +GlobalDeleteAtom +GlobalFindAtomA +GlobalFindAtomW +GlobalFix +GlobalFlags +GlobalFree +GlobalGetAtomNameA +GlobalGetAtomNameW +GlobalHandle +GlobalLock +GlobalMemoryStatus +GlobalReAlloc +GlobalSize +GlobalUnWire +GlobalUnfix +GlobalUnlock +GlobalWire +Heap32First +Heap32ListFirst +Heap32ListNext +Heap32Next +HeapAlloc +HeapCompact +HeapCreate +HeapDestroy +HeapFree +HeapLock +HeapReAlloc +HeapSetFlags +HeapSize +HeapUnlock +HeapValidate +HeapWalk +InitAtomTable +InitializeCriticalSection +InitializeCriticalSectionAndSpinCount +InterlockedCompareExchange +InterlockedDecrement +InterlockedExchange +InterlockedExchangeAdd +InterlockedIncrement +InvalidateNLSCache +IsBadCodePtr +IsBadHugeReadPtr +IsBadHugeWritePtr +IsBadReadPtr +IsBadStringPtrA +IsBadStringPtrW +IsBadWritePtr +IsDBCSLeadByte +IsDBCSLeadByteEx +IsDebuggerPresent +IsLSCallback +IsProcessorFeaturePresent +IsSLCallback +IsSystemResumeAutomatic +IsValidCodePage +IsValidLanguageGroup +IsValidLocale +K32Thk1632Epilog +K32Thk1632Prolog +K32_NtCreateFile +K32_RtlNtStatusToDosError +LCMapStringA +LCMapStringW +LeaveCriticalSection +LoadLibraryA +LoadLibraryExA +LoadLibraryExW +LoadLibraryW +LoadModule +LoadResource +LocalAlloc +LocalCompact +LocalFileTimeToFileTime +LocalFlags +LocalFree +LocalHandle +LocalLock +LocalReAlloc +LocalShrink +LocalSize +LocalUnlock +LockFile +LockFileEx +LockResource +MakeCriticalSectionGlobal +MapHInstLS +MapHInstLS_PN +MapHInstSL +MapHInstSL_PN +MapHModuleLS +MapHModuleSL +MapLS +MapSL +MapSLFix +MapViewOfFile +MapViewOfFileEx +Module32First +Module32Next +MoveFileA +MoveFileExA +MoveFileExW +MoveFileW +MulDiv +MultiByteToWideChar +NotifyNLSUserCache +OpenEventA +OpenEventW +OpenFile +OpenFileMappingA +OpenFileMappingW +OpenMutexA +OpenMutexW +OpenProcess +OpenProfileUserMapping +OpenSemaphoreA +OpenSemaphoreW +OpenThread +OpenVxDHandle +OpenWaitableTimerA +OpenWaitableTimerW +OutputDebugStringA +OutputDebugStringW +PeekConsoleInputA +PeekConsoleInputW +PeekNamedPipe +PostQueuedCompletionStatus +PrepareTape +Process32First +Process32Next +PulseEvent +PurgeComm +QT_Thunk +QueryDosDeviceA +QueryDosDeviceW +QueryNumberOfEventLogRecords +QueryOldestEventLogRecord +QueryPerformanceCounter +QueryPerformanceFrequency +QueueUserAPC +RaiseException +ReadConsoleA +ReadConsoleInputA +ReadConsoleInputW +ReadConsoleOutputA +ReadConsoleOutputAttribute +ReadConsoleOutputCharacterA +ReadConsoleOutputCharacterW +ReadConsoleOutputW +ReadConsoleW +ReadDirectoryChangesW +ReadFile +ReadFileEx +ReadFileScatter +ReadProcessMemory +RegisterServiceProcess +RegisterSysMsgHandler +ReinitializeCriticalSection +ReleaseMutex +ReleaseSemaphore +RemoveDirectoryA +RemoveDirectoryW +RequestDeviceWakeup +RequestWakeupLatency +ResetEvent +ResetNLSUserInfoCache +ResetWriteWatch +ResumeThread +RtlAddFunctionTable +RtlDeleteFunctionTable +RtlFillMemory +RtlInstallFunctionTableCallback +RtlMoveMemory +RtlUnwind +RtlUnwindEx +RtlZeroMemory +SMapLS +SMapLS_IP_EBP_12 +SMapLS_IP_EBP_16 +SMapLS_IP_EBP_20 +SMapLS_IP_EBP_24 +SMapLS_IP_EBP_28 +SMapLS_IP_EBP_32 +SMapLS_IP_EBP_36 +SMapLS_IP_EBP_40 +SMapLS_IP_EBP_8 +SUnMapLS +SUnMapLS_IP_EBP_12 +SUnMapLS_IP_EBP_16 +SUnMapLS_IP_EBP_20 +SUnMapLS_IP_EBP_24 +SUnMapLS_IP_EBP_28 +SUnMapLS_IP_EBP_32 +SUnMapLS_IP_EBP_36 +SUnMapLS_IP_EBP_40 +SUnMapLS_IP_EBP_8 +ScrollConsoleScreenBufferA +ScrollConsoleScreenBufferW +SearchPathA +SearchPathW +SetCalendarInfoA +SetCalendarInfoW +SetCommBreak +SetCommConfig +SetCommMask +SetCommState +SetCommTimeouts +SetComputerNameA +SetComputerNameW +SetConsoleActiveScreenBuffer +SetConsoleCP +SetConsoleCtrlHandler +SetConsoleCursorInfo +SetConsoleCursorPosition +SetConsoleMode +SetConsoleOutputCP +SetConsoleScreenBufferSize +SetConsoleTextAttribute +SetConsoleTitleA +SetConsoleTitleW +SetConsoleWindowInfo +SetCriticalSectionSpinCount +SetCurrentDirectoryA +SetCurrentDirectoryW +SetDaylightFlag +SetDefaultCommConfigA +SetDefaultCommConfigW +SetEndOfFile +SetEnvironmentVariableA +SetEnvironmentVariableW +SetErrorMode +SetEvent +SetFileApisToANSI +SetFileApisToOEM +SetFileAttributesA +SetFileAttributesW +SetFilePointer +SetFilePointerEx +SetFileTime +SetHandleContext +SetHandleCount +SetHandleInformation +SetLastError +SetLocalTime +SetLocaleInfoA +SetLocaleInfoW +SetMailslotInfo +SetMessageWaitingIndicator +SetNamedPipeHandleState +SetPriorityClass +SetProcessAffinityMask +SetProcessPriorityBoost +SetProcessShutdownParameters +SetProcessWorkingSetSize +SetStdHandle +SetSystemPowerState +SetSystemTime +SetSystemTimeAdjustment +SetTapeParameters +SetTapePosition +SetThreadAffinityMask +SetThreadContext +SetThreadExecutionState +SetThreadIdealProcessor +SetThreadLocale +SetThreadPriority +SetThreadPriorityBoost +SetTimeZoneInformation +SetUnhandledExceptionFilter +SetUserGeoID +SetVolumeLabelA +SetVolumeLabelW +SetWaitableTimer +SetupComm +SignalObjectAndWait +SignalSysMsgHandlers +SizeofResource +Sleep +SleepEx +SuspendThread +SwitchToFiber +SwitchToThread +SystemTimeToFileTime +SystemTimeToTzSpecificLocalTime +TerminateProcess +TerminateThread +Thread32First +Thread32Next +ThunkConnect32 +TlsAlloc +TlsAllocInternal +TlsFree +TlsFreeInternal +TlsGetValue +TlsSetValue +Toolhelp32ReadProcessMemory +TransactNamedPipe +TransmitCommChar +TryEnterCriticalSection +UTRegister +UTUnRegister +UnMapLS +UnMapSLFixArray +UnhandledExceptionFilter +UninitializeCriticalSection +UnlockFile +UnlockFileEx +UnmapViewOfFile +UpdateResourceA +UpdateResourceW +VerLanguageNameA +VerLanguageNameW +VirtualAlloc +VirtualAllocEx +VirtualFree +VirtualFreeEx +VirtualLock +VirtualProtect +VirtualProtectEx +VirtualQuery +VirtualQueryEx +VirtualUnlock +WaitCommEvent +WaitForDebugEvent +WaitForMultipleObjects +WaitForMultipleObjectsEx +WaitForSingleObject +WaitForSingleObjectEx +WaitNamedPipeA +WaitNamedPipeW +WideCharToMultiByte +WinExec +WriteConsoleA +WriteConsoleInputA +WriteConsoleInputW +WriteConsoleOutputA +WriteConsoleOutputAttribute +WriteConsoleOutputCharacterA +WriteConsoleOutputCharacterW +WriteConsoleOutputW +WriteConsoleW +WriteFile +WriteFileEx +WriteFileGather +WritePrivateProfileSectionA +WritePrivateProfileSectionW +WritePrivateProfileStringA +WritePrivateProfileStringW +WritePrivateProfileStructA +WritePrivateProfileStructW +WriteProcessMemory +WriteProfileSectionA +WriteProfileSectionW +WriteProfileStringA +WriteProfileStringW +WriteTapemark +_DebugOut +_DebugPrintf +_hread +_hwrite +_lclose +_lcreat +_llseek +_lopen +_lread +_lwrite +dprintf +lstrcat +lstrcatA +lstrcatW +lstrcmp +lstrcmpA +lstrcmpW +lstrcmpi +lstrcmpiA +lstrcmpiW +lstrcpy +lstrcpyA +lstrcpyW +lstrcpyn +lstrcpynA +lstrcpynW +lstrlen +lstrlenA +lstrlenW diff --git a/overlay_toolchain/tcc/lib/libtcc1-32.a b/overlay_toolchain/tcc/lib/libtcc1-32.a new file mode 100644 index 00000000..3fdf1fae Binary files /dev/null and b/overlay_toolchain/tcc/lib/libtcc1-32.a differ diff --git a/overlay_toolchain/tcc/lib/libtcc1-64.a b/overlay_toolchain/tcc/lib/libtcc1-64.a new file mode 100644 index 00000000..cf1bf6da Binary files /dev/null and b/overlay_toolchain/tcc/lib/libtcc1-64.a differ diff --git a/overlay_toolchain/tcc/lib/msvcrt.def b/overlay_toolchain/tcc/lib/msvcrt.def new file mode 100644 index 00000000..742acb8b --- /dev/null +++ b/overlay_toolchain/tcc/lib/msvcrt.def @@ -0,0 +1,1399 @@ +LIBRARY msvcrt.dll + +EXPORTS +$I10_OUTPUT +??0__non_rtti_object@@QAE@ABV0@@Z +??0__non_rtti_object@@QAE@PBD@Z +??0bad_cast@@AAE@PBQBD@Z +??0bad_cast@@QAE@ABQBD@Z +??0bad_cast@@QAE@ABV0@@Z +??0bad_cast@@QAE@PBD@Z +??0bad_typeid@@QAE@ABV0@@Z +??0bad_typeid@@QAE@PBD@Z +??0exception@@QAE@ABQBD@Z +??0exception@@QAE@ABQBDH@Z +??0exception@@QAE@ABV0@@Z +??0exception@@QAE@XZ +??1__non_rtti_object@@UAE@XZ +??1bad_cast@@UAE@XZ +??1bad_typeid@@UAE@XZ +??1exception@@UAE@XZ +??1type_info@@UAE@XZ +??2@YAPAXI@Z +??2@YAPAXIHPBDH@Z +??3@YAXPAX@Z +??4__non_rtti_object@@QAEAAV0@ABV0@@Z +??4bad_cast@@QAEAAV0@ABV0@@Z +??4bad_typeid@@QAEAAV0@ABV0@@Z +??4exception@@QAEAAV0@ABV0@@Z +??8type_info@@QBEHABV0@@Z +??9type_info@@QBEHABV0@@Z +??_7__non_rtti_object@@6B@ +??_7bad_cast@@6B@ +??_7bad_typeid@@6B@ +??_7exception@@6B@ +??_E__non_rtti_object@@UAEPAXI@Z +??_Ebad_cast@@UAEPAXI@Z +??_Ebad_typeid@@UAEPAXI@Z +??_Eexception@@UAEPAXI@Z +??_Fbad_cast@@QAEXXZ +??_Fbad_typeid@@QAEXXZ +??_G__non_rtti_object@@UAEPAXI@Z +??_Gbad_cast@@UAEPAXI@Z +??_Gbad_typeid@@UAEPAXI@Z +??_Gexception@@UAEPAXI@Z +??_U@YAPAXI@Z +??_U@YAPAXIHPBDH@Z +??_V@YAXPAX@Z +?_query_new_handler@@YAP6AHI@ZXZ +?_query_new_mode@@YAHXZ +?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z +?_set_new_mode@@YAHH@Z +?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z +?before@type_info@@QBEHABV1@@Z +?name@type_info@@QBEPBDXZ +?raw_name@type_info@@QBEPBDXZ +?set_new_handler@@YAP6AXXZP6AXXZ@Z +?set_terminate@@YAP6AXXZP6AXXZ@Z +?set_unexpected@@YAP6AXXZP6AXXZ@Z +?terminate@@YAXXZ +?unexpected@@YAXXZ +?what@exception@@UBEPBDXZ +_CIacos +_CIasin +_CIatan +_CIatan2 +_CIcos +_CIcosh +_CIexp +_CIfmod +_CIlog +_CIlog10 +_CIpow +_CIsin +_CIsinh +_CIsqrt +_CItan +_CItanh +_CrtCheckMemory +_CrtDbgBreak +_CrtDbgReport +_CrtDbgReportV +_CrtDbgReportW +_CrtDbgReportWV +_CrtDoForAllClientObjects +_CrtDumpMemoryLeaks +_CrtIsMemoryBlock +_CrtIsValidHeapPointer +_CrtIsValidPointer +_CrtMemCheckpoint +_CrtMemDifference +_CrtMemDumpAllObjectsSince +_CrtMemDumpStatistics +_CrtReportBlockType +_CrtSetAllocHook +_CrtSetBreakAlloc +_CrtSetDbgBlockType +_CrtSetDbgFlag +_CrtSetDumpClient +_CrtSetReportFile +_CrtSetReportHook +_CrtSetReportHook2 +_CrtSetReportMode +_CxxThrowException +_EH_prolog +_Getdays +_Getmonths +_Gettnames +_HUGE +_Strftime +_XcptFilter +__CppXcptFilter +__CxxCallUnwindDelDtor +__CxxCallUnwindDtor +__CxxCallUnwindVecDtor +__CxxDetectRethrow +__CxxExceptionFilter +__CxxFrameHandler +__CxxFrameHandler2 +__CxxFrameHandler3 +__CxxLongjmpUnwind +__CxxQueryExceptionSize +__CxxRegisterExceptionObject +__CxxUnregisterExceptionObject +__DestructExceptionObject +__RTCastToVoid +__RTDynamicCast +__RTtypeid +__STRINGTOLD +___lc_codepage_func +___lc_collate_cp_func +___lc_handle_func +___mb_cur_max_func +___setlc_active_func +___unguarded_readlc_active_add_func +__argc +__argv +__badioinfo +__crtCompareStringA +__crtCompareStringW +__crtGetLocaleInfoW +__crtGetStringTypeW +__crtLCMapStringA +__crtLCMapStringW +__daylight +__dllonexit +__doserrno +__dstbias +__fpecode +__getmainargs +__initenv +__iob_func +__isascii +__iscsym +__iscsymf +__lc_codepage +__lc_collate_cp +__lc_handle +__lconv_init +__libm_sse2_acos +__libm_sse2_acosf +__libm_sse2_asin +__libm_sse2_asinf +__libm_sse2_atan +__libm_sse2_atan2 +__libm_sse2_atanf +__libm_sse2_cos +__libm_sse2_cosf +__libm_sse2_exp +__libm_sse2_expf +__libm_sse2_log +__libm_sse2_log10 +__libm_sse2_log10f +__libm_sse2_logf +__libm_sse2_pow +__libm_sse2_powf +__libm_sse2_sin +__libm_sse2_sinf +__libm_sse2_tan +__libm_sse2_tanf +__mb_cur_max +__p___argc +__p___argv +__p___initenv +__p___mb_cur_max +__p___wargv +__p___winitenv +__p__acmdln +__p__amblksiz +__p__commode +__p__daylight +__p__dstbias +__p__environ +__p__fileinfo +__p__fmode +__p__iob +__p__mbcasemap +__p__mbctype +__p__osver +__p__pctype +__p__pgmptr +__p__pwctype +__p__timezone +__p__tzname +__p__wcmdln +__p__wenviron +__p__winmajor +__p__winminor +__p__winver +__p__wpgmptr +__pctype_func +__pioinfo +__pwctype_func +__pxcptinfoptrs +__set_app_type +__setlc_active +__setusermatherr +__strncnt +__threadhandle +__threadid +__toascii +__unDName +__unDNameEx +__uncaught_exception +__unguarded_readlc_active +__wargv +__wcserror +__wcserror_s +__wcsncnt +__wgetmainargs +__winitenv +_abnormal_termination +_abs64 +_access +_access_s +_acmdln +_adj_fdiv_m16i +_adj_fdiv_m32 +_adj_fdiv_m32i +_adj_fdiv_m64 +_adj_fdiv_r +_adj_fdivr_m16i +_adj_fdivr_m32 +_adj_fdivr_m32i +_adj_fdivr_m64 +_adj_fpatan +_adj_fprem +_adj_fprem1 +_adj_fptan +_adjust_fdiv +_aexit_rtn +_aligned_free +_aligned_free_dbg +_aligned_malloc +_aligned_malloc_dbg +_aligned_offset_malloc +_aligned_offset_malloc_dbg +_aligned_offset_realloc +_aligned_offset_realloc_dbg +_aligned_realloc +_aligned_realloc_dbg +_amsg_exit +_assert +_atodbl +_atodbl_l +_atof_l +_atoflt_l +_atoi64 +_atoi64_l +_atoi_l +_atol_l +_atoldbl +_atoldbl_l +_beep +_beginthread +_beginthreadex +_c_exit +_cabs +_callnewh +_calloc_dbg +_cexit +_cgets +_cgets_s +_cgetws +_cgetws_s +_chdir +_chdrive +_chgsign +_chkesp +_chmod +_chsize +_chsize_s +_chvalidator +_chvalidator_l +_clearfp +_close +_commit +_commode +_control87 +_controlfp +_controlfp_s +_copysign +_cprintf +_cprintf_l +_cprintf_p +_cprintf_p_l +_cprintf_s +_cprintf_s_l +_cputs +_cputws +_creat +_crtAssertBusy +_crtBreakAlloc +_crtDbgFlag +_cscanf +_cscanf_l +_cscanf_s +_cscanf_s_l +_ctime32 +_ctime32_s +_ctime64 +_ctime64_s +_ctype +_cwait +_cwprintf +_cwprintf_l +_cwprintf_p +_cwprintf_p_l +_cwprintf_s +_cwprintf_s_l +_cwscanf +_cwscanf_l +_cwscanf_s +_cwscanf_s_l +_daylight +_difftime32 +_difftime64 +_dstbias +_dup +_dup2 +_ecvt +_ecvt_s +_endthread +_endthreadex +_environ +_eof +_errno +_except_handler2 +_except_handler3 +_except_handler4_common +_execl +_execle +_execlp +_execlpe +_execv +_execve +_execvp +_execvpe +_exit +_expand +_expand_dbg +_fcloseall +_fcvt +_fcvt_s +_fdopen +_fgetchar +_fgetwchar +_filbuf +_fileinfo +_filelength +_filelengthi64 +_fileno +_findclose +_findfirst +_findfirst64 +_findfirsti64 +_findnext +_findnext64 +_findnexti64 +_finite +_flsbuf +_flushall +_fmode +_fpclass +_fpieee_flt +_fpreset +_fprintf_l +_fprintf_p +_fprintf_p_l +_fprintf_s_l +_fputchar +_fputwchar +_free_dbg +_freea +_freea_s +_fscanf_l +_fscanf_s_l +_fseeki64 +_fsopen +_fstat +_fstat64 +_fstati64 +_ftime +_ftime32 +_ftime32_s +_ftime64 +_ftime64_s +_ftol +_ftol2 +_ftol2_sse +_ftol2_sse_excpt +_fullpath +_fullpath_dbg +_futime +_futime32 +_futime64 +_fwprintf_l +_fwprintf_p +_fwprintf_p_l +_fwprintf_s_l +_fwscanf_l +_fwscanf_s_l +_gcvt +_gcvt_s +_get_doserrno +_get_environ +_get_errno +_get_fileinfo +_get_fmode +_get_heap_handle +_get_osfhandle +_get_osplatform +_get_osver +_get_output_format +_get_pgmptr +_get_sbh_threshold +_get_wenviron +_get_winmajor +_get_winminor +_get_winver +_get_wpgmptr +_getch +_getche +_getcwd +_getdcwd +_getdiskfree +_getdllprocaddr +_getdrive +_getdrives +_getmaxstdio +_getmbcp +_getpid +_getsystime +_getw +_getwch +_getwche +_getws +_global_unwind2 +_gmtime32 +_gmtime32_s +_gmtime64 +_gmtime64_s +_heapadd +_heapchk +_heapmin +_heapset +_heapused +_heapwalk +_hypot +_i64toa +_i64toa_s +_i64tow +_i64tow_s +_initterm +_initterm_e +_inp +_inpd +_inpw +_invalid_parameter +_iob +_isalnum_l +_isalpha_l +_isatty +_iscntrl_l +_isctype +_isctype_l +_isdigit_l +_isgraph_l +_isleadbyte_l +_islower_l +_ismbbalnum +_ismbbalnum_l +_ismbbalpha +_ismbbalpha_l +_ismbbgraph +_ismbbgraph_l +_ismbbkalnum +_ismbbkalnum_l +_ismbbkana +_ismbbkana_l +_ismbbkprint +_ismbbkprint_l +_ismbbkpunct +_ismbbkpunct_l +_ismbblead +_ismbblead_l +_ismbbprint +_ismbbprint_l +_ismbbpunct +_ismbbpunct_l +_ismbbtrail +_ismbbtrail_l +_ismbcalnum +_ismbcalnum_l +_ismbcalpha +_ismbcalpha_l +_ismbcdigit +_ismbcdigit_l +_ismbcgraph +_ismbcgraph_l +_ismbchira +_ismbchira_l +_ismbckata +_ismbckata_l +_ismbcl0 +_ismbcl0_l +_ismbcl1 +_ismbcl1_l +_ismbcl2 +_ismbcl2_l +_ismbclegal +_ismbclegal_l +_ismbclower +_ismbclower_l +_ismbcprint +_ismbcprint_l +_ismbcpunct +_ismbcpunct_l +_ismbcspace +_ismbcspace_l +_ismbcsymbol +_ismbcsymbol_l +_ismbcupper +_ismbcupper_l +_ismbslead +_ismbslead_l +_ismbstrail +_ismbstrail_l +_isnan +_isprint_l +_isspace_l +_isupper_l +_iswalnum_l +_iswalpha_l +_iswcntrl_l +_iswctype_l +_iswdigit_l +_iswgraph_l +_iswlower_l +_iswprint_l +_iswpunct_l +_iswspace_l +_iswupper_l +_iswxdigit_l +_isxdigit_l +_itoa +_itoa_s +_itow +_itow_s +_j0 +_j1 +_jn +_kbhit +_lfind +_lfind_s +_loaddll +_local_unwind2 +_local_unwind4 +_localtime32 +_localtime32_s +_localtime64 +_localtime64_s +_lock +_locking +_logb +_longjmpex +_lrotl +_lrotr +_lsearch +_lsearch_s +_lseek +_lseeki64 +_ltoa +_ltoa_s +_ltow +_ltow_s +_makepath +_makepath_s +_malloc_dbg +_mbbtombc +_mbbtombc_l +_mbbtype +_mbcasemap +_mbccpy +_mbccpy_l +_mbccpy_s +_mbccpy_s_l +_mbcjistojms +_mbcjistojms_l +_mbcjmstojis +_mbcjmstojis_l +_mbclen +_mbclen_l +_mbctohira +_mbctohira_l +_mbctokata +_mbctokata_l +_mbctolower +_mbctolower_l +_mbctombb +_mbctombb_l +_mbctoupper +_mbctoupper_l +_mbctype +_mblen_l +_mbsbtype +_mbsbtype_l +_mbscat +_mbscat_s +_mbscat_s_l +_mbschr +_mbschr_l +_mbscmp +_mbscmp_l +_mbscoll +_mbscoll_l +_mbscpy +_mbscpy_s +_mbscpy_s_l +_mbscspn +_mbscspn_l +_mbsdec +_mbsdec_l +_mbsdup +_mbsicmp +_mbsicmp_l +_mbsicoll +_mbsicoll_l +_mbsinc +_mbsinc_l +_mbslen +_mbslen_l +_mbslwr +_mbslwr_l +_mbslwr_s +_mbslwr_s_l +_mbsnbcat +_mbsnbcat_l +_mbsnbcat_s +_mbsnbcat_s_l +_mbsnbcmp +_mbsnbcmp_l +_mbsnbcnt +_mbsnbcnt_l +_mbsnbcoll +_mbsnbcoll_l +_mbsnbcpy +_mbsnbcpy_l +_mbsnbcpy_s +_mbsnbcpy_s_l +_mbsnbicmp +_mbsnbicmp_l +_mbsnbicoll +_mbsnbicoll_l +_mbsnbset +_mbsnbset_l +_mbsnbset_s +_mbsnbset_s_l +_mbsncat +_mbsncat_l +_mbsncat_s +_mbsncat_s_l +_mbsnccnt +_mbsnccnt_l +_mbsncmp +_mbsncmp_l +_mbsncoll +_mbsncoll_l +_mbsncpy +_mbsncpy_l +_mbsncpy_s +_mbsncpy_s_l +_mbsnextc +_mbsnextc_l +_mbsnicmp +_mbsnicmp_l +_mbsnicoll +_mbsnicoll_l +_mbsninc +_mbsninc_l +_mbsnlen +_mbsnlen_l +_mbsnset +_mbsnset_l +_mbsnset_s +_mbsnset_s_l +_mbspbrk +_mbspbrk_l +_mbsrchr +_mbsrchr_l +_mbsrev +_mbsrev_l +_mbsset +_mbsset_l +_mbsset_s +_mbsset_s_l +_mbsspn +_mbsspn_l +_mbsspnp +_mbsspnp_l +_mbsstr +_mbsstr_l +_mbstok +_mbstok_l +_mbstok_s +_mbstok_s_l +_mbstowcs_l +_mbstowcs_s_l +_mbstrlen +_mbstrlen_l +_mbstrnlen +_mbstrnlen_l +_mbsupr +_mbsupr_l +_mbsupr_s +_mbsupr_s_l +_mbtowc_l +_memccpy +_memicmp +_memicmp_l +_mkdir +_mkgmtime +_mkgmtime32 +_mkgmtime64 +_mktemp +_mktemp_s +_mktime32 +_mktime64 +_msize +_msize_debug +_nextafter +_onexit +_open +_open_osfhandle +_osplatform +_osver +_outp +_outpd +_outpw +_pclose +_pctype +_pgmptr +_pipe +_popen +_printf_l +_printf_p +_printf_p_l +_printf_s_l +_purecall +_putch +_putenv +_putenv_s +_putw +_putwch +_putws +_pwctype +_read +_realloc_dbg +_resetstkoflw +_rmdir +_rmtmp +_rotl +_rotl64 +_rotr +_rotr64 +_safe_fdiv +_safe_fdivr +_safe_fprem +_safe_fprem1 +_scalb +_scanf_l +_scanf_s_l +_scprintf +_scprintf_l +_scprintf_p_l +_scwprintf +_scwprintf_l +_scwprintf_p_l +_searchenv +_searchenv_s +_seh_longjmp_unwind +_seh_longjmp_unwind4 +_set_SSE2_enable +_set_controlfp +_set_doserrno +_set_errno +_set_error_mode +_set_fileinfo +_set_fmode +_set_output_format +_set_sbh_threshold +_seterrormode +_setjmp +_setjmp3 +_setmaxstdio +_setmbcp +_setmode +_setsystime +_sleep +_snprintf +_snprintf_c +_snprintf_c_l +_snprintf_l +_snprintf_s +_snprintf_s_l +_snscanf +_snscanf_l +_snscanf_s +_snscanf_s_l +_snwprintf +_snwprintf_l +_snwprintf_s +_snwprintf_s_l +_snwscanf +_snwscanf_l +_snwscanf_s +_snwscanf_s_l +_sopen +_sopen_s +_spawnl +_spawnle +_spawnlp +_spawnlpe +_spawnv +_spawnve +_spawnvp +_spawnvpe +_splitpath +_splitpath_s +_sprintf_l +_sprintf_p_l +_sprintf_s_l +_sscanf_l +_sscanf_s_l +_stat +_stat64 +_stati64 +_statusfp +_strcmpi +_strcoll_l +_strdate +_strdate_s +_strdup +_strdup_dbg +_strerror +_strerror_s +_stricmp +_stricmp_l +_stricoll +_stricoll_l +_strlwr +_strlwr_l +_strlwr_s +_strlwr_s_l +_strncoll +_strncoll_l +_strnicmp +_strnicmp_l +_strnicoll +_strnicoll_l +_strnset +_strnset_s +_strrev +_strset +_strset_s +_strtime +_strtime_s +_strtod_l +_strtoi64 +_strtoi64_l +_strtol_l +_strtoui64 +_strtoui64_l +_strtoul_l +_strupr +_strupr_l +_strupr_s +_strupr_s_l +_strxfrm_l +_swab +_swprintf +_swprintf_c +_swprintf_c_l +_swprintf_p_l +_swprintf_s_l +_swscanf_l +_swscanf_s_l +_sys_errlist +_sys_nerr +_tell +_telli64 +_tempnam +_tempnam_dbg +_time32 +_time64 +_timezone +_tolower +_tolower_l +_toupper +_toupper_l +_towlower_l +_towupper_l +_tzname +_tzset +_ui64toa +_ui64toa_s +_ui64tow +_ui64tow_s +_ultoa +_ultoa_s +_ultow +_ultow_s +_umask +_umask_s +_ungetch +_ungetwch +_unlink +_unloaddll +_unlock +_utime +_utime32 +_utime64 +_vcprintf +_vcprintf_l +_vcprintf_p +_vcprintf_p_l +_vcprintf_s +_vcprintf_s_l +_vcwprintf +_vcwprintf_l +_vcwprintf_p +_vcwprintf_p_l +_vcwprintf_s +_vcwprintf_s_l +_vfprintf_l +_vfprintf_p +_vfprintf_p_l +_vfprintf_s_l +_vfwprintf_l +_vfwprintf_p +_vfwprintf_p_l +_vfwprintf_s_l +_vprintf_l +_vprintf_p +_vprintf_p_l +_vprintf_s_l +_vscprintf +_vscprintf_l +_vscprintf_p_l +_vscwprintf +_vscwprintf_l +_vscwprintf_p_l +_vsnprintf +_vsnprintf_c +_vsnprintf_c_l +_vsnprintf_l +_vsnprintf_s +_vsnprintf_s_l +_vsnwprintf +_vsnwprintf_l +_vsnwprintf_s +_vsnwprintf_s_l +_vsprintf_l +_vsprintf_p +_vsprintf_p_l +_vsprintf_s_l +_vswprintf +_vswprintf_c +_vswprintf_c_l +_vswprintf_l +_vswprintf_p_l +_vswprintf_s_l +_vwprintf_l +_vwprintf_p +_vwprintf_p_l +_vwprintf_s_l +_waccess +_waccess_s +_wasctime +_wasctime_s +_wassert +_wchdir +_wchmod +_wcmdln +_wcreat +_wcscoll_l +_wcsdup +_wcsdup_dbg +_wcserror +_wcserror_s +_wcsftime_l +_wcsicmp +_wcsicmp_l +_wcsicoll +_wcsicoll_l +_wcslwr +_wcslwr_l +_wcslwr_s +_wcslwr_s_l +_wcsncoll +_wcsncoll_l +_wcsnicmp +_wcsnicmp_l +_wcsnicoll +_wcsnicoll_l +_wcsnset +_wcsnset_s +_wcsrev +_wcsset +_wcsset_s +_wcstoi64 +_wcstoi64_l +_wcstol_l +_wcstombs_l +_wcstombs_s_l +_wcstoui64 +_wcstoui64_l +_wcstoul_l +_wcsupr +_wcsupr_l +_wcsupr_s +_wcsupr_s_l +_wcsxfrm_l +_wctime +_wctime32 +_wctime32_s +_wctime64 +_wctime64_s +_wctomb_l +_wctomb_s_l +_wctype +_wenviron +_wexecl +_wexecle +_wexeclp +_wexeclpe +_wexecv +_wexecve +_wexecvp +_wexecvpe +_wfdopen +_wfindfirst +_wfindfirst64 +_wfindfirsti64 +_wfindnext +_wfindnext64 +_wfindnexti64 +_wfopen +_wfopen_s +_wfreopen +_wfreopen_s +_wfsopen +_wfullpath +_wfullpath_dbg +_wgetcwd +_wgetdcwd +_wgetenv +_wgetenv_s +_winmajor +_winminor +_winput_s +_winver +_wmakepath +_wmakepath_s +_wmkdir +_wmktemp +_wmktemp_s +_wopen +_woutput_s +_wperror +_wpgmptr +_wpopen +_wprintf_l +_wprintf_p +_wprintf_p_l +_wprintf_s_l +_wputenv +_wputenv_s +_wremove +_wrename +_write +_wrmdir +_wscanf_l +_wscanf_s_l +_wsearchenv +_wsearchenv_s +_wsetlocale +_wsopen +_wsopen_s +_wspawnl +_wspawnle +_wspawnlp +_wspawnlpe +_wspawnv +_wspawnve +_wspawnvp +_wspawnvpe +_wsplitpath +_wsplitpath_s +_wstat +_wstat64 +_wstati64 +_wstrdate +_wstrdate_s +_wstrtime +_wstrtime_s +_wsystem +_wtempnam +_wtempnam_dbg +_wtmpnam +_wtmpnam_s +_wtof +_wtof_l +_wtoi +_wtoi64 +_wtoi64_l +_wtoi_l +_wtol +_wtol_l +_wunlink +_wutime +_wutime32 +_wutime64 +_y0 +_y1 +_yn +abort +abs +acos +asctime +asctime_s +asin +atan +atan2 +atexit +atof +atoi +atol +bsearch +bsearch_s +btowc +calloc +ceil +clearerr +clearerr_s +clock +cos +cosh +ctime +difftime +div +exit +exp +fabs +fclose +feof +ferror +fflush +fgetc +fgetpos +fgets +fgetwc +fgetws +floor +fmod +fopen +fopen_s +fprintf +fprintf_s +fputc +fputs +fputwc +fputws +fread +free +freopen +freopen_s +frexp +fscanf +fscanf_s +fseek +fsetpos +ftell +fwprintf +fwprintf_s +fwrite +fwscanf +fwscanf_s +getc +getchar +getenv +getenv_s +gets +getwc +getwchar +gmtime +is_wctype +isalnum +isalpha +iscntrl +isdigit +isgraph +isleadbyte +islower +isprint +ispunct +isspace +isupper +iswalnum +iswalpha +iswascii +iswcntrl +iswctype +iswdigit +iswgraph +iswlower +iswprint +iswpunct +iswspace +iswupper +iswxdigit +isxdigit +labs +ldexp +ldiv +localeconv +localtime +log +log10 +longjmp +malloc +mblen +mbrlen +mbrtowc +mbsdup_dbg +mbsrtowcs +mbsrtowcs_s +mbstowcs +mbstowcs_s +mbtowc +memchr +memcmp +memcpy +memcpy_s +memmove +memmove_s +memset +mktime +modf +perror +pow +printf +printf_s +putc +putchar +puts +putwc +putwchar +qsort +qsort_s +raise +rand +rand_s +realloc +remove +rename +rewind +scanf +scanf_s +setbuf +setlocale +setvbuf +signal +sin +sinh +sprintf +sprintf_s +sqrt +srand +sscanf +sscanf_s +strcat +strcat_s +strchr +strcmp +strcoll +strcpy +strcpy_s +strcspn +strerror +strerror_s +strftime +strlen +strncat +strncat_s +strncmp +strncpy +strncpy_s +strnlen +strpbrk +strrchr +strspn +strstr +strtod +strtok +strtok_s +strtol +strtoul +strxfrm +swprintf +swprintf_s +swscanf +swscanf_s +system +tan +tanh +time +tmpfile +tmpfile_s +tmpnam +tmpnam_s +tolower +toupper +towlower +towupper +ungetc +ungetwc +utime +vfprintf +vfprintf_s +vfwprintf +vfwprintf_s +vprintf +vprintf_s +vsnprintf +vsprintf +vsprintf_s +vswprintf +vswprintf_s +vwprintf +vwprintf_s +wcrtomb +wcrtomb_s +wcscat +wcscat_s +wcschr +wcscmp +wcscoll +wcscpy +wcscpy_s +wcscspn +wcsftime +wcslen +wcsncat +wcsncat_s +wcsncmp +wcsncpy +wcsncpy_s +wcsnlen +wcspbrk +wcsrchr +wcsrtombs +wcsrtombs_s +wcsspn +wcsstr +wcstod +wcstok +wcstok_s +wcstol +wcstombs +wcstombs_s +wcstoul +wcsxfrm +wctob +wctomb +wctomb_s +wprintf +wprintf_s +wscanf +wscanf_s diff --git a/overlay_toolchain/tcc/lib/user32.def b/overlay_toolchain/tcc/lib/user32.def new file mode 100644 index 00000000..a034dac2 --- /dev/null +++ b/overlay_toolchain/tcc/lib/user32.def @@ -0,0 +1,658 @@ +LIBRARY user32.dll + +EXPORTS +ActivateKeyboardLayout +AdjustWindowRect +AdjustWindowRectEx +AlignRects +AllowSetForegroundWindow +AnimateWindow +AnyPopup +AppendMenuA +AppendMenuW +ArrangeIconicWindows +AttachThreadInput +BeginDeferWindowPos +BeginPaint +BlockInput +BringWindowToTop +BroadcastSystemMessage +BroadcastSystemMessageA +BroadcastSystemMessageW +CalcChildScroll +CallMsgFilter +CallMsgFilterA +CallMsgFilterW +CallNextHookEx +CallWindowProcA +CallWindowProcW +CascadeChildWindows +CascadeWindows +ChangeClipboardChain +ChangeDisplaySettingsA +ChangeDisplaySettingsExA +ChangeDisplaySettingsExW +ChangeDisplaySettingsW +ChangeMenuA +ChangeMenuW +CharLowerA +CharLowerBuffA +CharLowerBuffW +CharLowerW +CharNextA +CharNextExA +CharNextExW +CharNextW +CharPrevA +CharPrevExA +CharPrevExW +CharPrevW +CharToOemA +CharToOemBuffA +CharToOemBuffW +CharToOemW +CharUpperA +CharUpperBuffA +CharUpperBuffW +CharUpperW +CheckDlgButton +CheckMenuItem +CheckMenuRadioItem +CheckRadioButton +ChildWindowFromPoint +ChildWindowFromPointEx +ClientThreadConnect +ClientToScreen +ClipCursor +CloseClipboard +CloseDesktop +CloseWindow +CloseWindowStation +CopyAcceleratorTableA +CopyAcceleratorTableW +CopyIcon +CopyImage +CopyRect +CountClipboardFormats +CreateAcceleratorTableA +CreateAcceleratorTableW +CreateCaret +CreateCursor +CreateDesktopA +CreateDesktopW +CreateDialogIndirectParamA +CreateDialogIndirectParamW +CreateDialogParamA +CreateDialogParamW +CreateIcon +CreateIconFromResource +CreateIconFromResourceEx +CreateIconIndirect +CreateMDIWindowA +CreateMDIWindowW +CreateMenu +CreatePopupMenu +CreateWindowExA +CreateWindowExW +CreateWindowStationA +CreateWindowStationW +DdeAbandonTransaction +DdeAccessData +DdeAddData +DdeClientTransaction +DdeCmpStringHandles +DdeConnect +DdeConnectList +DdeCreateDataHandle +DdeCreateStringHandleA +DdeCreateStringHandleW +DdeDisconnect +DdeDisconnectList +DdeEnableCallback +DdeFreeDataHandle +DdeFreeStringHandle +DdeGetData +DdeGetLastError +DdeImpersonateClient +DdeInitializeA +DdeInitializeW +DdeKeepStringHandle +DdeNameService +DdePostAdvise +DdeQueryConvInfo +DdeQueryNextServer +DdeQueryStringA +DdeQueryStringW +DdeReconnect +DdeSetQualityOfService +DdeSetUserHandle +DdeUnaccessData +DdeUninitialize +DefDlgProcA +DefDlgProcW +DefFrameProcA +DefFrameProcW +DefMDIChildProcA +DefMDIChildProcW +DefWindowProcA +DefWindowProcW +DeferWindowPos +DeleteMenu +DestroyAcceleratorTable +DestroyCaret +DestroyCursor +DestroyIcon +DestroyMenu +DestroyWindow +DialogBoxIndirectParamA +DialogBoxIndirectParamW +DialogBoxParamA +DialogBoxParamW +DispatchMessageA +DispatchMessageW +DlgDirListA +DlgDirListComboBoxA +DlgDirListComboBoxW +DlgDirListW +DlgDirSelectComboBoxExA +DlgDirSelectComboBoxExW +DlgDirSelectExA +DlgDirSelectExW +DragDetect +DragObject +DrawAnimatedRects +DrawCaption +DrawCaptionTempA +DrawCaptionTempW +DrawEdge +DrawFocusRect +DrawFrame +DrawFrameControl +DrawIcon +DrawIconEx +DrawMenuBar +DrawMenuBarTemp +DrawStateA +DrawStateW +DrawTextA +DrawTextExA +DrawTextExW +DrawTextW +EditWndProc +EmptyClipboard +EnableMenuItem +EnableScrollBar +EnableWindow +EndDeferWindowPos +EndDialog +EndMenu +EndPaint +EndTask +EnumChildWindows +EnumClipboardFormats +EnumDesktopWindows +EnumDesktopsA +EnumDesktopsW +EnumDisplayDevicesA +EnumDisplayDevicesW +EnumDisplayMonitors +EnumDisplaySettingsA +EnumDisplaySettingsExA +EnumDisplaySettingsExW +EnumDisplaySettingsW +EnumPropsA +EnumPropsExA +EnumPropsExW +EnumPropsW +EnumThreadWindows +EnumWindowStationsA +EnumWindowStationsW +EnumWindows +EqualRect +ExcludeUpdateRgn +ExitWindowsEx +FillRect +FindWindowA +FindWindowExA +FindWindowExW +FindWindowW +FlashWindow +FlashWindowEx +FrameRect +FreeDDElParam +GetActiveWindow +GetAltTabInfo +GetAncestor +GetAsyncKeyState +GetCapture +GetCaretBlinkTime +GetCaretPos +GetClassInfoA +GetClassInfoExA +GetClassInfoExW +GetClassInfoW +GetClassLongA +GetClassLongW +GetClassNameA +GetClassNameW +GetClassWord +GetClientRect +GetClipCursor +GetClipboardData +GetClipboardFormatNameA +GetClipboardFormatNameW +GetClipboardOwner +GetClipboardSequenceNumber +GetClipboardViewer +GetComboBoxInfo +GetCursor +GetCursorInfo +GetCursorPos +GetDC +GetDCEx +GetDesktopWindow +GetDialogBaseUnits +GetDlgCtrlID +GetDlgItem +GetDlgItemInt +GetDlgItemTextA +GetDlgItemTextW +GetDoubleClickTime +GetFocus +GetForegroundWindow +GetGUIThreadInfo +GetGuiResources +GetIconInfo +GetInputDesktop +GetInputState +GetInternalWindowPos +GetKBCodePage +GetKeyNameTextA +GetKeyNameTextW +GetKeyState +GetKeyboardLayout +GetKeyboardLayoutList +GetKeyboardLayoutNameA +GetKeyboardLayoutNameW +GetKeyboardState +GetKeyboardType +GetLastActivePopup +GetListBoxInfo +GetMenu +GetMenuBarInfo +GetMenuCheckMarkDimensions +GetMenuContextHelpId +GetMenuDefaultItem +GetMenuInfo +GetMenuItemCount +GetMenuItemID +GetMenuItemInfoA +GetMenuItemInfoW +GetMenuItemRect +GetMenuState +GetMenuStringA +GetMenuStringW +GetMessageA +GetMessageExtraInfo +GetMessagePos +GetMessageTime +GetMessageW +GetMonitorInfoA +GetMonitorInfoW +GetMouseMovePoints +GetMouseMovePointsEx +GetNextDlgGroupItem +GetNextDlgTabItem +GetNextQueueWindow +GetOpenClipboardWindow +GetParent +GetPriorityClipboardFormat +GetProcessDefaultLayout +GetProcessWindowStation +GetPropA +GetPropW +GetQueueStatus +GetScrollBarInfo +GetScrollInfo +GetScrollPos +GetScrollRange +GetShellWindow +GetSubMenu +GetSysColor +GetSysColorBrush +GetSystemMenu +GetSystemMetrics +GetTabbedTextExtentA +GetTabbedTextExtentW +GetThreadDesktop +GetTitleBarInfo +GetTopWindow +GetUpdateRect +GetUpdateRgn +GetUserObjectInformationA +GetUserObjectInformationW +GetUserObjectSecurity +GetWindow +GetWindowContextHelpId +GetWindowDC +GetWindowInfo +GetWindowLongPtrA +GetWindowLongPtrW +SetWindowLongPtrA +SetWindowLongPtrW +GetWindowLongA +GetWindowLongW +GetWindowModuleFileNameA +GetWindowModuleFileNameW +GetWindowPlacement +GetWindowRect +GetWindowRgn +GetWindowTextA +GetWindowTextLengthA +GetWindowTextLengthW +GetWindowTextW +GetWindowThreadProcessId +GetWindowWord +GrayStringA +GrayStringW +HasSystemSleepStarted +HideCaret +HiliteMenuItem +IMPGetIMEA +IMPGetIMEW +IMPQueryIMEA +IMPQueryIMEW +IMPSetIMEA +IMPSetIMEW +ImpersonateDdeClientWindow +InSendMessage +InSendMessageEx +InflateRect +InitSharedTable +InitTask +InsertMenuA +InsertMenuItemA +InsertMenuItemW +InsertMenuW +InternalGetWindowText +IntersectRect +InvalidateRect +InvalidateRgn +InvertRect +IsCharAlphaA +IsCharAlphaNumericA +IsCharAlphaNumericW +IsCharAlphaW +IsCharLowerA +IsCharLowerW +IsCharUpperA +IsCharUpperW +IsChild +IsClipboardFormatAvailable +IsDialogMessage +IsDialogMessageA +IsDialogMessageW +IsDlgButtonChecked +IsHungThread +IsIconic +IsMenu +IsRectEmpty +IsWindow +IsWindowEnabled +IsWindowUnicode +IsWindowVisible +IsZoomed +KillTimer +LoadAcceleratorsA +LoadAcceleratorsW +LoadBitmapA +LoadBitmapW +LoadCursorA +LoadCursorFromFileA +LoadCursorFromFileW +LoadCursorW +LoadIconA +LoadIconW +LoadImageA +LoadImageW +LoadKeyboardLayoutA +LoadKeyboardLayoutW +LoadMenuA +LoadMenuIndirectA +LoadMenuIndirectW +LoadMenuW +LoadStringA +LoadStringW +LockSetForegroundWindow +LockWindowStation +LockWindowUpdate +LookupIconIdFromDirectory +LookupIconIdFromDirectoryEx +MapDialogRect +MapVirtualKeyA +MapVirtualKeyExA +MapVirtualKeyExW +MapVirtualKeyW +MapWindowPoints +MenuItemFromPoint +MessageBeep +MessageBoxA +MessageBoxExA +MessageBoxExW +MessageBoxIndirectA +MessageBoxIndirectW +MessageBoxW +ModifyAccess +ModifyMenuA +ModifyMenuW +MonitorFromPoint +MonitorFromRect +MonitorFromWindow +MoveWindow +MsgWaitForMultipleObjects +MsgWaitForMultipleObjectsEx +NotifyWinEvent +OemKeyScan +OemToCharA +OemToCharBuffA +OemToCharBuffW +OemToCharW +OffsetRect +OpenClipboard +OpenDesktopA +OpenDesktopW +OpenIcon +OpenInputDesktop +OpenWindowStationA +OpenWindowStationW +PackDDElParam +PaintDesktop +PeekMessageA +PeekMessageW +PlaySoundEvent +PostMessageA +PostMessageW +PostQuitMessage +PostThreadMessageA +PostThreadMessageW +PtInRect +RealChildWindowFromPoint +RealGetWindowClass +RedrawWindow +RegisterClassA +RegisterClassExA +RegisterClassExW +RegisterClassW +RegisterClipboardFormatA +RegisterClipboardFormatW +RegisterDeviceNotificationA +RegisterDeviceNotificationW +RegisterHotKey +RegisterLogonProcess +RegisterNetworkCapabilities +RegisterSystemThread +RegisterTasklist +RegisterWindowMessageA +RegisterWindowMessageW +ReleaseCapture +ReleaseDC +RemoveMenu +RemovePropA +RemovePropW +ReplyMessage +ReuseDDElParam +ScreenToClient +ScrollDC +ScrollWindow +ScrollWindowEx +SendDlgItemMessageA +SendDlgItemMessageW +SendIMEMessageExA +SendIMEMessageExW +SendInput +SendMessageA +SendMessageCallbackA +SendMessageCallbackW +SendMessageTimeoutA +SendMessageTimeoutW +SendMessageW +SendNotifyMessageA +SendNotifyMessageW +SetActiveWindow +SetCapture +SetCaretBlinkTime +SetCaretPos +SetClassLongA +SetClassLongW +SetClassWord +SetClipboardData +SetClipboardViewer +SetCursor +SetCursorPos +SetDebugErrorLevel +SetDeskWallpaper +SetDesktopBitmap +SetDlgItemInt +SetDlgItemTextA +SetDlgItemTextW +SetDoubleClickTime +SetFocus +SetForegroundWindow +SetInternalWindowPos +SetKeyboardState +SetLastErrorEx +SetLogonNotifyWindow +SetMenu +SetMenuContextHelpId +SetMenuDefaultItem +SetMenuInfo +SetMenuItemBitmaps +SetMenuItemInfoA +SetMenuItemInfoW +SetMessageExtraInfo +SetMessageQueue +SetParent +SetProcessDefaultLayout +SetProcessWindowStation +SetPropA +SetPropW +SetRect +SetRectEmpty +SetScrollInfo +SetScrollPos +SetScrollRange +SetShellWindow +SetSysColors +SetSysColorsTemp +SetSystemCursor +SetThreadDesktop +SetTimer +SetUserObjectInformationA +SetUserObjectInformationW +SetUserObjectSecurity +SetWinEventHook +SetWindowContextHelpId +SetWindowFullScreenState +SetWindowLongA +SetWindowLongW +SetWindowPlacement +SetWindowPos +SetWindowRgn +SetWindowTextA +SetWindowTextW +SetWindowWord +SetWindowsHookA +SetWindowsHookExA +SetWindowsHookExW +SetWindowsHookW +ShowCaret +ShowCursor +ShowOwnedPopups +ShowScrollBar +ShowWindow +ShowWindowAsync +SubtractRect +SwapMouseButton +SwitchDesktop +SwitchToThisWindow +SysErrorBox +SystemParametersInfoA +SystemParametersInfoW +TabbedTextOutA +TabbedTextOutW +TileChildWindows +TileWindows +ToAscii +ToAsciiEx +ToUnicode +ToUnicodeEx +TrackMouseEvent +TrackPopupMenu +TrackPopupMenuEx +TranslateAccelerator +TranslateAcceleratorA +TranslateAcceleratorW +TranslateMDISysAccel +TranslateMessage +UnhookWinEvent +UnhookWindowsHook +UnhookWindowsHookEx +UnionRect +UnloadKeyboardLayout +UnlockWindowStation +UnpackDDElParam +UnregisterClassA +UnregisterClassW +UnregisterDeviceNotification +UnregisterHotKey +UpdateWindow +UserClientDllInitialize +UserIsSystemResumeAutomatic +UserSetDeviceHoldState +UserSignalProc +UserTickleTimer +ValidateRect +ValidateRgn +VkKeyScanA +VkKeyScanExA +VkKeyScanExW +VkKeyScanW +WINNLSEnableIME +WINNLSGetEnableStatus +WINNLSGetIMEHotkey +WNDPROC_CALLBACK +WaitForInputIdle +WaitMessage +WinHelpA +WinHelpW +WinOldAppHackoMatic +WindowFromDC +WindowFromPoint +YieldTask +_SetProcessDefaultLayout +keybd_event +mouse_event +wsprintfA +wsprintfW +wvsprintfA +wvsprintfW diff --git a/overlay_toolchain/tcc/libtcc.dll b/overlay_toolchain/tcc/libtcc.dll new file mode 100644 index 00000000..0a5d8179 Binary files /dev/null and b/overlay_toolchain/tcc/libtcc.dll differ diff --git a/overlay_toolchain/tcc/libtcc/libtcc.def b/overlay_toolchain/tcc/libtcc/libtcc.def new file mode 100644 index 00000000..bc866ab9 --- /dev/null +++ b/overlay_toolchain/tcc/libtcc/libtcc.def @@ -0,0 +1,37 @@ +LIBRARY libtcc.dll + +EXPORTS +tcc_add_file +tcc_add_include_path +tcc_add_library +tcc_add_library_err +tcc_add_library_path +tcc_add_symbol +tcc_add_sysinclude_path +tcc_basename +tcc_compile_string +tcc_define_symbol +tcc_delete +tcc_error +tcc_error_noabort +tcc_fileextension +tcc_free +tcc_get_dllexports +tcc_get_symbol +tcc_malloc +tcc_mallocz +tcc_memcheck +tcc_new +tcc_output_file +tcc_parse_args +tcc_print_stats +tcc_realloc +tcc_relocate +tcc_run +tcc_set_error_func +tcc_set_lib_path +tcc_set_options +tcc_set_output_type +tcc_strdup +tcc_undefine_symbol +tcc_warning diff --git a/overlay_toolchain/tcc/libtcc/libtcc.h b/overlay_toolchain/tcc/libtcc/libtcc.h new file mode 100644 index 00000000..a1b31e30 --- /dev/null +++ b/overlay_toolchain/tcc/libtcc/libtcc.h @@ -0,0 +1,100 @@ +#ifndef LIBTCC_H +#define LIBTCC_H + +#ifndef LIBTCCAPI +# define LIBTCCAPI +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct TCCState; + +typedef struct TCCState TCCState; + +/* create a new TCC compilation context */ +LIBTCCAPI TCCState *tcc_new(void); + +/* free a TCC compilation context */ +LIBTCCAPI void tcc_delete(TCCState *s); + +/* set CONFIG_TCCDIR at runtime */ +LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path); + +/* set error/warning display callback */ +LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque, + void (*error_func)(void *opaque, const char *msg)); + +/* set options as from command line (multiple supported) */ +LIBTCCAPI void tcc_set_options(TCCState *s, const char *str); + +/*****************************/ +/* preprocessor */ + +/* add include path */ +LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname); + +/* add in system include path */ +LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname); + +/* define preprocessor symbol 'sym'. Can put optional value */ +LIBTCCAPI void tcc_define_symbol(TCCState *s, const char *sym, const char *value); + +/* undefine preprocess symbol 'sym' */ +LIBTCCAPI void tcc_undefine_symbol(TCCState *s, const char *sym); + +/*****************************/ +/* compiling */ + +/* add a file (C file, dll, object, library, ld script). Return -1 if error. */ +LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename); + +/* compile a string containing a C source. Return -1 if error. */ +LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf); + +/*****************************/ +/* linking commands */ + +/* set output type. MUST BE CALLED before any compilation */ +LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type); +#define TCC_OUTPUT_MEMORY 1 /* output will be run in memory (default) */ +#define TCC_OUTPUT_EXE 2 /* executable file */ +#define TCC_OUTPUT_DLL 3 /* dynamic library */ +#define TCC_OUTPUT_OBJ 4 /* object file */ +#define TCC_OUTPUT_PREPROCESS 5 /* only preprocess (used internally) */ + +/* equivalent to -Lpath option */ +LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname); + +/* the library name is the same as the argument of the '-l' option */ +LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname); + +/* add a symbol to the compiled program */ +LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val); + +/* output an executable, library or object file. DO NOT call + tcc_relocate() before. */ +LIBTCCAPI int tcc_output_file(TCCState *s, const char *filename); + +/* link and run main() function and return its value. DO NOT call + tcc_relocate() before. */ +LIBTCCAPI int tcc_run(TCCState *s, int argc, char **argv); + +/* do all relocations (needed before using tcc_get_symbol()) */ +LIBTCCAPI int tcc_relocate(TCCState *s1, void *ptr); +/* possible values for 'ptr': + - TCC_RELOCATE_AUTO : Allocate and manage memory internally + - NULL : return required memory size for the step below + - memory address : copy code to memory passed by the caller + returns -1 if error. */ +#define TCC_RELOCATE_AUTO (void*)1 + +/* return symbol value or NULL if not found */ +LIBTCCAPI void *tcc_get_symbol(TCCState *s, const char *name); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/overlay_toolchain/tcc/tcc.exe b/overlay_toolchain/tcc/tcc.exe new file mode 100644 index 00000000..2c8d0639 Binary files /dev/null and b/overlay_toolchain/tcc/tcc.exe differ diff --git a/psxrecomp_cli.py b/psxrecomp_cli.py index b148a05c..c7a35fcd 100755 --- a/psxrecomp_cli.py +++ b/psxrecomp_cli.py @@ -409,12 +409,24 @@ def ensure_emitters( Generate & rebuild without a pre-staged setup-host SDK. """ if not force: + # With the framework's recompiler sources present, always run the + # (incremental) build: a binary that merely exists may predate the + # sources -- a submodule moved to another revision -- and would emit + # code for the old framework without a word (a hook site listed in + # game.toml silently missing). Ninja makes the up-to-date case cheap. + # Without sources (an SDK pack), the staged binaries are the only ones. try: - game, bios = find_emitters(project_root) - progress.log(f"Emitters ready: {game}, {bios}") - return game, bios + recompiler_source_dir(project_root) + have_sources = True except FileNotFoundError: - pass + have_sources = False + if not have_sources: + try: + game, bios = find_emitters(project_root) + progress.log(f"Emitters ready: {game}, {bios}") + return game, bios + except FileNotFoundError: + pass progress.phase( "emitters", diff --git a/recompiler/CMakeLists.txt b/recompiler/CMakeLists.txt index 1563689a..a26c36d6 100644 --- a/recompiler/CMakeLists.txt +++ b/recompiler/CMakeLists.txt @@ -1223,7 +1223,8 @@ if(BUILD_TESTING) vk_mailbox_policy vk_present_timing vk_present_wait_stage - vk_staging_cache) + vk_staging_cache + wide_overlay_band_scissor) add_test( NAME ${_t} COMMAND ${Python3_EXECUTABLE} diff --git a/recompiler/include/code_generator.h b/recompiler/include/code_generator.h index 0cde2e0f..4409e4ef 100644 --- a/recompiler/include/code_generator.h +++ b/recompiler/include/code_generator.h @@ -174,6 +174,7 @@ struct CodeGenConfig { // while widescreen reveals extra world. 4:3 evaluates the original compare. std::vector ws_cull_keep_sites; std::vector ws_cull_masked_reject_sites; + std::vector ws_cull_scale_sites; // Exact `addi[u] rt,zero,imm` 12-bit angular half-extents. The runtime // scales tan(angle) by the current horizontal reveal factor. diff --git a/recompiler/src/code_generator.cpp b/recompiler/src/code_generator.cpp index d753447f..9ace7ceb 100644 --- a/recompiler/src/code_generator.cpp +++ b/recompiler/src/code_generator.cpp @@ -812,6 +812,20 @@ std::string CodeGenerator::generate_branch_condition(uint32_t instr, uint32_t ad return fmt::format("psx_ws_x_margin() > 0 ? 0 : ({}) /* ws branch keep */", cond); }; + // NCLIP/backface sign branches (bltz/bgez/blez/bgtz on a MAC0 copy). + // nclip_keep: reject forced not-taken while wide. nclip_exact: test the + // exact tracked sign while wide. Every sign-test shape is supported: the + // title's emitter decides which one its backface reject uses. Returns "" + // when addr is not a configured NCLIP site. + auto nclip_sign_branch = [&](const char *cmp) -> std::string { + if (config_.ws_cull_nclip_keep_sites.count(addr)) + return fmt::format("psx_ws_x_margin() > 0 ? 0 : ((int32_t){} {} 0) /* ws nclip keep */", + reg_name(rs), cmp); + if (config_.ws_cull_nclip_exact_sites.count(addr)) + return fmt::format("psx_ws_x_margin() > 0 ? (gte_nclip_exact_sign((int32_t){}, 0x{:08X}u) {} 0) : ((int32_t){} {} 0) /* ws exact nclip */", + reg_name(rs), addr, cmp, reg_name(rs), cmp); + return ""; + }; // REGIMM branches. R3000A hardware decodes EVERY rt value here, not just // the four assembler mnemonics: the branch sense is rt bit 0 (0 = bltz, @@ -849,12 +863,10 @@ std::string CodeGenerator::generate_branch_condition(uint32_t instr, uint32_t ad if (regimm_op == 0x00 && config_.ws_cull_screen_x_sites.count(addr)) return fmt::format("psx_ws_cull_bltz_hi({}) /* ws cull (left edge, X in the high half) */", reg_name(rs)); - if (regimm_op == 0x00 && config_.ws_cull_nclip_keep_sites.count(addr)) - return fmt::format("psx_ws_x_margin() > 0 ? 0 : ((int32_t){} < 0) /* ws nclip keep */", - reg_name(rs)); - if (regimm_op == 0x00 && config_.ws_cull_nclip_exact_sites.count(addr)) - return fmt::format("psx_ws_x_margin() > 0 ? gte_nclip_precise_bltz((int32_t){}) : ((int32_t){} < 0) /* ws exact nclip */", - reg_name(rs), reg_name(rs)); + if (regimm_op == 0x00) { + const std::string n = nclip_sign_branch("<"); + if (!n.empty()) return n; + } return keep_branch_if_wide( fmt::format("(int32_t){} < 0", reg_name(rs))); } else { // bgez family (incl. bgezal + undefined mirrors) @@ -865,6 +877,10 @@ std::string CodeGenerator::generate_branch_condition(uint32_t instr, uint32_t ad if (regimm_op == 0x01 && config_.ws_cull_bgez_sites.count(addr)) return fmt::format("psx_ws_cull_bgez({}) /* ws cull (left keep) */", reg_name(rs)); + if (regimm_op == 0x01) { + const std::string n = nclip_sign_branch(">="); + if (!n.empty()) return n; + } return keep_branch_if_wide( fmt::format("(int32_t){} >= 0", reg_name(rs))); } @@ -883,11 +899,15 @@ std::string CodeGenerator::generate_branch_condition(uint32_t instr, uint32_t ad case 0x06: // blez case 0x16: // blezl + if (const std::string n = nclip_sign_branch("<="); !n.empty()) + return n; return keep_branch_if_wide( fmt::format("(int32_t){} <= 0", reg_name(rs))); case 0x07: // bgtz case 0x17: // bgtzl + if (const std::string n = nclip_sign_branch(">"); !n.empty()) + return n; return keep_branch_if_wide( fmt::format("(int32_t){} > 0", reg_name(rs))); } @@ -1117,6 +1137,38 @@ std::string CodeGenerator::translate_instruction_core(uint32_t addr, uint32_t in reg_name(dst), vanilla, site.result, comment); } + // Register-register frustum-edge compares ([[widescreen.cull.scale]]): + // the configured operand is a +/-half_extent*z bound computed at runtime, + // so it is scaled by the live reveal instead of rewriting an immediate. + // psx_ws_cull_scale is identity at 4:3. Overlay variants with another + // instruction at the same VA are left untouched. + for (const auto& site : config_.ws_cull_scale_sites) { + if ((site.address & 0x1FFFFFFFu) != (addr & 0x1FFFFFFFu)) continue; + if (instr != site.expected) { + if (config_.overlay_mode) continue; + fmt::print(stderr, + "ERROR: cull scale expected 0x{:08X} at 0x{:08X}, found 0x{:08X}\n", + site.expected, addr, instr); + std::exit(1); + } + const uint32_t rs = get_rs(instr), rt = get_rt(instr), rd = get_rd(instr); + const std::string a = site.operand == 0 + ? fmt::format("(uint32_t)psx_ws_cull_scale((int32_t){}, {})", + reg_name(rs), site.half_extent) + : std::string(reg_name(rs)); + const std::string b = site.operand == 1 + ? fmt::format("(uint32_t)psx_ws_cull_scale((int32_t){}, {})", + reg_name(rt), site.half_extent) + : std::string(reg_name(rt)); + if (funct == 0x2A) + return fmt::format("{} = ((int32_t){} < (int32_t){}) ? 1u : 0u;" + " /* ws cull scale (bound x (half+margin)/half) */{}", + reg_name(rd), a, b, comment); + return fmt::format("{} = ({} < {}) ? 1u : 0u;" + " /* ws cull scale (bound x (half+margin)/half) */{}", + reg_name(rd), a, b, comment); + } + // Widescreen automatic far-backdrop column PRELOAD ([widescreen.cull] // auto_backdrop). At a detected window's START/END finalize, route the value // through psx_ws_backdrop_value(orig, is_end): identity at 4:3, but in @@ -3555,6 +3607,7 @@ void CodeGenerator::emit_runtime_externs(std::ostream& ss) const { ss << "extern int32_t psx_ws_plane_nx(int32_t nx); /* ws side-plane normal-X scale (gpu.c) */\n"; ss << "extern uint32_t psx_ws_xclip_bound(uint32_t vanilla); /* ws per-prim X reject bound load (gpu.c) */\n"; ss << "extern uint32_t psx_ws_cull_keep_result(uint32_t vanilla, uint32_t forced); /* ws guarded keep compare (gpu.c) */\n"; + ss << "extern int32_t psx_ws_cull_scale(int32_t bound, int32_t half_extent); /* ws frustum-edge bound scale (gpu.c) */\n"; ss << "extern uint32_t psx_ws_aspect_cone_result(uint32_t site, uint32_t vanilla, uint32_t object, int32_t x, int32_t z, int32_t y); /* aspect-aware participation cone */\n"; ss << "extern uint32_t psx_ws_angle_widen(uint32_t vanilla); /* aspect-scaled 12-bit terrain-frustum half-angle */\n"; ss << "extern int psx_ws_backdrop_x(int x); /* widescreen backdrop screenX squash (gpu.c) */\n"; diff --git a/recompiler/src/config_loader.cpp b/recompiler/src/config_loader.cpp index 2ff83a51..6079a1f3 100644 --- a/recompiler/src/config_loader.cpp +++ b/recompiler/src/config_loader.cpp @@ -76,7 +76,10 @@ uint32_t overlay_codegen_config_hash(const GameConfig& c) { h.u32(site.reject_mask); } } - h.words("mod_instruction_sites", c.mod_instruction_sites); + // Appended only when used, like the other late additions: a config that + // does not use the feature keeps the hash (and every overlay cache) it had. + if (!c.mod_instruction_sites.empty()) + h.words("mod_instruction_sites", c.mod_instruction_sites); h.words("cull_bias", c.ws_cull_bias_sites); if (!c.ws_cull_bias_lower_sites.empty()) h.words("cull_bias_lower", c.ws_cull_bias_lower_sites); @@ -143,6 +146,20 @@ uint32_t overlay_codegen_config_hash(const GameConfig& c) { h.u32(site.result); } + std::vector scale_sites = c.ws_cull_scale_sites; + std::sort(scale_sites.begin(), scale_sites.end(), + [](const auto& a, const auto& b) { return a.address < b.address; }); + if (!scale_sites.empty()) { // appended only when used (see above) + h.tag("cull_scale"); + h.u32((uint32_t)scale_sites.size()); + for (const auto& site : scale_sites) { + h.u32(site.address); + h.u32(site.expected); + h.u32(site.operand); + h.u32(site.half_extent); + } + } + std::vector angle_sites = c.ws_cull_angle_sites; std::sort(angle_sites.begin(), angle_sites.end(), [](const auto& a, const auto& b) { @@ -1929,6 +1946,7 @@ GameConfig load_game_config(const fs::path& config_path_in) { uint32_t ws_cull_clip_edge_width = 0; std::vector ws_cull_keep_sites; std::vector ws_cull_masked_reject_sites; + std::vector ws_cull_scale_sites; std::vector ws_cull_angle_sites; WidescreenAspectConeConfig ws_aspect_cone; int ws_cull_guard_pixels = 0; @@ -2027,6 +2045,38 @@ GameConfig load_game_config(const fs::path& config_path_in) { ws_cull_keep_sites.push_back(site); } } + if (cull.contains("scale")) { + std::set seen; + for (const auto& item : toml::find(cull, "scale")) { + WidescreenCullScaleSite site; + site.address = parse_hex(toml::find(item, "address"), + "widescreen.cull.scale.address"); + site.expected = parse_hex(toml::find(item, "expected"), + "widescreen.cull.scale.expected"); + const std::string operand = toml::find(item, "operand"); + if (operand == "rs") site.operand = 0; + else if (operand == "rt") site.operand = 1; + else throw std::runtime_error(fmt::format( + "{}: [[widescreen.cull.scale]] operand must be rs or rt", + config_path.string())); + const int half = toml::find(item, "half_extent"); + if (half <= 0 || half > 1024) throw std::runtime_error(fmt::format( + "{}: [[widescreen.cull.scale]] half_extent must be 1..1024", + config_path.string())); + site.half_extent = (uint32_t)half; + const uint32_t op = site.expected >> 26; + const uint32_t fn = site.expected & 0x3Fu; + if (!(op == 0u && (fn == 0x2Au || fn == 0x2Bu))) + throw std::runtime_error(fmt::format( + "{}: [[widescreen.cull.scale]] expected must be SLT/SLTU", + config_path.string())); + if (!seen.insert(site.address & 0x1FFFFFFFu).second) + throw std::runtime_error(fmt::format( + "{}: duplicate [[widescreen.cull.scale]] address 0x{:08X}", + config_path.string(), site.address)); + ws_cull_scale_sites.push_back(site); + } + } if (cull.contains("angle")) { std::set seen; for (const auto& item : @@ -2434,6 +2484,7 @@ GameConfig load_game_config(const fs::path& config_path_in) { /*ws_cull_nclip_exact_sites*/ ws_cull_nclip_exact_sites, /*ws_cull_branch_keep_sites*/ ws_cull_branch_keep_sites, /*ws_cull_keep_sites*/ ws_cull_keep_sites, + /*ws_cull_scale_sites*/ ws_cull_scale_sites, /*ws_cull_angle_sites*/ ws_cull_angle_sites, /*ws_aspect_cone*/ ws_aspect_cone, /*ws_cull_guard_pixels*/ ws_cull_guard_pixels, diff --git a/recompiler/src/config_loader.h b/recompiler/src/config_loader.h index e5e22036..9d8320c8 100644 --- a/recompiler/src/config_loader.h +++ b/recompiler/src/config_loader.h @@ -103,6 +103,18 @@ struct WidescreenCullKeepSite { // constant with `addi[u] rt,zero,imm`; the runtime widens tan(angle) by the // live horizontal reveal factor. Full-word guards prevent overlay-address // aliases from changing unrelated immediates. +// One register-register view-bound compare whose bound operand is widened +// with the live reveal: `slt rd, rs, rt` where the configured operand holds +// +/-half_extent*z (a camera-space frustum edge computed at runtime, so there +// is no immediate to rewrite). The operand is scaled by +// (half_extent + margin) / half_extent; identity at 4:3. Full-word guarded. +struct WidescreenCullScaleSite { + uint32_t address = 0; + uint32_t expected = 0; // guarded SLT/SLTU instruction + uint32_t operand = 1; // 0 = scale rs, 1 = scale rt + uint32_t half_extent = 0; // authored screen half-extent (e.g. 160) +}; + struct WidescreenAngleSite { uint32_t address = 0; uint32_t expected = 0; // guarded ADDI/ADDIU with rs == zero @@ -1060,6 +1072,9 @@ struct GameConfig { // where maximal overdraw is preferable to range guessing. Each entry is // guarded by the complete MIPS word; 4:3 executes the vanilla comparison. std::vector ws_cull_keep_sites; + // Register-register frustum-edge compares whose bound operand scales + // with the live reveal ([[widescreen.cull.scale]]). + std::vector ws_cull_scale_sites; // Exact 12-bit angular half-extents used by terrain-cell frusta. std::vector ws_cull_angle_sites; // Full-word-guarded model-participation cosine compares widened only in diff --git a/recompiler/src/main_psx.cpp b/recompiler/src/main_psx.cpp index 8fe6013e..f32cbba7 100644 --- a/recompiler/src/main_psx.cpp +++ b/recompiler/src/main_psx.cpp @@ -243,6 +243,7 @@ static int psxrecomp_game_main(int argc, char** argv) { std::set ws_cull_clip_edge_x_load; // [widescreen.cull] clip_edge_x_load_sites uint32_t ws_cull_clip_edge_width = 0; // [widescreen.cull] clip_edge_width std::vector ws_cull_keep; + std::vector ws_cull_scale; std::vector ws_cull_angle; std::vector draw_distance_clamps; // [[draw_distance.clamp]] PSXRecompV4::WidescreenAspectConeConfig ws_aspect_cone; @@ -320,6 +321,7 @@ static int psxrecomp_game_main(int argc, char** argv) { ws_cull_clip_edge_width = PSXRecompV4::ws_cull_clip_edge_width(cfg); ws_cull_keep = cfg.ws_cull_keep_sites; ws_cull_masked_reject = cfg.ws_cull_masked_reject_sites; + ws_cull_scale = cfg.ws_cull_scale_sites; ws_cull_angle = cfg.ws_cull_angle_sites; draw_distance_clamps = cfg.draw_distance_clamp_sites; ws_aspect_cone = cfg.ws_aspect_cone; @@ -427,6 +429,7 @@ static int psxrecomp_game_main(int argc, char** argv) { ws_cull_clip_edge_width = PSXRecompV4::ws_cull_clip_edge_width(wscfg); if (ws_cull_keep.empty()) ws_cull_keep = wscfg.ws_cull_keep_sites; if (ws_cull_masked_reject.empty()) ws_cull_masked_reject = wscfg.ws_cull_masked_reject_sites; + if (ws_cull_scale.empty()) ws_cull_scale = wscfg.ws_cull_scale_sites; if (ws_cull_angle.empty()) ws_cull_angle = wscfg.ws_cull_angle_sites; if (ws_aspect_cone.sites.empty()) ws_aspect_cone = wscfg.ws_aspect_cone; @@ -1497,6 +1500,7 @@ static int psxrecomp_game_main(int argc, char** argv) { else if (!ws_cull_w_imms.empty()) codegen_config.ws_cull_clip_edge_width = ws_cull_w_imms.front(); codegen_config.ws_cull_keep_sites = ws_cull_keep; + codegen_config.ws_cull_scale_sites = ws_cull_scale; codegen_config.ws_cull_angle_sites = ws_cull_angle; codegen_config.draw_distance_clamp_sites = draw_distance_clamps; codegen_config.ws_aspect_cone = ws_aspect_cone; diff --git a/recompiler/src/pgxp_hook_emitter.cpp b/recompiler/src/pgxp_hook_emitter.cpp index a998b12c..5f251f3e 100644 --- a/recompiler/src/pgxp_hook_emitter.cpp +++ b/recompiler/src/pgxp_hook_emitter.cpp @@ -24,11 +24,13 @@ inline int16_t get_imm16(uint32_t i) { return (int16_t)(i & 0xFFFF); } * the macros preprocess to ((void)0) and the optimizer erases the dead * capture locals, so base objects are unchanged; only a -DPSX_PGXP=1 TU pays. * - * Deliberately unhooked: AND/XOR/NOR/SLT-family and the exotic immediates — - * they only ever DESTROY precision, and the engine's validate-on-read drops - * their stale shadows without help. The configured widescreen special sites - * return early above translate_instruction's main dispatch and are likewise - * unhooked (they are cull compares, not vertex moves; validation covers). */ + * Every GPR-writing ALU op is hooked. Bitwise ops (AND/OR/XOR/NOR, ANDI/ORI/ + * XORI) carry a vertex half whose 11-bit GPU field survives them - engines + * pack clip flags above the field after projecting - and SLT-family results + * are reset, so no destination keeps a stale shadow. The configured + * widescreen special sites return early above translate_instruction's main + * dispatch and are unhooked (they are cull compares, not vertex moves; + * validation covers). */ bool emission_ends_on_preprocessor_directive(const std::string& code) { /* Scan back to the start of the final line, then find its first * non-blank character. A directive is legal with leading whitespace, so @@ -89,7 +91,8 @@ void append_pgxp_hooks(uint32_t instr, std::string& code) { code, instr, reg_name(rs), reg_name(rt)); return; case 0x20: case 0x21: case 0x22: case 0x23: /* ADD(U)/SUB(U) */ - case 0x25: /* OR */ + case 0x24: case 0x25: case 0x26: case 0x27: /* AND/OR/XOR/NOR */ + case 0x2A: case 0x2B: /* SLT/SLTU */ if (rd == 0) return; code = fmt::format( "{{ uint32_t _pgx1 = {}; uint32_t _pgx2 = {}; {}\n " @@ -107,7 +110,8 @@ void append_pgxp_hooks(uint32_t instr, std::string& code) { reg_name(rs), code, instr, reg_name(rt), (uint32_t)(int32_t)offset); return; - case 0x0D: /* ORI */ + case 0x0A: case 0x0B: /* SLTI / SLTIU */ + case 0x0C: case 0x0D: case 0x0E: /* ANDI / ORI / XORI */ if (rt == 0) return; code = fmt::format( "{{ uint32_t _pgx1 = {}; {}\n PGXP_ALU(0x{:08X}u, {}, _pgx1, 0x{:04X}u); }}", diff --git a/recompiler/tests/draw_distance_codegen_test.cpp b/recompiler/tests/draw_distance_codegen_test.cpp index 666c1346..b7c03d81 100644 --- a/recompiler/tests/draw_distance_codegen_test.cpp +++ b/recompiler/tests/draw_distance_codegen_test.cpp @@ -267,7 +267,10 @@ void emission() { "exactly one clamp emitted"); check(at != std::string::npos && at >= 5 && out.compare(at - 5, 5, "\n ") == 0 && - out.find("\n cpu->gpr[10] =", at) != std::string::npos, + (out.find("\n cpu->gpr[10] =", at) != std::string::npos || + /* PGXP-aliasing form: the source is captured before the write. */ + out.find("\n { uint32_t _pgx1 = cpu->gpr[2]; cpu->gpr[10] =", at) != + std::string::npos), "the clamp and the guard share the statement indent"); // The addiu form clamps the source the slot index is computed from. diff --git a/recompiler/tests/recompiler_patch_test.cpp b/recompiler/tests/recompiler_patch_test.cpp index 4058f028..bfde820b 100644 --- a/recompiler/tests/recompiler_patch_test.cpp +++ b/recompiler/tests/recompiler_patch_test.cpp @@ -311,6 +311,28 @@ result = 0 keep_config.ws_cull_keep_sites[1].result == 0u, "parser preserves full-word-guarded maximal-participation sites"); + const auto scale = write_config(root, "cull-scale", R"toml( +[[widescreen.cull.scale]] +address = "0x8002C734" +expected = "0x0062182A" +operand = "rt" +half_extent = 160 + +[[widescreen.cull.scale]] +address = "0x8002C758" +expected = "0x0043102A" +operand = "rs" +half_extent = 160 +)toml"); + const auto scale_config = PSXRecompV4::load_game_config(scale); + check(scale_config.ws_cull_scale_sites.size() == 2 && + scale_config.ws_cull_scale_sites[0].address == 0x8002C734u && + scale_config.ws_cull_scale_sites[0].expected == 0x0062182Au && + scale_config.ws_cull_scale_sites[0].operand == 1u && + scale_config.ws_cull_scale_sites[0].half_extent == 160u && + scale_config.ws_cull_scale_sites[1].operand == 0u, + "parser preserves register-register frustum-edge scale sites"); + const auto signed_bound = write_config(root, "signed-x-bound", R"toml( [[widescreen.signed_x_bound]] address = "0x8002D290" @@ -818,7 +840,7 @@ void codegen_tests() { const std::string nclip_exact = generate_first_instruction( 0x04400002u, {}, false, nclip_exact_config); // bltz v0,+2 check(nclip_exact.find( - "gte_nclip_precise_bltz((int32_t)cpu->gpr[2])") != + "gte_nclip_exact_sign((int32_t)cpu->gpr[2], 0x80010000u) < 0") != std::string::npos && nclip_exact.find("ws exact nclip") != std::string::npos, "codegen emits title-scoped exact NCLIP predicate"); @@ -828,6 +850,13 @@ void codegen_tests() { guarded.find("guarded wide nclip") != std::string::npos, "inclusive/keep NCLIP branches carry full-word identity to the host"); } + PSXRecomp::CodeGenConfig nclip_keep_config; + nclip_keep_config.ws_cull_nclip_keep_sites.insert(0x80010000u); + const std::string nclip_keep_blez = generate_first_instruction( + 0x18400002u, {}, false, nclip_keep_config); + check(nclip_keep_blez.find("psx_ws_x_margin() > 0 ? 0 : ((int32_t)cpu->gpr[2] <= 0)") != + std::string::npos, + "codegen NCLIP keep covers blez"); PSXRecomp::CodeGenConfig plane_nx_config; plane_nx_config.ws_cull_plane_nx_sites.insert(0x80010000u); @@ -877,6 +906,27 @@ void codegen_tests() { std::string::npos, "overlay full-word mismatch leaves keep site unchanged"); + PSXRecomp::CodeGenConfig scale_config_gen; + scale_config_gen.ws_cull_scale_sites.push_back( + {0x80010000u, 0x0062182Au, 1u, 160u}); // slt v1,v1,v0: scale rt + const std::string scale_rt = generate_first_instruction( + 0x0062182Au, {}, false, scale_config_gen); + check(scale_rt.find("psx_ws_cull_scale((int32_t)") != std::string::npos && + scale_rt.find(", 160)") != std::string::npos && + scale_rt.find("(int32_t)cpu->gpr[3] < (int32_t)(uint32_t)psx_ws_cull_scale") != + std::string::npos, + "codegen scales the configured rt bound of a signed frustum edge"); + scale_config_gen.ws_cull_scale_sites[0] = {0x80010000u, 0x0043102Au, 0u, 160u}; + const std::string scale_rs = generate_first_instruction( + 0x0043102Au, {}, false, scale_config_gen); + check(scale_rs.find("(int32_t)(uint32_t)psx_ws_cull_scale((int32_t)cpu->gpr[2], 160) < (int32_t)cpu->gpr[3]") != + std::string::npos, + "codegen scales the configured rs bound of the opposite edge"); + const std::string scale_overlay_mismatch = generate_first_instruction( + 0x0043102Bu, {}, true, scale_config_gen); // sltu at same overlay VA + check(scale_overlay_mismatch.find("psx_ws_cull_scale") == std::string::npos, + "overlay full-word mismatch leaves scale site unchanged"); + PSXRecomp::CodeGenConfig angle_config; angle_config.ws_cull_angle_sites.push_back( {0x80010000u, 0x24020155u}); diff --git a/recompiler/tests/test_optional_netplay_auth.py b/recompiler/tests/test_optional_netplay_auth.py index 16ff877f..a8d66794 100644 --- a/recompiler/tests/test_optional_netplay_auth.py +++ b/recompiler/tests/test_optional_netplay_auth.py @@ -50,6 +50,9 @@ def main(): "RNET_HOST_RELAY_HEADER_INCLUDED", "RNetHostRelayStatus st"): assert token in p.stdout, f"enabled path lost {token}" else: + # netplay-off builds must not need any recomp_net header + # (none exist in this include path, so -E would have failed). + assert "RNET_RELAY_HEADER_INCLUDED" not in p.stdout assert "rnet_account_" not in p.stdout, "offline launcher retained account linkage" assert "RNET_ACCOUNT_" not in p.stdout, "offline launcher retained account state dependency" assert "RNetHostRelayStatus st" not in p.stdout, "offline launcher retained the recomp-net host relay" diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 2bfaae4d..f057641c 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.20) project(psxrecomp-runtime C CXX) include(CTest) @@ -66,6 +66,15 @@ if(BUILD_TESTING) set_tests_properties(netplay_libjuice_offline_other PROPERTIES PASS_REGULAR_EXPRESSION "recomp-net pins libjuice SHA256") if(NOT MSVC) + add_executable(host_snapshot_guard_test tests/test_host_snapshot_guard.c) + add_executable(fntrace_restore_handoff_test + tests/test_fntrace_restore_handoff.c src/fntrace.c) + foreach(test_target host_snapshot_guard_test fntrace_restore_handoff_test) + target_include_directories(${test_target} PRIVATE include src) + target_compile_options(${test_target} PRIVATE -O2 -flto -ffunction-sections -fdata-sections) + target_link_options(${test_target} PRIVATE -flto -Wl,--gc-sections) + add_test(NAME ${test_target} COMMAND ${test_target}) + endforeach() add_executable(ws_world_scene_test tests/test_ws_world_scene.c src/psx_video_timing.c) target_include_directories(ws_world_scene_test PRIVATE include src) @@ -267,6 +276,7 @@ if(BUILD_TESTING) tests/psx_ram_runtime_map_stubs.c src/memory.c src/dma.c + src/gpu_timeline.c src/boot_state.c src/psx_ram_geometry.c) target_include_directories(psx_ram_runtime_map_test PRIVATE include src) @@ -287,6 +297,7 @@ if(BUILD_TESTING) tests/psx_ram_runtime_map_stubs.c src/memory.c src/dma.c + src/gpu_timeline.c src/boot_state.c src/psx_icache.c src/psx_ram_geometry.c) @@ -420,6 +431,7 @@ if(BUILD_TESTING) src/psx_ram_geometry.c src/mod_runtime.cpp src/mod_packages.cpp + src/mod_media.cpp src/disc_path.cpp src/cue_sheet.cpp src/iso_reader.cpp @@ -472,7 +484,8 @@ if(BUILD_TESTING) add_executable(gpu_textured_dot_nw_shift_exec_test tests/test_gpu_textured_dot_nw_shift_exec.c - src/psx_video_timing.c) + src/psx_video_timing.c + src/gpu_timeline.c) target_include_directories(gpu_textured_dot_nw_shift_exec_test PRIVATE include src) @@ -491,7 +504,8 @@ if(BUILD_TESTING) add_executable(ws_auto_ui_untextured_exec_test tests/test_ws_auto_ui_untextured_exec.c src/ws_ui_group.c - src/psx_video_timing.c) + src/psx_video_timing.c + src/gpu_timeline.c) target_include_directories(ws_auto_ui_untextured_exec_test PRIVATE include src) @@ -507,7 +521,8 @@ if(BUILD_TESTING) add_executable(ws_shared_split_ui_exec_test tests/test_ws_shared_split_ui_exec.c src/ws_ui_group.c - src/psx_video_timing.c) + src/psx_video_timing.c + src/gpu_timeline.c) target_include_directories(ws_shared_split_ui_exec_test PRIVATE include src) if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") target_compile_options(ws_shared_split_ui_exec_test PRIVATE @@ -518,9 +533,11 @@ if(BUILD_TESTING) add_executable(ws_view_anchor_test tests/test_ws_view_anchor.c) add_executable(ws_view_anchor_gpu_test tests/test_ws_view_anchor_gpu.c - src/psx_video_timing.c) + src/psx_video_timing.c + src/gpu_timeline.c) add_executable(native_wide_projection_test tests/test_native_wide_projection.c - src/psx_video_timing.c) + src/psx_video_timing.c + src/gpu_timeline.c) foreach(_anchor_test ws_view_anchor ws_view_anchor_gpu native_wide_projection) target_include_directories(${_anchor_test}_test PRIVATE include src) if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") @@ -706,25 +723,38 @@ if(BUILD_TESTING) add_executable(mod_packages_test tests/test_mod_packages.cpp src/mod_packages.cpp + src/mod_media.cpp src/iso_reader.cpp src/cue_sheet.cpp src/crc32.c src/psx_sha256.c) target_include_directories(mod_packages_test PRIVATE include + ../recompiler/include ../recompiler/lib/toml11) + target_link_libraries(mod_packages_test PRIVATE chdr-static) add_test(NAME mod_packages_test COMMAND mod_packages_test) add_executable(builtin_mod_manifests_test tests/test_builtin_mod_manifests.cpp src/mod_packages.cpp + src/mod_media.cpp src/iso_reader.cpp src/cue_sheet.cpp src/crc32.c src/psx_sha256.c) target_include_directories(builtin_mod_manifests_test PRIVATE include + ../recompiler/include ../recompiler/lib/toml11) + target_link_libraries(builtin_mod_manifests_test PRIVATE chdr-static) add_test(NAME builtin_mod_manifests_test COMMAND builtin_mod_manifests_test "${CMAKE_CURRENT_SOURCE_DIR}/../mods/builtin/packages") + add_executable(mod_media_test + tests/test_mod_media.cpp src/mod_media.cpp src/iso_reader.cpp + src/cue_sheet.cpp src/psx_sha256.c) + target_include_directories(mod_media_test PRIVATE include ../recompiler/include) + target_link_libraries(mod_media_test PRIVATE chdr-static) + add_test(NAME mod_media_test COMMAND mod_media_test) + add_executable(text_xlate_fix_only_test tests/test_text_xlate_fix_only.cpp src/text_xlate.cpp @@ -739,6 +769,7 @@ if(BUILD_TESTING) src/iso_reader_c.cpp src/mod_runtime.cpp src/mod_packages.cpp + src/mod_media.cpp src/disc_path.cpp src/cue_sheet.cpp src/iso_reader.cpp @@ -760,6 +791,31 @@ if(BUILD_TESTING) endif() add_test(NAME mod_runtime_test COMMAND mod_runtime_test) + add_executable(mod_resident_test + tests/test_mod_resident.cpp + src/mod_resident.cpp + src/mod_runtime.cpp + src/mod_packages.cpp + src/mod_media.cpp + src/disc_path.cpp + src/cue_sheet.cpp + src/iso_reader.cpp + src/crc32.c + src/psx_sha256.c) + target_include_directories(mod_resident_test PRIVATE + include + ../recompiler/include + ../recompiler/lib/toml11) + target_link_libraries(mod_resident_test PRIVATE chdr-static) + if(WIN32) + if(MSVC) + target_link_options(mod_resident_test PRIVATE /STACK:16777216) + else() + target_link_options(mod_resident_test PRIVATE -Wl,--stack,16777216) + endif() + endif() + add_test(NAME mod_resident_test COMMAND mod_resident_test) + if(WIN32) add_executable(autocompile_publication_test tests/test_autocompile_publication.c diff --git a/runtime/include/cpu_state.h b/runtime/include/cpu_state.h index 8b1c8fd5..d03b97a1 100644 --- a/runtime/include/cpu_state.h +++ b/runtime/include/cpu_state.h @@ -235,13 +235,15 @@ extern void gte_geometry_correction_stats(uint32_t *lookups, uint32_t *hits, * where sub-pixel and guest-visible integer signs differ. MAC0 stays native. */ extern void gte_nclip_precise_stats(uint64_t *hits, uint64_t *fallbacks, uint64_t *disagreements); -/* Title-scoped widescreen cull consumer. Returns the exact tracked NCLIP sign - * only when it belongs to the supplied native MAC0; otherwise preserves the - * native comparison. This does not change guest-visible GTE state. */ -extern int gte_nclip_precise_bltz(int32_t native_mac0); extern int gte_nclip_native_wide_sign(int32_t native_mac0, int* sign); extern int gte_nclip_native_wide_previous_sign(int32_t native_mac0, int* sign); extern int psx_ws_nclip_branch(uint32_t pc, uint32_t instr, int32_t mac0, int vanilla); +/* Title-scoped widescreen cull consumer ([widescreen.cull] nclip_exact_sites). + * Returns the sign (-1/0/1) the branch at `pc` should test: the exact tracked + * NCLIP sign only when it belongs to the supplied native MAC0, otherwise the + * native sign. Counts per-site use (gte_nclip_stats.h). Does not change + * guest-visible GTE state. */ +extern int32_t gte_nclip_exact_sign(int32_t native_mac0, uint32_t pc); /* PGXP dataflow-shadowing hook macros (PGXP_LOAD/STORE/ALU/MULDIV/COP2). * The emitter writes them unconditionally; they expand to real calls only diff --git a/runtime/include/debug_server.h b/runtime/include/debug_server.h index 27a3d2b9..ba776a17 100644 --- a/runtime/include/debug_server.h +++ b/runtime/include/debug_server.h @@ -108,6 +108,10 @@ uint32_t debug_server_get_tcp_drops(void); /* Record the current frame's state into the ring buffer. * Call after vblank processing. */ void debug_server_record_frame(void); +/* Operator capture mark (hotkey, present thread): freeze the always-on display + * and GP0 rings at this instant and save the presented native-wide frame, so a + * transient glitch can be read back afterwards over TCP (capture_mark). */ +void debug_server_capture_mark(void); /* Block while paused, polling TCP + SDL events. * Call from vblank callback before frame processing. */ diff --git a/runtime/include/dma.h b/runtime/include/dma.h index d6565acf..a681de9f 100644 --- a/runtime/include/dma.h +++ b/runtime/include/dma.h @@ -42,6 +42,14 @@ uint32_t dma_get_dicr(void); uint32_t dma_get_dpcr(void); int dma_cdrom_transfer_active(void); int dma_gpu_linked_list_active(void); +/* RAM-side effects of a completed CD-ROM (ch3) transfer of host-supplied + * sector data, for seamless-loading adapters serving a game's own CdGetSector + * or read loop: overlay capture before the first word, per-word RAM stores + * under DMA attribution, executable-page invalidation, the CD DMA log (when + * lba >= 0) and overlay capture on completion. Channel registers, IRQs and + * guest timing are untouched. dest/bytes word aligned; returns 0 if the span + * leaves live RAM. */ +int dma_host_cdrom_write(uint32_t dest, const uint8_t* src, uint32_t bytes, int lba); typedef struct DMAChannelDebugState { uint32_t madr; diff --git a/runtime/include/gpu.h b/runtime/include/gpu.h index 203e6cd4..c625b2ba 100644 --- a/runtime/include/gpu.h +++ b/runtime/include/gpu.h @@ -304,6 +304,12 @@ void gpu_ws_set_cull_keep_sites(const uint32_t *addresses, const uint32_t *results, int nsites); void gpu_ws_set_angle_sites(const uint32_t *addresses, const uint32_t *expected, int nsites); +/* [[widescreen.cull.scale]]: full-word-guarded SLT/SLTU sites whose rs (0) or + * rt (1) operand is a runtime +/-half_extent*z frustum bound. */ +void gpu_ws_set_cull_scale_sites(const uint32_t *addresses, + const uint32_t *expected, + const uint32_t *operands, + const uint32_t *half_extents, int nsites); void gpu_ws_set_aspect_cone(const uint32_t *addresses, const uint32_t *expected, const uint32_t *cosine_thresholds, @@ -351,6 +357,12 @@ int psx_ws_cull_keep_site(uint32_t pc, uint32_t instr, uint32_t vanilla, uint32_t *out); uint32_t psx_ws_angle_widen(uint32_t vanilla); int psx_ws_angle_site(uint32_t pc, uint32_t instr, uint32_t *out); +/* bound * (half_extent + margin) / half_extent; identity at 4:3. */ +int32_t psx_ws_cull_scale(int32_t bound, int32_t half_extent); +/* Interpreter path for a configured scale site: returns 1 and the widened + * compare verdict in *out when (pc, instr) is a configured site. */ +int psx_ws_cull_scale_site(uint32_t pc, uint32_t instr, uint32_t rs_value, + uint32_t rt_value, uint32_t *out); uint32_t psx_ws_aspect_cone_result(uint32_t site, uint32_t vanilla, uint32_t object, int32_t x, int32_t z, int32_t y); @@ -438,6 +450,36 @@ void gpu_ws_set_adaptive_backdrop_preload(int enabled); * `prim` is the address of the PsyQ P_TAG word; the drawn command starts at * prim+4. anchor: -1 = left, 0 = center, +1 = right. */ void gpu_ws_tag_hud_prim(uint32_t prim, int anchor); +/* Stretch a trusted authored background polygon about the display center in + * the native-wide output only (GL/SW). prim+4 is the command address, including + * for a command embedded inside a longer DMA packet. Only opaque polygons are + * accepted; address, full packet contents, and frame freshness are guarded. + * Tag the complete background composite before submitting its ordering table. + * The caller proves background identity/coverage; no guest data is modified. */ +void gpu_ws_tag_background_prim(uint32_t prim); +/* Always-on counters for the explicit HUD-anchor and background tag tables: + * how many tags a title plugin offered, how many were rejected at insert + * (native-wide not configured / unreadable or unsupported command), and why + * executing primitives that matched a tagged address were or were not + * honoured. TCP: {"cmd":"ws_tag_stats"}. */ +typedef struct GpuWsTagStats { + uint64_t tag_calls; + uint64_t tag_rejected; + uint64_t hit; + uint64_t stale; + uint64_t guard_mismatch; + uint32_t last_tag_frame; + uint32_t last_hit_frame; +} GpuWsTagStats; +void gpu_ws_get_tag_stats(GpuWsTagStats *hud, GpuWsTagStats *background); +/* Freeze/unfreeze the always-on GP0 command ring (capture mark). */ +void gpu_gp0_ring_set_frozen(int frozen); +/* Fresh packet tags are eligible for background classification. */ +int gpu_ws_background_stretch_active(void); +/* A tagged background can remain in a wide surface after its packet expires. + * Once used, retain full compositing until GPU reset or snapshot restoration. + * Packet freshness must never re-enable canonical-center overwrites. */ +int gpu_ws_background_requires_full_composite(void); /* Clear synthetic margins to black over an opaque 0x64/65 rectangle's Y band * immediately before it executes. Packet-guarded; canonical VRAM is untouched. */ void gpu_ws_tag_black_reveal_rect(uint32_t prim); diff --git a/runtime/include/gpu_timeline.h b/runtime/include/gpu_timeline.h new file mode 100644 index 00000000..e18f1b5d --- /dev/null +++ b/runtime/include/gpu_timeline.h @@ -0,0 +1,52 @@ +#ifndef PSXRECOMP_GPU_TIMELINE_H +#define PSXRECOMP_GPU_TIMELINE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPU frame timeline: an always-on, guest-cycle-stamped record of the events + * that decide WHAT a present shows — vblank, display-start flips, draw-area + * changes, GPU linked-list DMA start/end, and each present (swapped or + * skipped). The GP0, display and presented-image rings are all tagged by + * frame number only, which cannot order a present against a draw inside the + * same frame; this ring can. Frozen by the capture mark. */ +#define GPU_TIMELINE_CAP 32768u /* power of two; ~40 s at typical rates */ + +typedef enum { + GTL_VBLANK = 1, /* a = lcf after toggle */ + GTL_DISP_START = 2, /* a = x, b = y (GP1 05h) */ + GTL_DRAW_AREA = 3, /* a = left, b = top (GP0 E3h) */ + GTL_LL_START = 4, /* a = OT start address */ + GTL_LL_END = 5, /* a = nodes, b = words */ + GTL_PRESENT = 6, /* a = path, b = disp_x | disp_y << 16 */ + GTL_PRESENT_SKIP = 7, /* a = path, b = disp_x | disp_y << 16 (no swap) */ + GTL_DISP_CAPTURE = 8, /* display-ring capture; b = disp_x | disp_y << 16 */ + GTL_FILL = 9, /* a = x | y << 16, b = w | h << 16 (GP0 02h) */ +} GpuTimelineKind; + +/* Present paths recorded in GTL_PRESENT/GTL_PRESENT_SKIP `a`. */ +enum { GTL_PATH_WIDE_FBO = 1, GTL_PATH_VRAM_FBO = 2, GTL_PATH_CPU = 3, + GTL_PATH_HOLD = 4 }; + +typedef struct { + uint64_t cyc; /* psx_cycle_count */ + uint32_t frame; /* s_frame_count */ + uint32_t a, b; + uint8_t kind; + uint8_t pad[3]; +} GpuTimelineEntry; + +void gpu_timeline_note(uint8_t kind, uint32_t a, uint32_t b); +void gpu_timeline_set_frozen(int frozen); +uint64_t gpu_timeline_total(void); +int gpu_timeline_get(uint64_t seq, GpuTimelineEntry *out); +const char *gpu_timeline_kind_name(uint8_t kind); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/runtime/include/gte_nclip_stats.h b/runtime/include/gte_nclip_stats.h new file mode 100644 index 00000000..2812f5b6 --- /dev/null +++ b/runtime/include/gte_nclip_stats.h @@ -0,0 +1,60 @@ +#ifndef PSXRECOMP_GTE_NCLIP_STATS_H +#define PSXRECOMP_GTE_NCLIP_STATS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Precise-NCLIP observability (widescreen). While [widescreen] precise_nclip + * is active, every NCLIP also computes the backface sign from the UNCLAMPED + * projection (the PGXP sub-pixel shadow, validated against each SXY word; + * precise_nclip arms that transport by itself, independent of the visual + * corrections). Guest MAC0 stays native; only configured branch sites + * ([widescreen.cull] nclip_exact_sites) consume the precise sign. + * + * Always-on tables, keyed by the last guest store PC before each NCLIP (a + * producer locator inside the issuing emitter) and by branch PC (exact-site + * consumers), so a title can find which emitters + * lose triangles to the +/-1024 screen clamp before listing any site. */ + +typedef struct { + uint32_t func; /* locator: last guest store PC before the NCLIP */ + uint32_t nclips; /* NCLIPs with a precise sign available */ + uint32_t disagree; /* precise sign != native MAC0 sign */ + uint32_t saturated; /* any of the three SXY entries hit the clamp */ + uint32_t last_frame; +} GteNclipFuncStat; + +typedef struct { + uint32_t pc; /* configured exact-NCLIP branch PC */ + uint32_t evals; + uint32_t flips; /* branch decision changed by the precise sign */ + uint32_t fallbacks; /* no precise sign for this MAC0 -> native */ + uint32_t last_frame; +} GteNclipSiteStat; + +#define GTE_NCLIP_STAT_CAP 256 + +void gte_nclip_precise_stats(uint64_t *hits, uint64_t *fallbacks, + uint64_t *disagreements); +int gte_nclip_func_stats(GteNclipFuncStat *out, int max); +int gte_nclip_site_stats(GteNclipSiteStat *out, int max); +void gte_nclip_stats_reset(void); + +/* Branch consumer for exact-NCLIP sites: the sign (-1/0/1) the branch should + * test. The precise sign when it belongs to `native_mac0` (the value the + * guest just read from MAC0), else the native sign. */ +int32_t gte_nclip_exact_sign(int32_t native_mac0, uint32_t pc); + +/* Kill switch for the exact-site consumer (default on): off makes every exact + * site test the native sign, for same-build/same-state A/B and diagnosis. */ +void gte_nclip_exact_set_enabled(int on); +int gte_nclip_exact_enabled(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/runtime/include/host_keymap.h b/runtime/include/host_keymap.h index 32aa0b3a..0f17ac95 100644 --- a/runtime/include/host_keymap.h +++ b/runtime/include/host_keymap.h @@ -23,6 +23,7 @@ typedef enum HostKeymapAction { HOST_KEYMAP_SAVE_STATE_MENU, /* default F7 */ HOST_KEYMAP_SCANLINES, /* default F6 */ HOST_KEYMAP_TURBO_TOGGLE, /* default F9; latches Turbo until pressed again */ + HOST_KEYMAP_CAPTURE_MARK, /* default Ctrl+M; freezes the debug capture rings */ HOST_KEYMAP_ACTION_COUNT } HostKeymapAction; diff --git a/runtime/include/interrupts.h b/runtime/include/interrupts.h index c5efd2b5..948d03ae 100644 --- a/runtime/include/interrupts.h +++ b/runtime/include/interrupts.h @@ -8,6 +8,12 @@ extern "C" { #endif struct CPUState; +/* A host adapter that preserves registers outside guest RAM is not a + * serializable continuation. Defer snapshots until it returns; scheduler + * escapes discard the scope with the abandoned host stack. */ +void psx_snapshot_host_call_begin(void); +void psx_snapshot_host_call_end(void); +void psx_snapshot_host_call_reset(void); /* IRQ bit positions in I_STAT/I_MASK */ #define IRQ_VBLANK 0 diff --git a/runtime/include/mod_media.h b/runtime/include/mod_media.h new file mode 100644 index 00000000..dc551898 --- /dev/null +++ b/runtime/include/mod_media.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace PSXRecompV4 { + +/* Canonical bytes are an immutable, engine-owned snapshot. Plugins never + * reopen the selected file after verification. The PSX domain contains the + * first data track's 2048-byte sector payloads, excluding CD audio. */ +bool load_mod_media(const std::filesystem::path& path, + const std::string& format, uint64_t expected_size, + const std::string& expected_sha256, + std::shared_ptr>& bytes, + std::string* error = nullptr); + +} // namespace PSXRecompV4 diff --git a/runtime/include/mod_packages.h b/runtime/include/mod_packages.h index 788301c4..57ab8476 100644 --- a/runtime/include/mod_packages.h +++ b/runtime/include/mod_packages.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -224,6 +225,8 @@ struct ModResource { std::string file_description; std::string format = "file"; bool required = false; + uint64_t size = 0; + std::string sha256; }; struct ModDerivedDisc { @@ -352,6 +355,9 @@ struct ModResolution { std::string feature_id; std::string id; std::filesystem::path path; + std::string format; + std::string sha256; + std::shared_ptr> bytes; }; std::vector resources; struct Diagnostic { @@ -519,6 +525,8 @@ bool mod_register_builtin_resolver(const std::string& id, ModBuiltinResolver res void mod_clear_builtin_resolvers_for_tests(); bool mod_register_activation_plugin(const std::string& id, void (*callback)(void)); bool mod_register_vblank_plugin(const std::string& id, void (*callback)(void)); +bool mod_register_savestate_plugin(const std::string& id, void (*callback)(void)); +void mod_invoke_savestate_plugin(const std::string& id); /* A function-entry hook is a trusted implementation like the others: manifests * select it by id, and it runs only while a resolved plan activates that id. */ bool mod_register_function_entry_plugin(const std::string& id, uint32_t address, @@ -548,4 +556,25 @@ bool mod_register_instruction_plugin(const std::string& id, uint32_t address, std::vector mod_instruction_hooks(const std::string& id); void mod_clear_plugins_for_tests(); +/* Every id a trusted implementation registered (activation, vblank or + * function-entry), sorted. */ +std::vector mod_registered_plugin_ids(); + +/* Registered implementations that no manifest under `manifest_roots` declares + * as a [[plugin]] id. The resolved plan activates plugins by manifest id only, + * so such an implementation can never run: a hook registered under a sub-id + * ("x.widescreen.hud") is silently dead while its package ("x.widescreen") + * resolves cleanly. Roots are searched recursively for manifest.toml; pass the + * AUTHORED trees (title mods/preloaded, framework mods/builtin) so developer + * packages a release catalog strips still count as declarations. Manifests + * that fail to parse are reported through `errors`. */ +struct ModPluginAudit { + std::vector undeclared; /* registered, never declared */ + std::vector declared; /* every manifest [[plugin]] id */ + std::vector errors; + size_t manifests = 0; +}; +ModPluginAudit mod_audit_registered_plugins( + const std::vector& manifest_roots); + } // namespace PSXRecompV4 diff --git a/runtime/include/mod_plugins.h b/runtime/include/mod_plugins.h index 64db01ad..6815df63 100644 --- a/runtime/include/mod_plugins.h +++ b/runtime/include/mod_plugins.h @@ -27,6 +27,10 @@ int psx_mod_register_activation_plugin(const char* id, PSXModActivationCallback callback); int psx_mod_register_vblank_plugin(const char* id, PSXModVBlankCallback callback); +/* Runs after successful guest-state restore, before the restored PC resumes. + * Rebind host hooks here; do not advance guest gameplay as a VBlank would. */ +int psx_mod_register_savestate_plugin(const char* id, + PSXModActivationCallback callback); int psx_mod_register_function_entry_plugin( const char* id, uint32_t address, PSXModFunctionEntryCallback callback); /* Mod-defined guest functions have no original machine-code body. Addresses @@ -87,6 +91,9 @@ int psx_mod_game_started(void); * otherwise capacity must hold the entire file. Active sector mods apply. */ int psx_mod_read_disc_file(const char* path, void* buffer, uint32_t capacity, uint32_t* size); +/* Effective-disc LBA and byte size of a file (directory records patched by + * active mods apply, so a relocated file reports its new extent). */ +int psx_mod_disc_file_extent(const char* path, uint32_t* lba, uint32_t* size); /* Experimental retained-texture service (currently OpenGL only). IDs are * nonzero, stable game-owned identities, NOT GL names. Banks are immutable * 16-bit PS1 texels/indices with a caller-selected row pitch (width). @@ -124,6 +131,42 @@ void psx_mod_write_word(uint32_t address, uint32_t value); */ void psx_mod_write_code_word(uint32_t address, uint32_t value); +/* + * Services shared by seamless-loading adapters (resident disc data: see + * mod_resident.h). Emulation-thread callbacks only. + * + * Run a guest function to completion from a hook: a0..a3 and $ra are set, + * control returns when the guest reaches return_address, and the caller's + * GPRs, PC, HI and LO are restored. COP0, GTE and timing deadlines keep the + * callee's effects, as they would after an ordinary call. Snapshots wait + * until the call returns (the host stack holds the continuation). Returns v0. + */ +uint32_t psx_mod_call_guest(struct CPUState* cpu, uint32_t function, + uint32_t return_address, uint32_t a0, uint32_t a1, + uint32_t a2, uint32_t a3); +/* Deliver disc sectors into RAM exactly as a completed CD-ROM DMA would + * (overlay capture, executable-page invalidation, CD DMA log when lba >= 0). + * Word-aligned address and length. Returns 0 when the span leaves RAM. */ +int psx_mod_dma_write_ram(uint32_t address, const void* data, uint32_t bytes, + int lba); +/* Store bytes through the CPU store path (any alignment): for data the + * original code produces with CPU stores, e.g. a decompressor's output. */ +int psx_mod_host_write_ram(uint32_t address, const void* data, uint32_t bytes); +/* PsyQ SpuWrite by DMA, completed synchronously: transfer address, DMA-write + * transfer mode, the words through the SPU's DMA write path (address + * advance and sample-IRQ checks), then transfer mode stop when stop_after. + * spu_address 8-aligned, guest_source/bytes word aligned, at most 512 KiB; + * the transfer address wraps at the end of SPU RAM as on hardware. + * Library bookkeeping (transfer callbacks, busy flags) stays the caller's. */ +int psx_mod_spu_upload(uint32_t spu_address, uint32_t guest_source, + uint32_t bytes, int stop_after); +/* PsyQ LoadImage completed synchronously: texture-cache flush, GP0 A0h + * rectangle copy of w*h 16-bit pixels from guest RAM (provenance attributed + * per word), then GP1(04h) DMA direction CPU->GP0 for uploads the library + * would DMA (16 words or more). Caller drains earlier GPU work first. */ +int psx_mod_psyq_load_image(uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t guest_source); + /* * Allocate opt-in enhancement memory from Expansion 1. Until the first * allocation, the region remains hardware-faithful open bus. The returned @@ -276,6 +319,22 @@ int psx_mod_option_value(const char* package_id, const char* feature_id, */ int psx_mod_current_resource_path(const char* resource_id, char* out, uint32_t out_size); +/* Read-only canonical media verified by the engine for this plugin's owning + * package/feature. The pointer lives until the committed plan is replaced or + * cleared. Available only during that plugin's callbacks; returns 0 for an + * ordinary unverified resource, an inactive feature, or a different owner. */ +int psx_mod_current_resource_bytes(const char* resource_id, + const uint8_t** bytes, uint64_t* size); + +/* Append raw Mode-2 sectors (2336 bytes, starting with the XA subheader) + * from a verified resource owned by this activation callback. Returns their + * native CD LBA in first_lba. Registration is deterministic, append-only and + * rejected outside activation, for invalid ranges or beyond 99:59:74. + * The immutable committed snapshot remains mounted until the plan changes; + * no host path or donor data is saved into guest RAM/savestates. */ +int psx_mod_append_disc_extent(const char* resource_id, uint64_t byte_offset, + uint32_t sector_count, uint32_t* first_lba); + /* Display aspects have no framework ceiling: the native-wide surfaces size * themselves from the live width, and each title caps its own view at what * it has validated (fixed ratio, or the adaptive maximum below). Requests diff --git a/runtime/include/mod_resident.h b/runtime/include/mod_resident.h new file mode 100644 index 00000000..770b36fd --- /dev/null +++ b/runtime/include/mod_resident.h @@ -0,0 +1,114 @@ +#pragma once +/* + * Resident disc resources for title-owned seamless-loading adapters. + * + * A seamless loader serves a game's blocking loads from memory instead of the + * emulated drive, with the game's own code still consuming every byte. The + * title-independent half lives here: read the listed files from the effective + * (mod-patched) disc once, optionally derive data from them with the title's + * own decoders, verify everything with SHA-256, and keep a cache that is + * reused only by the exact same mod plan. The adapter keeps its loader hooks, + * its catalog and its decoders. + * + * Cache key: SHA-256 over the active mod plan fingerprint, the adapter's + * format id and the complete spec (paths, stock sizes/hashes, policy). Every + * blob is re-verified when a cache is loaded; a mismatch rebuilds it. Packs + * live in LOCALAPPDATA (or XDG_CACHE_HOME / ~/.cache)//seamless, or in + * PSX_RESIDENT_CACHE when set. Only files named <format>-*.pack are pruned. + * + * Call psx_resident_prepare() from an activation callback (it reads the disc + * through psx_mod_read_disc_file). Accessors are emulation-thread only. + * TCP: {"cmd":"resident_status"} lists every prepared pack. + */ +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + /* Serve mod-effective content. Files that differ from their stock hash + * are counted (psx_resident_file_stock() == 0), never replaced. */ + PSX_RESIDENT_ALLOW_MODIFIED = 0, + /* Fail preparation when any file with a stock hash differs: for adapters + * whose hooks depend on the original layout. The title then loads + * normally. */ + PSX_RESIDENT_REQUIRE_STOCK = 1 +}; + +typedef struct PSXResidentFile { + const char* path; /* ISO 9660 path, e.g. "CD/TOMBA2.IMG" */ + uint32_t stock_size; /* original byte size; 0 = not catalogued */ + const char* stock_sha256; /* lowercase hex over the zero-padded sectors of + * the original file; NULL = not catalogued */ +} PSXResidentFile; + +typedef struct PSXResidentSink PSXResidentSink; + +/* Store one derived blob (decoded asset, table, ...) for source file `file`. + * `tag` and `meta` are the adapter's own; blobs are kept in emission order and + * identical bytes are stored once. Returns 0 on failure (preparation fails). */ +int psx_resident_emit(PSXResidentSink* sink, uint32_t file, uint32_t tag, + const uint32_t meta[4], const void* bytes, uint32_t size); + +/* Called once per file during preparation, in spec order, with the file's + * sector-padded effective content. `stock` is 1 when it matched its stock + * hash. Return 0 to fail preparation (e.g. a stock decode mismatch). */ +typedef int (*PSXResidentDeriveFn)(PSXResidentSink* sink, uint32_t file, + const uint8_t* data, uint32_t size, + int stock, void* user); + +typedef struct PSXResidentSpec { + uint32_t struct_size; /* sizeof(PSXResidentSpec) */ + const char* title; /* cache folder, e.g. "MegaManX6Recomp" */ + const char* format; /* pack id; change it whenever the derived + * data's meaning changes */ + const PSXResidentFile* files; + uint32_t file_count; + uint32_t policy; /* PSX_RESIDENT_ALLOW_MODIFIED / _REQUIRE_STOCK */ + uint32_t max_file_bytes; /* 0 = a full 80-minute CD */ + PSXResidentDeriveFn derive; /* optional */ + void* derive_user; + uint32_t keep_packs; /* packs of this format kept besides the + * active one; 0 = 3 */ +} PSXResidentSpec; + +typedef struct PSXResidentPack PSXResidentPack; + +/* Load (verified) or build the pack. NULL on failure; the reason is kept for + * resident_status and the resident.prepare_failed mod counter is bumped. A + * later prepare for the same title and format releases the earlier pack. */ +const PSXResidentPack* psx_resident_prepare(const PSXResidentSpec* spec); + +uint32_t psx_resident_file_count(const PSXResidentPack* pack); +/* Sector-padded effective bytes. `size` receives the file size, `padded` the + * padded length (both optional). NULL for an invalid index. */ +const uint8_t* psx_resident_file(const PSXResidentPack* pack, uint32_t file, + uint32_t* size, uint32_t* padded); +/* Effective-disc LBA of the file's first sector (relocations by mods apply). */ +uint32_t psx_resident_file_lba(const PSXResidentPack* pack, uint32_t file); +int psx_resident_file_stock(const PSXResidentPack* pack, uint32_t file); +uint32_t psx_resident_modified_files(const PSXResidentPack* pack); +/* `bytes` starting at effective LBA `lba`, entirely within one file's padded + * content; NULL otherwise. `file` (optional) receives the file index. */ +const uint8_t* psx_resident_find_lba(const PSXResidentPack* pack, uint32_t lba, + uint32_t bytes, uint32_t* file); + +uint32_t psx_resident_derived_count(const PSXResidentPack* pack); +/* Derived blob `index` in emission order. Optional out-params. */ +const uint8_t* psx_resident_derived(const PSXResidentPack* pack, uint32_t index, + uint32_t* file, uint32_t* tag, + uint32_t meta[4], uint32_t* size); + +/* Lowercase hex SHA-256 of the guest bytes in [lo, hi) of each range, hashed + * in order, compared with `sha256`. Guards an adapter's code contract. */ +typedef struct PSXResidentRange { uint32_t lo, hi; } PSXResidentRange; +int psx_resident_guest_ranges_match(const PSXResidentRange* ranges, + uint32_t count, const char* sha256); + +/* Debug server: JSON array describing every prepared pack. */ +int psx_resident_status_json(char* out, uint32_t capacity); + +#ifdef __cplusplus +} +#endif diff --git a/runtime/include/mod_runtime.h b/runtime/include/mod_runtime.h index d8d48306..c350363b 100644 --- a/runtime/include/mod_runtime.h +++ b/runtime/include/mod_runtime.h @@ -5,6 +5,7 @@ #ifdef __cplusplus #include <filesystem> #include <string> +#include <vector> #if defined(RECOMP_LAUNCHER) #include "recomp_launcher.h" #endif @@ -24,6 +25,11 @@ bool mod_runtime_commit(const std::filesystem::path& disc_path = {}, bool mod_runtime_clear_for_netplay(std::string* error = nullptr); const std::string& mod_runtime_fingerprint(); const std::filesystem::path& mod_runtime_effective_disc_path(); +/* Read an effective-disc file as whole sectors (true end-of-file tail bytes + * included). max_bytes = 0 allows a full CD. Emulation-thread only. */ +bool mod_runtime_read_disc_file_sectors(const std::string& path, uint32_t max_bytes, + std::vector<uint8_t>& padded, uint32_t& lba, + uint32_t& size, std::string* error = nullptr); #if defined(RECOMP_LAUNCHER) const ::RecompLauncherCModProvider* mod_runtime_launcher_provider(); @@ -61,6 +67,10 @@ void mod_runtime_function_entry_context_restore(const ModFunctionEntryContext *i void mod_runtime_patch_disc_sector(uint32_t lba, int raw_sector, uint8_t* bytes, uint32_t size); void mod_runtime_enable_disc_patches(void); +int mod_runtime_read_disc_extent(uint32_t lba, int raw_sector, + uint8_t* bytes, uint32_t size); +uint32_t mod_runtime_disc_extent_start(void); +uint32_t mod_runtime_disc_sector_count(uint32_t base_count); #ifdef __cplusplus } diff --git a/runtime/include/overlay_api.h b/runtime/include/overlay_api.h index 91fdb1d9..fca6c108 100644 --- a/runtime/include/overlay_api.h +++ b/runtime/include/overlay_api.h @@ -114,11 +114,18 @@ * (cpu_state.h maps the name in PSX_OVERLAY_DLL_BUILD). */ /* v25: function-entry callbacks may return an opt-in filter result while * retaining the v24 last_store_pc pointer. */ -/* v26: guarded packed-coordinate rejection callback, preserving the selected - * rejection axes while the native-wide renderer clips horizontal margins. */ -/* v27: full-word-bound native-wide winding branch callback. */ -/* v28: guarded instruction callbacks and scoped guest-function completion. */ -#define PSX_OVERLAY_ABI_VERSION 28 +/* Master line: + * v26: guarded packed-coordinate rejection callback, preserving the selected + * rejection axes while the native-wide renderer clips horizontal margins. + * v27: full-word-bound native-wide winding branch callback. + * v28: guarded instruction callbacks and scoped guest-function completion. + * release/native-rendering-20261003 line (independently numbered v26..v29): + * ws_cull_scale and gte_nclip_exact_sign forwarders, completion-returning + * entry hooks, guarded pre-instruction callback. + * v30: the two lines merged. OverlayCallbacks keeps the master layout, which + * already holds every release-line callback; shards built against either + * v28 or v29 are rejected and recompiled. */ +#define PSX_OVERLAY_ABI_VERSION 30 /* Process-lifetime overlay candidate capacity. Every accepted manifest F * record consumes one slot, even when another DLL carries an identical @@ -185,8 +192,14 @@ * so packaged pairs cannot be hidden by an older user cache on first boot. */ /* 13: merge adaptive backdrop v12: independent quotient consumers, proven * copied/biased camera inputs, and two biased bounds for terrain strips. */ -/* 14: guarded saturation-aware NCLIP branch consumers and ABI v27 forwarding. */ -#define PSX_OVERLAY_CODEGEN_VER 15 +/* 14 (master): guarded saturation-aware NCLIP branch consumers and ABI v27 + * forwarding. 15 (master): see history. + * 14-16 (release/native-rendering-20261003): [[widescreen.cull.scale]] + * register-register frustum-edge emit; exact/keep NCLIP sites for every + * sign-branch shape. + * 17: the two lines merged (master exact-NCLIP emission, release keep-site + * shapes and cull-scale sites). */ +#define PSX_OVERLAY_CODEGEN_VER 17 /* Auto codegen hash (generated by hash_codegen.cmake from the recompiler codegen * sources). Folded into the cache PATH next to cg<N> (gcc/<arch-abi>/cg<N>_<hash>/) diff --git a/runtime/include/overlay_dispatch_preamble.c.inc b/runtime/include/overlay_dispatch_preamble.c.inc index 3ea2a7e0..9a0dca67 100644 --- a/runtime/include/overlay_dispatch_preamble.c.inc +++ b/runtime/include/overlay_dispatch_preamble.c.inc @@ -296,6 +296,16 @@ uint32_t psx_ws_angle_widen(uint32_t vanilla) { ? g_cbs.ws_angle_widen(vanilla) : vanilla; } +int32_t psx_ws_cull_scale(int32_t bound, int32_t half_extent) { + return g_cbs.ws_cull_scale + ? g_cbs.ws_cull_scale(bound, half_extent) + : bound; +} +int32_t gte_nclip_exact_sign(int32_t native_mac0, uint32_t pc) { + return g_cbs.nclip_exact_sign + ? g_cbs.nclip_exact_sign(native_mac0, pc) + : (native_mac0 < 0 ? -1 : (native_mac0 > 0 ? 1 : 0)); +} /* Sub-pixel GTE precision-store tracker (ABI v14). The emitter emits a direct * gte_precision_store_word() call for every swc2 (GTE store-word), including in * overlay-resident code, so the DLL must define it or the shard fails to link diff --git a/runtime/include/pgxp.h b/runtime/include/pgxp.h index d29bd476..6c06b9c8 100644 --- a/runtime/include/pgxp.h +++ b/runtime/include/pgxp.h @@ -253,6 +253,16 @@ typedef struct PGXPStats { uint64_t nclip_precise; uint64_t nclip_disagree; uint64_t nclip_corrected; + /* pgxp_load_precise_word outcomes (perspective texturing, per vertex): + * which check refused the depth. untracked = no shadow for that address in + * this generation; mismatch = shadow describes a different word; partial = + * only one half carries a projection; no_z = projection without depth. */ + uint64_t word_lookups; + uint64_t word_hit; + uint64_t word_untracked; + uint64_t word_mismatch; + uint64_t word_partial; + uint64_t word_no_z; } PGXPStats; void pgxp_get_stats(PGXPStats *out); @@ -282,6 +292,34 @@ int pgxp_load_precise_word(uint32_t addr, uint32_t packed, void pgxp_checkpoint_begin(void); void pgxp_checkpoint_rollback(void); +/* Refused precise-word lookups, newest at (seq - 1) % cap (TCP pgxp_miss_ring). */ +enum { + PGXP_MISS_UNTRACKED = 1, + PGXP_MISS_MISMATCH = 2, + PGXP_MISS_PARTIAL = 3, + PGXP_MISS_NO_Z = 4 +}; +#define PGXP_MISS_RING_CAP 8192u +typedef struct PGXPWordMiss { + uint64_t seq; + uint32_t addr; /* packet word address (canonical RAM offset) */ + uint32_t packet; /* the word the GPU consumed */ + uint32_t shadow_value; /* the word the shadow describes */ + uint8_t shadow_flags; /* 1 = X, 2 = Y, 4 = Z */ + uint8_t live; /* shadow belongs to the current generation */ + uint8_t reason; /* PGXP_MISS_* */ +} PGXPWordMiss; +/* Returns the total number of misses ever recorded. */ +uint64_t pgxp_word_miss_ring(const PGXPWordMiss **ring, uint32_t *cap); + +/* Debug read of one shadow slot (TCP pgxp_shadow). `space`: 0 = guest + * address (RAM / scratchpad), 1 = GPR index (32 = HI, 33 = LO), 2 = GTE data + * register. Returns 0 when the slot does not exist; *live says whether it + * belongs to the current generation. */ +int pgxp_debug_shadow(int space, uint32_t key, int *live, uint32_t *value, + uint32_t *flags, int32_t *x16, int32_t *y16, + uint16_t *z); + /* --- test accessors (always compiled; trivial) ---------------------------- */ /* index 0..3 selects the SXY0..SXYP register shadow (GTE data regs 12..15). */ diff --git a/runtime/include/present_image_ring.h b/runtime/include/present_image_ring.h new file mode 100644 index 00000000..33746b48 --- /dev/null +++ b/runtime/include/present_image_ring.h @@ -0,0 +1,55 @@ +#ifndef PSXRECOMP_PRESENT_IMAGE_RING_H +#define PSXRECOMP_PRESENT_IMAGE_RING_H + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Presented-image ring: a small copy of EVERY frame actually shown in the + * window (after compositing, letterbox included, before host OSD), for about + * ten seconds. Complements the display ring (canonical VRAM, ~1 s) for + * glitches that live only in presentation — native-wide compositing, frame + * interpolation, held frames — and that last a frame or two, so a single + * screenshot cannot catch them. Always-on in debug-tools builds + * (PSX_PRESENT_IMAGE_RING=0 disables); frozen by the capture mark. + * + * Entries are RGB565, PRESENT_IMAGE_RING_H rows tall, width following the + * window aspect (capped at PRESENT_IMAGE_RING_MAX_W). */ +#define PRESENT_IMAGE_RING_CAP 600 +#define PRESENT_IMAGE_RING_H 120 +#define PRESENT_IMAGE_RING_MAX_W 720 + +/* Thumbnail width for a window of ww x wh pixels. */ +int present_image_ring_thumb_w(int ww, int wh); + +/* 1 while capture is enabled and not frozen (callers skip the downscale). */ +int present_image_ring_accepting(void); + +/* Record one presented frame. `rgba` is 8-bit R,G,B,(A) per pixel, `pitch` + * bytes per row; `bottom_up` = rows stored bottom-first (GL readback). The + * image must already be w x PRESENT_IMAGE_RING_H. */ +void present_image_ring_push(uint32_t frame, const uint8_t *rgba, int w, + int pitch, int bottom_up); + +/* Box-downscale an ARGB8888 CPU present buffer (0xAARRGGBB, sw x sh) into a + * thumbnail and record it. Software / CPU-present path. */ +void present_image_ring_push_argb(uint32_t frame, const uint32_t *argb, + int sw, int sh, int src_pitch_px); + +void present_image_ring_set_frozen(int frozen); +int present_image_ring_frozen(void); + +/* Oldest/newest recorded frame numbers and how many entries are valid. */ +void present_image_ring_span(uint32_t *oldest, uint32_t *newest, int *count); + +/* Copy entry for `frame` as RGB888 top-down into a malloc'd buffer the + * caller frees. Returns 0 if the frame is not in the ring. */ +int present_image_ring_get_rgb(uint32_t frame, uint8_t **rgb, int *w, int *h); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/runtime/include/savestate.h b/runtime/include/savestate.h index 48d58e03..0a4d9505 100644 --- a/runtime/include/savestate.h +++ b/runtime/include/savestate.h @@ -140,6 +140,9 @@ void psx_frontend_on_rb_snap_loaded(void); /* Frontend hook (main.cpp): host OSD toast after a user save/load settles. * is_load: 0 = save, 1 = load. slot is 0-based. ok: 1 on success. */ void psx_frontend_on_savestate_notify(int is_load, int slot, int ok); +/* Frontend hook (main.cpp): a user save/load was refused before it was staged + * (so no notify follows). `reason` is short, plain text for the OSD. */ +void psx_frontend_on_savestate_refused(int is_load, int slot, const char *reason); /* Called every block from psx_check_interrupts (in_exception == 0). If a save is * pending, serialize with cpu->pc = resume_pc; if a load is pending, restore and diff --git a/runtime/include/ws_hud_anchor.h b/runtime/include/ws_hud_anchor.h index 2d035cae..40480f23 100644 --- a/runtime/include/ws_hud_anchor.h +++ b/runtime/include/ws_hud_anchor.h @@ -78,14 +78,23 @@ static inline void ws_hud_anchor_insert(WsHudAnchorTag *tags, uint32_t count, tags[victim].guard = *guard; } -static inline int ws_hud_anchor_lookup(const WsHudAnchorTag *tags, - uint32_t count, - uint32_t command_addr, - const uint32_t *words, - uint32_t word_count, - uint32_t frame, - int *out_anchor) { - if (!tags || !count || !words) return 0; +/* Lookup outcome, so callers can keep always-on counters that say WHY a tagged + * primitive was or was not honoured (absent, expired, or packet rewritten). */ +enum { + WS_HUD_ANCHOR_HIT = 1, + WS_HUD_ANCHOR_ABSENT = 0, + WS_HUD_ANCHOR_STALE = -1, + WS_HUD_ANCHOR_GUARD_MISMATCH = -2 +}; + +static inline int ws_hud_anchor_lookup_result(const WsHudAnchorTag *tags, + uint32_t count, + uint32_t command_addr, + const uint32_t *words, + uint32_t word_count, + uint32_t frame, + int *out_anchor) { + if (!tags || !count || !words) return WS_HUD_ANCHOR_ABSENT; uint32_t idx = ws_hud_anchor_slot(command_addr) & (count - 1u); for (uint32_t i = 0; i < WS_HUD_ANCHOR_PROBES && i < count; i++) { const WsHudAnchorTag *tag = &tags[(idx + i) & (count - 1u)]; @@ -93,13 +102,25 @@ static inline int ws_hud_anchor_lookup(const WsHudAnchorTag *tags, continue; if (tag->frame > frame || frame - tag->frame > WS_HUD_ANCHOR_FRESH_FRAMES) - return 0; + return WS_HUD_ANCHOR_STALE; if (!ws_prepass_packet_matches(&tag->guard, words, word_count)) - return 0; + return WS_HUD_ANCHOR_GUARD_MISMATCH; if (out_anchor) *out_anchor = tag->anchor; - return 1; + return WS_HUD_ANCHOR_HIT; } - return 0; + return WS_HUD_ANCHOR_ABSENT; +} + +static inline int ws_hud_anchor_lookup(const WsHudAnchorTag *tags, + uint32_t count, + uint32_t command_addr, + const uint32_t *words, + uint32_t word_count, + uint32_t frame, + int *out_anchor) { + return ws_hud_anchor_lookup_result(tags, count, command_addr, words, + word_count, frame, out_anchor) == + WS_HUD_ANCHOR_HIT; } #ifdef __cplusplus diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake index 6df1d524..715831fa 100644 --- a/runtime/runtime.cmake +++ b/runtime/runtime.cmake @@ -1,4 +1,4 @@ -# Shared psxrecomp runtime CMake helpers. +# Shared psxrecomp runtime CMake helpers. # # Include this from either the framework runtime build or a sibling game # project. SDL3 is the default; set -DPSX_SDL_BACKEND=SDL2 for the legacy @@ -420,6 +420,8 @@ set(PSXRECOMP_RUNTIME_SOURCES ${PSXRECOMP_ROOT}/runtime/src/psx_icache.c ${PSXRECOMP_ROOT}/runtime/src/starvation_ring.c ${PSXRECOMP_ROOT}/runtime/src/latency_ring.c + ${PSXRECOMP_ROOT}/runtime/src/present_image_ring.c + ${PSXRECOMP_ROOT}/runtime/src/gpu_timeline.c ${PSXRECOMP_ROOT}/runtime/src/data_shards.c ${PSXRECOMP_ROOT}/runtime/src/load_accel.c ${PSXRECOMP_ROOT}/runtime/src/card_read_summary.c @@ -438,7 +440,10 @@ set(PSXRECOMP_RUNTIME_SOURCES ${PSXRECOMP_ROOT}/runtime/src/mod_builtin_bezel.c ${PSXRECOMP_ROOT}/runtime/src/mod_builtin_ram.c ${PSXRECOMP_ROOT}/runtime/src/mod_packages.cpp + ${PSXRECOMP_ROOT}/runtime/src/mod_media.cpp ${PSXRECOMP_ROOT}/runtime/src/mod_runtime.cpp + ${PSXRECOMP_ROOT}/runtime/src/mod_resident.cpp + ${PSXRECOMP_ROOT}/runtime/src/mod_guest_services.c ${PSXRECOMP_ROOT}/runtime/src/mod_texture_banks.c ${PSXRECOMP_ROOT}/runtime/src/psx_keybinds.c ${PSXRECOMP_ROOT}/runtime/src/psx_bios_backend.c @@ -1077,6 +1082,15 @@ function(_psxrt_finalize_mod_catalog_guards) VERBATIM) add_dependencies("${_guard_target}" "${_stage_target}") add_dependencies(${_t} "${_guard_target}") + # Siblings can share one output directory (above; and every + # PSX_PGXP_VARIANT clone sits beside its base). Each staging step + # wipes and rewrites mods/bundled, so under a parallel build one + # sibling's wipe raced the other's staging or check. Stage siblings + # one after another: each after the previous one staged and verified. + if(_i GREATER 0) + add_dependencies("${_stage_target}" "${_prev_guard_target}") + endif() + set(_prev_guard_target "${_guard_target}") endforeach() # One ctest, registered against the first staging target's output @@ -1307,6 +1321,25 @@ function(_psxrt_stage_mod_catalog target preloaded_dir) ${_readme_copy} COMMENT "Staging mod catalog for ${target} (${_n_ids} package(s) -> mods/bundled)" VERBATIM) + # Every trusted plugin the executable registers must be selectable by an + # authored manifest [[plugin]] id; the resolved plan activates plugins by + # manifest id only, so an undeclared id (typically a hook registered under + # a sub-id of its package's plugin) is dead code that fails silently. + # Audits the AUTHORED trees, so developer packages a release catalog + # strips still count as declarations. + if(BUILD_TESTING) + set(_audit_roots "${PSXRECOMP_ROOT}/mods/builtin") + if(NOT preloaded_dir STREQUAL "" AND NOT preloaded_dir STREQUAL "NONE" + AND IS_DIRECTORY "${preloaded_dir}") + list(APPEND _audit_roots "${preloaded_dir}") + endif() + get_target_property(_extra_roots ${target} PSXRT_AUDIT_MOD_DIRS) + if(_extra_roots) + list(APPEND _audit_roots ${_extra_roots}) + endif() + add_test(NAME psx_mod_plugin_audit_${target} + COMMAND $<TARGET_FILE:${target}> --audit-mod-plugins ${_audit_roots}) + endif() set_property(GLOBAL APPEND PROPERTY PSXRECOMP_MOD_CATALOG_TARGETS "${target}") set_property(GLOBAL APPEND PROPERTY PSXRECOMP_MOD_CATALOG_MANIFESTS "${_manifest}") @@ -1368,7 +1401,13 @@ function(psxrecomp_add_runtime_target target) # mods/builtin/packages) this target does not ship. They are left out of # <exe-dir>/mods/bundled entirely -- absent, not hidden -- so no packager # can ship them either. An id that is not a builtin fails configure. - set(multiValueArgs EXTRAS_SOURCES GAME_GENERATED_FULL_C EXCLUDE_BUILTIN_MODS) + # + # AUDIT_MOD_DIRS names further authored package trees (manifest.toml files + # are found recursively) that declare plugins this executable registers but + # no bundled catalog ships, e.g. development-only packages. They are + # audited, never staged. + set(multiValueArgs EXTRAS_SOURCES GAME_GENERATED_FULL_C EXCLUDE_BUILTIN_MODS + AUDIT_MOD_DIRS) cmake_parse_arguments(PSXRT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) # DEBUG_PORT and WINDOW_TITLE were previously required cmake-time defaults. @@ -1974,7 +2013,14 @@ function(psxrecomp_add_runtime_target target) # letting it stage would have it wipe and re-stage the runtime's catalog # with only the framework half. if(NOT PSXRT_COSIM) - _psxrt_stage_mod_catalog("${target}" "${PSXRT_PRELOADED_MODS_DIR}" + foreach(_audit_dir IN LISTS PSXRT_AUDIT_MOD_DIRS) + if(NOT IS_DIRECTORY "${_audit_dir}") + message(FATAL_ERROR + "AUDIT_MOD_DIRS for target '${target}' is not a directory: ${_audit_dir}") + endif() + endforeach() + set_property(TARGET ${target} PROPERTY PSXRT_AUDIT_MOD_DIRS "${PSXRT_AUDIT_MOD_DIRS}") + _psxrt_stage_mod_catalog("${target}" "${PSXRT_PRELOADED_MODS_DIR}" ${PSXRT_EXCLUDE_BUILTIN_MODS}) endif() endif() diff --git a/runtime/src/debug_server.c b/runtime/src/debug_server.c index 15002c07..c4ab3a40 100644 --- a/runtime/src/debug_server.c +++ b/runtime/src/debug_server.c @@ -31,6 +31,9 @@ #include "gpu.h" #include "gpu_render.h" /* gr_scale + gr_render_display_hires (screenshot_hires) */ #include "present_ring.h" +#include "gpu_timeline.h" +#include "gte_nclip_stats.h" +#include "present_image_ring.h" #include "load_transition_ring.h" #include "cdrom.h" #include "sio.h" @@ -5293,7 +5296,9 @@ static void handle_geom_correction(int id, const char *json) "\"tri_precise\":%llu,\"tri_mixed\":%llu,\"tri_native\":%llu," "\"rect_bypass\":%llu,\"rect_partial\":%llu," "\"nclip_precise\":%llu,\"nclip_disagree\":%llu," - "\"nclip_corrected\":%llu}}", + "\"nclip_corrected\":%llu," + "\"word\":{\"lookups\":%llu,\"hit\":%llu,\"untracked\":%llu," + "\"mismatch\":%llu,\"partial\":%llu,\"no_z\":%llu}}}", id, gte_geometry_correction_enabled(), gpu_texture_correction_enabled(), @@ -5325,7 +5330,81 @@ static void handle_geom_correction(int id, const char *json) (unsigned long long)ps.rect_partial, (unsigned long long)ps.nclip_precise, (unsigned long long)ps.nclip_disagree, - (unsigned long long)ps.nclip_corrected); + (unsigned long long)ps.nclip_corrected, + (unsigned long long)ps.word_lookups, + (unsigned long long)ps.word_hit, + (unsigned long long)ps.word_untracked, + (unsigned long long)ps.word_mismatch, + (unsigned long long)ps.word_partial, + (unsigned long long)ps.word_no_z); +} + +/* pgxp_shadow — read PGXP shadow slots: {"cmd":"pgxp_shadow","addr":A, + * "count":N} walks N guest words from A (RAM / scratchpad); "space":"gpr" or + * "gte" with "index"/"count" reads register shadows instead. Each slot: the + * word it describes, whether it is live this generation, the per-half/depth + * flags (1 = X, 2 = Y, 4 = Z) and the 16.16 positions. Pair it with read_ram + * to see whether a packet word still matches its shadow. */ +static void handle_pgxp_shadow(int id, const char *json) +{ + char sp[16] = ""; + json_get_str(json, "space", sp, sizeof sp); + int space = strcmp(sp, "gpr") == 0 ? 1 : strcmp(sp, "gte") == 0 ? 2 : 0; + char addr_str[32] = ""; + uint32_t key = space ? (uint32_t)json_get_int(json, "index", 0) + : (json_get_str(json, "addr", addr_str, sizeof addr_str) + ? hex_to_u32(addr_str) : 0u); + int count = json_get_int(json, "count", 1); + if (count < 1) count = 1; + if (count > 256) count = 256; + static char buf[256 * 112 + 128]; + size_t n = (size_t)snprintf(buf, sizeof buf, "{\"id\":%d,\"ok\":true,\"slots\":[", id); + for (int i = 0; i < count && n < sizeof buf - 128; i++) { + uint32_t k = space ? key + (uint32_t)i : key + (uint32_t)i * 4u; + int live = 0; uint32_t value = 0, flags = 0; int32_t x16 = 0, y16 = 0; uint16_t z = 0; + if (!pgxp_debug_shadow(space, k, &live, &value, &flags, &x16, &y16, &z)) + break; + n += (size_t)snprintf(buf + n, sizeof buf - n, + "%s{\"key\":\"0x%08X\",\"live\":%d,\"value\":\"0x%08X\"," + "\"flags\":%u,\"x16\":%d,\"y16\":%d,\"z\":%u}", + i ? "," : "", k, live, value, flags, x16, y16, z); + } + snprintf(buf + n, sizeof buf - n, "]}"); + send_fmt("%s", buf); +} + +/* pgxp_miss_ring — the newest refused perspective-depth lookups (always-on + * ring, PGXP_MISS_RING_CAP deep): {"cmd":"pgxp_miss_ring","count":N}. Each + * entry: packet word address (canonical RAM offset), the word the GPU + * consumed, the word/flags the shadow held, and the reason (untracked, + * mismatch, partial, no_z). Join addr with wtrace_dump to name the writer. */ +static void handle_pgxp_miss_ring(int id, const char *json) +{ + static const char *const reasons[] = { "?", "untracked", "mismatch", + "partial", "no_z" }; + const PGXPWordMiss *ring; uint32_t cap; + uint64_t total = pgxp_word_miss_ring(&ring, &cap); + int count = json_get_int(json, "count", 256); + uint64_t avail = total < cap ? total : cap; + if (count < 0) count = 0; + if ((uint64_t)count > avail) count = (int)avail; + size_t sz = (size_t)count * 160u + 256u; + char *buf = (char *)malloc(sz); + if (!buf) { send_err(id, "oom"); return; } + size_t n = (size_t)snprintf(buf, sz, "{\"id\":%d,\"ok\":true,\"total\":%llu,\"entries\":[", + id, (unsigned long long)total); + for (int i = 0; i < count; i++) { + const PGXPWordMiss *m = &ring[(total - (uint64_t)count + (uint64_t)i) % cap]; + n += (size_t)snprintf(buf + n, sz - n, + "%s{\"seq\":%llu,\"addr\":\"0x%08X\",\"packet\":\"0x%08X\"," + "\"shadow\":\"0x%08X\",\"flags\":%u,\"live\":%u,\"reason\":\"%s\"}", + i ? "," : "", (unsigned long long)m->seq, m->addr, m->packet, + m->shadow_value, m->shadow_flags, m->live, + reasons[m->reason < 5 ? m->reason : 0]); + } + snprintf(buf + n, sz - n, "]}"); + send_fmt("%s", buf); + free(buf); } /* pgxp — live-tune the value-propagation engine for one-toggle isolation runs @@ -7872,6 +7951,33 @@ static void handle_mod_counters(int id, const char *json) free(buf); } +/* Resident disc packs prepared by seamless-loading adapters (mod_resident.h): + * {"cmd":"resident_status"} + * -> packs: [{title, format, state, error, path, files, modified, derived, + * blobs, bytes, ms}] */ +static void handle_resident_status(int id, const char *json) +{ + extern int psx_resident_status_json(char *out, uint32_t capacity); + (void)json; + for (uint32_t cap = 4096u; cap <= (1u << 22); cap *= 4u) { + char *packs = (char *)malloc(cap); + if (!packs) break; + if (psx_resident_status_json(packs, cap)) { + char *buf = (char *)malloc(cap + 64u); + if (buf) { + snprintf(buf, cap + 64u, "{\"id\":%d,\"ok\":true,\"packs\":%s}", id, packs); + debug_server_send_line(buf); + free(buf); + } + free(packs); + if (!buf) send_err(id, "alloc failed"); + return; + } + free(packs); + } + send_err(id, "resident status too large"); +} + static void handle_ws_hud_mode(int id, const char *json) { int v = json_get_int(json, "tag_rects", -1); @@ -7880,6 +7986,33 @@ static void handle_ws_hud_mode(int id, const char *json) send_fmt("{\"id\":%d,\"ok\":true,\"tag_rects\":%d}", id, v ? 1 : 0); } +/* Explicit HUD-anchor / background tag pipeline counters (always on): + * {"cmd":"ws_tag_stats"} + * -> hud / background: tag_calls, tag_rejected, hit, stale, guard_mismatch, + * last_tag_frame, last_hit_frame. A title plugin that tags but never hits + * is either tagging the wrong address or rewriting packets after tagging. */ +static void handle_ws_tag_stats(int id, const char *json) +{ + (void)json; + GpuWsTagStats hud, bg; + gpu_ws_get_tag_stats(&hud, &bg); + const GpuWsTagStats *s[2] = { &hud, &bg }; + char part[2][256]; + for (int i = 0; i < 2; i++) + snprintf(part[i], sizeof part[i], + "{\"tag_calls\":%llu,\"tag_rejected\":%llu,\"hit\":%llu," + "\"stale\":%llu,\"guard_mismatch\":%llu," + "\"last_tag_frame\":%u,\"last_hit_frame\":%u}", + (unsigned long long)s[i]->tag_calls, + (unsigned long long)s[i]->tag_rejected, + (unsigned long long)s[i]->hit, + (unsigned long long)s[i]->stale, + (unsigned long long)s[i]->guard_mismatch, + s[i]->last_tag_frame, s[i]->last_hit_frame); + send_fmt("{\"id\":%d,\"ok\":true,\"frame\":%llu,\"hud\":%s,\"background\":%s}", + id, (unsigned long long)s_frame_count, part[0], part[1]); +} + /* Kernel-image bless state: {"cmd":"kernel_bless"} -> * entries/clean/mismatch/native_hits/verifies/invalidations, plus the * declared kernel patch ranges and the segments they made the verifier @@ -8194,11 +8327,18 @@ static void handle_display_aspect(int id, const char *json) { int num=json_get_int(json,"num",-1), den=json_get_int(json,"den",-1); int adaptive=json_get_int(json,"adaptive",0); if (!psx_debug_display_aspect(num,den,adaptive)) { - send_err(id,"invalid display aspect (4:3 through 32:9)");return; + send_err(id,"invalid display aspect (4:3 or wider, terms 1..99)");return; } send_fmt("{\"id\":%d,\"ok\":true,\"num\":%d,\"den\":%d,\"adaptive\":%d}",id,num,den,adaptive!=0); } +extern int psx_debug_window_size(int w, int h); +static void handle_window_size(int id, const char *json) { + int w = json_get_int(json, "w", -1), h = json_get_int(json, "h", -1); + if (!psx_debug_window_size(w, h)) { send_err(id, "need a window and 64<=w,h<=16384"); return; } + send_fmt("{\"id\":%d,\"ok\":true,\"w\":%d,\"h\":%d}", id, w, h); +} + /* Live native-wide vs squash toggle (A/B): ws_nw on=<0|1> re-engages the wide * path in the chosen mode without a relaunch. 2 = native-wide, 1 = squash. */ extern void psx_ws_set_native_wide(int on); @@ -8920,6 +9060,12 @@ typedef struct { uint16_t *vram; /* full 1024x512 */ } DispRingEntry; static PSX_BSS DispRingEntry s_disp_ring[DISP_RING_CAP]; +/* Capture mark state (debug_server_capture_mark / capture_mark). */ +static int s_capture_frozen = 0; +static uint64_t s_capture_mark_frame = 0; +static uint64_t s_capture_mark_count = 0; +static char s_capture_wide_path[512]; +static int s_capture_wide_ok = 0; static uint16_t *s_disp_ring_px = NULL; /* one block for all entries */ static void disp_ring_capture(void) @@ -8933,7 +9079,7 @@ static void disp_ring_capture(void) const char *e = getenv("PSX_DISPLAY_RING"); enabled = (!e || !*e || *e != '0') ? 1 : 0; } - if (!enabled) return; + if (!enabled || s_capture_frozen) return; if (!s_disp_ring_px) { size_t per = (size_t)DISP_RING_MAX_W * DISP_RING_MAX_H; size_t vram = (size_t)1024 * 512; @@ -8951,6 +9097,7 @@ static void disp_ring_capture(void) GpuDisplayInfo di; gpu_get_display_info(&di); if (di.disabled || di.width == 0 || di.height == 0) return; + gpu_timeline_note(GTL_DISP_CAPTURE, 0, di.display_x | (di.display_y << 16)); uint32_t w = di.width, h = di.height; if (w > DISP_RING_MAX_W) w = DISP_RING_MAX_W; if (h > DISP_RING_MAX_H) h = DISP_RING_MAX_H; @@ -9388,7 +9535,10 @@ static void handle_dump_buffer(int id, const char *json) * present path uses (gr_render_wide_display into a scratch buffer), so the dump * reflects the composited wide frame 1:1, orientation included. Errors if the * active backend has no wide compositor or native-wide isn't engaged. */ -static void handle_wide_shot(int id, const char *json) +/* Write the presented native-wide frame to `path`. Returns NULL on success + * (and the pixel size), or a static error string. Shared by wide_shot and + * the capture mark. */ +static const char *write_wide_png(const char *path, int *out_w, int *out_h) { extern int gr_wide_supported(void); extern int gr_scale(void); @@ -9397,33 +9547,28 @@ static void handle_wide_shot(int id, const char *json) extern void gl_renderer_sync_cpu(void); gl_renderer_sync_cpu(); /* no-op on SW / when no GL frame pending */ - if (!gr_wide_supported()) { send_err(id, "active backend has no wide compositor"); return; } + if (!gr_wide_supported()) return "active backend has no wide compositor"; int extra = ws_nw_extra(); - if (extra <= 0) { send_err(id, "native-wide not engaged (extra=0; need a wide game frame)"); return; } + if (extra <= 0) return "native-wide not engaged (extra=0; need a wide game frame)"; GpuDisplayInfo di; gpu_get_display_info(&di); - if (di.disabled || di.width == 0 || di.height == 0) { send_err(id, "display disabled"); return; } + if (di.disabled || di.width == 0 || di.height == 0) return "display disabled"; int scale = gr_scale(); if (scale < 1) scale = 1; int present_w = (int)di.width + extra; int W = present_w * scale, H = (int)di.height * scale; - char path[512]; - if (!json_get_str(json, "path", path, sizeof(path))) - strncpy(path, "psx_wide.png", sizeof(path) - 1); - path[sizeof(path) - 1] = '\0'; - uint32_t *buf = (uint32_t *)malloc((size_t)W * H * sizeof(uint32_t)); - if (!buf) { send_err(id, "alloc failed"); return; } + if (!buf) return "alloc failed"; int n = gr_render_wide_display(buf, W * (int)sizeof(uint32_t), (int)di.display_x, (int)di.display_y, (int)di.height); - if (n <= 0) { free(buf); send_err(id, "no wide surface for displayed buffer"); return; } + if (n <= 0) { free(buf); return "no wide surface for displayed buffer"; } /* ARGB8888 (0xAARRGGBB) -> RGB, written in the buffer's row order (so the * PNG shows exactly the present orientation — the point of this probe). */ uint8_t *rgb = (uint8_t *)malloc((size_t)W * H * 3); - if (!rgb) { free(buf); send_err(id, "alloc failed"); return; } + if (!rgb) { free(buf); return "alloc failed"; } for (int y = 0; y < H; y++) { for (int x = 0; x < W; x++) { uint32_t px = buf[(size_t)y * W + x]; @@ -9435,14 +9580,114 @@ static void handle_wide_shot(int id, const char *json) } free(buf); FILE *f = fopen(path, "wb"); - if (!f) { free(rgb); send_err(id, "cannot open file"); return; } + if (!f) { free(rgb); return "cannot open file"; } int ok = png_write_rgb(f, rgb, (uint32_t)W, (uint32_t)H); free(rgb); fclose(f); - if (!ok) { send_err(id, "png encode failed"); return; } + if (!ok) return "png encode failed"; + if (out_w) *out_w = W; + if (out_h) *out_h = H; + return NULL; +} + +static void handle_wide_shot(int id, const char *json) +{ + char path[512]; + if (!json_get_str(json, "path", path, sizeof(path))) + strncpy(path, "psx_wide.png", sizeof(path) - 1); + path[sizeof(path) - 1] = '\0'; + int W = 0, H = 0; + const char *err = write_wide_png(path, &W, &H); + if (err) { send_err(id, err); return; } send_fmt("{\"id\":%d,\"ok\":true,\"path\":\"%s\",\"width\":%d,\"height\":%d}", id, path, W, H); } +/* Operator capture mark. Runs on the present thread (hotkey handler), where + * the renderer's context is current. Freezes the display and GP0 rings so the + * frames and draw lists leading up to the mark survive until read, and saves + * the presented native-wide frame (the only record of the compositor output). + * A second mark while frozen is ignored; release with capture_mark op=release. */ +void debug_server_capture_mark(void) +{ + if (s_capture_frozen) return; + s_capture_mark_frame = s_frame_count; + s_capture_mark_count++; + snprintf(s_capture_wide_path, sizeof s_capture_wide_path, + "capture_mark_%llu_wide.png", (unsigned long long)s_frame_count); + s_capture_wide_ok = write_wide_png(s_capture_wide_path, NULL, NULL) == NULL; + s_capture_frozen = 1; + gpu_gp0_ring_set_frozen(1); + present_image_ring_set_frozen(1); + gpu_timeline_set_frozen(1); +} + +/* Presented-image ring (see present_image_ring.h): + * {"cmd":"present_image_ring_stats"} -> oldest, newest, count, frozen + * {"cmd":"present_image_ring_get","frame":N,"path":"x.png"} */ +static void handle_present_image_ring_stats(int id, const char *json) +{ + (void)json; + uint32_t lo = 0, hi = 0; int n = 0; + present_image_ring_span(&lo, &hi, &n); + send_fmt("{\"id\":%d,\"ok\":true,\"oldest\":%u,\"newest\":%u,\"count\":%d," + "\"frozen\":%d,\"capacity\":%d,\"height\":%d}", + id, lo, hi, n, present_image_ring_frozen(), + PRESENT_IMAGE_RING_CAP, PRESENT_IMAGE_RING_H); +} +static void handle_present_image_ring_get(int id, const char *json) +{ + int f = json_get_int(json, "frame", -1); + char path[512]; + if (f < 0 || !json_get_str(json, "path", path, sizeof path)) { + send_err(id, "need frame and path"); return; + } + uint8_t *rgb = NULL; int w = 0, h = 0; + if (!present_image_ring_get_rgb((uint32_t)f, &rgb, &w, &h)) { + send_err(id, "frame not in presented-image ring"); return; + } + FILE *fp = fopen(path, "wb"); + int ok = fp && png_write_rgb(fp, rgb, (uint32_t)w, (uint32_t)h); + if (fp) fclose(fp); + free(rgb); + if (!ok) { send_err(id, "png write failed"); return; } + send_fmt("{\"id\":%d,\"ok\":true,\"frame\":%d,\"width\":%d,\"height\":%d}", + id, f, w, h); +} + +/* {"cmd":"capture_mark","op":"status"|"mark"|"release"} + * status -> frozen, mark_frame, count, wide_path/wide_ok, and the frozen + * display-ring / GP0-ring frame spans to query. + * mark -> same as the hotkey (use only when nobody is at the window). + * release -> resume continuous capture. */ +static void handle_capture_mark(int id, const char *json) +{ + char op[16] = "status"; + (void)json_get_str(json, "op", op, sizeof op); + if (!strcmp(op, "mark")) debug_server_capture_mark(); + else if (!strcmp(op, "release")) { + s_capture_frozen = 0; + gpu_gp0_ring_set_frozen(0); + present_image_ring_set_frozen(0); + gpu_timeline_set_frozen(0); + } else if (strcmp(op, "status")) { send_err(id, "op must be status|mark|release"); return; } + uint32_t oldest = 0, newest = 0; + gpu_gp0_ring_frame_span(&oldest, &newest); + uint32_t d_old = UINT32_MAX, d_new = 0; + for (int i = 0; i < DISP_RING_CAP; i++) { + if (!s_disp_ring[i].valid) continue; + if (s_disp_ring[i].frame < d_old) d_old = s_disp_ring[i].frame; + if (s_disp_ring[i].frame > d_new) d_new = s_disp_ring[i].frame; + } + if (d_old == UINT32_MAX) d_old = 0; + send_fmt("{\"id\":%d,\"ok\":true,\"frozen\":%d,\"mark_frame\":%llu," + "\"count\":%llu,\"wide_path\":\"%s\",\"wide_ok\":%d," + "\"display_ring\":[%u,%u],\"gp0_ring\":[%u,%u],\"frame\":%llu}", + id, s_capture_frozen, (unsigned long long)s_capture_mark_frame, + (unsigned long long)s_capture_mark_count, s_capture_wide_path, + s_capture_wide_ok, d_old, d_new, oldest, newest, + (unsigned long long)s_frame_count); +} + /* screenshot: capture what the player is actually being shown. Native-wide * presentation is wider than the canonical PSX display rectangle, so routing * this command unconditionally through handle_screenshot_file silently omits @@ -9725,6 +9970,87 @@ static void handle_present_ring(int id, const char *json) free(buf); } +/* Precise-NCLIP attribution (gte_nclip_stats.h). + * {"cmd":"nclip_stats"} totals + per-function + per-site tables + * {"cmd":"nclip_stats","reset":1} clear the tables after reading + * {"cmd":"nclip_stats","exact":0|1} switch exact-site consumers off/on + * funcs: [near_store_pc, nclips, disagree, saturated, last_frame] (1 = unknown) + * sites: [pc, evals, flips, fallbacks, last_frame] */ +static void handle_nclip_stats(int id, const char *json) +{ + extern int gpu_ws_precise_nclip_enabled(void); + static GteNclipFuncStat funcs[GTE_NCLIP_STAT_CAP]; + static GteNclipSiteStat sites[GTE_NCLIP_STAT_CAP]; + uint64_t hits = 0, fallbacks = 0, disagree = 0; + gte_nclip_precise_stats(&hits, &fallbacks, &disagree); + const int nf = gte_nclip_func_stats(funcs, GTE_NCLIP_STAT_CAP); + const int ns = gte_nclip_site_stats(sites, GTE_NCLIP_STAT_CAP); + const int bufsz = 256 + (nf + ns) * 72; + char *buf = (char *)malloc((size_t)bufsz); + if (!buf) { send_err(id, "alloc failed"); return; } + int pos = snprintf(buf, bufsz, + "{\"id\":%d,\"ok\":true,\"enabled\":%d,\"exact\":%d,\"hits\":%llu,\"fallbacks\":%llu," + "\"disagreements\":%llu,\"funcs\":[", + id, gpu_ws_precise_nclip_enabled(), gte_nclip_exact_enabled(), + (unsigned long long)hits, + (unsigned long long)fallbacks, (unsigned long long)disagree); + for (int i = 0; i < nf; i++) + pos += snprintf(buf + pos, bufsz - pos, "%s[\"0x%08X\",%u,%u,%u,%u]", + i ? "," : "", funcs[i].func, funcs[i].nclips, + funcs[i].disagree, funcs[i].saturated, funcs[i].last_frame); + pos += snprintf(buf + pos, bufsz - pos, "],\"sites\":["); + for (int i = 0; i < ns; i++) + pos += snprintf(buf + pos, bufsz - pos, "%s[\"0x%08X\",%u,%u,%u,%u]", + i ? "," : "", sites[i].pc, sites[i].evals, + sites[i].flips, sites[i].fallbacks, sites[i].last_frame); + snprintf(buf + pos, bufsz - pos, "]}"); + if (json_get_int(json, "reset", 0)) gte_nclip_stats_reset(); + { + const int exact = json_get_int(json, "exact", -1); + if (exact >= 0) gte_nclip_exact_set_enabled(exact); + } + send_fmt("%s", buf); + free(buf); +} + +/* GPU frame timeline (gpu_timeline.h): cycle-ordered vblank / flip / + * draw-area / linked-list DMA / present events. + * {"cmd":"gpu_timeline","from":F,"to":T} frames [F,T] (default: last 8) + * events: [seq, cycle, frame, kind, a, b] */ +static void handle_gpu_timeline(int id, const char *json) +{ + uint64_t total = gpu_timeline_total(); + uint64_t oldest = total > GPU_TIMELINE_CAP ? total - GPU_TIMELINE_CAP : 0; + GpuTimelineEntry last; + uint32_t newest_frame = (total && gpu_timeline_get(total - 1, &last)) ? last.frame : 0; + int to = json_get_int(json, "to", (int)newest_frame); + int from = json_get_int(json, "from", to - 7); + if (from < 0) from = 0; + if (to < from) { send_err(id, "to < from"); return; } + int bufsz = 256 + 4096 * 80; + char *buf = (char *)malloc((size_t)bufsz); + if (!buf) { send_err(id, "alloc failed"); return; } + GpuTimelineEntry first_e; + uint32_t oldest_frame = (total && gpu_timeline_get(oldest, &first_e)) ? first_e.frame : 0; + int pos = snprintf(buf, bufsz, + "{\"id\":%d,\"ok\":true,\"total\":%llu,\"frames\":[%u,%u],\"events\":[", + id, (unsigned long long)total, oldest_frame, newest_frame); + int first = 1, n = 0; + for (uint64_t s = oldest; s < total && pos < bufsz - 128 && n < 4096; s++) { + GpuTimelineEntry e; + if (!gpu_timeline_get(s, &e)) continue; + if ((int)e.frame < from || (int)e.frame > to) continue; + pos += snprintf(buf + pos, bufsz - pos, "%s[%llu,%llu,%u,\"%s\",%u,%u]", + first ? "" : ",", (unsigned long long)s, + (unsigned long long)e.cyc, e.frame, + gpu_timeline_kind_name(e.kind), e.a, e.b); + first = 0; n++; + } + pos += snprintf(buf + pos, bufsz - pos, "],\"truncated\":%s}", n >= 4096 ? "true" : "false"); + send_fmt("%s", buf); + free(buf); +} + /* ---- Write trace: hook + handlers (Tier 1 reverse debugger) ---- */ extern CPUState *debug_cpu_ptr; @@ -14232,13 +14558,21 @@ static const CmdEntry s_commands[] = { { "gpu_state", handle_gpu_state }, { "geom_correction", handle_geom_correction }, { "pgxp", handle_pgxp }, + { "pgxp_shadow", handle_pgxp_shadow }, + { "pgxp_miss_ring", handle_pgxp_miss_ring }, { "ws_aspect_cone_site", handle_ws_aspect_cone_site }, { "ws_margin", handle_ws_margin }, { "ws_hud_mode", handle_ws_hud_mode }, + { "ws_tag_stats", handle_ws_tag_stats }, { "mod_counters", handle_mod_counters }, + { "resident_status", handle_resident_status }, + { "capture_mark", handle_capture_mark }, + { "present_image_ring_stats", handle_present_image_ring_stats }, + { "present_image_ring_get", handle_present_image_ring_get }, { "kernel_bless", handle_kernel_bless }, { "ws_aspect", handle_ws_aspect }, { "display_aspect", handle_display_aspect }, + { "window_size", handle_window_size }, { "ws_nw", handle_ws_nw }, { "scanline", handle_scanline }, { "ws_backdrop_ring", handle_ws_backdrop_ring }, @@ -14256,6 +14590,8 @@ static const CmdEntry s_commands[] = { { "gl_coh_ring", handle_gl_coh_ring }, { "gl_present_ring", handle_gl_present_ring }, { "present_ring", handle_present_ring }, + { "gpu_timeline", handle_gpu_timeline }, + { "nclip_stats", handle_nclip_stats }, { "frame_perf", handle_frame_perf }, { "gl_ws_ablate", handle_gl_ws_ablate }, { "gl_interp", handle_gl_interp }, diff --git a/runtime/src/dirty_ram_interp.c b/runtime/src/dirty_ram_interp.c index e43373d9..38f49b74 100644 --- a/runtime/src/dirty_ram_interp.c +++ b/runtime/src/dirty_ram_interp.c @@ -1918,10 +1918,13 @@ static int exec_one_fetched_inner(CPUState *cpu, uint32_t pc, uint32_t insn, cpu->gpr[0] = 0; return 0; } - case 0x24: /* AND */ - cpu->gpr[rd] = cpu->gpr[rs] & cpu->gpr[rt]; + case 0x24: { /* AND */ + uint32_t a = cpu->gpr[rs], b = cpu->gpr[rt]; + cpu->gpr[rd] = a & b; + psx_pgxp_alu(cpu, insn, cpu->gpr[rd], a, b); cpu->gpr[0] = 0; return 0; + } case 0x25: { /* OR */ uint32_t a = cpu->gpr[rs], b = cpu->gpr[rt]; cpu->gpr[rd] = a | b; @@ -1929,22 +1932,30 @@ static int exec_one_fetched_inner(CPUState *cpu, uint32_t pc, uint32_t insn, cpu->gpr[0] = 0; return 0; } - case 0x26: /* XOR */ - cpu->gpr[rd] = cpu->gpr[rs] ^ cpu->gpr[rt]; + case 0x26: { /* XOR */ + uint32_t a = cpu->gpr[rs], b = cpu->gpr[rt]; + cpu->gpr[rd] = a ^ b; + psx_pgxp_alu(cpu, insn, cpu->gpr[rd], a, b); cpu->gpr[0] = 0; return 0; - case 0x27: /* NOR */ - cpu->gpr[rd] = ~(cpu->gpr[rs] | cpu->gpr[rt]); + } + case 0x27: { /* NOR */ + uint32_t a = cpu->gpr[rs], b = cpu->gpr[rt]; + cpu->gpr[rd] = ~(a | b); + psx_pgxp_alu(cpu, insn, cpu->gpr[rd], a, b); cpu->gpr[0] = 0; return 0; + } case 0x2A: /* SLT */ { uint32_t vanilla = ((int32_t)cpu->gpr[rs] < (int32_t)cpu->gpr[rt]) ? 1u : 0u; uint32_t kept = vanilla; - if (!psx_ws_aspect_cone_site(cpu, pc, insn, vanilla, &kept)) + if (!psx_ws_cull_scale_site(pc, insn, cpu->gpr[rs], cpu->gpr[rt], &kept) && + !psx_ws_aspect_cone_site(cpu, pc, insn, vanilla, &kept)) (void)psx_ws_cull_keep_site(pc, insn, vanilla, &kept); cpu->gpr[rd] = kept; + psx_pgxp_alu(cpu, insn, kept, 0, 0); cpu->gpr[0] = 0; return 0; } @@ -1952,8 +1963,10 @@ static int exec_one_fetched_inner(CPUState *cpu, uint32_t pc, uint32_t insn, { uint32_t vanilla = (cpu->gpr[rs] < cpu->gpr[rt]) ? 1u : 0u; uint32_t kept = vanilla; - (void)psx_ws_cull_keep_site(pc, insn, vanilla, &kept); + if (!psx_ws_cull_scale_site(pc, insn, cpu->gpr[rs], cpu->gpr[rt], &kept)) + (void)psx_ws_cull_keep_site(pc, insn, vanilla, &kept); cpu->gpr[rd] = kept; + psx_pgxp_alu(cpu, insn, kept, 0, 0); cpu->gpr[0] = 0; return 0; } @@ -2151,6 +2164,7 @@ static int exec_one_fetched_inner(CPUState *cpu, uint32_t pc, uint32_t insn, cpu->gpr[rt] = (uint32_t)psx_ws_cull_slti(cpu->gpr[rs], imm); else cpu->gpr[rt] = ((int32_t)cpu->gpr[rs] < simm) ? 1u : 0u; + psx_pgxp_alu(cpu, insn, cpu->gpr[rt], 0, 0); cpu->gpr[0] = 0; return 0; } @@ -2180,13 +2194,17 @@ static int exec_one_fetched_inner(CPUState *cpu, uint32_t pc, uint32_t insn, cpu->gpr[rt] = (uint32_t)psx_ws_cull_sltiu(cpu->gpr[rs], imm); else cpu->gpr[rt] = (cpu->gpr[rs] < (uint32_t)simm) ? 1u : 0u; + psx_pgxp_alu(cpu, insn, cpu->gpr[rt], 0, 0); cpu->gpr[0] = 0; return 0; } - case 0x0C: /* ANDI */ - cpu->gpr[rt] = cpu->gpr[rs] & imm; + case 0x0C: { /* ANDI */ + uint32_t a = cpu->gpr[rs]; + cpu->gpr[rt] = a & imm; + psx_pgxp_alu(cpu, insn, cpu->gpr[rt], a, imm); cpu->gpr[0] = 0; return 0; + } case 0x0D: { /* ORI */ uint32_t a = cpu->gpr[rs]; if (rs == 0 && rt != 0 && psx_ws_is_signed_x_bound_site(pc, insn)) @@ -2197,10 +2215,13 @@ static int exec_one_fetched_inner(CPUState *cpu, uint32_t pc, uint32_t insn, cpu->gpr[0] = 0; return 0; } - case 0x0E: /* XORI */ - cpu->gpr[rt] = cpu->gpr[rs] ^ imm; + case 0x0E: { /* XORI */ + uint32_t a = cpu->gpr[rs]; + cpu->gpr[rt] = a ^ imm; + psx_pgxp_alu(cpu, insn, cpu->gpr[rt], a, imm); cpu->gpr[0] = 0; return 0; + } case 0x0F: /* LUI rt, imm */ if (psx_ws_is_signed_x_bound_site(pc, insn)) cpu->gpr[rt] = (uint32_t)psx_ws_player_x_bound((int32_t)(imm << 16)); diff --git a/runtime/src/dma.c b/runtime/src/dma.c index 6ebe3bc1..70ade5a9 100644 --- a/runtime/src/dma.c +++ b/runtime/src/dma.c @@ -31,6 +31,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "gpu_timeline.h" /* Word-aligned main-RAM offset of a DMA address (MADR / stepped cursor) * through the live geometry: retail folds to 2 MiB exactly as the DMAC's @@ -515,6 +516,39 @@ static void start_async_cdrom_transfer(void) { } } +int dma_host_cdrom_write(uint32_t dest, const uint8_t *src, uint32_t bytes, int lba) { + if ((dest & 3u) || (bytes & 3u) || (!src && bytes)) return 0; + const uint32_t addr = DMA_RAM_ADDR(dest); + const uint32_t live = psx_ram_live_bytes(); + if (addr >= live || bytes > live - addr) return 0; + if (!bytes) return 1; + /* Same capture window as the real ch3 path: game data, not FMV buffers. */ + const int capture = addr < 0x1C0000u || addr >= PSX_MAIN_RAM_RETAIL_BYTES; + const int saved_ch = g_dma_cur_ch; + const uint32_t saved_madr = g_dma_cur_madr, saved_bcr = g_dma_cur_bcr; + g_dma_exec_depth++; + g_dma_cur_ch = 3; + g_dma_cur_bcr = bytes / 4u; + if (capture) overlay_capture_before_dma(addr, bytes); + for (uint32_t i = 0; i < bytes; i += 4u) { + uint32_t word; + memcpy(&word, src + i, 4); + g_dma_cur_madr = addr + i; + psx_write_word(addr + i, word); + } + dirty_ram_mark_executable_range(addr, bytes); + if (capture) { + if (lba >= 0) cd_dma_log_push(lba, addr, bytes); + extern uint8_t *memory_get_ram_ptr(void); + overlay_capture_on_dma(addr, bytes, memory_get_ram_ptr() + addr); + } + g_dma_cur_ch = saved_ch; + g_dma_cur_madr = saved_madr; + g_dma_cur_bcr = saved_bcr; + g_dma_exec_depth--; + return 1; +} + static void finish_async_cdrom_transfer(uint32_t final_addr) { finish_cdrom_dma_capture(final_addr, 1); DMAAsyncChannel *a = &cdrom_async; @@ -730,6 +764,8 @@ static void gpu_ll_complete(void *opaque, int hit_limit) { (void)opaque; gpu_ot_stats.completes++; gpu_ot_record_walk_stats(psx_cycle_count - gpu_ot_start_cycle); + gpu_timeline_note(GTL_LL_END, gpu_linked_list.nodes_processed, + gpu_linked_list.total_words); channels[2].madr = hit_limit ? gpu_linked_list.current_addr : 0x00FFFFFFu; gpu_ws_end_linked_list(); @@ -757,6 +793,7 @@ static void start_async_gpu_linked_list(void) { * header and payload read at its consumption boundary. */ gpu_ws_prepass_linked_list(start_addr); dma_gpu_ll_start(&gpu_linked_list, start_addr, 0x40000u); + gpu_timeline_note(GTL_LL_START, start_addr, 0); event_ring_record_aux(EV_DMA_SCHED, 2u, channels[2].chcr); gpu_ot_stats.starts++; gpu_ot_start_cycle = psx_cycle_count; diff --git a/runtime/src/gpu.c b/runtime/src/gpu.c index baec4a62..6277daab 100644 --- a/runtime/src/gpu.c +++ b/runtime/src/gpu.c @@ -49,6 +49,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "gpu_timeline.h" /* Word-aligned main-RAM key for a primitive/OT address through the live * geometry (retail: the DMAC's 0x1FFFFC fold). */ @@ -127,6 +128,9 @@ typedef struct { uint8_t op; uint8_t full_draw_area; uint8_t shared_split_ui; + /* A triangle or a rotated quad: UI only as part of a widget it lies + * inside (ws_ui_prepass_admit_enclosed), never on its own. */ + uint8_t enclosed_only; WsPrepassPacketGuard packet_guard; } WsUiPrepassItem; static WsUiPrepassItem ws_ui_prepass[WS_UI_PREPASS_MAX]; @@ -163,6 +167,7 @@ static struct { uint32_t rank; /* admitted, then dropped by the max_rank filter */ uint32_t stale; /* live packet no longer matches cached bytes */ uint32_t backing; /* NOT a reject: lower-rank backing panels kept */ + uint32_t enclosed; /* NOT a reject: needles/hands inside a widget */ } ws_ui_reject; /* Geometry of the primitives the max_rank filter discarded. A count alone @@ -191,6 +196,9 @@ static void ws_nw_sync_target(void); typedef struct { uint32_t key; uint32_t stamp; int32_t anchor_x; } WsTag; static WsTag ws_tags[WS_TAG_BUCKETS]; static WsHudAnchorTag ws_hud_anchor_tags[WS_HUD_ANCHOR_TABLE_SIZE]; +static WsHudAnchorTag ws_background_tags[WS_HUD_ANCHOR_TABLE_SIZE]; +static uint32_t ws_background_tag_frame; +static int ws_background_tags_used; static WsHudAnchorTag ws_reveal_clear_tags[WS_HUD_ANCHOR_TABLE_SIZE]; static WsHudAnchorTag ws_screen_mask_tags[WS_HUD_ANCHOR_TABLE_SIZE]; static WsRadialScreenMaskTag ws_radial_screen_mask_tags[WS_RADIAL_MASK_TAG_COUNT]; @@ -277,7 +285,12 @@ void gpu_ws_set_precise_nclip(int on) { * PGXP correction is disabled. Re-derive the internal transport arm. */ gpu_pgxp_rederive_enable(); } -int gpu_ws_precise_nclip_enabled(void) { return ws_precise_nclip_cfg && (ws_active() || ws_nw_extra() > 0); } +/* Same "reveals extra world" test the exact-NCLIP branch consumers use + * (psx_ws_x_margin() > 0): squash AND native-wide. ws_active() alone is the + * squash factor, which native-wide never sets, so the producer was dead there. */ +int gpu_ws_precise_nclip_enabled(void) { + return ws_precise_nclip_cfg && psx_ws_x_margin() > 0; +} void gpu_ws_set_gameplay_state_gate(uint32_t addr, const uint32_t *values, int nvalues) { if (nvalues < 0) nvalues = 0; @@ -979,6 +992,59 @@ int psx_ws_cull_keep_site(uint32_t pc, uint32_t instr, uint32_t vanilla, return 0; } +typedef struct { + uint32_t address; + uint32_t expected; + uint32_t operand; /* 0 = rs, 1 = rt */ + int32_t half_extent; +} WsCullScaleSite; +static WsCullScaleSite ws_cull_scale_sites[WS_EXPLICIT_CULL_SITES_MAX]; +static int ws_cull_scale_n = 0; +void gpu_ws_set_cull_scale_sites(const uint32_t *addresses, + const uint32_t *expected, + const uint32_t *operands, + const uint32_t *half_extents, int nsites) { + if (nsites < 0) nsites = 0; + if (nsites > WS_EXPLICIT_CULL_SITES_MAX) nsites = WS_EXPLICIT_CULL_SITES_MAX; + ws_cull_scale_n = nsites; + for (int i = 0; i < nsites; i++) { + ws_cull_scale_sites[i].address = addresses[i] & 0x1FFFFFFFu; + ws_cull_scale_sites[i].expected = expected[i]; + ws_cull_scale_sites[i].operand = operands[i] ? 1u : 0u; + ws_cull_scale_sites[i].half_extent = (int32_t)half_extents[i]; + } +} +/* A camera-space frustum edge authored for a half_extent-pixel half-screen + * (x < half*z/H) widens to the live view by scaling the bound by + * (half + margin) / half. 64-bit intermediate; saturates to int32. */ +int32_t psx_ws_cull_scale(int32_t bound, int32_t half_extent) { + const int32_t margin = psx_ws_x_margin(); + if (margin <= 0 || half_extent <= 0) return bound; + int64_t v = (int64_t)bound * (int64_t)(half_extent + margin) / half_extent; + if (v > INT32_MAX) v = INT32_MAX; + if (v < INT32_MIN) v = INT32_MIN; + return (int32_t)v; +} +int psx_ws_cull_scale_site(uint32_t pc, uint32_t instr, uint32_t rs_value, + uint32_t rt_value, uint32_t *out) { + const uint32_t phys = pc & 0x1FFFFFFFu; + for (int i = 0; i < ws_cull_scale_n; i++) { + const WsCullScaleSite *site = &ws_cull_scale_sites[i]; + if (site->address != phys || site->expected != instr) continue; + if (site->operand == 0) + rs_value = (uint32_t)psx_ws_cull_scale((int32_t)rs_value, site->half_extent); + else + rt_value = (uint32_t)psx_ws_cull_scale((int32_t)rt_value, site->half_extent); + const uint32_t funct = instr & 0x3Fu; + if (out) + *out = funct == 0x2Au + ? (((int32_t)rs_value < (int32_t)rt_value) ? 1u : 0u) + : ((rs_value < rt_value) ? 1u : 0u); + return 1; + } + return 0; +} + typedef struct { uint32_t address; uint32_t expected; @@ -2091,13 +2157,13 @@ int psx_ws_ui_groups_json(char *buf, int cap) { "\"disp_x\":%d,\"disp_w\":%d,\"join_gap\":%d," "\"rejected\":{\"opcode\":%u,\"not_axis\":%u,\"degenerate\":%u," "\"too_big\":%u,\"cap\":%u,\"rank\":%u,\"stale\":%u}," - "\"backing_panels\":%u,\"n\":%u,", + "\"backing_panels\":%u,\"enclosed_parts\":%u,\"n\":%u,", ws_active(), ws_auto_ui_squash, ws_auto_ui_dense, ws_ui_prepass_rank != 0xFFFFu ? (int)ws_ui_prepass_rank : -1, ws_disp_x(), ws_disp_w(), WS_UI_GROUP_JOIN_GAP, ws_ui_reject.opcode, ws_ui_reject.not_axis, ws_ui_reject.degenerate, ws_ui_reject.too_big, ws_ui_reject.cap, ws_ui_reject.rank, - ws_ui_reject.stale, ws_ui_reject.backing, + ws_ui_reject.stale, ws_ui_reject.backing, ws_ui_reject.enclosed, ws_ui_prepass_count); off += snprintf(buf + off, (size_t)(cap - off), "\"rank_dropped\":["); for (uint32_t i = 0; i < ws_ui_rankdrop_count && off < cap - 120; i++) { @@ -2293,20 +2359,96 @@ static int ws_hud_command_words(uint32_t command_addr, uint32_t *words, return 1; } +static GpuWsTagStats ws_hud_tag_stats; +static GpuWsTagStats ws_background_tag_stats; + +void gpu_ws_get_tag_stats(GpuWsTagStats *hud, GpuWsTagStats *background) { + if (hud) *hud = ws_hud_tag_stats; + if (background) *background = ws_background_tag_stats; +} + +static void ws_tag_stats_note_lookup(GpuWsTagStats *stats, int result) { + switch (result) { + case WS_HUD_ANCHOR_HIT: + stats->hit++; + stats->last_hit_frame = (uint32_t)s_frame_count; + break; + case WS_HUD_ANCHOR_STALE: stats->stale++; break; + case WS_HUD_ANCHOR_GUARD_MISMATCH: stats->guard_mismatch++; break; + default: break; + } +} + void gpu_ws_tag_hud_prim(uint32_t prim, int anchor) { - if (!ws_native_wide_configured()) return; - if ((prim & 3u) != 0 || prim > UINT32_MAX - 4u) return; + ws_hud_tag_stats.tag_calls++; uint32_t command_addr = prim + 4u; uint32_t words[12]; uint32_t word_count = 0; - if (!ws_hud_command_words(command_addr, words, &word_count)) + if (!ws_native_wide_configured() || + (prim & 3u) != 0 || prim > UINT32_MAX - 4u || + !ws_hud_command_words(command_addr, words, &word_count)) { + ws_hud_tag_stats.tag_rejected++; return; + } WsPrepassPacketGuard guard = ws_prepass_packet_guard(words, word_count); ws_hud_anchor_insert(ws_hud_anchor_tags, WS_HUD_ANCHOR_TABLE_SIZE, GPU_RAM_KEY(command_addr), anchor, &guard, (uint32_t)s_frame_count); + ws_hud_tag_stats.last_tag_frame = (uint32_t)s_frame_count; +} + +void gpu_ws_tag_background_prim(uint32_t prim) { + ws_background_tag_stats.tag_calls++; + uint32_t words[12], count = 0; + if (!ws_native_wide_configured() || (prim & 3u) || + prim > UINT32_MAX - 4u || + !ws_hud_command_words(prim + 4u, words, &count)) { + ws_background_tag_stats.tag_rejected++; + return; + } + uint32_t op = words[0] >> 24; + if (op < 0x20u || op > 0x3Fu || (op & 2u)) { + ws_background_tag_stats.tag_rejected++; + return; + } + WsPrepassPacketGuard guard = ws_prepass_packet_guard(words, count); + ws_hud_anchor_insert(ws_background_tags, WS_HUD_ANCHOR_TABLE_SIZE, + (prim + 4u) & 0x1FFFFCu, 0, &guard, + (uint32_t)s_frame_count); + ws_background_tags_used = 1; + ws_background_tag_frame = (uint32_t)s_frame_count; + ws_background_tag_stats.last_tag_frame = (uint32_t)s_frame_count; +} + +int gpu_ws_background_stretch_active(void) { + uint32_t frame = (uint32_t)s_frame_count; + return ws_background_tags_used && ws_native_wide_active() && + frame >= ws_background_tag_frame && + frame - ws_background_tag_frame <= WS_HUD_ANCHOR_FRESH_FRAMES; +} + +int gpu_ws_background_requires_full_composite(void) { + /* Freshness governs reuse of a packet address, not the lifetime of the + * pixels it produced. A slow game frame or a held display buffer can keep + * those pixels on screen indefinitely. Conservatively keep full mirroring + * once a composite has been tagged; GPU reset/snapshot restore clears the + * latch together with the tags. Never modify the packet freshness guard. */ + return ws_background_tags_used && ws_native_wide_configured(); +} + +static int ws_nw_explicit_background(void) { + if (!gpu_ws_background_stretch_active() || + gp0_cmd_source_addr == 0xFFFFFFFFu || + gp0_words_needed <= 0 || gp0_words_needed > 12) return 0; + uint32_t addr = gp0_cmd_source_addr & 0x1FFFFFFFu; + if (addr >= 0x00200000u || (addr & 3u)) return 0; + int result = ws_hud_anchor_lookup_result( + ws_background_tags, WS_HUD_ANCHOR_TABLE_SIZE, addr, gp0_cmd_buf, + (uint32_t)gp0_words_needed, (uint32_t)s_frame_count, NULL); + ws_tag_stats_note_lookup(&ws_background_tag_stats, result); + return result == WS_HUD_ANCHOR_HIT; } void gpu_ws_tag_black_reveal_rect(uint32_t prim) { @@ -2382,10 +2524,12 @@ static int ws_nw_explicit_hud_delta(int32_t *out_delta) { uint32_t command_addr = gp0_cmd_source_addr & 0x1FFFFFFFu; if (command_addr >= psx_ram_live_bytes() || (command_addr & 3u)) return 0; int anchor = 0; - if (!ws_hud_anchor_lookup(ws_hud_anchor_tags, WS_HUD_ANCHOR_TABLE_SIZE, - command_addr, gp0_cmd_buf, - (uint32_t)gp0_words_needed, - (uint32_t)s_frame_count, &anchor)) + int result = ws_hud_anchor_lookup_result( + ws_hud_anchor_tags, WS_HUD_ANCHOR_TABLE_SIZE, command_addr, + gp0_cmd_buf, (uint32_t)gp0_words_needed, (uint32_t)s_frame_count, + &anchor); + ws_tag_stats_note_lookup(&ws_hud_tag_stats, result); + if (result != WS_HUD_ANCHOR_HIT) return 0; int32_t off = ws_nw_offset(); if (out_delta) @@ -2513,6 +2657,8 @@ static int ws_bg_phase_over(void) { static int ws_tagged_world_primitive(void); int psx_ws_prim_in_backdrop(void) { + /* Explicit title proof is independent of heuristic draw-order phases. */ + if (ws_nw_explicit_background()) return 1; if (gp0_cmd_source_addr != 0xFFFFFFFFu) { uint32_t f = (uint32_t)s_frame_count; if (f != bdg_src_frame) { bdg_src_frame = f; g_bdg_src_lo = 0xFFFFFFFFu; g_bdg_src_hi = 0; } @@ -2714,9 +2860,22 @@ static int ws_axis_aligned_quad(const int32_t vx[4], const int32_t vy[4]) { return corners == 15u; } +/* A widget part that is not an axis-aligned rectangle (a triangle, a rotated + * quad): squashed with its widget when the prepass admitted it as lying + * inside that widget (ws_ui_prepass_finish). */ +static int ws_auto_ui_transform_part(int32_t *vx, int n) { + if (ws_nw_explicit_hud_delta(NULL) || psx_ws_prim_is_tagged()) return 0; + int32_t anchor; + if (!ws_auto_ui_anchor(&anchor)) return 0; + for (int i = 0; i < n; i++) + vx[i] = ws_scale_about(vx[i], anchor) + ws_shared_ui_delta(); + ws_auto_ui_transform_count++; + return 1; +} + static int ws_auto_ui_transform_quad(int32_t vx[4], const int32_t vy[4]) { - if (ws_nw_explicit_hud_delta(NULL) || psx_ws_prim_is_tagged() || !ws_axis_aligned_quad(vx, vy)) - return 0; + if (ws_nw_explicit_hud_delta(NULL) || psx_ws_prim_is_tagged()) return 0; + if (!ws_axis_aligned_quad(vx, vy)) return ws_auto_ui_transform_part(vx, 4); int32_t min_x = vx[0], max_x = vx[0], min_y = vy[0], max_y = vy[0]; for (int i = 1; i < 4; i++) { @@ -3345,6 +3504,8 @@ static void gpu_reset_state(int clear_vram) { gp0_next_source_addr = 0xFFFFFFFFu; gp0_cmd_source_addr = 0xFFFFFFFFu; ws_hud_anchor_clear(ws_hud_anchor_tags, WS_HUD_ANCHOR_TABLE_SIZE); + ws_hud_anchor_clear(ws_background_tags, WS_HUD_ANCHOR_TABLE_SIZE); + ws_background_tags_used = 0; ws_hud_anchor_clear(ws_reveal_clear_tags, WS_HUD_ANCHOR_TABLE_SIZE); ws_hud_anchor_clear(ws_screen_mask_tags, WS_HUD_ANCHOR_TABLE_SIZE); ws_radial_mask_clear(ws_radial_screen_mask_tags); @@ -3668,6 +3829,7 @@ void gpu_vblank_flush_present(void) { void gpu_vblank_tick(void) { lcf ^= 1; + gpu_timeline_note(GTL_VBLANK, lcf, 0); /* GPUSTAT.13 (interlace FIELD): on real hardware this alternates per * field while GP1(08h) vertical interlace is on, in antiphase with the * even/odd-lines bit 31 during active display. Modeled here at vblank @@ -4462,6 +4624,7 @@ static void gp0_exec_mono_tri(void) { parse_vertex(gp0_cmd_buf[1 + i], &vx[i], &vy[i]); } if (gpu_triangle_rejected(vx, vy, 0, 1, 2)) return; + ws_auto_ui_transform_part(vx, 3); ws_nw_hud_shift_vertices(vx, 3); for (int i = 0; i < 3; i++) { vx[i] += draw_offset_x; @@ -4580,6 +4743,7 @@ static void gp0_exec_shaded_tri(void) { parse_vertex(gp0_cmd_buf[1 + i * 2], &vx[i], &vy[i]); } if (gpu_triangle_rejected(vx, vy, 0, 1, 2)) return; + ws_auto_ui_transform_part(vx, 3); ws_nw_hud_shift_vertices(vx, 3); for (int i = 0; i < 3; i++) { vx[i] += draw_offset_x; @@ -4746,6 +4910,7 @@ static void gp0_exec_textured_tri(void) { uint16_t tpage = tpage_word & 0x1FF; set_tpage_from_poly(tpage_word); /* latches even for size-rejected polys */ if (gpu_triangle_rejected(vx, vy, 0, 1, 2)) return; + ws_auto_ui_transform_part(vx, 3); ws_nw_hud_shift_vertices(vx, 3); for (int i = 0; i < 3; i++) { @@ -4893,6 +5058,7 @@ static void gp0_exec_shaded_textured_tri(void) { uint16_t tpage = tpage_word & 0x1FF; set_tpage_from_poly(tpage_word); /* latches even for size-rejected polys */ if (gpu_triangle_rejected(vx, vy, 0, 1, 2)) return; + ws_auto_ui_transform_part(vx, 3); ws_nw_hud_shift_vertices(vx, 3); for (int i = 0; i < 3; i++) { @@ -5291,6 +5457,7 @@ static void gp0_exec_fill_rect(void) { * VRAM. Routed through the renderer so it also fills the hi-res * supersampling mirror (no-op cost when supersampling is off). */ gr_fill_rect((int)dst_x, (int)dst_y, (int)width, (int)height, color16); + gpu_timeline_note(GTL_FILL, dst_x | (dst_y << 16), width | (height << 16)); /* Native-wide: when the game clears a display buffer, clear the full width * of that buffer's wide surface over the same rows — refreshing the centred @@ -5345,6 +5512,7 @@ static void gp0_exec_draw_area_tl(void) { gr_set_draw_area((int)draw_area_left, (int)draw_area_top, (int)draw_area_right, (int)draw_area_bottom); ws_nw_sync_target(); /* back buffer (draw_area_left) → wide mirror surface */ + gpu_timeline_note(GTL_DRAW_AREA, draw_area_left, draw_area_top); } static void gp0_exec_draw_area_br(void) { @@ -5652,8 +5820,27 @@ static void ws_ui_prepass_add(const uint32_t *words, uint32_t word_count, if (ws_ui_prepass_count >= WS_UI_PREPASS_MAX) { ws_ui_reject.cap++; return; } uint32_t op = words[0] >> 24; int32_t min_x, max_x, min_y, max_y; + int enclosed_only = 0; - if (op >= 0x20u && op <= 0x3Fu && (op & 0x08u)) { + if (op >= 0x20u && op <= 0x3Fu && !(op & 0x08u)) { + /* A triangle is a widget part only when it lies inside the widget: + * a compass needle, a dial hand (Spider-Man's compass arrow, two + * flat triangles in the ring's own rank). */ + const int textured = (op & 0x04u) != 0; + const int shaded = (op & 0x10u) != 0; + const int step = 1 + (textured ? 1 : 0) + (shaded ? 1 : 0); + int32_t vx, vy; + parse_vertex(words[1], &min_x, &min_y); + max_x = min_x; max_y = min_y; + for (int i = 1; i < 3; i++) { + parse_vertex(words[1 + i * step], &vx, &vy); + if (vx < min_x) min_x = vx; + if (vx > max_x) max_x = vx; + if (vy < min_y) min_y = vy; + if (vy > max_y) max_y = vy; + } + enclosed_only = 1; + } else if (op >= 0x20u && op <= 0x3Fu && (op & 0x08u)) { /* Any 4-vertex polygon. Untextured HUD fills (health gradients, * meter bars) sit in the same front layer as the textured frames * around them; leaving them out kept their raw 4:3 X while the frame @@ -5676,7 +5863,10 @@ static void ws_ui_prepass_add(const uint32_t *words, uint32_t word_count, int32_t vx[4], vy[4]; for (int i = 0; i < 4; i++) parse_vertex(words[indices[i]], &vx[i], &vy[i]); - if (!ws_axis_aligned_quad(vx, vy)) { ws_ui_reject.not_axis++; return; } + if (!ws_axis_aligned_quad(vx, vy)) { + ws_ui_reject.not_axis++; + enclosed_only = 1; /* a rotated piece: see triangles */ + } min_x = max_x = vx[0]; min_y = max_y = vy[0]; for (int i = 1; i < 4; i++) { if (vx[i] < min_x) min_x = vx[i]; @@ -5724,7 +5914,13 @@ static void ws_ui_prepass_add(const uint32_t *words, uint32_t word_count, int32_t width = max_x - min_x, height = max_y - min_y; int32_t X = ws_disp_x(), W = ws_disp_w(), H = ws_disp_h(); - if ((min_x <= X && max_x >= X + W && min_y <= 0 && max_y >= H) || + /* Anything spanning the display width (to within W/64 of each edge) is a + * full-width overlay -- letterbox bars, fade strips, menu band rules -- + * not a widget: it widens with the image. Squashed as UI, a cutscene's + * bars left the revealed margins showing whatever the frame cleared to, + * and the pause menu's rules (x 2..510 of 512) stopped short of the band + * they frame (Spider-Man). */ + if ((min_x <= X + W / 64 && max_x >= X + W - W / 64) || (width > W / 2 && height > H / 4)) { ws_ui_reject.too_big++; return; @@ -5746,6 +5942,7 @@ static void ws_ui_prepass_add(const uint32_t *words, uint32_t word_count, item->op = (uint8_t)op; item->full_draw_area = full_draw_area ? 1 : 0; item->shared_split_ui = 0; + item->enclosed_only = (uint8_t)enclosed_only; item->packet_guard = ws_prepass_packet_guard(words, word_count); } @@ -5780,7 +5977,7 @@ void gpu_ws_prepass_linked_list(uint32_t start_addr) { ws_auto_ui_dense = 0; ws_ui_reject.opcode = ws_ui_reject.not_axis = ws_ui_reject.degenerate = ws_ui_reject.too_big = ws_ui_reject.cap = ws_ui_reject.rank = - ws_ui_reject.stale = ws_ui_reject.backing = 0; + ws_ui_reject.stale = ws_ui_reject.backing = ws_ui_reject.enclosed = 0; ws_ui_rankdrop_count = 0; if (!ws_auto_ui_squash || !ws_active()) return; @@ -5895,18 +6092,20 @@ void gpu_ws_prepass_linked_list(uint32_t start_addr) { uint16_t backing_rank = 0xFFFFu; for (uint32_t i = 0; i < ws_ui_prepass_count; i++) { uint16_t r = ws_ui_prepass[i].ot_rank; - if (r < max_rank && (backing_rank == 0xFFFFu || r > backing_rank)) + if (!ws_ui_prepass[i].enclosed_only && r < max_rank && + (backing_rank == 0xFFFFu || r > backing_rank)) backing_rank = r; } static uint8_t keep[WS_UI_PREPASS_MAX]; for (uint32_t i = 0; i < ws_ui_prepass_count; i++) - keep[i] = ws_ui_prepass[i].ot_rank == max_rank; + keep[i] = ws_ui_prepass[i].ot_rank == max_rank && + !ws_ui_prepass[i].enclosed_only; const int32_t small_w = ws_disp_w() / 4, small_h = ws_disp_h() / 4; for (int changed = 1; changed && backing_rank != 0xFFFFu;) { changed = 0; for (uint32_t i = 0; i < ws_ui_prepass_count; i++) { const WsUiPrepassItem *it = &ws_ui_prepass[i]; - if (keep[i] || it->ot_rank != backing_rank) continue; + if (keep[i] || it->enclosed_only || it->ot_rank != backing_rank) continue; const int small = it->group.width <= small_w && it->h <= small_h; const int untextured = ws_ui_untextured_op(it->op); for (uint32_t j = 0; j < ws_ui_prepass_count; j++) { @@ -5922,6 +6121,37 @@ void gpu_ws_prepass_linked_list(uint32_t start_addr) { } } + /* Widget parts that are not axis-aligned rectangles -- a compass needle, + * a dial hand -- join from the HUD rank when they lie inside the admitted + * pieces they overlap (the union of their boxes). Left out, they stretch + * with the wide image while the frame around them squashes. */ + for (uint32_t i = 0; i < ws_ui_prepass_count; i++) { + const WsUiPrepassItem *it = &ws_ui_prepass[i]; + if (!it->enclosed_only || it->ot_rank != max_rank) continue; + const int32_t x0 = it->group.x, x1 = it->group.x + it->group.width; + const int32_t y0 = it->y, y1 = it->y + it->h; + int32_t ux0 = 0, ux1 = 0, uy0 = 0, uy1 = 0; + int any = 0; + for (uint32_t j = 0; j < ws_ui_prepass_count; j++) { + const WsUiPrepassItem *ui = &ws_ui_prepass[j]; + if (!keep[j] || ui->enclosed_only) continue; + const int32_t a0 = ui->group.x, a1 = ui->group.x + ui->group.width; + const int32_t b0 = ui->y, b1 = ui->y + ui->h; + if (a0 >= x1 || x0 >= a1 || b0 >= y1 || y0 >= b1) continue; + if (!any) { ux0 = a0; ux1 = a1; uy0 = b0; uy1 = b1; any = 1; } + else { + if (a0 < ux0) ux0 = a0; + if (a1 > ux1) ux1 = a1; + if (b0 < uy0) uy0 = b0; + if (b1 > uy1) uy1 = b1; + } + } + if (any && ux0 <= x0 && x1 <= ux1 && uy0 <= y0 && y1 <= uy1) { + keep[i] = 1; + ws_ui_reject.enclosed++; + } + } + uint32_t out = 0; for (uint32_t i = 0; i < ws_ui_prepass_count; i++) { if (keep[i]) { @@ -6091,7 +6321,13 @@ static GpuGp0RingEntry *gp0_ring = NULL; /* lazy-alloc on first record */ static uint64_t gp0_ring_seq = 0; /* total commands recorded */ static uint32_t gp0_ring_head = 0; /* next write slot */ +/* Capture mark (debug_server_capture_mark): stop overwriting so the window + * that led up to an operator-reported glitch survives until it is read. */ +static int gp0_ring_frozen = 0; +void gpu_gp0_ring_set_frozen(int frozen) { gp0_ring_frozen = frozen ? 1 : 0; } + static void gp0_ring_record(const uint32_t *words, int n) { + if (gp0_ring_frozen) return; if (!gp0_ring) { gp0_ring = (GpuGp0RingEntry *)calloc(GP0_RING_CAP, sizeof(*gp0_ring)); if (!gp0_ring) return; /* OOM — capture disabled, no other effect */ @@ -6156,6 +6392,7 @@ static void gp0_ring_record(const uint32_t *words, int n) { (void)n; } +void gpu_gp0_ring_set_frozen(int frozen) { (void)frozen; } uint64_t gpu_gp0_ring_total(void) { return 0; } uint32_t gpu_gp0_ring_capacity(void) { return 0; } uint32_t gpu_gp0_ring_max_words(void) { return GPU_GP0_RING_MAX_WORDS; } @@ -6816,6 +7053,7 @@ static void gp1_display_area_start(uint32_t val) { display_area_x = val & 0x3FF; display_area_y = (val >> 10) & 0x1FF; ws_note_display_base(display_area_x); /* learn the display buffer set (native-wide) */ + gpu_timeline_note(GTL_DISP_START, display_area_x, display_area_y); } static void gp1_h_display_range(uint32_t val) { @@ -7105,6 +7343,8 @@ int gpu_snapshot_read(const uint8_t *p, uint32_t len) { ws_reset_scene_history(); ws_scene_hold_reset(&s_ws_scene_hold); ws_hud_anchor_clear(ws_hud_anchor_tags, WS_HUD_ANCHOR_TABLE_SIZE); + ws_hud_anchor_clear(ws_background_tags, WS_HUD_ANCHOR_TABLE_SIZE); + ws_background_tags_used = 0; ws_hud_anchor_clear(ws_reveal_clear_tags, WS_HUD_ANCHOR_TABLE_SIZE); ws_hud_anchor_clear(ws_screen_mask_tags, WS_HUD_ANCHOR_TABLE_SIZE); ws_radial_mask_clear(ws_radial_screen_mask_tags); diff --git a/runtime/src/gpu_gl_renderer.c b/runtime/src/gpu_gl_renderer.c index a795e3c6..61c4055d 100644 --- a/runtime/src/gpu_gl_renderer.c +++ b/runtime/src/gpu_gl_renderer.c @@ -86,6 +86,7 @@ #include "psx_savestate_menu.h" #include "host_time.h" #include "latency_ring.h" +#include "gpu_timeline.h" #include "frame_pacing.h" #include "psx_rewind.h" @@ -204,6 +205,9 @@ typedef void (APIENTRY *PFN_glEndQuery)(GLenum); typedef void (APIENTRY *PFN_glGetQueryObjectui64v)(GLuint, GLenum, GLuint64 *); typedef void (APIENTRY *PFN_glGetQueryObjectiv)(GLuint, GLenum, GLint *); typedef void (APIENTRY *PFN_glQueryCounter)(GLuint, GLenum); +/* Buffer mapping for asynchronous pixel-pack readback (presented-image ring). */ +typedef void * (APIENTRY *PFN_glMapBuffer)(GLenum, GLenum); +typedef GLboolean (APIENTRY *PFN_glUnmapBuffer)(GLenum); #ifndef GL_TIME_ELAPSED #define GL_TIME_ELAPSED 0x88BF #endif @@ -217,6 +221,8 @@ typedef void (APIENTRY *PFN_glQueryCounter)(GLuint, GLenum); #define GL_QUERY_RESULT_AVAILABLE 0x8867 #endif +static PFN_glMapBuffer p_glMapBuffer; +static PFN_glUnmapBuffer p_glUnmapBuffer; static PFN_glCreateShader p_glCreateShader; static PFN_glShaderSource p_glShaderSource; static PFN_glCompileShader p_glCompileShader; @@ -319,6 +325,9 @@ static int load_modern_gl(void) { p_glGetQueryObjectui64v = (void *)SDL_GL_GetProcAddress("glGetQueryObjectui64v"); p_glGetQueryObjectiv = (void *)SDL_GL_GetProcAddress("glGetQueryObjectiv"); p_glQueryCounter = (void *)SDL_GL_GetProcAddress("glQueryCounter"); + /* Optional: only the debug presented-image ring maps pack buffers. */ + p_glMapBuffer = (void *)SDL_GL_GetProcAddress("glMapBuffer"); + p_glUnmapBuffer = (void *)SDL_GL_GetProcAddress("glUnmapBuffer"); #undef LOAD return ok; } @@ -2375,6 +2384,22 @@ static void mark_prim_dirty(const int *xs, const int *ys, int n, int textured) { * boundary (MMX6: draw area alternates y=0/y=240, both bands in ONE wide * surface) bleed into the OTHER band's rows — presented one frame later as * top/bottom edge flicker (16:9 GL only). */ +/* Wide-surface scissor: full wide width, draw-area rows (see above). Every + * draw into a wide surface uses it, including the full-screen-overlay pass. */ +static void wide_band_scissor_x(int x, int w) { + int y1 = s_area_y1, y2 = s_area_y2; + if (s_pass_active) { /* render pass: stay inside the backed-up band */ + if (y1 < s_pass_y) y1 = s_pass_y; + if (y2 > s_pass_y + s_pass_h - 1) y2 = s_pass_y + s_pass_h - 1; + } + int sy = y1, sh = y2 - y1 + 1; + if (sy < 0) { sh += sy; sy = 0; } + if (sy + sh > VRAM_H) sh = VRAM_H - sy; + if (sh < 0) sh = 0; + glEnable(GL_SCISSOR_TEST); + glScissor(x * s_out_scale, sy * s_out_scale, w * s_out_scale, sh * s_out_scale); +} +static void wide_band_scissor(void) { wide_band_scissor_x(0, g_wide_w); } static void wide_target_begin(int dx, GLint uXoff, GLint uXhalf) { if (s_ws_ablate != 3) /* ablate 3: no FBO rebind (draws land in hr — perf probe) */ p_glBindFramebuffer(PSXGL_FRAMEBUFFER, g_wide_cur); @@ -2383,21 +2408,7 @@ static void wide_target_begin(int dx, GLint uXoff, GLint uXhalf) { if (s_hiw) p_glUniform1f(uXoff == s_tex_uXoff ? s_tex_uShift : s_geo_uShift, s_shift_hi); glViewport(0, 0, g_wide_w * s_out_scale, VRAM_H * s_out_scale); - glEnable(GL_SCISSOR_TEST); - { - int y1 = s_area_y1, y2 = s_area_y2; - if (s_pass_active) { /* render pass: stay inside the backed-up band */ - if (y1 < s_pass_y) y1 = s_pass_y; - if (y2 > s_pass_y + s_pass_h - 1) y2 = s_pass_y + s_pass_h - 1; - } - int sy = y1, sh = y2 - y1 + 1; - if (sy < 0) { sh += sy; sy = 0; } - if (sy + sh > VRAM_H) sh = VRAM_H - sy; - if (sh < 0) sh = 0; - glScissor(view_pad_left * s_out_scale, sy * s_out_scale, - (g_wide_w - view_pad_left - view_pad_right) * s_out_scale, - sh * s_out_scale); - } + wide_band_scissor_x(view_pad_left, g_wide_w - view_pad_left - view_pad_right); p_glUniform1f(uXoff, (float)dx); p_glUniform1f(uXhalf, (float)g_wide_w / 2.0f); } @@ -2454,17 +2465,23 @@ static int bd_prim_gate(const int *xs, int n, int textured) { static int s_wide_fast = 1; void gl_renderer_set_wide_fast(int on) { s_wide_fast = on ? 1 : 0; } int gl_renderer_get_wide_fast(void) { return s_wide_fast; } +static int wide_fast_center_valid(void) { + /* An explicitly stretched sky differs inside the canonical viewport too. + * Keep the full composite for those scenes, including later foreground + * draws. Tags are installed before DMA, so no earlier center draws skip. */ + return s_wide_fast && !gpu_ws_background_requires_full_composite(); +} static void wide_blit_center(GLuint wide_fbo, int base_x, int disp_y, int disp_h); /* def below */ /* True if [lo,hi] (canonical draw-x) lies strictly inside the 4:3 frame, so the * prim adds nothing to either reveal margin and its mirror can be skipped. */ static int mirror_x_center_only(int lo, int hi) { - if (!s_wide_fast || view_enabled) return 0; + if (!wide_fast_center_valid() || view_enabled) return 0; int base = g_wide_cur_base, native_w = g_wide_w - 2 * g_wide_off; if (native_w <= 0) return 0; return (lo >= base) && (hi < base + native_w); } static int mirror_geo_center_only(const int *xs, int n) { - if (!s_wide_fast || view_enabled) return 0; + if (!wide_fast_center_valid() || view_enabled) return 0; int lo = xs[0], hi = xs[0]; for (int i = 1; i < n; i++) { if (xs[i] < lo) lo = xs[i]; if (xs[i] > hi) hi = xs[i]; } return mirror_x_center_only(lo, hi); @@ -2637,7 +2654,7 @@ static int s_cw_batches = 0, s_cw_wide_sets = 0, s_cw_wide_cfgs = 0, /* Textured-batch variant of mirror_x_center_only: scan the queued verts' x * (attr 0, stride TEXV). Defined here so s_tb / TEXV are in scope. */ static int mirror_batch_center_only(int nverts) { - if (!s_wide_fast || nverts <= 0) return 0; + if (!wide_fast_center_valid() || nverts <= 0) return 0; float flo = s_tb[0], fhi = s_tb[0]; for (int i = 1; i < nverts; i++) { float x = s_tb[i * TEXV]; @@ -2991,9 +3008,10 @@ static GLenum s_fb_mode = GL_TRIANGLES; static float s_fbl[FLATBATCH_MAXL * 2 * 6]; static int s_fbl_at[FLATBATCH_MAXL]; static int s_fbl_n = 0; +static int s_fb_gate = 0; static int mirror_flat_batch_center_only(int nverts) { - if (!s_wide_fast || nverts <= 0) return 0; + if (!wide_fast_center_valid() || nverts <= 0) return 0; float flo = s_fb[0], fhi = s_fb[0]; for (int i = 1; i < nverts; i++) { float x = s_fb[i * 6]; @@ -3041,12 +3059,11 @@ static void flush_flat_batch(void) { else glDrawArrays(fmode, 0, nverts); int mirror = g_wide_cur && !s_wide_suppress && s_ws_ablate != 1 && !(!g_ws_bd_stretch_on && mirror_flat_batch_center_only(nverts)); - if (hiw_on() && hiw_enqueue_geo(s_fb, nverts, semi, mask, mirror, 0)) mirror = 0; + if (hiw_on() && hiw_enqueue_geo(s_fb, nverts, semi, mask, mirror, s_fb_gate)) mirror = 0; if (mirror) { int dx = wide_dx(); - /* Batch may span many prims; use stretch gate off (flat dots/UI). */ - s_bd_gate = 0; + s_bd_gate = s_fb_gate; gl_perf_mirror_begin(); wide_target_begin(dx, s_geo_uXoff, s_geo_uXhalf); wide_set_bd_scale(s_geo_uXscale, s_geo_uXcenter); @@ -3123,11 +3140,12 @@ static void gpu_geometry(GLenum mode, const int *xs, const int *ys, if (mode == GL_LINES && n == 2 && s_hr_scale == 1 && !s_hiw && g_wide_cur && !bd_prim_gate(xs, n, 0)) { if (s_fb_n > 0 && (s_fb_mode != GL_LINES || s_fb_semi != semi || - s_fb_mask != (int)s_mask_set)) + s_fb_mask != (int)s_mask_set || s_fb_gate != 0)) flush_flat_batch(); if (s_fb_n + 2 > FLATBATCH_MAXV) flush_flat_batch(); s_fb_mode = GL_LINES; + s_fb_gate = 0; s_fb_semi = semi; s_fb_mask = (int)s_mask_set; float mask_a = s_mask_set ? 1.0f : 0.0f; @@ -3248,14 +3266,16 @@ static void gpu_geometry(GLenum mode, const int *xs, const int *ys, return; } + int gate = bd_prim_gate(xs, n, 0); if (s_fb_n > 0 && (s_fb_mode != GL_TRIANGLES || s_fb_semi != semi || - s_fb_mask != (int)s_mask_set)) + s_fb_mask != (int)s_mask_set || s_fb_gate != gate)) flush_flat_batch(); if (s_fb_n + n > FLATBATCH_MAXV) flush_flat_batch(); s_fb_mode = GL_TRIANGLES; s_fb_semi = semi; s_fb_mask = (int)s_mask_set; + s_fb_gate = gate; float mask_a = s_mask_set ? 1.0f : 0.0f; for (int i = 0; i < n; i++) { @@ -3419,7 +3439,8 @@ static void gpu_textured_triangle(const int *xs, const int *ys, /* Draw a flat-colored rect (GEO program) DIRECTLY into the active wide surface * at wide-space coords [wx, wx+ww) × [y, y+h). Used only by the full-screen- * overlay path; positions are already in wide space so u_xoff stays 0. Mirrors - * raster_flat_rect(&wt, ...) in sw_draw_flat_rect. Caller stays inside + * raster_flat_rect(&wt, ...) in sw_draw_flat_rect, including its draw-area row + * clip. Caller stays inside * hr_begin/hr_end. */ static void wide_flat_rect_direct(int wx, int y, int ww, int h, uint16_t c, int semi) { if (ww <= 0 || h <= 0) return; @@ -3432,12 +3453,13 @@ static void wide_flat_rect_direct(int wx, int y, int ww, int h, uint16_t c, int fx0,fy0,r,g,b,a, fx1,fy0,r,g,b,a, fx0,fy1,r,g,b,a, fx1,fy0,r,g,b,a, fx0,fy1,r,g,b,a, fx1,fy1,r,g,b,a, }; - /* Wide target: positions already wide-space so u_xoff = 0; full-width - * scissor; u_xhalf = g_wide_w/2. */ + /* Wide target: positions already wide-space so u_xoff = 0; full-width, + * draw-area-rows scissor like rt_wide() — a full-height scissor let an + * overlay-width rect that canonically clips at a vertical double-buffer + * band boundary paint the OTHER band's rows; u_xhalf = g_wide_w/2. */ p_glBindFramebuffer(PSXGL_FRAMEBUFFER, g_wide_cur); glViewport(0, 0, g_wide_w * s_out_scale, VRAM_H * s_out_scale); - glEnable(GL_SCISSOR_TEST); - glScissor(0, 0, g_wide_w * s_out_scale, VRAM_H * s_out_scale); /* full surface (rt_wide) */ + wide_band_scissor(); if (semi >= 0) apply_psx_blend(semi); else glDisable(GL_BLEND); mask_stencil(s_mask_set); p_glUseProgram(s_geo_prog); @@ -6758,7 +6780,95 @@ static void gl_draw_osd_image(const uint32_t *px, int ow, int oh, } /* Composite host toast + volume bar into the default framebuffer, then swap. */ +/* ---- presented-image ring feed (debug tools) ------------------------------ + * Every present, before the host OSD is drawn: blit the composed default + * framebuffer (what the window shows, letterbox included) down to a + * PRESENT_IMAGE_RING_H-tall thumbnail FBO, and read it back through a pair of + * pixel-pack buffers so the GPU->CPU copy of frame N completes while frame + * N+1 is presented (no pipeline stall). Tagged with the frame number at issue + * time. Absent buffer-mapping entry points disable only this feed. */ +#ifndef PSX_NO_DEBUG_TOOLS +#include "present_image_ring.h" +extern uint64_t s_frame_count; +#define PSXGL_PIXEL_PACK_BUFFER 0x88EB +#define PSXGL_STREAM_READ 0x88E1 +#define PSXGL_READ_ONLY 0x88B8 +static GLuint s_pir_fbo, s_pir_tex, s_pir_pbo[2]; +static int s_pir_w, s_pir_pending[2], s_pir_pending_w[2], s_pir_idx; +static uint32_t s_pir_frame[2]; +static int s_pir_disabled; + +static void present_image_ring_capture_gl(void) { + if (s_pir_disabled || !p_glMapBuffer || !p_glUnmapBuffer) return; + if (!present_image_ring_accepting()) return; + int ww = 0, wh = 0; + SDL_GL_GetDrawableSize(s_win, &ww, &wh); + const int tw = present_image_ring_thumb_w(ww, wh); + const int th = PRESENT_IMAGE_RING_H; + if (tw <= 0) return; + if (!s_pir_fbo) { + glGenTextures(1, &s_pir_tex); + glBindTexture(GL_TEXTURE_2D, s_pir_tex); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, PRESENT_IMAGE_RING_MAX_W, th, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glBindTexture(GL_TEXTURE_2D, 0); + p_glGenFramebuffers(1, &s_pir_fbo); + p_glBindFramebuffer(PSXGL_FRAMEBUFFER, s_pir_fbo); + p_glFramebufferTexture2D(PSXGL_FRAMEBUFFER, PSXGL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, s_pir_tex, 0); + const GLenum st = p_glCheckFramebufferStatus(PSXGL_FRAMEBUFFER); + p_glBindFramebuffer(PSXGL_FRAMEBUFFER, 0); + if (st != PSXGL_FRAMEBUFFER_COMPLETE) { s_pir_disabled = 1; return; } + p_glGenBuffers(2, s_pir_pbo); + for (int i = 0; i < 2; i++) { + p_glBindBuffer(PSXGL_PIXEL_PACK_BUFFER, s_pir_pbo[i]); + p_glBufferData(PSXGL_PIXEL_PACK_BUFFER, + (ptrdiff_t)PRESENT_IMAGE_RING_MAX_W * th * 4, NULL, + PSXGL_STREAM_READ); + } + p_glBindBuffer(PSXGL_PIXEL_PACK_BUFFER, 0); + } + /* Downscale the presented image (default framebuffer back buffer). */ + glDisable(GL_SCISSOR_TEST); + p_glBindFramebuffer(PSXGL_READ_FRAMEBUFFER, 0); + p_glBindFramebuffer(PSXGL_DRAW_FRAMEBUFFER, s_pir_fbo); + p_glBlitFramebuffer(0, 0, ww, wh, 0, 0, tw, th, GL_COLOR_BUFFER_BIT, GL_LINEAR); + /* Queue this frame's readback into the current pack buffer. */ + const int cur = s_pir_idx; + p_glBindFramebuffer(PSXGL_READ_FRAMEBUFFER, s_pir_fbo); + p_glBindBuffer(PSXGL_PIXEL_PACK_BUFFER, s_pir_pbo[cur]); + glPixelStorei(GL_PACK_ALIGNMENT, 4); + glReadPixels(0, 0, tw, th, GL_RGBA, GL_UNSIGNED_BYTE, (void *)0); + s_pir_pending[cur] = 1; + s_pir_pending_w[cur] = tw; + s_pir_frame[cur] = (uint32_t)s_frame_count; + /* Harvest the previous frame's buffer (its copy finished during this one). */ + const int prev = cur ^ 1; + if (s_pir_pending[prev]) { + p_glBindBuffer(PSXGL_PIXEL_PACK_BUFFER, s_pir_pbo[prev]); + const uint8_t *px = (const uint8_t *)p_glMapBuffer(PSXGL_PIXEL_PACK_BUFFER, + PSXGL_READ_ONLY); + if (px) { + present_image_ring_push(s_pir_frame[prev], px, s_pir_pending_w[prev], + s_pir_pending_w[prev] * 4, 1 /* GL rows bottom-up */); + p_glUnmapBuffer(PSXGL_PIXEL_PACK_BUFFER); + } + s_pir_pending[prev] = 0; + } + p_glBindBuffer(PSXGL_PIXEL_PACK_BUFFER, 0); + p_glBindFramebuffer(PSXGL_READ_FRAMEBUFFER, 0); + p_glBindFramebuffer(PSXGL_DRAW_FRAMEBUFFER, 0); + s_pir_idx = prev; + s_pir_w = tw; +} +#endif + static void gl_swap_with_osd(void) { +#ifndef PSX_NO_DEBUG_TOOLS + if (s_ctx) present_image_ring_capture_gl(); +#endif if (s_present_prog && s_ctx) { int ww = 0, wh = 0; SDL_GL_GetDrawableSize(s_win, &ww, &wh); @@ -7014,6 +7124,7 @@ int gl_renderer_present_hold_last(void) { * full-window image (GL without interp). */ hold_capture_drawable(); } + gpu_timeline_note(GTL_PRESENT, GTL_PATH_HOLD, 0); latency_ring_mark(LAT_SWAP_BEGIN); gl_swap_with_osd(); latency_ring_mark(LAT_SWAP_END); @@ -7036,6 +7147,8 @@ void gl_renderer_present_vram(int disp_x, int disp_y, int w, int h, int linear, !psx_present_vsync_owns_cadence() && !gl_renderer_interpolation_owns_cadence()) { s_probe_skip++; + gpu_timeline_note(GTL_PRESENT_SKIP, GTL_PATH_VRAM_FBO, + (uint32_t)disp_x | ((uint32_t)disp_y << 16)); gl_perf_present_enter(); gl_perf_present_exit(0); return; @@ -7095,6 +7208,8 @@ void gl_renderer_present_vram(int disp_x, int disp_y, int w, int h, int linear, present_target_quad(src_tex, src_tw, VRAM_H, src_x, disp_y, w, h, linear, lx, ly, lw, lh, 1, 1, src_scale); pres_record(GL_PRES_VRAM, disp_x, disp_y, w, h, lx, ly, lw, lh); + gpu_timeline_note(GTL_PRESENT, GTL_PATH_VRAM_FBO, + (uint32_t)disp_x | ((uint32_t)disp_y << 16)); hold_capture_drawable(); latency_ring_mark(LAT_SWAP_BEGIN); gl_swap_with_osd(); @@ -7116,7 +7231,7 @@ void gl_renderer_present_vram(int disp_x, int disp_y, int w, int h, int linear, * x-translated by the reveal offset. No-op when s_wide_fast is off (then the * mirror drew the full surface, as before). Shared by both present paths. */ static void wide_blit_center(GLuint wide_fbo, int base_x, int disp_y, int disp_h) { - if (!s_wide_fast || view_enabled || g_wide_w <= 0) return; + if (!wide_fast_center_valid() || view_enabled || g_wide_w <= 0) return; int native_w = g_wide_w - 2 * g_wide_off; if (native_w <= 0) return; int S = s_out_scale; @@ -7199,6 +7314,8 @@ int gl_renderer_present_wide_fbo(int disp_x, int disp_y, int disp_h, int linear) !psx_present_vsync_owns_cadence() && !gl_renderer_interpolation_owns_cadence()) { s_probe_skip++; + gpu_timeline_note(GTL_PRESENT_SKIP, GTL_PATH_WIDE_FBO, + (uint32_t)disp_x | ((uint32_t)disp_y << 16)); gl_perf_present_enter(); gl_perf_present_exit(1); return 1; @@ -7233,6 +7350,8 @@ int gl_renderer_present_wide_fbo(int disp_x, int disp_y, int disp_h, int linear) present_target_quad(tex, g_wide_w, VRAM_H, 0, disp_y, g_wide_w, disp_h, linear, lx, ly, lw, lh, 1, 1, s_out_scale); pres_record(GL_PRES_WIDE, disp_x, disp_y, g_wide_w, disp_h, lx, ly, lw, lh); + gpu_timeline_note(GTL_PRESENT, GTL_PATH_WIDE_FBO, + (uint32_t)disp_x | ((uint32_t)disp_y << 16)); hold_capture_drawable(); latency_ring_mark(LAT_SWAP_BEGIN); gl_swap_with_osd(); diff --git a/runtime/src/gpu_timeline.c b/runtime/src/gpu_timeline.c new file mode 100644 index 00000000..e52eee2a --- /dev/null +++ b/runtime/src/gpu_timeline.c @@ -0,0 +1,45 @@ +/* GPU frame timeline ring — see gpu_timeline.h. */ +#include "gpu_timeline.h" +#include "psx_cycles.h" + +extern uint64_t s_frame_count; /* debug_server.c */ + +static GpuTimelineEntry s_ring[GPU_TIMELINE_CAP]; +static uint64_t s_total = 0; +static int s_frozen = 0; + +void gpu_timeline_note(uint8_t kind, uint32_t a, uint32_t b) { + if (s_frozen) return; + GpuTimelineEntry *e = &s_ring[s_total & (GPU_TIMELINE_CAP - 1u)]; + e->cyc = psx_cycle_count; + e->frame = (uint32_t)s_frame_count; + e->a = a; + e->b = b; + e->kind = kind; + s_total++; +} + +void gpu_timeline_set_frozen(int frozen) { s_frozen = frozen ? 1 : 0; } + +uint64_t gpu_timeline_total(void) { return s_total; } + +int gpu_timeline_get(uint64_t seq, GpuTimelineEntry *out) { + if (seq >= s_total || s_total - seq > GPU_TIMELINE_CAP) return 0; + *out = s_ring[seq & (GPU_TIMELINE_CAP - 1u)]; + return 1; +} + +const char *gpu_timeline_kind_name(uint8_t kind) { + switch (kind) { + case GTL_VBLANK: return "vblank"; + case GTL_DISP_START: return "disp_start"; + case GTL_DRAW_AREA: return "draw_area"; + case GTL_LL_START: return "ll_start"; + case GTL_LL_END: return "ll_end"; + case GTL_PRESENT: return "present"; + case GTL_PRESENT_SKIP: return "present_skip"; + case GTL_DISP_CAPTURE: return "disp_capture"; + case GTL_FILL: return "fill"; + default: return "?"; + } +} diff --git a/runtime/src/gpu_vk_renderer.c b/runtime/src/gpu_vk_renderer.c index 31cf2370..c57e1546 100644 --- a/runtime/src/gpu_vk_renderer.c +++ b/runtime/src/gpu_vk_renderer.c @@ -3052,8 +3052,10 @@ static void vkb_draw_gouraud_triangle(int x0,int y0,uint16_t c0,int x1,int y1,ui /* Full-screen-overlay wide pass (pause gray-filter / load fade): draw a flat * rect covering the FULL wide width [0, wide_w) x [y, y+h) directly into the * active wide surface (positions already wide-space, u_xoff = 0). Mirrors GL's - * wide_flat_rect_direct: full-surface scissor (the overlay must dim the - * revealed margins too). The 6 verts are consumed privately (s_vbase bumped) + * wide_flat_rect_direct: full wide width (the overlay must dim the revealed + * margins too) but only the draw-area rows, like SW rt_wide() — a full-height + * scissor let a rect that canonically clips at a vertical double-buffer band + * boundary paint the OTHER band's rows. The 6 verts are consumed privately (s_vbase bumped) * so they never join a canonical batch. */ static void wide_overlay_rect(int y, int h, uint16_t c, int semi) { if (s_wide_cur < 0 || !s_ready) return; @@ -3065,12 +3067,8 @@ static void wide_overlay_rect(int y, int h, uint16_t c, int semi) { push_vert(x0, fy0, col); push_vert(x1, fy1, col); push_vert(x0, fy1, col); s_vbase += s_vcount; s_vcount = 0; /* consume privately */ int blend = (semi < 0) ? 0 : (semi + 1); - int S = s_scale; VkCommandBuffer cb = begin_oneshot(); - wide_pass_begin(cb); - /* Overlay covers the whole surface: override the band scissor. */ - VkRect2D sc = { { 0, 0 }, { (uint32_t)(s_wide_w * S), (uint32_t)(VRAM_H * S) } }; - p_vkCmdSetScissor(cb, 0, 1, &sc); + wide_pass_begin(cb); /* band scissor: full wide width, draw-area rows */ bind_masked(cb, 0, 0, blend, s_mask_check, s_mask_set); GeoPush gp = { px_shift(), 0.0f, (float)s_wide_w / 2.0f }; p_vkCmdPushConstants(cb, s_pl_geo, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof gp, &gp); diff --git a/runtime/src/gte.cpp b/runtime/src/gte.cpp index 593851e8..e591a58b 100644 --- a/runtime/src/gte.cpp +++ b/runtime/src/gte.cpp @@ -2,6 +2,7 @@ #include "cpu_state.h" #include "nd_intro_ot.h" #include "pgxp.h" +#include "gte_nclip_stats.h" #include "render_pass_projection.h" #include <algorithm> #include <cstdlib> @@ -13,6 +14,8 @@ extern "C" int gpu_ws_precise_nclip_enabled(void); /* overlay_loader.c: nonzero while an overlay shadow diff (interpreter record * plus native replay of one candidate) is running. */ extern "C" int psx_overlay_shadow_diff_active(void); +extern "C" uint64_t s_frame_count; /* debug_server.c */ +extern "C" uint32_t g_debug_last_store_pc; /* debug_server.c */ extern "C" { int (*g_psx_projection_command)(CPUState*, uint32_t) = nullptr; } namespace PSXRecomp { @@ -1075,10 +1078,63 @@ extern "C" void gte_nclip_precise_stats(uint64_t *hits, uint64_t *fallbacks, if (fallbacks) *fallbacks = s_nclip_fallbacks; if (disagreements) *disagreements = s_nclip_disagreements; } -extern "C" int gte_nclip_precise_bltz(int32_t native_mac0) { - if (!s_nclip_last_precise_valid || native_mac0 != s_nclip_last_native) - return native_mac0 < 0; - return s_nclip_last_precise_sign < 0; +/* Always-on attribution tables (gte_nclip_stats.h): producers by guest + * function, consumers by branch PC. Open addressing; a full table drops new + * keys (counted in s_nclip_*_dropped) rather than evicting. */ +static GteNclipFuncStat s_nclip_func[GTE_NCLIP_STAT_CAP]; /* key 1 = unknown */ +static GteNclipSiteStat s_nclip_site[GTE_NCLIP_STAT_CAP]; +static uint32_t s_nclip_func_dropped = 0, s_nclip_site_dropped = 0; +static inline uint32_t nclip_slot(uint32_t key) { + return (key * 2654435761u) >> 24; /* GTE_NCLIP_STAT_CAP == 256 */ +} +template <typename T> +static T *nclip_find(T *table, uint32_t key, uint32_t T::*field, + uint32_t *dropped) { + for (uint32_t i = 0, s = nclip_slot(key); i < GTE_NCLIP_STAT_CAP; + ++i, s = (s + 1) & (GTE_NCLIP_STAT_CAP - 1)) { + T *e = &table[s]; + if (e->*field == key) return e; + if (e->*field == 0) { e->*field = key; return e; } + } + ++*dropped; + return nullptr; +} +extern "C" int gte_nclip_func_stats(GteNclipFuncStat *out, int max) { + int n = 0; + for (int i = 0; i < GTE_NCLIP_STAT_CAP && n < max; ++i) + if (s_nclip_func[i].func) out[n++] = s_nclip_func[i]; + return n; +} +extern "C" int gte_nclip_site_stats(GteNclipSiteStat *out, int max) { + int n = 0; + for (int i = 0; i < GTE_NCLIP_STAT_CAP && n < max; ++i) + if (s_nclip_site[i].pc) out[n++] = s_nclip_site[i]; + return n; +} +extern "C" void gte_nclip_stats_reset(void) { + memset(s_nclip_func, 0, sizeof s_nclip_func); + memset(s_nclip_site, 0, sizeof s_nclip_site); + s_nclip_func_dropped = s_nclip_site_dropped = 0; +} +static int s_nclip_exact_enabled = 1; +extern "C" void gte_nclip_exact_set_enabled(int on) { s_nclip_exact_enabled = on ? 1 : 0; } +extern "C" int gte_nclip_exact_enabled(void) { return s_nclip_exact_enabled; } +extern "C" int32_t gte_nclip_exact_sign(int32_t native_mac0, uint32_t pc) { + const int32_t native = native_mac0 < 0 ? -1 : (native_mac0 > 0 ? 1 : 0); + const bool usable = s_nclip_exact_enabled && s_nclip_last_precise_valid && + native_mac0 == s_nclip_last_native; + const int32_t sign = usable ? s_nclip_last_precise_sign : native; + if (!s_gte_replay_sandbox && s_speculative_depth == 0) { + if (GteNclipSiteStat *e = nclip_find(s_nclip_site, pc, + &GteNclipSiteStat::pc, + &s_nclip_site_dropped)) { + e->evals++; + if (!usable) e->fallbacks++; + else if (sign != native) e->flips++; + e->last_frame = (uint32_t)s_frame_count; + } + } + return sign; } extern "C" int gte_nclip_native_wide_sign(int32_t native_mac0, int* sign) { if (!s_nclip_last_precise_valid || !s_nclip_last_horizontal_saturated || @@ -1184,8 +1240,24 @@ void gte_nclip(GTEState* gte, uint32_t instr) { else checked &= x == raw_x[i]; } s_nclip_last_horizontal_saturated = checked && saturated; - if ((cross > 0 && out <= 0) || (cross < 0 && out >= 0)) + const bool disagree = (cross > 0 && out <= 0) || (cross < 0 && out >= 0); + if (disagree) s_nclip_disagreements++; + /* Last guest store before this NCLIP: codegen stamps it on every + * store, so it lands inside the emitter that issued the NCLIP (the + * function stamp is not maintained for static code). */ + const uint32_t key = g_debug_last_store_pc ? g_debug_last_store_pc : 1u; + if (GteNclipFuncStat *e = nclip_find(s_nclip_func, key, + &GteNclipFuncStat::func, + &s_nclip_func_dropped)) { + e->nclips++; + if (disagree) e->disagree++; + if (sx0 == -0x400 || sx0 == 0x3FF || sy0 == -0x400 || sy0 == 0x3FF || + sx1 == -0x400 || sx1 == 0x3FF || sy1 == -0x400 || sy1 == 0x3FF || + sx2 == -0x400 || sx2 == 0x3FF || sy2 == -0x400 || sy2 == 0x3FF) + e->saturated++; + e->last_frame = (uint32_t)s_frame_count; + } } else if (gpu_ws_precise_nclip_enabled() && !s_gte_replay_sandbox && s_speculative_depth == 0) { s_nclip_fallbacks++; @@ -2272,10 +2344,10 @@ extern "C" void gte_write_data(CPUState* cpu, uint8_t reg, uint32_t val) { cpu->gte_data[29] = packed; } break; - /* Guest writes to the SXY FIFO drop the affected register shadows: - * we never model FIFO side effects on shadows — the shifted regs 12/13 - * now describe words their shadows no longer match, and validation - * drops those on next use. */ + /* Guest writes to the SXY FIFO: regs 12/13 overwrite their shadow, a + * reg 14 write overwrites SXY2 and its SXYP mirror, and a reg 15 + * write is the FIFO push, which pgxp_gte_reg_written applies to the + * shadows exactly as the registers move. */ case 12: case 13: cpu->gte_data[reg] = val; if (!PSXRecomp::GTE::s_gte_replay_sandbox) @@ -2284,20 +2356,16 @@ extern "C" void gte_write_data(CPUState* cpu, uint8_t reg, uint32_t val) { case 14: cpu->gte_data[14] = val; cpu->gte_data[15] = val; - if (!PSXRecomp::GTE::s_gte_replay_sandbox) { - pgxp_gte_reg_written(14, val); - pgxp_gte_reg_written(15, val); - } + if (!PSXRecomp::GTE::s_gte_replay_sandbox) + pgxp_gte_reg_written(14, val); /* resets the SXYP mirror too */ break; case 15: cpu->gte_data[12] = cpu->gte_data[13]; cpu->gte_data[13] = cpu->gte_data[14]; cpu->gte_data[14] = val; cpu->gte_data[15] = val; - if (!PSXRecomp::GTE::s_gte_replay_sandbox) { - pgxp_gte_reg_written(14, val); - pgxp_gte_reg_written(15, val); - } + if (!PSXRecomp::GTE::s_gte_replay_sandbox) + pgxp_gte_reg_written(15, val); /* FIFO push on the shadows */ break; case 28: { cpu->gte_data[9] = (val & 0x1Fu) << 7; diff --git a/runtime/src/host_keymap.c b/runtime/src/host_keymap.c index b23a8386..39afb3d0 100644 --- a/runtime/src/host_keymap.c +++ b/runtime/src/host_keymap.c @@ -110,6 +110,8 @@ static void apply_defaults(void) { add_bind(HOST_KEYMAP_SCANLINES, (int)SDLK_F6, (int)SDL_SCANCODE_F6, 0); if (want_default(HOST_KEYMAP_TURBO_TOGGLE)) add_bind(HOST_KEYMAP_TURBO_TOGGLE, (int)SDLK_F9, (int)SDL_SCANCODE_F9, 0); + if (want_default(HOST_KEYMAP_CAPTURE_MARK)) + add_bind(HOST_KEYMAP_CAPTURE_MARK, (int)SDLK_m, (int)SDL_SCANCODE_M, KMOD_CTRL); } /* Parse one "Ctrl+Alt+PageUp" token into key+mods. */ @@ -169,6 +171,7 @@ static HostKeymapAction action_for_key(const char *name) { if (ieq(name, "SaveStateMenu")) return HOST_KEYMAP_SAVE_STATE_MENU; if (ieq(name, "Scanlines")) return HOST_KEYMAP_SCANLINES; if (ieq(name, "TurboToggle")) return HOST_KEYMAP_TURBO_TOGGLE; + if (ieq(name, "CaptureMark")) return HOST_KEYMAP_CAPTURE_MARK; return HOST_KEYMAP_ACTION_COUNT; } @@ -223,6 +226,17 @@ void host_keymap_load(const char *config_ini_path) { apply_defaults(); } +/* A physical key event reports which side's modifier is down (KMOD_LCTRL or + * KMOD_RCTRL), while a binding means "either Ctrl". Compare on the side-less + * Ctrl/Alt/Shift set so Ctrl+X binds match a real left- or right-Ctrl press. */ +static int canonical_mods(int mod) { + int m = 0; + if (mod & KMOD_CTRL) m |= KMOD_CTRL; + if (mod & KMOD_ALT) m |= KMOD_ALT; + if (mod & KMOD_SHIFT) m |= KMOD_SHIFT; + return m; +} + int host_keymap_match_event(HostKeymapAction action, int keycode, int scancode, int mod) { const HostKeyAction *a; @@ -234,7 +248,7 @@ int host_keymap_match_event(HostKeymapAction action, int keycode, if (a->binds[i].keycode != keycode && (scancode <= 0 || a->binds[i].scancode != scancode)) continue; - if ((mod & relevant) == a->binds[i].mods) return 1; + if (canonical_mods(mod & relevant) == canonical_mods(a->binds[i].mods)) return 1; } return 0; } @@ -253,7 +267,7 @@ int host_keymap_down(HostKeymapAction action, const uint8_t *keys, int mod) { const int sc = a->binds[i].scancode; if (sc <= 0 || sc >= SDL_NUM_SCANCODES) continue; if (!keys[sc]) continue; - if ((mod & relevant) == a->binds[i].mods) return 1; + if (canonical_mods(mod & relevant) == canonical_mods(a->binds[i].mods)) return 1; } return 0; } diff --git a/runtime/src/interrupts.c b/runtime/src/interrupts.c index 195a614f..b5f99efc 100644 --- a/runtime/src/interrupts.c +++ b/runtime/src/interrupts.c @@ -635,6 +635,13 @@ int psx_irq_resume_context_snapshot_site(void) return g_cosim_dirty_pump_site; } +static unsigned s_snapshot_host_call_depth; +void psx_snapshot_host_call_begin(void) { ++s_snapshot_host_call_depth; } +void psx_snapshot_host_call_end(void) { + if (s_snapshot_host_call_depth) --s_snapshot_host_call_depth; +} +void psx_snapshot_host_call_reset(void) { s_snapshot_host_call_depth = 0; } + uint32_t psx_irq_resume_context_snapshot_pc(void) { return g_dirty_safe_resume_pc; @@ -644,6 +651,7 @@ int psx_irq_resume_context_snapshot_safe_at(uint32_t resume_pc) { extern int psx_mod_function_entry_active(void); if (psx_mod_function_entry_active()) return 0; + if (s_snapshot_host_call_depth) return 0; if (g_cosim_dirty_pump_site == 0) return 1; diff --git a/runtime/src/iso_reader_c.cpp b/runtime/src/iso_reader_c.cpp index 0dc8e173..e77638ae 100644 --- a/runtime/src/iso_reader_c.cpp +++ b/runtime/src/iso_reader_c.cpp @@ -7,6 +7,7 @@ #include "iso_reader.h" #include "mod_runtime.h" #include <cstdio> +#include <cstring> extern "C" { @@ -20,18 +21,17 @@ void* iso_open(const char* path) { } int iso_read_sector(void* handle, uint32_t lba, uint8_t* buffer, int size) { - if (!handle) return 0; + if (!handle || !buffer || size < 2048) return 0; auto* reader = static_cast<PS1::ISOReader*>(handle); - (void)size; /* ReadSector always reads 2048 bytes */ - if (!reader->ReadSector(lba, buffer)) return 0; + if (!mod_runtime_read_disc_extent(lba, 0, buffer, size) && !reader->ReadSector(lba, buffer)) return 0; mod_runtime_patch_disc_sector(lba, 0, buffer, 2048); return 1; } int iso_read_raw_sector(void* handle, uint32_t lba, uint8_t* buffer, int size) { - if (!handle || size < 2352) return 0; + if (!handle || !buffer || size < 2352) return 0; auto* reader = static_cast<PS1::ISOReader*>(handle); - if (!reader->ReadRawSector(lba, buffer)) return 0; + if (!mod_runtime_read_disc_extent(lba, 1, buffer, size) && !reader->ReadRawSector(lba, buffer)) return 0; mod_runtime_patch_disc_sector(lba, 1, buffer, 2352); return 1; } @@ -39,6 +39,23 @@ int iso_read_raw_sector(void* handle, uint32_t lba, uint8_t* buffer, int size) { int iso_read_subq(void* handle, uint32_t lba, uint8_t* buffer, int size, int* valid) { if (!handle || !buffer || size < 12 || !valid) return 0; + const auto* reader=static_cast<PS1::ISOReader*>(handle); + const uint32_t start=mod_runtime_disc_extent_start(); + if (start && lba>=start && lba<mod_runtime_disc_sector_count(start)) { + const auto bcd=[](uint32_t v) {return uint8_t((v/10)*16+v%10);}; + std::memset(buffer,0,12);buffer[0]=0x41; + buffer[1]=bcd(reader->TrackCount()+1);buffer[2]=1; + const uint32_t rel=lba-start,abs=lba+150; + buffer[3]=bcd(rel/4500);buffer[4]=bcd(rel/75%60);buffer[5]=bcd(rel%75); + buffer[6]=bcd(abs/4500);buffer[7]=bcd(abs/75%60);buffer[8]=bcd(abs%75); + uint16_t crc=0; + for(unsigned i=0;i<10;++i) { + crc^=uint16_t(buffer[i])<<8; + for(unsigned j=0;j<8;++j)crc=uint16_t((crc<<1)^((crc&0x8000)?0x1021:0)); + } + crc=uint16_t(~crc);buffer[10]=uint8_t(crc);buffer[11]=uint8_t(crc>>8); + *valid=1;return 1; + } bool crc_valid = false; if (!static_cast<PS1::ISOReader*>(handle)->ReadSubChannelQ( lba, buffer, &crc_valid)) return 0; @@ -53,22 +70,25 @@ int iso_has_subq_replacements(void* handle) { uint32_t iso_sector_count(void* handle) { if (!handle) return 0; auto* reader = static_cast<PS1::ISOReader*>(handle); - return reader->GetSectorCount(); + return mod_runtime_disc_sector_count(reader->GetSectorCount()); } /* CD-track TOC accessors (multi-track / CD-DA support). track is 1-based. */ int iso_track_count(void* handle) { if (!handle) return 1; - return static_cast<PS1::ISOReader*>(handle)->TrackCount(); + return static_cast<PS1::ISOReader*>(handle)->TrackCount() + (mod_runtime_disc_extent_start()?1:0); } uint32_t iso_track_start_lba(void* handle, int track) { if (!handle) return 0; - return static_cast<PS1::ISOReader*>(handle)->TrackStartLBA(track); + auto* reader=static_cast<PS1::ISOReader*>(handle); + if (track==reader->TrackCount()+1 && mod_runtime_disc_extent_start()) return mod_runtime_disc_extent_start(); + return reader->TrackStartLBA(track); } uint32_t iso_track_pregap_lba(void* handle, int track) { auto* reader = static_cast<PS1::ISOReader*>(handle); + if (reader && track==reader->TrackCount()+1 && mod_runtime_disc_extent_start()) return mod_runtime_disc_extent_start(); return reader ? reader->TrackPregapLBA(track) : 0; } diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index 6bee3760..ef8ed927 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp @@ -96,6 +96,9 @@ extern "C" void psx_event_step_conservative_env_init(void); #include "mod_plugins.h" #include "mod_session_baseline.h" #include "mod_runtime.h" +#include "mod_packages.h" +#include "present_image_ring.h" +#include "gpu_timeline.h" #include "crc32.h" #include "disc_identity.h" #include "sbi_setup.h" @@ -1040,6 +1043,12 @@ extern "C" void psx_frontend_on_savestate_notify(int is_load, int slot, int ok) host_osd_push(buf, 2000); } +extern "C" void psx_frontend_on_savestate_refused(int is_load, int slot, + const char *reason) { + (void)is_load; (void)slot; + host_osd_push(reason, 3000); +} + extern "C" void psx_frontend_on_savestate_loaded(void) { psx_projection_reset_session(); mod_runtime_on_savestate_loaded(); @@ -1323,6 +1332,11 @@ static int g_hotkey_pad_fast_forward_toggle = 0; /* unbound: latch fas static uint32_t g_savestate_input_guard_min_until = 0; static uint32_t g_savestate_input_guard_max_until = 0; static int g_headless = 0; /* debug/CI frontend: no SDL window/audio */ +/* Test frontend: the full windowed runtime (presenter, frame interpolation, + * render passes) in a window that is never shown. For automated checks of + * presentation features without putting a window on the desktop; drive it + * over TCP like --headless. */ +static int g_hidden_window = 0; /* FMV instant-skip via the game's OWN end-of-movie path. Tomba's MDEC player * (FUN_8001efe8) tears a movie down when the streamed frame number reaches that @@ -1465,8 +1479,7 @@ extern "C" int psx_mod_set_fixed_display_aspect( uint32_t numerator, uint32_t denominator) { if (numerator == 0 || denominator == 0 || numerator > 99 || denominator > 99 || - 3u * numerator < 4u * denominator || - 9u * numerator > 32u * denominator) { + 3u * numerator < 4u * denominator) { std::fprintf(stderr, "psxrecomp: mod rejected invalid display aspect %u:%u\n", (unsigned)numerator, (unsigned)denominator); @@ -1485,8 +1498,7 @@ extern "C" int psx_mod_set_adaptive_display_aspect( const bool uncapped = max_numerator == 0 && max_denominator == 0; if (!uncapped && (max_numerator == 0 || max_denominator == 0 || max_numerator > 99 || max_denominator > 99 || - 3u * max_numerator < 4u * max_denominator || - 9u * max_numerator > 32u * max_denominator)) { + 3u * max_numerator < 4u * max_denominator)) { std::fprintf(stderr, "psxrecomp: mod rejected invalid adaptive display aspect %u:%u\n", (unsigned)max_numerator, (unsigned)max_denominator); @@ -1539,8 +1551,6 @@ extern "C" int psx_mod_set_adaptive_display_aspect( static PSXModSessionBaseline g_mod_owned_baseline; static void reset_mod_owned_presentation(void) { - g_mod_texfilter = -1; - gr_set_texture_filter(g_video_texfilter); PSXModSessionScalars live; live.video_vsync = g_video_vsync; live.frame_interpolation = g_frame_interpolation; @@ -1560,6 +1570,8 @@ static void reset_mod_owned_presentation(void) { g_frame_period_ms = live.frame_period_ms; g_mod_native_vblank_rate = false; g_mod_native_vblank_fps = 0; + g_mod_texfilter = -1; + gr_set_texture_filter(g_video_texfilter); if (!first) { psx_ram_reset_size_request(); psx_mod_set_texture_bank_resolver(nullptr); @@ -2030,6 +2042,15 @@ extern "C" int psx_debug_display_aspect(int num, int den, int adaptive) { return 1; } +/* Resize the game window as a player would (Fit/adaptive widescreen follow the + * resulting window events). For TCP-driven checks of window-shaped behaviour + * in --hidden-window runs. */ +extern "C" int psx_debug_window_size(int w, int h) { + if (!sdl_window || w < 64 || h < 64 || w > 16384 || h > 16384) return 0; + SDL_SetWindowSize(sdl_window, w, h); + return 1; +} + static bool g_gl_active = false; /* GL context live -> GL present path */ static bool g_vk_active = false; /* Vulkan context live -> VK present path */ @@ -2517,18 +2538,21 @@ static void write_cached_path(const char* argv0, const char* filename, f << PSXRecompV4::relative_to_folder(path, exe_dir_from_argv(argv0)).generic_string() << "\n"; } +/* Nobody is at the screen: never block on a modal dialog or a file picker. */ +static bool frontend_unattended() { return g_headless || g_hidden_window; } + static void launcher_warning(const char* title, const std::string& msg) { std::fprintf(stderr, "%s: %s\n", title, msg.c_str()); - // Headless (--headless / PSX_HEADLESS): NEVER pop a blocking modal — it would + // Unattended (--headless / PSX_HEADLESS / --hidden-window): NEVER pop a blocking modal — it would // hang an unattended/CI/scripted run forever waiting for a click. // SDL_ShowSimpleMessageBox is cross-platform; the Win32-only MessageBoxA left // macOS and Linux users with a silent exit (v0.4.0 macOS report, 2026-09-15). - if (!g_headless) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, title, msg.c_str(), NULL); + if (!frontend_unattended()) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, title, msg.c_str(), NULL); } static void launcher_info(const char* title, const std::string& msg) { std::fprintf(stderr, "%s: %s\n", title, msg.c_str()); - if (!g_headless) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, title, msg.c_str(), NULL); + if (!frontend_unattended()) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, title, msg.c_str(), NULL); } /* Game display name for picker dialogs ("Tomba!"); set after the game @@ -2539,7 +2563,8 @@ static bool pick_runtime_file(const char* title, const char* filter, std::filesystem::path& out, const char* cli_flag) { // Headless: never open an interactive file dialog (it blocks). Fail the // resolve so boot aborts cleanly with the stderr message the caller printed. - if (g_headless) { + // Also when unattended in a hidden window (--hidden-window). + if (frontend_unattended()) { std::fprintf(stderr, "psxrecomp: headless — cannot prompt for '%s'.\n" " Supply it on the command line: %s <path> (or set it in game.toml).\n", @@ -4977,12 +5002,10 @@ static int pad_mode_boot_analog(int mode) { return mode == PSXRecompV4::PAD_MODE_ANALOG ? 1 : 0; } -/* Keyboard has no DualShock sticks/config handshake — always present as a - * plain digital pad (SCPH-1080). Leaving keyboard slots in ANALOG/policy mode made - * P2–P5 show as connected while games that expect digital multitap pads never - * saw usable button input. */ +/* Keyboard mappings can drive both DualShock sticks. Honor the configured + * mode, including analog-only title locks; multitap policy belongs to the + * SIO seat below and applies equally to keyboards and physical controllers. */ static int effective_player_mode(const PlayerInput& p) { - if (p.kind == 1) return (int)PSXRecompV4::PAD_MODE_DIGITAL; return p.mode; } @@ -7084,6 +7107,47 @@ struct NetplayVblankEpilogue { }; /* Called from gpu_vblank_tick() at each simulated vblank. */ +#ifndef PSX_NO_DEBUG_TOOLS +/* Headless has no present surface, but automated A/B runs still need the + * frame-indexed record of what a windowed build would show: the displayed + * band of the native-wide surface on a wide game frame, otherwise the 4:3 + * display area. Same classification as the windowed present below. */ +static void headless_present_image_ring_capture(void) { + if (!present_image_ring_accepting()) return; + GpuDisplayInfo di; + gpu_get_display_info(&di); + if (di.disabled || di.width == 0 || di.height == 0 || di.depth24) return; + const bool fmv_frame = !g_ws_engaged || gpu_ws_present_native_43() != 0; + static std::vector<uint32_t> buf; + int w = 0, h = 0; + if (!fmv_frame && ws_native_wide_active() && gr_wide_supported()) { + buf.resize((size_t)1024 * 4 * 512 * 4); + if (gr_wide_dump_full(buf.data(), (int)buf.size(), &w, &h, + (int)di.display_x) > 0 && h >= 512) { + const int s = h / 512; + const int y0 = (int)di.display_y * s, rows = (int)di.height * s; + if (y0 + rows <= h) { + present_image_ring_push_argb((uint32_t)s_frame_count, + buf.data() + (size_t)y0 * w, + w, rows, w); + return; + } + } + } + w = (int)di.width; h = (int)di.height; + buf.resize((size_t)w * h); + for (int y = 0; y < h; y++) + for (int x = 0; x < w; x++) { + const uint16_t p = gpu_vram_peek((int)(di.display_x + x), + (int)(di.display_y + y)); + buf[(size_t)y * w + x] = 0xFF000000u | ((uint32_t)(p & 31) << 19) | + ((uint32_t)((p >> 5) & 31) << 11) | + ((uint32_t)((p >> 10) & 31) << 3); + } + present_image_ring_push_argb((uint32_t)s_frame_count, buf.data(), w, h, w); +} +#endif + static NetplayVblankEpilogue sdl_vblank_present_body(void) { NetplayVblankEpilogue ep{}; /* Guest quantum for this vblank is complete. Drop top-level-resume armed @@ -7303,6 +7367,17 @@ static NetplayVblankEpilogue sdl_vblank_present_body(void) { (int)mod)) { fast_forward_toggle_flip(); } + else if (!key_repeat && + host_keymap_match_event(HOST_KEYMAP_CAPTURE_MARK, + (int)key, (int)scancode, + (int)mod)) { +#ifndef PSX_NO_DEBUG_TOOLS + debug_server_capture_mark(); + host_osd_push("Capture marked (debug rings frozen)", 2000); +#else + host_osd_push("Capture mark needs a debug-tools build", 2000); +#endif + } else if (!key_repeat && host_keymap_match_event(HOST_KEYMAP_DISPLAY_PERF, (int)key, (int)scancode, @@ -7525,14 +7600,34 @@ static NetplayVblankEpilogue sdl_vblank_present_body(void) { s_presentation_fast_forward = (turbo_loads_active || fmv_skip_active) ? 1 : 0; - if (g_headless) { - /* Headless skips the presenter below, but still needs the same - * game-entry widescreen activation for its rendered frame dumps. */ - if (!g_ws_engaged && fntrace_is_game_started()) { + /* Guest-affecting per-frame services run on EVERY guest frame, before any + * presentation early-out (headless, TCP turbo, load/FMV present skips). + * Widescreen engagement changes GTE projection and cull margins, and mod + * frame hooks may touch guest state, so neither may depend on whether this + * frame is presented — otherwise headless validation runs a different game + * than the windowed build. Hooks still run after all normal input sampling. */ + mod_call_frame_hooks(); + + /* Resize-driven mode updates the pending aspect during BIOS boot too, but + * the actual wide compositor remains disengaged until game entry. No-op + * without a window. */ + update_adaptive_widescreen(); + + /* Engage widescreen at game entry: BIOS boot stays authentic 4:3. */ + if (!g_ws_engaged) { + if (fntrace_is_game_started()) { g_ws_engaged = true; g_ws_projection_mode = -1; + refresh_widescreen_projection(); } + } else { refresh_widescreen_projection(); + } + + if (g_headless) { +#ifndef PSX_NO_DEBUG_TOOLS + headless_present_image_ring_capture(); +#endif ep.skip_pace = 1; return ep; } @@ -7703,13 +7798,6 @@ static NetplayVblankEpilogue sdl_vblank_present_body(void) { } } - /* Mod hooks. Run after all normal input sampling. */ - mod_call_frame_hooks(); - - /* Resize-driven mode updates the pending aspect during BIOS boot too, but - * the actual wide compositor remains disengaged until game entry. */ - update_adaptive_widescreen(); - /* Depth24 GP1(07h) retarget (MotK intro→crawl): keep the prior Swap for a * few vblanks so stale trailing VRAM never flashes on the right edge. * Must tick every present — gpu.c arms s_d24_present_hold and also @@ -7717,16 +7805,6 @@ static NetplayVblankEpilogue sdl_vblank_present_body(void) { * sticks and depth24_fix_trailing_margin blanks the whole FMV forever. */ if (gpu_depth24_present_hold_tick()) return ep; - /* Engage widescreen at game entry: BIOS boot stays authentic 4:3. */ - if (!g_ws_engaged) { - if (fntrace_is_game_started()) { - g_ws_engaged = true; - g_ws_projection_mode = -1; - refresh_widescreen_projection(); - } - } else { - refresh_widescreen_projection(); - } /* Rollback resim (§33/§47): short catch-up keeps hold-last; long catch-up * periodically presents live Replay VRAM so the display shows progress @@ -8126,6 +8204,17 @@ static NetplayVblankEpilogue sdl_vblank_present_body(void) { SDL_Rect src = { 0, 0, src_w, src_h }; SDL_UpdateTexture(sdl_texture, &src, sdl_pixel_buf, (int)(src_w * sizeof(uint32_t))); +#ifndef PSX_NO_DEBUG_TOOLS + /* Presented-image ring (software/CPU present): the frame being shown. */ + present_image_ring_push_argb((uint32_t)s_frame_count, sdl_pixel_buf, + (int)src_w, (int)src_h, (int)src_w); +#endif + { + GpuDisplayInfo tdi; + gpu_get_display_info(&tdi); + gpu_timeline_note(GTL_PRESENT, GTL_PATH_CPU, + tdi.display_x | ((uint32_t)tdi.display_y << 16)); + } /* Short FMV bands only update [0..src_h). Linear sampling at the bottom * edge blends with uninitialized texels below (X11 SDL backends often * show that as a thin white strip; Wayland may not). Pad one black row @@ -13438,6 +13527,32 @@ int main(int argc, char** argv) { launcher_boot_timing_mark("host:main_enter"); #endif + /* --audit-mod-plugins <manifest-root>...: build-time check, no emulation. + * Every trusted implementation this executable registered must be named + * by some authored manifest [[plugin]] id, or the plan can never activate + * it. Exit 0 when all are declared, 1 otherwise (ctest per title). */ + for (int i = 1; i < argc; i++) { + if (std::strcmp(argv[i], "--audit-mod-plugins") != 0) continue; + std::vector<std::filesystem::path> roots; + for (int j = i + 1; j < argc && std::strncmp(argv[j], "--", 2) != 0; j++) + roots.emplace_back(argv[j]); + const PSXRecompV4::ModPluginAudit audit = + PSXRecompV4::mod_audit_registered_plugins(roots); + const std::vector<std::string> registered = + PSXRecompV4::mod_registered_plugin_ids(); + std::fprintf(stdout, "mod plugin audit: %zu manifest(s), %zu declared id(s), " + "%zu registered id(s)\n", audit.manifests, + audit.declared.size(), registered.size()); + for (const std::string& e : audit.errors) + std::fprintf(stdout, " manifest error: %s\n", e.c_str()); + for (const std::string& id : audit.undeclared) + std::fprintf(stdout, " UNDECLARED (can never run): %s\n", id.c_str()); + const bool ok = roots.size() > 0 && audit.errors.empty() && + audit.undeclared.empty(); + std::fprintf(stdout, "mod plugin audit: %s\n", ok ? "PASS" : "FAIL"); + return ok ? 0 : 1; + } + /* Setup-host zip-root exe: after Generate & rebuild, hand off to the * product binary under build-release/ (bios/, mods/, assets/, settings). */ #if defined(PSX_HAS_CODEGEN_SETUP_HOST) @@ -13516,6 +13631,8 @@ int main(int argc, char** argv) { * --launcher force the GUI launcher (overrides skip_launcher) * --no-launcher skip the GUI launcher (boot straight in) * --headless skip SDL window/audio; use TCP screenshots/state + * --hidden-window full presenter in a never-shown window (TCP-driven + * tests of interpolation / render passes) * --netplay enable delay-sync LAN (also PSX_NETPLAY=1) * --net-slot N local player slot (0|1) * --net-input-player N host device to sample (0=P1, 1=P2; default auto) @@ -13557,6 +13674,9 @@ int main(int argc, char** argv) { } else if (std::strcmp(argv[i], "--headless") == 0) { g_headless = 1; force_no_launcher = true; + } else if (std::strcmp(argv[i], "--hidden-window") == 0) { + g_hidden_window = 1; + force_no_launcher = true; } else if (std::strcmp(argv[i], "--netplay") == 0) { net_cfg.enabled = 1; } else if (std::strcmp(argv[i], "--net-slot") == 0 && i + 1 < argc) { @@ -13977,6 +14097,18 @@ int main(int argc, char** argv) { gpu_ws_set_masked_reject_sites(addresses.data(), expected.data(), masks.data(), (int)addresses.size()); } + { + std::vector<uint32_t> addresses, expected, operands, halves; + for (const auto& site : gc.ws_cull_scale_sites) { + addresses.push_back(site.address); + expected.push_back(site.expected); + operands.push_back(site.operand); + halves.push_back(site.half_extent); + } + gpu_ws_set_cull_scale_sites( + addresses.data(), expected.data(), operands.data(), + halves.data(), (int)addresses.size()); + } { std::vector<uint32_t> addresses, expected; addresses.reserve(gc.ws_cull_angle_sites.size()); @@ -15965,13 +16097,20 @@ session_reboot: } else { /* Select the renderer backend BEFORE gpu_init() (which runs gr_init -> * the backend's init on the VRAM buffer). Software is the default and - * the fallback; an unavailable OpenGL backend reverts to software. */ - gr_set_backend(g_video_renderer == 2 ? GR_BACKEND_VULKAN : - g_video_renderer == 1 ? GR_BACKEND_OPENGL : - GR_BACKEND_SOFTWARE); - std::fprintf(stdout, "psxrecomp: renderer backend requested: %s\n", - g_video_renderer == 2 ? "vulkan" : - g_video_renderer == 1 ? "opengl" : "software"); + * the fallback; an unavailable OpenGL backend reverts to software. + * Headless never creates a window or GPU context, so a GPU backend + * would only rasterize through its software fallback while refusing + * the context-bound services (native-wide compositing, hi-res + * readback). Select the software backend it would really run, so + * headless validation exercises the same wide compositor as a window. */ + const int backend_renderer = g_headless ? 0 : g_video_renderer; + gr_set_backend(backend_renderer == 2 ? GR_BACKEND_VULKAN : + backend_renderer == 1 ? GR_BACKEND_OPENGL : + GR_BACKEND_SOFTWARE); + std::fprintf(stdout, "psxrecomp: renderer backend requested: %s%s\n", + backend_renderer == 2 ? "vulkan" : + backend_renderer == 1 ? "opengl" : "software", + g_headless && g_video_renderer != 0 ? " (headless)" : ""); } gpu_init(); /* Internal-resolution supersampling (SSAA). Must follow gpu_init. @@ -16455,6 +16594,11 @@ session_reboot: win_flags |= PSX_SDL_WINDOW_HIGH_DENSITY; } if (g_video_renderer == 2) win_flags |= SDL_WINDOW_VULKAN; + if (g_hidden_window) { + win_flags &= ~(Uint32)SDL_WINDOW_SHOWN; + win_flags |= SDL_WINDOW_HIDDEN; + g_fullscreen = 0; + } /* Fullscreen on launch (launcher's tri-state Fullscreen control): 1 = * borderless desktop fullscreen (keeps the desktop resolution, letterboxes * the image), 2 = exclusive fullscreen (real display-mode change), 0 = diff --git a/runtime/src/mod_guest_services.c b/runtime/src/mod_guest_services.c new file mode 100644 index 00000000..141a5b4e --- /dev/null +++ b/runtime/src/mod_guest_services.c @@ -0,0 +1,96 @@ +/* Guest services for seamless-loading adapters (mod_plugins.h). Each is the + * one shared implementation of an effect several titles' adapters need; see + * the header for the contract. */ +#include "mod_plugins.h" +#include "cpu_state.h" +#include "dma.h" +#include "gpu.h" +#include "interrupts.h" +#include "psx_memory.h" +#include "spu.h" +#include <string.h> + +uint32_t psx_mod_call_guest(struct CPUState* cpu, uint32_t function, + uint32_t return_address, uint32_t a0, uint32_t a1, + uint32_t a2, uint32_t a3) { + uint32_t regs[32]; + const uint32_t pc = cpu->pc, hi = cpu->hi, lo = cpu->lo; + memcpy(regs, cpu->gpr, sizeof regs); + cpu->gpr[4] = a0; + cpu->gpr[5] = a1; + cpu->gpr[6] = a2; + cpu->gpr[7] = a3; + cpu->gpr[31] = return_address; + psx_snapshot_host_call_begin(); + psx_dispatch_call(cpu, function, return_address); + const uint32_t result = cpu->gpr[2]; + memcpy(cpu->gpr, regs, sizeof regs); + cpu->pc = pc; + cpu->hi = hi; + cpu->lo = lo; + psx_snapshot_host_call_end(); + return result; +} + +int psx_mod_dma_write_ram(uint32_t address, const void* data, uint32_t bytes, + int lba) { + return dma_host_cdrom_write(address, (const uint8_t*)data, bytes, lba); +} + +static int ram_span(uint32_t address, uint32_t bytes) { + const uint32_t phys = address & 0x1FFFFFFFu; + const uint32_t live = psx_ram_live_bytes(); + return address < 0xC0000000u && phys < live && bytes <= live - phys; +} + +int psx_mod_host_write_ram(uint32_t address, const void* data, uint32_t bytes) { + const uint8_t* p = (const uint8_t*)data; + if ((!p && bytes) || !ram_span(address, bytes)) return 0; + while (bytes && (address & 3u)) { psx_host_write_byte(address++, *p++); --bytes; } + for (; bytes >= 4; address += 4, p += 4, bytes -= 4) { + uint32_t word; + memcpy(&word, p, 4); + psx_host_write_word(address, word); + } + while (bytes--) psx_host_write_byte(address++, *p++); + return 1; +} + +#define SPU_RAM_BYTES 0x80000u +#define SPU_TRANSFER_ADDR 0x1F801DA6u +#define SPU_CONTROL 0x1F801DAAu + +int psx_mod_spu_upload(uint32_t spu_address, uint32_t guest_source, + uint32_t bytes, int stop_after) { + if ((spu_address & 7u) || (guest_source & 3u) || (bytes & 3u) || + spu_address >= SPU_RAM_BYTES || bytes > SPU_RAM_BYTES || + !ram_span(guest_source, bytes)) + return 0; + spu_write(SPU_TRANSFER_ADDR, spu_address >> 3); + const uint16_t control = spu_ctrl_read(); + spu_write(SPU_CONTROL, (control & ~0x30u) | 0x20u); + for (uint32_t i = 0; i < bytes; i += 4u) spu_dma_write(psx_mod_read_word(guest_source + i)); + if (stop_after) spu_write(SPU_CONTROL, control & ~0x30u); + return 1; +} + +int psx_mod_psyq_load_image(uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t guest_source) { + if (!w || w > 1024u || !h || h > 512u || x >= 1024u || y >= 512u || + (guest_source & 3u)) + return 0; + const uint32_t words = (w * h + 1u) / 2u; + if (!ram_span(guest_source, words * 4u)) return 0; + gpu_set_gp0_source(guest_source); + gpu_write_gp1(0x04000000u); + gpu_write_gp0(0x01000000u); + gpu_write_gp0(0xA0000000u); + gpu_write_gp0(x | (y << 16)); + gpu_write_gp0(w | (h << 16)); + for (uint32_t i = 0; i < words; i++) { + gpu_set_gp0_source(guest_source + 4u * i); + gpu_write_gp0(psx_mod_read_word(guest_source + 4u * i)); + } + if (words >= 16u) gpu_write_gp1(0x04000002u); + return 1; +} diff --git a/runtime/src/mod_media.cpp b/runtime/src/mod_media.cpp new file mode 100644 index 00000000..b5793afd --- /dev/null +++ b/runtime/src/mod_media.cpp @@ -0,0 +1,118 @@ +#include "mod_media.h" +#include "iso_reader.h" +#include "psx_sha256.h" + +#include <algorithm> +#include <array> +#include <cstring> +#include <fstream> +#include <stdexcept> + +namespace PSXRecompV4 { +namespace { +constexpr uint64_t kMaxMediaBytes = 512ull * 1024 * 1024; + +uint32_t le32(const uint8_t* p) { + return uint32_t(p[0]) | (uint32_t(p[1]) << 8) | + (uint32_t(p[2]) << 16) | (uint32_t(p[3]) << 24); +} +uint32_t be32(const uint8_t* p) { + return uint32_t(p[3]) | (uint32_t(p[2]) << 8) | + (uint32_t(p[1]) << 16) | (uint32_t(p[0]) << 24); +} + +void read_disc_sector(PS1::ISOReader& reader, uint32_t lba, uint8_t* out) { + std::array<uint8_t, 2352> raw{}; + if (reader.ReadRawSector(lba, raw.data())) { + if (raw[15] != 1 && raw[15] != 2) + throw std::runtime_error("donor volume contains a non-data sector"); + std::memcpy(out, raw.data() + (raw[15] == 1 ? 16 : 24), 2048); + } else if (!reader.ReadSector(lba, out)) { + throw std::runtime_error("cannot read donor volume sector"); + } +} +} // namespace + +bool load_mod_media(const std::filesystem::path& path, + const std::string& format, uint64_t expected_size, + const std::string& expected_sha256, + std::shared_ptr<const std::vector<uint8_t>>& bytes, + std::string* error) { + bytes.reset(); + if (error) error->clear(); + try { + if (!expected_size || expected_size > kMaxMediaBytes || + expected_sha256.size() != 64 || + !std::all_of(expected_sha256.begin(), expected_sha256.end(), + [](char c) { return (c >= '0' && c <= '9') || + (c >= 'a' && c <= 'f'); })) + throw std::runtime_error("invalid donor size or SHA-256"); + auto data = std::make_shared<std::vector<uint8_t>>(); + if (format == "psx-disc") { + PS1::ISOReader reader; + if (!reader.Open(path.string())) + throw std::runtime_error("cannot open donor disc"); + std::array<uint8_t, 2048> pvd{}; + read_disc_sector(reader, 16, pvd.data()); + if (pvd[0] != 1 || std::memcmp(pvd.data() + 1, "CD001", 5) || + pvd[6] != 1 || pvd[128] != 0 || pvd[129] != 8 || + pvd[130] != 8 || pvd[131] != 0) + throw std::runtime_error("donor disc is not a 2048-byte ISO9660 volume"); + const uint32_t declared_count = le32(pvd.data() + 80); + /* Retail mixed-mode discs may declare the whole disc, including + * audio, as their ISO volume size. The actual data-track boundary + * comes from the TOC or the single-file image length. */ + const uint32_t count = reader.TrackCount() > 1 + ? reader.TrackPregapLBA(2) : reader.GetSectorCount(); + if (reader.TrackIsAudio(1) || reader.TrackStartLBA(1) != 0 || + declared_count != be32(pvd.data() + 84) || declared_count < count || + count <= 16 || uint64_t(count) * 2048 != expected_size) + throw std::runtime_error("donor data-track size does not match"); + data->resize(static_cast<size_t>(expected_size)); + for (uint32_t i = 0; i < count; ++i) + read_disc_sector(reader, i, data->data() + size_t(i) * 2048); + } else if (format == "file" || format == "n64-rom") { + if (std::filesystem::file_size(path) != expected_size) + throw std::runtime_error("donor file size does not match"); + if (format == "n64-rom" && + (expected_size < 64 || expected_size % 4 || expected_size > 64ull * 1024 * 1024)) + throw std::runtime_error("invalid N64 ROM size"); + std::ifstream input(path, std::ios::binary); + data->resize(static_cast<size_t>(expected_size)); + if (!input.read(reinterpret_cast<char*>(data->data()), + static_cast<std::streamsize>(expected_size)) || + input.peek() != std::char_traits<char>::eof()) + throw std::runtime_error("cannot read complete donor file"); + if (format == "n64-rom") { + const uint32_t magic = be32(data->data()); + if (magic == 0x37804012) { + for (size_t i = 0; i < data->size(); i += 2) + std::swap((*data)[i], (*data)[i + 1]); + } else if (magic == 0x40123780) { + for (size_t i = 0; i < data->size(); i += 4) + std::reverse(data->begin() + i, data->begin() + i + 4); + } else if (magic != 0x80371240) { + throw std::runtime_error("unrecognized N64 ROM byte order"); + } + } + } else { + throw std::runtime_error("unsupported donor media format"); + } + uint8_t digest[32]; + psx_sha256_compute(data->data(), data->size(), digest); + static const char hex[] = "0123456789abcdef"; + std::string actual(64, '0'); + for (size_t i = 0; i < 32; ++i) { + actual[i * 2] = hex[digest[i] >> 4]; + actual[i * 2 + 1] = hex[digest[i] & 15]; + } + if (actual != expected_sha256) + throw std::runtime_error("donor SHA-256 does not match"); + bytes = std::move(data); + return true; + } catch (const std::exception& e) { + if (error) *error = e.what(); + return false; + } +} +} // namespace PSXRecompV4 diff --git a/runtime/src/mod_packages.cpp b/runtime/src/mod_packages.cpp index 82839aa4..83a6f414 100644 --- a/runtime/src/mod_packages.cpp +++ b/runtime/src/mod_packages.cpp @@ -2,6 +2,7 @@ #include "crc32.h" #include "mod_plugins.h" +#include "mod_media.h" #include "psx_sha256.h" #include "toml.hpp" @@ -23,7 +24,7 @@ namespace PSXRecompV4 { namespace { constexpr uint32_t kMinFormatVersion = 1; -constexpr uint32_t kMaxFormatVersion = 7; +constexpr uint32_t kMaxFormatVersion = 8; constexpr uint64_t kMaxArchiveBytes = 256ull * 1024ull * 1024ull; constexpr uint32_t kMaxArchiveFiles = 4096; @@ -33,6 +34,7 @@ std::map<std::string, ModBuiltinResolver>& builtin_resolvers() { } struct RegisteredPlugin { + void (*savestate)(void) = nullptr; PSXModActivationCallback activation = nullptr; PSXModVBlankCallback vblank = nullptr; /* Generated-function entry hooks, keyed by guest address. One id may @@ -762,7 +764,13 @@ std::string canonical_resolution(const std::vector<const ModPackage*>& ordered, } for (const ModResolution::Resource& resource : resources) { out << "resource:" << resource.package_id << ':' << resource.feature_id - << ':' << resource.id << '=' << resource.path.string() << '\n'; + << ':' << resource.id << '='; + if (resource.bytes) + out << resource.format << ':' << resource.bytes->size() << ':' + << resource.sha256; + else + out << resource.path.string(); + out << '\n'; } return out.str(); } @@ -1479,7 +1487,7 @@ bool mod_register_function_filter_plugin(const std::string& id, uint32_t address bool mod_plugin_registered(const std::string& id) { const auto found = registered_plugins().find(id); return found != registered_plugins().end() && - (found->second.activation || found->second.vblank || + (found->second.activation || found->second.vblank || found->second.savestate || !found->second.function_entries.empty() || !found->second.guest_functions.empty() || !found->second.instructions.empty()); } @@ -1493,7 +1501,7 @@ bool mod_register_guest_function_plugin(const std::string& id, uint32_t address, for (const auto& plugin : registered_plugins()) for (const auto& function : plugin.second.guest_functions) if (function.address == key) return false; - registered_plugins()[id].guest_functions.push_back({key, callback}); + registered_plugins()[id].guest_functions.push_back({key, callback, nullptr}); return true; } @@ -1521,6 +1529,20 @@ std::vector<ModInstructionHook> mod_instruction_hooks(const std::string& id) { ? std::vector<ModInstructionHook>{} : found->second.instructions; } +bool mod_register_savestate_plugin(const std::string& id, void (*callback)(void)) { + if (!valid_id(id) || !callback) return false; + RegisteredPlugin& plugin = registered_plugins()[id]; + if (plugin.savestate) return false; + plugin.savestate = callback; + return true; +} + +void mod_invoke_savestate_plugin(const std::string& id) { + const auto found = registered_plugins().find(id); + if (found != registered_plugins().end() && found->second.savestate) + found->second.savestate(); +} + void mod_invoke_activation_plugin(const std::string& id) { const auto found = registered_plugins().find(id); if (found != registered_plugins().end() && found->second.activation) @@ -1544,6 +1566,47 @@ void mod_clear_plugins_for_tests() { registered_plugins().clear(); } +std::vector<std::string> mod_registered_plugin_ids() { + std::vector<std::string> ids; + for (const auto& entry : registered_plugins()) + if (entry.second.activation || entry.second.vblank || + !entry.second.function_entries.empty() || !entry.second.guest_functions.empty()) + ids.push_back(entry.first); + return ids; /* std::map keeps them sorted */ +} + +ModPluginAudit mod_audit_registered_plugins( + const std::vector<fs::path>& manifest_roots) { + ModPluginAudit audit; + std::set<std::string> declared; + for (const fs::path& root : manifest_roots) { + std::error_code ec; + if (!fs::is_directory(root, ec)) { + audit.errors.push_back(root.string() + ": not a directory"); + continue; + } + for (fs::recursive_directory_iterator it(root, ec), end; + !ec && it != end; it.increment(ec)) { + if (!it->is_regular_file(ec) || it->path().filename() != "manifest.toml") + continue; + ModPackage package; + std::string error; + if (!ModPackageManager::read_manifest(it->path(), package, &error)) { + audit.errors.push_back(it->path().string() + ": " + error); + continue; + } + ++audit.manifests; + for (const ModPlugin& plugin : package.plugins) + declared.insert(plugin.id); + } + if (ec) audit.errors.push_back(root.string() + ": " + ec.message()); + } + audit.declared.assign(declared.begin(), declared.end()); + for (const std::string& id : mod_registered_plugin_ids()) + if (!declared.count(id)) audit.undeclared.push_back(id); + return audit; +} + const char* mod_channel_name(ModChannel channel) { switch (channel) { case ModChannel::Experimental: return "experimental"; @@ -1843,6 +1906,19 @@ bool ModPackageManager::read_manifest(const fs::path& path, ModPackage& out, toml::find_or<std::string>(v, "format", "file"); resource.required = toml::find_or<bool>(v, "required", false); + if (v.contains("size") || v.contains("sha256") || + resource.format == "n64-rom" || resource.format == "psx-disc") { + if (out.format_version < 8) + throw std::runtime_error("verified media requires format_version 8"); + const int64_t size = toml::find<int64_t>(v, "size"); + resource.sha256 = toml::find<std::string>(v, "sha256"); + if (size <= 0 || size > 512ll * 1024 * 1024 || + !valid_sha256(resource.sha256) || + (resource.format != "file" && resource.format != "n64-rom" && + resource.format != "psx-disc")) + throw std::runtime_error("invalid verified media identity or format"); + resource.size = static_cast<uint64_t>(size); + } if (!find_feature(out, resource.feature_id)) throw std::runtime_error( "resource references unknown feature"); @@ -1855,9 +1931,11 @@ bool ModPackageManager::read_manifest(const fs::path& path, ModPackage& out, throw std::runtime_error("resource label is empty"); if (resource.format != "file" && resource.format != "directory" && - resource.format != "folder") + resource.format != "folder" && + resource.format != "n64-rom" && + resource.format != "psx-disc") throw std::runtime_error( - "resource format must be file or directory"); + "unsupported resource format"); out.resources.push_back(std::move(resource)); } } @@ -3740,6 +3818,17 @@ ModResolution ModPackageManager::resolve(const std::string& game_id, resolved.feature_id = resource.feature_id; resolved.id = resource.id; resolved.path = path; + resolved.format = resource.format; + resolved.sha256 = resource.sha256; + if (!resource.sha256.empty()) { + std::string media_error; + if (!load_mod_media(path, resource.format, resource.size, + resource.sha256, resolved.bytes, &media_error)) { + result.errors.push_back(package->id + "/" + resource.feature_id + + ": " + resource.id + ": " + media_error); + continue; + } + } result.resources.push_back(std::move(resolved)); } } @@ -3953,3 +4042,9 @@ extern "C" int psx_mod_register_activation_plugin( return id && PSXRecompV4::mod_register_activation_plugin(id, callback) ? 1 : 0; } + +extern "C" int psx_mod_register_savestate_plugin( + const char* id, PSXModActivationCallback callback) { + return id && + PSXRecompV4::mod_register_savestate_plugin(id, callback) ? 1 : 0; +} diff --git a/runtime/src/mod_resident.cpp b/runtime/src/mod_resident.cpp new file mode 100644 index 00000000..e0292481 --- /dev/null +++ b/runtime/src/mod_resident.cpp @@ -0,0 +1,540 @@ +/* Resident disc resources for seamless-loading adapters (mod_resident.h). + * + * Pack file (little endian): + * "PSXRES01", u32 version, u32 files, u32 derived, u32 blobs, + * u8 key[32], u64 payload_bytes, + * files[] {u32 lba, size, padded, stock, blob} + * derived[] {u32 file, tag, meta[4], blob} + * blobs[] {u64 offset, u32 size, u32 zero, u8 sha256[32]} + * u8 table_sha256[32] (everything above), payload. + * Every blob is hashed again on load. Identical bytes share one blob. */ +#include "mod_resident.h" +#include "mod_plugins.h" +#include "mod_runtime.h" +#include "psx_sha256.h" + +#include <algorithm> +#include <array> +#include <cctype> +#include <chrono> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <filesystem> +#include <fstream> +#include <map> +#include <memory> +#include <stdexcept> +#include <string> +#include <system_error> +#include <vector> +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#ifndef NOMINMAX +#define NOMINMAX +#endif +#include <windows.h> +#else +#include <unistd.h> +#endif + +namespace { + +using Bytes = std::vector<uint8_t>; +using Digest = std::array<uint8_t, 32>; + +constexpr char kMagic[8] = {'P', 'S', 'X', 'R', 'E', 'S', '0', '1'}; +constexpr uint32_t kVersion = 1; +constexpr uint32_t kBlobAlign = 16; +constexpr uint32_t kFullCd = 360000u * 2048u; +constexpr uint64_t kMaxPackBytes = 1ull << 31; + +struct FileRec { uint32_t lba, size, padded, stock, blob; }; +struct DerivedRec { uint32_t file, tag, meta[4], blob; }; +struct Blob { uint64_t offset; uint32_t size; Digest sha; }; + +} // namespace + +struct PSXResidentPack { + Bytes payload; + std::vector<FileRec> files; + std::vector<DerivedRec> derived; + std::vector<Blob> blobs; + std::vector<uint32_t> by_lba; /* file indices sorted by lba */ + uint32_t modified = 0; +}; + +struct PSXResidentSink { + PSXResidentPack* pack; + std::map<Digest, uint32_t> index; + uint32_t file_count; + std::string error; +}; + +namespace { + +struct Record { + std::string title, format, state, error, path; + std::unique_ptr<PSXResidentPack> pack; + double ms = 0; +}; +std::vector<Record>& records() { + static std::vector<Record> r; + return r; +} + +Digest sha(const uint8_t* p, size_t n) { + Digest d; + psx_sha256_compute(p, n, d.data()); + return d; +} +std::string hex(const uint8_t* d, size_t n = 32) { + std::string out(n * 2, '0'); + static const char* digits = "0123456789abcdef"; + for (size_t i = 0; i < n; i++) { + out[2 * i] = digits[d[i] >> 4]; + out[2 * i + 1] = digits[d[i] & 15]; + } + return out; +} + +void put32(Bytes& b, uint32_t v) { for (int i = 0; i < 4; i++) b.push_back(uint8_t(v >> (8 * i))); } +void put64(Bytes& b, uint64_t v) { for (int i = 0; i < 8; i++) b.push_back(uint8_t(v >> (8 * i))); } +uint32_t get32(const uint8_t* p) { + return uint32_t(p[0]) | uint32_t(p[1]) << 8 | uint32_t(p[2]) << 16 | uint32_t(p[3]) << 24; +} +uint64_t get64(const uint8_t* p) { return uint64_t(get32(p)) | uint64_t(get32(p + 4)) << 32; } + +bool valid_spec(const PSXResidentSpec* s) { + if (!s || s->struct_size < sizeof(PSXResidentSpec) || !s->title || !*s->title || + !s->format || !*s->format || !s->files || !s->file_count || + s->policy > PSX_RESIDENT_REQUIRE_STOCK) + return false; + for (const char* p = s->format; *p; ++p) + if (!(std::isalnum((unsigned char)*p) || *p == '-' || *p == '_' || *p == '.')) return false; + for (const char* p = s->title; *p; ++p) + if (*p == '/' || *p == '\\' || *p == ':' || *p == '.') return false; + for (uint32_t i = 0; i < s->file_count; i++) { + const auto& f = s->files[i]; + if (!f.path || !*f.path) return false; + if (f.stock_sha256 && std::strlen(f.stock_sha256) != 64) return false; + } + return true; +} + +Digest cache_key(const PSXResidentSpec* s, const std::string& fingerprint) { + psx_sha256_ctx ctx; + psx_sha256_init(&ctx); + auto text = [&](const std::string& t) { + psx_sha256_update(&ctx, reinterpret_cast<const uint8_t*>(t.c_str()), t.size() + 1); + }; + text("PSXRES01"); + text(fingerprint); + text(s->title); + text(s->format); + text(std::to_string(s->policy) + "/" + std::to_string(s->max_file_bytes)); + for (uint32_t i = 0; i < s->file_count; i++) { + const auto& f = s->files[i]; + text(f.path); + text(std::to_string(f.stock_size)); + text(f.stock_sha256 ? f.stock_sha256 : ""); + } + Digest d; + psx_sha256_final(&ctx, d.data()); + return d; +} + +std::filesystem::path cache_dir(const char* title) { + if (const char* p = std::getenv("PSX_RESIDENT_CACHE")) + if (*p) return std::filesystem::path(p) / title; + std::filesystem::path root; +#ifdef _WIN32 + if (const char* p = std::getenv("LOCALAPPDATA")) root = p; +#else + if (const char* p = std::getenv("XDG_CACHE_HOME")) root = p; + else if (const char* p = std::getenv("HOME")) root = std::filesystem::path(p) / ".cache"; +#endif + if (root.empty()) throw std::runtime_error("no cache directory"); + return root / title / "seamless"; +} + +uint32_t add_blob(PSXResidentSink& sink, const uint8_t* p, uint32_t n) { + const Digest d = sha(p, n); + auto it = sink.index.find(d); + if (it != sink.index.end()) return it->second; + auto& pack = *sink.pack; + uint64_t offset = (pack.payload.size() + kBlobAlign - 1) & ~uint64_t(kBlobAlign - 1); + if (offset + n > kMaxPackBytes) throw std::runtime_error("pack size limit"); + pack.payload.resize(size_t(offset)); + pack.payload.insert(pack.payload.end(), p, p + n); + pack.blobs.push_back({offset, n, d}); + const uint32_t id = uint32_t(pack.blobs.size() - 1); + sink.index.emplace(d, id); + return id; +} + +void index_lba(PSXResidentPack& pack) { + pack.by_lba.resize(pack.files.size()); + for (uint32_t i = 0; i < pack.by_lba.size(); i++) pack.by_lba[i] = i; + std::sort(pack.by_lba.begin(), pack.by_lba.end(), + [&](uint32_t a, uint32_t b) { return pack.files[a].lba < pack.files[b].lba; }); + pack.modified = 0; + for (const auto& f : pack.files) pack.modified += f.stock ? 0 : 1; +} + +std::unique_ptr<PSXResidentPack> build(const PSXResidentSpec* s, std::string& error) { + auto pack = std::make_unique<PSXResidentPack>(); + PSXResidentSink sink{pack.get(), {}, s->file_count, {}}; + const uint32_t max = s->max_file_bytes ? s->max_file_bytes : kFullCd; + Bytes data; + for (uint32_t i = 0; i < s->file_count; i++) { + const auto& f = s->files[i]; + uint32_t lba = 0, size = 0; + if (!PSXRecompV4::mod_runtime_read_disc_file_sectors(f.path, max, data, lba, size, &error)) + return nullptr; + int stock = 0; + if (f.stock_sha256) + stock = (!f.stock_size || f.stock_size == size) && + hex(sha(data.data(), data.size()).data()) == f.stock_sha256; + if (!stock && s->policy == PSX_RESIDENT_REQUIRE_STOCK && f.stock_sha256) { + error = std::string(f.path) + ": differs from the original disc"; + return nullptr; + } + const uint32_t blob = add_blob(sink, data.data(), uint32_t(data.size())); + pack->files.push_back({lba, size, uint32_t(data.size()), uint32_t(stock), blob}); + if (s->derive) { + const size_t before = pack->derived.size(); + if (!s->derive(&sink, i, data.data(), uint32_t(data.size()), stock, s->derive_user)) { + error = sink.error.empty() ? std::string(f.path) + ": derive failed" : sink.error; + return nullptr; + } + for (size_t d = before; d < pack->derived.size(); d++) + if (pack->derived[d].file != i) { + error = std::string(f.path) + ": derived blob names another file"; + return nullptr; + } + } + } + index_lba(*pack); + return pack; +} + +Bytes table(const PSXResidentPack& p, const Digest& key) { + Bytes t(kMagic, kMagic + 8); + put32(t, kVersion); + put32(t, uint32_t(p.files.size())); + put32(t, uint32_t(p.derived.size())); + put32(t, uint32_t(p.blobs.size())); + t.insert(t.end(), key.begin(), key.end()); + put64(t, p.payload.size()); + for (const auto& f : p.files) { + put32(t, f.lba); put32(t, f.size); put32(t, f.padded); put32(t, f.stock); put32(t, f.blob); + } + for (const auto& d : p.derived) { + put32(t, d.file); put32(t, d.tag); + for (uint32_t m : d.meta) put32(t, m); + put32(t, d.blob); + } + for (const auto& b : p.blobs) { + put64(t, b.offset); put32(t, b.size); put32(t, 0); + t.insert(t.end(), b.sha.begin(), b.sha.end()); + } + const Digest d = sha(t.data(), t.size()); + t.insert(t.end(), d.begin(), d.end()); + return t; +} + +void publish(const std::filesystem::path& path, const PSXResidentPack& p, const Digest& key) { + std::filesystem::create_directories(path.parent_path()); + auto tmp = path; +#ifdef _WIN32 + tmp += "." + std::to_string(GetCurrentProcessId()) + ".tmp"; +#else + tmp += "." + std::to_string(getpid()) + ".tmp"; +#endif + const Bytes t = table(p, key); + { + std::ofstream out(tmp, std::ios::binary | std::ios::trunc); + out.write(reinterpret_cast<const char*>(t.data()), std::streamsize(t.size())); + out.write(reinterpret_cast<const char*>(p.payload.data()), std::streamsize(p.payload.size())); + out.close(); + if (!out) { + std::error_code ec; + std::filesystem::remove(tmp, ec); + throw std::runtime_error("cannot write " + tmp.string()); + } + } +#ifdef _WIN32 + if (!MoveFileExW(tmp.c_str(), path.c_str(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)) { + std::error_code ec; + std::filesystem::remove(tmp, ec); + throw std::runtime_error("cannot publish " + path.string()); + } +#else + std::filesystem::rename(tmp, path); +#endif +} + +/* Structure, key and every blob hash. Returns null on any mismatch. */ +std::unique_ptr<PSXResidentPack> load(const std::filesystem::path& path, const Digest& key, + uint32_t file_count) { + std::error_code ec; + const auto bytes = std::filesystem::file_size(path, ec); + if (ec || bytes < 64 || bytes > kMaxPackBytes) return nullptr; + std::ifstream in(path, std::ios::binary); + uint8_t head[64]; + if (!in.read(reinterpret_cast<char*>(head), sizeof head)) return nullptr; + if (std::memcmp(head, kMagic, 8) || get32(head + 8) != kVersion || get32(head + 12) != file_count || + std::memcmp(head + 24, key.data(), 32)) + return nullptr; + const uint64_t nd = get32(head + 16), nb = get32(head + 20), payload = get64(head + 56); + const uint64_t tsize = 64 + uint64_t(file_count) * 20 + nd * 28 + nb * 48; + if (tsize + 32 > bytes || tsize + 32 + payload != bytes) return nullptr; + Bytes raw(static_cast<size_t>(tsize + 32)); + std::memcpy(raw.data(), head, sizeof head); + if (!in.read(reinterpret_cast<char*>(raw.data() + 64), std::streamsize(raw.size() - 64))) return nullptr; + const uint8_t* p = raw.data(); + if (sha(p, size_t(tsize)) != *reinterpret_cast<const Digest*>(p + tsize)) return nullptr; + auto pack = std::make_unique<PSXResidentPack>(); + const uint8_t* q = p + 64; + for (uint32_t i = 0; i < file_count; i++, q += 20) + pack->files.push_back({get32(q), get32(q + 4), get32(q + 8), get32(q + 12), get32(q + 16)}); + for (uint64_t i = 0; i < nd; i++, q += 28) + pack->derived.push_back({get32(q), get32(q + 4), {get32(q + 8), get32(q + 12), get32(q + 16), + get32(q + 20)}, get32(q + 24)}); + for (uint64_t i = 0; i < nb; i++, q += 48) { + Blob b{get64(q), get32(q + 8), {}}; + std::memcpy(b.sha.data(), q + 16, 32); + if (b.offset > payload || b.size > payload - b.offset) return nullptr; + pack->blobs.push_back(b); + } + for (const auto& f : pack->files) + if (f.blob >= nb || pack->blobs[f.blob].size != f.padded || f.padded % 2048 || + f.size > f.padded || f.padded - f.size >= 2048) + return nullptr; + for (const auto& d : pack->derived) + if (d.blob >= nb || d.file >= file_count) return nullptr; + pack->payload.resize(static_cast<size_t>(payload)); + if (!in.read(reinterpret_cast<char*>(pack->payload.data()), std::streamsize(payload))) return nullptr; + for (const auto& b : pack->blobs) + if (sha(pack->payload.data() + b.offset, b.size) != b.sha) return nullptr; + index_lba(*pack); + return pack; +} + +/* A cache from another disc with the same plan fingerprint cannot match the + * extents of every listed file on this one. */ +bool extents_match(const PSXResidentPack& pack, const PSXResidentSpec* s) { + for (uint32_t i = 0; i < s->file_count; i++) { + uint32_t lba = 0, size = 0; + if (!psx_mod_disc_file_extent(s->files[i].path, &lba, &size) || + lba != pack.files[i].lba || size != pack.files[i].size) + return false; + } + return true; +} + +void prune(const std::filesystem::path& keep, const std::string& format, uint32_t count) { + std::error_code ec; + std::vector<std::filesystem::directory_entry> packs; + const std::string prefix = format + "-"; + for (const auto& e : std::filesystem::directory_iterator(keep.parent_path(), ec)) { + const auto name = e.path().filename().string(); + if (e.path() != keep && name.rfind(prefix, 0) == 0 && e.path().extension() == ".pack") + packs.push_back(e); + } + if (packs.size() <= count) return; + std::sort(packs.begin(), packs.end(), [](const auto& a, const auto& b) { + std::error_code e1, e2; + return a.last_write_time(e1) > b.last_write_time(e2); + }); + for (size_t i = count; i < packs.size(); i++) std::filesystem::remove(packs[i].path(), ec); +} + +Record& record_for(const PSXResidentSpec* s) { + auto& r = records(); + for (auto& rec : r) + if (rec.title == s->title && rec.format == s->format) return rec; + r.push_back({}); + r.back().title = s->title; + r.back().format = s->format; + return r.back(); +} + +void json_string(std::string& out, const std::string& s) { + out += '"'; + for (char c : s) { + if (c == '"' || c == '\\') { out += '\\'; out += c; } + else if ((unsigned char)c < 0x20) { char b[8]; std::snprintf(b, sizeof b, "\\u%04x", c); out += b; } + else out += c; + } + out += '"'; +} + +} // namespace + +extern "C" int psx_resident_emit(PSXResidentSink* sink, uint32_t file, uint32_t tag, + const uint32_t meta[4], const void* bytes, uint32_t size) { + if (!sink || file >= sink->file_count || (!bytes && size)) return 0; + try { + const uint32_t blob = add_blob(*sink, static_cast<const uint8_t*>(bytes), size); + DerivedRec d{file, tag, {0, 0, 0, 0}, blob}; + if (meta) std::memcpy(d.meta, meta, sizeof d.meta); + sink->pack->derived.push_back(d); + return 1; + } catch (const std::exception& e) { + sink->error = e.what(); + return 0; + } +} + +extern "C" const PSXResidentPack* psx_resident_prepare(const PSXResidentSpec* spec) { + if (!valid_spec(spec)) { + psx_mod_counter_add("resident.invalid_spec", 1); + return nullptr; + } + Record& rec = record_for(spec); + rec.pack.reset(); + rec.error.clear(); + rec.path.clear(); + const auto start = std::chrono::steady_clock::now(); + try { + const std::string& fingerprint = PSXRecompV4::mod_runtime_fingerprint(); + const Digest key = cache_key(spec, fingerprint); + /* Without a committed plan there is no disc identity to key on: build + * in memory and never reuse or publish. */ + const bool cacheable = !fingerprint.empty(); + std::filesystem::path path; + std::unique_ptr<PSXResidentPack> pack; + if (cacheable) { + path = cache_dir(spec->title) / (std::string(spec->format) + "-" + hex(key.data(), 16) + ".pack"); + rec.path = path.string(); + pack = load(path, key, spec->file_count); + if (pack && !extents_match(*pack, spec)) pack.reset(); + if (!pack && std::filesystem::exists(path)) psx_mod_counter_add("resident.cache_rejected", 1); + } + if (pack) { + rec.state = "verified"; + std::error_code ec; + std::filesystem::last_write_time(path, std::filesystem::file_time_type::clock::now(), ec); + psx_mod_counter_add("resident.verified", 1); + } else { + pack = build(spec, rec.error); + if (!pack) throw std::runtime_error(rec.error); + if (cacheable) publish(path, *pack, key); + rec.state = cacheable ? "prepared" : "prepared (uncached: no mod plan)"; + psx_mod_counter_add("resident.prepared", 1); + } + if (cacheable) prune(path, spec->format, spec->keep_packs ? spec->keep_packs : 3); + rec.pack = std::move(pack); + } catch (const std::exception& e) { + rec.pack.reset(); + rec.state = "failed"; + if (rec.error.empty()) rec.error = e.what(); + psx_mod_counter_add("resident.prepare_failed", 1); + } + rec.ms = std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - start).count(); + return rec.pack.get(); +} + +extern "C" uint32_t psx_resident_file_count(const PSXResidentPack* p) { + return p ? uint32_t(p->files.size()) : 0; +} + +extern "C" const uint8_t* psx_resident_file(const PSXResidentPack* p, uint32_t file, + uint32_t* size, uint32_t* padded) { + if (!p || file >= p->files.size()) return nullptr; + const auto& f = p->files[file]; + if (size) *size = f.size; + if (padded) *padded = f.padded; + return p->payload.data() + p->blobs[f.blob].offset; +} + +extern "C" uint32_t psx_resident_file_lba(const PSXResidentPack* p, uint32_t file) { + return p && file < p->files.size() ? p->files[file].lba : 0; +} + +extern "C" int psx_resident_file_stock(const PSXResidentPack* p, uint32_t file) { + return p && file < p->files.size() ? int(p->files[file].stock) : 0; +} + +extern "C" uint32_t psx_resident_modified_files(const PSXResidentPack* p) { + return p ? p->modified : 0; +} + +extern "C" const uint8_t* psx_resident_find_lba(const PSXResidentPack* p, uint32_t lba, + uint32_t bytes, uint32_t* file) { + if (!p || p->by_lba.empty()) return nullptr; + /* Last file starting at or before lba. Files never overlap on a disc. */ + auto it = std::upper_bound(p->by_lba.begin(), p->by_lba.end(), lba, + [&](uint32_t v, uint32_t i) { return v < p->files[i].lba; }); + if (it == p->by_lba.begin()) return nullptr; + const uint32_t i = *--it; + const auto& f = p->files[i]; + const uint64_t offset = uint64_t(lba - f.lba) * 2048u; + if (offset > f.padded || bytes > f.padded - offset) return nullptr; + if (file) *file = i; + return p->payload.data() + p->blobs[f.blob].offset + offset; +} + +extern "C" uint32_t psx_resident_derived_count(const PSXResidentPack* p) { + return p ? uint32_t(p->derived.size()) : 0; +} + +extern "C" const uint8_t* psx_resident_derived(const PSXResidentPack* p, uint32_t index, + uint32_t* file, uint32_t* tag, + uint32_t meta[4], uint32_t* size) { + if (!p || index >= p->derived.size()) return nullptr; + const auto& d = p->derived[index]; + if (file) *file = d.file; + if (tag) *tag = d.tag; + if (meta) std::memcpy(meta, d.meta, sizeof d.meta); + if (size) *size = p->blobs[d.blob].size; + return p->payload.data() + p->blobs[d.blob].offset; +} + +extern "C" int psx_resident_guest_ranges_match(const PSXResidentRange* ranges, uint32_t count, + const char* sha256) { + if (!ranges || !count || !sha256) return 0; + psx_sha256_ctx ctx; + psx_sha256_init(&ctx); + uint8_t chunk[256]; + for (uint32_t r = 0; r < count; r++) { + if (ranges[r].hi < ranges[r].lo) return 0; + for (uint32_t a = ranges[r].lo; a < ranges[r].hi;) { + const uint32_t n = std::min<uint32_t>(sizeof chunk, ranges[r].hi - a); + for (uint32_t i = 0; i < n; i++) chunk[i] = psx_mod_read_byte(a + i); + psx_sha256_update(&ctx, chunk, n); + a += n; + } + } + uint8_t d[32]; + psx_sha256_final(&ctx, d); + return hex(d) == sha256; +} + +extern "C" int psx_resident_status_json(char* out, uint32_t capacity) { + std::string s = "["; + for (const auto& r : records()) { + if (s.size() > 1) s += ','; + s += "{\"title\":"; json_string(s, r.title); + s += ",\"format\":"; json_string(s, r.format); + s += ",\"state\":"; json_string(s, r.state); + s += ",\"error\":"; json_string(s, r.error); + s += ",\"path\":"; json_string(s, r.path); + char b[256]; + const PSXResidentPack* p = r.pack.get(); + std::snprintf(b, sizeof b, + ",\"files\":%u,\"modified\":%u,\"derived\":%u,\"blobs\":%u,\"bytes\":%llu,\"ms\":%.1f}", + p ? unsigned(p->files.size()) : 0u, p ? p->modified : 0u, + p ? unsigned(p->derived.size()) : 0u, p ? unsigned(p->blobs.size()) : 0u, + p ? (unsigned long long)p->payload.size() : 0ull, r.ms); + s += b; + } + s += ']'; + if (!out || capacity <= s.size()) return 0; + std::memcpy(out, s.c_str(), s.size() + 1); + return 1; +} diff --git a/runtime/src/mod_runtime.cpp b/runtime/src/mod_runtime.cpp index 152cc34a..8a6315f9 100644 --- a/runtime/src/mod_runtime.cpp +++ b/runtime/src/mod_runtime.cpp @@ -65,6 +65,10 @@ namespace PSXRecompV4 { namespace { struct RuntimeMods { + struct DiscExtent { uint32_t lba, count; const uint8_t* data; }; + std::vector<DiscExtent> disc_extents; + uint32_t extent_start = 0; + bool activating = false; ModPackageManager manager; ModResolution plan; ModResolution validation; @@ -1223,6 +1227,8 @@ bool mod_runtime_initialize(const std::filesystem::path& root, RuntimeMods& s = state(); s.manager.set_root({}); clear_function_entry_hooks(); + s.disc_extents.clear(); + s.extent_start = 0; s.plan = {}; s.validation = {}; s.raw_disc_index.clear(); @@ -1277,6 +1283,8 @@ bool mod_runtime_clear_for_netplay(std::string* error) { return true; } clear_function_entry_hooks(); + s.disc_extents.clear(); + s.extent_start = 0; s.plan = {}; s.validation = {}; s.raw_disc_index.clear(); @@ -1350,6 +1358,8 @@ bool mod_runtime_commit(const std::filesystem::path& disc_path, std::string* err /* Hooks follow activation, never a bare commit: a new plan runs none of * its function-entry hooks until mod_runtime_activate_plugins(). */ clear_function_entry_hooks(); + s.disc_extents.clear(); + s.extent_start = 0; s.plan = std::move(plan); build_disc_index(s); s.effective_disc_path = std::move(effective_disc); @@ -1432,6 +1442,11 @@ extern "C" void mod_runtime_on_savestate_loaded(void) { applied = true; } s.main_applied = true; + for (const ModResolution::Plugin& plugin : s.plan.plugins) { + s.current_plugin = &plugin; + mod_invoke_savestate_plugin(plugin.id); + s.current_plugin = nullptr; + } if (applied) std::fprintf(stdout, "psxrecomp: reapplied mod plan %s after savestate restore\n", @@ -1442,6 +1457,147 @@ extern "C" void mod_runtime_enable_disc_patches(void) { PSXRecompV4::state().disc_enabled = true; } +extern "C" int psx_mod_append_disc_extent(const char* resource_id, + uint64_t byte_offset, uint32_t sector_count, uint32_t* first_lba) { + using namespace PSXRecompV4; + if (first_lba) *first_lba = 0; + auto& s = state(); + const uint8_t* data = nullptr; + uint64_t size = 0; + if (!s.activating || !first_lba || !sector_count || + !psx_mod_current_resource_bytes(resource_id, &data, &size) || + byte_offset > size || uint64_t(sector_count)*2336 > size-byte_offset) return 0; + try { + uint32_t start = s.extent_start; + if (s.disc_extents.empty()) { + PS1::ISOReader reader; + const auto& mount = s.effective_disc_path.empty() ? s.disc_path : s.effective_disc_path; + if (mount.empty() || !reader.Open(mount.string()) || reader.TrackCount() >= 99) return 0; + start = reader.GetSectorCount(); + if (!start) return 0; + } + const uint32_t lba = s.disc_extents.empty() ? start : + s.disc_extents.back().lba + s.disc_extents.back().count; + if (uint64_t(lba)+sector_count+150 > 450000) return 0; + // Mode-2's duplicated subheader is part of the format contract. + for (uint32_t i=0; i<sector_count; ++i) { + const auto* sector = data+byte_offset+uint64_t(i)*2336; + if (std::memcmp(sector,sector+4,4)) return 0; + } + s.disc_extents.push_back({lba,sector_count,data+byte_offset}); + s.extent_start = start; + *first_lba = lba; + return 1; + } catch (...) { return 0; } +} + +extern "C" uint32_t mod_runtime_disc_extent_start(void) { + const auto& s=PSXRecompV4::state(); + return s.disc_enabled && !s.disc_extents.empty() ? s.extent_start : 0; +} +extern "C" uint32_t mod_runtime_disc_sector_count(uint32_t base_count) { + const auto& s=PSXRecompV4::state(); + return mod_runtime_disc_extent_start() ? + std::max(base_count,s.disc_extents.back().lba+s.disc_extents.back().count) : base_count; +} +extern "C" int mod_runtime_read_disc_extent(uint32_t lba, int raw, + uint8_t* bytes, uint32_t size) { + if (!bytes || size < (raw ? 2352u : 2048u) || !mod_runtime_disc_extent_start()) return 0; + const auto& extents=PSXRecompV4::state().disc_extents; + for (const auto& e:extents) if (lba>=e.lba && lba-e.lba<e.count) { + const auto* sector=e.data+uint64_t(lba-e.lba)*2336; + if (raw) { + std::memset(bytes,0,16);std::memset(bytes+1,0xff,10); + const uint32_t msf=lba+150; + const auto bcd=[](uint32_t v) {return uint8_t((v/10)*16+v%10);}; + bytes[12]=bcd(msf/4500);bytes[13]=bcd(msf/75%60);bytes[14]=bcd(msf%75);bytes[15]=2; + std::memcpy(bytes+16,sector,2336); + } else std::memcpy(bytes,sector+8,2048); + return 1; + } + return 0; +} + +static void patch_committed_disc_sector(uint32_t lba, int raw_sector, + uint8_t* bytes, uint32_t size); + +/* The largest file a CD can hold (80-minute disc, 360,000 sectors). Mods may + * grow an archive past its original extent, e.g. into a padding file. */ +static constexpr uint32_t kMaxDiscFileBytes = 360000u * 2048u; + +/* One 2048-byte user-data sector of the effective disc: the committed plan's + * raw and user-data writes/overlays applied. Form 2 (XA) sectors are refused. */ +static bool read_effective_user_sector(PS1::ISOReader& reader, uint32_t lba, + uint8_t* sector) { + uint8_t raw[2352]; + if (reader.ReadRawSector(lba, raw)) { + if (raw[15] != 1 && (raw[15] != 2 || (raw[18] & 0x20u))) return false; + patch_committed_disc_sector(lba, 1, raw, sizeof raw); + std::memcpy(sector, raw + (raw[15] == 1 ? 16 : 24), 2048); + if (raw[15] == 1) patch_committed_disc_sector(lba, 0, sector, 2048); + } else { + if (!reader.ReadSector(lba, sector)) return false; + patch_committed_disc_sector(lba, 0, sector, 2048); + } + return !PSXRecompV4::state().disc_guard_failed; +} + +/* ISO 9660 path lookup through the effective directory records. Mods may + * relocate or grow a file by patching its directory record (e.g. an archive + * extended into the following padding file); the emulated drive serves those + * patched records, so host reads must resolve paths through them too. Names + * compare case-insensitively without the ";1" version suffix. */ +static bool find_effective_file(PS1::ISOReader& reader, const std::string& path, + uint32_t& lba, uint32_t& bytes, bool& directory) { + uint8_t sector[2048]; + auto le32 = [](const uint8_t* p) { + return (uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) | + ((uint32_t)p[3] << 24); + }; + if (!read_effective_user_sector(reader, 16, sector) || sector[0] != 1 || + std::memcmp(sector + 1, "CD001", 5) != 0) return false; + lba = le32(sector + 156 + 2); + bytes = le32(sector + 156 + 10); + directory = true; + size_t at = 0; + while (at < path.size()) { + size_t next = path.find_first_of("/\\", at); + if (next == std::string::npos) next = path.size(); + std::string want = path.substr(at, next - at); + at = next + 1; + if (want.empty()) continue; + if (!directory) return false; + std::transform(want.begin(), want.end(), want.begin(), + [](unsigned char c) { return (char)std::toupper(c); }); + bool found = false; + const uint32_t sectors = (bytes + 2047u) / 2048u; + for (uint32_t i = 0; i < sectors && !found; ++i) { + if (!read_effective_user_sector(reader, lba + i, sector)) return false; + for (uint32_t p = 0; p < 2048u && sector[p] && !found;) { + const uint32_t length = sector[p]; + if (length < 34 || p + length > 2048u || + 33u + sector[p + 32] > length) return false; + std::string name(reinterpret_cast<const char*>(sector + p + 33), + sector[p + 32]); + name = name.substr(0, name.find(';')); + std::transform(name.begin(), name.end(), name.begin(), + [](unsigned char c) { return (char)std::toupper(c); }); + if (sector[p + 32] == 1 && (sector[p + 33] == 0 || sector[p + 33] == 1)) + name.clear(); + if (!name.empty() && name == want) { + lba = le32(sector + p + 2); + bytes = le32(sector + p + 10); + directory = (sector[p + 25] & 2u) != 0; + found = true; + } + p += length; + } + } + if (!found) return false; + } + return true; +} + extern "C" int psx_mod_read_disc_file(const char* path, void* buffer, uint32_t capacity, uint32_t* size) { using namespace PSXRecompV4; @@ -1452,33 +1608,84 @@ extern "C" int psx_mod_read_disc_file(const char* path, void* buffer, const auto& mount = s.effective_disc_path.empty() ? s.disc_path : s.effective_disc_path; if (mount.empty()) return 0; PS1::ISOReader reader; - PS1::ISOFileEntry entry; - if (!reader.Open(mount.string()) || !reader.FindFile(path, entry) || - entry.is_directory || !entry.size || entry.size > 64u * 1024u * 1024u) + uint32_t lba = 0, bytes = 0; + bool directory = false; + if (!reader.Open(mount.string()) || + !find_effective_file(reader, path, lba, bytes, directory) || + directory || !bytes || bytes > kMaxDiscFileBytes) return 0; - if (!buffer) { *size = entry.size; return 1; } - if (capacity < entry.size) return 0; - uint8_t sector[2048], raw[2352]; - for (uint32_t offset = 0; offset < entry.size; offset += 2048u) { - const uint32_t lba = entry.lba + offset / 2048u; - if (reader.ReadRawSector(lba, raw)) { - if (raw[15] != 1 && (raw[15] != 2 || (raw[18] & 0x20u))) return 0; - mod_runtime_patch_disc_sector(lba, 1, raw, sizeof raw); - std::memcpy(sector, raw + (raw[15] == 1 ? 16 : 24), sizeof sector); - if (raw[15] == 1) mod_runtime_patch_disc_sector(lba, 0, sector, sizeof sector); - } else { - if (!reader.ReadSector(lba, sector)) return 0; - mod_runtime_patch_disc_sector(lba, 0, sector, sizeof sector); - } - if (state().disc_guard_failed) return 0; - const uint32_t count = std::min(2048u, entry.size - offset); + if (!buffer) { *size = bytes; return 1; } + if (capacity < bytes) return 0; + uint8_t sector[2048]; + for (uint32_t offset = 0; offset < bytes; offset += 2048u) { + if (!read_effective_user_sector(reader, lba + offset / 2048u, sector)) return 0; + const uint32_t count = std::min(2048u, bytes - offset); std::memcpy(static_cast<uint8_t*>(buffer) + offset, sector, count); } - *size = entry.size; + *size = bytes; return 1; } catch (...) { return 0; } } +extern "C" int psx_mod_disc_file_extent(const char* path, uint32_t* lba, + uint32_t* size) { + using namespace PSXRecompV4; + if (lba) *lba = 0; + if (size) *size = 0; + if (!path || !*path || !lba || !size) return 0; + try { + const auto& s = state(); + const auto& mount = s.effective_disc_path.empty() ? s.disc_path : s.effective_disc_path; + if (mount.empty()) return 0; + PS1::ISOReader reader; + uint32_t first = 0, bytes = 0; + bool directory = false; + if (!reader.Open(mount.string()) || + !find_effective_file(reader, path, first, bytes, directory) || + directory || !bytes || bytes > kMaxDiscFileBytes) + return 0; + *lba = first; + *size = bytes; + return 1; + } catch (...) { return 0; } +} + +namespace PSXRecompV4 { +/* Whole effective sectors, including the bytes after end-of-file in the last + * sector: a sector-granular read by the game receives exactly these. */ +bool mod_runtime_read_disc_file_sectors(const std::string& path, uint32_t max_bytes, + std::vector<uint8_t>& padded, uint32_t& lba, + uint32_t& size, std::string* error) { + padded.clear(); + lba = size = 0; + auto fail = [&](const std::string& why) { + if (error) *error = path + ": " + why; + padded.clear(); + return false; + }; + try { + const auto& s = state(); + const auto& mount = s.effective_disc_path.empty() ? s.disc_path : s.effective_disc_path; + if (mount.empty()) return fail("no disc mounted"); + PS1::ISOReader reader; + bool directory = false; + if (!reader.Open(mount.string())) return fail("cannot open disc"); + if (!find_effective_file(reader, path, lba, size, directory) || directory) + return fail("not found on the disc"); + if (!size || size > kMaxDiscFileBytes || (max_bytes && size > max_bytes)) + return fail("unsupported size " + std::to_string(size)); + const uint32_t sectors = (size + 2047u) / 2048u; + padded.resize(size_t(sectors) * 2048u); + for (uint32_t i = 0; i < sectors; ++i) + if (!read_effective_user_sector(reader, lba + i, padded.data() + size_t(i) * 2048u)) + return fail("unreadable sector " + std::to_string(lba + i)); + return true; + } catch (const std::exception& e) { + return fail(e.what()); + } +} +} // namespace PSXRecompV4 + extern "C" void mod_runtime_activate_plugins(void) { using namespace PSXRecompV4; RuntimeMods& s = state(); @@ -1486,10 +1693,14 @@ extern "C" void mod_runtime_activate_plugins(void) { gpu_ws_set_native_scene_predicate(nullptr); psx_ram_reset_size_request(); if (!s.initialized || !s.plan.ok) return; + s.disc_extents.clear(); + s.extent_start = 0; + s.activating = true; for (const ModResolution::Plugin& plugin : s.plan.plugins) { PluginCallbackScope scope(s, &plugin); mod_invoke_activation_plugin(plugin.id); } + s.activating = false; build_function_entry_hooks(s); } @@ -1557,6 +1768,27 @@ extern "C" uint8_t psx_mod_read_byte(uint32_t address) { return psx_read_byte(address); } +extern "C" int psx_mod_current_resource_bytes(const char* resource_id, + const uint8_t** bytes, + uint64_t* size) { + using namespace PSXRecompV4; + if (bytes) *bytes = nullptr; + if (size) *size = 0; + if (!resource_id || !*resource_id || !bytes || !size) return 0; + const auto& s = state(); + if (!s.initialized || !s.plan.ok || !s.current_plugin) return 0; + for (const auto& resource : s.plan.resources) { + if (resource.package_id == s.current_plugin->package_id && + resource.feature_id == s.current_plugin->feature_id && + resource.id == resource_id && resource.bytes) { + *bytes = resource.bytes->data(); + *size = resource.bytes->size(); + return 1; + } + } + return 0; +} + extern "C" void psx_mod_write_byte(uint32_t address, uint8_t value) { psx_host_write_byte(address, value); } @@ -1764,9 +1996,12 @@ extern "C" int psx_mod_function_entry(CPUState* cpu, uint32_t address) { PluginCallbackScope scope(s, it->plugin, cpu); ++function_entry_depth; if (it->callback) it->callback(cpu, address); - const bool finished = s.current_function_finished || (it->filter && it->filter(cpu, address)); + /* Either completion form skips the body: an entry callback that + * called psx_mod_finish_function(), or a filter returning nonzero. */ + const bool handled = s.current_function_finished || + (it->filter && it->filter(cpu, address)); --function_entry_depth; - if (finished) { + if (handled) { cpu->pc = cpu->gpr[31]; return 1; } @@ -1789,12 +2024,16 @@ extern "C" void mod_runtime_function_entry_context_restore(const ModFunctionEntr static_cast<const PSXRecompV4::ModResolution::Plugin *>(in->plugin); } -extern "C" void mod_runtime_patch_disc_sector(uint32_t lba, int raw_sector, - uint8_t* bytes, uint32_t size) { +/* Apply the committed plan's disc writes and overlays to one sector. The + * emulated drive reaches this only after mod_runtime_enable_disc_patches() + * (reference reads before then must see the original image); host-side + * preparation through psx_mod_read_disc_file() always sees the effective disc, + * including during plugin activation, which runs before the drive is enabled. */ +static void patch_committed_disc_sector(uint32_t lba, int raw_sector, + uint8_t* bytes, uint32_t size) { using namespace PSXRecompV4; RuntimeMods& s = state(); - if (!s.initialized || !s.disc_enabled || s.disc_guard_failed || - !bytes || size == 0) return; + if (!s.initialized || s.disc_guard_failed || !bytes || size == 0) return; /* Raw Mode2 Form1 reads are also the source of the 2048-byte logical * stream consumed by the emulated CD controller. Apply raw claims to the * complete sector, then user-data claims to its payload window. Form2/XA @@ -1813,7 +2052,7 @@ extern "C" void mod_runtime_patch_disc_sector(uint32_t lba, int raw_sector, const auto overlay_sector = overlay_index.find(lba); if (sector == index.end() && overlay_sector == overlay_index.end()) { if (has_mode2_form1_user_data) - mod_runtime_patch_disc_sector(lba, 0, bytes + 24, 2048); + patch_committed_disc_sector(lba, 0, bytes + 24, 2048); return; } if (sector != index.end()) { @@ -1868,5 +2107,11 @@ extern "C" void mod_runtime_patch_disc_sector(uint32_t lba, int raw_sector, } } if (has_mode2_form1_user_data && !s.disc_guard_failed) - mod_runtime_patch_disc_sector(lba, 0, bytes + 24, 2048); + patch_committed_disc_sector(lba, 0, bytes + 24, 2048); +} + +extern "C" void mod_runtime_patch_disc_sector(uint32_t lba, int raw_sector, + uint8_t* bytes, uint32_t size) { + if (!PSXRecompV4::state().disc_enabled) return; + patch_committed_disc_sector(lba, raw_sector, bytes, size); } diff --git a/runtime/src/overlay_loader.c b/runtime/src/overlay_loader.c index b76df907..671e6f02 100644 --- a/runtime/src/overlay_loader.c +++ b/runtime/src/overlay_loader.c @@ -2668,6 +2668,14 @@ static void init_callbacks(void) { extern uint32_t psx_ws_angle_widen(uint32_t vanilla); s_callbacks.ws_angle_widen = psx_ws_angle_widen; } + { + extern int32_t psx_ws_cull_scale(int32_t bound, int32_t half_extent); + s_callbacks.ws_cull_scale = psx_ws_cull_scale; + } + { + extern int32_t gte_nclip_exact_sign(int32_t native_mac0, uint32_t pc); + s_callbacks.nclip_exact_sign = gte_nclip_exact_sign; + } /* PGXP dataflow-shadowing hook table (pgxp_hooks.h, appended last). * Referenced only by pgxp-flavour shards; the flavor half of the ABI * tag already rejects any host/DLL flavor mix, and a NULL table on an diff --git a/runtime/src/pgxp.cpp b/runtime/src/pgxp.cpp index 5471d14d..98199904 100644 --- a/runtime/src/pgxp.cpp +++ b/runtime/src/pgxp.cpp @@ -385,6 +385,13 @@ static inline int32_t f_simm(uint32_t i) { return (int32_t)(int16_t)(i & 0xFFF /* Memory-mode hooks: loads / stores */ /* ------------------------------------------------------------------------- */ +/* SXY2 and SXYP are one register seen at two addresses: whichever the hook + * just filled, the other describes the same word. */ +static inline void gte_sxy2_mirror(uint32_t reg) { + if (reg == 14) s_gte[15] = s_gte[14]; + else if (reg == 15) s_gte[14] = s_gte[15]; +} + extern "C" void psx_pgxp_load(struct CPUState *cpu, uint32_t instr, uint32_t addr, uint32_t value) { (void)cpu; @@ -502,6 +509,7 @@ extern "C" void psx_pgxp_cop2(struct CPUState *cpu, uint32_t instr, } else { pv_reset(dst, value); } + gte_sxy2_mirror(f_rt(instr)); return; } case 0x3A: { /* SWC2: [addr] <- gte[rt] */ @@ -539,9 +547,9 @@ extern "C" void psx_pgxp_cop2(struct CPUState *cpu, uint32_t instr, } else { pv_reset(dst, value); } - /* An SXYP write (rd==15) shifts the hardware FIFO; we do not - * model it — regs 12..14 now describe words they no longer - * match, and validation drops them on next use. */ + /* An SXYP write (rd==15) already shifted the FIFO shadows + * (pgxp_gte_reg_written, from the GTE register write). */ + gte_sxy2_mirror(f_rd(instr)); return; } case 0x02: { /* CFC2: control regs carry no @@ -598,17 +606,95 @@ static inline int halves_independent(uint32_t a, uint32_t b, uint32_t r, int sub ((lo >> 16) == 0); /* no carry/borrow out of low */ } +/* Bitwise ops (AND/OR/XOR/NOR and ANDI/ORI/XORI) move bits; they do not + * compute coordinates. GP0 decodes only the 11-bit field of each vertex half + * (bits 0..10 of X, 16..26 of Y), and engines pack clip / outcode bits into + * the rest of the word after projecting (Spider-Man ORs off-screen flags into + * bits 14/15 of each half of SXY2 before storing it). A result half whose GPU + * field equals the field of a tracked operand half therefore still describes + * that vertex. Carrying it is exact - no arithmetic, like a move - so it runs + * in both tiers. The carried value keeps the shadow invariant (integer part + * == the half read as int16): the fraction rides along, the integer becomes + * the result half. The GPU consumer rebases onto the field it decodes. */ +static inline int half_exact(const PGXPValue *pv, uint32_t value, int hi_half) { + if (!comp_tracked(pv, value, hi_half)) return 0; + int32_t v16 = hi_half ? pv->y16 : pv->x16; + /* A saturated projection shadow sits beyond the clamped word; it is not + * the value of that half and must not be carried as one. */ + return (v16 >> 16) == (int32_t)(int16_t)(hi_half ? (value >> 16) : value); +} + +static inline int carry_field(PGXPValue *dst, const PGXPValue *src, + uint32_t sval, uint32_t result, int hi_half) { + if (!half_exact(src, sval, hi_half)) return 0; + uint32_t sh = hi_half ? 16u : 0u; + if ((((sval ^ result) >> sh) & 0x7FFu) != 0) return 0; + int32_t frac = (hi_half ? src->y16 : src->x16) & 0xFFFF; + int32_t v = (int32_t)((uint32_t)(int32_t)(int16_t)(result >> sh) << 16) | frac; + if (hi_half) { dst->y16 = v; dst->flags |= PGXP_F_VY; } + else { dst->x16 = v; dst->flags |= PGXP_F_VX; } + return 1; +} + +static inline int has_depth(const PGXPValue *pv) { + return pv && pv->gen == s_gen && (pv->flags & PGXP_F_VZ) && pv->z != 0; +} + +/* Depth belongs to a whole vertex: it survives an op only when both halves of + * the result came from one operand that carried it, and the other operand is + * not itself a vertex (a constant, a mask, an offset). */ +static inline void keep_depth(PGXPValue *dst, const PGXPValue *p, + const PGXPValue *other) { + if ((dst->flags & PGXP_F_VXY) == PGXP_F_VXY && has_depth(p) && + !has_depth(other)) { + dst->z = p->z; + dst->flags |= PGXP_F_VZ; + } +} + +static void alu_bitwise(PGXPValue *dst, const PGXPValue *a, uint32_t s1, + const PGXPValue *b, uint32_t s2, uint32_t result) { + pv_reset(dst, result); + /* Prefer the operand that is a whole vertex, so a vertex ORed with flags + * keeps its depth even when the flag word happens to share a field. */ + const PGXPValue *p = a; uint32_t pval = s1; + const PGXPValue *q = b; uint32_t qval = s2; + if (!has_depth(a) && has_depth(b)) { p = b; pval = s2; q = a; qval = s1; } + const PGXPValue *from[2] = { nullptr, nullptr }; + for (int hi = 0; hi < 2; hi++) { + if (carry_field(dst, p, pval, result, hi)) from[hi] = p; + else if (carry_field(dst, q, qval, result, hi)) from[hi] = q; + else if (((hi ? result >> 16 : result) & 0xFFFFu) == 0) { + /* An exactly-zero half is an exact coordinate (the repack + * pattern ORs a shifted half into a zero half). */ + if (hi) { dst->y16 = 0; dst->flags |= PGXP_F_VY; } + else { dst->x16 = 0; dst->flags |= PGXP_F_VX; } + } + } + if (from[0] && from[0] == from[1]) + keep_depth(dst, from[0], from[0] == p ? q : p); +} + +static const PGXPValue kNoShadow = { 0, 0, 0, 0, 0, 0 }; + +/* Snapshot a source GPR shadow: the destination may alias a source (in-place + * ops such as `or t2, t2, t9` or `addiu t0, t0, 4`), and it is reset before + * the sources are read. */ +static inline const PGXPValue *gpr_shadow(uint32_t r, PGXPValue *copy) { + *copy = (r != 0) ? s_gpr[r] : kNoShadow; + return copy; +} + extern "C" void psx_pgxp_alu(struct CPUState *cpu, uint32_t instr, uint32_t result, uint32_t s1, uint32_t s2) { (void)cpu; if (!g_pgxp_active) return; uint32_t op = f_op(instr); - uint32_t dst_reg; - PGXPValue *a = nullptr, *b = nullptr; /* source shadows (may be 0) */ + PGXPValue ca, cb; if (op == 0) { /* SPECIAL */ - dst_reg = f_rd(instr); + uint32_t dst_reg = f_rd(instr); uint32_t rs = f_rs(instr), rt = f_rt(instr); uint32_t funct = f_funct(instr); if (funct == 0x11 || funct == 0x13) { /* MTHI / MTLO */ @@ -624,38 +710,31 @@ extern "C" void psx_pgxp_alu(struct CPUState *cpu, uint32_t instr, switch (funct) { case 0x10: /* MFHI */ - if (s_cpu_mode && s_gpr[PGXP_REG_HI].gen == s_gen) { - pv_validate(&s_gpr[PGXP_REG_HI], result); - *dst = s_gpr[PGXP_REG_HI]; - } else pv_reset(dst, result); - return; - case 0x12: /* MFLO */ - if (s_cpu_mode && s_gpr[PGXP_REG_LO].gen == s_gen) { - pv_validate(&s_gpr[PGXP_REG_LO], result); - *dst = s_gpr[PGXP_REG_LO]; + case 0x12: { /* MFLO */ + PGXPValue *hl = &s_gpr[funct == 0x10 ? PGXP_REG_HI : PGXP_REG_LO]; + if (s_cpu_mode && hl->gen == s_gen) { + pv_validate(hl, result); + *dst = *hl; } else pv_reset(dst, result); return; + } case 0x00: case 0x02: case 0x03: /* SLL / SRL / SRA */ case 0x04: case 0x06: case 0x07: { /* SLLV / SRLV / SRAV */ uint32_t sh = (funct < 4) ? f_shamt(instr) : (s2 & 31u); - uint32_t src_reg = rt; - PGXPValue *src = (src_reg != 0) ? &s_gpr[src_reg] : nullptr; + const PGXPValue *src = gpr_shadow(rt, &ca); int right = (funct & 3u) != 0; - if (!s_cpu_mode || sh != 16 || !src || src->gen != s_gen) { - pv_reset(dst, result); - return; - } - pv_validate(src, s1); pv_reset(dst, result); + if (!s_cpu_mode || sh != 16 || src->gen != s_gen) + return; if (!right) { /* << 16: low comp -> Y */ - if (src->flags & PGXP_F_VX) { + if (comp_tracked(src, s1, 0)) { dst->y16 = src->x16; dst->flags |= PGXP_F_VY; } dst->x16 = 0; dst->flags |= PGXP_F_VX; /* low half exactly zero */ } else { /* >> 16: high comp -> X */ - if (src->flags & PGXP_F_VY) { + if (comp_tracked(src, s1, 1)) { dst->x16 = src->y16; dst->flags |= PGXP_F_VX; } @@ -664,52 +743,36 @@ extern "C" void psx_pgxp_alu(struct CPUState *cpu, uint32_t instr, } return; } - case 0x20: case 0x21: /* ADD / ADDU */ - case 0x22: case 0x23: /* SUB / SUBU */ - case 0x25: { /* OR */ - /* MOVE idioms first — they matter even without full cpu-mode - * arithmetic, and they are exact. */ - int is_or = (funct == 0x25); - int is_sub = (funct == 0x22 || funct == 0x23); - if ((is_or || !is_sub) && rt == 0) { /* op rd, rs, $zero */ - if (rs != 0 && s_gpr[rs].gen == s_gen) { - pv_validate(&s_gpr[rs], result); - *dst = s_gpr[rs]; + case 0x24: case 0x25: case 0x26: case 0x27: { /* AND/OR/XOR/NOR */ + const PGXPValue *a = gpr_shadow(rs, &ca); + const PGXPValue *b = gpr_shadow(rt, &cb); + /* OR with $zero is the MOVE idiom: the whole shadow, depth too. */ + if (funct == 0x25 && (rs == 0 || rt == 0)) { + const PGXPValue *m = (rt == 0) ? a : b; + if (m->gen == s_gen) { + *dst = *m; + pv_validate(dst, result); } else pv_reset(dst, result); return; } - if ((is_or || !is_sub) && rs == 0) { /* op rd, $zero, rt */ - if (rt != 0 && s_gpr[rt].gen == s_gen) { - pv_validate(&s_gpr[rt], result); - *dst = s_gpr[rt]; + alu_bitwise(dst, a, s1, b, s2, result); + return; + } + case 0x20: case 0x21: /* ADD / ADDU */ + case 0x22: case 0x23: { /* SUB / SUBU */ + const PGXPValue *a = gpr_shadow(rs, &ca); + const PGXPValue *b = gpr_shadow(rt, &cb); + int is_sub = (funct == 0x22 || funct == 0x23); + /* MOVE idioms first - exact, so they run in both tiers. */ + if (rt == 0 || (!is_sub && rs == 0)) { + const PGXPValue *m = (rt == 0) ? a : b; + if (m->gen == s_gen) { + *dst = *m; + pv_validate(dst, result); } else pv_reset(dst, result); return; } if (!s_cpu_mode) { pv_reset(dst, result); return; } - a = (rs != 0) ? &s_gpr[rs] : nullptr; - b = (rt != 0) ? &s_gpr[rt] : nullptr; - if (is_or) { - /* Merge disjoint halves (the lhu/sll/or repack pattern). */ - if ((s1 & s2) != 0) { pv_reset(dst, result); return; } - pv_reset(dst, result); - const PGXPValue *xsrc; uint32_t xval; - if ((s1 & 0xFFFFu) != 0) { xsrc = a; xval = s1; } - else { xsrc = b; xval = s2; } - const PGXPValue *ysrc; uint32_t yval; - if ((s1 & 0xFFFF0000u) != 0) { ysrc = a; yval = s1; } - else { ysrc = b; yval = s2; } - if (comp_tracked(xsrc, xval, 0)) { - dst->x16 = xsrc->x16; dst->flags |= PGXP_F_VX; - } else if ((result & 0xFFFFu) == 0) { - dst->x16 = 0; dst->flags |= PGXP_F_VX; - } - if (comp_tracked(ysrc, yval, 1)) { - dst->y16 = ysrc->y16; dst->flags |= PGXP_F_VY; - } else if ((result & 0xFFFF0000u) == 0) { - dst->y16 = 0; dst->flags |= PGXP_F_VY; - } - return; - } /* add/sub: require at least one tracked component and halves * that combined independently (no cross-half carry). */ if (!halves_independent(s1, s2, result, is_sub) || @@ -724,19 +787,24 @@ extern "C" void psx_pgxp_alu(struct CPUState *cpu, uint32_t instr, dst->y16 = is_sub ? comp16(a, s1, 1) - comp16(b, s2, 1) : comp16(a, s1, 1) + comp16(b, s2, 1); dst->flags = PGXP_F_VXY; + /* A vertex plus / minus an offset is still that vertex. */ + if (comp_tracked(a, s1, 0) && comp_tracked(a, s1, 1)) + keep_depth(dst, a, b); + else if (!is_sub && comp_tracked(b, s2, 0) && comp_tracked(b, s2, 1)) + keep_depth(dst, b, a); return; } - default: + default: /* SLT/SLTU/...: not a vertex */ pv_reset(dst, result); return; } } /* immediates */ - dst_reg = f_rt(instr); + uint32_t dst_reg = f_rt(instr); if (dst_reg == 0) return; PGXPValue *dst = &s_gpr[dst_reg]; - uint32_t rs = f_rs(instr); + const PGXPValue *a = gpr_shadow(f_rs(instr), &ca); switch (op) { case 0x0F: { /* LUI: both halves exact */ @@ -749,54 +817,43 @@ extern "C" void psx_pgxp_alu(struct CPUState *cpu, uint32_t instr, case 0x08: case 0x09: { /* ADDI / ADDIU */ int32_t imm = f_simm(instr); if (imm == 0) { /* MOVE idiom */ - if (rs != 0 && s_gpr[rs].gen == s_gen) { - pv_validate(&s_gpr[rs], result); - *dst = s_gpr[rs]; + if (a->gen == s_gen) { + *dst = *a; + pv_validate(dst, result); } else pv_reset(dst, result); return; } - a = (rs != 0) ? &s_gpr[rs] : nullptr; /* A negative immediate is a subtraction of its magnitude: checking * carry on the sign-extended form would reject nearly every -N. */ - { - int neg = imm < 0; - uint32_t mag = (uint32_t)(neg ? -imm : imm); - if (!s_cpu_mode || - !halves_independent(s1, mag, result, neg) || - (!comp_tracked(a, s1, 0) && !comp_tracked(a, s1, 1))) { - pv_reset(dst, result); - return; - } - int32_t dx = (int32_t)(mag & 0xFFFFu) << 16; + int neg = imm < 0; + uint32_t mag = (uint32_t)(neg ? -imm : imm); + if (!s_cpu_mode || + !halves_independent(s1, mag, result, neg) || + (!comp_tracked(a, s1, 0) && !comp_tracked(a, s1, 1))) { pv_reset(dst, result); - dst->x16 = comp16(a, s1, 0) + (neg ? -dx : dx); - dst->y16 = comp16(a, s1, 1); /* no carry crossed: Y untouched */ - dst->flags = PGXP_F_VXY; - } - return; - } - case 0x0D: { /* ORI */ - uint32_t imm = instr & 0xFFFFu; - if (imm == 0 || (s_cpu_mode && (s1 & 0xFFFFu) == 0)) { - a = (rs != 0) ? &s_gpr[rs] : nullptr; - pv_reset(dst, result); - if (comp_tracked(a, s1, 1)) { - dst->y16 = a->y16; dst->flags |= PGXP_F_VY; - } - if (imm == 0) { - if (comp_tracked(a, s1, 0)) { - dst->x16 = a->x16; dst->flags |= PGXP_F_VX; - } - } else { /* exact constant low half */ - dst->x16 = ((int32_t)(int16_t)imm) << 16; - dst->flags |= PGXP_F_VX; - } return; } + int32_t dx = (int32_t)(mag & 0xFFFFu) << 16; pv_reset(dst, result); + dst->x16 = comp16(a, s1, 0) + (neg ? -dx : dx); + dst->y16 = comp16(a, s1, 1); /* no carry crossed: Y untouched */ + dst->flags = PGXP_F_VXY; + if (comp_tracked(a, s1, 0) && comp_tracked(a, s1, 1)) + keep_depth(dst, a, nullptr); return; } - default: /* ANDI/XORI/SLTI/... */ + case 0x0C: case 0x0D: case 0x0E: { /* ANDI / ORI / XORI */ + uint32_t imm = instr & 0xFFFFu; + alu_bitwise(dst, a, s1, nullptr, imm, result); + /* ORI into a zero low half writes an exact constant there (the + * lui/ori and repack idioms). */ + if (op == 0x0D && !(dst->flags & PGXP_F_VX) && (s1 & 0xFFFFu) == 0) { + dst->x16 = ((int32_t)(int16_t)imm) << 16; + dst->flags |= PGXP_F_VX; + } + return; + } + default: /* SLTI/SLTIU: not a vertex */ pv_reset(dst, result); return; } @@ -954,8 +1011,20 @@ extern "C" void pgxp_gte_reg_written(int reg, uint32_t value) { * machine state back, so its writes must not stick to the shadows). */ if (s_suppress != 0) return; if (reg < 0 || reg > 31) return; + if (reg == 15) { + /* SXYP is a FIFO push: SXY1 moves to SXY0, SXY2 to SXY1, the value + * lands in SXY2 (psx-spx GTE "SXYP"). Engines draw quads from a + * projected-vertex table this way - load three corners, NCLIP, push + * the fourth through SXYP, NCLIP, store SXY0..2 into the packet - so + * the shadows shift with the registers. The MTC2 / LWC2 hook then + * copies the source shadow into the pushed slot. */ + s_gte[12] = s_gte[13]; + s_gte[13] = s_gte[14]; + reg = 14; + } pv_kill(&s_gte[reg]); pv_reset(&s_gte[reg], value); + gte_sxy2_mirror(reg); /* SXY2 and SXYP: one register */ } /* ------------------------------------------------------------------------- */ @@ -996,6 +1065,21 @@ static inline int pgxp_accept(int32_t px, int32_t py, int32_t int_x, return 0; } +/* Rebase a shadow that describes the int16 half onto GP0's 11-bit field when + * the half carries flag bits ABOVE the field (Spider-Man packs clip flags in + * bits 14/15). A half whose bits 11-15 are a plain sign extension holds an + * ordinary number; if it overflowed the field (e.g. 0x0402 parses as -1022), + * that is CPU arithmetic the GPU wraps, which pgxp_agrees() only believes on + * exact integer agreement, so it is left to that check unchanged. */ +static inline int32_t field_rebase(int32_t v16, uint32_t half, int32_t parsed) { + int32_t as16 = (int16_t)half; + int32_t as11 = ((int32_t)(half << 21)) >> 21; + if (parsed != as11 || parsed == as16) return v16; + const uint32_t above = (half >> 11) & 0x1Fu; + if (above == ((half & 0x8000u) ? 0x1Fu : 0u)) return v16; + return (int32_t)((int64_t)v16 + ((int64_t)as11 - as16) * 65536); +} + extern "C" int pgxp_get_precise_vertex(uint32_t addr, uint32_t packet_word, int32_t int_x, int32_t int_y, int32_t *x16, int32_t *y16, @@ -1028,6 +1112,12 @@ extern "C" int pgxp_get_precise_vertex(uint32_t addr, uint32_t packet_word, } if (have) { + /* A shadow describes each half read as int16; GP0 decodes only its + * 11-bit field (engines keep clip / outcode bits above it). When the + * caller parsed the field, rebase the precise value onto it - the + * fraction is unchanged. Any other integer is caught below. */ + px = field_rebase(px, packet_word & 0xFFFFu, int_x); + py = field_rebase(py, packet_word >> 16, int_y); /* Truncation agreement: the GPU parsed 11-bit integers out of the * packet; a precise position whose integer part disagrees (a * wrapped/CPU-modified coordinate) must not be believed. Then the @@ -1087,6 +1177,23 @@ extern "C" void pgxp_store_gte_reg(uint32_t addr, uint8_t reg) { *dst = *src; } +extern "C" int pgxp_debug_shadow(int space, uint32_t key, int *live, + uint32_t *value, uint32_t *flags, + int32_t *x16, int32_t *y16, uint16_t *z) { + const PGXPValue *pv = nullptr; + if (space == 0) pv = pgxp_ptr(key); + else if (space == 1 && key < 34) pv = &s_gpr[key]; + else if (space == 2 && key < 32) pv = &s_gte[key]; + if (!pv) return 0; + *live = pv->gen == s_gen; + *value = pv->value; + *flags = pv->flags; + *x16 = pv->x16; + *y16 = pv->y16; + *z = pv->z; + return 1; +} + /* ------------------------------------------------------------------------- */ /* Test accessors */ /* ------------------------------------------------------------------------- */ @@ -1126,15 +1233,60 @@ extern "C" void pgxp_test_set_generation(uint32_t gen) { s_gen = gen; } /* Address-keyed depth lookup for the shipped perspective-texturing path * (gpu.c prepare_texture_triangle). Same contract as the retired hashed * table: hit only when the tracked word matches the packet word exactly. */ +/* Always-on ring of refused precise-word lookups: which packet word, what + * the shadow at its address held, and why it was refused. Join it with + * wtrace_dump (writer PC per address) to find the guest code path that drops + * provenance. */ +static PGXPWordMiss s_miss_ring[PGXP_MISS_RING_CAP]; +static uint64_t s_miss_seq = 0; + +static void note_word_miss(uint32_t addr, uint32_t packed, const PGXPValue *pv, + uint8_t reason) { + PGXPWordMiss *m = &s_miss_ring[s_miss_seq % PGXP_MISS_RING_CAP]; + m->seq = s_miss_seq++; + m->addr = addr; + m->packet = packed; + m->shadow_value = pv ? pv->value : 0; + m->shadow_flags = pv ? (uint8_t)pv->flags : 0; + m->live = (pv && pv->gen == s_gen) ? 1 : 0; + m->reason = reason; +} + +extern "C" uint64_t pgxp_word_miss_ring(const PGXPWordMiss **ring, + uint32_t *cap) { + *ring = s_miss_ring; + *cap = PGXP_MISS_RING_CAP; + return s_miss_seq; +} + extern "C" int pgxp_load_precise_word(uint32_t addr, uint32_t packed, int32_t *x16, int32_t *y16, uint16_t *z) { if (!s_enabled) return 0; + s_stats.word_lookups++; PGXPValue *pv = pgxp_ptr(addr); - if (!pv || pv->gen != s_gen || pv->value != packed || - (pv->flags & PGXP_F_VXY) != PGXP_F_VXY) + if (!pv || pv->gen != s_gen) { + s_stats.word_untracked++; + note_word_miss(addr, packed, pv, PGXP_MISS_UNTRACKED); return 0; + } + if (pv->value != packed) { + s_stats.word_mismatch++; + note_word_miss(addr, packed, pv, PGXP_MISS_MISMATCH); + return 0; + } + if ((pv->flags & PGXP_F_VXY) != PGXP_F_VXY) { + s_stats.word_partial++; + note_word_miss(addr, packed, pv, PGXP_MISS_PARTIAL); + return 0; + } if (x16) *x16 = pv->x16; if (y16) *y16 = pv->y16; if (z) *z = (pv->flags & PGXP_F_VZ) ? pv->z : 0; - return (pv->flags & PGXP_F_VZ) && pv->z != 0; + if (!(pv->flags & PGXP_F_VZ) || pv->z == 0) { + s_stats.word_no_z++; + note_word_miss(addr, packed, pv, PGXP_MISS_NO_Z); + return 0; + } + s_stats.word_hit++; + return 1; } diff --git a/runtime/src/present_image_ring.c b/runtime/src/present_image_ring.c new file mode 100644 index 00000000..8ed55839 --- /dev/null +++ b/runtime/src/present_image_ring.c @@ -0,0 +1,137 @@ +#include "present_image_ring.h" + +#include <stdlib.h> +#include <string.h> + +typedef struct { + uint32_t frame; + uint16_t w; + uint8_t valid; + uint16_t *px; /* PRESENT_IMAGE_RING_MAX_W * PRESENT_IMAGE_RING_H, RGB565 */ +} PresentImage; + +static PresentImage s_ring[PRESENT_IMAGE_RING_CAP]; +static uint16_t *s_pixels = NULL; +static uint32_t s_head = 0; +static int s_enabled = -1; +static int s_frozen = 0; + +static int ring_ready(void) { + if (s_enabled < 0) { + const char *e = getenv("PSX_PRESENT_IMAGE_RING"); + s_enabled = (!e || !*e || *e != '0') ? 1 : 0; + } + if (!s_enabled) return 0; + if (!s_pixels) { + const size_t per = (size_t)PRESENT_IMAGE_RING_MAX_W * PRESENT_IMAGE_RING_H; + s_pixels = (uint16_t *)calloc((size_t)PRESENT_IMAGE_RING_CAP * per, sizeof(uint16_t)); + if (!s_pixels) { s_enabled = 0; return 0; } + for (int i = 0; i < PRESENT_IMAGE_RING_CAP; i++) + s_ring[i].px = s_pixels + (size_t)i * per; + } + return 1; +} + +int present_image_ring_thumb_w(int ww, int wh) { + if (ww <= 0 || wh <= 0) return 0; + long w = ((long)ww * PRESENT_IMAGE_RING_H + wh / 2) / wh; + if (w < 1) w = 1; + if (w > PRESENT_IMAGE_RING_MAX_W) w = PRESENT_IMAGE_RING_MAX_W; + return (int)w; +} + +int present_image_ring_accepting(void) { + return !s_frozen && ring_ready(); +} + +static PresentImage *next_slot(uint32_t frame, int w) { + PresentImage *e = &s_ring[s_head]; + s_head = (s_head + 1) % PRESENT_IMAGE_RING_CAP; + e->frame = frame; + e->w = (uint16_t)w; + e->valid = 1; + return e; +} + +static uint16_t pack565(unsigned r, unsigned g, unsigned b) { + return (uint16_t)(((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)); +} + +void present_image_ring_push(uint32_t frame, const uint8_t *rgba, int w, + int pitch, int bottom_up) { + if (!rgba || w <= 0 || w > PRESENT_IMAGE_RING_MAX_W) return; + if (!present_image_ring_accepting()) return; + PresentImage *e = next_slot(frame, w); + for (int y = 0; y < PRESENT_IMAGE_RING_H; y++) { + const int sy = bottom_up ? (PRESENT_IMAGE_RING_H - 1 - y) : y; + const uint8_t *src = rgba + (size_t)sy * pitch; + uint16_t *dst = e->px + (size_t)y * w; + for (int x = 0; x < w; x++) + dst[x] = pack565(src[4 * x], src[4 * x + 1], src[4 * x + 2]); + } +} + +void present_image_ring_push_argb(uint32_t frame, const uint32_t *argb, + int sw, int sh, int src_pitch_px) { + if (!argb || sw <= 0 || sh <= 0) return; + if (!present_image_ring_accepting()) return; + const int w = present_image_ring_thumb_w(sw, sh); + PresentImage *e = next_slot(frame, w); + for (int y = 0; y < PRESENT_IMAGE_RING_H; y++) { + const int y0 = (int)((long)y * sh / PRESENT_IMAGE_RING_H); + int y1 = (int)((long)(y + 1) * sh / PRESENT_IMAGE_RING_H); + if (y1 <= y0) y1 = y0 + 1; + for (int x = 0; x < w; x++) { + const int x0 = (int)((long)x * sw / w); + int x1 = (int)((long)(x + 1) * sw / w); + if (x1 <= x0) x1 = x0 + 1; + unsigned r = 0, g = 0, b = 0, n = 0; + for (int yy = y0; yy < y1 && yy < sh; yy++) + for (int xx = x0; xx < x1 && xx < sw; xx++) { + const uint32_t p = argb[(size_t)yy * src_pitch_px + xx]; + r += (p >> 16) & 0xFF; g += (p >> 8) & 0xFF; b += p & 0xFF; n++; + } + if (!n) n = 1; + e->px[(size_t)y * w + x] = pack565(r / n, g / n, b / n); + } + } +} + +void present_image_ring_set_frozen(int frozen) { s_frozen = frozen ? 1 : 0; } +int present_image_ring_frozen(void) { return s_frozen; } + +void present_image_ring_span(uint32_t *oldest, uint32_t *newest, int *count) { + uint32_t lo = UINT32_MAX, hi = 0; + int n = 0; + for (int i = 0; i < PRESENT_IMAGE_RING_CAP; i++) { + if (!s_ring[i].valid) continue; + n++; + if (s_ring[i].frame < lo) lo = s_ring[i].frame; + if (s_ring[i].frame > hi) hi = s_ring[i].frame; + } + if (oldest) *oldest = n ? lo : 0; + if (newest) *newest = hi; + if (count) *count = n; +} + +int present_image_ring_get_rgb(uint32_t frame, uint8_t **rgb, int *w, int *h) { + if (!rgb || !s_pixels) return 0; + for (int i = 0; i < PRESENT_IMAGE_RING_CAP; i++) { + const PresentImage *e = &s_ring[i]; + if (!e->valid || e->frame != frame) continue; + const size_t n = (size_t)e->w * PRESENT_IMAGE_RING_H; + uint8_t *out = (uint8_t *)malloc(n * 3); + if (!out) return 0; + for (size_t k = 0; k < n; k++) { + const uint16_t p = e->px[k]; + out[3 * k] = (uint8_t)(((p >> 11) & 31) << 3); + out[3 * k + 1] = (uint8_t)(((p >> 5) & 63) << 2); + out[3 * k + 2] = (uint8_t)((p & 31) << 3); + } + *rgb = out; + if (w) *w = e->w; + if (h) *h = PRESENT_IMAGE_RING_H; + return 1; + } + return 0; +} diff --git a/runtime/src/psx_interpreter.c b/runtime/src/psx_interpreter.c index 340305f0..4f94d87e 100644 --- a/runtime/src/psx_interpreter.c +++ b/runtime/src/psx_interpreter.c @@ -283,13 +283,18 @@ static void exec_one(CPUState* cpu) { } case 0x23: set_reg(cpu, rd, rs_val - rt_val); psx_pgxp_alu(cpu, insn, cpu->gpr[rd], rs_val, rt_val); break; /* SUBU */ - case 0x24: set_reg(cpu, rd, rs_val & rt_val); break; /* AND */ + case 0x24: set_reg(cpu, rd, rs_val & rt_val); + psx_pgxp_alu(cpu, insn, cpu->gpr[rd], rs_val, rt_val); break; /* AND */ case 0x25: set_reg(cpu, rd, rs_val | rt_val); psx_pgxp_alu(cpu, insn, cpu->gpr[rd], rs_val, rt_val); break; /* OR */ - case 0x26: set_reg(cpu, rd, rs_val ^ rt_val); break; /* XOR */ - case 0x27: set_reg(cpu, rd, ~(rs_val | rt_val)); break; /* NOR */ - case 0x2A: set_reg(cpu, rd, (int32_t)rs_val < (int32_t)rt_val ? 1 : 0); break; /* SLT */ - case 0x2B: set_reg(cpu, rd, rs_val < rt_val ? 1 : 0); break; /* SLTU */ + case 0x26: set_reg(cpu, rd, rs_val ^ rt_val); + psx_pgxp_alu(cpu, insn, cpu->gpr[rd], rs_val, rt_val); break; /* XOR */ + case 0x27: set_reg(cpu, rd, ~(rs_val | rt_val)); + psx_pgxp_alu(cpu, insn, cpu->gpr[rd], rs_val, rt_val); break; /* NOR */ + case 0x2A: set_reg(cpu, rd, (int32_t)rs_val < (int32_t)rt_val ? 1 : 0); + psx_pgxp_alu(cpu, insn, cpu->gpr[rd], rs_val, rt_val); break; /* SLT */ + case 0x2B: set_reg(cpu, rd, rs_val < rt_val ? 1 : 0); + psx_pgxp_alu(cpu, insn, cpu->gpr[rd], rs_val, rt_val); break; /* SLTU */ default: /* R3000A ignores undefined SPECIAL encodings (no trap). */ break; @@ -363,12 +368,16 @@ static void exec_one(CPUState* cpu) { } case 0x09: set_reg(cpu, RT(insn), rs_val + (uint32_t)SIMM(insn)); psx_pgxp_alu(cpu, insn, cpu->gpr[RT(insn)], rs_val, (uint32_t)SIMM(insn)); break; /* ADDIU */ - case 0x0A: set_reg(cpu, RT(insn), (int32_t)rs_val < SIMM(insn) ? 1 : 0); break; /* SLTI */ - case 0x0B: set_reg(cpu, RT(insn), rs_val < (uint32_t)SIMM(insn) ? 1 : 0); break; /* SLTIU */ - case 0x0C: set_reg(cpu, RT(insn), rs_val & IMM16(insn)); break; /* ANDI */ + case 0x0A: set_reg(cpu, RT(insn), (int32_t)rs_val < SIMM(insn) ? 1 : 0); + psx_pgxp_alu(cpu, insn, cpu->gpr[RT(insn)], rs_val, (uint32_t)SIMM(insn)); break; /* SLTI */ + case 0x0B: set_reg(cpu, RT(insn), rs_val < (uint32_t)SIMM(insn) ? 1 : 0); + psx_pgxp_alu(cpu, insn, cpu->gpr[RT(insn)], rs_val, (uint32_t)SIMM(insn)); break; /* SLTIU */ + case 0x0C: set_reg(cpu, RT(insn), rs_val & IMM16(insn)); + psx_pgxp_alu(cpu, insn, cpu->gpr[RT(insn)], rs_val, IMM16(insn)); break; /* ANDI */ case 0x0D: set_reg(cpu, RT(insn), rs_val | IMM16(insn)); psx_pgxp_alu(cpu, insn, cpu->gpr[RT(insn)], rs_val, IMM16(insn)); break; /* ORI */ - case 0x0E: set_reg(cpu, RT(insn), rs_val ^ IMM16(insn)); break; /* XORI */ + case 0x0E: set_reg(cpu, RT(insn), rs_val ^ IMM16(insn)); + psx_pgxp_alu(cpu, insn, cpu->gpr[RT(insn)], rs_val, IMM16(insn)); break; /* XORI */ case 0x0F: set_reg(cpu, RT(insn), (uint32_t)IMM16(insn) << 16); psx_pgxp_alu(cpu, insn, cpu->gpr[RT(insn)], 0, 0); break; /* LUI */ diff --git a/runtime/src/savestate.c b/runtime/src/savestate.c index 418e6e74..72d6fdac 100644 --- a/runtime/src/savestate.c +++ b/runtime/src/savestate.c @@ -649,7 +649,11 @@ static int netplay_user_blocked(void) { } static int request_save_inner(int slot) { - if (!s_configured) { fprintf(stderr, "savestate: not configured\n"); return 0; } + if (!s_configured) { + fprintf(stderr, "savestate: not configured\n"); + psx_frontend_on_savestate_refused(0, slot, "Save states are not available yet"); + return 0; + } if (slot < 0 || slot >= SAVESTATE_SLOTS) return 0; s_save_failed = 0; s_last_save_pc = 0; /* block netplay transfer until this write stamps a PC */ @@ -662,13 +666,19 @@ static int request_save_inner(int slot) { } static int request_load_inner(int slot) { - if (!s_configured) { fprintf(stderr, "savestate: not configured\n"); return 0; } + if (!s_configured) { + fprintf(stderr, "savestate: not configured\n"); + psx_frontend_on_savestate_refused(1, slot, "Save states are not available yet"); + return 0; + } if (slot < 0 || slot >= SAVESTATE_SLOTS) return 0; if (!psx_hle_scheduler_enabled()) { /* LLE (host-fiber) mode: the restore longjmp target lives on the * scheduler fiber; cross-fiber unwind is unsafe. HLE is the default. */ fprintf(stderr, "savestate: load requires the HLE scheduler (default); " "PSX_HLE_SCHEDULER=0 run cannot load states.\n"); + psx_frontend_on_savestate_refused(1, slot, + "Cannot load: this run uses the legacy thread scheduler"); return 0; } s_load_failed = 0; diff --git a/runtime/src/traps.c b/runtime/src/traps.c index de363c87..e1f1fe98 100644 --- a/runtime/src/traps.c +++ b/runtime/src/traps.c @@ -6,6 +6,7 @@ #include "cpu_state.h" #include "psx_memory.h" +#include "interrupts.h" #include "psx_bss.h" #include "psx_runtime.h" /* fix B: psx_exc_escape_reason_t + g_exc_escape_reason */ #include "debug_server.h" @@ -811,6 +812,7 @@ void psx_scheduler_run(CPUState* cpu) g_sched_escape.reason = PSX_RUN_CONTINUE; for (;;) { if (setjmp(g_scheduler_jmpbuf) != 0) { + psx_snapshot_host_call_reset(); /* A structured escape unwound the native stack to here. Reset the * invariants the skipped psx_dispatch_impl frames would otherwise * own. No exception_jmpbuf frame is ever skipped (switch fires only diff --git a/runtime/tests/gpu_exec_stubs.inc b/runtime/tests/gpu_exec_stubs.inc index c9224e95..ae5db385 100644 --- a/runtime/tests/gpu_exec_stubs.inc +++ b/runtime/tests/gpu_exec_stubs.inc @@ -5,6 +5,7 @@ * Draw calls that tests observe are recorded below. */ uint64_t s_frame_count; +uint64_t psx_cycle_count; /* gpu_timeline.c stamps notes with it */ int g_exec_phase; uint32_t g_debug_current_func_addr; uint32_t g_debug_last_store_pc; diff --git a/runtime/tests/overlay_pair_dedup_harness.c b/runtime/tests/overlay_pair_dedup_harness.c index 74048a54..f1da260d 100644 --- a/runtime/tests/overlay_pair_dedup_harness.c +++ b/runtime/tests/overlay_pair_dedup_harness.c @@ -195,9 +195,19 @@ int psx_mod_function_entry(CPUState *cpu, uint32_t address) { (void)cpu; (void)address; return 0; } +void psx_mod_instruction(CPUState *cpu, uint32_t address, uint32_t instruction) { + (void)cpu; (void)address; (void)instruction; +} int psx_netplay_is_resimulating(void) { return 0; } int psx_game_text_native_ok(uint32_t address) { (void)address; return 1; } uint32_t psx_ws_angle_widen(uint32_t vanilla) { return vanilla; } +int32_t psx_ws_cull_scale(int32_t bound, int32_t half_extent) { + (void)half_extent; return bound; +} +int32_t gte_nclip_exact_sign(int32_t native_mac0, uint32_t pc) { + (void)pc; + return native_mac0 < 0 ? -1 : (native_mac0 > 0 ? 1 : 0); +} uint32_t psx_ws_cull_keep_result(uint32_t vanilla, uint32_t forced) { (void)forced; return vanilla; } diff --git a/runtime/tests/psx_ram_runtime_map_stubs.c b/runtime/tests/psx_ram_runtime_map_stubs.c index 3341c7b9..2e98819d 100644 --- a/runtime/tests/psx_ram_runtime_map_stubs.c +++ b/runtime/tests/psx_ram_runtime_map_stubs.c @@ -57,6 +57,7 @@ uint32_t ls_read_hook(uint32_t a, int s, uint32_t v) { (void)a; (void)s; return void ls_write_hook(uint32_t a, int s, uint32_t v) { (void)a; (void)s; (void)v; } void ls_shadow_record_unreplayable(void) {} int fntrace_is_game_started(void) { return 0; } +void fntrace_restore_game_started(int started) { (void)started; } void overlay_loader_note_code_write(void) {} void overlay_loader_resync_validation_after_restore(void) {} void gte_canonicalize_cpu_state(CPUState *cpu) { (void)cpu; } diff --git a/runtime/tests/test_dma_gpu_list_cpu_hold.py b/runtime/tests/test_dma_gpu_list_cpu_hold.py index d82ac759..24a9ff19 100644 --- a/runtime/tests/test_dma_gpu_list_cpu_hold.py +++ b/runtime/tests/test_dma_gpu_list_cpu_hold.py @@ -17,5 +17,6 @@ if __name__ == '__main__': with tempfile.TemporaryDirectory() as root: for opt in ('-O0', '-O2'): build_and_run(args.cc, here, here.parent, opt, Path(root), - ['dma.c', 'dma_gpu_ll.c'], 'test_dma_gpu_list_cpu_hold.c') + ['dma.c', 'dma_gpu_ll.c', 'gpu_timeline.c'], + 'test_dma_gpu_list_cpu_hold.c') print('PASS: the GPU linked-list kick holds the CPU until the walk ends (O0/O2)') diff --git a/runtime/tests/test_fntrace_restore_handoff.c b/runtime/tests/test_fntrace_restore_handoff.c new file mode 100644 index 00000000..2ed82734 --- /dev/null +++ b/runtime/tests/test_fntrace_restore_handoff.c @@ -0,0 +1,27 @@ +#include "fntrace.h" +#include <stdio.h> +#include <stdlib.h> + +static int effects; +void dirty_ram_clear_image_baseline(void) { ++effects; } +void memory_clear_low_boot_scratch(void) { ++effects; } +void cdrom_notify_game_started(void) { ++effects; } +void boot_state_trigger_capture(const CPUState* cpu) { (void)cpu; ++effects; } +static void check(int ok, const char* message) { + if (!ok) { fprintf(stderr, "FAIL: %s\n", message); exit(1); } +} +int main(void) { + CPUState cpu = {0}; + fntrace_set_game_range(0x8006B58Cu, 0); + fntrace_restore_game_started(1); + fntrace_mark_game_started(&cpu); + check(fntrace_is_game_started() && !effects, "cold game restore skips destructive handoff"); + fntrace_restore_game_started(0); + check(!fntrace_is_game_started() && !effects, "pre-game restore resets warm latch"); + fntrace_mark_game_started(&cpu); + check(effects == 4, "normal boot retains all handoff effects"); + fntrace_mark_game_started(&cpu); + check(effects == 4, "handoff remains one-shot"); + puts("restored handoff checks passed"); + return 0; +} diff --git a/runtime/tests/test_gl_internal_scale_guards.py b/runtime/tests/test_gl_internal_scale_guards.py index f194d437..d7ef6089 100644 --- a/runtime/tests/test_gl_internal_scale_guards.py +++ b/runtime/tests/test_gl_internal_scale_guards.py @@ -102,7 +102,7 @@ class GlScaleGuards(unittest.TestCase): self.assertIn("(nverts + 2 * nl) * 6 * sizeof(float)", flush) self.assertRegex(flush, r"if \(nl\) flat_batch_draw_hr_lines\(nverts, nl\);\n" r"\s*else glDrawArrays\((GL_TRIANGLES|fmode), 0, nverts\);") - self.assertIn("hiw_enqueue_geo(s_fb, nverts, semi, mask, mirror, 0)", flush) + self.assertIn("hiw_enqueue_geo(s_fb, nverts, semi, mask, mirror, s_fb_gate)", flush) wide = flush[flush.index("wide_target_begin("):] self.assertRegex(wide, r"glDrawArrays\((GL_TRIANGLES|fmode), 0, nverts\);") hr = body(GL, "static void flat_batch_draw_hr_lines(int nverts, int nl)") @@ -143,7 +143,7 @@ class HiresWindowGuards(unittest.TestCase): for site, call in (("static void flush_tex_batch(void)", "if (hiw_on() && hiw_enqueue_tex(nverts, semi, mirror, s_tb_gate)) mirror = 0;"), ("static void flush_flat_batch(void)", - "if (hiw_on() && hiw_enqueue_geo(s_fb, nverts, semi, mask, mirror, 0)) mirror = 0;"), + "if (hiw_on() && hiw_enqueue_geo(s_fb, nverts, semi, mask, mirror, s_fb_gate)) mirror = 0;"), ("static void gpu_geometry(", "mirror = 0;")): fn = body(GL, site) self.assertIn(call, fn, site) diff --git a/runtime/tests/test_gl_readback_region.c b/runtime/tests/test_gl_readback_region.c index 44e46761..f6d60e96 100644 --- a/runtime/tests/test_gl_readback_region.c +++ b/runtime/tests/test_gl_readback_region.c @@ -1,6 +1,10 @@ /* Original source-owned GL readback-coherence regression. No retail payload. */ #include "gpu_gl_renderer.c" #include "mod_texture_banks.c" +#include "gpu_timeline.c" +uint64_t psx_cycle_count=0; +static int test_full_composite; +int gpu_ws_background_requires_full_composite(void){return test_full_composite;} uint32_t psx_mod_gpu_dma_memory_alloc(uint32_t n,uint32_t a){(void)n;(void)a;return 0;} uint32_t psx_mod_read_word(uint32_t a){(void)a;return 0;} static uint16_t image[1024*512], oracle[1024*512]; @@ -153,6 +157,28 @@ static void verify_camera_plane_clip(int scale) { check(glb_vram_read(100,100)==(16|(6<<5)),"fractional clipped UV sample one"); check(glb_vram_read(200,100)==(18|(7<<5)),"fractional clipped UV sample two"); } +/* Native-wide, vertically double-buffered (both bands in ONE wide surface): + * a full-width flat rect takes the full-screen-overlay wide pass. It spans + * above its draw area; canonical VRAM clips it at the band top, and the wide + * surface must clip it there too instead of painting the other band. */ +static void verify_wide_overlay_band(void) { + const int S=s_scale,W=426*S,H=512*S; + uint32_t *wide=(uint32_t*)malloc((size_t)W*H*sizeof(uint32_t)); + int ow=0,oh=0; + check(wide!=NULL,"wide dump alloc");if(!wide)return; + glb_set_draw_area(0,0,1023,511); + glb_wide_configure(426,53);glb_wide_set_target(0); + glb_wide_clear(0,0,512,0x0421); + glb_set_draw_area(0,240,319,479); + glb_draw_flat_rect(0,158,320,322,0x001f);flush_flat_batch(); + check(glb_wide_dump_full(wide,W*H,&ow,&oh,0)>0&&ow==W&&oh==H,"wide surface dump"); + const uint32_t other=wide[(200*S)*W+5*S],edge=wide[(239*S+S-1)*W+420*S],drawn=wide[(240*S)*W+5*S]; + check(((other>>16)&0xff)<0x20,"overlay rect leaves the other band's margin"); + check(((edge>>16)&0xff)<0x20,"overlay rect stops at the draw-area top row"); + check(((drawn>>16)&0xff)>=0xf0,"overlay rect covers its own band's margin"); + free(wide); + glb_set_draw_area(0,0,1023,511);glb_wide_disable_target();glb_wide_configure(0,0); +} int main(int argc,char **argv){ int scale=argc>1?atoi(argv[1]):1; if(SDL_Init(SDL_INIT_VIDEO)!=0)return 2; @@ -296,6 +322,8 @@ int main(int argc,char **argv){ glb_wide_set_view(0,0,0,0); check(wide_dx()==53,"disabled view preserves original origin"); free(wide_pixels); + for(test_full_composite=0;test_full_composite<2;test_full_composite++)verify_wide_overlay_band(); + test_full_composite=0; printf("checks=%d failures=%d\n",checks,failures); gl_renderer_shutdown();SDL_DestroyWindow(win);SDL_Quit();return failures?1:0; } diff --git a/runtime/tests/test_gpu_gp0_history_guard.py b/runtime/tests/test_gpu_gp0_history_guard.py index 5fb8768e..00877808 100644 --- a/runtime/tests/test_gpu_gp0_history_guard.py +++ b/runtime/tests/test_gpu_gp0_history_guard.py @@ -18,6 +18,7 @@ import tempfile ROOT = pathlib.Path(__file__).resolve().parents[2] GPU_C = ROOT / "runtime" / "src" / "gpu.c" +GPU_TIMELINE_C = ROOT / "runtime" / "src" / "gpu_timeline.c" DEFAULT_GCC = pathlib.Path(r"C:\msys64\mingw64\bin\gcc.exe") DRIVER_C = r""" @@ -201,6 +202,7 @@ STUBS_C = r""" #include <string.h> uint64_t s_frame_count = 0; +uint64_t psx_cycle_count = 0; uint32_t g_debug_last_store_pc = 0x80012340u; uint32_t g_psx_ram_size = 0x00200000u; uint32_t g_psx_ram_mask = 0x001FFFFFu; @@ -242,8 +244,8 @@ int ws_cull_should_keep(uint32_t addr) { (void)addr; return 1; } int ws_ui_group_should_keep(uint32_t addr) { (void)addr; return 1; } uint32_t psx_mod_gpu_dma_resolve_address(uint32_t address) { return address; } void ws_ui_group_assign(WsUiGroupItem *items, size_t count, - int32_t display_width, int dense_menu) -{ (void)items; (void)count; (void)display_width; (void)dense_menu; } + int32_t display_width, int dense_menu, int in_place) +{ (void)items; (void)count; (void)display_width; (void)dense_menu; (void)in_place; } int32_t ws_ui_anchor_for_bounds(int32_t x, int32_t width, int32_t display_width) { (void)x; (void)width; return display_width / 2; } int gte_geometry_correction_enabled(void) { return 0; } @@ -441,6 +443,7 @@ def build(cc: str, work: pathlib.Path, name: str, prod: bool) -> pathlib.Path: cmd.extend([ str(work / "driver.c"), str(GPU_C), + str(GPU_TIMELINE_C), str(work / "stubs.c"), ]) if platform.system() == "Darwin": diff --git a/runtime/tests/test_gpu_textured_dot_nw_shift_exec.c b/runtime/tests/test_gpu_textured_dot_nw_shift_exec.c index 37fe4fb2..31dbb239 100644 --- a/runtime/tests/test_gpu_textured_dot_nw_shift_exec.c +++ b/runtime/tests/test_gpu_textured_dot_nw_shift_exec.c @@ -19,6 +19,8 @@ static void reset_gpu_state_for_test(void) { memset(test_ram, 0, sizeof(test_ram)); memset(&last_textured_rect, 0, sizeof(last_textured_rect)); memset(ws_hud_anchor_tags, 0, sizeof(ws_hud_anchor_tags)); + memset(ws_background_tags, 0, sizeof(ws_background_tags)); + ws_background_tags_used = 0; memset(ws_tags, 0, sizeof(ws_tags)); s_frame_count = 100; @@ -84,6 +86,91 @@ static void configure_native_wide_16_9(void) { ws_full_2d = 1; } +static void test_background_packet_tags(void) { + /* The second F4 is embedded in a DMA node: its preceding word need not + * be a P_TAG. Only the command and its complete contents are authority. */ + const uint32_t addr = 0x1001Cu; + const uint32_t packet[] = {0x28020304u, 0, 320, 240u << 16, + (240u << 16) | 320u}; + reset_gpu_state_for_test(); + memcpy(&test_ram[addr / 4u], packet, sizeof(packet)); + gp0_cmd_source_addr = addr; + gp0_words_needed = 5; + memcpy(gp0_cmd_buf, packet, sizeof(packet)); + gpu_ws_tag_background_prim(addr - 4u); + assert(!gpu_ws_background_stretch_active()); + assert(!gpu_ws_background_requires_full_composite()); + assert(!ws_nw_explicit_background()); + + configure_native_wide_16_9(); + gpu_ws_tag_background_prim(0x80000000u | (addr - 4u)); + assert(gpu_ws_background_stretch_active()); + assert(gpu_ws_background_requires_full_composite()); + assert(ws_nw_explicit_background()); + /* Explicit proof remains valid after a foreground phase has begun. */ + s_bg_phase_frame = (uint32_t)s_frame_count; + s_bg_phase_over = 1; + assert(psx_ws_prim_in_backdrop() == 1); + assert(memcmp(&test_ram[addr / 4u], packet, sizeof(packet)) == 0); + + for (unsigned i = 0; i < 5; ++i) { + gp0_cmd_buf[i] ^= 1u; + assert(!ws_nw_explicit_background()); + gp0_cmd_buf[i] ^= 1u; + } + gp0_cmd_source_addr += 4u; + assert(!ws_nw_explicit_background()); + gp0_cmd_source_addr -= 4u; + gp0_words_needed = 4; + assert(!ws_nw_explicit_background()); + gp0_words_needed = 5; + s_frame_count += 2; + assert(ws_nw_explicit_background()); + ++s_frame_count; + assert(!gpu_ws_background_stretch_active()); + assert(!ws_nw_explicit_background()); + /* A held display retains its stretched pixels after packet expiry. The + * compositor must not paste canonical 4:3 scenery over their center. */ + assert(gpu_ws_background_requires_full_composite()); + s_frame_count += 120; + assert(gpu_ws_background_requires_full_composite()); + assert(!ws_nw_explicit_background()); + s_frame_count = 99; + assert(!gpu_ws_background_stretch_active()); + assert(gpu_ws_background_requires_full_composite()); + s_frame_count = 100; + ws_mode = 0; + assert(!gpu_ws_background_stretch_active()); + assert(!gpu_ws_background_requires_full_composite()); + + /* Reject semi-transparent polygons, rectangles, misalignment and RAM + * overflow; a rejected tag must not even enable the full-composite path. */ + const uint32_t bad_prim[] = {addr - 3u, 0xFFFFFFFCu, 0x801FFFFCu, + 0x1F800000u}; + reset_gpu_state_for_test(); + configure_native_wide_16_9(); + assert(!gpu_ws_background_requires_full_composite()); + for (unsigned i = 0; i < sizeof(bad_prim) / sizeof(bad_prim[0]); ++i) + gpu_ws_tag_background_prim(bad_prim[i]); + assert(!gpu_ws_background_stretch_active()); + const uint32_t bad_op[] = {0x2Au, 0x2Eu, 0x3Eu, 0x64u, 0x40u}; + for (unsigned i = 0; i < sizeof(bad_op) / sizeof(bad_op[0]); ++i) { + test_ram[addr / 4u] = bad_op[i] << 24; + gpu_ws_tag_background_prim(addr - 4u); + assert(!gpu_ws_background_stretch_active()); + } + /* The GTE-produced textured quad also qualifies, with all nine words + * covered by its guard, including the last UV word. */ + test_ram[addr / 4u] = 0x2DFFFFFFu; + gpu_ws_tag_background_prim(addr - 4u); + gp0_cmd_source_addr = addr; + gp0_words_needed = 9; + memcpy(gp0_cmd_buf, &test_ram[addr / 4u], 9u * sizeof(uint32_t)); + assert(ws_nw_explicit_background()); + gp0_cmd_buf[8] ^= 0x10000u; + assert(!ws_nw_explicit_background()); +} + int main(void) { reset_gpu_state_for_test(); set_dot_packet(0x10004u, 137, 42); @@ -159,6 +246,7 @@ int main(void) { g_test_precise_words = 0; } - puts("gpu_textured_dot_nw_shift_exec_test: PASS"); + test_background_packet_tags(); + puts("gpu_textured_dot_nw_shift_exec_test: PASS (HUD and background tags)"); return 0; } diff --git a/runtime/tests/test_gte_register_access.cpp b/runtime/tests/test_gte_register_access.cpp index 58622e6e..5df26aee 100644 --- a/runtime/tests/test_gte_register_access.cpp +++ b/runtime/tests/test_gte_register_access.cpp @@ -1,6 +1,7 @@ #include "cpu_state.h" #include "gte.h" #include "pgxp.h" +#include "gte_nclip_stats.h" #include "render_pass_projection.h" #include <array> @@ -57,6 +58,7 @@ extern "C" int psx_overlay_shadow_diff_active(void) { return g_test_shadow_diff; extern "C" void psx_ws_note_gte_project(int) {} extern "C" { uint64_t s_frame_count = 0; +uint32_t g_debug_last_store_pc = 0; } uint64_t g_test_cycle = 0; @@ -652,6 +654,8 @@ int test_precise_nclip_is_title_scoped() { cpu.gte_data[12 + i] = packed[i]; gte_test_seed_precise_projection(i, packed[i], x16[i], y16[i], 100); } + gte_nclip_stats_reset(); + g_debug_last_store_pc = 0x80012340u; uint64_t hit0 = 0, fallback0 = 0, disagree0 = 0; gte_nclip_precise_stats(&hit0, &fallback0, &disagree0); gte_execute(&cpu, 0x06u); @@ -661,9 +665,34 @@ int test_precise_nclip_is_title_scoped() { fallback1 != fallback0 || disagree1 != disagree0 + 1u) return fail_value("precise NCLIP preserves guest MAC0", 0, 0x06u, 0, 1u, cpu.gte_data[24]); - if (!gte_nclip_precise_bltz(1) || gte_nclip_precise_bltz(2)) + /* The branch consumer sees the precise (negative) sign only for the MAC0 + * the NCLIP produced; any other value keeps its native sign. Every branch + * shape tests this one sign. */ + if (gte_nclip_exact_sign(1, 0x80011000u) != -1 || + gte_nclip_exact_sign(2, 0x80011000u) != 1 || + gte_nclip_exact_sign(0, 0x80011004u) != 0) return fail_value("title-scoped precise NCLIP predicate", 0, 0x06u, 0, 1u, 0u); + { + GteNclipSiteStat sites[GTE_NCLIP_STAT_CAP]; + const int n = gte_nclip_site_stats(sites, GTE_NCLIP_STAT_CAP); + uint32_t evals = 0, flips = 0, falls = 0; + for (int i = 0; i < n; ++i) + if (sites[i].pc == 0x80011000u) { + evals = sites[i].evals; flips = sites[i].flips; + falls = sites[i].fallbacks; + } + if (evals != 2u || flips != 1u || falls != 1u) + return fail_value("exact NCLIP site attribution", 0, 0x06u, + 0, 2u, evals); + GteNclipFuncStat funcs[GTE_NCLIP_STAT_CAP]; + const int nf = gte_nclip_func_stats(funcs, GTE_NCLIP_STAT_CAP); + uint32_t fn = 0, fd = 0; + for (int i = 0; i < nf; ++i) + if (funcs[i].func == 0x80012340u) { fn = funcs[i].nclips; fd = funcs[i].disagree; } + if (fn != 1u || fd != 1u) + return fail_value("NCLIP producer attribution", 0, 0x06u, 0, 1u, fn); + } /* A stale packed-word shadow must fail closed to the native sign and count * as a fallback, never as a precise hit. */ @@ -675,7 +704,7 @@ int test_precise_nclip_is_title_scoped() { g_test_precise_nclip_enabled = 0; if (cpu.gte_data[24] != 1u || hit2 != hit1 || fallback2 != fallback1 + 1u || disagree2 != disagree1 || - gte_nclip_precise_bltz(1)) + gte_nclip_exact_sign(1, 0x80011000u) != 1) return fail_value("stale precise NCLIP falls back natively", 0, 0x06u, 0, 1u, cpu.gte_data[24]); return 0; diff --git a/runtime/tests/test_host_keymap.c b/runtime/tests/test_host_keymap.c index 4a3afe52..d1839e81 100644 --- a/runtime/tests/test_host_keymap.c +++ b/runtime/tests/test_host_keymap.c @@ -30,6 +30,15 @@ int main(int argc, char **argv) { "default fullscreen includes Alt+Return"); check(host_keymap_match(HOST_KEYMAP_FULLSCREEN, (int)SDLK_f, mod_ctrl()), "default fullscreen includes Ctrl+F"); + /* A real key event carries only one side's modifier bit. */ + check(host_keymap_match(HOST_KEYMAP_FULLSCREEN, (int)SDLK_f, (int)KMOD_LCTRL), + "Ctrl+F matches a left-Ctrl-only press"); + check(host_keymap_match(HOST_KEYMAP_FULLSCREEN, (int)SDLK_RETURN, (int)KMOD_RALT), + "Alt+Return matches a right-Alt-only press"); + check(host_keymap_match(HOST_KEYMAP_CAPTURE_MARK, (int)SDLK_m, (int)KMOD_LCTRL), + "default capture mark is Ctrl+M"); + check(!host_keymap_match(HOST_KEYMAP_CAPTURE_MARK, (int)SDLK_m, 0), + "plain M does not trigger the capture mark"); keys[SDL_SCANCODE_TAB] = 1; check(host_keymap_down(HOST_KEYMAP_TURBO, keys, 0), "default turbo is held by Tab"); diff --git a/runtime/tests/test_host_snapshot_guard.c b/runtime/tests/test_host_snapshot_guard.c new file mode 100644 index 00000000..50efd514 --- /dev/null +++ b/runtime/tests/test_host_snapshot_guard.c @@ -0,0 +1,37 @@ +#include "interrupts.c" + +int psx_mod_function_entry_active(void) { return 0; } +int g_cosim_dirty_pump_site; +int g_call_unit_depth; +int g_psx_dispatch_depth; +uint32_t g_dirty_safe_resume_pc; + +static void check(int ok, const char* message) { + if (!ok) { fprintf(stderr, "FAIL: %s\n", message); exit(1); } +} + +int main(void) { + uint32_t pc = 0x80025070u; + check(psx_irq_resume_context_snapshot_safe_at(pc), "native boundary admitted"); + psx_snapshot_host_call_begin(); + psx_snapshot_host_call_begin(); + check(!psx_irq_resume_context_snapshot_safe_at(pc), "nested host adapter deferred"); + psx_snapshot_host_call_end(); + check(!psx_irq_resume_context_snapshot_safe_at(pc), "outer adapter still active"); + psx_snapshot_host_call_end(); + check(psx_irq_resume_context_snapshot_safe_at(pc), "register restore admits snapshot"); + g_cosim_dirty_pump_site = 1; + g_dirty_safe_resume_pc = pc; + check(psx_irq_resume_context_snapshot_safe_at(pc), "retired interpreter boundary admitted"); + psx_snapshot_host_call_begin(); + check(!psx_irq_resume_context_snapshot_safe_at(pc), "interpreter adapter deferred"); + psx_snapshot_host_call_reset(); /* scheduler longjmp abandoned the adapter */ + check(psx_irq_resume_context_snapshot_safe_at(pc), "scheduler escape releases abandoned scope"); + psx_snapshot_host_call_end(); /* no underflow */ + check(psx_irq_resume_context_snapshot_safe_at(pc), "unmatched end stays safe"); + check(!psx_irq_resume_context_snapshot_safe_at(pc + 4), "existing resume-PC guard retained"); + g_call_unit_depth = 1; + check(!psx_irq_resume_context_snapshot_safe_at(pc), "existing call-unit guard retained"); + puts("host snapshot continuation checks passed"); + return 0; +} diff --git a/runtime/tests/test_interp_mod_entry_guards.py b/runtime/tests/test_interp_mod_entry_guards.py index ddd3d2d2..b6b6fc1a 100644 --- a/runtime/tests/test_interp_mod_entry_guards.py +++ b/runtime/tests/test_interp_mod_entry_guards.py @@ -21,7 +21,10 @@ def main(): assert source.count('psx_mod_function_entry(cpu, addr)') == 1 # Every interpreted entry reaches these calls: without an active hook they # must cost one load, never a call into the plugin table. - assert 'if (!forced && g_psx_mod_function_entry_hooks && psx_mod_function_entry(cpu, addr))\n return 1;' in source + # A forced span replay (psx_mod_run_guest_span) runs inside a hook + # already: it must not re-enter the entry hooks, so the check leads. + assert ('if (!forced && g_psx_mod_function_entry_hooks && ' + 'psx_mod_function_entry(cpu, addr))\n return 1;') in source assert 'if (g_psx_mod_function_entry_hooks &&\n' in source local_start = source.index('if (allow_local_dirty_flow && target != 0 &&') local_end = source.index('current_page = target_phys >> 12;', local_start) @@ -35,6 +38,10 @@ def main(): assert local.count('psx_mod_function_entry(cpu, target)') == 1 assert local.index('overlay_loader_dispatch(cpu, target)') < local.index( 'psx_mod_function_entry(cpu, target)') < local.index('pc = target;') + completion = local[local.index('if (g_psx_mod_function_entry_hooks &&'):] + completion = completion[:completion.index('pc = target;')] + assert 'g_dirty_interp_chain_target = cpu->pc;' in completion + assert 'OV_FPLOG_RET1();' in completion print('interpreter mod entry guards: PASS') diff --git a/runtime/tests/test_mod_media.cpp b/runtime/tests/test_mod_media.cpp new file mode 100644 index 00000000..bb574b0a --- /dev/null +++ b/runtime/tests/test_mod_media.cpp @@ -0,0 +1,116 @@ +#include "mod_media.h" +#include "psx_sha256.h" +#include <algorithm> +#include <filesystem> +#include <fstream> +#include <iostream> +#include <string> + +namespace fs = std::filesystem; +using namespace PSXRecompV4; +static int failures; +static void check(bool ok, const char* text) { + if (!ok) { std::cerr << "FAIL: " << text << '\n'; ++failures; } +} +static void write(const fs::path& path, const std::vector<uint8_t>& bytes) { + std::ofstream out(path, std::ios::binary); + out.write(reinterpret_cast<const char*>(bytes.data()), bytes.size()); +} +static std::string hash(const std::vector<uint8_t>& bytes) { + uint8_t digest[32]; + psx_sha256_compute(bytes.data(), bytes.size(), digest); + std::string result; + for (uint8_t byte : digest) { + result += "0123456789abcdef"[byte >> 4]; + result += "0123456789abcdef"[byte & 15]; + } + return result; +} +int main(int argc, char** argv) { + std::shared_ptr<const std::vector<uint8_t>> bytes; + std::string error; + if (argc == 5) { + const bool ok = load_mod_media(argv[1], argv[2], std::stoull(argv[3]), argv[4], bytes, &error); + if (!ok) { std::cerr << error << '\n'; return 1; } + std::cout << "verified bytes=" << bytes->size() << " sha256=" << hash(*bytes) << '\n'; + return 0; + } + const fs::path root = fs::temp_directory_path() / "psxrecomp-mod-media-test"; + fs::create_directories(root); + std::vector<uint8_t> rom(64); + for (size_t i = 0; i < rom.size(); ++i) rom[i] = static_cast<uint8_t>(i); + rom[0] = 0x80; rom[1] = 0x37; rom[2] = 0x12; rom[3] = 0x40; + const auto rom_hash = hash(rom); + const auto path = root / "rom.z64"; + write(path, rom); + check(load_mod_media(path, "n64-rom", rom.size(), rom_hash, bytes, &error) && *bytes == rom, + "canonical N64 bytes"); + auto snapshot = bytes; + auto swapped = rom; + for (size_t i = 0; i < swapped.size(); i += 2) std::swap(swapped[i], swapped[i + 1]); + write(path, swapped); + check(load_mod_media(path, "n64-rom", rom.size(), rom_hash, bytes, &error) && *bytes == rom, + "halfword swapped N64 identity"); + swapped = rom; + for (size_t i = 0; i < swapped.size(); i += 4) + std::reverse(swapped.begin() + i, swapped.begin() + i + 4); + write(path, swapped); + check(load_mod_media(path, "n64-rom", rom.size(), rom_hash, bytes, &error) && *bytes == rom, + "word swapped N64 identity"); + swapped[32] ^= 1; + write(path, swapped); + check(!load_mod_media(path, "n64-rom", rom.size(), rom_hash, bytes, &error) && !bytes, + "same-size wrong media rejected without exposing bytes"); + check(*snapshot == rom, "snapshot survives on-disk changes"); + check(!load_mod_media(path, "n64-rom", rom.size() + 4, rom_hash, bytes, &error), "size guard"); + check(!load_mod_media(path, "n64-rom", rom.size(), std::string(64, 'z'), bytes, &error), "hash syntax"); + check(!load_mod_media(root / "absent", "n64-rom", 64, rom_hash, bytes, &error), "missing file"); + check(!load_mod_media(path, "file", 513ull * 1024 * 1024, rom_hash, bytes, &error), "bounded allocation"); + + std::vector<uint8_t> iso(24 * 2048); + size_t pvd = 16 * 2048; + iso[pvd] = 1; + std::copy_n("CD001", 5, iso.begin() + pvd + 1); + iso[pvd + 6] = 1; iso[pvd + 80] = 24; iso[pvd + 87] = 24; + iso[pvd + 129] = 8; iso[pvd + 130] = 8; + const auto iso_hash = hash(iso); + const auto disc = root / "disc.iso"; + write(disc, iso); + check(load_mod_media(disc, "psx-disc", iso.size(), iso_hash, bytes, &error) && *bytes == iso, + "cooked ISO volume"); + for (unsigned mode : {1u, 2u}) { + std::vector<uint8_t> raw(24 * 2352); + for (unsigned i = 0; i < 24; ++i) { + std::fill(raw.begin() + i * 2352 + 1, raw.begin() + i * 2352 + 11, 0xff); + raw[i * 2352 + 15] = static_cast<uint8_t>(mode); + std::copy_n(iso.begin() + i * 2048, 2048, + raw.begin() + i * 2352 + (mode == 1 ? 16 : 24)); + } + write(root / "disc.bin", raw); + check(load_mod_media(root / "disc.bin", "psx-disc", iso.size(), iso_hash, bytes, &error) && *bytes == iso, + "Mode 1/2 raw BIN canonical identity"); + write(root / "audio.bin", std::vector<uint8_t>(2352, 0x5a)); + const auto cue = root / "disc.cue"; + { + std::ofstream out(cue); + out << "FILE \"disc.bin\" BINARY\n TRACK 01 MODE" << mode << "/2352\n INDEX 01 00:00:00\n" + "FILE \"audio.bin\" BINARY\n TRACK 02 AUDIO\n INDEX 01 00:00:00\n"; + } + check(load_mod_media(cue, "psx-disc", iso.size(), iso_hash, bytes, &error) && *bytes == iso, + "CUE identity excludes audio tracks"); + } + iso[pvd + 87] = 23; + write(disc, iso); + check(!load_mod_media(disc, "psx-disc", iso.size(), hash(iso), bytes, &error), "ISO endian count guard"); + iso[pvd + 87] = 24; iso[pvd + 1] = 'X'; + write(disc, iso); + check(!load_mod_media(disc, "psx-disc", iso.size(), hash(iso), bytes, &error), "ISO PVD guard"); + iso[pvd + 1] = 'C'; iso[pvd + 80] = 40; iso[pvd + 87] = 40; + write(disc, iso); + check(load_mod_media(disc, "psx-disc", iso.size(), hash(iso), bytes, &error) && *bytes == iso, + "mixed-mode volume size may extend beyond data track"); + for (const char* file : {"rom.z64", "disc.iso", "disc.bin", "disc.cue", "audio.bin"}) + fs::remove(root / file); + fs::remove(root); + return failures ? 1 : 0; +} diff --git a/runtime/tests/test_mod_packages.cpp b/runtime/tests/test_mod_packages.cpp index 73a79f3c..ff9df1aa 100644 --- a/runtime/tests/test_mod_packages.cpp +++ b/runtime/tests/test_mod_packages.cpp @@ -410,6 +410,37 @@ int main() { "an implementation exposes exactly the hooks it registered"); check(mod_function_entry_hooks("test.missing").empty(), "an unregistered implementation exposes no hooks"); + /* Audit: a hook registered under a sub-id of the package's declared + * plugin can never be activated by a plan and must be reported. */ + check(mod_register_function_entry_plugin("test.entry.hud", 0x80020000u, entry_hook), + "sub-id function-entry plugin must register"); + { + const fs::path audit_root = root / "audit-authored"; + write_text(audit_root / "entry.mod/1.0.0/manifest.toml", + "format_version = 5\n" + "id = \"entry.mod\"\n" + "version = \"1.0.0\"\n" + "name = \"Entry Mod\"\n" + "resolver = \"declarative\"\n" + "[[target]]\n" + "game_id = \"SLUS-TEST\"\n" + "[[feature]]\n" + "id = \"entry\"\n" + "name = \"Entry Plugin\"\n" + "[[plugin]]\n" + "feature = \"entry\"\n" + "id = \"test.entry\"\n"); + const ModPluginAudit audit = mod_audit_registered_plugins({audit_root}); + check(audit.errors.empty() && audit.manifests == 1, + "audit must read every authored manifest"); + check(std::find(audit.declared.begin(), audit.declared.end(), + "test.entry") != audit.declared.end(), + "audit must collect declared [[plugin]] ids"); + check(audit.undeclared.size() == 1 && audit.undeclared[0] == "test.entry.hud", + "audit must report exactly the registered-but-undeclared id"); + const ModPluginAudit missing = mod_audit_registered_plugins({root / "absent"}); + check(!missing.errors.empty(), "audit must report an unreadable root"); + } mod_clear_plugins_for_tests(); ModResolution entry_unavailable = reload.resolve("SLUS-TEST"); check(!entry_unavailable.ok, @@ -2109,6 +2140,55 @@ int main() { mod_clear_plugins_for_tests(); } + { + const auto media_root = root / "media-catalog"; + const auto manifest_path = media_root / "packages/media.mod/1.0.0/manifest.toml"; + std::vector<uint8_t> rom(64); + rom[0] = 0x80; rom[1] = 0x37; rom[2] = 0x12; rom[3] = 0x40; + const auto owner = media_root / "owner.z64"; + const auto moved = media_root / "moved.v64"; + write_bytes(owner, rom); + const std::string declaration = + "id = \"media.mod\"\nversion = \"1.0.0\"\nname = \"Media\"\n" + "[[target]]\ngame_id = \"SLUS-TEST\"\n" + "[[feature]]\nid = \"arena\"\nname = \"Arena\"\n" + "[[resource]]\nfeature = \"arena\"\nid = \"rom\"\nlabel = \"ROM\"\n" + "format = \"n64-rom\"\nrequired = true\nsize = 64\nsha256 = \"" + sha256_hex(rom) + "\"\n"; + write_text(manifest_path, "format_version = 8\n" + declaration); + ModPackageManager media(media_root); + check(media.scan(&error) && media.scan_errors().empty(), "verified-media manifest parses"); + const auto stock_plan = media.resolve("SLUS-TEST"); + check(stock_plan.ok && stock_plan.resources.empty(), "disabled donor mod needs no media"); + check(media.set_feature_enabled("media.mod", "arena", true, &error), error.c_str()); + check(!media.resolve("SLUS-TEST").ok, "enabled donor mod without media cannot launch"); + check(media.set_feature_resource_path("media.mod", "arena", "rom", owner, &error), error.c_str()); + auto pinned = media.resolve("SLUS-TEST"); + check(pinned.ok && pinned.resources.size() == 1 && pinned.resources[0].bytes && + *pinned.resources[0].bytes == rom, "plan contains verified canonical bytes"); + auto swapped = rom; + for (size_t i = 0; i < swapped.size(); i += 2) std::swap(swapped[i], swapped[i + 1]); + write_bytes(moved, swapped); + check(media.set_feature_resource_path("media.mod", "arena", "rom", moved, &error), error.c_str()); + check(media.resolve("SLUS-TEST").fingerprint == pinned.fingerprint, + "donor fingerprint depends on canonical identity rather than path or byte order"); + swapped[24] ^= 1; + write_bytes(moved, swapped); + check(!media.resolve("SLUS-TEST").ok, "wrong same-size media blocks plan"); + fs::remove(moved); + check(!media.resolve("SLUS-TEST").ok, "removed media blocks a new plan"); + check(media.set_feature_enabled("media.mod", "arena", false, &error), error.c_str()); + const auto restored = media.resolve("SLUS-TEST"); + check(restored.ok && restored.resources.empty() && restored.fingerprint == stock_plan.fingerprint, + "disabling donor mod restores the exact stock plan"); + write_text(manifest_path, "format_version = 7\n" + declaration); + ModPackage invalid; + check(!ModPackageManager::read_manifest(manifest_path, invalid, &error), + "old manifest version cannot silently ignore donor verification"); + auto negative_size = declaration; + negative_size.replace(negative_size.find("size = 64"), 9, "size = -1"); + write_text(manifest_path, "format_version = 8\n" + negative_size); + check(!ModPackageManager::read_manifest(manifest_path, invalid, &error), "negative media size rejected"); + } fs::remove_all(root, ec); if (failures) { std::cerr << failures << " mod package test(s) failed\n"; diff --git a/runtime/tests/test_mod_resident.cpp b/runtime/tests/test_mod_resident.cpp new file mode 100644 index 00000000..7a1d5729 --- /dev/null +++ b/runtime/tests/test_mod_resident.cpp @@ -0,0 +1,280 @@ +/* Resident disc resources (mod_resident.h): build from the effective disc, + * warm verification, corruption and plan-change invalidation, stock policy, + * derived blobs, relocation, pruning and the guest-range guard. */ +#include "mod_resident.h" +#include "mod_runtime.h" +#include "mod_plugins.h" +#include "psx_sha256.h" +#include "gpu.h" + +#include <array> +#include <algorithm> +#include <cstdint> +#include <cstdlib> +#include <cstring> +#include <filesystem> +#include <fstream> +#include <iostream> +#include <string> +#include <vector> + +namespace fs = std::filesystem; + +static std::array<uint8_t, 2 * 1024 * 1024> ram; +static int failures; + +extern "C" uint8_t psx_read_byte(uint32_t a) { return ram[a & 0x1fffffu]; } +extern "C" void psx_write_byte(uint32_t a, uint8_t v) { ram[a & 0x1fffffu] = v; } +extern "C" uint16_t psx_read_half(uint32_t a) { + return (uint16_t)(ram[a & 0x1fffffu] | ram[(a + 1) & 0x1fffffu] << 8); +} +extern "C" void psx_write_half(uint32_t a, uint16_t v) { + psx_write_byte(a, (uint8_t)v); psx_write_byte(a + 1, (uint8_t)(v >> 8)); +} +extern "C" uint32_t psx_read_word(uint32_t a) { + return (uint32_t)psx_read_half(a) | (uint32_t)psx_read_half(a + 2) << 16; +} +extern "C" void psx_write_word(uint32_t a, uint32_t v) { + psx_write_half(a, (uint16_t)v); psx_write_half(a + 2, (uint16_t)(v >> 16)); +} +extern "C" void psx_host_write_byte(uint32_t a, uint8_t v) { psx_write_byte(a, v); } +extern "C" void psx_host_write_half(uint32_t a, uint16_t v) { psx_write_half(a, v); } +extern "C" void psx_host_write_word(uint32_t a, uint32_t v) { psx_write_word(a, v); } +extern "C" uint32_t psx_mod_memory_alloc(uint32_t, uint32_t) { return 0; } +extern "C" uint32_t psx_mod_gpu_dma_memory_alloc(uint32_t, uint32_t) { return 0; } +extern "C" void psx_ram_reset_size_request(void) {} +extern "C" void psx_projection_reset_session(void) {} +extern "C" void gpu_ws_set_native_scene_predicate(int (*)(void)) {} +extern "C" int psx_ws_x_margin(void) { return 0; } +extern "C" void gpu_get_display_info(GpuDisplayInfo* out) { *out = GpuDisplayInfo{}; } +extern "C" void dirty_ram_mark_executable_range(uint32_t, uint32_t) {} +extern "C" int fntrace_is_game_started(void) { return 1; } +extern "C" void gpu_ws_tag_hud_primitive(uint32_t, int) {} +extern "C" void gpu_ws_tag_world_primitive(uint32_t, int) {} +extern "C" void gpu_ws_set_adaptive_backdrop_preload(int) {} +extern "C" int gpu_ws_configured_x_reveal(void) { return 0; } +extern "C" void gpu_ws_tag_hud_prim(uint32_t, int) {} +extern "C" void gpu_ws_tag_screen_mask_quad(uint32_t) {} +extern "C" void gpu_ws_tag_radial_screen_mask_quad(uint32_t, float) {} + +static void check(bool ok, const char* what) { + if (!ok) { std::cerr << "FAIL: " << what << "\n"; failures++; } +} + +static std::string sha_hex(const uint8_t* p, size_t n) { + uint8_t d[32]; + psx_sha256_compute(p, n, d); + static const char* h = "0123456789abcdef"; + std::string s(64, '0'); + for (int i = 0; i < 32; i++) { s[2 * i] = h[d[i] >> 4]; s[2 * i + 1] = h[d[i] & 15]; } + return s; +} + +static void write_bytes(const fs::path& p, const std::vector<uint8_t>& b) { + fs::create_directories(p.parent_path()); + std::ofstream(p, std::ios::binary).write((const char*)b.data(), (std::streamsize)b.size()); +} +static void write_text(const fs::path& p, const std::string& t) { + fs::create_directories(p.parent_path()); + std::ofstream(p) << t; +} + +/* derive: one reversed copy of each file, plus a copy of file 0's bytes from + * file 1 (identical bytes must share one blob). */ +static int derive_calls; +static int derive(PSXResidentSink* sink, uint32_t file, const uint8_t* data, uint32_t size, + int stock, void* user) { + derive_calls++; + std::vector<uint8_t> rev(data, data + size); + std::reverse(rev.begin(), rev.end()); + const uint32_t meta[4] = {size, (uint32_t)stock, 0xabcdu, file}; + if (!psx_resident_emit(sink, file, 7, meta, rev.data(), size)) return 0; + if (file == 1) { + const auto* first = static_cast<const std::vector<uint8_t>*>(user); + if (!psx_resident_emit(sink, file, 9, nullptr, first->data(), (uint32_t)first->size())) return 0; + } + return 1; +} + +static std::string status() { + std::vector<char> b(8192); + return psx_resident_status_json(b.data(), (uint32_t)b.size()) ? std::string(b.data()) : ""; +} + +int main() { + std::error_code ec; + const fs::path root = fs::temp_directory_path() / "psx_mod_resident_test"; + fs::remove_all(root, ec); +#ifdef _WIN32 + _putenv_s("PSX_RESIDENT_CACHE", (root / "cache").string().c_str()); +#else + setenv("PSX_RESIDENT_CACHE", (root / "cache").string().c_str(), 1); +#endif + + /* ISO: root dir @20 -> DATA dir @21 -> A.BIN (3000 bytes @22..23), + * B.BIN (5000 bytes @24..26). Non-zero bytes after each end of file. */ + std::vector<uint8_t> iso(30 * 2048); + auto le32 = [&](size_t at, uint32_t n) { for (unsigned i = 0; i < 4; ++i) iso[at + i] = (uint8_t)(n >> (i * 8)); }; + auto record = [&](size_t at, uint32_t lba, uint32_t bytes, bool dir, const std::string& name) { + iso[at] = (uint8_t)((33 + name.size() + 1) & ~size_t(1)); + le32(at + 2, lba); le32(at + 10, bytes); iso[at + 25] = dir ? 2 : 0; + iso[at + 28] = 1; iso[at + 31] = 1; iso[at + 32] = (uint8_t)name.size(); + std::copy(name.begin(), name.end(), iso.begin() + at + 33); + return (size_t)iso[at]; + }; + iso[16 * 2048] = 1; std::copy_n("CD001", 5, iso.begin() + 16 * 2048 + 1); iso[16 * 2048 + 6] = 1; + record(16 * 2048 + 156, 20, 2048, true, std::string(1, '\0')); + record(20 * 2048, 21, 2048, true, "DATA"); + const size_t a_rec = 21 * 2048; + const size_t b_rec = a_rec + record(a_rec, 22, 3000, false, "A.BIN;1"); + record(b_rec, 24, 5000, false, "B.BIN;1"); + for (unsigned i = 0; i < 2 * 2048; ++i) iso[22 * 2048 + i] = i < 3000 ? (uint8_t)(i * 7) : 0xEE; + for (unsigned i = 0; i < 3 * 2048; ++i) iso[24 * 2048 + i] = i < 5000 ? (uint8_t)(i * 13 + 1) : 0xDD; + const std::vector<uint8_t> a_padded(iso.begin() + 22 * 2048, iso.begin() + 24 * 2048); + const std::vector<uint8_t> b_padded(iso.begin() + 24 * 2048, iso.begin() + 27 * 2048); + const std::string a_sha = sha_hex(a_padded.data(), a_padded.size()); + const std::string b_sha = sha_hex(b_padded.data(), b_padded.size()); + + const fs::path disc_root = root / "disc"; + const fs::path iso_path = disc_root / "game.iso"; + write_bytes(iso_path, iso); + std::string error; + check(PSXRecompV4::mod_runtime_initialize(disc_root, "RESIDENT", 0, {}, &error), "initialize"); + check(PSXRecompV4::mod_runtime_commit(iso_path, &error), "commit"); + check(!PSXRecompV4::mod_runtime_fingerprint().empty(), "a committed plan has a fingerprint"); + + uint32_t lba = 0, size = 0; + check(psx_mod_disc_file_extent("DATA/B.BIN", &lba, &size) && lba == 24 && size == 5000, + "extent query reports the effective record"); + check(!psx_mod_disc_file_extent("DATA", &lba, &size) && !lba && !size, "extent rejects directories"); + + PSXResidentFile files[2] = {{"DATA/A.BIN", 3000, a_sha.c_str()}, + {"data/b.bin", 5000, b_sha.c_str()}}; + PSXResidentSpec spec{}; + spec.struct_size = sizeof spec; + spec.title = "ResidentTest"; + spec.format = "rt-v1"; + spec.files = files; + spec.file_count = 2; + spec.policy = PSX_RESIDENT_REQUIRE_STOCK; + spec.derive = derive; + spec.derive_user = (void*)&a_padded; + spec.keep_packs = 2; + + const PSXResidentPack* pack = psx_resident_prepare(&spec); + check(pack != nullptr, "cold prepare"); + check(derive_calls == 2, "derive runs once per file on a cold build"); + check(status().find("\"state\":\"prepared\"") != std::string::npos, "status reports a prepared pack"); + uint32_t padded = 0; + const uint8_t* a = psx_resident_file(pack, 0, &size, &padded); + check(a && size == 3000 && padded == 4096 && std::equal(a_padded.begin(), a_padded.end(), a), + "file bytes include the true sector tail"); + check(psx_resident_file_lba(pack, 1) == 24 && psx_resident_file_stock(pack, 0) && + psx_resident_file_stock(pack, 1) && !psx_resident_modified_files(pack), "lba and stock flags"); + uint32_t which = 99; + const uint8_t* at = psx_resident_find_lba(pack, 25, 4096, &which); + check(at && which == 1 && std::equal(b_padded.begin() + 2048, b_padded.end(), at), "find by lba inside a file"); + check(!psx_resident_find_lba(pack, 25, 4097, nullptr), "find rejects spans past the padded end"); + check(!psx_resident_find_lba(pack, 21, 16, nullptr), "find rejects lbas before every file"); + check(psx_resident_derived_count(pack) == 3, "derived blobs kept in order"); + uint32_t file = 0, tag = 0, meta[4] = {}; + const uint8_t* d = psx_resident_derived(pack, 1, &file, &tag, meta, &size); + check(d && file == 1 && tag == 7 && size == 6144 && meta[0] == 6144 && meta[1] == 1 && meta[2] == 0xabcd && + d[0] == b_padded.back(), "derived blob metadata and bytes"); + const uint8_t* dup = psx_resident_derived(pack, 2, &file, &tag, nullptr, &size); + check(dup == a && tag == 9, "identical bytes share one blob"); + + /* Warm: verified from disk, derive not called. */ + pack = psx_resident_prepare(&spec); + check(pack && derive_calls == 2, "warm prepare reuses the cache"); + check(status().find("\"state\":\"verified\"") != std::string::npos, "status reports verification"); + check(std::equal(a_padded.begin(), a_padded.end(), psx_resident_file(pack, 0, nullptr, nullptr)), + "warm bytes identical"); + + /* A flipped payload byte is caught by its blob hash and rebuilt. */ + fs::path pack_path; + for (const auto& e : fs::directory_iterator(root / "cache" / "ResidentTest")) + if (e.path().extension() == ".pack") pack_path = e.path(); + { + std::fstream f(pack_path, std::ios::binary | std::ios::in | std::ios::out); + f.seekp(-1, std::ios::end); + char c = 0x55; + f.write(&c, 1); + } + pack = psx_resident_prepare(&spec); + check(pack && derive_calls == 4, "corrupt cache rebuilt"); + + /* Stock policy. */ + std::string wrong(64, '0'); + files[0].stock_sha256 = wrong.c_str(); + check(!psx_resident_prepare(&spec), "require-stock rejects a differing file"); + check(status().find("differs from the original disc") != std::string::npos, "failure reason kept"); + spec.policy = PSX_RESIDENT_ALLOW_MODIFIED; + pack = psx_resident_prepare(&spec); + check(pack && !psx_resident_file_stock(pack, 0) && psx_resident_modified_files(pack) == 1, + "allow-modified serves and counts the differing file"); + files[0].stock_sha256 = a_sha.c_str(); + spec.policy = PSX_RESIDENT_REQUIRE_STOCK; + + /* Old packs of this format are pruned to keep_packs; others untouched. */ + for (int i = 0; i < 4; i++) write_bytes(root / "cache" / "ResidentTest" / ("rt-v1-old" + std::to_string(i) + ".pack"), {1}); + write_bytes(root / "cache" / "ResidentTest" / "other-v1-x.pack", {1}); + pack = psx_resident_prepare(&spec); + unsigned ours = 0, other = 0; + for (const auto& e : fs::directory_iterator(root / "cache" / "ResidentTest")) { + const auto name = e.path().filename().string(); + ours += name.rfind("rt-v1-", 0) == 0; + other += name.rfind("other-", 0) == 0; + } + check(pack && ours == 3 && other == 1, "prune keeps the active pack plus keep_packs of its format only"); + + /* A mod plan that patches B and grows A through its directory record: + * a new key (new pack), effective bytes and the relocated extent. */ + write_text(disc_root / "packages/rt.patch/1.0.0/manifest.toml", + "format_version = 5\nid = \"rt.patch\"\nversion = \"1.0.0\"\nname = \"RT Patch\"\n" + "[[target]]\ngame_id = \"RESIDENT\"\ndisc_sha256 = \"" + sha_hex(iso.data(), iso.size()) + "\"\n" + "[[feature]]\nid = \"asset\"\nname = \"Asset\"\n" + "[[patch]]\nfeature = \"asset\"\ntarget = \"disc_user\"\noffset = " + std::to_string(24 * 2048 + 2) + "\n" + "expected = \"1b\"\nreplace = \"5a\"\n" + "[[patch]]\nfeature = \"asset\"\ntarget = \"disc_user\"\noffset = " + std::to_string(a_rec + 10) + "\n" + "expected = \"b80b0000\"\nreplace = \"00100000\"\n"); + write_text(disc_root / "state.toml", + "format_version = 2\n[[feature]]\npackage_id = \"rt.patch\"\nid = \"asset\"\nenabled = true\n"); + const std::string stock_fingerprint = PSXRecompV4::mod_runtime_fingerprint(); + check(PSXRecompV4::mod_runtime_initialize(disc_root, "RESIDENT", 0, {}, &error) && + PSXRecompV4::mod_runtime_commit(iso_path, &error), "patched plan commit"); + check(PSXRecompV4::mod_runtime_fingerprint() != stock_fingerprint, "plan fingerprint changed"); + check(!psx_resident_prepare(&spec), "require-stock refuses the modded plan"); + spec.policy = PSX_RESIDENT_ALLOW_MODIFIED; + const int before = derive_calls; + pack = psx_resident_prepare(&spec); + check(pack && derive_calls == before + 2, "modded plan builds its own pack"); + const uint8_t* b = psx_resident_file(pack, 1, &size, nullptr); + check(b && b[2] == 0x5a && !psx_resident_file_stock(pack, 1), "effective patched bytes served"); + a = psx_resident_file(pack, 0, &size, &padded); + check(a && size == 4096 && padded == 4096 && a[3500] == 0xEE && !psx_resident_file_stock(pack, 0), + "grown file read through its patched directory record"); + check(status().find("\"modified\":2") != std::string::npos, "status counts modified files"); + + /* Guest-range guard. */ + for (uint32_t i = 0; i < 64; i++) ram[0x1000 + i] = (uint8_t)(i ^ 0x5a); + std::vector<uint8_t> guarded(ram.begin() + 0x1000, ram.begin() + 0x1040); + const std::string guard = sha_hex(guarded.data(), guarded.size()); + const PSXResidentRange ranges[2] = {{0x80001000u, 0x80001020u}, {0x80001020u, 0x80001040u}}; + check(psx_resident_guest_ranges_match(ranges, 2, guard.c_str()), "guard matches"); + ram[0x1030] ^= 1; + check(!psx_resident_guest_ranges_match(ranges, 2, guard.c_str()), "guard detects a changed byte"); + + /* Invalid specs are refused before any disc access. */ + PSXResidentSpec bad = spec; + bad.format = "bad/format"; + check(!psx_resident_prepare(&bad), "format ids are file-name safe"); + bad = spec; + bad.struct_size = 4; + check(!psx_resident_prepare(&bad), "struct size checked"); + + fs::remove_all(root, ec); + if (failures) return 1; + std::cout << "mod resident tests passed\n"; + return 0; +} diff --git a/runtime/tests/test_mod_runtime.cpp b/runtime/tests/test_mod_runtime.cpp index 535f776a..59a9802a 100644 --- a/runtime/tests/test_mod_runtime.cpp +++ b/runtime/tests/test_mod_runtime.cpp @@ -22,6 +22,7 @@ static std::array<uint8_t, 2 * 1024 * 1024> ram; static int failures; static int activation_calls; static int plugin_calls; +static int restore_calls; extern "C" uint8_t psx_read_byte(uint32_t address) { return ram[address & 0x1fffffu]; @@ -159,7 +160,6 @@ static int test_inactive_filter(CPUState*, uint32_t) { ++inactive_filter_hits; return 1; } - static int guest_function_hits; static int instruction_hits; static void test_instruction(CPUState* cpu, uint32_t) { @@ -184,15 +184,49 @@ static void test_guest_function(CPUState* cpu, uint32_t) { if (cpu->gpr[31] != ra) failures++; } + static void test_activation_plugin(void) { activation_calls++; } +static const uint8_t* media_snapshot; +static uint64_t media_size; +static int media_access, foreign_media_access; +static uint32_t mounted_lba; +static int extent_ok, invalid_extent, foreign_extent; +static void test_media_plugin(void) { + media_access = psx_mod_current_resource_bytes("rom", &media_snapshot, &media_size); + const uint8_t* foreign = nullptr; + uint64_t size = 0; + foreign_media_access = psx_mod_current_resource_bytes("private", &foreign, &size); + extent_ok=psx_mod_append_disc_extent("xa",0,2,&mounted_lba); + uint32_t bad=99; + invalid_extent=psx_mod_append_disc_extent("xa",1,2,&bad); + foreign_extent=psx_mod_append_disc_extent("private",0,1,&bad); +} + +extern "C" { +void* iso_open(const char*); +void iso_close(void*); +int iso_read_raw_sector(void*,uint32_t,uint8_t*,int); +int iso_read_sector(void*,uint32_t,uint8_t*,int); +int iso_read_subq(void*,uint32_t,uint8_t*,int,int*); +uint32_t iso_sector_count(void*); +int iso_track_count(void*); +uint32_t iso_track_start_lba(void*,int); +int iso_track_is_audio(void*,int); +} + static int big_ram_activations; static void test_big_ram_activation(void) { big_ram_activations++; } +static void test_restore_plugin(void) { + restore_calls++; + if (ram[0x1000] != 0xa1) failures++; /* main plan must be reapplied first */ +} + static void check(bool value, const char* message) { if (!value) { std::cerr << "FAIL: " << message << "\n"; @@ -454,6 +488,10 @@ int main() { check(psx_mod_register_guest_function_plugin( "runtime.unselected-entry", 0x8FFF0004u, test_unselected_entry), "unselected callback implementation can register"); + check(psx_mod_register_savestate_plugin("runtime.test-vblank", test_restore_plugin), + "restore callback must register through the C API"); + check(!psx_mod_register_savestate_plugin("runtime.test-vblank", test_restore_plugin), + "duplicate restore callback must be rejected"); check(PSXRecompV4::mod_runtime_initialize( root, "SLUS-RUNTIME", 0x80002000, {}, &error), error.c_str()); @@ -641,7 +679,12 @@ int main() { ram[0x1102] = 1; ram[0x1103] = 0; ram[0x1200] = 2; ram[0x1201] = 0; ram[0x1202] = 1; ram[0x1203] = 0x32; + const int activation_before_restore = activation_calls; + const int vblank_before_restore = plugin_calls; mod_runtime_on_savestate_loaded(); + check(restore_calls == 1 && activation_calls == activation_before_restore && + plugin_calls == vblank_before_restore, + "restore must rebind hooks without activation or a gameplay VBlank"); check(ram[0x1000] == 0xa1 && ram[0x1003] == 0xa4 && ram[0x1100] == 42 && ram[0x1102] == 43 && ram[0x1200] == 1 && ram[0x1201] == 0x42 && @@ -941,6 +984,163 @@ int main() { check(PSXRecompV4::mod_runtime_commit(raw_path,&error),"reader mount raw disc"); check(psx_mod_read_disc_file("S0/LEVEL.NSF",result.data(),(uint32_t)result.size(),&bytes) && std::equal(result.begin(),result.end(),iso.begin()+22*2048),"raw and ISO reads identical"); + /* Verified bytes are scoped to the committed feature, and do not depend + * on reopening an owner file after launch. No launcher is needed here. */ + const auto media_root = root / "verified-media"; + std::vector<uint8_t> rom(64, 0); + rom[0] = 0x80; rom[1] = 0x37; rom[2] = 0x12; rom[3] = 0x40; + rom[32] = 0x5a; + const auto rom_path = media_root / "owner.z64"; + write_bytes(rom_path, rom); + std::vector<uint8_t> xa(2336*2); + xa[2]=xa[6]=0x64;xa[8]=0x52; + xa[2336+2]=xa[2336+6]=0xE4;xa[2336+8]=0x63; + const auto xa_path=media_root/"owner.xa";write_bytes(xa_path,xa); + write_text(media_root / "packages/media.test/1.0.0/manifest.toml", + "format_version = 8\nid = \"media.test\"\nversion = \"1.0.0\"\nname = \"Media Test\"\n" + "[[target]]\ngame_id = \"READER\"\n" + "[[feature]]\nid = \"active\"\nname = \"Active\"\ndefault_enabled = true\n" + "[[feature]]\nid = \"private\"\nname = \"Private\"\n" + "[[resource]]\nfeature = \"active\"\nid = \"rom\"\nlabel = \"ROM\"\n" + "format = \"n64-rom\"\nrequired = true\nsize = 64\nsha256 = \"" + sha256_hex(rom) + "\"\n" + "[[resource]]\nfeature = \"active\"\nid = \"xa\"\nlabel = \"XA\"\n" + "format = \"file\"\nrequired = true\nsize = 4672\nsha256 = \"" + sha256_hex(xa) + "\"\n" + "[[resource]]\nfeature = \"private\"\nid = \"private\"\nlabel = \"Private\"\n" + "format = \"n64-rom\"\nrequired = true\nsize = 64\nsha256 = \"" + sha256_hex(rom) + "\"\n" + "[[plugin]]\nfeature = \"active\"\nid = \"media.test.plugin\"\n"); + write_text(media_root / "state.toml", + "format_version = 2\n[[feature]]\npackage_id = \"media.test\"\nid = \"active\"\nenabled = true\n" + "[feature.resources]\nrom = \"" + rom_path.generic_string() + "\"\nxa = \"" + xa_path.generic_string() + "\"\n"); + check(psx_mod_register_activation_plugin("media.test.plugin", test_media_plugin), "register media consumer"); + check(PSXRecompV4::mod_runtime_initialize(media_root, "READER", 0, {}, &error), "media initialize"); + check(PSXRecompV4::mod_runtime_commit(iso_path, &error), "verify and commit owner media"); + const uint8_t* unavailable = nullptr; + uint64_t unavailable_size = 0; + check(!psx_mod_current_resource_bytes("rom", &unavailable, &unavailable_size), "bytes unavailable outside plugin callback"); + mod_runtime_activate_plugins(); + check(media_access && media_size == rom.size() && + std::equal(rom.begin(), rom.end(), media_snapshot), "plugin receives exact verified bytes"); + check(!foreign_media_access, "inactive feature cannot supply bytes to another feature"); + check(extent_ok && mounted_lba==24 && !invalid_extent && !foreign_extent,"activation mounts only owned bounded resource extents"); + uint32_t bad_lba=1; + check(!psx_mod_append_disc_extent("xa",0,1,&bad_lba)&&!bad_lba,"late mounting refused"); + void* mounted=iso_open(iso_path.string().c_str()); + check(mounted&&iso_sector_count(mounted)==24,"BIOS sees original disc before activation is enabled"); + mod_runtime_enable_disc_patches(); + std::array<uint8_t,12> subq{};int valid=0; + check(iso_sector_count(mounted)==26&&iso_track_count(mounted)==2&& + iso_track_start_lba(mounted,2)==24&&!iso_track_is_audio(mounted,2),"appended extents expose one data track and leadout"); + check(iso_read_raw_sector(mounted,24,sector.data(),sector.size())&§or[12]==0&§or[13]==2&§or[14]==0x24&§or[15]==2&& + std::equal(xa.begin(),xa.begin()+2336,sector.begin()+16),"native raw sector header and exact XA subheader/audio bytes"); + check(iso_read_sector(mounted,25,sector.data(),sector.size())&§or[0]==0x63,"cooked access resolves the same extent"); + check(!iso_read_sector(mounted,26,sector.data(),sector.size())&& + !iso_read_raw_sector(mounted,24,sector.data(),2351),"extent end and short raw buffers rejected"); + check(iso_read_subq(mounted,24,subq.data(),subq.size(),&valid)&&valid&&subq[0]==0x41&&subq[1]==2&&subq[5]==0,"appended data track has native subchannel position"); + check(iso_read_sector(mounted,22,sector.data(),sector.size())&§or[1]==7,"base sectors unchanged"); + xa[8]=0xff;write_bytes(xa_path,xa); + check(iso_read_raw_sector(mounted,24,sector.data(),sector.size())&§or[24]==0x52,"streaming uses verified snapshot after external file changes"); + mod_runtime_activate_plugins(); + check(mounted_lba==24&&iso_sector_count(mounted)==26,"reactivation has stable LBAs and no duplicate extents"); + rom[32] ^= 1; + write_bytes(rom_path, rom); + check(media_snapshot && media_snapshot[32] == 0x5a, "committed bytes survive owner file changes"); + check(!PSXRecompV4::mod_runtime_commit({}, &error), "new commit rejects modified media"); + check(PSXRecompV4::mod_runtime_clear_for_netplay(&error), "netplay clears donor plan"); + check(iso_sector_count(mounted)==24&&iso_track_count(mounted)==1&& + !iso_read_raw_sector(mounted,24,sector.data(),sector.size()),"clearing plan removes all donor sectors and restores TOC"); + iso_close(mounted); + /* Plugin activation (native asset preparation) runs before the emulated + * drive's disc patches are enabled. Host reads must already return the + * committed plan's effective bytes, or a prepared cache would silently + * serve original assets under a modded plan. The drive path stays gated. */ + { + const auto patched_root = root / "host-reader-patched"; + const auto patched_iso = patched_root / "original.iso"; + /* A byte past the original 3000-byte extent; a mod that grows the file + * through its directory record exposes it. */ + std::vector<uint8_t> grown_iso = iso; + grown_iso[22 * 2048 + 3500] = 0x77; + write_bytes(patched_iso, grown_iso); + write_text(patched_root / "packages/reader.patch/1.0.0/manifest.toml", + "format_version = 5\n" + "id = \"reader.patch\"\n" + "version = \"1.0.0\"\n" + "name = \"Reader Patch\"\n" + "[[target]]\n" + "game_id = \"READER\"\n" + "disc_sha256 = \"" + sha256_hex(grown_iso) + "\"\n" + "[[feature]]\n" + "id = \"asset\"\n" + "name = \"Asset\"\n" + "[[feature]]\n" + "id = \"grow\"\n" + "name = \"Grow\"\n" + "[[patch]]\n" + "feature = \"grow\"\n" + "target = \"disc_user\"\n" + "offset = " + std::to_string(21 * 2048 + 10) + "\n" + "expected = \"b80b0000\"\n" + "replace = \"a00f0000\"\n" + "[[feature]]\n" + "id = \"huge\"\n" + "name = \"Huge\"\n" + "[[patch]]\n" + "feature = \"huge\"\n" + "target = \"disc_user\"\n" + "offset = " + std::to_string(21 * 2048 + 10) + "\n" + "expected = \"b80b0000\"\n" + "replace = \"00f82204\"\n" + "[[patch]]\n" + "feature = \"asset\"\n" + "target = \"disc_user\"\n" + "offset = " + std::to_string(22 * 2048 + 5) + "\n" + "expected = \"23\"\n" + "replace = \"5a\"\n"); + write_text(patched_root / "state.toml", + "format_version = 2\n" + "[[feature]]\n" + "package_id = \"reader.patch\"\n" + "id = \"asset\"\n" + "enabled = true\n" + "[[feature]]\n" + "package_id = \"reader.patch\"\n" + "id = \"grow\"\n" + "enabled = true\n"); + check(PSXRecompV4::mod_runtime_initialize(patched_root, "READER", 0, {}, &error), + "patched reader initialize"); + check(PSXRecompV4::mod_runtime_commit(patched_iso, &error), "patched reader commit"); + check(psx_mod_read_disc_file("S0/LEVEL.NSF", nullptr, 0, &bytes) && bytes == 4000, + "host disc reads resolve paths through patched directory records"); + std::vector<uint8_t> effective(4000); + check(psx_mod_read_disc_file("S0/LEVEL.NSF", effective.data(), + (uint32_t)effective.size(), &bytes) && + bytes == 4000 && effective[5] == 0x5a && effective[3500] == 0x77 && + std::equal(effective.begin() + 6, effective.begin() + 3000, + iso.begin() + 22 * 2048 + 6), + "host disc reads apply the committed plan before the drive is enabled"); + check(!psx_mod_read_disc_file("S0", nullptr, 0, &bytes), + "effective lookup still rejects directories"); + std::array<uint8_t, 2048> drive_sector{}; + std::copy_n(iso.begin() + 22 * 2048, 2048, drive_sector.begin()); + mod_runtime_patch_disc_sector(22, 0, drive_sector.data(), (uint32_t)drive_sector.size()); + check(drive_sector[5] == 0x23, + "the emulated drive path stays original until disc patches are enabled"); + mod_runtime_enable_disc_patches(); + mod_runtime_patch_disc_sector(22, 0, drive_sector.data(), (uint32_t)drive_sector.size()); + check(drive_sector[5] == 0x5a, "enabled drive path applies the same plan"); + /* Grown archives may exceed 64 MiB (an extended MMX6 ROCK_X6.DAT is + * 69,400,576 bytes); the bound is CD capacity, not a fixed cap. */ + write_text(patched_root / "state.toml", + "format_version = 2\n" + "[[feature]]\n" + "package_id = \"reader.patch\"\n" + "id = \"huge\"\n" + "enabled = true\n"); + check(PSXRecompV4::mod_runtime_initialize(patched_root, "READER", 0, {}, &error) && + PSXRecompV4::mod_runtime_commit(patched_iso, &error), "huge plan commit"); + check(psx_mod_read_disc_file("S0/LEVEL.NSF", nullptr, 0, &bytes) && bytes == 69400576u, + "files grown past 64 MiB keep their effective size"); + } fs::remove_all(root, ec); if (failures) return 1; std::cout << "mod runtime tests passed\n"; diff --git a/runtime/tests/test_pgxp.cpp b/runtime/tests/test_pgxp.cpp index aca3f823..c53081dd 100644 --- a/runtime/tests/test_pgxp.cpp +++ b/runtime/tests/test_pgxp.cpp @@ -64,6 +64,12 @@ static uint32_t enc_cop2(uint32_t sub, uint32_t rt, uint32_t rd) { #define SRA(rt, rd, sh) enc_r(0, rt, rd, sh, 0x03) #define OR(rs, rt, rd) enc_r(rs, rt, rd, 0, 0x25) #define ADDU(rs, rt, rd) enc_r(rs, rt, rd, 0, 0x21) +#define SUBU(rs, rt, rd) enc_r(rs, rt, rd, 0, 0x23) +#define AND(rs, rt, rd) enc_r(rs, rt, rd, 0, 0x24) +#define NOR(rs, rt, rd) enc_r(rs, rt, rd, 0, 0x27) +#define SLT(rs, rt, rd) enc_r(rs, rt, rd, 0, 0x2A) +#define ANDI(rs, rt, imm) enc_i(0x0C, rs, rt, (uint16_t)(imm)) +#define ORI(rs, rt, imm) enc_i(0x0D, rs, rt, (uint16_t)(imm)) /* One projected vertex: x = 160.5, y = 80.25 -> packed integer word. */ static const uint32_t PACKED = (80u << 16) | 160u; @@ -214,6 +220,150 @@ int main(void) { CHECK(lookup(ADDR_B, (PACKED >> 16) << 16, 0, 80, nullptr, nullptr, nullptr) == PGXP_SRC_NATIVE); + /* --- clip flags packed above the GPU field (Spider-Man 0x8007F31C): + * mfc2 t2,SXY2; subu t9,t2,t4; nor t9,t9,t5; and t2,t2,t5; or t2,t2,t9 + * ... and t2,t2,a3; or t2,t2,t9'; sw t2 + * The flag ops rewrite bits 14/15 and 30/31 of the word, never the 11-bit + * fields GP0 decodes, so the vertex (and its depth) must survive - in + * BOTH tiers, since bitwise carries are exact. --- */ + for (int mode = 0; mode < 2; mode++) { + pgxp_set_cpu_mode(mode); + const uint32_t T2 = 10, T4 = 12, T5 = 13, T9 = 25, A3 = 7; + const uint32_t bounds = (240u << 16) | 128u; /* x >= 128 -> flag */ + const uint32_t m14 = 0xBFFFBFFFu, m15 = 0x7FFF7FFFu; + pgxp_gte_push_sxy(X16, Y16, SZ3, PACKED); + psx_pgxp_cop2(nullptr, MFC2(T2, 14), PACKED, 0); + psx_pgxp_load(nullptr, LW(1, T4), 0x80180000u, bounds); /* untracked */ + psx_pgxp_alu(nullptr, LUI(T5, 0xBFFF), 0xBFFF0000u, 0, 0); + psx_pgxp_alu(nullptr, ORI(T5, T5, 0xBFFF), m14, 0xBFFF0000u, 0xBFFFu); + uint32_t d = PACKED - bounds; + psx_pgxp_alu(nullptr, SUBU(T2, T4, T9), d, PACKED, bounds); + uint32_t f = ~(d | m14); + psx_pgxp_alu(nullptr, NOR(T9, T5, T9), f, d, m14); + uint32_t w = PACKED & m14; + psx_pgxp_alu(nullptr, AND(T2, T5, T2), w, PACKED, m14); + psx_pgxp_alu(nullptr, OR(T2, T9, T2), w | f, w, f); + w |= f; + CHECK(w == (PACKED | 0x4000u)); /* x flagged */ + psx_pgxp_alu(nullptr, AND(T2, A3, T2), w & m15, w, m15); + w &= m15; + psx_pgxp_load(nullptr, LW(1, T9), 0x80180004u, 0x80000000u); + psx_pgxp_alu(nullptr, OR(T2, T9, T2), w | 0x80000000u, w, 0x80000000u); + w |= 0x80000000u; + psx_pgxp_store(nullptr, SW(1, T2), ADDR_B, w); + int32_t x, y; uint16_t z; + CHECK(lookup(ADDR_B, w, 160, 80, &x, &y, &z) == PGXP_SRC_DATAFLOW); + CHECK(x == X16 && y == Y16 && z == SZ3); + uint16_t wz = 0; + CHECK(pgxp_load_precise_word(ADDR_B, w, nullptr, nullptr, &wz) == 1); + CHECK(wz == SZ3); + } + pgxp_set_cpu_mode(0); + + /* --- quad from a projected-vertex table (Spider-Man 0x8007C5D4): + * lwc2 SXY0..2 <- table; NCLIP; lwc2 SXYP <- table; NCLIP; + * swc2 SXY0..2 -> packet + * The SXYP write pushes the FIFO; the stored words are corners 1..3. --- */ + { + const uint32_t TABLE = 0x80180100u, PKT = 0x80180200u; + uint32_t words[4]; + for (uint32_t i = 0; i < 4; i++) { + words[i] = ((80u + i) << 16) | (160u + i); + pgxp_gte_push_sxy((int32_t)((160 + i) << 16) | 0x8000, + (int32_t)((80 + i) << 16) | 0x4000, + (uint16_t)(100 + i), words[i]); + psx_pgxp_cop2(nullptr, SWC2(14), words[i], TABLE + i * 4u); + } + for (uint32_t i = 0; i < 3; i++) { /* lwc2 SXY0..2 */ + pgxp_gte_reg_written((int)(12 + i), words[i]); + psx_pgxp_cop2(nullptr, enc_i(0x32, 1, 12 + i, 0), words[i], + TABLE + i * 4u); + } + pgxp_gte_reg_written(15, words[3]); /* lwc2 SXYP: push */ + psx_pgxp_cop2(nullptr, enc_i(0x32, 1, 15, 0), words[3], TABLE + 12u); + for (uint32_t i = 0; i < 3; i++) + psx_pgxp_cop2(nullptr, SWC2(12 + i), words[i + 1], PKT + i * 4u); + for (uint32_t i = 0; i < 3; i++) { + int32_t x, y; uint16_t z; + CHECK(lookup(PKT + i * 4u, words[i + 1], 161 + (int32_t)i, + 81 + (int32_t)i, &x, &y, &z) == PGXP_SRC_DATAFLOW); + CHECK(x == ((int32_t)((161 + i) << 16) | 0x8000)); + CHECK(z == 101 + i); + } + } + + /* --- render-pass checkpoint: a sandboxed pass rewrites a packet word + * (raw-restored afterwards); the shadow must come back with it --- */ + { + const uint32_t other = (90u << 16) | 170u; + produce_at(ADDR_A); + pgxp_checkpoint_begin(); + pgxp_gte_push_sxy((170 << 16) | 0x1000, (90 << 16) | 0x2000, 7, other); + psx_pgxp_cop2(nullptr, SWC2(14), other, ADDR_A); + CHECK(lookup(ADDR_A, other, 170, 90, nullptr, nullptr, nullptr) == + PGXP_SRC_DATAFLOW); /* the pass sees its own word */ + pgxp_invalidate_all(); /* undone by the rollback */ + pgxp_suppress_begin(); /* left open by an abort */ + pgxp_checkpoint_rollback(); + CHECK(pgxp_test_suppress_depth() == 0); + CHECK(pgxp_test_active()); + int32_t x, y; uint16_t z; + CHECK(lookup(ADDR_A, PACKED, 160, 80, &x, &y, &z) == PGXP_SRC_DATAFLOW); + CHECK(x == X16 && y == Y16 && z == SZ3); + /* a generation wrap inside the pass cannot be undone: fail closed */ + produce_at(ADDR_A); + pgxp_checkpoint_begin(); + pgxp_test_set_generation(0xFFFFFFFFu); + pgxp_invalidate_all(); + pgxp_checkpoint_rollback(); + CHECK(lookup(ADDR_A, PACKED, 160, 80, nullptr, nullptr, nullptr) == + PGXP_SRC_NATIVE); + } + + /* --- in-place ops read their source before the destination is reset --- */ + pgxp_set_cpu_mode(1); + produce_at(ADDR_A); + psx_pgxp_load(nullptr, LW(1, 8), ADDR_A, PACKED); + psx_pgxp_alu(nullptr, ADDIU(8, 8, 4), PACKED + 4u, PACKED, 4u); + psx_pgxp_store(nullptr, SW(1, 8), ADDR_B, PACKED + 4u); + { + int32_t x, y; uint16_t z; + CHECK(lookup(ADDR_B, PACKED + 4u, 164, 80, &x, &y, &z) == + PGXP_SRC_DATAFLOW); + CHECK(x == X16 + (4 << 16) && y == Y16); + CHECK(z == SZ3); /* vertex + offset keeps depth */ + } + pgxp_set_cpu_mode(0); + + /* --- a mask that changes the GPU field does not carry that half --- */ + produce_at(ADDR_A); + psx_pgxp_load(nullptr, LW(1, 8), ADDR_A, PACKED); + psx_pgxp_alu(nullptr, ANDI(8, 8, 0x0080), PACKED & 0x80u, PACKED, 0x80u); + psx_pgxp_store(nullptr, SW(1, 8), ADDR_B, PACKED & 0x80u); + CHECK(lookup(ADDR_B, PACKED & 0x80u, 128, 0, nullptr, nullptr, nullptr) != + PGXP_SRC_DATAFLOW); + CHECK(pgxp_load_precise_word(ADDR_B, PACKED & 0x80u, nullptr, nullptr, + nullptr) == 0); + + /* --- a saturated projection is not that half's value: never carried --- */ + { + const uint32_t sat = (80u << 16) | 1023u; /* x clamped */ + pgxp_gte_push_sxy(2000 << 16, Y16, SZ3, sat); + psx_pgxp_cop2(nullptr, MFC2(10, 14), sat, 0); + psx_pgxp_load(nullptr, LW(1, 25), 0x80180008u, 0); /* untracked 0 */ + psx_pgxp_alu(nullptr, OR(10, 25, 10), sat, sat, 0); + psx_pgxp_store(nullptr, SW(1, 10), ADDR_B, sat); + CHECK(pgxp_load_precise_word(ADDR_B, sat, nullptr, nullptr, nullptr) == 0); + } + + /* --- SLT-family results are not vertices: the destination resets --- */ + pgxp_gte_push_sxy(X16, Y16, SZ3, PACKED); + psx_pgxp_cop2(nullptr, MFC2(10, 14), PACKED, 0); + psx_pgxp_alu(nullptr, SLT(0, 10, 10), 1u, 0, PACKED); + psx_pgxp_store(nullptr, SW(1, 10), ADDR_B, 1u); + CHECK(lookup(ADDR_B, 1u, 1, 0, nullptr, nullptr, nullptr) == + PGXP_SRC_NATIVE); + /* --- truncation agreement: integer part must match the native parse --- */ produce_at(ADDR_A); CHECK(lookup(ADDR_A, PACKED, 161, 80, nullptr, nullptr, nullptr) == diff --git a/runtime/tests/test_sdl3_main_single_include.py b/runtime/tests/test_sdl3_main_single_include.py index f88bdc55..87ba2036 100644 --- a/runtime/tests/test_sdl3_main_single_include.py +++ b/runtime/tests/test_sdl3_main_single_include.py @@ -27,9 +27,22 @@ def main() -> int: if rel not in STANDALONE_TEST_PROGRAMS: owners.append(rel) + # The header's implementation is per executable. The app's entry point is + # runtime/src/main.cpp and nothing under src/ or include/ may pull it in + # (any of those would be linked into the app next to main.cpp). A test may + # include it only as the entry-point TU of its own standalone executable: + # the file defines main() itself, and is not linked into the app. + standalone = [] + for owner in list(owners): + if owner.startswith("runtime/tests/"): + text = (ROOT / owner).read_text(encoding="utf-8") + if "int main(" in text: + standalone.append(owner) + owners.remove(owner) if owners != ["runtime/src/main.cpp"]: raise AssertionError( - "SDL_main.h must be included exactly once by runtime/src/main.cpp; " + "SDL_main.h must be included by runtime/src/main.cpp and, outside " + "tests with their own main(), nowhere else; " f"found {owners}" ) diff --git a/runtime/tests/test_segment_miss_wiring.py b/runtime/tests/test_segment_miss_wiring.py index c4b1457f..fd0aa979 100644 --- a/runtime/tests/test_segment_miss_wiring.py +++ b/runtime/tests/test_segment_miss_wiring.py @@ -48,7 +48,8 @@ def main(): block = block[:block.index('#endif\n\n /* B-2')] assert re.search(r'clean_game_text_miss = psx_game_address_in_text\(addr\) \? 1 : 0;', block), \ 'a compiled-dispatch miss in game text no longer sets clean_game_text_miss' - hook = re.search(r'if \(clean_game_text_miss\)\s*\(void\)psx_segment_miss_note\(addr, ' + # A forced span replay interprets compiled text on purpose: not a miss. + hook = re.search(r'if \(clean_game_text_miss && !forced\)\s*\(void\)psx_segment_miss_note\(addr, ' r'psx_game_is_function_entry,\s*cpu->gpr\[31\], cpu->gpr\[29\],', block) assert hook, 'dirty_ram_dispatch_inner no longer notes segment misses on a clean-text miss' assert block.index('psx_dispatch_game_compiled(cpu, addr)') < hook.start(), \ diff --git a/runtime/tests/test_wide_overlay_band_scissor.py b/runtime/tests/test_wide_overlay_band_scissor.py new file mode 100644 index 00000000..dece81ac --- /dev/null +++ b/runtime/tests/test_wide_overlay_band_scissor.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +"""The full-screen-overlay native-wide pass must clip to the draw-area rows. + +Vertically double-buffered titles keep both display bands in ONE wide surface. +A full-width rect that extends above its draw area is clipped at the band top +in canonical VRAM; the wide pass has to clip it there too (the software +reference rt_wide() does), or it paints the other band's rows and the next +present shows a flat band over that buffer. The GL pixel check lives in +test_gl_readback_region.c; this guard covers both GPU backends' source. +""" +from pathlib import Path +import re + +src = Path(__file__).parents[1] / "src" + + +def body(text, signature): + m = re.search(re.escape(signature) + r".*?\n\}", text, flags=re.DOTALL) + assert m, f"{signature} not found" + return m.group(0) + + +gl = (src / "gpu_gl_renderer.c").read_text(encoding="utf-8") +band = body(gl, "static void wide_band_scissor_x(int x, int w) {") +assert "static void wide_band_scissor(void) { wide_band_scissor_x(0, g_wide_w); }" in gl, "GL band scissor does not cover the full wide width" +assert "s_area_y1" in band and "s_area_y2" in band, "GL band scissor ignores the draw area" +flat = body(gl, "static void wide_flat_rect_direct(") +assert "wide_band_scissor();" in flat, "GL overlay pass does not use the band scissor" +assert "VRAM_H * s_scale); /* full surface" not in flat, "GL overlay pass uses a full-height scissor" +target = body(gl, "static void wide_target_begin(") +assert "wide_band_scissor_x(" in target, "GL wide mirror does not use the band scissor" + +vk = (src / "gpu_vk_renderer.c").read_text(encoding="utf-8") +begin = body(vk, "static void wide_pass_begin(VkCommandBuffer cb) {") +assert "s_da_y1" in begin and "s_da_y2" in begin, "Vulkan wide pass ignores the draw area" +overlay = body(vk, "static void wide_overlay_rect(") +assert "wide_pass_begin(cb);" in overlay, "Vulkan overlay pass does not open a wide pass" +assert "vkCmdSetScissor" not in overlay, "Vulkan overlay pass overrides the band scissor" + +print("wide overlay band scissor test passed") diff --git a/runtime/tests/test_ws_auto_ui_untextured_exec.c b/runtime/tests/test_ws_auto_ui_untextured_exec.c index 44f4a604..572ad517 100644 --- a/runtime/tests/test_ws_auto_ui_untextured_exec.c +++ b/runtime/tests/test_ws_auto_ui_untextured_exec.c @@ -227,12 +227,15 @@ int main(void) { assert(gmax == ws_scale_about(120, left)); assert(fmin == gmin && fmax == gmax); - /* A non-axis-aligned untextured quad is world geometry, never UI. */ + /* A non-axis-aligned untextured quad reaching outside every widget is + * world geometry, never UI (one inside a widget is a part of it: see the + * needle below). */ reset_state(1); build_hud(60, 128, 64, 120); - test_ram[NODE_FILL / 4u + 1u + 3u] = pack_vertex(121, 25); /* skew v1 */ + test_ram[NODE_FILL / 4u + 1u + 3u] = pack_vertex(140, 25); /* skew v1 out */ gpu_ws_prepass_linked_list(OT_HEAD); assert(ws_ui_prepass_count == 2); + assert(ws_ui_reject.enclosed == 0); /* Backing panel enclosing the frame: admitted from the rank behind the * HUD and squashed with it about the shared run's centre. */ @@ -293,6 +296,73 @@ int main(void) { assert(ws_ui_prepass_count == 3); assert(ws_ui_reject.backing == 0); + /* A letterbox bar spanning the whole display width in the HUD's own + * rank is a full-width overlay: never UI, drawn edge to edge. */ + reset_state(1); + build_hud(60, 128, 64, 120); + { + const int16_t bx0 = (int16_t)ws_disp_x(), bx1 = (int16_t)(ws_disp_x() + ws_disp_w()); + const uint32_t bar[5] = { + 0x28000000u, pack_vertex(bx0, 0), pack_vertex(bx1, 0), + pack_vertex(bx0, 30), pack_vertex(bx1, 30), + }; + put_node(NODE_FLAT, 0xFFFFFFu, bar, 5); + gpu_ws_prepass_linked_list(OT_HEAD); + assert(ws_ui_prepass_count == 2); /* frame + gouraud fill only */ + assert(ws_ui_reject.too_big == 1); + /* A rule stopping two pixels short of each edge is full width too. */ + const uint32_t rule[5] = { + 0x28000000u, pack_vertex((int16_t)(bx0 + 2), 40), pack_vertex((int16_t)(bx1 - 2), 40), + pack_vertex((int16_t)(bx0 + 2), 44), pack_vertex((int16_t)(bx1 - 2), 44), + }; + put_node(NODE_FLAT, 0xFFFFFFu, rule, 5); + gpu_ws_prepass_linked_list(OT_HEAD); + assert(ws_ui_prepass_count == 2 && ws_ui_reject.too_big == 1); + put_node(NODE_FLAT, 0xFFFFFFu, bar, 5); + gpu_exec_reset_triangles(); + load_packet(NODE_FLAT, 5); + gp0_exec_mono_quad(); + assert(gpu_exec_triangles.min_x == bx0); + assert(gpu_exec_triangles.max_x == bx1); + } + + /* A needle inside its widget (Spider-Man's compass arrow: flat + * triangles in the ring's rank) joins the widget and squashes with it. */ + reset_state(1); + build_hud(60, 128, 64, 120); + { + const uint32_t tri[4] = { + 0x20FFFF00u, pack_vertex(70, 22), pack_vertex(100, 30), pack_vertex(80, 34), + }; + put_node(NODE_FLAT, 0xFFFFFFu, tri, 4); + gpu_ws_prepass_linked_list(OT_HEAD); + assert(ws_ui_prepass_count == 3); /* frame, fill, needle */ + assert(ws_ui_reject.enclosed == 1); + gpu_exec_reset_triangles(); + load_packet(NODE_FLAT, 4); + gp0_exec_mono_tri(); + const int32_t widget = 60 + (128 - 60) / 2; + assert(gpu_exec_triangles.min_x == ws_scale_about(70, widget)); + assert(gpu_exec_triangles.max_x == ws_scale_about(100, widget)); + } + + /* A triangle reaching outside every widget is world geometry. */ + reset_state(1); + build_hud(60, 128, 64, 120); + { + const uint32_t tri[4] = { + 0x20FFFF00u, pack_vertex(50, 22), pack_vertex(140, 30), pack_vertex(80, 34), + }; + put_node(NODE_FLAT, 0xFFFFFFu, tri, 4); + gpu_ws_prepass_linked_list(OT_HEAD); + assert(ws_ui_prepass_count == 2); + assert(ws_ui_reject.enclosed == 0); + gpu_exec_reset_triangles(); + load_packet(NODE_FLAT, 4); + gp0_exec_mono_tri(); + assert(gpu_exec_triangles.min_x == 50 && gpu_exec_triangles.max_x == 140); + } + puts("ws_auto_ui_untextured_exec_test: PASS"); return 0; } diff --git a/tools/aot_overlay_pipeline.py b/tools/aot_overlay_pipeline.py index 88abc4c1..9438b99b 100644 --- a/tools/aot_overlay_pipeline.py +++ b/tools/aot_overlay_pipeline.py @@ -771,16 +771,16 @@ def extract(profile_path, game_toml, recompiler, output, cue=None, disc=None, pr output, views) -def audit(game_toml, recompiler, cache, inventory, output, static_dispatch=None): +def audit(game_toml, recompiler, cache, inventory, output, static_dispatch=None, flavor=0): target = ['--static-dispatch', str(static_dispatch)] if static_dispatch else ['--cache-root', str(cache)] subprocess.run([sys.executable, str(FRAMEWORK / 'tools/audit_aot_cache.py'), '--framework-root', str(FRAMEWORK), '--recompiler', str(recompiler), - '--game-toml', str(game_toml), *target, + '--game-toml', str(game_toml), '--flavor', str(flavor), *target, '--inventory', str(inventory), '--output', str(output)], check=True) return json.loads(output.read_text()) -def build(inventory, game_toml, recompiler, work, gcc, workers, project_root=None, cps=False): +def build(inventory, game_toml, recompiler, work, gcc, workers, project_root=None, cps=False, flavor=0): """Independent recipe builds cannot nominate entries in sibling images.""" cache = work / 'cache' cache.mkdir(parents=True) @@ -793,7 +793,7 @@ def build(inventory, game_toml, recompiler, work, gcc, workers, project_root=Non '--project-root', str(project_root or game_toml.parent), '--recompiler', str(recompiler), '--runtime-include', str(FRAMEWORK / 'runtime/include'), '--out-dir', str(target / 'cache'), '--compiler', 'gcc', '--gcc', gcc, - '--flavor', '0', '--jobs', '1'] + (['--cps'] if cps else []) + '--flavor', str(flavor), '--jobs', '1'] + (['--cps'] if cps else []) with (target / 'compile.log').open('w') as log: subprocess.run(command, stdout=log, stderr=subprocess.STDOUT, check=True) return index, job, target @@ -1023,7 +1023,7 @@ def run(): parser.add_argument('--runtime-config', type=Path, help='Packaged config controlling native cache namespace/code generation') parser.add_argument('--runtime-build-dir', type=Path, - help='Verify the staged runtime publishes the supported flavor-0 ABI') + help='Read and validate the staged runtime overlay ABI (base or PGXP)') parser.add_argument('--runtime-target', default='psx-runtime') parser.add_argument('--recompiler', type=Path, required=True) parser.add_argument('--work-dir', type=Path, required=True) @@ -1049,10 +1049,13 @@ def run(): import tomllib require_runtime_cache(tomllib.loads((args.runtime_config or args.game_toml) .read_text(encoding='utf-8-sig'))) + flavor = 0 if args.runtime_build_dir: from release_stage import _flavor_from_build - require(_flavor_from_build(str(args.runtime_build_dir), args.runtime_target) == 0, - 'This AOT pipeline currently requires a flavor-0 runtime') + flavor = _flavor_from_build(str(args.runtime_build_dir), args.runtime_target) + require(flavor in (0, 2), 'Unsupported runtime overlay flavor') + require(args.action == 'release' or flavor == 0, + 'Static AOT generation currently requires a flavor-0 runtime') import tomllib config, recompiler = args.game_toml.resolve(), args.recompiler.resolve() profile_path = args.profile.resolve() @@ -1102,8 +1105,9 @@ def run(): require(tomllib.loads(runtime_config.read_text(encoding='utf-8-sig'))['game']['id'] == inventory['game_id'], 'Runtime config/game mismatch') cache = build(inventory, runtime_config, recompiler, work, args.gcc, args.workers, config.parent, - args.cps) - receipt = audit(runtime_config, recompiler, cache, work / 'runtime-input-inventory.json', work / 'audit.json') + args.cps, flavor) + receipt = audit(runtime_config, recompiler, cache, work / 'runtime-input-inventory.json', work / 'audit.json', + flavor=flavor) receipt['profile_sha256'] = inventory['profile_sha256'] receipt['original_disc_sha256'] = inventory['original_disc_sha256'] receipt['required_images'] = inventory['required_images'] diff --git a/tools/new_project_layout/project_studio/bulkops.py b/tools/new_project_layout/project_studio/bulkops.py index f69889e4..7a395c53 100644 --- a/tools/new_project_layout/project_studio/bulkops.py +++ b/tools/new_project_layout/project_studio/bulkops.py @@ -21,7 +21,6 @@ from .gitops import ( push, push_modules, push_psxrecomp, - _git, repo_status, run_release_workflow, switch_branch, @@ -239,65 +238,6 @@ def bulk_migrate_bundled( return map_repos(repos, one, jobs=jobs, on_repo=on_repo) -def _load_update_cmake(): - """Import tools/update_cmake.py from the framework running this tool, so - projects pinned to an older psxrecomp still get the current blocks.""" - import importlib.util - - path = Path(__file__).resolve().parents[2] / "update_cmake.py" - spec = importlib.util.spec_from_file_location("psx_update_cmake", path) - if spec is None or spec.loader is None or not path.is_file(): - raise FileNotFoundError(f"update_cmake.py not found at {path}") - mod = importlib.util.module_from_spec(spec) - spec.loader.exec_module(mod) - return mod - - -def bulk_update_cmake( - repos: list[tuple[str, Path]], - *, - commit: bool = True, - push_remote: bool = False, - dry_run: bool = False, - jobs: int = 1, - on_repo: OnRepoResults | None = None, -) -> list[CmdResult]: - """Sync each repo's CMakeLists.txt with the scaffold template's managed - blocks (tools/update_cmake.py), committing only CMakeLists.txt.""" - um = _load_update_cmake() - - def one(label: str, root: Path) -> list[CmdResult]: - path = root / "CMakeLists.txt" - if not path.is_file(): - return [CmdResult(False, f"{label}: no CMakeLists.txt")] - try: - old = path.read_text(encoding="utf-8") - new = um.sync(old) - except (OSError, SystemExit) as exc: - return [CmdResult(False, f"{label}: {exc}")] - if new == old: - return [CmdResult(True, f"{label}: CMakeLists.txt up to date")] - if dry_run: - return [CmdResult(True, f"{label}: would update CMakeLists.txt")] - path.write_text(new, encoding="utf-8", newline="") - if not commit: - return [CmdResult(True, f"{label}: updated CMakeLists.txt (uncommitted)")] - msg = "CMake: sync managed blocks (update_cmake)" - code, out, err = _git(root, "add", "--", "CMakeLists.txt") - if code == 0: - code, out, err = _git(root, "commit", "-m", msg, "--", "CMakeLists.txt") - if code != 0: - return [CmdResult(False, f"{label}: updated but commit failed", err or out)] - if push_remote: - r = push(root) - if not r.ok: - return [CmdResult(False, f"{label}: committed, push failed", r.detail)] - return [CmdResult(True, f"{label}: updated, committed, pushed")] - return [CmdResult(True, f"{label}: updated + committed")] - - return map_repos(repos, one, jobs=jobs, on_repo=on_repo) - - def bulk_pull( repos: list[tuple[str, Path]], *, diff --git a/tools/new_project_layout/project_studio/cli.py b/tools/new_project_layout/project_studio/cli.py index e680ad9b..3d449bf8 100644 --- a/tools/new_project_layout/project_studio/cli.py +++ b/tools/new_project_layout/project_studio/cli.py @@ -1337,35 +1337,6 @@ def cmd_git_bulk_migrate_bundled(args: argparse.Namespace) -> int: return 1 if failed else 0 -def cmd_git_bulk_update_cmake(args: argparse.Namespace) -> int: - from project_studio.bulkops import bulk_update_cmake - from project_studio.repo_index import load_index - - repos = _bulk_repos_or_die(args) - if repos is None: - return 2 - jobs = int(getattr(args, "jobs", 0) or 0) or int(getattr(load_index(), "bulk_jobs", 1) or 1) - - def on_repo(label: str, results: list) -> None: - for r in results: - print(f" [{'OK' if r.ok else 'FAIL'}] {r.message}", flush=True) - if r.detail: - for ln in r.detail.splitlines(): - print(f" {ln}", flush=True) - - results = bulk_update_cmake( - repos, - commit=not bool(getattr(args, "no_commit", False)), - push_remote=bool(getattr(args, "push", False)), - dry_run=bool(getattr(args, "dry_run", False)), - jobs=jobs, - on_repo=on_repo, - ) - failed = sum(1 for r in results if not r.ok) - print(f"bulk update-cmake: {len(results) - failed} ok, {failed} failed", flush=True) - return 1 if failed else 0 - - def cmd_git_migrate_bundled(args: argparse.Namespace) -> int: from project_studio.migrate_bundled import BundledMigrateOptions, migrate_to_bundled_release @@ -2329,17 +2300,6 @@ def build_parser() -> argparse.ArgumentParser: p_gbmb.add_argument("--jobs", type=int, default=0, help="Parallel repos (default: index setting)") p_gbmb.set_defaults(func=cmd_git_bulk_migrate_bundled) - p_gbuc = git_sub.add_parser( - "bulk-update-cmake", - help="Sync selected repos' CMakeLists.txt with the scaffold template " - "(tools/update_cmake.py); commits CMakeLists.txt only", - ) - add_bulk_select(p_gbuc) - p_gbuc.add_argument("--no-commit", action="store_true", help="Edit CMakeLists.txt but do not commit") - p_gbuc.add_argument("--push", action="store_true", help="Push after committing") - p_gbuc.add_argument("--jobs", type=int, default=0, help="Parallel repos (default: index setting)") - p_gbuc.set_defaults(func=cmd_git_bulk_update_cmake) - p_gmb = git_sub.add_parser( "migrate-bundled", help="Move one game repo onto bundled releases", diff --git a/tools/new_project_layout/project_studio/gui.py b/tools/new_project_layout/project_studio/gui.py index a2bfd28a..67d412a3 100644 --- a/tools/new_project_layout/project_studio/gui.py +++ b/tools/new_project_layout/project_studio/gui.py @@ -2241,13 +2241,6 @@ class ProjectStudioApp: height=34, command=self._bulk_install_ci, ).pack(side="left", padx=8) - ctk.CTkButton( - relb, - text="Update CMake", - width=120, - height=34, - command=self._bulk_update_cmake, - ).pack(side="left") ctk.CTkLabel( relb, text="Dispatches release.yml per selected game repo (gh). " @@ -4547,36 +4540,6 @@ class ProjectStudioApp: done_warn_prefix="Release dispatch finished with failures.", ) - def _bulk_update_cmake(self) -> None: - from .bulkops import bulk_update_cmake - - repos = self._bulk_require_selection() - if repos is None: - return - dry = self._git_dry() - if not dry: - names = "\n".join(f"* {lab}" for lab, _ in repos) - if not messagebox.askyesno( - "Project Studio", - f"Sync CMakeLists.txt with the psxrecomp template and commit it " - f"(CMakeLists.txt only, not pushed) for {len(repos)} repo(s)?\n\n{names}", - parent=self.root, - ): - return - - def run(*, jobs: int, on_repo) -> list: - return bulk_update_cmake( - repos, commit=True, push_remote=False, dry_run=dry, jobs=jobs, on_repo=on_repo - ) - - self._bulk_run_bg( - f"Bulk update CMake ({len(repos)} repos)", - run, - refresh_git=True, - done_info="Update CMake finished — see activity log.", - done_warn_prefix="Update CMake finished with failures.", - ) - def _bulk_install_ci(self) -> None: from .bulkops import bulk_install_ci diff --git a/tools/new_project_layout/templates/CMakeLists.txt.in b/tools/new_project_layout/templates/CMakeLists.txt.in index a412c646..f984ea95 100644 --- a/tools/new_project_layout/templates/CMakeLists.txt.in +++ b/tools/new_project_layout/templates/CMakeLists.txt.in @@ -49,16 +49,6 @@ psxrecomp_add_game_runtime(psx-runtime @CODEGEN_SETUP_ARG@ ) -# >>> psxrecomp:recomp-net-headers (managed by tools/update_cmake.{sh,ps1}) -# runtime/src/main.cpp includes recomp_net/host_relay.h unconditionally (a -# plain-C types header). With PSX_NETPLAY off nothing adds recomp-net's include -# dir, so expose it whenever the submodule is checked out. -if(EXISTS "${PSXRECOMP_ROOT}/lib/recomp-net/include/recomp_net/host_relay.h") - target_include_directories(psx-runtime PRIVATE - "${PSXRECOMP_ROOT}/lib/recomp-net/include") -endif() -# <<< psxrecomp:recomp-net-headers - # Stage runtime configs next to the exe for direct build/ launches. Only copy # files that exist — never fail POST_BUILD when game_options.toml is absent. foreach(_PSX_RUNTIME_CONFIG game.toml game_options.toml) diff --git a/tools/tests/test_aot_overlay_pipeline.py b/tools/tests/test_aot_overlay_pipeline.py index fa634ae2..f3481e9f 100644 --- a/tools/tests/test_aot_overlay_pipeline.py +++ b/tools/tests/test_aot_overlay_pipeline.py @@ -17,6 +17,32 @@ import audit_aot_cache as auditor import indexed_lzss_pack as lzss_pack +class PgxpReleaseNamespaceTests(unittest.TestCase): + def test_pgxp_compile_and_audit_follow_runtime_flavor(self): + with tempfile.TemporaryDirectory() as directory: + work = Path(directory) + commands = [] + + def compile_fixture(command, **kwargs): + commands.append(command) + Path(command[command.index('--out-dir') + 1]).mkdir(parents=True) + + with mock.patch.object(pipeline.subprocess, 'run', side_effect=compile_fixture): + pipeline.build(dict(jobs=[dict(input='invented.json', name='image')]), + work / 'game.toml', work / 'emitter', work, + 'gcc', 1, flavor=2) + self.assertEqual(commands[0][commands[0].index('--flavor') + 1], '2') + receipt = work / 'audit.json' + receipt.write_text('{"flavor": 2}') + with mock.patch.object(pipeline.subprocess, 'run') as run: + result = pipeline.audit(work / 'game.toml', work / 'emitter', + work / 'cache', work / 'inventory.json', + receipt, flavor=2) + command = run.call_args.args[0] + self.assertEqual(command[command.index('--flavor') + 1], '2') + self.assertEqual(result['flavor'], 2) + + class FakeDisc: def __init__(self, files): self.data = files diff --git a/tools/tests/test_overlay_widescreen_callbacks.py b/tools/tests/test_overlay_widescreen_callbacks.py index 77234f3c..49e94713 100644 --- a/tools/tests/test_overlay_widescreen_callbacks.py +++ b/tools/tests/test_overlay_widescreen_callbacks.py @@ -29,7 +29,7 @@ static int nclip_branch(uint32_t pc, uint32_t word, int32_t mac0, int vanilla) { static void advance(uint32_t n) { cycles += n; } static int entry(CPUState *cpu, uint32_t address) { assert(cycles == 17); seen_cpu = cpu; seen_address = address; - return 1; + cpu->pc = cpu->gpr[31]; return 1; } int main(void) { CPUState cpu = {0}; @@ -42,7 +42,9 @@ int main(void) { assert(psx_ws_screen_x_bound(-256) == -512); assert(psx_ws_screen_x_bound(256) == 512); psx_advance_cycles(17); + cpu.gpr[31] = 0x80010000; assert(psx_mod_function_entry(&cpu, 0x80045770) == 1); + assert(cpu.pc == 0x80010000); assert(seen_cpu == &cpu && seen_address == 0x80045770); callbacks.ws_screen_x_bound = 0; callbacks.mod_function_entry = 0; overlay_init(&callbacks); diff --git a/tools/update_cmake.ps1 b/tools/update_cmake.ps1 deleted file mode 100644 index e1167d72..00000000 --- a/tools/update_cmake.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -# update_cmake.ps1 — sync a game project's CMakeLists.txt with the scaffold -# template's managed blocks (implementation: tools/update_cmake.py). -# Usage: update_cmake.ps1 [--project DIR] [--check] [--dry-run] -$ErrorActionPreference = 'Stop' -$Root = Split-Path -Parent $PSScriptRoot -$Py = $env:PYTHON -if (-not $Py) { - foreach ($c in 'python3', 'python', 'py') { - if (Get-Command $c -ErrorAction SilentlyContinue) { $Py = $c; break } - } -} -if (-not $Py) { Write-Error 'update_cmake: python not found on PATH'; exit 1 } -& $Py (Join-Path $Root 'tools/update_cmake.py') @args -exit $LASTEXITCODE diff --git a/tools/update_cmake.py b/tools/update_cmake.py deleted file mode 100755 index 6ca1cf10..00000000 --- a/tools/update_cmake.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python3 -"""Idempotently sync a game project's CMakeLists.txt with the scaffold template. - -The managed block lives in tools/new_project_layout/templates/CMakeLists.txt.in -between `# >>> psxrecomp:<name>` / `# <<< psxrecomp:<name>` markers (single -source of truth). For each block this inserts it after the project's -psxrecomp_add_game_runtime(...) call, or replaces it in place if the markers are -already present. Run via tools/update_cmake.sh or tools/update_cmake.ps1. - - update_cmake.py [--project DIR] [--check] [--dry-run] - --check exit 1 if the project is out of date (writes nothing; for CI) - --dry-run print the unified diff, write nothing -""" -import argparse, difflib, re, sys -from pathlib import Path - -ROOT = Path(__file__).resolve().parent.parent -TEMPLATE = ROOT / "tools/new_project_layout/templates/CMakeLists.txt.in" -BLOCK_RE = re.compile( - r"^# >>> psxrecomp:(?P<n>[\w-]+).*?\n.*?^# <<< psxrecomp:(?P=n)[ \t]*\n", - re.M | re.S) - - -def template_blocks(): - return {m["n"]: m.group(0) for m in BLOCK_RE.finditer(TEMPLATE.read_text(encoding="utf-8"))} - - -def add_runtime_end(text): - """Index just past the closing ')' of psxrecomp_add_game_runtime(...).""" - m = re.search(r"^\s*psxrecomp_add_game_runtime\s*\(", text, re.M) - if not m: - return None - depth, i, in_str = 0, m.end() - 1, False - while i < len(text): - c = text[i] - if c == '"' and text[i - 1] != "\\": - in_str = not in_str - elif not in_str: - if c == "#": - i = text.find("\n", i) - if i < 0: - return None - continue - depth += c == "(" - depth -= c == ")" - if depth == 0: - nl = text.find("\n", i) - return len(text) if nl < 0 else nl + 1 - i += 1 - return None - - -def sync(text): - for name, block in template_blocks().items(): - m = re.search(r"^# >>> psxrecomp:%s.*?\n.*?^# <<< psxrecomp:%s[ \t]*\n" % (re.escape(name), re.escape(name)), text, re.M | re.S) - if m: - text = text[:m.start()] + block + text[m.end():] - continue - end = add_runtime_end(text) - if end is None: - sys.exit("update_cmake: no psxrecomp_add_game_runtime(...) call found") - text = text[:end] + "\n" + block + text[end:] - return text - - -def main(): - ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) - ap.add_argument("--project", default=".", help="game project dir (default: cwd)") - ap.add_argument("--check", action="store_true") - ap.add_argument("--dry-run", action="store_true") - a = ap.parse_args() - path = Path(a.project).resolve() / "CMakeLists.txt" - if not path.is_file(): - sys.exit(f"update_cmake: {path} not found") - old = path.read_text(encoding="utf-8") - new = sync(old) - if new == old: - print("update_cmake: up to date") - return 0 - if a.check or a.dry_run: - sys.stdout.writelines(difflib.unified_diff(old.splitlines(True), new.splitlines(True), "CMakeLists.txt", "CMakeLists.txt (updated)")) - return 1 if a.check else 0 - path.write_text(new, encoding="utf-8", newline="") - print(f"update_cmake: updated {path}") - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/tools/update_cmake.sh b/tools/update_cmake.sh deleted file mode 100755 index 2dc38f32..00000000 --- a/tools/update_cmake.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# update_cmake.sh — sync a game project's CMakeLists.txt with the scaffold -# template's managed blocks (implementation: tools/update_cmake.py). -# Usage: update_cmake.sh [--project DIR] [--check] [--dry-run] -set -eu -ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -PY="${PYTHON:-}" -if [ -z "$PY" ]; then - for c in python3 python; do command -v "$c" >/dev/null 2>&1 && { PY="$c"; break; }; done -fi -[ -n "$PY" ] || { echo "update_cmake: python not found on PATH" >&2; exit 1; } -exec "$PY" "$ROOT/tools/update_cmake.py" "$@"