ADDED support for .ips .ups .ppf files to the GUI.
git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@755 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
c2632be8f2
commit
acce8fa624
|
@ -138,7 +138,7 @@ struct {
|
|||
{ "OptionsEmulatorSaveEEPROMSensor", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR },
|
||||
{ "OptionsEmulatorSaveFlash64K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K },
|
||||
{ "OptionsEmulatorSaveFlash128K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M },
|
||||
{ "OptionsEmulatorAutoIPSPatch", ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH },
|
||||
{ "OptionsEmulatorAutoApplyPatchFiles", ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES },
|
||||
{ "OptionsEmulatorAGBPrint", ID_OPTIONS_EMULATOR_AGBPRINT },
|
||||
{ "OptionsEmulatorRTC", ID_OPTIONS_EMULATOR_REALTIMECLOCK },
|
||||
{ "OptionsEmulatorRewindInterval", ID_OPTIONS_EMULATOR_REWINDINTERVAL },
|
||||
|
|
|
@ -69,6 +69,12 @@ MainWnd::~MainWnd()
|
|||
{
|
||||
}
|
||||
|
||||
bool MainWnd::fileExists( LPCTSTR lpFileName )
|
||||
{
|
||||
// check if file exists
|
||||
return GetFileAttributes( lpFileName ) != INVALID_FILE_ATTRIBUTES;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(MainWnd, CWnd)
|
||||
//{{AFX_MSG_MAP(MainWnd)
|
||||
|
@ -173,8 +179,8 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
|
|||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SYNCHRONIZE, OnUpdateOptionsEmulatorSynchronize)
|
||||
ON_COMMAND(ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE, OnOptionsEmulatorSpeeduptoggle)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE, OnUpdateOptionsEmulatorSpeeduptoggle)
|
||||
ON_COMMAND(ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH, OnOptionsEmulatorAutomaticallyipspatch)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH, OnUpdateOptionsEmulatorAutomaticallyipspatch)
|
||||
ON_COMMAND(ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES, OnOptionsEmulatorAutomaticallyApplyPatchFiles)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES, OnUpdateOptionsEmulatorAutomaticallyipspatch)
|
||||
ON_COMMAND(ID_OPTIONS_EMULATOR_AGBPRINT, OnOptionsEmulatorAgbprint)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_AGBPRINT, OnUpdateOptionsEmulatorAgbprint)
|
||||
ON_COMMAND(ID_OPTIONS_EMULATOR_REALTIMECLOCK, OnOptionsEmulatorRealtimeclock)
|
||||
|
@ -455,8 +461,19 @@ bool MainWnd::FileRun()
|
|||
gbCheatRemoveAll();
|
||||
}
|
||||
|
||||
CString ipsname;
|
||||
ipsname.Format("%s.ips", theApp.filename);
|
||||
CString patchName;
|
||||
patchName.Format("%s.ips", theApp.filename);
|
||||
if( !fileExists( patchName ) ) {
|
||||
patchName.Format("%s.ups", theApp.filename);
|
||||
if( !fileExists( patchName ) ) {
|
||||
patchName.Format("%s.ppf", theApp.filename);
|
||||
if( !fileExists( patchName ) ) {
|
||||
// don't use any patches
|
||||
patchName.Empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!theApp.dir.GetLength()) {
|
||||
int index = theApp.filename.ReverseFind('\\');
|
||||
|
@ -495,9 +512,9 @@ bool MainWnd::FileRun()
|
|||
theApp.romSize = gbRomSize;
|
||||
|
||||
|
||||
if(theApp.autoIPS) {
|
||||
if(theApp.autoPatch && !patchName.IsEmpty()) {
|
||||
int size = gbRomSize;
|
||||
utilApplyIPS(ipsname, &gbRom, &size);
|
||||
utilApplyIPS(patchName, &gbRom, &size);
|
||||
if(size != gbRomSize) {
|
||||
extern bool gbUpdateSizes();
|
||||
gbUpdateSizes();
|
||||
|
@ -562,9 +579,9 @@ bool MainWnd::FileRun()
|
|||
}
|
||||
*/
|
||||
|
||||
if(theApp.autoIPS) {
|
||||
if(theApp.autoPatch && !patchName.IsEmpty()) {
|
||||
int size = 0x2000000;
|
||||
utilApplyIPS(ipsname, &rom, &size);
|
||||
utilApplyIPS(patchName, &rom, &size);
|
||||
if(size != 0x2000000) {
|
||||
CPUReset();
|
||||
}
|
||||
|
@ -1151,9 +1168,7 @@ void MainWnd::screenCapture(int captureNumber)
|
|||
captureNumber,
|
||||
ext);
|
||||
|
||||
// check if file exists
|
||||
DWORD dwAttr = GetFileAttributes( buffer );
|
||||
if( dwAttr != INVALID_FILE_ATTRIBUTES ) {
|
||||
if( fileExists( buffer ) ) {
|
||||
// screenshot file already exists
|
||||
screenCapture(++captureNumber);
|
||||
// this will recursively use the first non-existent screenshot number
|
||||
|
|
|
@ -49,6 +49,9 @@ public:
|
|||
void winSaveCheatList(const char *name);
|
||||
void winSaveCheatListDefault();
|
||||
|
||||
private:
|
||||
bool fileExists( LPCTSTR lpFileName );
|
||||
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
|
@ -176,7 +179,7 @@ protected:
|
|||
afx_msg void OnUpdateOptionsEmulatorSynchronize(CCmdUI* pCmdUI);
|
||||
afx_msg void OnOptionsEmulatorSpeeduptoggle();
|
||||
afx_msg void OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI* pCmdUI);
|
||||
afx_msg void OnOptionsEmulatorAutomaticallyipspatch();
|
||||
afx_msg void OnOptionsEmulatorAutomaticallyApplyPatchFiles();
|
||||
afx_msg void OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI* pCmdUI);
|
||||
afx_msg void OnOptionsEmulatorAgbprint();
|
||||
afx_msg void OnUpdateOptionsEmulatorAgbprint(CCmdUI* pCmdUI);
|
||||
|
|
|
@ -536,14 +536,14 @@ void MainWnd::OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI* pCmdUI)
|
|||
pCmdUI->SetCheck(theApp.speedupToggle);
|
||||
}
|
||||
|
||||
void MainWnd::OnOptionsEmulatorAutomaticallyipspatch()
|
||||
void MainWnd::OnOptionsEmulatorAutomaticallyApplyPatchFiles()
|
||||
{
|
||||
theApp.autoIPS = !theApp.autoIPS;
|
||||
theApp.autoPatch = !theApp.autoPatch;
|
||||
}
|
||||
|
||||
void MainWnd::OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->SetCheck(theApp.autoIPS);
|
||||
pCmdUI->SetCheck(theApp.autoPatch);
|
||||
}
|
||||
|
||||
void MainWnd::OnOptionsEmulatorAgbprint()
|
||||
|
|
|
@ -257,7 +257,7 @@ VBA::VBA()
|
|||
autoSaveLoadCheatList = false;
|
||||
winout = NULL;
|
||||
removeIntros = false;
|
||||
autoIPS = true;
|
||||
autoPatch = true;
|
||||
winGbBorderOn = 0;
|
||||
winFlashSize = 0x20000;
|
||||
winRtcEnable = false;
|
||||
|
@ -1635,7 +1635,7 @@ void VBA::loadSettings()
|
|||
|
||||
recentFreeze = regQueryDwordValue("recentFreeze", false) ? true : false;
|
||||
|
||||
autoIPS = regQueryDwordValue("autoIPS", true) ? true : false;
|
||||
autoPatch = regQueryDwordValue("autoPatch", 1) == 1 ? true : false;
|
||||
|
||||
cpuDisableSfx = regQueryDwordValue("disableSfx", 0) ? true : false;
|
||||
|
||||
|
@ -2616,7 +2616,7 @@ void VBA::saveSettings()
|
|||
|
||||
regSetDwordValue("recentFreeze", recentFreeze);
|
||||
|
||||
regSetDwordValue("autoIPS", autoIPS);
|
||||
regSetDwordValue("autoPatch", autoPatch ? 1 : 0);
|
||||
|
||||
regSetDwordValue("disableSfx", cpuDisableSfx);
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ class VBA : public CWinApp
|
|||
bool autoSaveLoadCheatList;
|
||||
FILE *winout;
|
||||
bool removeIntros;
|
||||
bool autoIPS;
|
||||
bool autoPatch;
|
||||
int winGbBorderOn;
|
||||
int winFlashSize;
|
||||
bool winRtcEnable;
|
||||
|
|
|
@ -1859,7 +1859,7 @@ BEGIN
|
|||
MENUITEM "&Below Normal", ID_OPTIONS_PRIORITY_BELOWNORMAL
|
||||
END
|
||||
MENUITEM "&Remove intros (GBA)", ID_OPTIONS_EMULATOR_REMOVEINTROSGBA
|
||||
MENUITEM "Automatic IPS patching", ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH
|
||||
MENUITEM "Auto-apply IPS/UPS/PPF", ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES
|
||||
MENUITEM "AGB Print", ID_OPTIONS_EMULATOR_AGBPRINT
|
||||
MENUITEM "Real Time Clock", ID_OPTIONS_EMULATOR_REALTIMECLOCK
|
||||
MENUITEM "&Game Overrides...", ID_OPTIONS_EMULATOR_GAMEOVERRIDES
|
||||
|
|
|
@ -718,7 +718,7 @@
|
|||
#define ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR 40173
|
||||
#define ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K 40174
|
||||
#define ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M 40175
|
||||
#define ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH 40176
|
||||
#define ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES 40176
|
||||
#define ID_TOOLS_RECORD_STARTAVIRECORDING 40178
|
||||
#define ID_TOOLS_RECORD_STOPAVIRECORDING 40179
|
||||
#define ID_OPTIONS_FILTER_BILINEAR 40186
|
||||
|
|
Loading…
Reference in New Issue