Try to fix some bugs in the new cheat changes

This commit is contained in:
zilmar 2020-12-31 08:03:27 +10:30
parent c4160785e9
commit cb0f746099
3 changed files with 13 additions and 0 deletions

View File

@ -44,6 +44,7 @@ Source: "{#BaseDir}\apidoc.htm"; DestDir: "{app}"
[Dirs]
Name: "{app}\Config"; Permissions: everyone-full
Name: "{app}\Config\Cheats-User"; Permissions: everyone-full
Name: "{app}\Logs"; Permissions: everyone-full
Name: "{app}\Save"; Permissions: everyone-full
Name: "{app}\Screenshots"; Permissions: everyone-full

View File

@ -91,6 +91,10 @@ void CEnhancements::UpdateCheats(const CEnhancementList & Cheats)
CGuard Guard(m_CS);
if (strcmp(m_CheatFile->FileName(), OutFile) != 0)
{
if (!OutFile.DirectoryExists())
{
OutFile.DirectoryCreate();
}
SectionFiles::const_iterator CheatFileItr = m_CheatFiles.find(m_SectionIdent);
if (m_CheatFiles.end() != CheatFileItr)
{
@ -156,6 +160,7 @@ void CEnhancements::LoadCheats(CMipsMemoryVM * MMU)
WaitScanDone();
CGuard Guard(m_CS);
SectionFiles::const_iterator CheatFileItr = m_CheatFiles.find(m_SectionIdent);
bool FoundFile = false;
if (CheatFileItr != m_CheatFiles.end())
{
CPath CheatFile(CheatFileItr->second);
@ -163,9 +168,15 @@ void CEnhancements::LoadCheats(CMipsMemoryVM * MMU)
{
m_CheatFile = std::make_unique<CEnhancmentFile>(CheatFile, "Cheat");
m_CheatFile->GetEnhancementList(m_SectionIdent.c_str(), m_Cheats);
FoundFile = true;
}
}
if (!FoundFile)
{
m_CheatFile = nullptr;
m_Cheats.clear();
}
ResetCodes(MMU);
for (CEnhancementList::const_iterator itr = m_Cheats.begin(); itr != m_Cheats.end(); itr++)
{

View File

@ -30,6 +30,7 @@ IF %ERRORLEVEL% NEQ 0 GOTO EndErr
rd "%base_dir%\Bin\Package" /Q /S > NUL 2>&1
md "%base_dir%\Bin\Package"
md "%base_dir%\Bin\Package\Config"
md "%base_dir%\Bin\Package\Config\Cheats"
md "%base_dir%\Bin\Package\Lang"
md "%base_dir%\Bin\Package\Plugin%VSPlatform%"
md "%base_dir%\Bin\Package\Plugin%VSPlatform%\Audio"