Skip to content

Commit

Permalink
Revert last commit + Add NTR mode switch
Browse files Browse the repository at this point in the history
This no longer needs dev launcher patch to work. Reverted last commit
because MPU change broke akloader when attempting to boot a retail rom.

Touch screen is not working in the menu (this does not impact games
however). Related to new mode switch. A force DS touchscreen function is
needed for this to be fixed.

The touch screen works fine however if you boot it from ntr mode hbmenu
or NTR Bootstrap.
  • Loading branch information
ApacheThunder committed Sep 19, 2016
1 parent 08e83e8 commit 9cb22d2
Show file tree
Hide file tree
Showing 32 changed files with 190 additions and 53 deletions.
4 changes: 3 additions & 1 deletion akloader/arm7/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,7 @@ int main(int argc,char** argv)
fifoSetValue32Handler(FIFO_USER_04, resetMsgHandler, 0);

// Keep the ARM7 out of main RAM
while(true) swiWaitForVBlank();
// while(true) swiWaitForVBlank();
while(1) { swiWaitForVBlank(); }
}

7 changes: 4 additions & 3 deletions akloader/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,15 @@ int main(void)
resetInterrupts();
resetAndLoop();

}
else {
}
else {
dbg_printf("load (%s)fail\n", filename );
#ifdef NDS_BOOT
showMsg( MSGID_SYS_FILE_MISSING, MSG_COLOR ); //boot nds
#endif//NDS_BOOT
return 1;
}

while(1) { swiWaitForVBlank(); }
return 0;
}

43 changes: 27 additions & 16 deletions akmenu4/arm7/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,28 +161,39 @@ int main()
//nocashMessage("reset!");
//swiSoftReset();

nocashMessage("ARM7 main.cpp main");
//mute sound
if(2==getSystem()) writePowerManagement(PM_CONTROL_REG,(readPowerManagement(PM_CONTROL_REG)&~PM_SOUND_AMP)|PM_SOUND_MUTE);
//switch on backlight on both screens
writePowerManagement(PM_CONTROL_REG,readPowerManagement(PM_CONTROL_REG)|PM_BACKLIGHT_BOTTOM|PM_BACKLIGHT_TOP);
nocashMessage("ARM7 main.cpp main");

// read User Settings from firmware
readUserSettings();
volatile u32* SCFG_ROM = (volatile u32*)0x4004000;
volatile u32* SCFG_CLK = (volatile u32*)0x4004004;
volatile u32* SCFG_EXT = (volatile u32*)0x4004008;

*SCFG_ROM = 0x703;
*SCFG_CLK = 0x0181;
*SCFG_EXT = 0x13A40000;

irqInit();
fifoInit();
//mute sound
if(2==getSystem()) writePowerManagement(PM_CONTROL_REG,(readPowerManagement(PM_CONTROL_REG)&~PM_SOUND_AMP)|PM_SOUND_MUTE);
//switch on backlight on both screens
writePowerManagement(PM_CONTROL_REG,readPowerManagement(PM_CONTROL_REG)|PM_BACKLIGHT_BOTTOM|PM_BACKLIGHT_TOP);

// Start the RTC tracking IRQ
initClockIRQ();
// read User Settings from firmware
readUserSettings();

fifoSetValue32Handler(FIFO_USER_01,menuValue32Handler,0);
irqInit();
fifoInit();

installSystemFIFO();
// Start the RTC tracking IRQ
initClockIRQ();

irqSet(IRQ_VBLANK,VblankHandler);
fifoSetValue32Handler(FIFO_USER_01,menuValue32Handler,0);

irqEnable(IRQ_VBLANK|IRQ_NETWORK);
installSystemFIFO();

while(true) swiWaitForVBlank();
irqSet(IRQ_VBLANK,VblankHandler);

irqEnable(IRQ_VBLANK|IRQ_NETWORK);

// while(true) swiWaitForVBlank();
while(1) { swiWaitForVBlank(); }
}

23 changes: 14 additions & 9 deletions akmenu4/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ int main(void)
{
nocashMessage("ARM9 main.cpp main");

volatile u32* SCFG_ROM = (volatile u32*)0x4004000;
volatile u32* SCFG_CLK = (volatile u32*)0x4004004;
volatile u32* SCFG_EXT = (volatile u32*)0x4004008;

*SCFG_CLK = 0x80;
*SCFG_EXT = 0x03000000;

irq().init();

windowManager();
Expand All @@ -163,12 +170,9 @@ int main(void)
// init graphics
gdi().init();
#ifdef DEBUG
gdi().switchSubEngineMode();
#endif//DEBUG
// gdi().switchSubEngineMode();
#endif
dbg_printf( "gdi ok\n" );
unsigned int * SCFG_ROM= (unsigned int*)0x4004000;
unsigned int * SCFG_CLK= (unsigned int*)0x4004004;
unsigned int * SCFG_EXT= (unsigned int*)0x4004008;

dbg_printf( "SCFG_ROM %x\n", *SCFG_ROM ); // DS MODE 80
dbg_printf( "SCFG_CLK %x\n", *SCFG_CLK ); // DS MODE 80
Expand All @@ -184,7 +188,8 @@ int main(void)
dbg_printf( "init fat %d\n", succ );
dbg_printf( "init elm %d\n", succ2 );

wait_press_b();
// Debug Pause. Disabled for now
// wait_press_b();

// setting scripts
gs().loadSettings();
Expand Down Expand Up @@ -335,8 +340,8 @@ int main(void)

if(*(u32*)0x04000604) fifoSendValue32(FIFO_USER_01,MENU_MSG_SHUTDOWN);

while( true )
{
// while( true ) {
while(1) {
timer().updateFps();

INPUT & inputs = updateInput();
Expand All @@ -349,6 +354,6 @@ int main(void)

gdi().present( GE_MAIN );
}

return 0;
}

9 changes: 0 additions & 9 deletions libunds/source/arm7/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,6 @@ void sdmmcValueHandler(u32 value, void* user_data) {
//---------------------------------------------------------------------------------
void installSystemFIFO(void) {
//---------------------------------------------------------------------------------
unsigned int * SCFG_CLK= (unsigned int*)0x4004004;
unsigned int * SCFG_EXT= (unsigned int*)0x4004008;

//*SCFG_EXT = 0x93FFFB06;
//*SCFG_EXT = 0x93FFFF07; // TWL value
//*SCFG_CLK = 0x0187; // TWL value
*SCFG_EXT |= 0x830F0100; // NAND ACCESS
*SCFG_CLK |= 1; // NAND ACCESS


fifoSetValue32Handler(FIFO_PM, powerValueHandler, 0);
fifoSetValue32Handler(FIFO_SDMMC, sdmmcValueHandler, 0);
Expand Down
13 changes: 2 additions & 11 deletions libunds/source/arm9/system/initSystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ void __attribute__((weak)) initSystem(void) {
__syscalls.exit = __libnds_exit;
irqEnable(IRQ_VBLANK);

unsigned int * SCFG_CLK= (unsigned int*)0x4004004;
unsigned int * SCFG_EXT= (unsigned int*)0x4004008;

//*SCFG_EXT = 0xFFFFFFFF;

//*SCFG_EXT = 0xFFFFFFFF; broke ds game
//*SCFG_EXT = 0x830FE100; broke ds game

//*SCFG_EXT = 0x830F0100; ds game ok no sd access
*SCFG_EXT = 0x830F0100;
*SCFG_CLK |= 1;
}


15 changes: 14 additions & 1 deletion libunds/source/arm9/system/mpu_setup.s
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,15 @@ __libnds_mpu_setup:

orr r0,r0,#(PAGE_32K | 1)
mcr p15, 0, r0, c6, c4, 0

ldr r0,=0x4004008
ldr r0,[r0]
ands r0,r0,#0x8000
bne dsi_mode

swi 0xf0000

ldr r1,=( PAGE_8M | 0x03000000 | 1)
ldr r1,=( PAGE_128M | 0x08000000 | 1)
cmp r0,#0
bne debug_mode

Expand All @@ -135,6 +140,13 @@ debug_mode:
adr r9,debugmasks
b setregions

dsi_mode: @pumped up 3ds dsi mode
ldr r1,=( PAGE_64M | 0x10000000 | 1) @ 3DS IO port (sd card / nand access from ARM9)
ldr r3,=( PAGE_16M | 0x02000000 | 1) @ Normal 16MB DS/DSI RAM (for compatibility)
ldr r2,=( PAGE_128M | 0x08000000 | 1) @ 128 MB 3DS RAM
mov r8,#0x03000000
adr r9,dsimasks

setregions:

@-------------------------------------------------------------------------
Expand All @@ -152,6 +164,7 @@ setregions:
@-------------------------------------------------------------------------
mcr p15, 0, r3, c6, c7, 0


@-------------------------------------------------------------------------
@ Write buffer enable
@-------------------------------------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions patch_ndsheader_dsiware.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,11 @@ def writeBlankuntilAddress(f_out, caddr, taddr):
MBK_1_5_Settings= '\x81\x85\x89\x8d\x80\x84\x88\x8c\x90\x94\x98\x9c\x80\x84\x88\x8c\x90\x94\x98\x9c',
MBK_6_8_Settings_ARM7= '\xc07\x00\x08@7\xc0\x07\x007@\x07',
MBK_6_8_Settings_ARM9= '\x00\x00\x00\x00@7\xc0\x07\x007@\x07',
accessControl= 0x0001F938,
accessControl= 0x00000138,
#arm7ScfgExtMask= 0x80044000,
arm7ScfgExtMask= 0xFFFFFFFF,
reserved_flags= 0x01000000,
arm7ScfgExtMask= 0x80040000,
#reserved_flags= 0x01000000,
reserved_flags= 0x00000000,
arm7iLoadAddress= 0x2E80000,
arm7iRomOffset= arm7iRomOffset,
arm7iSize= arm7isize,
Expand Down
Binary file added ui/HatsuneMiku/BTN2.BMP
Binary file not shown.
Binary file added ui/HatsuneMiku/BTN3.BMP
Binary file not shown.
Binary file added ui/HatsuneMiku/BTN4.BMP
Binary file not shown.
Binary file added ui/HatsuneMiku/CALENDAR/clock_colon.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/CALENDAR/clock_numbers.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/CALENDAR/day_numbers.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/CALENDAR/year_numbers.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/CROSS.BMP
Binary file not shown.
18 changes: 18 additions & 0 deletions ui/HatsuneMiku/CUSTOM.INI
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[user name]
x = 43
y = 146
color = 0x7fff
show = 1
[custom text]
text=User Text
x=80
y=0
w=256
h=16
color=0x7FFF
show=0
[custom picture]
file=no file
x=0
y=0
show=0
Binary file added ui/HatsuneMiku/MENU_BG.BMP
Binary file not shown.
Binary file added ui/HatsuneMiku/TICK.BMP
Binary file not shown.
Binary file added ui/HatsuneMiku/TITLE_BG.BMP
Binary file not shown.
Binary file added ui/HatsuneMiku/brightness.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/card_icon_blue.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/folder_up.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/lower_screen.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/progress_bar.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/progress_wnd.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/spin_btn_left.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/spin_btn_right.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/title_left.bmp
Binary file not shown.
Binary file added ui/HatsuneMiku/title_right.bmp
Binary file not shown.
104 changes: 104 additions & 0 deletions ui/HatsuneMiku/uisettings.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
[global settings]
formFrameColor = 0x0000
formBodyColor = 0x4605
formTextColor = 0x7371
formTitleTextColor = 0x6b52
buttonTextColor = 0x6f40
spinBoxNormalColor = 0x4600
spinBoxFocusColor = 0x20e2
spinBoxFrameColor = 0x6f40
spinBoxTextColor = 0x6f40
spinBoxTextHiLightColor = 0x7bb7
listViewBarColor1 = 0x5ac6
listViewBarColor2 = 0x0008
listTextColor = 0x6f40
listTextHighLightColor = 0x7bdc
popMenuTextColor = 0x7fe6
popMenuTextHighLightColor = 0x6300
popMenuBarColor = 0x3180

[start button]
x = 0
y = 172
w = 48
h = 18
textColor = 0x7FFF
file = none
show = 0

[start menu]
x = 0
y = 0
itemX = 21
itemY = 52
barLeft = 19
itemHeight = 14
itemWidth = 85

[brightness btn]
x = 0
y = 172
w =16
h =16

[folderup btn]
x = 0
y = 0
w =40
h = 16

[disk icon]
x = 97
y = 172

[main list]
textColor = 0x7fe2
textColorHilight = 0x6f72
selectionBarColor1 = 0x0000
selectionBarColor2 =0x0000
selectionBarOpacity = 48

[big clock]
x = 13
y = 165
show = 1

[calendar year]
x = 86
y = 165
show = 1

[calendar month]
x = 59
y = 165
show = 1

[calendar day]
x = 145
y = 19
highlightColor = 0x41e0
dw = 16
dh = 14
show = 1

[folder text]
x = 98
y = 2
w = 160
h = 16
color = 0x6720

[setting window]
spinBoxWidth = 108

[rom info window]
w = 220
h = 144

[help window]
w = 200
h = 160

[end]


Binary file added ui/HatsuneMiku/upper_screen.bmp
Binary file not shown.

0 comments on commit 9cb22d2

Please sign in to comment.