mirror of
https://github.com/HayatoG/tlg_pc.git
synced 2026-11-07 10:46:09 -10:00
Both fixes are confirmed by inFAMOUS players on Windows (iss_pc origin/main 6b668a0). ISA rewrite first: tlg_pc had none, and the red-zone protection is a section of its G3ISA1 table and loader. It comes as gr2_pc 5c5d84d brought it from iss_pc (upstream gow3_pc PR #129 via iss_pc f79c7a3, 4e4daad, c2c14a0; SSE4A iss_pc 3727fde): - src/cpu_check.c, src/isa_emulate.c, src/isa_rewrite.c, scripts/isa_rewrite.py and their tests (isa_fixture.bin, test_isa_sse4a/emulate/stub.c, test_cpu_check.c, test_isa_rewrite.py, test_run_isa.py, the --cpu-features probe test); - probe.c: --cpu-features, --isa-rewrite with the SHA-256 image check, int3 sites from SIGTRAP and EXCEPTION_BREAKPOINT, site report at exit and on window close; GR2's GR2_ alias left out; - tlg_run.py and run.py build out/isa-rewrite.bin when the CPU lacks a set or TLG_ISA_REWRITE forces it (1, or a list such as movbe,bmi1; 0 never); the CPU check gets out/lib (gr2_pc fe1b03d) and an unanswered check builds the table anyway; - build.sh / gpu/CMakeLists.txt: isa_emulate with -mgeneral-regs-only, ISA tests in --test and as Windows targets; the Linux and Windows packages bundle iced-x86==1.21.0. The TLG 1.03 image has 1941 sites (MOVBE 37, BMI1 1791, LZCNT 113, no SSE4A): only CPUs before Haswell need the emulation. Red-zone protection (iss_pc a5120b1, PR #45; 00b1d37, PR #46): PS4 code keeps data in the 128 bytes below rsp and Windows writes its exception frame there on every GPU page-tracking fault. scripts/red_zone.py (isa_rewrite.py --red-zone) finds the functions from .eh_frame_hdr, runs a red-zone liveness pass and moves every faultable memory instruction that runs while the red zone is live into a stub: lea rsp,[rsp-128]; insn; lea rsp,[rsp+128]; jmp back. isa_rewrite.c applies the G3RZONE1 section after the emulation rewrite. TLG_RED_ZONE_REWRITE=0 off, =1 on for Linux, on by default on Windows (probe.c, tlg_run.py, run.py). Linux test switch TLG_CLOBBER_RED_ZONE=<bytes>. File I/O (iss_pc f0151cb #24, 7964b9b and dee27df #43, cd4c6be #48): runtime_file.c, compat_win.c/.h. TLG had iss's pre-#24 files plus the #25 freeze marks, so the result is iss's: own file positions, host bounce buffers for reads and writes, more Win32 errors retried, the first 32 failed reads, writes, opens, renames and path operations logged. Docs: port/docs/red_zone.md (with TLG's results), README (pt-BR/en), UPSTREAM.md. .gitignore: red-zone fixtures excepted; /game, /dump and port/user also as symlinks. TLG 1.03: 2690 instructions protected in 2521 patches (9 short-jump relays), 114 red-zone functions of 26081 (10 conservative), nothing left unprotected. Linux, from the save: TLG_CLOBBER_RED_ZONE=2048 alone, 90 s, no fault (TLG is not hit in this scene); protection + clobber=2048, 150 s, no fault, 28 Frame stats; clean 29. FPS: two back-to-back pairs, protection only 41.2 / 43.9, clean 43.2 / 41.2: drift, no cost. build.sh --test passes except sema-test, which fails on main the same way; unittest test_red_zone test_isa_rewrite test_run_isa test_probe: 69 OK. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KHxhRF717FsAPVntc7R6zU
36 lines
791 B
Plaintext
36 lines
791 B
Plaintext
# Arquivos do jogo (copyright da Sony/genDESIGN): NUNCA versionar
|
|
/dump
|
|
*.psarc
|
|
*.bin
|
|
*.prx
|
|
*.sprx
|
|
*.sfo
|
|
*.plt
|
|
# Exception: synthetic 448-byte x86 image for the ISA rewrite tests (upstream gow3_pc), no game code
|
|
!port/tests/data/isa_fixture.bin
|
|
# Exception: synthetic red-zone test image and table (tests/test_red_zone.py --write), no game code
|
|
!port/tests/data/red_zone_image.bin
|
|
!port/tests/data/red_zone_table.bin
|
|
|
|
# Ferramentas de terceiros (Ghidra, JDK, GhidraOrbis): instaladas localmente
|
|
/tools/
|
|
|
|
# Saída bruta de descompilação (código derivado do jogo) e caches do REA/Ghidra
|
|
analysis/raw/
|
|
analysis/*.c
|
|
*.rea-snapshot
|
|
*.gpr
|
|
*.rep/
|
|
|
|
# Outros
|
|
__pycache__/
|
|
*.pyc
|
|
.DS_Store
|
|
|
|
# Saídas de build do port e dados locais do jogo preparados
|
|
port/out/
|
|
port/pgo/
|
|
port/user
|
|
/game
|
|
port/dist/
|