m_Do demo work (#1189)

* m_Do_controller_pad and m_Do_Reset OK for demo, m_Do_machine 100% with weak func order

* Add machine.pch, m_Do_machine OK for demo

* m_Do_gba_com and m_Do_MemCardRWmng OK for demo

* m_Do_graphic work

* m_Do_graphic JPN/PAL version diffs
This commit is contained in:
LagoLunatic
2026-08-31 15:52:01 -04:00
committed by GitHub
parent 18e0b77903
commit e7e0e8e581
61 changed files with 694 additions and 411 deletions
+4 -4
View File
@@ -15,12 +15,12 @@ public:
virtual s32 getGrafType() const { return 1; }
virtual void setLookat();
f32 getWidthPower() const { return mBounds.getWidth() / mOrtho.getWidth(); }
f32 getHeightPower() const { return mBounds.getHeight() / mOrtho.getHeight(); }
f32 getWidthPower() { return mBounds.getWidth() / mOrtho.getWidth(); }
f32 getHeightPower() { return mBounds.getHeight() / mOrtho.getHeight(); }
const JGeometry::TBox2<f32>* getOrtho() const { return &mOrtho; }
void setOrtho(f32 x, f32 y, f32 width, f32 height, f32 far, f32 near) {
JGeometry::TBox2<f32> ortho(x, y, x + width, y + height);
setOrtho(ortho, far, near);
setOrtho(JGeometry::TBox2<f32>(x, y, x + width, y + height), far, near);
}
private:
+1 -1
View File
@@ -49,7 +49,7 @@ public:
};
MtxP getViewMtx() { return mViewMtx; }
void setViewMtx(Mtx m) { MTXCopy(m, mViewMtx); }
void setViewMtx(const Mtx m) { MTXCopy(m, mViewMtx); }
void setDrawModeOpaTexEdge() { mDrawMode = OPA_TEX_EDGE; }
+2 -2
View File
@@ -23,7 +23,7 @@ struct JFWSystem {
static s32 decompPriority;
static s32 aPiecePriority;
static ResFONT* systemFontRes;
static GXRenderModeObj* renderMode;
static const GXRenderModeObj* renderMode;
static u32 exConsoleBufferSize;
};
@@ -53,7 +53,7 @@ struct JFWSystem {
JUT_ASSERT(61, sInitCalled == FALSE);
CSetUpParam::aramGraphBufSize = size;
}
static void setRenderMode(GXRenderModeObj* p_modeObj) {
static void setRenderMode(const GXRenderModeObj* p_modeObj) {
JUT_ASSERT(80, sInitCalled == FALSE);
CSetUpParam::renderMode = p_modeObj;
}
+1 -3
View File
@@ -43,7 +43,7 @@ public:
static void dump(void);
static JKRAram* getManager() { return sAramObject; }
static JKRAramHeap* getAramHeap() { return getManager()->mAramHeap; }
static JKRAramHeap* getAramHeap() { return sAramObject->mAramHeap; }
static JSUList<JKRAMCommand>& getCommandList() { return sAramCommandList; }
static u8 decideAramGroupId(int groupId) {
@@ -94,6 +94,4 @@ inline JKRAramBlock* JKRMainRamToAram(u8* buf, JKRAramBlock* block, u32 size, JK
return JKRAram::mainRamToAram(buf, block, size, expandSwitch, fileSize, heap, id);
}
// void JKRDecompressFromAramToMainRam(u32, void*, u32, u32, u32, u32*);
#endif /* JKRARAM_H */
+8
View File
@@ -68,4 +68,12 @@ inline JKRAramStreamCommand* JKRStreamToAram_Async(JSUFileInputStream *stream, u
return JKRAramStream::write_StreamToAram_Async(stream, addr, size, offset);
}
inline void JKRSetAramTransferBuffer(u8* buffer, u32 bufferSize, JKRHeap* heap) {
JKRAramStream::setTransBuffer(buffer, bufferSize, heap);
}
inline void JKRResetAramTransferBuffer() {
JKRAramStream::setTransBuffer(NULL, 0, NULL);
}
#endif /* JKRARAMSTREAM_H */
+8
View File
@@ -240,4 +240,12 @@ inline u32 JKRReadTypeResource(void* buffer, u32 bufferSize, u32 tag, const char
return JKRArchive::readTypeResource(buffer, bufferSize, tag, name, arc);
}
inline JKRArchive* JKRMountArchive(const char* path, JKRArchive::EMountMode mountMode, JKRHeap* heap, JKRArchive::EMountDirection mountDirection) {
return JKRArchive::mount(path, mountMode, heap, mountDirection);
}
inline void JKRUnmountArchive(JKRArchive* arc) {
arc->unmount();
}
#endif
+11 -19
View File
@@ -3,31 +3,25 @@
#include "dolphin/dvd/dvd.h"
struct JKRFileFinder_UnknownBase {
/* 0x00 */ const char* mEntryName;
/* 0x04 */ s32 mEntryFileIndex;
/* 0x08 */ u16 mEntryId;
/* 0x0A */ u16 mEntryTypeFlags;
}; // Size: 0x0C
class JKRFileFinder : public JKRFileFinder_UnknownBase {
class JKRFileFinder {
public:
JKRFileFinder() {
mIsAvailable = false;
mIsFileOrDirectory = false;
}
virtual ~JKRFileFinder() {}
bool isAvailable() const { return mIsAvailable; }
bool isFile() const { return mIsFileOrDirectory; }
bool isDirectory() const { return mIsFileOrDirectory; }
public:
/* 0x00 */ const char* mEntryName;
/* 0x04 */ s32 mEntryFileIndex;
/* 0x08 */ u16 mEntryId;
/* 0x0A */ u16 mEntryTypeFlags;
virtual ~JKRFileFinder() {}
/* vt[3] */ virtual bool findNextFile() = 0;
protected:
/* 0x00 */ // JKRFileFinder_UnknownBase
/* 0x0C */ // vtable
/* 0x10 */ bool mIsAvailable;
/* 0x11 */ bool mIsFileOrDirectory;
/* 0x12 */ u8 field_0x12[2];
@@ -43,9 +37,6 @@ public:
/* vt[3] */ virtual bool findNextFile(void); /* override */
private:
/* 0x00 */ // JKRFileFinder_UnknownBase
/* 0x0C */ // vtable
/* 0x10 */ // JKRFileFinder
/* 0x14 */ JKRArchive* mArchive;
/* 0x18 */ s32 mStartIndex;
/* 0x1C */ s32 mEndIndex;
@@ -61,12 +52,13 @@ public:
/* vt[3] */ virtual bool findNextFile(void); /* override */
private:
/* 0x00 */ // JKRFileFinder_UnknownBase
/* 0x0C */ // vtable
/* 0x10 */ // JKRFileFinder
/* 0x14 */ DVDDirectory mDvdDirectory;
/* 0x20 */ bool mDvdIsOpen;
/* 0x21 */ u8 field_0x21[3];
};
inline bool JKRIsFileFinderAvailable(JKRFileFinder* fileFinder) {
return fileFinder->isAvailable();
}
#endif /* JKRFILEFINDER_H */
+4
View File
@@ -65,4 +65,8 @@ inline void* JKRGetResource(const char* name) {
return JKRFileLoader::getGlbResource(name);
}
inline bool JKRRemoveResource(void* resource, JKRFileLoader* fileLoader) {
return JKRFileLoader::removeResource(resource, fileLoader);
}
#endif /* JKRFILELOADER_H */
+12
View File
@@ -241,4 +241,16 @@ inline JKRHeap* JKRGetRootHeap() {
return JKRHeap::getRootHeap();
}
inline JKRErrorHandler JKRSetErrorHandler(JKRErrorHandler errorHandler) {
return JKRHeap::setErrorHandler(errorHandler);
}
inline bool JKRSetErrorFlag(JKRHeap* heap, bool flag) {
return heap->setErrorFlag(flag);
}
inline void JKRSetDebugFillDelete(u8) {}
inline void JKRSetDebugFillNew(u8) {}
inline void JKRSetDebugFillNotuse(u8) {}
#endif /* JKRHEAP_H */
+21 -12
View File
@@ -11,6 +11,7 @@ class JSUList;
//
class JSUPtrList;
class JSUPtrLink {
public:
JSUPtrLink(void* object);
@@ -36,13 +37,13 @@ class JSULink : public JSUPtrLink {
public:
JSULink(T* object) : JSUPtrLink((void*)object) {}
T* getObject() const { return (T*)mObject; }
T* getObject() const { return static_cast<T*>(mObject); }
JSUList<T>* getSupervisor() const { return (JSUList<T>*)mList; }
JSUList<T>* getSupervisor() const { return static_cast<JSUList<T>*>(mList); }
JSULink<T>* getNext() const { return (JSULink<T>*)mNext; }
JSULink<T>* getNext() const { return static_cast<JSULink*>(mNext); }
JSULink<T>* getPrev() const { return (JSULink<T>*)mPrev; }
JSULink<T>* getPrev() const { return static_cast<JSULink*>(mPrev); }
};
//
@@ -83,6 +84,8 @@ public:
~JSUList() {}
void initiate() { JSUPtrList::initiate(); }
bool append(JSULink<T>* link) { return this->JSUPtrList::append((JSUPtrLink*)link); }
bool prepend(JSULink<T>* link) { return this->JSUPtrList::prepend((JSUPtrLink*)link); }
@@ -97,6 +100,8 @@ public:
JSULink<T>* getLast() const { return (JSULink<T>*)getLastLink(); }
JSULink<T>* getNth(u32 index) const { return (JSULink<T>*)getNthLink(index); }
JSULink<T>* getEnd() const { return NULL; }
u32 getNumLinks() const { return mLength; }
@@ -114,7 +119,7 @@ public:
return *this;
}
T* getObject() { return this->mLink->getObject(); }
T* getObject() const { return this->mLink->getObject(); }
bool operator==(JSULink<T> const* other) const { return this->mLink == other; }
bool operator!=(JSULink<T> const* other) const { return this->mLink != other; }
@@ -145,7 +150,7 @@ public:
T& operator*() { return *this->getObject(); }
T* operator->() { return this->getObject(); }
T* operator->() const { return mLink->getObject(); }
// private:
JSULink<T>* mLink;
@@ -163,15 +168,17 @@ public:
bool appendChild(JSUTree<T>* child) { return this->append(child); }
bool prependChild(JSUTree<T>* child) { return this->prepend(child); }
bool removeChild(JSUTree<T>* child) { return this->remove(child); }
bool insertChild(JSUTree<T>* before, JSUTree<T>* child) { return this->insert(before, child); }
JSUTree<T>* getEndChild() const { return NULL; }
JSUTree<T>* getFirstChild() const { return (JSUTree<T>*)this->getFirst(); }
JSUTree<T>* getFirstChild() const { return (JSUTree<T>*)this->getFirstLink(); }
JSUTree<T>* getLastChild() const { return (JSUTree<T>*)this->getLast(); }
JSUTree<T>* getLastChild() const { return (JSUTree<T>*)this->getLastLink(); }
JSUTree<T>* getNextChild() const { return (JSUTree<T>*)this->mNext; }
@@ -179,7 +186,7 @@ public:
u32 getNumChildren() const { return this->getNumLinks(); }
T* getObject() const { return (T*)this->getObjectPtr(); }
T* getObject() const { return (T*)this->mObject; }
JSUTree<T>* getParent() const { return (JSUTree<T>*)this->mList; }
};
@@ -195,9 +202,11 @@ public:
return *this;
}
operator int() { return (int)mTree; }
T* getObject() const { return this->mTree->getObject(); }
bool operator==(JSUTree<T>* other) { return this->mTree == other; }
bool operator==(const JSUTree<T>* other) const { return this->mTree == other; }
bool operator!=(const JSUTree<T>* other) const { return this->mTree != other; }
@@ -212,9 +221,9 @@ public:
return *this;
}
T* operator*() { return this->getObject(); }
T* operator*() const { return mTree->getObject(); }
T* operator->() const { return this->getObject(); }
T* operator->() const { return mTree->getObject(); }
private:
JSUTree<T>* mTree;
+19 -15
View File
@@ -6,6 +6,20 @@
#include "JSystem/JUtility/JUTFont.h"
#include "stdarg.h"
class JUTConsole;
extern "C" void JUTConsole_print_f_va_(JUTConsole*, const char*, va_list);
extern "C" void JUTSetReportConsole(JUTConsole*);
extern "C" JUTConsole* JUTGetReportConsole();
extern "C" void JUTSetWarningConsole(JUTConsole*);
extern "C" JUTConsole* JUTGetWarningConsole();
extern "C" void JUTReportConsole_f_va(const char*, va_list);
extern "C" void JUTReportConsole_f(const char*, ...);
extern "C" void JUTWarningConsole(const char* message);
extern "C" void JUTWarningConsole_f_va(const char*, va_list);
extern "C" void JUTWarningConsole_f(const char* message, ...);
extern "C" void JUTReportConsole(const char* message);
class JUTConsole : public JKRDisposer {
public:
enum EConsoleType {
@@ -46,7 +60,7 @@ public:
mFontSizeX = x;
mFontSizeY = y;
}
void setHeight(u32 height) {
void setHeight(unsigned int height) {
mHeight = height;
if (mHeight > mMaxLines) {
mHeight = mMaxLines;
@@ -67,7 +81,7 @@ public:
bool isVisible() const { return mVisible; }
void setVisible(bool visible) { mVisible = visible; }
u8 getLineAttr(int param_0) { return mBuf[(field_0x20 + 2) * param_0]; }
u8 getLineAttr(int param_0) const { return mBuf[(field_0x20 + 2) * param_0]; }
void setLineAttr(int param_0, u8 param_1) { mBuf[(field_0x20 + 2) * param_0] = param_1; }
u8* getLinePtr(int param_0) const { return &mBuf[(field_0x20 + 2) * param_0] + 1; }
int diffIndex(int param_0, int param_1) const {
@@ -89,6 +103,8 @@ public:
void scrollToLastLine() { scroll(mMaxLines); }
void scrollToFirstLine() { scroll(-mMaxLines); }
void print_f_va(const char* fmt, std::__tag_va_List* args) { JUTConsole_print_f_va_(this, fmt, args->list); }
public:
/* 0x18 */ JGadget::TLinkListNode mLinkNode;
@@ -126,7 +142,7 @@ public:
void drawDirect(bool) const;
void setDirectConsole(JUTConsole*);
JUTConsole* getDirectConsole() const { return mDirectConsole; }
JUTConsole* getDirectConsoel() const { return mDirectConsole; }
static JUTConsoleManager* getManager() { return sManager; }
@@ -145,16 +161,4 @@ private:
/* 0x10 */ JUTConsole* mDirectConsole;
}; // Size: 0x14
extern "C" void JUTConsole_print_f_va_(JUTConsole*, const char*, va_list);
extern "C" void JUTSetReportConsole(JUTConsole*);
extern "C" JUTConsole* JUTGetReportConsole();
extern "C" void JUTSetWarningConsole(JUTConsole*);
extern "C" JUTConsole* JUTGetWarningConsole();
extern "C" void JUTReportConsole_f_va(const char*, va_list);
extern "C" void JUTReportConsole_f(const char*, ...);
extern "C" void JUTWarningConsole(const char* message);
extern "C" void JUTWarningConsole_f_va(const char*, va_list);
extern "C" void JUTWarningConsole_f(const char* message, ...);
extern "C" void JUTReportConsole(const char* message);
#endif /* JUTCONSOLE_H */
@@ -4,13 +4,6 @@
#include "JSystem/JUtility/TColor.h"
#include "stdarg.h"
namespace std {
// no idea what this is or why it is used instead of va_list
struct __tag_va_List {
va_list list;
};
}
class JUTDirectPrint {
private:
JUTDirectPrint();
+3 -3
View File
@@ -48,7 +48,7 @@ public:
class JUTExMapFile {
public:
JUTExMapFile(char* path) : mLink(this) { mPath = path; }
JUTExMapFile(const char* path) : mLink(this) { mPath = const_cast<char*>(path); }
public:
/* 0x00 */ char* mPath;
@@ -96,9 +96,9 @@ public:
JUTExternalFB* getFrameMemory() const { return mFrameMemory; }
void setTraceSuppress(u32 param_0) { mTraceSuppress = param_0; }
void setGamePad(JUTGamePad* gamePad) {
void enterPad(JUTGamePad* gamePad) {
mGamePad = gamePad;
mGamePadPort = JUTGamePad::Port_Unknown;
mGamePadPort = JUTGamePad::EPortInvalid;
}
static void setMapFile(const char* map) {
+25 -19
View File
@@ -38,18 +38,24 @@ struct JUTGamePadRecordBase {
struct JUTGamePad : public JKRDisposer {
public:
enum EStickMode {
STICK_MODE_1 = 1,
EStickMode1 = 1,
};
enum EWhichStick {
WS_MAIN_STICK,
WS_SUB_STICK,
EMainStick,
ESubStick,
};
enum EPadPort {
Port_Unknown = -1,
Port_1,
Port_2,
Port_3,
Port_4,
EPortInvalid = -1,
EPort1,
EPort2,
EPort3,
EPort4,
};
enum EClampMode {
EClampStick = 1,
};
JUTGamePad(JUTGamePad::EPadPort port);
@@ -73,6 +79,8 @@ public:
PADSetAnalogMode(mode);
}
// TODO: debug maps suggest isResetOccurred should do more than this, maybe the int* param is used for something?
static bool isResetOccurred(int*) { return C3ButtonReset::sResetOccurred; }
static void clearResetOccurred() { C3ButtonReset::sResetOccurred = false; }
static void setResetCallback(callbackFn callback, void* param_0) {
@@ -128,6 +136,8 @@ public:
static PADStatus & getPortStatus(EPadPort port) { return mPadStatus[port]; }
static void suppressPadReset(u32 val) { mSuppressPadReset = val; }
struct CButton {
CButton() { clear(); }
void clear();
@@ -144,11 +154,11 @@ public:
/* 0x10 */ f32 mAnalogLf;
/* 0x14 */ f32 mAnalogRf;
/* 0x18 */ u32 mRepeat;
/* 0x1C */ u32 field_0x1c;
/* 0x20 */ u32 field_0x20;
/* 0x24 */ u32 field_0x24;
/* 0x28 */ u32 field_0x28;
/* 0x2C */ u32 field_0x2c;
/* 0x1C */ u32 mRepeatCount;
/* 0x20 */ u32 mRepeatStart;
/* 0x24 */ u32 mRepeatMask;
/* 0x28 */ u32 mRepeatDelay;
/* 0x2C */ u32 mRepeatRate;
}; // Size: 0x30
struct C3ButtonReset {
@@ -223,10 +233,6 @@ public:
mRumble.startPatternedRumble(param_2, rumble, param_4);
}
// TODO:
void isResetOccurred(int*) {}
void suppressPadReset(u32) {}
/* 0x18 */ CButton mButton;
/* 0x48 */ CStick mMainStick;
/* 0x58 */ CStick mSubStick;
@@ -246,8 +252,8 @@ public:
static CButton mPadButton[4];
static CStick mPadMStick[4];
static CStick mPadSStick[4];
static EStickMode sStickMode;
static u32 sClampMode;
static EStickMode mStickMode;
static u32 mClampMode;
static u8 mPadAssign[4];
static u32 mSuppressPadReset;
static s32 sAnalogMode;
+4
View File
@@ -71,4 +71,8 @@ inline JUTVideo* JUTGetVideoManager() {
return JUTVideo::getManager();
}
inline void JUTDestroyVideoManager() {
JUTVideo::destroyManager();
}
#endif /* JUTVIDEO_H */