diff --git a/common/include/PS2Edefs.h b/common/include/PS2Edefs.h index 89478d89ec..8e8b0b69d1 100644 --- a/common/include/PS2Edefs.h +++ b/common/include/PS2Edefs.h @@ -618,7 +618,7 @@ typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); typedef s32 (CALLBACK* _CDVDreadSector)(u8* buffer, u32 lsn, int mode); typedef s32 (CALLBACK* _CDVDgetDualInfo)(s32* dualType, u32* _layer1start); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (CALLBACK* callback)()); +typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); // DEV9 diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index fb7ea20adc..1d928674ab 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -514,7 +514,7 @@ void cdvdDetectDisk() } } -void CALLBACK cdvdNewDiskCB() +void cdvdNewDiskCB() { DoCDVDresetDiskTypeCache(); diff --git a/pcsx2/CDVD/CDVD.h b/pcsx2/CDVD/CDVD.h index 1570486d93..90e0d605fb 100644 --- a/pcsx2/CDVD/CDVD.h +++ b/pcsx2/CDVD/CDVD.h @@ -138,6 +138,6 @@ extern void cdvdReadInterrupt(); // We really should not have a function with the exact same name as a callback except for case! extern void cdvdDetectDisk(); -extern void CALLBACK cdvdNewDiskCB(); +extern void cdvdNewDiskCB(); extern u8 cdvdRead(u8 key); extern void cdvdWrite(u8 key, u8 rt); diff --git a/pcsx2/CDVD/CDVDisoReader.cpp b/pcsx2/CDVD/CDVDisoReader.cpp index bcd2cb2a5c..4220f4ed96 100644 --- a/pcsx2/CDVD/CDVDisoReader.cpp +++ b/pcsx2/CDVD/CDVDisoReader.cpp @@ -396,7 +396,7 @@ s32 CALLBACK ISOdummyS32() return 0; } -void CALLBACK ISOnewDiskCB(void(CALLBACK*)()) +void CALLBACK ISOnewDiskCB(__unused void(*callback)()) { } diff --git a/pcsx2/VU.h b/pcsx2/VU.h index d570c17d81..42c1f75790 100644 --- a/pcsx2/VU.h +++ b/pcsx2/VU.h @@ -180,16 +180,5 @@ PCSX2_ALIGNED16_EXTERN(VURegs VU0); #define VU1 (*g_pVU1) +extern u32* GET_VU_MEM(VURegs* VU, u32 addr); -#ifdef _WIN32 -extern __forceinline u32* GET_VU_MEM(VURegs* VU, u32 addr) -#else -static __forceinline u32* GET_VU_MEM(VURegs* VU, u32 addr) -#endif -{ - if( VU == g_pVU1 ) return (u32*)(VU1.Mem+(addr&0x3fff)); - - if( addr >= 0x4000 ) return (u32*)(VU0.Mem+(addr&0x43f0)); // get VF and VI regs (they're mapped to 0x4xx0 in VU0 mem!) - - return (u32*)(VU0.Mem+(addr&0x0fff)); // for addr 0x0000 to 0x4000 just wrap around -} diff --git a/pcsx2/VUflags.cpp b/pcsx2/VUflags.cpp index 0336eea4c1..270df38c9a 100644 --- a/pcsx2/VUflags.cpp +++ b/pcsx2/VUflags.cpp @@ -13,7 +13,6 @@ * If not, see . */ - #include "PrecompiledHeader.h" #include @@ -26,7 +25,7 @@ /*****************************************/ -__inline void vuUpdateDI(VURegs * VU) { +void vuUpdateDI(VURegs * VU) { // u32 Flag_S = 0; // u32 Flag_I = 0; // u32 Flag_D = 0; @@ -41,7 +40,7 @@ __inline void vuUpdateDI(VURegs * VU) { // VU->statusflag|= (Flag_D | (VU0.VI[REG_STATUS_FLAG].US[0] >> 5)) << 11; } -__forceinline u32 VU_MAC_UPDATE( int shift, VURegs * VU, float f) +static __releaseinline u32 VU_MAC_UPDATE( int shift, VURegs * VU, float f ) { u32 v = *(u32*)&f; int exp = (v >> 23) & 0xff; @@ -112,7 +111,7 @@ __forceinline void VU_MACw_CLEAR(VURegs * VU) VU->macflag&= ~(0x1111<<0); } -void VU_STAT_UPDATE(VURegs * VU) { +__releaseinline void VU_STAT_UPDATE(VURegs * VU) { int newflag = 0 ; if (VU->macflag & 0x000F) newflag = 0x1; if (VU->macflag & 0x00F0) newflag |= 0x2; diff --git a/pcsx2/VUflags.h b/pcsx2/VUflags.h index 0fa8191bcd..f12664b194 100644 --- a/pcsx2/VUflags.h +++ b/pcsx2/VUflags.h @@ -16,15 +16,12 @@ #pragma once #include "VU.h" -void vuUpdateDI(VURegs * VU); -__forceinline u32 VU_MAC_UPDATE( int shift, VURegs * VU, float f); -__forceinline u32 VU_MACx_UPDATE(VURegs * VU, float x); -__forceinline u32 VU_MACy_UPDATE(VURegs * VU, float y); -__forceinline u32 VU_MACz_UPDATE(VURegs * VU, float z); -__forceinline u32 VU_MACw_UPDATE(VURegs * VU, float w); -__forceinline void VU_MACx_CLEAR(VURegs * VU); -__forceinline void VU_MACy_CLEAR(VURegs * VU); -__forceinline void VU_MACz_CLEAR(VURegs * VU); -__forceinline void VU_MACw_CLEAR(VURegs * VU); -void VU_STAT_UPDATE(VURegs * VU); - +extern u32 VU_MACx_UPDATE(VURegs * VU, float x); +extern u32 VU_MACy_UPDATE(VURegs * VU, float y); +extern u32 VU_MACz_UPDATE(VURegs * VU, float z); +extern u32 VU_MACw_UPDATE(VURegs * VU, float w); +extern void VU_MACx_CLEAR(VURegs * VU); +extern void VU_MACy_CLEAR(VURegs * VU); +extern void VU_MACz_CLEAR(VURegs * VU); +extern void VU_MACw_CLEAR(VURegs * VU); +extern void VU_STAT_UPDATE(VURegs * VU); diff --git a/pcsx2/VUops.cpp b/pcsx2/VUops.cpp index aaf742cc0c..c5523b69ec 100644 --- a/pcsx2/VUops.cpp +++ b/pcsx2/VUops.cpp @@ -13,7 +13,6 @@ * If not, see . */ - #include "PrecompiledHeader.h" #include @@ -46,9 +45,9 @@ #define _UImm11_ (s32)(VU->code & 0x7ff) -VECTOR RDzero; +static PCSX2_ALIGNED16( VECTOR RDzero ); -void _vuFMACflush(VURegs * VU) { +static __releaseinline void __fastcall _vuFMACflush(VURegs * VU) { int i; for (i=0; i<8; i++) { @@ -65,7 +64,7 @@ void _vuFMACflush(VURegs * VU) { } } -void _vuFDIVflush(VURegs * VU) { +static __releaseinline void __fastcall _vuFDIVflush(VURegs * VU) { if (VU->fdiv.enable == 0) return; if ((VU->cycle - VU->fdiv.sCycle) >= VU->fdiv.Cycle) { @@ -77,7 +76,7 @@ void _vuFDIVflush(VURegs * VU) { } } -void _vuEFUflush(VURegs * VU) { +static __releaseinline void __fastcall _vuEFUflush(VURegs * VU) { if (VU->efu.enable == 0) return; if ((VU->cycle - VU->efu.sCycle) >= VU->efu.Cycle) { @@ -143,13 +142,13 @@ void _vuFlushAll(VURegs* VU) } while(nRepeat); } -void _vuTestPipes(VURegs * VU) { +__forceinline void _vuTestPipes(VURegs * VU) { _vuFMACflush(VU); _vuFDIVflush(VU); _vuEFUflush(VU); } -void _vuFMACTestStall(VURegs * VU, int reg, int xyzw) { +static void __fastcall _vuFMACTestStall(VURegs * VU, int reg, int xyzw) { int cycle; int i; @@ -172,7 +171,7 @@ void _vuFMACTestStall(VURegs * VU, int reg, int xyzw) { _vuTestPipes(VU); } -void _vuFMACAdd(VURegs * VU, int reg, int xyzw) { +static __releaseinline void __fastcall _vuFMACAdd(VURegs * VU, int reg, int xyzw) { int i; /* find a free fmac pipe */ @@ -195,7 +194,7 @@ void _vuFMACAdd(VURegs * VU, int reg, int xyzw) { VU->fmac[i].clipflag = VU->clipflag; } -void _vuFDIVAdd(VURegs * VU, int cycles) { +static __releaseinline void __fastcall _vuFDIVAdd(VURegs * VU, int cycles) { VUM_LOG("adding FDIV pipe"); VU->fdiv.enable = 1; @@ -205,7 +204,7 @@ void _vuFDIVAdd(VURegs * VU, int cycles) { VU->fdiv.statusflag = VU->statusflag; } -void _vuEFUAdd(VURegs * VU, int cycles) { +static __releaseinline void __fastcall _vuEFUAdd(VURegs * VU, int cycles) { // VUM_LOG("adding EFU pipe\n"); VU->efu.enable = 1; @@ -214,7 +213,7 @@ void _vuEFUAdd(VURegs * VU, int cycles) { VU->efu.reg.F = VU->p.F; } -void _vuFlushFDIV(VURegs * VU) { +static __releaseinline void __fastcall _vuFlushFDIV(VURegs * VU) { int cycle; if (VU->fdiv.enable == 0) return; @@ -228,7 +227,7 @@ void _vuFlushFDIV(VURegs * VU) { VU->VI[REG_STATUS_FLAG].UL = VU->fdiv.statusflag; } -void _vuFlushEFU(VURegs * VU) { +static __releaseinline void __fastcall _vuFlushEFU(VURegs * VU) { int cycle; if (VU->efu.enable == 0) return; @@ -241,7 +240,7 @@ void _vuFlushEFU(VURegs * VU) { VU->VI[REG_P].UL = VU->efu.reg.UL; } -void _vuTestFMACStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuTestFMACStalls(VURegs * VU, _VURegsNum *VUregsn) { if (VUregsn->VFread0) { _vuFMACTestStall(VU, VUregsn->VFread0, VUregsn->VFr0xyzw); } @@ -250,7 +249,7 @@ void _vuTestFMACStalls(VURegs * VU, _VURegsNum *VUregsn) { } } -void _vuAddFMACStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuAddFMACStalls(VURegs * VU, _VURegsNum *VUregsn) { if (VUregsn->VFwrite) { _vuFMACAdd(VU, VUregsn->VFwrite, VUregsn->VFwxyzw); } else @@ -261,36 +260,36 @@ void _vuAddFMACStalls(VURegs * VU, _VURegsNum *VUregsn) { } } -void _vuTestFDIVStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuTestFDIVStalls(VURegs * VU, _VURegsNum *VUregsn) { // _vuTestFMACStalls(VURegs * VU, _VURegsNum *VUregsn); _vuFlushFDIV(VU); } -void _vuAddFDIVStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuAddFDIVStalls(VURegs * VU, _VURegsNum *VUregsn) { if (VUregsn->VIwrite & (1 << REG_Q)) { _vuFDIVAdd(VU, VUregsn->cycles); } } -void _vuTestEFUStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuTestEFUStalls(VURegs * VU, _VURegsNum *VUregsn) { // _vuTestFMACStalls(VURegs * VU, _VURegsNum *VUregsn); _vuFlushEFU(VU); } -void _vuAddEFUStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuAddEFUStalls(VURegs * VU, _VURegsNum *VUregsn) { if (VUregsn->VIwrite & (1 << REG_P)) { _vuEFUAdd(VU, VUregsn->cycles); } } -void _vuTestUpperStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuTestUpperStalls(VURegs * VU, _VURegsNum *VUregsn) { switch (VUregsn->pipe) { case VUPIPE_FMAC: _vuTestFMACStalls(VU, VUregsn); break; } } -void _vuTestLowerStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuTestLowerStalls(VURegs * VU, _VURegsNum *VUregsn) { switch (VUregsn->pipe) { case VUPIPE_FMAC: _vuTestFMACStalls(VU, VUregsn); break; case VUPIPE_FDIV: _vuTestFDIVStalls(VU, VUregsn); break; @@ -298,13 +297,13 @@ void _vuTestLowerStalls(VURegs * VU, _VURegsNum *VUregsn) { } } -void _vuAddUpperStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuAddUpperStalls(VURegs * VU, _VURegsNum *VUregsn) { switch (VUregsn->pipe) { case VUPIPE_FMAC: _vuAddFMACStalls(VU, VUregsn); break; } } -void _vuAddLowerStalls(VURegs * VU, _VURegsNum *VUregsn) { +__forceinline void _vuAddLowerStalls(VURegs * VU, _VURegsNum *VUregsn) { switch (VUregsn->pipe) { case VUPIPE_FMAC: _vuAddFMACStalls(VU, VUregsn); break; case VUPIPE_FDIV: _vuAddFDIVStalls(VU, VUregsn); break; @@ -317,7 +316,7 @@ void _vuAddLowerStalls(VURegs * VU, _VURegsNum *VUregsn) { /* VU Upper instructions */ /******************************/ #ifndef INT_VUDOUBLEHACK -float vuDouble(u32 f) +static float __fastcall vuDouble(u32 f) { switch(f & 0x7f800000){ case 0x0: @@ -337,7 +336,7 @@ float vuDouble(u32 f) } } #else -float vuDouble(u32 f) +static __forceinline float vuDouble(u32 f) { return *(float*)&f; } @@ -1578,6 +1577,17 @@ void _vuMR32(VURegs * VU) { if (_W) VU->VF[_Ft_].i.w = tx; }//last updated 23/10/03 linuzappz +// -------------------------------------------------------------------------------------- +// Load / Store Instructions (VU Interpreter) +// -------------------------------------------------------------------------------------- + +__forceinline u32* GET_VU_MEM(VURegs* VU, u32 addr) // non-static, also used by sVU for now. +{ + if( VU == g_pVU1 ) return (u32*)(VU1.Mem+(addr&0x3fff)); + if( addr >= 0x4000 ) return (u32*)(VU0.Mem+(addr&0x43f0)); // get VF and VI regs (they're mapped to 0x4xx0 in VU0 mem!) + return (u32*)(VU0.Mem+(addr&0x0fff)); // for addr 0x0000 to 0x4000 just wrap around +} + void _vuLQ(VURegs * VU) { s16 imm; u16 addr; diff --git a/pcsx2/VUops.h b/pcsx2/VUops.h index 5a5aa07dfe..05dbbe5dd5 100644 --- a/pcsx2/VUops.h +++ b/pcsx2/VUops.h @@ -15,16 +15,7 @@ #pragma once #include "VU.h" - -extern __forceinline u32 VU_MAC_UPDATE( int shift, VURegs * VU, float f); -extern __forceinline u32 VU_MACx_UPDATE(VURegs * VU, float x); -extern __forceinline u32 VU_MACy_UPDATE(VURegs * VU, float y); -extern __forceinline u32 VU_MACz_UPDATE(VURegs * VU, float z); -extern __forceinline u32 VU_MACw_UPDATE(VURegs * VU, float w); -extern __forceinline void VU_MACx_CLEAR(VURegs * VU); -extern __forceinline void VU_MACy_CLEAR(VURegs * VU); -extern __forceinline void VU_MACz_CLEAR(VURegs * VU); -extern __forceinline void VU_MACw_CLEAR(VURegs * VU); +#include "VUflags.h" #define float_to_int4(x) (s32)((float)x * (1.0f / 0.0625f)) #define float_to_int12(x) (s32)((float)x * (1.0f / 0.000244140625f)) @@ -36,14 +27,11 @@ extern __forceinline void VU_MACw_CLEAR(VURegs * VU); #define MAC_Reset( VU ) VU->VI[REG_MAC_FLAG].UL = VU->VI[REG_MAC_FLAG].UL & (~0xFFFF) -void _vuSetCycleFlags(VURegs * VU); -void _vuFlushFDIV(VURegs * VU); -void _vuFlushEFU(VURegs * VU); -void _vuTestPipes(VURegs * VU); -void _vuTestUpperStalls(VURegs * VU, _VURegsNum *VUregsn); -void _vuTestLowerStalls(VURegs * VU, _VURegsNum *VUregsn); -void _vuAddUpperStalls(VURegs * VU, _VURegsNum *VUregsn); -void _vuAddLowerStalls(VURegs * VU, _VURegsNum *VUregsn); +extern void _vuTestPipes(VURegs * VU); +extern void _vuTestUpperStalls(VURegs * VU, _VURegsNum *VUregsn); +extern void _vuTestLowerStalls(VURegs * VU, _VURegsNum *VUregsn); +extern void _vuAddUpperStalls(VURegs * VU, _VURegsNum *VUregsn); +extern void _vuAddLowerStalls(VURegs * VU, _VURegsNum *VUregsn); /******************************/ /* VU Upper instructions */ diff --git a/pcsx2/Vif.cpp b/pcsx2/Vif.cpp index 1016fe59ca..a390aa7945 100644 --- a/pcsx2/Vif.cpp +++ b/pcsx2/Vif.cpp @@ -48,7 +48,92 @@ __forceinline static int _limit(int a, int max) { return (a > max) ? max : a; } - + +static __forceinline u32 setVifRowRegs(u32 reg, u32 data) +{ + switch (reg) + { + case 0: + vifRegs->r0 = data; + break; + case 1: + vifRegs->r1 = data; + break; + case 2: + vifRegs->r2 = data; + break; + case 3: + vifRegs->r3 = data; + break; + jNO_DEFAULT; + } + return data; +} + +static __forceinline u32 getVifRowRegs(u32 reg) +{ + switch (reg) + { + case 0: + return vifRegs->r0; + break; + case 1: + return vifRegs->r1; + break; + case 2: + return vifRegs->r2; + break; + case 3: + return vifRegs->r3; + break; + jNO_DEFAULT; + } + return 0; // unreachable... +} + +static __forceinline u32 setVifColRegs(u32 reg, u32 data) +{ + switch (reg) + { + case 0: + vifRegs->c0 = data; + break; + case 1: + vifRegs->c1 = data; + break; + case 2: + vifRegs->c2 = data; + break; + case 3: + vifRegs->c3 = data; + break; + jNO_DEFAULT; + } + return data; +} + +static __forceinline u32 getVifColRegs(u32 reg) +{ + switch (reg) + { + case 0: + return vifRegs->c0; + break; + case 1: + return vifRegs->c1; + break; + case 2: + return vifRegs->c2; + break; + case 3: + return vifRegs->c3; + break; + jNO_DEFAULT; + } + return 0; // unreachable... +} + + static __releaseinline void writeXYZW(u32 offnum, u32 &dest, u32 data) { int n; diff --git a/pcsx2/Vif.h b/pcsx2/Vif.h index 7ec5675bd6..fda707b337 100644 --- a/pcsx2/Vif.h +++ b/pcsx2/Vif.h @@ -148,89 +148,10 @@ extern "C" extern u32* _vifCol; } -static __forceinline u32 setVifRowRegs(u32 reg, u32 data) -{ - switch (reg) - { - case 0: - vifRegs->r0 = data; - break; - case 1: - vifRegs->r1 = data; - break; - case 2: - vifRegs->r2 = data; - break; - case 3: - vifRegs->r3 = data; - break; - jNO_DEFAULT; - } - return data; -} - -static __forceinline u32 getVifRowRegs(u32 reg) -{ - switch (reg) - { - case 0: - return vifRegs->r0; - break; - case 1: - return vifRegs->r1; - break; - case 2: - return vifRegs->r2; - break; - case 3: - return vifRegs->r3; - break; - jNO_DEFAULT; - } - return 0; // unreachable... -} - -static __forceinline u32 setVifColRegs(u32 reg, u32 data) -{ - switch (reg) - { - case 0: - vifRegs->c0 = data; - break; - case 1: - vifRegs->c1 = data; - break; - case 2: - vifRegs->c2 = data; - break; - case 3: - vifRegs->c3 = data; - break; - jNO_DEFAULT; - } - return data; -} - -static __forceinline u32 getVifColRegs(u32 reg) -{ - switch (reg) - { - case 0: - return vifRegs->c0; - break; - case 1: - return vifRegs->c1; - break; - case 2: - return vifRegs->c2; - break; - case 3: - return vifRegs->c3; - break; - jNO_DEFAULT; - } - return 0; // unreachable... -} +//extern u32 setVifRowRegs(u32 reg, u32 data); +//extern u32 getVifRowRegs(u32 reg); +//extern u32 setVifColRegs(u32 reg, u32 data); +//extern u32 getVifColRegs(u32 reg); #define vif0Regs ((VIFregisters*)&PS2MEM_HW[0x3800]) #define vif1Regs ((VIFregisters*)&PS2MEM_HW[0x3c00]) diff --git a/pcsx2/x86/sVU_Lower.cpp b/pcsx2/x86/sVU_Lower.cpp index 2e861795ae..913699b92c 100644 --- a/pcsx2/x86/sVU_Lower.cpp +++ b/pcsx2/x86/sVU_Lower.cpp @@ -23,7 +23,6 @@ #include "iFPU.h" #include "iCOP0.h" #include "VUmicro.h" -#include "VUflags.h" #include "sVU_Micro.h" #include "sVU_Debug.h" #include "sVU_zerorec.h"