Merge master into developer

This commit is contained in:
Aurora 2016-08-31 16:14:20 +02:00
commit 726b06b748
4 changed files with 19 additions and 16 deletions

View File

@ -43,19 +43,22 @@ bool readConfig(const char *configPath)
return true; return true;
} }
void writeConfig(const char *configPath, u32 configTemp) void writeConfig(const char *configPath, u32 configTemp, ConfigurationStatus needConfig)
{ {
/* If the configuration is different from previously, overwrite it. /* If the configuration is different from previously, overwrite it.
Just the no-forcing flag being set is not enough */ Just the no-forcing flag being set is not enough */
if((configTemp & 0xFFFFFFEF) != configData.config) if(needConfig == CREATE_CONFIGURATION || (configTemp & 0xFFFFFFEF) != configData.config)
{ {
if(needConfig == CREATE_CONFIGURATION)
{
memcpy(configData.magic, "CONF", 4);
configData.formatVersionMajor = CONFIG_VERSIONMAJOR;
configData.formatVersionMinor = CONFIG_VERSIONMINOR;
}
//Merge the new options and new boot configuration //Merge the new options and new boot configuration
configData.config = (configData.config & 0xFFFFFFC0) | (configTemp & 0x3F); configData.config = (configData.config & 0xFFFFFFC0) | (configTemp & 0x3F);
memcpy(configData.magic, "CONF", 4);
configData.formatVersionMajor = CONFIG_VERSIONMAJOR;
configData.formatVersionMinor = CONFIG_VERSIONMINOR;
if(!fileWrite(&configData, configPath, sizeof(cfgData))) if(!fileWrite(&configData, configPath, sizeof(cfgData)))
error("Error writing the configuration file"); error("Error writing the configuration file");
} }

View File

@ -40,8 +40,15 @@ typedef struct __attribute__((packed))
u32 config; u32 config;
} cfgData; } cfgData;
typedef enum ConfigurationStatus
{
DONT_CONFIGURE = 0,
MODIFY_CONFIGURATION = 1,
CREATE_CONFIGURATION = 2
} ConfigurationStatus;
extern cfgData configData; extern cfgData configData;
bool readConfig(const char *configPath); bool readConfig(const char *configPath);
void writeConfig(const char *configPath, u32 configTemp); void writeConfig(const char *configPath, u32 configTemp, ConfigurationStatus needConfig);
void configMenu(bool oldPinStatus); void configMenu(bool oldPinStatus);

View File

@ -216,7 +216,7 @@ void main(void)
if(!isFirmlaunch) if(!isFirmlaunch)
{ {
configTemp |= (u32)nandType | ((u32)firmSource << 2); configTemp |= (u32)nandType | ((u32)firmSource << 2);
writeConfig(configPath, configTemp); writeConfig(configPath, configTemp, needConfig);
} }
u32 firmVersion = loadFirm(&firmType, firmSource); u32 firmVersion = loadFirm(&firmType, firmSource);

View File

@ -47,13 +47,6 @@ typedef struct firmHeader {
firmSectionHeader section[4]; firmSectionHeader section[4];
} firmHeader; } firmHeader;
typedef enum ConfigurationStatus
{
DONT_CONFIGURE = 0,
MODIFY_CONFIGURATION = 1,
CREATE_CONFIGURATION = 2
} ConfigurationStatus;
static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource); static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource);
static inline void patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lh); static inline void patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lh);
static inline void patchLegacyFirm(FirmwareType firmType); static inline void patchLegacyFirm(FirmwareType firmType);