diff --git a/config/GM8E01_00/NESemu/splits.txt b/config/GM8E01_00/NESemu/splits.txt index dcbf8efc..c178f946 100644 --- a/config/GM8E01_00/NESemu/splits.txt +++ b/config/GM8E01_00/NESemu/splits.txt @@ -5,3 +5,13 @@ Sections: .rodata type:rodata align:8 .data type:data align:8 .bss type:bss align:32 + +RELSetup/modwrapper.c: + .text start:0x00000000 end:0x000000D4 + .data start:0x00000000 end:0x00000030 + +NESemu/emu.c: + .text start:0x000000D4 end:0x0000A1F4 + .rodata start:0x00000000 end:0x00000104 + .data start:0x00000030 end:0x0001F104 + .bss start:0x00000000 end:0x00009E1C diff --git a/config/GM8E01_00/NESemu/symbols.txt b/config/GM8E01_00/NESemu/symbols.txt index fa8396d1..dfdf68a3 100644 --- a/config/GM8E01_00/NESemu/symbols.txt +++ b/config/GM8E01_00/NESemu/symbols.txt @@ -11,7 +11,7 @@ fn_1_EAC = .text:0x00000EAC; // type:function size:0x78 fn_1_F24 = .text:0x00000F24; // type:function size:0xAD8 fn_1_19FC = .text:0x000019FC; // type:function size:0xF0 fn_1_1AEC = .text:0x00001AEC; // type:function size:0xD8 -lbl_1_text_1BC4 = .text:0x00001BC4; // type:label +fn_1_1BC4 = .text:0x00001BC4; // type:function lbl_1_text_1C60 = .text:0x00001C60; // type:label lbl_1_text_1C68 = .text:0x00001C68; // type:label lbl_1_text_2134 = .text:0x00002134; // type:label @@ -132,8 +132,8 @@ lbl_1_text_3174 = .text:0x00003174; // type:label lbl_1_text_31A0 = .text:0x000031A0; // type:label lbl_1_text_3244 = .text:0x00003244; // type:label lbl_1_text_324C = .text:0x0000324C; // type:label -lbl_1_text_33F4 = .text:0x000033F4; // type:label -lbl_1_text_3418 = .text:0x00003418; // type:label +fn_1_33F4 = .text:0x000033F4; // type:function +fn_1_3418 = .text:0x00003418; // type:function fn_1_3438 = .text:0x00003438; // type:function size:0x8C fn_1_34C4 = .text:0x000034C4; // type:function size:0x17C fn_1_3640 = .text:0x00003640; // type:function size:0x1DC @@ -211,9 +211,9 @@ lbl_1_rodata_B4 = .rodata:0x000000B4; // type:object size:0x20 data:float lbl_1_rodata_D4 = .rodata:0x000000D4; // type:object size:0x4 data:float lbl_1_rodata_D8 = .rodata:0x000000D8; // type:object size:0x4 data:float lbl_1_rodata_E0 = .rodata:0x000000E0; // type:object size:0x24 -lbl_1_data_0 = .data:0x00000000; // type:object size:0x10 -lbl_1_data_10 = .data:0x00000010; // type:object size:0x20 -lbl_1_data_30 = .data:0x00000030; // type:object size:0x1D940 +lbl_1_data_0 = .data:0x00000000; // type:object size:0xD scope:local data:string +lbl_1_data_10 = .data:0x00000010; // type:object size:0x19 scope:local data:string +kRomData = .data:0x00000030; // type:object size:0x1D940 scope:local data:byte lbl_1_data_1D970 = .data:0x0001D970; // type:object size:0x160 lbl_1_data_1DAD0 = .data:0x0001DAD0; // type:object size:0x28 lbl_1_data_1DAF8 = .data:0x0001DAF8; // type:object size:0x1030 diff --git a/config/GM8E01_00/config.yml b/config/GM8E01_00/config.yml index 3eada28d..b7e65740 100644 --- a/config/GM8E01_00/config.yml +++ b/config/GM8E01_00/config.yml @@ -6,8 +6,8 @@ mw_comment_version: 8 quick_analysis: true # Faster reruns after full analysis fill_gaps: false # Alignments known -#modules: -#- object: orig/GM8E01_00/files/NESemuP.rel - #hash: 5ad6bb727d6dd220e6aceef9143c61a86a6f2bb5 - #symbols: config/GM8E01_00/NESemu/symbols.txt - #splits: config/GM8E01_00/NESemu/splits.txt +modules: +- object: orig/GM8E01_00/files/NESemuP.rel + hash: 5ad6bb727d6dd220e6aceef9143c61a86a6f2bb5 + symbols: config/GM8E01_00/NESemu/symbols.txt + splits: config/GM8E01_00/NESemu/splits.txt diff --git a/configure.py b/configure.py index 66b0744d..18109de9 100755 --- a/configure.py +++ b/configure.py @@ -831,7 +831,7 @@ config.libs = [ Object(Matching, "Kyoto/Graphics/CGX.cpp"), Object(Matching, "Kyoto/Graphics/CTevCombiners.cpp"), Object(NonMatching, "Kyoto/Graphics/DolphinCGraphics.cpp"), - Object(NonMatching, "Kyoto/Graphics/DolphinCPalette.cpp"), + Object(Matching, "Kyoto/Graphics/DolphinCPalette.cpp"), Object(NonMatching, "Kyoto/Graphics/DolphinCTexture.cpp"), Object(Matching, "Kyoto/Math/CloseEnough.cpp"), Object(NonMatching, "Kyoto/Math/CMatrix3f.cpp"), diff --git a/include/Kyoto/CFrameDelayedKiller.hpp b/include/Kyoto/CFrameDelayedKiller.hpp index 68998c46..af9cb2f7 100644 --- a/include/Kyoto/CFrameDelayedKiller.hpp +++ b/include/Kyoto/CFrameDelayedKiller.hpp @@ -8,8 +8,8 @@ public: static void Initialize(); static void ShutDown(); - static void sub_8036cb90(); - static void sub_8036cc1c(bool unk1, void* unk2); + static void fn_8036CB90(); + static void fn_8036CC1C(bool unk1, void* unk2); }; #endif // _CFRAMEDELAYEDKILLER diff --git a/include/Kyoto/Graphics/CGraphicsPalette.hpp b/include/Kyoto/Graphics/CGraphicsPalette.hpp index a7d9532e..6ae66bc5 100644 --- a/include/Kyoto/Graphics/CGraphicsPalette.hpp +++ b/include/Kyoto/Graphics/CGraphicsPalette.hpp @@ -1,6 +1,8 @@ #ifndef _CGRAPHICSPALETTE #define _CGRAPHICSPALETTE +#include "dolphin/gx/GXEnum.h" +#include "dolphin/gx/GXStruct.h" #include "types.h" #include "dolphin/gx.h" @@ -21,6 +23,7 @@ public: CGraphicsPalette(CInputStream& in); ~CGraphicsPalette(); + inline GXTlutFmt GetTlutFmt() const { return static_cast(x0_fmt); } ushort* GetPaletteData() { return xc_entries.get(); } const ushort* GetPaletteData() const { return xc_entries.get(); } void Load() const; @@ -31,7 +34,7 @@ private: EPaletteFormat x0_fmt; mutable uint x4_frameLoaded; uint x8_entryCount; - rstl::single_ptr xc_entries; + rstl::single_ptr< ushort > xc_entries; GXTlutObj x10_tlutObj; bool x1c_locked; }; diff --git a/include/dolphin/gx/GXTexture.h b/include/dolphin/gx/GXTexture.h index 44a38616..32de49ca 100644 --- a/include/dolphin/gx/GXTexture.h +++ b/include/dolphin/gx/GXTexture.h @@ -22,7 +22,7 @@ void GXLoadTexObj(GXTexObj* obj, GXTexMapID id); u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, u8 max_lod); void GXInvalidateTexAll(); void GXInitTexObjWrapMode(GXTexObj* obj, GXTexWrapMode s, GXTexWrapMode t); -void GXInitTlutObj(GXTlutObj* obj, const void* data, GXTlutFmt format, u16 entries); +void GXInitTlutObj(GXTlutObj* obj, void* data, GXTlutFmt format, u16 entries); void GXLoadTlut(const GXTlutObj* obj, GXTlut idx); void GXSetTexCoordScaleManually(GXTexCoordID coord, GXBool enable, u16 ss, u16 ts); void GXInitTexCacheRegion(GXTexRegion* region, GXBool is_32b_mipmap, u32 tmem_even, diff --git a/src/Dolphin/os/OSMessage.c b/src/Dolphin/os/OSMessage.c index a3329fad..b3b80329 100644 --- a/src/Dolphin/os/OSMessage.c +++ b/src/Dolphin/os/OSMessage.c @@ -1,7 +1,5 @@ #include -#pragma push -#pragma force_active on void OSInitMessageQueue(OSMessageQueue* mq, OSMessage* msgArray, s32 msgCount) { OSInitThreadQueue(&mq->queueSend); OSInitThreadQueue(&mq->queueReceive); @@ -60,7 +58,6 @@ BOOL OSReceiveMessage(OSMessageQueue* mq, OSMessage* msg, s32 flags) { OSRestoreInterrupts(enabled); return TRUE; } -#pragma pop BOOL OSJamMessage(OSMessageQueue* mq, OSMessage msg, s32 flags) { BOOL enabled; diff --git a/src/Kyoto/Graphics/DolphinCPalette.cpp b/src/Kyoto/Graphics/DolphinCPalette.cpp index 871d4125..ac77d129 100644 --- a/src/Kyoto/Graphics/DolphinCPalette.cpp +++ b/src/Kyoto/Graphics/DolphinCPalette.cpp @@ -3,16 +3,21 @@ #include "Kyoto/Alloc/CMemorySys.hpp" #include "Kyoto/CFrameDelayedKiller.hpp" #include "Kyoto/Streams/CInputStream.hpp" +#include "dolphin/gx/GXEnum.h" #include "dolphin/os/OSCache.h" uint CGraphicsPalette::sCurrentFrameCount = 0; +inline GXTlutFmt ConvertFormat(EPaletteFormat fmt) { + return static_cast(fmt); +} + CGraphicsPalette::CGraphicsPalette(EPaletteFormat format, int numEntries) : x0_fmt(format) , x8_entryCount(numEntries) , xc_entries((ushort*)CMemory::Alloc(numEntries * sizeof(ushort), IAllocator::kHI_RoundUpLen)) , x1c_locked(false) { - GXInitTlutObj(&x10_tlutObj, xc_entries.get(), (GXTlutFmt)(x0_fmt), x8_entryCount); + GXInitTlutObj(&x10_tlutObj, xc_entries.get(), ConvertFormat(x0_fmt), x8_entryCount); } CGraphicsPalette::CGraphicsPalette(CInputStream& in) @@ -21,14 +26,14 @@ CGraphicsPalette::CGraphicsPalette(CInputStream& in) , xc_entries((ushort*)CMemory::Alloc(x8_entryCount * sizeof(ushort), IAllocator::kHI_RoundUpLen)) , x1c_locked(false) { in.Get(reinterpret_cast< uchar* >(xc_entries.get()), x8_entryCount * sizeof(ushort)); - GXInitTlutObj(&x10_tlutObj, xc_entries.get(), static_cast< GXTlutFmt >(x0_fmt), x8_entryCount); + GXInitTlutObj(&x10_tlutObj, xc_entries.get(), ConvertFormat(x0_fmt), x8_entryCount); DCFlushRange(xc_entries.get(), x8_entryCount * sizeof(ushort)); } CGraphicsPalette::~CGraphicsPalette() { uint frameDiff = sCurrentFrameCount - x4_frameLoaded; if (frameDiff < 2) { - CFrameDelayedKiller::sub_8036cc1c(frameDiff == 0, xc_entries.release()); + CFrameDelayedKiller::fn_8036CC1C(frameDiff == 0, xc_entries.release()); } } @@ -39,7 +44,7 @@ void CGraphicsPalette::Load() const { void CGraphicsPalette::UnLock() { DCStoreRange(xc_entries.get(), x8_entryCount * sizeof(ushort)); - GXInitTlutObj(&x10_tlutObj, xc_entries.get(), static_cast< GXTlutFmt >(x0_fmt), x8_entryCount); + GXInitTlutObj(&x10_tlutObj, xc_entries.get(), ConvertFormat(x0_fmt), x8_entryCount); DCFlushRange(xc_entries.get(), x8_entryCount * sizeof(ushort)); x1c_locked = false; }