[Audio] Add Audio.rdb

This commit is contained in:
zilmar 2017-09-27 06:55:53 +10:00
parent 5d3b72ce5a
commit 8d60ef1992
10 changed files with 123 additions and 51 deletions

1
Config/Audio.rdb Normal file
View File

@ -0,0 +1 @@
// ============ Audio RDB for Project64 ====================================

View File

@ -1,4 +1,4 @@
// ============ Glide RDB for PJ64 v2.2 ====================================
// ============ Video RDB for Project64 ====================================
// UCODE:
// These are ucode crcs used in the uCode detector.
// If a crc is not found here, the plugin will ask you

View File

@ -24,7 +24,8 @@ Filename: "{app}\Project64.exe"; Description: "{cm:LaunchProgram,{#StringChange(
[Files]
Source: "{#BaseDir}\Bin\{#Configuration}\Project64.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#BaseDir}\Config\Project64Video.rdb"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Video.rdb"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Audio.rdb"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Project64.cht"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Project64.rdb"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Project64.rdx"; DestDir: "{app}\Config"

View File

@ -73,7 +73,7 @@ void CSettings::RegisterSettings(void)
m_Set_log_flush = FindSystemSettingId("Log Auto Flush");
m_Set_log_dir = FindSystemSettingId("Dir:Log");
SetModuleName("Project64-Audio");
SetModuleName("Audio");
RegisterSetting(Set_Volume, Data_DWORD_General, "Volume", "Settings", 100, NULL);
RegisterSetting(Set_Logging_MD5, Data_DWORD_General, "MD5", "Logging", g_ModuleLogLevel[TraceMD5], NULL);
RegisterSetting(Set_Logging_Thread, Data_DWORD_General, "Thread", "Logging", g_ModuleLogLevel[TraceThread], NULL);

View File

@ -13,6 +13,7 @@
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;
CIniFile * CSettingTypeRomDatabase::m_VideoIniFile = NULL;
CIniFile * CSettingTypeRomDatabase::m_AudioIniFile = NULL;
stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL;
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault) :
@ -21,7 +22,8 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, int DefaultV
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault),
m_VideoSetting(IsVideoSetting(Name))
m_VideoSetting(IsVideoSetting(Name)),
m_AudioSetting(IsAudioSetting(Name))
{
}
@ -31,7 +33,8 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, bool Default
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault),
m_VideoSetting(IsVideoSetting(Name))
m_VideoSetting(IsVideoSetting(Name)),
m_AudioSetting(IsAudioSetting(Name))
{
}
@ -41,7 +44,8 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, const char *
m_DefaultValue(0),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault),
m_VideoSetting(IsVideoSetting(Name))
m_VideoSetting(IsVideoSetting(Name)),
m_AudioSetting(IsAudioSetting(Name))
{
}
@ -51,7 +55,8 @@ CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, SettingID De
m_DefaultValue(0),
m_DefaultSetting(DefaultSetting),
m_DeleteOnDefault(DeleteOnDefault),
m_VideoSetting(IsVideoSetting(Name))
m_VideoSetting(IsVideoSetting(Name)),
m_AudioSetting(IsAudioSetting(Name))
{
}
@ -64,7 +69,8 @@ void CSettingTypeRomDatabase::Initialize(void)
WriteTrace(TraceAppInit, TraceDebug, "Start");
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Project64VideoRDB).c_str());
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_VideoRDB).c_str());
m_AudioIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_AudioRDB).c_str());
g_Settings->RegisterChangeCB(Game_IniKey, NULL, GameChanged);
g_Settings->RegisterChangeCB(Cmd_BaseDirectory, NULL, BaseDirChanged);
@ -87,6 +93,11 @@ void CSettingTypeRomDatabase::CleanUp(void)
delete m_VideoIniFile;
m_VideoIniFile = NULL;
}
if (m_AudioIniFile)
{
delete m_AudioIniFile;
m_AudioIniFile = NULL;
}
if (m_SectionIdent)
{
delete m_SectionIdent;
@ -106,8 +117,14 @@ void CSettingTypeRomDatabase::BaseDirChanged(void * /*Data */)
delete m_VideoIniFile;
m_VideoIniFile = NULL;
}
if (m_AudioIniFile)
{
delete m_AudioIniFile;
m_AudioIniFile = NULL;
}
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Project64VideoRDB).c_str());
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_VideoRDB).c_str());
m_AudioIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_AudioRDB).c_str());
}
void CSettingTypeRomDatabase::GameChanged(void * /*Data */)
@ -133,6 +150,10 @@ bool CSettingTypeRomDatabase::Load(int Index, uint32_t & Value) const
{
bRes = m_VideoIniFile->GetNumber(Section(), m_KeyName.c_str(), Value, Value);
}
else if (m_AudioSetting)
{
bRes = m_AudioIniFile->GetNumber(Section(), m_KeyName.c_str(), Value, Value);
}
else
{
bRes = m_SettingsIniFile->GetNumber(Section(), m_KeyName.c_str(), Value, Value);
@ -152,6 +173,10 @@ bool CSettingTypeRomDatabase::Load(int Index, stdstr & Value) const
{
bRes = m_VideoIniFile->GetString(Section(), m_KeyName.c_str(), m_DefaultStr, temp_value);
}
else if (m_AudioSetting)
{
bRes = m_AudioIniFile->GetString(Section(), m_KeyName.c_str(), m_DefaultStr, temp_value);
}
else
{
bRes = m_SettingsIniFile->GetString(Section(), m_KeyName.c_str(), m_DefaultStr, temp_value);
@ -225,6 +250,10 @@ void CSettingTypeRomDatabase::Save(int /*Index*/, bool Value)
{
m_VideoIniFile->SaveNumber(Section(), m_KeyName.c_str(), Value);
}
else if (m_AudioSetting)
{
m_AudioIniFile->SaveNumber(Section(), m_KeyName.c_str(), Value);
}
else
{
m_SettingsIniFile->SaveNumber(Section(), m_KeyName.c_str(), Value);
@ -251,6 +280,10 @@ void CSettingTypeRomDatabase::Save(int Index, uint32_t Value)
{
m_VideoIniFile->SaveNumber(Section(), m_KeyName.c_str(), Value);
}
else if (m_AudioSetting)
{
m_AudioIniFile->SaveNumber(Section(), m_KeyName.c_str(), Value);
}
else
{
m_SettingsIniFile->SaveNumber(Section(), m_KeyName.c_str(), Value);
@ -267,6 +300,10 @@ void CSettingTypeRomDatabase::Save(int /*Index*/, const stdstr & Value)
{
m_VideoIniFile->SaveString(Section(), m_KeyName.c_str(), Value.c_str());
}
else if (m_AudioSetting)
{
m_AudioIniFile->SaveString(Section(), m_KeyName.c_str(), Value.c_str());
}
else
{
m_SettingsIniFile->SaveString(Section(), m_KeyName.c_str(), Value.c_str());
@ -283,6 +320,10 @@ void CSettingTypeRomDatabase::Save(int /*Index*/, const char * Value)
{
m_VideoIniFile->SaveString(Section(), m_KeyName.c_str(), Value);
}
else if (m_AudioSetting)
{
m_AudioIniFile->SaveString(Section(), m_KeyName.c_str(), Value);
}
else
{
m_SettingsIniFile->SaveString(Section(), m_KeyName.c_str(), Value);
@ -299,6 +340,10 @@ void CSettingTypeRomDatabase::Delete(int /*Index*/)
{
m_VideoIniFile->SaveString(Section(), m_KeyName.c_str(), NULL);
}
else if (m_AudioSetting)
{
m_AudioIniFile->SaveString(Section(), m_KeyName.c_str(), NULL);
}
else
{
m_SettingsIniFile->SaveString(Section(), m_KeyName.c_str(), NULL);
@ -314,11 +359,24 @@ bool CSettingTypeRomDatabase::IsVideoSetting(const char * Name)
return false;
}
bool CSettingTypeRomDatabase::IsAudioSetting(const char * Name)
{
if (_strnicmp(Name, "Audio-", 6) == 0)
{
return true;
}
return false;
}
const char * CSettingTypeRomDatabase::StripNameSection(const char * Name)
{
if (_strnicmp(Name, "Video-", 6) == 0)
{
return &Name[6];
}
if (_strnicmp(Name, "Audio-", 6) == 0)
{
return &Name[6];
}
return Name;
}

View File

@ -55,6 +55,7 @@ protected:
static void BaseDirChanged(void * /*Data */);
static bool IsVideoSetting(const char * Name);
static bool IsAudioSetting(const char * Name);
static const char * StripNameSection(const char * Name);
virtual const char * Section(void) const { return m_SectionIdent->c_str(); }
@ -64,10 +65,12 @@ protected:
const SettingID m_DefaultSetting;
const bool m_DeleteOnDefault;
bool m_VideoSetting;
bool m_AudioSetting;
static stdstr * m_SectionIdent;
static CIniFile * m_SettingsIniFile;
static CIniFile * m_VideoIniFile;
static CIniFile * m_AudioIniFile;
private:
CSettingTypeRomDatabase(); // Disable default constructor

View File

@ -11,54 +11,58 @@
#include "stdafx.h"
#include "SettingsType-RomDatabaseSetting.h"
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, int DefaultValue, bool DeleteOnDefault ) :
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
m_SectionIdent(SectionIdent)
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, int DefaultValue, bool DeleteOnDefault) :
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
m_SectionIdent(SectionIdent)
{
m_SectionIdent.Replace("\\","-");
if (!m_VideoSetting)
{
m_VideoSetting = IsVideoSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
m_SectionIdent.Replace("\\", "-");
if (!m_VideoSetting || !m_AudioSetting)
{
m_VideoSetting = IsVideoSetting(m_SectionIdent.c_str());
m_AudioSetting = IsAudioSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
}
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
m_SectionIdent(SectionIdent)
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, bool DefaultValue, bool DeleteOnDefault) :
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
m_SectionIdent(SectionIdent)
{
m_SectionIdent.Replace("\\","-");
if (!m_VideoSetting)
{
m_VideoSetting = IsVideoSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
m_SectionIdent.Replace("\\", "-");
if (!m_VideoSetting || !m_AudioSetting)
{
m_VideoSetting = IsVideoSetting(m_SectionIdent.c_str());
m_AudioSetting = IsAudioSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
}
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
m_SectionIdent(SectionIdent)
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, const char * DefaultValue, bool DeleteOnDefault) :
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
m_SectionIdent(SectionIdent)
{
m_SectionIdent.Replace("\\","-");
if (!m_VideoSetting)
{
m_VideoSetting = IsVideoSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
m_SectionIdent.Replace("\\", "-");
if (!m_VideoSetting || !m_AudioSetting)
{
m_VideoSetting = IsVideoSetting(m_SectionIdent.c_str());
m_AudioSetting = IsAudioSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
}
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
CSettingTypeRomDatabase(Name, DefaultSetting, DeleteOnDefault),
m_SectionIdent(SectionIdent)
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault) :
CSettingTypeRomDatabase(Name, DefaultSetting, DeleteOnDefault),
m_SectionIdent(SectionIdent)
{
m_SectionIdent.Replace("\\","-");
if (!m_VideoSetting)
{
m_VideoSetting = IsVideoSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
m_SectionIdent.Replace("\\", "-");
if (!m_VideoSetting || !m_AudioSetting)
{
m_VideoSetting = IsVideoSetting(m_SectionIdent.c_str());
m_AudioSetting = IsAudioSetting(m_SectionIdent.c_str());
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
}
}
CSettingTypeRomDatabaseSetting::~CSettingTypeRomDatabaseSetting()
{
}
}

View File

@ -31,8 +31,10 @@ enum SettingID
SupportFile_SettingsDefault,
SupportFile_RomDatabase,
SupportFile_RomDatabaseDefault,
SupportFile_Project64VideoRDB,
SupportFile_Project64VideoRDBDefault,
SupportFile_VideoRDB,
SupportFile_VideoRDBDefault,
SupportFile_AudioRDB,
SupportFile_AudioRDBDefault,
SupportFile_Cheats,
SupportFile_CheatsDefault,
SupportFile_Notes,

View File

@ -94,8 +94,10 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(SupportFile_SettingsDefault, new CSettingTypeRelativePath("Config", "Project64.cfg"));
AddHandler(SupportFile_RomDatabase, new CSettingTypeApplicationPath("", "RomDatabase", SupportFile_RomDatabaseDefault));
AddHandler(SupportFile_RomDatabaseDefault, new CSettingTypeRelativePath("Config", "Project64.rdb"));
AddHandler(SupportFile_Project64VideoRDB, new CSettingTypeApplicationPath("", "Project64VideoRDB", SupportFile_Project64VideoRDBDefault));
AddHandler(SupportFile_Project64VideoRDBDefault, new CSettingTypeRelativePath("Config", "Project64Video.rdb"));
AddHandler(SupportFile_VideoRDB, new CSettingTypeApplicationPath("", "VideoRDB", SupportFile_VideoRDBDefault));
AddHandler(SupportFile_VideoRDBDefault, new CSettingTypeRelativePath("Config", "Video.rdb"));
AddHandler(SupportFile_AudioRDB, new CSettingTypeApplicationPath("", "AudioRDB", SupportFile_AudioRDBDefault));
AddHandler(SupportFile_AudioRDBDefault, new CSettingTypeRelativePath("Config", "Audio.rdb"));
AddHandler(SupportFile_Cheats, new CSettingTypeApplicationPath("", "Cheats", SupportFile_CheatsDefault));
AddHandler(SupportFile_CheatsDefault, new CSettingTypeRelativePath("Config", "Project64.cht"));
AddHandler(SupportFile_Notes, new CSettingTypeApplicationPath("", "Notes", SupportFile_NotesDefault));

View File

@ -34,7 +34,8 @@ md "%base_dir%\Bin\Package\Plugin\Input"
md "%base_dir%\Bin\Package\Plugin\RSP"
copy "%base_dir%\Bin\Release\Project64.exe" "%base_dir%\Bin\Package"
copy "%base_dir%\Config\Project64Video.rdb" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Video.rdb" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Audio.rdb" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Project64.cht" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Project64.rdb" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Project64.rdx" "%base_dir%\Bin\Package\Config"