1 diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c
2 index f1005db..ebd1d4f 100644
3 --- a/libpcsxcore/new_dynarec/new_dynarec.c
4 +++ b/libpcsxcore/new_dynarec/new_dynarec.c
5 @@ -235,7 +235,7 @@ static struct decoded_insn
6 int new_dynarec_hacks_old;
7 int new_dynarec_did_compile;
9 - #define HACK_ENABLED(x) ((new_dynarec_hacks | new_dynarec_hacks_pergame) & (x))
10 + #define HACK_ENABLED(x) ((NDHACK_NO_STALLS) & (x))
12 extern int cycle_count; // ... until end of the timeslice, counts -N -> 0
13 extern int last_count; // last absolute target, often = next_interupt
14 @@ -471,6 +471,7 @@ int cycle_multiplier_old;
16 static int CLOCK_ADJUST(int x)
19 int m = cycle_multiplier_override && cycle_multiplier == CYCLE_MULT_DEFAULT
20 ? cycle_multiplier_override : cycle_multiplier;
22 @@ -522,6 +523,9 @@ static int doesnt_expire_soon(void *tcaddr)
23 // This is called from the recompiled JR/JALR instructions
24 void noinline *get_addr(u_int vaddr)
27 +printf("get_addr %08x, pc=%08x\n", vaddr, psxRegs.pc);
29 u_int page=get_page(vaddr);
30 u_int vpage=get_vpage(vaddr);
31 struct ll_entry *head;
32 @@ -6248,7 +6252,7 @@ void unneeded_registers(int istart,int iend,int r)
33 // R0 is always unneeded
37 + unneeded_reg[i]=1;//u;
38 gte_unneeded[i]=gte_u;
40 printf("ur (%d,%d) %x: ",istart,iend,start+i*4);
41 @@ -8794,6 +8798,7 @@ int new_recompile_block(u_int addr)
43 // This allocates registers (if possible) one instruction prior
44 // to use, which can avoid a load-use penalty on certain CPUs.
48 if (!i || !dops[i-1].is_jump)
49 @@ -8950,6 +8955,7 @@ int new_recompile_block(u_int addr)
55 /* Pass 6 - Optimize clean/dirty state */
56 clean_registers(0,slen-1,1);
57 @@ -9204,6 +9210,11 @@ int new_recompile_block(u_int addr)
58 load_regs(regs[i].regmap_entry,regs[i].regmap,INVCP,INVCP);
60 ds = assemble(i, ®s[i], ccadj[i]);
62 + // write-out non-consts, consts are likely different because of get_final_value()
63 + if (!dops[i].is_jump)
64 + wb_dirtys(regs[i].regmap,regs[i].dirty&~regs[i].loadedconst);
69 @@ -9439,6 +9450,10 @@ int new_recompile_block(u_int addr)
75 +printf("new_recompile_block done\n");
80 diff --git a/libpcsxcore/new_dynarec/pcsxmem.c b/libpcsxcore/new_dynarec/pcsxmem.c
81 index bb471b6..8f68a3b 100644
82 --- a/libpcsxcore/new_dynarec/pcsxmem.c
83 +++ b/libpcsxcore/new_dynarec/pcsxmem.c
84 @@ -272,6 +272,8 @@ static void write_biu(u32 value)
85 if (address != 0xfffe0130)
88 +extern u32 handler_cycle;
89 +handler_cycle = psxRegs.cycle;
91 case 0x800: case 0x804:
93 diff --git a/libpcsxcore/psxcounters.c b/libpcsxcore/psxcounters.c
94 index b2cc07b..f916580 100644
95 --- a/libpcsxcore/psxcounters.c
96 +++ b/libpcsxcore/psxcounters.c
97 @@ -378,9 +378,12 @@ void psxRcntUpdate()
99 /******************************************************************************/
101 +extern u32 handler_cycle;
103 void psxRcntWcount( u32 index, u32 value )
105 verboseLog( 2, "[RCNT %i] wcount: %x\n", index, value );
106 +handler_cycle = psxRegs.cycle;
108 _psxRcntWcount( index, value );
110 @@ -389,6 +392,7 @@ void psxRcntWcount( u32 index, u32 value )
111 void psxRcntWmode( u32 index, u32 value )
113 verboseLog( 1, "[RCNT %i] wmode: %x\n", index, value );
114 +handler_cycle = psxRegs.cycle;
116 _psxRcntWmode( index, value );
117 _psxRcntWcount( index, 0 );
118 @@ -400,6 +404,7 @@ void psxRcntWmode( u32 index, u32 value )
119 void psxRcntWtarget( u32 index, u32 value )
121 verboseLog( 1, "[RCNT %i] wtarget: %x\n", index, value );
122 +handler_cycle = psxRegs.cycle;
124 rcnts[index].target = value;
126 @@ -412,6 +417,7 @@ void psxRcntWtarget( u32 index, u32 value )
127 u32 psxRcntRcount( u32 index )
130 +handler_cycle = psxRegs.cycle;
132 count = _psxRcntRcount( index );