overclocking cleanup

This commit is contained in:
feos-tas 2016-06-26 06:50:08 +00:00
parent 88a6999e49
commit ddfdf735db
5 changed files with 29 additions and 25 deletions

View File

@ -182,7 +182,7 @@ static CFGSTRUCT fceuconfig[] =
AC(ntsccol_enable),AC(ntsctint),AC(ntschue),
AC(force_grayscale),
AC(dendy),
AC(extrascanlines),
AC(postrenderscanlines),
AC(vblankscanlines),
AC(overclock_enabled),
AC(skip_7bit_overclocking),

View File

@ -36,16 +36,16 @@ void CloseTimingDialog(HWND hwndDlg)
skip_7bit_overclocking = (IsDlgButtonChecked(hwndDlg, CB_SKIP_7BIT) == BST_CHECKED);
GetDlgItemText(hwndDlg, IDC_EXTRA_SCANLINES, str, 4);
sscanf(str,"%d",&extrascanlines);
sscanf(str,"%d",&postrenderscanlines);
GetDlgItemText(hwndDlg, IDC_VBLANK_SCANLINES, str, 4);
sscanf(str,"%d",&vblankscanlines);
if (extrascanlines < 0)
if (postrenderscanlines < 0)
{
extrascanlines = 0;
postrenderscanlines = 0;
MessageBox(hwndDlg, "Overclocking is when you speed up your CPU, not slow it down!", "Error", MB_OK);
sprintf(str,"%d",extrascanlines);
sprintf(str,"%d",postrenderscanlines);
SetDlgItemText(hwndDlg,IDC_EXTRA_SCANLINES,str);
}
else if (vblankscanlines < 0)
@ -62,7 +62,7 @@ void CloseTimingDialog(HWND hwndDlg)
else
EndDialog(hwndDlg, 0);
totalscanlines = normalscanlines + (overclock_enabled ? extrascanlines : 0);
totalscanlines = normalscanlines + (overclock_enabled ? postrenderscanlines : 0);
}
/**
@ -94,7 +94,7 @@ BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
SendDlgItemMessage(hwndDlg,IDC_EXTRA_SCANLINES, EM_SETLIMITTEXT,3,0);
SendDlgItemMessage(hwndDlg,IDC_VBLANK_SCANLINES,EM_SETLIMITTEXT,3,0);
sprintf(str,"%d",extrascanlines);
sprintf(str,"%d",postrenderscanlines);
SetDlgItemText(hwndDlg,IDC_EXTRA_SCANLINES,str);
sprintf(str,"%d",vblankscanlines);

View File

@ -92,17 +92,16 @@ using namespace std;
//-----------
//overclocking-related
// overclock the console by adding dummy scanlines to PPU loop
// disables DMC DMA and WaveHi filling for these dummies
// overclock the console by adding dummy scanlines to PPU loop or to vblank
// disables DMC DMA, WaveHi filling and image rendering for these dummies
// doesn't work with new PPU
bool overclock_enabled = 0;
// 7-bit samples have priority over overclocking
bool skip_7bit_overclocking = 1;
int normalscanlines;
int extrascanlines = 0;
int totalscanlines;
int vblankscanlines = 0;
bool overclocking = 0;
bool skip_7bit_overclocking = 1; // 7-bit samples have priority over overclocking
int normalscanlines;
int totalscanlines;
int postrenderscanlines = 0;
int vblankscanlines = 0;
//------------
int AFon = 1, AFoff = 1, AutoFireOffset = 0; //For keeping track of autofire settings
@ -879,7 +878,7 @@ void FCEU_ResetVidSys(void) {
overclock_enabled = 0;
normalscanlines = (dendy ? 290 : 240)+newppu; // use flag as number!
totalscanlines = normalscanlines + (overclock_enabled ? extrascanlines : 0);
totalscanlines = normalscanlines + (overclock_enabled ? postrenderscanlines : 0);
FCEUPPU_SetVideoSystem(w || dendy);
SetSoundVariables();
}
@ -968,7 +967,7 @@ void FCEUI_SetRegion(int region) {
break;
}
normalscanlines += newppu;
totalscanlines = normalscanlines + (overclock_enabled ? extrascanlines : 0);
totalscanlines = normalscanlines + (overclock_enabled ? postrenderscanlines : 0);
FCEUI_SetVidSystem(pal_emulation);
RefreshThrottleFPS();
#ifdef WIN32

View File

@ -9,12 +9,12 @@ void ResetGameLoaded(void);
//overclocking-related
extern bool overclock_enabled;
extern bool overclocking;
extern bool skip_7bit_overclocking;
extern int normalscanlines;
extern int extrascanlines;
extern int totalscanlines;
extern int postrenderscanlines;
extern int vblankscanlines;
extern bool overclocking;
extern bool AutoResumePlay;
extern char romNameWhenClosingEmulator[];

View File

@ -1225,12 +1225,17 @@ static void Fixit1(void) {
void MMC5_hb(int); //Ugh ugh ugh.
static void DoLine(void) {
if (overclocking)
{
X6502_Run(256 + 69);
scanline++;
X6502_Run(16);
return;
}
int x;
// scanlines after 239 are dummy for dendy, and Xbuf is capped at 0xffff bytes, don't let it overflow
// send all future writes to the invisible sanline. the easiest way to "skip" them altogether in old ppu
// todo: figure out what exactly should be skipped. it's known that there's no activity on PPU bus
uint8 *target = XBuf + ((scanline < 240 ? scanline : 240) << 8);
u8* dtarget = XDBuf + ((scanline < 240 ? scanline : 240) << 8);
uint8 *target = XBuf + (scanline << 8);
u8* dtarget = XDBuf + (scanline << 8);
if (MMC5Hack) MMC5_hb(scanline);
@ -1815,7 +1820,7 @@ int FCEUPPU_Loop(int skip) {
if (DMC_7bit && skip_7bit_overclocking)
totalscanlines = normalscanlines;
else
totalscanlines = normalscanlines + (overclock_enabled ? extrascanlines : 0);
totalscanlines = normalscanlines + (overclock_enabled ? postrenderscanlines : 0);
for (scanline = 0; scanline < totalscanlines; ) { //scanline is incremented in DoLine. Evil. :/
deempcnt[deemp]++;