1diff --git a/unix/unix.cpp b/unix/unix.cpp 2index cc82fa5..191760e 100644 3--- a/unix/unix.cpp 4+++ b/unix/unix.cpp 5@@ -237,6 +237,7 @@ 6 #include "debug.h" 7 #endif 8 #include "statemanager.h" 9+#include "../alttp/alttp_public.h" 10 11 #ifdef NETPLAY_SUPPORT 12 #ifdef _DEBUG 13@@ -353,6 +354,16 @@ static void InitJoysticks (void); 14 static void ReadJoysticks (void); 15 #endif 16 17+static uint8_t * alttp_base(uint32_t addr) { 18+ return S9xGetMemPointer(addr); 19+} 20+static int alttp_save(const char * filename) { 21+ return S9xFreezeGame(filename); 22+} 23+static int alttp_load(const char * filename) { 24+ return S9xUnfreezeGame(filename); 25+} 26+static struct ap_snes9x alttp; 27 28 void _splitpath (const char *path, char *drive, char *dir, char *fname, char *ext) 29 { 30@@ -1889,6 +1900,12 @@ int main (int argc, char **argv) 31 bool8 NP_Activated = Settings.NetPlay; 32 #endif 33 34+ alttp.base = alttp_base; 35+ alttp.save = alttp_save; 36+ alttp.load = alttp_load; 37+ alttp.info_string_ptr = &GFX.InfoString; 38+ ap_init(&alttp); 39+ 40 while (1) 41 { 42 #ifdef NETPLAY_SUPPORT 43@@ -1933,8 +1950,13 @@ int main (int argc, char **argv) 44 rewinding = stateMan.pop(); 45 else if(IPPU.TotalEmulatedFrames % unixSettings.rewindGranularity == 0) 46 stateMan.push(); 47- 48+ 49+ uint16 jpb = MovieGetJoypad(0); 50+ uint16 old_jpb = jpb; 51+ ap_tick(IPPU.TotalEmulatedFrames, &jpb); 52+ MovieSetJoypad(0, jpb); 53 S9xMainLoop(); 54+ MovieSetJoypad(0, old_jpb); 55 } 56 57 #ifdef NETPLAY_SUPPORT 58diff --git a/unix/Makefile.in b/unix/Makefile.in 59index 7d321e8..1247df1 100644 60--- a/unix/Makefile.in 61+++ b/unix/Makefile.in 62@@ -51,8 +51,12 @@ configure: configure.ac 63 @echo "configure is older than in-file. Run autoconf or touch configure." 64 exit 1 65 66-snes9x: $(OBJECTS) 67- $(CCC) $(LDFLAGS) $(INCLUDES) -o $@ $(OBJECTS) -lm @S9XLIBS@ 68+../alttp/build/libalttp.a: $(wildcard ../alttp/*) 69+ $(MAKE) -C ../alttp/ 70+ 71+snes9x: $(OBJECTS) ../alttp/build/libalttp.a 72+ 73+ $(CCC) $(LDFLAGS) $(INCLUDES) -o $@ $^ $(OBJECTS) -lm @S9XLIBS@ 74 75 ../jma/s9x-jma.o: ../jma/s9x-jma.cpp 76 $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@