mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-06-29 01:30:53 -04:00
implement dispatch.c
This commit is contained in:
@@ -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