mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-20 05:16:24 -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,49 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAHostIO/JAHioMessage.h"
|
||||
#include "JSystem/JAHostIO/JAHioNode.h"
|
||||
#include "JSystem/JAHostIO/JAHioUtil.h"
|
||||
#include "JSystem/JHostIO/JORMContext.h"
|
||||
|
||||
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::smYTop = 5;
|
||||
u16 JAHControl::smXLeft = 5;
|
||||
u16 JAHControl::smIndentSize = 30;
|
||||
u16 JAHControl::smLineHeight = 23;
|
||||
u16 JAHControl::smContWidth = 450;
|
||||
u16 JAHControl::smIntX = 2;
|
||||
u16 JAHControl::smIntY = 5;
|
||||
u16 JAHControl::smNameWidth = 150;
|
||||
|
||||
void JAHControl::returnY(u16 param_1) {
|
||||
mY += u16(smIntY + smLineHeight * param_1);
|
||||
mX = smXLeft + field_0x4 * smIndentSize;
|
||||
}
|
||||
|
||||
void JAHControl::indent(s8 param_1) {
|
||||
field_0x4 += param_1;
|
||||
mX = smXLeft + field_0x4 * smIndentSize;
|
||||
}
|
||||
|
||||
void JAHControl::makeComment(const char* label, u32 id, u8 param_3, u32 style) {
|
||||
mContext->genLabel(label, id, style, NULL, mX, mY, smCommentWidth[param_3], smLineHeight);
|
||||
returnY(1);
|
||||
}
|
||||
|
||||
JAHControl::JAHControl(JORMContext* mctx, JAHioNode* node) {
|
||||
mContext = mctx;
|
||||
mNode = node;
|
||||
mX = smXLeft;
|
||||
mY = smYTop;
|
||||
field_0x4 = 0;
|
||||
char* name = node->getNodeName();
|
||||
if (name) {
|
||||
makeComment(JAHioUtil::getString("■■■ %s ■■■", name), 0xCCCC0000, 5, 0);
|
||||
} else {
|
||||
makeComment("■■■ NO NAMED NODE ■■■", 0, 5, 0);
|
||||
}
|
||||
indent(1);
|
||||
returnY(1);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAHostIO/JAHioMgr.h"
|
||||
#include "JSystem/JAHostIO/JAHFrameNode.h"
|
||||
#include "JSystem/JHostIO/JORServer.h"
|
||||
|
||||
JAHioMgr::JAHioMgr() : field_0x4(0), field_0x8(0) {}
|
||||
|
||||
void JAHioMgr::init_OnGame() {
|
||||
field_0x4 = 0;
|
||||
}
|
||||
|
||||
bool JAHioMgr::isGameMode() {
|
||||
return field_0x4 == 0;
|
||||
}
|
||||
|
||||
void JAHioMgr::appendRootNode(JORReflexible* param_1, JAHioNode* node) {
|
||||
JUT_ASSERT(44, isGameMode());
|
||||
JORMContext* mctx = JORAttachMContext(12);
|
||||
mctx->genNode(param_1, 1, node->getNodeName(), node, 0, 0);
|
||||
JORReleaseMContext(mctx);
|
||||
appendFrameNode(node);
|
||||
}
|
||||
|
||||
void JAHioMgr::appendFrameNode(JAHioNode* node) {
|
||||
if (node->getNodeType() == 1) {
|
||||
field_0xc.append(((JAHFrameNode*)node)->getFrameNodeLink());
|
||||
}
|
||||
}
|
||||
|
||||
void JAHioMgr::removeFrameNode(JAHioNode* node) {
|
||||
if (node->getNodeType() == 1) {
|
||||
field_0xc.remove(((JAHFrameNode*)node)->getFrameNodeLink());
|
||||
}
|
||||
JSUTreeIterator<JAHioNode> it;
|
||||
for (it = node->getTree()->getFirstChild(); it != node->getTree()->getEndChild(); ++it) {
|
||||
removeFrameNode(*it);
|
||||
}
|
||||
}
|
||||
|
||||
u32 JAHioMgr::framework() {
|
||||
JSUListIterator<JAHFrameNode> it;
|
||||
for (it = field_0xc.getFirst(); it != field_0xc.getEnd(); ++it) {
|
||||
it->framework();
|
||||
}
|
||||
JAHioNode* node = JAHioNode::getCurrentNode();
|
||||
if (node && node->getNodeType() == 1) {
|
||||
((JAHFrameNode*)node)->currentFramework();
|
||||
}
|
||||
u32 r30 = 0;
|
||||
if (field_0x4 == 1) {
|
||||
r30 = JOR_MESSAGELOOP();
|
||||
}
|
||||
return r30;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAHostIO/JAHioNode.h"
|
||||
#include "JSystem/JAHostIO/JAHioMessage.h"
|
||||
#include "JSystem/JAHostIO/JAHioMgr.h"
|
||||
#include "JSystem/JHostIO/JORServer.h"
|
||||
#include <cstring>
|
||||
|
||||
JAHioNode::JAHioNode(const char* name) : mTree(this) {
|
||||
mLastChild = NULL;
|
||||
if (name) {
|
||||
setNodeName(name);
|
||||
} else {
|
||||
setNodeName("no named");
|
||||
}
|
||||
}
|
||||
|
||||
JAHioNode::~JAHioNode() {
|
||||
if (getParent()) {
|
||||
getParent()->removeNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
void JAHioNode::updateNode() {
|
||||
JORMContext* mctx = JORReflexible::getJORServer()->attachMCTX(5);
|
||||
mctx->invalidNode(this, 3);
|
||||
JORReflexible::getJORServer()->releaseMCTX(mctx);
|
||||
}
|
||||
|
||||
void JAHioNode::setNodeName(const char* name) {
|
||||
int size = strlen(name) + 1;
|
||||
JUT_ASSERT(51, size < 32);
|
||||
strcpy(mName, name);
|
||||
}
|
||||
|
||||
void JAHioNode::genMessage(JORMContext* mctx) {
|
||||
JAHControl control(mctx, this);
|
||||
message(control);
|
||||
if (JAHSingletonBase<JAHioMgr>::getIns()->getNodeSysType() == 0) {
|
||||
generateTempChildren(mctx);
|
||||
} else {
|
||||
generateRealChildren(mctx);
|
||||
}
|
||||
}
|
||||
|
||||
void JAHioNode::appendNode(JAHioNode* node, const char* name) {
|
||||
mTree.appendChild(&node->mTree);
|
||||
JAHSingletonBase<JAHioMgr>::getIns()->appendFrameNode(node);
|
||||
if (name) {
|
||||
node->setNodeName(name);
|
||||
}
|
||||
updateNode();
|
||||
}
|
||||
|
||||
void JAHioNode::prependNode(JAHioNode* node, const char* name) {
|
||||
mTree.prependChild(&node->mTree);
|
||||
JAHSingletonBase<JAHioMgr>::getIns()->appendFrameNode(node);
|
||||
if (name) {
|
||||
node->setNodeName(name);
|
||||
}
|
||||
updateNode();
|
||||
}
|
||||
|
||||
void JAHioNode::removeNode(JAHioNode* node) {
|
||||
if (smCurrentNode == this) {
|
||||
smCurrentNode = NULL;
|
||||
}
|
||||
mTree.removeChild(&node->mTree);
|
||||
JAHSingletonBase<JAHioMgr>::getIns()->removeFrameNode(node);
|
||||
updateNode();
|
||||
}
|
||||
|
||||
void JAHioNode::generateRealChildren(JORMContext* mctx) {
|
||||
for (JSUTreeIterator<JAHioNode> it(mTree.getFirstChild()); it != mTree.getEndChild(); ++it) {
|
||||
JAHioNode* node = it.getObject();
|
||||
mctx->startNode(node->mName, node, 4, node->getNodeIcon());
|
||||
node->genMessage(mctx);
|
||||
mctx->endNode();
|
||||
}
|
||||
}
|
||||
|
||||
void JAHioNode::generateTempChildren(JORMContext* mctx) {
|
||||
for (JSUTreeIterator<JAHioNode> it(mTree.getFirstChild()); it != mTree.getEndChild(); ++it) {
|
||||
JAHioNode* node = it.getObject();
|
||||
mctx->genNode(node->mName, node, 4, node->getNodeIcon());
|
||||
}
|
||||
}
|
||||
|
||||
u32 JAHioNode::getNodeKind() const { return 0; }
|
||||
|
||||
JAHioNode* JAHioNode::getParent() {
|
||||
if (mTree.getParent()) {
|
||||
return mTree.getParent()->getObject();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void JAHioNode::listenPropertyEvent(const JORPropertyEvent* event) {
|
||||
propertyEvent(JAH_P_EVENT0, (u32)event->id);
|
||||
JORReflexible::listenPropertyEvent(event);
|
||||
propertyEvent(JAH_P_EVENT1, (u32)event->id);
|
||||
}
|
||||
|
||||
void JAHioNode::listenNodeEvent(const JORNodeEvent* event) {
|
||||
if (event->field_0x0 == 3) {
|
||||
smCurrentNode = this;
|
||||
if (getParent()) {
|
||||
getParent()->setLastChild(this);
|
||||
}
|
||||
nodeEvent(JAH_N_EVENT0);
|
||||
} else if (event->field_0x0 == 4) {
|
||||
nodeEvent(JAH_N_EVENT1);
|
||||
} else if (event->field_0x0 == 5) {
|
||||
nodeEvent(JAH_N_EVENT2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAHostIO/JAHioUtil.h"
|
||||
#include <cstdio>
|
||||
|
||||
char JAHioUtil::mStringBuffer[256];
|
||||
|
||||
char* JAHioUtil::getString(const char* msg, ...) {
|
||||
va_list args;
|
||||
va_start(msg, args);
|
||||
vsprintf(mStringBuffer, msg, args);
|
||||
va_end(args);
|
||||
return mStringBuffer;
|
||||
}
|
||||
Reference in New Issue
Block a user