diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-06-02 18:28:35 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-02 12:28:35 +0200 |
| commit | 4b96a74fc35adab4226c249eb9d51e00968736ee (patch) | |
| tree | 1ce3e4208b207ebde9bdbf1a3a6363a27e735b6a | |
| parent | 1b131d28dfceef1fc7eafde3a76b3816e6a426bd (diff) | |
| download | box64-4b96a74fc35adab4226c249eb9d51e00968736ee.tar.gz box64-4b96a74fc35adab4226c249eb9d51e00968736ee.zip | |
[ENV][WOW64] Not every env var applies to WowBox64 (#2700)
* [ENV] Not every env var applies to WowBox64 * [DOCS] Updated env docs for WowBox64
| -rw-r--r-- | docs/USAGE.md | 72 | ||||
| -rw-r--r-- | docs/box64.pod | 64 | ||||
| -rw-r--r-- | docs/gen/gen.py | 55 | ||||
| -rw-r--r-- | docs/gen/usage.json | 96 | ||||
| -rw-r--r-- | src/include/env.h | 230 | ||||
| -rw-r--r-- | src/tools/env.c | 124 |
6 files changed, 388 insertions, 253 deletions
diff --git a/docs/USAGE.md b/docs/USAGE.md index 7240a773..6fdd3c1c 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -4,9 +4,11 @@ Usage There are many environment variables to control Box64's behaviour, which will be listed below by category. -### Configuration files +There are 2 types of Box64 builds: the Wine WOW64 build (WowBox64) and the regular Linux build. Beware only some of the environment variables are available in WowBox64. -In addition to environment variables, by default, Box64 also looks for 2 places for rcfile: the system-wide `/etc/box64.box64rc` and user-specific `~/.box64rc`. +### Configuration files for Linux build + +In addition to environment variables, if you're using the regular Linux build, Box64 also looks for 2 places for rcfile by default: the system-wide `/etc/box64.box64rc` and user-specific `~/.box64rc`. Settings priority follows this order (from highest to lowest): `~/.box64rc` > `/etc/box64.box64rc` > environment variables. Example configuration: @@ -21,7 +23,7 @@ BOX64_DYNAREC_CALLRET=1 This configuration will apply the specified settings application-wide to any executable named `factorio`. -### Advanced usage +### Advanced usage for Linux build 1. **Wildcard Matching** @@ -173,7 +175,7 @@ Add --no-sandbox argument to the guest program. ### BOX64_AVX -Expose AVX extension to CPUID and cpuinfo file. Default value is 2 on Arm64 because it's fully implemented in DynaRec, 0 otherwise. +Expose AVX extension to CPUID and cpuinfo file. Default value is 2 on Arm64 because it's fully implemented in DynaRec, 0 otherwise. Availble in WowBox64. * 0: Do not expose AVX capabilities. * 1: Expose AVX, BMI1, F16C and VAES extensions to CPUID and cpuinfo file. @@ -187,7 +189,7 @@ Path to the bash executable. ### BOX64_CPUTYPE -Specify the CPU type to emulate. +Specify the CPU type to emulate. Availble in WowBox64. * 0: Emulate a Intel CPU Model. [Default] * 1: Emulate a AMD CPU Model. @@ -208,7 +210,7 @@ Detect MonoBleedingEdge and apply conservative settings. ### BOX64_DYNAREC_DIV0 -Enable or disable the generation of division-by-zero exception. +Enable or disable the generation of division-by-zero exception. Availble in WowBox64. * 0: Do not generate thr division-by-zero exception. [Default] * 1: Generate the division-by-zero exception. @@ -222,7 +224,7 @@ Enable or disable libtbb detection. ### BOX64_DYNAREC_X87DOUBLE -Force the use of float/double for x87 emulation. +Force the use of float/double for x87 emulation. Availble in WowBox64. * 0: Try to use float when possible for x87 emulation. [Default] * 1: Only use Double for x87 emulation. @@ -273,7 +275,7 @@ Behaviour when hooking malloc operators. ### BOX64_MAXCPU -Maximum CPU cores exposed. +Maximum CPU cores exposed. Availble in WowBox64. * 0: Use the actual number of CPU cores. [Default] * XXXX: Use XXXX CPU cores. @@ -320,14 +322,14 @@ Expose SHAEXT (a.k.a. SHA_NI) capabilities. ### BOX64_SSE_FLUSHTO0 -Behaviour of SSE Flush to 0 flags. +Behaviour of SSE Flush to 0 flags. Availble in WowBox64. * 0: Just track the flag. [Default] * 1: Apply SSE Flush to 0 flag directly. ### BOX64_SSE42 -Expose SSE4.2 capabilities. +Expose SSE4.2 capabilities. Availble in WowBox64. * 0: Do not expose SSE4.2 capabilities. * 1: Expose SSE4.2 capabilities. [Default] @@ -369,7 +371,7 @@ Call XInitThreads when loading X11. This is mostly for old Loki games with the L ### BOX64_X87_NO80BITS -Behavoiur of x87 80bits long double. +Behavoiur of x87 80bits long double. Availble in WowBox64. * 0: Try to handle 80bits long double as precise as possible. [Default] * 1: Use 64bits double for x87. @@ -385,14 +387,14 @@ Enable or disable the logging of dlsym errors. ### BOX64_DUMP -Dump elfloader debug information. +Dump elfloader debug information. Availble in WowBox64. * 0: Do not dump elfloader debug information. [Default] * 1: Dump elfloader debug information. ### BOX64_DYNAREC_DUMP -Enable DynaRec dump. +Enable DynaRec dump. Availble in WowBox64. * 0: Do not dump DynaRec blocks. [Default] * 1: Dump DynaRec blocks. @@ -400,7 +402,7 @@ Enable DynaRec dump. ### BOX64_DYNAREC_DUMP_RANGE -Dump DynaRec blocks in the specified range. +Dump DynaRec blocks in the specified range. Availble in WowBox64. * 0xXXXXXXXX-0xYYYYYYYY: Define the range where dynablock gets dumped (inclusive-exclusive). @@ -416,7 +418,7 @@ The GDBJIT debugging support, only available on build with `-DGDBJIT=ON`, enable ### BOX64_DYNAREC_LOG -Disable or enable DynaRec logs. +Disable or enable DynaRec logs. Availble in WowBox64. * 0: Disable DynaRec logs. [Default] * 1: Enable minimal DynaRec logs. @@ -425,7 +427,7 @@ Disable or enable DynaRec logs. ### BOX64_DYNAREC_MISSING -Print missing opcodes. +Print missing opcodes. Availble in WowBox64. * 0: Do not print the missing opcode. [Default] * 1: Print missing opcodes. @@ -440,7 +442,7 @@ Generate map file for Linux perf tool. ### BOX64_DYNAREC_TEST -Enable DynaRec execution comparison with the interpreter, very slow, only for testing. +Enable DynaRec execution comparison with the interpreter, very slow, only for testing. Availble in WowBox64. * 0: No comparison. [Default] * 1: Each opcode runs on interpreter and on Dynarec, regs and memory are compared and printed when they differ. @@ -470,7 +472,7 @@ Set the address where the program is loaded, only active for PIE guest programs. ### BOX64_LOG -Enable or disable Box64 logs, default value is 0 if stdout is not terminal, 1 otherwise. +Enable or disable Box64 logs, default value is 0 if stdout is not terminal, 1 otherwise. Availble in WowBox64. * 0: Disable Box64 logs. * 1: Enable minimal Box64 logs. @@ -479,7 +481,7 @@ Enable or disable Box64 logs, default value is 0 if stdout is not terminal, 1 ot ### BOX64_NOBANNER -Disable the Box64 banner. +Disable the Box64 banner. Availble in WowBox64. * 0: Show the Box64 banner. * 1: Do not show the Box64 banner. @@ -577,21 +579,21 @@ Only available on box64 build with trace. Adds trace of all instructions execute ### BOX64_DYNAREC -Enable/disable the Dynamic Recompiler (a.k.a DynaRec). This option defaults to 1 if it's enabled in the build options for a supported architecture. +Enable/disable the Dynamic Recompiler (a.k.a DynaRec). This option defaults to 1 if it's enabled in the build options for a supported architecture. Availble in WowBox64. * 0: Disable DynaRec. * 1: Enable DynaRec. ### BOX64_DYNAREC_ALIGNED_ATOMICS -Generate aligned atomics only (only available on Arm64 for now). +Generate aligned atomics only (only available on Arm64 for now). Availble in WowBox64. * 0: Generate unaligned atomics handling code. [Default] * 1: Generate aligned atomics only, which is faster and smaller code size, but will cause SIGBUS for LOCK prefixed opcodes operating on aligned data addresses. ### BOX64_DYNAREC_BIGBLOCK -Enable building bigger DynaRec code blocks for better performance. +Enable building bigger DynaRec code blocks for better performance. Availble in WowBox64. * 0: Do not try to build block as big as possible, suitable for programs using lots of threads and JIT, like Unity. * 1: Build Dynarec block as big as possible. @@ -600,15 +602,15 @@ Enable building bigger DynaRec code blocks for better performance. ### BOX64_DYNAREC_CALLRET -Optimize CALL/RET opcodes. +Optimize CALL/RET opcodes. Availble in WowBox64. * 0: Do not optimize CALL/RET, use jump table. [Default] * 1: Try to optimize CALL/RET, skipping the jump table when possible. - * 2: Try to optimize CALL/RET, skipping the jump table when possible, adding code to handle return to dirty/modified block. + * 2: Try to optimize CALL/RET, skipping the jump table when possible, adding code to handle return to dirty/modified block. Does not work on WowBox64. ### BOX64_DYNAREC_DF -Enable or disable the use of deferred flags. +Enable or disable the use of deferred flags. Availble in WowBox64. * 0: Disable the use of deferred flags. * 1: Enable the use of deferred flags. [Default] @@ -623,14 +625,14 @@ Allow continue running a block that is unprotected and potentially dirty. ### BOX64_DYNAREC_FASTNAN -Enable or disable fast NaN handling. +Enable or disable fast NaN handling. Availble in WowBox64. * 0: Precisely emulate the -NaN generation like on x86. * 1: Do not do anything special with -NAN generation, faster. [Default] ### BOX64_DYNAREC_FASTROUND -Enable or disable fast rounding. +Enable or disable fast rounding. Availble in WowBox64. * 0: Generate float/double -> int rounding and use current rounding mode for float/double computation like on x86. * 1: Do not do anything special with edge case rounding, faster. [Default] @@ -638,7 +640,7 @@ Enable or disable fast rounding. ### BOX64_DYNAREC_FORWARD -Define max allowed forward value when building block. +Define max allowed forward value when building block. Availble in WowBox64. * 0: No forward value. When current block ends, do not try to go further even if there are previous forward jumps. * 128: Allow up to 128 bytes of gap between end of the block and the next forward jump. [Default] @@ -646,14 +648,14 @@ Define max allowed forward value when building block. ### BOX64_DYNAREC_NATIVEFLAGS -Enable or disable the use of native flags. +Enable or disable the use of native flags. Availble in WowBox64. * 0: Do not use native flags. * 1: Use native flags when possible. [Default] ### BOX64_DYNAREC_PAUSE -Enable x86 PAUSE emulation, may help the performance of spinlocks. +Enable x86 PAUSE emulation, may help the performance of spinlocks. Availble in WowBox64. * 0: Ignore x86 PAUSE instruction. [Default] * 1: Use YIELD to emulate x86 PAUSE instruction. @@ -662,7 +664,7 @@ Enable x86 PAUSE emulation, may help the performance of spinlocks. ### BOX64_DYNAREC_SAFEFLAGS -Behaviour of flags emulation on CALL/RET opcodes. +Behaviour of flags emulation on CALL/RET opcodes. Availble in WowBox64. * 0: Treat CALL/RET as if it never needs any flags. * 1: Most of RETs will need flags, most of CALLs will not. [Default] @@ -670,7 +672,7 @@ Behaviour of flags emulation on CALL/RET opcodes. ### BOX64_DYNAREC_STRONGMEM -Enable the emulation of x86 strong memory model. +Enable the emulation of x86 strong memory model. Availble in WowBox64. * 0: Do not try anything special. [Default] * 1: Enable some memory barriers when writing to memory to emulate the x86 strong memory model in a limited way. @@ -686,14 +688,14 @@ Use volatile metadata parsed from PE files, only valid for 64bit Windows games. ### BOX64_DYNAREC_WAIT -Wait or not for the building of a DynaRec code block to be ready. +Wait or not for the building of a DynaRec code block to be ready. Availble in WowBox64. * 0: Do not wait and use interpreter instead, might speedup a bit on massive multithread or JIT programs. * 1: Wait for a DynaRec code block to be ready. [Default] ### BOX64_DYNAREC_WEAKBARRIER -Tweak the memory barriers to reduce the performance impact by strong memory emualtion. +Tweak the memory barriers to reduce the performance impact by strong memory emualtion. Availble in WowBox64. * 0: Use regular safe barrier. * 1: Use weak barriers to have more performance boost. [Default] @@ -708,7 +710,7 @@ Force 32-bit compatible memory mappings on 64-bit programs that run 32-bit code ### BOX64_NODYNAREC -Forbid dynablock creation in the address range specified, helpful for debugging behaviour difference between Dynarec and Interpreter. +Forbid dynablock creation in the address range specified, helpful for debugging behaviour difference between Dynarec and Interpreter. Availble in WowBox64. * 0xXXXXXXXX-0xYYYYYYYY: Define the range where dynablock creation is forbidden (inclusive-exclusive). diff --git a/docs/box64.pod b/docs/box64.pod index 444d5702..3d58ee10 100644 --- a/docs/box64.pod +++ b/docs/box64.pod @@ -75,7 +75,7 @@ Arguments to pass to the guest program, only valid if there is no existing argum =item B<BOX64_AVX> =I<0|1|2> -Expose AVX extension to CPUID and cpuinfo file. Default value is 2 on Arm64 because it's fully implemented in DynaRec, 0 otherwise. +Expose AVX extension to CPUID and cpuinfo file. Default value is 2 on Arm64 because it's fully implemented in DynaRec, 0 otherwise. Availble in WowBox64. * 0 : Do not expose AVX capabilities. * 1 : Expose AVX, BMI1, F16C and VAES extensions to CPUID and cpuinfo file. @@ -107,7 +107,7 @@ Add -cef-disable-gpu-compositor argument to the guest program. =item B<BOX64_CPUTYPE> =I<0|1> -Specify the CPU type to emulate. +Specify the CPU type to emulate. Availble in WowBox64. * 0 : Emulate a Intel CPU Model. [Default] * 1 : Emulate a AMD CPU Model. @@ -131,7 +131,7 @@ Enable or disable the logging of dlsym errors. =item B<BOX64_DUMP> =I<0|1> -Dump elfloader debug information. +Dump elfloader debug information. Availble in WowBox64. * 0 : Do not dump elfloader debug information. [Default] * 1 : Dump elfloader debug information. @@ -139,7 +139,7 @@ Dump elfloader debug information. =item B<BOX64_DYNAREC> =I<0|1> -Enable/disable the Dynamic Recompiler (a.k.a DynaRec). This option defaults to 1 if it's enabled in the build options for a supported architecture. +Enable/disable the Dynamic Recompiler (a.k.a DynaRec). This option defaults to 1 if it's enabled in the build options for a supported architecture. Availble in WowBox64. * 0 : Disable DynaRec. * 1 : Enable DynaRec. @@ -147,7 +147,7 @@ Enable/disable the Dynamic Recompiler (a.k.a DynaRec). This option defaults to 1 =item B<BOX64_DYNAREC_ALIGNED_ATOMICS> =I<0|1> -Generate aligned atomics only (only available on Arm64 for now). +Generate aligned atomics only (only available on Arm64 for now). Availble in WowBox64. * 0 : Generate unaligned atomics handling code. [Default] * 1 : Generate aligned atomics only, which is faster and smaller code size, but will cause SIGBUS for LOCK prefixed opcodes operating on aligned data addresses. @@ -155,7 +155,7 @@ Generate aligned atomics only (only available on Arm64 for now). =item B<BOX64_DYNAREC_BIGBLOCK> =I<0|1|2|3> -Enable building bigger DynaRec code blocks for better performance. +Enable building bigger DynaRec code blocks for better performance. Availble in WowBox64. * 0 : Do not try to build block as big as possible, suitable for programs using lots of threads and JIT, like Unity. * 1 : Build Dynarec block as big as possible. @@ -173,16 +173,16 @@ Detect MonoBleedingEdge and apply conservative settings. =item B<BOX64_DYNAREC_CALLRET> =I<0|1|2> -Optimize CALL/RET opcodes. +Optimize CALL/RET opcodes. Availble in WowBox64. * 0 : Do not optimize CALL/RET, use jump table. [Default] * 1 : Try to optimize CALL/RET, skipping the jump table when possible. - * 2 : Try to optimize CALL/RET, skipping the jump table when possible, adding code to handle return to dirty/modified block. + * 2 : Try to optimize CALL/RET, skipping the jump table when possible, adding code to handle return to dirty/modified block. Does not work on WowBox64. =item B<BOX64_DYNAREC_DF> =I<0|1> -Enable or disable the use of deferred flags. +Enable or disable the use of deferred flags. Availble in WowBox64. * 0 : Disable the use of deferred flags. * 1 : Enable the use of deferred flags. [Default] @@ -199,7 +199,7 @@ Allow continue running a block that is unprotected and potentially dirty. =item B<BOX64_DYNAREC_DIV0> =I<0|1> -Enable or disable the generation of division-by-zero exception. +Enable or disable the generation of division-by-zero exception. Availble in WowBox64. * 0 : Do not generate thr division-by-zero exception. [Default] * 1 : Generate the division-by-zero exception. @@ -207,7 +207,7 @@ Enable or disable the generation of division-by-zero exception. =item B<BOX64_DYNAREC_DUMP> =I<0|1|2> -Enable DynaRec dump. +Enable DynaRec dump. Availble in WowBox64. * 0 : Do not dump DynaRec blocks. [Default] * 1 : Dump DynaRec blocks. @@ -216,14 +216,14 @@ Enable DynaRec dump. =item B<BOX64_DYNAREC_DUMP_RANGE> =I<0xXXXXXXXX-0xYYYYYYYY> -Dump DynaRec blocks in the specified range. +Dump DynaRec blocks in the specified range. Availble in WowBox64. * 0xXXXXXXXX-0xYYYYYYYY : Define the range where dynablock gets dumped (inclusive-exclusive). =item B<BOX64_DYNAREC_FASTNAN> =I<0|1> -Enable or disable fast NaN handling. +Enable or disable fast NaN handling. Availble in WowBox64. * 0 : Precisely emulate the -NaN generation like on x86. * 1 : Do not do anything special with -NAN generation, faster. [Default] @@ -231,7 +231,7 @@ Enable or disable fast NaN handling. =item B<BOX64_DYNAREC_FASTROUND> =I<0|1|2> -Enable or disable fast rounding. +Enable or disable fast rounding. Availble in WowBox64. * 0 : Generate float/double -> int rounding and use current rounding mode for float/double computation like on x86. * 1 : Do not do anything special with edge case rounding, faster. [Default] @@ -240,7 +240,7 @@ Enable or disable fast rounding. =item B<BOX64_DYNAREC_FORWARD> =I<0|128|XXXX> -Define max allowed forward value when building block. +Define max allowed forward value when building block. Availble in WowBox64. * 0 : No forward value. When current block ends, do not try to go further even if there are previous forward jumps. * 128 : Allow up to 128 bytes of gap between end of the block and the next forward jump. [Default] @@ -260,7 +260,7 @@ The GDBJIT debugging support, only available on build with `-DGDBJIT=ON`, enable =item B<BOX64_DYNAREC_LOG> =I<0|1|2|3> -Disable or enable DynaRec logs. +Disable or enable DynaRec logs. Availble in WowBox64. * 0 : Disable DynaRec logs. [Default] * 1 : Enable minimal DynaRec logs. @@ -270,7 +270,7 @@ Disable or enable DynaRec logs. =item B<BOX64_DYNAREC_MISSING> =I<0|1|2> -Print missing opcodes. +Print missing opcodes. Availble in WowBox64. * 0 : Do not print the missing opcode. [Default] * 1 : Print missing opcodes. @@ -279,7 +279,7 @@ Print missing opcodes. =item B<BOX64_DYNAREC_NATIVEFLAGS> =I<0|1> -Enable or disable the use of native flags. +Enable or disable the use of native flags. Availble in WowBox64. * 0 : Do not use native flags. * 1 : Use native flags when possible. [Default] @@ -287,7 +287,7 @@ Enable or disable the use of native flags. =item B<BOX64_DYNAREC_PAUSE> =I<0|1|2|3> -Enable x86 PAUSE emulation, may help the performance of spinlocks. +Enable x86 PAUSE emulation, may help the performance of spinlocks. Availble in WowBox64. * 0 : Ignore x86 PAUSE instruction. [Default] * 1 : Use YIELD to emulate x86 PAUSE instruction. @@ -305,7 +305,7 @@ Generate map file for Linux perf tool. =item B<BOX64_DYNAREC_SAFEFLAGS> =I<0|1|2> -Behaviour of flags emulation on CALL/RET opcodes. +Behaviour of flags emulation on CALL/RET opcodes. Availble in WowBox64. * 0 : Treat CALL/RET as if it never needs any flags. * 1 : Most of RETs will need flags, most of CALLs will not. [Default] @@ -314,7 +314,7 @@ Behaviour of flags emulation on CALL/RET opcodes. =item B<BOX64_DYNAREC_STRONGMEM> =I<0|1|2|3> -Enable the emulation of x86 strong memory model. +Enable the emulation of x86 strong memory model. Availble in WowBox64. * 0 : Do not try anything special. [Default] * 1 : Enable some memory barriers when writing to memory to emulate the x86 strong memory model in a limited way. @@ -332,7 +332,7 @@ Enable or disable libtbb detection. =item B<BOX64_DYNAREC_TEST> =I<0|1|0xXXXXXXXX-0xYYYYYYYY> -Enable DynaRec execution comparison with the interpreter, very slow, only for testing. +Enable DynaRec execution comparison with the interpreter, very slow, only for testing. Availble in WowBox64. * 0 : No comparison. [Default] * 1 : Each opcode runs on interpreter and on Dynarec, regs and memory are compared and printed when they differ. @@ -357,7 +357,7 @@ Use volatile metadata parsed from PE files, only valid for 64bit Windows games. =item B<BOX64_DYNAREC_WAIT> =I<0|1> -Wait or not for the building of a DynaRec code block to be ready. +Wait or not for the building of a DynaRec code block to be ready. Availble in WowBox64. * 0 : Do not wait and use interpreter instead, might speedup a bit on massive multithread or JIT programs. * 1 : Wait for a DynaRec code block to be ready. [Default] @@ -365,7 +365,7 @@ Wait or not for the building of a DynaRec code block to be ready. =item B<BOX64_DYNAREC_WEAKBARRIER> =I<0|1|2> -Tweak the memory barriers to reduce the performance impact by strong memory emualtion. +Tweak the memory barriers to reduce the performance impact by strong memory emualtion. Availble in WowBox64. * 0 : Use regular safe barrier. * 1 : Use weak barriers to have more performance boost. [Default] @@ -374,7 +374,7 @@ Tweak the memory barriers to reduce the performance impact by strong memory emua =item B<BOX64_DYNAREC_X87DOUBLE> =I<0|1|2> -Force the use of float/double for x87 emulation. +Force the use of float/double for x87 emulation. Availble in WowBox64. * 0 : Try to use float when possible for x87 emulation. [Default] * 1 : Only use Double for x87 emulation. @@ -501,7 +501,7 @@ Set the address where the program is loaded, only active for PIE guest programs. =item B<BOX64_LOG> =I<0|1|2|3> -Enable or disable Box64 logs, default value is 0 if stdout is not terminal, 1 otherwise. +Enable or disable Box64 logs, default value is 0 if stdout is not terminal, 1 otherwise. Availble in WowBox64. * 0 : Disable Box64 logs. * 1 : Enable minimal Box64 logs. @@ -520,7 +520,7 @@ Behaviour when hooking malloc operators. =item B<BOX64_MAXCPU> =I<0|XXXX> -Maximum CPU cores exposed. +Maximum CPU cores exposed. Availble in WowBox64. * 0 : Use the actual number of CPU cores. [Default] * XXXX : Use XXXX CPU cores. @@ -536,7 +536,7 @@ Force 32-bit compatible memory mappings on 64-bit programs that run 32-bit code =item B<BOX64_NOBANNER> =I<0|1> -Disable the Box64 banner. +Disable the Box64 banner. Availble in WowBox64. * 0 : Show the Box64 banner. * 1 : Do not show the Box64 banner. @@ -544,7 +544,7 @@ Disable the Box64 banner. =item B<BOX64_NODYNAREC> =I<0xXXXXXXXX-0xYYYYYYYY> -Forbid dynablock creation in the address range specified, helpful for debugging behaviour difference between Dynarec and Interpreter. +Forbid dynablock creation in the address range specified, helpful for debugging behaviour difference between Dynarec and Interpreter. Availble in WowBox64. * 0xXXXXXXXX-0xYYYYYYYY : Define the range where dynablock creation is forbidden (inclusive-exclusive). @@ -694,7 +694,7 @@ Always show SIGSEGV signal detailes. =item B<BOX64_SSE_FLUSHTO0> =I<0|1> -Behaviour of SSE Flush to 0 flags. +Behaviour of SSE Flush to 0 flags. Availble in WowBox64. * 0 : Just track the flag. [Default] * 1 : Apply SSE Flush to 0 flag directly. @@ -702,7 +702,7 @@ Behaviour of SSE Flush to 0 flags. =item B<BOX64_SSE42> =I<0|1> -Expose SSE4.2 capabilities. +Expose SSE4.2 capabilities. Availble in WowBox64. * 0 : Do not expose SSE4.2 capabilities. * 1 : Expose SSE4.2 capabilities. [Default] @@ -818,7 +818,7 @@ Call XInitThreads when loading X11. This is mostly for old Loki games with the L =item B<BOX64_X87_NO80BITS> =I<0|1> -Behavoiur of x87 80bits long double. +Behavoiur of x87 80bits long double. Availble in WowBox64. * 0 : Try to handle 80bits long double as precise as possible. [Default] * 1 : Use 64bits double for x87. diff --git a/docs/gen/gen.py b/docs/gen/gen.py index 710e973b..0eb3d52e 100644 --- a/docs/gen/gen.py +++ b/docs/gen/gen.py @@ -18,9 +18,11 @@ Usage There are many environment variables to control Box64's behaviour, which will be listed below by category. -### Configuration files +There are 2 types of Box64 builds: the Wine WOW64 build (WowBox64) and the regular Linux build. Beware only some of the environment variables are available in WowBox64. -In addition to environment variables, by default, Box64 also looks for 2 places for rcfile: the system-wide `/etc/box64.box64rc` and user-specific `~/.box64rc`. +### Configuration files for Linux build + +In addition to environment variables, if you're using the regular Linux build, Box64 also looks for 2 places for rcfile by default: the system-wide `/etc/box64.box64rc` and user-specific `~/.box64rc`. Settings priority follows this order (from highest to lowest): `~/.box64rc` > `/etc/box64.box64rc` > environment variables. Example configuration: @@ -35,7 +37,7 @@ BOX64_DYNAREC_CALLRET=1 This configuration will apply the specified settings application-wide to any executable named `factorio`. -### Advanced usage +### Advanced usage for Linux build 1. **Wildcard Matching** @@ -63,9 +65,9 @@ This configuration will apply the specified settings application-wide to any exe for category, entries in categories.items(): md_file.write(f"## {category}\n\n") for entry in entries: - md_file.write(f"### {entry['name']}\n\n{entry['description']}\n\n") + md_file.write(f"### {entry['name']}\n\n{entry['description']}{' Availble in WowBox64.' if entry['wine'] else ''}\n\n") for option in entry['options']: - md_file.write(f" * {option['key']}: {option['description']} {"[Default]" if option['default'] else ""}\n") + md_file.write(f" * {option['key']}: {option['description']} {'[Default]' if option['default'] else ''}\n") md_file.write("\n") @@ -123,9 +125,9 @@ Example: """) for entry in data: - pod_file.write(f"\n=item B<{entry['name']}> =I<{ '|'.join(option['key'] for option in entry['options']) }>\n\n{entry['description']}\n\n") + pod_file.write(f"\n=item B<{entry['name']}> =I<{ '|'.join(option['key'] for option in entry['options']) }>\n\n{entry['description']}{' Availble in WowBox64.' if entry['wine'] else ''}\n\n") for option in entry['options']: - pod_file.write(f" * {option['key']} : {option['description']} {"[Default]" if option['default'] else ""}\n") + pod_file.write(f" * {option['key']} : {option['description']} {'[Default]' if option['default'] else ''}\n") pod_file.write("\n") pod_file.write(""" @@ -155,22 +157,22 @@ def get_usage_entry(usage, define): for entry in data: i = list(d["default"] for d in entry["options"]).count(True) if i > 1: - print(f"{entry["name"]:<{PADDING}}: multiple default values usage.json") + print(f"{entry['name']:<{PADDING}}: multiple default values usage.json") # regex to match env.h C code regex = { "INTEGER": re.compile( - r"^\s*INTEGER\((?P<define>\w+), (?P<name>\w+), (?P<default>\w+), (?P<min>\w+), (?P<max>\w+)\)" + r"^\s*INTEGER\((?P<define>\w+), (?P<name>\w+), (?P<default>\w+), (?P<min>\w+), (?P<max>\w+), (?P<wine>\w+)\)" ), "INTEGER64": re.compile( - r"^\s*INTEGER64\((?P<define>\w+), (?P<name>\w+), (?P<default>\w+)\)" + r"^\s*INTEGER64\((?P<define>\w+), (?P<name>\w+), (?P<default>\w+), (?P<wine>\w+)\)" ), "BOOLEAN": re.compile( - r"^\s*BOOLEAN\((?P<define>\w+), (?P<name>\w+), (?P<default>\w+)\)" + r"^\s*BOOLEAN\((?P<define>\w+), (?P<name>\w+), (?P<default>\w+), (?P<wine>\w+)\)" ), - "ADDRESS": re.compile(r"^\s*ADDRESS\((?P<define>\w+), (?P<name>\w+)\)"), - "STRING": re.compile(r"^\s*STRING\((?P<define>\w+), (?P<name>\w+)\)"), + "ADDRESS": re.compile(r"^\s*ADDRESS\((?P<define>\w+), (?P<name>\w+), (?P<wine>\w+)\)"), + "STRING": re.compile(r"^\s*STRING\((?P<define>\w+), (?P<name>\w+), (?P<wine>\w+)\)"), } env_file = os.path.join(script_dir, "../../src/include/env.h") @@ -210,6 +212,10 @@ for define, m in matches["INTEGER"].items(): # blank means that the entry has an 'XXXX' entry which usually indicated that arbitrary values are valid blank = False default2 = None + + if int(m["wine"]) != int(e["wine"]): + print(f"{define:<{PADDING}}: wine mismatch: env.h={int(m['wine'])}, usage.json={int(e['wine'])}") + for o in e["options"]: if o["key"] == "XXXX": blank = True @@ -238,7 +244,7 @@ for define, m in matches["INTEGER"].items(): f"{define:<{PADDING}}: default value mismatch: env.h={default}, usage.json={default2}" ) -for define, m in matches["INTEGER64"].items(): +for define, m in matches['INTEGER64'].items(): # similar to INTEGER but without min/max name = m["name"] default = None if m["no_default"] or not m["default"].isdigit() else int(m["default"]) @@ -246,6 +252,10 @@ for define, m in matches["INTEGER64"].items(): # Check consistency with usage.json if e := get_usage_entry(data, define): default2 = None + + if int(m["wine"]) != int(e["wine"]): + print(f"{define:<{PADDING}}: wine mismatch: env.h={int(m['wine'])}, usage.json={int(e['wine'])}") + for o in e["options"]: if o["key"] == "XXXX": continue @@ -267,11 +277,15 @@ for define, m in matches["BOOLEAN"].items(): # Check consistency with usage.json if e := get_usage_entry(data, define): default2 = None + + if int(m["wine"]) != int(e["wine"]): + print(f"{define:<{PADDING}}: wine mismatch: env.h={int(m['wine'])}, usage.json={int(e['wine'])}") + for o in e["options"]: try: val = bool(o["key"]) except ValueError: - print(f"{define:<{PADDING}}: failed to parse boolean {o["key"]}") + print(f"{define:<{PADDING}}: failed to parse boolean {o['key']}") if o["default"]: default2 = val @@ -281,14 +295,19 @@ for define, m in matches["BOOLEAN"].items(): f"{define:<{PADDING}}: default value mismatch: env.h={default}, usage.json={default2}" ) -# ADDRESS and STRING are not that interesting, just check that they exist in usage.json +# ADDRESS and STRING are not that interesting for define, m in matches["ADDRESS"].items(): - _ = get_usage_entry(data, define) + if e := get_usage_entry(data, define): + if int(m["wine"]) != int(e["wine"]): + print(f"{define:<{PADDING}}: wine mismatch: env.h={int(m['wine'])}, usage.json={int(e['wine'])}") + for define, m in matches["STRING"].items(): # skip BOX64_ENV[1-5] entries, they mismatch but this is fine if define.startswith("BOX64_ENV"): continue - _ = get_usage_entry(data, define) + if e := get_usage_entry(data, define): + if int(m["wine"]) != int(e["wine"]): + print(f"{define:<{PADDING}}: wine mismatch: env.h={int(m['wine'])}, usage.json={int(e['wine'])}") # check that everything from usage.json is in env.h for e in data: diff --git a/docs/gen/usage.json b/docs/gen/usage.json index 9dc1a30a..4cce0566 100644 --- a/docs/gen/usage.json +++ b/docs/gen/usage.json @@ -3,6 +3,7 @@ "name": "BOX64_ADDLIBS", "description": "Add extras to the needed libraries list, rarely needed.", "category": "Libraries", + "wine": false, "options": [ { "key": "XXXX", @@ -20,6 +21,7 @@ "name": "BOX64_ALLOWMISSINGLIBS", "description": "Allow missing libraries to be ignored.", "category": "Libraries", + "wine": false, "options": [ { "key": "0", @@ -37,6 +39,7 @@ "name": "BOX64_ARGS", "description": "Arguments to pass to the guest program, only valid if there is no existing arguments.", "category": "Arguments", + "wine": false, "options": [ { "key": "XXXX", @@ -54,6 +57,7 @@ "name": "BOX64_AVX", "description": "Expose AVX extension to CPUID and cpuinfo file. Default value is 2 on Arm64 because it's fully implemented in DynaRec, 0 otherwise.", "category": "Compatibility", + "wine": true, "options": [ { "key": "0", @@ -76,6 +80,7 @@ "name": "BOX64_BASH", "description": "Path to the bash executable.", "category": "Compatibility", + "wine": false, "options": [ { "key": "XXXX", @@ -88,6 +93,7 @@ "name": "BOX64_CEFDISABLEGPU", "description": "Add -cef-disable-gpu argument to the guest program.", "category": "Arguments", + "wine": false, "options": [ { "key": "0", @@ -105,6 +111,7 @@ "name": "BOX64_CEFDISABLEGPUCOMPOSITOR", "description": "Add -cef-disable-gpu-compositor argument to the guest program.", "category": "Arguments", + "wine": false, "options": [ { "key": "0", @@ -122,6 +129,7 @@ "name": "BOX64_CPUTYPE", "description": "Specify the CPU type to emulate.", "category": "Compatibility", + "wine": true, "options": [ { "key": "0", @@ -139,6 +147,7 @@ "name": "BOX64_CRASHHANDLER", "description": "Use a dummy crash handler or not.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -156,6 +165,7 @@ "name": "BOX64_DLSYM_ERROR", "description": "Enable or disable the logging of dlsym errors.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -173,6 +183,7 @@ "name": "BOX64_DUMP", "description": "Dump elfloader debug information.", "category": "Debugging", + "wine": true, "options": [ { "key": "0", @@ -190,6 +201,7 @@ "name": "BOX64_DYNAREC", "description": "Enable/disable the Dynamic Recompiler (a.k.a DynaRec). This option defaults to 1 if it's enabled in the build options for a supported architecture.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -207,6 +219,7 @@ "name": "BOX64_DYNAREC_ALIGNED_ATOMICS", "description": "Generate aligned atomics only (only available on Arm64 for now).", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -224,6 +237,7 @@ "name": "BOX64_DYNAREC_BIGBLOCK", "description": "Enable building bigger DynaRec code blocks for better performance.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -251,6 +265,7 @@ "name": "BOX64_DYNAREC_BLEEDING_EDGE", "description": "Detect MonoBleedingEdge and apply conservative settings.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -268,6 +283,7 @@ "name": "BOX64_DYNAREC_CALLRET", "description": "Optimize CALL/RET opcodes.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -281,7 +297,7 @@ }, { "key": "2", - "description": "Try to optimize CALL/RET, skipping the jump table when possible, adding code to handle return to dirty/modified block.", + "description": "Try to optimize CALL/RET, skipping the jump table when possible, adding code to handle return to dirty/modified block. Does not work on WowBox64.", "default": false } ] @@ -290,6 +306,7 @@ "name": "BOX64_DYNAREC_DF", "description": "Enable or disable the use of deferred flags.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -307,6 +324,7 @@ "name": "BOX64_DYNAREC_DIRTY", "description": "Allow continue running a block that is unprotected and potentially dirty.", "category": "Performance", + "wine": false, "options": [ { "key": "0", @@ -329,6 +347,7 @@ "name": "BOX64_DYNAREC_DIV0", "description": "Enable or disable the generation of division-by-zero exception.", "category": "Compatibility", + "wine": true, "options": [ { "key": "0", @@ -346,6 +365,7 @@ "name": "BOX64_DYNAREC_DUMP", "description": "Enable DynaRec dump.", "category": "Debugging", + "wine": true, "options": [ { "key": "0", @@ -368,6 +388,7 @@ "name": "BOX64_DYNAREC_DUMP_RANGE", "description": "Dump DynaRec blocks in the specified range.", "category": "Debugging", + "wine": true, "options": [ { "key": "0xXXXXXXXX-0xYYYYYYYY", @@ -380,6 +401,7 @@ "name": "BOX64_DYNAREC_FASTNAN", "description": "Enable or disable fast NaN handling.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -397,6 +419,7 @@ "name": "BOX64_DYNAREC_FASTROUND", "description": "Enable or disable fast rounding.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -419,6 +442,7 @@ "name": "BOX64_DYNAREC_FORWARD", "description": "Define max allowed forward value when building block.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -441,6 +465,7 @@ "name": "BOX64_DYNAREC_GDBJIT", "description": "The GDBJIT debugging support, only available on build with `-DGDBJIT=ON`, enable it with gdb command: jit-reader-load /usr/local/lib/libbox64gdbjitreader.so.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -473,6 +498,7 @@ "name": "BOX64_DYNAREC_LOG", "description": "Disable or enable DynaRec logs.", "category": "Debugging", + "wine": true, "options": [ { "key": "0", @@ -500,6 +526,7 @@ "name": "BOX64_DYNAREC_MISSING", "description": "Print missing opcodes.", "category": "Debugging", + "wine": true, "options": [ { "key": "0", @@ -522,6 +549,7 @@ "name": "BOX64_DYNAREC_NATIVEFLAGS", "description": "Enable or disable the use of native flags.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -539,6 +567,7 @@ "name": "BOX64_DYNAREC_PAUSE", "description": "Enable x86 PAUSE emulation, may help the performance of spinlocks.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -566,6 +595,7 @@ "name": "BOX64_DYNAREC_PERFMAP", "description": "Generate map file for Linux perf tool.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -583,6 +613,7 @@ "name": "BOX64_DYNAREC_SAFEFLAGS", "description": "Behaviour of flags emulation on CALL/RET opcodes.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -605,6 +636,7 @@ "name": "BOX64_DYNAREC_STRONGMEM", "description": "Enable the emulation of x86 strong memory model.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -632,6 +664,7 @@ "name": "BOX64_DYNAREC_TBB", "description": "Enable or disable libtbb detection.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -649,6 +682,7 @@ "name": "BOX64_DYNAREC_TEST", "description": "Enable DynaRec execution comparison with the interpreter, very slow, only for testing.", "category": "Debugging", + "wine": true, "options": [ { "key": "0", @@ -671,6 +705,7 @@ "name": "BOX64_DYNAREC_TRACE", "description": "Enable or disable DynaRec trace.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -688,6 +723,7 @@ "name": "BOX64_DYNAREC_VOLATILE_METADATA", "description": "Use volatile metadata parsed from PE files, only valid for 64bit Windows games.", "category": "Performance", + "wine": false, "options": [ { "key": "0", @@ -705,6 +741,7 @@ "name": "BOX64_DYNAREC_WAIT", "description": "Wait or not for the building of a DynaRec code block to be ready.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -722,6 +759,7 @@ "name": "BOX64_DYNAREC_WEAKBARRIER", "description": "Tweak the memory barriers to reduce the performance impact by strong memory emualtion.", "category": "Performance", + "wine": true, "options": [ { "key": "0", @@ -744,6 +782,7 @@ "name": "BOX64_DYNAREC_X87DOUBLE", "description": "Force the use of float/double for x87 emulation.", "category": "Compatibility", + "wine": true, "options": [ { "key": "0", @@ -766,6 +805,7 @@ "name": "BOX64_EMULATED_LIBS", "description": "Force the use of emulated libraries.", "category": "Libraries", + "wine": false, "options": [ { "key": "XXXX", @@ -783,6 +823,7 @@ "name": "BOX64_ENV", "description": "Add an environment variable.", "category": "Environment", + "wine": false, "options": [ { "key": "XXXX=yyyy", @@ -795,6 +836,7 @@ "name": "BOX64_ENV[1-5]", "description": "Add an environment variable.", "category": "Environment", + "wine": false, "options": [ { "key": "XXXX=yyyy", @@ -807,6 +849,7 @@ "name": "BOX64_EXIT", "description": "Just exit, do not try to run the program.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -824,6 +867,7 @@ "name": "BOX64_FIX_64BIT_INODES", "description": "Fix 64bit inodes.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -841,6 +885,7 @@ "name": "BOX64_IGNOREINT3", "description": "Ignore INT3 instructions.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -858,6 +903,7 @@ "name": "BOX64_INSERT_ARGS", "description": "Prepend arguments to the command line.", "category": "Arguments", + "wine": false, "options": [ { "key": "XXXX", @@ -875,6 +921,7 @@ "name": "BOX64_INPROCESSGPU", "description": "Add --in-process-gpu argument to the guest program.", "category": "Arguments", + "wine": false, "options": [ { "key": "0", @@ -892,6 +939,7 @@ "name": "BOX64_JITGDB", "description": "Launch gdb or not for SIGSEGV, SIGILL, and SIGBUS.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -919,6 +967,7 @@ "name": "BOX64_JVM", "description": "Detect libjvm and apply conservative settings.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -936,6 +985,7 @@ "name": "BOX64_LD_LIBRARY_PATH", "description": "Path to look for x86_64 libraries.", "category": "Libraries", + "wine": false, "options": [ { "key": "XXXX", @@ -948,6 +998,7 @@ "name": "BOX64_LD_PRELOAD", "description": "Force loading libraries with the binary.", "category": "Libraries", + "wine": false, "options": [ { "key": "XXXX", @@ -965,6 +1016,7 @@ "name": "BOX64_LIBCEF", "description": "Detect libcef and apply BOX64_MALLOC_HACK settings.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -982,6 +1034,7 @@ "name": "BOX64_LIBGL", "description": "Set the name for libGL.", "category": "Libraries", + "wine": false, "options": [ { "key": "libXXXX", @@ -999,6 +1052,7 @@ "name": "BOX64_LOAD_ADDR", "description": "Set the address where the program is loaded, only active for PIE guest programs.", "category": "Debugging", + "wine": false, "options": [ { "key": "0xXXXXXXXX", @@ -1011,6 +1065,7 @@ "name": "BOX64_LOG", "description": "Enable or disable Box64 logs, default value is 0 if stdout is not terminal, 1 otherwise.", "category": "Debugging", + "wine": true, "options": [ { "key": "0", @@ -1038,6 +1093,7 @@ "name": "BOX64_MALLOC_HACK", "description": "Behaviour when hooking malloc operators.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1060,6 +1116,7 @@ "name": "BOX64_MAXCPU", "description": "Maximum CPU cores exposed.", "category": "Compatibility", + "wine": true, "options": [ { "key": "0", @@ -1077,6 +1134,7 @@ "name": "BOX64_MMAP32", "description": "Force 32-bit compatible memory mappings on 64-bit programs that run 32-bit code (like Wine WOW64), can improve performance.", "category": "Performance", + "wine": false, "options": [ { "key": "0", @@ -1094,6 +1152,7 @@ "name": "BOX64_NOBANNER", "description": "Disable the Box64 banner.", "category": "Debugging", + "wine": true, "options": [ { "key": "0", @@ -1111,6 +1170,7 @@ "name": "BOX64_NODYNAREC", "description": "Forbid dynablock creation in the address range specified, helpful for debugging behaviour difference between Dynarec and Interpreter.", "category": "Performance", + "wine": true, "options": [ { "key": "0xXXXXXXXX-0xYYYYYYYY", @@ -1123,6 +1183,7 @@ "name": "BOX64_NOGTK", "description": "Do not load wrapped GTK libraries.", "category": "Libraries", + "wine": false, "options": [ { "key": "0", @@ -1140,6 +1201,7 @@ "name": "BOX64_NOPULSE", "description": "Do not load PulseAudio libraries (both native and x86_64).", "category": "Libraries", + "wine": false, "options": [ { "key": "0", @@ -1157,6 +1219,7 @@ "name": "BOX64_NORCFILES", "description": "Do not load any rc files.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1174,6 +1237,7 @@ "name": "BOX64_NOSANDBOX", "description": "Add --no-sandbox argument to the guest program.", "category": "Arguments", + "wine": false, "options": [ { "key": "0", @@ -1191,6 +1255,7 @@ "name": "BOX64_NOSIGSEGV", "description": "Disable the handling of SIGSEGV.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1208,6 +1273,7 @@ "name": "BOX64_NOSIGILL", "description": "Disable the handling of SIGILL.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1225,6 +1291,7 @@ "name": "BOX64_NOVULKAN", "description": "Do not load Vulkan libraries.", "category": "Libraries", + "wine": false, "options": [ { "key": "0", @@ -1242,6 +1309,7 @@ "name": "BOX64_PATH", "description": "Path to look for x86_64 binaries.", "category": "Compatibility", + "wine": false, "options": [ { "key": "XXXX", @@ -1254,6 +1322,7 @@ "name": "BOX64_PREFER_EMULATED", "description": "Prefer emulated libraries over native ones.", "category": "Libraries", + "wine": false, "options": [ { "key": "0", @@ -1271,6 +1340,7 @@ "name": "BOX64_PREFER_WRAPPED", "description": "Prefer wrapped libs first even if the lib is specified with absolute path.", "category": "Libraries", + "wine": false, "options": [ { "key": "0", @@ -1288,6 +1358,7 @@ "name": "BOX64_RCFILE", "description": "Path to the rc file to load.", "category": "Compatibility", + "wine": false, "options": [ { "key": "XXXX", @@ -1300,6 +1371,7 @@ "name": "BOX64_RDTSC_1GHZ", "description": "Use hardware counter for rdtsc if available.", "category": "Performance", + "wine": false, "options": [ { "key": "0", @@ -1317,6 +1389,7 @@ "name": "BOX64_RESERVE_HIGH", "description": "Reserve high memory area for the program, always enabled on Box32.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1334,6 +1407,7 @@ "name": "BOX64_ROLLING_LOG", "description": "Show last few wrapped function call when a signal is caught.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1356,6 +1430,7 @@ "name": "BOX64_SDL2_JGUID", "description": "Use a workaround for SDL_GetJoystickGUIDInfo function for wrapped SDL2.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1373,6 +1448,7 @@ "name": "BOX64_SHAEXT", "description": "Expose SHAEXT (a.k.a. SHA_NI) capabilities.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1390,6 +1466,7 @@ "name": "BOX64_SHOWBT", "description": "Show native and emulated backtrace when a signal is caught.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1407,6 +1484,7 @@ "name": "BOX64_SHOWSEGV", "description": "Always show SIGSEGV signal detailes.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1424,6 +1502,7 @@ "name": "BOX64_SSE_FLUSHTO0", "description": "Behaviour of SSE Flush to 0 flags.", "category": "Compatibility", + "wine": true, "options": [ { "key": "0", @@ -1441,6 +1520,7 @@ "name": "BOX64_SSE42", "description": "Expose SSE4.2 capabilities.", "category": "Compatibility", + "wine": true, "options": [ { "key": "0", @@ -1458,6 +1538,7 @@ "name": "BOX64_SYNC_ROUNDING", "description": "Synchronize rounding mode between x86 and native.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1475,6 +1556,7 @@ "name": "BOX64_TRACE_COLOR", "description": "Enable or disable colored trace output.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1492,6 +1574,7 @@ "name": "BOX64_TRACE_EMM", "description": "Enable or disable EMM (i.e. MMX) trace output.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1509,6 +1592,7 @@ "name": "BOX64_TRACE_FILE", "description": "Send all log and trace to a file instead of `stdout`.", "category": "Debugging", + "wine": false, "options": [ { "key": "XXXX", @@ -1531,6 +1615,7 @@ "name": "BOX64_TRACE_INIT", "description": "Same as BOX64_TRACE but starts the trace immediately.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1548,6 +1633,7 @@ "name": "BOX64_TRACE_START", "description": "Start trace after N opcodes executed.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1570,6 +1656,7 @@ "name": "BOX64_TRACE_XMM", "description": "Enable or disable XMM (i.e. SSE) trace output.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1587,6 +1674,7 @@ "name": "BOX64_TRACE", "description": "Only available on box64 build with trace. Adds trace of all instructions executed, along with a register dump.", "category": "Debugging", + "wine": false, "options": [ { "key": "0", @@ -1614,6 +1702,7 @@ "name": "BOX64_UNITYPLAYER", "description": "Detect UnityPlayer and apply conservative settings.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1631,6 +1720,7 @@ "name": "BOX64_WRAP_EGL", "description": "Prefer wrapped libs for EGL and GLESv2.", "category": "Libraries", + "wine": false, "options": [ { "key": "0", @@ -1648,6 +1738,7 @@ "name": "BOX64_X11GLX", "description": "Force Xorg GLX extension to be present.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1665,6 +1756,7 @@ "name": "BOX64_X11SYNC", "description": "Force synchronized operation on X11 display.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1682,6 +1774,7 @@ "name": "BOX64_X11THREADS", "description": "Call XInitThreads when loading X11. This is mostly for old Loki games with the Loki_Compat library.", "category": "Compatibility", + "wine": false, "options": [ { "key": "0", @@ -1699,6 +1792,7 @@ "name": "BOX64_X87_NO80BITS", "description": "Behavoiur of x87 80bits long double.", "category": "Compatibility", + "wine": true, "options": [ { "key": "0", diff --git a/src/include/env.h b/src/include/env.h index db4974bd..ff8961c6 100644 --- a/src/include/env.h +++ b/src/include/env.h @@ -14,11 +14,11 @@ } /* - INTEGER(NAME, name, default, min, max) - INTEGER64(NAME, name, default) - BOOLEAN(NAME, name, default) - ADDRESS(NAME, name) - STRING(NAME, name) + INTEGER(NAME, name, default, min, max, wine) + INTEGER64(NAME, name, default, wine) + BOOLEAN(NAME, name, default, wine) + ADDRESS(NAME, name, wine) + STRING(NAME, name, wine) */ #ifdef _WIN32 @@ -30,117 +30,117 @@ extern char* ftrace_name; #define BOX64_NOBANNER_DEFAULT (isatty(fileno(stdout)) ? 0 : 1) #endif -#define ENVSUPER1() \ - STRING(BOX64_ADDLIBS, addlibs) \ - BOOLEAN(BOX64_ALLOWMISSINGLIBS, allow_missing_libs, 0) \ - STRING(BOX64_ARGS, args) \ - STRING(BOX64_BASH, bash) \ - BOOLEAN(BOX64_CEFDISABLEGPU, cefdisablegpu, 0) \ - BOOLEAN(BOX64_CEFDISABLEGPUCOMPOSITOR, cefdisablegpucompositor, 0) \ - INTEGER(BOX64_CPUTYPE, cputype, 0, 0, 1) \ - BOOLEAN(BOX64_CRASHHANDLER, dummy_crashhandler, 1) \ - BOOLEAN(BOX64_DLSYM_ERROR, dlsym_error, 0) \ - BOOLEAN(BOX64_DUMP, dump, 0) \ - BOOLEAN(BOX64_DYNAREC_ALIGNED_ATOMICS, dynarec_aligned_atomics, 0) \ - INTEGER(BOX64_DYNAREC_BIGBLOCK, dynarec_bigblock, 2, 0, 3) \ - BOOLEAN(BOX64_DYNAREC_BLEEDING_EDGE, dynarec_bleeding_edge, 1) \ - INTEGER(BOX64_DYNAREC_CALLRET, dynarec_callret, 0, 0, 2) \ - BOOLEAN(BOX64_DYNAREC_DF, dynarec_df, 1) \ - INTEGER(BOX64_DYNAREC_DIRTY, dynarec_dirty, 0, 0, 2) \ - BOOLEAN(BOX64_DYNAREC_DIV0, dynarec_div0, 0) \ - INTEGER(BOX64_DYNAREC_DUMP, dynarec_dump, 0, 0, 2) \ - STRING(BOX64_DYNAREC_DUMP_RANGE, dynarec_dump_range) \ - BOOLEAN(BOX64_DYNAREC_FASTNAN, dynarec_fastnan, 1) \ - INTEGER(BOX64_DYNAREC_FASTROUND, dynarec_fastround, 1, 0, 2) \ - INTEGER(BOX64_DYNAREC_FORWARD, dynarec_forward, 128, 0, 1024) \ - STRING(BOX64_DYNAREC_GDBJIT, dynarec_gdbjit_str) \ - INTEGER(BOX64_DYNAREC_LOG, dynarec_log, 0, 0, 3) \ - INTEGER(BOX64_DYNAREC_MISSING, dynarec_missing, 0, 0, 2) \ - BOOLEAN(BOX64_DYNAREC_NATIVEFLAGS, dynarec_nativeflags, 1) \ - INTEGER(BOX64_DYNAREC_PAUSE, dynarec_pause, 0, 0, 3) \ - BOOLEAN(BOX64_DYNAREC_PERFMAP, dynarec_perf_map, 0) \ - INTEGER(BOX64_DYNAREC_SAFEFLAGS, dynarec_safeflags, 1, 0, 2) \ - INTEGER(BOX64_DYNAREC_STRONGMEM, dynarec_strongmem, 0, 0, 3) \ - BOOLEAN(BOX64_DYNAREC_TBB, dynarec_tbb, 1) \ - STRING(BOX64_DYNAREC_TEST, dynarec_test_str) \ - BOOLEAN(BOX64_DYNAREC_TRACE, dynarec_trace, 0) \ - BOOLEAN(BOX64_DYNAREC_VOLATILE_METADATA, dynarec_volatile_metadata, 1) \ - BOOLEAN(BOX64_DYNAREC_WAIT, dynarec_wait, 1) \ - INTEGER(BOX64_DYNAREC_WEAKBARRIER, dynarec_weakbarrier, 1, 0, 2) \ - INTEGER(BOX64_DYNAREC_X87DOUBLE, dynarec_x87double, 0, 0, 2) \ - STRING(BOX64_EMULATED_LIBS, emulated_libs) \ - STRING(BOX64_ENV, env) \ - STRING(BOX64_ENV1, env1) \ - STRING(BOX64_ENV2, env2) \ - STRING(BOX64_ENV3, env3) \ - STRING(BOX64_ENV4, env4) \ - STRING(BOX64_ENV5, env5) \ - BOOLEAN(BOX64_EXIT, exit, 0) \ - BOOLEAN(BOX64_FIX_64BIT_INODES, fix_64bit_inodes, 0) \ - BOOLEAN(BOX64_IGNOREINT3, ignoreint3, 0) \ - STRING(BOX64_INSERT_ARGS, insert_args) \ - BOOLEAN(BOX64_INPROCESSGPU, inprocessgpu, 0) \ - INTEGER(BOX64_JITGDB, jitgdb, 0, 0, 3) \ - BOOLEAN(BOX64_JVM, jvm, 1) \ - STRING(BOX64_LD_LIBRARY_PATH, ld_library_path) \ - BOOLEAN(BOX64_LIBCEF, libcef, 1) \ - STRING(BOX64_LIBGL, libgl) \ - ADDRESS(BOX64_LOAD_ADDR, load_addr) \ - INTEGER(BOX64_LOG, log, DEFAULT_LOG_LEVEL, 0, 3) \ - INTEGER(BOX64_MALLOC_HACK, malloc_hack, 0, 0, 2) \ - INTEGER(BOX64_MAXCPU, new_maxcpu, 0, 0, 100) \ - BOOLEAN(BOX64_MMAP32, mmap32, 1) \ - BOOLEAN(BOX64_NOBANNER, nobanner, BOX64_NOBANNER_DEFAULT) \ - STRING(BOX64_NODYNAREC, nodynarec) \ - BOOLEAN(BOX64_NOGTK, nogtk, 0) \ - BOOLEAN(BOX64_NOPULSE, nopulse, 0) \ - BOOLEAN(BOX64_NORCFILES, noenvfiles, 0) \ - BOOLEAN(BOX64_NOSANDBOX, nosandbox, 0) \ - BOOLEAN(BOX64_NOSIGSEGV, nosigsegv, 0) \ - BOOLEAN(BOX64_NOSIGILL, nosigill, 0) \ - BOOLEAN(BOX64_NOVULKAN, novulkan, 0) \ - STRING(BOX64_PATH, path) \ - BOOLEAN(BOX64_PREFER_EMULATED, prefer_emulated, 0) \ - BOOLEAN(BOX64_PREFER_WRAPPED, prefer_wrapped, 0) \ - STRING(BOX64_RCFILE, envfile) \ - BOOLEAN(BOX64_RDTSC_1GHZ, rdtsc_1ghz, 0) \ - BOOLEAN(BOX64_RESERVE_HIGH, reserve_high, 0) \ - INTEGER(BOX64_ROLLING_LOG, cycle_log, 0, 0, 2048) \ - BOOLEAN(BOX64_SDL2_JGUID, sdl2_jguid, 0) \ - BOOLEAN(BOX64_SHAEXT, shaext, 1) \ - BOOLEAN(BOX64_SHOWBT, showbt, 0) \ - BOOLEAN(BOX64_SHOWSEGV, showsegv, 0) \ - BOOLEAN(BOX64_SSE_FLUSHTO0, sse_flushto0, 0) \ - BOOLEAN(BOX64_SSE42, sse42, 1) \ - BOOLEAN(BOX64_SYNC_ROUNDING, sync_rounding, 0) \ - BOOLEAN(BOX64_TRACE_COLOR, trace_regsdiff, 0) \ - BOOLEAN(BOX64_TRACE_EMM, trace_emm, 0) \ - STRING(BOX64_TRACE_FILE, trace_file) \ - STRING(BOX64_TRACE_INIT, trace_init) \ - INTEGER64(BOX64_TRACE_START, start_cnt, 0) \ - BOOLEAN(BOX64_TRACE_XMM, trace_xmm, 0) \ - STRING(BOX64_TRACE, trace) \ - BOOLEAN(BOX64_UNITYPLAYER, unityplayer, 1) \ - BOOLEAN(BOX64_WRAP_EGL, wrap_egl, 0) \ - BOOLEAN(BOX64_X11GLX, x11glx, 1) \ - BOOLEAN(BOX64_X11SYNC, x11sync, 0) \ - BOOLEAN(BOX64_X11THREADS, x11threads, 0) \ - BOOLEAN(BOX64_X87_NO80BITS, x87_no80bits, 0) +#define ENVSUPER1() \ + STRING(BOX64_ADDLIBS, addlibs, 0) \ + BOOLEAN(BOX64_ALLOWMISSINGLIBS, allow_missing_libs, 0, 0) \ + STRING(BOX64_ARGS, args, 0) \ + STRING(BOX64_BASH, bash, 0) \ + BOOLEAN(BOX64_CEFDISABLEGPU, cefdisablegpu, 0, 0) \ + BOOLEAN(BOX64_CEFDISABLEGPUCOMPOSITOR, cefdisablegpucompositor, 0, 0) \ + INTEGER(BOX64_CPUTYPE, cputype, 0, 0, 1, 1) \ + BOOLEAN(BOX64_CRASHHANDLER, dummy_crashhandler, 1, 0) \ + BOOLEAN(BOX64_DLSYM_ERROR, dlsym_error, 0, 0) \ + BOOLEAN(BOX64_DUMP, dump, 0, 1) \ + BOOLEAN(BOX64_DYNAREC_ALIGNED_ATOMICS, dynarec_aligned_atomics, 0, 1) \ + INTEGER(BOX64_DYNAREC_BIGBLOCK, dynarec_bigblock, 2, 0, 3, 1) \ + BOOLEAN(BOX64_DYNAREC_BLEEDING_EDGE, dynarec_bleeding_edge, 1, 0) \ + INTEGER(BOX64_DYNAREC_CALLRET, dynarec_callret, 0, 0, 2, 1) \ + BOOLEAN(BOX64_DYNAREC_DF, dynarec_df, 1, 1) \ + INTEGER(BOX64_DYNAREC_DIRTY, dynarec_dirty, 0, 0, 2, 0) \ + BOOLEAN(BOX64_DYNAREC_DIV0, dynarec_div0, 0, 1) \ + INTEGER(BOX64_DYNAREC_DUMP, dynarec_dump, 0, 0, 2, 1) \ + STRING(BOX64_DYNAREC_DUMP_RANGE, dynarec_dump_range, 1) \ + BOOLEAN(BOX64_DYNAREC_FASTNAN, dynarec_fastnan, 1, 1) \ + INTEGER(BOX64_DYNAREC_FASTROUND, dynarec_fastround, 1, 0, 2, 1) \ + INTEGER(BOX64_DYNAREC_FORWARD, dynarec_forward, 128, 0, 1024, 1) \ + STRING(BOX64_DYNAREC_GDBJIT, dynarec_gdbjit_str, 0) \ + INTEGER(BOX64_DYNAREC_LOG, dynarec_log, 0, 0, 3, 1) \ + INTEGER(BOX64_DYNAREC_MISSING, dynarec_missing, 0, 0, 2, 1) \ + BOOLEAN(BOX64_DYNAREC_NATIVEFLAGS, dynarec_nativeflags, 1, 1) \ + INTEGER(BOX64_DYNAREC_PAUSE, dynarec_pause, 0, 0, 3, 1) \ + BOOLEAN(BOX64_DYNAREC_PERFMAP, dynarec_perf_map, 0, 0) \ + INTEGER(BOX64_DYNAREC_SAFEFLAGS, dynarec_safeflags, 1, 0, 2, 1) \ + INTEGER(BOX64_DYNAREC_STRONGMEM, dynarec_strongmem, 0, 0, 3, 1) \ + BOOLEAN(BOX64_DYNAREC_TBB, dynarec_tbb, 1, 0) \ + STRING(BOX64_DYNAREC_TEST, dynarec_test_str, 1) \ + BOOLEAN(BOX64_DYNAREC_TRACE, dynarec_trace, 0, 0) \ + BOOLEAN(BOX64_DYNAREC_VOLATILE_METADATA, dynarec_volatile_metadata, 1, 0) \ + BOOLEAN(BOX64_DYNAREC_WAIT, dynarec_wait, 1, 1) \ + INTEGER(BOX64_DYNAREC_WEAKBARRIER, dynarec_weakbarrier, 1, 0, 2, 1) \ + INTEGER(BOX64_DYNAREC_X87DOUBLE, dynarec_x87double, 0, 0, 2, 1) \ + STRING(BOX64_EMULATED_LIBS, emulated_libs, 0) \ + STRING(BOX64_ENV, env, 0) \ + STRING(BOX64_ENV1, env1, 0) \ + STRING(BOX64_ENV2, env2, 0) \ + STRING(BOX64_ENV3, env3, 0) \ + STRING(BOX64_ENV4, env4, 0) \ + STRING(BOX64_ENV5, env5, 0) \ + BOOLEAN(BOX64_EXIT, exit, 0, 0) \ + BOOLEAN(BOX64_FIX_64BIT_INODES, fix_64bit_inodes, 0, 0) \ + BOOLEAN(BOX64_IGNOREINT3, ignoreint3, 0, 0) \ + STRING(BOX64_INSERT_ARGS, insert_args, 0) \ + BOOLEAN(BOX64_INPROCESSGPU, inprocessgpu, 0, 0) \ + INTEGER(BOX64_JITGDB, jitgdb, 0, 0, 3, 0) \ + BOOLEAN(BOX64_JVM, jvm, 1, 0) \ + STRING(BOX64_LD_LIBRARY_PATH, ld_library_path, 0) \ + BOOLEAN(BOX64_LIBCEF, libcef, 1, 0) \ + STRING(BOX64_LIBGL, libgl, 0) \ + ADDRESS(BOX64_LOAD_ADDR, load_addr, 0) \ + INTEGER(BOX64_LOG, log, DEFAULT_LOG_LEVEL, 0, 3, 1) \ + INTEGER(BOX64_MALLOC_HACK, malloc_hack, 0, 0, 2, 0) \ + INTEGER(BOX64_MAXCPU, new_maxcpu, 0, 0, 100, 1) \ + BOOLEAN(BOX64_MMAP32, mmap32, 1, 0) \ + BOOLEAN(BOX64_NOBANNER, nobanner, BOX64_NOBANNER_DEFAULT, 1) \ + STRING(BOX64_NODYNAREC, nodynarec, 1) \ + BOOLEAN(BOX64_NOGTK, nogtk, 0, 0) \ + BOOLEAN(BOX64_NOPULSE, nopulse, 0, 0) \ + BOOLEAN(BOX64_NORCFILES, noenvfiles, 0, 0) \ + BOOLEAN(BOX64_NOSANDBOX, nosandbox, 0, 0) \ + BOOLEAN(BOX64_NOSIGSEGV, nosigsegv, 0, 0) \ + BOOLEAN(BOX64_NOSIGILL, nosigill, 0, 0) \ + BOOLEAN(BOX64_NOVULKAN, novulkan, 0, 0) \ + STRING(BOX64_PATH, path, 0) \ + BOOLEAN(BOX64_PREFER_EMULATED, prefer_emulated, 0, 0) \ + BOOLEAN(BOX64_PREFER_WRAPPED, prefer_wrapped, 0, 0) \ + STRING(BOX64_RCFILE, envfile, 0) \ + BOOLEAN(BOX64_RDTSC_1GHZ, rdtsc_1ghz, 0, 0) \ + BOOLEAN(BOX64_RESERVE_HIGH, reserve_high, 0, 0) \ + INTEGER(BOX64_ROLLING_LOG, cycle_log, 0, 0, 2048, 0) \ + BOOLEAN(BOX64_SDL2_JGUID, sdl2_jguid, 0, 0) \ + BOOLEAN(BOX64_SHAEXT, shaext, 1, 0) \ + BOOLEAN(BOX64_SHOWBT, showbt, 0, 0) \ + BOOLEAN(BOX64_SHOWSEGV, showsegv, 0, 0) \ + BOOLEAN(BOX64_SSE_FLUSHTO0, sse_flushto0, 0, 1) \ + BOOLEAN(BOX64_SSE42, sse42, 1, 1) \ + BOOLEAN(BOX64_SYNC_ROUNDING, sync_rounding, 0, 0) \ + BOOLEAN(BOX64_TRACE_COLOR, trace_regsdiff, 0, 0) \ + BOOLEAN(BOX64_TRACE_EMM, trace_emm, 0, 0) \ + STRING(BOX64_TRACE_FILE, trace_file, 0) \ + STRING(BOX64_TRACE_INIT, trace_init, 0) \ + INTEGER64(BOX64_TRACE_START, start_cnt, 0, 0) \ + BOOLEAN(BOX64_TRACE_XMM, trace_xmm, 0, 0) \ + STRING(BOX64_TRACE, trace, 0) \ + BOOLEAN(BOX64_UNITYPLAYER, unityplayer, 1, 0) \ + BOOLEAN(BOX64_WRAP_EGL, wrap_egl, 0, 0) \ + BOOLEAN(BOX64_X11GLX, x11glx, 1, 0) \ + BOOLEAN(BOX64_X11SYNC, x11sync, 0, 0) \ + BOOLEAN(BOX64_X11THREADS, x11threads, 0, 0) \ + BOOLEAN(BOX64_X87_NO80BITS, x87_no80bits, 0, 1) #ifdef ARM64 #define ENVSUPER2() \ - INTEGER(BOX64_AVX, avx, 2, 0, 2) + INTEGER(BOX64_AVX, avx, 2, 0, 2, 1) #else #define ENVSUPER2() \ - INTEGER(BOX64_AVX, avx, 0, 0, 2) + INTEGER(BOX64_AVX, avx, 0, 0, 2, 1) #endif #ifdef DYNAREC #define ENVSUPER3() \ - BOOLEAN(BOX64_DYNAREC, dynarec, 1) + BOOLEAN(BOX64_DYNAREC, dynarec, 1, 1) #else #define ENVSUPER3() \ - BOOLEAN(BOX64_DYNAREC, dynarec, 0) + BOOLEAN(BOX64_DYNAREC, dynarec, 0, 1) #endif #define ENVSUPER() \ @@ -149,11 +149,11 @@ extern char* ftrace_name; ENVSUPER3() typedef struct box64env_s { -#define INTEGER(NAME, name, default, min, max) int name; -#define INTEGER64(NAME, name, default) int64_t name; -#define BOOLEAN(NAME, name, default) int name; -#define ADDRESS(NAME, name) uintptr_t name; -#define STRING(NAME, name) char* name; +#define INTEGER(NAME, name, default, min, max, wine) int name; +#define INTEGER64(NAME, name, default, wine) int64_t name; +#define BOOLEAN(NAME, name, default, wine) int name; +#define ADDRESS(NAME, name, wine) uintptr_t name; +#define STRING(NAME, name, wine) char* name; ENVSUPER() #undef INTEGER #undef INTEGER64 @@ -161,11 +161,11 @@ typedef struct box64env_s { #undef ADDRESS #undef STRING -#define INTEGER(NAME, name, default, min, max) uint64_t is_##name##_overridden : 1; -#define INTEGER64(NAME, name, default) uint64_t is_##name##_overridden : 1; -#define BOOLEAN(NAME, name, default) uint64_t is_##name##_overridden : 1; -#define ADDRESS(NAME, name) uint64_t is_##name##_overridden : 1; -#define STRING(NAME, name) uint64_t is_##name##_overridden : 1; +#define INTEGER(NAME, name, default, min, max, wine) uint64_t is_##name##_overridden : 1; +#define INTEGER64(NAME, name, default, wine) uint64_t is_##name##_overridden : 1; +#define BOOLEAN(NAME, name, default, wine) uint64_t is_##name##_overridden : 1; +#define ADDRESS(NAME, name, wine) uint64_t is_##name##_overridden : 1; +#define STRING(NAME, name, wine) uint64_t is_##name##_overridden : 1; ENVSUPER() #undef INTEGER #undef INTEGER64 diff --git a/src/tools/env.c b/src/tools/env.c index 4b512693..5e0a1de4 100644 --- a/src/tools/env.c +++ b/src/tools/env.c @@ -232,11 +232,11 @@ static void trimStringInplace(char* s) static void freeEnv(box64env_t* env) { -#define INTEGER(NAME, name, default, min, max) -#define INTEGER64(NAME, name, default) -#define BOOLEAN(NAME, name, default) -#define ADDRESS(NAME, name) -#define STRING(NAME, name) box_free(env->name); +#define INTEGER(NAME, name, default, min, max, wine) +#define INTEGER64(NAME, name, default, wine) +#define BOOLEAN(NAME, name, default, wine) +#define ADDRESS(NAME, name, wine) +#define STRING(NAME, name, wine) box_free(env->name); ENVSUPER() #undef INTEGER #undef INTEGER64 @@ -324,17 +324,17 @@ static void initializeEnvFile(const char* filename) *strchr(key, '=') = '\0'; trimStringInplace(key); trimStringInplace(val); -#define INTEGER(NAME, name, default, min, max) \ - else if (!strcmp(key, #NAME)) \ - { \ - int v = strtol(val, &p, 0); \ - if (p != val && v >= min && v <= max) { \ - current_env.is_##name##_overridden = 1; \ - current_env.is_any_overridden = 1; \ - current_env.name = v; \ - } \ - } -#define INTEGER64(NAME, name, default) \ +#define INTEGER(NAME, name, default, min, max, wine) \ + else if (!strcmp(key, #NAME)) \ + { \ + int v = strtol(val, &p, 0); \ + if (p != val && v >= min && v <= max) { \ + current_env.is_##name##_overridden = 1; \ + current_env.is_any_overridden = 1; \ + current_env.name = v; \ + } \ + } +#define INTEGER64(NAME, name, default, wine) \ else if (!strcmp(key, #NAME)) \ { \ int64_t v = strtoll(val, &p, 0); \ @@ -344,7 +344,7 @@ static void initializeEnvFile(const char* filename) current_env.name = v; \ } \ } -#define BOOLEAN(NAME, name, default) \ +#define BOOLEAN(NAME, name, default, wine) \ else if (!strcmp(key, #NAME)) \ { \ if (strcmp(val, "0")) { \ @@ -357,7 +357,7 @@ static void initializeEnvFile(const char* filename) current_env.name = 0; \ } \ } -#define ADDRESS(NAME, name) \ +#define ADDRESS(NAME, name, wine) \ else if (!strcmp(key, #NAME)) \ { \ uintptr_t v = (uintptr_t)strtoll(val, &p, 0); \ @@ -367,7 +367,7 @@ static void initializeEnvFile(const char* filename) current_env.name = v; \ } \ } -#define STRING(NAME, name) \ +#define STRING(NAME, name, wine) \ else if (!strcmp(key, #NAME)) \ { \ current_env.is_##name##_overridden = 1; \ @@ -436,31 +436,31 @@ const char* GetLastApplyEntryName() } static void internalApplyEnvFileEntry(const char* entryname, const box64env_t* env) { -#define INTEGER(NAME, name, default, min, max) \ - if (env->is_##name##_overridden) { \ - box64env.name = env->name; \ - box64env.is_##name##_overridden = 1; \ - box64env.is_any_overridden = 1; \ +#define INTEGER(NAME, name, default, min, max, wine) \ + if (env->is_##name##_overridden) { \ + box64env.name = env->name; \ + box64env.is_##name##_overridden = 1; \ + box64env.is_any_overridden = 1; \ } -#define INTEGER64(NAME, name, default) \ +#define INTEGER64(NAME, name, default, wine) \ if (env->is_##name##_overridden) { \ box64env.name = env->name; \ box64env.is_##name##_overridden = 1; \ box64env.is_any_overridden = 1; \ } -#define BOOLEAN(NAME, name, default) \ +#define BOOLEAN(NAME, name, default, wine) \ if (env->is_##name##_overridden) { \ box64env.name = env->name; \ box64env.is_##name##_overridden = 1; \ box64env.is_any_overridden = 1; \ } -#define ADDRESS(NAME, name) \ +#define ADDRESS(NAME, name, wine) \ if (env->is_##name##_overridden) { \ box64env.name = env->name; \ box64env.is_##name##_overridden = 1; \ box64env.is_any_overridden = 1; \ } -#define STRING(NAME, name) \ +#define STRING(NAME, name, wine) \ if (env->is_##name##_overridden) { \ box64env.name = env->name; \ box64env.is_##name##_overridden = 1; \ @@ -504,22 +504,42 @@ void ApplyEnvFileEntry(const char* entryname) void LoadEnvVariables() { -#define INTEGER(NAME, name, default, min, max) box64env.name = default; -#define INTEGER64(NAME, name, default) box64env.name = default; -#define BOOLEAN(NAME, name, default) box64env.name = default; -#define ADDRESS(NAME, name) box64env.name = 0; -#define STRING(NAME, name) box64env.name = NULL; +#ifdef _WIN32 +#define INTEGER(NAME, name, default, min, max, wine) box64env.name = wine ? default : 0; +#define INTEGER64(NAME, name, default, wine) box64env.name = wine ? default : 0; +#define BOOLEAN(NAME, name, default, wine) box64env.name = wine ? default : 0; +#define ADDRESS(NAME, name, wine) box64env.name = 0; +#define STRING(NAME, name, wine) box64env.name = NULL; ENVSUPER() #undef INTEGER #undef INTEGER64 #undef BOOLEAN #undef ADDRESS #undef STRING - +#else +#define INTEGER(NAME, name, default, min, max, wine) box64env.name = default; +#define INTEGER64(NAME, name, default, wine) box64env.name = default; +#define BOOLEAN(NAME, name, default, wine) box64env.name = default; +#define ADDRESS(NAME, name, wine) box64env.name = 0; +#define STRING(NAME, name, wine) box64env.name = NULL; + ENVSUPER() +#undef INTEGER +#undef INTEGER64 +#undef BOOLEAN +#undef ADDRESS +#undef STRING +#endif char* p; // load env vars from GetEnv() -#define INTEGER(NAME, name, default, min, max) \ - p = GetEnv(#NAME); \ + +#ifdef _WIN32 +#define GETENV(name, wine) (wine ? GetEnv(name) : NULL); +#else +#define GETENV(name, wine) GetEnv(name) +#endif + +#define INTEGER(NAME, name, default, min, max, wine) \ + p = GETENV(#NAME, wine); \ if (p) { \ box64env.name = atoi(p); \ if (box64env.name < min || box64env.name > max) { \ @@ -529,30 +549,30 @@ void LoadEnvVariables() box64env.is_any_overridden = 1; \ } \ } -#define INTEGER64(NAME, name, default) \ - p = GetEnv(#NAME); \ +#define INTEGER64(NAME, name, default, wine) \ + p = GETENV(#NAME, wine); \ if (p) { \ box64env.name = atoll(p); \ box64env.is_##name##_overridden = 1; \ box64env.is_any_overridden = 1; \ } -#define BOOLEAN(NAME, name, default) \ - p = GetEnv(#NAME); \ +#define BOOLEAN(NAME, name, default, wine) \ + p = GETENV(#NAME, wine); \ if (p) { \ box64env.name = p[0] != '0'; \ box64env.is_##name##_overridden = 1; \ box64env.is_any_overridden = 1; \ } -#define ADDRESS(NAME, name) \ - p = GetEnv(#NAME); \ +#define ADDRESS(NAME, name, wine) \ + p = GETENV(#NAME, wine); \ if (p) { \ char* endptr; \ box64env.name = (uintptr_t)strtoll(p, &endptr, 0); \ box64env.is_##name##_overridden = 1; \ box64env.is_any_overridden = 1; \ } -#define STRING(NAME, name) \ - p = GetEnv(#NAME); \ +#define STRING(NAME, name, wine) \ + p = GETENV(#NAME, wine); \ if (p) { \ box64env.name = strdup(p); \ box64env.is_##name##_overridden = 1; \ @@ -570,19 +590,19 @@ void LoadEnvVariables() void PrintEnvVariables(box64env_t* env, int level) { if (env->is_any_overridden) printf_log(level, "BOX64ENV: Variables overridden:\n"); -#define INTEGER(NAME, name, default, min, max) \ - if (env->is_##name##_overridden) \ +#define INTEGER(NAME, name, default, min, max, wine) \ + if (env->is_##name##_overridden) \ printf_log_prefix(0, level, "\t%s=%d\n", #NAME, env->name); -#define INTEGER64(NAME, name, default) \ - if (env->is_##name##_overridden) \ +#define INTEGER64(NAME, name, default, wine) \ + if (env->is_##name##_overridden) \ printf_log_prefix(0, level, "\t%s=%lld\n", #NAME, env->name); -#define BOOLEAN(NAME, name, default) \ - if (env->is_##name##_overridden) \ +#define BOOLEAN(NAME, name, default, wine) \ + if (env->is_##name##_overridden) \ printf_log_prefix(0, level, "\t%s=%d\n", #NAME, env->name); -#define ADDRESS(NAME, name) \ +#define ADDRESS(NAME, name, wine) \ if (env->is_##name##_overridden) \ printf_log_prefix(0, level, "\t%s=%p\n", #NAME, (void*)env->name); -#define STRING(NAME, name) \ +#define STRING(NAME, name, wine) \ if (env->is_##name##_overridden) \ printf_log_prefix(0, level, "\t%s=%s\n", #NAME, env->name); ENVSUPER() |