mirror of
https://github.com/sp00nznet/xboxrecomp.git
synced 2026-12-06 02:22:30 +00:00
Fix the getting-started pipeline: every documented step was broken
Both open issues (#1, #2) are people bouncing off the same wall. All four documented steps failed on a stock Windows console; reproduced each one. - tools/xbe_parser was the only tool package without __init__.py/__main__.py, so `py -3 -m tools.xbe_parser` could never run (issue #2, verbatim). - disasm auto-detect hardcoded `burnout3_analysis.json` in two copies. Now globs `*_analysis.json` from one helper, so per-game names work (issue #1). - GETTING_STARTED step 2 never passed --json, so the file step 3 requires was never produced. - A U+2192 arrow in recomp's argparse description and in xbe_parser's --extract-sections output crashed cp1252 consoles, i.e. `recomp --help` was a traceback on default Windows terminals. Also adds the MIT LICENSE file. README has claimed MIT since the initial release but no license text existed, which legally left the repo all-rights-reserved and blocked contribution. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 sp00nz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -58,9 +58,13 @@ game_files/
|
||||
## Step 2: Parse the XBE
|
||||
|
||||
```bash
|
||||
py -3 -m tools.xbe_parser game_files/default.xbe
|
||||
py -3 -m tools.xbe_parser game_files/default.xbe --json game_files/mygame_analysis.json
|
||||
```
|
||||
|
||||
The `--json` file is **required by Step 3** — the disassembler reads the section
|
||||
layout from it. Name it `<anything>_analysis.json` and keep it next to the XBE;
|
||||
Step 3 finds it automatically.
|
||||
|
||||
This outputs:
|
||||
- **Entry point** — where execution starts (e.g., `0x001D2807`)
|
||||
- **Section layout** — VA, size, and raw offset for .text, .rdata, .data, and XDK lib sections
|
||||
|
||||
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
from typing import List, Optional
|
||||
|
||||
from . import config
|
||||
from .loader import load_image, BinaryImage, SectionInfo
|
||||
from .loader import load_image, BinaryImage, SectionInfo, _find_analysis_json
|
||||
from .engine import DisasmEngine
|
||||
from .functions import FunctionDetector
|
||||
from .xrefs import build_xrefs, XRefTracker
|
||||
@@ -245,14 +245,8 @@ class Disassembler:
|
||||
if self.analysis_json:
|
||||
return self.analysis_json
|
||||
|
||||
candidates = [
|
||||
Path(self.xbe_path).parent / "burnout3_analysis.json",
|
||||
Path("tools/xbe_parser/burnout3_analysis.json"),
|
||||
]
|
||||
for p in candidates:
|
||||
if p.exists():
|
||||
return str(p)
|
||||
return None
|
||||
found = _find_analysis_json(Path(self.xbe_path))
|
||||
return str(found) if found else None
|
||||
|
||||
def _load_and_print_cached_stats(self) -> None:
|
||||
"""Load and print stats from cached summary.json."""
|
||||
|
||||
+12
-7
@@ -129,17 +129,22 @@ def _parse_hex(s: str) -> int:
|
||||
|
||||
|
||||
def _find_analysis_json(xbe_path: Path) -> Optional[Path]:
|
||||
"""Auto-detect the analysis JSON file location."""
|
||||
candidates = [
|
||||
"""Auto-detect the analysis JSON file location.
|
||||
|
||||
Matches any ``*_analysis.json`` written by ``tools.xbe_parser --json``,
|
||||
so the name is per-game rather than hardcoded to one title.
|
||||
"""
|
||||
search_dirs = [
|
||||
# Same directory as XBE
|
||||
xbe_path.parent / "burnout3_analysis.json",
|
||||
xbe_path.parent,
|
||||
# In the xbe_parser tool directory
|
||||
Path("tools/xbe_parser/burnout3_analysis.json"),
|
||||
Path("tools/xbe_parser"),
|
||||
# Relative to repo root
|
||||
xbe_path.parent.parent / "tools" / "xbe_parser" / "burnout3_analysis.json",
|
||||
xbe_path.parent.parent / "tools" / "xbe_parser",
|
||||
]
|
||||
for p in candidates:
|
||||
if p.exists():
|
||||
for d in search_dirs:
|
||||
# sorted() so the pick is deterministic when a dir holds several
|
||||
for p in sorted(d.glob("*_analysis.json")):
|
||||
return p
|
||||
return None
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ def list_categories(translator):
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Burnout 3: x86 → C Static Recompiler")
|
||||
description="Xbox x86 -> C Static Recompiler")
|
||||
parser.add_argument("xbe_path", help="Path to default.xbe")
|
||||
parser.add_argument("-o", "--output-dir",
|
||||
help="Output directory")
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
"""XBE header/section parser for Xbox executables."""
|
||||
@@ -0,0 +1,12 @@
|
||||
"""
|
||||
CLI entry point for the XBE parser.
|
||||
|
||||
Usage:
|
||||
py -3 -m tools.xbe_parser game_files/default.xbe
|
||||
py -3 -m tools.xbe_parser game_files/default.xbe --json output/analysis.json
|
||||
py -3 -m tools.xbe_parser game_files/default.xbe --extract-sections output/sections/
|
||||
"""
|
||||
|
||||
from .xbe_parser import main
|
||||
|
||||
main()
|
||||
@@ -1100,7 +1100,7 @@ def main():
|
||||
print(f"\nExtracting sections to: {args.extract_sections}")
|
||||
for sec in xbe.sections:
|
||||
filepath = xbe_parser.extract_section(sec, args.extract_sections)
|
||||
print(f" {sec.name:<12} → {filepath} ({sec.raw_size} bytes)")
|
||||
print(f" {sec.name:<12} -> {filepath} ({sec.raw_size} bytes)")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user