From f6de3eac2a4220fef0237e847469dc09899bdae0 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Sun, 10 Nov 2024 21:35:35 -0700 Subject: [PATCH] Bug fix --- settings/bootloader/source/boot.c | 4 +++- title/bootloader/source/boot.c | 4 +++- universal/bootloader_app/source/boot.c | 4 +++- universal/bootloader_menu/source/boot.c | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/settings/bootloader/source/boot.c b/settings/bootloader/source/boot.c index b7b020fa46..94e534e652 100644 --- a/settings/bootloader/source/boot.c +++ b/settings/bootloader/source/boot.c @@ -449,10 +449,12 @@ int main (void) { #endif if (wantToPatchDLDI) { toncset((u32*)0x06000000, 0, 0x8000); - if (*(u32*)0x02FF4184 == 0x69684320) { // DLDI ' Chi' string + bootloader in DLDI driver space + if (*(u32*)0x02FF4184 == 0x69684320) { // DLDI ' Chi' string in bootstub space + bootloader in DLDI driver space const u16 dldiFileSize = 1 << *(u8*)0x02FF418D; tonccpy((u32*)0x06000000, (u32*)0x02FF4180, dldiFileSize); dldiRelocateBinary(); + + toncset((u32*)0x02FF4000, 0, 0x8180); // Clear bootstub + DLDI driver } else if (*(u32*)0x02FF8004 == 0x69684320) { // DLDI ' Chi' string const u16 dldiFileSize = 1 << *(u8*)0x02FF800D; tonccpy((u32*)0x06000000, (u32*)0x02FF8000, (dldiFileSize > 0x4000) ? 0x4000 : dldiFileSize); diff --git a/title/bootloader/source/boot.c b/title/bootloader/source/boot.c index ed47c6c6a8..76f5aeca4d 100644 --- a/title/bootloader/source/boot.c +++ b/title/bootloader/source/boot.c @@ -637,10 +637,12 @@ int main (void) { #endif if (wantToPatchDLDI) { toncset((u32*)0x06000000, 0, 0x8000); - if (*(u32*)0x02FF4184 == 0x69684320) { // DLDI ' Chi' string + bootloader in DLDI driver space + if (*(u32*)0x02FF4184 == 0x69684320) { // DLDI ' Chi' string in bootstub space + bootloader in DLDI driver space const u16 dldiFileSize = 1 << *(u8*)0x02FF418D; tonccpy((u32*)0x06000000, (u32*)0x02FF4180, dldiFileSize); dldiRelocateBinary(); + + toncset((u32*)0x02FF4000, 0, 0x8180); // Clear bootstub + DLDI driver } else if (*(u32*)0x02FF8004 == 0x69684320) { // DLDI ' Chi' string const u16 dldiFileSize = 1 << *(u8*)0x02FF800D; tonccpy((u32*)0x06000000, (u32*)0x02FF8000, (dldiFileSize > 0x4000) ? 0x4000 : dldiFileSize); diff --git a/universal/bootloader_app/source/boot.c b/universal/bootloader_app/source/boot.c index 1285506005..74d8f8e734 100644 --- a/universal/bootloader_app/source/boot.c +++ b/universal/bootloader_app/source/boot.c @@ -390,10 +390,12 @@ int main (void) { #endif if (wantToPatchDLDI) { toncset((u32*)0x06000000, 0, 0x8000); - if (*(u32*)0x02FF4184 == 0x69684320) { // DLDI ' Chi' string + bootloader in DLDI driver space + if (*(u32*)0x02FF4184 == 0x69684320) { // DLDI ' Chi' string in bootstub space + bootloader in DLDI driver space const u16 dldiFileSize = 1 << *(u8*)0x02FF418D; tonccpy((u32*)0x06000000, (u32*)0x02FF4180, dldiFileSize); dldiRelocateBinary(); + + toncset((u32*)0x02FF4000, 0, 0x8180); // Clear bootstub + DLDI driver } else if (*(u32*)0x02FF8004 == 0x69684320) { // DLDI ' Chi' string const u16 dldiFileSize = 1 << *(u8*)0x02FF800D; tonccpy((u32*)0x06000000, (u32*)0x02FF8000, (dldiFileSize > 0x4000) ? 0x4000 : dldiFileSize); diff --git a/universal/bootloader_menu/source/boot.c b/universal/bootloader_menu/source/boot.c index a967712994..91018260b6 100644 --- a/universal/bootloader_menu/source/boot.c +++ b/universal/bootloader_menu/source/boot.c @@ -581,10 +581,12 @@ int main (void) { #endif if (wantToPatchDLDI) { toncset((u32*)0x06000000, 0, 0x8000); - if (*(u32*)0x02FF4184 == 0x69684320) { // DLDI ' Chi' string + bootloader in DLDI driver space + if (*(u32*)0x02FF4184 == 0x69684320) { // DLDI ' Chi' string in bootstub space + bootloader in DLDI driver space const u16 dldiFileSize = 1 << *(u8*)0x02FF418D; tonccpy((u32*)0x06000000, (u32*)0x02FF4180, dldiFileSize); dldiRelocateBinary(); + + toncset((u32*)0x02FF4000, 0, 0x8180); // Clear bootstub + DLDI driver } else if (*(u32*)0x02FF8004 == 0x69684320) { // DLDI ' Chi' string const u16 dldiFileSize = 1 << *(u8*)0x02FF800D; tonccpy((u32*)0x06000000, (u32*)0x02FF8000, (dldiFileSize > 0x4000) ? 0x4000 : dldiFileSize);