Move config and PIN paths to the respective headers
This commit is contained in:
parent
263a5eda56
commit
9bc62ec12d
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,11 @@
|
||||
|
||||
#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 CONFIG_PATH "/luma/config.bin"
|
||||
#define CONFIG_VERSIONMAJOR 1
|
||||
#define CONFIG_VERSIONMINOR 0
|
||||
|
||||
@ -48,6 +49,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);
|
@ -69,10 +69,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;
|
||||
|
||||
//Determine if this is a firmlaunch boot
|
||||
if(launchedFirmTidLow[5] != 0)
|
||||
@ -208,7 +206,7 @@ void main(void)
|
||||
if(!isFirmlaunch)
|
||||
{
|
||||
configTemp |= (u32)nandType | ((u32)firmSource << 2);
|
||||
writeConfig(configPath, configTemp, needConfig);
|
||||
writeConfig(needConfig, configTemp);
|
||||
}
|
||||
|
||||
u32 firmVersion = loadFirm(&firmType, firmSource);
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define PATTERN(a) a "_*.bin"
|
||||
#define PATTERN(a) a "_*.bin"
|
||||
|
||||
extern bool isN3DS;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user