Fixed crashes loading an emuNAND if the SD was too small to be able to hold it
This commit is contained in:
parent
113059e57c
commit
95d06c115a
@ -7,6 +7,7 @@
|
||||
#include "types.h"
|
||||
|
||||
#define HID_PAD (*(vu32 *)0x10146000 ^ 0xFFF)
|
||||
|
||||
#define BUTTON_R1 (1 << 8)
|
||||
#define BUTTON_L1 (1 << 9)
|
||||
#define BUTTON_A 1
|
||||
@ -19,6 +20,7 @@
|
||||
#define BUTTON_LEFT (1 << 5)
|
||||
#define BUTTON_UP (1 << 6)
|
||||
#define BUTTON_DOWN (1 << 7)
|
||||
|
||||
#define SAFE_MODE (BUTTON_R1 | BUTTON_L1 | BUTTON_A | BUTTON_UP)
|
||||
#define OVERRIDE_BUTTONS (BUTTON_B ^ 0xFFF)
|
||||
#define SINGLE_PAYLOAD_BUTTONS (BUTTON_LEFT | BUTTON_RIGHT | BUTTON_UP | BUTTON_DOWN | BUTTON_START | BUTTON_X | BUTTON_Y)
|
||||
|
@ -10,9 +10,6 @@
|
||||
#include "memory.h"
|
||||
#include "font.h"
|
||||
|
||||
#define SCREEN_TOP_WIDTH 400
|
||||
#define SCREEN_TOP_HEIGHT 240
|
||||
|
||||
static const struct fb {
|
||||
u8 *top_left;
|
||||
u8 *top_right;
|
||||
|
@ -8,8 +8,12 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define SCREEN_TOP_WIDTH 400
|
||||
#define SCREEN_TOP_HEIGHT 240
|
||||
|
||||
#define SPACING_Y 10
|
||||
#define SPACING_X 8
|
||||
|
||||
#define COLOR_TITLE 0xFF9900
|
||||
#define COLOR_WHITE 0xFFFFFF
|
||||
#define COLOR_RED 0x0000FF
|
||||
|
@ -15,18 +15,16 @@ void getEmunandSect(u32 *off, u32 *head, u32 *emuNAND)
|
||||
(nandSize > 0x200000 ? 0x400000 : 0x200000);
|
||||
|
||||
//Check for RedNAND
|
||||
if(sdmmc_sdcard_readsectors(nandOffset + 1, 1, temp) == 0)
|
||||
{
|
||||
if(*(u32 *)(temp + 0x100) == NCSD_MAGIC)
|
||||
if(!sdmmc_sdcard_readsectors(nandOffset + 1, 1, temp) &&
|
||||
*(u32 *)(temp + 0x100) == NCSD_MAGIC)
|
||||
{
|
||||
*off = nandOffset + 1;
|
||||
*head = nandOffset + 1;
|
||||
}
|
||||
|
||||
//Check for Gateway emuNAND
|
||||
else if(sdmmc_sdcard_readsectors(nandOffset + nandSize, 1, temp) == 0)
|
||||
{
|
||||
if(*(u32 *)(temp + 0x100) == NCSD_MAGIC)
|
||||
else if(!sdmmc_sdcard_readsectors(nandOffset + nandSize, 1, temp) &&
|
||||
*(u32 *)(temp + 0x100) == NCSD_MAGIC)
|
||||
{
|
||||
*off = nandOffset;
|
||||
*head = nandOffset + nandSize;
|
||||
@ -40,8 +38,6 @@ void getEmunandSect(u32 *off, u32 *head, u32 *emuNAND)
|
||||
if(*emuNAND) getEmunandSect(off, head, emuNAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 getSDMMC(u8 *pos, u32 size)
|
||||
{
|
||||
|
@ -9,9 +9,6 @@
|
||||
#include "buttons.h"
|
||||
#include "../build/loader.h"
|
||||
|
||||
#define PAYLOAD_ADDRESS 0x24F00000
|
||||
#define PATTERN(a) a "_*.bin"
|
||||
|
||||
static FATFS sdFs,
|
||||
nandFs;
|
||||
|
||||
|
@ -6,6 +6,9 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define PAYLOAD_ADDRESS 0x24F00000
|
||||
#define PATTERN(a) a "_*.bin"
|
||||
|
||||
u32 mountFs(void);
|
||||
u32 fileRead(void *dest, const char *path, u32 size);
|
||||
u32 fileWrite(const void *buffer, const char *path, u32 size);
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "i2c.h"
|
||||
#include "../build/screeninit.h"
|
||||
|
||||
#define SCREENINIT_ADDRESS 0x24F02000
|
||||
|
||||
vu32 *arm11Entry = (u32 *)0x1FFFFFF8;
|
||||
|
||||
void deinitScreens(void)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "types.h"
|
||||
|
||||
#define PDN_GPU_CNT (*(vu8 *)0x10141200)
|
||||
#define SCREENINIT_ADDRESS 0x24F02000
|
||||
|
||||
void deinitScreens(void);
|
||||
void initScreens(void);
|
Reference in New Issue
Block a user