Match and link DolphinCPalette

Former-commit-id: 1c2e8dd3334119ff1c131d2dc91cc83155164902
This commit is contained in:
Phillip Stephens 2023-10-14 17:24:41 -07:00
parent 6eb1f81068
commit 5b99371451
9 changed files with 38 additions and 23 deletions

View File

@ -5,3 +5,13 @@ Sections:
.rodata type:rodata align:8 .rodata type:rodata align:8
.data type:data align:8 .data type:data align:8
.bss type:bss align:32 .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

View File

@ -11,7 +11,7 @@ fn_1_EAC = .text:0x00000EAC; // type:function size:0x78
fn_1_F24 = .text:0x00000F24; // type:function size:0xAD8 fn_1_F24 = .text:0x00000F24; // type:function size:0xAD8
fn_1_19FC = .text:0x000019FC; // type:function size:0xF0 fn_1_19FC = .text:0x000019FC; // type:function size:0xF0
fn_1_1AEC = .text:0x00001AEC; // type:function size:0xD8 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_1C60 = .text:0x00001C60; // type:label
lbl_1_text_1C68 = .text:0x00001C68; // type:label lbl_1_text_1C68 = .text:0x00001C68; // type:label
lbl_1_text_2134 = .text:0x00002134; // 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_31A0 = .text:0x000031A0; // type:label
lbl_1_text_3244 = .text:0x00003244; // type:label lbl_1_text_3244 = .text:0x00003244; // type:label
lbl_1_text_324C = .text:0x0000324C; // type:label lbl_1_text_324C = .text:0x0000324C; // type:label
lbl_1_text_33F4 = .text:0x000033F4; // type:label fn_1_33F4 = .text:0x000033F4; // type:function
lbl_1_text_3418 = .text:0x00003418; // type:label fn_1_3418 = .text:0x00003418; // type:function
fn_1_3438 = .text:0x00003438; // type:function size:0x8C fn_1_3438 = .text:0x00003438; // type:function size:0x8C
fn_1_34C4 = .text:0x000034C4; // type:function size:0x17C fn_1_34C4 = .text:0x000034C4; // type:function size:0x17C
fn_1_3640 = .text:0x00003640; // type:function size:0x1DC 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_D4 = .rodata:0x000000D4; // type:object size:0x4 data:float
lbl_1_rodata_D8 = .rodata:0x000000D8; // 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_rodata_E0 = .rodata:0x000000E0; // type:object size:0x24
lbl_1_data_0 = .data:0x00000000; // type:object size:0x10 lbl_1_data_0 = .data:0x00000000; // type:object size:0xD scope:local data:string
lbl_1_data_10 = .data:0x00000010; // type:object size:0x20 lbl_1_data_10 = .data:0x00000010; // type:object size:0x19 scope:local data:string
lbl_1_data_30 = .data:0x00000030; // type:object size:0x1D940 kRomData = .data:0x00000030; // type:object size:0x1D940 scope:local data:byte
lbl_1_data_1D970 = .data:0x0001D970; // type:object size:0x160 lbl_1_data_1D970 = .data:0x0001D970; // type:object size:0x160
lbl_1_data_1DAD0 = .data:0x0001DAD0; // type:object size:0x28 lbl_1_data_1DAD0 = .data:0x0001DAD0; // type:object size:0x28
lbl_1_data_1DAF8 = .data:0x0001DAF8; // type:object size:0x1030 lbl_1_data_1DAF8 = .data:0x0001DAF8; // type:object size:0x1030

View File

@ -6,8 +6,8 @@ mw_comment_version: 8
quick_analysis: true # Faster reruns after full analysis quick_analysis: true # Faster reruns after full analysis
fill_gaps: false # Alignments known fill_gaps: false # Alignments known
#modules: modules:
#- object: orig/GM8E01_00/files/NESemuP.rel - object: orig/GM8E01_00/files/NESemuP.rel
#hash: 5ad6bb727d6dd220e6aceef9143c61a86a6f2bb5 hash: 5ad6bb727d6dd220e6aceef9143c61a86a6f2bb5
#symbols: config/GM8E01_00/NESemu/symbols.txt symbols: config/GM8E01_00/NESemu/symbols.txt
#splits: config/GM8E01_00/NESemu/splits.txt splits: config/GM8E01_00/NESemu/splits.txt

View File

@ -831,7 +831,7 @@ config.libs = [
Object(Matching, "Kyoto/Graphics/CGX.cpp"), Object(Matching, "Kyoto/Graphics/CGX.cpp"),
Object(Matching, "Kyoto/Graphics/CTevCombiners.cpp"), Object(Matching, "Kyoto/Graphics/CTevCombiners.cpp"),
Object(NonMatching, "Kyoto/Graphics/DolphinCGraphics.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(NonMatching, "Kyoto/Graphics/DolphinCTexture.cpp"),
Object(Matching, "Kyoto/Math/CloseEnough.cpp"), Object(Matching, "Kyoto/Math/CloseEnough.cpp"),
Object(NonMatching, "Kyoto/Math/CMatrix3f.cpp"), Object(NonMatching, "Kyoto/Math/CMatrix3f.cpp"),

View File

@ -8,8 +8,8 @@ public:
static void Initialize(); static void Initialize();
static void ShutDown(); static void ShutDown();
static void sub_8036cb90(); static void fn_8036CB90();
static void sub_8036cc1c(bool unk1, void* unk2); static void fn_8036CC1C(bool unk1, void* unk2);
}; };
#endif // _CFRAMEDELAYEDKILLER #endif // _CFRAMEDELAYEDKILLER

View File

@ -1,6 +1,8 @@
#ifndef _CGRAPHICSPALETTE #ifndef _CGRAPHICSPALETTE
#define _CGRAPHICSPALETTE #define _CGRAPHICSPALETTE
#include "dolphin/gx/GXEnum.h"
#include "dolphin/gx/GXStruct.h"
#include "types.h" #include "types.h"
#include "dolphin/gx.h" #include "dolphin/gx.h"
@ -21,6 +23,7 @@ public:
CGraphicsPalette(CInputStream& in); CGraphicsPalette(CInputStream& in);
~CGraphicsPalette(); ~CGraphicsPalette();
inline GXTlutFmt GetTlutFmt() const { return static_cast<GXTlutFmt>(x0_fmt); }
ushort* GetPaletteData() { return xc_entries.get(); } ushort* GetPaletteData() { return xc_entries.get(); }
const ushort* GetPaletteData() const { return xc_entries.get(); } const ushort* GetPaletteData() const { return xc_entries.get(); }
void Load() const; void Load() const;
@ -31,7 +34,7 @@ private:
EPaletteFormat x0_fmt; EPaletteFormat x0_fmt;
mutable uint x4_frameLoaded; mutable uint x4_frameLoaded;
uint x8_entryCount; uint x8_entryCount;
rstl::single_ptr<ushort> xc_entries; rstl::single_ptr< ushort > xc_entries;
GXTlutObj x10_tlutObj; GXTlutObj x10_tlutObj;
bool x1c_locked; bool x1c_locked;
}; };

View File

@ -22,7 +22,7 @@ void GXLoadTexObj(GXTexObj* obj, GXTexMapID id);
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, u8 max_lod); u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, u8 max_lod);
void GXInvalidateTexAll(); void GXInvalidateTexAll();
void GXInitTexObjWrapMode(GXTexObj* obj, GXTexWrapMode s, GXTexWrapMode t); 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 GXLoadTlut(const GXTlutObj* obj, GXTlut idx);
void GXSetTexCoordScaleManually(GXTexCoordID coord, GXBool enable, u16 ss, u16 ts); void GXSetTexCoordScaleManually(GXTexCoordID coord, GXBool enable, u16 ss, u16 ts);
void GXInitTexCacheRegion(GXTexRegion* region, GXBool is_32b_mipmap, u32 tmem_even, void GXInitTexCacheRegion(GXTexRegion* region, GXBool is_32b_mipmap, u32 tmem_even,

View File

@ -1,7 +1,5 @@
#include <dolphin/os.h> #include <dolphin/os.h>
#pragma push
#pragma force_active on
void OSInitMessageQueue(OSMessageQueue* mq, OSMessage* msgArray, s32 msgCount) { void OSInitMessageQueue(OSMessageQueue* mq, OSMessage* msgArray, s32 msgCount) {
OSInitThreadQueue(&mq->queueSend); OSInitThreadQueue(&mq->queueSend);
OSInitThreadQueue(&mq->queueReceive); OSInitThreadQueue(&mq->queueReceive);
@ -60,7 +58,6 @@ BOOL OSReceiveMessage(OSMessageQueue* mq, OSMessage* msg, s32 flags) {
OSRestoreInterrupts(enabled); OSRestoreInterrupts(enabled);
return TRUE; return TRUE;
} }
#pragma pop
BOOL OSJamMessage(OSMessageQueue* mq, OSMessage msg, s32 flags) { BOOL OSJamMessage(OSMessageQueue* mq, OSMessage msg, s32 flags) {
BOOL enabled; BOOL enabled;

View File

@ -3,16 +3,21 @@
#include "Kyoto/Alloc/CMemorySys.hpp" #include "Kyoto/Alloc/CMemorySys.hpp"
#include "Kyoto/CFrameDelayedKiller.hpp" #include "Kyoto/CFrameDelayedKiller.hpp"
#include "Kyoto/Streams/CInputStream.hpp" #include "Kyoto/Streams/CInputStream.hpp"
#include "dolphin/gx/GXEnum.h"
#include "dolphin/os/OSCache.h" #include "dolphin/os/OSCache.h"
uint CGraphicsPalette::sCurrentFrameCount = 0; uint CGraphicsPalette::sCurrentFrameCount = 0;
inline GXTlutFmt ConvertFormat(EPaletteFormat fmt) {
return static_cast<GXTlutFmt>(fmt);
}
CGraphicsPalette::CGraphicsPalette(EPaletteFormat format, int numEntries) CGraphicsPalette::CGraphicsPalette(EPaletteFormat format, int numEntries)
: x0_fmt(format) : x0_fmt(format)
, x8_entryCount(numEntries) , x8_entryCount(numEntries)
, xc_entries((ushort*)CMemory::Alloc(numEntries * sizeof(ushort), IAllocator::kHI_RoundUpLen)) , xc_entries((ushort*)CMemory::Alloc(numEntries * sizeof(ushort), IAllocator::kHI_RoundUpLen))
, x1c_locked(false) { , 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) CGraphicsPalette::CGraphicsPalette(CInputStream& in)
@ -21,14 +26,14 @@ CGraphicsPalette::CGraphicsPalette(CInputStream& in)
, xc_entries((ushort*)CMemory::Alloc(x8_entryCount * sizeof(ushort), IAllocator::kHI_RoundUpLen)) , xc_entries((ushort*)CMemory::Alloc(x8_entryCount * sizeof(ushort), IAllocator::kHI_RoundUpLen))
, x1c_locked(false) { , x1c_locked(false) {
in.Get(reinterpret_cast< uchar* >(xc_entries.get()), x8_entryCount * sizeof(ushort)); 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)); DCFlushRange(xc_entries.get(), x8_entryCount * sizeof(ushort));
} }
CGraphicsPalette::~CGraphicsPalette() { CGraphicsPalette::~CGraphicsPalette() {
uint frameDiff = sCurrentFrameCount - x4_frameLoaded; uint frameDiff = sCurrentFrameCount - x4_frameLoaded;
if (frameDiff < 2) { 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() { void CGraphicsPalette::UnLock() {
DCStoreRange(xc_entries.get(), x8_entryCount * sizeof(ushort)); 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)); DCFlushRange(xc_entries.get(), x8_entryCount * sizeof(ushort));
x1c_locked = false; x1c_locked = false;
} }