diff --git a/Makefile.libretro b/Makefile.libretro index 86563b0..2387bed 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -752,8 +752,8 @@ else WARNING_DEFINES = -Wno-write-strings endif -CFLAGS += $(fpic) $(WARNING_DEFINES) $(DEFINES) $(ENDIANNESS_DEFINES) -LDFLAGS += $(LIBM) +CFLAGS += $(fpic) $(WARNING_DEFINES) $(DEFINES) $(ENDIANNESS_DEFINES) -Werror=implicit-function-declaration +LDFLAGS += $(LIBM) -Werror=implicit-function-declaration ifeq ($(platform), psp1) INCFLAGS += -I$(shell psp-config --pspsdk-path)/include diff --git a/src/cart.h b/src/cart.h index 4573403..cd05d4b 100644 --- a/src/cart.h +++ b/src/cart.h @@ -104,4 +104,7 @@ void FCEU_OpenGenie(void); void FCEU_CloseGenie(void); void FCEU_KillGenie(void); +extern CartInfo iNESCart; +extern CartInfo UNIFCart; + #endif diff --git a/src/drivers/libretro/libretro.c b/src/drivers/libretro/libretro.c index 39263fc..7ff7dcb 100644 --- a/src/drivers/libretro/libretro.c +++ b/src/drivers/libretro/libretro.c @@ -67,8 +67,6 @@ void linearFree(void* mem); RETRO_HW_RENDER_INTEFACE_GSKIT_PS2 *ps2 = NULL; #endif -extern void FCEU_ZapperSetTolerance(int t); - static retro_video_refresh_t video_cb = NULL; static retro_input_poll_t poll_cb = NULL; static retro_input_state_t input_cb = NULL; @@ -95,7 +93,7 @@ static int aspect_ratio_par; #define MAX_BUTTONS 8 #define TURBO_BUTTONS 2 -unsigned char turbo_button_toggle[MAX_PLAYERS][TURBO_BUTTONS] = { {0} }; +unsigned turbo_button_toggle[MAX_PLAYERS][TURBO_BUTTONS] = { {0} }; typedef struct { @@ -145,27 +143,11 @@ static bool libretro_supports_bitmasks = false; const size_t PPU_BIT = 1ULL << 31ULL; -extern uint8 NTARAM[0x800], PALRAM[0x20], SPRAM[0x100], PPU[4]; - -/* overclock the console by adding dummy scanlines to PPU loop - * disables DMC DMA and WaveHi filling for these dummies - * doesn't work with new PPU */ -unsigned overclock_enabled = -1; -unsigned overclocked = 0; -unsigned skip_7bit_overclocking = 1; /* 7-bit samples have priority over overclocking */ -unsigned totalscanlines = 0; -unsigned normal_scanlines = 240; -unsigned extrascanlines = 0; -unsigned vblankscanlines = 0; -unsigned dendy = 0; - static unsigned systemRegion = 0; static unsigned opt_region = 0; static unsigned opt_showAdvSoundOptions = 0; static unsigned opt_showAdvSystemOptions = 0; -int FCEUnetplay; - #if defined(PSP) || defined(PS2) static __attribute__((aligned(16))) uint16_t retro_palette[256]; #else @@ -181,28 +163,14 @@ static uint16_t* fceu_video_out; static unsigned sndsamplerate; static unsigned sndquality; static unsigned sndvolume; -unsigned swapDuty; static int32_t *sound = 0; static uint32_t Dummy = 0; static uint32_t current_palette = 0; static unsigned serialize_size; -int PPUViewScanline=0; -int PPUViewer=0; - -/* extern forward decls.*/ -extern FCEUGI *GameInfo; -extern uint8 *XBuf; -extern CartInfo iNESCart; -extern CartInfo UNIFCart; -extern int show_crosshair; -extern int option_ramstate; - /* emulator-specific callback functions */ -void UpdatePPUView(int refreshchr) { } - const char * GetKeyboard(void) { return ""; @@ -305,13 +273,7 @@ FILE *FCEUD_UTF8fopen(const char *n, const char *m) } /*palette for FCEU*/ -#define PAL_TOTAL 16 /* total no. of palettes in palettes[] */ -#define PAL_DEFAULT (PAL_TOTAL + 1) -#define PAL_RAW (PAL_TOTAL + 2) -#define PAL_CUSTOM (PAL_TOTAL + 3) - static int external_palette_exist = 0; -extern int ipalette; /* table for currently loaded palette */ static uint8_t base_palette[192]; @@ -613,6 +575,11 @@ struct st_palettes palettes[] = { } }; +#define PAL_TOTAL (sizeof(palettes) / sizeof(palettes[0])) /* total palettes in table */ +#define PAL_DEFAULT (PAL_TOTAL + 1) +#define PAL_RAW (PAL_TOTAL + 2) +#define PAL_CUSTOM (PAL_TOTAL + 3) + #ifdef HAVE_NTSC_FILTER /* ntsc */ #include "nes_ntsc.h" @@ -988,7 +955,7 @@ void retro_get_system_av_info(struct retro_system_av_info *info) info->geometry.max_height = NES_HEIGHT; info->geometry.aspect_ratio = get_aspect_ratio(width, height); info->timing.sample_rate = (float)sndsamplerate; - if (FSettings.PAL || dendy) + if (FSettings.PAL || FSettings.dendy) info->timing.fps = 838977920.0/16777215.0; else info->timing.fps = 1008307711.0/16777215.0; @@ -1093,7 +1060,7 @@ static void FCEUD_RegionOverride(unsigned region) break; } - dendy = d; + FSettings.dendy = d; FCEUI_SetVidSystem(pal); ResetPalette(); } @@ -1149,11 +1116,11 @@ static void check_variables(bool startup) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { if (!strcmp(var.value, "random")) - option_ramstate = 2; + FSettings.ramstate = 2; else if (!strcmp(var.value, "fill $00")) - option_ramstate = 1; + FSettings.ramstate = 1; else - option_ramstate = 0; + FSettings.ramstate = 0; } #ifdef HAVE_NTSC_FILTER @@ -1192,38 +1159,18 @@ static void check_variables(bool startup) current_palette = PAL_RAW; else if (!strcmp(var.value, "custom")) current_palette = PAL_CUSTOM; - else if (!strcmp(var.value, "asqrealc")) - current_palette = 0; - else if (!strcmp(var.value, "nintendo-vc")) - current_palette = 1; - else if (!strcmp(var.value, "rgb")) - current_palette = 2; - else if (!strcmp(var.value, "yuv-v3")) - current_palette = 3; - else if (!strcmp(var.value, "unsaturated-final")) - current_palette = 4; - else if (!strcmp(var.value, "sony-cxa2025as-us")) - current_palette = 5; - else if (!strcmp(var.value, "pal")) - current_palette = 6; - else if (!strcmp(var.value, "bmf-final2")) - current_palette = 7; - else if (!strcmp(var.value, "bmf-final3")) - current_palette = 8; - else if (!strcmp(var.value, "smooth-fbx")) - current_palette = 9; - else if (!strcmp(var.value, "composite-direct-fbx")) - current_palette = 10; - else if (!strcmp(var.value, "pvm-style-d93-fbx")) - current_palette = 11; - else if (!strcmp(var.value, "ntsc-hardware-fbx")) - current_palette = 12; - else if (!strcmp(var.value, "nes-classic-fbx-fs")) - current_palette = 13; - else if (!strcmp(var.value, "nescap")) - current_palette = 14; - else if (!strcmp(var.value, "wavebeam")) - current_palette = 15; + else + { + unsigned i; + for (i = 0; i < PAL_TOTAL; i++) + { + if (!strcmp(var.value, palettes[i].name)) + { + current_palette = i; + break; + } + } + } if (current_palette != orig_value) { @@ -1254,33 +1201,33 @@ static void check_variables(bool startup) bool do_reinit = false; if (!strcmp(var.value, "disabled") - && overclock_enabled != 0) + && ppu.overclock_enabled != 0) { - skip_7bit_overclocking = 1; - extrascanlines = 0; - vblankscanlines = 0; - overclock_enabled = 0; + ppu.skip_7bit_overclocking = 1; + ppu.extrascanlines = 0; + ppu.vblankscanlines = 0; + ppu.overclock_enabled = 0; do_reinit = true; } else if (!strcmp(var.value, "2x-Postrender")) { - skip_7bit_overclocking = 1; - extrascanlines = 266; - vblankscanlines = 0; - overclock_enabled = 1; + ppu.skip_7bit_overclocking = 1; + ppu.extrascanlines = 266; + ppu.vblankscanlines = 0; + ppu.overclock_enabled = 1; do_reinit = true; } else if (!strcmp(var.value, "2x-VBlank")) { - skip_7bit_overclocking = 1; - extrascanlines = 0; - vblankscanlines = 266; - overclock_enabled = 1; + ppu.skip_7bit_overclocking = 1; + ppu.extrascanlines = 0; + ppu.vblankscanlines = 266; + ppu.overclock_enabled = 1; do_reinit = true; } - normal_scanlines = dendy ? 290 : 240; - totalscanlines = normal_scanlines + (overclock_enabled ? extrascanlines : 0); + ppu.normal_scanlines = FSettings.dendy ? SCANLINES_DENDY : SCANLINES_NORMAL; + ppu.totalscanlines = ppu.normal_scanlines + (ppu.overclock_enabled ? ppu.extrascanlines : 0); if (do_reinit && startup) { @@ -1312,8 +1259,10 @@ static void check_variables(bool startup) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { - if (!strcmp(var.value, "enabled")) show_crosshair = 1; - else if (!strcmp(var.value, "disabled")) show_crosshair = 0; + if (!strcmp(var.value, "enabled")) + FSettings.show_crosshair = 1; + else if (!strcmp(var.value, "disabled")) + FSettings.show_crosshair = 0; } #ifdef PSP @@ -1451,8 +1400,8 @@ static void check_variables(bool startup) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { bool newval = (!strcmp(var.value, "enabled")); - if (newval != swapDuty) - swapDuty = newval; + if (newval != FSettings.swapDuty) + FSettings.swapDuty = newval; } var.key = key; @@ -2428,8 +2377,6 @@ bool retro_load_game(const struct retro_game_info *game) #endif sndquality = 0; sndvolume = 150; - swapDuty = 0; - dendy = 0; opt_region = 0; /* Wii: initialize this or else last variable is passed through @@ -2489,7 +2436,7 @@ bool retro_load_game(const struct retro_game_info *game) FCEU_printf(" Loading custom palette: %s%cnes.pal\n", dir, slash); /* Save region and dendy mode for region-auto detect */ - systemRegion = (dendy << 1) | (retro_get_region() & 1); + systemRegion = (FSettings.dendy << 1) | (retro_get_region() & 1); current_palette = 0; diff --git a/src/fceu.c b/src/fceu.c index 0d471b9..564b67f 100644 --- a/src/fceu.c +++ b/src/fceu.c @@ -339,6 +339,14 @@ int FCEUI_Initialize(void) { FSettings.UsrLastSLine[0] = 231; FSettings.UsrLastSLine[1] = 239; FSettings.SoundVolume = 100; + FSettings.dendy = 0; + FSettings.swapDuty = 0; + ppu.overclock_enabled = 0; + ppu.skip_7bit_overclocking = 1; + ppu.totalscanlines = 0; + ppu.normal_scanlines = SCANLINES_NORMAL; + ppu.extrascanlines = 0; + ppu.vblankscanlines = 0; FCEUPPU_Init(); X6502_Init(); return 1; @@ -379,8 +387,6 @@ void ResetNES(void) X6502_Reset(); } -int option_ramstate = 0; - void FCEU_MemoryRand(uint8 *ptr, uint32 size) { int x = 0; @@ -395,7 +401,7 @@ void FCEU_MemoryRand(uint8 *ptr, uint32 size) /* 1942 SCORE/HISCORE is screwed... */ #endif uint8_t v = 0; - switch (option_ramstate) + switch (FSettings.ramstate) { case 0: v = 0xff; break; case 1: v = 0x00; break; @@ -464,7 +470,7 @@ void FCEU_ResetVidSys(void) else if (GameInfo->vidsys == GIV_PAL) { w = 1; - dendy = 0; + FSettings.dendy = 0; } else w = FSettings.PAL; @@ -472,12 +478,12 @@ void FCEU_ResetVidSys(void) PAL = w ? 1 : 0; if (PAL) - dendy = 0; + FSettings.dendy = 0; - normal_scanlines = dendy ? 290 : 240; - totalscanlines = normal_scanlines + (overclock_enabled ? extrascanlines : 0); + ppu.normal_scanlines = FSettings.dendy ? SCANLINES_DENDY : SCANLINES_NORMAL; + ppu.totalscanlines = ppu.normal_scanlines + (ppu.overclock_enabled ? ppu.extrascanlines : 0); - FCEUPPU_SetVideoSystem(w || dendy); + FCEUPPU_SetVideoSystem(w || FSettings.dendy); SetSoundVariables(); } @@ -515,7 +521,7 @@ void FCEUI_SetRenderedLines(int ntscf, int ntscl, int palf, int pall) FSettings.UsrLastSLine[0] = ntscl; FSettings.UsrFirstSLine[1] = palf; FSettings.UsrLastSLine[1] = pall; - if (PAL || dendy) + if (PAL || FSettings.dendy) { FSettings.FirstSLine = FSettings.UsrFirstSLine[1]; FSettings.LastSLine = FSettings.UsrLastSLine[1]; @@ -559,7 +565,7 @@ void FCEUI_SetSnapName(int a) int32 FCEUI_GetDesiredFPS(void) { - if (PAL || dendy) + if (PAL || FSettings.dendy) return(838977920); /* ~50.007 */ else return(1008307711); /* ~60.1 */ diff --git a/src/fceu.h b/src/fceu.h index f97b425..4756bda 100644 --- a/src/fceu.h +++ b/src/fceu.h @@ -5,24 +5,6 @@ extern int fceuindbg; -/* Overclocking-related */ -extern unsigned overclock_enabled; -extern unsigned overclocked; -extern unsigned skip_7bit_overclocking; -extern unsigned DMC_7bit; -extern unsigned totalscanlines; -extern unsigned normal_scanlines; -extern unsigned extrascanlines; -extern unsigned vblankscanlines; - -/* Region selection */ -extern unsigned dendy; - -/* Audio mods*/ -extern unsigned swapDuty; /* Swap bits 6 & 7 of $4000/$4004 to mimic bug - * found on some famiclones/Dendy models. - */ - void ResetGameLoaded(void); #define DECLFR(x) uint8 FP_FASTAPASS(1) x(uint32 A) @@ -79,6 +61,9 @@ extern uint8 PAL; #include "driver.h" +#define SCANLINES_NORMAL 240 +#define SCANLINES_DENDY 290 + typedef struct { int PAL; int NetworkPlay; @@ -102,6 +87,13 @@ typedef struct { uint32 SndRate; int soundq; int lowpass; + + int show_crosshair; + int ramstate; + int dendy; + int swapDuty; /* Swap bits 6 & 7 of $4000/$4004 to mimic bug + * found on some famiclones/Dendy models. + */ } FCEUS; extern FCEUS FSettings; diff --git a/src/ines.c b/src/ines.c index 7f807d3..ba524f3 100644 --- a/src/ines.c +++ b/src/ines.c @@ -1062,7 +1062,8 @@ int iNESLoad(const char *name, FCEUFILE *fp) { * 1: RP2C07 ("Licensed PAL NES") * 2: Multiple-region * 3: UMC 6527P ("Dendy") */ - if (iNESCart.region == 3) dendy = 1; + if (iNESCart.region == 3) + FSettings.dendy = 1; FCEUI_SetVidSystem((iNESCart.region == 1) ? 1 : 0); return 1; diff --git a/src/input.h b/src/input.h index 82061bc..1ab1e39 100644 --- a/src/input.h +++ b/src/input.h @@ -29,4 +29,6 @@ extern void (*InputScanlineHook)(uint8 *bg, uint8 *spr, uint32 linets, int final void FCEU_DoSimpleCommand(int cmd); +void FCEU_ZapperSetTolerance(int t); + #endif diff --git a/src/ppu.c b/src/ppu.c index 45ccc7f..b6ae1c5 100644 --- a/src/ppu.c +++ b/src/ppu.c @@ -32,7 +32,6 @@ #include "general.h" #include "fceu-endian.h" #include "fceu-memory.h" -#include "ppuview.h" #include "cart.h" #include "palette.h" @@ -64,6 +63,8 @@ static uint32 ppulut1[256]; static uint32 ppulut2[256]; static uint32 ppulut3[128]; +FCEU_PPU ppu; + static void makeppulut(void) { int x; int y; @@ -660,7 +661,7 @@ static void DoLine(void) uint8 *target = NULL; uint8 *dtarget = NULL; - if (scanline >= 240 && scanline != totalscanlines) + if (scanline >= 240 && scanline != ppu.totalscanlines) { X6502_Run(256 + 69); scanline++; @@ -1066,7 +1067,7 @@ static void CopySprites(uint8 *target) { void FCEUPPU_SetVideoSystem(int w) { if (w) { - scanlines_per_frame = dendy ? 262 : 312; + scanlines_per_frame = FSettings.dendy ? 262 : 312; FSettings.FirstSLine = FSettings.UsrFirstSLine[1]; FSettings.LastSLine = FSettings.UsrLastSLine[1]; } else { @@ -1166,11 +1167,11 @@ int FCEUPPU_Loop(int skip) { TriggerNMI(); } X6502_Run((scanlines_per_frame - 242) * (256 + 85) - 12); - if (overclock_enabled && vblankscanlines) { - if (!DMC_7bit || !skip_7bit_overclocking) { - overclocked = 1; - X6502_Run(vblankscanlines * (256 + 85) - 12); - overclocked = 0; + if (ppu.overclock_enabled && ppu.vblankscanlines) { + if (!DMC_7bit || !ppu.skip_7bit_overclocking) { + overclocking = 1; + X6502_Run(ppu.vblankscanlines * (256 + 85) - 12); + overclocking = 0; } } PPU_status &= 0x1f; @@ -1203,7 +1204,7 @@ int FCEUPPU_Loop(int skip) { kook ^= 1; } if (GameInfo->type == GIT_NSF) - X6502_Run((256 + 85) * normal_scanlines); + X6502_Run((256 + 85) * ppu.normal_scanlines); #ifdef FRAMESKIP else if (skip) { int y; @@ -1234,21 +1235,20 @@ int FCEUPPU_Loop(int skip) { deemp = PPU[1] >> 5; /* manual samples can't play correctly with overclocking */ - if (DMC_7bit && skip_7bit_overclocking) - totalscanlines = normal_scanlines; + if (DMC_7bit && ppu.skip_7bit_overclocking) + ppu.totalscanlines = ppu.normal_scanlines; else - totalscanlines = normal_scanlines + (overclock_enabled ? extrascanlines : 0); + ppu.totalscanlines = ppu.normal_scanlines + (ppu.overclock_enabled ? ppu.extrascanlines : 0); - for (scanline = 0; scanline < totalscanlines; ) { /* scanline is incremented in DoLine. Evil. :/ */ + for (scanline = 0; scanline < ppu.totalscanlines; ) { /* scanline is incremented in DoLine. Evil. :/ */ deempcnt[deemp]++; - /* if ((PPUViewer) && (scanline == PPUViewScanline)) UpdatePPUView(1); */ DoLine(); - if (scanline < normal_scanlines || scanline == totalscanlines) - overclocked = 0; + if (scanline < ppu.normal_scanlines || scanline == ppu.totalscanlines) + overclocking = 0; else { - if (DMC_7bit && skip_7bit_overclocking) /* 7bit sample started after 240th line */ + if (DMC_7bit && ppu.skip_7bit_overclocking) /* 7bit sample started after 240th line */ break; - overclocked = 1; + overclocking = 1; } } diff --git a/src/ppu.h b/src/ppu.h index 96338a1..829de71 100644 --- a/src/ppu.h +++ b/src/ppu.h @@ -1,6 +1,18 @@ #ifndef _FCEU_PPU_H #define _FCEU_PPU_H +typedef struct { + /* PPU Overclocking */ + int overclock_enabled; /* 1 : enable, 0 : disable duh! */ + int skip_7bit_overclocking; /* 7-bit samples have priority over overclocking */ + int extrascanlines; + int vblankscanlines; + int normal_scanlines; /* 240 : normal, 290 : dendy */ + int totalscanlines; +} FCEU_PPU; + +extern FCEU_PPU ppu; + void FCEUPPU_Init(void); void FCEUPPU_Reset(void); void FCEUPPU_Power(void); @@ -16,6 +28,8 @@ extern void FP_FASTAPASS(1) (*PPU_hook)(uint32 A); extern uint8 NTARAM[0x800], *vnapage[4]; extern uint8 PPUNTARAM; extern uint8 PPUCHRRAM; +extern uint8 PALRAM[0x20]; +extern uint8 SPRAM[0x100]; void FCEUPPU_SaveState(void); void FCEUPPU_LoadState(int version); diff --git a/src/ppuview.h b/src/ppuview.h deleted file mode 100644 index 740a183..0000000 --- a/src/ppuview.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _FCEU_PPUVIEW_H -#define _FCEU_PPUVIEW_H - -extern int PPUViewScanline; -extern int PPUViewer; -extern int scanline; - -void PPUViewDoBlit(); -void DoPPUView(); -void UpdatePPUView(int refreshchr); - - -#endif diff --git a/src/sound.c b/src/sound.c index a483d16..a72f93a 100644 --- a/src/sound.c +++ b/src/sound.c @@ -61,7 +61,7 @@ typedef struct { int reloaddec; } ENVUNIT; -unsigned DMC_7bit = 0; /* used to skip overclocking */ +uint32 DMC_7bit = 0; /* used to skip overclocking */ static ENVUNIT EnvUnits[3]; static const int RectDuties[4] = { 1, 2, 4, 6 }; @@ -195,7 +195,7 @@ static DECLFW(Write_PSG) { DoSQ1(); EnvUnits[0].Mode = (V & 0x30) >> 4; EnvUnits[0].Speed = (V & 0xF); - if (swapDuty) + if (FSettings.swapDuty) V = (V & 0x3F) | ((V & 0x80) >> 1) | ((V & 0x40) << 1); break; case 0x1: @@ -216,7 +216,7 @@ static DECLFW(Write_PSG) { DoSQ2(); EnvUnits[1].Mode = (V & 0x30) >> 4; EnvUnits[1].Speed = (V & 0xF); - if (swapDuty) + if (FSettings.swapDuty) V = (V & 0x3F) | ((V & 0x80) >> 1) | ((V & 0x40) << 1); break; case 0x5: diff --git a/src/sound.h b/src/sound.h index c4413cc..d10a56a 100644 --- a/src/sound.h +++ b/src/sound.h @@ -50,6 +50,7 @@ extern int32 Wave[2048 + 512]; extern int32 WaveFinal[2048 + 512]; extern int32 WaveHi[]; extern uint32 soundtsinc; +extern uint32 DMC_7bit; extern uint32 soundtsoffs; #define SOUNDTS (sound_timestamp + soundtsoffs) diff --git a/src/video.c b/src/video.c index 0017fc1..80da854 100644 --- a/src/video.c +++ b/src/video.c @@ -37,7 +37,6 @@ uint8 *XBuf = NULL; uint8 *XDBuf = NULL; -int show_crosshair = 0; void FCEU_KillVirtualVideo(void) { @@ -53,15 +52,15 @@ int FCEU_InitVirtualVideo(void) { /* 256 bytes per scanline, * 240 scanline maximum, +8 for alignment, */ if (!XBuf) - XBuf = (uint8*)(FCEU_malloc(256 * (256 + extrascanlines + 8))); + XBuf = (uint8*)(FCEU_malloc(256 * (256 + ppu.extrascanlines + 8))); if (!XDBuf) - XDBuf = (uint8*)(FCEU_malloc(256 * (256 + extrascanlines + 8))); + XDBuf = (uint8*)(FCEU_malloc(256 * (256 + ppu.extrascanlines + 8))); if (!XBuf || !XDBuf) return 0; - memset(XBuf, 128, 256 * (256 + extrascanlines + 8)); - memset(XDBuf, 128, 256 * (256 + extrascanlines + 8)); + memset(XBuf, 128, 256 * (256 + ppu.extrascanlines + 8)); + memset(XDBuf, 128, 256 * (256 + ppu.extrascanlines + 8)); return 1; } @@ -82,7 +81,7 @@ void FCEU_PutImage(void) FCEU_VSUniDraw(XBuf); } if (howlong) howlong--; - if (show_crosshair) + if (FSettings.show_crosshair) FCEU_DrawInput(XBuf); } diff --git a/src/video.h b/src/video.h index 9eef95b..b98a419 100644 --- a/src/video.h +++ b/src/video.h @@ -6,7 +6,6 @@ void FCEU_KillVirtualVideo(void); int SaveSnapshot(void); extern uint8 *XBuf; extern uint8 *XDBuf; -extern int show_crosshair; void FCEU_DrawNumberRow(uint8 *XBuf, int *nstatus, int cur); #endif diff --git a/src/x6502.c b/src/x6502.c index b8bf2d9..0d00377 100644 --- a/src/x6502.c +++ b/src/x6502.c @@ -34,6 +34,7 @@ void (*X6502_Run)(int32 cycles); uint32 timestamp; uint32 sound_timestamp; +uint32 overclocking = 0; void FP_FASTAPASS(1) (*MapIRQHook)(int a); #define _PC X.PC @@ -54,7 +55,7 @@ void FP_FASTAPASS(1) (*MapIRQHook)(int a); _tcount += __x; \ _count -= __x * 48; \ timestamp += __x; \ - if (!overclocked) sound_timestamp += __x; \ + if (!overclocking) sound_timestamp += __x; \ } static INLINE uint8 RdMemNorm(uint32 A) { @@ -516,7 +517,7 @@ static void X6502_RunDebug(int32 cycles) { _tcount = 0; if (MapIRQHook) MapIRQHook(temp); - if (!overclocked) + if (!overclocking) FCEU_SoundCPUHook(temp); _PC++; @@ -613,7 +614,7 @@ void X6502_Run(int32 cycles) temp = _tcount; _tcount = 0; if (MapIRQHook) MapIRQHook(temp); - if (!overclocked) + if (!overclocking) FCEU_SoundCPUHook(temp); X.PC = pbackus; _PC++; diff --git a/src/x6502.h b/src/x6502.h index f480544..d9d8b65 100644 --- a/src/x6502.h +++ b/src/x6502.h @@ -35,6 +35,7 @@ void X6502_Run(int32 cycles); extern uint32 timestamp; extern uint32 sound_timestamp; +extern uint32 overclocking; extern X6502 X; #define N_FLAG 0x80 @@ -48,7 +49,7 @@ extern X6502 X; extern void FP_FASTAPASS(1) (*MapIRQHook)(int a); -#define NTSC_CPU (dendy ? 1773447.467 : 1789772.7272727272727272) +#define NTSC_CPU (FSettings.dendy ? 1773447.467 : 1789772.7272727272727272) #define PAL_CPU 1662607.125 #define FCEU_IQEXT 0x001