diff options
| author | Roman Sandu <roma.sandu@gmail.com> | 2026-03-27 04:54:07 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-26 18:54:07 -0700 |
| commit | 0fc019dcfa2ed1834825e9754d47e7948e1745f7 (patch) | |
| tree | c3b06bbb412d48cc6586bea3312274dd70f00761 /libs/JSystem/src | |
| parent | f8cf5458482d7b380f52740289745b8241448559 (diff) | |
JAHostIO and friends (#3131)
Diffstat (limited to 'libs/JSystem/src')
| -rw-r--r-- | libs/JSystem/src/JAHNodeLib/JAHAudienceSettingNode.cpp | 5 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHNodeLib/JAHConductNode.cpp | 8 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHNodeLib/JAHIDSwapNode.cpp | 8 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHNodeLib/JAHSoundPlayerNode.cpp | 149 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHNodeLib/JAHViewerApp.cpp | 14 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHNodeLib/JAHViewerSys.cpp | 12 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHostIO/JAHFrameNode.cpp | 93 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHostIO/JAHUAsnData.cpp | 172 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHostIO/JAHUFx.cpp | 8 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHostIO/JAHUTableEdit.cpp | 196 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHostIO/JAHVirtualNode.cpp | 93 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHostIO/JAHioMessage.cpp | 4 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHostIO/JAHioMgr.cpp | 7 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHostIO/JAHioNode.cpp | 12 | ||||
| -rw-r--r-- | libs/JSystem/src/JAHostIO/JAHioUtil.cpp | 13 |
15 files changed, 784 insertions, 10 deletions
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); |
