[DYNAREC] Added option to force Double for x87 emulation, and added some detection of Crysis to force this option (needed for Crysis physics engine)

This commit is contained in:
ptitSeb 2022-01-30 12:28:37 +01:00
parent 4510b4997a
commit ceb4e53f15
4 changed files with 26 additions and 1 deletions

View File

@ -127,6 +127,11 @@ Enable/Disable simulation of Strong Memory model
* 1 : Enable some Memory Barrier when reading from memory (on some MOV opcode) to simulate Strong Memory Model while trying to limit performance impact (Default when libmonobdwgc-2.0.so is loaded)
* 2 : Enable some Memory Barrier when reading from memory (on some MOV opcode) to simulate Strong Memory Model
#### BOX86_DYNAREC_X87DOUBLE
Force the use of Double for x87 emulation
* 0 : Try to use float when possible for x87 emulation (faster)
* 1 : Only use Double for x87 emulation (slower, may be needed for some specific games, like Crysis)
#### BOX86_LIBGL
* libXXXX set the name for libGL (defaults to libGL.so.1).
* /PATH/TO/libGLXXX : Sets the name and path for libGL

View File

@ -568,7 +568,7 @@ uintptr_t dynarecD9(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
switch((nextop>>3)&7) {
case 0:
INST_NAME("FLD ST0, float[ED]");
v1 = x87_do_push(dyn, ninst, x1, NEON_CACHE_ST_F);
v1 = x87_do_push(dyn, ninst, x1, box86_dynarec_x87double?NEON_CACHE_ST_D:NEON_CACHE_ST_F);
if(ST_IS_F(0))
s0 = v1;
else

View File

@ -15,6 +15,7 @@ extern int box86_dynarec_forced;
extern int box86_dynarec_largest;
extern int box86_dynarec_bigblock;
extern int box86_dynarec_strongmem;
extern int box86_dynarec_x87double;
extern uintptr_t box86_nodynarec_start, box86_nodynarec_end;
#ifdef ARM
extern int arm_vfp; // vfp version (3 or 4), with 32 registers is mendatory

View File

@ -54,6 +54,7 @@ int box86_dynarec_forced = 0;
int box86_dynarec_largest = 0;
int box86_dynarec_bigblock = 1;
int box86_dynarec_strongmem = 0;
int box86_dynarec_x87double = 0;
uintptr_t box86_nodynarec_start = 0;
uintptr_t box86_nodynarec_end = 0;
#ifdef ARM
@ -325,6 +326,15 @@ void LoadLogEnv()
if(box86_dynarec_strongmem)
printf_log(LOG_INFO, "Dynarec will try to emulate a strong memory model%s\n", (box86_dynarec_strongmem==1)?" with limited performace loss":"");
}
p = getenv("BOX86_DYNAREC_X87DOUBLE");
if(p) {
if(strlen(p)==1) {
if(p[0]>='0' && p[0]<='1')
box86_dynarec_x87double = p[0]-'0';
}
if(box86_dynarec_x87double)
printf_log(LOG_INFO, "Dynarec will use only double for x87 emulation\n");
}
p = getenv("BOX86_NODYNAREC");
if(p) {
if (strchr(p,'-')) {
@ -592,6 +602,9 @@ void PrintHelp() {
printf(" BOX86_DYNAREC_LOG with 0/1/2/3 or NONE/INFO/DEBUG/DUMP to set the printed dynarec info\n");
printf(" BOX86_DYNAREC with 0/1 to disable or enable Dynarec (On by default)\n");
printf(" BOX86_NODYNAREC with address interval (0x1234-0x4567) to forbid dynablock creation in the interval specified\n");
printf(" BOX86_DYNAREC_BIGBLOCK 0/1/2 to control Dynarec building BigBlock or not\n");
printf(" BOX86_DYNAREC_STRONGMEM 0/1/2 to control Dynarec emulation attempt of Stong memory model\n");
printf(" BOX86_DYNAREC_X87DOUBLE 0/1 to force Dynarec to use Double for x87 emulation\n");
#endif
#ifdef HAVE_TRACE
printf(" BOX86_TRACE with 1 to enable x86 execution trace\n");
@ -965,6 +978,12 @@ int main(int argc, const char **argv, const char **env) {
printf_log(LOG_NONE, "winedbg detected, not launching it!\n");
exit(0); // exiting, it doesn't work anyway
}
#ifdef DYNAREC
if(argv[nextarg+1] && strstr(argv[nextarg+1], "Crysis")) {
printf_log(LOG_NONE, "Crysis detected, forcing use of Double for x87 emulation\n");
box86_dynarec_x87double = 1;
}
#endif
}
// Create a new context
my_context = NewBox86Context(argc - nextarg);