Add scratch_preset_id option for objdiff decomp.me integration

This commit is contained in:
Luke Street 2024-11-07 09:30:54 -07:00
parent 14c60bb5a5
commit 065fc7b715
2 changed files with 8 additions and 0 deletions

View File

@ -172,6 +172,10 @@ if args.map:
# Use for any additional files that should cause a re-configure when modified # Use for any additional files that should cause a re-configure when modified
config.reconfig_deps = [] 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. # Base flags, common to most GC/Wii games.
# Generally leave untouched, with overrides added below. # Generally leave untouched, with overrides added below.
cflags_base = [ cflags_base = [

View File

@ -48,6 +48,7 @@ class Object:
"lib": None, "lib": None,
"mw_version": None, "mw_version": None,
"progress_category": None, "progress_category": None,
"scratch_preset_id": None,
"shift_jis": None, "shift_jis": None,
"source": name, "source": name,
"src_dir": None, "src_dir": None,
@ -79,6 +80,7 @@ class Object:
set_default("asm_dir", config.asm_dir) set_default("asm_dir", config.asm_dir)
set_default("host", False) set_default("host", False)
set_default("mw_version", config.linker_version) set_default("mw_version", config.linker_version)
set_default("scratch_preset_id", config.scratch_preset_id)
set_default("shift_jis", config.shift_jis) set_default("shift_jis", config.shift_jis)
set_default("src_dir", config.src_dir) set_default("src_dir", config.src_dir)
@ -174,6 +176,7 @@ class ProjectConfig:
True # Generate compile_commands.json for clangd True # Generate compile_commands.json for clangd
) )
self.extra_clang_flags: List[str] = [] # Extra flags for clangd self.extra_clang_flags: List[str] = [] # Extra flags for clangd
self.scratch_preset_id: Optional[int] = None # Default decomp.me preset ID for scratches
# Progress output, progress.json and report.json config # Progress output, progress.json and report.json config
self.progress = True # Enable report.json generation and CLI progress output self.progress = True # Enable report.json generation and CLI progress output
@ -1384,6 +1387,7 @@ def generate_objdiff_config(
"platform": "gc_wii", "platform": "gc_wii",
"compiler": compiler_version, "compiler": compiler_version,
"c_flags": cflags_str, "c_flags": cflags_str,
"preset_id": obj.options["scratch_preset_id"],
} }
if src_exists: if src_exists:
unit_config["scratch"].update( unit_config["scratch"].update(