diff --git a/libdragon b/libdragon index 4b38fd56..e6adc203 160000 --- a/libdragon +++ b/libdragon @@ -1 +1 @@ -Subproject commit 4b38fd5618007e7ed9040107d0f7e52f2de81a22 +Subproject commit e6adc2034376158ecb47e7498220336ede442ee9 diff --git a/src/boot/boot.c b/src/boot/boot.c index b4b066ee..d9d2eca3 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -37,15 +37,26 @@ static void boot_detect_cic_seed (boot_params_t *params) { void boot (boot_params_t *params) { if (params->tv_type == BOOT_TV_TYPE_PASSTHROUGH) { - params->tv_type = OS_INFO->tv_type; + switch (get_tv_type()) { + case TV_PAL: + params->tv_type = BOOT_TV_TYPE_PAL; + break; + case TV_NTSC: + params->tv_type = BOOT_TV_TYPE_NTSC; + break; + case TV_MPAL: + params->tv_type = BOOT_TV_TYPE_MPAL; + break; + default: + params->tv_type = BOOT_TV_TYPE_NTSC; + break; + } } if (params->detect_cic_seed) { boot_detect_cic_seed(params); } - OS_INFO->mem_size_6105 = OS_INFO->mem_size; - C0_WRITE_STATUS(C0_STATUS_CU1 | C0_STATUS_CU0 | C0_STATUS_FR); while (!(cpu_io_read(&SP->SR) & SP_SR_HALT)); @@ -120,7 +131,7 @@ void boot (boot_params_t *params) { boot_device = (params->device_type & 0x01); tv_type = (params->tv_type & 0x03); - reset_type = BOOT_RESET_TYPE_NMI; + reset_type = BOOT_RESET_TYPE_COLD; cic_seed = (params->cic_seed & 0xFF); version = (params->tv_type == BOOT_TV_TYPE_PAL) ? 6 : (params->tv_type == BOOT_TV_TYPE_NTSC) ? 1 diff --git a/src/boot/boot.h b/src/boot/boot.h index 61ff6546..0bbd910d 100644 --- a/src/boot/boot.h +++ b/src/boot/boot.h @@ -41,7 +41,6 @@ typedef struct { } boot_params_t; -bool boot_is_warm (void); void boot (boot_params_t *params); diff --git a/src/boot/boot_io.h b/src/boot/boot_io.h index a251cd9b..6923e4df 100644 --- a/src/boot/boot_io.h +++ b/src/boot/boot_io.h @@ -241,28 +241,6 @@ typedef struct { #define ROM_CART_BASE (0x10000000UL) #define ROM_CART ((io32_t *) ROM_CART_BASE) -/** @brief OS Information Structure. */ -typedef struct { - uint32_t tv_type; - uint32_t device_type; - uint32_t device_base; - uint32_t reset_type; - uint32_t cic_id; - uint32_t version; - uint32_t mem_size; - uint8_t app_nmi_buffer[64]; - uint32_t __reserved_1[37]; - uint32_t mem_size_6105; -} os_info_t; - -#define OS_INFO_BASE (0x80000300UL) -#define OS_INFO ((os_info_t *) OS_INFO_BASE) - -/** @brief The Console was powered on using the power switch. */ -#define OS_INFO_RESET_TYPE_COLD (0) -/** @brief The Console was reset using the reset button. */ -#define OS_INFO_RESET_TYPE_NMI (1) - static inline uint32_t cpu_io_read (io32_t *address) { io32_t *uncached = UNCACHED(address); diff --git a/src/boot/reboot.S b/src/boot/reboot.S index e64a46f1..5d0ab6de 100644 --- a/src/boot/reboot.S +++ b/src/boot/reboot.S @@ -2,10 +2,15 @@ #define REBOOT_ADDRESS 0xA4001000 #define STACK_ADDRESS 0xA4001FF0 +#define RI_ADDRESS 0xA4700000 + +#define RI_SELECT 0x0C +#define RI_REFRESH 0x10 + .set noat .section .text.reboot, "ax", %progbits -.type reboot, %object + reboot_start: .global reboot_start @@ -29,6 +34,15 @@ reboot_entry: li $sp, STACK_ADDRESS +reset_rdram: + bnez $s5, reset_rdram_skip + + li $t0, RI_ADDRESS + + sw $zero, RI_REFRESH($t0) + sw $zero, RI_SELECT($t0) +reset_rdram_skip: + detect_console_region: li $t0, 1 beq $s4, $zero, pal_console @@ -37,16 +51,16 @@ detect_console_region: pal_console: li $ra, 0xA4001554 - b reset_registers + b prepare_registers ntsc_console: li $ra, 0xA4001550 - b reset_registers + b prepare_registers mpal_console: li $ra, 0xA4001554 -reset_registers: +prepare_registers: move $at, $zero move $v0, $zero move $v1, $zero @@ -56,7 +70,7 @@ reset_registers: move $a3, $zero move $t0, $zero move $t1, $zero - move $t2, $zero + li $t2, 0x40 move $t4, $zero move $t5, $zero move $t6, $zero diff --git a/src/menu/menu.c b/src/menu/menu.c index a573bcdb..482f2d0f 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -157,7 +157,7 @@ static struct views_s { void menu_run (boot_params_t *boot_params) { menu_init(boot_params); - while (exception_reset_time() < RESET_TIME_LENGTH) { + while (exception_reset_time() == 0) { surface_t *display = (frame_counter >= FRAMERATE_DIVIDER) ? display_try_get() : NULL; if (display != NULL) {