diff --git a/source/fceugx.cpp b/source/fceugx.cpp index 0cd5698..8f56bb0 100644 --- a/source/fceugx.cpp +++ b/source/fceugx.cpp @@ -556,5 +556,15 @@ int main(int argc, char *argv[]) #endif } // emulation loop - } // main loop + } // main loop +} + +char* ImageFolder() +{ + switch(GCSettings.PreviewImage) + { + case 1 : return GCSettings.CoverFolder; break; + case 2 : return GCSettings.ArtworkFolder; break; + default: return GCSettings.ScreenshotsFolder; break; + } } diff --git a/source/fceugx.h b/source/fceugx.h index 4b3d95a..e6ea4dd 100644 --- a/source/fceugx.h +++ b/source/fceugx.h @@ -90,6 +90,8 @@ struct SGCSettings char SaveFolder[MAXPATHLEN]; // Path to save files char CheatFolder[MAXPATHLEN]; // Path to cheat files char ScreenshotsFolder[MAXPATHLEN]; // Path to screenshot files + char CoverFolder[MAXPATHLEN]; // Path to cover files + char ArtworkFolder[MAXPATHLEN]; // Path to artwork files int AutoloadGame; char smbip[80]; @@ -117,8 +119,11 @@ struct SGCSettings int SFXVolume; int Rumble; int language; + int PreviewImage; }; +char* ImageFolder(); + void ExitApp(); void ShutdownWii(); bool SupportedIOS(u32 ios); diff --git a/source/menu.cpp b/source/menu.cpp index 665119c..addede1 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -954,8 +954,15 @@ static int MenuGameSelection() gameBrowser.SetPosition(20, 98); ResetBrowser(); + GuiTrigger trigPlusMinus; + trigPlusMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, PAD_TRIGGER_Z, WIIDRC_BUTTON_PLUS); + GuiImage bgPreview(&bgPreviewImg); - bgPreview.SetPosition(365, 98); + GuiButton bgPreviewBtn(bgPreview.GetWidth(), bgPreview.GetHeight()); + bgPreviewBtn.SetImage(&bgPreview); + bgPreviewBtn.SetPosition(365, 98); + bgPreviewBtn.SetTrigger(&trigPlusMinus); + int previousPreviewImg = GCSettings.PreviewImage; GuiImage preview; preview.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); @@ -970,7 +977,7 @@ static int MenuGameSelection() mainWindow->Append(&titleTxt); mainWindow->Append(&gameBrowser); mainWindow->Append(&buttonWindow); - mainWindow->Append(&bgPreview); + mainWindow->Append(&bgPreviewBtn); mainWindow->Append(&preview); ResumeGui(); @@ -1045,10 +1052,11 @@ static int MenuGameSelection() } //update game screenshot - if(previousBrowserIndex != browser.selIndex) + if(previousBrowserIndex != browser.selIndex || previousPreviewImg != GCSettings.PreviewImage) { previousBrowserIndex = browser.selIndex; - snprintf(screenshotPath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], GCSettings.ScreenshotsFolder, browserList[browser.selIndex].displayname); + previousPreviewImg = GCSettings.PreviewImage; + snprintf(screenshotPath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], ImageFolder(), browserList[browser.selIndex].displayname); AllocSaveBuffer(); int width, height; @@ -1075,6 +1083,11 @@ static int MenuGameSelection() menu = MENU_SETTINGS; else if(exitBtn.GetState() == STATE_CLICKED) ExitRequested = 1; + else if(bgPreviewBtn.GetState() == STATE_CLICKED) + { + GCSettings.PreviewImage = (GCSettings.PreviewImage + 1) % 3; + bgPreviewBtn.ResetState(); + } } HaltParseThread(); // halt parsing @@ -1083,7 +1096,7 @@ static int MenuGameSelection() mainWindow->Remove(&titleTxt); mainWindow->Remove(&buttonWindow); mainWindow->Remove(&gameBrowser); - mainWindow->Remove(&bgPreview); + mainWindow->Remove(&bgPreviewBtn); mainWindow->Remove(&preview); MEM_DEALLOC(imgBuffer); return menu; @@ -3515,6 +3528,8 @@ static int MenuSettingsFile() sprintf(options.name[i++], "Save Folder"); sprintf(options.name[i++], "Cheats Folder"); sprintf(options.name[i++], "Screenshots Folder"); + sprintf(options.name[i++], "Covers Folder"); + sprintf(options.name[i++], "Artwork Folder"); sprintf(options.name[i++], "Auto Load"); sprintf(options.name[i++], "Auto Save"); sprintf(options.name[i++], "Append Auto to .SAV Files"); @@ -3593,18 +3608,26 @@ static int MenuSettingsFile() break; case 6: + OnScreenKeyboard(GCSettings.CoverFolder, MAXPATHLEN); + break; + + case 7: + OnScreenKeyboard(GCSettings.ArtworkFolder, MAXPATHLEN); + break; + + case 8: GCSettings.AutoLoad++; if (GCSettings.AutoLoad > 2) GCSettings.AutoLoad = 0; break; - case 7: + case 9: GCSettings.AutoSave++; if (GCSettings.AutoSave > 3) GCSettings.AutoSave = 0; break; - case 8: + case 10: GCSettings.AppendAuto++; if (GCSettings.AppendAuto > 1) GCSettings.AppendAuto = 0; @@ -3671,18 +3694,20 @@ static int MenuSettingsFile() snprintf (options.value[3], 35, "%s", GCSettings.SaveFolder); snprintf (options.value[4], 35, "%s", GCSettings.CheatFolder); snprintf (options.value[5], 35, "%s", GCSettings.ScreenshotsFolder); + snprintf (options.value[6], 35, "%s", GCSettings.CoverFolder); + snprintf (options.value[7], 35, "%s", GCSettings.ArtworkFolder); - if (GCSettings.AutoLoad == 0) sprintf (options.value[6],"Off"); - else if (GCSettings.AutoLoad == 1) sprintf (options.value[6],"RAM"); - else if (GCSettings.AutoLoad == 2) sprintf (options.value[6],"State"); + if (GCSettings.AutoLoad == 0) sprintf (options.value[8],"Off"); + else if (GCSettings.AutoLoad == 1) sprintf (options.value[8],"RAM"); + else if (GCSettings.AutoLoad == 2) sprintf (options.value[8],"State"); if (GCSettings.AutoSave == 0) sprintf (options.value[7],"Off"); - else if (GCSettings.AutoSave == 1) sprintf (options.value[7],"RAM"); - else if (GCSettings.AutoSave == 2) sprintf (options.value[7],"State"); - else if (GCSettings.AutoSave == 3) sprintf (options.value[7],"Both"); + else if (GCSettings.AutoSave == 1) sprintf (options.value[9],"RAM"); + else if (GCSettings.AutoSave == 2) sprintf (options.value[9],"State"); + else if (GCSettings.AutoSave == 3) sprintf (options.value[9],"Both"); - if (GCSettings.AppendAuto == 0) sprintf (options.value[8], "Off"); - else if (GCSettings.AppendAuto == 1) sprintf (options.value[8], "On"); + if (GCSettings.AppendAuto == 0) sprintf (options.value[10], "Off"); + else if (GCSettings.AppendAuto == 1) sprintf (options.value[10], "On"); optionBrowser.TriggerUpdate(); } @@ -3717,6 +3742,7 @@ static int MenuSettingsMenu() sprintf(options.name[i++], "Sound Effects Volume"); sprintf(options.name[i++], "Rumble"); sprintf(options.name[i++], "Language"); + sprintf(options.name[i++], "Preview Image"); options.length = i; for(i=0; i < options.length; i++) @@ -3800,6 +3826,12 @@ static int MenuSettingsMenu() else if(GCSettings.language == LANG_JAPANESE) GCSettings.language = LANG_ENGLISH; break; + + case 6: + GCSettings.PreviewImage++; + if(GCSettings.PreviewImage > 2) + GCSettings.PreviewImage = 0; + break; } if(ret >= 0 || firstRun) @@ -3867,6 +3899,19 @@ static int MenuSettingsMenu() case LANG_TURKISH: sprintf(options.value[5], "Turkish"); break; } + switch(GCSettings.PreviewImage) + { + case 0: + sprintf(options.value[6], "Screenshots"); + break; + case 1: + sprintf(options.value[6], "Covers"); + break; + case 2: + sprintf(options.value[6], "Artwork"); + break; + } + optionBrowser.TriggerUpdate(); } diff --git a/source/preferences.cpp b/source/preferences.cpp index 4b0650c..8d70686 100644 --- a/source/preferences.cpp +++ b/source/preferences.cpp @@ -131,6 +131,8 @@ preparePrefsData () createXMLSetting("CheatFolder", "Cheats Folder", GCSettings.CheatFolder); createXMLSetting("gamegenie", "Game Genie", toStr(GCSettings.gamegenie)); createXMLSetting("ScreenshotsFolder", "Screenshots Folder", GCSettings.ScreenshotsFolder); + createXMLSetting("CoverFolder", "Covers Folder", GCSettings.CoverFolder); + createXMLSetting("ArtworkFolder", "Artwork Folder", GCSettings.ArtworkFolder); createXMLSection("Network", "Network Settings"); @@ -163,7 +165,7 @@ preparePrefsData () createXMLSetting("SFXVolume", "Sound Effects Volume", toStr(GCSettings.SFXVolume)); createXMLSetting("Rumble", "Rumble", toStr(GCSettings.Rumble)); createXMLSetting("language", "Language", toStr(GCSettings.language)); - + createXMLSetting("PreviewImage", "Preview Image", toStr(GCSettings.PreviewImage)); createXMLSection("Controller", "Controller Settings"); @@ -303,6 +305,8 @@ decodePrefsData () loadXMLSetting(GCSettings.CheatFolder, "CheatFolder", sizeof(GCSettings.CheatFolder)); loadXMLSetting(&GCSettings.gamegenie, "gamegenie"); loadXMLSetting(GCSettings.ScreenshotsFolder, "ScreenshotsFolder", sizeof(GCSettings.ScreenshotsFolder)); + loadXMLSetting(GCSettings.CoverFolder, "CoverFolder", sizeof(GCSettings.CoverFolder)); + loadXMLSetting(GCSettings.ArtworkFolder, "ArtworkFolder", sizeof(GCSettings.ArtworkFolder)); // Network Settings @@ -333,6 +337,7 @@ decodePrefsData () loadXMLSetting(&GCSettings.SFXVolume, "SFXVolume"); loadXMLSetting(&GCSettings.Rumble, "Rumble"); loadXMLSetting(&GCSettings.language, "language"); + loadXMLSetting(&GCSettings.PreviewImage, "PreviewImage"); // Controller Settings @@ -423,6 +428,8 @@ DefaultSettings () GCSettings.MusicVolume = 20; GCSettings.SFXVolume = 40; GCSettings.Rumble = 1; // Enabled + GCSettings.PreviewImage = 0; + #ifdef HW_RVL GCSettings.language = CONF_GetLanguage(); @@ -441,6 +448,8 @@ DefaultSettings () sprintf (GCSettings.SaveFolder, "%s/saves", APPFOLDER); // Path to save files sprintf (GCSettings.CheatFolder, "%s/cheats", APPFOLDER); // Path to cheat files sprintf (GCSettings.ScreenshotsFolder, "%s/screenshots", APPFOLDER); // Path to screenshots files + sprintf (GCSettings.CoverFolder, "%s/covers", APPFOLDER); // Path to cover files + sprintf (GCSettings.ArtworkFolder, "%s/artwork", APPFOLDER); // Path to artwork files GCSettings.AutoLoad = 1; // Auto Load RAM GCSettings.AutoSave = 1; // Auto Save RAM } @@ -600,8 +609,13 @@ bool LoadPrefs() char dirPath[MAXPATHLEN]; sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.ScreenshotsFolder); CreateDirectory(dirPath); + sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.CoverFolder); + CreateDirectory(dirPath); + sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.ArtworkFolder); + CreateDirectory(dirPath); sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.CheatFolder); CreateDirectory(dirPath); + } ResetText();