mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Fix all occurences of VCART_BUFFER
This commit is contained in:
parent
b204921554
commit
ae6c1c61c1
@ -55,9 +55,6 @@
|
|||||||
// buffer area defines (in use by vgame.c)
|
// buffer area defines (in use by vgame.c)
|
||||||
#define VGAME_BUFFER ((u8*)0x20400000)
|
#define VGAME_BUFFER ((u8*)0x20400000)
|
||||||
#define VGAME_BUFFER_SIZE (0x200000) // 2MB, big RomFS
|
#define VGAME_BUFFER_SIZE (0x200000) // 2MB, big RomFS
|
||||||
// buffer area defines (in use by vcart.c)
|
|
||||||
#define VCART_BUFFER ((u8*)0x20600000)
|
|
||||||
#define VCART_BUFFER_SIZE (0x20000) // 128kB, this is more than enough
|
|
||||||
|
|
||||||
// buffer area defines (in use by image.c, for RAMdrive)
|
// buffer area defines (in use by image.c, for RAMdrive)
|
||||||
#define RAMDRV_BUFFER ((u8*)0x22800000) // top of STACK
|
#define RAMDRV_BUFFER ((u8*)0x22800000) // top of STACK
|
||||||
|
@ -4,11 +4,16 @@
|
|||||||
#define FAT_LIMIT 0x100000000
|
#define FAT_LIMIT 0x100000000
|
||||||
#define VFLAG_PRIV_HDR (1UL<<31)
|
#define VFLAG_PRIV_HDR (1UL<<31)
|
||||||
|
|
||||||
static CartData* cdata = (CartData*) VCART_BUFFER; // 128kB reserved (~64kB required)
|
static CartData* cdata = NULL;
|
||||||
static bool cart_init = false;
|
static bool cart_init = false;
|
||||||
|
|
||||||
u32 InitVCartDrive(void) {
|
u32 InitVCartDrive(void) {
|
||||||
cart_init = ((InitCardRead(cdata) == 0) && (cdata->cart_size <= FAT_LIMIT));
|
if (!cdata) cdata = (CartData*) malloc(sizeof(CartData));
|
||||||
|
cart_init = (cdata && (InitCardRead(cdata) == 0) && (cdata->cart_size <= FAT_LIMIT));
|
||||||
|
if (!cart_init && cdata) {
|
||||||
|
free(cdata);
|
||||||
|
cdata = NULL;
|
||||||
|
}
|
||||||
return cart_init ? cdata->cart_id : 0;
|
return cart_init ? cdata->cart_id : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +61,7 @@ bool ReadVCartDir(VirtualFile* vfile, VirtualDir* vdir) {
|
|||||||
|
|
||||||
int ReadVCartFile(const VirtualFile* vfile, void* buffer, u64 offset, u64 count) {
|
int ReadVCartFile(const VirtualFile* vfile, void* buffer, u64 offset, u64 count) {
|
||||||
u32 foffset = vfile->offset + offset;
|
u32 foffset = vfile->offset + offset;
|
||||||
|
if (!cdata) return -1;
|
||||||
if (vfile->flags & VFLAG_PRIV_HDR)
|
if (vfile->flags & VFLAG_PRIV_HDR)
|
||||||
return ReadCartPrivateHeader(buffer, foffset, count, cdata);
|
return ReadCartPrivateHeader(buffer, foffset, count, cdata);
|
||||||
else return ReadCartBytes(buffer, foffset, count, cdata);
|
else return ReadCartBytes(buffer, foffset, count, cdata);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user