kh is light

This commit is contained in:
Ethan Roseman 2023-09-13 10:56:59 +09:00
commit eafb5fa733
No known key found for this signature in database
GPG Key ID: 27F9FCEB8E4969BD
5 changed files with 105 additions and 0 deletions

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
asm/
assets/
undefined_syms_auto.txt
undefined_funcs_auto.txt
SLPS_251.05*
*.iso
*.bin
*.o

4
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"python.linting.mypyEnabled": true,
"python.linting.enabled": true
}

44
iso.py Normal file
View File

@ -0,0 +1,44 @@
from io import BytesIO
import sys
from typing import Optional
BLOCK_LENGTH = 0x800
def get_file_offset(data: BytesIO, filename: str) -> Optional[int]:
base_pos = 0x105 * BLOCK_LENGTH
filename_bytes = filename.encode("UTF-8")
data.seek(base_pos)
for i in range(0x500):
something = data.read(1)
if int.from_bytes(something) != 1:
continue
string_length = int.from_bytes(data.read(1))
if string_length != len(filename_bytes):
continue
cur_pos = data.tell()
read_filename = data.read(string_length)
if read_filename == filename_bytes:
data.seek(cur_pos - 0x1B)
pos = int.from_bytes(data.read(4))
return pos
data.seek(cur_pos + 1)
with open("kh_jp.iso", "rb") as f:
iso_bytes = f.read()
file_like = BytesIO(iso_bytes)
pos = get_file_offset(file_like, "KINGDOM.IDX;1")
if not pos:
print("File not found")
sys.exit(1)
print(f"{(pos * 0x800):X}")

32
kh.jp.yaml Normal file
View File

@ -0,0 +1,32 @@
name: Kingdom Hearts (jp)
sha1: 9dabbf867a7ec2a030df99ba1ed969f2deef0488
options:
basename: SLPS_251.05
target_path: SLPS_251.05
base_path: .
compiler: GCC
find_file_boundaries: False
platform: ps2
create_undefined_funcs_auto: True
undefined_funcs_auto_path: undefined_funcs_auto.txt
create_undefined_syms_auto: True
undefined_syms_auto_path: undefined_syms_auto.txt
symbol_addrs_path: symbol_addrs.txt
asm_path: asm
src_path: src
build_path: build
extensions_path: tools/splat_ext
section_order: [".text", ".data", ".rodata", ".bss"]
auto_all_sections: [".data", ".rodata", ".bss"]
segments:
- [0, bin, elf_header]
- name: main
type: code
start: 0x80
vram: 0x100000
subsegments:
- [0x80, asm, blob]
- [0x16F360, data, blob]
- [0x3869D0, rodata, blob]
- [0x38DB80, bin]
- [0x39A680]

14
permuter_settings.toml Normal file
View File

@ -0,0 +1,14 @@
compiler_command = "/home/ethteck/repos/decomp.me/backend/compilers/ps2/ee-gcc2.96/bin/ee-gcc -c -B /home/ethteck/repos/decomp.me/backend/compilers/ps2/ee-gcc2.96/bin/ee- -G0 -O2"
assembler_command = "mips-linux-gnu-as -march=r5900 -mabi=eabi -Iinclude"
compiler_type = "gcc"
[preserve_macros]
"gs?[DS]P.*" = "void"
OVERRIDE_FLAG_CHECK = "int"
OS_K0_TO_PHYSICAL = "int"
"G_.*" = "int"
"TEXEL.*" = "int"
PRIMITIVE = "int"
[decompme.compilers]
"tools/build/cc/gcc/gcc" = "ee-gcc2.96"