mirror of
https://github.com/open-goal/jak-project
synced 2026-08-20 06:16:35 -04:00
Merge remote-tracking branch 'origin/master' into j2/progress
This commit is contained in:
@@ -232,30 +232,6 @@ Ptr<u8> GetNextDGO(u32* lastObjectFlag) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Instruct the IOP to continue loading the next object.
|
||||
* Only should be called once it is safe to overwrite the previous.
|
||||
* @param heapPtr : pointer to heap so the IOP could try to load directly into a heap if it wants.
|
||||
* This should be updated after each object file load to make sure the IOP knows the exact location
|
||||
* of the end of the GOAL heap data.
|
||||
* DONE,
|
||||
* EXACT
|
||||
*/
|
||||
void ContinueLoadingDGO(Ptr<u8> heapPtr) {
|
||||
u32 msgID = sMsgNum;
|
||||
RPC_Dgo_Cmd* sendBuff = sMsg + sMsgNum;
|
||||
sMsgNum = sMsgNum ^ 1;
|
||||
sendBuff->result = DGO_RPC_RESULT_INIT;
|
||||
sMsg[msgID].buffer1 = 0;
|
||||
sMsg[msgID].buffer2 = 0;
|
||||
sMsg[msgID].buffer_heap_top = heapPtr.offset;
|
||||
// the IOP will wait for this RpcCall to continue the DGO state machine.
|
||||
RpcCall(DGO_RPC_CHANNEL, DGO_RPC_LOAD_NEXT_FNO, true, sendBuff, sizeof(RPC_Dgo_Cmd), sendBuff,
|
||||
sizeof(RPC_Dgo_Cmd));
|
||||
// this async RPC call will complete when the next object is fully loaded.
|
||||
sLastMsg = sendBuff;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Load the TEST.DGO file.
|
||||
* Presumably used for debugging DGO loads.
|
||||
@@ -291,7 +267,9 @@ void LoadDGOTest() {
|
||||
}
|
||||
|
||||
// okay to load the next one
|
||||
ContinueLoadingDGO(Ptr<u8>(0x4000000));
|
||||
ASSERT(false); // this is different per version, annoyingly. This function is unused though,
|
||||
// so let's be lazy for now...
|
||||
// ContinueLoadingDGO(Ptr<u8>(0x4000000));
|
||||
}
|
||||
|
||||
sShowStallMsg = lastShowStall;
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
#include "game/common/dgo_rpc_types.h"
|
||||
#include "game/kernel/common/Ptr.h"
|
||||
|
||||
extern u32 sMsgNum;
|
||||
s32 RpcCall(s32 rpcChannel,
|
||||
u32 fno,
|
||||
bool async,
|
||||
@@ -13,7 +15,6 @@ s32 RpcCall(s32 rpcChannel,
|
||||
s32 recvSize);
|
||||
void BeginLoadingDGO(const char* name, Ptr<u8> buffer1, Ptr<u8> buffer2, Ptr<u8> currentHeap);
|
||||
Ptr<u8> GetNextDGO(u32* lastObjectFlag);
|
||||
void ContinueLoadingDGO(Ptr<u8> heapPtr);
|
||||
u64 RpcCall_wrapper(void* _args);
|
||||
u32 RpcBusy(s32 channel);
|
||||
void RpcSync(s32 channel);
|
||||
@@ -23,3 +24,5 @@ u32 InitRPC();
|
||||
void StopIOP();
|
||||
|
||||
extern u32 sShowStallMsg;
|
||||
extern RPC_Dgo_Cmd sMsg[2];
|
||||
extern RPC_Dgo_Cmd* sLastMsg;
|
||||
@@ -144,7 +144,7 @@ void link_control::begin(Ptr<uint8_t> object_file,
|
||||
m_opengoal = false;
|
||||
// not an open goal object.
|
||||
if (link_debug_printfs) {
|
||||
printf("Linking GOAL style object\n");
|
||||
printf("Linking GOAL style object %s\n", name);
|
||||
}
|
||||
|
||||
// initialize
|
||||
@@ -252,6 +252,9 @@ Ptr<u8> c_symlink2(Ptr<u8> objData, Ptr<u8> linkObj, Ptr<u8> relocTable) {
|
||||
*(objPtr.cast<u32>()) = linkObj.offset;
|
||||
} else {
|
||||
// I don't think we should hit this ever.
|
||||
// if this is hit - there's a good chance something has overwritten the object file data
|
||||
// after linking has started.
|
||||
printf("val is 0x%x ptr %p\n", objValue, relocPtr - 1);
|
||||
ASSERT(false);
|
||||
}
|
||||
} while (*relocPtr);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "common/common_types.h"
|
||||
#include "common/log/log.h"
|
||||
|
||||
#include "game/common/dgo_rpc_types.h"
|
||||
#include "game/kernel/common/Ptr.h"
|
||||
#include "game/kernel/common/fileio.h"
|
||||
#include "game/kernel/common/kdgo.h"
|
||||
@@ -10,6 +11,31 @@
|
||||
#include "game/kernel/jak1/klink.h"
|
||||
|
||||
namespace jak1 {
|
||||
|
||||
/*!
|
||||
* Instruct the IOP to continue loading the next object.
|
||||
* Only should be called once it is safe to overwrite the previous.
|
||||
* @param heapPtr : pointer to heap so the IOP could try to load directly into a heap if it wants.
|
||||
* This should be updated after each object file load to make sure the IOP knows the exact location
|
||||
* of the end of the GOAL heap data.
|
||||
* DONE,
|
||||
* EXACT
|
||||
*/
|
||||
void ContinueLoadingDGO(Ptr<u8> heapPtr) {
|
||||
u32 msgID = sMsgNum;
|
||||
RPC_Dgo_Cmd* sendBuff = sMsg + sMsgNum;
|
||||
sMsgNum = sMsgNum ^ 1;
|
||||
sendBuff->result = DGO_RPC_RESULT_INIT;
|
||||
sMsg[msgID].buffer1 = 0;
|
||||
sMsg[msgID].buffer2 = 0;
|
||||
sMsg[msgID].buffer_heap_top = heapPtr.offset;
|
||||
// the IOP will wait for this RpcCall to continue the DGO state machine.
|
||||
RpcCall(DGO_RPC_CHANNEL, DGO_RPC_LOAD_NEXT_FNO, true, sendBuff, sizeof(RPC_Dgo_Cmd), sendBuff,
|
||||
sizeof(RPC_Dgo_Cmd));
|
||||
// this async RPC call will complete when the next object is fully loaded.
|
||||
sLastMsg = sendBuff;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Load and link a DGO file.
|
||||
* This does not use the mutli-threaded linker and will block until the entire file is done.
|
||||
|
||||
@@ -10,6 +10,30 @@
|
||||
|
||||
namespace jak2 {
|
||||
|
||||
/*!
|
||||
* Instruct the IOP to continue loading the next object.
|
||||
* Only should be called once it is safe to overwrite the previous.
|
||||
* @param heapPtr : pointer to heap so the IOP could try to load directly into a heap if it wants.
|
||||
* This should be updated after each object file load to make sure the IOP knows the exact location
|
||||
* of the end of the GOAL heap data.
|
||||
*
|
||||
* Unlike jak 1, we update buffer1 and buffer2 here for borrow heap loads.
|
||||
*/
|
||||
void ContinueLoadingDGO(Ptr<u8> b1, Ptr<u8> b2, Ptr<u8> heapPtr) {
|
||||
u32 msgID = sMsgNum;
|
||||
RPC_Dgo_Cmd* sendBuff = sMsg + sMsgNum;
|
||||
sMsgNum = sMsgNum ^ 1;
|
||||
sendBuff->result = DGO_RPC_RESULT_INIT;
|
||||
sMsg[msgID].buffer1 = b1.offset;
|
||||
sMsg[msgID].buffer2 = b2.offset;
|
||||
sMsg[msgID].buffer_heap_top = heapPtr.offset;
|
||||
// the IOP will wait for this RpcCall to continue the DGO state machine.
|
||||
RpcCall(DGO_RPC_CHANNEL, DGO_RPC_LOAD_NEXT_FNO, true, sendBuff, sizeof(RPC_Dgo_Cmd), sendBuff,
|
||||
sizeof(RPC_Dgo_Cmd));
|
||||
// this async RPC call will complete when the next object is fully loaded.
|
||||
sLastMsg = sendBuff;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Load and link a DGO file.
|
||||
* This does not use the mutli-threaded linker and will block until the entire file is done.
|
||||
@@ -85,7 +109,7 @@ void load_and_link_dgo_from_c(const char* name,
|
||||
|
||||
// inform IOP we are done
|
||||
if (!lastObjectLoaded) {
|
||||
ContinueLoadingDGO(Ptr<u8>((heap->current + 0x3f).offset & 0xffffffc0));
|
||||
ContinueLoadingDGO(buffer1, buffer2, Ptr<u8>((heap->current + 0x3f).offset & 0xffffffc0));
|
||||
}
|
||||
}
|
||||
sShowStallMsg = oldShowStall;
|
||||
|
||||
@@ -1460,7 +1460,7 @@ int InitHeapAndSymbol() {
|
||||
set_fixed_symbol(FIX_SYM_ASIZE_OF_BASIC_FUNC, "asize-of-basic-func",
|
||||
make_function_from_c((void*)asize_of_basic).offset);
|
||||
set_fixed_symbol(FIX_SYM_COPY_BASIC_FUNC, "asize-of-basic-func",
|
||||
make_function_from_c((void*)copy_basic).offset);
|
||||
make_function_from_c((void*)copy_basic, true).offset);
|
||||
set_fixed_symbol(FIX_SYM_DELETE_BASIC, "delete-basic",
|
||||
make_function_from_c((void*)delete_basic).offset);
|
||||
set_fixed_symbol(FIX_SYM_GLOBAL_HEAP, "global", kglobalheap.offset);
|
||||
@@ -1509,7 +1509,7 @@ int InitHeapAndSymbol() {
|
||||
set_fixed_type(FIX_SYM_BASIC, "basic", get_fixed_type_symbol(FIX_SYM_STRUCTURE),
|
||||
pack_type_flag(9, 0, 4), make_function_from_c((void*)print_basic).offset,
|
||||
make_function_from_c((void*)inspect_basic).offset);
|
||||
basic_type->new_method = make_function_from_c((void*)new_basic);
|
||||
basic_type->new_method = make_function_from_c((void*)new_basic, true);
|
||||
basic_type->delete_method = Ptr<Function>(u32_in_fixed_sym(FIX_SYM_DELETE_BASIC));
|
||||
basic_type->asize_of_method = Ptr<Function>(u32_in_fixed_sym(FIX_SYM_ASIZE_OF_BASIC_FUNC));
|
||||
basic_type->copy_method = Ptr<Function>(u32_in_fixed_sym(FIX_SYM_COPY_BASIC_FUNC));
|
||||
@@ -1636,7 +1636,7 @@ int InitHeapAndSymbol() {
|
||||
pack_type_flag(9, 0, 16), 0, 0);
|
||||
|
||||
Ptr<Type>(u32_in_fixed_sym(FIX_SYM_OBJECT_TYPE))->new_method =
|
||||
make_function_from_c((void*)alloc_heap_object);
|
||||
make_function_from_c((void*)alloc_heap_object, true);
|
||||
|
||||
make_function_symbol_from_c("string->symbol", (void*)intern);
|
||||
make_function_symbol_from_c("print", (void*)sprint);
|
||||
|
||||
Reference in New Issue
Block a user