Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/RSBE01_02/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ sora/gf/gf_error_check.cpp:
sora/gf/gf_file_io_handle.cpp:
.text start:0x80020B38 end:0x80022054

sora/gf/gf_file_io_request.cpp:
.text start:0x80022054 end:0x80022490

sora/gf/gf_gameframe_counter.cpp:
.text start:0x800241B4 end:0x800242DC

Expand Down
18 changes: 9 additions & 9 deletions config/RSBE01_02/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2428,8 +2428,8 @@ getSize__14gfFileIOHandleCFv = .text:0x80021F88; // type:function size:0xC
getBuffer__14gfFileIOHandleCFv = .text:0x80021F94; // type:function size:0xC
getPool__14gfFileIOHandleCFv = .text:0x80021FA0; // type:function size:0xC
release__14gfFileIOHandleFv = .text:0x80021FAC; // type:function size:0xA8
fn_80022054 = .text:0x80022054; // type:function size:0x16C
fn_800221C0 = .text:0x800221C0; // type:function size:0x78
__ct__20gfFileIORequestQueueFv = .text:0x80022054; // type:function size:0x16C
__dt__15gfFileIORequestFv = .text:0x800221C0; // type:function size:0x78
setParam__15gfFileIORequestFPCc = .text:0x80022238; // type:function size:0xE4
setReadParam__15gfFileIORequestFPCcPCvii = .text:0x8002231C; // type:function size:0x80
setReadParam__15gfFileIORequestFPCcPvii = .text:0x8002239C; // type:function size:0x80
Expand Down Expand Up @@ -16032,7 +16032,7 @@ fn_803EF640 = .text:0x803EF640; // type:function size:0x414
fn_803EFA54 = .text:0x803EFA54; // type:function size:0x450
fn_803EFEA4 = .text:0x803EFEA4; // type:function size:0x1A8
fn_803F004C = .text:0x803F004C; // type:function size:0x5F4
strlen__FPc = .text:0x803F0640; // type:function size:0x1C scope:weak
strlen = .text:0x803F0640; // type:function size:0x1C scope:weak
__va_arg = .text:0x803F065C; // type:function size:0xC8 scope:global
__register_global_object = .text:0x803F0724; // type:function size:0x18 scope:global
__destroy_global_chain = .text:0x803F073C; // type:function size:0x48 scope:global
Expand Down Expand Up @@ -16228,16 +16228,16 @@ fn_803FA078 = .text:0x803FA078; // type:function size:0x90
sscanf = .text:0x803FA108; // type:function size:0xC8
fn_803FA1D0 = .text:0x803FA1D0; // type:function size:0xB0
strcpy = .text:0x803FA280; // type:function size:0xC0
strncpy__6StringF6StringPCcUl = .text:0x803FA340; // type:function size:0x44
strncpy = .text:0x803FA340; // type:function size:0x44
strcat = .text:0x803FA384; // type:function size:0x2C
strncat = .text:0x803FA3B0; // type:function size:0x4C
strcmp = .text:0x803FA3FC; // type:function size:0x11C
strncmp = .text:0x803FA518; // type:function size:0x40
strchr__FPcPc = .text:0x803FA558; // type:function size:0x30 scope:global
strrchr__FPcPc = .text:0x803FA588; // type:function size:0x48
strcspn__FPcPc = .text:0x803FA5D0; // type:function size:0xA4
strtok__FPcPc = .text:0x803FA674; // type:function size:0x124
strstr__FPcPc = .text:0x803FA798; // type:function size:0x6C
strchr = .text:0x803FA558; // type:function size:0x30 scope:global
strrchr = .text:0x803FA588; // type:function size:0x48
strcspn = .text:0x803FA5D0; // type:function size:0xA4
strtok = .text:0x803FA674; // type:function size:0x124
strstr = .text:0x803FA798; // type:function size:0x6C
fn_803FA804 = .text:0x803FA804; // type:function size:0x13F4
fn_803FBBF8 = .text:0x803FBBF8; // type:function size:0x84
fn_803FBC7C = .text:0x803FBC7C; // type:function size:0x430
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ def MatchingFor(*versions):
Object(Matching, "sora/gf/gf_decomp.cpp"),
Object(Matching, "sora/gf/gf_error_check.cpp"),
Object(Matching, "sora/gf/gf_file_io_handle.cpp"),
Object(Matching, "sora/gf/gf_file_io_request.cpp"),
Object(Matching, "sora/gf/gf_gameframe_counter.cpp"),
Object(Matching, "sora/gf/gf_keep_fb.cpp"),
Object(Matching, "sora/gf/gf_memory_util.cpp"),
Expand Down
46 changes: 23 additions & 23 deletions src/sora/gf/gf_file_io_handle.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <OS/OSInterrupt.h>
#include <revolution/OS/OSInterrupt.h>
#include <gf/gf_heap_manager.h>
#include <gf/gf_file_io_handle.h>
#include <gf/gf_file_io_manager.h>
Expand All @@ -24,7 +24,7 @@ bool gfFileIOHandle::createDirRequest(const char* filepath) {
if (m_request) {
m_request->setParam(filepath);
m_request->m_kind = gfFileIORequest::CreateDir;
m_request->unk17_2 = false;
m_request->unk17_b1 = false;
g_gfFileIOManager->push(m_request);
return true;
}
Expand Down Expand Up @@ -72,7 +72,7 @@ bool gfFileIOHandle::checkDirRequest(const char* filepath) {
if (m_request) {
m_request->setParam(filepath);
m_request->m_kind = gfFileIORequest::CheckDir;
m_request->unk17_2 = false;
m_request->unk17_b1 = false;
g_gfFileIOManager->push(m_request);
return true;
}
Expand Down Expand Up @@ -133,7 +133,7 @@ bool gfFileIOHandle::mountSD() {
m_request->setParam(nullptr);
m_request->m_kind = gfFileIORequest::MountSD;
m_request->m_vfUnk = 0;
m_request->unk17_2 = false;
m_request->unk17_b1 = false;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -146,7 +146,7 @@ bool gfFileIOHandle::unmountSD() {
m_request->setParam(nullptr);
m_request->m_kind = gfFileIORequest::UnmountSD;
m_request->m_vfUnk = 0;
m_request->unk17_2 = false;
m_request->unk17_b1 = false;
g_gfFileIOManager->push(m_request);
return true;
}
Expand Down Expand Up @@ -194,7 +194,7 @@ bool gfFileIOHandle::readRequest(const char* filepath, HeapType heap, int length
ensureLoaded();
if (m_request) {
m_request->setReadParam(filepath, heapPtr, length, offset);
m_request->unk18_1 = true;
m_request->unk18_b5 = true;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -205,7 +205,7 @@ bool gfFileIOHandle::readRequest(const char* filepath, const void* heapPtr, int
ensureLoaded();
if (m_request) {
m_request->setReadParam(filepath, heapPtr, length, offset);
m_request->unk18_1 = true;
m_request->unk18_b5 = true;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -216,7 +216,7 @@ bool gfFileIOHandle::readRequest(const char* filepath, void* heapPtr, int length
ensureLoaded();
if (m_request) {
m_request->setReadParam(filepath, heapPtr, length, offset);
m_request->unk18_1 = true;
m_request->unk18_b5 = true;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -229,7 +229,7 @@ bool gfFileIOHandle::readRequestCached(const char* filepath, HeapType heap, int
if (m_request) {
m_request->setReadParam(filepath, heapPtr, length, offset);
m_request->m_isCached = true;
m_request->unk18_1 = true;
m_request->unk18_b5 = true;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -241,7 +241,7 @@ bool gfFileIOHandle::readRequestCached(const char* filepath, const void* heapPtr
if (m_request) {
m_request->setReadParam(filepath, heapPtr, length, offset);
m_request->m_isCached = true;
m_request->unk18_1 = true;
m_request->unk18_b5 = true;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -253,7 +253,7 @@ bool gfFileIOHandle::readRequestCached(const char* filepath, void* heapPtr, int
if (m_request) {
m_request->setReadParam(filepath, heapPtr, length, offset);
m_request->m_isCached = true;
m_request->unk18_1 = true;
m_request->unk18_b5 = true;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -265,7 +265,7 @@ bool gfFileIOHandle::readRequestNoSync(const char* filepath, HeapType heap, int
ensureLoaded();
if (m_request) {
m_request->setReadParam(filepath, heapPtr, length, offset);
m_request->unk17_2 = false;
m_request->unk17_b1 = false;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -276,7 +276,7 @@ bool gfFileIOHandle::readRequestNoSync(const char* filepath, void* heapPtr, int
ensureLoaded();
if (m_request) {
m_request->setReadParam(filepath, heapPtr, length, offset);
m_request->unk17_2 = false;
m_request->unk17_b1 = false;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -287,8 +287,8 @@ bool gfFileIOHandle::read(const char* filepath, HeapType heap, int offset) {
const void* heapPtr = gfHeapManager::getHeap(heap);
ensureLoaded();
m_request->setReadParam(filepath, heapPtr, 0, offset);
m_request->unk17_2 = false;
m_request->unk18_0 = true;
m_request->unk17_b1 = false;
m_request->unk18_b7 = true;
g_gfFileIOManager->push(m_request);

goto loop;
Expand All @@ -306,8 +306,8 @@ bool gfFileIOHandle::read(const char* filepath, HeapType heap, int offset) {
bool gfFileIOHandle::read(const char* filepath, const void* heapPtr, int offset) {
ensureLoaded();
m_request->setReadParam(filepath, heapPtr, 0, offset);
m_request->unk17_2 = false;
m_request->unk18_0 = true;
m_request->unk17_b1 = false;
m_request->unk18_b7 = true;
g_gfFileIOManager->push(m_request);

goto loop;
Expand All @@ -325,8 +325,8 @@ bool gfFileIOHandle::read(const char* filepath, const void* heapPtr, int offset)
bool gfFileIOHandle::read(const char* filepath, void* heapPtr, int offset) {
ensureLoaded();
m_request->setReadParam(filepath, heapPtr, 0, offset);
m_request->unk17_2 = false;
m_request->unk18_0 = true;
m_request->unk17_b1 = false;
m_request->unk18_b7 = true;
g_gfFileIOManager->push(m_request);

goto loop;
Expand All @@ -344,7 +344,7 @@ bool gfFileIOHandle::read(const char* filepath, void* heapPtr, int offset) {
bool gfFileIOHandle::writeRequest(const char* filepath, void* heapPtr, int length, int offset) {
ensureLoaded();
m_request->setWriteParam(filepath, heapPtr, length, offset);
m_request->unk17_2 = false;
m_request->unk17_b1 = false;
g_gfFileIOManager->push(m_request);
return true;
}
Expand All @@ -354,7 +354,7 @@ bool gfFileIOHandle::cancelRequest() {
if (m_request) {
if (!m_request->m_isCancelRequested) {
int status = OSDisableInterrupts();
bool r30 = m_request->unk17_0;
bool r30 = m_request->unk17_b5;
if (!r30) {
m_request->m_isCancelRequested = true;
}
Expand Down Expand Up @@ -406,7 +406,7 @@ void* gfFileIOHandle::getBuffer() const {
return m_request->m_dest;
}

void* gfFileIOHandle::getPool() const {
const void* gfFileIOHandle::getPool() const {
return m_request->m_heap;
}

Expand All @@ -416,7 +416,7 @@ void gfFileIOHandle::release() {
if (m_request->m_isCancelRequested && !m_request->m_isCanceled) {
int status = OSDisableInterrupts();
if (!m_request->m_isCanceled) {
m_request->unk17_11 = true;
m_request->unk17_b2 = true;
m_request->m_notifyCallback = nullptr;
r31 = false;
}
Expand Down
99 changes: 99 additions & 0 deletions src/sora/gf/gf_file_io_request.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#include <cstring>
#include <gf/gf_heap_manager.h>
#include <gf/gf_file_io_handle.h>
#include <gf/gf_file_io_manager.h>
#include <gf/gf_file_io_request.h>
#include <revolution/NET/crc.h>
#include <revolution/OS/OSMutex.h>
#include <sr/sr_common.h>
#include <types.h>

gfFileIORequestQueue::gfFileIORequestQueue() {
OSInitMutex(&m_mtx);
m_queue = new (Heaps::SystemFW) utQueue<gfFileIORequest*, 128>;
}

gfFileIORequest::~gfFileIORequest() {
m_isReady = true;
unk17_b6 = false;
unk17_b5 = false;
m_isCancelRequested = false;
m_isCanceled = false;
unk17_b2 = false;
unk17_b1 = false;
unk17_b0 = false;
unk18_b7 = false;
unk18_b6 = false;
unk18_b5 = false;
unk18_b4 = false;
m_notifyCallback = nullptr;
m_pFilepath = nullptr;
m_filepath[0] = '\0';
}

void gfFileIORequest::setParam(const char* path) {
m_pFilepath = nullptr;
m_isReady = true;

unk17_b6 = false;
unk17_b5 = false;
m_isCancelRequested = false;
m_isCanceled = false;
unk17_b2 = false;
unk17_b1 = false;
unk17_b0 = false;

unk18_b7 = false;
unk18_b6 = false;
unk18_b5 = false;
unk18_b4 = false;

m_returnStatus = 0;
m_isReady = false;

unk17_b1 = g_gfFileIOManager->unk98;
unk17_b5 = false;
unk18_b5 = false;
m_dest = nullptr;
m_heap = nullptr;
unk18_b4 = false;

m_filepath[0] = '\0';
m_crc16 = 0;
if (path) {
m_pFilepath = m_filepath;
strncpy(m_filepath, path, sizeof(m_filepath) - 1);
m_crc16 = NETCalcCRC16(m_pFilepath, strlen(m_pFilepath));
}
}

void gfFileIORequest::setReadParam(const char* path, const void* addr, int len, int offs) {
setParam(path);
m_heap = addr;
m_kind = Read;
m_readLen = len;
m_offset = offs;
if (path[0] == '/' && path[1] == 'f') {
unk18_b4 = true;
}
}

void gfFileIORequest::setReadParam(const char* path, void* addr, int len, int offs) {
setParam(path);
m_dest = addr;
m_kind = Read;
m_readLen = len;
m_offset = offs;
if (path[0] == '/' && path[1] == 'f') {
unk18_b4 = true;
}
}

void gfFileIORequest::setWriteParam(const char* path, void* addr, int len, int offs) {
setParam(path);
m_kind = Write;
m_dest = addr;
m_heap = nullptr;
m_readLen = len;
m_offset = offs;
}
Loading