1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-28 07:46:18 +00:00

Merge branch 'master' into skelanimeupdates

This commit is contained in:
KrimtonZ 2020-04-01 14:05:17 -05:00
commit 495582cc94
9 changed files with 80 additions and 28 deletions

2
.gitignore vendored
View file

@ -17,6 +17,8 @@ baserom/
*.elf *.elf
*.sra *.sra
*.z64 *.z64
*.n64
*.v64
*.map *.map
*.dump *.dump
out.txt out.txt

6
Jenkinsfile vendored
View file

@ -5,13 +5,11 @@ pipeline {
stage('Setup') { stage('Setup') {
steps { steps {
echo 'Setting up...' echo 'Setting up...'
sh 'cp /usr/local/etc/roms/baserom_oot.z64 baserom.z64' sh 'cp /usr/local/etc/roms/baserom_oot.z64 baserom_original.z64'
sh 'git submodule update --init --recursive' sh 'git submodule update --init --recursive'
sh 'make -C tools'
sh 'cp -r /usr/local/etc/ido/ido7.1_compiler tools/ido7.1_compiler' sh 'cp -r /usr/local/etc/ido/ido7.1_compiler tools/ido7.1_compiler'
sh 'chmod +x -R tools/ido*' sh 'chmod +x -R tools/ido*'
sh 'python3 extract_baserom.py' sh 'make setup'
sh 'python3 extract_assets.py'
} }
} }
stage('Build') { stage('Build') {

View file

@ -14,8 +14,6 @@ This repo does not include all assets necessary for compiling the ROM. A prior c
This is a disassembly and decompilation of Legend of Zelda: Ocarina of Time Master Quest (debug) This is a disassembly and decompilation of Legend of Zelda: Ocarina of Time Master Quest (debug)
It builds the following ROM: It builds the following ROM:
* zelda_ocarina_mq_dbg.z64 `md5: 717179476af84133b14ff73af87db57a` * zelda_ocarina_mq_dbg.z64 `md5: f0b7f35375f9cc8ca1b2d59d78e35405`
Please refer to the Getting Started guide in the Wiki for setup instructions. Please refer to the Getting Started guide in the Wiki for setup instructions.
Thanks to z64me and CrookedPoe for their actor documentation. https://github.com/CrookedPoe/z64-rw

1
THANKS.md Normal file
View file

@ -0,0 +1 @@
Thanks to z64me and CrookedPoe for their actor documentation. https://github.com/CrookedPoe/z64-rw

View file

@ -1 +1 @@
717179476af84133b14ff73af87db57a zelda_ocarina_mq_dbg.z64 f0b7f35375f9cc8ca1b2d59d78e35405 zelda_ocarina_mq_dbg.z64

63
fixbaserom.py Normal file
View file

@ -0,0 +1,63 @@
import os.path
from os import path
import sys
import struct
import hashlib
# Determine if we have a ROM file
romFileName = ""
if (path.exists("baserom_original.z64")):
romFileName = "baserom_original.z64"
elif (path.exists("baserom_original.n64")):
romFileName = "baserom_original.n64"
# Read in the original ROM
if (romFileName != ""):
print("File '" + romFileName + "' found.")
with open(romFileName, mode='rb') as file:
fileContent = bytearray(file.read())
# Check if ROM needs to be byte swapped
if (fileContent[0] == 0x40):
# Byte Swap ROM
# TODO: This is pretty slow at the moment. Look into optimizing it later...
print("ROM needs to be byte swapped...")
i = 0
while (i < len(fileContent)):
tmp = struct.unpack_from("BBBB", fileContent, i)
struct.pack_into("BBBB", fileContent, i + 0, tmp[3], tmp[2], tmp[1], tmp[0])
i += 4
perc = float(i) / float(len(fileContent))
if (i % (1024 * 1024 * 4) == 0):
print(str(perc * 100) + "%")
print("Byte swapping done.")
else:
print("Error: Could not find baserom_original.z64/baserom_original.n64.")
sys.exit(1)
# Strip the overdump
print("Stripping overdump...")
strippedContent = list(fileContent[0:0x3600000])
# Patch the header
print("Patching header...")
strippedContent[0x3E] = 0x50
# Check to see if the ROM is a "vanilla" Debug ROM
md5Hash = hashlib.md5(bytearray(strippedContent)).hexdigest()
if (str(md5Hash) != "f0b7f35375f9cc8ca1b2d59d78e35405"):
print("Error: Expected a hash of f0b7f35375f9cc8ca1b2d59d78e35405 but got " + str(md5Hash) + ". The baserom is probably not \"vanilla\"")
sys.exit(1)
# Write out our new ROM
print("Writing new ROM 'baserom.z64'.")
with open("baserom.z64", mode="wb") as file:
file.write(bytes(strippedContent))
print("Done!")

View file

@ -129,6 +129,11 @@ build/undefined_syms.txt: undefined_syms.txt
clean: clean:
$(RM) $(ROM) $(ELF) -r build $(RM) $(ROM) $(ELF) -r build
setup:
make -C tools
python3 fixbaserom.py
python3 extract_baserom.py
python3 extract_assets.py
#### Various Recipes #### #### Various Recipes ####

View file

@ -58,20 +58,12 @@ void BgSpot15Saku_Destroy(BgSpot15Saku* this, GlobalContext* globalCtx) {
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
} }
#ifdef NON_MATCHING
// regalloc differences
void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) { void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) {
void* temp = this->unk_168; if (this->unk_168 && !(gSaveContext.inf_table[7] & 2)) {
void* temp2 = this->unk_16C;
if ((temp != NULL || temp2 != NULL) && !(gSaveContext.inf_table[7] & 2)) {
this->unk_17C = 2; this->unk_17C = 2;
this->actionFunc = func_808B4978; this->actionFunc = func_808B4978;
} }
} }
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot15_Saku/func_808B4930.s")
#endif
void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) { void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor; Actor* thisx = &this->dyna.actor;
@ -86,18 +78,12 @@ void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) {
} }
} }
#ifdef NON_MATCHING
// single regalloc difference
void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) { void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) {
if (this->unk_17C == 0) { if (!this->unk_17C) {
this->unk_168 = 0 & 0xFFFFFFFFFFFFFFFF; this->unk_168 = 0;
this->unk_16C = 0 & 0xFFFFFFFFFFFFFFFF;
this->actionFunc = func_808B4930; this->actionFunc = func_808B4930;
} }
} }
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot15_Saku/func_808B4A04.s")
#endif
void BgSpot15Saku_Update(BgSpot15Saku* this, GlobalContext* globalCtx) { void BgSpot15Saku_Update(BgSpot15Saku* this, GlobalContext* globalCtx) {
DECR(this->unk_17C); DECR(this->unk_17C);

View file

@ -7,8 +7,7 @@
typedef struct { typedef struct {
/* 0x0000 */ DynaPolyActor dyna; /* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ ActorFunc actionFunc; /* 0x0164 */ ActorFunc actionFunc;
/* 0x0168 */ UNK_PTR unk_168; /* 0x0168 */ u64 unk_168;
/* 0x016C */ UNK_PTR unk_16C;
/* 0x0170 */ f32 unk_170; /* 0x0170 */ f32 unk_170;
/* 0x0174 */ f32 unk_174; /* 0x0174 */ f32 unk_174;
/* 0x0174 */ f32 unk_178; /* 0x0174 */ f32 unk_178;