SDL2: Fix up cheats (still missing UI

This commit is contained in:
tmaul 2021-04-08 21:09:19 +01:00
parent 520cb85217
commit 1ab8226f0d
4 changed files with 29 additions and 17 deletions

View File

@ -35,6 +35,20 @@ static void CheatError(TCHAR* pszFilename, INT32 nLineNumber, CheatInfo* pCheat,
}
FBAPopupDisplay(PUF_TYPE_ERROR);
#elseif defined(BUILD_SDL2)
printf("Cheat file %s is malformed.\nPlease remove or repair the file.\n\n", pszFilename);
if (pCheat) {
printf("Parse error at line %i, in cheat \"%s\".\n", nLineNumber, pCheat->szCheatName);
} else {
printf("Parse error at line %i.\n", nLineNumber);
}
if (pszInfo) {
printf("Problem:\t%s.\n", pszInfo);
}
if (pszLine) {
printf("Text:\t%s\n", pszLine);
}
#endif
}
@ -671,5 +685,3 @@ INT32 ConfigCheatLoad()
return 0;
}

View File

@ -9,7 +9,7 @@ static char* szSDLconfigPath = NULL;
static void CreateConfigName(char* szConfig)
{
#if defined(BUILD_SDL2) && !defined(SDL_WINDOWS)
#if defined(BUILD_SDL2) && !defined(SDL_WINDOWS)
char cfgdir[MAX_PATH] = { 0 };
if (szSDLconfigPath == NULL)
@ -19,7 +19,7 @@ static void CreateConfigName(char* szConfig)
snprintf(cfgdir, MAX_PATH, "%sfbneo.ini", szSDLconfigPath);
memcpy(szConfig, cfgdir, sizeof(cfgdir));
#else
#else
_stprintf(szConfig, _T("fbneo.ini"));
#endif
@ -64,9 +64,9 @@ int ConfigAppLoad()
VAR(nVidSelect); // video mode select
VAR(bVidFullStretch);
VAR(nAutoFireRate);
VAR(bAlwaysMenu);
VAR(nGameSelect);
VAR(nFilterSelect);
VAR(bAlwaysMenu);
VAR(nGameSelect);
VAR(nFilterSelect);
VAR(bShowAvailableOnly);
VAR(bShowClones);
VAR(gameSelectedFromFilter);
@ -125,7 +125,7 @@ int ConfigAppLoad()
STR(szAppListsPath);
STR(szAppDatListsPath);
STR(szAppArchivesPath);
#undef STR
#undef FLT
#undef VAR
@ -219,7 +219,7 @@ int ConfigAppSave()
STR(szAppPreviewsPath);
fprintf(f, "\n// Path to titlescreen images for use on the menu (include trailing slash)\n");
STR(szAppTitlesPath);
fprintf(f, "\n// UNUSED CURRENTLY (include trailing slash)\n");
fprintf(f, "\n// Cheat files path (include trailing slash)\n");
STR(szAppCheatsPath);
fprintf(f, "\n// Hiscore save path (include trailing slash)\n");
STR(szAppHiscorePath);

View File

@ -127,7 +127,7 @@ int DrvInit(int nDrvNum, bool bRestore)
bSaveRAM = false;
nBurnLayer = 0xFF; // show all layers
ConfigCheatLoad();
// Reset the speed throttling code, so we don't 'jump' after the load
RunReset();
VidExit();

View File

@ -239,15 +239,15 @@ void ingame_gui_start(SDL_Renderer* renderer)
while (!finished)
{
starting_stick = SDL_GetTicks();
starting_stick = SDL_GetTicks();
finished = ingame_gui_process();
ingame_gui_render();
// limit 5 FPS (free CPU usage)
if ( ( 1000 / 5 ) > SDL_GetTicks() - starting_stick) {
SDL_Delay( 1000 / 5 - ( SDL_GetTicks() - starting_stick ) );
}
// limit 5 FPS (free CPU usage)
if ( ( 1000 / 5 ) > SDL_GetTicks() - starting_stick)
{
SDL_Delay( 1000 / 5 - ( SDL_GetTicks() - starting_stick ) );
}
}
ingame_gui_exit();