Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,6 @@ Select an object from the left sidebar to begin diffing. Changes to the project

## References
- [Decomp Toolkit](https://github.com/encounter/dtk-template) (repo template)
- [Latest commit used in this Decomp](https://github.com/encounter/dtk-template/commit/54bf50ee31ef7242c74f398529279c62394c68c6#diff-4d5f3192809ec1b9add6b33007e0c50031ad9a0a2f3f55a481b506468824db2cR148)
- [Dolphin 2001 SDK](https://github.com/doldecomp/dolsdk2001)
- Alice uses Revolution SDK of a currently unknown version or release, however, dolsdk can be used as a basis
36 changes: 0 additions & 36 deletions config/SALP4Q/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,6 @@ Sections:
Revolution/OS/__start.c:
.init start:0x80004000 end:0x80006618

Alice/Objects/Groups/CKGrpAliceHero.cpp:
.text start:0x8000DBF0 end:0x8000E264

Alice/Objects/Hooks/CKHkAliceHero.cpp:
.text start:0x8001D894 end:0x8001E9E8

Alice/Objects/Components/CKAliceHeroConfig.cpp:
.text start:0x800539D4 end:0x80055528

Alice/Objects/Logic/CKAliceGameSpawnPoint.cpp:
.text start:0x800EEFBC end:0x800EF814

Alice/Objects/Geometries/CSkinGeometry.cpp:
.text start:0x801DB1A8 end:0x801DB6D8

Alice/Objects/Graphics/CLightManager.cpp:
.text start:0x801E3D88 end:0x801E76B4

Alice/Objects/Nodes/CSpawnNode.cpp:
.text start:0x80211C1C end:0x80212060

Alice/Objects/Services/CKSrvTrigger.cpp:
.text start:0x8022CE90 end:0x8022D744

Alice/Objects/Camera/CKCameraFixTrack.cpp:
.text start:0x80238574 end:0x802388B4

Alice/Objects/Cinematics/CKStartDoor.cpp:
.text start:0x80266000 end:0x802662AC

Alice/Objects/Dictionaries/CKSoundDictionary.cpp:
.text start:0x802B9360 end:0x802B9A70

Alice/Objects/Managers/CKSoundManager.cpp:
.text start:0x802BA0DC end:0x802BAEA0

PowerPC_EABI_Support/Runtime/global_destructor_chain.c:
.text start:0x80368C58 end:0x80394124

Expand Down
25 changes: 8 additions & 17 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@
# Tool versions
config.binutils_tag = "2.42-1"
config.compilers_tag = "20240706"
config.dtk_tag = "v1.1.2"
config.objdiff_tag = "v2.3.2"
config.sjiswrap_tag = "v1.1.1"
config.dtk_tag = "v1.3.0"
config.objdiff_tag = "v2.4.0"
config.sjiswrap_tag = "v1.2.0"
config.wibo_tag = "0.6.11"


Expand All @@ -174,6 +174,10 @@
# Use for any additional files that should cause a re-configure when modified
config.reconfig_deps = []

# Optional numeric ID for decomp.me preset
# Can be overridden in libraries or objects
config.scratch_preset_id = None

# Base flags, common to most GC/Wii games.
# Generally leave untouched, with overrides added below.
cflags_base = [
Expand Down Expand Up @@ -287,20 +291,7 @@ def MatchingFor(*versions):
"cflags": cflags_base,
"host": False,
"progress_category": "game", # str | List[str]
"objects": [
Object(MatchingFor(), "Alice/Objects/Managers/CKSoundManager.cpp"),
Object(MatchingFor(), "Alice/Objects/Services/CKSrvTrigger.cpp"),
Object(MatchingFor(), "Alice/Objects/Hooks/CKHkAliceHero.cpp"),
Object(MatchingFor(), "Alice/Objects/Groups/CKGrpAliceHero.cpp"),
Object(MatchingFor(), "Alice/Objects/Components/CKAliceHeroConfig.cpp"),
Object(MatchingFor(), "Alice/Objects/Camera/CKCameraFixTrack.cpp"),
Object(MatchingFor(), "Alice/Objects/Cinematics/CKStartDoor.cpp"),
Object(MatchingFor(), "Alice/Objects/Dictionaries/CKSoundDictionary.cpp"),
Object(MatchingFor(), "Alice/Objects/Geometries/CSkinGeometry.cpp"),
Object(MatchingFor(), "Alice/Objects/Nodes/CSpawnNode.cpp"),
Object(MatchingFor(), "Alice/Objects/Logic/CKAliceGameSpawnPoint.cpp"),
Object(MatchingFor(), "Alice/Objects/Graphics/CLightManager.cpp")
],
"objects": []
}
]

Expand Down
44 changes: 29 additions & 15 deletions tools/decompctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,58 +18,63 @@
script_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.abspath(os.path.join(script_dir, ".."))
src_dir = os.path.join(root_dir, "src")
include_dirs = [
os.path.join(root_dir, "include"),
# Add additional include directories here
]
include_dirs: List[str] = [] # Set with -I flag

include_pattern = re.compile(r'^#\s*include\s*[<"](.+?)[>"]')
guard_pattern = re.compile(r"^#\s*ifndef\s+(.*)$")
once_pattern = re.compile(r"^#\s*pragma\s+once$")

defines = set()
deps = []


def import_h_file(in_file: str, r_path: str, deps: List[str]) -> str:
def import_h_file(in_file: str, r_path: str) -> str:
rel_path = os.path.join(root_dir, r_path, in_file)
if os.path.exists(rel_path):
return import_c_file(rel_path, deps)
return import_c_file(rel_path)
for include_dir in include_dirs:
inc_path = os.path.join(include_dir, in_file)
if os.path.exists(inc_path):
return import_c_file(inc_path, deps)
return import_c_file(inc_path)
else:
print("Failed to locate", in_file)
return ""


def import_c_file(in_file: str, deps: List[str]) -> str:
def import_c_file(in_file: str) -> str:
in_file = os.path.relpath(in_file, root_dir)
deps.append(in_file)
out_text = ""

try:
with open(in_file, encoding="utf-8") as file:
out_text += process_file(in_file, list(file), deps)
out_text += process_file(in_file, list(file))
except Exception:
with open(in_file) as file:
out_text += process_file(in_file, list(file), deps)
out_text += process_file(in_file, list(file))
return out_text


def process_file(in_file: str, lines: List[str], deps: List[str]) -> str:
def process_file(in_file: str, lines: List[str]) -> str:
out_text = ""
for idx, line in enumerate(lines):
guard_match = guard_pattern.match(line.strip())
if idx == 0:
guard_match = guard_pattern.match(line.strip())
if guard_match:
if guard_match[1] in defines:
break
defines.add(guard_match[1])
else:
once_match = once_pattern.match(line.strip())
if once_match:
if in_file in defines:
break
defines.add(in_file)
print("Processing file", in_file)
include_match = include_pattern.match(line.strip())
if include_match and not include_match[1].endswith(".s"):
out_text += f'/* "{in_file}" line {idx} "{include_match[1]}" */\n'
out_text += import_h_file(include_match[1], os.path.dirname(in_file), deps)
out_text += import_h_file(include_match[1], os.path.dirname(in_file))
out_text += f'/* end "{include_match[1]}" */\n'
else:
out_text += line
Expand Down Expand Up @@ -100,10 +105,19 @@ def main():
"--depfile",
help="""Dependency file""",
)
parser.add_argument(
"-I",
"--include",
help="""Include directory""",
action="append",
)
args = parser.parse_args()

deps = []
output = import_c_file(args.c_file, deps)
if args.include is None:
exit("No include directories specified")
global include_dirs
include_dirs = args.include
output = import_c_file(args.c_file)

with open(os.path.join(root_dir, args.output), "w", encoding="utf-8") as f:
f.write(output)
Expand Down
23 changes: 9 additions & 14 deletions tools/ninja_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,10 @@
import os
from io import StringIO
from pathlib import Path
from typing import Dict, List, Match, Optional, Tuple, Union
from typing import Dict, Iterable, List, Match, Optional, Tuple, Union

NinjaPath = Union[str, Path]
NinjaPaths = Union[
List[str],
List[Path],
List[NinjaPath],
List[Optional[str]],
List[Optional[Path]],
List[Optional[NinjaPath]],
]
NinjaPaths = Iterable[Optional[NinjaPath]]
NinjaPathOrPaths = Union[NinjaPath, NinjaPaths]


Expand Down Expand Up @@ -118,8 +111,8 @@ def build(
pool: Optional[str] = None,
dyndep: Optional[NinjaPath] = None,
) -> List[str]:
outputs = serialize_paths(outputs)
out_outputs = [escape_path(x) for x in outputs]
str_outputs = serialize_paths(outputs)
out_outputs = [escape_path(x) for x in str_outputs]
all_inputs = [escape_path(x) for x in serialize_paths(inputs)]

if implicit:
Expand Down Expand Up @@ -154,7 +147,7 @@ def build(
for key, val in iterator:
self.variable(key, val, indent=1)

return outputs
return str_outputs

def include(self, path: str) -> None:
self._line("include %s" % path)
Expand Down Expand Up @@ -225,9 +218,11 @@ def serialize_path(input: Optional[NinjaPath]) -> str:


def serialize_paths(input: Optional[NinjaPathOrPaths]) -> List[str]:
if isinstance(input, list):
if isinstance(input, str) or isinstance(input, Path):
return [serialize_path(input)] if input else []
elif input is not None:
return [serialize_path(path) for path in input if path]
return [serialize_path(input)] if input else []
return []


def escape(string: str) -> str:
Expand Down
Loading
Loading