mirror of
https://github.com/ApacheThunder/NTR_Launcher.git
synced 2025-06-19 03:25:38 -04:00

Removed some features that would see little use like the TWL mode option and the enable SD option. MBK init code moved and always used. Sets MBK to proper values for NTR mode (as documented in No$GBA). Since this build is now intended to be launched from a patched DSi System Menu, the touch screen mode change code has been removed and and this no longer requires a custom libnds build that isn't really available anywhere right now. :P
102 lines
2.7 KiB
C++
Executable File
102 lines
2.7 KiB
C++
Executable File
/*
|
|
NitroHax -- Cheat tool for the Nintendo DS
|
|
Copyright (C) 2008 Michael "Chishm" Chisholm
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <nds.h>
|
|
#include <fat.h>
|
|
#include <nds/fifocommon.h>
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <malloc.h>
|
|
#include <list>
|
|
|
|
#include "inifile.h"
|
|
#include "bootsplash.h"
|
|
#include "nds_card.h"
|
|
#include "launch_engine.h"
|
|
#include "crc.h"
|
|
#include "version.h"
|
|
|
|
// #define REG_ROMCTRL (*(vu32*)0x40001A4)
|
|
// #define REG_SCFG_ROM (*(vu32*)0x4004000)
|
|
// #define REG_SCFG_CLK (*(vu32*)0x4004004)
|
|
// #define REG_SCFG_EXT (*(vu32*)0x4004008)
|
|
// #define REG_SCFG_MC (*(vu32*)0x4004010)
|
|
|
|
int main() {
|
|
|
|
// defaultExceptionHandler();
|
|
|
|
bool TWLCLOCK = false;
|
|
|
|
// If slot is powered off, tell Arm7 slot power on is required.
|
|
if(REG_SCFG_MC == 0x11) { fifoSendValue32(FIFO_USER_02, 1); }
|
|
if(REG_SCFG_MC == 0x10) { fifoSendValue32(FIFO_USER_02, 1); }
|
|
|
|
u32 ndsHeader[0x80];
|
|
char gameid[4];
|
|
|
|
BootSplashInit();
|
|
|
|
if (fatInitDefault()) {
|
|
CIniFile ntrlauncher_config( "sd:/nds/NTR_Launcher.ini" );
|
|
|
|
if(ntrlauncher_config.GetInt("NTRLAUNCHER","RESETSLOT1",0) == 0) { /* */ } else {
|
|
fifoSendValue32(FIFO_USER_02, 1);
|
|
fifoSendValue32(FIFO_USER_04, 1);
|
|
}
|
|
|
|
if(ntrlauncher_config.GetInt("NTRLAUNCHER","TWLCLOCK",0) == 0) {
|
|
fifoSendValue32(FIFO_USER_05, 1);
|
|
REG_SCFG_CLK = 0x80;
|
|
swiWaitForVBlank();
|
|
} else { REG_SCFG_CLK = 0x85; TWLCLOCK = true; }
|
|
|
|
} else {
|
|
fifoSendValue32(FIFO_USER_02, 1);
|
|
fifoSendValue32(FIFO_USER_04, 1);
|
|
}
|
|
|
|
// Tell Arm7 it's ready for card reset (if card reset is nessecery)
|
|
fifoSendValue32(FIFO_USER_01, 1);
|
|
// Waits for Arm7 to finish card reset (if nessecery)
|
|
fifoWaitValue32(FIFO_USER_03);
|
|
|
|
for (int i = 0; i < 40; i++) { swiWaitForVBlank(); }
|
|
|
|
sysSetCardOwner (BUS_OWNER_ARM9);
|
|
|
|
getHeader (ndsHeader);
|
|
|
|
for (int i = 0; i < 40; i++) { swiWaitForVBlank(); }
|
|
|
|
memcpy (gameid, ((const char*)ndsHeader) + 12, 4);
|
|
|
|
while(1) {
|
|
if(REG_SCFG_MC == 0x11) {
|
|
ErrorScreen();
|
|
for (int i = 0; i < 300; i++) { swiWaitForVBlank(); }
|
|
break;
|
|
} else {
|
|
runLaunchEngine(TWLCLOCK);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|