mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-08-05 00:59:18 -04:00
prepare TRK and link mainloop.c
This commit is contained in:
@@ -352,6 +352,14 @@ DVDERR_CFLAGS = CFLAGS + [
|
||||
"-sdata2 0",
|
||||
"-pool off"
|
||||
] + DOL_DEFINES
|
||||
TRK_CFLAGS = [
|
||||
"-O4,p",
|
||||
"-sdata 0",
|
||||
"-fp hard",
|
||||
"-enum int",
|
||||
"-char unsigned",
|
||||
"-inline deferred"
|
||||
] + DOL_DEFINES
|
||||
BASE_REL_CFLAGS = CFLAGS + [
|
||||
"-sdata 0",
|
||||
f"-sdata2 {REL_SDATA2_SIZE}",
|
||||
@@ -403,6 +411,7 @@ DOL_CFLAGS = ' '.join(BASE_DOL_CFLAGS + LOCAL_CFLAGS)
|
||||
DOL_BOOT_CFLAGS = ' '.join(BOOT_CFLAGS + LOCAL_CFLAGS)
|
||||
DOL_DVDERR_CFLAGS = ' '.join(DVDERR_CFLAGS + LOCAL_CFLAGS)
|
||||
DOL_CFLAGS_SDATA0_CFLAGS = ' '.join(DOL_CFLAGS_NO_SDATA + LOCAL_CFLAGS)
|
||||
DOL_TRK_CFLAGS = ' '.join(TRK_CFLAGS + LOCAL_CFLAGS)
|
||||
SDK_FLAGS = ' '.join(SDK_CFLAG + LOCAL_CFLAGS)
|
||||
ALIGN16 = ' '.join(BASE_DOL_CFLAGS + LOCAL_CFLAGS + ALIGN16_CFLAG)
|
||||
DOL_CPPFLAGS = ' '.join(CPLFLAGS + BASE_DOL_CFLAGS + LOCAL_CFLAGS)
|
||||
|
||||
@@ -189,6 +189,8 @@ dolphin/os/OSRtc.c:
|
||||
MSL_C/rand.c:
|
||||
.text: [0x8009f46c, 0x8009f494]
|
||||
.sdata: [0x80218260, 0x80218268]
|
||||
TRK/mainloop.c:
|
||||
.text: [0x800A1FF4, 0x800A20EC]
|
||||
dolphin/odenotstub/odenotstub.c:
|
||||
.text: [0x800a9770, 0x800a9780]
|
||||
dolphin/amcstubs/AmcExi2Stubs.c:
|
||||
|
||||
@@ -647,6 +647,10 @@ class CSource(Source):
|
||||
self.cc = c.CC
|
||||
self.cflags = c.DOL_CPPFLAGS
|
||||
self.frank = False
|
||||
elif path == "src/TRK/mainloop.c":
|
||||
self.cc = c.CC
|
||||
self.cflags = c.DOL_TRK_CFLAGS
|
||||
self.frank = False
|
||||
else:
|
||||
self.cflags = ctx.cflags
|
||||
self.cc = c.CC
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef MEM_TRK_H
|
||||
#define MEM_TRK_H
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
void* TRK_memcpy(void* dst, const void* src, size_t size);
|
||||
void* TRK_memset(void* dst, int val, size_t size);
|
||||
void TRK_fill_mem(void*, int, size_t);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef TRK_DISPATCH
|
||||
#define TRK_DISPATCH
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#include "TRK/msgbuf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
TRKResult TRKDispatchMessage(MessageBuffer* mBuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -8,9 +8,7 @@ extern "C"{
|
||||
void InitMetroTRK(void);
|
||||
void exit(void);
|
||||
|
||||
void* TRK_memcpy(void* dst, const void* src, size_t size);
|
||||
void* TRK_memset(void* dst, int val, size_t size);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef TRK_MAINLOOP
|
||||
#define TRK_MAINLOOP
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
void TRKNubMainLoop(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef TRK_MSGBUF
|
||||
#define TRK_MSGBUF
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct MessageBuffer {
|
||||
int unk0;
|
||||
int unk4;
|
||||
int unk8;
|
||||
u32 unkC;
|
||||
u8 mBuffer[0x87C];
|
||||
} MessageBuffer;
|
||||
|
||||
MessageBuffer* TRKGetBuffer(int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef TRK_NUBEVENT
|
||||
#define TRK_NUBEVENT
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
BOOL TRKGetNextEvent(TRKEvent*);
|
||||
void TRKDestructEvent(TRKEvent*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef TRK_SERPOLL
|
||||
#define TRK_SERPOLL
|
||||
#include "types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void TRKGetInput();
|
||||
|
||||
extern u8* gTRKInputPendingPtr;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef TRK_TARGIMPL
|
||||
#define TRK_TARGIMPL
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void TRKTargeInterrupt(TRKEvent*);
|
||||
void TRKTargetSupportRequest();
|
||||
BOOL TRKTargetStopped();
|
||||
void TRKTargetContinue();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef TRK_H
|
||||
#define TRK_H
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
TRKSuccess = 0,
|
||||
TRKError100 = 0x100,
|
||||
TRKError301 = 0x301,
|
||||
TRKError302 = 0x302,
|
||||
TRKError500 = 0x500
|
||||
}TRKResult;
|
||||
|
||||
typedef struct TRKEvent{
|
||||
u8 mEventType;
|
||||
int mMax;
|
||||
int mBufferIndex;
|
||||
}TRKEvent;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "types.h"
|
||||
#include "TRK/_mem_trk.h"
|
||||
|
||||
__declspec(section ".init") asm void __TRK_reset(void){
|
||||
nofralloc
|
||||
@@ -73,4 +73,4 @@ lbl_80005548:
|
||||
/* 80005560 7C0803A6 */ mtlr r0
|
||||
/* 80005564 38210020 */ addi r1, r1, 0x20
|
||||
/* 80005568 4E800020 */ blr
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#include "TRK/mainloop.h"
|
||||
#include "TRK/nubevent.h"
|
||||
#include "TRK/dispatch.h"
|
||||
#include "TRK/targimpl.h"
|
||||
#include "TRK/serpoll.h"
|
||||
|
||||
void TRKNubMainLoop(void){
|
||||
|
||||
MessageBuffer* msg;
|
||||
TRKEvent event;
|
||||
BOOL loop = FALSE;
|
||||
BOOL statInput = FALSE;
|
||||
|
||||
while(loop == FALSE){
|
||||
if(TRKGetNextEvent(&event) != FALSE){
|
||||
statInput = FALSE;
|
||||
switch(event.mEventType){
|
||||
case 0:
|
||||
break;
|
||||
case 2:
|
||||
msg = TRKGetBuffer(event.mBufferIndex);
|
||||
TRKDispatchMessage(msg);
|
||||
break;
|
||||
case 1:
|
||||
loop = TRUE;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
TRKTargetInterrupt(&event);
|
||||
break;
|
||||
case 5:
|
||||
TRKTargetSupportRequest();
|
||||
break;
|
||||
}
|
||||
TRKDestructEvent(&event);
|
||||
}
|
||||
else if((statInput == FALSE) || ((u8)*gTRKInputPendingPtr != 0)){
|
||||
statInput = TRUE;
|
||||
TRKGetInput();
|
||||
}
|
||||
else{
|
||||
if(TRKTargetStopped() == FALSE){
|
||||
TRKTargetContinue();
|
||||
}
|
||||
statInput = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "TRK/dolphin_trk.h"
|
||||
#include "TRK/_mem_trk.h"
|
||||
|
||||
__declspec(section ".init") void* TRK_memset(void* dst, int val, size_t size){
|
||||
TRK_fill_mem(dst, val, size);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dolphin/os.h"
|
||||
#include "dolphin/db.h"
|
||||
#include "TRK/dolphin_trk.h"
|
||||
#include "TRK/trk.h"
|
||||
#include "dolphin/os/__ppc_eabi_init.h"
|
||||
|
||||
__declspec(section ".init")void __init_registers(void);
|
||||
|
||||
Reference in New Issue
Block a user