- Subproject commit 1629815c5a08ff95c3b0d592bbf9583c63cd124b
-Subproject commit 0cb25b034cb07a96077f1b0af4fd84960fdcd151
++Subproject commit eb78012240776d8143a2c6eede4802410d606f85
void dump_firm(firm_h** buffer, uint8_t index) {
if (*buffer != NULL) return;
- uint32_t firm_offset = 0x0B130000 + (index % 2) * 0x400000,
- firm_size = 0x00100000; // 1MB, because
+ // NOTE - Cast, because GCC is making assumptions about 'index'.
+ uint32_t firm_offset = (uint32_t)(0x0B130000 + (index % 2) * 0x400000),
+ firm_b_size = 0x00100000; // 1MB, because
- buffer[0] = malloc(firm_size);
- buffer[0] = static_allocate(firm_b_size);
++ buffer[0] = malloc(firm_b_size);
uint8_t ctr[0x10],
cid[0x10],
ctr_screen_enable_backlight(CTR_SCREEN_BOTH);
- set_font(PATH_TERMFONT);
-
install_interrupts(); // Get some free debug info.
- if (c) {
- // Failed to mount SD. Bomb out.
- abort("Failed to mount SD card.\n");
- }
-
- if (argc >= 1 && argc < 2) {
- // Valid argc passed.
- fprintf(stderr, "Chainloaded. Path: %s\n", argv[0]);
- }
-
- load_config(); // Load configuration.
-
if (CFG_BOOTENV == 7) {
fprintf(stderr, "Rebooted from AGB, disabling EmuNAND.\n");
- config.options[OPTION_EMUNAND] = 0;
+ config->options[OPTION_EMUNAND] = 0;
}
// Autoboot. Non-standard code path.
void
regenerate_config()
{
- memset(&config, 0, sizeof(config));
- memcpy(&(config.magic), CONFIG_MAGIC, 4);
- config.config_ver = config_version;
- config.options[OPTION_ACCENT_COLOR] = 2;
- config.options[OPTION_BRIGHTNESS] = 3;
+ for(int i=0; i < 4; i++)
+ config->magic[i] = CONFIG_MAGIC[i];
+
+ config->config_ver = config_version;
+ config->options[OPTION_ACCENT_COLOR] = 2;
++ config->options[OPTION_BRIGHTNESS] = 3;
if (!(conf_handle = fopen(PATH_CONFIG, "w")))
abort("Failed to open config for write?\n");
regenerate_config();
}
- if (config.config_ver < config_version) {
+ if (config->config_ver < config_version) {
fprintf(BOTTOM_SCREEN, "Config file has outdated version:\n"
" %s\n"
- "Regenerating with defaults...\n",
+ "Regenerating with defaults.\n",
PATH_CONFIG);
f_unlink(PATH_CONFIG);
regenerate_config();
if (!(conf_handle = fopen(PATH_CONFIG, "w")))
abort("Failed to open config for write?\n");
- config.options[OPTION_RECONFIGURED] = 0; // This should not persist to disk.
+ config->options[OPTION_RECONFIGURED] = 0; // This should not persist to disk.
- fwrite(&config, 1, sizeof(config), conf_handle);
+ fwrite(config, 1, sizeof(struct config_file), conf_handle);
fclose(conf_handle);
- config.options[OPTION_RECONFIGURED] = 1; // Save caches on boot.
+ config->options[OPTION_RECONFIGURED] = 1; // Save caches on boot.
+
+ fprintf(stderr, "Saved config successfully.\n");
}
if (PDN_GPU_CNT == 1)
screenInitAddress[2] = 0; // Do a full init.
- screenInitAddress[3] = 0xFF; // Brightness
+ // FIXME - God awful syntactical hack.
- screenInitAddress[3] = ("\x40\x8F\xC0\xFF")[config.options[OPTION_BRIGHTNESS]];
++ screenInitAddress[3] = ("\x40\x8F\xC0\xFF")[config->options[OPTION_BRIGHTNESS]];
+
screenInitAddress[4] = mode; // Mode
*a11_entry = (uint32_t)screenInitAddress;