* [runtime] Memory swizzling rework
Reimplementation of memory swizzling supporting all valid GS texture
storage types.
An additional optimization was done to improve the speed of lookups.
Since page access is linear, we can precompute the non-linear bit
(blocks and columns) for an entire page for each format. This reduces
the runtime calculation to just calculating the correct page in 2d
memory space and then performing a lookup in the table to get the
location in memory inside a page. Since all page accesses are the same,
this works across all pages. Speed improvements should be compounded by
the number of accesses but there might be some reductions as a result of
actually implementing formats that were not implemented before.
I took care to do this with simple math. GS swizzling is complicated and
optimizing it for debug builds is outside the scope of my current work.
This is just the standalone code. It will be worked into the current
rasterizer in a follow up commit.
* [runtime] Reimplement GS host -> local transfers
Reimplement the host -> local transfers using new swizzling code
* [runtime] Reimplement sampling with new swizzling
Reimplements the rasterizer sampling code to use the new swizzling code
* [runtime] Replace fb writes with new swizzling
Replace the framebuffer write code with the new swizzling code
* [runtime] Reduce vram read/write to func lookup
Reduces the vram read write switches to a function lookup
* [tests] fix GS tests not handling depth test
* [runtime] z interpolation and write support
Add support for interpolating z from primitives and writing to the z
buffer after z testing and masking
* [runtime] local to local transfer rework
* [runtime] host readout uses new sizzling code
plus cleanup some dead code
* [runtime] rework local->host transfer
update to the new swizzling code
* [runtime] update clear function with new swizzling
* feat: invert codegen hight to low convertion
feat: added copy and GetEntryAddress
feat: handle truncated DMAC
* feat: always use address on analyzer now
* feat: correct pick syscalls ID
* feat: added deci2Call
* feat: added wip dbcmain IOP
* feat: added InitTLB
feat: added err logs on thread for debug sus crash
* fix: fix SetupHeap for strange cases
* feat: fix incorrect SetupHeap test(it use a wrong idea on how heap allocate memory)
* feat: added memalign and memalign_r
feat: added GetOsdConfigParam2 and SetOsdConfigParam2 but idk if was a good idea
* feat: added more memory stuff
* feat: back to library functions
* 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
* fix: CRITICAL fix on code gen on generating BEQ translation, I added a small yeld because goto could spin forever and monopolize guest execution
* feat: add scratchpad alias base and improve scratchpad address handling
* feat: added debug logging on GifArbiter for submit and drain operations
* feat: add interrupt and thread management syscall implementations
fix: change some IDs calls to match ps2sdk
* feat: added vif1 logs
* feat: added logs on gs gpu
feat: added performLocalToLocalTransfer to GS emulation path for TRXDIR = 2. (emulates the PS2 GS “copy this rectangle from one place in VRAM to another”)
* feat: added PSMT8 and refactor PSMT4
* feat: some identation on vu1
feat: added some logs on vu1
* feat: added GuestExecutionScope to temporarily stop owning guest execution, then restore it exactly as it was.
feat: added vsync wizardry
feat: added some regression test
* fix: fix gs logger
* feat: remove extra logs I think they will help no one
feat: move join all threads to prevent the app to get stuck on close, but now it random crash on closing
feat: one more small test on psmt4 to try fix ghosting on re code veronica
* feat: added a small case for exporter from ghidra for metal slug 3
* feat: added ugly code to pass on test
* docs: deprecate the local analyzer workflow in favor of Ghidra
feat: improve the Ghidra exporter for stripped games and internal entry points
fix: correct FindAddress behavior in the runtime
fix: emit missing delay-slot code in recompiler edge cases
feat: add SetSyscall support from @Whoneon
feat: add dispatchSyscallOverride support from @Whoneon
fix: fix Unmatched '{' due to missing newlines from issue #96
feat: delete python ghidra script I never updated it anyway
feat: added a lot more of regression test
feat: added a lot of logs to help debug on runtime
fix: fix wrong syscall ID on runtime
* pad: implement basic input mapping and stubs
Add a minimal libpad implementation backed by raylib input
Provide override hooks for deterministic tests
Add pad input tests and link runtime into test target
* FIX: moved pad override test hooks to ps2_call_list.h
* pad: move test hooks to X macro list + removing __cplusplus ifdef
* removed one last ifdef remaining
* refresh PR merge status
---------
Co-authored-by: Ranieri <ran-junior@hotmail.com>
* 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
* 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
* 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
* mc0: map memory card paths to mcRoot and related io tests
* Fix mc0 test setup to initialize temp paths
* fix: implementing WIN32 I/O support in syscalls
* fix: avoid fioWrite deadlock
Do not lock the fd map while calling getHostFile; use the syscall file mutex around fwrite instead
* 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
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
* 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
* refactor: structed binding for readability and clarity, used emplace_back to prevent extra-copied object
* fix: add dwarf_private.h include
* fix: update GPR_U32 and GPR_S32 macros to use _mm_extract_epi32 for SSE/AVX intrinsics
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