From: notaz Date: Thu, 18 Nov 2021 22:39:26 +0000 (+0200) Subject: drc: use a separate var for game hacks X-Git-Tag: r23~73 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d62c125afc816c30a81f38e7dce75e80940c11e1;p=pcsx_rearmed.git drc: use a separate var for game hacks because config save/load can clear the main var --- diff --git a/libpcsxcore/database.c b/libpcsxcore/database.c index ac19d576..108ccc69 100644 --- a/libpcsxcore/database.c +++ b/libpcsxcore/database.c @@ -35,12 +35,12 @@ void Apply_Hacks_Cdrom() } /* Dynarec game-specific hacks */ - new_dynarec_hacks &= ~NDHACK_OVERRIDE_CYCLE_M; + new_dynarec_hacks_pergame = 0; /* Internal Section is fussy about timings */ if (strcmp(CdromId, "SLPS01868") == 0) { cycle_multiplier_override = 200; - new_dynarec_hacks |= NDHACK_OVERRIDE_CYCLE_M; + new_dynarec_hacks_pergame |= NDHACK_OVERRIDE_CYCLE_M; } } diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c index a4d418fd..9fe13a13 100644 --- a/libpcsxcore/new_dynarec/assem_arm.c +++ b/libpcsxcore/new_dynarec/assem_arm.c @@ -1585,7 +1585,7 @@ static void emit_extjump2(u_char *addr, u_int target, void *linker) emit_loadlp(target,0); emit_loadlp((u_int)addr,1); - assert(addr>=translation_cache&&addr<(translation_cache+(1<=ndrc->translation_cache&&addr<(ndrc->translation_cache+(1<=0x80000000&&target<0x80800000)||(target>0xA4000000&&target<0xA4001000)); //DEBUG > #ifdef DEBUG_CYCLE_COUNT diff --git a/libpcsxcore/new_dynarec/assem_arm64.c b/libpcsxcore/new_dynarec/assem_arm64.c index 6380b272..303dcf00 100644 --- a/libpcsxcore/new_dynarec/assem_arm64.c +++ b/libpcsxcore/new_dynarec/assem_arm64.c @@ -1812,7 +1812,7 @@ static void c2op_assemble(int i,struct regstat *i_regs) need_ir=(gte_unneeded[i+1]&0xe00)!=0xe00; assem_debug("gte op %08x, unneeded %016lx, need_flags %d, need_ir %d\n", source[i],gte_unneeded[i+1],need_flags,need_ir); - if(new_dynarec_hacks&NDHACK_GTE_NO_FLAGS) + if(HACK_ENABLED(NDHACK_GTE_NO_FLAGS)) need_flags=0; //int shift = (source[i] >> 19) & 1; //int lm = (source[i] >> 10) & 1; diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index 65bb3f10..60f005fd 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -439,6 +439,7 @@ unsigned int next_interupt; int new_dynarec_did_compile; int cycle_multiplier; int cycle_multiplier_override; +int new_dynarec_hacks_pergame; int new_dynarec_hacks; void *psxH_ptr; void *zeromem_ptr; diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index 4e09592d..c0ef579e 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -216,8 +216,11 @@ struct link_entry #endif int new_dynarec_hacks; + int new_dynarec_hacks_pergame; int new_dynarec_did_compile; + #define HACK_ENABLED(x) ((new_dynarec_hacks | new_dynarec_hacks_pergame) & (x)) + extern int cycle_count; // ... until end of the timeslice, counts -N -> 0 extern int last_count; // last absolute target, often = next_interupt extern int pcaddr; @@ -2932,7 +2935,7 @@ void store_assemble(int i,struct regstat *i_regs) add_stub_r(type,jaddr,out,i,addr,i_regs,ccadj[i],reglist); jaddr=0; } - if(!(i_regs->waswritten&(1<waswritten&(1<waswritten&(1<waswritten&(1<regmap,INVCP); @@ -3407,7 +3410,7 @@ static void c2ls_assemble(int i,struct regstat *i_regs) if(jaddr2) add_stub_r(type,jaddr2,out,i,ar,i_regs,ccadj[i],reglist); if(opcode[i]==0x3a) // SWC2 - if(!(i_regs->waswritten&(1<waswritten&(1<regmap,INVCP); assert(ir>=0); @@ -5794,7 +5797,7 @@ void unneeded_registers(int istart,int iend,int r) uint64_t u,gte_u,b,gte_b; uint64_t temp_u,temp_gte_u=0; uint64_t gte_u_unknown=0; - if(new_dynarec_hacks&NDHACK_GTE_UNNEEDED) + if (HACK_ENABLED(NDHACK_GTE_UNNEEDED)) gte_u_unknown=~0ll; if(iend==slen-1) { u=1; @@ -6634,7 +6637,7 @@ void new_dynarec_cleanup(void) static u_int *get_source_start(u_int addr, u_int *limit) { - if (!(new_dynarec_hacks & NDHACK_OVERRIDE_CYCLE_M)) + if (!HACK_ENABLED(NDHACK_OVERRIDE_CYCLE_M)) cycle_multiplier_override = 0; if (addr < 0x00200000 || @@ -6650,7 +6653,7 @@ static u_int *get_source_start(u_int addr, u_int *limit) { // BIOS. The multiplier should be much higher as it's uncached 8bit mem, // but timings in PCSX are too tied to the interpreter's BIAS - if (!(new_dynarec_hacks & NDHACK_OVERRIDE_CYCLE_M)) + if (!HACK_ENABLED(NDHACK_OVERRIDE_CYCLE_M)) cycle_multiplier_override = 200; *limit = (addr & 0xfff00000) | 0x80000; diff --git a/libpcsxcore/new_dynarec/new_dynarec.h b/libpcsxcore/new_dynarec/new_dynarec.h index bab33793..bfb48838 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.h +++ b/libpcsxcore/new_dynarec/new_dynarec.h @@ -12,6 +12,7 @@ extern int cycle_multiplier_override; #define NDHACK_GTE_NO_FLAGS (1<<2) #define NDHACK_OVERRIDE_CYCLE_M (1<<3) extern int new_dynarec_hacks; +extern int new_dynarec_hacks_pergame; void new_dynarec_init(void); void new_dynarec_cleanup(void);