diff --git a/Makefile b/Makefile index 7ecc8c484..f80564093 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,15 @@ ROMALLOCATION_DATA = 0x015000 ROMALLOCATION_LIB = 0x038800 ROMALLOCATION_GAME = 0x144ee0 +# ROM_SIZE - The desired ROM size in megabytes. +# +# All versions of the retail ROM are 32MB. +# +# If this is too low you might get this error from ld: +# "final link failed: memory exhausted" + +ROM_SIZE := 32 + ################################################################################ # The VERSION constant is used in the source to handle version-specific code. @@ -102,6 +111,8 @@ COMPILER = ido ROMALLOCATION_DATA = 0x015000 ROMALLOCATION_LIB = 0x038800 +ROM_SIZE = 32 + ifeq ($(ROMID), ntsc-beta) PAL = 0 PIRACYCHECKS = 0 @@ -143,7 +154,12 @@ ifeq ($(ROMID), jpn-final) endif endif -DEFINES := VERSION=$(VERSION) MATCHING=$(MATCHING) PAL=$(PAL) PIRACYCHECKS=$(PIRACYCHECKS) _FINALROM=1 +DEFINES := \ + VERSION=$(VERSION) \ + MATCHING=$(MATCHING) \ + PAL=$(PAL) \ + PIRACYCHECKS=$(PIRACYCHECKS) \ + ROM_SIZE=$(ROM_SIZE) C_DEFINES := $(foreach d,$(DEFINES),-D$(d)) AS_DEFINES := $(foreach d,$(DEFINES),--defsym $(d)) --defsym _LANGUAGE_ASSEMBLY=1 @@ -519,7 +535,7 @@ build/recomp/%/err.english.cc: # Link all objects together with ld to make stage1.elf. In this stage, the game, # lib and data segments are uncompressed and placed past the end of the ROM. $(B_DIR)/stage1.elf: $(O_FILES) ld/pd.ld - cpp -DROMID=$(ROMID) -DVERSION=$(VERSION) -DROMALLOCATION_DATA=$(ROMALLOCATION_DATA) -DROMALLOCATION_LIB=$(ROMALLOCATION_LIB) -DROMALLOCATION_GAME=$(ROMALLOCATION_GAME) -P ld/pd.ld -o $(B_DIR)/pd.ld + cpp -DROMID=$(ROMID) -DVERSION=$(VERSION) -DROMALLOCATION_DATA=$(ROMALLOCATION_DATA) -DROMALLOCATION_LIB=$(ROMALLOCATION_LIB) -DROMALLOCATION_GAME=$(ROMALLOCATION_GAME) -DROM_SIZE=$(ROM_SIZE) -P ld/pd.ld -o $(B_DIR)/pd.ld $(TOOLCHAIN)-ld --no-check-sections -z muldefs -T $(B_DIR)/pd.ld --print-map -o $@ > $(B_DIR)/pd.map $(B_DIR)/stage1.bin: $(B_DIR)/stage1.elf diff --git a/include/PR/libaudio.h b/include/PR/libaudio.h index 74c951c40..b162b2ffb 100644 --- a/include/PR/libaudio.h +++ b/include/PR/libaudio.h @@ -968,9 +968,6 @@ void alSndpSetPriority(ALSndPlayer *sndp, ALSndId id, u8 priority); void alSndpSetFXMix(ALSndPlayer *sndp, u8 mix); s32 alSndpGetState(ALSndPlayer *sndp); -#ifndef _FINALROM -void alParseAbiCL(Acmd *cmdList, u32 nbytes); -#endif #ifdef _LANGUAGE_C_PLUS_PLUS } #endif diff --git a/include/PR/os_message.h b/include/PR/os_message.h index 5bc565e36..264379857 100644 --- a/include/PR/os_message.h +++ b/include/PR/os_message.h @@ -21,7 +21,7 @@ /*---------------------------------------------------------------------* Copyright (C) 1998 Nintendo. (Originated by SGI) - + $RCSfile: os_message.h,v $ $Revision: 1.1 $ $Date: 1998/10/09 08:01:15 $ @@ -75,11 +75,7 @@ typedef struct OSMesgQueue_s { */ /* Events */ -#ifdef _FINALROM #define OS_NUM_EVENTS 15 -#else -#define OS_NUM_EVENTS 23 -#endif #define OS_EVENT_SW1 0 /* CPU SW1 interrupt */ #define OS_EVENT_SW2 1 /* CPU SW2 interrupt */ @@ -96,16 +92,6 @@ typedef struct OSMesgQueue_s { #define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */ #define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */ #define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */ -#ifndef _FINALROM -#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */ -#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */ -#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */ -#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */ -#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */ -#define OS_EVENT_RDB_DBG_DONE 20 -#define OS_EVENT_RDB_FLUSH_PROF 21 -#define OS_EVENT_RDB_ACK_PROF 22 -#endif /* Flags to turn blocking on/off when sending/receiving message */ diff --git a/ld/pd.ld b/ld/pd.ld index c6fce69ff..59a32cf05 100644 --- a/ld/pd.ld +++ b/ld/pd.ld @@ -167,7 +167,7 @@ SECTIONS PLACEHOLDER_SEGMENT(libzip, ROMALLOCATION_LIB) - __rompos = 0x02000000; + __rompos = ROM_SIZE * 1024 * 1024; __rampos = 0x70001050; BEGIN_SEG(lib) SUBALIGN(0x10) @@ -367,7 +367,7 @@ SECTIONS * ------------------------------------------------------------------------- */ - __rampos = 0x02000000; + __rampos = ROM_SIZE * 1024 * 1024; BEGIN_SEG(textureconfig) { @@ -390,14 +390,14 @@ SECTIONS } END_SEG(getitle) - _getitleSegmentStart = 0x02000000; - _getitleSegmentEnd = 0x020065d0; - var020043f8 = 0x020043f8; - var02004468 = 0x02004468; - var02004700 = 0x02004700; - var02004d28 = 0x02004d28; - var02004dc8 = 0x02004dc8; - var02005dd0 = 0x02005dd0; + _getitleSegmentStart = ROM_SIZE * 1024 * 1024; + _getitleSegmentEnd = _getitleSegmentStart + 0x65d0; + var020043f8 = _getitleSegmentStart + 0x43f8; + var02004468 = _getitleSegmentStart + 0x4468; + var02004700 = _getitleSegmentStart + 0x4700; + var02004d28 = _getitleSegmentStart + 0x4d28; + var02004dc8 = _getitleSegmentStart + 0x4dc8; + var02005dd0 = _getitleSegmentStart + 0x5dd0; /*************************************************************************** * fonts @@ -603,12 +603,13 @@ SECTIONS _accessingpakSegmentRomEnd = 0; #endif - .fill : AT(__rompos) + BEGIN_SEG(fill) { FILL(0xff); - . = 0x02000000 - __rompos - 1; + . = ROM_SIZE * 1024 * 1024 - __rompos - 1; BYTE(0xff); } + END_SEG(fill) /DISCARD/ : { * (.MIPS.abiflags); diff --git a/src/game/texreset.c b/src/game/texreset.c index a74e61408..7a8e077b1 100644 --- a/src/game/texreset.c +++ b/src/game/texreset.c @@ -50,7 +50,7 @@ void texReset(void) g_TextureConfigSegment = mempAlloc(len, MEMPOOL_STAGE); dmaExec(g_TextureConfigSegment, (u32)&_textureconfigSegmentRomStart, len); - g_TexBase = (u32)g_TextureConfigSegment - 0x02000000; + g_TexBase = (u32)g_TextureConfigSegment - ROM_SIZE * 1024 * 1024; g_TexGdl1 = (Gfx *)(g_TexBase + (u32)g_TcGdl1); g_TexGdl2 = (Gfx *)(g_TexBase + (u32)g_TcGdl2); g_TexGdl3 = (Gfx *)(g_TexBase + (u32)g_TcGdl3); @@ -72,7 +72,7 @@ void texReset(void) g_TexGeneralConfigs = (struct textureconfig *)(g_TexBase + (u32)g_TcGeneralConfigs); g_TexRadarConfigs = (struct textureconfig *)(g_TexBase + (u32)g_TcRadarConfigs); - g_TexNumConfigs = (len - (u32)&g_TcWallhitConfigs + 0x02000000) / sizeof(struct textureconfig); + g_TexNumConfigs = (len - (u32)&g_TcWallhitConfigs + ROM_SIZE * 1024 * 1024) / sizeof(struct textureconfig); g_TexWords = mempAlloc(ALIGN16(g_TexNumConfigs * 4), MEMPOOL_STAGE); for (i = 0; i < g_TexNumConfigs; i++) { diff --git a/src/lib/dma.c b/src/lib/dma.c index c2e4c77ad..1244f853f 100644 --- a/src/lib/dma.c +++ b/src/lib/dma.c @@ -34,7 +34,7 @@ void dmaStart(void *memaddr, u32 romaddr, u32 len, bool priority) s32 i; #if VERSION < VERSION_NTSC_1_0 - if (romaddr >= 1024 * 1024 * 32) { + if (romaddr >= ROM_SIZE * 1024 * 1024) { crashSetMessage("DMA : Off the end of the rom"); CRASH(); } diff --git a/tools/mkrom/rom.c b/tools/mkrom/rom.c index 9ab525167..e7039bdec 100644 --- a/tools/mkrom/rom.c +++ b/tools/mkrom/rom.c @@ -40,13 +40,17 @@ void rom_load(char *filename) void rom_write(char *filename) { FILE *fp = fopen(filename, "wb"); + uint32_t fill_start; + uint32_t rom_size; if (!fp) { fprintf(stderr, "Unable to open \"%s\" for writing\n", filename); exit(1); } - fwrite(state.rom, 1024 * 1024 * 32, 1, fp); + map_get_segment_rompos("fill", &fill_start, &rom_size); + + fwrite(state.rom, rom_size, 1, fp); fclose(fp); }