mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-22 10:39:20 +01:00
Fixed SD card fault display + ROM boot changes
This commit is contained in:
parent
9f5557ff36
commit
25bb6f343c
@ -5,6 +5,11 @@
|
|||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define C0_STATUS_FR (1 << 26)
|
||||||
|
#define C0_STATUS_CU0 (1 << 28)
|
||||||
|
#define C0_STATUS_CU1 (1 << 29)
|
||||||
|
|
||||||
|
|
||||||
extern uint32_t ipl2 __attribute__((section(".data")));
|
extern uint32_t ipl2 __attribute__((section(".data")));
|
||||||
|
|
||||||
|
|
||||||
@ -75,14 +80,10 @@ void boot (boot_params_t *params) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// asm volatile (
|
|
||||||
// "li $t1, %[status] \n"
|
|
||||||
// "mtc0 $t1, $12 \n" ::
|
|
||||||
// [status] "i" (C0_SR_CU1 | C0_SR_CU0 | C0_SR_FR)
|
|
||||||
// );
|
|
||||||
|
|
||||||
OS_INFO->mem_size_6105 = OS_INFO->mem_size;
|
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));
|
while (!(cpu_io_read(&SP->SR) & SP_SR_HALT));
|
||||||
|
|
||||||
cpu_io_write(&SP->SR, SP_SR_CLR_INTR | SP_SR_SET_HALT);
|
cpu_io_write(&SP->SR, SP_SR_CLR_INTR | SP_SR_SET_HALT);
|
||||||
|
@ -39,6 +39,7 @@ static flashcart_t *flashcart = &((flashcart_t) {
|
|||||||
|
|
||||||
|
|
||||||
flashcart_error_t flashcart_init (void) {
|
flashcart_error_t flashcart_init (void) {
|
||||||
|
bool sd_initialized;
|
||||||
flashcart_error_t error;
|
flashcart_error_t error;
|
||||||
|
|
||||||
// HACK: Because libcart reads PI config from address 0x10000000 when initializing
|
// HACK: Because libcart reads PI config from address 0x10000000 when initializing
|
||||||
@ -48,9 +49,7 @@ flashcart_error_t flashcart_init (void) {
|
|||||||
extern uint32_t cart_dom1;
|
extern uint32_t cart_dom1;
|
||||||
cart_dom1 = 0x80371240;
|
cart_dom1 = 0x80371240;
|
||||||
|
|
||||||
if (!debug_init_sdfs("sd:/", -1)) {
|
sd_initialized = debug_init_sdfs("sd:/", -1);
|
||||||
return FLASHCART_ERROR_NOT_DETECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: Flashcart model is extracted from libcart after debug_init_sdfs call is made
|
// NOTE: Flashcart model is extracted from libcart after debug_init_sdfs call is made
|
||||||
extern int cart_type;
|
extern int cart_type;
|
||||||
@ -66,13 +65,17 @@ flashcart_error_t flashcart_init (void) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return FLASHCART_ERROR_UNSUPPORTED;
|
return FLASHCART_ERROR_NOT_DETECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((error = flashcart->init()) != FLASHCART_OK) {
|
if ((error = flashcart->init()) != FLASHCART_OK) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sd_initialized) {
|
||||||
|
return FLASHCART_ERROR_SD_CARD;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef MENU_NO_USB_LOG
|
#ifndef MENU_NO_USB_LOG
|
||||||
// NOTE: Some flashcarts doesn't have USB port, can't throw error here
|
// NOTE: Some flashcarts doesn't have USB port, can't throw error here
|
||||||
debug_init_usblog();
|
debug_init_usblog();
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
FLASHCART_OK,
|
FLASHCART_OK,
|
||||||
FLASHCART_ERROR_NOT_DETECTED,
|
FLASHCART_ERROR_NOT_DETECTED,
|
||||||
FLASHCART_ERROR_UNSUPPORTED,
|
|
||||||
FLASHCART_ERROR_OUTDATED,
|
FLASHCART_ERROR_OUTDATED,
|
||||||
|
FLASHCART_ERROR_SD_CARD,
|
||||||
FLASHCART_ERROR_ARGS,
|
FLASHCART_ERROR_ARGS,
|
||||||
FLASHCART_ERROR_LOAD,
|
FLASHCART_ERROR_LOAD,
|
||||||
FLASHCART_ERROR_INT,
|
FLASHCART_ERROR_INT,
|
||||||
|
@ -11,10 +11,10 @@ static char *format_flashcart_error (flashcart_error_t error) {
|
|||||||
return "No error";
|
return "No error";
|
||||||
case FLASHCART_ERROR_NOT_DETECTED:
|
case FLASHCART_ERROR_NOT_DETECTED:
|
||||||
return "No flashcart hardware was detected";
|
return "No flashcart hardware was detected";
|
||||||
case FLASHCART_ERROR_UNSUPPORTED:
|
|
||||||
return "Unsupported flashcart";
|
|
||||||
case FLASHCART_ERROR_OUTDATED:
|
case FLASHCART_ERROR_OUTDATED:
|
||||||
return "Outdated flashcart firmware";
|
return "Outdated flashcart firmware";
|
||||||
|
case FLASHCART_ERROR_SD_CARD:
|
||||||
|
return "Error during SD card initialization";
|
||||||
case FLASHCART_ERROR_ARGS:
|
case FLASHCART_ERROR_ARGS:
|
||||||
return "Invalid argument passed to flashcart function";
|
return "Invalid argument passed to flashcart function";
|
||||||
case FLASHCART_ERROR_LOAD:
|
case FLASHCART_ERROR_LOAD:
|
||||||
|
@ -181,7 +181,7 @@ static void load (menu_t *menu) {
|
|||||||
path_free(path);
|
path_free(path);
|
||||||
|
|
||||||
menu->boot_params->device_type = BOOT_DEVICE_TYPE_ROM;
|
menu->boot_params->device_type = BOOT_DEVICE_TYPE_ROM;
|
||||||
menu->boot_params->reset_type = BOOT_RESET_TYPE_COLD;
|
menu->boot_params->reset_type = BOOT_RESET_TYPE_NMI;
|
||||||
menu->boot_params->tv_type = BOOT_TV_TYPE_PASSTHROUGH;
|
menu->boot_params->tv_type = BOOT_TV_TYPE_PASSTHROUGH;
|
||||||
menu->boot_params->detect_cic_seed = true;
|
menu->boot_params->detect_cic_seed = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user