diff --git a/Makefile b/Makefile index 5514991..6a5b86e 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ SOURCES := source DATA := data INCLUDES := include EXEFS_SRC := exefs_src -ROMFS := romfs +ROMFS := romfs APP_TITLE := BOTW UI APP_AUTHOR := Jpe230 diff --git a/include/MainMenu.h b/include/MainMenu.h index 25b6175..a8ce85f 100644 --- a/include/MainMenu.h +++ b/include/MainMenu.h @@ -12,7 +12,7 @@ SDL_Surface* screenSurface; SDL_Renderer* renderer; TTF_Font *Arial, *Arial_S, *Arial_M; SDL_Texture *sprites[200]; -SDL_Texture *saveFileImg[6]; +SDL_Texture *saveFileImg[8]; SDL_Texture *GreenRupee; SDL_Texture *back; SDL_Texture *bbutton; diff --git a/include/main.h b/include/main.h index e9f8188..f71de20 100644 --- a/include/main.h +++ b/include/main.h @@ -23,6 +23,7 @@ int positionKey; int key; int number; int currentItem; +int maxSlot; int main(int argc, char **argv); void startSDLServices(); @@ -42,7 +43,7 @@ void dropMenuButtons(int x); void KeyboardLogic(); void exitMen(); int file_exist (char *filename); - +void getCaption(); diff --git a/source/main.c b/source/main.c index ac65cd3..979be51 100644 --- a/source/main.c +++ b/source/main.c @@ -37,23 +37,27 @@ void startSDLServices(){ errorScreen(); } else{ - for(int x = 0; x < 6; x++){ - char nameFile_S[22]; - snprintf(nameFile_S, sizeof nameFile_S, "save:/%d/caption.jpg", x); - - if(file_exist (nameFile_S)){ - SDL_LoadImage(renderer, &saveFileImg[x], nameFile_S); - } - else{ - SDL_LoadImage(renderer, &saveFileImg[x], "romfs:/missingSlot.png"); - } - } - + getCaption(); selectSlotMenu(slot); } } + +void getCaption(){ + for(int x = 0; x < (maxSlot + 1); x++){ + char nameFile_S[29]; + snprintf(nameFile_S, sizeof nameFile_S, "save:/%d/caption.jpg", x); + + if(file_exist (nameFile_S)){ + SDL_LoadImage(renderer, &saveFileImg[x], nameFile_S); + } + else{ + SDL_LoadImage(renderer, &saveFileImg[x], "romfs:/missingSlot.png"); + } + } +} + int file_exist (char *filename) { FILE *file = fopen(filename, "r"); @@ -71,6 +75,7 @@ void initServices(){ currentPage = 1; currentState = 0; currentItem = 0; + maxSlot = 5; romfsInit(); startSDLServices(); @@ -238,13 +243,13 @@ void MenuButtonsSlot(int x){ switch(x){ case 2: slot++; - if(slot == 6) + if(slot == maxSlot + 1) slot = 0; break; case 3: slot--; if(slot == -1) - slot = 5; + slot = maxSlot; break; } @@ -498,6 +503,18 @@ int main(int argc, char **argv){ if (kDown & KEY_DLEFT) buttonLogic(3); if (kDown & KEY_A) ConfirmButton(); + if(currentState == 0 && kDown & KEY_R){ + if(maxSlot == 7){ + maxSlot = 5; + } + else{ + maxSlot = 7; + } + slot = 0; + getCaption(); + selectSlotMenu(slot); + } + if(currentState != 0){ if (kDown & KEY_B) BackButton(); if (kDown & KEY_Y) RupeeKey();