No commit message

This commit is contained in:
blueshogun96 2012-01-12 02:54:37 +00:00
parent 1737efc2cf
commit 78f665cbf9
25 changed files with 2584 additions and 168 deletions

View File

@ -1239,4 +1239,75 @@ TODO: Verify that Lock3DSurface is the same on other XDKs like Lock2DSurface
11/3/11
- Made a few quick fixes to make the Dashboard a little more functional
and a little less buggy/crashy. Now only the system info option will
kill you!
kill you!
12/3/11
- Added proper critical section handling. Xbox critical section structure
is different than the Win32 one. Using revel8n (defiance)'s code. Thanks!
- Added a dirty fix for XAPILIB.1.0.3950. So far, only the Halo demo uses this.
Should make a proper fix later.
1/7/12
- Added the following function(s)
CreateFiber (5558-5849)
DeleteFiber (5558-5849)
SwitchToFiber (3911, 5558-5849)
ChangeThreadToFiber (3911, 5558-5849)
1/10/12
- Added the following function(s)
D3DDevice_Swap (5849)(*)
D3D::CDevice::KickOff (D3DDevice::KickPushBuffer) (5849)
D3DDevice_SetRenderState_RopZCmpAlwaysRead (5455-5849)
D3DDevice_SetRenderState_RopZRead (5455-5849)
D3DDevice_SetRenderState_DoNotCullUncompressed (5455-5849)
D3DDevice_SetSoftDisplayFilter (5849)
D3DDevice_SetFlickerFilter (5849)
CDirectSound::SetRollOffFactor (5849)
IDirectSound8_SetRollOffFactor (5849)
CDirectSound::SetDopplerFactor (5849)
IDirectSound8_SetDopplerFactor (5849)
CDirectSoundVoice::SetPitch (5849)
CDirectSoundBuffer::SetPitch (5849)
IDirectSoundBuffer8:SetPitch (5849)
CDirectSoundVoice::SetMaxDistance (5849)
CDirectSoundBuffer::SetMaxDistance (5849)
IDirectSoundBuffer8_SetMaxDistance (5849)
CDirectSoundVoice::SetMinDistance (5849)
CDirectSoundBuffer::SetMinDistance (5849)
IDirectSoundBuffer8_SetMinDistance (5849)
CDirectSoundVoice::SetVolume (5849)
CDirectSoundBuffer::SetVolume (5849)
IDirectSoundBuffer8_SetVolume (5849)
CDirectSoundVoice::SetPosition (5849)
CDirectSoundBuffer::SetPosition (5849)
IDirectSoundBuffer8_SetPosition (5849)
CDirectSoundVoice::SetVelocity (5849)
CDirectSoundBuffer::SetVelocity (5849)
IDirectSoundBuffer8_SetVelocity (5849)
CMcpxBuffer::Play (5849)(**)
CDirectSoundBuffer::PlayEx (5849)
IDirectSoundBuffer8_PlayEx (5849)
D3DDevice_SetRenderState_MultiSampleMode (5849)
D3DDevice_SetRenderState_MultiSampleRenderTargetMode (5849)
D3DDevice_SetRenderState_MultiSampleAntiAlias (5849)
D3DDevice_SetRenderState_MultiSampleMask (5849)
RtlDestroyHeap (4242-4531, 4721-5849)
CDirectSound::CreateSoundStream (5849)
DirectSoundCreateStream (5849)
CDirectSoundStream::SetMixBinVolumes (5849)
CMcpxStream::Pause (5849)
CDirectSoundStream::Pause (5849)
CDirectSoundStream::FlushEx (5849)
IDirectSoundStream_FlushEx (5849)
DirectSoundDoWork (5849)
D3DDevice_GeDisplayFieldStatus (5849)
CDirectSound::SynchPlayback (5849)
IDirectSound8_SynchPlayback (5849)
- Fixed a tiny bug in the vertex shader reassembler code (needed a bigger buffer
for Castlevania).
(*) Needed an alternative signature for this one.
(**) Needed a new signature.

View File

@ -415,6 +415,12 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
CxbxKrnlRegisterThread(hDupHandle);
}
//
// Clear critical section list
//
//extern void InitializeSectionStructures(void);
InitializeSectionStructures();
DbgPrintf("EmuMain (0x%X): Initializing Direct3D.\n", GetCurrentThreadId());
XTL::EmuD3DInit(pXbeHeader, dwXbeHeaderSize);

View File

@ -656,68 +656,20 @@ extern int EmuException(LPEXCEPTION_POINTERS e)
}
}
// Metal Slug 3
// Halo demo
if(e->ExceptionRecord->ExceptionCode == 0xC0000005)
{
//if(e->ContextRecord->Eip == 0x1B59BC)
//{
// // mov [ecx+0x28], eax
// e->ContextRecord->Eip += 3;
if(e->ContextRecord->Eip == 0x4835C)
{
// mov dword ptr [eax], 1
e->ContextRecord->Eip += 6;
// DbgPrintf("EmuMain (0x%X): Metal Slug 3 hack 1 was applied!\n", GetCurrentThreadId());
DbgPrintf("EmuMain (0x%X): Halo Demo hack 1 was applied!\n", GetCurrentThreadId());
// g_bEmuException = false;
g_bEmuException = false;
// return EXCEPTION_CONTINUE_EXECUTION;
// }
//if(e->ContextRecord->Eip == 0x1B59CA)
//{
// // mov [ecx+0x28], eax
// e->ContextRecord->Eip += 3;
// DbgPrintf("EmuMain (0x%X): Metal Slug 3 hack 2 was applied!\n", GetCurrentThreadId());
// g_bEmuException = false;
// return EXCEPTION_CONTINUE_EXECUTION;
// }
//if(e->ContextRecord->Eip == 0x1B59DE)
//{
// // mov [ecx+0x28], eax
// e->ContextRecord->Eip += 3;
// DbgPrintf("EmuMain (0x%X): Metal Slug 3 hack 3 was applied!\n", GetCurrentThreadId());
// g_bEmuException = false;
// return EXCEPTION_CONTINUE_EXECUTION;
// }
//if(e->ContextRecord->Eip == 0x1B59EC)
//{
// // mov [ecx+0x28], eax
// e->ContextRecord->Eip += 3;
// DbgPrintf("EmuMain (0x%X): Metal Slug 3 hack 4 was applied!\n", GetCurrentThreadId());
// g_bEmuException = false;
// return EXCEPTION_CONTINUE_EXECUTION;
// ` }
//if(e->ContextRecord->Eip == 0x1B59BC)
//{
// // mov [ecx+0x28], eax
// e->ContextRecord->Eip += 7;
// DbgPrintf("EmuMain (0x%X): Metal Slug 3 hack 1 was applied!\n", GetCurrentThreadId());
// g_bEmuException = false;
// return EXCEPTION_CONTINUE_EXECUTION;
// }
return EXCEPTION_CONTINUE_EXECUTION;
}
}
// Privileged instruction check

View File

@ -104,4 +104,5 @@ g_pXInputSetStateStatus[XINPUT_SETSTATE_SLOTS];
extern HANDLE g_hInputHandle[XINPUT_HANDLE_SLOTS];
extern void InitializeSectionStructures(void);
#endif

View File

@ -2543,13 +2543,19 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateVertexShader
if(SUCCEEDED(hRet) && pFunction)
{
boolean bUseDeclarationOnly = 0;
hRet = XTL::EmuRecompileVshFunction((DWORD*)pFunction,
&pRecompiledBuffer,
&VertexShaderSize,
g_VertexShaderConstantMode == X_VSCM_NONERESERVED);
g_VertexShaderConstantMode == X_VSCM_NONERESERVED,
&bUseDeclarationOnly);
if(SUCCEEDED(hRet))
{
pRecompiledFunction = (DWORD*)pRecompiledBuffer->GetBufferPointer();
if(!bUseDeclarationOnly)
pRecompiledFunction = (DWORD*)pRecompiledBuffer->GetBufferPointer();
else
pRecompiledFunction = NULL;
}
else
{
@ -3489,6 +3495,8 @@ XTL::X_D3DIndexBuffer * WINAPI XTL::EmuIDirect3DDevice8_CreateIndexBuffer2(UINT
return pIndexBuffer;
}
BOOL g_bBadIndexData = FALSE;
// ******************************************************************
// * func: EmuIDirect3DDevice8_SetIndices
// ******************************************************************
@ -3521,6 +3529,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetIndices
HRESULT hRet = D3D_OK;
//#if 0
if(pIndexData != NULL)
{
DbgPrintf("EmuIDirect3DDevice8_SetIndcies(): pIndexData->EmuIndexBuffer8:= 0x%.08X\n", pIndexData->EmuIndexBuffer8 );
@ -3558,7 +3567,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetIndices
hRet = g_pD3DDevice8->SetIndices(0, BaseVertexIndex);
}
//#endif
fail:
EmuSwapFS(); // XBox FS
@ -4654,7 +4663,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
dwBPP = 4;
}
else if(X_Format == 0x05 /* X_D3DFMT_R5G6B5 */ || X_Format == 0x04 /* X_D3DFMT_A4R4G4B4 */
|| X_Format == 0x02 /* X_D3DFMT_A1R5G5B5 */
|| X_Format == 0x02 /* X_D3DFMT_A1R5G5B5 */ || X_Format == 0x03 /* X_D3DFMT_X1R5G5B5 */
|| X_Format == 0x28 /* X_D3DFMT_G8B8 */ )
{
bSwizzled = TRUE;
@ -7864,7 +7873,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVertices
" pIndexData : 0x%.08X\n"
");\n",
GetCurrentThreadId(), PrimitiveType, VertexCount, pIndexData);
//#if 0
// update index buffer, if necessary
if(g_pIndexBuffer != 0 && g_pIndexBuffer->Lock == X_D3DRESOURCE_LOCK_FLAG_NOSIZE)
{
@ -8022,7 +8031,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVertices
#endif
VertPatch.Restore();
//#endif
EmuSwapFS(); // XBox FS
return D3D_OK;

View File

@ -1400,7 +1400,7 @@ VOID XTL::EmuUpdateActiveTexture()
dwBPP = 4;
}
else if(X_Format == 0x05 /* X_D3DFMT_R5G6B5 */ || X_Format == 0x04 /* X_D3DFMT_A4R4G4B4 */
|| X_Format == 0x02 /* X_D3DFMT_A1R5G5B5 */
|| X_Format == 0x02 /* X_D3DFMT_A1R5G5B5 */ || X_Format == 0x03 /* X_D3DFMT_X1R5G5B5 */
|| X_Format == 0x28 /* X_D3DFMT_G8B8 */ )
{
bSwizzled = TRUE;

View File

@ -2005,13 +2005,15 @@ extern HRESULT XTL::EmuRecompileVshFunction
DWORD *pFunction,
LPD3DXBUFFER *ppRecompiled,
DWORD *pOriginalSize,
boolean bNoReservedConstants
boolean bNoReservedConstants,
boolean *pbUseDeclarationOnly
)
{
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));
LPD3DXBUFFER pErrors = NULL;
HRESULT hRet = 0;
// TODO: support this situation..
@ -2020,6 +2022,8 @@ extern HRESULT XTL::EmuRecompileVshFunction
*ppRecompiled = NULL;
*pOriginalSize = 0;
*pbUseDeclarationOnly = 0;
if(!pShader)
{
EmuWarning("Couldn't allocate memory for vertex shader conversion buffer");
@ -2060,7 +2064,7 @@ extern HRESULT XTL::EmuRecompileVshFunction
// The size of the shader is
*pOriginalSize = (DWORD)pToken - (DWORD)pFunction;
char* pShaderDisassembly = (char*)CxbxMalloc(pShader->IntermediateCount * 50); // Should be plenty
char* pShaderDisassembly = (char*)CxbxMalloc(pShader->IntermediateCount * 100); // Should be plenty
DbgVshPrintf("-- Before conversion --\n");
VshWriteShader(pShader, pShaderDisassembly, FALSE);
DbgVshPrintf("%s", pShaderDisassembly);
@ -2076,8 +2080,14 @@ extern HRESULT XTL::EmuRecompileVshFunction
// 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;
EmuWarning("Cannot assemble empty vertex shader!");
EmuWarning("Attempting to use vertex declaration instead...");
// Attempt to use the vertex declaration for a fixed pipeline
// vertex shader instead...
*pbUseDeclarationOnly = 1;
hRet = S_OK;
}
else
{
@ -2087,14 +2097,18 @@ extern HRESULT XTL::EmuRecompileVshFunction
D3DXASM_SKIPVALIDATION,
NULL,
ppRecompiled,
NULL);
&pErrors);
}
if (FAILED(hRet))
{
EmuWarning("Couldn't assemble recompiled vertex shader\n");
EmuWarning("%s\n", pErrors->GetBufferPointer());
}
if( pErrors )
pErrors->Release();
CxbxFree(pShaderDisassembly);
}
CxbxFree(pShader);

View File

@ -65,7 +65,8 @@ extern HRESULT EmuRecompileVshFunction
DWORD *pFunction,
LPD3DXBUFFER *ppRecompiled,
DWORD *pOriginalSize,
boolean bNoReservedConstants
boolean bNoReservedConstants,
boolean *pbUseDeclarationOnly
);
extern void FreeVertexDynamicPatch(VERTEX_SHADER *pVertexShader);

View File

@ -854,8 +854,7 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateBuffer
EmuWarning("Use of unsupported pdsbd->dwFlags mask(s) (0x%.08X)", pdsbd->dwFlags & (~dwAcceptableMask));
pDSBufferDesc->dwSize = sizeof(DSBUFFERDESC);
pDSBufferDesc->dwFlags = (pdsbd->dwFlags & dwAcceptableMask) | DSBCAPS_CTRLVOLUME | DSBCAPS_GETCURRENTPOSITION2 |
DSBCAPS_CTRLPOSITIONNOTIFY;
pDSBufferDesc->dwFlags = (pdsbd->dwFlags & dwAcceptableMask) | DSBCAPS_CTRLVOLUME | DSBCAPS_GETCURRENTPOSITION2;
pDSBufferDesc->dwBufferBytes = pdsbd->dwBufferBytes;
if(pDSBufferDesc->dwBufferBytes < DSBSIZE_MIN)
@ -3337,7 +3336,11 @@ extern "C" HRESULT __stdcall XTL::EmuIDirectSoundBuffer8_PlayEx
if(pBuffer->EmuDirectSoundBuffer8 == 0)
EmuWarning("pBuffer->EmuDirectSoundBuffer8 == 0");
EmuWarning("PlayEx not yet implemented!");
// EmuWarning("PlayEx not yet implemented!");
// TODO: Handle other non-PC standard flags
DWORD dwPCFlags = ( dwFlags & DSBPLAY_LOOPING ) ? DSBPLAY_LOOPING : 0;
HRESULT hr = pBuffer->EmuDirectSoundBuffer8->Play( 0, 0, dwPCFlags );
EmuSwapFS(); // XBox FS

View File

@ -79,6 +79,47 @@ extern PVOID g_pfnThreadNotification[16] = { NULL };
extern int g_iThreadNotificationCount = 0;
PVOID g_pPersistedData = NULL;
// A critical section containing the PC and Xbox equivalent
struct INTERNAL_CRITICAL_SECTION
{
xboxkrnl::PRTL_CRITICAL_SECTION XboxCriticalSection;
NtDll::_RTL_CRITICAL_SECTION NativeCriticalSection;
};
#define MAX_XBOX_CRITICAL_SECTIONS 1024
INTERNAL_CRITICAL_SECTION GlobalCriticalSections[MAX_XBOX_CRITICAL_SECTIONS] = {0};
void InitializeSectionStructures(void)
{
ZeroMemory(GlobalCriticalSections, sizeof(GlobalCriticalSections));
}
int FindCriticalSection(xboxkrnl::PRTL_CRITICAL_SECTION CriticalSection)
{
int FreeSection = -1;
int iSection = 0;
for (iSection = 0; iSection < MAX_XBOX_CRITICAL_SECTIONS; ++iSection)
{
if (GlobalCriticalSections[iSection].XboxCriticalSection == CriticalSection)
{
FreeSection = iSection;
break;
}
else if (FreeSection < 0 && GlobalCriticalSections[iSection].XboxCriticalSection == NULL)
{
FreeSection = iSection;
}
}
if (FreeSection < 0)
{
EmuWarning("Too many critical sections in use!\n");
}
return FreeSection;
}
// PsCreateSystemThread proxy procedure
#pragma warning(push)
#pragma warning(disable: 4731) // disable ebp modification warning
@ -194,7 +235,7 @@ XBSYSAPI EXPORTNUM(1) xboxkrnl::PVOID NTAPI xboxkrnl::AvGetSavedDataAddress()
DbgPrintf("EmuKrnl (0x%X): AvGetSavedDataAddress();\n", GetCurrentThreadId() );
// __asm int 3;
__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.
@ -1178,15 +1219,14 @@ XBSYSAPI EXPORTNUM(169) xboxkrnl::PVOID NTAPI xboxkrnl::MmCreateKernelStack
" Unknown : 0x%.08X\n"
");\n",
GetCurrentThreadId(), NumberOfBytes, Unknown);
if(Unknown)
EmuWarning("MmCreateKernelStack unknown parameter ignored\n");
NtDll::PVOID pRet = NULL;
if(FAILED(NtDll::NtAllocateVirtualMemory(GetCurrentProcess(), &pRet, 0, &NumberOfBytes, MEM_COMMIT, PAGE_READWRITE)))
EmuWarning("MmCreateKernelStack failed!\n");
else
pRet = (PVOID)((ULONG)pRet + NumberOfBytes);
/*__asm int 3;
CxbxKrnlCleanup( "MmCreateKernelStack unimplemented (check call stack)" );*/
NtDll::PVOID pRet = NULL;
if(FAILED(NtDll::NtAllocateVirtualMemory(GetCurrentProcess(), &pRet, 0, &NumberOfBytes, MEM_COMMIT, PAGE_READWRITE)))
EmuWarning("MmCreateKernelStack failed!\n");
else
pRet = (PVOID)((ULONG)pRet + NumberOfBytes);
EmuSwapFS(); // Xbox FS
@ -1211,7 +1251,9 @@ XBSYSAPI EXPORTNUM(170) VOID NTAPI xboxkrnl::MmDeleteKernelStack
");\n",
GetCurrentThreadId(), EndAddress, BaseAddress);
ULONG RegionSize = 0;
/* __asm int 3;
CxbxKrnlCleanup( "MmDeleteKernelStack unimplemented (check call stack)" );*/
ULONG RegionSize = 0;
if (FAILED(NtDll::NtFreeVirtualMemory(GetCurrentProcess(), &BaseAddress, &RegionSize, MEM_RELEASE)))
EmuWarning("MmDeleteKernelStack failed!\n");
@ -3013,11 +3055,28 @@ 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)
NtDll::RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
// This seems redundant, but xbox software doesn't always do it
if (CriticalSection)
{
int iSection = FindCriticalSection(CriticalSection);
NtDll::RtlEnterCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
if (iSection >= 0)
{
GlobalCriticalSections[iSection].XboxCriticalSection = CriticalSection;
if (CriticalSection->LockCount < 0)
NtDll::RtlInitializeCriticalSection(&GlobalCriticalSections[iSection].NativeCriticalSection);
NtDll::RtlEnterCriticalSection(&GlobalCriticalSections[iSection].NativeCriticalSection);
CriticalSection->LockCount = GlobalCriticalSections[iSection].NativeCriticalSection.LockCount;
CriticalSection->RecursionCount = GlobalCriticalSections[iSection].NativeCriticalSection.RecursionCount;
CriticalSection->OwningThread = GlobalCriticalSections[iSection].NativeCriticalSection.OwningThread;
}
//if(CriticalSection->LockCount == -1)
//NtDll::RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
//NtDll::RtlEnterCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
}
EmuSwapFS(); // Xbox FS
@ -3093,8 +3152,18 @@ XBSYSAPI EXPORTNUM(291) VOID NTAPI xboxkrnl::RtlInitializeCriticalSection
");\n",
GetCurrentThreadId(), CriticalSection);
//*/
int iSection = FindCriticalSection(CriticalSection);
NtDll::RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
if (iSection >= 0)
{
GlobalCriticalSections[iSection].XboxCriticalSection = CriticalSection;
NtDll::RtlInitializeCriticalSection(&GlobalCriticalSections[iSection].NativeCriticalSection);
CriticalSection->LockCount = GlobalCriticalSections[iSection].NativeCriticalSection.LockCount;
CriticalSection->RecursionCount = GlobalCriticalSections[iSection].NativeCriticalSection.RecursionCount;
CriticalSection->OwningThread = GlobalCriticalSections[iSection].NativeCriticalSection.OwningThread;
}
//NtDll::RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
EmuSwapFS(); // Xbox FS
@ -3111,8 +3180,19 @@ XBSYSAPI EXPORTNUM(294) VOID NTAPI xboxkrnl::RtlLeaveCriticalSection
{
EmuSwapFS(); // Win2k/XP FS
// Note: We need to execute this before debug output to avoid trouble
NtDll::RtlLeaveCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
int iSection = FindCriticalSection(CriticalSection);
if (iSection >= 0)
{
GlobalCriticalSections[iSection].XboxCriticalSection = CriticalSection;
NtDll::RtlLeaveCriticalSection(&GlobalCriticalSections[iSection].NativeCriticalSection);
CriticalSection->LockCount = GlobalCriticalSections[iSection].NativeCriticalSection.LockCount;
CriticalSection->RecursionCount = GlobalCriticalSections[iSection].NativeCriticalSection.RecursionCount;
CriticalSection->OwningThread = GlobalCriticalSections[iSection].NativeCriticalSection.OwningThread;
}
// Note: We need to execute this before debug output to avoid trouble
//NtDll::RtlLeaveCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);
/* sorta pointless
DbgPrintf("EmuKrnl (0x%X): RtlLeaveCriticalSection\n"
@ -3232,7 +3312,23 @@ XBSYSAPI EXPORTNUM(306) xboxkrnl::BOOLEAN NTAPI xboxkrnl::RtlTryEnterCriticalSec
");\n",
GetCurrentThreadId(), CriticalSection);
BOOL bRet = NtDll::RtlTryEnterCriticalSection((NtDll::PRTL_CRITICAL_SECTION)CriticalSection);
BOOL bRet = FALSE;
int iSection = FindCriticalSection(CriticalSection);
if (iSection >= 0)
{
GlobalCriticalSections[iSection].XboxCriticalSection = CriticalSection;
if (CriticalSection->LockCount < 0)
NtDll::RtlInitializeCriticalSection(&GlobalCriticalSections[iSection].NativeCriticalSection);
bRet = NtDll::RtlTryEnterCriticalSection(&GlobalCriticalSections[iSection].NativeCriticalSection);
CriticalSection->LockCount = GlobalCriticalSections[iSection].NativeCriticalSection.LockCount;
CriticalSection->RecursionCount = GlobalCriticalSections[iSection].NativeCriticalSection.RecursionCount;
CriticalSection->OwningThread = GlobalCriticalSections[iSection].NativeCriticalSection.OwningThread;
}
//bRet = NtDll::RtlTryEnterCriticalSection((NtDll::PRTL_CRITICAL_SECTION)CriticalSection);
EmuSwapFS(); // Xbox FS

View File

@ -106,7 +106,7 @@ DWORD WINAPI XTL::EmuXNetGetEthernetLinkStatus()
EmuSwapFS(); // XBox FS
// for now, no ethernet connection is available
return 0;
return XNET_ETHERNET_LINK_ACTIVE | XNET_ETHERNET_LINK_100MBPS;
}
// ******************************************************************

View File

@ -34,6 +34,14 @@
#ifndef EMUXONLINE_H
#define EMUXONLINE_H
// Flags returned by XNetGetEthernetLinkStatus()
#define XNET_ETHERNET_LINK_ACTIVE 0x01
#define XNET_ETHERNET_LINK_100MBPS 0x02
#define XNET_ETHERNET_LINK_10MBPS 0x04
#define XNET_ETHERNET_LINK_FULL_DUPLEX 0x08
#define XNET_ETHERNET_LINK_HALF_DUPLEX 0x10
// ******************************************************************
// * clas: EmuThis
// ******************************************************************

View File

@ -76,6 +76,17 @@ XTL::XINPUT_POLLING_PARAMETERS g_pp;
// Saved launch data
XTL::LAUNCH_DATA g_SavedLaunchData;
// Fiber function list
typedef struct _XFIBER
{
LPFIBER_START_ROUTINE pfnRoutine;
LPVOID pParam;
}XFIBER;
XFIBER g_Fibers[256];
// Number of fiber routines queued
int g_FiberCount = 0;
// ******************************************************************
// * func: EmuXapiApplyKernelPatches
// ******************************************************************
@ -1266,6 +1277,14 @@ LPVOID WINAPI XTL::EmuCreateFiber
LPVOID pFiber = CreateFiber( dwStackSize, lpStartRoutine, lpParameter );
if( !pFiber )
EmuWarning( "CreateFiber failed!" );
else
DbgPrintf("CreateFiber returned 0x%X\n" );
// Add to list of queued fiber routines
g_Fibers[g_FiberCount].pfnRoutine = lpStartRoutine;
if( lpParameter ) g_Fibers[g_FiberCount].pParam = lpParameter;
g_FiberCount++;
EmuSwapFS(); // Xbox FS
@ -1293,6 +1312,97 @@ VOID WINAPI XTL::EmuDeleteFiber
EmuSwapFS(); // Xbox FS
}
// ******************************************************************
// * func: EmuSwitchToFiber
// ******************************************************************
VOID WINAPI XTL::EmuSwitchToFiber
(
LPVOID lpFiber
)
{
EmuSwapFS(); // Win2k/XP FS
DbgPrintf("EmuXapi (0x%X): EmuSwitchToFiber\n"
"(\n"
" lpFiber : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpFiber );
// SwitchToFiber( lpFiber ); // <- Hangs/crashes...
// Execute fiber routines
for( int i = 0; i < g_FiberCount; i++ )
{
EmuSwapFS(); // Xbox FS
if( g_Fibers[i].pfnRoutine )
g_Fibers[i].pfnRoutine(g_Fibers[i].pParam);
EmuSwapFS(); // Win2k/XP FS
}
g_FiberCount = 0;
DbgPrintf( "Finished executing fibers!\n" );
EmuSwapFS(); // Xbox FS
}
// ******************************************************************
// * func: EmuConvertThreadToFiber
// ******************************************************************
LPVOID WINAPI XTL::EmuConvertThreadToFiber
(
LPVOID lpParameter
)
{
EmuSwapFS(); // Win2k/XP FS
DbgPrintf("EmuXapi (0x%X): EmuConvertThreadToFiber\n"
"(\n"
" lpParameter : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpParameter );
LPVOID pRet = ConvertThreadToFiber( lpParameter );
DbgPrintf( "EmuConvertThreadToFiber returned 0x%X\n", pRet );
EmuSwapFS(); // Xbox FS
return pRet;
}
// ******************************************************************
// * func: EmuXapiFiberStartup
// ******************************************************************
VOID WINAPI XTL::EmuXapiFiberStartup(DWORD dwDummy)
{
EmuSwapFS(); // Win2k/XP FS
DbgPrintf("EmuXapi (0x%X): EmuXapiFiberStarup()\n"
"(\n"
" dwDummy : 0x%.08X\n"
");\n",
GetCurrentThreadId(), dwDummy);
EmuSwapFS(); // Xbox FS
typedef void (__stdcall *pfDummyFunc)(DWORD dwDummy);
pfDummyFunc func = (pfDummyFunc)dwDummy;
void* TlsIndex = (void*) CxbxKrnl_TLS->dwTLSIndexAddr;
__asm
{
mov eax, TlsIndex
mov ecx, fs:4
mov eax, [ecx+eax*4]
mov eax, [eax+8]
push dword ptr [eax]
call func
}
}
// ******************************************************************
// * func: EmuLoadSectionA
// ******************************************************************
@ -1326,7 +1436,10 @@ LPVOID WINAPI XTL::EmuXLoadSectionA
// pRet = (void*) 0x41F900;
else
__asm int 3;
{
EmuWarning( "Section %s not found!", pSectionName );
// __asm int 3;
}
EmuSwapFS(); // Xbox FS
@ -1773,6 +1886,10 @@ DWORD WINAPI XTL::EmuXGetLaunchInfo
// Delete the file once we're done.
DeleteFile("CxbxLaunchData.bin");
//void* ptr = (void*) 0x416250;
//memcpy( ptr, &g_pph, sizeof( XTL::POLLING_PARAMETERS_HANDLE ) );
//ptr = (void*) &g_pph;
// HACK: Initialize XInput from restart
/*if(g_bXInputOpenCalled)
{

View File

@ -655,6 +655,27 @@ VOID WINAPI EmuDeleteFiber
LPVOID lpFiber
);
// ******************************************************************
// * func: EmuSwitchToFiber
// ******************************************************************
VOID WINAPI EmuSwitchToFiber
(
LPVOID lpFiber
);
// ******************************************************************
// * func: EmuConvertThreadToFiber
// ******************************************************************
LPVOID WINAPI EmuConvertThreadToFiber
(
LPVOID lpParameter
);
// ******************************************************************
// * func: EmuXapiFiberStartup
// ******************************************************************
VOID WINAPI EmuXapiFiberStartup(DWORD dwDummy);
// ******************************************************************
// * func: EmuXLoadSectionA
// ******************************************************************

View File

@ -3258,6 +3258,36 @@ OOVPATable D3D8_1_0_5558[] =
"EmuIDirect3DDevice8_SetVertexData2f"
#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
},
};
// ******************************************************************

View File

@ -1025,29 +1025,6 @@ SOOVPA<7> D3DDevice_SetRenderState_VertexBlend_1_0_5849 =
}
};
// ******************************************************************
// * D3DDevice_SetRenderState_MultiSampleMask
// ******************************************************************
SOOVPA<8> D3DDevice_SetRenderState_MultiSampleMask_1_0_5849 =
{
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 },
}
};
// ******************************************************************
// * D3DDevice_SetPalette
// ******************************************************************
@ -1335,6 +1312,277 @@ SOOVPA<7> D3DDevice_GetTile_1_0_5849 =
}
};
// ******************************************************************
// * D3DDevice_Swap
// ******************************************************************
SOOVPA<7> D3DDevice_Swap_1_0_5849 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x1B, 0xE8 },
{ 0x38, 0xC3 },
{ 0x55, 0xC0 },
{ 0x72, 0x3F },
{ 0x8F, 0x8E },
{ 0xAC, 0xC6 },
{ 0xC9, 0xC0 },
}
};
// ******************************************************************
// * IDirect3DDevice8_Swap (2)
// ******************************************************************
SOOVPA<11> IDirect3DDevice8_Swap2_1_0_5849 =
{
0, // Large == 0
11, // Count == 11
-1, // XRef Not Saved
0, // XRef Not Used
{
// IDirect3DDevice8_Swap+0x2A : mov ebx, 5
{ 0x2A, 0xBB }, // (Offset,Value)-Pair #1
{ 0x2B, 0x05 }, // (Offset,Value)-Pair #2
// IDirect3DDevice8_Swap+0x37 : test bl, 3
{ 0x37, 0xF6 }, // (Offset,Value)-Pair #3
{ 0x38, 0xC3 }, // (Offset,Value)-Pair #4
{ 0x39, 0x03 }, // (Offset,Value)-Pair #5
// IDirect3DDevice8_Swap+0x60 : inc dword ptr [esi+0x2478]
{ 0x60, 0xFF }, // (Offset,Value)-Pair #6
{ 0x61, 0x86 }, // (Offset,Value)-Pair #7
{ 0x62, 0x78 }, // (Offset,Value)-Pair #8
{ 0x63, 0x24 }, // (Offset,Value)-Pair #9
// IDirect3DDevice8_Swap+0xE0 : retn 4
{ 0xE0, 0xC2 }, // (Offset,Value)-Pair #10
{ 0xE1, 0x04 }, // (Offset,Value)-Pair #11
}
};
// ******************************************************************
// * D3D::CDevice::KickOff
// ******************************************************************
SOOVPA<13> D3D_CDevice_KickOff_1_0_5849 =
{
0, // Large == 0
13, // Count == 13
-1, // Xref Not Saved
0, // Xref Is Used
{
// D3D::CDevice::KickOff+0x0A : mov edx, [ecx+0x35C]
{ 0x0A, 0x8B },
{ 0x0B, 0x96 },
{ 0x0C, 0x70 },
{ 0x0D, 0x07 },
{ 0x0E, 0x00 },
{ 0x0F, 0x00 },
// D3D::CDevice::KickOff+0x14 : test ch, 0x20
{ 0x14, 0xF6 },
{ 0x15, 0xC4 },
{ 0x16, 0x20 },
// D3D::CDevice::KickOff+0x24 : sfence
{ 0x24, 0x0F },
{ 0x25, 0xAE },
{ 0x26, 0xF8 },
// D3D::CDevice::KickOff+0xAF : retn
{ 0xAF, 0xC3 }
}
};
// ******************************************************************
// * D3DDevice_SetSoftDisplayFilter
// ******************************************************************
SOOVPA<7> D3DDevice_SetSoftDisplayFilter_1_0_5849 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x0D, 0x56 },
{ 0x14, 0x8B },
{ 0x1F, 0x95 },
{ 0x2A, 0x00 },
{ 0x37, 0x33 },
{ 0x44, 0x01 },
{ 0x4D, 0x5E },
}
};
// ******************************************************************
// * D3DDevice_SetFlickerFilter
// ******************************************************************
SOOVPA<7> D3DDevice_SetFlickerFilter_1_0_5849 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x07, 0xC9 },
{ 0x10, 0x24 },
{ 0x1A, 0x74 },
{ 0x22, 0x6A },
{ 0x2E, 0xC7 },
{ 0x34, 0x01 },
{ 0x3E, 0x5E },
}
};
// ******************************************************************
// * D3DDevice_SetRenderState_MultiSampleMode
// ******************************************************************
SOOVPA<9> D3DDevice_SetRenderState_MultiSampleMode_1_0_5849 =
{
0, // Large == 0
9, // Count == 9
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x03, 0x04 },
{ 0x0A, 0xA3 },
{ 0x0F, 0x8B },
{ 0x12, 0x1A },
{ 0x17, 0x14 },
{ 0x1B, 0x75 },
{ 0x1C, 0x07 },
{ 0x24, 0xC2 },
{ 0x26, 0x00 },
}
};
// ******************************************************************
// * D3DDevice_SetRenderState_MultiSampleRenderTargetMode
// ******************************************************************
SOOVPA<9> D3DDevice_SetRenderState_MultiSampleRenderTargetMode_1_0_5849 =
{
0, // Large == 0
9, // Count == 9
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x03, 0x04 },
{ 0x0A, 0xA3 },
{ 0x0F, 0x8B },
{ 0x12, 0x1A },
{ 0x17, 0x14 },
{ 0x1B, 0x74 },
{ 0x1C, 0x07 },
{ 0x24, 0xC2 },
{ 0x26, 0x00 },
}
};
// ******************************************************************
// * D3DDevice_SetRenderState_MultiSampleAntiAlias
// ******************************************************************
SOOVPA<7> D3DDevice_SetRenderState_MultiSampleAntiAlias_1_0_5849 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x0D, 0xCE },
{ 0x1E, 0x8B },
{ 0x2B, 0xF9 },
{ 0x3A, 0xCF },
{ 0x49, 0x00 },
{ 0x58, 0xC1 },
{ 0x6B, 0x5F },
}
};
// ******************************************************************
// * D3DDevice_SetRenderState_MultiSampleMask
// ******************************************************************
SOOVPA<8> D3DDevice_SetRenderState_MultiSampleMask_1_0_5849 =
{
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 },
}
};
// ******************************************************************
// * D3DDevice_SetPixelShaderConstant
// ******************************************************************
SOOVPA<7> D3DDevice_SetPixelShaderConstant_1_0_5849 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x1E, 0x85 },
{ 0x3E, 0x8B },
{ 0x5E, 0xC0 },
{ 0x7E, 0x0F },
{ 0x9F, 0x8B },
{ 0xBE, 0x00 },
{ 0xDE, 0xC0 },
}
};
// ******************************************************************
// * D3DDevice_GetDisplayFieldStatus
// ******************************************************************
SOOVPA<7> D3DDevice_GetDisplayFieldStatus_1_0_5849 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x06, 0x90 },
{ 0x0E, 0x04 },
{ 0x16, 0x00 },
{ 0x1E, 0x56 },
{ 0x26, 0xD2 },
{ 0x2E, 0x89 },
{ 0x36, 0x00 },
}
};
// ******************************************************************
// * D3D8_1_0_5849
// ******************************************************************
@ -1420,15 +1668,25 @@ OOVPATable D3D8_1_0_5849[] =
"EmuIDirect3DDevice8_Clear"
#endif
},
// IDirect3DDevice8::Swap (* unchanged since 5233 *)
// IDirect3DDevice8::Swap
{
(OOVPA*)&IDirect3DDevice8_Swap_1_0_5233,
(OOVPA*)&D3DDevice_Swap_1_0_5849,
XTL::EmuIDirect3DDevice8_Swap,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_Swap"
#endif
},
// IDirect3DDevice8::Swap (2)
{
(OOVPA*)&IDirect3DDevice8_Swap2_1_0_5849,
XTL::EmuIDirect3DDevice8_Swap,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_Swap2"
#endif
},
// IDirect3DDevice8::GetBackBuffer2
{
@ -2432,6 +2690,125 @@ OOVPATable D3D8_1_0_5849[] =
"EmuIDirect3DDevice8_GetTile"
#endif
},
// D3D::CDevice::KickOff
{
(OOVPA*)&D3D_CDevice_KickOff_1_0_5849,
XTL::EmuD3DDevice_KickOff,
#ifdef _DEBUG_TRACE
"D3D::CDevice::KickOff (D3DDevice::KickPushBuffer)"
#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::SetSoftDisplayFilter
{
(OOVPA*)&D3DDevice_SetSoftDisplayFilter_1_0_5849,
XTL::EmuIDirect3DDevice8_SetSoftDisplayFilter,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_SetSoftDisplayFilter"
#endif
},
// IDirect3DDevice8::SetFlickerFilter
{
(OOVPA*)&D3DDevice_SetFlickerFilter_1_0_5849,
XTL::EmuIDirect3DDevice8_SetFlickerFilter,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_SetFlickerFilter"
#endif
},
// IDirect3DDevice8::SetRenderState_MultiSampleMode
{
(OOVPA*)&D3DDevice_SetRenderState_MultiSampleMode_1_0_5849,
XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMode,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_SetRenderState_MultiSampleMode"
#endif
},
// IDirect3DDevice8::SetRenderState_MultiSampleRenderTargetMode
{
(OOVPA*)&D3DDevice_SetRenderState_MultiSampleRenderTargetMode_1_0_5849,
XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_SetRenderState_MultiSampleRenderTargetMode"
#endif
},
// IDirect3DDevice8::SetRenderState_MultiSampleAntiAlias
{
(OOVPA*)&D3DDevice_SetRenderState_MultiSampleAntiAlias_1_0_5849,
XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias"
#endif
},
// IDirect3DDevice8::SetRenderState_MultiSampleMask
{
(OOVPA*)&D3DDevice_SetRenderState_MultiSampleMask_1_0_5849,
XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleMode,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_SetRenderState_MultiSampleMode"
#endif
},
// IDirect3DDevice8::SetPixelShaderConstant
{
(OOVPA*)&D3DDevice_SetPixelShaderConstant_1_0_5849,
XTL::EmuIDirect3DDevice8_SetPixelShaderConstant,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_SetPixelShaderConstant"
#endif
},
// D3DDevice_GetDisplayFieldStatus
{
(OOVPA*)&D3DDevice_GetDisplayFieldStatus_1_0_5849,
XTL::EmuIDirect3DDevice8_GetDisplayFieldStatus,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_GetDisplayFieldStatus"
#endif
},
};
// ******************************************************************

View File

@ -4755,10 +4755,10 @@ SOOVPA<9> CDirectSoundStream_SetMixBinVolumes_1_0_3936 =
// ******************************************************************
// * CDirectSoundStream::SetI3DL2Source
// ******************************************************************
SOOVPA<14> CDirectSoundStream_SetI3DL2Source_1_0_3936 =
SOOVPA<9> CDirectSoundStream_SetI3DL2Source_1_0_3936 =
{
0, // Large == 0
14, // Count == 14
9, // Count == 9
0, // Xref Is Saved
1, // Xref Is Used
@ -4766,17 +4766,12 @@ SOOVPA<14> CDirectSoundStream_SetI3DL2Source_1_0_3936 =
{
{ 0x11, XREF_CDirectSoundVoice_SetI3DL2Source },
{ 0x00, 0xFF },
{ 0x01, 0x74 },
{ 0x02, 0x24 },
{ 0x03, 0x0C },
{ 0x04, 0x8B },
{ 0x05, 0x44 },
{ 0x06, 0x24 },
{ 0x01, 0x74 },
{ 0x04, 0x8B },
{ 0x07, 0x08 },
{ 0x0C, 0x83 },
{ 0x0A, 0x24 },
{ 0x0D, 0xC0 },
{ 0x0E, 0x04 },
{ 0x10, 0xE8 },
{ 0x15, 0xC2 },
{ 0x16, 0x0C },
}
@ -6046,16 +6041,16 @@ OOVPATable DSound_1_0_3936[] =
0,
#ifdef _DEBUG_TRACE
"CMcpxVoiceClient::SetI3DL2Source (XREF)"
"CMcpxVoiceClient::SetI3DL2Source (XREF) NIGGER (1) **************"
#endif
},
// CDirectSoundVoice::SetI3DL2Source (XREF)
{
(OOVPA*)&CDirectSoundVoice_SetI3DL2Source_1_0_3936,
0,
XTL::EmuCDirectSoundStream_SetI3DL2Source,
#ifdef _DEBUG_TRACE
"CDirectSoundVoice::SetI3DL2Source (XREF)"
"CDirectSoundVoice::SetI3DL2Source (XREF) NIGGER (2) *************"
#endif
},
// IDirectSoundBuffer_SetI3DL2Source
@ -6130,15 +6125,15 @@ OOVPATable DSound_1_0_3936[] =
#endif
},
// CDirectSoundStream::SetI3DL2Source
{
/*{
(OOVPA*)&CDirectSoundStream_SetI3DL2Source_1_0_3936,
XTL::EmuCDirectSoundStream_SetI3DL2Source,
#ifdef _DEBUG_TRACE
"EmuCDirectSoundStream_SetI3DL2Source ***********************"
"EmuCDirectSoundStream_SetI3DL2Source"
#endif
},
},*/
// CDirectSoundBuffer_SetNotificationPositions
{
(OOVPA*)&CDirectSoundBuffer_SetNotificationPositions_1_0_3936, 0,

File diff suppressed because it is too large Load Diff

View File

@ -973,6 +973,51 @@ SOOVPA<9> DeleteFiber_1_0_3911 =
}
};
// ******************************************************************
// * SwitchToFiber
// ******************************************************************
SOOVPA<8> SwitchToFiber_1_0_3911 =
{
0, // Large == 0
8, // Count == 8
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x06, 0x64 },
{ 0x0E, 0x44 },
{ 0x16, 0xFF },
{ 0x1E, 0x91 },
{ 0x26, 0x61 },
{ 0x31, 0x64 },
{ 0x36, 0x00 },
{ 0x3E, 0x00 },
}
};
// ******************************************************************
// * ConvertThreadToFiber
// ******************************************************************
SOOVPA<7> ConvertThreadToFiber_1_0_3911 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x05, 0x64 },
{ 0x0C, 0x8B },
{ 0x13, 0x8D },
{ 0x1A, 0x01 },
{ 0x21, 0x8B },
{ 0x28, 0x89 },
{ 0x31, 0x8B },
}
};
//// ******************************************************************
//// * XInputGetCapabilities
//// ******************************************************************
@ -1524,6 +1569,50 @@ SOOVPA<7> XMountMURootA_1_0_3911 =
}
};
// ******************************************************************
// * XMountUtilityDrive
// ******************************************************************
SOOVPA<7> XMountUtilityDrive_1_0_3911 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x1C, 0x85 },
{ 0x3A, 0x8D },
{ 0x58, 0x10 },
{ 0x76, 0xF8 },
{ 0x94, 0xF8 },
{ 0xB3, 0x8B },
{ 0xD0, 0xC0 },
}
};
// ******************************************************************
// * GetFileAttributesA
// ******************************************************************
SOOVPA<7> GetFileAttributesA_1_0_3911 =
{
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_3911
// ******************************************************************
@ -1828,6 +1917,26 @@ OOVPATable XAPI_1_0_3911[] =
"EmuDeleteFiber"
#endif
},
// SwitchToFiber
{
(OOVPA*)&SwitchToFiber_1_0_3911,
XTL::EmuSwitchToFiber,
#ifdef _DEBUG_TRACE
"EmuSwitchToFiber"
#endif
},
// ConvertThreadToFiber
{
(OOVPA*)&ConvertThreadToFiber_1_0_3911,
XTL::EmuConvertThreadToFiber,
#ifdef _DEBUG_TRACE
"EmuConvertThreadToFiber"
#endif
},
// XInputGetCapabilities
{
(OOVPA*)&XInputGetCapabilities_1_0_3911,
@ -1991,6 +2100,25 @@ OOVPATable XAPI_1_0_3911[] =
#ifdef _DEBUG_TRACE
"EmuXMountMURootA"
#endif
},
// XMountUtilityDrive
{
(OOVPA*)&XMountUtilityDrive_1_0_3911,
XTL::EmuXMountUtilityDrive,
#ifdef _DEBUG_TRACE
"EmuXMountUtilityDrive"
#endif
},
// GetFileAttributesA
{
(OOVPA*)&GetFileAttributesA_1_0_3911,
XTL::EmuGetFileAttributesA,
#ifdef _DEBUG_TRACE
"EmuGetFileAttributesA"
#endif
},
// CloseHandle
/*{

View File

@ -928,6 +928,16 @@ OOVPATable XAPI_1_0_4361[] =
"EmuSetWaitableTimer"
#endif
},
// RtlDestroyHeap (* unchanged since 4134 *)
{
(OOVPA*)&RtlDestroyHeap_1_0_4134,
XTL::EmuRtlDestroyHeap,
#ifdef _DEBUG_TRACE
"EmuRtlDestroyHeap"
#endif
},
};
// ******************************************************************

View File

@ -351,6 +351,16 @@ OOVPATable XAPI_1_0_4432[] =
"EmuGetFileAttributesA"
#endif
},
// RtlDestroyHeap (* unchanged since 4134 *)
{
(OOVPA*)&RtlDestroyHeap_1_0_4134,
XTL::EmuRtlDestroyHeap,
#ifdef _DEBUG_TRACE
"EmuRtlDestroyHeap"
#endif
},
};
// ******************************************************************

View File

@ -519,6 +519,16 @@ OOVPATable XAPI_1_0_5233[] =
"EmuGetFileAttributesA"
#endif
},
// RtlDestroyHeap (* unchanged since 4134 *)
{
(OOVPA*)&RtlDestroyHeap_1_0_4134,
XTL::EmuRtlDestroyHeap,
#ifdef _DEBUG_TRACE
"EmuRtlDestroyHeap"
#endif
},
};
// ******************************************************************

View File

@ -325,6 +325,116 @@ SOOVPA<8> XMountMUA_1_0_5558 =
}
};
// ******************************************************************
// * CreateFiber
// ******************************************************************
SOOVPA<7> CreateFiber_1_0_5558 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x10, 0x00 },
{ 0x22, 0x57 },
{ 0x34, 0x75 },
{ 0x46, 0x41 },
{ 0x58, 0xFC },
{ 0x6A, 0x39 },
{ 0x7C, 0xCE },
}
};
// ******************************************************************
// * DeleteFiber
// ******************************************************************
SOOVPA<6> DeleteFiber_1_0_5558 =
{
0, // Large == 0
6, // Count == 6
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x01, 0x44 },
{ 0x04, 0xFF },
{ 0x07, 0xFF },
{ 0x0A, 0xFF },
{ 0x10, 0xC2 },
{ 0x11, 0x04 },
}
};
// ******************************************************************
// * SwitchToFiber
// ******************************************************************
SOOVPA<8> SwitchToFiber_1_0_5558 =
{
0, // Large == 0
8, // Count == 8
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x06, 0x64 },
{ 0x0E, 0x44 },
{ 0x16, 0xFF },
{ 0x1E, 0x91 },
{ 0x26, 0x61 },
{ 0x31, 0x64 },
{ 0x36, 0x00 },
{ 0x3E, 0x00 },
}
};
// ******************************************************************
// * ConvertThreadToFiber
// ******************************************************************
SOOVPA<7> ConvertThreadToFiber_1_0_5558 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x05, 0x64 },
{ 0x0C, 0x8B },
{ 0x13, 0x8D },
{ 0x1A, 0x01 },
{ 0x21, 0x8B },
{ 0x28, 0x89 },
{ 0x31, 0x8B },
}
};
// ******************************************************************
// * XapiFiberStartup
// ******************************************************************
SOOVPA<7> XapiFiberStartup_1_0_5558 =
{
0, // Large == 0
7, // Count == 7
-1, // Xref Not Saved
0, // Xref Not Used
{
{ 0x07, 0xE8 },
{ 0x10, 0xA1 },
{ 0x1C, 0x8B },
{ 0x25, 0xFF },
{ 0x2B, 0x0C },
{ 0x34, 0xC3 },
{ 0x3D, 0x00 },
}
};
// ******************************************************************
// * XAPI_1_0_5558
// ******************************************************************
@ -687,6 +797,65 @@ OOVPATable XAPI_1_0_5558[] =
"EmuXMountMUA"
#endif
},
// CreateFiber
{
(OOVPA*)&CreateFiber_1_0_5558,
XTL::EmuCreateFiber,
#ifdef _DEBUG_TRACE
"EmuCreateFiber"
#endif
},
// DeleteFiber
{
(OOVPA*)&DeleteFiber_1_0_5558,
XTL::EmuDeleteFiber,
#ifdef _DEBUG_TRACE
"EmuDeleteFiber"
#endif
},
// SwitchToFiber
{
(OOVPA*)&SwitchToFiber_1_0_5558,
XTL::EmuSwitchToFiber,
#ifdef _DEBUG_TRACE
"EmuSwitchToFiber"
#endif
},
// ConvertThreadToFiber
{
(OOVPA*)&ConvertThreadToFiber_1_0_5558,
XTL::EmuConvertThreadToFiber,
#ifdef _DEBUG_TRACE
"EmuConvertThreadToFiber"
#endif
},
//// XapiFiberStartup
//{
// (OOVPA*)&XapiFiberStartup_1_0_5558,
// XTL::EmuXapiFiberStartup,
// #ifdef _DEBUG_TRACE
// "XapiFiberStartup"
// #endif
//},
// RtlDestroyHeap (* unchanged since 4134 *)
{
(OOVPA*)&RtlDestroyHeap_1_0_4134,
XTL::EmuRtlDestroyHeap,
#ifdef _DEBUG_TRACE
"EmuRtlDestroyHeap"
#endif
},
};
// ******************************************************************

View File

@ -535,6 +535,56 @@ OOVPATable XAPI_1_0_5849[] =
"EmuXFormatUtilityDrive"
#endif
},
// CreateFiber
{
(OOVPA*)&CreateFiber_1_0_5558,
XTL::EmuCreateFiber,
#ifdef _DEBUG_TRACE
"EmuCreateFiber"
#endif
},
// DeleteFiber
{
(OOVPA*)&DeleteFiber_1_0_5558,
XTL::EmuDeleteFiber,
#ifdef _DEBUG_TRACE
"EmuDeleteFiber"
#endif
},
// SwitchToFiber
{
(OOVPA*)&SwitchToFiber_1_0_5558,
XTL::EmuSwitchToFiber,
#ifdef _DEBUG_TRACE
"EmuSwitchToFiber"
#endif
},
// ConvertThreadToFiber
{
(OOVPA*)&ConvertThreadToFiber_1_0_5558,
XTL::EmuConvertThreadToFiber,
#ifdef _DEBUG_TRACE
"EmuConvertThreadToFiber"
#endif
},
// RtlDestroyHeap (* unchanged since 4134 *)
{
(OOVPA*)&RtlDestroyHeap_1_0_4134,
XTL::EmuRtlDestroyHeap,
#ifdef _DEBUG_TRACE
"EmuRtlDestroyHeap"
#endif
},
};
// ******************************************************************

View File

@ -382,12 +382,12 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead
RtlCreateHeapOffs = 0x37;
}
}
else if( OrigBuildVersion == 3950 )
/*else if( OrigBuildVersion == 3950 )
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_3950, lower, upper);
ProcessHeapOffs = 0x3E;
RtlCreateHeapOffs = 0x37;
}
}*/
else // 3911, 4034, 4134
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_3911, lower, upper);
@ -405,6 +405,19 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead
DbgPrintf("HLE: 0x%.08X -> EmuXapiProcessHeap\n", XTL::EmuXapiProcessHeap);
DbgPrintf("HLE: 0x%.08X -> g_pRtlCreateHeap\n", XTL::g_pRtlCreateHeap);
}
else if( OrigBuildVersion == 3950 )
{
// This library doesn't appear to have XapiInitProcess.
// So far, only the Halo demo uses this XDK library version.
// TODO: Don't use hard coded values in case other games using this library
// version are discovered. You can get XapiProcessHeap from LocalFree+0x7.
XTL::EmuXapiProcessHeap = (PVOID*)(0x2D9758);
XTL::g_pRtlCreateHeap = (XTL::pfRtlCreateHeap)(0x164FC);
DbgPrintf("HLE: 0x%.08X -> EmuXapiProcessHeap\n", XTL::EmuXapiProcessHeap);
DbgPrintf("HLE: 0x%.08X -> g_pRtlCreateHeap\n", XTL::g_pRtlCreateHeap);
}
}
}
else if(strcmp("D3D8", szLibraryName) == 0 /*&& strcmp("D3D8LTCG", szOrigLibraryName)*/ &&