mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
implement dispatch.c
This commit is contained in:
@@ -194,10 +194,14 @@ TRK/mainloop.c:
|
||||
TRK/nubevent.c:
|
||||
.text: [0x800A20EC, 0x800A2314]
|
||||
.bss: [0x802095C8, 0x802095F0]
|
||||
#TRK/nubinit.c: #breaks .init and .text
|
||||
#TRK/nubinit.c: #things break, fix later
|
||||
# .text: [0x800A2314, 0x800A2494]
|
||||
# .rodata: [0x800AF750, 0x800AF770]
|
||||
# .bss: [0x802095F0, 0x802095F8]
|
||||
#TRK/dispatch.c:
|
||||
# .text: [0x800A34F4, 0x800A3590]
|
||||
# .data: [0x800E2128, 0x800E21B0]
|
||||
# .bss: [0x8020AFC0, 0x8020AFC8]
|
||||
dolphin/odenotstub/odenotstub.c:
|
||||
.text: [0x800a9770, 0x800a9780]
|
||||
dolphin/amcstubs/AmcExi2Stubs.c:
|
||||
|
||||
+1
-1
@@ -647,7 +647,7 @@ class CSource(Source):
|
||||
self.cc = c.CC
|
||||
self.cflags = c.DOL_CPPFLAGS
|
||||
self.frank = False
|
||||
elif path == "src/TRK/mainloop.c" or path == "src/TRK/nubevent.c" or path == "src/TRK/nubinit.c":
|
||||
elif path == "src/TRK/mainloop.c" or path == "src/TRK/nubevent.c" or path == "src/TRK/nubinit.c" or path == "src/TRK/dispatch.c":
|
||||
self.cc = c.CC
|
||||
self.cflags = c.DOL_TRK_CFLAGS
|
||||
self.frank = False
|
||||
|
||||
@@ -17,6 +17,8 @@ typedef struct MessageBuffer {
|
||||
MessageBuffer* TRKGetBuffer(int);
|
||||
void TRKReleaseBuffer(int);
|
||||
TRKResult TRKInitializeMessageBuffers();
|
||||
void TRKSetBufferPosition(MessageBuffer*, u32);
|
||||
void TRKReadBuffer1_ui8(MessageBuffer*, u8*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef TRK_MSGHNDLR
|
||||
#define TRK_MSGHNDLR
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#include "TRK/msgbuf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
TRKResult TRKDoUnsupported(MessageBuffer*);
|
||||
TRKResult TRKDoConnect(MessageBuffer*);
|
||||
TRKResult TRKDoDisconnect(MessageBuffer*);
|
||||
TRKResult TRKDoReset(MessageBuffer*);
|
||||
TRKResult TRKDoVersions(MessageBuffer*);
|
||||
TRKResult TRKDoSupportMask(MessageBuffer*);
|
||||
TRKResult TRKDoCPUType(MessageBuffer*);
|
||||
TRKResult TRKDoReadMemory(MessageBuffer*);
|
||||
TRKResult TRKDoWriteMemory(MessageBuffer*);
|
||||
TRKResult TRKDoReadRegisters(MessageBuffer*);
|
||||
TRKResult TRKDoWriteRegisters(MessageBuffer*);
|
||||
TRKResult TRKDoFlushCache(MessageBuffer*);
|
||||
TRKResult TRKDoSetOption(MessageBuffer*);
|
||||
TRKResult TRKDoContinue(MessageBuffer*);
|
||||
TRKResult TRKDoStep(MessageBuffer*);
|
||||
TRKResult TRKDoStop(MessageBuffer*);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "TRK/dispatch.h"
|
||||
#include "TRK/msghndlr.h"
|
||||
|
||||
u32 gTRKDispatchTableSize;
|
||||
|
||||
TRKResult (*gTRKDispatchTable[])(MessageBuffer*) = {&TRKDoUnsupported, &TRKDoConnect, &TRKDoDisconnect,
|
||||
&TRKDoReset, &TRKDoVersions, &TRKDoSupportMask, &TRKDoCPUType, &TRKDoUnsupported,&TRKDoUnsupported,
|
||||
&TRKDoUnsupported,&TRKDoUnsupported,&TRKDoUnsupported,&TRKDoUnsupported,&TRKDoUnsupported,
|
||||
&TRKDoUnsupported,&TRKDoUnsupported, &TRKDoReadMemory, &TRKDoWriteMemory, &TRKDoReadRegisters,
|
||||
&TRKDoWriteRegisters, &TRKDoUnsupported,&TRKDoUnsupported, &TRKDoFlushCache, &TRKDoSetOption,
|
||||
&TRKDoContinue, &TRKDoStep, &TRKDoStop};
|
||||
|
||||
TRKResult TRKInitializeDispatcher(){
|
||||
gTRKDispatchTableSize = 32;
|
||||
return TRKSuccess;
|
||||
}
|
||||
|
||||
TRKResult TRKDispatchMessage(MessageBuffer* mbuf){
|
||||
|
||||
u8 buf;
|
||||
s16 val;
|
||||
TRKResult res = TRKError500;
|
||||
|
||||
TRKSetBufferPosition(mbuf, 0);
|
||||
TRKReadBuffer1_ui8(mbuf, &buf);
|
||||
val = buf;
|
||||
if ((val & 0xFF) < gTRKDispatchTableSize){
|
||||
res = gTRKDispatchTable[buf](mbuf);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
Reference in New Issue
Block a user