Skip to content

Commit 6e50ee2

Browse files
2 parents 1e27669 + 956a968 commit 6e50ee2

File tree

9 files changed

+110
-294
lines changed

9 files changed

+110
-294
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*.dsi
99
*.cia
1010
*.zip
11+
SCFW.SC
1112
BootStrap/arm7/build
1213
BootStrap/arm9/build
1314
data

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ endif
1010
include $(DEVKITARM)/ds_rules
1111

1212
export HBMENU_MAJOR := 0
13-
export HBMENU_MINOR := 9
13+
export HBMENU_MINOR := 10
1414
export HBMENU_PATCH := 0
1515

1616

@@ -127,7 +127,7 @@ endif
127127
all: bootloader bootstub exceptionstub $(BUILD)
128128

129129
#---------------------------------------------------------------------------------
130-
$(BUILD):
130+
$(BUILD): bootloader bootstub exceptionstub
131131
@[ -d $@ ] || mkdir -p $@
132132
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
133133

source/excpt_stub.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <calico.h>
2+
#include <nds.h>
3+
4+
#include "nds_loader_arm9.h"
5+
#include "exceptionstub_bin.h"
6+
7+
typedef struct excptStub_t {
8+
u32 dummy;
9+
void* bss_start;
10+
void* bss_end;
11+
VoidFn excpt_vector;
12+
} excptStub_t;
13+
14+
void installExcptStub(void)
15+
{
16+
excptStub_t* exceptionstub = (excptStub_t*)0x2ffa000;
17+
armCopyMem32(exceptionstub,exceptionstub_bin,exceptionstub_bin_size);
18+
if (exceptionstub->bss_start != exceptionstub->bss_end) {
19+
armFillMem32(exceptionstub->bss_start, 0, (char*)exceptionstub->bss_end - (char*)exceptionstub->bss_start);
20+
}
21+
22+
EXCEPTION_VECTOR = exceptionstub->excpt_vector;
23+
}

source/file_browse.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ string browseForFile (const vector<string>& extensionList) {
157157
getDirectoryContents (dirContents, extensionList);
158158
showDirectoryContents (dirContents, screenOffset);
159159

160-
while (true) {
160+
while (pmMainLoop()) {
161161
// Clear old cursors
162162
for (int i = ENTRIES_START_ROW; i < ENTRIES_PER_SCREEN + ENTRIES_START_ROW; i++) {
163163
iprintf ("\x1b[%d;0H ", i);
@@ -172,6 +172,9 @@ string browseForFile (const vector<string>& extensionList) {
172172
scanKeys();
173173
pressed = keysDownRepeat();
174174
swiWaitForVBlank();
175+
if (!pmMainLoop()) {
176+
return "";
177+
}
175178
} while (!pressed);
176179

177180
if (pressed & KEY_UP) fileOffset -= 1;
@@ -219,4 +222,6 @@ string browseForFile (const vector<string>& extensionList) {
219222
showDirectoryContents (dirContents, screenOffset);
220223
}
221224
}
225+
226+
return "";
222227
}

source/main.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void InitGUI(void) {
6363
//---------------------------------------------------------------------------------
6464
void stop (void) {
6565
//---------------------------------------------------------------------------------
66-
while (1) {
66+
while (pmMainLoop()) {
6767
swiWaitForVBlank();
6868
}
6969
}
@@ -74,9 +74,13 @@ int main(int argc, char **argv) {
7474

7575
// overwrite reboot stub identifier
7676
// so tapping power on DSi returns to DSi menu
77-
extern u64 *fake_heap_end;
78-
*fake_heap_end = 0;
77+
pmClearResetJumpTarget();
78+
79+
// install exception stub
80+
installExcptStub();
81+
7982
InitGUI();
83+
8084
if (!fatInitDefault()) {
8185
iprintf ("\n\nfatinitDefault failed!\n");
8286
stop();
@@ -91,9 +95,12 @@ int main(int argc, char **argv) {
9195
chdir("/");
9296
}
9397

94-
while(1) {
98+
while(pmMainLoop()) {
9599

96100
string filename = browseForFile(extensionList);
101+
if (filename.empty()) {
102+
continue;
103+
}
97104

98105
// Construct a command line
99106
vector<string> argarray;
@@ -115,7 +122,7 @@ int main(int argc, char **argv) {
115122

116123
argarray.clear();
117124

118-
while (1) {
125+
while (pmMainLoop()) {
119126
swiWaitForVBlank();
120127
scanKeys();
121128
if (!(keysHeld() & KEY_A)) break;

0 commit comments

Comments
 (0)