* Patch stack checks done using fs:[0x28]
Additionally adds support for multiple patches per instruction, since this makes two separate patches we need to conditionally perform for mov instructions.
* Missing include
* Disable patches for Apple
Mac can use their native FS segment directly, so these patches aren't needed
* Oops
* VectorFpRound64 decode table
Also fixed definition for V_TRUNC_F64, though I doubt that would change anything important.
* V_FLOOR_F64 implementation
Used by Just Cause 4
* Oops
Never forget your 64s
* Some mprotect fixes
The biggest thing here is preventing mprotect on memory that isn't mapped in address space. This would cause exceptions before, but succeeds on real hardware.
I've also included a couple other minor fixes, mostly based around some tests I recently performed.
Note: All changes to memory pools in this PR are assumed. I have not yet tested memory pools with any of this logic, but I do at least want to prevent mprotect on pool reserved memory to avoid crashes.
* Update memory.cpp
* clang
* Avoid storing the Tcb pointer on the stack
* Just return the already stored pointer in GetTcbBase
* Replace uses of GetTcbBase with g_curthread->tcb
* copyright 2025
* sir clang offnir, the all-formatting
The bitfield in the struct is padded, which produces uninitialized memory on initialization.
To avoid modifying the struct while making our GraphicsPipelineKey struct properly hashable, set values directly instead of re-initializing.
This fixes pipeline compile spam, and the subsequent poor performance, on certain setups.
* Earlier initialization of elf info.
Everything used for elf info initialization comes from the param.sfo, so we can initialize this earlier to have this information accessible during memory init.
* Extract compiled SDK version from pubtoolinfo string
Up until now, we've been using the game's reported "firmware version" as our compiled SDK version. This behavior is inaccurate, and is something that has come up in my hardware tests before.
For the actual compiled SDK version, we should use the SDK version in the PUBTOOLINFO string of the param.sfo, only falling back on the firmware version when that the sdk_ver component isn't present.
* Store compiled SDK version in ElfInfo
* Limit address space for compiled SDK version at or above FW 3
Sony placed a hard cap at 0xfc00000000, with a slight extension for stack mappings. For now, though stack mappings aren't implemented, there's no harm in keeping a slightly extended address space (since this cap is lower than our old user max).
Limiting the max through address space is necessary for Windows due to performance issues, in the future I plan to properly implement checks in memory manager code to properly handle this behavior for all platforms.
* Use compiled SDK version for sceKernelGetCompiledSdkVersion
I think this is pretty self explanatory.
* Log SDK version
Since this value is what most internal firmware version checks are against, logging the value will help with debugging.
* Update address_space.cpp
* Update emulator.cpp
* Backwards compatible logging
Because that's apparently an issue now