summaryrefslogtreecommitdiff
path: root/include/JSystem/JUtility
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2021-05-10 08:54:07 -0700
committerGitHub <noreply@github.com>2021-05-10 11:54:07 -0400
commit462d71cbef02ef119fc2aa480b98cfeedde46441 (patch)
tree923ed9f6f939c3e4b64dba0070e1539d05910089 /include/JSystem/JUtility
parent9799fadfe84344fa3ea78835365570d832a476c7 (diff)
Makefile fixes / JUTNameTab (#129)
* 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>
Diffstat (limited to 'include/JSystem/JUtility')
-rw-r--r--include/JSystem/JUtility/JUTNameTab.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/JSystem/JUtility/JUTNameTab.h b/include/JSystem/JUtility/JUTNameTab.h
index 008473520a..ff0e7860e8 100644
--- a/include/JSystem/JUtility/JUTNameTab.h
+++ b/include/JSystem/JUtility/JUTNameTab.h
@@ -3,4 +3,34 @@
#include "dolphin/types.h"
+struct ResNTAB {
+ u16 mEntryNum;
+ u16 mPad0;
+ struct Entry {
+ u16 mKeyCode;
+ u16 mOffs;
+ } mEntries[1];
+
+ inline const char* getName(u32 index) const {
+ return ((const char*)mEntries) + mEntries[index].mOffs - 4;
+ }
+};
+
+class JUTNameTab {
+public:
+ JUTNameTab();
+ JUTNameTab(const ResNTAB* pNameTable);
+ virtual ~JUTNameTab() {}
+
+ void setResource(const ResNTAB* pNameTable);
+ s32 getIndex(char const*) const;
+ const char* getName(u16 index) const;
+ u16 calcKeyCode(char const* pName) const;
+
+private:
+ const ResNTAB* mpNameTable;
+ const char* mpStrData;
+ u16 mNameNum;
+};
+
#endif /* JUTNAMETAB_H */