From 58b75cc51a7900b53117be7697d2aefeadeb7f66 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 25 Jul 2008 19:46:56 +0000 Subject: [PATCH] fix for load-state-after-load crash git-svn-id: file:///home/notaz/opt/svn/PicoDrive@563 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/Area.c | 6 +++--- Pico/cd/Pico.s | 4 +++- platform/base_readme.txt | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) 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 -- 2.39.5