mirror of
https://github.com/zeldaret/tp
synced 2026-07-07 06:04:58 -04:00
Z2AudioLib misc decomp (#75)
* Z2SoundHandles: decomp portions
* start decomping: Z2SpeechMgr2, Z2SoundHandles
* Z2SoundHandles::stopAllSounds(): ok
* Z2SoundHandles::getHandleUserData(): ok
* Z2SoundInfo: header
* Z2SoundObjBase::framework(): ok
* Z2SoundObjBase::Z2SoundObjBase(), Z2SoundObjBase::init(): ok
* Z2SoundObjBase::~Z2SoundObjBase(): ok
* Z2SoundObjBase::stopOK(): ok
* Z2SoundObjBase::stopOK, incomplete Z2SoundObjBase::dispose()
* clang-format
* Z2SoundObjBase::dispose(): ok
* JAISound::operator->(): null assert
* JAIAudience: stub
* Z2SoundObject::{init, deleteObject, isAlive}: ok
* Z2SeMgr: elaborate struct (and decl JAISoundHandles to support this)
* start subclassing Z2SoundObjBase; nonmatching Z2SoundObjSimple::init()
* Z2SeMGr::{incrCrowdSize, decrCrowdSize}: ok
* Z2MultiSeMgr::resetMultiSePos(): ok
* Z2WolfHowlMgr.h: decls
* Z2SoundStarter: move to decls and fix postprocess.py symbol pass
* Z2AudioArcLoader: decls
* Z2SoundObjMgr: ok some fns
- deleteEnemyAll()
- isTwilightBattle()
- setGhostEnemyState()
additionally elaborates parts of the Z2Creature hierarchy
* delete unused .s files and add tool to find them (only runs on linux)
* run clang-format
* postprocess.py: comment out debugging
* add python step to ok-check workflow
* address review comments
* address review comments
Co-authored-by: notyourav <65437533+notyourav@users.noreply.github.com>
Co-authored-by: Pheenoh <pheenoh@gmail.com>
Co-authored-by: notyourav <65437533+notyourav@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
Use as `python tools/find_unused_asm.py | xargs rm`
|
||||
"""
|
||||
|
||||
import inotify.adapters
|
||||
from inotify.constants import IN_OPEN
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
from sys import stderr
|
||||
|
||||
asm_files = set(Path('include/').glob('**/*.s'))
|
||||
|
||||
stderr.write('==> clean\n')
|
||||
subprocess.run(['make', 'clean'], stdout=subprocess.DEVNULL)
|
||||
|
||||
stderr.write('==> set up watches\n')
|
||||
ino = inotify.adapters.Inotify()
|
||||
for p in asm_files:
|
||||
ino.add_watch(str(p), mask=IN_OPEN)
|
||||
|
||||
stderr.write('==> run make\n')
|
||||
subprocess.run(['make', '-j'], stdout=subprocess.DEVNULL)
|
||||
|
||||
opened_paths = set()
|
||||
for evt in ino.event_gen(timeout_s=1):
|
||||
if evt:
|
||||
(header, type_names, path, filename) = evt
|
||||
opened_paths.add(Path(path))
|
||||
|
||||
unused_asm = asm_files - opened_paths
|
||||
for p in unused_asm:
|
||||
print(str(p))
|
||||
@@ -34,12 +34,12 @@ import struct
|
||||
|
||||
# Substitutions
|
||||
substitutions = (
|
||||
('<', '?0'),
|
||||
('>', '?1'),
|
||||
('@', '?2'),
|
||||
('\\', '?3'),
|
||||
(',', '?4'),
|
||||
('-', '?5')
|
||||
('<', '_SUB_0'),
|
||||
('>', '_SUB_1'),
|
||||
('@', '_SUB_2'),
|
||||
('\\', '_SUB_3'),
|
||||
(',', '_SUB_4'),
|
||||
('-', '_SUB_5')
|
||||
)
|
||||
|
||||
def format(symbol):
|
||||
@@ -117,7 +117,7 @@ def impl_postprocess_elf(f, do_ctor_realign, do_old_stack, do_symbol_fixup):
|
||||
f.seek(0x30)
|
||||
nSecHeader = read_u16(f)
|
||||
idxSegNameSeg = read_u16(f)
|
||||
secF = False # First instance the section names
|
||||
secF = True # First instance the section names
|
||||
|
||||
# Header: 0x32:
|
||||
patch_align_ofs = []
|
||||
@@ -132,8 +132,9 @@ def impl_postprocess_elf(f, do_ctor_realign, do_old_stack, do_symbol_fixup):
|
||||
|
||||
if sh_type == SHT_STRTAB and do_symbol_fixup:
|
||||
if not secF:
|
||||
secF = True
|
||||
continue
|
||||
secF = False
|
||||
|
||||
f.seek(ofsSecHeader + i * 0x28 + 0x10)
|
||||
ofs = read_u32(f)
|
||||
size = read_u32(f)
|
||||
|
||||
Reference in New Issue
Block a user