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); 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 #endif
} }
@ -671,5 +685,3 @@ INT32 ConfigCheatLoad()
return 0; return 0;
} }

View File

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

View File

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

View File

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