From 13527755de932ac8dad66405a414889ab4671c51 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 16 Dec 2019 17:41:04 +1000 Subject: [PATCH] Rename rarezip segment to inflate --- Makefile | 12 +++++----- README.md | 4 ++-- checksums.md5 | 2 +- ld/stage1.ld | 10 ++++---- src/boot/boot.c | 10 ++++---- src/{rarezip/rarezip.c => inflate/inflate.c} | 24 ++++++++++---------- tools/buildrom | 6 ++--- tools/extract | 2 +- 8 files changed, 35 insertions(+), 35 deletions(-) rename src/{rarezip/rarezip.c => inflate/inflate.c} (99%) diff --git a/Makefile b/Makefile index 108648096..7557cd924 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ UCODE_BIN_FILES := \ $(B_DIR)/ucode/game.bin \ $(B_DIR)/ucode/gvars.bin \ $(B_DIR)/ucode/library.bin \ - $(B_DIR)/ucode/rarezip.bin \ + $(B_DIR)/ucode/inflate.bin \ $(B_DIR)/ucode/setup.bin default: all @@ -238,13 +238,13 @@ $(B_DIR)/ucode/setup.bin: $(B_DIR)/stage1.bin setup: $(B_DIR)/ucode/setup.bin ################################################################################ -# Rarezip +# Inflate -$(B_DIR)/ucode/rarezip.bin: $(B_DIR)/stage1.bin +$(B_DIR)/ucode/inflate.bin: $(B_DIR)/stage1.bin mkdir -p $(B_DIR)/ucode - B_DIR=$(B_DIR) tools/extract-segment rarezip + B_DIR=$(B_DIR) tools/extract-segment inflate -rarezip: $(B_DIR)/ucode/rarezip.bin +inflate: $(B_DIR)/ucode/inflate.bin ################################################################################ # Main game @@ -320,4 +320,4 @@ clean: binclean: rm -f build/ntsc-final/ucode/*.bin - find src/{boot,game,gvars,library,rarezip,setup} -name '*.o' -delete + find src/{boot,game,gvars,library,inflate,setup} -name '*.o' -delete diff --git a/README.md b/README.md index 36e69cdaf..880a41782 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This repository contains a work-in-progress decompilation of Perfect Dark for th | 0x1000 boot | 22/52 functions done (42.31%) | | 0x3050 library | 27/950 functions done (2.84%) | | 0x39850 setup | About 50% identified | -| 0x4e850 rarezip | 2/8 functions done (25.00%) | +| 0x4e850 inflate | 2/8 functions done (25.00%) | | 0x4fc40 game | 478/4196 functions done (11.39%) | | Lang files | Done | | Setup files | Done | @@ -68,7 +68,7 @@ Before you do anything you need an existing ROM to extract assets from. The project can do the following: -* Build individual ucode binaries (boot, library, setup, rarezip and game) which match the ones extracted from the base ROM. +* Build individual ucode binaries (boot, library, setup, inflate and game) which match the ones extracted from the base ROM. * Build a functioning ROM by splicing the C source and assets into an existing ROM. The built ROM is not byte perfect yet, but is is functionally equivalent. * Run `make` to build the assets that will be included in the ROM. These files will be written to `build/ntsc-final` and are matching what's in the `extracted/ntsc-final` folder. diff --git a/checksums.md5 b/checksums.md5 index 0ced99acb..f3d30aec3 100644 --- a/checksums.md5 +++ b/checksums.md5 @@ -2013,6 +2013,6 @@ ea5a2ff4e5e0a68822f62feff2c40af4 build/ntsc-final/files/bgdata/bg_wax_tilesZ d41d8cd98f00b204e9800998ecf8427e build/ntsc-final/files/ob/ob_mid.seg 2a1aa1eff3cdfe5dc3e91a2e773a55b9 build/ntsc-final/ucode/boot.bin ed0462324d1287de21611707172d316a build/ntsc-final/ucode/game.bin +843285fdc0e80a77576eeb73940d2fd3 build/ntsc-final/ucode/inflate.bin 6a227624d708b43a10f220e005aef486 build/ntsc-final/ucode/library.bin -843285fdc0e80a77576eeb73940d2fd3 build/ntsc-final/ucode/rarezip.bin 11c9c4c2737f66e7312949909b894dcc build/ntsc-final/ucode/setup.bin diff --git a/ld/stage1.ld b/ld/stage1.ld index 69c19a166..9a78dbf5b 100644 --- a/ld/stage1.ld +++ b/ld/stage1.ld @@ -14,7 +14,7 @@ SECTIONS { setupSegmentStart = 0x80059fe0; setupSegmentRomStart = 0x39850; - rarezipSegmentRomStart = 0x4e850; + inflateSegmentRomStart = 0x4e850; ziplistSegmentRomStart = 0x4fc40; __rompos = 0; @@ -504,11 +504,11 @@ SECTIONS } __rompos += SIZEOF(.game); - .rarezip 0x70200000 : AT(__rompos) { - src/rarezip/rarezip.o (.text); - src/rarezip/rarezip.o (.data); + .inflate 0x70200000 : AT(__rompos) { + src/inflate/inflate.o (.text); + src/inflate/inflate.o (.data); } - __rompos += SIZEOF(.rarezip); + __rompos += SIZEOF(.inflate); __rompos = 0xed83a0; _filesSegmentRomStart = __rompos; diff --git a/src/boot/boot.c b/src/boot/boot.c index 629bae901..ce2e366ff 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -479,18 +479,18 @@ void *getSetupRomAddr(void) return &setupSegmentRomStart; } -extern void *rarezipSegmentRomStart; +extern void *inflateSegmentRomStart; // func0001688 -void *getRarezipRomAddr(void) +void *getInflateRomAddr(void) { - return &rarezipSegmentRomStart; + return &inflateSegmentRomStart; } // func0001694 -void *getRarezipRomAddr2(void) +void *getInflateRomAddr2(void) { - return &rarezipSegmentRomStart; + return &inflateSegmentRomStart; } extern void *ziplistSegmentRomStart; diff --git a/src/rarezip/rarezip.c b/src/inflate/inflate.c similarity index 99% rename from src/rarezip/rarezip.c rename to src/inflate/inflate.c index 54d998b2c..6da9bf114 100644 --- a/src/rarezip/rarezip.c +++ b/src/inflate/inflate.c @@ -448,7 +448,7 @@ glabel func70200000 ); GLOBAL_ASM( -glabel func7020055c +glabel inflateCodes /* 7020055c: 27bdfff0 */ addiu $sp,$sp,-16 /* 70200560: 3c0a7020 */ lui $t2,0x7020 /* 70200564: 254a13bc */ addiu $t2,$t2,0x13bc @@ -691,7 +691,7 @@ glabel func7020055c ); GLOBAL_ASM( -glabel func702008c0 +glabel inflateStored /* 702008c0: 3c097020 */ lui $t1,0x7020 /* 702008c4: 252913b8 */ addiu $t1,$t1,0x13b8 /* 702008c8: 8d240000 */ lw $a0,0x0($t1) @@ -788,7 +788,7 @@ glabel func702008c0 ); GLOBAL_ASM( -glabel func70200a14 +glabel inflateFixed /* 70200a14: 27bdfb40 */ addiu $sp,$sp,-1216 /* 70200a18: afbf0024 */ sw $ra,0x24($sp) /* 70200a1c: 27a2002c */ addiu $v0,$sp,0x2c @@ -870,7 +870,7 @@ glabel func70200a14 /* 70200b2c: 8fa404b8 */ lw $a0,0x4b8($sp) /* 70200b30: 8fa504b4 */ lw $a1,0x4b4($sp) /* 70200b34: 8fa604b0 */ lw $a2,0x4b0($sp) -/* 70200b38: 0c080157 */ jal func7020055c +/* 70200b38: 0c080157 */ jal inflateCodes /* 70200b3c: 8fa704ac */ lw $a3,0x4ac($sp) /* 70200b40: 8fbf0024 */ lw $ra,0x24($sp) /* 70200b44: 27bd04c0 */ addiu $sp,$sp,0x4c0 @@ -880,7 +880,7 @@ glabel func70200a14 ); GLOBAL_ASM( -glabel func70200b54 +glabel inflateDynamic /* 70200b54: 3c087020 */ lui $t0,0x7020 /* 70200b58: 8d0813b8 */ lw $t0,0x13b8($t0) /* 70200b5c: 27bdfa98 */ addiu $sp,$sp,-1384 @@ -1233,7 +1233,7 @@ glabel func70200b54 /* 70201050: 8fa40550 */ lw $a0,0x550($sp) /* 70201054: 8fa5054c */ lw $a1,0x54c($sp) /* 70201058: 8fa60548 */ lw $a2,0x548($sp) -/* 7020105c: 0c080157 */ jal func7020055c +/* 7020105c: 0c080157 */ jal inflateCodes /* 70201060: 8fa70544 */ lw $a3,0x544($sp) /* 70201064: 8fbf002c */ lw $ra,0x2c($sp) /* 70201068: 8fb00028 */ lw $s0,0x28($sp) @@ -1243,7 +1243,7 @@ glabel func70200b54 ); GLOBAL_ASM( -glabel inflate_block +glabel inflateBlock /* 70201078: 3c097020 */ lui $t1,0x7020 /* 7020107c: 252913b8 */ addiu $t1,$t1,0x13b8 /* 70201080: 8d230000 */ lw $v1,0x0($t1) @@ -1299,21 +1299,21 @@ glabel inflate_block /* 70201138: ad180000 */ sw $t8,0x0($t0) /* 7020113c: 14410005 */ bne $v0,$at,.L70201154 /* 70201140: ad230000 */ sw $v1,0x0($t1) -/* 70201144: 0c0802d5 */ jal func70200b54 +/* 70201144: 0c0802d5 */ jal inflateDynamic /* 70201148: 00000000 */ nop /* 7020114c: 1000000f */ b .L7020118c /* 70201150: 8fbf0014 */ lw $ra,0x14($sp) .L70201154: /* 70201154: 14400005 */ bnez $v0,.L7020116c /* 70201158: 24010001 */ li $at,0x1 -/* 7020115c: 0c080230 */ jal func702008c0 +/* 7020115c: 0c080230 */ jal inflateStored /* 70201160: 00000000 */ nop /* 70201164: 10000009 */ b .L7020118c /* 70201168: 8fbf0014 */ lw $ra,0x14($sp) .L7020116c: /* 7020116c: 54410006 */ bnel $v0,$at,.L70201188 /* 70201170: 24020002 */ li $v0,0x2 -/* 70201174: 0c080285 */ jal func70200a14 +/* 70201174: 0c080285 */ jal inflateFixed /* 70201178: 00000000 */ nop /* 7020117c: 10000003 */ b .L7020118c /* 70201180: 8fbf0014 */ lw $ra,0x14($sp) @@ -1340,7 +1340,7 @@ u32 inflate(void) do { hufts = 0; - r = inflate_block(&sp52); + r = inflateBlock(&sp52); if (r != 0) { return r; @@ -1360,7 +1360,7 @@ u32 inflate(void) } // 70201268 -u32 rarezip_inflate(void *src, void *dst, void *buffer) +u32 inflate1173(void *src, void *dst, void *buffer) { g_pSrc = src; g_pDst = dst; diff --git a/tools/buildrom b/tools/buildrom index 44df0418a..f6e0e0b1f 100755 --- a/tools/buildrom +++ b/tools/buildrom @@ -21,7 +21,7 @@ def main(): write_binary(fd, 0x1000, get_boot()) write_binary(fd, 0x3050, get_library()) write_binary(fd, 0x39850, get_setup()) - write_binary(fd, 0x4e850, get_rarezip()) + write_binary(fd, 0x4e850, get_inflate()) write_binary(fd, 0x4fc40, get_gamezips()) write_binary(fd, 0x7f2388, get_fonts()) write_binary(fd, 0x80a250, get_sfxctl()) @@ -67,8 +67,8 @@ def get_library(): def get_setup(): return zip('build/ntsc-final/ucode/setup.bin') -def get_rarezip(): - return getfilecontents('build/ntsc-final/ucode/rarezip.bin') +def get_inflate(): + return getfilecontents('build/ntsc-final/ucode/inflate.bin') def get_gamezips(): return getfilecontents('build/ntsc-final/ucode/gamezips.bin') diff --git a/tools/extract b/tools/extract index 64112075c..10d802d8b 100755 --- a/tools/extract +++ b/tools/extract @@ -173,7 +173,7 @@ class Extractor: self.write('ucode/rspboot.bin', self.rom[0x40:0x1000]) self.write('ucode/boot.bin', self.rom[0x1000:0x3050]) self.write('ucode/library.bin', self.decompress(self.rom[0x3050:])) - self.write('ucode/rarezip.bin', self.rom[0x4e850:0x4fc40]) + self.write('ucode/inflate.bin', self.rom[0x4e850:0x4fc40]) self.extract_ucode_game() def extract_ucode_game(self):