mirror of https://github.com/PCSX2/pcsx2.git
clang format: set SpacesBeforeTrailingComments to 1
This commit is contained in:
parent
8945ace3f7
commit
604d3bac3c
|
@ -77,7 +77,7 @@ SpaceAfterCStyleCast: false
|
||||||
SpaceBeforeAssignmentOperators: true
|
SpaceBeforeAssignmentOperators: true
|
||||||
SpaceBeforeParens: ControlStatements
|
SpaceBeforeParens: ControlStatements
|
||||||
SpaceInEmptyParentheses: false
|
SpaceInEmptyParentheses: false
|
||||||
SpacesBeforeTrailingComments: 2
|
SpacesBeforeTrailingComments: 1
|
||||||
SpacesInAngles: false
|
SpacesInAngles: false
|
||||||
SpacesInContainerLiterals: true
|
SpacesInContainerLiterals: true
|
||||||
SpacesInCStyleCastParentheses: false
|
SpacesInCStyleCastParentheses: false
|
||||||
|
|
|
@ -25,7 +25,7 @@ using namespace std;
|
||||||
|
|
||||||
const u8 version = PS2E_FW_VERSION;
|
const u8 version = PS2E_FW_VERSION;
|
||||||
const u8 revision = 0;
|
const u8 revision = 0;
|
||||||
const u8 build = 7; // increase that with each version
|
const u8 build = 7; // increase that with each version
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define snprintf sprintf_s
|
#define snprintf sprintf_s
|
||||||
|
@ -140,7 +140,7 @@ void PHYRead()
|
||||||
|
|
||||||
PHYACC |= phyregs[reg] | (reg << 8);
|
PHYACC |= phyregs[reg] | (reg << 8);
|
||||||
|
|
||||||
if (fwRu32(0x8424) & 0x40000000) //RRx interrupt mask
|
if (fwRu32(0x8424) & 0x40000000) //RRx interrupt mask
|
||||||
{
|
{
|
||||||
fwRu32(0x8420) |= 0x40000000;
|
fwRu32(0x8420) |= 0x40000000;
|
||||||
FWirq();
|
FWirq();
|
||||||
|
@ -158,7 +158,7 @@ FWread32(u32 addr)
|
||||||
break;
|
break;
|
||||||
// Control Register 2
|
// Control Register 2
|
||||||
case 0x1f808410:
|
case 0x1f808410:
|
||||||
ret = fwRu32(addr); //SCLK OK (Needs to be set when FW is "Ready"
|
ret = fwRu32(addr); //SCLK OK (Needs to be set when FW is "Ready"
|
||||||
break;
|
break;
|
||||||
//Interrupt 0 Register
|
//Interrupt 0 Register
|
||||||
case 0x1f808420:
|
case 0x1f808420:
|
||||||
|
@ -201,11 +201,11 @@ FWwrite32(u32 addr, u32 value)
|
||||||
case 0x1f808414:
|
case 0x1f808414:
|
||||||
//If in read mode (top bit set) we read the PHY register requested then set the RRx interrupt if it's enabled
|
//If in read mode (top bit set) we read the PHY register requested then set the RRx interrupt if it's enabled
|
||||||
//Im presuming we send that back to pcsx2 then. This register stores the result, plus whatever was written (minus the read/write flag
|
//Im presuming we send that back to pcsx2 then. This register stores the result, plus whatever was written (minus the read/write flag
|
||||||
fwRu32(addr) = value; //R/W Bit cleaned in underneath function
|
fwRu32(addr) = value; //R/W Bit cleaned in underneath function
|
||||||
if (value & 0x40000000) //Writing to PHY
|
if (value & 0x40000000) //Writing to PHY
|
||||||
{
|
{
|
||||||
PHYWrite();
|
PHYWrite();
|
||||||
} else if (value & 0x80000000) //Reading from PHY
|
} else if (value & 0x80000000) //Reading from PHY
|
||||||
{
|
{
|
||||||
PHYRead();
|
PHYRead();
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ FWwrite32(u32 addr, u32 value)
|
||||||
fwRu32(addr) &= ~0x800000;
|
fwRu32(addr) &= ~0x800000;
|
||||||
break;
|
break;
|
||||||
//Control Register 2
|
//Control Register 2
|
||||||
case 0x1f808410: // fwRu32(addr) = value; break;
|
case 0x1f808410: // fwRu32(addr) = value; break;
|
||||||
//Ignore writes to this for now, apart from 0x2 which is Link Power Enable
|
//Ignore writes to this for now, apart from 0x2 which is Link Power Enable
|
||||||
//0x8 is SCLK OK (Ready) which should be set for emulation
|
//0x8 is SCLK OK (Ready) which should be set for emulation
|
||||||
fwRu32(addr) = 0x8 /*| value & 0x2*/;
|
fwRu32(addr) = 0x8 /*| value & 0x2*/;
|
||||||
|
|
|
@ -50,12 +50,12 @@ void LoadConfig()
|
||||||
if (!szTemp)
|
if (!szTemp)
|
||||||
return;
|
return;
|
||||||
strcpy(szTemp, "\\inis\\fwnull.ini");
|
strcpy(szTemp, "\\inis\\fwnull.ini");
|
||||||
fp = fopen("inis\\fwnull.ini", "rt"); //check if firewirenull.ini really exists
|
fp = fopen("inis\\fwnull.ini", "rt"); //check if firewirenull.ini really exists
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
CreateDirectory("inis", NULL);
|
CreateDirectory("inis", NULL);
|
||||||
memset(&conf, 0, sizeof(conf));
|
memset(&conf, 0, sizeof(conf));
|
||||||
conf.Log = 0; //default value
|
conf.Log = 0; //default value
|
||||||
SaveConfig(); //save and return
|
SaveConfig(); //save and return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
|
@ -94,10 +94,10 @@ void CALLBACK FWabout()
|
||||||
(DLGPROC)AboutDlgProc);
|
(DLGPROC)AboutDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
LPVOID lpReserved)
|
LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
hInst = (HINSTANCE)hModule;
|
hInst = (HINSTANCE)hModule;
|
||||||
return TRUE; // very quick :)
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ using namespace std;
|
||||||
|
|
||||||
const unsigned char version = PS2E_GS_VERSION;
|
const unsigned char version = PS2E_GS_VERSION;
|
||||||
const unsigned char revision = 0;
|
const unsigned char revision = 0;
|
||||||
const unsigned char build = 1; // increase that with each version
|
const unsigned char build = 1; // increase that with each version
|
||||||
|
|
||||||
static char libraryName[256];
|
static char libraryName[256];
|
||||||
Config conf;
|
Config conf;
|
||||||
|
|
|
@ -63,7 +63,7 @@ void _GSgifTransfer(const u32 *pMem, u32 size)
|
||||||
do {
|
do {
|
||||||
GIFPackedRegHandlerA_D(pMem);
|
GIFPackedRegHandlerA_D(pMem);
|
||||||
|
|
||||||
pMem += 4; //sizeof(GIFPackedReg)/4;
|
pMem += 4; //sizeof(GIFPackedReg)/4;
|
||||||
} while (--path->nloop > 0);
|
} while (--path->nloop > 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ void _GSgifTransfer(const u32 *pMem, u32 size)
|
||||||
u32 reg = path->GetReg();
|
u32 reg = path->GetReg();
|
||||||
GIFPackedRegHandlers[reg](pMem);
|
GIFPackedRegHandlers[reg](pMem);
|
||||||
|
|
||||||
pMem += 4; //sizeof(GIFPackedReg)/4;
|
pMem += 4; //sizeof(GIFPackedReg)/4;
|
||||||
size--;
|
size--;
|
||||||
} while (path->StepReg() && (size > 0));
|
} while (path->StepReg() && (size > 0));
|
||||||
|
|
||||||
|
@ -97,8 +97,8 @@ void _GSgifTransfer(const u32 *pMem, u32 size)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GIF_FLG_IMAGE: // FROM_VFRAM
|
case GIF_FLG_IMAGE: // FROM_VFRAM
|
||||||
case GIF_FLG_IMAGE2: // Used in the DirectX version, so we'll use it here too.
|
case GIF_FLG_IMAGE2: // Used in the DirectX version, so we'll use it here too.
|
||||||
{
|
{
|
||||||
int len = min(size, path->nloop);
|
int len = min(size, path->nloop);
|
||||||
//GSLog::Writeln("GIF_FLG_IMAGE(%d)=%d", gs.imageTransfer, len);
|
//GSLog::Writeln("GIF_FLG_IMAGE(%d)=%d", gs.imageTransfer, len);
|
||||||
|
@ -136,7 +136,7 @@ void _GSgifTransfer(const u32 *pMem, u32 size)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: // GIF_IMAGE
|
default: // GIF_IMAGE
|
||||||
GSLog::WriteLn("*** WARNING **** Unexpected GIFTag flag.");
|
GSLog::WriteLn("*** WARNING **** Unexpected GIFTag flag.");
|
||||||
assert(0);
|
assert(0);
|
||||||
path->nloop = 0;
|
path->nloop = 0;
|
||||||
|
|
|
@ -42,7 +42,7 @@ union GIFTag
|
||||||
u32 _PAD2 : 14;
|
u32 _PAD2 : 14;
|
||||||
u32 PRE : 1;
|
u32 PRE : 1;
|
||||||
u32 PRIM : 11;
|
u32 PRIM : 11;
|
||||||
u32 FLG : 2; // enum GIF_FLG
|
u32 FLG : 2; // enum GIF_FLG
|
||||||
u32 NREG : 4;
|
u32 NREG : 4;
|
||||||
u64 REGS : 64;
|
u64 REGS : 64;
|
||||||
};
|
};
|
||||||
|
@ -129,4 +129,4 @@ template <int index>
|
||||||
extern void _GSgifTransfer(const u32 *pMem, u32 size);
|
extern void _GSgifTransfer(const u32 *pMem, u32 size);
|
||||||
extern GIFRegHandler GIFPackedRegHandlers[];
|
extern GIFRegHandler GIFPackedRegHandlers[];
|
||||||
extern GIFRegHandler GIFRegHandlers[];
|
extern GIFRegHandler GIFRegHandlers[];
|
||||||
#endif // GIFTRANSFER_H_INCLUDED
|
#endif // GIFTRANSFER_H_INCLUDED
|
||||||
|
|
|
@ -43,7 +43,7 @@ void LoadConfig()
|
||||||
|
|
||||||
if (!Ini.Open(iniFile, READ_FILE)) {
|
if (!Ini.Open(iniFile, READ_FILE)) {
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
SaveConfig(); //save and return
|
SaveConfig(); //save and return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,19 +225,19 @@ enum GS_PRIM_CLASS {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GS_PSM {
|
enum GS_PSM {
|
||||||
PSM_PSMCT32 = 0, // 0000-0000
|
PSM_PSMCT32 = 0, // 0000-0000
|
||||||
PSM_PSMCT24 = 1, // 0000-0001
|
PSM_PSMCT24 = 1, // 0000-0001
|
||||||
PSM_PSMCT16 = 2, // 0000-0010
|
PSM_PSMCT16 = 2, // 0000-0010
|
||||||
PSM_PSMCT16S = 10, // 0000-1010
|
PSM_PSMCT16S = 10, // 0000-1010
|
||||||
PSM_PSMT8 = 19, // 0001-0011
|
PSM_PSMT8 = 19, // 0001-0011
|
||||||
PSM_PSMT4 = 20, // 0001-0100
|
PSM_PSMT4 = 20, // 0001-0100
|
||||||
PSM_PSMT8H = 27, // 0001-1011
|
PSM_PSMT8H = 27, // 0001-1011
|
||||||
PSM_PSMT4HL = 36, // 0010-0100
|
PSM_PSMT4HL = 36, // 0010-0100
|
||||||
PSM_PSMT4HH = 44, // 0010-1100
|
PSM_PSMT4HH = 44, // 0010-1100
|
||||||
PSM_PSMZ32 = 48, // 0011-0000
|
PSM_PSMZ32 = 48, // 0011-0000
|
||||||
PSM_PSMZ24 = 49, // 0011-0001
|
PSM_PSMZ24 = 49, // 0011-0001
|
||||||
PSM_PSMZ16 = 50, // 0011-0010
|
PSM_PSMZ16 = 50, // 0011-0010
|
||||||
PSM_PSMZ16S = 58, // 0011-1010
|
PSM_PSMZ16S = 58, // 0011-1010
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GS_TFX {
|
enum GS_TFX {
|
||||||
|
@ -385,7 +385,7 @@ u32 wREV : 8;
|
||||||
u32 wID : 8;
|
u32 wID : 8;
|
||||||
REG_END
|
REG_END
|
||||||
|
|
||||||
REG64_(GSReg, DISPFB) // (-1/2)
|
REG64_(GSReg, DISPFB) // (-1/2)
|
||||||
u32 FBP : 9;
|
u32 FBP : 9;
|
||||||
u32 FBW : 6;
|
u32 FBW : 6;
|
||||||
u32 PSM : 5;
|
u32 PSM : 5;
|
||||||
|
@ -397,7 +397,7 @@ REG_END2
|
||||||
u32 Block() const { return FBP << 5; }
|
u32 Block() const { return FBP << 5; }
|
||||||
REG_END2
|
REG_END2
|
||||||
|
|
||||||
REG64_(GSReg, DISPLAY) // (-1/2)
|
REG64_(GSReg, DISPLAY) // (-1/2)
|
||||||
u32 DX : 12;
|
u32 DX : 12;
|
||||||
u32 DY : 11;
|
u32 DY : 11;
|
||||||
u32 MAGH : 4;
|
u32 MAGH : 4;
|
||||||
|
@ -491,7 +491,7 @@ u32 SINT : 1;
|
||||||
u32 XPCK : 1;
|
u32 XPCK : 1;
|
||||||
u32 PCK2 : 2;
|
u32 PCK2 : 2;
|
||||||
u32 SPML : 4;
|
u32 SPML : 4;
|
||||||
u32 GCONT : 1; // YCrCb
|
u32 GCONT : 1; // YCrCb
|
||||||
u32 PHS : 1;
|
u32 PHS : 1;
|
||||||
u32 PVS : 1;
|
u32 PVS : 1;
|
||||||
u32 PEHS : 1;
|
u32 PEHS : 1;
|
||||||
|
@ -840,9 +840,9 @@ u32 ZTST : 2;
|
||||||
u32 _PAD1 : 13;
|
u32 _PAD1 : 13;
|
||||||
u32 _PAD2 : 32;
|
u32 _PAD2 : 32;
|
||||||
REG_END2
|
REG_END2
|
||||||
__forceinline bool DoFirstPass() { return !ATE || ATST != ATST_NEVER; } // not all pixels fail automatically
|
__forceinline bool DoFirstPass() { return !ATE || ATST != ATST_NEVER; } // not all pixels fail automatically
|
||||||
__forceinline bool DoSecondPass() { return ATE && ATST != ATST_ALWAYS && AFAIL != AFAIL_KEEP; } // pixels may fail, write fb/z
|
__forceinline bool DoSecondPass() { return ATE && ATST != ATST_ALWAYS && AFAIL != AFAIL_KEEP; } // pixels may fail, write fb/z
|
||||||
__forceinline bool NoSecondPass() { return ATE && ATST != ATST_ALWAYS && AFAIL == AFAIL_KEEP; } // pixels may fail, no output
|
__forceinline bool NoSecondPass() { return ATE && ATST != ATST_ALWAYS && AFAIL == AFAIL_KEEP; } // pixels may fail, no output
|
||||||
REG_END2
|
REG_END2
|
||||||
|
|
||||||
REG64_(GIFReg, TEX0)
|
REG64_(GIFReg, TEX0)
|
||||||
|
@ -886,7 +886,7 @@ u32 MTBA : 1;
|
||||||
u32 _PAD2 : 9;
|
u32 _PAD2 : 9;
|
||||||
u32 L : 2;
|
u32 L : 2;
|
||||||
u32 _PAD3 : 11;
|
u32 _PAD3 : 11;
|
||||||
s32 K : 12; // 1:7:4
|
s32 K : 12; // 1:7:4
|
||||||
u32 _PAD4 : 20;
|
u32 _PAD4 : 20;
|
||||||
REG_END2
|
REG_END2
|
||||||
bool IsMinLinear() const { return (MMIN == 1) || (MMIN & 4); }
|
bool IsMinLinear() const { return (MMIN == 1) || (MMIN & 4); }
|
||||||
|
@ -966,8 +966,8 @@ REG_END
|
||||||
// GSState::GIFRegHandlerXYOFFSET will make sure that the _PAD1/2 bits are set to zero
|
// GSState::GIFRegHandlerXYOFFSET will make sure that the _PAD1/2 bits are set to zero
|
||||||
|
|
||||||
REG64_(GIFReg, XYOFFSET)
|
REG64_(GIFReg, XYOFFSET)
|
||||||
u32 OFX; // :16; u32 _PAD1:16;
|
u32 OFX; // :16; u32 _PAD1:16;
|
||||||
u32 OFY; // :16; u32 _PAD2:16;
|
u32 OFY; // :16; u32 _PAD2:16;
|
||||||
REG_END
|
REG_END
|
||||||
|
|
||||||
REG64_(GIFReg, XYZ)
|
REG64_(GIFReg, XYZ)
|
||||||
|
@ -1129,7 +1129,7 @@ REG_END
|
||||||
|
|
||||||
REG128_(GIFPacked, A_D)
|
REG128_(GIFPacked, A_D)
|
||||||
u64 DATA : 64;
|
u64 DATA : 64;
|
||||||
u32 ADDR : 8; // enum GIF_A_D_REG
|
u32 ADDR : 8; // enum GIF_A_D_REG
|
||||||
u32 _PAD1 : 24;
|
u32 _PAD1 : 24;
|
||||||
u32 _PAD2 : 32;
|
u32 _PAD2 : 32;
|
||||||
REG_END
|
REG_END
|
||||||
|
|
|
@ -50,13 +50,13 @@ void LoadConfig()
|
||||||
if (!szTemp)
|
if (!szTemp)
|
||||||
return;
|
return;
|
||||||
strcpy(szTemp, "\\inis\\gsnull.ini");
|
strcpy(szTemp, "\\inis\\gsnull.ini");
|
||||||
fp = fopen("inis\\gsnull.ini", "rt"); //check if gsnull.ini really exists
|
fp = fopen("inis\\gsnull.ini", "rt"); //check if gsnull.ini really exists
|
||||||
|
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
CreateDirectory("inis", NULL);
|
CreateDirectory("inis", NULL);
|
||||||
memset(&conf, 0, sizeof(conf));
|
memset(&conf, 0, sizeof(conf));
|
||||||
conf.Log = 0; //default value
|
conf.Log = 0; //default value
|
||||||
SaveConfig(); //save and return
|
SaveConfig(); //save and return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,10 @@ GSabout()
|
||||||
(DLGPROC)AboutDlgProc);
|
(DLGPROC)AboutDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
LPVOID lpReserved)
|
LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
hInst = (HINSTANCE)hModule;
|
hInst = (HINSTANCE)hModule;
|
||||||
return TRUE; // very quick :)
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,10 @@ const wchar_t *padTypes[] = {
|
||||||
// Hacks or configurations which PCSX2 needs with a specific value
|
// Hacks or configurations which PCSX2 needs with a specific value
|
||||||
void PCSX2_overrideConfig(GeneralConfig &config_in_out)
|
void PCSX2_overrideConfig(GeneralConfig &config_in_out)
|
||||||
{
|
{
|
||||||
config_in_out.disableScreenSaver = 0; // Not required - handled internally by PCSX2
|
config_in_out.disableScreenSaver = 0; // Not required - handled internally by PCSX2
|
||||||
config_in_out.escapeFullscreenHack = 0; // Not required - handled internally by PCSX2
|
config_in_out.escapeFullscreenHack = 0; // Not required - handled internally by PCSX2
|
||||||
config_in_out.saveStateTitle = 0; // Not required - handled internally by PCSX2
|
config_in_out.saveStateTitle = 0; // Not required - handled internally by PCSX2
|
||||||
config_in_out.closeHacks = 0; // Cannot function when used by PCSX2
|
config_in_out.closeHacks = 0; // Cannot function when used by PCSX2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dialog widgets which should be disabled - mostly matching PCSX2_overrideConfig
|
// Dialog widgets which should be disabled - mostly matching PCSX2_overrideConfig
|
||||||
|
@ -53,7 +53,7 @@ const UINT *PCSX2_disabledWidgets()
|
||||||
IDC_DISABLE_SCREENSAVER,
|
IDC_DISABLE_SCREENSAVER,
|
||||||
IDC_ESCAPE_FULLSCREEN_HACK,
|
IDC_ESCAPE_FULLSCREEN_HACK,
|
||||||
IDC_SAVE_STATE_TITLE,
|
IDC_SAVE_STATE_TITLE,
|
||||||
IDC_ANALOG_START1, // start in analog mode - only useful for PS1
|
IDC_ANALOG_START1, // start in analog mode - only useful for PS1
|
||||||
IDC_CLOSE_HACK1,
|
IDC_CLOSE_HACK1,
|
||||||
IDC_CLOSE_HACK2,
|
IDC_CLOSE_HACK2,
|
||||||
0};
|
0};
|
||||||
|
@ -102,11 +102,11 @@ const GeneralSettingsBool BoolOptionsInfo[] = {
|
||||||
{L"Multitap 1", IDC_MULTITAP1, 0},
|
{L"Multitap 1", IDC_MULTITAP1, 0},
|
||||||
{L"Multitap 2", IDC_MULTITAP2, 0},
|
{L"Multitap 2", IDC_MULTITAP2, 0},
|
||||||
|
|
||||||
{L"Escape Fullscreen Hack", IDC_ESCAPE_FULLSCREEN_HACK, 1}, // Not required for PCSX2
|
{L"Escape Fullscreen Hack", IDC_ESCAPE_FULLSCREEN_HACK, 1}, // Not required for PCSX2
|
||||||
{L"Disable Screen Saver", IDC_DISABLE_SCREENSAVER, 1}, // Not required for PCSX2
|
{L"Disable Screen Saver", IDC_DISABLE_SCREENSAVER, 1}, // Not required for PCSX2
|
||||||
{L"Logging", IDC_DEBUG_FILE, 0},
|
{L"Logging", IDC_DEBUG_FILE, 0},
|
||||||
|
|
||||||
{L"Save State in Title", IDC_SAVE_STATE_TITLE, 0}, // Not required for PCSX2
|
{L"Save State in Title", IDC_SAVE_STATE_TITLE, 0}, // Not required for PCSX2
|
||||||
{L"GH2", IDC_GH2_HACK, 0},
|
{L"GH2", IDC_GH2_HACK, 0},
|
||||||
{L"Turbo Key Hack", IDC_TURBO_KEY_HACK, 0},
|
{L"Turbo Key Hack", IDC_TURBO_KEY_HACK, 0},
|
||||||
};
|
};
|
||||||
|
@ -339,7 +339,7 @@ void CALLBACK PADsetSettingsDir(const char *dir)
|
||||||
|
|
||||||
FILE *temp = nullptr;
|
FILE *temp = nullptr;
|
||||||
_wfopen_s(&temp, iniFile, L"r");
|
_wfopen_s(&temp, iniFile, L"r");
|
||||||
if (!temp) { // File not found, possibly.
|
if (!temp) { // File not found, possibly.
|
||||||
HRSRC res = FindResource(hInst, MAKEINTRESOURCE(IDR_INI1), RT_RCDATA);
|
HRSRC res = FindResource(hInst, MAKEINTRESOURCE(IDR_INI1), RT_RCDATA);
|
||||||
if (!res)
|
if (!res)
|
||||||
return;
|
return;
|
||||||
|
@ -1642,7 +1642,7 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l
|
||||||
SetTimer(hWnd, 1, 3000, 0);
|
SetTimer(hWnd, 1, 3000, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((cmd >= ID_LOCK_BUTTONS && cmd <= ID_ANALOG) || cmd == ID_IGNORE) { // || cmd == ID_FORCE_FEEDBACK) {
|
} else if ((cmd >= ID_LOCK_BUTTONS && cmd <= ID_ANALOG) || cmd == ID_IGNORE) { // || cmd == ID_FORCE_FEEDBACK) {
|
||||||
// Messes up things, unfortunately.
|
// Messes up things, unfortunately.
|
||||||
// End binding on a bunch of notification messages, and
|
// End binding on a bunch of notification messages, and
|
||||||
// this will send a bunch.
|
// this will send a bunch.
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef uint16_t USHORT;
|
||||||
typedef int64_t __int64;
|
typedef int64_t __int64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_PATH (256) // random value
|
#define MAX_PATH (256) // random value
|
||||||
|
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ static inline unsigned int timeGetTime()
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
uint64_t ms = (now.tv_usec / 1000) + ((uint64_t)now.tv_sec * 1000);
|
uint64_t ms = (now.tv_usec / 1000) + ((uint64_t)now.tv_sec * 1000);
|
||||||
return (ms & 0xFFFFFFFF); // MS code is u32 ...
|
return (ms & 0xFFFFFFFF); // MS code is u32 ...
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "Utilities/Dependencies.h"
|
#include "Utilities/Dependencies.h"
|
||||||
|
|
|
@ -385,9 +385,9 @@ void ProcessButtonBinding(Binding *b, ButtonSum *sum, int value)
|
||||||
if (value < b->deadZone || !value)
|
if (value < b->deadZone || !value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (config.turboKeyHack == 1) { // send a tabulator keypress to emulator
|
if (config.turboKeyHack == 1) { // send a tabulator keypress to emulator
|
||||||
//printf("%x\n", b->command);
|
//printf("%x\n", b->command);
|
||||||
if (b->command == 0x11) { // L3 button
|
if (b->command == 0x11) { // L3 button
|
||||||
static unsigned int LastCheck = 0;
|
static unsigned int LastCheck = 0;
|
||||||
unsigned int t = timeGetTime();
|
unsigned int t = timeGetTime();
|
||||||
if (t - LastCheck < 300)
|
if (t - LastCheck < 300)
|
||||||
|
@ -1262,10 +1262,10 @@ u8 CALLBACK PADpoll(u8 value)
|
||||||
//query.response[4] &= pad->mask[1];
|
//query.response[4] &= pad->mask[1];
|
||||||
|
|
||||||
// No need to cap these, already done int CapSum().
|
// No need to cap these, already done int CapSum().
|
||||||
query.response[9] = (unsigned char)sum->buttons[13]; //D-pad right
|
query.response[9] = (unsigned char)sum->buttons[13]; //D-pad right
|
||||||
query.response[10] = (unsigned char)sum->buttons[15]; //D-pad left
|
query.response[10] = (unsigned char)sum->buttons[15]; //D-pad left
|
||||||
query.response[11] = (unsigned char)sum->buttons[12]; //D-pad up
|
query.response[11] = (unsigned char)sum->buttons[12]; //D-pad up
|
||||||
query.response[12] = (unsigned char)sum->buttons[14]; //D-pad down
|
query.response[12] = (unsigned char)sum->buttons[14]; //D-pad down
|
||||||
|
|
||||||
query.response[13] = (unsigned char)sum->buttons[8];
|
query.response[13] = (unsigned char)sum->buttons[8];
|
||||||
query.response[14] = (unsigned char)sum->buttons[9];
|
query.response[14] = (unsigned char)sum->buttons[9];
|
||||||
|
|
|
@ -210,7 +210,7 @@ const GeneralSettingsBool BoolOptionsInfo[] = {
|
||||||
{L"Disable Screen Saver", 0 /*IDC_DISABLE_SCREENSAVER*/, 1},
|
{L"Disable Screen Saver", 0 /*IDC_DISABLE_SCREENSAVER*/, 1},
|
||||||
{L"Logging", 0 /*IDC_DEBUG_FILE*/, 0},
|
{L"Logging", 0 /*IDC_DEBUG_FILE*/, 0},
|
||||||
|
|
||||||
{L"Save State in Title", 0 /*IDC_SAVE_STATE_TITLE*/, 0}, //No longer required, PCSX2 now handles it - avih 2011-05-17
|
{L"Save State in Title", 0 /*IDC_SAVE_STATE_TITLE*/, 0}, //No longer required, PCSX2 now handles it - avih 2011-05-17
|
||||||
{L"GH2", 0 /*IDC_GH2_HACK*/, 0},
|
{L"GH2", 0 /*IDC_GH2_HACK*/, 0},
|
||||||
{L"Turbo Key Hack", 0 /*IDC_TURBO_KEY_HACK*/, 0},
|
{L"Turbo Key Hack", 0 /*IDC_TURBO_KEY_HACK*/, 0},
|
||||||
};
|
};
|
||||||
|
@ -461,7 +461,7 @@ int LoadSettings(int force, wchar_t *file)
|
||||||
config.multipleBinding = multipleBinding;
|
config.multipleBinding = multipleBinding;
|
||||||
|
|
||||||
//TODO RefreshEnabledDevicesAndDisplay(1);
|
//TODO RefreshEnabledDevicesAndDisplay(1);
|
||||||
RefreshEnabledDevices(1); // XXX For the moment only a subfonction
|
RefreshEnabledDevices(1); // XXX For the moment only a subfonction
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -495,7 +495,7 @@ void RefreshEnabledDevices(int updateDeviceList)
|
||||||
}
|
}
|
||||||
|
|
||||||
dm->EnableDevice(i);
|
dm->EnableDevice(i);
|
||||||
#if 0 // windows magic?
|
#if 0 // windows magic?
|
||||||
if ((dev->type == KEYBOARD && dev->api == IGNORE_KEYBOARD) ||
|
if ((dev->type == KEYBOARD && dev->api == IGNORE_KEYBOARD) ||
|
||||||
(dev->type == KEYBOARD && dev->api == config.keyboardApi) ||
|
(dev->type == KEYBOARD && dev->api == config.keyboardApi) ||
|
||||||
(dev->type == MOUSE && dev->api == config.mouseApi) ||
|
(dev->type == MOUSE && dev->api == config.mouseApi) ||
|
||||||
|
|
|
@ -49,7 +49,7 @@ JoyEvdev::JoyEvdev(int fd, bool ds3, const wchar_t *id)
|
||||||
// Add Absolute axis
|
// Add Absolute axis
|
||||||
if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmap)), abs_bitmap) >= 0) {
|
if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmap)), abs_bitmap) >= 0) {
|
||||||
for (int bit = 0; bit < ABS_CNT; bit++) {
|
for (int bit = 0; bit < ABS_CNT; bit++) {
|
||||||
ControlType type = ABSAXIS; // FIXME DS3
|
ControlType type = ABSAXIS; // FIXME DS3
|
||||||
|
|
||||||
if (testBit(bit, abs_bitmap)) {
|
if (testBit(bit, abs_bitmap)) {
|
||||||
input_absinfo info;
|
input_absinfo info;
|
||||||
|
|
|
@ -72,7 +72,7 @@ int LinuxKeyboard::Update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return status; // XXX ????
|
return status; // XXX ????
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnumLnx()
|
void EnumLnx()
|
||||||
|
|
|
@ -28,20 +28,20 @@ wchar_t *GetVKStringW(unsigned char vk)
|
||||||
case 0x13:
|
case 0x13:
|
||||||
return L"Pause";
|
return L"Pause";
|
||||||
|
|
||||||
case 0x21: // return "Page Up";
|
case 0x21: // return "Page Up";
|
||||||
case 0x22: // return "Page Down";
|
case 0x22: // return "Page Down";
|
||||||
case 0x23: // return "End";
|
case 0x23: // return "End";
|
||||||
case 0x24: // return "Home";
|
case 0x24: // return "Home";
|
||||||
case 0x25: // return "Left";
|
case 0x25: // return "Left";
|
||||||
case 0x26: // return "Up";
|
case 0x26: // return "Up";
|
||||||
case 0x27: // return "Right";
|
case 0x27: // return "Right";
|
||||||
case 0x28: // return "Down";
|
case 0x28: // return "Down";
|
||||||
case 0x2D: // return "Insert";
|
case 0x2D: // return "Insert";
|
||||||
case 0x2E: // return "Delete";
|
case 0x2E: // return "Delete";
|
||||||
case 0x5B: // return "Left Windows";
|
case 0x5B: // return "Left Windows";
|
||||||
case 0x5C: // return "Right Windows";
|
case 0x5C: // return "Right Windows";
|
||||||
case 0x5D: // return "Application";
|
case 0x5D: // return "Application";
|
||||||
case 0x6F: // return "Num /";
|
case 0x6F: // return "Num /";
|
||||||
flag = 1 << 24;
|
flag = 1 << 24;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
memset(&xInputVibration, 0, sizeof(xInputVibration));
|
memset(&xInputVibration, 0, sizeof(xInputVibration));
|
||||||
this->index = index;
|
this->index = index;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 17; i++) { // Skip empty bit
|
for (i = 0; i < 17; i++) { // Skip empty bit
|
||||||
AddPhysicalControl(PRESSURE_BTN, i + (i > 10), 0);
|
AddPhysicalControl(PRESSURE_BTN, i + (i > 10), 0);
|
||||||
}
|
}
|
||||||
for (; i < 21; i++) {
|
for (; i < 21; i++) {
|
||||||
|
@ -282,7 +282,7 @@ void EnumXInputDevices()
|
||||||
|
|
||||||
if (hMod) {
|
if (hMod) {
|
||||||
if ((pXInputEnable = (_XInputEnable)GetProcAddress(hMod, "XInputEnable")) &&
|
if ((pXInputEnable = (_XInputEnable)GetProcAddress(hMod, "XInputEnable")) &&
|
||||||
((pXInputGetStateEx = (_XInputGetStateEx)GetProcAddress(hMod, (LPCSTR)100)) || // Try Ex version first
|
((pXInputGetStateEx = (_XInputGetStateEx)GetProcAddress(hMod, (LPCSTR)100)) || // Try Ex version first
|
||||||
(pXInputGetStateEx = (_XInputGetStateEx)GetProcAddress(hMod, "XInputGetState")))) {
|
(pXInputGetStateEx = (_XInputGetStateEx)GetProcAddress(hMod, "XInputGetState")))) {
|
||||||
pXInputGetExtended = (_XInputGetExtended)GetProcAddress(hMod, "XInputGetExtended");
|
pXInputGetExtended = (_XInputGetExtended)GetProcAddress(hMod, "XInputGetExtended");
|
||||||
pXInputSetState = (_XInputSetState)GetProcAddress(hMod, "XInputSetState");
|
pXInputSetState = (_XInputSetState)GetProcAddress(hMod, "XInputSetState");
|
||||||
|
|
|
@ -44,7 +44,7 @@ void LoadConfig()
|
||||||
|
|
||||||
if (!Ini.Open(iniFile, READ_FILE)) {
|
if (!Ini.Open(iniFile, READ_FILE)) {
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
SaveConfig(); //save and return
|
SaveConfig(); //save and return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ using namespace std;
|
||||||
|
|
||||||
const u8 version = PS2E_SPU2_VERSION;
|
const u8 version = PS2E_SPU2_VERSION;
|
||||||
const u8 revision = 0;
|
const u8 revision = 0;
|
||||||
const u8 build = 8; // increase that with each version
|
const u8 build = 8; // increase that with each version
|
||||||
const u32 minor = 0; // increase that with each version
|
const u32 minor = 0; // increase that with each version
|
||||||
|
|
||||||
// ADSR constants
|
// ADSR constants
|
||||||
#define ATTACK_MS 494L
|
#define ATTACK_MS 494L
|
||||||
|
@ -55,8 +55,8 @@ u16 interrupt = 0;
|
||||||
s8 *spu2regs = NULL;
|
s8 *spu2regs = NULL;
|
||||||
u16 *spu2mem = NULL;
|
u16 *spu2mem = NULL;
|
||||||
u16 *pSpuIrq[2] = {NULL};
|
u16 *pSpuIrq[2] = {NULL};
|
||||||
u32 dwEndChannel2[2] = {0}; // keeps track of what channels have ended
|
u32 dwEndChannel2[2] = {0}; // keeps track of what channels have ended
|
||||||
u32 dwNoiseVal = 1; // global noise generator
|
u32 dwNoiseVal = 1; // global noise generator
|
||||||
|
|
||||||
s32 SPUCycles = 0, SPUWorkerCycles = 0;
|
s32 SPUCycles = 0, SPUWorkerCycles = 0;
|
||||||
s32 SPUStartCycle[2];
|
s32 SPUStartCycle[2];
|
||||||
|
@ -67,9 +67,9 @@ int ADMAS7Write();
|
||||||
|
|
||||||
void InitADSR();
|
void InitADSR();
|
||||||
|
|
||||||
void (*irqCallbackSPU2)(); // func of main emu, called on spu irq
|
void (*irqCallbackSPU2)(); // func of main emu, called on spu irq
|
||||||
void (*irqCallbackDMA4)() = 0; // func of main emu, called on spu irq
|
void (*irqCallbackDMA4)() = 0; // func of main emu, called on spu irq
|
||||||
void (*irqCallbackDMA7)() = 0; // func of main emu, called on spu irq
|
void (*irqCallbackDMA7)() = 0; // func of main emu, called on spu irq
|
||||||
|
|
||||||
const s32 f[5][2] = {
|
const s32 f[5][2] = {
|
||||||
{0, 0},
|
{0, 0},
|
||||||
|
@ -81,7 +81,7 @@ const s32 f[5][2] = {
|
||||||
u32 RateTable[160];
|
u32 RateTable[160];
|
||||||
|
|
||||||
// channels and voices
|
// channels and voices
|
||||||
VOICE_PROCESSED voices[SPU_NUMBER_VOICES + 1]; // +1 for modulation
|
VOICE_PROCESSED voices[SPU_NUMBER_VOICES + 1]; // +1 for modulation
|
||||||
|
|
||||||
EXPORT_C_(u32)
|
EXPORT_C_(u32)
|
||||||
PS2EgetLibType()
|
PS2EgetLibType()
|
||||||
|
@ -167,7 +167,7 @@ SPU2init()
|
||||||
}
|
}
|
||||||
memset(spu2regs, 0, 0x10000);
|
memset(spu2regs, 0, 0x10000);
|
||||||
|
|
||||||
spu2mem = (u16 *)malloc(0x200000); // 2Mb
|
spu2mem = (u16 *)malloc(0x200000); // 2Mb
|
||||||
if (spu2mem == NULL) {
|
if (spu2mem == NULL) {
|
||||||
SysMessage("Error allocating Memory\n");
|
SysMessage("Error allocating Memory\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -188,7 +188,7 @@ SPU2init()
|
||||||
voices[i].pLoop = voices[i].pStart = voices[i].pCurr = (u8 *)spu2mem;
|
voices[i].pLoop = voices[i].pStart = voices[i].pCurr = (u8 *)spu2mem;
|
||||||
|
|
||||||
voices[i].pvoice = (_SPU_VOICE *)((u8 *)spu2regs + voices[i].memoffset) + (i % 24);
|
voices[i].pvoice = (_SPU_VOICE *)((u8 *)spu2regs + voices[i].memoffset) + (i % 24);
|
||||||
voices[i].ADSRX.SustainLevel = 1024; // -> init sustain
|
voices[i].ADSRX.SustainLevel = 1024; // -> init sustain
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -259,17 +259,17 @@ SPU2async(u32 cycle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitADSR() // INIT ADSR
|
void InitADSR() // INIT ADSR
|
||||||
{
|
{
|
||||||
u32 r, rs, rd;
|
u32 r, rs, rd;
|
||||||
s32 i;
|
s32 i;
|
||||||
memset(RateTable, 0, sizeof(u32) * 160); // build the rate table according to Neill's rules (see at bottom of file)
|
memset(RateTable, 0, sizeof(u32) * 160); // build the rate table according to Neill's rules (see at bottom of file)
|
||||||
|
|
||||||
r = 3;
|
r = 3;
|
||||||
rs = 1;
|
rs = 1;
|
||||||
rd = 0;
|
rd = 0;
|
||||||
|
|
||||||
for (i = 32; i < 160; i++) // we start at pos 32 with the real values... everything before is 0
|
for (i = 32; i < 160; i++) // we start at pos 32 with the real values... everything before is 0
|
||||||
{
|
{
|
||||||
if (r < 0x3FFFFFFF) {
|
if (r < 0x3FFFFFFF) {
|
||||||
r += rs;
|
r += rs;
|
||||||
|
@ -286,9 +286,9 @@ void InitADSR() // INIT ADSR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MixADSR(VOICE_PROCESSED *pvoice) // MIX ADSR
|
int MixADSR(VOICE_PROCESSED *pvoice) // MIX ADSR
|
||||||
{
|
{
|
||||||
if (pvoice->bStop) // should be stopped:
|
if (pvoice->bStop) // should be stopped:
|
||||||
{
|
{
|
||||||
if (pvoice->bIgnoreLoop == 0) {
|
if (pvoice->bIgnoreLoop == 0) {
|
||||||
pvoice->ADSRX.EnvelopeVol = 0;
|
pvoice->ADSRX.EnvelopeVol = 0;
|
||||||
|
@ -300,7 +300,7 @@ int MixADSR(VOICE_PROCESSED *pvoice) // MIX ADSR
|
||||||
pvoice->bIgnoreLoop = false;
|
pvoice->bIgnoreLoop = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (pvoice->ADSRX.ReleaseModeExp) // do release
|
if (pvoice->ADSRX.ReleaseModeExp) // do release
|
||||||
{
|
{
|
||||||
switch ((pvoice->ADSRX.EnvelopeVol >> 28) & 0x7) {
|
switch ((pvoice->ADSRX.EnvelopeVol >> 28) & 0x7) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -347,9 +347,9 @@ int MixADSR(VOICE_PROCESSED *pvoice) // MIX ADSR
|
||||||
pvoice->ADSRX.lVolume = pvoice->ADSRX.EnvelopeVol >> 21;
|
pvoice->ADSRX.lVolume = pvoice->ADSRX.EnvelopeVol >> 21;
|
||||||
pvoice->ADSRX.lVolume = pvoice->ADSRX.EnvelopeVol >> 21;
|
pvoice->ADSRX.lVolume = pvoice->ADSRX.EnvelopeVol >> 21;
|
||||||
return pvoice->ADSRX.lVolume;
|
return pvoice->ADSRX.lVolume;
|
||||||
} else // not stopped yet?
|
} else // not stopped yet?
|
||||||
{
|
{
|
||||||
if (pvoice->ADSRX.State == 0) // -> attack
|
if (pvoice->ADSRX.State == 0) // -> attack
|
||||||
{
|
{
|
||||||
if (pvoice->ADSRX.AttackModeExp) {
|
if (pvoice->ADSRX.AttackModeExp) {
|
||||||
if (pvoice->ADSRX.EnvelopeVol < 0x60000000)
|
if (pvoice->ADSRX.EnvelopeVol < 0x60000000)
|
||||||
|
@ -369,7 +369,7 @@ int MixADSR(VOICE_PROCESSED *pvoice) // MIX ADSR
|
||||||
return pvoice->ADSRX.lVolume;
|
return pvoice->ADSRX.lVolume;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------//
|
//--------------------------------------------------//
|
||||||
if (pvoice->ADSRX.State == 1) // -> decay
|
if (pvoice->ADSRX.State == 1) // -> decay
|
||||||
{
|
{
|
||||||
switch ((pvoice->ADSRX.EnvelopeVol >> 28) & 0x7) {
|
switch ((pvoice->ADSRX.EnvelopeVol >> 28) & 0x7) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -408,7 +408,7 @@ int MixADSR(VOICE_PROCESSED *pvoice) // MIX ADSR
|
||||||
return pvoice->ADSRX.lVolume;
|
return pvoice->ADSRX.lVolume;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------//
|
//--------------------------------------------------//
|
||||||
if (pvoice->ADSRX.State == 2) // -> sustain
|
if (pvoice->ADSRX.State == 2) // -> sustain
|
||||||
{
|
{
|
||||||
if (pvoice->ADSRX.SustainIncrease) {
|
if (pvoice->ADSRX.SustainIncrease) {
|
||||||
if (pvoice->ADSRX.SustainModeExp) {
|
if (pvoice->ADSRX.SustainModeExp) {
|
||||||
|
@ -473,11 +473,11 @@ void SPU2Worker()
|
||||||
int ch, flags;
|
int ch, flags;
|
||||||
|
|
||||||
VOICE_PROCESSED *pChannel = voices;
|
VOICE_PROCESSED *pChannel = voices;
|
||||||
for (ch = 0; ch < SPU_NUMBER_VOICES; ch++, pChannel++) // loop em all... we will collect 1 ms of sound of each playing channel
|
for (ch = 0; ch < SPU_NUMBER_VOICES; ch++, pChannel++) // loop em all... we will collect 1 ms of sound of each playing channel
|
||||||
{
|
{
|
||||||
if (pChannel->bNew) {
|
if (pChannel->bNew) {
|
||||||
pChannel->StartSound(); // start new sound
|
pChannel->StartSound(); // start new sound
|
||||||
dwEndChannel2[ch / 24] &= ~(1 << (ch % 24)); // clear end channel bit
|
dwEndChannel2[ch / 24] &= ~(1 << (ch % 24)); // clear end channel bit
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pChannel->bOn) {
|
if (!pChannel->bOn) {
|
||||||
|
@ -485,24 +485,24 @@ void SPU2Worker()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pChannel->iActFreq != pChannel->iUsedFreq) // new psx frequency?
|
if (pChannel->iActFreq != pChannel->iUsedFreq) // new psx frequency?
|
||||||
pChannel->VoiceChangeFrequency();
|
pChannel->VoiceChangeFrequency();
|
||||||
|
|
||||||
// loop until 1 ms of data is reached
|
// loop until 1 ms of data is reached
|
||||||
int ns = 0;
|
int ns = 0;
|
||||||
while (ns < NSSIZE) {
|
while (ns < NSSIZE) {
|
||||||
while (pChannel->spos >= 0x10000) {
|
while (pChannel->spos >= 0x10000) {
|
||||||
if (pChannel->iSBPos == 28) // 28 reached?
|
if (pChannel->iSBPos == 28) // 28 reached?
|
||||||
{
|
{
|
||||||
start = pChannel->pCurr; // set up the current pos
|
start = pChannel->pCurr; // set up the current pos
|
||||||
|
|
||||||
// special "stop" sign
|
// special "stop" sign
|
||||||
if (start == (u8 *)-1) //!pChannel->bOn
|
if (start == (u8 *)-1) //!pChannel->bOn
|
||||||
{
|
{
|
||||||
pChannel->bOn = false; // -> turn everything off
|
pChannel->bOn = false; // -> turn everything off
|
||||||
pChannel->ADSRX.lVolume = 0;
|
pChannel->ADSRX.lVolume = 0;
|
||||||
pChannel->ADSRX.EnvelopeVol = 0;
|
pChannel->ADSRX.EnvelopeVol = 0;
|
||||||
goto ENDX; // -> and done for this channel
|
goto ENDX; // -> and done for this channel
|
||||||
}
|
}
|
||||||
|
|
||||||
pChannel->iSBPos = 0;
|
pChannel->iSBPos = 0;
|
||||||
|
@ -524,15 +524,15 @@ void SPU2Worker()
|
||||||
|
|
||||||
// flag handler
|
// flag handler
|
||||||
if ((flags & 4) && (!pChannel->bIgnoreLoop))
|
if ((flags & 4) && (!pChannel->bIgnoreLoop))
|
||||||
pChannel->pLoop = start - 16; // loop adress
|
pChannel->pLoop = start - 16; // loop adress
|
||||||
|
|
||||||
if (flags & 1) // 1: stop/loop
|
if (flags & 1) // 1: stop/loop
|
||||||
{
|
{
|
||||||
// We play this block out first...
|
// We play this block out first...
|
||||||
dwEndChannel2[ch / 24] |= (1 << (ch % 24));
|
dwEndChannel2[ch / 24] |= (1 << (ch % 24));
|
||||||
//if(!(flags&2)) // 1+2: do loop... otherwise: stop
|
//if(!(flags&2)) // 1+2: do loop... otherwise: stop
|
||||||
if (flags != 3 || pChannel->pLoop == NULL) // PETE: if we don't check exactly for 3, loop hang ups will happen (DQ4, for example)
|
if (flags != 3 || pChannel->pLoop == NULL) // PETE: if we don't check exactly for 3, loop hang ups will happen (DQ4, for example)
|
||||||
{ // and checking if pLoop is set avoids crashes, yeah
|
{ // and checking if pLoop is set avoids crashes, yeah
|
||||||
start = (u8 *)-1;
|
start = (u8 *)-1;
|
||||||
pChannel->bStop = true;
|
pChannel->bStop = true;
|
||||||
pChannel->bIgnoreLoop = false;
|
pChannel->bIgnoreLoop = false;
|
||||||
|
@ -541,10 +541,10 @@ void SPU2Worker()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pChannel->pCurr = start; // store values for next cycle
|
pChannel->pCurr = start; // store values for next cycle
|
||||||
}
|
}
|
||||||
|
|
||||||
pChannel->iSBPos++; // get sample data
|
pChannel->iSBPos++; // get sample data
|
||||||
pChannel->spos -= 0x10000;
|
pChannel->spos -= 0x10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,16 +612,16 @@ SPU2readDMA4Mem(u16 *pMem, int size)
|
||||||
irqCallbackSPU2();
|
irqCallbackSPU2();
|
||||||
}
|
}
|
||||||
|
|
||||||
spuaddr++; // inc spu addr
|
spuaddr++; // inc spu addr
|
||||||
if (spuaddr > 0x0fffff) // wrap at 2Mb
|
if (spuaddr > 0x0fffff) // wrap at 2Mb
|
||||||
spuaddr = 0; // wrap
|
spuaddr = 0; // wrap
|
||||||
}
|
}
|
||||||
|
|
||||||
spuaddr += 19; //Transfer Local To Host TSAH/L + Data Size + 20 (already +1'd)
|
spuaddr += 19; //Transfer Local To Host TSAH/L + Data Size + 20 (already +1'd)
|
||||||
C0_SPUADDR_SET(spuaddr);
|
C0_SPUADDR_SET(spuaddr);
|
||||||
|
|
||||||
// got from J.F. and Kanodin... is it needed?
|
// got from J.F. and Kanodin... is it needed?
|
||||||
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80; // DMA complete
|
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80; // DMA complete
|
||||||
SPUStartCycle[0] = SPUCycles;
|
SPUStartCycle[0] = SPUCycles;
|
||||||
SPUTargetCycle[0] = size;
|
SPUTargetCycle[0] = size;
|
||||||
interrupt |= (1 << 1);
|
interrupt |= (1 << 1);
|
||||||
|
@ -643,16 +643,16 @@ SPU2readDMA7Mem(u16 *pMem, int size)
|
||||||
IRQINFO |= 8;
|
IRQINFO |= 8;
|
||||||
irqCallbackSPU2();
|
irqCallbackSPU2();
|
||||||
}
|
}
|
||||||
spuaddr++; // inc spu addr
|
spuaddr++; // inc spu addr
|
||||||
if (spuaddr > 0x0fffff) // wrap at 2Mb
|
if (spuaddr > 0x0fffff) // wrap at 2Mb
|
||||||
spuaddr = 0; // wrap
|
spuaddr = 0; // wrap
|
||||||
}
|
}
|
||||||
|
|
||||||
spuaddr += 19; //Transfer Local To Host TSAH/L + Data Size + 20 (already +1'd)
|
spuaddr += 19; //Transfer Local To Host TSAH/L + Data Size + 20 (already +1'd)
|
||||||
C1_SPUADDR_SET(spuaddr);
|
C1_SPUADDR_SET(spuaddr);
|
||||||
|
|
||||||
// got from J.F. and Kanodin... is it needed?
|
// got from J.F. and Kanodin... is it needed?
|
||||||
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80; // DMA complete
|
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80; // DMA complete
|
||||||
SPUStartCycle[1] = SPUCycles;
|
SPUStartCycle[1] = SPUCycles;
|
||||||
SPUTargetCycle[1] = size;
|
SPUTargetCycle[1] = size;
|
||||||
interrupt |= (1 << 2);
|
interrupt |= (1 << 2);
|
||||||
|
@ -686,7 +686,7 @@ int ADMAS4Write()
|
||||||
Adma4.AmountLeft -= 512;
|
Adma4.AmountLeft -= 512;
|
||||||
if (Adma4.AmountLeft == 0) {
|
if (Adma4.AmountLeft == 0) {
|
||||||
SPUStartCycle[0] = SPUCycles;
|
SPUStartCycle[0] = SPUCycles;
|
||||||
SPUTargetCycle[0] = 1; //512*48000;
|
SPUTargetCycle[0] = 1; //512*48000;
|
||||||
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80;
|
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80;
|
||||||
interrupt |= (1 << 1);
|
interrupt |= (1 << 1);
|
||||||
}
|
}
|
||||||
|
@ -713,7 +713,7 @@ int ADMAS7Write()
|
||||||
Adma7.AmountLeft -= 512;
|
Adma7.AmountLeft -= 512;
|
||||||
if (Adma7.AmountLeft == 0) {
|
if (Adma7.AmountLeft == 0) {
|
||||||
SPUStartCycle[1] = SPUCycles;
|
SPUStartCycle[1] = SPUCycles;
|
||||||
SPUTargetCycle[1] = 1; //512*48000;
|
SPUTargetCycle[1] = 1; //512*48000;
|
||||||
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80;
|
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80;
|
||||||
interrupt |= (1 << 2);
|
interrupt |= (1 << 2);
|
||||||
}
|
}
|
||||||
|
@ -754,7 +754,7 @@ SPU2writeDMA4Mem(u16 *pMem, int size)
|
||||||
MemAddr[0] += size << 1;
|
MemAddr[0] += size << 1;
|
||||||
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80;
|
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80;
|
||||||
SPUStartCycle[0] = SPUCycles;
|
SPUStartCycle[0] = SPUCycles;
|
||||||
SPUTargetCycle[0] = 1; //iSize;
|
SPUTargetCycle[0] = 1; //iSize;
|
||||||
interrupt |= (1 << 1);
|
interrupt |= (1 << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -792,7 +792,7 @@ SPU2writeDMA7Mem(u16 *pMem, int size)
|
||||||
MemAddr[1] += size << 1;
|
MemAddr[1] += size << 1;
|
||||||
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80;
|
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80;
|
||||||
SPUStartCycle[1] = SPUCycles;
|
SPUStartCycle[1] = SPUCycles;
|
||||||
SPUTargetCycle[1] = 1; //iSize;
|
SPUTargetCycle[1] = 1; //iSize;
|
||||||
interrupt |= (1 << 2);
|
interrupt |= (1 << 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,11 +818,11 @@ SPU2interruptDMA7()
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn channels on
|
// turn channels on
|
||||||
void SoundOn(s32 start, s32 end, u16 val) // SOUND ON PSX COMAND
|
void SoundOn(s32 start, s32 end, u16 val) // SOUND ON PSX COMAND
|
||||||
{
|
{
|
||||||
for (s32 ch = start; ch < end; ch++, val >>= 1) // loop channels
|
for (s32 ch = start; ch < end; ch++, val >>= 1) // loop channels
|
||||||
{
|
{
|
||||||
if ((val & 1) && voices[ch].pStart) // mmm... start has to be set before key on !?!
|
if ((val & 1) && voices[ch].pStart) // mmm... start has to be set before key on !?!
|
||||||
{
|
{
|
||||||
voices[ch].bNew = true;
|
voices[ch].bNew = true;
|
||||||
voices[ch].bIgnoreLoop = false;
|
voices[ch].bIgnoreLoop = false;
|
||||||
|
@ -831,22 +831,22 @@ void SoundOn(s32 start, s32 end, u16 val) // SOUND ON PSX COMAND
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn channels off
|
// turn channels off
|
||||||
void SoundOff(s32 start, s32 end, u16 val) // SOUND OFF PSX COMMAND
|
void SoundOff(s32 start, s32 end, u16 val) // SOUND OFF PSX COMMAND
|
||||||
{
|
{
|
||||||
for (s32 ch = start; ch < end; ch++, val >>= 1) // loop channels
|
for (s32 ch = start; ch < end; ch++, val >>= 1) // loop channels
|
||||||
{
|
{
|
||||||
if (val & 1) // && s_chan[i].bOn) mmm...
|
if (val & 1) // && s_chan[i].bOn) mmm...
|
||||||
voices[ch].bStop = true;
|
voices[ch].bStop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FModOn(s32 start, s32 end, u16 val) // FMOD ON PSX COMMAND
|
void FModOn(s32 start, s32 end, u16 val) // FMOD ON PSX COMMAND
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
for (ch = start; ch < end; ch++, val >>= 1) // loop channels
|
for (ch = start; ch < end; ch++, val >>= 1) // loop channels
|
||||||
{
|
{
|
||||||
if (val & 1) // -> fmod on/off
|
if (val & 1) // -> fmod on/off
|
||||||
{
|
{
|
||||||
if (ch > 0) {
|
if (ch > 0) {
|
||||||
}
|
}
|
||||||
|
@ -870,7 +870,7 @@ SPU2write(u32 mem, u16 value)
|
||||||
u32 r = mem & 0xffff;
|
u32 r = mem & 0xffff;
|
||||||
|
|
||||||
// channel info
|
// channel info
|
||||||
if ((r >= 0x0000 && r < 0x0180) || (r >= 0x0400 && r < 0x0580)) // some channel info?
|
if ((r >= 0x0000 && r < 0x0180) || (r >= 0x0400 && r < 0x0580)) // some channel info?
|
||||||
{
|
{
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
if (r >= 0x400)
|
if (r >= 0x400)
|
||||||
|
@ -888,16 +888,16 @@ SPU2write(u32 mem, u16 value)
|
||||||
case 4: {
|
case 4: {
|
||||||
int NP;
|
int NP;
|
||||||
if (value > 0x3fff)
|
if (value > 0x3fff)
|
||||||
NP = 0x3fff; // get pitch val
|
NP = 0x3fff; // get pitch val
|
||||||
else
|
else
|
||||||
NP = value;
|
NP = value;
|
||||||
|
|
||||||
pvoice->pvoice->pitch = NP;
|
pvoice->pvoice->pitch = NP;
|
||||||
|
|
||||||
NP = (44100L * NP) / 4096L; // calc frequency
|
NP = (44100L * NP) / 4096L; // calc frequency
|
||||||
if (NP < 1)
|
if (NP < 1)
|
||||||
NP = 1; // some security
|
NP = 1; // some security
|
||||||
pvoice->iActFreq = NP; // store frequency
|
pvoice->iActFreq = NP; // store frequency
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: {
|
case 6: {
|
||||||
|
@ -1075,7 +1075,7 @@ SPU2read(u32 mem)
|
||||||
u16 ret;
|
u16 ret;
|
||||||
u32 r = mem & 0xffff;
|
u32 r = mem & 0xffff;
|
||||||
|
|
||||||
if ((r >= 0x0000 && r <= 0x0180) || (r >= 0x0400 && r <= 0x0580)) // some channel info?
|
if ((r >= 0x0000 && r <= 0x0180) || (r >= 0x0400 && r <= 0x0580)) // some channel info?
|
||||||
{
|
{
|
||||||
s32 ch = 0;
|
s32 ch = 0;
|
||||||
|
|
||||||
|
@ -1092,7 +1092,7 @@ SPU2read(u32 mem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r > 0x01c0 && r <= 0x02E0) || (r > 0x05c0 && r <= 0x06E0)) // some channel info?
|
if ((r > 0x01c0 && r <= 0x02E0) || (r > 0x05c0 && r <= 0x06E0)) // some channel info?
|
||||||
{
|
{
|
||||||
s32 ch = 0;
|
s32 ch = 0;
|
||||||
u32 rx = r;
|
u32 rx = r;
|
||||||
|
@ -1193,19 +1193,19 @@ void VOICE_PROCESSED::SetVolume(int iProcessRight)
|
||||||
{
|
{
|
||||||
u16 vol = iProcessRight ? pvoice->right.word : pvoice->left.word;
|
u16 vol = iProcessRight ? pvoice->right.word : pvoice->left.word;
|
||||||
|
|
||||||
if (vol & 0x8000) // sweep not working
|
if (vol & 0x8000) // sweep not working
|
||||||
{
|
{
|
||||||
s16 sInc = 1; // -> sweep up?
|
s16 sInc = 1; // -> sweep up?
|
||||||
if (vol & 0x2000)
|
if (vol & 0x2000)
|
||||||
sInc = -1; // -> or down?
|
sInc = -1; // -> or down?
|
||||||
if (vol & 0x1000)
|
if (vol & 0x1000)
|
||||||
vol ^= 0xffff; // -> mmm... phase inverted? have to investigate this
|
vol ^= 0xffff; // -> mmm... phase inverted? have to investigate this
|
||||||
vol = ((vol & 0x7f) + 1) / 2; // -> sweep: 0..127 -> 0..64
|
vol = ((vol & 0x7f) + 1) / 2; // -> sweep: 0..127 -> 0..64
|
||||||
vol += vol / (2 * sInc); // -> HACK: we don't sweep right now, so we just raise/lower the volume by the half!
|
vol += vol / (2 * sInc); // -> HACK: we don't sweep right now, so we just raise/lower the volume by the half!
|
||||||
vol *= 128;
|
vol *= 128;
|
||||||
} else // no sweep:
|
} else // no sweep:
|
||||||
{
|
{
|
||||||
if (vol & 0x4000) // -> mmm... phase inverted? have to investigate this
|
if (vol & 0x4000) // -> mmm... phase inverted? have to investigate this
|
||||||
vol = 0x3fff - (vol & 0x3fff);
|
vol = 0x3fff - (vol & 0x3fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1217,7 +1217,7 @@ void VOICE_PROCESSED::SetVolume(int iProcessRight)
|
||||||
|
|
||||||
void VOICE_PROCESSED::StartSound()
|
void VOICE_PROCESSED::StartSound()
|
||||||
{
|
{
|
||||||
ADSRX.lVolume = 1; // and init some adsr vars
|
ADSRX.lVolume = 1; // and init some adsr vars
|
||||||
ADSRX.State = 0;
|
ADSRX.State = 0;
|
||||||
ADSRX.EnvelopeVol = 0;
|
ADSRX.EnvelopeVol = 0;
|
||||||
|
|
||||||
|
@ -1225,10 +1225,10 @@ void VOICE_PROCESSED::StartSound()
|
||||||
// setup the reverb effects
|
// setup the reverb effects
|
||||||
}
|
}
|
||||||
|
|
||||||
pCurr = pStart; // set sample start
|
pCurr = pStart; // set sample start
|
||||||
iSBPos = 28;
|
iSBPos = 28;
|
||||||
|
|
||||||
bNew = false; // init channel flags
|
bNew = false; // init channel flags
|
||||||
bStop = false;
|
bStop = false;
|
||||||
bOn = true;
|
bOn = true;
|
||||||
spos = 0x10000L;
|
spos = 0x10000L;
|
||||||
|
@ -1236,7 +1236,7 @@ void VOICE_PROCESSED::StartSound()
|
||||||
|
|
||||||
void VOICE_PROCESSED::VoiceChangeFrequency()
|
void VOICE_PROCESSED::VoiceChangeFrequency()
|
||||||
{
|
{
|
||||||
iUsedFreq = iActFreq; // -> take it and calc steps
|
iUsedFreq = iActFreq; // -> take it and calc steps
|
||||||
sinc = (u32)pvoice->pitch << 4;
|
sinc = (u32)pvoice->pitch << 4;
|
||||||
if (!sinc)
|
if (!sinc)
|
||||||
sinc = 1;
|
sinc = 1;
|
||||||
|
|
|
@ -42,7 +42,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern FILE *spu2Log;
|
extern FILE *spu2Log;
|
||||||
#define SPU2_LOG __Log //debug mode
|
#define SPU2_LOG __Log //debug mode
|
||||||
|
|
||||||
extern const u8 version;
|
extern const u8 version;
|
||||||
extern const u8 revision;
|
extern const u8 revision;
|
||||||
|
@ -115,10 +115,10 @@ void SysMessage(char *fmt, ...);
|
||||||
#define REG_C0_END2 0x0342
|
#define REG_C0_END2 0x0342
|
||||||
#define REG_C1_END1 0x0740
|
#define REG_C1_END1 0x0740
|
||||||
#define REG_C1_END2 0x0742
|
#define REG_C1_END2 0x0742
|
||||||
#define REG_C0_SPUSTAT 0x0344 //not sure!
|
#define REG_C0_SPUSTAT 0x0344 //not sure!
|
||||||
#define REG_C1_CTRL 0x059A
|
#define REG_C1_CTRL 0x059A
|
||||||
#define REG_C1_ADMAS 0x05B0
|
#define REG_C1_ADMAS 0x05B0
|
||||||
#define REG_C1_SPUSTAT 0x0744 //not sure!
|
#define REG_C1_SPUSTAT 0x0744 //not sure!
|
||||||
#define REG_P_MVOLL 0x0760
|
#define REG_P_MVOLL 0x0760
|
||||||
#define REG_P_MVOLR 0x0762
|
#define REG_P_MVOLR 0x0762
|
||||||
#define REG_P_EVOLL 0x0764
|
#define REG_P_EVOLL 0x0764
|
||||||
|
@ -166,8 +166,8 @@ struct SPU_CONTROL_
|
||||||
u16 noiseFreq : 6;
|
u16 noiseFreq : 6;
|
||||||
u16 reverb : 1;
|
u16 reverb : 1;
|
||||||
u16 irq : 1;
|
u16 irq : 1;
|
||||||
u16 dma : 2; // 1 - no dma, 2 - write, 3 - read
|
u16 dma : 2; // 1 - no dma, 2 - write, 3 - read
|
||||||
u16 extr : 1; // external reverb
|
u16 extr : 1; // external reverb
|
||||||
u16 cdreverb : 1;
|
u16 cdreverb : 1;
|
||||||
u16 extAudio : 1;
|
u16 extAudio : 1;
|
||||||
u16 extCd : 1;
|
u16 extCd : 1;
|
||||||
|
@ -189,31 +189,31 @@ struct _SPU_VOICE
|
||||||
u16 Vol : 7;
|
u16 Vol : 7;
|
||||||
u16 res1 : 5;
|
u16 res1 : 5;
|
||||||
u16 Inverted : 1;
|
u16 Inverted : 1;
|
||||||
u16 Decrease : 1; // if 0, increase
|
u16 Decrease : 1; // if 0, increase
|
||||||
u16 ExpSlope : 1; // if 0, linear slope
|
u16 ExpSlope : 1; // if 0, linear slope
|
||||||
u16 Sweep1 : 1; // always one
|
u16 Sweep1 : 1; // always one
|
||||||
} sweep;
|
} sweep;
|
||||||
u16 word;
|
u16 word;
|
||||||
} left, right;
|
} left, right;
|
||||||
|
|
||||||
u16 pitch : 14; // 1000 - no pitch, 2000 - pitch + 1, etc
|
u16 pitch : 14; // 1000 - no pitch, 2000 - pitch + 1, etc
|
||||||
u16 res0 : 2;
|
u16 res0 : 2;
|
||||||
|
|
||||||
u16 SustainLvl : 4;
|
u16 SustainLvl : 4;
|
||||||
u16 DecayRate : 4;
|
u16 DecayRate : 4;
|
||||||
u16 AttackRate : 7;
|
u16 AttackRate : 7;
|
||||||
u16 AttackExp : 1; // if 0, linear
|
u16 AttackExp : 1; // if 0, linear
|
||||||
|
|
||||||
u16 ReleaseRate : 5;
|
u16 ReleaseRate : 5;
|
||||||
u16 ReleaseExp : 1; // if 0, linear
|
u16 ReleaseExp : 1; // if 0, linear
|
||||||
u16 SustainRate : 7;
|
u16 SustainRate : 7;
|
||||||
u16 res1 : 1;
|
u16 res1 : 1;
|
||||||
u16 SustainDec : 1; // if 0, inc
|
u16 SustainDec : 1; // if 0, inc
|
||||||
u16 SustainExp : 1; // if 0, linear
|
u16 SustainExp : 1; // if 0, linear
|
||||||
|
|
||||||
u16 AdsrVol;
|
u16 AdsrVol;
|
||||||
u16 Address; // add / 8
|
u16 Address; // add / 8
|
||||||
u16 RepeatAddr; // gets reset when sample starts
|
u16 RepeatAddr; // gets reset when sample starts
|
||||||
};
|
};
|
||||||
|
|
||||||
// ADSR INFOS PER CHANNEL
|
// ADSR INFOS PER CHANNEL
|
||||||
|
@ -233,8 +233,8 @@ struct ADSRInfoEx
|
||||||
s32 lVolume;
|
s32 lVolume;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NSSIZE 48 // ~ 1 ms of data
|
#define NSSIZE 48 // ~ 1 ms of data
|
||||||
#define NSFRAMES 16 // gather at least NSFRAMES of NSSIZE before submitting
|
#define NSFRAMES 16 // gather at least NSFRAMES of NSSIZE before submitting
|
||||||
#define NSPACKETS 4
|
#define NSPACKETS 4
|
||||||
#define SPU_VOICE_STATE_SIZE (sizeof(VOICE_PROCESSED) - 4 * sizeof(void *))
|
#define SPU_VOICE_STATE_SIZE (sizeof(VOICE_PROCESSED) - 4 * sizeof(void *))
|
||||||
|
|
||||||
|
@ -258,25 +258,25 @@ struct VOICE_PROCESSED
|
||||||
|
|
||||||
// start save state
|
// start save state
|
||||||
|
|
||||||
s32 iSBPos; // mixing stuff
|
s32 iSBPos; // mixing stuff
|
||||||
s32 spos;
|
s32 spos;
|
||||||
s32 sinc;
|
s32 sinc;
|
||||||
|
|
||||||
s32 iActFreq; // current psx pitch
|
s32 iActFreq; // current psx pitch
|
||||||
s32 iUsedFreq; // current pc pitch
|
s32 iUsedFreq; // current pc pitch
|
||||||
|
|
||||||
s32 iStartAddr, iLoopAddr, iNextAddr;
|
s32 iStartAddr, iLoopAddr, iNextAddr;
|
||||||
|
|
||||||
ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start)
|
ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start)
|
||||||
bool bIgnoreLoop, bNew, bNoise, bReverb, bOn, bStop, bVolChanged;
|
bool bIgnoreLoop, bNew, bNoise, bReverb, bOn, bStop, bVolChanged;
|
||||||
s32 memoffset; // if first core, 0, if second, 0x400
|
s32 memoffset; // if first core, 0, if second, 0x400
|
||||||
|
|
||||||
// end save state
|
// end save state
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
// Sound Buffers //
|
// Sound Buffers //
|
||||||
///////////////////
|
///////////////////
|
||||||
u8 *pStart; // start and end addresses
|
u8 *pStart; // start and end addresses
|
||||||
u8 *pLoop, *pCurr;
|
u8 *pLoop, *pCurr;
|
||||||
|
|
||||||
_SPU_VOICE *pvoice;
|
_SPU_VOICE *pvoice;
|
||||||
|
|
|
@ -50,12 +50,12 @@ void LoadConfig()
|
||||||
if (!szTemp)
|
if (!szTemp)
|
||||||
return;
|
return;
|
||||||
strcpy(szTemp, "\\inis\\spu2null.ini");
|
strcpy(szTemp, "\\inis\\spu2null.ini");
|
||||||
fp = fopen("inis\\usbnull.ini", "rt"); //check if usbnull.ini really exists
|
fp = fopen("inis\\usbnull.ini", "rt"); //check if usbnull.ini really exists
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
CreateDirectory("inis", NULL);
|
CreateDirectory("inis", NULL);
|
||||||
memset(&conf, 0, sizeof(conf));
|
memset(&conf, 0, sizeof(conf));
|
||||||
conf.Log = 0; //default value
|
conf.Log = 0; //default value
|
||||||
SaveConfig(); //save and return
|
SaveConfig(); //save and return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
|
@ -93,10 +93,10 @@ void CALLBACK SPU2about()
|
||||||
(DLGPROC)AboutDlgProc);
|
(DLGPROC)AboutDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
LPVOID lpReserved)
|
LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
hInst = (HINSTANCE)hModule;
|
hInst = (HINSTANCE)hModule;
|
||||||
return TRUE; // very quick :)
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ string s_strLogPath = "logs";
|
||||||
|
|
||||||
const unsigned char version = PS2E_USB_VERSION;
|
const unsigned char version = PS2E_USB_VERSION;
|
||||||
const unsigned char revision = 0;
|
const unsigned char revision = 0;
|
||||||
const unsigned char build = 7; // increase that with each version
|
const unsigned char build = 7; // increase that with each version
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define snprintf sprintf_s
|
#define snprintf sprintf_s
|
||||||
|
|
|
@ -50,12 +50,12 @@ void LoadConfig()
|
||||||
if (!szTemp)
|
if (!szTemp)
|
||||||
return;
|
return;
|
||||||
strcpy(szTemp, "\\inis\\usbnull.ini");
|
strcpy(szTemp, "\\inis\\usbnull.ini");
|
||||||
fp = fopen("inis\\usbnull.ini", "rt"); //check if usbnull.ini really exists
|
fp = fopen("inis\\usbnull.ini", "rt"); //check if usbnull.ini really exists
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
CreateDirectory("inis", NULL);
|
CreateDirectory("inis", NULL);
|
||||||
memset(&conf, 0, sizeof(conf));
|
memset(&conf, 0, sizeof(conf));
|
||||||
conf.Log = 0; //default value
|
conf.Log = 0; //default value
|
||||||
SaveConfig(); //save and return
|
SaveConfig(); //save and return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
|
@ -93,10 +93,10 @@ void CALLBACK USBabout()
|
||||||
(DLGPROC)AboutDlgProc);
|
(DLGPROC)AboutDlgProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
LPVOID lpReserved)
|
LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
hInst = (HINSTANCE)hModule;
|
hInst = (HINSTANCE)hModule;
|
||||||
return TRUE; // very quick :)
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,9 @@ const unsigned char build = 10;
|
||||||
HINSTANCE hinst;
|
HINSTANCE hinst;
|
||||||
|
|
||||||
BOOL WINAPI DllMain(
|
BOOL WINAPI DllMain(
|
||||||
HINSTANCE hinstDLL, // handle to DLL module
|
HINSTANCE hinstDLL, // handle to DLL module
|
||||||
DWORD fdwReason, // reason for calling function
|
DWORD fdwReason, // reason for calling function
|
||||||
LPVOID lpvReserved // reserved
|
LPVOID lpvReserved // reserved
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (fdwReason == DLL_PROCESS_ATTACH) {
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||||
|
@ -307,7 +307,7 @@ s32 CALLBACK CDVDreadTrack(u32 lsn, int mode)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lsn > tracks[0].length) { // track 0 is total disc.
|
if (lsn > tracks[0].length) { // track 0 is total disc.
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ *subq)
|
||||||
{
|
{
|
||||||
// the formatted subq command returns: control/adr, track, index, trk min, trk sec, trk frm, 0x00, abs min, abs sec, abs frm
|
// the formatted subq command returns: control/adr, track, index, trk min, trk sec, trk frm, 0x00, abs min, abs sec, abs frm
|
||||||
|
|
||||||
if (lsn > tracks[0].length) // track 0 is total disc.
|
if (lsn > tracks[0].length) // track 0 is total disc.
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(subq, 0, sizeof(cdvdSubQ));
|
memset(subq, 0, sizeof(cdvdSubQ));
|
||||||
|
@ -428,7 +428,7 @@ s32 CALLBACK CDVDgetTOC(u8 *tocBuff)
|
||||||
if (mt < 0)
|
if (mt < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (mt == 0) { //single layer
|
if (mt == 0) { //single layer
|
||||||
// fake it
|
// fake it
|
||||||
tocBuff[0] = 0x04;
|
tocBuff[0] = 0x04;
|
||||||
tocBuff[1] = 0x02;
|
tocBuff[1] = 0x02;
|
||||||
|
@ -437,11 +437,11 @@ s32 CALLBACK CDVDgetTOC(u8 *tocBuff)
|
||||||
tocBuff[4] = 0x86;
|
tocBuff[4] = 0x86;
|
||||||
tocBuff[5] = 0x72;
|
tocBuff[5] = 0x72;
|
||||||
|
|
||||||
tocBuff[16] = 0x00; // first sector for layer 0
|
tocBuff[16] = 0x00; // first sector for layer 0
|
||||||
tocBuff[17] = 0x03;
|
tocBuff[17] = 0x03;
|
||||||
tocBuff[18] = 0x00;
|
tocBuff[18] = 0x00;
|
||||||
tocBuff[19] = 0x00;
|
tocBuff[19] = 0x00;
|
||||||
} else if (mt == 1) { //PTP
|
} else if (mt == 1) { //PTP
|
||||||
u32 layer1start = src->GetLayerBreakAddress() + 0x30000;
|
u32 layer1start = src->GetLayerBreakAddress() + 0x30000;
|
||||||
|
|
||||||
// dual sided
|
// dual sided
|
||||||
|
@ -452,7 +452,7 @@ s32 CALLBACK CDVDgetTOC(u8 *tocBuff)
|
||||||
tocBuff[4] = 0x41;
|
tocBuff[4] = 0x41;
|
||||||
tocBuff[5] = 0x95;
|
tocBuff[5] = 0x95;
|
||||||
|
|
||||||
tocBuff[14] = 0x61; // PTP
|
tocBuff[14] = 0x61; // PTP
|
||||||
|
|
||||||
tocBuff[16] = 0x00;
|
tocBuff[16] = 0x00;
|
||||||
tocBuff[17] = 0x03;
|
tocBuff[17] = 0x03;
|
||||||
|
@ -463,7 +463,7 @@ s32 CALLBACK CDVDgetTOC(u8 *tocBuff)
|
||||||
tocBuff[21] = (layer1start >> 16) & 0xff;
|
tocBuff[21] = (layer1start >> 16) & 0xff;
|
||||||
tocBuff[22] = (layer1start >> 8) & 0xff;
|
tocBuff[22] = (layer1start >> 8) & 0xff;
|
||||||
tocBuff[23] = (layer1start >> 0) & 0xff;
|
tocBuff[23] = (layer1start >> 0) & 0xff;
|
||||||
} else { //OTP
|
} else { //OTP
|
||||||
u32 layer1start = src->GetLayerBreakAddress() + 0x30000;
|
u32 layer1start = src->GetLayerBreakAddress() + 0x30000;
|
||||||
|
|
||||||
// dual sided
|
// dual sided
|
||||||
|
@ -474,7 +474,7 @@ s32 CALLBACK CDVDgetTOC(u8 *tocBuff)
|
||||||
tocBuff[4] = 0x41;
|
tocBuff[4] = 0x41;
|
||||||
tocBuff[5] = 0x95;
|
tocBuff[5] = 0x95;
|
||||||
|
|
||||||
tocBuff[14] = 0x71; // OTP
|
tocBuff[14] = 0x71; // OTP
|
||||||
|
|
||||||
tocBuff[16] = 0x00;
|
tocBuff[16] = 0x00;
|
||||||
tocBuff[17] = 0x03;
|
tocBuff[17] = 0x03;
|
||||||
|
@ -527,7 +527,7 @@ s32 CALLBACK CDVDgetTOC(u8 *tocBuff)
|
||||||
err = CDVDgetTD(i, &trackInfo);
|
err = CDVDgetTD(i, &trackInfo);
|
||||||
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
|
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
|
||||||
tocBuff[i * 10 + 30] = trackInfo.type;
|
tocBuff[i * 10 + 30] = trackInfo.type;
|
||||||
tocBuff[i * 10 + 32] = err == -1 ? 0 : itob(i); //number
|
tocBuff[i * 10 + 32] = err == -1 ? 0 : itob(i); //number
|
||||||
tocBuff[i * 10 + 37] = itob(min);
|
tocBuff[i * 10 + 37] = itob(min);
|
||||||
tocBuff[i * 10 + 38] = itob(sec);
|
tocBuff[i * 10 + 38] = itob(sec);
|
||||||
tocBuff[i * 10 + 39] = itob(frm);
|
tocBuff[i * 10 + 39] = itob(frm);
|
||||||
|
|
|
@ -60,7 +60,7 @@ typedef struct _toc_data
|
||||||
|
|
||||||
extern toc_data cdtoc;
|
extern toc_data cdtoc;
|
||||||
|
|
||||||
class Source //abstract class as base for source modules
|
class Source //abstract class as base for source modules
|
||||||
{
|
{
|
||||||
Source(Source &);
|
Source(Source &);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
int lsn;
|
int lsn;
|
||||||
int mode;
|
int mode;
|
||||||
char data[2352 * 16]; //we will read in blocks of 16 sectors
|
char data[2352 * 16]; //we will read in blocks of 16 sectors
|
||||||
} SectorInfo;
|
} SectorInfo;
|
||||||
|
|
||||||
//bits: 12 would use 1<<12 entries, or 4096*16 sectors ~ 128MB
|
//bits: 12 would use 1<<12 entries, or 4096*16 sectors ~ 128MB
|
||||||
|
@ -115,7 +115,7 @@ bool cdvdUpdateDiscStatus()
|
||||||
{
|
{
|
||||||
int change = src->DiscChanged();
|
int change = src->DiscChanged();
|
||||||
|
|
||||||
if (change == -1) { //error getting status (no disc in drive?)
|
if (change == -1) { //error getting status (no disc in drive?)
|
||||||
//try to recreate the device
|
//try to recreate the device
|
||||||
src->Reopen();
|
src->Reopen();
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ s32 cdvdRequestSector(u32 sector, s32 mode)
|
||||||
if (sector >= tracks[0].length)
|
if (sector >= tracks[0].length)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
sector &= ~15; //align to 16-sector block
|
sector &= ~15; //align to 16-sector block
|
||||||
|
|
||||||
threadRequestInfo.lsn = sector;
|
threadRequestInfo.lsn = sector;
|
||||||
threadRequestInfo.mode = mode;
|
threadRequestInfo.mode = mode;
|
||||||
|
@ -330,7 +330,7 @@ s32 cdvdDirectReadSector(s32 first, s32 mode, char *buffer)
|
||||||
if ((u32)first >= tracks[0].length)
|
if ((u32)first >= tracks[0].length)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
s32 sector = first & (~15); //align to 16-sector block
|
s32 sector = first & (~15); //align to 16-sector block
|
||||||
|
|
||||||
EnterCriticalSection(&CacheMutex);
|
EnterCriticalSection(&CacheMutex);
|
||||||
if (!cdvdCacheFetch(sector, mode, data)) {
|
if (!cdvdCacheFetch(sector, mode, data)) {
|
||||||
|
|
|
@ -75,7 +75,7 @@ s32 cdvdParseTOC()
|
||||||
etrack = cdtoc.Descriptors[i].Msf[0];
|
etrack = cdtoc.Descriptors[i].Msf[0];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0xa2: // session size
|
case 0xa2: // session size
|
||||||
if (cdtoc.Descriptors[i].SessionNumber == cdtoc.LastCompleteSession) {
|
if (cdtoc.Descriptors[i].SessionNumber == cdtoc.LastCompleteSession) {
|
||||||
min = cdtoc.Descriptors[i].Msf[0];
|
min = cdtoc.Descriptors[i].Msf[0];
|
||||||
sec = cdtoc.Descriptors[i].Msf[1];
|
sec = cdtoc.Descriptors[i].Msf[1];
|
||||||
|
|
|
@ -153,13 +153,13 @@ s32 IOCtlSrc::GetSectorCount()
|
||||||
dvdrs.LayerNumber = 0;
|
dvdrs.LayerNumber = 0;
|
||||||
if (DeviceIoControl(device, IOCTL_DVD_READ_STRUCTURE, &dvdrs, sizeof(dvdrs), &dld, sizeof(dld), &size, NULL) != 0) {
|
if (DeviceIoControl(device, IOCTL_DVD_READ_STRUCTURE, &dvdrs, sizeof(dvdrs), &dld, sizeof(dld), &size, NULL) != 0) {
|
||||||
s32 sectors1 = _byteswap_ulong(dld.ld.EndDataSector) - _byteswap_ulong(dld.ld.StartingDataSector) + 1;
|
s32 sectors1 = _byteswap_ulong(dld.ld.EndDataSector) - _byteswap_ulong(dld.ld.StartingDataSector) + 1;
|
||||||
if (dld.ld.NumberOfLayers == 1) { // PTP, OTP
|
if (dld.ld.NumberOfLayers == 1) { // PTP, OTP
|
||||||
if (dld.ld.TrackPath == 0) { // PTP
|
if (dld.ld.TrackPath == 0) { // PTP
|
||||||
dvdrs.LayerNumber = 1;
|
dvdrs.LayerNumber = 1;
|
||||||
if (DeviceIoControl(device, IOCTL_DVD_READ_STRUCTURE, &dvdrs, sizeof(dvdrs), &dld, sizeof(dld), &size, nullptr) != 0) {
|
if (DeviceIoControl(device, IOCTL_DVD_READ_STRUCTURE, &dvdrs, sizeof(dvdrs), &dld, sizeof(dld), &size, nullptr) != 0) {
|
||||||
sectors1 += _byteswap_ulong(dld.ld.EndDataSector) - _byteswap_ulong(dld.ld.StartingDataSector) + 1;
|
sectors1 += _byteswap_ulong(dld.ld.EndDataSector) - _byteswap_ulong(dld.ld.StartingDataSector) + 1;
|
||||||
}
|
}
|
||||||
} else { // OTP
|
} else { // OTP
|
||||||
// sectors = end_sector - (~end_sector_l0 & 0xFFFFFF) + end_sector_l0 - start_sector
|
// sectors = end_sector - (~end_sector_l0 & 0xFFFFFF) + end_sector_l0 - start_sector
|
||||||
dld.ld.EndLayerZeroSector = _byteswap_ulong(dld.ld.EndLayerZeroSector);
|
dld.ld.EndLayerZeroSector = _byteswap_ulong(dld.ld.EndLayerZeroSector);
|
||||||
sectors1 += dld.ld.EndLayerZeroSector - (~dld.ld.EndLayerZeroSector & 0x00FFFFFF) + 1;
|
sectors1 += dld.ld.EndLayerZeroSector - (~dld.ld.EndLayerZeroSector & 0x00FFFFFF) + 1;
|
||||||
|
@ -189,11 +189,11 @@ s32 IOCtlSrc::GetLayerBreakAddress()
|
||||||
dvdrs.SessionId = sessID;
|
dvdrs.SessionId = sessID;
|
||||||
dvdrs.LayerNumber = 0;
|
dvdrs.LayerNumber = 0;
|
||||||
if (DeviceIoControl(device, IOCTL_DVD_READ_STRUCTURE, &dvdrs, sizeof(dvdrs), &dld, sizeof(dld), &size, nullptr)) {
|
if (DeviceIoControl(device, IOCTL_DVD_READ_STRUCTURE, &dvdrs, sizeof(dvdrs), &dld, sizeof(dld), &size, nullptr)) {
|
||||||
if (dld.ld.NumberOfLayers == 0) { // Single layer
|
if (dld.ld.NumberOfLayers == 0) { // Single layer
|
||||||
layerBreak = 0;
|
layerBreak = 0;
|
||||||
} else if (dld.ld.TrackPath == 0) { // PTP
|
} else if (dld.ld.TrackPath == 0) { // PTP
|
||||||
layerBreak = _byteswap_ulong(dld.ld.EndDataSector) - _byteswap_ulong(dld.ld.StartingDataSector);
|
layerBreak = _byteswap_ulong(dld.ld.EndDataSector) - _byteswap_ulong(dld.ld.StartingDataSector);
|
||||||
} else { // OTP
|
} else { // OTP
|
||||||
layerBreak = _byteswap_ulong(dld.ld.EndLayerZeroSector) - _byteswap_ulong(dld.ld.StartingDataSector);
|
layerBreak = _byteswap_ulong(dld.ld.EndLayerZeroSector) - _byteswap_ulong(dld.ld.StartingDataSector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,9 +212,9 @@ void IOCtlSrc::SetSpindleSpeed(bool restore_defaults)
|
||||||
USHORT speed = 0;
|
USHORT speed = 0;
|
||||||
|
|
||||||
if (GetMediaType() < 0)
|
if (GetMediaType() < 0)
|
||||||
speed = 4800; // CD-ROM to ~32x (PS2 has 24x (3600 KB/s))
|
speed = 4800; // CD-ROM to ~32x (PS2 has 24x (3600 KB/s))
|
||||||
else
|
else
|
||||||
speed = 11080; // DVD-ROM to ~8x (PS2 has 4x (5540 KB/s))
|
speed = 11080; // DVD-ROM to ~8x (PS2 has 4x (5540 KB/s))
|
||||||
|
|
||||||
if (!restore_defaults) {
|
if (!restore_defaults) {
|
||||||
CDROM_SET_SPEED s;
|
CDROM_SET_SPEED s;
|
||||||
|
@ -224,11 +224,11 @@ void IOCtlSrc::SetSpindleSpeed(bool restore_defaults)
|
||||||
s.WriteSpeed = speed;
|
s.WriteSpeed = speed;
|
||||||
|
|
||||||
if (DeviceIoControl(device,
|
if (DeviceIoControl(device,
|
||||||
IOCTL_CDROM_SET_SPEED, //operation to perform
|
IOCTL_CDROM_SET_SPEED, //operation to perform
|
||||||
&s, sizeof(s), //no input buffer
|
&s, sizeof(s), //no input buffer
|
||||||
NULL, 0, //output buffer
|
NULL, 0, //output buffer
|
||||||
&dontcare, //#bytes returned
|
&dontcare, //#bytes returned
|
||||||
(LPOVERLAPPED)NULL)) //synchronous I/O == 0)
|
(LPOVERLAPPED)NULL)) //synchronous I/O == 0)
|
||||||
{
|
{
|
||||||
printf(" * CDVD: setSpindleSpeed success (%uKB/s)\n", speed);
|
printf(" * CDVD: setSpindleSpeed success (%uKB/s)\n", speed);
|
||||||
} else {
|
} else {
|
||||||
|
@ -238,15 +238,15 @@ void IOCtlSrc::SetSpindleSpeed(bool restore_defaults)
|
||||||
CDROM_SET_SPEED s;
|
CDROM_SET_SPEED s;
|
||||||
s.RequestType = CdromSetSpeed;
|
s.RequestType = CdromSetSpeed;
|
||||||
s.RotationControl = CdromDefaultRotation;
|
s.RotationControl = CdromDefaultRotation;
|
||||||
s.ReadSpeed = 0xffff; // maximum ?
|
s.ReadSpeed = 0xffff; // maximum ?
|
||||||
s.WriteSpeed = 0xffff;
|
s.WriteSpeed = 0xffff;
|
||||||
|
|
||||||
DeviceIoControl(device,
|
DeviceIoControl(device,
|
||||||
IOCTL_CDROM_SET_SPEED, //operation to perform
|
IOCTL_CDROM_SET_SPEED, //operation to perform
|
||||||
&s, sizeof(s), //no input buffer
|
&s, sizeof(s), //no input buffer
|
||||||
NULL, 0, //output buffer
|
NULL, 0, //output buffer
|
||||||
&dontcare, //#bytes returned
|
&dontcare, //#bytes returned
|
||||||
(LPOVERLAPPED)NULL); //synchronous I/O == 0)
|
(LPOVERLAPPED)NULL); //synchronous I/O == 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,11 +275,11 @@ s32 IOCtlSrc::GetMediaType()
|
||||||
dvdrs.SessionId = sessID;
|
dvdrs.SessionId = sessID;
|
||||||
dvdrs.LayerNumber = 0;
|
dvdrs.LayerNumber = 0;
|
||||||
if (DeviceIoControl(device, IOCTL_DVD_READ_STRUCTURE, &dvdrs, sizeof(dvdrs), &dld, sizeof(dld), &size, nullptr)) {
|
if (DeviceIoControl(device, IOCTL_DVD_READ_STRUCTURE, &dvdrs, sizeof(dvdrs), &dld, sizeof(dld), &size, nullptr)) {
|
||||||
if (dld.ld.NumberOfLayers == 0) { // Single layer
|
if (dld.ld.NumberOfLayers == 0) { // Single layer
|
||||||
mediaType = 0;
|
mediaType = 0;
|
||||||
} else if (dld.ld.TrackPath == 0) { // PTP
|
} else if (dld.ld.TrackPath == 0) { // PTP
|
||||||
mediaType = 1;
|
mediaType = 1;
|
||||||
} else { // OTP
|
} else { // OTP
|
||||||
mediaType = 2;
|
mediaType = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ using namespace std;
|
||||||
|
|
||||||
const unsigned char version = PS2E_DEV9_VERSION;
|
const unsigned char version = PS2E_DEV9_VERSION;
|
||||||
const unsigned char revision = 0;
|
const unsigned char revision = 0;
|
||||||
const unsigned char build = 5; // increase that with each version
|
const unsigned char build = 5; // increase that with each version
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define snprintf sprintf_s
|
#define snprintf sprintf_s
|
||||||
|
|
|
@ -50,6 +50,6 @@ void GamePad::DoRumble(int type, int pad)
|
||||||
void GamePad::UpdateGamePadState()
|
void GamePad::UpdateGamePadState()
|
||||||
{
|
{
|
||||||
#ifdef SDL_BUILD
|
#ifdef SDL_BUILD
|
||||||
SDL_JoystickUpdate(); // No need to make yet another function call for that
|
SDL_JoystickUpdate(); // No need to make yet another function call for that
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GamePad(const GamePad &); // copy constructor
|
GamePad(const GamePad &); // copy constructor
|
||||||
GamePad &operator=(const GamePad &); // assignment
|
GamePad &operator=(const GamePad &); // assignment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find every interesting devices and create right structure for them(depend on backend)
|
* Find every interesting devices and create right structure for them(depend on backend)
|
||||||
|
@ -55,7 +55,7 @@ public:
|
||||||
**/
|
**/
|
||||||
static void DoRumble(int type, int pad);
|
static void DoRumble(int type, int pad);
|
||||||
|
|
||||||
virtual bool Init(int id) { return false; } // opens a handle and gets information
|
virtual bool Init(int id) { return false; } // opens a handle and gets information
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for GUI checkbox to give feedback to the user
|
* Used for GUI checkbox to give feedback to the user
|
||||||
|
@ -143,7 +143,7 @@ public:
|
||||||
virtual int GetAxisFromKey(int pad, int index) { return 0; }
|
virtual int GetAxisFromKey(int pad, int index) { return 0; }
|
||||||
// These fields need to be inherited by child classes
|
// These fields need to be inherited by child classes
|
||||||
protected:
|
protected:
|
||||||
string devname; // pretty device name
|
string devname; // pretty device name
|
||||||
int _id;
|
int _id;
|
||||||
int numbuttons, numaxes, numhats;
|
int numbuttons, numaxes, numhats;
|
||||||
int deadzone;
|
int deadzone;
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
// Construtor of GamepadConfiguration
|
// Construtor of GamepadConfiguration
|
||||||
GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
|
GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
|
||||||
: wxDialog(
|
: wxDialog(
|
||||||
parent, // Parent
|
parent, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Gamepad configuration"), // Title
|
_T("Gamepad configuration"), // Title
|
||||||
wxDefaultPosition, // Position
|
wxDefaultPosition, // Position
|
||||||
wxSize(400, 230), // Width + Lenght
|
wxSize(400, 230), // Width + Lenght
|
||||||
// Style
|
// Style
|
||||||
wxSYSTEM_MENU |
|
wxSYSTEM_MENU |
|
||||||
wxCAPTION |
|
wxCAPTION |
|
||||||
|
@ -36,84 +36,84 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
|
||||||
|
|
||||||
m_pad_id = pad;
|
m_pad_id = pad;
|
||||||
m_pan_gamepad_config = new wxPanel(
|
m_pan_gamepad_config = new wxPanel(
|
||||||
this, // Parent
|
this, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
wxDefaultPosition, // Prosition
|
wxDefaultPosition, // Prosition
|
||||||
wxSize(300, 200) // Size
|
wxSize(300, 200) // Size
|
||||||
);
|
);
|
||||||
m_cb_rumble = new wxCheckBox(
|
m_cb_rumble = new wxCheckBox(
|
||||||
m_pan_gamepad_config, // Parent
|
m_pan_gamepad_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("&Enable rumble"), // Label
|
_T("&Enable rumble"), // Label
|
||||||
wxPoint(20, 20) // Position
|
wxPoint(20, 20) // Position
|
||||||
);
|
);
|
||||||
|
|
||||||
m_cb_hack_sixaxis_usb = new wxCheckBox(
|
m_cb_hack_sixaxis_usb = new wxCheckBox(
|
||||||
m_pan_gamepad_config, // Parent
|
m_pan_gamepad_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("&Hack: Sixaxis/DS3 plugged in USB"), // Label
|
_T("&Hack: Sixaxis/DS3 plugged in USB"), // Label
|
||||||
wxPoint(20, 40) // Position
|
wxPoint(20, 40) // Position
|
||||||
);
|
);
|
||||||
|
|
||||||
m_cb_hack_sixaxis_pressure = new wxCheckBox(
|
m_cb_hack_sixaxis_pressure = new wxCheckBox(
|
||||||
m_pan_gamepad_config, // Parent
|
m_pan_gamepad_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("&Hack: Sixaxis/DS3 pressure"), // Label
|
_T("&Hack: Sixaxis/DS3 pressure"), // Label
|
||||||
wxPoint(20, 60) // Position
|
wxPoint(20, 60) // Position
|
||||||
);
|
);
|
||||||
|
|
||||||
wxString txt_rumble = wxT("Rumble intensity");
|
wxString txt_rumble = wxT("Rumble intensity");
|
||||||
m_lbl_rumble_intensity = new wxStaticText(
|
m_lbl_rumble_intensity = new wxStaticText(
|
||||||
m_pan_gamepad_config, // Parent
|
m_pan_gamepad_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
txt_rumble, // Text which must be displayed
|
txt_rumble, // Text which must be displayed
|
||||||
wxPoint(20, 90), // Position
|
wxPoint(20, 90), // Position
|
||||||
wxDefaultSize // Size
|
wxDefaultSize // Size
|
||||||
);
|
);
|
||||||
|
|
||||||
m_sl_rumble_intensity = new wxSlider(
|
m_sl_rumble_intensity = new wxSlider(
|
||||||
m_pan_gamepad_config, // Parent
|
m_pan_gamepad_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
0, // value
|
0, // value
|
||||||
0, // min value 0x0000
|
0, // min value 0x0000
|
||||||
0x7FFF, // max value 0x7FFF
|
0x7FFF, // max value 0x7FFF
|
||||||
wxPoint(150, 83), // Position
|
wxPoint(150, 83), // Position
|
||||||
wxSize(200, 30) // Size
|
wxSize(200, 30) // Size
|
||||||
);
|
);
|
||||||
|
|
||||||
wxString txt_joystick = wxT("Joystick sensibility");
|
wxString txt_joystick = wxT("Joystick sensibility");
|
||||||
m_lbl_rumble_intensity = new wxStaticText(
|
m_lbl_rumble_intensity = new wxStaticText(
|
||||||
m_pan_gamepad_config, // Parent
|
m_pan_gamepad_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
txt_joystick, // Text which must be displayed
|
txt_joystick, // Text which must be displayed
|
||||||
wxPoint(20, 120), // Position
|
wxPoint(20, 120), // Position
|
||||||
wxDefaultSize // Size
|
wxDefaultSize // Size
|
||||||
);
|
);
|
||||||
|
|
||||||
m_sl_joystick_sensibility = new wxSlider(
|
m_sl_joystick_sensibility = new wxSlider(
|
||||||
m_pan_gamepad_config, // Parent
|
m_pan_gamepad_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
0, // value
|
0, // value
|
||||||
0, // min value
|
0, // min value
|
||||||
100, // max value
|
100, // max value
|
||||||
wxPoint(150, 113), // Position
|
wxPoint(150, 113), // Position
|
||||||
wxSize(200, 30) // Size
|
wxSize(200, 30) // Size
|
||||||
);
|
);
|
||||||
|
|
||||||
m_bt_ok = new wxButton(
|
m_bt_ok = new wxButton(
|
||||||
m_pan_gamepad_config, // Parent
|
m_pan_gamepad_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("&OK"), // Label
|
_T("&OK"), // Label
|
||||||
wxPoint(250, 160), // Position
|
wxPoint(250, 160), // Position
|
||||||
wxSize(60, 25) // Size
|
wxSize(60, 25) // Size
|
||||||
);
|
);
|
||||||
|
|
||||||
m_bt_cancel = new wxButton(
|
m_bt_cancel = new wxButton(
|
||||||
m_pan_gamepad_config, // Parent
|
m_pan_gamepad_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("&Cancel"), // Label
|
_T("&Cancel"), // Label
|
||||||
wxPoint(320, 160), // Position
|
wxPoint(320, 160), // Position
|
||||||
wxSize(60, 25) // Size
|
wxSize(60, 25) // Size
|
||||||
);
|
);
|
||||||
|
|
||||||
Bind(wxEVT_BUTTON, &GamepadConfiguration::OnButtonClicked, this);
|
Bind(wxEVT_BUTTON, &GamepadConfiguration::OnButtonClicked, this);
|
||||||
|
@ -130,7 +130,7 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
|
||||||
*/
|
*/
|
||||||
void GamepadConfiguration::InitGamepadConfiguration()
|
void GamepadConfiguration::InitGamepadConfiguration()
|
||||||
{
|
{
|
||||||
repopulate(); // Set label and fit simulated key array
|
repopulate(); // Set label and fit simulated key array
|
||||||
/*
|
/*
|
||||||
* Check if there exist at least one pad available
|
* Check if there exist at least one pad available
|
||||||
* if the pad id is 0, you need at least 1 gamepad connected,
|
* if the pad id is 0, you need at least 1 gamepad connected,
|
||||||
|
@ -146,14 +146,14 @@ void GamepadConfiguration::InitGamepadConfiguration()
|
||||||
|
|
||||||
if (!s_vgamePad[m_pad_id]->TestForce(0.001f)) {
|
if (!s_vgamePad[m_pad_id]->TestForce(0.001f)) {
|
||||||
wxMessageBox(L"Rumble is not available for your device.");
|
wxMessageBox(L"Rumble is not available for your device.");
|
||||||
m_cb_rumble->Disable(); // disable the rumble checkbox
|
m_cb_rumble->Disable(); // disable the rumble checkbox
|
||||||
m_sl_rumble_intensity->Disable(); // disable the rumble intensity slider
|
m_sl_rumble_intensity->Disable(); // disable the rumble intensity slider
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wxMessageBox(L"No gamepad detected.");
|
wxMessageBox(L"No gamepad detected.");
|
||||||
m_sl_joystick_sensibility->Disable(); // disable the joystick sensibility slider
|
m_sl_joystick_sensibility->Disable(); // disable the joystick sensibility slider
|
||||||
m_cb_rumble->Disable(); // disable the rumble checkbox
|
m_cb_rumble->Disable(); // disable the rumble checkbox
|
||||||
m_sl_rumble_intensity->Disable(); // disable the rumble intensity slider
|
m_sl_rumble_intensity->Disable(); // disable the rumble intensity slider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,13 +167,13 @@ void GamepadConfiguration::InitGamepadConfiguration()
|
||||||
void GamepadConfiguration::OnButtonClicked(wxCommandEvent &event)
|
void GamepadConfiguration::OnButtonClicked(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
// Affichage d'un message à chaque clic sur le bouton
|
// Affichage d'un message à chaque clic sur le bouton
|
||||||
wxButton *bt_tmp = (wxButton *)event.GetEventObject(); // get the button object
|
wxButton *bt_tmp = (wxButton *)event.GetEventObject(); // get the button object
|
||||||
int bt_id = bt_tmp->GetId(); // get the real ID
|
int bt_id = bt_tmp->GetId(); // get the real ID
|
||||||
if (bt_id == m_bt_ok->GetId()) { // If the button ID is equals to the Ok button ID
|
if (bt_id == m_bt_ok->GetId()) { // If the button ID is equals to the Ok button ID
|
||||||
Close(); // Close the window
|
Close(); // Close the window
|
||||||
} else if (bt_id == m_bt_cancel->GetId()) { // If the button ID is equals to the cancel button ID
|
} else if (bt_id == m_bt_cancel->GetId()) { // If the button ID is equals to the cancel button ID
|
||||||
reset(); // reinitialize the value of each parameters
|
reset(); // reinitialize the value of each parameters
|
||||||
Close(); // Close the window
|
Close(); // Close the window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,12 +184,12 @@ void GamepadConfiguration::OnButtonClicked(wxCommandEvent &event)
|
||||||
*/
|
*/
|
||||||
void GamepadConfiguration::OnSliderReleased(wxCommandEvent &event)
|
void GamepadConfiguration::OnSliderReleased(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
wxSlider *sl_tmp = (wxSlider *)event.GetEventObject(); // get the slider object
|
wxSlider *sl_tmp = (wxSlider *)event.GetEventObject(); // get the slider object
|
||||||
int sl_id = sl_tmp->GetId(); // slider id
|
int sl_id = sl_tmp->GetId(); // slider id
|
||||||
if (sl_id == m_sl_rumble_intensity->GetId()) { // if this is the rumble intensity slider
|
if (sl_id == m_sl_rumble_intensity->GetId()) { // if this is the rumble intensity slider
|
||||||
u32 intensity = m_sl_rumble_intensity->GetValue(); // get the new value
|
u32 intensity = m_sl_rumble_intensity->GetValue(); // get the new value
|
||||||
conf->set_ff_intensity(intensity); // and set the force feedback intensity value with it
|
conf->set_ff_intensity(intensity); // and set the force feedback intensity value with it
|
||||||
// get the rumble intensity
|
// get the rumble intensity
|
||||||
float strength = m_sl_rumble_intensity->GetValue();
|
float strength = m_sl_rumble_intensity->GetValue();
|
||||||
/*
|
/*
|
||||||
* convert in a float value between 0 and 1, and run rumble feedback
|
* convert in a float value between 0 and 1, and run rumble feedback
|
||||||
|
@ -204,8 +204,8 @@ void GamepadConfiguration::OnSliderReleased(wxCommandEvent &event)
|
||||||
*/
|
*/
|
||||||
s_vgamePad[m_pad_id]->TestForce(strength / 0x7FFF);
|
s_vgamePad[m_pad_id]->TestForce(strength / 0x7FFF);
|
||||||
} else if (sl_id == m_sl_joystick_sensibility->GetId()) {
|
} else if (sl_id == m_sl_joystick_sensibility->GetId()) {
|
||||||
u32 sensibility = m_sl_joystick_sensibility->GetValue(); // get the new value
|
u32 sensibility = m_sl_joystick_sensibility->GetValue(); // get the new value
|
||||||
conf->set_sensibility(sensibility); // and set the joystick sensibility
|
conf->set_sensibility(sensibility); // and set the joystick sensibility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ void GamepadConfiguration::OnSliderReleased(wxCommandEvent &event)
|
||||||
*/
|
*/
|
||||||
void GamepadConfiguration::OnCheckboxChange(wxCommandEvent &event)
|
void GamepadConfiguration::OnCheckboxChange(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
wxCheckBox *cb_tmp = (wxCheckBox *)event.GetEventObject(); // get the slider object
|
wxCheckBox *cb_tmp = (wxCheckBox *)event.GetEventObject(); // get the slider object
|
||||||
int cb_id = cb_tmp->GetId();
|
int cb_id = cb_tmp->GetId();
|
||||||
if (cb_id == m_cb_rumble->GetId()) {
|
if (cb_id == m_cb_rumble->GetId()) {
|
||||||
conf->pad_options[m_pad_id].forcefeedback = (m_cb_rumble->GetValue()) ? (u32)1 : (u32)0;
|
conf->pad_options[m_pad_id].forcefeedback = (m_cb_rumble->GetValue()) ? (u32)1 : (u32)0;
|
||||||
|
@ -267,6 +267,6 @@ void GamepadConfiguration::repopulate()
|
||||||
// enable rumble intensity slider if the checkbox is checked
|
// enable rumble intensity slider if the checkbox is checked
|
||||||
if (m_cb_rumble->GetValue())
|
if (m_cb_rumble->GetValue())
|
||||||
m_sl_rumble_intensity->Enable();
|
m_sl_rumble_intensity->Enable();
|
||||||
else // disable otherwise
|
else // disable otherwise
|
||||||
m_sl_rumble_intensity->Disable();
|
m_sl_rumble_intensity->Disable();
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,4 +57,4 @@ public:
|
||||||
void InitGamepadConfiguration();
|
void InitGamepadConfiguration();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GAMEPADCONFIGURATION_H__
|
#endif // __GAMEPADCONFIGURATION_H__
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
// Construtor of JoystickConfiguration
|
// Construtor of JoystickConfiguration
|
||||||
JoystickConfiguration::JoystickConfiguration(int pad, bool left, wxWindow *parent)
|
JoystickConfiguration::JoystickConfiguration(int pad, bool left, wxWindow *parent)
|
||||||
: wxDialog(
|
: wxDialog(
|
||||||
parent, // Parent
|
parent, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Gamepad configuration"), // Title
|
_T("Gamepad configuration"), // Title
|
||||||
wxDefaultPosition, // Position
|
wxDefaultPosition, // Position
|
||||||
wxSize(400, 200), // Width + Lenght
|
wxSize(400, 200), // Width + Lenght
|
||||||
// Style
|
// Style
|
||||||
wxSYSTEM_MENU |
|
wxSYSTEM_MENU |
|
||||||
wxCAPTION |
|
wxCAPTION |
|
||||||
|
@ -37,70 +37,70 @@ JoystickConfiguration::JoystickConfiguration(int pad, bool left, wxWindow *paren
|
||||||
m_pad_id = pad;
|
m_pad_id = pad;
|
||||||
m_isForLeftJoystick = left;
|
m_isForLeftJoystick = left;
|
||||||
m_pan_joystick_config = new wxPanel(
|
m_pan_joystick_config = new wxPanel(
|
||||||
this, // Parent
|
this, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
wxDefaultPosition, // Prosition
|
wxDefaultPosition, // Prosition
|
||||||
wxSize(300, 200) // Size
|
wxSize(300, 200) // Size
|
||||||
);
|
);
|
||||||
|
|
||||||
if (m_isForLeftJoystick) {
|
if (m_isForLeftJoystick) {
|
||||||
m_cb_reverse_Lx = new wxCheckBox(
|
m_cb_reverse_Lx = new wxCheckBox(
|
||||||
m_pan_joystick_config, // Parent
|
m_pan_joystick_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Reverse Lx"), // Label
|
_T("Reverse Lx"), // Label
|
||||||
wxPoint(20, 20) // Position
|
wxPoint(20, 20) // Position
|
||||||
);
|
);
|
||||||
|
|
||||||
m_cb_reverse_Ly = new wxCheckBox(
|
m_cb_reverse_Ly = new wxCheckBox(
|
||||||
m_pan_joystick_config, // Parent
|
m_pan_joystick_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Reverse Ly"), // Label
|
_T("Reverse Ly"), // Label
|
||||||
wxPoint(20, 40) // Position
|
wxPoint(20, 40) // Position
|
||||||
);
|
);
|
||||||
|
|
||||||
m_cb_mouse_Ljoy = new wxCheckBox(
|
m_cb_mouse_Ljoy = new wxCheckBox(
|
||||||
m_pan_joystick_config, // Parent
|
m_pan_joystick_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Use mouse for left analog joystick"), // Label
|
_T("Use mouse for left analog joystick"), // Label
|
||||||
wxPoint(20, 60) // Position
|
wxPoint(20, 60) // Position
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
m_cb_reverse_Rx = new wxCheckBox(
|
m_cb_reverse_Rx = new wxCheckBox(
|
||||||
m_pan_joystick_config, // Parent
|
m_pan_joystick_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Reverse Rx"), // Label
|
_T("Reverse Rx"), // Label
|
||||||
wxPoint(20, 20) // Position
|
wxPoint(20, 20) // Position
|
||||||
);
|
);
|
||||||
|
|
||||||
m_cb_reverse_Ry = new wxCheckBox(
|
m_cb_reverse_Ry = new wxCheckBox(
|
||||||
m_pan_joystick_config, // Parent
|
m_pan_joystick_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Reverse Ry"), // Label
|
_T("Reverse Ry"), // Label
|
||||||
wxPoint(20, 40) // Position
|
wxPoint(20, 40) // Position
|
||||||
);
|
);
|
||||||
|
|
||||||
m_cb_mouse_Rjoy = new wxCheckBox(
|
m_cb_mouse_Rjoy = new wxCheckBox(
|
||||||
m_pan_joystick_config, // Parent
|
m_pan_joystick_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Use mouse for right analog joystick"), // Label
|
_T("Use mouse for right analog joystick"), // Label
|
||||||
wxPoint(20, 60) // Position
|
wxPoint(20, 60) // Position
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bt_ok = new wxButton(
|
m_bt_ok = new wxButton(
|
||||||
m_pan_joystick_config, // Parent
|
m_pan_joystick_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("&OK"), // Label
|
_T("&OK"), // Label
|
||||||
wxPoint(250, 130), // Position
|
wxPoint(250, 130), // Position
|
||||||
wxSize(60, 25) // Size
|
wxSize(60, 25) // Size
|
||||||
);
|
);
|
||||||
|
|
||||||
m_bt_cancel = new wxButton(
|
m_bt_cancel = new wxButton(
|
||||||
m_pan_joystick_config, // Parent
|
m_pan_joystick_config, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("&Cancel"), // Label
|
_T("&Cancel"), // Label
|
||||||
wxPoint(320, 130), // Position
|
wxPoint(320, 130), // Position
|
||||||
wxSize(60, 25) // Size
|
wxSize(60, 25) // Size
|
||||||
);
|
);
|
||||||
|
|
||||||
Bind(wxEVT_BUTTON, &JoystickConfiguration::OnButtonClicked, this);
|
Bind(wxEVT_BUTTON, &JoystickConfiguration::OnButtonClicked, this);
|
||||||
|
@ -113,7 +113,7 @@ JoystickConfiguration::JoystickConfiguration(int pad, bool left, wxWindow *paren
|
||||||
*/
|
*/
|
||||||
void JoystickConfiguration::InitJoystickConfiguration()
|
void JoystickConfiguration::InitJoystickConfiguration()
|
||||||
{
|
{
|
||||||
repopulate(); // Set label and fit simulated key array
|
repopulate(); // Set label and fit simulated key array
|
||||||
/*
|
/*
|
||||||
* Check if there exist at least one pad available
|
* Check if there exist at least one pad available
|
||||||
* if the pad id is 0, you need at least 1 gamepad connected,
|
* if the pad id is 0, you need at least 1 gamepad connected,
|
||||||
|
@ -143,13 +143,13 @@ void JoystickConfiguration::InitJoystickConfiguration()
|
||||||
void JoystickConfiguration::OnButtonClicked(wxCommandEvent &event)
|
void JoystickConfiguration::OnButtonClicked(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
// Affichage d'un message à chaque clic sur le bouton
|
// Affichage d'un message à chaque clic sur le bouton
|
||||||
wxButton *bt_tmp = (wxButton *)event.GetEventObject(); // get the button object
|
wxButton *bt_tmp = (wxButton *)event.GetEventObject(); // get the button object
|
||||||
int bt_id = bt_tmp->GetId(); // get the real ID
|
int bt_id = bt_tmp->GetId(); // get the real ID
|
||||||
if (bt_id == m_bt_ok->GetId()) { // If the button ID is equals to the Ok button ID
|
if (bt_id == m_bt_ok->GetId()) { // If the button ID is equals to the Ok button ID
|
||||||
Close(); // Close the window
|
Close(); // Close the window
|
||||||
} else if (bt_id == m_bt_cancel->GetId()) { // If the button ID is equals to the cancel button ID
|
} else if (bt_id == m_bt_cancel->GetId()) { // If the button ID is equals to the cancel button ID
|
||||||
reset(); // reinitialize the value of each parameters
|
reset(); // reinitialize the value of each parameters
|
||||||
Close(); // Close the window
|
Close(); // Close the window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ void JoystickConfiguration::OnButtonClicked(wxCommandEvent &event)
|
||||||
*/
|
*/
|
||||||
void JoystickConfiguration::OnCheckboxChange(wxCommandEvent &event)
|
void JoystickConfiguration::OnCheckboxChange(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
wxCheckBox *cb_tmp = (wxCheckBox *)event.GetEventObject(); // get the slider object
|
wxCheckBox *cb_tmp = (wxCheckBox *)event.GetEventObject(); // get the slider object
|
||||||
int cb_id = cb_tmp->GetId();
|
int cb_id = cb_tmp->GetId();
|
||||||
bool val;
|
bool val;
|
||||||
if (m_isForLeftJoystick) {
|
if (m_isForLeftJoystick) {
|
||||||
|
|
|
@ -36,8 +36,8 @@ class JoystickConfiguration : public wxDialog
|
||||||
{
|
{
|
||||||
wxPanel *m_pan_joystick_config;
|
wxPanel *m_pan_joystick_config;
|
||||||
wxCheckBox *m_cb_reverse_Lx, *m_cb_reverse_Ly, *m_cb_reverse_Rx, *m_cb_reverse_Ry,
|
wxCheckBox *m_cb_reverse_Lx, *m_cb_reverse_Ly, *m_cb_reverse_Rx, *m_cb_reverse_Ry,
|
||||||
*m_cb_mouse_Ljoy, // Use mouse for left joystick
|
*m_cb_mouse_Ljoy, // Use mouse for left joystick
|
||||||
*m_cb_mouse_Rjoy; // Use mouse for right joystick
|
*m_cb_mouse_Rjoy; // Use mouse for right joystick
|
||||||
wxButton *m_bt_ok, *m_bt_cancel;
|
wxButton *m_bt_ok, *m_bt_cancel;
|
||||||
|
|
||||||
u32 m_pad_id;
|
u32 m_pad_id;
|
||||||
|
@ -57,4 +57,4 @@ public:
|
||||||
void InitJoystickConfiguration();
|
void InitJoystickConfiguration();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __JOYSTICKCONFIGURATION_H__
|
#endif // __JOYSTICKCONFIGURATION_H__
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
|
|
||||||
// Construtor of Dialog
|
// Construtor of Dialog
|
||||||
Dialog::Dialog()
|
Dialog::Dialog()
|
||||||
: wxDialog(NULL, // Parent
|
: wxDialog(NULL, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("OnePad configuration"), // Title
|
_T("OnePad configuration"), // Title
|
||||||
wxDefaultPosition, // Position
|
wxDefaultPosition, // Position
|
||||||
wxSize(DEFAULT_WIDTH, DEFAULT_HEIGHT), // Width + Lenght
|
wxSize(DEFAULT_WIDTH, DEFAULT_HEIGHT), // Width + Lenght
|
||||||
// Style
|
// Style
|
||||||
wxSYSTEM_MENU |
|
wxSYSTEM_MENU |
|
||||||
wxCAPTION |
|
wxCAPTION |
|
||||||
|
@ -43,196 +43,196 @@ Dialog::Dialog()
|
||||||
int padding[BUTTONS_LENGHT][4];
|
int padding[BUTTONS_LENGHT][4];
|
||||||
|
|
||||||
// L1
|
// L1
|
||||||
padding[PAD_L1][0] = 218; // Width
|
padding[PAD_L1][0] = 218; // Width
|
||||||
padding[PAD_L1][1] = 28; // Height
|
padding[PAD_L1][1] = 28; // Height
|
||||||
padding[PAD_L1][2] = 50; // X
|
padding[PAD_L1][2] = 50; // X
|
||||||
padding[PAD_L1][3] = 175; // Y
|
padding[PAD_L1][3] = 175; // Y
|
||||||
|
|
||||||
// L2
|
// L2
|
||||||
padding[PAD_L2][0] = 218; // Width
|
padding[PAD_L2][0] = 218; // Width
|
||||||
padding[PAD_L2][1] = 28; // Height
|
padding[PAD_L2][1] = 28; // Height
|
||||||
padding[PAD_L2][2] = 50; // X
|
padding[PAD_L2][2] = 50; // X
|
||||||
padding[PAD_L2][3] = 104; // Y
|
padding[PAD_L2][3] = 104; // Y
|
||||||
|
|
||||||
// R1
|
// R1
|
||||||
padding[PAD_R1][0] = 218; // Width
|
padding[PAD_R1][0] = 218; // Width
|
||||||
padding[PAD_R1][1] = 28; // Height
|
padding[PAD_R1][1] = 28; // Height
|
||||||
padding[PAD_R1][2] = 726; // X
|
padding[PAD_R1][2] = 726; // X
|
||||||
padding[PAD_R1][3] = 175; // Y
|
padding[PAD_R1][3] = 175; // Y
|
||||||
|
|
||||||
// R2
|
// R2
|
||||||
padding[PAD_R2][0] = 218; // Width
|
padding[PAD_R2][0] = 218; // Width
|
||||||
padding[PAD_R2][1] = 28; // Height
|
padding[PAD_R2][1] = 28; // Height
|
||||||
padding[PAD_R2][2] = 726; // X
|
padding[PAD_R2][2] = 726; // X
|
||||||
padding[PAD_R2][3] = 104; // Y
|
padding[PAD_R2][3] = 104; // Y
|
||||||
|
|
||||||
// Triangle
|
// Triangle
|
||||||
padding[PAD_TRIANGLE][0] = 218; // Width
|
padding[PAD_TRIANGLE][0] = 218; // Width
|
||||||
padding[PAD_TRIANGLE][1] = 28; // Height
|
padding[PAD_TRIANGLE][1] = 28; // Height
|
||||||
padding[PAD_TRIANGLE][2] = 726; // X
|
padding[PAD_TRIANGLE][2] = 726; // X
|
||||||
padding[PAD_TRIANGLE][3] = 246; // Y
|
padding[PAD_TRIANGLE][3] = 246; // Y
|
||||||
|
|
||||||
// Circle
|
// Circle
|
||||||
padding[PAD_CIRCLE][0] = 218; // Width
|
padding[PAD_CIRCLE][0] = 218; // Width
|
||||||
padding[PAD_CIRCLE][1] = 28; // Height
|
padding[PAD_CIRCLE][1] = 28; // Height
|
||||||
padding[PAD_CIRCLE][2] = 726; // X
|
padding[PAD_CIRCLE][2] = 726; // X
|
||||||
padding[PAD_CIRCLE][3] = 319; // Y
|
padding[PAD_CIRCLE][3] = 319; // Y
|
||||||
|
|
||||||
// Cross
|
// Cross
|
||||||
padding[PAD_CROSS][0] = 218; // Width
|
padding[PAD_CROSS][0] = 218; // Width
|
||||||
padding[PAD_CROSS][1] = 28; // Height
|
padding[PAD_CROSS][1] = 28; // Height
|
||||||
padding[PAD_CROSS][2] = 726; // X
|
padding[PAD_CROSS][2] = 726; // X
|
||||||
padding[PAD_CROSS][3] = 391; // Y
|
padding[PAD_CROSS][3] = 391; // Y
|
||||||
|
|
||||||
// Square
|
// Square
|
||||||
padding[PAD_SQUARE][0] = 218; // Width
|
padding[PAD_SQUARE][0] = 218; // Width
|
||||||
padding[PAD_SQUARE][1] = 28; // Height
|
padding[PAD_SQUARE][1] = 28; // Height
|
||||||
padding[PAD_SQUARE][2] = 726; // X
|
padding[PAD_SQUARE][2] = 726; // X
|
||||||
padding[PAD_SQUARE][3] = 463; // Y
|
padding[PAD_SQUARE][3] = 463; // Y
|
||||||
|
|
||||||
// Directional pad up
|
// Directional pad up
|
||||||
padding[PAD_UP][0] = 100; // Width
|
padding[PAD_UP][0] = 100; // Width
|
||||||
padding[PAD_UP][1] = 25; // Height
|
padding[PAD_UP][1] = 25; // Height
|
||||||
padding[PAD_UP][2] = 108; // X
|
padding[PAD_UP][2] = 108; // X
|
||||||
padding[PAD_UP][3] = 290; // Y
|
padding[PAD_UP][3] = 290; // Y
|
||||||
|
|
||||||
// Directional pad down
|
// Directional pad down
|
||||||
padding[PAD_DOWN][0] = 100; // Width
|
padding[PAD_DOWN][0] = 100; // Width
|
||||||
padding[PAD_DOWN][1] = 25; // Height
|
padding[PAD_DOWN][1] = 25; // Height
|
||||||
padding[PAD_DOWN][2] = 108; // X
|
padding[PAD_DOWN][2] = 108; // X
|
||||||
padding[PAD_DOWN][3] = 340; // Y
|
padding[PAD_DOWN][3] = 340; // Y
|
||||||
|
|
||||||
// Directional pad right
|
// Directional pad right
|
||||||
padding[PAD_RIGHT][0] = 109; // Width
|
padding[PAD_RIGHT][0] = 109; // Width
|
||||||
padding[PAD_RIGHT][1] = 25; // Height
|
padding[PAD_RIGHT][1] = 25; // Height
|
||||||
padding[PAD_RIGHT][2] = 159; // X
|
padding[PAD_RIGHT][2] = 159; // X
|
||||||
padding[PAD_RIGHT][3] = 315; // Y
|
padding[PAD_RIGHT][3] = 315; // Y
|
||||||
|
|
||||||
// Directional pad left
|
// Directional pad left
|
||||||
padding[PAD_LEFT][0] = 109; // Width
|
padding[PAD_LEFT][0] = 109; // Width
|
||||||
padding[PAD_LEFT][1] = 25; // Height
|
padding[PAD_LEFT][1] = 25; // Height
|
||||||
padding[PAD_LEFT][2] = 50; // X
|
padding[PAD_LEFT][2] = 50; // X
|
||||||
padding[PAD_LEFT][3] = 315; // Y
|
padding[PAD_LEFT][3] = 315; // Y
|
||||||
|
|
||||||
// Left Joystick up
|
// Left Joystick up
|
||||||
padding[PAD_L_UP][0] = 100; // Width
|
padding[PAD_L_UP][0] = 100; // Width
|
||||||
padding[PAD_L_UP][1] = 25; // Height
|
padding[PAD_L_UP][1] = 25; // Height
|
||||||
padding[PAD_L_UP][2] = 325; // X
|
padding[PAD_L_UP][2] = 325; // X
|
||||||
padding[PAD_L_UP][3] = 527; // Y
|
padding[PAD_L_UP][3] = 527; // Y
|
||||||
|
|
||||||
// Left Joystick down
|
// Left Joystick down
|
||||||
padding[PAD_L_DOWN][0] = 100; // Width
|
padding[PAD_L_DOWN][0] = 100; // Width
|
||||||
padding[PAD_L_DOWN][1] = 25; // Height
|
padding[PAD_L_DOWN][1] = 25; // Height
|
||||||
padding[PAD_L_DOWN][2] = 325; // X
|
padding[PAD_L_DOWN][2] = 325; // X
|
||||||
padding[PAD_L_DOWN][3] = 577; // Y
|
padding[PAD_L_DOWN][3] = 577; // Y
|
||||||
|
|
||||||
// Left Joystick right
|
// Left Joystick right
|
||||||
padding[PAD_L_RIGHT][0] = 109; // Width
|
padding[PAD_L_RIGHT][0] = 109; // Width
|
||||||
padding[PAD_L_RIGHT][1] = 25; // Height
|
padding[PAD_L_RIGHT][1] = 25; // Height
|
||||||
padding[PAD_L_RIGHT][2] = 377; // X
|
padding[PAD_L_RIGHT][2] = 377; // X
|
||||||
padding[PAD_L_RIGHT][3] = 552; // Y
|
padding[PAD_L_RIGHT][3] = 552; // Y
|
||||||
|
|
||||||
// Left Joystick left
|
// Left Joystick left
|
||||||
padding[PAD_L_LEFT][0] = 109; // Width
|
padding[PAD_L_LEFT][0] = 109; // Width
|
||||||
padding[PAD_L_LEFT][1] = 25; // Height
|
padding[PAD_L_LEFT][1] = 25; // Height
|
||||||
padding[PAD_L_LEFT][2] = 268; // X
|
padding[PAD_L_LEFT][2] = 268; // X
|
||||||
padding[PAD_L_LEFT][3] = 552; // Y
|
padding[PAD_L_LEFT][3] = 552; // Y
|
||||||
|
|
||||||
// L3
|
// L3
|
||||||
padding[PAD_L3][0] = 218; // Width
|
padding[PAD_L3][0] = 218; // Width
|
||||||
padding[PAD_L3][1] = 28; // Height
|
padding[PAD_L3][1] = 28; // Height
|
||||||
padding[PAD_L3][2] = 268; // X
|
padding[PAD_L3][2] = 268; // X
|
||||||
padding[PAD_L3][3] = 641; // Y
|
padding[PAD_L3][3] = 641; // Y
|
||||||
|
|
||||||
// Right Joystick up
|
// Right Joystick up
|
||||||
padding[PAD_R_UP][0] = 100; // Width
|
padding[PAD_R_UP][0] = 100; // Width
|
||||||
padding[PAD_R_UP][1] = 25; // Height
|
padding[PAD_R_UP][1] = 25; // Height
|
||||||
padding[PAD_R_UP][2] = 555; // X
|
padding[PAD_R_UP][2] = 555; // X
|
||||||
padding[PAD_R_UP][3] = 527; // Y
|
padding[PAD_R_UP][3] = 527; // Y
|
||||||
|
|
||||||
// Right Joystick down
|
// Right Joystick down
|
||||||
padding[PAD_R_DOWN][0] = 100; // Width
|
padding[PAD_R_DOWN][0] = 100; // Width
|
||||||
padding[PAD_R_DOWN][1] = 25; // Height
|
padding[PAD_R_DOWN][1] = 25; // Height
|
||||||
padding[PAD_R_DOWN][2] = 555; // X
|
padding[PAD_R_DOWN][2] = 555; // X
|
||||||
padding[PAD_R_DOWN][3] = 577; // Y
|
padding[PAD_R_DOWN][3] = 577; // Y
|
||||||
|
|
||||||
// Right Joystick right
|
// Right Joystick right
|
||||||
padding[PAD_R_RIGHT][0] = 109; // Width
|
padding[PAD_R_RIGHT][0] = 109; // Width
|
||||||
padding[PAD_R_RIGHT][1] = 25; // Height
|
padding[PAD_R_RIGHT][1] = 25; // Height
|
||||||
padding[PAD_R_RIGHT][2] = 607; // X
|
padding[PAD_R_RIGHT][2] = 607; // X
|
||||||
padding[PAD_R_RIGHT][3] = 552; // Y
|
padding[PAD_R_RIGHT][3] = 552; // Y
|
||||||
|
|
||||||
// Right Joystick left
|
// Right Joystick left
|
||||||
padding[PAD_R_LEFT][0] = 109; // Width
|
padding[PAD_R_LEFT][0] = 109; // Width
|
||||||
padding[PAD_R_LEFT][1] = 25; // Height
|
padding[PAD_R_LEFT][1] = 25; // Height
|
||||||
padding[PAD_R_LEFT][2] = 498; // X
|
padding[PAD_R_LEFT][2] = 498; // X
|
||||||
padding[PAD_R_LEFT][3] = 552; // Y
|
padding[PAD_R_LEFT][3] = 552; // Y
|
||||||
|
|
||||||
// R3
|
// R3
|
||||||
padding[PAD_R3][0] = 218; // Width
|
padding[PAD_R3][0] = 218; // Width
|
||||||
padding[PAD_R3][1] = 28; // Height
|
padding[PAD_R3][1] = 28; // Height
|
||||||
padding[PAD_R3][2] = 498; // X
|
padding[PAD_R3][2] = 498; // X
|
||||||
padding[PAD_R3][3] = 641; // Y
|
padding[PAD_R3][3] = 641; // Y
|
||||||
|
|
||||||
// Start
|
// Start
|
||||||
padding[PAD_START][0] = 218; // Width
|
padding[PAD_START][0] = 218; // Width
|
||||||
padding[PAD_START][1] = 28; // Height
|
padding[PAD_START][1] = 28; // Height
|
||||||
padding[PAD_START][2] = 503; // X
|
padding[PAD_START][2] = 503; // X
|
||||||
padding[PAD_START][3] = 34; // Y
|
padding[PAD_START][3] = 34; // Y
|
||||||
|
|
||||||
// Select
|
// Select
|
||||||
padding[PAD_SELECT][0] = 218; // Width
|
padding[PAD_SELECT][0] = 218; // Width
|
||||||
padding[PAD_SELECT][1] = 28; // Height
|
padding[PAD_SELECT][1] = 28; // Height
|
||||||
padding[PAD_SELECT][2] = 273; // X
|
padding[PAD_SELECT][2] = 273; // X
|
||||||
padding[PAD_SELECT][3] = 34; // Y
|
padding[PAD_SELECT][3] = 34; // Y
|
||||||
|
|
||||||
// Analog
|
// Analog
|
||||||
padding[Analog][0] = 218; // Width
|
padding[Analog][0] = 218; // Width
|
||||||
padding[Analog][1] = 28; // Height
|
padding[Analog][1] = 28; // Height
|
||||||
padding[Analog][2] = 50; // X
|
padding[Analog][2] = 50; // X
|
||||||
padding[Analog][3] = 452; // Y
|
padding[Analog][3] = 452; // Y
|
||||||
|
|
||||||
// Left Joystick Configuration
|
// Left Joystick Configuration
|
||||||
padding[JoyL_config][0] = 180; // Width
|
padding[JoyL_config][0] = 180; // Width
|
||||||
padding[JoyL_config][1] = 28; // Height
|
padding[JoyL_config][1] = 28; // Height
|
||||||
padding[JoyL_config][2] = 50; // X
|
padding[JoyL_config][2] = 50; // X
|
||||||
padding[JoyL_config][3] = 550; // Y
|
padding[JoyL_config][3] = 550; // Y
|
||||||
|
|
||||||
// Right Joystick Configuration
|
// Right Joystick Configuration
|
||||||
padding[JoyR_config][0] = 180; // Width
|
padding[JoyR_config][0] = 180; // Width
|
||||||
padding[JoyR_config][1] = 28; // Height
|
padding[JoyR_config][1] = 28; // Height
|
||||||
padding[JoyR_config][2] = 764; // X
|
padding[JoyR_config][2] = 764; // X
|
||||||
padding[JoyR_config][3] = 550; // Y
|
padding[JoyR_config][3] = 550; // Y
|
||||||
|
|
||||||
// Gamepad Configuration
|
// Gamepad Configuration
|
||||||
padding[Gamepad_config][0] = 180; // Width
|
padding[Gamepad_config][0] = 180; // Width
|
||||||
padding[Gamepad_config][1] = 28; // Height
|
padding[Gamepad_config][1] = 28; // Height
|
||||||
padding[Gamepad_config][2] = 50; // X
|
padding[Gamepad_config][2] = 50; // X
|
||||||
padding[Gamepad_config][3] = 585; // Y
|
padding[Gamepad_config][3] = 585; // Y
|
||||||
|
|
||||||
// Set All Buttons
|
// Set All Buttons
|
||||||
padding[Set_all][0] = 180; // Width
|
padding[Set_all][0] = 180; // Width
|
||||||
padding[Set_all][1] = 28; // Height
|
padding[Set_all][1] = 28; // Height
|
||||||
padding[Set_all][2] = 764; // X
|
padding[Set_all][2] = 764; // X
|
||||||
padding[Set_all][3] = 585; // Y
|
padding[Set_all][3] = 585; // Y
|
||||||
|
|
||||||
// Apply modifications without exit
|
// Apply modifications without exit
|
||||||
padding[Apply][0] = 70; // Width
|
padding[Apply][0] = 70; // Width
|
||||||
padding[Apply][1] = 28; // Height
|
padding[Apply][1] = 28; // Height
|
||||||
padding[Apply][2] = 833; // X
|
padding[Apply][2] = 833; // X
|
||||||
padding[Apply][3] = 642; // Y
|
padding[Apply][3] = 642; // Y
|
||||||
|
|
||||||
// Ok button
|
// Ok button
|
||||||
padding[Ok][0] = 70; // Width
|
padding[Ok][0] = 70; // Width
|
||||||
padding[Ok][1] = 28; // Height
|
padding[Ok][1] = 28; // Height
|
||||||
padding[Ok][2] = 913; // X
|
padding[Ok][2] = 913; // X
|
||||||
padding[Ok][3] = 642; // Y
|
padding[Ok][3] = 642; // Y
|
||||||
|
|
||||||
// Cancel button
|
// Cancel button
|
||||||
padding[Cancel][0] = 70; // Width
|
padding[Cancel][0] = 70; // Width
|
||||||
padding[Cancel][1] = 28; // Height
|
padding[Cancel][1] = 28; // Height
|
||||||
padding[Cancel][2] = 753; // X
|
padding[Cancel][2] = 753; // X
|
||||||
padding[Cancel][3] = 642; // Y
|
padding[Cancel][3] = 642; // Y
|
||||||
|
|
||||||
// create a new Notebook
|
// create a new Notebook
|
||||||
m_tab_gamepad = new wxNotebook(this, wxID_ANY);
|
m_tab_gamepad = new wxNotebook(this, wxID_ANY);
|
||||||
|
@ -250,18 +250,18 @@ Dialog::Dialog()
|
||||||
sstm << label << i;
|
sstm << label << i;
|
||||||
// New page creation
|
// New page creation
|
||||||
m_tab_gamepad->AddPage(
|
m_tab_gamepad->AddPage(
|
||||||
m_pan_tabs[i], // Parent
|
m_pan_tabs[i], // Parent
|
||||||
wxString(sstm.str().c_str(), wxConvUTF8) // Title
|
wxString(sstm.str().c_str(), wxConvUTF8) // Title
|
||||||
);
|
);
|
||||||
|
|
||||||
for (int j = 0; j < BUTTONS_LENGHT; ++j) {
|
for (int j = 0; j < BUTTONS_LENGHT; ++j) {
|
||||||
// Gamepad buttons
|
// Gamepad buttons
|
||||||
m_bt_gamepad[i][j] = new wxButton(
|
m_bt_gamepad[i][j] = new wxButton(
|
||||||
m_pan_tabs[i], // Parent
|
m_pan_tabs[i], // Parent
|
||||||
wxID_HIGHEST + j + 1, // ID
|
wxID_HIGHEST + j + 1, // ID
|
||||||
_T("Undefined"), // Label
|
_T("Undefined"), // Label
|
||||||
wxPoint(padding[j][2], padding[j][3]), // Position
|
wxPoint(padding[j][2], padding[j][3]), // Position
|
||||||
wxSize(padding[j][0], padding[j][1]) // Size
|
wxSize(padding[j][0], padding[j][1]) // Size
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Redefine others gui buttons label
|
// Redefine others gui buttons label
|
||||||
|
@ -292,9 +292,9 @@ Dialog::Dialog()
|
||||||
|
|
||||||
void Dialog::InitDialog()
|
void Dialog::InitDialog()
|
||||||
{
|
{
|
||||||
GamePad::EnumerateGamePads(s_vgamePad); // activate gamepads
|
GamePad::EnumerateGamePads(s_vgamePad); // activate gamepads
|
||||||
LoadConfig(); // Load configuration from the ini file
|
LoadConfig(); // Load configuration from the ini file
|
||||||
repopulate(); // Set label and fit simulated key array
|
repopulate(); // Set label and fit simulated key array
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
@ -304,54 +304,54 @@ void Dialog::InitDialog()
|
||||||
void Dialog::OnButtonClicked(wxCommandEvent &event)
|
void Dialog::OnButtonClicked(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
// Affichage d'un message à chaque clic sur le bouton
|
// Affichage d'un message à chaque clic sur le bouton
|
||||||
wxButton *bt_tmp = (wxButton *)event.GetEventObject(); // get the button object
|
wxButton *bt_tmp = (wxButton *)event.GetEventObject(); // get the button object
|
||||||
int bt_id = bt_tmp->GetId() - wxID_HIGHEST - 1; // get the real ID
|
int bt_id = bt_tmp->GetId() - wxID_HIGHEST - 1; // get the real ID
|
||||||
int gamepad_id = m_tab_gamepad->GetSelection(); // get the tab ID (equivalent to the gamepad id)
|
int gamepad_id = m_tab_gamepad->GetSelection(); // get the tab ID (equivalent to the gamepad id)
|
||||||
if (bt_id >= 0 && bt_id <= PAD_R_LEFT) { // if the button ID is a gamepad button
|
if (bt_id >= 0 && bt_id <= PAD_R_LEFT) { // if the button ID is a gamepad button
|
||||||
bt_tmp->Disable(); // switch the button state to "Disable"
|
bt_tmp->Disable(); // switch the button state to "Disable"
|
||||||
config_key(gamepad_id, bt_id);
|
config_key(gamepad_id, bt_id);
|
||||||
bt_tmp->Enable(); // switch the button state to "Enable"
|
bt_tmp->Enable(); // switch the button state to "Enable"
|
||||||
} else if (bt_id == Gamepad_config) { // If the button ID is equals to the Gamepad_config button ID
|
} else if (bt_id == Gamepad_config) { // If the button ID is equals to the Gamepad_config button ID
|
||||||
GamepadConfiguration gamepad_config(gamepad_id, this);
|
GamepadConfiguration gamepad_config(gamepad_id, this);
|
||||||
|
|
||||||
gamepad_config.InitGamepadConfiguration();
|
gamepad_config.InitGamepadConfiguration();
|
||||||
gamepad_config.ShowModal();
|
gamepad_config.ShowModal();
|
||||||
} else if (bt_id == JoyL_config) { // If the button ID is equals to the JoyL_config button ID
|
} else if (bt_id == JoyL_config) { // If the button ID is equals to the JoyL_config button ID
|
||||||
JoystickConfiguration joystick_config(gamepad_id, true, this);
|
JoystickConfiguration joystick_config(gamepad_id, true, this);
|
||||||
|
|
||||||
joystick_config.InitJoystickConfiguration();
|
joystick_config.InitJoystickConfiguration();
|
||||||
joystick_config.ShowModal();
|
joystick_config.ShowModal();
|
||||||
} else if (bt_id == JoyR_config) { // If the button ID is equals to the JoyR_config button ID
|
} else if (bt_id == JoyR_config) { // If the button ID is equals to the JoyR_config button ID
|
||||||
JoystickConfiguration joystick_config(gamepad_id, false, this);
|
JoystickConfiguration joystick_config(gamepad_id, false, this);
|
||||||
|
|
||||||
joystick_config.InitJoystickConfiguration();
|
joystick_config.InitJoystickConfiguration();
|
||||||
joystick_config.ShowModal();
|
joystick_config.ShowModal();
|
||||||
} else if (bt_id == Set_all) { // If the button ID is equals to the Set_all button ID
|
} else if (bt_id == Set_all) { // If the button ID is equals to the Set_all button ID
|
||||||
for (int i = 0; i < MAX_KEYS; ++i) {
|
for (int i = 0; i < MAX_KEYS; ++i) {
|
||||||
bt_tmp = m_bt_gamepad[gamepad_id][i];
|
bt_tmp = m_bt_gamepad[gamepad_id][i];
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case PAD_L_UP: // Left joystick (Up) ↑
|
case PAD_L_UP: // Left joystick (Up) ↑
|
||||||
m_pan_tabs[gamepad_id]->ShowImg(img_l_arrow_up);
|
m_pan_tabs[gamepad_id]->ShowImg(img_l_arrow_up);
|
||||||
break;
|
break;
|
||||||
case PAD_L_RIGHT: // Left joystick (Right) →
|
case PAD_L_RIGHT: // Left joystick (Right) →
|
||||||
m_pan_tabs[gamepad_id]->ShowImg(img_l_arrow_right);
|
m_pan_tabs[gamepad_id]->ShowImg(img_l_arrow_right);
|
||||||
break;
|
break;
|
||||||
case PAD_L_DOWN: // Left joystick (Down) ↓
|
case PAD_L_DOWN: // Left joystick (Down) ↓
|
||||||
m_pan_tabs[gamepad_id]->ShowImg(img_l_arrow_bottom);
|
m_pan_tabs[gamepad_id]->ShowImg(img_l_arrow_bottom);
|
||||||
break;
|
break;
|
||||||
case PAD_L_LEFT: // Left joystick (Left) ←
|
case PAD_L_LEFT: // Left joystick (Left) ←
|
||||||
m_pan_tabs[gamepad_id]->ShowImg(img_l_arrow_left);
|
m_pan_tabs[gamepad_id]->ShowImg(img_l_arrow_left);
|
||||||
break;
|
break;
|
||||||
case PAD_R_UP: // Right joystick (Up) ↑
|
case PAD_R_UP: // Right joystick (Up) ↑
|
||||||
m_pan_tabs[gamepad_id]->ShowImg(img_r_arrow_up);
|
m_pan_tabs[gamepad_id]->ShowImg(img_r_arrow_up);
|
||||||
break;
|
break;
|
||||||
case PAD_R_RIGHT: // Right joystick (Right) →
|
case PAD_R_RIGHT: // Right joystick (Right) →
|
||||||
m_pan_tabs[gamepad_id]->ShowImg(img_r_arrow_right);
|
m_pan_tabs[gamepad_id]->ShowImg(img_r_arrow_right);
|
||||||
break;
|
break;
|
||||||
case PAD_R_DOWN: // Right joystick (Down) ↓
|
case PAD_R_DOWN: // Right joystick (Down) ↓
|
||||||
m_pan_tabs[gamepad_id]->ShowImg(img_r_arrow_bottom);
|
m_pan_tabs[gamepad_id]->ShowImg(img_r_arrow_bottom);
|
||||||
break;
|
break;
|
||||||
case PAD_R_LEFT: // Right joystick (Left) ←
|
case PAD_R_LEFT: // Right joystick (Left) ←
|
||||||
m_pan_tabs[gamepad_id]->ShowImg(img_r_arrow_left);
|
m_pan_tabs[gamepad_id]->ShowImg(img_r_arrow_left);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -362,28 +362,28 @@ void Dialog::OnButtonClicked(wxCommandEvent &event)
|
||||||
m_pan_tabs[gamepad_id]->Update();
|
m_pan_tabs[gamepad_id]->Update();
|
||||||
config_key(gamepad_id, i);
|
config_key(gamepad_id, i);
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case PAD_L_UP: // Left joystick (Up) ↑
|
case PAD_L_UP: // Left joystick (Up) ↑
|
||||||
m_pan_tabs[gamepad_id]->HideImg(img_l_arrow_up);
|
m_pan_tabs[gamepad_id]->HideImg(img_l_arrow_up);
|
||||||
break;
|
break;
|
||||||
case PAD_L_RIGHT: // Left joystick (Right) →
|
case PAD_L_RIGHT: // Left joystick (Right) →
|
||||||
m_pan_tabs[gamepad_id]->HideImg(img_l_arrow_right);
|
m_pan_tabs[gamepad_id]->HideImg(img_l_arrow_right);
|
||||||
break;
|
break;
|
||||||
case PAD_L_DOWN: // Left joystick (Down) ↓
|
case PAD_L_DOWN: // Left joystick (Down) ↓
|
||||||
m_pan_tabs[gamepad_id]->HideImg(img_l_arrow_bottom);
|
m_pan_tabs[gamepad_id]->HideImg(img_l_arrow_bottom);
|
||||||
break;
|
break;
|
||||||
case PAD_L_LEFT: // Left joystick (Left) ←
|
case PAD_L_LEFT: // Left joystick (Left) ←
|
||||||
m_pan_tabs[gamepad_id]->HideImg(img_l_arrow_left);
|
m_pan_tabs[gamepad_id]->HideImg(img_l_arrow_left);
|
||||||
break;
|
break;
|
||||||
case PAD_R_UP: // Right joystick (Up) ↑
|
case PAD_R_UP: // Right joystick (Up) ↑
|
||||||
m_pan_tabs[gamepad_id]->HideImg(img_r_arrow_up);
|
m_pan_tabs[gamepad_id]->HideImg(img_r_arrow_up);
|
||||||
break;
|
break;
|
||||||
case PAD_R_RIGHT: // Right joystick (Right) →
|
case PAD_R_RIGHT: // Right joystick (Right) →
|
||||||
m_pan_tabs[gamepad_id]->HideImg(img_r_arrow_right);
|
m_pan_tabs[gamepad_id]->HideImg(img_r_arrow_right);
|
||||||
break;
|
break;
|
||||||
case PAD_R_DOWN: // Right joystick (Down) ↓
|
case PAD_R_DOWN: // Right joystick (Down) ↓
|
||||||
m_pan_tabs[gamepad_id]->HideImg(img_r_arrow_bottom);
|
m_pan_tabs[gamepad_id]->HideImg(img_r_arrow_bottom);
|
||||||
break;
|
break;
|
||||||
case PAD_R_LEFT: // Right joystick (Left) ←
|
case PAD_R_LEFT: // Right joystick (Left) ←
|
||||||
m_pan_tabs[gamepad_id]->HideImg(img_r_arrow_left);
|
m_pan_tabs[gamepad_id]->HideImg(img_r_arrow_left);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -392,15 +392,15 @@ void Dialog::OnButtonClicked(wxCommandEvent &event)
|
||||||
}
|
}
|
||||||
m_pan_tabs[gamepad_id]->Refresh();
|
m_pan_tabs[gamepad_id]->Refresh();
|
||||||
m_pan_tabs[gamepad_id]->Update();
|
m_pan_tabs[gamepad_id]->Update();
|
||||||
usleep(500000); // give enough time to the user to release the button
|
usleep(500000); // give enough time to the user to release the button
|
||||||
}
|
}
|
||||||
} else if (bt_id == Ok) { // If the button ID is equals to the Ok button ID
|
} else if (bt_id == Ok) { // If the button ID is equals to the Ok button ID
|
||||||
SaveConfig(); // Save the configuration
|
SaveConfig(); // Save the configuration
|
||||||
Close(); // Close the window
|
Close(); // Close the window
|
||||||
} else if (bt_id == Apply) { // If the button ID is equals to the Apply button ID
|
} else if (bt_id == Apply) { // If the button ID is equals to the Apply button ID
|
||||||
SaveConfig(); // Save the configuration
|
SaveConfig(); // Save the configuration
|
||||||
} else if (bt_id == Cancel) { // If the button ID is equals to the cancel button ID
|
} else if (bt_id == Cancel) { // If the button ID is equals to the cancel button ID
|
||||||
Close(); // Close the window
|
Close(); // Close the window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ void Dialog::JoystickEvent(wxTimerEvent &event)
|
||||||
} else if (map >= PAD_R_UP && map <= PAD_R_LEFT) {
|
} else if (map >= PAD_R_UP && map <= PAD_R_LEFT) {
|
||||||
m_pan_tabs[events.jaxis.which]->MoveJoystick(events.jaxis.axis, events.jaxis.value);
|
m_pan_tabs[events.jaxis.which]->MoveJoystick(events.jaxis.axis, events.jaxis.value);
|
||||||
m_pan_tabs[events.jaxis.which]->ShowImg(img_right_cursor);
|
m_pan_tabs[events.jaxis.which]->ShowImg(img_right_cursor);
|
||||||
} else if (map < PAD_L_UP) { // if this is not a joystick
|
} else if (map < PAD_L_UP) { // if this is not a joystick
|
||||||
m_pan_tabs[events.jaxis.which]->ShowImg(map);
|
m_pan_tabs[events.jaxis.which]->ShowImg(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ void Dialog::JoystickEvent(wxTimerEvent &event)
|
||||||
it2 = m_map_images[events.jaxis.which].find(key);
|
it2 = m_map_images[events.jaxis.which].find(key);
|
||||||
if (it2 != m_map_images[events.jaxis.which].end()) {
|
if (it2 != m_map_images[events.jaxis.which].end()) {
|
||||||
map = m_map_images[events.jaxis.which][key];
|
map = m_map_images[events.jaxis.which][key];
|
||||||
if (map < PAD_L_UP) { // if this is not a joystick
|
if (map < PAD_L_UP) { // if this is not a joystick
|
||||||
m_pan_tabs[events.jaxis.which]->HideImg(map);
|
m_pan_tabs[events.jaxis.which]->HideImg(map);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -519,7 +519,7 @@ void Dialog::JoystickEvent(wxTimerEvent &event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // SDL_BUILD
|
#endif // SDL_BUILD
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
|
@ -48,17 +48,17 @@
|
||||||
// see onepad.h for more details about gamepad button id
|
// see onepad.h for more details about gamepad button id
|
||||||
|
|
||||||
enum gui_buttons {
|
enum gui_buttons {
|
||||||
Analog = PAD_R_LEFT + 1, // Analog button (not yet supported ?)
|
Analog = PAD_R_LEFT + 1, // Analog button (not yet supported ?)
|
||||||
JoyL_config, // Left Joystick Configuration
|
JoyL_config, // Left Joystick Configuration
|
||||||
JoyR_config, // Right Joystick Configuration
|
JoyR_config, // Right Joystick Configuration
|
||||||
Gamepad_config, // Gamepad Configuration
|
Gamepad_config, // Gamepad Configuration
|
||||||
Set_all, // Set all buttons
|
Set_all, // Set all buttons
|
||||||
Apply, // Apply modifications without exit
|
Apply, // Apply modifications without exit
|
||||||
Ok, // Apply modifications and exit
|
Ok, // Apply modifications and exit
|
||||||
Cancel // Exit without apply modificatons
|
Cancel // Exit without apply modificatons
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BUTTONS_LENGHT 32 // numbers of buttons on the gamepad
|
#define BUTTONS_LENGHT 32 // numbers of buttons on the gamepad
|
||||||
#define UPDATE_TIME 5
|
#define UPDATE_TIME 5
|
||||||
#define DEFAULT_WIDTH 1000
|
#define DEFAULT_WIDTH 1000
|
||||||
#define DEFAULT_HEIGHT 740
|
#define DEFAULT_HEIGHT 740
|
||||||
|
@ -66,11 +66,11 @@ enum gui_buttons {
|
||||||
class Dialog : public wxDialog
|
class Dialog : public wxDialog
|
||||||
{
|
{
|
||||||
// Panels
|
// Panels
|
||||||
opPanel *m_pan_tabs[GAMEPAD_NUMBER]; // Gamepad Tabs box
|
opPanel *m_pan_tabs[GAMEPAD_NUMBER]; // Gamepad Tabs box
|
||||||
// Notebooks
|
// Notebooks
|
||||||
wxNotebook *m_tab_gamepad; // Joysticks Tabs
|
wxNotebook *m_tab_gamepad; // Joysticks Tabs
|
||||||
// Buttons
|
// Buttons
|
||||||
wxButton *m_bt_gamepad[GAMEPAD_NUMBER][BUTTONS_LENGHT]; // Joystick button use to modify the button mapping
|
wxButton *m_bt_gamepad[GAMEPAD_NUMBER][BUTTONS_LENGHT]; // Joystick button use to modify the button mapping
|
||||||
// Contain all simulated key
|
// Contain all simulated key
|
||||||
u32 m_simulatedKeys[GAMEPAD_NUMBER][MAX_KEYS];
|
u32 m_simulatedKeys[GAMEPAD_NUMBER][MAX_KEYS];
|
||||||
// Timer
|
// Timer
|
||||||
|
@ -95,6 +95,6 @@ public:
|
||||||
void show();
|
void show();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void DisplayDialog(); // Main function
|
extern void DisplayDialog(); // Main function
|
||||||
|
|
||||||
#endif // __DIALOG_H__
|
#endif // __DIALOG_H__
|
||||||
|
|
|
@ -46,7 +46,7 @@ string KeyName(int pad, int key, int keysym)
|
||||||
case 3:
|
case 3:
|
||||||
sprintf(&tmp[0], "Mouse Right");
|
sprintf(&tmp[0], "Mouse Right");
|
||||||
break;
|
break;
|
||||||
default: // Use only number for extra button
|
default: // Use only number for extra button
|
||||||
sprintf(&tmp[0], "Mouse %d", keysym);
|
sprintf(&tmp[0], "Mouse %d", keysym);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -164,7 +164,7 @@ void LoadConfig()
|
||||||
f = fopen(iniFile.c_str(), "r");
|
f = fopen(iniFile.c_str(), "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
printf("OnePAD: failed to load ini %s\n", iniFile.c_str());
|
printf("OnePAD: failed to load ini %s\n", iniFile.c_str());
|
||||||
SaveConfig(); //save and return
|
SaveConfig(); //save and return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ enum gui_img {
|
||||||
img_left_cursor,
|
img_left_cursor,
|
||||||
img_right_cursor,
|
img_right_cursor,
|
||||||
img_analog,
|
img_analog,
|
||||||
img_background, // background pic
|
img_background, // background pic
|
||||||
img_l_arrow_up,
|
img_l_arrow_up,
|
||||||
img_l_arrow_right,
|
img_l_arrow_right,
|
||||||
img_l_arrow_bottom,
|
img_l_arrow_bottom,
|
||||||
|
@ -74,4 +74,4 @@ public:
|
||||||
void MoveJoystick(int, int);
|
void MoveJoystick(int, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __OPPANEL_H__
|
#endif // __OPPANEL_H__
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "joystick.h"
|
#include "joystick.h"
|
||||||
#include <signal.h> // sigaction
|
#include <signal.h> // sigaction
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Joystick definitions //
|
// Joystick definitions //
|
||||||
|
@ -85,16 +85,16 @@ void JoystickInfo::GenerateDefaultEffect()
|
||||||
#if SDL_MAJOR_VERSION >= 2
|
#if SDL_MAJOR_VERSION >= 2
|
||||||
for (int i = 0; i < NB_EFFECT; i++) {
|
for (int i = 0; i < NB_EFFECT; i++) {
|
||||||
SDL_HapticEffect effect;
|
SDL_HapticEffect effect;
|
||||||
memset(&effect, 0, sizeof(SDL_HapticEffect)); // 0 is safe default
|
memset(&effect, 0, sizeof(SDL_HapticEffect)); // 0 is safe default
|
||||||
SDL_HapticDirection direction;
|
SDL_HapticDirection direction;
|
||||||
direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
|
direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
|
||||||
direction.dir[0] = 18000;
|
direction.dir[0] = 18000;
|
||||||
effect.periodic.direction = direction;
|
effect.periodic.direction = direction;
|
||||||
effect.periodic.period = 10;
|
effect.periodic.period = 10;
|
||||||
effect.periodic.magnitude = (Sint16)(conf->get_ff_intensity()); // Effect at maximum instensity
|
effect.periodic.magnitude = (Sint16)(conf->get_ff_intensity()); // Effect at maximum instensity
|
||||||
effect.periodic.offset = 0;
|
effect.periodic.offset = 0;
|
||||||
effect.periodic.phase = 18000;
|
effect.periodic.phase = 18000;
|
||||||
effect.periodic.length = 125; // 125ms feels quite near to original
|
effect.periodic.length = 125; // 125ms feels quite near to original
|
||||||
effect.periodic.delay = 0;
|
effect.periodic.delay = 0;
|
||||||
effect.periodic.attack_length = 0;
|
effect.periodic.attack_length = 0;
|
||||||
effects[i] = effect;
|
effects[i] = effect;
|
||||||
|
@ -113,7 +113,7 @@ void JoystickInfo::Rumble(int type, int pad)
|
||||||
if (haptic == NULL)
|
if (haptic == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (first) { // If done multiple times, device memory will be filled
|
if (first) { // If done multiple times, device memory will be filled
|
||||||
first = 0;
|
first = 0;
|
||||||
GenerateDefaultEffect();
|
GenerateDefaultEffect();
|
||||||
/** Sine and triangle are quite probably the best, don't change that lightly and if you do
|
/** Sine and triangle are quite probably the best, don't change that lightly and if you do
|
||||||
|
@ -157,7 +157,7 @@ void JoystickInfo::Destroy()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION >= 2
|
#if SDL_MAJOR_VERSION >= 2
|
||||||
#if SDL_MINOR_VERSION >= 4 // Version before 2.0.4 are bugged, JoystickClose crashes randomly
|
#if SDL_MINOR_VERSION >= 4 // Version before 2.0.4 are bugged, JoystickClose crashes randomly
|
||||||
if (joy)
|
if (joy)
|
||||||
SDL_JoystickClose(joy);
|
SDL_JoystickClose(joy);
|
||||||
#endif
|
#endif
|
||||||
|
@ -202,9 +202,9 @@ bool JoystickInfo::Init(int id)
|
||||||
// FIXME: people need to restart the plugin to take the option into account.
|
// FIXME: people need to restart the plugin to take the option into account.
|
||||||
bool hack_enabled = (conf->pad_options[0].sixaxis_pressure) || (conf->pad_options[1].sixaxis_pressure);
|
bool hack_enabled = (conf->pad_options[0].sixaxis_pressure) || (conf->pad_options[1].sixaxis_pressure);
|
||||||
if (found_hack != string::npos && numaxes > 4 && hack_enabled) {
|
if (found_hack != string::npos && numaxes > 4 && hack_enabled) {
|
||||||
numbuttons = 4; // (select, start, l3, r3)
|
numbuttons = 4; // (select, start, l3, r3)
|
||||||
// Enable this hack in bluetooth too. It avoid to restart the onepad gui
|
// Enable this hack in bluetooth too. It avoid to restart the onepad gui
|
||||||
numbuttons += 4; // the 4 hat buttons
|
numbuttons += 4; // the 4 hat buttons
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION >= 2
|
#if SDL_MAJOR_VERSION >= 2
|
||||||
|
@ -237,7 +237,7 @@ bool JoystickInfo::TestForce(float strength = 0.60)
|
||||||
#if SDL_MAJOR_VERSION >= 2
|
#if SDL_MAJOR_VERSION >= 2
|
||||||
// This code just use standard rumble to check that SDL handles the pad correctly! --3kinox
|
// This code just use standard rumble to check that SDL handles the pad correctly! --3kinox
|
||||||
if (haptic == NULL)
|
if (haptic == NULL)
|
||||||
return false; // Otherwise, core dump!
|
return false; // Otherwise, core dump!
|
||||||
SDL_HapticRumbleInit(haptic);
|
SDL_HapticRumbleInit(haptic);
|
||||||
// Make the haptic pad rumble 60% strength for half a second, shoudld be enough for user to see if it works or not
|
// Make the haptic pad rumble 60% strength for half a second, shoudld be enough for user to see if it works or not
|
||||||
if (SDL_HapticRumblePlay(haptic, strength, 400) != 0) {
|
if (SDL_HapticRumblePlay(haptic, strength, 400) != 0) {
|
||||||
|
@ -308,7 +308,7 @@ bool JoystickInfo::PollAxes(u32 &pkey)
|
||||||
// Normally, old_value contains the release state so it can be used to detect the types of axis.
|
// Normally, old_value contains the release state so it can be used to detect the types of axis.
|
||||||
bool is_full_axis = (old_value < full_axis_ceil);
|
bool is_full_axis = (old_value < full_axis_ceil);
|
||||||
|
|
||||||
if ((!is_full_axis && abs(value) <= half_axis_ceil) || (is_full_axis && value <= full_axis_ceil)) // we don't want this
|
if ((!is_full_axis && abs(value) <= half_axis_ceil) || (is_full_axis && value <= full_axis_ceil)) // we don't want this
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "GamePad.h"
|
#include "GamePad.h"
|
||||||
#include "onepad.h"
|
#include "onepad.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#define NB_EFFECT 2 // Don't use more than two, ps2 only has one for big motor and one for small(like most systems)
|
#define NB_EFFECT 2 // Don't use more than two, ps2 only has one for big motor and one for small(like most systems)
|
||||||
// holds all joystick info
|
// holds all joystick info
|
||||||
class JoystickInfo : GamePad
|
class JoystickInfo : GamePad
|
||||||
{
|
{
|
||||||
|
@ -49,8 +49,8 @@ public:
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
JoystickInfo(const JoystickInfo &); // copy constructor
|
JoystickInfo(const JoystickInfo &); // copy constructor
|
||||||
JoystickInfo &operator=(const JoystickInfo &); // assignment
|
JoystickInfo &operator=(const JoystickInfo &); // assignment
|
||||||
|
|
||||||
void Destroy();
|
void Destroy();
|
||||||
// opens handles to all possible joysticks
|
// opens handles to all possible joysticks
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
|
|
||||||
void Rumble(int type, int pad);
|
void Rumble(int type, int pad);
|
||||||
|
|
||||||
bool Init(int id); // opens a handle and gets information
|
bool Init(int id); // opens a handle and gets information
|
||||||
|
|
||||||
bool TestForce(float);
|
bool TestForce(float);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string.h> // for memset
|
#include <string.h> // for memset
|
||||||
#define MAX_KEYS 24
|
#define MAX_KEYS 24
|
||||||
|
|
||||||
enum KeyType {
|
enum KeyType {
|
||||||
|
@ -68,9 +68,9 @@ public:
|
||||||
u16 mouse_r : 1;
|
u16 mouse_r : 1;
|
||||||
u16 sixaxis_usb : 1;
|
u16 sixaxis_usb : 1;
|
||||||
u16 sixaxis_pressure : 1;
|
u16 sixaxis_pressure : 1;
|
||||||
u16 _free : 7; // The 8 remaining bits are unused, do what you wish with them ;)
|
u16 _free : 7; // The 8 remaining bits are unused, do what you wish with them ;)
|
||||||
} pad_options[GAMEPAD_NUMBER]; // One for each pads
|
} pad_options[GAMEPAD_NUMBER]; // One for each pads
|
||||||
u32 packed_options; // Only first 8 bits of each 16 bits series are really used, rest is padding
|
u32 packed_options; // Only first 8 bits of each 16 bits series are really used, rest is padding
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 keys[GAMEPAD_NUMBER][MAX_KEYS];
|
u32 keys[GAMEPAD_NUMBER][MAX_KEYS];
|
||||||
|
@ -84,19 +84,19 @@ public:
|
||||||
{
|
{
|
||||||
memset(&keys, 0, sizeof(keys));
|
memset(&keys, 0, sizeof(keys));
|
||||||
log = packed_options = joyid_map = 0;
|
log = packed_options = joyid_map = 0;
|
||||||
ff_intensity = 0x7FFF; // set it at max value by default
|
ff_intensity = 0x7FFF; // set it at max value by default
|
||||||
sensibility = 500;
|
sensibility = 500;
|
||||||
for (int pad = 0; pad < GAMEPAD_NUMBER; pad++) {
|
for (int pad = 0; pad < GAMEPAD_NUMBER; pad++) {
|
||||||
keysym_map[pad].clear();
|
keysym_map[pad].clear();
|
||||||
set_joyid((u32)pad, (u32)pad); // define id mapping for each gamepad
|
set_joyid((u32)pad, (u32)pad); // define id mapping for each gamepad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_joyid(u32 pad, u32 joy_id)
|
void set_joyid(u32 pad, u32 joy_id)
|
||||||
{
|
{
|
||||||
int shift = 8 * pad;
|
int shift = 8 * pad;
|
||||||
joyid_map &= ~(0xFF << shift); // clear
|
joyid_map &= ~(0xFF << shift); // clear
|
||||||
joyid_map |= (joy_id & 0xFF) << shift; // set
|
joyid_map |= (joy_id & 0xFF) << shift; // set
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 get_joyid(u32 pad)
|
u32 get_joyid(u32 pad)
|
||||||
|
|
|
@ -48,7 +48,7 @@ bool toggleAutoRepeat = false;
|
||||||
|
|
||||||
const u32 version = PS2E_PAD_VERSION;
|
const u32 version = PS2E_PAD_VERSION;
|
||||||
const u32 revision = 1;
|
const u32 revision = 1;
|
||||||
const u32 build = 3; // increase that with each version
|
const u32 build = 3; // increase that with each version
|
||||||
#define PAD_SAVE_STATE_VERSION ((revision << 8) | (build << 0))
|
#define PAD_SAVE_STATE_VERSION ((revision << 8) | (build << 0))
|
||||||
|
|
||||||
FILE *padLog = NULL;
|
FILE *padLog = NULL;
|
||||||
|
@ -241,7 +241,7 @@ PADclose()
|
||||||
EXPORT_C_(u32)
|
EXPORT_C_(u32)
|
||||||
PADquery()
|
PADquery()
|
||||||
{
|
{
|
||||||
return 3; // both
|
return 3; // both
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32)
|
EXPORT_C_(s32)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#ifndef __PAD_H__
|
#ifndef __PAD_H__
|
||||||
#define __PAD_H__
|
#define __PAD_H__
|
||||||
|
|
||||||
#define GAMEPAD_NUMBER 2 // numbers of gamepad
|
#define GAMEPAD_NUMBER 2 // numbers of gamepad
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -88,38 +88,38 @@ enum PadCommands {
|
||||||
CMD_CONFIG_MODE = 0x43,
|
CMD_CONFIG_MODE = 0x43,
|
||||||
CMD_SET_MODE_AND_LOCK = 0x44,
|
CMD_SET_MODE_AND_LOCK = 0x44,
|
||||||
CMD_QUERY_MODEL_AND_MODE = 0x45,
|
CMD_QUERY_MODEL_AND_MODE = 0x45,
|
||||||
CMD_QUERY_ACT = 0x46, // ??
|
CMD_QUERY_ACT = 0x46, // ??
|
||||||
CMD_QUERY_COMB = 0x47, // ??
|
CMD_QUERY_COMB = 0x47, // ??
|
||||||
CMD_QUERY_MODE = 0x4C, // QUERY_MODE ??
|
CMD_QUERY_MODE = 0x4C, // QUERY_MODE ??
|
||||||
CMD_VIBRATION_TOGGLE = 0x4D,
|
CMD_VIBRATION_TOGGLE = 0x4D,
|
||||||
CMD_SET_DS2_NATIVE_MODE = 0x4F // SET_DS2_NATIVE_MODE
|
CMD_SET_DS2_NATIVE_MODE = 0x4F // SET_DS2_NATIVE_MODE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum gamePadValues {
|
enum gamePadValues {
|
||||||
PAD_L2 = 0, // L2 button
|
PAD_L2 = 0, // L2 button
|
||||||
PAD_R2, // R2 button
|
PAD_R2, // R2 button
|
||||||
PAD_L1, // L1 button
|
PAD_L1, // L1 button
|
||||||
PAD_R1, // R1 button
|
PAD_R1, // R1 button
|
||||||
PAD_TRIANGLE, // Triangle button ▲
|
PAD_TRIANGLE, // Triangle button ▲
|
||||||
PAD_CIRCLE, // Circle button ●
|
PAD_CIRCLE, // Circle button ●
|
||||||
PAD_CROSS, // Cross button ✖
|
PAD_CROSS, // Cross button ✖
|
||||||
PAD_SQUARE, // Square button ■
|
PAD_SQUARE, // Square button ■
|
||||||
PAD_SELECT, // Select button
|
PAD_SELECT, // Select button
|
||||||
PAD_L3, // Left joystick button (L3)
|
PAD_L3, // Left joystick button (L3)
|
||||||
PAD_R3, // Right joystick button (R3)
|
PAD_R3, // Right joystick button (R3)
|
||||||
PAD_START, // Start button
|
PAD_START, // Start button
|
||||||
PAD_UP, // Directional pad ↑
|
PAD_UP, // Directional pad ↑
|
||||||
PAD_RIGHT, // Directional pad →
|
PAD_RIGHT, // Directional pad →
|
||||||
PAD_DOWN, // Directional pad ↓
|
PAD_DOWN, // Directional pad ↓
|
||||||
PAD_LEFT, // Directional pad ←
|
PAD_LEFT, // Directional pad ←
|
||||||
PAD_L_UP, // Left joystick (Up) ↑
|
PAD_L_UP, // Left joystick (Up) ↑
|
||||||
PAD_L_RIGHT, // Left joystick (Right) →
|
PAD_L_RIGHT, // Left joystick (Right) →
|
||||||
PAD_L_DOWN, // Left joystick (Down) ↓
|
PAD_L_DOWN, // Left joystick (Down) ↓
|
||||||
PAD_L_LEFT, // Left joystick (Left) ←
|
PAD_L_LEFT, // Left joystick (Left) ←
|
||||||
PAD_R_UP, // Right joystick (Up) ↑
|
PAD_R_UP, // Right joystick (Up) ↑
|
||||||
PAD_R_RIGHT, // Right joystick (Right) →
|
PAD_R_RIGHT, // Right joystick (Right) →
|
||||||
PAD_R_DOWN, // Right joystick (Down) ↓
|
PAD_R_DOWN, // Right joystick (Down) ↓
|
||||||
PAD_R_LEFT // Right joystick (Left) ←
|
PAD_R_LEFT // Right joystick (Left) ←
|
||||||
};
|
};
|
||||||
|
|
||||||
extern keyEvent event;
|
extern keyEvent event;
|
||||||
|
|
|
@ -244,7 +244,7 @@ u8 pad_poll(u8 value)
|
||||||
query.response[3] = (buttons >> 8) & 0xFF;
|
query.response[3] = (buttons >> 8) & 0xFF;
|
||||||
query.response[4] = (buttons >> 0) & 0xFF;
|
query.response[4] = (buttons >> 0) & 0xFF;
|
||||||
|
|
||||||
if (pad->mode != MODE_DIGITAL) { // ANALOG || DS2 native
|
if (pad->mode != MODE_DIGITAL) { // ANALOG || DS2 native
|
||||||
query.numBytes = 9;
|
query.numBytes = 9;
|
||||||
|
|
||||||
query.response[5] = key_status->get(query.port, PAD_R_RIGHT);
|
query.response[5] = key_status->get(query.port, PAD_R_RIGHT);
|
||||||
|
@ -252,7 +252,7 @@ u8 pad_poll(u8 value)
|
||||||
query.response[7] = key_status->get(query.port, PAD_L_RIGHT);
|
query.response[7] = key_status->get(query.port, PAD_L_RIGHT);
|
||||||
query.response[8] = key_status->get(query.port, PAD_L_UP);
|
query.response[8] = key_status->get(query.port, PAD_L_UP);
|
||||||
|
|
||||||
if (pad->mode != MODE_ANALOG) { // DS2 native
|
if (pad->mode != MODE_ANALOG) { // DS2 native
|
||||||
query.numBytes = 21;
|
query.numBytes = 21;
|
||||||
|
|
||||||
query.response[9] = !test_bit(buttons, 13) ? key_status->get(query.port, PAD_RIGHT) : 0;
|
query.response[9] = !test_bit(buttons, 13) ? key_status->get(query.port, PAD_RIGHT) : 0;
|
||||||
|
|
|
@ -23,7 +23,7 @@ static const int InvExpOffsets[] = {0, 4, 6, 8, 9, 10, 11, 12};
|
||||||
static u32 PsxRates[160];
|
static u32 PsxRates[160];
|
||||||
|
|
||||||
|
|
||||||
void InitADSR() // INIT ADSR
|
void InitADSR() // INIT ADSR
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (32 + 128); i++) {
|
for (int i = 0; i < (32 + 128); i++) {
|
||||||
int shift = (i - 32) >> 2;
|
int shift = (i - 32) >> 2;
|
||||||
|
@ -57,7 +57,7 @@ bool V_ADSR::Calculate()
|
||||||
Phase = 5;
|
Phase = 5;
|
||||||
|
|
||||||
switch (Phase) {
|
switch (Phase) {
|
||||||
case 1: // attack
|
case 1: // attack
|
||||||
if (Value == ADSR_MAX_VOL) {
|
if (Value == ADSR_MAX_VOL) {
|
||||||
// Already maxed out. Progress phase and nothing more:
|
// Already maxed out. Progress phase and nothing more:
|
||||||
Phase++;
|
Phase++;
|
||||||
|
@ -79,7 +79,7 @@ bool V_ADSR::Calculate()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // decay
|
case 2: // decay
|
||||||
{
|
{
|
||||||
u32 off = InvExpOffsets[(Value >> 28) & 7];
|
u32 off = InvExpOffsets[(Value >> 28) & 7];
|
||||||
Value -= PsxRates[((DecayRate ^ 0x1f) * 4) - 0x18 + off + 32];
|
Value -= PsxRates[((DecayRate ^ 0x1f) * 4) - 0x18 + off + 32];
|
||||||
|
@ -95,26 +95,26 @@ bool V_ADSR::Calculate()
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case 3: // sustain
|
case 3: // sustain
|
||||||
{
|
{
|
||||||
// 0x7f disables sustain (infinite sustain)
|
// 0x7f disables sustain (infinite sustain)
|
||||||
if (SustainRate == 0x7f)
|
if (SustainRate == 0x7f)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (SustainMode & 2) // decreasing
|
if (SustainMode & 2) // decreasing
|
||||||
{
|
{
|
||||||
if (SustainMode & 4) // exponential
|
if (SustainMode & 4) // exponential
|
||||||
{
|
{
|
||||||
u32 off = InvExpOffsets[(Value >> 28) & 7];
|
u32 off = InvExpOffsets[(Value >> 28) & 7];
|
||||||
Value -= PsxRates[(SustainRate ^ 0x7f) - 0x1b + off + 32];
|
Value -= PsxRates[(SustainRate ^ 0x7f) - 0x1b + off + 32];
|
||||||
} else // linear
|
} else // linear
|
||||||
Value -= PsxRates[(SustainRate ^ 0x7f) - 0xf + 32];
|
Value -= PsxRates[(SustainRate ^ 0x7f) - 0xf + 32];
|
||||||
|
|
||||||
if (Value <= 0) {
|
if (Value <= 0) {
|
||||||
Value = 0;
|
Value = 0;
|
||||||
Phase++;
|
Phase++;
|
||||||
}
|
}
|
||||||
} else { // increasing
|
} else { // increasing
|
||||||
if ((SustainMode & 4) && (Value >= 0x60000000))
|
if ((SustainMode & 4) && (Value >= 0x60000000))
|
||||||
Value += PsxRates[(SustainRate ^ 0x7f) - 0x18 + 32];
|
Value += PsxRates[(SustainRate ^ 0x7f) - 0x18 + 32];
|
||||||
else
|
else
|
||||||
|
@ -128,18 +128,18 @@ bool V_ADSR::Calculate()
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case 4: // sustain end
|
case 4: // sustain end
|
||||||
Value = (SustainMode & 2) ? 0 : ADSR_MAX_VOL;
|
Value = (SustainMode & 2) ? 0 : ADSR_MAX_VOL;
|
||||||
if (Value == 0)
|
if (Value == 0)
|
||||||
Phase = 6;
|
Phase = 6;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // release
|
case 5: // release
|
||||||
if (ReleaseMode) // exponential
|
if (ReleaseMode) // exponential
|
||||||
{
|
{
|
||||||
u32 off = InvExpOffsets[(Value >> 28) & 7];
|
u32 off = InvExpOffsets[(Value >> 28) & 7];
|
||||||
Value -= PsxRates[((ReleaseRate ^ 0x1f) * 4) - 0x18 + off + 32];
|
Value -= PsxRates[((ReleaseRate ^ 0x1f) * 4) - 0x18 + off + 32];
|
||||||
} else { // linear
|
} else { // linear
|
||||||
//Value-=PsxRates[((ReleaseRate^0x1f)*4)-0xc+32];
|
//Value-=PsxRates[((ReleaseRate^0x1f)*4)-0xc+32];
|
||||||
if (ReleaseRate != 0x1f)
|
if (ReleaseRate != 0x1f)
|
||||||
Value -= (1 << (0x1f - ReleaseRate));
|
Value -= (1 << (0x1f - ReleaseRate));
|
||||||
|
@ -151,7 +151,7 @@ bool V_ADSR::Calculate()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: // release end
|
case 6: // release end
|
||||||
Value = 0;
|
Value = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ void V_VolumeSlide::Update()
|
||||||
|
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
value = 0;
|
value = 0;
|
||||||
Mode = 0; // disable slide
|
Mode = 0; // disable slide
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Increment
|
// Increment
|
||||||
|
@ -208,10 +208,10 @@ void V_VolumeSlide::Update()
|
||||||
// linear / Pseudo below 75% (they're the same)
|
// linear / Pseudo below 75% (they're the same)
|
||||||
value += PsxRates[(Increment ^ 0x7f) - 0x10 + 32];
|
value += PsxRates[(Increment ^ 0x7f) - 0x10 + 32];
|
||||||
|
|
||||||
if (value < 0) // wrapped around the "top"?
|
if (value < 0) // wrapped around the "top"?
|
||||||
{
|
{
|
||||||
value = 0x7fffffff;
|
value = 0x7fffffff;
|
||||||
Mode = 0; // disable slide
|
Mode = 0; // disable slide
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ extern wxString RegDumpFileName;
|
||||||
extern int Interpolation;
|
extern int Interpolation;
|
||||||
extern int numSpeakers;
|
extern int numSpeakers;
|
||||||
extern bool EffectsDisabled;
|
extern bool EffectsDisabled;
|
||||||
extern float FinalVolume; // Global / pre-scale
|
extern float FinalVolume; // Global / pre-scale
|
||||||
extern bool AdvancedVolumeControl;
|
extern bool AdvancedVolumeControl;
|
||||||
extern float VolumeAdjustFLdb;
|
extern float VolumeAdjustFLdb;
|
||||||
extern float VolumeAdjustCdb;
|
extern float VolumeAdjustCdb;
|
||||||
|
|
|
@ -68,4 +68,4 @@ using WaveDump::CoreSrc_PreReverb;
|
||||||
using WaveDump::CoreSrc_PostReverb;
|
using WaveDump::CoreSrc_PostReverb;
|
||||||
using WaveDump::CoreSrc_External;
|
using WaveDump::CoreSrc_External;
|
||||||
|
|
||||||
#endif // DEBUG_H_INCLUDED //
|
#endif // DEBUG_H_INCLUDED //
|
||||||
|
|
|
@ -121,19 +121,19 @@ void DPLII::Convert(s16 *obuffer, s32 ValL, s32 ValR)
|
||||||
LR = (s32)(lpf_r.sample((ValR >> 4) / pow_2_31) * pow_2_31);
|
LR = (s32)(lpf_r.sample((ValR >> 4) / pow_2_31) * pow_2_31);
|
||||||
LFE = (LL + LR) >> 4;
|
LFE = (LL + LR) >> 4;
|
||||||
|
|
||||||
C = (ValL + ValR) >> 1; //16.8
|
C = (ValL + ValR) >> 1; //16.8
|
||||||
|
|
||||||
ValL -= C; //16.8
|
ValL -= C; //16.8
|
||||||
ValR -= C; //16.8
|
ValR -= C; //16.8
|
||||||
|
|
||||||
L = ValL >> 8; //16.0
|
L = ValL >> 8; //16.0
|
||||||
R = ValR >> 8; //16.0
|
R = ValR >> 8; //16.0
|
||||||
C = C >> 8; //16.0
|
C = C >> 8; //16.0
|
||||||
|
|
||||||
const s32 Cfl = 1 + sLogTable[Gfl];
|
const s32 Cfl = 1 + sLogTable[Gfl];
|
||||||
const s32 Cfr = 1 + sLogTable[Gfr];
|
const s32 Cfr = 1 + sLogTable[Gfr];
|
||||||
|
|
||||||
const s32 VL = (ValL >> 4) * Cfl; //16.12
|
const s32 VL = (ValL >> 4) * Cfl; //16.12
|
||||||
const s32 VR = (ValR >> 4) * Cfr;
|
const s32 VR = (ValR >> 4) * Cfr;
|
||||||
|
|
||||||
const s32 SC = (VL - VR) >> 15;
|
const s32 SC = (VL - VR) >> 15;
|
||||||
|
@ -145,7 +145,7 @@ void DPLII::Convert(s16 *obuffer, s32 ValL, s32 ValR)
|
||||||
|
|
||||||
obuffer[0] = spdif_data[0] + (((L * Config_DSound51.GainL)) >> 8) + AddCX;
|
obuffer[0] = spdif_data[0] + (((L * Config_DSound51.GainL)) >> 8) + AddCX;
|
||||||
obuffer[1] = spdif_data[1] + (((R * Config_DSound51.GainR)) >> 8) + AddCX;
|
obuffer[1] = spdif_data[1] + (((R * Config_DSound51.GainR)) >> 8) + AddCX;
|
||||||
obuffer[2] = spdif_data[2] + (((C * Config_DSound51.GainC)) >> 8); // - AddCX;
|
obuffer[2] = spdif_data[2] + (((C * Config_DSound51.GainC)) >> 8); // - AddCX;
|
||||||
obuffer[3] = spdif_data[3] + (((LFE * Config_DSound51.GainLFE)) >> 8);
|
obuffer[3] = spdif_data[3] + (((LFE * Config_DSound51.GainLFE)) >> 8);
|
||||||
obuffer[4] = spdif_data[4] + (((SL * Config_DSound51.GainSL)) >> 8);
|
obuffer[4] = spdif_data[4] + (((SL * Config_DSound51.GainSL)) >> 8);
|
||||||
obuffer[5] = spdif_data[5] + (((SR * Config_DSound51.GainSR)) >> 8);
|
obuffer[5] = spdif_data[5] + (((SR * Config_DSound51.GainSR)) >> 8);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Dma.h"
|
#include "Dma.h"
|
||||||
|
|
||||||
#include "PS2E-spu2.h" // temporary until I resolve cyclePtr/TimeUpdate dependencies.
|
#include "PS2E-spu2.h" // temporary until I resolve cyclePtr/TimeUpdate dependencies.
|
||||||
|
|
||||||
extern u8 callirq;
|
extern u8 callirq;
|
||||||
|
|
||||||
|
@ -95,10 +95,10 @@ void V_Core::LogAutoDMA(FILE *fp)
|
||||||
fwrite(DMAPtr + InputDataProgress, 0x400, 1, fp);
|
fwrite(DMAPtr + InputDataProgress, 0x400, 1, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_Core::AutoDMAReadBuffer(int mode) //mode: 0= split stereo; 1 = do not split stereo
|
void V_Core::AutoDMAReadBuffer(int mode) //mode: 0= split stereo; 1 = do not split stereo
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_NEW_IOPDMA_SPU2
|
#ifndef ENABLE_NEW_IOPDMA_SPU2
|
||||||
int spos = ((InputPosRead + 0xff) & 0x100); //starting position of the free buffer
|
int spos = ((InputPosRead + 0xff) & 0x100); //starting position of the free buffer
|
||||||
|
|
||||||
LogAutoDMA(Index ? ADMA7LogFile : ADMA4LogFile);
|
LogAutoDMA(Index ? ADMA7LogFile : ADMA4LogFile);
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ void V_Core::StartADMAWrite(u16 *pMem, u32 sz)
|
||||||
// by the grace of not being used."
|
// by the grace of not being used."
|
||||||
//
|
//
|
||||||
// Update: This hack is no longer needed when we don't do a core reset. Guess the null pc was in spu2 memory?
|
// Update: This hack is no longer needed when we don't do a core reset. Guess the null pc was in spu2 memory?
|
||||||
#define NO_BIOS_HACKFIX 1 // set to 1 to disable the hackfix
|
#define NO_BIOS_HACKFIX 1 // set to 1 to disable the hackfix
|
||||||
|
|
||||||
void V_Core::PlainDMAWrite(u16 *pMem, u32 size)
|
void V_Core::PlainDMAWrite(u16 *pMem, u32 size)
|
||||||
{
|
{
|
||||||
|
@ -534,7 +534,7 @@ s32 V_Core::NewDmaWrite(u32 *data, u32 bytesLeft, u32 *bytesProcessed)
|
||||||
|
|
||||||
s16 *mptr = (s16 *)data;
|
s16 *mptr = (s16 *)data;
|
||||||
|
|
||||||
if (false) //(mode)
|
if (false) //(mode)
|
||||||
{
|
{
|
||||||
//memcpy((ADMATempBuffer+(InputPosWrite<<1)),mptr,0x400);
|
//memcpy((ADMATempBuffer+(InputPosWrite<<1)),mptr,0x400);
|
||||||
memcpy(GetMemPtr(0x2000 + (Index << 10) + InputPosWrite), mptr, 0x400);
|
memcpy(GetMemPtr(0x2000 + (Index << 10) + InputPosWrite), mptr, 0x400);
|
||||||
|
@ -595,10 +595,10 @@ s32 V_Core::NewDmaWrite(u32 *data, u32 bytesLeft, u32 *bytesProcessed)
|
||||||
|
|
||||||
if (processed == 0) {
|
if (processed == 0) {
|
||||||
*bytesProcessed = 0;
|
*bytesProcessed = 0;
|
||||||
return 768 * 15; // pause a bit
|
return 768 * 15; // pause a bit
|
||||||
} else {
|
} else {
|
||||||
*bytesProcessed = processed;
|
*bytesProcessed = processed;
|
||||||
return 0; // auto pause
|
return 0; // auto pause
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (MsgDMA() && DmaStarting)
|
if (MsgDMA() && DmaStarting)
|
||||||
|
|
|
@ -45,7 +45,7 @@ static float LMax = 0, RMax = 0;
|
||||||
static float AccL = 0;
|
static float AccL = 0;
|
||||||
static float AccR = 0;
|
static float AccR = 0;
|
||||||
|
|
||||||
const float Scale = 4294967296.0f; // tweak this value to change the overall output volume
|
const float Scale = 4294967296.0f; // tweak this value to change the overall output volume
|
||||||
|
|
||||||
const float GainL = 0.80f * Scale;
|
const float GainL = 0.80f * Scale;
|
||||||
const float GainR = 0.80f * Scale;
|
const float GainR = 0.80f * Scale;
|
||||||
|
@ -57,7 +57,7 @@ const float GainSR = 0.90f * Scale;
|
||||||
|
|
||||||
const float GainLFE = 0.90f * Scale;
|
const float GainLFE = 0.90f * Scale;
|
||||||
|
|
||||||
const float AddCLR = 0.20f * Scale; // Stereo expansion
|
const float AddCLR = 0.20f * Scale; // Stereo expansion
|
||||||
|
|
||||||
extern void ResetDplIIDecoder()
|
extern void ResetDplIIDecoder()
|
||||||
{
|
{
|
||||||
|
@ -76,9 +76,9 @@ void ProcessDplIISample32(const StereoOut32 &src, Stereo51Out32DplII *s)
|
||||||
|
|
||||||
// Calculate center channel and LFE
|
// Calculate center channel and LFE
|
||||||
float C = (IL + IR) * 0.5f;
|
float C = (IL + IR) * 0.5f;
|
||||||
float SUB = C; // no need to lowpass, the speaker amplifier should take care of it
|
float SUB = C; // no need to lowpass, the speaker amplifier should take care of it
|
||||||
|
|
||||||
float L = IL - C; // Effective L/R data
|
float L = IL - C; // Effective L/R data
|
||||||
float R = IR - C;
|
float R = IR - C;
|
||||||
|
|
||||||
// Peak L/R
|
// Peak L/R
|
||||||
|
@ -89,17 +89,17 @@ void ProcessDplIISample32(const StereoOut32 &src, Stereo51Out32DplII *s)
|
||||||
AccR += (PR - AccR) * 0.1f;
|
AccR += (PR - AccR) * 0.1f;
|
||||||
|
|
||||||
// Calculate power balance
|
// Calculate power balance
|
||||||
float Balance = (AccR - AccL); // -1 .. 1
|
float Balance = (AccR - AccL); // -1 .. 1
|
||||||
|
|
||||||
// If the power levels are different, then the audio is meant for the front speakers
|
// If the power levels are different, then the audio is meant for the front speakers
|
||||||
float Frontness = std::abs(Balance);
|
float Frontness = std::abs(Balance);
|
||||||
float Rearness = 1 - Frontness; // And the other way around
|
float Rearness = 1 - Frontness; // And the other way around
|
||||||
|
|
||||||
// Equalize the power levels for L/R
|
// Equalize the power levels for L/R
|
||||||
float B = std::min(0.9f, std::max(-0.9f, Balance));
|
float B = std::min(0.9f, std::max(-0.9f, Balance));
|
||||||
|
|
||||||
float VL = L / (1 - B); // if B>0, it means R>L, so increase L, else decrease L
|
float VL = L / (1 - B); // if B>0, it means R>L, so increase L, else decrease L
|
||||||
float VR = R / (1 + B); // vice-versa
|
float VR = R / (1 + B); // vice-versa
|
||||||
|
|
||||||
// 1.73+1.22 = 2.94; 2.94 = 0.34 = 0.9996; Close enough.
|
// 1.73+1.22 = 2.94; 2.94 = 0.34 = 0.9996; Close enough.
|
||||||
// The range for VL/VR is approximately 0..1,
|
// The range for VL/VR is approximately 0..1,
|
||||||
|
@ -142,19 +142,19 @@ void ProcessDplSample32(const StereoOut32 &src, Stereo51Out32Dpl *s)
|
||||||
float ValL = src.Left / (float)(1 << (SndOutVolumeShift + 16));
|
float ValL = src.Left / (float)(1 << (SndOutVolumeShift + 16));
|
||||||
float ValR = src.Right / (float)(1 << (SndOutVolumeShift + 16));
|
float ValR = src.Right / (float)(1 << (SndOutVolumeShift + 16));
|
||||||
|
|
||||||
float C = (ValL + ValR) * 0.5f; //+15.8
|
float C = (ValL + ValR) * 0.5f; //+15.8
|
||||||
float S = (ValL - ValR) * 0.5f;
|
float S = (ValL - ValR) * 0.5f;
|
||||||
|
|
||||||
float L = ValL - C; //+15.8
|
float L = ValL - C; //+15.8
|
||||||
float R = ValR - C;
|
float R = ValR - C;
|
||||||
|
|
||||||
float SUB = C;
|
float SUB = C;
|
||||||
|
|
||||||
s32 CX = (s32)(C * AddCLR); // +15.16
|
s32 CX = (s32)(C * AddCLR); // +15.16
|
||||||
|
|
||||||
s->Left = (s32)(L * GainL) + CX; // +15.16 = +31, can grow to +32 if (GainL + AddCLR)>255
|
s->Left = (s32)(L * GainL) + CX; // +15.16 = +31, can grow to +32 if (GainL + AddCLR)>255
|
||||||
s->Right = (s32)(R * GainR) + CX;
|
s->Right = (s32)(R * GainR) + CX;
|
||||||
s->Center = (s32)(C * GainC); // +15.16 = +31
|
s->Center = (s32)(C * GainC); // +15.16 = +31
|
||||||
s->LFE = (s32)(SUB * GainLFE);
|
s->LFE = (s32)(SUB * GainLFE);
|
||||||
s->LeftBack = (s32)(S * GainSL);
|
s->LeftBack = (s32)(S * GainSL);
|
||||||
s->RightBack = (s32)(S * GainSR);
|
s->RightBack = (s32)(S * GainSR);
|
||||||
|
|
|
@ -48,7 +48,7 @@ class SoundTouch;
|
||||||
namespace VersionInfo
|
namespace VersionInfo
|
||||||
{
|
{
|
||||||
static const u8 Release = 2;
|
static const u8 Release = 2;
|
||||||
static const u8 Revision = 0; // increase that with each version
|
static const u8 Revision = 0; // increase that with each version
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
class AlsaMod : public SndOutModule
|
class AlsaMod : public SndOutModule
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
static const int PacketsPerBuffer = 1; // increase this if ALSA can't keep up with 512-sample packets
|
static const int PacketsPerBuffer = 1; // increase this if ALSA can't keep up with 512-sample packets
|
||||||
static const int MAX_BUFFER_COUNT = 4;
|
static const int MAX_BUFFER_COUNT = 4;
|
||||||
static const int NumBuffers = 4; // TODO: this should be configurable someday -- lower values reduce latency.
|
static const int NumBuffers = 4; // TODO: this should be configurable someday -- lower values reduce latency.
|
||||||
unsigned int pspeed;
|
unsigned int pspeed;
|
||||||
|
|
||||||
snd_pcm_t *handle;
|
snd_pcm_t *handle;
|
||||||
|
|
|
@ -39,4 +39,4 @@ extern void RemoveSound();
|
||||||
extern int SoundGetBytesBuffered();
|
extern int SoundGetBytesBuffered();
|
||||||
extern void SoundFeedVoiceData(unsigned char *pSound, long lBytes);
|
extern void SoundFeedVoiceData(unsigned char *pSound, long lBytes);
|
||||||
|
|
||||||
#endif // __LINUX_H__
|
#endif // __LINUX_H__
|
||||||
|
|
|
@ -47,9 +47,9 @@ int Interpolation = 4;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool EffectsDisabled = false;
|
bool EffectsDisabled = false;
|
||||||
float FinalVolume; // global
|
float FinalVolume; // global
|
||||||
bool AdvancedVolumeControl;
|
bool AdvancedVolumeControl;
|
||||||
float VolumeAdjustFLdb; // decibels settings, cos audiophiles love that
|
float VolumeAdjustFLdb; // decibels settings, cos audiophiles love that
|
||||||
float VolumeAdjustCdb;
|
float VolumeAdjustCdb;
|
||||||
float VolumeAdjustFRdb;
|
float VolumeAdjustFRdb;
|
||||||
float VolumeAdjustBLdb;
|
float VolumeAdjustBLdb;
|
||||||
|
@ -57,7 +57,7 @@ float VolumeAdjustBRdb;
|
||||||
float VolumeAdjustSLdb;
|
float VolumeAdjustSLdb;
|
||||||
float VolumeAdjustSRdb;
|
float VolumeAdjustSRdb;
|
||||||
float VolumeAdjustLFEdb;
|
float VolumeAdjustLFEdb;
|
||||||
float VolumeAdjustFL; // linear coefs calcualted from decibels,
|
float VolumeAdjustFL; // linear coefs calcualted from decibels,
|
||||||
float VolumeAdjustC;
|
float VolumeAdjustC;
|
||||||
float VolumeAdjustFR;
|
float VolumeAdjustFR;
|
||||||
float VolumeAdjustBL;
|
float VolumeAdjustBL;
|
||||||
|
@ -69,12 +69,12 @@ unsigned int delayCycles;
|
||||||
|
|
||||||
bool postprocess_filter_enabled = true;
|
bool postprocess_filter_enabled = true;
|
||||||
bool postprocess_filter_dealias = false;
|
bool postprocess_filter_dealias = false;
|
||||||
bool _visual_debug_enabled = false; // windows only feature
|
bool _visual_debug_enabled = false; // windows only feature
|
||||||
|
|
||||||
// OUTPUT
|
// OUTPUT
|
||||||
u32 OutputModule = 0;
|
u32 OutputModule = 0;
|
||||||
int SndOutLatencyMS = 300;
|
int SndOutLatencyMS = 300;
|
||||||
int SynchMode = 0; // Time Stretch, Async or Disabled
|
int SynchMode = 0; // Time Stretch, Async or Disabled
|
||||||
static u32 OutputAPI = 0;
|
static u32 OutputAPI = 0;
|
||||||
static u32 SdlOutputAPI = 0;
|
static u32 SdlOutputAPI = 0;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ void ReadSettings()
|
||||||
|
|
||||||
wxString temp;
|
wxString temp;
|
||||||
CfgReadStr(L"OUTPUT", L"Output_Module", temp, PortaudioOut->GetIdent());
|
CfgReadStr(L"OUTPUT", L"Output_Module", temp, PortaudioOut->GetIdent());
|
||||||
OutputModule = FindOutputModuleById(temp.c_str()); // find the driver index of this module
|
OutputModule = FindOutputModuleById(temp.c_str()); // find the driver index of this module
|
||||||
|
|
||||||
// find current API
|
// find current API
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
|
@ -101,4 +101,4 @@ void AboutBox();
|
||||||
extern wxFileConfig *spuConfig;
|
extern wxFileConfig *spuConfig;
|
||||||
extern bool pathSet;
|
extern bool pathSet;
|
||||||
extern void initIni();
|
extern void initIni();
|
||||||
#endif // CONFIG_H_INCLUDED
|
#endif // CONFIG_H_INCLUDED
|
||||||
|
|
|
@ -174,7 +174,7 @@ void DisplayDialog()
|
||||||
// Create the widgets
|
// Create the widgets
|
||||||
dialog = gtk_dialog_new_with_buttons(
|
dialog = gtk_dialog_new_with_buttons(
|
||||||
"Spu2-X Config",
|
"Spu2-X Config",
|
||||||
NULL, // parent window
|
NULL, // parent window
|
||||||
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
|
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
|
||||||
"OK", GTK_RESPONSE_ACCEPT,
|
"OK", GTK_RESPONSE_ACCEPT,
|
||||||
"Cancel", GTK_RESPONSE_REJECT,
|
"Cancel", GTK_RESPONSE_REJECT,
|
||||||
|
|
|
@ -152,7 +152,7 @@ static __forceinline s32 GetNextDataBuffered(V_Core &thiscore, uint voiceidx)
|
||||||
if ((vc.SCurrent & 3) == 0) {
|
if ((vc.SCurrent & 3) == 0) {
|
||||||
IncrementNextA(thiscore, voiceidx);
|
IncrementNextA(thiscore, voiceidx);
|
||||||
|
|
||||||
if ((vc.NextA & 7) == 0) // vc.SCurrent == 24 equivalent
|
if ((vc.NextA & 7) == 0) // vc.SCurrent == 24 equivalent
|
||||||
{
|
{
|
||||||
if (vc.LoopFlags & XAFLAG_LOOP_END) {
|
if (vc.LoopFlags & XAFLAG_LOOP_END) {
|
||||||
thiscore.Regs.ENDX |= (1 << voiceidx);
|
thiscore.Regs.ENDX |= (1 << voiceidx);
|
||||||
|
@ -166,7 +166,7 @@ static __forceinline s32 GetNextDataBuffered(V_Core &thiscore, uint voiceidx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
vc.NextA++; // no, don't IncrementNextA here. We haven't read the header yet.
|
vc.NextA++; // no, don't IncrementNextA here. We haven't read the header yet.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ static __forceinline s32 GetNextDataBuffered(V_Core &thiscore, uint voiceidx)
|
||||||
SetIrqCall(i);
|
SetIrqCall(i);
|
||||||
|
|
||||||
s16 *memptr = GetMemPtr(vc.NextA & 0xFFFF8);
|
s16 *memptr = GetMemPtr(vc.NextA & 0xFFFF8);
|
||||||
vc.LoopFlags = *memptr >> 8; // grab loop flags from the upper byte.
|
vc.LoopFlags = *memptr >> 8; // grab loop flags from the upper byte.
|
||||||
|
|
||||||
if ((vc.LoopFlags & XAFLAG_LOOP_START) && !vc.LoopMode)
|
if ((vc.LoopFlags & XAFLAG_LOOP_START) && !vc.LoopMode)
|
||||||
vc.LoopStartA = vc.NextA & 0xFFFF8;
|
vc.LoopStartA = vc.NextA & 0xFFFF8;
|
||||||
|
@ -225,13 +225,13 @@ static __forceinline void GetNextDataDummy(V_Core &thiscore, uint voiceidx)
|
||||||
|
|
||||||
IncrementNextA(thiscore, voiceidx);
|
IncrementNextA(thiscore, voiceidx);
|
||||||
|
|
||||||
if ((vc.NextA & 7) == 0) // vc.SCurrent == 24 equivalent
|
if ((vc.NextA & 7) == 0) // vc.SCurrent == 24 equivalent
|
||||||
{
|
{
|
||||||
if (vc.LoopFlags & XAFLAG_LOOP_END) {
|
if (vc.LoopFlags & XAFLAG_LOOP_END) {
|
||||||
thiscore.Regs.ENDX |= (1 << voiceidx);
|
thiscore.Regs.ENDX |= (1 << voiceidx);
|
||||||
vc.NextA = vc.LoopStartA | 1;
|
vc.NextA = vc.LoopStartA | 1;
|
||||||
} else
|
} else
|
||||||
vc.NextA++; // no, don't IncrementNextA here. We haven't read the header yet.
|
vc.NextA++; // no, don't IncrementNextA here. We haven't read the header yet.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vc.SCurrent == 28) {
|
if (vc.SCurrent == 28) {
|
||||||
|
@ -239,7 +239,7 @@ static __forceinline void GetNextDataDummy(V_Core &thiscore, uint voiceidx)
|
||||||
if (Cores[i].IRQEnable && Cores[i].IRQA == (vc.NextA & 0xFFFF8))
|
if (Cores[i].IRQEnable && Cores[i].IRQA == (vc.NextA & 0xFFFF8))
|
||||||
SetIrqCall(i);
|
SetIrqCall(i);
|
||||||
|
|
||||||
vc.LoopFlags = *GetMemPtr(vc.NextA & 0xFFFF8) >> 8; // grab loop flags from the upper byte.
|
vc.LoopFlags = *GetMemPtr(vc.NextA & 0xFFFF8) >> 8; // grab loop flags from the upper byte.
|
||||||
|
|
||||||
if ((vc.LoopFlags & XAFLAG_LOOP_START) && !vc.LoopMode)
|
if ((vc.LoopFlags & XAFLAG_LOOP_START) && !vc.LoopMode)
|
||||||
vc.LoopStartA = vc.NextA & 0xFFFF8;
|
vc.LoopStartA = vc.NextA & 0xFFFF8;
|
||||||
|
@ -335,7 +335,7 @@ static __forceinline void CalculateADSR(V_Core &thiscore, uint voiceidx)
|
||||||
vc.Stop();
|
vc.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
pxAssume(vc.ADSR.Value >= 0); // ADSR should never be negative...
|
pxAssume(vc.ADSR.Value >= 0); // ADSR should never be negative...
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -343,34 +343,34 @@ static __forceinline void CalculateADSR(V_Core &thiscore, uint voiceidx)
|
||||||
*/
|
*/
|
||||||
template <s32 i_tension>
|
template <s32 i_tension>
|
||||||
__forceinline static s32 HermiteInterpolate(
|
__forceinline static s32 HermiteInterpolate(
|
||||||
s32 y0, // 16.0
|
s32 y0, // 16.0
|
||||||
s32 y1, // 16.0
|
s32 y1, // 16.0
|
||||||
s32 y2, // 16.0
|
s32 y2, // 16.0
|
||||||
s32 y3, // 16.0
|
s32 y3, // 16.0
|
||||||
s32 mu // 0.12
|
s32 mu // 0.12
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
s32 m00 = ((y1 - y0) * i_tension) >> 16; // 16.0
|
s32 m00 = ((y1 - y0) * i_tension) >> 16; // 16.0
|
||||||
s32 m01 = ((y2 - y1) * i_tension) >> 16; // 16.0
|
s32 m01 = ((y2 - y1) * i_tension) >> 16; // 16.0
|
||||||
s32 m0 = m00 + m01;
|
s32 m0 = m00 + m01;
|
||||||
|
|
||||||
s32 m10 = ((y2 - y1) * i_tension) >> 16; // 16.0
|
s32 m10 = ((y2 - y1) * i_tension) >> 16; // 16.0
|
||||||
s32 m11 = ((y3 - y2) * i_tension) >> 16; // 16.0
|
s32 m11 = ((y3 - y2) * i_tension) >> 16; // 16.0
|
||||||
s32 m1 = m10 + m11;
|
s32 m1 = m10 + m11;
|
||||||
|
|
||||||
s32 val = ((2 * y1 + m0 + m1 - 2 * y2) * mu) >> 12; // 16.0
|
s32 val = ((2 * y1 + m0 + m1 - 2 * y2) * mu) >> 12; // 16.0
|
||||||
val = ((val - 3 * y1 - 2 * m0 - m1 + 3 * y2) * mu) >> 12; // 16.0
|
val = ((val - 3 * y1 - 2 * m0 - m1 + 3 * y2) * mu) >> 12; // 16.0
|
||||||
val = ((val + m0) * mu) >> 11; // 16.0
|
val = ((val + m0) * mu) >> 11; // 16.0
|
||||||
|
|
||||||
return (val + (y1 << 1));
|
return (val + (y1 << 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline static s32 CatmullRomInterpolate(
|
__forceinline static s32 CatmullRomInterpolate(
|
||||||
s32 y0, // 16.0
|
s32 y0, // 16.0
|
||||||
s32 y1, // 16.0
|
s32 y1, // 16.0
|
||||||
s32 y2, // 16.0
|
s32 y2, // 16.0
|
||||||
s32 y3, // 16.0
|
s32 y3, // 16.0
|
||||||
s32 mu // 0.12
|
s32 mu // 0.12
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//q(t) = 0.5 *( (2 * P1) +
|
//q(t) = 0.5 *( (2 * P1) +
|
||||||
|
@ -391,11 +391,11 @@ __forceinline static s32 CatmullRomInterpolate(
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline static s32 CubicInterpolate(
|
__forceinline static s32 CubicInterpolate(
|
||||||
s32 y0, // 16.0
|
s32 y0, // 16.0
|
||||||
s32 y1, // 16.0
|
s32 y1, // 16.0
|
||||||
s32 y2, // 16.0
|
s32 y2, // 16.0
|
||||||
s32 y3, // 16.0
|
s32 y3, // 16.0
|
||||||
s32 mu // 0.12
|
s32 mu // 0.12
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const s32 a0 = y3 - y2 - y0 + y1;
|
const s32 a0 = y3 - y2 - y0 + y1;
|
||||||
|
@ -445,7 +445,7 @@ static __forceinline s32 GetVoiceValues(V_Core &thiscore, uint voiceidx)
|
||||||
jNO_DEFAULT;
|
jNO_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; // technically unreachable!
|
return 0; // technically unreachable!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Noise values need to be mixed without going through interpolation, since it
|
// Noise values need to be mixed without going through interpolation, since it
|
||||||
|
@ -578,14 +578,14 @@ static __forceinline StereoOut32 MixVoice(uint coreidx, uint voiceidx)
|
||||||
return ApplyVolume(StereoOut32(Value, Value), vc.Volume);
|
return ApplyVolume(StereoOut32(Value, Value), vc.Volume);
|
||||||
} else {
|
} else {
|
||||||
// Continue processing voice, even if it's "off". Or else we miss interrupts! (Fatal Frame engine died because of this.)
|
// Continue processing voice, even if it's "off". Or else we miss interrupts! (Fatal Frame engine died because of this.)
|
||||||
if (NEVER_SKIP_VOICES || (*GetMemPtr(vc.NextA & 0xFFFF8) >> 8 & 3) != 3 || vc.LoopStartA != (vc.NextA & ~7) // not in a tight loop
|
if (NEVER_SKIP_VOICES || (*GetMemPtr(vc.NextA & 0xFFFF8) >> 8 & 3) != 3 || vc.LoopStartA != (vc.NextA & ~7) // not in a tight loop
|
||||||
|| (Cores[0].IRQEnable && (Cores[0].IRQA & ~7) == vc.LoopStartA) // or should be interrupting regularly
|
|| (Cores[0].IRQEnable && (Cores[0].IRQA & ~7) == vc.LoopStartA) // or should be interrupting regularly
|
||||||
|| (Cores[1].IRQEnable && (Cores[1].IRQA & ~7) == vc.LoopStartA) || !(thiscore.Regs.ENDX & 1 << voiceidx)) // or isn't currently flagged as having passed the endpoint
|
|| (Cores[1].IRQEnable && (Cores[1].IRQA & ~7) == vc.LoopStartA) || !(thiscore.Regs.ENDX & 1 << voiceidx)) // or isn't currently flagged as having passed the endpoint
|
||||||
{
|
{
|
||||||
UpdatePitch(coreidx, voiceidx);
|
UpdatePitch(coreidx, voiceidx);
|
||||||
|
|
||||||
while (vc.SP > 0)
|
while (vc.SP > 0)
|
||||||
GetNextDataDummy(thiscore, voiceidx); // Dummy is enough
|
GetNextDataDummy(thiscore, voiceidx); // Dummy is enough
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write-back of raw voice data (some zeros since the voice is "dead")
|
// Write-back of raw voice data (some zeros since the voice is "dead")
|
||||||
|
@ -598,7 +598,7 @@ static __forceinline StereoOut32 MixVoice(uint coreidx, uint voiceidx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const VoiceMixSet VoiceMixSet::Empty((StereoOut32()), (StereoOut32())); // Don't use SteroOut32::Empty because C++ doesn't make any dep/order checks on global initializers.
|
const VoiceMixSet VoiceMixSet::Empty((StereoOut32()), (StereoOut32())); // Don't use SteroOut32::Empty because C++ doesn't make any dep/order checks on global initializers.
|
||||||
|
|
||||||
static __forceinline void MixCoreVoices(VoiceMixSet &dest, const uint coreidx)
|
static __forceinline void MixCoreVoices(VoiceMixSet &dest, const uint coreidx)
|
||||||
{
|
{
|
||||||
|
@ -671,7 +671,7 @@ StereoOut32 V_Core::Mix(const VoiceMixSet &inVoices, const StereoOut32 &Input, c
|
||||||
//
|
//
|
||||||
// On the other hand, updating the buffer is cheap and easy, so might as well. ;)
|
// On the other hand, updating the buffer is cheap and easy, so might as well. ;)
|
||||||
|
|
||||||
Reverb_AdvanceBuffer(); // Updates the reverb work area as well, if needed.
|
Reverb_AdvanceBuffer(); // Updates the reverb work area as well, if needed.
|
||||||
|
|
||||||
// ToDo:
|
// ToDo:
|
||||||
// Bad EndA causes memory corruption. Bad for us, unknown on PS2!
|
// Bad EndA causes memory corruption. Bad for us, unknown on PS2!
|
||||||
|
@ -806,7 +806,7 @@ __forceinline
|
||||||
WaveDump::WriteCore(1, CoreSrc_Input, InputData[1]);
|
WaveDump::WriteCore(1, CoreSrc_Input, InputData[1]);
|
||||||
|
|
||||||
// Todo: Replace me with memzero initializer!
|
// Todo: Replace me with memzero initializer!
|
||||||
VoiceMixSet VoiceData[2] = {VoiceMixSet::Empty, VoiceMixSet::Empty}; // mixed voice data for each core.
|
VoiceMixSet VoiceData[2] = {VoiceMixSet::Empty, VoiceMixSet::Empty}; // mixed voice data for each core.
|
||||||
MixCoreVoices(VoiceData[0], 0);
|
MixCoreVoices(VoiceData[0], 0);
|
||||||
MixCoreVoices(VoiceData[1], 1);
|
MixCoreVoices(VoiceData[1], 1);
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ struct FrequencyResponseFilter
|
||||||
, lb2(0.97555529586426892000f)
|
, lb2(0.97555529586426892000f)
|
||||||
|
|
||||||
, ha0(1.52690772687271160000f)
|
, ha0(1.52690772687271160000f)
|
||||||
, ha1(-1.62653918974914990000f) //-1.72 = "common equilizer curve" --____--
|
, ha1(-1.62653918974914990000f) //-1.72 = "common equilizer curve" --____--
|
||||||
, ha2(0.57997976029249387000f)
|
, ha2(0.57997976029249387000f)
|
||||||
, hb1(-0.80955590379048203000f)
|
, hb1(-0.80955590379048203000f)
|
||||||
, hb2(0.28990420120653748000f)
|
, hb2(0.28990420120653748000f)
|
||||||
|
|
|
@ -75,7 +75,7 @@ static void InitLibraryName()
|
||||||
#ifdef DEBUG_FAST
|
#ifdef DEBUG_FAST
|
||||||
"-Debug"
|
"-Debug"
|
||||||
#elif defined(PCSX2_DEBUG)
|
#elif defined(PCSX2_DEBUG)
|
||||||
"-Debug/Strict" // strict debugging is slow!
|
"-Debug/Strict" // strict debugging is slow!
|
||||||
#elif defined(PCSX2_DEVBUILD)
|
#elif defined(PCSX2_DEVBUILD)
|
||||||
"-Dev"
|
"-Dev"
|
||||||
#else
|
#else
|
||||||
|
@ -92,7 +92,7 @@ static void InitLibraryName()
|
||||||
#ifdef DEBUG_FAST
|
#ifdef DEBUG_FAST
|
||||||
"-Debug"
|
"-Debug"
|
||||||
#elif defined(PCSX2_DEBUG)
|
#elif defined(PCSX2_DEBUG)
|
||||||
"-Debug/Strict" // strict debugging is slow!
|
"-Debug/Strict" // strict debugging is slow!
|
||||||
#elif defined(PCSX2_DEVBUILD)
|
#elif defined(PCSX2_DEVBUILD)
|
||||||
"-Dev"
|
"-Dev"
|
||||||
#else
|
#else
|
||||||
|
@ -268,7 +268,7 @@ SPU2irqCallback(void (*SPU2callback)(), void (*DMA4callback)(), void (*DMA7callb
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT_C_(void)
|
EXPORT_C_(void)
|
||||||
CALLBACK SPU2readDMA4Mem(u16 *pMem, u32 size) // size now in 16bit units
|
CALLBACK SPU2readDMA4Mem(u16 *pMem, u32 size) // size now in 16bit units
|
||||||
{
|
{
|
||||||
if (cyclePtr != NULL)
|
if (cyclePtr != NULL)
|
||||||
TimeUpdate(*cyclePtr);
|
TimeUpdate(*cyclePtr);
|
||||||
|
@ -278,7 +278,7 @@ CALLBACK SPU2readDMA4Mem(u16 *pMem, u32 size) // size now in 16bit units
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void)
|
EXPORT_C_(void)
|
||||||
CALLBACK SPU2writeDMA4Mem(u16 *pMem, u32 size) // size now in 16bit units
|
CALLBACK SPU2writeDMA4Mem(u16 *pMem, u32 size) // size now in 16bit units
|
||||||
{
|
{
|
||||||
if (cyclePtr != NULL)
|
if (cyclePtr != NULL)
|
||||||
TimeUpdate(*cyclePtr);
|
TimeUpdate(*cyclePtr);
|
||||||
|
@ -336,7 +336,7 @@ SPU2reset()
|
||||||
{
|
{
|
||||||
memset(spu2regs, 0, 0x010000);
|
memset(spu2regs, 0, 0x010000);
|
||||||
memset(_spu2mem, 0, 0x200000);
|
memset(_spu2mem, 0, 0x200000);
|
||||||
memset(_spu2mem + 0x2800, 7, 0x10); // from BIOS reversal. Locks the voices so they don't run free.
|
memset(_spu2mem + 0x2800, 7, 0x10); // from BIOS reversal. Locks the voices so they don't run free.
|
||||||
Cores[0].Init(0);
|
Cores[0].Init(0);
|
||||||
Cores[1].Init(1);
|
Cores[1].Init(1);
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ SPU2open(void *pDsp)
|
||||||
gsWindowHandle = 0;
|
gsWindowHandle = 0;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#ifdef PCSX2_DEVBUILD // Define may not be needed but not tested yet. Better make sure.
|
#ifdef PCSX2_DEVBUILD // Define may not be needed but not tested yet. Better make sure.
|
||||||
if (IsDevBuild && VisualDebug()) {
|
if (IsDevBuild && VisualDebug()) {
|
||||||
if (debugDialogOpen == 0) {
|
if (debugDialogOpen == 0) {
|
||||||
hDebugDialog = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_DEBUG), 0, DebugProc, 0);
|
hDebugDialog = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_DEBUG), 0, DebugProc, 0);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Dma.h"
|
#include "Dma.h"
|
||||||
|
|
||||||
#include "PS2E-spu2.h" // required for ENABLE_NEW_IOPDMA_SPU2 define
|
#include "PS2E-spu2.h" // required for ENABLE_NEW_IOPDMA_SPU2 define
|
||||||
|
|
||||||
// Core 0 Input is "SPDIF mode" - Source audio is AC3 compressed.
|
// Core 0 Input is "SPDIF mode" - Source audio is AC3 compressed.
|
||||||
|
|
||||||
|
|
|
@ -36,20 +36,20 @@ void SPU2writeLog(const char *action, u32 rmem, u16 value)
|
||||||
|
|
||||||
//u32 vx=0, vc=0;
|
//u32 vx=0, vc=0;
|
||||||
u32 core = 0, omem, mem;
|
u32 core = 0, omem, mem;
|
||||||
omem = mem = rmem & 0x7FF; //FFFF;
|
omem = mem = rmem & 0x7FF; //FFFF;
|
||||||
if (mem & 0x400) {
|
if (mem & 0x400) {
|
||||||
omem ^= 0x400;
|
omem ^= 0x400;
|
||||||
core = 1;
|
core = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (omem < 0x0180) // Voice Params (VP)
|
if (omem < 0x0180) // Voice Params (VP)
|
||||||
{
|
{
|
||||||
const u32 voice = (omem & 0x1F0) >> 4;
|
const u32 voice = (omem & 0x1F0) >> 4;
|
||||||
const u32 param = (omem & 0xF) >> 1;
|
const u32 param = (omem & 0xF) >> 1;
|
||||||
char dest[192];
|
char dest[192];
|
||||||
sprintf(dest, "Voice %d %s", voice, ParamNames[param]);
|
sprintf(dest, "Voice %d %s", voice, ParamNames[param]);
|
||||||
RegLog(2, dest, rmem, core, value);
|
RegLog(2, dest, rmem, core, value);
|
||||||
} else if ((omem >= 0x01C0) && (omem < 0x02E0)) // Voice Addressing Params (VA)
|
} else if ((omem >= 0x01C0) && (omem < 0x02E0)) // Voice Addressing Params (VA)
|
||||||
{
|
{
|
||||||
const u32 voice = ((omem - 0x01C0) / 12);
|
const u32 voice = ((omem - 0x01C0) / 12);
|
||||||
const u32 address = ((omem - 0x01C0) % 12) >> 1;
|
const u32 address = ((omem - 0x01C0) % 12) >> 1;
|
||||||
|
|
|
@ -88,7 +88,7 @@ u16 const *const regtable_original[0x401] =
|
||||||
|
|
||||||
PCORE(0, AutoDMACtrl),
|
PCORE(0, AutoDMACtrl),
|
||||||
|
|
||||||
PRAW(0x1b2), PRAW(0x1b4), PRAW(0x1b6), PRAW(0x1b8), PRAW(0x1ba), PRAW(0x1bc), PRAW(0x1be), // unknown
|
PRAW(0x1b2), PRAW(0x1b4), PRAW(0x1b6), PRAW(0x1b8), PRAW(0x1ba), PRAW(0x1bc), PRAW(0x1be), // unknown
|
||||||
|
|
||||||
// Voice Addresses
|
// Voice Addresses
|
||||||
PVCA(0, 0), PVCA(0, 1), PVCA(0, 2), PVCA(0, 3), PVCA(0, 4), PVCA(0, 5),
|
PVCA(0, 0), PVCA(0, 1), PVCA(0, 2), PVCA(0, 3), PVCA(0, 4), PVCA(0, 5),
|
||||||
|
@ -191,7 +191,7 @@ u16 const *const regtable_original[0x401] =
|
||||||
|
|
||||||
PCORE(1, AutoDMACtrl),
|
PCORE(1, AutoDMACtrl),
|
||||||
|
|
||||||
PRAW(0x5b2), PRAW(0x5b4), PRAW(0x5b6), PRAW(0x5b8), PRAW(0x5ba), PRAW(0x5bc), PRAW(0x5be), // unknown
|
PRAW(0x5b2), PRAW(0x5b4), PRAW(0x5b6), PRAW(0x5b8), PRAW(0x5ba), PRAW(0x5bc), PRAW(0x5be), // unknown
|
||||||
|
|
||||||
// Voice Addresses
|
// Voice Addresses
|
||||||
PVCA(1, 0), PVCA(1, 1), PVCA(1, 2), PVCA(1, 3), PVCA(1, 4), PVCA(1, 5),
|
PVCA(1, 0), PVCA(1, 1), PVCA(1, 2), PVCA(1, 3), PVCA(1, 4), PVCA(1, 5),
|
||||||
|
|
|
@ -230,8 +230,8 @@ StereoOut32 V_Core::DoReverb(const StereoOut32 &Input)
|
||||||
_spu2mem[mix_dest_b1] = mix_b1;
|
_spu2mem[mix_dest_b1] = mix_b1;
|
||||||
|
|
||||||
upbuf[ubpos] = clamp_mix(StereoOut32(
|
upbuf[ubpos] = clamp_mix(StereoOut32(
|
||||||
mix_a0 + mix_b0, // left
|
mix_a0 + mix_b0, // left
|
||||||
mix_a1 + mix_b1 // right
|
mix_a1 + mix_b1 // right
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ SndOutModule *mods[] =
|
||||||
#if defined(__linux__) /* && defined(__ALSA__)*/
|
#if defined(__linux__) /* && defined(__ALSA__)*/
|
||||||
AlsaOut,
|
AlsaOut,
|
||||||
#endif
|
#endif
|
||||||
NULL // signals the end of our list
|
NULL // signals the end of our list
|
||||||
};
|
};
|
||||||
|
|
||||||
int FindOutputModuleById(const wchar_t *omodid)
|
int FindOutputModuleById(const wchar_t *omodid)
|
||||||
|
@ -132,7 +132,7 @@ bool SndBuffer::CheckUnderrunStatus(int &nSamples, int &quietSampleCount)
|
||||||
|
|
||||||
int data = _GetApproximateDataInBuffer();
|
int data = _GetApproximateDataInBuffer();
|
||||||
if (m_underrun_freeze) {
|
if (m_underrun_freeze) {
|
||||||
int toFill = m_size / ((SynchMode == 2) ? 32 : 400); // TimeStretch and Async off?
|
int toFill = m_size / ((SynchMode == 2) ? 32 : 400); // TimeStretch and Async off?
|
||||||
toFill = GetAlignedBufferSize(toFill);
|
toFill = GetAlignedBufferSize(toFill);
|
||||||
|
|
||||||
// toFill is now aligned to a SndOutPacket
|
// toFill is now aligned to a SndOutPacket
|
||||||
|
@ -145,13 +145,13 @@ bool SndBuffer::CheckUnderrunStatus(int &nSamples, int &quietSampleCount)
|
||||||
m_underrun_freeze = false;
|
m_underrun_freeze = false;
|
||||||
if (MsgOverruns())
|
if (MsgOverruns())
|
||||||
ConLog(" * SPU2 > Underrun compensation (%d packets buffered)\n", toFill / SndOutPacketSize);
|
ConLog(" * SPU2 > Underrun compensation (%d packets buffered)\n", toFill / SndOutPacketSize);
|
||||||
lastPct = 0.0; // normalize timestretcher
|
lastPct = 0.0; // normalize timestretcher
|
||||||
} else if (data < nSamples) {
|
} else if (data < nSamples) {
|
||||||
nSamples = data;
|
nSamples = data;
|
||||||
quietSampleCount = SndOutPacketSize - data;
|
quietSampleCount = SndOutPacketSize - data;
|
||||||
m_underrun_freeze = true;
|
m_underrun_freeze = true;
|
||||||
|
|
||||||
if (SynchMode == 0) // TimeStrech on
|
if (SynchMode == 0) // TimeStrech on
|
||||||
timeStretchUnderrun();
|
timeStretchUnderrun();
|
||||||
|
|
||||||
return nSamples != 0;
|
return nSamples != 0;
|
||||||
|
@ -321,7 +321,7 @@ void SndBuffer::_WriteSamples(StereoOut32 *bData, int nSamples)
|
||||||
// The older portion of the buffer is discarded rather than incoming data,
|
// The older portion of the buffer is discarded rather than incoming data,
|
||||||
// so that the overall audio synchronization is better.
|
// so that the overall audio synchronization is better.
|
||||||
|
|
||||||
int free = m_size - _GetApproximateDataInBuffer(); // -1, but the <= handles that
|
int free = m_size - _GetApproximateDataInBuffer(); // -1, but the <= handles that
|
||||||
if (free <= nSamples) {
|
if (free <= nSamples) {
|
||||||
// Disabled since the lock-free queue can't handle changing the read end from the write thread
|
// Disabled since the lock-free queue can't handle changing the read end from the write thread
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -350,7 +350,7 @@ void SndBuffer::_WriteSamples(StereoOut32 *bData, int nSamples)
|
||||||
#else
|
#else
|
||||||
if (MsgOverruns())
|
if (MsgOverruns())
|
||||||
ConLog(" * SPU2 > Overrun! 1 packet tossed)\n");
|
ConLog(" * SPU2 > Overrun! 1 packet tossed)\n");
|
||||||
lastPct = 0.0; // normalize the timestretcher
|
lastPct = 0.0; // normalize the timestretcher
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ void SndBuffer::Init()
|
||||||
m_underrun_freeze = false;
|
m_underrun_freeze = false;
|
||||||
|
|
||||||
sndTempBuffer = new StereoOut32[SndOutPacketSize];
|
sndTempBuffer = new StereoOut32[SndOutPacketSize];
|
||||||
sndTempBuffer16 = new StereoOut16[SndOutPacketSize * 2]; // in case of leftovers.
|
sndTempBuffer16 = new StereoOut16[SndOutPacketSize * 2]; // in case of leftovers.
|
||||||
} catch (std::bad_alloc &) {
|
} catch (std::bad_alloc &) {
|
||||||
// out of memory exception (most likely)
|
// out of memory exception (most likely)
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ void SndBuffer::Init()
|
||||||
|
|
||||||
sndTempProgress = 0;
|
sndTempProgress = 0;
|
||||||
|
|
||||||
soundtouchInit(); // initializes the timestretching
|
soundtouchInit(); // initializes the timestretching
|
||||||
|
|
||||||
// initialize module
|
// initialize module
|
||||||
if (mods[OutputModule]->Init() == -1)
|
if (mods[OutputModule]->Init() == -1)
|
||||||
|
@ -421,7 +421,7 @@ int SndBuffer::ssFreeze = 0;
|
||||||
void SndBuffer::ClearContents()
|
void SndBuffer::ClearContents()
|
||||||
{
|
{
|
||||||
SndBuffer::soundtouchClearContents();
|
SndBuffer::soundtouchClearContents();
|
||||||
SndBuffer::ssFreeze = 256; //Delays sound output for about 1 second.
|
SndBuffer::ssFreeze = 256; //Delays sound output for about 1 second.
|
||||||
}
|
}
|
||||||
|
|
||||||
void SndBuffer::Write(const StereoOut32 &Sample)
|
void SndBuffer::Write(const StereoOut32 &Sample)
|
||||||
|
@ -432,7 +432,7 @@ void SndBuffer::Write(const StereoOut32 &Sample)
|
||||||
if (WavRecordEnabled)
|
if (WavRecordEnabled)
|
||||||
RecordWrite(Sample.DownSample());
|
RecordWrite(Sample.DownSample());
|
||||||
|
|
||||||
if (mods[OutputModule] == &NullOut) // null output doesn't need buffering or stretching! :p
|
if (mods[OutputModule] == &NullOut) // null output doesn't need buffering or stretching! :p
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sndTempBuffer[sndTempProgress++] = Sample;
|
sndTempBuffer[sndTempProgress++] = Sample;
|
||||||
|
@ -445,7 +445,7 @@ void SndBuffer::Write(const StereoOut32 &Sample)
|
||||||
//Don't play anything directly after loading a savestate, avoids static killing your speakers.
|
//Don't play anything directly after loading a savestate, avoids static killing your speakers.
|
||||||
if (ssFreeze > 0) {
|
if (ssFreeze > 0) {
|
||||||
ssFreeze--;
|
ssFreeze--;
|
||||||
memset(sndTempBuffer, 0, sizeof(StereoOut32) * SndOutPacketSize); // Play silence
|
memset(sndTempBuffer, 0, sizeof(StereoOut32) * SndOutPacketSize); // Play silence
|
||||||
}
|
}
|
||||||
#ifndef __POSIX__
|
#ifndef __POSIX__
|
||||||
if (dspPluginEnabled) {
|
if (dspPluginEnabled) {
|
||||||
|
@ -464,7 +464,7 @@ void SndBuffer::Write(const StereoOut32 &Sample)
|
||||||
sndTempBuffer[i] = sndTempBuffer16[ei].UpSample();
|
sndTempBuffer[i] = sndTempBuffer16[ei].UpSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SynchMode == 0) // TimeStrech on
|
if (SynchMode == 0) // TimeStrech on
|
||||||
timeStretchWrite();
|
timeStretchWrite();
|
||||||
else
|
else
|
||||||
_WriteSamples(sndTempBuffer, SndOutPacketSize);
|
_WriteSamples(sndTempBuffer, SndOutPacketSize);
|
||||||
|
@ -480,7 +480,7 @@ void SndBuffer::Write(const StereoOut32 &Sample)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
if (SynchMode == 0) // TimeStrech on
|
if (SynchMode == 0) // TimeStrech on
|
||||||
timeStretchWrite();
|
timeStretchWrite();
|
||||||
else
|
else
|
||||||
_WriteSamples(sndTempBuffer, SndOutPacketSize);
|
_WriteSamples(sndTempBuffer, SndOutPacketSize);
|
||||||
|
|
|
@ -27,7 +27,7 @@ static const int SndOutPacketSize = 64;
|
||||||
// downsamples 32 bit samples to 16 bit sound driver output (this way timestretching and
|
// downsamples 32 bit samples to 16 bit sound driver output (this way timestretching and
|
||||||
// DSP effects get better precision results)
|
// DSP effects get better precision results)
|
||||||
static const int SndOutVolumeShift = 12;
|
static const int SndOutVolumeShift = 12;
|
||||||
static const int SndOutVolumeShift32 = 16 - SndOutVolumeShift; // shift up, not down
|
static const int SndOutVolumeShift32 = 16 - SndOutVolumeShift; // shift up, not down
|
||||||
|
|
||||||
// Samplerate of the SPU2. For accurate playback we need to match this
|
// Samplerate of the SPU2. For accurate playback we need to match this
|
||||||
// exactly. Trying to scale samplerates and maintain SPU2's Ts timing accuracy
|
// exactly. Trying to scale samplerates and maintain SPU2's Ts timing accuracy
|
||||||
|
@ -50,7 +50,7 @@ extern unsigned int delayCycles;
|
||||||
struct Stereo51Out16DplII;
|
struct Stereo51Out16DplII;
|
||||||
struct Stereo51Out32DplII;
|
struct Stereo51Out32DplII;
|
||||||
|
|
||||||
struct Stereo51Out16Dpl; // similar to DplII but without rear balancing
|
struct Stereo51Out16Dpl; // similar to DplII but without rear balancing
|
||||||
struct Stereo51Out32Dpl;
|
struct Stereo51Out32Dpl;
|
||||||
|
|
||||||
extern void ResetDplIIDecoder();
|
extern void ResetDplIIDecoder();
|
||||||
|
@ -694,4 +694,4 @@ extern void RecordWrite(const StereoOut16 &sample);
|
||||||
extern s32 DspLoadLibrary(wchar_t *fileName, int modNum);
|
extern s32 DspLoadLibrary(wchar_t *fileName, int modNum);
|
||||||
extern void DspCloseLibrary();
|
extern void DspCloseLibrary();
|
||||||
extern int DspProcess(s16 *buffer, int samples);
|
extern int DspProcess(s16 *buffer, int samples);
|
||||||
extern void DspUpdate(); // to let the Dsp process window messages
|
extern void DspUpdate(); // to let the Dsp process window messages
|
||||||
|
|
|
@ -178,20 +178,20 @@ public:
|
||||||
const PaDeviceInfo *devinfo = Pa_GetDeviceInfo(deviceIndex);
|
const PaDeviceInfo *devinfo = Pa_GetDeviceInfo(deviceIndex);
|
||||||
|
|
||||||
int speakers;
|
int speakers;
|
||||||
switch (numSpeakers) // speakers = (numSpeakers + 1) *2; ?
|
switch (numSpeakers) // speakers = (numSpeakers + 1) *2; ?
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
speakers = 2;
|
speakers = 2;
|
||||||
break; // Stereo
|
break; // Stereo
|
||||||
case 1:
|
case 1:
|
||||||
speakers = 4;
|
speakers = 4;
|
||||||
break; // Quadrafonic
|
break; // Quadrafonic
|
||||||
case 2:
|
case 2:
|
||||||
speakers = 6;
|
speakers = 6;
|
||||||
break; // Surround 5.1
|
break; // Surround 5.1
|
||||||
case 3:
|
case 3:
|
||||||
speakers = 8;
|
speakers = 8;
|
||||||
break; // Surround 7.1
|
break; // Surround 7.1
|
||||||
default:
|
default:
|
||||||
speakers = 2;
|
speakers = 2;
|
||||||
}
|
}
|
||||||
|
@ -223,24 +223,24 @@ public:
|
||||||
switch (dplLevel) {
|
switch (dplLevel) {
|
||||||
case 0:
|
case 0:
|
||||||
ConLog("* SPU2 > 5.1 speaker expansion enabled.\n");
|
ConLog("* SPU2 > 5.1 speaker expansion enabled.\n");
|
||||||
ActualPaCallback = new ConvertedSampleReader<Stereo51Out32>(&writtenSoFar); //"normal" stereo upmix
|
ActualPaCallback = new ConvertedSampleReader<Stereo51Out32>(&writtenSoFar); //"normal" stereo upmix
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ConLog("* SPU2 > 5.1 speaker expansion with basic ProLogic dematrixing enabled.\n");
|
ConLog("* SPU2 > 5.1 speaker expansion with basic ProLogic dematrixing enabled.\n");
|
||||||
ActualPaCallback = new ConvertedSampleReader<Stereo51Out32Dpl>(&writtenSoFar); // basic Dpl decoder without rear stereo balancing
|
ActualPaCallback = new ConvertedSampleReader<Stereo51Out32Dpl>(&writtenSoFar); // basic Dpl decoder without rear stereo balancing
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ConLog("* SPU2 > 5.1 speaker expansion with experimental ProLogicII dematrixing enabled.\n");
|
ConLog("* SPU2 > 5.1 speaker expansion with experimental ProLogicII dematrixing enabled.\n");
|
||||||
ActualPaCallback = new ConvertedSampleReader<Stereo51Out32DplII>(&writtenSoFar); //gigas PLII
|
ActualPaCallback = new ConvertedSampleReader<Stereo51Out32DplII>(&writtenSoFar); //gigas PLII
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
actualUsedChannels = 6; // we do not support 7.0 or 6.2 configurations, downgrade to 5.1
|
actualUsedChannels = 6; // we do not support 7.0 or 6.2 configurations, downgrade to 5.1
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // anything 8 or more gets the 7.1 treatment!
|
default: // anything 8 or more gets the 7.1 treatment!
|
||||||
ConLog("* SPU2 > 7.1 speaker expansion enabled.\n");
|
ConLog("* SPU2 > 7.1 speaker expansion enabled.\n");
|
||||||
ActualPaCallback = new ConvertedSampleReader<Stereo71Out32>(&writtenSoFar);
|
ActualPaCallback = new ConvertedSampleReader<Stereo71Out32>(&writtenSoFar);
|
||||||
actualUsedChannels = 8; // we do not support 7.2 or more, downgrade to 7.1
|
actualUsedChannels = 8; // we do not support 7.2 or more, downgrade to 7.1
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ private:
|
||||||
public:
|
public:
|
||||||
virtual void Configure(uptr parent)
|
virtual void Configure(uptr parent)
|
||||||
{
|
{
|
||||||
PaError err = Pa_Initialize(); // Initialization can be done multiple times, PA keeps a counter
|
PaError err = Pa_Initialize(); // Initialization can be done multiple times, PA keeps a counter
|
||||||
if (err != paNoError) {
|
if (err != paNoError) {
|
||||||
fprintf(stderr, "* SPU2-X: PortAudio error: %s\n", Pa_GetErrorText(err));
|
fprintf(stderr, "* SPU2-X: PortAudio error: %s\n", Pa_GetErrorText(err));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -183,7 +183,7 @@ u64 HighResCounter()
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitWaitSync() // not extremely accurate but enough.
|
void InitWaitSync() // not extremely accurate but enough.
|
||||||
{
|
{
|
||||||
HighResFreq = HighResFrequency();
|
HighResFreq = HighResFrequency();
|
||||||
HighResPrev = HighResCounter();
|
HighResPrev = HighResCounter();
|
||||||
|
@ -202,11 +202,11 @@ u32 WaitSync(u32 TargetCycle)
|
||||||
|
|
||||||
// Refresh current time after sleeping
|
// Refresh current time after sleeping
|
||||||
u64 Current = HighResCounter();
|
u64 Current = HighResCounter();
|
||||||
u32 delta = (u32)floor((Current - HighResPrev) / HighResScale + 0.5); // We lose some precision here, cycles might drift away over long periods of time ;P
|
u32 delta = (u32)floor((Current - HighResPrev) / HighResScale + 0.5); // We lose some precision here, cycles might drift away over long periods of time ;P
|
||||||
|
|
||||||
// Calculate time delta
|
// Calculate time delta
|
||||||
CurrentIOPCycle += delta;
|
CurrentIOPCycle += delta;
|
||||||
HighResPrev += (u64)floor(delta * HighResScale + 0.5); // Trying to compensate drifting mentioned above, not necessarily useful.
|
HighResPrev += (u64)floor(delta * HighResScale + 0.5); // Trying to compensate drifting mentioned above, not necessarily useful.
|
||||||
|
|
||||||
return delta;
|
return delta;
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ s2r_replay(HWND hwnd, HINSTANCE hinst, LPSTR filename, int nCmdShow)
|
||||||
|
|
||||||
replay_mode = true;
|
replay_mode = true;
|
||||||
|
|
||||||
InitWaitSync(); // Initialize the WaitSync stuff
|
InitWaitSync(); // Initialize the WaitSync stuff
|
||||||
|
|
||||||
SPU2init();
|
SPU2init();
|
||||||
SPU2irqCallback(dummy1, dummy4, dummy7);
|
SPU2irqCallback(dummy1, dummy4, dummy7);
|
||||||
|
|
|
@ -51,7 +51,7 @@ float SndBuffer::GetStatusPct()
|
||||||
// Get the buffer status of the output driver too, so that we can
|
// Get the buffer status of the output driver too, so that we can
|
||||||
// obtain a more accurate overall buffer status.
|
// obtain a more accurate overall buffer status.
|
||||||
|
|
||||||
int drvempty = mods[OutputModule]->GetEmptySampleCount(); // / 2;
|
int drvempty = mods[OutputModule]->GetEmptySampleCount(); // / 2;
|
||||||
|
|
||||||
//ConLog( "Data %d >>> driver: %d predict: %d\n", m_data, drvempty, m_predictData );
|
//ConLog( "Data %d >>> driver: %d predict: %d\n", m_data, drvempty, m_predictData );
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ float addToAvg(float val)
|
||||||
{
|
{
|
||||||
static float avg_fullness[AVERAGING_BUFFER_SIZE];
|
static float avg_fullness[AVERAGING_BUFFER_SIZE];
|
||||||
static unsigned int nextAvgPos = 0;
|
static unsigned int nextAvgPos = 0;
|
||||||
static unsigned int available = 0; // Make sure we're not averaging AVERAGING_WINDOW items if we inserted less.
|
static unsigned int available = 0; // Make sure we're not averaging AVERAGING_WINDOW items if we inserted less.
|
||||||
if (gRequestStretcherReset >= STRETCHER_RESET_THRESHOLD)
|
if (gRequestStretcherReset >= STRETCHER_RESET_THRESHOLD)
|
||||||
available = 0;
|
available = 0;
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ float addToAvg(float val)
|
||||||
}
|
}
|
||||||
sum = sum / actualWindow;
|
sum = sum / actualWindow;
|
||||||
|
|
||||||
return sum ? sum : 1; // 1 because that's the 100% perfect speed value
|
return sum ? sum : 1; // 1 because that's the 100% perfect speed value
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -150,14 +150,14 @@ bool IsInRange(const T &val, const T &min, const T &max)
|
||||||
void SndBuffer::UpdateTempoChangeSoundTouch2()
|
void SndBuffer::UpdateTempoChangeSoundTouch2()
|
||||||
{
|
{
|
||||||
|
|
||||||
long targetSamplesReservoir = 48 * SndOutLatencyMS; //48000*SndOutLatencyMS/1000
|
long targetSamplesReservoir = 48 * SndOutLatencyMS; //48000*SndOutLatencyMS/1000
|
||||||
//base aim at buffer filled %
|
//base aim at buffer filled %
|
||||||
float baseTargetFullness = (double)targetSamplesReservoir; ///(double)m_size;//0.05;
|
float baseTargetFullness = (double)targetSamplesReservoir; ///(double)m_size;//0.05;
|
||||||
|
|
||||||
//state vars
|
//state vars
|
||||||
static bool inside_hysteresis; //=false;
|
static bool inside_hysteresis; //=false;
|
||||||
static int hys_ok_count; //=0;
|
static int hys_ok_count; //=0;
|
||||||
static float dynamicTargetFullness; //=baseTargetFullness;
|
static float dynamicTargetFullness; //=baseTargetFullness;
|
||||||
if (gRequestStretcherReset >= STRETCHER_RESET_THRESHOLD) {
|
if (gRequestStretcherReset >= STRETCHER_RESET_THRESHOLD) {
|
||||||
ConLog("______> stretch: Reset.\n");
|
ConLog("______> stretch: Reset.\n");
|
||||||
inside_hysteresis = false;
|
inside_hysteresis = false;
|
||||||
|
@ -166,10 +166,10 @@ void SndBuffer::UpdateTempoChangeSoundTouch2()
|
||||||
}
|
}
|
||||||
|
|
||||||
int data = _GetApproximateDataInBuffer();
|
int data = _GetApproximateDataInBuffer();
|
||||||
float bufferFullness = (float)data; ///(float)m_size;
|
float bufferFullness = (float)data; ///(float)m_size;
|
||||||
|
|
||||||
#ifdef NEWSTRETCHER_USE_DYNAMIC_TUNING
|
#ifdef NEWSTRETCHER_USE_DYNAMIC_TUNING
|
||||||
{ //test current iterations/sec every 0.5s, and change algo params accordingly if different than previous IPS more than 30%
|
{ //test current iterations/sec every 0.5s, and change algo params accordingly if different than previous IPS more than 30%
|
||||||
static long iters = 0;
|
static long iters = 0;
|
||||||
static wxDateTime last = wxDateTime::UNow();
|
static wxDateTime last = wxDateTime::UNow();
|
||||||
wxDateTime unow = wxDateTime::UNow();
|
wxDateTime unow = wxDateTime::UNow();
|
||||||
|
@ -192,7 +192,7 @@ void SndBuffer::UpdateTempoChangeSoundTouch2()
|
||||||
//Algorithm params: (threshold params (hysteresis), etc)
|
//Algorithm params: (threshold params (hysteresis), etc)
|
||||||
const float hys_ok_factor = 1.04f;
|
const float hys_ok_factor = 1.04f;
|
||||||
const float hys_bad_factor = 1.2f;
|
const float hys_bad_factor = 1.2f;
|
||||||
int hys_min_ok_count = GetClamped((int)(50.0 * (float)targetIPS / 750.0), 2, 100); //consecutive iterations within hys_ok before going to 1:1 mode
|
int hys_min_ok_count = GetClamped((int)(50.0 * (float)targetIPS / 750.0), 2, 100); //consecutive iterations within hys_ok before going to 1:1 mode
|
||||||
int compensationDivider = GetClamped((int)(100.0 * (float)targetIPS / 750), 15, 150);
|
int compensationDivider = GetClamped((int)(100.0 * (float)targetIPS / 750), 15, 150);
|
||||||
|
|
||||||
float tempoAdjust = bufferFullness / dynamicTargetFullness;
|
float tempoAdjust = bufferFullness / dynamicTargetFullness;
|
||||||
|
@ -208,7 +208,7 @@ void SndBuffer::UpdateTempoChangeSoundTouch2()
|
||||||
tempoAdjust = GetClamped(tempoAdjust, 0.05f, 10.0f);
|
tempoAdjust = GetClamped(tempoAdjust, 0.05f, 10.0f);
|
||||||
|
|
||||||
if (tempoAdjust < 1)
|
if (tempoAdjust < 1)
|
||||||
baseTargetFullness /= sqrt(tempoAdjust); // slightly increase latency when running slow.
|
baseTargetFullness /= sqrt(tempoAdjust); // slightly increase latency when running slow.
|
||||||
|
|
||||||
dynamicTargetFullness += (baseTargetFullness / tempoAdjust - dynamicTargetFullness) / (double)compensationDivider;
|
dynamicTargetFullness += (baseTargetFullness / tempoAdjust - dynamicTargetFullness) / (double)compensationDivider;
|
||||||
if (IsInRange(tempoAdjust, 0.9f, 1.1f) && IsInRange(dynamicTargetFullness, baseTargetFullness * 0.9f, baseTargetFullness * 1.1f))
|
if (IsInRange(tempoAdjust, 0.9f, 1.1f) && IsInRange(dynamicTargetFullness, baseTargetFullness * 0.9f, baseTargetFullness * 1.1f))
|
||||||
|
@ -242,7 +242,7 @@ void SndBuffer::UpdateTempoChangeSoundTouch2()
|
||||||
wxDateTime unow = wxDateTime::UNow();
|
wxDateTime unow = wxDateTime::UNow();
|
||||||
wxTimeSpan delta = unow.Subtract(last);
|
wxTimeSpan delta = unow.Subtract(last);
|
||||||
|
|
||||||
if (delta.GetMilliseconds() > 1000) { //report buffers state and tempo adjust every second
|
if (delta.GetMilliseconds() > 1000) { //report buffers state and tempo adjust every second
|
||||||
ConLog("buffers: %4d ms (%3.0f%%), tempo: %f, comp: %2.3f, iters: %d, (N-IPS:%d -> avg:%d, minokc:%d, div:%d) reset:%d\n",
|
ConLog("buffers: %4d ms (%3.0f%%), tempo: %f, comp: %2.3f, iters: %d, (N-IPS:%d -> avg:%d, minokc:%d, div:%d) reset:%d\n",
|
||||||
(int)(data / 48), (double)(100.0 * bufferFullness / baseTargetFullness), (double)tempoAdjust, (double)(dynamicTargetFullness / baseTargetFullness), iters, (int)targetIPS, AVERAGING_WINDOW, hys_min_ok_count, compensationDivider, gRequestStretcherReset);
|
(int)(data / 48), (double)(100.0 * bufferFullness / baseTargetFullness), (double)tempoAdjust, (double)(dynamicTargetFullness / baseTargetFullness), iters, (int)targetIPS, AVERAGING_WINDOW, hys_min_ok_count, compensationDivider, gRequestStretcherReset);
|
||||||
last = unow;
|
last = unow;
|
||||||
|
@ -266,7 +266,7 @@ void SndBuffer::UpdateTempoChangeSoundTouch()
|
||||||
|
|
||||||
float tempoChange;
|
float tempoChange;
|
||||||
float emergencyAdj = 0;
|
float emergencyAdj = 0;
|
||||||
float newcee = cTempo; // workspace var. for cTempo
|
float newcee = cTempo; // workspace var. for cTempo
|
||||||
|
|
||||||
// IMPORTANT!
|
// IMPORTANT!
|
||||||
// If you plan to tweak these values, make sure you're using a release build
|
// If you plan to tweak these values, make sure you're using a release build
|
||||||
|
|
|
@ -137,7 +137,7 @@ void WavOutFile::write(const short *buffer, int numElems)
|
||||||
|
|
||||||
assert(header.format.bits_per_sample == 16);
|
assert(header.format.bits_per_sample == 16);
|
||||||
if (numElems < 1)
|
if (numElems < 1)
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
|
|
||||||
res = fwrite(buffer, 2, numElems, fptr);
|
res = fwrite(buffer, 2, numElems, fptr);
|
||||||
|
|
||||||
|
|
|
@ -93,10 +93,10 @@ private:
|
||||||
public:
|
public:
|
||||||
/// Constructor: Creates a new WAV file. Throws a 'runtime_error' exception
|
/// Constructor: Creates a new WAV file. Throws a 'runtime_error' exception
|
||||||
/// if file creation fails.
|
/// if file creation fails.
|
||||||
WavOutFile(const char *fileName, ///< Filename
|
WavOutFile(const char *fileName, ///< Filename
|
||||||
int sampleRate, ///< Sample rate (e.g. 44100 etc)
|
int sampleRate, ///< Sample rate (e.g. 44100 etc)
|
||||||
int bits, ///< Bits per sample (8 or 16 bits)
|
int bits, ///< Bits per sample (8 or 16 bits)
|
||||||
int channels ///< Number of channels (1=mono, 2=stereo)
|
int channels ///< Number of channels (1=mono, 2=stereo)
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Destructor: Finalizes & closes the WAV file.
|
/// Destructor: Finalizes & closes the WAV file.
|
||||||
|
@ -104,8 +104,8 @@ public:
|
||||||
|
|
||||||
/// Write data to WAV file. Throws a 'runtime_error' exception if writing to
|
/// Write data to WAV file. Throws a 'runtime_error' exception if writing to
|
||||||
/// file fails.
|
/// file fails.
|
||||||
void write(const short *buffer, ///< Pointer to sample data buffer.
|
void write(const short *buffer, ///< Pointer to sample data buffer.
|
||||||
int numElems ///< How many array items are to be written to file.
|
int numElems ///< How many array items are to be written to file.
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ void RecordStart()
|
||||||
m_wavrecord = new WavOutFile("recording.wav", 48000, 16, 2);
|
m_wavrecord = new WavOutFile("recording.wav", 48000, 16, 2);
|
||||||
WavRecordEnabled = true;
|
WavRecordEnabled = true;
|
||||||
} catch (std::runtime_error &) {
|
} catch (std::runtime_error &) {
|
||||||
m_wavrecord = NULL; // not needed, but what the heck. :)
|
m_wavrecord = NULL; // not needed, but what the heck. :)
|
||||||
SysMessage("SPU2-X couldn't open file for recording: %s.\nRecording to wavfile disabled.", "recording.wav");
|
SysMessage("SPU2-X couldn't open file for recording: %s.\nRecording to wavfile disabled.", "recording.wav");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,9 @@ int Interpolation = 4;
|
||||||
|
|
||||||
bool EffectsDisabled = false;
|
bool EffectsDisabled = false;
|
||||||
|
|
||||||
float FinalVolume; // Global
|
float FinalVolume; // Global
|
||||||
bool AdvancedVolumeControl;
|
bool AdvancedVolumeControl;
|
||||||
float VolumeAdjustFLdb; // decibels settings, cos audiophiles love that
|
float VolumeAdjustFLdb; // decibels settings, cos audiophiles love that
|
||||||
float VolumeAdjustCdb;
|
float VolumeAdjustCdb;
|
||||||
float VolumeAdjustFRdb;
|
float VolumeAdjustFRdb;
|
||||||
float VolumeAdjustBLdb;
|
float VolumeAdjustBLdb;
|
||||||
|
@ -50,7 +50,7 @@ float VolumeAdjustBRdb;
|
||||||
float VolumeAdjustSLdb;
|
float VolumeAdjustSLdb;
|
||||||
float VolumeAdjustSRdb;
|
float VolumeAdjustSRdb;
|
||||||
float VolumeAdjustLFEdb;
|
float VolumeAdjustLFEdb;
|
||||||
float VolumeAdjustFL; // linear coefs calcualted from decibels,
|
float VolumeAdjustFL; // linear coefs calcualted from decibels,
|
||||||
float VolumeAdjustC;
|
float VolumeAdjustC;
|
||||||
float VolumeAdjustFR;
|
float VolumeAdjustFR;
|
||||||
float VolumeAdjustBL;
|
float VolumeAdjustBL;
|
||||||
|
@ -65,7 +65,7 @@ bool postprocess_filter_dealias = false;
|
||||||
|
|
||||||
// OUTPUT
|
// OUTPUT
|
||||||
int SndOutLatencyMS = 100;
|
int SndOutLatencyMS = 100;
|
||||||
int SynchMode = 0; // Time Stretch, Async or Disabled
|
int SynchMode = 0; // Time Stretch, Async or Disabled
|
||||||
|
|
||||||
u32 OutputModule = 0;
|
u32 OutputModule = 0;
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void ReadSettings()
|
||||||
dplLevel = CfgReadInt(L"OUTPUT", L"DplDecodingLevel", 0);
|
dplLevel = CfgReadInt(L"OUTPUT", L"DplDecodingLevel", 0);
|
||||||
SndOutLatencyMS = CfgReadInt(L"OUTPUT", L"Latency", 100);
|
SndOutLatencyMS = CfgReadInt(L"OUTPUT", L"Latency", 100);
|
||||||
|
|
||||||
if ((SynchMode == 0) && (SndOutLatencyMS < LATENCY_MIN_TS)) // can't use low-latency with timestretcher atm
|
if ((SynchMode == 0) && (SndOutLatencyMS < LATENCY_MIN_TS)) // can't use low-latency with timestretcher atm
|
||||||
SndOutLatencyMS = LATENCY_MIN_TS;
|
SndOutLatencyMS = LATENCY_MIN_TS;
|
||||||
else if (SndOutLatencyMS < LATENCY_MIN)
|
else if (SndOutLatencyMS < LATENCY_MIN)
|
||||||
SndOutLatencyMS = LATENCY_MIN;
|
SndOutLatencyMS = LATENCY_MIN;
|
||||||
|
|
|
@ -54,7 +54,7 @@ void UpdateDebugDialog()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lCount++;
|
lCount++;
|
||||||
if (lCount >= (SampleRate / 100)) // Increase to SampleRate/200 for smooth display.
|
if (lCount >= (SampleRate / 100)) // Increase to SampleRate/200 for smooth display.
|
||||||
{
|
{
|
||||||
HDC hdc = GetDC(hDebugDialog);
|
HDC hdc = GetDC(hDebugDialog);
|
||||||
|
|
||||||
|
@ -82,12 +82,12 @@ void UpdateDebugDialog()
|
||||||
SetDCBrushColor(hdc, RGB(0, 0, 0));
|
SetDCBrushColor(hdc, RGB(0, 0, 0));
|
||||||
if ((vc.ADSR.Phase > 0) && (vc.ADSR.Phase < 6)) {
|
if ((vc.ADSR.Phase > 0) && (vc.ADSR.Phase < 6)) {
|
||||||
SetDCBrushColor(hdc, RGB(0, 0, 128)); // light blue for playing voice
|
SetDCBrushColor(hdc, RGB(0, 0, 128)); // light blue for playing voice
|
||||||
if (vc.Modulated) {
|
if (vc.Modulated) {
|
||||||
SetDCBrushColor(hdc, RGB(0, 128, 0)); // light green for playing voice with modulation enabled
|
SetDCBrushColor(hdc, RGB(0, 128, 0)); // light green for playing voice with modulation enabled
|
||||||
}
|
}
|
||||||
if (vc.Noise) {
|
if (vc.Noise) {
|
||||||
SetDCBrushColor(hdc, RGB(128, 0, 0)); // light red for playing voice with noise enabled
|
SetDCBrushColor(hdc, RGB(128, 0, 0)); // light red for playing voice with noise enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
else
|
else
|
||||||
|
@ -122,7 +122,7 @@ void UpdateDebugDialog()
|
||||||
|
|
||||||
int peak = (vcd.displayPeak * 38) / 32768;
|
int peak = (vcd.displayPeak * 38) / 32768;
|
||||||
|
|
||||||
if (vcd.displayPeak >= 32700) // leave a little bit of margin
|
if (vcd.displayPeak >= 32700) // leave a little bit of margin
|
||||||
{
|
{
|
||||||
SetDCBrushColor(hdc, RGB(255, 0, 0));
|
SetDCBrushColor(hdc, RGB(255, 0, 0));
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ void UpdateDebugDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cd.dmaFlag > 0) // So it shows x times this is called, since dmas are so fast
|
if (cd.dmaFlag > 0) // So it shows x times this is called, since dmas are so fast
|
||||||
{
|
{
|
||||||
swprintf_s(t, L"size = %d", cd.lastsize);
|
swprintf_s(t, L"size = %d", cd.lastsize);
|
||||||
|
|
||||||
|
|
|
@ -40,14 +40,14 @@ private:
|
||||||
|
|
||||||
ds_device_data m_devices[32];
|
ds_device_data m_devices[32];
|
||||||
int ndevs;
|
int ndevs;
|
||||||
GUID DevGuid; // currently employed GUID.
|
GUID DevGuid; // currently employed GUID.
|
||||||
bool haveGuid;
|
bool haveGuid;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Instance vars
|
// Instance vars
|
||||||
|
|
||||||
int channel;
|
int channel;
|
||||||
int myLastWrite; // last write position, in bytes
|
int myLastWrite; // last write position, in bytes
|
||||||
|
|
||||||
bool dsound_running;
|
bool dsound_running;
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
|
@ -303,7 +303,7 @@ private:
|
||||||
int i = (int)SendMessage(GetDlgItem(hWnd, IDC_DS_DEVICE), CB_GETCURSEL, 0, 0);
|
int i = (int)SendMessage(GetDlgItem(hWnd, IDC_DS_DEVICE), CB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
if (!m_devices[i].hasGuid) {
|
if (!m_devices[i].hasGuid) {
|
||||||
m_Device[0] = 0; // clear device name to ""
|
m_Device[0] = 0; // clear device name to ""
|
||||||
} else {
|
} else {
|
||||||
swprintf_s(temp, L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
swprintf_s(temp, L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||||
m_devices[i].guid.Data1,
|
m_devices[i].guid.Data1,
|
||||||
|
|
|
@ -285,20 +285,20 @@ public:
|
||||||
// This doesn't always work though, so let it be a user configurable option.
|
// This doesn't always work though, so let it be a user configurable option.
|
||||||
|
|
||||||
int speakers;
|
int speakers;
|
||||||
switch (numSpeakers) // speakers = (numSpeakers + 1) *2; ?
|
switch (numSpeakers) // speakers = (numSpeakers + 1) *2; ?
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
speakers = 2;
|
speakers = 2;
|
||||||
break; // Stereo
|
break; // Stereo
|
||||||
case 1:
|
case 1:
|
||||||
speakers = 4;
|
speakers = 4;
|
||||||
break; // Quadrafonic
|
break; // Quadrafonic
|
||||||
case 2:
|
case 2:
|
||||||
speakers = 6;
|
speakers = 6;
|
||||||
break; // Surround 5.1
|
break; // Surround 5.1
|
||||||
case 3:
|
case 3:
|
||||||
speakers = 8;
|
speakers = 8;
|
||||||
break; // Surround 7.1
|
break; // Surround 7.1
|
||||||
default:
|
default:
|
||||||
speakers = 2;
|
speakers = 2;
|
||||||
}
|
}
|
||||||
|
@ -338,20 +338,20 @@ public:
|
||||||
switch (dplLevel) {
|
switch (dplLevel) {
|
||||||
case 0:
|
case 0:
|
||||||
ConLog("* SPU2 > 5.1 speaker expansion enabled.\n");
|
ConLog("* SPU2 > 5.1 speaker expansion enabled.\n");
|
||||||
voiceContext = new StreamingVoice<Stereo51Out16>(pXAudio2); //"normal" stereo upmix
|
voiceContext = new StreamingVoice<Stereo51Out16>(pXAudio2); //"normal" stereo upmix
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ConLog("* SPU2 > 5.1 speaker expansion with basic ProLogic dematrixing enabled.\n");
|
ConLog("* SPU2 > 5.1 speaker expansion with basic ProLogic dematrixing enabled.\n");
|
||||||
voiceContext = new StreamingVoice<Stereo51Out16Dpl>(pXAudio2); // basic Dpl decoder without rear stereo balancing
|
voiceContext = new StreamingVoice<Stereo51Out16Dpl>(pXAudio2); // basic Dpl decoder without rear stereo balancing
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ConLog("* SPU2 > 5.1 speaker expansion with experimental ProLogicII dematrixing enabled.\n");
|
ConLog("* SPU2 > 5.1 speaker expansion with experimental ProLogicII dematrixing enabled.\n");
|
||||||
voiceContext = new StreamingVoice<Stereo51Out16DplII>(pXAudio2); //gigas PLII
|
voiceContext = new StreamingVoice<Stereo51Out16DplII>(pXAudio2); //gigas PLII
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // anything 8 or more gets the 7.1 treatment!
|
default: // anything 8 or more gets the 7.1 treatment!
|
||||||
ConLog("* SPU2 > 7.1 speaker expansion enabled.\n");
|
ConLog("* SPU2 > 7.1 speaker expansion enabled.\n");
|
||||||
voiceContext = new StreamingVoice<Stereo51Out16>(pXAudio2);
|
voiceContext = new StreamingVoice<Stereo51Out16>(pXAudio2);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -294,20 +294,20 @@ public:
|
||||||
// This doesn't always work though, so let it be a user configurable option.
|
// This doesn't always work though, so let it be a user configurable option.
|
||||||
|
|
||||||
int speakers;
|
int speakers;
|
||||||
switch (numSpeakers) // speakers = (numSpeakers + 1) *2; ?
|
switch (numSpeakers) // speakers = (numSpeakers + 1) *2; ?
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
speakers = 2;
|
speakers = 2;
|
||||||
break; // Stereo
|
break; // Stereo
|
||||||
case 1:
|
case 1:
|
||||||
speakers = 4;
|
speakers = 4;
|
||||||
break; // Quadrafonic
|
break; // Quadrafonic
|
||||||
case 2:
|
case 2:
|
||||||
speakers = 6;
|
speakers = 6;
|
||||||
break; // Surround 5.1
|
break; // Surround 5.1
|
||||||
case 3:
|
case 3:
|
||||||
speakers = 8;
|
speakers = 8;
|
||||||
break; // Surround 7.1
|
break; // Surround 7.1
|
||||||
default:
|
default:
|
||||||
speakers = 2;
|
speakers = 2;
|
||||||
}
|
}
|
||||||
|
@ -350,20 +350,20 @@ public:
|
||||||
switch (dplLevel) {
|
switch (dplLevel) {
|
||||||
case 0:
|
case 0:
|
||||||
ConLog("* SPU2 > 5.1 speaker expansion enabled.\n");
|
ConLog("* SPU2 > 5.1 speaker expansion enabled.\n");
|
||||||
voiceContext = new StreamingVoice<Stereo51Out16>(pXAudio2); //"normal" stereo upmix
|
voiceContext = new StreamingVoice<Stereo51Out16>(pXAudio2); //"normal" stereo upmix
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ConLog("* SPU2 > 5.1 speaker expansion with basic ProLogic dematrixing enabled.\n");
|
ConLog("* SPU2 > 5.1 speaker expansion with basic ProLogic dematrixing enabled.\n");
|
||||||
voiceContext = new StreamingVoice<Stereo51Out16Dpl>(pXAudio2); // basic Dpl decoder without rear stereo balancing
|
voiceContext = new StreamingVoice<Stereo51Out16Dpl>(pXAudio2); // basic Dpl decoder without rear stereo balancing
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ConLog("* SPU2 > 5.1 speaker expansion with experimental ProLogicII dematrixing enabled.\n");
|
ConLog("* SPU2 > 5.1 speaker expansion with experimental ProLogicII dematrixing enabled.\n");
|
||||||
voiceContext = new StreamingVoice<Stereo51Out16DplII>(pXAudio2); //gigas PLII
|
voiceContext = new StreamingVoice<Stereo51Out16DplII>(pXAudio2); //gigas PLII
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // anything 8 or more gets the 7.1 treatment!
|
default: // anything 8 or more gets the 7.1 treatment!
|
||||||
ConLog("* SPU2 > 7.1 speaker expansion enabled.\n");
|
ConLog("* SPU2 > 7.1 speaker expansion enabled.\n");
|
||||||
voiceContext = new StreamingVoice<Stereo51Out16>(pXAudio2);
|
voiceContext = new StreamingVoice<Stereo51Out16>(pXAudio2);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -160,7 +160,7 @@ public:
|
||||||
whbuffer[i].lpNext = 0;
|
whbuffer[i].lpNext = 0;
|
||||||
whbuffer[i].reserved = 0;
|
whbuffer[i].reserved = 0;
|
||||||
waveOutPrepareHeader(hwodevice, whbuffer + i, sizeof(WAVEHDR));
|
waveOutPrepareHeader(hwodevice, whbuffer + i, sizeof(WAVEHDR));
|
||||||
whbuffer[i].dwFlags |= WHDR_DONE; //avoid deadlock
|
whbuffer[i].dwFlags |= WHDR_DONE; //avoid deadlock
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start Thread
|
// Start Thread
|
||||||
|
|
|
@ -29,28 +29,28 @@
|
||||||
|
|
||||||
typedef struct winampDSPModule
|
typedef struct winampDSPModule
|
||||||
{
|
{
|
||||||
char *description; // description
|
char *description; // description
|
||||||
HWND hwndParent; // parent window (filled in by calling app)
|
HWND hwndParent; // parent window (filled in by calling app)
|
||||||
HINSTANCE hDllInstance; // instance handle to this DLL (filled in by calling app)
|
HINSTANCE hDllInstance; // instance handle to this DLL (filled in by calling app)
|
||||||
|
|
||||||
void (*Config)(struct winampDSPModule *this_mod); // configuration dialog (if needed)
|
void (*Config)(struct winampDSPModule *this_mod); // configuration dialog (if needed)
|
||||||
int (*Init)(struct winampDSPModule *this_mod); // 0 on success, creates window, etc (if needed)
|
int (*Init)(struct winampDSPModule *this_mod); // 0 on success, creates window, etc (if needed)
|
||||||
|
|
||||||
// modify waveform samples: returns number of samples to actually write
|
// modify waveform samples: returns number of samples to actually write
|
||||||
// (typically numsamples, but no more than twice numsamples, and no less than half numsamples)
|
// (typically numsamples, but no more than twice numsamples, and no less than half numsamples)
|
||||||
// numsamples should always be at least 128. should, but I'm not sure
|
// numsamples should always be at least 128. should, but I'm not sure
|
||||||
int (*ModifySamples)(struct winampDSPModule *this_mod, short int *samples, int numsamples, int bps, int nch, int srate);
|
int (*ModifySamples)(struct winampDSPModule *this_mod, short int *samples, int numsamples, int bps, int nch, int srate);
|
||||||
|
|
||||||
void (*Quit)(struct winampDSPModule *this_mod); // called when unloading
|
void (*Quit)(struct winampDSPModule *this_mod); // called when unloading
|
||||||
|
|
||||||
void *userData; // user data, optional
|
void *userData; // user data, optional
|
||||||
} winampDSPModule;
|
} winampDSPModule;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int version; // DSP_HDRVER
|
int version; // DSP_HDRVER
|
||||||
char *description; // description of library
|
char *description; // description of library
|
||||||
winampDSPModule *(*getModule)(int); // module retrieval function
|
winampDSPModule *(*getModule)(int); // module retrieval function
|
||||||
} winampDSPHeader;
|
} winampDSPHeader;
|
||||||
|
|
||||||
// exported symbols
|
// exported symbols
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
void RegSet(u16 src); // used to set the volume from a register source (16 bit signed)
|
void RegSet(u16 src); // used to set the volume from a register source (16 bit signed)
|
||||||
void DebugDump(FILE *dump, const char *title, const char *nameLR);
|
void DebugDump(FILE *dump, const char *title, const char *nameLR);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,18 +116,18 @@ struct V_ADSR
|
||||||
u32 SustainLevel : 4,
|
u32 SustainLevel : 4,
|
||||||
DecayRate : 4,
|
DecayRate : 4,
|
||||||
AttackRate : 7,
|
AttackRate : 7,
|
||||||
AttackMode : 1, // 0 for linear (+lin), 1 for pseudo exponential (+exp)
|
AttackMode : 1, // 0 for linear (+lin), 1 for pseudo exponential (+exp)
|
||||||
|
|
||||||
ReleaseRate : 5,
|
ReleaseRate : 5,
|
||||||
ReleaseMode : 1, // 0 for linear (-lin), 1 for exponential (-exp)
|
ReleaseMode : 1, // 0 for linear (-lin), 1 for exponential (-exp)
|
||||||
SustainRate : 7,
|
SustainRate : 7,
|
||||||
SustainMode : 3; // 0 = +lin, 1 = -lin, 2 = +exp, 3 = -exp
|
SustainMode : 3; // 0 = +lin, 1 = -lin, 2 = +exp, 3 = -exp
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
s32 Value; // Ranges from 0 to 0x7fffffff (signed values are clamped to 0) [Reg_ENVX]
|
s32 Value; // Ranges from 0 to 0x7fffffff (signed values are clamped to 0) [Reg_ENVX]
|
||||||
u8 Phase; // monitors current phase of ADSR envelope
|
u8 Phase; // monitors current phase of ADSR envelope
|
||||||
bool Releasing; // Ready To Release, triggered by Voice.Stop();
|
bool Releasing; // Ready To Release, triggered by Voice.Stop();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool Calculate();
|
bool Calculate();
|
||||||
|
@ -136,7 +136,7 @@ public:
|
||||||
|
|
||||||
struct V_Voice
|
struct V_Voice
|
||||||
{
|
{
|
||||||
u32 PlayCycle; // SPU2 cycle where the Playing started
|
u32 PlayCycle; // SPU2 cycle where the Playing started
|
||||||
|
|
||||||
V_VolumeSlideLR Volume;
|
V_VolumeSlideLR Volume;
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ struct V_Voice
|
||||||
|
|
||||||
// Last outputted audio value, used for voice modulation.
|
// Last outputted audio value, used for voice modulation.
|
||||||
s32 OutX;
|
s32 OutX;
|
||||||
s32 NextCrest; // temp value for Crest calculation
|
s32 NextCrest; // temp value for Crest calculation
|
||||||
|
|
||||||
// SBuffer now points directly to an ADPCM cache entry.
|
// SBuffer now points directly to an ADPCM cache entry.
|
||||||
s16 *SBuffer;
|
s16 *SBuffer;
|
||||||
|
@ -329,10 +329,10 @@ struct V_CoreRegs
|
||||||
|
|
||||||
struct V_VoiceGates
|
struct V_VoiceGates
|
||||||
{
|
{
|
||||||
s16 DryL; // 'AND Gate' for Direct Output to Left Channel
|
s16 DryL; // 'AND Gate' for Direct Output to Left Channel
|
||||||
s16 DryR; // 'AND Gate' for Direct Output for Right Channel
|
s16 DryR; // 'AND Gate' for Direct Output for Right Channel
|
||||||
s16 WetL; // 'AND Gate' for Effect Output for Left Channel
|
s16 WetL; // 'AND Gate' for Effect Output for Left Channel
|
||||||
s16 WetR; // 'AND Gate' for Effect Output for Right Channel
|
s16 WetR; // 'AND Gate' for Effect Output for Right Channel
|
||||||
};
|
};
|
||||||
|
|
||||||
struct V_CoreGates
|
struct V_CoreGates
|
||||||
|
@ -343,12 +343,12 @@ struct V_CoreGates
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
s16 InpL; // Sound Data Input to Direct Output (Left)
|
s16 InpL; // Sound Data Input to Direct Output (Left)
|
||||||
s16 InpR; // Sound Data Input to Direct Output (Right)
|
s16 InpR; // Sound Data Input to Direct Output (Right)
|
||||||
s16 SndL; // Voice Data to Direct Output (Left)
|
s16 SndL; // Voice Data to Direct Output (Left)
|
||||||
s16 SndR; // Voice Data to Direct Output (Right)
|
s16 SndR; // Voice Data to Direct Output (Right)
|
||||||
s16 ExtL; // External Input to Direct Output (Left)
|
s16 ExtL; // External Input to Direct Output (Left)
|
||||||
s16 ExtR; // External Input to Direct Output (Right)
|
s16 ExtR; // External Input to Direct Output (Right)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -370,7 +370,7 @@ struct V_Core
|
||||||
{
|
{
|
||||||
static const uint NumVoices = 24;
|
static const uint NumVoices = 24;
|
||||||
|
|
||||||
int Index; // Core index identifier.
|
int Index; // Core index identifier.
|
||||||
|
|
||||||
// Voice Gates -- These are SSE-related values, and must always be
|
// Voice Gates -- These are SSE-related values, and must always be
|
||||||
// first to ensure 16 byte alignment
|
// first to ensure 16 byte alignment
|
||||||
|
@ -379,32 +379,32 @@ struct V_Core
|
||||||
V_CoreGates DryGate;
|
V_CoreGates DryGate;
|
||||||
V_CoreGates WetGate;
|
V_CoreGates WetGate;
|
||||||
|
|
||||||
V_VolumeSlideLR MasterVol; // Master Volume
|
V_VolumeSlideLR MasterVol; // Master Volume
|
||||||
V_VolumeLR ExtVol; // Volume for External Data Input
|
V_VolumeLR ExtVol; // Volume for External Data Input
|
||||||
V_VolumeLR InpVol; // Volume for Sound Data Input
|
V_VolumeLR InpVol; // Volume for Sound Data Input
|
||||||
V_VolumeLR FxVol; // Volume for Output from Effects
|
V_VolumeLR FxVol; // Volume for Output from Effects
|
||||||
|
|
||||||
V_Voice Voices[NumVoices];
|
V_Voice Voices[NumVoices];
|
||||||
|
|
||||||
u32 IRQA; // Interrupt Address
|
u32 IRQA; // Interrupt Address
|
||||||
u32 TSA; // DMA Transfer Start Address
|
u32 TSA; // DMA Transfer Start Address
|
||||||
|
|
||||||
bool IRQEnable; // Interrupt Enable
|
bool IRQEnable; // Interrupt Enable
|
||||||
bool FxEnable; // Effect Enable
|
bool FxEnable; // Effect Enable
|
||||||
bool Mute; // Mute
|
bool Mute; // Mute
|
||||||
bool AdmaInProgress;
|
bool AdmaInProgress;
|
||||||
|
|
||||||
s8 DMABits; // DMA related?
|
s8 DMABits; // DMA related?
|
||||||
s8 NoiseClk; // Noise Clock
|
s8 NoiseClk; // Noise Clock
|
||||||
u16 AutoDMACtrl; // AutoDMA Status
|
u16 AutoDMACtrl; // AutoDMA Status
|
||||||
s32 DMAICounter; // DMA Interrupt Counter
|
s32 DMAICounter; // DMA Interrupt Counter
|
||||||
u32 InputDataLeft; // Input Buffer
|
u32 InputDataLeft; // Input Buffer
|
||||||
u32 InputPosRead;
|
u32 InputPosRead;
|
||||||
u32 InputPosWrite;
|
u32 InputPosWrite;
|
||||||
u32 InputDataProgress;
|
u32 InputDataProgress;
|
||||||
|
|
||||||
V_Reverb Revb; // Reverb Registers
|
V_Reverb Revb; // Reverb Registers
|
||||||
V_ReverbBuffers RevBuffers; // buffer pointers for reverb, pre-calculated and pre-clipped.
|
V_ReverbBuffers RevBuffers; // buffer pointers for reverb, pre-calculated and pre-clipped.
|
||||||
u32 EffectsStartA;
|
u32 EffectsStartA;
|
||||||
u32 EffectsEndA;
|
u32 EffectsEndA;
|
||||||
u32 ExtEffectsStartA;
|
u32 ExtEffectsStartA;
|
||||||
|
@ -417,7 +417,7 @@ struct V_Core
|
||||||
s32 EffectsBufferSize;
|
s32 EffectsBufferSize;
|
||||||
u32 EffectsBufferStart;
|
u32 EffectsBufferStart;
|
||||||
|
|
||||||
V_CoreRegs Regs; // Registers
|
V_CoreRegs Regs; // Registers
|
||||||
|
|
||||||
// Last samples to pass through the effects processor.
|
// Last samples to pass through the effects processor.
|
||||||
// Used because the effects processor works at 24khz and just pulls
|
// Used because the effects processor works at 24khz and just pulls
|
||||||
|
@ -438,7 +438,7 @@ struct V_Core
|
||||||
u32 MADR;
|
u32 MADR;
|
||||||
u32 TADR;
|
u32 TADR;
|
||||||
|
|
||||||
u32 KeyOn; // not the KON register (though maybe it is)
|
u32 KeyOn; // not the KON register (though maybe it is)
|
||||||
|
|
||||||
// psxmode caches
|
// psxmode caches
|
||||||
u16 psxSoundDataTransferControl;
|
u16 psxSoundDataTransferControl;
|
||||||
|
@ -463,7 +463,7 @@ struct V_Core
|
||||||
, DMAPtr(NULL)
|
, DMAPtr(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
V_Core(int idx); // our badass constructor
|
V_Core(int idx); // our badass constructor
|
||||||
~V_Core() throw();
|
~V_Core() throw();
|
||||||
|
|
||||||
void Init(int index);
|
void Init(int index);
|
||||||
|
|
|
@ -23,47 +23,47 @@
|
||||||
#define SPU2_VP(voice) ((voice)*16)
|
#define SPU2_VP(voice) ((voice)*16)
|
||||||
#define SPU2_VA(voice) ((voice)*12)
|
#define SPU2_VA(voice) ((voice)*12)
|
||||||
|
|
||||||
#define REG_VP_VOLL 0x0000 // Voice Volume Left
|
#define REG_VP_VOLL 0x0000 // Voice Volume Left
|
||||||
#define REG_VP_VOLR 0x0002 // Voice Volume Right
|
#define REG_VP_VOLR 0x0002 // Voice Volume Right
|
||||||
#define REG_VP_PITCH 0x0004 // Pitch
|
#define REG_VP_PITCH 0x0004 // Pitch
|
||||||
#define REG_VP_ADSR1 0x0006 // Envelope 1 (Attack-Decay-Sustain-Release)
|
#define REG_VP_ADSR1 0x0006 // Envelope 1 (Attack-Decay-Sustain-Release)
|
||||||
#define REG_VP_ADSR2 0x0008 // Envelope 2 (Attack-Decay-Sustain-Release)
|
#define REG_VP_ADSR2 0x0008 // Envelope 2 (Attack-Decay-Sustain-Release)
|
||||||
#define REG_VP_ENVX 0x000A // Current Envelope
|
#define REG_VP_ENVX 0x000A // Current Envelope
|
||||||
#define REG_VP_VOLXL 0x000C // Current Voice Volume Left
|
#define REG_VP_VOLXL 0x000C // Current Voice Volume Left
|
||||||
#define REG_VP_VOLXR 0x000E // Current Voice Volume Right
|
#define REG_VP_VOLXR 0x000E // Current Voice Volume Right
|
||||||
|
|
||||||
// .. repeated for each voice ..
|
// .. repeated for each voice ..
|
||||||
|
|
||||||
#define REG_S_PMON 0x0180 // Pitch Modulation Spec.
|
#define REG_S_PMON 0x0180 // Pitch Modulation Spec.
|
||||||
#define REG_S_NON 0x0184 // Alloc Noise Generator
|
#define REG_S_NON 0x0184 // Alloc Noise Generator
|
||||||
#define REG_S_VMIXL 0x0188 // Voice Output Mix Left (Dry)
|
#define REG_S_VMIXL 0x0188 // Voice Output Mix Left (Dry)
|
||||||
#define REG_S_VMIXEL 0x018C // Voice Output Mix Left (Wet)
|
#define REG_S_VMIXEL 0x018C // Voice Output Mix Left (Wet)
|
||||||
#define REG_S_VMIXR 0x0190 // Voice Output Mix Right (Dry)
|
#define REG_S_VMIXR 0x0190 // Voice Output Mix Right (Dry)
|
||||||
#define REG_S_VMIXER 0x0194 // Voice Output Mix Right (Wet)
|
#define REG_S_VMIXER 0x0194 // Voice Output Mix Right (Wet)
|
||||||
|
|
||||||
#define REG_P_MMIX 0x0198 // Output Spec. After Voice Mix
|
#define REG_P_MMIX 0x0198 // Output Spec. After Voice Mix
|
||||||
#define REG_C_ATTR 0x019A // Core X Attrib
|
#define REG_C_ATTR 0x019A // Core X Attrib
|
||||||
#define REG_A_IRQA 0x019C // Interrupt Address Spec.
|
#define REG_A_IRQA 0x019C // Interrupt Address Spec.
|
||||||
|
|
||||||
#define REG_S_KON 0x01A0 // Key On 0/1
|
#define REG_S_KON 0x01A0 // Key On 0/1
|
||||||
#define REG_S_KOFF 0x01A4 // Key Off 0/1
|
#define REG_S_KOFF 0x01A4 // Key Off 0/1
|
||||||
|
|
||||||
#define REG_A_TSA 0x01A8 // Transfer starting address
|
#define REG_A_TSA 0x01A8 // Transfer starting address
|
||||||
#define REG__1AC 0x01AC // Transfer data
|
#define REG__1AC 0x01AC // Transfer data
|
||||||
#define REG__1AE 0x01AE
|
#define REG__1AE 0x01AE
|
||||||
#define REG_S_ADMAS 0x01B0 // AutoDMA Status
|
#define REG_S_ADMAS 0x01B0 // AutoDMA Status
|
||||||
|
|
||||||
// 1b2, 1b4, 1b6, 1b8, 1ba, 1bc, 1be are unknown
|
// 1b2, 1b4, 1b6, 1b8, 1ba, 1bc, 1be are unknown
|
||||||
|
|
||||||
#define REG_VA_SSA 0x01C0 // Waveform data starting address
|
#define REG_VA_SSA 0x01C0 // Waveform data starting address
|
||||||
#define REG_VA_LSAX 0x01C4 // Loop point address
|
#define REG_VA_LSAX 0x01C4 // Loop point address
|
||||||
#define REG_VA_NAX 0x01C8 // Waveform data that should be read next
|
#define REG_VA_NAX 0x01C8 // Waveform data that should be read next
|
||||||
|
|
||||||
// .. repeated for each voice ..
|
// .. repeated for each voice ..
|
||||||
|
|
||||||
#define REG_A_ESA 0x02E0 //Address: Top address of working area for effects processing
|
#define REG_A_ESA 0x02E0 //Address: Top address of working area for effects processing
|
||||||
#define R_FB_SRC_A 0x02E4 // Feedback Source A
|
#define R_FB_SRC_A 0x02E4 // Feedback Source A
|
||||||
#define R_FB_SRC_B 0x02E8 // Feedback Source B
|
#define R_FB_SRC_B 0x02E8 // Feedback Source B
|
||||||
#define R_IIR_DEST_A0 0x02EC
|
#define R_IIR_DEST_A0 0x02EC
|
||||||
#define R_IIR_DEST_A1 0x02F0
|
#define R_IIR_DEST_A1 0x02F0
|
||||||
#define R_ACC_SRC_A0 0x02F4
|
#define R_ACC_SRC_A0 0x02F4
|
||||||
|
@ -78,17 +78,17 @@
|
||||||
#define R_ACC_SRC_C1 0x0318
|
#define R_ACC_SRC_C1 0x0318
|
||||||
#define R_ACC_SRC_D0 0x031C
|
#define R_ACC_SRC_D0 0x031C
|
||||||
#define R_ACC_SRC_D1 0x0320
|
#define R_ACC_SRC_D1 0x0320
|
||||||
#define R_IIR_SRC_B0 0x0324 // Some sources have R_IIR_SRC_B0 and R_IIR_SRC_B1 swapped ><
|
#define R_IIR_SRC_B0 0x0324 // Some sources have R_IIR_SRC_B0 and R_IIR_SRC_B1 swapped ><
|
||||||
#define R_IIR_SRC_B1 0x0328 // Assume a typo in the docs and B0 is actually at 324, B1 at 328 in the HW.
|
#define R_IIR_SRC_B1 0x0328 // Assume a typo in the docs and B0 is actually at 324, B1 at 328 in the HW.
|
||||||
#define R_MIX_DEST_A0 0x032C
|
#define R_MIX_DEST_A0 0x032C
|
||||||
#define R_MIX_DEST_A1 0x0330
|
#define R_MIX_DEST_A1 0x0330
|
||||||
#define R_MIX_DEST_B0 0x0334
|
#define R_MIX_DEST_B0 0x0334
|
||||||
#define R_MIX_DEST_B1 0x0338
|
#define R_MIX_DEST_B1 0x0338
|
||||||
#define REG_A_EEA 0x033C // Address: End address of working area for effects processing (upper part of address only!)
|
#define REG_A_EEA 0x033C // Address: End address of working area for effects processing (upper part of address only!)
|
||||||
|
|
||||||
#define REG_S_ENDX 0x0340 // End Point passed flag
|
#define REG_S_ENDX 0x0340 // End Point passed flag
|
||||||
|
|
||||||
#define REG_P_STATX 0x0344 // Status register?
|
#define REG_P_STATX 0x0344 // Status register?
|
||||||
|
|
||||||
// 0x346 .. 0x3fe are unknown (unused?)
|
// 0x346 .. 0x3fe are unknown (unused?)
|
||||||
|
|
||||||
|
@ -99,25 +99,25 @@
|
||||||
|
|
||||||
// "Different" register area
|
// "Different" register area
|
||||||
|
|
||||||
#define REG_P_MVOLL 0x0760 // Master Volume Left
|
#define REG_P_MVOLL 0x0760 // Master Volume Left
|
||||||
#define REG_P_MVOLR 0x0762 // Master Volume Right
|
#define REG_P_MVOLR 0x0762 // Master Volume Right
|
||||||
#define REG_P_EVOLL 0x0764 // Effect Volume Left
|
#define REG_P_EVOLL 0x0764 // Effect Volume Left
|
||||||
#define REG_P_EVOLR 0x0766 // Effect Volume Right
|
#define REG_P_EVOLR 0x0766 // Effect Volume Right
|
||||||
#define REG_P_AVOLL 0x0768 // Core External Input Volume Left (Only Core 1)
|
#define REG_P_AVOLL 0x0768 // Core External Input Volume Left (Only Core 1)
|
||||||
#define REG_P_AVOLR 0x076A // Core External Input Volume Right (Only Core 1)
|
#define REG_P_AVOLR 0x076A // Core External Input Volume Right (Only Core 1)
|
||||||
#define REG_P_BVOLL 0x076C // Sound Data Volume Left
|
#define REG_P_BVOLL 0x076C // Sound Data Volume Left
|
||||||
#define REG_P_BVOLR 0x076E // Sound Data Volume Right
|
#define REG_P_BVOLR 0x076E // Sound Data Volume Right
|
||||||
#define REG_P_MVOLXL 0x0770 // Current Master Volume Left
|
#define REG_P_MVOLXL 0x0770 // Current Master Volume Left
|
||||||
#define REG_P_MVOLXR 0x0772 // Current Master Volume Right
|
#define REG_P_MVOLXR 0x0772 // Current Master Volume Right
|
||||||
|
|
||||||
#define R_IIR_ALPHA 0x0774 //IIR alpha (% used)
|
#define R_IIR_ALPHA 0x0774 //IIR alpha (% used)
|
||||||
#define R_ACC_COEF_A 0x0776
|
#define R_ACC_COEF_A 0x0776
|
||||||
#define R_ACC_COEF_B 0x0778
|
#define R_ACC_COEF_B 0x0778
|
||||||
#define R_ACC_COEF_C 0x077A
|
#define R_ACC_COEF_C 0x077A
|
||||||
#define R_ACC_COEF_D 0x077C
|
#define R_ACC_COEF_D 0x077C
|
||||||
#define R_IIR_COEF 0x077E
|
#define R_IIR_COEF 0x077E
|
||||||
#define R_FB_ALPHA 0x0780 //feedback alpha (% used)
|
#define R_FB_ALPHA 0x0780 //feedback alpha (% used)
|
||||||
#define R_FB_X 0x0782 //feedback
|
#define R_FB_X 0x0782 //feedback
|
||||||
#define R_IN_COEF_L 0x0784
|
#define R_IN_COEF_L 0x0784
|
||||||
#define R_IN_COEF_R 0x0786
|
#define R_IN_COEF_R 0x0786
|
||||||
|
|
||||||
|
@ -126,11 +126,11 @@
|
||||||
// End OF "Different" register area
|
// End OF "Different" register area
|
||||||
|
|
||||||
// SPDIF interface
|
// SPDIF interface
|
||||||
#define SPDIF_OUT 0x07C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass
|
#define SPDIF_OUT 0x07C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass
|
||||||
#define SPDIF_IRQINFO 0x07C2
|
#define SPDIF_IRQINFO 0x07C2
|
||||||
#define SPDIF_MODE 0x07C6
|
#define SPDIF_MODE 0x07C6
|
||||||
#define SPDIF_MEDIA 0x07C8 // SPDIF Media: 'CD'/DVD
|
#define SPDIF_MEDIA 0x07C8 // SPDIF Media: 'CD'/DVD
|
||||||
#define SPDIF_PROTECT 0x07CC // SPDIF Copy Protection
|
#define SPDIF_PROTECT 0x07CC // SPDIF Copy Protection
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
@ -147,38 +147,38 @@ Core attributes (SD_C)
|
||||||
|
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#define SPDIF_OUT_OFF 0x0000 // no spdif output
|
#define SPDIF_OUT_OFF 0x0000 // no spdif output
|
||||||
#define SPDIF_OUT_PCM 0x0020 // encode spdif from spu2 pcm output
|
#define SPDIF_OUT_PCM 0x0020 // encode spdif from spu2 pcm output
|
||||||
#define SPDIF_OUT_BYPASS 0x0100 // bypass spu2 processing
|
#define SPDIF_OUT_BYPASS 0x0100 // bypass spu2 processing
|
||||||
|
|
||||||
#define SPDIF_MODE_BYPASS_BITSTREAM 0x0002 // bypass mode for digital bitstream data
|
#define SPDIF_MODE_BYPASS_BITSTREAM 0x0002 // bypass mode for digital bitstream data
|
||||||
#define SPDIF_MODE_BYPASS_PCM 0x0000 // bypass mode for pcm data (using analog output)
|
#define SPDIF_MODE_BYPASS_PCM 0x0000 // bypass mode for pcm data (using analog output)
|
||||||
|
|
||||||
#define SPDIF_MODE_MEDIA_CD 0x0800 // source media is a CD
|
#define SPDIF_MODE_MEDIA_CD 0x0800 // source media is a CD
|
||||||
#define SPDIF_MODE_MEDIA_DVD 0x0000 // source media is a DVD
|
#define SPDIF_MODE_MEDIA_DVD 0x0000 // source media is a DVD
|
||||||
|
|
||||||
#define SPDIF_MEDIA_CDVD 0x0200
|
#define SPDIF_MEDIA_CDVD 0x0200
|
||||||
#define SPDIF_MEDIA_400 0x0000
|
#define SPDIF_MEDIA_400 0x0000
|
||||||
|
|
||||||
#define SPDIF_PROTECT_NORMAL 0x0000 // spdif stream is not protected
|
#define SPDIF_PROTECT_NORMAL 0x0000 // spdif stream is not protected
|
||||||
#define SPDIF_PROTECT_PROHIBIT 0x8000 // spdif stream can't be copied
|
#define SPDIF_PROTECT_PROHIBIT 0x8000 // spdif stream can't be copied
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
#define VOICE_PARAM_VOLL 0x0 // Voice Volume Left
|
#define VOICE_PARAM_VOLL 0x0 // Voice Volume Left
|
||||||
#define VOICE_PARAM_VOLR 0x2 // Voice Volume Right
|
#define VOICE_PARAM_VOLR 0x2 // Voice Volume Right
|
||||||
#define VOICE_PARAM_PITCH 0x4 // Pitch
|
#define VOICE_PARAM_PITCH 0x4 // Pitch
|
||||||
#define VOICE_PARAM_ADSR1 0x6 // Envelope 1 (Attack-Delay-Sustain-Release)
|
#define VOICE_PARAM_ADSR1 0x6 // Envelope 1 (Attack-Delay-Sustain-Release)
|
||||||
#define VOICE_PARAM_ADSR2 0x8 // Envelope 2 (Attack-Delay-Sustain-Release)
|
#define VOICE_PARAM_ADSR2 0x8 // Envelope 2 (Attack-Delay-Sustain-Release)
|
||||||
#define VOICE_PARAM_ENVX 0xA // Current Envelope
|
#define VOICE_PARAM_ENVX 0xA // Current Envelope
|
||||||
#define VOICE_PARAM_VOLXL 0xC // Current Voice Volume Left
|
#define VOICE_PARAM_VOLXL 0xC // Current Voice Volume Left
|
||||||
#define VOICE_PARAM_VOLXR 0xE // Current Voice Volume Right
|
#define VOICE_PARAM_VOLXR 0xE // Current Voice Volume Right
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
#define VOICE_ADDR_SSA 0x0 // Waveform data starting address
|
#define VOICE_ADDR_SSA 0x0 // Waveform data starting address
|
||||||
#define VOICE_ADDR_LSAX 0x4 // Loop point address
|
#define VOICE_ADDR_LSAX 0x4 // Loop point address
|
||||||
#define VOICE_ADDR_NAX 0x8 // Waveform data that should be read next
|
#define VOICE_ADDR_NAX 0x8 // Waveform data that should be read next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "PS2E-spu2.h" // hopefully temporary, until I resolve lClocks depdendency
|
#include "PS2E-spu2.h" // hopefully temporary, until I resolve lClocks depdendency
|
||||||
|
|
||||||
namespace Savestate
|
namespace Savestate
|
||||||
{
|
{
|
||||||
|
@ -35,11 +35,11 @@ static void wipe_the_cache()
|
||||||
|
|
||||||
struct Savestate::DataBlock
|
struct Savestate::DataBlock
|
||||||
{
|
{
|
||||||
u32 spu2id; // SPU2-X state identifier lets ZeroGS/PeopsSPU2 know this isn't their state)
|
u32 spu2id; // SPU2-X state identifier lets ZeroGS/PeopsSPU2 know this isn't their state)
|
||||||
u8 unkregs[0x10000]; // SPU2 raw register memory
|
u8 unkregs[0x10000]; // SPU2 raw register memory
|
||||||
u8 mem[0x200000]; // SPU2 raw sample memory
|
u8 mem[0x200000]; // SPU2 raw sample memory
|
||||||
|
|
||||||
u32 version; // SPU2-X version identifier
|
u32 version; // SPU2-X version identifier
|
||||||
V_Core Cores[2];
|
V_Core Cores[2];
|
||||||
V_SPDIF Spdif;
|
V_SPDIF Spdif;
|
||||||
s16 OutPos;
|
s16 OutPos;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Dma.h"
|
#include "Dma.h"
|
||||||
|
|
||||||
#include "PS2E-spu2.h" // needed until I figure out a nice solution for irqcallback dependencies.
|
#include "PS2E-spu2.h" // needed until I figure out a nice solution for irqcallback dependencies.
|
||||||
|
|
||||||
s16 *spu2regs = NULL;
|
s16 *spu2regs = NULL;
|
||||||
s16 *_spu2mem = NULL;
|
s16 *_spu2mem = NULL;
|
||||||
|
@ -140,7 +140,7 @@ void V_Core::Init(int index)
|
||||||
WetGate.ExtR = 0;
|
WetGate.ExtR = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Regs.MMIX = c ? 0xFFC : 0xFF0; // PS2 confirmed (f3c and f30 after BIOS ran, ffc and ff0 after sdinit)
|
Regs.MMIX = c ? 0xFFC : 0xFF0; // PS2 confirmed (f3c and f30 after BIOS ran, ffc and ff0 after sdinit)
|
||||||
Regs.VMIXL = 0xFFFFFF;
|
Regs.VMIXL = 0xFFFFFF;
|
||||||
Regs.VMIXR = 0xFFFFFF;
|
Regs.VMIXR = 0xFFFFFF;
|
||||||
Regs.VMIXEL = 0xFFFFFF;
|
Regs.VMIXEL = 0xFFFFFF;
|
||||||
|
@ -150,7 +150,7 @@ void V_Core::Init(int index)
|
||||||
ExtEffectsStartA = EffectsStartA;
|
ExtEffectsStartA = EffectsStartA;
|
||||||
ExtEffectsEndA = EffectsEndA;
|
ExtEffectsEndA = EffectsEndA;
|
||||||
|
|
||||||
FxEnable = 0; // Uninitialized it's 0 for both cores. Resetting libs however may set this to 0 or 1.
|
FxEnable = 0; // Uninitialized it's 0 for both cores. Resetting libs however may set this to 0 or 1.
|
||||||
// These are real PS2 values, mainly constant apart from a few bits: 0x3220EAA4, 0x40505E9C.
|
// These are real PS2 values, mainly constant apart from a few bits: 0x3220EAA4, 0x40505E9C.
|
||||||
// These values mean nothing. They do not reflect the actual address the SPU2 is testing,
|
// These values mean nothing. They do not reflect the actual address the SPU2 is testing,
|
||||||
// it would seem that reading the IRQA register returns the last written value, not the
|
// it would seem that reading the IRQA register returns the last written value, not the
|
||||||
|
@ -160,7 +160,7 @@ void V_Core::Init(int index)
|
||||||
// in the input or output areas, so we're using 0x800.
|
// in the input or output areas, so we're using 0x800.
|
||||||
// F1 2005 is known to rely on an uninitialised IRQA being an address which will be hit.
|
// F1 2005 is known to rely on an uninitialised IRQA being an address which will be hit.
|
||||||
IRQA = 0x800;
|
IRQA = 0x800;
|
||||||
IRQEnable = 0; // PS2 confirmed
|
IRQEnable = 0; // PS2 confirmed
|
||||||
|
|
||||||
for (uint v = 0; v < NumVoices; ++v) {
|
for (uint v = 0; v < NumVoices; ++v) {
|
||||||
VoiceGates[v].DryL = -1;
|
VoiceGates[v].DryL = -1;
|
||||||
|
@ -168,7 +168,7 @@ void V_Core::Init(int index)
|
||||||
VoiceGates[v].WetL = -1;
|
VoiceGates[v].WetL = -1;
|
||||||
VoiceGates[v].WetR = -1;
|
VoiceGates[v].WetR = -1;
|
||||||
|
|
||||||
Voices[v].Volume = V_VolumeSlideLR(0, 0); // V_VolumeSlideLR::Max;
|
Voices[v].Volume = V_VolumeSlideLR(0, 0); // V_VolumeSlideLR::Max;
|
||||||
Voices[v].SCurrent = 28;
|
Voices[v].SCurrent = 28;
|
||||||
|
|
||||||
Voices[v].ADSR.Value = 0;
|
Voices[v].ADSR.Value = 0;
|
||||||
|
@ -183,7 +183,7 @@ void V_Core::Init(int index)
|
||||||
AdmaInProgress = 0;
|
AdmaInProgress = 0;
|
||||||
|
|
||||||
Regs.STATX = 0x80;
|
Regs.STATX = 0x80;
|
||||||
Regs.ENDX = 0xffffff; // PS2 confirmed
|
Regs.ENDX = 0xffffff; // PS2 confirmed
|
||||||
|
|
||||||
RevBuffers.NeedsUpdated = true;
|
RevBuffers.NeedsUpdated = true;
|
||||||
UpdateEffectsBufferSize();
|
UpdateEffectsBufferSize();
|
||||||
|
@ -258,7 +258,7 @@ void V_Core::UpdateEffectsBufferSize()
|
||||||
{
|
{
|
||||||
const s32 newbufsize = EffectsEndA - EffectsStartA + 1;
|
const s32 newbufsize = EffectsEndA - EffectsStartA + 1;
|
||||||
|
|
||||||
if ((newbufsize * 2) > 0x20000) // max 128kb per core
|
if ((newbufsize * 2) > 0x20000) // max 128kb per core
|
||||||
{
|
{
|
||||||
//printf("too big, returning\n");
|
//printf("too big, returning\n");
|
||||||
//return;
|
//return;
|
||||||
|
@ -382,10 +382,10 @@ __forceinline void TimeUpdate(u32 cClocks)
|
||||||
UpdateDebugDialog();
|
UpdateDebugDialog();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SynchMode == 1) // AsyncMix on
|
if (SynchMode == 1) // AsyncMix on
|
||||||
SndBuffer::UpdateTempoChangeAsyncMixing();
|
SndBuffer::UpdateTempoChangeAsyncMixing();
|
||||||
else
|
else
|
||||||
TickInterval = 768; // Reset to default, in case the user hotswitched from async to something else.
|
TickInterval = 768; // Reset to default, in case the user hotswitched from async to something else.
|
||||||
|
|
||||||
//Update Mixing Progress
|
//Update Mixing Progress
|
||||||
while (dClocks >= TickInterval) {
|
while (dClocks >= TickInterval) {
|
||||||
|
@ -448,7 +448,7 @@ __forceinline void UpdateSpdifMode()
|
||||||
{
|
{
|
||||||
int OPM = PlayMode;
|
int OPM = PlayMode;
|
||||||
|
|
||||||
if (Spdif.Out & 0x4) // use 24/32bit PCM data streaming
|
if (Spdif.Out & 0x4) // use 24/32bit PCM data streaming
|
||||||
{
|
{
|
||||||
PlayMode = 8;
|
PlayMode = 8;
|
||||||
ConLog("* SPU2-X: WARNING: Possibly CDDA mode set!\n");
|
ConLog("* SPU2-X: WARNING: Possibly CDDA mode set!\n");
|
||||||
|
@ -458,9 +458,9 @@ __forceinline void UpdateSpdifMode()
|
||||||
if (Spdif.Out & SPDIF_OUT_BYPASS) {
|
if (Spdif.Out & SPDIF_OUT_BYPASS) {
|
||||||
PlayMode = 2;
|
PlayMode = 2;
|
||||||
if (!(Spdif.Mode & SPDIF_MODE_BYPASS_BITSTREAM))
|
if (!(Spdif.Mode & SPDIF_MODE_BYPASS_BITSTREAM))
|
||||||
PlayMode = 4; //bitstream bypass
|
PlayMode = 4; //bitstream bypass
|
||||||
} else {
|
} else {
|
||||||
PlayMode = 0; //normal processing
|
PlayMode = 0; //normal processing
|
||||||
if (Spdif.Out & SPDIF_OUT_PCM) {
|
if (Spdif.Out & SPDIF_OUT_PCM) {
|
||||||
PlayMode = 1;
|
PlayMode = 1;
|
||||||
}
|
}
|
||||||
|
@ -496,7 +496,7 @@ static u32 map_spu2to1(u32 addr)
|
||||||
|
|
||||||
void V_Core::WriteRegPS1(u32 mem, u16 value)
|
void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
{
|
{
|
||||||
pxAssume(Index == 0); // Valid on Core 0 only!
|
pxAssume(Index == 0); // Valid on Core 0 only!
|
||||||
|
|
||||||
bool show = true;
|
bool show = true;
|
||||||
u32 reg = mem & 0xffff;
|
u32 reg = mem & 0xffff;
|
||||||
|
@ -506,13 +506,13 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
u8 voice = ((reg - 0x1c00) >> 4);
|
u8 voice = ((reg - 0x1c00) >> 4);
|
||||||
u8 vval = reg & 0xf;
|
u8 vval = reg & 0xf;
|
||||||
switch (vval) {
|
switch (vval) {
|
||||||
case 0x0: //VOLL (Volume L)
|
case 0x0: //VOLL (Volume L)
|
||||||
case 0x2: //VOLR (Volume R)
|
case 0x2: //VOLR (Volume R)
|
||||||
{
|
{
|
||||||
V_VolumeSlide &thisvol = vval == 0 ? Voices[voice].Volume.Left : Voices[voice].Volume.Right;
|
V_VolumeSlide &thisvol = vval == 0 ? Voices[voice].Volume.Left : Voices[voice].Volume.Right;
|
||||||
thisvol.Reg_VOL = value;
|
thisvol.Reg_VOL = value;
|
||||||
|
|
||||||
if (value & 0x8000) // +Lin/-Lin/+Exp/-Exp
|
if (value & 0x8000) // +Lin/-Lin/+Exp/-Exp
|
||||||
{
|
{
|
||||||
thisvol.Mode = (value & 0xF000) >> 12;
|
thisvol.Mode = (value & 0xF000) >> 12;
|
||||||
thisvol.Increment = (value & 0x7F);
|
thisvol.Increment = (value & 0x7F);
|
||||||
|
@ -542,16 +542,16 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
//ConLog("voice %x StartA write: %x\n", voice, Voices[voice].StartA);
|
//ConLog("voice %x StartA write: %x\n", voice, Voices[voice].StartA);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x8: // ADSR1 (Envelope)
|
case 0x8: // ADSR1 (Envelope)
|
||||||
Voices[voice].ADSR.regADSR1 = value;
|
Voices[voice].ADSR.regADSR1 = value;
|
||||||
//ConLog("voice %x regADSR1 write: %x\n", voice, Voices[voice].ADSR.regADSR1);
|
//ConLog("voice %x regADSR1 write: %x\n", voice, Voices[voice].ADSR.regADSR1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xa: // ADSR2 (Envelope)
|
case 0xa: // ADSR2 (Envelope)
|
||||||
Voices[voice].ADSR.regADSR2 = value;
|
Voices[voice].ADSR.regADSR2 = value;
|
||||||
//ConLog("voice %x regADSR2 write: %x\n", voice, Voices[voice].ADSR.regADSR2);
|
//ConLog("voice %x regADSR2 write: %x\n", voice, Voices[voice].ADSR.regADSR2);
|
||||||
break;
|
break;
|
||||||
case 0xc: // Voice 0..23 ADSR Current Volume
|
case 0xc: // Voice 0..23 ADSR Current Volume
|
||||||
// not commonly set by games
|
// not commonly set by games
|
||||||
Voices[voice].ADSR.Value = value * 0x10001U;
|
Voices[voice].ADSR.Value = value * 0x10001U;
|
||||||
ConLog("voice %x ADSR.Value write: %x\n", voice, Voices[voice].ADSR.Value);
|
ConLog("voice %x ADSR.Value write: %x\n", voice, Voices[voice].ADSR.Value);
|
||||||
|
@ -567,71 +567,71 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
|
|
||||||
else
|
else
|
||||||
switch (reg) {
|
switch (reg) {
|
||||||
case 0x1d80: // Mainvolume left
|
case 0x1d80: // Mainvolume left
|
||||||
MasterVol.Left.Mode = 0;
|
MasterVol.Left.Mode = 0;
|
||||||
MasterVol.Left.RegSet(value);
|
MasterVol.Left.RegSet(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d82: // Mainvolume right
|
case 0x1d82: // Mainvolume right
|
||||||
MasterVol.Right.Mode = 0;
|
MasterVol.Right.Mode = 0;
|
||||||
MasterVol.Right.RegSet(value);
|
MasterVol.Right.RegSet(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d84: // Reverberation depth left
|
case 0x1d84: // Reverberation depth left
|
||||||
FxVol.Left = GetVol32(value);
|
FxVol.Left = GetVol32(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d86: // Reverberation depth right
|
case 0x1d86: // Reverberation depth right
|
||||||
FxVol.Right = GetVol32(value);
|
FxVol.Right = GetVol32(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d88: // Voice ON (0-15)
|
case 0x1d88: // Voice ON (0-15)
|
||||||
SPU2_FastWrite(REG_S_KON, value);
|
SPU2_FastWrite(REG_S_KON, value);
|
||||||
break;
|
break;
|
||||||
case 0x1d8a: // Voice ON (16-23)
|
case 0x1d8a: // Voice ON (16-23)
|
||||||
SPU2_FastWrite(REG_S_KON + 2, value);
|
SPU2_FastWrite(REG_S_KON + 2, value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d8c: // Voice OFF (0-15)
|
case 0x1d8c: // Voice OFF (0-15)
|
||||||
SPU2_FastWrite(REG_S_KOFF, value);
|
SPU2_FastWrite(REG_S_KOFF, value);
|
||||||
break;
|
break;
|
||||||
case 0x1d8e: // Voice OFF (16-23)
|
case 0x1d8e: // Voice OFF (16-23)
|
||||||
SPU2_FastWrite(REG_S_KOFF + 2, value);
|
SPU2_FastWrite(REG_S_KOFF + 2, value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d90: // Channel FM (pitch lfo) mode (0-15)
|
case 0x1d90: // Channel FM (pitch lfo) mode (0-15)
|
||||||
SPU2_FastWrite(REG_S_PMON, value);
|
SPU2_FastWrite(REG_S_PMON, value);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
ConLog("spu2x warning: wants to set Pitch Modulation reg1 to %x \n", value);
|
ConLog("spu2x warning: wants to set Pitch Modulation reg1 to %x \n", value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d92: // Channel FM (pitch lfo) mode (16-23)
|
case 0x1d92: // Channel FM (pitch lfo) mode (16-23)
|
||||||
SPU2_FastWrite(REG_S_PMON + 2, value);
|
SPU2_FastWrite(REG_S_PMON + 2, value);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
ConLog("spu2x warning: wants to set Pitch Modulation reg2 to %x \n", value);
|
ConLog("spu2x warning: wants to set Pitch Modulation reg2 to %x \n", value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 0x1d94: // Channel Noise mode (0-15)
|
case 0x1d94: // Channel Noise mode (0-15)
|
||||||
SPU2_FastWrite(REG_S_NON, value);
|
SPU2_FastWrite(REG_S_NON, value);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
ConLog("spu2x warning: wants to set Channel Noise mode reg1 to %x\n", value);
|
ConLog("spu2x warning: wants to set Channel Noise mode reg1 to %x\n", value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d96: // Channel Noise mode (16-23)
|
case 0x1d96: // Channel Noise mode (16-23)
|
||||||
SPU2_FastWrite(REG_S_NON + 2, value);
|
SPU2_FastWrite(REG_S_NON + 2, value);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
ConLog("spu2x warning: wants to set Channel Noise mode reg2 to %x\n", value);
|
ConLog("spu2x warning: wants to set Channel Noise mode reg2 to %x\n", value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d98: // 1F801D98h - Voice 0..23 Reverb mode aka Echo On (EON) (R/W)
|
case 0x1d98: // 1F801D98h - Voice 0..23 Reverb mode aka Echo On (EON) (R/W)
|
||||||
//Regs.VMIXEL = value & 0xFFFF;
|
//Regs.VMIXEL = value & 0xFFFF;
|
||||||
SPU2_FastWrite(REG_S_VMIXEL, value);
|
SPU2_FastWrite(REG_S_VMIXEL, value);
|
||||||
SPU2_FastWrite(REG_S_VMIXER, value);
|
SPU2_FastWrite(REG_S_VMIXER, value);
|
||||||
//ConLog("spu2x warning: setting reverb mode reg1 to %x \n", Regs.VMIXEL);
|
//ConLog("spu2x warning: setting reverb mode reg1 to %x \n", Regs.VMIXEL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d9a: // 1F801D98h + 2 - Voice 0..23 Reverb mode aka Echo On (EON) (R/W)
|
case 0x1d9a: // 1F801D98h + 2 - Voice 0..23 Reverb mode aka Echo On (EON) (R/W)
|
||||||
//Regs.VMIXEL = value << 16;
|
//Regs.VMIXEL = value << 16;
|
||||||
SPU2_FastWrite(REG_S_VMIXEL + 2, value);
|
SPU2_FastWrite(REG_S_VMIXEL + 2, value);
|
||||||
SPU2_FastWrite(REG_S_VMIXER + 2, value);
|
SPU2_FastWrite(REG_S_VMIXER + 2, value);
|
||||||
|
@ -648,17 +648,17 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
// SPU2_FastWrite(REG_S_VMIXL+2,value);
|
// SPU2_FastWrite(REG_S_VMIXL+2,value);
|
||||||
// SPU2_FastWrite(REG_S_VMIXR+2,value);
|
// SPU2_FastWrite(REG_S_VMIXR+2,value);
|
||||||
//break;
|
//break;
|
||||||
case 0x1d9c: // Voice 0..15 ON/OFF (status) (ENDX) (R) // writeable but hw overrides it shortly after
|
case 0x1d9c: // Voice 0..15 ON/OFF (status) (ENDX) (R) // writeable but hw overrides it shortly after
|
||||||
//Regs.ENDX &= 0xff0000;
|
//Regs.ENDX &= 0xff0000;
|
||||||
ConLog("spu2x warning: wants to set ENDX reg1 to %x \n", value);
|
ConLog("spu2x warning: wants to set ENDX reg1 to %x \n", value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d9e: // // Voice 15..23 ON/OFF (status) (ENDX) (R) // writeable but hw overrides it shortly after
|
case 0x1d9e: // // Voice 15..23 ON/OFF (status) (ENDX) (R) // writeable but hw overrides it shortly after
|
||||||
//Regs.ENDX &= 0xffff;
|
//Regs.ENDX &= 0xffff;
|
||||||
ConLog("spu2x warning: wants to set ENDX reg2 to %x \n", value);
|
ConLog("spu2x warning: wants to set ENDX reg2 to %x \n", value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1da2: // Reverb work area start
|
case 0x1da2: // Reverb work area start
|
||||||
{
|
{
|
||||||
EffectsStartA = map_spu1to2(value);
|
EffectsStartA = map_spu1to2(value);
|
||||||
//EffectsEndA = 0xFFFFF; // fixed EndA in psx mode
|
//EffectsEndA = 0xFFFFF; // fixed EndA in psx mode
|
||||||
|
@ -676,7 +676,7 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
//ConLog("SPU2-X Setting TSA to %x \n", TSA);
|
//ConLog("SPU2-X Setting TSA to %x \n", TSA);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1da8: // Spu Write to Memory
|
case 0x1da8: // Spu Write to Memory
|
||||||
//ConLog("SPU direct DMA Write. Current TSA = %x\n", TSA);
|
//ConLog("SPU direct DMA Write. Current TSA = %x\n", TSA);
|
||||||
if (Cores[0].IRQEnable && (Cores[0].IRQA <= Cores[0].TSA)) {
|
if (Cores[0].IRQEnable && (Cores[0].IRQA <= Cores[0].TSA)) {
|
||||||
SetIrqCall(0);
|
SetIrqCall(0);
|
||||||
|
@ -690,30 +690,30 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
SPU2_FastWrite(REG_C_ATTR, value);
|
SPU2_FastWrite(REG_C_ATTR, value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1dac: // 1F801DACh - Sound RAM Data Transfer Control (should be 0004h)
|
case 0x1dac: // 1F801DACh - Sound RAM Data Transfer Control (should be 0004h)
|
||||||
ConLog("SPU Sound RAM Data Transfer Control (should be 4) : value = %x \n", value);
|
ConLog("SPU Sound RAM Data Transfer Control (should be 4) : value = %x \n", value);
|
||||||
psxSoundDataTransferControl = value;
|
psxSoundDataTransferControl = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1dae: // 1F801DAEh - SPU Status Register (SPUSTAT) (R)
|
case 0x1dae: // 1F801DAEh - SPU Status Register (SPUSTAT) (R)
|
||||||
// The SPUSTAT register should be treated read-only (writing is possible in so far that the written
|
// The SPUSTAT register should be treated read-only (writing is possible in so far that the written
|
||||||
// value can be read-back for a short moment, however, thereafter the hardware is overwriting that value).
|
// value can be read-back for a short moment, however, thereafter the hardware is overwriting that value).
|
||||||
//Regs.STATX = value;
|
//Regs.STATX = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1DB0: // 1F801DB0h 4 CD Volume Left/Right
|
case 0x1DB0: // 1F801DB0h 4 CD Volume Left/Right
|
||||||
break; // cd left?
|
break; // cd left?
|
||||||
case 0x1DB2:
|
case 0x1DB2:
|
||||||
break; // cd right?
|
break; // cd right?
|
||||||
case 0x1DB4: // 1F801DB4h 4 Extern Volume Left / Right
|
case 0x1DB4: // 1F801DB4h 4 Extern Volume Left / Right
|
||||||
break; // Extern left?
|
break; // Extern left?
|
||||||
case 0x1DB6:
|
case 0x1DB6:
|
||||||
break; // Extern right?
|
break; // Extern right?
|
||||||
case 0x1DB8: // 1F801DB8h 4 Current Main Volume Left/Right
|
case 0x1DB8: // 1F801DB8h 4 Current Main Volume Left/Right
|
||||||
break; // Current left?
|
break; // Current left?
|
||||||
case 0x1DBA:
|
case 0x1DBA:
|
||||||
break; // Current right?
|
break; // Current right?
|
||||||
case 0x1DBC: // 1F801DBCh 4 Unknown? (R/W)
|
case 0x1DBC: // 1F801DBCh 4 Unknown? (R/W)
|
||||||
break;
|
break;
|
||||||
case 0x1DBE:
|
case 0x1DBE:
|
||||||
break;
|
break;
|
||||||
|
@ -792,10 +792,10 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
break;
|
break;
|
||||||
case 0x1DF0:
|
case 0x1DF0:
|
||||||
Revb.IIR_SRC_B0 = value * 4;
|
Revb.IIR_SRC_B0 = value * 4;
|
||||||
break; // IIR_SRC_B0 and IIR_SRC_B1 supposedly swapped on SPU2
|
break; // IIR_SRC_B0 and IIR_SRC_B1 supposedly swapped on SPU2
|
||||||
case 0x1DF2:
|
case 0x1DF2:
|
||||||
Revb.IIR_SRC_B1 = value * 4;
|
Revb.IIR_SRC_B1 = value * 4;
|
||||||
break; // but I don't believe it! (games in psxmode sound better unswapped)
|
break; // but I don't believe it! (games in psxmode sound better unswapped)
|
||||||
case 0x1DF4:
|
case 0x1DF4:
|
||||||
Revb.MIX_DEST_A0 = value * 4;
|
Revb.MIX_DEST_A0 = value * 4;
|
||||||
break;
|
break;
|
||||||
|
@ -824,7 +824,7 @@ void V_Core::WriteRegPS1(u32 mem, u16 value)
|
||||||
|
|
||||||
u16 V_Core::ReadRegPS1(u32 mem)
|
u16 V_Core::ReadRegPS1(u32 mem)
|
||||||
{
|
{
|
||||||
pxAssume(Index == 0); // Valid on Core 0 only!
|
pxAssume(Index == 0); // Valid on Core 0 only!
|
||||||
|
|
||||||
bool show = true;
|
bool show = true;
|
||||||
u16 value = spu2Ru16(mem);
|
u16 value = spu2Ru16(mem);
|
||||||
|
@ -836,13 +836,13 @@ u16 V_Core::ReadRegPS1(u32 mem)
|
||||||
u8 voice = ((reg - 0x1c00) >> 4);
|
u8 voice = ((reg - 0x1c00) >> 4);
|
||||||
u8 vval = reg & 0xf;
|
u8 vval = reg & 0xf;
|
||||||
switch (vval) {
|
switch (vval) {
|
||||||
case 0x0: //VOLL (Volume L)
|
case 0x0: //VOLL (Volume L)
|
||||||
//value=Voices[voice].VolumeL.Mode;
|
//value=Voices[voice].VolumeL.Mode;
|
||||||
//value=Voices[voice].VolumeL.Value;
|
//value=Voices[voice].VolumeL.Value;
|
||||||
value = Voices[voice].Volume.Left.Reg_VOL;
|
value = Voices[voice].Volume.Left.Reg_VOL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2: //VOLR (Volume R)
|
case 0x2: //VOLR (Volume R)
|
||||||
//value=Voices[voice].VolumeR.Mode;
|
//value=Voices[voice].VolumeR.Mode;
|
||||||
//value=Voices[voice].VolumeR.Value;
|
//value=Voices[voice].VolumeR.Value;
|
||||||
value = Voices[voice].Volume.Right.Reg_VOL;
|
value = Voices[voice].Volume.Right.Reg_VOL;
|
||||||
|
@ -862,8 +862,8 @@ u16 V_Core::ReadRegPS1(u32 mem)
|
||||||
case 0xa:
|
case 0xa:
|
||||||
value = Voices[voice].ADSR.regADSR2;
|
value = Voices[voice].ADSR.regADSR2;
|
||||||
break;
|
break;
|
||||||
case 0xc: // Voice 0..23 ADSR Current Volume
|
case 0xc: // Voice 0..23 ADSR Current Volume
|
||||||
value = Voices[voice].ADSR.Value >> 16; // no clue
|
value = Voices[voice].ADSR.Value >> 16; // no clue
|
||||||
//if (value != 0) ConLog("voice %d read ADSR.Value result = %x\n", voice, value);
|
//if (value != 0) ConLog("voice %d read ADSR.Value result = %x\n", voice, value);
|
||||||
break;
|
break;
|
||||||
case 0xe:
|
case 0xe:
|
||||||
|
@ -890,42 +890,42 @@ u16 V_Core::ReadRegPS1(u32 mem)
|
||||||
|
|
||||||
case 0x1d88:
|
case 0x1d88:
|
||||||
value = 0;
|
value = 0;
|
||||||
break; // Voice 0..23 Key ON(Start Attack / Decay / Sustain) (W)
|
break; // Voice 0..23 Key ON(Start Attack / Decay / Sustain) (W)
|
||||||
case 0x1d8a:
|
case 0x1d8a:
|
||||||
value = 0;
|
value = 0;
|
||||||
break;
|
break;
|
||||||
case 0x1d8c:
|
case 0x1d8c:
|
||||||
value = 0;
|
value = 0;
|
||||||
break; // Voice 0..23 Key OFF (Start Release) (W)
|
break; // Voice 0..23 Key OFF (Start Release) (W)
|
||||||
case 0x1d8e:
|
case 0x1d8e:
|
||||||
value = 0;
|
value = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d90:
|
case 0x1d90:
|
||||||
value = Regs.PMON & 0xFFFF;
|
value = Regs.PMON & 0xFFFF;
|
||||||
break; // Voice 0..23 Channel FM(pitch lfo) mode(R / W)
|
break; // Voice 0..23 Channel FM(pitch lfo) mode(R / W)
|
||||||
case 0x1d92:
|
case 0x1d92:
|
||||||
value = Regs.PMON >> 16;
|
value = Regs.PMON >> 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d94:
|
case 0x1d94:
|
||||||
value = Regs.NON & 0xFFFF;
|
value = Regs.NON & 0xFFFF;
|
||||||
break; // Voice 0..23 Channel Noise mode (R/W)
|
break; // Voice 0..23 Channel Noise mode (R/W)
|
||||||
case 0x1d96:
|
case 0x1d96:
|
||||||
value = Regs.NON >> 16;
|
value = Regs.NON >> 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d98:
|
case 0x1d98:
|
||||||
value = Regs.VMIXEL & 0xFFFF;
|
value = Regs.VMIXEL & 0xFFFF;
|
||||||
break; // Voice 0..23 Channel Reverb mode (R/W)
|
break; // Voice 0..23 Channel Reverb mode (R/W)
|
||||||
case 0x1d9a:
|
case 0x1d9a:
|
||||||
value = Regs.VMIXEL >> 16;
|
value = Regs.VMIXEL >> 16;
|
||||||
break;
|
break;
|
||||||
/*case 0x1d9c: value = Regs.VMIXL&0xFFFF; break;*/ // this is wrong?
|
/*case 0x1d9c: value = Regs.VMIXL&0xFFFF; break;*/ // this is wrong?
|
||||||
/*case 0x1d9e: value = Regs.VMIXL >> 16; break;*/
|
/*case 0x1d9e: value = Regs.VMIXL >> 16; break;*/
|
||||||
case 0x1d9c:
|
case 0x1d9c:
|
||||||
value = Regs.ENDX & 0xFFFF;
|
value = Regs.ENDX & 0xFFFF;
|
||||||
break; // Voice 0..23 Channel ON / OFF(status) (R) (ENDX)
|
break; // Voice 0..23 Channel ON / OFF(status) (R) (ENDX)
|
||||||
case 0x1d9e:
|
case 0x1d9e:
|
||||||
value = Regs.ENDX >> 16;
|
value = Regs.ENDX >> 16;
|
||||||
|
|
||||||
|
@ -948,7 +948,7 @@ u16 V_Core::ReadRegPS1(u32 mem)
|
||||||
value = Cores[0].Regs.ATTR;
|
value = Cores[0].Regs.ATTR;
|
||||||
//ConLog("SPU2-X ps1 reg psxSPUCNT read return value: %x\n", value);
|
//ConLog("SPU2-X ps1 reg psxSPUCNT read return value: %x\n", value);
|
||||||
break;
|
break;
|
||||||
case 0x1dac: // 1F801DACh - Sound RAM Data Transfer Control (should be 0004h)
|
case 0x1dac: // 1F801DACh - Sound RAM Data Transfer Control (should be 0004h)
|
||||||
value = psxSoundDataTransferControl;
|
value = psxSoundDataTransferControl;
|
||||||
break;
|
break;
|
||||||
case 0x1dae:
|
case 0x1dae:
|
||||||
|
@ -992,13 +992,13 @@ static void __fastcall RegWrite_VoiceParams(u16 value)
|
||||||
V_Voice &thisvoice = Cores[core].Voices[voice];
|
V_Voice &thisvoice = Cores[core].Voices[voice];
|
||||||
|
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 0: //VOLL (Volume L)
|
case 0: //VOLL (Volume L)
|
||||||
case 1: //VOLR (Volume R)
|
case 1: //VOLR (Volume R)
|
||||||
{
|
{
|
||||||
V_VolumeSlide &thisvol = (param == 0) ? thisvoice.Volume.Left : thisvoice.Volume.Right;
|
V_VolumeSlide &thisvol = (param == 0) ? thisvoice.Volume.Left : thisvoice.Volume.Right;
|
||||||
thisvol.Reg_VOL = value;
|
thisvol.Reg_VOL = value;
|
||||||
|
|
||||||
if (value & 0x8000) // +Lin/-Lin/+Exp/-Exp
|
if (value & 0x8000) // +Lin/-Lin/+Exp/-Exp
|
||||||
{
|
{
|
||||||
thisvol.Mode = (value & 0xF000) >> 12;
|
thisvol.Mode = (value & 0xF000) >> 12;
|
||||||
thisvol.Increment = (value & 0x7F);
|
thisvol.Increment = (value & 0x7F);
|
||||||
|
@ -1022,11 +1022,11 @@ static void __fastcall RegWrite_VoiceParams(u16 value)
|
||||||
thisvoice.Pitch = value & 0x3fff;
|
thisvoice.Pitch = value & 0x3fff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // ADSR1 (Envelope)
|
case 3: // ADSR1 (Envelope)
|
||||||
thisvoice.ADSR.regADSR1 = value;
|
thisvoice.ADSR.regADSR1 = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // ADSR2 (Envelope)
|
case 4: // ADSR2 (Envelope)
|
||||||
thisvoice.ADSR.regADSR2 = value;
|
thisvoice.ADSR.regADSR2 = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1057,13 +1057,13 @@ static void __fastcall RegWrite_VoiceAddr(u16 value)
|
||||||
V_Voice &thisvoice = Cores[core].Voices[voice];
|
V_Voice &thisvoice = Cores[core].Voices[voice];
|
||||||
|
|
||||||
switch (address) {
|
switch (address) {
|
||||||
case 0: // SSA (Waveform Start Addr) (hiword, 4 bits only)
|
case 0: // SSA (Waveform Start Addr) (hiword, 4 bits only)
|
||||||
thisvoice.StartA = ((value & 0x0F) << 16) | (thisvoice.StartA & 0xFFF8);
|
thisvoice.StartA = ((value & 0x0F) << 16) | (thisvoice.StartA & 0xFFF8);
|
||||||
if (IsDevBuild)
|
if (IsDevBuild)
|
||||||
DebugCores[core].Voices[voice].lastSetStartA = thisvoice.StartA;
|
DebugCores[core].Voices[voice].lastSetStartA = thisvoice.StartA;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // SSA (loword)
|
case 1: // SSA (loword)
|
||||||
thisvoice.StartA = (thisvoice.StartA & 0x0F0000) | (value & 0xFFF8);
|
thisvoice.StartA = (thisvoice.StartA & 0x0F0000) | (value & 0xFFF8);
|
||||||
if (IsDevBuild)
|
if (IsDevBuild)
|
||||||
DebugCores[core].Voices[voice].lastSetStartA = thisvoice.StartA;
|
DebugCores[core].Voices[voice].lastSetStartA = thisvoice.StartA;
|
||||||
|
@ -1131,12 +1131,12 @@ static void __fastcall RegWrite_Core(u16 value)
|
||||||
bool fxenable = thiscore.FxEnable;
|
bool fxenable = thiscore.FxEnable;
|
||||||
u8 oldDmaMode = thiscore.DmaMode;
|
u8 oldDmaMode = thiscore.DmaMode;
|
||||||
|
|
||||||
thiscore.AttrBit0 = (value >> 0) & 0x01; //1 bit
|
thiscore.AttrBit0 = (value >> 0) & 0x01; //1 bit
|
||||||
thiscore.DMABits = (value >> 1) & 0x07; //3 bits
|
thiscore.DMABits = (value >> 1) & 0x07; //3 bits
|
||||||
thiscore.DmaMode = (value >> 4) & 0x03; //2 bit (not necessary, we get the direction from the iop)
|
thiscore.DmaMode = (value >> 4) & 0x03; //2 bit (not necessary, we get the direction from the iop)
|
||||||
thiscore.IRQEnable = (value >> 6) & 0x01; //1 bit
|
thiscore.IRQEnable = (value >> 6) & 0x01; //1 bit
|
||||||
thiscore.FxEnable = (value >> 7) & 0x01; //1 bit
|
thiscore.FxEnable = (value >> 7) & 0x01; //1 bit
|
||||||
thiscore.NoiseClk = (value >> 8) & 0x3f; //6 bits
|
thiscore.NoiseClk = (value >> 8) & 0x3f; //6 bits
|
||||||
//thiscore.Mute =(value>>14) & 0x01; //1 bit
|
//thiscore.Mute =(value>>14) & 0x01; //1 bit
|
||||||
thiscore.Mute = 0;
|
thiscore.Mute = 0;
|
||||||
//thiscore.CoreEnabled=(value>>15) & 0x01; //1 bit
|
//thiscore.CoreEnabled=(value>>15) & 0x01; //1 bit
|
||||||
|
@ -1154,7 +1154,7 @@ static void __fastcall RegWrite_Core(u16 value)
|
||||||
|
|
||||||
if (oldDmaMode != thiscore.DmaMode) {
|
if (oldDmaMode != thiscore.DmaMode) {
|
||||||
// FIXME... maybe: if this mode was cleared in the middle of a DMA, should we interrupt it?
|
// FIXME... maybe: if this mode was cleared in the middle of a DMA, should we interrupt it?
|
||||||
thiscore.Regs.STATX &= ~0x400; // ready to transfer
|
thiscore.Regs.STATX &= ~0x400; // ready to transfer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value & 0x000E) {
|
if (value & 0x000E) {
|
||||||
|
@ -1349,16 +1349,16 @@ static void __fastcall RegWrite_Core(u16 value)
|
||||||
psxmode = true;
|
psxmode = true;
|
||||||
//memset(_spu2mem, 0, 0x200000);
|
//memset(_spu2mem, 0, 0x200000);
|
||||||
Cores[1].FxEnable = 0;
|
Cores[1].FxEnable = 0;
|
||||||
Cores[1].EffectsStartA = 0x7FFF8; // park core1 effect area in inaccessible mem
|
Cores[1].EffectsStartA = 0x7FFF8; // park core1 effect area in inaccessible mem
|
||||||
Cores[1].EffectsEndA = 0x7FFFF;
|
Cores[1].EffectsEndA = 0x7FFFF;
|
||||||
Cores[1].ExtEffectsStartA = 0x7FFF8; // park core1 ext effect area in high mem
|
Cores[1].ExtEffectsStartA = 0x7FFF8; // park core1 ext effect area in high mem
|
||||||
Cores[1].ExtEffectsStartA = 0x7FFFF;
|
Cores[1].ExtEffectsStartA = 0x7FFFF;
|
||||||
Cores[1].ReverbX = 0;
|
Cores[1].ReverbX = 0;
|
||||||
Cores[1].RevBuffers.NeedsUpdated = true;
|
Cores[1].RevBuffers.NeedsUpdated = true;
|
||||||
Cores[0].ReverbX = 0;
|
Cores[0].ReverbX = 0;
|
||||||
Cores[0].RevBuffers.NeedsUpdated = true;
|
Cores[0].RevBuffers.NeedsUpdated = true;
|
||||||
for (uint v = 0; v < 24; ++v) {
|
for (uint v = 0; v < 24; ++v) {
|
||||||
Cores[1].Voices[v].Volume = V_VolumeSlideLR(0, 0); // V_VolumeSlideLR::Max;
|
Cores[1].Voices[v].Volume = V_VolumeSlideLR(0, 0); // V_VolumeSlideLR::Max;
|
||||||
Cores[1].Voices[v].SCurrent = 28;
|
Cores[1].Voices[v].SCurrent = 28;
|
||||||
|
|
||||||
Cores[1].Voices[v].ADSR.Value = 0;
|
Cores[1].Voices[v].ADSR.Value = 0;
|
||||||
|
@ -1398,7 +1398,7 @@ static void __fastcall RegWrite_CoreExt(u16 value)
|
||||||
case REG_P_MVOLR: {
|
case REG_P_MVOLR: {
|
||||||
V_VolumeSlide &thisvol = (addr == REG_P_MVOLL) ? thiscore.MasterVol.Left : thiscore.MasterVol.Right;
|
V_VolumeSlide &thisvol = (addr == REG_P_MVOLL) ? thiscore.MasterVol.Left : thiscore.MasterVol.Right;
|
||||||
|
|
||||||
if (value & 0x8000) // +Lin/-Lin/+Exp/-Exp
|
if (value & 0x8000) // +Lin/-Lin/+Exp/-Exp
|
||||||
{
|
{
|
||||||
thisvol.Mode = (value & 0xF000) >> 12;
|
thisvol.Mode = (value & 0xF000) >> 12;
|
||||||
thisvol.Increment = (value & 0x7F);
|
thisvol.Increment = (value & 0x7F);
|
||||||
|
@ -1517,7 +1517,7 @@ static void __fastcall RegWrite_Null(u16 value)
|
||||||
typedef void __fastcall RegWriteHandler(u16 value);
|
typedef void __fastcall RegWriteHandler(u16 value);
|
||||||
static RegWriteHandler *const tbl_reg_writes[0x401] =
|
static RegWriteHandler *const tbl_reg_writes[0x401] =
|
||||||
{
|
{
|
||||||
VoiceParamsCore(0), // 0x000 -> 0x180
|
VoiceParamsCore(0), // 0x000 -> 0x180
|
||||||
CoreParamsPair(0, REG_S_PMON),
|
CoreParamsPair(0, REG_S_PMON),
|
||||||
CoreParamsPair(0, REG_S_NON),
|
CoreParamsPair(0, REG_S_NON),
|
||||||
CoreParamsPair(0, REG_S_VMIXL),
|
CoreParamsPair(0, REG_S_VMIXL),
|
||||||
|
@ -1550,33 +1550,33 @@ static RegWriteHandler *const tbl_reg_writes[0x401] =
|
||||||
|
|
||||||
CoreParamsPair(0, REG_A_ESA),
|
CoreParamsPair(0, REG_A_ESA),
|
||||||
|
|
||||||
ReverbPair(0, R_FB_SRC_A), // 0x02E4 // Feedback Source A
|
ReverbPair(0, R_FB_SRC_A), // 0x02E4 // Feedback Source A
|
||||||
ReverbPair(0, R_FB_SRC_B), // 0x02E8 // Feedback Source B
|
ReverbPair(0, R_FB_SRC_B), // 0x02E8 // Feedback Source B
|
||||||
ReverbPair(0, R_IIR_DEST_A0), // 0x02EC
|
ReverbPair(0, R_IIR_DEST_A0), // 0x02EC
|
||||||
ReverbPair(0, R_IIR_DEST_A1), // 0x02F0
|
ReverbPair(0, R_IIR_DEST_A1), // 0x02F0
|
||||||
ReverbPair(0, R_ACC_SRC_A0), // 0x02F4
|
ReverbPair(0, R_ACC_SRC_A0), // 0x02F4
|
||||||
ReverbPair(0, R_ACC_SRC_A1), // 0x02F8
|
ReverbPair(0, R_ACC_SRC_A1), // 0x02F8
|
||||||
ReverbPair(0, R_ACC_SRC_B0), // 0x02FC
|
ReverbPair(0, R_ACC_SRC_B0), // 0x02FC
|
||||||
ReverbPair(0, R_ACC_SRC_B1), // 0x0300
|
ReverbPair(0, R_ACC_SRC_B1), // 0x0300
|
||||||
ReverbPair(0, R_IIR_SRC_A0), // 0x0304
|
ReverbPair(0, R_IIR_SRC_A0), // 0x0304
|
||||||
ReverbPair(0, R_IIR_SRC_A1), // 0x0308
|
ReverbPair(0, R_IIR_SRC_A1), // 0x0308
|
||||||
ReverbPair(0, R_IIR_DEST_B0), // 0x030C
|
ReverbPair(0, R_IIR_DEST_B0), // 0x030C
|
||||||
ReverbPair(0, R_IIR_DEST_B1), // 0x0310
|
ReverbPair(0, R_IIR_DEST_B1), // 0x0310
|
||||||
ReverbPair(0, R_ACC_SRC_C0), // 0x0314
|
ReverbPair(0, R_ACC_SRC_C0), // 0x0314
|
||||||
ReverbPair(0, R_ACC_SRC_C1), // 0x0318
|
ReverbPair(0, R_ACC_SRC_C1), // 0x0318
|
||||||
ReverbPair(0, R_ACC_SRC_D0), // 0x031C
|
ReverbPair(0, R_ACC_SRC_D0), // 0x031C
|
||||||
ReverbPair(0, R_ACC_SRC_D1), // 0x0320
|
ReverbPair(0, R_ACC_SRC_D1), // 0x0320
|
||||||
ReverbPair(0, R_IIR_SRC_B0), // 0x0324
|
ReverbPair(0, R_IIR_SRC_B0), // 0x0324
|
||||||
ReverbPair(0, R_IIR_SRC_B1), // 0x0328
|
ReverbPair(0, R_IIR_SRC_B1), // 0x0328
|
||||||
ReverbPair(0, R_MIX_DEST_A0), // 0x032C
|
ReverbPair(0, R_MIX_DEST_A0), // 0x032C
|
||||||
ReverbPair(0, R_MIX_DEST_A1), // 0x0330
|
ReverbPair(0, R_MIX_DEST_A1), // 0x0330
|
||||||
ReverbPair(0, R_MIX_DEST_B0), // 0x0334
|
ReverbPair(0, R_MIX_DEST_B0), // 0x0334
|
||||||
ReverbPair(0, R_MIX_DEST_B1), // 0x0338
|
ReverbPair(0, R_MIX_DEST_B1), // 0x0338
|
||||||
|
|
||||||
RegWrite_Core<0, REG_A_EEA>, RegWrite_Null,
|
RegWrite_Core<0, REG_A_EEA>, RegWrite_Null,
|
||||||
|
|
||||||
CoreParamsPair(0, REG_S_ENDX), // 0x0340 // End Point passed flag
|
CoreParamsPair(0, REG_S_ENDX), // 0x0340 // End Point passed flag
|
||||||
RegWrite_Core<0, REG_P_STATX>, // 0x0344 // Status register?
|
RegWrite_Core<0, REG_P_STATX>, // 0x0344 // Status register?
|
||||||
|
|
||||||
//0x346 here
|
//0x346 here
|
||||||
REGRAW(0x346),
|
REGRAW(0x346),
|
||||||
|
@ -1607,7 +1607,7 @@ static RegWriteHandler *const tbl_reg_writes[0x401] =
|
||||||
// AND... we reached 0x400!
|
// AND... we reached 0x400!
|
||||||
// Last verse, same as the first:
|
// Last verse, same as the first:
|
||||||
|
|
||||||
VoiceParamsCore(1), // 0x000 -> 0x180
|
VoiceParamsCore(1), // 0x000 -> 0x180
|
||||||
CoreParamsPair(1, REG_S_PMON),
|
CoreParamsPair(1, REG_S_PMON),
|
||||||
CoreParamsPair(1, REG_S_NON),
|
CoreParamsPair(1, REG_S_NON),
|
||||||
CoreParamsPair(1, REG_S_VMIXL),
|
CoreParamsPair(1, REG_S_VMIXL),
|
||||||
|
@ -1640,33 +1640,33 @@ static RegWriteHandler *const tbl_reg_writes[0x401] =
|
||||||
|
|
||||||
CoreParamsPair(1, REG_A_ESA),
|
CoreParamsPair(1, REG_A_ESA),
|
||||||
|
|
||||||
ReverbPair(1, R_FB_SRC_A), // 0x02E4 // Feedback Source A
|
ReverbPair(1, R_FB_SRC_A), // 0x02E4 // Feedback Source A
|
||||||
ReverbPair(1, R_FB_SRC_B), // 0x02E8 // Feedback Source B
|
ReverbPair(1, R_FB_SRC_B), // 0x02E8 // Feedback Source B
|
||||||
ReverbPair(1, R_IIR_DEST_A0), // 0x02EC
|
ReverbPair(1, R_IIR_DEST_A0), // 0x02EC
|
||||||
ReverbPair(1, R_IIR_DEST_A1), // 0x02F0
|
ReverbPair(1, R_IIR_DEST_A1), // 0x02F0
|
||||||
ReverbPair(1, R_ACC_SRC_A0), // 0x02F4
|
ReverbPair(1, R_ACC_SRC_A0), // 0x02F4
|
||||||
ReverbPair(1, R_ACC_SRC_A1), // 0x02F8
|
ReverbPair(1, R_ACC_SRC_A1), // 0x02F8
|
||||||
ReverbPair(1, R_ACC_SRC_B0), // 0x02FC
|
ReverbPair(1, R_ACC_SRC_B0), // 0x02FC
|
||||||
ReverbPair(1, R_ACC_SRC_B1), // 0x0300
|
ReverbPair(1, R_ACC_SRC_B1), // 0x0300
|
||||||
ReverbPair(1, R_IIR_SRC_A0), // 0x0304
|
ReverbPair(1, R_IIR_SRC_A0), // 0x0304
|
||||||
ReverbPair(1, R_IIR_SRC_A1), // 0x0308
|
ReverbPair(1, R_IIR_SRC_A1), // 0x0308
|
||||||
ReverbPair(1, R_IIR_DEST_B0), // 0x030C
|
ReverbPair(1, R_IIR_DEST_B0), // 0x030C
|
||||||
ReverbPair(1, R_IIR_DEST_B1), // 0x0310
|
ReverbPair(1, R_IIR_DEST_B1), // 0x0310
|
||||||
ReverbPair(1, R_ACC_SRC_C0), // 0x0314
|
ReverbPair(1, R_ACC_SRC_C0), // 0x0314
|
||||||
ReverbPair(1, R_ACC_SRC_C1), // 0x0318
|
ReverbPair(1, R_ACC_SRC_C1), // 0x0318
|
||||||
ReverbPair(1, R_ACC_SRC_D0), // 0x031C
|
ReverbPair(1, R_ACC_SRC_D0), // 0x031C
|
||||||
ReverbPair(1, R_ACC_SRC_D1), // 0x0320
|
ReverbPair(1, R_ACC_SRC_D1), // 0x0320
|
||||||
ReverbPair(1, R_IIR_SRC_B0), // 0x0324
|
ReverbPair(1, R_IIR_SRC_B0), // 0x0324
|
||||||
ReverbPair(1, R_IIR_SRC_B1), // 0x0328
|
ReverbPair(1, R_IIR_SRC_B1), // 0x0328
|
||||||
ReverbPair(1, R_MIX_DEST_A0), // 0x032C
|
ReverbPair(1, R_MIX_DEST_A0), // 0x032C
|
||||||
ReverbPair(1, R_MIX_DEST_A1), // 0x0330
|
ReverbPair(1, R_MIX_DEST_A1), // 0x0330
|
||||||
ReverbPair(1, R_MIX_DEST_B0), // 0x0334
|
ReverbPair(1, R_MIX_DEST_B0), // 0x0334
|
||||||
ReverbPair(1, R_MIX_DEST_B1), // 0x0338
|
ReverbPair(1, R_MIX_DEST_B1), // 0x0338
|
||||||
|
|
||||||
RegWrite_Core<1, REG_A_EEA>, RegWrite_Null,
|
RegWrite_Core<1, REG_A_EEA>, RegWrite_Null,
|
||||||
|
|
||||||
CoreParamsPair(1, REG_S_ENDX), // 0x0340 // End Point passed flag
|
CoreParamsPair(1, REG_S_ENDX), // 0x0340 // End Point passed flag
|
||||||
RegWrite_Core<1, REG_P_STATX>, // 0x0344 // Status register?
|
RegWrite_Core<1, REG_P_STATX>, // 0x0344 // Status register?
|
||||||
|
|
||||||
REGRAW(0x746),
|
REGRAW(0x746),
|
||||||
REGRAW(0x748), REGRAW(0x74A), REGRAW(0x74C), REGRAW(0x74E),
|
REGRAW(0x748), REGRAW(0x74A), REGRAW(0x74C), REGRAW(0x74E),
|
||||||
|
@ -1675,64 +1675,64 @@ static RegWriteHandler *const tbl_reg_writes[0x401] =
|
||||||
|
|
||||||
// ------ -------
|
// ------ -------
|
||||||
|
|
||||||
RegWrite_CoreExt<0, REG_P_MVOLL>, // 0x0760 // Master Volume Left
|
RegWrite_CoreExt<0, REG_P_MVOLL>, // 0x0760 // Master Volume Left
|
||||||
RegWrite_CoreExt<0, REG_P_MVOLR>, // 0x0762 // Master Volume Right
|
RegWrite_CoreExt<0, REG_P_MVOLR>, // 0x0762 // Master Volume Right
|
||||||
RegWrite_CoreExt<0, REG_P_EVOLL>, // 0x0764 // Effect Volume Left
|
RegWrite_CoreExt<0, REG_P_EVOLL>, // 0x0764 // Effect Volume Left
|
||||||
RegWrite_CoreExt<0, REG_P_EVOLR>, // 0x0766 // Effect Volume Right
|
RegWrite_CoreExt<0, REG_P_EVOLR>, // 0x0766 // Effect Volume Right
|
||||||
RegWrite_CoreExt<0, REG_P_AVOLL>, // 0x0768 // Core External Input Volume Left (Only Core 1)
|
RegWrite_CoreExt<0, REG_P_AVOLL>, // 0x0768 // Core External Input Volume Left (Only Core 1)
|
||||||
RegWrite_CoreExt<0, REG_P_AVOLR>, // 0x076A // Core External Input Volume Right (Only Core 1)
|
RegWrite_CoreExt<0, REG_P_AVOLR>, // 0x076A // Core External Input Volume Right (Only Core 1)
|
||||||
RegWrite_CoreExt<0, REG_P_BVOLL>, // 0x076C // Sound Data Volume Left
|
RegWrite_CoreExt<0, REG_P_BVOLL>, // 0x076C // Sound Data Volume Left
|
||||||
RegWrite_CoreExt<0, REG_P_BVOLR>, // 0x076E // Sound Data Volume Right
|
RegWrite_CoreExt<0, REG_P_BVOLR>, // 0x076E // Sound Data Volume Right
|
||||||
RegWrite_CoreExt<0, REG_P_MVOLXL>, // 0x0770 // Current Master Volume Left
|
RegWrite_CoreExt<0, REG_P_MVOLXL>, // 0x0770 // Current Master Volume Left
|
||||||
RegWrite_CoreExt<0, REG_P_MVOLXR>, // 0x0772 // Current Master Volume Right
|
RegWrite_CoreExt<0, REG_P_MVOLXR>, // 0x0772 // Current Master Volume Right
|
||||||
|
|
||||||
RegWrite_CoreExt<0, R_IIR_ALPHA>, // 0x0774 //IIR alpha (% used)
|
RegWrite_CoreExt<0, R_IIR_ALPHA>, // 0x0774 //IIR alpha (% used)
|
||||||
RegWrite_CoreExt<0, R_ACC_COEF_A>, // 0x0776
|
RegWrite_CoreExt<0, R_ACC_COEF_A>, // 0x0776
|
||||||
RegWrite_CoreExt<0, R_ACC_COEF_B>, // 0x0778
|
RegWrite_CoreExt<0, R_ACC_COEF_B>, // 0x0778
|
||||||
RegWrite_CoreExt<0, R_ACC_COEF_C>, // 0x077A
|
RegWrite_CoreExt<0, R_ACC_COEF_C>, // 0x077A
|
||||||
RegWrite_CoreExt<0, R_ACC_COEF_D>, // 0x077C
|
RegWrite_CoreExt<0, R_ACC_COEF_D>, // 0x077C
|
||||||
RegWrite_CoreExt<0, R_IIR_COEF>, // 0x077E
|
RegWrite_CoreExt<0, R_IIR_COEF>, // 0x077E
|
||||||
RegWrite_CoreExt<0, R_FB_ALPHA>, // 0x0780 //feedback alpha (% used)
|
RegWrite_CoreExt<0, R_FB_ALPHA>, // 0x0780 //feedback alpha (% used)
|
||||||
RegWrite_CoreExt<0, R_FB_X>, // 0x0782 //feedback
|
RegWrite_CoreExt<0, R_FB_X>, // 0x0782 //feedback
|
||||||
RegWrite_CoreExt<0, R_IN_COEF_L>, // 0x0784
|
RegWrite_CoreExt<0, R_IN_COEF_L>, // 0x0784
|
||||||
RegWrite_CoreExt<0, R_IN_COEF_R>, // 0x0786
|
RegWrite_CoreExt<0, R_IN_COEF_R>, // 0x0786
|
||||||
|
|
||||||
// ------ -------
|
// ------ -------
|
||||||
|
|
||||||
RegWrite_CoreExt<1, REG_P_MVOLL>, // 0x0788 // Master Volume Left
|
RegWrite_CoreExt<1, REG_P_MVOLL>, // 0x0788 // Master Volume Left
|
||||||
RegWrite_CoreExt<1, REG_P_MVOLR>, // 0x078A // Master Volume Right
|
RegWrite_CoreExt<1, REG_P_MVOLR>, // 0x078A // Master Volume Right
|
||||||
RegWrite_CoreExt<1, REG_P_EVOLL>, // 0x0764 // Effect Volume Left
|
RegWrite_CoreExt<1, REG_P_EVOLL>, // 0x0764 // Effect Volume Left
|
||||||
RegWrite_CoreExt<1, REG_P_EVOLR>, // 0x0766 // Effect Volume Right
|
RegWrite_CoreExt<1, REG_P_EVOLR>, // 0x0766 // Effect Volume Right
|
||||||
RegWrite_CoreExt<1, REG_P_AVOLL>, // 0x0768 // Core External Input Volume Left (Only Core 1)
|
RegWrite_CoreExt<1, REG_P_AVOLL>, // 0x0768 // Core External Input Volume Left (Only Core 1)
|
||||||
RegWrite_CoreExt<1, REG_P_AVOLR>, // 0x076A // Core External Input Volume Right (Only Core 1)
|
RegWrite_CoreExt<1, REG_P_AVOLR>, // 0x076A // Core External Input Volume Right (Only Core 1)
|
||||||
RegWrite_CoreExt<1, REG_P_BVOLL>, // 0x076C // Sound Data Volume Left
|
RegWrite_CoreExt<1, REG_P_BVOLL>, // 0x076C // Sound Data Volume Left
|
||||||
RegWrite_CoreExt<1, REG_P_BVOLR>, // 0x076E // Sound Data Volume Right
|
RegWrite_CoreExt<1, REG_P_BVOLR>, // 0x076E // Sound Data Volume Right
|
||||||
RegWrite_CoreExt<1, REG_P_MVOLXL>, // 0x0770 // Current Master Volume Left
|
RegWrite_CoreExt<1, REG_P_MVOLXL>, // 0x0770 // Current Master Volume Left
|
||||||
RegWrite_CoreExt<1, REG_P_MVOLXR>, // 0x0772 // Current Master Volume Right
|
RegWrite_CoreExt<1, REG_P_MVOLXR>, // 0x0772 // Current Master Volume Right
|
||||||
|
|
||||||
RegWrite_CoreExt<1, R_IIR_ALPHA>, // 0x0774 //IIR alpha (% used)
|
RegWrite_CoreExt<1, R_IIR_ALPHA>, // 0x0774 //IIR alpha (% used)
|
||||||
RegWrite_CoreExt<1, R_ACC_COEF_A>, // 0x0776
|
RegWrite_CoreExt<1, R_ACC_COEF_A>, // 0x0776
|
||||||
RegWrite_CoreExt<1, R_ACC_COEF_B>, // 0x0778
|
RegWrite_CoreExt<1, R_ACC_COEF_B>, // 0x0778
|
||||||
RegWrite_CoreExt<1, R_ACC_COEF_C>, // 0x077A
|
RegWrite_CoreExt<1, R_ACC_COEF_C>, // 0x077A
|
||||||
RegWrite_CoreExt<1, R_ACC_COEF_D>, // 0x077C
|
RegWrite_CoreExt<1, R_ACC_COEF_D>, // 0x077C
|
||||||
RegWrite_CoreExt<1, R_IIR_COEF>, // 0x077E
|
RegWrite_CoreExt<1, R_IIR_COEF>, // 0x077E
|
||||||
RegWrite_CoreExt<1, R_FB_ALPHA>, // 0x0780 //feedback alpha (% used)
|
RegWrite_CoreExt<1, R_FB_ALPHA>, // 0x0780 //feedback alpha (% used)
|
||||||
RegWrite_CoreExt<1, R_FB_X>, // 0x0782 //feedback
|
RegWrite_CoreExt<1, R_FB_X>, // 0x0782 //feedback
|
||||||
RegWrite_CoreExt<1, R_IN_COEF_L>, // 0x0784
|
RegWrite_CoreExt<1, R_IN_COEF_L>, // 0x0784
|
||||||
RegWrite_CoreExt<1, R_IN_COEF_R>, // 0x0786
|
RegWrite_CoreExt<1, R_IN_COEF_R>, // 0x0786
|
||||||
|
|
||||||
REGRAW(0x7B0), REGRAW(0x7B2), REGRAW(0x7B4), REGRAW(0x7B6),
|
REGRAW(0x7B0), REGRAW(0x7B2), REGRAW(0x7B4), REGRAW(0x7B6),
|
||||||
REGRAW(0x7B8), REGRAW(0x7BA), REGRAW(0x7BC), REGRAW(0x7BE),
|
REGRAW(0x7B8), REGRAW(0x7BA), REGRAW(0x7BC), REGRAW(0x7BE),
|
||||||
|
|
||||||
// SPDIF interface
|
// SPDIF interface
|
||||||
|
|
||||||
RegWrite_SPDIF<SPDIF_OUT>, // 0x07C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass
|
RegWrite_SPDIF<SPDIF_OUT>, // 0x07C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass
|
||||||
RegWrite_SPDIF<SPDIF_IRQINFO>, // 0x07C2
|
RegWrite_SPDIF<SPDIF_IRQINFO>, // 0x07C2
|
||||||
REGRAW(0x7C4),
|
REGRAW(0x7C4),
|
||||||
RegWrite_SPDIF<SPDIF_MODE>, // 0x07C6
|
RegWrite_SPDIF<SPDIF_MODE>, // 0x07C6
|
||||||
RegWrite_SPDIF<SPDIF_MEDIA>, // 0x07C8 // SPDIF Media: 'CD'/DVD
|
RegWrite_SPDIF<SPDIF_MEDIA>, // 0x07C8 // SPDIF Media: 'CD'/DVD
|
||||||
REGRAW(0x7CA),
|
REGRAW(0x7CA),
|
||||||
RegWrite_SPDIF<SPDIF_PROTECT>, // 0x07CC // SPDIF Copy Protection
|
RegWrite_SPDIF<SPDIF_PROTECT>, // 0x07CC // SPDIF Copy Protection
|
||||||
|
|
||||||
REGRAW(0x7CE),
|
REGRAW(0x7CE),
|
||||||
REGRAW(0x7D0), REGRAW(0x7D2), REGRAW(0x7D4), REGRAW(0x7D6),
|
REGRAW(0x7D0), REGRAW(0x7D2), REGRAW(0x7D4), REGRAW(0x7D6),
|
||||||
|
@ -1742,7 +1742,7 @@ static RegWriteHandler *const tbl_reg_writes[0x401] =
|
||||||
REGRAW(0x7F0), REGRAW(0x7F2), REGRAW(0x7F4), REGRAW(0x7F6),
|
REGRAW(0x7F0), REGRAW(0x7F2), REGRAW(0x7F4), REGRAW(0x7F6),
|
||||||
REGRAW(0x7F8), REGRAW(0x7FA), REGRAW(0x7FC), REGRAW(0x7FE),
|
REGRAW(0x7F8), REGRAW(0x7FA), REGRAW(0x7FC), REGRAW(0x7FE),
|
||||||
|
|
||||||
NULL // should be at 0x400! (we assert check it on startup)
|
NULL // should be at 0x400! (we assert check it on startup)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue