mirror of
https://github.com/coderkei/akmenu-next.git
synced 2025-06-18 08:55:46 -04:00
Fix DSi build
* Fix DSI build. Now works correctly on DSi. * Fixed soft reset into boot.nds. Now works on both DSi and flashcarts. Also fixed for theme reset. * Fixed soft reset into GBA mode. Was using libnds's broken swi call. Replaced with modified version that isn't broken. * Fixed warnings generated during compile. * Removed old LD/Specs from arm7 folder. This is needed to allow proper arm7 entry point for TWL_FIRM compatiblity on 3DS. Didn't seem to break DS mode copy so a DSi specific build of arm7 make file is not needed at the moment. * custom banner added via banner.bin and -t ndstool command. * Flashcart build now uses -h 0x200 command for better compatiblity with older homebrew launchers/flashcarts.
This commit is contained in:
parent
805f9e9674
commit
7f66ae6613
19
Makefile
19
Makefile
@ -23,14 +23,20 @@ GAME_SUBTITLE2 := github.com/coderkei
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#.PHONY: checkarm7 checkarm9 checkarm9_ak2 checkarm9_dsi checkarm9_m3 checkarm9_tt clean
|
||||
.PHONY: checkarm7 checkarm9 checkarm9_dsi clean
|
||||
.PHONY: nds-bootloader checkarm7 checkarm9 checkarm9_dsi clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
all: checkarm7 checkarm9 checkarm9_dsi \
|
||||
all: nds-bootloader checkarm7 checkarm9 checkarm9_dsi \
|
||||
$(TARGET).nds $(TARGET).dsi
|
||||
|
||||
data:
|
||||
@mkdir -p data
|
||||
|
||||
nds-bootloader: data
|
||||
$(MAKE) -C nds-bootloader LOADBIN=$(CURDIR)/data/load.bin
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
checkarm7:
|
||||
$(MAKE) -C arm7
|
||||
@ -46,13 +52,14 @@ checkarm9_dsi:
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET).nds : $(NITRO_FILES) arm7/$(TARGET).elf arm9/$(TARGET).elf
|
||||
ndstool -c $(TARGET).nds -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf \
|
||||
-b $(GAME_ICON) "$(GAME_TITLE);$(GAME_SUBTITLE1);$(GAME_SUBTITLE2)" \
|
||||
-h 0x200 -t banner.bin \
|
||||
$(_ADDFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET).dsi : $(NITRO_FILES) arm7/$(TARGET).elf arm9_dsi/$(TARGET).elf
|
||||
ndstool -c $@ -7 arm7/$(TARGET).elf -9 arm9_dsi/$(TARGET).elf \
|
||||
-b $(GAME_ICON) "$(GAME_TITLE);$(GAME_SUBTITLE1);$(GAME_SUBTITLE2)" \
|
||||
-t banner.bin \
|
||||
-g AKGE 01 "AKMENU" -z 80040407 -u 00030004 -a 00000138 -p 0001 \
|
||||
$(_ADDFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -60,7 +67,7 @@ arm7/$(TARGET).elf:
|
||||
$(MAKE) -C arm7
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
arm9/$(TARGET).elf:
|
||||
arm9/$(TARGET).elf: nds-bootloader
|
||||
$(MAKE) -C arm9
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -71,5 +78,7 @@ arm9_dsi/$(TARGET).elf:
|
||||
clean:
|
||||
$(MAKE) -C arm9 clean
|
||||
$(MAKE) -C arm9_dsi clean
|
||||
$(MAKE) -C nds-bootloader clean
|
||||
$(MAKE) -C arm7 clean
|
||||
rm -rf data
|
||||
rm -f *.nds *.dsi
|
||||
|
@ -28,7 +28,7 @@ CFLAGS := -g -Wall -O3\
|
||||
$(ARCH) $(INCLUDE) -DARM7
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=../ds_arm7_iwram.specs -g $(ARCH) -Wl,--nmagic -Wl,-Map,$(notdir $*).map
|
||||
LDFLAGS = -specs=ds_arm7.specs -g $(ARCH) -Wl,--nmagic -Wl,-Map,$(notdir $*).map
|
||||
|
||||
LIBS := -ldswifi7 -lmm7 -lnds7
|
||||
|
||||
|
@ -1,192 +0,0 @@
|
||||
/*--------------------------------------------------------------------------------
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License,
|
||||
v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
obtain one at https://mozilla.org/MPL/2.0/.
|
||||
--------------------------------------------------------------------------------*/
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
|
||||
MEMORY {
|
||||
|
||||
rom : ORIGIN = 0x08000000, LENGTH = 32M
|
||||
iwram : ORIGIN = 0x03800000, LENGTH = 64K
|
||||
}
|
||||
|
||||
__iwram_start = ORIGIN(iwram);
|
||||
__iwram_top = ORIGIN(iwram)+ LENGTH(iwram);
|
||||
|
||||
__sp_irq = __iwram_top - 0x100;
|
||||
__sp_svc = __sp_irq - 0x100;
|
||||
__sp_usr = __sp_svc - 0x100;
|
||||
|
||||
__irq_flags = 0x04000000 - 8;
|
||||
__irq_flagsaux = 0x04000000 - 0x40;
|
||||
__irq_vector = 0x04000000 - 4;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.crt0 :
|
||||
{
|
||||
__text_start = . ;
|
||||
KEEP (*(.crt0))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram = 0xff
|
||||
|
||||
.init :
|
||||
{
|
||||
KEEP (*(SORT_NONE(.init)))
|
||||
} >iwram = 0xff
|
||||
|
||||
.plt : { *(.plt) } >iwram = 0xff
|
||||
|
||||
.text : /* ALIGN (4): */
|
||||
{
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
KEEP (*(.text.*personality*))
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.glue_7t) *(.glue_7) *(.vfp11_veneer)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram = 0xff
|
||||
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
} >iwram =0xff
|
||||
|
||||
__text_end = . ;
|
||||
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*all.rodata*(*)
|
||||
*(.roda)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r*)
|
||||
SORT(CONSTRUCTORS)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram = 0xff
|
||||
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >iwram
|
||||
__exidx_start = .;
|
||||
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >iwram
|
||||
__exidx_end = .;
|
||||
|
||||
/* Ensure the __preinit_array_start label is properly aligned. We
|
||||
could instead move the label definition inside the section, but
|
||||
the linker would then create the section even if it turns out to
|
||||
be empty, which isn't pretty. */
|
||||
. = ALIGN(32 / 8);
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
.preinit_array : { KEEP (*(.preinit_array)) } >iwram = 0xff
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
PROVIDE (__init_array_start = .);
|
||||
.init_array : { KEEP (*(.init_array)) } >iwram = 0xff
|
||||
PROVIDE (__init_array_end = .);
|
||||
PROVIDE (__fini_array_start = .);
|
||||
.fini_array : { KEEP (*(.fini_array)) } >iwram = 0xff
|
||||
PROVIDE (__fini_array_end = .);
|
||||
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of the constructors, so
|
||||
we make sure it is first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not actually link against
|
||||
crtbegin.o; the linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it doesn't matter which
|
||||
directory crtbegin.o is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram = 0xff
|
||||
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram = 0xff
|
||||
|
||||
.eh_frame :
|
||||
{
|
||||
KEEP (*(.eh_frame))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram = 0xff
|
||||
|
||||
.gcc_except_table :
|
||||
{
|
||||
*(.gcc_except_table)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >iwram = 0xff
|
||||
.jcr : { KEEP (*(.jcr)) } >iwram = 0
|
||||
.got : { *(.got.plt) *(.got) } >iwram = 0
|
||||
|
||||
|
||||
.data ALIGN(4) : {
|
||||
__data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
__data_end = ABSOLUTE(.) ;
|
||||
} >iwram = 0xff
|
||||
|
||||
|
||||
__arm7_end__ = .;
|
||||
|
||||
|
||||
.bss ALIGN(4) :
|
||||
{
|
||||
__bss_start = ABSOLUTE(.);
|
||||
__bss_start__ = ABSOLUTE(.);
|
||||
*(.dynbss)
|
||||
*(.gnu.linkonce.b*)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
__bss_end__ = ABSOLUTE(.);
|
||||
__end__ = ABSOLUTE(.);
|
||||
} >iwram
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
.stack 0x80000 : { _stack = .; *(.stack) }
|
||||
/* These must appear regardless of . */
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
%include <sync-none.specs>
|
||||
|
||||
*link:
|
||||
+ -T../ds_arm7_iwram.ld%s --no-warn-rwx-segments
|
||||
|
||||
*startfile:
|
||||
ds_arm7_vram_crt0%O%s crti%O%s crtbegin%O%s
|
15
arm7/source/biosCalls.s
Normal file
15
arm7/source/biosCalls.s
Normal file
@ -0,0 +1,15 @@
|
||||
.TEXT
|
||||
.ARM
|
||||
|
||||
@---------------------------------------------------------------------------------------
|
||||
.GLOBAL swiSwitchToGBAModeFixed
|
||||
.func swiSwitchToGBAModeFixed
|
||||
@---------------------------------------------------------------------------------------
|
||||
swiSwitchToGBAModeFixed:
|
||||
mov r2,#0x40
|
||||
swi 0x1f0000
|
||||
|
||||
.endfunc
|
||||
|
||||
.end
|
||||
|
@ -14,6 +14,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void swiSwitchToGBAModeFixed(); // This is broken in libnds since 2008. Not fixed until libnds2 which this project isn't using yet.
|
||||
void __libnds_exit(int rc) {}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -106,7 +107,7 @@ static void menuValue32Handler(u32 value, void* data) {
|
||||
ii = (1 * PM_BACKLIGHT_TOP) | PM_SOUND_AMP;
|
||||
writePowerManagement(PM_CONTROL_REG, ii);
|
||||
swiChangeSoundBias(0, 0x400);
|
||||
swiSwitchToGBAMode();
|
||||
swiSwitchToGBAModeFixed();
|
||||
} break;
|
||||
case MENU_MSG_ARM7_REBOOT_TT:
|
||||
prepairResetTT();
|
||||
@ -154,6 +155,7 @@ int main() {
|
||||
|
||||
irqInit();
|
||||
fifoInit();
|
||||
touchInit();
|
||||
|
||||
// Start the RTC tracking IRQ
|
||||
initClockIRQ();
|
||||
@ -166,5 +168,11 @@ int main() {
|
||||
|
||||
irqEnable(IRQ_VBLANK | IRQ_NETWORK);
|
||||
|
||||
if (isDSiMode() && REG_SNDEXTCNT != 0) {
|
||||
i2cWriteRegister(0x4A, 0x12, 0x00); // Press power-button for auto-reset
|
||||
i2cWriteRegister(0x4A, 0x70, 0x01); // Bootflag = Warmboot/SkipHealthSafety
|
||||
}
|
||||
|
||||
while (true) swiWaitForVBlank();
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ GRAPHICS :=
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
-Wno-address-of-packed-member \
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
|
||||
CFLAGS += -D_NO_BOOTSTUB_
|
||||
|
@ -59,3 +59,4 @@ typedef t_singleton<cExpansion> cExpansion_s;
|
||||
inline cExpansion& expansion() {
|
||||
return cExpansion_s::instance();
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ void cGdi::frameRect(s16 x, s16 y, u16 w, u16 h, u16 thickness, GRAPHICS_ENGINE
|
||||
}
|
||||
|
||||
void cGdi::fillRect(u16 color1, u16 color2, s16 x, s16 y, u16 w, u16 h, GRAPHICS_ENGINE engine) {
|
||||
ALIGN(4) u16 color[2] = {BIT(15) | color1, BIT(15) | color2};
|
||||
ALIGN(4) u16 color[2] = { (u16)(BIT(15) | color1), (u16)(BIT(15) | color2) };
|
||||
u16* pSrc = (u16*)color;
|
||||
u16* pDest = NULL;
|
||||
|
||||
|
@ -146,11 +146,13 @@ TLaunchResult launchRom(const std::string& aFullPath, DSRomInfo& aRomInfo, bool
|
||||
u32 bigSaveMask = 14;
|
||||
// reading speed setting
|
||||
std::string disk = aFullPath.substr(0, 5);
|
||||
bool dma = false, protection = aRomInfo.saveInfo().isProtection();
|
||||
// bool dma = false, protection = aRomInfo.saveInfo().isProtection();
|
||||
bool protection = aRomInfo.saveInfo().isProtection();
|
||||
u32 speed = 0;
|
||||
{
|
||||
if (protection) speed = 0x1fff;
|
||||
dma = aRomInfo.saveInfo().isDMA();
|
||||
// dma = aRomInfo.saveInfo().isDMA();
|
||||
aRomInfo.saveInfo().isDMA();
|
||||
flags |= PATCH_DMA;
|
||||
if ((gameCode & 0xffffff) ==
|
||||
0x425855) // 4950 - Jam with the Band (Europe) (En,Fr,De,Es,It)
|
||||
|
@ -28,6 +28,7 @@ GRAPHICS :=
|
||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
||||
|
||||
CFLAGS := -g -Wall -O3\
|
||||
-Wno-address-of-packed-member \
|
||||
$(ARCH) $(INCLUDE) -DARM9
|
||||
|
||||
CFLAGS += -D_NO_BOOTSTUB_ -D__DSIMODE__
|
||||
|
BIN
banner.bin
Normal file
BIN
banner.bin
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user