Skip to content

Commit

Permalink
Fix text for debug console...
Browse files Browse the repository at this point in the history
* Fixed mistake that caused misaligned console text when debug mode is
enabled.
  • Loading branch information
ApacheThunder committed Oct 31, 2023
1 parent 24d8428 commit 30f6948
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 43 deletions.
13 changes: 2 additions & 11 deletions BootLoader/source/main.arm7.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,24 +533,15 @@ void arm7_main (void) {
while (ipcRecvState() != ARM9_READY);

if (twlMode) {
*((vu32*)REG_MBK1)=0x8D898581;
*((vu32*)REG_MBK2)=0x8C888480;
*((vu32*)REG_MBK3)=0x9C989490;
*((vu32*)REG_MBK4)=0x8C888480;
*((vu32*)REG_MBK5)=0x9C989490;
REG_MBK9=0x0300000F;
REG_MBK6=0x080037C0;
REG_MBK7=0x07C03740;
REG_MBK8=0x07403700;
} else {
*((vu32*)REG_MBK1)=0x8D898581;
*((vu32*)REG_MBK2)=0x8C888480;
*((vu32*)REG_MBK3)=0x9C989490;
*((vu32*)REG_MBK4)=0x8C888480;
*((vu32*)REG_MBK5)=0x9C989490;
REG_MBK9=0xFCFFFF0F;
REG_MBK6=0x09403900;
REG_MBK7=0x09803940;
REG_MBK8=0x09C03980;
REG_MBK9=0xFCFFFF0F;
}

errorOutput(ERR_STS_CLR_MEM, false);
Expand Down
19 changes: 13 additions & 6 deletions BootLoader/source/main.arm9.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,24 @@ void arm9_main (void) {
if (tmpData->debugMode == 0x01)debugMode = true;

if (TWLMODE) {
*((vu32*)REG_MBK1)=0x8D898581;
*((vu32*)REG_MBK2)=0x8C888480;
*((vu32*)REG_MBK3)=0x9C989490;
*((vu32*)REG_MBK4)=0x8C888480;
*((vu32*)REG_MBK5)=0x9C989490;
REG_MBK6=0x00000000;
REG_MBK7=0x07C03740;
REG_MBK8=0x07403700;
REG_MBK9=0x0300000F;
} else {
// MBK settings for NTR mode games
REG_MBK6=0x00003000;
REG_MBK7=0x00003000;
REG_MBK8=0x00003000;
REG_MBK9=0xFCFFFF0F;
*((vu32*)REG_MBK1)=0x8D898581;
*((vu32*)REG_MBK2)=0x91898581;
*((vu32*)REG_MBK3)=0x91999591;
*((vu32*)REG_MBK4)=0x91898581;
*((vu32*)REG_MBK5)=0x91999591;
REG_MBK6 = 0x00003000;
REG_MBK7 = 0x00003000;
REG_MBK8 = 0x00003000;
}

//set shared ram to ARM7
Expand All @@ -188,7 +196,6 @@ void arm9_main (void) {
REG_IE = 0;
REG_IF = ~0;


if (debugMode)arm9_errorCode = ERR_STS_START;

// Synchronise start
Expand Down
2 changes: 1 addition & 1 deletion BootLoader/source/reset.arm7.s
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ arm7_reset:
@ ipcSendState(ARM7_BOOT)
strh r0, [r12]

ldr r0,=0x2FFFE34
ldr r0,=0x27FFE34

ldr r0,[r0]
bx r0
Expand Down
2 changes: 1 addition & 1 deletion BootLoader/source/reset.arm9.s
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ arm9_reset:
@ while (ipcRecvState() != ARM7_BOOT);
bl waitsync

ldr r10, =0x2FFFE24
ldr r10, =0x27FFE24
ldr r2, [r10]

@ Switch MPU to startup default
Expand Down
43 changes: 19 additions & 24 deletions arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,14 @@ extern void InitConsole();

extern bool ConsoleInit;

void DisplayText(const char* text, bool clear = false, bool clearOnly = false){
void DisplayText(const char* text, bool clear = false, bool noText = false){
if (!ConsoleInit)InitConsole();
if (clear || clearOnly)consoleClear();
if (!clearOnly) {
printf("--------------------------------\n");
printf("----[NTR Launcher Debug Mode]---\n");
printf("----------[Version: 2.7]--------\n");
printf("--------------------------------\n\n");
}
printf(text);
if (clear)consoleClear();
printf("--------------------------------\n");
printf("----[NTR Launcher Debug Mode]---\n");
printf("----------[Version: 2.7]--------\n");
printf("--------------------------------\n\n");
if (!noText)printf(text);
}

void DoWait(int waitTime = 30){
Expand All @@ -73,7 +71,7 @@ void DoWait(int waitTime = 30){

void DoCardInit(bool DebugMode) {
if (DebugMode){
DisplayText("CLEARONLY", true);
DisplayText("CLR", true, true);
DisplayText("Loading Cart details.\nPlease Wait...\n", true);
}
// Do cart init stuff to wake cart up. DLDI init may fail otherwise!
Expand All @@ -82,28 +80,29 @@ void DoCardInit(bool DebugMode) {
tonccpy(gameCode, ndsHeader.gameCode, 6);
DoWait(60);
if (DebugMode) {
DisplayText("CLEARONLY", true, true);
DisplayText("CLR", true, true);
iprintf("Detected Cart Name: %12s \n", gameTitle);
iprintf("Detected Cart Game ID: %6s \n\n", gameCode);
DisplayText("Press any button to continue...");
printf("Press any button to continue...");
do { swiWaitForVBlank(); scanKeys(); } while (!keysDown());
}
}

void ResetSlot1() {
if (REG_SCFG_MC == 0x11) return;
/*void ResetSlot1() {
if (REG_SCFG_MC == 0x11)return;
disableSlot1();
DoWait();
enableSlot1();
}
}*/

void DoSlotCheck(bool DebugMode) {
if (REG_SCFG_MC == 0x11) {
if(!ConsoleInit)InitConsole();
if(DebugMode) {
DisplayText("Please insert a cartridge...\n", true, false);
DisplayText("Please insert a cartridge...\n", true);
} else {
DisplayText("\n\n\n\n\n\n\n\n\n\n\n Please insert a cartridge... ", true, true);
if (!ConsoleInit)InitConsole();
consoleClear();
printf("\n\n\n\n\n\n\n\n\n\n\n Please insert a cartridge... ");
}
REDO:
swiWaitForVBlank();
Expand Down Expand Up @@ -157,11 +156,7 @@ int main() {
} else {
char *p = (char*)PersonalData->name;
for (int i = 0; i < 10; i++) {
if (p[i*2] == 0x00) {
p[i*2/2] = 0;
} else {
p[i*2/2] = p[i*2];
}
if (p[i*2] == 0x00) { p[i*2/2] = 0; } else { p[i*2/2] = p[i*2]; }
}
if (language == -1) language = (PersonalData->language);
BootSplashInit(UseNTRSplash, HealthAndSafety_MSG, language, false);
Expand All @@ -179,7 +174,7 @@ int main() {

while(1) {
// If SCFG_MC is returning as zero/null, this means SCFG_EXT registers are locked on arm9 or user attempted to run this while in NTR mode.
if((REG_SCFG_MC == 0x00) | (REG_SCFG_MC == 0x11) | (REG_SCFG_MC == 0x10)) {
if((REG_SCFG_MC == 0x00) || (REG_SCFG_MC == 0x11) || (REG_SCFG_MC == 0x10)) {
if (UseAnimatedSplash) {
BootSplashInit(false, false, 0, true);
} else {
Expand Down

0 comments on commit 30f6948

Please sign in to comment.