mirror of https://github.com/zeldaret/mm.git
Add README.md. Minor makefile cleanup.
This commit is contained in:
parent
bdf36b85d3
commit
45d820041c
|
@ -15,4 +15,6 @@ __pychahe__/*
|
||||||
test.txt
|
test.txt
|
||||||
*.xlsx
|
*.xlsx
|
||||||
src/test.c
|
src/test.c
|
||||||
*.dump
|
*.dump
|
||||||
|
tools/ido5.3_compiler/*
|
||||||
|
tools/ido7.1_compiler/*
|
27
Makefile
27
Makefile
|
@ -1,15 +1,10 @@
|
||||||
# TODO think about how to split this up
|
# TODO think about how to split this up
|
||||||
|
|
||||||
MIPS_BINUTILS := mips-linux-gnu-
|
|
||||||
|
|
||||||
AS := $(MIPS_BINUTILS)as
|
AS := $(MIPS_BINUTILS)as
|
||||||
LD := $(MIPS_BINUTILS)ld
|
LD := $(MIPS_BINUTILS)ld
|
||||||
|
|
||||||
#QEMU_IRIX := ~/irixemu/mips-linux-user/qemu-mips
|
IRIX_71_ROOT := ./tools/ido7.1_compiler/
|
||||||
QEMU_IRIX := ~/qemu-irix
|
IRIX_53_ROOT := ./tools/ido5.3_compiler/
|
||||||
IRIX_71_ROOT := ./ido/71/
|
|
||||||
IRIX_62_ROOT := ./ido/62/
|
|
||||||
IRIX_53_ROOT := ./ido/53_patched/
|
|
||||||
|
|
||||||
CFLAGS := -G 0 -non_shared -Xfullwarn -Xcpluscomm
|
CFLAGS := -G 0 -non_shared -Xfullwarn -Xcpluscomm
|
||||||
ASFLAGS := -march=vr4300 -32
|
ASFLAGS := -march=vr4300 -32
|
||||||
|
@ -32,9 +27,9 @@ test.txt: CFLAGS := $(CFLAGS) -Wab,-r4300_mul
|
||||||
|
|
||||||
CC := $(QEMU_IRIX) -L $(IRIX_71_ROOT) $(IRIX_71_ROOT)/usr/bin/cc
|
CC := $(QEMU_IRIX) -L $(IRIX_71_ROOT) $(IRIX_71_ROOT)/usr/bin/cc
|
||||||
|
|
||||||
test.txt: CC := python3 ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
test.txt: CC := ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||||
build/src/boot_O2_g3/%: CC := python3 ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
build/src/boot_O2_g3/%: CC := ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||||
build/src/code/%: CC := python3 ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
build/src/code/%: CC := ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||||
|
|
||||||
BASEROM_FILES := $(wildcard baserom/*)
|
BASEROM_FILES := $(wildcard baserom/*)
|
||||||
# Exclude dmadata, it will be generated right before packing the rom
|
# Exclude dmadata, it will be generated right before packing the rom
|
||||||
|
@ -84,7 +79,7 @@ check: $(ROM)
|
||||||
@md5sum -c checksum.md5
|
@md5sum -c checksum.md5
|
||||||
|
|
||||||
$(ROM): $(ROM_FILES)
|
$(ROM): $(ROM_FILES)
|
||||||
@python3 ./tools/makerom.py ./tables/dmadata_table.py $@
|
@./tools/makerom.py ./tables/dmadata_table.py $@
|
||||||
|
|
||||||
build/boot_pre_dmadata.bin: build/code_pre_dmadata.elf
|
build/boot_pre_dmadata.bin: build/code_pre_dmadata.elf
|
||||||
$(MIPS_BINUTILS)objcopy --dump-section boot=$@ $<
|
$(MIPS_BINUTILS)objcopy --dump-section boot=$@ $<
|
||||||
|
@ -116,7 +111,7 @@ linker_scripts/dmadata_script.txt: $(DECOMP_PRE_DMADATA_FILES) $(BASEROM_PRE_DMA
|
||||||
mv build/decomp build/decomp_temp
|
mv build/decomp build/decomp_temp
|
||||||
mv build/baserom_pre_dmadata build/baserom
|
mv build/baserom_pre_dmadata build/baserom
|
||||||
mv build/decomp_pre_dmadata build/decomp
|
mv build/decomp_pre_dmadata build/decomp
|
||||||
python3 ./tools/dmadata.py ./tables/dmadata_table.py /dev/null -u -l linker_scripts/dmadata_script.txt
|
./tools/dmadata.py ./tables/dmadata_table.py /dev/null -u -l linker_scripts/dmadata_script.txt
|
||||||
mv build/baserom build/baserom_pre_dmadata
|
mv build/baserom build/baserom_pre_dmadata
|
||||||
mv build/decomp build/decomp_pre_dmadata
|
mv build/decomp build/decomp_pre_dmadata
|
||||||
mv build/baserom_temp build/baserom
|
mv build/baserom_temp build/baserom
|
||||||
|
@ -129,7 +124,7 @@ clean:
|
||||||
rm $(ROM) -r build
|
rm $(ROM) -r build
|
||||||
|
|
||||||
build/baserom/dmadata: $(COMP_FILES) $(DECOMP_FILES) $(BASEROM_BUILD_FILES)
|
build/baserom/dmadata: $(COMP_FILES) $(DECOMP_FILES) $(BASEROM_BUILD_FILES)
|
||||||
python3 ./tools/dmadata.py ./tables/dmadata_table.py $@
|
./tools/dmadata.py ./tables/dmadata_table.py $@
|
||||||
|
|
||||||
build/baserom/boot: build/boot.bin
|
build/baserom/boot: build/boot.bin
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
@ -151,9 +146,9 @@ build/decomp_pre_dmadata/ovl_title: build/ovl_title_pre_dmadata.bin
|
||||||
|
|
||||||
|
|
||||||
disasm:
|
disasm:
|
||||||
@python3 ./tools/disasm.py -d ./asm -e ./include -u . -l ./tables/files.py -f ./tables/functions.py -o ./tables/objects.py -v ./tables/variables.py -v ./tables/vrom_variables.py -v ./tables/object_addr_variables.py -v ./tables/pre_boot_variables.py
|
@./tools/disasm.py -d ./asm -e ./include -u . -l ./tables/files.py -f ./tables/functions.py -o ./tables/objects.py -v ./tables/variables.py -v ./tables/vrom_variables.py -v ./tables/object_addr_variables.py -v ./tables/pre_boot_variables.py
|
||||||
@while read -r file; do \
|
@while read -r file; do \
|
||||||
python3 ./tools/split_asm.py ./asm/$$file.asm ./asm/nonmatching/$$file; \
|
./tools/split_asm.py ./asm/$$file.asm ./asm/nonmatching/$$file; \
|
||||||
done < ./tables/files_with_nonmatching.txt
|
done < ./tables/files_with_nonmatching.txt
|
||||||
|
|
||||||
# Recipes
|
# Recipes
|
||||||
|
@ -177,5 +172,5 @@ build/decomp_pre_dmadata/%: decomp/%
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
build/comp/%.yaz0: build/decomp/%
|
build/comp/%.yaz0: build/decomp/%
|
||||||
python3 ./tools/yaz0.py $< $@
|
./tools/yaz0.py $< $@
|
||||||
|
|
||||||
|
|
6
README
6
README
|
@ -1,6 +0,0 @@
|
||||||
WIP Majora's Mask decomp, proper docs and README will be made later.
|
|
||||||
|
|
||||||
Basic steps (assuming you already have IDO and irixqemu):
|
|
||||||
Run extract_rom.py with a USA Majora's Mask ROM named baserom.z64 (will need to get libyaz0 first, I'll set up the dependency file eventually)
|
|
||||||
Run disasm.py
|
|
||||||
Run Make (edit the makefile with the paths to ido, etc. I'll make it use evironment variables eventually)
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
# Legend of Zelda: Majora's Mask (U) 1.0
|
||||||
|
|
||||||
|
This is a disassembly of Legend of Zelda: Majora's Mask (U) 1.0
|
||||||
|
|
||||||
|
It builds the following ROM:
|
||||||
|
* rom.z64 `md5: 2a0a8acb61538235bc1094d297fb6556`
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
## Step 1:
|
||||||
|
|
||||||
|
If you're running Windows 10, [install WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10). If you're running an older version of Windows, install a Linux VM. If you're already running a Linux OS, you're good to go.
|
||||||
|
|
||||||
|
## Step 2:
|
||||||
|
|
||||||
|
Using sudo apt-get, install the following packages:
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
git
|
||||||
|
binutils-mips-linux-gnu
|
||||||
|
python3
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 2:
|
||||||
|
Download build_tools.zip from the Releases section and extract it to the tools folder.
|
||||||
|
|
||||||
|
## Step 3:
|
||||||
|
|
||||||
|
Open up your .bashrc file (~/.bashrc), scroll to the bottom, and add the following, replacing `/path/to/qemu-mips` with the location the qemu-mips you extracted from the build tools:
|
||||||
|
|
||||||
|
```
|
||||||
|
export QEMU_IRIX="/path/to/qemu-mips"
|
||||||
|
export MIPS_BINUTILS_PREFIX=mips-linux-gnu-
|
||||||
|
```
|
||||||
|
|
||||||
|
Save and close/reopen your terminal window.
|
||||||
|
|
||||||
|
## Step 4:
|
||||||
|
Make a fork of the main repository https://github.com/Rozelette/Majora-Unmasked.git and clone your fork.
|
||||||
|
|
||||||
|
## Step 5:
|
||||||
|
|
||||||
|
Navigate to the Majora-Unmasked folder you just cloned. Type the following commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
git submodule update --init --recursive
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 6:
|
||||||
|
|
||||||
|
You will need to acquire a copy of the ROM. The md5 of this ROM should be `2a0a8acb61538235bc1094d297fb6556`.
|
||||||
|
|
||||||
|
Once this has been done, type, replacing `<ROM>` with the name of your ROM:
|
||||||
|
```
|
||||||
|
./tools/extract_baserom.py <ROM>
|
||||||
|
```
|
||||||
|
|
||||||
|
This will extract all the individual files in the ROM into a newly created baserom folder, as well as decompress the compressed files in a newly created decomp folder.
|
||||||
|
|
||||||
|
Next, type:
|
||||||
|
```
|
||||||
|
make disasm
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create the build folders as well as a newly created asm folder containing the disassemblies of nearly all the files containing code.
|
||||||
|
|
||||||
|
## Step 7:
|
||||||
|
|
||||||
|
Type the following:
|
||||||
|
```
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
If all goes well, a ROM rom.z64 should be built and the following text should be printed:
|
||||||
|
|
||||||
|
`rom.z64: OK `
|
||||||
|
|
||||||
|
If you instead see the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
rom.z64: FAILED
|
||||||
|
md5sum: WARNING: 1 computed checksum did NOT match
|
||||||
|
```
|
||||||
|
|
||||||
|
This means that something is wrong with the ROM's contents. Either the baserom files are incorrect due to a bad ROM, or some piece of code is not matching.
|
|
@ -1 +1 @@
|
||||||
libyaz0
|
libyaz0==0.5
|
||||||
|
|
|
@ -1605,7 +1605,7 @@
|
||||||
0x800EFBFC:("func_800EFBFC","void","GlobalContext* ctxt, s16 index"),
|
0x800EFBFC:("func_800EFBFC","void","GlobalContext* ctxt, s16 index"),
|
||||||
0x800EFD44:("func_800EFD44","void","GlobalContext* ctxt, s16 index"),
|
0x800EFD44:("func_800EFD44","void","GlobalContext* ctxt, s16 index"),
|
||||||
0x800EFE60:("EffFootmark_Init","void","GlobalContext* ctxt"),
|
0x800EFE60:("EffFootmark_Init","void","GlobalContext* ctxt"),
|
||||||
0x800EFF04:("EffFootmark_Add","void","GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor, char id, Vector3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay"),
|
0x800EFF04:("EffFootmark_Add","void","GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor, u8 id, Vector3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay"),
|
||||||
0x800F00BC:("EffFootmark_Update","void","GlobalContext* ctxt"),
|
0x800F00BC:("EffFootmark_Update","void","GlobalContext* ctxt"),
|
||||||
0x800F01C8:("EffFootmark_Draw","void","GlobalContext* ctxt"),
|
0x800F01C8:("EffFootmark_Draw","void","GlobalContext* ctxt"),
|
||||||
0x800F0390:("func_800F0390","void","GlobalContext* ctxt"),
|
0x800F0390:("func_800F0390","void","GlobalContext* ctxt"),
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import argparse, os, struct, ast
|
import argparse, os, struct, ast
|
||||||
|
|
||||||
SPLIT_FILES = True # TODO this should be a flag somewhere
|
SPLIT_FILES = True # TODO this should be a flag somewhere
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import os, struct, sys, ast, argparse
|
import os, struct, sys, ast, argparse
|
||||||
|
|
||||||
def align_up(base, align_to):
|
def align_up(base, align_to):
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import struct, os, sys, argparse
|
import struct, os, sys, argparse
|
||||||
|
|
||||||
from libyaz0 import decompress
|
from libyaz0 import decompress
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import struct;
|
import struct;
|
||||||
from tkinter import *;
|
from tkinter import *;
|
||||||
from tkinter.ttk import *
|
from tkinter.ttk import *
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import os, struct, sys, ast, argparse
|
import os, struct, sys, ast, argparse
|
||||||
|
|
||||||
def read_uint32_be(data, offset):
|
def read_uint32_be(data, offset):
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
# TODO generalize
|
# TODO generalize
|
||||||
|
|
||||||
data = [
|
data = [
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
'''
|
'''
|
||||||
Resources:
|
Resources:
|
||||||
http://www.cs.unibo.it/~solmi/teaching/arch_2002-2003/AssemblyLanguageProgDoc.pdf
|
http://www.cs.unibo.it/~solmi/teaching/arch_2002-2003/AssemblyLanguageProgDoc.pdf
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import argparse, os
|
import argparse, os
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import os, sys, argparse
|
import os, sys, argparse
|
||||||
|
|
||||||
def read_file(name):
|
def read_file(name):
|
||||||
|
|
Loading…
Reference in New Issue