Skip to content

Commit 45a7506

Browse files
committed
Add alternate DSTWO DLDI driver to work around red error screen
Closes DS-Homebrew/TWiLightMenu#1738
1 parent f40a60d commit 45a7506

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,5 @@ retail/arm9/include/version.h
136136
*.lz77
137137
!retail/nitrofiles/fonts/*.lz77
138138
!retail/nitrofiles/bootloader_images.lz77
139+
!retail/nitrofiles/dstwo.dldi
139140
!retail/nitrofiles/esrbOnlineNotice.lz77

retail/arm9/source/nds_loader_arm9.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,19 @@ static bool dldiPatchLoader (data_t *binData, u32 binSize, bool clearBSS)
151151
return false;
152152
}
153153

154-
pDH = (data_t*)(io_dldi_data);
154+
if (strcmp(io_dldi_data->friendlyName, "DSTWO(Slot-1)") == 0) {
155+
pDH = (data_t*)lz77ImageBuffer;
156+
157+
FILE* dldiFile = fopen("nitro:/dstwo.dldi", "rb"); // Use alternate DLDI driver to work around red error screen
158+
if (dldiFile) {
159+
fread(lz77ImageBuffer, 1, 0x800, dldiFile);
160+
fclose(dldiFile);
161+
} else {
162+
return false;
163+
}
164+
} else {
165+
pDH = (data_t*)(io_dldi_data);
166+
}
155167

156168
pAH = &(binData[patchOffset]);
157169

retail/nitrofiles/dstwo.dldi

1.82 KB
Binary file not shown.

0 commit comments

Comments
 (0)