mirror of https://github.com/zeldaret/mm.git
Extract Incbins (#1776)
* extract incbins infastructure * rspboot incbin * rsptext incbin * rspdata incbin * aspMainStack incbin * ipl3 incbin
This commit is contained in:
parent
982ca889e2
commit
c767f49455
1
Makefile
1
Makefile
|
@ -492,6 +492,7 @@ setup:
|
||||||
$(MAKE) -C tools
|
$(MAKE) -C tools
|
||||||
$(PYTHON) tools/decompress_baserom.py -v $(VERSION)
|
$(PYTHON) tools/decompress_baserom.py -v $(VERSION)
|
||||||
$(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 $(EXTRACTED_DIR)/baserom -v $(VERSION)
|
$(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 $(EXTRACTED_DIR)/baserom -v $(VERSION)
|
||||||
|
$(PYTHON) tools/extract_incbins.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/incbin -v $(VERSION)
|
||||||
$(PYTHON) tools/extract_yars.py $(EXTRACTED_DIR)/baserom -v $(VERSION)
|
$(PYTHON) tools/extract_yars.py $(EXTRACTED_DIR)/baserom -v $(VERSION)
|
||||||
|
|
||||||
assets:
|
assets:
|
||||||
|
|
|
@ -15,4 +15,48 @@ archives:
|
||||||
- icon_item_24_static_yar
|
- icon_item_24_static_yar
|
||||||
- schedule_dma_static_yar
|
- schedule_dma_static_yar
|
||||||
incbins:
|
incbins:
|
||||||
|
- name: ipl3
|
||||||
|
segment: makerom
|
||||||
|
vram: 0x8007F040
|
||||||
|
size: 0xFC0
|
||||||
|
- name: rspbootText
|
||||||
|
segment: boot
|
||||||
|
vram: 0x800969C0
|
||||||
|
size: 0x160
|
||||||
|
- name: aspMainText
|
||||||
|
segment: code
|
||||||
|
vram: 0x801AAAB0
|
||||||
|
size: 0x1000
|
||||||
|
- name: gspS2DEX2_fifoText
|
||||||
|
segment: code
|
||||||
|
vram: 0x801ABAB0
|
||||||
|
size: 0x18C0
|
||||||
|
- name: njpgdspMainText
|
||||||
|
segment: code
|
||||||
|
vram: 0x801AD370
|
||||||
|
size: 0xAF0
|
||||||
|
- name: aspMainData
|
||||||
|
segment: code
|
||||||
|
vram: 0x801E1E80
|
||||||
|
size: 0x2E0
|
||||||
|
- name: gspF3DZEX2_NoN_PosLight_fifoText
|
||||||
|
segment: code
|
||||||
|
vram: 0x801E2160
|
||||||
|
size: 0x1630
|
||||||
|
- name: gspF3DZEX2_NoN_PosLight_fifoData
|
||||||
|
segment: code
|
||||||
|
vram: 0x801E3790
|
||||||
|
size: 0x420
|
||||||
|
- name: gspS2DEX2_fifoData
|
||||||
|
segment: code
|
||||||
|
vram: 0x801E3BB0
|
||||||
|
size: 0x390
|
||||||
|
- name: njpgdspMainData
|
||||||
|
segment: code
|
||||||
|
vram: 0x801E3F40
|
||||||
|
size: 0x60
|
||||||
|
- name: aspMainStack
|
||||||
|
segment: code
|
||||||
|
vram: 0x801D6200
|
||||||
|
size: 0x400
|
||||||
assets:
|
assets:
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# Evaluate this file only once in case it's included more than once
|
||||||
|
.ifndef _MACRO_INC_GUARD
|
||||||
|
.internal _MACRO_INC_GUARD
|
||||||
|
.set _MACRO_INC_GUARD, 1
|
||||||
|
|
||||||
.macro glabel label
|
.macro glabel label
|
||||||
.global \label
|
.global \label
|
||||||
.ent \label
|
.ent \label
|
||||||
|
@ -90,3 +95,5 @@
|
||||||
.set $fs4f, $f29
|
.set $fs4f, $f29
|
||||||
.set $fs5, $f30
|
.set $fs5, $f30
|
||||||
.set $fs5f, $f31
|
.set $fs5f, $f31
|
||||||
|
|
||||||
|
.endif
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
// Ucode symbols
|
|
||||||
|
|
||||||
rspbootTextEnd = rspbootTextStart + 0x160;
|
|
||||||
aspMainTextEnd = aspMainTextStart + 0x1000;
|
|
||||||
aspMainDataEnd = aspMainDataStart + 0x2E0;
|
|
||||||
|
|
||||||
// Segmented Addresses
|
// Segmented Addresses
|
||||||
|
|
||||||
// segment 0x01
|
// segment 0x01
|
||||||
|
|
13
spec
13
spec
|
@ -21,7 +21,7 @@ beginseg
|
||||||
name "boot"
|
name "boot"
|
||||||
address 0x80080060
|
address 0x80080060
|
||||||
include "$(BUILD_DIR)/src/boot/boot_main.o"
|
include "$(BUILD_DIR)/src/boot/boot_main.o"
|
||||||
include "$(BUILD_DIR)/data/boot/rspboot.data.o"
|
include "$(BUILD_DIR)/src/boot/rspboot.o"
|
||||||
include "$(BUILD_DIR)/src/boot/idle.o"
|
include "$(BUILD_DIR)/src/boot/idle.o"
|
||||||
include "$(BUILD_DIR)/src/boot/viconfig.o"
|
include "$(BUILD_DIR)/src/boot/viconfig.o"
|
||||||
include "$(BUILD_DIR)/src/boot/carthandle.o"
|
include "$(BUILD_DIR)/src/boot/carthandle.o"
|
||||||
|
@ -606,9 +606,7 @@ beginseg
|
||||||
name "code"
|
name "code"
|
||||||
compress
|
compress
|
||||||
after "dmadata"
|
after "dmadata"
|
||||||
include "$(BUILD_DIR)/data/code/aspMain.data.o"
|
include "$(BUILD_DIR)/src/code/rsptext.o"
|
||||||
include "$(BUILD_DIR)/data/code/gspS2DEX2.fifo.data.o"
|
|
||||||
include "$(BUILD_DIR)/data/code/njpgdspMain.data.o"
|
|
||||||
include "$(BUILD_DIR)/src/code/z_en_a_keep.o"
|
include "$(BUILD_DIR)/src/code/z_en_a_keep.o"
|
||||||
include "$(BUILD_DIR)/src/code/z_en_item00.o"
|
include "$(BUILD_DIR)/src/code/z_en_item00.o"
|
||||||
include "$(BUILD_DIR)/src/code/z_eff_blure.o"
|
include "$(BUILD_DIR)/src/code/z_eff_blure.o"
|
||||||
|
@ -758,7 +756,7 @@ beginseg
|
||||||
include "$(BUILD_DIR)/src/audio/lib/playback.o"
|
include "$(BUILD_DIR)/src/audio/lib/playback.o"
|
||||||
include "$(BUILD_DIR)/src/audio/lib/effects.o"
|
include "$(BUILD_DIR)/src/audio/lib/effects.o"
|
||||||
include "$(BUILD_DIR)/src/audio/lib/seqplayer.o"
|
include "$(BUILD_DIR)/src/audio/lib/seqplayer.o"
|
||||||
include "$(BUILD_DIR)/data/code/audio_dramStack.data.o"
|
include "$(BUILD_DIR)/src/audio/lib/stack.o"
|
||||||
include "$(BUILD_DIR)/asm/code/code_8019AE40.text.o" // handwritten
|
include "$(BUILD_DIR)/asm/code/code_8019AE40.text.o" // handwritten
|
||||||
pad_text
|
pad_text
|
||||||
include "$(BUILD_DIR)/asm/code/code_8019AEC0.text.o" // handwritten
|
include "$(BUILD_DIR)/asm/code/code_8019AEC0.text.o" // handwritten
|
||||||
|
@ -779,10 +777,7 @@ beginseg
|
||||||
include "$(BUILD_DIR)/assets/audio/sequence_font_table.o"
|
include "$(BUILD_DIR)/assets/audio/sequence_font_table.o"
|
||||||
include "$(BUILD_DIR)/src/audio/tables/sequence_table.o"
|
include "$(BUILD_DIR)/src/audio/tables/sequence_table.o"
|
||||||
include "$(BUILD_DIR)/src/audio/tables/samplebank_table.o"
|
include "$(BUILD_DIR)/src/audio/tables/samplebank_table.o"
|
||||||
include "$(BUILD_DIR)/data/code/aspMain.rodata.o"
|
include "$(BUILD_DIR)/src/code/rspdata.o"
|
||||||
include "$(BUILD_DIR)/data/code/gspF3DZEX2.NoN.PosLight.fifo.rodata.o"
|
|
||||||
include "$(BUILD_DIR)/data/code/gspS2DEX2.fifo.rodata.o"
|
|
||||||
include "$(BUILD_DIR)/data/code/njpgdspMain.rodata.o"
|
|
||||||
endseg
|
endseg
|
||||||
|
|
||||||
// The game expects all the segments after the `code` segment and before the first overlay to be `NOLOAD` ones
|
// The game expects all the segments after the `code` segment and before the first overlay to be `NOLOAD` ones
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
.include "macro.inc"
|
||||||
|
|
||||||
|
.section .data
|
||||||
|
|
||||||
|
dlabel aspMainStack
|
||||||
|
.incbin "incbin/aspMainStack"
|
|
@ -0,0 +1,7 @@
|
||||||
|
.include "macro.inc"
|
||||||
|
|
||||||
|
.section .data
|
||||||
|
|
||||||
|
dlabel rspbootTextStart
|
||||||
|
.incbin "incbin/rspbootText"
|
||||||
|
dlabel rspbootTextEnd
|
|
@ -0,0 +1,23 @@
|
||||||
|
.include "macro.inc"
|
||||||
|
|
||||||
|
.section .rodata
|
||||||
|
|
||||||
|
dlabel aspMainDataStart
|
||||||
|
.incbin "incbin/aspMainData"
|
||||||
|
dlabel aspMainDataEnd
|
||||||
|
|
||||||
|
dlabel gspF3DZEX2_NoN_PosLight_fifoTextStart
|
||||||
|
.incbin "incbin/gspF3DZEX2_NoN_PosLight_fifoText"
|
||||||
|
dlabel gspF3DZEX2_NoN_PosLight_fifoTextEnd
|
||||||
|
|
||||||
|
dlabel gspF3DZEX2_NoN_PosLight_fifoDataStart
|
||||||
|
.incbin "incbin/gspF3DZEX2_NoN_PosLight_fifoData"
|
||||||
|
dlabel gspF3DZEX2_NoN_PosLight_fifoDataEnd
|
||||||
|
|
||||||
|
dlabel gspS2DEX2_fifoDataStart
|
||||||
|
.incbin "incbin/gspS2DEX2_fifoData"
|
||||||
|
dlabel gspS2DEX2_fifoDataEnd
|
||||||
|
|
||||||
|
dlabel njpgdspMainDataStart
|
||||||
|
.incbin "incbin/njpgdspMainData"
|
||||||
|
dlabel njpgdspMainDataEnd
|
|
@ -0,0 +1,15 @@
|
||||||
|
.include "macro.inc"
|
||||||
|
|
||||||
|
.section .data
|
||||||
|
|
||||||
|
dlabel aspMainTextStart
|
||||||
|
.incbin "incbin/aspMainText"
|
||||||
|
dlabel aspMainTextEnd
|
||||||
|
|
||||||
|
dlabel gspS2DEX2_fifoTextStart
|
||||||
|
.incbin "incbin/gspS2DEX2_fifoText"
|
||||||
|
dlabel gspS2DEX2_fifoTextEnd
|
||||||
|
|
||||||
|
dlabel njpgdspMainTextStart
|
||||||
|
.incbin "incbin/njpgdspMainText"
|
||||||
|
dlabel njpgdspMainTextEnd
|
|
@ -1,2 +1,3 @@
|
||||||
.text
|
.section .text
|
||||||
.incbin "extracted/n64-us/baserom/makerom", 0x40, 0xFC0
|
|
||||||
|
.incbin "incbin/ipl3"
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# SPDX-FileCopyrightText: © 2024 ZeldaRET
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from version import version_config
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Extract incbin pieces from an uncompressed ROM."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"baserom_segments_dir",
|
||||||
|
type=Path,
|
||||||
|
help="Directory of uncompressed ROM segments",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"output_dir",
|
||||||
|
type=Path,
|
||||||
|
help="Output directory for incbin pieces",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-v",
|
||||||
|
"--version",
|
||||||
|
required=True,
|
||||||
|
help="MM version",
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
config = version_config.load_version_config(args.version)
|
||||||
|
|
||||||
|
args.output_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
for incbin in config.incbins:
|
||||||
|
incbin_path = args.output_dir / incbin.name
|
||||||
|
with open(args.baserom_segments_dir / incbin.segment, "rb") as f:
|
||||||
|
offset = incbin.vram - config.dmadata_segments[incbin.segment].vram
|
||||||
|
f.seek(offset)
|
||||||
|
incbin_data = f.read(incbin.size)
|
||||||
|
incbin_path.write_bytes(incbin_data)
|
||||||
|
|
||||||
|
print(f"Extracted {len(config.incbins)} incbin pieces to {args.output_dir}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in New Issue