mirror of
https://github.com/zeldaret/tp
synced 2026-05-23 15:01:53 -04:00
462d71cbef
* Makefile: Fix issues with iconv causing it to break under devkitPro / msys The version of iconv included in devkitPro does not have a -o option, so replace it with normal shell redirection. Also, SHIFT-JIS does not have a mapping for ~, so output the Windows CP932 variant instead, which does. See: https://en.wikipedia.org/wiki/Tilde#Unicode_and_Shift_JIS_encoding_of_wave_dash https://en.wikipedia.org/wiki/Code_page_932_(Microsoft_Windows)#Single-byte_character_differences * Update diff configuration -Bbinary doesn't seem to work with my copy of bjdump (it says it can't decode unknown architecture) Cheese things by using expected/ instead of having the user place things manually. * JUTNameTab * J3DPacket / J3DDrawBuffer * format Co-authored-by: lepelog <lepelog@users.noreply.github.com>
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
//
|
|
// Generated By: dol2asm
|
|
// Translation Unit: JUTNameTab
|
|
//
|
|
|
|
#include "JSystem/JUtility/JUTNameTab.h"
|
|
#include "dol2asm.h"
|
|
#include "dolphin/types.h"
|
|
#include "msl_c/string.h"
|
|
|
|
JUTNameTab::JUTNameTab() {
|
|
setResource(NULL);
|
|
}
|
|
|
|
JUTNameTab::JUTNameTab(const ResNTAB* pNameTable) {
|
|
setResource(pNameTable);
|
|
}
|
|
|
|
void JUTNameTab::setResource(const ResNTAB* pNameTable) {
|
|
mpNameTable = pNameTable;
|
|
|
|
if (pNameTable != NULL) {
|
|
mNameNum = pNameTable->mEntryNum;
|
|
mpStrData = (const char*)(pNameTable->mEntries + mNameNum);
|
|
} else {
|
|
mNameNum = 0;
|
|
mpStrData = 0;
|
|
}
|
|
}
|
|
|
|
s32 JUTNameTab::getIndex(const char* pName) const {
|
|
const ResNTAB::Entry* pEntry = mpNameTable->mEntries;
|
|
u16 keyCode = calcKeyCode(pName);
|
|
|
|
for (u16 i = 0; i < mNameNum; pEntry++, i++)
|
|
if (pEntry->mKeyCode == keyCode &&
|
|
strcmp((mpNameTable->mEntries[i].mOffs + ((const char*)mpNameTable)), pName) == 0)
|
|
return i;
|
|
|
|
return -1;
|
|
}
|
|
|
|
const char* JUTNameTab::getName(u16 index) const {
|
|
if (index < mNameNum)
|
|
return mpNameTable->getName(index);
|
|
return NULL;
|
|
}
|
|
|
|
u16 JUTNameTab::calcKeyCode(const char* pName) const {
|
|
u32 keyCode = 0;
|
|
while (*pName)
|
|
keyCode = (keyCode * 3) + *pName++;
|
|
return keyCode;
|
|
}
|