X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fnew_dynarec%2Fnew_dynarec.c;h=f6ea2996c0dcd7f7bf9f62b17a145dd4bd89608b;hp=7e9fa1e1c9d4ddac891cbd9425113db370a0676e;hb=26bd3dadfd724f73242ab317fce3a50af8135db6;hpb=fe807a8ab74893785612242a54a488d2706dbbd4 diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index 7e9fa1e1..f6ea2996 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -225,6 +225,7 @@ static struct decoded_insn static void *copy; static int expirep; static u_int stop_after_jal; + static u_int f1_hack; // 0 - off, ~0 - capture address, else addr #ifndef RAM_FIXED static uintptr_t ram_offset; #else @@ -464,13 +465,13 @@ static void do_clear_cache(void) #define NO_CYCLE_PENALTY_THR 12 -int cycle_multiplier; // 100 for 1.0 +int cycle_multiplier = CYCLE_MULT_DEFAULT; // 100 for 1.0 int cycle_multiplier_override; int cycle_multiplier_old; static int CLOCK_ADJUST(int x) { - int m = cycle_multiplier_override + int m = cycle_multiplier_override && cycle_multiplier == CYCLE_MULT_DEFAULT ? cycle_multiplier_override : cycle_multiplier; int s=(x>>31)|1; return (x * m + s * 50) / 100; @@ -6700,6 +6701,7 @@ void new_dynarec_clear_full(void) literalcount=0; stop_after_jal=0; inv_code_start=inv_code_end=~0; + f1_hack=0; // TLB for(n=0;n<4096;n++) ll_clear(jump_in+n); for(n=0;n<4096;n++) ll_clear(jump_out+n); @@ -6945,6 +6947,27 @@ int new_recompile_block(u_int addr) ll_add_flags(jump_in+page,start,state_rflags,(void *)beginning); return 0; } + else if (f1_hack == ~0u || (f1_hack != 0 && start == f1_hack)) { + void *beginning = start_block(); + u_int page = get_page(start); + emit_readword(&psxRegs.GPR.n.sp, 0); + emit_readptr(&mem_rtab, 1); + emit_shrimm(0, 12, 2); + emit_readptr_dualindexedx_ptrlen(1, 2, 1); + emit_addimm(0, 0x18, 0); + emit_adds_ptr(1, 1, 1); + emit_ldr_dualindexed(1, 0, 0); + emit_writeword(0, &psxRegs.GPR.r[26]); // lw k0, 0x18(sp) + emit_far_call(get_addr_ht); + emit_jmpreg(0); // jr k0 + literal_pool(0); + end_block(beginning); + + ll_add_flags(jump_in + page, start, state_rflags, beginning); + SysPrintf("F1 hack to %08x\n", start); + f1_hack = start; + return 0; + } source = get_source_start(start, &pagelimit); if (source == NULL) { @@ -7465,6 +7488,23 @@ int new_recompile_block(u_int addr) } assert(slen>0); + /* spacial hack(s) */ + if (i > 10 && source[i-1] == 0 && source[i-2] == 0x03e00008 + && source[i-4] == 0x8fbf0018 && source[i-6] == 0x00c0f809 + && dops[i-7].itype == STORE) + { + i = i-8; + if (dops[i].itype == IMM16) + i--; + // swl r2, 15(r6); swr r2, 12(r6); sw r6, *; jalr r6 + if (dops[i].itype == STORELR && dops[i].rs1 == 6 + && dops[i-1].itype == STORELR && dops[i-1].rs1 == 6) + { + SysPrintf("F1 hack from %08x\n", start); + f1_hack = ~0u; + } + } + /* Pass 2 - Register dependencies and branch targets */ unneeded_registers(0,slen-1,0);