synced portions of TRK lib with other decomps

This commit is contained in:
Yotona
2023-08-02 13:40:51 -06:00
parent f3f944c797
commit 473736fb6a
22 changed files with 335 additions and 451 deletions
@@ -3,6 +3,8 @@
#include "dolphin/types.h"
typedef int MessageBufferID;
typedef struct TRKBuffer {
u32 _00;
u32 _04;
@@ -1,19 +1,33 @@
#ifndef METROTRK_PORTABLE_NUBEVENT_H
#define METROTRK_PORTABLE_NUBEVENT_H
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf.h"
#include "dolphin/types.h"
typedef struct TRKEventQueue {
typedef u32 NubEventID;
typedef enum NubEventType {
NullEvent,
ShutdownEvent,
RequestEvent,
BreakpointEvent,
ExceptionEvent,
SupportEvent
} NubEventType;
typedef struct NubEvent {
NubEventType mType;
NubEventID mID;
MessageBufferID mMessageBufferID;
} NubEvent;
typedef struct EventQueue {
s32 _00;
s32 _04;
s32 _08;
s32 _0C;
s32 _10;
s32 _14;
s32 _18;
s32 _1C;
s32 _20;
u32 _24;
} TRKEventQueue;
s32 mCount;
s32 mFirst;
NubEvent mEventList[2];
NubEventID mEventID;
} EventQueue;
EventQueue gTRKEventQueue;
#endif /* METROTRK_PORTABLE_NUBEVENT_H */
@@ -1,8 +1,29 @@
#ifndef OS_DOLPHIN_DOLPHIN_TRK_GLUE_H
#define OS_DOLPHIN_DOLPHIN_TRK_GLUE_H
#include "dolphin/os/OS.h"
#include "dolphin/types.h"
typedef enum { HARDWARE_GDEV = 0, HARDWARE_DDH = 1, HARDWARE_BBA = 2 } HardwareType;
typedef int (*DBCommFunc)();
typedef int (*DBCommInitFunc)(void*, OSInterruptHandler);
typedef int (*DBCommReadFunc)(u8*, int);
typedef int (*DBCommWriteFunc)(const u8*, int);
typedef struct DBCommTable {
DBCommInitFunc initialize_func;
DBCommFunc initinterrupts_func;
DBCommFunc shutdown_func;
DBCommFunc peek_func;
DBCommReadFunc read_func;
DBCommWriteFunc write_func;
DBCommFunc open_func;
DBCommFunc close_func;
DBCommFunc pre_continue_func;
DBCommFunc post_stop_func;
} DBCommTable;
void UnreserveEXI2Port();
void ReserveEXI2Port();
s32 TRKWriteUARTN(const void*, u32);
+117 -12
View File
@@ -6,21 +6,126 @@
void TRKSwapAndGo();
void TRKTargetSetStopped(s32);
typedef struct Default_PPC {
u32 GPR[32];
u32 PC;
u32 LR;
u32 CR;
u32 CTR;
u32 XER;
} Default_PPC;
typedef struct Float_PPC {
u64 FPR[32];
u64 FPSCR;
u64 FPECR;
} Float_PPC;
typedef struct Extended1_PPC_6xx_7xx{
u32 SR[16];
u32 TBL;
u32 TBU;
u32 HID0;
u32 HID1;
u32 MSR;
u32 PVR;
u32 IBAT0U;
u32 IBAT0L;
u32 IBAT1U;
u32 IBAT1L;
u32 IBAT2U;
u32 IBAT2L;
u32 IBAT3U;
u32 IBAT3L;
u32 DBAT0U;
u32 DBAT0L;
u32 DBAT1U;
u32 DBAT1L;
u32 DBAT2U;
u32 DBAT2L;
u32 DBAT3U;
u32 DBAT3L;
u32 DMISS;
u32 DCMP;
u32 HASH1;
u32 HASH2;
u32 IMISS;
u32 ICMP;
u32 RPA;
u32 SDR1;
u32 DAR;
u32 DSISR;
u32 SPRG0;
u32 SPRG1;
u32 SPRG2;
u32 SPRG3;
u32 DEC;
u32 IABR;
u32 EAR;
u32 DABR;
u32 PMC1;
u32 PMC2;
u32 PMC3;
u32 PMC4;
u32 SIA;
u32 MMCR0;
u32 MMCR1;
u32 THRM1;
u32 THRM2;
u32 THRM3;
u32 ICTC;
u32 L2CR;
u32 UMMCR2;
u32 UBAMR;
u32 UMMCR0;
u32 UPMC1;
u32 UPMC2;
u32 USIA;
u32 UMMCR1;
u32 UPMC3;
u32 UPMC4;
u32 USDA;
u32 MMCR2;
u32 BAMR;
u32 SDA;
u32 MSSCR0;
u32 MSSCR1;
u32 PIR;
u32 exceptionID;
u32 GQR[8];
u32 HID_G;
u32 WPAR;
u32 DMA_U;
u32 DMA_L;
} Extended1_PPC_6xx_7xx;
typedef struct Extended2_PPC_6xx_7xx{
u32 PSR[32][2];
} Extended2_PPC_6xx_7xx;
typedef struct ProcessorState_PPC_6xx_7xx{
Default_PPC Default;
Float_PPC Float;
Extended1_PPC_6xx_7xx Extended1;
Extended2_PPC_6xx_7xx Extended2;
u32 transport_handler_saved_ra;
} ProcessorState_PPC_6xx_7xx;
typedef ProcessorState_PPC_6xx_7xx ProcessorState_PPC;
ProcessorState_PPC gTRKCPUState;
typedef struct TRKState {
/* 0x00 */ u32 field_0x00[35];
/* 0x8C */ u32 msr;
/* 0x90 */ u32 field_0x90[2];
/* 0x98 */ u32 target;
/* 0x9C */ u32 field_0x9C;
/* 0x00 */ u32 GPR[32];
/* 0x80 */ u32 LR;
/* 0x84 */ u32 CTR;
/* 0x88 */ u32 XER;
/* 0x8C */ u32 MSR;
/* 0x90 */ u32 DAR;
/* 0x94 */ u32 DSISR;
/* 0x98 */ u32 stopped;
/* 0x9C */ u32 inputActivated;
/* 0xA0 */ void* inputPendingPtr;
} TRKState;
TRKState gTRKState;
typedef struct TRKCPUState {
/* 0x00 */ u32 field_0x00[32];
/* 0x80 */ u32 pc;
/* 0x84 */ u32 field_0x84[235];
} TRKCPUState;
TRKCPUState gTRKCPUState;
#endif /* PPC_GENERIC_TARGIMPL_H */
@@ -4,18 +4,18 @@
#include "dolphin/types.h"
typedef struct CircleBuffer {
int field_0x0;
int field_0x4;
int field_0x8;
u8* field_0x0;
u8* field_0x4;
u8* field_0x8;
u32 field_0xc;
s32 readBuf;
u32 field_0x14;
u32 criticalSection;
s32 mBytesToRead;
u32 mBytesToWrite;
u32 mCriticalSection;
} CircleBuffer;
s32 CircleBufferReadBytes(CircleBuffer*, u32, u32);
s32 CircleBufferWriteBytes(CircleBuffer* buf, s32 param_2, u32 param_3);
void CircleBufferInitialize(CircleBuffer* buf, s32 param_2, s32 param_3);
s32 CBGetBytesAvailableForRead(CircleBuffer* buf);
s32 CircleBufferReadBytes(CircleBuffer*, u8*, u32);
s32 CircleBufferWriteBytes(CircleBuffer*, u8*, u32);
void CircleBufferInitialize(CircleBuffer*, u8*, s32);
s32 CBGetBytesAvailableForRead(CircleBuffer*);
#endif /* UTILS_COMMON_CIRCLEBUFFER_H */