diff --git a/build/win32/Cxbx.suo b/build/win32/Cxbx.suo index fcb981ee6..bf4aca377 100644 Binary files a/build/win32/Cxbx.suo and b/build/win32/Cxbx.suo differ diff --git a/doc/ShogunChangelog.txt b/doc/ShogunChangelog.txt index d8c6a6361..e9880d5f7 100644 --- a/doc/ShogunChangelog.txt +++ b/doc/ShogunChangelog.txt @@ -1211,4 +1211,11 @@ TODO: Verify that Lock3DSurface is the same on other XDKs like Lock2DSurface XGUnswizzleRect (4627) - Added the following source file(s) - XG.1.0.4432.h/inl \ No newline at end of file + XG.1.0.4432.h/inl + +6/25/11 +- Added the following function(s) + XInputGetDeviceDescription (4831) + +- Fixed the signature for XInputCapabilities (4831). This signature is + generally very weak among 4831 and 4928... \ No newline at end of file diff --git a/src/CxbxKrnl/EmuDSound.cpp b/src/CxbxKrnl/EmuDSound.cpp index 11374f77d..3b659b093 100644 --- a/src/CxbxKrnl/EmuDSound.cpp +++ b/src/CxbxKrnl/EmuDSound.cpp @@ -1390,19 +1390,24 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_GetCurrentPosition ");\n", GetCurrentThreadId(), pThis, pdwCurrentPlayCursor, pdwCurrentWriteCursor); + HRESULT hRet = E_FAIL; + HackUpdateSoundBuffers(); HackUpdateSoundStreams(); // NOTE: TODO: This call always seems to fail on primary buffers! - HRESULT hRet = pThis->EmuDirectSoundBuffer8->GetCurrentPosition(pdwCurrentPlayCursor, pdwCurrentWriteCursor); + if( pThis && pThis->EmuDirectSoundBuffer8 ) + { + hRet = pThis->EmuDirectSoundBuffer8->GetCurrentPosition(pdwCurrentPlayCursor, pdwCurrentWriteCursor); - if(FAILED(hRet)) - EmuWarning("GetCurrentPosition Failed!"); + if(FAILED(hRet)) + EmuWarning("GetCurrentPosition Failed!"); - if(pdwCurrentPlayCursor != 0 && pdwCurrentWriteCursor != 0) - { - DbgPrintf("*pdwCurrentPlayCursor := %d, *pdwCurrentWriteCursor := %d\n", *pdwCurrentPlayCursor, *pdwCurrentWriteCursor); - } + if(pdwCurrentPlayCursor != 0 && pdwCurrentWriteCursor != 0) + { + DbgPrintf("*pdwCurrentPlayCursor := %d, *pdwCurrentWriteCursor := %d\n", *pdwCurrentPlayCursor, *pdwCurrentWriteCursor); + } + } EmuSwapFS(); // XBox FS diff --git a/src/CxbxKrnl/EmuKrnl.cpp b/src/CxbxKrnl/EmuKrnl.cpp index 551d8538e..d48ab0a19 100644 --- a/src/CxbxKrnl/EmuKrnl.cpp +++ b/src/CxbxKrnl/EmuKrnl.cpp @@ -194,6 +194,35 @@ XBSYSAPI EXPORTNUM(1) xboxkrnl::PVOID NTAPI xboxkrnl::AvGetSavedDataAddress() DbgPrintf("EmuKrnl (0x%X): AvGetSavedDataAddress();\n", GetCurrentThreadId() ); +// __asm int 3; + + // Allocate a buffer the size of the screen buffer and return that. + // TODO: Fill this buffer with the contents of the front buffer. + // TODO: This isn't always the size we need... + + if( g_pPersistedData ) + { + CxbxFree( g_pPersistedData ); + g_pPersistedData = NULL; + } + + g_pPersistedData = CxbxMalloc( 640*480*4 ); + +#if 0 + // Get a copy of the front buffer + IDirect3DSurface8* pFrontBuffer = NULL; + + if( SUCCEEDED(g_pD3DDevice8->GetFrontBuffer(pFrontBuffer))) + { + D3DLOCKED_RECT LockedRect; + pFrontBuffer->LockRect( 0, NULL, &LockedRect ); + + CopyMemory( g_pPersistedData, LockRect.pBits, 640*480*4 ); + + pFrontBuffer->UnlockRect(); + } +#endif + // TODO: We might want to return something sometime... /*if( !g_pPersistedData ) { @@ -207,7 +236,7 @@ XBSYSAPI EXPORTNUM(1) xboxkrnl::PVOID NTAPI xboxkrnl::AvGetSavedDataAddress() EmuSwapFS(); // Xbox FS - return NULL; //g_pPersistedData; + return NULL;//g_pPersistedData; } // ****************************************************************** @@ -772,7 +801,7 @@ XBSYSAPI EXPORTNUM(129) xboxkrnl::UCHAR NTAPI xboxkrnl::KeRaiseIrqlToDpcLevel() DbgPrintf("EmuKrnl (0x%X): KeRaiseIrqlToDpcLevel()\n", GetCurrentThreadId()); // I really tried to avoid adding this... - __asm int 3; +// __asm int 3; // CxbxKrnlCleanup("KeRaiseIrqlToDpcLevel not implemented! (Tell blueshogun -_-)"); EmuSwapFS(); diff --git a/src/CxbxKrnl/EmuXactEng.cpp b/src/CxbxKrnl/EmuXactEng.cpp index 5adb2d6a4..7f85cbbf3 100644 --- a/src/CxbxKrnl/EmuXactEng.cpp +++ b/src/CxbxKrnl/EmuXactEng.cpp @@ -247,7 +247,7 @@ HRESULT WINAPI XTL::EmuIXACTEngine_CreateSoundSource ");\n", GetCurrentThreadId(), pThis, dwFlags, ppSoundSource); - *ppSoundSource = (X_XACTSoundSource*) malloc( sizeof( X_XACTSoundSource ) ); + *ppSoundSource = (X_XACTSoundSource*) CxbxMalloc( sizeof( X_XACTSoundSource ) ); EmuSwapFS(); diff --git a/src/CxbxKrnl/EmuXapi.cpp b/src/CxbxKrnl/EmuXapi.cpp index 8c5b63748..71b639113 100644 --- a/src/CxbxKrnl/EmuXapi.cpp +++ b/src/CxbxKrnl/EmuXapi.cpp @@ -1321,6 +1321,10 @@ LPVOID WINAPI XTL::EmuXLoadSectionA else if(!strcmp(pSectionName, "DSPImage")) pRet = (void*) 0x41F900; + // Zapper (NTSC) +// else if(!strcmp(pSectionName, "sig")) +// pRet = (void*) 0x41F900; + else __asm int 3; @@ -1401,7 +1405,7 @@ HANDLE WINAPI XTL::EmuXGetSectionHandleA } else if(!strcmp(pSectionName, ".XTLID")) { - __asm int 3; +// __asm int 3; pRet = (void*) 0x91B0A0; } @@ -1438,7 +1442,7 @@ HANDLE WINAPI XTL::EmuXGetSectionHandleA else { - __asm int 3; +// __asm int 3; } EmuSwapFS(); // Xbox FS @@ -2602,4 +2606,29 @@ BOOL WINAPI XTL::EmuSwitchToThread() EmuSwapFS(); // Xbox FS return bRet; -} \ No newline at end of file +} + +// ****************************************************************** +// * func: EmuXInputGetDeviceDescription +// ****************************************************************** +DWORD WINAPI XTL::EmuXInputGetDeviceDescription +( + HANDLE hDevice, + PVOID pDescription +) +{ + EmuSwapFS(); // Win2k/XP FS + + DbgPrintf("EmuXapi (0x%X): EmuXInputGetDeviceDescription\n" + "(\n" + " hDevice : 0x%.08X\n" + " pDescription : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), hDevice, pDescription); + + // TODO: Lightgun support? + + EmuSwapFS(); // Xbox FS + + return ERROR_NOT_SUPPORTED; // ERROR_DEVICE_NOT_CONNECTED; +} diff --git a/src/CxbxKrnl/EmuXapi.h b/src/CxbxKrnl/EmuXapi.h index cdd986949..2d96d126a 100644 --- a/src/CxbxKrnl/EmuXapi.h +++ b/src/CxbxKrnl/EmuXapi.h @@ -947,6 +947,16 @@ DWORD WINAPI EmuXGetDeviceEnumerationStatus(); // ****************************************************************** BOOL WINAPI EmuSwitchToThread(); +// ****************************************************************** +// * func: EmuXInputGetDeviceDescription +// ****************************************************************** +DWORD WINAPI EmuXInputGetDeviceDescription +( + HANDLE hDevice, + PVOID pDescription +); + + // s+ /* not necessary? // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5233.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5233.inl index 66e5d022a..52239b15f 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5233.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5233.inl @@ -850,6 +850,29 @@ SOOVPA<12> IDirect3DDevice8_SetLight_1_0_5233 = } }; +// ****************************************************************** +// * IDirect3DDevice8_SetLight +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_SetLight_1_0_5344 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x00 }, + { 0x3E, 0x89 }, + { 0x5E, 0x00 }, + { 0x7E, 0x03 }, + { 0x9E, 0xC8 }, + { 0xBE, 0xC9 }, + { 0xDE, 0x03 }, + { 0xFE, 0xC1 }, + } +}; + // ****************************************************************** // * IDirect3DDevice8_LightEnable // ****************************************************************** @@ -887,6 +910,29 @@ SOOVPA<13> IDirect3DDevice8_LightEnable_1_0_5233 = } }; +// ****************************************************************** +// * IDirect3DDevice8_LightEnable +// ****************************************************************** +SOOVPA<8> IDirect3DDevice8_LightEnable_1_0_5344 = +{ + 0, // Large == 0 + 8, // Count == 8 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x1E, 0x8D }, + { 0x3E, 0xC7 }, + { 0x5E, 0xC7 }, + { 0x7E, 0x00 }, + { 0x9E, 0x85 }, + { 0xBE, 0x01 }, + { 0xDE, 0x00 }, + { 0xFE, 0x83 }, + } +}; + // ****************************************************************** // * IDirect3DVertexBuffer8_GetDesc // ****************************************************************** @@ -2499,6 +2545,16 @@ OOVPATable D3D8_1_0_5233[] = #ifdef _DEBUG_TRACE "EmuIDirect3DDevice8_SetLight" #endif + }, + // IDirect3DDevice8::SetLight + { + (OOVPA*)&IDirect3DDevice8_SetLight_1_0_5344, + + XTL::EmuIDirect3DDevice8_SetLight, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetLight (5344)" + #endif }, // IDirect3DDevice8::LightEnable { @@ -2509,6 +2565,16 @@ OOVPATable D3D8_1_0_5233[] = #ifdef _DEBUG_TRACE "EmuIDirect3DDevice8_LightEnable" #endif + }, + // IDirect3DDevice8::LightEnable + { + (OOVPA*)&IDirect3DDevice8_LightEnable_1_0_5344, + + XTL::EmuIDirect3DDevice8_LightEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_LightEnable (5344)" + #endif }, // IDirect3DDevice8::DrawIndexedVertices { diff --git a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5558.inl b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5558.inl index dec10d3c3..2ec08488d 100644 --- a/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5558.inl +++ b/src/CxbxKrnl/HLEDataBase/D3D8.1.0.5558.inl @@ -1854,6 +1854,73 @@ SOOVPA<7> D3DCubeTexture_GetCubeMapSurface_1_0_5558 = } }; +// ****************************************************************** +// * D3DDevice_SetVertexDataColor +// ****************************************************************** +SOOVPA<7> D3DDevice_SetVertexDataColor_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x08, 0x06 }, + { 0x14, 0x8B }, + { 0x1C, 0x19 }, + { 0x26, 0xB6 }, + { 0x30, 0x00 }, + { 0x3A, 0xFF }, + { 0x44, 0x08 }, + } +}; + +// ****************************************************************** +// * D3DDevice_SetVertexData4f +// ****************************************************************** +SOOVPA<7> D3DDevice_SetVertexData4f_1_0_5558 = +{ + 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_SetVertexData2f +// ****************************************************************** +SOOVPA<8> D3DDevice_SetVertexData2f_1_0_5558 = +{ + 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 }, + } +}; + // ****************************************************************** // * D3D8_1_0_5558 // ****************************************************************** @@ -3151,6 +3218,46 @@ OOVPATable D3D8_1_0_5558[] = "EmuIDirect3DCubeTexture8_GetCubeMapSurface" #endif }, + // IDirect3DDevice8::GetCreationParameters (* unchanged since 4034 *) + { + (OOVPA*)&IDirect3DDevice8_GetCreationParameters_1_0_4034, + + XTL::EmuIDirect3DDevice8_GetCreationParameters, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetCreationParameters" + #endif + }, + // IDirect3DDevice8::SetVertexDataColor + { + (OOVPA*)&D3DDevice_SetVertexDataColor_1_0_5558, + + XTL::EmuIDirect3DDevice8_SetVertexDataColor, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexDataColor" + #endif + }, + // IDirect3DDevice8::SetVertexData4f + { + (OOVPA*)&D3DDevice_SetVertexData4f_1_0_5558, + + XTL::EmuIDirect3DDevice8_SetVertexData4f, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData4f" + #endif + }, + // IDirect3DDevice8::SetVertexData2f + { + (OOVPA*)&D3DDevice_SetVertexData2f_1_0_5558, + + XTL::EmuIDirect3DDevice8_SetVertexData2f, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetVertexData2f" + #endif + }, }; // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.5558.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.5558.inl index 99884a6c6..bf6ea1bbf 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.5558.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.5558.inl @@ -2158,6 +2158,76 @@ SOOVPA<8> IDirectSound_EnableHeadphones_1_0_5558 = } }; +// ****************************************************************** +// * DirectSound::CDirectSound::GetOutputLevels +// ****************************************************************** +SOOVPA<7> DirectSound_CDirectSound_GetOutputLevels_1_0_5558 = +{ + 0, // Large == 0 + 7, // Count == 7 + + XREF_DirectSound_CDirectSound_GetOutputLevels, // Xref Is Saved + 0, // Xref Not Used + + { + { 0x07, 0x10 }, + { 0x10, 0xF3 }, + { 0x19, 0x5E }, + { 0x22, 0xFE }, + { 0x2B, 0x85 }, + { 0x34, 0xA6 }, + { 0x3D, 0xD0 }, + } +}; + +// ****************************************************************** +// * IDirectSound_GetOutputLevels +// ****************************************************************** +SOOVPA<9> IDirectSound_GetOutputLevels_1_0_5558 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // Xref Not Saved + 1, // Xref Is Used + + { + { 0x19, XREF_DirectSound_CDirectSound_GetOutputLevels }, + + { 0x02, 0x24 }, + { 0x06, 0x24 }, + { 0x0A, 0xFF }, + { 0x0E, 0x83 }, + { 0x12, 0xD9 }, + { 0x16, 0xC8 }, + { 0x1D, 0xC2 }, + { 0x1E, 0x0C }, + } +}; + +// ****************************************************************** +// * XAudioDownloadEffectsImage +// ****************************************************************** +SOOVPA<8> XAudioDownloadEffectsImage_1_0_5558 = +{ + 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 }, + } +}; + // ****************************************************************** // * Direct_1_0_5558 // ****************************************************************** @@ -3256,6 +3326,33 @@ OOVPATable DSound_1_0_5558[] = "IDirectSound8_EnableHeadphones" #endif }, + // DirectSound::CDirectSound::GetOutputLevels (XREF) + { + (OOVPA*)&DirectSound_CDirectSound_GetOutputLevels_1_0_5558, + 0, + + #ifdef _DEBUG_TRACE + "DirectSound::CDirectSound::GetOutputLevels (XREF)" + #endif + }, + // IDirectSound_GetOutputLevels + { + (OOVPA*)&IDirectSound_GetOutputLevels_1_0_5558, + XTL::EmuIDirectSound8_GetOutputLevels, + + #ifdef _DEBUG_TRACE + "IDirectSound_GetOutputLevels" + #endif + }, + // XAudioDownloadEffectsImage + { + (OOVPA*)&XAudioDownloadEffectsImage_1_0_5558, + XTL::EmuXAudioDownloadEffectsImage, + + #ifdef _DEBUG_TRACE + "XAudioDownloadEffectsImage" + #endif + }, }; // ******************************************************************