Convert ROMALLOCATION constants into Makefile options
This commit is contained in:
parent
17583575e4
commit
46a88a3d59
26
Makefile
26
Makefile
|
@ -46,6 +46,19 @@ GCC_OPT_LVL = -Os
|
|||
|
||||
PAL = 0
|
||||
|
||||
# ROMALLOCATION
|
||||
#
|
||||
# The lib, data and game segments are compressed in the final ROM.
|
||||
#
|
||||
# These options define how much space is allocated for the compressed segments.
|
||||
#
|
||||
# If any value is not big enough, the build system will tell you which one needs
|
||||
# to be changed and what to change it to.
|
||||
|
||||
ROMALLOCATION_DATA = 0x015000
|
||||
ROMALLOCATION_LIB = 0x038800
|
||||
ROMALLOCATION_GAME = 0x144ee0
|
||||
|
||||
################################################################################
|
||||
|
||||
# The VERSION constant is used in the source to handle version-specific code.
|
||||
|
@ -86,34 +99,45 @@ COPYLEN = 2
|
|||
ifeq ($(MATCHING), 1)
|
||||
COMPILER = ido
|
||||
|
||||
ROMALLOCATION_DATA = 0x015000
|
||||
ROMALLOCATION_LIB = 0x038800
|
||||
|
||||
ifeq ($(ROMID), ntsc-beta)
|
||||
PAL = 0
|
||||
PIRACYCHECKS = 0
|
||||
ROMALLOCATION_DATA = 0x012000
|
||||
ROMALLOCATION_LIB = 0x02f800
|
||||
ROMALLOCATION_GAME = 0x105000
|
||||
endif
|
||||
ifeq ($(ROMID), ntsc-1.0)
|
||||
PAL = 0
|
||||
PIRACYCHECKS = 1
|
||||
ROMALLOCATION_GAME = 0x144ee0
|
||||
ZIPMAGIC = 0xffff
|
||||
endif
|
||||
ifeq ($(ROMID), ntsc-final)
|
||||
PAL = 0
|
||||
PIRACYCHECKS = 1
|
||||
ROMALLOCATION_GAME = 0x144ee0
|
||||
ZIPMAGIC = 0xffff
|
||||
endif
|
||||
ifeq ($(ROMID), pal-beta)
|
||||
PAL = 1
|
||||
PIRACYCHECKS = 1
|
||||
ROMALLOCATION_GAME = 0x1306f0
|
||||
ZIPMAGIC = 0x0c00
|
||||
COPYLEN = 6
|
||||
endif
|
||||
ifeq ($(ROMID), pal-final)
|
||||
PAL = 1
|
||||
PIRACYCHECKS = 1
|
||||
ROMALLOCATION_GAME = 0x1306f0
|
||||
ZIPMAGIC = 0xaf00
|
||||
endif
|
||||
ifeq ($(ROMID), jpn-final)
|
||||
PAL = 0
|
||||
PIRACYCHECKS = 1
|
||||
ROMALLOCATION_GAME = 0x1296f0
|
||||
ZIPMAGIC = 0x0002
|
||||
COPYLEN = 4
|
||||
endif
|
||||
|
@ -495,7 +519,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) -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) -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
|
||||
|
|
31
ld/pd.ld
31
ld/pd.ld
|
@ -69,37 +69,6 @@
|
|||
} \
|
||||
END_SEG(name)
|
||||
|
||||
/******************************************************************************
|
||||
* ROM Allocations
|
||||
* ----------------------------------------------------------------------------
|
||||
* The lib, data and game segments are compressed in the final ROM. To do this,
|
||||
* we build them uncompressed here but place them past the end of the ROM, then
|
||||
* mkrom compresses them and writes them into the ROM.
|
||||
*
|
||||
* These constants are defining how much space is reserved for the compressed
|
||||
* segments. If these segments are edited and grow to a point that their
|
||||
* compressed size exceeds the allocation then their allocations will need to be
|
||||
* increased.
|
||||
*/
|
||||
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
#define ROMALLOCATION_LIB 0x038800
|
||||
#define ROMALLOCATION_DATA 0x015000
|
||||
#define ROMALLOCATION_GAME 0x1296f0
|
||||
#elif VERSION >= VERSION_PAL_BETA
|
||||
#define ROMALLOCATION_LIB 0x038800
|
||||
#define ROMALLOCATION_DATA 0x015000
|
||||
#define ROMALLOCATION_GAME 0x1306f0
|
||||
#elif VERSION >= VERSION_NTSC_1_0
|
||||
#define ROMALLOCATION_LIB 0x038800
|
||||
#define ROMALLOCATION_DATA 0x015000
|
||||
#define ROMALLOCATION_GAME 0x144ee0
|
||||
#else
|
||||
#define ROMALLOCATION_LIB 0x02f800
|
||||
#define ROMALLOCATION_DATA 0x012000
|
||||
#define ROMALLOCATION_GAME 0x105000
|
||||
#endif
|
||||
|
||||
OUTPUT_ARCH (mips)
|
||||
|
||||
SECTIONS
|
||||
|
|
|
@ -20,7 +20,7 @@ static void copy(char *segname, uint8_t *payload, size_t len, char *constname)
|
|||
|
||||
if (len > allocation) {
|
||||
fprintf(stderr, "The %s segment is too big after compression to fit the allocation of 0x%x.\n", segname, allocation);
|
||||
fprintf(stderr, "In ld/pd.ld, increase the value of %s to 0x%x or higher.\n", constname, len);
|
||||
fprintf(stderr, "In the Makefile, increase the value of %s to 0x%x or higher.\n", constname, len);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue