Skip to content

Commit

Permalink
Show GB icon for .gb ROMs
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Feb 19, 2018
1 parent 7c25c5b commit c11a024
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
14 changes: 12 additions & 2 deletions romsel_dsimenutheme/arm9/source/fileBrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,18 @@ string browseForFile(const vector<string> extensionList, const char* username)
spawnedtitleboxes = 0;
for(int i = 0; i < 40; i++) {
if (i+pagenum*40 < file_count) {
if (romtype == 0) getGameInfo(dirContents[scrn].at(i+pagenum*40).isDirectory, dirContents[scrn].at(i+pagenum*40).name.c_str(), i);
else {
if (romtype == 0) {
getGameInfo(dirContents[scrn].at(i+pagenum*40).isDirectory, dirContents[scrn].at(i+pagenum*40).name.c_str(), i);
} else if (romtype == 1) {
std::string std_romsel_filename = dirContents[scrn].at(i+pagenum*40).name.c_str();
if(std_romsel_filename.substr(std_romsel_filename.find_last_of(".") + 1) == "gbc") {
isGBC[i] = true;
} else {
isGBC[i] = false;
}
launchable[i] = true;
isHomebrew[i] = false;
} else {
launchable[i] = true;
isHomebrew[i] = false;
}
Expand Down
8 changes: 2 additions & 6 deletions romsel_dsimenutheme/arm9/source/graphics/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@
#include "org_box_empty.h"
#include "_3ds_box_empty.h"

// Built-in icons
#include "icon_gbc.h"
#include "icon_nes.h"

#include "../iconTitle.h"
#include "graphics.h"
#include "fontHandler.h"
Expand Down Expand Up @@ -277,7 +273,7 @@ void vBlankHandler()
for(int i = 0; i < 40; i++) {
if (i < spawnedtitleboxes) {
glSprite(spawnedboxXpos-titleboxXpos, titleboxYpos, GL_FLIP_NONE, boxfullImage);
if (romtype == 1) drawIconGBC(iconXpos-titleboxXpos, titleboxYpos+12);
if (romtype == 1) drawIconGBC(iconXpos-titleboxXpos, titleboxYpos+12, i);
else if (romtype == 2) drawIconNES(iconXpos-titleboxXpos, titleboxYpos+12);
else drawIcon(iconXpos-titleboxXpos, titleboxYpos+12, i);
} else
Expand All @@ -295,7 +291,7 @@ void vBlankHandler()
}
}
glSprite(96, 84-titleboxYmovepos, GL_FLIP_NONE, boxfullImage);
if (romtype == 1) drawIconGBC(112, 96-titleboxYmovepos);
if (romtype == 1) drawIconGBC(112, 96-titleboxYmovepos, cursorPosition);
else if (romtype == 2) drawIconNES(112, 96-titleboxYmovepos);
else drawIcon(112, 96-titleboxYmovepos, cursorPosition);
titleboxYmovepos += 5;
Expand Down
8 changes: 6 additions & 2 deletions romsel_dsimenutheme/arm9/source/iconTitle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,13 @@ void drawIcon(int Xpos, int Ypos, int num)
glSprite(Xpos, Ypos, bannerFlip[num], &ndsIcon[num2][bnriconPalLine[num]][bnriconframenumY[num] & 31]);
}

void drawIconGBC(int Xpos, int Ypos)
void drawIconGBC(int Xpos, int Ypos, int num)
{
glSprite(Xpos, Ypos, GL_FLIP_NONE, gbcIcon);
if(isGBC[num]) {
glSprite(Xpos, Ypos, GL_FLIP_NONE, gbcIcon);
} else {
glSprite(Xpos, Ypos, GL_FLIP_NONE, gbIcon);
}
}
void drawIconNES(int Xpos, int Ypos)
{
Expand Down
2 changes: 1 addition & 1 deletion romsel_dsimenutheme/arm9/source/iconTitle.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ void getGameInfo(bool isDir, const char* name, int num);
void iconUpdate(bool isDir, const char* name, int num);
void titleUpdate(bool isDir, const char* name);
void drawIcon(int Xpos, int Ypos, int num);
void drawIconGBC(int Xpos, int Ypos);
void drawIconGBC(int Xpos, int Ypos, int num);
void drawIconNES(int Xpos, int Ypos);
1 change: 1 addition & 0 deletions romsel_dsimenutheme/arm9/source/ndsheaderbanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ int bnriconframenumY[40] = {0};
int bannerFlip[40] = {GL_FLIP_NONE};

// bnriconisDSi[]
bool isGBC[40] = {false};
bool bnriconisDSi[40] = {false};
bool launchable[40] = {true};
bool isHomebrew[40] = {false};
Expand Down
1 change: 1 addition & 0 deletions romsel_dsimenutheme/arm9/source/ndsheaderbanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ extern int bnriconframenumY[40];
extern int bannerFlip[40];

// bnriconisDSi[]
extern bool isGBC[40];
extern bool bnriconisDSi[40];
extern bool launchable[40];
extern bool isHomebrew[40];
Expand Down

0 comments on commit c11a024

Please sign in to comment.