Commit Graph

3543 Commits

Author SHA1 Message Date
Luke Usher fe75b70331 Unpatch D3DDevice_GetPersistedSurface & Document
D3DDevice_PersistDisplay

D3DDevice_GetPersistedSurface is a wrapper around
AvGetSavedDataAddress() and does not need to be patched.

D3DDevice_PersistDisplay needs to be patched for now, as it depends on
CMiniport::IsFlipPending, which only works with LLE NV2A at this moment
in time.
2018-02-05 13:31:52 +00:00
Luke Usher cb08990572 Unpatch D3DCubeTexture_GetCubeMapSurface
This function simply returns a new surface which points to one side of a
Cube Texture.

And as such doesn't need to be patched.
2018-02-05 13:27:59 +00:00
Luke Usher ec40b8408f Unpatch Texture Lock functions and introduce EmuUpdateActiveTextureStages
This fixed an issue in Crash Bandicoot: The Wrath of Cortex in which the
splash screen was corrupt (new issue to this branch)

Currently, this function does no hashing/dirty flags/any checks for
modification, so titles that modify textures on the fly will not display
correctly.

This will be addressed in a later commit.
2018-02-05 13:27:59 +00:00
Luke Usher 50750e318c Unpatch remanining XG functions 2018-02-05 13:27:59 +00:00
Luke Usher 0fc2266b95 Introduce SetHostResource 2018-02-05 13:27:58 +00:00
Luke Usher d64a85db53 GetHostResource now does EmuVerifyResourceIsRegistered
This prevents the need for all the calls to this function throughout the
codebase, and also means that resources are only converted to their host
counterparts when this is actually required by Cxbx-Reloaded, rather
than anytime the resource is used.
2018-02-05 13:27:58 +00:00
Luke Usher c088f5cc38 Increment Reference Count instead of calling EmuPatch(D3DResource_AddRef)
- This prevents unwanted side effects when all we want to do is increment the Xbox reference count.

 Cleanup around Set/Get RenderTarget
  - This still isn't quite right, but a little bettter than what we had
  - Turns out this as been wrong ever since we unpatched D3DDevice_CreateDevice!
2018-02-05 13:27:58 +00:00
Luke Usher eaf49d885b Fix another case of D3DResource_Register trashing the Data pointer
- This restored textures in the 4361+ XDK samples

 Move Host Resource lookup into a function to reduce code duplication.
  - The new function (GetHostResource) is now used internally by all the other GetXXXResource functions.
2018-02-05 13:27:58 +00:00
Luke Usher 2cde77ee73 Map Xbox Resources to Host Resources via the data pointer, rather than the resourcce header
- This fixes an issue where the XOnlineDash would crash when re-using resource data.

 Fix a nullptr dereference in D3DResource_Release

Stop trashing resource data pointers within D3DResource_Register
 - The xbox function now works unpatched and takes care of this before function executes.
2018-02-05 13:27:57 +00:00
Luke Usher 8e3e374332 Protect against the data pointer being trashed by Release 2018-02-05 13:27:57 +00:00
Luke Usher 65b5e915a6 Hijack D3DResource_Release to free host resources when the last Xbox copy is released 2018-02-05 13:27:57 +00:00
Luke Usher 59dac75ca7 Unpatch Get2DSurfaceDesc 2018-02-05 13:27:57 +00:00
Luke Usher d97d264d74 Multiple Tweaks/Improvements
Rename IsYuvSurface to IsYuvSurfaceOrTexture, apply the same changes to D3DTexture_LockRect as D3DSurface_LockRect (allows Silent Hill 2 to progress very slightly further)

Decouple host resources from the Resource->Lock field, I may have missed a few things, but now host resources no longer get lost if Xbox code or an unpatched function changes -> Lock!
2018-02-05 13:27:57 +00:00
Luke Usher a06a6179a8 Restore accidentally overwritten comments. 2018-02-05 13:27:56 +00:00
Luke Usher dcd2d7230d Fix YUV Overlay Playback
Now with less hacks, a simpler code path (always software based) and without the need for
maintaining a host copy of the YUV surface.
2018-02-05 13:27:56 +00:00
Luke Usher 3984b59cc7 Unpatch various D3D functions. Smashing Drive & JSRF still work, other titles promising! 2018-02-05 13:27:56 +00:00
Luke Usher 57a00bf366
Merge pull request #905 from PatrickvL/SmallStuff
Memory manager tweaks v2
2018-02-04 13:19:49 +00:00
patrickvl 8b44d804d6 Attempt to fix line-ending difference 2018-02-03 22:41:12 +01:00
patrickvl f2f0b61570 Fix compile after rebase 2018-02-03 22:30:34 +01:00
PatrickvL 33fddb0cf0 Kernel : Forward NtAllocateVirtualMemory and NtFreeVirtualMemory to XbAllocateVirtualMemory and XbFreeVirtualMemory.
For now, the actual (non-stub) implementations are still forwarding to Windows.

Still, this move centralizes the work to be done, and decouples it from our kernel implementation.
2018-02-03 22:21:07 +01:00
PatrickvL 5f542fb09b VMManager : Removed XbAllocateVirtualMemoryReal and XbFreeVirtualMemoryReal, instead marked bStub argument as default false. 2018-02-03 22:21:06 +01:00
patrickvl 480179f65a Prevent zero-alignment (and remove needless newline from EmuWarning calls) 2018-02-03 22:21:04 +01:00
patrickvl 9927013eaa Forgot a break, that broke all contiguous allocations... ahum. 2018-02-03 22:21:02 +01:00
PatrickvL c70f678470 Fix merge-conflicts while merging branch upstream 'master' into SmallStuff 2018-02-03 22:21:00 +01:00
PatrickvL 909e5d1c5d
Merge pull request #896 from PatrickvL/XboxDevices
Centralized hardware devices
2018-02-03 13:57:48 +01:00
patrickvl 1313fd9d99 Fix project filters 2018-02-03 13:57:48 +01:00
PatrickvL fde310fe94 Centralized hardware devices around Xbox sytem, (revisions of) components chosen based on hardware revision.
Most is not yet implemented, but more will surely follow.
Moved SMBUS-address defines and global device variables towards Xbox.h
2018-02-03 13:53:23 +01:00
PatrickvL 3b8e3967cb Fix build after rebase 2018-02-01 17:07:08 +01:00
PatrickvL 4080cc42ac Prevent potential memory leak 2018-02-01 17:07:08 +01:00
patrickvl 0249620f04 Restored commented-out default case when reading SMC_COMMAND_VERSION byte. 2018-02-01 17:07:08 +01:00
patrickvl a5f303a353 DebugKit contain Conexant TV encoder 2018-02-01 17:07:08 +01:00
PatrickvL 4d7895eb98 Centralized hardware devices around Xbox sytem, (revisions of) components chosen based on hardware revision.
Most is not yet implemented, but more will surely follow.
Moved SMBUS-address defines and global device variables towards Xbox.h
2018-02-01 17:07:07 +01:00
PatrickvL c08c4d9224
Merge pull request #903 from x1nixmzeng/thread-names
Thread names
2018-02-01 10:17:30 +01:00
x1nixmzeng 59ad517149 Lookup current threadid
And early-out when not debugging
2018-02-01 08:49:34 +00:00
x1nixmzeng 58ca1159f1 Named all threaded methods 2018-01-31 23:31:28 +00:00
x1nixmzeng 416a3a9a68 Support for naming threads under Windows 2018-01-31 23:17:33 +00:00
PatrickvL 1d32fac997
Merge pull request #900 from ergo720/HalRegisterShutdownNotification
HalRegisterShutdownNotification implementation
2018-01-30 14:20:28 +01:00
ergo720 9bfae8be5d HalRegisterShutdownNotification implementation 2018-01-30 13:44:47 +01:00
PatrickvL bc1df4c073
Merge pull request #898 from LukeUsher/various-tweaks
Various Fixes from patch-removal-experiment
2018-01-28 15:02:05 +01:00
Luke Usher 9e8725518d Unpatch more of XFileMediaObject
Fixes missing intro audio in Crash Twinsanity
2018-01-28 13:21:15 +00:00
Luke Usher 9760609c75 Unpatch XFileMediaObject API functions
This fixes a hang in Atari Anthology and likely other titles.
These functions do not actually need to be patched.
2018-01-28 13:21:06 +00:00
Luke Usher ff857021e1 Unpatch D3D_CMiniport_GetDisplayCapabilities as it's just a wrapper around AvSendTvEncoderOption 2018-01-28 13:20:58 +00:00
Luke Usher ccf287033b Unpatch XWaveFileCreateMediaObject
This fixes a hang in Crash Bandicoot: The Wrath of Cortex.
2018-01-28 13:20:47 +00:00
Luke Usher 12349e345d Don't attempt to compile empty pixel shaders (those with no instructions)
This gets past the vs1.1 crash in Sonic Heroes E3 Demo.
2018-01-28 13:20:41 +00:00
PatrickvL c8c0353374
Merge pull request #895 from ergo720/FatalMessage
Xbox fatal error implementation
2018-01-28 12:44:27 +01:00
ergo720 753d9d89c2 Dashboard fatal error + fix issue #878 2018-01-28 10:06:11 +01:00
PatrickvL 5b4c5e59a7
Merge pull request #897 from donwayo/xbeinfo
Xbeinfo
2018-01-28 00:55:50 +01:00
Eduardo C 774f300b33 Tweaks to GenExtraInfo() 2018-01-28 00:44:12 +01:00
Eduardo C b95f65be30 Fix tabs... 2018-01-27 22:11:37 +01:00
Eduardo C 576ce83e94 Improved dumping of extended Xbe certificate information: Original Certificate Size, Online Service ID, Extra Security Flags, and Code Encryption Key 2018-01-27 22:04:55 +01:00