From 24a827406758f153c70858470a83c86216d885ad Mon Sep 17 00:00:00 2001 From: red031000 Date: Tue, 5 May 2020 17:13:38 +0100 Subject: [PATCH 1/2] add dism scripts to gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 9db5da344..1944bdd57 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,7 @@ arm*/baserom.* arm9/modules/module_*.s arm9/modules/module_*.sbin arm9/modules/module_*.cfg + +# Dism scripts +dism.sh +asmdiff.sh From f90214e2716f7d5169784f2301254033d82f984d Mon Sep 17 00:00:00 2001 From: red031000 Date: Tue, 5 May 2020 22:19:58 +0100 Subject: [PATCH 2/2] OS_emulator.c --- arm9/asm/OS_emulator.s | 19 ------------------- arm9/lib/include/OS_emulator.h | 13 +++++++++++++ arm9/lib/include/OS_init.h | 1 + arm9/lib/include/consts.h | 4 ++++ arm9/lib/src/OS_arena.c | 2 +- arm9/lib/src/OS_emulator.c | 18 ++++++++++++++++++ arm9/undefined_syms.txt | 1 + undefined_syms.txt | 1 + 8 files changed, 39 insertions(+), 20 deletions(-) delete mode 100644 arm9/asm/OS_emulator.s create mode 100644 arm9/lib/include/OS_emulator.h create mode 100644 arm9/lib/src/OS_emulator.c diff --git a/arm9/asm/OS_emulator.s b/arm9/asm/OS_emulator.s deleted file mode 100644 index 69207a5e8..000000000 --- a/arm9/asm/OS_emulator.s +++ /dev/null @@ -1,19 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - arm_func_start OS_GetConsoleType -OS_GetConsoleType: ; 0x020CBBC0 - ldr r0, _020CBBD0 ; =0x82000001 - ldr r1, _020CBBD4 ; =0x02106828 - str r0, [r1, #0x0] - bx lr - .balign 4 -_020CBBD0: .word 0x82000001 -_020CBBD4: .word 0x02106828 - - arm_func_start OS_IsRunOnEmulator -OS_IsRunOnEmulator: - mov r0, #0x0 - bx lr diff --git a/arm9/lib/include/OS_emulator.h b/arm9/lib/include/OS_emulator.h new file mode 100644 index 000000000..541052582 --- /dev/null +++ b/arm9/lib/include/OS_emulator.h @@ -0,0 +1,13 @@ +// +// Created by red031000 on 2020-05-05. +// + +#ifndef POKEDIAMOND_OS_EMULATOR_H +#define POKEDIAMOND_OS_EMULATOR_H + +#include "consts.h" + +BOOL OS_IsRunOnEmulator(); +u32 OS_GetConsoleType(); + +#endif //POKEDIAMOND_OS_EMULATOR_H diff --git a/arm9/lib/include/OS_init.h b/arm9/lib/include/OS_init.h index 1ff2837cb..d24978360 100644 --- a/arm9/lib/include/OS_init.h +++ b/arm9/lib/include/OS_init.h @@ -11,6 +11,7 @@ #include "OS_thread.h" #include "OS_protectionRegion.h" #include "OS_entropy.h" +#include "OS_emulator.h" #include "OS_arena.h" #include "OS_alloc.h" #include "OS_system.h" diff --git a/arm9/lib/include/consts.h b/arm9/lib/include/consts.h index e07fe3232..81330924d 100644 --- a/arm9/lib/include/consts.h +++ b/arm9/lib/include/consts.h @@ -48,6 +48,10 @@ #define HW_C6_PR_2GB 0x3c #define HW_C6_PR_4GB 0x3e +#define OSi_CONSOLE_NOT_DETECT 0xffffffff + +#define OS_CONSOLE_NITRO 0x80000000 +#define OS_CONSOLE_DEV_CARD 0x02000000 #define OS_CONSOLE_SIZE_MASK 0x00000003 #define OS_CONSOLE_SIZE_4MB 0x00000001 diff --git a/arm9/lib/src/OS_arena.c b/arm9/lib/src/OS_arena.c index eb04e60b1..ae05b49cb 100644 --- a/arm9/lib/src/OS_arena.c +++ b/arm9/lib/src/OS_arena.c @@ -5,8 +5,8 @@ #include "consts.h" #include "OS_arena.h" #include "OS_protectionRegion.h" +#include "OS_emulator.h" -extern u32 OS_GetConsoleType(); extern BOOL OSi_MainExArenaEnabled; extern BOOL OSi_Initialized; // TODO: located at 0x021d36f0 void SDK_MAIN_ARENA_LO(); // TODO: technically this should be defined in the lcf diff --git a/arm9/lib/src/OS_emulator.c b/arm9/lib/src/OS_emulator.c new file mode 100644 index 000000000..1be0e1634 --- /dev/null +++ b/arm9/lib/src/OS_emulator.c @@ -0,0 +1,18 @@ +// +// Created by red031000 on 2020-05-05. +// + +#include "OS_emulator.h" +#include "function_target.h" + +extern u32 OSi_ConsoleTypeCache; //todo fix bss + +ARM_FUNC BOOL OS_IsRunOnEmulator() { + return FALSE; +} + +ARM_FUNC u32 OS_GetConsoleType() { + OSi_ConsoleTypeCache = OS_CONSOLE_NITRO | OS_CONSOLE_DEV_CARD | OS_CONSOLE_SIZE_4MB; + + return OSi_ConsoleTypeCache; +} diff --git a/arm9/undefined_syms.txt b/arm9/undefined_syms.txt index 72e1c07e6..a76e77837 100644 --- a/arm9/undefined_syms.txt +++ b/arm9/undefined_syms.txt @@ -16,6 +16,7 @@ Unk_02106A00 = 0x02106A00; Unk_02106A04 = 0x02106A04; // .bss +OSi_ConsoleTypeCache = 0x02106828; gBacklightTop = 0x02106FA0; gBacklightTop_2 = 0x02106FA0; gUnknown21C48B8 = 0x021C48B8; diff --git a/undefined_syms.txt b/undefined_syms.txt index 302fe8bf2..9fca8cb55 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -14,6 +14,7 @@ Unk_02106A00 = 0x02106A00; Unk_02106A04 = 0x02106A04; // .bss +OSi_ConsoleTypeCache = 0x02106828; gBacklightTop = 0x02106FA0; gBacklightTop_2 = 0x02106FA0; gUnknown21C48B8 = 0x021C48B8;