Skip to content

Commit

Permalink
Move gbaSwitch function to a new .cpp file
Browse files Browse the repository at this point in the history
ALSO: Add GBA borders for later use
  • Loading branch information
RocketRobz committed Feb 22, 2018
1 parent 3b8632b commit 080d79d
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
15 changes: 4 additions & 11 deletions romsel_dsimenutheme/arm9/source/fileBrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "graphics/TextPane.h"
#include "SwitchState.h"

#include "gbaswitch.h"
#include "ndsLoaderArm9.h"

#include "inifile.h"
Expand Down Expand Up @@ -623,22 +624,14 @@ string browseForFile(const vector<string> extensionList, const char* username)
for (int i = 0; i < 4; i++) swiWaitForVBlank();
SaveSettings();

int err = 0;
if (cursorPosition == -2) {
// Launch settings
err = runNdsFile ("/_nds/srloader/main.srldr", 0, NULL, false);
int err = runNdsFile ("/_nds/srloader/main.srldr", 0, NULL, false);
iprintf ("Start failed. Error %i\n", err);
} else if (cursorPosition == -1) {
// Clear VRAM A and B to show black border for GBA mode
vramSetBankA(VRAM_A_MAIN_BG);
vramSetBankB(VRAM_B_MAIN_BG);
for (u32 i = 0; i < 0x80000; i++) {
*(u32*)(0x06000000+i) = 0;
*(u32*)(0x06200000+i) = 0;
}
// Switch to GBA mode
err = runNdsFile ("/_nds/srloader/gbaswitch.srldr", 0, NULL, false);
gbaSwitch();
}
iprintf ("Start failed. Error %i\n", err);
}

DirEntry* entry = &dirContents[scrn].at(cursorPosition+pagenum*40);
Expand Down
31 changes: 31 additions & 0 deletions romsel_dsimenutheme/arm9/source/gbaswitch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "gbaswitch.h"
#include "ndsLoaderArm9.h"

//#include "gbaframe.h"
//#include "gbaframe_srloader.h"

//int gbaBorder = 0;

void gbaSwitch(void) {
vramSetBankA(VRAM_A_MAIN_BG);
vramSetBankB(VRAM_B_MAIN_BG);
/*if (gbaBorder == 2) {
int bg3 = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 0,0);
dmaCopy(gbaframe_srloaderBitmap, bgGetGfxPtr(bg3), 256*256);
dmaCopy(gbaframe_srloaderPal, BG_PALETTE, 256*2);
} else if (gbaBorder == 1) {
int bg3 = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 0,0);
dmaCopy(gbaframeBitmap, bgGetGfxPtr(bg3), 256*256);
dmaCopy(gbaframePal, BG_PALETTE, 256*2);
} else {*/
// Clear VRAM A and B to show black border for GBA mode
for (u32 i = 0; i < 0x80000; i++) {
*(u32*)(0x06000000+i) = 0;
*(u32*)(0x06200000+i) = 0;
}
//}
// Switch to GBA mode
runNdsFile ("/_nds/srloader/gbaswitch.srldr", 0, NULL, false);
}
8 changes: 8 additions & 0 deletions romsel_dsimenutheme/arm9/source/gbaswitch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef GBASWITCH_H
#define GBASWITCH_H

#include <nds.h>

extern void gbaSwitch();

#endif // GBASWITCH_H
Binary file added romsel_dsimenutheme/gfx_saveforlater/gbaframe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added romsel_dsimenutheme/resources/gbaframe.bmp
Binary file not shown.
Binary file added romsel_dsimenutheme/resources/gbaframe_ak2.bmp
Binary file not shown.
2 changes: 1 addition & 1 deletion titleandsettings/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ int main(int argc, char **argv) {

char vertext[12];
// snprintf(vertext, sizeof(vertext), "Ver %d.%d.%d ", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); // Doesn't work :(
snprintf(vertext, sizeof(vertext), "Ver %d.%d.%d ", 3, 2, 1);
snprintf(vertext, sizeof(vertext), "Ver %d.%d.%d ", 3, 2, 2);

if (showlogo) {
graphicsInit();
Expand Down

0 comments on commit 080d79d

Please sign in to comment.