mirror of
https://github.com/ApacheThunder/GBA-Exploader.git
synced 2025-06-18 11:35:38 -04:00
FIx Slot-2 DS mode ...
* Fix mistake that caused DS mode Slot-2 booting to not work. (accidently removed needed arm7 code in previous commit after optimizing code relating to Rumble Menu softreset)
This commit is contained in:
parent
de53d7252d
commit
7084d26052
8
Makefile
8
Makefile
@ -9,7 +9,7 @@ export TARGET := GBA_ExpLoader
|
||||
export TOPDIR := $(CURDIR)
|
||||
|
||||
export VERSION_MAJOR := 0
|
||||
export VERSION_MINOR := 61
|
||||
export VERSION_MINOR := 61b
|
||||
export VERSTRING := $(VERSION_MAJOR).$(VERSION_MINOR)
|
||||
|
||||
# GMAE_ICON is the image used to create the game icon, leave blank to use default rule
|
||||
@ -45,11 +45,11 @@ checkarm9:
|
||||
#---------------------------------------------------------------------------------
|
||||
$(TARGET).nds : arm7/$(TARGET).elf arm9/$(TARGET).elf
|
||||
@ndstool -c $@ -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf \
|
||||
-b $(CURDIR)/logo32.bmp "GBA ExpLoader;Version $(VERSTRING);By Rudolph;" \
|
||||
-b $(CURDIR)/logo32.bmp "GBA ExpLoader;Version $(VERSTRING);By Rudolph" \
|
||||
-g #### 01 "GBAEXPLOADER" -z 80040000 -u 00030004 -a 00000138 -p 0001 \
|
||||
|
||||
data:
|
||||
@mkdir -p data
|
||||
@mkdir -p arm9/data
|
||||
|
||||
ndsbootloader: data
|
||||
$(MAKE) -C ndsbootloader LOADBIN=$(CURDIR)/arm9/data/load.bin
|
||||
@ -67,6 +67,6 @@ clean:
|
||||
$(MAKE) -C arm9 clean
|
||||
$(MAKE) -C arm7 clean
|
||||
$(MAKE) -C ndsbootloader clean
|
||||
rm -rf data
|
||||
rm -rf arm9/data
|
||||
rm -f $(TARGET).nds
|
||||
|
||||
|
@ -37,6 +37,24 @@ volatile bool switchedMode = false;
|
||||
// They used r0 instead of r2. This reimplementation fixes that issue for now.
|
||||
extern void swiSwitchToGBAModeFixed();
|
||||
|
||||
static void prepareReset() {
|
||||
vu32 vr;
|
||||
u32 i;
|
||||
|
||||
powerOn(POWER_SOUND);
|
||||
|
||||
for(i = 0x040000B0; i < (0x040000B0+0x30); i+=4)*((vu32*)i) = 0;
|
||||
|
||||
REG_IME = IME_DISABLE;
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
|
||||
for(vr = 0; vr < 0x100; vr++); // Wait ARM9
|
||||
|
||||
swiSoftReset();
|
||||
}
|
||||
|
||||
|
||||
void gbaMode() {
|
||||
vu32 vr;
|
||||
|
||||
@ -57,15 +75,18 @@ volatile bool exitflag = false;
|
||||
void powerButtonCB() { exitflag = true; }
|
||||
|
||||
void fifoCheckHandler() {
|
||||
if (!switchedMode && fifoCheckValue32(FIFO_USER_01)) {
|
||||
switchedMode = true;
|
||||
gbaMode();
|
||||
if (!switchedMode) {
|
||||
if (fifoCheckValue32(FIFO_USER_01)) {
|
||||
switchedMode = true;
|
||||
gbaMode();
|
||||
} else if (fifoCheckValue32(FIFO_USER_02)) {
|
||||
switchedMode = true;
|
||||
prepareReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VblankHandler(void) { fifoCheckHandler(); }
|
||||
|
||||
|
||||
void VcountHandler() { inputGetAndSend(); }
|
||||
|
||||
int main() {
|
||||
|
@ -16,8 +16,8 @@ include $(DEVKITARM)/ds_rules
|
||||
# all directories are relative to this makefile
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD := build
|
||||
SOURCES := source source/tarosa source/bootloader
|
||||
INCLUDES := include build source/tarosa source/bootloader
|
||||
SOURCES := source source/tarosa include
|
||||
INCLUDES := include build source/tarosa
|
||||
DATA := data
|
||||
STATICLIBS :=
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -145,7 +145,7 @@ u32 ReadNorFlashID() {
|
||||
return 0x227E2218;
|
||||
}
|
||||
}
|
||||
return 0x227E2220;
|
||||
return 0x227E2220; // EZFlash IV or EWIN
|
||||
}
|
||||
|
||||
void chip_reset() {
|
@ -492,8 +492,7 @@ int checkSRAM(char *name) {
|
||||
ctrl_get();
|
||||
|
||||
for(i = 0; ctrl.sign[i] != 0; i++) {
|
||||
if(ctrl.sign[i] != Rudolph[i])
|
||||
break;
|
||||
if(ctrl.sign[i] != Rudolph[i])break;
|
||||
}
|
||||
|
||||
if(carttype < 4)OpenNorWrite();
|
||||
|
@ -33,27 +33,24 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "maindef.h"
|
||||
#include "dsCard.h"
|
||||
#include "GBA_ini.h"
|
||||
#include "ctrl_tbl.h"
|
||||
|
||||
#include "bootloader/ret_menu9_gen.h"
|
||||
|
||||
#include "memcleaner.h"
|
||||
|
||||
#include "skin.h"
|
||||
#include "message.h"
|
||||
|
||||
#include "tarosa/tarosa_Graphic.h"
|
||||
#include "tarosa/tarosa_Shinofont.h"
|
||||
|
||||
#include "ret_menu9_gen.h"
|
||||
#include "dsCard.h"
|
||||
|
||||
#include "GBA_ini.h"
|
||||
#include "ctrl_tbl.h"
|
||||
#include "skin.h"
|
||||
#include "message.h"
|
||||
|
||||
extern uint16* MainScreen;
|
||||
extern uint16* SubScreen;
|
||||
|
||||
#define BG_256_COLOR (BIT(7))
|
||||
|
||||
#define VERSTRING "v0.61"
|
||||
#define VERSTRING "v0.61b"
|
||||
|
||||
int numFiles = 0;
|
||||
int numGames = 0;
|
||||
@ -145,8 +142,7 @@ void gba_frame() {
|
||||
}
|
||||
|
||||
static void resetToSlot2() {
|
||||
vu32 vr;
|
||||
|
||||
vu32 vr;
|
||||
// make arm9 loop code
|
||||
*((vu32*)0x027FFE08) = (u32)0xE59FF014; // ldr pc, 0x027FFE24
|
||||
*((vu32*)0x027FFE24) = (u32)0x027FFE08; // Set ARM9 Loop address
|
||||
@ -154,8 +150,7 @@ static void resetToSlot2() {
|
||||
|
||||
sysSetCartOwner(BUS_OWNER_ARM7); // ARM7 has access to GBA cart
|
||||
|
||||
// FIFOSend(IPC_CMD_SLOT2);
|
||||
fifoSendValue32(FIFO_USER_05, 1);
|
||||
fifoSendValue32(FIFO_USER_02, 1);
|
||||
|
||||
for(vr = 0; vr < 0x20000; vr++); // Wait ARM7
|
||||
|
||||
@ -166,10 +161,7 @@ static void resetToSlot2() {
|
||||
|
||||
void gbaMode() {
|
||||
|
||||
if(strncmp(GBA_HEADER.gamecode, "PASS", 4) == 0) {
|
||||
// resetARM9Memory();
|
||||
resetToSlot2();
|
||||
}
|
||||
if(strncmp(GBA_HEADER.gamecode, "PASS", 4) == 0)resetToSlot2();
|
||||
|
||||
videoSetMode(0);
|
||||
videoSetModeSub(0);
|
||||
@ -960,7 +952,8 @@ void mainloop(void) {
|
||||
DrawBox_SUB(SubScreen, 21, 4, 234, 26, 5, 1);
|
||||
DrawBox_SUB(SubScreen, 22, 5, 233, 25, 0, 0);
|
||||
ShinoPrint_SUB( SubScreen, 9*6, 1*12-2, (u8*)"GBA ExpLoader", 0, 0, 0);
|
||||
ShinoPrint_SUB( SubScreen, 34*6-2, 12, (u8 *)VERSTRING, 0, 0, 0);
|
||||
// ShinoPrint_SUB( SubScreen, 34*6-2, 12, (u8*)VERSTRING, 0, 0, 0);
|
||||
ShinoPrint_SUB( SubScreen, 33*6-2, 12, (u8*)VERSTRING, 0, 0, 0);
|
||||
|
||||
|
||||
DrawBox_SUB(SubScreen, 6, 125, 249, 190, 5, 0);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#define maindef_h
|
||||
|
||||
#define ROMTITLE "GBA ExpLoader"
|
||||
#define ROMVERSION "Version 0.61 by Rudolph."
|
||||
#define ROMVERSION "Version 0.61b by Rudolph."
|
||||
#define ROMDATE ""__DATE__" "__TIME__
|
||||
|
||||
#endif
|
||||
|
@ -1,74 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Copyright (C) 2007 Acekard, www.acekard.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
#include <nds.h>
|
||||
|
||||
#include "memcleaner.h"
|
||||
|
||||
void resetARM9Memory() {
|
||||
// DMA
|
||||
for (u8 i=0; i<4; i++) {
|
||||
DMA_CR(i) = 0;
|
||||
DMA_SRC(i) = 0;
|
||||
DMA_DEST(i) = 0;
|
||||
TIMER_CR(i) = 0;
|
||||
TIMER_DATA(i) = 0;
|
||||
}
|
||||
|
||||
swiWaitForVBlank(); // wait for VBLANK to avoid screen picture break
|
||||
//PALETTE[0] = 0xFFFF;
|
||||
|
||||
// VIDEO
|
||||
// trun on vram banks for clear
|
||||
VRAM_CR = 0x80808080;
|
||||
(*(vu32*)0x027FFE04) = 0; // temporary variable
|
||||
BG_PALETTE[0] = 0xFFFF;
|
||||
dmaFillWords(0, BG_PALETTE+1, (2*1024)-2);
|
||||
dmaFillWords(0, OAM, 2*1024);
|
||||
dmaFillWords(0, (void*)0x04000000, 0x56); //clear main display registers
|
||||
dmaFillWords(0, (void*)0x04001000, 0x56); //clear sub display registers
|
||||
|
||||
// clear video registers
|
||||
REG_DISPCNT = 0;
|
||||
REG_DISPCNT_SUB = 0;
|
||||
VRAM_A_CR = 0;
|
||||
VRAM_B_CR = 0;
|
||||
VRAM_C_CR = 0;
|
||||
VRAM_D_CR = 0;
|
||||
VRAM_E_CR = 0;
|
||||
VRAM_F_CR = 0;
|
||||
VRAM_G_CR = 0;
|
||||
VRAM_H_CR = 0;
|
||||
VRAM_I_CR = 0;
|
||||
VRAM_CR = 0x00000000;
|
||||
REG_POWERCNT = 0x820F; // turn on all engines
|
||||
|
||||
// Interrupt
|
||||
REG_IME = 0;
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
}
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Copyright (C) 2007 Acekard, www.acekard.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _MEMCLEANER_H_
|
||||
#define _MEMCLEANER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
void resetARM9Memory();
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//_MEMCLEANER_H_
|
Loading…
Reference in New Issue
Block a user