portx64: files/romdata: getEstimatedFileSize() so we can preallocate enough memory for files in x64

This commit is contained in:
Raf committed 2024-08-02 17:32:33 +08:00
1 parent cec197e841
commit 5795634b9c
20 files changed
+122 -148

No files matched your search

+11 -1
View File
@@ -6,10 +6,19 @@
extern u8 *g_RomFile;
extern u32 g_RomFileSize;
typedef enum {
FT_BG,
FT_TILES,
FT_LANG,
FT_SETUP,
FT_PADS,
FT_MODEL
} FileType;
s32 romdataInit(void);
u8 *romdataFileLoad(s32 fileNum, u32 *outSize);
void romdataFilePreprocess(s32 fileNum, s32 loadType, u8 *data, u32 size);
void romdataFilePreprocess(s32 fileNum, s32 loadType, u8 *data, u32 size, u32 *outSize);
void romdataFileFree(s32 fileNum);
const char *romdataFileGetName(s32 fileNum);
@@ -21,5 +30,6 @@ s32 romdataFileGetNumForName(const char *name);
u8 *romdataSegGetData(const char *segName);
u8 *romdataSegGetDataEnd(const char *segName);
u32 romdataSegGetSize(const char *segName);
u32 romdataGetEstimatedFileSize(u32 size, FileType filetype);
#endif
+4 -2
View File
@@ -1,7 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "system.h"
enum {
AL_ADPCM_WAVE = 0,
@@ -414,8 +416,8 @@ static int convert_audio_bankfile(u8 *dst, u8 *src)
u8 *preprocessALBankFile_x64(u8 *src, u32 size, u32 *outSize)
{
size_t dstlen = size * 4;
u8 *dst = calloc(1, dstlen);
u32 dstlen = size * 4;
u8* dst = sysMemZeroAlloc(dstlen);
*outSize = convert_audio_bankfile(dst, src);
*outSize = ALIGN16(*outSize);
+3 -1
View File
@@ -1,7 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "romdata.h"
#include "system.h"
static int get_next_nonzero(u8 *src, u32 offset, size_t len)
@@ -74,7 +76,7 @@ u32 convert_lang_file(u8 *dst, u8 *src, size_t srclen)
}
u8 *preprocessLangFile_x64(u8 *data, u32 size, u32 *outSize) {
u32 newSizeEstimated = (u32)(size * 1.3);
u32 newSizeEstimated = romdataGetEstimatedFileSize(size, FT_LANG);
u8 *dst = sysMemZeroAlloc(newSizeEstimated);
u32 newSize = convert_lang_file(dst, data, size);
+3 -1
View File
@@ -1,7 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "romdata.h"
#include "system.h"
enum contenttype {
@@ -935,7 +937,7 @@ u8 *preprocessModelFile_x64(u8 *data, u32 size, u32 *outSize)
{
gbi_reset();
u32 newSizeEstimated = (u32)(size * 1.7);
u32 newSizeEstimated = romdataGetEstimatedFileSize(size, FT_MODEL);
u8 *dst = sysMemZeroAlloc(newSizeEstimated);
u32 newSize = convert_model(dst, data, size);
+3 -1
View File
@@ -1,7 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "romdata.h"
#include "system.h"
#define PADFLAG_INTPOS 0x0001
@@ -309,7 +311,7 @@ static int convert_pads_file(u8 *dst, u8 *src)
}
u8* preprocessPadsFile_x64(u8 *data, u32 size, u32 *outSize) {
u32 newSizeEstimated = (u32)(size * 1.7);
u32 newSizeEstimated = romdataGetEstimatedFileSize(size, FT_PADS);
u8* dst = sysMemZeroAlloc(newSizeEstimated);
u32 newSize = convert_pads_file(dst, data);
+5 -2
View File
@@ -1,7 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "romdata.h"
#include "system.h"
@@ -86,11 +88,12 @@ u32 convert_tiles(u8 *dst, u8 *src, size_t srclen)
u8 *preprocessTilesFile_x64(u8 *data, u32 size, u32 *outSize)
{
u8 *dst = sysMemZeroAlloc(size);
u32 newSizeEstimated = romdataGetEstimatedFileSize(size, FT_TILES);
u8 *dst = sysMemZeroAlloc(newSizeEstimated);
u32 newSize = convert_tiles(dst, data, size);
if (newSize > size) {
if (newSize > newSizeEstimated) {
sysLogPrintf(LOG_ERROR, "overflow when trying to preprocess a tiles file, size %d newsize %d", size, newSize);
exit(EXIT_FAILURE);
}
+6 -3
View File
@@ -4,11 +4,14 @@
#include "types.h"
#include "common.h"
#include "system.h"
#include "assert.h"
#include "common.h"
#include "setups_decl.h"
#include "romdata.h"
#include "system.h"
static inline void convF32(f32 *dst, f32 src) { *(u32*)dst = srctoh32(*(u32*)&src); }
static inline void convU32(u32 *dst, u32 src) { *dst = srctoh32(src); }
@@ -1232,7 +1235,7 @@ void test_conv_functions()
}
u8 *preprocessSetupFile_x64(u8 *data, u32 size, u32 *outSize) {
u32 newSizeEstimated = (u32)(size * 3.3);
u32 newSizeEstimated = romdataGetEstimatedFileSize(size, FT_SETUP);
u8 *dst = sysMemZeroAlloc(newSizeEstimated);
u32 newSize = convert_setup(dst, data, size);
-103
View File
@@ -1,103 +0,0 @@
#include <libgen.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <zlib.h>
FILE *openfile(char *filename)
{
char path[1024];
struct stat status;
memcpy(path, filename, strlen(filename));
dirname(path);
while (stat(path, &status) == -1) {
// while (mkdir(path, 0755) == -1) {
while (mkdir(path) == -1) {
dirname(path);
}
memcpy(path, filename, strlen(filename));
dirname(path);
}
FILE *fp = fopen(filename, "wb");
if (fp == NULL) {
fprintf(stderr, "Unable to open '%s' for writing\n", filename);
exit(EXIT_FAILURE);
}
return fp;
}
size_t rzip_get_infsize(uint8_t *src)
{
if (src[0] != 0x11 || src[1] != 0x73) {
fprintf(stderr, "rzip_get_infsize: 1173 not found\n");
exit(EXIT_FAILURE);
}
return src[2] << 16 | (src[3] << 8) | src[4];
}
int rzip_inflate(uint8_t *dst, size_t dstlen, uint8_t *src, size_t srclen)
{
if (src[0] != 0x11 || src[1] != 0x73) {
fprintf(stderr, "rzip_inflate: 1173 not found\n");
for (int i = 0; i < 16; i++) {
fprintf(stderr, "%02x ", src[i]);
}
fprintf(stderr, "\n");
exit(EXIT_FAILURE);
}
z_stream stream;
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
stream.opaque = Z_NULL;
stream.avail_in = srclen - 5;
stream.next_in = &src[5];
stream.avail_out = dstlen;
stream.next_out = dst;
inflateInit2(&stream, -15);
int ret = inflate(&stream, Z_FINISH);
inflateEnd(&stream);
return ret;
}
int rzip_deflate(uint8_t *dst, size_t *dstlen, uint8_t *src, size_t srclen)
{
dst[0] = 0x11;
dst[1] = 0x73;
dst[2] = (srclen >> 16) & 0xff;
dst[3] = (srclen >> 8) & 0xff;
dst[4] = srclen & 0xff;
*dstlen = *dstlen - 5;
z_stream stream;
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
stream.opaque = Z_NULL;
stream.avail_in = srclen;
stream.next_in = src;
stream.avail_out = *dstlen;
stream.next_out = &dst[5];
deflateInit2(&stream, 9, Z_DEFLATED, -15, 9, Z_DEFAULT_STRATEGY);
int ret = deflate(&stream, Z_FINISH);
deflateEnd(&stream);
*dstlen = stream.next_out - dst;
return ret;
}
+16
View File
@@ -545,3 +545,19 @@ u32 romdataSegGetSize(const char *segName)
{
return romdataGetSeg(segName)->size;
}
u32 romdataGetEstimatedFileSize(u32 size, FileType filetype)
{
switch (filetype) {
case FT_BG: return (u32)(size * 1.1);
case FT_TILES: return (u32)(size * 1.1);
case FT_LANG: return (u32)(size * 1.3);
case FT_SETUP: return (u32)(size * 3.3);
case FT_PADS: return (u32)(size * 1.7);
case FT_MODEL: return (u32)(size * 1.7);
default:
sysLogPrintf(LOG_WARNING, "wrong file type in romdataGetEstimatedFileSize: %d", filetype);
return size;
}
}
+14 -3
View File
@@ -1509,6 +1509,11 @@ void bgReset(s32 stagenum)
primcompsize = *(u32 *)&header[8];
var8007fc54 = inflatedsize - primcompsize;
var8007fc54 -= 0xc;
#ifdef PLATFORM_64BIT
inflatedsize = romdataGetEstimatedFileSize(inflatedsize, FT_BG);
#endif
inflatedsize = ALIGN16(inflatedsize);
// Allocate space for the primary bg data
@@ -1529,7 +1534,7 @@ void bgReset(s32 stagenum)
bgInflate((u8 *) scratch, g_BgPrimaryData, primcompsize);
#ifndef PLATFORM_N64
preprocessBgSection1(g_BgPrimaryData, 0x0f000000);
preprocessBgSection1(g_BgPrimaryData, inflatedsize, 0x0f000000);
#endif
// Shrink the allocation (ie. free the scratch space)
@@ -1998,7 +2003,8 @@ void bgBuildTables(s32 stagenum)
numlightsptr++;
}
#ifndef PLATFORM_N64
// in x64, lights are already pre-processed at this point (TEMP)
#if !defined(PLATFORM_N64) && !defined(PLATFORM_64BIT)
preprocessBgLights(g_BgLightsFileData, 0);
#endif
@@ -2820,6 +2826,11 @@ void bgLoadRoom(s32 roomnum)
#endif
}
#ifdef PLATFORM_64BIT
alloclen = alloclen * 4; // just to be safe for now, adjust properly later #TODO
#endif
#ifdef PLATFORM_N64
bgGarbageCollectRooms(alloclen, false);
@@ -2856,7 +2867,7 @@ void bgLoadRoom(s32 roomnum)
// Inflate the data to the left side of the allocation
inflatedlen = bgInflate(memaddr, allocation, g_BgRooms[roomnum + 1].unk00 - g_BgRooms[roomnum].unk00);
#ifndef PLATFORM_N64
preprocessBgRoom(allocation, g_BgRooms[roomnum].unk00);
inflatedlen = preprocessBgRoom(allocation, inflatedlen, g_BgRooms[roomnum].unk00);
#endif
g_Rooms[roomnum].gfxdata = (struct roomgfxdata *)allocation;
+3 -3
View File
@@ -3831,7 +3831,7 @@ void bgunTickGunLoad(void)
*player->gunctrl.loadmemptr = ptr;
*player->gunctrl.loadmemremaining = remaining;
loadsize = ALIGN64(fileGetInflatedSize(player->gunctrl.loadfilenum)) + 0x8000;
loadsize = ALIGN64(fileGetInflatedSize(player->gunctrl.loadfilenum, FT_MODEL)) + 0x8000;
osSyncPrintf("BriGun: Loading - %s, pMem 0x%08x Size %d\n");
@@ -3933,7 +3933,7 @@ void bgunTickGunLoad(void)
modeldef0f1a7560(modeldef, player->gunctrl.loadfilenum, 0x05000000, modeldef, &player->gunctrl.texpool, false);
fileGetInflatedSize(player->gunctrl.loadfilenum);
fileGetInflatedSize(player->gunctrl.loadfilenum, FT_MODEL);
fileGetLoadedSize(player->gunctrl.loadfilenum);
fileGetLoadedSize(player->gunctrl.loadfilenum);
fileGetLoadedSize(player->gunctrl.loadfilenum);
@@ -3946,7 +3946,7 @@ void bgunTickGunLoad(void)
newvalue = ALIGN64(texGetPoolLeftPos(&player->gunctrl.texpool));
remaining = *player->gunctrl.loadmemremaining;
remaining -= (s32)(newvalue - *player->gunctrl.loadmemptr);
remaining -= (intptr_t)(newvalue - *player->gunctrl.loadmemptr);
*player->gunctrl.loadmemptr = newvalue;
*player->gunctrl.loadmemremaining = remaining;
+9 -5
View File
@@ -11,7 +11,7 @@
#include "data.h"
#include "types.h"
#ifndef PLATFORM_N64
#include "romdata.h"
#include "system.h"
#endif
/**
@@ -4176,7 +4176,7 @@ void fileLoad(u8 *dst, u32 allocationlen, romptr_t *romaddrptr, struct fileinfo
dmaExec(dst, *romaddrptr, romsize);
} else {
// DMA the compressed data to scratch space then inflate
u8 *scratch = (dst + allocationlen) - ((romsize + 7) & 0xfffffffffffffff8);
u8 *scratch = (dst + allocationlen) - ((romsize + 7) & (uintptr_t)~7);
if ((uintptr_t)scratch - (uintptr_t)dst < 8) {
info->loadedsize = 0;
@@ -4255,7 +4255,7 @@ void fileLoadPartToAddr(u16 filenum, void *memaddr, s32 offset, u32 len)
}
}
u32 fileGetInflatedSize(s32 filenum)
u32 fileGetInflatedSize(s32 filenum, FileType filetype)
{
u8 *ptr;
u8 buffer[0x50];
@@ -4283,7 +4283,11 @@ u32 fileGetInflatedSize(s32 filenum)
}
if (rzipIs1173(ptr)) {
#ifdef PLATFORM_N64
return (ptr[2] << 16) | (ptr[3] << 8) | ptr[4];
#else
return romdataGetEstimatedFileSize((ptr[2] << 16) | (ptr[3] << 8) | ptr[4], filetype);
#endif
}
#if VERSION < VERSION_NTSC_1_0
@@ -4300,7 +4304,7 @@ u32 fileGetInflatedSize(s32 filenum)
return 0;
}
void *fileLoadToNew(s32 filenum, u32 method)
void *fileLoadToNew(s32 filenum, u32 method, FileType filetype)
{
struct fileinfo *info = &g_FileInfo[filenum];
u32 stack;
@@ -4308,7 +4312,7 @@ void *fileLoadToNew(s32 filenum, u32 method)
if (method == FILELOADMETHOD_EXTRAMEM || method == FILELOADMETHOD_DEFAULT) {
if (info->loadedsize == 0) {
info->loadedsize = (fileGetInflatedSize(filenum) + 0x20) & 0xfffffff0;
info->loadedsize = (fileGetInflatedSize(filenum, filetype) + 0x20) & 0xfffffff0;
if (method == FILELOADMETHOD_EXTRAMEM) {
info->loadedsize += 0x8000;
+10 -4
View File
@@ -382,6 +382,7 @@ void langLoad(s32 bank)
if ((uintptr_t)g_LangBuffer + len + g_LangBufferSize - (uintptr_t)g_LangBufferPos >= 0) {
s32 len2 = (uintptr_t)g_LangBuffer + g_LangBufferSize - (uintptr_t)g_LangBufferPos;
len2 = len2 / 32 * 32;
g_LoadType = LOADTYPE_LANG;
g_LangBanks[bank] = fileLoadToAddr(langGetFileId(bank), FILELOADMETHOD_DEFAULT, (u8 *)g_LangBufferPos, len2);
g_LangBufferPos = (u8 *)(align32((uintptr_t)g_LangBufferPos + len));
} else {
@@ -389,13 +390,15 @@ void langLoad(s32 bank)
}
#else
s32 file_id = langGetFileId(bank);
g_LangBanks[bank] = fileLoadToNew(file_id, FILELOADMETHOD_DEFAULT);
g_LoadType = LOADTYPE_LANG;
g_LangBanks[bank] = fileLoadToNew(file_id, FILELOADMETHOD_DEFAULT, FT_LANG);
#endif
}
void langLoadToAddr(s32 bank, u8 *dst, s32 size)
{
s32 file_id = langGetFileId(bank);
g_LoadType = LOADTYPE_LANG;
g_LangBanks[bank] = fileLoadToAddr(file_id, FILELOADMETHOD_DEFAULT, dst, size);
}
@@ -418,12 +421,15 @@ char *langGet(s32 textid)
{
s32 bankindex = textid >> 9;
s32 textindex = textid & 0x1ff;
uintptr_t *bank = g_LangBanks[bankindex];
uintptr_t *bank = (uintptr_t*)g_LangBanks[bankindex];
uintptr_t addr;
if (bank && bank[textindex]) {
// addr = (uintptr_t)bank + PD_BE32(bank[textindex]);
addr = (u8*)bank + (bank[textindex]);
#ifdef PLATFORM_64BIT
addr = (uintptr_t)bank + bank[textindex];
#else
addr = (uintptr_t)bank + PD_BE32(bank[textindex]);
#endif
} else {
addr = 0;
}
+19 -7
View File
@@ -51,15 +51,27 @@ void langReset(s32 stagenum)
langReload();
#else
// Versions prior to PAL load the language directly
g_LangBanks[LANGBANK_GUN] = fileLoadToNew(langGetFileId(LANGBANK_GUN), FILELOADMETHOD_DEFAULT);
g_LangBanks[LANGBANK_MPMENU] = fileLoadToNew(langGetFileId(LANGBANK_MPMENU), FILELOADMETHOD_DEFAULT);
g_LangBanks[LANGBANK_PROPOBJ] = fileLoadToNew(langGetFileId(LANGBANK_PROPOBJ), FILELOADMETHOD_DEFAULT);
g_LangBanks[LANGBANK_MPWEAPONS] = fileLoadToNew(langGetFileId(LANGBANK_MPWEAPONS), FILELOADMETHOD_DEFAULT);
g_LangBanks[LANGBANK_OPTIONS] = fileLoadToNew(langGetFileId(LANGBANK_OPTIONS), FILELOADMETHOD_DEFAULT);
g_LangBanks[LANGBANK_MISC] = fileLoadToNew(langGetFileId(LANGBANK_MISC), FILELOADMETHOD_DEFAULT);
g_LoadType = LOADTYPE_LANG; // find be a better way to do this..
g_LangBanks[LANGBANK_GUN] = fileLoadToNew(langGetFileId(LANGBANK_GUN), FILELOADMETHOD_DEFAULT, FT_LANG);
g_LoadType = LOADTYPE_LANG;
g_LangBanks[LANGBANK_MPMENU] = fileLoadToNew(langGetFileId(LANGBANK_MPMENU), FILELOADMETHOD_DEFAULT, FT_LANG);
g_LoadType = LOADTYPE_LANG;
g_LangBanks[LANGBANK_PROPOBJ] = fileLoadToNew(langGetFileId(LANGBANK_PROPOBJ), FILELOADMETHOD_DEFAULT, FT_LANG);
g_LoadType = LOADTYPE_LANG;
g_LangBanks[LANGBANK_MPWEAPONS] = fileLoadToNew(langGetFileId(LANGBANK_MPWEAPONS), FILELOADMETHOD_DEFAULT, FT_LANG);
g_LoadType = LOADTYPE_LANG;
g_LangBanks[LANGBANK_OPTIONS] = fileLoadToNew(langGetFileId(LANGBANK_OPTIONS), FILELOADMETHOD_DEFAULT, FT_LANG);
g_LoadType = LOADTYPE_LANG;
g_LangBanks[LANGBANK_MISC] = fileLoadToNew(langGetFileId(LANGBANK_MISC), FILELOADMETHOD_DEFAULT, FT_LANG);
if (stagenum == STAGE_CREDITS) {
g_LangBanks[LANGBANK_TITLE] = fileLoadToNew(langGetFileId(LANGBANK_TITLE), FILELOADMETHOD_DEFAULT);
g_LoadType = LOADTYPE_LANG;
g_LangBanks[LANGBANK_TITLE] = fileLoadToNew(langGetFileId(LANGBANK_TITLE), FILELOADMETHOD_DEFAULT, FT_LANG);
}
#endif
}
+3 -3
View File
@@ -1869,7 +1869,7 @@ Gfx *menuRenderModel(Gfx *gdl, struct menumodel *menumodel, s32 modeltype)
bodyfilenum = g_HeadsAndBodies[bodynum].filenum;
totalfilelen = fileGetInflatedSize(bodyfilenum);
totalfilelen = fileGetInflatedSize(bodyfilenum, FT_MODEL);
totalfilelen = ALIGN64(totalfilelen);
if (g_HeadsAndBodies[bodynum].unk00_01) {
@@ -1877,7 +1877,7 @@ Gfx *menuRenderModel(Gfx *gdl, struct menumodel *menumodel, s32 modeltype)
headfilenum = 0xffff;
} else {
headfilenum = g_HeadsAndBodies[headnum].filenum;
totalfilelen += ALIGN64(fileGetInflatedSize(headfilenum));
totalfilelen += ALIGN64(fileGetInflatedSize(headfilenum, FT_MODEL));
}
#ifdef PLATFORM_64BIT
@@ -1915,7 +1915,7 @@ Gfx *menuRenderModel(Gfx *gdl, struct menumodel *menumodel, s32 modeltype)
body0f02ce8c(bodynum, headnum, menumodel->bodymodeldef, menumodel->headmodeldef, totalfilelen * 0, &menumodel->bodymodel, false, 1);
} else {
totalfilelen = ALIGN64(fileGetInflatedSize(menumodel->newparams)) + 0x4000;
totalfilelen = ALIGN64(fileGetInflatedSize(menumodel->newparams, FT_MODEL)) + 0x4000;
if (1);
texInitPool(&texpool, &menumodel->allocstart[(u32)totalfilelen], menumodel->alloclen - totalfilelen);
+1 -1
View File
@@ -190,7 +190,7 @@ struct modeldef *modeldefLoad(u16 fileid, u8 *dst, s32 size, struct texpool *arg
if (dst) {
modeldef = fileLoadToAddr(fileid, FILELOADMETHOD_EXTRAMEM, dst, size);
} else {
modeldef = fileLoadToNew(fileid, FILELOADMETHOD_EXTRAMEM, FT_LANG);
modeldef = fileLoadToNew(fileid, FILELOADMETHOD_EXTRAMEM, FT_MODEL);
}
modelPromoteTypeToPointer(modeldef);
+3 -3
View File
@@ -1424,14 +1424,14 @@ void playerTickChrBody(void)
offset1 += sizeof(struct weaponobj);
offset1 = ALIGN64(offset1);
offset2 = offset1 + ALIGN64(fileGetInflatedSize(g_HeadsAndBodies[bodynum].filenum));
offset2 = offset1 + ALIGN64(fileGetInflatedSize(g_HeadsAndBodies[bodynum].filenum, FT_MODEL));
if (headnum >= 0) {
offset2 += ALIGN64(fileGetInflatedSize(g_HeadsAndBodies[headnum].filenum));
offset2 += ALIGN64(fileGetInflatedSize(g_HeadsAndBodies[headnum].filenum, FT_MODEL));
}
if (weaponmodelnum >= 0) {
offset2 += ALIGN64(fileGetInflatedSize(g_ModelStates[weaponmodelnum].fileid));
offset2 += ALIGN64(fileGetInflatedSize(g_ModelStates[weaponmodelnum].fileid, FT_MODEL));
}
offset2 += 0x4000;
+2 -2
View File
@@ -1319,7 +1319,7 @@ void setupLoadFiles(s32 stagenum)
g_LoadType = LOADTYPE_SETUP;
g_GeCreditsData = (u8 *)fileLoadToNew(filenum, FILELOADMETHOD_DEFAULT);
g_GeCreditsData = (u8 *)fileLoadToNew(filenum, FILELOADMETHOD_DEFAULT, FT_SETUP);
setup = (struct stagesetup *)g_GeCreditsData;
langLoad(langGetLangBankIndexFromStagenum(stagenum));
@@ -1330,7 +1330,7 @@ void setupLoadFiles(s32 stagenum)
g_LoadType = LOADTYPE_PADS;
g_StageSetup.padfiledata = fileLoadToNew(g_Stages[g_StageIndex].padsfileid, FILELOADMETHOD_DEFAULT);
g_StageSetup.padfiledata = fileLoadToNew(g_Stages[g_StageIndex].padsfileid, FILELOADMETHOD_DEFAULT, FT_PADS);
g_StageSetup.waypoints = NULL;
g_StageSetup.waygroups = NULL;
+1 -1
View File
@@ -18,7 +18,7 @@ void tilesReset(void)
}
g_LoadType = LOADTYPE_TILES;
g_TileFileData.u8 = fileLoadToNew(g_Stages[index].tilefileid, FILELOADMETHOD_DEFAULT);
g_TileFileData.u8 = fileLoadToNew(g_Stages[index].tilefileid, FILELOADMETHOD_DEFAULT, FT_TILES);
g_TileNumRooms = *g_TileFileData.u32;
g_TileRooms = g_TileFileData.u32 + 1;
+6 -2
View File
@@ -4,12 +4,16 @@
#include "data.h"
#include "types.h"
#ifndef PLATFORM_N64
#include "romdata.h"
#endif
romptr_t fileGetRomAddress(s32 filenum);
s32 fileGetRomSize(s32 filenum);
void filesInit(void);
void fileLoadPartToAddr(u16 filenum, void *memaddr, s32 offset, u32 len);
u32 fileGetInflatedSize(s32 filenum);
void *fileLoadToNew(s32 filenum, u32 method);
u32 fileGetInflatedSize(s32 filenum, FileType filetype);
void *fileLoadToNew(s32 filenum, u32 method, FileType filetype);
void *fileLoadToAddr(s32 filenum, s32 method, u8 *ptr, u32 size);
u32 fileGetLoadedSize(s32 filenum);
u32 fileGetAllocationSize(s32 filenum);