mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-06-04 02:16:06 -04:00
31 lines
1013 B
C
31 lines
1013 B
C
#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;
|
|
} |