From: notaz Date: Fri, 25 Jul 2008 19:46:56 +0000 (+0000) Subject: fix for load-state-after-load crash X-Git-Tag: v1.85~401 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58b75cc51a7900b53117be7697d2aefeadeb7f66;p=picodrive.git fix for load-state-after-load crash git-svn-id: file:///home/notaz/opt/svn/PicoDrive@563 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/Pico/Area.c b/Pico/Area.c index 49c2afcd..35f28c28 100644 --- a/Pico/Area.c +++ b/Pico/Area.c @@ -62,7 +62,7 @@ PICO_INTERNAL void PicoAreaPackCpu(unsigned char *cpu, int is_sub) memcpy(cpu,m68ki_cpu_p->dar,0x40); pc=m68ki_cpu_p->pc; *(unsigned int *)(cpu+0x44)=m68k_get_reg(NULL, M68K_REG_SR); - *(unsigned int *)(cpu+0x48)=m68ki_cpu_p->sp[0]; + *(unsigned int *)(cpu+0x48)=m68ki_cpu_p->sp[m68ki_cpu_p->s_flag^SFLAG_SET]; cpu[0x4c] = CPU_INT_LEVEL>>8; cpu[0x4d] = CPU_STOPPED; m68k_set_context(oldcontext); @@ -95,10 +95,10 @@ PICO_INTERNAL void PicoAreaUnpackCpu(unsigned char *cpu, int is_sub) #elif defined(EMU_M68K) void *oldcontext = m68ki_cpu_p; m68k_set_context(is_sub ? &PicoCpuMS68k : &PicoCpuMM68k); + m68k_set_reg(M68K_REG_SR, *(unsigned int *)(cpu+0x44)); memcpy(m68ki_cpu_p->dar,cpu,0x40); m68ki_cpu_p->pc=*(unsigned int *)(cpu+0x40); - m68k_set_reg(M68K_REG_SR, *(unsigned int *)(cpu+0x44)); - m68ki_cpu_p->sp[0]=*(unsigned int *)(cpu+0x48); + m68ki_cpu_p->sp[m68ki_cpu_p->s_flag^SFLAG_SET]=*(unsigned int *)(cpu+0x48); CPU_INT_LEVEL = cpu[0x4c] << 8; CPU_STOPPED = cpu[0x4d]; m68k_set_context(oldcontext); diff --git a/Pico/cd/Pico.s b/Pico/cd/Pico.s index 6cd140a1..a51590f5 100644 --- a/Pico/cd/Pico.s +++ b/Pico/cd/Pico.s @@ -49,9 +49,11 @@ SekRunPS: str r2, [r8] str r3, [r10] + ldr r6, =CycloneJumpTab ldr r1, =SekCycleCnt ldr r0, =((488<<16)-PS_STEP_M68K) - ldr r6, =CycloneJumpTab + str r6, [r7,#0x54] + str r6, [lr,#0x54] @ make copies to avoid literal pools @ schedule m68k for the first time.. ldr r1, [r1] diff --git a/platform/base_readme.txt b/platform/base_readme.txt index 0ba3a0fb..3cb98b05 100644 --- a/platform/base_readme.txt +++ b/platform/base_readme.txt @@ -648,6 +648,7 @@ Changelog 1.51a * Fixed a sync problem between main and sub 68k. Should fix the hanging problem for some games. + * ARM: fixed a crash when CD savestate is loaded just after loading ROM. 1.51 * Improved bin_to_cso_mp3 tool, it should no longer complain about