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
77 lines
2.0 KiB
C
77 lines
2.0 KiB
C
/*
|
|
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 <string.h>
|
|
#include <nds.h>
|
|
|
|
#include "load_bin.h"
|
|
#include "launch_engine.h"
|
|
|
|
#define LCDC_BANK_C (u16*)0x06840000
|
|
|
|
void vramcpy (void* dst, const void* src, int len)
|
|
{
|
|
u16* dst16 = (u16*)dst;
|
|
u16* src16 = (u16*)src;
|
|
|
|
for ( ; len > 0; len -= 2) {
|
|
*dst16++ = *src16++;
|
|
}
|
|
}
|
|
|
|
// Basic engine with no cheat related code.
|
|
// void runLaunchEngine (bool TWLCLOCK, bool EnableSD)
|
|
void runLaunchEngine(bool TWLCLOCK)
|
|
{
|
|
|
|
irqDisable(IRQ_ALL);
|
|
|
|
// Direct CPU access to VRAM bank C
|
|
VRAM_C_CR = VRAM_ENABLE | VRAM_C_LCD;
|
|
|
|
// Clear VRAM
|
|
memset (LCDC_BANK_C, 0x00, 128 * 1024);
|
|
|
|
// Load the loader/patcher into the correct address
|
|
vramcpy (LCDC_BANK_C, load_bin, load_bin_size);
|
|
|
|
// Give the VRAM to the ARM7
|
|
VRAM_C_CR = VRAM_ENABLE | VRAM_C_ARM7_0x06000000;
|
|
|
|
// Reset into a passme loop
|
|
REG_EXMEMCNT |= ARM7_OWNS_ROM | ARM7_OWNS_CARD;
|
|
|
|
*((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;
|
|
|
|
if( TWLCLOCK ) { REG_SCFG_EXT=0x03002000; } else { REG_SCFG_EXT=0x03000000; }
|
|
|
|
*((vu32*)0x027FFFFC) = 0;
|
|
*((vu32*)0x027FFE04) = (u32)0xE59FF018;
|
|
*((vu32*)0x027FFE24) = (u32)0x027FFE04;
|
|
swiSoftReset();
|
|
}
|
|
|