diff options
Diffstat (limited to 'libs')
39 files changed, 1286 insertions, 89 deletions
diff --git a/libs/JSystem/include/JSystem/JAHNodeLib/JAHSoundPlayerNode.h b/libs/JSystem/include/JSystem/JAHNodeLib/JAHSoundPlayerNode.h index 625b2b9a1c..da603b6d38 100644 --- a/libs/JSystem/include/JSystem/JAHNodeLib/JAHSoundPlayerNode.h +++ b/libs/JSystem/include/JSystem/JAHNodeLib/JAHSoundPlayerNode.h @@ -2,10 +2,43 @@ #define JAHSOUNDPLAYERNODE_H #include "JSystem/JAHostIO/JAHFrameNode.h" +#include "JSystem/JAHostIO/JAHUAsnData.h" +#include "JSystem/JAHostIO/JAHUTableEdit.h" + +class JAHPlayBox : public JAHUSeBox { +public: + JAHPlayBox(); + + virtual void onCurrentNodeFrame(); + +public: + /* 0x85 */ u8 unk85; +}; class JAHSoundPlayerNode : public JAHFrameNode { public: JAHSoundPlayerNode(); + + virtual void message(JAHControl&); + virtual void onCurrentNodeFrame(); + + u8 getContMode() const; + +public: + /* 0x70 */ s32 unk70; + /* 0x74 */ s32 unk74; + /* 0x78 */ s32 unk78; + /* 0x7C */ u8 unk7C; + /* 0x7D */ u8 unk7D; + /* 0x7E */ u8 unk7E; + /* 0x7F */ u8 unk7F; + /* 0x80 */ s32 unk80; + /* 0x84 */ s32 unk84; + /* 0x88 */ s64 unk88; + /* 0x90 */ s64 unk90; + /* 0x98 */ JAHPlayBox unk98; + /* 0x120 */ bool unk120; + /* 0x122 */ JAHUAsn unk122; }; #endif /* JAHSOUNDPLAYERNODE_H */ diff --git a/libs/JSystem/include/JSystem/JAHostIO/JAHFrameNode.h b/libs/JSystem/include/JSystem/JAHostIO/JAHFrameNode.h index 1b4ad74043..991dff94d2 100644 --- a/libs/JSystem/include/JSystem/JAHostIO/JAHFrameNode.h +++ b/libs/JSystem/include/JSystem/JAHostIO/JAHFrameNode.h @@ -9,17 +9,19 @@ class JAHVirtualNode; class JAHFrameNode : public JAHioNode { public: JAHFrameNode(const char*); - /* vt[07] */ virtual ~JAHFrameNode(); /* vt[02] */ virtual void listenPropertyEvent(const JORPropertyEvent*); /* vt[05] */ virtual void genMessage(JORMContext*); /* vt[06] */ virtual void listenNodeEvent(const JORNodeEvent*); - /* vt[0C] */ virtual s32 getNodeType(); + /* vt[0C] */ virtual s32 getNodeType() { return 1; } /* vt[11] */ virtual void onCurrentNodeFrame(); /* vt[12] */ virtual void onFrame(); void framework(); void currentFramework(); + void callAllVirtualMessages(JAHControl&); + void appendVirNode(JAHVirtualNode*); + JSULink<JAHFrameNode>* getFrameNodeLink() { return &mFrameNodeLink; } /* 0x44 */ JSUTree<JAHVirtualNode> mTree; diff --git a/libs/JSystem/include/JSystem/JAHostIO/JAHPubDefine.h b/libs/JSystem/include/JSystem/JAHostIO/JAHPubDefine.h index b67d462bc5..7e2f238582 100644 --- a/libs/JSystem/include/JSystem/JAHostIO/JAHPubDefine.h +++ b/libs/JSystem/include/JSystem/JAHostIO/JAHPubDefine.h @@ -3,18 +3,22 @@ #include "JSystem/JUtility/JUTAssert.h" -template<class T> +template <class T> class JAHSingletonBase { public: JAHSingletonBase() { sInstance = (T*)this; } virtual ~JAHSingletonBase() { sInstance = NULL; } static T* newInstance() { + // clang-format off JUT_ASSERT(82, sInstance==NULL); + // clang-format on if (!sInstance) { sInstance = new T(); } + // clang-format off JUT_ASSERT(85, sInstance!=NULL); + // clang-format on return sInstance; } diff --git a/libs/JSystem/include/JSystem/JAHostIO/JAHUAsnData.h b/libs/JSystem/include/JSystem/JAHostIO/JAHUAsnData.h new file mode 100644 index 0000000000..a1aaeedf33 --- /dev/null +++ b/libs/JSystem/include/JSystem/JAHostIO/JAHUAsnData.h @@ -0,0 +1,40 @@ +#ifndef JAHUASNNDATA_H +#define JAHUASNNDATA_H + +#include "types.h" + +class JORReflexible; +class JAHControl; + +class JAHUAsn { +public: + JAHUAsn(u16 param_1) : unk0(param_1) {} + + u8 getAttribute(u32); + u16 getSubNum(s32, s32); + u16 getDataNum(s32, s32, s32); + const char* getName(s32, s32, s32, s32); + u32 getDataId(s32, s32, s32, s32); + u8 getCategory(u32); + u8 getSub(u32); + u16 getDataPerCat(u32); + u16 getDataPerSub(u32); + u32 getNextId(u32, bool); + + void createComboBoxCategory(JAHControl&); + void createComboBoxSub(JAHControl&, s32, s32); + void createComboBoxData(JAHControl&, s32, s32, s32); + void checkAndUpdateNameBox(s32*, s32*, s32*, s32*, s32, s32, s32, JORReflexible*); + void updateNameBoxAll(s32*, s32*, s32*, s32*, JORReflexible*); + +private: + void __updateNameBoxCategory(s32*, JORReflexible*); + void __updateNameBoxSub(s32, s32, s32*, JORReflexible*); + void __updateNameBoxData(s32, s32, s32, s32*, JORReflexible*); + u32 __GetSubNo(s32); + u32 __GetDataNo(s32); + + /* 0x0 */ u16 unk0; +}; + +#endif /* JAHUASNNDATA_H */ diff --git a/libs/JSystem/include/JSystem/JAHostIO/JAHUGlobal.h b/libs/JSystem/include/JSystem/JAHostIO/JAHUGlobal.h new file mode 100644 index 0000000000..451787cb46 --- /dev/null +++ b/libs/JSystem/include/JSystem/JAHostIO/JAHUGlobal.h @@ -0,0 +1,30 @@ +#ifndef JAHUGLOBAL_H +#define JAHUGLOBAL_H + +#include <cstring> +#include "JSystem/JHostIO/JORServer.h" +#include "JSystem/JUtility/JUTAssert.h" + +inline void JAHUDialog_CatComment(char* param_1, const char* param_2, const char* param_3) { + if (param_3) { + std::strcpy(param_1, param_3); + std::strcat(param_1, "\n\n"); + } + std::strcat(param_1, param_2); +} + +inline void JAHUDialog_OK(const char* mes, const char* param_2, const char* param_3) { + char buffer[128]; + if (param_3) { + JAHUDialog_CatComment(buffer, mes, param_3); + } else { + // clang-format off + JUT_ASSERT(144, std::strlen(mes)<128-1) + // clang-format on + std::strcpy(buffer, mes); + } + + JORMessageBox(buffer, param_2, 0x30); +} + +#endif /* JAHUGLOBAL_H */ diff --git a/libs/JSystem/include/JSystem/JAHostIO/JAHUTableEdit.h b/libs/JSystem/include/JSystem/JAHostIO/JAHUTableEdit.h index ba8498c5bc..6f0dd9d556 100644 --- a/libs/JSystem/include/JSystem/JAHostIO/JAHUTableEdit.h +++ b/libs/JSystem/include/JSystem/JAHostIO/JAHUTableEdit.h @@ -2,10 +2,47 @@ #define JAHUTABLEDIT_H #include "JSystem/JAHostIO/JAHVirtualNode.h" +#include "JSystem/JAudio2/JAISound.h" + +class JAHUAsn; class JAHUSeBox : public JAHVirtualNode { public: - JAHUSeBox(); + JAHUSeBox(u32, u32*); + + virtual void message(JAHControl&); + virtual void onCurrentNodeFrame(); + virtual void propertyEvent(JAH_P_Event, u32); + virtual void nodeEvent(JAH_N_Event); + virtual void trigPlayButton(); + virtual void trigStopButton(); + virtual void soundPlay(); + virtual void soundStop(); + + u8 checkNameSetChange(); + void updateNameSet(JORReflexible*); + void setId(u32, bool, JORReflexible*); + u32 getId() const { return unk58; } + +public: + /* 0x40 */ JAISoundHandle unk40; + /* 0x44 */ JAISoundHandle unk44; + /* 0x48 */ bool unk48; + /* 0x4C */ u32 unk4C; + /* 0x50 */ u32 unk50; + /* 0x54 */ u32 unk54; + /* 0x58 */ u32 unk58; + /* 0x5C */ u32* unk5C; + /* 0x60 */ JAHUAsn* mAsnCalc; + /* 0x64 */ s32 unk64; + /* 0x68 */ s32 unk68; + /* 0x6C */ s32 unk6C; + /* 0x70 */ s32 unk70; + /* 0x74 */ s32 unk74; + /* 0x78 */ s32 unk78; + /* 0x7C */ s32 unk7C; + /* 0x80 */ s32 unk80; + /* 0x84 */ bool unk84; }; #endif /* JAHUTABLEDIT_H */ diff --git a/libs/JSystem/include/JSystem/JAHostIO/JAHUpdate.h b/libs/JSystem/include/JSystem/JAHostIO/JAHUpdate.h new file mode 100644 index 0000000000..84efd7e539 --- /dev/null +++ b/libs/JSystem/include/JSystem/JAHostIO/JAHUpdate.h @@ -0,0 +1,57 @@ +#ifndef JAHUPDATE_H +#define JAHUPDATE_H + +#include "JSystem/JAHostIO/JAHioNode.h" +#include "JSystem/JHostIO/JORMContext.h" +#include "JSystem/JHostIO/JORServer.h" +#include "types.h" + +namespace JAHUpdate { + +extern JAHioNode* spNode; +extern JORMContext* spMc; + +inline void startUpdateNode(JAHioNode* param_1) { + spMc = attachJORMContext(8); + spNode = param_1; + spMc->startUpdateNode(spNode); +} + +inline void endUpdateNode() { + spMc->endUpdateNode(); + releaseJORMContext(spMc); + spMc = NULL; + spNode = NULL; +} + +inline void buttonOn(JAHioNode* param_1, u32 param_2) { + bool b = false; + if (spMc != NULL) + b = true; + + if (!b) + startUpdateNode(param_1); + + spMc->updateButton(1, param_2, 0); + + if (!b) + endUpdateNode(); +} + +inline void buttonOff(JAHioNode* param_1, u32 param_2) { + bool b = false; + if (spMc != NULL) + b = true; + + if (!b) + startUpdateNode(param_1); + + spMc->updateButton(1, param_2, 0x40000000); + + if (!b) + endUpdateNode(); +} + +} // namespace JAHUpdate + +#endif /* JAHUPDATE_H */ diff --git a/libs/JSystem/include/JSystem/JAHostIO/JAHVirtualNode.h b/libs/JSystem/include/JSystem/JAHostIO/JAHVirtualNode.h index 50cdbc8725..d8ce63037a 100644 --- a/libs/JSystem/include/JSystem/JAHostIO/JAHVirtualNode.h +++ b/libs/JSystem/include/JSystem/JAHostIO/JAHVirtualNode.h @@ -8,13 +8,28 @@ class JAHControl; class JAHVirtualNode { public: - JAHVirtualNode(); + JAHVirtualNode(const char*); + virtual void updateNode(); - virtual void message(JAHControl&); + virtual void message(JAHControl&) {} virtual void onFrame(); virtual void onCurrentNodeFrame(); virtual void propertyEvent(JAH_P_Event, u32); virtual void nodeEvent(JAH_N_Event); + virtual void virtualMessage(JAHControl&); + + void callAllVirtualMessages(JAHControl&); + JAHioNode* getMaster(); + void framework(); + void currentFramework(); + void listenVirtualPropertyEvent(JAH_P_Event, u32); + void listenVirtualNodeEvent(JAH_N_Event); + void setVirNodeName(const char*); + + JSUTree<JAHVirtualNode>* getVirTree() { return &mTree; } + static u32 getVirNodeNum() { return smVirNodeNum; } + + static u32 smVirNodeNum; /* 0x04 */ JSUTree<JAHVirtualNode> mTree; /* 0x20 */ char mName[32]; diff --git a/libs/JSystem/include/JSystem/JAHostIO/JAHioMessage.h b/libs/JSystem/include/JSystem/JAHostIO/JAHioMessage.h index 558882bfa3..5a323dacd0 100644 --- a/libs/JSystem/include/JSystem/JAHostIO/JAHioMessage.h +++ b/libs/JSystem/include/JSystem/JAHostIO/JAHioMessage.h @@ -1,22 +1,42 @@ #ifndef JAHIOMESSAGE_H #define JAHIOMESSAGE_H +#include <JSystem/JHostIO/JORMContext.h> #include <types.h> class JAHioNode; class JORMContext; +class JAHControl; class JAHControl { public: JAHControl(JORMContext*, JAHioNode*); void returnY(u16); void indent(s8); + void makeComment(const char*, u32, u8, u32); + void makeButtonL(const char*, u32, u16, u32); + void makeCommentL(const char*, u32, u16, u32); + void endComboBox(); + void startComboBoxL(const char*, s32*, u16, u16, u32); + void makeSlider(const char*, s32*, s32, s32, u32); + void makeSlider(const char*, s16*, s16, s16, u32); + void makeSlider(const char*, f32*, f32, f32, u32); + void makeButton(const char*, u32, u8, u32); + void endRadioButton(); + void makeRadioButtonItem(const char*, u8); + void startRadioButton(const char*, u8*, u8, u32); + void makeCheckBox(const char*, u8*, u8, bool, u32); + void makeSlider(const char*, u8*, u8, u8, u32); + void makeComboBoxItem(const char*, u8); + void makeComboBoxItem(const char*, s32); + void startComboBox(const char*, u8*, u8, u32); + static u16 getComboWidth(u8 itemNo) { return smComboWidth[itemNo]; } static u16 getLineHeight() { return smLineHeight; } - static u16 getContWidth() { return smContWidth; } - static u16 getIntervalX() { return smIntX; } - static u16 getNameWidth() { return smNameWidth; } + static u32 getContWidth() { return smContWidth; } + static u32 getIntervalX() { return smIntX; } + static u32 getNameWidth() { return smNameWidth; } static u16 smButtonWidth[]; static u16 smCommentWidth[]; @@ -34,9 +54,7 @@ public: u16 getY() { return mY; } JORMContext* getContext() { return mContext; } - void tabX(u16 param_1) { - mX += param_1 + smIntX; - } + void tabX(u16 param_1) { mX += smIntX + param_1; } void returnYDirectSize(u16 param_1) { mY += param_1; mX = smXLeft + field_0x4 * smIndentSize; @@ -49,4 +67,164 @@ public: /* 0x0C */ JAHioNode* mNode; }; +// There's a funky dependency loop between JAHControl and JAHContTemplate, which must be resolved +// THIS way, as makeSlider etc functions must be defined NOT out-of-line for their string literal +// symbols to get the correct mangling. + +class JAHContTemplate { +public: + template <class T> + static void startComboBox(JAHControl* param_1, const char* param_2, T* param_3, u16 param_4, + u16 param_5, u32 param_6) { + if (param_2) { + param_1->getContext()->genLabel(param_2, 0, param_6, NULL, param_1->getX(), + param_1->getY(), param_4, param_1->getLineHeight()); + param_1->tabX(param_4); + } + + param_1->getContext()->startComboBox(param_2, param_3, param_6, NULL, param_1->getX(), + param_1->getY() - 7, param_5, + param_1->getLineHeight()); + param_1->tabX(param_5); + } + + template <class T> + static void makeSlider(JAHControl* param_1, const char* param_2, T* param_3, T param_4, + T param_5, u32 param_6) { + if (param_2) { + param_1->getContext()->genLabel(param_2, 0, param_6, NULL, param_1->getX(), + param_1->getY(), param_1->getNameWidth(), + param_1->getLineHeight()); + } + + param_1->getContext()->genSlider( + "---", param_3, param_4, param_5, param_6, NULL, + (u32)param_1->getX() + param_1->getNameWidth() + param_1->getIntervalX(), + param_1->getY() - 3, param_1->getContWidth(), param_1->getLineHeight()); + param_1->returnY(1); + } + + template <class T> + static void startRadioButton(JAHControl* param_1, const char* param_2, T* param_3, T param_4, + u32 param_5) { + if (param_2) { + param_1->getContext()->genLabel(param_2, 0, param_5, NULL, param_1->getX(), + param_1->getY(), param_1->getNameWidth() + 48, + param_1->getLineHeight()); + } + param_1->getContext()->startRadioButton( + param_2, param_3, param_5, NULL, + (u32)param_1->getX() + param_1->getNameWidth() + param_1->getIntervalX() + 48, + param_1->getY(), param_1->getContWidth() + 250, param_4 * 18); + + param_1->returnYDirectSize(param_4 * 18); + } + + template <class T> + static void makeCheckBox(JAHControl* param_1, const char* param_2, T* param_3, T param_4, + bool param_5, u32 param_6) { + if (!param_5) { + param_1->getContext()->genCheckBox(param_2, param_3, param_4, param_6, NULL, + param_1->getX(), param_1->getY(), 1000, + param_1->getLineHeight()); + } else { + param_1->getContext()->genCheckBox(param_2, param_3, param_4, param_6, NULL, + param_1->getX() + param_1->getNameWidth() + + param_1->getIntervalX() + 52, + param_1->getY(), 1000, param_1->getLineHeight()); + } + param_1->returnY(1); + } + + template <class T> + static void startComboBox(JAHControl* param_1, const char* param_2, T* param_3, T param_4, + u32 param_5) { + if (param_2) { + param_1->getContext()->genLabel(param_2, 0, param_5, NULL, param_1->getX(), + param_1->getY(), param_1->getNameWidth() + 48, + param_1->getLineHeight()); + } + + param_1->getContext()->startComboBox( + param_2, param_3, param_5, NULL, + param_1->getX() + param_1->getNameWidth() + param_1->getIntervalX() + 48, + param_1->getY() - 7, param_1->getComboWidth(param_4), param_1->getLineHeight()); + } +}; + +inline void JAHControl::makeButtonL(const char* param_1, u32 param_2, u16 param_3, u32 param_4) { + mContext->genButton(param_1, param_2, param_4, NULL, mX, mY - 5, param_3, smLineHeight); + tabX(param_3); +} + +inline void JAHControl::makeCommentL(const char* param_1, u32 param_2, u16 param_3, u32 param_4) { + mContext->genLabel(param_1, param_2, param_4, NULL, mX, mY, param_3, smLineHeight); + tabX(param_3); +} + +inline void JAHControl::endComboBox() { + mContext->endComboBox(); +} + +inline void JAHControl::startComboBoxL(const char* param_1, s32* param_2, u16 param_3, u16 param_4, + u32 param_5) { + JAHContTemplate::startComboBox(this, param_1, param_2, param_3, param_4, param_5); +} + +inline void JAHControl::makeSlider(const char* param_1, s32* param_2, s32 param_3, s32 param_4, + u32 param_5) { + JAHContTemplate::makeSlider(this, param_1, param_2, param_3, param_4, param_5); +} + +inline void JAHControl::makeSlider(const char* param_1, s16* param_2, s16 param_3, s16 param_4, + u32 param_5) { + JAHContTemplate::makeSlider(this, param_1, param_2, param_3, param_4, param_5); +} + +inline void JAHControl::makeSlider(const char* param_1, f32* param_2, f32 param_3, f32 param_4, + u32 param_5) { + JAHContTemplate::makeSlider(this, param_1, param_2, param_3, param_4, param_5); +} + +inline void JAHControl::makeSlider(const char* param_1, u8* param_2, u8 param_3, u8 param_4, + u32 param_5) { + JAHContTemplate::makeSlider(this, param_1, param_2, param_3, param_4, param_5); +} + +inline void JAHControl::makeButton(const char* param_1, u32 param_2, u8 param_3, u32 param_4) { + mContext->genButton(param_1, param_2, param_4, NULL, mX, mY - 5, smButtonWidth[param_3], + smLineHeight); + returnY(1); +} + +inline void JAHControl::endRadioButton() { + mContext->endRadioButton(); +} + +inline void JAHControl::makeRadioButtonItem(const char* param_1, u8 param_2) { + mContext->genRadioButtonItem(param_1, param_2, 0, -1, -1, 128, 16); +} + +inline void JAHControl::startRadioButton(const char* param_1, u8* param_2, u8 param_3, + u32 param_4) { + JAHContTemplate::startRadioButton(this, param_1, param_2, param_3, param_4); +} + +inline void JAHControl::makeCheckBox(const char* param_1, u8* param_2, u8 param_3, bool param_4, + u32 param_5) { + JAHContTemplate::makeCheckBox(this, param_1, param_2, param_3, param_4, param_5); +} + +inline void JAHControl::makeComboBoxItem(const char* label, u8 itemNo) { + makeComboBoxItem(label, (s32)itemNo); +} + +inline void JAHControl::makeComboBoxItem(const char* label, s32 itemNo) { + mContext->genComboBoxItem(label, itemNo); +} + +inline void JAHControl::startComboBox(const char* label, u8* param_2, u8 param_3, u32 param_4) { + JAHContTemplate::startComboBox(this, label, param_2, param_3, param_4); +} + #endif /* JAHIOMESSAGE_H */ diff --git a/libs/JSystem/include/JSystem/JAudio2/JASDSPInterface.h b/libs/JSystem/include/JSystem/JAudio2/JASDSPInterface.h index a653431bee..44f2805bfe 100644 --- a/libs/JSystem/include/JSystem/JAudio2/JASDSPInterface.h +++ b/libs/JSystem/include/JSystem/JAudio2/JASDSPInterface.h @@ -1,6 +1,7 @@ #ifndef JASDSPINTERFACE_H #define JASDSPINTERFACE_H +#include <cstdint> #include <types.h> struct JASWaveInfo; diff --git a/libs/JSystem/include/JSystem/JAudio2/JAUSoundTable.h b/libs/JSystem/include/JSystem/JAudio2/JAUSoundTable.h index e2dceca7b1..b85744ff94 100644 --- a/libs/JSystem/include/JSystem/JAudio2/JAUSoundTable.h +++ b/libs/JSystem/include/JSystem/JAudio2/JAUSoundTable.h @@ -192,7 +192,11 @@ struct JAUSoundNameTable : public JASGlobalInstance<JAUSoundNameTable> { JAUSoundNameTable(bool param_0) : JASGlobalInstance<JAUSoundNameTable>(param_0) { } ~JAUSoundNameTable() {} + int getNumGroups_inSection(u8) const; + int getNumItems_inGroup(u8, u8) const; void init(void const*); + const char* getName(JAISoundID) const; + const char* getGroupName(JAISoundID) const; JAUSoundTable_<JAUSoundNameTableRoot,JAUSoundNameTableSection,JAUSoundNameTableGroup,void> field_0x0; }; diff --git a/libs/JSystem/include/JSystem/JHostIO/JOREvent.h b/libs/JSystem/include/JSystem/JHostIO/JOREvent.h new file mode 100644 index 0000000000..14d7b2fa52 --- /dev/null +++ b/libs/JSystem/include/JSystem/JHostIO/JOREvent.h @@ -0,0 +1,36 @@ +#ifndef JOREVENT_H +#define JOREVENT_H + +#include "types.h" + +class JORReflexible; + +struct JOREvent {}; + +struct JORPropertyEvent : JOREvent { + enum EKind { + EKind_HasListener = (1 << 30), + EKind_ValueID = (1 << 29), + EKind_FloatValue = (1 << 9), + }; + + /* 0x00 */ u8 field_0x0[0x4 - 0x0]; + /* 0x04 */ u32 type; + /* 0x08 */ u32 kind; + /* 0x0C */ char* id; // id? + /* 0x10 */ JORReflexible* field_0x10; // ? + /* 0x14 */ u32 field_0x14; + union { + u32 U32; + u16 U16[2]; + } + /* 0x18 */ field_0x18; +}; + +struct JORGenEvent : JOREvent {}; + +struct JORNodeEvent : JOREvent { + /* 0x00 */ u32 field_0x0; +}; + +#endif /* JOREVENT_H */ diff --git a/libs/JSystem/include/JSystem/JHostIO/JORFile.h b/libs/JSystem/include/JSystem/JHostIO/JORFile.h index cd2f048c48..e2123d8f4a 100644 --- a/libs/JSystem/include/JSystem/JHostIO/JORFile.h +++ b/libs/JSystem/include/JSystem/JHostIO/JORFile.h @@ -18,7 +18,7 @@ public: /* 0x08 */ u32 m_fileAttribute; /* 0x0C */ u32 m_lowDateTime; /* 0x10 */ u32 m_highDateTime; - /* 0x14 */ char* m_filename; + /* 0x14 */ char m_filename[]; }; class JORFile { diff --git a/libs/JSystem/include/JSystem/JHostIO/JORMContext.h b/libs/JSystem/include/JSystem/JHostIO/JORMContext.h index b06adad45b..a9676ec3d1 100644 --- a/libs/JSystem/include/JSystem/JHostIO/JORMContext.h +++ b/libs/JSystem/include/JSystem/JHostIO/JORMContext.h @@ -7,7 +7,7 @@ #include <dolphin.h> #endif #include <stdint.h> -#include "JSystem/JHostIO/JORReflexible.h" +#include "JSystem/JHostIO/JOREvent.h" #include "JSystem/JSupport/JSUMemoryStream.h" #define MCTX_MSG_RESET 0 @@ -194,9 +194,7 @@ public: void startUpdateNode(JORReflexible* obj) { putNode(obj); } void genNodeSub(const char* label, JORReflexible* i_node, u32, u32); - void putNode(JORReflexible* obj) { - mOutputStream << (uintptr_t)obj; - } + void putNode(JORReflexible* obj) { mOutputStream << (uintptr_t)obj; } void invalidNode(JORReflexible* i_node, u32); void genControl(u32 type, u32 kind, const char* label, u32 style, u32 id, @@ -221,6 +219,10 @@ public: u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT); + void updateButton(u32 param_1, u32 param_2, u32 param_3) { + updateControl(param_1, param_2, param_3); + } + void genLabel(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT); @@ -270,6 +272,7 @@ public: DEFINE_START_COMBO_BOX_ID(s32, JORPropertyEvent::EKind_ValueID) DEFINE_UPDATE_COMBO_BOX(u8) + DEFINE_UPDATE_COMBO_BOX(s32) DEFINE_UPDATE_COMBO_BOX_ID(s32) @@ -279,6 +282,16 @@ public: genSelectorItemSub(label, itemNo, 0, 0, 0, 0, 0); } + void editComboBoxItem(u32 param_0, u32 param_1, const char* param_2, s32 param_3, u32 param_4); + + void addComboBoxItem(u32 param_1, s32* param_2, const char* param_3, s32 param_4, u32 param_5) { + editComboBoxItem(param_1, (uintptr_t)param_2, param_3, param_4, param_5); + } + + void removeComboBoxItem(u32 param_1, s32* param_2, u32 param_3) { + editComboBoxItem(param_1, (uintptr_t)param_2, NULL, 0, param_3); + } + /** * === RADIO BUTTON === */ @@ -313,8 +326,6 @@ public: updateSelectorSub(mode, (uintptr_t)pSrc, *pSrc, param_3); } - void editComboBoxItem(u32 param_0, u32 param_1, const char* param_2, s32 param_3, u32 param_4); - void openMessageBox(void* param_0, u32 style, const char* message, const char* title); /* 0x00000 */ u8 mBuffer[0x10000]; diff --git a/libs/JSystem/include/JSystem/JHostIO/JORReflexible.h b/libs/JSystem/include/JSystem/JHostIO/JORReflexible.h index 030c6fd9f9..4a142dee7e 100644 --- a/libs/JSystem/include/JSystem/JHostIO/JORReflexible.h +++ b/libs/JSystem/include/JSystem/JHostIO/JORReflexible.h @@ -2,36 +2,12 @@ #define JORREFLEXIBLE_H #include <types.h> +#include "JSystem/JHostIO/JORServer.h" -class JORReflexible; - -struct JOREvent {}; - -struct JORPropertyEvent : JOREvent { - enum EKind { - EKind_HasListener = (1 << 30), - EKind_ValueID = (1 << 29), - EKind_FloatValue = (1 << 9), - }; - - /* 0x00 */ u8 field_0x0[0x4 - 0x0]; - /* 0x04 */ u32 type; - /* 0x08 */ u32 kind; - /* 0x0C */ char* id; // id? - /* 0x10 */ JORReflexible* field_0x10; // ? - /* 0x14 */ u32 field_0x14; - union { - u32 U32; - u16 U16[2]; - } - /* 0x18 */ field_0x18; -}; - -struct JORGenEvent : JOREvent {}; - -struct JORNodeEvent : JOREvent { - /* 0x00 */ u32 field_0x0; -}; +struct JOREvent; +struct JORPropertyEvent; +struct JORGenEvent; +struct JORNodeEvent; class JORMContext; class JORServer; @@ -48,8 +24,8 @@ class JORReflexible : public JOREventListener { public: #if DEBUG JORReflexible() {} - static JORServer* getJORServer(); - + static JORServer* getJORServer() { return JORServer::getInstance(); } + virtual void listenPropertyEvent(const JORPropertyEvent*); virtual void listen(u32, const JOREvent*); virtual void genObjectInfo(const JORGenEvent*); diff --git a/libs/JSystem/include/JSystem/JKernel/JKRArchive.h b/libs/JSystem/include/JSystem/JKernel/JKRArchive.h index 7402f50b13..fe8697fb5e 100644 --- a/libs/JSystem/include/JSystem/JKernel/JKRArchive.h +++ b/libs/JSystem/include/JSystem/JKernel/JKRArchive.h @@ -3,7 +3,6 @@ #include "JSystem/JKernel/JKRCompression.h" #include "JSystem/JKernel/JKRFileLoader.h" -#include "global.h" class JKRHeap; diff --git a/libs/JSystem/include/JSystem/JKernel/JKRHeap.h b/libs/JSystem/include/JSystem/JKernel/JKRHeap.h index 2c38aa1984..9528c7735e 100644 --- a/libs/JSystem/include/JSystem/JKernel/JKRHeap.h +++ b/libs/JSystem/include/JSystem/JKernel/JKRHeap.h @@ -74,7 +74,7 @@ public: bool setErrorFlag(bool errorFlag); bool isSubHeap(JKRHeap* heap) const; - void* getAltAramStartAdr(); + static void* getAltAramStartAdr(); /* vt[03] */ virtual void callAllDisposer(); /* vt[04] */ virtual u32 getHeapType() = 0; diff --git a/libs/JSystem/include/JSystem/JSupport/JSUInputStream.h b/libs/JSystem/include/JSystem/JSupport/JSUInputStream.h index afde440837..418cc8ea1b 100644 --- a/libs/JSystem/include/JSystem/JSupport/JSUInputStream.h +++ b/libs/JSystem/include/JSystem/JSupport/JSUInputStream.h @@ -4,9 +4,9 @@ #include "JSystem/JSupport/JSUIosBase.h" /** -* @ingroup jsystem-jsupport -* -*/ + * @ingroup jsystem-jsupport + * + */ class JSUInputStream : public JSUIosBase { public: JSUInputStream() {} @@ -89,17 +89,11 @@ public: return *this; } - s32 read(bool& val) { - return read(&val, sizeof(bool)); - } + s32 read(bool& val) { return read(&val, sizeof(bool)); } - s32 read(u8& val) { - return read(&val, sizeof(u8)); - } + s32 read(u8& val) { return read(&val, sizeof(u8)); } - s32 read(u32& param_0) { - return read(¶m_0, 4); - } + s32 read(u32& param_0) { return read(¶m_0, 4); } // TODO: return value probably wrong s32 read(void*, s32); @@ -108,9 +102,9 @@ public: // move? /** -* @ingroup jsystem-jsupport -* -*/ + * @ingroup jsystem-jsupport + * + */ template <typename T> T* JSUConvertOffsetToPtr(const void*, const void*); diff --git a/libs/JSystem/include/JSystem/JSupport/JSUMemoryStream.h b/libs/JSystem/include/JSystem/JSupport/JSUMemoryStream.h index d5da78bfff..c79b2a3535 100644 --- a/libs/JSystem/include/JSystem/JSupport/JSUMemoryStream.h +++ b/libs/JSystem/include/JSystem/JSupport/JSUMemoryStream.h @@ -5,9 +5,9 @@ #include "JSystem/JSupport/JSURandomOutputStream.h" /** -* @ingroup jsystem-jsupport -* -*/ + * @ingroup jsystem-jsupport + * + */ class JSUMemoryInputStream : public JSURandomInputStream { public: JSUMemoryInputStream(const void* res, s32 size) { setBuffer(res, size); } @@ -19,9 +19,7 @@ public: s32 getLength() const; s32 getPosition() const; - void* getPointer() const { - return (u8*)mBuffer + mPosition; - } + void* getPointer() const { return (u8*)mBuffer + mPosition; } private: /* 0x08 */ const void* mBuffer; @@ -39,7 +37,7 @@ public: virtual ~JSUMemoryOutputStream() {} virtual s32 writeData(const void*, s32); virtual s32 getLength() const; - virtual s32 getPosition() const; + virtual s32 getPosition() const { return mPosition; } virtual s32 seek(s32, JSUStreamSeekFrom); virtual s32 getAvailable() const; virtual s32 seekPos(s32, JSUStreamSeekFrom); diff --git a/libs/JSystem/src/JAHNodeLib/JAHAudienceSettingNode.cpp b/libs/JSystem/src/JAHNodeLib/JAHAudienceSettingNode.cpp new file mode 100644 index 0000000000..236d5d198a --- /dev/null +++ b/libs/JSystem/src/JAHNodeLib/JAHAudienceSettingNode.cpp @@ -0,0 +1,5 @@ +#include <JSystem/JAHostIO/JAHioMessage.h> + +void dummy(JAHControl* cont) { + cont->makeSlider(NULL, (f32*)NULL, (f32)0, (f32)0, 0); +} diff --git a/libs/JSystem/src/JAHNodeLib/JAHConductNode.cpp b/libs/JSystem/src/JAHNodeLib/JAHConductNode.cpp new file mode 100644 index 0000000000..6f461f0d88 --- /dev/null +++ b/libs/JSystem/src/JAHNodeLib/JAHConductNode.cpp @@ -0,0 +1,8 @@ +#include <JSystem/JAHostIO/JAHioMessage.h> + +void dummy(JAHControl* cont, u16 s) { + cont->startRadioButton(NULL, (u8*)NULL, (u8)0, 0); + cont->makeRadioButtonItem(NULL, (u8)0); + cont->endRadioButton(); + cont->makeButton(NULL, 0, (u8)0, 0); +} diff --git a/libs/JSystem/src/JAHNodeLib/JAHIDSwapNode.cpp b/libs/JSystem/src/JAHNodeLib/JAHIDSwapNode.cpp new file mode 100644 index 0000000000..d5e5615f37 --- /dev/null +++ b/libs/JSystem/src/JAHNodeLib/JAHIDSwapNode.cpp @@ -0,0 +1,8 @@ +#include "JSystem/JAHostIO/JAHUTableEdit.h" +#include "JSystem/JAHostIO/JAHioMessage.h" + +static void dummy(JAHUSeBox* box, JAHControl* ctrl) { + box->getId(); + ctrl->makeCheckBox(NULL, (u8*)NULL, 0, false, 0); + box->~JAHUSeBox(); +} diff --git a/libs/JSystem/src/JAHNodeLib/JAHSoundPlayerNode.cpp b/libs/JSystem/src/JAHNodeLib/JAHSoundPlayerNode.cpp new file mode 100644 index 0000000000..cd3fa984eb --- /dev/null +++ b/libs/JSystem/src/JAHNodeLib/JAHSoundPlayerNode.cpp @@ -0,0 +1,149 @@ +#include "JSystem/JAHNodeLib/JAHSoundPlayerNode.h" +#include "JSystem/JAHostIO/JAHUpdate.h" +#include "JSystem/JAHostIO/JAHioMessage.h" +#include "JSystem/JAudio2/JAISoundStarter.h" + +void JAHPlayBox::onCurrentNodeFrame() { + JAHSoundPlayerNode* master = (JAHSoundPlayerNode*)getMaster(); + if (!master) + return; + u8 b = master->getContMode() & 2; + if (!b) { + JAHUSeBox::onCurrentNodeFrame(); + } else if (unk48 != unk85) { + if (unk48) { + JAHUpdate::buttonOff(getMaster(), unk4C); + JAHUpdate::buttonOn(getMaster(), unk50); + } else { + JAHUpdate::buttonOn(getMaster(), unk4C); + JAHUpdate::buttonOff(getMaster(), unk50); + } + } + + unk85 = unk48; +} + +u8 JAHSoundPlayerNode::getContMode() const { + return unk7C; +} + +JAHSoundPlayerNode::JAHSoundPlayerNode() : JAHFrameNode("SOUND PLAYER"), unk122(16) { + unk70 = 30; + unk74 = 60; + unk78 = 10; + unk7C = 0; + unk7D = 0; + unk7E = 1; + unk80 = 0; + unk84 = 0; + unk7F = 2; + unk120 = 0; + appendVirNode(&unk98); +} + +JAHPlayBox::JAHPlayBox() : JAHUSeBox(-1, NULL) { + unk85 = 0; +} + +void JAHSoundPlayerNode::message(JAHControl& param_1) { + param_1.returnY(1); + param_1.makeCheckBox("ID順に連続再生する", &unk7C, 2, false, 0); + param_1.returnY(1); + param_1.makeComment("--連続再生モード設定--", 0, 5, 0); + param_1.indent(1); + param_1.makeSlider("最大再生時間(1=0.1sec)", &unk70, 0, 60000, 0); + param_1.makeSlider("空白時間(1=0.1sec)", &unk78, 0, 6000, 0); + param_1.returnY(1); + param_1.startRadioButton("ダミーデータの挙動", &unk7E, 2, 0); + param_1.makeRadioButtonItem("スキップする", 1); + param_1.makeRadioButtonItem("再生する", 0); + param_1.endRadioButton(); + param_1.startRadioButton("トリガーSEまたはBGM系の挙動", &unk7D, 2, 0); + param_1.makeRadioButtonItem("フル再生", 0); + param_1.makeRadioButtonItem("最大再生時間以上はフェードアウト", 1); + param_1.endRadioButton(); + param_1.returnY(1); + param_1.makeSlider("フェードアウト時間(単位:ゲームフレーム)", &unk74, 0, 3600, 0); +} + +void JAHSoundPlayerNode::onCurrentNodeFrame() { + if (!(unk7C & 2)) + return; + + u8 attr = unk122.getAttribute(unk98.getId()); + + switch (unk98.unk48) { + case true: + switch (unk7F) { + case 0: + if (!unk98.unk40) { + unk90 = OSGetTime(); + unk84 = 0; + unk7F = 2; + break; + } + + if (unk80 > unk70) { + unk84 = 0; + unk7F = 2; + } else { + JASGlobalInstance<JAISoundStarter>::getInstance()->startSound(unk98.getId(), + &unk98.unk40, NULL); + unk80 = OSTicksToMilliseconds(OSGetTime() - unk88) / 100; + } + + if (unk7D == 1) { + if (unk80 > unk70) { + unk98.unk40->stop(unk74); + unk84 = 0; + unk90 = OSGetTime(); + unk7F = 1; + } else { + unk80 = OSTicksToMilliseconds(OSGetTime() - unk88) / 100; + } + } + break; + + case 1: + if (!unk98.unk40) { + unk7F = 2; + unk90 = OSGetTime(); + } + break; + + case 2: + if (unk120) { + if (unk84 <= unk78) { + if (unk84 < 0) + JASGlobalInstance<JAISoundStarter>::getInstance()->startSound( + unk98.getId(), &unk98.unk40, NULL); + + unk84 = OSTicksToMilliseconds(OSGetTime() - unk90) / 100; + break; + } + + u32 id = unk122.getNextId(unk98.getId(), unk7E != 0 ? true : false); + unk98.setId(id, true, this); + } + + JASGlobalInstance<JAISoundStarter>::getInstance()->startSound(unk98.getId(), + &unk98.unk40, NULL); + unk7F = 0; + unk80 = 0; + unk88 = OSGetTime(); + unk84 = 0; + break; + } + break; + + case false: + if (unk120) { + unk80 = 0; + unk84 = 0; + unk7F = 2; + } + break; + } + + unk120 = unk98.unk48; +} diff --git a/libs/JSystem/src/JAHNodeLib/JAHViewerApp.cpp b/libs/JSystem/src/JAHNodeLib/JAHViewerApp.cpp new file mode 100644 index 0000000000..c8d56465c9 --- /dev/null +++ b/libs/JSystem/src/JAHNodeLib/JAHViewerApp.cpp @@ -0,0 +1,14 @@ + +#include "JSystem/JAHostIO/JAHioMessage.h" +#include "JSystem/JSupport/JSUMemoryStream.h" +#include "JSystem/JSupport/JSUOutputStream.h" + +static void dummy(JSUMemoryInputStream& in, JSUOutputStream& out, JAHControl& ctrl) { + out << s16(0); + s16 b; + in >> b; + ctrl.makeSlider("", (u8*)NULL, (u8)0, (u8)0, 0); + u16 a; + in >> a; + in.getPointer(); +} diff --git a/libs/JSystem/src/JAHNodeLib/JAHViewerSys.cpp b/libs/JSystem/src/JAHNodeLib/JAHViewerSys.cpp new file mode 100644 index 0000000000..6b14f74662 --- /dev/null +++ b/libs/JSystem/src/JAHNodeLib/JAHViewerSys.cpp @@ -0,0 +1,12 @@ +#include "JSystem/JAHostIO/JAHUGlobal.h" + +static void dummy(JSUInputStream& input) { + JSUMemoryOutputStream stream(NULL, 0); + stream.getPosition(); + stream << u8(0); + u8 b; + input >> b; + u32 a; + input >> a; + JAHUDialog_OK("", "", ""); +} diff --git a/libs/JSystem/src/JAHostIO/JAHFrameNode.cpp b/libs/JSystem/src/JAHostIO/JAHFrameNode.cpp new file mode 100644 index 0000000000..6b4d0d68fc --- /dev/null +++ b/libs/JSystem/src/JAHostIO/JAHFrameNode.cpp @@ -0,0 +1,93 @@ +#include <JSystem/JAHostIO/JAHFrameNode.h> +#include <JSystem/JAHostIO/JAHVirtualNode.h> +#include <JSystem/JAHostIO/JAHioMessage.h> +#include <JSystem/JAHostIO/JAHioMgr.h> + +JAHFrameNode::JAHFrameNode(const char* name) + : JAHioNode(name), mTree((JAHVirtualNode*)this), mFrameNodeLink(this) {} + +void JAHFrameNode::genMessage(JORMContext* context) { + JAHControl control(context, this); + callAllVirtualMessages(control); + message(control); + if (JAHSingletonBase<JAHioMgr>::getIns()->getNodeSysType() == 0) + generateTempChildren(context); + else + generateRealChildren(context); +} + +void JAHFrameNode::callAllVirtualMessages(JAHControl& control) { + if (mTree.getNumChildren() == 0) + return; + + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); iter != mTree.getEndChild(); + ++iter) + { + iter->message(control); + } +} + +void JAHFrameNode::appendVirNode(JAHVirtualNode* node) { + mTree.appendChild(node->getVirTree()); +} + +void JAHFrameNode::listenPropertyEvent(const JORPropertyEvent* event) { + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); iter != mTree.getEndChild(); + ++iter) + { + iter->listenVirtualPropertyEvent(JAH_P_EVENT0, (u32)event->id); + } + + JAHioNode::listenPropertyEvent(event); + + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); iter != mTree.getEndChild(); + ++iter) + { + iter->listenVirtualPropertyEvent(JAH_P_EVENT1, (u32)event->id); + } +} + +void JAHFrameNode::listenNodeEvent(const JORNodeEvent* event) { + JAHioNode::listenNodeEvent(event); + if (event->field_0x0 == 3) { + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); + iter != mTree.getEndChild(); ++iter) + iter->listenVirtualNodeEvent(JAH_N_EVENT0); + } else if (event->field_0x0 == 4) { + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); + iter != mTree.getEndChild(); ++iter) + iter->listenVirtualNodeEvent(JAH_N_EVENT1); + } else if (event->field_0x0 == 5) { + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); + iter != mTree.getEndChild(); ++iter) + iter->listenVirtualNodeEvent(JAH_N_EVENT2); + } +} + +void JAHFrameNode::framework() { + onFrame(); + if (mTree.getNumChildren() != 0) { + int i = 0; // unused? + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); + iter != mTree.getEndChild(); ++iter) + { + iter->framework(); + } + } +} + +void JAHFrameNode::onFrame() {} + +void JAHFrameNode::currentFramework() { + onCurrentNodeFrame(); + if (mTree.getNumChildren() != 0) { + int i = 0; // unused? + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); + iter != mTree.getEndChild(); ++iter) + { + iter->currentFramework(); + } + } +} + +void JAHFrameNode::onCurrentNodeFrame() {} diff --git a/libs/JSystem/src/JAHostIO/JAHUAsnData.cpp b/libs/JSystem/src/JAHostIO/JAHUAsnData.cpp new file mode 100644 index 0000000000..b4c4da98ce --- /dev/null +++ b/libs/JSystem/src/JAHostIO/JAHUAsnData.cpp @@ -0,0 +1,172 @@ +#include <JSystem/JAHostIO/JAHUAsnData.h> +#include "JSystem/JAHostIO/JAHioMessage.h" +#include "JSystem/JAudio2/JAUSoundTable.h" +#include "JSystem/JHostIO/JORServer.h" + +u8 JAHUAsn::getAttribute(u32 param_1) { + u8 a = (param_1 & 0x800) >> 11; + u8 b = (param_1 & 0xC0000000) >> 24; + return a | (b << 4); +} + +u16 JAHUAsn::getSubNum(s32 param_1, s32 param_2) { + JAUSoundNameTable* table = JASGlobalInstance<JAUSoundNameTable>::getInstance(); + int num = table->getNumItems_inGroup(param_1, param_2); + int uVar2 = (u16)(num / unk0); + if (num % unk0 > 0) + uVar2++; + return uVar2 <= 64 ? (u16)uVar2 : (u16)64; +} + +u16 JAHUAsn::getDataNum(s32 param_1, s32 param_2, s32 param_3) { + JAUSoundNameTable* table = JASGlobalInstance<JAUSoundNameTable>::getInstance(); + int uVar1 = getSubNum(param_1, param_2); + int iVar2 = table->getNumItems_inGroup(param_1, param_2); + + if (iVar2 == 0) + return 0; + + if (iVar2 % unk0 == 0) + return unk0; + + if (param_3 == uVar1 - 1) + return iVar2 % unk0; + + return unk0; +} + +const char* JAHUAsn::getName(s32 param_1, s32 param_2, s32 param_3, s32 param_4) { + JAUSoundNameTable* table = JASGlobalInstance<JAUSoundNameTable>::getInstance(); + return table->getName((param_1 << 24) + (param_2 << 16) + (param_4 + param_3 * unk0)); +} + +u32 JAHUAsn::getDataId(s32 param_1, s32 param_2, s32 param_3, s32 param_4) { + return (param_1 << 24) + (param_2 << 16) + (param_4 + param_3 * unk0); +} + +void JAHUAsn::createComboBoxCategory(JAHControl& control) { + int totalItems = 0; + + JAUSoundNameTable* table = JASGlobalInstance<JAUSoundNameTable>::getInstance(); + for (u32 i = 0; i < 3; ++i) { + for (u32 j = 0; j < table->getNumGroups_inSection(i); ++j) { + if (table->getNumItems_inGroup(i, j) > 0) { + const char* name = table->getGroupName((i << 24) + (j << 16)); + control.getContext()->genComboBoxItem(name, totalItems); + ++totalItems; + } + } + } +} + +void JAHUAsn::createComboBoxSub(JAHControl& control, s32 param_2, s32 param_3) { + int uVar1 = getSubNum(param_2, param_3); + for (int i = 0; i < uVar1; ++i) { + char buffer[4]; + sprintf(buffer, "%2x\0", i); + control.getContext()->genComboBoxItem(buffer, i); + } +} + +void JAHUAsn::createComboBoxData(JAHControl& control, s32 param_2, s32 param_3, s32 param_4) { + int uVar1 = getDataNum(param_2, param_3, param_4); + for (int i = 0; i < uVar1; ++i) { + const char* name = getName(param_2, param_3, param_4, i); + control.getContext()->genComboBoxItem(name, i); + } +} + +void JAHUAsn::checkAndUpdateNameBox(s32* param_1, s32* param_2, s32* param_3, s32* param_4, + s32 param_5, s32 param_6, s32 param_7, JORReflexible* param_8) { + if (*param_1 != param_5 || *param_2 != param_6 || *param_3 != param_7) { + if (*param_2 != param_6 || *param_1 != param_5) { + *param_3 = 0; + __updateNameBoxSub(*param_1, *param_2, param_3, param_8); + } + + if (*param_3 != param_7 || *param_2 != param_6 || *param_1 != param_5) { + *param_4 = 0; + __updateNameBoxData(*param_1, *param_2, *param_3, param_4, param_8); + } + } +} + +void JAHUAsn::updateNameBoxAll(s32* param_1, s32* param_2, s32* param_3, s32* param_4, + JORReflexible* param_5) { + __updateNameBoxCategory(param_2, param_5); + __updateNameBoxSub(*param_1, *param_2, param_3, param_5); + __updateNameBoxData(*param_1, *param_2, *param_3, param_4, param_5); +} + +void JAHUAsn::__updateNameBoxCategory(s32* param_1, JORReflexible* param_2) { + JORMContext* ctx = attachJORMContext(8); + ctx->startUpdateNode(param_2); + ctx->updateComboBox(2, param_1, 0); + ctx->endUpdateNode(); + releaseJORMContext(ctx); +} + +void JAHUAsn::__updateNameBoxSub(s32 param_1, s32 param_2, s32* param_3, JORReflexible* param_4) { + JORMContext* ctx = attachJORMContext(8); + ctx->startUpdateNode(param_4); + ctx->removeComboBoxItem(5, param_3, 0); + int num = getSubNum(param_1, param_2); + for (int i = 0; i < num; ++i) { + char buf[4]; + sprintf(buf, "%2x\0", i); + ctx->addComboBoxItem(1, param_3, buf, i, 0); + } + ctx->updateComboBox(2, param_3, 0); + ctx->endUpdateNode(); + releaseJORMContext(ctx); +} + +void JAHUAsn::__updateNameBoxData(s32 param_1, s32 param_2, s32 param_3, s32* param_4, + JORReflexible* param_5) { + JORMContext* ctx = attachJORMContext(8); + ctx->startUpdateNode(param_5); + ctx->removeComboBoxItem(5, param_4, 0); + ctx->endUpdateNode(); + releaseJORMContext(ctx); + + ctx = attachJORMContext(8); + ctx->startUpdateNode(param_5); + int num = getDataNum(param_1, param_2, param_3); + for (int i = 0; i < num; ++i) { + ctx->addComboBoxItem(1, param_4, getName(param_1, param_2, param_3, i), i, 0); + } + ctx->updateComboBox(2, param_4, 0); + ctx->endUpdateNode(); + releaseJORMContext(ctx); +} + +u32 JAHUAsn::__GetSubNo(s32 param_1) { + return param_1 / unk0; +} + +u32 JAHUAsn::__GetDataNo(s32 param_1) { + return param_1 % unk0; +} + +u8 JAHUAsn::getCategory(u32 param_1) { + return (param_1 & 0xF0000) >> 0x10; +} + +u8 JAHUAsn::getSub(u32 param_1) { + int perCat = getDataPerCat(param_1); + return __GetSubNo(perCat); +} + +u16 JAHUAsn::getDataPerCat(u32 param_1) { + return param_1; +} + +u16 JAHUAsn::getDataPerSub(u32 param_1) { + u16 perCat = getDataPerCat(param_1); + return __GetDataNo(perCat); +} + +u32 JAHUAsn::getNextId(u32 param_1, bool param_2) { + JUT_ASSERT(490, 0L); + return param_1; +} diff --git a/libs/JSystem/src/JAHostIO/JAHUFx.cpp b/libs/JSystem/src/JAHostIO/JAHUFx.cpp new file mode 100644 index 0000000000..d704c9c61c --- /dev/null +++ b/libs/JSystem/src/JAHostIO/JAHUFx.cpp @@ -0,0 +1,8 @@ +#include <JSystem/JAHostIO/JAHioMessage.h> + +void dummy(JAHControl* cont, u16 s) { + cont->makeSlider(NULL, (s16*)NULL, (s16)0, (s16)0, 0); + cont->makeSlider(NULL, (s32*)NULL, (s32)0, (s32)0, 0); + cont->returnYDirectSize(s); + cont->startRadioButton(NULL, (u8*)NULL, (u8)0, 0); +} diff --git a/libs/JSystem/src/JAHostIO/JAHUTableEdit.cpp b/libs/JSystem/src/JAHostIO/JAHUTableEdit.cpp new file mode 100644 index 0000000000..44936fe0b8 --- /dev/null +++ b/libs/JSystem/src/JAHostIO/JAHUTableEdit.cpp @@ -0,0 +1,196 @@ +#include "JSystem/JAHostIO/JAHUTableEdit.h" +#include "JSystem/JAHostIO/JAHUAsnData.h" +#include "JSystem/JAHostIO/JAHUpdate.h" +#include "JSystem/JAHostIO/JAHioMessage.h" +#include "JSystem/JAHostIO/JAHioUtil.h" +#include "JSystem/JAudio2/JAISoundStarter.h" +#include "JSystem/JAudio2/JAUSoundTable.h" + +JAHUSeBox::JAHUSeBox(u32 param_1, u32* param_2) : JAHVirtualNode(NULL) { + unk4C = getVirNodeNum() | 0x12000000; + unk50 = getVirNodeNum() | 0x13000000; + unk54 = getVirNodeNum() | 0x14000000; + unk5C = param_2; + mAsnCalc = NULL; + + mAsnCalc = new JAHUAsn(0x10); + JUT_ASSERT(611, mAsnCalc); + + unk48 = false; + if (param_1 == -1) + unk58 = mAsnCalc->getDataId(0, 0, 0, 0); + else + unk58 = param_1; + + unk84 = 0; +} + +void JAHUSeBox::trigPlayButton() { + unk48 = true; + JAHUpdate::buttonOff(getMaster(), unk4C); + JAHUpdate::buttonOn(getMaster(), unk50); +} + +void JAHUSeBox::trigStopButton() { + unk48 = false; + JAHUpdate::buttonOn(getMaster(), unk4C); + JAHUpdate::buttonOff(getMaster(), unk50); + soundStop(); +} + +void JAHUSeBox::soundStop() { + if (unk40) + unk40->stop(); +} + +void JAHUSeBox::onCurrentNodeFrame() { + if (unk48) { + soundPlay(); + unk48 = false; + } + + if (unk44 && !unk40) { + JAHUpdate::buttonOn(getMaster(), unk4C); + JAHUpdate::buttonOff(getMaster(), unk50); + } else if (!unk44 && unk40) { + JAHUpdate::buttonOff(getMaster(), unk4C); + JAHUpdate::buttonOn(getMaster(), unk50); + } +} + +void JAHUSeBox::soundPlay() { + JAISoundStarter* starter = JASGlobalInstance<JAISoundStarter>::getInstance(); + if (starter) { + starter->startSound(unk58, &unk40, 0); + } +} + +void JAHUSeBox::message(JAHControl& control) { + if (!unk84 && JASGlobalInstance<JAUSoundNameTable>::getInstance()) { + if (unk58 == -1) { + unk64 = 0; + unk68 = 0; + unk6C = 0; + unk70 = 0; + unk74 = 0; + unk78 = 0; + unk7C = 0; + unk80 = 0; + unk58 = 0; + } else { + unk64 = unk58 >> 24; + unk68 = mAsnCalc->getCategory(unk58); + unk6C = mAsnCalc->getSub(unk58); + unk70 = mAsnCalc->getDataPerSub(unk58); + unk74 = unk64; + unk78 = unk68; + unk7C = unk6C; + unk80 = unk70; + } + + unk84 = true; + } + + control.startComboBoxL(NULL, &unk68, 0, 200, 0); + mAsnCalc->createComboBoxCategory(control); + control.endComboBox(); + control.startComboBoxL(NULL, &unk6C, 0, 0x2d, 0); + mAsnCalc->createComboBoxSub(control, unk64, unk68); + control.endComboBox(); + control.startComboBoxL(NULL, &unk70, 0, 200, 0); + mAsnCalc->createComboBoxData(control, unk64, unk68, unk6C); + control.endComboBox(); + control.makeCommentL(JAHioUtil::getString("%08x", unk58), unk54, 0x37, 0); + control.makeButtonL(">", unk4C, 0x32, 0); + control.makeButtonL("■", unk50, 0x32, 0x40000000); + control.returnY(1); +} + +void JAHUSeBox::nodeEvent(JAH_N_Event) {} + +void JAHUSeBox::propertyEvent(JAH_P_Event param_1, u32 param_2) { + if (param_1 == 0) { + unk74 = unk64; + unk78 = unk68; + unk7C = unk6C; + unk80 = unk70; + return; + } + + if (param_2 != unk4C && param_2 != unk50 && + ((unk7C == unk6C && unk80 == unk70) || unk68 != unk78)) + { + JAUSoundNameTable* table = JASGlobalInstance<JAUSoundNameTable>::getInstance(); + int groups = table->getNumGroups_inSection(0); + if (unk68 >= groups) { + groups += table->getNumGroups_inSection(1); + if (unk68 < groups) { + unk64 = 1; + unk68 -= table->getNumGroups_inSection(0); + } else { + unk64 = 2; + unk68 -= groups; + } + } else { + unk64 = 0; + } + } + + mAsnCalc->checkAndUpdateNameBox(&unk64, &unk68, &unk6C, &unk70, unk74, unk78, unk7C, + getMaster()); + if (checkNameSetChange()) { + unk58 = mAsnCalc->getDataId(unk64, unk68, unk6C, unk70); + if (unk5C != NULL) + *unk5C = unk58; + char buf[9]; + sprintf(buf, "%08x", unk58); + JORMContext* ctx = attachJORMContext(8); + ctx->startUpdateNode(getMaster()); + ctx->updateLabel(2, unk54, buf); + ctx->endUpdateNode(); + releaseJORMContext(ctx); + } + + if (param_2 == unk4C) { + trigPlayButton(); + } else if (param_2 == unk50) { + trigStopButton(); + } +} + +u8 JAHUSeBox::checkNameSetChange() { + u8 iVar1 = 0; + + if (unk74 != unk64) + iVar1++; + + if (unk78 != unk68) + iVar1++; + + if (unk7C != unk6C) + iVar1++; + + if (unk80 != unk70) + iVar1++; + + return iVar1; +} + +void JAHUSeBox::updateNameSet(JORReflexible* param_1) { + mAsnCalc->updateNameBoxAll(&unk64, &unk68, &unk6C, &unk70, param_1); + JORMContext* ctx = attachJORMContext(8); + ctx->startUpdateNode(param_1); + ctx->updateLabel(2, unk54, JAHioUtil::getString("%08x", unk58)); + ctx->endUpdateNode(); + releaseJORMContext(ctx); +} + +void JAHUSeBox::setId(u32 param_1, bool param_2, JORReflexible* param_3) { + unk58 = param_1; + unk64 = unk58 >> 24; + unk68 = (param_1 >> 16) & 0xff; + unk6C = mAsnCalc->getSub(param_1); + unk70 = mAsnCalc->getDataPerSub(param_1); + if (param_2) + updateNameSet(param_3); +} diff --git a/libs/JSystem/src/JAHostIO/JAHVirtualNode.cpp b/libs/JSystem/src/JAHostIO/JAHVirtualNode.cpp new file mode 100644 index 0000000000..7275fc70be --- /dev/null +++ b/libs/JSystem/src/JAHostIO/JAHVirtualNode.cpp @@ -0,0 +1,93 @@ +#include <JSystem/JAHostIO/JAHVirtualNode.h> +#include <JSystem/JUtility/JUTAssert.h> +#include <cstring> + +u32 JAHVirtualNode::smVirNodeNum; + +void JAHVirtualNode::virtualMessage(JAHControl& control) { + message(control); + callAllVirtualMessages(control); +} + +void JAHVirtualNode::callAllVirtualMessages(JAHControl& control) { + if (mTree.getNumChildren() == 0) + return; + + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); iter != mTree.getEndChild(); + ++iter) + { + iter->message(control); + } +} + +JAHioNode* JAHVirtualNode::getMaster() { + JSUTree<JAHVirtualNode>* it = mTree.getParent(); + while (it->getParent()) + it = it->getParent(); + return (JAHioNode*)it->getObject(); +} + +void JAHVirtualNode::framework() { + onFrame(); + for (JSUTreeIterator<JAHVirtualNode> iter = getVirTree()->getFirstChild(); + iter != getVirTree()->getEndChild(); ++iter) + { + iter->framework(); + } +} + +void JAHVirtualNode::onFrame() {} + +void JAHVirtualNode::currentFramework() { + onCurrentNodeFrame(); + for (JSUTreeIterator<JAHVirtualNode> iter = getVirTree()->getFirstChild(); + iter != getVirTree()->getEndChild(); ++iter) + { + iter->framework(); + } +} + +void JAHVirtualNode::onCurrentNodeFrame() {} + +void JAHVirtualNode::listenVirtualPropertyEvent(JAH_P_Event param_1, u32 param_2) { + propertyEvent(param_1, param_2); + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); iter != mTree.getEndChild(); + ++iter) + { + iter->listenVirtualPropertyEvent(param_1, param_2); + } +} + +void JAHVirtualNode::propertyEvent(JAH_P_Event, u32) {} + +void JAHVirtualNode::listenVirtualNodeEvent(JAH_N_Event param_1) { + nodeEvent(param_1); + for (JSUTreeIterator<JAHVirtualNode> iter = mTree.getFirstChild(); iter != mTree.getEndChild(); + ++iter) + { + iter->listenVirtualNodeEvent(param_1); + } +} + +void JAHVirtualNode::nodeEvent(JAH_N_Event) {} + +void JAHVirtualNode::setVirNodeName(const char* name) { + JUT_ASSERT(139, name); + size_t size = strlen(name) + 1; + // clang-format off + JUT_ASSERT(141, size<32); + // clang-format on + strcpy(mName, name); +} + +JAHVirtualNode::JAHVirtualNode(const char* name) : mTree(this) { + if (name) + setVirNodeName(name); + else + setVirNodeName("no name"); + smVirNodeNum += 1; +} + +void JAHVirtualNode::updateNode() { + getMaster()->updateNode(); +} diff --git a/libs/JSystem/src/JAHostIO/JAHioMessage.cpp b/libs/JSystem/src/JAHostIO/JAHioMessage.cpp index 93fda0dd72..bc0e26e211 100644 --- a/libs/JSystem/src/JAHostIO/JAHioMessage.cpp +++ b/libs/JSystem/src/JAHostIO/JAHioMessage.cpp @@ -1,4 +1,4 @@ -#include "JSystem/JSystem.h" // IWYU pragma: keep +#include "JSystem/JSystem.h" // IWYU pragma: keep #include "JSystem/JAHostIO/JAHioMessage.h" #include "JSystem/JAHostIO/JAHioNode.h" @@ -7,7 +7,7 @@ u16 JAHControl::smButtonWidth[] = {20, 50, 100, 150, 300, 600}; u16 JAHControl::smCommentWidth[] = {20, 50, 100, 200, 400, 800}; -u16 JAHControl::smComboWidth[] = { 50, 100, 150, 200, 300, 600}; +u16 JAHControl::smComboWidth[] = {50, 100, 150, 200, 300, 600}; u16 JAHControl::smYTop = 5; u16 JAHControl::smXLeft = 5; u16 JAHControl::smIndentSize = 30; diff --git a/libs/JSystem/src/JAHostIO/JAHioMgr.cpp b/libs/JSystem/src/JAHostIO/JAHioMgr.cpp index 5c1a324651..91b0a030e6 100644 --- a/libs/JSystem/src/JAHostIO/JAHioMgr.cpp +++ b/libs/JSystem/src/JAHostIO/JAHioMgr.cpp @@ -1,9 +1,12 @@ -#include "JSystem/JSystem.h" // IWYU pragma: keep +#include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/JAHostIO/JAHioMgr.h" #include "JSystem/JAHostIO/JAHFrameNode.h" +#include "JSystem/JAHostIO/JAHioMgr.h" #include "JSystem/JHostIO/JORServer.h" +template <> +JAHioMgr* JAHSingletonBase<JAHioMgr>::sInstance = NULL; + JAHioMgr::JAHioMgr() : field_0x4(0), field_0x8(0) {} void JAHioMgr::init_OnGame() { diff --git a/libs/JSystem/src/JAHostIO/JAHioNode.cpp b/libs/JSystem/src/JAHostIO/JAHioNode.cpp index 5eef2f7e92..12ba55c8eb 100644 --- a/libs/JSystem/src/JAHostIO/JAHioNode.cpp +++ b/libs/JSystem/src/JAHostIO/JAHioNode.cpp @@ -1,10 +1,12 @@ -#include "JSystem/JSystem.h" // IWYU pragma: keep +#include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/JAHostIO/JAHioNode.h" +#include <cstring> #include "JSystem/JAHostIO/JAHioMessage.h" #include "JSystem/JAHostIO/JAHioMgr.h" +#include "JSystem/JAHostIO/JAHioNode.h" #include "JSystem/JHostIO/JORServer.h" -#include <cstring> + +JAHioNode* JAHioNode::smCurrentNode; JAHioNode::JAHioNode(const char* name) : mTree(this) { mLastChild = NULL; @@ -86,7 +88,9 @@ void JAHioNode::generateTempChildren(JORMContext* mctx) { } } -u32 JAHioNode::getNodeKind() const { return 0; } +u32 JAHioNode::getNodeKind() const { + return 0; +} JAHioNode* JAHioNode::getParent() { if (mTree.getParent()) { diff --git a/libs/JSystem/src/JAHostIO/JAHioUtil.cpp b/libs/JSystem/src/JAHostIO/JAHioUtil.cpp index 11c5fd4b52..e301b442af 100644 --- a/libs/JSystem/src/JAHostIO/JAHioUtil.cpp +++ b/libs/JSystem/src/JAHostIO/JAHioUtil.cpp @@ -1,10 +1,19 @@ -#include "JSystem/JSystem.h" // IWYU pragma: keep +#include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/JAHostIO/JAHioUtil.h" #include <cstdio> +#include "JSystem/JAHostIO/JAHUpdate.h" +#include "JSystem/JAHostIO/JAHioUtil.h" +#include "JSystem/JHostIO/JORFile.h" char JAHioUtil::mStringBuffer[256]; +JAHioNode* JAHUpdate::spNode; +JORMContext* JAHUpdate::spMc; + +static char* dummy(JORDir* dir) { + return std::strrchr(dir->getFilename(), '\n'); +} + char* JAHioUtil::getString(const char* msg, ...) { va_list args; va_start(msg, args); diff --git a/libs/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string b/libs/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string index 41984de8b5..27c03be9d9 100644 --- a/libs/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string +++ b/libs/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string @@ -10,7 +10,6 @@ using ::memcmp; using ::memchr; using ::memmove; -using ::strrchr; using ::strlen; using ::strncmp; using ::strcmp; @@ -25,6 +24,11 @@ using ::wcslen; inline char* strchr(char* str, int c) { return ::strchr(str, c); } + +inline char* strrchr(char* str, int c) { + return ::strrchr(str, c); +} + }; // namespace std #endif diff --git a/libs/revolution/include/revolution/dvd.h b/libs/revolution/include/revolution/dvd.h index 06b7ecaece..afb0013558 100644 --- a/libs/revolution/include/revolution/dvd.h +++ b/libs/revolution/include/revolution/dvd.h @@ -3,7 +3,6 @@ #include <revolution/types.h> #include <revolution/esp.h> -#include "global.h" #ifdef __cplusplus extern "C" { @@ -188,15 +187,16 @@ typedef struct DVDGameTOC { typedef struct DVDPartitionParams DVDPartitionParams; +#define ROUND_HACK(n, a) (((u32)(n) + (a)-1) & ~((a)-1)) struct DVDPartitionParams { ESTicket ticket; - u8 padding0[ROUND(sizeof(ESTicket), 32) - sizeof(ESTicket)]; + u8 padding0[ROUND_HACK(sizeof(ESTicket), 32) - sizeof(ESTicket)]; ESTicketView ticketView; - u8 padding1[ROUND(sizeof(ESTicketView), 32) - sizeof(ESTicketView)]; + u8 padding1[ROUND_HACK(sizeof(ESTicketView), 32) - sizeof(ESTicketView)]; u32 numTmdBytes; u8 padding2[28]; ESTitleMeta tmd; - u8 padding3[ROUND(sizeof(ESTitleMeta), 32) - sizeof(ESTitleMeta)]; + u8 padding3[ROUND_HACK(sizeof(ESTitleMeta), 32) - sizeof(ESTitleMeta)]; u32 numCertBytes; u8 padding4[28]; u8 certificates[4096]; @@ -204,6 +204,7 @@ struct DVDPartitionParams { u8 padding5[28]; u8 h3Hash[98304]; }; +#undef ROUND_HACK typedef struct diRegVals { u32 ImmRegVal; diff --git a/libs/revolution/src/ipc/ipcProfile.c b/libs/revolution/src/ipc/ipcProfile.c index 735f053757..a778e09b35 100644 --- a/libs/revolution/src/ipc/ipcProfile.c +++ b/libs/revolution/src/ipc/ipcProfile.c @@ -1,4 +1,5 @@ #include <revolution.h> +#include "global.h" #include <cstring> #if SDK_AUG2010 diff --git a/libs/revolution/src/pad/Pad.c b/libs/revolution/src/pad/Pad.c index b20da7bb14..3d934d3d8b 100644 --- a/libs/revolution/src/pad/Pad.c +++ b/libs/revolution/src/pad/Pad.c @@ -1,6 +1,7 @@ #include <revolution.h> #include <revolution/pad.h> #include <revolution/si.h> +#include "global.h" #include <cstring> diff --git a/libs/revolution/src/wpad/__wpad.h b/libs/revolution/src/wpad/__wpad.h index 7203d9f5b0..e6a6c8803e 100644 --- a/libs/revolution/src/wpad/__wpad.h +++ b/libs/revolution/src/wpad/__wpad.h @@ -3,6 +3,7 @@ #include <revolution/os.h> #include <revolution/wpad.h> +#include "global.h" #ifdef __cplusplus extern "C" { |
