From c11a024aed07002e51e013c52c48f66b3b371349 Mon Sep 17 00:00:00 2001 From: Robz8 Date: Mon, 19 Feb 2018 11:42:39 -0700 Subject: [PATCH] Show GB icon for .gb ROMs --- romsel_dsimenutheme/arm9/source/fileBrowse.cpp | 14 ++++++++++++-- .../arm9/source/graphics/graphics.cpp | 8 ++------ romsel_dsimenutheme/arm9/source/iconTitle.cpp | 8 ++++++-- romsel_dsimenutheme/arm9/source/iconTitle.h | 2 +- .../arm9/source/ndsheaderbanner.cpp | 1 + romsel_dsimenutheme/arm9/source/ndsheaderbanner.h | 1 + 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/romsel_dsimenutheme/arm9/source/fileBrowse.cpp b/romsel_dsimenutheme/arm9/source/fileBrowse.cpp index 73f274644d..c7530e7859 100644 --- a/romsel_dsimenutheme/arm9/source/fileBrowse.cpp +++ b/romsel_dsimenutheme/arm9/source/fileBrowse.cpp @@ -349,8 +349,18 @@ string browseForFile(const vector 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; } diff --git a/romsel_dsimenutheme/arm9/source/graphics/graphics.cpp b/romsel_dsimenutheme/arm9/source/graphics/graphics.cpp index 1dac4a318b..6f66cbaaa6 100644 --- a/romsel_dsimenutheme/arm9/source/graphics/graphics.cpp +++ b/romsel_dsimenutheme/arm9/source/graphics/graphics.cpp @@ -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" @@ -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 @@ -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; diff --git a/romsel_dsimenutheme/arm9/source/iconTitle.cpp b/romsel_dsimenutheme/arm9/source/iconTitle.cpp index abafe81585..8c6bc6c223 100644 --- a/romsel_dsimenutheme/arm9/source/iconTitle.cpp +++ b/romsel_dsimenutheme/arm9/source/iconTitle.cpp @@ -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) { diff --git a/romsel_dsimenutheme/arm9/source/iconTitle.h b/romsel_dsimenutheme/arm9/source/iconTitle.h index 197fcba65e..6569c16b91 100644 --- a/romsel_dsimenutheme/arm9/source/iconTitle.h +++ b/romsel_dsimenutheme/arm9/source/iconTitle.h @@ -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); diff --git a/romsel_dsimenutheme/arm9/source/ndsheaderbanner.cpp b/romsel_dsimenutheme/arm9/source/ndsheaderbanner.cpp index 77ca72e35d..a5177bf7ba 100644 --- a/romsel_dsimenutheme/arm9/source/ndsheaderbanner.cpp +++ b/romsel_dsimenutheme/arm9/source/ndsheaderbanner.cpp @@ -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}; diff --git a/romsel_dsimenutheme/arm9/source/ndsheaderbanner.h b/romsel_dsimenutheme/arm9/source/ndsheaderbanner.h index aa015b6f25..722624b4c9 100644 --- a/romsel_dsimenutheme/arm9/source/ndsheaderbanner.h +++ b/romsel_dsimenutheme/arm9/source/ndsheaderbanner.h @@ -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];