mirror of https://github.com/PCSX2/pcsx2.git
Support single widescreen dbf file. Also includes a batch file to create a cheats_ws.dbf file from individual pnach files, and also includes the cheats_ws.dbf file which was generated from the current individual ws cheat pnach files.
Still needs: 1. remove all single ws pnach files from the repository. 2. Update the installer/uninstaller accordingly. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5827 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
4ae6b0cb83
commit
d11382a20c
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,18 @@
|
|||
%~d0
|
||||
cd %~p0
|
||||
set db=cheats_ws.dbf
|
||||
del %db%
|
||||
|
||||
@echo off
|
||||
echo Creating %db%
|
||||
for %%f in (*.pnach) do (
|
||||
echo Processing %%f
|
||||
echo //IMPORT-START:%%f>> %db%
|
||||
echo [patches=%%~nf]>> %db%
|
||||
type %%f>> %db%
|
||||
echo.>> %db%
|
||||
echo [/patches]>> %db%
|
||||
echo //IMPORT-END:%%f>> %db%
|
||||
echo.>> %db%
|
||||
echo.>> %db%
|
||||
)
|
|
@ -22,6 +22,7 @@
|
|||
#include "GameDatabase.h"
|
||||
#include <wx/textfile.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/textfile.h>
|
||||
|
||||
IniPatch Patch[ MAX_PATCH ];
|
||||
IniPatch Cheat[ MAX_CHEAT ];
|
||||
|
@ -155,14 +156,20 @@ int InitPatches(const wxString& crc, const Game_Data& game)
|
|||
return patchnumber;
|
||||
}
|
||||
|
||||
void inifile_processString(const wxString& inStr)
|
||||
{
|
||||
wxString str(inStr);
|
||||
inifile_trim(str);
|
||||
if (!str.IsEmpty()) inifile_command(1, str);
|
||||
}
|
||||
|
||||
// This routine receives a file from inifile_read, trims it,
|
||||
// Then sends the command to be parsed.
|
||||
void inifile_process(wxTextFile &f1 )
|
||||
{
|
||||
for (uint i = 0; i < f1.GetLineCount(); i++)
|
||||
{
|
||||
inifile_trim(f1[i]);
|
||||
if (!f1[i].IsEmpty()) inifile_command(1, f1[i]);
|
||||
inifile_processString(f1[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,6 +206,51 @@ static int LoadCheatsFiles(const wxDirName& folderName, wxString& fileSpec, cons
|
|||
return cheatnumber - before;
|
||||
}
|
||||
|
||||
|
||||
// This routine loads cheats from a dbf file
|
||||
// Returns number of cheats loaded
|
||||
// Note: Should be called after InitPatches()
|
||||
// expected DB format of section(s) to be loaded:
|
||||
//[patches=ABCDE1234<anything can come here upto EOL>
|
||||
// <patch file content, possibly multiline, possibly with comments>
|
||||
//[/patches]
|
||||
// DB file notes: 1. no spaces around the '='. 2. CRC should be in upper case padded with 0s to 8 chars
|
||||
int LoadCheatsFromDbf(wxString gameCRC, const wxString& cheatsDbfFilename) {
|
||||
gameCRC.MakeUpper();
|
||||
|
||||
wxTextFile db(cheatsDbfFilename);
|
||||
db.Open();
|
||||
|
||||
int before = cheatnumber;
|
||||
|
||||
wxString line;
|
||||
bool insideCurrentGame = false;
|
||||
bool first = true;
|
||||
|
||||
while (true) {
|
||||
if (first) line = db.GetFirstLine();
|
||||
else line = db.GetNextLine();
|
||||
first = false;
|
||||
|
||||
if (insideCurrentGame) {
|
||||
if (line.Find(L"[/patches]") == 0) {
|
||||
insideCurrentGame = false;
|
||||
continue;
|
||||
}
|
||||
inifile_processString(line);
|
||||
|
||||
} else if (line.Find(wxString(L"[patches=") + gameCRC) == 0) {
|
||||
insideCurrentGame = true;
|
||||
}
|
||||
|
||||
if (db.Eof()) break;
|
||||
}
|
||||
|
||||
db.Close();
|
||||
return cheatnumber - before;
|
||||
}
|
||||
|
||||
|
||||
// This routine loads cheats from *.pnach files
|
||||
// Returns number of cheats loaded
|
||||
// Note: Should be called after InitPatches()
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace PatchFunc
|
|||
|
||||
extern void ResetCheatsCount();
|
||||
extern int LoadCheats(wxString name, const wxDirName& folderName, const wxString& friendlyName);
|
||||
extern int LoadCheatsFromDbf(wxString gameCRC, const wxString& cheatsDbfFilename);
|
||||
extern void inifile_command(bool isCheat, const wxString& cmd);
|
||||
extern void inifile_trim(wxString& buffer);
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include "AppSaveStates.h"
|
||||
#include "AppGameDatabase.h"
|
||||
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include "Utilities/TlsVariable.inl"
|
||||
|
||||
#include "ps2/BiosTools.h"
|
||||
|
@ -312,6 +314,7 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
|
|||
|
||||
int numberLoadedCheats;
|
||||
int numberLoadedWideScreenPatches;
|
||||
int numberDbfCheatsLoaded;
|
||||
|
||||
if (ElfCRC) gameCRC.Printf( L"%8.8x", ElfCRC );
|
||||
if (!DiscSerial.IsEmpty()) gameSerial = L" [" + DiscSerial + L"]";
|
||||
|
@ -365,7 +368,14 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
|
|||
if (EmuConfig.EnableWideScreenPatches) {
|
||||
if (numberLoadedWideScreenPatches = LoadCheats(gameCRC, PathDefs::GetCheatsWS(), L"Widescreen hacks")) {
|
||||
gameWsHacks.Printf(L" [%d widescreen hacks]", numberLoadedWideScreenPatches);
|
||||
}
|
||||
} else {
|
||||
// No ws cheat files found at the cheats_ws folder, try the ws cheats db file.
|
||||
wxString cheats_wsDbf = Path::Combine(((wxFileName)wxStandardPaths::Get().GetExecutablePath()).GetPath(), L"cheats_ws.dbf");
|
||||
if (numberDbfCheatsLoaded = LoadCheatsFromDbf(gameCRC, cheats_wsDbf)) {
|
||||
Console.WriteLn(Color_Green, "(Wide Screen Cheats DB) Patches Loaded: %d", numberDbfCheatsLoaded);
|
||||
gameWsHacks.Printf(L" [%d widescreen hacks]", numberDbfCheatsLoaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Console.SetTitle(gameName+gameSerial+gameCompat+gameFixes+gamePatch+gameCheats+gameWsHacks);
|
||||
|
|
Loading…
Reference in New Issue