mirror of https://github.com/PCSX2/pcsx2.git
SPU2null reformat
This commit is contained in:
parent
67e7d63f0f
commit
e3a2ad03bc
|
@ -23,14 +23,16 @@ using namespace std;
|
||||||
extern string s_strIniPath;
|
extern string s_strIniPath;
|
||||||
PluginConf Ini;
|
PluginConf Ini;
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2configure()
|
EXPORT_C_(void)
|
||||||
|
SPU2configure()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2about()
|
EXPORT_C_(void)
|
||||||
|
SPU2about()
|
||||||
{
|
{
|
||||||
//SysMessage("%s %d.%d", libraryName, version, build);
|
//SysMessage("%s %d.%d", libraryName, version, build);
|
||||||
SysMessage("SPU2null: A simple null plugin.");
|
SysMessage("SPU2null: A simple null plugin.");
|
||||||
|
@ -40,8 +42,7 @@ void LoadConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
||||||
|
|
||||||
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;
|
||||||
|
@ -55,8 +56,7 @@ void SaveConfig()
|
||||||
{
|
{
|
||||||
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
||||||
|
|
||||||
if (!Ini.Open(iniFile, WRITE_FILE))
|
if (!Ini.Open(iniFile, WRITE_FILE)) {
|
||||||
{
|
|
||||||
printf("failed to open %s\n", iniFile.c_str());
|
printf("failed to open %s\n", iniFile.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,25 +76,27 @@ const s32 f[5][2] = {
|
||||||
{60, 0},
|
{60, 0},
|
||||||
{115, -52},
|
{115, -52},
|
||||||
{98, -55},
|
{98, -55},
|
||||||
{ 122, -60 }
|
{122, -60}};
|
||||||
};
|
|
||||||
|
|
||||||
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) PS2EgetLibType()
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibType()
|
||||||
{
|
{
|
||||||
return PS2E_LT_SPU2;
|
return PS2E_LT_SPU2;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(char*) PS2EgetLibName()
|
EXPORT_C_(char*)
|
||||||
|
PS2EgetLibName()
|
||||||
{
|
{
|
||||||
return libraryName;
|
return libraryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
EXPORT_C_(u32)
|
||||||
|
PS2EgetLibVersion2(u32 type)
|
||||||
{
|
{
|
||||||
return (version << 16) | (revision << 8) | build | (minor << 24);
|
return (version << 16) | (revision << 8) | build | (minor << 24);
|
||||||
}
|
}
|
||||||
|
@ -103,22 +105,26 @@ void __Log(char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list list;
|
va_list list;
|
||||||
|
|
||||||
if (!conf.Log || spu2Log == NULL) return;
|
if (!conf.Log || spu2Log == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
va_start(list, fmt);
|
va_start(list, fmt);
|
||||||
vfprintf(spu2Log, fmt, list);
|
vfprintf(spu2Log, fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2setSettingsDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
SPU2setSettingsDir(const char* dir)
|
||||||
{
|
{
|
||||||
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenLog() {
|
bool OpenLog()
|
||||||
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
#ifdef SPU2_LOG
|
#ifdef SPU2_LOG
|
||||||
if(spu2Log) return result;
|
if (spu2Log)
|
||||||
|
return result;
|
||||||
|
|
||||||
const std::string LogFile(s_strLogPath + "/spu2null.log");
|
const std::string LogFile(s_strLogPath + "/spu2null.log");
|
||||||
|
|
||||||
|
@ -135,7 +141,8 @@ bool OpenLog() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2setLogDir(const char* dir)
|
EXPORT_C_(void)
|
||||||
|
SPU2setLogDir(const char* dir)
|
||||||
{
|
{
|
||||||
// Get the path to the log directory.
|
// Get the path to the log directory.
|
||||||
s_strLogPath = (dir == NULL) ? "logs/" : dir;
|
s_strLogPath = (dir == NULL) ? "logs/" : dir;
|
||||||
|
@ -148,21 +155,20 @@ EXPORT_C_(void) SPU2setLogDir(const char* dir)
|
||||||
OpenLog();
|
OpenLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) SPU2init()
|
EXPORT_C_(s32)
|
||||||
|
SPU2init()
|
||||||
{
|
{
|
||||||
OpenLog();
|
OpenLog();
|
||||||
|
|
||||||
spu2regs = (s8*)malloc(0x10000);
|
spu2regs = (s8*)malloc(0x10000);
|
||||||
if (spu2regs == NULL)
|
if (spu2regs == NULL) {
|
||||||
{
|
|
||||||
SysMessage("Error allocating Memory\n");
|
SysMessage("Error allocating Memory\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -177,8 +183,7 @@ EXPORT_C_(s32) SPU2init()
|
||||||
voices[i + 24].memoffset = 0x400;
|
voices[i + 24].memoffset = 0x400;
|
||||||
|
|
||||||
// init each channel
|
// init each channel
|
||||||
for (u32 i = 0; i < ArraySize(voices); ++i)
|
for (u32 i = 0; i < ArraySize(voices); ++i) {
|
||||||
{
|
|
||||||
|
|
||||||
voices[i].pLoop = voices[i].pStart = voices[i].pCurr = (u8*)spu2mem;
|
voices[i].pLoop = voices[i].pStart = voices[i].pCurr = (u8*)spu2mem;
|
||||||
|
|
||||||
|
@ -189,7 +194,8 @@ EXPORT_C_(s32) SPU2init()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(s32) SPU2open(void *pDsp)
|
EXPORT_C_(s32)
|
||||||
|
SPU2open(void* pDsp)
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
SPUCycles = SPUWorkerCycles = 0;
|
SPUCycles = SPUWorkerCycles = 0;
|
||||||
|
@ -200,12 +206,14 @@ EXPORT_C_(s32) SPU2open(void *pDsp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2close()
|
EXPORT_C_(void)
|
||||||
|
SPU2close()
|
||||||
{
|
{
|
||||||
g_nSpuInit = 0;
|
g_nSpuInit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2shutdown()
|
EXPORT_C_(void)
|
||||||
|
SPU2shutdown()
|
||||||
{
|
{
|
||||||
free(spu2regs);
|
free(spu2regs);
|
||||||
spu2regs = NULL;
|
spu2regs = NULL;
|
||||||
|
@ -224,33 +232,27 @@ void SPU2Worker();
|
||||||
|
|
||||||
#define CYCLES_PER_MS (36864000 / 1000)
|
#define CYCLES_PER_MS (36864000 / 1000)
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2async(u32 cycle)
|
EXPORT_C_(void)
|
||||||
|
SPU2async(u32 cycle)
|
||||||
{
|
{
|
||||||
SPUCycles += cycle;
|
SPUCycles += cycle;
|
||||||
if (interrupt & (1 << 2))
|
if (interrupt & (1 << 2)) {
|
||||||
{
|
if (SPUCycles - SPUStartCycle[1] >= SPUTargetCycle[1]) {
|
||||||
if (SPUCycles - SPUStartCycle[1] >= SPUTargetCycle[1])
|
|
||||||
{
|
|
||||||
interrupt &= ~(1 << 2);
|
interrupt &= ~(1 << 2);
|
||||||
irqCallbackDMA7();
|
irqCallbackDMA7();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interrupt & (1 << 1))
|
if (interrupt & (1 << 1)) {
|
||||||
{
|
if (SPUCycles - SPUStartCycle[0] >= SPUTargetCycle[0]) {
|
||||||
if (SPUCycles - SPUStartCycle[0] >= SPUTargetCycle[0])
|
|
||||||
{
|
|
||||||
interrupt &= ~(1 << 1);
|
interrupt &= ~(1 << 1);
|
||||||
irqCallbackDMA4();
|
irqCallbackDMA4();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_nSpuInit)
|
if (g_nSpuInit) {
|
||||||
{
|
|
||||||
|
|
||||||
while (SPUCycles - SPUWorkerCycles > 0 && CYCLES_PER_MS < SPUCycles - SPUWorkerCycles)
|
while (SPUCycles - SPUWorkerCycles > 0 && CYCLES_PER_MS < SPUCycles - SPUWorkerCycles) {
|
||||||
{
|
|
||||||
SPU2Worker();
|
SPU2Worker();
|
||||||
SPUWorkerCycles += CYCLES_PER_MS;
|
SPUWorkerCycles += CYCLES_PER_MS;
|
||||||
}
|
}
|
||||||
|
@ -269,17 +271,16 @@ void InitADSR() // INIT ADSR
|
||||||
|
|
||||||
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;
|
||||||
rd++;
|
rd++;
|
||||||
if (rd == 5)
|
if (rd == 5) {
|
||||||
{
|
|
||||||
rd = 1;
|
rd = 1;
|
||||||
rs *= 2;
|
rs *= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r > 0x3FFFFFFF) r = 0x3FFFFFFF;
|
if (r > 0x3FFFFFFF)
|
||||||
|
r = 0x3FFFFFFF;
|
||||||
|
|
||||||
RateTable[i] = r;
|
RateTable[i] = r;
|
||||||
}
|
}
|
||||||
|
@ -289,8 +290,7 @@ 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;
|
||||||
pvoice->bOn = false;
|
pvoice->bOn = false;
|
||||||
pvoice->pStart = (u8*)(spu2mem + pvoice->iStartAddr);
|
pvoice->pStart = (u8*)(spu2mem + pvoice->iStartAddr);
|
||||||
|
@ -302,8 +302,7 @@ int MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR
|
||||||
}
|
}
|
||||||
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:
|
||||||
pvoice->ADSRX.EnvelopeVol -= RateTable[(4 * (pvoice->ADSRX.ReleaseRate ^ 0x1F)) - 0x18 + 0 + 32];
|
pvoice->ADSRX.EnvelopeVol -= RateTable[(4 * (pvoice->ADSRX.ReleaseRate ^ 0x1F)) - 0x18 + 0 + 32];
|
||||||
break;
|
break;
|
||||||
|
@ -329,14 +328,11 @@ int MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR
|
||||||
pvoice->ADSRX.EnvelopeVol -= RateTable[(4 * (pvoice->ADSRX.ReleaseRate ^ 0x1F)) - 0x18 + 12 + 32];
|
pvoice->ADSRX.EnvelopeVol -= RateTable[(4 * (pvoice->ADSRX.ReleaseRate ^ 0x1F)) - 0x18 + 12 + 32];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
pvoice->ADSRX.EnvelopeVol -= RateTable[(4 * (pvoice->ADSRX.ReleaseRate ^ 0x1F)) - 0x0C + 32];
|
pvoice->ADSRX.EnvelopeVol -= RateTable[(4 * (pvoice->ADSRX.ReleaseRate ^ 0x1F)) - 0x0C + 32];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pvoice->ADSRX.EnvelopeVol < 0)
|
if (pvoice->ADSRX.EnvelopeVol < 0) {
|
||||||
{
|
|
||||||
pvoice->ADSRX.EnvelopeVol = 0;
|
pvoice->ADSRX.EnvelopeVol = 0;
|
||||||
pvoice->bOn = false;
|
pvoice->bOn = false;
|
||||||
pvoice->pStart = (u8*)(spu2mem + pvoice->iStartAddr);
|
pvoice->pStart = (u8*)(spu2mem + pvoice->iStartAddr);
|
||||||
|
@ -351,25 +347,20 @@ 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)
|
||||||
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.AttackRate ^ 0x7F) - 0x10 + 32];
|
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.AttackRate ^ 0x7F) - 0x10 + 32];
|
||||||
else
|
else
|
||||||
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.AttackRate ^ 0x7F) - 0x18 + 32];
|
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.AttackRate ^ 0x7F) - 0x18 + 32];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.AttackRate ^ 0x7F) - 0x10 + 32];
|
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.AttackRate ^ 0x7F) - 0x10 + 32];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pvoice->ADSRX.EnvelopeVol < 0)
|
if (pvoice->ADSRX.EnvelopeVol < 0) {
|
||||||
{
|
|
||||||
pvoice->ADSRX.EnvelopeVol = 0x7FFFFFFF;
|
pvoice->ADSRX.EnvelopeVol = 0x7FFFFFFF;
|
||||||
pvoice->ADSRX.State = 1;
|
pvoice->ADSRX.State = 1;
|
||||||
}
|
}
|
||||||
|
@ -380,8 +371,7 @@ int MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR
|
||||||
//--------------------------------------------------//
|
//--------------------------------------------------//
|
||||||
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:
|
||||||
pvoice->ADSRX.EnvelopeVol -= RateTable[(4 * (pvoice->ADSRX.DecayRate ^ 0x1F)) - 0x18 + 0 + 32];
|
pvoice->ADSRX.EnvelopeVol -= RateTable[(4 * (pvoice->ADSRX.DecayRate ^ 0x1F)) - 0x18 + 0 + 32];
|
||||||
break;
|
break;
|
||||||
|
@ -408,9 +398,9 @@ int MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pvoice->ADSRX.EnvelopeVol < 0) pvoice->ADSRX.EnvelopeVol = 0;
|
if (pvoice->ADSRX.EnvelopeVol < 0)
|
||||||
if (((pvoice->ADSRX.EnvelopeVol >> 27)&0xF) <= pvoice->ADSRX.SustainLevel)
|
pvoice->ADSRX.EnvelopeVol = 0;
|
||||||
{
|
if (((pvoice->ADSRX.EnvelopeVol >> 27) & 0xF) <= pvoice->ADSRX.SustainLevel) {
|
||||||
pvoice->ADSRX.State = 2;
|
pvoice->ADSRX.State = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,31 +410,22 @@ int MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR
|
||||||
//--------------------------------------------------//
|
//--------------------------------------------------//
|
||||||
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)
|
|
||||||
{
|
|
||||||
if (pvoice->ADSRX.EnvelopeVol < 0x60000000)
|
if (pvoice->ADSRX.EnvelopeVol < 0x60000000)
|
||||||
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.SustainRate ^ 0x7F) - 0x10 + 32];
|
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.SustainRate ^ 0x7F) - 0x10 + 32];
|
||||||
else
|
else
|
||||||
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.SustainRate ^ 0x7F) - 0x18 + 32];
|
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.SustainRate ^ 0x7F) - 0x18 + 32];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.SustainRate ^ 0x7F) - 0x10 + 32];
|
pvoice->ADSRX.EnvelopeVol += RateTable[(pvoice->ADSRX.SustainRate ^ 0x7F) - 0x10 + 32];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pvoice->ADSRX.EnvelopeVol < 0)
|
if (pvoice->ADSRX.EnvelopeVol < 0) {
|
||||||
{
|
|
||||||
pvoice->ADSRX.EnvelopeVol = 0x7FFFFFFF;
|
pvoice->ADSRX.EnvelopeVol = 0x7FFFFFFF;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if (pvoice->ADSRX.SustainModeExp) {
|
||||||
{
|
switch ((pvoice->ADSRX.EnvelopeVol >> 28) & 0x7) {
|
||||||
if (pvoice->ADSRX.SustainModeExp)
|
|
||||||
{
|
|
||||||
switch ((pvoice->ADSRX.EnvelopeVol >> 28)&0x7)
|
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
pvoice->ADSRX.EnvelopeVol -= RateTable[((pvoice->ADSRX.SustainRate ^ 0x7F)) - 0x1B + 0 + 32];
|
pvoice->ADSRX.EnvelopeVol -= RateTable[((pvoice->ADSRX.SustainRate ^ 0x7F)) - 0x1B + 0 + 32];
|
||||||
break;
|
break;
|
||||||
|
@ -470,14 +451,11 @@ int MixADSR(VOICE_PROCESSED* pvoice) // MIX ADSR
|
||||||
pvoice->ADSRX.EnvelopeVol -= RateTable[((pvoice->ADSRX.SustainRate ^ 0x7F)) - 0x1B + 12 + 32];
|
pvoice->ADSRX.EnvelopeVol -= RateTable[((pvoice->ADSRX.SustainRate ^ 0x7F)) - 0x1B + 12 + 32];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
pvoice->ADSRX.EnvelopeVol -= RateTable[((pvoice->ADSRX.SustainRate ^ 0x7F)) - 0x0F + 32];
|
pvoice->ADSRX.EnvelopeVol -= RateTable[((pvoice->ADSRX.SustainRate ^ 0x7F)) - 0x0F + 32];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pvoice->ADSRX.EnvelopeVol < 0)
|
if (pvoice->ADSRX.EnvelopeVol < 0) {
|
||||||
{
|
|
||||||
pvoice->ADSRX.EnvelopeVol = 0;
|
pvoice->ADSRX.EnvelopeVol = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,14 +475,12 @@ void SPU2Worker()
|
||||||
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) {
|
||||||
{
|
|
||||||
// fill buffer with empty data
|
// fill buffer with empty data
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -514,10 +490,8 @@ void SPU2Worker()
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -539,13 +513,10 @@ void SPU2Worker()
|
||||||
start += 16;
|
start += 16;
|
||||||
|
|
||||||
// some callback and irq active?
|
// some callback and irq active?
|
||||||
if (pChannel->GetCtrl()->irq)
|
if (pChannel->GetCtrl()->irq) {
|
||||||
{
|
|
||||||
// if irq address reached or irq on looping addr, when stop/loop flag is set
|
// if irq address reached or irq on looping addr, when stop/loop flag is set
|
||||||
u8* pirq = (u8*)pSpuIrq[ch >= 24];
|
u8* pirq = (u8*)pSpuIrq[ch >= 24];
|
||||||
if ((pirq > start - 16 && pirq <= start)
|
if ((pirq > start - 16 && pirq <= start) || ((flags & 1) && (pirq > pChannel->pLoop - 16 && pirq <= pChannel->pLoop))) {
|
||||||
|| ((flags&1) && (pirq > pChannel->pLoop - 16 && pirq <= pChannel->pLoop)))
|
|
||||||
{
|
|
||||||
IRQINFO |= 4 << (int)(ch >= 24);
|
IRQINFO |= 4 << (int)(ch >= 24);
|
||||||
irqCallbackSPU2();
|
irqCallbackSPU2();
|
||||||
}
|
}
|
||||||
|
@ -565,9 +536,7 @@ void SPU2Worker()
|
||||||
start = (u8*)-1;
|
start = (u8*)-1;
|
||||||
pChannel->bStop = true;
|
pChannel->bStop = true;
|
||||||
pChannel->bIgnoreLoop = false;
|
pChannel->bIgnoreLoop = false;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
start = pChannel->pLoop;
|
start = pChannel->pLoop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,68 +554,58 @@ void SPU2Worker()
|
||||||
ns++;
|
ns++;
|
||||||
pChannel->spos += pChannel->sinc;
|
pChannel->spos += pChannel->sinc;
|
||||||
}
|
}
|
||||||
ENDX:
|
ENDX:;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// mix all channels
|
// mix all channels
|
||||||
if ((spu2Ru16(REG_C0_MMIX) & 0xC0) && (spu2Ru16(REG_C0_ADMAS) & 0x1) && !(spu2Ru16(REG_C0_CTRL) & 0x30))
|
if ((spu2Ru16(REG_C0_MMIX) & 0xC0) && (spu2Ru16(REG_C0_ADMAS) & 0x1) && !(spu2Ru16(REG_C0_CTRL) & 0x30)) {
|
||||||
{
|
for (int ns = 0; ns < NSSIZE; ns++) {
|
||||||
for (int ns = 0;ns < NSSIZE;ns++)
|
|
||||||
{
|
|
||||||
Adma4.Index += 1;
|
Adma4.Index += 1;
|
||||||
|
|
||||||
if (Adma4.Index == 128 || Adma4.Index == 384)
|
if (Adma4.Index == 128 || Adma4.Index == 384) {
|
||||||
{
|
if (ADMAS4Write()) {
|
||||||
if (ADMAS4Write())
|
|
||||||
{
|
|
||||||
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80;
|
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80;
|
||||||
irqCallbackDMA4();
|
irqCallbackDMA4();
|
||||||
}
|
} else
|
||||||
else MemAddr[0] += 1024;
|
MemAddr[0] += 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Adma4.Index == 512)
|
if (Adma4.Index == 512) {
|
||||||
{
|
|
||||||
Adma4.Index = 0;
|
Adma4.Index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((spu2Ru16(REG_C1_MMIX) & 0xC0) && (spu2Ru16(REG_C1_ADMAS) & 0x2) && !(spu2Ru16(REG_C1_CTRL) & 0x30))
|
if ((spu2Ru16(REG_C1_MMIX) & 0xC0) && (spu2Ru16(REG_C1_ADMAS) & 0x2) && !(spu2Ru16(REG_C1_CTRL) & 0x30)) {
|
||||||
{
|
for (int ns = 0; ns < NSSIZE; ns++) {
|
||||||
for (int ns = 0;ns < NSSIZE;ns++)
|
|
||||||
{
|
|
||||||
Adma7.Index += 1;
|
Adma7.Index += 1;
|
||||||
|
|
||||||
if (Adma7.Index == 128 || Adma7.Index == 384)
|
if (Adma7.Index == 128 || Adma7.Index == 384) {
|
||||||
{
|
if (ADMAS7Write()) {
|
||||||
if (ADMAS7Write())
|
|
||||||
{
|
|
||||||
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80;
|
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80;
|
||||||
irqCallbackDMA7();
|
irqCallbackDMA7();
|
||||||
}
|
} else
|
||||||
else MemAddr[1] += 1024;
|
MemAddr[1] += 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Adma7.Index == 512) Adma7.Index = 0;
|
if (Adma7.Index == 512)
|
||||||
|
Adma7.Index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2readDMA4Mem(u16 *pMem, int size)
|
EXPORT_C_(void)
|
||||||
|
SPU2readDMA4Mem(u16* pMem, int size)
|
||||||
{
|
{
|
||||||
u32 spuaddr = C0_SPUADDR;
|
u32 spuaddr = C0_SPUADDR;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
SPU2_LOG("SPU2 readDMA4Mem size %x, addr: %x\n", size, pMem);
|
SPU2_LOG("SPU2 readDMA4Mem size %x, addr: %x\n", size, pMem);
|
||||||
|
|
||||||
for (i = 0;i < size;i++)
|
for (i = 0; i < size; i++) {
|
||||||
{
|
|
||||||
*pMem++ = *(u16*)(spu2mem + spuaddr);
|
*pMem++ = *(u16*)(spu2mem + spuaddr);
|
||||||
if ((spu2Rs16(REG_C0_CTRL)&0x40) && C0_IRQA == spuaddr)
|
if ((spu2Rs16(REG_C0_CTRL) & 0x40) && C0_IRQA == spuaddr) {
|
||||||
{
|
|
||||||
spu2Ru16(SPDIF_OUT) |= 0x4;
|
spu2Ru16(SPDIF_OUT) |= 0x4;
|
||||||
C0_SPUADDR_SET(spuaddr);
|
C0_SPUADDR_SET(spuaddr);
|
||||||
IRQINFO |= 4;
|
IRQINFO |= 4;
|
||||||
|
@ -668,18 +627,17 @@ EXPORT_C_(void) SPU2readDMA4Mem(u16 *pMem, int size)
|
||||||
interrupt |= (1 << 1);
|
interrupt |= (1 << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2readDMA7Mem(u16* pMem, int size)
|
EXPORT_C_(void)
|
||||||
|
SPU2readDMA7Mem(u16* pMem, int size)
|
||||||
{
|
{
|
||||||
u32 spuaddr = C1_SPUADDR;
|
u32 spuaddr = C1_SPUADDR;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
SPU2_LOG("SPU2 readDMA7Mem size %x, addr: %x\n", size, pMem);
|
SPU2_LOG("SPU2 readDMA7Mem size %x, addr: %x\n", size, pMem);
|
||||||
|
|
||||||
for (i = 0;i < size;i++)
|
for (i = 0; i < size; i++) {
|
||||||
{
|
|
||||||
*pMem++ = *(u16*)(spu2mem + spuaddr);
|
*pMem++ = *(u16*)(spu2mem + spuaddr);
|
||||||
if ((spu2Rs16(REG_C1_CTRL)&0x40) && C1_IRQA == spuaddr)
|
if ((spu2Rs16(REG_C1_CTRL) & 0x40) && C1_IRQA == spuaddr) {
|
||||||
{
|
|
||||||
spu2Ru16(SPDIF_OUT) |= 0x8;
|
spu2Ru16(SPDIF_OUT) |= 0x8;
|
||||||
C1_SPUADDR_SET(spuaddr);
|
C1_SPUADDR_SET(spuaddr);
|
||||||
IRQINFO |= 8;
|
IRQINFO |= 8;
|
||||||
|
@ -711,8 +669,10 @@ EXPORT_C_(void) SPU2readDMA7Mem(u16* pMem, int size)
|
||||||
int ADMAS4Write()
|
int ADMAS4Write()
|
||||||
{
|
{
|
||||||
u32 spuaddr;
|
u32 spuaddr;
|
||||||
if (interrupt & 0x2) return 0;
|
if (interrupt & 0x2)
|
||||||
if (Adma4.AmountLeft <= 0) return 1;
|
return 0;
|
||||||
|
if (Adma4.AmountLeft <= 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
spuaddr = C0_SPUADDR;
|
spuaddr = C0_SPUADDR;
|
||||||
// SPU2 Deinterleaves the Left and Right Channels
|
// SPU2 Deinterleaves the Left and Right Channels
|
||||||
|
@ -724,8 +684,7 @@ int ADMAS4Write()
|
||||||
C0_SPUADDR_SET(spuaddr);
|
C0_SPUADDR_SET(spuaddr);
|
||||||
|
|
||||||
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;
|
||||||
|
@ -737,8 +696,10 @@ int ADMAS4Write()
|
||||||
int ADMAS7Write()
|
int ADMAS7Write()
|
||||||
{
|
{
|
||||||
u32 spuaddr;
|
u32 spuaddr;
|
||||||
if (interrupt & 0x4) return 0;
|
if (interrupt & 0x4)
|
||||||
if (Adma7.AmountLeft <= 0) return 1;
|
return 0;
|
||||||
|
if (Adma7.AmountLeft <= 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
spuaddr = C1_SPUADDR;
|
spuaddr = C1_SPUADDR;
|
||||||
// SPU2 Deinterleaves the Left and Right Channels
|
// SPU2 Deinterleaves the Left and Right Channels
|
||||||
|
@ -750,8 +711,7 @@ int ADMAS7Write()
|
||||||
C1_SPUADDR_SET(spuaddr);
|
C1_SPUADDR_SET(spuaddr);
|
||||||
|
|
||||||
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;
|
||||||
|
@ -760,14 +720,14 @@ int ADMAS7Write()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2writeDMA4Mem(u16* pMem, int size)
|
EXPORT_C_(void)
|
||||||
|
SPU2writeDMA4Mem(u16* pMem, int size)
|
||||||
{
|
{
|
||||||
u32 spuaddr;
|
u32 spuaddr;
|
||||||
|
|
||||||
SPU2_LOG("SPU2 writeDMA4Mem size %x, addr: %x\n", size, pMem);
|
SPU2_LOG("SPU2 writeDMA4Mem size %x, addr: %x\n", size, pMem);
|
||||||
|
|
||||||
if ((spu2Ru16(REG_C0_ADMAS) & 0x1) && (spu2Ru16(REG_C0_CTRL) & 0x30) == 0 && size)
|
if ((spu2Ru16(REG_C0_ADMAS) & 0x1) && (spu2Ru16(REG_C0_CTRL) & 0x30) == 0 && size) {
|
||||||
{
|
|
||||||
//fwrite(pMem,iSize<<1,1,LogFile);
|
//fwrite(pMem,iSize<<1,1,LogFile);
|
||||||
memset(&Adma4, 0, sizeof(ADMA));
|
memset(&Adma4, 0, sizeof(ADMA));
|
||||||
C0_SPUADDR_SET(0);
|
C0_SPUADDR_SET(0);
|
||||||
|
@ -782,8 +742,7 @@ EXPORT_C_(void) SPU2writeDMA4Mem(u16* pMem, int size)
|
||||||
spuaddr += size;
|
spuaddr += size;
|
||||||
C0_SPUADDR_SET(spuaddr);
|
C0_SPUADDR_SET(spuaddr);
|
||||||
|
|
||||||
if ((spu2Ru16(REG_C0_CTRL)&0x40) && C0_IRQA == spuaddr)
|
if ((spu2Ru16(REG_C0_CTRL) & 0x40) && C0_IRQA == spuaddr) {
|
||||||
{
|
|
||||||
spu2Ru16(SPDIF_OUT) |= 0x4;
|
spu2Ru16(SPDIF_OUT) |= 0x4;
|
||||||
IRQINFO |= 4;
|
IRQINFO |= 4;
|
||||||
irqCallbackSPU2();
|
irqCallbackSPU2();
|
||||||
|
@ -799,14 +758,14 @@ EXPORT_C_(void) SPU2writeDMA4Mem(u16* pMem, int size)
|
||||||
interrupt |= (1 << 1);
|
interrupt |= (1 << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2writeDMA7Mem(u16* pMem, int size)
|
EXPORT_C_(void)
|
||||||
|
SPU2writeDMA7Mem(u16* pMem, int size)
|
||||||
{
|
{
|
||||||
u32 spuaddr;
|
u32 spuaddr;
|
||||||
|
|
||||||
SPU2_LOG("SPU2 writeDMA7Mem size %x, addr: %x\n", size, pMem);
|
SPU2_LOG("SPU2 writeDMA7Mem size %x, addr: %x\n", size, pMem);
|
||||||
|
|
||||||
if ((spu2Ru16(REG_C1_ADMAS) & 0x2) && (spu2Ru16(REG_C1_CTRL) & 0x30) == 0 && size)
|
if ((spu2Ru16(REG_C1_ADMAS) & 0x2) && (spu2Ru16(REG_C1_CTRL) & 0x30) == 0 && size) {
|
||||||
{
|
|
||||||
//fwrite(pMem,iSize<<1,1,LogFile);
|
//fwrite(pMem,iSize<<1,1,LogFile);
|
||||||
memset(&Adma7, 0, sizeof(ADMA));
|
memset(&Adma7, 0, sizeof(ADMA));
|
||||||
C1_SPUADDR_SET(0);
|
C1_SPUADDR_SET(0);
|
||||||
|
@ -821,8 +780,7 @@ EXPORT_C_(void) SPU2writeDMA7Mem(u16* pMem, int size)
|
||||||
spuaddr += size;
|
spuaddr += size;
|
||||||
C1_SPUADDR_SET(spuaddr);
|
C1_SPUADDR_SET(spuaddr);
|
||||||
|
|
||||||
if ((spu2Ru16(REG_C1_CTRL)&0x40) && C1_IRQA == spuaddr)
|
if ((spu2Ru16(REG_C1_CTRL) & 0x40) && C1_IRQA == spuaddr) {
|
||||||
{
|
|
||||||
spu2Ru16(SPDIF_OUT) |= 0x8;
|
spu2Ru16(SPDIF_OUT) |= 0x8;
|
||||||
IRQINFO |= 8;
|
IRQINFO |= 8;
|
||||||
irqCallbackSPU2();
|
irqCallbackSPU2();
|
||||||
|
@ -838,7 +796,8 @@ EXPORT_C_(void) SPU2writeDMA7Mem(u16* pMem, int size)
|
||||||
interrupt |= (1 << 2);
|
interrupt |= (1 << 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2interruptDMA4()
|
EXPORT_C_(void)
|
||||||
|
SPU2interruptDMA4()
|
||||||
{
|
{
|
||||||
SPU2_LOG("SPU2 interruptDMA4\n");
|
SPU2_LOG("SPU2 interruptDMA4\n");
|
||||||
|
|
||||||
|
@ -846,7 +805,8 @@ EXPORT_C_(void) SPU2interruptDMA4()
|
||||||
spu2Ru16(REG_C0_SPUSTAT) |= 0x80;
|
spu2Ru16(REG_C0_SPUSTAT) |= 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2interruptDMA7()
|
EXPORT_C_(void)
|
||||||
|
SPU2interruptDMA7()
|
||||||
{
|
{
|
||||||
SPU2_LOG("SPU2 interruptDMA7\n");
|
SPU2_LOG("SPU2 interruptDMA7\n");
|
||||||
|
|
||||||
|
@ -888,18 +848,16 @@ void FModOn(s32 start, s32 end, u16 val) // FMOD ON PSX COMMAND
|
||||||
{
|
{
|
||||||
if (val & 1) // -> fmod on/off
|
if (val & 1) // -> fmod on/off
|
||||||
{
|
{
|
||||||
if (ch > 0)
|
if (ch > 0) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// turn fmod off
|
// turn fmod off
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2write(u32 mem, u16 value)
|
EXPORT_C_(void)
|
||||||
|
SPU2write(u32 mem, u16 value)
|
||||||
{
|
{
|
||||||
u32 spuaddr;
|
u32 spuaddr;
|
||||||
|
|
||||||
|
@ -915,19 +873,19 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
|
||||||
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) ch = ((r - 0x400) >> 4) + 24;
|
if (r >= 0x400)
|
||||||
else ch = (r >> 4);
|
ch = ((r - 0x400) >> 4) + 24;
|
||||||
|
else
|
||||||
|
ch = (r >> 4);
|
||||||
|
|
||||||
VOICE_PROCESSED* pvoice = &voices[ch];
|
VOICE_PROCESSED* pvoice = &voices[ch];
|
||||||
|
|
||||||
switch (r&0x0f)
|
switch (r & 0x0f) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
case 2:
|
case 2:
|
||||||
pvoice->SetVolume(mem & 0x2);
|
pvoice->SetVolume(mem & 0x2);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4: {
|
||||||
{
|
|
||||||
int NP;
|
int NP;
|
||||||
if (value > 0x3fff)
|
if (value > 0x3fff)
|
||||||
NP = 0x3fff; // get pitch val
|
NP = 0x3fff; // get pitch val
|
||||||
|
@ -937,12 +895,12 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
|
||||||
pvoice->pvoice->pitch = NP;
|
pvoice->pvoice->pitch = NP;
|
||||||
|
|
||||||
NP = (44100L * NP) / 4096L; // calc frequency
|
NP = (44100L * NP) / 4096L; // calc frequency
|
||||||
if (NP < 1) NP = 1; // some security
|
if (NP < 1)
|
||||||
|
NP = 1; // some security
|
||||||
pvoice->iActFreq = NP; // store frequency
|
pvoice->iActFreq = NP; // store frequency
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6:
|
case 6: {
|
||||||
{
|
|
||||||
pvoice->ADSRX.AttackModeExp = (value & 0x8000) ? 1 : 0;
|
pvoice->ADSRX.AttackModeExp = (value & 0x8000) ? 1 : 0;
|
||||||
pvoice->ADSRX.AttackRate = ((value >> 8) & 0x007f);
|
pvoice->ADSRX.AttackRate = ((value >> 8) & 0x007f);
|
||||||
pvoice->ADSRX.DecayRate = (((value >> 4) & 0x000f));
|
pvoice->ADSRX.DecayRate = (((value >> 4) & 0x000f));
|
||||||
|
@ -962,12 +920,10 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// more channel info
|
// more channel info
|
||||||
if ((r >= 0x01c0 && r <= 0x02E0) || (r >= 0x05c0 && r <= 0x06E0))
|
if ((r >= 0x01c0 && r <= 0x02E0) || (r >= 0x05c0 && r <= 0x06E0)) {
|
||||||
{
|
|
||||||
s32 ch = 0;
|
s32 ch = 0;
|
||||||
u32 rx = r;
|
u32 rx = r;
|
||||||
if (rx >= 0x400)
|
if (rx >= 0x400) {
|
||||||
{
|
|
||||||
ch = 24;
|
ch = 24;
|
||||||
rx -= 0x400;
|
rx -= 0x400;
|
||||||
}
|
}
|
||||||
|
@ -976,8 +932,7 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
|
||||||
rx -= (ch % 24) * 12;
|
rx -= (ch % 24) * 12;
|
||||||
VOICE_PROCESSED* pvoice = &voices[ch];
|
VOICE_PROCESSED* pvoice = &voices[ch];
|
||||||
|
|
||||||
switch (rx)
|
switch (rx) {
|
||||||
{
|
|
||||||
case 0x1C0:
|
case 0x1C0:
|
||||||
pvoice->iStartAddr = (((u32)value & 0x3f) << 16) | (pvoice->iStartAddr & 0xFFFF);
|
pvoice->iStartAddr = (((u32)value & 0x3f) << 16) | (pvoice->iStartAddr & 0xFFFF);
|
||||||
pvoice->pStart = (u8*)(spu2mem + pvoice->iStartAddr);
|
pvoice->pStart = (u8*)(spu2mem + pvoice->iStartAddr);
|
||||||
|
@ -1010,19 +965,18 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// process non-channel data
|
// process non-channel data
|
||||||
switch (mem&0xffff)
|
switch (mem & 0xffff) {
|
||||||
{
|
|
||||||
case REG_C0_SPUDATA:
|
case REG_C0_SPUDATA:
|
||||||
spuaddr = C0_SPUADDR;
|
spuaddr = C0_SPUADDR;
|
||||||
spu2mem[spuaddr] = value;
|
spu2mem[spuaddr] = value;
|
||||||
spuaddr++;
|
spuaddr++;
|
||||||
if ((spu2Ru16(REG_C0_CTRL)&0x40) && C0_IRQA == spuaddr)
|
if ((spu2Ru16(REG_C0_CTRL) & 0x40) && C0_IRQA == spuaddr) {
|
||||||
{
|
|
||||||
spu2Ru16(SPDIF_OUT) |= 0x4;
|
spu2Ru16(SPDIF_OUT) |= 0x4;
|
||||||
IRQINFO |= 4;
|
IRQINFO |= 4;
|
||||||
irqCallbackSPU2();
|
irqCallbackSPU2();
|
||||||
}
|
}
|
||||||
if (spuaddr > 0xFFFFE) spuaddr = 0x2800;
|
if (spuaddr > 0xFFFFE)
|
||||||
|
spuaddr = 0x2800;
|
||||||
|
|
||||||
C0_SPUADDR_SET(spuaddr);
|
C0_SPUADDR_SET(spuaddr);
|
||||||
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80;
|
spu2Ru16(REG_C0_SPUSTAT) &= ~0x80;
|
||||||
|
@ -1032,13 +986,13 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
|
||||||
spuaddr = C1_SPUADDR;
|
spuaddr = C1_SPUADDR;
|
||||||
spu2mem[spuaddr] = value;
|
spu2mem[spuaddr] = value;
|
||||||
spuaddr++;
|
spuaddr++;
|
||||||
if ((spu2Ru16(REG_C1_CTRL)&0x40) && C1_IRQA == spuaddr)
|
if ((spu2Ru16(REG_C1_CTRL) & 0x40) && C1_IRQA == spuaddr) {
|
||||||
{
|
|
||||||
spu2Ru16(SPDIF_OUT) |= 0x8;
|
spu2Ru16(SPDIF_OUT) |= 0x8;
|
||||||
IRQINFO |= 8;
|
IRQINFO |= 8;
|
||||||
irqCallbackSPU2();
|
irqCallbackSPU2();
|
||||||
}
|
}
|
||||||
if (spuaddr > 0xFFFFE) spuaddr = 0x2800;
|
if (spuaddr > 0xFFFFE)
|
||||||
|
spuaddr = 0x2800;
|
||||||
|
|
||||||
C1_SPUADDR_SET(spuaddr);
|
C1_SPUADDR_SET(spuaddr);
|
||||||
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80;
|
spu2Ru16(REG_C1_SPUSTAT) &= ~0x80;
|
||||||
|
@ -1114,7 +1068,8 @@ EXPORT_C_(void) SPU2write(u32 mem, u16 value)
|
||||||
assert(C1_SPUADDR < 0x100000);
|
assert(C1_SPUADDR < 0x100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u16) SPU2read(u32 mem)
|
EXPORT_C_(u16)
|
||||||
|
SPU2read(u32 mem)
|
||||||
{
|
{
|
||||||
u32 spuaddr;
|
u32 spuaddr;
|
||||||
u16 ret;
|
u16 ret;
|
||||||
|
@ -1131,8 +1086,7 @@ EXPORT_C_(u16) SPU2read(u32 mem)
|
||||||
|
|
||||||
VOICE_PROCESSED* pvoice = &voices[ch];
|
VOICE_PROCESSED* pvoice = &voices[ch];
|
||||||
|
|
||||||
switch (r&0x0f)
|
switch (r & 0x0f) {
|
||||||
{
|
|
||||||
case 10:
|
case 10:
|
||||||
return (u16)(pvoice->ADSRX.EnvelopeVol >> 16);
|
return (u16)(pvoice->ADSRX.EnvelopeVol >> 16);
|
||||||
}
|
}
|
||||||
|
@ -1143,8 +1097,7 @@ EXPORT_C_(u16) SPU2read(u32 mem)
|
||||||
s32 ch = 0;
|
s32 ch = 0;
|
||||||
u32 rx = r;
|
u32 rx = r;
|
||||||
|
|
||||||
if (rx >= 0x400)
|
if (rx >= 0x400) {
|
||||||
{
|
|
||||||
ch = 24;
|
ch = 24;
|
||||||
rx -= 0x400;
|
rx -= 0x400;
|
||||||
}
|
}
|
||||||
|
@ -1153,8 +1106,7 @@ EXPORT_C_(u16) SPU2read(u32 mem)
|
||||||
rx -= (ch % 24) * 12;
|
rx -= (ch % 24) * 12;
|
||||||
VOICE_PROCESSED* pvoice = &voices[ch];
|
VOICE_PROCESSED* pvoice = &voices[ch];
|
||||||
|
|
||||||
switch (rx)
|
switch (rx) {
|
||||||
{
|
|
||||||
case 0x1C0:
|
case 0x1C0:
|
||||||
return (u16)(((pvoice->pStart - (u8*)spu2mem) >> 17) & 0x3F);
|
return (u16)(((pvoice->pStart - (u8*)spu2mem) >> 17) & 0x3F);
|
||||||
case 0x1C2:
|
case 0x1C2:
|
||||||
|
@ -1170,13 +1122,13 @@ EXPORT_C_(u16) SPU2read(u32 mem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mem&0xffff)
|
switch (mem & 0xffff) {
|
||||||
{
|
|
||||||
case REG_C0_SPUDATA:
|
case REG_C0_SPUDATA:
|
||||||
spuaddr = C0_SPUADDR;
|
spuaddr = C0_SPUADDR;
|
||||||
ret = spu2mem[spuaddr];
|
ret = spu2mem[spuaddr];
|
||||||
spuaddr++;
|
spuaddr++;
|
||||||
if (spuaddr > 0xfffff) spuaddr = 0;
|
if (spuaddr > 0xfffff)
|
||||||
|
spuaddr = 0;
|
||||||
C0_SPUADDR_SET(spuaddr);
|
C0_SPUADDR_SET(spuaddr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1184,7 +1136,8 @@ EXPORT_C_(u16) SPU2read(u32 mem)
|
||||||
spuaddr = C1_SPUADDR;
|
spuaddr = C1_SPUADDR;
|
||||||
ret = spu2mem[spuaddr];
|
ret = spu2mem[spuaddr];
|
||||||
spuaddr++;
|
spuaddr++;
|
||||||
if (spuaddr > 0xfffff) spuaddr = 0;
|
if (spuaddr > 0xfffff)
|
||||||
|
spuaddr = 0;
|
||||||
C1_SPUADDR_SET(spuaddr);
|
C1_SPUADDR_SET(spuaddr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1210,17 +1163,20 @@ EXPORT_C_(u16) SPU2read(u32 mem)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2WriteMemAddr(int core, u32 value)
|
EXPORT_C_(void)
|
||||||
|
SPU2WriteMemAddr(int core, u32 value)
|
||||||
{
|
{
|
||||||
MemAddr[core] = value;
|
MemAddr[core] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(u32) SPU2ReadMemAddr(int core)
|
EXPORT_C_(u32)
|
||||||
|
SPU2ReadMemAddr(int core)
|
||||||
{
|
{
|
||||||
return MemAddr[core];
|
return MemAddr[core];
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C_(void) SPU2irqCallback(void (*SPU2callback)(), void (*DMA4callback)(), void (*DMA7callback)())
|
EXPORT_C_(void)
|
||||||
|
SPU2irqCallback(void (*SPU2callback)(), void (*DMA4callback)(), void (*DMA7callback)())
|
||||||
{
|
{
|
||||||
irqCallbackSPU2 = SPU2callback;
|
irqCallbackSPU2 = SPU2callback;
|
||||||
irqCallbackDMA4 = DMA4callback;
|
irqCallbackDMA4 = DMA4callback;
|
||||||
|
@ -1240,13 +1196,14 @@ void VOICE_PROCESSED::SetVolume(int iProcessRight)
|
||||||
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) sInc = -1; // -> or down?
|
if (vol & 0x2000)
|
||||||
if (vol&0x1000) vol ^= 0xffff; // -> mmm... phase inverted? have to investigate this
|
sInc = -1; // -> or down?
|
||||||
|
if (vol & 0x1000)
|
||||||
|
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);
|
||||||
|
@ -1264,8 +1221,7 @@ void VOICE_PROCESSED::StartSound()
|
||||||
ADSRX.State = 0;
|
ADSRX.State = 0;
|
||||||
ADSRX.EnvelopeVol = 0;
|
ADSRX.EnvelopeVol = 0;
|
||||||
|
|
||||||
if (bReverb && GetCtrl()->reverb)
|
if (bReverb && GetCtrl()->reverb) {
|
||||||
{
|
|
||||||
// setup the reverb effects
|
// setup the reverb effects
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1291,7 +1247,8 @@ void VOICE_PROCESSED::Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GUI Routines
|
// GUI Routines
|
||||||
EXPORT_C_(s32) SPU2test()
|
EXPORT_C_(s32)
|
||||||
|
SPU2test()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1302,35 +1259,25 @@ typedef struct
|
||||||
u8 spu2regs[0x10000];
|
u8 spu2regs[0x10000];
|
||||||
} SPU2freezeData;
|
} SPU2freezeData;
|
||||||
|
|
||||||
EXPORT_C_(s32) SPU2freeze(int mode, freezeData *data)
|
EXPORT_C_(s32)
|
||||||
|
SPU2freeze(int mode, freezeData* data)
|
||||||
{
|
{
|
||||||
SPU2freezeData* spud;
|
SPU2freezeData* spud;
|
||||||
|
|
||||||
if (mode == FREEZE_LOAD)
|
if (mode == FREEZE_LOAD) {
|
||||||
{
|
|
||||||
spud = (SPU2freezeData*)data->data;
|
spud = (SPU2freezeData*)data->data;
|
||||||
if (spud->version == 0x11223344)
|
if (spud->version == 0x11223344) {
|
||||||
{
|
|
||||||
memcpy(spu2regs, spud->spu2regs, 0x10000);
|
memcpy(spu2regs, spud->spu2regs, 0x10000);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("SPU2null wrong format\n");
|
printf("SPU2null wrong format\n");
|
||||||
}
|
}
|
||||||
}
|
} else if (mode == FREEZE_SAVE) {
|
||||||
else
|
|
||||||
if (mode == FREEZE_SAVE)
|
|
||||||
{
|
|
||||||
spud = (SPU2freezeData*)data->data;
|
spud = (SPU2freezeData*)data->data;
|
||||||
spud->version = 0x11223344;
|
spud->version = 0x11223344;
|
||||||
memcpy(spud->spu2regs, spu2regs, 0x10000);
|
memcpy(spud->spu2regs, spu2regs, 0x10000);
|
||||||
}
|
} else if (mode == FREEZE_SIZE) {
|
||||||
else
|
|
||||||
if (mode == FREEZE_SIZE)
|
|
||||||
{
|
|
||||||
data->size = sizeof(SPU2freezeData);
|
data->size = sizeof(SPU2freezeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#define SPU2defs
|
#define SPU2defs
|
||||||
#include "PS2Edefs.h"
|
#include "PS2Edefs.h"
|
||||||
}
|
}
|
||||||
|
@ -143,10 +142,11 @@ void SysMessage(char *fmt, ...);
|
||||||
#define IRQINFO spu2Ru16(REG_IRQINFO)
|
#define IRQINFO spu2Ru16(REG_IRQINFO)
|
||||||
|
|
||||||
#define SPU2_GET32BIT(lo, hi) (((u32)(spu2Ru16(hi) & 0x3f) << 16) | (u32)spu2Ru16(lo))
|
#define SPU2_GET32BIT(lo, hi) (((u32)(spu2Ru16(hi) & 0x3f) << 16) | (u32)spu2Ru16(lo))
|
||||||
#define SPU2_SET32BIT(value, lo, hi) { \
|
#define SPU2_SET32BIT(value, lo, hi) \
|
||||||
|
{ \
|
||||||
spu2Ru16(hi) = ((value) >> 16) & 0x3f; \
|
spu2Ru16(hi) = ((value) >> 16) & 0x3f; \
|
||||||
spu2Ru16(lo) = (value)&0xffff; \
|
spu2Ru16(lo) = (value)&0xffff; \
|
||||||
} \
|
}
|
||||||
|
|
||||||
#define C0_IRQA SPU2_GET32BIT(REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
#define C0_IRQA SPU2_GET32BIT(REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
||||||
#define C1_IRQA SPU2_GET32BIT(REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
#define C1_IRQA SPU2_GET32BIT(REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
||||||
|
@ -178,12 +178,14 @@ struct _SPU_VOICE
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
u16 Vol : 14;
|
u16 Vol : 14;
|
||||||
u16 Inverted : 1;
|
u16 Inverted : 1;
|
||||||
u16 Sweep0 : 1;
|
u16 Sweep0 : 1;
|
||||||
} vol;
|
} vol;
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
u16 Vol : 7;
|
u16 Vol : 7;
|
||||||
u16 res1 : 5;
|
u16 res1 : 5;
|
||||||
u16 Inverted : 1;
|
u16 Inverted : 1;
|
||||||
|
|
|
@ -28,14 +28,15 @@ void SaveConfig()
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return;
|
if (!szTemp)
|
||||||
|
return;
|
||||||
strcpy(szTemp, "\\inis\\spu2null.ini");
|
strcpy(szTemp, "\\inis\\spu2null.ini");
|
||||||
sprintf(szValue, "%u", Conf1->Log);
|
sprintf(szValue, "%u", Conf1->Log);
|
||||||
WritePrivateProfileString("Interface", "Logging", szValue, szIniFile);
|
WritePrivateProfileString("Interface", "Logging", szValue, szIniFile);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig() {
|
void LoadConfig()
|
||||||
|
{
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,11 +47,11 @@ void LoadConfig() {
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return ;
|
if (!szTemp)
|
||||||
|
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
|
||||||
|
@ -61,6 +62,4 @@ void LoadConfig() {
|
||||||
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
|
||||||
Conf1->Log = strtoul(szValue, NULL, 10);
|
Conf1->Log = strtoul(szValue, NULL, 10);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
|
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
|
||||||
void SysMessage(char *fmt, ...) {
|
void SysMessage(char* fmt, ...)
|
||||||
|
{
|
||||||
va_list list;
|
va_list list;
|
||||||
char tmp[512];
|
char tmp[512];
|
||||||
|
|
||||||
|
@ -32,12 +33,14 @@ void SysMessage(char *fmt, ...) {
|
||||||
MessageBox(0, tmp, "SPU2NULL Msg", 0);
|
MessageBox(0, tmp, "SPU2NULL Msg", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
if (conf.Log) CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
if (conf.Log)
|
||||||
|
CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
|
@ -48,7 +51,8 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case IDOK:
|
case IDOK:
|
||||||
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
if (IsDlgButtonChecked(hW, IDC_LOGGING))
|
||||||
conf.Log = 1;
|
conf.Log = 1;
|
||||||
else conf.Log = 0;
|
else
|
||||||
|
conf.Log = 0;
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -57,7 +61,8 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -72,15 +77,16 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK SPU2configure() {
|
void CALLBACK SPU2configure()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_CONFIG),
|
MAKEINTRESOURCE(IDD_CONFIG),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
(DLGPROC)ConfigureDlgProc);
|
(DLGPROC)ConfigureDlgProc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK SPU2about() {
|
void CALLBACK SPU2about()
|
||||||
|
{
|
||||||
DialogBox(hInst,
|
DialogBox(hInst,
|
||||||
MAKEINTRESOURCE(IDD_ABOUT),
|
MAKEINTRESOURCE(IDD_ABOUT),
|
||||||
GetActiveWindow(),
|
GetActiveWindow(),
|
||||||
|
@ -89,8 +95,8 @@ void CALLBACK SPU2about() {
|
||||||
|
|
||||||
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 :)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue