This allows for both steps to be completely disconnected, easily
allowing patches to be turned on or off based on a set of flags, as well
as preventing the need to clear the HLE cache when switching from
HLE->LLE.
This also allows patches to be seen/modifed from a central location,
no more searching through the codebase to determine if a function should
be patched or not, and no more 'FUNC_EXPORTS/GetProcAddress' magic!
Currently, this is used for HLE only, but could really shine when
extended to introduce optional detour based logging even when LLE is
enabled.
For example We could easily add a LLE_D3D_DETOUR flag, which when
enabled, patches functions with a wrapper, which simply logs input and
output, calling the original xbox function via a trampoline.
This would be great for debugging, as we'd get a full call trace from
the API level, even when not implementing HLE.
There's also the possibility of mixing in some patches even with LLE
enabled: for a hybrid HLE/LLE solution of the same functionality,
but there are no plans to implement that at this moment of time.
- Updated incomplete logic for texm instructions to perform correct number of dot products
- updated CMP instruction logic to more closely match CND logic
- Added missing compare to depth instruction
- Moved recompiled results into shader structure as mappings are needed when resolving constant register indexes
- Moved texture mode decoding to before fixups and optimizations
- Added initial method to fix uninitialized registers components
- Added fixes for accesses to registers that became read-only in 1.4+
- Updated logic that initialized texture coordinate register accesses
- Additional logic to fix LRP instruction that accessed registers more than allowed
- Preparations for method to handle general register access limitations
- Moved patching of scalar instructions to catch those missed before
- Added enumeration values for additional DCL instructions
- Added enumeration values for additional TEXLD and TEXCRD instructions
- Added enumeration values for Sampler and Output Color registers
- Added additional constant declarations for use as scaling parameters when replacing unsupported instruction and argument modifiers
- Added helper method for checking set argument modifier flags
- Added helper method for setting parameter to declared constant register value
- Increased number of Intermediate slots
- Added helper method to set parameter to unclamped color value
- Added helper methods that allow for searching for free registers to be used as outputs
- Added helper method to retrieve maximum register counts based on type
- Updated register replacement methods to allow specifying range and exclusion
- Added helper method to determine which registers are valid for output on PC
- Added additional optimizations for MAD instructions
- Added conversion of CND instruction on unsupported pixel shader versions
- Added additional methods to fix destination register usage, constant value parameters, and argument and instruction modifiers
- Added additional method to add output to color register when required
- Updated texture mode decoding to support requirements for pixel shader version 2.0 (declare samplers, declare input registers, texcoord and texcrd usage, etc.)
- Fix for loops that were overrunning parameter counts
- Added additional constant value logic to attempt to use constant registers when possible
Following titles are functional: (demos didn't work right before)
* Xbox Demos [XK-001 v1.01]
* Whacked
* Xbox demos
* RalliSport Challenge
* Xbox demos
* Quantum Redshift
* Xbox demos
Confirmed does not regress:
* Xbox dashboard
* Xbox Live
rest of the kernel.
NOTE: This brings back the previous KeBugCheck issue: Turns out it
wasn't solved by the previous commit, instead, the thread triggering the
error was hanging, preventing the error from appearing. Need to find a
better solution.
Perhaps we need to write our own custom KeWait implementation for now,
rather than attempting to mirror Xbox functionality 1:1. Direct Code
execution severely reduces the viability of an accurate
implementation of this.
Currently disabled as it doesn't work yet/is incomplete.
Work will be resumed once LLE OCHI is stable and enabled.
For now, we'll just have to skip Segaboot and launch games directly.