Merge pull request #162 from retro-wertz/overclocking
Overclock Update and cleanup
This commit is contained in:
@@ -61,13 +61,14 @@ static int zapper_mode = 0; /* 0=absolute 1=relative */
|
|||||||
/* overclock the console by adding dummy scanlines to PPU loop
|
/* overclock the console by adding dummy scanlines to PPU loop
|
||||||
* disables DMC DMA and WaveHi filling for these dummies
|
* disables DMC DMA and WaveHi filling for these dummies
|
||||||
* doesn't work with new PPU */
|
* doesn't work with new PPU */
|
||||||
|
unsigned overclock_state = -1;
|
||||||
unsigned overclocked = 0;
|
unsigned overclocked = 0;
|
||||||
/* 7-bit samples have priority over overclocking */
|
unsigned skip_7bit_overclocking = 1; /* 7-bit samples have priority over overclocking */
|
||||||
unsigned skip_7bit_overclocking = 1;
|
unsigned totalscanlines = 0;
|
||||||
unsigned normal_scanlines = 240;
|
unsigned normal_scanlines = 240;
|
||||||
unsigned extrascanlines = 0;
|
unsigned extrascanlines = 0;
|
||||||
unsigned vblankscanlines = 0;
|
unsigned vblankscanlines = 0;
|
||||||
unsigned overclock_state = -1;
|
|
||||||
unsigned dendy = 0;
|
unsigned dendy = 0;
|
||||||
|
|
||||||
int FCEUnetplay;
|
int FCEUnetplay;
|
||||||
@@ -80,7 +81,6 @@ static uint16_t retro_palette[256];
|
|||||||
static uint16_t* fceu_video_out;
|
static uint16_t* fceu_video_out;
|
||||||
|
|
||||||
/* Some timing-related variables. */
|
/* Some timing-related variables. */
|
||||||
static int soundo = 1;
|
|
||||||
unsigned sndsamplerate = 48000;
|
unsigned sndsamplerate = 48000;
|
||||||
unsigned sndquality = 0;
|
unsigned sndquality = 0;
|
||||||
unsigned sndvolume = 150;
|
unsigned sndvolume = 150;
|
||||||
@@ -540,7 +540,7 @@ void retro_set_input_state(retro_input_state_t cb)
|
|||||||
|
|
||||||
void retro_set_controller_port_device(unsigned port, unsigned device)
|
void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||||
{
|
{
|
||||||
unsigned i, arg = 0;
|
unsigned arg = 0;
|
||||||
void *InputDPtr;
|
void *InputDPtr;
|
||||||
|
|
||||||
if (port < 2) /* port #0 = player1/player3, port #1 = player2/player4 */
|
if (port < 2) /* port #0 = player1/player3, port #1 = player2/player4 */
|
||||||
|
|||||||
@@ -49,8 +49,6 @@
|
|||||||
|
|
||||||
uint64 timestampbase;
|
uint64 timestampbase;
|
||||||
|
|
||||||
extern int totalscanlines;
|
|
||||||
|
|
||||||
FCEUGI *GameInfo = NULL;
|
FCEUGI *GameInfo = NULL;
|
||||||
void (*GameInterface)(int h);
|
void (*GameInterface)(int h);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ extern unsigned overclock_state;
|
|||||||
extern unsigned overclocked;
|
extern unsigned overclocked;
|
||||||
extern unsigned skip_7bit_overclocking;
|
extern unsigned skip_7bit_overclocking;
|
||||||
extern unsigned DMC_7bit;
|
extern unsigned DMC_7bit;
|
||||||
|
extern unsigned totalscanlines;
|
||||||
extern unsigned normal_scanlines;
|
extern unsigned normal_scanlines;
|
||||||
extern unsigned extrascanlines;
|
extern unsigned extrascanlines;
|
||||||
extern unsigned vblankscanlines;
|
extern unsigned vblankscanlines;
|
||||||
|
|||||||
24
src/ppu.c
24
src/ppu.c
@@ -127,8 +127,6 @@ static int maxsprites = 8;
|
|||||||
int scanline;
|
int scanline;
|
||||||
static uint32 scanlines_per_frame;
|
static uint32 scanlines_per_frame;
|
||||||
|
|
||||||
int totalscanlines;
|
|
||||||
|
|
||||||
uint8 PPU[4];
|
uint8 PPU[4];
|
||||||
uint8 PPUSPL;
|
uint8 PPUSPL;
|
||||||
uint8 NTARAM[0x800], PALRAM[0x20], SPRAM[0x100], SPRBUF[0x100];
|
uint8 NTARAM[0x800], PALRAM[0x20], SPRAM[0x100], SPRBUF[0x100];
|
||||||
@@ -1153,11 +1151,12 @@ int FCEUPPU_Loop(int skip) {
|
|||||||
TriggerNMI();
|
TriggerNMI();
|
||||||
}
|
}
|
||||||
X6502_Run((scanlines_per_frame - 242) * (256 + 85) - 12);
|
X6502_Run((scanlines_per_frame - 242) * (256 + 85) - 12);
|
||||||
if (vblankscanlines)
|
if (overclock_state && vblankscanlines) {
|
||||||
{
|
if (!DMC_7bit || !skip_7bit_overclocking) {
|
||||||
overclocked = 1;
|
overclocked = 1;
|
||||||
X6502_Run(vblankscanlines * (256 + 85) - 12);
|
X6502_Run(vblankscanlines * (256 + 85) - 12);
|
||||||
overclocked = 0;
|
overclocked = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PPU_status &= 0x1f;
|
PPU_status &= 0x1f;
|
||||||
X6502_Run(256);
|
X6502_Run(256);
|
||||||
@@ -1231,20 +1230,13 @@ int FCEUPPU_Loop(int skip) {
|
|||||||
DoLine();
|
DoLine();
|
||||||
if (scanline < normal_scanlines || scanline == totalscanlines)
|
if (scanline < normal_scanlines || scanline == totalscanlines)
|
||||||
overclocked = 0;
|
overclocked = 0;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (DMC_7bit && skip_7bit_overclocking) /* 7bit sample started after 240th line */
|
if (DMC_7bit && skip_7bit_overclocking) /* 7bit sample started after 240th line */
|
||||||
break;
|
break;
|
||||||
overclocked = 1;
|
overclocked = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* For Debugging */
|
|
||||||
/* FCEU_printf("Overclock State:%d DMC+7bit:%d Skip_7bit_OC:%d\n",
|
|
||||||
overclock_state,DMC_7bit,skip_7bit_overclocking);
|
|
||||||
FCEU_printf("SL:%d N_SL:%d, T_SL:%d Overclocked(for FCEU_SoundCPUHook):%d\n\n",
|
|
||||||
scanline,normal_scanlines,totalscanlines,overclocked);
|
|
||||||
FCEU_printf("extrascanlines:%d vblankscanlines:%d\n",extrascanlines,vblankscanlines);
|
|
||||||
*/
|
|
||||||
DMC_7bit = 0;
|
DMC_7bit = 0;
|
||||||
if (MMC5Hack && (ScreenON || SpriteON)) MMC5_hb(scanline);
|
if (MMC5Hack && (ScreenON || SpriteON)) MMC5_hb(scanline);
|
||||||
for (x = 1, max = 0, maxref = 0; x < 7; x++) {
|
for (x = 1, max = 0, maxref = 0; x < 7; x++) {
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ static void X6502_RunDebug(int32 cycles) {
|
|||||||
_tcount = 0;
|
_tcount = 0;
|
||||||
if (MapIRQHook) MapIRQHook(temp);
|
if (MapIRQHook) MapIRQHook(temp);
|
||||||
|
|
||||||
if (scanline < normal_scanlines || scanline == totalscanlines)
|
if (!overclocked)
|
||||||
FCEU_SoundCPUHook(temp);
|
FCEU_SoundCPUHook(temp);
|
||||||
|
|
||||||
_PC++;
|
_PC++;
|
||||||
|
|||||||
@@ -23,10 +23,6 @@
|
|||||||
|
|
||||||
#include "x6502struct.h"
|
#include "x6502struct.h"
|
||||||
|
|
||||||
extern int scanline;
|
|
||||||
extern unsigned normal_scanlines;
|
|
||||||
extern int totalscanlines;
|
|
||||||
|
|
||||||
#ifdef FCEUDEF_DEBUGGER
|
#ifdef FCEUDEF_DEBUGGER
|
||||||
void X6502_Debug(void (*CPUHook)(X6502 *),
|
void X6502_Debug(void (*CPUHook)(X6502 *),
|
||||||
uint8 (*ReadHook)(X6502 *, uint32),
|
uint8 (*ReadHook)(X6502 *, uint32),
|
||||||
|
|||||||
Reference in New Issue
Block a user