move JK* JS* TUs into JSystem folder

This commit is contained in:
unknown 2020-11-29 11:53:10 -05:00
parent 635fbc34ec
commit 27cc0f5aa8
No known key found for this signature in database
GPG Key ID: 4312662758CE7D5A
7 changed files with 421 additions and 424 deletions

View File

@ -1,27 +0,0 @@
#include "JKernel/JKRDisposer.h"
#include "global.h"
#include "JKernel/JKRHeap.h"
// #include "JKernel/asm/func_802D147C.s"
JKRDisposer::JKRDisposer() : __vt(lbl_803CC0F0), ptr_link(this) {
this->heap = JKRHeap::findFromRoot(this);
if (this->heap != 0) {
this->heap->disposable_list.append(&this->ptr_link);
}
}
// Almost. Missing three instructions, something
// to do with the destruction of JSUPtrLink
#ifdef NONMATCHING
JKRDisposer::~JKRDisposer() {
this->__vt = lbl_803CC0F0;
if (this->heap != NULL) {
this->heap->disposable_list.remove(&this->ptr_link);
}
}
#else
asm JKRDisposer::~JKRDisposer() {
nofralloc
#include "JKernel/asm/func_802D14E4.s"
}
#endif

View File

@ -1,217 +0,0 @@
#include "JKernel/JKRHeap.h"
#include "global.h"
#ifdef NONMATCHING
JKRHeap::JKRHeap(void* data, u32 size, JKRHeap* parent, bool error_handler) {
}
#else
asm JKRHeap::JKRHeap(void* data, u32 size, JKRHeap* parent, bool error_handler) {
nofralloc
#include "JKernel/asm/func_802CE138.s"
}
#endif
asm JKRHeap::~JKRHeap() {
nofralloc
#include "JKernel/asm/func_802CE264.s"
}
asm bool JKRHeap::initArena(char**, u32*, int) {
nofralloc
#include "JKernel/asm/func_802CE378.s"
}
asm void JKRHeap::becomeSystemHeap() {
nofralloc
#include "JKernel/asm/func_802CE428.s"
}
asm void JKRHeap::becomeCurrentHeap() {
nofralloc
#include "JKernel/asm/func_802CE438.s"
}
asm void JKRHeap::destroy() {
nofralloc
#include "JKernel/asm/func_802CE448.s"
}
asm void* JKRHeap::alloc(u32 size, int alignment, JKRHeap* heap) {
nofralloc
#include "JKernel/asm/func_802CE474.s"
}
asm void* JKRHeap::alloc(u32 size, int alignment) {
nofralloc
#include "JKernel/asm/func_802CE4D4.s"
}
asm void JKRHeap::free(void* ptr, JKRHeap* heap) {
nofralloc
#include "JKernel/asm/func_802CE500.s"
}
asm void JKRHeap::free(void* ptr) {
nofralloc
#include "JKernel/asm/func_802CE548.s"
}
asm void JKRHeap::callAllDisposer() {
nofralloc
#include "JKernel/asm/func_802CE574.s"
}
asm void JKRHeap::freeAll() {
nofralloc
#include "JKernel/asm/func_802CE5CC.s"
}
asm void JKRHeap::freeTail() {
nofralloc
#include "JKernel/asm/func_802CE5F8.s"
}
asm s32 JKRHeap::resize(void* ptr, u32 size, JKRHeap* heap) {
nofralloc
#include "JKernel/asm/func_802CE624.s"
}
asm s32 JKRHeap::resize(void* ptr, u32 size) {
nofralloc
#include "JKernel/asm/func_802CE684.s"
}
asm s32 JKRHeap::getSize(void* ptr, JKRHeap* heap) {
nofralloc
#include "JKernel/asm/func_802CE6B0.s"
}
asm s32 JKRHeap::getSize(void* ptr) {
nofralloc
#include "JKernel/asm/func_802CE700.s"
}
asm u32 JKRHeap::getFreeSize() {
nofralloc
#include "JKernel/asm/func_802CE72C.s"
}
asm u32 JKRHeap::getMaxFreeBlock() {
nofralloc
#include "JKernel/asm/func_802CE758.s"
}
asm u32 JKRHeap::getTotalFreeSize() {
nofralloc
#include "JKernel/asm/func_802CE784.s"
}
asm u8 JKRHeap::changeGroupID(u8 param_1) {
nofralloc
#include "JKernel/asm/func_802CE7B0.s"
}
asm u32 JKRHeap::getMaxAllocatableSize(int alignment) {
nofralloc
#include "JKernel/asm/func_802CE7DC.s"
}
asm JKRHeap* JKRHeap::findFromRoot(void* ptr) {
nofralloc
#include "JKernel/asm/func_802CE83C.s"
}
asm JKRHeap* JKRHeap::find(void* ptr) const {
nofralloc
#include "JKernel/asm/func_802CE894.s"
}
asm JKRHeap* JKRHeap::findAllHeap(void* ptr) const {
nofralloc
#include "JKernel/asm/func_802CE93C.s"
}
asm void JKRHeap::dispose_subroutine(u32 begin, u32 end) {
nofralloc
#include "JKernel/asm/func_802CE9E4.s"
}
asm void JKRHeap::dispose(void* ptr, u32 size) {
nofralloc
#include "JKernel/asm/func_802CEA78.s"
}
asm void JKRHeap::dispose(void* begin, void* end) {
nofralloc
#include "JKernel/asm/func_802CEAA0.s"
}
asm void JKRHeap::dispose() {
nofralloc
#include "JKernel/asm/func_802CEAC0.s"
}
asm void JKRHeap::copyMemory(void* dst, void* src, u32 size) {
nofralloc
#include "JKernel/asm/func_802CEB18.s"
}
asm void JKRHeap::JKRDefaultMemoryErrorRoutine(JKRHeap* heap, u32 size, int alignment) {
nofralloc
#include "JKernel/asm/func_802CEB40.s"
}
asm bool JKRHeap::setErrorFlag(bool param_1) {
nofralloc
#include "JKernel/asm/func_802CEB78.s"
}
asm JKRErrorHandler JKRHeap::setErrorHandler(JKRErrorHandler param_1) {
nofralloc
#include "JKernel/asm/func_802CEB88.s"
}
asm bool JKRHeap::isSubHeap(JKRHeap* heap) const {
nofralloc
#include "JKernel/asm/func_802CEBA8.s"
}
asm void* operator new(u32 size) {
nofralloc
#include "JKernel/asm/func_802CEC4C.s"
}
asm void* operator new(u32 size, int alignment) {
nofralloc
#include "JKernel/asm/func_802CEC74.s"
}
asm void* operator new(u32 size, JKRHeap* heap, int alignment) {
nofralloc
#include "JKernel/asm/func_802CEC98.s"
}
asm void* operator new[](u32 size) {
nofralloc
#include "JKernel/asm/func_802CECC4.s"
}
asm void* operator new[](u32 size, int alignment) {
nofralloc
#include "JKernel/asm/func_802CECEC.s"
}
asm void* operator new[](u32 size, JKRHeap* heap, int alignment) {
nofralloc
#include "JKernel/asm/func_802CED10.s"
}
asm void operator delete(void* ptr) {
nofralloc
#include "JKernel/asm/func_802CED3C.s"
}
asm void operator delete[](void* ptr) {
nofralloc
#include "JKernel/asm/func_802CED60.s"
}

View File

@ -1,174 +0,0 @@
#include "JSupport/JSUList.h"
#include "global.h"
// #include "JSupport/asm/func_802DBDFC.s"
JSUPtrLink::JSUPtrLink(void* param_1) {
this->list = (JSUPtrList*)NULL;
this->unk0 = param_1;
this->prev = (JSUPtrLink*)NULL;
this->next = (JSUPtrLink*)NULL;
}
// #include "JSupport/asm/func_802DBE14.s"
JSUPtrLink::~JSUPtrLink() {
if (this->list != NULL) {
this->list->remove(this);
}
}
//
//
//
// #include "JSupport/asm/func_802DBE74.s"
JSUPtrList::JSUPtrList(bool should_initiate) {
if (should_initiate != false) {
this->initiate();
}
}
// #include "JSupport/asm/func_802DBEAC.s"
JSUPtrList::~JSUPtrList() {
JSUPtrLink* node = this->head;
s32 removed = 0;
while (this->length > removed) {
node->list = (JSUPtrList*)NULL;
node = node->next;
removed += 1;
}
}
// #include "JSupport/asm/func_802DBF14.s"
void JSUPtrList::initiate() {
this->head = (JSUPtrLink*)NULL;
this->tail = (JSUPtrLink*)NULL;
this->length = 0;
}
// #include "JSupport/asm/func_802DBF28.s"
void JSUPtrList::setFirst(JSUPtrLink* first) {
first->list = this;
first->prev = (JSUPtrLink*)NULL;
first->next = (JSUPtrLink*)NULL;
this->tail = first;
this->head = first;
this->length = 1;
}
// #include "JSupport/asm/func_802DBF4C.s"
bool JSUPtrList::append(JSUPtrLink* ptr) {
JSUPtrList* list = ptr->list;
bool result = ((JSUPtrList*)NULL == list);
if (!result) {
result = list->remove(ptr);
}
if (result) {
if (this->length == 0) {
this->setFirst(ptr);
} else {
ptr->list = this;
ptr->prev = this->tail;
ptr->next = (JSUPtrLink*)NULL;
this->tail->next = ptr;
this->tail = ptr;
this->length++;
}
}
return result;
}
// #include "JSupport/asm/func_802DBFF0.s"
bool JSUPtrList::prepend(JSUPtrLink* ptr) {
JSUPtrList* list = ptr->list;
bool result = ((JSUPtrList*)NULL == list);
if (!result) {
result = list->remove(ptr);
}
if (result) {
if (this->length == 0) {
this->setFirst(ptr);
} else {
ptr->list = this;
ptr->prev = (JSUPtrLink*)NULL;
ptr->next = this->head;
this->head->prev = ptr;
this->head = ptr;
this->length++;
}
}
return result;
}
// #include "JSupport/asm/func_802DC094.s"
bool JSUPtrList::insert(JSUPtrLink* before, JSUPtrLink* ptr) {
if (before == this->head) {
return this->prepend(ptr);
} else if (before == (JSUPtrLink*)NULL) {
return this->append(ptr);
}
if (before->list != this) {
return false;
}
bool result = ((JSUPtrList*)NULL == ptr->list);
if (!result) {
result = ptr->list->remove(ptr);
}
if (result) {
JSUPtrLink* prev = before->prev;
ptr->list = this;
ptr->prev = prev;
ptr->next = before;
prev->next = ptr;
before->prev = ptr;
this->length++;
}
return result;
}
// #include "JSupport/asm/func_802DC15C.s"
bool JSUPtrList::remove(JSUPtrLink* ptr) {
bool is_parent = (ptr->list == this);
if (is_parent) {
if (this->length == 1) {
this->head = (JSUPtrLink*)NULL;
this->tail = (JSUPtrLink*)NULL;
} else if (ptr == this->head) {
ptr->next->prev = (JSUPtrLink*)NULL;
this->head = ptr->next;
} else if (ptr == this->tail) {
ptr->prev->next = (JSUPtrLink*)NULL;
this->tail = ptr->prev;
} else {
ptr->prev->next = ptr->next;
ptr->next->prev = ptr->prev;
}
ptr->list = (JSUPtrList*)NULL;
this->length--;
}
return is_parent;
}
// #include "JSupport/asm/func_802DC20C.s"
JSUPtrLink* JSUPtrList::getNthLink(u32 index) const {
if (index >= this->length) {
return (JSUPtrLink*)NULL;
}
JSUPtrLink* node = this->head;
for(u32 i = 0; i < index; i++) {
node = node->next;
}
return node;
}

View File

@ -1 +1,27 @@
// ok
#include "JKernel/JKRDisposer.h"
#include "global.h"
#include "JKernel/JKRHeap.h"
// #include "JKernel/asm/func_802D147C.s"
JKRDisposer::JKRDisposer() : __vt(lbl_803CC0F0), ptr_link(this) {
this->heap = JKRHeap::findFromRoot(this);
if (this->heap != 0) {
this->heap->disposable_list.append(&this->ptr_link);
}
}
// Almost. Missing three instructions, something
// to do with the destruction of JSUPtrLink
#ifdef NONMATCHING
JKRDisposer::~JKRDisposer() {
this->__vt = lbl_803CC0F0;
if (this->heap != NULL) {
this->heap->disposable_list.remove(&this->ptr_link);
}
}
#else
asm JKRDisposer::~JKRDisposer() {
nofralloc
#include "JKernel/asm/func_802D14E4.s"
}
#endif

View File

@ -1 +1,217 @@
// ok
#include "JKernel/JKRHeap.h"
#include "global.h"
#ifdef NONMATCHING
JKRHeap::JKRHeap(void* data, u32 size, JKRHeap* parent, bool error_handler) {
}
#else
asm JKRHeap::JKRHeap(void* data, u32 size, JKRHeap* parent, bool error_handler) {
nofralloc
#include "JKernel/asm/func_802CE138.s"
}
#endif
asm JKRHeap::~JKRHeap() {
nofralloc
#include "JKernel/asm/func_802CE264.s"
}
asm bool JKRHeap::initArena(char**, u32*, int) {
nofralloc
#include "JKernel/asm/func_802CE378.s"
}
asm void JKRHeap::becomeSystemHeap() {
nofralloc
#include "JKernel/asm/func_802CE428.s"
}
asm void JKRHeap::becomeCurrentHeap() {
nofralloc
#include "JKernel/asm/func_802CE438.s"
}
asm void JKRHeap::destroy() {
nofralloc
#include "JKernel/asm/func_802CE448.s"
}
asm void* JKRHeap::alloc(u32 size, int alignment, JKRHeap* heap) {
nofralloc
#include "JKernel/asm/func_802CE474.s"
}
asm void* JKRHeap::alloc(u32 size, int alignment) {
nofralloc
#include "JKernel/asm/func_802CE4D4.s"
}
asm void JKRHeap::free(void* ptr, JKRHeap* heap) {
nofralloc
#include "JKernel/asm/func_802CE500.s"
}
asm void JKRHeap::free(void* ptr) {
nofralloc
#include "JKernel/asm/func_802CE548.s"
}
asm void JKRHeap::callAllDisposer() {
nofralloc
#include "JKernel/asm/func_802CE574.s"
}
asm void JKRHeap::freeAll() {
nofralloc
#include "JKernel/asm/func_802CE5CC.s"
}
asm void JKRHeap::freeTail() {
nofralloc
#include "JKernel/asm/func_802CE5F8.s"
}
asm s32 JKRHeap::resize(void* ptr, u32 size, JKRHeap* heap) {
nofralloc
#include "JKernel/asm/func_802CE624.s"
}
asm s32 JKRHeap::resize(void* ptr, u32 size) {
nofralloc
#include "JKernel/asm/func_802CE684.s"
}
asm s32 JKRHeap::getSize(void* ptr, JKRHeap* heap) {
nofralloc
#include "JKernel/asm/func_802CE6B0.s"
}
asm s32 JKRHeap::getSize(void* ptr) {
nofralloc
#include "JKernel/asm/func_802CE700.s"
}
asm u32 JKRHeap::getFreeSize() {
nofralloc
#include "JKernel/asm/func_802CE72C.s"
}
asm u32 JKRHeap::getMaxFreeBlock() {
nofralloc
#include "JKernel/asm/func_802CE758.s"
}
asm u32 JKRHeap::getTotalFreeSize() {
nofralloc
#include "JKernel/asm/func_802CE784.s"
}
asm u8 JKRHeap::changeGroupID(u8 param_1) {
nofralloc
#include "JKernel/asm/func_802CE7B0.s"
}
asm u32 JKRHeap::getMaxAllocatableSize(int alignment) {
nofralloc
#include "JKernel/asm/func_802CE7DC.s"
}
asm JKRHeap* JKRHeap::findFromRoot(void* ptr) {
nofralloc
#include "JKernel/asm/func_802CE83C.s"
}
asm JKRHeap* JKRHeap::find(void* ptr) const {
nofralloc
#include "JKernel/asm/func_802CE894.s"
}
asm JKRHeap* JKRHeap::findAllHeap(void* ptr) const {
nofralloc
#include "JKernel/asm/func_802CE93C.s"
}
asm void JKRHeap::dispose_subroutine(u32 begin, u32 end) {
nofralloc
#include "JKernel/asm/func_802CE9E4.s"
}
asm void JKRHeap::dispose(void* ptr, u32 size) {
nofralloc
#include "JKernel/asm/func_802CEA78.s"
}
asm void JKRHeap::dispose(void* begin, void* end) {
nofralloc
#include "JKernel/asm/func_802CEAA0.s"
}
asm void JKRHeap::dispose() {
nofralloc
#include "JKernel/asm/func_802CEAC0.s"
}
asm void JKRHeap::copyMemory(void* dst, void* src, u32 size) {
nofralloc
#include "JKernel/asm/func_802CEB18.s"
}
asm void JKRHeap::JKRDefaultMemoryErrorRoutine(JKRHeap* heap, u32 size, int alignment) {
nofralloc
#include "JKernel/asm/func_802CEB40.s"
}
asm bool JKRHeap::setErrorFlag(bool param_1) {
nofralloc
#include "JKernel/asm/func_802CEB78.s"
}
asm JKRErrorHandler JKRHeap::setErrorHandler(JKRErrorHandler param_1) {
nofralloc
#include "JKernel/asm/func_802CEB88.s"
}
asm bool JKRHeap::isSubHeap(JKRHeap* heap) const {
nofralloc
#include "JKernel/asm/func_802CEBA8.s"
}
asm void* operator new(u32 size) {
nofralloc
#include "JKernel/asm/func_802CEC4C.s"
}
asm void* operator new(u32 size, int alignment) {
nofralloc
#include "JKernel/asm/func_802CEC74.s"
}
asm void* operator new(u32 size, JKRHeap* heap, int alignment) {
nofralloc
#include "JKernel/asm/func_802CEC98.s"
}
asm void* operator new[](u32 size) {
nofralloc
#include "JKernel/asm/func_802CECC4.s"
}
asm void* operator new[](u32 size, int alignment) {
nofralloc
#include "JKernel/asm/func_802CECEC.s"
}
asm void* operator new[](u32 size, JKRHeap* heap, int alignment) {
nofralloc
#include "JKernel/asm/func_802CED10.s"
}
asm void operator delete(void* ptr) {
nofralloc
#include "JKernel/asm/func_802CED3C.s"
}
asm void operator delete[](void* ptr) {
nofralloc
#include "JKernel/asm/func_802CED60.s"
}

View File

@ -1 +1,174 @@
// ok
#include "JSupport/JSUList.h"
#include "global.h"
// #include "JSupport/asm/func_802DBDFC.s"
JSUPtrLink::JSUPtrLink(void* param_1) {
this->list = (JSUPtrList*)NULL;
this->unk0 = param_1;
this->prev = (JSUPtrLink*)NULL;
this->next = (JSUPtrLink*)NULL;
}
// #include "JSupport/asm/func_802DBE14.s"
JSUPtrLink::~JSUPtrLink() {
if (this->list != NULL) {
this->list->remove(this);
}
}
//
//
//
// #include "JSupport/asm/func_802DBE74.s"
JSUPtrList::JSUPtrList(bool should_initiate) {
if (should_initiate != false) {
this->initiate();
}
}
// #include "JSupport/asm/func_802DBEAC.s"
JSUPtrList::~JSUPtrList() {
JSUPtrLink* node = this->head;
s32 removed = 0;
while (this->length > removed) {
node->list = (JSUPtrList*)NULL;
node = node->next;
removed += 1;
}
}
// #include "JSupport/asm/func_802DBF14.s"
void JSUPtrList::initiate() {
this->head = (JSUPtrLink*)NULL;
this->tail = (JSUPtrLink*)NULL;
this->length = 0;
}
// #include "JSupport/asm/func_802DBF28.s"
void JSUPtrList::setFirst(JSUPtrLink* first) {
first->list = this;
first->prev = (JSUPtrLink*)NULL;
first->next = (JSUPtrLink*)NULL;
this->tail = first;
this->head = first;
this->length = 1;
}
// #include "JSupport/asm/func_802DBF4C.s"
bool JSUPtrList::append(JSUPtrLink* ptr) {
JSUPtrList* list = ptr->list;
bool result = ((JSUPtrList*)NULL == list);
if (!result) {
result = list->remove(ptr);
}
if (result) {
if (this->length == 0) {
this->setFirst(ptr);
} else {
ptr->list = this;
ptr->prev = this->tail;
ptr->next = (JSUPtrLink*)NULL;
this->tail->next = ptr;
this->tail = ptr;
this->length++;
}
}
return result;
}
// #include "JSupport/asm/func_802DBFF0.s"
bool JSUPtrList::prepend(JSUPtrLink* ptr) {
JSUPtrList* list = ptr->list;
bool result = ((JSUPtrList*)NULL == list);
if (!result) {
result = list->remove(ptr);
}
if (result) {
if (this->length == 0) {
this->setFirst(ptr);
} else {
ptr->list = this;
ptr->prev = (JSUPtrLink*)NULL;
ptr->next = this->head;
this->head->prev = ptr;
this->head = ptr;
this->length++;
}
}
return result;
}
// #include "JSupport/asm/func_802DC094.s"
bool JSUPtrList::insert(JSUPtrLink* before, JSUPtrLink* ptr) {
if (before == this->head) {
return this->prepend(ptr);
} else if (before == (JSUPtrLink*)NULL) {
return this->append(ptr);
}
if (before->list != this) {
return false;
}
bool result = ((JSUPtrList*)NULL == ptr->list);
if (!result) {
result = ptr->list->remove(ptr);
}
if (result) {
JSUPtrLink* prev = before->prev;
ptr->list = this;
ptr->prev = prev;
ptr->next = before;
prev->next = ptr;
before->prev = ptr;
this->length++;
}
return result;
}
// #include "JSupport/asm/func_802DC15C.s"
bool JSUPtrList::remove(JSUPtrLink* ptr) {
bool is_parent = (ptr->list == this);
if (is_parent) {
if (this->length == 1) {
this->head = (JSUPtrLink*)NULL;
this->tail = (JSUPtrLink*)NULL;
} else if (ptr == this->head) {
ptr->next->prev = (JSUPtrLink*)NULL;
this->head = ptr->next;
} else if (ptr == this->tail) {
ptr->prev->next = (JSUPtrLink*)NULL;
this->tail = ptr->prev;
} else {
ptr->prev->next = ptr->next;
ptr->next->prev = ptr->prev;
}
ptr->list = (JSUPtrList*)NULL;
this->length--;
}
return is_parent;
}
// #include "JSupport/asm/func_802DC20C.s"
JSUPtrLink* JSUPtrList::getNthLink(u32 index) const {
if (index >= this->length) {
return (JSUPtrLink*)NULL;
}
JSUPtrLink* node = this->head;
for(u32 i = 0; i < index; i++) {
node = node->next;
}
return node;
}

View File

@ -421,12 +421,12 @@ TEXT_O_FILES := \
$(BUILD_DIR)/asm/gf/GFLight.o \
$(BUILD_DIR)/asm/gf/GFPixel.o \
$(BUILD_DIR)/asm/gf/GFTev.o \
$(BUILD_DIR)/libs/JKernel/JKRHeap.o \
$(BUILD_DIR)/libs/JSystem/JKernel/JKRHeap.o \
$(BUILD_DIR)/asm/JKernel/JKRHeap.o \
$(BUILD_DIR)/asm/JKernel/JKRExpHeap.o \
$(BUILD_DIR)/asm/JKernel/JKRSolidHeap.o \
$(BUILD_DIR)/asm/JKernel/JKRAssertHeap.o \
$(BUILD_DIR)/libs/JKernel/JKRDisposer.o \
$(BUILD_DIR)/libs/JSystem/JKernel/JKRDisposer.o \
$(BUILD_DIR)/asm/JKernel/JKRDisposer.o \
$(BUILD_DIR)/asm/JKernel/JKRThread.o \
$(BUILD_DIR)/asm/JKernel/JKRAram.o \
@ -449,7 +449,7 @@ TEXT_O_FILES := \
$(BUILD_DIR)/asm/JKernel/JKRDvdAramRipper.o \
$(BUILD_DIR)/asm/JKernel/JKRDecomp.o \
$(BUILD_DIR)/asm/JSupport/JSUList.o \
$(BUILD_DIR)/libs/JSupport/JSUList.o \
$(BUILD_DIR)/libs/JSystem/JSupport/JSUList.o \
$(BUILD_DIR)/asm/JSupport/JSUInputStream.o \
$(BUILD_DIR)/asm/JSupport/JSUMemoryStream.o \
$(BUILD_DIR)/asm/JSupport/JSUFileStream.o \