Skip to content

Commit b3711df

Browse files
committed
snes9x2010 Lagfix port and comment changes.
1 parent c66c309 commit b3711df

File tree

16 files changed

+1106
-1002
lines changed

16 files changed

+1106
-1002
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ DEBUG = 0
22
PERF_TEST = 0
33
LOAD_FROM_MEMORY_TEST = 1
44
USE_BLARGG_APU = 0
5+
LAGFIX = 1
56

67
ifeq ($(platform),)
78
platform = unix
@@ -264,6 +265,10 @@ ifeq ($(PERF_TEST),1)
264265
FLAGS += -DPERF_TEST
265266
endif
266267

268+
ifeq ($(LAGFIX),1)
269+
FLAGS += -DLAGFIX
270+
endif
271+
267272
ifeq ($(platform), psp1)
268273
INCFLAGS += -I$(shell psp-config --pspsdk-path)/include
269274
endif
@@ -283,7 +288,7 @@ ifneq (,$(findstring msvc,$(platform)))
283288
LD = link.exe
284289
else
285290
OBJOUT = -o
286-
LINKOUT = -o
291+
LINKOUT = -o
287292
LD = $(CC)
288293
endif
289294

libretro.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void retro_init(void)
305305
else
306306
log_cb = NULL;
307307

308-
// State that the core supports achievements.
308+
/* State that the core supports achievements. */
309309
bool achievements = true;
310310
environ_cb(RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS, &achievements);
311311

@@ -319,7 +319,7 @@ void retro_init(void)
319319
S9xInitDisplay();
320320
S9xInitGFX();
321321
#ifdef USE_BLARGG_APU
322-
S9xInitSound(1000, 0); //just give it a 1 second buffer
322+
S9xInitSound(1000, 0); /* just give it a 1 second buffer */
323323
S9xSetSamplesAvailableCallback(S9xAudioCallback);
324324
#else
325325
S9xInitSound();
@@ -431,7 +431,7 @@ void retro_run(void)
431431

432432
#ifdef PSP
433433
static unsigned int __attribute__((aligned(16))) d_list[32];
434-
void* const texture_vram_p = (void*)(0x44200000 - (512 * 512)); // max VRAM address - frame size
434+
void* const texture_vram_p = (void*)(0x44200000 - (512 * 512)); /* max VRAM address - frame size */
435435
sceKernelDcacheWritebackRange(GFX.Screen, GFX.Pitch * IPPU.RenderedScreenHeight);
436436
sceGuStart(GU_DIRECT, d_list);
437437
sceGuCopyImage(GU_PSM_4444, 0, 0, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, GFX.Pitch >> 1, GFX.Screen, 0, 0, 512, texture_vram_p);
@@ -538,6 +538,12 @@ size_t retro_serialize_size(void)
538538
bool retro_serialize(void* data, size_t size)
539539
{
540540
int32_t i;
541+
#ifdef LAGFIX
542+
S9xPackStatus();
543+
#ifndef USE_BLARGG_APU
544+
S9xAPUPackStatus();
545+
#endif
546+
#endif
541547
S9xUpdateRTC();
542548
S9xSRTCPreSaveState();
543549
uint8_t* buffer = data;
@@ -667,19 +673,19 @@ void retro_cheat_set(unsigned index, bool enabled, const char* code)
667673
uint8_t val;
668674

669675
bool sram;
670-
uint8_t bytes[3];//used only by GoldFinger, ignored for now
676+
uint8_t bytes[3];/* used only by GoldFinger, ignored for now */
671677

672678
if (S9xGameGenieToRaw(code, &address, &val) && S9xProActionReplayToRaw(code, &address, &val) && S9xGoldFingerToRaw(code, &address, &sram, &val, bytes))
673-
return; // bad code, ignore
679+
return; /* bad code, ignore */
674680
if (index > Cheat.num_cheats)
675-
return; // cheat added in weird order, ignore
681+
return; /* cheat added in weird order, ignore */
676682
if (index == Cheat.num_cheats)
677683
Cheat.num_cheats++;
678684

679685
Cheat.c[index].address = address;
680686
Cheat.c[index].byte = val;
681687
Cheat.c[index].enabled = enabled;
682-
Cheat.c[index].saved = false; // it'll be saved next time cheats run anyways
688+
Cheat.c[index].saved = false; /* it'll be saved next time cheats run anyways */
683689

684690
Settings.ApplyCheats = true;
685691
S9xApplyCheats();

0 commit comments

Comments
 (0)