Merge commit '46da46b152472c668875d67c336f59ded62d3ecc' into compile

This commit is contained in:
kipcode66
2026-01-23 17:04:18 -05:00
495 changed files with 24331 additions and 21201 deletions
+2 -1
View File
@@ -1,8 +1,9 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
#include "JSystem/J3DGraphBase/J3DSys.h"
@@ -5,9 +5,10 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
void J3DModelData::clear() {
mpRawData = 0;
+6 -2
View File
@@ -95,7 +95,9 @@ JKRHeap::JKRFreeCallback JKRHeap::sFreeCallback;
bool JKRHeap::initArena(char** memory, u32* size, int maxHeaps) {
void* arenaLo = OSGetArenaLo();
void* arenaHi = OSGetArenaHi();
OS_REPORT("original arenaLo = %p arenaHi = %p\n", arenaLo, arenaHi);
#if !PLATFORM_GCN
OSReport("original arenaLo = %p arenaHi = %p\n", arenaLo, arenaHi);
#endif
if (arenaLo == arenaHi)
return false;
@@ -123,7 +125,9 @@ bool JKRHeap::initArena(char** memory, u32* size, int maxHeaps) {
bool JKRHeap::initArena2(char** memory, u32* size, int maxHeaps) {
void* arenaLo = OSGetMEM2ArenaLo();
void* arenaHi = OSGetMEM2ArenaHi();
OS_REPORT("original arenaLo = %p arenaHi = %p\n", arenaLo, arenaHi);
#if !PLATFORM_GCN
OSReport("original arenaLo = %p arenaHi = %p\n", arenaLo, arenaHi);
#endif
if (arenaLo == arenaHi) {
return false;
}
+59 -5
View File
@@ -9,6 +9,8 @@
JSUList<JKRThread> JKRThread::sThreadList(0);
void* JKRIdleThread::sThread;
JKRThreadSwitch* JKRThreadSwitch::sManager;
u32 JKRThreadSwitch::sTotalCount;
@@ -99,6 +101,12 @@ JKRThread* JKRThread::searchThread(OSThread* thread) {
return NULL;
}
static void dummy1(JKRThread* thread, JKRThread::TLoad* load) {
load->getId();
load->isValid();
thread->getLoadInfo();
}
JKRThreadSwitch::JKRThreadSwitch(JKRHeap* param_0) {
mHeap = param_0;
OSSetSwitchThreadCallback(JKRThreadSwitch::callback);
@@ -123,6 +131,11 @@ JKRThreadSwitch* JKRThreadSwitch::createManager(JKRHeap* heap) {
return sManager;
}
static void dummy2(JKRThread::TLoad* load) {
load->setValid(false);
load->setId(0);
}
JKRThread* JKRThreadSwitch::enter(JKRThread* thread, int thread_id) {
if (!thread) {
return NULL;
@@ -210,6 +223,10 @@ void JKRThreadSwitch::callback(OSThread* current, OSThread* next) {
}
}
void dummy3(JKRThreadSwitch* threadSw, JKRThreadName_* name) {
threadSw->draw(name);
}
void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console) {
const char* print_0 = " total: switch:%3d time:%d(%df)\n";
const char* print_1 = " -------------------------------------\n";
@@ -263,15 +280,52 @@ void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console
}
}
void* JKRThread::run() {
return NULL;
static void dummy4(JKRTask* thread, JSULink<JKRTask>* link) {
thread->getStack();
delete link;
}
void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list) {
draw(thread_name_list, NULL);
JKRTask::~JKRTask() {
sTaskList.remove(&mTaskLink);
}
JKRThreadSwitch::~JKRThreadSwitch() {}
void* JKRTask::run() {
struct TaskMessage {
void (*field_0x0)(int);
int field_0x4;
void* field_0x8;
};
OSInitFastCast();
while (true) {
TaskMessage* msg = (TaskMessage*)waitMessageBlock();
if (msg->field_0x0) {
msg->field_0x0(msg->field_0x4);
check();
if (field_0x94) {
OSSendMessage(field_0x94, msg->field_0x8, OS_MESSAGE_NOBLOCK);
}
}
msg->field_0x0 = NULL;
}
}
int JKRTask::check() {
int result = 0;
u8* ptr = (u8*)JKRThread::getStack();
JUT_ASSERT(1033, *((u32*)ptr) == 0xDEADBABE);
ptr += 4;
result += 4;
while (*ptr++ == 0xDE) { result++; }
return result;
}
#if !PLATFORM_GCN
static void dummy(JKRIdleThread* thread) {
thread->run();
delete thread;
thread->destroy();
}
#endif
#pragma push
#pragma force_active on
+16 -16
View File
@@ -9,6 +9,15 @@
#include <cstdarg>
#endif
inline void enter_(int param_0, int param_1, int param_2, const char* fmt, va_list args) {
char buf[0x100];
int ret = vsnprintf(buf, 0x100, fmt, args);
if (ret < 0) {
return;
}
JUTDbPrint::getManager()->enter(param_0, param_1, param_2, buf, ret < 0x100 ? ret : 0xFF);
}
JUTDbPrint::JUTDbPrint(JUTFont* pFont, JKRHeap* pHeap) {
mFont = pFont;
mFirst = NULL;
@@ -53,6 +62,11 @@ void JUTDbPrint::enter(int param_0, int param_1, int param_2, const char* param_
}
}
static void dummy() {
va_list args;
enter_(0, 0, 0, 0, args);
}
void JUTDbPrint::flush() {
this->flush(0, 0, JUTVideo::getManager()->getFbWidth(), JUTVideo::getManager()->getEfbHeight());
}
@@ -92,27 +106,13 @@ void JUTDbPrint::drawString(int posX, int posY, int len, const u8* str) {
void JUTReport(int param_0, int param_1, char const* fmt, ...) {
va_list args;
va_start(args, fmt);
char buf[0x100];
int ret = vsnprintf(buf, 0x100, fmt, args);
enter_(param_0, param_1, 1, fmt, args);
va_end(args);
if (ret < 0) {
return;
}
JUTDbPrint::sDebugPrint->enter(param_0, param_1, 1, buf, ret < 0x100 ? ret : 0xFF);
}
void JUTReport(int param_0, int param_1, int param_2, char const* fmt, ...) {
va_list args;
va_start(args, fmt);
char buf[0x100];
int ret = vsnprintf(buf, 0x100, fmt, args);
enter_(param_0, param_1, param_2, fmt, args);
va_end(args);
if (ret < 0) {
return;
}
JUTDbPrint::sDebugPrint->enter(param_0, param_1, param_2, buf, ret < 0x100 ? ret : 0xFF);
}
+30 -35
View File
@@ -10,8 +10,21 @@
#include <dolphin/dolphin.h>
#include <stdint.h>
struct CallbackObject {
/* 0x00 */ JUTExceptionUserCallback callback;
/* 0x04 */ u16 error;
/* 0x08 */ OSContext* context;
/* 0x0C */ int param_3;
/* 0x10 */ int param_4;
};
OSMessageQueue JUTException::sMessageQueue = {0};
STATIC_ASSERT(sizeof(CallbackObject) == 0x14);
static CallbackObject exCallbackObject;
JSUList<JUTException::JUTExMapFile> JUTException::sMapFileList(false);
static OSTime c3bcnt[4] = {0, 0, 0, 0};
const char* JUTException::sCpuExpName[17] = {
@@ -38,10 +51,16 @@ JUTException* JUTException::sErrorManager;
JUTExceptionUserCallback JUTException::sPreUserCallback;
JUTExceptionUserCallback JUTException::sPostUserCallback;
JUTExceptionUserCallback JUTException::sPostUserCallback;
#if PLATFORM_GCN
const int stack_size = 0x1C00;
#else
const int stack_size = 0x4000;
#endif
JUTException::JUTException(JUTDirectPrint* directPrint)
: JKRThread(0x1C00, 0x10, 0), mDirectPrint(directPrint) {
: JKRThread(stack_size, 0x10, 0), mDirectPrint(directPrint) {
OSSetErrorHandler(__OS_EXCEPTION_DSI, (OSErrorHandler)errorHandler);
OSSetErrorHandler(__OS_EXCEPTION_ISI, (OSErrorHandler)errorHandler);
OSSetErrorHandler(__OS_EXCEPTION_PROGRAM, (OSErrorHandler)errorHandler);
@@ -74,16 +93,6 @@ JUTException* JUTException::create(JUTDirectPrint* directPrint) {
OSMessage JUTException::sMessageBuffer[1] = {0};
struct CallbackObject {
/* 0x00 */ JUTExceptionUserCallback callback;
/* 0x04 */ u16 error;
/* 0x06 */ u16 pad_0x06;
/* 0x08 */ OSContext* context;
/* 0x0C */ int param_3;
/* 0x10 */ int param_4;
/* 0x14 */
};
void* JUTException::run() {
u32 msr = PPCMfmsr();
msr &= ~0x0900;
@@ -118,9 +127,6 @@ void* JUTException::run() {
}
}
STATIC_ASSERT(sizeof(CallbackObject) == 0x14);
static CallbackObject exCallbackObject;
void* JUTException::sConsoleBuffer;
u32 JUTException::sConsoleBufferSize;
@@ -154,8 +160,6 @@ void JUTException::errorHandler(OSError error, OSContext* context, u32 param_3,
OSYieldThread();
}
JSUList<JUTException::JUTExMapFile> JUTException::sMapFileList(false);
void JUTException::panic_f_va(char const* file, int line, char const* format, va_list args) {
char buffer[256];
vsnprintf(buffer, sizeof(buffer) - 1, format, args);
@@ -525,12 +529,8 @@ bool JUTException::isEnablePad() const {
bool JUTException::readPad(u32* out_trigger, u32* out_button) {
bool result = false;
OSTime start_time = OSGetTime();
OSTime ms;
do {
OSTime end_time = OSGetTime();
OSTime ticks = end_time - start_time;
ms = ticks / (OS_TIMER_CLOCK / 1000);
} while (ms < 0x32);
} while (OSTicksToMilliseconds(OSGetTime() - start_time) < 0x32);
if (mGamePad == (JUTGamePad*)0xffffffff) {
JUTGamePad gamePad0(JUTGamePad::EPort1);
@@ -750,24 +750,19 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
}
void JUTException::waitTime(s32 timeout_ms) {
if (timeout_ms) {
OSTime start_time = OSGetTime();
OSTime ms;
do {
OSTime end_time = OSGetTime();
OSTime ticks = end_time - start_time;
ms = ticks / (OS_TIMER_CLOCK / 1000);
} while (ms < timeout_ms);
if (!timeout_ms) {
return;
}
OSTime start_time = OSGetTime();
do {
} while (OSTicksToMilliseconds(OSGetTime() - start_time) < timeout_ms);
}
void JUTException::createFB() {
_GXRenderModeObj* renderMode = &GXNtsc480Int;
void* end = (void*)OSGetArenaHi();
u16 width = ALIGN_NEXT(renderMode->fbWidth, 16);
u16 height = renderMode->xfbHeight;
u32 pixel_count = width * height;
u32 size = pixel_count * 2;
u32 size = (u16(ALIGN_NEXT(u16(renderMode->fbWidth), 16)) * renderMode->xfbHeight) * 2;
void* begin = (void*)ALIGN_PREV((uintptr_t)end - size, 32);
void* object = (void*)ALIGN_PREV((s32)begin - sizeof(JUTExternalFB), 32);
@@ -807,7 +802,7 @@ void JUTException::appendMapFile(char const* path) {
}
for (JSUListIterator<JUTExMapFile> iterator = sMapFileList.getFirst(); iterator != sMapFileList.getEnd(); iterator++) {
if (strcmp(path, iterator->mPath) == 0) {
if (strcmp(path, iterator.getObject()->mPath) == 0) {
return;
}
}
+25 -13
View File
@@ -50,6 +50,8 @@ void JUTGamePad::initList() {
u32 JUTGamePad::sSuppressPadReset;
u8 data_8074CFA4_debug;
s32 JUTGamePad::sAnalogMode;
BOOL JUTGamePad::init() {
@@ -80,7 +82,7 @@ u32 JUTGamePad::sRumbleSupported;
u32 JUTGamePad::read() {
sRumbleSupported = PADRead(mPadStatus);
switch (getClampMode()) {
switch (sClampMode) {
case EClampStick:
PADClamp(mPadStatus);
break;
@@ -89,17 +91,18 @@ u32 JUTGamePad::read() {
break;
}
u32 reset_mask = 0;
u32 bittest;
u32 reset_mask = 0;
for (int i = 0; i < 4; i++) {
bittest = PAD_CHAN0_BIT >> i;
if (mPadStatus[i].err == 0) {
PADStatus* pad_status = &mPadStatus[i];
u32 stick_status;
stick_status = mPadMStick[i].update(mPadStatus[i].stickX, mPadStatus[i].stickY, sStickMode, EMainStick, mPadButton[i].mButton) << 0x18;
stick_status |= (mPadSStick[i].update(mPadStatus[i].substickX, mPadStatus[i].substickY, sStickMode, ESubStick, mPadButton[i].mButton) << 0x10);
stick_status = mPadMStick[i].update(pad_status->stickX, pad_status->stickY, sStickMode, EMainStick, mPadButton[i].mButton) << 0x18;
stick_status |= (mPadSStick[i].update(pad_status->substickX, pad_status->substickY, sStickMode, ESubStick, mPadButton[i].mButton) << 0x10);
mPadButton[i].update(&mPadStatus[i], stick_status);
mPadButton[i].update(pad_status, stick_status);
} else if (mPadStatus[i].err == -1) {
mPadMStick[i].update(0, 0, sStickMode, EMainStick, 0);
mPadSStick[i].update(0, 0, sStickMode, ESubStick, 0);
@@ -109,6 +112,9 @@ u32 JUTGamePad::read() {
reset_mask |= bittest;
}
} else {
if (data_8074CFA4_debug) {
OS_REPORT("game pad read error (%d)\n", mPadStatus[i].err);
}
mPadButton[i].mTrigger = 0;
mPadButton[i].mRelease = 0;
mPadButton[i].mRepeat = 0;
@@ -135,9 +141,11 @@ u32 JUTGamePad::read() {
}
if (pad->getPadRecord() != NULL && pad->getPadRecord()->isActive()) {
int port = pad->mPortNum;
if (port >= 0 && mPadStatus[port].err == 0) {
pad->getPadRecord()->write(&mPadStatus[port]);
if (pad->mPortNum >= 0) {
int port = pad->mPortNum;
if (mPadStatus[port].err == 0) {
pad->getPadRecord()->write(&mPadStatus[port]);
}
}
}
}
@@ -388,17 +396,21 @@ u32 JUTGamePad::CStick::getButton(u32 buttons) {
if (-sReleasePoint < mPosX && mPosX < sReleasePoint) {
button = button & ~0x3;
} else if (mPosX <= -sPressPoint) {
button = (button & ~0x2) | 1;
button = (button & ~0x2);
button |= 1;
} else if (mPosX >= sPressPoint) {
button = (button & ~0x1) | 2;
button = (button & ~0x1);
button |= 2;
}
if (-sReleasePoint < mPosY && mPosY < sReleasePoint) {
button = button & ~0xC;
} else if (mPosY <= -sPressPoint) {
button = (button & ~0x8) | 4;
button = (button & ~0x8);
button |= 4;
} else if (mPosY >= sPressPoint) {
button = (button & ~0x4) | 8;
button = (button & ~0x4);
button |= 8;
}
return button;
@@ -463,7 +475,7 @@ void JUTGamePad::CRumble::update(s16 port) {
stopMotorHard(port);
mLength = 0;
} else if (mFrameCount == 0) {
if (mStatus[port] == 0) {
if (mStatus[port] == false) {
startMotor(port);
}
return;
+4
View File
@@ -56,9 +56,11 @@ JUTVideo::~JUTVideo() {
}
void JUTVideo::preRetraceProc(u32 retrace_count) {
#if PLATFORM_GCN
if (!sManager) {
return;
}
#endif
if (sManager->mPreCallback) {
(*sManager->mPreCallback)(retrace_count);
@@ -166,9 +168,11 @@ void JUTVideo::drawDoneCallback() {
}
void JUTVideo::postRetraceProc(u32 retrace_count) {
#if PLATFORM_GCN
if (!sManager) {
return;
}
#endif
if (sManager->mPostCallback != NULL) {
sManager->mPostCallback(retrace_count);