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:
Luke Street
2026-03-01 15:35:36 -07:00
committed by GitHub
parent c9a46bd65b
commit 4df8ccc871
1740 changed files with 583 additions and 825 deletions
@@ -0,0 +1,65 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/JSupport/JSUOutputStream.h"
#include "JSystem/JSupport/JSURandomOutputStream.h"
#ifdef __REVOLUTION_SDK__
#include <revolution.h>
#else
#include <dolphin.h>
#endif
#include <cstring>
JSUOutputStream::~JSUOutputStream() {
if (!isGood()) {
OS_REPORT("JSUOutputStream: occur error.\n");
}
}
s32 JSUOutputStream::write(const void* buffer, s32 numBytes) {
s32 bytesWrote = writeData(buffer, numBytes);
if (bytesWrote != numBytes) {
setState(IOS_STATE_1);
}
return bytesWrote;
}
void JSUOutputStream::write(const char* str) {
if (str == NULL) {
u16 spA = 0;
if (writeData(&spA, sizeof(spA)) != sizeof(spA)) {
setState(IOS_STATE_1);
}
} else {
int len = strlen(str);
if (len >= 0x10000) {
setState(IOS_STATE_2);
} else {
u16 sp8 = len;
if (writeData(&sp8, sizeof(sp8)) != sizeof(sp8) || writeData(str, len) != len) {
setState(IOS_STATE_1);
}
}
}
}
s32 JSUOutputStream::skip(s32 count, s8 param_1) {
s32 skipCount = 0;
for (; skipCount < count; skipCount++) {
if (writeData(&param_1, sizeof(param_1)) != sizeof(param_1)) {
setState(IOS_STATE_1);
break;
}
}
return skipCount;
}
s32 JSURandomOutputStream::seek(s32 param_0, JSUStreamSeekFrom param_1) {
s32 seekResult = seekPos(param_0, param_1);
clrState(IOS_STATE_1);
return seekResult;
}
s32 JSURandomOutputStream::getAvailable() const {
return getLength() - getPosition();
}