Work on d_jdpreviwer (#3067)

This commit is contained in:
hatal175 2026-01-26 07:20:02 +02:00 committed by GitHub
parent 7883248acc
commit be3efedee3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 160 additions and 3 deletions

View File

@ -621,7 +621,7 @@ config.libs = [
Object(MatchingFor(ALL), "f_op/f_op_overlap.cpp"),
Object(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "f_op/f_op_overlap_mng.cpp"),
Object(MatchingFor(ALL_GCN, ALL_WII, "ShieldD"), "f_op/f_op_overlap_req.cpp"),
Object(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "f_op/f_op_scene.cpp"),
Object(MatchingFor(ALL), "f_op/f_op_scene.cpp"),
Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_scene_iter.cpp"),
Object(MatchingFor(ALL), "f_op/f_op_scene_mng.cpp"),
Object(MatchingFor(ALL), "f_op/f_op_scene_req.cpp"),

View File

@ -187,4 +187,8 @@ inline void JORReleaseMContext(JORMContext* mctx) {
JORServer::getInstance()->releaseMCTX(mctx);
}
inline void JOR_ENABLEEVENTCALLBACKLIST(bool enable) {
JORServer::getInstance()->enableEventCallbackList(enable);
}
#endif /* JORSERVER_H */

View File

@ -0,0 +1,51 @@
#ifndef JSYSTEM_JSTUDIO_JSTUDIO_JPREVIEWER_CONTROL_H
#define JSYSTEM_JSTUDIO_JSTUDIO_JPREVIEWER_CONTROL_H
#include "JSystem/JHostIO/JORReflexible.h"
#include "JSystem/JHostIO/JORServer.h"
#include "JSystem/JStudio/JStudioToolLibrary/interface.h"
#include "JSystem/JStudio/JStudioToolLibrary/visual.h"
class J2DOrthoGraph;
class JUTFont;
class JUTGamePad;
namespace JStudio {
class TControl;
class TParse;
};
namespace JStudioPreviewer {
class TControl : public JORReflexible, public JOREventCallbackListNode {
public:
TControl();
virtual ~TControl() {}
void genMessage(JORMContext*);
void interface_setPad(const JUTGamePad* pPad) {
mPad.setPad(pPad);
}
void show_setRender(J2DOrthoGraph* pGraph, JUTFont* pFont) {
field_0x128.setRender(pGraph);
field_0x12c.setFont(pFont);
}
void jstudio_setControl(JStudio::TControl*);
void jstudio_setParse(JStudio::TParse*);
virtual void update();
virtual void show2D();
virtual void show3D(Mtx mtx);
virtual int JORAct(u32, const char*);
private:
/* 0x018 */ u8 field_0x18[0xf8 - 0x18];
/* 0x0F8 */ JStudioToolLibrary::TPad mPad;
/* 0x018 */ u8 field_0xfc[0x128 - 0xfc];
/* 0x128 */ JStudioToolLibrary::TDrawPrimitive2D field_0x128;
/* 0x12C */ JStudioToolLibrary::TPrint field_0x12c;
};
};
#endif

View File

@ -2,6 +2,7 @@
#define D_JPREVIEWER_H
#include <dolphin/mtx.h>
#include "JSystem/JStudio/JStudio_JPreviewer/control.h"
namespace JStudio {
class TControl;
@ -13,7 +14,7 @@ class JUTGamePad;
class JUTResFont;
class tParse_;
class dJprevCtrl_c /* : public JStudioPreviewer::TControl */ {
class dJprevCtrl_c : public JStudioPreviewer::TControl {
public:
};
@ -21,9 +22,13 @@ public:
class dJprev_c {
public:
dJprev_c(JStudio::TControl*, const JUTGamePad&);
~dJprev_c();
void show3D(Mtx);
void show2D();
void create(JStudio::TControl* pControl, const JUTGamePad& pad);
void remove();
void update();
static dJprev_c* get() { return m_myObj; }
@ -34,7 +39,7 @@ public:
/* 0x08 */ JKRExpHeap* mHeap;
/* 0x0C */ tParse_* m_parse;
/* 0x10 */ dJprevCtrl_c* mControl;
/* 0x14 */ u8 field_0x14;
/* 0x14 */ s8 mHIOId;
};
#endif /* D_JPREVIEWER_H */

View File

@ -0,0 +1,8 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/JStudio/JStudio_JPreviewer/control.h"
JStudioPreviewer::TControl::TControl() : JOREventCallbackListNode(0xc0000000,0xc00000ff,false) {
}

85
src/d/d_jpreviewer.cpp Normal file
View File

@ -0,0 +1,85 @@
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_jpreviewer.h"
#include "JSystem/JStudio/JStudio/jstudio-control.h"
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "JSystem/JUtility/JUTResFont.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JKernel/JKRExpHeap.h"
#include "JSystem/JHostIO/JORServer.h"
class tParse_ : public JStudio::TParse {
public:
tParse_() : JStudio::TParse(NULL) {}
bool parseBlock_object(const JStudio::stb::data::TParse_TBlock_object& param_1, u32 param_2) {
u32 type = param_1.get_type();
switch(type) {
case 'JMSG':
case -1: {
char acStack_20[10];
JStudio::stb::data::toString_block(acStack_20, type);
const void* id = param_1.get_ID();
// Ignoring demo object: (%s) %s\n
OS_REPORT("デモオブジェクト無視 : (%s) %s\n", acStack_20, id);
return 1;
}
}
return JStudio::stb::TParse::parseBlock_object(param_1, param_2);
}
};
dJprev_c::dJprev_c(JStudio::TControl* param_1, const JUTGamePad& param_2) {
mOrthoGraph = new J2DOrthoGraph(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f);
JUT_ASSERT(72, mOrthoGraph != NULL)
mFont = new JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL);
JUT_ASSERT(74, mFont != NULL)
m_parse = new tParse_();
JUT_ASSERT(76, m_parse != NULL)
mHeap = JKRExpHeap::create(0x100000, JKRHeap::getRootHeap2(), NULL);
JUT_ASSERT(82, mHeap != NULL)
mControl = new dJprevCtrl_c();
JUT_ASSERT(86, mControl != NULL)
mHIOId = mDoHIO_createChild("JStudioPreviewer", mControl);
mControl->interface_setPad(&param_2);
mControl->show_setRender(mOrthoGraph, mFont);
mControl->jstudio_setControl(param_1);
mControl->jstudio_setParse(m_parse);
JOR_ENABLEEVENTCALLBACKLIST(1);
m_myObj = this;
}
dJprev_c::~dJprev_c() {
mDoHIO_deleteChild(mHIOId);
delete mControl;
mHeap->destroy();
delete m_parse;
delete mFont;
delete mOrthoGraph;
m_myObj = NULL;
}
void dJprev_c::create(JStudio::TControl* pControl, const JUTGamePad& pad) {
JUT_ASSERT(130, m_myObj == NULL);
new dJprev_c(pControl, pad);
JUT_ASSERT(132, m_myObj != NULL);
}
void dJprev_c::remove() {
JUT_ASSERT(147, m_myObj != NULL);
delete m_myObj;
}
void dJprev_c::update() {
mControl->update();
}
void dJprev_c::show3D(Mtx mtx) {
mControl->show3D(mtx);
}
void dJprev_c::show2D() {
mControl->show2D();
}

View File

@ -8,6 +8,10 @@
#include "f_op/f_op_scene_mng.h"
#include "m_Do/m_Do_hostIO.h"
#if DEBUG
#pragma nosyminline on
#endif
static int fopScn_Draw(scene_class* i_this) {
int ret = fpcNd_DrawMethod((nodedraw_method_class*)i_this->submethod, i_this);
return ret;