Merge boot segment into lib

This commit is contained in:
Ryan Dwyer 2021-03-08 12:18:53 +10:00
parent 6ce32b7c88
commit 34438419e5
29 changed files with 139 additions and 78 deletions

View File

@ -126,8 +126,8 @@ CFLAGS = -DVERSION=$(VERSION) \
$(OPT_LVL) \ $(OPT_LVL) \
$(MIPSISET) $(MIPSISET)
C_FILES := $(shell find src/gvars src/boot src/lib src/game src/inflate -name '*.c') C_FILES := $(shell find src/gvars src/lib src/game src/inflate -name '*.c')
S_FILES := $(shell find src/boot src/lib src/game -name '*.s') S_FILES := $(shell find src/lib src/game -name '*.s')
# Create names such as $(B_DIR)/assets/files/PfooZ # Create names such as $(B_DIR)/assets/files/PfooZ
# These names (with .o added) will be dependenices for LD # These names (with .o added) will be dependenices for LD
@ -232,7 +232,6 @@ $(B_DIR)/pd.z64: $(B_DIR)/stage3.bin
# stage 2, then extract-segment is used to slice out the segments. # stage 2, then extract-segment is used to slice out the segments.
CHECK_FILES := \ CHECK_FILES := \
$(B_DIR)/segments/boot.bin \
$(B_DIR)/segments/filenames.bin \ $(B_DIR)/segments/filenames.bin \
$(B_DIR)/segments/firingrange.bin \ $(B_DIR)/segments/firingrange.bin \
$(B_DIR)/segments/game.bin \ $(B_DIR)/segments/game.bin \
@ -449,11 +448,6 @@ $(B_DIR)/assets/animations/list.o: src/assets/animations/list.c
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(IDOCC) -c $(CFLAGS) $< -o $@ $(IDOCC) -c $(CFLAGS) $< -o $@
$(B_DIR)/boot/%.o: src/boot/%.c
@mkdir -p $(dir $@)
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
$(B_DIR)/lib/ultra/libc/llcvt.o: src/lib/ultra/libc/llcvt.c $(B_DIR)/lib/ultra/libc/llcvt.o: src/lib/ultra/libc/llcvt.c
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@ /usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
@ -519,4 +513,4 @@ assetsclean:
codeclean: codeclean:
rm -f $(B_DIR)/segments/*.bin rm -f $(B_DIR)/segments/*.bin
find $(B_DIR)/{boot,game,gvars,inflate,lib} -name '*.o' -delete find $(B_DIR)/{game,gvars,inflate,lib} -name '*.o' -delete

View File

@ -2014,12 +2014,11 @@ f0068491f441172310f2b6868c03739d build/jpn-final/assets/files/bgdata/bg_wax_pad
ea5a2ff4e5e0a68822f62feff2c40af4 build/jpn-final/assets/files/bgdata/bg_wax_tilesZ ea5a2ff4e5e0a68822f62feff2c40af4 build/jpn-final/assets/files/bgdata/bg_wax_tilesZ
d41d8cd98f00b204e9800998ecf8427e build/jpn-final/assets/files/ob/ob_mid.seg d41d8cd98f00b204e9800998ecf8427e build/jpn-final/assets/files/ob/ob_mid.seg
538d2b75945eae069b29c46193e74790 build/jpn-final/pd.z64 538d2b75945eae069b29c46193e74790 build/jpn-final/pd.z64
39ef58f5babf5d619bec8b2629c26bc8 build/jpn-final/segments/boot.bin
333e8b4f6fe9dc9b59cf3e61b4e0c224 build/jpn-final/segments/firingrange.bin 333e8b4f6fe9dc9b59cf3e61b4e0c224 build/jpn-final/segments/firingrange.bin
bd6e5fc360d5e0c35ea3605e2514f205 build/jpn-final/segments/game.bin bd6e5fc360d5e0c35ea3605e2514f205 build/jpn-final/segments/game.bin
22d5e92bffcc67b222cf3697e96106f6 build/jpn-final/segments/data.bin 22d5e92bffcc67b222cf3697e96106f6 build/jpn-final/segments/data.bin
843285fdc0e80a77576eeb73940d2fd3 build/jpn-final/segments/inflate.bin 843285fdc0e80a77576eeb73940d2fd3 build/jpn-final/segments/inflate.bin
c550660ff4ba024113ddb38103bf79f8 build/jpn-final/segments/lib.bin dd3b5fe7696544bb41e97cfae67fd431 build/jpn-final/segments/lib.bin
c47d9377956666bc0e77d6cba3dc68fb build/jpn-final/segments/mpconfigs.bin c47d9377956666bc0e77d6cba3dc68fb build/jpn-final/segments/mpconfigs.bin
529b54a03375af2ff74eb3367cbac294 build/jpn-final/segments/mpstringsE.bin 529b54a03375af2ff74eb3367cbac294 build/jpn-final/segments/mpstringsE.bin
4d1eb9e58e090aa91301917c518b5b5f build/jpn-final/segments/mpstringsF.bin 4d1eb9e58e090aa91301917c518b5b5f build/jpn-final/segments/mpstringsF.bin

View File

@ -2012,12 +2012,11 @@ f0068491f441172310f2b6868c03739d build/ntsc-1.0/assets/files/bgdata/bg_wax_pads
ea5a2ff4e5e0a68822f62feff2c40af4 build/ntsc-1.0/assets/files/bgdata/bg_wax_tilesZ ea5a2ff4e5e0a68822f62feff2c40af4 build/ntsc-1.0/assets/files/bgdata/bg_wax_tilesZ
d41d8cd98f00b204e9800998ecf8427e build/ntsc-1.0/assets/files/ob/ob_mid.seg d41d8cd98f00b204e9800998ecf8427e build/ntsc-1.0/assets/files/ob/ob_mid.seg
7f4171b0c8d17815be37913f535e4e93 build/ntsc-1.0/pd.z64 7f4171b0c8d17815be37913f535e4e93 build/ntsc-1.0/pd.z64
402561223a33f48461e302e1cca12129 build/ntsc-1.0/segments/boot.bin
cb373c94109322d081a57b142fdd9999 build/ntsc-1.0/segments/firingrange.bin cb373c94109322d081a57b142fdd9999 build/ntsc-1.0/segments/firingrange.bin
5181a0d11cf8f24370a3f2d3b29e522e build/ntsc-1.0/segments/game.bin 5181a0d11cf8f24370a3f2d3b29e522e build/ntsc-1.0/segments/game.bin
b21679a1b2dabd721bc4afee11bf5266 build/ntsc-1.0/segments/data.bin b21679a1b2dabd721bc4afee11bf5266 build/ntsc-1.0/segments/data.bin
843285fdc0e80a77576eeb73940d2fd3 build/ntsc-1.0/segments/inflate.bin 843285fdc0e80a77576eeb73940d2fd3 build/ntsc-1.0/segments/inflate.bin
3155eece856e9fbd9bc47d03463cfc1b build/ntsc-1.0/segments/lib.bin 0ee07d5d8e890e264e775e4034e3b900 build/ntsc-1.0/segments/lib.bin
fe4034c01c91bd10e488fe93389b4104 build/ntsc-1.0/segments/mpconfigs.bin fe4034c01c91bd10e488fe93389b4104 build/ntsc-1.0/segments/mpconfigs.bin
529b54a03375af2ff74eb3367cbac294 build/ntsc-1.0/segments/mpstringsE.bin 529b54a03375af2ff74eb3367cbac294 build/ntsc-1.0/segments/mpstringsE.bin
e4f45399a4f97e3fd6733f0f6919d28d build/ntsc-1.0/segments/mpstringsF.bin e4f45399a4f97e3fd6733f0f6919d28d build/ntsc-1.0/segments/mpstringsF.bin

View File

@ -2011,12 +2011,11 @@ c6f0dd6193685637763d426dfce837fb build/ntsc-beta/assets/files/bgdata/bg_wax_pad
ea5a2ff4e5e0a68822f62feff2c40af4 build/ntsc-beta/assets/files/bgdata/bg_wax_tilesZ ea5a2ff4e5e0a68822f62feff2c40af4 build/ntsc-beta/assets/files/bgdata/bg_wax_tilesZ
d41d8cd98f00b204e9800998ecf8427e build/ntsc-beta/assets/files/ob/ob_mid.seg d41d8cd98f00b204e9800998ecf8427e build/ntsc-beta/assets/files/ob/ob_mid.seg
aa93f4df16fceada399a749f5ad2f273 build/ntsc-beta/pd.z64 aa93f4df16fceada399a749f5ad2f273 build/ntsc-beta/pd.z64
74cb41628ed5784a8ad48c6398b0ce83 build/ntsc-beta/segments/boot.bin
a12b5437510403bb09b3cceb45dd2a10 build/ntsc-beta/segments/firingrange.bin a12b5437510403bb09b3cceb45dd2a10 build/ntsc-beta/segments/firingrange.bin
daae19f7ce11d3f3e1f98d543ad856f5 build/ntsc-beta/segments/game.bin daae19f7ce11d3f3e1f98d543ad856f5 build/ntsc-beta/segments/game.bin
cab47b8c30b1be608c1c5c1db08342de build/ntsc-beta/segments/data.bin cab47b8c30b1be608c1c5c1db08342de build/ntsc-beta/segments/data.bin
d13f25c1c59fb96346ac23301ccd9d7d build/ntsc-beta/segments/inflate.bin d13f25c1c59fb96346ac23301ccd9d7d build/ntsc-beta/segments/inflate.bin
14aa42e2f0f215d931900d25ab70e576 build/ntsc-beta/segments/lib.bin 900199658b5cfb5a3c16844abc9da56e build/ntsc-beta/segments/lib.bin
8aaec8cc806ec62d2f70eaa08282e9c0 build/ntsc-beta/segments/mpconfigs.bin 8aaec8cc806ec62d2f70eaa08282e9c0 build/ntsc-beta/segments/mpconfigs.bin
d52a0fc2e90e03b610879b50df4c0fd4 build/ntsc-beta/segments/mpstringsE.bin d52a0fc2e90e03b610879b50df4c0fd4 build/ntsc-beta/segments/mpstringsE.bin
e4f45399a4f97e3fd6733f0f6919d28d build/ntsc-beta/segments/mpstringsF.bin e4f45399a4f97e3fd6733f0f6919d28d build/ntsc-beta/segments/mpstringsF.bin

View File

@ -2012,12 +2012,11 @@ f0068491f441172310f2b6868c03739d build/ntsc-final/assets/files/bgdata/bg_wax_pa
ea5a2ff4e5e0a68822f62feff2c40af4 build/ntsc-final/assets/files/bgdata/bg_wax_tilesZ ea5a2ff4e5e0a68822f62feff2c40af4 build/ntsc-final/assets/files/bgdata/bg_wax_tilesZ
d41d8cd98f00b204e9800998ecf8427e build/ntsc-final/assets/files/ob/ob_mid.seg d41d8cd98f00b204e9800998ecf8427e build/ntsc-final/assets/files/ob/ob_mid.seg
e03b088b6ac9e0080440efed07c1e40f build/ntsc-final/pd.z64 e03b088b6ac9e0080440efed07c1e40f build/ntsc-final/pd.z64
2a1aa1eff3cdfe5dc3e91a2e773a55b9 build/ntsc-final/segments/boot.bin
cb373c94109322d081a57b142fdd9999 build/ntsc-final/segments/firingrange.bin cb373c94109322d081a57b142fdd9999 build/ntsc-final/segments/firingrange.bin
ed0462324d1287de21611707172d316a build/ntsc-final/segments/game.bin ed0462324d1287de21611707172d316a build/ntsc-final/segments/game.bin
11c9c4c2737f66e7312949909b894dcc build/ntsc-final/segments/data.bin 11c9c4c2737f66e7312949909b894dcc build/ntsc-final/segments/data.bin
843285fdc0e80a77576eeb73940d2fd3 build/ntsc-final/segments/inflate.bin 843285fdc0e80a77576eeb73940d2fd3 build/ntsc-final/segments/inflate.bin
6a227624d708b43a10f220e005aef486 build/ntsc-final/segments/lib.bin 5ab66459c09843f5953718643c998625 build/ntsc-final/segments/lib.bin
fe4034c01c91bd10e488fe93389b4104 build/ntsc-final/segments/mpconfigs.bin fe4034c01c91bd10e488fe93389b4104 build/ntsc-final/segments/mpconfigs.bin
529b54a03375af2ff74eb3367cbac294 build/ntsc-final/segments/mpstringsE.bin 529b54a03375af2ff74eb3367cbac294 build/ntsc-final/segments/mpstringsE.bin
302f7aa0464c781187551fcd3870aec2 build/ntsc-final/segments/mpstringsJ.bin 302f7aa0464c781187551fcd3870aec2 build/ntsc-final/segments/mpstringsJ.bin

View File

@ -2012,12 +2012,11 @@ f0068491f441172310f2b6868c03739d build/pal-beta/assets/files/bgdata/bg_wax_pads
ea5a2ff4e5e0a68822f62feff2c40af4 build/pal-beta/assets/files/bgdata/bg_wax_tilesZ ea5a2ff4e5e0a68822f62feff2c40af4 build/pal-beta/assets/files/bgdata/bg_wax_tilesZ
d41d8cd98f00b204e9800998ecf8427e build/pal-beta/assets/files/ob/ob_mid.seg d41d8cd98f00b204e9800998ecf8427e build/pal-beta/assets/files/ob/ob_mid.seg
ad2de210a3455ba5ec541f0c78d91444 build/pal-beta/pd.z64 ad2de210a3455ba5ec541f0c78d91444 build/pal-beta/pd.z64
541e374b58a36056f73ad02a2bbb5f75 build/pal-beta/segments/boot.bin
333e8b4f6fe9dc9b59cf3e61b4e0c224 build/pal-beta/segments/firingrange.bin 333e8b4f6fe9dc9b59cf3e61b4e0c224 build/pal-beta/segments/firingrange.bin
ad5835b91b7e252ef8f4a421a44eb12b build/pal-beta/segments/game.bin ad5835b91b7e252ef8f4a421a44eb12b build/pal-beta/segments/game.bin
bca5001a5dd0ef9aab24ba085f27eb40 build/pal-beta/segments/data.bin bca5001a5dd0ef9aab24ba085f27eb40 build/pal-beta/segments/data.bin
843285fdc0e80a77576eeb73940d2fd3 build/pal-beta/segments/inflate.bin 843285fdc0e80a77576eeb73940d2fd3 build/pal-beta/segments/inflate.bin
7a859fcb6e89426543b5a207cc388f82 build/pal-beta/segments/lib.bin 317967a2f69b8e33ce588b0223ea3859 build/pal-beta/segments/lib.bin
fe4034c01c91bd10e488fe93389b4104 build/pal-beta/segments/mpconfigs.bin fe4034c01c91bd10e488fe93389b4104 build/pal-beta/segments/mpconfigs.bin
529b54a03375af2ff74eb3367cbac294 build/pal-beta/segments/mpstringsE.bin 529b54a03375af2ff74eb3367cbac294 build/pal-beta/segments/mpstringsE.bin
bed567631daf314f79ec8a2aa994f3a0 build/pal-beta/segments/mpstringsF.bin bed567631daf314f79ec8a2aa994f3a0 build/pal-beta/segments/mpstringsF.bin

View File

@ -2012,12 +2012,11 @@ f0068491f441172310f2b6868c03739d build/pal-final/assets/files/bgdata/bg_wax_pad
ea5a2ff4e5e0a68822f62feff2c40af4 build/pal-final/assets/files/bgdata/bg_wax_tilesZ ea5a2ff4e5e0a68822f62feff2c40af4 build/pal-final/assets/files/bgdata/bg_wax_tilesZ
d41d8cd98f00b204e9800998ecf8427e build/pal-final/assets/files/ob/ob_mid.seg d41d8cd98f00b204e9800998ecf8427e build/pal-final/assets/files/ob/ob_mid.seg
d9b5cd305d228424891ce38e71bc9213 build/pal-final/pd.z64 d9b5cd305d228424891ce38e71bc9213 build/pal-final/pd.z64
7c4233976802db99f90c6c0fede1080b build/pal-final/segments/boot.bin
333e8b4f6fe9dc9b59cf3e61b4e0c224 build/pal-final/segments/firingrange.bin 333e8b4f6fe9dc9b59cf3e61b4e0c224 build/pal-final/segments/firingrange.bin
4e506821044251aecc10ec332389c576 build/pal-final/segments/game.bin 4e506821044251aecc10ec332389c576 build/pal-final/segments/game.bin
1c49c171e829a5407f0ae5fd28a123cd build/pal-final/segments/data.bin 1c49c171e829a5407f0ae5fd28a123cd build/pal-final/segments/data.bin
843285fdc0e80a77576eeb73940d2fd3 build/pal-final/segments/inflate.bin 843285fdc0e80a77576eeb73940d2fd3 build/pal-final/segments/inflate.bin
b83973db626573e024608444e5d74461 build/pal-final/segments/lib.bin ba4edc92cda812aaddff2810be77dbf7 build/pal-final/segments/lib.bin
7f5540dd6fff2039b2ce05bf57ac5611 build/pal-final/segments/mpconfigs.bin 7f5540dd6fff2039b2ce05bf57ac5611 build/pal-final/segments/mpconfigs.bin
529b54a03375af2ff74eb3367cbac294 build/pal-final/segments/mpstringsE.bin 529b54a03375af2ff74eb3367cbac294 build/pal-final/segments/mpstringsE.bin
4d1eb9e58e090aa91301917c518b5b5f build/pal-final/segments/mpstringsF.bin 4d1eb9e58e090aa91301917c518b5b5f build/pal-final/segments/mpstringsF.bin

View File

@ -1,7 +0,0 @@
#define BOOTFILES(section) \
build/ROMID/boot/entry.o (section); \
build/ROMID/boot/segments.o (section); \
build/ROMID/boot/init.o (section); \
build/ROMID/boot/sched.o (section); \
build/ROMID/boot/reset.o (section); \
build/ROMID/lib/ultra/os/maptlbrdb.o (section);

View File

@ -1,4 +1,10 @@
#define LIBFILES(section) \ #define LIBFILES(section) \
build/ROMID/lib/entry.o (section); \
build/ROMID/lib/segments.o (section); \
build/ROMID/lib/init.o (section); \
build/ROMID/lib/sched.o (section); \
build/ROMID/lib/reset.o (section); \
build/ROMID/lib/ultra/os/maptlbrdb.o (section); \
build/ROMID/game/data/data_000000.o (section); \ build/ROMID/game/data/data_000000.o (section); \
build/ROMID/lib/ultra/io/vimgr.o (section); \ build/ROMID/lib/ultra/io/vimgr.o (section); \
build/ROMID/lib/ultra/io/pimgr.o (section); \ build/ROMID/lib/ultra/io/pimgr.o (section); \

View File

@ -1,4 +1,3 @@
#include "bootfiles.inc"
#include "gamefiles.inc" #include "gamefiles.inc"
#include "libfiles.inc" #include "libfiles.inc"
@ -77,7 +76,7 @@
* increased. * increased.
*/ */
#define ROMALLOCATION_LIB 0x036800 #define ROMALLOCATION_LIB 0x038850
#define ROMALLOCATION_DATA 0x015000 #define ROMALLOCATION_DATA 0x015000
#define ROMALLOCATION_GAME 0x151980 #define ROMALLOCATION_GAME 0x151980
@ -180,46 +179,28 @@ SECTIONS
} }
END_SEG(bootloader) END_SEG(bootloader)
/***************************************************************************
* boot
* -------------------------------------------------------------------------
* ROM range: 0x00001000 - 0x00003050
* RAM range: 0x70001000 - 0x70003050
* -------------------------------------------------------------------------
*/
__rampos = 0x70001000;
BEGIN_SEG(boot)
{
BOOTFILES(.text)
}
END_SEG(boot)
_bootSegmentStart = 0x70001050;
/*************************************************************************** /***************************************************************************
* lib * lib
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* ROM range: 0x00003050 - 0x00039850 (compressed) * ROM range: 0x00001000 - 0x00039850 (compressed from 0x3050 onwards)
* RAM range: 0x70003050 - 0x70059fe0 * RAM range: 0x70001000 - 0x70059fe0
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* This compressed segment must be placed immediately after boot, because
* the boot code calculates the lib address as boot start + boot length.
*/ */
PLACEHOLDER_SEGMENT(libzip) PLACEHOLDER_SEGMENT(libzip)
__rompos = 0x02000000; __rompos = 0x02000000;
__rampos = 0x70001000;
BEGIN_SEG(lib) BEGIN_SEG(lib)
{ {
LIBFILES(.text) LIBFILES(.text)
BOOTFILES(.rodata)
LIBFILES(.rodata) LIBFILES(.rodata)
} }
END_SEG(lib) END_SEG(lib)
_libSegmentStart = 0x70001050;
/*************************************************************************** /***************************************************************************
* data * data
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
@ -235,7 +216,7 @@ SECTIONS
PLACEHOLDER_SEGMENT(datazip) PLACEHOLDER_SEGMENT(datazip)
__rompos = __savedrompos; __rompos = __savedrompos;
__rampos = 0x80001000 + SIZEOF(.boot) + SIZEOF(.lib); __rampos = 0x80001000 + SIZEOF(.lib);
BEGIN_SEG(data) BEGIN_SEG(data)
{ {

View File

@ -1,6 +1,6 @@
#include <ultra64.h> #include <ultra64.h>
#include "constants.h" #include "constants.h"
#include "boot/sched.h" #include "lib/sched.h"
#include "game/camdraw.h" #include "game/camdraw.h"
#include "game/cheats.h" #include "game/cheats.h"
#include "game/inventory/inventory.h" #include "game/inventory/inventory.h"

View File

@ -1,5 +1,5 @@
#include <ultra64.h> #include <ultra64.h>
#include "boot/sched.h" #include "lib/sched.h"
#include "constants.h" #include "constants.h"
#include "game/bondmove.h" #include "game/bondmove.h"
#include "game/cheats.h" #include "game/cheats.h"

View File

@ -1,5 +1,5 @@
#include <ultra64.h> #include <ultra64.h>
#include "boot/sched.h" #include "lib/sched.h"
#include "constants.h" #include "constants.h"
#include "game/dlights.h" #include "game/dlights.h"
#include "game/game_0b2150.h" #include "game/game_0b2150.h"

View File

@ -1,6 +1,6 @@
#include <ultra64.h> #include <ultra64.h>
#include "constants.h" #include "constants.h"
#include "boot/sched.h" #include "lib/sched.h"
#include "game/game_0b69d0.h" #include "game/game_0b69d0.h"
#include "game/game_176080.h" #include "game/game_176080.h"
#include "game/mplayer/mplayer.h" #include "game/mplayer/mplayer.h"

View File

@ -1,6 +1,6 @@
#include <ultra64.h> #include <ultra64.h>
#include "boot/init.h" #include "lib/init.h"
#include "boot/sched.h" #include "lib/sched.h"
#include "constants.h" #include "constants.h"
#include "gvars/gvars.h" #include "gvars/gvars.h"
#include "lib/lib_09660.h" #include "lib/lib_09660.h"

View File

@ -1,5 +1,5 @@
#include <ultra64.h> #include <ultra64.h>
#include "boot/entry.h" #include "lib/entry.h"
#include "constants.h" #include "constants.h"
#include "game/game_0e0770.h" #include "game/game_0e0770.h"
#include "gvars/gvars.h" #include "gvars/gvars.h"

View File

@ -1,8 +1,8 @@
#include <ultra64.h> #include <ultra64.h>
#include "boot/entry.h" #include "lib/entry.h"
#include "boot/init.h" #include "lib/init.h"
#include "boot/reset.h" #include "lib/reset.h"
#include "boot/segments.h" #include "lib/segments.h"
#include "constants.h" #include "constants.h"
#include "game/game_0e0770.h" #include "game/game_0e0770.h"
#include "gvars/gvars.h" #include "gvars/gvars.h"

View File

@ -1,5 +1,5 @@
#include <ultra64.h> #include <ultra64.h>
#include "boot/entry.h" #include "lib/entry.h"
#include "constants.h" #include "constants.h"
#include "gvars/gvars.h" #include "gvars/gvars.h"
#include "lib/lib_074f0.h" #include "lib/lib_074f0.h"

View File

@ -1,5 +1,5 @@
#include <ultra64.h> #include <ultra64.h>
#include "boot/sched.h" #include "lib/sched.h"
#include "constants.h" #include "constants.h"
#include "game/camdraw.h" #include "game/camdraw.h"
#include "game/cheats.h" #include "game/cheats.h"

View File

@ -1,10 +1,102 @@
#include <ultra64.h> #include <ultra64.h>
#include "constants.h" #include "constants.h"
#include "boot/reset.h" #include "lib/reset.h"
#include "gvars/gvars.h" #include "gvars/gvars.h"
#include "data.h" #include "data.h"
#include "types.h" #include "types.h"
#if VERSION >= VERSION_PAL_FINAL
GLOBAL_ASM(
glabel resetproc
/* 2df0: 27bdffd0 */ addiu $sp,$sp,-48
/* 2df4: afa40030 */ sw $a0,0x30($sp)
/* 2df8: afbf0014 */ sw $ra,0x14($sp)
/* 2dfc: 3c048009 */ lui $a0,0x8009
/* 2e00: afa0002c */ sw $zero,0x2c($sp)
/* 2e04: 2484fff8 */ addiu $a0,$a0,-8
/* 2e08: 27a5002c */ addiu $a1,$sp,0x2c
/* 2e0c: 0c011ffc */ jal 0x47ff0
/* 2e10: 24060001 */ li $a2,0x1
/* 2e14: 240e0001 */ li $t6,0x1
/* 2e18: 3c018006 */ lui $at,0x8006
/* 2e1c: 0c002413 */ jal 0x904c
/* 2e20: a02ecb80 */ sb $t6,-0x3480($at)
/* 2e24: 3c048009 */ lui $a0,0x8009
/* 2e28: 0c011f1c */ jal 0x47c70
/* 2e2c: 2484dc20 */ addiu $a0,$a0,-9184
/* 2e30: 00002025 */ move $a0,$zero
/* 2e34: 0c011f4c */ jal 0x47d30
/* 2e38: 2405000b */ li $a1,0xb
/* 2e3c: 3c028006 */ lui $v0,0x8006
/* 2e40: 2442f3c0 */ addiu $v0,$v0,-3136
/* 2e44: 24030400 */ li $v1,0x400
/* 2e48: 3c048006 */ lui $a0,0x8006
/* 2e4c: ac43052c */ sw $v1,0x52c($v0)
/* 2e50: ac430540 */ sw $v1,0x540($v0)
/* 2e54: 0c012194 */ jal 0x48650
/* 2e58: 2484f8c0 */ addiu $a0,$a0,-1856
/* 2e5c: 0c012178 */ jal 0x485e0
/* 2e60: 24040001 */ li $a0,0x1
/* 2e64: 0c012288 */ jal 0x48a20
/* 2e68: 00000000 */ nop
/* 2e6c: 3c018009 */ lui $at,0x8009
/* 2e70: ac220340 */ sw $v0,0x340($at)
/* 2e74: 0c012288 */ jal 0x48a20
/* 2e78: ac230344 */ sw $v1,0x344($at)
/* 2e7c: 3c198009 */ lui $t9,0x8009
/* 2e80: 8f390344 */ lw $t9,0x344($t9)
/* 2e84: 3c188009 */ lui $t8,0x8009
/* 2e88: 3c010022 */ lui $at,0x22
/* 2e8c: 8f180340 */ lw $t8,0x340($t8)
/* 2e90: 3421add7 */ ori $at,$at,0xadd7
/* 2e94: 03214821 */ addu $t1,$t9,$at
/* 2e98: 0121082b */ sltu $at,$t1,$at
/* 2e9c: 03014021 */ addu $t0,$t8,$at
/* 2ea0: 25080000 */ addiu $t0,$t0,0x0
/* 2ea4: 0102082b */ sltu $at,$t0,$v0
/* 2ea8: 14200019 */ bnez $at,.PF00002f10
/* 2eac: 0048082b */ sltu $at,$v0,$t0
/* 2eb0: 14200003 */ bnez $at,.PF00002ec0
/* 2eb4: 0069082b */ sltu $at,$v1,$t1
/* 2eb8: 10200015 */ beqz $at,.PF00002f10
/* 2ebc: 00000000 */ nop
.PF00002ec0:
/* 2ec0: 0c012288 */ jal 0x48a20
/* 2ec4: 00000000 */ nop
/* 2ec8: 3c0b8009 */ lui $t3,0x8009
/* 2ecc: 8d6b0344 */ lw $t3,0x344($t3)
/* 2ed0: 3c0a8009 */ lui $t2,0x8009
/* 2ed4: 3c010022 */ lui $at,0x22
/* 2ed8: 8d4a0340 */ lw $t2,0x340($t2)
/* 2edc: 3421add7 */ ori $at,$at,0xadd7
/* 2ee0: 01616821 */ addu $t5,$t3,$at
/* 2ee4: 01a1082b */ sltu $at,$t5,$at
/* 2ee8: 01416021 */ addu $t4,$t2,$at
/* 2eec: 258c0000 */ addiu $t4,$t4,0x0
/* 2ef0: 004c082b */ sltu $at,$v0,$t4
/* 2ef4: 1420fff2 */ bnez $at,.PF00002ec0
/* 2ef8: 00000000 */ nop
/* 2efc: 0182082b */ sltu $at,$t4,$v0
/* 2f00: 14200003 */ bnez $at,.PF00002f10
/* 2f04: 006d082b */ sltu $at,$v1,$t5
/* 2f08: 1420ffed */ bnez $at,.PF00002ec0
/* 2f0c: 00000000 */ nop
.PF00002f10:
/* 2f10: 0c0053c9 */ jal 0x14f24
/* 2f14: 00000000 */ nop
.PF00002f18:
/* 2f18: 1000ffff */ b .PF00002f18
/* 2f1c: 00000000 */ nop
/* 2f20: 00000000 */ nop
/* 2f24: 00000000 */ nop
/* 2f28: 00000000 */ nop
/* 2f2c: 00000000 */ nop
/* 2f30: 8fbf0014 */ lw $ra,0x14($sp)
/* 2f34: 27bd0030 */ addiu $sp,$sp,0x30
/* 2f38: 03e00008 */ jr $ra
/* 2f3c: 00000000 */ nop
);
#else
GLOBAL_ASM( GLOBAL_ASM(
glabel resetproc glabel resetproc
/* 2e00: 27bdffd0 */ addiu $sp,$sp,-48 /* 2e00: 27bdffd0 */ addiu $sp,$sp,-48
@ -105,6 +197,7 @@ glabel resetproc
/* 2f68: 03e00008 */ jr $ra /* 2f68: 03e00008 */ jr $ra
/* 2f6c: 00000000 */ nop /* 2f6c: 00000000 */ nop
); );
#endif
void resetThreadCreate(void) void resetThreadCreate(void)
{ {

View File

@ -1,6 +1,6 @@
#include <ultra64.h> #include <ultra64.h>
#include "boot/init.h" #include "lib/init.h"
#include "boot/sched.h" #include "lib/sched.h"
#include "constants.h" #include "constants.h"
#include "game/game_0e0770.h" #include "game/game_0e0770.h"
#include "gvars/gvars.h" #include "gvars/gvars.h"

View File

@ -19,7 +19,6 @@ class Extractor:
self.extract_accessingpak() self.extract_accessingpak()
self.extract_animations() self.extract_animations()
self.extract_audio() self.extract_audio()
self.extract_boot()
self.extract_bootloader() self.extract_bootloader()
self.extract_copyright() self.extract_copyright()
self.extract_data() self.extract_data()
@ -89,9 +88,6 @@ class Extractor:
offset = int.from_bytes(sequences[pos:pos+4], 'big') offset = int.from_bytes(sequences[pos:pos+4], 'big')
return self.decompress(sequences[offset:]) return self.decompress(sequences[offset:])
def extract_boot(self):
self.write_extracted('segments/boot.bin', self.rom[0x1000:0x3050])
def extract_copyright(self): def extract_copyright(self):
addr = self.val('copyright') addr = self.val('copyright')
data = self.decompress(self.rom[addr:addr+0xb30]) data = self.decompress(self.rom[addr:addr+0xb30])
@ -201,8 +197,11 @@ class Extractor:
end = self.val('animations') end = self.val('animations')
self.write_asset('garbage/%s/garbage2.bin' % self.romid, self.rom[start:end]) self.write_asset('garbage/%s/garbage2.bin' % self.romid, self.rom[start:end])
# In all versions, lib starts at 0x1000 and is compressed from 0x3050 onwards
def extract_lib(self): def extract_lib(self):
self.write_extracted('segments/lib.bin', self.decompress(self.rom[0x3050:])) part1 = self.rom[0x1000:0x3050]
part2 = self.decompress(self.rom[0x3050:])
self.write_extracted('segments/lib.bin', part1 + part2)
def extract_mpconfigs(self): def extract_mpconfigs(self):
addr = self.val('mpconfigs') addr = self.val('mpconfigs')

View File

@ -68,9 +68,10 @@ def get_segment(fd, locations, segname):
fd.seek(start) fd.seek(start)
return fd.read(end - start) return fd.read(end - start)
# lib is compressed from offset 0x2050 onwards
def pack_lib(fd, locations): def pack_lib(fd, locations):
lib = get_segment(fd, locations, 'lib') lib = get_segment(fd, locations, 'lib')
zipped = zip(lib) zipped = lib[0:0x2050] + zip(lib[0x2050:])
attempt(fd, locations, 'lib', zipped, 'ROMALLOCATION_LIB') attempt(fd, locations, 'lib', zipped, 'ROMALLOCATION_LIB')
def pack_data(fd, locations): def pack_data(fd, locations):
@ -105,7 +106,7 @@ def write_garbage_part(fd, addr, filename):
fd.seek(addr) fd.seek(addr)
fd.write(binary) fd.write(binary)
def write_garbage(fd, locations): def write_garbage(fd):
if os.environ['ROMID'] == 'ntsc-final': if os.environ['ROMID'] == 'ntsc-final':
write_garbage_part(fd, 0x2ea6c, 'garbage1.bin') write_garbage_part(fd, 0x2ea6c, 'garbage1.bin')
write_garbage_part(fd, 0x157800, 'garbage2.bin') write_garbage_part(fd, 0x157800, 'garbage2.bin')
@ -132,7 +133,7 @@ def main():
fd = open(sys.argv[1], 'rb+') fd = open(sys.argv[1], 'rb+')
write_garbage(fd, locations) write_garbage(fd)
pack_lib(fd, locations) pack_lib(fd, locations)
pack_data(fd, locations) pack_data(fd, locations)