firmware: Move firmware.dfc to Battery directory, #3349229

There currently is no official place for the firmware.dfc
file. The current behavior is to save the .dfc in the same
directory as the executable. Per zeromus' suggestion, the
.dfc will now be saved in the Battery directory.
This will be true for all ports that support DeSmuME's
directory structure.

Patch from rogerman.
This commit is contained in:
riccardom 2011-10-02 11:27:29 +00:00
parent fb9445ffa3
commit 048f0c292e
2 changed files with 17 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2009 DeSmuME Team
/* Copyright (C) 2009-2011 DeSmuME Team
This file is part of DeSmuME
@ -566,7 +566,9 @@ bool CFIRMWARE::load()
INFO(" * ARM7 unpacked size: 0x%08X (%i) bytes\n", size7, size7);
}
snprintf(MMU.fw.userfile, MAX_PATH, "%sFirmware%cfirmware.dfc", path.pathToModule, DIRECTORY_DELIMITER_CHAR);
// Generate the path for the external firmware config file.
std::string extFilePath = CFIRMWARE::GetExternalFilePath();
strncpy(MMU.fw.userfile, extFilePath.c_str(), MAX_PATH);
fclose(fp);
fp = fopen(MMU.fw.userfile, "rb");
@ -607,6 +609,15 @@ bool CFIRMWARE::load()
return true;
}
std::string CFIRMWARE::GetExternalFilePath()
{
std::string fwPath = CommonSettings.Firmware;
std::string fwFileName = Path::GetFileNameFromPathWithoutExt(fwPath);
std::string configPath = path.pathToBattery;
std::string finalPath = configPath + DIRECTORY_DELIMITER_CHAR + fwFileName + FILE_EXT_DELIMITER_CHAR + FW_CONFIG_FILE_EXT;
return finalPath;
}
//=====================================================================================================
static u32

View File

@ -24,6 +24,8 @@
// the count of bytes copied from the firmware into memory
#define NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT 0x70
#define FW_CONFIG_FILE_EXT "dfc"
class CFIRMWARE
{
private:
@ -48,6 +50,8 @@ public:
bool load();
static std::string GetExternalFilePath();
struct HEADER
{
u16 part3_rom_gui9_addr; // 000h