diff --git a/.gitignore b/.gitignore index 4c64350e..436fddcd 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,9 @@ assets/ *.app *.elf +# Linker scripts +*.ld + # Miscellaneous .vscode temp/ diff --git a/README.md b/README.md index e1c52ad5..0b004c94 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,17 @@ Documentation of the code can be found at [theonlyzac.github.io/sly1](https://th New contributors are welcome and encouraged to make a pull request! If you would like to help but aren't sure where to start, check out [CONTRIBUTING.md](/docs/CONTRIBUTING.md) and feel free to [join our Discord server][discord-url] for guidance. +## Setup + +First you need to clone the repository. After cloning, install the required python packages with pip. + +```bash +git clone https://github.com/TheOnlyZac/sly1 +cd sly1 +pip install -U -r requirements.txt +``` + +After setting up the repository and installing the required packages, you will need to extract the ELF file from a legally obtained copy of the game. With the disc mounted, copy the `SCUS_971.98` file from the root directory of the disc to the `disc` directory of the project. ## Building @@ -49,7 +60,6 @@ The `scripts` directory contains scripts for setting up the build environment on **Prerequisites**: `git`, `make`, `wine-stable`, `p7zip-full` ```bash -git clone https://github.com/TheOnlyZac/sly1 cd sly1/scripts ./setup-progd-linux.sh cd .. @@ -61,7 +71,6 @@ make **Prerequisites**: `git`, `make`, `7zip` ```powershell -git clone https://github.com/TheOnlyZac/sly1 cd sly1\scripts .\setup-progd-windows.bat cd .. diff --git a/config/sly1.yaml b/config/sly1.yaml new file mode 100644 index 00000000..1202accb --- /dev/null +++ b/config/sly1.yaml @@ -0,0 +1,57 @@ +name: Sly Cooper and the Thievius Raccoonus (USA) +sha1: 57dc305db57932ad3f1122966cdb695d2e62a47a + +options: + basename: sly1 + target_path: disc/SCUS_971.98 + elf_path: SCUS_971.98 + base_path: ../ + platform: ps2 + compiler: GCC + + asm_path: asm + src_path: src + build_path: build + + find_file_boundaries: False + disasm_unknown: True + named_regs_for_c_funcs: False + + create_undefined_funcs_auto: True + undefined_funcs_auto_path: config/undefined_funcs_auto.txt + + create_undefined_syms_auto: True + undefined_syms_auto_path: config/undefined_syms_auto.txt + + symbol_addrs_path: config/symbol_addrs.txt + + extensions_path: tools/splat_ext + + section_order: [".text", ".rodata", ".data", ".bss"] + + auto_all_sections: [".rodata", ".data", ".bss"] + +subalign: 0x4 + +segments: + - [0, databin, elf_header] + + - name: main + type: code + start: 0x001000 + vram: 0x100000 + bss_size: 0x3B1304 + subsegments: + - [0x001000, asm, sce/crt0] # starts with 2 nops + - [0x001178, asm] + - [0x0491A0, c, P2/coin] + - [0x049400, asm] + + - [0x112E10, bin, vutext] + + - [0x118380, rodata] + + - [0x151580, data] + + - [0x17C200, databin] + - [0x1A20D0] diff --git a/config/symbol_addrs.txt b/config/symbol_addrs.txt new file mode 100644 index 00000000..80683c6d --- /dev/null +++ b/config/symbol_addrs.txt @@ -0,0 +1,2 @@ +OnCoinSmack = 0x001481A0; // type:func +SetCoinDprizes = 0x00148298; // type:func \ No newline at end of file diff --git a/disc/.gitkeep b/disc/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/include/common.h b/include/common.h new file mode 100644 index 00000000..a6838970 --- /dev/null +++ b/include/common.h @@ -0,0 +1,6 @@ +#ifndef COMMON_H +#define COMMON_H + +#include "include_asm.h" + +#endif /* COMMON_H */ \ No newline at end of file diff --git a/include/include_asm.h b/include/include_asm.h new file mode 100644 index 00000000..7085c84f --- /dev/null +++ b/include/include_asm.h @@ -0,0 +1,23 @@ +#ifndef INCLUDE_ASM_H +#define INCLUDE_ASM_H + +#if !defined(SPLAT) && !defined(__CTX__) && !defined(PERMUTER) +#ifndef INCLUDE_ASM +#define INCLUDE_ASM_INTERNAL(TYPE, BASE_FOLDER, FOLDER, NAME, ARGS...) \ + __asm__( \ + ".section .text\n" \ + "\t.align\t3\n" \ + "\t.globl\t" #NAME "\n" \ + "\t.ent\t" #NAME "\n" #NAME ":\n" \ + "\t.include \"asm/" BASE_FOLDER "/" FOLDER "/" #NAME ".s\"\n" \ + "\t.set reorder\n" \ + "\t.set at\n" \ + "\t.end\t" #NAME); +#define INCLUDE_ASM(TYPE, FOLDER, NAME, ARGS...) INCLUDE_ASM_INTERNAL(TYPE, "nonmatchings", FOLDER, NAME, ARGS) +#endif +__asm__(".include \"include/macro.inc\"\n"); +#else +#define INCLUDE_ASM(TYPE, FOLDER, NAME, ARGS...) +#endif + +#endif /* INCLUDE_ASM_H */ \ No newline at end of file diff --git a/include/macro.inc b/include/macro.inc new file mode 100644 index 00000000..f4259d38 --- /dev/null +++ b/include/macro.inc @@ -0,0 +1,10 @@ +.macro glabel label + .global \label + .type \label, @function + \label: +.endm + +.macro dlabel label + .global \label + \label: +.endm \ No newline at end of file diff --git a/splat.yml b/splat.yml deleted file mode 100644 index 3cf7ccac..00000000 --- a/splat.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Sly Cooper and the Thievius Raccoonus (USA) -sha1: 57dc305db57932ad3f1122966cdb695d2e62a47a - -options: - basename: sly1 - target_path: SCUS_971.98 - elf_path: SCUS_971.98 - base_path: . - platform: ps2 - compiler: GCC - - asm_path: asm - src_path: src - build_path: build - - find_file_boundaries: False - disasm_unknown: True - named_regs_for_c_funcs: False - - 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 - - extensions_path: tools/splat_ext - - section_order: - - .text - - .vutext - - .rodata - #- .vudata - #- .reginfo - - .data - - .gcc_except_table - - .sbss - - .bss - #- .vubss - #- .stack - #- .shstrtab - - auto_all_sections: - - .data - - .rodata - - .bss - -subalign: 0x4 - - -segments: - - [0, databin, elf_header] - - - name: .text - type: code - start: 0x001000 - vram: 0x100000 - bss_size: 0x3b1304 - subsegments: - - [0x001000, asm, sce/crt0] # starts with 2 nops - - [0x001178, asm, xunk1] - - [0x0863f0, asm, P2/lookat] - - [0x086758, asm, P2/main] - - - { name: .vutext, type: data, start: 0x112e10, vram: 0x112e10 } - - #- [0x211e0b] -i diff --git a/tools/splat b/tools/splat deleted file mode 160000 index 46729c53..00000000 --- a/tools/splat +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 46729c53201730a7c3fd93fdaabb11e26db88995