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,10 +42,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
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,17 +38,17 @@ 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
|
||||||
{
|
{
|
||||||
|
@ -58,10 +57,10 @@ typedef struct
|
||||||
|
|
||||||
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 //
|
||||||
|
@ -135,18 +134,19 @@ void SysMessage(char *fmt, ...);
|
||||||
#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(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;
|
||||||
|
@ -192,7 +194,7 @@ struct _SPU_VOICE
|
||||||
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;
|
||||||
|
@ -234,7 +236,7 @@ struct ADSRInfoEx
|
||||||
#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
|
||||||
{
|
{
|
||||||
|
@ -275,14 +277,14 @@ struct VOICE_PROCESSED
|
||||||
// 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;
|
||||||
|
|
|
@ -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;
|
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;
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
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);
|
||||||
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,33 +22,37 @@
|
||||||
|
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
|
||||||
void SysMessage(char *fmt, ...) {
|
void SysMessage(char* fmt, ...)
|
||||||
|
{
|
||||||
va_list list;
|
va_list list;
|
||||||
char tmp[512];
|
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)
|
||||||
|
CheckDlgButton(hW, IDC_LOGGING, TRUE);
|
||||||
return 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
|
||||||
|
conf.Log = 0;
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
EndDialog(hW, FALSE);
|
EndDialog(hW, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -57,13 +61,14 @@ 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;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -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