mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-06 02:58:18 -04:00
Reorganize library code into libs/ (#3119)
* Reorganize files into libs/{dolphin,JSystem,PowerPC_EABI_Support,revolution,TRK_MINNOW_DOLPHIN}
* Update configure.py and project.py for new libs structure
* Refactor `#include <dolphin/x.h>` -> `<x.h>`
* Remove `__REVOLUTION_SDK__` forwards from dolphin
* Fix dolphin/ references in revolution
* Wrap `#include <dolphin.h>` in `!__REVOLUTION_SDK__`
* Always build TRK against dolphin headers
* Resolve revolution SDK header resolution issues
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JUtility/JUTResource.h"
|
||||
#include "JSystem/JKernel/JKRArchive.h"
|
||||
#include "JSystem/JSupport/JSUInputStream.h"
|
||||
#include <cstring>
|
||||
|
||||
void* JUTResReference::getResource(JSUInputStream* stream, u32 resType, JKRArchive* archive) {
|
||||
stream->read(mType);
|
||||
stream->read(mNameLength);
|
||||
stream->read(&mName, mNameLength);
|
||||
|
||||
if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4) {
|
||||
mName[mNameLength] = 0;
|
||||
}
|
||||
|
||||
return getResource(resType, archive);
|
||||
}
|
||||
|
||||
|
||||
void* JUTResReference::getResource(const void* data, u32 resType, JKRArchive* archive) {
|
||||
const u8* pData = (const u8*)data;
|
||||
mType = pData[0];
|
||||
mNameLength = pData[1];
|
||||
|
||||
if (mNameLength != 0) {
|
||||
memcpy(&mName, &pData[2], mNameLength);
|
||||
}
|
||||
|
||||
if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4) {
|
||||
mName[mNameLength] = 0;
|
||||
}
|
||||
|
||||
return getResource(resType, archive);
|
||||
}
|
||||
|
||||
void* JUTResReference::getResource(u32 resType, JKRArchive* archive) {
|
||||
void* res = NULL;
|
||||
switch (mType) {
|
||||
case RESTYPE_Unk1:
|
||||
break;
|
||||
case RESTYPE_Unk2:
|
||||
res = JKRGetTypeResource(resType, mName, archive);
|
||||
break;
|
||||
case RESTYPE_Unk3:
|
||||
res = JKRGetNameResource(mName, archive);
|
||||
break;
|
||||
case RESTYPE_Unk4:
|
||||
res = JKRGetResource(mName);
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
Reference in New Issue
Block a user