#include <ctr9/i2c.h> // for i2cWriteRegister, I2C_DEV_MCU
#include <malloc.h> // for memalign
#include <std/draw.h> // for framebuffers
-
-int screen_is_init = 0;
+#include <util.h>
struct framebuffers *framebuffers;
-volatile uint32_t *const arm11Entry = (volatile uint32_t *)0x1FFFFFF8;
+volatile uint32_t *arm11Entry = (volatile uint32_t *)0x1FFFFFF8;
static const uint32_t brightness[4] = {0x26, 0x39, 0x4C, 0x5F};
void __attribute__((naked)) arm11Stub(void)
ctr_cache_clean_and_flush_all();
hasCopiedStub = true;
}
+
+ if (is_firmlaunch())
+ arm11Entry = (volatile uint32_t*)0x1FFFFFFC;
}
void invokeArm11Function(void (*func)())
}
}
-int get_screen_is_init() {
- return screen_is_init;
-}
-
void screen_mode(uint32_t mode, uint32_t bright_level) {
static uint32_t stride, init_top, init_bottom, bright;
// i2cWriteRegister(I2C_DEV_MCU, 0x22, 1 << 1);
//Turn on backlight
i2cWriteRegister(I2C_DEV_MCU, 0x22, 0x2A);
-
- screen_is_init = 1;
}
// Check key down for autoboot
set_fb_struct();
+ install_interrupts(); // Get some free debug info.
+
+ installArm11Stub();
+
if (is_firmlaunch()) {
shut_up();
ctr_system_poweroff();
}
- install_interrupts(); // Get some free debug info.
-
- installArm11Stub();
-
if (CFG_BOOTENV == 7)
set_opt_u32(OPTION_EMUNAND, 0); // Disable EmuNAND on AGB reboot.
#include "std/draw.h" // for crflush, stderr
#include "std/fs.h" // for crumount
-#include "patcher.h"
+#include "util.h"
#include <ctr9/ctr_system.h>
-static volatile uint32_t *const a11_entry = (volatile uint32_t *)0x1FFFFFF8;
-static volatile uint32_t *const a11_entry_fl = (volatile uint32_t *)0x1FFFFFFC;
+extern volatile uint32_t *arm11Entry;
void firmlaunch(firm_h* firm) {
// Get entrypoints
crumount(); // Unmount SD.
- if (get_screen_is_init())
- deinitScreens(); // Turn off display if on
+ deinitScreens(); // Turn off display if on
- if (is_firmlaunch())
- *a11_entry_fl = (uint32_t)entry11; // Start kernel11
- else
- *a11_entry = (uint32_t)entry11; // Start kernel11
+ *arm11Entry = (uint32_t)entry11; // Start kernel11
entry9(); // Start process9
}
#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)();
-int get_screen_is_init();
-
/* Initializes the screen and sets the display mode.
*
* \param mode Screen mode to initialize in, one of RGBA8, BGR8, RGB565_OES, RGB5_A1_OES, or RGBA4_OES
#ifndef __PATCHER_H
#define __PATCHER_H
-int is_firmlaunch();
-int get_firmtype();
-
/* Patches firmware with the current configuration.
*
* \return zero on success
--- /dev/null
+#ifndef UTIL_H
+#define UTIL_H
+
+int is_firmlaunch();
+int get_firmtype();
+
+#endif