Skip to content

Commit

Permalink
Added support to Master Mode
Browse files Browse the repository at this point in the history
(Press R to activate the 2 slots for Master Mode)
  • Loading branch information
Jpe230 committed Jun 22, 2018
1 parent 3df74fa commit 9c6c3fb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/MainMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ int positionKey;
int key;
int number;
int currentItem;
int maxSlot;

int main(int argc, char **argv);
void startSDLServices();
Expand All @@ -42,7 +43,7 @@ void dropMenuButtons(int x);
void KeyboardLogic();
void exitMen();
int file_exist (char *filename);

void getCaption();



Expand Down
45 changes: 31 additions & 14 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -71,6 +75,7 @@ void initServices(){
currentPage = 1;
currentState = 0;
currentItem = 0;
maxSlot = 5;
romfsInit();
startSDLServices();

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 9c6c3fb

Please sign in to comment.