Merge master into developer

This commit is contained in:
Aurora 2016-09-02 14:24:24 +02:00
commit a99b26ff8c
7 changed files with 20 additions and 19 deletions

View File

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

View File

@ -24,11 +24,13 @@
#include "types.h"
#define CONFIG(a) (((configData.config >> (a + 16)) & 1) != 0)
#define MULTICONFIG(a) ((configData.config >> (a * 2 + 6)) & 3)
#define CONFIG(a) (((configData.config >> (a + 16)) & 1) != 0)
#define MULTICONFIG(a) ((configData.config >> (a * 2 + 6)) & 3)
#define BOOTCONFIG(a, b) ((configData.config >> a) & b)
#define DEV_OPTIONS MULTICONFIG(2)
#define CONFIG_PATH "/luma/config.bin"
#define CONFIG_VERSIONMAJOR 1
#define CONFIG_VERSIONMINOR 0
@ -49,6 +51,6 @@ typedef enum ConfigurationStatus
extern cfgData configData;
bool readConfig(const char *configPath);
void writeConfig(const char *configPath, u32 configTemp, ConfigurationStatus needConfig);
bool readConfig(void);
void writeConfig(ConfigurationStatus needConfig, u32 configTemp);
void configMenu(bool oldPinStatus);

View File

@ -71,10 +71,8 @@ void main(void)
//Mount filesystems. CTRNAND will be mounted only if/when needed
mountFs();
const char configPath[] = "/luma/config.bin";
//Attempt to read the configuration file
needConfig = readConfig(configPath) ? MODIFY_CONFIGURATION : CREATE_CONFIGURATION;
needConfig = readConfig() ? MODIFY_CONFIGURATION : CREATE_CONFIGURATION;
if(DEV_OPTIONS != 2)
{
@ -216,7 +214,7 @@ void main(void)
if(!isFirmlaunch)
{
configTemp |= (u32)nandType | ((u32)firmSource << 2);
writeConfig(configPath, configTemp, needConfig);
writeConfig(needConfig, configTemp);
}
u32 firmVersion = loadFirm(&firmType, firmSource);

View File

@ -24,7 +24,7 @@
#include "types.h"
#define PATTERN(a) a "_*.bin"
#define PATTERN(a) a "_*.bin"
extern bool isN3DS;

View File

@ -95,7 +95,7 @@ void newPin(bool allowSkipping)
computePinHash(tmp, enteredPassword, (PIN_LENGTH + 15) / 16);
memcpy(pin.hash, tmp, 32);
if(!fileWrite(&pin, "/luma/pin.bin", sizeof(PINData)))
if(!fileWrite(&pin, PIN_PATH, sizeof(PINData)))
error("Error writing the PIN file");
}
@ -105,7 +105,7 @@ bool verifyPin(void)
PINData pin;
if(fileRead(&pin, "/luma/pin.bin") != sizeof(PINData) ||
if(fileRead(&pin, PIN_PATH) != sizeof(PINData) ||
memcmp(pin.magic, "PINF", 4) != 0 ||
pin.formatVersionMajor != PIN_VERSIONMAJOR ||
pin.formatVersionMinor != PIN_VERSIONMINOR)

View File

@ -30,7 +30,8 @@
#include "types.h"
#define PIN_LENGTH 4
#define PIN_LENGTH 4
#define PIN_PATH "/luma/pin.bin"
#define PIN_VERSIONMAJOR 1
#define PIN_VERSIONMINOR 0

View File

@ -29,10 +29,10 @@
#include "types.h"
#define PDN_GPU_CNT (*(vu8 *)0x10141200)
#define PDN_GPU_CNT (*(vu8 *)0x10141200)
#define ARM11_STUB_ADDRESS (0x25000000 - 0x30) //It's currently only 0x28 bytes large. We're putting 0x30 just to be sure here
#define WAIT_FOR_ARM9() *arm11Entry = 0; while(!*arm11Entry); ((void (*)())*arm11Entry)();
#define ARM11_STUB_ADDRESS (0x25000000 - 0x30) //It's currently only 0x28 bytes large. We're putting 0x30 just to be sure here
#define WAIT_FOR_ARM9() *arm11Entry = 0; while(!*arm11Entry); ((void (*)())*arm11Entry)();
static volatile struct fb {
u8 *top_left;