most of TRK done / some misc work (#2030)

* work on d_file_sel_warning

* various cleanup

* attempt to fix d_gameover

* event cleanup

* trk work

* most of TRK done

* remove asm
This commit is contained in:
TakaRikka
2024-01-12 18:43:52 -08:00
committed by GitHub
parent f342bd7171
commit 4bd825e76c
123 changed files with 2831 additions and 6643 deletions
@@ -1,6 +1,11 @@
#ifndef METROTRK_PORTABLE_DISPATCH_H
#define METROTRK_PORTABLE_DISPATCH_H
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define TRK_DISPATCH_CMD_CONNECT 1 /* Connect to the console */
#define TRK_DISPATCH_CMD_DISCONNECT 2 /* Disconnect from the console */
@@ -17,4 +22,12 @@
#define TRK_DISPATCH_CMD_STEP 25 /* Step through an instruction */
#define TRK_DISPATCH_CMD_STOP 26 /* Stop the debugger */
typedef struct TRKBuffer TRKBuffer;
BOOL TRKDispatchMessage(TRKBuffer* buffer);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_DISPATCH_H */
@@ -3,17 +3,36 @@
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int MessageBufferID;
#define TRKMSGBUF_SIZE (0x800 + 0x80)
typedef struct TRKBuffer {
/* 0x00 */ u32 _00;
/* 0x04 */ BOOL isInUse;
/* 0x08 */ u32 length;
/* 0x0C */ u32 position;
/* 0x10 */ u8 data[TRKMSGBUF_SIZE];
} TRKBuffer;
/* typedef struct TRKBuffer {
u32 _00;
u32 _04;
s32 _08;
u32 _0C;
u32 _10;
u8 m_buffer[0x87C];
} TRKBuffer;
} TRKBuffer; */
s32 TRKSetBufferPosition(TRKBuffer*, u32);
void* TRKGetBuffer(int);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_MSGBUF_H */
@@ -2,22 +2,23 @@
#define METROTRK_PORTABLE_MSGHNDLR_H
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf.h"
#include "trk.h"
void SetTRKConnected(BOOL);
BOOL GetTRKConnected(void);
s32 TRKDoSetOption(TRKBuffer*);
s32 TRKDoStop(TRKBuffer*);
s32 TRKDoStep(TRKBuffer*);
s32 TRKDoContinue(TRKBuffer*);
s32 TRKDoWriteRegisters(TRKBuffer*);
s32 TRKDoReadRegisters(TRKBuffer*);
s32 TRKDoWriteMemory(TRKBuffer*);
s32 TRKDoReadMemory(TRKBuffer*);
s32 TRKDoSupportMask(TRKBuffer*);
s32 TRKDoVersions(TRKBuffer*);
s32 TRKDoOverride(TRKBuffer*);
s32 TRKDoReset(TRKBuffer*);
s32 TRKDoDisconnect(TRKBuffer*);
s32 TRKDoConnect(TRKBuffer*);
DSError TRKDoSetOption(TRKBuffer*);
DSError TRKDoStop(TRKBuffer*);
DSError TRKDoStep(TRKBuffer*);
DSError TRKDoContinue(TRKBuffer*);
DSError TRKDoWriteRegisters(TRKBuffer*);
DSError TRKDoReadRegisters(TRKBuffer*);
DSError TRKDoWriteMemory(TRKBuffer*);
DSError TRKDoReadMemory(TRKBuffer*);
DSError TRKDoSupportMask(TRKBuffer*);
DSError TRKDoVersions(TRKBuffer*);
DSError TRKDoOverride(TRKBuffer*);
DSError TRKDoReset(TRKBuffer*);
DSError TRKDoDisconnect(TRKBuffer*);
DSError TRKDoConnect(TRKBuffer*);
#endif /* METROTRK_PORTABLE_MSGHNDLR_H */
@@ -1,32 +1,38 @@
#ifndef METROTRK_PORTABLE_NUBEVENT_H
#define METROTRK_PORTABLE_NUBEVENT_H
#include "trk.h"
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/msgbuf.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef u32 NubEventID;
typedef enum NubEventType {
NullEvent,
ShutdownEvent,
RequestEvent,
BreakpointEvent,
ExceptionEvent,
SupportEvent
} NubEventType;
typedef struct TRKEvent {
NubEventType eventType;
NubEventID eventID;
MessageBufferID msgBufID;
} TRKEvent;
typedef struct NubEvent {
NubEventType mType;
NubEventID mID;
MessageBufferID mMessageBufferID;
} NubEvent;
typedef struct TRKEventQueue {
int _00;
int count;
int next;
TRKEvent events[2];
NubEventID eventID;
} TRKEventQueue;
extern TRKEventQueue gTRKEventQueue;
typedef struct EventQueue {
s32 _00;
s32 mCount;
s32 mFirst;
NubEvent mEventList[2];
NubEventID mEventID;
} EventQueue;
EventQueue gTRKEventQueue;
BOOL TRKGetNextEvent(TRKEvent* event);
void TRKDestructEvent(TRKEvent*);
void TRKConstructEvent(TRKEvent*, NubEventType);
DSError TRKPostEvent(TRKEvent*);
DSError TRKInitializeEventQueue();
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_NUBEVENT_H */
@@ -2,9 +2,21 @@
#define METROTRK_PORTABLE_NUBINIT_H
#include "dolphin/types.h"
#include "trk.h"
#ifdef __cplusplus
extern "C" {
#endif
void TRKNubWelcome(void);
s32 TRKTerminateNub(void);
s32 TRKInitializeNub(void);
void TRKNubMainLoop(void);
DSError TRKTerminateNub(void);
DSError TRKInitializeNub(void);
extern BOOL gTRKBigEndian;
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_NUBINIT_H */
@@ -3,4 +3,16 @@
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
void TRKGetInput(void);
extern void* gTRKInputPendingPtr;
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_SERPOLL_H */
@@ -1,5 +1,19 @@
#ifndef METROTRK_PORTABLE_SUPPORT_H
#define METROTRK_PORTABLE_SUPPORT_H
#include "dolphin/types.h"
#include "trk.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct TRKBuffer TRKBuffer;
DSError TRKRequestSend(TRKBuffer* msgBuf, int* bufferId, u32 p1, u32 p2, int p3);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_SUPPORT_H */
@@ -2,8 +2,7 @@
#define OS_DOLPHIN_DOLPHIN_TRK_GLUE_H
#include "dolphin/os/OS.h"
typedef enum { HARDWARE_GDEV = 0, HARDWARE_DDH = 1, HARDWARE_BBA = 2 } HardwareType;
#include "trk.h"
typedef int (*DBCommFunc)();
typedef int (*DBCommInitFunc)(void*, OSInterruptHandler);
@@ -1,5 +1,16 @@
#ifndef OS_DOLPHIN_TARGCONT_H
#define OS_DOLPHIN_TARGCONT_H
#include "trk.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRKTargetContinue(void);
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_TARGCONT_H */
@@ -3,7 +3,15 @@
#include "dolphin/types.h"
u8 GetUseSerialIO();
#ifdef __cplusplus
extern "C" {
#endif
u8 GetUseSerialIO(void);
void SetUseSerialIO(u8);
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_TARGET_OPTIONS_H */
@@ -1,5 +1,19 @@
#ifndef PPC_EXPORT_TARGSUPP_H
#define PPC_EXPORT_TARGSUPP_H
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
u32 TRKAccessFile(u32, u32, u32*, u8*);
u32 TRKOpenFile(u32, u32, u32*, u8*);
u32 TRKCloseFile(u32, u32);
u32 TRKPositionFile(u32, u32, u32*, u8*);
#ifdef __cplusplus
}
#endif
#endif /* PPC_EXPORT_TARGSUPP_H */
+100 -87
View File
@@ -1,10 +1,19 @@
#ifndef PPC_GENERIC_TARGIMPL_H
#define PPC_GENERIC_TARGIMPL_H
#include "dolphin/types.h"
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/nubevent.h"
#include "trk.h"
#ifdef __cplusplus
extern "C" {
#endif
void TRKSwapAndGo();
void TRKTargetSetStopped(s32);
DSError TRKTargetInterrupt(TRKEvent*);
DSError TRKTargetSupportRequest();
void TRKDestructEvent(TRKEvent*);
BOOL TRKTargetStopped(void);
typedef struct Default_PPC {
u32 GPR[32];
@@ -21,98 +30,98 @@ typedef struct Float_PPC {
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;
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];
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;
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;
extern ProcessorState_PPC gTRKCPUState;
typedef struct TRKState {
/* 0x00 */ u32 GPR[32];
@@ -126,6 +135,10 @@ typedef struct TRKState {
/* 0x9C */ u32 inputActivated;
/* 0xA0 */ void* inputPendingPtr;
} TRKState;
TRKState gTRKState;
extern TRKState gTRKState;
#ifdef __cplusplus
}
#endif
#endif /* PPC_GENERIC_TARGIMPL_H */
@@ -3,19 +3,27 @@
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct CircleBuffer {
u8* field_0x0;
u8* field_0x4;
u8* field_0x8;
u32 field_0xc;
u8* read_ptr;
u8* write_ptr;
u8* start_ptr;
u32 size;
s32 mBytesToRead;
u32 mBytesToWrite;
u32 mCriticalSection;
} CircleBuffer;
s32 CircleBufferReadBytes(CircleBuffer*, u8*, u32);
s32 CircleBufferWriteBytes(CircleBuffer*, u8*, u32);
int CircleBufferReadBytes(CircleBuffer*, u8*, u32);
int CircleBufferWriteBytes(CircleBuffer*, u8*, u32);
void CircleBufferInitialize(CircleBuffer*, u8*, s32);
s32 CBGetBytesAvailableForRead(CircleBuffer*);
u32 CBGetBytesAvailableForRead(CircleBuffer*);
#ifdef __cplusplus
}
#endif
#endif /* UTILS_COMMON_CIRCLEBUFFER_H */
@@ -3,8 +3,16 @@
#include "dolphin/types.h"
void MWExitCriticalSection(u32* section);
void MWEnterCriticalSection(u32* section);
void MWInitializeCriticalSection();
#ifdef __cplusplus
extern "C" {
#endif
void MWExitCriticalSection(unsigned int* section);
void MWEnterCriticalSection(unsigned int* section);
void MWInitializeCriticalSection(unsigned int*);
#ifdef __cplusplus
}
#endif
#endif /* UTILS_GC_MWCRITICALSECTION_GC_H */