Clean up enhancements code
This commit is contained in:
parent
b63c1cbc3c
commit
fd1a6112c0
|
@ -27,9 +27,9 @@ Thumbs.db
|
||||||
/Bin/Release64
|
/Bin/Release64
|
||||||
/build
|
/build
|
||||||
/Config/Cheats-User
|
/Config/Cheats-User
|
||||||
|
/Config/Enhancement-User
|
||||||
/Config/Project64.cache3
|
/Config/Project64.cache3
|
||||||
/Config/Project64.cfg
|
/Config/Project64.cfg
|
||||||
/Config/Project64.cht
|
|
||||||
/Config/Project64.rdn
|
/Config/Project64.rdn
|
||||||
/Config/Project64.sc3
|
/Config/Project64.sc3
|
||||||
/Config/Project64.zcache
|
/Config/Project64.zcache
|
||||||
|
|
|
@ -4,13 +4,14 @@ AudioRDB=..\..\Config\Audio.rdb
|
||||||
Auto Sleep=0
|
Auto Sleep=0
|
||||||
Basic Mode=0
|
Basic Mode=0
|
||||||
CheatDir=..\..\Config\Cheats\
|
CheatDir=..\..\Config\Cheats\
|
||||||
Enhancement=..\..\Config\Project64.enh
|
EnhancementDir=..\..\Config\Enhancement\
|
||||||
ExtInfo=..\..\Config\Project64.rdx
|
ExtInfo=..\..\Config\Project64.rdx
|
||||||
Notes=..\..\Config\Project64.rdn
|
Notes=..\..\Config\Project64.rdn
|
||||||
RomDatabase=..\..\Config\Project64.rdb
|
RomDatabase=..\..\Config\Project64.rdb
|
||||||
RomListCache=..\..\Config\Project64.cache3
|
RomListCache=..\..\Config\Project64.cache3
|
||||||
ShortCuts=..\..\Config\Project64.sc3
|
ShortCuts=..\..\Config\Project64.sc3
|
||||||
UserCheatDir=..\..\Config\Cheats-User\
|
UserCheatDir=..\..\Config\Cheats-User\
|
||||||
|
UserEnhancementDir=..\..\Config\Enhancement-User\
|
||||||
VideoRDB=..\..\Config\Video.rdb
|
VideoRDB=..\..\Config\Video.rdb
|
||||||
|
|
||||||
[Debugger]
|
[Debugger]
|
||||||
|
|
|
@ -277,6 +277,7 @@ enum LanguageStringID
|
||||||
OPTION_IPL_ROM_USA_PATH = 470,
|
OPTION_IPL_ROM_USA_PATH = 470,
|
||||||
OPTION_IPL_ROM_TOOL_PATH = 471,
|
OPTION_IPL_ROM_TOOL_PATH = 471,
|
||||||
OPTION_DISKSAVETYPE = 472,
|
OPTION_DISKSAVETYPE = 472,
|
||||||
|
OPTION_ENABLE_ENHANCEMENTS = 473,
|
||||||
|
|
||||||
//Rom Browser Tab
|
//Rom Browser Tab
|
||||||
RB_MAX_ROMS = 480,
|
RB_MAX_ROMS = 480,
|
||||||
|
|
|
@ -243,6 +243,7 @@ void CLanguage::LoadDefaultStrings(void)
|
||||||
DEF_STR(OPTION_IPL_ROM_USA_PATH, "American Retail 64DD IPL ROM Path:");
|
DEF_STR(OPTION_IPL_ROM_USA_PATH, "American Retail 64DD IPL ROM Path:");
|
||||||
DEF_STR(OPTION_IPL_ROM_TOOL_PATH, "Development 64DD IPL ROM Path:");
|
DEF_STR(OPTION_IPL_ROM_TOOL_PATH, "Development 64DD IPL ROM Path:");
|
||||||
DEF_STR(OPTION_DISKSAVETYPE, "Disk Save Type:");
|
DEF_STR(OPTION_DISKSAVETYPE, "Disk Save Type:");
|
||||||
|
DEF_STR(OPTION_ENABLE_ENHANCEMENTS, "Enable Enhancements");
|
||||||
|
|
||||||
//ROM Browser Tab
|
//ROM Browser Tab
|
||||||
DEF_STR(RB_MAX_ROMS, "Max # of ROMs remembered (0-10):");
|
DEF_STR(RB_MAX_ROMS, "Max # of ROMs remembered (0-10):");
|
||||||
|
|
|
@ -32,8 +32,9 @@ class CSettingEnhancementActive :
|
||||||
public CSettingTypeGame
|
public CSettingTypeGame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingEnhancementActive(const char * Name, const char * Ident) :
|
CSettingEnhancementActive(const char * Name, const char * Ident, bool Default) :
|
||||||
CSettingTypeGame("",false)
|
CSettingTypeGame("",false),
|
||||||
|
m_Default(Default)
|
||||||
{
|
{
|
||||||
m_KeyNameIdex = GenerateKeyName(Name, Ident, "Active");
|
m_KeyNameIdex = GenerateKeyName(Name, Ident, "Active");
|
||||||
}
|
}
|
||||||
|
@ -49,7 +50,7 @@ public:
|
||||||
{
|
{
|
||||||
return Active;
|
return Active;
|
||||||
}
|
}
|
||||||
return false;
|
return m_Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetActive(bool Active)
|
void SetActive(bool Active)
|
||||||
|
@ -71,6 +72,9 @@ public:
|
||||||
CSettingTypeGame::Delete(0);
|
CSettingTypeGame::Delete(0);
|
||||||
Flush();
|
Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_Default;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSettingEnhancementSelectedOption :
|
class CSettingEnhancementSelectedOption :
|
||||||
|
@ -119,6 +123,7 @@ CEnhancement::CEnhancement(const char * Ident) :
|
||||||
m_Ident(Ident),
|
m_Ident(Ident),
|
||||||
m_CodeOptionSize(0),
|
m_CodeOptionSize(0),
|
||||||
m_SelectedOption(0xFFFF0000),
|
m_SelectedOption(0xFFFF0000),
|
||||||
|
m_OnByDefault(false),
|
||||||
m_Active(false),
|
m_Active(false),
|
||||||
m_Valid(false)
|
m_Valid(false)
|
||||||
{
|
{
|
||||||
|
@ -128,6 +133,7 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
|
||||||
m_Ident(Ident),
|
m_Ident(Ident),
|
||||||
m_CodeOptionSize(0),
|
m_CodeOptionSize(0),
|
||||||
m_SelectedOption(0xFFFF0000),
|
m_SelectedOption(0xFFFF0000),
|
||||||
|
m_OnByDefault(false),
|
||||||
m_Active(false),
|
m_Active(false),
|
||||||
m_Valid(false)
|
m_Valid(false)
|
||||||
{
|
{
|
||||||
|
@ -164,6 +170,10 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
|
||||||
{
|
{
|
||||||
m_Note = &Pos[1];
|
m_Note = &Pos[1];
|
||||||
}
|
}
|
||||||
|
else if (stricmp(Key.c_str(), "OnByDefault") == 0)
|
||||||
|
{
|
||||||
|
m_OnByDefault = Pos[1] == '1';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -213,7 +223,7 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
m_Active = CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str()).Active();
|
m_Active = CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).Active();
|
||||||
uint16_t SelectedValue = 0;
|
uint16_t SelectedValue = 0;
|
||||||
if (CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).SelectedValue(SelectedValue))
|
if (CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).SelectedValue(SelectedValue))
|
||||||
{
|
{
|
||||||
|
@ -224,11 +234,16 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
|
||||||
|
|
||||||
void CEnhancement::SetName(const char * Name)
|
void CEnhancement::SetName(const char * Name)
|
||||||
{
|
{
|
||||||
CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str()).Delete();
|
std::string NewName = stdstr(Name != NULL ? Name : "").Trim("\t ,");
|
||||||
|
if (NewName == m_Name)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).Delete();
|
||||||
CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).Delete();
|
CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).Delete();
|
||||||
m_Name = stdstr(Name != NULL ? Name : "").Trim("\t ,");
|
m_Name = stdstr(Name != NULL ? Name : "").Trim("\t ,");
|
||||||
m_NameAndExtension = m_Name;
|
m_NameAndExtension = m_Name;
|
||||||
if (m_Active) { CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str()).SetActive(true); }
|
if (m_Active != m_OnByDefault) { CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).SetActive(m_OnByDefault); }
|
||||||
if (OptionSelected()) { CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).SetOption(SelectedOption()); }
|
if (OptionSelected()) { CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).SetOption(SelectedOption()); }
|
||||||
CheckValid();
|
CheckValid();
|
||||||
}
|
}
|
||||||
|
@ -268,7 +283,13 @@ void CEnhancement::SetActive(bool Active)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_Active = Active;
|
m_Active = Active;
|
||||||
CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str()).SetActive(m_Active);
|
CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).SetActive(m_Active);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEnhancement::SetOnByDefault(bool OnByDefault)
|
||||||
|
{
|
||||||
|
m_OnByDefault = OnByDefault;
|
||||||
|
m_Active = CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).Active();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEnhancement::CheckValid(void)
|
void CEnhancement::CheckValid(void)
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
void SetOptions(const CodeOptions & Options);
|
void SetOptions(const CodeOptions & Options);
|
||||||
void SetSelectedOption(uint16_t Value);
|
void SetSelectedOption(uint16_t Value);
|
||||||
void SetActive(bool Active);
|
void SetActive(bool Active);
|
||||||
|
void SetOnByDefault(bool OnByDefault);
|
||||||
|
|
||||||
inline const std::string & GetName(void) const { return m_Name; }
|
inline const std::string & GetName(void) const { return m_Name; }
|
||||||
inline const std::string & GetNameAndExtension(void) const { return m_NameAndExtension; }
|
inline const std::string & GetNameAndExtension(void) const { return m_NameAndExtension; }
|
||||||
|
@ -46,6 +47,7 @@ public:
|
||||||
inline uint32_t CodeOptionSize(void) const { return m_CodeOptionSize; }
|
inline uint32_t CodeOptionSize(void) const { return m_CodeOptionSize; }
|
||||||
inline bool Valid(void) const { return m_Valid; }
|
inline bool Valid(void) const { return m_Valid; }
|
||||||
inline bool Active(void) const { return m_Active; }
|
inline bool Active(void) const { return m_Active; }
|
||||||
|
inline bool GetOnByDefault(void) const { return m_OnByDefault; }
|
||||||
bool OptionSelected() const { return (m_SelectedOption & 0xFFFF0000) == 0; }
|
bool OptionSelected() const { return (m_SelectedOption & 0xFFFF0000) == 0; }
|
||||||
uint16_t SelectedOption() const { return (uint16_t)(m_SelectedOption & 0xFFFF); }
|
uint16_t SelectedOption() const { return (uint16_t)(m_SelectedOption & 0xFFFF); }
|
||||||
|
|
||||||
|
@ -64,6 +66,7 @@ private:
|
||||||
std::string m_OptionValue;
|
std::string m_OptionValue;
|
||||||
uint32_t m_CodeOptionSize;
|
uint32_t m_CodeOptionSize;
|
||||||
uint32_t m_SelectedOption;
|
uint32_t m_SelectedOption;
|
||||||
|
bool m_OnByDefault;
|
||||||
bool m_Active;
|
bool m_Active;
|
||||||
bool m_Valid;
|
bool m_Valid;
|
||||||
};
|
};
|
||||||
|
|
|
@ -325,6 +325,10 @@ void CEnhancmentFile::SaveCurrentSection(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Section += stdstr_f("$%s%s", Enhancement.GetName().c_str(), m_LineFeed);
|
Section += stdstr_f("$%s%s", Enhancement.GetName().c_str(), m_LineFeed);
|
||||||
|
if (Enhancement.GetOnByDefault())
|
||||||
|
{
|
||||||
|
Section += stdstr_f("OnByDefault=1%s", m_LineFeed);
|
||||||
|
}
|
||||||
if (!Enhancement.GetNote().empty())
|
if (!Enhancement.GetNote().empty())
|
||||||
{
|
{
|
||||||
Section += stdstr_f("Note=%s%s", Enhancement.GetNote().c_str(), m_LineFeed);
|
Section += stdstr_f("Note=%s%s", Enhancement.GetNote().c_str(), m_LineFeed);
|
||||||
|
|
|
@ -89,7 +89,7 @@ void CEnhancements::UpdateCheats(const CEnhancementList & Cheats)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
if (strcmp(m_CheatFile->FileName(), OutFile) != 0)
|
if (m_CheatFile.get() == nullptr || strcmp(m_CheatFile->FileName(), OutFile) != 0)
|
||||||
{
|
{
|
||||||
if (!OutFile.DirectoryExists())
|
if (!OutFile.DirectoryExists())
|
||||||
{
|
{
|
||||||
|
@ -125,6 +125,46 @@ void CEnhancements::UpdateCheats(void)
|
||||||
m_UpdateCheats = true;
|
m_UpdateCheats = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEnhancements::UpdateEnhancements(const CEnhancementList & Enhancements)
|
||||||
|
{
|
||||||
|
std::string GameName = g_Settings->LoadStringVal(Rdb_GoodName);
|
||||||
|
CPath OutFile(g_Settings->LoadStringVal(SupportFile_UserEnhancementDir), stdstr_f("%s.enh", GameName.c_str()).c_str());
|
||||||
|
#ifdef _WIN32
|
||||||
|
OutFile.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CGuard Guard(m_CS);
|
||||||
|
if (m_EnhancementFile.get() == nullptr ||strcmp(m_EnhancementFile->FileName(), OutFile) != 0)
|
||||||
|
{
|
||||||
|
if (!OutFile.DirectoryExists())
|
||||||
|
{
|
||||||
|
OutFile.DirectoryCreate();
|
||||||
|
}
|
||||||
|
SectionFiles::const_iterator EnhancementFileItr = m_EnhancementFiles.find(m_SectionIdent);
|
||||||
|
if (m_EnhancementFiles.end() != EnhancementFileItr)
|
||||||
|
{
|
||||||
|
m_EnhancementFiles.erase(EnhancementFileItr);
|
||||||
|
}
|
||||||
|
m_EnhancementFile = std::make_unique<CEnhancmentFile>(OutFile, "Enhancement");
|
||||||
|
m_EnhancementFiles.insert(SectionFiles::value_type(m_SectionIdent, OutFile));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_EnhancementFile->SetName(m_SectionIdent.c_str(), GameName.c_str());
|
||||||
|
m_EnhancementFile->RemoveEnhancements(m_SectionIdent.c_str());
|
||||||
|
for (CEnhancementList::const_iterator itr = Enhancements.begin(); itr != Enhancements.end(); itr++)
|
||||||
|
{
|
||||||
|
const CEnhancement & Enhancement = itr->second;
|
||||||
|
if (!Enhancement.Valid())
|
||||||
|
{
|
||||||
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
m_EnhancementFile->AddEnhancement(m_SectionIdent.c_str(), Enhancement);
|
||||||
|
}
|
||||||
|
m_EnhancementFile->SaveCurrentSection();
|
||||||
|
m_UpdateCheats = true;
|
||||||
|
}
|
||||||
|
|
||||||
void CEnhancements::ResetCodes(CMipsMemoryVM * MMU)
|
void CEnhancements::ResetCodes(CMipsMemoryVM * MMU)
|
||||||
{
|
{
|
||||||
m_ActiveCodes.clear();
|
m_ActiveCodes.clear();
|
||||||
|
@ -155,28 +195,36 @@ void CEnhancements::ResetCodes(CMipsMemoryVM * MMU)
|
||||||
m_OriginalValues16.clear();
|
m_OriginalValues16.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEnhancements::LoadCheats(CMipsMemoryVM * MMU)
|
void CEnhancements::LoadEnhancements(const char * Ident, SectionFiles & Files, std::unique_ptr<CEnhancmentFile> & File, CEnhancementList & EnhancementList)
|
||||||
{
|
{
|
||||||
WaitScanDone();
|
SectionFiles::const_iterator CheatFileItr = Files.find(m_SectionIdent);
|
||||||
CGuard Guard(m_CS);
|
|
||||||
SectionFiles::const_iterator CheatFileItr = m_CheatFiles.find(m_SectionIdent);
|
|
||||||
bool FoundFile = false;
|
bool FoundFile = false;
|
||||||
if (CheatFileItr != m_CheatFiles.end())
|
if (CheatFileItr != Files.end())
|
||||||
{
|
{
|
||||||
CPath CheatFile(CheatFileItr->second);
|
CPath CheatFile(CheatFileItr->second);
|
||||||
if (CheatFile.Exists())
|
if (CheatFile.Exists())
|
||||||
{
|
{
|
||||||
m_CheatFile = std::make_unique<CEnhancmentFile>(CheatFile, "Cheat");
|
File = std::make_unique<CEnhancmentFile>(CheatFile, Ident);
|
||||||
m_CheatFile->GetEnhancementList(m_SectionIdent.c_str(), m_Cheats);
|
File->GetEnhancementList(m_SectionIdent.c_str(), EnhancementList);
|
||||||
FoundFile = true;
|
FoundFile = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FoundFile)
|
if (!FoundFile)
|
||||||
{
|
{
|
||||||
m_CheatFile = nullptr;
|
File = nullptr;
|
||||||
m_Cheats.clear();
|
EnhancementList.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEnhancements::LoadCheats(CMipsMemoryVM * MMU)
|
||||||
|
{
|
||||||
|
WaitScanDone();
|
||||||
|
CGuard Guard(m_CS);
|
||||||
|
|
||||||
|
LoadEnhancements("Cheat", m_CheatFiles, m_CheatFile, m_Cheats);
|
||||||
|
LoadEnhancements("Enhancement", m_EnhancementFiles, m_EnhancementFile, m_Enhancements);
|
||||||
|
|
||||||
ResetCodes(MMU);
|
ResetCodes(MMU);
|
||||||
for (CEnhancementList::const_iterator itr = m_Cheats.begin(); itr != m_Cheats.end(); itr++)
|
for (CEnhancementList::const_iterator itr = m_Cheats.begin(); itr != m_Cheats.end(); itr++)
|
||||||
{
|
{
|
||||||
|
@ -439,7 +487,7 @@ void CEnhancements::ModifyMemory16(CMipsMemoryVM & MMU, uint32_t Address, uint16
|
||||||
|
|
||||||
void CEnhancements::ScanFileThread(void)
|
void CEnhancements::ScanFileThread(void)
|
||||||
{
|
{
|
||||||
SectionFiles Files;
|
SectionFiles CheatFiles;
|
||||||
CPath File(g_Settings->LoadStringVal(SupportFile_CheatDir), "*.cht");
|
CPath File(g_Settings->LoadStringVal(SupportFile_CheatDir), "*.cht");
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
File.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
File.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||||
|
@ -453,7 +501,7 @@ void CEnhancements::ScanFileThread(void)
|
||||||
EnhancmentFile.GetSections(Sections);
|
EnhancmentFile.GetSections(Sections);
|
||||||
for (CEnhancmentFile::SectionList::const_iterator itr = Sections.begin(); itr != Sections.end(); itr++)
|
for (CEnhancmentFile::SectionList::const_iterator itr = Sections.begin(); itr != Sections.end(); itr++)
|
||||||
{
|
{
|
||||||
Files.insert(SectionFiles::value_type(itr->c_str(), File));
|
CheatFiles.insert(SectionFiles::value_type(itr->c_str(), File));
|
||||||
}
|
}
|
||||||
} while (m_Scan && File.FindNext());
|
} while (m_Scan && File.FindNext());
|
||||||
}
|
}
|
||||||
|
@ -471,14 +519,52 @@ void CEnhancements::ScanFileThread(void)
|
||||||
EnhancmentFile.GetSections(Sections);
|
EnhancmentFile.GetSections(Sections);
|
||||||
for (CEnhancmentFile::SectionList::const_iterator itr = Sections.begin(); itr != Sections.end(); itr++)
|
for (CEnhancmentFile::SectionList::const_iterator itr = Sections.begin(); itr != Sections.end(); itr++)
|
||||||
{
|
{
|
||||||
Files[itr->c_str()] = (const char *)File;
|
CheatFiles[itr->c_str()] = (const char *)File;
|
||||||
|
}
|
||||||
|
} while (m_Scan && File.FindNext());
|
||||||
|
}
|
||||||
|
|
||||||
|
File = CPath(g_Settings->LoadStringVal(SupportFile_EnhancementDir), "*.enh");
|
||||||
|
#ifdef _WIN32
|
||||||
|
File.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||||
|
#endif
|
||||||
|
SectionFiles EnhancementFiles;
|
||||||
|
if (File.FindFirst() && m_Scan)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
CEnhancmentFile EnhancmentFile(File, "Enhancment");
|
||||||
|
CEnhancmentFile::SectionList Sections;
|
||||||
|
EnhancmentFile.GetSections(Sections);
|
||||||
|
for (CEnhancmentFile::SectionList::const_iterator itr = Sections.begin(); itr != Sections.end(); itr++)
|
||||||
|
{
|
||||||
|
EnhancementFiles.insert(SectionFiles::value_type(itr->c_str(), File));
|
||||||
|
}
|
||||||
|
} while (m_Scan && File.FindNext());
|
||||||
|
}
|
||||||
|
|
||||||
|
File = CPath(g_Settings->LoadStringVal(SupportFile_UserEnhancementDir), "*.enh");
|
||||||
|
#ifdef _WIN32
|
||||||
|
File.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||||
|
#endif
|
||||||
|
if (m_Scan && File.FindFirst())
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
CEnhancmentFile EnhancmentFile(File, "Enhancment");
|
||||||
|
CEnhancmentFile::SectionList Sections;
|
||||||
|
EnhancmentFile.GetSections(Sections);
|
||||||
|
for (CEnhancmentFile::SectionList::const_iterator itr = Sections.begin(); itr != Sections.end(); itr++)
|
||||||
|
{
|
||||||
|
EnhancementFiles[itr->c_str()] = (const char *)File;
|
||||||
}
|
}
|
||||||
} while (m_Scan && File.FindNext());
|
} while (m_Scan && File.FindNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
m_CheatFiles = Files;
|
m_CheatFiles = CheatFiles;
|
||||||
|
m_EnhancementFiles = EnhancementFiles;
|
||||||
m_Scanned = true;
|
m_Scanned = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,12 @@ public:
|
||||||
|
|
||||||
void ApplyActive(CMipsMemoryVM & MMU, bool UpdateChanges);
|
void ApplyActive(CMipsMemoryVM & MMU, bool UpdateChanges);
|
||||||
void ApplyGSButton(CMipsMemoryVM & MMU, bool UpdateChanges);
|
void ApplyGSButton(CMipsMemoryVM & MMU, bool UpdateChanges);
|
||||||
void UpdateCheats(const CEnhancementList & Cheats );
|
void UpdateCheats(const CEnhancementList & Cheats);
|
||||||
void UpdateCheats(void);
|
void UpdateCheats(void);
|
||||||
|
void UpdateEnhancements(const CEnhancementList & Enhancements);
|
||||||
|
|
||||||
inline const CEnhancementList & Cheats(void) const { return m_Cheats; }
|
inline const CEnhancementList & Cheats(void) const { return m_Cheats; }
|
||||||
|
inline const CEnhancementList & Enhancements(void) const { return m_Enhancements; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct GAMESHARK_CODE
|
struct GAMESHARK_CODE
|
||||||
|
@ -63,6 +65,7 @@ private:
|
||||||
|
|
||||||
void ResetCodes(CMipsMemoryVM * MMU);
|
void ResetCodes(CMipsMemoryVM * MMU);
|
||||||
void LoadCheats(CMipsMemoryVM * MMU);
|
void LoadCheats(CMipsMemoryVM * MMU);
|
||||||
|
void LoadEnhancements(const char * Ident, SectionFiles & Files, std::unique_ptr<CEnhancmentFile> & File, CEnhancementList & EnhancementList);
|
||||||
void ApplyGameSharkCodes(CMipsMemoryVM & MMU, CODES & CodeEntry, uint32_t CurrentEntry);
|
void ApplyGameSharkCodes(CMipsMemoryVM & MMU, CODES & CodeEntry, uint32_t CurrentEntry);
|
||||||
uint32_t EntrySize(const CODES & CodeEntry, uint32_t CurrentEntry);
|
uint32_t EntrySize(const CODES & CodeEntry, uint32_t CurrentEntry);
|
||||||
void ModifyMemory8(CMipsMemoryVM & MMU, uint32_t Address, uint8_t Value);
|
void ModifyMemory8(CMipsMemoryVM & MMU, uint32_t Address, uint8_t Value);
|
||||||
|
@ -79,9 +82,10 @@ private:
|
||||||
|
|
||||||
CriticalSection m_CS;
|
CriticalSection m_CS;
|
||||||
std::string m_SectionIdent;
|
std::string m_SectionIdent;
|
||||||
SectionFiles m_CheatFiles;
|
SectionFiles m_CheatFiles, m_EnhancementFiles;
|
||||||
std::unique_ptr<CEnhancmentFile> m_CheatFile;
|
std::unique_ptr<CEnhancmentFile> m_CheatFile, m_EnhancementFile;
|
||||||
CEnhancementList m_Cheats;
|
CEnhancementList m_Cheats;
|
||||||
|
CEnhancementList m_Enhancements;
|
||||||
CODES_ARRAY m_ActiveCodes;
|
CODES_ARRAY m_ActiveCodes;
|
||||||
CODES_ARRAY m_GSButtonCodes;
|
CODES_ARRAY m_GSButtonCodes;
|
||||||
ORIGINAL_VALUES16 m_OriginalValues16;
|
ORIGINAL_VALUES16 m_OriginalValues16;
|
||||||
|
|
|
@ -34,6 +34,7 @@ const char * SystemEventName(SystemEvent event)
|
||||||
case SysEvent_PauseCPU_Settings: return "SysEvent_PauseCPU_Settings";
|
case SysEvent_PauseCPU_Settings: return "SysEvent_PauseCPU_Settings";
|
||||||
case SysEvent_PauseCPU_Cheats: return "SysEvent_PauseCPU_Cheats";
|
case SysEvent_PauseCPU_Cheats: return "SysEvent_PauseCPU_Cheats";
|
||||||
case SysEvent_PauseCPU_ChangingBPs: return "SysEvent_PauseCPU_ChangingBPs";
|
case SysEvent_PauseCPU_ChangingBPs: return "SysEvent_PauseCPU_ChangingBPs";
|
||||||
|
case SysEvent_PauseCPU_Enhancement: return "SysEvent_PauseCPU_Enhancement";
|
||||||
case SysEvent_ResumeCPU_FromMenu: return "SysEvent_ResumeCPU_FromMenu";
|
case SysEvent_ResumeCPU_FromMenu: return "SysEvent_ResumeCPU_FromMenu";
|
||||||
case SysEvent_ResumeCPU_AppGainedActive: return "SysEvent_ResumeCPU_AppGainedActive";
|
case SysEvent_ResumeCPU_AppGainedActive: return "SysEvent_ResumeCPU_AppGainedActive";
|
||||||
case SysEvent_ResumeCPU_AppGainedFocus: return "SysEvent_ResumeCPU_AppGainedFocus";
|
case SysEvent_ResumeCPU_AppGainedFocus: return "SysEvent_ResumeCPU_AppGainedFocus";
|
||||||
|
@ -252,6 +253,13 @@ void CSystemEvents::ExecuteEvents()
|
||||||
bPause = true;
|
bPause = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SysEvent_PauseCPU_Enhancement:
|
||||||
|
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||||
|
{
|
||||||
|
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_Enhancement);
|
||||||
|
bPause = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SysEvent_ResetRecompilerCode:
|
case SysEvent_ResetRecompilerCode:
|
||||||
if (g_Recompiler)
|
if (g_Recompiler)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,7 @@ enum SystemEvent
|
||||||
SysEvent_PauseCPU_Settings,
|
SysEvent_PauseCPU_Settings,
|
||||||
SysEvent_PauseCPU_Cheats,
|
SysEvent_PauseCPU_Cheats,
|
||||||
SysEvent_PauseCPU_ChangingBPs,
|
SysEvent_PauseCPU_ChangingBPs,
|
||||||
|
SysEvent_PauseCPU_Enhancement,
|
||||||
SysEvent_ResumeCPU_FromMenu,
|
SysEvent_ResumeCPU_FromMenu,
|
||||||
SysEvent_ResumeCPU_AppGainedActive,
|
SysEvent_ResumeCPU_AppGainedActive,
|
||||||
SysEvent_ResumeCPU_AppGainedFocus,
|
SysEvent_ResumeCPU_AppGainedFocus,
|
||||||
|
@ -41,6 +42,7 @@ enum SystemEvent
|
||||||
SysEvent_ResumeCPU_Settings,
|
SysEvent_ResumeCPU_Settings,
|
||||||
SysEvent_ResumeCPU_Cheats,
|
SysEvent_ResumeCPU_Cheats,
|
||||||
SysEvent_ResumeCPU_ChangingBPs,
|
SysEvent_ResumeCPU_ChangingBPs,
|
||||||
|
SysEvent_ResumeCPU_Enhancement,
|
||||||
SysEvent_ChangingFullScreen,
|
SysEvent_ChangingFullScreen,
|
||||||
SysEvent_ChangePlugins,
|
SysEvent_ChangePlugins,
|
||||||
SysEvent_SaveMachineState,
|
SysEvent_SaveMachineState,
|
||||||
|
|
|
@ -214,6 +214,7 @@ void CN64System::ExternalEvent(SystemEvent action)
|
||||||
case SysEvent_PauseCPU_SearchMemory:
|
case SysEvent_PauseCPU_SearchMemory:
|
||||||
case SysEvent_PauseCPU_Settings:
|
case SysEvent_PauseCPU_Settings:
|
||||||
case SysEvent_PauseCPU_Cheats:
|
case SysEvent_PauseCPU_Cheats:
|
||||||
|
case SysEvent_PauseCPU_Enhancement:
|
||||||
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
|
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||||
{
|
{
|
||||||
QueueEvent(action);
|
QueueEvent(action);
|
||||||
|
@ -292,6 +293,12 @@ void CN64System::ExternalEvent(SystemEvent action)
|
||||||
m_hPauseEvent.Trigger();
|
m_hPauseEvent.Trigger();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SysEvent_ResumeCPU_Enhancement:
|
||||||
|
if (g_Settings->LoadDword(GameRunning_CPU_PausedType) == PauseType_Enhancement)
|
||||||
|
{
|
||||||
|
m_hPauseEvent.Trigger();
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
WriteTrace(TraceN64System, TraceError, "Unknown event %d", action);
|
WriteTrace(TraceN64System, TraceError, "Unknown event %d", action);
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
|
|
@ -36,6 +36,7 @@ enum PauseType
|
||||||
PauseType_Settings,
|
PauseType_Settings,
|
||||||
PauseType_Cheats,
|
PauseType_Cheats,
|
||||||
PauseType_ChangingBPs,
|
PauseType_ChangingBPs,
|
||||||
|
PauseType_Enhancement,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CPU_TYPE
|
enum CPU_TYPE
|
||||||
|
|
|
@ -108,7 +108,6 @@
|
||||||
<ClCompile Include="Settings\SettingType\SettingsType-Application.cpp" />
|
<ClCompile Include="Settings\SettingType\SettingsType-Application.cpp" />
|
||||||
<ClCompile Include="Settings\SettingType\SettingsType-ApplicationIndex.cpp" />
|
<ClCompile Include="Settings\SettingType\SettingsType-ApplicationIndex.cpp" />
|
||||||
<ClCompile Include="Settings\SettingType\SettingsType-ApplicationPath.cpp" />
|
<ClCompile Include="Settings\SettingType\SettingsType-ApplicationPath.cpp" />
|
||||||
<ClCompile Include="Settings\SettingType\SettingsType-Enhancements.cpp" />
|
|
||||||
<ClCompile Include="Settings\SettingType\SettingsType-GameSetting.cpp" />
|
<ClCompile Include="Settings\SettingType\SettingsType-GameSetting.cpp" />
|
||||||
<ClCompile Include="Settings\SettingType\SettingsType-GameSettingIndex.cpp" />
|
<ClCompile Include="Settings\SettingType\SettingsType-GameSettingIndex.cpp" />
|
||||||
<ClCompile Include="Settings\SettingType\SettingsType-RDBCpuType.cpp" />
|
<ClCompile Include="Settings\SettingType\SettingsType-RDBCpuType.cpp" />
|
||||||
|
@ -217,7 +216,6 @@
|
||||||
<ClInclude Include="Settings\SettingType\SettingsType-ApplicationIndex.h" />
|
<ClInclude Include="Settings\SettingType\SettingsType-ApplicationIndex.h" />
|
||||||
<ClInclude Include="Settings\SettingType\SettingsType-ApplicationPath.h" />
|
<ClInclude Include="Settings\SettingType\SettingsType-ApplicationPath.h" />
|
||||||
<ClInclude Include="Settings\SettingType\SettingsType-Base.h" />
|
<ClInclude Include="Settings\SettingType\SettingsType-Base.h" />
|
||||||
<ClInclude Include="Settings\SettingType\SettingsType-Enhancements.h" />
|
|
||||||
<ClInclude Include="Settings\SettingType\SettingsType-GameSetting.h" />
|
<ClInclude Include="Settings\SettingType\SettingsType-GameSetting.h" />
|
||||||
<ClInclude Include="Settings\SettingType\SettingsType-GameSettingIndex.h" />
|
<ClInclude Include="Settings\SettingType\SettingsType-GameSettingIndex.h" />
|
||||||
<ClInclude Include="Settings\SettingType\SettingsType-RDBCpuType.h" />
|
<ClInclude Include="Settings\SettingType\SettingsType-RDBCpuType.h" />
|
||||||
|
|
|
@ -339,9 +339,6 @@
|
||||||
<ClCompile Include="Settings.cpp">
|
<ClCompile Include="Settings.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Settings\SettingType\SettingsType-Enhancements.cpp">
|
|
||||||
<Filter>Source Files\Settings\SettingType</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="N64System\Enhancement\EnhancementFile.cpp">
|
<ClCompile Include="N64System\Enhancement\EnhancementFile.cpp">
|
||||||
<Filter>Source Files\N64 System\Enhancement</Filter>
|
<Filter>Source Files\N64 System\Enhancement</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -662,9 +659,6 @@
|
||||||
<ClInclude Include="Settings\SettingsID.h">
|
<ClInclude Include="Settings\SettingsID.h">
|
||||||
<Filter>Header Files\Settings</Filter>
|
<Filter>Header Files\Settings</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Settings\SettingType\SettingsType-Enhancements.h">
|
|
||||||
<Filter>Header Files\Settings\SettingType</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="N64System\Enhancement\EnhancementFile.h">
|
<ClInclude Include="N64System\Enhancement\EnhancementFile.h">
|
||||||
<Filter>Header Files\N64 System\Enhancement</Filter>
|
<Filter>Header Files\N64 System\Enhancement</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "Settings/SettingType/SettingsType-Application.h"
|
#include "Settings/SettingType/SettingsType-Application.h"
|
||||||
#include "Settings/SettingType/SettingsType-ApplicationPath.h"
|
#include "Settings/SettingType/SettingsType-ApplicationPath.h"
|
||||||
#include "Settings/SettingType/SettingsType-ApplicationIndex.h"
|
#include "Settings/SettingType/SettingsType-ApplicationIndex.h"
|
||||||
#include "Settings/SettingType/SettingsType-Enhancements.h"
|
|
||||||
#include "Settings/SettingType/SettingsType-GameSetting.h"
|
#include "Settings/SettingType/SettingsType-GameSetting.h"
|
||||||
#include "Settings/SettingType/SettingsType-GameSettingIndex.h"
|
#include "Settings/SettingType/SettingsType-GameSettingIndex.h"
|
||||||
#include "Settings/SettingType/SettingsType-RelativePath.h"
|
#include "Settings/SettingType/SettingsType-RelativePath.h"
|
||||||
|
@ -46,7 +45,6 @@ CSettings::~CSettings()
|
||||||
CSettingTypeApplication::CleanUp();
|
CSettingTypeApplication::CleanUp();
|
||||||
CSettingTypeRomDatabase::CleanUp();
|
CSettingTypeRomDatabase::CleanUp();
|
||||||
CSettingTypeGame::CleanUp();
|
CSettingTypeGame::CleanUp();
|
||||||
CSettingTypeEnhancements::CleanUp();
|
|
||||||
|
|
||||||
for (SETTING_MAP::iterator iter = m_SettingInfo.begin(); iter != m_SettingInfo.end(); iter++)
|
for (SETTING_MAP::iterator iter = m_SettingInfo.begin(); iter != m_SettingInfo.end(); iter++)
|
||||||
{
|
{
|
||||||
|
@ -103,8 +101,10 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
||||||
AddHandler(SupportFile_CheatDirDefault, new CSettingTypeRelativePath("Config\\Cheats", ""));
|
AddHandler(SupportFile_CheatDirDefault, new CSettingTypeRelativePath("Config\\Cheats", ""));
|
||||||
AddHandler(SupportFile_UserCheatDir, new CSettingTypeApplicationPath("Settings", "UserCheatDir", SupportFile_UserCheatDirDefault));
|
AddHandler(SupportFile_UserCheatDir, new CSettingTypeApplicationPath("Settings", "UserCheatDir", SupportFile_UserCheatDirDefault));
|
||||||
AddHandler(SupportFile_UserCheatDirDefault, new CSettingTypeRelativePath("Config\\Cheats-User", ""));
|
AddHandler(SupportFile_UserCheatDirDefault, new CSettingTypeRelativePath("Config\\Cheats-User", ""));
|
||||||
AddHandler(SupportFile_Enhancements, new CSettingTypeApplicationPath("Settings", "Enhancement", SupportFile_EnhancementsDefault));
|
AddHandler(SupportFile_EnhancementDir, new CSettingTypeApplicationPath("Settings", "EnhancementDir", SupportFile_EnhancementDirDefault));
|
||||||
AddHandler(SupportFile_EnhancementsDefault, new CSettingTypeRelativePath("Config", "Project64.enh"));
|
AddHandler(SupportFile_EnhancementDirDefault, new CSettingTypeRelativePath("Config\\Enhancement", ""));
|
||||||
|
AddHandler(SupportFile_UserEnhancementDir, new CSettingTypeApplicationPath("Settings", "UserEnhancementDir", SupportFile_UserEnhancementDirDefault));
|
||||||
|
AddHandler(SupportFile_UserEnhancementDirDefault, new CSettingTypeRelativePath("Config\\Enhancement-User", ""));
|
||||||
AddHandler(SupportFile_Notes, new CSettingTypeApplicationPath("Settings", "Notes", SupportFile_NotesDefault));
|
AddHandler(SupportFile_Notes, new CSettingTypeApplicationPath("Settings", "Notes", SupportFile_NotesDefault));
|
||||||
AddHandler(SupportFile_NotesDefault, new CSettingTypeRelativePath("Config", "Project64.rdn"));
|
AddHandler(SupportFile_NotesDefault, new CSettingTypeRelativePath("Config", "Project64.rdn"));
|
||||||
AddHandler(SupportFile_ExtInfo, new CSettingTypeApplicationPath("Settings", "ExtInfo", SupportFile_ExtInfoDefault));
|
AddHandler(SupportFile_ExtInfo, new CSettingTypeApplicationPath("Settings", "ExtInfo", SupportFile_ExtInfoDefault));
|
||||||
|
@ -125,7 +125,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
||||||
AddHandler(Setting_ForceInterpreterCPU, new CSettingTypeApplication("Settings", "Force Interpreter CPU", true));
|
AddHandler(Setting_ForceInterpreterCPU, new CSettingTypeApplication("Settings", "Force Interpreter CPU", true));
|
||||||
#endif
|
#endif
|
||||||
AddHandler(Setting_FixedRdramAddress, new CSettingTypeApplication("Settings", "Fixed Rdram Address", (uint32_t)0));
|
AddHandler(Setting_FixedRdramAddress, new CSettingTypeApplication("Settings", "Fixed Rdram Address", (uint32_t)0));
|
||||||
AddHandler(Setting_Enhancement, new CSettingTypeApplication("Settings", "Enable Enhancement", (uint32_t)false));
|
AddHandler(Setting_Enhancement, new CSettingTypeApplication("Settings", "Enable Enhancement", (uint32_t)true));
|
||||||
|
|
||||||
AddHandler(Setting_RememberCheats, new CSettingTypeApplication("Settings", "Remember Cheats", (uint32_t)false));
|
AddHandler(Setting_RememberCheats, new CSettingTypeApplication("Settings", "Remember Cheats", (uint32_t)false));
|
||||||
AddHandler(Setting_UniqueSaveDir, new CSettingTypeApplication("Settings", "Unique Game Dir", true));
|
AddHandler(Setting_UniqueSaveDir, new CSettingTypeApplication("Settings", "Unique Game Dir", true));
|
||||||
|
@ -687,7 +687,6 @@ bool CSettings::Initialize(const char * BaseDirectory, const char * AppName)
|
||||||
CSettingTypeApplication::Initialize();
|
CSettingTypeApplication::Initialize();
|
||||||
CSettingTypeRomDatabase::Initialize();
|
CSettingTypeRomDatabase::Initialize();
|
||||||
CSettingTypeGame::Initialize();
|
CSettingTypeGame::Initialize();
|
||||||
CSettingTypeEnhancements::Initialize();
|
|
||||||
|
|
||||||
g_Settings->SaveString(Setting_ApplicationName, AppName);
|
g_Settings->SaveString(Setting_ApplicationName, AppName);
|
||||||
WriteTrace(TraceAppInit, TraceDebug, "Done");
|
WriteTrace(TraceAppInit, TraceDebug, "Done");
|
||||||
|
|
|
@ -78,19 +78,6 @@ void CGameSettings::RefreshGameSettings()
|
||||||
{
|
{
|
||||||
m_CountPerOp = 2;
|
m_CountPerOp = 2;
|
||||||
}
|
}
|
||||||
/*if (g_Settings->LoadBool(Setting_Enhancement))
|
|
||||||
{
|
|
||||||
for (int i = 0; i < CCheats::MaxCheats; i++)
|
|
||||||
{
|
|
||||||
std::string Name = g_Settings->LoadStringIndex(Enhancement_Name, i);
|
|
||||||
if (Name.length() == 0) { break; }
|
|
||||||
|
|
||||||
if (g_Settings->LoadBoolIndex(Enhancement_Active, i) && g_Settings->LoadBoolIndex(Enhancement_Overclock, i))
|
|
||||||
{
|
|
||||||
m_OverClockModifier = g_Settings->LoadDwordIndex(Enhancement_OverclockValue, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if (m_OverClockModifier < 1) { m_OverClockModifier = 1; }
|
if (m_OverClockModifier < 1) { m_OverClockModifier = 1; }
|
||||||
if (m_OverClockModifier > 20) { m_OverClockModifier = 20; }
|
if (m_OverClockModifier > 20) { m_OverClockModifier = 20; }
|
||||||
RefreshSyncToAudio();
|
RefreshSyncToAudio();
|
||||||
|
|
|
@ -1,168 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
* *
|
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
|
||||||
* http://www.pj64-emu.com/ *
|
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
||||||
* *
|
|
||||||
* License: *
|
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
||||||
* *
|
|
||||||
****************************************************************************/
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "SettingsType-Enhancements.h"
|
|
||||||
|
|
||||||
CIniFile * CSettingTypeEnhancements::m_EnhancementIniFile = NULL;
|
|
||||||
std::string * CSettingTypeEnhancements::m_SectionIdent = NULL;
|
|
||||||
std::string * CSettingTypeEnhancements::m_GameName = NULL;
|
|
||||||
|
|
||||||
CSettingTypeEnhancements::CSettingTypeEnhancements(const char * PostFix ) :
|
|
||||||
m_PostFix(PostFix)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CSettingTypeEnhancements::~CSettingTypeEnhancements( void )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::Initialize ( void )
|
|
||||||
{
|
|
||||||
WriteTrace(TraceAppInit, TraceDebug, "Start");
|
|
||||||
m_EnhancementIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Enhancements).c_str());
|
|
||||||
m_EnhancementIniFile->SetAutoFlush(false);
|
|
||||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
|
|
||||||
m_SectionIdent = new std::string(g_Settings->LoadStringVal(Game_IniKey));
|
|
||||||
m_GameName = new std::string(g_Settings->LoadStringVal(Game_IniKey));
|
|
||||||
GameChanged(NULL);
|
|
||||||
WriteTrace(TraceAppInit, TraceDebug, "Done");
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::CleanUp ( void )
|
|
||||||
{
|
|
||||||
if (m_EnhancementIniFile)
|
|
||||||
{
|
|
||||||
m_EnhancementIniFile->SetAutoFlush(true);
|
|
||||||
delete m_EnhancementIniFile;
|
|
||||||
m_EnhancementIniFile = NULL;
|
|
||||||
}
|
|
||||||
if (m_SectionIdent)
|
|
||||||
{
|
|
||||||
delete m_SectionIdent;
|
|
||||||
m_SectionIdent = NULL;
|
|
||||||
}
|
|
||||||
if (m_GameName)
|
|
||||||
{
|
|
||||||
delete m_GameName;
|
|
||||||
m_GameName = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::FlushChanges( void )
|
|
||||||
{
|
|
||||||
if (m_EnhancementIniFile)
|
|
||||||
{
|
|
||||||
m_EnhancementIniFile->FlushChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::GameChanged ( void * /*Data */ )
|
|
||||||
{
|
|
||||||
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
|
||||||
*m_GameName = g_Settings->LoadStringVal(Rdb_GoodName);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSettingTypeEnhancements::IsSettingSet(void) const
|
|
||||||
{
|
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSettingTypeEnhancements::Load (uint32_t Index, bool & Value ) const
|
|
||||||
{
|
|
||||||
if (m_EnhancementIniFile == NULL)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
stdstr_f Key("Enhancement%d%s", Index, m_PostFix);
|
|
||||||
uint32_t dwValue = 0;
|
|
||||||
bool bRes = m_EnhancementIniFile->GetNumber(m_SectionIdent->c_str(), Key.c_str(), 0, dwValue);
|
|
||||||
if (bRes)
|
|
||||||
{
|
|
||||||
Value = dwValue != 0;
|
|
||||||
}
|
|
||||||
return bRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSettingTypeEnhancements::Load (uint32_t Index, uint32_t & Value ) const
|
|
||||||
{
|
|
||||||
if (m_EnhancementIniFile == NULL)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
stdstr_f Key("Enhancement%d%s", Index, m_PostFix);
|
|
||||||
return m_EnhancementIniFile->GetNumber(m_SectionIdent->c_str(), Key.c_str(), 0, Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSettingTypeEnhancements::Load (uint32_t Index, std::string & Value ) const
|
|
||||||
{
|
|
||||||
if (m_EnhancementIniFile == NULL)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
stdstr_f Key("Enhancement%d%s",Index,m_PostFix);
|
|
||||||
return m_EnhancementIniFile->GetString(m_SectionIdent->c_str(),Key.c_str(),"",Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
//return the default values
|
|
||||||
void CSettingTypeEnhancements::LoadDefault (uint32_t /*Index*/, bool & /*Value*/ ) const
|
|
||||||
{
|
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::LoadDefault (uint32_t /*Index*/, uint32_t & /*Value*/ ) const
|
|
||||||
{
|
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::LoadDefault (uint32_t /*Index*/, std::string & /*Value*/ ) const
|
|
||||||
{
|
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Update the settings
|
|
||||||
void CSettingTypeEnhancements::Save (uint32_t Index, bool Value )
|
|
||||||
{
|
|
||||||
if (m_EnhancementIniFile == NULL) { return; }
|
|
||||||
|
|
||||||
stdstr_f Key("Enhancement%d%s", Index, m_PostFix);
|
|
||||||
m_EnhancementIniFile->SaveNumber(m_SectionIdent->c_str(), Key.c_str(), Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::Save (uint32_t Index, uint32_t Value )
|
|
||||||
{
|
|
||||||
if (m_EnhancementIniFile == NULL) { return; }
|
|
||||||
|
|
||||||
stdstr_f Key("Enhancement%d%s", Index, m_PostFix);
|
|
||||||
m_EnhancementIniFile->SaveNumber(m_SectionIdent->c_str(), Key.c_str(), Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::Save (uint32_t Index, const std::string & Value )
|
|
||||||
{
|
|
||||||
if (m_EnhancementIniFile == NULL) { return; }
|
|
||||||
|
|
||||||
stdstr_f Key("Enhancement%d%s",Index,m_PostFix);
|
|
||||||
m_EnhancementIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::Save (uint32_t Index, const char * Value )
|
|
||||||
{
|
|
||||||
if (m_EnhancementIniFile == NULL) { return; }
|
|
||||||
|
|
||||||
stdstr_f Key("Enhancement%d%s",Index,m_PostFix);
|
|
||||||
m_EnhancementIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingTypeEnhancements::Delete (uint32_t Index )
|
|
||||||
{
|
|
||||||
stdstr_f Key("Enhancement%d%s",Index,m_PostFix);
|
|
||||||
m_EnhancementIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),NULL);
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
* *
|
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
|
||||||
* http://www.pj64-emu.com/ *
|
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
||||||
* *
|
|
||||||
* License: *
|
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
||||||
* *
|
|
||||||
****************************************************************************/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
|
||||||
#include <Common/IniFileClass.h>
|
|
||||||
|
|
||||||
class CSettingTypeEnhancements :
|
|
||||||
public CSettingType
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CSettingTypeEnhancements(const char * PostFix );
|
|
||||||
~CSettingTypeEnhancements();
|
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
|
||||||
virtual SettingType GetSettingType ( void ) const { return SettingType_Enhancement; }
|
|
||||||
virtual bool IsSettingSet ( void ) const;
|
|
||||||
|
|
||||||
//return the values
|
|
||||||
virtual bool Load (uint32_t Index, bool & Value ) const;
|
|
||||||
virtual bool Load (uint32_t Index, uint32_t & Value ) const;
|
|
||||||
virtual bool Load (uint32_t Index, std::string & Value ) const;
|
|
||||||
|
|
||||||
//return the default values
|
|
||||||
virtual void LoadDefault (uint32_t Index, bool & Value ) const;
|
|
||||||
virtual void LoadDefault (uint32_t Index, uint32_t & Value ) const;
|
|
||||||
virtual void LoadDefault (uint32_t Index, std::string & Value ) const;
|
|
||||||
|
|
||||||
//Update the settings
|
|
||||||
virtual void Save (uint32_t Index, bool Value );
|
|
||||||
virtual void Save (uint32_t Index, uint32_t Value );
|
|
||||||
virtual void Save (uint32_t Index, const std::string & Value );
|
|
||||||
virtual void Save (uint32_t Index, const char * Value );
|
|
||||||
|
|
||||||
// Delete the setting
|
|
||||||
virtual void Delete (uint32_t Index );
|
|
||||||
|
|
||||||
// Initialize this class to use ini or registry
|
|
||||||
static void Initialize ( void );
|
|
||||||
static void CleanUp ( void );
|
|
||||||
static void FlushChanges ( void );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static CIniFile * m_EnhancementIniFile;
|
|
||||||
static std::string * m_SectionIdent;
|
|
||||||
static std::string * m_GameName;
|
|
||||||
const char * const m_PostFix;
|
|
||||||
static void GameChanged ( void * /*Data */ );
|
|
||||||
|
|
||||||
private:
|
|
||||||
CSettingTypeEnhancements(void); // Disable default constructor
|
|
||||||
CSettingTypeEnhancements(const CSettingTypeEnhancements&); // Disable copy constructor
|
|
||||||
CSettingTypeEnhancements& operator=(const CSettingTypeEnhancements&); // Disable assignment
|
|
||||||
};
|
|
|
@ -40,8 +40,10 @@ enum SettingID
|
||||||
SupportFile_CheatDirDefault,
|
SupportFile_CheatDirDefault,
|
||||||
SupportFile_UserCheatDir,
|
SupportFile_UserCheatDir,
|
||||||
SupportFile_UserCheatDirDefault,
|
SupportFile_UserCheatDirDefault,
|
||||||
SupportFile_Enhancements,
|
SupportFile_EnhancementDir,
|
||||||
SupportFile_EnhancementsDefault,
|
SupportFile_EnhancementDirDefault,
|
||||||
|
SupportFile_UserEnhancementDir,
|
||||||
|
SupportFile_UserEnhancementDirDefault,
|
||||||
SupportFile_Notes,
|
SupportFile_Notes,
|
||||||
SupportFile_NotesDefault,
|
SupportFile_NotesDefault,
|
||||||
SupportFile_ExtInfo,
|
SupportFile_ExtInfo,
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
<ClCompile Include="UserInterface\Debugger\ScriptSystem.cpp" />
|
<ClCompile Include="UserInterface\Debugger\ScriptSystem.cpp" />
|
||||||
<ClCompile Include="UserInterface\Debugger\Symbols.cpp" />
|
<ClCompile Include="UserInterface\Debugger\Symbols.cpp" />
|
||||||
<ClCompile Include="UserInterface\DiscordRPC.cpp" />
|
<ClCompile Include="UserInterface\DiscordRPC.cpp" />
|
||||||
|
<ClCompile Include="UserInterface\EnhancementUI.cpp" />
|
||||||
<ClCompile Include="UserInterface\MainWindow.cpp" />
|
<ClCompile Include="UserInterface\MainWindow.cpp" />
|
||||||
<ClCompile Include="UserInterface\LoggingUI.cpp" />
|
<ClCompile Include="UserInterface\LoggingUI.cpp" />
|
||||||
<ClCompile Include="UserInterface\MainMenu.cpp" />
|
<ClCompile Include="UserInterface\MainMenu.cpp" />
|
||||||
|
@ -158,6 +159,7 @@
|
||||||
<ClInclude Include="UserInterface\Debugger\ScriptInstance.h" />
|
<ClInclude Include="UserInterface\Debugger\ScriptInstance.h" />
|
||||||
<ClInclude Include="UserInterface\Debugger\ScriptSystem.h" />
|
<ClInclude Include="UserInterface\Debugger\ScriptSystem.h" />
|
||||||
<ClInclude Include="UserInterface\Debugger\Symbols.h" />
|
<ClInclude Include="UserInterface\Debugger\Symbols.h" />
|
||||||
|
<ClInclude Include="UserInterface\EnhancementUI.h" />
|
||||||
<ClInclude Include="UserInterface\MainWindow.h" />
|
<ClInclude Include="UserInterface\MainWindow.h" />
|
||||||
<ClInclude Include="UserInterface\LoggingUI.h" />
|
<ClInclude Include="UserInterface\LoggingUI.h" />
|
||||||
<ClInclude Include="UserInterface\MainMenu.h" />
|
<ClInclude Include="UserInterface\MainMenu.h" />
|
||||||
|
|
|
@ -249,6 +249,9 @@
|
||||||
<ClCompile Include="UserInterface\About.cpp">
|
<ClCompile Include="UserInterface\About.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="UserInterface\EnhancementUI.cpp">
|
||||||
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="UserInterface\resource.h">
|
<ClInclude Include="UserInterface\resource.h">
|
||||||
|
@ -482,6 +485,9 @@
|
||||||
<ClInclude Include="UserInterface\About.h">
|
<ClInclude Include="UserInterface\About.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="UserInterface\EnhancementUI.h">
|
||||||
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="res\divider.cur">
|
<None Include="res\divider.cur">
|
||||||
|
|
|
@ -402,7 +402,7 @@ void CCheatList::RefreshItems()
|
||||||
if (m_hWnd == NULL) { return; }
|
if (m_hWnd == NULL) { return; }
|
||||||
|
|
||||||
m_DeleteingEntries = true;
|
m_DeleteingEntries = true;
|
||||||
TreeView_DeleteAllItems(m_hCheatTree);
|
m_hCheatTree.DeleteAllItems();
|
||||||
m_DeleteingEntries = false;
|
m_DeleteingEntries = false;
|
||||||
|
|
||||||
for (CEnhancementList::iterator itr = m_Cheats.begin(); itr != m_Cheats.end(); itr++)
|
for (CEnhancementList::iterator itr = m_Cheats.begin(); itr != m_Cheats.end(); itr++)
|
||||||
|
@ -421,7 +421,7 @@ void CCheatList::AddCodeLayers(LPARAM Enhancement, const std::wstring &Name, HTR
|
||||||
TV_INSERTSTRUCT tv;
|
TV_INSERTSTRUCT tv;
|
||||||
|
|
||||||
wchar_t Text[500], Item[500];
|
wchar_t Text[500], Item[500];
|
||||||
if (Name.length() > (sizeof(Text) - 5)) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
if (Name.length() > ((sizeof(Text) / sizeof(Text[0])) - 5)) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||||
wcscpy(Text, Name.c_str());
|
wcscpy(Text, Name.c_str());
|
||||||
if (wcschr(Text, L'\\') > 0) { *wcschr(Text, L'\\') = 0; }
|
if (wcschr(Text, L'\\') > 0) { *wcschr(Text, L'\\') = 0; }
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,465 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* *
|
||||||
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
|
* http://www.pj64-emu.com/ *
|
||||||
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
|
* *
|
||||||
|
* License: *
|
||||||
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include <Project64\UserInterface\EnhancementUI.h>
|
||||||
|
#include <Project64-core\N64System\Enhancement\Enhancements.h>
|
||||||
|
|
||||||
|
class CEditEnhancement :
|
||||||
|
public CDialogImpl < CEditEnhancement >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BEGIN_MSG_MAP_EX(CEditEnhancement)
|
||||||
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
|
COMMAND_HANDLER_EX(IDC_GAMESHARK, BN_CLICKED, OnGamesharkBtn)
|
||||||
|
COMMAND_ID_HANDLER(IDC_BTN_GAMESHARK, OnEditGameshark)
|
||||||
|
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
|
||||||
|
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||||
|
END_MSG_MAP()
|
||||||
|
|
||||||
|
enum { IDD = IDD_Enhancement_Edit };
|
||||||
|
|
||||||
|
CEditEnhancement(CEnhancementUI & EnhancementUI, CEnhancement * Enhancement);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CEditEnhancement(void);
|
||||||
|
CEditEnhancement(const CEditEnhancement&);
|
||||||
|
CEditEnhancement& operator=(const CEditEnhancement&);
|
||||||
|
|
||||||
|
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
|
LRESULT OnGamesharkBtn(UINT Code, int id, HWND ctl);
|
||||||
|
LRESULT OnEditGameshark(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
||||||
|
LRESULT OnOkCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
||||||
|
LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
||||||
|
|
||||||
|
CEnhancementUI & m_EnhancementUI;
|
||||||
|
CEnhancement::CodeEntries m_Entries;
|
||||||
|
CEnhancement * m_EditEnhancement;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CEditGS :
|
||||||
|
public CDialogImpl < CEditGS >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BEGIN_MSG_MAP_EX(CEditGS)
|
||||||
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
|
COMMAND_HANDLER(IDC_CHEAT_CODES, EN_CHANGE, OnCheatChanged)
|
||||||
|
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
|
||||||
|
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||||
|
END_MSG_MAP()
|
||||||
|
|
||||||
|
enum { IDD = IDD_Enhancement_GS };
|
||||||
|
|
||||||
|
CEditGS(CEnhancement::CodeEntries & Entries);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CEditGS();
|
||||||
|
CEditGS(const CEditGS&);
|
||||||
|
CEditGS& operator=(const CEditGS&);
|
||||||
|
|
||||||
|
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
|
||||||
|
LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
|
||||||
|
LRESULT OnOkCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
|
||||||
|
LRESULT OnCheatChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
|
||||||
|
|
||||||
|
bool CheatCode(CEnhancement::CodeEntries & Entries);
|
||||||
|
|
||||||
|
CEnhancement::CodeEntries & m_Entries;
|
||||||
|
};
|
||||||
|
|
||||||
|
CEnhancementUI::CEnhancementUI(void) :
|
||||||
|
m_hSelectedItem(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEnhancementUI::Display(HWND hParent, bool BlockExecution)
|
||||||
|
{
|
||||||
|
if (g_BaseSystem)
|
||||||
|
{
|
||||||
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_Enhancement);
|
||||||
|
}
|
||||||
|
if (BlockExecution)
|
||||||
|
{
|
||||||
|
m_bModal = true;
|
||||||
|
DoModal(hParent);
|
||||||
|
}
|
||||||
|
else if (m_hWnd != NULL)
|
||||||
|
{
|
||||||
|
SetFocus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_bModal = false;
|
||||||
|
Create(hParent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEnhancementUI::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
SetWindowText(wGS(CHEAT_TITLE).c_str());
|
||||||
|
|
||||||
|
m_TreeList.Attach(GetDlgItem(IDC_ENHANCEMENTLIST));
|
||||||
|
LONG Style = m_TreeList.GetWindowLong(GWL_STYLE);
|
||||||
|
m_TreeList.SetWindowLong(GWL_STYLE, TVS_CHECKBOXES | TVS_SHOWSELALWAYS | Style);
|
||||||
|
|
||||||
|
HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 40, 40);
|
||||||
|
HBITMAP hBmp = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_TRI_STATE));
|
||||||
|
ImageList_AddMasked(hImageList, hBmp, RGB(255, 0, 255));
|
||||||
|
DeleteObject(hBmp);
|
||||||
|
m_TreeList.SetImageList(hImageList, TVSIL_STATE);
|
||||||
|
|
||||||
|
m_Enhancements = g_Enhancements->Enhancements();
|
||||||
|
RefreshList();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEnhancementUI::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
EndDialog(wID);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEnhancementUI::OnAddEnhancement(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
CEditEnhancement(*this, nullptr).DoModal(m_hWnd);
|
||||||
|
RefreshList();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEnhancementUI::OnEnhancementListRClicked(NMHDR* pNMHDR)
|
||||||
|
{
|
||||||
|
TVHITTESTINFO ht = { 0 };
|
||||||
|
uint32_t dwpos = GetMessagePos();
|
||||||
|
ht.pt.x = GET_X_LPARAM(dwpos);
|
||||||
|
ht.pt.y = GET_Y_LPARAM(dwpos);
|
||||||
|
::MapWindowPoints(HWND_DESKTOP, pNMHDR->hwndFrom, &ht.pt, 1);
|
||||||
|
|
||||||
|
TreeView_HitTest(pNMHDR->hwndFrom, &ht);
|
||||||
|
m_hSelectedItem = ht.hItem;
|
||||||
|
|
||||||
|
POINT Mouse;
|
||||||
|
GetCursorPos(&Mouse);
|
||||||
|
HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_ENHANCEMENT_MENU));
|
||||||
|
HMENU hPopupMenu = GetSubMenu(hMenu, 0);
|
||||||
|
|
||||||
|
if (m_hSelectedItem == NULL)
|
||||||
|
{
|
||||||
|
RemoveMenu(hPopupMenu, 3, MF_BYPOSITION);
|
||||||
|
RemoveMenu(hPopupMenu, 2, MF_BYPOSITION);
|
||||||
|
RemoveMenu(hPopupMenu, 1, MF_BYPOSITION);
|
||||||
|
}
|
||||||
|
|
||||||
|
TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, NULL);
|
||||||
|
DestroyMenu(hMenu);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEnhancementUI::OnEnhancementListDClicked(NMHDR* pNMHDR)
|
||||||
|
{
|
||||||
|
uint32_t dwpos = GetMessagePos();
|
||||||
|
TVHITTESTINFO ht = { 0 };
|
||||||
|
ht.pt.x = GET_X_LPARAM(dwpos);
|
||||||
|
ht.pt.y = GET_Y_LPARAM(dwpos);
|
||||||
|
::MapWindowPoints(HWND_DESKTOP, pNMHDR->hwndFrom, &ht.pt, 1);
|
||||||
|
|
||||||
|
TreeView_HitTest(pNMHDR->hwndFrom, &ht);
|
||||||
|
|
||||||
|
if ((ht.flags & TVHT_ONITEMLABEL) == 0 || ht.hItem == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
TVITEM item = { 0 };
|
||||||
|
item.mask = TVIF_PARAM;
|
||||||
|
item.hItem = (HTREEITEM)ht.hItem;
|
||||||
|
if (!m_TreeList.GetItem(&item) || item.lParam == NULL)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEditEnhancement(*this, (CEnhancement *)item.lParam).DoModal(m_hWnd);
|
||||||
|
RefreshList();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEnhancementUI::AddCodeLayers(LPARAM Enhancement, const std::wstring & Name, HTREEITEM hParent, bool Active)
|
||||||
|
{
|
||||||
|
TV_INSERTSTRUCT tv;
|
||||||
|
|
||||||
|
wchar_t Text[500], Item[500];
|
||||||
|
if (Name.length() > ((sizeof(Text) / sizeof(Text[0])) - 5)) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||||
|
wcscpy(Text, Name.c_str());
|
||||||
|
if (wcschr(Text, L'\\') > 0) { *wcschr(Text, L'\\') = 0; }
|
||||||
|
|
||||||
|
tv.item.mask = TVIF_TEXT;
|
||||||
|
tv.item.pszText = Item;
|
||||||
|
tv.item.cchTextMax = sizeof(Item);
|
||||||
|
tv.item.hItem = m_TreeList.GetChildItem(hParent);
|
||||||
|
while (tv.item.hItem)
|
||||||
|
{
|
||||||
|
m_TreeList.GetItem(&tv.item);
|
||||||
|
if (wcscmp(Text, Item) == 0)
|
||||||
|
{
|
||||||
|
TV_CHECK_STATE State = TV_GetCheckState(tv.item.hItem);
|
||||||
|
if ((Active && State == TV_STATE_CLEAR) || (!Active && State == TV_STATE_CHECKED))
|
||||||
|
{
|
||||||
|
TV_SetCheckState(tv.item.hItem, TV_STATE_INDETERMINATE);
|
||||||
|
}
|
||||||
|
size_t StartPos = wcslen(Text) + 1;
|
||||||
|
std::wstring TempCheatName;
|
||||||
|
if (StartPos < Name.length())
|
||||||
|
{
|
||||||
|
TempCheatName = Name.substr(StartPos);
|
||||||
|
}
|
||||||
|
AddCodeLayers(Enhancement, TempCheatName, tv.item.hItem, Active);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tv.item.hItem = m_TreeList.GetNextSiblingItem(tv.item.hItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
tv.hInsertAfter = TVI_SORT;
|
||||||
|
tv.item.mask = TVIF_TEXT | TVIF_PARAM;
|
||||||
|
tv.item.pszText = Text;
|
||||||
|
tv.item.lParam = Enhancement;
|
||||||
|
tv.hParent = hParent;
|
||||||
|
hParent = m_TreeList.InsertItem(&tv);
|
||||||
|
TV_SetCheckState(hParent, Active ? TV_STATE_CHECKED : TV_STATE_CLEAR);
|
||||||
|
|
||||||
|
if (wcscmp(Text, Name.c_str()) == 0) { return; }
|
||||||
|
AddCodeLayers(Enhancement, Name.substr(wcslen(Text) + 1), hParent, Active);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEnhancementUI::RefreshList()
|
||||||
|
{
|
||||||
|
m_TreeList.DeleteAllItems();
|
||||||
|
for (CEnhancementList::iterator itr = m_Enhancements.begin(); itr != m_Enhancements.end(); itr++)
|
||||||
|
{
|
||||||
|
std::string Name = itr->second.GetNameAndExtension();
|
||||||
|
if (Name.length() == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
AddCodeLayers((LPARAM)&itr->second, stdstr(Name).ToUTF16(), TVI_ROOT, itr->second.Active());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEnhancementUI::TV_CHECK_STATE CEnhancementUI::TV_GetCheckState(HTREEITEM hItem)
|
||||||
|
{
|
||||||
|
TVITEM tvItem = { 0 };
|
||||||
|
tvItem.mask = TVIF_HANDLE | TVIF_STATE;
|
||||||
|
tvItem.hItem = hItem;
|
||||||
|
tvItem.stateMask = TVIS_STATEIMAGEMASK;
|
||||||
|
|
||||||
|
m_TreeList.GetItem(&tvItem);
|
||||||
|
|
||||||
|
switch (tvItem.state >> 12)
|
||||||
|
{
|
||||||
|
case 1: return TV_STATE_CHECKED;
|
||||||
|
case 2: return TV_STATE_CLEAR;
|
||||||
|
case 3: return TV_STATE_INDETERMINATE;
|
||||||
|
}
|
||||||
|
return TV_STATE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEnhancementUI::TV_SetCheckState(HTREEITEM hItem, TV_CHECK_STATE state)
|
||||||
|
{
|
||||||
|
TVITEM tvItem = { 0 };
|
||||||
|
tvItem.mask = TVIF_HANDLE | TVIF_STATE;
|
||||||
|
tvItem.hItem = (HTREEITEM)hItem;
|
||||||
|
tvItem.stateMask = TVIS_STATEIMAGEMASK;
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case TV_STATE_CHECKED: tvItem.state = INDEXTOSTATEIMAGEMASK(1); break;
|
||||||
|
case TV_STATE_CLEAR: tvItem.state = INDEXTOSTATEIMAGEMASK(2); break;
|
||||||
|
case TV_STATE_INDETERMINATE: tvItem.state = INDEXTOSTATEIMAGEMASK(3); break;
|
||||||
|
default: tvItem.state = INDEXTOSTATEIMAGEMASK(0); break;
|
||||||
|
}
|
||||||
|
return m_TreeList.SetItem(&tvItem) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEditEnhancement::CEditEnhancement(CEnhancementUI & EnhancementUI, CEnhancement * Enhancement) :
|
||||||
|
m_EnhancementUI(EnhancementUI),
|
||||||
|
m_EditEnhancement(Enhancement)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEditEnhancement::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
m_Entries = m_EditEnhancement != nullptr ? m_EditEnhancement->GetEntries() : CEnhancement::CodeEntries();
|
||||||
|
GetDlgItem(IDC_OVERCLOCK).EnableWindow(false);
|
||||||
|
GetDlgItem(IDC_OVER_CLOCK_MODIFIER).EnableWindow(false);
|
||||||
|
GetDlgItem(IDC_CODE_NAME).SetWindowText(m_EditEnhancement != nullptr ? stdstr(m_EditEnhancement->GetName()).ToUTF16().c_str() : L"");
|
||||||
|
GetDlgItem(IDC_NOTES).SetWindowText(m_EditEnhancement != nullptr ? stdstr(m_EditEnhancement->GetNote()).ToUTF16().c_str() : L"");
|
||||||
|
CButton(GetDlgItem(IDC_AUTOON)).SetCheck(m_EditEnhancement != nullptr ? (m_EditEnhancement->GetOnByDefault() ? BST_CHECKED : BST_UNCHECKED) : BST_UNCHECKED);
|
||||||
|
CButton(GetDlgItem(IDC_GAMESHARK)).SetCheck(m_Entries.size() > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEditEnhancement::OnGamesharkBtn(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
CButton(GetDlgItem(IDC_GAMESHARK)).SetCheck(m_Entries.size() > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
CEditGS(m_Entries).DoModal(m_hWnd);
|
||||||
|
CButton(GetDlgItem(IDC_GAMESHARK)).SetCheck(m_Entries.size() > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEditEnhancement::OnEditGameshark(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
OnGamesharkBtn(0, 0, 0);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEditEnhancement::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
EndDialog(wID);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEditEnhancement::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
CEnhancementList & Enhancements = m_EnhancementUI.m_Enhancements;
|
||||||
|
if (m_EditEnhancement != nullptr)
|
||||||
|
{
|
||||||
|
m_EditEnhancement->SetName(GetCWindowText(GetDlgItem(IDC_CODE_NAME)).c_str());
|
||||||
|
m_EditEnhancement->SetOnByDefault(CButton(GetDlgItem(IDC_AUTOON)).GetCheck() == BST_CHECKED);
|
||||||
|
m_EditEnhancement->SetEntries(m_Entries);
|
||||||
|
m_EditEnhancement->SetNote(GetCWindowText(GetDlgItem(IDC_NOTES)).c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CEnhancement Enhancement("Enhancement");
|
||||||
|
Enhancement.SetName(GetCWindowText(GetDlgItem(IDC_CODE_NAME)).c_str());
|
||||||
|
Enhancement.SetOnByDefault(CButton(GetDlgItem(IDC_AUTOON)).GetCheck() == BST_CHECKED);
|
||||||
|
Enhancement.SetEntries(m_Entries);
|
||||||
|
Enhancement.SetNote(GetCWindowText(GetDlgItem(IDC_NOTES)).c_str());
|
||||||
|
Enhancements.AddItem(Enhancement);
|
||||||
|
}
|
||||||
|
g_Enhancements->UpdateEnhancements(Enhancements);
|
||||||
|
m_EnhancementUI.RefreshList();
|
||||||
|
EndDialog(wID);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CEditGS::CEditGS(CEnhancement::CodeEntries & Entries) :
|
||||||
|
m_Entries(Entries)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEditGS::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
stdstr Buffer;
|
||||||
|
for (size_t i = 0, n = m_Entries.size(); i < n; i++)
|
||||||
|
{
|
||||||
|
const CEnhancement::CodeEntry Entry = m_Entries[i];
|
||||||
|
if (!Buffer.empty())
|
||||||
|
{
|
||||||
|
Buffer.append("\r\n");
|
||||||
|
}
|
||||||
|
Buffer += stdstr_f("%08X %s", Entry.Command, Entry.Value.c_str());
|
||||||
|
}
|
||||||
|
CEdit CheatCodes(GetDlgItem(IDC_CHEAT_CODES));
|
||||||
|
CheatCodes.SetWindowText(Buffer.ToUTF16().c_str());
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEditGS::OnCheatChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
CEnhancement::CodeEntries Entries;
|
||||||
|
GetDlgItem(IDOK).EnableWindow(CheatCode(Entries));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEditGS::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
CEnhancement::CodeEntries Entries;
|
||||||
|
if (CheatCode(Entries))
|
||||||
|
{
|
||||||
|
m_Entries = Entries;
|
||||||
|
EndDialog(wID);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CEditGS::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
EndDialog(wID);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEditGS::CheatCode(CEnhancement::CodeEntries & Entries)
|
||||||
|
{
|
||||||
|
Entries.clear();
|
||||||
|
|
||||||
|
bool ValidCode = true;
|
||||||
|
CEdit CheatCodes(GetDlgItem(IDC_CHEAT_CODES));
|
||||||
|
uint32_t numlines = CheatCodes.GetLineCount();
|
||||||
|
|
||||||
|
for (uint32_t line = 0; line < numlines; line++)
|
||||||
|
{
|
||||||
|
const char * formatnormal = "XXXXXXXX XXXX";
|
||||||
|
|
||||||
|
wchar_t wstr[128] = { 0 };
|
||||||
|
*(LPWORD)wstr = sizeof(wstr) / sizeof(wstr[0]);
|
||||||
|
uint32_t len = CheatCodes.GetLine(line, wstr);
|
||||||
|
wstr[len] = 0;
|
||||||
|
|
||||||
|
if (len <= 0) { continue; }
|
||||||
|
|
||||||
|
std::string str = stdstr().FromUTF16(wstr);
|
||||||
|
char tempformat[128] = { 0 };
|
||||||
|
for (uint32_t i = 0; i < sizeof(tempformat); i++)
|
||||||
|
{
|
||||||
|
if (isxdigit(str[i]))
|
||||||
|
{
|
||||||
|
tempformat[i] = 'X';
|
||||||
|
}
|
||||||
|
if (str[i] == ' ')
|
||||||
|
{
|
||||||
|
tempformat[i] = str[i];
|
||||||
|
}
|
||||||
|
if (str[i] == 0) { break; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(tempformat, formatnormal) == 0)
|
||||||
|
{
|
||||||
|
CEnhancement::CodeEntry Entry;
|
||||||
|
Entry.Command = strtoul(str.c_str(), 0, 16);
|
||||||
|
const char * ReadPos = strchr(str.c_str(), ' ');
|
||||||
|
if (ReadPos != nullptr)
|
||||||
|
{
|
||||||
|
Entry.Value = ReadPos + 1;
|
||||||
|
Entries.push_back(Entry);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ValidCode = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ValidCode = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ValidCode && Entries.size() > 0)
|
||||||
|
{
|
||||||
|
CEnhancement Item("");
|
||||||
|
Item.SetName("Test");
|
||||||
|
Item.SetEntries(Entries);
|
||||||
|
if (!Item.Valid() || Item.CodeOptionSize() != 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ValidCode;
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* *
|
||||||
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
|
* http://www.pj64-emu.com/ *
|
||||||
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
|
* *
|
||||||
|
* License: *
|
||||||
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
#pragma once
|
||||||
|
#include <Project64\WTLApp.h>
|
||||||
|
|
||||||
|
class CEditEnhancement;
|
||||||
|
|
||||||
|
class CEnhancementUI :
|
||||||
|
public CDialogImpl<CEnhancementUI>
|
||||||
|
{
|
||||||
|
enum TV_CHECK_STATE
|
||||||
|
{
|
||||||
|
TV_STATE_UNKNOWN,
|
||||||
|
TV_STATE_CLEAR,
|
||||||
|
TV_STATE_CHECKED,
|
||||||
|
TV_STATE_INDETERMINATE
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
BEGIN_MSG_MAP_EX(CEnhancementUI)
|
||||||
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
|
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||||
|
COMMAND_ID_HANDLER(ID_POPUP_ADDENHANCEMENT, OnAddEnhancement)
|
||||||
|
NOTIFY_HANDLER_EX(IDC_ENHANCEMENTLIST, NM_RCLICK, OnEnhancementListRClicked)
|
||||||
|
NOTIFY_HANDLER_EX(IDC_ENHANCEMENTLIST, NM_DBLCLK, OnEnhancementListDClicked)
|
||||||
|
END_MSG_MAP()
|
||||||
|
|
||||||
|
enum { IDD = IDD_Enhancement_Config };
|
||||||
|
|
||||||
|
CEnhancementUI();
|
||||||
|
|
||||||
|
void Display(HWND hParent, bool BlockExecution);
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend CEditEnhancement;
|
||||||
|
|
||||||
|
CEnhancementUI(const CEnhancementUI&);
|
||||||
|
CEnhancementUI& operator=(const CEnhancementUI&);
|
||||||
|
|
||||||
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
|
LRESULT OnAddEnhancement(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||||
|
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||||
|
LRESULT OnEnhancementListRClicked(NMHDR* pNMHDR);
|
||||||
|
LRESULT OnEnhancementListDClicked(NMHDR* pNMHDR);
|
||||||
|
|
||||||
|
void AddCodeLayers(LPARAM ListID, const std::wstring &Name, HTREEITEM hParent, bool Active);
|
||||||
|
void RefreshList(void);
|
||||||
|
TV_CHECK_STATE TV_GetCheckState(HTREEITEM hItem);
|
||||||
|
bool TV_SetCheckState(HTREEITEM hItem, TV_CHECK_STATE state);
|
||||||
|
|
||||||
|
CEnhancementList m_Enhancements;
|
||||||
|
CTreeViewCtrl m_TreeList;
|
||||||
|
HTREEITEM m_hSelectedItem;
|
||||||
|
};
|
|
@ -54,7 +54,6 @@ CMainMenu::CMainMenu(CMainGui * hMainWindow) :
|
||||||
m_ChangeSettingList.push_back(Debugger_AppLogFlush);
|
m_ChangeSettingList.push_back(Debugger_AppLogFlush);
|
||||||
m_ChangeSettingList.push_back(Game_CurrentSaveState);
|
m_ChangeSettingList.push_back(Game_CurrentSaveState);
|
||||||
m_ChangeSettingList.push_back(Setting_CurrentLanguage);
|
m_ChangeSettingList.push_back(Setting_CurrentLanguage);
|
||||||
m_ChangeSettingList.push_back(Setting_Enhancement);
|
|
||||||
|
|
||||||
for (UISettingList::const_iterator iter = m_ChangeUISettingList.begin(); iter != m_ChangeUISettingList.end(); iter++)
|
for (UISettingList::const_iterator iter = m_ChangeUISettingList.begin(); iter != m_ChangeUISettingList.end(); iter++)
|
||||||
{
|
{
|
||||||
|
@ -509,9 +508,6 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
||||||
case ID_DEBUG_DISABLE_GAMEFIX:
|
case ID_DEBUG_DISABLE_GAMEFIX:
|
||||||
g_Settings->SaveBool(Debugger_DisableGameFixes, !g_Settings->LoadBool(Debugger_DisableGameFixes));
|
g_Settings->SaveBool(Debugger_DisableGameFixes, !g_Settings->LoadBool(Debugger_DisableGameFixes));
|
||||||
break;
|
break;
|
||||||
case ID_DEBUG_ENANCEMENT:
|
|
||||||
g_Settings->SaveBool(Setting_Enhancement, !g_Settings->LoadBool(Setting_Enhancement));
|
|
||||||
break;
|
|
||||||
case ID_DEBUGGER_TRACE_MD5: SetTraceModuleSetttings(Debugger_TraceMD5); break;
|
case ID_DEBUGGER_TRACE_MD5: SetTraceModuleSetttings(Debugger_TraceMD5); break;
|
||||||
case ID_DEBUGGER_TRACE_SETTINGS: SetTraceModuleSetttings(Debugger_TraceSettings); break;
|
case ID_DEBUGGER_TRACE_SETTINGS: SetTraceModuleSetttings(Debugger_TraceSettings); break;
|
||||||
case ID_DEBUGGER_TRACE_UNKNOWN: SetTraceModuleSetttings(Debugger_TraceUnknown); break;
|
case ID_DEBUGGER_TRACE_UNKNOWN: SetTraceModuleSetttings(Debugger_TraceUnknown); break;
|
||||||
|
@ -1246,12 +1242,6 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
|
||||||
DebugMenu.push_back(Item);
|
DebugMenu.push_back(Item);
|
||||||
Item.Reset(SUB_MENU, EMPTY_STRING, EMPTY_STDSTR, &DebugNotificationMenu, L"Notification");
|
Item.Reset(SUB_MENU, EMPTY_STRING, EMPTY_STDSTR, &DebugNotificationMenu, L"Notification");
|
||||||
DebugMenu.push_back(Item);
|
DebugMenu.push_back(Item);
|
||||||
Item.Reset(ID_DEBUG_ENANCEMENT, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Enable Enhancement");
|
|
||||||
if (g_Settings->LoadBool(Setting_Enhancement))
|
|
||||||
{
|
|
||||||
Item.SetItemTicked(true);
|
|
||||||
}
|
|
||||||
DebugMenu.push_back(Item);
|
|
||||||
DebugMenu.push_back(MENU_ITEM(SPLITER));
|
DebugMenu.push_back(MENU_ITEM(SPLITER));
|
||||||
Item.Reset(ID_DEBUG_SHOW_TLB_MISSES, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Show TLB Misses");
|
Item.Reset(ID_DEBUG_SHOW_TLB_MISSES, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Show TLB Misses");
|
||||||
if (g_Settings->LoadBool(Debugger_ShowTLBMisses))
|
if (g_Settings->LoadBool(Debugger_ShowTLBMisses))
|
||||||
|
|
|
@ -40,7 +40,7 @@ enum MainMenuID
|
||||||
ID_DEBUGGER_TLBENTRIES, ID_DEBUGGER_BREAKPOINTS, ID_DEBUGGER_MEMORY, ID_DEBUGGER_R4300REGISTERS,
|
ID_DEBUGGER_TLBENTRIES, ID_DEBUGGER_BREAKPOINTS, ID_DEBUGGER_MEMORY, ID_DEBUGGER_R4300REGISTERS,
|
||||||
ID_DEBUGGER_INTERRUPT_SP, ID_DEBUGGER_INTERRUPT_SI, ID_DEBUGGER_INTERRUPT_AI, ID_DEBUGGER_INTERRUPT_VI,
|
ID_DEBUGGER_INTERRUPT_SP, ID_DEBUGGER_INTERRUPT_SI, ID_DEBUGGER_INTERRUPT_AI, ID_DEBUGGER_INTERRUPT_VI,
|
||||||
ID_DEBUGGER_INTERRUPT_PI, ID_DEBUGGER_INTERRUPT_DP, ID_DEBUGGER_SCRIPTS, ID_DEBUGGER_SYMBOLS, ID_DEBUGGER_DMALOG,
|
ID_DEBUGGER_INTERRUPT_PI, ID_DEBUGGER_INTERRUPT_DP, ID_DEBUGGER_SCRIPTS, ID_DEBUGGER_SYMBOLS, ID_DEBUGGER_DMALOG,
|
||||||
ID_DEBUGGER_EXCBREAKPOINTS, ID_DEBUGGER_CPULOG, ID_DEBUGGER_STACKTRACE, ID_DEBUGGER_STACKVIEW, ID_DEBUG_ENANCEMENT,
|
ID_DEBUGGER_EXCBREAKPOINTS, ID_DEBUGGER_CPULOG, ID_DEBUGGER_STACKTRACE, ID_DEBUGGER_STACKVIEW,
|
||||||
|
|
||||||
// App logging
|
// App logging
|
||||||
ID_DEBUGGER_APPLOG_FLUSH, ID_DEBUGGER_TRACE_MD5, ID_DEBUGGER_TRACE_SETTINGS, ID_DEBUGGER_TRACE_UNKNOWN, ID_DEBUGGER_TRACE_APPINIT,
|
ID_DEBUGGER_APPLOG_FLUSH, ID_DEBUGGER_TRACE_MD5, ID_DEBUGGER_TRACE_SETTINGS, ID_DEBUGGER_TRACE_UNKNOWN, ID_DEBUGGER_TRACE_APPINIT,
|
||||||
|
|
|
@ -945,6 +945,10 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
|
||||||
{
|
{
|
||||||
_this->m_CheatsUI.Display(hWnd, true);
|
_this->m_CheatsUI.Display(hWnd, true);
|
||||||
}
|
}
|
||||||
|
else if (LOWORD(wParam) == ID_POPUPMENU_CHOOSEENHANCEMENT)
|
||||||
|
{
|
||||||
|
_this->m_EnhancementUI.Display(hWnd, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (g_Rom)
|
if (g_Rom)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <Project64/UserInterface/Debugger/debugger.h>
|
#include <Project64/UserInterface/Debugger/debugger.h>
|
||||||
#include <Project64-core/Plugins/PluginClass.h>
|
#include <Project64-core/Plugins/PluginClass.h>
|
||||||
#include <Project64\UserInterface\CheatClassUI.h>
|
#include <Project64\UserInterface\CheatClassUI.h>
|
||||||
|
#include <Project64\UserInterface\EnhancementUI.h>
|
||||||
#include <Project64\UserInterface\ProjectSupport.h>
|
#include <Project64\UserInterface\ProjectSupport.h>
|
||||||
|
|
||||||
class CGfxPlugin; //Plugin that controls the rendering
|
class CGfxPlugin; //Plugin that controls the rendering
|
||||||
|
@ -117,6 +118,7 @@ private:
|
||||||
HWND m_hMainWindow, m_hStatusWnd;
|
HWND m_hMainWindow, m_hStatusWnd;
|
||||||
DWORD m_ThreadId;
|
DWORD m_ThreadId;
|
||||||
CCheatsUI m_CheatsUI;
|
CCheatsUI m_CheatsUI;
|
||||||
|
CEnhancementUI m_EnhancementUI;
|
||||||
CProjectSupport m_Support;
|
CProjectSupport m_Support;
|
||||||
|
|
||||||
const bool m_bMainWindow;
|
const bool m_bMainWindow;
|
||||||
|
|
|
@ -25,6 +25,7 @@ m_SettingsConfig(SettingsConfig)
|
||||||
SetDlgItemText(IDC_LOAD_FULLSCREEN, wGS(OPTION_AUTO_FULLSCREEN).c_str());
|
SetDlgItemText(IDC_LOAD_FULLSCREEN, wGS(OPTION_AUTO_FULLSCREEN).c_str());
|
||||||
SetDlgItemText(IDC_SCREEN_SAVER, wGS(OPTION_DISABLE_SS).c_str());
|
SetDlgItemText(IDC_SCREEN_SAVER, wGS(OPTION_DISABLE_SS).c_str());
|
||||||
SetDlgItemText(IDC_BASIC_MODE, wGS(OPTION_BASIC_MODE).c_str());
|
SetDlgItemText(IDC_BASIC_MODE, wGS(OPTION_BASIC_MODE).c_str());
|
||||||
|
SetDlgItemText(IDC_ENABLE_ENHANCEMENTS, wGS(OPTION_ENABLE_ENHANCEMENTS).c_str());
|
||||||
SetDlgItemText(IDC_MAXROMS_TXT, wGS(RB_MAX_ROMS).c_str());
|
SetDlgItemText(IDC_MAXROMS_TXT, wGS(RB_MAX_ROMS).c_str());
|
||||||
SetDlgItemText(IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str());
|
SetDlgItemText(IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str());
|
||||||
SetDlgItemText(IDC_MAXROMDIR_TXT, wGS(RB_MAX_DIRS).c_str());
|
SetDlgItemText(IDC_MAXROMDIR_TXT, wGS(RB_MAX_DIRS).c_str());
|
||||||
|
@ -35,6 +36,7 @@ m_SettingsConfig(SettingsConfig)
|
||||||
AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN), Setting_AutoFullscreen);
|
AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN), Setting_AutoFullscreen);
|
||||||
AddModCheckBox(GetDlgItem(IDC_SCREEN_SAVER), Setting_DisableScrSaver);
|
AddModCheckBox(GetDlgItem(IDC_SCREEN_SAVER), Setting_DisableScrSaver);
|
||||||
AddModCheckBox(GetDlgItem(IDC_DISCORD_RPC), Setting_EnableDiscordRPC);
|
AddModCheckBox(GetDlgItem(IDC_DISCORD_RPC), Setting_EnableDiscordRPC);
|
||||||
|
AddModCheckBox(GetDlgItem(IDC_ENABLE_ENHANCEMENTS), Setting_Enhancement);
|
||||||
AddModCheckBox(GetDlgItem(IDC_BASIC_MODE), UserInterface_BasicMode);
|
AddModCheckBox(GetDlgItem(IDC_BASIC_MODE), UserInterface_BasicMode);
|
||||||
|
|
||||||
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBER), File_RecentGameFileCount, false);
|
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_REMEMBER), File_RecentGameFileCount, false);
|
||||||
|
|
|
@ -20,6 +20,7 @@ class CGeneralOptionsPage :
|
||||||
COMMAND_ID_HANDLER_EX(IDC_LOAD_FULLSCREEN,CheckBoxChanged)
|
COMMAND_ID_HANDLER_EX(IDC_LOAD_FULLSCREEN,CheckBoxChanged)
|
||||||
COMMAND_ID_HANDLER_EX(IDC_SCREEN_SAVER,CheckBoxChanged)
|
COMMAND_ID_HANDLER_EX(IDC_SCREEN_SAVER,CheckBoxChanged)
|
||||||
COMMAND_ID_HANDLER_EX(IDC_DISCORD_RPC, CheckBoxChanged)
|
COMMAND_ID_HANDLER_EX(IDC_DISCORD_RPC, CheckBoxChanged)
|
||||||
|
COMMAND_ID_HANDLER_EX(IDC_ENABLE_ENHANCEMENTS, CheckBoxChanged)
|
||||||
COMMAND_ID_HANDLER_EX(IDC_BASIC_MODE,OnBasicMode)
|
COMMAND_ID_HANDLER_EX(IDC_BASIC_MODE,OnBasicMode)
|
||||||
COMMAND_HANDLER_EX(IDC_REMEMBER,EN_UPDATE,EditBoxChanged)
|
COMMAND_HANDLER_EX(IDC_REMEMBER,EN_UPDATE,EditBoxChanged)
|
||||||
COMMAND_HANDLER_EX(IDC_REMEMBERDIR,EN_UPDATE,EditBoxChanged)
|
COMMAND_HANDLER_EX(IDC_REMEMBERDIR,EN_UPDATE,EditBoxChanged)
|
||||||
|
|
|
@ -155,18 +155,19 @@ BEGIN
|
||||||
CONTROL "Pause emulation when window is not active?",IDC_AUTOSLEEP,
|
CONTROL "Pause emulation when window is not active?",IDC_AUTOSLEEP,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,9,206,10
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,9,206,10
|
||||||
CONTROL "On loading a ROM go to full screen",IDC_LOAD_FULLSCREEN,
|
CONTROL "On loading a ROM go to full screen",IDC_LOAD_FULLSCREEN,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,25,206,10
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,24,206,10
|
||||||
CONTROL "Disable Screen Saver when running rom",IDC_SCREEN_SAVER,
|
CONTROL "Disable Screen Saver when running rom",IDC_SCREEN_SAVER,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,41,206,10
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,39,206,10
|
||||||
CONTROL "Hide Advanced Settings",IDC_BASIC_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,72,206,10
|
CONTROL "Enable Discord Rich Presence",IDC_DISCORD_RPC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,54,206,10
|
||||||
LTEXT "Max # of Roms Remembered (Max 10):",IDC_MAXROMS_TXT,6,96,145,10
|
CONTROL "Enable Enhancements",IDC_ENABLE_ENHANCEMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,69,206,10
|
||||||
EDITTEXT IDC_REMEMBER,148,94,26,12,ES_AUTOHSCROLL | ES_NUMBER
|
CONTROL "Hide Advanced Settings",IDC_BASIC_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,84,206,10
|
||||||
LTEXT "roms",IDC_ROMSEL_TEXT2,178,97,31,10
|
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,4,99,208,1
|
||||||
LTEXT "Max # of Rom Dirs Remembered (Max 10):",IDC_MAXROMDIR_TXT,6,111,145,10
|
LTEXT "Max # of Roms Remembered (Max 10):",IDC_MAXROMS_TXT,6,107,145,10
|
||||||
EDITTEXT IDC_REMEMBERDIR,148,109,26,12,ES_AUTOHSCROLL | ES_NUMBER
|
EDITTEXT IDC_REMEMBER,148,105,26,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
LTEXT "dirs",IDC_ROMSEL_TEXT4,178,113,34,10
|
LTEXT "roms",IDC_ROMSEL_TEXT2,178,108,31,10
|
||||||
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,4,88,208,1
|
LTEXT "Max # of Rom Dirs Remembered (Max 10):",IDC_MAXROMDIR_TXT,6,122,145,10
|
||||||
CONTROL "Enable Discord Rich Presence",IDC_DISCORD_RPC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,57,145,8
|
EDITTEXT IDC_REMEMBERDIR,148,120,26,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
LTEXT "dirs",IDC_ROMSEL_TEXT4,178,124,34,10
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_Rom_Information DIALOGEX 0, 0, 239, 207
|
IDD_Rom_Information DIALOGEX 0, 0, 239, 207
|
||||||
|
@ -2215,6 +2216,11 @@ BEGIN
|
||||||
0
|
0
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_Settings_General AFX_DIALOG_LAYOUT
|
||||||
|
BEGIN
|
||||||
|
0
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|
|
@ -327,6 +327,7 @@
|
||||||
#define IDC_R12_EDIT 1145
|
#define IDC_R12_EDIT 1145
|
||||||
#define IDC_PAL 1146
|
#define IDC_PAL 1146
|
||||||
#define IDC_R13_EDIT 1146
|
#define IDC_R13_EDIT 1146
|
||||||
|
#define IDC_ENABLE_ENHANCEMENTS 1146
|
||||||
#define IDC_USA 1147
|
#define IDC_USA 1147
|
||||||
#define IDC_R14_EDIT 1147
|
#define IDC_R14_EDIT 1147
|
||||||
#define IDC_R15_EDIT 1148
|
#define IDC_R15_EDIT 1148
|
||||||
|
|
Loading…
Reference in New Issue