updated = 1;
}
+ if (config->firm[0][0] == 0)
+ strncpy(config->firm[0], PATH_NATIVE_F, 255);
+ if (config->firm[1][0] == 0)
+ strncpy(config->firm[1], PATH_TWL_F, 255);
+ if (config->firm[2][0] == 0)
+ strncpy(config->firm[2], PATH_AGB_F, 255);
+
if (updated) {
save_config(); // Save the configuration.
}
char* get_opt(void* val) {
uint32_t opt = (uint32_t)val;
+ if (opt >= OPTION_NFIRM_PATH && opt <= OPTION_AFIRM_PATH) {
+ opt -= OPTION_NFIRM_PATH;
+ return config->firm[opt];
+ }
+
char raw = config->options[opt];
static char str[2] = "0";
str[0] = '0';
firm_loc = malloc(firm_size);
fprintf(stderr, "Loading NATIVE_FIRM\n");
- if (load_firm(firm_loc, PATH_NATIVE_F, PATH_NATIVE_FIRMKEY, PATH_NATIVE_CETK, &firm_size, NATIVE_FIRM_TITLEID) != 0) {
+ if (load_firm(firm_loc, get_opt((void*)OPTION_NFIRM_PATH), PATH_NATIVE_FIRMKEY, PATH_NATIVE_CETK, &firm_size, NATIVE_FIRM_TITLEID) != 0) {
abort("\n Failed to load NATIVE_FIRM.\n");
}
find_proc9(firm_loc, &firm_proc9, &firm_p9_exefs);
twl_firm_loc = malloc(twl_firm_size);
fprintf(stderr, "TWL_FIRM\n");
- if (load_firm(twl_firm_loc, PATH_TWL_F, PATH_TWL_FIRMKEY, PATH_TWL_CETK, &twl_firm_size, TWL_FIRM_TITLEID) != 0) {
+ if (load_firm(twl_firm_loc, get_opt((void*)OPTION_TFIRM_PATH), PATH_TWL_FIRMKEY, PATH_TWL_CETK, &twl_firm_size, TWL_FIRM_TITLEID) != 0) {
fprintf(stderr, "\n TWL_FIRM failed to load.\n");
state = 1;
} else {
agb_firm_loc = malloc(agb_firm_size);
fprintf(stderr, "AGB_FIRM\n");
- if (load_firm(agb_firm_loc, PATH_AGB_F, PATH_AGB_FIRMKEY, PATH_AGB_CETK, &agb_firm_size, AGB_FIRM_TITLEID) != 0) {
+ if (load_firm(agb_firm_loc, get_opt((void*)OPTION_AFIRM_PATH), PATH_AGB_FIRMKEY, PATH_AGB_CETK, &agb_firm_size, AGB_FIRM_TITLEID) != 0) {
fprintf(stderr, "\n AGB_FIRM failed to load.\n");
state = 1;
} else {