add Dendy support

This commit is contained in:
Daryl Borth 2020-11-08 16:36:36 -07:00
parent 06bb334b2b
commit 546c67adcd
7 changed files with 29 additions and 8 deletions

View File

@ -472,7 +472,8 @@ int main(int argc, char *argv[])
if(currentTiming != GCSettings.timing)
{
GameInfo->vidsys=(EGIV)GCSettings.timing;
GameInfo->vidsys=(EGIV)GetFCEUTiming();
UpdateDendy();
FCEU_ResetVidSys(); // causes a small 'pop' in the audio
}

View File

@ -47,7 +47,8 @@ int GCMemROM(int size)
/*** Set some default values ***/
GameInfo->name=0;
GameInfo->type=GIT_CART;
GameInfo->vidsys=(EGIV)GCSettings.timing;
GameInfo->vidsys=(EGIV)GetFCEUTiming();
UpdateDendy();
GameInfo->input[0]=GameInfo->input[1]=SI_UNSET;
GameInfo->inputfc=SIFC_UNSET;
GameInfo->cspecial=SIS_NONE;

View File

@ -23,6 +23,21 @@ int dendy;
bool swapDuty;
int KillFCEUXonFrame = 0;
int GetFCEUTiming()
{
return GCSettings.timing == 3 ? 2 : GCSettings.timing;
}
void UpdateDendy()
{
if(GCSettings.timing == 3) {
dendy = 1;
}
else {
dendy = 0;
}
}
/**
* Closes a game. Frees memory, and deinitializes the drivers.
*/

View File

@ -34,6 +34,8 @@
extern unsigned char * nesrom;
int GetFCEUTiming();
void UpdateDendy();
void RebuildSubCheats(void);
int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type);

View File

@ -204,7 +204,7 @@ static u32 normaldiff;
void setFrameTimer()
{
if (FCEUI_GetCurrentVidSystem(NULL, NULL) == 1) // PAL
if (FCEUI_GetCurrentVidSystem(NULL, NULL) == 1 || GCSettings.timing == 3) // PAL
normaldiff = 20000; // 50hz
else
normaldiff = 16667; // 60hz
@ -643,9 +643,10 @@ ResetVideo_Emu ()
if (GCSettings.render == 0)
{
rmode = tvmodes[FCEUI_GetCurrentVidSystem(NULL, NULL)];
int timing = GCSettings.timing == 3 ? 1 : FCEUI_GetCurrentVidSystem(NULL, NULL);
rmode = tvmodes[timing];
if (FCEUI_GetCurrentVidSystem(NULL, NULL) == 1) // PAL
if (FCEUI_GetCurrentVidSystem(NULL, NULL) == 1 || GCSettings.timing == 3) // PAL
UpdateSampleRate(48070);
else
UpdateSampleRate(48220);
@ -659,7 +660,7 @@ ResetVideo_Emu ()
else
ResetFbWidth(512, rmode);
if (FCEUI_GetCurrentVidSystem(NULL, NULL) == 1) // PAL
if (FCEUI_GetCurrentVidSystem(NULL, NULL) == 1 || GCSettings.timing == 3) // PAL
UpdateSampleRate(48080);
else
UpdateSampleRate(48130);

View File

@ -3392,7 +3392,7 @@ static int MenuSettingsVideo()
case 4: // timing
GCSettings.timing++;
if(GCSettings.timing > 2)
if(GCSettings.timing > 3)
GCSettings.timing = 0;
break;
@ -3459,6 +3459,7 @@ static int MenuSettingsVideo()
case 0: sprintf (options.value[4], "NTSC"); break;
case 1: sprintf (options.value[4], "PAL"); break;
case 2: sprintf (options.value[4], "Automatic"); break;
case 3: sprintf (options.value[4], "Dendy"); break;
}
sprintf (options.value[5], "%.2f%%, %.2f%%", GCSettings.zoomHor*100, GCSettings.zoomVert*100);

View File

@ -389,7 +389,7 @@ void FixInvalidSettings()
GCSettings.Controller = CTRL_PAD2;
if(!(GCSettings.render >= 0 && GCSettings.render < 5))
GCSettings.render = 4;
if(GCSettings.timing < 0 || GCSettings.timing > 2)
if(GCSettings.timing < 0 || GCSettings.timing > 3)
GCSettings.timing = 2;
if(!(GCSettings.videomode >= 0 && GCSettings.videomode < 5))
GCSettings.videomode = 0;