Commit Graph

41 Commits

Author SHA1 Message Date
Ranieri f49ca4edbc refactor: refactor VU1 (#191)
* feat: implement fix and changes based on dark cloud report
fix: fix GS AFAIL for RGB/alpha/Z, ZMSK
fix: fix VU1 flags mask and pipeline
fix: small VU1 cache fix
feat: __ct__, __sinit_ are not sillent stubs anymore

* feat: fix song JP pulling

* feat: sound update for lotR

* feat: prevent guest execution to be very slow

* fix: small gs size bug

* feat: refactor VU
fix: fix cliping and other issues on gs
fix: fix wrong vu0 register on recompiler

* fix fix ACC scheduler stall
feat: remove unused test
fix: .fix overflow e underflow on FMAC

* feat: small setting  for windows test
2026-08-05 14:50:24 -03:00
Shane Michael Mathews (Personal Account) 61300792a0 fix(recomp): include <cstdint> before elfio in elf_parser.h (#199)
ELFIO, pinned at Release_3.12 via FetchContent, uses uint16_t, uint32_t
and uint64_t in elf_types.hpp without including <cstdint> itself. Newer
libstdc++ releases trimmed the transitive includes that used to supply
those typedefs, so building elf_parser.cpp fails:

  elf_types.hpp:30:20: error: 'uint16_t' does not name a type
     30 | using Elf_Half   = uint16_t;

Include <cstdint> ahead of elfio.hpp so the typedefs are visible when
that header is processed. Header-only change; no behaviour is affected.
2026-08-01 12:48:48 -03:00
gustavoauneth d87bff4256 fix(recomp): incorrect opcode mapping for MMI2 in PMADDH, PHMADH, PMSUBH and PHMSBH instructions (#194) 2026-08-01 00:58:03 -03:00
Ranieri 52edf07657 Feature/agressive recompiler (#146)
* feat: added guestBranchKind enum to categorize branch types
feat: added missingFunctionPolicy enum to define behaviors for missing function scenarios
refactor: added handle guest branches and report missing functions
feat lookupFunction to utilize new dispatch logic and improve error handling for unregistered functions

* fix: fix test conflict

* feat: added debug sound driver logs

* feat: emmiter for return

* feat: added recompiler reporter
feat: added strict diagnostics flag for heavy debug calls

* feat: staticc table insted of hashmap for runtime

* feat: back file to ignore

* feat: explode code across helpers and classes

* feat: update codegen test
feat: better guest nop check

* feat: fix link problem on linux

* feat: fix Segmentation fault

* feat: added recompile replace for DMA and MMIO
feat: added a clean memory helpers
feat: use memory helpers across the project
feat: fix ucrt on msvc

* feat: undo messup merge
2026-07-07 10:14:25 -03:00
Ranieri 5196a6672a Refactor runtime for move speed and better code style (#140)
* feat: added guestBranchKind enum to categorize branch types
feat: added missingFunctionPolicy enum to define behaviors for missing function scenarios
refactor: added handle guest branches and report missing functions
feat lookupFunction to utilize new dispatch logic and improve error handling for unregistered functions

* fix: fix test conflict

* feat: added debug sound driver logs

* feat: emmiter for return

* feat: added recompiler reporter
feat: added strict diagnostics flag for heavy debug calls

* feat: staticc table insted of hashmap for runtime

* feat: back file to ignore

* feat: explode code across helpers and classes

* feat: update codegen test
feat: better guest nop check

* feat: fix link problem on linux

* feat: fix Segmentation fault
2026-07-04 00:43:22 -03:00
Sinan ed8b3ebee1 Reduce recompiler output memory usage, and added multi-threading to recomp process (#128)
* feat(recomp): Reduce recompiler output memory usage

Stream output generation, add low-memory config controls, and avoid
pathological indirect-jump switch expansion in generated C++.

Low-memory mode now avoids retaining per-instruction disassembly strings
while still emitting asm comments during output generation. Output workers
are bounded/configurable, combined output is streamed, and decoded buffers
are released after generation.

Also document the new output memory settings.

* fix(recomp): added tests for unregistered JR/JALR, updated fallback logic to cover JR/JALR, moved Rabbitizer formatting into R5900Decoder
2026-06-06 00:15:14 -03:00
Ranieri 93e221feaa Feature/runtime ecosystem refactor (#107)
* feat: remove memory and pad from stub section

* feat: add support for resume entry targets in CodeGenerator (this allow jumps in address outside function)
feat: refactor entry point discovery one more try to reduce big generated file

* feat: optmizations for release build

* feat: remove unused  file

* feat: added some test cases for code gen

* feat: added log macro and remove win specific code

* feat: refactor runtime folder structure
feat: added reset sound driver RPC state and compatibility layout
feat: rename and added new test
feat: update RPC calls to use defined constants
feat: added more PSMC(16, 32)
feat: change cd read to try find the asset ignoring case sensitive
fix: fix some render problems
feat: add logs on pad
feat: added more RPC handles

* feat: added game override for code veronica

* feat: apply vita patch

* feat: flags to disable build

* feat: fix merges
feat: break a lot of tests

* feat: better throw error on empty cd path
feat: remove recompiler unusde function
feat: apply missing patch

* feat: gamedp is now part of lib
feat: missing file

* feat: small cleanup

* feat: missing vita changes

* feat: fix more merge

* feat: fix tests

* feat: last missing feature

* feat: added missing import

* feat: rename test local functions

* feat: init syscall on ps2 list

* feat: added DMA helpers

* feat: faster builds
feat: more implement for darkcloud

* feat: back missing file

* feat: added missing includes

* feat: remove test

* feat: missing include

* feat: read register funtion

* feat: build  fix

* feat: force  exit on detach thread
2026-04-04 23:09:56 -03:00
Antonio Guastella 493522a769 recompiler: filter auto-generated map symbols to reduce oversized outputs (#95) 2026-03-05 11:14:41 -03:00
roby65 b3be2650b0 Fixed recompiler error when the cpp filename is too long (#88)
* Fix error when filename is too long

* Fix typo

* Added tests
2026-03-01 16:39:42 -03:00
Ranieri 669114f3f6 Feature/runtime review codegen fixes (#87)
* feat: small fixes on code gen

* feat: added code gen test

* feat: rename IOP

* fix: fix special case on JR
feat: added code generator test

* feat: ps2 logs now need special macros

* feat: a lot of regressions test
feat: use test to fix bugs on runtime
fix: fix incorrect instructions on code generator
feat: added missing decode on r5900 decoder
feat: added scissor on rasterizer

* feat: better ghidra plugin analyzer
fix: fix real bug on function finding on elf analyzer

* feat: some logs on GS
feat: added more syscalls stubs
feat: added more ps2 stubs

* feat: added missing stub
2026-02-27 03:44:59 -03:00
Ranieri 8584c0613a Feature/runtime gs recompiler instructions (#73)
* feat: basic gs
feat: basic rasterizer
fix: a lot of fixes to runtime stubs
feat: basic vif intercepter
feat: return "ok" for some stubs
feat: disassembly code as comment
fix: fix code gen instructions set
fix: again jump
feat: remove unused macro
fix: fix some problematic macros
feat: track delayslots on runtime
and many more

* feat: added missing files

* fix: fix instruction test
2026-02-22 02:20:42 -03:00
Antonio Guastella d7701f9ea7 fix: reslice entry functions without container (#70) 2026-02-20 10:07:31 -03:00
Ranieri 4334e74342 fix: fixed entry slicing logic to avoid “same tail repeated” generation (#67) 2026-02-18 23:34:27 -03:00
Ranieri 043bf3bf8d Feature/stub by address (#61)
* feat: split runtime code in small files to be easy to develop

* feat: split stubs in inl files

* feat: function auto link function treat functions with underscore as same as without underscore

* feat: remove underscore prefix from stubs

* feat: thread and flags refactor

* feat: propagate request stop
feat: some elf validation on runtime

* feat: remove Z7 compiler options
feat: added a literal float case error on vu

* fix: fix critical recompiler error on marking pc calls

* feat: better system interrupt
refactor: small refactor on thread system

* feat: stubs implements for resident evil code veronica

* feat: merge fileio

* feat: stub by address

* feat: codegen now auto-routes J/JAL callssites with known relocation symbols to syscalls/stubs
2026-02-18 01:35:20 -03:00
Antonio Guastella 4961710407 Issue 11 vu0 macro (#48)
* Add missing VU0 Special1 macro translations

* Fix VU0 macro decode and field ops

Align Special2 decoding with fhi_flo, implement VCLIPw/VABS, and fix field variants (VADDx/VSUBx/VMULx). Keep C++17 compatibility by replacing unordered_set::contains and remove dead ADDIU return. Update Special2 metadata for VWAITQ.

* vu0: complete macro mappings and add coverage test

* review: clean up vu macro handling

* fix: restore C++20 contains in code generator

* fix: correct VU0 Special2 instruction encoding in decoder test

---------

Co-authored-by: Antonio Guastella <antonioguastella@energine.it>
Co-authored-by: Ranieri <ran-junior@hotmail.com>
2026-02-16 22:20:48 -03:00
Ranieri b7973593ee fix: added missing header include for gcc (#54) 2026-02-14 13:00:36 -03:00
Ranieri 8f747334d6 feat: refactor analyzer to not realy only on debug symbols (#53)
fix: patching NOP things that code gen already know how to handle
feat: added a bug on JAL/J/JAR code gen
feat: enhanced tom file
fix: fix memory layout for ps2 macros
feat: added a lot of not working garbabe to runtime (fix later)
feat: some code organization
feat: added new tests
feat: update readme
2026-02-13 15:02:34 -03:00
Ranieri 5e9139dd22 feat: better decoder (#40)
* feat: use rabbitizer for decode MIPs instructions

* feat: cleanup code generator

* feat: fix test and add a sefe check for generate functions
2026-02-02 13:29:12 -03:00
Ranieri d7306d2095 Feature/better analyzer v1 (#39)
* feat: pin dependencies

* feat: dwarf parse

* fix duplicated functions

* feat: small code cleanup

* feat: crash prevent

* feat: modernize code

* feat: split m_libFunctions from m_knownLibNames

* feat: added ghidra loader

* feat: auto bootstrap name for recompiler
2026-02-02 01:49:51 -03:00
Joshua T. Fisher e770572116 ps2_recomp lib and runner separation, fix runtime default build (#36)
* Separate the exe and lib of ps2_recomp.

* Move macro header to runtime, don't generate it, apply generated diff.
2026-01-31 19:29:18 -03:00
M. Sami Gürpınar c218c64348 Made member methods const (#34)
* refactor: update function name checks to use contains method

* refactor: update code generation to use static_cast

* refactor: made member methods const

* refactor: made range-based loop

* refactor: make one variable constructor explicit

* refactor: remove redundant else

* refactor: turn includes to forward declarations

* refactor: brace placements turned into allman style
2026-01-31 13:14:56 -03:00
Joshua T. Fisher 91678d1977 Merge pull request #29 from playmer/playmer/fix_lookup
Convert CodeGenerator::m_symbols to unordered_map to fix O(n) lookups
2026-01-29 00:20:46 -03:00
Ran-j 2e08d5e87b refactor: refactor runtime and recompile for better workflow and correct generating code and analyze output 2026-01-04 22:21:50 -03:00
Ran-j 2d1f7ec07f feat: added missing v0 instructions
feat: added threads inplementation on ps2 syscalls
feat: patch entrypoint on recompiler
feat: ps2 macros now is part of the runtime
feat: use thread to hold game loop
feat: sanitize functions like point out by chrisking1981
fix: fix old instructions cast
fix: fix missing patch for opcode j
2025-12-27 11:33:24 -03:00
Ran-j 409570c709 feat: added minitest framework
feat: added some unit tests for code gen and decoder
fix: backport some bugfix from chrisking1981 branch
2025-12-26 18:33:52 -03:00
Ran-j 4ea08199b0 feat: now we generate header file for stub functions 2025-11-29 12:26:39 -03:00
Ran-j 342bb19607 feat: added more instructions with revision 2025-05-29 16:20:08 -03:00
Ran-j 70f672cfd8 feat: better decode and code gen (remove some old instruction) 2025-04-24 12:04:56 -03:00
Ran-j eb87f7c0e5 feat: more instruction 2025-04-21 03:21:42 -03:00
Ran-j da1bc9e482 feat: added missing things on decoder 2025-04-18 02:44:45 -03:00
Ran-j cba98b04e2 feat: remove stub from recompiler 2025-04-18 01:39:58 -03:00
Ran-j fa676bd692 feat: added auto function mapper to code gen 2025-04-17 01:54:07 -03:00
Ran-j 23bb92bd4a refactor: added more instructions decoder 2025-04-16 01:45:13 -03:00
Ran-j a4dc5c79ce feat: more instructions 2025-04-15 18:36:01 -03:00
Ran-j 0a6382c386 feat: added more instruction parser 2025-04-15 15:58:34 -03:00
Ran-j a10f7f8415 feat: more instruction 2025-04-15 15:21:54 -03:00
Ran-j b21c7bbb82 feat: added more instructions 2025-04-15 14:42:41 -03:00
Ran-j aceb8b1535 feat: some default stub for now 2025-04-14 02:34:51 -03:00
Ran-j e5cef40032 fix: fix recompile from single file to multi file 2025-04-14 02:02:56 -03:00
Ran-j 8c0af4e224 feat: added header for link functions 2025-04-14 01:41:22 -03:00
Ran-j 6e9049be40 migrate from private cloud 2025-04-12 03:49:35 -03:00