mirror of https://github.com/PCSX2/pcsx2.git
SPU2null reformat
This commit is contained in:
parent
67e7d63f0f
commit
e3a2ad03bc
|
@ -23,44 +23,44 @@ 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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
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;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
conf.Log = Ini.ReadInt("logging", 0);
|
conf.Log = Ini.ReadInt("logging", 0);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveConfig()
|
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;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ini.WriteInt("logging", conf.Log);
|
Ini.WriteInt("logging", conf.Log);
|
||||||
Ini.Close();
|
Ini.Close();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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"
|
||||||
}
|
}
|
||||||
|
@ -39,114 +38,115 @@ extern "C"
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
|
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
|
||||||
#else
|
#else
|
||||||
#define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type
|
#define EXPORT_C_(type) extern "C" __attribute__((stdcall, externally_visible, visibility("default"))) type
|
||||||
#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;
|
||||||
extern const u8 build;
|
extern const u8 build;
|
||||||
extern const u32 minor;
|
extern const u32 minor;
|
||||||
extern char *libraryName;
|
extern char* libraryName;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
s32 Log;
|
s32 Log;
|
||||||
} Config;
|
} Config;
|
||||||
|
|
||||||
extern Config conf;
|
extern Config conf;
|
||||||
|
|
||||||
void __Log(char *fmt, ...);
|
void __Log(char* fmt, ...);
|
||||||
void SaveConfig();
|
void SaveConfig();
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
void SysMessage(char *fmt, ...);
|
void SysMessage(char* fmt, ...);
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// SPU2 Registers //
|
// SPU2 Registers //
|
||||||
////////////////////
|
////////////////////
|
||||||
#define REG_VP_VOLL 0x0000
|
#define REG_VP_VOLL 0x0000
|
||||||
#define REG_VP_VOLR 0x0002
|
#define REG_VP_VOLR 0x0002
|
||||||
#define REG_VP_PITCH 0x0004
|
#define REG_VP_PITCH 0x0004
|
||||||
#define REG_VP_ADSR1 0x0006
|
#define REG_VP_ADSR1 0x0006
|
||||||
#define REG_VP_ADSR2 0x0008
|
#define REG_VP_ADSR2 0x0008
|
||||||
#define REG_VP_ENVX 0x000A
|
#define REG_VP_ENVX 0x000A
|
||||||
#define REG_VP_VOLXL 0x000C
|
#define REG_VP_VOLXL 0x000C
|
||||||
#define REG_VP_VOLXR 0x000E
|
#define REG_VP_VOLXR 0x000E
|
||||||
#define REG_C0_FMOD1 0x0180
|
#define REG_C0_FMOD1 0x0180
|
||||||
#define REG_C0_FMOD2 0x0182
|
#define REG_C0_FMOD2 0x0182
|
||||||
#define REG_C1_FMOD1 0x0580
|
#define REG_C1_FMOD1 0x0580
|
||||||
#define REG_C1_FMOD2 0x0582
|
#define REG_C1_FMOD2 0x0582
|
||||||
#define REG_S_NON 0x0184
|
#define REG_S_NON 0x0184
|
||||||
#define REG_S_VMIXL 0x0188
|
#define REG_S_VMIXL 0x0188
|
||||||
#define REG_S_VMIXEL 0x018C
|
#define REG_S_VMIXEL 0x018C
|
||||||
#define REG_S_VMIXR 0x0190
|
#define REG_S_VMIXR 0x0190
|
||||||
#define REG_S_VMIXER 0x0194
|
#define REG_S_VMIXER 0x0194
|
||||||
#define REG_C0_MMIX 0x0198
|
#define REG_C0_MMIX 0x0198
|
||||||
#define REG_C1_MMIX 0x0598
|
#define REG_C1_MMIX 0x0598
|
||||||
#define REG_C0_CTRL 0x019A
|
#define REG_C0_CTRL 0x019A
|
||||||
#define REG_C0_IRQA_HI 0x019C
|
#define REG_C0_IRQA_HI 0x019C
|
||||||
#define REG_C0_IRQA_LO 0x019D
|
#define REG_C0_IRQA_LO 0x019D
|
||||||
#define REG_C1_IRQA_HI 0x059C
|
#define REG_C1_IRQA_HI 0x059C
|
||||||
#define REG_C1_IRQA_LO 0x059D
|
#define REG_C1_IRQA_LO 0x059D
|
||||||
#define REG_C0_SPUON1 0x1A0
|
#define REG_C0_SPUON1 0x1A0
|
||||||
#define REG_C0_SPUON2 0x1A2
|
#define REG_C0_SPUON2 0x1A2
|
||||||
#define REG_C1_SPUON1 0x5A0
|
#define REG_C1_SPUON1 0x5A0
|
||||||
#define REG_C1_SPUON2 0x5A2
|
#define REG_C1_SPUON2 0x5A2
|
||||||
#define REG_C0_SPUOFF1 0x1A4
|
#define REG_C0_SPUOFF1 0x1A4
|
||||||
#define REG_C0_SPUOFF2 0x1A6
|
#define REG_C0_SPUOFF2 0x1A6
|
||||||
#define REG_C1_SPUOFF1 0x5A4
|
#define REG_C1_SPUOFF1 0x5A4
|
||||||
#define REG_C1_SPUOFF2 0x5A6
|
#define REG_C1_SPUOFF2 0x5A6
|
||||||
#define REG_C0_SPUADDR_HI 0x01A8
|
#define REG_C0_SPUADDR_HI 0x01A8
|
||||||
#define REG_C0_SPUADDR_LO 0x01AA
|
#define REG_C0_SPUADDR_LO 0x01AA
|
||||||
#define REG_C1_SPUADDR_HI 0x05A8
|
#define REG_C1_SPUADDR_HI 0x05A8
|
||||||
#define REG_C1_SPUADDR_LO 0x05AA
|
#define REG_C1_SPUADDR_LO 0x05AA
|
||||||
#define REG_C0_SPUDATA 0x01AC
|
#define REG_C0_SPUDATA 0x01AC
|
||||||
#define REG_C1_SPUDATA 0x05AC
|
#define REG_C1_SPUDATA 0x05AC
|
||||||
#define REG_C0_DMACTRL 0x01AE
|
#define REG_C0_DMACTRL 0x01AE
|
||||||
#define REG_C1_DMACTRL 0x05AE
|
#define REG_C1_DMACTRL 0x05AE
|
||||||
#define REG_C0_ADMAS 0x01B0
|
#define REG_C0_ADMAS 0x01B0
|
||||||
#define REG_VA_SSA 0x01C0
|
#define REG_VA_SSA 0x01C0
|
||||||
#define REG_VA_LSAX 0x01C4
|
#define REG_VA_LSAX 0x01C4
|
||||||
#define REG_VA_NAX 0x01C8
|
#define REG_VA_NAX 0x01C8
|
||||||
#define REG_A_ESA 0x02E0
|
#define REG_A_ESA 0x02E0
|
||||||
#define REG_A_EEA 0x033C
|
#define REG_A_EEA 0x033C
|
||||||
#define REG_C0_END1 0x0340
|
#define REG_C0_END1 0x0340
|
||||||
#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
|
||||||
#define REG_P_EVOLR 0x0766
|
#define REG_P_EVOLR 0x0766
|
||||||
#define REG_P_AVOLL 0x0768
|
#define REG_P_AVOLL 0x0768
|
||||||
#define REG_P_AVOLR 0x076A
|
#define REG_P_AVOLR 0x076A
|
||||||
#define REG_P_BVOLL 0x076C
|
#define REG_P_BVOLL 0x076C
|
||||||
#define REG_P_BVOLR 0x076E
|
#define REG_P_BVOLR 0x076E
|
||||||
#define REG_P_MVOLXL 0x0770
|
#define REG_P_MVOLXL 0x0770
|
||||||
#define REG_P_MVOLXR 0x0772
|
#define REG_P_MVOLXR 0x0772
|
||||||
#define SPDIF_OUT 0x07C0
|
#define SPDIF_OUT 0x07C0
|
||||||
#define REG_IRQINFO 0x07C2
|
#define REG_IRQINFO 0x07C2
|
||||||
#define SPDIF_MODE 0x07C6
|
#define SPDIF_MODE 0x07C6
|
||||||
#define SPDIF_MEDIA 0x07C8
|
#define SPDIF_MEDIA 0x07C8
|
||||||
|
|
||||||
#define spu2Rs16(mem) (*(s16*)&spu2regs[(mem) & 0xffff])
|
#define spu2Rs16(mem) (*(s16*)&spu2regs[(mem)&0xffff])
|
||||||
#define spu2Ru16(mem) (*(u16*)&spu2regs[(mem) & 0xffff])
|
#define spu2Ru16(mem) (*(u16*)&spu2regs[(mem)&0xffff])
|
||||||
//#define spu2Rs32(mem) (*(s32*)&spu2regs[(mem) & 0xffff])
|
//#define spu2Rs32(mem) (*(s32*)&spu2regs[(mem) & 0xffff])
|
||||||
//#define spu2Ru32(mem) (*(u32*)&spu2regs[(mem) & 0xffff])
|
//#define spu2Ru32(mem) (*(u32*)&spu2regs[(mem) & 0xffff])
|
||||||
|
|
||||||
#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(lo) = (value)&0xffff; \
|
spu2Ru16(hi) = ((value) >> 16) & 0x3f; \
|
||||||
} \
|
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)
|
||||||
|
@ -157,20 +157,20 @@ void SysMessage(char *fmt, ...);
|
||||||
#define C0_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
#define C0_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C0_IRQA_LO, REG_C0_IRQA_HI)
|
||||||
#define C1_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
#define C1_SPUADDR_SET(value) SPU2_SET32BIT(value, REG_C1_IRQA_LO, REG_C1_IRQA_HI)
|
||||||
|
|
||||||
#define SPU_NUMBER_VOICES 48
|
#define SPU_NUMBER_VOICES 48
|
||||||
|
|
||||||
struct SPU_CONTROL_
|
struct SPU_CONTROL_
|
||||||
{
|
{
|
||||||
u16 spuon : 1;
|
u16 spuon : 1;
|
||||||
u16 spuUnmute : 1;
|
u16 spuUnmute : 1;
|
||||||
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
// the layout of each voice in wSpuRegs
|
// the layout of each voice in wSpuRegs
|
||||||
|
@ -178,115 +178,117 @@ struct _SPU_VOICE
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct {
|
struct
|
||||||
u16 Vol : 14;
|
{
|
||||||
u16 Inverted : 1;
|
u16 Vol : 14;
|
||||||
u16 Sweep0 : 1;
|
u16 Inverted : 1;
|
||||||
|
u16 Sweep0 : 1;
|
||||||
} vol;
|
} vol;
|
||||||
struct {
|
struct
|
||||||
u16 Vol : 7;
|
{
|
||||||
u16 res1 : 5;
|
u16 Vol : 7;
|
||||||
u16 Inverted : 1;
|
u16 res1 : 5;
|
||||||
u16 Decrease : 1; // if 0, increase
|
u16 Inverted : 1;
|
||||||
u16 ExpSlope : 1; // if 0, linear slope
|
u16 Decrease : 1; // if 0, increase
|
||||||
u16 Sweep1 : 1; // always one
|
u16 ExpSlope : 1; // if 0, linear slope
|
||||||
} sweep;
|
u16 Sweep1 : 1; // always one
|
||||||
u16 word;
|
} sweep;
|
||||||
} left, right;
|
u16 word;
|
||||||
|
} 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
|
||||||
struct ADSRInfoEx
|
struct ADSRInfoEx
|
||||||
{
|
{
|
||||||
s32 State;
|
s32 State;
|
||||||
s32 AttackModeExp;
|
s32 AttackModeExp;
|
||||||
s32 AttackRate;
|
s32 AttackRate;
|
||||||
s32 DecayRate;
|
s32 DecayRate;
|
||||||
s32 SustainLevel;
|
s32 SustainLevel;
|
||||||
s32 SustainModeExp;
|
s32 SustainModeExp;
|
||||||
s32 SustainIncrease;
|
s32 SustainIncrease;
|
||||||
s32 SustainRate;
|
s32 SustainRate;
|
||||||
s32 ReleaseModeExp;
|
s32 ReleaseModeExp;
|
||||||
s32 ReleaseRate;
|
s32 ReleaseRate;
|
||||||
s32 EnvelopeVol;
|
s32 EnvelopeVol;
|
||||||
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*))
|
||||||
|
|
||||||
struct VOICE_PROCESSED
|
struct VOICE_PROCESSED
|
||||||
{
|
{
|
||||||
VOICE_PROCESSED()
|
VOICE_PROCESSED()
|
||||||
{
|
{
|
||||||
memset(this, 0, sizeof(VOICE_PROCESSED));
|
memset(this, 0, sizeof(VOICE_PROCESSED));
|
||||||
}
|
}
|
||||||
~VOICE_PROCESSED()
|
~VOICE_PROCESSED()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVolume(int right);
|
void SetVolume(int right);
|
||||||
void StartSound();
|
void StartSound();
|
||||||
void VoiceChangeFrequency();
|
void VoiceChangeFrequency();
|
||||||
void FModChangeFrequency(int ns);
|
void FModChangeFrequency(int ns);
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
SPU_CONTROL_* GetCtrl();
|
SPU_CONTROL_* GetCtrl();
|
||||||
|
|
||||||
// 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ADMA
|
struct ADMA
|
||||||
{
|
{
|
||||||
u16 * MemAddr;
|
u16* MemAddr;
|
||||||
s32 IntPointer;
|
s32 IntPointer;
|
||||||
s32 Index;
|
s32 Index;
|
||||||
s32 AmountLeft;
|
s32 AmountLeft;
|
||||||
s32 Enabled;
|
s32 Enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __SPU2_H__ */
|
#endif /* __SPU2_H__ */
|
||||||
|
|
|
@ -21,46 +21,45 @@ extern HINSTANCE hInst;
|
||||||
void SaveConfig()
|
void SaveConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return;
|
|
||||||
strcpy(szTemp, "\\inis\\spu2null.ini");
|
|
||||||
sprintf(szValue,"%u",Conf1->Log);
|
|
||||||
WritePrivateProfileString("Interface", "Logging",szValue,szIniFile);
|
|
||||||
|
|
||||||
|
if (!szTemp)
|
||||||
|
return;
|
||||||
|
strcpy(szTemp, "\\inis\\spu2null.ini");
|
||||||
|
sprintf(szValue, "%u", Conf1->Log);
|
||||||
|
WritePrivateProfileString("Interface", "Logging", szValue, szIniFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig() {
|
void LoadConfig()
|
||||||
FILE *fp;
|
{
|
||||||
|
FILE* fp;
|
||||||
|
|
||||||
|
|
||||||
Config *Conf1 = &conf;
|
Config* Conf1 = &conf;
|
||||||
char *szTemp;
|
char* szTemp;
|
||||||
char szIniFile[256], szValue[256];
|
char szIniFile[256], szValue[256];
|
||||||
|
|
||||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||||
szTemp = strrchr(szIniFile, '\\');
|
szTemp = strrchr(szIniFile, '\\');
|
||||||
|
|
||||||
if(!szTemp) return ;
|
if (!szTemp)
|
||||||
strcpy(szTemp, "\\inis\\spu2null.ini");
|
return;
|
||||||
fp=fopen("inis\\usbnull.ini","rt");//check if usbnull.ini really exists
|
strcpy(szTemp, "\\inis\\spu2null.ini");
|
||||||
if (!fp)
|
fp = fopen("inis\\usbnull.ini", "rt"); //check if usbnull.ini really exists
|
||||||
{
|
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);
|
||||||
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,75 +22,81 @@
|
||||||
|
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
|
||||||
void SysMessage(char *fmt, ...) {
|
void SysMessage(char* fmt, ...)
|
||||||
va_list list;
|
{
|
||||||
char tmp[512];
|
va_list list;
|
||||||
|
char tmp[512];
|
||||||
|
|
||||||
va_start(list,fmt);
|
va_start(list, fmt);
|
||||||
vsprintf(tmp,fmt,list);
|
vsprintf(tmp, fmt, list);
|
||||||
va_end(list);
|
va_end(list);
|
||||||
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)
|
||||||
return TRUE;
|
CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hW, TRUE);
|
EndDialog(hW, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
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
|
||||||
SaveConfig();
|
conf.Log = 0;
|
||||||
EndDialog(hW, FALSE);
|
SaveConfig();
|
||||||
return TRUE;
|
EndDialog(hW, FALSE);
|
||||||
}
|
return TRUE;
|
||||||
}
|
}
|
||||||
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) {
|
{
|
||||||
case WM_INITDIALOG:
|
switch (uMsg) {
|
||||||
return TRUE;
|
case WM_INITDIALOG:
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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(),
|
||||||
(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;
|
{
|
||||||
return TRUE; // very quick :)
|
hInst = (HINSTANCE)hModule;
|
||||||
|
return TRUE; // very quick :)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue