diff options
| author | robojumper <robojumper@gmail.com> | 2024-09-30 02:34:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-29 20:34:33 -0400 |
| commit | ed4aa2311932f216067bfbc31bb692247c93ac55 (patch) | |
| tree | 569fb28a5dd77a9996cdb67abb455a63388e86d8 /include | |
| parent | fe1c06e056e3c9cfe96edd44af7a879175005f27 (diff) | |
d_rawarchive followups (#42)
* d_rawarchive followups
* symbols hygiene
* Add Egg function
Diffstat (limited to 'include')
| -rw-r--r-- | include/MSL_C/MSL_Common/Src/string.h | 1 | ||||
| -rw-r--r-- | include/d/d_rawarchive.h | 26 | ||||
| -rw-r--r-- | include/egg/gfx/eggLight.h | 1 | ||||
| -rw-r--r-- | include/nw4r/g3d/g3d_resfile.h | 7 | ||||
| -rw-r--r-- | include/nw4r/g3d/g3d_resmat.h | 4 |
5 files changed, 32 insertions, 7 deletions
diff --git a/include/MSL_C/MSL_Common/Src/string.h b/include/MSL_C/MSL_Common/Src/string.h index 8a0a3f97..b4bcd08d 100644 --- a/include/MSL_C/MSL_Common/Src/string.h +++ b/include/MSL_C/MSL_Common/Src/string.h @@ -17,6 +17,7 @@ int strcmp(const char* str1, const char* str2); char* strcat(char* dst, const char* src); char* strncpy(char* dst, const char* src, size_t n); char* strcpy(char* dst, const char* src); +int sscanf(const char *buffer, const char *format, ...); size_t strlen(const char* str); #ifdef __cplusplus diff --git a/include/d/d_rawarchive.h b/include/d/d_rawarchive.h index 53ec867a..abffa93d 100644 --- a/include/d/d_rawarchive.h +++ b/include/d/d_rawarchive.h @@ -3,9 +3,25 @@ #include <common.h> #include <m/m_dvd.h> -// clang-format off #include <sized_string.h> -// clang-format on + +class ArcCallbackHandlerBase { +public: + ArcCallbackHandlerBase(): mPrefix(' ') {} + /* vtable at 8050df50 */ + /** 800651c0 */ + virtual void CreateArcEntry(void *data, const char *path); + /** 800653d0 */ + virtual void DestroyArcEntry(const char *path); + + u32 mPrefix; +}; + +class ArcCallbackHandler : public ArcCallbackHandlerBase { +public: + ArcCallbackHandler() {} + static ArcCallbackHandler sInstance; +}; // TODO: loading status could be an enum (-2/-1/0/+1) @@ -22,7 +38,7 @@ public: static BOOL checkArcExistsOnDisk(const char *fileName, const char *dirName); static BOOL checkArcExistsOnDiskInner(SizedString<128> &path, const char *fileName, const char *dirName); - int mount(const char *name, void *data, void *callbackArg, u8 mountDirection, EGG::Heap *heap); + int mount(const char *name, void *data, ArcCallbackHandler *callbackArg, u8 mountDirection, EGG::Heap *heap); int onMount(void *callbackArg); int ensureLoadedMaybe(void *callbackArg); @@ -83,7 +99,7 @@ public: dRawArcTable_c(); ~dRawArcTable_c(); - bool init(u16 count, void *callbackArg, EGG::Heap *heap); + bool init(u16 count, ArcCallbackHandler *callbackArg, EGG::Heap *heap); BOOL getArcOrLoadFromDisk(const char *name, const char *dirName, u8 mountDirection, EGG::Heap *heap); BOOL addEntryFromSuperArc(const char *name, void *data, u8 mountDirection, EGG::Heap *heap); int ensureLoadedMaybe2(const char *name); @@ -101,7 +117,7 @@ public: private: /* 0x0 */ dRawArcEntry_c *mpEntries; /* 0x4 */ u16 mCount; - /* 0x8 */ void *mCallbackArg; + /* 0x8 */ ArcCallbackHandler *mCallbackArg; }; #endif; diff --git a/include/egg/gfx/eggLight.h b/include/egg/gfx/eggLight.h index 073705a7..f48991ba 100644 --- a/include/egg/gfx/eggLight.h +++ b/include/egg/gfx/eggLight.h @@ -20,6 +20,7 @@ public: virtual void GetBinaryInner(Bin *) const override; virtual size_t GetBinarySize() override; virtual void SetBinaryInner(const Bin &, const Bin &, f32) override; + void replaceModelTextures(nw4r::g3d::ResMdl) const; void drawAndCaptureTexture(f32, f32, f32, f32); }; diff --git a/include/nw4r/g3d/g3d_resfile.h b/include/nw4r/g3d/g3d_resfile.h index 9a8c51cd..f6375cf7 100644 --- a/include/nw4r/g3d/g3d_resfile.h +++ b/include/nw4r/g3d/g3d_resfile.h @@ -18,8 +18,8 @@ struct ResFileData { struct ResFile { ResCommon<ResFileData> mFile; // at 0x0 - ResFile(): mFile((void*)nullptr) {} - ResFile(void *ptr): mFile(ptr) {} + ResFile() : mFile((void *)nullptr) {} + ResFile(void *ptr) : mFile(ptr) {} inline ResFileData &ref() const { return mFile.ref(); @@ -79,6 +79,9 @@ struct ResFile { u32 GetResAnmScnNumEntries() const; bool Bind(ResFile); + bool Bind() { + return Bind(*this); + } void Release(); void Init(); void Terminate(); diff --git a/include/nw4r/g3d/g3d_resmat.h b/include/nw4r/g3d/g3d_resmat.h index 4946b707..b1bcba41 100644 --- a/include/nw4r/g3d/g3d_resmat.h +++ b/include/nw4r/g3d/g3d_resmat.h @@ -46,6 +46,8 @@ struct ResPixDL { struct ResMatPix : public ResCommon<ResPixDL> { ResMatPix(void *vptr) : ResCommon(vptr) {} void DCStore(bool sync); + void GXGetDstAlpha(u8*, u8*) const; + void GXSetDstAlpha(u8, u8); void CallDisplayList(bool bSync) const; ResMatPix CopyTo(void *p) const; @@ -179,6 +181,8 @@ struct ResMat : public ResCommon<ResMatData> { return ResMatTexCoordGen(&ofs_to_ptr<ResMatDLData>(ref().toResMatDLData)->dlTexCoordGen); } + bool IsOpaque() const; + bool Bind(ResFile); UNKTYPE Release(); UNKTYPE Init(); |
