Skip to content

Commit

Permalink
snes: fix crash with rewind enabled in tales of phantasia. the proble…
Browse files Browse the repository at this point in the history
…m seems to be that during runtosave(), the smp hits a wait opcode (0xff), which it can't get out of. with this fix, the emulator no longer crashes, but the emulated game does crash. more research is needed.
  • Loading branch information
nattthebear committed Dec 2, 2012
1 parent 20d04f9 commit 451f786
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
38 changes: 19 additions & 19 deletions BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,26 +200,26 @@ public enum SNES_REG : int
OBSEL_NAMEBASE = 50,
OBSEL_NAMESEL = 51,
OBSEL_SIZE = 52,
//$2131 CGADSUB
CGADSUB_MODE = 60,
CGADSUB_HALF = 61,
CGADSUB_BG4 = 62,
CGADSUB_BG3 = 63,
CGADSUB_BG2 = 64,
CGADSUB_BG1 = 65,
CGADSUB_OBJ = 66,
//$2131 CGADSUB
CGADSUB_MODE = 60,
CGADSUB_HALF = 61,
CGADSUB_BG4 = 62,
CGADSUB_BG3 = 63,
CGADSUB_BG2 = 64,
CGADSUB_BG1 = 65,
CGADSUB_OBJ = 66,
CGADSUB_BACKDROP = 67,
//$212C TM
TM_BG1 =70,
TM_BG2 =71,
TM_BG3 =72,
TM_BG4 =73,
TM_OBJ =74,
//$212D TM
TS_BG1 =80,
TS_BG2 =81,
TS_BG3 =82,
TS_BG4 =83,
//$212C TM
TM_BG1 =70,
TM_BG2 =71,
TM_BG3 =72,
TM_BG4 =73,
TM_OBJ =74,
//$212D TM
TS_BG1 =80,
TS_BG2 =81,
TS_BG3 =82,
TS_BG4 =83,
TS_OBJ =84
}

Expand Down
Binary file modified BizHawk.MultiClient/output/dll/libsneshawk.dll
Binary file not shown.
6 changes: 4 additions & 2 deletions libsnes/bizwinmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ cd bsnes
mkdir obj
mkdir out
export BIZWINCFLAGS="-I. -O3 -masm=intel -DLIBCO_IMPORT -DLIBCO_MSVC -static-libgcc -static-libstdc++"
#for gdb debugging
#export BIZWINCFLAGS="-I. -O0 -g -masm=intel -DLIBCO_IMPORT -DLIBCO_MSVC -static-libgcc -static-libstdc++"
export TARGET_LIBSNES_LIBDEPS="-L ../libco_msvc_win32/release/ -llibco_msvc_win32 -static-libgcc -static-libstdc++"
profile=compatibility platform=win target=libsnes make -e -j
profile=compatibility platform=win target=libsnes make -e -j 4
cd ..
cp bsnes/out/snes.dll ../BizHawk.MultiClient/output/dll/libsneshawk.dll
cp bsnes/out/snes.dll ../BizHawk.MultiClient/output/dll/libsneshawk.dll
4 changes: 4 additions & 0 deletions libsnes/bsnes/snes/smp/core/opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ void SMPcore::op_stw_dp() {

void SMPcore::op_wait() {
while(true) {
if(scheduler.sync == Scheduler::SynchronizeMode::All) {
regs.pc--; // repeat this opcode on next run
scheduler.exit(Scheduler::ExitReason::SynchronizeEvent);
}
op_io();
op_io();
}
Expand Down

0 comments on commit 451f786

Please sign in to comment.