Commit Graph

5420 Commits

Author SHA1 Message Date
PatrickvL a195045e84 Prevent dead-lock in VMManager::AllocateContiguous, by moving the if-IsMappable-goto-Fail line down below the Lock() call, so that we won't Unlock an unlocked critical section (which according to MS documentation, will cause a deadlock on the next call to EnterCriticaSection).
Source https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-leavecriticalsection :
"If a thread calls LeaveCriticalSection when it does not have ownership of the specified critical section object, an error occurs that may cause another thread using EnterCriticalSection to wait indefinitely."
2018-09-17 13:12:37 +02:00
Luke Usher 68f1293090 Fix incorrect flag masks in jump instructions 2018-09-15 22:37:35 +01:00
Luke Usher 1413f2960e Fix comment again... Are these comments really needed? Or/Xor/Operands are self-explanatory 2018-09-15 16:39:01 +01:00
Luke Usher 9bac79c44d Fix a compiler warning 2018-09-15 16:24:38 +01:00
Luke Usher b3338288a6 Fix OR->XOR in comment 2018-09-15 16:22:07 +01:00
Luke Usher b8889b6857 Fix a crash on invalid memory accesses 2018-09-15 16:19:50 +01:00
Luke Usher 1102133475 Attempt to interpret code blocks rather than single instructions, reducing MMIO overheads 2018-09-15 12:20:28 +01:00
patrickvl 6af5b65e4a HLE : Extract common CreateDevice code to two separate functions. 2018-09-12 17:03:37 +02:00
patrickvl 7b4dc90b73 nv2a: Ptimer fixes
Ported from https://github.com/xqemu/xqemu/pull/113 by dracc https://github.com/dracc

A few GPU timing related fixes
NV2A crystal frequency is currently set to debug unit speed of 13.5MHz.
Later retail xboxes had a 16.67MHz crystal according to @JayFoxRox's research(?).
Also, current ptimer clock value calculation is flipped around and on top of that always overflows.

With these fixes, running get_timers.py against xqemu reports values close to what real hardware gives.

Proposed changes
Set NV2A_CRYSTAL_FREQ to retail speed
Fix ptimer_get_clock() behaviour
2018-09-12 16:38:53 +02:00
PatrickvL 63f9128ae4
Merge pull request #1436 from faha223/FixArgcChecks
Fixed the argc checks in winmain and CxbxKrnl.cpp
2018-09-11 18:39:11 +02:00
Frederick Arthur Hallock III 440b62d63e Fixed the argc checks in winmain and CxbxKrnl.cpp that were checking against the wrong value. This was preventing the emulator from being launched in Kernel mode. 2018-09-11 12:18:55 -04:00
Luke Usher f798a23a85 Fix wrong calling convention around calls to KeGetPCR 2018-09-10 11:24:53 +01:00
PatrickvL db8cf258ba
Merge pull request #1434 from PatrickvL/d3d_plugins
Implemented drawing plugins
2018-09-08 08:07:59 +02:00
PatrickvL 7ccd90e2bd Implemented drawing plugins by moving HLE and LLE push buffer drawing into separate functions and passing HLE pushbuffer command handling on to the LLE pgraph method handler.
Also removed a few unused symbols (X_D3DRESOURCE_LOCK_PALETTE, extern EmuUpdateActiveTextureStages, g_bBadIndexData)
2018-09-07 10:48:19 +02:00
Luke Usher b46a82b23a
Removed Debug builds
Having multiple build types for each branch is proving to be confusing for some users. 

Ever since we implemented #1388, there has been no end-user benefit for using Debug builds, as they can get the same logging result by toggling the log level to Debug
2018-09-06 08:12:46 +01:00
RadWolfie 3c8169b076
Merge pull request #1427 from RadWolfie/Use-SimpleIni-class-for-Symbol-Cache-File
Use SimpleIni class for symbol cache file
2018-09-04 12:52:05 -05:00
RadWolfie 1e555bec3f Update UI and internal task to clear cache 2018-09-04 02:15:07 -05:00
RadWolfie 8ff36ffbef Include missing copyright authors 2018-09-03 21:47:32 -05:00
RadWolfie de347a1719 Replace Windows API to SimpleIni class
Plus also replace spaces to tabs in edited functions.
2018-09-03 21:46:57 -05:00
RadWolfie eff6da7551
Merge pull request #1426 from RadWolfie/move-source-files-to-their-own-folder-part1-of-2
Move source files to their own folder part1.2
2018-09-02 09:54:11 -05:00
RadWolfie 75ac4079aa Oops missed one link fixup 2018-09-02 09:44:18 -05:00
RadWolfie de1633dab5 Move D3D8 and Direct3D9 files into its own folder 2018-09-02 09:10:30 -05:00
RadWolfie 385e0c612d Oops 2018-09-02 06:55:23 -05:00
PatrickvL aeca7066bc
Updated readme
Changed Direct3D 8 into Direct3D 9
Removed d3d8to9 mention
2018-09-02 08:22:48 +02:00
RadWolfie 4ea37624a6
Merge pull request #1425 from RadWolfie/move-source-files-to-their-own-folder-part1
Move source files to their own folder (Part 1)
2018-09-01 15:12:18 -05:00
RadWolfie a2c667f706 Final clean up except for D3D8 files. 2018-09-01 14:49:03 -05:00
RadWolfie a89f702d1e Add D3D8 filter to visual studio 2018-09-01 14:23:18 -05:00
RadWolfie f083da6666 Move XGraphic to its own folder 2018-09-01 14:22:58 -05:00
RadWolfie 81d3ae8510 Move XOnline files to its own folder 2018-09-01 14:11:37 -05:00
RadWolfie dc24c3f1c1 Move XActEng files to its own folder 2018-09-01 13:34:50 -05:00
RadWolfie 696dc019d5 Fix file path comments 2018-09-01 12:55:13 -05:00
RadWolfie ba9dd0b399 Move XInput plugin in OHCI folder 2018-09-01 12:47:53 -05:00
RadWolfie a650e1e4f3 Move Xapi, XInput, and DInput into their own folder
Both XInput and DInput are migrated together. It's best to keep them in XInput folder.

As for Xapi files, may not require any plugin? Or possible put into their own folder?
2018-09-01 11:54:58 -05:00
RadWolfie 5ff6e9e6b5 Move DirectSound plugin to its own folder
Will eventually need to separate the APIs and its classes into a generic class.
2018-09-01 11:54:58 -05:00
RadWolfie ce67dea010 Move HLE's Intercept and Patches to their own folder
First step to organize the filesystem! (Beside hardware files has its own directory, good job!)
2018-09-01 11:54:58 -05:00
Luke Usher 9d6843f043
Merge pull request #1424 from LukeUsher/fix-depth-issues-cb-woc
Quick patch to fix Depth-Buffer issues in Crash Bandicoot: The Wrath of Cortex
2018-09-01 14:41:04 +01:00
Luke Usher f2b3a01210 Quick patch to fix Depth-Buffer issues in Crash Bandicoot: The Wrath of
Cortex (and likely many others)

Calling the unpatched trampoline of the patched function is enough to
solve the issue: This further enforces that unpatching these functions
and reading from NV2A state is the right thing to do, work will continue
on that as a seperate branch.
2018-09-01 14:33:50 +01:00
Luke Usher 9172cef216
Merge pull request #1400 from revel8n/shader_improvements
Shader improvements (Pixel Shader 2.0)
2018-08-30 21:39:47 +01:00
Luke Usher c23b3b25fc
Merge pull request #1423 from PatrickvL/newline_cleanup
Cleanup remnants from the FUNC_EXPORTS removal
2018-08-30 15:59:04 +01:00
PatrickvL 361504e97b Cleanup remnants from the FUNC_EXPORTS removal 2018-08-30 16:39:54 +02:00
Luke Usher b40431f976
Merge pull request #1421 from RadWolfie/minor-fixup-for-wm_move
Fix flickering window on move
2018-08-30 07:22:43 +01:00
RadWolfie 44013064e0 Fix flickering window on move
Using this method perform very minor flicker when moving around on screen.
2018-08-29 19:17:40 -05:00
Luke Usher a0cf419193
Merge pull request #1420 from LukeUsher/hle-patching
Split Symbol scanning and patching phases
2018-08-28 18:43:07 +01:00
Luke Usher 2c5873a070 Fix complation after rebase 2018-08-28 16:26:08 +01:00
Luke Usher b00ab30648 Split Symbol scanning and patching phases
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.
2018-08-28 16:23:53 +01:00
revel8n 4d2e5a27ef
Fix incorrect instruction index used for register replacement 2018-08-28 09:22:02 -05:00
revel8n 28ace7e010
Update to pass correct register type for pixel shader 1.3 and below when determining output register validity 2018-08-28 09:21:59 -05:00
revel8n ad2691618a
Added initial implementation of bump mapping related instructions
- Added handling of missing texture state states
- Added retrieval of bump mapping texture stage states as pixel shader constants
2018-08-28 09:21:55 -05:00
revel8n 919891cf3d
Fixes for matrix calculations in texm instructions
- 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
2018-08-28 09:21:51 -05:00
revel8n 3f0f0cd2f2
Initial implementation of pixel shader 2.0 replacement of unsupported 'texm*' instructions and register usage optimization 2018-08-28 09:21:47 -05:00