diff --git a/Source/RSP/Cpu.c b/Source/RSP/Cpu.c index 5d09ce355..b7a92ffad 100644 --- a/Source/RSP/Cpu.c +++ b/Source/RSP/Cpu.c @@ -43,14 +43,14 @@ UDWORD EleSpec[32], Indx[32]; OPCODE RSPOpC; DWORD *PrgCount, NextInstruction, RSP_Running, RSP_MfStatusCount; -void * RSP_Opcode[64]; -void * RSP_RegImm[32]; -void * RSP_Special[64]; -void * RSP_Cop0[32]; -void * RSP_Cop2[32]; -void * RSP_Vector[64]; -void * RSP_Lc2[32]; -void * RSP_Sc2[32]; +p_func RSP_Opcode[64]; +p_func RSP_RegImm[32]; +p_func RSP_Special[64]; +p_func RSP_Cop0[32]; +p_func RSP_Cop2[32]; +p_func RSP_Vector[64]; +p_func RSP_Lc2[32]; +p_func RSP_Sc2[32]; void BuildInterpreterCPU(void); void BuildRecompilerCPU(void); diff --git a/Source/RSP/Cpu.h b/Source/RSP/Cpu.h index 8c345d225..4159e8f89 100644 --- a/Source/RSP/Cpu.h +++ b/Source/RSP/Cpu.h @@ -28,14 +28,14 @@ extern UDWORD EleSpec[32], Indx[32]; -extern void * RSP_Opcode[64]; -extern void * RSP_RegImm[32]; -extern void * RSP_Special[64]; -extern void * RSP_Cop0[32]; -extern void * RSP_Cop2[32]; -extern void * RSP_Vector[64]; -extern void * RSP_Lc2[32]; -extern void * RSP_Sc2[32]; +extern p_func RSP_Opcode[64]; +extern p_func RSP_RegImm[32]; +extern p_func RSP_Special[64]; +extern p_func RSP_Cop0[32]; +extern p_func RSP_Cop2[32]; +extern p_func RSP_Vector[64]; +extern p_func RSP_Lc2[32]; +extern p_func RSP_Sc2[32]; extern DWORD * PrgCount, RSP_Running; extern OPCODE RSPOpC; diff --git a/Source/RSP/Interpreter CPU.c b/Source/RSP/Interpreter CPU.c index bc5d7c74b..b8647093d 100644 --- a/Source/RSP/Interpreter CPU.c +++ b/Source/RSP/Interpreter CPU.c @@ -443,7 +443,7 @@ DWORD RunInterpreterCPU(DWORD Cycles) { RDP_LogLoc(*PrgCount); RSP_LW_IMEM(*PrgCount, &RSPOpC.Hex); - ((void (*)()) RSP_Opcode[ RSPOpC.op ])(); + RSP_Opcode[ RSPOpC.op ](); switch (RSP_NextInstruction) { case NORMAL: diff --git a/Source/RSP/Interpreter Ops.c b/Source/RSP/Interpreter Ops.c index d5837f555..0cd7738b2 100644 --- a/Source/RSP/Interpreter Ops.c +++ b/Source/RSP/Interpreter Ops.c @@ -43,11 +43,11 @@ extern BOOL AudioHle, GraphicsHle; /************************* OpCode functions *************************/ void RSP_Opcode_SPECIAL ( void ) { - ((void (*)()) RSP_Special[ RSPOpC.funct ])(); + RSP_Special[ RSPOpC.funct ](); } void RSP_Opcode_REGIMM ( void ) { - ((void (*)()) RSP_RegImm[ RSPOpC.rt ])(); + RSP_RegImm[ RSPOpC.rt ](); } void RSP_Opcode_J ( void ) { @@ -152,11 +152,11 @@ void RSP_Opcode_LUI (void) { } void RSP_Opcode_COP0 (void) { - ((void (*)()) RSP_Cop0[ RSPOpC.rs ])(); + RSP_Cop0[ RSPOpC.rs ](); } void RSP_Opcode_COP2 (void) { - ((void (*)()) RSP_Cop2[ RSPOpC.rs ])(); + RSP_Cop2[ RSPOpC.rs ](); } void RSP_Opcode_LB ( void ) { @@ -204,11 +204,11 @@ void RSP_Opcode_SW ( void ) { } void RSP_Opcode_LC2 (void) { - ((void (*)()) RSP_Lc2 [ RSPOpC.rd ])(); + RSP_Lc2 [ RSPOpC.rd ](); } void RSP_Opcode_SC2 (void) { - ((void (*)()) RSP_Sc2 [ RSPOpC.rd ])(); + RSP_Sc2 [ RSPOpC.rd ](); } /********************** R4300i OpCodes: Special **********************/ void RSP_Special_SLL ( void ) { @@ -527,7 +527,7 @@ void RSP_Cop2_CT (void) { } void RSP_COP2_VECTOR (void) { - ((void (*)()) RSP_Vector[ RSPOpC.funct ])(); + RSP_Vector[ RSPOpC.funct ](); } /************************** Vect functions **************************/ void RSP_Vector_VMULF (void) { diff --git a/Source/RSP/Recompiler CPU.c b/Source/RSP/Recompiler CPU.c index a8e7271e7..82d8feae5 100644 --- a/Source/RSP/Recompiler CPU.c +++ b/Source/RSP/Recompiler CPU.c @@ -835,7 +835,7 @@ void CompilerRSPBlock ( void ) { /* i think this pops up an unknown op dialog */ /* NextInstruction = FINISH_BLOCK; */ } else { - ((void (*)()) RSP_Opcode[ RSPOpC.op ])(); + RSP_Opcode[ RSPOpC.op ](); } switch (NextInstruction) { diff --git a/Source/RSP/Recompiler Ops.c b/Source/RSP/Recompiler Ops.c index fbdc4bfec..3c39c5875 100644 --- a/Source/RSP/Recompiler Ops.c +++ b/Source/RSP/Recompiler Ops.c @@ -118,13 +118,13 @@ void Branch_AddRef(DWORD Target, DWORD * X86Loc) { } } -void Cheat_r4300iOpcode ( void * FunctAddress, char * FunctName) { +void Cheat_r4300iOpcode(p_func FunctAddress, char * FunctName) { CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC)); MoveConstToVariable(RSPOpC.Hex, &RSPOpC.Hex, "RSPOpC.Hex" ); Call_Direct(FunctAddress, FunctName); } -void Cheat_r4300iOpcodeNoMessage( void * FunctAddress, char * FunctName) { +void Cheat_r4300iOpcodeNoMessage(p_func FunctAddress, char * FunctName) { MoveConstToVariable(RSPOpC.Hex, &RSPOpC.Hex, "RSPOpC.Hex" ); Call_Direct(FunctAddress, FunctName); } @@ -168,11 +168,11 @@ void CompileBranchExit(DWORD TargetPC, DWORD ContinuePC) /************************* OpCode functions *************************/ void Compile_SPECIAL ( void ) { - ((void (*)()) RSP_Special[ RSPOpC.funct ])(); + RSP_Special[ RSPOpC.funct ](); } void Compile_REGIMM ( void ) { - ((void (*)()) RSP_RegImm[ RSPOpC.rt ])(); + RSP_RegImm[ RSPOpC.rt ](); } void Compile_J ( void ) { @@ -572,11 +572,11 @@ void Compile_LUI ( void ) { } void Compile_COP0 (void) { - ((void (*)()) RSP_Cop0[ RSPOpC.rs ])(); + RSP_Cop0[ RSPOpC.rs ](); } void Compile_COP2 (void) { - ((void (*)()) RSP_Cop2[ RSPOpC.rs ])(); + RSP_Cop2[ RSPOpC.rs ](); } void Compile_LB ( void ) { @@ -948,11 +948,11 @@ void Compile_SW ( void ) { } void Compile_LC2 (void) { - ((void (*)()) RSP_Lc2 [ RSPOpC.rd ])(); + RSP_Lc2 [ RSPOpC.rd ](); } void Compile_SC2 (void) { - ((void (*)()) RSP_Sc2 [ RSPOpC.rd ])(); + RSP_Sc2 [ RSPOpC.rd ](); } /********************** R4300i OpCodes: Special **********************/ @@ -1789,7 +1789,7 @@ void Compile_Cop2_CT ( void ) { } void Compile_COP2_VECTOR (void) { - ((void (*)()) RSP_Vector[ RSPOpC.funct ])(); + RSP_Vector[ RSPOpC.funct ](); } /************************** Vect functions **************************/ diff --git a/Source/RSP/Types.h b/Source/RSP/Types.h index bb38baee3..12862d845 100644 --- a/Source/RSP/Types.h +++ b/Source/RSP/Types.h @@ -27,6 +27,12 @@ #ifndef __Types_h #define __Types_h +/* + * pointer to RSP operation code functions or "func" + * This is the type of all RSP interpreter and recompiler functions. + */ +typedef void(*p_func)(void); + typedef union tagUWORD { long W; float F;