Merge pull request #363 from Zal0/master

Swapping preview images with + button
This commit is contained in:
dborth 2019-01-05 10:49:34 -07:00 committed by GitHub
commit b954e176ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 12 deletions

View File

@ -928,8 +928,15 @@ static int MenuGameSelection()
gameBrowser.SetPosition(20, 98); gameBrowser.SetPosition(20, 98);
ResetBrowser(); ResetBrowser();
GuiTrigger trigPlusMinus;
trigPlusMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, PAD_TRIGGER_Z, WIIDRC_BUTTON_PLUS);
GuiImage bgPreview(&bgPreviewImg); 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; GuiImage preview;
preview.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); preview.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
@ -944,7 +951,7 @@ static int MenuGameSelection()
mainWindow->Append(&titleTxt); mainWindow->Append(&titleTxt);
mainWindow->Append(&gameBrowser); mainWindow->Append(&gameBrowser);
mainWindow->Append(&buttonWindow); mainWindow->Append(&buttonWindow);
mainWindow->Append(&bgPreview); mainWindow->Append(&bgPreviewBtn);
mainWindow->Append(&preview); mainWindow->Append(&preview);
ResumeGui(); ResumeGui();
@ -1018,10 +1025,11 @@ static int MenuGameSelection()
} }
//update gamelist image //update gamelist image
if(previousBrowserIndex != browser.selIndex) if(previousBrowserIndex != browser.selIndex || previousPreviewImg != GCSettings.PreviewImage)
{ {
previousBrowserIndex = browser.selIndex; previousBrowserIndex = browser.selIndex;
snprintf(imagePath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], GCSettings.ImageFolder, browserList[browser.selIndex].displayname); previousPreviewImg = GCSettings.PreviewImage;
snprintf(imagePath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], ImageFolder(), browserList[browser.selIndex].displayname);
AllocSaveBuffer(); AllocSaveBuffer();
int width, height; int width, height;
@ -1048,6 +1056,11 @@ static int MenuGameSelection()
menu = MENU_SETTINGS; menu = MENU_SETTINGS;
else if(exitBtn.GetState() == STATE_CLICKED) else if(exitBtn.GetState() == STATE_CLICKED)
ExitRequested = 1; ExitRequested = 1;
else if(bgPreviewBtn.GetState() == STATE_CLICKED)
{
GCSettings.PreviewImage = (GCSettings.PreviewImage + 1) % 3;
bgPreviewBtn.ResetState();
}
} }
HaltParseThread(); // halt parsing HaltParseThread(); // halt parsing
@ -1056,7 +1069,7 @@ static int MenuGameSelection()
mainWindow->Remove(&titleTxt); mainWindow->Remove(&titleTxt);
mainWindow->Remove(&buttonWindow); mainWindow->Remove(&buttonWindow);
mainWindow->Remove(&gameBrowser); mainWindow->Remove(&gameBrowser);
mainWindow->Remove(&bgPreview); mainWindow->Remove(&bgPreviewBtn);
mainWindow->Remove(&preview); mainWindow->Remove(&preview);
MEM_DEALLOC(imgBuffer); MEM_DEALLOC(imgBuffer);
return menu; return menu;
@ -3803,15 +3816,12 @@ static int MenuSettingsMenu()
{ {
case 0: case 0:
sprintf(options.value[6], "Screenshots"); sprintf(options.value[6], "Screenshots");
snprintf(GCSettings.ImageFolder, MAXJOLIET, "%s", GCSettings.ScreenshotsFolder);
break; break;
case 1: case 1:
sprintf(options.value[6], "Covers"); sprintf(options.value[6], "Covers");
snprintf(GCSettings.ImageFolder, MAXJOLIET, "%s", GCSettings.CoverFolder);
break; break;
case 2: case 2:
sprintf(options.value[6], "Artwork"); sprintf(options.value[6], "Artwork");
snprintf(GCSettings.ImageFolder, MAXJOLIET, "%s", GCSettings.ArtworkFolder);
break; break;
} }
optionBrowser.TriggerUpdate(); optionBrowser.TriggerUpdate();

View File

@ -174,7 +174,6 @@ preparePrefsData ()
createXMLSetting("BorderFolder", "SGB Borders Folder", GCSettings.BorderFolder); createXMLSetting("BorderFolder", "SGB Borders Folder", GCSettings.BorderFolder);
createXMLSetting("CoverFolder", "Covers Folder", GCSettings.CoverFolder); createXMLSetting("CoverFolder", "Covers Folder", GCSettings.CoverFolder);
createXMLSetting("ArtworkFolder", "Artwork Folder", GCSettings.ArtworkFolder); createXMLSetting("ArtworkFolder", "Artwork Folder", GCSettings.ArtworkFolder);
createXMLSetting("ImageFolder", "Image Folder", GCSettings.ImageFolder);
createXMLSection("Network", "Network Settings"); createXMLSection("Network", "Network Settings");
@ -490,7 +489,6 @@ decodePrefsData ()
loadXMLSetting(GCSettings.BorderFolder, "BorderFolder", sizeof(GCSettings.BorderFolder)); loadXMLSetting(GCSettings.BorderFolder, "BorderFolder", sizeof(GCSettings.BorderFolder));
loadXMLSetting(GCSettings.CoverFolder, "CoverFolder", sizeof(GCSettings.CoverFolder)); loadXMLSetting(GCSettings.CoverFolder, "CoverFolder", sizeof(GCSettings.CoverFolder));
loadXMLSetting(GCSettings.ArtworkFolder, "ArtworkFolder", sizeof(GCSettings.ArtworkFolder)); loadXMLSetting(GCSettings.ArtworkFolder, "ArtworkFolder", sizeof(GCSettings.ArtworkFolder));
loadXMLSetting(GCSettings.ImageFolder, "ImageFolder", sizeof(GCSettings.ImageFolder));
// Network Settings // Network Settings
@ -638,7 +636,6 @@ DefaultSettings ()
sprintf (GCSettings.BorderFolder, "%s/borders", APPFOLDER); sprintf (GCSettings.BorderFolder, "%s/borders", APPFOLDER);
sprintf (GCSettings.CoverFolder, "%s/covers", APPFOLDER); // Path to cover files sprintf (GCSettings.CoverFolder, "%s/covers", APPFOLDER); // Path to cover files
sprintf (GCSettings.ArtworkFolder, "%s/artwork", APPFOLDER); // Path to artwork files sprintf (GCSettings.ArtworkFolder, "%s/artwork", APPFOLDER); // Path to artwork files
sprintf (GCSettings.ImageFolder, "%s/screenshots", APPFOLDER);
GCSettings.AutoLoad = 1; GCSettings.AutoLoad = 1;
GCSettings.AutoSave = 1; GCSettings.AutoSave = 1;

View File

@ -469,3 +469,13 @@ int main(int argc, char *argv[])
} // main loop } // main loop
return 0; return 0;
} }
char* ImageFolder()
{
switch(GCSettings.PreviewImage)
{
case 1 : return GCSettings.CoverFolder; break;
case 2 : return GCSettings.ArtworkFolder; break;
default: return GCSettings.ScreenshotsFolder; break;
}
}

View File

@ -107,7 +107,6 @@ struct SGCSettings
char ScreenshotsFolder[MAXPATHLEN]; //Path to screenshots files char ScreenshotsFolder[MAXPATHLEN]; //Path to screenshots files
char CoverFolder[MAXPATHLEN]; //Path to cover files char CoverFolder[MAXPATHLEN]; //Path to cover files
char ArtworkFolder[MAXPATHLEN]; //Path to artwork files char ArtworkFolder[MAXPATHLEN]; //Path to artwork files
char ImageFolder[MAXPATHLEN]; //Saved image folder path
char BorderFolder[MAXPATHLEN]; // Path to Super Game Boy border files char BorderFolder[MAXPATHLEN]; // Path to Super Game Boy border files
char smbip[80]; char smbip[80];
@ -115,6 +114,9 @@ struct SGCSettings
char smbpwd[20]; char smbpwd[20];
char smbshare[20]; char smbshare[20];
}; };
char* ImageFolder();
void ExitApp(); void ExitApp();
void ShutdownWii(); void ShutdownWii();
bool SupportedIOS(u32 ios); bool SupportedIOS(u32 ios);