diff --git a/build/win32/Cxbx.suo b/build/win32/Cxbx.suo new file mode 100644 index 000000000..26b0d7080 Binary files /dev/null and b/build/win32/Cxbx.suo differ diff --git a/build/win32/CxbxKrnl.vcproj b/build/win32/CxbxKrnl.vcproj index 2f338d145..8c3465524 100644 --- a/build/win32/CxbxKrnl.vcproj +++ b/build/win32/CxbxKrnl.vcproj @@ -179,6 +179,7 @@ ProgramDatabaseFile=".\..\..\bin\debug/CxbxKrnl.pdb" GenerateMapFile="true" MapFileName=".\..\..\bin\debug/CxbxKrnl.map" + StackReserveSize="8000000" RandomizedBaseAddress="1" DataExecutionPrevention="0" ImportLibrary=".\..\..\bin\debug/CxbxKrnl.lib" @@ -378,6 +379,10 @@ RelativePath="..\..\src\CxbxKrnl\HLEDataBase\D3D8.1.0.5849.h" > + + @@ -442,6 +447,10 @@ RelativePath="..\..\src\CxbxKrnl\HLEDataBase\Xapi.1.0.5849.h" > + + @@ -470,6 +479,10 @@ RelativePath="..\..\src\CxbxKrnl\HLEDataBase\XOnline.1.0.4627.h" > + + + + @@ -1304,6 +1321,10 @@ /> + + @@ -1628,6 +1649,10 @@ /> + + @@ -1752,6 +1777,10 @@ RelativePath="..\..\src\CxbxKrnl\HLEDataBase\XOnline.1.0.4627.inl" > + + + + diff --git a/doc/Changelog.txt b/doc/Changelog.txt index e30c7d1f2..d6793d5f4 100644 --- a/doc/Changelog.txt +++ b/doc/Changelog.txt @@ -1,5 +1,25 @@ Cxbx Home Page: http://www.caustik.com/cxbx/ +version: 0.8.1 (2/3/10) +-------------------------------- + +- Cxbx's compatibility has vastly increased (see compatibility list). + +- Added video option to enable/disable hardware YUV surfaces for video playback. + (This should fix problems with videos not showing up or robotic sounds). + +- Fixed bug in vertex patching code for Vista (thanks defiance)! + +- Most XDKs have at least basic support. + +- Fixed pipeline bumpmapping is now supported. + +- Multiple thread notification routines now supported. + +- Lots of bug fixes. + +- And many more I can't remember (it's been a long time)! + version: 0.8.0 (??/??/??) -------------------------------- diff --git a/doc/ShogunChangelog.txt b/doc/ShogunChangelog.txt index 9fcc9b48a..10d8c438a 100644 --- a/doc/ShogunChangelog.txt +++ b/doc/ShogunChangelog.txt @@ -192,4 +192,563 @@ TODO: Investigate 0x2AE7F2 and 0x2C8877 for Panzer. - Added the following texture formats D3DFMT_A8B8G8R8 (Swizzled) - D3DFMT_UYVY (Swizzled, afaik) \ No newline at end of file + D3DFMT_UYVY (Swizzled, afaik) + +11/11/09 +- Added the following texture format(s) + D3DFMT_UNKNOWN (Undefined) (For MetalSlug 3) + +- Added the following functions + IDirect3DDevice8_SetShaderConstantMode (5849) + IDirect3DDevice8_SetViewport (5849) + QueueUserAPC (5849) (Possibly too high level) + CDirectSound_SetAllParameters (4721) + +11/18/09 +- Added the following function(s) + IDirect3D8_CreateDevice (5028) + +11/20/09 +- Added the following function(s) + RtlReallocateHeap (4361) + RtlSizeHeap (4361) + CDirectSoundVoiceSettings::SetMixBinVolumes (4361) + CDirectSoundVoice::SetMixBinVolumes (4361) + CDirectSoundBuffer::SetMixBinVolumes (4361) + +- Removed DSOUND 4361 alias to 4627 (This will break Smashing Drive!) + +11/22/09 +- Temporarily set DSOUND 4361 alias to 4627 again. +- Added the following function(s) + CDirectSoundStream_SetMixBins (4627) + CMcpxVoiceClient_SetEG (4627) + CDirectSoundVoice_SetEG (4627) + CDirectSoundStream_SetEG (4627) + CDirectSoundStream_FlushEx (4627) + IDirectSoundStream_FlushEx (4627) + +11/23/09 +- Added the following function(s) + RtlCreateHeap (4134) + RtlAllocateHeap (4134) + RtlFreeHeap (4134) + RtlReAllocateHeap (4134) + RtlSizeHeap (4134) + XapiBootDash (4134) + XRegisterThreadNotifyRoutine (4134) + XGetDeviceChanges (4134) + XID_fCloseDevice (XREF) (4134) + XInputClose (4134) + XInputGetCapabilities (4134) + SetThreadPriorityBoost (4134) + GetThreadPriority (4134) + XGetDevices (4134) + QueryPerformanceCounter (4134) + QueryPerformanceFrequency (4134) + XInputPoll (4134 - 4928) + XGetSectionHandleA (4134 - 4928) + XLoadSectionByHandle (4134 - 4928) + XFreeSectionByHandle (4134 - 4928) + RtlDestroyHeap (4134 - 4928) + D3DDevice_CreatePixelShader (4134) + IDirect3DSurface8_LockRect (4134) + Lock2DSurface (4134) + D3DDevice_SetGammaRamp (4134) + IDirect3D8_CheckDeviceFormat (4134) + IDirect3D8_GetAdapterModeCount (4134) + IDirect3D8_EnumAdapterModes (4134) + IDirect3DDevice8_LoadVertexShader (4134) + IDirect3DDevice8_SelectVertexShader (4134) + IDirect3DDevice8_CopyRects (4134) + IDirect3DDevice8_CreateImageSurface (4134) + IDirect3DDevice8_SetVertexShaderConstant (4134) + IDirect3DDevice8_SetPixelShader (4134) + IDirect3DDevice8_SetTextureState_BumpEnv (4134) + IDirect3DDevice8_SetIndices (4134) + IDirect3DDevice8_SetTexture (4134) + IDirect3DDevice8_SetRenderState_VertexBlend (4134) + IDirect3DDevice8_SetRenderState_TextureFactor (4134) + IDirect3DDevice8_SetRenderState_EdgeAntiAlias (4134) + IDirect3DDevice8_SetRenderState_Simple (4134) + IDirect3DDevice8_SetRenderState_ZEnable (4134) + IDirect3DDevice8_SetRenderState_StencilEnable (4134) + IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias (4134) + IDirect3DDevice8_GetTransform (4134) + IDirect3DDevice8_SetStreamSource (4134) + IDirect3DDevice8_SetVertexShader (4134) + IDirect3DDevice8_DrawVertices (4134) + IDirect3DDevice8_DrawVerticesUP (4134) + IDirect3DDevice8_DrawIndexedVertices (4134) + IDirect3DDevice8_SetLight (4134) + IDirect3DDevice8_SetMaterial (4134) + IDirect3DDevice8_LightEnable (4134) + IDirect3DVertexBuffer8_Lock (4134) + Get2DSurfaceDesc (4134) + IDirect3DSurface8_GetDesc (4134) + IDirect3DDevice8_SetRenderState_StencilFail (4134) + IDirect3DDevice8_SetRenderState_NormalizeNormals (4134) + IDirect3DDevice8_Reset (4134 - 4361) + IDirect3D8_KickOffAndWaitForIdle (4134 - 4361) + IDirect3DDevice8_SetTextureState_TwoSidedLighting (4134 - 4361) + IDirect3DDevice8_SetRenderState_BackFillMode (4134 - 4361) + IDirect3DDevice8_SetTextureState_ColorKeyColor (4134 - 4361) + IDirect3DDevice8_SetRenderState_FrontFace (4134 - 4361) + IDirect3DDevice8_SetRenderState_LogicOp (4134 - 4361) + IDirect3DDevice8_SetRenderState_StencilFail (4134 - 4361) + IDirect3DDevice8_SetRenderState_OcclusionCullEnable (4134 - 4361) + IDirect3DDevice8_SetRenderState_StencilCullEnable (4134 - 4361) + +- Move the following functions + XInputPoll (4928 -> 4134) + XGetSectionHandleA (4627 -> 4134) + XLoadSectionByHandle (4627 -> 4134) + XFreeSectionByHandle (4627 -> 4134) + RtlDestroyHeap (4627 -> 4134) + IDirect3DDevice8_Reset (4134) + IDirect3D8_KickOffAndWaitForIdle (4432 -> 4134) + IDirect3DDevice8_SetTextureState_TwoSidedLighting (4432 -> 4134) + IDirect3DDevice8_SetRenderState_BackFillMode (4432 -> 4134) + IDirect3DDevice8_SetTextureState_ColorKeyColor (4432 -> 4134) + IDirect3DDevice8_SetRenderState_FrontFace (4432 -> 4134) + IDirect3DDevice8_SetRenderState_LogicOp (4432 -> 4134) + IDirect3DDevice8_SetRenderState_StencilFail (4432 -> 4134) + IDirect3DDevice8_SetRenderState_OcclusionCullEnable (4432 -> 4134) + IDirect3DDevice8_SetRenderState_StencilCullEnable (4432 -> 4134) + +- Added a bit of code to print out more details about the Direct3D device + each Xbox game is trying to create. +- Added a hack to disable Tripple Buffering. JSRF needs this for cards that + don't support it with the parameters it's using. + +11/24/09 +- Added the following functions(s) + IDirect3DDevice8_FillMode (4134) + IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead (4134 - 4627) + IDirect3DDevice8_SetRenderState_RopZRead (4134 - 4627) + IDirect3DDevice8_SetRenderState_DoNotCullUncompressed (4134 - 4627) + IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable (4134 - 4361) + IDirect3DDevice8_SetRenderState_MultiSampleMask (4134 - 4361) + IDirect3DDevice8_SetRenderState_MultiSampleMode (4134 - 4361) + IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode (4134 - 4361) + IDirect3DDevice8_SetRenderState_ShadowFunc (4134 - 4361) + IDirect3DDevice8_SetRenderState_YuvEnable (4134 - 4361) + IDirect3DDevice8_DrawIndexedVerticesUP (4134 - 4361) + IDirect3DDevice8_SetPixelShaderConstant (4134 - 4627) + IDirect3DDevice8_DeletePixelShader (4134 - 4627) + IDirect3DDevice8_SetRenderState_CullModeB (4134 - 4627) + IDirect3DDevice8_DeleteVertexShader (4134 - 4627) + IDirect3DDevice8_SetScreenSpaceOffset (4134 - 4627) + D3D::SetFence (XREF) (4134 - 4627) + IDirect3DDevice8_SetRenderState_LineWidth (4134 - 4361) + IDirect3DDevice8_GetGammaRamp (4134) + SetThreadPriorityBoost (4134 - 4361) + IDirect3DDevice8_BlockUntilVerticalBlank (4134) + IDirect3DDevice8_SetSwapCallback (4134 - 4361) + IDirect3DDevice8_GetTile (4134 - 4361) + IDirect3DDevice8_SetTile (4134 - 4361) + IDirect3DDevice8_IsBusy (4134 - 4361) + +- Fix a bug in D3D8 4134. IDirect3DDevice8_SetRenderState_Fillmode_1_0_3925 was giving + us a false positive. The problem exists in 4034 as well because whoever started + trying to add 4034 and 4134 support just threw in a bunch of signatures from D3D8 3925 + must have been looking for similarities in that XDK. Good idea when you don't have + a certain XDK, but it's not 100% safe to do (or leave in unattended). +- Attempting to impliment IDirect3DDevice8_SetSwapCallback. Some of the steps necessary + will revolve around IDirect3DDevice8_SetVerticalBlankCallback's inner workings. Adding + the callback function to execute each time D3DDevice_Present/Swap is called is easy, but + Some of the parameters require a bit of leg work. Right now, some of my implementation + is guess work. Hopefully Caustik will have a good idea of what to do. +- Even worse, the signatures for D3DDevice_SetSwapCallback and D3DDevice_SetVerticalBlankCallback + are almost completely identical and are different by an extremely small margin. For 4134, + it looks the same as 4361's. I might be over reacting, but I just don't want to screw this + up because working on JSRF is proving to be a delicate operation! + +11/26/09 +- Added the following function(s) + XnInit (5233) + bind (5233) + ioctlsocket (5233) + WSAStartup (5233) + XNetStartup (5233 - 5344) + CDirectSoundStream_SetMode (3936) + +12/1/09 +- Added the following function(s) + XACT::CEngine::RegisterNotification (4627) + IXACTEngine_RegisterNotification (4627) + XACT::CEngine::GetNotification (4627) + IXACTEngine_GetNotification (4627) + XACT::CEngine::CreateSoundBank (4928) + IXACTEngine::CreateSoundBank (4928) + XACT::CEngine::RegisterWaveBank (4928) + IXACTEngine::RegisterWaveBank (4928) + XAudioDownloadEffectsImage (4627 - 4928) + +12/2/09 +- Added the following function(s) + XACT::CEngine::UnRegisterWaveBank (4928)(*) + IXACTEngine_UnRegisterWaveBank (4928)(*) + IDirect3DDevice8_PersistDisplay (4627 & 4928) + XNetGetEthernetLinkStatus (4627 - 4928, 5233 & 5344) + XGWriteSurfaceOrTextureToXPR (4627 - 4928) +- Other things + Added D3DTOP_BLENDCURRENTALPHA (13) + +- Unreal Championship gets passed the loading screen and the menus appear to be interactive + as well. It took F-O-R-E-V-E-R, but I'm finally beginning to make some significant progress + since my last updates for this game. + +(*) Could be wrong. Look into IXACTEngine_SetNotification as well... + +12/3/09 +- Added the following function(s) + XLaunchNewImageA (4627 & 4928) + XGetLaunchInfo (4627 - 4928) +- Unreal Championship appears to be "almost" ingame. The LaunchData parameter from XLaunchNewImageA + is saved in a .bin file (CxbxLaunchData.bin) and is loaded once XGetLaunchInfo is called. After it + is loaded, the file is deleted so that Unreal Championship is started normally. When CxbxLaunchData.bin + is loaded by XGetLaunchInfo, Unreal Championship will use this data to load the desired level and + data that goes with it. The biggest problem is that the controller is no longer recognized after + Cxbx is restarted. It may take yet another hack to get around this. If we can, we'll find out whether + this game can be played or not. + +12/26/09 +- Added the following function(s) + XSetProcessQuantumLength (4627 & 4721) + XGetFileCacheSize (5233 & 5344) + IDirect3DDevice8_Unknown1 (5233) (*) + IDirect3DDevice8_SetRenderState_TwoSidedLighting (5120 & 5233) + IDirect3DDevice8_SetRenderState_FrontFace (4531 - 5233) + IDirect3DDevice8_SetRenderState_LogicOp (4721 - 5344) + IDirect3DDevice8_BeginPush (5233 & 5344) + IDirect3DDevice8_EndPush (5233 & 5344) + +(*) This is not the actual function name. Since I was unable to find any functions even somewhat similar +to it (I don't have 5233, but not even 5344 helped this time), I just created a dummy function to the game +from crashing. There were 4 functions that had access to it, and I had no idea which one was calling it, +nor could I find out what those functions were either. The only lead I had was that it called the kernel +function AvSendTVEncoderOption, which led me to the assumption that we can get away with ignoring this function +for now. So far, this only occurs in games known as "Run Like Hell" and "Oddworld Munch's Oddyssee". + +12/27/09 +- Added the following function(s) + IDirect3DDevice8_AddRef (3925) [3911] + CDirectSoundStream_GetInfo (All) (*) + IDirect3DDevice8_Unknown1 (3925) (**) + IDirect3DDevice8_GetViewport (3925) + IDirect3DDevice8_GetGammaRamp (3925) + SignalObjectAndWait (3911 - 4627) + PulseEvent (3911) + IDirect3DDevice8_GetDisplayFieldStatus (3925) + +- Stopped Cxbx from trying to assemble "empty" shaders in Azurik: Rize of Perathia. + +(*) Since this function is part of the DirectSoundStream VTable (CDirectSoundStream::vtbl), the XDK doesn't +matter. +(**) See update for 12/26/09 + +12/28/09 +- Added the following function(s) + IDirect3DDevice8_SetSwapCallback (4928) + IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias (3925) [3911] + +12/29/09 +- Added the following function(s) + CDirectSoundVoice_SetMode (4627 - 4831) + CDirectSoundBuffer_SetMode (4627 - 4831) + IDirectSoundBuffer_SetMode (4627 - 4831) + IDirect3DDevice8_SetRenderState_FrontFace (4531 - 5120) + IDirect3DDevice8_SetRenderState_MultiSampleMode (4531 - 4831) + IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode (4531 - 4831) + IDirect3DDevice8_SetRenderState_StencilCullEnable (4531 - 4831) + +1/1/2010 +- Added the following function(s) + IDirect3DDevice8_SetGammaRamp (4242 - 4531) + IDirect3DDevice8_CreateVertexBuffer (4432) + IDirect3DDevice8_SetShaderConstantMode (4361 - 4432) + IDirect3DDevice8_SetVertexShaderConstant (4432 & 4531?) + IDirect3DDevice8_CreatePixelShader (4432 & 4531) + IDirect3DDevice8_GetViewport (4400 - 4531?) + IDirect3DDevice8_DrawVertices (4400 - 4531?) + IDirect3DDevice8_SetFlickerFilter (4361 & 4432) + IDirect3DDevice8_SetSoftDisplayFilter (4361 & 4432) + IDirect3DDevice8_SetGammaRamp (4432) + IDirect3DDevice8_DrawIndexedVertices (4400 - 4531?) + IDirect3DDevice8_PrimeVertexCache (4361) + IDirect3DDevice8_BeginPush/EndPush (4361) + IDirect3DDevice8_Begin/End (4361 - 4531?) + IDirect3DDevice8_SetVertexData2f (4361 - 4531?) + IDirect3DDevice8_SetVertexData4f (4361 - 4531?) + IDirect3DDevice8_SetVertexData4ub (4361 - 4531?) + CDirectSoundBuffer_PlayEx (4361 - 4627)(*) + IDirectSoundBuffer8_PlayEx (4361 - 4627)(*) + CMxpxBuffer_Stop2 (4361 - 4432)(**) + CDirectSoundBuffer_StopEx (4361 - 4627) + IDirectSoundBuffer8_StopEx (4361 - 4627) + CDirectSound_SetPosition (4361 - 4432) + +- Added support for D3DVSDE_BLENDWEIGHT + +(*) Not yet confirmed +(**) There are two versions of CMcpxBuffer_Stop. One has one parameter (ulong), and the other has two and calls + the first one (__int64, ulong). My signature is for the one with 2 params. + +1/2/10 +- Added the following function(s) + CDirectSound_SetVelocity (4432) + CDirectSoundVOice_SetPosition (4432) + IDirect3DDevice8_SetIndices (4400 - 4531) + +- Added all known blending operations (a bit surprised Caustik only added D3DBLENDOP_ADD) + +1/3/10 +- Added the following function(s) + IDirect3DDevice8_SetRenderState_VertexBlend (3925) [3911] + IDirect3DDevice8_SetRenderState_BackFillMode (3925) [3911] + IDirect3DDevice8_SetRenderState_TwoSidedLighting (3925) [3911] + IDirect3DDevice8_SetRenderState_NormalizeNormals (3925) [3911] + IDirect3DDevice8_SetRenderState_FrontFace (3925) [3911] + IDirect3DDevice8_SetRenderState_TextureFactor (3925) [3911] + IDirect3DDevice8_SetRenderState_LogicOp (3925) [3911] + IDirect3DDevice8_SetRenderState_EdgeAntiAlias (3925) [3911] + IDirect3DDevice8_SetRenderState_MultiSampleMask (3925) [3911] + IDirect3DDevice8_SetRenderState_MultiSampleMode (3925) [3911] + CreateFiber (4432) + DeleteFiber (4432) + +- Added the following kernel function(s) + KeBugCheck (*) + +- Fixed up EmuIDirect3DDevice8_UpdateOverlay a bit. Updating the overlay + in software lets me see video playback again and let's me take screen + shots because it's a YUV -> RGB conversion. Videos also play at more + "correct" speeds in software anyway. Unreal Championship requires + this to be done in software to avoid crashing. Also, since the YUV + overlay is done in software, it's not updated automatically like a hard- + ware accelerated overlay, so I added a hack to update the screen if + Present or Swap was not called since the last update of the overlay. + this fixes most problems I've had with video playback. + +(*) TODO: Find out what is calling this (possibly XapiFiberStartup) + +1/4/10 +- Added the following function(s) + IDirect3DDevice8_SetRenderState_ShadowFunc (3925) [3911] + IDirect3DDevice8_SetRenderState_LineWidth (3925) [3911] + IDirect3DDevice8_SetRenderState_YuvEnable (3925) [3911] + IDirect3DDevice8_PersistDisplay (3925) [3911] + +1/5/10 +- Added the following function(s) + CDirectSoundVoice_SetPitch (4627) + CDirectSoundBuffer_SetPitch (4627) + IDirectSoundBuffer8_SetPitch (4627) + CMcpxBuffer_GetStatus (4721) + IDirect3DDevice8_CreateIndexBuffer (5558) + IDirect3DDevice8_CreateIndexBuffer2 (5558) + IDirect3DDevice8_SetVerticalBlankCallback (5233) + +- The TechCertGame works again, but freezes ingame. + +1/6/10 +- Added the following function(s) + IDirect3DDevice8_SampleAlpha (5233 - 5344) + IDirect3DDevice8_GetVertexShaderSize (4134 - 4531) + +1/8/10 +- Added the following function(s) + CMcpxBuffer_Pause (4928 - 5344) + CDirectSoundBuffer_Pause (4928 - 5344) + IDirectSoundBuffer8_Pause (4928 - 5344) + CreateSemaphore (5558) (*) + ReleaseSemaphore (5558) (*) + IDirect3D8_GetAdapterModeCount (4721 - 5558) + IDirect3D8_EnumAdapterModes (4721 - 5558) + IDirect3DDevice8_SetverticalBlankCallback (5558) + IDirect3DDevice8_SetSwapCallback (5558) + IDirect3DDevice8_GetGammaRamp (5558 - 5659?) + IDirect3DDevice8_SetRenderState_TextureFactor (5558) + IDirect3DDevice8_SetRenderState_VertexBlend (5558) + +- Created new function EmuXB2PC_D3DMultisampleFormat(DWORD Type) in convert.cpp +- Fixed a bug in IDirect3D8_CheckMultiSampleDeviceType, actually use PCSurfaceFormat + flag instead of actual parameter! + +(*) Yes they are high level, but it fixes some problems with Metal Arms (5558) + +1/15/10 +- Added the following function(s) + IDirect3DDevice8_DrawVertices (3925) [3911] + IDirect3DDevice8_DrawVerticesUP (3925) [3911] + IDirect3DDevice8_DrawIndexedVerticesUP (3925) [3911] + CMcpxAPU::Set3dDopplerFactor (3936) [3911] + CDirectSound::SetDopplerFactor (3936) [3911] + IDirectSound8_SetDopplerFactor (3936) [3911] + IDirect3DDevice8_GetDisplayMode (3925) [3911] + XGIsSwizzledFormat (3911) + XGSizzleRect (3911) + XGUnswizzleRect (3911) + XGSwizzleBox (3911) + XGWriteSurfaceOrTextureToXPR (3911) + +- Added the following kernel function(s) + IoDismountVolumeByName + HalReadSMCTrayState + +- Added XG.1.0.3911.h/inl (it's about damn time!) + +1/16/09 +- Added the folliwing function(s) + IDirect3DDevice8_SetTextureState_BumpEnv (3925) [3911] + IDirect3DDevice8_SetTextureState_ColorKeyColor (3925) [3911] + IDirect3DDevice8_SetVertexData4s (3925) [3911] + IDirect3D8_SetPushBufferSize (3925) [3911] + CSensaura3d::GetFullHRTFFilterPair (3936) [3911] + DirectSoundUseFullHRTF (3936) [3911] + CDirectSound::GetCaps (3936) [3911] + IDirectSound8_GetCaps (3936) [3911] + +1/22/09 +- Added the following function(s) + timeSetEvent (4627 & 4721) + timeKillEvent (4627 & 4721) + CDirectSoundVoice::SetConeAngles (3936) [3911] + DirectSoundEnterCriticalSection (3936) [3911] + CDirectSoundBuffer::PlayEx (3936) [3911] + IDirectSoundBuffer8_PlayEx (3936) [3911] + DirectSoundUseFullHRTF (3936) [3911] + RaiseException (4627 - 4928) + +1/23/10 +- Added the following function(s) + D3D_AllocContiguousMemory (3925) [3911] (*) + IDirect3DResource8_GetType (3925) [3911] (*) + +(*) Cxbx doesn't crash without this signature... +(**) Just for testing purposes. You can remove it if you want/need. + +1/24/10 +- Added the following function(s) + IDirect3DDevice8_SetRenderState_Deferred (3925) [3911] (*) + IDirect3DDevice8_SetLight (3925) [3911] + IDirect3DDevice8_LightEnable (3925) [3911] + IDirect3DDevice8_CreateVertexShader (3925) [3911] + IDirect3DDevice8_SetRenderTarget (3948) [3911] + +(*) This can/should be removed once the detection of 3911's D3DDeferredRenderState +is properly located. + +- Fixed the ordering problem with Deferred Texture States in 3911. +- TODO: Compensate the difference in modified vertex shader constants. + +1/25/10 +- Added the following function(s) + IDirect3DSurface8_GetDesc (3925) [3911] + IDirectSound8_AddRef (3936) / [3911] - 4242 + DirectSoundGetSampleTime (3936) [3911] + IDirectSoundBuffer8_AddRef (3936) [3911] - 4627 + +- Moved the following function(s) + IDirectSound8_AddRef (4361 -> 3936) + IDirectSoundBuffer8_AddRef (4627 -> 3936) + +- Fix some bugs in EmuDirectSoundBufferCreate. DSBCAPS_MIXIN,_FXIN AND _FXIN2 + were getting by the "AcceptableMask" undetected. + +1/27/10 +- Added the following function(s) + IDirect3DDevice8_SetTile (3925) [3911] + CDirectSoundBuffer::SetMinDistance (3936) [3911] + IDirectSoundBuffer8_SetMinDistance (3936) [3911] + CDirectSoundBuffer::SetMaxDistance (3936) [3911] + IDirectSoundBuffer8_SetMaxDistance (3936) [3911] + IDirect3DDevice8_ApplyStateBlock (3925) [3911] + IDirect3DDevice8_CaptureStateBlock (3925) [3911] + IDirect3DDevice8_CreateStateBlock (3925) [3911] + IDirect3DDevice8_DeleteStateBlock (3925) [3911] + IDirect3DDevice8_DeletePixelShader (3925) [3911] + IDirectSoundBuffer8_SetMixBinVolumes (3925) [3911] + +_ Added the following kernel function(s) + KeRaiseIrqlToDpcLevel + +1/28/10 +- Added the following function(s) + QueueUserAPC (3911 - 5788) + GetThreadPriority (5849) + SetThreadPriorityBoost (5849) + IDirect3DDevice8_BlockUntilVerticalBlank (5849) + XGetSectionHandleA (5849) + XLoadSectionByHandle (5949) + XFreeSectionByHandle (5849) + XGetSectionSize (5849) + +- Moved the following function(s) + QueueUserAPC (5849 -> 3911) + +- Fixed the problem with QueueUserAPC, it works now. Had to set the + right permisions for it to work on windows. +- Made another signature for CMcpxBuffer::GetCurrentPosition (3911). The original + was off by one byte. + +2/4/10 +- Added the following function(s) + D3D::KickOffAndWaitForIdle (5344 - 5558) + IDirect3DDevice8_Reset (5558) + IDirect3DDevice8_SetGammaRamp (5455 - 5558) + IDirect3DDevice8_GetViewport (5558) + GetFileAttributesA (5558) + VirtualProtect (4627 - 5558) (*) + +(*) Probably too high level... + +4/9/10 +- Added new Simple Renderstates + D3DRS_STENCILZFAIL + D3DRS_STENCILPASS + D3DRS_STENCILFUNC + D3DRS_STENCILREF + D3DRS_STENCILMASK + D3DRS_STENCILWRITEMASK + +- Added the following function(s) + D3DDevice_SetModelView (3925) [3911] + D3DDevice_FlushVertexCache (3925) [3911] + D3DDevice_SetScissors (3925) [3911] + D3DDevice_SetVertexShaderInput (3925) [3911] + D3DDevice_PrimeVertexCache (3925) [3911] + D3DDevice_SetVertexData4ub (3925) [3911] + D3DDevice_SetVertexShaderConstant (3925) [3911] + D3DDevice_BeginPushBuffer (3925) [3911] + D3DDevice_EndPushBuffer (3925) [3911] + D3DDevice_SetRenderState_RopZCmpAlwaysRead (3925) [3911] + D3DDevice_SetRenderState_RopZRead (3925) [3911] (*) + D3DDevice_SetRenderState_DoNotCullUncompressed (3925) [3911] (*) + +(*) Not yet verified. Signatures are right, but XRefs probably aren't. + +4/10/10 +- Added a new fix for Halo in EmuFlushIVB(). Use g_IVBFVF when the current FVF is 0. +- Added the following function(s) + D3D::SetFence (XRef) (3925) [3911] + D3DDevice_InsertFence (3925) [3911] + D3DDevice_LoadVertexShaderProgram (3925) [3911] + D3DDevice_RunPushBuffer (3925) [3911] + IDirectSoundBuffer8_Play (3936) [3911] (Fixed) + +- Azurik: Rize of Perathia now goes ingame! + +4/11/10 +- Fixed a minor bug with the deferred texture state (D3DTSS_MAGFILTER) for XDK 3911. +- Fixed a major bug in the push buffer execution code. The stride was not incremented + for the D3DFVF_XYZ flag. Using the position mask to find position related FVFs. +- Robotech: Battlecry is now playable! + +4/13/10 +- Added the following function(s) + Direct3D_EnumAdapterModes (5233-5344) + D3DDevice_SetVerticalBlankCallback (5455) + D3DDevice_GetProjection + \ No newline at end of file diff --git a/doc/ShogunTodo.txt b/doc/ShogunTodo.txt index 87bd21d35..7e13b0f54 100644 --- a/doc/ShogunTodo.txt +++ b/doc/ShogunTodo.txt @@ -11,8 +11,12 @@ Emulation: - Ensure the Cxbx has some basic support for every XDK. We're close, but 5028, 5120, 5455 and 5788 need further investigation. - The Xbox's version of the .xsb format needs to be reversed for XACT. - - Verify that section loading APIs can really be ignored. + - Cache xbe section addresses and names for XLoad/FreeSection[ByHandle] - Basic network capabilities? + - Some vertex shaders have their constant register usage modified by Cxbx (to balance out + the fact that Xbox vertex shaders can use constant values -96 to 96. Adding 96 in + SetVertexShaderConstant fixes some samples and Petit Copter, but breaks Turok. + - Indexed geometry rendered with D3DPT_QUADLIST is badly broken (Panzer and Robotech: Battlecry). More: - For completion's sake, we're going to have to use Direct3D 9 or OpenGL (OpenGL is better for @@ -21,10 +25,9 @@ More: - An option to disable sound processing. Quantum Redshift may need this... Game Specific: - - Add I/CDirectSoundBuffer_Pause and I/CDirectSoundBuffer_GetStatus for 4721 (Robotech Battlecry) - - The engine used by Taz: Wanted (4432) and Zapper (4831) are almost completely the same. There's - a missing XAPI function causing the crash, so fixing one will essentially fix the other. - - Unreal Championship requires XACT emulation. - Azurik: Rize of Perathia (possibly the hardest Xbox game to emulate) has some unusual situations going on (heap corruption, empty shaders, etc.). We need better solutions for such scenarios. - DOA3 is getting close... + - Fusion Frenzy: There are some bugs in the D3DFMT_P8 -> D3DFMT_A8R8G8B8 conversion code. + - Keep working on Run Like Hell, you might be surprised! + - Find out what's causing the stack corruption with Petit Copter. \ No newline at end of file diff --git a/resource/Cxbx.aps b/resource/Cxbx.aps new file mode 100644 index 000000000..148c2461c Binary files /dev/null and b/resource/Cxbx.aps differ diff --git a/resource/Cxbx.rc b/resource/Cxbx.rc index c829aaab8..73e088939 100644 --- a/resource/Cxbx.rc +++ b/resource/Cxbx.rc @@ -1,4 +1,4 @@ -//Microsoft Developer Studio generated resource script. +// Microsoft Visual C++ generated resource script. // #include "..\src\Cxbx\ResCxbx.h" @@ -32,7 +32,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_CXBX ICON DISCARDABLE "Cxbx.ico" +IDI_CXBX ICON "Cxbx.ico" #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// @@ -40,18 +40,18 @@ IDI_CXBX ICON DISCARDABLE "Cxbx.ico" // TEXTINCLUDE // -1 TEXTINCLUDE DISCARDABLE +1 TEXTINCLUDE BEGIN "..\\src\\Cxbx\\ResCxbx.h\0" END -2 TEXTINCLUDE DISCARDABLE +2 TEXTINCLUDE BEGIN "#include ""WinResrc.h""\r\n" "\0" END -3 TEXTINCLUDE DISCARDABLE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -65,14 +65,14 @@ END // Bitmap // -IDB_LOGO BITMAP DISCARDABLE "Logo.bmp" +IDB_LOGO BITMAP "Logo.bmp" ///////////////////////////////////////////////////////////////////////////// // // Menu // -IDR_MAINMENU MENU DISCARDABLE +IDR_MAINMENU MENU BEGIN POPUP "&File" BEGIN @@ -83,8 +83,7 @@ BEGIN MENUITEM "&Export Exe...", ID_FILE_EXPORTTOEXE, GRAYED MENUITEM SEPARATOR MENUITEM "&Save Xbe", ID_FILE_SAVEXBEFILE, GRAYED - MENUITEM "Save Xbe &As...", ID_FILE_SAVEXBEFILEAS - , GRAYED + MENUITEM "Save Xbe &As...", ID_FILE_SAVEXBEFILEAS, GRAYED MENUITEM SEPARATOR POPUP "&Recent Xbe Files" BEGIN @@ -120,9 +119,7 @@ BEGIN POPUP "Logo &Bitmap", GRAYED BEGIN MENUITEM "&Import...", ID_EDIT_LOGOBITMAP_IMPORT - MENUITEM "&Export...", ID_EDIT_LOGOBITMAP_EXPORT - END POPUP "&Patch", GRAYED BEGIN @@ -133,9 +130,7 @@ BEGIN POPUP "Dump &Xbe Info To..." BEGIN MENUITEM "&File...", ID_EDIT_DUMPXBEINFOTO_FILE - MENUITEM "&Debug Console", ID_EDIT_DUMPXBEINFOTO_DEBUGCONSOLE - END END POPUP "&View" @@ -143,24 +138,18 @@ BEGIN POPUP "&Debug Output (GUI)" BEGIN MENUITEM "&Console", ID_EMULATION_DEBUGOUTPUTGUI_CONSOLE - MENUITEM "&File...", ID_EMULATION_DEBUGOUTPUTGUI_FILE - END POPUP "Debug Output (&Kernel)" BEGIN MENUITEM "&Console", ID_EMULATION_DEBUGOUTPUTKERNEL_CONSOLE - MENUITEM "&File...", ID_EMULATION_DEBUGOUTPUTKERNEL_FILE - END END POPUP "&Settings" BEGIN MENUITEM "Config &Controller...", ID_SETTINGS_CONFIG_CONTROLLER - - MENUITEM "Config &Audio...", ID_SETTINGS_CONFIGURESOUND - , GRAYED + MENUITEM "Config &Audio...", ID_SETTINGS_CONFIGURESOUND, GRAYED MENUITEM "Config &Video...", ID_SETTINGS_CONFIG_VIDEO MENUITEM SEPARATOR POPUP "Executable &Generation" @@ -190,7 +179,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE +GUIDELINES DESIGNINFO BEGIN IDD_CONTROLLER_CFG, DIALOG BEGIN @@ -203,9 +192,10 @@ BEGIN IDD_VIDEO_CFG, DIALOG BEGIN LEFTMARGIN, 4 - RIGHTMARGIN, 255 + RIGHTMARGIN, 256 TOPMARGIN, 6 - BOTTOMMARGIN, 108 + BOTTOMMARGIN, 119 + HORZGUIDE, 116 END END #endif // APSTUDIO_INVOKED @@ -217,9 +207,9 @@ END // IDD_CONTROLLER_CFG DIALOGEX 0, 0, 343, 137 -STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Cxbx : Controller Configuration" -FONT 8, "Verdana" +FONT 8, "Verdana", 0, 0, 0x1 BEGIN PUSHBUTTON "X",IDC_SET_X,7,11,50,14,BS_FLAT PUSHBUTTON "Y",IDC_SET_Y,60,11,50,14,BS_FLAT @@ -251,35 +241,28 @@ BEGIN GROUPBOX "Digital Buttons",IDC_STATIC,2,51,220,46 GROUPBOX "Analog Thumbstick (Left)",IDC_STATIC,226,1,113,47 GROUPBOX "Analog Thumbstick (Right)",IDC_STATIC,227,51,112,46 - CTEXT "Please choose one of the controller components from above...", - IDC_CONFIG_STATUS,2,121,336,12,SS_CENTERIMAGE, - WS_EX_STATICEDGE - PUSHBUTTON "Click to configure all input...",IDC_CONFIGURE_ALL,6, - 102,210,14,BS_FLAT + CTEXT "Please choose one of the controller components from above...",IDC_CONFIG_STATUS,2,121,336,12,SS_CENTERIMAGE,WS_EX_STATICEDGE + PUSHBUTTON "Click to configure all input...",IDC_CONFIGURE_ALL,6,102,210,14,BS_FLAT END -IDD_VIDEO_CFG DIALOGEX 0, 0, 258, 110 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_VIDEO_CFG DIALOGEX 0, 0, 259, 121 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Cxbx : Video Configuration" FONT 8, "Verdana", 0, 0, 0x1 BEGIN - COMBOBOX IDC_VC_DISPLAY_ADAPTER,76,12,173,100,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_VC_D3D_DEVICE,76,31,173,100,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_VC_VIDEO_RESOLUTION,76,49,173,100,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - CONTROL "Use Hardware Video Mode",IDC_CV_FULLSCREEN,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,76,71,98,10 - CONTROL "Force VSync",IDC_CV_VSYNC,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,182,71,65,10 - PUSHBUTTON "Cancel",IDC_VC_CANCEL,146,92,50,14,BS_FLAT - PUSHBUTTON "Accept",IDC_VC_ACCEPT,203,92,50,14,BS_FLAT - GROUPBOX "Direct3D Configuration",IDC_STATIC,4,1,250,87,BS_CENTER + COMBOBOX IDC_VC_DISPLAY_ADAPTER,76,12,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_VC_D3D_DEVICE,76,31,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_VC_VIDEO_RESOLUTION,76,49,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Use Hardware Video Mode",IDC_CV_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,71,98,10 + CONTROL "Force VSync",IDC_CV_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,182,71,65,10 + PUSHBUTTON "Cancel",IDC_VC_CANCEL,146,102,50,14,BS_FLAT + PUSHBUTTON "Accept",IDC_VC_ACCEPT,206,102,50,14,BS_FLAT + GROUPBOX "Direct3D Configuration",IDC_STATIC,4,1,250,98,BS_CENTER LTEXT "Display Adapter:",IDC_STATIC,13,14,57,8,0,WS_EX_RIGHT LTEXT "Direct3D Device:",IDC_STATIC,13,33,57,8,0,WS_EX_RIGHT LTEXT "Video Resolution:",IDC_STATIC,12,52,58,8,0,WS_EX_RIGHT LTEXT "Other Options:",IDC_STATIC,21,71,49,8,0,WS_EX_RIGHT + CONTROL "Enable Hardware YUV Overlays",IDC_CV_HARDWAREYUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,84,123,11 END @@ -288,8 +271,8 @@ END // JPEG // -IDR_JPEG_ABOUT JPEG DISCARDABLE "About.jpg" -IDR_JPEG_SPLASH JPEG DISCARDABLE "Splash.jpg" +IDR_JPEG_ABOUT JPEG "About.jpg" +IDR_JPEG_SPLASH JPEG "Splash.jpg" #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/resource/Thumbs.db b/resource/Thumbs.db deleted file mode 100644 index 51e45e7eb..000000000 Binary files a/resource/Thumbs.db and /dev/null differ diff --git a/src/Common/Win32/XBVideo.cpp b/src/Common/Win32/XBVideo.cpp index 1091c54bb..4e1421642 100644 --- a/src/Common/Win32/XBVideo.cpp +++ b/src/Common/Win32/XBVideo.cpp @@ -38,7 +38,7 @@ // ****************************************************************** // * func: XBVideo::XBVideo // ****************************************************************** -XBVideo::XBVideo() : m_bVSync(false), m_bFullscreen(false) +XBVideo::XBVideo() : m_bVSync(false), m_bFullscreen(false), m_bHardwareYUV(false) { strcpy(m_szVideoResolution, "Automatic (Default)"); } @@ -81,6 +81,9 @@ void XBVideo::Load(const char *szRegistryKey) dwType = REG_DWORD; dwSize = sizeof(DWORD); RegQueryValueEx(hKey, "VSync", NULL, &dwType, (PBYTE)&m_bVSync, &dwSize); + dwType = REG_DWORD; dwSize = sizeof(DWORD); + RegQueryValueEx(hKey, "HardwareYUV", NULL, &dwType, (PBYTE)&m_bHardwareYUV, &dwSize); + RegCloseKey(hKey); } } @@ -117,6 +120,9 @@ void XBVideo::Save(const char *szRegistryKey) dwType = REG_DWORD; dwSize = sizeof(DWORD); RegSetValueEx(hKey, "VSync", 0, dwType, (PBYTE)&m_bVSync, dwSize); + dwType = REG_DWORD; dwSize = sizeof(DWORD); + RegSetValueEx(hKey, "HardwareYUV", 0, dwType, (PBYTE)&m_bHardwareYUV, dwSize); + RegCloseKey(hKey); } } diff --git a/src/Common/Win32/XBVideo.h b/src/Common/Win32/XBVideo.h index 56bd8c876..853fd9be3 100644 --- a/src/Common/Win32/XBVideo.h +++ b/src/Common/Win32/XBVideo.h @@ -86,6 +86,12 @@ class XBVideo : public Error void SetVSync(BOOL bVSync) { m_bVSync = bVSync; } BOOL GetVSync() { return m_bVSync; } + // ****************************************************************** + // * Hardware YUV Toggling + // ****************************************************************** + void SetHardwareYUV(BOOL bHardwareYUV) { m_bHardwareYUV = bHardwareYUV; } + BOOL GetHardwareYUV() { return m_bHardwareYUV; } + private: // ****************************************************************** // * Configuration @@ -95,6 +101,7 @@ class XBVideo : public Error DWORD m_dwDirect3DDevice; BOOL m_bFullscreen; BOOL m_bVSync; + BOOL m_bHardwareYUV; }; #endif diff --git a/src/Cxbx.h b/src/Cxbx.h index 7c9628430..3e662a128 100644 --- a/src/Cxbx.h +++ b/src/Cxbx.h @@ -60,6 +60,8 @@ typedef signed long sint32; #define _DEBUG_TRACK_VB /*! define this to track vertex shaders */ #define _DEBUG_TRACK_VS +/*! define this to track pixel shaders */ +#define _DEBUG_TRACK_PS /*! define this to track push buffers */ #define _DEBUG_TRACK_PB /*! define this to track memory allocations */ @@ -72,6 +74,8 @@ typedef signed long sint32; #endif /*! define this to trace warnings */ #define _DEBUG_WARNINGS +/*! define this to trace vertex shader constants */ +#define _DEBUG_TRACK_VS_CONST /*! define this to dump textures that have been set */ //#define _DEBUG_DUMP_TEXTURE_SETTEXTURE "C:\\xbox\\_textures\\" @@ -80,9 +84,9 @@ typedef signed long sint32; /*! version string dependent on trace flag */ #ifndef _DEBUG_TRACE -#define _CXBX_VERSION "0.8.1-Beta" +#define _CXBX_VERSION "0.8.1-Pre2" #else -#define _CXBX_VERSION "0.8.1-Beta-Trace" +#define _CXBX_VERSION "0.8.1-Pre2-Trace" #endif /*! debug mode choices */ diff --git a/src/Cxbx/DlgVideoConfig.cpp b/src/Cxbx/DlgVideoConfig.cpp index 2c083476b..e8cdaf8e6 100644 --- a/src/Cxbx/DlgVideoConfig.cpp +++ b/src/Cxbx/DlgVideoConfig.cpp @@ -138,6 +138,8 @@ INT_PTR CALLBACK DlgVideoConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR SendMessage(GetDlgItem(hWndDlg, IDC_CV_FULLSCREEN), BM_SETCHECK, (WPARAM)g_XBVideo.GetFullscreen(), 0); SendMessage(GetDlgItem(hWndDlg, IDC_CV_VSYNC), BM_SETCHECK, (WPARAM)g_XBVideo.GetVSync(), 0); + + SendMessage(GetDlgItem(hWndDlg, IDC_CV_HARDWAREYUV), BM_SETCHECK, (WPARAM)g_XBVideo.GetHardwareYUV(), 0); } } break; @@ -190,7 +192,7 @@ INT_PTR CALLBACK DlgVideoConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR g_XBVideo.SetVideoResolution(szBuffer); } - /*! save fullscreen/vsync options */ + /*! save fullscreen/vsync/YUV options */ { LRESULT lRet = SendMessage(GetDlgItem(hWndDlg, IDC_CV_FULLSCREEN), BM_GETCHECK, 0, 0); @@ -199,6 +201,10 @@ INT_PTR CALLBACK DlgVideoConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR lRet = SendMessage(GetDlgItem(hWndDlg, IDC_CV_VSYNC), BM_GETCHECK, 0, 0); g_XBVideo.SetVSync(lRet == BST_CHECKED); + + lRet = SendMessage(GetDlgItem(hWndDlg, IDC_CV_HARDWAREYUV), BM_GETCHECK, 0, 0); + + g_XBVideo.SetHardwareYUV(lRet == BST_CHECKED); } /*! save video configuration */ diff --git a/src/Cxbx/ResCxbx.h b/src/Cxbx/ResCxbx.h index 8a5f612fd..83bf75a23 100644 --- a/src/Cxbx/ResCxbx.h +++ b/src/Cxbx/ResCxbx.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by C:\Aaron\Projects\Cxbx\Resource\Cxbx.rc +// Microsoft Visual C++ generated include file. +// Used by C:\Users\Brandon\Desktop\Cxbx\dstien\wip\resource\Cxbx.rc // #define IDI_CXBX 101 #define IDB_SPLASH 102 @@ -48,6 +48,7 @@ #define IDC_VC_CANCEL 1041 #define IDC_CV_VSYNC 1042 #define IDC_VC_VIDEO_RESOLUTION 1047 +#define IDC_CV_HARDWAREYUV 1050 #define ID_FILE_EXIT 40005 #define ID_HELP_ABOUT 40008 #define ID_EMULATION_START 40009 @@ -97,12 +98,12 @@ #define ID_EMULATION_STOP 40082 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 119 #define _APS_NEXT_COMMAND_VALUE 40083 -#define _APS_NEXT_CONTROL_VALUE 1050 +#define _APS_NEXT_CONTROL_VALUE 1051 #define _APS_NEXT_SYMED_VALUE 104 #endif #endif diff --git a/src/CxbxKrnl/Emu.cpp b/src/CxbxKrnl/Emu.cpp index 854ff8a82..42a257d4a 100644 --- a/src/CxbxKrnl/Emu.cpp +++ b/src/CxbxKrnl/Emu.cpp @@ -78,6 +78,9 @@ volatile bool g_bPrintfOn = true; // global exception patching address uint32 g_HaloHack[4] = {0}; +// Dead to Rights hack +uint32 g_DeadToRightsHack[2] = {0}; + // Static Function(s) static int ExitException(LPEXCEPTION_POINTERS e); @@ -155,9 +158,19 @@ extern int EmuException(LPEXCEPTION_POINTERS e) if(e->ExceptionRecord->ExceptionCode == 0xC0000005) { // Halo Access Adjust 1 - if(e->ContextRecord->Eip == 0x0003394C) + if(e->ContextRecord->Eip == 0x0003394C || e->ContextRecord->Eip == 0x0003387C) { - if(e->ContextRecord->Ecx == 0x803BD800) + // blueshogun96 4/10/2010 + // Quite frankly, I don't know how Caustik came up with this hack. + // A similar situation comes up prior to going ingame almost immediately + // after the menus. The hack wasn't applied because the register values + // were different, but the situation looks the same. Also, I don't know + // where the 0x803A6000 came from in the first hack. Is this accomodating + // for size?? Or does this need to stay constant. More information is + // welcome! + + if(e->ContextRecord->Ecx == 0x803BD800 || e->ContextRecord->Ecx == 0x803E853C || + e->ContextRecord->Ecx == 0x813B5018) { // Halo BINK skip { @@ -294,32 +307,19 @@ extern int EmuException(LPEXCEPTION_POINTERS e) return EXCEPTION_CONTINUE_EXECUTION; } + + if(e->ContextRecord->Eip == 0x1197F4) + { + e->ContextRecord->Eip += 2; + + DbgPrintf("EmuMain (0x%X): House of the Dead hack 2 applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } } - // Unreal Championship *NTSC* - //if(e->ExceptionRecord->ExceptionCode == 0xC0000005) - //{ - // // Unknown NVIDIA Soundstorm APU register - // // mov eax, ds:0xFE80200C - // if(e->ContextRecord->Eip == 0x2C8E78 ) - // { - // // Set EAX to zero - // //e->ContextRecord->Eax = 0; - // // Skip this instruction - // e->ContextRecord->Eip += 5; - // *((DWORD*) 0x2C8E79) = 0x00; - // *((DWORD*) 0x2C8E7A) = 0x00; - // *((DWORD*) 0x2C8E7B) = 0x00; - // *((DWORD*) 0x2C8E7C) = 0x00; - - // DbgPrintf("EmuMain (0x%X): Unreal Championship hack 1 applied!\n", GetCurrentThreadId()); - - // g_bEmuException = false; - - // return EXCEPTION_CONTINUE_EXECUTION; - // } - //} - // Zapper *NTSC* if(e->ExceptionRecord->ExceptionCode == 0xC0000096) { @@ -342,7 +342,7 @@ extern int EmuException(LPEXCEPTION_POINTERS e) { if(e->ContextRecord->Eip == 0x4ED70) { - // Zapper WBINVD skip + // WBINVD skip e->ContextRecord->Eip += 2; DbgPrintf("EmuMain (0x%X): Fusion Frenzy hack 1 was applied!\n", GetCurrentThreadId()); @@ -382,6 +382,19 @@ extern int EmuException(LPEXCEPTION_POINTERS e) g_bEmuException = false; + return EXCEPTION_CONTINUE_EXECUTION; + } + + if(e->ContextRecord->Eip == 0xB2EFB || e->ContextRecord->Eip == (0xB2EFB + 3) || + e->ContextRecord->Eip == (0xB2EFB + 6) || e->ContextRecord->Eip == (0xB2EFB + 9)) + { + // mov [eax-0xX], edi + e->ContextRecord->Eip += 3; + + DbgPrintf("EmuMain (0x%X): Phantom Crash hack 2 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + return EXCEPTION_CONTINUE_EXECUTION; } } @@ -401,6 +414,254 @@ extern int EmuException(LPEXCEPTION_POINTERS e) return EXCEPTION_CONTINUE_EXECUTION; } } + else if(e->ExceptionRecord->ExceptionCode == 0x80000003) + { + if(e->ContextRecord->Eip == 0xDF138) + { + // int 3 + e->ContextRecord->Eip++; + + DbgPrintf("EmuMain (0x%X): Blood Rayne hack 2 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + + // JetSetRadio Future *NTSC* + if(e->ExceptionRecord->ExceptionCode == 0xC0000005) + { + if(e->ContextRecord->Eip == 0x48226) + { + // mov edx, [eax] + e->ContextRecord->Eip += 2; + + DbgPrintf("EmuMain (0x%X): JetSetRadio Future hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + + if(e->ContextRecord->Eip == 0x48233) + { + // call dword ptr [edx+0x10] + e->ContextRecord->Eip += 3; + + DbgPrintf("EmuMain (0x%X): JetSetRadio Future hack 2 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + if(e->ContextRecord->Eip == 0x47448) + { + // mov edx, [ecx] + // push ecx + // call dword ptr [edx+0x0C] + e->ContextRecord->Eip += 6; + + DbgPrintf("EmuMain (0x%X): JetSetRadio Future hack 3 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + + //if(e->ContextRecord->Eip == 0x48233) + //{ + // // call dword ptr [edx+0x10] + // e->ContextRecord->Eip += 3; + + // DbgPrintf("EmuMain (0x%X): JetSetRadio Future hack 2 was applied!\n", GetCurrentThreadId()); + + // g_bEmuException = false; + + // return EXCEPTION_CONTINUE_EXECUTION; + // } + } + + // Unreal Championship *NTSC* + if(e->ExceptionRecord->ExceptionCode == 0xC0000096) + { + if(e->ContextRecord->Eip == 0x4DD40) + { + // WBINVD skip + e->ContextRecord->Eip += 2; + + DbgPrintf("EmuMain (0x%X): Unreal Championship Hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + else if(e->ExceptionRecord->ExceptionCode == 0xC0000005) + { + if(e->ContextRecord->Eip == 0x6E94B) + { + // mov ecx, [eax+4] + e->ContextRecord->Eip += 3; + + DbgPrintf("EmuMain (0x%X): Unreal Championship Hack 2 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + if(e->ContextRecord->Eip == 0x6E954) + { + // mov [eax+4], ecx + e->ContextRecord->Eip += 3; + + DbgPrintf("EmuMain (0x%X): Unreal Championship Hack 3 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + + // Frogger Beyond *NTSC* + if(e->ExceptionRecord->ExceptionCode == 0xC0000005) + { + if(e->ContextRecord->Eip == 0x19F9D0) + { + // + e->ContextRecord->Eip += 3; + + DbgPrintf("EmuMain (0x%X): Frogger Beyond Hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + + // Rayman Arena *NTSC* + if(e->ExceptionRecord->ExceptionCode == 0xC0000005) + { + if(e->ContextRecord->Eip == 0x18B40C) + { + // call dword ptr [ecx+4] + e->ContextRecord->Eip += 3; + + DbgPrintf("EmuMain (0x%X): Rayman Arena Hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + + // Dead to Rights (Region shouldn't matter) + /*if(e->ExceptionRecord->ExceptionCode == 0xC0000005) + { + if(g_DeadToRightsHack[0]) + { + DbgPrintf("EmuMain (0x%X): Dead to Rights Hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + }*/ + + /* Metal Gear Solid II (NTSC) */ + if(e->ExceptionRecord->ExceptionCode == 0xC0000096) + { + if(e->ContextRecord->Eip == 0x4E2A0D) + { + // WBINVD skip + e->ContextRecord->Eip += 2; + + DbgPrintf("EmuMain (0x%X): Metal Gear Solid II Hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + + // Soul Calibur II + if(e->ExceptionRecord->ExceptionCode == 0xC0000096) + { + if(e->ContextRecord->Eip == 0x25452) + { + // WBINVD skip + e->ContextRecord->Eip += 2; + + DbgPrintf("EmuMain (0x%X): Soul Calibur II Hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + + /* Munch Trial(NTSC)*/ + if(e->ExceptionRecord->ExceptionCode == 0xC0000005) + { + if(e->ContextRecord->Eip == 0x254D96) + { + // rep movsd + e->ContextRecord->Eip += 2; + + DbgPrintf("EmuMain (0x%X): Munch Trial hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + + if(e->ExceptionRecord->ExceptionCode == 0xC0000005) + { + if(e->ContextRecord->Eip == 0x346B4) + { + // cmp dword ptr [eax+0x208], 0 + e->ContextRecord->Eip += 7; + + DbgPrintf("EmuMain (0x%X): Xbox Dashboard (3944) hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + + // Splinter Cell + if(e->ExceptionRecord->ExceptionCode == 0xC0000005) + { + if(e->ContextRecord->Eip == 0x1421A) + { + // mov ecx, [eax+4] + e->ContextRecord->Eip += 3; + + DbgPrintf("EmuMain (0x%X): Splinter Cell hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } + + // Metal Slug 3 + if(e->ExceptionRecord->ExceptionCode == 0xC0000005) + { + if(e->ContextRecord->Eip == 0x1B59BC) + { + // mov [ecx+0x28], eax + e->ContextRecord->Eip += 3; + + DbgPrintf("EmuMain (0x%X): Metal Slug 3 hack 1 was applied!\n", GetCurrentThreadId()); + + g_bEmuException = false; + + return EXCEPTION_CONTINUE_EXECUTION; + } + } // print debug information { diff --git a/src/CxbxKrnl/Emu.h b/src/CxbxKrnl/Emu.h index 4e7d6d353..cb9383fa9 100644 --- a/src/CxbxKrnl/Emu.h +++ b/src/CxbxKrnl/Emu.h @@ -65,6 +65,9 @@ extern volatile bool g_bEmuSuspended; // global exception patching address extern uint32 g_HaloHack[4]; +// Dead to Rights hack +extern uint32 g_DeadToRightsHack[2]; + // global exception patching address extern uint32 funcExclude[2048]; @@ -80,7 +83,8 @@ extern CHAR *g_strZDrive; extern HWND g_hEmuWindow; // thread notification routine -extern PVOID g_pfnThreadNotification; +extern PVOID g_pfnThreadNotification[16]; +extern int g_iThreadNotificationCount; // NOTE: this is an arbitrary latency #define XINPUT_SETSTATE_LATENCY 4 diff --git a/src/CxbxKrnl/EmuD3D8.cpp b/src/CxbxKrnl/EmuD3D8.cpp index db291aa3b..5ee328be0 100644 --- a/src/CxbxKrnl/EmuD3D8.cpp +++ b/src/CxbxKrnl/EmuD3D8.cpp @@ -37,7 +37,7 @@ // Disable overlay updates for Unreal Championship... // TODO: Find out why a crash occurs playing the second // intro video. -#define UnrealChampionshipHack +//#define UnrealChampionshipHack // prevent name collisions namespace xboxkrnl @@ -68,6 +68,7 @@ XTL::LPDIRECTDRAWCLIPPER g_pDDClipper = NULL; // DirectDraw7 Clippe DWORD g_CurrentVertexShader = 0; BOOL g_bFakePixelShaderLoaded = FALSE; BOOL g_bIsFauxFullscreen = FALSE; +BOOL g_bHackUpdateSoftwareOverlay = FALSE; // Static Function(s) static BOOL WINAPI EmuEnumDisplayDevices(GUID FAR *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, LPVOID lpContext, HMONITOR hm); @@ -94,10 +95,14 @@ static HBRUSH g_hBgBrush = NULL; // Background Brush static volatile bool g_bRenderWindowActive = false; static XBVideo g_XBVideo; static XTL::D3DVBLANKCALLBACK g_pVBCallback = NULL; // Vertical-Blank callback routine +static XTL::D3DSWAPCALLBACK g_pSwapCallback = NULL; // Swap/Present callback routine // wireframe toggle static int g_iWireframe = 0; +// build version +extern uint32 g_BuildVersion; + // resource caching for _Register static XTL::X_D3DResource pCache[16] = {0}; @@ -113,6 +118,10 @@ static XTL::IDirect3DVertexBuffer8 *g_pDummyBuffer = NULL; // Dummy buffer, use static XTL::D3DVBLANKDATA g_VBData = {0}; static DWORD g_VBLastSwap = 0; +// current swap information +static XTL::D3DSWAPDATA g_SwapData = {0}; +static DWORD g_SwapLast = 0; + // cached Direct3D state variable(s) static XTL::X_D3DSurface *g_pCachedRenderTarget = NULL; static XTL::X_D3DSurface *g_pCachedZStencilSurface = NULL; @@ -123,6 +132,8 @@ static DWORD g_VertexShaderSlots[136]; // cached palette pointer static PVOID pCurrentPalette; +// cached palette size +static DWORD dwCurrentPaletteSize = -1; static XTL::X_VERTEXSHADERCONSTANTMODE g_VertexShaderConstantMode = X_VSCM_192; @@ -659,6 +670,9 @@ static DWORD WINAPI EmuUpdateTickCount(LPVOID) { g_VBData.VBlank++; + // TODO: Fixme. This may not be right... + g_SwapData.SwapVBlank = 1; + if(g_pVBCallback != NULL) { EmuSwapFS(); // Xbox FS @@ -667,6 +681,14 @@ static DWORD WINAPI EmuUpdateTickCount(LPVOID) } g_VBData.Swap = 0; + + // TODO: This can't be accurate... + g_SwapData.TimeUntilSwapVBlank = 0; + + // TODO: Recalculate this for PAL version if necessary. + // Also, we should check the D3DPRESENT_INTERVAL value for accurracy. + // g_SwapData.TimeBetweenSwapVBlanks = 1/60; + g_SwapData.TimeBetweenSwapVBlanks = 0; } } @@ -731,6 +753,14 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID) g_EmuCDPD.pPresentationParameters->FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; } + // HACK: Disable Tripple Buffering for now... + // TODO: Enumerate maximum BackBufferCount if possible. + if(g_EmuCDPD.pPresentationParameters->BackBufferCount > 1) + { + EmuWarning("Limiting BackBufferCount to 1..."); + g_EmuCDPD.pPresentationParameters->BackBufferCount = 1; + } + // TODO: Support Xbox extensions if possible if(g_EmuCDPD.pPresentationParameters->MultiSampleType != 0) { @@ -867,9 +897,19 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID) } CxbxFree(lpCodes); - + if(!g_bSupportsYUY2) EmuWarning("YUY2 overlays are not supported in hardware, could be slow!"); + + // Does the user want to use Hardware accelerated YUV surfaces? + if(g_bSupportsYUY2 && g_XBVideo.GetHardwareYUV()) + DbgPrintf("EmuD3D8 (0x%X): Hardware accelerated YUV surfaces Enabled...\n", GetCurrentThreadId()); + + if(!g_XBVideo.GetHardwareYUV()) + { + g_bSupportsYUY2 = false; + DbgPrintf("EmuD3D8 (0x%X): Hardware accelerated YUV surfaces Disabled...\n", GetCurrentThreadId()); + } } // initialize primary surface @@ -917,7 +957,7 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID) g_pD3DDevice8->BeginScene(); // initially, show a black screen - g_pD3DDevice8->Clear(0, 0, D3DCLEAR_TARGET, 0xFF000000, 0, 0); + g_pD3DDevice8->Clear(0, 0, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0xFF000000, 1.0f, 0); g_pD3DDevice8->Present(0, 0, 0, 0); // signal completion @@ -1071,6 +1111,20 @@ HRESULT WINAPI XTL::EmuIDirect3D8_CreateDevice GetCurrentThreadId(), Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface); + // Print a few of the pPresentationParameters contents to the console + DbgPrintf("BackBufferWidth: = %d\n" + "BackBufferHeight: = %d\n" + "BackBufferFormat: = 0x%.08X\n" + "BackBufferCount: = 0x%.08X\n" + "SwapEffect: = 0x%.08X\n" + "EnableAutoDepthStencil: = 0x%.08X\n" + "AutoDepthStencilFormat: = 0x%.08X\n" + "Flags: = 0x%.08X\n\n", + pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight, + pPresentationParameters->BackBufferFormat, pPresentationParameters->BackBufferCount, + pPresentationParameters->SwapEffect, pPresentationParameters->EnableAutoDepthStencil, + pPresentationParameters->AutoDepthStencilFormat, pPresentationParameters->Flags ); + // Cache parameters g_EmuCDPD.Adapter = Adapter; g_EmuCDPD.DeviceType = DeviceType; @@ -1191,8 +1245,13 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetDisplayFieldStatus(X_D3DFIELD_STATUS *pF ");\n", GetCurrentThreadId(), pFieldStatus); +#if 1 pFieldStatus->Field = (g_VBData.VBlank%2 == 0) ? X_D3DFIELD_ODD : X_D3DFIELD_EVEN; pFieldStatus->VBlankCount = g_VBData.VBlank; +#else + pFieldStatus->Field = X_D3DFIELD_PROGRESSIVE; + pFieldStatus->VBlankCount = 0; +#endif EmuSwapFS(); // XBox FS @@ -2364,7 +2423,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateVertexShader LPD3DXBUFFER pRecompiledBuffer = NULL; DWORD *pRecompiledDeclaration; DWORD *pRecompiledFunction = NULL; - DWORD VertexShaderSize; + DWORD VertexShaderSize = 0; DWORD DeclarationSize; DWORD Handle = 0; @@ -2543,7 +2602,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexShaderConstant ");\n", GetCurrentThreadId(), Register, pConstantData, ConstantCount); -#ifdef _DEBUG_TRACK_VS_CONST +/*#ifdef _DEBUG_TRACK_VS_CONST for (uint32 i = 0; i < ConstantCount; i++) { printf("SetVertexShaderConstant, c%d (c%d) = { %f, %f, %f, %f }\n", @@ -2553,7 +2612,14 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexShaderConstant *((float*)pConstantData + 4 * i + 2), *((float*)pConstantData + 4 * i + 3)); } -#endif // _DEBUG_TRACK_VS_CONST +#endif*/ // _DEBUG_TRACK_VS_CONST + + // TODO: HACK: Since Xbox vertex shader constants range from -96 to 96, during conversion + // some shaders need to add 96 to use ranges 0 to 192. This fixes 3911 - 4361 games and XDK + // samples, but breaks Turok. + + if(g_BuildVersion <= 4361) + Register += 96; HRESULT hRet = g_pD3DDevice8->SetVertexShaderConstant ( @@ -2695,18 +2761,27 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DeletePixelShader // ****************************************************************** HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreatePixelShader ( - CONST DWORD *pFunction, - DWORD *pHandle + X_D3DPIXELSHADERDEF *pPSDef, + DWORD *pHandle ) { EmuSwapFS(); // Win2k/XP FS DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CreatePixelShader\n" "(\n" - " pFunction : 0x%.08X\n" + " pPSDef : 0x%.08X\n" " pHandle : 0x%.08X\n" ");\n", - GetCurrentThreadId(), pFunction, pHandle); + GetCurrentThreadId(), pPSDef, pHandle); + + DWORD* pFunction = NULL; + +#if 1 + pFunction = (DWORD*) pPSDef; +#endif + + // Attempt to recompile PixelShader + EmuRecompilePshDef( pPSDef, NULL ); // redirect to windows d3d HRESULT hRet = g_pD3DDevice8->CreatePixelShader @@ -2913,6 +2988,29 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateTexture if(Usage & (D3DUSAGE_RENDERTARGET)) PCPool = D3DPOOL_DEFAULT; + // HACK: Width and Height sometimes set to 0xFFFF and 0 in Crazy Taxi 3 + // When it fails, it returns a success anyway and D3DResource::Register + // sees it as a VertexBuffer instead of a Texture. + if( Width >= 0xFFFF || Height >= 0xFFFF ) + { + Width = 256; + Height = 256; + PCFormat = D3DFMT_A8R8G8B8; + + EmuWarning( "Overriding texture parameters:\n" + "Width: 0xFFFF -> 256\n" + "Height: 0xFFFF -> 256\n" + "Format: D3DFMT_A8R8G8B8" ); + } + + if( Width == 0 || Height == 0 ) + { + Width = Height = 256; + EmuWarning( "Overriding texture parameters:\n" + "Width: 0 -> 256\n" + "Height: 0 -> 256" ); + } + hRet = g_pD3DDevice8->CreateTexture ( Width, Height, Levels, @@ -3249,10 +3347,14 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetIndices HRESULT hRet = D3D_OK; + if(pIndexData != NULL) + DbgPrintf("EmuIDirect3DDevice8_SetIndcies(): pIndexData->EmuIndexBuffer8:= 0x%.08X\n", pIndexData->EmuIndexBuffer8 ); + + g_dwBaseVertexIndex = BaseVertexIndex; + if(pIndexData != 0) { g_pIndexBuffer = pIndexData; - g_dwBaseVertexIndex = BaseVertexIndex; // HACK: Halo Hack if(pIndexData->Lock == 0x00840863) @@ -3260,6 +3362,14 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetIndices EmuVerifyResourceIsRegistered(pIndexData); + // HACK: Unreal Championship + if((pIndexData->Lock & 0xFFFF0000) == 0x00490000 || (pIndexData->Lock & 0xF0000000) != 0x00000000 || + pIndexData->Lock == 0x10) + { + hRet = E_FAIL; + goto fail; + } + IDirect3DIndexBuffer8 *pIndexBuffer = pIndexData->EmuIndexBuffer8; if(pIndexData->Lock != X_D3DRESOURCE_LOCK_FLAG_NOSIZE) @@ -3272,6 +3382,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetIndices hRet = g_pD3DDevice8->SetIndices(0, BaseVertexIndex); } +fail: EmuSwapFS(); // XBox FS return hRet; @@ -3640,6 +3751,21 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData4f g_IVBFVF |= D3DFVF_XYZRHW; } + break; + + case 1: // D3DVSDE_BLENDWEIGHT + { + int o = g_IVBTblOffs; + + g_IVBTable[o].Position.x = a; + g_IVBTable[o].Position.y = b; + g_IVBTable[o].Position.z = c; + g_IVBTable[o].Blend1 = d; + + g_IVBTblOffs++; + + g_IVBFVF |= D3DFVF_XYZB1; + } break; case 2: // D3DVSDE_NORMAL @@ -3770,6 +3896,68 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData4f return hRet; } +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetVertexData4ub +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData4ub +( + INT Register, + BYTE a, + BYTE b, + BYTE c, + BYTE d +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexData4ub\n" + "(\n" + " Register : 0x%.08X\n" + " a : 0x%.02X\n" + " b : 0x%.02X\n" + " c : 0x%.02X\n" + " d : 0x%.02X\n" + ");\n", + GetCurrentThreadId(), Register, a, b, c, d); + + EmuSwapFS(); // Xbox FS + + DWORD dwA = a, dwB = b, dwC = c, dwD = d; + + return EmuIDirect3DDevice8_SetVertexData4f(Register, DWtoF(dwA), DWtoF(dwB), DWtoF(dwC), DWtoF(dwD)); +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetVertexData4s +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData4s +( + INT Register, + SHORT a, + SHORT b, + SHORT c, + SHORT d +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexData4s\n" + "(\n" + " Register : 0x%.08X\n" + " a : 0x%.04X\n" + " b : 0x%.04X\n" + " c : 0x%.04X\n" + " d : 0x%.04X\n" + ");\n", + GetCurrentThreadId(), Register, a, b, c, d); + + EmuSwapFS(); // Xbox FS + + DWORD dwA = a, dwB = b, dwC = c, dwD = d; + + return EmuIDirect3DDevice8_SetVertexData4f(Register, DWtoF(dwA), DWtoF(dwB), DWtoF(dwC), DWtoF(dwD)); +} + // ****************************************************************** // * func: EmuIDirect3DDevice8_SetVertexDataColor // ****************************************************************** @@ -3940,7 +4128,24 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_Present if(g_VBData.VBlank == g_VBLastSwap + 1) g_VBData.Flags = 1; // D3DVBLANK_SWAPDONE else + { g_VBData.Flags = 2; // D3DVBLANK_SWAPMISSED + g_SwapData.MissedVBlanks++; + } + + // Handle Swap Callback function + { + g_SwapData.Swap++; + + if(g_pSwapCallback != NULL) + { + EmuSwapFS(); // Xbox FS + g_pSwapCallback(&g_SwapData); + EmuSwapFS(); // Win2k/XP FS + } + } + + g_bHackUpdateSoftwareOverlay = FALSE; EmuSwapFS(); // XBox FS @@ -3978,6 +4183,20 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_Swap HRESULT hRet = g_pD3DDevice8->Present(0, 0, 0, 0); + // Handle Swap Callback function + { + g_SwapData.Swap++; + + if(g_pSwapCallback != NULL) + { + EmuSwapFS(); // Xbox FS + g_pSwapCallback(&g_SwapData); + EmuSwapFS(); // Win2k/XP FS + } + } + + g_bHackUpdateSoftwareOverlay = FALSE; + EmuSwapFS(); // XBox FS return hRet; @@ -4028,6 +4247,8 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register // TODO: once this is known to be working, remove the warning EmuWarning("Vertex buffer allocation size unknown"); dwSize = 0x2000; // temporarily assign a small buffer, which will be increased later + /*hRet = E_FAIL; + goto fail;*/ } hRet = g_pD3DDevice8->CreateVertexBuffer @@ -4462,14 +4683,19 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register // // create texture resource // + + // Attempt to use correct palette sizes + DWORD dwPaletteAllocSize = (dwCurrentPaletteSize == -1) ? 256*4 : dwCurrentPaletteSize; + BYTE *pPixelData = (BYTE*)LockedRect.pBits; DWORD dwDataSize = dwMipWidth*dwMipHeight*4; - DWORD dwPaletteSize = 256*4; // Note: This is not allways true, it can be 256- 128- 64- or 32*4 + DWORD dwPaletteSize = dwPaletteAllocSize; //256*4; // Note: This is not allways true, it can be 256- 128- 64- or 32*4 BYTE* pTextureCache = (BYTE*)CxbxMalloc(dwDataSize); BYTE* pExpandedTexture = (BYTE*)CxbxMalloc(dwDataSize); - BYTE* pTexturePalette = (BYTE*)CxbxMalloc(256*4); - + BYTE* pTexturePalette = (BYTE*)CxbxMalloc(dwPaletteAllocSize); + + //__asm int 3; // First we need to unswizzle the texture data XTL::EmuXGUnswizzleRect ( @@ -4477,12 +4703,15 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register LockedRect.Pitch, iRect, iPoint, dwBPP ); + //__asm int 3; // Copy the unswizzled data to a temporary buffer memcpy(pTextureCache, pPixelData, dwDataSize); + //__asm int 3; // Copy the currently selected palette's data to the buffer memcpy(pTexturePalette, pCurrentPalette, dwPaletteSize); + //__asm int 3; unsigned int w = 0; unsigned int c = 0; unsigned char p = 0; @@ -4502,6 +4731,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register c++; } + //__asm int 3; // Copy the expanded texture back to the buffer memcpy(pPixelData, pExpandedTexture, dwDataSize); @@ -4633,6 +4863,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register } pCurrentPalette = pBase; + dwCurrentPaletteSize = dwSize; pResource->Data = (ULONG)pBase; } @@ -4943,6 +5174,11 @@ VOID WINAPI XTL::EmuGet2DSurfaceDesc // if( pPixelContainer->EmuTexture8 == ((IDirect3DTexture8*) 0x078A0044) ) hRet = pPixelContainer->EmuTexture8->GetLevelDesc(dwLevel, &SurfaceDesc); + //hRet = pPixelContainer->EmuSurface8->GetDesc(&SurfaceDesc); + if(FAILED(hRet)) + EmuWarning("IDirect3DTexture8::GetSurfaceDesc failed!"); + + DbgPrintf("Okay"); /* static int dwDumpTexture = 0; @@ -4956,6 +5192,7 @@ VOID WINAPI XTL::EmuGet2DSurfaceDesc } // rearrange into xbox format (remove D3DPOOL) + if(SUCCEEDED(hRet)) { // Convert Format (PC->Xbox) pDesc->Format = EmuPC2XB_D3DFormat(SurfaceDesc.Format); @@ -5240,6 +5477,8 @@ HRESULT WINAPI XTL::EmuIDirect3DTexture8_LockRect HRESULT hRet; + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DTexture8_LockRect (pThis->Texture = 0x%8.8X)\n", pThis->EmuTexture8); + EmuVerifyResourceIsRegistered(pThis); // check if we have an unregistered YUV2 resource @@ -5263,11 +5502,20 @@ HRESULT WINAPI XTL::EmuIDirect3DTexture8_LockRect CxbxKrnlCleanup("EmuIDirect3DTexture8_LockRect: Unknown Flags! (0x%.08X)", Flags); // Remove old lock(s) - pTexture8->UnlockRect(Level); + if(Level == 6 || Level == 7 || Level == 8 || Level == 9) + { + // HACK: Unreal Championship crashes when the texture level reaches 9... + EmuWarning("Unreal Championship texture hack applied!"); + hRet = D3DERR_INVALIDCALL; + } + else + { + pTexture8->UnlockRect(Level); - hRet = pTexture8->LockRect(Level, pLockedRect, pRect, NewFlags); + hRet = pTexture8->LockRect(Level, pLockedRect, pRect, NewFlags); - pThis->Common |= X_D3DCOMMON_ISLOCKED; + pThis->Common |= X_D3DCOMMON_ISLOCKED; + } } EmuSwapFS(); // XBox FS @@ -5492,7 +5740,7 @@ XTL::X_D3DVertexBuffer* WINAPI XTL::EmuIDirect3DDevice8_CreateVertexBuffer2 ); if(FAILED(hRet)) - EmuWarning("CreateVertexBuffer Failed!"); + CxbxKrnlCleanup("CreateVertexBuffer Failed!"); #ifdef _DEBUG_TRACK_VB g_VBTrackTotal.insert(pD3DVertexBuffer->EmuVertexBuffer8); @@ -5599,167 +5847,181 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_UpdateOverlay GetCurrentThreadId(), pSurface, SrcRect, DstRect, EnableColorKey, ColorKey); #ifndef UnrealChampionshipHack - // manually copy data over to overlay - if(g_bSupportsYUY2) - { - DDSURFACEDESC2 ddsd2; + if(pSurface) + { + // manually copy data over to overlay + if(g_bSupportsYUY2) + { + DDSURFACEDESC2 ddsd2; - ZeroMemory(&ddsd2, sizeof(ddsd2)); + ZeroMemory(&ddsd2, sizeof(ddsd2)); - ddsd2.dwSize = sizeof(ddsd2); + ddsd2.dwSize = sizeof(ddsd2); - if(FAILED(g_pDDSOverlay7->Lock(NULL, &ddsd2, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL))) - EmuWarning("Unable to lock overlay surface!"); + if(FAILED(g_pDDSOverlay7->Lock(NULL, &ddsd2, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL))) + EmuWarning("Unable to lock overlay surface!"); - // copy data - { - char *pDest = (char*)ddsd2.lpSurface; - char *pSour = (char*)pSurface->Lock; + // copy data + { + char *pDest = (char*)ddsd2.lpSurface; + char *pSour = (char*)pSurface->Lock; - int w = g_dwOverlayW; - int h = g_dwOverlayH; + int w = g_dwOverlayW; + int h = g_dwOverlayH; - // TODO: sucker the game into rendering directly to the overlay (speed boost) - if( (ddsd2.lPitch == w*2) && ((int)g_dwOverlayP == w*2) ) - memcpy(pDest, pSour, h*w*2); - else - { - for(int y=0;yUnlock(NULL); - } + g_pDDSOverlay7->Unlock(NULL); + } - // update overlay! - if(g_bSupportsYUY2) - { - RECT SourRect = {0, 0, g_dwOverlayW, g_dwOverlayH}, DestRect; - MONITORINFO MonitorInfo = {0}; + // update overlay! + if(g_bSupportsYUY2) + { + RECT SourRect = {0, 0, g_dwOverlayW, g_dwOverlayH}, DestRect; + MONITORINFO MonitorInfo = {0}; - int nTitleHeight = 0;//GetSystemMetrics(SM_CYCAPTION); - int nBorderWidth = 0;//GetSystemMetrics(SM_CXSIZEFRAME); - int nBorderHeight = 0;//GetSystemMetrics(SM_CYSIZEFRAME); + int nTitleHeight = 0;//GetSystemMetrics(SM_CYCAPTION); + int nBorderWidth = 0;//GetSystemMetrics(SM_CXSIZEFRAME); + int nBorderHeight = 0;//GetSystemMetrics(SM_CYSIZEFRAME); - MonitorInfo.cbSize = sizeof(MONITORINFO); - GetMonitorInfo(g_hMonitor, &MonitorInfo); + MonitorInfo.cbSize = sizeof(MONITORINFO); + GetMonitorInfo(g_hMonitor, &MonitorInfo); - GetWindowRect(g_hEmuWindow, &DestRect); + GetWindowRect(g_hEmuWindow, &DestRect); - DestRect.left += nBorderWidth; - DestRect.right -= nBorderWidth; - DestRect.top += nTitleHeight + nBorderHeight; - DestRect.bottom -= nBorderHeight; + DestRect.left += nBorderWidth; + DestRect.right -= nBorderWidth; + DestRect.top += nTitleHeight + nBorderHeight; + DestRect.bottom -= nBorderHeight; - DestRect.left -= MonitorInfo.rcMonitor.left; - DestRect.right -= MonitorInfo.rcMonitor.left; - DestRect.top -= MonitorInfo.rcMonitor.top; - DestRect.bottom -= MonitorInfo.rcMonitor.top; + DestRect.left -= MonitorInfo.rcMonitor.left; + DestRect.right -= MonitorInfo.rcMonitor.left; + DestRect.top -= MonitorInfo.rcMonitor.top; + DestRect.bottom -= MonitorInfo.rcMonitor.top; - DDOVERLAYFX ddofx; + DDOVERLAYFX ddofx; - ZeroMemory(&ddofx, sizeof(ddofx)); + ZeroMemory(&ddofx, sizeof(ddofx)); - ddofx.dwSize = sizeof(DDOVERLAYFX); - ddofx.dckDestColorkey.dwColorSpaceLowValue = 0; - ddofx.dckDestColorkey.dwColorSpaceHighValue = 0; + ddofx.dwSize = sizeof(DDOVERLAYFX); + ddofx.dckDestColorkey.dwColorSpaceLowValue = 0; + ddofx.dckDestColorkey.dwColorSpaceHighValue = 0; - HRESULT hRet = g_pDDSOverlay7->UpdateOverlay(&SourRect, g_pDDSPrimary, &DestRect, /*DDOVER_KEYDESTOVERRIDE | */DDOVER_SHOW, /*&ddofx*/0); - } - else - { - // TODO: dont assume X8R8G8B8 ? - D3DLOCKED_RECT LockedRectDest; + HRESULT hRet = g_pDDSOverlay7->UpdateOverlay(&SourRect, g_pDDSPrimary, &DestRect, /*DDOVER_KEYDESTOVERRIDE | */DDOVER_SHOW, /*&ddofx*/0); + } + else + { + // TODO: dont assume X8R8G8B8 ? + D3DLOCKED_RECT LockedRectDest; - IDirect3DSurface8 *pBackBuffer=0; + IDirect3DSurface8 *pBackBuffer=0; - HRESULT hRet = g_pD3DDevice8->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer); + HRESULT hRet = g_pD3DDevice8->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer); - // if we obtained the backbuffer, manually translate the YUY2 into the backbuffer format - if(hRet == D3D_OK && pBackBuffer->LockRect(&LockedRectDest, NULL, NULL) == D3D_OK) - { - uint08 *pCurByte = (uint08*)pSurface->Lock; + // if we obtained the backbuffer, manually translate the YUY2 into the backbuffer format + if(hRet == D3D_OK && pBackBuffer->LockRect(&LockedRectDest, NULL, NULL) == D3D_OK) + { + uint08 *pCurByte = (uint08*)pSurface->Lock; - uint08 *pDest = (uint08*)LockedRectDest.pBits; + uint08 *pDest = (uint08*)LockedRectDest.pBits; - uint32 dx=0, dy=0; + uint32 dx=0, dy=0; - uint32 dwImageSize = g_dwOverlayP*g_dwOverlayH; + uint32 dwImageSize = g_dwOverlayP*g_dwOverlayH; - // grayscale - if(false) - { - for(uint32 y=0;yXRGB) - else - { - for(uint32 v=0;vXRGB) + else + { + for(uint32 v=0;v 255) ? 255 : R); - G = (G < 0) ? 0 : ((G > 255) ? 255 : G); - B = (B < 0) ? 0 : ((B > 255) ? 255 : B); + R = (R < 0) ? 0 : ((R > 255) ? 255 : R); + G = (G < 0) ? 0 : ((G > 255) ? 255 : G); + B = (B < 0) ? 0 : ((B > 255) ? 255 : B); - uint32 i = (dy*LockedRectDest.Pitch+(dx+x)*4); + uint32 i = (dy*LockedRectDest.Pitch+(dx+x)*4); - pDest[i+0] = (uint08)B; - pDest[i+1] = (uint08)G; - pDest[i+2] = (uint08)R; - pDest[i+3] = 0xFF; + pDest[i+0] = (uint08)B; + pDest[i+1] = (uint08)G; + pDest[i+2] = (uint08)R; + pDest[i+3] = 0xFF; - a++; - } + a++; + } - dx+=2; + dx+=2; - if((dx % g_dwOverlayW) == 0) - { - dy++; - dx=0; - } + if((dx % g_dwOverlayW) == 0) + { + dy++; + dx=0; + } - } - } + } + } - pBackBuffer->UnlockRect(); - } - } + pBackBuffer->UnlockRect(); + } + + // Update overlay if present was not called since the last call to + // EmuIDirect3DDevice8_UpdateOverlay. + if(g_bHackUpdateSoftwareOverlay) + g_pD3DDevice8->Present(0, 0, 0, 0); + + g_bHackUpdateSoftwareOverlay = TRUE; + } + } + else + { + EmuWarning("pSurface == NULL!"); + } #endif EmuSwapFS(); // XBox FS @@ -6316,6 +6578,33 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetRenderState_Simple DbgPrintf("D3DRS_DITHERENABLE := 0x%.08X\n", Value); break; + case D3DRS_STENCILZFAIL: + Value = EmuXB2PC_D3DSTENCILOP(Value); + DbgPrintf("D3DRS_STENCILZFAIL := 0x%.08X\n", Value); + break; + + case D3DRS_STENCILPASS: + Value = EmuXB2PC_D3DSTENCILOP(Value); + DbgPrintf("D3DRS_STENCILPASS := 0x%.08X\n", Value); + break; + + case D3DRS_STENCILFUNC: + Value = EmuXB2PC_D3DCMPFUNC(Value); + DbgPrintf("D3DRS_STENCILFUNC := 0x%.08X\n", Value); + break; + + case D3DRS_STENCILREF: + DbgPrintf("D3DRS_STENCILREF := 0x%.08X\n", Value); + break; + + case D3DRS_STENCILMASK: + DbgPrintf("D3DRS_STENCILMASK := 0x%.08X\n", Value); + break; + + case D3DRS_STENCILWRITEMASK: + DbgPrintf("D3DRS_STENCILWRITEMASK := 0x%.08X\n", Value); + break; + default: CxbxKrnlCleanup("Unsupported RenderState (0x%.08X)", State); break; @@ -7089,7 +7378,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawVertices VertexPatcher VertPatch; - bool bPatched = VertPatch.Apply(&VPDesc); + bool bPatched = VertPatch.Apply(&VPDesc, NULL); if(IsValidCurrentShader()) { @@ -7153,7 +7442,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawVerticesUP VertexPatcher VertPatch; - bool bPatched = VertPatch.Apply(&VPDesc); + bool bPatched = VertPatch.Apply(&VPDesc, NULL); if (IsValidCurrentShader()) { @@ -7250,8 +7539,9 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVertices VPDesc.hVertexShader = g_CurrentVertexShader; VertexPatcher VertPatch; + bool FatalError = false; - bool bPatched = VertPatch.Apply(&VPDesc); + bool bPatched = VertPatch.Apply(&VPDesc, &FatalError); #ifdef _DEBUG_TRACK_VB if(!g_bVBSkipStream) @@ -7297,7 +7587,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVertices pIndexBuffer->Unlock(); - g_pD3DDevice8->SetIndices(pIndexBuffer, 0); + g_pD3DDevice8->SetIndices(pIndexBuffer, g_dwBaseVertexIndex); uiNumVertices = VertexCount; uiStartIndex = 0; @@ -7308,12 +7598,26 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVertices uiStartIndex = ((DWORD)pIndexData)/2; } - if(IsValidCurrentShader()) + if(IsValidCurrentShader() && !FatalError) { g_pD3DDevice8->DrawIndexedPrimitive ( EmuPrimitiveType(VPDesc.PrimitiveType), 0, uiNumVertices, uiStartIndex, VPDesc.dwPrimitiveCount ); + /*if( (PrimitiveType == X_D3DPT_LINELOOP) || (PrimitiveType == X_D3DPT_QUADLIST) ) + { + g_pD3DDevice8->DrawPrimitive + ( + EmuPrimitiveType(VPDesc.PrimitiveType), 0, VPDesc.dwPrimitiveCount + ); + } + else + { + g_pD3DDevice8->DrawIndexedPrimitive + ( + EmuPrimitiveType(VPDesc.PrimitiveType), 0, uiNumVertices, uiStartIndex, VPDesc.dwPrimitiveCount + ); + } */ } if(!bActiveIB) @@ -7377,7 +7681,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVerticesUP VertexPatcher VertPatch; - bool bPatched = VertPatch.Apply(&VPDesc); + bool bPatched = VertPatch.Apply(&VPDesc, NULL); #ifdef _DEBUG_TRACK_VB if(!g_bVBSkipStream) @@ -7500,9 +7804,15 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetRenderTarget if(pRenderTarget != 0) { - EmuVerifyResourceIsRegistered(pRenderTarget); - - pPCRenderTarget = pRenderTarget->EmuSurface8; + if(pRenderTarget->EmuSurface8) + { + EmuVerifyResourceIsRegistered(pRenderTarget); + pPCRenderTarget = pRenderTarget->EmuSurface8; + } + else + { + pPCRenderTarget = g_pCachedRenderTarget->EmuSurface8; + } } if(pNewZStencil != 0) @@ -8226,7 +8536,7 @@ HRESULT WINAPI XTL::EmuIDirect3D8_CheckDeviceMultiSampleType // TODO: HACK: Devices that don't support this should somehow emulate it! if(PCSurfaceFormat == D3DFMT_D16) { - EmuWarning("D3DFMT_16 is an unsupported texture format!"); + EmuWarning("D3DFMT_D16 is an unsupported texture format!"); PCSurfaceFormat = D3DFMT_X8R8G8B8; } else if(PCSurfaceFormat == D3DFMT_P8) @@ -8244,19 +8554,16 @@ HRESULT WINAPI XTL::EmuIDirect3D8_CheckDeviceMultiSampleType Windowed = FALSE; // TODO: Convert from Xbox to PC!! - if(MultiSampleType == 0x0011) - MultiSampleType = D3DMULTISAMPLE_NONE; - else - CxbxKrnlCleanup("EmuIDirect3D8_CheckDeviceMultiSampleType Unknown MultiSampleType! (%d)", MultiSampleType); + D3DMULTISAMPLE_TYPE PCMultiSampleType = EmuXB2PC_D3DMultiSampleFormat((DWORD) MultiSampleType); // Now call the real CheckDeviceMultiSampleType with the corrected parameters. HRESULT hRet = g_pD3D8->CheckDeviceMultiSampleType ( Adapter, DeviceType, - SurfaceFormat, + PCSurfaceFormat, Windowed, - MultiSampleType + PCMultiSampleType ); EmuSwapFS(); // Xbox FS @@ -8487,38 +8794,35 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetPixelShaderProgram DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetPixelShaderProgram\n" "(\n" - " pPSDef : 0x%.08X\n" + " pPSDef : 0x%.08X\n" ");\n", GetCurrentThreadId(), pPSDef ); - // blueshogun96 10/1/07 - // I'm assuming this function is for those who are to lazy to call - // CreatePixelShader followed by SetPixelShader :) - // - // If this the wrong implementation/approach to emulating this, - // by all means fix it! - DWORD* pHandle = NULL; + HRESULT hRet = E_FAIL; + DWORD dwHandle; // Redirect this call to windows Direct3D - HRESULT hRet = g_pD3DDevice8->CreatePixelShader + /*hRet = g_pD3DDevice8->CreatePixelShader ( (DWORD*) pPSDef, pHandle - ); + );*/ if(FAILED(hRet)) { - *pHandle = X_PIXELSHADER_FAKE_HANDLE; + dwHandle = X_PIXELSHADER_FAKE_HANDLE; EmuWarning("We're lying about the creation of a pixel shader!"); } // Now, redirect this to Xbox Direct3D - hRet = XTL::EmuIDirect3DDevice8_SetPixelShader( *pHandle ); + EmuSwapFS(); + hRet = XTL::EmuIDirect3DDevice8_SetPixelShader( dwHandle ); + EmuSwapFS(); EmuSwapFS(); // Xbox FS - return hRet; + return S_OK; } // ****************************************************************** @@ -8615,7 +8919,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_DrawRectPatch // ****************************************************************** HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetProjectionViewportMatrix ( - D3DMATRIX *pProjectionViewport + D3DXMATRIX *pProjectionViewport ) { EmuSwapFS(); // Win2K/XP FS @@ -8626,31 +8930,55 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetProjectionViewportMatrix ");\n", GetCurrentThreadId(), pProjectionViewport); - // blueshogun96 10/10/07 - // Feel free to rewrite this if necissary. + // blueshogun96 1/25/10 + // It's been almost 3 years, but I think this is a better + // implementation. Still probably not right, but better + // then before. HRESULT hRet; - D3DMATRIX Out; + D3DXMATRIX Out, mtxProjection, mtxViewport; D3DVIEWPORT8 Viewport; + // Get current viewport hRet = g_pD3DDevice8->GetViewport(&Viewport); if(FAILED(hRet)) EmuWarning("Unable to get viewport!\n"); + // Get current projection matrix + hRet = g_pD3DDevice8->GetTransform(D3DTS_PROJECTION, &mtxProjection); + if(FAILED(hRet)) + EmuWarning("Unable to get projection matrix!\n"); + + // Clear the destination matrix ::ZeroMemory(&Out, sizeof(D3DMATRIX)); - Out._11 = Viewport.Width; - Out._22 = -((signed)Viewport.Height); - Out._33 = 1; - Out._41 = Viewport.X; - Out._42 = Viewport.Height + Viewport.Y; - Out._44 = 1; + // Create the Viewport matrix manually + // Direct3D8 doesn't give me everything I need in a viewport structure + // (one thing I REALLY HATE!) so some constants will have to be used + // instead. - *pProjectionViewport = Out; + float ClipWidth = 2.0f; + float ClipHeight = 2.0f; + float ClipX = -1.0f; + float ClipY = 1.0f; + float Width = DWtoF(Viewport.Width); + float Height = DWtoF(Viewport.Height); + + D3DXMatrixIdentity(&mtxViewport); + mtxViewport._11 = Width / ClipWidth; + mtxViewport._22 = -(Height / ClipHeight); + mtxViewport._41 = -(ClipX * mtxViewport._11); + mtxViewport._42 = -(ClipY * mtxViewport._22); + + // Multiply projection and viewport matrix together + Out = mtxProjection * mtxViewport; + + if(pProjectionViewport) + *pProjectionViewport = Out; EmuSwapFS(); // Xbox FS - return hRet; + return S_OK; } #pragma warning(default:4244) @@ -8808,3 +9136,321 @@ void WINAPI XTL::EmuIDirect3DDevice8_SetStipple( DWORD* pPattern ) EmuSwapFS(); } + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetSwapCallback +// ****************************************************************** +void WINAPI XTL::EmuIDirect3DDevice8_SetSwapCallback +( + D3DSWAPCALLBACK pCallback +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetSwapCallback\n" + "(\n" + " pCallback : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pCallback); + + DbgPrintf("pCallback: = 0x%.08X\n", pCallback); + + g_pSwapCallback = pCallback; + + EmuSwapFS(); // XBox FS + + return; +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_PersistDisplay +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_PersistDisplay() +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_PersistDisplay()\n", GetCurrentThreadId()); + + HRESULT hRet = S_OK; + + // TODO: If this functionality is ever really needed, an idea for + // implementation would be to save a copy of the backbuffer's contents + // and free the memory after the next call to D3DDevice::Present(). + // This temporary data could also be made available to the Xbox game + // through AvGetSavedDataAddress() since D3DDevice::GetPersistedDisplay2 + // just contains a call to that kernel function. So far, Unreal Champ- + // ionship is the only game that uses this functionality that I know of. + // Other Unreal Engine 2.x games might as well. + + EmuWarning("(Temporarily) Not persisting display. Blueshogun can fix this."); + + if(!g_pD3DDevice8) + { + EmuWarning("Direct3D device not initialized!"); + hRet = E_FAIL; + } + + EmuSwapFS(); // Xbox FS + + return hRet; +} + + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_Unknown1 +// ****************************************************************** +void WINAPI XTL::EmuIDirect3DDevice8_Unknown1() +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_Unknown1()\n", GetCurrentThreadId()); + + // TODO: Find out what this actually is. + // This function was only found in Run Like Hell (5233) @ 0x11FCD0. + // So far, this function hasn't been found in any other XDKs. Since + // the only major thing going on inside of it is a call to the kernel + // function AvSendTVEncoderOption, we can probably ignore it. + + EmuSwapFS(); // Xbox FS +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_PrimeVertexCache +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_PrimeVertexCache +( + UINT VertexCount, + WORD *pIndexData +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_PrimeVertexCache\n" + "(\n" + " VertexCount : 0x%.08X\n" + " pIndexData : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), VertexCount, pIndexData); + + // TODO: Implement + EmuWarning("PrimeVertexCache is not supported!"); + + EmuSwapFS(); // Win2k/XP FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetRenderState_SampleAlpha +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_SampleAlpha +( + DWORD dwSampleAlpha +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_SampleAlpha\n" + "(\n" + " dwSampleAlpha : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), dwSampleAlpha); + + // TODO: Implement? + + EmuWarning("SampleAlpha not supported!"); + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetRenderState_Deferred +// ****************************************************************** +VOID __fastcall XTL::EmuIDirect3DDevice8_SetRenderState_Deferred +( + DWORD State, + DWORD Value +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_Deferred\n" + "(\n" + " State : 0x%.08X\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), State, Value); + + // TODO: HACK: Technically, this function doesn't need to be emulated. + // The location of EmuD3DDeferredRenderState for 3911 isn't correct and at + // the time of writing, I don't understand how to fix it. Until then, + // I'm going to implement this in a reckless manner. When the offset for + // EmuD3DDeferredRenderState is fixed for 3911, this function should be + // obsolete! + + if( State > 81 && State < 116 ) + EmuD3DDeferredRenderState[State-82] = Value; + else + CxbxKrnlCleanup("Unknown Deferred RenderState! (%d)\n", State); + + /* + XDK 3911 Deferred RenderState values + D3DRS_FOGENABLE = 82, // TRUE to enable fog blending + D3DRS_FOGTABLEMODE = 83, // D3DFOGMODE + D3DRS_FOGSTART = 84, // float fog start (for both vertex and pixel fog) + D3DRS_FOGEND = 85, // float fog end + D3DRS_FOGDENSITY = 86, // float fog density + D3DRS_RANGEFOGENABLE = 87, // TRUE to enable range-based fog + D3DRS_WRAP0 = 88, // D3DWRAP* flags (D3DWRAP_U, D3DWRAPCOORD_0, etc.) for 1st texture coord. + D3DRS_WRAP1 = 89, // D3DWRAP* flags (D3DWRAP_U, D3DWRAPCOORD_0, etc.) for 2nd texture coord. + D3DRS_WRAP2 = 90, // D3DWRAP* flags (D3DWRAP_U, D3DWRAPCOORD_0, etc.) for 3rd texture coord. + D3DRS_WRAP3 = 91, // D3DWRAP* flags (D3DWRAP_U, D3DWRAPCOORD_0, etc.) for 4th texture coord. + D3DRS_LIGHTING = 92, // TRUE to enable lighting + D3DRS_SPECULARENABLE = 93, // TRUE to enable specular + D3DRS_LOCALVIEWER = 94, // TRUE to enable camera-relative specular highlights + D3DRS_COLORVERTEX = 95, // TRUE to enable per-vertex color + D3DRS_BACKSPECULARMATERIALSOURCE= 96, // D3DMATERIALCOLORSOURCE (Xbox extension) + D3DRS_BACKDIFFUSEMATERIALSOURCE = 97, // D3DMATERIALCOLORSOURCE (Xbox extension) + D3DRS_BACKAMBIENTMATERIALSOURCE = 98, // D3DMATERIALCOLORSOURCE (Xbox extension) + D3DRS_BACKEMISSIVEMATERIALSOURCE= 99, // D3DMATERIALCOLORSOURCE (Xbox extension) + D3DRS_SPECULARMATERIALSOURCE = 100, // D3DMATERIALCOLORSOURCE + D3DRS_DIFFUSEMATERIALSOURCE = 101, // D3DMATERIALCOLORSOURCE + D3DRS_AMBIENTMATERIALSOURCE = 102, // D3DMATERIALCOLORSOURCE + D3DRS_EMISSIVEMATERIALSOURCE = 103, // D3DMATERIALCOLORSOURCE + D3DRS_BACKAMBIENT = 104, // D3DCOLOR (Xbox extension) + D3DRS_AMBIENT = 105, // D3DCOLOR + D3DRS_POINTSIZE = 106, // float point size + D3DRS_POINTSIZE_MIN = 107, // float point size min threshold + D3DRS_POINTSPRITEENABLE = 108, // TRUE to enable point sprites + D3DRS_POINTSCALEENABLE = 109, // TRUE to enable point size scaling + D3DRS_POINTSCALE_A = 110, // float point attenuation A value + D3DRS_POINTSCALE_B = 111, // float point attenuation B value + D3DRS_POINTSCALE_C = 112, // float point attenuation C value + D3DRS_POINTSIZE_MAX = 113, // float point size max threshold + D3DRS_PATCHEDGESTYLE = 114, // D3DPATCHEDGESTYLE + D3DRS_PATCHSEGMENTS = 115, // DWORD number of segments per edge when drawing patches + */ + + EmuSwapFS(); // Xbox FS +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_DeleteStateBlock +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_DeleteStateBlock +( + DWORD Token +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_DeleteStateBlock\n" + "(\n" + " Token : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Token); + + HRESULT hRet = g_pD3DDevice8->DeleteStateBlock(Token); + + EmuSwapFS(); // Xbox FS + + return hRet; +} + + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetModelView +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetModelView +( + CONST D3DMATRIX *pModelView, + CONST D3DMATRIX *pInverseModelView, + CONST D3DMATRIX *pComposite +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetModelView\n" + "(\n" + " pModelView : 0x%.08X\n" + " pInverseModelView : 0x%.08X\n" + " pComposite : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pModelView, pInverseModelView, pComposite); + + // TODO: Implement + CxbxKrnlCleanup("SetModelView not yet implemented (should be easy fix, tell blueshogun)"); + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_FlushVertexCache +// ****************************************************************** +void WINAPI XTL::EmuIDirect3DDevice8_FlushVertexCache() +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_FlushVertexCache();\n", GetCurrentThreadId()); + + EmuSwapFS(); // Xbox FS +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_BeginPushBuffer +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_BeginPushBuffer +( + X_D3DPushBuffer *pPushBuffer +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BeginPushBuffer\n" + "(\n" + " pPushBuffer : 0x%.08X\n" + ");\n", GetCurrentThreadId(), pPushBuffer); + + //CxbxKrnlCleanup("BeginPushBuffer is not yet implemented!"); + EmuWarning("BeginPushBuffer is not yet implemented!"); + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_EndPushBuffer +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_EndPushBuffer() +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_EndPushBuffer();\n", GetCurrentThreadId()); + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuXMETAL_StartPush +// ****************************************************************** +void WINAPI XTL::EmuXMETAL_StartPush(void* Unknown) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuD3D8 (0x%X): EmuXMETAL_StartPush\n" + "(\n" + " Unknown : 0x%.08X\n", + ");\n", GetCurrentThreadId(), Unknown); + + // This function is too low level to actually emulate + __asm int 3; + + EmuSwapFS(); // Xbox FS +} \ No newline at end of file diff --git a/src/CxbxKrnl/EmuD3D8.h b/src/CxbxKrnl/EmuD3D8.h index 1fa4d86a2..0e46c0601 100644 --- a/src/CxbxKrnl/EmuD3D8.h +++ b/src/CxbxKrnl/EmuD3D8.h @@ -436,8 +436,8 @@ VOID WINAPI EmuIDirect3DDevice8_DeletePixelShader // ****************************************************************** HRESULT WINAPI EmuIDirect3DDevice8_CreatePixelShader ( - CONST DWORD *pFunction, - DWORD *pHandle + X_D3DPIXELSHADERDEF *pPSDef, + DWORD *pHandle ); // ****************************************************************** @@ -597,6 +597,30 @@ HRESULT WINAPI EmuIDirect3DDevice8_SetVertexData4f FLOAT d ); +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetVertexData4ub +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_SetVertexData4ub +( + INT Register, + BYTE a, + BYTE b, + BYTE c, + BYTE d +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetVertexData4s +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_SetVertexData4s +( + INT Register, + SHORT a, + SHORT b, + SHORT c, + SHORT d +); + // ****************************************************************** // * func: EmuIDirect3DDevice8_SetVertexDataColor // ****************************************************************** @@ -1681,7 +1705,7 @@ HRESULT WINAPI EmuIDirect3DDevice8_DrawRectPatch // ****************************************************************** HRESULT WINAPI EmuIDirect3DDevice8_GetProjectionViewportMatrix ( - D3DMATRIX *pProjectionViewport + D3DXMATRIX *pProjectionViewport ); // ****************************************************************** @@ -1720,4 +1744,89 @@ VOID WINAPI EmuD3DDevice_SetStateUP(); // ****************************************************************** void WINAPI EmuIDirect3DDevice8_SetStipple( DWORD* pPattern ); +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetSwapCallback +// ****************************************************************** +void WINAPI EmuIDirect3DDevice8_SetSwapCallback +( + D3DSWAPCALLBACK pCallback +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_PersistDisplay +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_PersistDisplay(); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_Unknown1 +// ****************************************************************** +void WINAPI EmuIDirect3DDevice8_Unknown1(); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_PrimeVertexCache +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_PrimeVertexCache +( + UINT VertexCount, + WORD *pIndexData +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetRenderState_SampleAlpha +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_SetRenderState_SampleAlpha +( + DWORD dwSampleAlpha +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetRenderState_Deferred +// ****************************************************************** +VOID __fastcall EmuIDirect3DDevice8_SetRenderState_Deferred +( + DWORD State, + DWORD Value +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_DeleteStateBlock +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_DeleteStateBlock +( + DWORD Token +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetModelView +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_SetModelView +( + CONST D3DMATRIX *pModelView, + CONST D3DMATRIX *pInverseModelView, + CONST D3DMATRIX *pComposite +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_FlushVertexCache +// ****************************************************************** +void WINAPI EmuIDirect3DDevice8_FlushVertexCache(); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_BeginPushBuffer +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_BeginPushBuffer +( + X_D3DPushBuffer *pPushBuffer +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_EndPushBuffer +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_EndPushBuffer(); + +// ****************************************************************** +// * func: EmuXMETAL_StartPush +// ****************************************************************** +void WINAPI EmuXMETAL_StartPush(void* Unknown); + #endif diff --git a/src/CxbxKrnl/EmuD3D8/Convert.cpp b/src/CxbxKrnl/EmuD3D8/Convert.cpp index c536f120b..8dd5e0a9f 100644 --- a/src/CxbxKrnl/EmuD3D8/Convert.cpp +++ b/src/CxbxKrnl/EmuD3D8/Convert.cpp @@ -174,7 +174,7 @@ XTL::D3DFORMAT XTL::EmuXB2PC_D3DFormat(X_D3DFORMAT Format) case 0x30: // Linear (X_D3DFMT_LIN_D16) case 0x2C: // Swizzled (X_D3DFMT_D16) - return D3DFMT_D16; + return D3DFMT_D16; // TODO: D3DDMT_D16 on Xbox is always lockable case 0x27: // Swizzled (X_D3DFMT_L6V5U5) return D3DFMT_L6V5U5; @@ -187,6 +187,9 @@ XTL::D3DFORMAT XTL::EmuXB2PC_D3DFormat(X_D3DFORMAT Format) case 0x64: return D3DFMT_VERTEXDATA; + + case 0xFFFFFFFF: + return D3DFMT_UNKNOWN; // TODO: Not sure if this counts as swizzled or not... } CxbxKrnlCleanup("EmuXB2PC_D3DFormat: Unknown Format (0x%.08X)", Format); @@ -228,6 +231,12 @@ XTL::X_D3DFORMAT XTL::EmuPC2XB_D3DFormat(D3DFORMAT Format) case D3DFMT_L8: return 0x13; // Linear // return 0x00; // Swizzled + case D3DFMT_D16: + case D3DFMT_D16_LOCKABLE: + return 0x2C; + + case D3DFMT_UNKNOWN: + return 0xFFFFFFFF; } CxbxKrnlCleanup("EmuPC2XB_D3DFormat: Unknown Format (%d)", Format); @@ -260,6 +269,37 @@ DWORD XTL::EmuXB2PC_D3DLock(DWORD Flags) return NewFlags; } +// convert from xbox to pc multisample formats +XTL::D3DMULTISAMPLE_TYPE XTL::EmuXB2PC_D3DMultiSampleFormat(DWORD Type) +{ + switch(Type) + { + case 0x0011: + return D3DMULTISAMPLE_NONE; + + case 0x1021: + case 0x1121: + case 0x2021: + case 0x2012: + return D3DMULTISAMPLE_2_SAMPLES; + + case 0x1022: + case 0x1222: + case 0x2022: + case 0x2222: + return D3DMULTISAMPLE_4_SAMPLES; + + case 0x1233: + case 0x2233: + return D3DMULTISAMPLE_9_SAMPLES; + } + + CxbxKrnlCleanup( "Unknown Multisample Type (0x%X)!\n" + "If this value is greater than 0xFFFF contact blueshogun!" ); + + return D3DMULTISAMPLE_NONE; +} + // lookup table for converting vertex count to primitive count UINT XTL::EmuD3DVertexToPrimitive[11][2] = { @@ -303,12 +343,12 @@ CONST DWORD XTL::EmuD3DRenderStateSimpleEncoded[174] = X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 2 X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 4 X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 6 - X_D3DRSSE_UNK, 0x0004037c, // 8 - D3DRS_SHADEMODE + X_D3DRSSE_UNK, 0x0004037c, // 8 - , D3DRS_SHADEMODE X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 10 X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 12 0x0004035c, 0x00040300, // 14 - D3DRS_ZWRITEENABLE, D3DRS_ALPHATESTENABLE X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 16 - X_D3DRSSE_UNK, 0x00040344, // 18 + X_D3DRSSE_UNK, 0x00040344, // 18 - , D3DRS_SRCBLEND 0x00040348, X_D3DRSSE_UNK, // 20 - D3DRS_DESTBLEND X_D3DRSSE_UNK, 0x00040354, // 22 - , D3DRS_ZFUNC 0x00040340, 0x0004033c, // 24 - D3DRS_ALPHAREF, D3DRS_ALPHAFUNC @@ -326,9 +366,9 @@ CONST DWORD XTL::EmuD3DRenderStateSimpleEncoded[174] = X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 48 X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 50 X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 52 - X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 54 - X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 56 - X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 58 + 0x00040374, 0x00040378, // 54 - D3DRS_STENCILZFAIL, D3DRS_STENCILPASS + 0x00040364, 0x00040368, // 56 - D3DRS_STENCILFUNC, D3DRS_STENCILREF + 0x0004036c, 0x00040360, // 58 - D3DRS_STENCILMASK, D3DRS_STENCILWRITEMASK X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 60 X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 62 X_D3DRSSE_UNK, X_D3DRSSE_UNK, // 64 diff --git a/src/CxbxKrnl/EmuD3D8/Convert.h b/src/CxbxKrnl/EmuD3D8/Convert.h index b3297f7e9..c6a184581 100644 --- a/src/CxbxKrnl/EmuD3D8/Convert.h +++ b/src/CxbxKrnl/EmuD3D8/Convert.h @@ -55,6 +55,9 @@ extern X_D3DFORMAT EmuPC2XB_D3DFormat(D3DFORMAT Format); // convert from xbox to pc d3d lock flags extern DWORD EmuXB2PC_D3DLock(DWORD Flags); +// convert from xbox to pc multisample formats +extern D3DMULTISAMPLE_TYPE EmuXB2PC_D3DMultiSampleFormat(DWORD Type); + /** // convert from pc to xbox texture transform state types (unnecessary so far) if((uint32)State < 4) @@ -91,6 +94,24 @@ inline D3DBLENDOP EmuXB2PC_D3DBLENDOP(X_D3DBLENDOP Value) { case 0x8006: return D3DBLENDOP_ADD; + case 0x800a: + return D3DBLENDOP_SUBTRACT; + case 0x800b: + return D3DBLENDOP_REVSUBTRACT; + case 0x8007: + return D3DBLENDOP_MIN; + case 0x8008: + return D3DBLENDOP_MAX; + case 0xF006: + { + CxbxKrnlCleanup("D3DBLENDOP_ADDSIGNED is not supported!"); + return D3DBLENDOP_ADD; + }; + case 0xF005: + { + CxbxKrnlCleanup("D3DBLENDOP_REVSUBTRACTSIGNED is not supported!"); + return D3DBLENDOP_REVSUBTRACT; + } } CxbxKrnlCleanup("Unknown D3DBLENDOP (0x%.08X)", Value); @@ -98,7 +119,7 @@ inline D3DBLENDOP EmuXB2PC_D3DBLENDOP(X_D3DBLENDOP Value) return (D3DBLENDOP)Value; } -// convert from xbox to pc blend types +// convert from xbox to pc blend types inline D3DBLEND EmuXB2PC_D3DBLEND(X_D3DBLEND Value) { if(Value < 2) @@ -129,6 +150,35 @@ inline D3DSHADEMODE EmuXB2PC_D3DSHADEMODE(X_D3DSHADEMODE Value) return (D3DSHADEMODE)((Value & 0x3) + 1); } +// convert from xbox to pc stencilop modes +inline D3DSTENCILOP EmuXB2PC_D3DSTENCILOP(X_D3DSTENCILOP Value) +{ + switch(Value) + { + case 0x1e00: + return D3DSTENCILOP_KEEP; + case 0: + return D3DSTENCILOP_ZERO; + case 0x1e01: + return D3DSTENCILOP_REPLACE; + case 0x1e02: + return D3DSTENCILOP_INCRSAT; + case 0x1e03: + return D3DSTENCILOP_DECRSAT; + case 0x150a: + return D3DSTENCILOP_INVERT; + case 0x8507: + return D3DSTENCILOP_INCR; + case 0x8508: + return D3DSTENCILOP_DECR; + + default: + CxbxKrnlCleanup("Unknown D3DSTENCILOP (0x%.08X)", Value); + } + + return (D3DSTENCILOP) Value; +} + // table used for vertex->primitive count conversion extern UINT EmuD3DVertexToPrimitive[11][2]; diff --git a/src/CxbxKrnl/EmuD3D8/PixelShader.cpp b/src/CxbxKrnl/EmuD3D8/PixelShader.cpp new file mode 100644 index 000000000..e02ff75cc --- /dev/null +++ b/src/CxbxKrnl/EmuD3D8/PixelShader.cpp @@ -0,0 +1,366 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->EmuD3D8->PixelShader.cpp +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** +#define _CXBXKRNL_INTERNAL +#define _XBOXKRNL_DEFEXTRN_ + +#include "CxbxKrnl/CxbxKrnl.h" +#include "CxbxKrnl/Emu.h" +#include "CxbxKrnl/EmuFS.h" +#include "CxbxKrnl/EmuAlloc.h" +#include "CxbxKrnl/EmuXTL.h" + + +// PS Texture Modes +char* PS_TextureModes[] = +{ + "PS_TEXTUREMODES_NONE", // 0x00 + "PS_TEXTUREMODES_PROJECT2D", // 0x01 + "PS_TEXTUREMODES_PROJECT3D", // 0x02 + "PS_TEXTUREMODES_CUBEMAP", // 0x03 + "PS_TEXTUREMODES_PASSTHRU", // 0x04 + "PS_TEXTUREMODES_CLIPPLANE", // 0x05 + "PS_TEXTUREMODES_BUMPENVMAP", // 0x06 + "PS_TEXTUREMODES_BUMPENVMAP_LUM", // 0x07 + "PS_TEXTUREMODES_BRDF", // 0x08 + "PS_TEXTUREMODES_DOT_ST", // 0x09 + "PS_TEXTUREMODES_DOT_ZW", // 0x0A + "PS_TEXTUREMODES_DOT_RFLCT_DIFF", // 0x0B + "PS_TEXTUREMODES_DOT_RFLCT_SPEC", // 0x0C + "PS_TEXTUREMODES_DOT_STR_3D", // 0x0D + "PS_TEXTUREMODES_DOT_STR_CUBE", // 0x0E + "PS_TEXTUREMODES_DPNDNT_AR", // 0x0F + "PS_TEXTUREMODES_DPNDNT_GB", // 0x10 + "PS_TEXTUREMODES_DOTPRODUCT", // 0x11 + "PS_TEXTUREMODES_DOT_RFLCT_SPEC_CONST", // 0x12 + "???", // 0x13 + "???", // 0x14 + "???", // 0x15 + "???", // 0x16 + "???", // 0x17 + "???", // 0x18 + "???", // 0x19 + "???", // 0x1A + "???", // 0x1B + "???", // 0x1C + "???", // 0x1D + "???", // 0x1E + "???", // 0x1F +}; + +// PS DotMapping +char* PS_DotMapping[] = +{ + "PS_DOTMAPPING_ZERO_TO_ONE", // 0x00 + "PS_DOTMAPPING_MINUS1_TO_1_D3D", // 0x01 + "PS_DOTMAPPING_MINUS1_TO_1_GL", // 0x02 + "PS_DOTMAPPING_MINUS1_TO_1", // 0x03 + "PS_DOTMAPPING_HILO_1", // 0x04 + "PS_DOTMAPPING_HILO_HEMISPHERE", // 0x07 +}; + +// PS CompareMode +char* PS_CompareMode[] = +{ + "PS_COMPAREMODE_S_LT", // 0x00L + "PS_COMPAREMODE_S_GE", // 0x01L + + "PS_COMPAREMODE_T_LT", // 0x00L + "PS_COMPAREMODE_T_GE", // 0x02L + + "PS_COMPAREMODE_R_LT", // 0x00L + "PS_COMPAREMODE_R_GE", // 0x04L + + "PS_COMPAREMODE_Q_LT", // 0x00L + "PS_COMPAREMODE_Q_GE", // 0x08L +}; + +// PS CombinerCountFlags +char* PS_CombinerCountFlags[] = +{ + "PS_COMBINERCOUNT_MUX_LSB", // 0x0000L, // mux on r0.a lsb + "PS_COMBINERCOUNT_MUX_MSB", // 0x0001L, // mux on r0.a msb + + "PS_COMBINERCOUNT_SAME_C0", // 0x0000L, // c0 same in each stage + "PS_COMBINERCOUNT_UNIQUE_C0", // 0x0010L, // c0 unique in each stage + + "PS_COMBINERCOUNT_SAME_C1", // 0x0000L, // c1 same in each stage + "PS_COMBINERCOUNT_UNIQUE_C1", // 0x0100L // c1 unique in each stage +}; + +// PS InputMapping +char* PS_InputMapping[] = +{ + "PS_INPUTMAPPING_UNSIGNED_IDENTITY", // 0x00L, // max(0,x) OK for final combiner + "PS_INPUTMAPPING_UNSIGNED_INVERT", // 0x20L, // 1 - max(0,x) OK for final combiner + "PS_INPUTMAPPING_EXPAND_NORMAL", // 0x40L, // 2*max(0,x) - 1 invalid for final combiner + "PS_INPUTMAPPING_EXPAND_NEGATE", // 0x60L, // 1 - 2*max(0,x) invalid for final combiner + "PS_INPUTMAPPING_HALFBIAS_NORMAL", // 0x80L, // max(0,x) - 1/2 invalid for final combiner + "PS_INPUTMAPPING_HALFBIAS_NEGATE", // 0xa0L, // 1/2 - max(0,x) invalid for final combiner + "PS_INPUTMAPPING_SIGNED_IDENTITY", // 0xc0L, // x invalid for final combiner + "PS_INPUTMAPPING_SIGNED_NEGATE", // 0xe0L, // -x invalid for final combiner +}; + +// PS Register +char* PS_Register[] = +{ + "PS_REGISTER_ZERO", // 0x00L, // r + "PS_REGISTER_DISCARD", // 0x00L, // w + "PS_REGISTER_C0", // 0x01L, // r + "PS_REGISTER_C1", // 0x02L, // r + "PS_REGISTER_FOG", // 0x03L, // r + "PS_REGISTER_V0", // 0x04L, // r/w + "PS_REGISTER_V1", // 0x05L, // r/w + "PS_REGISTER_T0", // 0x08L, // r/w + "PS_REGISTER_T1", // 0x09L, // r/w + "PS_REGISTER_T2", // 0x0aL, // r/w + "PS_REGISTER_T3", // 0x0bL, // r/w + "PS_REGISTER_R0", // 0x0cL, // r/w + "PS_REGISTER_R1", // 0x0dL, // r/w + "PS_REGISTER_V1R0_SUM", // 0x0eL, // r + "PS_REGISTER_EF_PROD", // 0x0fL, // r + + "PS_REGISTER_ONE", // PS_REGISTER_ZERO | PS_INPUTMAPPING_UNSIGNED_INVERT, // OK for final combiner + "PS_REGISTER_NEGATIVE_ONE", // PS_REGISTER_ZERO | PS_INPUTMAPPING_EXPAND_NORMAL, // invalid for final combiner + "PS_REGISTER_ONE_HALF", // PS_REGISTER_ZERO | PS_INPUTMAPPING_HALFBIAS_NEGATE, // invalid for final combiner + "PS_REGISTER_NEGATIVE_ONE_HALF",// PS_REGISTER_ZERO | PS_INPUTMAPPING_HALFBIAS_NORMAL, // invalid for final combiner +}; + +// PS Channel +char* PS_Channel[] = +{ + "PS_CHANNEL_RGB", // 0x00, // used as RGB source + "PS_CHANNEL_BLUE", // 0x00, // used as ALPHA source + "PS_CHANNEL_ALPHA", // 0x10, // used as RGB or ALPHA source +}; + +// PS FinalCombinerSetting +char* PS_FinalCombinerSetting[] = +{ + "PS_FINALCOMBINERSETTING_CLAMP_SUM", // 0x80, // V1+R0 sum clamped to [0,1] + + "PS_FINALCOMBINERSETTING_COMPLEMENT_V1", // 0x40, // unsigned invert mapping + + "PS_FINALCOMBINERSETTING_COMPLEMENT_R0", // 0x20, // unsigned invert mapping +}; + +// PS CombineOutput +char* PS_CombineOutput[] = +{ + "PS_COMBINEROUTPUT_IDENTITY", // 0x00L, // y = x + "PS_COMBINEROUTPUT_BIAS", // 0x08L, // y = x - 0.5 + "PS_COMBINEROUTPUT_SHIFTLEFT_1", // 0x10L, // y = x*2 + "PS_COMBINEROUTPUT_SHIFTLEFT_1_BIAS", // 0x18L, // y = (x - 0.5)*2 + "PS_COMBINEROUTPUT_SHIFTLEFT_2", // 0x20L, // y = x*4 + "PS_COMBINEROUTPUT_SHIFTRIGHT_1", // 0x30L, // y = x/2 + + "PS_COMBINEROUTPUT_AB_BLUE_TO_ALPHA", // 0x80L, // RGB only + + "PS_COMBINEROUTPUT_CD_BLUE_TO_ALPHA", // 0x40L, // RGB only + + "PS_COMBINEROUTPUT_AB_MULTIPLY", // 0x00L, + "PS_COMBINEROUTPUT_AB_DOT_PRODUCT", // 0x02L, // RGB only + + "PS_COMBINEROUTPUT_CD_MULTIPLY", // 0x00L, + "PS_COMBINEROUTPUT_CD_DOT_PRODUCT", // 0x01L, // RGB only + + "PS_COMBINEROUTPUT_AB_CD_SUM", // 0x00L, // 3rd output is AB+CD + "PS_COMBINEROUTPUT_AB_CD_MUX", // 0x04L, // 3rd output is MUX(AB,CD) based on R0.a +}; + +// PS GlobalFlags +char* PS_GlobalFlags[] = +{ + "PS_GLOBALFLAGS_NO_TEXMODE_ADJUST", // 0x0000L, // don't adjust texture modes + "PS_GLOBALFLAGS_TEXMODE_ADJUST", // 0x0001L, // adjust texture modes according to set texture +}; + + +void XTL::DumpPixelShaderDefToFile( X_D3DPIXELSHADERDEF* pPSDef ) +{ + static int PshNumber = 0; // Keep track of how many pixel shaders we've attemted to convert. + char szPSDef[512]; + + sprintf( szPSDef, "PSDef%.03d.txt", PshNumber++ ); + + FILE* out = fopen( szPSDef, "w" ); + if( out ) + { + fprintf( out, "PSAphaInputs[8] = 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X\n" + "PSFinalCombinerInputsABCD = 0x%.08X\n" + "PSFinalCombinerInputsEFG = 0x%.08X\n" + "PSConstant0[8] = 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X\n" + "PSConstant1[8] = 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X\n" + "PSAlphaOutputs[8] = 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X\n" + "PSRGBInputs[8] = 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X\n" + "PSCompareMode = 0x%.08X\n" + "PSFinalCombinerConstant0 = 0x%.08X\n" + "PSFinalCombinerConstant1 = 0x%.08X\n" + "PSRGBOutputs[8] = 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X 0x%.08X\n" + "PSCombinerCount = 0x%.08X\n" + "PSTextureModes = 0x%.08X\n" + "PSDotMapping = 0x%.08X\n" + "PSInputTexture = 0x%.08X\n" + "PSC0Mapping = 0x%.08X\n" + "PSC1Mapping = 0x%.08X\n" + "PSFinalCombinerConstants = 0x%.08X\n", + pPSDef->PSAlphaInputs[0], pPSDef->PSAlphaInputs[1], pPSDef->PSAlphaInputs[2], pPSDef->PSAlphaInputs[3], + pPSDef->PSAlphaInputs[4], pPSDef->PSAlphaInputs[5], pPSDef->PSAlphaInputs[6], pPSDef->PSAlphaInputs[7], + pPSDef->PSFinalCombinerInputsABCD, + pPSDef->PSFinalCombinerInputsEFG, + pPSDef->PSConstant0[0], pPSDef->PSConstant0[1], pPSDef->PSConstant0[2], pPSDef->PSConstant0[3], + pPSDef->PSConstant0[4], pPSDef->PSConstant0[5], pPSDef->PSConstant0[6], pPSDef->PSConstant0[7], + pPSDef->PSConstant1[0], pPSDef->PSConstant1[1], pPSDef->PSConstant1[2], pPSDef->PSConstant1[3], + pPSDef->PSConstant1[4], pPSDef->PSConstant1[5], pPSDef->PSConstant1[6], pPSDef->PSConstant1[7], + pPSDef->PSAlphaOutputs[0], pPSDef->PSAlphaOutputs[1], pPSDef->PSAlphaOutputs[2], pPSDef->PSAlphaOutputs[3], + pPSDef->PSAlphaOutputs[4], pPSDef->PSAlphaOutputs[5], pPSDef->PSAlphaOutputs[6], pPSDef->PSAlphaOutputs[7], + pPSDef->PSRGBInputs[0], pPSDef->PSRGBInputs[1], pPSDef->PSRGBInputs[2], pPSDef->PSRGBInputs[3], + pPSDef->PSRGBInputs[4], pPSDef->PSRGBInputs[5], pPSDef->PSRGBInputs[6], pPSDef->PSRGBInputs[7], + pPSDef->PSCompareMode, + pPSDef->PSFinalCombinerConstant0, + pPSDef->PSFinalCombinerConstant1, + pPSDef->PSRGBOutputs[0], pPSDef->PSRGBOutputs[1], pPSDef->PSRGBOutputs[2], pPSDef->PSRGBOutputs[3], + pPSDef->PSRGBOutputs[4], pPSDef->PSRGBOutputs[5], pPSDef->PSRGBOutputs[6], pPSDef->PSRGBOutputs[7], + pPSDef->PSCombinerCount, + pPSDef->PSTextureModes, + pPSDef->PSDotMapping, + pPSDef->PSInputTexture, + pPSDef->PSC0Mapping, + pPSDef->PSC1Mapping, + pPSDef->PSFinalCombinerConstants ); + fclose( out ); + } +} + +// print relevant contents to the debug console +void XTL::PrintPixelShaderDefContents( X_D3DPIXELSHADERDEF* pPSDef ) +{ + // Show the contents to the user + if( pPSDef ) + { + DbgPshPrintf( "\n-----PixelShader Def Contents-----\n" ); + + if( pPSDef->PSTextureModes ) + { + DWORD dwPSTexMode0 = ( pPSDef->PSTextureModes >> 0 ) & 0x1F; + DWORD dwPSTexMode1 = ( pPSDef->PSTextureModes >> 5 ) & 0x1F; + DWORD dwPSTexMode2 = ( pPSDef->PSTextureModes >> 10 ) & 0x1F; + DWORD dwPSTexMode3 = ( pPSDef->PSTextureModes >> 15 ) & 0x1F; + + DbgPshPrintf( "PSTextureModes ->\n" ); + DbgPshPrintf( "Stage 0: %s\n", PS_TextureModes[dwPSTexMode0] ); + DbgPshPrintf( "Stage 1: %s\n", PS_TextureModes[dwPSTexMode1] ); + DbgPshPrintf( "Stage 2: %s\n", PS_TextureModes[dwPSTexMode2] ); + DbgPshPrintf( "Stage 3: %s\n", PS_TextureModes[dwPSTexMode3] ); + } + + if( pPSDef->PSDotMapping ) + { + DWORD dwPSDMStage1 = ( pPSDef->PSDotMapping >> 0 ) & 0x7; + DWORD dwPSDMStage2 = ( pPSDef->PSDotMapping >> 4 ) & 0x7; + DWORD dwPSDMStage3 = ( pPSDef->PSDotMapping >> 8 ) & 0x7; + + DbgPshPrintf( "PSDotMapping ->\n" ); + DbgPshPrintf( "Stage 1: %s\n", PS_DotMapping[dwPSDMStage1] ); + DbgPshPrintf( "Stage 2: %s\n", PS_DotMapping[dwPSDMStage2] ); + DbgPshPrintf( "Stage 3: %s\n", PS_DotMapping[dwPSDMStage3] ); + } + + if( pPSDef->PSCompareMode ) + { + DWORD dwPSCMStage0 = ( pPSDef->PSCompareMode >> 0 ) & 0xF; + DWORD dwPSCMStage1 = ( pPSDef->PSCompareMode >> 4 ) & 0xF; + DWORD dwPSCMStage2 = ( pPSDef->PSCompareMode >> 8 ) & 0xF; + DWORD dwPSCMStage3 = ( pPSDef->PSCompareMode >> 12 ) & 0xF; + + DbgPshPrintf( "PSCompareMode ->\n" ); + DbgPshPrintf( "Stage 0: %s\n", PS_TextureModes[dwPSCMStage0 == 0 ? 0 : 1] ); + DbgPshPrintf( "Stage 1: %s\n", PS_TextureModes[dwPSCMStage1 == 0 ? 2 : 3] ); + DbgPshPrintf( "Stage 2: %s\n", PS_TextureModes[dwPSCMStage2 == 0 ? 4 : 5] ); + DbgPshPrintf( "Stage 3: %s\n", PS_TextureModes[dwPSCMStage3 == 0 ? 6 : 7] ); + } + + if( pPSDef->PSInputTexture ) + { + DWORD dwPSITStage2 = ( pPSDef->PSInputTexture >> 16 ) & 0x1; + DWORD dwPSITStage3 = ( pPSDef->PSInputTexture >> 20 ) & 0x3; + + DbgPshPrintf( "PSInputTexture ->\n" ); + DbgPshPrintf( "Stage 2: %s\n", PS_TextureModes[dwPSITStage2] ); + DbgPshPrintf( "Stage 3: %s\n", PS_TextureModes[dwPSITStage3] ); + } + + if( pPSDef->PSCombinerCount ) + { + DWORD dwPSCCNumCombiners = ( pPSDef->PSCombinerCount >> 0 ) & 0xF; + DWORD dwPSCCMux = ( pPSDef->PSCombinerCount >> 8 ) & 0x1; + DWORD dwPSCCC0 = ( pPSDef->PSCombinerCount >> 12 ) & 0x1; + DWORD dwPSCCC1 = ( pPSDef->PSCombinerCount >> 16 ) & 0x1; + + DbgPshPrintf( "PSCombinerCount ->\n" ); + DbgPshPrintf( "Combiners: %d\n", dwPSCCNumCombiners ); + DbgPshPrintf( "Mux: %s\n", PS_CombinerCountFlags[dwPSCCMux] ); + DbgPshPrintf( "C0: %s\n", PS_CombinerCountFlags[dwPSCCC0 == 0 ? 2 : 3] ); + DbgPshPrintf( "C1: %s\n", PS_CombinerCountFlags[dwPSCCC1 == 0 ? 4 : 5] ); + } + + /*for( int i = 0; i > 7; i++ ) + { + if( pPSDef->PSRGBInputs[i] ) + {*/ + } +} + +HRESULT XTL::EmuRecompilePshDef( X_D3DPIXELSHADERDEF* pPSDef, LPD3DXBUFFER* ppRecompiled ) +{ + char szPshString[2048]; // I'm sure that's big enough... + + // Dump the contents of the PixelShader def +#ifdef _DEBUG_TRACK_PS + DumpPixelShaderDefToFile( pPSDef ); + + // Azurik like to create and destroy the same shader every frame! O_o +// PrintPixelShaderDefContents( pPSDef ); +#endif + + // First things first, set the pixel shader version + // TODO: ps.1.1 might be a better idea... + sprintf(szPshString, "%s", "ps.1.0\n"); + + // Handle Texture declarations + if(pPSDef->PSTextureModes != 0) + { + } + + return S_OK; +} diff --git a/src/CxbxKrnl/EmuD3D8/PixelShader.h b/src/CxbxKrnl/EmuD3D8/PixelShader.h new file mode 100644 index 000000000..77f34c5ee --- /dev/null +++ b/src/CxbxKrnl/EmuD3D8/PixelShader.h @@ -0,0 +1,434 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->EmuD3D8->PixelShader.h +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** +#ifndef PIXELSHADER_H +#define PIXELSHADER_H + +#include "Cxbx.h" + +/*---------------------------------------------------------------------------*/ +/* Texture configuration - The following members of the D3DPixelShaderDef */ +/* structure define the addressing modes of each of the four texture stages:*/ +/* PSTextureModes */ +/* PSDotMapping */ +/* PSInputTexture */ +/* PSCompareMode */ +/*---------------------------------------------------------------------------*/ + +// ========================================================================================================= +// PSTextureModes +// --------.--------.--------.---xxxxx stage0 +// --------.--------.------xx.xxx----- stage1 +// --------.--------.-xxxxx--.-------- stage2 +// --------.----xxxx.x-------.-------- stage3 + +#define PS_TEXTUREMODES(t0,t1,t2,t3) (((t3)<<15)|((t2)<<10)|((t1)<<5)|(t0)) + +/* +Texture modes: +NONE :stage inactive +PROJECT2D :argb = texture(s/q, t/q) +PROJECT3D :argb = texture(s/q, t/q, r/q) +CUBEMAP :argb = cubemap(s,t,r) +PASSTHRU :argb = s,t,r,q +CLIPPLANE :pixel not drawn if s,t,r, or q < 0. PSCompareMode affects comparison +BUMPENVMAP :argb=texture(s+mat00*src.r+mat01*src.g, + t+mat10*src.r+mat11*src.g) + mat00 set via D3DTSS_BUMPENVMAT00, etc. +BUMPENVMAP_LUM :argb=texture(s+mat00*src.r+mat01*src.g, + t+mat10*src.r+mat11*src.g); + rgb *= (lum_scale*src.b + lum_bias); (a is not affected) + lum_scale set by D3DTSS_BUMPENVLSCALE + lum_bias set by D3DTSS_BUMPENVLOFFSET + mat00 set via D3DTSS_BUMPENVMAT00, etc. +BRDF :argb = texture(eyeSigma, lightSigma, dPhi) + eyeSigma = Sigma of eye vector in spherical coordinates + lightSigma = Sigma of light vector in spherical coordinates + dPhi = Phi of eye - Phi of light +DOT_ST :argb = texture(, (s,t,r).(src.r,src.g,src.b)) +DOT_ZW :frag depth = (/((s,t,r).(src.r,src.g,src.b)) +DOT_RFLCT_DIFF :n = (,(s,t,r).(src.r,src.g,src.b),) + argb = cubemap(n) +DOT_RFLCT_SPEC :n = (,,(s,t,r).(src.r,src.g,src.b)) + r = 2*n*(n.e)/(n.n) - e where e is eye vector built from q coord of each stage + argb = cubemap(r) +DOT_STR_3D :argb=texture((,,(s,t,r).(src.r,src.g,src.b))) +DOT_STR_CUBE :argb=cubemap((,,(s,t,r).(src.r,src.g,src.b))) +DEPENDENT_AR :argb = texture(src.a, src.r) +DEPENDENT_GB :argb = texture(src.g, src.b) +DOTPRODUCT :argb = (s,t,r).(src.r,src.g,src.b) +DOT_RFLCT_SPEC_CONST :n = (,,(s,t,r).(src.r,src.g,src.b)) + r = 2*n*(n.e)/(n.n) - e where e is eye vector set via SetEyeVector() + argb = cubemap(r) +*/ + +enum PS_TEXTUREMODES +{ // valid in stage 0 1 2 3 + PS_TEXTUREMODES_NONE= 0x00L, // * * * * + PS_TEXTUREMODES_PROJECT2D= 0x01L, // * * * * + PS_TEXTUREMODES_PROJECT3D= 0x02L, // * * * * + PS_TEXTUREMODES_CUBEMAP= 0x03L, // * * * * + PS_TEXTUREMODES_PASSTHRU= 0x04L, // * * * * + PS_TEXTUREMODES_CLIPPLANE= 0x05L, // * * * * + PS_TEXTUREMODES_BUMPENVMAP= 0x06L, // - * * * + PS_TEXTUREMODES_BUMPENVMAP_LUM= 0x07L, // - * * * + PS_TEXTUREMODES_BRDF= 0x08L, // - - * * + PS_TEXTUREMODES_DOT_ST= 0x09L, // - - * * + PS_TEXTUREMODES_DOT_ZW= 0x0aL, // - - * * + PS_TEXTUREMODES_DOT_RFLCT_DIFF= 0x0bL, // - - * - + PS_TEXTUREMODES_DOT_RFLCT_SPEC= 0x0cL, // - - - * + PS_TEXTUREMODES_DOT_STR_3D= 0x0dL, // - - - * + PS_TEXTUREMODES_DOT_STR_CUBE= 0x0eL, // - - - * + PS_TEXTUREMODES_DPNDNT_AR= 0x0fL, // - * * * + PS_TEXTUREMODES_DPNDNT_GB= 0x10L, // - * * * + PS_TEXTUREMODES_DOTPRODUCT= 0x11L, // - * * - + PS_TEXTUREMODES_DOT_RFLCT_SPEC_CONST= 0x12L, // - - - * + // 0x13-0x1f reserved +}; + + +// ========================================================================================================= +// PSDotMapping +// --------.--------.--------.-----xxx // stage1 +// --------.--------.--------.-xxx---- // stage2 +// --------.--------.-----xxx.-------- // stage3 + +#define PS_DOTMAPPING(t0,t1,t2,t3) (((t3)<<8)|((t2)<<4)|(t1)) + +// Mappings: +// ZERO_TO_ONE :rgb->(r,g,b): 0x0=>0.0, 0xff=>1.0 +// MINUS1_TO_1_D3D :rgb->(r,g,b): 0x0=>-128/127, 0x01=>-1.0, 0x80=>0.0, 0xff=>1.0 +// MINUS1_TO_1_GL :rgb->(r,g,b): 0x80=>-1.0, 0x7f=>1.0 +// MINUS1_TO_1 :rgb->(r,g,b): 0x80=>-128/127, 0x81=>-1.0, 0x0=>0.0, 0x7f=>1.0 +// HILO_1 :HL->(H,L,1.0): 0x0000=>0.0, 0xffff=>1.0 +// HILO_HEMISPHERE :HL->(H,L,sqrt(1-H*H-L*L)): 0x8001=>-1.0, 0x0=>0.0, 0x7fff=>1.0, 0x8000=>-32768/32767 + +enum PS_DOTMAPPING +{ // valid in stage 0 1 2 3 + PS_DOTMAPPING_ZERO_TO_ONE= 0x00L, // - * * * + PS_DOTMAPPING_MINUS1_TO_1_D3D= 0x01L, // - * * * + PS_DOTMAPPING_MINUS1_TO_1_GL= 0x02L, // - * * * + PS_DOTMAPPING_MINUS1_TO_1= 0x03L, // - * * * + PS_DOTMAPPING_HILO_1= 0x04L, // - * * * + PS_DOTMAPPING_HILO_HEMISPHERE= 0x07L, // - * * * +}; + +// ========================================================================================================= +// PSCompareMode +// --------.--------.--------.----xxxx // stage0 +// --------.--------.--------.xxxx---- // stage1 +// --------.--------.----xxxx.-------- // stage2 +// --------.--------.xxxx----.-------- // stage3 + +#define PS_COMPAREMODE(t0,t1,t2,t3) (((t3)<<12)|((t2)<<8)|((t1)<<4)|(t0)) + +enum PS_COMPAREMODE +{ + PS_COMPAREMODE_S_LT= 0x00L, + PS_COMPAREMODE_S_GE= 0x01L, + + PS_COMPAREMODE_T_LT= 0x00L, + PS_COMPAREMODE_T_GE= 0x02L, + + PS_COMPAREMODE_R_LT= 0x00L, + PS_COMPAREMODE_R_GE= 0x04L, + + PS_COMPAREMODE_Q_LT= 0x00L, + PS_COMPAREMODE_Q_GE= 0x08L, +}; + +// ========================================================================================================= +// PSInputTexture +// --------.-------x.--------.-------- // stage2 +// --------.--xx----.--------.-------- // stage3 +// +// Selects the other texture to use as an input in the following texture modes: +// DOT_ST, DOT_STR_3D, DOT_STR_CUBE, DOT_ZW, DOT_RFLCT_SPEC, +// DOT_RFLCT_DIFF, DPNDNT_AR, DPNDNT_GB, BUMPENVMAP, +// BUMPENVMAP_LUM, DOT_PRODUCT + +#define PS_INPUTTEXTURE(t0,t1,t2,t3) (((t3)<<20)|((t2)<<16)) + + +/*---------------------------------------------------------------------------------*/ +/* Color combiners - The following members of the D3DPixelShaderDef structure */ +/* define the state for the eight stages of color combiners: */ +/* PSCombinerCount - Number of stages */ +/* PSAlphaInputs[8] - Inputs for alpha portion of each stage */ +/* PSRGBInputs[8] - Inputs for RGB portion of each stage */ +/* PSConstant0[8] - Constant 0 for each stage */ +/* PSConstant1[8] - Constant 1 for each stage */ +/* PSFinalCombinerConstant0 - Constant 0 for final combiner */ +/* PSFinalCombinerConstant1 - Constant 1 for final combiner */ +/* PSAlphaOutputs[8] - Outputs for alpha portion of each stage */ +/* PSRGBOutputs[8] - Outputs for RGB portion of each stage */ +/*---------------------------------------------------------------------------------*/ + + +// ========================================================================================================= +// PSCombinerCount +// --------.--------.--------.----xxxx // number of combiners (1-8) +// --------.--------.-------x.-------- // mux bit (0= LSB, 1= MSB) +// --------.--------.---x----.-------- // separate C0 +// --------.-------x.--------.-------- // separate C1 + +#define PS_COMBINERCOUNT(count, flags) (((flags)<<8)|(count)) +// count is 1-8, flags contains one or more values from PS_COMBINERCOUNTFLAGS + +enum PS_COMBINERCOUNTFLAGS +{ + PS_COMBINERCOUNT_MUX_LSB= 0x0000L, // mux on r0.a lsb + PS_COMBINERCOUNT_MUX_MSB= 0x0001L, // mux on r0.a msb + + PS_COMBINERCOUNT_SAME_C0= 0x0000L, // c0 same in each stage + PS_COMBINERCOUNT_UNIQUE_C0= 0x0010L, // c0 unique in each stage + + PS_COMBINERCOUNT_SAME_C1= 0x0000L, // c1 same in each stage + PS_COMBINERCOUNT_UNIQUE_C1= 0x0100L // c1 unique in each stage +}; + + +// ========================================================================================================= +// PSRGBInputs[0-7] +// PSAlphaInputs[0-7] +// PSFinalCombinerInputsABCD +// PSFinalCombinerInputsEFG +// --------.--------.--------.----xxxx // D register +// --------.--------.--------.---x---- // D channel (0= RGB/BLUE, 1= ALPHA) +// --------.--------.--------.xxx----- // D input mapping +// --------.--------.----xxxx.-------- // C register +// --------.--------.---x----.-------- // C channel (0= RGB/BLUE, 1= ALPHA) +// --------.--------.xxx-----.-------- // C input mapping +// --------.----xxxx.--------.-------- // B register +// --------.---x----.--------.-------- // B channel (0= RGB/BLUE, 1= ALPHA) +// --------.xxx-----.--------.-------- // B input mapping +// ----xxxx.--------.--------.-------- // A register +// ---x----.--------.--------.-------- // A channel (0= RGB/BLUE, 1= ALPHA) +// xxx-----.--------.--------.-------- // A input mapping + +// examples: +// +// shader.PSRGBInputs[3]= PS_COMBINERINPUTS( +// PS_REGISTER_T0 | PS_INPUTMAPPING_EXPAND_NORMAL | PS_CHANNEL_RGB, +// PS_REGISTER_C0 | PS_INPUTMAPPING_UNSIGNED_IDENTITY | PS_CHANNEL_ALPHA, +// PS_REGISTER_ZERO, +// PS_REGISTER_ZERO); +// +// shader.PSFinalCombinerInputsABCD= PS_COMBINERINPUTS( +// PS_REGISTER_T0 | PS_INPUTMAPPING_UNSIGNED_IDENTITY | PS_CHANNEL_ALPHA, +// PS_REGISTER_ZERO | PS_INPUTMAPPING_EXPAND_NORMAL | PS_CHANNEL_RGB, +// PS_REGISTER_EFPROD | PS_INPUTMAPPING_UNSIGNED_INVERT | PS_CHANNEL_RGB, +// PS_REGISTER_ZERO); +// +// PS_FINALCOMBINERSETTING is set in 4th field of PSFinalCombinerInputsEFG with PS_COMBINERINPUTS +// example: +// +// shader.PSFinalCombinerInputsEFG= PS_COMBINERINPUTS( +// PS_REGISTER_R0 | PS_INPUTMAPPING_UNSIGNED_IDENTITY | PS_CHANNEL_RGB, +// PS_REGISTER_R1 | PS_INPUTMAPPING_UNSIGNED_IDENTITY | PS_CHANNEL_RGB, +// PS_REGISTER_R1 | PS_INPUTMAPPING_UNSIGNED_IDENTITY | PS_CHANNEL_BLUE, +// PS_FINALCOMBINERSETTING_CLAMP_SUM | PS_FINALCOMBINERSETTING_COMPLEMENT_R0); + +#define PS_COMBINERINPUTS(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d)) +// For PSFinalCombinerInputsEFG, +// a,b,c contain a value from PS_REGISTER, PS_CHANNEL, and PS_INPUTMAPPING for input E,F, and G +// d contains values from PS_FINALCOMBINERSETTING +// For all other inputs, +// a,b,c,d each contain a value from PS_REGISTER, PS_CHANNEL, and PS_INPUTMAPPING + +enum PS_INPUTMAPPING +{ + PS_INPUTMAPPING_UNSIGNED_IDENTITY= 0x00L, // max(0,x) OK for final combiner + PS_INPUTMAPPING_UNSIGNED_INVERT= 0x20L, // 1 - max(0,x) OK for final combiner + PS_INPUTMAPPING_EXPAND_NORMAL= 0x40L, // 2*max(0,x) - 1 invalid for final combiner + PS_INPUTMAPPING_EXPAND_NEGATE= 0x60L, // 1 - 2*max(0,x) invalid for final combiner + PS_INPUTMAPPING_HALFBIAS_NORMAL= 0x80L, // max(0,x) - 1/2 invalid for final combiner + PS_INPUTMAPPING_HALFBIAS_NEGATE= 0xa0L, // 1/2 - max(0,x) invalid for final combiner + PS_INPUTMAPPING_SIGNED_IDENTITY= 0xc0L, // x invalid for final combiner + PS_INPUTMAPPING_SIGNED_NEGATE= 0xe0L, // -x invalid for final combiner +}; + +enum PS_REGISTER +{ + PS_REGISTER_ZERO= 0x00L, // r + PS_REGISTER_DISCARD= 0x00L, // w + PS_REGISTER_C0= 0x01L, // r + PS_REGISTER_C1= 0x02L, // r + PS_REGISTER_FOG= 0x03L, // r + PS_REGISTER_V0= 0x04L, // r/w + PS_REGISTER_V1= 0x05L, // r/w + PS_REGISTER_T0= 0x08L, // r/w + PS_REGISTER_T1= 0x09L, // r/w + PS_REGISTER_T2= 0x0aL, // r/w + PS_REGISTER_T3= 0x0bL, // r/w + PS_REGISTER_R0= 0x0cL, // r/w + PS_REGISTER_R1= 0x0dL, // r/w + PS_REGISTER_V1R0_SUM= 0x0eL, // r + PS_REGISTER_EF_PROD= 0x0fL, // r + + PS_REGISTER_ONE= PS_REGISTER_ZERO | PS_INPUTMAPPING_UNSIGNED_INVERT, // OK for final combiner + PS_REGISTER_NEGATIVE_ONE= PS_REGISTER_ZERO | PS_INPUTMAPPING_EXPAND_NORMAL, // invalid for final combiner + PS_REGISTER_ONE_HALF= PS_REGISTER_ZERO | PS_INPUTMAPPING_HALFBIAS_NEGATE, // invalid for final combiner + PS_REGISTER_NEGATIVE_ONE_HALF= PS_REGISTER_ZERO | PS_INPUTMAPPING_HALFBIAS_NORMAL, // invalid for final combiner +}; + +// FOG ALPHA is only available in final combiner +// V1R0_SUM and EF_PROD are only available in final combiner (A,B,C,D inputs only) +// V1R0_SUM_ALPHA and EF_PROD_ALPHA are not available +// R0_ALPHA is initialized to T0_ALPHA in stage0 + +enum PS_CHANNEL +{ + PS_CHANNEL_RGB= 0x00, // used as RGB source + PS_CHANNEL_BLUE= 0x00, // used as ALPHA source + PS_CHANNEL_ALPHA= 0x10, // used as RGB or ALPHA source +}; + + +enum PS_FINALCOMBINERSETTING +{ + PS_FINALCOMBINERSETTING_CLAMP_SUM= 0x80, // V1+R0 sum clamped to [0,1] + + PS_FINALCOMBINERSETTING_COMPLEMENT_V1= 0x40, // unsigned invert mapping + + PS_FINALCOMBINERSETTING_COMPLEMENT_R0= 0x20, // unsigned invert mapping +}; + +// ========================================================================================================= +// PSRGBOutputs[0-7] +// PSAlphaOutputs[0-7] +// --------.--------.--------.----xxxx // CD register +// --------.--------.--------.xxxx---- // AB register +// --------.--------.----xxxx.-------- // SUM register +// --------.--------.---x----.-------- // CD output (0= multiply, 1= dot product) +// --------.--------.--x-----.-------- // AB output (0= multiply, 1= dot product) +// --------.--------.-x------.-------- // AB_CD mux/sum select (0= sum, 1= mux) +// --------.------xx.x-------.-------- // Output mapping +// --------.-----x--.--------.-------- // CD blue to alpha +// --------.----x---.--------.-------- // AB blue to alpha + +#define PS_COMBINEROUTPUTS(ab,cd,mux_sum,flags) (((flags)<<12)|((mux_sum)<<8)|((ab)<<4)|(cd)) +// ab,cd,mux_sum contain a value from PS_REGISTER +// flags contains values from PS_COMBINEROUTPUT + +enum PS_COMBINEROUTPUT +{ + PS_COMBINEROUTPUT_IDENTITY= 0x00L, // y = x + PS_COMBINEROUTPUT_BIAS= 0x08L, // y = x - 0.5 + PS_COMBINEROUTPUT_SHIFTLEFT_1= 0x10L, // y = x*2 + PS_COMBINEROUTPUT_SHIFTLEFT_1_BIAS= 0x18L, // y = (x - 0.5)*2 + PS_COMBINEROUTPUT_SHIFTLEFT_2= 0x20L, // y = x*4 + PS_COMBINEROUTPUT_SHIFTRIGHT_1= 0x30L, // y = x/2 + + PS_COMBINEROUTPUT_AB_BLUE_TO_ALPHA= 0x80L, // RGB only + + PS_COMBINEROUTPUT_CD_BLUE_TO_ALPHA= 0x40L, // RGB only + + PS_COMBINEROUTPUT_AB_MULTIPLY= 0x00L, + PS_COMBINEROUTPUT_AB_DOT_PRODUCT= 0x02L, // RGB only + + PS_COMBINEROUTPUT_CD_MULTIPLY= 0x00L, + PS_COMBINEROUTPUT_CD_DOT_PRODUCT= 0x01L, // RGB only + + PS_COMBINEROUTPUT_AB_CD_SUM= 0x00L, // 3rd output is AB+CD + PS_COMBINEROUTPUT_AB_CD_MUX= 0x04L, // 3rd output is MUX(AB,CD) based on R0.a +}; + +// AB_CD register output must be DISCARD if either AB_DOT_PRODUCT or CD_DOT_PRODUCT are set + +// ========================================================================================================= +// PSC0Mapping +// PSC1Mapping +// --------.--------.--------.----xxxx // offset of D3D constant for stage 0 +// --------.--------.--------.xxxx---- // offset of D3D constant for stage 1 +// --------.--------.----xxxx.-------- // offset of D3D constant for stage 2 +// --------.--------.xxxx----.-------- // offset of D3D constant for stage 3 +// --------.----xxxx.--------.-------- // offset of D3D constant for stage 4 +// --------.xxxx----.--------.-------- // offset of D3D constant for stage 5 +// ----xxxx.--------.--------.-------- // offset of D3D constant for stage 6 +// xxxx----.--------.--------.-------- // offset of D3D constant for stage 7 + +#define PS_CONSTANTMAPPING(s0,s1,s2,s3,s4,s5,s6,s7) \ + (((DWORD)(s0)&0xf)<< 0) | (((DWORD)(s1)&0xf)<< 4) | \ + (((DWORD)(s2)&0xf)<< 8) | (((DWORD)(s3)&0xf)<<12) | \ + (((DWORD)(s4)&0xf)<<16) | (((DWORD)(s5)&0xf)<<20) | \ + (((DWORD)(s6)&0xf)<<24) | (((DWORD)(s7)&0xf)<<28) +// s0-s7 contain the offset of the D3D constant that corresponds to the +// c0 or c1 constant in stages 0 through 7. These mappings are only used in +// SetPixelShaderConstant(). + +// ========================================================================================================= +// PSFinalCombinerConstants +// --------.--------.--------.----xxxx // offset of D3D constant for C0 +// --------.--------.--------.xxxx---- // offset of D3D constant for C1 +// --------.--------.-------x.-------- // Adjust texture flag + +#define PS_FINALCOMBINERCONSTANTS(c0,c1,flags) (((DWORD)(flags) << 8) | ((DWORD)(c0)&0xf)<< 0) | (((DWORD)(c1)&0xf)<< 4) +// c0 and c1 contain the offset of the D3D constant that corresponds to the +// constants in the final combiner. These mappings are only used in +// SetPixelShaderConstant(). Flags contains values from PS_GLOBALFLAGS + +enum PS_GLOBALFLAGS +{ + // if this flag is set, the texture mode for each texture stage is adjusted as follows: + // if set texture is a cubemap, + // change PS_TEXTUREMODES_PROJECT2D to PS_TEXTUREMODES_CUBEMAP + // change PS_TEXTUREMODES_PROJECT3D to PS_TEXTUREMODES_CUBEMAP + // change PS_TEXTUREMODES_DOT_STR_3D to PS_TEXTUREMODES_DOT_STR_CUBE + // if set texture is a volume texture, + // change PS_TEXTUREMODES_PROJECT2D to PS_TEXTUREMODES_PROJECT3D + // change PS_TEXTUREMODES_CUBEMAP to PS_TEXTUREMODES_PROJECT3D + // change PS_TEXTUREMODES_DOT_STR_CUBE to PS_TEXTUREMODES_DOT_STR_3D + // if set texture is neither cubemap or volume texture, + // change PS_TEXTUREMODES_PROJECT3D to PS_TEXTUREMODES_PROJECT2D + // change PS_TEXTUREMODES_CUBEMAP to PS_TEXTUREMODES_PROJECT2D + + PS_GLOBALFLAGS_NO_TEXMODE_ADJUST= 0x0000L, // don't adjust texture modes + PS_GLOBALFLAGS_TEXMODE_ADJUST= 0x0001L, // adjust texture modes according to set texture +}; + +// dump pixel shader definition to file +void DumpPixelShaderDefToFile( X_D3DPIXELSHADERDEF* pPSDef ); +// print relevant contents to the debug console +void PrintPixelShaderDefContents( X_D3DPIXELSHADERDEF* pDSDef ); +// Recompile Xbox PixelShader def +HRESULT EmuRecompilePshDef( X_D3DPIXELSHADERDEF* pPSDef, LPD3DXBUFFER* ppRecompiled ); + +#ifdef _DEBUG_TRACK_PS +#define DbgPshPrintf if(g_bPrintfOn) printf +#else +inline void null_func_psh(...) { } +#define DbgPshPrintf XTL::null_func_psh +#endif + +#endif \ No newline at end of file diff --git a/src/CxbxKrnl/EmuD3D8/PushBuffer.cpp b/src/CxbxKrnl/EmuD3D8/PushBuffer.cpp index b30107230..274da0e3b 100644 --- a/src/CxbxKrnl/EmuD3D8/PushBuffer.cpp +++ b/src/CxbxKrnl/EmuD3D8/PushBuffer.cpp @@ -267,7 +267,21 @@ extern void XTL::EmuExecutePushBufferRaw if(!VshHandleIsVertexShader(dwVertexShader)) { - if(dwVertexShader & D3DFVF_XYZRHW) { dwStride += sizeof(FLOAT)*4; } + /*if(dwVertexShader & D3DFVF_XYZRHW) { dwStride += sizeof(FLOAT)*4; } + if(dwVertexShader & D3DFVF_XYZ) { dwStride += sizeof(FLOAT)*3; } + if(dwVertexShader & D3DFVF_XYZB1) { dwStride += sizeof(FLOAT); } + if(dwVertexShader & D3DFVF_XYZB2) { dwStride += sizeof(FLOAT)*2; } + if(dwVertexShader & D3DFVF_XYZB3) { dwStride += sizeof(FLOAT)*3; } + if(dwVertexShader & D3DFVF_XYZB4) { dwStride += sizeof(FLOAT)*4; }*/ + + if((dwVertexShader & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW){ dwStride += sizeof(FLOAT)*4; } + if((dwVertexShader & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) { dwStride += sizeof(FLOAT)*3; } + if((dwVertexShader & D3DFVF_POSITION_MASK) == D3DFVF_XYZB1) { dwStride += sizeof(FLOAT)*4; } + if((dwVertexShader & D3DFVF_POSITION_MASK) == D3DFVF_XYZB2) { dwStride += sizeof(FLOAT)*5; } + if((dwVertexShader & D3DFVF_POSITION_MASK) == D3DFVF_XYZB3) { dwStride += sizeof(FLOAT)*6; } + if((dwVertexShader & D3DFVF_POSITION_MASK) == D3DFVF_XYZB4) { dwStride += sizeof(FLOAT)*7; } + + if(dwVertexShader & D3DFVF_NORMAL) { dwStride += sizeof(FLOAT)*3; } if(dwVertexShader & D3DFVF_DIFFUSE) { dwStride += sizeof(DWORD); } if(dwVertexShader & D3DFVF_SPECULAR) { dwStride += sizeof(DWORD); } @@ -329,7 +343,7 @@ extern void XTL::EmuExecutePushBufferRaw VertexPatcher VertPatch; - bool bPatched = VertPatch.Apply(&VPDesc); + bool bPatched = VertPatch.Apply(&VPDesc, NULL); g_pD3DDevice8->DrawPrimitiveUP ( @@ -425,7 +439,7 @@ extern void XTL::EmuExecutePushBufferRaw VertexPatcher VertPatch; - bool bPatched = VertPatch.Apply(&VPDesc); + bool bPatched = VertPatch.Apply(&VPDesc, NULL); g_pD3DDevice8->SetIndices(pIndexBuffer, 0); @@ -588,7 +602,7 @@ extern void XTL::EmuExecutePushBufferRaw VertexPatcher VertPatch; - bool bPatched = VertPatch.Apply(&VPDesc); + bool bPatched = VertPatch.Apply(&VPDesc, NULL); g_pD3DDevice8->SetIndices(pIndexBuffer, 0); diff --git a/src/CxbxKrnl/EmuD3D8/State.cpp b/src/CxbxKrnl/EmuD3D8/State.cpp index 56a0e9b64..8b12a6b4d 100644 --- a/src/CxbxKrnl/EmuD3D8/State.cpp +++ b/src/CxbxKrnl/EmuD3D8/State.cpp @@ -41,6 +41,9 @@ DWORD *XTL::EmuD3DDeferredRenderState; DWORD *XTL::EmuD3DDeferredTextureState; +extern uint32 g_BuildVersion; +extern uint32 g_OrigBuildVersion; + // ****************************************************************** // * func: EmuUpdateDeferredStates // ****************************************************************** @@ -153,6 +156,11 @@ void XTL::EmuUpdateDeferredStates() //**/ } + // For 3925, the actual D3DTSS flags have different values. + bool bHack3925 = (g_BuildVersion == 3925) ? true : false; + int Adjust1 = bHack3925 ? 12 : 0; + int Adjust2 = bHack3925 ? 10 : 0; + // Certain D3DTS values need to be checked on each Draw[Indexed]Vertices if(EmuD3DDeferredTextureState != 0) { @@ -160,118 +168,123 @@ void XTL::EmuUpdateDeferredStates() { ::DWORD *pCur = &EmuD3DDeferredTextureState[v*32]; - if(pCur[0] != X_D3DTSS_UNK) + if(pCur[0+Adjust2] != X_D3DTSS_UNK) { - if(pCur[0] == 5) + if(pCur[0+Adjust2] == 5) CxbxKrnlCleanup("ClampToEdge is unsupported (temporarily)"); g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ADDRESSU, pCur[0]); } - if(pCur[1] != X_D3DTSS_UNK) + if(pCur[1+Adjust2] != X_D3DTSS_UNK) { - if(pCur[1] == 5) + if(pCur[1+Adjust2] == 5) CxbxKrnlCleanup("ClampToEdge is unsupported (temporarily)"); g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ADDRESSV, pCur[1]); } - if(pCur[2] != X_D3DTSS_UNK) + if(pCur[2+Adjust2] != X_D3DTSS_UNK) { - if(pCur[2] == 5) + if(pCur[2+Adjust2] == 5) CxbxKrnlCleanup("ClampToEdge is unsupported (temporarily)"); g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ADDRESSW, pCur[2]); } - if(pCur[3] != X_D3DTSS_UNK) + if(pCur[3+Adjust2] != X_D3DTSS_UNK) { - if(pCur[3] == 4) + if(pCur[3+Adjust2] == 4) CxbxKrnlCleanup("QuinCunx is unsupported (temporarily)"); - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MAGFILTER, pCur[3]); + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MAGFILTER, pCur[3+Adjust2]); } - if(pCur[4] != X_D3DTSS_UNK) + if(pCur[4+Adjust2] != X_D3DTSS_UNK) { - if(pCur[4] == 4) + if(pCur[4+Adjust2] == 4) CxbxKrnlCleanup("QuinCunx is unsupported (temporarily)"); - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MINFILTER, pCur[4]); + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MINFILTER, pCur[4+Adjust2]); } - if(pCur[5] != X_D3DTSS_UNK) + if(pCur[5+Adjust2] != X_D3DTSS_UNK) { - if(pCur[5] == 4) + if(pCur[5+Adjust2] == 4) CxbxKrnlCleanup("QuinCunx is unsupported (temporarily)"); - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MIPFILTER, pCur[5]); + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MIPFILTER, pCur[5+Adjust2]); } - if(pCur[6] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MIPMAPLODBIAS, pCur[6]); + if(pCur[6+Adjust2] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MIPMAPLODBIAS, pCur[6+Adjust2]); - if(pCur[7] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MAXMIPLEVEL, pCur[7]); + if(pCur[7+Adjust2] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MAXMIPLEVEL, pCur[7+Adjust2]); - if(pCur[8] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MAXANISOTROPY, pCur[8]); + if(pCur[8+Adjust2] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_MAXANISOTROPY, pCur[8+Adjust2]); // TODO: Use a lookup table, this is not always a 1:1 map - if(pCur[12] != X_D3DTSS_UNK) + if(pCur[12-Adjust1] != X_D3DTSS_UNK) { - if(pCur[12] > 12 && !(pCur[12] >= 17 && pCur[12] <= 21) && (pCur[12] != 22) && (pCur[12] != 14) && - (pCur[12] != 15)) - CxbxKrnlCleanup("(Temporarily) Unsupported D3DTSS_COLOROP Value (%d)", pCur[12]); + if(pCur[12-Adjust1] > 12 && !(pCur[12-Adjust1] >= 17 && pCur[12-Adjust1] <= 21) && + (pCur[12-Adjust1] != 22) && (pCur[12-Adjust1] != 14) && + (pCur[12-Adjust1] != 15) && (pCur[12-Adjust1] != 13)) + CxbxKrnlCleanup("(Temporarily) Unsupported D3DTSS_COLOROP Value (%d)", pCur[12-Adjust1]); // Dirty Hack: 22 == D3DTOP_DOTPRODUCT3 - if( pCur[12] == 22 ) + if( pCur[12-Adjust1] == 22 ) g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLOROP, D3DTOP_DOTPRODUCT3); - else if( pCur[12] == 14 ) + else if( pCur[12-Adjust1] == 14 ) g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLOROP, D3DTOP_BLENDTEXTUREALPHA); - else if( pCur[12] == 15 ) + else if( pCur[12-Adjust1] == 15 ) g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLOROP, D3DTOP_BLENDFACTORALPHA); + else if( pCur[12-Adjust1] == 13 ) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLOROP, D3DTOP_BLENDCURRENTALPHA); else - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLOROP, pCur[12]); + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLOROP, pCur[12-Adjust1]); } - if(pCur[13] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLORARG0, pCur[13]); + if(pCur[13-Adjust1] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLORARG0, pCur[13-Adjust1]); - if(pCur[14] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLORARG1, pCur[14]); + if(pCur[14-Adjust1] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLORARG1, pCur[14-Adjust1]); - if(pCur[15] != X_D3DTSS_UNK) + if(pCur[15-Adjust1] != X_D3DTSS_UNK) g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLORARG2, pCur[15]); // TODO: Use a lookup table, this is not always a 1:1 map (same as D3DTSS_COLOROP) - if(pCur[16] != X_D3DTSS_UNK) + if(pCur[16-Adjust1] != X_D3DTSS_UNK) { - if(pCur[16] > 12 && pCur[16] != 14) - CxbxKrnlCleanup("(Temporarily) Unsupported D3DTSS_ALPHAOP Value (%d)", pCur[16]); + if(pCur[16-Adjust1] > 12 && pCur[16-Adjust1] != 14 && pCur[16-Adjust1] != 13) + CxbxKrnlCleanup("(Temporarily) Unsupported D3DTSS_ALPHAOP Value (%d)", pCur[16-Adjust1]); - if( pCur[16] == 14 ) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAOP, D3DTOP_BLENDTEXTUREALPHA ); - if( pCur[16] == 15 ) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAOP, D3DTOP_BLENDFACTORALPHA ); + if( pCur[16-Adjust1] == 14 ) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAOP, D3DTOP_BLENDTEXTUREALPHA); + if( pCur[16-Adjust1] == 15 ) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAOP, D3DTOP_BLENDFACTORALPHA); + if( pCur[16-Adjust1] == 13 ) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAOP, D3DTOP_BLENDCURRENTALPHA); else - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAOP, pCur[16]); + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAOP, pCur[16-Adjust1]); } - if(pCur[17] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAARG0, pCur[17]); + if(pCur[17-Adjust1] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAARG0, pCur[17-Adjust1]); - if(pCur[18] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAARG1, pCur[18]); + if(pCur[18-Adjust1] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAARG1, pCur[18-Adjust1]); - if(pCur[19] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAARG2, pCur[19]); + if(pCur[19-Adjust1] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAARG2, pCur[19-Adjust1]); - if(pCur[20] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_RESULTARG, pCur[20]); + if(pCur[20-Adjust1] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_RESULTARG, pCur[20-Adjust1]); - if(pCur[21] != X_D3DTSS_UNK) - g_pD3DDevice8->SetTextureStageState(v, D3DTSS_TEXTURETRANSFORMFLAGS, pCur[21]); + if(pCur[21-Adjust1] != X_D3DTSS_UNK) + g_pD3DDevice8->SetTextureStageState(v, D3DTSS_TEXTURETRANSFORMFLAGS, pCur[21-Adjust1]); if(pCur[29] != X_D3DTSS_UNK) g_pD3DDevice8->SetTextureStageState(v, D3DTSS_BORDERCOLOR, pCur[29]); diff --git a/src/CxbxKrnl/EmuD3D8/VertexBuffer.cpp b/src/CxbxKrnl/EmuD3D8/VertexBuffer.cpp index 0e5cd741f..477aa154f 100644 --- a/src/CxbxKrnl/EmuD3D8/VertexBuffer.cpp +++ b/src/CxbxKrnl/EmuD3D8/VertexBuffer.cpp @@ -51,6 +51,7 @@ XTL::X_D3DPRIMITIVETYPE XTL::g_IVBPrimitiveType = XTL::X_D3DPT_INVALID; UINT XTL::g_IVBTblOffs = 0; struct XTL::_D3DIVB *XTL::g_IVBTable = 0; extern DWORD XTL::g_IVBFVF = 0; +extern XTL::X_D3DVertexBuffer *g_pVertexBuffer = NULL; static unsigned int crctab[256]; @@ -144,7 +145,7 @@ void XTL::VertexPatcher::CacheStream(VertexPatchDesc *pPatchDesc, UINT uiStride; IDirect3DVertexBuffer8 *pOrigVertexBuffer; XTL::D3DVERTEXBUFFER_DESC Desc; - void *pCalculateData; + void *pCalculateData = NULL; uint32 uiKey; UINT uiLength; CACHEDSTREAM *pCachedStream = (CACHEDSTREAM *)CxbxMalloc(sizeof(CACHEDSTREAM)); @@ -262,12 +263,13 @@ void XTL::VertexPatcher::FreeCachedStream(void *pStream) } bool XTL::VertexPatcher::ApplyCachedStream(VertexPatchDesc *pPatchDesc, - UINT uiStream) + UINT uiStream, + bool *pbFatalError) { UINT uiStride; IDirect3DVertexBuffer8 *pOrigVertexBuffer; XTL::D3DVERTEXBUFFER_DESC Desc; - void *pCalculateData; + void *pCalculateData = NULL; UINT uiLength; bool bApplied = false; uint32 uiKey; @@ -276,7 +278,20 @@ bool XTL::VertexPatcher::ApplyCachedStream(VertexPatchDesc *pPatchDesc, if(!pPatchDesc->pVertexStreamZeroData) { g_pD3DDevice8->GetStreamSource(uiStream, &pOrigVertexBuffer, &uiStride); - if(FAILED(pOrigVertexBuffer->GetDesc(&Desc))) + if(!pOrigVertexBuffer) + { + /*if(!g_pVertexBuffer || !g_pVertexBuffer->EmuVertexBuffer8) + CxbxKrnlCleanup("Unable to retrieve original buffer (Stream := %d)", uiStream); + else + pOrigVertexBuffer = g_pVertexBuffer->EmuVertexBuffer8;*/ + + if(pbFatalError) + *pbFatalError = true; + + return false; + } + + if(FAILED(pOrigVertexBuffer->GetDesc(&Desc))) { CxbxKrnlCleanup("Could not retrieve original buffer size"); } @@ -731,9 +746,10 @@ bool XTL::VertexPatcher::NormalizeTexCoords(VertexPatchDesc *pPatchDesc, UINT ui else { // Copy stream for patching and caching. + g_pD3DDevice8->GetStreamSource(uiStream, &pOrigVertexBuffer, &uiStride); XTL::D3DVERTEXBUFFER_DESC Desc; - if(FAILED(pOrigVertexBuffer->GetDesc(&Desc))) + if(!pOrigVertexBuffer || FAILED(pOrigVertexBuffer->GetDesc(&Desc))) { CxbxKrnlCleanup("Could not retrieve original FVF buffer size."); } @@ -883,7 +899,10 @@ bool XTL::VertexPatcher::PatchPrimitive(VertexPatchDesc *pPatchDesc, switch(pPatchDesc->PrimitiveType) { case X_D3DPT_QUADLIST: + //EmuWarning("VertexPatcher::PatchPrimitive: Processing D3DPT_QUADLIST"); + break; case X_D3DPT_LINELOOP: + //EmuWarning("VertexPatcher::PatchPrimitive: Processing D3DPT_LINELOOP"); break; default: @@ -993,13 +1012,13 @@ bool XTL::VertexPatcher::PatchPrimitive(VertexPatchDesc *pPatchDesc, if(pPatchDesc->PrimitiveType == X_D3DPT_QUADLIST) { uint08 *pPatch1 = &pPatchedVertexData[pPatchDesc->dwOffset * pStream->uiOrigStride]; - uint08 *pPatch2 = &pPatchedVertexData[pPatchDesc->dwOffset + 3 * pStream->uiOrigStride]; - uint08 *pPatch3 = &pPatchedVertexData[pPatchDesc->dwOffset + 4 * pStream->uiOrigStride]; - uint08 *pPatch4 = &pPatchedVertexData[pPatchDesc->dwOffset + 5 * pStream->uiOrigStride]; + uint08 *pPatch2 = &pPatchedVertexData[(pPatchDesc->dwOffset + 3) * pStream->uiOrigStride]; + uint08 *pPatch3 = &pPatchedVertexData[(pPatchDesc->dwOffset + 4) * pStream->uiOrigStride]; + uint08 *pPatch4 = &pPatchedVertexData[(pPatchDesc->dwOffset + 5) * pStream->uiOrigStride]; uint08 *pOrig1 = &pOrigVertexData[pPatchDesc->dwOffset * pStream->uiOrigStride]; - uint08 *pOrig2 = &pOrigVertexData[pPatchDesc->dwOffset + 2 * pStream->uiOrigStride]; - uint08 *pOrig3 = &pOrigVertexData[pPatchDesc->dwOffset + 3 * pStream->uiOrigStride]; + uint08 *pOrig2 = &pOrigVertexData[(pPatchDesc->dwOffset + 2) * pStream->uiOrigStride]; + uint08 *pOrig3 = &pOrigVertexData[(pPatchDesc->dwOffset + 3) * pStream->uiOrigStride]; for(uint32 i = 0;i < pPatchDesc->dwPrimitiveCount/2;i++) { @@ -1049,7 +1068,7 @@ bool XTL::VertexPatcher::PatchPrimitive(VertexPatchDesc *pPatchDesc, return true; } -bool XTL::VertexPatcher::Apply(VertexPatchDesc *pPatchDesc) +bool XTL::VertexPatcher::Apply(VertexPatchDesc *pPatchDesc, bool *pbFatalError) { bool Patched = false; // Get the number of streams @@ -1062,7 +1081,7 @@ bool XTL::VertexPatcher::Apply(VertexPatchDesc *pPatchDesc) { bool LocalPatched = false; - if(ApplyCachedStream(pPatchDesc, uiStream)) + if(ApplyCachedStream(pPatchDesc, uiStream, pbFatalError)) { m_pStreams[uiStream].bUsedCached = true; continue; @@ -1136,6 +1155,13 @@ VOID XTL::EmuFlushIVB() if(bFVF && ((g_CurrentVertexShader & D3DFVF_POSITION_MASK) != D3DFVF_XYZRHW)) { dwCurFVF = g_CurrentVertexShader; + + // HACK: Halo... + if(dwCurFVF == 0) + { + EmuWarning("EmuFlushIVB(): using g_IVBFVF instead of current FVF!"); + dwCurFVF = g_IVBFVF; + } } else { @@ -1176,13 +1202,28 @@ VOID XTL::EmuFlushIVB() DbgPrintf("IVB Position := {%f, %f, %f, %f}\n", g_IVBTable[v].Position.x, g_IVBTable[v].Position.y, g_IVBTable[v].Position.z, g_IVBTable[v].Position.z, g_IVBTable[v].Rhw); } + else if(dwPos == D3DFVF_XYZB1) + { + *(FLOAT*)pdwVB++ = g_IVBTable[v].Position.x; + *(FLOAT*)pdwVB++ = g_IVBTable[v].Position.y; + *(FLOAT*)pdwVB++ = g_IVBTable[v].Position.z; + *(FLOAT*)pdwVB++ = g_IVBTable[v].Blend1; + + if(v == 0) + { + uiStride += (sizeof(FLOAT)*4); + } + + DbgPrintf("IVB Position := {%f, %f, %f, %f}\n", g_IVBTable[v].Position.x, g_IVBTable[v].Position.y, g_IVBTable[v].Position.z, g_IVBTable[v].Blend1); + } else { - CxbxKrnlCleanup("Unsupported Position Mask (FVF := 0x%.08X)", g_IVBFVF); + CxbxKrnlCleanup("Unsupported Position Mask (FVF := 0x%.08X dwPos := 0x%.08X)", dwCurFVF, dwPos); } - if(dwPos == D3DFVF_NORMAL) +// if(dwPos == D3DFVF_NORMAL) // <- This didn't look right but if it is, change it back... + if(dwCurFVF & D3DFVF_NORMAL) { *(FLOAT*)pdwVB++ = g_IVBTable[v].Normal.x; *(FLOAT*)pdwVB++ = g_IVBTable[v].Normal.y; @@ -1287,7 +1328,7 @@ VOID XTL::EmuFlushIVB() VertexPatcher VertPatch; - bool bPatched = VertPatch.Apply(&VPDesc); + bool bPatched = VertPatch.Apply(&VPDesc, NULL); if(bFVF) { diff --git a/src/CxbxKrnl/EmuD3D8/VertexBuffer.h b/src/CxbxKrnl/EmuD3D8/VertexBuffer.h index 0059ec289..de59c7b39 100644 --- a/src/CxbxKrnl/EmuD3D8/VertexBuffer.h +++ b/src/CxbxKrnl/EmuD3D8/VertexBuffer.h @@ -82,7 +82,7 @@ class VertexPatcher VertexPatcher(); ~VertexPatcher(); - bool Apply(VertexPatchDesc *pPatchDesc); + bool Apply(VertexPatchDesc *pPatchDesc, bool *pbFatalError); bool Restore(); // Dumps the cache to the console @@ -112,7 +112,8 @@ class VertexPatcher // Tries to apply a previously patched stream from the cache bool ApplyCachedStream(VertexPatchDesc *pPatchDesc, - UINT uiStream); + UINT uiStream, + bool *pbFatalError); // Patches the types of the stream bool PatchStream(VertexPatchDesc *pPatchDesc, UINT uiStream); @@ -133,6 +134,7 @@ extern struct _D3DIVB { XTL::D3DXVECTOR3 Position; // Position FLOAT Rhw; // Rhw + FLOAT Blend1; // Blend1 XTL::DWORD dwSpecular; // Specular XTL::DWORD dwDiffuse; // Diffuse XTL::D3DXVECTOR3 Normal; // Normal diff --git a/src/CxbxKrnl/EmuD3D8/VertexShader - Copy.cpp b/src/CxbxKrnl/EmuD3D8/VertexShader - Copy.cpp new file mode 100644 index 000000000..4b4d4285e --- /dev/null +++ b/src/CxbxKrnl/EmuD3D8/VertexShader - Copy.cpp @@ -0,0 +1,2095 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->EmuD3D8->VertexShader.cpp +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2004 Aaron Robinson +// * Kingofc +// * +// * All rights reserved +// * +// ****************************************************************** +#define _CXBXKRNL_INTERNAL +#define _XBOXKRNL_DEFEXTRN_ + +#include "CxbxKrnl/CxbxKrnl.h" +#include "CxbxKrnl/Emu.h" +#include "CxbxKrnl/EmuFS.h" +#include "CxbxKrnl/EmuAlloc.h" +#include "CxbxKrnl/EmuXTL.h" + +// **************************************************************************** +// * Vertex shader function recompiler +// **************************************************************************** + +// Local macros +#define VERSION_VS 0xF0 // vs.1.1, not an official value +#define VERSION_XVS 0x20 // Xbox vertex shader +#define VERSION_XVSS 0x73 // Xbox vertex state shader +#define VERSION_XVSW 0x77 // Xbox vertex read/write shader +#define VSH_XBOX_MAX_INSTRUCTION_COUNT 136 // The maximum Xbox shader instruction count +#define VSH_MAX_INTERMEDIATE_COUNT 1024 // The maximum number of intermediate format slots + +// Local types +typedef enum _VSH_FIELD_NAME +{ + FLD_ILU = 0, + FLD_MAC, + FLD_CONST, + FLD_V, + // Input A + FLD_A_NEG, + FLD_A_SWZ_X, + FLD_A_SWZ_Y, + FLD_A_SWZ_Z, + FLD_A_SWZ_W, + FLD_A_R, + FLD_A_MUX, + // Input B + FLD_B_NEG, + FLD_B_SWZ_X, + FLD_B_SWZ_Y, + FLD_B_SWZ_Z, + FLD_B_SWZ_W, + FLD_B_R, + FLD_B_MUX, + // Input C + FLD_C_NEG, + FLD_C_SWZ_X, + FLD_C_SWZ_Y, + FLD_C_SWZ_Z, + FLD_C_SWZ_W, + FLD_C_R_HIGH, + FLD_C_R_LOW, + FLD_C_MUX, + // Output + FLD_OUT_MAC_MASK_X, + FLD_OUT_MAC_MASK_Y, + FLD_OUT_MAC_MASK_Z, + FLD_OUT_MAC_MASK_W, + FLD_OUT_R, + FLD_OUT_ILU_MASK_X, + FLD_OUT_ILU_MASK_Y, + FLD_OUT_ILU_MASK_Z, + FLD_OUT_ILU_MASK_W, + FLD_OUT_O_MASK_X, + FLD_OUT_O_MASK_Y, + FLD_OUT_O_MASK_Z, + FLD_OUT_O_MASK_W, + FLD_OUT_ORB, + FLD_OUT_ADDRESS, + FLD_OUT_MUX, + // Relative addressing + FLD_A0X, + // Final instruction + FLD_FINAL +} +VSH_FIELD_NAME; + +typedef enum _VSH_OREG_NAME +{ + OREG_OPOS, + OREG_UNUSED1, + OREG_UNUSED2, + OREG_OD0, + OREG_OD1, + OREG_OFOG, + OREG_OPTS, + OREG_OB0, + OREG_OB1, + OREG_OT0, + OREG_OT1, + OREG_OT2, + OREG_OT3, + OREG_UNUSED3, + OREG_UNUSED4, + OREG_A0X +} +VSH_OREG_NAME; + +typedef enum _VSH_PARAMETER_TYPE +{ + PARAM_UNKNOWN = 0, + PARAM_R, + PARAM_V, + PARAM_C +} +VSH_PARAMETER_TYPE; + +typedef enum _VSH_OUTPUT_TYPE +{ + OUTPUT_C = 0, + OUTPUT_O +} +VSH_OUTPUT_TYPE; + +typedef enum _VSH_OUTPUT_MUX +{ + OMUX_MAC = 0, + OMUX_ILU +} +VSH_OUTPUT_MUX; + +typedef enum _VSH_ILU +{ + ILU_NOP = 0, + ILU_MOV, + ILU_RCP, + ILU_RCC, + ILU_RSQ, + ILU_EXP, + ILU_LOG, + ILU_LIT +} +VSH_ILU; + +typedef enum _VSH_MAC +{ + MAC_NOP, + MAC_MOV, + MAC_MUL, + MAC_ADD, + MAC_MAD, + MAC_DP3, + MAC_DPH, + MAC_DP4, + MAC_DST, + MAC_MIN, + MAC_MAX, + MAC_SLT, + MAC_SGE, + MAC_ARL +} +VSH_MAC; + +typedef struct _VSH_OPCODE_PARAMS +{ + VSH_ILU ILU; + VSH_MAC MAC; + boolean A; + boolean B; + boolean C; +} +VSH_OPCODE_PARAMS; + +typedef enum _VSH_SWIZZLE +{ + SWIZZLE_X = 0, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W +} +VSH_SWIZZLE; + +typedef struct _VSH_PARAMETER +{ + VSH_PARAMETER_TYPE ParameterType; // Parameter type, R, V or C + boolean Neg; // TRUE if negated, FALSE if not + VSH_SWIZZLE Swizzle[4]; // The four swizzles + int16 Address; // Register address +} +VSH_PARAMETER; + +typedef struct _VSH_OUTPUT +{ + // Output register + VSH_OUTPUT_MUX OutputMux; // MAC or ILU used as output + VSH_OUTPUT_TYPE OutputType; // C or O + boolean OutputMask[4]; + int16 OutputAddress; + // MAC output R register + boolean MACRMask[4]; + boolean MACRAddress; + // ILU output R register + boolean ILURMask[4]; + boolean ILURAddress; +} +VSH_OUTPUT; + +// The raw, parsed shader instruction (can be many combined [paired] instructions) +typedef struct _VSH_SHADER_INSTRUCTION +{ + VSH_ILU ILU; + VSH_MAC MAC; + VSH_OUTPUT Output; + VSH_PARAMETER A; + VSH_PARAMETER B; + VSH_PARAMETER C; + boolean a0x; +} +VSH_SHADER_INSTRUCTION; + +typedef enum _VSH_IMD_OUTPUT_TYPE +{ + IMD_OUTPUT_C, + IMD_OUTPUT_R, + IMD_OUTPUT_O, + IMD_OUTPUT_A0X +} +VSH_IMD_OUTPUT_TYPE; + +typedef enum _VSH_IMD_INSTRUCTION_TYPE +{ + IMD_MAC, + IMD_ILU +} +VSH_IMD_INSTRUCTION_TYPE; + +typedef struct _VSH_IMD_OUTPUT +{ + VSH_IMD_OUTPUT_TYPE Type; + boolean Mask[4]; + int16 Address; +} +VSH_IMD_OUTPUT; + +typedef struct _VSH_IMD_PARAMETER +{ + boolean Active; + VSH_PARAMETER Parameter; + boolean IsA0X; +} +VSH_IMD_PARAMETER; + +typedef struct _VSH_INTERMEDIATE_FORMAT +{ + + boolean IsCombined; + VSH_IMD_INSTRUCTION_TYPE InstructionType; + VSH_MAC MAC; + VSH_ILU ILU; + VSH_IMD_OUTPUT Output; + VSH_IMD_PARAMETER Parameters[3]; +} +VSH_INTERMEDIATE_FORMAT; + +// Used for xvu spec definition +typedef struct _VSH_FIELDMAPPING +{ + VSH_FIELD_NAME FieldName; + uint08 SubToken; + uint08 StartBit; + uint08 BitLength; +} +VSH_FIELDMAPPING; + +typedef struct _VSH_XBOX_SHADER +{ + XTL::VSH_SHADER_HEADER ShaderHeader; + uint16 IntermediateCount; + VSH_INTERMEDIATE_FORMAT Intermediate[VSH_MAX_INTERMEDIATE_COUNT]; +} +VSH_XBOX_SHADER; + +// Local constants +static const VSH_FIELDMAPPING g_FieldMapping[] = +{ + // Field Name DWORD BitPos BitSize + { FLD_ILU, 1, 25, 3 }, + { FLD_MAC, 1, 21, 4 }, + { FLD_CONST, 1, 13, 8 }, + { FLD_V, 1, 9, 4 }, + // INPUT A + { FLD_A_NEG, 1, 8, 1 }, + { FLD_A_SWZ_X, 1, 6, 2 }, + { FLD_A_SWZ_Y, 1, 4, 2 }, + { FLD_A_SWZ_Z, 1, 2, 2 }, + { FLD_A_SWZ_W, 1, 0, 2 }, + { FLD_A_R, 2, 28, 4 }, + { FLD_A_MUX, 2, 26, 2 }, + // INPUT B + { FLD_B_NEG, 2, 25, 1 }, + { FLD_B_SWZ_X, 2, 23, 2 }, + { FLD_B_SWZ_Y, 2, 21, 2 }, + { FLD_B_SWZ_Z, 2, 19, 2 }, + { FLD_B_SWZ_W, 2, 17, 2 }, + { FLD_B_R, 2, 13, 4 }, + { FLD_B_MUX, 2, 11, 2 }, + // INPUT C + { FLD_C_NEG, 2, 10, 1 }, + { FLD_C_SWZ_X, 2, 8, 2 }, + { FLD_C_SWZ_Y, 2, 6, 2 }, + { FLD_C_SWZ_Z, 2, 4, 2 }, + { FLD_C_SWZ_W, 2, 2, 2 }, + { FLD_C_R_HIGH, 2, 0, 2 }, + { FLD_C_R_LOW, 3, 30, 2 }, + { FLD_C_MUX, 3, 28, 2 }, + // Output + { FLD_OUT_MAC_MASK_X, 3, 27, 1 }, + { FLD_OUT_MAC_MASK_Y, 3, 26, 1 }, + { FLD_OUT_MAC_MASK_Z, 3, 25, 1 }, + { FLD_OUT_MAC_MASK_W, 3, 24, 1 }, + { FLD_OUT_R, 3, 20, 4 }, + { FLD_OUT_ILU_MASK_X, 3, 19, 1 }, + { FLD_OUT_ILU_MASK_Y, 3, 18, 1 }, + { FLD_OUT_ILU_MASK_Z, 3, 17, 1 }, + { FLD_OUT_ILU_MASK_W, 3, 16, 1 }, + { FLD_OUT_O_MASK_X, 3, 15, 1 }, + { FLD_OUT_O_MASK_Y, 3, 14, 1 }, + { FLD_OUT_O_MASK_Z, 3, 13, 1 }, + { FLD_OUT_O_MASK_W, 3, 12, 1 }, + { FLD_OUT_ORB, 3, 11, 1 }, + { FLD_OUT_ADDRESS, 3, 3, 8 }, + { FLD_OUT_MUX, 3, 2, 1 }, + // Other + { FLD_A0X, 3, 1, 1 }, + { FLD_FINAL, 3, 0, 1 } +}; + +static const VSH_OPCODE_PARAMS g_OpCodeParams[] = +{ + // ILU OP MAC OP ParamA ParamB ParamC + { ILU_MOV, MAC_NOP, FALSE, FALSE, TRUE }, + { ILU_RCP, MAC_NOP, FALSE, FALSE, TRUE }, + { ILU_RCC, MAC_NOP, FALSE, FALSE, TRUE }, + { ILU_RSQ, MAC_NOP, FALSE, FALSE, TRUE }, + { ILU_EXP, MAC_NOP, FALSE, FALSE, TRUE }, + { ILU_LOG, MAC_NOP, FALSE, FALSE, TRUE }, + { ILU_LIT, MAC_NOP, FALSE, FALSE, TRUE }, + { ILU_NOP, MAC_MOV, TRUE, FALSE, FALSE }, + { ILU_NOP, MAC_MUL, TRUE, TRUE, FALSE }, + { ILU_NOP, MAC_ADD, TRUE, FALSE, TRUE }, + { ILU_NOP, MAC_MAD, TRUE, TRUE, TRUE }, + { ILU_NOP, MAC_DP3, TRUE, TRUE, FALSE }, + { ILU_NOP, MAC_DPH, TRUE, TRUE, FALSE }, + { ILU_NOP, MAC_DP4, TRUE, TRUE, FALSE }, + { ILU_NOP, MAC_DST, TRUE, TRUE, FALSE }, + { ILU_NOP, MAC_MIN, TRUE, TRUE, FALSE }, + { ILU_NOP, MAC_MAX, TRUE, TRUE, FALSE }, + { ILU_NOP, MAC_SLT, TRUE, TRUE, FALSE }, + { ILU_NOP, MAC_SGE, TRUE, TRUE, FALSE }, + { ILU_NOP, MAC_ARL, TRUE, FALSE, FALSE } +}; + +static const char* MAC_OpCode[] = +{ + "nop", + "mov", + "mul", + "add", + "mad", + "dp3", + "dph", + "dp4", + "dst", + "min", + "max", + "slt", + "sge", + "mov", // really "arl" + "???", + "???" +}; + +static const char* ILU_OpCode[] = +{ + "nop", + "mov", + "rcp", + "rcc", + "rsq", + "exp", + "log", + "lit" +}; + +static const char* OReg_Name[] = +{ + "oPos", + "???", + "???", + "oD0", + "oD1", + "oFog", + "oPts", + "oB0", + "oB1", + "oT0", + "oT1", + "oT2", + "oT3", + "???", + "???", + "a0.x" +}; + +static inline int IsInUse(const boolean *pMask) +{ + return (pMask[0] || pMask[1] || pMask[2] || pMask[3]); +} + +static inline boolean HasMACR(VSH_SHADER_INSTRUCTION *pInstruction) +{ + return IsInUse(pInstruction->Output.MACRMask) && pInstruction->MAC != MAC_NOP; +} + +static inline boolean HasMACO(VSH_SHADER_INSTRUCTION *pInstruction) +{ + return IsInUse(pInstruction->Output.OutputMask) && + pInstruction->Output.OutputMux == OMUX_MAC && + pInstruction->MAC != MAC_NOP; +} + +static inline boolean HasMACARL(VSH_SHADER_INSTRUCTION *pInstruction) +{ + return /*!IsInUse(pInstruction->Output.OutputMask) && + pInstruction->Output.OutputMux == OMUX_MAC &&*/ + pInstruction->MAC == MAC_ARL; +} + +static inline boolean HasILUR(VSH_SHADER_INSTRUCTION *pInstruction) +{ + return IsInUse(pInstruction->Output.ILURMask) && pInstruction->ILU != ILU_NOP; +} + +static inline boolean HasILUO(VSH_SHADER_INSTRUCTION *pInstruction) +{ + return IsInUse(pInstruction->Output.OutputMask) && + pInstruction->Output.OutputMux == OMUX_ILU && + pInstruction->ILU != ILU_NOP; +} + +// Retrieves a number of bits in the instruction token +static inline int VshGetFromToken(uint32 *pShaderToken, + uint08 SubToken, + uint08 StartBit, + uint08 BitLength) +{ + return (pShaderToken[SubToken] >> StartBit) & ~(0xFFFFFFFF << BitLength); +} + +// Converts the C register address to disassembly format +static inline int16 ConvertCRegister(const int16 CReg) +{ + return ((((CReg >> 5) & 7) - 3) * 32) + (CReg & 31); +} + +uint08 VshGetField(uint32 *pShaderToken, + VSH_FIELD_NAME FieldName) +{ + return (uint08)(VshGetFromToken(pShaderToken, + g_FieldMapping[FieldName].SubToken, + g_FieldMapping[FieldName].StartBit, + g_FieldMapping[FieldName].BitLength)); +} + +static VSH_OPCODE_PARAMS* VshGetOpCodeParams(VSH_ILU ILU, + VSH_MAC MAC) +{ + int i; + + for (i = 0; i < (sizeof(g_OpCodeParams) / sizeof(VSH_OPCODE_PARAMS)); i++) + { + if(ILU != ILU_NOP && ILU == g_OpCodeParams[i].ILU || + MAC != MAC_NOP && MAC == g_OpCodeParams[i].MAC) + { + return (VSH_OPCODE_PARAMS*)&g_OpCodeParams[i]; + } + } + return NULL; +} + +static void VshParseInstruction(uint32 *pShaderToken, + VSH_SHADER_INSTRUCTION *pInstruction) +{ + // First get the instruction(s). + pInstruction->ILU = (VSH_ILU)VshGetField(pShaderToken, FLD_ILU); + pInstruction->MAC = (VSH_MAC)VshGetField(pShaderToken, FLD_MAC); + // Get parameter A + pInstruction->A.ParameterType = (VSH_PARAMETER_TYPE)VshGetField(pShaderToken, FLD_A_MUX); + switch(pInstruction->A.ParameterType) + { + case PARAM_R: + pInstruction->A.Address = VshGetField(pShaderToken, FLD_A_R); + break; + case PARAM_V: + pInstruction->A.Address = VshGetField(pShaderToken, FLD_V); + break; + case PARAM_C: + pInstruction->A.Address = ConvertCRegister(VshGetField(pShaderToken, FLD_CONST)); + break; + default: + EmuWarning("Invalid instruction, parameter A type unknown %d\n", pInstruction->A.ParameterType); + return; + } + pInstruction->A.Neg = VshGetField(pShaderToken, FLD_A_NEG); + pInstruction->A.Swizzle[0] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_A_SWZ_X); + pInstruction->A.Swizzle[1] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_A_SWZ_Y); + pInstruction->A.Swizzle[2] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_A_SWZ_Z); + pInstruction->A.Swizzle[3] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_A_SWZ_W); + // Get parameter B + pInstruction->B.ParameterType = (VSH_PARAMETER_TYPE)VshGetField(pShaderToken, FLD_B_MUX); + switch(pInstruction->B.ParameterType) + { + case PARAM_R: + pInstruction->B.Address = VshGetField(pShaderToken, FLD_B_R); + break; + case PARAM_V: + pInstruction->B.Address = VshGetField(pShaderToken, FLD_V); + break; + case PARAM_C: + pInstruction->B.Address = ConvertCRegister(VshGetField(pShaderToken, FLD_CONST)); + break; + default: + DbgVshPrintf("Invalid instruction, parameter B type unknown %d\n", pInstruction->B.ParameterType); + return; + } + pInstruction->B.Neg = VshGetField(pShaderToken, FLD_B_NEG); + pInstruction->B.Swizzle[0] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_B_SWZ_X); + pInstruction->B.Swizzle[1] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_B_SWZ_Y); + pInstruction->B.Swizzle[2] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_B_SWZ_Z); + pInstruction->B.Swizzle[3] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_B_SWZ_W); + // Get parameter C + pInstruction->C.ParameterType = (VSH_PARAMETER_TYPE)VshGetField(pShaderToken, FLD_C_MUX); + switch(pInstruction->C.ParameterType) + { + case PARAM_R: + pInstruction->C.Address = VshGetField(pShaderToken, FLD_C_R_HIGH) << 2 | + VshGetField(pShaderToken, FLD_C_R_LOW); + break; + case PARAM_V: + pInstruction->C.Address = VshGetField(pShaderToken, FLD_V); + break; + case PARAM_C: + pInstruction->C.Address = ConvertCRegister(VshGetField(pShaderToken, FLD_CONST)); + break; + default: + DbgVshPrintf("Invalid instruction, parameter C type unknown %d\n", pInstruction->C.ParameterType); + return; + } + pInstruction->C.Neg = VshGetField(pShaderToken, FLD_C_NEG); + pInstruction->C.Swizzle[0] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_C_SWZ_X); + pInstruction->C.Swizzle[1] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_C_SWZ_Y); + pInstruction->C.Swizzle[2] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_C_SWZ_Z); + pInstruction->C.Swizzle[3] = (VSH_SWIZZLE)VshGetField(pShaderToken, FLD_C_SWZ_W); + // Get output + // Output register + pInstruction->Output.OutputType = (VSH_OUTPUT_TYPE)VshGetField(pShaderToken, FLD_OUT_ORB); + switch(pInstruction->Output.OutputType) + { + case OUTPUT_C: + pInstruction->Output.OutputAddress = ConvertCRegister(VshGetField(pShaderToken, FLD_OUT_ADDRESS)); + break; + case OUTPUT_O: + pInstruction->Output.OutputAddress = VshGetField(pShaderToken, FLD_OUT_ADDRESS) & 0xF; + break; + } + pInstruction->Output.OutputMux = (VSH_OUTPUT_MUX)VshGetField(pShaderToken, FLD_OUT_MUX); + pInstruction->Output.OutputMask[0] = VshGetField(pShaderToken, FLD_OUT_O_MASK_X); + pInstruction->Output.OutputMask[1] = VshGetField(pShaderToken, FLD_OUT_O_MASK_Y); + pInstruction->Output.OutputMask[2] = VshGetField(pShaderToken, FLD_OUT_O_MASK_Z); + pInstruction->Output.OutputMask[3] = VshGetField(pShaderToken, FLD_OUT_O_MASK_W); + // MAC output + pInstruction->Output.MACRMask[0] = VshGetField(pShaderToken, FLD_OUT_MAC_MASK_X); + pInstruction->Output.MACRMask[1] = VshGetField(pShaderToken, FLD_OUT_MAC_MASK_Y); + pInstruction->Output.MACRMask[2] = VshGetField(pShaderToken, FLD_OUT_MAC_MASK_Z); + pInstruction->Output.MACRMask[3] = VshGetField(pShaderToken, FLD_OUT_MAC_MASK_W); + pInstruction->Output.MACRAddress = VshGetField(pShaderToken, FLD_OUT_R); + // ILU output + pInstruction->Output.ILURMask[0] = VshGetField(pShaderToken, FLD_OUT_ILU_MASK_X); + pInstruction->Output.ILURMask[1] = VshGetField(pShaderToken, FLD_OUT_ILU_MASK_Y); + pInstruction->Output.ILURMask[2] = VshGetField(pShaderToken, FLD_OUT_ILU_MASK_Z); + pInstruction->Output.ILURMask[3] = VshGetField(pShaderToken, FLD_OUT_ILU_MASK_W); + pInstruction->Output.ILURAddress = VshGetField(pShaderToken, FLD_OUT_R); + // Finally, get a0.x indirect constant addressing + pInstruction->a0x = VshGetField(pShaderToken, FLD_A0X); +} + +// Print functions +static char VshGetRegisterName(VSH_PARAMETER_TYPE ParameterType) +{ + switch(ParameterType) + { + case PARAM_R: + return 'r'; + case PARAM_V: + return 'v'; + case PARAM_C: + return 'c'; + default: + return '?'; + } +} + +static void VshWriteOutputMask(boolean *OutputMask, + char *pDisassembly, + uint32 *pDisassemblyPos) +{ + if(OutputMask[0] && OutputMask[1] && OutputMask[2] && OutputMask[3]) + { + // All compoenents are there, no need to print the mask + return; + } + *pDisassemblyPos += sprintf(pDisassembly + *pDisassemblyPos, ".%s%s%s%s", + OutputMask[0] ? "x" : "", + OutputMask[1] ? "y" : "", + OutputMask[2] ? "z" : "", + OutputMask[3] ? "w" : ""); +} + +static void VshWriteParameter(VSH_IMD_PARAMETER *pParameter, + char *pDisassembly, + uint32 *pDisassemblyPos) +{ + *pDisassemblyPos += sprintf(pDisassembly + *pDisassemblyPos, ", %s%c", + pParameter->Parameter.Neg ? "-" : "", + VshGetRegisterName(pParameter->Parameter.ParameterType)); + if(pParameter->Parameter.ParameterType == PARAM_C && pParameter->IsA0X) + { + // Only display the offset if it's not 0. + if(pParameter->Parameter.Address) + { + *pDisassemblyPos += sprintf(pDisassembly + *pDisassemblyPos, "[a0.x+%d]", pParameter->Parameter.Address); + } + else + { + *pDisassemblyPos += sprintf(pDisassembly + *pDisassemblyPos, "[a0.x]"); + } + } + else + { + *pDisassemblyPos += sprintf(pDisassembly + *pDisassemblyPos, "%d", pParameter->Parameter.Address); + } + // Only bother printing the swizzle if it is not .xyzw + if(!(pParameter->Parameter.Swizzle[0] == 0 && + pParameter->Parameter.Swizzle[1] == 1 && + pParameter->Parameter.Swizzle[2] == 2 && + pParameter->Parameter.Swizzle[3] == 3)) + { + int i; + + *pDisassemblyPos += sprintf(pDisassembly + *pDisassemblyPos, "."); + for (i = 0; i < 4; i++) + { + int j; + char Swizzle = '?'; + switch(pParameter->Parameter.Swizzle[i]) + { + case SWIZZLE_X: + Swizzle = 'x'; + break; + case SWIZZLE_Y: + Swizzle = 'y'; + break; + case SWIZZLE_Z: + Swizzle = 'z'; + break; + case SWIZZLE_W: + Swizzle = 'w'; + break; + } + *pDisassemblyPos += sprintf(pDisassembly + *pDisassemblyPos, "%c", Swizzle); + for (j = i; j < 4; j++) + { + if(pParameter->Parameter.Swizzle[i] != pParameter->Parameter.Swizzle[j]) + { + break; + } + } + if(j == 4) + { + break; + } + } + } +} + +static void VshWriteShader(VSH_XBOX_SHADER *pShader, + char* pDisassembly, + boolean Truncate) +{ + uint32 DisassemblyPos = 0; + switch(pShader->ShaderHeader.Version) + { + case VERSION_VS: + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "vs.1.1\n"); + break; + case VERSION_XVS: + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "xvs.1.1\n"); + break; + case VERSION_XVSS: + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "xvss.1.1\n"); + break; + case VERSION_XVSW: + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "xvsw.1.1\n"); + break; + default: + break; + } + for (int i = 0; i < pShader->IntermediateCount && (i < 128 || !Truncate); i++) + { + VSH_INTERMEDIATE_FORMAT *pIntermediate = &pShader->Intermediate[i]; + + if(i == 128) + { + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "; -- Passing the truncation limit --\n"); + } + // Writing combining sign if neccessary + if(pIntermediate->IsCombined) + { + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "+"); + } + // Print the op code + if(pIntermediate->InstructionType == IMD_MAC) + { + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "%s ", MAC_OpCode[pIntermediate->MAC]); + } + else + { + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "%s ", ILU_OpCode[pIntermediate->ILU]); + } + + // Print the output parameter + if(pIntermediate->Output.Type == IMD_OUTPUT_A0X) + { + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "a0.x"); + } + else + { + switch(pIntermediate->Output.Type) + { + case IMD_OUTPUT_C: + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "c%d", pIntermediate->Output.Address); + break; + case IMD_OUTPUT_R: + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "r%d", pIntermediate->Output.Address); + break; + case IMD_OUTPUT_O: + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "%s", OReg_Name[pIntermediate->Output.Address]); + break; + default: + CxbxKrnlCleanup("Invalid output register in vertex shader!"); + break; + } + VshWriteOutputMask(pIntermediate->Output.Mask, pDisassembly, &DisassemblyPos); + } + // Print the parameters + for (int i = 0; i < 3; i++) + { + VSH_IMD_PARAMETER *pParameter = &pIntermediate->Parameters[i]; + if(pParameter->Active) + { + VshWriteParameter(pParameter, pDisassembly, &DisassemblyPos); + } + } + DisassemblyPos += sprintf(pDisassembly + DisassemblyPos, "\n"); + } + *(pDisassembly + DisassemblyPos) = 0; +} + +static void VshAddParameter(VSH_PARAMETER *pParameter, + boolean a0x, + VSH_IMD_PARAMETER *pIntermediateParameter) +{ + pIntermediateParameter->Parameter = *pParameter; + pIntermediateParameter->Active = TRUE; + pIntermediateParameter->IsA0X = a0x; +} + +static void VshAddParameters(VSH_SHADER_INSTRUCTION *pInstruction, + VSH_ILU ILU, + VSH_MAC MAC, + VSH_IMD_PARAMETER *pParameters) +{ + uint08 ParamCount = 0; + VSH_OPCODE_PARAMS* pParams = VshGetOpCodeParams(ILU, MAC); + + // param A + if(pParams->A) + { + VshAddParameter(&pInstruction->A, pInstruction->a0x, &pParameters[ParamCount]); + ParamCount++; + } + + // param B + if(pParams->B) + { + VshAddParameter(&pInstruction->B, pInstruction->a0x, &pParameters[ParamCount]); + ParamCount++; + } + + // param C + if(pParams->C) + { + VshAddParameter(&pInstruction->C, pInstruction->a0x, &pParameters[ParamCount]); + ParamCount++; + } +} + +static void VshVerifyBufferBounds(VSH_XBOX_SHADER *pShader) +{ + if(pShader->IntermediateCount == VSH_MAX_INTERMEDIATE_COUNT) + { + CxbxKrnlCleanup("Shader exceeds conversion buffer!"); + } +} + +static VSH_INTERMEDIATE_FORMAT *VshNewIntermediate(VSH_XBOX_SHADER *pShader) +{ + VshVerifyBufferBounds(pShader); + + ZeroMemory(&pShader->Intermediate[pShader->IntermediateCount], sizeof(VSH_INTERMEDIATE_FORMAT)); + + return &pShader->Intermediate[pShader->IntermediateCount++]; +} + +static void VshInsertIntermediate(VSH_XBOX_SHADER *pShader, + VSH_INTERMEDIATE_FORMAT *pIntermediate, + uint16 Pos) +{ + VshVerifyBufferBounds(pShader); + + for (int i = pShader->IntermediateCount; i >= Pos; i--) + { + pShader->Intermediate[i + 1] = pShader->Intermediate[i]; + } + pShader->Intermediate[Pos] = *pIntermediate; + pShader->IntermediateCount++; +} + +static void VshDeleteIntermediate(VSH_XBOX_SHADER *pShader, + uint16 Pos) +{ + for (int i = Pos; i < (pShader->IntermediateCount - 1); i++) + { + pShader->Intermediate[i] = pShader->Intermediate[i + 1]; + } + pShader->IntermediateCount--; +} + +static boolean VshAddInstructionMAC_R(VSH_SHADER_INSTRUCTION *pInstruction, + VSH_XBOX_SHADER *pShader, + boolean IsCombined) +{ + VSH_INTERMEDIATE_FORMAT *pIntermediate; + if(!HasMACR(pInstruction)) + { + return FALSE; + } + + pIntermediate = VshNewIntermediate(pShader); + pIntermediate->IsCombined = IsCombined; + + // Opcode + pIntermediate->InstructionType = IMD_MAC; + pIntermediate->MAC = pInstruction->MAC; + + // Output param + pIntermediate->Output.Type = IMD_OUTPUT_R; + pIntermediate->Output.Address = pInstruction->Output.MACRAddress; + memcpy(pIntermediate->Output.Mask, pInstruction->Output.MACRMask, sizeof(boolean) * 4); + + // Other parameters + VshAddParameters(pInstruction, ILU_NOP, pInstruction->MAC, pIntermediate->Parameters); + + return TRUE; +} + +static boolean VshAddInstructionMAC_O(VSH_SHADER_INSTRUCTION* pInstruction, + VSH_XBOX_SHADER *pShader, + boolean IsCombined) +{ + VSH_INTERMEDIATE_FORMAT *pIntermediate; + if(!HasMACO(pInstruction)) + { + return FALSE; + } + + pIntermediate = VshNewIntermediate(pShader); + pIntermediate->IsCombined = IsCombined; + + // Opcode + pIntermediate->InstructionType = IMD_MAC; + pIntermediate->MAC = pInstruction->MAC; + + // Output param + pIntermediate->Output.Type = pInstruction->Output.OutputType == OUTPUT_C ? IMD_OUTPUT_C : IMD_OUTPUT_O; + pIntermediate->Output.Address = pInstruction->Output.OutputAddress; + memcpy(pIntermediate->Output.Mask, pInstruction->Output.OutputMask, sizeof(boolean) * 4); + + // Other parameters + VshAddParameters(pInstruction, ILU_NOP, pInstruction->MAC, pIntermediate->Parameters); + + return TRUE; +} + +static boolean VshAddInstructionMAC_ARL(VSH_SHADER_INSTRUCTION *pInstruction, + VSH_XBOX_SHADER *pShader, + boolean IsCombined) +{ + VSH_INTERMEDIATE_FORMAT *pIntermediate; + if(!HasMACARL(pInstruction)) + { + return FALSE; + } + + pIntermediate = VshNewIntermediate(pShader); + pIntermediate->IsCombined = IsCombined; + + // Opcode + pIntermediate->InstructionType = IMD_MAC; + pIntermediate->MAC = pInstruction->MAC; + + // Output param + pIntermediate->Output.Type = IMD_OUTPUT_A0X; + pIntermediate->Output.Address = pInstruction->Output.OutputAddress; + + // Other parameters + VshAddParameters(pInstruction, ILU_NOP, pInstruction->MAC, pIntermediate->Parameters); + + return TRUE; +} + +static boolean VshAddInstructionILU_R(VSH_SHADER_INSTRUCTION *pInstruction, + VSH_XBOX_SHADER *pShader, + boolean IsCombined) +{ + VSH_INTERMEDIATE_FORMAT *pIntermediate; + if(!HasILUR(pInstruction)) + { + return FALSE; + } + + pIntermediate = VshNewIntermediate(pShader); + pIntermediate->IsCombined = IsCombined; + + // Opcode + pIntermediate->InstructionType = IMD_ILU; + pIntermediate->ILU = pInstruction->ILU; + + // Output param + pIntermediate->Output.Type = IMD_OUTPUT_R; + // If this is a combined instruction, only r1 is allowed (R address should not be used) + pIntermediate->Output.Address = IsCombined ? 1 : pInstruction->Output.ILURAddress; + memcpy(pIntermediate->Output.Mask, pInstruction->Output.ILURMask, sizeof(boolean) * 4); + + // Other parameters + VshAddParameters(pInstruction, pInstruction->ILU, MAC_NOP, pIntermediate->Parameters); + + return TRUE; +} + +static boolean VshAddInstructionILU_O(VSH_SHADER_INSTRUCTION *pInstruction, + VSH_XBOX_SHADER *pShader, + boolean IsCombined) +{ + VSH_INTERMEDIATE_FORMAT *pIntermediate; + if(!HasILUO(pInstruction)) + { + return FALSE; + } + + pIntermediate = VshNewIntermediate(pShader); + pIntermediate->IsCombined = IsCombined; + + // Opcode + pIntermediate->InstructionType = IMD_ILU; + pIntermediate->ILU = pInstruction->ILU; + + // Output param + pIntermediate->Output.Type = pInstruction->Output.OutputType == OUTPUT_C ? IMD_OUTPUT_C : IMD_OUTPUT_O; + pIntermediate->Output.Address = pInstruction->Output.OutputAddress; + memcpy(pIntermediate->Output.Mask, pInstruction->Output.OutputMask, sizeof(boolean) * 4); + + // Other parameters + VshAddParameters(pInstruction, pInstruction->ILU, MAC_NOP, pIntermediate->Parameters); + + return TRUE; +} + +static void VshConvertToIntermediate(VSH_SHADER_INSTRUCTION *pInstruction, + VSH_XBOX_SHADER *pShader) +{ + // Five types of instructions: + // MAC + // + // ILU + // + // MAC + // +ILU + // + // MAC + // +MAC + // +ILU + // + // MAC + // +ILU + // +ILU + boolean IsCombined = FALSE; + + if(VshAddInstructionMAC_R(pInstruction, pShader, IsCombined)) + { + if(HasMACO(pInstruction) || + HasILUR(pInstruction) || + HasILUO(pInstruction)) + { + IsCombined = TRUE; + } + } + if(VshAddInstructionMAC_O(pInstruction, pShader, IsCombined)) + { + if(HasILUR(pInstruction) || + HasILUO(pInstruction)) + { + IsCombined = TRUE; + } + } + // Special case, arl (mov a0.x, ...) + if(VshAddInstructionMAC_ARL(pInstruction, pShader, IsCombined)) + { + if(HasILUR(pInstruction) || + HasILUO(pInstruction)) + { + IsCombined = TRUE; + } + } + if(VshAddInstructionILU_R(pInstruction, pShader, IsCombined)) + { + if(HasILUO(pInstruction)) + { + IsCombined = TRUE; + } + } + (void)VshAddInstructionILU_O(pInstruction, pShader, IsCombined); +} + +static inline void VshSetSwizzle(VSH_IMD_PARAMETER *pParameter, + VSH_SWIZZLE x, + VSH_SWIZZLE y, + VSH_SWIZZLE z, + VSH_SWIZZLE w) +{ + pParameter->Parameter.Swizzle[0] = x; + pParameter->Parameter.Swizzle[1] = y; + pParameter->Parameter.Swizzle[2] = z; + pParameter->Parameter.Swizzle[3] = w; +} + +static inline void VshSetOutputMask(VSH_IMD_OUTPUT* pOutput, + boolean MaskX, + boolean MaskY, + boolean MaskZ, + boolean MaskW) +{ + pOutput->Mask[0] = MaskX; + pOutput->Mask[1] = MaskY; + pOutput->Mask[2] = MaskZ; + pOutput->Mask[3] = MaskW; +} +/* + mul oPos.xyz, r12, c-38 + +rcc r1.x, r12.w + + mad oPos.xyz, r12, r1.x, c-37 +*/ +static void VshRemoveScreenSpaceInstructions(VSH_XBOX_SHADER *pShader) +{ + int16 PosC38 = -1; + int deleted = 0; + + for (int i = 0; i < pShader->IntermediateCount; i++) + { + VSH_INTERMEDIATE_FORMAT* pIntermediate = &pShader->Intermediate[i]; + + for (int k = 0; k < 3; k++) + { + if(pIntermediate->Parameters[k].Active) + { + if(pIntermediate->Parameters[k].Parameter.ParameterType == PARAM_C && + !pIntermediate->Parameters[k].IsA0X) + { + if(pIntermediate->Parameters[k].Parameter.Address == -37) + { + // Found c-37, remove the instruction + if(k == 2 && + pIntermediate->Parameters[1].Active && + pIntermediate->Parameters[1].Parameter.ParameterType == PARAM_R) + { + DbgVshPrintf("PosC38 = %d i = %d\n", PosC38, i); + for (int j = (i-1); j >= 0; j--) + { + VSH_INTERMEDIATE_FORMAT* pIntermediate1W = &pShader->Intermediate[j]; + // Time to start searching for +rcc r#.x, r12.w + if(pIntermediate1W->InstructionType == IMD_ILU && + pIntermediate1W->ILU == ILU_RCC && + pIntermediate1W->Output.Type == IMD_OUTPUT_R && + pIntermediate1W->Output.Address == + pIntermediate->Parameters[1].Parameter.Address) + { + DbgVshPrintf("Deleted +rcc r1.x, r12.w\n"); + VshDeleteIntermediate(pShader, j); + deleted++; + i--; + //j--; + break; + } + } + } + VshDeleteIntermediate(pShader, i); + deleted++; + i--; + DbgVshPrintf("Deleted mad oPos.xyz, r12, r1.x, c-37\n"); + break; + } + else if(pIntermediate->Parameters[k].Parameter.Address == -38) + { + VshDeleteIntermediate(pShader, i); + PosC38 = i; + deleted++; + i--; + DbgVshPrintf("Deleted mul oPos.xyz, r12, c-38\n"); + } + } + } + } + } + + // If we couldn't find the generic screen space transformation we're + // assuming that the shader writes direct screen coordinates that must be + // normalized. This hack will fail if (a) the shader uses custom screen + // space transformation, (b) reads r10 or r11 after we have written to + // them, or (c) doesn't reserve c-38 and c-37 for scale and offset. + if(deleted != 3) + { + EmuWarning("Applying screen space vertex shader patching hack!"); + for (int i = 0; i < pShader->IntermediateCount; i++) + { + VSH_INTERMEDIATE_FORMAT* pIntermediate = &pShader->Intermediate[i]; + + // Find instructions outputting to oPos. + if( pIntermediate->Output.Type == IMD_OUTPUT_O && + pIntermediate->Output.Address == OREG_OPOS) + { + // Redirect output to r11. + pIntermediate->Output.Type = IMD_OUTPUT_R; + pIntermediate->Output.Address = 11; + + // Scale r11 to r10. (mul r10.[mask], r11, c58) + VSH_INTERMEDIATE_FORMAT MulIntermediate; + MulIntermediate.IsCombined = FALSE; + MulIntermediate.InstructionType = IMD_MAC; + MulIntermediate.MAC = MAC_MUL; + MulIntermediate.Output.Type = IMD_OUTPUT_R; + MulIntermediate.Output.Address = 10; + MulIntermediate.Output.Mask[0] = pIntermediate->Output.Mask[0]; + MulIntermediate.Output.Mask[1] = pIntermediate->Output.Mask[1]; + MulIntermediate.Output.Mask[2] = pIntermediate->Output.Mask[2]; + MulIntermediate.Output.Mask[3] = pIntermediate->Output.Mask[3]; + MulIntermediate.Parameters[0].Active = TRUE; + MulIntermediate.Parameters[0].IsA0X = FALSE; + MulIntermediate.Parameters[0].Parameter.ParameterType = PARAM_R; + MulIntermediate.Parameters[0].Parameter.Address = 11; + MulIntermediate.Parameters[0].Parameter.Neg = FALSE; + VshSetSwizzle(&MulIntermediate.Parameters[0], SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W); + MulIntermediate.Parameters[1].Active = TRUE; + MulIntermediate.Parameters[1].IsA0X = FALSE; + MulIntermediate.Parameters[1].Parameter.ParameterType = PARAM_C; + MulIntermediate.Parameters[1].Parameter.Address = ConvertCRegister(58); + MulIntermediate.Parameters[1].Parameter.Neg = FALSE; + VshSetSwizzle(&MulIntermediate.Parameters[1], SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W); + MulIntermediate.Parameters[2].Active = FALSE; + VshInsertIntermediate(pShader, &MulIntermediate, ++i); + + // Add offset with r10 to oPos (add oPos.[mask], r10, c59) + VSH_INTERMEDIATE_FORMAT AddIntermediate = MulIntermediate; + AddIntermediate.MAC = MAC_ADD; + AddIntermediate.Output.Type = IMD_OUTPUT_O; + AddIntermediate.Output.Address = OREG_OPOS; + AddIntermediate.Parameters[0].Parameter.ParameterType = PARAM_R; + AddIntermediate.Parameters[0].Parameter.Address = 10; + AddIntermediate.Parameters[1].Parameter.Address = ConvertCRegister(59); + VshInsertIntermediate(pShader, &AddIntermediate, ++i); + } + } + } +} + +// Converts the intermediate format vertex shader to DirectX 8 format +static boolean VshConvertShader(VSH_XBOX_SHADER *pShader, + boolean bNoReservedConstants) +{ + boolean RUsage[13] = { FALSE }; + // TODO: What about state shaders and such? + pShader->ShaderHeader.Version = VERSION_VS; + + // Search for the screen space instructions, and remove them + if(!bNoReservedConstants) + { + VshRemoveScreenSpaceInstructions(pShader); + } + + // TODO: Add routine for compacting r register usage so that at least one is freed (two if dph and r12) + + for (int i = 0; i < pShader->IntermediateCount; i++) + { + VSH_INTERMEDIATE_FORMAT* pIntermediate = &pShader->Intermediate[i]; + // Combining not supported in vs.1.1 + pIntermediate->IsCombined = FALSE; + + /* + if(pIntermediate->Output.Type == IMD_OUTPUT_O && pIntermediate->Output.Address == OREG_OFOG) + { + // The PC shader assembler doesn't like masks on scalar registers + VshSetOutputMask(&pIntermediate->Output, TRUE, TRUE, TRUE, TRUE); + }*/ + + if(pIntermediate->InstructionType == IMD_ILU && pIntermediate->ILU == ILU_RCC) + { + // Convert rcc to rcp + pIntermediate->ILU = ILU_RCP; + } + + if(pIntermediate->Output.Type == IMD_OUTPUT_R) + { + RUsage[pIntermediate->Output.Address] = TRUE; + } + // Make constant registers range from 0 to 192 instead of -96 to 96 + if(pIntermediate->Output.Type == IMD_OUTPUT_C) + { + pIntermediate->Output.Address += 96; + } + + for (int j = 0; j < 3; j++) + { + if(pIntermediate->Parameters[j].Active) + { + if(pIntermediate->Parameters[j].Parameter.ParameterType == PARAM_R) + { + RUsage[pIntermediate->Parameters[j].Parameter.Address] = TRUE; + } + // Make constant registers range from 0 to 192 instead of -96 to 96 + if(pIntermediate->Parameters[j].Parameter.ParameterType == PARAM_C) + { + pIntermediate->Parameters[j].Parameter.Address += 96; + } + } + } + + if(pIntermediate->InstructionType == IMD_MAC && pIntermediate->MAC == MAC_DPH) + { + // Replace dph with dp3 and add + if(pIntermediate->Output.Type != IMD_OUTPUT_R) + { + // TODO: Complete dph support + EmuWarning("Can't simulate dph for other than output r registers (yet)\n"); + return FALSE; + } + VSH_INTERMEDIATE_FORMAT TmpIntermediate = *pIntermediate; + pIntermediate->MAC = MAC_DP3; + TmpIntermediate.MAC = MAC_ADD; + TmpIntermediate.Parameters[0].IsA0X = FALSE; + TmpIntermediate.Parameters[0].Parameter.ParameterType = PARAM_R; + TmpIntermediate.Parameters[0].Parameter.Address = TmpIntermediate.Output.Address; + TmpIntermediate.Parameters[0].Parameter.Neg = FALSE; + VshSetSwizzle(&TmpIntermediate.Parameters[0], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); + VshSetSwizzle(&TmpIntermediate.Parameters[1], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); + VshSetOutputMask(&TmpIntermediate.Output, FALSE, FALSE, FALSE, TRUE); + VshInsertIntermediate(pShader, &TmpIntermediate, i + 1); + i++; + } + } + int16 R12Replacement = -1; + if(RUsage[12]) + { + // Sigh, they absolutely had to use r12, didn't they? + for (int i = 11; i >= 0; i--) + { + if(!RUsage[i]) + { + R12Replacement = i; + break; + } + } + if(R12Replacement == -1) + { + EmuWarning("Vertex shader uses all r registers, including r12; impossible to convert!"); + return FALSE; + } + for (int j = 0; j < pShader->IntermediateCount; j++) + { + VSH_INTERMEDIATE_FORMAT* pIntermediate = &pShader->Intermediate[j]; + if(pIntermediate->Output.Type == IMD_OUTPUT_O && + pIntermediate->Output.Address == OREG_OPOS) + { + // Found instruction writing to oPos + pIntermediate->Output.Type = IMD_OUTPUT_R; + pIntermediate->Output.Address = R12Replacement; + } + + for (int k = 0; k < 3; k++) + { + if(pIntermediate->Parameters[k].Active) + { + if(pIntermediate->Parameters[k].Parameter.ParameterType == PARAM_R && + pIntermediate->Parameters[k].Parameter.Address == 12) + { + // Found a r12 used as a parameter; replace + pIntermediate->Parameters[k].Parameter.Address = R12Replacement; + } + else if(pIntermediate->Parameters[k].Parameter.ParameterType == PARAM_C && + pIntermediate->Parameters[k].Parameter.Address == 58 && + !pIntermediate->Parameters[k].IsA0X) + { + // Found c-38, replace it with r12.w + pIntermediate->Parameters[k].Parameter.ParameterType = PARAM_R; + pIntermediate->Parameters[k].Parameter.Address = R12Replacement; + VshSetSwizzle(&pIntermediate->Parameters[k], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); + } + } + } + } + // Insert mov oPos, r## in the end + VSH_INTERMEDIATE_FORMAT *pOPosWriteBack = VshNewIntermediate(pShader); + pOPosWriteBack->InstructionType = IMD_ILU; + pOPosWriteBack->ILU = ILU_MOV; + pOPosWriteBack->MAC = MAC_NOP; + pOPosWriteBack->Output.Type = IMD_OUTPUT_O; + pOPosWriteBack->Output.Address = OREG_OPOS; + VshSetOutputMask(&pOPosWriteBack->Output, TRUE, TRUE, TRUE, TRUE); + pOPosWriteBack->Parameters[0].Active = TRUE; + pOPosWriteBack->Parameters[0].Parameter.ParameterType = PARAM_R; + pOPosWriteBack->Parameters[0].Parameter.Address = R12Replacement; + VshSetSwizzle(&pOPosWriteBack->Parameters[0], SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W); + } + return TRUE; +} + +// **************************************************************************** +// * Vertex shader declaration recompiler +// **************************************************************************** + +typedef struct _VSH_TYPE_PATCH_DATA +{ + DWORD NbrTypes; + UINT Types[256]; +} +VSH_TYPE_PATCH_DATA; + +typedef struct _VSH_STREAM_PATCH_DATA +{ + DWORD NbrStreams; + XTL::STREAM_DYNAMIC_PATCH pStreamPatches[256]; +} +VSH_STREAM_PATCH_DATA; + +typedef struct _VSH_PATCH_DATA +{ + boolean NeedPatching; + DWORD ConvertedStride; + VSH_TYPE_PATCH_DATA TypePatchData; + VSH_STREAM_PATCH_DATA StreamPatchData; +} +VSH_PATCH_DATA; + +// VERTEX SHADER +#define DEF_VSH_END 0xFFFFFFFF +#define DEF_VSH_NOP 0x00000000 + +static DWORD VshGetDeclarationSize(DWORD *pDeclaration) +{ + DWORD Pos = 0; + while (*(pDeclaration + Pos) != DEF_VSH_END) + { + Pos++; + } + return (Pos + 1) * sizeof(DWORD); +} + +DWORD Xb2PCRegisterType(DWORD VertexRegister) +{ + DWORD PCRegisterType; + switch(VertexRegister) + { + case -1: + DbgVshPrintf("D3DVSDE_VERTEX /* xbox ext. */"); + PCRegisterType = -1; + break; + case 0: + DbgVshPrintf("D3DVSDE_POSITION"); + PCRegisterType = D3DVSDE_POSITION; + break; + case 1: + DbgVshPrintf("D3DVSDE_BLENDWEIGHT"); + PCRegisterType = D3DVSDE_BLENDWEIGHT; + break; + case 2: + DbgVshPrintf("D3DVSDE_NORMAL"); + PCRegisterType = D3DVSDE_NORMAL; + break; + case 3: + DbgVshPrintf("D3DVSDE_DIFFUSE"); + PCRegisterType = D3DVSDE_DIFFUSE; + break; + case 4: + DbgVshPrintf("D3DVSDE_SPECULAR"); + PCRegisterType = D3DVSDE_SPECULAR; + break; + case 5: + DbgVshPrintf("D3DVSDE_FOG /* xbox ext. */"); + PCRegisterType = -1; + break; + case 7: + DbgVshPrintf("D3DVSDE_BACKDIFFUSE /* xbox ext. */"); + PCRegisterType = -1; + break; + case 8: + DbgVshPrintf("D3DVSDE_BACKSPECULAR /* xbox ext. */"); + PCRegisterType = -1; + break; + case 9: + DbgVshPrintf("D3DVSDE_TEXCOORD0"); + PCRegisterType = D3DVSDE_TEXCOORD0; + break; + case 10: + DbgVshPrintf("D3DVSDE_TEXCOORD1"); + PCRegisterType = D3DVSDE_TEXCOORD1; + break; + case 11: + DbgVshPrintf("D3DVSDE_TEXCOORD2"); + PCRegisterType = D3DVSDE_TEXCOORD2; + break; + case 12: + DbgVshPrintf("D3DVSDE_TEXCOORD3"); + PCRegisterType = D3DVSDE_TEXCOORD3; + break; + default: + DbgVshPrintf("%d /* unknown register */", VertexRegister); + PCRegisterType = -1; + break; + } + return PCRegisterType; +} + +static inline DWORD VshGetTokenType(DWORD Token) +{ + return (Token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT; +} + +static inline DWORD VshGetVertexRegister(DWORD Token) +{ + return (Token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT; +} + +static inline DWORD VshGetVertexRegisterIn(DWORD Token) +{ + return (Token & D3DVSD_VERTEXREGINMASK) >> D3DVSD_VERTEXREGINSHIFT; +} + +static inline DWORD VshGetVertexStream(DWORD Token) +{ + return (Token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT; +} + +static void VshConvertToken_NOP(DWORD *pToken) +{ + // D3DVSD_NOP + if(*pToken != DEF_VSH_NOP) + { + EmuWarning("Token NOP found, but extra parameters are given!\n"); + } + DbgVshPrintf("\tD3DVSD_NOP(),\n"); +} + +static DWORD VshConvertToken_CONSTMEM(DWORD *pToken) +{ + // D3DVSD_CONST + DbgVshPrintf("\tD3DVSD_CONST("); + + DWORD ConstantAddress = ((*pToken >> D3DVSD_CONSTADDRESSSHIFT) & 0xFF); + DWORD Count = (*pToken & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT; + + DbgVshPrintf("%d, %d),\n", ConstantAddress, Count); + + //pToken = D3DVSD_CONST(ConstantAddress, Count); + + for (uint i = 0; i < Count; i++) + { + DbgVshPrintf("\t0x%08X,\n", pToken); + } + return Count; +} + +static void VshConverToken_TESSELATOR(DWORD *pToken, + boolean IsFixedFunction) +{ + using namespace XTL; + + // TODO: Investigate why Xb2PCRegisterType is only used for fixed function vertex shaders + // D3DVSD_TESSUV + if(*pToken & 0x10000000) + { + XTL::DWORD VertexRegister = VshGetVertexRegister(*pToken); + XTL::DWORD NewVertexRegister = VertexRegister; + + DbgVshPrintf("\tD3DVSD_TESSUV("); + + if(IsFixedFunction) + { + NewVertexRegister = Xb2PCRegisterType(VertexRegister); + } + else + { + DbgVshPrintf("%d", NewVertexRegister); + } + + DbgVshPrintf("),\n"); + + *pToken = D3DVSD_TESSUV(NewVertexRegister); + } + // D3DVSD_TESSNORMAL + else + { + XTL::DWORD VertexRegisterIn = VshGetVertexRegisterIn(*pToken); + XTL::DWORD VertexRegisterOut = VshGetVertexRegister(*pToken); + + XTL::DWORD NewVertexRegisterIn = VertexRegisterIn; + XTL::DWORD NewVertexRegisterOut = VertexRegisterOut; + + DbgVshPrintf("\tD3DVSD_TESSNORMAL("); + + if(IsFixedFunction) + { + NewVertexRegisterIn = Xb2PCRegisterType(VertexRegisterIn); + } + else + { + DbgVshPrintf("%d", NewVertexRegisterIn); + } + + DbgVshPrintf(", "); + + if(IsFixedFunction) + { + NewVertexRegisterOut = Xb2PCRegisterType(VertexRegisterOut); + } + else + { + DbgVshPrintf("%d", NewVertexRegisterOut); + } + + DbgVshPrintf("),\n"); + *pToken = D3DVSD_TESSNORMAL(NewVertexRegisterIn, NewVertexRegisterOut); + } +} + +static boolean VshAddStreamPatch(VSH_PATCH_DATA *pPatchData) +{ + int CurrentStream = pPatchData->StreamPatchData.NbrStreams - 1; + + if(CurrentStream >= 0) + { + DbgVshPrintf("NeedPatching: %d\n", pPatchData->NeedPatching); + + XTL::STREAM_DYNAMIC_PATCH* pStreamPatch = &pPatchData->StreamPatchData.pStreamPatches[CurrentStream]; + + pStreamPatch->ConvertedStride = pPatchData->ConvertedStride; + pStreamPatch->NbrTypes = pPatchData->TypePatchData.NbrTypes; + pStreamPatch->NeedPatch = pPatchData->NeedPatching; + pStreamPatch->pTypes = (UINT *)CxbxMalloc(pPatchData->TypePatchData.NbrTypes * sizeof(VSH_TYPE_PATCH_DATA)); + memcpy(pStreamPatch->pTypes, pPatchData->TypePatchData.Types, pPatchData->TypePatchData.NbrTypes * sizeof(VSH_TYPE_PATCH_DATA)); + + return TRUE; + } + return FALSE; +} + +static void VshConvertToken_STREAM(DWORD *pToken, + VSH_PATCH_DATA *pPatchData) +{ + // D3DVSD_STREAM_TESS + if(*pToken & D3DVSD_STREAMTESSMASK) + { + DbgVshPrintf("\tD3DVSD_STREAM_TESS(),\n"); + } + // D3DVSD_STREAM + else + { + XTL::DWORD StreamNumber = VshGetVertexStream(*pToken); + DbgVshPrintf("\tD3DVSD_STREAM(%d),\n", StreamNumber); + + // new stream + // copy current data to structure + if(VshAddStreamPatch(pPatchData)) + { + pPatchData->ConvertedStride = 0; + pPatchData->TypePatchData.NbrTypes = 0; + pPatchData->NeedPatching = FALSE; + } + + pPatchData->StreamPatchData.NbrStreams++; + } +} + +static void VshConvertToken_STREAMDATA_SKIP(DWORD *pToken) +{ + using namespace XTL; + + XTL::DWORD SkipCount = (*pToken & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT; + DbgVshPrintf("\tD3DVSD_SKIP(%d),\n", SkipCount); +} + +static void VshConvertToken_STREAMDATA_SKIPBYTES(DWORD *pToken) +{ + using namespace XTL; + + XTL::DWORD SkipBytesCount = (*pToken & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT; + DbgVshPrintf("\tD3DVSD_SKIPBYTES(%d), /* xbox ext. */\n", SkipBytesCount); + if(SkipBytesCount % sizeof(XTL::DWORD)) + { + EmuWarning("D3DVSD_SKIPBYTES can't be converted to D3DVSD_SKIP, not divisble by 4."); + } + *pToken = D3DVSD_SKIP(SkipBytesCount / sizeof(XTL::DWORD)); +} + +static void VshConvertToken_STREAMDATA_REG(DWORD *pToken, + boolean IsFixedFunction, + VSH_PATCH_DATA *pPatchData) +{ + using namespace XTL; + + DbgVshPrintf("\tD3DVSD_REG("); + + XTL::DWORD VertexRegister = VshGetVertexRegister(*pToken); + XTL::DWORD NewVertexRegister; + + if(IsFixedFunction) + { + NewVertexRegister = Xb2PCRegisterType(VertexRegister); + } + else + { + NewVertexRegister = VertexRegister; + DbgVshPrintf("%d", NewVertexRegister); + } + + DbgVshPrintf(", "); + + XTL::DWORD DataType = (*pToken >> D3DVSD_DATATYPESHIFT) & 0xFF; + XTL::DWORD NewDataType = 0; + + // save patching information + pPatchData->TypePatchData.Types[pPatchData->TypePatchData.NbrTypes] = DataType; + pPatchData->TypePatchData.NbrTypes++; + + switch(DataType) + { + case 0x12: + DbgVshPrintf("D3DVSDT_FLOAT1"); + NewDataType = D3DVSDT_FLOAT1; + pPatchData->ConvertedStride += sizeof(FLOAT); + break; + case 0x22: + DbgVshPrintf("D3DVSDT_FLOAT2"); + NewDataType = D3DVSDT_FLOAT2; + pPatchData->ConvertedStride += 2*sizeof(FLOAT); + break; + case 0x32: + DbgVshPrintf("D3DVSDT_FLOAT3"); + NewDataType = D3DVSDT_FLOAT3; + pPatchData->ConvertedStride += 3*sizeof(FLOAT); + break; + case 0x42: + DbgVshPrintf("D3DVSDT_FLOAT4"); + NewDataType = D3DVSDT_FLOAT4; + pPatchData->ConvertedStride += 4*sizeof(FLOAT); + break; + case 0x40: + DbgVshPrintf("D3DVSDT_D3DCOLOR"); + NewDataType = D3DVSDT_D3DCOLOR; + pPatchData->ConvertedStride += sizeof(D3DCOLOR); + break; + case 0x25: + DbgVshPrintf("D3DVSDT_SHORT2"); + NewDataType = D3DVSDT_SHORT2; + pPatchData->ConvertedStride += 2*sizeof(XTL::SHORT); + break; + case 0x45: + DbgVshPrintf("D3DVSDT_SHORT4"); + NewDataType = D3DVSDT_SHORT4; + pPatchData->ConvertedStride += 4*sizeof(XTL::SHORT); + break; + case 0x11: + DbgVshPrintf("D3DVSDT_NORMSHORT1 /* xbox ext. */"); + NewDataType = D3DVSDT_SHORT2; // hmm, emulation? + pPatchData->ConvertedStride += 2*sizeof(XTL::SHORT); + pPatchData->NeedPatching = TRUE; + break; + case 0x21: + DbgVshPrintf("D3DVSDT_NORMSHORT2 /* xbox ext. */"); + NewDataType = D3DVSDT_SHORT2; + pPatchData->ConvertedStride += 2*sizeof(XTL::SHORT); + pPatchData->NeedPatching = TRUE; + break; + case 0x31: + DbgVshPrintf("D3DVSDT_NORMSHORT3 /* xbox ext. nsp */"); + NewDataType = D3DVSDT_SHORT4; + pPatchData->ConvertedStride += 4*sizeof(XTL::SHORT); + pPatchData->NeedPatching = TRUE; + break; + case 0x41: + DbgVshPrintf("D3DVSDT_NORMSHORT4 /* xbox ext. */"); + NewDataType = D3DVSDT_SHORT4; + pPatchData->ConvertedStride += 4*sizeof(XTL::SHORT); + pPatchData->NeedPatching = TRUE; + break; + case 0x16: + DbgVshPrintf("D3DVSDT_NORMPACKED3 /* xbox ext. nsp */"); + NewDataType = D3DVSDT_FLOAT3;//0xFF; //32bit + pPatchData->ConvertedStride += 3*sizeof(FLOAT); + pPatchData->NeedPatching = TRUE; + break; + case 0x15: + DbgVshPrintf("D3DVSDT_SHORT1 /* xbox ext. nsp */"); + NewDataType = D3DVSDT_SHORT2; + pPatchData->ConvertedStride += 2*sizeof(XTL::SHORT); + pPatchData->NeedPatching = TRUE; + break; + case 0x35: + DbgVshPrintf("D3DVSDT_SHORT3 /* xbox ext. nsp */"); + NewDataType = D3DVSDT_SHORT4; + pPatchData->ConvertedStride += 4*sizeof(XTL::SHORT); + pPatchData->NeedPatching = TRUE; + break; + case 0x14: + DbgVshPrintf("D3DVSDT_PBYTE1 /* xbox ext. nsp */"); + NewDataType = D3DVSDT_FLOAT1; + pPatchData->ConvertedStride += 1*sizeof(FLOAT); + pPatchData->NeedPatching = TRUE; + break; + case 0x24: + DbgVshPrintf("D3DVSDT_PBYTE2 /* xbox ext. nsp */"); + NewDataType = D3DVSDT_FLOAT2; + pPatchData->ConvertedStride += 2*sizeof(FLOAT); + pPatchData->NeedPatching = TRUE; + break; + case 0x34: + DbgVshPrintf("D3DVSDT_PBYTE3 /* xbox ext. nsp */"); + NewDataType = D3DVSDT_FLOAT3; + pPatchData->ConvertedStride += 3*sizeof(FLOAT); + pPatchData->NeedPatching = TRUE; + break; + case 0x44: + DbgVshPrintf("D3DVSDT_PBYTE4 /* xbox ext. */"); + NewDataType = D3DVSDT_FLOAT4; + pPatchData->ConvertedStride += 4*sizeof(FLOAT); + break; + case 0x72: + DbgVshPrintf("D3DVSDT_FLOAT2H /* xbox ext. */"); + NewDataType = D3DVSDT_FLOAT3; + pPatchData->ConvertedStride += 3*sizeof(FLOAT); + pPatchData->NeedPatching = TRUE; + break; + case 0x02: + DbgVshPrintf("D3DVSDT_NONE /* xbox ext. nsp */"); + NewDataType = 0xFF; + break; + default: + DbgVshPrintf("Unknown data type for D3DVSD_REG: 0x%02X\n", DataType); + break; + } + *pToken = D3DVSD_REG(NewVertexRegister, NewDataType); + + DbgVshPrintf("),\n"); + + if(NewDataType == 0xFF) + { + EmuWarning("/* WARNING: Fatal type mismatch, no fitting type! */\n"); + } +} + +static void VshConvertToken_STREAMDATA(DWORD *pToken, + boolean IsFixedFunction, + VSH_PATCH_DATA *pPatchData) +{ + using namespace XTL; + + // D3DVSD_SKIP + if(*pToken & 0x10000000) + { + VshConvertToken_STREAMDATA_SKIP(pToken); + } + // D3DVSD_SKIPBYTES + else if(*pToken & 0x18000000) + { + VshConvertToken_STREAMDATA_SKIPBYTES(pToken); + } + // D3DVSD_REG + else + { + VshConvertToken_STREAMDATA_REG(pToken, IsFixedFunction, pPatchData); + } +} + +static DWORD VshRecompileToken(DWORD *pToken, + boolean IsFixedFunction, + VSH_PATCH_DATA *pPatchData) +{ + using namespace XTL; + + XTL::DWORD Step = 1; + + switch(VshGetTokenType(*pToken)) + { + case D3DVSD_TOKEN_NOP: + VshConvertToken_NOP(pToken); + break; + case D3DVSD_TOKEN_STREAM: + { + VshConvertToken_STREAM(pToken, pPatchData); + break; + } + case D3DVSD_TOKEN_STREAMDATA: + { + VshConvertToken_STREAMDATA(pToken, IsFixedFunction, pPatchData); + break; + } + case D3DVSD_TOKEN_TESSELLATOR: + { + VshConverToken_TESSELATOR(pToken, IsFixedFunction); + break; + } + case D3DVSD_TOKEN_CONSTMEM: + { + Step = VshConvertToken_CONSTMEM(pToken); + break; + } + default: + DbgVshPrintf("Unknown token type: %d\n", VshGetTokenType(*pToken)); + break; + } + + return Step; +} + +DWORD XTL::EmuRecompileVshDeclaration +( + DWORD *pDeclaration, + DWORD **ppRecompiledDeclaration, + DWORD *pDeclarationSize, + boolean IsFixedFunction, + VERTEX_DYNAMIC_PATCH *pVertexDynamicPatch +) +{ + // First of all some info: + // We have to figure out which flags are set and then + // we have to patch their params + + // some token values + // 0xFFFFFFFF - end of the declaration + // 0x00000000 - nop (means that this value is ignored) + + // Calculate size of declaration + DWORD DeclarationSize = VshGetDeclarationSize(pDeclaration); + *ppRecompiledDeclaration = (DWORD *)CxbxMalloc(DeclarationSize); + DWORD *pRecompiled = *ppRecompiledDeclaration; + memcpy(pRecompiled, pDeclaration, DeclarationSize); + *pDeclarationSize = DeclarationSize; + + // TODO: Put these in one struct + VSH_PATCH_DATA PatchData = { 0 }; + + DbgVshPrintf("DWORD dwVSHDecl[] =\n{\n"); + + while (*pRecompiled != DEF_VSH_END) + { + DWORD Step = VshRecompileToken(pRecompiled, IsFixedFunction, &PatchData); + pRecompiled += Step; + } + DbgVshPrintf("\tD3DVSD_END()\n};\n"); + + VshAddStreamPatch(&PatchData); + + DbgVshPrintf("NbrStreams: %d\n", PatchData.StreamPatchData.NbrStreams); + + // Copy the patches to the vertex shader struct + DWORD StreamsSize = PatchData.StreamPatchData.NbrStreams * sizeof(STREAM_DYNAMIC_PATCH); + pVertexDynamicPatch->NbrStreams = PatchData.StreamPatchData.NbrStreams; + pVertexDynamicPatch->pStreamPatches = (STREAM_DYNAMIC_PATCH *)CxbxMalloc(StreamsSize); + memcpy(pVertexDynamicPatch->pStreamPatches, + PatchData.StreamPatchData.pStreamPatches, + StreamsSize); + + return D3D_OK; +} + +// recompile xbox vertex shader function +extern HRESULT XTL::EmuRecompileVshFunction +( + DWORD *pFunction, + LPD3DXBUFFER *ppRecompiled, + DWORD *pOriginalSize, + boolean bNoReservedConstants +) +{ + VSH_SHADER_HEADER *pShaderHeader = (VSH_SHADER_HEADER*)pFunction; + DWORD *pToken; + boolean EOI = false; + VSH_XBOX_SHADER *pShader = (VSH_XBOX_SHADER*)CxbxMalloc(sizeof(VSH_XBOX_SHADER)); + HRESULT hRet = 0; + + // TODO: support this situation.. + if(pFunction == NULL) + return E_FAIL; + + *ppRecompiled = NULL; + *pOriginalSize = 0; + if(!pShader) + { + EmuWarning("Couldn't allocate memory for vertex shader conversion buffer"); + hRet = E_OUTOFMEMORY; + } + memset(pShader, 0, sizeof(VSH_XBOX_SHADER)); + pShader->ShaderHeader = *pShaderHeader; + switch(pShaderHeader->Version) + { + case VERSION_XVS: + break; + case VERSION_XVSS: + EmuWarning("Might not support vertex state shaders?"); + hRet = E_FAIL; + break; + case VERSION_XVSW: + EmuWarning("Might not support vertex read/write shaders?"); + hRet = E_FAIL; + break; + default: + EmuWarning("Unknown vertex shader version 0x%02X\n", pShaderHeader->Version); + hRet = E_FAIL; + break; + } + + if(SUCCEEDED(hRet)) + { + + for (pToken = (DWORD*)((uint08*)pFunction + sizeof(VSH_SHADER_HEADER)); !EOI; pToken += VSH_INSTRUCTION_SIZE) + { + VSH_SHADER_INSTRUCTION Inst; + + VshParseInstruction(pToken, &Inst); + VshConvertToIntermediate(&Inst, pShader); + EOI = (boolean)VshGetField(pToken, FLD_FINAL); + } + + // The size of the shader is + *pOriginalSize = (DWORD)pToken - (DWORD)pFunction; + + char* pShaderDisassembly = (char*)CxbxMalloc(pShader->IntermediateCount * 50); // Should be plenty + DbgVshPrintf("-- Before conversion --\n"); + VshWriteShader(pShader, pShaderDisassembly, FALSE); + DbgVshPrintf("%s", pShaderDisassembly); + DbgVshPrintf("-----------------------\n"); + + VshConvertShader(pShader, bNoReservedConstants); + VshWriteShader(pShader, pShaderDisassembly, TRUE); + + DbgVshPrintf("-- After conversion ---\n"); + DbgVshPrintf("%s", pShaderDisassembly); + DbgVshPrintf("-----------------------\n"); + + // HACK: Azurik. Prevent Direct3D from trying to assemble this. + if(!strcmp(pShaderDisassembly, "vs.1.1\n")) + { + EmuWarning("Cannot assemble empty vertex shader!\n"); + hRet = D3DXERR_INVALIDDATA; + } + else + { + + hRet = D3DXAssembleShader(pShaderDisassembly, + strlen(pShaderDisassembly), + D3DXASM_SKIPVALIDATION, + NULL, + ppRecompiled, + NULL); + } + + if (FAILED(hRet)) + { + EmuWarning("Couldn't assemble recompiled vertex shader\n"); + } + + CxbxFree(pShaderDisassembly); + } + CxbxFree(pShader); + + return hRet; +} + +extern void XTL::FreeVertexDynamicPatch(VERTEX_SHADER *pVertexShader) +{ + for (DWORD i = 0; i < pVertexShader->VertexDynamicPatch.NbrStreams; i++) + { + CxbxFree(pVertexShader->VertexDynamicPatch.pStreamPatches[i].pTypes); + } + CxbxFree(pVertexShader->VertexDynamicPatch.pStreamPatches); + pVertexShader->VertexDynamicPatch.pStreamPatches = NULL; + pVertexShader->VertexDynamicPatch.NbrStreams = 0; +} + +extern boolean XTL::IsValidCurrentShader(void) +{ + DWORD Handle; + + EmuSwapFS(); + EmuIDirect3DDevice8_GetVertexShader(&Handle); + EmuSwapFS(); + if (VshHandleIsVertexShader(Handle)) + { + X_D3DVertexShader *pD3DVertexShader = (X_D3DVertexShader *)(Handle & 0x7FFFFFFF); + VERTEX_SHADER *pVertexShader = (VERTEX_SHADER *)pD3DVertexShader->Handle; + if (pVertexShader->Status != 0) + { + return FALSE; + } + /* + for (uint32 i = 0; i < pVertexShader->VertexDynamicPatch.NbrStreams; i++) + { + if (pVertexShader->VertexDynamicPatch.pStreamPatches[i].NeedPatch) + { + // Just for caching purposes + pVertexShader->Status = 0x80000001; + return FALSE; + } + } + */ + } + return TRUE; +} + +extern XTL::VERTEX_DYNAMIC_PATCH *XTL::VshGetVertexDynamicPatch(DWORD Handle) +{ + X_D3DVertexShader *pD3DVertexShader = VshHandleGetVertexShader(Handle); + VERTEX_SHADER *pVertexShader = (VERTEX_SHADER *)pD3DVertexShader->Handle; + + for (uint32 i = 0; i < pVertexShader->VertexDynamicPatch.NbrStreams; i++) + { + if (pVertexShader->VertexDynamicPatch.pStreamPatches[i].NeedPatch) + { + return &pVertexShader->VertexDynamicPatch; + } + } + return NULL; +} \ No newline at end of file diff --git a/src/CxbxKrnl/EmuD3D8/VertexShader.cpp b/src/CxbxKrnl/EmuD3D8/VertexShader.cpp index 35892bbba..3c666b992 100644 --- a/src/CxbxKrnl/EmuD3D8/VertexShader.cpp +++ b/src/CxbxKrnl/EmuD3D8/VertexShader.cpp @@ -1269,7 +1269,8 @@ static boolean VshConvertShader(VSH_XBOX_SHADER *pShader, // Make constant registers range from 0 to 192 instead of -96 to 96 if(pIntermediate->Output.Type == IMD_OUTPUT_C) { - pIntermediate->Output.Address += 96; + //if(pIntermediate->Output.Address < 0) + pIntermediate->Output.Address += 96; } for (int j = 0; j < 3; j++) @@ -1283,31 +1284,93 @@ static boolean VshConvertShader(VSH_XBOX_SHADER *pShader, // Make constant registers range from 0 to 192 instead of -96 to 96 if(pIntermediate->Parameters[j].Parameter.ParameterType == PARAM_C) { - pIntermediate->Parameters[j].Parameter.Address += 96; + //if(pIntermediate->Parameters[j].Parameter.Address < 0) + pIntermediate->Parameters[j].Parameter.Address += 96; } } } if(pIntermediate->InstructionType == IMD_MAC && pIntermediate->MAC == MAC_DPH) { + // 2010/01/12 - revel8n - attempt to alleviate conversion issues relate to the dph instruction + // Replace dph with dp3 and add if(pIntermediate->Output.Type != IMD_OUTPUT_R) { // TODO: Complete dph support EmuWarning("Can't simulate dph for other than output r registers (yet)\n"); - return FALSE; + + // attempt to find unused register... + int outRegister = -1; + for (int j = 11; j >= 0; --j) + { + if(!RUsage[j]) + { + outRegister = j; + break; + } + } + + // return failure if there are no available registers + if (outRegister == -1) + { + return FALSE; + } + + VSH_INTERMEDIATE_FORMAT TmpIntermediate = *pIntermediate; + + // modify the instructions + // the register value is not needed beyond these instructions so setting the usage flag should not be necessary (??) + pIntermediate->MAC = MAC_DP3; + pIntermediate->Output.Type = IMD_OUTPUT_R; + pIntermediate->Output.Address = outRegister; + VshSetOutputMask(&pIntermediate->Output, TRUE, TRUE, TRUE, TRUE); + + TmpIntermediate.MAC = MAC_ADD; + TmpIntermediate.Parameters[0].IsA0X = FALSE; + TmpIntermediate.Parameters[0].Parameter.ParameterType = PARAM_R; + TmpIntermediate.Parameters[0].Parameter.Address = outRegister; + TmpIntermediate.Parameters[0].Parameter.Neg = FALSE; + //VshSetSwizzle(&TmpIntermediate.Parameters[0], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); + VshSetSwizzle(&TmpIntermediate.Parameters[1], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); + //VshSetOutputMask(&TmpIntermediate.Output, FALSE, FALSE, FALSE, TRUE); + VshInsertIntermediate(pShader, &TmpIntermediate, i + 1); } - VSH_INTERMEDIATE_FORMAT TmpIntermediate = *pIntermediate; - pIntermediate->MAC = MAC_DP3; - TmpIntermediate.MAC = MAC_ADD; - TmpIntermediate.Parameters[0].IsA0X = FALSE; - TmpIntermediate.Parameters[0].Parameter.ParameterType = PARAM_R; - TmpIntermediate.Parameters[0].Parameter.Address = TmpIntermediate.Output.Address; - TmpIntermediate.Parameters[0].Parameter.Neg = FALSE; - VshSetSwizzle(&TmpIntermediate.Parameters[0], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); - VshSetSwizzle(&TmpIntermediate.Parameters[1], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); - VshSetOutputMask(&TmpIntermediate.Output, FALSE, FALSE, FALSE, TRUE); - VshInsertIntermediate(pShader, &TmpIntermediate, i + 1); + else + { + VSH_INTERMEDIATE_FORMAT TmpIntermediate = *pIntermediate; + pIntermediate->MAC = MAC_DP3; + TmpIntermediate.MAC = MAC_ADD; + TmpIntermediate.Parameters[0].IsA0X = FALSE; + TmpIntermediate.Parameters[0].Parameter.ParameterType = PARAM_R; + TmpIntermediate.Parameters[0].Parameter.Address = TmpIntermediate.Output.Address; + TmpIntermediate.Parameters[0].Parameter.Neg = FALSE; + + int swizzle = (TmpIntermediate.Output.Mask[0]) | (TmpIntermediate.Output.Mask[1] << 1) | (TmpIntermediate.Output.Mask[2] << 2) | (TmpIntermediate.Output.Mask[3] << 3); + switch (swizzle) + { + case 1: + VshSetSwizzle(&TmpIntermediate.Parameters[0], SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X); + break; + case 2: + VshSetSwizzle(&TmpIntermediate.Parameters[0], SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y); + break; + case 4: + VshSetSwizzle(&TmpIntermediate.Parameters[0], SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z); + break; + case 8: + VshSetSwizzle(&TmpIntermediate.Parameters[0], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); + break; + case 15: + default: + VshSetSwizzle(&TmpIntermediate.Parameters[0], SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W); + break; + } + //VshSetSwizzle(&TmpIntermediate.Parameters[0], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); + VshSetSwizzle(&TmpIntermediate.Parameters[1], SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W); + //VshSetOutputMask(&TmpIntermediate.Output, FALSE, FALSE, FALSE, TRUE); + VshInsertIntermediate(pShader, &TmpIntermediate, i + 1); + } i++; } } @@ -1608,8 +1671,9 @@ static boolean VshAddStreamPatch(VSH_PATCH_DATA *pPatchData) pStreamPatch->ConvertedStride = pPatchData->ConvertedStride; pStreamPatch->NbrTypes = pPatchData->TypePatchData.NbrTypes; pStreamPatch->NeedPatch = pPatchData->NeedPatching; - pStreamPatch->pTypes = (UINT *)CxbxMalloc(pPatchData->TypePatchData.NbrTypes * sizeof(VSH_TYPE_PATCH_DATA)); - memcpy(pStreamPatch->pTypes, pPatchData->TypePatchData.Types, pPatchData->TypePatchData.NbrTypes * sizeof(VSH_TYPE_PATCH_DATA)); + // 2010/01/12 - revel8n - fixed allocated data size and type + pStreamPatch->pTypes = (UINT *)CxbxMalloc(pPatchData->TypePatchData.NbrTypes * sizeof(UINT)); //VSH_TYPE_PATCH_DATA)); + memcpy(pStreamPatch->pTypes, pPatchData->TypePatchData.Types, pPatchData->TypePatchData.NbrTypes * sizeof(UINT)); //VSH_TYPE_PATCH_DATA)); return TRUE; } @@ -2009,12 +2073,22 @@ extern HRESULT XTL::EmuRecompileVshFunction DbgVshPrintf("%s", pShaderDisassembly); DbgVshPrintf("-----------------------\n"); - hRet = D3DXAssembleShader(pShaderDisassembly, + // HACK: Azurik. Prevent Direct3D from trying to assemble this. + if(!strcmp(pShaderDisassembly, "vs.1.1\n")) + { + EmuWarning("Cannot assemble empty vertex shader!\n"); + hRet = D3DXERR_INVALIDDATA; + } + else + { + + hRet = D3DXAssembleShader(pShaderDisassembly, strlen(pShaderDisassembly), D3DXASM_SKIPVALIDATION, NULL, ppRecompiled, NULL); + } if (FAILED(hRet)) { diff --git a/src/CxbxKrnl/EmuD3D8Types.h b/src/CxbxKrnl/EmuD3D8Types.h index b7094a880..bef4b8966 100644 --- a/src/CxbxKrnl/EmuD3D8Types.h +++ b/src/CxbxKrnl/EmuD3D8Types.h @@ -47,6 +47,7 @@ typedef DWORD X_D3DBLEND; typedef DWORD X_D3DCMPFUNC; typedef DWORD X_D3DFILLMODE; typedef DWORD X_D3DSHADEMODE; +typedef DWORD X_D3DSTENCILOP; typedef DWORD X_D3DTEXTURESTAGESTATETYPE; typedef PVOID X_D3DCALLBACK; @@ -403,9 +404,22 @@ typedef struct _D3DVBLANKDATA } D3DVBLANKDATA; +typedef struct _D3DSWAPDATA +{ + DWORD Swap; + DWORD SwapVBlank; + DWORD MissedVBlanks; + DWORD TimeUntilSwapVBlank; + DWORD TimeBetweenSwapVBlanks; +} +D3DSWAPDATA; + // D3DVBLANKCALLBACK typedef void (__cdecl * D3DVBLANKCALLBACK)(D3DVBLANKDATA *pData); +// D3DSWAPCALLBACK +typedef void (__cdecl * D3DSWAPCALLBACK)(D3DSWAPDATA *pData); + // deferred render state "unknown" flag #define X_D3DRS_UNK 0x7fffffff diff --git a/src/CxbxKrnl/EmuDSound.cpp b/src/CxbxKrnl/EmuDSound.cpp index 0240cccdc..8af262c6e 100644 --- a/src/CxbxKrnl/EmuDSound.cpp +++ b/src/CxbxKrnl/EmuDSound.cpp @@ -68,7 +68,7 @@ XTL::X_CDirectSoundStream::_vtbl XTL::X_CDirectSoundStream::vtbl = /* STDMETHOD(GetInfo)(THIS_ LPXMEDIAINFO pInfo) PURE; */ - 0xBEEFB001, // 0x08 + &XTL::EmuCDirectSoundStream_GetInfo, // 0x08 &XTL::EmuCDirectSoundStream_GetStatus, // 0x0C &XTL::EmuCDirectSoundStream_Process, // 0x10 &XTL::EmuCDirectSoundStream_Discontinuity, // 0x14 @@ -842,10 +842,13 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateBuffer DWORD dwEmuFlags = 0; DSBUFFERDESC *pDSBufferDesc = (DSBUFFERDESC*)CxbxMalloc(sizeof(DSBUFFERDESC)); + DSBUFFERDESC *pDSBufferDescSpecial = NULL; + bool bIsSpecial = false; // convert from Xbox to PC DSound { - DWORD dwAcceptableMask = 0x00000010 | 0x00000020 | 0x00000080 | 0x00000100 | 0x00002000 | 0x00040000 | 0x00080000; + //DWORD dwAcceptableMask = 0x00000010 | 0x00000020 | 0x00000080 | 0x00000100 | 0x00002000 | 0x00040000 | 0x00080000; + DWORD dwAcceptableMask = 0x00000010 | 0x00000020 | 0x00000080 | 0x00000100 | 0x00020000 | 0x00040000 /*| 0x00080000*/; if(pdsbd->dwFlags & (~dwAcceptableMask)) EmuWarning("Use of unsupported pdsbd->dwFlags mask(s) (0x%.08X)", pdsbd->dwFlags & (~dwAcceptableMask)); @@ -891,39 +894,70 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateBuffer } else { + bIsSpecial = true; + dwEmuFlags |= DSB_FLAG_RECIEVEDATA; + EmuWarning("Creating dummy WAVEFORMATEX (pdsbd->lpwfxFormat = NULL)..."); - __asm int 3; - // HACK: For Quantum Redshift, create dummy WAVEFORMATEX data. + // HACK: This is a special sound buffer, create dummy WAVEFORMATEX data. + // It's supposed to recieve data rather than generate it. Buffers created + // with flags DSBCAPS_MIXIN, DSBCAPS_FXIN, and DSBCAPS_FXIN2 will have no + // WAVEFORMATEX structure by default. + // TODO: A better response to this scenario if possible. - pDSBufferDesc->lpwfxFormat = (WAVEFORMATEX*)CxbxMalloc(sizeof(WAVEFORMATEX)); + pDSBufferDescSpecial = (DSBUFFERDESC*)CxbxMalloc(sizeof(DSBUFFERDESC)); + pDSBufferDescSpecial->lpwfxFormat = (WAVEFORMATEX*)CxbxMalloc(sizeof(WAVEFORMATEX)); - // pDSBufferDesc->lpwfxFormat->cbSize = sizeof( WAVEFORMATEX ); - pDSBufferDesc->lpwfxFormat->nChannels = 2; - pDSBufferDesc->lpwfxFormat->wFormatTag = WAVE_FORMAT_PCM; - pDSBufferDesc->lpwfxFormat->nSamplesPerSec = 48000; - pDSBufferDesc->lpwfxFormat->nBlockAlign = 4; - pDSBufferDesc->lpwfxFormat->nAvgBytesPerSec = 4 * 48000; - pDSBufferDesc->lpwfxFormat->wBitsPerSample = 16; + //memset(pDSBufferDescSpecial->lpwfxFormat, 0, sizeof(WAVEFORMATEX)); + //memset(pDSBufferDescSpecial, 0, sizeof(DSBUFFERDESC)); + + pDSBufferDescSpecial->lpwfxFormat->wFormatTag = WAVE_FORMAT_PCM; + pDSBufferDescSpecial->lpwfxFormat->nChannels = 2; + pDSBufferDescSpecial->lpwfxFormat->nSamplesPerSec = 22050; + pDSBufferDescSpecial->lpwfxFormat->nBlockAlign = 4; + pDSBufferDescSpecial->lpwfxFormat->nAvgBytesPerSec = pDSBufferDescSpecial->lpwfxFormat->nSamplesPerSec * + pDSBufferDescSpecial->lpwfxFormat->nBlockAlign; + pDSBufferDescSpecial->lpwfxFormat->wBitsPerSample = 16; + + pDSBufferDescSpecial->dwSize = sizeof(DSBUFFERDESC); + pDSBufferDescSpecial->dwFlags = DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY; + pDSBufferDescSpecial->dwBufferBytes = 3 * pDSBufferDescSpecial->lpwfxFormat->nAvgBytesPerSec; + + // pDSBufferDesc->lpwfxFormat = (WAVEFORMATEX*)CxbxMalloc(sizeof(WAVEFORMATEX)/*+pdsbd->lpwfxFormat->cbSize*/); + + //// pDSBufferDesc->lpwfxFormat->cbSize = sizeof( WAVEFORMATEX ); + // pDSBufferDesc->lpwfxFormat->nChannels = 1; + // pDSBufferDesc->lpwfxFormat->wFormatTag = WAVE_FORMAT_PCM; + // pDSBufferDesc->lpwfxFormat->nSamplesPerSec = 22050; + // pDSBufferDesc->lpwfxFormat->nBlockAlign = 4; + // pDSBufferDesc->lpwfxFormat->nAvgBytesPerSec = 4 * 22050; + // pDSBufferDesc->lpwfxFormat->wBitsPerSample = 16; + + // Give this buffer 3 seconds of data if needed + /*if(pdsbd->dwBufferBytes == 0) + pDSBufferDesc->dwBufferBytes = 3 * pDSBufferDesc->lpwfxFormat->nAvgBytesPerSec;*/ } pDSBufferDesc->guid3DAlgorithm = DS3DALG_DEFAULT; } // sanity check - if(pDSBufferDesc->lpwfxFormat->nBlockAlign != (pDSBufferDesc->lpwfxFormat->nChannels*pDSBufferDesc->lpwfxFormat->wBitsPerSample)/8) - { - pDSBufferDesc->lpwfxFormat->nBlockAlign = (2*pDSBufferDesc->lpwfxFormat->wBitsPerSample)/8; - pDSBufferDesc->lpwfxFormat->nAvgBytesPerSec = pDSBufferDesc->lpwfxFormat->nSamplesPerSec * pDSBufferDesc->lpwfxFormat->nBlockAlign; - } + if(!bIsSpecial) + { + if(pDSBufferDesc->lpwfxFormat->nBlockAlign != (pDSBufferDesc->lpwfxFormat->nChannels*pDSBufferDesc->lpwfxFormat->wBitsPerSample)/8) + { + pDSBufferDesc->lpwfxFormat->nBlockAlign = (2*pDSBufferDesc->lpwfxFormat->wBitsPerSample)/8; + pDSBufferDesc->lpwfxFormat->nAvgBytesPerSec = pDSBufferDesc->lpwfxFormat->nSamplesPerSec * pDSBufferDesc->lpwfxFormat->nBlockAlign; + } + } // TODO: Garbage Collection *ppBuffer = new X_CDirectSoundBuffer(); (*ppBuffer)->EmuDirectSoundBuffer8 = 0; (*ppBuffer)->EmuBuffer = 0; - (*ppBuffer)->EmuBufferDesc = pDSBufferDesc; + (*ppBuffer)->EmuBufferDesc = bIsSpecial ? pDSBufferDescSpecial : pDSBufferDesc; (*ppBuffer)->EmuLockPtr1 = 0; (*ppBuffer)->EmuLockBytes1 = 0; (*ppBuffer)->EmuLockPtr2 = 0; @@ -932,10 +966,13 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateBuffer DbgPrintf("EmuDSound (0x%X): EmuDirectSoundCreateBuffer, *ppBuffer := 0x%.08X, bytes := 0x%.08X\n", GetCurrentThreadId(), *ppBuffer, pDSBufferDesc->dwBufferBytes); - HRESULT hRet = g_pDSound8->CreateSoundBuffer(pDSBufferDesc, &((*ppBuffer)->EmuDirectSoundBuffer8), NULL); + HRESULT hRet = g_pDSound8->CreateSoundBuffer(bIsSpecial ? pDSBufferDescSpecial : pDSBufferDesc, &((*ppBuffer)->EmuDirectSoundBuffer8), NULL); if(FAILED(hRet)) + { EmuWarning("CreateSoundBuffer Failed!"); + (*ppBuffer)->EmuDirectSoundBuffer8 = NULL; + } // cache this sound buffer { @@ -1217,24 +1254,27 @@ ULONG WINAPI XTL::EmuIDirectSoundBuffer8_Release if(pThis != 0) { - uRet = pThis->EmuDirectSoundBuffer8->Release(); + if(!(pThis->EmuFlags & DSB_FLAG_RECIEVEDATA)) + { + uRet = pThis->EmuDirectSoundBuffer8->Release(); - if(uRet == 0) - { - // remove cache entry - for(int v=0;vEmuBufferDesc->lpwfxFormat != NULL) - CxbxFree(pThis->EmuBufferDesc->lpwfxFormat); + if(pThis->EmuBufferDesc->lpwfxFormat != NULL) + CxbxFree(pThis->EmuBufferDesc->lpwfxFormat); - CxbxFree(pThis->EmuBufferDesc); + CxbxFree(pThis->EmuBufferDesc); - delete pThis; - } + delete pThis; + } + } } EmuSwapFS(); // XBox FS @@ -1719,7 +1759,9 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateStream // ****************************************************************** VOID WINAPI XTL::EmuCMcpxStream_Dummy_0x10(DWORD dwDummy1, DWORD dwDummy2) { - EmuWarning("EmuCMcpxStream_Dummy_0x10 is ignored!"); + // Causes deadlock in Halo... + // TODO: Verify that this is a Vista related problem (I HATE Vista!) +// EmuWarning("EmuCMcpxStream_Dummy_0x10 is ignored!"); return; } @@ -1835,6 +1877,40 @@ ULONG WINAPI XTL::EmuCDirectSoundStream_Release(X_CDirectSoundStream *pThis) return uRet; } +// ****************************************************************** +// * func: EmuCDirectSoundStream_GetInfo +// ****************************************************************** +HRESULT WINAPI XTL::EmuCDirectSoundStream_GetInfo +( + X_CDirectSoundStream* pThis, + LPXMEDIAINFO pInfo +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_GetInfo\n" + "(\n" + " pThis : 0x%.08X\n" + " pInfo : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pInfo); + + // TODO: A (real) implementation? + EmuWarning("EmuCDirectSoundStream_GetInfo is not yet supported!"); + + if( pInfo ) + { + pInfo->dwFlags = XMO_STREAMF_FIXED_SAMPLE_SIZE; + pInfo->dwInputSize = 0x40000; + pInfo->dwOutputSize = 0x40000; + pInfo->dwMaxLookahead = 0x4000; + } + + EmuSwapFS(); // Xbox FS + + return DS_OK; +} + // ****************************************************************** // * func: EmuCDirectSoundStream_GetStatus // ****************************************************************** @@ -2695,7 +2771,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMode { EmuSwapFS(); // Win2k/XP FS - DbgPrintf("EmuD3D8 (0x%X): EmuIDirectSoundBuffer8_SetFormat\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetFormat\n" "(\n" " pBuffer : 0x%.08X\n" " dwMode : 0x%.08X\n" @@ -2908,15 +2984,25 @@ ULONG WINAPI XTL::EmuIDirectSoundBuffer8_AddRef DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer_AddRef\n" "(\n" - " pThis : 0x%.08X\n" + " pThis : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis); - ULONG ret; + ULONG ret = 0; if(pThis != 0) - if(pThis->EmuDirectSoundBuffer8 != 0) // HACK: Ignore unsupported codecs. - ret = pThis->EmuDirectSoundBuffer8->AddRef(); + { + // HACK: Skip this on unsupported flags + if(pThis->EmuFlags & DSB_FLAG_RECIEVEDATA) + { + EmuWarning("Not adding reference to a potentially pad pointer!"); + } + else + { + if(pThis->EmuDirectSoundBuffer8 != 0) // HACK: Ignore unsupported codecs. + ret = pThis->EmuDirectSoundBuffer8->AddRef(); + } + } EmuSwapFS(); // Xbox FS @@ -2944,7 +3030,8 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_Pause // This function wasn't part of the XDK until 4721. HRESULT ret = S_OK; - if(pThis != NULL) + // Unstable! + /*if(pThis != NULL) { if(pThis->EmuDirectSoundBuffer8) { @@ -2958,7 +3045,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_Pause if(dwPause == X_DSBPAUSE_SYNCHPLAYBACK) EmuWarning("DSBPAUSE_SYNCHPLAYBACK is not yet supported!"); } - } + }*/ EmuSwapFS(); // Xbox FS @@ -3037,4 +3124,303 @@ HRESULT WINAPI XTL::EmuIDirectSound8_GetOutputLevels EmuSwapFS(); return S_OK; -} \ No newline at end of file +} + +// ****************************************************************** +// * func: EmuCDirectSoundStream_SetEG +// ****************************************************************** +HRESULT WINAPI XTL::EmuCDirectSoundStream_SetEG +( + LPVOID pThis, + LPVOID pEnvelopeDesc +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetEG\n" + "(\n" + " pThis : 0x%.08X\n" + " pEnvelopeDesc : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pEnvelopeDesc); + + // TODO: Implement this... + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirectSoundStream_Flush +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirectSoundStream_Flush() +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundStream_Flush()\n", GetCurrentThreadId() ); + + // TODO: Actually implement + + EmuSwapFS(); + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirectSoundStream_FlushEx +// ****************************************************************** +extern "C" HRESULT WINAPI XTL::EmuIDirectSoundStream_FlushEx +( + X_CDirectSoundStream* pThis, + REFERENCE_TIME rtTimeStamp, + DWORD dwFlags +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundStream_FlushEx\n" + "(\n" + " pThis : 0x%.08X\n" + " rtTimeStamp : 0x%.08X\n" + " dwFlags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, rtTimeStamp, dwFlags); + + // TODO: Actually implement + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuCDirectSoundStream_SetMode +// ****************************************************************** +HRESULT WINAPI XTL::EmuCDirectSoundStream_SetMode +( + X_CDirectSoundStream *pStream, + DWORD dwMode, + DWORD dwApply +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetFormat\n" + "(\n" + " pStream : 0x%.08X\n" + " dwMode : 0x%.08X\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pStream, dwMode, dwApply); + + HRESULT hRet = DS_OK; + + EmuWarning("EmuCDirectSoundStream_SetMode ignored"); + + EmuSwapFS(); // XBox FS + + return hRet; +} + +// ****************************************************************** +// * func: EmuXAudioDownloadEffectsImage +// ****************************************************************** +HRESULT WINAPI XTL::EmuXAudioDownloadEffectsImage +( + LPCSTR pszImageName, + LPVOID pImageLoc, + DWORD dwFlags, + LPVOID *ppImageDesc +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuXAudioDownloadEffectsImage\n" + "(\n" + " pszImageName : 0x%.08X\n" + " pImageLoc : 0x%.08X\n" + " dwFlags : 0x%.08X\n" + " ppImageDesc : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pszImageName, pImageLoc, dwFlags, ppImageDesc ); + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirectSoundBuffer8_SetFilter +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetFilter +( + LPVOID pThis, + X_DSFILTERDESC* pFilterDesc +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetFilter\n" + "(\n" + " pThis : 0x%.08X\n" + " pFilterDesc : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pFilterDesc); + + // TODO: Implement + + EmuWarning("IDirectSoundBuffer8_SetFilter not yet supported!"); + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuCDirectSoundStream_SetFilter +// ****************************************************************** +HRESULT WINAPI XTL::EmuCDirectSoundStream_SetFilter +( + X_CDirectSoundStream* pThis, + X_DSFILTERDESC* pFilterDesc +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuCDirectSoundStream_SetFilter\n" + "(\n" + " pThis : 0x%.08X\n" + " pFilterDesc : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pFilterDesc); + + // TODO: Implement + + EmuWarning("CDirectSoundStream_SetFilter not yet supported!"); + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + + +// ****************************************************************** +// * func: EmuIDirectSoundBuffer8_PlayEx +// ****************************************************************** +extern "C" HRESULT __stdcall XTL::EmuIDirectSoundBuffer8_PlayEx +( + X_CDirectSoundBuffer *pBuffer, + REFERENCE_TIME rtTimeStamp, + DWORD dwFlags +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_PlayEx\n" + "(\n" + " pBuffer : 0x%.08X\n" + " rtTimeStamp : 0x%.08X\n" + " dwFlags : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pBuffer, rtTimeStamp, dwFlags); + + if(pBuffer->EmuDirectSoundBuffer8 == 0) + EmuWarning("pBuffer->EmuDirectSoundBuffer8 == 0"); + + EmuWarning("PlayEx not yet implemented!"); + + EmuSwapFS(); // XBox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirectSound8_GetCaps +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirectSound8_GetCaps +( + X_CDirectSound* pThis, + X_DSCAPS* pDSCaps +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetFilter\n" + "(\n" + " pThis : 0x%.08X\n" + " pDSCaps : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, pDSCaps); + + // Get PC's DirectSound capabilities + DSCAPS DSCapsPC; + ZeroMemory( &DSCapsPC, sizeof( DSCAPS ) ); + + HRESULT hRet = g_pDSound8->GetCaps( &DSCapsPC ); + if(FAILED(hRet)) + EmuWarning("Failed to get PC DirectSound caps!"); + + // Convert PC -> Xbox + if(pDSCaps) + { + // WARNING: This may not be accurate under Windows Vista... + pDSCaps->dwFree2DBuffers = DSCapsPC.dwFreeHwMixingAllBuffers; + pDSCaps->dwFree3DBuffers = DSCapsPC.dwFreeHw3DAllBuffers; + pDSCaps->dwFreeBufferSGEs = 256; // TODO: Verify max on a real Xbox + pDSCaps->dwMemoryAllocated = DSCapsPC.dwFreeHwMemBytes; // TODO: Bytes or MegaBytes? + } + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirectSoundStream_SetPitch +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirectSoundStream_SetPitch +( + X_CDirectSoundStream* pThis, + LONG lPitch +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundStream_SetPitch\n" + "(\n" + " pThis : 0x%.08X\n" + " lPitch : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, lPitch); + + HRESULT hRet = S_OK; + + EmuWarning("IDirectSoundStream_SetPitch not yet implemented!"); + + return hRet; +} + +// ****************************************************************** +// * func: EmuDirectSoundGetSampleTime +// ****************************************************************** +DWORD WINAPI XTL::EmuDirectSoundGetSampleTime() +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuDSound (0x%X): EmuDirectSoundGetSampleTime();\n", GetCurrentThreadId()); + + // FIXME: This is the best I could think of for now. + // Check the XDK documentation for the description of what this function + // can actually do. BTW, this function accesses the NVIDIA SoundStorm APU + // register directly (0xFE80200C). + + // TODO: Handle reset at certain event? + // TODO: Wait until a DirectSoundBuffer/Stream is being played? + static DWORD dwStart = GetTickCount(); + DWORD dwRet = GetTickCount() - dwStart; + + EmuSwapFS(); + + return 0; +} diff --git a/src/CxbxKrnl/EmuDSound.h b/src/CxbxKrnl/EmuDSound.h index 8d6bd9177..871d5cf4d 100644 --- a/src/CxbxKrnl/EmuDSound.h +++ b/src/CxbxKrnl/EmuDSound.h @@ -99,6 +99,42 @@ typedef struct _XMEDIAPACKET } XMEDIAPACKET, *PXMEDIAPACKET, *LPXMEDIAPACKET; +// ****************************************************************** +// * XMEDIAINFO +// ****************************************************************** +typedef struct _XMEDIAINFO +{ + DWORD dwFlags; + DWORD dwInputSize; + DWORD dwOutputSize; + DWORD dwMaxLookahead; +} +XMEDIAINFO, *PXEIDIAINFO, *LPXMEDIAINFO; + +// XMEDIAINFO Flags +#define XMO_STREAMF_FIXED_SAMPLE_SIZE 0x00000001 // The object supports only a fixed sample size +#define XMO_STREAMF_FIXED_PACKET_ALIGNMENT 0x00000002 // The object supports only a fixed packet alignment +#define XMO_STREAMF_INPUT_ASYNC 0x00000004 // The object supports receiving input data asynchronously +#define XMO_STREAMF_OUTPUT_ASYNC 0x00000008 // The object supports providing output data asynchronously +#define XMO_STREAMF_IN_PLACE 0x00000010 // The object supports in-place modification of data +#define XMO_STREAMF_MASK 0x0000001F + +// ****************************************************************** +// * X_DSFILTERDESC +// ****************************************************************** +struct X_DSFILTERDESC +{ + DWORD dwMode; + DWORD dwQCoefficient; + DWORD adwCoefficients[4]; +}; + +// X_DSFILTERDESC modes +#define DSFILTER_MODE_BYPASS 0x00000000 // The filter is bypassed +#define DSFILTER_MODE_DLS2 0x00000001 // DLS2 mode +#define DSFILTER_MODE_PARAMEQ 0x00000002 // Parametric equalizer mode +#define DSFILTER_MODE_MULTI 0x00000003 // Multifunction mode + // ****************************************************************** // * DSLFODESC // ****************************************************************** @@ -148,6 +184,18 @@ struct X_DSOUTPUTLEVELS DWORD dwDigitalLowFrequencyRMS; }; +// ****************************************************************** +// * X_DSCAPS +// ****************************************************************** +struct X_DSCAPS +{ + DWORD dwFree2DBuffers; + DWORD dwFree3DBuffers; + DWORD dwFreeBufferSGEs; + DWORD dwMemoryAllocated; +}; + + typedef struct IDirectSoundStream IDirectSoundStream; typedef IDirectSoundStream *LPDIRECTSOUNDSTREAM; @@ -186,6 +234,7 @@ struct X_CDirectSoundBuffer #define DSB_FLAG_ADPCM 0x00000001 #define WAVE_FORMAT_XBOX_ADPCM 0x0069 +#define DSB_FLAG_RECIEVEDATA 0x00001000 // ****************************************************************** // * X_CMcpxStream @@ -241,7 +290,12 @@ class X_CDirectSoundStream { ULONG (WINAPI *AddRef)(X_CDirectSoundStream *pThis); // 0x00 ULONG (WINAPI *Release)(X_CDirectSoundStream *pThis); // 0x04 - DWORD Unknown; // 0x08 + + HRESULT (WINAPI *GetInfo) // 0x08 + ( + X_CDirectSoundStream *pThis, + XMEDIAINFO *pInfo + ); HRESULT (WINAPI *GetStatus) // 0x0C ( @@ -656,6 +710,16 @@ HRESULT WINAPI EmuIDirectSoundBuffer8_Play DWORD dwFlags ); +// ****************************************************************** +// * func: EmuIDirectSoundBuffer8_PlayEx +// ****************************************************************** +extern "C" HRESULT __stdcall EmuIDirectSoundBuffer8_PlayEx +( + X_CDirectSoundBuffer *pBuffer, + REFERENCE_TIME rtTimeStamp, + DWORD dwFlags +); + // ****************************************************************** // * func: EmuIDirectSoundBuffer8_SetVolume // ****************************************************************** @@ -724,6 +788,15 @@ ULONG WINAPI EmuCDirectSoundStream_AddRef(X_CDirectSoundStream *pThis); // ****************************************************************** ULONG WINAPI EmuCDirectSoundStream_Release(X_CDirectSoundStream *pThis); +// ****************************************************************** +// * EmuCDirectSoundStream_GetInfo +// ****************************************************************** +HRESULT WINAPI EmuCDirectSoundStream_GetInfo +( + X_CDirectSoundStream* pThis, + LPXMEDIAINFO pInfo +); + // ****************************************************************** // * func: EmuCDirectSoundStream_GetStatus // ****************************************************************** @@ -1133,4 +1206,90 @@ HRESULT WINAPI EmuIDirectSound8_GetOutputLevels BOOL bResetPeakValues ); +// ****************************************************************** +// * func: EmuCDirectSoundStream_SetEG +// ****************************************************************** +HRESULT WINAPI EmuCDirectSoundStream_SetEG +( + LPVOID pThis, + LPVOID pEnvelopeDesc +); + +// ****************************************************************** +// * func: EmuIDirectSoundStream_Flush +// ****************************************************************** +HRESULT WINAPI EmuIDirectSoundStream_Flush(); + +// ****************************************************************** +// * func: EmuIDirectSoundStream_FlushEx +// ****************************************************************** +extern "C" HRESULT WINAPI EmuIDirectSoundStream_FlushEx +( + X_CDirectSoundStream* pThis, + REFERENCE_TIME rtTimeStamp, + DWORD dwFlags +); + +// ****************************************************************** +// * func: EmuCDirectSoundStream_SetMode +// ****************************************************************** +HRESULT WINAPI EmuCDirectSoundStream_SetMode +( + X_CDirectSoundStream *pStream, + DWORD dwMode, + DWORD dwApply +); + +// ****************************************************************** +// * func: EmuXAudioDownloadEffectsImage +// ****************************************************************** +HRESULT WINAPI EmuXAudioDownloadEffectsImage +( + LPCSTR pszImageName, + LPVOID pImageLoc, + DWORD dwFlags, + LPVOID *ppImageDesc +); + +// ****************************************************************** +// * func: EmuIDirectSoundBuffer8_SetFilter +// ****************************************************************** +HRESULT WINAPI EmuIDirectSoundBuffer8_SetFilter +( + LPVOID pThis, + X_DSFILTERDESC* pFilterDesc +); + +// ****************************************************************** +// * func: EmuCDirectSoundStream_SetFilter +// ****************************************************************** +HRESULT WINAPI EmuCDirectSoundStream_SetFilter +( + X_CDirectSoundStream* pThis, + X_DSFILTERDESC* pFilterDesc +); + +// ****************************************************************** +// * func: EmuIDirectSound8_GetCaps +// ****************************************************************** +HRESULT WINAPI EmuIDirectSound8_GetCaps +( + X_CDirectSound* pThis, + X_DSCAPS* pDSCaps +); + +// ****************************************************************** +// * func: EmuIDirectSoundStream_SetPitch +// ****************************************************************** +HRESULT WINAPI EmuIDirectSoundStream_SetPitch +( + X_CDirectSoundStream* pThis, + LONG lPitch +); + +// ****************************************************************** +// * func: EmuDirectSoundGetSampleTime +// ****************************************************************** +DWORD WINAPI EmuDirectSoundGetSampleTime(); + #endif diff --git a/src/CxbxKrnl/EmuKrnl.cpp b/src/CxbxKrnl/EmuKrnl.cpp index 6cd794370..1270b6793 100644 --- a/src/CxbxKrnl/EmuKrnl.cpp +++ b/src/CxbxKrnl/EmuKrnl.cpp @@ -75,7 +75,8 @@ typedef struct _PCSTProxyParam PCSTProxyParam; // Global Variable(s) -extern PVOID g_pfnThreadNotification = NULL; +extern PVOID g_pfnThreadNotification[16] = { NULL }; +extern int g_iThreadNotificationCount = 0; // PsCreateSystemThread proxy procedure #pragma warning(push) @@ -108,17 +109,24 @@ static unsigned int WINAPI PCSTProxy EmuGenerateFS(CxbxKrnl_TLS, CxbxKrnl_TLSData); // call thread notification routine(s) - if(g_pfnThreadNotification != 0) + if(g_iThreadNotificationCount != 0) { - XTL::XTHREAD_NOTIFY_PROC pfnNotificationRoutine = (XTL::XTHREAD_NOTIFY_PROC)g_pfnThreadNotification; + for(int i = 0; i < 16; i++ ) + { + XTL::XTHREAD_NOTIFY_PROC pfnNotificationRoutine = (XTL::XTHREAD_NOTIFY_PROC)g_pfnThreadNotification[i]; - DbgPrintf("EmKrnl (0x%X): Calling pfnNotificationRoutine (0x%.08X)\n", GetCurrentThreadId(), pfnNotificationRoutine); + // If the routine doesn't exist, don't execute it! + if(pfnNotificationRoutine == NULL) + continue; - EmuSwapFS(); // Xbox FS + DbgPrintf("EmKrnl (0x%X): Calling pfnNotificationRoutine[%d] (0x%.08X)\n", g_iThreadNotificationCount, GetCurrentThreadId(), pfnNotificationRoutine); - pfnNotificationRoutine(TRUE); + EmuSwapFS(); // Xbox FS - EmuSwapFS(); // Win2k/XP FS + pfnNotificationRoutine(TRUE); + + EmuSwapFS(); // Win2k/XP FS + } } // use the special calling convention @@ -148,15 +156,24 @@ callComplete: EmuSwapFS(); // Win2k/XP FS // call thread notification routine(s) - if(g_pfnThreadNotification != 0) + if(g_iThreadNotificationCount != 0) { - XTL::XTHREAD_NOTIFY_PROC pfnNotificationRoutine = (XTL::XTHREAD_NOTIFY_PROC)g_pfnThreadNotification; + for(int i = 0; i < 16; i++ ) + { + XTL::XTHREAD_NOTIFY_PROC pfnNotificationRoutine = (XTL::XTHREAD_NOTIFY_PROC)g_pfnThreadNotification[i]; - EmuSwapFS(); // Xbox FS + // If the routine doesn't exist, don't execute it! + if(pfnNotificationRoutine == NULL) + continue; - pfnNotificationRoutine(FALSE); + DbgPrintf("EmKrnl (0x%X): Calling pfnNotificationRoutine[%d] (0x%.08X)\n", g_iThreadNotificationCount, GetCurrentThreadId(), pfnNotificationRoutine); - EmuSwapFS(); // Win2k/XP FS + EmuSwapFS(); // Xbox FS + + pfnNotificationRoutine(FALSE); + + EmuSwapFS(); // Win2k/XP FS + } } CxbxKrnlTerminateThread(); @@ -183,6 +200,37 @@ XBSYSAPI EXPORTNUM(1) xboxkrnl::PVOID NTAPI xboxkrnl::AvGetSavedDataAddress() return NULL; } +// ****************************************************************** +// * 0x0009 HalReadSMCTrayState +// ****************************************************************** +XBSYSAPI EXPORTNUM(9) VOID NTAPI xboxkrnl::HalReadSMCTrayState +( + DWORD* State, + DWORD* Count +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuKrnl (0x%X): HalReadSMCTrayState\n" + "(\n" + " State : 0x%.08X\n" + " Count : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), State, Count); + +#define TRAY_CLOSED_MEDIA_PRESENT 96 +#define TRAY_CLOSED_NO_MEDIA 64 +#define TRAY_OPEN 16 + + // TODO: Make this configurable? + // TODO: What is the count parameter for?? + + *State = TRAY_CLOSED_NO_MEDIA; +// *Count = 1; + + EmuSwapFS(); // Xbox FS +} + // ****************************************************************** // * 0x000E ExAllocatePool // ****************************************************************** @@ -501,6 +549,51 @@ XBSYSAPI EXPORTNUM(69) xboxkrnl::NTSTATUS NTAPI xboxkrnl::IoDeleteSymbolicLink return ret; } +// ****************************************************************** +// * IoDismountVolumeByName +// ****************************************************************** +XBSYSAPI EXPORTNUM(91) xboxkrnl::NTSTATUS NTAPI xboxkrnl::IoDismountVolumeByName +( + IN PSTRING VolumeName +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuKrnl (0x%X): IoDismountVolumeByName\n" + "(\n" + " VolumeName : 0x%.08X (%s)\n" + ");\n", + GetCurrentThreadId(), VolumeName, VolumeName); + + // TODO: Anything? + NTSTATUS ret = STATUS_SUCCESS; + + EmuSwapFS(); // Xbox FS + + return ret; +} + +// ****************************************************************** +// * KeBugCheck +// ****************************************************************** +XBSYSAPI EXPORTNUM(95) VOID NTAPI xboxkrnl::KeBugCheck +( + IN ULONG BugCheckMode +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuKrnl (0x%X): KeBugCheck\n" + "(\n" + " BugCheckMode : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), BugCheckMode); + + // TODO: Investigate XapiFiberStartup maybe? + + EmuSwapFS(); // Xbox FS +} + // ****************************************************************** // * 0x0063 - KeDelayExecutionThread // ****************************************************************** @@ -659,6 +752,22 @@ XBSYSAPI EXPORTNUM(128) VOID NTAPI xboxkrnl::KeQuerySystemTime return; } +// ****************************************************************** +// * KeRaiseIrqlToDpcLevel +// ****************************************************************** +XBSYSAPI EXPORTNUM(129) xboxkrnl::UCHAR NTAPI xboxkrnl::KeRaiseIrqlToDpcLevel() +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuKrnl (0x%X): KeRaiseIrqlToDpcLevel()\n", GetCurrentThreadId()); + + // I really tried to avoid adding this... + + EmuSwapFS(); + + return 0; +} + // ****************************************************************** // * 0x0095 - KeSetTimer // ****************************************************************** @@ -680,7 +789,8 @@ XBSYSAPI EXPORTNUM(149) xboxkrnl::BOOLEAN NTAPI xboxkrnl::KeSetTimer GetCurrentThreadId(), Timer, DueTime, Dpc); // Call KeSetTimerEx - KeSetTimerEx(Timer, DueTime, 0, Dpc); +// KeSetTimerEx(Timer, DueTime, 0, Dpc); + CxbxKrnlCleanup("KeSetTimer is not implemented!"); EmuSwapFS(); // Xbox FS @@ -1361,6 +1471,17 @@ XBSYSAPI EXPORTNUM(190) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateFile ObjectAttributes->RootDirectory = g_hCurDir; + DbgPrintf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); + DbgPrintf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); + DbgPrintf(" New:\"$XbePath\\%s\"\n", szBuffer); + } + // Going to map Y:\ to current directory as well (dashboard test, 3944) + else if( (szBuffer[0] == 'Y' || szBuffer[0] == 'y') && szBuffer[1] == ':' && szBuffer[2] == '\\') + { + szBuffer += 3; + + ObjectAttributes->RootDirectory = g_hCurDir; + DbgPrintf("EmuKrnl (0x%X): NtCreateFile Corrected path...\n", GetCurrentThreadId()); DbgPrintf(" Org:\"%s\"\n", ObjectAttributes->ObjectName->Buffer); DbgPrintf(" New:\"$XbePath\\%s\"\n", szBuffer); @@ -1749,7 +1870,7 @@ XBSYSAPI EXPORTNUM(206) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueueApcThread { EmuSwapFS(); // Win2k/XP FS - DbgPrintf("EmuKrnl (0x%X): NtQueryDirectoryFile\n" + DbgPrintf("EmuKrnl (0x%X): NtQueueApcThread\n" "(\n" " ThreadHandle : 0x%.08X\n" " ApcRoutine : 0x%.08X\n" @@ -1902,6 +2023,9 @@ XBSYSAPI EXPORTNUM(210) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryFullAttributes NTSTATUS ret = NtDll::NtQueryFullAttributesFile(&NtObjAttr, Attributes); + if(FAILED(ret)) + EmuWarning("NtQueryFullAttributesFile failed! (0x%.08X)\n", ret); + EmuSwapFS(); // Xbox FS return ret; @@ -1932,6 +2056,9 @@ XBSYSAPI EXPORTNUM(211) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryInformationFil GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, Length, FileInfo); + // TODO: IIRC, this function is depreciated. Maybe we should just use + // ZwQueryInformationFile instead? + // if(FileInfo != FilePositionInformation && FileInfo != FileNetworkOpenInformation) // CxbxKrnlCleanup("Unknown FILE_INFORMATION_CLASS 0x%.08X", FileInfo); @@ -1966,7 +2093,7 @@ XBSYSAPI EXPORTNUM(211) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryInformationFil } if(FAILED(ret)) - EmuWarning("NtQueryInformationFile failed!"); + EmuWarning("NtQueryInformationFile failed! (0x%.08X)", ret); EmuSwapFS(); // Xbox FS @@ -2526,6 +2653,8 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE GetCurrentThreadId(), ThreadHandle, ThreadExtraSize, KernelStackSize, TlsDataSize, ThreadId, StartContext1, StartContext2, CreateSuspended, DebugStack, StartRoutine); + static bool bFirstTime = false; + // create thread, using our special proxy technique { DWORD dwThreadId; @@ -2579,15 +2708,24 @@ XBSYSAPI EXPORTNUM(258) VOID NTAPI xboxkrnl::PsTerminateSystemThread(IN NTSTATUS GetCurrentThreadId(), ExitStatus); // call thread notification routine(s) - if(g_pfnThreadNotification != 0) + if(g_iThreadNotificationCount != 0) { - XTL::XTHREAD_NOTIFY_PROC pfnNotificationRoutine = (XTL::XTHREAD_NOTIFY_PROC)g_pfnThreadNotification; + for(int i = 0; i < 16; i++ ) + { + XTL::XTHREAD_NOTIFY_PROC pfnNotificationRoutine = (XTL::XTHREAD_NOTIFY_PROC)g_pfnThreadNotification[i]; - EmuSwapFS(); // Xbox FS + // If the routine doesn't exist, don't execute it! + if(pfnNotificationRoutine == NULL) + continue; - pfnNotificationRoutine(FALSE); + DbgPrintf("EmKrnl (0x%X): Calling pfnNotificationRoutine[%d] (0x%.08X)\n", g_iThreadNotificationCount, GetCurrentThreadId(), pfnNotificationRoutine); - EmuSwapFS(); // Win2k/XP FS + EmuSwapFS(); // Xbox FS + + pfnNotificationRoutine(FALSE); + + EmuSwapFS(); // Win2k/XP FS + } } // CxbxKrnlTerminateThread(); @@ -2677,7 +2815,7 @@ XBSYSAPI EXPORTNUM(277) VOID NTAPI xboxkrnl::RtlEnterCriticalSection //printf("CriticalSection->LockCount : %d\n", CriticalSection->LockCount); // This seems redundant, but xbox software doesn't always do it - //if(CriticalSection->LockCount == -1) + if(CriticalSection->LockCount == -1) NtDll::RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection); NtDll::RtlEnterCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection); diff --git a/src/CxbxKrnl/EmuXG.cpp b/src/CxbxKrnl/EmuXG.cpp index 6559ca5fd..b9c040174 100644 --- a/src/CxbxKrnl/EmuXG.cpp +++ b/src/CxbxKrnl/EmuXG.cpp @@ -179,14 +179,41 @@ VOID WINAPI XTL::EmuXGSwizzleBox GetCurrentThreadId(), pSource, RowPitch, SlicePitch, pBox, pDest, Width, Height, Depth, pPoint, BytesPerPixel); - if(pBox == NULL && pPoint == NULL && RowPitch == 0 && SlicePitch == 0) - { - memcpy(pDest, pSource, Width*Height*Depth*BytesPerPixel); - } - else - { - CxbxKrnlCleanup("Temporarily unsupported swizzle (easy fix)"); - } + if(pDest != (LPVOID) 0x80000000) + { + if(pBox == NULL && pPoint == NULL && RowPitch == 0 && SlicePitch == 0) + { + memcpy(pDest, pSource, Width*Height*Depth*BytesPerPixel); + } + else + { + if(pPoint != NULL && (pPoint->u != 0 || pPoint->u != 0 || pPoint->w != 0)) + CxbxKrnlCleanup("Temporarily unsupported swizzle (very easy fix)"); + + DWORD dwMaxY = Height; + DWORD dwMaxZ = Depth; + DWORD dwChunkSize = Width; + + uint08 *pSrc = (uint08*)pSource; + uint08 *pDst = (uint08*)pDest; + + if(pBox != 0) + { + pSrc += pBox->Top*RowPitch; + pSrc += pBox->Left; + + dwMaxY = pBox->Bottom - pBox->Top; + dwChunkSize = pBox->Right - pBox->Left; + } + + for(DWORD y=0;y +// ****************************************************************** +// * XACT Interfaces +// ****************************************************************** +struct X_XACTEngine; +struct X_XACTWaveBank; +struct X_XACTSoundBank; +struct X_XACTSoundSource; +struct X_XACTSoundCue; + // ****************************************************************** // * X_XACT_RUNTIME_PARAMETERS // ****************************************************************** @@ -64,6 +73,32 @@ struct X_XACT_WAVEBANK_STREAMING_PARAMETERS DWORD dwPacketSizeInMilliSecs; // stream packet size to use for each stream (in ms) }; +// ****************************************************************** +// * X_XACT_NOTIFICATION_DESCRIPTION +// ****************************************************************** +struct X_XACT_NOTIFICATION_DESCRIPTION +{ + WORD wType; + WORD wFlags; + X_XACTSoundBank* pSoundBank; + X_XACTWaveBank* pWaveBank; + DWORD dwSoundCueIndex; + X_XACTSoundCue* pSoundCue; + PVOID pvContext; + HANDLE hEvent; +}; + +typedef const X_XACT_NOTIFICATION_DESCRIPTION *PCXACT_NOTIFICATION_DESCRIPTION; + +//struct X_XACT_NOTIFICATION +//{ +// X_XACT_NOTIFICATION_DESCRIPTION Header; +// X_XACT_NOTIFICATION_UNION Data; +// REFERENCE_TIME rtTimeStamp; +//}; +// +//typedef const X_XACT_NOTIFICATION *PXACT_NOTIFICATION; + // ****************************************************************** // * X_XACTEngine // ****************************************************************** @@ -289,4 +324,32 @@ HRESULT WINAPI EmuIXACTSoundSource_SetVelocity DWORD dwApply ); +// ****************************************************************** +// * EmuIXACTEngine_RegisterNotification +// ****************************************************************** +HRESULT WINAPI EmuIXACTEngine_RegisterNotification +( + X_XACTEngine* pThis, + PCXACT_NOTIFICATION_DESCRIPTION pNotificationDesc +); + +// ****************************************************************** +// * EmuIXACTEngine_GetNotification +// ****************************************************************** +HRESULT WINAPI EmuIXACTEngine_GetNotification +( + X_XACTEngine* pThis, + PCXACT_NOTIFICATION_DESCRIPTION pNotificationDesc, + LPVOID pNotification +); + +// ****************************************************************** +// * EmuIXACTEngine_UnRegisterWaveBank +// ****************************************************************** +HRESULT WINAPI EmuIXACTEngine_UnRegisterWaveBank +( + X_XACTEngine* pThis, + X_XACTWaveBank* pWaveBank +); + #endif \ No newline at end of file diff --git a/src/CxbxKrnl/EmuXapi.cpp b/src/CxbxKrnl/EmuXapi.cpp index 0595d5533..d72df9e1b 100644 --- a/src/CxbxKrnl/EmuXapi.cpp +++ b/src/CxbxKrnl/EmuXapi.cpp @@ -54,6 +54,10 @@ extern SectionList* g_pSectionList; // Number of sections extern int g_NumSections; +bool g_bXLaunchNewImageCalled = false; +bool g_bXInputOpenCalled = false; + + // ****************************************************************** // * prevent name collisions // ****************************************************************** @@ -64,6 +68,13 @@ namespace NtDll #include "EmuXTL.h" + +XTL::POLLING_PARAMETERS_HANDLE g_pph; +XTL::XINPUT_POLLING_PARAMETERS g_pp; + +// Saved launch data +XTL::LAUNCH_DATA g_SavedLaunchData; + // ****************************************************************** // * func: EmuXapiApplyKernelPatches // ****************************************************************** @@ -184,18 +195,21 @@ PVOID WINAPI XTL::EmuRtlAllocateHeap PVOID pRet = CxbxRtlAlloc(hHeap, dwFlags, dwBytes+0x20); - offs = (BYTE)(RoundUp((uint32)pRet, 0x20) - (uint32)pRet); + if( pRet ) + { + offs = (BYTE)(RoundUp((uint32)pRet, 0x20) - (uint32)pRet); - if(offs == 0) - { - offs = 0x20; - } + if(offs == 0) + { + offs = 0x20; + } - pRet = (PVOID)((uint32)pRet + offs); + pRet = (PVOID)((uint32)pRet + offs); - *(BYTE*)((uint32)pRet - 1) = offs; + *(BYTE*)((uint32)pRet - 1) = offs; - DbgPrintf("pRet : 0x%.08X\n", pRet); + DbgPrintf("pRet : 0x%.08X\n", pRet); + } EmuSwapFS(); // XBox FS @@ -528,11 +542,11 @@ HANDLE WINAPI XTL::EmuXInputOpen { if(g_hInputHandle[dwPort] == 0) { - pph = new POLLING_PARAMETERS_HANDLE(); + pph = (POLLING_PARAMETERS_HANDLE*) &g_pph; // new POLLING_PARAMETERS_HANDLE(); if(pPollingParameters != NULL) { - pph->pPollingParameters = new XINPUT_POLLING_PARAMETERS(); + pph->pPollingParameters = (XINPUT_POLLING_PARAMETERS*) &g_pp; // new XINPUT_POLLING_PARAMETERS(); memcpy(pph->pPollingParameters, pPollingParameters, sizeof(XINPUT_POLLING_PARAMETERS)); } @@ -551,7 +565,7 @@ HANDLE WINAPI XTL::EmuXInputOpen { if(pph->pPollingParameters == 0) { - pph->pPollingParameters = new XINPUT_POLLING_PARAMETERS(); + pph->pPollingParameters = (XINPUT_POLLING_PARAMETERS*) &g_pp; // new XINPUT_POLLING_PARAMETERS(); } memcpy(pph->pPollingParameters, pPollingParameters, sizeof(XINPUT_POLLING_PARAMETERS)); @@ -560,7 +574,7 @@ HANDLE WINAPI XTL::EmuXInputOpen { if(pph->pPollingParameters != 0) { - delete pph->pPollingParameters; + //delete pph->pPollingParameters; pph->pPollingParameters = 0; } @@ -570,6 +584,8 @@ HANDLE WINAPI XTL::EmuXInputOpen pph->dwPort = dwPort; } + g_bXInputOpenCalled = true; + EmuSwapFS(); // XBox FS return (HANDLE)pph; @@ -1167,15 +1183,36 @@ VOID WINAPI XTL::EmuXRegisterThreadNotifyRoutine if(fRegister) { - if(g_pfnThreadNotification != NULL) - CxbxKrnlCleanup("Multiple thread notification routines installed (caustik can fix this!)"); + // I honestly don't expect this to happen, but if it does... + if(g_iThreadNotificationCount >= 16) + CxbxKrnlCleanup("Too many thread notification routines installed\n" + "If you're reading this message than tell blueshogun you saw it!!!"); - g_pfnThreadNotification = pThreadNotification->pfnNotifyRoutine; + // Find an empty spot in the thread notification array + for(int i = 0; i < 16; i++) + { + // If we find one, then add it to the array, and break the loop so + // that we don't accidently register the same routine twice! + if(g_pfnThreadNotification[i] == NULL) + { + g_pfnThreadNotification[i] = pThreadNotification->pfnNotifyRoutine; + g_iThreadNotificationCount++; + break; + } + } } else { - if(g_pfnThreadNotification != NULL) - g_pfnThreadNotification = NULL; + // Go through each routine and nullify the routine passed in. + for(int i = 0; i < 16; i++) + { + if(pThreadNotification->pfnNotifyRoutine == g_pfnThreadNotification[i]) + { + g_pfnThreadNotification[i] = NULL; + g_iThreadNotificationCount--; + break; + } + } } EmuSwapFS(); // XBox FS @@ -1247,88 +1284,13 @@ LPVOID WINAPI XTL::EmuXLoadSectionA ");\n", GetCurrentThreadId(), pSectionName, pSectionName ); - // Search this .xbe for the section it wants to load. + // TODO: Search this .xbe for the section it wants to load. // If we find it, return the address of it. -// LPVOID pRet = NULL; - - // Get the .xbe header - /*Xbe::Header* pXbeHeader = (Xbe::Header*) 0x00010000; - - // Get the number of sections this .xbe has and the - // location of the section headers. - DWORD dwNumSections = pXbeHeader->dwSections; - DWORD dwSectionAddr = pXbeHeader->dwSectionHeadersAddr - pXbeHeader->dwBaseAddr; - - // Get section headers. - Xbe::SectionHeader* pSectionHeaders = (Xbe::SectionHeader*) CxbxMalloc( sizeof( Xbe::SectionHeader ) * dwNumSections ); - - DWORD dwOffset = dwSectionAddr; - - for( DWORD i = 0; i < dwNumSections; i++ ) - { - memcpy( &pSectionHeaders[i], ((DWORD*) dwOffset), sizeof( Xbe::SectionHeader ) ); - dwOffset += sizeof( Xbe::SectionHeader ); - } - - // Find a match to the section name - DWORD dwSection = -1; - - for( DWORD i = 0; i < dwNumSections; i++ ) - { - char szSectionName[32]; - dwOffset = pSectionHeaders[i].dwSectionNameAddr - pXbeHeader->dwBaseAddr; - sprintf( szSectionName, "%s", ((DWORD*) dwOffset) ); - - // Do we have a match? - if( !strcmp( szSectionName, pSectionName ) ) - { - dwSection = i; - break; - } - } - - // If we have a match, get the raw address of this section - // and return a pointer to that address. - if( dwSection != -1 ) - { - pRet = (LPVOID) pSectionHeaders[dwSection].dwRawAddr; - } - - // Free up the memory - CxbxFree( pSectionHeaders );*/ - LPVOID pRet = NULL; - /*int Section = -1; - DbgPrintf( "Sections: %d\n", g_NumSections ); - DbgPrintf( "Section List 0x%.08X\n", g_pSectionList ); - - if( g_pSectionList ) - { - for( int i = 0; i < (int) g_NumSections; i++ ) - { - if( !strcmp( g_pSectionList[i].szSectionName, pSectionName ) ) - { - Section = i; - break; - } - } - - for( int i = 0; i < g_NumSections; i++ ) - DbgPrintf( "Section #%d: %s\n", i, g_pSectionList[i].szSectionName ); - - if( Section != -1 ) - { - pRet = ((LPVOID) g_pSectionList[Section].dwSectionAddr); - } - - __asm int 3; - } - else - { - EmuWarning( "Section List not initialized!" ); - __asm int 3; - }*/ + // Xbox Dashboard (3944) + if(strcmp("XIPS", pSectionName)==0) + pRet = (void*) 0x11C000; EmuSwapFS(); // Xbox FS @@ -1375,12 +1337,36 @@ HANDLE WINAPI XTL::EmuXGetSectionHandleA ");\n", GetCurrentThreadId(), pSectionName, pSectionName ); + DWORD* pdwRet = NULL; + // TODO: Implement (if necessary)? // CxbxKrnlCleanup( "XGetSectionHandleA is not implemented" ); + // TODO: Save the name and address of each section contained in + // this .xbe instead of adding this stuff by hand because the section + // address can change from one game region to the next, and some games + // will use the same engine and section name, so accuracy is not + // guarunteed. + + // Metal Gear Solid II (NTSC) + if( !strcmp( pSectionName, "Rev24b" ) ) + { + pdwRet = (DWORD*) 0x648000; + } + + // Metal Slug 3 (NTSC) + if(!strcmp(pSectionName, "newpal")) + pdwRet = (DWORD*) 0x26C000; + if(!strcmp(pSectionName, "msg_font")) + pdwRet = (DWORD*) 0x270000; + if(!strcmp(pSectionName, "se_all")) + pdwRet = (DWORD*) 0x272000; + if(!strcmp(pSectionName, ".XTLID")) + pdwRet = (DWORD*) 0x8C5000; + EmuSwapFS(); // Xbox FS - return NULL; + return (LPVOID) pdwRet; } // ****************************************************************** @@ -1395,16 +1381,16 @@ LPVOID WINAPI XTL::EmuXLoadSectionByHandle DbgPrintf("EmuXapi (0x%X): EmuXLoadSectionByHandle\n" "(\n" - " hSection : 0x%.80X\n" + " hSection : 0x%.08X\n" ");\n", GetCurrentThreadId(), hSection ); - // TODO: Implement (if necessary)? -// CxbxKrnlCleanup( "XLoadSectionByHandle is not implemented" ); + // The handle should contain the address of this section by the hack + // used in EmuXGetSectionHandleA. EmuSwapFS(); // Xbox FS - return NULL; + return (LPVOID) hSection; } // ****************************************************************** @@ -1419,7 +1405,7 @@ BOOL WINAPI XTL::EmuXFreeSectionByHandle DbgPrintf("EmuXapi (0x%X): EmuXFreeSectionByHandle\n" "(\n" - " hSection : 0x%.80X\n" + " hSection : 0x%.08X\n" ");\n", GetCurrentThreadId(), hSection ); @@ -1428,9 +1414,43 @@ BOOL WINAPI XTL::EmuXFreeSectionByHandle EmuSwapFS(); // Xbox FS - return NULL; + return TRUE; } +// ****************************************************************** +// * func: EmuXGetSectionSize +// ****************************************************************** +DWORD WINAPI XTL::EmuXGetSectionSize +( + HANDLE hSection +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuXGetSectionSize\n" + "(\n" + " hSection : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hSection ); + + DWORD dwSize = 0; + + // Metal Slug 3 (NTSC) + if(hSection == (HANDLE) 0x26C000) // newpal + dwSize = 0x31DA; + else if(hSection == (HANDLE) 0x270000) // msg_fong + dwSize = 0x115F; + else if(hSection == (HANDLE) 0x272000) // se_all + dwSize = 0x64F37E; + else if(hSection == (HANDLE) 0x8C5000) // .XTLID + dwSize = 0x480; + + EmuSwapFS(); + + return dwSize; +} + + // ****************************************************************** // * func: EmuRtlDestroyHeap // ****************************************************************** @@ -1443,7 +1463,7 @@ PVOID WINAPI XTL::EmuRtlDestroyHeap DbgPrintf("EmuXapi (0x%X): EmuRtlDestroyHeap\n" "(\n" - " HeapHandle : 0x%.80X\n" + " HeapHandle : 0x%.08X\n" ");\n", GetCurrentThreadId(), HeapHandle ); @@ -1454,6 +1474,518 @@ PVOID WINAPI XTL::EmuRtlDestroyHeap return pRet; } +// ****************************************************************** +// * func: EmuQueueUserAPC +// ****************************************************************** +DWORD WINAPI XTL::EmuQueueUserAPC +( + PAPCFUNC pfnAPC, + HANDLE hThread, + DWORD dwData +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuQueueUserAPC\n" + "(\n" + " pfnAPC : 0x%.08X\n" + " hThread : 0x%.08X\n" + " dwData : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pfnAPC, hThread, dwData); + + DWORD dwRet = 0; + + // If necessary, we can just continue to emulate NtQueueApcThread (0xCE). + // I added this because NtQueueApcThread fails in Metal Slug 3. + + HANDLE hApcThread = NULL; + if(!DuplicateHandle(GetCurrentProcess(),hThread,GetCurrentProcess(),&hApcThread,THREAD_SET_CONTEXT,FALSE,0)) + EmuWarning("DuplicateHandle failed!"); + + dwRet = QueueUserAPC(pfnAPC, hApcThread, dwData); + if(!dwRet) + EmuWarning("QueueUserAPC failed!"); + + EmuSwapFS(); // Xbox FS + + return dwRet; +} + +// ****************************************************************** +// * func: EmuGetOverlappedResult +// ****************************************************************** +BOOL WINAPI XTL::EmuGetOverlappedResult +( + HANDLE hFile, + LPOVERLAPPED lpOverlapped, + LPDWORD lpNumberOfBytesTransferred, + BOOL bWait +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuGetOverlappedResult\n" + "(\n" + " hFile : 0x%.08X\n" + " lpOverlapped : 0x%.08X\n" + " lpNumberOfBytesTransformed : 0x%.08X\n" + " bWait : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait); + + BOOL bRet = GetOverlappedResult( hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait ); + +// if(bWait) +// bRet = TRUE; // Sucker... + + EmuSwapFS(); // Xbox FS + + return bRet; +} + +// ****************************************************************** +// * func: EmuXLaunchNewImage +// ****************************************************************** +DWORD WINAPI XTL::EmuXLaunchNewImage +( + LPCSTR lpTitlePath, + PLAUNCH_DATA pLaunchData +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuXLaunchNewImage\n" + "(\n" + " lpTitlePath : 0x%.08X (%s)\n" + " pLaunchData : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), lpTitlePath, lpTitlePath, pLaunchData); + + // If this function succeeds, it doesn't get a chance to return anything. + DWORD dwRet = ERROR_GEN_FAILURE; + + // If no path is specified, then the xbe is rebooting to dashboard + if(!lpTitlePath) + CxbxKrnlCleanup("The xbe is rebooting (XLaunchNewImage)"); + + // Ignore any other attempts to execute other .xbe files (for now). + EmuWarning("Not executing the xbe!"); + + // Save the launch data + if(pLaunchData != NULL) + { + CopyMemory(&g_SavedLaunchData, pLaunchData, sizeof(LAUNCH_DATA)); + + // Save the launch data parameters to disk for later. + DbgPrintf("Saving launch data as CxbxLaunchData.bin...\n"); + + FILE* fp = fopen("CxbxLaunchData.bin", "wb"); + + fseek(fp, 0, SEEK_SET); + fwrite(pLaunchData, sizeof( LAUNCH_DATA ), 1, fp); + fclose(fp); + } + + g_bXLaunchNewImageCalled = true; + + // Temporary Hack (Unreal): Jump back to the entry point + uint32* start = (uint32*) 0x21C13B; + + EmuSwapFS(); // Xbox FS + + __asm + { + /*mov esi, 0; + mov edi, 0; + mov esp, 0; + mov ebp, 0;*/ + jmp start; + } + + return dwRet; +} + +// ****************************************************************** +// * func: EmuXGetLaunchInfo +// ****************************************************************** +DWORD WINAPI XTL::EmuXGetLaunchInfo +( + PDWORD pdwLaunchDataType, + PLAUNCH_DATA pLaunchData +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuXGetLaunchInfo\n" + "(\n" + " pdwLaunchDataType : 0x%.08X\n" + " pLaunchData : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pdwLaunchDataType, pLaunchData); + + DWORD dwRet = E_FAIL; + + // Has XLaunchNewImage been called since we've started this round? + if(g_bXLaunchNewImageCalled) + { + // I don't think we'll be emulating any other xbox apps + // other than games anytime soon... + *pdwLaunchDataType = LDT_TITLE; + + // Copy saved launch data + CopyMemory(pLaunchData, &g_SavedLaunchData, sizeof(LAUNCH_DATA)); + + dwRet = ERROR_SUCCESS; + } + + FILE* fp = NULL; + + // Does CxbxLaunchData.bin exist? + if(!g_bXLaunchNewImageCalled) + fp = fopen("CxbxLaunchData.bin", "rb"); + + // If it does exist, load it. + if(fp) + { + // Data from Xbox game + *pdwLaunchDataType = LDT_TITLE; + + // Read in the contents. + fseek(fp, 0, SEEK_SET); + fread(&g_SavedLaunchData, sizeof(LAUNCH_DATA), 1, fp); + memcpy(pLaunchData, &g_SavedLaunchData, sizeof(LAUNCH_DATA)); +// fread(pLaunchData, sizeof(LAUNCH_DATA), 1, fp); +// memcpy(&g_SavedLaunchData, pLaunchData, sizeof(LAUNCH_DATA)); + fclose(fp); + + // Delete the file once we're done. + DeleteFile("CxbxLaunchData.bin"); + + // HACK: Initialize XInput from restart + /*if(g_bXInputOpenCalled) + { + EmuSwapFS(); + XTL::EmuXInputOpen( NULL, 0, 0, NULL ); + EmuSwapFS(); + }*/ + + dwRet = ERROR_SUCCESS; + } + + EmuSwapFS(); // Xbox FS + + return dwRet; +} + +// ****************************************************************** +// * func: EmuXSetProcessQuantumLength +// ****************************************************************** +VOID WINAPI XTL::EmuXSetProcessQuantumLength +( + DWORD dwMilliseconds +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuXSetProcessQuantumLength\n" + "(\n" + " dwMilliseconds : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), dwMilliseconds); + + // TODO: Implement? + EmuWarning("XSetProcessQuantumLength is being ignored!"); + + EmuSwapFS(); // Xbox FS +} + +// ****************************************************************** +// * func: EmuXGetFileCacheSize +// ****************************************************************** +DWORD WINAPI XTL::EmuXGetFileCacheSize() +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuXGetFileCacheSize()\n", GetCurrentThreadId()); + + // Return the default cache size for now. + // TODO: Save the file cache size if/when set. + DWORD dwRet = 64 * 1024; + + EmuSwapFS(); + + return dwRet; +} + +// ****************************************************************** +// * func: EmuSignalObjectAndWait +// ****************************************************************** +DWORD WINAPI XTL::EmuSignalObjectAndWait +( + HANDLE hObjectToSignal, + HANDLE hObjectToWaitOn, + DWORD dwMilliseconds, + BOOL bAlertable +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuSignalObjectAndWait\n" + "(\n" + " hObjectToSignal : 0x%.08X\n" + " hObjectToWaitOn : 0x%.08X\n" + " dwMilliseconds : 0x%.08X\n" + " bAlertable : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable); + + DWORD dwRet = SignalObjectAndWait( hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable ); + + EmuSwapFS(); // Xbox FS + + return dwRet; +} + +// ****************************************************************** +// * func: EmuPulseEvent +// ****************************************************************** +BOOL WINAPI XTL::EmuPulseEvent( HANDLE hEvent ) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuPulseEvent\n" + "(\n" + " hEvent : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hEvent); + + // TODO: This function might be a bit too high level. If it is, + // feel free to implement NtPulseEvent in EmuKrnl.cpp + + BOOL bRet = PulseEvent( hEvent ); + + EmuSwapFS(); // Xbox FS + + return bRet; +} + +// ****************************************************************** +// * func: EmuCreateSemaphore +// ****************************************************************** +HANDLE WINAPI XTL::EmuCreateSemaphore +( + LPVOID lpSemaphoreAttributes, + LONG lInitialCount, + LONG lMaximumCount, + LPSTR lpName +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuCreateSemaphore\n" + "(\n" + " lpSemaphoreAttributes : 0x%.08X\n" + " lInitialCount : 0x%.08X\n" + " lMaximumCount : 0x%.08X\n" + " lpName : 0x%.08X (%s)\n" + ");\n", + GetCurrentThreadId(), lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName); + + if(lpSemaphoreAttributes) + EmuWarning( "lpSemaphoreAttributes != NULL" ); + + HANDLE hRet = CreateSemaphore( NULL, lInitialCount, lMaximumCount, lpName ); + if( !hRet ) + EmuWarning( "CreateSemaphore failed!" ); + + EmuSwapFS(); // Xbox FS + + return hRet; +} + +// ****************************************************************** +// * func: EmuReleaseSemaphore +// ****************************************************************** +BOOL WINAPI XTL::EmuReleaseSemaphore +( + HANDLE hSemaphore, + LONG lReleaseCount, + LPLONG lpPreviousCount +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuReleaseSemaphore\n" + "(\n" + " hSemaphore : 0x%.08X\n" + " lReleaseCount : 0x%.08X\n" + " lpPreviousCount : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hSemaphore, lReleaseCount, lpPreviousCount); + + BOOL bRet = ReleaseSemaphore( hSemaphore, lReleaseCount, lpPreviousCount ); + if( !bRet ) + EmuWarning( "ReleaseSemaphore failed!" ); + + EmuSwapFS(); // Xbox FS + + return bRet; +} + +// ****************************************************************** +// * func: timeSetEvent +// ****************************************************************** +MMRESULT WINAPI XTL::EmutimeSetEvent +( + UINT uDelay, + UINT uResolution, + LPTIMECALLBACK fptc, + DWORD dwUser, + UINT fuEvent +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuReleaseSemaphore\n" + "(\n" + " uDelay : 0x%.08X\n" + " uResolution : 0x%.08X\n" + " fptc : 0x%.08X\n" + " dwUser : 0x%.08X\n" + " fuEvent : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), uDelay, uResolution, fptc, dwUser, fuEvent); + + MMRESULT Ret = timeSetEvent( uDelay, uResolution, fptc, (DWORD_PTR) dwUser, fuEvent ); + + EmuSwapFS(); // Xbox FS + + return Ret; +} + +// ****************************************************************** +// * func: timeKillEvent +// ****************************************************************** +MMRESULT WINAPI XTL::EmutimeKillEvent +( + UINT uTimerID +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuReleaseSemaphore\n" + "(\n" + " uTimerID : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), uTimerID); + + MMRESULT Ret = timeKillEvent( uTimerID ); + + EmuSwapFS(); // Xbox FS + + return Ret; +} + +// ****************************************************************** +// * func: EmuRaiseException +// ****************************************************************** +VOID WINAPI XTL::EmuRaiseException +( + DWORD dwExceptionCode, // exception code + DWORD dwExceptionFlags, // continuable exception flag + DWORD nNumberOfArguments, // number of arguments + CONST ULONG_PTR *lpArguments // array of arguments +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuRaiseException\n" + "(\n" + " dwExceptionCode : 0x%.08X\n" + " dwExceptionFlags : 0x%.08X\n" + " nNumberOfArguments: 0x%.08X\n" + " lpArguments : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments); + + // TODO: Implement or not? +// RaiseException(dwExceptionCode, dwExceptionFlags, nNumberOfArguments, (*(ULONG_PTR**) &lpArguments)); + + EmuSwapFS(); // Xbox FS +} + +// ****************************************************************** +// * func: EmuGetFileAttributesA +// ****************************************************************** +DWORD WINAPI XTL::EmuGetFileAttributesA +( + LPCSTR lpFileName // name of file or directory +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuGetFileAttributesA\n" + "(\n" + " lpFileName : (%s)\n" + ");\n", + GetCurrentThreadId(), lpFileName); + + // Dues Ex... + + // Shave off the D:\ and default to the current directory. + // TODO: Other directories (i.e. Utility)? + + char* szBuffer = (char*) lpFileName; + + if((szBuffer[0] == 'D' || szBuffer[0] == 'd') && szBuffer[1] == ':' || szBuffer[2] == '\\') + { + szBuffer += 3; + + DbgPrintf("EmuXapi (0x%X): GetFileAttributesA Corrected path...\n", GetCurrentThreadId()); + DbgPrintf(" Org:\"%s\"\n", lpFileName); + DbgPrintf(" New:\"$XbePath\\%s\"\n", szBuffer); + } + + DWORD dwRet = GetFileAttributes(szBuffer); + if(FAILED(dwRet)) + EmuWarning("GetFileAttributes failed!"); + + EmuSwapFS(); + + return dwRet; +} + +// ****************************************************************** +// func: EmuVirtualProtect +// ****************************************************************** +BOOL WINAPI XTL::EmuVirtualProtect +( + LPVOID lpAddress, // region of committed pages + SIZE_T dwSize, // size of the region + DWORD flNewProtect, // desired access protection + PDWORD lpflOldProtect // old protection +) +{ + EmuSwapFS(); + + DbgPrintf("EmuXapi (0x%X): EmuVirtualProtect\n" + "(\n" + " lpAddress : 0x%.08X\n" + " dwSize : 0x%.08X\n" + " flNewProtect : 0x%.08X\n" + " lpflOldProtect : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), lpAddress, dwSize, flNewProtect, lpflOldProtect); + + DWORD dwRet = VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect); + + EmuSwapFS(); + + return dwRet; +} + + /* not necessary? // ****************************************************************** // * func: EmuXCalculateSignatureBegin diff --git a/src/CxbxKrnl/EmuXapi.h b/src/CxbxKrnl/EmuXapi.h index 79fcc939a..35dbcbd2e 100644 --- a/src/CxbxKrnl/EmuXapi.h +++ b/src/CxbxKrnl/EmuXapi.h @@ -291,6 +291,23 @@ XCALCSIG_SIGNATURE, *PXCALCSIG_SIGNATURE; #define XCALCSIG_FLAG_NON_ROAMABLE (0x00000001) +// ****************************************************************** +// * LAUNCH_DATA +// ****************************************************************** +#define MAX_LAUNCH_DATA_SIZE 1024 * 3 + +typedef struct _LAUNCH_DATA +{ + BYTE Data[MAX_LAUNCH_DATA_SIZE]; +} +LAUNCH_DATA, *PLAUNCH_DATA; + +#define LDT_TITLE 0 +#define LDT_FROM_DASHBOARD 2 +#define LDT_FROM_DEBUGGER_CMDLINE 3 +#define LDT_FROM_UPDATE 4 + + // ****************************************************************** // * func: EmuXapiApplyKernelPatches // ****************************************************************** @@ -594,7 +611,7 @@ LPVOID WINAPI EmuCreateFiber // ****************************************************************** VOID WINAPI EmuDeleteFiber ( - LPVOID lpFiber + LPVOID lpFiber ); // ****************************************************************** @@ -602,7 +619,7 @@ VOID WINAPI EmuDeleteFiber // ****************************************************************** LPVOID WINAPI EmuXLoadSectionA ( - LPCSTR pSectionName + LPCSTR pSectionName ); // ****************************************************************** @@ -610,7 +627,7 @@ LPVOID WINAPI EmuXLoadSectionA // ****************************************************************** BOOL WINAPI EmuXFreeSectionA ( - LPCSTR pSectionName + LPCSTR pSectionName ); // ****************************************************************** @@ -618,7 +635,7 @@ BOOL WINAPI EmuXFreeSectionA // ****************************************************************** HANDLE WINAPI EmuXGetSectionHandleA ( - LPCSTR pSectionName + LPCSTR pSectionName ); // ****************************************************************** @@ -626,7 +643,7 @@ HANDLE WINAPI EmuXGetSectionHandleA // ****************************************************************** LPVOID WINAPI EmuXLoadSectionByHandle ( - HANDLE hSection + HANDLE hSection ); // ****************************************************************** @@ -634,7 +651,15 @@ LPVOID WINAPI EmuXLoadSectionByHandle // ****************************************************************** BOOL WINAPI EmuXFreeSectionByHandle ( - HANDLE hSection + HANDLE hSection +); + +// ****************************************************************** +// * func: EmuXGetSectionSize +// ****************************************************************** +DWORD WINAPI EmuXGetSectionSize +( + HANDLE hSection ); // ****************************************************************** @@ -645,6 +670,146 @@ PVOID WINAPI EmuRtlDestroyHeap IN HANDLE HeapHandle ); +// ****************************************************************** +// * func: EmuQueueUserAPC +// ****************************************************************** +DWORD WINAPI EmuQueueUserAPC +( + PAPCFUNC pfnAPC, + HANDLE hThread, + DWORD dwData +); + +// ****************************************************************** +// * func: EmuGetOverlappedResult +// ****************************************************************** +BOOL WINAPI EmuGetOverlappedResult +( + HANDLE hFile, + LPOVERLAPPED lpOverlapped, + LPDWORD lpNumberOfBytesTransferred, + BOOL bWait +); + +// ****************************************************************** +// * func: EmuXLaunchNewImage +// ****************************************************************** +DWORD WINAPI EmuXLaunchNewImage +( + LPCSTR lpTitlePath, + PLAUNCH_DATA pLaunchData +); + +// ****************************************************************** +// * func: EmuXGetLaunchInfo +// ****************************************************************** +DWORD WINAPI EmuXGetLaunchInfo +( + PDWORD pdwLaunchDataType, + PLAUNCH_DATA pLaunchData +); + +// ****************************************************************** +// * func: EmuXSetProcessQuantumLength +// ****************************************************************** +VOID WINAPI EmuXSetProcessQuantumLength +( + DWORD dwMilliseconds +); + +// ****************************************************************** +// * func: EmuXGetFileCacheSize +// ****************************************************************** +DWORD WINAPI EmuXGetFileCacheSize(); + +// ****************************************************************** +// * func: EmuSignalObjectAndWait +// ****************************************************************** +DWORD WINAPI EmuSignalObjectAndWait +( + HANDLE hObjectToSignal, + HANDLE hObjectToWaitOn, + DWORD dwMilliseconds, + BOOL bAlertable +); + +// ****************************************************************** +// * func: EmuPulseEvent +// ****************************************************************** +BOOL WINAPI EmuPulseEvent( HANDLE hEvent ); + +// ****************************************************************** +// * func: EmuCreateSemaphore +// ****************************************************************** +HANDLE WINAPI EmuCreateSemaphore +( + LPVOID lpSemaphoreAttributes, + LONG lInitialCount, + LONG lMaximumCount, + LPSTR lpName +); + +// ****************************************************************** +// * func: EmuReleaseSemaphore +// ****************************************************************** +BOOL WINAPI EmuReleaseSemaphore +( + HANDLE hSemaphore, + LONG lReleaseCount, + LPLONG lpPreviousCount +); + +// ****************************************************************** +// * func: timeSetEvent +// ****************************************************************** +MMRESULT WINAPI EmutimeSetEvent +( + UINT uDelay, + UINT uResolution, + LPTIMECALLBACK fptc, + DWORD dwUser, + UINT fuEvent +); + +// ****************************************************************** +// * func: timeKillEvent +// ****************************************************************** +MMRESULT WINAPI EmutimeKillEvent +( + UINT uTimerID +); + +// ****************************************************************** +// * func: EmuRaiseException +// ****************************************************************** +VOID WINAPI EmuRaiseException +( + DWORD dwExceptionCode, // exception code + DWORD dwExceptionFlags, // continuable exception flag + DWORD nNumberOfArguments, // number of arguments + CONST ULONG_PTR *lpArguments // array of arguments +); + +// ****************************************************************** +// * func: EmuGetFileAttributesA +// ****************************************************************** +DWORD WINAPI EmuGetFileAttributesA +( + LPCSTR lpFileName // name of file or directory +); + +// ****************************************************************** +// func: EmuVirtualProtect +// ****************************************************************** +BOOL WINAPI EmuVirtualProtect +( + LPVOID lpAddress, // region of committed pages + SIZE_T dwSize, // size of the region + DWORD flNewProtect, // desired access protection + PDWORD lpflOldProtect // old protection +); + + // s+ /* not necessary? // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase.cpp b/src/CxbxKrnl/HLEDataBase.cpp index 4e89fda7a..164c265b2 100644 --- a/src/CxbxKrnl/HLEDataBase.cpp +++ b/src/CxbxKrnl/HLEDataBase.cpp @@ -60,6 +60,7 @@ extern "C" const char *szHLELastCompileTime = __TIMESTAMP__; #include "HLEDataBase/D3D8.1.0.5233.inl" #include "HLEDataBase/D3D8.1.0.5558.inl" #include "HLEDataBase/D3D8.1.0.5849.inl" +#include "HLEDataBase/D3D8LTCG.1.0.5849.inl" #include "HLEDataBase/DSound.1.0.3936.inl" #include "HLEDataBase/DSound.1.0.4361.inl" #include "HLEDataBase/DSound.1.0.4432.inl" @@ -67,6 +68,7 @@ extern "C" const char *szHLELastCompileTime = __TIMESTAMP__; #include "HLEDataBase/DSound.1.0.5233.inl" #include "HLEDataBase/DSound.1.0.5558.inl" #include "HLEDataBase/DSound.1.0.5849.inl" +#include "HLEDataBase/XG.1.0.3911.inl" #include "HLEDataBase/XG.1.0.4361.inl" #include "HLEDataBase/XG.1.0.4627.inl" #include "HLEDataBase/XG.1.0.5233.inl" @@ -74,6 +76,7 @@ extern "C" const char *szHLELastCompileTime = __TIMESTAMP__; #include "HLEDataBase/XNet.1.0.3911.inl" #include "HLEDataBase/XOnline.1.0.4361.inl" #include "HLEDataBase/XOnline.1.0.4627.inl" +#include "HLEDataBase/XOnline.1.0.5233.inl" #include "HLEDataBase/XactEng.1.0.4627.inl" // ****************************************************************** @@ -206,6 +209,13 @@ HLEData HLEDataBase[] = 1, 0, 5849, D3D8_1_0_5849, D3D8_1_0_5849_SIZE + }, + // D3D8LTCG Version 1.0.5849 + { + "D3D8LTCG", + 1, 0, 5849, + D3D8LTCG_1_0_5849, + D3D8LTCG_1_0_5849_SIZE }, // DSound Version 1.0.3936 { @@ -255,6 +265,13 @@ HLEData HLEDataBase[] = 1, 0, 5849, DSound_1_0_5849, DSound_1_0_5849_SIZE + }, + // XG Version 1.0.3911 + { + "XGRAPHC", + 1, 0, 3911, + XG_1_0_3911, + XG_1_0_3911_SIZE }, // XG Version 1.0.4361 { @@ -305,6 +322,13 @@ HLEData HLEDataBase[] = 1, 0, 4627, XOnline_1_0_4627, XOnline_1_0_4627_SIZE + }, + // XOnline(s) Version 1.0.5233 + { + "XONLINES", + 1, 0, 5233, + XOnline_1_0_5233, + XOnline_1_0_5233_SIZE }, // XactEng Version 1.0.4627 { @@ -476,10 +500,31 @@ extern uint32 XRefDataBase[] = -1, // XREF_DirectSound_CDirectSoundBuffer_SetAllParameters -1, // XREF_DirectSound_CDirectSound_EnableHeadphones -1, // XREF_DirectSound_CDirectSoundVoice_SetHeadroom + -1, // XREF_DirectSound_CDirectSoundBuffer_SetHeadroom -1, // XREF_DirectSound_CDirectSound_GetOutputLevels + -1, // XREF_DirectSound_CMcpxBuffer_Pause -1, // XREF_DirectSound_CDirectSoundBuffer_Pause -1, // XREF_DirectSound_CMcpxBuffer_GetStatus -1, // XREF_DirectSound_CDirectSoundBuffer_GetStatus + -1, // XREF_DirectSound_CDirectSoundVoice_SetEG + -1, // XREF_DirectSound_CMcpxVoiceClient_SetEG + -1, // XREF_DirectSound_CMcpxVoiceClient_SetFilter + -1, // XREF_DirectSound_CDirectSoundVoice_SetFilter + -1, // XREF_DirectSound_CDirectSoundBuffer_SetFilter + -1, // XREF_DirectSound_CDirectSoundStream_SetFilter + -1, // XREF_DirectSound_CDirectSoundBuffer_StopEx + -1, // XREF_CMcpxBuffer_Stop2 + -1, // XREF_CMcpxAPU_Set3dDopplerFactor + -1, // XREF_CSensaura3d_GetFullHRTFFilterPair + -1, // XREF_CDirectSound_GetCaps + -1, // XREF_CDirectSoundVoice_SetPitch + -1, // XREF_DirectSoundEnterCriticalSection + -1, // XREF_CDirectSoundBuffer_SetMinDistance + -1, // XREF_CDirectSoundBuffer_SetMaxDistance + -1, // XREF_CMcpxVoiceClient_Commit3dSettings + -1, // XREF_CMcpxVoiceClient_SetI3DL2Source + -1, // XREF_CDirectSoundVoice_SetI3DL2Source + -1, // XREF_CDirectSoundVoice_SetMixBinVolumes // XACT -1, // XREF_XACT_CEngine_RegisterWaveBank -1, // XREF_XACT_CEngine_RegisterStreamedWaveBank @@ -487,6 +532,13 @@ extern uint32 XRefDataBase[] = -1, // XREF_XACT_CEngine_DownloadEffectsImage -1, // XREF_XACT_CEngine_CreateSoundSource -1, // XREF_XACT_CSoundBank_GetSoundCueIndexFromFriendlyName + -1, // XREF_XACT_CEngine_RegisterNotification + -1, // XREF_XACT_CEngine_GetNotification + -1, // XREF_XACT_CEngine_UnRegisterWaveBank + // XONLINE + -1, // XREF_XoUpdateLaunchNewImageInternal + -1, // XREF_CXo_XOnlineLogon + -1, /* not necessary? -1, //XREF_XAPIXCALCULATESIGNATUREBEGINEX //*/ diff --git a/src/CxbxKrnl/HLEDataBase.h b/src/CxbxKrnl/HLEDataBase.h index fe44e7879..f7e3a5903 100644 --- a/src/CxbxKrnl/HLEDataBase.h +++ b/src/CxbxKrnl/HLEDataBase.h @@ -52,6 +52,7 @@ #include "HLEDataBase/D3D8.1.0.5233.h" #include "HLEDataBase/D3D8.1.0.5558.h" #include "HLEDataBase/D3D8.1.0.5849.h" +#include "HLEDataBase/D3D8LTCG.1.0.5849.h" #include "HLEDataBase/DSound.1.0.3936.h" #include "HLEDataBase/DSound.1.0.4361.h" #include "HLEDataBase/DSound.1.0.4432.h" @@ -66,6 +67,7 @@ #include "HLEDataBase/XNet.1.0.3911.h" #include "HLEDataBase/XOnline.1.0.4361.h" #include "HLEDataBase/XOnline.1.0.4627.h" +#include "HLEDataBase/XOnline.1.0.5233.h" #include "HLEDataBase/XactEng.1.0.4627.h" // ****************************************************************** @@ -125,6 +127,7 @@ enum XRefDataBaseOffset XREF_D3DCD_LAZYSETSTATEVB, XREF_D3D_BLOCKONTIME, XREF_D3D_SETFENCE, + XREF_D3D_KickOffAndWaitForIdle, XREF_XNINIT, XREF_FCLOSEDEVICE, XREF_CLEARSTATEBLOCKFLAGS, @@ -266,10 +269,31 @@ enum XRefDataBaseOffset XREF_DirectSound_CDirectSoundBuffer_SetAllParameters, XREF_DirectSound_CDirectSound_EnableHeadphones, XREF_DirectSound_CDirectSoundVoice_SetHeadroom, + XREF_DirectSound_CDirectSoundBuffer_SetHeadroom, XREF_DirectSound_CDirectSound_GetOutputLevels, + XREF_DirectSound_CMcpxBuffer_Pause, XREF_DirectSound_CDirectSoundBuffer_Pause, XREF_DirectSound_CMcpxBuffer_GetStatus, XREF_DirectSound_CDirectSoundBuffer_GetStatus, + XREF_DirectSound_CDirectSoundVoice_SetEG, + XREF_DirectSound_CMcpxVoiceClient_SetEG, + XREF_DirectSound_CMcpxVoiceClient_SetFilter, + XREF_DirectSound_CDirectSoundVoice_SetFilter, + XREF_DirectSound_CDirectSoundBuffer_SetFilter, + XREF_DirectSound_CDirectSoundStream_SetFilter, + XREF_DirectSound_CDirectSoundBuffer_StopEx, + XREF_CMcpxBuffer_Stop2, + XREF_CMcpxAPU_Set3dDopplerFactor, + XREF_CSensaura3d_GetFullHRTFFilterPair, + XREF_CDirectSound_GetCaps, + XREF_CDirectSoundVoice_SetPitch, + XREF_DirectSoundEnterCriticalSection, + XREF_CDirectSoundBuffer_SetMinDistance, + XREF_CDirectSoundBuffer_SetMaxDistance, + XREF_CMcpxVoiceClient_Commit3dSettings, + XREF_CMcpxVoiceClient_SetI3DL2Source, + XREF_CDirectSoundVoice_SetI3DL2Source, + XREF_CDirectSoundVoice_SetMixBinVolumes, // XACT // +s XREF_XACT_CEngine_RegisterWaveBank, @@ -278,6 +302,13 @@ enum XRefDataBaseOffset XREF_XACT_CEngine_DownloadEffectsImage, XREF_XACT_CEngine_CreateSoundSource, XREF_XACT_CSoundBank_GetSoundCueIndexFromFriendlyName, + XREF_XACT_CEngine_RegisterNotification, + XREF_XACT_CEngine_GetNotification, + XREF_XACT_CEngine_UnRegisterWaveBank, + // XONLINE + // +s + XREF_XoUpdateLaunchNewImageInternal, + XREF_CXo_XOnlineLogon, // XAPI /* not necessary? diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.3925.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.3925.inl index 38e400fcd..1c9630277 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.3925.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.3925.inl @@ -219,6 +219,8 @@ SOOVPA<11> IDirect3DDevice8_GetVisibilityTestResult_1_0_3925 = // ****************************************************************** // * IDirect3D8_KickOffAndWaitForIdle // ****************************************************************** +// * Actually, this is D3D::CDevice::KickOff +// ****************************************************************** SOOVPA<10> IDirect3D8_KickOffAndWaitForIdle_1_0_3925 = { 0, // Large == 0 @@ -404,6 +406,58 @@ SOOVPA<11> IDirect3DDevice8_SetRenderTarget_1_0_3925 = } }; +// ****************************************************************** +// * IDirect3DDevice8_SetRenderTarget +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetRenderTarget_1_0_3948 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderTarget+0x00 : sub esp, 0x30 + { 0x00, 0x83 }, // (Offset,Value)-Pair #1 + { 0x01, 0xEC }, // (Offset,Value)-Pair #2 + { 0x02, 0x30 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetRenderTarget+0x32 : and ecx, 0x0F + { 0x32, 0x83 }, // (Offset,Value)-Pair #4 + { 0x33, 0xE1 }, // (Offset,Value)-Pair #5 + { 0x34, 0x0F }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderTarget+0x69 : push ebx + { 0x69, 0x53 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetRenderTarget+0xDA : push edx + { 0xDA, 0x52 }, // (Offset,Value)-Pair #8 + } +}; + +// ****************************************************************** +// * D3DSurface_GetDesc +// ****************************************************************** +SOOVPA<7> D3DSurface_GetDesc_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x01, 0x44 }, + { 0x04, 0x8B }, + { 0x07, 0x04 }, + { 0x0A, 0x00 }, + { 0x11, 0xC2 }, + { 0x12, 0x08 }, + { 0x13, 0x00 }, + } +}; + // ****************************************************************** // * IDirect3DDevice8_GetTransform // ****************************************************************** @@ -2497,6 +2551,1691 @@ SOOVPA<11> IDirect3DDevice8_SetMaterial_1_0_3925 = } }; +// ****************************************************************** +// * IDirect3DDevice8_AddRef +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_AddRef_1_0_3925 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_AddRef+0x00 : mov eax, [addr] + { 0x00, 0xA1 }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_AddRef+0x05 : mov ecx, [eax+0x0408] + { 0x05, 0x8B }, // (Offset,Value)-Pair #2 + { 0x06, 0x88 }, // (Offset,Value)-Pair #3 + { 0x07, 0x08 }, // (Offset,Value)-Pair #4 + { 0x08, 0x04 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_AddRef+0x0B : inc ecx + { 0x0B, 0x41 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_AddRef+0x05 : mov [eax+0x0408], ecx + { 0x0C, 0x89 }, // (Offset,Value)-Pair #7 + { 0x0D, 0x88 }, // (Offset,Value)-Pair #8 + { 0x0E, 0x08 }, // (Offset,Value)-Pair #9 + { 0x0F, 0x04 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_Unknown1 +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_Unknown1_1_0_3925 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_Unknown1+0x00 : xor eax, eax + { 0x00, 0x33 }, + { 0x01, 0xC0 }, + // IDirect3DDevice8_Unknown1+0x13 : call ds:AvSendTVEncoderOption + { 0x13, 0xFF }, + { 0x14, 0x15 }, + { 0x15, 0x10 }, + { 0x16, 0x49 }, + { 0x17, 0x2A }, + { 0x18, 0x00 }, + // IDirect3DDevice8_Unknown1+0x1E : retn + { 0x1E, 0xC3 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_GetViewport +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_GetViewport_1_0_3925 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_GetViewport+0x05 : push esi; push edi + { 0x05, 0x56 }, // (Offset,Value)-Pair #1 + { 0x06, 0x57 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_GetViewport+0x0B : lea esi, [eax+0x0B00] + { 0x0B, 0x8D }, // (Offset,Value)-Pair #3 + { 0x0C, 0xB0 }, // (Offset,Value)-Pair #4 + { 0x0D, 0x00 }, // (Offset,Value)-Pair #5 + { 0x0E, 0x0B }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_GetViewport+0x11 : mov ecx, 6 + { 0x11, 0xB9 }, // (Offset,Value)-Pair #7 + { 0x12, 0x06 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_GetViewport+0x1A : retn 0x04 + { 0x1A, 0xC2 }, // (Offset,Value)-Pair #9 + { 0x1B, 0x04 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_GetGammaRamp +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_GetGammaRamp_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x05, 0x8B }, + { 0x0A, 0x00 }, + { 0x10, 0xE1 }, + { 0x16, 0x0C }, + { 0x1C, 0x00 }, + { 0x22, 0x00 }, + { 0x28, 0x04 }, + } +}; +// ****************************************************************** +// * D3DDevice_GetDisplayFieldStatus +// ****************************************************************** +SOOVPA<14> D3DDevice_GetDisplayFieldStatus_1_0_3925 = +{ + 0, // Large == 0 + 14, // Count == 14 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + // IDirect3DDevice8_GetDisplayFieldStatus+0x05 : mov edx, [eax+0x2B28] + { 0x05, 0x8B }, + { 0x06, 0x90 }, + { 0x07, 0x28 }, + { 0x08, 0x2B }, + // IDirect3DDevice8_GetDisplayFieldStatus+0x12 : test [eax+0x2510], 0x1200000 + { 0x12, 0xF7 }, + { 0x13, 0x80 }, + { 0x14, 0x10 }, + { 0x15, 0x25 }, + // IDirect3DDevice8_GetDisplayFieldStatus+0x1E : mov dx, 0x80C0 + { 0x1E, 0x66 }, + { 0x1F, 0xBA }, + { 0x20, 0xC0 }, + { 0x21, 0x80 }, + // IDirect3DDevice8_GetDisplayFieldStatus+0x3C : retn 4 + { 0x3C, 0xC2 }, + { 0x3D, 0x04 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetRenderState_MultiSampleAntiAlias +// ****************************************************************** +SOOVPA<7> D3DDevice_SetRenderState_MultiSampleAntiAlias_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0B, 0x8B }, + { 0x1D, 0x8B }, + { 0x26, 0x8B }, + { 0x2C, 0x8B }, + { 0x38, 0x0B }, + { 0x40, 0x89 }, + { 0x49, 0xC2 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_VertexBlend +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_VertexBlend_1_0_3925 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_VertexBlend+0x0A : or ecx, 2 + { 0x0A, 0x83 }, // (Offset,Value)-Pair #1 + { 0x0B, 0xC9 }, // (Offset,Value)-Pair #2 + { 0x0C, 0x02 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetRenderState_VertexBlend+0x1A : mov dword ptr [eax], 0x40328 + { 0x1A, 0xC7 }, // (Offset,Value)-Pair #4 + { 0x1B, 0x00 }, // (Offset,Value)-Pair #5 + { 0x1C, 0x28 }, // (Offset,Value)-Pair #6 + { 0x1D, 0x03 }, // (Offset,Value)-Pair #7 + { 0x1E, 0x04 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_VertexBlend+0x23 : add eax, 8 + { 0x23, 0x83 }, // (Offset,Value)-Pair #9 + { 0x24, 0xC0 }, // (Offset,Value)-Pair #10 + { 0x25, 0x08 }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_VertexBlend+0x2F : retn 0x04 + { 0x2F, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x30, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_BackFillMode +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_BackFillMode_1_0_3925 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_BackFillMode+0x2B : jnz +0x2 + { 0x2B, 0x75 }, // (Offset,Value)-Pair #1 + { 0x2C, 0x02 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_BackFillMode+0x32 : mov dword ptr [eax], abs + { 0x32, 0xC7 }, // (Offset,Value)-Pair #3 + { 0x33, 0x00 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_BackFillMode+0x3B : add eax, 0x0C; mov [edi], eax; pop edi + { 0x3B, 0x83 }, // (Offset,Value)-Pair #5 + { 0x3C, 0xC0 }, // (Offset,Value)-Pair #6 + { 0x3D, 0x0C }, // (Offset,Value)-Pair #7 + { 0x3E, 0x89 }, // (Offset,Value)-Pair #8 + { 0x3F, 0x07 }, // (Offset,Value)-Pair #9 + { 0x40, 0x5F }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_BackFillMode+0x48 : retn 0x04 + { 0x48, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x49, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetTextureState_TwoSidedLighting +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_3925 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x06 : or dword ptr [eax+8], 0x20 + { 0x06, 0x83 }, // (Offset,Value)-Pair #1 + { 0x07, 0x48 }, // (Offset,Value)-Pair #2 + { 0x08, 0x08 }, // (Offset,Value)-Pair #3 + { 0x09, 0x20 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x3B : mov dword ptr [eax], 0x8038C + { 0x3B, 0xC7 }, // (Offset,Value)-Pair #5 + { 0x3C, 0x00 }, // (Offset,Value)-Pair #6 + { 0x3D, 0x8C }, // (Offset,Value)-Pair #7 + { 0x3E, 0x03 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x44 : add eax, 0x0C + { 0x44, 0x83 }, // (Offset,Value)-Pair #9 + { 0x45, 0xC0 }, // (Offset,Value)-Pair #10 + { 0x46, 0x0C }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x51 : retn 0x04 + { 0x51, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x52, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_NormalizeNormals +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetRenderState_NormalizeNormals_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_NormalizeNormals+0x1D : mov [esi], eax + { 0x1D, 0x89 }, // (Offset,Value)-Pair #1 + { 0x1E, 0x06 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_NormalizeNormals+0x1F : or dword ptr [esi+8], 2 + { 0x1F, 0x83 }, // (Offset,Value)-Pair #3 + { 0x20, 0x4E }, // (Offset,Value)-Pair #4 + { 0x21, 0x08 }, // (Offset,Value)-Pair #5 + { 0x22, 0x02 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_NormalizeNormals+0x2A : retn 0x04 + { 0x2A, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x2B, 0x04 }, // (Offset,Value)-Pair #8 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_FrontFace +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_FrontFace_1_0_3925 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_FrontFace+0x00 : push esi + { 0x00, 0x56 }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_FrontFace+0x07 : push esi + { 0x07, 0x56 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_FrontFace+0xD : mov ecx, [esp+0x08] + { 0x0D, 0x8B }, // (Offset,Value)-Pair #3 + { 0x0E, 0x4C }, // (Offset,Value)-Pair #4 + { 0x0F, 0x24 }, // (Offset,Value)-Pair #5 + { 0x10, 0x08 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_FrontFace+0x1A : add eax, 8 + { 0x1A, 0x83 }, // (Offset,Value)-Pair #7 + { 0x1B, 0xC0 }, // (Offset,Value)-Pair #8 + { 0x1C, 0x08 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_TextureFactor +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetRenderState_TextureFactor_1_0_3925 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_TextureFactor+0x07 : mov eax, [esi+0x0414] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x86 }, // (Offset,Value)-Pair #2 + { 0x09, 0x14 }, // (Offset,Value)-Pair #3 + { 0x0A, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_TextureFactor+0x2E : rep stosd + { 0x2E, 0xF3 }, // (Offset,Value)-Pair #5 + { 0x2F, 0xAB }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_TextureFactor+0x3C : retn 0x04 + { 0x3C, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x3D, 0x04 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_TextureFactor+0x49 : retn 0x04 + { 0x49, 0xC2 }, // (Offset,Value)-Pair #9 + { 0x4A, 0x04 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_LogicOp +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_LogicOp_1_0_3925 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_LogicOp+0x11 : test ecx, ecx + { 0x11, 0x85 }, // (Offset,Value)-Pair #1 + { 0x12, 0xC9 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_LogicOp+0x2D : mov dword ptr [eax], 0x817BC + { 0x2D, 0xC7 }, // (Offset,Value)-Pair #3 + { 0x2E, 0x00 }, // (Offset,Value)-Pair #4 + { 0x2F, 0xBC }, // (Offset,Value)-Pair #5 + { 0x30, 0x17 }, // (Offset,Value)-Pair #6 + { 0x31, 0x08 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetRenderState_LogicOp+0x49 : retn 0x04 + { 0x49, 0xC2 }, // (Offset,Value)-Pair #8 + { 0x4A, 0x04 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_EdgeAntiAlias +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetRenderState_EdgeAntiAlias_1_0_3925 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x17 : mov [eax+0x04], ecx + { 0x17, 0x89 }, // (Offset,Value)-Pair #1 + { 0x18, 0x48 }, // (Offset,Value)-Pair #2 + { 0x19, 0x04 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x1A : mov [eax+0x08], ecx + { 0x1A, 0x89 }, // (Offset,Value)-Pair #4 + { 0x1B, 0x48 }, // (Offset,Value)-Pair #5 + { 0x1C, 0x08 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x1D : add eax, 0x0C + { 0x1D, 0x83 }, // (Offset,Value)-Pair #7 + { 0x1E, 0xC0 }, // (Offset,Value)-Pair #8 + { 0x1F, 0x0C }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x29 : retn 0x04 + { 0x29, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x2A, 0x04 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_MultiSampleMask +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_MultiSampleMask_1_0_3925 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x0B : mov ecx, esi + { 0x0B, 0x8B }, // (Offset,Value)-Pair #1 + { 0x0C, 0xCE }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x32 : and ecx, 0x0F; shl edx, 0x10 + { 0x32, 0x83 }, // (Offset,Value)-Pair #3 + { 0x33, 0xE1 }, // (Offset,Value)-Pair #4 + { 0x34, 0x0F }, // (Offset,Value)-Pair #5 + { 0x35, 0xC1 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x3A : mov dword ptr [eax], 0x41D7C + { 0x3A, 0xC7 }, // (Offset,Value)-Pair #7 + { 0x3B, 0x00 }, // (Offset,Value)-Pair #8 + { 0x3C, 0x7C }, // (Offset,Value)-Pair #9 + { 0x3D, 0x1D }, // (Offset,Value)-Pair #10 + { 0x3E, 0x04 }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x49 : retn 0x04 + { 0x49, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x4A, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_MultiSampleMode +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_MultiSampleMode_1_0_3925 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x05 : mov ecx, [esp+4] + { 0x05, 0x8B }, // (Offset,Value)-Pair #1 + { 0x06, 0x4C }, // (Offset,Value)-Pair #2 + { 0x07, 0x24 }, // (Offset,Value)-Pair #3 + { 0x08, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x0F : mov edx, [eax+0x410] + { 0x0F, 0x8B }, // (Offset,Value)-Pair #5 + { 0x10, 0x90 }, // (Offset,Value)-Pair #6 + { 0x11, 0x10 }, // (Offset,Value)-Pair #7 + { 0x12, 0x04 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x15 : mov eax, [eax+0x40C] + { 0x15, 0x8B }, // (Offset,Value)-Pair #9 + { 0x16, 0x80 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x22 : retn 0x04 + { 0x22, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x23, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * D3DDevice_PersistDisplay +// ****************************************************************** +SOOVPA<14> D3DDevice_PersistDisplay_1_0_3925 = +{ + 0, // Large == 0 + 14, // Count == 14 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + // D3DDevice_PersistDisplay+0x25 : mov eax, [ebx+0x408] + { 0x25, 0x8B }, + { 0x26, 0x83 }, + { 0x27, 0x08 }, + { 0x28, 0x04 }, + { 0x29, 0x00 }, + { 0x2A, 0x00 }, + // D3DDevice_PersistDisplay+0x3A : lea edi, [ebx+0x2308] + { 0x3a, 0x8D }, + { 0x3B, 0xBB }, + { 0x3C, 0x08 }, + { 0x3D, 0x23 }, + { 0x3E, 0x00 }, + { 0x3F, 0x00 }, + // D3DDevice_PersistDisplay+0x70 : shl edx, cl + { 0x70, 0xD3 }, + { 0x71, 0xE2 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_ShadowFunc +// ****************************************************************** +SOOVPA<14> IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_3925 = +{ + 0, // Large == 0 + 14, // Count == 14 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x00 : push esi + { 0x00, 0x56 }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x11 : mov dword ptr [eax], 0x41E6C + { 0x11, 0xC7 }, // (Offset,Value)-Pair #2 + { 0x12, 0x00 }, // (Offset,Value)-Pair #3 + { 0x13, 0x6C }, // (Offset,Value)-Pair #4 + { 0x14, 0x1E }, // (Offset,Value)-Pair #5 + { 0x15, 0x04 }, // (Offset,Value)-Pair #6 + { 0x16, 0x00 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x17 : lea edx, [ecx-0x0200] + { 0x17, 0x8D }, // (Offset,Value)-Pair #8 + { 0x18, 0x91 }, // (Offset,Value)-Pair #9 + { 0x19, 0x00 }, // (Offset,Value)-Pair #10 + { 0x1A, 0xFE }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x20 : add eax, 0x08 + { 0x20, 0x83 }, // (Offset,Value)-Pair #12 + { 0x21, 0xC0 }, // (Offset,Value)-Pair #13 + { 0x22, 0x08 }, // (Offset,Value)-Pair #14 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_LineWidth +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetRenderState_LineWidth_1_0_3925 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_LineWidth+0x15 : fmul dword ptr [esi+0x508] + { 0x15, 0xD8 }, // (Offset,Value)-Pair #1 + { 0x16, 0x8E }, // (Offset,Value)-Pair #2 + { 0x17, 0x08 }, // (Offset,Value)-Pair #3 + { 0x18, 0x05 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_LineWidth+0x32 : cmp edi, 0x1FF + { 0x32, 0x81 }, // (Offset,Value)-Pair #5 + { 0x33, 0xFF }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_LineWidth+0x3A : mov edi, 0x1FF + { 0x3A, 0xBF }, // (Offset,Value)-Pair #7 + { 0x3B, 0xFF }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_LineWidth+0x5C : retn 0x04 + { 0x5C, 0xC2 }, // (Offset,Value)-Pair #9 + { 0x5D, 0x04 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_YuvEnable +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetRenderState_YuvEnable_1_0_3925 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_YuvEnable+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #1 + { 0x01, 0x44 }, // (Offset,Value)-Pair #2 + { 0x02, 0x24 }, // (Offset,Value)-Pair #3 + { 0x03, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x04 : push edi + { 0x04, 0x56 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x0B : push edi + { 0x0B, 0x56 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x1F : mov [esi], eax + { 0x1F, 0x89 }, // (Offset,Value)-Pair #7 + { 0x20, 0x06 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x22 : retn 0x04 + { 0x22, 0xC2 }, // (Offset,Value)-Pair #9 + { 0x23, 0x04 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_OcclusionCullEnable +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_3925 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x20 : jz +0x05 + { 0x20, 0x74 }, // (Offset,Value)-Pair #1 + { 0x21, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x3B : cmp [abs], 0x1E00 + { 0x3B, 0x81 }, // (Offset,Value)-Pair #3 + { 0x41, 0x00 }, // (Offset,Value)-Pair #4 + { 0x42, 0x1E }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x4A : mov dword ptr [eax], 0x41D84 + { 0x4A, 0xC7 }, // (Offset,Value)-Pair #6 + { 0x4B, 0x00 }, // (Offset,Value)-Pair #7 + { 0x4C, 0x84 }, // (Offset,Value)-Pair #8 + { 0x4D, 0x1D }, // (Offset,Value)-Pair #9 + { 0x4E, 0x04 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x59 : retn 0x04 + { 0x59, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x5A, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_StencilCullEnable +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0B, 0x56 }, + { 0x16, 0x8B }, + { 0x22, 0xB9 }, + { 0x2E, 0xD2 }, + { 0x3A, 0x0C }, + { 0x46, 0x03 }, + { 0x52, 0x04 }, + } +}; + +// ****************************************************************** +// * D3DDevice_DrawVerticesUP +// ****************************************************************** +SOOVPA<8> D3DDevice_DrawVerticesUP_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1F, 0x8B }, + { 0x3E, 0xC0 }, + { 0x5E, 0x03 }, + { 0x7E, 0x07 }, + { 0x9E, 0xF0 }, + { 0xBE, 0x40 }, + { 0xDE, 0x75 }, + { 0xFE, 0x8B }, + } +}; + +// ****************************************************************** +// * D3DDevice_DrawIndexedVerticesUP +// ****************************************************************** +SOOVPA<8> D3DDevice_DrawIndexedVerticesUP_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1F, 0x8B }, + { 0x3E, 0x8B }, + { 0x5E, 0xF0 }, + { 0x7E, 0x8B }, + { 0xA2, 0x8B }, + { 0xBE, 0x83 }, + { 0xDE, 0x75 }, + { 0xFE, 0x75 }, + } +}; + +// ****************************************************************** +// * D3DDevice_DrawVertices +// ****************************************************************** +SOOVPA<8> D3DDevice_DrawVertices_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x12, 0x8B }, + { 0x27, 0x8B }, + { 0x3A, 0x89 }, + { 0x4E, 0xFF }, + { 0x62, 0x81 }, + { 0x76, 0x00 }, + { 0x8A, 0x17 }, + { 0x9E, 0x00 }, + } +}; + +// ****************************************************************** +// * D3DDevice_GetDisplayMode +// ****************************************************************** +SOOVPA<7> D3DDevice_GetDisplayMode_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x09, 0xB4 }, + { 0x14, 0x8B }, + { 0x1F, 0x10 }, + { 0x2A, 0x1B }, + { 0x35, 0x8B }, + { 0x41, 0x89 }, + { 0x4B, 0x89 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetTextureState_BumpEnv +// ****************************************************************** +SOOVPA<7> D3DDevice_SetTextureState_BumpEnv_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0E, 0x8B }, + { 0x16, 0x8B }, + { 0x22, 0x24 }, + { 0x2E, 0x24 }, + { 0x3A, 0x04 }, + { 0x46, 0x8B }, + { 0x52, 0xB5 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetTextureState_ColorKeyColor +// ****************************************************************** +SOOVPA<7> D3DDevice_SetTextureState_ColorKeyColor_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0x56 }, + { 0x0D, 0x8B }, + { 0x13, 0x8D }, + { 0x1A, 0x8B }, + { 0x21, 0x83 }, + { 0x28, 0x07 }, + { 0x2F, 0x5E }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetVertexData4s +// ****************************************************************** +SOOVPA<8> D3DDevice_SetVertexData4s_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0x56 }, + { 0x10, 0x08 }, + { 0x19, 0xBF }, + { 0x22, 0x24 }, + { 0x2B, 0x54 }, + { 0x34, 0x24 }, + { 0x3D, 0x08 }, + { 0x46, 0x00 }, + } +}; + +// ****************************************************************** +// * Direct3D_SetPushBufferSize +// ****************************************************************** +SOOVPA<7> Direct3D_SetPushBufferSize_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x01, 0x44 }, + { 0x04, 0x8B }, + { 0x07, 0x08 }, + { 0x0D, 0x89 }, + { 0x0E, 0x0D }, + { 0x13, 0xC2 }, + { 0x14, 0x08 }, + } +}; + +// ****************************************************************** +// * D3DResource_GetType +// ****************************************************************** +SOOVPA<7> D3DResource_GetType_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x13, 0x2A }, + { 0x28, 0x00 }, + { 0x3D, 0x00 }, + { 0x52, 0x74 }, + { 0x67, 0x00 }, + { 0x7C, 0x04 }, + { 0x91, 0x00 }, + } +}; + +// ****************************************************************** +// * D3D_AllocContiguousMemory +// ****************************************************************** +SOOVPA<6> D3D_AllocContiguousMemory_1_0_3925 = +{ + 0, // Large == 0 + 6, // Count == 6 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0x04 }, + { 0x0E, 0x6A }, + { 0x16, 0xC2 }, + { 0x17, 0x08 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_Deferred +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_Deferred_1_0_3925 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_Deferred+0x00 : mov eax, ds:(g_DirtyFromRenderState)-148[ecx*4] + { 0x00, 0x8B }, + { 0x01, 0x04 }, + { 0x02, 0x8D }, + // IDirect3DDevice8_SetRenderState_Deferred+0x07 : or dword ptr ds:g_Device+8,eax + { 0x07, 0x09 }, + { 0x08, 0x05 }, + // IDirect3DDevice8_SetRenderState_Deferred+0x0D : mov dword ptr ds:D3D__RenderState[ecx*4], edx + { 0x0D, 0x89 }, + { 0x0E, 0x14 }, + { 0x0F, 0x8D }, + // IDirect3DDevice8_SetRenderState_Deferred+0x14 : retn + { 0x14, 0xC3 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetLight +// ****************************************************************** +SOOVPA<8> D3DDevice_SetLight_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1D, 0x0F }, + { 0x3C, 0xD8 }, + { 0x5B, 0x00 }, + { 0x7A, 0x89 }, + { 0x99, 0xA5 }, + { 0xB8, 0xC1 }, + { 0xD7, 0x00 }, + { 0xF6, 0x00 }, + } +}; + +// ****************************************************************** +// * D3DDevice_LightEnable +// ****************************************************************** +SOOVPA<7> D3DDevice_LightEnable_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1A, 0x04 }, + { 0x36, 0x00 }, + { 0x52, 0x00 }, + { 0x6E, 0x75 }, + { 0x8A, 0x88 }, + { 0xA6, 0x75 }, + { 0xC2, 0x00 }, + } +}; + +// ****************************************************************** +// * D3DDevice_CreateVertexShader +// ****************************************************************** +SOOVPA<8> D3DDevice_CreateVertexShader_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x85 }, + { 0x3E, 0xE8 }, + { 0x5E, 0x5D }, + { 0x7E, 0x01 }, + { 0x9E, 0x24 }, + { 0xBE, 0x24 }, + { 0xDE, 0x83 }, + { 0xFE, 0xC7 }, + } +}; + +// ****************************************************************** +// * D3DDevice_GetProjectionViewportMatrix +// ****************************************************************** +SOOVPA<7> D3DDevice_GetProjectionViewportMatrix_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x02, 0x35 }, + { 0x07, 0x57 }, + { 0x0A, 0x24 }, + { 0x0E, 0xA0 }, + { 0x12, 0xB9 }, + { 0x16, 0x00 }, + { 0x1A, 0x5E }, + } +}; + +// ****************************************************************** +// * D3DDevice_GetTile +// ****************************************************************** +SOOVPA<7> D3DDevice_GetTile_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x03, 0x04 }, + { 0x0A, 0x56 }, + { 0x0D, 0x7C }, + { 0x12, 0x40 }, + { 0x17, 0x21 }, + { 0x1C, 0x00 }, + { 0x21, 0x5F }, + } +}; + +// ****************************************************************** +// * D3DDevice_ApplyStateBlock +// ****************************************************************** +SOOVPA<8> D3DDevice_ApplyStateBlock_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1D, 0x83 }, + { 0x40, 0x83 }, + { 0x5B, 0x16 }, + { 0x7A, 0x01 }, + { 0x99, 0x46 }, + { 0xB8, 0x06 }, + { 0xD7, 0x39 }, + { 0xF6, 0x51 }, + } +}; + +// ****************************************************************** +// * D3DDevice_CaptureStateBlock +// ****************************************************************** +SOOVPA<7> D3DDevice_CaptureStateBlock_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x76 }, + { 0x3E, 0xE8 }, + { 0x5E, 0x06 }, + { 0x7E, 0x26 }, + { 0x9E, 0xFF }, + { 0xBE, 0x04 }, + { 0xDE, 0xF8 }, + } +}; + +// ****************************************************************** +// * D3DDevice_DeleteStateBlock +// ****************************************************************** +SOOVPA<7> D3DDevice_DeleteStateBlock_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x11, 0x76 }, + { 0x24, 0x3B }, + { 0x37, 0xE8 }, + { 0x4A, 0x50 }, + { 0x5D, 0x74 }, + { 0x70, 0x06 }, + { 0x83, 0xEB }, + } +}; + +// ****************************************************************** +// * D3DDevice_CreateStateBlock +// ****************************************************************** +SOOVPA<8> D3DDevice_CreateStateBlock_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x8B }, + { 0x3E, 0x89 }, + { 0x5E, 0x24 }, + { 0x7E, 0xF8 }, + { 0x9F, 0x01 }, + { 0xBE, 0xB6 }, + { 0xDE, 0xF8 }, + { 0xFE, 0x76 }, + } +}; + +// ****************************************************************** +// * D3DDevice_DeletePixelShader +// ****************************************************************** +SOOVPA<7> D3DDevice_DeletePixelShader_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x02, 0x24 }, + { 0x06, 0x75 }, + { 0x0A, 0x04 }, + { 0x0E, 0x09 }, + { 0x12, 0x04 }, + { 0x18, 0xC2 }, + { 0x1A, 0x00 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetPixelShaderProgram +// ****************************************************************** +SOOVPA<7> D3DDevice_SetPixelShaderProgram_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x06, 0xA1 }, + { 0x0E, 0x88 }, + { 0x16, 0x00 }, + { 0x1E, 0x00 }, + { 0x26, 0x04 }, + { 0x32, 0xC7 }, + { 0x36, 0x00 }, + } +}; + +// ****************************************************************** +// * D3D::KickOffAndWaitForIdle +// ****************************************************************** +// * This is for the real D3D::KickOffAndWaitForIdle +// ****************************************************************** +SOOVPA<5> D3D_KickOffAndWaitForIdle_1_0_3925 = +{ + 0, // Large == 0 + 5, // Count == 5 + + XREF_D3D_KickOffAndWaitForIdle, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x05, 0x8B }, + { 0x06, 0x48 }, + { 0x07, 0x1C }, + { 0x0A, 0x51 }, + { 0x10, 0xC3 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetModelView +// ****************************************************************** +SOOVPA<7> D3DDevice_SetModelView_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x12, 0x08 }, + { 0x26, 0x53 }, + { 0x3A, 0x8B }, + { 0x4E, 0x80 }, + { 0x62, 0x00 }, + { 0x76, 0x00 }, + { 0x8A, 0x0C }, + } +}; + +// ****************************************************************** +// * D3DDevice_FlushVertexCache +// ****************************************************************** +SOOVPA<8> D3DDevice_FlushVertexCache_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x00, 0x56 }, + { 0x07, 0x56 }, + { 0x08, 0xE8 }, + { 0x0D, 0xC7 }, + { 0x0F, 0x10 }, + { 0x12, 0x00 }, + { 0x17, 0x00 }, + { 0x1C, 0x08 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetScissors +// ****************************************************************** +SOOVPA<8> D3DDevice_SetScissors_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1D, 0x08 }, + { 0x3C, 0x24 }, + { 0x5F, 0x8B }, + { 0x7A, 0x83 }, + { 0x99, 0xE0 }, + { 0xBA, 0xD9 }, + { 0xD9, 0x8B }, + { 0xF6, 0xDB }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetVertexShaderInput +// ****************************************************************** +SOOVPA<8> D3DDevice_SetVertexShaderInput_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x03 }, + { 0x3E, 0x8B }, + { 0x5E, 0xC7 }, + { 0x7E, 0xF8 }, + { 0x9E, 0xC6 }, + { 0xBE, 0x7F }, + { 0xDE, 0xCA }, + { 0xFE, 0x17 }, + } +}; + +// ****************************************************************** +// * D3DDevice_PrimeVertexCache +// ****************************************************************** +SOOVPA<8> D3DDevice_PrimeVertexCache_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0D, 0x00 }, + { 0x1C, 0x55 }, + { 0x2B, 0x00 }, + { 0x3A, 0x24 }, + { 0x49, 0xCB }, + { 0x58, 0x74 }, + { 0x67, 0x00 }, + { 0x76, 0x08 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetVertexData4ub +// ****************************************************************** +SOOVPA<7> D3DDevice_SetVertexData4ub_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0x56 }, + { 0x10, 0x08 }, + { 0x19, 0xC9 }, + { 0x22, 0x54 }, + { 0x2B, 0x14 }, + { 0x34, 0x24 }, + { 0x3D, 0xFC }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetPixelShaderConstant +// ****************************************************************** +SOOVPA<7> D3DDevice_SetPixelShaderConstant_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x4C }, + { 0x3E, 0x11 }, + { 0x61, 0xDF }, + { 0x7E, 0xF6 }, + { 0x9E, 0x05 }, + { 0xC0, 0x51 }, + { 0xDE, 0xC4 }, + } +}; + +// ****************************************************************** +// * D3DDevice_InsertCallback +// ****************************************************************** +SOOVPA<7> D3DDevice_InsertCallback_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0D, 0x8B }, + { 0x18, 0x8B }, + { 0x25, 0x50 }, + { 0x32, 0x10 }, + { 0x3F, 0x00 }, + { 0x4C, 0x00 }, + { 0x59, 0x03 }, + } +}; + +// ****************************************************************** +// * D3DDevice_BeginPushBuffer +// ****************************************************************** +SOOVPA<7> D3DDevice_BeginPushBuffer_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0B, 0xCE }, + { 0x1B, 0x57 }, + { 0x25, 0x00 }, + { 0x32, 0x06 }, + { 0x3F, 0x03 }, + { 0x4C, 0x04 }, + { 0x59, 0x04 }, + } +}; + +// ****************************************************************** +// * D3DDevice_EndPushBuffer +// ****************************************************************** +SOOVPA<7> D3DDevice_EndPushBuffer_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x11, 0x8D }, + { 0x24, 0x8B }, + { 0x37, 0xFC }, + { 0x4A, 0xFF }, + { 0x5D, 0xF7 }, + { 0x70, 0x03 }, + { 0x83, 0x00 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_3925 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x05 : D3D__RenderState[D3DRS_ROPZCMPALWAYSREAD] + { 0x05, XREF_D3DRS_ROPZCMPALWAYSREAD }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #2 + { 0x01, 0x44 }, // (Offset,Value)-Pair #3 + { 0x02, 0x24 }, // (Offset,Value)-Pair #4 + { 0x03, 0x04 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x09 : call [abs] + { 0x09, 0xE8 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x0E : retn 0x04 + { 0x0E, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x0F, 0x04 }, // (Offset,Value)-Pair #8 + { 0x10, 0x00 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_RopZRead +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_RopZRead_1_0_3925 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirect3DDevice8_SetRenderState_RopZRead+0x05 : D3D__RenderState[D3DRS_ROPZCMPALWAYSREAD] + { 0x05, XREF_D3DRS_ROPZREAD }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_RopZRead+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #2 + { 0x01, 0x44 }, // (Offset,Value)-Pair #3 + { 0x02, 0x24 }, // (Offset,Value)-Pair #4 + { 0x03, 0x04 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_RopZRead+0x09 : call [abs] + { 0x09, 0xE8 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_RopZRead+0x0E : retn 0x04 + { 0x0E, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x0F, 0x04 }, // (Offset,Value)-Pair #8 + { 0x10, 0x00 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_DoNotCullUncompressed +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_3925 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x05 : D3D__RenderState[D3DRS_ROPZCMPALWAYSREAD] + { 0x05, XREF_D3DRS_DONOTCULLUNCOMPRESSED }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #2 + { 0x01, 0x44 }, // (Offset,Value)-Pair #3 + { 0x02, 0x24 }, // (Offset,Value)-Pair #4 + { 0x03, 0x04 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x09 : call [abs] + { 0x09, 0xE8 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x0E : retn 0x04 + { 0x0E, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x0F, 0x04 }, // (Offset,Value)-Pair #8 + { 0x10, 0x00 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * XMETAL_StartPush +// ****************************************************************** +SOOVPA<11> XMETAL_StartPush_1_0_3925 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + // XMETAL_StartPush+0x00 : mov ecx, [esp+0x4] + { 0x00, 0x8B }, + { 0x01, 0x4C }, + { 0x02, 0x24 }, + { 0x03, 0x04 }, + + // XMETAL_StartPush+0x04 : mov eax, [ecx] + { 0x04, 0x8B }, + { 0x05, 0x01 }, + + // XMETAL_StartPush+0x06 : cmp eax, [ecx+0x4] + { 0x06, 0x3B }, + { 0x07, 0x41 }, + { 0x08, 0x04 }, + + // XMETAL_StartPush+0x10 : retn 4 + { 0x10, 0xC2 }, + { 0x11, 0x04 }, + } +}; + +// ****************************************************************** +// * D3D::SetFence +// ****************************************************************** +SOOVPA<11> D3D_SetFence_1_0_3925 = +{ + 0, // Large == 0 + 11, // Count == 11 + + XREF_D3D_SETFENCE, // Xref Is Saved + 0, // Xref Not Used + + { + // D3D::SetFence+0x0F : mov edi, [esi+0x1C] + { 0x0F, 0x8B }, + { 0x10, 0x7E }, + { 0x11, 0x1C }, + + // D3D::SetFence+0x3D : and ecx, 0x3F + { 0x3D, 0x83 }, + { 0x3E, 0xE1 }, + { 0x3F, 0x3F }, + + // D3D::SetFence+0x77 : mov [esi*ebp*4], edi + { 0x77, 0x89 }, + { 0x78, 0x3C }, + { 0x79, 0xAE }, + + // D3D::SetFence+0x96 : retn 4 + { 0x96, 0xC2 }, + { 0x97, 0x04 }, + } +}; + +// ****************************************************************** +// * D3DDevice_InsertFence +// ****************************************************************** +SOOVPA<5> D3DDevice_InsertFence_1_0_3925 = +{ + 0, // Large == 0 + 5, // Count == 5 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x03, XREF_D3D_SETFENCE }, + + { 0x00, 0x6A }, + { 0x01, 0x00 }, + { 0x02, 0xE8 }, + { 0x07, 0xC3 }, + } +}; + +// ****************************************************************** +// * D3DDevice_LoadVertexShaderProgram +// ****************************************************************** +SOOVPA<7> D3DDevice_LoadVertexShaderProgram_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0B, 0x2D }, + { 0x18, 0x10 }, + { 0x25, 0x00 }, + { 0x32, 0xA5 }, + { 0x3F, 0x8B }, + { 0x4C, 0x00 }, + { 0x59, 0xE8 }, + } +}; + +// ****************************************************************** +// * D3DDevice_RunPushBuffer +// ****************************************************************** +SOOVPA<15> D3DDevice_RunPushBuffer_1_0_3925 = +{ + 0, // Large == 0 + 15, // Count == 15 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + // D3DDevice_RunPushBuffer+0x5E : and ecx, 4 + { 0x5E, 0x83 }, + { 0x5F, 0xE1 }, + { 0x60, 0x04 }, + + // D3DDevice_RunPushBuffer+0x95 : push 0x308 + { 0x95, 0x68 }, + { 0x96, 0x08 }, + { 0x97, 0x03 }, + { 0x98, 0x00 }, + { 0x99, 0x00 }, + + // D3DDevice_RunPushBuffer+0xF1 : mov dword ptr [eax+8], 0x40100 + { 0xF1, 0xC7 }, + { 0xF2, 0x40 }, + { 0xF3, 0x08 }, + { 0xF4, 0x00 }, + { 0xF5, 0x01 }, + { 0xF6, 0x04 }, + { 0xF7, 0x00 }, + } +}; + +// ****************************************************************** +// * D3DDevice_BlockOnFence +// ****************************************************************** +SOOVPA<7> D3DDevice_BlockOnFence_1_0_3925 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x00, 0x8B }, + { 0x02, 0x24 }, + { 0x04, 0x6A }, + { 0x06, 0x50 }, + { 0x0C, 0xC2 }, + { 0x0D, 0x04 }, + { 0x0E, 0x00 }, + } +}; + // ****************************************************************** // * D3D8_1_0_3925 // ****************************************************************** @@ -3240,6 +4979,639 @@ OOVPATable D3D8_1_0_3925[] = "EmuIDirect3DDevice8_SetMaterial" #endif }, + // IDirect3DDevice8::AddRef + { + (OOVPA*)&IDirect3DDevice8_AddRef_1_0_3925, + + XTL::EmuIDirect3DDevice8_AddRef, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_AddRef" + #endif + }, + // IDirect3DDevice8_Unknown1 + { + (OOVPA*)&IDirect3DDevice8_Unknown1_1_0_3925, + + XTL::EmuIDirect3DDevice8_Unknown1, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_Unknown1" + #endif + }, + // IDirect3DDevice8::GetViewport + { + (OOVPA*)&IDirect3DDevice8_GetViewport_1_0_3925, + + XTL::EmuIDirect3DDevice8_GetViewport, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetViewport" + #endif + }, + // IDirect3DDevice8::GetGammaRamp + { + (OOVPA*)&IDirect3DDevice8_GetGammaRamp_1_0_3925, + + XTL::EmuIDirect3DDevice8_GetGammaRamp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetGammaRamp" + #endif + }, + // D3DDevice_GetDisplayFieldStatus + { + (OOVPA*)&D3DDevice_GetDisplayFieldStatus_1_0_3925, + XTL::EmuIDirect3DDevice8_GetDisplayFieldStatus, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetDisplayFieldStatus" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleAntiAlias + { + (OOVPA*)&D3DDevice_SetRenderState_MultiSampleAntiAlias_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias" + #endif + }, + // IDirect3DDevice8::SetRenderState_VertexBlend + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_VertexBlend_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_VertexBlend, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_VertexBlend" + #endif + }, + // IDirect3DDevice8::SetRenderState_BackFillMode + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_BackFillMode_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_BackFillMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_BackFillMode" + #endif + }, + // IDirect3DDevice8::SetTextureState_TwoSidedLighting + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_TwoSidedLighting" + #endif + }, + // IDirect3DDevice8_SetRenderState_NormalizeNormals + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_NormalizeNormals_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_NormalizeNormals, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_NormalizeNormals" + #endif + }, + // IDirect3DDevice8::SetRenderState_FrontFace + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_FrontFace_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_FrontFace, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_FrontFace" + #endif + }, + // IDirect3DDevice8::SetRenderState_TextureFactor + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_TextureFactor_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_TextureFactor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_TextureFactor" + #endif + }, + // IDirect3DDevice8::SetRenderState_LogicOp + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_LogicOp_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_LogicOp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_LogicOp" + #endif + }, + // IDirect3DDevice8::SetRenderState_EdgeAntiAlias + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_EdgeAntiAlias_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleMask + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMask_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMask, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleMask" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleMode + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMode_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleMode" + #endif + }, + // D3DDevice_PersistDisplay + { + (OOVPA*)&D3DDevice_PersistDisplay_1_0_3925, + XTL::EmuIDirect3DDevice8_PersistDisplay, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_PersistDisplay" + #endif + }, + // IDirect3DDevice8::SetRenderState_ShadowFunc + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" + #endif + }, + // IDirect3DDevice8::SetRenderState_LineWidth + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_LineWidth_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_LineWidth, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_LineWidth" + #endif + }, + // IDirect3DDevice8::SetRenderState_YuvEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_YuvEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_OcclusionCullEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_StencilCullEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilCullEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilCullEnable" + #endif + }, + // D3DDevice_DrawVerticesUP + { + (OOVPA*)&D3DDevice_DrawVerticesUP_1_0_3925, + XTL::EmuIDirect3DDevice8_DrawVerticesUP, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawVerticesUP" + #endif + }, + // D3DDevice_DrawIndexedVerticesUP + { + (OOVPA*)&D3DDevice_DrawIndexedVerticesUP_1_0_3925, + XTL::EmuIDirect3DDevice8_DrawIndexedVerticesUP, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawIndexedVerticesUP" + #endif + }, + // D3DDevice_DrawVertices + { + (OOVPA*)&D3DDevice_DrawVertices_1_0_3925, + XTL::EmuIDirect3DDevice8_DrawVertices, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawVertices" + #endif + }, + // D3DDevice_GetDisplayMode + { + (OOVPA*)&D3DDevice_GetDisplayMode_1_0_3925, + XTL::EmuIDirect3DDevice8_GetDisplayMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetDisplayMode" + #endif + }, + // D3DDevice_SetTextureState_BumpEnv + { + (OOVPA*)&D3DDevice_SetTextureState_BumpEnv_1_0_3925, + XTL::EmuIDirect3DDevice8_SetTextureState_BumpEnv, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_BumpEnv" + #endif + }, + // D3DDevice_SetTextureState_ColorKeyColor + { + (OOVPA*)&D3DDevice_SetTextureState_ColorKeyColor_1_0_3925, + XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_ColorKeyColor" + #endif + }, + // D3DDevice_SetVertexData4s + { + (OOVPA*)&D3DDevice_SetVertexData4s_1_0_3925, + XTL::EmuIDirect3DDevice8_SetVertexData4s, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData4s" + #endif + }, + // IDirect3D8::SetPushBufferSize + { + (OOVPA*)&Direct3D_SetPushBufferSize_1_0_3925, + XTL::EmuIDirect3D8_SetPushBufferSize, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_SetPushBufferSize" + #endif + }, + // IDirect3DResource8::GetType + // Probably not even necessary... + { + (OOVPA*)&D3DResource_GetType_1_0_3925, + + XTL::EmuIDirect3DResource8_GetType, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DResource8_GetType" + #endif + }, + // IDirect3D8_AllocContiguousMemory + { + (OOVPA*)&D3D_AllocContiguousMemory_1_0_3925, + XTL::EmuIDirect3D8_AllocContiguousMemory, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_AllocContiguousMemory" + #endif + }, + // IDirect3DDevice8_SetRenderState_Deferred + /*{ + (OOVPA*)&IDirect3DDevice8_SetRenderState_Deferred_1_0_3925, + XTL::EmuIDirect3DDevice8_SetRenderState_Deferred, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_Deferred" + #endif + },*/ + // D3DDevice_SetLight + { + (OOVPA*)&D3DDevice_SetLight_1_0_3925, + XTL::EmuIDirect3DDevice8_SetLight, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetLight" + #endif + }, + // D3DDevice_LightEnable + { + (OOVPA*)&D3DDevice_LightEnable_1_0_3925, + XTL::EmuIDirect3DDevice8_LightEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_LightEnable" + #endif + }, + // D3DDevice_CreateVertexShader + { + (OOVPA*)&D3DDevice_CreateVertexShader_1_0_3925, + XTL::EmuIDirect3DDevice8_CreateVertexShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreateVertexShader" + #endif + }, + // IDirect3DDevice8::SetRenderTarget + { + (OOVPA*)&IDirect3DDevice8_SetRenderTarget_1_0_3948, + + XTL::EmuIDirect3DDevice8_SetRenderTarget, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderTarget (3948)" + #endif + }, + // IDirect3DSurface8::GetDesc + { + (OOVPA*)&D3DSurface_GetDesc_1_0_3925, + + XTL::EmuIDirect3DSurface8_GetDesc, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DSurface8_GetDesc" + #endif + }, + // IDirect3DDevice8_GetProjectionViewportMatrix + { + (OOVPA*)&D3DDevice_GetProjectionViewportMatrix_1_0_3925, + + XTL::EmuIDirect3DDevice8_GetProjectionViewportMatrix, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetProjectionViewportMatrix" + #endif + }, + // D3DDevice_GetTile + { + (OOVPA*)&D3DDevice_GetTile_1_0_3925, + XTL::EmuIDirect3DDevice8_GetTile, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetTile" + #endif + }, + // D3DDevice_ApplyStateBlock + { + (OOVPA*)&D3DDevice_ApplyStateBlock_1_0_3925, + XTL::EmuIDirect3DDevice8_ApplyStateBlock, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_ApplyStateBlock" + #endif + }, + // D3DDevice_CaptureStateBlock + { + (OOVPA*)&D3DDevice_CaptureStateBlock_1_0_3925, + XTL::EmuIDirect3DDevice8_CaptureStateBlock, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CaptureStateBlock" + #endif + }, + // D3DDevice_DeleteStateBlock + { + (OOVPA*)&D3DDevice_DeleteStateBlock_1_0_3925, + XTL::EmuIDirect3DDevice8_DeleteStateBlock, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DeleteStateBlock" + #endif + }, + // D3DDevice_CreateStateBlock + { + + (OOVPA*)&D3DDevice_CreateStateBlock_1_0_3925, + XTL::EmuIDirect3DDevice8_CreateStateBlock, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreateStateBlock" + #endif + }, + // D3DDevice_DeletePixelShader + { + (OOVPA*)&D3DDevice_DeletePixelShader_1_0_3925, + XTL::EmuIDirect3DDevice8_DeletePixelShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DeletePixelShader" + #endif + }, + // D3DDevice_SetPixelShaderProgram + { + (OOVPA*)&D3DDevice_SetPixelShaderProgram_1_0_3925, + XTL::EmuIDirect3DDevice8_SetPixelShaderProgram, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetPixelShaderProgram" + #endif + }, + // D3D::KickOffAndWaitForIdle + { + + (OOVPA*)&D3D_KickOffAndWaitForIdle_1_0_3925, + XTL::EmuIDirect3D8_KickOffAndWaitForIdle, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_KickOffAndWaitForIdle" + #endif + }, + // D3DDevice_SetModelView + { + (OOVPA*)&D3DDevice_SetModelView_1_0_3925, + XTL::EmuIDirect3DDevice8_SetModelView, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetModelView" + #endif + }, + // D3DDevice_FlushVertexCache + { + (OOVPA*)&D3DDevice_FlushVertexCache_1_0_3925, + XTL::EmuIDirect3DDevice8_FlushVertexCache, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_FlushVertexCache" + #endif + }, + // D3DDevice_SetScissors + { + (OOVPA*)&D3DDevice_SetScissors_1_0_3925, + XTL::EmuIDirect3DDevice8_SetScissors, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetScissors" + #endif + }, + // D3DDevice_SetVertexShaderInput + { + (OOVPA*)&D3DDevice_SetVertexShaderInput_1_0_3925, + XTL::EmuIDirect3DDevice8_SetVertexShaderInput, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexShaderInput" + #endif + }, + // D3DDevice_PrimeVertexCache + { + (OOVPA*)&D3DDevice_PrimeVertexCache_1_0_3925, + XTL::EmuIDirect3DDevice8_PrimeVertexCache, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_PrimeVertexCache" + #endif + }, + // IDirect3DDevice8::SetVertexData4ub + { + (OOVPA*)&D3DDevice_SetVertexData4ub_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetVertexData4ub, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData4ub" + #endif + }, + // IDirect3DDevice8::SetPixelShaderConstant + { + (OOVPA*)&D3DDevice_SetPixelShaderConstant_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetPixelShaderConstant, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetPixelShaderConstant" + #endif + }, + // IDirect3DDevice8_InsertCallback + { + (OOVPA*)&D3DDevice_InsertCallback_1_0_3925, + + XTL::EmuIDirect3DDevice8_InsertCallback, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_InsertCallback" + #endif + }, + // IDirect3DDevice8::BeginPushBuffer + { + (OOVPA*)&D3DDevice_BeginPushBuffer_1_0_3925, + + XTL::EmuIDirect3DDevice8_BeginPushBuffer, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_BeginPushBuffer" + #endif + }, + // IDirect3DDevice8::EndPushBuffer + { + (OOVPA*)&D3DDevice_EndPushBuffer_1_0_3925, + + XTL::EmuIDirect3DDevice8_EndPushBuffer, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_EndPushBuffer" + #endif + }, + // IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead" + #endif + }, + // IDirect3DDevice8::SetRenderState_RopZRead + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZRead_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_RopZRead" + #endif + }, + // IDirect3DDevice8::SetRenderState_DoNotCullUncompressed + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_3925, + + XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed" + #endif + }, + // XMETAL_StartPush + /*{ + (OOVPA*)&XMETAL_StartPush_1_0_3925, + + XTL::EmuXMETAL_StartPush, + + #ifdef _DEBUG_TRACE + "EmuXMETAL_StartPush" + #endif + }*/ + // D3D::SetFence (XREF) + { + (OOVPA*)&D3D_SetFence_1_0_3925, 0, + + #ifdef _DEBUG_TRACE + "D3D::SetFence (XREF)" + #endif + }, + // IDirect3DDevice8::InsertFence + { + (OOVPA*)&D3DDevice_InsertFence_1_0_3925, + + XTL::EmuIDirect3DDevice8_InsertFence, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_InsertFence" + #endif + }, + // D3DDevice_LoadVertexShaderProgram + { + (OOVPA*)&D3DDevice_LoadVertexShaderProgram_1_0_3925, + + XTL::EmuIDirect3DDevice8_LoadVertexShaderProgram, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_LoadVertexShaderProgram" + #endif + }, + // IDirect3DDevice8::RunPushBuffer + { + (OOVPA*)&D3DDevice_RunPushBuffer_1_0_3925, + + XTL::EmuIDirect3DDevice8_RunPushBuffer, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_RunPushBuffer" + #endif + }, + // IDirect3DDevice8::BlockOnFence + { + (OOVPA*)&D3DDevice_BlockOnFence_1_0_3925, + + XTL::EmuIDirect3DDevice8_BlockOnFence, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_BlockOnFence " + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4134.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4134.inl index d069e8215..0057a2399 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4134.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4134.inl @@ -134,6 +134,130 @@ SOOVPA<10> IDirect3DDevice8_SetTransform_1_0_4134 = } }; +// ****************************************************************** +// * IDirect3D8_CheckDeviceFormat +// ****************************************************************** +SOOVPA<8> IDirect3D8_CheckDeviceFormat_1_0_4134 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3D8_CheckDeviceFormat+0x0D : retn 0x18 + { 0x0D, 0xC2 }, // (Offset,Value)-Pair #1 + { 0x0E, 0x18 }, // (Offset,Value)-Pair #2 + + // IDirect3D8_CheckDeviceFormat+0x15 : jz +0x08 + { 0x15, 0x74 }, // (Offset,Value)-Pair #3 + { 0x16, 0x08 }, // (Offset,Value)-Pair #4 + + // IDirect3D8_CheckDeviceFormat+0x29 : mov cl, 0x80 + { 0x29, 0xB1 }, // (Offset,Value)-Pair #5 + { 0x2A, 0x80 }, // (Offset,Value)-Pair #6 + + // IDirect3D8_CheckDeviceFormat+0x61 : retn 0x18 + { 0x61, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x62, 0x18 }, // (Offset,Value)-Pair #8 + } +}; + +// ****************************************************************** +// * IDirect3D8_GetAdapterModeCount +// ****************************************************************** +SOOVPA<12> IDirect3D8_GetAdapterModeCount_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3D8_GetAdapterModeCount+0x25 : add edx, 0xFF + { 0x25, 0x81 }, // (Offset,Value)-Pair #1 + { 0x26, 0xE2 }, // (Offset,Value)-Pair #2 + { 0x27, 0xFF }, // (Offset,Value)-Pair #3 + + // IDirect3D8_GetAdapterModeCount+0x47 : cmp edi, 0x04 + { 0x47, 0x83 }, // (Offset,Value)-Pair #4 + { 0x48, 0xFF }, // (Offset,Value)-Pair #5 + { 0x49, 0x04 }, // (Offset,Value)-Pair #6 + + // IDirect3D8_GetAdapterModeCount+0x95 : shl eax, 0x02 + { 0x95, 0xC1 }, // (Offset,Value)-Pair #7 + { 0x96, 0xE0 }, // (Offset,Value)-Pair #8 + { 0x97, 0x02 }, // (Offset,Value)-Pair #9 + + // IDirect3D8_GetAdapterModeCount+0x99 : add esp, 0x08 + { 0x99, 0x83 }, // (Offset,Value)-Pair #10 + { 0x9A, 0xC4 }, // (Offset,Value)-Pair #11 + { 0x9B, 0x08 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3D8_EnumAdapterModes +// ****************************************************************** +SOOVPA<10> IDirect3D8_EnumAdapterModes_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3D8_EnumAdapterModes+0x00 : sub esp, 0x08 + { 0x00, 0x83 }, // (Offset,Value)-Pair #1 + { 0x01, 0xEC }, // (Offset,Value)-Pair #2 + { 0x02, 0x08 }, // (Offset,Value)-Pair #3 + + // IDirect3D8_EnumAdapterModes+0xD1 : and edx, 0x0A + { 0xD1, 0x83 }, // (Offset,Value)-Pair #4 + { 0xD2, 0xE2 }, // (Offset,Value)-Pair #5 + { 0xD3, 0x0A }, // (Offset,Value)-Pair #6 + + // IDirect3D8_EnumAdapterModes+0xF5 : mov dword ptr[edi+0x10], 0x1E + { 0xF5, 0xC7 }, // (Offset,Value)-Pair #7 + { 0xF6, 0x47 }, // (Offset,Value)-Pair #8 + { 0xF7, 0x10 }, // (Offset,Value)-Pair #9 + { 0xF8, 0x1E }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_LoadVertexShader +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_LoadVertexShader_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_LoadVertexShader+0x07 : mov al, [ebx+0x08] + { 0x07, 0x8A }, // (Offset,Value)-Pair #1 + { 0x08, 0x43 }, // (Offset,Value)-Pair #2 + { 0x09, 0x08 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_LoadVertexShader+0x32 : mov dword ptr [eax], 0x00041E9C + { 0x32, 0xC7 }, // (Offset,Value)-Pair #4 + { 0x33, 0x00 }, // (Offset,Value)-Pair #5 + { 0x34, 0x9C }, // (Offset,Value)-Pair #6 + { 0x35, 0x1E }, // (Offset,Value)-Pair #7 + { 0x36, 0x04 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_LoadVertexShader+0x4E : mov [ebx], ebx + { 0x4E, 0x89 }, // (Offset,Value)-Pair #9 + { 0x4F, 0x13 }, // (Offset,Value)-Pair #10 + } +}; + // ****************************************************************** // * IDirect3DDevice8_SetRenderState_FogColor // ****************************************************************** @@ -324,6 +448,1982 @@ SOOVPA<9> IDirect3DDevice8_SetRenderTarget_1_0_4134 = } }; +// ****************************************************************** +// * IDirect3DDevice8_SelectVertexShader +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SelectVertexShader_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SelectVertexShader+0x13 : mov [esi+0x384], eax + { 0x13, 0x89 }, // (Offset,Value)-Pair #1 + { 0x14, 0x86 }, // (Offset,Value)-Pair #2 + { 0x15, 0x84 }, // (Offset,Value)-Pair #3 + { 0x16, 0x03 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SelectVertexShader+0x3B : mov dword ptr [eax], 0x00081E94 + { 0x3B, 0xC7 }, // (Offset,Value)-Pair #5 + { 0x3C, 0x00 }, // (Offset,Value)-Pair #6 + { 0x3D, 0x94 }, // (Offset,Value)-Pair #7 + { 0x3E, 0x1E }, // (Offset,Value)-Pair #8 + { 0x3F, 0x08 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SelectVertexShader+0x55 : mov [esi], eax + { 0x55, 0x89 }, // (Offset,Value)-Pair #10 + { 0x56, 0x06 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_CopyRects +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_CopyRects_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_CopyRects+0x00 : sub esp, 0x01A0 + { 0x00, 0x81 }, // (Offset,Value)-Pair #1 + { 0x01, 0xEC }, // (Offset,Value)-Pair #2 + { 0x02, 0xA0 }, // (Offset,Value)-Pair #3 + { 0x03, 0x01 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_CopyRects+0x6E : mov esi, [eax+0x201C] + { 0x6E, 0x8B }, // (Offset,Value)-Pair #5 + { 0x6F, 0xB0 }, // (Offset,Value)-Pair #6 + { 0x70, 0x1C }, // (Offset,Value)-Pair #7 + { 0x71, 0x20 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_CopyRects+0xDD : jnz +0x22 + { 0xDD, 0x75 }, // (Offset,Value)-Pair #9 + { 0xDE, 0x22 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_CreateImageSurface +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_CreateImageSurface_1_0_4134 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_CreateImageSurface+0x2A : push 0x18 + { 0x2A, 0x6A }, // (Offset,Value)-Pair #1 + { 0x2B, 0x18 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_CreateImageSurface+0x2C : push 0x40 + { 0x2C, 0x6A }, // (Offset,Value)-Pair #3 + { 0x2D, 0x40 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_CreateImageSurface+0x3B : push 0x0404 + { 0x3B, 0x68 }, // (Offset,Value)-Pair #5 + { 0x3C, 0x04 }, // (Offset,Value)-Pair #6 + { 0x3D, 0x04 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_CreateImageSurface+0x61 : retn 0x10 + { 0x61, 0xC2 }, // (Offset,Value)-Pair #8 + { 0x62, 0x10 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetVertexShaderConstant +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetVertexShaderConstant_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetVertexShaderConstant+0x11 : mov cl, [ebx+0x08] + { 0x11, 0x8A }, // (Offset,Value)-Pair #1 + { 0x12, 0x4B }, // (Offset,Value)-Pair #2 + { 0x13, 0x08 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetVertexShaderConstant+0x1A : test cl, 0x10 + { 0x1A, 0xF6 }, // (Offset,Value)-Pair #4 + { 0x1B, 0xC1 }, // (Offset,Value)-Pair #5 + { 0x1C, 0x10 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetVertexShaderConstant+0x60 : jle +0x19 + { 0x60, 0x7E }, // (Offset,Value)-Pair #7 + { 0x61, 0x19 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetVertexShaderConstant+0x98 : retn 0x0C + { 0x98, 0xC2 }, // (Offset,Value)-Pair #9 + { 0x99, 0x0C }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetPixelShader +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetPixelShader_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetPixelShader+0x0E : mov esi, [ebx+0x0370] + { 0x0E, 0x8B }, // (Offset,Value)-Pair #1 + { 0x0F, 0xB3 }, // (Offset,Value)-Pair #2 + { 0x10, 0x70 }, // (Offset,Value)-Pair #3 + { 0x11, 0x03 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetPixelShader+0x3A : or eax, 0x2000 + { 0x3A, 0x0D }, // (Offset,Value)-Pair #5 + { 0x3C, 0x20 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetPixelShader+0x78 : retn 0x04 + { 0x78, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x79, 0x04 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetPixelShader+0xE3 : rep movsd + { 0xE3, 0xF3 }, // (Offset,Value)-Pair #9 + { 0xE4, 0xA5 }, // (Offset,Value)-Pair #10 + + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetTextureState_BumpEnv +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetTextureState_BumpEnv_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTextureState_BumpEnv+0x18 : jnz +0x03 + { 0x18, 0x75 }, // (Offset,Value)-Pair #1 + { 0x19, 0x03 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetTextureState_BumpEnv+0x1D : test bl, 3 + { 0x1D, 0xF6 }, // (Offset,Value)-Pair #3 + { 0x1E, 0xC3 }, // (Offset,Value)-Pair #4 + { 0x1F, 0x03 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetTextureState_BumpEnv+0x32 : mov ecx, [esp+0x14] + { 0x32, 0x8B }, // (Offset,Value)-Pair #6 + { 0x33, 0x4C }, // (Offset,Value)-Pair #7 + { 0x34, 0x24 }, // (Offset,Value)-Pair #8 + { 0x35, 0x18 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetTextureState_BumpEnv+0x50 : shl esi, 5 + { 0x50, 0xC1 }, // (Offset,Value)-Pair #10 + { 0x51, 0xE6 }, // (Offset,Value)-Pair #11 + { 0x52, 0x05 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetIndices +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetIndices_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetIndices+0x0E : jz +0x10 + { 0x0E, 0x74 }, // (Offset,Value)-Pair #1 + { 0x0F, 0x10 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetIndices+0x1E : jmp +0x0A + { 0x1E, 0xEB }, // (Offset,Value)-Pair #3 + { 0x1F, 0x0A }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetIndices+0x59 : mov [esi+0x1C], ecx + { 0x59, 0x89 }, // (Offset,Value)-Pair #5 + { 0x5A, 0x4E }, // (Offset,Value)-Pair #6 + { 0x5B, 0x1C }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetIndices+0x76 : mov [esi+0x038C], edi + { 0x76, 0x89 }, // (Offset,Value)-Pair #8 + { 0x77, 0xBE }, // (Offset,Value)-Pair #9 + { 0x78, 0x8C }, // (Offset,Value)-Pair #10 + { 0x79, 0x03 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetTexture +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetTexture_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTexture+0x09 : push edi + { 0x09, 0x57 }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetTexture+0x21 : jz +0x20 + { 0x21, 0x74 }, // (Offset,Value)-Pair #2 + { 0x22, 0x20 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetTexture+0x33 : test ecx, 0x78FFFF + { 0x33, 0xF7 }, // (Offset,Value)-Pair #4 + { 0x34, 0xC1 }, // (Offset,Value)-Pair #5 + { 0x37, 0x78 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetTexture+0x39 : mov [eax], edx + { 0x39, 0x89 }, // (Offset,Value)-Pair #7 + { 0x3A, 0x10 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetTexture+0xC9 : jz +0x4D + { 0xC9, 0x74 }, // (Offset,Value)-Pair #9 + { 0xCA, 0x4D }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_VertexBlend +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetRenderState_VertexBlend_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_VertexBlend+0x06 : or edx, 0x200 + { 0x06, 0x81 }, // (Offset,Value)-Pair #1 + { 0x07, 0xCA }, // (Offset,Value)-Pair #2 + { 0x08, 0x00 }, // (Offset,Value)-Pair #3 + { 0x09, 0x02 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_VertexBlend+0x1E : jb +0x05 + { 0x1E, 0x72 }, // (Offset,Value)-Pair #5 + { 0x1F, 0x05 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_VertexBlend+0x2F : mov [eax+4], ecx + { 0x2F, 0x89 }, // (Offset,Value)-Pair #7 + { 0x30, 0x48 }, // (Offset,Value)-Pair #8 + { 0x31, 0x04 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetRenderState_VertexBlend+0x3E : retn 0x04 + { 0x3E, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x3F, 0x04 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_TextureFactor +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_TextureFactor_1_0_4134 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_TextureFactor+0x07 : mov eax, [esi+0x0370] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x86 }, // (Offset,Value)-Pair #2 + { 0x09, 0x70 }, // (Offset,Value)-Pair #3 + { 0x0A, 0x03 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_TextureFactor+0x2F : nop + { 0x2F, 0x90 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_TextureFactor+0x41 : retn 0x04 + { 0x41, 0xC2 }, // (Offset,Value)-Pair #6 + { 0x42, 0x04 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetRenderState_TextureFactor+0x4E : retn 0x04 + { 0x4E, 0xC2 }, // (Offset,Value)-Pair #8 + { 0x4F, 0x04 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_EdgeAntiAlias +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetRenderState_EdgeAntiAlias_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x07 : mov eax, [esi] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x06 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x0C : jb +0x05 + { 0x0C, 0x72 }, // (Offset,Value)-Pair #3 + { 0x0D, 0x05 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x13 : mov ecx, [esp+0x08] + { 0x13, 0x8B }, // (Offset,Value)-Pair #5 + { 0x14, 0x4C }, // (Offset,Value)-Pair #6 + { 0x15, 0x24 }, // (Offset,Value)-Pair #7 + { 0x16, 0x08 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x2F : retn 0x04 + { 0x2F, 0xC2 }, // (Offset,Value)-Pair #9 + { 0x30, 0x04 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_Simple +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_Simple_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_Simple+0x05 : add eax, 0x08 + { 0x05, 0x83 }, // (Offset,Value)-Pair #1 + { 0x06, 0xC0 }, // (Offset,Value)-Pair #2 + { 0x07, 0x08 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetRenderState_Simple+0x0E : jnb +0x0C + { 0x0E, 0x73 }, // (Offset,Value)-Pair #4 + { 0x0F, 0x0C }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_Simple+0x15 : mov [eax-8], ecx + { 0x15, 0x89 }, // (Offset,Value)-Pair #6 + { 0x16, 0x48 }, // (Offset,Value)-Pair #7 + { 0x17, 0xF8 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_Simple+0x18 : mov [eax-4], ecx + { 0x18, 0x89 }, // (Offset,Value)-Pair #9 + { 0x19, 0x50 }, // (Offset,Value)-Pair #10 + { 0x1A, 0xFC }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_Simple+0x25 : jmp +0xD9 + { 0x25, 0xEB }, // (Offset,Value)-Pair #12 + { 0x26, 0xD9 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_ZEnable +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_ZEnable_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_ZEnable+0x0C : jb +0x05 + { 0x0C, 0x72 }, // (Offset,Value)-Pair #1 + { 0x0D, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_ZEnable+0x1B : mov edx, [esi+0x2074h] + { 0x1B, 0x8B }, // (Offset,Value)-Pair #3 + { 0x1C, 0x96 }, // (Offset,Value)-Pair #4 + { 0x1D, 0x74 }, // (Offset,Value)-Pair #5 + { 0x1E, 0x20 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_ZEnable+0x31 : mov dword ptr [eax], 0x4030C + { 0x31, 0xC7 }, // (Offset,Value)-Pair #7 + { 0x32, 0x00 }, // (Offset,Value)-Pair #8 + { 0x33, 0x0C }, // (Offset,Value)-Pair #9 + { 0x34, 0x03 }, // (Offset,Value)-Pair #10 + { 0x35, 0x04 }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_ZEnable+0x98 : retn 0x04 + { 0x98, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x99, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_StencilEnable +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetRenderState_StencilEnable_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + { + // IDirect3DDevice8_SetRenderState_StencilEnable+0x0C : jb +0x05 + { 0x0C, 0x72 }, // (Offset,Value)-Pair #1 + { 0x0D, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_StencilEnable+0x2C : jz +0x19 + { 0x2C, 0x74 }, // (Offset,Value)-Pair #3 + { 0x2D, 0x19 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_StencilEnable+0x4D : mov dword ptr [eax], 0x00041D84 + { 0x4D, 0xC7 }, // (Offset,Value)-Pair #5 + { 0x4E, 0x00 }, // (Offset,Value)-Pair #6 + { 0x4F, 0x84 }, // (Offset,Value)-Pair #7 + { 0x50, 0x1D }, // (Offset,Value)-Pair #8 + { 0x51, 0x04 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetRenderState_StencilEnable+0x81 : retn 0x04 + { 0x81, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x82, 0x04 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias+0x04 : push esi + { 0x04, 0x56 }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias+0x05 : mov esi, dword ptr [addr] + { 0x05, 0x8B }, // (Offset,Value)-Pair #2 + { 0x06, 0x35 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias+0x0B : mov ecx, esi + { 0x0B, 0x8B }, // (Offset,Value)-Pair #4 + { 0x0C, 0xCE }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias+0x1C : jb +0x05 + { 0x1C, 0x72 }, // (Offset,Value)-Pair #6 + { 0x1D, 0x05 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias+0x38 : shl ecx, 0x10 + { 0x38, 0xC1 }, // (Offset,Value)-Pair #8 + { 0x39, 0xE1 }, // (Offset,Value)-Pair #9 + { 0x3A, 0x10 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias+0x4F : retn 0x04 + { 0x4F, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x50, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_GetTransform +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_GetTransform_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_GetTransform+0x0A : shl ecx, 0x06 + { 0x0A, 0xC1 }, // (Offset,Value)-Pair #1 + { 0x0B, 0xE1 }, // (Offset,Value)-Pair #2 + { 0x0C, 0x06 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_GetTransform+0x12 : lea esi, [ecx+eax+*numb*] + { 0x12, 0x8D }, // (Offset,Value)-Pair #4 + { 0x13, 0xB4 }, // (Offset,Value)-Pair #5 + { 0x14, 0x01 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_GetTransform+0x19 : mov ecx, 0x10 + { 0x19, 0xB9 }, // (Offset,Value)-Pair #7 + { 0x1A, 0x10 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_GetTransform+0x20 : pop edi, pop esi + { 0x20, 0x5F }, // (Offset,Value)-Pair #9 + { 0x21, 0x5E }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_GetTransform+0x22 : retn 0x08 + { 0x22, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x23, 0x08 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetStreamSource +// ****************************************************************** +SOOVPA<14> IDirect3DDevice8_SetStreamSource_1_0_4134 = +{ + 0, // Large == 0 + 14, // Count == 14 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetStreamSource+0x08 : mov edi, [esp+8+0x04] + { 0x08, 0x8B }, // (Offset,Value)-Pair #1 + { 0x09, 0x7C }, // (Offset,Value)-Pair #2 + { 0x0A, 0x24 }, // (Offset,Value)-Pair #3 + { 0x0B, 0x10 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetStreamSource+0x28 : jz +0x26 + { 0x28, 0x74 }, // (Offset,Value)-Pair #5 + { 0x29, 0x26 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetStreamSource+0x70 : or ecx, 0x40 + { 0x70, 0x83 }, // (Offset,Value)-Pair #7 + { 0x71, 0xC9 }, // (Offset,Value)-Pair #8 + { 0x72, 0x40 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetStreamSource+0x7E : or ecx, 0x70 + { 0x7E, 0x83 }, // (Offset,Value)-Pair #10 + { 0x7F, 0xC9 }, // (Offset,Value)-Pair #11 + { 0x80, 0x70 }, // (Offset,Value)-Pair #12 + + // IDirect3DDevice8_SetStreamSource+0x89 : retn 0x0C + { 0x89, 0xC2 }, // (Offset,Value)-Pair #13 + { 0x8A, 0x0C }, // (Offset,Value)-Pair #14 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetVertexShader +// ****************************************************************** +SOOVPA<14> IDirect3DDevice8_SetVertexShader_1_0_4134 = +{ + 0, // Large == 0 + 14, // Count == 14 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetVertexShader+0x06 : test bl, 1 + { 0x06, 0xF6 }, // (Offset,Value)-Pair #1 + { 0x07, 0xC3 }, // (Offset,Value)-Pair #2 + { 0x08, 0x01 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetVertexShader+0x11 : mov eax, [esi+0x0380] + { 0x11, 0x8B }, // (Offset,Value)-Pair #4 + { 0x12, 0x86 }, // (Offset,Value)-Pair #5 + { 0x13, 0x80 }, // (Offset,Value)-Pair #6 + { 0x14, 0x03 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetVertexShader+0x90 : retn 0x04 + { 0x90, 0xC2 }, // (Offset,Value)-Pair #8 + { 0x91, 0x04 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetVertexShader+0xB0 : mov dword ptr [eax], 0x4194C + { 0xB0, 0xC7 }, // (Offset,Value)-Pair #10 + { 0xB1, 0x00 }, // (Offset,Value)-Pair #11 + { 0xB2, 0x4C }, // (Offset,Value)-Pair #12 + { 0xB3, 0x19 }, // (Offset,Value)-Pair #13 + { 0xB4, 0x04 }, // (Offset,Value)-Pair #14 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_DrawVertices +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_DrawVertices_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_DrawVertices+0x12 : mov edi, [esp+0x0C+0x0C] + { 0x12, 0x8B }, // (Offset,Value)-Pair #1 + { 0x13, 0x7C }, // (Offset,Value)-Pair #2 + { 0x14, 0x24 }, // (Offset,Value)-Pair #3 + { 0x15, 0x18 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_DrawVertices+0x16 : lea esi, [edi-1] + { 0x16, 0x8D }, // (Offset,Value)-Pair #5 + { 0x17, 0x77 }, // (Offset,Value)-Pair #6 + { 0x18, 0xFF }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_DrawVertices+0x7E : shl edi, 0x18 + { 0x7E, 0xC1 }, // (Offset,Value)-Pair #8 + { 0x7F, 0xE7 }, // (Offset,Value)-Pair #9 + { 0x80, 0x18 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_DrawVertices+0x9C : retn 0x0C + { 0x9C, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x9D, 0x0C }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_DrawVerticesUP +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_DrawVerticesUP_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_DrawVerticesUP+0x03 : sub esp, 0x14 + { 0x03, 0x83 }, // (Offset,Value)-Pair #1 + { 0x04, 0xEC }, // (Offset,Value)-Pair #2 + { 0x05, 0x14 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_DrawVerticesUP+0x2F : mov edx, [edi+0x744] + { 0x2F, 0x8B }, // (Offset,Value)-Pair #4 + { 0x30, 0x97 }, // (Offset,Value)-Pair #5 + { 0x31, 0x44 }, // (Offset,Value)-Pair #6 + { 0x32, 0x07 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_DrawVerticesUP+0xC1 : cmp esi, 0x80 + { 0xC1, 0x81 }, // (Offset,Value)-Pair #8 + { 0xC2, 0xFE }, // (Offset,Value)-Pair #9 + { 0xC3, 0x80 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_DrawIndexedVertices +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_DrawIndexedVertices_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_DrawIndexedVertices+0x0E : mov eax, [esi+0x1C] + { 0x0E, 0x8B }, // (Offset,Value)-Pair #1 + { 0x0F, 0x46 }, // (Offset,Value)-Pair #2 + { 0x10, 0x1C }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_DrawIndexedVertices+0x20 : push 0x0209 + { 0x20, 0x68 }, // (Offset,Value)-Pair #4 + { 0x21, 0x09 }, // (Offset,Value)-Pair #5 + { 0x22, 0x02 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_DrawIndexedVertices+0x64 : dec eax + { 0x64, 0x48 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_DrawIndexedVertices+0xF1 : prefetchnta byte ptr [esi+0x3C] + { 0xF1, 0x0F }, // (Offset,Value)-Pair #8 + { 0xF2, 0x18 }, // (Offset,Value)-Pair #9 + { 0xF3, 0x46 }, // (Offset,Value)-Pair #10 + { 0xF4, 0x3C }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetLight +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetLight_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetLight+0x11 : mov edi, [ebp+0x394] + { 0x11, 0x8B }, // (Offset,Value)-Pair #1 + { 0x12, 0xBD }, // (Offset,Value)-Pair #2 + { 0x13, 0x94 }, // (Offset,Value)-Pair #3 + { 0x14, 0x03 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetLight+0x30 : shl eax, 0x04 + { 0x30, 0xC1 }, // (Offset,Value)-Pair #5 + { 0x31, 0xE0 }, // (Offset,Value)-Pair #6 + { 0x32, 0x04 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetLight+0xBD : rep stosb + { 0xBD, 0xF3 }, // (Offset,Value)-Pair #8 + { 0xBE, 0xAB }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetLight+0xFD : mov ecx, [ebx+0x68] + { 0xFD, 0x8B }, // (Offset,Value)-Pair #10 + { 0xFE, 0x4B }, // (Offset,Value)-Pair #11 + { 0xFF, 0x68 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetMaterial +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetMaterial_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetMaterial+0x0C : add edi, 0x0940 + { 0x0C, 0x81 }, // (Offset,Value)-Pair #1 + { 0x0D, 0xC7 }, // (Offset,Value)-Pair #2 + { 0x0E, 0xF0 }, // (Offset,Value)-Pair #3 + { 0x0F, 0x09 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetMaterial+0x12 : mov ecx, 0x11 + { 0x12, 0xB9 }, // (Offset,Value)-Pair #5 + { 0x13, 0x11 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetMaterial+0x1F : or ecx, 0x1000 + { 0x1F, 0x81 }, // (Offset,Value)-Pair #7 + { 0x20, 0xC9 }, // (Offset,Value)-Pair #8 + { 0x21, 0x00 }, // (Offset,Value)-Pair #9 + { 0x22, 0x10 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetMaterial+0x2D : retn 0x04 + { 0x2D, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x2E, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_LightEnable +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_LightEnable_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_LightEnable+0x0F : cmp ebx, [esi+0x0394] + { 0x0F, 0x3B }, // (Offset,Value)-Pair #1 + { 0x10, 0x9E }, // (Offset,Value)-Pair #2 + { 0x11, 0x94 }, // (Offset,Value)-Pair #3 + { 0x12, 0x03 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_LightEnable+0x6B : test eax, eax + { 0x6B, 0x85 }, // (Offset,Value)-Pair #5 + { 0x6C, 0xC0 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_LightEnable+0x9E : mov eax, [eax+0x8C] + { 0x9E, 0x8B }, // (Offset,Value)-Pair #7 + { 0x9F, 0x80 }, // (Offset,Value)-Pair #8 + { 0xA0, 0x8C }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_LightEnable+0xBC : jz +0x12 + { 0xBC, 0x74 }, // (Offset,Value)-Pair #10 + { 0xBD, 0x12 }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_LightEnable+0xE1 : retn 0x08 + { 0xE1, 0xC2 }, // (Offset,Value)-Pair #12 + { 0xE2, 0x08 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DVertexBuffer8_Lock +// ****************************************************************** +SOOVPA<11> IDirect3DVertexBuffer8_Lock_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DVertexBuffer8_Lock+0x01 : mov bl, [esp+0x18] + { 0x01, 0x8A }, // (Offset,Value)-Pair #1 + { 0x02, 0x5C }, // (Offset,Value)-Pair #2 + { 0x03, 0x24 }, // (Offset,Value)-Pair #3 + { 0x04, 0x18 }, // (Offset,Value)-Pair #4 + + // IDirect3DVertexBuffer8_Lock+0x09 : jnz +0x24 + { 0x09, 0x75 }, // (Offset,Value)-Pair #5 + { 0x0A, 0x24 }, // (Offset,Value)-Pair #6 + + // IDirect3DVertexBuffer8_Lock+0x2F : test bl, 0xA0 + { 0x2F, 0xF6 }, // (Offset,Value)-Pair #7 + { 0x30, 0xC3 }, // (Offset,Value)-Pair #8 + { 0x31, 0xA0 }, // (Offset,Value)-Pair #9 + + // IDirect3DVertexBuffer8_Lock+0x50 : retn 0x14 + { 0x50, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x51, 0x14 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DSurface8_GetDesc +// ****************************************************************** +SOOVPA<15> IDirect3DSurface8_GetDesc_1_0_4134 = +{ + 0, // Large == 0 + 15, // Count == 15 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DSurface8_GetDesc+0x00 : mov eax, [esp+0x08] + { 0x00, 0x8B }, // (Offset,Value)-Pair #1 + { 0x01, 0x44 }, // (Offset,Value)-Pair #2 + { 0x02, 0x24 }, // (Offset,Value)-Pair #3 + { 0x03, 0x08 }, // (Offset,Value)-Pair #4 + + // IDirect3DSurface8_GetDesc+0x04 : mov ecx, [esp+0x04] + { 0x04, 0x8B }, // (Offset,Value)-Pair #5 + { 0x05, 0x4C }, // (Offset,Value)-Pair #6 + { 0x06, 0x24 }, // (Offset,Value)-Pair #7 + { 0x07, 0x04 }, // (Offset,Value)-Pair #8 + + // IDirect3DSurface8_GetDesc+0x08 : push eax + { 0x08, 0x50 }, // (Offset,Value)-Pair #9 + + // IDirect3DSurface8_GetDesc+0x09 : push 0 + { 0x09, 0x6A }, // (Offset,Value)-Pair #10 + { 0x0A, 0x00 }, // (Offset,Value)-Pair #11 + + // IDirect3DSurface8_GetDesc+0x0B : push ecx + { 0x0B, 0x51 }, // (Offset,Value)-Pair #12 + + // IDirect3DSurface8_GetDesc+0x0C : call [abs] + { 0x0C, 0xE8 }, // (Offset,Value)-Pair #13 + + // IDirect3DSurface8_GetDesc+0x11 : retn 0x08 + { 0x11, 0xC2 }, // (Offset,Value)-Pair #14 + { 0x12, 0x08 }, // (Offset,Value)-Pair #15 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_NormalizeNormals +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetRenderState_NormalizeNormals_1_0_4134 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_NormalizeNormals+0x07 : mov eax, [esi] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x06 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_NormalizeNormals+0x25 : or [addr], 0x200 + { 0x25, 0x81 }, // (Offset,Value)-Pair #3 + { 0x26, 0x0D }, // (Offset,Value)-Pair #4 + { 0x2B, 0x00 }, // (Offset,Value)-Pair #5 + { 0x2C, 0x02 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_NormalizeNormals+0x36 : retn 0x04 + { 0x36, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x37, 0x04 }, // (Offset,Value)-Pair #8 + } +}; + +// ****************************************************************** +// * Get2DSurfaceDesc +// ****************************************************************** +SOOVPA<10> Get2DSurfaceDesc_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // Get2DSurfaceDesc+0x2B : movzx edx, byte ptr [edi+0x0D] + { 0x2B, 0x0F }, // (Offset,Value)-Pair #1 + { 0x2C, 0xB6 }, // (Offset,Value)-Pair #2 + { 0x2D, 0x57 }, // (Offset,Value)-Pair #3 + { 0x2E, 0x0D }, // (Offset,Value)-Pair #4 + + // Get2DSurfaceDesc+0x52 : mov edx, [eax+0x21C0] + { 0x52, 0x8B }, // (Offset,Value)-Pair #5 + { 0x53, 0x90 }, // (Offset,Value)-Pair #6 + { 0x54, 0x7C }, // (Offset,Value)-Pair #7 + { 0x55, 0x20 }, // (Offset,Value)-Pair #8 + + // Get2DSurfaceDesc+0xAE : retn 0x0C + { 0xAE, 0xC2 }, // (Offset,Value)-Pair #9 + { 0xAF, 0x0C }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_Reset +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_Reset_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_Reset+0x15 : mov ecx, ebp + { 0x15, 0x8B }, // (Offset,Value)-Pair #1 + { 0x16, 0xCD }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_Reset+0x1E : jnz +0xF5 + { 0x1E, 0x75 }, // (Offset,Value)-Pair #3 + { 0x1F, 0xF5 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_Reset+0x27 : mov esi, [esp+0x14] + { 0x27, 0x8B }, // (Offset,Value)-Pair #5 + { 0x28, 0x74 }, // (Offset,Value)-Pair #6 + { 0x29, 0x24 }, // (Offset,Value)-Pair #7 + { 0x2A, 0x14 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_Reset+0x37 : jge +0x10 + { 0x37, 0x7D }, // (Offset,Value)-Pair #9 + { 0x38, 0x10 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3D8_KickOffAndWaitForIdle +// ****************************************************************** +SOOVPA<9> IDirect3D8_KickOffAndWaitForIdle_1_0_4134 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3D8_KickOffAndWaitForIdle+0x00 : mov eax, [addr] + { 0x00, 0xA1 }, // (Offset,Value)-Pair #1 + + // IDirect3D8_KickOffAndWaitForIdle+0x05 : mov ecx, [eax+0x30] + { 0x05, 0x8B }, // (Offset,Value)-Pair #2 + { 0x06, 0x48 }, // (Offset,Value)-Pair #3 + { 0x07, 0x30 }, // (Offset,Value)-Pair #4 + + // IDirect3D8_KickOffAndWaitForIdle+0x08 : push 0 + { 0x08, 0x6A }, // (Offset,Value)-Pair #5 + { 0x09, 0x00 }, // (Offset,Value)-Pair #6 + + // IDirect3D8_KickOffAndWaitForIdle+0x0A : push ecx + { 0x0A, 0x51 }, // (Offset,Value)-Pair #7 + + // IDirect3D8_KickOffAndWaitForIdle+0x0B : call [addr] + { 0x0B, 0xE8 }, // (Offset,Value)-Pair #8 + + // IDirect3D8_KickOffAndWaitForIdle+0x10 : retn + { 0x10, 0xC3 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetTextureState_TwoSidedLighting +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x11 : or edx, 0x1000 + { 0x11, 0x81 }, // (Offset,Value)-Pair #1 + { 0x12, 0xCA }, // (Offset,Value)-Pair #2 + { 0x13, 0x00 }, // (Offset,Value)-Pair #3 + { 0x14, 0x10 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x24 : cmp eax, [esi+4]; push edi + { 0x24, 0x3B }, // (Offset,Value)-Pair #5 + { 0x25, 0x46 }, // (Offset,Value)-Pair #6 + { 0x26, 0x04 }, // (Offset,Value)-Pair #7 + { 0x27, 0x57 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x53 : add eax, 0x0C + { 0x53, 0x83 }, // (Offset,Value)-Pair #9 + { 0x54, 0xC0 }, // (Offset,Value)-Pair #10 + { 0x55, 0x0C }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x60 : retn 0x04 + { 0x60, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x61, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_BackFillMode +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_BackFillMode_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_BackFillMode+0x1C : jb +0x05 + { 0x1C, 0x72 }, // (Offset,Value)-Pair #1 + { 0x1D, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_BackFillMode+0x35 : mov dword ptr [eax], abs + { 0x35, 0xC7 }, // (Offset,Value)-Pair #3 + { 0x36, 0x00 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_BackFillMode+0x3B : add eax, 0x0C; mov [esi], eax; mov [abs], edi + { 0x41, 0x83 }, // (Offset,Value)-Pair #5 + { 0x42, 0xC0 }, // (Offset,Value)-Pair #6 + { 0x43, 0x0C }, // (Offset,Value)-Pair #7 + { 0x44, 0x89 }, // (Offset,Value)-Pair #8 + { 0x45, 0x06 }, // (Offset,Value)-Pair #9 + { 0x46, 0x89 }, // (Offset,Value)-Pair #10 + { 0x47, 0x3D }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_BackFillMode+0x4E : retn 0x04 + { 0x4E, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x4F, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetTextureState_ColorKeyColor +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTextureState_ColorKeyColor+0x0C : jb +0x05 + { 0x0C, 0x72 }, // (Offset,Value)-Pair #1 + { 0x0D, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetTextureState_ColorKeyColor+0x27 : add eax, 8; mov [esi], eax; shl ecx, 7 + { 0x27, 0x83 }, // (Offset,Value)-Pair #3 + { 0x28, 0xC0 }, // (Offset,Value)-Pair #4 + { 0x29, 0x08 }, // (Offset,Value)-Pair #5 + { 0x2A, 0x89 }, // (Offset,Value)-Pair #6 + { 0x2B, 0x06 }, // (Offset,Value)-Pair #7 + { 0x2C, 0xC1 }, // (Offset,Value)-Pair #8 + { 0x2D, 0xE1 }, // (Offset,Value)-Pair #9 + { 0x2E, 0x07 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetTextureState_ColorKeyColor+0x36 : retn 0x08 + { 0x36, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x37, 0x08 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_FrontFace +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetRenderState_FrontFace_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirect3DDevice8_SetRenderState_FrontFace+0x36 : jmp IDirect3DDevice8_SetRenderState_CullMode + { 0x36, XREF_DXSRSCULLMODE}, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_FrontFace+0x09 : cmp eax, [esi+4] + { 0x09, 0x3B }, // (Offset,Value)-Pair #2 + { 0x0A, 0x46 }, // (Offset,Value)-Pair #3 + { 0x0B, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_FrontFace+0x13 : mov ecx, [esp+0x08] + { 0x13, 0x8B }, // (Offset,Value)-Pair #5 + { 0x14, 0x4C }, // (Offset,Value)-Pair #6 + { 0x15, 0x24 }, // (Offset,Value)-Pair #7 + { 0x16, 0x08 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_FrontFace+0x20 : add eax, 8 + { 0x20, 0x83 }, // (Offset,Value)-Pair #9 + { 0x21, 0xC0 }, // (Offset,Value)-Pair #10 + { 0x22, 0x08 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_LogicOp +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_LogicOp_1_0_4134 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_LogicOp+0x07 : mov eax, [esi] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x06 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_LogicOp+0x1B : mov dword ptr [eax], 0x417BC + { 0x1B, 0xC7 }, // (Offset,Value)-Pair #3 + { 0x1C, 0x00 }, // (Offset,Value)-Pair #4 + { 0x1D, 0xBC }, // (Offset,Value)-Pair #5 + { 0x1E, 0x17 }, // (Offset,Value)-Pair #6 + { 0x1F, 0x04 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetRenderState_LogicOp+0x4F : retn 0x04 + { 0x4F, 0xC2 }, // (Offset,Value)-Pair #8 + { 0x50, 0x04 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_StencilFail +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_StencilFail_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_StencilFail+0x0C : jb +0x05 + { 0x0C, 0x72 }, // (Offset,Value)-Pair #1 + { 0x0D, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_StencilFail+0x38 : cmp [abs], 0x1E00 + { 0x38, 0x81 }, // (Offset,Value)-Pair #3 + { 0x3E, 0x00 }, // (Offset,Value)-Pair #4 + { 0x3F, 0x1E }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_StencilFail+0x47 : mov dword ptr [eax], 0x41D84 + { 0x47, 0xC7 }, // (Offset,Value)-Pair #6 + { 0x48, 0x00 }, // (Offset,Value)-Pair #7 + { 0x49, 0x84 }, // (Offset,Value)-Pair #8 + { 0x4A, 0x1D }, // (Offset,Value)-Pair #9 + { 0x4B, 0x04 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_StencilFail+0x6A : retn 0x04 + { 0x6A, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x6B, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_OcclusionCullEnable +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x15 : jb +0x05 + { 0x15, 0x72 }, // (Offset,Value)-Pair #1 + { 0x16, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x41 : cmp [abs], 0x1E00 + { 0x41, 0x81 }, // (Offset,Value)-Pair #3 + { 0x47, 0x00 }, // (Offset,Value)-Pair #4 + { 0x48, 0x1E }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x50 : mov dword ptr [eax], 0x41D84 + { 0x50, 0xC7 }, // (Offset,Value)-Pair #6 + { 0x51, 0x00 }, // (Offset,Value)-Pair #7 + { 0x52, 0x84 }, // (Offset,Value)-Pair #8 + { 0x53, 0x1D }, // (Offset,Value)-Pair #9 + { 0x54, 0x04 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x5F : retn 0x04 + { 0x5F, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x60, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_StencilCullEnable +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x0C : D3D__RenderState[D3DRS_STENCILCULLENABLE] + { 0x0C, XREF_D3DRS_STENCILCULLENABLE }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x15 : jb +0x05 + { 0x15, 0x72 }, // (Offset,Value)-Pair #2 + { 0x16, 0x05 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x41 : cmp [abs], 0x1E00 + { 0x41, 0x81 }, // (Offset,Value)-Pair #4 + { 0x47, 0x00 }, // (Offset,Value)-Pair #5 + { 0x48, 0x1E }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x50 : mov dword ptr [eax], 0x41D84 + { 0x50, 0xC7 }, // (Offset,Value)-Pair #7 + { 0x51, 0x00 }, // (Offset,Value)-Pair #8 + { 0x52, 0x84 }, // (Offset,Value)-Pair #9 + { 0x53, 0x1D }, // (Offset,Value)-Pair #10 + { 0x54, 0x04 }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x5F : retn 0x04 + { 0x5F, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x60, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_FillMode +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetRenderState_FillMode_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_FillMode+0x07 : mov eax, [esi] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x06 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_FillMode+0x21 : mov ecx, [esp+0x08] + { 0x21, 0x8B }, // (Offset,Value)-Pair #3 + { 0x22, 0x4C }, // (Offset,Value)-Pair #4 + { 0x23, 0x24 }, // (Offset,Value)-Pair #5 + { 0x24, 0x08 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_FillMode+0x25 : jnz +0x02 + { 0x25, 0x75 }, // (Offset,Value)-Pair #7 + { 0x26, 0x02 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_FillMode+0x35 : add eax, 0x0C + { 0x35, 0x83 }, // (Offset,Value)-Pair #9 + { 0x36, 0xC0 }, // (Offset,Value)-Pair #10 + { 0x37, 0x0C }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_4134 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x05 : D3D__RenderState[D3DRS_ROPZCMPALWAYSREAD] + { 0x05, XREF_D3DRS_ROPZCMPALWAYSREAD }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #2 + { 0x01, 0x44 }, // (Offset,Value)-Pair #3 + { 0x02, 0x24 }, // (Offset,Value)-Pair #4 + { 0x03, 0x04 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x09 : call [abs] + { 0x09, 0xE8 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x0E : retn 0x04 + { 0x0E, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x0F, 0x04 }, // (Offset,Value)-Pair #8 + { 0x10, 0x00 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_RopZRead +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_RopZRead_1_0_4134 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirect3DDevice8_SetRenderState_RopZRead+0x05 : D3D__RenderState[D3DRS_ROPZCMPALWAYSREAD] + { 0x05, XREF_D3DRS_ROPZREAD }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_RopZRead+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #2 + { 0x01, 0x44 }, // (Offset,Value)-Pair #3 + { 0x02, 0x24 }, // (Offset,Value)-Pair #4 + { 0x03, 0x04 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_RopZRead+0x09 : call [abs] + { 0x09, 0xE8 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_RopZRead+0x0E : retn 0x04 + { 0x0E, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x0F, 0x04 }, // (Offset,Value)-Pair #8 + { 0x10, 0x00 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_DoNotCullUncompressed +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4134 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x05 : D3D__RenderState[D3DRS_ROPZCMPALWAYSREAD] + { 0x05, XREF_D3DRS_DONOTCULLUNCOMPRESSED }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #2 + { 0x01, 0x44 }, // (Offset,Value)-Pair #3 + { 0x02, 0x24 }, // (Offset,Value)-Pair #4 + { 0x03, 0x04 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x09 : call [abs] + { 0x09, 0xE8 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x0E : retn 0x04 + { 0x0E, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x0F, 0x04 }, // (Offset,Value)-Pair #8 + { 0x10, 0x00 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable_1_0_4134 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable+0x0C : mov eax, [edi+0x2070] + { 0x0C, 0x8B }, // (Offset,Value)-Pair #1 + { 0x0D, 0x86 }, // (Offset,Value)-Pair #2 + { 0x0E, 0x70 }, // (Offset,Value)-Pair #3 + { 0x0F, 0x20 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable+0x6E : add eax, 0x18 + { 0x6E, 0x83 }, // (Offset,Value)-Pair #5 + { 0x6F, 0xC0 }, // (Offset,Value)-Pair #6 + { 0x70, 0x18 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable+0x7C : retn 0x04 + { 0x7C, 0xC2 }, // (Offset,Value)-Pair #8 + { 0x7D, 0x04 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_MultiSampleMask +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_MultiSampleMask_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x1C : jb +0x05 + { 0x1C, 0x72 }, // (Offset,Value)-Pair #1 + { 0x1D, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x38 : and ecx, 0x0F; shl edx, 0x10 + { 0x38, 0x83 }, // (Offset,Value)-Pair #3 + { 0x39, 0xE1 }, // (Offset,Value)-Pair #4 + { 0x3A, 0x0F }, // (Offset,Value)-Pair #5 + { 0x3B, 0xC1 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x3E : mov dword ptr [eax], 0x41D7C + { 0x3E, 0xC7 }, // (Offset,Value)-Pair #7 + { 0x3F, 0x00 }, // (Offset,Value)-Pair #8 + { 0x40, 0x7C }, // (Offset,Value)-Pair #9 + { 0x41, 0x1D }, // (Offset,Value)-Pair #10 + { 0x42, 0x04 }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x4F : retn 0x04 + { 0x4F, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x50, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_MultiSampleMode +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_MultiSampleMode_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x0F : mov ecx, [eax+0x2070] + { 0x0F, 0x8B }, // (Offset,Value)-Pair #1 + { 0x10, 0x88 }, // (Offset,Value)-Pair #2 + { 0x11, 0x70 }, // (Offset,Value)-Pair #3 + { 0x12, 0x20 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x15 : cmp ecx, [eax+0x207C] + { 0x15, 0x3B }, // (Offset,Value)-Pair #5 + { 0x16, 0x88 }, // (Offset,Value)-Pair #6 + { 0x17, 0x7C }, // (Offset,Value)-Pair #7 + { 0x18, 0x20 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x1B : jnz +0x0D + { 0x1B, 0x75 }, // (Offset,Value)-Pair #9 + { 0x1C, 0x0D }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x2A : retn 0x04 + { 0x2A, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x2B, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode+0x0F : mov ecx, [eax+0x2070] + { 0x0F, 0x8B }, // (Offset,Value)-Pair #1 + { 0x10, 0x88 }, // (Offset,Value)-Pair #2 + { 0x11, 0x70 }, // (Offset,Value)-Pair #3 + { 0x12, 0x20 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode+0x15 : cmp ecx, [eax+0x207C] + { 0x15, 0x3B }, // (Offset,Value)-Pair #5 + { 0x16, 0x88 }, // (Offset,Value)-Pair #6 + { 0x17, 0x7C }, // (Offset,Value)-Pair #7 + { 0x18, 0x20 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode+0x1B : jz +0x0D + { 0x1B, 0x74 }, // (Offset,Value)-Pair #9 + { 0x1C, 0x0D }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode+0x2A : retn 0x04 + { 0x2A, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x2B, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_ShadowFunc +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x00 : push esi + { 0x00, 0x56 }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x09 : cmp eax, [esi+4] + { 0x09, 0x3B }, // (Offset,Value)-Pair #2 + { 0x0A, 0x46 }, // (Offset,Value)-Pair #3 + { 0x0B, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x0C : jb +0x05 + { 0x0C, 0x72 }, // (Offset,Value)-Pair #5 + { 0x0D, 0x05 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x1D : lea edx, [ecx-0x0200] + { 0x1D, 0x8D }, // (Offset,Value)-Pair #7 + { 0x1E, 0x91 }, // (Offset,Value)-Pair #8 + { 0x1F, 0x00 }, // (Offset,Value)-Pair #9 + { 0x20, 0xFE }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x26 : add eax, 0x08 + { 0x26, 0x83 }, // (Offset,Value)-Pair #11 + { 0x27, 0xC0 }, // (Offset,Value)-Pair #12 + { 0x28, 0x08 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_YuvEnable +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_YuvEnable+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #1 + { 0x01, 0x44 }, // (Offset,Value)-Pair #2 + { 0x02, 0x24 }, // (Offset,Value)-Pair #3 + { 0x03, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x10 : mov eax, [esi] + { 0x10, 0x8B }, // (Offset,Value)-Pair #5 + { 0x11, 0x06 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x12 : cmp eax, [esi+4] + { 0x12, 0x3B }, // (Offset,Value)-Pair #7 + { 0x13, 0x46 }, // (Offset,Value)-Pair #8 + { 0x14, 0x04 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x15 : jb +0x05 + { 0x15, 0x72 }, // (Offset,Value)-Pair #10 + { 0x16, 0x05 }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x28 : retn 0x04 + { 0x28, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x29, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_DrawIndexedVerticesUP +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_DrawIndexedVerticesUP_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_DrawIndexedVerticesUP+0x4A : or edx, 0x800 + { 0x4A, 0x81 }, // (Offset,Value)-Pair #1 + { 0x4B, 0xCA }, // (Offset,Value)-Pair #2 + { 0x4C, 0x00 }, // (Offset,Value)-Pair #3 + { 0x4D, 0x08 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_DrawIndexedVerticesUP+0x5C : lea edx, [edi+0x6C4] + { 0x5C, 0x8D }, // (Offset,Value)-Pair #5 + { 0x5D, 0x97 }, // (Offset,Value)-Pair #6 + { 0x5E, 0xC4 }, // (Offset,Value)-Pair #7 + { 0x5F, 0x06 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_DrawIndexedVerticesUP+0x6A : mov eax, 0x10 + { 0x6A, 0xB8 }, // (Offset,Value)-Pair #9 + { 0x6B, 0x10 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetPixelShaderConstant +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetPixelShaderConstant_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetPixelShaderConstant+0x17 : test eax, eax + { 0x17, 0x85 }, // (Offset,Value)-Pair #1 + { 0x18, 0xC0 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetPixelShaderConstant+0x32 : add edi, 0x04 + { 0x32, 0x83 }, // (Offset,Value)-Pair #3 + { 0x33, 0xC7 }, // (Offset,Value)-Pair #4 + { 0x34, 0x04 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetPixelShaderConstant+0x47 : jmp +0x07 + { 0x47, 0xEB }, // (Offset,Value)-Pair #6 + { 0x48, 0x07 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetPixelShaderConstant+0xC7 : fstp [esp+??] + { 0xC7, 0xD9 }, // (Offset,Value)-Pair #8 + { 0xC8, 0x1C }, // (Offset,Value)-Pair #9 + { 0xC9, 0x24 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * D3DDevice_DeletePixelShader +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_DeletePixelShader_1_0_4134 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x02, 0x24 }, + { 0x06, 0x75 }, + { 0x0A, 0x04 }, + { 0x0E, 0x09 }, + { 0x12, 0x04 }, + { 0x18, 0xC2 }, + { 0x1A, 0x00 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_CullModeB +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_CullModeB_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 13 + + XREF_DXSRSCULLMODE, // XRef Is Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_CullModeB+0x22 : mov dword ptr [eax], 0x40308 + { 0x22, 0xC7 }, // (Offset,Value)-Pair #1 + { 0x24, 0x08 }, // (Offset,Value)-Pair #2 + { 0x25, 0x03 }, // (Offset,Value)-Pair #3 + { 0x26, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_CullModeB+0x2D : add eax, 8 + { 0x2D, 0x83 }, // (Offset,Value)-Pair #5 + { 0x2E, 0xC0 }, // (Offset,Value)-Pair #6 + { 0x2F, 0x08 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetRenderState_CullModeB+0x39 : retn 4 + { 0x39, 0xC2 }, // (Offset,Value)-Pair #8 + { 0x3A, 0x04 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetRenderState_CullModeB+0x5C : add edx, 0x404 + { 0x5C, 0x81 }, // (Offset,Value)-Pair #10 + { 0x5D, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x5E, 0x04 }, // (Offset,Value)-Pair #12 + { 0x5F, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * D3DDevice_DeleteVertexShader +// ****************************************************************** +SOOVPA<6> X_D3DDevice_DeleteVertexShader_1_0_4134 = +{ + 0, // Large == 0 + 6, // Count == 6 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x02, 0x24 }, + { 0x06, 0xFF }, + { 0x0A, 0x08 }, + { 0x0E, 0x44 }, + { 0x16, 0xC2 }, + { 0x17, 0x04 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetScreenSpaceOffset +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_SetScreenSpaceOffset_1_0_4134 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not saved + 0, // XRef Not Used + + { + { 0x06, 0x56 }, + { 0x07, 0xD8 }, + { 0x08, 0x44 }, + { 0x09, 0x24 }, + { 0x0A, 0x08 }, + { 0x2E, 0x8B }, + { 0x2F, 0x06 }, + } +}; + +// ****************************************************************** +// * D3D::SetFence +// ****************************************************************** +SOOVPA<12> D3D_SetFence_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + XREF_D3D_SETFENCE, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x0D, 0x72 }, + { 0x0E, 0x0E }, + { 0x31, 0xBA }, + { 0x32, 0x90 }, + { 0x33, 0x1D }, + { 0x34, 0x04 }, + { 0x35, 0x00 }, + { 0x45, 0x83 }, + { 0x46, 0xE1 }, + { 0x47, 0x3F }, + { 0xAA, 0xC2 }, + { 0xAB, 0x04 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetRenderState_LineWidth +// ****************************************************************** +SOOVPA<7> D3DDevice_SetRenderState_LineWidth_1_0_4134 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0C, 0x89 }, + { 0x18, 0x04 }, + { 0x28, 0xD9 }, + { 0x32, 0x81 }, + { 0x3F, 0x8B }, + { 0x4C, 0x00 }, + { 0x59, 0x06 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_BlockUntilVerticalBlank +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_BlockUntilVerticalBlank_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_BlockUntilVerticalBlank+0x05 : push 0; push 0; push 1 + { 0x05, 0x6A }, // (Offset,Value)-Pair #1 + { 0x06, 0x00 }, // (Offset,Value)-Pair #2 + { 0x07, 0x6A }, // (Offset,Value)-Pair #3 + { 0x08, 0x00 }, // (Offset,Value)-Pair #4 + { 0x09, 0x6A }, // (Offset,Value)-Pair #5 + { 0x0A, 0x01 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_BlockUntilVerticalBlank+0x17 : add eax, 0x2430 + { 0x17, 0x05 }, // (Offset,Value)-Pair #7 + { 0x18, 0x30 }, // (Offset,Value)-Pair #8 + { 0x19, 0x24 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_BlockUntilVerticalBlank+0x1D : call [KrnlImport] + { 0x1D, 0xFF }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_BlockUntilVerticalBlank+0x23 : retn + { 0x23, 0xC3 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetSwapCallback +// ****************************************************************** +/* This may look the same as 4361, but accuracy is not gauranteed. + It might be a SetVerticalBlankCallback that has an identical signature... */ +SOOVPA<12> IDirect3DDevice8_SetSwapCallback_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetVerticalBlankCallback+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #1 + { 0x01, 0x44 }, // (Offset,Value)-Pair #2 + { 0x02, 0x24 }, // (Offset,Value)-Pair #3 + { 0x03, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x04 : mov ecx, [addr] + { 0x04, 0x8B }, // (Offset,Value)-Pair #5 + { 0x05, 0x0D }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x0A : mov [ecx+0x242C], eax + { 0x0A, 0x89 }, // (Offset,Value)-Pair #7 + { 0x0B, 0x81 }, // (Offset,Value)-Pair #8 + { 0x0C, 0x2C }, // (Offset,Value)-Pair #9 + { 0x0D, 0x24 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x10 : retn 0x04 + { 0x10, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x11, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_GetTile +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_GetTile_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_GetTile+0x13 : lea esi, [ecx+eax*8+0x211C] + { 0x13, 0x8D }, // (Offset,Value)-Pair #1 + { 0x14, 0xB4 }, // (Offset,Value)-Pair #2 + { 0x15, 0xC1 }, // (Offset,Value)-Pair #3 + { 0x16, 0x1C }, // (Offset,Value)-Pair #4 + { 0x17, 0x21 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_GetTile+0x1A : mov ecx, 0x06 + { 0x1A, 0xB9 }, // (Offset,Value)-Pair #6 + { 0x1B, 0x06 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_GetTile+0x21 : pop edi; pop esi + { 0x21, 0x5F }, // (Offset,Value)-Pair #8 + { 0x22, 0x5E }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_GetTile+0x23 : retn 0x08 + { 0x23, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x24, 0x08 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetTile +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetTile_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTileNoWait+0x00 : sub esp, 0x18 + { 0x00, 0x83 }, // (Offset,Value)-Pair #1 + { 0x01, 0xEC }, // (Offset,Value)-Pair #2 + { 0x02, 0x18 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetTileNoWait+0x16 : cmp [esi+4], eax + { 0x16, 0x39 }, // (Offset,Value)-Pair #4 + { 0x17, 0x46 }, // (Offset,Value)-Pair #5 + { 0x18, 0x04 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetTileNoWait+0x3D : lea edi, [edx+ecx*8+0x211C] + { 0x3D, 0x8D }, // (Offset,Value)-Pair #7 + { 0x3E, 0xBC }, // (Offset,Value)-Pair #8 + { 0x3F, 0xCB }, // (Offset,Value)-Pair #9 + { 0x40, 0x1C }, // (Offset,Value)-Pair #10 + { 0x41, 0x21 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * D3DDevice_IsBusy +// ****************************************************************** +SOOVPA<7> D3DDevice_IsBusy_1_0_4134 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x05, 0x8B }, + { 0x0C, 0x90 }, + { 0x13, 0x44 }, + { 0x1A, 0xFF }, + { 0x21, 0x01 }, + { 0x28, 0x00 }, + { 0x2F, 0xD2 }, + } +}; + // ****************************************************************** // * D3D8_1_0_4134 // ****************************************************************** @@ -338,6 +2438,36 @@ OOVPATable D3D8_1_0_4134[] = #ifdef _DEBUG_TRACE "EmuIDirect3D8_CreateDevice" #endif + }, + // IDirect3D8::CheckDeviceFormat + { + (OOVPA*)&IDirect3D8_CheckDeviceFormat_1_0_4134, + + XTL::EmuIDirect3D8_CheckDeviceFormat, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_CheckDeviceFormat" + #endif + }, + // IDirect3D8::GetAdapterModeCount + { + (OOVPA*)&IDirect3D8_GetAdapterModeCount_1_0_4134, + + XTL::EmuIDirect3D8_GetAdapterModeCount, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_GetAdapterModeCount" + #endif + }, + // IDirect3D8::EnumAdapterModes + { + (OOVPA*)&IDirect3D8_EnumAdapterModes_1_0_4134, + + XTL::EmuIDirect3D8_EnumAdapterModes, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_EnumAdapterModes" + #endif }, // IDirect3DDevice8::SetRenderState_TexCoordIndex { @@ -465,7 +2595,7 @@ OOVPATable D3D8_1_0_4134[] = #endif }, // IDirect3DDevice8::BlockUntilVerticalBlank - { + /*{ (OOVPA*)&IDirect3DDevice8_BlockUntilVerticalBlank_1_0_3925, XTL::EmuIDirect3DDevice8_BlockUntilVerticalBlank, @@ -473,7 +2603,7 @@ OOVPATable D3D8_1_0_4134[] = #ifdef _DEBUG_TRACE "EmuIDirect3DDevice8_BlockUntilVerticalBlank" #endif - }, + },*/ // IDirect3DDevice8::SetVerticalBlankCallback { (OOVPA*)&IDirect3DDevice8_SetVerticalBlankCallback_1_0_3925, @@ -515,7 +2645,7 @@ OOVPATable D3D8_1_0_4134[] = #endif }, // IDirect3DDevice8::SetPixelShader - { + /*{ (OOVPA*)&IDirect3DDevice8_SetPixelShader_1_0_3925, XTL::EmuIDirect3DDevice8_SetPixelShader, @@ -523,7 +2653,7 @@ OOVPATable D3D8_1_0_4134[] = #ifdef _DEBUG_TRACE "EmuIDirect3DDevice8_SetPixelShader" #endif - }, + },*/ // IDirect3DDevice8::SetIndices { (OOVPA*)&IDirect3DDevice8_SetIndices_1_0_3925, @@ -735,7 +2865,7 @@ OOVPATable D3D8_1_0_4134[] = #endif }, // IDirect3DDevice8::SetRenderState_StencilFail - { + /*{ (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_3925, XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, @@ -743,7 +2873,7 @@ OOVPATable D3D8_1_0_4134[] = #ifdef _DEBUG_TRACE "EmuIDirect3DDevice8_SetRenderState_StencilFail" #endif - }, + },*/ // IDirect3DDevice8::SetRenderState_Simple { (OOVPA*)&IDirect3DDevice8_SetRenderState_Simple_1_0_3925, @@ -765,7 +2895,7 @@ OOVPATable D3D8_1_0_4134[] = #endif }, // IDirect3DDevice8::SetRenderState_FillMode - { + /*{ (OOVPA*)&IDirect3DDevice8_SetRenderState_FillMode_1_0_3925, XTL::EmuIDirect3DDevice8_SetRenderState_FillMode, @@ -773,7 +2903,7 @@ OOVPATable D3D8_1_0_4134[] = #ifdef _DEBUG_TRACE "EmuIDirect3DDevice8_SetRenderState_FillMode" #endif - }, + },*/ // IDirect3DDevice8::SetRenderState_StencilEnable { (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilEnable_1_0_3925, @@ -955,7 +3085,7 @@ OOVPATable D3D8_1_0_4134[] = #endif }, // Get2DSurfacDesc - { + /*{ (OOVPA*)&Get2DSurfaceDesc_1_0_3925, XTL::EmuGet2DSurfaceDesc, @@ -963,7 +3093,7 @@ OOVPATable D3D8_1_0_4134[] = #ifdef _DEBUG_TRACE "EmuGet2DSurfaceDesc" #endif - }, + },*/ // ********************** END WARNING UNTESTED!!! ******************* @@ -998,6 +3128,694 @@ OOVPATable D3D8_1_0_4134[] = "EmuIDirect3DDevice8_SetRenderTarget" #endif }, + // IDirect3DDevice8::CreatePixelShader (* unchanged since 3925 *) + { + (OOVPA*)&IDirect3DDevice8_CreatePixelShader_1_0_3925, + + XTL::EmuIDirect3DDevice8_CreatePixelShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreatePixelShader" + #endif + }, + // IDirect3DSurface8::LockRect (* unchanged since 3925 *) + { + (OOVPA*)&IDirect3DSurface8_LockRect_1_0_3925, + + XTL::EmuIDirect3DSurface8_LockRect, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DSurface8_LockRect" + #endif + }, + // Lock2DSurface (* unchanged since 3925 *) + { + (OOVPA*)&Lock2DSurface_1_0_3925, + + XTL::EmuLock2DSurface, + + #ifdef _DEBUG_TRACE + "EmuLock2DSurface" + #endif + }, + // IDirect3DDevice8_SetGammaRamp (* unchanged since 3925 *) + { + (OOVPA*)&IDirect3DDevice8_SetGammaRamp_1_0_3925, + XTL::EmuIDirect3DDevice8_SetGammaRamp, + + #ifdef _DEBUG_TRACE + "IDirect3DDevice8_SetGammaRamp" + #endif + }, + // IDirect3DDevice8::LoadVertexShader + { + (OOVPA*)&IDirect3DDevice8_LoadVertexShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_LoadVertexShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_LoadVertexShader" + #endif + }, + // IDirect3DDevice8::SelectVertexShader + { + (OOVPA*)&IDirect3DDevice8_SelectVertexShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_SelectVertexShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SelectVertexShader" + #endif + }, + // IDirect3DDevice8::CopyRects + { + (OOVPA*)&IDirect3DDevice8_CopyRects_1_0_4134, + + XTL::EmuIDirect3DDevice8_CopyRects, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CopyRects" + #endif + }, + // IDirect3DDevice8::CreateImageSurface + { + (OOVPA*)&IDirect3DDevice8_CreateImageSurface_1_0_4134, + + XTL::EmuIDirect3DDevice8_CreateImageSurface, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreateImageSurface" + #endif + }, + // IDirect3DDevice8::SetVertexShaderConstant + { + (OOVPA*)&IDirect3DDevice8_SetVertexShaderConstant_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetVertexShaderConstant, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexShaderConstant" + #endif + }, + // IDirect3DDevice8::SetPixelShader + { + (OOVPA*)&IDirect3DDevice8_SetPixelShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetPixelShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetPixelShader" + #endif + }, + // IDirect3DDevice8::SetTextureState_BumpEnv + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_BumpEnv_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetTextureState_BumpEnv, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_BumpEnv" + #endif + }, + // IDirect3DDevice8::SetIndices + { + (OOVPA*)&IDirect3DDevice8_SetIndices_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetIndices, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetIndices" + #endif + }, + // IDirect3DDevice8::SetTexture + { + (OOVPA*)&IDirect3DDevice8_SetTexture_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetTexture, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTexture" + #endif + }, + // IDirect3DDevice8::SetRenderState_VertexBlend + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_VertexBlend_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_VertexBlend, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_VertexBlend" + #endif + }, + // IDirect3DDevice8::SetRenderState_TextureFactor + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_TextureFactor_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_TextureFactor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_TextureFactor" + #endif + }, + // IDirect3DDevice8::SetRenderState_EdgeAntiAlias + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_EdgeAntiAlias_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias" + #endif + }, + // IDirect3DDevice8::SetRenderState_Simple + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_Simple_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_Simple, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_Simple" + #endif + }, + // IDirect3DDevice8::SetRenderState_ZEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_ZEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_ZEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_ZEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_StencilEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleAntiAlias + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias" + #endif + }, + // IDirect3DDevice8::GetTransform + { + (OOVPA*)&IDirect3DDevice8_GetTransform_1_0_4134, + + XTL::EmuIDirect3DDevice8_GetTransform, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetTransform" + #endif + }, + // IDirect3DDevice8::SetStreamSource + { + (OOVPA*)&IDirect3DDevice8_SetStreamSource_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetStreamSource, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetStreamSource" + #endif + }, + // IDirect3DDevice8::SetVertexShader + { + (OOVPA*)&IDirect3DDevice8_SetVertexShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetVertexShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexShader" + #endif + }, + // IDirect3DDevice8::DrawVertices + { + (OOVPA*)&IDirect3DDevice8_DrawVertices_1_0_4134, + + XTL::EmuIDirect3DDevice8_DrawVertices, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawVertices" + #endif + }, + // IDirect3DDevice8::DrawVerticesUP + { + (OOVPA*)&IDirect3DDevice8_DrawVerticesUP_1_0_4134, + + XTL::EmuIDirect3DDevice8_DrawVerticesUP, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawVerticesUP" + #endif + }, + // IDirect3DDevice8::DrawIndexedVertices + { + (OOVPA*)&IDirect3DDevice8_DrawIndexedVertices_1_0_4134, + + XTL::EmuIDirect3DDevice8_DrawIndexedVertices, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawIndexedVertices" + #endif + }, + // IDirect3DDevice8::SetLight + { + (OOVPA*)&IDirect3DDevice8_SetLight_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetLight, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetLight" + #endif + }, + // IDirect3DDevice8::SetMaterial + { + (OOVPA*)&IDirect3DDevice8_SetMaterial_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetMaterial, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetMaterial" + #endif + }, + // IDirect3DDevice8::LightEnable + { + (OOVPA*)&IDirect3DDevice8_LightEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_LightEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_LightEnable" + #endif + }, + // IDirect3DVertexBuffer8::Lock + { + (OOVPA*)&IDirect3DVertexBuffer8_Lock_1_0_4134, + + XTL::EmuIDirect3DVertexBuffer8_Lock, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DVertexBuffer8_Lock" + #endif + }, + // Get2DSurfacDesc + { + (OOVPA*)&Get2DSurfaceDesc_1_0_4134, + + XTL::EmuGet2DSurfaceDesc, + + #ifdef _DEBUG_TRACE + "EmuGet2DSurfaceDesc" + #endif + }, + // IDirect3DSurface8::GetDesc + { + (OOVPA*)&IDirect3DSurface8_GetDesc_1_0_4134, + + XTL::EmuIDirect3DSurface8_GetDesc, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DSurface8_GetDesc" + #endif + }, + // IDirect3DDevice8_SetRenderState_StencilFail + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilFail" + #endif + }, + // IDirect3DDevice8_SetRenderState_NormalizeNormals + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_NormalizeNormals_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_NormalizeNormals, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_NormalizeNormals" + #endif + }, + // IDirect3DDevice8::Reset + { + (OOVPA*)&IDirect3DDevice8_Reset_1_0_4134, + + XTL::EmuIDirect3DDevice8_Reset, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_Reset" + #endif + }, + // IDirect3D8::KickOffAndWaitForIdle + { + (OOVPA*)&IDirect3D8_KickOffAndWaitForIdle_1_0_4134, + + XTL::EmuIDirect3D8_KickOffAndWaitForIdle, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_KickOffAndWaitForIdle" + #endif + }, + // IDirect3DDevice8::SetTextureState_TwoSidedLighting + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting" + #endif + }, + // IDirect3DDevice8::SetRenderState_BackFillMode + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_BackFillMode_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_BackFillMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_BackFillMode" + #endif + }, + // IDirect3DDevice8::SetTextureState_ColorKeyColor + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_ColorKeyColor" + #endif + }, + // IDirect3DDevice8::SetRenderState_FrontFace + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_FrontFace_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_FrontFace, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_FrontFace" + #endif + }, + // IDirect3DDevice8::SetRenderState_LogicOp + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_LogicOp_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_LogicOp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_LogicOp" + #endif + }, + // IDirect3DDevice8::SetRenderState_StencilFail + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilFail" + #endif + }, + // IDirect3DDevice8::SetRenderState_OcclusionCullEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_StencilCullEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilCullEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilCullEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_FillMode + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_FillMode_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_FillMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_FillMode" + #endif + }, + // IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead" + #endif + }, + // IDirect3DDevice8::SetRenderState_RopZRead + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZRead_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_RopZRead" + #endif + }, + // IDirect3DDevice8::SetRenderState_DoNotCullUncompressed + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed" + #endif + }, + // IDirect3DDevice8::SetRenderState_Dxt1NoiseEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_Dxt1NoiseEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_Dxt1NoiseEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleMask + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMask_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMask, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleMask" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleMode + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMode_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleMode" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleRenderTargetMode + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode" + #endif + }, + // IDirect3DDevice8::SetRenderState_ShadowFunc + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" + #endif + }, + // IDirect3DDevice8::SetRenderState_YuvEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_YuvEnable" + #endif + }, + // IDirect3DDevice8::DrawIndexedVerticesUP + { + (OOVPA*)&IDirect3DDevice8_DrawIndexedVerticesUP_1_0_4134, + + XTL::EmuIDirect3DDevice8_DrawIndexedVerticesUP, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawIndexedVerticesUP" + #endif + }, + // IDirect3DDevice8::SetPixelShaderConstant + { + (OOVPA*)&IDirect3DDevice8_SetPixelShaderConstant_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetPixelShaderConstant, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetPixelShaderConstant" + #endif + }, + // IDirect3DDevice8::DeletePixelShader + { + (OOVPA*)&IDirect3DDevice8_DeletePixelShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_DeletePixelShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DeletePixelShader" + #endif + }, + // IDirect3DDevice8::SetRenderState_CullModeB (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_CullModeB_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_CullMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_CullModeB" + #endif + }, + // D3DDevice_DeleteVertexShader (* unchanged since 4134 *) + { + (OOVPA*)&X_D3DDevice_DeleteVertexShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_DeleteVertexShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DeleteVertexShader" + #endif + }, + // IDirect3DDevice8_SetScreenSpaceOffset + { + (OOVPA*)&IDirect3DDevice8_SetScreenSpaceOffset_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetScreenSpaceOffset, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetScreenSpaceOffset" + #endif + }, + // D3D::SetFence (XREF) (* unchanged since 4134 *) + { + (OOVPA*)&D3D_SetFence_1_0_4134, 0, + + #ifdef _DEBUG_TRACE + "D3D::SetFence (XREF)" + #endif + }, + // IDirect3DDevice8::SetRenderState_LineWidth + { + (OOVPA*)&D3DDevice_SetRenderState_LineWidth_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_LineWidth, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_LineWidth" + #endif + }, + + // IDirect3DDevice8::GetGammaRamp (* unchanged since 4034 *) + { + (OOVPA*)&IDirect3DDevice8_GetGammaRamp_1_0_4034, + + XTL::EmuIDirect3DDevice8_GetGammaRamp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetGammaRamp" + #endif + }, + // IDirect3DDevice8::BlockUntilVerticalBlank + { + (OOVPA*)&IDirect3DDevice8_BlockUntilVerticalBlank_1_0_4134, + + XTL::EmuIDirect3DDevice8_BlockUntilVerticalBlank, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_BlockUntilVerticalBlank" + #endif + }, + // IDirect3DDevice8::SetSwapCallback + { + (OOVPA*)&IDirect3DDevice8_SetSwapCallback_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetSwapCallback, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetSwapCallback" + #endif + }, + // IDirect3DDevice8::GetTile + { + (OOVPA*)&IDirect3DDevice8_GetTile_1_0_4134, + + XTL::EmuIDirect3DDevice8_GetTile, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetTile" + #endif + }, + // IDirect3DDevice8::SetTile + { + (OOVPA*)&IDirect3DDevice8_SetTile_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetTileNoWait, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTile" + #endif + }, + // IDirect3DDevice8::IsBusy + { + (OOVPA*)&D3DDevice_IsBusy_1_0_4134, + + XTL::EmuIDirect3DDevice8_IsBusy, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_IsBusy" + #endif + }, + // D3DDevice_GetVertexShaderSize (* unchanged since 3925 *) + { + (OOVPA*)&X_D3DDevice_GetVertexShaderSize_1_0_3925, + + XTL::EmuIDirect3DDevice8_GetVertexShaderSize, + + #ifdef _DEBUG_TRACE + "D3DDevice_GetVertexShaderSize" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4361.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4361.inl index e838a5ee0..91446683d 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4361.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4361.inl @@ -1930,6 +1930,280 @@ SOOVPA<12> IDirect3DDevice8_SetPalette_1_0_4361 = } }; + +// ****************************************************************** +// * IDirect3DDevice8_SetShaderConstantMode +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetShaderConstantMode_1_0_4361 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetShaderConstantMode+0x26 : mov [ebx+0x20D8], eax + { 0x26, 0x89 }, // (Offset,Value)-Pair #1 + { 0x27, 0x83 }, // (Offset,Value)-Pair #2 + { 0x28, 0x18 }, // (Offset,Value)-Pair #3 + { 0x29, 0x20 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetShaderConstantMode+0x50 : mov dword ptr [eax+0x04], 0x3C + { 0x50, 0xC7 }, // (Offset,Value)-Pair #5 + { 0x51, 0x40 }, // (Offset,Value)-Pair #6 + { 0x52, 0x04 }, // (Offset,Value)-Pair #7 + { 0x53, 0x3C }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetShaderConstantMode+0xE7 : add esi, 0x0124 + { 0xE7, 0x81 }, // (Offset,Value)-Pair #9 + { 0xE8, 0xC6 }, // (Offset,Value)-Pair #10 + { 0xE9, 0x24 }, // (Offset,Value)-Pair #11 + { 0xEA, 0x01 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetFlickerFilter +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetFlickerFilter_1_0_4361 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetFlickerFilter+0x1C : mov eax, [eax+0x2268] + { 0x1D, 0x80 }, // (Offset,Value)-Pair #2 + { 0x1E, 0x7C }, // (Offset,Value)-Pair #3 + { 0x1F, 0x22 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetFlickerFilter+0x22 : push 0; push esi; push 0x0B; push eax + { 0x22, 0x6A }, // (Offset,Value)-Pair #5 + { 0x23, 0x00 }, // (Offset,Value)-Pair #6 + { 0x24, 0x56 }, // (Offset,Value)-Pair #7 + { 0x25, 0x6A }, // (Offset,Value)-Pair #8 + { 0x26, 0x0B }, // (Offset,Value)-Pair #9 + { 0x27, 0x50 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetFlickerFilter+0x3F : retn 0x04 + { 0x3F, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x40, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetFlickerFilter +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetSoftDisplayFilter_1_0_4361 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetSoftDisplayFilter+0x25 : mov edx, [eax+0x2268] + { 0x25, 0x8B }, // (Offset,Value)-Pair #1 + { 0x26, 0x90 }, // (Offset,Value)-Pair #2 + { 0x27, 0x68 }, // (Offset,Value)-Pair #3 + { 0x28, 0x22 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetSoftDisplayFilter+0x2B : push 0; push esi; push 0x0E; push edx + { 0x2B, 0x6A }, // (Offset,Value)-Pair #5 + { 0x2C, 0x00 }, // (Offset,Value)-Pair #6 + { 0x2D, 0x56 }, // (Offset,Value)-Pair #7 + { 0x2E, 0x6A }, // (Offset,Value)-Pair #8 + { 0x2F, 0x0E }, // (Offset,Value)-Pair #9 + { 0x30, 0x52 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetSoftDisplayFilter+0x4E : retn 0x04 + { 0x4E, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x4F, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * D3DDevice_PrimeVertexCache +// ****************************************************************** +SOOVPA<7> D3DDevice_PrimeVertexCache_1_0_4361 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0E, 0xE8 }, + { 0x1E, 0xEE }, + { 0x2E, 0xC1 }, + { 0x3E, 0x24 }, + { 0x4E, 0x8B }, + { 0x5E, 0x04 }, + { 0x6E, 0x04 }, + } +}; + +// ****************************************************************** +// * D3DDevice_BeginPush +// ****************************************************************** +SOOVPA<7> D3DDevice_BeginPush_1_0_4361 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0x6A }, + { 0x08, 0x00 }, + { 0x10, 0x8B }, + { 0x12, 0x24 }, + { 0x17, 0xE8 }, + { 0x1C, 0x8B }, + { 0x21, 0x01 }, + } +}; + +// ****************************************************************** +// * D3DDevice_EndPush +// ****************************************************************** +SOOVPA<8> D3DDevice_EndPush_1_0_4361 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x00, 0x8B }, + { 0x02, 0x24 }, + { 0x04, 0x8B }, + { 0x0A, 0x89 }, + { 0x0B, 0x01 }, + { 0x0C, 0xC2 }, + { 0x0D, 0x04 }, + { 0x0E, 0x00 }, + } +}; + +// ****************************************************************** +// * D3DDevice_Begin +// ****************************************************************** +SOOVPA<7> D3DDevice_Begin_1_0_4361 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0xE8 }, + { 0x0C, 0x8B }, + { 0x13, 0xE8 }, + { 0x1A, 0x24 }, + { 0x21, 0x00 }, + { 0x28, 0x89 }, + { 0x2F, 0x00 }, + } +}; + +// ****************************************************************** +// * D3DDevice_End +// ****************************************************************** +SOOVPA<7> D3DDevice_End_1_0_4361 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0x8B }, + { 0x0E, 0xE8 }, + { 0x16, 0x17 }, + { 0x1E, 0x00 }, + { 0x26, 0x46 }, + { 0x2E, 0x01 }, + { 0x36, 0x08 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetVertexData2f +// ****************************************************************** +SOOVPA<8> D3DDevice_SetVertexData2f_1_0_4361 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0x8B }, + { 0x0C, 0x72 }, + { 0x13, 0x8B }, + { 0x1A, 0x80 }, + { 0x21, 0x0C }, + { 0x28, 0x89 }, + { 0x2F, 0xC0 }, + { 0x36, 0x00 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetVertexData4f +// ****************************************************************** +SOOVPA<7> D3DDevice_SetVertexData4f_1_0_4361 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0A, 0x46 }, + { 0x16, 0x08 }, + { 0x22, 0x09 }, + { 0x2E, 0x24 }, + { 0x3A, 0x24 }, + { 0x46, 0x8B }, + { 0x52, 0x14 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetVertexData4ub +// ****************************************************************** +SOOVPA<7> D3DDevice_SetVertexData4ub_1_0_4361 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x08, 0x06 }, + { 0x13, 0x8B }, + { 0x1C, 0x04 }, + { 0x26, 0x0F }, + { 0x30, 0x24 }, + { 0x3A, 0x24 }, + { 0x44, 0x89 }, + } +}; + // ****************************************************************** // * D3D8_1_0_4361 // ****************************************************************** @@ -2743,6 +3017,441 @@ OOVPATable D3D8_1_0_4361[] = "EmuIDirect3DDevice8_SetPalette" #endif }, + // IDirect3DDevice8::Reset (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_Reset_1_0_4134, + + XTL::EmuIDirect3DDevice8_Reset, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_Reset" + #endif + }, + // IDirect3D8::KickOffAndWaitForIdle (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3D8_KickOffAndWaitForIdle_1_0_4134, + + XTL::EmuIDirect3D8_KickOffAndWaitForIdle, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_KickOffAndWaitForIdle" + #endif + }, + // IDirect3DDevice8::SetTextureState_TwoSidedLighting (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting" + #endif + }, + // IDirect3DDevice8::SetRenderState_BackFillMode (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_BackFillMode_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_BackFillMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_BackFillMode" + #endif + }, + // IDirect3DDevice8::SetTextureState_ColorKeyColor (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_ColorKeyColor" + #endif + }, + // IDirect3DDevice8::SetRenderState_FrontFace (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_FrontFace_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_FrontFace, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_FrontFace" + #endif + }, + // IDirect3DDevice8::SetRenderState_LogicOp (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_LogicOp_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_LogicOp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_LogicOp" + #endif + }, + // IDirect3DDevice8::SetRenderState_StencilFail (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilFail" + #endif + }, + // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_StencilCullEnable (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilCullEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilCullEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead" + #endif + }, + // IDirect3DDevice8::SetRenderState_RopZRead (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZRead_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_RopZRead" + #endif + }, + // IDirect3DDevice8::SetRenderState_DoNotCullUncompressed (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed" + #endif + }, + // IDirect3DDevice8::SetRenderState_Dxt1NoiseEnable (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_Dxt1NoiseEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_Dxt1NoiseEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleMask (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMask_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMask, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleMask" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleMode (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMode_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleMode" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleRenderTargetMode (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode" + #endif + }, + // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" + #endif + }, + // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_YuvEnable" + #endif + }, + // IDirect3DDevice8::DrawIndexedVerticesUP (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_DrawIndexedVerticesUP_1_0_4134, + + XTL::EmuIDirect3DDevice8_DrawIndexedVerticesUP, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawIndexedVerticesUP" + #endif + }, + // IDirect3DDevice8::SetPixelShaderConstant (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetPixelShaderConstant_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetPixelShaderConstant, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetPixelShaderConstant" + #endif + }, + // IDirect3DDevice8::DeletePixelShader (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_DeletePixelShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_DeletePixelShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DeletePixelShader" + #endif + }, + // IDirect3DDevice8::SetRenderState_CullModeB (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_CullModeB_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_CullMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_CullModeB" + #endif + }, + // D3DDevice_DeleteVertexShader (* unchanged since 4134 *) + { + (OOVPA*)&X_D3DDevice_DeleteVertexShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_DeleteVertexShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DeleteVertexShader" + #endif + }, + // IDirect3DDevice8_SetScreenSpaceOffset (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetScreenSpaceOffset_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetScreenSpaceOffset, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetScreenSpaceOffset" + #endif + }, + // D3D::SetFence (XREF) (* unchanged since 4134 *) + { + (OOVPA*)&D3D_SetFence_1_0_4134, 0, + + #ifdef _DEBUG_TRACE + "D3D::SetFence (XREF)" + #endif + }, + // IDirect3DDevice8::SetRenderState_LineWidth (* unchanged since 4134 *) + { + (OOVPA*)&D3DDevice_SetRenderState_LineWidth_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_LineWidth, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_LineWidth" + #endif + }, + // IDirect3DDevice8::SetSwapCallback (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetSwapCallback_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetSwapCallback, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetSwapCallback" + #endif + }, + // IDirect3DDevice8::GetTile (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_GetTile_1_0_4134, + + XTL::EmuIDirect3DDevice8_GetTile, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetTile" + #endif + }, + // IDirect3DDevice8::SetTile (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetTile_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetTileNoWait, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTile" + #endif + }, + // IDirect3DDevice8::IsBusy (* unchanged since 4134 *) + { + (OOVPA*)&D3DDevice_IsBusy_1_0_4134, + + XTL::EmuIDirect3DDevice8_IsBusy, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_IsBusy" + #endif + }, + // IDirect3DDevice8::GetGammaRamp (* unchanged since 4034 *) + { + (OOVPA*)&IDirect3DDevice8_GetGammaRamp_1_0_4034, + + XTL::EmuIDirect3DDevice8_GetGammaRamp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetGammaRamp" + #endif + }, + // IDirect3DDevice8::SetShaderConstantMode + { + (OOVPA*)&IDirect3DDevice8_SetShaderConstantMode_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetShaderConstantMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetShaderConstantMode" + #endif + }, + // IDirect3DDevice8::SetFlickerFilter + { + (OOVPA*)&IDirect3DDevice8_SetFlickerFilter_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetFlickerFilter, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetFlickerFilter" + #endif + }, + // IDirect3DDevice8::SetSoftDisplayFilter + { + (OOVPA*)&IDirect3DDevice8_SetSoftDisplayFilter_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetSoftDisplayFilter, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetSoftDisplayFilter" + #endif + }, + // D3DDevice_PrimeVertexCache + { + (OOVPA*)&D3DDevice_PrimeVertexCache_1_0_4361, + XTL::EmuIDirect3DDevice8_PrimeVertexCache, + + #ifdef _DEBUG_TRACE + "D3DDevice_PrimeVertexCache" + #endif + }, + // D3DDevice_BeginPush + { + (OOVPA*)&D3DDevice_BeginPush_1_0_4361, + XTL::EmuIDirect3DDevice8_BeginPush, + + #ifdef _DEBUG_TRACE + "D3DDevice_BeginPush" + #endif + }, + // D3DDevice_EndPush + { + (OOVPA*)&D3DDevice_EndPush_1_0_4361, + XTL::EmuIDirect3DDevice8_EndPush, + + #ifdef _DEBUG_TRACE + "D3DDevice_EndPush" + #endif + }, + // IDirect3DDevice8::Begin + { + (OOVPA*)&D3DDevice_Begin_1_0_4361, + + XTL::EmuIDirect3DDevice8_Begin, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_Begin" + #endif + }, + // IDirect3DDevice8::End + { + (OOVPA*)&D3DDevice_End_1_0_4361, + + XTL::EmuIDirect3DDevice8_End, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_End" + #endif + }, + // IDirect3DDevice8::SetVertexData2f + { + (OOVPA*)&D3DDevice_SetVertexData2f_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetVertexData2f, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData2f" + #endif + }, + // IDirect3DDevice8::SetVertexData4f + { + (OOVPA*)&D3DDevice_SetVertexData4f_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetVertexData4f, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData4f" + #endif + }, + // IDirect3DDevice8::SetVertexData4ub + { + (OOVPA*)&D3DDevice_SetVertexData4ub_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetVertexData4ub, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData4ub" + #endif + }, + // D3DDevice_GetVertexShaderSize (* unchanged since 3925 *) + { + (OOVPA*)&X_D3DDevice_GetVertexShaderSize_1_0_3925, + + XTL::EmuIDirect3DDevice8_GetVertexShaderSize, + + #ifdef _DEBUG_TRACE + "D3DDevice_GetVertexShaderSize" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4432.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4432.inl index 722adc5db..9f6cc02ce 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4432.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4432.inl @@ -62,38 +62,6 @@ SOOVPA<8> IDirect3D8_CreateDevice_1_0_4432 = } }; -// ****************************************************************** -// * IDirect3DDevice8_Reset -// ****************************************************************** -SOOVPA<10> IDirect3DDevice8_Reset_1_0_4432 = -{ - 0, // Large == 0 - 10, // Count == 10 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_Reset+0x15 : mov ecx, ebp - { 0x15, 0x8B }, // (Offset,Value)-Pair #1 - { 0x16, 0xCD }, // (Offset,Value)-Pair #2 - - // IDirect3DDevice8_Reset+0x1E : jnz +0xF5 - { 0x1E, 0x75 }, // (Offset,Value)-Pair #3 - { 0x1F, 0xF5 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_Reset+0x27 : mov esi, [esp+0x14] - { 0x27, 0x8B }, // (Offset,Value)-Pair #5 - { 0x28, 0x74 }, // (Offset,Value)-Pair #6 - { 0x29, 0x24 }, // (Offset,Value)-Pair #7 - { 0x2A, 0x14 }, // (Offset,Value)-Pair #8 - - // IDirect3DDevice8_Reset+0x37 : jge +0x10 - { 0x37, 0x7D }, // (Offset,Value)-Pair #9 - { 0x38, 0x10 }, // (Offset,Value)-Pair #10 - } -}; - // ****************************************************************** // * IDirect3DDevice8_GetRenderTarget // ****************************************************************** @@ -200,41 +168,6 @@ SOOVPA<10> IDirect3DDevice8_SetPixelShader_1_0_4432 = } }; -// ****************************************************************** -// * IDirect3D8_KickOffAndWaitForIdle -// ****************************************************************** -SOOVPA<9> IDirect3D8_KickOffAndWaitForIdle_1_0_4432 = -{ - 0, // Large == 0 - 9, // Count == 9 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3D8_KickOffAndWaitForIdle+0x00 : mov eax, [addr] - { 0x00, 0xA1 }, // (Offset,Value)-Pair #1 - - // IDirect3D8_KickOffAndWaitForIdle+0x05 : mov ecx, [eax+0x30] - { 0x05, 0x8B }, // (Offset,Value)-Pair #2 - { 0x06, 0x48 }, // (Offset,Value)-Pair #3 - { 0x07, 0x30 }, // (Offset,Value)-Pair #4 - - // IDirect3D8_KickOffAndWaitForIdle+0x08 : push 0 - { 0x08, 0x6A }, // (Offset,Value)-Pair #5 - { 0x09, 0x00 }, // (Offset,Value)-Pair #6 - - // IDirect3D8_KickOffAndWaitForIdle+0x0A : push ecx - { 0x0A, 0x51 }, // (Offset,Value)-Pair #7 - - // IDirect3D8_KickOffAndWaitForIdle+0x0B : call [addr] - { 0x0B, 0xE8 }, // (Offset,Value)-Pair #8 - - // IDirect3D8_KickOffAndWaitForIdle+0x10 : retn - { 0x10, 0xC3 }, // (Offset,Value)-Pair #9 - } -}; - // ****************************************************************** // * IDirect3DDevice8_SetTextureState_TwoSidedLighting // ****************************************************************** @@ -270,41 +203,6 @@ SOOVPA<13> IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4432 = } }; -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_BackFillMode -// ****************************************************************** -SOOVPA<13> IDirect3DDevice8_SetRenderState_BackFillMode_1_0_4432 = -{ - 0, // Large == 0 - 13, // Count == 13 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_BackFillMode+0x1C : jb +0x05 - { 0x1C, 0x72 }, // (Offset,Value)-Pair #1 - { 0x1D, 0x05 }, // (Offset,Value)-Pair #2 - - // IDirect3DDevice8_SetRenderState_BackFillMode+0x35 : mov dword ptr [eax], abs - { 0x35, 0xC7 }, // (Offset,Value)-Pair #3 - { 0x36, 0x00 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_SetRenderState_BackFillMode+0x3B : add eax, 0x0C; mov [esi], eax; mov [abs], edi - { 0x41, 0x83 }, // (Offset,Value)-Pair #5 - { 0x42, 0xC0 }, // (Offset,Value)-Pair #6 - { 0x43, 0x0C }, // (Offset,Value)-Pair #7 - { 0x44, 0x89 }, // (Offset,Value)-Pair #8 - { 0x45, 0x06 }, // (Offset,Value)-Pair #9 - { 0x46, 0x89 }, // (Offset,Value)-Pair #10 - { 0x47, 0x3D }, // (Offset,Value)-Pair #11 - - // IDirect3DDevice8_SetRenderState_BackFillMode+0x4E : retn 0x04 - { 0x4E, 0xC2 }, // (Offset,Value)-Pair #12 - { 0x4F, 0x04 }, // (Offset,Value)-Pair #13 - } -}; - // ****************************************************************** // * IDirect3DDevice8_SetTextureState_ColorKeyColor // ****************************************************************** @@ -337,39 +235,6 @@ SOOVPA<12> IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4432 = } }; -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_FrontFace -// ****************************************************************** -SOOVPA<11> IDirect3DDevice8_SetRenderState_FrontFace_1_0_4432 = -{ - 0, // Large == 0 - 11, // Count == 11 - - -1, // XRef Not Saved - 1, // XRef Is Used - - { - // IDirect3DDevice8_SetRenderState_FrontFace+0x36 : jmp IDirect3DDevice8_SetRenderState_CullMode - { 0x36, XREF_DXSRSCULLMODE}, // (Offset,Value)-Pair #1 - - // IDirect3DDevice8_SetRenderState_FrontFace+0x09 : cmp eax, [esi+4] - { 0x09, 0x3B }, // (Offset,Value)-Pair #2 - { 0x0A, 0x46 }, // (Offset,Value)-Pair #3 - { 0x0B, 0x04 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_SetRenderState_FrontFace+0x13 : mov ecx, [esp+0x08] - { 0x13, 0x8B }, // (Offset,Value)-Pair #5 - { 0x14, 0x4C }, // (Offset,Value)-Pair #6 - { 0x15, 0x24 }, // (Offset,Value)-Pair #7 - { 0x16, 0x08 }, // (Offset,Value)-Pair #8 - - // IDirect3DDevice8_SetRenderState_FrontFace+0x20 : add eax, 8 - { 0x20, 0x83 }, // (Offset,Value)-Pair #9 - { 0x21, 0xC0 }, // (Offset,Value)-Pair #10 - { 0x22, 0x08 }, // (Offset,Value)-Pair #11 - } -}; - // ****************************************************************** // * IDirect3DDevice8_SetRenderState_NormalizeNormals // ****************************************************************** @@ -398,64 +263,6 @@ SOOVPA<8> IDirect3DDevice8_SetRenderState_NormalizeNormals_1_0_4432 = } }; -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_LogicOp -// ****************************************************************** -SOOVPA<9> IDirect3DDevice8_SetRenderState_LogicOp_1_0_4432 = -{ - 0, // Large == 0 - 9, // Count == 9 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_LogicOp+0x07 : mov eax, [esi] - { 0x07, 0x8B }, // (Offset,Value)-Pair #1 - { 0x08, 0x06 }, // (Offset,Value)-Pair #2 - - // IDirect3DDevice8_SetRenderState_LogicOp+0x1B : mov dword ptr [eax], 0x417BC - { 0x1B, 0xC7 }, // (Offset,Value)-Pair #3 - { 0x1C, 0x00 }, // (Offset,Value)-Pair #4 - { 0x1D, 0xBC }, // (Offset,Value)-Pair #5 - { 0x1E, 0x17 }, // (Offset,Value)-Pair #6 - { 0x1F, 0x04 }, // (Offset,Value)-Pair #7 - - // IDirect3DDevice8_SetRenderState_LogicOp+0x4F : retn 0x04 - { 0x4F, 0xC2 }, // (Offset,Value)-Pair #8 - { 0x50, 0x04 }, // (Offset,Value)-Pair #9 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable -// ****************************************************************** -SOOVPA<9> IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable_1_0_4432 = -{ - 0, // Large == 0 - 9, // Count == 9 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable+0x0C : mov eax, [edi+0x2070] - { 0x0C, 0x8B }, // (Offset,Value)-Pair #1 - { 0x0D, 0x86 }, // (Offset,Value)-Pair #2 - { 0x0E, 0x70 }, // (Offset,Value)-Pair #3 - { 0x0F, 0x20 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable+0x6E : add eax, 0x18 - { 0x6E, 0x83 }, // (Offset,Value)-Pair #5 - { 0x6F, 0xC0 }, // (Offset,Value)-Pair #6 - { 0x70, 0x18 }, // (Offset,Value)-Pair #7 - - // IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable+0x7C : retn 0x04 - { 0x7C, 0xC2 }, // (Offset,Value)-Pair #8 - { 0x7D, 0x04 }, // (Offset,Value)-Pair #9 - } -}; - // ****************************************************************** // * IDirect3DDevice8_SetRenderState_ZEnable // ****************************************************************** @@ -524,109 +331,6 @@ SOOVPA<9> IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias_1_0_4432 = } }; -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_MultiSampleMask -// ****************************************************************** -SOOVPA<13> IDirect3DDevice8_SetRenderState_MultiSampleMask_1_0_4432 = -{ - 0, // Large == 0 - 13, // Count == 13 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x1C : jb +0x05 - { 0x1C, 0x72 }, // (Offset,Value)-Pair #1 - { 0x1D, 0x05 }, // (Offset,Value)-Pair #2 - - // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x38 : and ecx, 0x0F; shl edx, 0x10 - { 0x38, 0x83 }, // (Offset,Value)-Pair #3 - { 0x39, 0xE1 }, // (Offset,Value)-Pair #4 - { 0x3A, 0x0F }, // (Offset,Value)-Pair #5 - { 0x3B, 0xC1 }, // (Offset,Value)-Pair #6 - - // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x3E : mov dword ptr [eax], 0x41D7C - { 0x3E, 0xC7 }, // (Offset,Value)-Pair #7 - { 0x3F, 0x00 }, // (Offset,Value)-Pair #8 - { 0x40, 0x7C }, // (Offset,Value)-Pair #9 - { 0x41, 0x1D }, // (Offset,Value)-Pair #10 - { 0x42, 0x04 }, // (Offset,Value)-Pair #11 - - // IDirect3DDevice8_SetRenderState_MultiSampleMask+0x4F : retn 0x04 - { 0x4F, 0xC2 }, // (Offset,Value)-Pair #12 - { 0x50, 0x04 }, // (Offset,Value)-Pair #13 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_MultiSampleMode -// ****************************************************************** -SOOVPA<12> IDirect3DDevice8_SetRenderState_MultiSampleMode_1_0_4432 = -{ - 0, // Large == 0 - 12, // Count == 12 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x0F : mov ecx, [eax+0x2070] - { 0x0F, 0x8B }, // (Offset,Value)-Pair #1 - { 0x10, 0x88 }, // (Offset,Value)-Pair #2 - { 0x11, 0x70 }, // (Offset,Value)-Pair #3 - { 0x12, 0x20 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x15 : cmp ecx, [eax+0x207C] - { 0x15, 0x3B }, // (Offset,Value)-Pair #5 - { 0x16, 0x88 }, // (Offset,Value)-Pair #6 - { 0x17, 0x7C }, // (Offset,Value)-Pair #7 - { 0x18, 0x20 }, // (Offset,Value)-Pair #8 - - // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x1B : jnz +0x0D - { 0x1B, 0x75 }, // (Offset,Value)-Pair #9 - { 0x1C, 0x0D }, // (Offset,Value)-Pair #10 - - // IDirect3DDevice8_SetRenderState_MultiSampleMode+0x2A : retn 0x04 - { 0x2A, 0xC2 }, // (Offset,Value)-Pair #11 - { 0x2B, 0x04 }, // (Offset,Value)-Pair #12 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode -// ****************************************************************** -SOOVPA<12> IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode_1_0_4432 = -{ - 0, // Large == 0 - 12, // Count == 12 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode+0x0F : mov ecx, [eax+0x2070] - { 0x0F, 0x8B }, // (Offset,Value)-Pair #1 - { 0x10, 0x88 }, // (Offset,Value)-Pair #2 - { 0x11, 0x70 }, // (Offset,Value)-Pair #3 - { 0x12, 0x20 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode+0x15 : cmp ecx, [eax+0x207C] - { 0x15, 0x3B }, // (Offset,Value)-Pair #5 - { 0x16, 0x88 }, // (Offset,Value)-Pair #6 - { 0x17, 0x7C }, // (Offset,Value)-Pair #7 - { 0x18, 0x20 }, // (Offset,Value)-Pair #8 - - // IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode+0x1B : jz +0x0D - { 0x1B, 0x74 }, // (Offset,Value)-Pair #9 - { 0x1C, 0x0D }, // (Offset,Value)-Pair #10 - - // IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode+0x2A : retn 0x04 - { 0x2A, 0xC2 }, // (Offset,Value)-Pair #11 - { 0x2B, 0x04 }, // (Offset,Value)-Pair #12 - } -}; - // ****************************************************************** // * IDirect3DDevice8_SetRenderState_LineWidth // ****************************************************************** @@ -659,278 +363,6 @@ SOOVPA<10> IDirect3DDevice8_SetRenderState_LineWidth_1_0_4432 = } }; -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_StencilFail -// ****************************************************************** -SOOVPA<12> IDirect3DDevice8_SetRenderState_StencilFail_1_0_4432 = -{ - 0, // Large == 0 - 12, // Count == 12 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_StencilFail+0x0C : jb +0x05 - { 0x0C, 0x72 }, // (Offset,Value)-Pair #1 - { 0x0D, 0x05 }, // (Offset,Value)-Pair #2 - - // IDirect3DDevice8_SetRenderState_StencilFail+0x38 : cmp [abs], 0x1E00 - { 0x38, 0x81 }, // (Offset,Value)-Pair #3 - { 0x3E, 0x00 }, // (Offset,Value)-Pair #4 - { 0x3F, 0x1E }, // (Offset,Value)-Pair #5 - - // IDirect3DDevice8_SetRenderState_StencilFail+0x47 : mov dword ptr [eax], 0x41D84 - { 0x47, 0xC7 }, // (Offset,Value)-Pair #6 - { 0x48, 0x00 }, // (Offset,Value)-Pair #7 - { 0x49, 0x84 }, // (Offset,Value)-Pair #8 - { 0x4A, 0x1D }, // (Offset,Value)-Pair #9 - { 0x4B, 0x04 }, // (Offset,Value)-Pair #10 - - // IDirect3DDevice8_SetRenderState_StencilFail+0x6A : retn 0x04 - { 0x6A, 0xC2 }, // (Offset,Value)-Pair #11 - { 0x6B, 0x04 }, // (Offset,Value)-Pair #12 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_OcclusionCullEnable -// ****************************************************************** -SOOVPA<12> IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4432 = -{ - 0, // Large == 0 - 12, // Count == 12 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x15 : jb +0x05 - { 0x15, 0x72 }, // (Offset,Value)-Pair #1 - { 0x16, 0x05 }, // (Offset,Value)-Pair #2 - - // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x41 : cmp [abs], 0x1E00 - { 0x41, 0x81 }, // (Offset,Value)-Pair #3 - { 0x47, 0x00 }, // (Offset,Value)-Pair #4 - { 0x48, 0x1E }, // (Offset,Value)-Pair #5 - - // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x50 : mov dword ptr [eax], 0x41D84 - { 0x50, 0xC7 }, // (Offset,Value)-Pair #6 - { 0x51, 0x00 }, // (Offset,Value)-Pair #7 - { 0x52, 0x84 }, // (Offset,Value)-Pair #8 - { 0x53, 0x1D }, // (Offset,Value)-Pair #9 - { 0x54, 0x04 }, // (Offset,Value)-Pair #10 - - // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x5F : retn 0x04 - { 0x5F, 0xC2 }, // (Offset,Value)-Pair #11 - { 0x60, 0x04 }, // (Offset,Value)-Pair #12 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_StencilCullEnable -// ****************************************************************** -SOOVPA<13> IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4432 = -{ - 0, // Large == 0 - 13, // Count == 13 - - -1, // XRef Not Saved - 1, // XRef Is Used - - { - // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x0C : D3D__RenderState[D3DRS_STENCILCULLENABLE] - { 0x0C, XREF_D3DRS_STENCILCULLENABLE }, // (Offset,Value)-Pair #1 - - // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x15 : jb +0x05 - { 0x15, 0x72 }, // (Offset,Value)-Pair #2 - { 0x16, 0x05 }, // (Offset,Value)-Pair #3 - - // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x41 : cmp [abs], 0x1E00 - { 0x41, 0x81 }, // (Offset,Value)-Pair #4 - { 0x47, 0x00 }, // (Offset,Value)-Pair #5 - { 0x48, 0x1E }, // (Offset,Value)-Pair #6 - - // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x50 : mov dword ptr [eax], 0x41D84 - { 0x50, 0xC7 }, // (Offset,Value)-Pair #7 - { 0x51, 0x00 }, // (Offset,Value)-Pair #8 - { 0x52, 0x84 }, // (Offset,Value)-Pair #9 - { 0x53, 0x1D }, // (Offset,Value)-Pair #10 - { 0x54, 0x04 }, // (Offset,Value)-Pair #11 - - // IDirect3DDevice8_SetRenderState_StencilCullEnable+0x5F : retn 0x04 - { 0x5F, 0xC2 }, // (Offset,Value)-Pair #12 - { 0x60, 0x04 }, // (Offset,Value)-Pair #13 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead -// ****************************************************************** -SOOVPA<9> IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_4432 = -{ - 0, // Large == 0 - 9, // Count == 9 - - -1, // XRef Not Saved - 1, // XRef Is Used - - { - // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x05 : D3D__RenderState[D3DRS_ROPZCMPALWAYSREAD] - { 0x05, XREF_D3DRS_ROPZCMPALWAYSREAD }, // (Offset,Value)-Pair #1 - - // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x00 : mov eax, [esp+0x04] - { 0x00, 0x8B }, // (Offset,Value)-Pair #2 - { 0x01, 0x44 }, // (Offset,Value)-Pair #3 - { 0x02, 0x24 }, // (Offset,Value)-Pair #4 - { 0x03, 0x04 }, // (Offset,Value)-Pair #5 - - // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x09 : call [abs] - { 0x09, 0xE8 }, // (Offset,Value)-Pair #6 - - // IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead+0x0E : retn 0x04 - { 0x0E, 0xC2 }, // (Offset,Value)-Pair #7 - { 0x0F, 0x04 }, // (Offset,Value)-Pair #8 - { 0x10, 0x00 }, // (Offset,Value)-Pair #9 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_RopZRead -// ****************************************************************** -SOOVPA<9> IDirect3DDevice8_SetRenderState_RopZRead_1_0_4432 = -{ - 0, // Large == 0 - 9, // Count == 9 - - -1, // XRef Not Saved - 1, // XRef Is Used - - { - // IDirect3DDevice8_SetRenderState_RopZRead+0x05 : D3D__RenderState[D3DRS_ROPZCMPALWAYSREAD] - { 0x05, XREF_D3DRS_ROPZREAD }, // (Offset,Value)-Pair #1 - - // IDirect3DDevice8_SetRenderState_RopZRead+0x00 : mov eax, [esp+0x04] - { 0x00, 0x8B }, // (Offset,Value)-Pair #2 - { 0x01, 0x44 }, // (Offset,Value)-Pair #3 - { 0x02, 0x24 }, // (Offset,Value)-Pair #4 - { 0x03, 0x04 }, // (Offset,Value)-Pair #5 - - // IDirect3DDevice8_SetRenderState_RopZRead+0x09 : call [abs] - { 0x09, 0xE8 }, // (Offset,Value)-Pair #6 - - // IDirect3DDevice8_SetRenderState_RopZRead+0x0E : retn 0x04 - { 0x0E, 0xC2 }, // (Offset,Value)-Pair #7 - { 0x0F, 0x04 }, // (Offset,Value)-Pair #8 - { 0x10, 0x00 }, // (Offset,Value)-Pair #9 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_DoNotCullUncompressed -// ****************************************************************** -SOOVPA<9> IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4432 = -{ - 0, // Large == 0 - 9, // Count == 9 - - -1, // XRef Not Saved - 1, // XRef Is Used - - { - // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x05 : D3D__RenderState[D3DRS_ROPZCMPALWAYSREAD] - { 0x05, XREF_D3DRS_DONOTCULLUNCOMPRESSED }, // (Offset,Value)-Pair #1 - - // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x00 : mov eax, [esp+0x04] - { 0x00, 0x8B }, // (Offset,Value)-Pair #2 - { 0x01, 0x44 }, // (Offset,Value)-Pair #3 - { 0x02, 0x24 }, // (Offset,Value)-Pair #4 - { 0x03, 0x04 }, // (Offset,Value)-Pair #5 - - // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x09 : call [abs] - { 0x09, 0xE8 }, // (Offset,Value)-Pair #6 - - // IDirect3DDevice8_SetRenderState_DoNotCullUncompressed+0x0E : retn 0x04 - { 0x0E, 0xC2 }, // (Offset,Value)-Pair #7 - { 0x0F, 0x04 }, // (Offset,Value)-Pair #8 - { 0x10, 0x00 }, // (Offset,Value)-Pair #9 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_ShadowFunc -// ****************************************************************** -SOOVPA<13> IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4432 = -{ - 0, // Large == 0 - 13, // Count == 13 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_ShadowFunc+0x00 : push esi - { 0x00, 0x56 }, // (Offset,Value)-Pair #1 - - // IDirect3DDevice8_SetRenderState_ShadowFunc+0x09 : cmp eax, [esi+4] - { 0x09, 0x3B }, // (Offset,Value)-Pair #2 - { 0x0A, 0x46 }, // (Offset,Value)-Pair #3 - { 0x0B, 0x04 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_SetRenderState_ShadowFunc+0x0C : jb +0x05 - { 0x0C, 0x72 }, // (Offset,Value)-Pair #5 - { 0x0D, 0x05 }, // (Offset,Value)-Pair #6 - - // IDirect3DDevice8_SetRenderState_ShadowFunc+0x1D : lea edx, [ecx-0x0200] - { 0x1D, 0x8D }, // (Offset,Value)-Pair #7 - { 0x1E, 0x91 }, // (Offset,Value)-Pair #8 - { 0x1F, 0x00 }, // (Offset,Value)-Pair #9 - { 0x20, 0xFE }, // (Offset,Value)-Pair #10 - - // IDirect3DDevice8_SetRenderState_ShadowFunc+0x26 : add eax, 0x08 - { 0x26, 0x83 }, // (Offset,Value)-Pair #11 - { 0x27, 0xC0 }, // (Offset,Value)-Pair #12 - { 0x28, 0x08 }, // (Offset,Value)-Pair #13 - } -}; - -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_YuvEnable -// ****************************************************************** -SOOVPA<13> IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4432 = -{ - 0, // Large == 0 - 13, // Count == 13 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_YuvEnable+0x00 : mov eax, [esp+0x04] - { 0x00, 0x8B }, // (Offset,Value)-Pair #1 - { 0x01, 0x44 }, // (Offset,Value)-Pair #2 - { 0x02, 0x24 }, // (Offset,Value)-Pair #3 - { 0x03, 0x04 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_SetRenderState_YuvEnable+0x10 : mov eax, [esi] - { 0x10, 0x8B }, // (Offset,Value)-Pair #5 - { 0x11, 0x06 }, // (Offset,Value)-Pair #6 - - // IDirect3DDevice8_SetRenderState_YuvEnable+0x12 : cmp eax, [esi+4] - { 0x12, 0x3B }, // (Offset,Value)-Pair #7 - { 0x13, 0x46 }, // (Offset,Value)-Pair #8 - { 0x14, 0x04 }, // (Offset,Value)-Pair #9 - - // IDirect3DDevice8_SetRenderState_YuvEnable+0x15 : jb +0x05 - { 0x15, 0x72 }, // (Offset,Value)-Pair #10 - { 0x16, 0x05 }, // (Offset,Value)-Pair #11 - - // IDirect3DDevice8_SetRenderState_YuvEnable+0x28 : retn 0x04 - { 0x28, 0xC2 }, // (Offset,Value)-Pair #12 - { 0x29, 0x04 }, // (Offset,Value)-Pair #13 - } -}; - // ****************************************************************** // * IDirect3DDevice8_SetPalette // ****************************************************************** @@ -1094,78 +526,6 @@ SOOVPA<12> IDirect3DDevice8_SetVerticalBlankCallback_1_0_4432 = } }; -// ****************************************************************** -// * IDirect3DDevice8_DrawIndexedVerticesUP -// ****************************************************************** -SOOVPA<10> IDirect3DDevice8_DrawIndexedVerticesUP_1_0_4432 = -{ - 0, // Large == 0 - 10, // Count == 10 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_DrawIndexedVerticesUP+0x4A : or edx, 0x800 - { 0x4A, 0x81 }, // (Offset,Value)-Pair #1 - { 0x4B, 0xCA }, // (Offset,Value)-Pair #2 - { 0x4C, 0x00 }, // (Offset,Value)-Pair #3 - { 0x4D, 0x08 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_DrawIndexedVerticesUP+0x5C : lea edx, [edi+0x6C4] - { 0x5C, 0x8D }, // (Offset,Value)-Pair #5 - { 0x5D, 0x97 }, // (Offset,Value)-Pair #6 - { 0x5E, 0xC4 }, // (Offset,Value)-Pair #7 - { 0x5F, 0x06 }, // (Offset,Value)-Pair #8 - - // IDirect3DDevice8_DrawIndexedVerticesUP+0x6A : mov eax, 0x10 - { 0x6A, 0xB8 }, // (Offset,Value)-Pair #9 - { 0x6B, 0x10 }, // (Offset,Value)-Pair #10 - } -}; - -// ****************************************************************** -// * IDirect3DTexture8_GetSurfaceLevel -// ****************************************************************** -SOOVPA<14> IDirect3DTexture8_GetSurfaceLevel_1_0_4432 = -{ - 0, // Large == 0 - 14, // Count == 14 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DTexture8_GetSurfaceLevel+0x00 : sub esp, 0x0C - { 0x00, 0x83 }, // (Offset,Value)-Pair #1 - { 0x01, 0xEC }, // (Offset,Value)-Pair #2 - { 0x02, 0x0C }, // (Offset,Value)-Pair #3 - - // IDirect3DTexture8_GetSurfaceLevel+0x04 : mov esi, [esp+0x14] - { 0x04, 0x8B }, // (Offset,Value)-Pair #4 - { 0x07, 0x14 }, // (Offset,Value)-Pair #5 - - // IDirect3DTexture8_GetSurfaceLevel+0x04 : lea eax, [esp+0x14] - { 0x08, 0x8D }, // (Offset,Value)-Pair #6 - { 0x0B, 0x14 }, // (Offset,Value)-Pair #7 - - // IDirect3DTexture8_GetSurfaceLevel+0x17 : mov edx, [esp+0x24] - { 0x17, 0x8B }, // (Offset,Value)-Pair #8 - { 0x1A, 0x24 }, // (Offset,Value)-Pair #9 - - // IDirect3DTexture8_GetSurfaceLevel+0x1B : lea eax, [esp+0x18] - { 0x1B, 0x8D }, // (Offset,Value)-Pair #10 - { 0x1E, 0x18 }, // (Offset,Value)-Pair #11 - - // IDirect3DTexture8_GetSurfaceLevel+0x29 : call [abs] - { 0x29, 0xE8 }, // (Offset,Value)-Pair #12 - - // IDirect3DTexture8_GetSurfaceLevel+0x4C : retn 0x0C - { 0x4C, 0xC2 }, // (Offset,Value)-Pair #13 - { 0x4D, 0x0C }, // (Offset,Value)-Pair #14 - } -}; - // ****************************************************************** // * IDirect3DDevice8_BackFillMode // ****************************************************************** @@ -1220,7 +580,7 @@ SOOVPA<12> IDirect3DDevice8_EndPush_1_0_4531 = }; // ****************************************************************** -// * D3DDevice_DeletePixelShader@4 +// * D3DDevice_DeletePixelShader // ****************************************************************** // TODO: Add SOOVPA<7> IDirect3DDevice8_DeletePixelShader_1_0_4531 = @@ -1268,6 +628,147 @@ SOOVPA<14> IDirect3DDevice8_Release_1_0_4432 = } }; +// ****************************************************************** +// * IDirect3DTexture8_GetSurfaceLevel +// ****************************************************************** +SOOVPA<14> IDirect3DTexture8_GetSurfaceLevel_1_0_4432 = +{ + 0, // Large == 0 + 14, // Count == 14 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DTexture8_GetSurfaceLevel+0x00 : sub esp, 0x0C + { 0x00, 0x83 }, // (Offset,Value)-Pair #1 + { 0x01, 0xEC }, // (Offset,Value)-Pair #2 + { 0x02, 0x0C }, // (Offset,Value)-Pair #3 + + // IDirect3DTexture8_GetSurfaceLevel+0x04 : mov esi, [esp+0x14] + { 0x04, 0x8B }, // (Offset,Value)-Pair #4 + { 0x07, 0x14 }, // (Offset,Value)-Pair #5 + + // IDirect3DTexture8_GetSurfaceLevel+0x04 : lea eax, [esp+0x14] + { 0x08, 0x8D }, // (Offset,Value)-Pair #6 + { 0x0B, 0x14 }, // (Offset,Value)-Pair #7 + + // IDirect3DTexture8_GetSurfaceLevel+0x17 : mov edx, [esp+0x24] + { 0x17, 0x8B }, // (Offset,Value)-Pair #8 + { 0x1A, 0x24 }, // (Offset,Value)-Pair #9 + + // IDirect3DTexture8_GetSurfaceLevel+0x1B : lea eax, [esp+0x18] + { 0x1B, 0x8D }, // (Offset,Value)-Pair #10 + { 0x1E, 0x18 }, // (Offset,Value)-Pair #11 + + // IDirect3DTexture8_GetSurfaceLevel+0x29 : call [abs] + { 0x29, 0xE8 }, // (Offset,Value)-Pair #12 + + // IDirect3DTexture8_GetSurfaceLevel+0x4C : retn 0x0C + { 0x4C, 0xC2 }, // (Offset,Value)-Pair #13 + { 0x4D, 0x0C }, // (Offset,Value)-Pair #14 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_GetDisplayMode +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_GetDisplayMode_1_0_4432 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_GetDisplayMode+0x01 : mov esi, ds:[*] + { 0x01, 0x8B }, // (Offset,Value)-Pair #1 + { 0x02, 0x35 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_GetDisplayMode+0x18 : shr ecx, 0x14 + { 0x18, 0xC1 }, // (Offset,Value)-Pair #3 + { 0x19, 0xE9 }, // (Offset,Value)-Pair #4 + { 0x1A, 0x14 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_GetDisplayMode+0x50 : shr eax, 0x0C + { 0x50, 0xC1 }, // (Offset,Value)-Pair #6 + { 0x51, 0xE8 }, // (Offset,Value)-Pair #7 + { 0x52, 0x0C }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_GetDisplayMode+0x6B : and eax, 0x0A + { 0x6B, 0x83 }, // (Offset,Value)-Pair #9 + { 0x6C, 0xE0 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_GetDisplayMode+0x92 : retn 4 + { 0x92, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x93, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetFlickerFilter +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetFlickerFilter_1_0_4432 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetFlickerFilter+0x1C : mov eax, [eax+0x227C] + { 0x1D, 0x80 }, // (Offset,Value)-Pair #2 + { 0x1E, 0x7C }, // (Offset,Value)-Pair #3 + { 0x1F, 0x22 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetFlickerFilter+0x22 : push 0; push esi; push 0x0B; push eax + { 0x22, 0x6A }, // (Offset,Value)-Pair #5 + { 0x23, 0x00 }, // (Offset,Value)-Pair #6 + { 0x24, 0x56 }, // (Offset,Value)-Pair #7 + { 0x25, 0x6A }, // (Offset,Value)-Pair #8 + { 0x26, 0x0B }, // (Offset,Value)-Pair #9 + { 0x27, 0x50 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetFlickerFilter+0x3F : retn 0x04 + { 0x3F, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x40, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetFlickerFilter +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetSoftDisplayFilter_1_0_4432 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetSoftDisplayFilter+0x25 : mov edx, [eax+0x227C] + { 0x25, 0x8B }, // (Offset,Value)-Pair #1 + { 0x26, 0x90 }, // (Offset,Value)-Pair #2 + { 0x27, 0x7C }, // (Offset,Value)-Pair #3 + { 0x28, 0x22 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetSoftDisplayFilter+0x2B : push 0; push esi; push 0x0E; push edx + { 0x2B, 0x6A }, // (Offset,Value)-Pair #5 + { 0x2C, 0x00 }, // (Offset,Value)-Pair #6 + { 0x2D, 0x56 }, // (Offset,Value)-Pair #7 + { 0x2E, 0x6A }, // (Offset,Value)-Pair #8 + { 0x2F, 0x0E }, // (Offset,Value)-Pair #9 + { 0x30, 0x52 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetSoftDisplayFilter+0x4E : retn 0x04 + { 0x4E, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x4F, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + // ****************************************************************** // * D3D8_1_0_4432 // ****************************************************************** @@ -1333,9 +834,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_GetBackBuffer" #endif }, - // IDirect3DDevice8::Reset + // IDirect3DDevice8::Reset (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_Reset_1_0_4432, + (OOVPA*)&IDirect3DDevice8_Reset_1_0_4134, XTL::EmuIDirect3DDevice8_Reset, @@ -1383,9 +884,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetPixelShader" #endif }, - // IDirect3D8::KickOffAndWaitForIdle + // IDirect3D8::KickOffAndWaitForIdle (* unchanged since 4134 *) { - (OOVPA*)&IDirect3D8_KickOffAndWaitForIdle_1_0_4432, + (OOVPA*)&IDirect3D8_KickOffAndWaitForIdle_1_0_4134, XTL::EmuIDirect3D8_KickOffAndWaitForIdle, @@ -1433,9 +934,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetTextureState_BumpEnv" #endif }, - // IDirect3DDevice8::SetTextureState_TwoSidedLighting + // IDirect3DDevice8::SetTextureState_TwoSidedLighting (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4134, XTL::EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting, @@ -1445,7 +946,7 @@ OOVPATable D3D8_1_0_4432[] = }, // IDirect3DDevice8::SetRenderState_BackFillMode { - (OOVPA*)&IDirect3DDevice8_SetRenderState_BackFillMode_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_BackFillMode_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_BackFillMode, @@ -1463,9 +964,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetTextureState_BorderColor" #endif }, - // IDirect3DDevice8::SetTextureState_ColorKeyColor + // IDirect3DDevice8::SetTextureState_ColorKeyColor (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4134, XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor, @@ -1503,9 +1004,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_CullMode" #endif }, - // IDirect3DDevice8::SetRenderState_FrontFace + // IDirect3DDevice8::SetRenderState_FrontFace (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_FrontFace_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_FrontFace_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_FrontFace, @@ -1513,9 +1014,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_FrontFace" #endif }, - // IDirect3DDevice8::SetRenderState_LogicOp + // IDirect3DDevice8::SetRenderState_LogicOp (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_LogicOp_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_LogicOp_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_LogicOp, @@ -1613,9 +1114,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_LineWidth" #endif }, - // IDirect3DDevice8::SetRenderState_StencilFail + // IDirect3DDevice8::SetRenderState_StencilFail (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, @@ -1623,9 +1124,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_StencilFail" #endif }, - // IDirect3DDevice8::SetRenderState_OcclusionCullEnable + // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable, @@ -1633,9 +1134,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable" #endif }, - // IDirect3DDevice8::SetRenderState_StencilCullEnable + // IDirect3DDevice8::SetRenderState_StencilCullEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_StencilCullEnable, @@ -1643,9 +1144,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_StencilCullEnable" #endif }, - // IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead + // IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead, @@ -1653,9 +1154,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead" #endif }, - // IDirect3DDevice8::SetRenderState_RopZRead + // IDirect3DDevice8::SetRenderState_RopZRead (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZRead_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZRead_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead, @@ -1663,9 +1164,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_RopZRead" #endif }, - // IDirect3DDevice8::SetRenderState_DoNotCullUncompressed + // IDirect3DDevice8::SetRenderState_DoNotCullUncompressed (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed, @@ -1673,9 +1174,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed" #endif }, - // IDirect3DDevice8::SetRenderState_Dxt1NoiseEnable + // IDirect3DDevice8::SetRenderState_Dxt1NoiseEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_Dxt1NoiseEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_Dxt1NoiseEnable, @@ -1703,9 +1204,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias" #endif }, - // IDirect3DDevice8::SetRenderState_MultiSampleMask + // IDirect3DDevice8::SetRenderState_MultiSampleMask (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMask_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMask_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMask, @@ -1713,9 +1214,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_MultiSampleMask" #endif }, - // IDirect3DDevice8::SetRenderState_MultiSampleMode + // IDirect3DDevice8::SetRenderState_MultiSampleMode (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMode_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleMode_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMode, @@ -1723,9 +1224,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_MultiSampleMode" #endif }, - // IDirect3DDevice8::SetRenderState_MultiSampleRenderTargetMode + // IDirect3DDevice8::SetRenderState_MultiSampleRenderTargetMode (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode, @@ -1733,9 +1234,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode" #endif }, - // IDirect3DDevice8::SetRenderState_ShadowFunc + // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, @@ -1743,9 +1244,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" #endif }, - // IDirect3DDevice8::SetRenderState_YuvEnable + // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable, @@ -1853,9 +1354,9 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetVerticalBlankCallback" #endif }, - // IDirect3DDevice8::DrawIndexedVerticesUP + // IDirect3DDevice8::DrawIndexedVerticesUP (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_DrawIndexedVerticesUP_1_0_4432, + (OOVPA*)&IDirect3DDevice8_DrawIndexedVerticesUP_1_0_4134, XTL::EmuIDirect3DDevice8_DrawIndexedVerticesUP, @@ -1933,7 +1434,7 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DResource8_Release" #endif }, - // IDirect3DTexture8::GetSurfaceLevels + // IDirect3DTexture8::GetSurfaceLevel { (OOVPA*)&IDirect3DTexture8_GetSurfaceLevel_1_0_4432, @@ -2033,6 +1534,264 @@ OOVPATable D3D8_1_0_4432[] = "EmuGet2DSurfaceDesc" #endif }, + // IDirect3DDevice8::SetPixelShaderConstant (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetPixelShaderConstant_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetPixelShaderConstant, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetPixelShaderConstant" + #endif + }, + // IDirect3DDevice8::DeletePixelShader (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_DeletePixelShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_DeletePixelShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DeletePixelShader" + #endif + }, + // IDirect3DDevice8::SetRenderState_CullModeB (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_CullModeB_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_CullMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_CullModeB" + #endif + }, + // D3DDevice_DeleteVertexShader (* unchanged since 4134 *) + { + (OOVPA*)&X_D3DDevice_DeleteVertexShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_DeleteVertexShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DeleteVertexShader" + #endif + }, + // IDirect3DDevice8_SetScreenSpaceOffset (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetScreenSpaceOffset_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetScreenSpaceOffset, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetScreenSpaceOffset" + #endif + }, + // D3D::SetFence (XREF) (* unchanged since 4134 *) + { + (OOVPA*)&D3D_SetFence_1_0_4134, 0, + + #ifdef _DEBUG_TRACE + "D3D::SetFence (XREF)" + #endif + }, + // IDirect3DDevice8::GetGammaRamp (* unchanged since 4034 *) + { + (OOVPA*)&IDirect3DDevice8_GetGammaRamp_1_0_4034, + + XTL::EmuIDirect3DDevice8_GetGammaRamp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetGammaRamp" + #endif + }, + // IDirect3DDevice8::GetDisplayMode + { + (OOVPA*)&IDirect3DDevice8_GetDisplayMode_1_0_4432, + + XTL::EmuIDirect3DDevice8_GetDisplayMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetDisplayMode" + #endif + }, + // IDirect3DDevice8::CreateVertexBuffer (* unchanged since 3925 *) + { + (OOVPA*)&IDirect3DDevice8_CreateVertexBuffer_1_0_3925, + + XTL::EmuIDirect3DDevice8_CreateVertexBuffer, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreateVertexBuffer" + #endif + }, + // IDirect3DVertexBuffer8::Lock (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3DVertexBuffer8_Lock_1_0_4361, + + XTL::EmuIDirect3DVertexBuffer8_Lock, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DVertexBuffer8_Lock" + #endif + }, + // IDirect3DDevice8::SetShaderConstantMode (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3DDevice8_SetShaderConstantMode_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetShaderConstantMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetShaderConstantMode" + #endif + }, + // IDirect3DDevice8::SetVertexShaderConstant (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3DDevice8_SetVertexShaderConstant_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetVertexShaderConstant, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexShaderConstant" + #endif + }, + // IDirect3DDevice8::CreatePixelShader (* unchanged since 3925 *) + { + (OOVPA*)&IDirect3DDevice8_CreatePixelShader_1_0_3925, + + XTL::EmuIDirect3DDevice8_CreatePixelShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreatePixelShader" + #endif + }, + // IDirect3DDevice8::GetViewport (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3DDevice8_GetViewport_1_0_4361, + + XTL::EmuIDirect3DDevice8_GetViewport, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetViewport" + #endif + }, + // IDirect3DDevice8::DrawVertices (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3DDevice8_DrawVertices_1_0_4361, + + XTL::EmuIDirect3DDevice8_DrawVertices, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawVertices" + #endif + }, + // IDirect3DDevice8::SetFlickerFilter + { + (OOVPA*)&IDirect3DDevice8_SetFlickerFilter_1_0_4432, + + XTL::EmuIDirect3DDevice8_SetFlickerFilter, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetFlickerFilter" + #endif + }, + // IDirect3DDevice8::SetSoftDisplayFilter + { + (OOVPA*)&IDirect3DDevice8_SetSoftDisplayFilter_1_0_4432, + + XTL::EmuIDirect3DDevice8_SetSoftDisplayFilter, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetSoftDisplayFilter" + #endif + }, + // IDirect3DDevice8::SetGammaRamp (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3DDevice8_SetGammaRamp_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetGammaRamp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetGammaRamp" + #endif + }, + // IDirect3DDevice8::DrawIndexedVertices (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3DDevice8_DrawIndexedVertices_1_0_4361, + + XTL::EmuIDirect3DDevice8_DrawIndexedVertices, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawIndexedVertices" + #endif + }, + // IDirect3DDevice8::Begin (* unchanged since 4361 *) + { + (OOVPA*)&D3DDevice_Begin_1_0_4361, + + XTL::EmuIDirect3DDevice8_Begin, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_Begin" + #endif + }, + // IDirect3DDevice8::End (* unchanged since 4361 *) + { + (OOVPA*)&D3DDevice_End_1_0_4361, + + XTL::EmuIDirect3DDevice8_End, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_End" + #endif + }, + // IDirect3DDevice8::SetVertexData2f (* unchanged since 4361 *) + { + (OOVPA*)&D3DDevice_SetVertexData2f_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetVertexData2f, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData2f" + #endif + }, + // IDirect3DDevice8::SetVertexData4f (* unchanged since 4361 *) + { + (OOVPA*)&D3DDevice_SetVertexData4f_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetVertexData4f, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData4f" + #endif + }, + // IDirect3DDevice8::SetVertexData4ub (* unchanged since 4361 *) + { + (OOVPA*)&D3DDevice_SetVertexData4ub_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetVertexData4ub, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData4ub" + #endif + }, + // IDirect3DDevice8::SetIndices (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3DDevice8_SetIndices_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetIndices, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetIndices" + #endif + }, + // D3DDevice_GetVertexShaderSize (* unchanged since 3925 *) + { + (OOVPA*)&X_D3DDevice_GetVertexShaderSize_1_0_3925, + + XTL::EmuIDirect3DDevice8_GetVertexShaderSize, + + #ifdef _DEBUG_TRACE + "D3DDevice_GetVertexShaderSize" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4627.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4627.inl index 264630db3..cad28ccb4 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4627.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.4627.inl @@ -123,6 +123,36 @@ SOOVPA<11> IDirect3DDevice8_BeginVisibilityTest_1_0_4627 = } }; +// ****************************************************************** +// * IDirect3D8_CreateDevice +// ****************************************************************** +SOOVPA<8> IDirect3D8_CreateDevice_1_0_5028 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3D8_CreateDevice+0x0A : jnz +0x0A + { 0x0A, 0x75 }, // (Offset,Value)-Pair #1 + { 0x0B, 0x0A }, // (Offset,Value)-Pair #2 + + // IDirect3D8_CreateDevice+0x80 : repe stosd + { 0x80, 0xF3 }, // (Offset,Value)-Pair #3 + { 0x81, 0xAB }, // (Offset,Value)-Pair #4 + + // IDirect3D8_CreateDevice+0x83 : mov eax, esi + { 0x83, 0x8B }, // (Offset,Value)-Pair #5 + { 0x84, 0xC6 }, // (Offset,Value)-Pair #6 + + // IDirect3D8_CreateDevice+0x91 : retn 0x18 + { 0x91, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x92, 0x18 }, // (Offset,Value)-Pair #8 + } +}; + // ****************************************************************** // * IDirect3DDevice8_EndVisibilityTest // ****************************************************************** @@ -768,7 +798,7 @@ SOOVPA<11> IDirect3DDevice8_GetTile_1_0_4627 = { 0x1A, 0xB9 }, // (Offset,Value)-Pair #6 { 0x1B, 0x06 }, // (Offset,Value)-Pair #7 - // IDirect3DDevice8_GetTile+0x5F : pop edi; pop esi + // IDirect3DDevice8_GetTile+0x21 : pop edi; pop esi { 0x21, 0x5F }, // (Offset,Value)-Pair #8 { 0x22, 0x5E }, // (Offset,Value)-Pair #9 @@ -831,38 +861,6 @@ SOOVPA<7> IDirect3DDevice8_CreateIndexBuffer2_1_0_4627 = } }; -// ****************************************************************** -// * IDirect3DDevice8_SetPixelShaderConstant -// ****************************************************************** -SOOVPA<10> IDirect3DDevice8_SetPixelShaderConstant_1_0_4627 = -{ - 0, // Large == 0 - 10, // Count == 10 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetPixelShaderConstant+0x17 : test eax, eax - { 0x17, 0x85 }, // (Offset,Value)-Pair #1 - { 0x18, 0xC0 }, // (Offset,Value)-Pair #2 - - // IDirect3DDevice8_SetPixelShaderConstant+0x32 : add edi, 0x04 - { 0x32, 0x83 }, // (Offset,Value)-Pair #3 - { 0x33, 0xC7 }, // (Offset,Value)-Pair #4 - { 0x34, 0x04 }, // (Offset,Value)-Pair #5 - - // IDirect3DDevice8_SetPixelShaderConstant+0x47 : jmp +0x07 - { 0x47, 0xEB }, // (Offset,Value)-Pair #6 - { 0x48, 0x07 }, // (Offset,Value)-Pair #7 - - // IDirect3DDevice8_SetPixelShaderConstant+0xC7 : fstp [esp+??] - { 0xC7, 0xD9 }, // (Offset,Value)-Pair #8 - { 0xC8, 0x1C }, // (Offset,Value)-Pair #9 - { 0xC9, 0x24 }, // (Offset,Value)-Pair #10 - } -}; - // ****************************************************************** // * IDirect3DDevice8_SetPixelShaderConstant // ****************************************************************** @@ -1003,28 +1001,6 @@ SOOVPA<12> IDirect3DDevice8_SetVertexShaderConstantNotInline_1_0_4627 = } }; -// ****************************************************************** -// * D3DDevice_DeletePixelShader@4 -// ****************************************************************** -SOOVPA<7> IDirect3DDevice8_DeletePixelShader_1_0_4627 = -{ - 0, // Large == 0 - 7, // Count == 7 - - -1, // Xref Not Saved - 0, // Xref Not Used - - { - { 0x02, 0x24 }, - { 0x06, 0x75 }, - { 0x0A, 0x04 }, - { 0x0E, 0x09 }, - { 0x12, 0x04 }, - { 0x18, 0xC2 }, - { 0x1A, 0x00 }, - } -}; - // ****************************************************************** // * IDirect3DDevice8_SetPixelShader // ****************************************************************** @@ -1794,41 +1770,6 @@ SOOVPA<10> IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_4627 = } }; -// ****************************************************************** -// * IDirect3DDevice8_SetRenderState_CullModeB -// ****************************************************************** -SOOVPA<13> IDirect3DDevice8_SetRenderState_CullModeB_1_0_4627 = -{ - 0, // Large == 0 - 13, // Count == 13 - - XREF_DXSRSCULLMODE, // XRef Is Saved - 0, // XRef Not Used - - { - // IDirect3DDevice8_SetRenderState_CullModeB+0x22 : mov dword ptr [eax], 0x40308 - { 0x22, 0xC7 }, // (Offset,Value)-Pair #1 - { 0x24, 0x08 }, // (Offset,Value)-Pair #2 - { 0x25, 0x03 }, // (Offset,Value)-Pair #3 - { 0x26, 0x04 }, // (Offset,Value)-Pair #4 - - // IDirect3DDevice8_SetRenderState_CullModeB+0x2D : add eax, 8 - { 0x2D, 0x83 }, // (Offset,Value)-Pair #5 - { 0x2E, 0xC0 }, // (Offset,Value)-Pair #6 - { 0x2F, 0x08 }, // (Offset,Value)-Pair #7 - - // IDirect3DDevice8_SetRenderState_CullModeB+0x39 : retn 4 - { 0x39, 0xC2 }, // (Offset,Value)-Pair #8 - { 0x3A, 0x04 }, // (Offset,Value)-Pair #9 - - // IDirect3DDevice8_SetRenderState_CullModeB+0x5C : add edx, 0x404 - { 0x5C, 0x81 }, // (Offset,Value)-Pair #10 - { 0x5D, 0xC2 }, // (Offset,Value)-Pair #11 - { 0x5E, 0x04 }, // (Offset,Value)-Pair #12 - { 0x5F, 0x04 }, // (Offset,Value)-Pair #13 - } -}; - // ****************************************************************** // * IDirect3DDevice8_SetRenderState_NormalizeNormalsB // ****************************************************************** @@ -2658,27 +2599,6 @@ SOOVPA<8> X_D3DDevice_GetViewportOffsetAndScale_1_0_4627 = } }; -// ****************************************************************** -// * D3DDevice_DeleteVertexShader -// ****************************************************************** -SOOVPA<6> X_D3DDevice_DeleteVertexShader_1_0_4627 = -{ - 0, // Large == 0 - 6, // Count == 6 - - -1, // Xref Not Saved - 0, // Xref Not Used - - { - { 0x02, 0x24 }, - { 0x06, 0xFF }, - { 0x0A, 0x08 }, - { 0x0E, 0x44 }, - { 0x16, 0xC2 }, - { 0x17, 0x04 }, - } -}; - // ****************************************************************** // * D3DDevice_SelectVertexShaderDirect // ****************************************************************** @@ -3234,28 +3154,6 @@ SOOVPA<7> IDirect3DDevice8_GetDisplayFieldStatus_1_0_4627 = } }; -// ****************************************************************** -// * IDirect3DDevice8_SetScreenSpaceOffset -// ****************************************************************** -SOOVPA<7> IDirect3DDevice8_SetScreenSpaceOffset_1_0_4627 = -{ - 0, // Large == 0 - 7, // Count == 7 - - -1, // Xref Not saved - 0, // XRef Not Used - - { - { 0x06, 0x56 }, - { 0x07, 0xD8 }, - { 0x08, 0x44 }, - { 0x09, 0x24 }, - { 0x0A, 0x08 }, - { 0x2E, 0x8B }, - { 0x2F, 0x06 }, - } -}; - // ****************************************************************** // * IDirect3DDevice8_CreateStateBlock // ****************************************************************** @@ -3429,7 +3327,7 @@ SOOVPA<7> D3DDevice_SetPalette_1_0_4627 = }; // ****************************************************************** -// * D3DDevice_SetRenderState_MultiSampleMask@4 +// * D3DDevice_SetRenderState_MultiSampleMask // ****************************************************************** SOOVPA<8> D3DDevice_SetRenderState_MultiSampleMask_1_0_4627 = { @@ -3452,7 +3350,7 @@ SOOVPA<8> D3DDevice_SetRenderState_MultiSampleMask_1_0_4627 = }; // ****************************************************************** -// * D3DDevice_SetRenderState_LogicOp@4 +// * D3DDevice_SetRenderState_LogicOp // ****************************************************************** SOOVPA<7> D3DDevice_SetRenderState_LogicOp_1_0_4627 = { @@ -3474,34 +3372,7 @@ SOOVPA<7> D3DDevice_SetRenderState_LogicOp_1_0_4627 = }; // ****************************************************************** -// * D3D::SetFence -// ****************************************************************** -SOOVPA<12> D3D_SetFence_1_0_4627 = -{ - 0, // Large == 0 - 12, // Count == 12 - - XREF_D3D_SETFENCE, // Xref Is Saved - 0, // Xref Not Used - - { - { 0x0D, 0x72 }, - { 0x0E, 0x0E }, - { 0x31, 0xBA }, - { 0x32, 0x90 }, - { 0x33, 0x1D }, - { 0x34, 0x04 }, - { 0x35, 0x00 }, - { 0x45, 0x83 }, - { 0x46, 0xE1 }, - { 0x47, 0x3F }, - { 0xAA, 0xC2 }, - { 0xAB, 0x04 }, - } -}; - -// ****************************************************************** -// * D3DDevice_InsertFence@0 +// * D3DDevice_InsertFence // ****************************************************************** SOOVPA<5> D3DDevice_InsertFence_1_0_4627 = { @@ -3673,7 +3544,7 @@ SOOVPA<10> IDirect3DDevice8_DrawIndexedVerticesUP_1_0_4627 = }; // ****************************************************************** -// * D3DDevice_SetStipple@4 +// * D3DDevice_SetStipple // ****************************************************************** SOOVPA<7> D3DDevice_SetStipple_1_0_4627 = { @@ -3694,6 +3565,142 @@ SOOVPA<7> D3DDevice_SetStipple_1_0_4627 = } }; +// ****************************************************************** +// * D3DDevice_PersistDisplay +// ****************************************************************** +SOOVPA<8> D3DDevice_PersistDisplay_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x21, 0x8B }, + { 0x3C, 0x8D }, + { 0x5B, 0x74 }, + { 0x7A, 0x42 }, + { 0x99, 0x56 }, + { 0xB8, 0x00 }, + { 0xD7, 0x8B }, + { 0xF6, 0xF9 }, + } +}; + +// ****************************************************************** +// * D3DDevice_PersistDisplay +// ****************************************************************** +SOOVPA<14> D3DDevice_PersistDisplay_1_0_4928 = +{ + 0, // Large == 0 + 14, // Count == 14 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + // D3DDevice_PersistDisplay+0x23 : mov eax, [ebx+0x500] + { 0x23, 0x8B }, + { 0x24, 0x83 }, + { 0x25, 0x00 }, + { 0x26, 0x05 }, + { 0x27, 0x00 }, + { 0x28, 0x00 }, + // D3DDevice_PersistDisplay+0x39 : lea ebp, [ebx+0x23C0] + { 0x39, 0x8D }, + { 0x3A, 0xAB }, + { 0x3B, 0xC0 }, + { 0x3C, 0x23 }, + { 0x3D, 0x00 }, + { 0x3E, 0x00 }, + // D3DDevice_PersistDisplay+0x72 : shl edx, cl + { 0x72, 0xD3 }, + { 0x73, 0xE2 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetSwapCallback +// ****************************************************************** +/* See the comment for the 4134 OOVPA signature for previous notes */ +SOOVPA<12> IDirect3DDevice8_SetSwapCallback_1_0_4928 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetVerticalBlankCallback+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #1 + { 0x01, 0x44 }, // (Offset,Value)-Pair #2 + { 0x02, 0x24 }, // (Offset,Value)-Pair #3 + { 0x03, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x04 : mov ecx, [addr] + { 0x04, 0x8B }, // (Offset,Value)-Pair #5 + { 0x05, 0x0D }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x0A : mov [ecx+0x254C], eax + { 0x0A, 0x89 }, // (Offset,Value)-Pair #7 + { 0x0B, 0x81 }, // (Offset,Value)-Pair #8 + { 0x0C, 0x4C }, // (Offset,Value)-Pair #9 + { 0x0D, 0x25 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x10 : retn 0x04 + { 0x10, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x11, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * D3DDevice_SetRenderState_MultiSampleMode +// ****************************************************************** +SOOVPA<8> D3DDevice_SetRenderState_MultiSampleMode_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x09, 0x89 }, + { 0x0F, 0x8B }, + { 0x13, 0x00 }, + { 0x1A, 0x00 }, + { 0x1B, 0x75 }, + { 0x21, 0x00 }, + { 0x28, 0x00 }, + { 0x31, 0xC2 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetRenderState_MultiSampleRenderTargetMode +// ****************************************************************** +SOOVPA<8> D3DDevice_SetRenderState_MultiSampleRenderTargetMode_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x09, 0x89 }, + { 0x0F, 0x8B }, + { 0x13, 0x00 }, + { 0x1A, 0x00 }, + { 0x1B, 0x74 }, + { 0x21, 0x00 }, + { 0x28, 0x00 }, + { 0x31, 0xC2 }, + } +}; + // ****************************************************************** // * D3D8_1_0_4627 // ****************************************************************** @@ -3718,6 +3725,16 @@ OOVPATable D3D8_1_0_4627[] = #ifdef _DEBUG_TRACE "EmuIDirect3D8_CreateDevice" #endif + }, + // IDirect3D8::CreateDevice + { + (OOVPA*)&IDirect3D8_CreateDevice_1_0_5028, + + XTL::EmuIDirect3D8_CreateDevice, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_CreateDevice_5028" + #endif }, // IDirect3D8::CheckDeviceFormat (* unchanged since 4361 *) { @@ -4015,9 +4032,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_CreateVertexShader" #endif }, - // IDirect3DDevice8::SetPixelShaderConstant + // IDirect3DDevice8::SetPixelShaderConstant (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetPixelShaderConstant_1_0_4627, + (OOVPA*)&IDirect3DDevice8_SetPixelShaderConstant_1_0_4134, XTL::EmuIDirect3DDevice8_SetPixelShaderConstant, @@ -4055,9 +4072,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetVertexShaderConstantNotInline" #endif }, - // IDirect3DDevice8::DeletePixelShader + // IDirect3DDevice8::DeletePixelShader (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_DeletePixelShader_1_0_4627, + (OOVPA*)&IDirect3DDevice8_DeletePixelShader_1_0_4134, XTL::EmuIDirect3DDevice8_DeletePixelShader, @@ -4355,9 +4372,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetTextureState_BorderColor" #endif }, - // IDirect3DDevice8::SetTextureState_ColorKeyColor (* unchanged since 4432 *) + // IDirect3DDevice8::SetTextureState_ColorKeyColor (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4134, XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor, @@ -4375,9 +4392,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetRenderState_VertexBlend" #endif }, - // IDirect3DDevice8::SetRenderState_CullModeB + // IDirect3DDevice8::SetRenderState_CullModeB (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_CullModeB_1_0_4627, + (OOVPA*)&IDirect3DDevice8_SetRenderState_CullModeB_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_CullMode, @@ -4545,9 +4562,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetRenderState_LineWidth" #endif }, - // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable, @@ -4575,9 +4592,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAliasB" #endif }, - // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, @@ -4585,9 +4602,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" #endif }, - // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable, @@ -4935,9 +4952,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_GetViewportOffsetAndScale" #endif }, - // D3DDevice_DeleteVertexShader + // D3DDevice_DeleteVertexShader (* unchanged since 4134 *) { - (OOVPA*)&X_D3DDevice_DeleteVertexShader_1_0_4627, + (OOVPA*)&X_D3DDevice_DeleteVertexShader_1_0_4134, XTL::EmuIDirect3DDevice8_DeleteVertexShader, @@ -5105,9 +5122,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_Release" #endif }, - // IDirect3DDevice8::SetRenderState_StencilFail (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_StencilFail (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, @@ -5125,9 +5142,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetPixelShader_4721" #endif }, - // IDirect3DDevice8::Reset + // IDirect3DDevice8::Reset (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_Reset_1_0_4432, + (OOVPA*)&IDirect3DDevice8_Reset_1_0_4134, XTL::EmuIDirect3DDevice8_Reset, @@ -5155,16 +5172,6 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetPalette" #endif }, - // IDirect3DDevice8::SetRenderState_StencilFail - { - (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4432, - - XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, - - #ifdef _DEBUG_TRACE - "EmuIDirect3DDevice8_SetRenderState_StencilFail" - #endif - }, // IDirect3DDevice8::SetBackBufferScale { (OOVPA*)&IDirect3DDevice8_SetBackBufferScale_1_0_4627, @@ -5205,9 +5212,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_GetDisplayFieldStatus" #endif }, - // IDirect3DDevice8_SetScreenSpaceOffset + // IDirect3DDevice8_SetScreenSpaceOffset (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetScreenSpaceOffset_1_0_4627, + (OOVPA*)&IDirect3DDevice8_SetScreenSpaceOffset_1_0_4134, XTL::EmuIDirect3DDevice8_SetScreenSpaceOffset, @@ -5295,9 +5302,9 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetRenderState_LogicOp" #endif }, - // D3D::SetFence (XREF) + // D3D::SetFence (XREF) (* unchanged since 4134 *) { - (OOVPA*)&D3D_SetFence_1_0_4627, 0, + (OOVPA*)&D3D_SetFence_1_0_4134, 0, #ifdef _DEBUG_TRACE "D3D::SetFence (XREF)" @@ -5333,10 +5340,10 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetPixelShaderConstant_4928" #endif }, - // IDirect3DDevice8::SetRenderState_TwoSidedLighting (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_TwoSidedLighting (* unchanged since 4134 *) // Beware of the typo... { - (OOVPA*)&IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4134, XTL::EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting, @@ -5344,7 +5351,7 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetRenderState_TwoSidedLighting" #endif }, - // D3DDevice_GetTexture2@4 + // D3DDevice_GetTexture2 { (OOVPA*)&D3DDevice_GetTexture2_1_0_4627, XTL::EmuIDirect3DDevice8_GetTexture2, @@ -5354,7 +5361,7 @@ OOVPATable D3D8_1_0_4627[] = #endif }, // D3D::CDevice::SetStateVB - { + /*{ (OOVPA*)&D3D_CDevice_SetStateVB_1_0_4627, XTL::EmuD3DDevice_SetStateVB, @@ -5362,9 +5369,9 @@ OOVPATable D3D8_1_0_4627[] = #ifdef _DEBUG_TRACE "D3D::CDevice::SetStateVB" #endif - }, + },*/ // D3D::CDevice::SetStateUP - { + /*{ (OOVPA*)&D3D_CDevice_SetStateUP_1_0_4627, XTL::EmuD3DDevice_SetStateUP, @@ -5372,7 +5379,7 @@ OOVPATable D3D8_1_0_4627[] = #ifdef _DEBUG_TRACE "D3D::CDevice::SetStateUP" #endif - }, + },*/ // IDirect3DDevice8::DrawIndexedVerticesUP { (OOVPA*)&IDirect3DDevice8_DrawIndexedVerticesUP_1_0_4627, @@ -5393,6 +5400,114 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetStipple" #endif }, + // IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead" + #endif + }, + // IDirect3DDevice8::SetRenderState_RopZRead (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZRead_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_RopZRead" + #endif + }, + // IDirect3DDevice8::SetRenderState_DoNotCullUncompressed (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed" + #endif + }, + // IDirect3DDevice8::DeletePixelShader (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_DeletePixelShader_1_0_4134, + + XTL::EmuIDirect3DDevice8_DeletePixelShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DeletePixelShader" + #endif + }, + // D3DDevice_PersistDisplay + { + (OOVPA*)&D3DDevice_PersistDisplay_1_0_4627, + XTL::EmuIDirect3DDevice8_PersistDisplay, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice_PersistDisplay" + #endif + }, + // D3DDevice_PersistDisplay + { + (OOVPA*)&D3DDevice_PersistDisplay_1_0_4928, + XTL::EmuIDirect3DDevice8_PersistDisplay, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_PersistDisplay_4928" + #endif + }, + // IDirect3DDevice8::SetSwapCallback + { + (OOVPA*)&IDirect3DDevice8_SetSwapCallback_1_0_4928, + + XTL::EmuIDirect3DDevice8_SetSwapCallback, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetSwapCallback" + #endif + }, + // IDirect3DDevice8::SetRenderState_FrontFace (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_FrontFace_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_FrontFace, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_FrontFace" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleMode + { + (OOVPA*)&D3DDevice_SetRenderState_MultiSampleMode_1_0_4627, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleMode" + #endif + }, + // IDirect3DDevice8::SetRenderState_MultiSampleRenderTargetMode + { + (OOVPA*)&D3DDevice_SetRenderState_MultiSampleRenderTargetMode_1_0_4627, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode" + #endif + }, + // IDirect3DDevice8::SetRenderState_StencilCullEnable (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilCullEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilCullEnable" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5233.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5233.inl index afc7e63c1..a10dc5255 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5233.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5233.inl @@ -1479,6 +1479,179 @@ SOOVPA<12> IDirect3DDevice8_SetSoftDisplayFilter_1_0_5344 = } }; +// ****************************************************************** +// * IDirect3DDevice8_Unknown1 +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_Unknown1_1_0_5233 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_Unknown1+0x00 : xor eax, eax + { 0x00, 0x33 }, + { 0x01, 0xC0 }, + // IDirect3DDevice8_Unknown1+0x13 : call ds:AvSendTVEncoderOption + { 0x13, 0xFF }, + { 0x14, 0x15 }, + { 0x15, 0x08 }, + { 0x16, 0x94 }, + { 0x17, 0x19 }, + { 0x18, 0x00 }, + // IDirect3DDevice8_Unknown1+0x1E : retn + { 0x1E, 0xC3 }, + } +}; + +// ****************************************************************** +// * D3DDevice_BeginPush +// ****************************************************************** +SOOVPA<6> D3DDevice_BeginPush_1_0_5344 = +{ + 0, // Large == 0 + 6, // Count == 6 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x06, 0x6A }, + { 0x07, 0x00 }, + { 0x0D, 0x8B }, + { 0x0E, 0x44 }, + { 0x12, 0x89 }, + { 0x16, 0xE9 }, + } +}; + +// ****************************************************************** +// * D3DDevice_EndPush +// ****************************************************************** +SOOVPA<8> D3DDevice_EndPush_1_0_5344 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x00, 0x8B }, + { 0x02, 0x24 }, + { 0x04, 0x8B }, + { 0x0A, 0x89 }, + { 0x0B, 0x01 }, + { 0x0C, 0xC2 }, + { 0x0D, 0x04 }, + { 0x0E, 0x00 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetVerticalBlankCallback +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetVerticalBlankCallback_1_0_5233 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetVerticalBlankCallback+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #1 + { 0x01, 0x44 }, // (Offset,Value)-Pair #2 + { 0x02, 0x24 }, // (Offset,Value)-Pair #3 + { 0x03, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x04 : mov ecx, [addr] + { 0x04, 0x8B }, // (Offset,Value)-Pair #5 + { 0x05, 0x0D }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x0A : mov [ecx+0x1958], eax + { 0x0A, 0x89 }, // (Offset,Value)-Pair #7 + { 0x0B, 0x81 }, // (Offset,Value)-Pair #8 + { 0x0C, 0x58 }, // (Offset,Value)-Pair #9 + { 0x0D, 0x19 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x10 : retn 0x04 + { 0x10, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x11, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * D3DDevice_SetRenderState_SampleAlpha +// ****************************************************************** +SOOVPA<7> D3DDevice_SetRenderState_SampleAlpha_1_0_5233 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0B, 0xC1 }, + { 0x15, 0x0B }, + { 0x1C, 0x8B }, + { 0x28, 0x85 }, + { 0x30, 0x07 }, + { 0x3B, 0xC7 }, + { 0x44, 0x83 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetRenderState_MultiSampleMask +// ****************************************************************** +SOOVPA<8> D3DDevice_SetRenderState_MultiSampleMask_1_0_5233 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0A, 0xA3 }, + { 0x12, 0x56 }, + { 0x1C, 0x8B }, + { 0x2A, 0x85 }, + { 0x30, 0x01 }, + { 0x3D, 0xC7 }, + { 0x44, 0x78 }, + { 0x4E, 0x04 }, + } +}; + +// ****************************************************************** +// * Direct3D_EnumAdapterModes +// ****************************************************************** +SOOVPA<8> Direct3D_EnumAdapterModes_1_0_5233 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x20, 0x8B }, + { 0x3E, 0xE3 }, + { 0x5E, 0x75 }, + { 0x7E, 0x00 }, + { 0x9E, 0x00 }, + { 0xBE, 0x0F }, + { 0xE2, 0x89 }, + { 0xFE, 0x5D }, + } +}; + // ****************************************************************** // * D3D8_1_0_5233 // ****************************************************************** @@ -1622,9 +1795,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_AddRef" #endif }, - // IDirect3DDevice8::Reset (* unchanged since 4432 *) + // IDirect3DDevice8::Reset (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_Reset_1_0_4432, + (OOVPA*)&IDirect3DDevice8_Reset_1_0_4134, XTL::EmuIDirect3DDevice8_Reset, @@ -1692,9 +1865,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetVertexShaderConstantNotInline" #endif }, - // IDirect3DDevice8::DeletePixelShader (* unchanged since 4627 *) + // IDirect3DDevice8::DeletePixelShader (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_DeletePixelShader_1_0_4627, + (OOVPA*)&IDirect3DDevice8_DeletePixelShader_1_0_4134, XTL::EmuIDirect3DDevice8_DeletePixelShader, @@ -1892,9 +2065,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetTextureState_BorderColor" #endif }, - // IDirect3DDevice8::SetTextureState_ColorKeyColor (* unchanged since 4432 *) + // IDirect3DDevice8::SetTextureState_ColorKeyColor (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_4134, XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor, @@ -1922,9 +2095,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_CullMode" #endif }, - // IDirect3DDevice8::SetRenderState_CullModeB (* unchanged since 4627 *) + // IDirect3DDevice8::SetRenderState_CullModeB (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_CullModeB_1_0_4627, + (OOVPA*)&IDirect3DDevice8_SetRenderState_CullModeB_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_CullMode, @@ -1982,9 +2155,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_FillMode" #endif }, - // IDirect3DDevice8::SetRenderState_BackFillMode (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_BackFillMode (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_BackFillMode_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_BackFillMode_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_BackFillMode, @@ -2042,9 +2215,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_StencilEnable" #endif }, - // IDirect3DDevice8::SetRenderState_StencilFail (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_StencilFail (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, @@ -2062,9 +2235,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_LineWidth" #endif }, - // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable, @@ -2072,9 +2245,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable" #endif }, - // IDirect3DDevice8::SetRenderState_StencilCullEnable (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_StencilCullEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_StencilCullEnable, @@ -2082,9 +2255,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_StencilCullEnable" #endif }, - // IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead, @@ -2092,9 +2265,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead" #endif }, - // IDirect3DDevice8::SetRenderState_RopZRead (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_RopZRead (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZRead_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_RopZRead_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead, @@ -2102,9 +2275,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_RopZRead" #endif }, - // IDirect3DDevice8::SetRenderState_DoNotCullUncompressed (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_DoNotCullUncompressed (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed, @@ -2142,9 +2315,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode" #endif }, - // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, @@ -2152,9 +2325,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" #endif }, - // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable, @@ -2462,9 +2635,9 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_GetViewportOffsetAndScale" #endif }, - // IDirect3DDevice8::DeleteVertexShader (* unchanged since 4627 *) + // IDirect3DDevice8::DeleteVertexShader (* unchanged since 4134 *) { - (OOVPA*)&X_D3DDevice_DeleteVertexShader_1_0_4627, + (OOVPA*)&X_D3DDevice_DeleteVertexShader_1_0_4134, XTL::EmuIDirect3DDevice8_DeleteVertexShader, @@ -2627,6 +2800,117 @@ OOVPATable D3D8_1_0_5233[] = "EmuIDirect3DDevice8_SetSoftDisplayFilter_5344" #endif }, + // IDirect3DDevice8_Unknown1 + /*{ + (OOVPA*)&IDirect3DDevice8_Unknown1_1_0_5233, + + XTL::EmuIDirect3DDevice8_Unknown1, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_Unknown1" + #endif + },*/ + // IDirect3DDevice8::SetRenderState_TwoSidedLighting (* unchanged since 4134 *) + // Beware of the typo... + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_TwoSidedLighting" + #endif + }, + // IDirect3DDevice8::SetRenderState_FrontFace (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_FrontFace_1_0_4134, + + XTL::EmuIDirect3DDevice8_SetRenderState_FrontFace, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_FrontFace" + #endif + }, + // D3DDevice_SetRenderState_LogicOp (* unchanged since 4627 *) + { + (OOVPA*)&D3DDevice_SetRenderState_LogicOp_1_0_4627, + + XTL::EmuIDirect3DDevice8_SetRenderState_LogicOp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_LogicOp" + #endif + }, + // IDirect3DDevice8::BeginPush + { + (OOVPA*)&D3DDevice_BeginPush_1_0_5344, + + XTL::EmuIDirect3DDevice8_BeginPush, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_BeginPush" + #endif + }, + // IDirect3DDevice8::EndPush + { + (OOVPA*)&D3DDevice_EndPush_1_0_5344, + + XTL::EmuIDirect3DDevice8_EndPush, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_EndPush" + #endif + }, + // IDirect3DDevice8::SetVerticalBlankCallback + { + (OOVPA*)&IDirect3DDevice8_SetVerticalBlankCallback_1_0_5233, + + XTL::EmuIDirect3DDevice8_SetVerticalBlankCallback, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVerticalBlankCallback" + #endif + }, + // D3DDevice_SetRenderState_SampleAlpha + { + (OOVPA*)&D3DDevice_SetRenderState_SampleAlpha_1_0_5233, + + XTL::EmuIDirect3DDevice8_SetRenderState_SampleAlpha, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_SampleAlpha" + #endif + }, + // D3DDevice_SetRenderState_MultiSampleMask + { + (OOVPA*)&D3DDevice_SetRenderState_MultiSampleMask_1_0_5233, + + XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMask, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_MultiSampleMask" + #endif + }, + // IDirect3D8::GetAdapterModeCount (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3D8_GetAdapterModeCount_1_0_4361, + + XTL::EmuIDirect3D8_GetAdapterModeCount, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_GetAdapterModeCount" + #endif + }, + // Direct3D_EnumAdapterModes + { + (OOVPA*)&Direct3D_EnumAdapterModes_1_0_5233, + + XTL::EmuIDirect3D8_EnumAdapterModes, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_EnumAdapterModes" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5558.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5558.inl index 5ad354e98..92fb65ef3 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5558.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5558.inl @@ -857,6 +857,242 @@ SOOVPA<10> IDirect3DDevice8_DrawVerticesUP_1_0_5558 = } }; +// ****************************************************************** +// * IDirect3DDevice8_CreateIndexBuffer +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_CreateIndexBuffer_1_0_5558 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x00, 0x50 }, + { 0x06, 0x8B }, + { 0x07, 0x4C }, + { 0x09, 0x04 }, + { 0x0A, 0x33 }, + { 0x0E, 0x0F }, + { 0x12, 0x01 }, + { 0x16, 0x0E }, + { 0x1A, 0x8B }, + { 0x1E, 0x00 }, + } +}; + +// ****************************************************************** +// * D3DDevice_CreateIndexBuffer2 +// ****************************************************************** +SOOVPA<7> D3DDevice_CreateIndexBuffer2_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x05, 0x00 }, + { 0x0C, 0x50 }, + { 0x13, 0xC0 }, + { 0x1A, 0xC9 }, + { 0x21, 0x04 }, + { 0x28, 0xC7 }, + { 0x2F, 0x48 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetVerticalBlankCallback +// ****************************************************************** +SOOVPA<7> D3DDevice_SetVerticalBlankCallback_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x01, 0x44 }, + { 0x04, 0x8B }, + { 0x0A, 0x89 }, + { 0x0B, 0x81 }, + { 0x0C, 0xA8 }, + { 0x0D, 0x1D }, + { 0x10, 0xC2 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetVerticalBlankCallback +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetVerticalBlankCallback_1_0_5455 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetVerticalBlankCallback+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #1 + { 0x01, 0x44 }, // (Offset,Value)-Pair #2 + { 0x02, 0x24 }, // (Offset,Value)-Pair #3 + { 0x03, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x04 : mov ecx, [addr] + { 0x04, 0x8B }, // (Offset,Value)-Pair #5 + { 0x05, 0x0D }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x0A : mov [ecx+0x1998], eax + { 0x0A, 0x89 }, // (Offset,Value)-Pair #7 + { 0x0B, 0x81 }, // (Offset,Value)-Pair #8 + { 0x0C, 0x98 }, // (Offset,Value)-Pair #9 + { 0x0D, 0x19 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetVerticalBlankCallback+0x10 : retn 0x04 + { 0x10, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x11, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * D3DDevice_SetSwapCallback +// ****************************************************************** +SOOVPA<7> D3DDevice_SetSwapCallback_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x01, 0x44 }, + { 0x04, 0x8B }, + { 0x0A, 0x89 }, + { 0x0B, 0x81 }, + { 0x0C, 0xA4 }, + { 0x0D, 0x1D }, + { 0x10, 0xC2 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetRenderState_TextureFactor +// ****************************************************************** +SOOVPA<7> D3DDevice_SetRenderState_TextureFactor_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x09, 0x80 }, + { 0x14, 0x46 }, + { 0x1F, 0x24 }, + { 0x2A, 0xBA }, + { 0x35, 0x4A }, + { 0x40, 0x5E }, + { 0x4D, 0x5E }, + } +}; + +// ****************************************************************** +// * D3DDevice_GetViewport +// ****************************************************************** +SOOVPA<7> D3DDevice_GetViewport_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x05, 0x8B }, + { 0x0C, 0x00 }, + { 0x13, 0x50 }, + { 0x1A, 0x08 }, + { 0x21, 0x89 }, + { 0x28, 0x51 }, + { 0x2F, 0x14 }, + } +}; + +// ****************************************************************** +// * D3DDevice_Reset +// ****************************************************************** +SOOVPA<8> D3DDevice_Reset_1_0_5558 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x13, 0x00 }, + { 0x28, 0x74 }, + { 0x40, 0x5F }, + { 0x55, 0x8B }, + { 0x67, 0x50 }, + { 0x7C, 0x00 }, + { 0x91, 0x3F }, + { 0xA6, 0x04 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetGammaRamp +// ****************************************************************** +SOOVPA<7> D3DDevice_SetGammaRamp_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0F, 0x68 }, + { 0x20, 0x34 }, + { 0x31, 0xB4 }, + { 0x42, 0x08 }, + { 0x53, 0xF3 }, + { 0x64, 0xCA }, + { 0x75, 0x07 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_GetProjectionViewportMatrix +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_GetProjectionViewportMatrix_1_0_5455 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x02, 0x35 }, + { 0x07, 0x57 }, + { 0x0A, 0x24 }, + { 0x0E, 0x60 }, + { 0x12, 0xB9 }, + { 0x16, 0x00 }, + { 0x1A, 0x5E }, + } +}; + // ****************************************************************** // * D3D8_1_0_5558 // ****************************************************************** @@ -1250,9 +1486,9 @@ OOVPATable D3D8_1_0_5558[] = "EmuIDirect3DDevice8_SetRenderState_StencilEnable" #endif }, - // IDirect3DDevice8::SetRenderState_StencilFail (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_StencilFail (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, @@ -1300,9 +1536,9 @@ OOVPATable D3D8_1_0_5558[] = "EmuIDirect3DVertexBuffer8_Lock2" #endif }, - // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable, @@ -1320,9 +1556,9 @@ OOVPATable D3D8_1_0_5558[] = "EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias" #endif }, - // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, @@ -1330,9 +1566,9 @@ OOVPATable D3D8_1_0_5558[] = "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" #endif }, - // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable, @@ -1491,7 +1727,7 @@ OOVPATable D3D8_1_0_5558[] = #endif }, // IDirect3DTexture8::LockRect (* unchanged since 5233 *) - { + /*{ (OOVPA*)&IDirect3DTexture8_LockRect_1_0_5233, XTL::EmuIDirect3DTexture8_LockRect, @@ -1499,7 +1735,7 @@ OOVPATable D3D8_1_0_5558[] = #ifdef _DEBUG_TRACE "EmuIDirect3DTexture8_LockRect" #endif - }, + },*/ // IDirect3DSurface8::LockRect (* unchanged since 3925 *) { (OOVPA*)&IDirect3DSurface8_LockRect_1_0_3925, @@ -1723,6 +1959,153 @@ OOVPATable D3D8_1_0_5558[] = "EmuIDirect3DDevice8_GetTransform" #endif }, + // IDirect3DDevice8::CreateIndexBuffer2 + { + (OOVPA*)&D3DDevice_CreateIndexBuffer2_1_0_5558, + + XTL::EmuIDirect3DDevice8_CreateIndexBuffer2, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreateIndexBuffer2" + #endif + }, + // IDirect3DDevice8::CreateIndexBuffer + { + (OOVPA*)&IDirect3DDevice8_CreateIndexBuffer_1_0_5558, + + XTL::EmuIDirect3DDevice8_CreateIndexBuffer, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreateIndexBuffer" + #endif + }, + // IDirect3D8::GetAdapterModeCount (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3D8_GetAdapterModeCount_1_0_4361, + + XTL::EmuIDirect3D8_GetAdapterModeCount, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_GetAdapterModeCount" + #endif + }, + // IDirect3D8::EnumAdapterModes (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3D8_EnumAdapterModes_1_0_4361, + + XTL::EmuIDirect3D8_EnumAdapterModes, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_EnumAdapterModes" + #endif + }, + // D3DDevice_SetVerticalBlankCallback + { + (OOVPA*)&D3DDevice_SetVerticalBlankCallback_1_0_5558, + XTL::EmuIDirect3DDevice8_SetVerticalBlankCallback, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVerticalBlankCallback" + #endif + }, + // D3DDevice_SetVerticalBlankCallback + { + (OOVPA*)&IDirect3DDevice8_SetVerticalBlankCallback_1_0_5455, + XTL::EmuIDirect3DDevice8_SetVerticalBlankCallback, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVerticalBlankCallback (5455)" + #endif + }, + // D3DDevice_SetSwapCallback + { + (OOVPA*)&D3DDevice_SetSwapCallback_1_0_5558, + XTL::EmuIDirect3DDevice8_SetSwapCallback, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetSwapCallback" + #endif + }, + // IDirect3DDevice8::GetGammaRamp (* unchanged since 4034 *) + { + (OOVPA*)&IDirect3DDevice8_GetGammaRamp_1_0_4034, + + XTL::EmuIDirect3DDevice8_GetGammaRamp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetGammaRamp" + #endif + }, + // IDirect3DDevice8::SetRenderState_TextureFactor + { + (OOVPA*)&D3DDevice_SetRenderState_TextureFactor_1_0_5558, + + XTL::EmuIDirect3DDevice8_SetRenderState_TextureFactor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_TextureFactor" + #endif + }, + // IDirect3DDevice8::SetRenderState_VertexBlend (* unchanged since 4361 *) + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_VertexBlend_1_0_4361, + + XTL::EmuIDirect3DDevice8_SetRenderState_VertexBlend, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_VertexBlend" + #endif + }, + // IDirect3D8::KickOffAndWaitForIdle (* unchanged since 5233 *) + { + (OOVPA*)&IDirect3D8_KickOffAndWaitForIdle_1_0_5233, + + XTL::EmuIDirect3D8_KickOffAndWaitForIdle, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_KickOffAndWaitForIdle" + #endif + }, + // IDirect3DDevice8::Reset (* unchanged since 4134 *) + { + (OOVPA*)&IDirect3DDevice8_Reset_1_0_4134, + + XTL::EmuIDirect3DDevice8_Reset, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_Reset" + #endif + }, + // IDirect3DDevice8::SetGammaRamp (* unchanged since 4928 *) + { + (OOVPA*)&IDirect3DDevice8_SetGammaRamp_1_0_4928, + + XTL::EmuIDirect3DDevice8_SetGammaRamp, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetGammaRamp" + #endif + }, + // IDirect3DDevice8::GetViewport + { + (OOVPA*)&D3DDevice_GetViewport_1_0_5558, + + XTL::EmuIDirect3DDevice8_GetViewport, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetViewport" + #endif + }, + // IDirect3DDevice8_GetProjectionViewportMatrix + { + (OOVPA*)&IDirect3DDevice8_GetProjectionViewportMatrix_1_0_5455, + + XTL::EmuIDirect3DDevice8_GetProjectionViewportMatrix, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetProjectionViewportMatrix (5455)" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5849.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5849.inl index 965880d5f..1fe7a9d4f 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5849.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5849.inl @@ -841,6 +841,51 @@ SOOVPA<7> IDirect3DDevice8_SetVerticalBlankCallback_1_0_5849 = } }; +// ****************************************************************** +// * D3DDevice_SetViewport +// ****************************************************************** +SOOVPA<8> D3DDevice_SetViewport_1_0_5849 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x86 }, + { 0x3E, 0x1B }, + { 0x5E, 0x8B }, + { 0x7E, 0x6D }, + { 0x9E, 0x81 }, + { 0xBE, 0x0C }, + { 0xDE, 0x75 }, + { 0xFE, 0x85 }, + } +}; + +// ****************************************************************** +// * D3DDevice_BlockUntilVerticalBlank +// ****************************************************************** +SOOVPA<7> D3DDevice_BlockUntilVerticalBlank_1_0_5849 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x05, 0x6A }, + { 0x08, 0x00 }, + { 0x0D, 0xC0 }, + { 0x12, 0x00 }, + { 0x17, 0x05 }, + { 0x1C, 0x50 }, + { 0x23, 0xC3 }, + } +}; + // ****************************************************************** // * D3D8_1_0_5849 // ****************************************************************** @@ -1176,9 +1221,9 @@ OOVPATable D3D8_1_0_5849[] = "EmuIDirect3DDevice8_SetRenderState_StencilEnable" #endif }, - // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable, @@ -1196,9 +1241,9 @@ OOVPATable D3D8_1_0_5849[] = "EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias" #endif }, - // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_ShadowFunc (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, @@ -1206,9 +1251,9 @@ OOVPATable D3D8_1_0_5849[] = "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" #endif }, - // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4432 *) + // IDirect3DDevice8::SetRenderState_YuvEnable (* unchanged since 4134 *) { - (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4432, + (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable, @@ -1626,6 +1671,36 @@ OOVPATable D3D8_1_0_5849[] = "EmuIDirect3DDevice8_SetRenderTarget" #endif }, + // IDirect3DDevice8::SetShaderConstantMode (* unchanged since 5233 *) + { + (OOVPA*)&IDirect3DDevice8_SetShaderConstantMode_1_0_5233, + + XTL::EmuIDirect3DDevice8_SetShaderConstantMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetShaderConstantMode" + #endif + }, + // IDirect3DDevice8::SetViewport + { + (OOVPA*)&D3DDevice_SetViewport_1_0_5849, + + XTL::EmuIDirect3DDevice8_SetViewport, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetViewport" + #endif + }, + // IDirect3DDevice8::BlockUntilVerticalBlank + { + (OOVPA*)&D3DDevice_BlockUntilVerticalBlank_1_0_5849, + + XTL::EmuIDirect3DDevice8_BlockUntilVerticalBlank, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_BlockUntilVerticalBlank" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/D3D8LTCG.1.0.5849.h b/src/CxbxKrnl/HLEDataBase/D3D8LTCG.1.0.5849.h new file mode 100644 index 000000000..44c6e3d2c --- /dev/null +++ b/src/CxbxKrnl/HLEDataBase/D3D8LTCG.1.0.5849.h @@ -0,0 +1,45 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->D3D8LTCG.1.0.5849.h +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** +#ifndef D3D8LTCG_1_0_5849_H +#define D3D8LTCG_1_0_5849_H + +#include "OOVPA.h" + +extern SOOVPA<13> IDirect3DDevice8_SetRenderState_CullMode_1_0_5849_LTCG; +extern SOOVPA<10> IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_5849_LTCG; + +extern OOVPATable D3D8LTCG_1_0_5849[]; +extern uint32 D3D8LTCG_1_0_5849_SIZE; + +#endif diff --git a/src/CxbxKrnl/HLEDataBase/D3D8LTCG.1.0.5849.inl b/src/CxbxKrnl/HLEDataBase/D3D8LTCG.1.0.5849.inl new file mode 100644 index 000000000..b2acdca04 --- /dev/null +++ b/src/CxbxKrnl/HLEDataBase/D3D8LTCG.1.0.5849.inl @@ -0,0 +1,1659 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->D3D8LTCG.1.0.5849.cpp +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** + +// Verteks 09/03/2009 +// For Burnout 3 Takedown + +// ****************************************************************** +// * IDirect3D8_CreateDevice +// ****************************************************************** +SOOVPA<8> IDirect3D8_CreateDevice_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3D8_CreateDevice+0x07 : jnz +0x0A + { 0x07, 0x75 }, // (Offset,Value)-Pair #1 + { 0x08, 0x0A }, // (Offset,Value)-Pair #2 + + // IDirect3D8_CreateDevice+0x7F : rep stos + { 0x7F, 0xF3 }, // (Offset,Value)-Pair #3 + { 0x80, 0xAB }, // (Offset,Value)-Pair #4 + + // IDirect3D8_CreateDevice+0x82 : mov eax, esi + { 0x82, 0x8B }, // (Offset,Value)-Pair #5 + { 0x83, 0xC6 }, // (Offset,Value)-Pair #6 + + // IDirect3D8_CreateDevice+0x8F : retn 0x18 + { 0x8F, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x90, 0x18 }, // (Offset,Value)-Pair #8 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetPixelShader +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetPixelShader_1_0_5849_LTCG = +{ + 0, // Large == 0 + 9, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3D8_SetPixelShader+0x1E : jnz +0x67 + { 0x1E, 0x75 }, // (Offset,Value)-Pair #1 + { 0x1F, 0x67 }, // (Offset,Value)-Pair #2 + + // IDirect3D8_SetPixelShader+0x3E : or eax, 0x2000 + { 0x3E, 0x0D }, // (Offset,Value)-Pair #3 + { 0x3F, 0x00 }, // (Offset,Value)-Pair #4 + + // IDirect3D8_SetPixelShader+0x60 : push eax + { 0x60, 0x50 }, // (Offset,Value)-Pair #5 + + // IDirect3D8_SetPixelShader+0x61 : shr eax, 1 + { 0x61, 0xD1 }, // (Offset,Value)-Pair #6 + { 0x62, 0xE8 }, // (Offset,Value)-Pair #7 + + // IDirect3D8_SetPixelShader+0xE1 : jb +0x0E + { 0xE1, 0x72 }, // (Offset,Value)-Pair #8 + { 0xE2, 0x0E }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_CreateVertexShader +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_CreateVertexShader_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + { 0x1E, 0x85 }, + { 0x3E, 0xE8 }, + { 0x5E, 0x75 }, + { 0x7E, 0x04 }, + { 0x9E, 0x24 }, + { 0xBE, 0x8B }, + { 0xDE, 0x73 }, + { 0xFD, 0xC7 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_DrawIndexedVertices +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_DrawIndexedVertices_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + { 0x13, 0x89 }, + { 0x3E, 0x3B }, + { 0x5E, 0x05 }, + { 0x7E, 0xC3 }, + { 0x9E, 0xC1 }, + { 0xC4, 0x03 }, + { 0xDE, 0xE2 }, + { 0xFD, 0xEA }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetVertexShader +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetVertexShader_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + { 0x1E, 0x89 }, + { 0x3B, 0x33 }, + { 0x5E, 0x83 }, + { 0x80, 0x0A }, + { 0x9E, 0x00 }, + { 0xBE, 0x04 }, + { 0xDE, 0x83 }, + { 0xF4, 0x08 }, + } +}; + +// Verteks 10/03/2009 + +// ****************************************************************** +// * IDirect3DDevice8_SetTexture +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetTexture_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + { 0x1E, 0x7C }, + { 0x3C, 0xE8 }, + { 0x5F, 0xE8 }, + { 0x7E, 0x45 }, + { 0x9E, 0x08 }, + { 0xBE, 0x0C }, + { 0xDE, 0x0F }, + { 0xFE, 0x8D }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetViewport +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetViewport_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0xAE }, + { 0x3E, 0x53 }, + { 0x5E, 0x00 }, + { 0x7E, 0x12 }, + { 0x9E, 0x75 }, + { 0xBE, 0x4C }, + { 0xDE, 0xE1 }, + { 0xF9, 0x7D }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetLight +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetLight_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x00 }, + { 0x3E, 0x89 }, + { 0x5E, 0x00 }, + { 0x7E, 0x07 }, + { 0x9E, 0xC8 }, + { 0xBE, 0xC9 }, + { 0xDE, 0x07 }, + { 0xFD, 0xC1 }, + } +}; + +/* Same as 5558 +// ****************************************************************** +// * IDirect3DDevice8_SetTransform +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetTransform_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1D, 0xB9 }, + { 0x3E, 0x0F }, + { 0x5E, 0xD9 }, + { 0x7A, 0x00 }, + { 0x99, 0x83 }, + { 0xB8, 0xE0 }, + { 0xD7, 0xD9 }, + { 0xF6, 0xF6 }, + } +}; +*/ + +/* Same as 5849 +// ****************************************************************** +// * IDirect3DDevice8_SetMaterial +// ****************************************************************** +SOOVPA<9> IDirect3DDevice8_SetMaterial_1_0_5849_LTCG = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x04, 0x08 }, + { 0x0C, 0x81 }, + { 0x0E, 0x00 }, + { 0x10, 0x00 }, + { 0x16, 0x00 }, + { 0x1F, 0x81 }, + { 0x22, 0x90 }, + { 0x2C, 0x5E }, + { 0x2E, 0x04 }, + } +}; +*/ + +// ****************************************************************** +// * IDirect3DDevice8_SetStreamSource +// ****************************************************************** +SOOVPA<14> IDirect3DDevice8_SetStreamSource_1_0_5849_LTCG = +{ + 0, // Large == 0 + 14, // Count == 14 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetStreamSource+0x07 : mov ebx, [esp+0x0C] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x5C }, // (Offset,Value)-Pair #2 + { 0x09, 0x24 }, // (Offset,Value)-Pair #3 + { 0x0A, 0x0C }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetStreamSource+0x28 : jz +0x26 + { 0x28, 0x74 }, // (Offset,Value)-Pair #5 + { 0x29, 0x26 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetStreamSource+0x70 : or ecx, 0x40 + { 0x70, 0x83 }, // (Offset,Value)-Pair #7 + { 0x71, 0xC9 }, // (Offset,Value)-Pair #8 + { 0x72, 0x40 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetStreamSource+0x7E : or ecx, 0x70 + { 0x7E, 0x83 }, // (Offset,Value)-Pair #10 + { 0x7F, 0xC9 }, // (Offset,Value)-Pair #11 + { 0x80, 0x70 }, // (Offset,Value)-Pair #12 + + // IDirect3DDevice8_SetStreamSource+0x89 : retn 0x0C + { 0x89, 0xC2 }, // (Offset,Value)-Pair #13 + { 0x8A, 0x0C }, // (Offset,Value)-Pair #14 + } +}; + +/* Same as 5849 +// ****************************************************************** +// * IDirect3DDevice8_SetVertexShaderConstant1 +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetVertexShaderConstant1_1_0_5849_LTCG = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetVertexShaderConstant1+0x06 : add eax, 0x1C + { 0x06, 0x83 }, // (Offset,Value)-Pair #1 + { 0x07, 0xC0 }, // (Offset,Value)-Pair #2 + { 0x08, 0x1C }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetVertexShaderConstant1+0x0F : jnb +0x43 + { 0x0F, 0x73 }, // (Offset,Value)-Pair #4 + { 0x10, 0x43 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetVertexShaderConstant1+0x1D : mov [eax-0x18], ecx + { 0x1D, 0x89 }, // (Offset,Value)-Pair #6 + { 0x1E, 0x48 }, // (Offset,Value)-Pair #7 + { 0x1F, 0xE8 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetVertexShaderConstant1+0x53 : retn + { 0x53, 0xC3 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetVertexShaderConstant1+0x5D : jmp +0xA2 + { 0x5D, 0xEB }, // (Offset,Value)-Pair #10 + { 0x5E, 0xA2 }, // (Offset,Value)-Pair #11 + } +}; +*/ + +/* Same as 5849 +// ****************************************************************** +// * IDirect3DDevice8_CreateVertexBuffer2 +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_CreateVertexBuffer2_1_0_5849_LTCG = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x08, 0xE8 }, + { 0x12, 0x1E }, + { 0x1C, 0x50 }, + { 0x26, 0x68 }, + { 0x31, 0x33 }, + { 0x3A, 0xFF }, + { 0x44, 0x01 }, + } +}; +*/ + +// ****************************************************************** +// * IDirect3DDevice8_SetTextureState_TexCoordIndex +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_5849_LTCG = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTextureState_TexCoordIndex+0x14 : shl eax, 0x07 + { 0x14, 0xC1 }, // (Offset,Value)-Pair #1 + { 0x15, 0xE0 }, // (Offset,Value)-Pair #2 + { 0x16, 0x07 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetTextureState_TexCoordIndex+0x26 : cmp eax, ecx + { 0x26, 0x3B }, // (Offset,Value)-Pair #4 + { 0x27, 0xC1 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetTextureState_TexCoordIndex+0x7A : mov ebp, 0x2400 + { 0x7A, 0xBD }, // (Offset,Value)-Pair #6 + { 0x7C, 0x24 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetTextureState_TexCoordIndex+0xB3 : shl ebx, 0x04 + { 0xB3, 0xC1 }, // (Offset,Value)-Pair #8 + { 0xB4, 0xE3 }, // (Offset,Value)-Pair #9 + { 0xB5, 0x04 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetTextureState_BumpEnv +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetTextureState_BumpEnv_1_0_5849_LTCG = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTextureState_BumpEnv+0x18 : jnz +0x03 + { 0x18, 0x75 }, // (Offset,Value)-Pair #1 + { 0x19, 0x03 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetTextureState_BumpEnv+0x1D : test bl, 3 + { 0x1D, 0xF6 }, // (Offset,Value)-Pair #3 + { 0x1E, 0xC3 }, // (Offset,Value)-Pair #4 + { 0x1F, 0x03 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetTextureState_BumpEnv+0x3B : mov ecx, [esp+0x18] + { 0x3B, 0x8B }, // (Offset,Value)-Pair #6 + { 0x3C, 0x4C }, // (Offset,Value)-Pair #7 + { 0x3D, 0x24 }, // (Offset,Value)-Pair #8 + { 0x3E, 0x18 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetTextureState_BumpEnv+0x59 : shl esi, 5 + { 0x59, 0xC1 }, // (Offset,Value)-Pair #10 + { 0x5A, 0xE6 }, // (Offset,Value)-Pair #11 + { 0x5B, 0x05 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetTextureState_BorderColor +// ****************************************************************** +SOOVPA<15> IDirect3DDevice8_SetTextureState_BorderColor_1_0_5849_LTCG = +{ + 0, // Large == 0 + 15, // Count == 15 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTextureState_BorderColor+0x0C : jb +0x0E + { 0x0C, 0x72 }, // (Offset,Value)-Pair #1 + { 0x0D, 0x0E }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetTextureState_BorderColor+0x22 : shl edx, 6 + { 0x22, 0xC1 }, // (Offset,Value)-Pair #3 + { 0x23, 0xE2 }, // (Offset,Value)-Pair #4 + { 0x24, 0x06 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetTextureState_BorderColor+0x34 : add eax, 8; mov [esi], eax; shl ecx, 7 + { 0x34, 0x83 }, // (Offset,Value)-Pair #6 + { 0x35, 0xC0 }, // (Offset,Value)-Pair #7 + { 0x36, 0x08 }, // (Offset,Value)-Pair #8 + { 0x37, 0x89 }, // (Offset,Value)-Pair #9 + { 0x38, 0x06 }, // (Offset,Value)-Pair #10 + { 0x39, 0xC1 }, // (Offset,Value)-Pair #11 + { 0x3A, 0xE1 }, // (Offset,Value)-Pair #12 + { 0x3B, 0x07 }, // (Offset,Value)-Pair #13 + + // IDirect3DDevice8_SetTextureState_BorderColor+0x43 : retn 0x08 + { 0x43, 0xC2 }, // (Offset,Value)-Pair #14 + { 0x44, 0x08 }, // (Offset,Value)-Pair #15 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_CullMode +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_CullMode_1_0_5849_LTCG = +{ + 0, // Large == 0 + 13, // Count == 13 + + XREF_DXSRSCULLMODE, // XRef Is Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_CullMode+0x22 : mov dword ptr [eax], 0x40308 + { 0x22, 0xC7 }, // (Offset,Value)-Pair #1 + { 0x24, 0x08 }, // (Offset,Value)-Pair #2 + { 0x25, 0x03 }, // (Offset,Value)-Pair #3 + { 0x26, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_CullMode+0x2D : add eax, 8 + { 0x2D, 0x83 }, // (Offset,Value)-Pair #5 + { 0x2E, 0xC0 }, // (Offset,Value)-Pair #6 + { 0x2F, 0x08 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_SetRenderState_CullMode+0x39 : retn 4 + { 0x39, 0xC2 }, // (Offset,Value)-Pair #8 + { 0x3A, 0x04 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetRenderState_CullMode+0x5C : add edx, 0x404 + { 0x5C, 0x81 }, // (Offset,Value)-Pair #10 + { 0x5D, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x5E, 0x04 }, // (Offset,Value)-Pair #12 + { 0x5F, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_TextureFactor +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_SetRenderState_TextureFactor_1_0_5849_LTCG = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + { 0x09, 0x84 }, + { 0x14, 0x46 }, + { 0x28, 0x24 }, + { 0x33, 0xBA }, + { 0x3D, 0x4A }, + { 0x48, 0x5E }, + { 0x55, 0x5E }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_NormalizeNormals +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetRenderState_NormalizeNormals_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_NormalizeNormals+0x07 : mov eax, [esi] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x06 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_NormalizeNormals+0x2E : or [addr], 0x200 + { 0x2E, 0x81 }, // (Offset,Value)-Pair #3 + { 0x2F, 0x0D }, // (Offset,Value)-Pair #4 + { 0x34, 0x00 }, // (Offset,Value)-Pair #5 + { 0x35, 0x02 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_NormalizeNormals+0x3F : retn 0x04 + { 0x3F, 0xC2 }, // (Offset,Value)-Pair #7 + { 0x40, 0x04 }, // (Offset,Value)-Pair #8 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_ZEnable +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetRenderState_ZEnable_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0C, 0x72 }, + { 0x2B, 0xC9 }, + { 0x3D, 0x89 }, + { 0x4F, 0x0C }, + { 0x63, 0x74 }, + { 0x74, 0x8B }, + { 0x8A, 0x8B }, + { 0x97, 0x06 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_StencilEnable +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetRenderState_StencilEnable_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + { + { 0x12, 0x8B }, + { 0x2D, 0x33 }, + { 0x40, 0x74 }, + { 0x4A, 0x74 }, + { 0x63, 0x89 }, + { 0x79, 0xB9 }, + { 0x92, 0x33 }, + { 0x9F, 0x04 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_Swap +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_Swap_1_0_5849_LTCG = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + { 0x1B, 0xE8 }, + { 0x38, 0xC3 }, + { 0x55, 0xC0 }, + { 0x72, 0xEB }, + { 0x93, 0x85 }, + { 0xAA, 0xC6 }, + { 0xC9, 0x0A }, + } +}; + +/* Same as 4627 +// ****************************************************************** +// * IDirect3DDevice8_SetVertexData2f +// ****************************************************************** +SOOVPA<14> IDirect3DDevice8_SetVertexData2f_1_0_5849_LTCG = +{ + 0, // Large == 0 + 14, // Count == 14 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetVertexData2f+0x20 : lea edx, ds:abs[ecx*8] + { 0x20, 0x8D }, // (Offset,Value)-Pair #1 + { 0x21, 0x14 }, // (Offset,Value)-Pair #2 + { 0x22, 0xCD }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetVertexData2f+0x2B : mov [eax], edx; mov edx, [esp+0x10] + { 0x2B, 0x89 }, // (Offset,Value)-Pair #4 + { 0x2C, 0x10 }, // (Offset,Value)-Pair #5 + { 0x2D, 0x8B }, // (Offset,Value)-Pair #6 + { 0x2E, 0x54 }, // (Offset,Value)-Pair #7 + { 0x2F, 0x24 }, // (Offset,Value)-Pair #8 + { 0x30, 0x10 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetVertexData2f+0x37 : add eax, 0x0C + { 0x37, 0x83 }, // (Offset,Value)-Pair #10 + { 0x38, 0xC0 }, // (Offset,Value)-Pair #11 + { 0x39, 0x0C }, // (Offset,Value)-Pair #12 + + // IDirect3DDevice8_SetVertexData2f+0x3D : retn 0x0C + { 0x3D, 0xC2 }, // (Offset,Value)-Pair #13 + { 0x3E, 0x0C }, // (Offset,Value)-Pair #14 + } +}; +*/ + +// ****************************************************************** +// * IDirect3DDevice8_End +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_End_1_0_5849_LTCG = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + { 0x07, 0x8B }, + { 0x13, 0x50 }, + { 0x1C, 0xC7 }, + { 0x22, 0xC7 }, + { 0x2B, 0x08 }, + { 0x34, 0xE1 }, + { 0x49, 0xC3 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_FillMode +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetRenderState_FillMode_1_0_5849_LTCG = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_FillMode+0x07 : mov eax, [esi] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x06 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_FillMode+0x2A : mov ecx, [esp+0x08] + { 0x2A, 0x8B }, // (Offset,Value)-Pair #3 + { 0x2B, 0x4C }, // (Offset,Value)-Pair #4 + { 0x2C, 0x24 }, // (Offset,Value)-Pair #5 + { 0x2D, 0x08 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_FillMode+0x2E : jnz +0x02 + { 0x2E, 0x75 }, // (Offset,Value)-Pair #7 + { 0x2F, 0x02 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_FillMode+0x3E : add eax, 0x0C + { 0x3E, 0x83 }, // (Offset,Value)-Pair #9 + { 0x3F, 0xC0 }, // (Offset,Value)-Pair #10 + { 0x40, 0x0C }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_FogColor +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetRenderState_FogColor_1_0_5849_LTCG = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_FogColor+0x07 : mov eax, [esi] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x06 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_FogColor+0x09 : cmp eax, [esi+4] + { 0x09, 0x3B }, // (Offset,Value)-Pair #3 + { 0x0A, 0x46 }, // (Offset,Value)-Pair #4 + { 0x0B, 0x04 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_FogColor+0x2E : shl edi, 0x10 + { 0x2E, 0xC1 }, // (Offset,Value)-Pair #6 + { 0x2F, 0xE7 }, // (Offset,Value)-Pair #7 + { 0x30, 0x10 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_FogColor+0x49 : mov [esi], eax + { 0x49, 0x89 }, // (Offset,Value)-Pair #9 + { 0x4A, 0x06 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_DrawVertices +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_DrawVertices_1_0_5849_LTCG = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x11, 0x8B }, + { 0x26, 0x46 }, + { 0x3C, 0xD1 }, + { 0x45, 0x3B }, + { 0x5D, 0x4C }, + { 0x70, 0xFF }, + { 0x83, 0xC1 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_DrawVerticesUP +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_DrawVerticesUP_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0xA1 }, + { 0x3E, 0x8B }, + { 0x5E, 0x08 }, + { 0x7E, 0xD0 }, + { 0x9E, 0x14 }, + { 0xBE, 0x8D }, + { 0xDE, 0x3B }, + { 0xFE, 0x81 }, + } +}; + +// Verteks 11/03/2009 + +// ****************************************************************** +// * D3DVertexBuffer_Lock2 +// ****************************************************************** +SOOVPA<7> IDirect3DVertexBuffer8_Lock2_1_0_5849_LTCG = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x08, 0x56 }, + { 0x12, 0x06 }, + { 0x26, 0xC7 }, + { 0x2F, 0x00 }, + { 0x39, 0xC3 }, + { 0x68, 0x80 }, + { 0x7A, 0x04 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_YuvEnable +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_YuvEnable_1_0_5849_LTCG = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_YuvEnable+0x00 : mov eax, [esp+0x04] + { 0x00, 0x8B }, // (Offset,Value)-Pair #1 + { 0x01, 0x44 }, // (Offset,Value)-Pair #2 + { 0x02, 0x24 }, // (Offset,Value)-Pair #3 + { 0x03, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x10 : mov eax, [esi] + { 0x10, 0x8B }, // (Offset,Value)-Pair #5 + { 0x11, 0x06 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x12 : cmp eax, [esi+4] + { 0x12, 0x3B }, // (Offset,Value)-Pair #7 + { 0x13, 0x46 }, // (Offset,Value)-Pair #8 + { 0x14, 0x04 }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x15 : jb +0x0E + { 0x15, 0x72 }, // (Offset,Value)-Pair #10 + { 0x16, 0x0E }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_YuvEnable+0x30 : retn 0x04 + { 0x30, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x31, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_ShadowFunc +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_5849_LTCG = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x00 : push esi + { 0x00, 0x56 }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x09 : cmp eax, [esi+4] + { 0x09, 0x3B }, // (Offset,Value)-Pair #2 + { 0x0A, 0x46 }, // (Offset,Value)-Pair #3 + { 0x0B, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x0C : jb +0x0E + { 0x0C, 0x72 }, // (Offset,Value)-Pair #5 + { 0x0D, 0x0E }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x26 : lea edx, [ecx-0x0200] + { 0x26, 0x8D }, // (Offset,Value)-Pair #7 + { 0x27, 0x91 }, // (Offset,Value)-Pair #8 + { 0x28, 0x00 }, // (Offset,Value)-Pair #9 + { 0x29, 0xFE }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x2F : add eax, 0x08 + { 0x2F, 0x83 }, // (Offset,Value)-Pair #11 + { 0x30, 0xC0 }, // (Offset,Value)-Pair #12 + { 0x31, 0x08 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_OcclusionCullEnable +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_5849_LTCG = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x15 : jb +0x0E + { 0x15, 0x72 }, // (Offset,Value)-Pair #1 + { 0x16, 0x0E }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x4A : cmp [abs], 0x1E00 + { 0x4A, 0x81 }, // (Offset,Value)-Pair #3 + { 0x50, 0x00 }, // (Offset,Value)-Pair #4 + { 0x51, 0x1E }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x59 : mov dword ptr [eax], 0x41D84 + { 0x59, 0xC7 }, // (Offset,Value)-Pair #6 + { 0x5A, 0x00 }, // (Offset,Value)-Pair #7 + { 0x5B, 0x84 }, // (Offset,Value)-Pair #8 + { 0x5C, 0x1D }, // (Offset,Value)-Pair #9 + { 0x5D, 0x04 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_OcclusionCullEnable+0x68 : retn 0x04 + { 0x68, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x69, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_EdgeAntiAlias +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetRenderState_EdgeAntiAlias_1_0_5849_LTCG = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x07 : mov eax, [esi] + { 0x07, 0x8B }, // (Offset,Value)-Pair #1 + { 0x08, 0x06 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x0C : jb +0x0E + { 0x0C, 0x72 }, // (Offset,Value)-Pair #3 + { 0x0D, 0x0E }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x1C : mov ecx, [esp+0x08] + { 0x1C, 0x8B }, // (Offset,Value)-Pair #5 + { 0x1D, 0x4C }, // (Offset,Value)-Pair #6 + { 0x1E, 0x24 }, // (Offset,Value)-Pair #7 + { 0x1F, 0x08 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetRenderState_EdgeAntiAlias+0x38 : retn 0x04 + { 0x38, 0xC2 }, // (Offset,Value)-Pair #9 + { 0x39, 0x04 }, // (Offset,Value)-Pair #10 + } +}; + +// I am not sure about this +// ****************************************************************** +// * IDirect3DTexture8_GetLevelDesc +// ****************************************************************** +// * NOTE: We are actually intercepting Get2DSurfaceDesc, because +// * GetLevelDesc Simply redirects to that function +// ****************************************************************** +SOOVPA<9> Get2DSurfaceDesc_1_0_5849_LTCG = +{ + 0, // Large == 0 + 9, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // Get2DSurfaceDesc+0x1E : movzx ecx, byte ptr [edi+0x0D] + { 0x1E, 0x0F }, // (Offset,Value)-Pair #1 + { 0x1F, 0xB6 }, // (Offset,Value)-Pair #2 + { 0x20, 0x4F }, // (Offset,Value)-Pair #3 + { 0x21, 0x0D }, // (Offset,Value)-Pair #4 + + // Get2DSurfaceDesc+0x45 : mov edx, [eax+0x1A14] + { 0x45, 0x8B }, // (Offset,Value)-Pair #5 + { 0x46, 0x90 }, // (Offset,Value)-Pair #6 + { 0x47, 0x14 }, // (Offset,Value)-Pair #7 + { 0x48, 0x1A }, // (Offset,Value)-Pair #8 + + // Get2DSurfaceDesc+0x9E : retn + { 0x9E, 0xC3 }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetShaderConstantMode +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetShaderConstantMode_1_0_5849_LTCG = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x19, 0xFD }, + { 0x38, 0x8B }, + { 0x60, 0x0B }, + { 0x7A, 0xBA }, + { 0xA4, 0xC0 }, + { 0xB2, 0x00 }, + { 0xDA, 0x89 }, + { 0xF9, 0x00 }, + } +}; + +/* +I don't know which one of these is the right one : +0x0034E040 2 args +0x0034E200 2 args +0x0034F150 3 args +// ****************************************************************** +// * IDirect3DDevice8_SetIndices +// ****************************************************************** +SOOVPA<7> IDirect3DDevice8_SetIndices_1_0_5849 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + { 0x0F, 0x10 }, + { 0x20, 0xC7 }, + { 0x31, 0xC0 }, + { 0x42, 0x78 }, + { 0x53, 0xBE }, + { 0x64, 0x89 }, + { 0x75, 0x10 }, + } +}; +*/ + +/* Maybe this : 0x0034D730 (NOT THIS) + It's : 0x0034CC00 (same as 3925) + + 0035FEE8 accessed by CreateDevice (must contain 0035DA40 ?) +0034D730 /$ A1 E8FE3500 mov eax, dword ptr ds:[35FEE8] +0034D735 |. 8B88 041A0000 mov ecx, dword ptr ds:[eax+1A04] <- Exception here +0034D73B |. 85C9 test ecx, ecx +0034D73D |. 74 24 je short default.0034D763 +0034D73F |. 8B01 mov eax, dword ptr ds:[ecx] +0034D741 |. A9 FFFF0000 test eax, 0FFFF +0034D746 |. 75 19 jnz short default.0034D761 +0034D748 |. 25 00000700 and eax, 70000 +0034D74D |. 3D 00000500 cmp eax, default.00050000 +0034D752 |. 75 0D jnz short default.0034D761 +0034D754 |. 8B41 14 mov eax, dword ptr ds:[ecx+14] +0034D757 |. 85C0 test eax, eax +0034D759 |. 74 06 je short default.0034D761 +0034D75B |. 50 push eax +0034D75C |. E8 9FF4FFFF call default.0034CC00 <- IDirect3DResource8_AddRef +0034D761 |> FF01 inc dword ptr ds:[ecx] +0034D763 |> 8BC1 mov eax, ecx +0034D765 \. C3 retn +// ****************************************************************** +// * IDirect3DResource8_AddRef +// ****************************************************************** +SOOVPA<10> IDirect3DResource8_AddRef_1_0_5849_LTCG = +{ + 0, // Large == 0 + 10, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DResource8_AddRef+0x11 : test eax, 0xFFFF + { 0x11, 0xA9 }, // (Offset,Value)-Pair #1 + { 0x12, 0xFF }, // (Offset,Value)-Pair #2 + { 0x13, 0xFF }, // (Offset,Value)-Pair #3 + + // IDirect3DResource8_AddRef+0x18 : and eax, 0x00070000 + { 0x18, 0x25 }, // (Offset,Value)-Pair #4 + { 0x1B, 0x07 }, // (Offset,Value)-Pair #5 + + // IDirect3DResource8_AddRef+0x1D : cmp eax, 0x00050000 + { 0x1D, 0x3D }, // (Offset,Value)-Pair #6 + { 0x20, 0x05 }, // (Offset,Value)-Pair #7 + + // IDirect3DResource8_AddRef+0x2B : push eax + { 0x2B, 0x50 }, // (Offset,Value)-Pair #8 + + // IDirect3DResource8_AddRef+0x34 : mov eax, ecx + { 0x33, 0x8B }, // (Offset,Value)-Pair #9 + { 0x34, 0xC1 }, // (Offset,Value)-Pair #10 + } +}; +*/ + +// 0x0034CC40 +// ****************************************************************** +// * IDirect3DResource8_Release +// ****************************************************************** +SOOVPA<11> IDirect3DResource8_Release_1_0_5849_LTCG = +{ + 0, // Large == 0 + 11, // Count == 8 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DResource8_Release+0x09 : and ecx, 0xFFFF + { 0x09, 0x81 }, // (Offset,Value)-Pair #1 + { 0x0A, 0xE1 }, // (Offset,Value)-Pair #2 + { 0x0B, 0xFF }, // (Offset,Value)-Pair #3 + { 0x0C, 0xFF }, // (Offset,Value)-Pair #4 + + // IDirect3DResource8_Release+0x14 : and eax, 0x00070000 + { 0x14, 0x25 }, // (Offset,Value)-Pair #5 + { 0x17, 0x07 }, // (Offset,Value)-Pair #6 + + // IDirect3DResource8_Release+0x19 : cmp eax, 0x00050000 + { 0x19, 0x3D }, // (Offset,Value)-Pair #7 + { 0x1C, 0x05 }, // (Offset,Value)-Pair #8 + + // IDirect3DResource8_Release+0x3D : pop edi + { 0x3D, 0x5F }, // (Offset,Value)-Pair #9 + + // IDirect3DResource8_Release+0x4A : retn 0x04 + { 0x4A, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x4B, 0x04 }, // (Offset,Value)-Pair #11 + } +}; + +// Verteks 05/04/2009 +// ****************************************************************** +// * IDirect3DDevice8_SetTextureState_ColorKeyColor (Not sure) +// ****************************************************************** +SOOVPA<10> IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_5849_LTCG = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTextureState_ColorKeyColor+0x05 : cmp esi, 0x5C + { 0x05, 0x83 }, + { 0x06, 0xFE }, + { 0x07, 0x5C }, + + // IDirect3DDevice8_SetTextureState_ColorKeyColor+0x29 : cmp esi, 0x88 + { 0x29, 0x81 }, + { 0x2A, 0xFE }, + { 0x2B, 0x88 }, + + // IDirect3DDevice8_SetTextureState_ColorKeyColor+0x4A : retn 0x08 + { 0x4A, 0xC2 }, + { 0x4B, 0x08 }, + + // IDirect3DDevice8_SetTextureState_ColorKeyColor+0x5A : retn 0x08 + { 0x5A, 0xC2 }, + { 0x5B, 0x08 }, + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_Unknown1_3 +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_Unknown1_3_1_0_5849_LTCG = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_Unknown1_3+0x04 : cmp eax, 0x0C + { 0x04, 0x83 }, + { 0x05, 0xF8 }, + { 0x06, 0x0C }, + + // IDirect3DDevice8_Unknown1_3+0x48 : and ecx, 0xFFFFBFF1 + { 0x48, 0x81 }, + { 0x49, 0xE1 }, + { 0x4A, 0xF1 }, + { 0x4B, 0xBF }, + { 0x4C, 0xFF }, + { 0x4D, 0xFF }, + + // IDirect3DDevice8_Unknown1_3+0x69 : retn 0x0C + { 0x69, 0xC2 }, + { 0x6A, 0x0C }, + + // IDirect3DDevice8_Unknown1_3+0xD7 : retn 0x0C + { 0xD7, 0xC2 }, + { 0xD8, 0x0C }, + } +}; + +// ****************************************************************** +// * D3D8LTCG_1_0_5849 +// ****************************************************************** +OOVPATable D3D8LTCG_1_0_5849[] = +{ + // IDirect3D8::CreateDevice + { + (OOVPA*)&IDirect3D8_CreateDevice_1_0_5849_LTCG, + + XTL::EmuIDirect3D8_CreateDevice, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_CreateDevice" + #endif + }, + // IDirect3DDevice8::SetPixelShader + { + (OOVPA*)&IDirect3DDevice8_SetPixelShader_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetPixelShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetPixelShader" + #endif + }, + // IDirect3DDevice8::CreateVertexShader + { + (OOVPA*)&IDirect3DDevice8_CreateVertexShader_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_CreateVertexShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreateVertexShader" + #endif + }, + // IDirect3DDevice8::DrawIndexedVertices + { + (OOVPA*)&IDirect3DDevice8_DrawIndexedVertices_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_DrawIndexedVertices, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawIndexedVertices" + #endif + }, + // IDirect3DDevice8::SetVertexShader + { + (OOVPA*)&IDirect3DDevice8_SetVertexShader_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetVertexShader, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexShader" + #endif + }, + // IDirect3DDevice8::SetTexture + { + (OOVPA*)&IDirect3DDevice8_SetTexture_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetTexture, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTexture" + #endif + }, + // IDirect3DDevice8::SetViewport + { + (OOVPA*)&IDirect3DDevice8_SetViewport_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetViewport, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetViewport" + #endif + }, + // IDirect3DDevice8::SetLight + { + (OOVPA*)&IDirect3DDevice8_SetLight_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetLight, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetLight" + #endif + }, + // IDirect3DDevice8::SetTransform (* unchanged since 5558 *) + { + (OOVPA*)&IDirect3DDevice8_SetTransform_1_0_5558, + + XTL::EmuIDirect3DDevice8_SetTransform, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTransform" + #endif + }, + // IDirect3DDevice8::SetMaterial (* unchanged since 5849 *) + { + (OOVPA*)&IDirect3DDevice8_SetMaterial_1_0_5849, + + XTL::EmuIDirect3DDevice8_SetMaterial, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetMaterial" + #endif + }, + // IDirect3DDevice8::SetStreamSource + { + (OOVPA*)&IDirect3DDevice8_SetStreamSource_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetStreamSource, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetStreamSource" + #endif + }, + // IDirect3DDevice8::SetVertexShaderConstant1 (* unchanged since 5849 *) + { + (OOVPA*)&IDirect3DDevice8_SetVertexShaderConstant1_1_0_5849, + + XTL::EmuIDirect3DDevice8_SetVertexShaderConstant1, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexShaderConstant1" + #endif + }, + // IDirect3DDevice8::CreateVertexBuffer2 (* unchanged since 5849 *) + { + (OOVPA*)&IDirect3DDevice8_CreateVertexBuffer2_1_0_5849, + + XTL::EmuIDirect3DDevice8_CreateVertexBuffer2, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_CreateVertexBuffer2" + #endif + }, + // IDirect3DDevice8::SetTextureState_TexCoordIndex + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetTextureState_TexCoordIndex, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_TexCoordIndex" + #endif + }, + // IDirect3DDevice8::SetTextureState_BumpEnv + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_BumpEnv_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetTextureState_BumpEnv, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_BumpEnv" + #endif + }, + // IDirect3DDevice8::SetTextureState_BorderColor + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_BorderColor_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetTextureState_BorderColor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_BorderColor" + #endif + }, + // IDirect3DDevice8::SetRenderState_CullMode + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_CullMode_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_CullMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_CullMode" + #endif + }, + // IDirect3DDevice8::SetRenderState_TextureFactor + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_TextureFactor_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_TextureFactor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_TextureFactor" + #endif + }, + // IDirect3DDevice8::SetRenderState_NormalizeNormals + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_NormalizeNormals_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_NormalizeNormals, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_NormalizeNormals" + #endif + }, + // IDirect3DDevice8::SetRenderState_ZEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_ZEnable_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_ZEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_ZEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_StencilEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilEnable_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilEnable" + #endif + }, + // IDirect3DDevice8::Swap + { + (OOVPA*)&IDirect3DDevice8_Swap_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_Swap, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_Swap" + #endif + }, + // IDirect3DDevice8::SetVertexData2f (* unchanged since 4627 *) + { + (OOVPA*)&IDirect3DDevice8_SetVertexData2f_1_0_4627, + + XTL::EmuIDirect3DDevice8_SetVertexData2f, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData2f" + #endif + }, + // IDirect3DDevice8::End + { + (OOVPA*)&IDirect3DDevice8_End_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_End, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_End" + #endif + }, + // IDirect3DDevice8::SetRenderState_FillMode + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_FillMode_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_FillMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_FillMode" + #endif + }, + // IDirect3DDevice8::SetRenderState_FogColor + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_FogColor_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_FogColor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_FogColor" + #endif + }, + // IDirect3DDevice8::DrawVertices + { + (OOVPA*)&IDirect3DDevice8_DrawVertices_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_DrawVertices, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawVertices" + #endif + }, + // IDirect3DDevice8::DrawVerticesUP + { + (OOVPA*)&IDirect3DDevice8_DrawVerticesUP_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_DrawVerticesUP, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_DrawVerticesUP" + #endif + }, + // IDirect3DDevice8::SetVertexShaderConstant4 (* unchanged since 4627 *) + { + (OOVPA*)&IDirect3DDevice8_SetVertexShaderConstant4_1_0_4627, + + XTL::EmuIDirect3DDevice8_SetVertexShaderConstant4, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexShaderConstant4" + #endif + }, + // IDirect3DVertexBuffer8::Lock2 + { + (OOVPA*)&IDirect3DVertexBuffer8_Lock2_1_0_5849_LTCG, + + XTL::EmuIDirect3DVertexBuffer8_Lock2, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DVertexBuffer8_Lock2" + #endif + }, + // IDirect3DDevice8::SetRenderState_YuvEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_YuvEnable_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_YuvEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_YuvEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_ShadowFunc + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" + #endif + }, + // IDirect3DDevice8::SetRenderState_OcclusionCullEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable" + #endif + }, + // IDirect3DDevice8::SetRenderState_EdgeAntiAlias + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_EdgeAntiAlias_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias" + #endif + }, + // IDirect3DTexture8::GetLevelDesc + { + (OOVPA*)&Get2DSurfaceDesc_1_0_5849_LTCG, + + XTL::EmuGet2DSurfaceDesc, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DTexture8_GetLevelDesc" + #endif + }, + // IDirect3DDevice8::SetShaderConstantMode + { + (OOVPA*)&IDirect3DDevice8_SetShaderConstantMode_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetShaderConstantMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetShaderConstantMode" + #endif + }, + // IDirect3DResource8::AddRef + { + (OOVPA*)&IDirect3DResource8_AddRef_1_0_3925, + + XTL::EmuIDirect3DResource8_AddRef, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DResource8_AddRef" + #endif + }, + // IDirect3DResource8::Release + { + (OOVPA*)&IDirect3DResource8_Release_1_0_5849_LTCG, + + XTL::EmuIDirect3DResource8_Release, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DResource8_Release" + #endif + }, + + // IDirect3DDevice8::SetTextureState_ColorKeyColor + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_ColorKeyColor" + #endif + }, + + // IDirect3DDevice8::Unknown1_3 + /*{ + (OOVPA*)&IDirect3DDevice8_Unknown1_3_1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_Unknown1_3, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_Unknown1_3" + #endif + },*/ + + /* + // IDirect3DDevice8:: + { + (OOVPA*)&IDirect3DDevice8__1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_" + #endif + }, + */ + /* + // IDirect3DDevice8:: + { + (OOVPA*)&IDirect3DDevice8__1_0_5849_LTCG, + + XTL::EmuIDirect3DDevice8_, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_" + #endif + }, + */ +}; + +uint32 D3D8LTCG_1_0_5849_SIZE = sizeof(D3D8LTCG_1_0_5849); \ No newline at end of file diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.3936.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.3936.inl index be7e2b0ce..9a0274591 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.3936.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.3936.inl @@ -1152,6 +1152,39 @@ SOOVPA<11> CMcpxBuffer_GetCurrentPosition_1_0_3936 = } }; +// ****************************************************************** +// * CMcpxBuffer_GetCurrentPosition +// ****************************************************************** +SOOVPA<11> CMcpxBuffer_GetCurrentPosition2_1_0_3936 = +{ + 0, // Large == 0 + 11, // Count == 11 + + XREF_GETCURRENTPOSITION, // XRef Is Saved + 0, // XRef Not Used + + { + // CMcpxBuffer_GetCurrentPosition+0x12 : mov eax, [esi+0x18] + { 0x12, 0x8B }, // (Offset,Value)-Pair #1 + { 0x13, 0x46 }, // (Offset,Value)-Pair #2 + { 0x14, 0x18 }, // (Offset,Value)-Pair #3 + + // CMcpxBuffer_GetCurrentPosition+0x1A : jnz +0x79 + { 0x1A, 0x75 }, // (Offset,Value)-Pair #4 + { 0x1B, 0x79 }, // (Offset,Value)-Pair #5 + + // CMcpxBuffer_GetCurrentPosition+0x8E : div dword ptr [ecx+0x4C] + { 0x8E, 0xF7 }, // (Offset,Value)-Pair #6 + { 0x8F, 0x71 }, // (Offset,Value)-Pair #7 + { 0x90, 0x4C }, // (Offset,Value)-Pair #8 + + // CMcpxBuffer_GetCurrentPosition+0xC8 : retn 0x08 + { 0xC8, 0xC2 }, // (Offset,Value)-Pair #9 + { 0xC9, 0x08 }, // (Offset,Value)-Pair #10 + { 0xCA, 0x00 }, // (Offset,Value)-Pair #11 + } +}; + // ****************************************************************** // * CDirectSoundBuffer_GetCurrentPosition // ****************************************************************** @@ -1167,7 +1200,7 @@ SOOVPA<10> CDirectSoundBuffer_GetCurrentPosition_1_0_3936 = // CDirectSoundBuffer_GetCurrentPosition+0x19 : call [CMcpxBuffer::GetCurrentPosition] { 0x19, XREF_GETCURRENTPOSITION }, // (Offset,Value)-Pair #1 - // CDirectSoundBuffer_GetCurrentPosition+0x0D : mov eax, [esp+0x0C] + // CDirectSoundBuffer_GetCurrentPosition+0x0D : mov eax, [esp+0x10] { 0x0D, 0x8B }, // (Offset,Value)-Pair #2 { 0x0E, 0x44 }, // (Offset,Value)-Pair #3 { 0x0F, 0x24 }, // (Offset,Value)-Pair #4 @@ -1214,17 +1247,84 @@ SOOVPA<8> IDirectSoundBuffer8_GetCurrentPosition_1_0_3936 = }; // ****************************************************************** -// * IDirectSoundBuffer8_Play +// * CDirectSoundBuffer::Play // ****************************************************************** -SOOVPA<11> IDirectSoundBuffer8_Play_1_0_3936 = +SOOVPA<7> CDirectSoundBuffer_Play_1_0_3936 = { 0, // Large == 0 - 11, // Count == 11 + 7, // Count == 7 + + XREF_DSOUNDPLAY, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x07, 0xFF }, + { 0x0C, 0xF0 }, + { 0x13, 0x24 }, + { 0x1A, 0x85 }, + { 0x25, 0xFF }, + { 0x2B, 0x8B }, + { 0x2F, 0xC2 }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer8_Play +// ****************************************************************** +SOOVPA<16> IDirectSoundBuffer8_Play_1_0_3936 = +{ + 0, // Large == 0 + 16, // Count == 15 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirectSoundBuffer8_Play+0x1D : call CDirectSoundBuffer::Play + { 0x1D, XREF_DSOUNDPLAY }, + + // IDirectSoundBuffer8_Play+0x00 : push [esp+0x10] + { 0x00, 0xFF }, // (Offset,Value)-Pair #1 + { 0x01, 0x74 }, // (Offset,Value)-Pair #2 + { 0x02, 0x24 }, // (Offset,Value)-Pair #3 + { 0x03, 0x10 }, // (Offset,Value)-Pair #4 + + // IDirectSoundBuffer8_Play+0x04 : mov eax, [esp+4+arg_0] + { 0x04, 0x8B }, // (Offset,Value)-Pair #5 + { 0x05, 0x44 }, // (Offset,Value)-Pair #6 + { 0x06, 0x24 }, // (Offset,Value)-Pair #7 + { 0x07, 0x08 }, // (Offset,Value)-Pair #8 + + // IDirectSoundBuffer8_Play+0x12 : and eax, [0xFFFFFFE4] + { 0x12, 0x83 }, // (Offset,Value)-Pair #9 + { 0x13, 0xC0 }, // (Offset,Value)-Pair #10 + { 0x14, 0xE4 }, // (Offset,Value)-Pair #11 + + // IDirectSoundBuffer8_Play+0x17 : sbb ecx, ecx + { 0x17, 0x1B }, // (Offset,Value)-Pair #12 + { 0x18, 0xC9 }, // (Offset,Value)-Pair #13 + + // IDirectSoundBuffer8_Play+0x21 : retn 0x10 + { 0x21, 0xC2 }, // (Offset,Value)-Pair #14 + { 0x22, 0x10 }, // (Offset,Value)-Pair #15 + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer8_Play2 +// ****************************************************************** +SOOVPA<12> IDirectSoundBuffer8_Play2_1_0_3936 = +{ + 0, // Large == 0 + 12, // Count == 12 -1, // XRef Not Saved 0, // XRef Not Used { + // IDirectSoundBuffer8_Play+0x1D : call CDirectSoundBuffer::Play + { 0x1D, XREF_DSOUNDPLAY }, + // IDirectSoundBuffer8_Play+0x00 : push [esp+0x10] { 0x00, 0xFF }, // (Offset,Value)-Pair #1 { 0x01, 0x74 }, // (Offset,Value)-Pair #2 @@ -3590,7 +3690,7 @@ SOOVPA<11> IDirectSound8_SetVelocity_1_0_3936 = { 0x33, 0x14 }, // (Offset,Value)-Pair #11 } }; - +/* // ****************************************************************** // * CDirectSound::SetAllParametersB // ****************************************************************** @@ -3690,7 +3790,7 @@ SOOVPA<12> IDirectSound8_SetAllParameters_1_0_3936 = { 0x1D, 0xC2 }, // (Offset,Value)-Pair #11 { 0x1E, 0x0C }, // (Offset,Value)-Pair #12 } -}; +};*/ // ****************************************************************** // * IDirectSound8_DownloadEffectsImage @@ -3725,6 +3825,864 @@ SOOVPA<11> IDirectSound8_DownloadEffectsImage_1_0_3936 = } }; +// ****************************************************************** +// * CDirectSoundStream_SetMode +// ****************************************************************** +SOOVPA<7> CDirectSoundStream_SetMode_1_0_3936 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // CDirectSoundStream_SetMode+0x10 : call [CDirectSoundVoice::SetMode] + { 0x11, XREF_DSBUFFERSETMODEA }, // (Offset,Value)-Pair #1 + + // CDirectSoundStream_SetMode+0x0C : add eax, 4 + { 0x0C, 0x83 }, // (Offset,Value)-Pair #2 + { 0x0D, 0xC0 }, // (Offset,Value)-Pair #3 + { 0x0E, 0x04 }, // (Offset,Value)-Pair #4 + + // CDirectSoundStream_SetMode+0x0F : push eax + { 0x0F, 0x50 }, // (Offset,Value)-Pair #6 + + // CDirectSoundBuffer8_SetMode+0x15 : retn 0x0C + { 0x15, 0xC2 }, // (Offset,Value)-Pair #9 + { 0x16, 0x0C }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * DirectSound::CMcpxBuffer::Play +// ****************************************************************** +SOOVPA<8> DirectSound_CMcpxBuffer_Play_1_0_3925 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DirectSound_CMcpxBuffer_Play, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x06, 0x56 }, + { 0x0E, 0xF1 }, + { 0x16, 0xFF }, + { 0x1D, 0x03 }, + { 0x1E, 0xFF }, + { 0x26, 0x75 }, + { 0x2F, 0x8B }, + { 0x36, 0xC2 }, + } +}; + +// ****************************************************************** +// * CMcpxAPU::Set3dDopplerFactor +// ****************************************************************** +SOOVPA<7> CMcpxAPU_Set3dDopplerFactor_1_0_3936 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_CMcpxAPU_Set3dDopplerFactor, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x03, 0x04 }, + { 0x08, 0x00 }, + { 0x0D, 0x24 }, + { 0x12, 0x80 }, + { 0x17, 0x07 }, + { 0x1F, 0x33 }, + { 0x21, 0xC2 }, + } +}; + +// ****************************************************************** +// * CDirectSound::SetDopplerFactor +// ****************************************************************** +SOOVPA<9> CDirectSound_SetDopplerFactor_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + XREF_SETDOPPLERFACTOR, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x23, XREF_CMcpxAPU_Set3dDopplerFactor }, + + { 0x07, 0xD9 }, + { 0x0E, 0x44 }, + { 0x16, 0x50 }, + { 0x1E, 0x0C }, + { 0x27, 0x85 }, + { 0x32, 0xFF }, + { 0x38, 0x8B }, + { 0x3E, 0x00 }, + } +}; + +// ****************************************************************** +// * IDirectSound_SetDopplerFactor +// ****************************************************************** +SOOVPA<8> IDirectSound_SetDopplerFactor_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x1D, XREF_SETDOPPLERFACTOR }, + + { 0x03, 0x0C }, + { 0x08, 0x8B }, + { 0x0D, 0x8B }, + { 0x12, 0x83 }, + { 0x17, 0x1B }, + { 0x1C, 0xE8 }, + { 0x21, 0xC2 }, + } +}; + +// ****************************************************************** +// * CSensaura3d::GetFullHRTFFilterPair +// ****************************************************************** +SOOVPA<7> CSensaura3d_GetFullHRTFFilterPair_1_0_3936 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_CSensaura3d_GetFullHRTFFilterPair, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x1E, 0xEB }, + { 0x3E, 0x40 }, + { 0x5E, 0x7E }, + { 0x7E, 0x1E }, + { 0xA2, 0xD9 }, + { 0xBE, 0x09 }, + { 0xDE, 0x8B }, + } +}; + +// ****************************************************************** +// * DirectSoundUseFullHRTF +// ****************************************************************** +SOOVPA<8> DirectSoundUseFullHRTF_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x0D, XREF_CSensaura3d_GetFullHRTFFilterPair }, + + { 0x05, 0x85 }, + { 0x06, 0xC0 }, + { 0x11, 0x74 }, + { 0x12, 0x0B }, + { 0x13, 0x68 }, + { 0x18, 0xFF }, + { 0x1E, 0xC3 }, + } +}; + +// ****************************************************************** +// * DirectSoundUseFullHRTF2 +// ****************************************************************** +SOOVPA<8> DirectSoundUseFullHRTF2_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x01, XREF_DirectSoundEnterCriticalSection }, + + { 0x05, 0x85 }, + { 0x06, 0xC0 }, + { 0x11, 0x74 }, + { 0x12, 0x0B }, + { 0x13, 0x68 }, + { 0x18, 0xFF }, + { 0x1E, 0xC3 }, + } +}; + +// ****************************************************************** +// * CDirectSound::GetCaps +// ****************************************************************** +SOOVPA<8> CDirectSound_GetCaps_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_CDirectSound_GetCaps, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x08, 0x8B }, + { 0x12, 0x8D }, + { 0x1C, 0x0C }, + { 0x26, 0xFF }, + { 0x34, 0x03 }, + { 0x3A, 0xDB }, + { 0x48, 0x8B }, + { 0x4E, 0x08 }, + } +}; + +// ****************************************************************** +// * IDirectSound_GetCaps +// ****************************************************************** +SOOVPA<8> IDirectSound_GetCaps_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x15, XREF_CDirectSound_GetCaps }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0x83 }, + { 0x0E, 0xD9 }, + { 0x12, 0xC8 }, + { 0x19, 0xC2 }, + { 0x1A, 0x08 }, + } +}; + +// ****************************************************************** +// * CDirectSoundVoice::SetPitch +// ****************************************************************** +SOOVPA<8> CDirectSoundVoice_SetPitch_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_CDirectSoundVoice_SetPitch, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x07, 0x8B }, + { 0x0C, 0xF0 }, + { 0x13, 0x18 }, + { 0x1A, 0xE8 }, + { 0x21, 0x8B }, + { 0x2A, 0xFF }, + { 0x30, 0x8B }, + { 0x36, 0x00 }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_SetPitch +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_SetPitch_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x15, XREF_CDirectSoundVoice_SetPitch }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0x83 }, + { 0x0E, 0xD9 }, + { 0x12, 0xC8 }, + { 0x19, 0xC2 }, + { 0x1A, 0x08 }, + } +}; + +// ****************************************************************** +// * CDirectSoundVoice::SetConeAngles +// ****************************************************************** +SOOVPA<8> CDirectSoundVoice_SetConeAngles_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DSVOICESETCONEANGLES, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x07, 0x8B }, + { 0x0E, 0xD0 }, + { 0x16, 0x18 }, + { 0x1E, 0x18 }, + { 0x27, 0x85 }, + { 0x32, 0xFF }, + { 0x38, 0x8B }, + { 0x3E, 0x00 }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_SetConeAngles +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_SetConeAngles_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x1D, XREF_DSVOICESETCONEANGLES }, + + { 0x03, 0x10 }, + { 0x08, 0xFF }, + { 0x0D, 0xC8 }, + { 0x12, 0x83 }, + { 0x17, 0x1B }, + { 0x1C, 0xE8 }, + { 0x21, 0xC2 }, + } +}; + +// ****************************************************************** +// * DirectSoundEnterCriticalSection +// ****************************************************************** +SOOVPA<7> DirectSoundEnterCriticalSection_1_0_3936 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DirectSoundEnterCriticalSection, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x02, 0xB6 }, + { 0x06, 0x00 }, + { 0x0A, 0x74 }, + { 0x0E, 0xC3 }, + { 0x14, 0xFF }, + { 0x1A, 0x33 }, + { 0x1B, 0xC0 }, + } +}; + +// ****************************************************************** +// * CDirectSoundBuffer::PlayEx +// ****************************************************************** +SOOVPA<9> CDirectSoundBuffer_PlayEx_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + XREF_DirectSound_CDirectSoundBuffer_PlayEx, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x03, XREF_DirectSoundEnterCriticalSection }, + + { 0x00, 0x56 }, + { 0x07, 0x8B }, + { 0x0E, 0xE0 }, + { 0x16, 0x44 }, + { 0x1E, 0x48 }, + { 0x26, 0xF6 }, + { 0x30, 0xFF }, + { 0x36, 0x8B }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_PlayEx +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_PlayEx_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x1D, XREF_DirectSound_CDirectSoundBuffer_PlayEx }, + + { 0x03, 0x10 }, + { 0x08, 0xFF }, + { 0x0D, 0xC8 }, + { 0x12, 0x83 }, + { 0x17, 0x1B }, + { 0x1C, 0xE8 }, + { 0x21, 0xC2 }, + } +}; + +// ****************************************************************** +// * IDirectSound8_AddRef +// ****************************************************************** +SOOVPA<12> IDirectSound8_AddRef_1_0_3936 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirectSound8_AddRef+0x04 : lea ecx, [eax-8] + { 0x04, 0x8D }, // (Offset,Value)-Pair #1 + { 0x05, 0x48 }, // (Offset,Value)-Pair #2 + { 0x06, 0xF8 }, // (Offset,Value)-Pair #3 + + // IDirectSound8_AddRef+0x07 : neg eax + { 0x07, 0xF7 }, // (Offset,Value)-Pair #4 + { 0x08, 0xD8 }, // (Offset,Value)-Pair #5 + + // IDirectSound8_AddRef+0x09 : sbb eax, eax + { 0x09, 0x1B }, // (Offset,Value)-Pair #6 + { 0x0A, 0xC0 }, // (Offset,Value)-Pair #7 + + // IDirectSound8_AddRef+0x0D : mov ecx, [eax] + { 0x0D, 0x8B }, // (Offset,Value)-Pair #8 + { 0x0E, 0x08 }, // (Offset,Value)-Pair #9 + + // IDirectSound8_AddRef+0x10 : call dword ptr [ecx+4] + { 0x10, 0xFF }, // (Offset,Value)-Pair #10 + { 0x11, 0x51 }, // (Offset,Value)-Pair #11 + { 0x12, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * DirectSoundGetSampleTime +// ****************************************************************** +SOOVPA<6> DirectSoundGetSampleTime_1_0_3936 = +{ + 0, // Large == 0 + 6, // Count == 6 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x00, 0xA1 }, + { 0x01, 0x0C }, + { 0x02, 0x20 }, + { 0x03, 0x80 }, + { 0x04, 0xFE }, + { 0x05, 0xC3 }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer8_AddRef +// ****************************************************************** +SOOVPA<10> IDirectSoundBuffer8_AddRef_1_0_3936 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirectSoundBuffer8_AddRef+0x04 : lea ecx, [eax-0x1C] + { 0x04, 0x8D }, // (Offset,Value)-Pair #1 + { 0x05, 0x48 }, // (Offset,Value)-Pair #2 + { 0x06, 0xE4 }, // (Offset,Value)-Pair #3 + + // IDirectSoundBuffer8_AddRef+0x07 : neg eax; sbb eax, eax + { 0x07, 0xF7 }, // (Offset,Value)-Pair #4 + { 0x08, 0xD8 }, // (Offset,Value)-Pair #5 + { 0x09, 0x1B }, // (Offset,Value)-Pair #6 + { 0x0A, 0xC0 }, // (Offset,Value)-Pair #7 + + // IDirectSoundBuffer8_AddRef+0x10 : call dword ptr [ecx+0x04] + { 0x10, 0xFF }, // (Offset,Value)-Pair #8 + { 0x11, 0x51 }, // (Offset,Value)-Pair #9 + { 0x12, 0x04 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * CDirectSoundBuffer::SetMinDistance +// ****************************************************************** +SOOVPA<9> CDirectSoundBuffer_SetMinDistance_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + XREF_CDirectSoundBuffer_SetMinDistance, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x11, XREF_DSSTREAMSETMINDISTANCE1B }, + + { 0x01, 0x74 }, + { 0x04, 0xD9 }, + { 0x07, 0x0C }, + { 0x0A, 0x1C }, + { 0x0D, 0x74 }, + { 0x10, 0xE8 }, + { 0x15, 0xC2 }, + { 0x16, 0x0C }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_SetMinDistance +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_SetMinDistance_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x1D, XREF_CDirectSoundBuffer_SetMinDistance }, + + { 0x03, 0x0C }, + { 0x08, 0x8B }, + { 0x0D, 0x8B }, + { 0x12, 0x83 }, + { 0x17, 0x1B }, + { 0x1C, 0xE8 }, + { 0x21, 0xC2 }, + } +}; + +// ****************************************************************** +// * CDirectSoundBuffer::SetMaxDistance +// ****************************************************************** +SOOVPA<9> CDirectSoundBuffer_SetMaxDistance_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + XREF_CDirectSoundBuffer_SetMaxDistance, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x11, XREF_DSSTREAMSETMAXDISTANCE1B }, + + { 0x01, 0x74 }, + { 0x04, 0xD9 }, + { 0x07, 0x0C }, + { 0x0A, 0x1C }, + { 0x0D, 0x74 }, + { 0x10, 0xE8 }, + { 0x15, 0xC2 }, + { 0x16, 0x0C }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_SetMaxDistance +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_SetMaxDistance_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x1D, XREF_CDirectSoundBuffer_SetMaxDistance }, + + { 0x03, 0x0C }, + { 0x08, 0x8B }, + { 0x0D, 0x8B }, + { 0x12, 0x83 }, + { 0x17, 0x1B }, + { 0x1C, 0xE8 }, + { 0x21, 0xC2 }, + } +}; + +// ****************************************************************** +// * CMcpxVoiceClient::SetI3DL2Source +// ****************************************************************** +SOOVPA<10> CMcpxVoiceClient_Commit3dSettings_1_0_3936 = +{ + 0, // Large == 0 + 10, // Small == 10 + + XREF_CMcpxVoiceClient_Commit3dSettings, // XRef Is Saved + 0, // XRef Not Used + + { + // CMcpxVoiceClient::Commit3dSettings+0x17 : or [eax+0x80], ecx + { 0x17, 0x09 }, + { 0x18, 0x88 }, + { 0x19, 0x80 }, + { 0x1A, 0x00 }, + // CMcpxVoiceClient::Commit3dSettings+0x2B : add eax, 0x80 + { 0x2B, 0x05 }, + { 0x2C, 0x80 }, + { 0x2D, 0x00 }, + // CMcpxVoiceClient::Commit3dSettings+0x3D : cmpxchg [ecx], edx + { 0x3D, 0x0F }, + { 0x3E, 0xB1 }, + { 0x3F, 0x11 }, + } +}; + +// ****************************************************************** +// * CMcpxVoiceClient::SetI3DL2Source +// ****************************************************************** +SOOVPA<8> CMcpxVoiceClient_SetI3DL2Source_1_0_3936 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_CMcpxVoiceClient_SetI3DL2Source, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x25, XREF_CMcpxVoiceClient_Commit3dSettings }, + + { 0x04, 0x08 }, + { 0x0A, 0x59 }, + { 0x10, 0x80 }, + { 0x16, 0x80 }, + { 0x1C, 0x5F }, + { 0x22, 0x8B }, + { 0x29, 0x33 }, + } +}; + +// ****************************************************************** +// * CDirectSoundVoice::SetI3DL2Source +// ****************************************************************** +SOOVPA<9> CDirectSoundVoice_SetI3DL2Source_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + XREF_CDirectSoundVoice_SetI3DL2Source, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x1F, XREF_CMcpxVoiceClient_SetI3DL2Source }, + + { 0x00, 0x56 }, + { 0x07, 0x8B }, + { 0x0E, 0xD0 }, + { 0x16, 0x10 }, + { 0x1E, 0xE8 }, + { 0x26, 0xF8 }, + { 0x2E, 0xFF }, + { 0x36, 0x5F }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_SetI3DL2Source +// ****************************************************************** +SOOVPA<9> IDirectSoundBuffer_SetI3DL2Source_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x19, XREF_CDirectSoundVoice_SetI3DL2Source }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0xFF }, + { 0x0E, 0x83 }, + { 0x12, 0xD9 }, + { 0x16, 0xC8 }, + { 0x1D, 0xC2 }, + { 0x1E, 0x0C }, + } +}; + +// ****************************************************************** +// * CDirectSoundVoice::SetMixBinVolumes +// ****************************************************************** +SOOVPA<7> CDirectSoundVoice_SetMixBinVolumes_1_0_3936 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_CDirectSoundVoice_SetMixBinVolumes, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x0D, 0x65 }, + { 0x1C, 0x53 }, + { 0x2B, 0xC0 }, + { 0x3A, 0xC7 }, + { 0x49, 0xFC }, + { 0x58, 0x83 }, + { 0x67, 0x15 }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_SetMixBinVolumes +// ****************************************************************** +SOOVPA<9> IDirectSoundBuffer_SetMixBinVolumes_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x19, XREF_CDirectSoundVoice_SetMixBinVolumes }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0xFF }, + { 0x0E, 0x83 }, + { 0x12, 0xD9 }, + { 0x16, 0xC8 }, + { 0x1D, 0xC2 }, + { 0x1E, 0x0C }, + } +}; + +// ****************************************************************** +// * CMcpxAPU::Set3dParameters +// ****************************************************************** +SOOVPA<7> CMcpxAPU_Set3dParameters_1_0_3936 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DSSETALLPARAMETERSB, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x05, 0x57 }, + { 0x0C, 0xB8 }, + { 0x13, 0x80 }, + { 0x1A, 0x83 }, + { 0x21, 0x74 }, + { 0x2C, 0x33 }, + { 0x2F, 0x08 }, + } +}; + +// ****************************************************************** +// * CDirectSound::SetAllParameters +// ****************************************************************** +SOOVPA<9> CDirectSound_SetAllParameters_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + XREF_DSSETALLPARAMETERSA, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x1F, XREF_DSSETALLPARAMETERSB }, + + { 0x00, 0x56 }, + { 0x07, 0x8B }, + { 0x0E, 0xD0 }, + { 0x16, 0x10 }, + { 0x1E, 0xE8 }, + { 0x26, 0xF8 }, + { 0x2E, 0xFF }, + { 0x36, 0x5F }, + } +}; + +// ****************************************************************** +// * IDirectSound_SetAllParameters +// ****************************************************************** +SOOVPA<9> IDirectSound_SetAllParameters_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x19, XREF_DSSETALLPARAMETERSA }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0xFF }, + { 0x0E, 0x83 }, + { 0x12, 0xD9 }, + { 0x16, 0xC8 }, + { 0x1D, 0xC2 }, + { 0x1E, 0x0C }, + } +}; + +// ****************************************************************** +// * CDirectSound::SetI3DL2Listener +// ****************************************************************** +SOOVPA<7> CDirectSound_SetI3DL2Listener_1_0_3936 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DSSETI3DL2LISTENER, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x08, 0xF8 }, + { 0x12, 0x0C }, + { 0x1C, 0x18 }, + { 0x26, 0x51 }, + { 0x33, 0x8B }, + { 0x3E, 0xFF }, + { 0x44, 0x5F }, + } +}; + +// ****************************************************************** +// * IDirectSound_SetI3DL2Listener +// ****************************************************************** +SOOVPA<9> IDirectSound_SetI3DL2Listener_1_0_3936 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x19, XREF_DSSETI3DL2LISTENER }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0xFF }, + { 0x0E, 0x83 }, + { 0x12, 0xD9 }, + { 0x16, 0xC8 }, + { 0x1D, 0xC2 }, + { 0x1E, 0x0C }, + } +}; + // ****************************************************************** // * DirectSoundCreate_1_0_3936 // ****************************************************************** @@ -4032,6 +4990,14 @@ OOVPATable DSound_1_0_3936[] = "CMcpxBuffer_GetCurrentPosition (XREF)" #endif }, + // CMcpxBuffer::GetCurrentPosition + { + (OOVPA*)&CMcpxBuffer_GetCurrentPosition2_1_0_3936, 0, + + #ifdef _DEBUG_TRACE + "CMcpxBuffer_GetCurrentPosition (XREF)" + #endif + }, // CDirectSoundBuffer::GetCurrentPosition { (OOVPA*)&CDirectSoundBuffer_GetCurrentPosition_1_0_3936, 0, @@ -4049,6 +5015,14 @@ OOVPATable DSound_1_0_3936[] = #ifdef _DEBUG_TRACE "IDirectSoundBuffer8_GetCurrentPosition" #endif + }, + // CDirectSoundBuffer_Play + { + (OOVPA*)&CDirectSoundBuffer_Play_1_0_3936, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundBuffer::Play (XREF)" + #endif }, // IDirectSoundBuffer8::Play { @@ -4060,6 +5034,16 @@ OOVPATable DSound_1_0_3936[] = "EmuIDirectSoundBuffer8_Play" #endif }, + // IDirectSoundBuffer8::Play + /* { + (OOVPA*)&IDirectSoundBuffer8_Play2_1_0_3936, + + XTL::EmuIDirectSoundBuffer8_Play, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer8_Play [YESSSS! IT WORKED!]" + #endif + },*/ // CDirectSoundBuffer::Stop { (OOVPA*)&CDirectSoundBuffer_Stop_1_0_3936, 0, @@ -4666,9 +5650,9 @@ OOVPATable DSound_1_0_3936[] = "EmuIDirectSound8_SetVelocity" #endif }, - // CDirectSound::SetVelocityB (XREF) + // CDirectSound::SetAllParametersB (XREF) { - (OOVPA*)&CDirectSound_SetAllParametersB_1_0_3936, 0, + (OOVPA*)&CMcpxAPU_Set3dParameters_1_0_3936, 0, #ifdef _DEBUG_TRACE "CDirectSound_SetAllParametersB (XRef)" @@ -4676,7 +5660,7 @@ OOVPATable DSound_1_0_3936[] = }, // CDirectSound::SetAllParametersA (XREF) { - (OOVPA*)&CDirectSound_SetAllParametersA_1_0_3936, 0, + (OOVPA*)&CDirectSound_SetAllParameters_1_0_3936, 0, #ifdef _DEBUG_TRACE "CDirectSound_SetAllParametersA (XRef)" @@ -4684,7 +5668,7 @@ OOVPATable DSound_1_0_3936[] = }, // IDirectSound8::SetAllParameters { - (OOVPA*)&IDirectSound8_SetAllParameters_1_0_3936, + (OOVPA*)&IDirectSound_SetAllParameters_1_0_3936, XTL::EmuIDirectSound8_SetAllParameters, @@ -4702,6 +5686,268 @@ OOVPATable DSound_1_0_3936[] = "EmuIDirectSound8_DownloadEffectsImage" #endif }, + // CDirectSoundStream::SetMode + { + (OOVPA*)&CDirectSoundStream_SetMode_1_0_3936, + + XTL::EmuCDirectSoundStream_SetMode, + + #ifdef _DEBUG_TRACE + "EmuCDirectSoundStream_SetMode" + #endif + }, + // DirectSound::CMcpxBuffer::Play (XREF) + /*{ + (OOVPA*)&DirectSound_CMcpxBuffer_Play_1_0_4361, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CMcpxBuffer::Play (XREF)" + #endif + },*/ + // CMcpxAPU::Set3dDopplerFactor (XREF) + { + (OOVPA*)&CMcpxAPU_Set3dDopplerFactor_1_0_3936, 0, + + #ifdef _DEBUG_TRACE + "CMcpxAPU::Set3dDopplerFactor (XREF)" + #endif + }, + // CDirectSound::SetDopplerFactor (XREF) + { + (OOVPA*)&CDirectSound_SetDopplerFactor_1_0_3936, 0, + + #ifdef _DEBUG_TRACE + "CDirectSound::SetDopplerFactor (XREF)" + #endif + }, + // IDirectSound_SetDopplerFactor + { + (OOVPA*)&IDirectSound_SetDopplerFactor_1_0_3936, + XTL::EmuIDirectSound8_SetDopplerFactor, + + #ifdef _DEBUG_TRACE + "IDirectSound_SetDopplerFactor" + #endif + }, + // CSensaura3d::GetFullHRTFFilterPair (XREF) + { + (OOVPA*)&CSensaura3d_GetFullHRTFFilterPair_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "CSensaura3d::GetFullHRTFFilterPair (XREF)" + #endif + }, + // DirectSoundUseFullHRTF + { + (OOVPA*)&DirectSoundUseFullHRTF_1_0_3936, + XTL::EmuDirectSoundUseFullHRTF, + + #ifdef _DEBUG_TRACE + "DirectSoundUseFullHRTF" + #endif + }, + // CDirectSound::GetCaps (XREF) + { + (OOVPA*)&CDirectSound_GetCaps_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "CDirectSound::GetCaps (XREF)" + #endif + }, + // IDirectSound_GetCaps + { + (OOVPA*)&IDirectSound_GetCaps_1_0_3936, + XTL::EmuIDirectSound8_GetCaps, + + #ifdef _DEBUG_TRACE + "IDirectSound_GetCaps" + #endif + }, + // CDirectSoundVoice::SetConeAngles (XREF) + { + (OOVPA*)&CDirectSoundVoice_SetConeAngles_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundVoice::SetConeAngles (XREF)" + #endif + }, + // IDirectSoundBuffer_SetConeAngles + { + (OOVPA*)&IDirectSoundBuffer_SetConeAngles_1_0_3936, + XTL::EmuIDirectSoundBuffer8_SetConeAngles, + + #ifdef _DEBUG_TRACE + "IDirectSoundBuffer_SetConeAngles" + #endif + }, + // DirectSoundEnterCriticalSection (XREF) + { + (OOVPA*)&DirectSoundEnterCriticalSection_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "DirectSoundEnterCriticalSection (XREF)" + #endif + }, + // DirectSoundUseFullHRTF + { + (OOVPA*)&DirectSoundUseFullHRTF2_1_0_3936, + XTL::EmuDirectSoundUseFullHRTF, + + #ifdef _DEBUG_TRACE + "DirectSoundUseFullHRTF" + #endif + }, + // DirectSound::CDirectSoundBuffer::PlayEx (XREF) + { + (OOVPA*)&CDirectSoundBuffer_PlayEx_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundBuffer::PlayEx (XREF)" + #endif + }, + // IDirectSoundBuffer_PlayEx + { + (OOVPA*)&IDirectSoundBuffer_PlayEx_1_0_3936, + XTL::EmuIDirectSoundBuffer8_PlayEx, + + #ifdef _DEBUG_TRACE + "IDirectSoundBuffer_PlayEx" + #endif + }, + // IDirectSound8::AddRef + { + (OOVPA*)&IDirectSound8_AddRef_1_0_3936, + + XTL::EmuIDirectSound8_AddRef, + + #ifdef _DEBUG_TRACE + "EmuIDirectSound8_AddRef" + #endif + }, + // DirectSoundGetSampleTime + { + (OOVPA*)&DirectSoundGetSampleTime_1_0_3936, + XTL::EmuDirectSoundGetSampleTime, + + #ifdef _DEBUG_TRACE + "DirectSoundGetSampleTime" + #endif + }, + // IDirectSoundBuffer_AddRef + { + (OOVPA*)&IDirectSoundBuffer8_AddRef_1_0_3936, + + XTL::EmuIDirectSoundBuffer8_AddRef, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer8_AddRef" + #endif + }, + // CDirectSoundBuffer::SetMinDistance (XREF) + { + (OOVPA*)&CDirectSoundBuffer_SetMinDistance_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundBuffer::SetMinDistance (XREF)" + #endif + }, + // IDirectSoundBuffer_SetMinDistance + { + (OOVPA*)&IDirectSoundBuffer_SetMinDistance_1_0_3936, + XTL::EmuIDirectSoundBuffer8_SetMinDistance, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer8_SetMinDistance" + #endif + }, + // CDirectSoundBuffer::SetMaxDistance (XREF) + { + (OOVPA*)&CDirectSoundBuffer_SetMaxDistance_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundBuffer::SetMaxDistance (XREF)" + #endif + }, + // IDirectSoundBuffer_SetMaxDistance + { + (OOVPA*)&IDirectSoundBuffer_SetMaxDistance_1_0_3936, + XTL::EmuIDirectSoundBuffer8_SetMaxDistance, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer8_SetMaxDistance" + #endif + }, + // CMcpxVoiceClient::Commit3dSettings (XREF) + { + (OOVPA*)&CMcpxVoiceClient_Commit3dSettings_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "CMcpxVoiceClient::Commit3dSettings (XREF)" + #endif + }, + // CMcpxVoiceClient::SetI3DL2Source (XREF) + { + (OOVPA*)&CMcpxVoiceClient_SetI3DL2Source_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "CMcpxVoiceClient::SetI3DL2Source (XREF)" + #endif + }, + // CDirectSoundVoice::SetI3DL2Source (XREF) + { + (OOVPA*)&CDirectSoundVoice_SetI3DL2Source_1_0_3936, + 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundVoice::SetI3DL2Source (XREF)" + #endif + }, + // IDirectSoundBuffer_SetI3DL2Source + { + (OOVPA*)&IDirectSoundBuffer_SetI3DL2Source_1_0_3936, + XTL::EmuIDirectSoundBuffer8_SetI3DL2Source, + + #ifdef _DEBUG_TRACE + "IDirectSoundBuffer8_SetI3DL2Source" + #endif + }, + // IDirectSoundBuffer_SetMixBinVolumes + { + (OOVPA*)&IDirectSoundBuffer_SetMixBinVolumes_1_0_3936, + XTL::EmuIDirectSoundBuffer8_SetMixBinVolumes, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer8_SetMixBinVolumes" + #endif + }, + // CDirectSound_SetI3DL2Listener + { + (OOVPA*)&CDirectSound_SetI3DL2Listener_1_0_3936, 0, + + #ifdef _DEBUG_TRACE + "CDirectSound::SetI3DL2Listener (XREF)" + #endif + }, + // IDirectSound8_SetI3DL2Listener + { + (OOVPA*)&IDirectSound_SetI3DL2Listener_1_0_3936, + + XTL::EmuIDirectSound8_SetI3DL2Listener, + + #ifdef _DEBUG_TRACE + "EmuIDirectSound8_SetI3DL2Listener" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.4361.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.4361.inl index 9ca939a49..7161abf39 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.4361.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.4361.inl @@ -65,42 +65,6 @@ SOOVPA<9> DirectSoundCreate_1_0_4361 = } }; -// ****************************************************************** -// * IDirectSound8_AddRef -// ****************************************************************** -SOOVPA<12> IDirectSound8_AddRef_1_0_4361 = -{ - 0, // Large == 0 - 12, // Count == 12 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirectSound8_AddRef+0x04 : lea ecx, [eax-8] - { 0x04, 0x8D }, // (Offset,Value)-Pair #1 - { 0x05, 0x48 }, // (Offset,Value)-Pair #2 - { 0x06, 0xF8 }, // (Offset,Value)-Pair #3 - - // IDirectSound8_AddRef+0x07 : neg eax - { 0x07, 0xF7 }, // (Offset,Value)-Pair #4 - { 0x08, 0xD8 }, // (Offset,Value)-Pair #5 - - // IDirectSound8_AddRef+0x09 : sbb eax, eax - { 0x09, 0x1B }, // (Offset,Value)-Pair #6 - { 0x0A, 0xC0 }, // (Offset,Value)-Pair #7 - - // IDirectSound8_AddRef+0x0D : mov ecx, [eax] - { 0x0D, 0x8B }, // (Offset,Value)-Pair #8 - { 0x0E, 0x08 }, // (Offset,Value)-Pair #9 - - // IDirectSound8_AddRef+0x10 : call dword ptr [ecx+4] - { 0x10, 0xFF }, // (Offset,Value)-Pair #10 - { 0x11, 0x51 }, // (Offset,Value)-Pair #11 - { 0x12, 0x04 }, // (Offset,Value)-Pair #12 - } -}; - // ****************************************************************** // * IDirectSound8_CreateSoundBuffer // ****************************************************************** @@ -806,6 +770,201 @@ SOOVPA<8> IDirectSoundBuffer8_Stop_1_0_4361 = } }; +// ****************************************************************** +// * DirectSound::CDirectSoundVoiceSettings::SetMixBinVolumes +// ****************************************************************** +SOOVPA<7> DirectSound_CDirectSoundVoiceSettings_SetMixBinVolumes_1_0_4361 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DSSETMIXBINVOLUMESC, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x03, 0x24 }, + { 0x08, 0x16 }, + { 0x0D, 0x46 }, + { 0x12, 0x8B }, + { 0x17, 0x42 }, + { 0x1C, 0x3B }, + { 0x21, 0x5E }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundVoice::SetMixBinVolumes +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundVoice_SetMixBinVolumes_1_0_4361 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DSSETMIXBINVOLUMESB, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x0D, XREF_DSSETMIXBINVOLUMESC }, + + { 0x02, 0x74 }, + { 0x06, 0x74 }, + { 0x0A, 0x4E }, + { 0x11, 0x8B }, + { 0x12, 0x4E }, + { 0x19, 0x5E }, + { 0x1A, 0xC2 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundBuffer::SetMixBinVolumes +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundBuffer_SetMixBinVolumes_1_0_4361 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DSSETMIXBINVOLUMESA, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x32, XREF_DSSETMIXBINVOLUMESB }, + + { 0x0C, 0x00 }, + { 0x12, 0x85 }, + { 0x1C, 0x15 }, + { 0x26, 0xEB }, + { 0x30, 0x10 }, + { 0x3A, 0x74 }, + { 0x47, 0x8B }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundBuffer::PlayEx +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundBuffer_PlayEx_1_0_4361 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DirectSound_CDirectSoundBuffer_PlayEx, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x3D, XREF_DSOUNDPLAY }, + + { 0x0C, 0x00 }, + { 0x16, 0x68 }, + { 0x22, 0x05 }, + { 0x2E, 0x20 }, + { 0x3A, 0x24 }, + { 0x46, 0x0B }, + { 0x52, 0x8B }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_PlayEx +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_PlayEx_1_0_4361 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x1D, XREF_DirectSound_CDirectSoundBuffer_PlayEx }, + + { 0x03, 0x10 }, + { 0x08, 0xFF }, + { 0x0D, 0xC8 }, + { 0x12, 0x83 }, + { 0x17, 0x1B }, + { 0x1C, 0xE8 }, + { 0x21, 0xC2 }, + } +}; + +// ****************************************************************** +// * CMcpxBuffer::Stop2 +// ****************************************************************** +SOOVPA<10> CMcpxBuffer_Stop2_1_0_4361 = +{ + 0, // Large == 0 + 10, // Count == 10 + + XREF_CMcpxBuffer_Stop2, // XRef Is Saved + 0, // XRef Is Not Used + + { + // CMcpxBuffer_Stop2+0x03 : mov eax, [ebp+arg_0] + { 0x03, 0x8B }, + { 0x04, 0x45 }, + { 0x05, 0x08 }, + // CMcpxBuffer_Stop2+0x14 : mov eax, [esi] + { 0x14, 0x8B }, + { 0x15, 0x06 }, + // CMcpxBuffer_Stop2+0x25 : push [ebp+arg_8] + { 0x25, 0xFF }, + { 0x26, 0x75 }, + { 0x27, 0x10 }, + // CMcpxBuffer_Stop2+0x36 : retn 0xC + { 0x36, 0xC2 }, + { 0x37, 0x0C }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundBuffer::StopEx +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundBuffer_StopEx_1_0_4361 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DirectSound_CDirectSoundBuffer_StopEx, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x3D, XREF_CMcpxBuffer_Stop2 }, + + { 0x0C, 0x00 }, + { 0x16, 0x68 }, + { 0x22, 0x05 }, + { 0x2E, 0x20 }, + { 0x3A, 0x24 }, + { 0x46, 0x0B }, + { 0x52, 0x8B }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_StopEx +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_StopEx_1_0_4361 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x1D, XREF_DirectSound_CDirectSoundBuffer_StopEx }, + + { 0x03, 0x10 }, + { 0x08, 0xFF }, + { 0x0D, 0xC8 }, + { 0x12, 0x83 }, + { 0x17, 0x1B }, + { 0x1C, 0xE8 }, + { 0x21, 0xC2 }, + } +}; + // ****************************************************************** // * DirectSoundCreate_1_0_4361 // ****************************************************************** @@ -857,9 +1016,9 @@ OOVPATable DSound_1_0_4361[] = "CDirectSoundStream_Pause" #endif }, - // IDirectSound8::AddRef + // IDirectSound8::AddRef (* unchanged since 3936 *) { - (OOVPA*)&IDirectSound8_AddRef_1_0_4361, + (OOVPA*)&IDirectSound8_AddRef_1_0_3936, XTL::EmuIDirectSound8_AddRef, @@ -956,7 +1115,7 @@ OOVPATable DSound_1_0_4361[] = XTL::EmuIDirectSoundBuffer8_SetCurrentPosition, #ifdef _DEBUG_TRACE - "IDirectSoundBuffer8_SetCurrentPosition" + "EmuIDirectSoundBuffer8_SetCurrentPosition" #endif }, // CMcpxBuffer::GetCurrentPosition @@ -982,7 +1141,7 @@ OOVPATable DSound_1_0_4361[] = XTL::EmuIDirectSoundBuffer8_GetCurrentPosition, #ifdef _DEBUG_TRACE - "IDirectSoundBuffer8_GetCurrentPosition" + "EmuIDirectSoundBuffer8_GetCurrentPosition" #endif }, // CMcpxBuffer::Play @@ -1008,7 +1167,7 @@ OOVPATable DSound_1_0_4361[] = XTL::EmuIDirectSoundBuffer8_Play, #ifdef _DEBUG_TRACE - "IDirectSoundBuffer8_Play" + "EmuIDirectSoundBuffer8_Play" #endif }, // CMcpxBuffer::Stop @@ -1018,6 +1177,14 @@ OOVPATable DSound_1_0_4361[] = #ifdef _DEBUG_TRACE "CMcpxBuffer_Stop (XREF)" #endif + }, + // CMcpxBuffer_Stop2 + { + (OOVPA*)&CMcpxBuffer_Stop2_1_0_4361, 0, + + #ifdef _DEBUG_TRACE + "CMcpxBuffer_Stop2 (XREF)" + #endif }, // CDirectSoundBuffer::Stop { @@ -1034,9 +1201,79 @@ OOVPATable DSound_1_0_4361[] = XTL::EmuIDirectSoundBuffer8_Stop, #ifdef _DEBUG_TRACE - "IDirectSoundBuffer8_Stop" + "EmuIDirectSoundBuffer8_Stop" #endif }, + // CDirectSoundVoiceSettings_SetMixBinVolumes + { + (OOVPA*)&DirectSound_CDirectSoundVoiceSettings_SetMixBinVolumes_1_0_4361, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundVoiceSettings::SetMixBinVolumes (XREF)" + #endif + }, + // CDirectSoundVoice_SetMixBinVolumes + { + (OOVPA*)&DirectSound_CDirectSoundVoice_SetMixBinVolumes_1_0_4361, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundVoice::SetMixBinVolumes (XREF)" + #endif + }, + // CDirectSoundBuffer_SetMixBinVolumes + { + (OOVPA*)&DirectSound_CDirectSoundBuffer_SetMixBinVolumes_1_0_4361, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundBuffer::SetMixBinVolumes (XREF)" + #endif + }, + // DirectSound::CDirectSoundBuffer::PlayEx (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundBuffer_PlayEx_1_0_4361, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundBuffer::PlayEx (XREF)" + #endif + }, + // IDirectSoundBuffer_PlayEx + { + (OOVPA*)&IDirectSoundBuffer_PlayEx_1_0_4361, + XTL::EmuIDirectSoundBuffer8_PlayEx, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer_PlayEx" + #endif + }, + // DirectSound::CDirectSoundBuffer::StopEx (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundBuffer_StopEx_1_0_4361, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundBuffer::StopEx (XREF)" + #endif + }, + // IDirectSoundBuffer_StopEx + { + (OOVPA*)&IDirectSoundBuffer_StopEx_1_0_4361, + XTL::EmuIDirectSoundBuffer8_StopEx, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer_StopEx" + #endif + }, + // IDirectSoundBuffer_AddRef (* unchanged since 3936 *) + { + (OOVPA*)&IDirectSoundBuffer8_AddRef_1_0_3936, + + XTL::EmuIDirectSoundBuffer8_AddRef, + + #ifdef _DEBUG_TRACE + "IDirectSoundBuffer8_AddRef" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.4432.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.4432.inl index 92d1af794..15a30038a 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.4432.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.4432.inl @@ -572,6 +572,102 @@ SOOVPA<11> IDirectSound8_SetDistanceFactor_1_0_4432 = } }; +// ****************************************************************** +// * CDirectSound::SetPositionA +// ****************************************************************** +SOOVPA<11> CDirectSound_SetPositionA_1_0_4432 = +{ + 0, // Large == 0 + 11, // Count == 11 + + XREF_DSSETPOSITIONA, // XRef Is Saved + 0, // XRef Not Used + + { + // CDirectSound_SetPositionA+0x2B : mov ecx, [ebp+0x08] + { 0x2B, 0x8B }, // (Offset,Value)-Pair #1 + { 0x2C, 0x4D }, // (Offset,Value)-Pair #2 + { 0x2D, 0x08 }, // (Offset,Value)-Pair #3 + + // CDirectSound_SetPositionA+0x3F : mov [edx+0x3C], edi + { 0x3F, 0x89 }, // (Offset,Value)-Pair #4 + { 0x40, 0x7A }, // (Offset,Value)-Pair #5 + { 0x41, 0x3C }, // (Offset,Value)-Pair #6 + + // CDirectSound_SetPositionA+0x4C : or word ptr [eax+0xA4], 0x01FF + { 0x4C, 0x80 }, // (Offset,Value)-Pair #7 + { 0x4D, 0x88 }, // (Offset,Value)-Pair #8 + { 0x4E, 0xA4 }, // (Offset,Value)-Pair #9 + { 0x4F, 0x00 }, // (Offset,Value)-Pair #10 + { 0x52, 0xFF }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * CDirectSound::SetVelocity +// ****************************************************************** +SOOVPA<15> CDirectSound_SetVelocity_1_0_4432 = +{ + 0, // Large == 0 + 15, // Count == 15 + + XREF_DSSETVELOCITYA, // XRef Is Saved + 0, // XRef Not Used + + { + // CDirectSound_SetVelocity+0x24 : mov eax, 0x80004005 + { 0x24, 0xB8 }, // (Offset,Value)-Pair #1 + { 0x25, 0x05 }, // (Offset,Value)-Pair #2 + { 0x26, 0x40 }, // (Offset,Value)-Pair #3 + { 0x27, 0x00 }, // (Offset,Value)-Pair #4 + { 0x28, 0x80 }, // (Offset,Value)-Pair #5 + + // CDirectSound_SetVelocity+0x37 : mov [edx+0x44], edi + { 0x37, 0x89 }, // (Offset,Value)-Pair #6 + { 0x38, 0x7A }, // (Offset,Value)-Pair #7 + { 0x39, 0x44 }, // (Offset,Value)-Pair #8 + + // CDirectSound_SetVelocity+0x4C : or dword ptr [eax+0x0A4], 0x40 + { 0x4C, 0x83 }, // (Offset,Value)-Pair #9 + { 0x4D, 0x88 }, // (Offset,Value)-Pair #10 + { 0x4E, 0xA4 }, // (Offset,Value)-Pair #11 + { 0x4F, 0x00 }, // (Offset,Value)-Pair #12 + { 0x52, 0x40 }, // (Offset,Value)-Pair #13 + + // CDirectSound_SetVelocity+0x73 : retn 0x14 + { 0x73, 0xC2 }, // (Offset,Value)-Pair #14 + { 0x74, 0x14 }, // (Offset,Value)-Pair #15 + } +}; + +// ****************************************************************** +// * CDirectSoundVoice::SetPosition +// ****************************************************************** +SOOVPA<8> CDirectSoundVoice_SetPosition_1_0_4432 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DSVOICESETPOSITION, // XRef Is Saved + 0, // XRef Not Used + + { + // CDirectSoundVoice_SetPosition+0x0F : mov edx, [ebp+arg_4] + { 0x0F, 0x8B }, + { 0x10, 0x55 }, + { 0x11, 0x0C }, + + // CDirectSoundVoice_SetPosition+0x12 : mov [ecx+04h], edx + { 0x12, 0x89 }, + { 0x13, 0x51 }, + { 0x14, 0x04 }, + + // CDirectSoundVoice_SetPosition+0x4F : retn 14h + { 0x4F, 0xC2 }, + { 0x50, 0x14 } + } +}; + // ****************************************************************** // * DirectSoundCreate_1_0_4432 // ****************************************************************** @@ -623,9 +719,9 @@ OOVPATable DSound_1_0_4432[] = "CDirectSoundStream_Pause" #endif }, - // IDirectSound8::AddRef (* unchanged since 4361 *) + // IDirectSound8::AddRef (* unchanged since 3936 *) { - (OOVPA*)&IDirectSound8_AddRef_1_0_4361, + (OOVPA*)&IDirectSound8_AddRef_1_0_3936, XTL::EmuIDirectSound8_AddRef, @@ -891,6 +987,16 @@ OOVPATable DSound_1_0_4432[] = "EmuIDirectSound8_DownloadEffectsImage" #endif }, + // IDirectSoundBuffer_AddRef (* unchanged since 3936 *) + { + (OOVPA*)&IDirectSoundBuffer8_AddRef_1_0_3936, + + XTL::EmuIDirectSoundBuffer8_AddRef, + + #ifdef _DEBUG_TRACE + "IDirectSoundBuffer8_AddRef" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.4627.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.4627.inl index 35ab7fc77..7b586bde7 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.4627.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.4627.inl @@ -274,6 +274,33 @@ SOOVPA<10> CDirectSound_SetAllParametersA_1_0_4627 = } }; +// ****************************************************************** +// * CDirectSound::SetAllParametersA +// ****************************************************************** +SOOVPA<10> CDirectSound_SetAllParametersA_1_0_4721 = +{ + 0, // Large == 0 + 10, // Count == 10 + + XREF_DSSETALLPARAMETERSA, // XRef Is Saved + 0, // XRef Not Used + + { + { 0x16, 0x68 }, // (Offset,Value)-Pair #1 + { 0x17, 0xD8 }, // (Offset,Value)-Pair #2 + { 0x18, 0x81 }, // (Offset,Value)-Pair #3 + { 0x19, 0x15 }, // (Offset,Value)-Pair #4 + + { 0x2F, 0xD9 }, // (Offset,Value)-Pair #5 + { 0x30, 0x41 }, // (Offset,Value)-Pair #6 + { 0x31, 0x04 }, // (Offset,Value)-Pair #7 + + { 0x87, 0x8B }, // (Offset,Value)-Pair #8 + { 0x88, 0x50 }, // (Offset,Value)-Pair #9 + { 0x89, 0x08 }, // (Offset,Value)-Pair #10 + } +}; + // ****************************************************************** // * CDirectSoundVoiceSettings::SetMixBinVolumes // ****************************************************************** @@ -773,6 +800,69 @@ SOOVPA<11> CMcpxBuffer_GetStatus_1_0_4627 = } }; +// ****************************************************************** +// * CMcpxBuffer_GetStatus +// ****************************************************************** +SOOVPA<10> CMcpxBuffer_GetStatus_1_0_4721 = +{ + 0, // Large == 0 + 10, // Count == 10 + + XREF_DSBUFFERGETSTATUSA, // XRef Is Saved + 0, // XRef Not Used + + { + // CMcpxBuffer_GetStatus+0x00 : movzx eax, word ptr [esi+0x12] + { 0x00, 0x0F }, // (Offset,Value)-Pair #5 + { 0x01, 0xB7 }, // (Offset,Value)-Pair #6 + { 0x02, 0x41 }, // (Offset,Value)-Pair #7 + { 0x03, 0x12 }, // (Offset,Value)-Pair #8 + + // CMcpxBuffer_GetStatus+0x27 : mov ecx, 0x8001 + { 0x27, 0xB9 }, // (Offset,Value)-Pair #3 + { 0x28, 0x01 }, // (Offset,Value)-Pair #4 + { 0x29, 0x80 }, // (Offset,Value)-Pair #4 + { 0x2A, 0x00 }, // (Offset,Value)-Pair #4 + + // CMcpxBuffer_GetStatus+0x39 : mov [ecx], eax + { 0x39, 0x89 }, // (Offset,Value)-Pair #5 + { 0x3A, 0x01 }, // (Offset,Value)-Pair #6 + } +}; + +// ****************************************************************** +// * CMcpxBuffer_GetStatus +// ****************************************************************** +//SOOVPA<11> CMcpxBuffer_GetStatus_1_0_4928 = +//{ +// 0, // Large == 0 +// 11, // Count == 11 +// +// XREF_DSBUFFERGETSTATUSA, // XRef Is Saved +// 0, // XRef Not Used +// +// { +// // CMcpxBuffer_GetStatus+0x0A : mov esi, ecx +// { 0x0A, 0x8B }, // (Offset,Value)-Pair #1 +// { 0x0B, 0xF1 }, // (Offset,Value)-Pair #2 +// +// // CMcpxBuffer_GetStatus+0x1B : jnz +0x44 +// { 0x1B, 0x75 }, // (Offset,Value)-Pair #3 +// { 0x1C, 0x44 }, // (Offset,Value)-Pair #4 +// +// // CMcpxBuffer_GetStatus+0x23 : movzx eax, word ptr [esi+0x12] +// { 0x23, 0x0F }, // (Offset,Value)-Pair #5 +// { 0x24, 0xB7 }, // (Offset,Value)-Pair #6 +// { 0x25, 0x46 }, // (Offset,Value)-Pair #7 +// { 0x26, 0x12 }, // (Offset,Value)-Pair #8 +// +// // CMcpxBuffer_GetStatus+0x3C : movzx eax, word ptr [esi+0x12] +// { 0x3C, 0x0F }, // (Offset,Value)-Pair #9 +// { 0x3D, 0xB7 }, // (Offset,Value)-Pair #10 +// { 0x3E, 0x46 }, // (Offset,Value)-Pair #11 +// } +//}; + // ****************************************************************** // * CMcpxBuffer_GetStatusB // ****************************************************************** @@ -2121,6 +2211,7 @@ SOOVPA<9> EmuIDirectSound_EnableHeadphones_1_0_4627 = } }; +/* // ****************************************************************** // * CDirectSoundVoice::SetHeadrom // ****************************************************************** @@ -2173,6 +2264,7 @@ SOOVPA<12> CDirectSoundStream_SetHeadroom_1_0_4627 = { 0x50, 0x08 }, } }; +*/ // ****************************************************************** // * CDirectSound::SetAllParametersA @@ -2201,84 +2293,6 @@ SOOVPA<10> CDirectSound_SetAllParametersA_1_0_4831 = } }; -// ****************************************************************** -// * IDirectSoundBuffer8_AddRef -// ****************************************************************** -SOOVPA<10> IDirectSoundBuffer8_AddRef_1_0_4627 = -{ - 0, // Large == 0 - 10, // Count == 10 - - -1, // XRef Not Saved - 0, // XRef Not Used - - { - // IDirectSoundBuffer8_AddRef+0x04 : lea ecx, [eax-0x1C] - { 0x04, 0x8D }, // (Offset,Value)-Pair #1 - { 0x05, 0x48 }, // (Offset,Value)-Pair #2 - { 0x06, 0xE4 }, // (Offset,Value)-Pair #3 - - // IDirectSoundBuffer8_AddRef+0x07 : neg eax; sbb eax, eax - { 0x07, 0xF7 }, // (Offset,Value)-Pair #4 - { 0x08, 0xD8 }, // (Offset,Value)-Pair #5 - { 0x09, 0x1B }, // (Offset,Value)-Pair #6 - { 0x0A, 0xC0 }, // (Offset,Value)-Pair #7 - - // IDirectSoundBuffer8_AddRef+0x10 : call dword ptr [ecx+0x04] - { 0x10, 0xFF }, // (Offset,Value)-Pair #8 - { 0x11, 0x51 }, // (Offset,Value)-Pair #9 - { 0x12, 0x04 }, // (Offset,Value)-Pair #10 - } -}; - -// ****************************************************************** -// * DirectSound::CDirectSoundBuffer::Pause -// ****************************************************************** -SOOVPA<7> DirectSound_CDirectSoundBuffer_Pause_1_0_4721 = -{ - 0, // Large == 0 - 7, // Count == 7 - - XREF_DirectSound_CDirectSoundBuffer_Pause, // Xref Is Saved - 0, // Xref Not Used - - { -// { 0x35, XREF_DirectSound_CMcpxBuffer_Pause }, - - { 0x0C, 0x00 }, - { 0x14, 0x74 }, - { 0x21, 0xB8 }, - { 0x2A, 0x24 }, - { 0x39, 0x85 }, - { 0x44, 0xFF }, - { 0x4B, 0xC7 }, - } -}; - -// ****************************************************************** -// * IDirectSoundBuffer_Pause -// ****************************************************************** -SOOVPA<8> IDirectSoundBuffer_Pause_1_0_4721 = -{ - 0, // Large == 0 - 8, // Count == 8 - - -1, // Xref Not Saved - 1, // Xref Is Used - - { - { 0x15, XREF_DirectSound_CDirectSoundBuffer_Pause }, - - { 0x02, 0x24 }, - { 0x06, 0x24 }, - { 0x0A, 0x83 }, - { 0x0E, 0xD9 }, - { 0x12, 0xC8 }, - { 0x19, 0xC2 }, - { 0x1A, 0x08 }, - } -}; - // ****************************************************************** // * DirectSound::CDirectSound::GetOutputLevels // ****************************************************************** @@ -2401,8 +2415,7 @@ SOOVPA<9> IDirectSoundBuffer8_SetAllParameters_1_0_4627 = // ****************************************************************** // * DirectSound::CMcpxBuffer::Pause // ****************************************************************** -// Not necessary -/*SOOVPA<7> DirectSound_CMcpxBuffer_Pause_1_0_4928 = +SOOVPA<7> DirectSound_CMcpxBuffer_Pause_1_0_4928 = { 0, // Large == 0 7, // Count == 7 @@ -2419,34 +2432,53 @@ SOOVPA<9> IDirectSoundBuffer8_SetAllParameters_1_0_4627 = { 0x58, 0xEB }, { 0x67, 0xE8 }, } -};*/ +}; // ****************************************************************** // * DirectSound::CDirectSoundBuffer::Pause // ****************************************************************** -SOOVPA<9> CDirectSoundBuffer_Pause_1_0_4721 = +SOOVPA<8> DirectSound_CDirectSoundBuffer_Pause_1_0_4928 = { 0, // Large == 0 - 9, // Count == 9 + 8, // Count == 8 XREF_DirectSound_CDirectSoundBuffer_Pause, // Xref Is Saved - 0, // Xref Not Used + 1, // Xref Is Used { - // CDirectSoundBuffer::Pause+0x28 : mov eax, [esp+4+arg_0] - { 0x28, 0x8B }, - { 0x29, 0x44 }, - { 0x2A, 0x24 }, - { 0x2B, 0x08 }, + { 0x35, XREF_DirectSound_CMcpxBuffer_Pause }, - // CDirectSoundBuffer::Pause+0x2C : mov ecx, [eax+0x20] - { 0x2C, 0x8B }, - { 0x2D, 0x48 }, - { 0x2E, 0x20 }, + { 0x0C, 0x00 }, + { 0x14, 0x74 }, + { 0x21, 0xB8 }, + { 0x2A, 0x24 }, + { 0x39, 0x85 }, + { 0x44, 0xFF }, + { 0x4B, 0xC7 }, + } +}; - // CDirectSoundBuffer::Pause+0x4E : retn 8 - { 0x4E, 0xC2 }, - { 0x4F, 0x08 }, +// ****************************************************************** +// * IDirectSoundBuffer_Pause +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_Pause_1_0_4928 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x15, XREF_DirectSound_CDirectSoundBuffer_Pause }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0x83 }, + { 0x0E, 0xD9 }, + { 0x12, 0xC8 }, + { 0x19, 0xC2 }, + { 0x1A, 0x08 }, } }; @@ -2520,6 +2552,474 @@ SOOVPA<8> IDirectSoundBuffer_GetStatus_1_0_4721 = } }; +// ****************************************************************** +// * DirectSound::CDirectSoundStream::SetMixBins +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundStream_SetMixBins_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x36, XREF_DSSETMIXBINSB }, + + { 0x0C, 0x00 }, + { 0x14, 0x74 }, + { 0x21, 0xB8 }, + { 0x2A, 0x24 }, + { 0x35, 0xE8 }, + { 0x40, 0x68 }, + { 0x4B, 0x8B }, + } +}; + +// ****************************************************************** +// * DirectSound::CMcpxVoiceClient::SetEG +// ****************************************************************** +SOOVPA<8> DirectSound_CMcpxVoiceClient_SetEG_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DirectSound_CMcpxVoiceClient_SetEG, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x1E, 0x75 }, + { 0x3E, 0x0F }, + { 0x5E, 0xE3 }, + { 0x7E, 0x4E }, + { 0x9E, 0x40 }, + { 0xBE, 0x50 }, + { 0xDE, 0x1C }, + { 0xFE, 0x1C }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundVoice::SetEG +// ****************************************************************** +SOOVPA<7> DirectSound_CDirectSoundVoice_SetEG_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DirectSound_CDirectSoundVoice_SetEG, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x0C, XREF_DirectSound_CMcpxVoiceClient_SetEG }, + + { 0x01, 0x44 }, + { 0x04, 0xFF }, + { 0x07, 0x08 }, + { 0x0A, 0x0C }, + { 0x10, 0xC2 }, + { 0x11, 0x08 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundStream::SetEG +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundStream_SetEG_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x36, XREF_DirectSound_CDirectSoundVoice_SetEG }, + + { 0x0C, 0x00 }, + { 0x14, 0x74 }, + { 0x21, 0xB8 }, + { 0x2A, 0x24 }, + { 0x35, 0xE8 }, + { 0x40, 0x68 }, + { 0x4B, 0x8B }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundStream::FlushEx +// ****************************************************************** +SOOVPA<7> DirectSound_CDirectSoundStream_FlushEx_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DSFLUSHEX2, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x0F, 0x00 }, + { 0x18, 0x0B }, + { 0x25, 0x05 }, + { 0x32, 0x8B }, + { 0x3F, 0x75 }, + { 0x4D, 0x85 }, + { 0x59, 0x15 }, + } +}; + +// ****************************************************************** +// * IDirectSoundStream_FlushEx +// ****************************************************************** +SOOVPA<9> IDirectSoundStream_FlushEx_1_0_4627 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x11, XREF_DSFLUSHEX2 }, + + { 0x01, 0x74 }, + { 0x04, 0xFF }, + { 0x07, 0x10 }, + { 0x0A, 0x24 }, + { 0x0D, 0x74 }, + { 0x10, 0xE8 }, + { 0x15, 0xC2 }, + { 0x16, 0x10 }, + } +}; + +// ****************************************************************** +// * XAudioDownloadEffectsImage +// ****************************************************************** +SOOVPA<8> XAudioDownloadEffectsImage_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0xB6 }, + { 0x41, 0x83 }, + { 0x61, 0x8B }, + { 0x80, 0x85 }, + { 0x9E, 0x8B }, + { 0xBE, 0x6A }, + { 0xDE, 0x07 }, + { 0xFE, 0xF7 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundVoice::SetMode +// ****************************************************************** +SOOVPA<7> DirectSound_CDirectSoundVoice_SetMode_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DSBUFFERSETMODEB, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x03, 0x0C }, + { 0x08, 0x04 }, + { 0x0D, 0x89 }, + { 0x12, 0x8B }, + { 0x17, 0x51 }, + { 0x1C, 0xE8 }, + { 0x21, 0x33 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundBuffer::SetMode +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundBuffer_SetMode_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DSBUFFERSETMODEA, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x36, XREF_DSBUFFERSETMODEB }, + + { 0x0C, 0x00 }, + { 0x14, 0x74 }, + { 0x21, 0xB8 }, + { 0x2A, 0x74 }, + { 0x35, 0xE8 }, + { 0x40, 0x68 }, + { 0x4B, 0x8B }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer8_SetMode +// ****************************************************************** +SOOVPA<9> IDirectSoundBuffer8_SetMode_1_0_4627 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x19, XREF_DSBUFFERSETMODEA }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0xFF }, + { 0x0E, 0x83 }, + { 0x12, 0xD9 }, + { 0x16, 0xC8 }, + { 0x1D, 0xC2 }, + { 0x1E, 0x0C }, + } +}; + +// ****************************************************************** +// * DirectSound::CMcpxVoiceClient::SetFilter +// ****************************************************************** +SOOVPA<8> DirectSound_CMcpxVoiceClient_SetFilter_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DirectSound_CMcpxVoiceClient_SetFilter, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x1E, 0xFF }, + { 0x3E, 0x73 }, + { 0x5E, 0x3E }, + { 0x7E, 0x0B }, + { 0x9E, 0xF6 }, + { 0xBE, 0x89 }, + { 0xDE, 0x0F }, + { 0xFE, 0xB7 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundVoice::SetFilter +// ****************************************************************** +SOOVPA<7> DirectSound_CDirectSoundVoice_SetFilter_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DirectSound_CDirectSoundVoice_SetFilter, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x0C, XREF_DirectSound_CMcpxVoiceClient_SetFilter }, + + { 0x01, 0x44 }, + { 0x04, 0xFF }, + { 0x07, 0x08 }, + { 0x0A, 0x0C }, + { 0x10, 0xC2 }, + { 0x11, 0x08 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundBuffer::SetFilter +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundBuffer_SetFilter_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DirectSound_CDirectSoundBuffer_SetFilter, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x32, XREF_DirectSound_CDirectSoundVoice_SetFilter }, + + { 0x0C, 0x00 }, + { 0x12, 0x85 }, + { 0x1C, 0x15 }, + { 0x26, 0xEB }, + { 0x30, 0x10 }, + { 0x3A, 0x74 }, + { 0x47, 0x8B }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundStream::SetFilter +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundStream_SetFilter_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DirectSound_CDirectSoundStream_SetFilter, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x36, XREF_DirectSound_CDirectSoundVoice_SetFilter }, + + { 0x0C, 0x00 }, + { 0x14, 0x74 }, + { 0x21, 0xB8 }, + { 0x2A, 0x24 }, + { 0x35, 0xE8 }, + { 0x40, 0x68 }, + { 0x4B, 0x8B }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_SetFilter +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_SetFilter_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x15, XREF_DirectSound_CDirectSoundBuffer_SetFilter }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0x83 }, + { 0x0E, 0xD9 }, + { 0x12, 0xC8 }, + { 0x19, 0xC2 }, + { 0x1A, 0x08 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundVoice::SetPitch +// ****************************************************************** +SOOVPA<6> DirectSound_CDirectSoundVoice_SetPitch_1_0_4627 = +{ + 0, // Large == 0 + 6, // Count == 6 + + XREF_DSBUFFERSETPITCHB, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x02, 0x24 }, + { 0x06, 0x10 }, + { 0x0A, 0x08 }, + { 0x0E, 0x8B }, + { 0x16, 0xC2 }, + { 0x17, 0x08 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundBuffer::SetPitch +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundBuffer_SetPitch_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DSBUFFERSETPITCHA, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x32, XREF_DSBUFFERSETPITCHB }, + + { 0x0C, 0x00 }, + { 0x12, 0x85 }, + { 0x1C, 0x15 }, + { 0x26, 0xEB }, + { 0x30, 0x10 }, + { 0x3A, 0x74 }, + { 0x47, 0x8B }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer8_SetPitch +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer8_SetPitch_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x15, XREF_DSBUFFERSETPITCHA }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0x83 }, + { 0x0E, 0xD9 }, + { 0x12, 0xC8 }, + { 0x19, 0xC2 }, + { 0x1A, 0x08 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundVoice::SetHeadroom +// ****************************************************************** +SOOVPA<7> DirectSound_CDirectSoundVoice_SetHeadroom_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DirectSound_CDirectSoundVoice_SetHeadroom, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x03, 0x04 }, + { 0x08, 0x48 }, + { 0x0D, 0x24 }, + { 0x12, 0x48 }, + { 0x17, 0x8B }, + { 0x1F, 0x5E }, + { 0x21, 0x08 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundStream::SetHeadroom +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundStream_SetHeadroom_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x36, XREF_DirectSound_CDirectSoundVoice_SetHeadroom }, + + { 0x0C, 0x00 }, + { 0x14, 0x74 }, + { 0x21, 0xB8 }, + { 0x2A, 0x24 }, + { 0x35, 0xE8 }, + { 0x40, 0x68 }, + { 0x4B, 0x8B }, + } +}; + // ****************************************************************** // * Direct_1_0_4627 // ****************************************************************** @@ -2652,6 +3152,14 @@ OOVPATable DSound_1_0_4627[] = #ifdef _DEBUG_TRACE "CDirectSound_SetAllParametersA (XRef)" #endif + }, + // CDirectSound::SetAllParametersA (XREF) + { + (OOVPA*)&CDirectSound_SetAllParametersA_1_0_4721, 0, + + #ifdef _DEBUG_TRACE + "CDirectSound_SetAllParametersA_4721 (XRef)" + #endif }, // CDirectSound_SetAllParametersA (XREF) { @@ -2662,7 +3170,7 @@ OOVPATable DSound_1_0_4627[] = #endif }, // IDirectSound8::SetAllParameters (* unchanged since 3936 *) - { + /*{ (OOVPA*)&IDirectSound8_SetAllParameters_1_0_3936, XTL::EmuIDirectSound8_SetAllParameters, @@ -2670,7 +3178,7 @@ OOVPATable DSound_1_0_4627[] = #ifdef _DEBUG_TRACE "EmuIDirectSound8_SetAllParameters" #endif - }, + },*/ // CDirectSoundVoiceSettings_SetMixBins (* unchanged since 4432 *) { (OOVPA*)&CDirectSoundVoiceSettings_SetMixBins_1_0_4432, 0, @@ -2746,6 +3254,15 @@ OOVPATable DSound_1_0_4627[] = #ifdef _DEBUG_TRACE "CDirectSound_SetPositionA (XRef)" #endif + }, + // CDirectSound::SetPositionA (XREF) + // TODO: Find a cure for laziness... + { + (OOVPA*)&CDirectSound_SetPositionA_1_0_4432, 0, + + #ifdef _DEBUG_TRACE + "CDirectSound_SetPositionA_4432 (XRef)" + #endif }, // IDirectSound8::SetPosition (* unchanged since 3936 *) { @@ -2777,9 +3294,9 @@ OOVPATable DSound_1_0_4627[] = "EmuIDirectSound8_CreateSoundBuffer" #endif }, - // IDirectSound8::AddRef (* unchanged since 4361 *) + // IDirectSound8::AddRef (* unchanged since 3936 *) { - (OOVPA*)&IDirectSound8_AddRef_1_0_4361, + (OOVPA*)&IDirectSound8_AddRef_1_0_3936, XTL::EmuIDirectSound8_AddRef, @@ -2927,6 +3444,22 @@ OOVPATable DSound_1_0_4627[] = "CMcpxBuffer_GetStatus (XREF)" #endif }, + // CMcpxBuffer::GetStatus + { + (OOVPA*)&CMcpxBuffer_GetStatus_1_0_4721, 0, + + #ifdef _DEBUG_TRACE + "CMcpxBuffer_GetStatus_4721 (XREF)" + #endif + }, + // CMcpxBuffer::GetStatus + /*{ + (OOVPA*)&CMcpxBuffer_GetStatus_1_0_4928, 0, + + #ifdef _DEBUG_TRACE + "CMcpxBuffer_GetStatus_4928 (XREF)" + #endif + },*/ // CMcpxBuffer::GetStatusB { (OOVPA*)&CMcpxBuffer_GetStatusB_1_0_4627, 0, @@ -3503,27 +4036,26 @@ OOVPATable DSound_1_0_4627[] = #endif }, // DirectSound::CDirectSoundVoice::SetHeadroom (XREF) - { - (OOVPA*)&CDirectSoundVoice_SetHeadroom_1_0_4627, - 0, + //{ + // (OOVPA*)&CDirectSoundVoice_SetHeadroom_1_0_4627, + // 0, - #ifdef _DEBUG_TRACE - "CDirectSoundVoice::SetHeadroom (XREF)" - #endif - }, - // CDirectSoundStream_SetHeadroom (XREF) - { - (OOVPA*)&CDirectSoundStream_SetHeadroom_1_0_4627, - XTL::EmuIDirectSoundStream_SetHeadroom, + // #ifdef _DEBUG_TRACE + // "CDirectSoundVoice::SetHeadroom (XREF)" + // #endif + //}, + //// CDirectSoundStream_SetHeadroom (XREF) + //{ + // (OOVPA*)&CDirectSoundStream_SetHeadroom_1_0_4627, + // XTL::EmuIDirectSoundStream_SetHeadroom, - #ifdef _DEBUG_TRACE - "IDirectSoundStream_SetHeadroom" - #endif - }, - // IDirectSoundBuffer_AddRef - // TODO: Same as 3936? + // #ifdef _DEBUG_TRACE + // "IDirectSoundStream_SetHeadroom" + // #endif + //}, + // IDirectSoundBuffer_AddRef (* unchanged since 3936 *) { - (OOVPA*)&IDirectSoundBuffer8_AddRef_1_0_4627, + (OOVPA*)&IDirectSoundBuffer8_AddRef_1_0_3936, XTL::EmuIDirectSoundBuffer8_AddRef, @@ -3575,30 +4107,30 @@ OOVPATable DSound_1_0_4627[] = "EmuIDirectSoundBuffer8_SetAllParameters" #endif }, - // CDirectSoundBuffer_Pause_1_0_4721 - /*{ - (OOVPA*)&CDirectSoundBuffer_Pause_1_0_4721, 0, + // DirectSound_CMcpxBuffer_Pause_1_0_4928 + { + (OOVPA*)&DirectSound_CMcpxBuffer_Pause_1_0_4928, 0, #ifdef _DEBUG_TRACE - "CDirectSoundBuffer::Pause_4721 (XREF)" + "CMcpxBuffer::Pause_4928 (XREF)" #endif - },*/ + }, // CDirectSoundBuffer::Pause { - (OOVPA*)&DirectSound_CDirectSoundBuffer_Pause_1_0_4721, 0, + (OOVPA*)&DirectSound_CDirectSoundBuffer_Pause_1_0_4928, 0, #ifdef _DEBUG_TRACE - "CDirectSoundBuffer::Pause_4721 (XREF)" + "CDirectSoundBuffer::Pause_4928 (XREF)" #endif }, // IDirectSoundBuffer8_Pause { - (OOVPA*)&IDirectSoundBuffer_Pause_1_0_4721, + (OOVPA*)&IDirectSoundBuffer_Pause_1_0_4928, XTL::EmuIDirectSoundBuffer8_Pause, #ifdef _DEBUG_TRACE - "IDirectSoundBuffer8_Pause_4721 (XREF)" + "IDirectSoundBuffer8_Pause_4928 (XREF)" #endif }, // DirectSound::CMcpxBuffer::GetStatus (XREF) @@ -3619,7 +4151,7 @@ OOVPATable DSound_1_0_4627[] = "DirectSound::CDirectSoundBuffer::GetStatus (XREF)" #endif }, - // IDirectSoundBuffer_GetStatus@8 + // IDirectSoundBuffer_GetStatus { (OOVPA*)&IDirectSoundBuffer_GetStatus_1_0_4721, XTL::EmuIDirectSoundBuffer8_GetStatus, @@ -3628,6 +4160,243 @@ OOVPATable DSound_1_0_4627[] = "IDirectSoundBuffer_GetStatus" #endif }, + // CDirectSoundStream::SetMixBins + { + (OOVPA*)&DirectSound_CDirectSoundStream_SetMixBins_1_0_4627, + + XTL::EmuCDirectSoundStream_SetMixBins, + + #ifdef _DEBUG_TRACE + "EmuCDirectSoundStream_SetMixBins" + #endif + }, + // CMcpxVoiceClient::SetEG + { + (OOVPA*)&DirectSound_CMcpxVoiceClient_SetEG_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "CMcpxVoiceClient::SetEG (XREF)" + #endif + }, + // CDirectSoundVoice::SetEG (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundVoice_SetEG_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundVoice::SetEG (XREF)" + #endif + }, + // DirectSound::CDirectSoundBuffer::SetEG (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundStream_SetEG_1_0_4627, + + XTL::EmuCDirectSoundStream_SetEG, + + #ifdef _DEBUG_TRACE + "EmuCDirectSoundStream::SetEG" + #endif + }, + // CDirectSoundStream::FlushEx (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundStream_FlushEx_1_0_4627, + 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundStream::FlushEx (XREF)" + #endif + }, + // IDirectSoundStream_FlushEx + { + (OOVPA*)&IDirectSoundStream_FlushEx_1_0_4627, + XTL::EmuIDirectSoundStream_FlushEx, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundStream_FlushEx" + #endif + }, + // XAudioDownloadEffectsImage + { + (OOVPA*)&XAudioDownloadEffectsImage_1_0_4627, + XTL::EmuXAudioDownloadEffectsImage, + + #ifdef _DEBUG_TRACE + "EmuXAudioDownloadEffectsImage" + #endif + }, + // CDirectSoundVoice::SetMode (XRef) + { + (OOVPA*)&DirectSound_CDirectSoundVoice_SetMode_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundVoice::SetMode (XRef)" + #endif + }, + // CDirectSoundBuffer::SetMode (XRef) + { + (OOVPA*)&DirectSound_CDirectSoundBuffer_SetMode_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundBuffer::SetMode (XRef)" + #endif + }, + // IDirectSoundBuffer_SetMode + { + (OOVPA*)&IDirectSoundBuffer8_SetMode_1_0_4627, + XTL::EmuIDirectSoundBuffer8_SetMode, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer8_SetMode" + #endif + }, + // DirectSound::CMcpxVoiceClient::SetFilter (XREF) + { + (OOVPA*)&DirectSound_CMcpxVoiceClient_SetFilter_1_0_4627, + 0, + + #ifdef _DEBUG_TRACE + "CMcpxVoiceClient::SetFilter (XREF)" + #endif + }, + // DirectSound::CDirectSoundVoice::SetFilter (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundVoice_SetFilter_1_0_4627, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundVoice::SetFilter (XREF)" + #endif + }, + // DirectSound::CDirectSoundBuffer::SetFilter (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundBuffer_SetFilter_1_0_4627, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundBuffer::SetFilter (XREF)" + #endif + }, + // DirectSound::CDirectSoundStream::SetFilter (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundStream_SetFilter_1_0_4627, + XTL::EmuCDirectSoundStream_SetFilter, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundStream::SetFilter (XREF)" + #endif + }, + // IDirectSoundBuffer_SetFilter + { + (OOVPA*)&IDirectSoundBuffer_SetFilter_1_0_4627, + XTL::EmuIDirectSoundBuffer8_SetFilter, + + #ifdef _DEBUG_TRACE + "IDirectSoundBuffer_SetFilter" + #endif + }, + // DirectSound::CDirectSoundBuffer::PlayEx (XREF) (* unchanged since 4361 *) + { + (OOVPA*)&DirectSound_CDirectSoundBuffer_PlayEx_1_0_4361, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundBuffer::PlayEx (XREF)" + #endif + }, + // IDirectSoundBuffer_PlayEx (* unchanged since 4361 *) + { + (OOVPA*)&IDirectSoundBuffer_PlayEx_1_0_4361, + XTL::EmuIDirectSoundBuffer8_PlayEx, + + #ifdef _DEBUG_TRACE + "IDirectSoundBuffer_PlayEx" + #endif + }, + // CMcpxBuffer_Stop2 + { + (OOVPA*)&CMcpxBuffer_Stop2_1_0_4361, 0, + + #ifdef _DEBUG_TRACE + "CMcpxBuffer_Stop2 (XREF)" + #endif + }, + // DirectSound::CDirectSoundBuffer::StopEx (XREF) (* unchanged since 4361 *) + { + (OOVPA*)&DirectSound_CDirectSoundBuffer_StopEx_1_0_4361, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundBuffer::StopEx (XREF)" + #endif + }, + // IDirectSoundBuffer_StopEx (* unchanged since 4361 *) + { + (OOVPA*)&IDirectSoundBuffer_StopEx_1_0_4361, + XTL::EmuIDirectSoundBuffer8_StopEx, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer_StopEx" + #endif + }, + // CDirectSound::SetVelocity (XREF) + { + (OOVPA*)&CDirectSound_SetVelocity_1_0_4432, 0, + + #ifdef _DEBUG_TRACE + "CDirectSound_SetVelocityA_4432 (XRef)" + #endif + }, + // CDirectSoundVoice::SetPosition (XREF) + { + (OOVPA*)&CDirectSoundVoice_SetPosition_1_0_4432, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundVoice::SetPosition_4432 (XRef)" + #endif + }, + // CDirectSoundVoice::SetPitch + { + (OOVPA*)&DirectSound_CDirectSoundVoice_SetPitch_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundVoice::SetPitch (XREF)" + #endif + }, + // IDirectSoundBuffer8::SetPitch + { + (OOVPA*)&DirectSound_CDirectSoundBuffer_SetPitch_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundBuffer::SetPitch (XREF)" + #endif + }, + // IDirectSoundBuffer8::SetPitch + { + (OOVPA*)&IDirectSoundBuffer8_SetPitch_1_0_4627, + + XTL::EmuIDirectSoundBuffer8_SetPitch, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer8_SetPitch" + #endif + }, + // DirectSound::CDirectSoundVoice::SetHeadroom (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundVoice_SetHeadroom_1_0_4627, + 0, + + #ifdef _DEBUG_TRACE + "CDirectSoundVoice::SetHeadroom (XREF)" + #endif + }, + // CDirectSoundStream_SetHeadroom (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundStream_SetHeadroom_1_0_4627, + XTL::EmuIDirectSoundStream_SetHeadroom, + + #ifdef _DEBUG_TRACE + "EmuCDirectSoundStream_SetHeadroom" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.5558.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.5558.inl index d4bb95ebb..331a76528 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.5558.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.5558.inl @@ -1701,6 +1701,28 @@ SOOVPA<8> IDirectSoundBuffer8_SetDopplerFactor_1_0_5558 = { 0x21, 0xC2 }, } }; +// ****************************************************************** +// * IDirectSoundBuffer_Lock +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_Lock_1_0_5558 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x04, 0x75 }, + { 0x0A, 0x75 }, + { 0x10, 0x1C }, + { 0x16, 0x18 }, + { 0x1C, 0x1B }, + { 0x22, 0xC8 }, + { 0x2C, 0x5D }, + { 0x2E, 0x20 }, + } +}; // ****************************************************************** // * Direct_1_0_5558 @@ -2629,6 +2651,16 @@ OOVPATable DSound_1_0_5558[] = "EmuDirectSoundCreateBuffer" #endif }, + // IDirectSoundBuffer_Lock + { + (OOVPA*)&IDirectSoundBuffer_Lock_1_0_5558, + + XTL::EmuIDirectSoundBuffer8_Lock, + + #ifdef _DEBUG_TRACE + "EmuIDirectSoundBuffer8_Lock" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.5849.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.5849.inl index 0e274a3cc..3056ea3ce 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.5849.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.5849.inl @@ -247,6 +247,99 @@ SOOVPA<11> CMcpxBuffer_Play_1_0_5849 = } }; +// ****************************************************************** +// * DirectSound::CDirectSoundVoice::SetHeadroom +// ****************************************************************** +SOOVPA<7> DirectSound_CDirectSoundVoice_SetHeadroom_1_0_5849 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DirectSound_CDirectSoundVoice_SetHeadroom, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x03, 0x04 }, + { 0x08, 0x48 }, + { 0x0D, 0x24 }, + { 0x12, 0x48 }, + { 0x17, 0x8B }, + { 0x1F, 0x5E }, + { 0x21, 0x08 }, + } +}; + +// ****************************************************************** +// * DirectSound::CDirectSoundBuffer::SetHeadroom +// ****************************************************************** +SOOVPA<8> DirectSound_CDirectSoundBuffer_SetHeadroom_1_0_5849 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_DirectSound_CDirectSoundBuffer_SetHeadroom, // Xref Is Saved + 1, // Xref Is Used + + { + { 0x32, XREF_DirectSound_CDirectSoundVoice_SetHeadroom }, + + { 0x0C, 0x00 }, + { 0x12, 0x85 }, + { 0x1C, 0x15 }, + { 0x26, 0xEB }, + { 0x30, 0x10 }, + { 0x3A, 0x74 }, + { 0x47, 0x8B }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_SetHeadroom +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_SetHeadroom_1_0_5849 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x15, XREF_DirectSound_CDirectSoundBuffer_SetHeadroom }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0x83 }, + { 0x0E, 0xD9 }, + { 0x12, 0xC8 }, + { 0x19, 0xC2 }, + { 0x1A, 0x08 }, + } +}; + +// ****************************************************************** +// * IDirectSoundBuffer_Lock +// ****************************************************************** +SOOVPA<8> IDirectSoundBuffer_Lock_1_0_5849 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x04, 0x75 }, + { 0x0A, 0x75 }, + { 0x10, 0x1C }, + { 0x16, 0x18 }, + { 0x1C, 0x1B }, + { 0x22, 0xC8 }, + { 0x2C, 0x5D }, + { 0x2E, 0x20 }, + } +}; + // ****************************************************************** // * Direct_1_0_5849 // ****************************************************************** @@ -566,6 +659,42 @@ OOVPATable DSound_1_0_5849[] = "EmuIDirectSoundBuffer8_Release" #endif }, + // DirectSound::CDirectSoundVoice::SetHeadroom (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundVoice_SetHeadroom_1_0_5849, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundVoice::SetHeadroom (XREF)" + #endif + }, + // DirectSound::CDirectSoundBuffer::SetHeadroom (XREF) + { + (OOVPA*)&DirectSound_CDirectSoundBuffer_SetHeadroom_1_0_5849, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSoundBuffer::SetHeadroom (XREF)" + #endif + }, + // IDirectSoundBuffer_SetHeadroom + { + (OOVPA*)&IDirectSoundBuffer_SetHeadroom_1_0_5849, + XTL::EmuIDirectSoundBuffer8_SetHeadroom, + + #ifdef _DEBUG_TRACE + "IDirectSoundBuffer_SetHeadroom" + #endif + }, + // IDirectSoundBuffer_Lock + { + (OOVPA*)&IDirectSoundBuffer_Lock_1_0_5849, + XTL::EmuIDirectSoundBuffer8_Lock, + + #ifdef _DEBUG_TRACE + "IDirectSoundBuffer_Lock" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/HLE_3911.rar b/src/CxbxKrnl/HLEDataBase/HLE_3911.rar new file mode 100644 index 000000000..e03095dec Binary files /dev/null and b/src/CxbxKrnl/HLEDataBase/HLE_3911.rar differ diff --git a/src/CxbxKrnl/HLEDataBase/XG.1.0.3911.h b/src/CxbxKrnl/HLEDataBase/XG.1.0.3911.h new file mode 100644 index 000000000..2b0fc106a --- /dev/null +++ b/src/CxbxKrnl/HLEDataBase/XG.1.0.3911.h @@ -0,0 +1,42 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->XG.1.0.3911.h +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** +#ifndef XG_1_0_3911_H +#define XG_1_0_3911_H + +#include "OOVPA.h" + +extern OOVPATable XG_1_0_3911[]; +extern uint32 XG_1_0_3911_SIZE; + +#endif diff --git a/src/CxbxKrnl/HLEDataBase/XG.1.0.3911.inl b/src/CxbxKrnl/HLEDataBase/XG.1.0.3911.inl new file mode 100644 index 000000000..680f8b824 --- /dev/null +++ b/src/CxbxKrnl/HLEDataBase/XG.1.0.3911.inl @@ -0,0 +1,208 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->XG.1.0.3911.inl +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** + +// ****************************************************************** +// * XGIsSwizzledFormat +// ****************************************************************** +SOOVPA<7> XGIsSwizzledFormat_1_0_3911 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0x7F }, + { 0x10, 0x7C }, + { 0x19, 0x0B }, + { 0x22, 0xF8 }, + { 0x2B, 0x83 }, + { 0x34, 0x0A }, + { 0x3D, 0x7F }, + } +}; + +// ****************************************************************** +// * XGSwizzleRect +// ****************************************************************** +SOOVPA<8> XGSwizzleRect_1_0_3911 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x03 }, + { 0x3E, 0x89 }, + { 0x5E, 0x83 }, + { 0x7E, 0x6C }, + { 0x9E, 0xFF }, + { 0xBE, 0xFF }, + { 0xDE, 0x89 }, + { 0xFE, 0x89 }, + } +}; + +// ****************************************************************** +// * XGSwizzleBox +// ****************************************************************** +SOOVPA<8> XGSwizzleBox_1_0_3911 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x75 }, + { 0x3E, 0x4D }, + { 0x5E, 0x48 }, + { 0x7E, 0x04 }, + { 0x9E, 0xD8 }, + { 0xC0, 0x83 }, + { 0xDE, 0xAF }, + { 0xFE, 0x45 }, + } +}; + +// ****************************************************************** +// * XGUnswizzleRect +// ****************************************************************** +SOOVPA<8> XGUnswizzleRect_1_0_3911 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x03 }, + { 0x3E, 0x00 }, + { 0x5E, 0xD2 }, + { 0x7E, 0x75 }, + { 0x9E, 0x70 }, + { 0xC1, 0xE9 }, + { 0xDE, 0x89 }, + { 0xFE, 0x60 }, + } +}; + +// ****************************************************************** +// * XGWriteSurfaceOrTextureToXPR +// ****************************************************************** +SOOVPA<7> XGWriteSurfaceOrTextureToXPR_1_0_3911 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x3D }, + { 0x3E, 0xE0 }, + { 0x5E, 0x75 }, + { 0x7E, 0x33 }, + { 0x9E, 0xC2 }, + { 0xBE, 0xF0 }, + { 0xDE, 0xFC }, + } +}; + +// ****************************************************************** +// * XG_1_0_3911 +// ****************************************************************** +OOVPATable XG_1_0_3911[] = +{ + // XGIsSwizzledFormat + { + (OOVPA*)&XGIsSwizzledFormat_1_0_3911, + + XTL::EmuXGIsSwizzledFormat, + + #ifdef _DEBUG_TRACE + "XGIsSwizzledFormat" + #endif + }, + // XGSwizzleRect + { + (OOVPA*)&XGSwizzleRect_1_0_3911, + + XTL::EmuXGSwizzleRect, + + #ifdef _DEBUG_TRACE + "EmuXGSwizzleRect" + #endif + }, + // XGUnswizzleRect + { + (OOVPA*)&XGUnswizzleRect_1_0_3911, + + XTL::EmuXGUnswizzleRect, + + #ifdef _DEBUG_TRACE + "EmuXGUnswizzleRect" + #endif + }, + // XGSwizzleBox + { + (OOVPA*)&XGSwizzleBox_1_0_3911, + + XTL::EmuXGSwizzleBox, + + #ifdef _DEBUG_TRACE + "EmuXGSwizzleBox" + #endif + }, + // XGWriteSurfaceOrTextureToXPR + { + (OOVPA*)&XGWriteSurfaceOrTextureToXPR_1_0_3911, + + XTL::EmuXGWriteSurfaceOrTextureToXPR, + + #ifdef _DEBUG_TRACE + "EmuXGWriteSurfaceOrTextureToXPR" + #endif + }, +}; + +// ****************************************************************** +// * XG_1_0_3911_SIZE +// ****************************************************************** +uint32 XG_1_0_3911_SIZE = sizeof(XG_1_0_3911); \ No newline at end of file diff --git a/src/CxbxKrnl/HLEDataBase/XG.1.0.4627.inl b/src/CxbxKrnl/HLEDataBase/XG.1.0.4627.inl index 82e22d4cc..c6d39290a 100644 --- a/src/CxbxKrnl/HLEDataBase/XG.1.0.4627.inl +++ b/src/CxbxKrnl/HLEDataBase/XG.1.0.4627.inl @@ -64,6 +64,28 @@ SOOVPA<10> XGSwizzleBox_1_0_4627 = } }; +// ****************************************************************** +// * XGWriteSurfaceOrTextureToXPR +// ****************************************************************** +SOOVPA<7> XGWriteSurfaceOrTextureToXPR_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x3D }, + { 0x3E, 0xE0 }, + { 0x5E, 0x75 }, + { 0x7E, 0x33 }, + { 0x9E, 0xC2 }, + { 0xBE, 0xF0 }, + { 0xE2, 0x8B }, + } +}; + // ****************************************************************** // * XG_1_0_4627 // ****************************************************************** @@ -99,6 +121,16 @@ OOVPATable XG_1_0_4627[] = "EmuXGSwizzleBox" #endif }, + // XGWriteSurfaceOrTextureToXPR + { + (OOVPA*)&XGWriteSurfaceOrTextureToXPR_1_0_4627, + + XTL::EmuXGWriteSurfaceOrTextureToXPR, + + #ifdef _DEBUG_TRACE + "EmuXGWriteSurfaceOrTextureToXPR" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/XOnline.1.0.4627.inl b/src/CxbxKrnl/HLEDataBase/XOnline.1.0.4627.inl index 6c1de4f44..72882c05e 100644 --- a/src/CxbxKrnl/HLEDataBase/XOnline.1.0.4627.inl +++ b/src/CxbxKrnl/HLEDataBase/XOnline.1.0.4627.inl @@ -64,6 +64,52 @@ SOOVPA<12> XnInit_1_0_4627 = } }; +// ****************************************************************** +// * XNetGetEthernetLinkStatus +// ****************************************************************** +SOOVPA<8> XNetGetEthernetLinkStatus_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x08, 0x33 }, + { 0x10, 0x8A }, + { 0x19, 0x00 }, + { 0x22, 0x56 }, + { 0x2B, 0xFF }, + { 0x34, 0xF0 }, + { 0x3D, 0x24 }, + { 0x46, 0x5B }, + } +}; + +// ****************************************************************** +// * XoUpdateLaunchNewImageInternal +// ****************************************************************** +SOOVPA<8> XoUpdateLaunchNewImageInternal_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_XoUpdateLaunchNewImageInternal, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x1E, 0xDB }, + { 0x3E, 0x1B }, + { 0x5E, 0xF6 }, + { 0x81, 0x83 }, + { 0x9E, 0xE8 }, + { 0xBE, 0x50 }, + { 0xDE, 0xE8 }, + { 0xFE, 0x15 }, + } +}; + // ****************************************************************** // * XOnline_1_0_4627 // ****************************************************************** @@ -137,6 +183,23 @@ OOVPATable XOnline_1_0_4627[] = "Emuioctlsocket" #endif }, + // XNetGetEthernetLinkStatus + { + (OOVPA*)&XNetGetEthernetLinkStatus_1_0_4627, + XTL::EmuXNetGetEthernetLinkStatus, + + #ifdef _DEBUG_TRACE + "XNetGetEthernetLinkStatus" + #endif + }, + // XoUpdateLaunchNewImageInternal (XREF) + { + (OOVPA*)&XoUpdateLaunchNewImageInternal_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "XoUpdateLaunchNewImageInternal (XREF)" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/XOnline.1.0.5233.h b/src/CxbxKrnl/HLEDataBase/XOnline.1.0.5233.h new file mode 100644 index 000000000..22b307366 --- /dev/null +++ b/src/CxbxKrnl/HLEDataBase/XOnline.1.0.5233.h @@ -0,0 +1,42 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->XOnline.1.0.5233.h +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** +#ifndef XONLINE_1_0_5233_H +#define XONLINE_1_0_5233_H + +#include "OOVPA.h" + +extern OOVPATable XOnline_1_0_5233[]; +extern uint32 XOnline_1_0_5233_SIZE; + +#endif diff --git a/src/CxbxKrnl/HLEDataBase/XOnline.1.0.5233.inl b/src/CxbxKrnl/HLEDataBase/XOnline.1.0.5233.inl new file mode 100644 index 000000000..fbac0fa80 --- /dev/null +++ b/src/CxbxKrnl/HLEDataBase/XOnline.1.0.5233.inl @@ -0,0 +1,233 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->XOnline.1.0.4627.inl +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** + +// ****************************************************************** +// * XNetStartup +// ****************************************************************** +SOOVPA<8> XNetStartup_1_0_5344 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x01, 0xC0 }, + { 0x04, 0x50 }, + { 0x07, 0x24 }, + { 0x0A, 0x68 }, + { 0x0F, 0xE8 }, + { 0x14, 0xC2 }, + { 0x15, 0x04 }, + { 0x16, 0x00 }, + } +}; + +// ****************************************************************** +// * XNetGetEthernetLinkStatus +// ****************************************************************** +SOOVPA<8> XNetGetEthernetLinkStatus_1_0_5344 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x08, 0x33 }, + { 0x10, 0x8A }, + { 0x19, 0x00 }, + { 0x22, 0x56 }, + { 0x2B, 0xFF }, + { 0x34, 0xF0 }, + { 0x3D, 0x24 }, + { 0x46, 0x5B }, + } +}; + +// ****************************************************************** +// * CXo::XOnlineLogon +// ****************************************************************** +SOOVPA<8> CXo_XOnlineLogon_1_0_5344 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_CXo_XOnlineLogon, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x21, 0xA8 }, + { 0x3E, 0x80 }, + { 0x5E, 0x00 }, + { 0x7E, 0x04 }, + { 0xA2, 0x85 }, + { 0xBE, 0xEC }, + { 0xDE, 0xF9 }, + { 0xFE, 0x33 }, + } +}; + +// ****************************************************************** +// * XOnlineLogon +// ****************************************************************** +SOOVPA<8> XOnlineLogon_1_0_5344 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x0B, XREF_CXo_XOnlineLogon }, + + { 0x00, 0x55 }, + { 0x01, 0x8B }, + { 0x02, 0xEC }, + { 0x03, 0x5D }, + { 0x04, 0x8B }, + { 0x05, 0x0D }, + { 0x0A, 0xE9 }, + } +}; + +// ****************************************************************** +// * XOnline_1_0_4627 +// ****************************************************************** +OOVPATable XOnline_1_0_5233[] = +{ + // XNetStartup + { + (OOVPA*)&XNetStartup_1_0_5344, + + XTL::EmuXNetStartup, + + #ifdef _DEBUG_TRACE + "EmuXNetStartup" + #endif + }, + // WSAStartup (* unchanged since 4361 *) + { + (OOVPA*)&WSAStartup_1_0_4361, + + XTL::EmuWSAStartup, + + #ifdef _DEBUG_TRACE + "EmuWSAStartup" + #endif + }, + // XnInit (XREF) (* unchanged since 4627 *) + { + (OOVPA*)&XnInit_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "XnInit (XRef)" + #endif + }, + // socket + /*{ + (OOVPA*)&socket_1_0_4361, + + MFPtoFP(XTL::EmuThis::Emusocket), + + #ifdef _DEBUG_TRACE + "Emusocket" + #endif + },*/ + // bind (* unchanged since 4361 *) + { + (OOVPA*)&bind_1_0_4361, + + MFPtoFP(XTL::EmuThis::Emubind), + + #ifdef _DEBUG_TRACE + "Emubind" + #endif + }, + // listen + /*{ + (OOVPA*)&listen_1_0_4361, + + MFPtoFP(XTL::EmuThis::Emulisten), + + #ifdef _DEBUG_TRACE + "Emulisten" + #endif + },*/ + // ioctlsocket (* unchanged since 4361 *) + { + (OOVPA*)&ioctlsocket_1_0_4361, + + MFPtoFP(XTL::EmuThis::Emuioctlsocket), + + #ifdef _DEBUG_TRACE + "Emuioctlsocket" + #endif + }, + // XNetGetEthernetLinkStatus + { + (OOVPA*)&XNetGetEthernetLinkStatus_1_0_5344, + XTL::EmuXNetGetEthernetLinkStatus, + + #ifdef _DEBUG_TRACE + "EmuXNetGetEthernetLinkStatus" + #endif + }, + // CXo::XOnlineLogon (XREF) + { + (OOVPA*)&CXo_XOnlineLogon_1_0_5344, + 0, + + #ifdef _DEBUG_TRACE + "CXo::XOnlineLogon (XREF) (5344)" + #endif + }, + // XOnlineLogon + { + (OOVPA*)&XOnlineLogon_1_0_5344, + XTL::EmuXOnlineLogon, + + #ifdef _DEBUG_TRACE + "EmuXOnlineLogon (5344)" + #endif + }, +}; + +// ****************************************************************** +// * XOnline_1_0_5233_SIZE +// ****************************************************************** +uint32 XOnline_1_0_5233_SIZE = sizeof(XOnline_1_0_5233); diff --git a/src/CxbxKrnl/HLEDataBase/XactEng.1.0.4627.inl b/src/CxbxKrnl/HLEDataBase/XactEng.1.0.4627.inl index 627109422..0ee6dcb8e 100644 --- a/src/CxbxKrnl/HLEDataBase/XactEng.1.0.4627.inl +++ b/src/CxbxKrnl/HLEDataBase/XactEng.1.0.4627.inl @@ -190,7 +190,39 @@ SOOVPA<8> XACT_CEngine_RegisterStreamedWaveBank_1_0_4627 = }; // ****************************************************************** -// * IXACTEngine_RegisterStreamedWaveBank +// * XACT::CEngine::RegisterStreamedWaveBank +// ****************************************************************** +SOOVPA<13> XACT_CEngine_RegisterStreamedWaveBank_1_0_4928 = +{ + 0, // Large == 0 + 13, // Count == 13 + + XREF_XACT_CEngine_RegisterStreamedWaveBank, // Xref Is Saved + 0, // Xref Not Used + + { + // XACT_CEngine_RegisterStreamedWaveBank+0x07 : push 0x7C + { 0x07, 0x6A }, // (Offset,Value)-Pair #1 + { 0x08, 0x7C }, // (Offset,Value)-Pair #2 + // XACT_CEngine_RegisterStreamedWaveBank+0x30 : add esi, 0x8007000E + { 0x30, 0x81 }, // (Offset,Value)-Pair #3 + { 0x31, 0xC7 }, // (Offset,Value)-Pair #4 + { 0x32, 0x0E }, // (Offset,Value)-Pair #5 + { 0x33, 0x00 }, // (Offset,Value)-Pair #6 + { 0x34, 0x07 }, // (Offset,Value)-Pair #7 + { 0x35, 0x80 }, // (Offset,Value)-Pair #8 + // XACT_CEngine_RegisterStreamedWaveBank+0x50 : add ecx, 0x44 + { 0x50, 0x83 }, // (Offset,Value)-Pair #9 + { 0x51, 0xC1 }, // (Offset,Value)-Pair #10 + { 0x52, 0x44 }, // (Offset,Value)-Pair #11 + // XACT_CEngine_RegisterStreamedWaveBank+0x71 : retn 0x0C + { 0x71, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x72, 0x0C }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IXACTEngine_RegisterStreamedWaveBank // ****************************************************************** SOOVPA<9> IXACTEngine_RegisterStreamedWaveBank_1_0_4627 = { @@ -214,6 +246,36 @@ SOOVPA<9> IXACTEngine_RegisterStreamedWaveBank_1_0_4627 = } }; +// ****************************************************************** +// * IXACTEngine_RegisterStreamedWaveBank +// ****************************************************************** +SOOVPA<10> IXACTEngine_RegisterStreamedWaveBank_1_0_4928 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + // IXACTEngine_RegisterStreamedWaveBank+0x22 : call XACT::CEngine::RegisterStreamedWaveBank + { 0x23, XREF_XACT_CEngine_RegisterStreamedWaveBank }, + + // IXACTEngine_RegisterStreamedWaveBank+0x0B : movzx esi, al + { 0x0B, 0x0F }, + { 0x0C, 0xB6 }, + { 0x0D, 0xF0 }, + // IXACTEngine_RegisterStreamedWaveBank+0x0E : mov eax, [esp+0x0C+4] + { 0x0E, 0x8B }, + { 0x0F, 0x44 }, + { 0x10, 0x24 }, + { 0x11, 0x10 }, + // IXACTEngine_RegisterStreamedWaveBank+0x3C : retn 0x0C + { 0x3C, 0xC2 }, + { 0x3D, 0x0C }, + } +}; + // ****************************************************************** // * XACT::CEngine::CreateSoundBank // ****************************************************************** @@ -237,6 +299,38 @@ SOOVPA<8> XACT_CEngine_CreateSoundBank_1_0_4627 = } }; +// ****************************************************************** +// * XACT::CEngine::CreateSoundBank +// ****************************************************************** +SOOVPA<13> XACT_CEngine_CreateSoundBank_1_0_4928 = +{ + 0, // Large == 0 + 13, // Count == 13 + + XREF_XACT_CEngine_CreateSoundBank, // Xref Is Saved + 0, // Xref Not Used + + { + // XACT::CEngine::CreateSoundBank+0x02 : push 0x34 + { 0x02, 0x6A }, // (Offset,Value)-Pair #1 + { 0x03, 0x34 }, // (Offset,Value)-Pair #2 + // XACT::CEngine::CreateSoundBank+0x2B : add edi, 0x8007000E + { 0x2B, 0x81 }, // (Offset,Value)-Pair #3 + { 0x2C, 0xC7 }, // (Offset,Value)-Pair #4 + { 0x2D, 0x0E }, // (Offset,Value)-Pair #5 + { 0x2E, 0x00 }, // (Offset,Value)-Pair #6 + { 0x2F, 0x07 }, // (Offset,Value)-Pair #7 + { 0x30, 0x80 }, // (Offset,Value)-Pair #8 + // XACT::CEngine::CreateSoundBank+0x4F : add ecx, 0x4C + { 0x4F, 0x83 }, // (Offset,Value)-Pair #9 + { 0x50, 0xC1 }, // (Offset,Value)-Pair #10 + { 0x51, 0x4C }, // (Offset,Value)-Pair #11 + // XACT::CEngine::CreateSoundBank+0x73 : retn 0x10 + { 0x73, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x74, 0x10 }, // (Offset,Value)-Pair #13 + } +}; + // ****************************************************************** // * IXACTEngine_CreateSoundBank // ****************************************************************** @@ -261,6 +355,35 @@ SOOVPA<8> IXACTEngine_CreateSoundBank_1_0_4627 = } }; +// ****************************************************************** +// * IXACTEngine_CreateSoundBank +// ****************************************************************** +SOOVPA<10> IXACTEngine_CreateSoundBank_1_0_4928 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x27, XREF_XACT_CEngine_CreateSoundBank }, + + // IXACTEngine_CreateSoundBank+0x07 : push [ebp+8+0x10] + { 0x07, 0xFF }, + { 0x08, 0x74 }, + { 0x09, 0x24 }, + { 0x0A, 0x18 }, + // IXACTEngine_CreateSoundBank+0x0B : movzx esi, al + { 0x0B, 0x0F }, + { 0x0C, 0xB6 }, + { 0x0D, 0xF0 }, + // IXACTEngine_CreateSoundBank+0x40 : retn 0x10 + { 0x40, 0xC2 }, + { 0x41, 0x10 }, + } +}; + // ****************************************************************** // * XACT::CEngine::DownloadEffectsImage // ****************************************************************** @@ -404,7 +527,7 @@ SOOVPA<9> IXACTSoundBank_GetSoundCueIndexFromFriendlyName_1_0_4627 = }; // ****************************************************************** -// * IXACTSoundBank_Play@20 +// * IXACTSoundBank_Play // ****************************************************************** SOOVPA<8> IXACTSoundBank_Play_1_0_4627 = { @@ -426,6 +549,199 @@ SOOVPA<8> IXACTSoundBank_Play_1_0_4627 = } }; +// ****************************************************************** +// * XACT::CEngine::RegisterNotification +// ****************************************************************** +SOOVPA<7> XACT_CEngine_RegisterNotification_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_XACT_CEngine_RegisterNotification, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x07, 0x8B }, + { 0x0C, 0x01 }, + { 0x13, 0xF0 }, + { 0x1A, 0xF6 }, + { 0x24, 0xFF }, + { 0x2A, 0x8B }, + { 0x2F, 0x08 }, + } +}; + +// ****************************************************************** +// * IXACTEngine_RegisterNotification +// ****************************************************************** +SOOVPA<8> IXACTEngine_RegisterNotification_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x15, XREF_XACT_CEngine_RegisterNotification }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0x83 }, + { 0x0E, 0xD9 }, + { 0x12, 0xC8 }, + { 0x19, 0xC2 }, + { 0x1A, 0x08 }, + } +}; + +// ****************************************************************** +// * XACT::CEngine::GetNotification +// ****************************************************************** +SOOVPA<8> XACT_CEngine_GetNotification_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_XACT_CEngine_GetNotification, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x11, 0x8D }, + { 0x24, 0x5A }, + { 0x37, 0xC0 }, + { 0x4A, 0x8B }, + { 0x5D, 0x04 }, + { 0x74, 0x8B }, + { 0x83, 0x40 }, + { 0x96, 0x0C }, + } +}; + +// ****************************************************************** +// * IXACTEngine_GetNotification +// ****************************************************************** +SOOVPA<9> IXACTEngine_GetNotification_1_0_4627 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x19, XREF_XACT_CEngine_GetNotification }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0xFF }, + { 0x0E, 0x83 }, + { 0x12, 0xD9 }, + { 0x16, 0xC8 }, + { 0x1D, 0xC2 }, + { 0x1E, 0x0C }, + } +}; + +// ****************************************************************** +// * XACT::CEngine::UnRegisterWaveBank +// ****************************************************************** +SOOVPA<8> XACT_CEngine_UnRegisterWaveBank_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_XACT_CEngine_UnRegisterWaveBank, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x07, 0x8B }, + { 0x10, 0x58 }, + { 0x19, 0x8B }, + { 0x22, 0x89 }, + { 0x2C, 0x8B }, + { 0x34, 0x5F }, + { 0x3D, 0xFF }, + { 0x46, 0x08 }, + } +}; + +// ****************************************************************** +// * XACT::CEngine::UnRegisterWaveBank +// ****************************************************************** +SOOVPA<8> XACT_CEngine_UnRegisterWaveBank_1_0_4928 = +{ + 0, // Large == 0 + 8, // Count == 8 + + XREF_XACT_CEngine_UnRegisterWaveBank, // Xref Is Saved + 0, // Xref Not Used + + { + // XACT_CEngine_UnRegisterWaveBank+0x06 : lea eax, [ecx+0x58] + { 0x06, 0x8D }, + { 0x07, 0x41 }, + { 0x08, 0x58 }, + // XACT_CEngine_UnRegisterWaveBank+0x28 : lea edi, [ebx+0x4C] + { 0x28, 0x8D }, + { 0x29, 0x7B }, + { 0x2A, 0x4C }, + // XACT_CEngine_UnRegisterWaveBank+0xBF : retn 0x8 + { 0xBF, 0xC2 }, + { 0xC0, 0x08 }, + } +}; + + +// ****************************************************************** +// * IXACTEngine_UnRegisterWaveBank +// ****************************************************************** +SOOVPA<8> IXACTEngine_UnRegisterWaveBank_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x15, XREF_XACT_CEngine_UnRegisterWaveBank }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0x83 }, + { 0x0E, 0xD9 }, + { 0x12, 0xC8 }, + { 0x19, 0xC2 }, + { 0x1A, 0x08 }, + } +}; + +// ****************************************************************** +// * IXACTEngine_UnRegisterWaveBank +// ****************************************************************** +SOOVPA<8> IXACTEngine_UnRegisterWaveBank_1_0_4928 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + // IXACTEngine_UnRegisterWaveBank+0x1E : call XACT::CEngine::UnRegisterWaveBank + { 0x1F, XREF_XACT_CEngine_UnRegisterWaveBank }, + + { 0x07, 0xFF }, + { 0x0E, 0x8B }, + { 0x16, 0xF8 }, + { 0x1E, 0xE8 }, + { 0x26, 0xF8 }, + { 0x2E, 0xFF }, + { 0x36, 0x5F }, + } +}; + // ****************************************************************** // * XactEng_1_0_4627 // ****************************************************************** @@ -486,6 +802,14 @@ OOVPATable XactEng_1_0_4627[] = #ifdef _DEBUG_TRACE "XACT::CEngine::RegisterStreamedWaveBank (XREF)" #endif + }, + // XACT::CEngine::RegisterStreamedWaveBank (XREF) + { + (OOVPA*)&XACT_CEngine_RegisterStreamedWaveBank_1_0_4928, 0, + + #ifdef _DEBUG_TRACE + "XACT::CEngine::RegisterStreamedWaveBank_4928 (XREF)" + #endif }, // IXACTEngine_RegisterStreamedWaveBank { @@ -493,7 +817,16 @@ OOVPATable XactEng_1_0_4627[] = XTL::EmuIXACTEngine_RegisterStreamedWaveBank, #ifdef _DEBUG_TRACE - "IXACTEngine_RegisterStreamedWaveBank" + "EmuIXACTEngine_RegisterStreamedWaveBank" + #endif + }, + // IXACTEngine_RegisterStreamedWaveBank + { + (OOVPA*)&IXACTEngine_RegisterStreamedWaveBank_1_0_4928, + XTL::EmuIXACTEngine_RegisterStreamedWaveBank, + + #ifdef _DEBUG_TRACE + "EmuIXACTEngine_RegisterStreamedWaveBank_4928" #endif }, // XACT::CEngine::CreateSoundBank (XREF) @@ -503,6 +836,14 @@ OOVPATable XactEng_1_0_4627[] = #ifdef _DEBUG_TRACE "XACT::CEngine::CreateSoundBank (XREF)" #endif + }, + // XACT::CEngine::CreateSoundBank (XREF) + { + (OOVPA*)&XACT_CEngine_CreateSoundBank_1_0_4928, 0, + + #ifdef _DEBUG_TRACE + "XACT::CEngine::CreateSoundBank_4928 (XREF)" + #endif }, // IXACTEngine_CreateSoundBank { @@ -510,7 +851,16 @@ OOVPATable XactEng_1_0_4627[] = XTL::EmuIXACTEngine_CreateSoundBank, #ifdef _DEBUG_TRACE - "IXACTEngine_CreateSoundBank" + "EmuIXACTEngine_CreateSoundBank" + #endif + }, + // IXACTEngine_CreateSoundBank + { + (OOVPA*)&IXACTEngine_CreateSoundBank_1_0_4928, + XTL::EmuIXACTEngine_CreateSoundBank, + + #ifdef _DEBUG_TRACE + "EmuIXACTEngine_CreateSoundBank_4928" #endif }, // XACT::CEngine::DownloadEffectsImage (XREF) @@ -528,7 +878,7 @@ OOVPATable XactEng_1_0_4627[] = XTL::EmuIXACTEngine_DownloadEffectsImage, #ifdef _DEBUG_TRACE - "IXACTEngine_DownloadEffectsImage" + "EmuIXACTEngine_DownloadEffectsImage" #endif }, // XACT::CEngine::CreateSoundSource (XREF) @@ -546,7 +896,7 @@ OOVPATable XactEng_1_0_4627[] = XTL::EmuIXACTEngine_CreateSoundSource, #ifdef _DEBUG_TRACE - "IXACTEngine_CreateSoundSource" + "EmuIXACTEngine_CreateSoundSource" #endif }, // XACT::CSoundBank::GetSoundCueIndexFromFriendlyName (XREF) @@ -564,7 +914,7 @@ OOVPATable XactEng_1_0_4627[] = XTL::EmuIXACTSoundBank_GetSoundCueIndexFromFriendlyName, #ifdef _DEBUG_TRACE - "IXACTSoundBank_GetSoundCueIndexFromFriendlyName" + "EmuIXACTSoundBank_GetSoundCueIndexFromFriendlyName" #endif }, // IXACTSoundBank_Play @@ -573,7 +923,79 @@ OOVPATable XactEng_1_0_4627[] = XTL::EmuIXACTSoundBank_Play, #ifdef _DEBUG_TRACE - "IXACTSoundBank_Play" + "EmuIXACTSoundBank_Play" + #endif + }, + // XACT::CEngine::RegisterNotification + { + (OOVPA*)&XACT_CEngine_RegisterNotification_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "XACT::CEngine::RegisterNotification (XREF)" + #endif + }, + // IXACTEngine_RegisterNotification + { + (OOVPA*)&IXACTEngine_RegisterNotification_1_0_4627, + + XTL::EmuIXACTEngine_RegisterNotification, + + #ifdef _DEBUG_TRACE + "EmuIXACTEngine_RegisterNotification (XREF)" + #endif + }, + // XACT::CEngine::GetNotification + { + (OOVPA*)&XACT_CEngine_GetNotification_1_0_4627, + 0, + + #ifdef _DEBUG_TRACE + "XACT::CEngine::GetNotification (XREF)" + #endif + }, + // IXACTEngine_GetNotification + { + (OOVPA*)&IXACTEngine_GetNotification_1_0_4627, + XTL::EmuIXACTEngine_GetNotification, + + #ifdef _DEBUG_TRACE + "EmuIXACTEngine_GetNotification" + #endif + }, + // XACT::CEngine::UnRegisterWaveBank (XREF) + { + (OOVPA*)&XACT_CEngine_UnRegisterWaveBank_1_0_4627, + 0, + + #ifdef _DEBUG_TRACE + "XACT::CEngine::UnRegisterWaveBank (XREF)" + #endif + }, + // XACT::CEngine::UnRegisterWaveBank (XREF) + { + (OOVPA*)&XACT_CEngine_UnRegisterWaveBank_1_0_4928, + 0, + + #ifdef _DEBUG_TRACE + "XACT::CEngine::UnRegisterWaveBank_4928 (XREF)" + #endif + }, + // IXACTEngine_UnRegisterWaveBank + { + (OOVPA*)&IXACTEngine_UnRegisterWaveBank_1_0_4627, + XTL::EmuIXACTEngine_UnRegisterWaveBank, + + #ifdef _DEBUG_TRACE + "IXACTEngine_UnRegisterWaveBank" + #endif + }, + // IXACTEngine_UnRegisterWaveBank + { + (OOVPA*)&IXACTEngine_UnRegisterWaveBank_1_0_4928, + XTL::EmuIXACTEngine_UnRegisterWaveBank, + + #ifdef _DEBUG_TRACE + "IXACTEngine_UnRegisterWaveBank_4928" #endif }, }; diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.inl index 87f9937fa..ff06b1a1d 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.inl @@ -1053,6 +1053,81 @@ SOOVPA<11> XFreeSectionA_1_0_3911 = } }; +// ****************************************************************** +// * SignalObjectAndWait +// ****************************************************************** +SOOVPA<8> SignalObjectAndWait_1_0_3911 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0x75 }, + { 0x12, 0x8B }, + { 0x19, 0x01 }, + { 0x26, 0x85 }, + { 0x2B, 0x7D }, + { 0x34, 0x00 }, + { 0x3F, 0x83 }, + { 0x46, 0x00 }, + } +}; + +// ****************************************************************** +// * PulseEvent +// ****************************************************************** +SOOVPA<11> PulseEvent_1_0_3911 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + // PulseEvent+0x00 : push 0 + { 0x00, 0x6A }, + { 0x01, 0x00 }, + // PulseEvent+0x02 : push [esp+8] + { 0x02, 0xFF }, + { 0x03, 0x74 }, + { 0x04, 0x24 }, + { 0x05, 0x08 }, + // PulseEvent+0x06 : call ds:NtPulseEvent + { 0x06, 0xFF }, + { 0x07, 0x15 }, + { 0x08, 0x54 }, + // PulseEvent+0x12 : test eax, eax + { 0x0C, 0x85 }, + { 0x0D, 0xC0 }, + } +}; + +// ****************************************************************** +// * QueueUserAPC +// ****************************************************************** +SOOVPA<7> QueueUserAPC_1_0_3911 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x03, 0x74 }, + { 0x08, 0x24 }, + { 0x0F, 0xFF }, + { 0x12, 0x18 }, + { 0x19, 0x33 }, + { 0x1C, 0xC0 }, + { 0x21, 0xC1 }, + } +}; + // ****************************************************************** // * XAPI_1_0_3911 // ****************************************************************** @@ -1378,6 +1453,36 @@ OOVPATable XAPI_1_0_3911[] = "EmuXFreeSectionA" #endif }, + // SignalObjectAndWait + { + (OOVPA*)&SignalObjectAndWait_1_0_3911, + + XTL::EmuSignalObjectAndWait, + + #ifdef _DEBUG_TRACE + "EmuSignalObjectAndWait" + #endif + }, + // PulseEvent + { + (OOVPA*)&PulseEvent_1_0_3911, + + XTL::EmuPulseEvent, + + #ifdef _DEBUG_TRACE + "EmuPulseEvent" + #endif + }, + // QueueUserAPC + { + (OOVPA*)&QueueUserAPC_1_0_3911, + + XTL::EmuQueueUserAPC, + + #ifdef _DEBUG_TRACE + "EmuQueueUserAPC" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4034.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4034.inl index f9da3c99b..85d1ef297 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4034.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4034.inl @@ -360,6 +360,26 @@ OOVPATable XAPI_1_0_4034[] = "EmuSetThreadPriority" #endif }, + // SignalObjectAndWait (* unchanged since 3911 *) + { + (OOVPA*)&SignalObjectAndWait_1_0_3911, + + XTL::EmuSignalObjectAndWait, + + #ifdef _DEBUG_TRACE + "EmuSignalObjectAndWait" + #endif + }, + // QueueUserAPC (* unchanged since 3911 *) + { + (OOVPA*)&QueueUserAPC_1_0_3911, + + XTL::EmuQueueUserAPC, + + #ifdef _DEBUG_TRACE + "EmuQueueUserAPC" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4134.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4134.inl index 0073d86e7..e7e95b255 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4134.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4134.inl @@ -174,6 +174,238 @@ SOOVPA<10> XMountUtilityDrive_1_0_4134 = } }; +// ****************************************************************** +// * QueryPerformanceCounter +// ****************************************************************** +SOOVPA<12> QueryPerformanceCounter_1_0_4134 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // QueryPerformanceCounter+0x04 : rdtsc + { 0x04, 0x0F }, // (Offset,Value)-Pair #1 + { 0x05, 0x31 }, // (Offset,Value)-Pair #2 + + // QueryPerformanceCounter+0x06 : mov [ecx], eax + { 0x06, 0x89 }, // (Offset,Value)-Pair #3 + { 0x07, 0x01 }, // (Offset,Value)-Pair #4 + + // QueryPerformanceCounter+0x08 : mov [ecx+4], eax + { 0x08, 0x89 }, // (Offset,Value)-Pair #5 + { 0x09, 0x51 }, // (Offset,Value)-Pair #6 + { 0x0A, 0x04 }, // (Offset,Value)-Pair #7 + + // QueryPerformanceCounter+0x0B : xor eax, eax + { 0x0B, 0x33 }, // (Offset,Value)-Pair #8 + { 0x0C, 0xC0 }, // (Offset,Value)-Pair #9 + + // QueryPerformanceCounter+0x0D : inc eax + { 0x0D, 0x40 }, // (Offset,Value)-Pair #10 + + // QueryPerformanceCounter+0x0E : retn 0x04 + { 0x0E, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x0F, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + +// ****************************************************************** +// * QueryPerformanceFrequency +// ****************************************************************** +SOOVPA<15> QueryPerformanceFrequency_1_0_4134 = +{ + 0, // Large == 0 + 15, // Count == 15 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // QueryPerformanceFrequency+0x04 : and dword ptr [eax+4], 0 + { 0x04, 0x83 }, // (Offset,Value)-Pair #1 + { 0x05, 0x60 }, // (Offset,Value)-Pair #2 + { 0x06, 0x04 }, // (Offset,Value)-Pair #3 + { 0x07, 0x00 }, // (Offset,Value)-Pair #4 + + // QueryPerformanceFrequency+0x06 : mov dword ptr [eax], 0x2BB5C755 + { 0x08, 0xC7 }, // (Offset,Value)-Pair #5 + { 0x09, 0x00 }, // (Offset,Value)-Pair #6 + { 0x0A, 0x55 }, // (Offset,Value)-Pair #7 + { 0x0B, 0xC7 }, // (Offset,Value)-Pair #8 + { 0x0C, 0xB5 }, // (Offset,Value)-Pair #9 + { 0x0D, 0x2B }, // (Offset,Value)-Pair #10 + + // QueryPerformanceFrequency+0x0E : xor eax, eax + { 0x0E, 0x33 }, // (Offset,Value)-Pair #11 + { 0x0F, 0xC0 }, // (Offset,Value)-Pair #12 + + // QueryPerformanceFrequency+0x10 : inc eax + { 0x10, 0x40 }, // (Offset,Value)-Pair #13 + + // QueryPerformanceFrequency+0x11 : retn 0x04 + { 0x11, 0xC2 }, // (Offset,Value)-Pair #14 + { 0x12, 0x04 }, // (Offset,Value)-Pair #15 + } +}; + +// ****************************************************************** +// * XInputPoll +// ****************************************************************** +SOOVPA<10> XInputPoll_1_0_4134 = +{ + 0, // Large == 0 + 10, // Count == 10 + + -1, // XRef Not Saved + 0, // XRef Is Used + + { + { 0x16, 0xF6 }, // (Offset,Value)-Pair #1 + { 0x17, 0x41 }, // (Offset,Value)-Pair #2 + { 0x18, 0x04 }, // (Offset,Value)-Pair #3 + { 0x19, 0x02 }, // (Offset,Value)-Pair #4 + + { 0x25, 0x39 }, // (Offset,Value)-Pair #5 + { 0x26, 0x70 }, // (Offset,Value)-Pair #6 + { 0x27, 0x04 }, // (Offset,Value)-Pair #7 + + { 0x3A, 0x83 }, // (Offset,Value)-Pair #8 + { 0x3B, 0xC0 }, // (Offset,Value)-Pair #9 + { 0x3C, 0x52 }, // (Offset,Value)-Pair #10 + } +}; + +// ****************************************************************** +// * XGetSectionHandleA +// ****************************************************************** +SOOVPA<13> XGetSectionHandleA_1_0_4134 = +{ + 0, // Large == 0 + 13, // Count == 0 + + -1, // XRef not saved + 0, // XRef not used + + { + // XGetSectionaHandleA+0x03 : sub esp, 0x10 + { 0x03, 0x83 }, + { 0x04, 0xEC }, + { 0x05, 0x10 }, + + // XGetSectionaHandleA+0x24 : imul esi, 0x38 + { 0x24, 0x6B }, + { 0x25, 0xF6 }, + { 0x26, 0x38 }, + + // XGetSectionaHandleA+0x4F : push 0x490 + { 0x4F, 0x68 }, + { 0x50, 0x90 }, + { 0x51, 0x04 }, + { 0x52, 0x00 }, + { 0x53, 0x00 }, + + // XGetSectionaHandleA+0x60 : retn 4 + { 0x60, 0xC2 }, + { 0x61, 0x04 } + } +}; + +// ****************************************************************** +// * XLoadSectionByHandle +// ****************************************************************** +SOOVPA<11> XLoadSectionByHandle_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef not saved + 0, // XRef not used + + { + // XLoadSectionByHandle+0x01 : mov esi, [esp+4+arg_0] + { 0x01, 0x8B }, + { 0x02, 0x74 }, + { 0x03, 0x24 }, + { 0x04, 0x08 }, + + // XLoadSectionByHandle+0x0C : test eax, eax + { 0x0C, 0x85 }, + { 0x0D, 0xC0 }, + + // XLoadSectionByHandle+0x1A : mov eax, [esi+4] + { 0x1A, 0x8B }, + { 0x1B, 0x46 }, + { 0x1C, 0x04 }, + + // XLoadSectionByHandle+0x1E : retn 4 + { 0x1E, 0xC2 }, + { 0x1F, 0x04 } + } +}; + + +// ****************************************************************** +// * XFreeSectionByHandle +// ****************************************************************** +SOOVPA<11> XFreeSectionByHandle_1_0_4134 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef not saved + 0, // XRef not used + + { + // XFreeSectionByHandle+0x00 : push esp + { 0x00, 0xFF }, + { 0x01, 0x74 }, + { 0x02, 0x24 }, + { 0x03, 0x04 }, + + // XFreeSectionByHandle+0x0A : test eax, eax + { 0x0A, 0x85 }, + { 0x0B, 0xC0 }, + + // XFreeSectionByHandle+0x18 : xor eax, eax + { 0x18, 0x33 }, + { 0x19, 0xC0 }, + + // XFreeSectionByHandle+0x1A : inc eax + { 0x1A, 0x40 }, + + // XFreeSectionByHandle+0x1B : retn 4 + { 0x1B, 0xC2 }, + { 0x1C, 0x04 } + } + +}; + +// ****************************************************************** +// * RtlDestroyHeap +// ****************************************************************** +SOOVPA<8> RtlDestroyHeap_1_0_4134 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x10, 0x56 }, + { 0x22, 0x75 }, + { 0x34, 0xE0 }, + { 0x46, 0x67 }, + { 0x58, 0x75 }, + { 0x6A, 0xE0 }, + { 0x7C, 0x06 }, + { 0x8E, 0x00 }, + } +}; + // ****************************************************************** // * XAPI_1_0_4134 // ****************************************************************** @@ -321,6 +553,237 @@ OOVPATable XAPI_1_0_4134[] = "GetTimeZoneInformation" #endif }, + // RtlCreateHeap (* unchanged since 3911 *) + { + (OOVPA*)&RtlCreateHeap_1_0_3911, + + XTL::EmuRtlCreateHeap, + + #ifdef _DEBUG_TRACE + "EmuRtlCreateHeap" + #endif + }, + // RtlAllocateHeap (* unchanged since 3911 *) + { + (OOVPA*)&RtlAllocateHeap_1_0_3911, + + XTL::EmuRtlAllocateHeap, + + #ifdef _DEBUG_TRACE + "EmuRtlAllocateHeap" + #endif + }, + // RtlFreeHeap (* unchanged since 3911 *) + { + (OOVPA*)&RtlFreeHeap_1_0_3911, + + XTL::EmuRtlFreeHeap, + + #ifdef _DEBUG_TRACE + "EmuRtlFreeHeap" + #endif + }, + //* + // RtlReAllocateHeap (* unchanged since 3911 *) + { + (OOVPA*)&RtlReAllocateHeap_1_0_3911, + + XTL::EmuRtlReAllocateHeap, + + #ifdef _DEBUG_TRACE + "EmuRtlReAllocateHeap" + #endif + }, + //*/ + //* + // RtlSizeHeap (* unchanged since 3911 *) + { + (OOVPA*)&RtlSizeHeap_1_0_3911, + + XTL::EmuRtlSizeHeap, + + #ifdef _DEBUG_TRACE + "EmuRtlSizeHeap" + #endif + }, + // XapiBootToDash (* unchanged since 3911 *) + { + (OOVPA*)&XapiBootDash_1_0_3911, + + XTL::EmuXapiBootDash, + + #ifdef _DEBUG_TRACE + "EmuXapiBootDash" + #endif + }, + // XRegisterThreadNotifyRoutine (* unchanged since 3911 *) + { + (OOVPA*)&XRegisterThreadNotifyRoutine_1_0_3911, + + XTL::EmuXRegisterThreadNotifyRoutine, + + #ifdef _DEBUG_TRACE + "EmuXRegisterThreadNotifyRoutine" + #endif + }, + // XGetDeviceChanges (* unchanged since 3911 *) + { + (OOVPA*)&XGetDeviceChanges_1_0_3911, + + XTL::EmuXGetDeviceChanges, + + #ifdef _DEBUG_TRACE + "EmuXGetDeviceChanges" + #endif + }, + // XID_fCloseDevice (* unchanged since 3911 *) + { + (OOVPA*)&XID_fCloseDevice_1_0_3911, 0, + + #ifdef _DEBUG_TRACE + "XID_fCloseDevice (XREF)" + #endif + }, + // XInputClose (* unchanged since 3911 *) + { + (OOVPA*)&XInputClose_1_0_3911, + + XTL::EmuXInputClose, + + #ifdef _DEBUG_TRACE + "EmuXInputClose" + #endif + }, + // XInputGetCapabilities (* unchanged since 3911 *) + { + (OOVPA*)&XInputGetCapabilities_1_0_3911, + + XTL::EmuXInputGetCapabilities, + + #ifdef _DEBUG_TRACE + "EmuXInputGetCapabilities" + #endif + }, + // GetThreadPriority (* unchanged since 3911 *) + { + (OOVPA*)&GetThreadPriority_1_0_3911, + + XTL::EmuGetThreadPriority, + + #ifdef _DEBUG_TRACE + "EmuGetThreadPriority" + #endif + }, + // XGetDevices (* unchanged since 3911 *) + { + (OOVPA*)&XGetDevices_1_0_3911, + + XTL::EmuXGetDevices, + + #ifdef _DEBUG_TRACE + "EmuXGetDevices" + #endif + }, + // QueryPerformanceCounter + { + (OOVPA*)&QueryPerformanceCounter_1_0_4134, + + XTL::EmuQueryPerformanceCounter, + + #ifdef _DEBUG_TRACE + "EmuQueryPerformanceCounter" + #endif + }, + // QueryPerformanceFrequency + { + (OOVPA*)&QueryPerformanceFrequency_1_0_4134, + + XTL::EmuQueryPerformanceFrequency, + + #ifdef _DEBUG_TRACE + "EmuQueryPerformanceFrequency" + #endif + }, + // XInputPoll + { + (OOVPA*)&XInputPoll_1_0_4134, + + XTL::EmuXInputPoll, + + #ifdef _DEBUG_TRACE + "EmuXInputPoll" + #endif + }, + // XGetSectionHandleA + { + (OOVPA*)&XGetSectionHandleA_1_0_4134, + + XTL::EmuXGetSectionHandleA, + + #ifdef _DEBUG_TRACE + "EmuXGetSectionHandleA" + #endif + }, + // XLoadSectionByHandle + { + (OOVPA*)&XLoadSectionByHandle_1_0_4134, + + XTL::EmuXLoadSectionByHandle, + + #ifdef _DEBUG_TRACE + "EmuXLoadSectionByHandle" + #endif + }, + // XFreeSectionByHandle + { + (OOVPA*)&XFreeSectionByHandle_1_0_4134, + + XTL::EmuXFreeSectionByHandle, + + #ifdef _DEBUG_TRACE + "EmuXFreeSectionByHandle" + #endif + }, + // RtlDestroyHeap + { + (OOVPA*)&RtlDestroyHeap_1_0_4134, + + XTL::EmuRtlDestroyHeap, + + #ifdef _DEBUG_TRACE + "EmuRtlDestroyHeap" + #endif + }, + // SetThreadPriorityBoost (* unchanged since 3911 *) + { + (OOVPA*)&SetThreadPriorityBoost_1_0_3911, + + XTL::EmuSetThreadPriorityBoost, + + #ifdef _DEBUG_TRACE + "EmuSetThreadPriorityBoost" + #endif + }, + // SignalObjectAndWait (* unchanged since 3911 *) + { + (OOVPA*)&SignalObjectAndWait_1_0_3911, + + XTL::EmuSignalObjectAndWait, + + #ifdef _DEBUG_TRACE + "EmuSignalObjectAndWait" + #endif + }, + // QueueUserAPC (* unchanged since 3911 *) + { + (OOVPA*)&QueueUserAPC_1_0_3911, + + XTL::EmuQueueUserAPC, + + #ifdef _DEBUG_TRACE + "EmuQueueUserAPC" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.inl index 66a445b81..2d23dd3f3 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.inl @@ -326,6 +326,42 @@ SOOVPA<12> XInputSetState_1_0_4361 = } }; +// ****************************************************************** +// * XInputSetState +// ****************************************************************** +SOOVPA<12> XInputSetState_1_0_4928 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // XInputSetState+0x04 : lea eax, [ecx+0x0A3] + { 0x04, 0x8D }, // (Offset,Value)-Pair #1 + { 0x05, 0x81 }, // (Offset,Value)-Pair #2 + { 0x06, 0xA3 }, // (Offset,Value)-Pair #3 + + // XInputSetState+0x12 : push 0x57 + { 0x12, 0x6A }, // (Offset,Value)-Pair #4 + { 0x13, 0x57 }, // (Offset,Value)-Pair #5 + + // XInputSetState+0x15 : jmp +0x19 + { 0x15, 0xEB }, // (Offset,Value)-Pair #6 + { 0x16, 0x19 }, // (Offset,Value)-Pair #7 + + // XInputSetState+0x28 : mov [edx+0x41], al + { 0x28, 0x88 }, // (Offset,Value)-Pair #8 + { 0x29, 0x42 }, // (Offset,Value)-Pair #9 + { 0x2A, 0x41 }, // (Offset,Value)-Pair #10 + + // XInputSetState+0x30 : retn 0x08 + { 0x30, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x31, 0x08 }, // (Offset,Value)-Pair #12 + } +}; + // ****************************************************************** // * CreateThread // ****************************************************************** @@ -515,6 +551,26 @@ OOVPATable XAPI_1_0_4361[] = #ifdef _DEBUG_TRACE "EmuRtlFreeHeap" #endif + }, + // RtlReAllocateHeap (* unchanged since 1.0.3911 *) + { + (OOVPA*)&RtlReAllocateHeap_1_0_3911, + + XTL::EmuRtlReAllocateHeap, + + #ifdef _DEBUG_TRACE + "EmuRtlReAllocateHeap" + #endif + }, + // RtlSizeHeap (* unchanged since 1.0.3911 *) + { + (OOVPA*)&RtlSizeHeap_1_0_3911, + + XTL::EmuRtlSizeHeap, + + #ifdef _DEBUG_TRACE + "EmuRtlSizeHeap" + #endif }, // QueryPerformanceCounter { @@ -739,6 +795,36 @@ OOVPATable XAPI_1_0_4361[] = "EmuGetExitCodeThread" #endif }, + // SetThreadPriorityBoost (* unchanged since 3911 *) + { + (OOVPA*)&SetThreadPriorityBoost_1_0_3911, + + XTL::EmuSetThreadPriorityBoost, + + #ifdef _DEBUG_TRACE + "EmuSetThreadPriorityBoost" + #endif + }, + // SignalObjectAndWait (* unchanged since 3911 *) + { + (OOVPA*)&SignalObjectAndWait_1_0_3911, + + XTL::EmuSignalObjectAndWait, + + #ifdef _DEBUG_TRACE + "EmuSignalObjectAndWait" + #endif + }, + // QueueUserAPC (* unchanged since 3911 *) + { + (OOVPA*)&QueueUserAPC_1_0_3911, + + XTL::EmuQueueUserAPC, + + #ifdef _DEBUG_TRACE + "EmuQueueUserAPC" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4432.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4432.inl index e22ec8b48..ab50088ea 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4432.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4432.inl @@ -302,6 +302,46 @@ OOVPATable XAPI_1_0_4432[] = "EmuSetThreadPriority" #endif }, + // SignalObjectAndWait (* unchanged since 3911 *) + { + (OOVPA*)&SignalObjectAndWait_1_0_3911, + + XTL::EmuSignalObjectAndWait, + + #ifdef _DEBUG_TRACE + "EmuSignalObjectAndWait" + #endif + }, + // CreateFiber (* unchanged since 3911 *) + { + (OOVPA*)&CreateFiber_1_0_3911, + + XTL::EmuCreateFiber, + + #ifdef _DEBUG_TRACE + "EmuCreateFiber" + #endif + }, + // DeleteFiber (* unchanged since 3911 *) + { + (OOVPA*)&DeleteFiber_1_0_3911, + + XTL::EmuDeleteFiber, + + #ifdef _DEBUG_TRACE + "EmuDeleteFiber" + #endif + }, + // QueueUserAPC (* unchanged since 3911 *) + { + (OOVPA*)&QueueUserAPC_1_0_3911, + + XTL::EmuQueueUserAPC, + + #ifdef _DEBUG_TRACE + "EmuQueueUserAPC" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl index bd744f2c0..ee91f9d8c 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl @@ -284,33 +284,6 @@ SOOVPA<8> XInputClose_1_0_4928 = } }; -// ****************************************************************** -// * XInputPoll -// ****************************************************************** -SOOVPA<10> XInputPoll_1_0_4928 = -{ - 0, // Large == 0 - 10, // Count == 10 - - -1, // XRef Not Saved - 0, // XRef Is Used - - { - { 0x16, 0xF6 }, // (Offset,Value)-Pair #1 - { 0x17, 0x41 }, // (Offset,Value)-Pair #2 - { 0x18, 0x04 }, // (Offset,Value)-Pair #3 - { 0x19, 0x02 }, // (Offset,Value)-Pair #4 - - { 0x25, 0x39 }, // (Offset,Value)-Pair #5 - { 0x26, 0x70 }, // (Offset,Value)-Pair #6 - { 0x27, 0x04 }, // (Offset,Value)-Pair #7 - - { 0x3A, 0x83 }, // (Offset,Value)-Pair #8 - { 0x3B, 0xC0 }, // (Offset,Value)-Pair #9 - { 0x3C, 0x52 }, // (Offset,Value)-Pair #10 - } -}; - // ****************************************************************** // * XInputGetState // ****************************************************************** @@ -519,108 +492,63 @@ SOOVPA<12> XInputGetCapabilities2_1_0_4831 = }; // ****************************************************************** -// * XLoadSectionByHandle +// * XInputGetCapabilities3 // ****************************************************************** -SOOVPA<11> XLoadSectionByHandle_1_0_4627 = +SOOVPA<12> XInputGetCapabilities3_1_0_4831 = { - 0, // Large == 0 - 11, // Count == 11 + 0, // Large == 0 + 12, // Count == 12 - -1, // XRef not saved - 0, // XRef not used + -1, // XRef Not Saved + 0, // XRef Not Used - { - // XLoadSectionByHandle+0x01 : mov esi, [esp+4+arg_0] - { 0x01, 0x8B }, - { 0x02, 0x74 }, - { 0x03, 0x24 }, - { 0x04, 0x08 }, + { + { 0x0B, 0x8B }, // (Offset,Value)-Pair #1 + { 0x0C, 0x1D }, // (Offset,Value)-Pair #2 + { 0x0D, 0x14 }, // (Offset,Value)-Pair #3 - // XLoadSectionByHandle+0x0C : test eax, eax - { 0x0C, 0x85 }, - { 0x0D, 0xC0 }, + { 0x25, 0xF6 }, // (Offset,Value)-Pair #4 + { 0x26, 0x46 }, // (Offset,Value)-Pair #5 + { 0x27, 0x04 }, // (Offset,Value)-Pair #6 + { 0x28, 0x02 }, // (Offset,Value)-Pair #7 - // XLoadSectionByHandle+0x1A : mov eax, [esi+4] - { 0x1A, 0x8B }, - { 0x1B, 0x46 }, - { 0x1C, 0x04 }, - - // XLoadSectionByHandle+0x1E : retn 4 - { 0x1E, 0xC2 }, - { 0x1F, 0x04 } - } -}; - - -// ****************************************************************** -// * XFreeSectionByHandle -// ****************************************************************** -SOOVPA<11> XFreeSectionByHandle_1_0_4627 = -{ - 0, // Large == 0 - 11, // Count == 11 - - -1, // XRef not saved - 0, // XRef not used - - { - // XFreeSectionByHandle+0x00 : push esp - { 0x00, 0xFF }, - { 0x01, 0x74 }, - { 0x02, 0x24 }, - { 0x03, 0x04 }, - - // XFreeSectionByHandle+0x0A : test eax, eax - { 0x0A, 0x85 }, - { 0x0B, 0xC0 }, - - // XFreeSectionByHandle+0x18 : xor eax, eax - { 0x18, 0x33 }, - { 0x19, 0xC0 }, - - // XFreeSectionByHandle+0x1A : inc eax - { 0x1A, 0x40 }, - - // XFreeSectionByHandle+0x1B : retn 4 - { 0x1B, 0xC2 }, - { 0x1C, 0x04 } - } + { 0x39, 0xF3 }, // (Offset,Value)-Pair #8 + { 0x3A, 0xAB }, // (Offset,Value)-Pair #9 + { 0xAF, 0xC7 }, // (Offset,Value)-Pair #10 + { 0xB0, 0x45 }, // (Offset,Value)-Pair #11 + { 0xB1, 0xE2 }, // (Offset,Value)-Pair #12 + } }; // ****************************************************************** -// * XGetSectionHandleA +// * XInputGetCapabilities4 // ****************************************************************** -SOOVPA<13> XGetSectionHandleA_1_0_4627 = +SOOVPA<12> XInputGetCapabilities4_1_0_4831 = { - 0, // Large == 0 - 13, // Count == 0 + 0, // Large == 0 + 12, // Count == 12 - -1, // XRef not saved - 0, // XRef not used + -1, // XRef Not Saved + 0, // XRef Not Used - { - // XGetSectionaHandleA+0x03 : sub esp, 0x10 - { 0x03, 0x83 }, - { 0x04, 0xEC }, - { 0x05, 0x10 }, + { + { 0x0B, 0x8B }, // (Offset,Value)-Pair #1 + { 0x0C, 0x1D }, // (Offset,Value)-Pair #2 + { 0x0D, 0x9C }, // (Offset,Value)-Pair #3 - // XGetSectionaHandleA+0x24 : imul esi, 0x38 - { 0x24, 0x6B }, - { 0x25, 0xF6 }, - { 0x26, 0x38 }, + { 0x25, 0xF6 }, // (Offset,Value)-Pair #4 + { 0x26, 0x46 }, // (Offset,Value)-Pair #5 + { 0x27, 0x04 }, // (Offset,Value)-Pair #6 + { 0x28, 0x02 }, // (Offset,Value)-Pair #7 - // XGetSectionaHandleA+0x4F : push 0x490 - { 0x4F, 0x68 }, - { 0x50, 0x90 }, - { 0x51, 0x04 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, + { 0x39, 0xF3 }, // (Offset,Value)-Pair #8 + { 0x3A, 0xAB }, // (Offset,Value)-Pair #9 - // XGetSectionaHandleA+0x60 : retn 4 - { 0x60, 0xC2 }, - { 0x61, 0x04 } - } + { 0xAF, 0xC7 }, // (Offset,Value)-Pair #10 + { 0xB0, 0x45 }, // (Offset,Value)-Pair #11 + { 0xB1, 0xE2 }, // (Offset,Value)-Pair #12 + } }; // ****************************************************************** @@ -695,9 +623,31 @@ SOOVPA<11> XFreeSectionA_1_0_4627 = }; // ****************************************************************** -// * RtlDestroyHeap@4 +// * GetOverlappedResult // ****************************************************************** -SOOVPA<8> RtlDestroyHeap_1_0_4627 = +SOOVPA<7> GetOverlappedResult_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0B, 0x75 }, + { 0x18, 0xC0 }, + { 0x27, 0xEB }, + { 0x32, 0x00 }, + { 0x3F, 0xEB }, + { 0x4C, 0x89 }, + { 0x59, 0x56 }, + } +}; + +// ****************************************************************** +// * XLaunchNewImageA +// ****************************************************************** +SOOVPA<8> XLaunchNewImageA_1_0_4627 = { 0, // Large == 0 8, // Count == 8 @@ -706,14 +656,178 @@ SOOVPA<8> RtlDestroyHeap_1_0_4627 = 0, // Xref Not Used { - { 0x10, 0x56 }, - { 0x22, 0x75 }, - { 0x34, 0xE0 }, - { 0x46, 0x67 }, - { 0x58, 0x75 }, - { 0x6A, 0xE0 }, - { 0x7C, 0x06 }, - { 0x8E, 0x00 }, + { 0x1E, 0x80 }, + { 0x3E, 0xC0 }, + { 0x5E, 0xFF }, + { 0x7E, 0xFC }, + { 0x9E, 0x08 }, + { 0xBE, 0x50 }, + { 0xDE, 0x05 }, + { 0xFE, 0x85 }, + } +}; + +// ****************************************************************** +// * XLaunchNewImageA +// ****************************************************************** +SOOVPA<12> XLaunchNewImageA_1_0_4928 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + // XLaunchNewImageA+0x03 : sub esp, 0x384 + { 0x03, 0x81 }, + { 0x04, 0xEC }, + { 0x05, 0x84 }, + { 0x06, 0x03 }, + { 0x07, 0x00 }, + { 0x08, 0x00 }, + // XLaunchNewImageA+0x33 : cmp al, 0x44 + { 0x33, 0x3C }, + { 0x34, 0x44 }, + // XLaunchNewImageA+0x41 : cmp byte ptr [esi+1], 0x3A + { 0x41, 0x80 }, + { 0x42, 0x7E }, + { 0x43, 0x02 }, + { 0x44, 0x5C }, + } +}; + +// ****************************************************************** +// * XGetLaunchInfo +// ****************************************************************** +SOOVPA<7> XGetLaunchInfo_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0B, 0x8B }, + { 0x18, 0x15 }, + { 0x25, 0x8B }, + { 0x32, 0x30 }, + { 0x3F, 0x00 }, + { 0x4C, 0x83 }, + { 0x59, 0x5E }, + } +}; + +// ****************************************************************** +// * XSetProcessQuantumLength +// ****************************************************************** +SOOVPA<7> XSetProcessQuantumLength_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x01, 0xA1 }, + { 0x04, 0x00 }, + { 0x07, 0x4C }, + { 0x0A, 0x8B }, + { 0x0D, 0x8D }, + { 0x10, 0x89 }, + { 0x13, 0xC2 }, + } +}; + +// ****************************************************************** +// * timeSetEvent +// ****************************************************************** +SOOVPA<7> timeSetEvent_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x8D }, + { 0x3E, 0x89 }, + { 0x5E, 0x15 }, + { 0x7E, 0x3F }, + { 0x9E, 0x03 }, + { 0xBE, 0x32 }, + { 0xDE, 0x89 }, + } +}; + +// ****************************************************************** +// * timeKillEvent +// ****************************************************************** +SOOVPA<8> timeKillEvent_1_0_4627 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0E, 0x8B }, + { 0x1A, 0xC2 }, + { 0x28, 0x8D }, + { 0x36, 0x56 }, + { 0x44, 0x00 }, + { 0x52, 0x00 }, + { 0x60, 0x5E }, + { 0x6E, 0x00 }, + } +}; + +// ****************************************************************** +// * RaiseException +// ****************************************************************** +SOOVPA<7> RaiseException_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x09, 0x83 }, + { 0x14, 0x8B }, + { 0x1F, 0xC7 }, + { 0x2A, 0x10 }, + { 0x35, 0x89 }, + { 0x40, 0x5F }, + { 0x4B, 0xFF }, + } +}; + + +// ****************************************************************** +// * VirtualProtect +// ****************************************************************** +SOOVPA<7> VirtualProtect_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + 0/*XREF_VirtualProtect*/, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x04, 0x8D }, + { 0x0A, 0x24 }, + { 0x10, 0x10 }, + { 0x18, 0x85 }, + { 0x1C, 0x33 }, + { 0x22, 0xE8 }, + { 0x28, 0xC0 }, } }; @@ -902,9 +1016,9 @@ OOVPATable XAPI_1_0_4627[] = "EmuXInputOpen" #endif }, - // XInputPoll + // XInputPoll (* unchanged since 4134 *) { - (OOVPA*)&XInputPoll_1_0_4928, + (OOVPA*)&XInputPoll_1_0_4134, XTL::EmuXInputPoll, @@ -999,6 +1113,16 @@ OOVPATable XAPI_1_0_4627[] = #ifdef _DEBUG_TRACE "EmuXInputSetState" #endif + }, + // XInputSetState + { + (OOVPA*)&XInputSetState_1_0_4928, + + XTL::EmuXInputSetState, + + #ifdef _DEBUG_TRACE + "EmuXInputSetState (4928)" + #endif }, /* obsolete? // XapiThreadStartup (* unchanged since 1.0.4361 *) @@ -1064,9 +1188,29 @@ OOVPATable XAPI_1_0_4627[] = "EmuXInputGetCapabilities2_4831" #endif }, - // XGetSectionHandleA + // XInputGetCapabilities3 + { + (OOVPA*)&XInputGetCapabilities3_1_0_4831, + + XTL::EmuXInputGetCapabilities, + + #ifdef _DEBUG_TRACE + "EmuXInputGetCapabilities3_4831" + #endif + }, + // XInputGetCapabilities4 + { + (OOVPA*)&XInputGetCapabilities4_1_0_4831, + + XTL::EmuXInputGetCapabilities, + + #ifdef _DEBUG_TRACE + "EmuXInputGetCapabilities4_4831" + #endif + }, + // XGetSectionHandleA (* unchanged since 4134 *) { - (OOVPA*)&XGetSectionHandleA_1_0_4627, + (OOVPA*)&XGetSectionHandleA_1_0_4134, XTL::EmuXGetSectionHandleA, @@ -1074,9 +1218,9 @@ OOVPATable XAPI_1_0_4627[] = "EmuXGetSectionHandleA" #endif }, - // XLoadSectionByHandle + // XLoadSectionByHandle (* unchanged since 4134 *) { - (OOVPA*)&XLoadSectionByHandle_1_0_4627, + (OOVPA*)&XLoadSectionByHandle_1_0_4134, XTL::EmuXLoadSectionByHandle, @@ -1084,9 +1228,9 @@ OOVPATable XAPI_1_0_4627[] = "EmuXLoadSectionByHandle" #endif }, - // XFreeSectionByHandle + // XFreeSectionByHandle (* unchanged since 4134 *) { - (OOVPA*)&XFreeSectionByHandle_1_0_4627, + (OOVPA*)&XFreeSectionByHandle_1_0_4134, XTL::EmuXFreeSectionByHandle, @@ -1198,9 +1342,9 @@ OOVPATable XAPI_1_0_4627[] = "EmuGetExitCodeThread" #endif }, - // RtlFreeHeap + // RtlDestroyHeap (* unchanged since 4134 *) { - (OOVPA*)&RtlDestroyHeap_1_0_4627, + (OOVPA*)&RtlDestroyHeap_1_0_4134, XTL::EmuRtlDestroyHeap, @@ -1208,6 +1352,108 @@ OOVPATable XAPI_1_0_4627[] = "EmuRtlDestroyHeap" #endif }, + // GetOverlappedResult + { + (OOVPA*)&GetOverlappedResult_1_0_4627, + + XTL::EmuGetOverlappedResult, + + #ifdef _DEBUG_TRACE + "EmuGetOverlappedResult" + #endif + }, + // XLaunchNewImageA + { + (OOVPA*)&XLaunchNewImageA_1_0_4627, + XTL::EmuXLaunchNewImage, + + #ifdef _DEBUG_TRACE + "EmuXLaunchNewImageA" + #endif + }, + // XLaunchNewImageA + { + (OOVPA*)&XLaunchNewImageA_1_0_4928, + XTL::EmuXLaunchNewImage, + + #ifdef _DEBUG_TRACE + "EmuXLaunchNewImageA" + #endif + }, + // XGetLaunchInfo + { + (OOVPA*)&XGetLaunchInfo_1_0_4627, + XTL::EmuXGetLaunchInfo, + + #ifdef _DEBUG_TRACE + "EmuXGetLaunchInfo" + #endif + }, + // XSetProcessQuantumLength + { + (OOVPA*)&XSetProcessQuantumLength_1_0_4627, + XTL::EmuXSetProcessQuantumLength, + + #ifdef _DEBUG_TRACE + "EmuXSetProcessQuantumLength" + #endif + }, + // SignalObjectAndWait (* unchanged since 3911 *) + { + (OOVPA*)&SignalObjectAndWait_1_0_3911, + + XTL::EmuSignalObjectAndWait, + + #ifdef _DEBUG_TRACE + "EmuSignalObjectAndWait" + #endif + }, + // timeSetEvent + { + (OOVPA*)&timeSetEvent_1_0_4627, + XTL::EmutimeSetEvent, + + #ifdef _DEBUG_TRACE + "EmutimeSetEvent" + #endif + }, + // timeKillEvent + { + (OOVPA*)&timeKillEvent_1_0_4627, + XTL::EmutimeKillEvent, + + #ifdef _DEBUG_TRACE + "EmutimeKillEvent" + #endif + }, + // RaiseException + { + (OOVPA*)&RaiseException_1_0_4627, + XTL::EmuRaiseException, + + #ifdef _DEBUG_TRACE + "EmuRaiseException" + #endif + }, + // QueueUserAPC (* unchanged since 3911 *) + { + (OOVPA*)&QueueUserAPC_1_0_3911, + + XTL::EmuQueueUserAPC, + + #ifdef _DEBUG_TRACE + "EmuQueueUserAPC" + #endif + }, + // VirtualProtect (* unchanged since 4627 *) + { + (OOVPA*)&VirtualProtect_1_0_4627, + XTL::EmuVirtualProtect, + + #ifdef _DEBUG_TRACE + "VirtualProtect" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl index 98a0f8548..86f611390 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl @@ -83,6 +83,29 @@ SOOVPA<7> XapiInitProcess_1_0_5233 = } }; +// ****************************************************************** +// * XapiInitProcess +// ****************************************************************** +SOOVPA<8> XapiInitProcess_1_0_5344 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x22, 0x6A }, + { 0x3E, 0x01 }, + { 0x5E, 0x7D }, + { 0x7E, 0x8B }, + { 0x9F, 0x68 }, + { 0xBE, 0x01 }, + { 0xDE, 0x6A }, + { 0xFE, 0x02 }, + } +}; + // ****************************************************************** // * XInitDevices // ****************************************************************** @@ -175,6 +198,27 @@ SOOVPA<7> XInputSetState_1_0_5233 = } }; +// ****************************************************************** +// * XGetFileCacheSize +// ****************************************************************** +SOOVPA<6> XGetFileCacheSize_1_0_5344 = +{ + 0, // Large == 0 + 6, // Count == 6 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x00, 0xFF }, + { 0x01, 0x15 }, + { 0x06, 0xC1 }, + { 0x07, 0xE0 }, + { 0x08, 0x0C }, + { 0x09, 0xC3 }, + } +}; + // ****************************************************************** // * XAPI_1_0_5233 // ****************************************************************** @@ -199,6 +243,16 @@ OOVPATable XAPI_1_0_5233[] = #ifdef _DEBUG_TRACE "EmuXapiInitProcess" #endif + }, + // XapiInitProcess + { + (OOVPA*)&XapiInitProcess_1_0_5344, + + XTL::EmuXapiInitProcess, + + #ifdef _DEBUG_TRACE + "EmuXapiInitProcess (5344)" + #endif }, // GetTimeZoneInformation (* unchanged since 3911 *) { @@ -418,6 +472,34 @@ OOVPATable XAPI_1_0_5233[] = "EmuXapiBootDash" #endif }, + // XGetFileCacheSize + { + (OOVPA*)&XGetFileCacheSize_1_0_5344, + XTL::EmuXGetFileCacheSize, + + #ifdef _DEBUG_TRACE + "XGetFileCacheSize" + #endif + }, + // QueueUserAPC (* unchanged since 3911 *) + { + (OOVPA*)&QueueUserAPC_1_0_3911, + + XTL::EmuQueueUserAPC, + + #ifdef _DEBUG_TRACE + "EmuQueueUserAPC" + #endif + }, + // VirtualProtect (* unchanged since 4627 *) + { + (OOVPA*)&VirtualProtect_1_0_4627, + XTL::EmuVirtualProtect, + + #ifdef _DEBUG_TRACE + "VirtualProtect" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl index adacba371..dc02da309 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl @@ -192,6 +192,116 @@ SOOVPA<8> XapiInitProcess_1_0_5659 = } }; +// ****************************************************************** +// * CreateSemaphoreA +// ****************************************************************** +SOOVPA<7> CreateSemaphoreA_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0A, 0x74 }, + { 0x16, 0x50 }, + { 0x22, 0x10 }, + { 0x31, 0x85 }, + { 0x3A, 0x75 }, + { 0x4A, 0x8B }, + { 0x55, 0x33 }, + } +}; + +// ****************************************************************** +// * ReleaseSemaphore +// ****************************************************************** +SOOVPA<7> ReleaseSemaphore_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x03, 0x0C }, + { 0x08, 0xFF }, + { 0x0D, 0x15 }, + { 0x12, 0x85 }, + { 0x17, 0xC0 }, + { 0x1C, 0xE8 }, + { 0x21, 0x33 }, + } +}; + +// ****************************************************************** +// * XLaunchNewImageA +// ****************************************************************** +SOOVPA<7> XLaunchNewImageA_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0xF0 }, + { 0x10, 0xD2 }, + { 0x19, 0x19 }, + { 0x22, 0x52 }, + { 0x2B, 0xE8 }, + { 0x34, 0x6A }, + { 0x3D, 0x10 }, + } +}; + +// ****************************************************************** +// * XGetLaunchInfo +// ****************************************************************** +SOOVPA<7> XGetLaunchInfo_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0B, 0x8B }, + { 0x18, 0x15 }, + { 0x25, 0x8B }, + { 0x32, 0x30 }, + { 0x3F, 0x00 }, + { 0x4C, 0x83 }, + { 0x59, 0x5E }, + } +}; + +// ****************************************************************** +// * GetFileAttributesA +// ****************************************************************** +SOOVPA<7> GetFileAttributesA_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x08, 0x08 }, + { 0x13, 0x8D }, + { 0x1C, 0x50 }, + { 0x26, 0xFF }, + { 0x30, 0x15 }, + { 0x3A, 0x45 }, + { 0x44, 0x83 }, + } +}; + // ****************************************************************** // * XAPI_1_0_5558 // ****************************************************************** @@ -409,6 +519,72 @@ OOVPATable XAPI_1_0_5558[] = "EmuXapiBootDash" #endif }, + // CreateSemaphore + { + (OOVPA*)&CreateSemaphoreA_1_0_5558, + + XTL::EmuCreateSemaphore, + + #ifdef _DEBUG_TRACE + "EmuCreateSemaphoreA" + #endif + }, + // ReleaseSemaphore + { + (OOVPA*)&ReleaseSemaphore_1_0_5558, + + XTL::EmuReleaseSemaphore, + + #ifdef _DEBUG_TRACE + "EmuReleaseSemaphore" + #endif + }, + // XLaunchNewImageA + { + (OOVPA*)&XLaunchNewImageA_1_0_5558, + XTL::EmuXLaunchNewImage, + + #ifdef _DEBUG_TRACE + "XLaunchNewImageA" + #endif + }, + // XGetLaunchInfo + { + (OOVPA*)&XGetLaunchInfo_1_0_5558, + XTL::EmuXGetLaunchInfo, + + #ifdef _DEBUG_TRACE + "XGetLaunchInfo" + #endif + }, + // QueueUserAPC (* unchanged since 3911 *) + { + (OOVPA*)&QueueUserAPC_1_0_3911, + + XTL::EmuQueueUserAPC, + + #ifdef _DEBUG_TRACE + "EmuQueueUserAPC" + #endif + }, + // GetFileAttributesA + { + (OOVPA*)&GetFileAttributesA_1_0_5558, + XTL::EmuGetFileAttributesA, + + #ifdef _DEBUG_TRACE + "GetFileAttributesA" + #endif + }, + // VirtualProtect (* unchanged since 4627 *) + { + (OOVPA*)&VirtualProtect_1_0_4627, + XTL::EmuVirtualProtect, + + #ifdef _DEBUG_TRACE + "VirtualProtect" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.inl index 2ac9eaf6e..e01155cdc 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.inl @@ -77,6 +77,92 @@ SOOVPA<7> XGetDeviceChanges_1_0_5849 = } }; +// ****************************************************************** +// * GetThreadPriority +// ****************************************************************** +SOOVPA<7> GetThreadPriority_1_0_5849 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x0D, 0xFF }, + { 0x16, 0x85 }, + { 0x1F, 0x15 }, + { 0x2A, 0x04 }, + { 0x35, 0xF1 }, + { 0x40, 0x8B }, + { 0x4B, 0xB8 }, + } +}; + +// ****************************************************************** +// * SetThreadPriorityBoost +// ****************************************************************** +SOOVPA<7> SetThreadPriorityBoost_1_0_5849 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x07, 0xFF }, + { 0x10, 0xFF }, + { 0x19, 0x20 }, + { 0x22, 0x50 }, + { 0x2C, 0x8B }, + { 0x35, 0x33 }, + { 0x40, 0x33 }, + } +}; + +// ****************************************************************** +// * XGetSectionSize +// ****************************************************************** +SOOVPA<5> XGetSectionSize_1_0_5849 = +{ + 0, // Large == 0 + 5, // Count == 5 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x00, 0x8B }, + { 0x02, 0x24 }, + { 0x04, 0x8B }, + { 0x06, 0x08 }, + { 0x08, 0x04 }, + } +}; + +// ****************************************************************** +// * RaiseException +// ****************************************************************** +SOOVPA<7> RaiseException_1_0_5849 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x09, 0x83 }, + { 0x14, 0x8B }, + { 0x1F, 0xC7 }, + { 0x2A, 0x10 }, + { 0x35, 0x89 }, + { 0x40, 0x5F }, + { 0x4B, 0xFF }, + } +}; + // ****************************************************************** // * XAPI_1_0_5849 // ****************************************************************** @@ -274,6 +360,91 @@ OOVPATable XAPI_1_0_5849[] = "EmuXapiBootDash" #endif }, + // QueueUserAPC (* unchanged since 3911 *) + { + (OOVPA*)&QueueUserAPC_1_0_3911, + + XTL::EmuQueueUserAPC, + + #ifdef _DEBUG_TRACE + "EmuQueueUserAPC" + #endif + }, + // GetThreadPriority + { + (OOVPA*)&GetThreadPriority_1_0_5849, + XTL::EmuGetThreadPriority, + + #ifdef _DEBUG_TRACE + "GetThreadPriority" + #endif + }, + // SetThreadPriorityBoost + { + (OOVPA*)&SetThreadPriorityBoost_1_0_5849, + XTL::EmuSetThreadPriorityBoost, + + #ifdef _DEBUG_TRACE + "SetThreadPriorityBoost" + #endif + }, + // GetThreadPriorityBoost + /*{ + (OOVPA*)&GetThreadPriorityBoost_1_0_5849, + XTL::EmuGetThreadPriorityBoost, + + #ifdef _DEBUG_TRACE + "GetThreadPriorityBoost" + #endif + },*/ + // XGetSectionHandleA (* unchanged since 4134 *) + { + (OOVPA*)&XGetSectionHandleA_1_0_4134, + + XTL::EmuXGetSectionHandleA, + + #ifdef _DEBUG_TRACE + "EmuXGetSectionHandleA" + #endif + }, + // XLoadSectionByHandle (* unchanged since 4134 *) + { + (OOVPA*)&XLoadSectionByHandle_1_0_4134, + + XTL::EmuXLoadSectionByHandle, + + #ifdef _DEBUG_TRACE + "EmuXLoadSectionByHandle" + #endif + }, + // XFreeSectionByHandle (* unchanged since 4134 *) + { + (OOVPA*)&XFreeSectionByHandle_1_0_4134, + + XTL::EmuXFreeSectionByHandle, + + #ifdef _DEBUG_TRACE + "EmuXFreeSectionByHandle" + #endif + }, + // XGetSectionSize + { + (OOVPA*)&XGetSectionSize_1_0_5849, + XTL::EmuXGetSectionSize, + + #ifdef _DEBUG_TRACE + "XGetSectionSize" + #endif + }, + // RaiseException + { + (OOVPA*)&RaiseException_1_0_5849, + XTL::EmuRaiseException, + + #ifdef _DEBUG_TRACE + "RaiseException" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEIntercept.cpp b/src/CxbxKrnl/HLEIntercept.cpp index 06aec68d7..3886b20b9 100644 --- a/src/CxbxKrnl/HLEIntercept.cpp +++ b/src/CxbxKrnl/HLEIntercept.cpp @@ -51,6 +51,9 @@ static void EmuXRefFailure(); uint32 fcount = 0; uint32 funcExclude[2048] = {0}; +uint32 g_BuildVersion; +uint32 g_OrigBuildVersion; + static std::vector vCacheOut; static bool bCacheInp = false; @@ -191,6 +194,7 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead uint16 OrigBuildVersion = BuildVersion; // Aliases - for testing purposes only + if(BuildVersion == 4039) { BuildVersion = 4034; } if(BuildVersion == 4242) { BuildVersion = 4361; } if(BuildVersion == 4531) { BuildVersion = 4432; } if(BuildVersion == 4721) { BuildVersion = 4627; } @@ -201,6 +205,7 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead if(BuildVersion == 5659) { BuildVersion = 5558; } if(BuildVersion == 5788) { BuildVersion = 5558; } if(BuildVersion == 5028) { BuildVersion = 4627; } + if(BuildVersion == 5120) { BuildVersion = 5233; } if(BuildVersion == 5933) { BuildVersion = 5849; } // These XDK versions are pretty much the same /* if(BuildVersion == 3944) { BuildVersion = 3925; } @@ -218,12 +223,21 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead */ char szLibraryName[9] = {0}; + char szOrigLibraryName[9] = {0}; for(uint32 c=0;c<8;c++) { szLibraryName[c] = pLibraryVersion[v].szName[c]; + szOrigLibraryName[c] = pLibraryVersion[v].szName[c]; } + // Test + if(strcmp(szLibraryName, "XGRAPHC") == 0) + { + if(BuildVersion == 4432) + BuildVersion = 4361; + } + // Several 3911 titles has different DSound builds. if(strcmp(szLibraryName, "DSOUND") == 0) { @@ -241,8 +255,13 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead // Some 3911 titles have different D3D8 builds if(strcmp(szLibraryName, "D3D8") == 0) { - if(BuildVersion == 3948) + if(BuildVersion <= 3948) BuildVersion = 3925; + + // Testing... don't release with this code in it! + // TODO: 5233 and 5558 + // if(BuildVersion == 4134) + // BuildVersion = 4627; } // Change a few XAPILIB versions to similar counterparts @@ -254,6 +273,12 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead BuildVersion = 4627; } + // Test (do not release uncommented!) + if(strcmp(szLibraryName, "D3D8LTCG") == 0) + { + strcpy(szLibraryName, "D3D8"); + } + // TODO: HACK: These libraries are packed into one database if(strcmp(szLibraryName, "D3DX8") == 0) { @@ -346,10 +371,15 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead } } } - else if(strcmp("D3D8", szLibraryName) == 0 && MajorVersion == 1 && MinorVersion == 0 && + else if(strcmp("D3D8", szLibraryName) == 0 /*&& strcmp("D3D8LTCG", szOrigLibraryName)*/ && + MajorVersion == 1 && MinorVersion == 0 && (BuildVersion == 3925 || BuildVersion == 4134 || BuildVersion == 4361 || BuildVersion == 4432 || BuildVersion == 4627 || BuildVersion == 5233 || BuildVersion == 5558 || BuildVersion == 5849)) { + // Save D3D8 build version + g_BuildVersion = BuildVersion; + g_OrigBuildVersion = OrigBuildVersion; + uint32 lower = pXbeHeader->dwBaseAddr; uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage; @@ -369,9 +399,12 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead int patchOffset = 0; if(BuildVersion == 3925) - { - XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x25) - 0x19F + 72*4); // TODO: Clean up (?) - patchOffset = 142*4 - 72*4; // TODO: Verify + { + XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x25) - 0x1FC + 82*4); // TODO: Clean up (?) + patchOffset = 142*4 - 82*4; // TODO: Verify + + //XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x25) - 0x19F + 72*4); // TODO: Clean up (?) + //patchOffset = 142*4 - 72*4; // TODO: Verify } else if(BuildVersion == 4134) { @@ -453,6 +486,86 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead } } } + //else if(strcmp("D3D8LTCG", szLibraryName) == 0 && MajorVersion == 1 && MinorVersion == 0 && + // (BuildVersion == 5849)) // 5849 only so far... + // { + // // Save D3D8 build version + // g_BuildVersion = BuildVersion; + // g_OrigBuildVersion = OrigBuildVersion; + + // uint32 lower = pXbeHeader->dwBaseAddr; + // uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage; + + // void *pFunc = 0; + + // if(BuildVersion == 5849) + // pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetRenderState_CullMode_1_0_5849_LTCG, lower, upper); + + // // locate D3DDeferredRenderState + // if(pFunc != 0) + // { + // // offset for stencil cull enable render state in the deferred render state buffer + // int patchOffset = 0; + + // if(BuildVersion == 5849) + // { + // // WARNING: Not thoroughly tested (just seemed very correct right away) + // XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x24C + 92*4); + // patchOffset = 162*4 - 92*4; + // } + + // XRefDataBase[XREF_D3DDEVICE] = *(DWORD*)((DWORD)pFunc + 0x03); + // XRefDataBase[XREF_D3DRS_MULTISAMPLEMODE] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset - 8*4; + // XRefDataBase[XREF_D3DRS_MULTISAMPLERENDERTARGETMODE] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset - 7*4; + // XRefDataBase[XREF_D3DRS_STENCILCULLENABLE] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 0*4; + // XRefDataBase[XREF_D3DRS_ROPZCMPALWAYSREAD] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 1*4; + // XRefDataBase[XREF_D3DRS_ROPZREAD] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 2*4; + // XRefDataBase[XREF_D3DRS_DONOTCULLUNCOMPRESSED] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 3*4; + + // for(int v=0;v<44;v++) + // { + // XTL::EmuD3DDeferredRenderState[v] = X_D3DRS_UNK; + // } + + // DbgPrintf("HLE: 0x%.08X -> EmuD3DDeferredRenderState\n", XTL::EmuD3DDeferredRenderState); + // } + // else + // { + // XTL::EmuD3DDeferredRenderState = 0; + // CxbxKrnlCleanup("EmuD3DDeferredRenderState was not found!"); + // } + + // // locate D3DDeferredTextureState + // { + // pFunc = 0; + + // if(BuildVersion == 3925) + // pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_5849_LTCG, lower, upper); + + // if(pFunc != 0) + // { + // if(BuildVersion == 3925) // 0x18F180 + // XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x11) - 0x70); // TODO: Verify + // else if(BuildVersion == 4134) + // XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x18) - 0x70); // TODO: Verify + // else + // XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x19) - 0x70); + + // for(int s=0;s<4;s++) + // { + // for(int v=0;v<32;v++) + // XTL::EmuD3DDeferredTextureState[v+s*32] = X_D3DTSS_UNK; + // } + + // DbgPrintf("HLE: 0x%.08X -> EmuD3DDeferredTextureState\n", XTL::EmuD3DDeferredTextureState); + // } + // else + // { + // XTL::EmuD3DDeferredTextureState = 0; + // CxbxKrnlCleanup("EmuD3DDeferredTextureState was not found!"); + // } + // } + // } } DbgPrintf("HLE: * Searching HLE database for %s %d.%d.%d...", szLibraryName, MajorVersion, MinorVersion, BuildVersion); diff --git a/src/CxbxKrnl/KernelThunk.cpp b/src/CxbxKrnl/KernelThunk.cpp index 0f427c170..3741d350c 100644 --- a/src/CxbxKrnl/KernelThunk.cpp +++ b/src/CxbxKrnl/KernelThunk.cpp @@ -66,7 +66,7 @@ extern "C" CXBXKRNL_API uint32 CxbxKrnl_KernelThunkTable[367] = (uint32)PANIC(0x0006), // 0x0006 (6) (uint32)PANIC(0x0007), // 0x0007 (7) (uint32)PANIC(0x0008), // 0x0008 (8) - (uint32)PANIC(0x0009), // 0x0009 (9) + (uint32)&xboxkrnl::HalReadSMCTrayState, // 0x0009 (9) (uint32)PANIC(0x000A), // 0x000A (10) (uint32)PANIC(0x000B), // 0x000B (11) (uint32)PANIC(0x000C), // 0x000C (12) @@ -148,11 +148,11 @@ extern "C" CXBXKRNL_API uint32 CxbxKrnl_KernelThunkTable[367] = (uint32)PANIC(0x0058), // 0x0058 (88) (uint32)PANIC(0x0059), // 0x0059 (89) (uint32)PANIC(0x005A), // 0x005A (90) - (uint32)PANIC(0x005B), // 0x005B (91) + (uint32)&xboxkrnl::IoDismountVolumeByName, // 0x005B (91) (uint32)PANIC(0x005C), // 0x005C (92) (uint32)PANIC(0x005D), // 0x005D (93) (uint32)PANIC(0x005E), // 0x005E (94) - (uint32)PANIC(0x005F), // 0x005F (95) + (uint32)&xboxkrnl::KeBugCheck, // 0x005F (95) (uint32)PANIC(0x0060), // 0x0060 (96) (uint32)PANIC(0x0061), // 0x0061 (97) (uint32)PANIC(0x0062), // 0x0062 (98) @@ -186,7 +186,7 @@ extern "C" CXBXKRNL_API uint32 CxbxKrnl_KernelThunkTable[367] = (uint32)&xboxkrnl::KeQueryPerformanceCounter, // 0x007E (126) (uint32)&xboxkrnl::KeQueryPerformanceFrequency, // 0x007F (127) (uint32)&xboxkrnl::KeQuerySystemTime, // 0x0080 (128) - (uint32)PANIC(0x0081), // 0x0081 (129) + (uint32)&xboxkrnl::KeRaiseIrqlToDpcLevel, // 0x0081 (129) (uint32)PANIC(0x0082), // 0x0082 (130) (uint32)PANIC(0x0083), // 0x0083 (131) (uint32)PANIC(0x0084), // 0x0084 (132)