make system.cpp equivalent

This commit is contained in:
HeartPiece 2024-06-15 15:19:16 +10:00
parent 6250e48106
commit 5dc1a5cf7d
3 changed files with 77 additions and 86 deletions

View File

@ -175,7 +175,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectActor.cpp">JSTObjectActor.cpp</a> | 22510 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectSystem.cpp">JSTObjectSystem.cpp</a> | 22652 | | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectActor.cpp">JSTObjectActor.cpp</a> | 22510 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectSystem.cpp">JSTObjectSystem.cpp</a> | 22652 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/matMath.cpp">matMath.cpp</a> | 26236 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/moviePlayer.cpp">moviePlayer.cpp</a> | 26335 | | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/matMath.cpp">matMath.cpp</a> | 26236 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/moviePlayer.cpp">moviePlayer.cpp</a> | 26335 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/windowMessage.cpp">windowMessage.cpp</a> | 29493 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/memoryCard.cpp">memoryCard.cpp</a> | 31350 | | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/windowMessage.cpp">windowMessage.cpp</a> | 29493 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/memoryCard.cpp">memoryCard.cpp</a> | 31350 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/system.cpp">system.cpp</a> | 32968 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/bootSection.cpp">bootSection.cpp</a> | 38573 | | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/system.cpp">system.cpp</a> | 33439 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/bootSection.cpp">bootSection.cpp</a> | 38573 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/movieMessage.cpp">movieMessage.cpp</a> | 44324 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/pikmin2MemoryCardMgr.cpp">pikmin2MemoryCardMgr.cpp</a> | 50866 | | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/movieMessage.cpp">movieMessage.cpp</a> | 44324 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/pikmin2MemoryCardMgr.cpp">pikmin2MemoryCardMgr.cpp</a> | 50866 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/graphics.cpp">graphics.cpp</a> | 76184 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageRendering.cpp">messageRendering.cpp</a> | 100334 | | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/graphics.cpp">graphics.cpp</a> | 76184 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageRendering.cpp">messageRendering.cpp</a> | 100334 |

View File

@ -19,10 +19,6 @@ struct OSContext;
struct _GXRenderModeObj; struct _GXRenderModeObj;
struct HeapStatus; struct HeapStatus;
void Pikmin2DefaultMemoryErrorRoutine(void*, u32, s32);
void kando_panic_f(bool, const char*, s32, const char*, ...);
extern void preUserCallback(u16, OSContext*, u32, u32);
struct HeapInfo : public Node, public JKRDisposer { struct HeapInfo : public Node, public JKRDisposer {
virtual ~HeapInfo(); // _20 (weak) virtual ~HeapInfo(); // _20 (weak)

View File

@ -30,63 +30,63 @@
#include "LoadResource.h" #include "LoadResource.h"
#include "Dolphin/__start.h" #include "Dolphin/__start.h"
GXRenderModeObj localNtsc608x448IntDfProg = { VI_TVMODE_NTSC_PROG, static GXRenderModeObj localNtsc608x448IntDfProg = { VI_TVMODE_NTSC_PROG,
608, // fbWidth 608, // fbWidth
448, // efbHeight 448, // efbHeight
448, // xfbHeight 448, // xfbHeight
27, // viXOrigin 27, // viXOrigin
16, // viYOrigin 16, // viYOrigin
666, // viWidth 666, // viWidth
448, // viHeight 448, // viHeight
VI_XFBMODE_SF, VI_XFBMODE_SF,
0, // field_rendering 0, // field_rendering
0, // aa 0, // aa
{ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },
{ 0, 0, 21, 22, 21, 0, 0 } }; { 0, 0, 21, 22, 21, 0, 0 } };
GXRenderModeObj localNtsc608x448IntDf = { VI_TVMODE_NTSC_INT, static GXRenderModeObj localNtsc608x448IntDf = { VI_TVMODE_NTSC_INT,
608, // fbWidth 608, // fbWidth
448, // efbHeight 448, // efbHeight
448, // xfbHeight 448, // xfbHeight
27, // viXOrigin 27, // viXOrigin
16, // viYOrigin 16, // viYOrigin
666, // viWidth 666, // viWidth
448, // viHeight 448, // viHeight
VI_XFBMODE_DF, VI_XFBMODE_DF,
0, // field_rendering 0, // field_rendering
0, // aa 0, // aa
{ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },
{ 7, 7, 12, 12, 12, 7, 7 } }; { 7, 7, 12, 12, 12, 7, 7 } };
GXRenderModeObj localPal608x448IntDf = { VI_TVMODE_PAL_INT, static GXRenderModeObj localPal608x448IntDf = { VI_TVMODE_PAL_INT,
608, // fbWidth 608, // fbWidth
448, // efbHeight 448, // efbHeight
538, // xfbHeight 538, // xfbHeight
25, // viXOrigin 25, // viXOrigin
18, // viYOrigin 18, // viYOrigin
670, // viWidth 670, // viWidth
538, // viHeight 538, // viHeight
VI_XFBMODE_DF, VI_XFBMODE_DF,
0, // field_rendering 0, // field_rendering
0, // aa 0, // aa
{ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },
{ 7, 7, 12, 12, 12, 7, 7 } }; { 7, 7, 12, 12, 12, 7, 7 } };
GXRenderModeObj localPal60608x448IntDf = { VI_TVMODE_EURGB60_INT, static GXRenderModeObj localPal60608x448IntDf = { VI_TVMODE_EURGB60_INT,
608, // fbWidth 608, // fbWidth
448, // efbHeight 448, // efbHeight
448, // xfbHeight 448, // xfbHeight
27, // viXOrigin 27, // viXOrigin
16, // viYOrigin 16, // viYOrigin
666, // viWidth 666, // viWidth
448, // viHeight 448, // viHeight
VI_XFBMODE_DF, VI_XFBMODE_DF,
0, // field_rendering 0, // field_rendering
0, // aa 0, // aa
{ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },
{ 7, 7, 12, 12, 12, 7, 7 } }; { 7, 7, 12, 12, 12, 7, 7 } };
GXRenderModeObj* sRenderModeTable[4] static GXRenderModeObj* sRenderModeTable[4]
= { &localNtsc608x448IntDfProg, &localNtsc608x448IntDf, &localPal608x448IntDf, &localPal60608x448IntDf }; = { &localNtsc608x448IntDfProg, &localNtsc608x448IntDf, &localPal608x448IntDf, &localPal60608x448IntDf };
System::ERenderMode System::mRenderMode; System::ERenderMode System::mRenderMode;
@ -95,21 +95,16 @@ System::GXVerifyArg System::sVerifyArg;
bool sUseABXCommand = true; bool sUseABXCommand = true;
struct CallbackObject { static JUTException::ExCallbackObject exCallbackObject;
u32* funcPtr;
u16 _04;
OSContext* _08;
u32 _0C;
u32 _10;
};
extern CallbackObject exCallbackObject; // pre-declare statics
static void preUserCallback(u16, OSContext*, u32, u32);
/** /**
* @note Address: 0x80421EC4 * @note Address: 0x80421EC4
* @note Size: 0xA0 * @note Size: 0xA0
*/ */
void Pikmin2DefaultMemoryErrorRoutine(void* address, u32 size, int alignment) static void Pikmin2DefaultMemoryErrorRoutine(void* address, u32 size, int alignment)
{ {
JUT_PANICLINE(99, "Memory Alloc Error!\n%x (size %d) align(%d)\nRestTotal=%d\nRestFree =%d\n", address, size, alignment, JUT_PANICLINE(99, "Memory Alloc Error!\n%x (size %d) align(%d)\nRestTotal=%d\nRestFree =%d\n", address, size, alignment,
static_cast<JKRHeap*>(address)->getTotalFreeSize(), static_cast<JKRHeap*>(address)->getFreeSize()); static_cast<JKRHeap*>(address)->getTotalFreeSize(), static_cast<JKRHeap*>(address)->getFreeSize());
@ -121,38 +116,38 @@ void Pikmin2DefaultMemoryErrorRoutine(void* address, u32 size, int alignment)
* @note Address: 0x80421F64 * @note Address: 0x80421F64
* @note Size: 0x188 * @note Size: 0x188
*/ */
void kando_panic_f(bool r3, const char* r4, int line, const char* r6, ...) static void kando_panic_f(bool r3, const char* file, int line, const char* format, ...)
{ {
va_list list; va_list list;
va_start(list, r6); va_start(list, format);
u32* func = (u32*)preUserCallback;
JUTConsole* console = JUTException::sConsole; JUTConsole* console = JUTException::sConsole;
JUTException* except = JUTException::sErrorManager; JUTException* except = JUTException::sErrorManager;
OSErrorHandler func = (OSErrorHandler)preUserCallback;
char buffer[0xFF]; char buffer[260];
vsnprintf(buffer, sizeof(buffer), r6, list); vsnprintf(buffer, 255, format, list);
if (!except) { if (!except) {
OSPanic(r4, line, buffer); OSPanic(file, line, buffer);
} }
OSContext* thread = &JFWSystem::mainThread->mThread->context; OSContext* context = &JFWSystem::mainThread->mThread->context;
char dest[sizeof(OSContext)]; char dest[sizeof(OSContext)];
memcpy(dest, thread, sizeof(OSContext)); memcpy(dest, context, sizeof(OSContext));
except->mStackPointer = thread; except->mStackPointer = (void*)((u32*)dest)[1];
exCallbackObject.funcPtr = func; exCallbackObject.mErrorHandler = func;
exCallbackObject._04 = 255; exCallbackObject.mError = 255;
exCallbackObject._08 = thread; exCallbackObject.mContext = context;
exCallbackObject._0C = 0; exCallbackObject._0C = 0;
exCallbackObject._10 = 0; exCallbackObject._10 = 0;
if (!console || (console && !(console->mOutput & 2))) { if (!console || (console && !(console->mOutput & 2))) {
OSReport("%s in \"%s\" on line %d\n", buffer, r4, line); OSReport("%s in \"%s\" on line %d\n", buffer, file, line);
} }
if (console) { if (console) {
console->print_f("%s in \"%s\" on\n line %d\n", buffer, r4, line); console->print_f("%s in \"%s\" on\n line %d\n", buffer, file, line);
} }
OSSendMessage(&JUTException::sMessageQueue, (OSMessage*)&exCallbackObject, true); OSSendMessage(&JUTException::sMessageQueue, (OSMessage*)&exCallbackObject, true);
@ -310,7 +305,7 @@ void preUserCallback(u16, OSContext*, u32, u32)
JUTException::sConsole->startPrint(3, "--- Game debug information ---\n"); JUTException::sConsole->startPrint(3, "--- Game debug information ---\n");
JUTConsoleManager::sManager->drawDirect(true); JUTConsoleManager::sManager->drawDirect(true);
} else { } else {
OSReport("コンソールがありません\n"); OSReport("コンソ\ールがありません\n"); // 'no console'
} }
} }
@ -393,7 +388,7 @@ void retraceCallback(u32)
if ((int)sys->mCpuLockCount > 0 && (int)sys->mCpuRetraceCount > (int)sys->mCpuLockCount) { if ((int)sys->mCpuLockCount > 0 && (int)sys->mCpuRetraceCount > (int)sys->mCpuLockCount) {
sUseABXCommand = false; sUseABXCommand = false;
OSReport("cpuLockCount %d retraceCount %d\n", sys->mCpuLockCount, sys->mCpuRetraceCount); OSReport("cpuLockCount %d retraceCount %d\n", sys->mCpuLockCount, sys->mCpuRetraceCount);
kando_panic_f(1, "system/retrace", 0, "CPU LOCKED!"); kando_panic_f(true, "system/retrace", 0, "CPU LOCKED!");
} }
} }
@ -1284,7 +1279,7 @@ void System::refreshGenNode() { }
void System::setFrameRate(int newFactor) void System::setFrameRate(int newFactor)
{ {
JFWDisplay* display = mDisplay; JFWDisplay* display = mDisplay;
JUT_ASSERTLINE(2343, display, "no display\n"); JUT_ASSERTLINE(2343, display, "no display");
mFrameRate = (f32)newFactor; mFrameRate = (f32)newFactor;
mDeltaTime = mFrameRate / 60.0f; mDeltaTime = mFrameRate / 60.0f;
display->mFrameRate = newFactor; display->mFrameRate = newFactor;