This commit is contained in:
Aaron Robinson 2003-07-03 05:09:28 +00:00
parent 0ba5b79d9f
commit 39734d62a8
20 changed files with 1314 additions and 143 deletions

View File

@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 dsound.lib winmm.lib d3d8.lib dinput8.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /machine:I386 /out:"Bin/Cxbx.dll" /libpath:"Lib"
# ADD LINK32 ws2_32.lib dsound.lib winmm.lib d3d8.lib dinput8.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /machine:I386 /out:"Bin/Cxbx.dll" /libpath:"Lib"
# SUBTRACT LINK32 /profile /pdb:none /debug
!ELSEIF "$(CFG)" == "CxbxKrnl - Win32 Debug"
@ -80,7 +80,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 dsound.lib winmm.lib d3dx8.lib d3d8.lib dinput8.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept /libpath:"Lib"
# ADD LINK32 ws2_32.lib dsound.lib winmm.lib d3dx8.lib d3d8.lib dinput8.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept /libpath:"Lib"
# SUBTRACT LINK32 /pdb:none
!ENDIF

View File

@ -61,7 +61,7 @@ typedef signed long sint32;
// ******************************************************************
// * Define this to trace intercepted function calls
// ******************************************************************
//#define _DEBUG_TRACE
#define _DEBUG_TRACE
// ******************************************************************
// * Version information

View File

@ -533,6 +533,31 @@ HRESULT WINAPI EmuIDirect3D8_EnumAdapterModes
// ******************************************************************
VOID WINAPI EmuIDirect3D8_KickOffAndWaitForIdle();
// ******************************************************************
// * func: EmuIDirect3DDevice8_AddRef
// ******************************************************************
ULONG WINAPI EmuIDirect3DDevice8_AddRef();
// ******************************************************************
// * func: EmuIDirect3DDevice8_BeginStateBlock
// ******************************************************************
HRESULT WINAPI EmuIDirect3DDevice8_BeginStateBlock();
// ******************************************************************
// * func: EmuIDirect3DDevice8_CaptureStateBlock
// ******************************************************************
HRESULT WINAPI EmuIDirect3DDevice8_CaptureStateBlock(DWORD Token);
// ******************************************************************
// * func: EmuIDirect3DDevice8_ApplyStateBlock
// ******************************************************************
HRESULT WINAPI EmuIDirect3DDevice8_ApplyStateBlock(DWORD Token);
// ******************************************************************
// * func: EmuIDirect3DDevice8_EndStateBlock
// ******************************************************************
HRESULT WINAPI EmuIDirect3DDevice8_EndStateBlock(DWORD *pToken);
// ******************************************************************
// * func: EmuIDirect3DDevice8_CopyRects
// ******************************************************************
@ -940,6 +965,14 @@ VOID __fastcall EmuIDirect3DDevice8_SetRenderState_Simple
DWORD Value
);
// ******************************************************************
// * func: EmuIDirect3DDevice8_SetRenderState_VertexBlend
// ******************************************************************
VOID WINAPI EmuIDirect3DDevice8_SetRenderState_VertexBlend
(
DWORD Value
);
// ******************************************************************
// * func: EmuIDirect3DDevice8_SetRenderState_CullMode
// ******************************************************************

View File

@ -329,6 +329,16 @@ typedef struct _IO_STATUS_BLOCK
}
IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
// ******************************************************************
// * IO_APC_ROUTINE
// ******************************************************************
typedef VOID (NTAPI *PIO_APC_ROUTINE)
(
IN PVOID ApcContext,
IN PIO_STATUS_BLOCK IoStatusBlock,
IN ULONG Reserved
);
// ******************************************************************
// * EVENT_TYPE
// ******************************************************************
@ -690,6 +700,24 @@ typedef NTSTATUS (NTAPI *FPTR_NtSetInformationFile)
IN ULONG FileInformationClass
);
// ******************************************************************
// * NtQueryDirectoryFile
// ******************************************************************
typedef NTSTATUS (NTAPI *FPTR_NtQueryDirectoryFile)
(
IN HANDLE FileHandle,
IN HANDLE Event OPTIONAL,
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID FileInformation,
IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInformationClass,
IN BOOLEAN ReturnSingleEntry,
IN PUNICODE_STRING FileMask OPTIONAL,
IN BOOLEAN RestartScan
);
// ******************************************************************
// * NtQueryFullAttributesFile
// ******************************************************************
@ -763,6 +791,7 @@ extern FPTR_NtClose NtClose;
extern FPTR_NtDelayExecution NtDelayExecution;
extern FPTR_NtDuplicateObject NtDuplicateObject;
extern FPTR_NtQueryInformationFile NtQueryInformationFile;
extern FPTR_NtQueryDirectoryFile NtQueryDirectoryFile;
extern FPTR_NtQueryFullAttributesFile NtQueryFullAttributesFile;
extern FPTR_NtQueryVolumeInformationFile NtQueryVolumeInformationFile;
extern FPTR_NtCreateEvent NtCreateEvent;

View File

@ -34,13 +34,54 @@
#ifndef EMUXONLINE_H
#define EMUXONLINE_H
// If you've never seen ugly code before, here is some for you
#undef FD_SET
#undef SO_DONTLINGER
#undef AF_IPX
#undef AF_MAX
#undef SOMAXCONN
#undef FD_READ
#undef FD_WRITE
#undef FD_OOB
#undef FD_ACCEPT
#undef FD_CONNECT
#undef FD_CLOSE
#include <winsock2.h>
// ******************************************************************
// * clas: EmuThis
// ******************************************************************
class EmuThis
{
// ******************************************************************
// * func: Emusocket
// ******************************************************************
SOCKET Emusocket(int af, int type, int protocol);
// ******************************************************************
// * func: Emubind
// ******************************************************************
int Emubind(SOCKET s, const struct sockaddr FAR *name, int namelen);
// ******************************************************************
// * func: Emulisten
// ******************************************************************
int Emulisten(SOCKET s, int backlog);
// ******************************************************************
// * func: Emuioctlsocket
// ******************************************************************
int Emuioctlsocket(SOCKET s, long cmd, u_long FAR *argp);
};
// ******************************************************************
// * func: EmuWSAStartup
// ******************************************************************
int WINAPI EmuWSAStartup
(
WORD wVersionRequested,
LPVOID lpWSAData // todo: use correct type
WSADATA *lpWSAData
);
// ******************************************************************
@ -51,14 +92,4 @@ INT WINAPI EmuXNetStartup
const PVOID pDummy
);
// ******************************************************************
// * func: Emusocket
// ******************************************************************
SOCKET socket
(
int af,
int type,
int protocol
);
#endif

View File

@ -332,6 +332,14 @@ HANDLE WINAPI EmuXInputOpen
IN PXINPUT_POLLING_PARAMETERS pPollingParameters OPTIONAL
);
// ******************************************************************
// * func: EmuXInputClose
// ******************************************************************
VOID WINAPI EmuXInputClose
(
IN HANDLE hDevice
);
// ******************************************************************
// * func: EmuXInputGetCapabilities
// ******************************************************************

View File

@ -88,7 +88,10 @@ extern bool bXRefFirstPass;
// ******************************************************************
enum XRefDataBaseOffset
{
XREF_XNINIT = 0
XREF_XNINIT = 0,
XREF_FCLOSEDEVICE = 1,
XREF_CLEARSTATEBLOCKFLAGS = 2,
XREF_RECORDSTATEBLOCK = 3
};
#endif

View File

@ -36,6 +36,23 @@
#include "Cxbx.h"
// ******************************************************************
// * Take THIS C++ !!
// ******************************************************************
template <class BaseClass, typename MFT> inline void *MFPtoFP( MFT pMemFunc)
{
union
{
MFT pMemFunc;
void (*pFunc)();
}
ThisConv;
ThisConv.pMemFunc = pMemFunc;
return ThisConv.pFunc;
}
#pragma pack(1)
// ******************************************************************

View File

@ -161,6 +161,205 @@ SOOVPA<10> IDirect3D8_EnumAdapterModes_1_0_4361 =
}
};
// ******************************************************************
// * IDirect3DDevice8_AddRef
// ******************************************************************
SOOVPA<10> IDirect3DDevice8_AddRef_1_0_4361 =
{
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+0x0440]
{ 0x05, 0x8B }, // (Offset,Value)-Pair #2
{ 0x06, 0x88 }, // (Offset,Value)-Pair #3
{ 0x07, 0x40 }, // (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+0x0440], ecx
{ 0x0C, 0x89 }, // (Offset,Value)-Pair #7
{ 0x0D, 0x88 }, // (Offset,Value)-Pair #8
{ 0x0E, 0x40 }, // (Offset,Value)-Pair #9
{ 0x0F, 0x04 }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * IDirect3D_ClearStateBlockFlags
// ******************************************************************
SOOVPA<9> IDirect3D_ClearStateBlockFlags_1_0_4361 =
{
0, // Large == 0
9, // Count == 9
XREF_CLEARSTATEBLOCKFLAGS, // XRef Is Saved
0, // XRef Not Used
{
// IDirect3D_ClearStateBlockFlags+0x0A : movzx ecx, 0x82
{ 0x0A, 0xB9 }, // (Offset,Value)-Pair #1
{ 0x0B, 0x82 }, // (Offset,Value)-Pair #2
// IDirect3D_ClearStateBlockFlags+0x16 : mov ecx, [edx+0x0390]
{ 0x16, 0x8B }, // (Offset,Value)-Pair #3
{ 0x17, 0x8A }, // (Offset,Value)-Pair #4
{ 0x18, 0x90 }, // (Offset,Value)-Pair #5
{ 0x19, 0x03 }, // (Offset,Value)-Pair #6
// IDirect3D_ClearStateBlockFlags+0x2F : add ecx, 0x90
{ 0x2F, 0x81 }, // (Offset,Value)-Pair #7
{ 0x30, 0xC1 }, // (Offset,Value)-Pair #8
{ 0x31, 0x90 }, // (Offset,Value)-Pair #9
}
};
// ******************************************************************
// * IDirect3D_RecordStateBlock
// ******************************************************************
SOOVPA<10> IDirect3D_RecordStateBlock_1_0_4361 =
{
0, // Large == 0
10, // Count == 10
XREF_RECORDSTATEBLOCK, // XRef Is Saved
0, // XRef Not Used
{
// IDirect3D_RecordStateBlock+0x0F : mov eax, [edi+0x0390]
{ 0x0F, 0x8B }, // (Offset,Value)-Pair #1
{ 0x10, 0x87 }, // (Offset,Value)-Pair #2
{ 0x11, 0x90 }, // (Offset,Value)-Pair #3
{ 0x12, 0x03 }, // (Offset,Value)-Pair #4
// IDirect3D_RecordStateBlock+0x95 : add ebx, ecx
{ 0x95, 0x03 }, // (Offset,Value)-Pair #5
{ 0x96, 0xD9 }, // (Offset,Value)-Pair #6
// IDirect3D_RecordStateBlock+0xD5 : mov dword ptr [esi+0x0C], 1
{ 0xD5, 0xC7 }, // (Offset,Value)-Pair #7
{ 0xD6, 0x46 }, // (Offset,Value)-Pair #8
{ 0xD7, 0x0C }, // (Offset,Value)-Pair #9
{ 0xD8, 0x01 }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * IDirect3DDevice8_BeginStateBlock
// ******************************************************************
SOOVPA<6> IDirect3DDevice8_BeginStateBlock_1_0_4361 =
{
0, // Large == 0
6, // Count == 6
-1, // XRef Not Saved
1, // XRef Is Used
{
// IDirect3DDevice8_BeginStateBlock+0x0F : call [ClearStateBlockFlags]
{ 0x0A, XREF_CLEARSTATEBLOCKFLAGS }, // (Offset,Value)-Pair #1
// IDirect3DDevice8_BeginStateBlock+0x00 : mov eax, [addr]
{ 0x00, 0xA1 }, // (Offset,Value)-Pair #2
// IDirect3DDevice8_BeginStateBlock+0x05 : mov [eax+8], 0x20
{ 0x05, 0x83 }, // (Offset,Value)-Pair #3
{ 0x06, 0x48 }, // (Offset,Value)-Pair #4
{ 0x07, 0x08 }, // (Offset,Value)-Pair #5
{ 0x08, 0x20 }, // (Offset,Value)-Pair #6
}
};
// ******************************************************************
// * IDirect3DDevice8_CaptureStateBlock
// ******************************************************************
SOOVPA<9> IDirect3DDevice8_CaptureStateBlock_1_0_4361 =
{
0, // Large == 0
9, // Count == 9
-1, // XRef Not Saved
0, // XRef Not Used
{
// IDirect3DDevice8_CaptureStateBlock+0x36 : mov eax, [edi+eax*4+0x0A78]
{ 0x36, 0x8B }, // (Offset,Value)-Pair #1
{ 0x37, 0x84 }, // (Offset,Value)-Pair #2
{ 0x38, 0x87 }, // (Offset,Value)-Pair #3
{ 0x39, 0x78 }, // (Offset,Value)-Pair #4
{ 0x3A, 0x0A }, // (Offset,Value)-Pair #5
// IDirect3DDevice8_CaptureStateBlock+0xA9 : cmp dword ptr [esi+0x0C], 0
{ 0xA9, 0x83 }, // (Offset,Value)-Pair #6
{ 0xAA, 0x7E }, // (Offset,Value)-Pair #7
{ 0xAB, 0x0C }, // (Offset,Value)-Pair #8
{ 0xAC, 0x00 }, // (Offset,Value)-Pair #9
}
};
// ******************************************************************
// * IDirect3DDevice8_ApplyStateBlock
// ******************************************************************
SOOVPA<9> IDirect3DDevice8_ApplyStateBlock_1_0_4361 =
{
0, // Large == 0
9, // Count == 9
-1, // XRef Not Saved
0, // XRef Not Used
{
// IDirect3DDevice8_ApplyStateBlock+0x0E : lea esi, [edi+0x3C]
{ 0x0E, 0x8D }, // (Offset,Value)-Pair #1
{ 0x0F, 0x77 }, // (Offset,Value)-Pair #2
{ 0x10, 0x3C }, // (Offset,Value)-Pair #3
// IDirect3DDevice8_ApplyStateBlock+0x34 : cmp [edi+8], ebp
{ 0x34, 0x39 }, // (Offset,Value)-Pair #4
{ 0x35, 0x6F }, // (Offset,Value)-Pair #5
{ 0x36, 0x08 }, // (Offset,Value)-Pair #6
// IDirect3DDevice8_ApplyStateBlock+0x9E : sub eax, 0x60
{ 0x9E, 0x83 }, // (Offset,Value)-Pair #7
{ 0x9F, 0xE8 }, // (Offset,Value)-Pair #8
{ 0xA0, 0x60 }, // (Offset,Value)-Pair #9
}
};
// ******************************************************************
// * IDirect3DDevice8_EndStateBlock
// ******************************************************************
SOOVPA<6> IDirect3DDevice8_EndStateBlock_1_0_4361 =
{
0, // Large == 0
6, // Count == 6
-1, // XRef Not Saved
1, // XRef Is Used
{
// IDirect3DDevice8_EndStateBlock+0x0F : call [ClearStateBlockFlags]
{ 0x0A, XREF_RECORDSTATEBLOCK }, // (Offset,Value)-Pair #1
// IDirect3DDevice8_EndStateBlock+0x00 : mov eax, [addr]
{ 0x00, 0xA1 }, // (Offset,Value)-Pair #2
// IDirect3DDevice8_EndStateBlock+0x05 : and [eax+8], 0xFFFFFFDF
{ 0x05, 0x83 }, // (Offset,Value)-Pair #3
{ 0x06, 0x60 }, // (Offset,Value)-Pair #4
{ 0x07, 0x08 }, // (Offset,Value)-Pair #5
{ 0x08, 0xDF }, // (Offset,Value)-Pair #6
}
};
// ******************************************************************
// * IDirect3DDevice8_CopyRects
// ******************************************************************
@ -763,6 +962,39 @@ SOOVPA<10> IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_4361 =
}
};
// ******************************************************************
// * IDirect3DDevice8_SetRenderState_VertexBlend
// ******************************************************************
SOOVPA<11> IDirect3DDevice8_SetRenderState_VertexBlend_1_0_4361 =
{
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_CullMode
// ******************************************************************
@ -1657,6 +1889,36 @@ SOOVPA<13> IDirect3DBaseTexture8_GetLevelCount_1_0_4361 =
}
};
// ******************************************************************
// * Get2DSurfaceDesc
// ******************************************************************
SOOVPA<10> Get2DSurfaceDesc_1_0_4361 =
{
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
}
};
// ******************************************************************
// * IDirect3DTexture8_GetSurfaceLevel
// ******************************************************************
@ -1698,6 +1960,47 @@ SOOVPA<11> IDirect3DTexture8_GetSurfaceLevel_1_0_4361 =
}
};
// ******************************************************************
// * IDirect3DTexture8_LockRect
// ******************************************************************
SOOVPA<17> IDirect3DTexture8_LockRect_1_0_4361 =
{
0, // Large == 0
17, // Count == 17
-1, // XRef Not Saved
0, // XRef Not Used
{
// IDirect3DTexture8_LockRect+0x00 : mov eax, [esp+0x14]
{ 0x00, 0x8B }, // (Offset,Value)-Pair #1
{ 0x01, 0x44 }, // (Offset,Value)-Pair #2
{ 0x02, 0x24 }, // (Offset,Value)-Pair #3
{ 0x03, 0x14 }, // (Offset,Value)-Pair #4
// IDirect3DTexture8_LockRect+0x04 : mov ecx, [esp+0x10]
{ 0x04, 0x8B }, // (Offset,Value)-Pair #5
{ 0x05, 0x4C }, // (Offset,Value)-Pair #6
{ 0x06, 0x24 }, // (Offset,Value)-Pair #7
{ 0x07, 0x10 }, // (Offset,Value)-Pair #8
// IDirect3DTexture8_LockRect+0x0C : push eax, push ecx, push edx, push eax, push 0
{ 0x0C, 0x50 }, // (Offset,Value)-Pair #9
{ 0x11, 0x51 }, // (Offset,Value)-Pair #10
{ 0x16, 0x52 }, // (Offset,Value)-Pair #11
{ 0x17, 0x50 }, // (Offset,Value)-Pair #12
{ 0x18, 0x6A }, // (Offset,Value)-Pair #13
{ 0x19, 0x00 }, // (Offset,Value)-Pair #14
// IDirect3DTexture8_LockRect+0x1B : call [addr]
{ 0x1B, 0xE8 }, // (Offset,Value)-Pair #15
// IDirect3DTexture8_LockRect+0x1B : retn 0x14
{ 0x20, 0xC2 }, // (Offset,Value)-Pair #16
{ 0x21, 0x14 }, // (Offset,Value)-Pair #17
}
};
// ******************************************************************
// * D3D8_1_0_4361
// ******************************************************************
@ -1743,6 +2046,72 @@ OOVPATable D3D8_1_0_4361[] =
"EmuIDirect3D8_EnumAdapterModes"
#endif
},
// IDirect3DDevice8::AddRef
{
(OOVPA*)&IDirect3DDevice8_AddRef_1_0_4361,
XTL::EmuIDirect3DDevice8_AddRef,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_AddRef"
#endif
},
// IDirect3D::ClearStateBlockFlags
{
(OOVPA*)&IDirect3D_ClearStateBlockFlags_1_0_4361, 0,
#ifdef _DEBUG_TRACE
"EmuIDirect3D_ClearStateBlockFlags (XREF)"
#endif
},
// IDirect3D::RecordStateBlock
{
(OOVPA*)&IDirect3D_RecordStateBlock_1_0_4361, 0,
#ifdef _DEBUG_TRACE
"EmuIDirect3D_RecordStateBlock (XREF)"
#endif
},
// IDirect3DDevice8::BeginStateBlock
{
(OOVPA*)&IDirect3DDevice8_BeginStateBlock_1_0_4361,
XTL::EmuIDirect3DDevice8_BeginStateBlock,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_BeginStateBlock"
#endif
},
// IDirect3DDevice8::CaptureStateBlock
{
(OOVPA*)&IDirect3DDevice8_CaptureStateBlock_1_0_4361,
XTL::EmuIDirect3DDevice8_CaptureStateBlock,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_CaptureStateBlock"
#endif
},
// IDirect3DDevice8::ApplyStateBlock
{
(OOVPA*)&IDirect3DDevice8_ApplyStateBlock_1_0_4361,
XTL::EmuIDirect3DDevice8_ApplyStateBlock,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_ApplyStateBlock"
#endif
},
// IDirect3DDevice8::EndStateBlock
{
(OOVPA*)&IDirect3DDevice8_EndStateBlock_1_0_4361,
XTL::EmuIDirect3DDevice8_EndStateBlock,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_EndStateBlock"
#endif
},
// IDirect3DDevice8::CopyRects
{
(OOVPA*)&IDirect3DDevice8_CopyRects_1_0_4361,
@ -1923,6 +2292,16 @@ OOVPATable D3D8_1_0_4361[] =
"EmuIDirect3DDevice8_SetTextureState_TexCoordIndex"
#endif
},
// IDirect3DDevice8::SetRenderState_VertexBlende
{
(OOVPA*)&IDirect3DDevice8_SetRenderState_VertexBlend_1_0_4361,
XTL::EmuIDirect3DDevice8_SetRenderState_VertexBlend,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_SetRenderState_VertexBlend"
#endif
},
// IDirect3DDevice8::SetRenderState_CullMode
{
(OOVPA*)&IDirect3DDevice8_SetRenderState_CullMode_1_0_4361,
@ -2143,6 +2522,16 @@ OOVPATable D3D8_1_0_4361[] =
"EmuIDirect3DResource8_IsBusy"
#endif
},
// Get2DSurfacDesc
{
(OOVPA*)&Get2DSurfaceDesc_1_0_4361,
XTL::EmuGet2DSurfaceDesc,
#ifdef _DEBUG_TRACE
"EmuGet2DSurfaceDesc"
#endif
},
// IDirect3DSurface8::GetDesc
{
(OOVPA*)&IDirect3DSurface8_GetDesc_1_0_4361,
@ -2183,6 +2572,16 @@ OOVPATable D3D8_1_0_4361[] =
"EmuIDirect3DTexture8_GetSurfaceLevel"
#endif
},
// IDirect3DTexture8::LockRect
{
(OOVPA*)&IDirect3DTexture8_LockRect_1_0_4361,
XTL::EmuIDirect3DTexture8_LockRect,
#ifdef _DEBUG_TRACE
"EmuIDirect3DTexture8_LockRect"
#endif
},
};
// ******************************************************************

View File

@ -1033,47 +1033,6 @@ SOOVPA<14> IDirect3DTexture8_GetSurfaceLevel2_1_0_4627 =
}
};
// ******************************************************************
// * IDirect3DTexture8_LockRect
// ******************************************************************
SOOVPA<17> IDirect3DTexture8_LockRect_1_0_4627 =
{
0, // Large == 0
17, // Count == 17
-1, // XRef Not Saved
0, // XRef Not Used
{
// IDirect3DTexture8_LockRect+0x00 : mov eax, [esp+0x14]
{ 0x00, 0x8B }, // (Offset,Value)-Pair #1
{ 0x01, 0x44 }, // (Offset,Value)-Pair #2
{ 0x02, 0x24 }, // (Offset,Value)-Pair #3
{ 0x03, 0x14 }, // (Offset,Value)-Pair #4
// IDirect3DTexture8_LockRect+0x04 : mov ecx, [esp+0x10]
{ 0x04, 0x8B }, // (Offset,Value)-Pair #5
{ 0x05, 0x4C }, // (Offset,Value)-Pair #6
{ 0x06, 0x24 }, // (Offset,Value)-Pair #7
{ 0x07, 0x10 }, // (Offset,Value)-Pair #8
// IDirect3DTexture8_LockRect+0x0C : push eax, push ecx, push edx, push eax, push 0
{ 0x0C, 0x50 }, // (Offset,Value)-Pair #9
{ 0x11, 0x51 }, // (Offset,Value)-Pair #10
{ 0x16, 0x52 }, // (Offset,Value)-Pair #11
{ 0x17, 0x50 }, // (Offset,Value)-Pair #12
{ 0x18, 0x6A }, // (Offset,Value)-Pair #13
{ 0x19, 0x00 }, // (Offset,Value)-Pair #14
// IDirect3DTexture8_LockRect+0x1B : call [addr]
{ 0x1B, 0xE8 }, // (Offset,Value)-Pair #15
// IDirect3DTexture8_LockRect+0x1B : retn 0x14
{ 0x20, 0xC2 }, // (Offset,Value)-Pair #16
{ 0x21, 0x14 }, // (Offset,Value)-Pair #17
}
};
// ******************************************************************
// * D3D8_1_0_4627
// ******************************************************************
@ -1599,9 +1558,9 @@ OOVPATable D3D8_1_0_4627[] =
"EmuIDirect3DTexture8_GetSurfaceLevel2"
#endif
},
// IDirect3DTexture8::LockRect
// IDirect3DTexture8::LockRect (* unchanged since 4361 *)
{
(OOVPA*)&IDirect3DTexture8_LockRect_1_0_4627,
(OOVPA*)&IDirect3DTexture8_LockRect_1_0_4361,
XTL::EmuIDirect3DTexture8_LockRect,

View File

@ -320,9 +320,12 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit
uint32 dwHLEEntries = HLEDataBaseSize/sizeof(HLEData);
uint32 LastUnResolvedXRefs;
uint32 OrigUnResolvedXRefs = UnResolvedXRefs;
do
for(int p=0;UnResolvedXRefs < LastUnResolvedXRefs;p++)
{
printf("Emu (0x%X): Beginning HLE Pass %d...\n", GetCurrentThreadId(), p);
LastUnResolvedXRefs = UnResolvedXRefs;
bool bFoundD3D = false;
@ -371,93 +374,95 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit
if(!found)
printf("Skipped\n");
if(strcmp("XAPILIB", szLibraryName) == 0 && MajorVersion == 1 && MinorVersion == 0 && (BuildVersion == 4627 || BuildVersion == 4361 || BuildVersion == 4034 || BuildVersion == 3911))
if(bXRefFirstPass)
{
uint32 lower = pXbeHeader->dwBaseAddr;
uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage;
// ******************************************************************
// * Locate XapiProcessHeap
// ******************************************************************
if(BuildVersion == 4361 || BuildVersion == 4627)
{
void *pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_4361, lower, upper);
if(pFunc != 0)
{
XTL::EmuXapiProcessHeap = *(PVOID**)((uint32)pFunc + 0x3E);
XTL::g_pRtlCreateHeap = *(XTL::pfRtlCreateHeap*)((uint32)pFunc + 0x37);
XTL::g_pRtlCreateHeap = (XTL::pfRtlCreateHeap)((uint32)pFunc + (uint32)XTL::g_pRtlCreateHeap + 0x37 + 0x04);
printf("Emu (0x%X): 0x%.08X -> EmuXapiProcessHeap\n", GetCurrentThreadId(), XTL::EmuXapiProcessHeap);
printf("Emu (0x%X): 0x%.08X -> RtlCreateHeap\n", GetCurrentThreadId(), XTL::g_pRtlCreateHeap);
}
}
}
else if(strcmp("D3D8", szLibraryName) == 0 && MajorVersion == 1 && MinorVersion == 0 && (BuildVersion == 4361 || BuildVersion == 4627))
{
uint32 lower = pXbeHeader->dwBaseAddr;
uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage;
void *pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetRenderState_CullMode_1_0_4361, lower, upper);
// ******************************************************************
// * Locate D3DDeferredRenderState
// ******************************************************************
if(pFunc != 0 && (BuildVersion == 4361 || BuildVersion == 4627))
if(strcmp("XAPILIB", szLibraryName) == 0 && MajorVersion == 1 && MinorVersion == 0 && (BuildVersion == 4627 || BuildVersion == 4361 || BuildVersion == 4034 || BuildVersion == 3911))
{
if(BuildVersion == 4361)
XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x200 + 82*4);
else if(BuildVersion == 4627)
XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x24C + 92*4);
uint32 lower = pXbeHeader->dwBaseAddr;
uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage;
for(int v=0;v<146;v++)
XTL::EmuD3DDeferredRenderState[v] = X_D3DRS_UNK;
// ******************************************************************
// * Locate XapiProcessHeap
// ******************************************************************
if(BuildVersion == 4361 || BuildVersion == 4627)
{
void *pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_4361, lower, upper);
printf("Emu (0x%X): 0x%.08X -> EmuD3DDeferredRenderState\n", GetCurrentThreadId(), XTL::EmuD3DDeferredRenderState);
}
else
{
XTL::EmuD3DDeferredRenderState = 0;
printf("Emu (0x%X): *Warning* EmuD3DDeferredRenderState not found!\n", GetCurrentThreadId());
if(pFunc != 0)
{
XTL::EmuXapiProcessHeap = *(PVOID**)((uint32)pFunc + 0x3E);
XTL::g_pRtlCreateHeap = *(XTL::pfRtlCreateHeap*)((uint32)pFunc + 0x37);
XTL::g_pRtlCreateHeap = (XTL::pfRtlCreateHeap)((uint32)pFunc + (uint32)XTL::g_pRtlCreateHeap + 0x37 + 0x04);
printf("Emu (0x%X): 0x%.08X -> EmuXapiProcessHeap\n", GetCurrentThreadId(), XTL::EmuXapiProcessHeap);
printf("Emu (0x%X): 0x%.08X -> RtlCreateHeap\n", GetCurrentThreadId(), XTL::g_pRtlCreateHeap);
}
}
}
else if(strcmp("D3D8", szLibraryName) == 0 && MajorVersion == 1 && MinorVersion == 0 && (BuildVersion == 4361 || BuildVersion == 4627))
{
uint32 lower = pXbeHeader->dwBaseAddr;
uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage;
// ******************************************************************
// * Locate D3DDeferredTextureState
// ******************************************************************
{
if(BuildVersion == 4361)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_4361, lower, upper);
else if(BuildVersion == 4627)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_4627, lower, upper);
void *pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetRenderState_CullMode_1_0_4361, lower, upper);
if(pFunc != 0)
// ******************************************************************
// * Locate D3DDeferredRenderState
// ******************************************************************
if(pFunc != 0 && (BuildVersion == 4361 || BuildVersion == 4627))
{
XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x19) - 0x70);
if(BuildVersion == 4361)
XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x200 + 82*4);
else if(BuildVersion == 4627)
XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x24C + 92*4);
for(int v=0;v<32*4;v++)
XTL::EmuD3DDeferredTextureState[v] = X_D3DTSS_UNK;
for(int v=0;v<146;v++)
XTL::EmuD3DDeferredRenderState[v] = X_D3DRS_UNK;
printf("Emu (0x%X): 0x%.08X -> EmuD3DDeferredTextureState\n", GetCurrentThreadId(), XTL::EmuD3DDeferredTextureState);
printf("Emu (0x%X): 0x%.08X -> EmuD3DDeferredRenderState\n", GetCurrentThreadId(), XTL::EmuD3DDeferredRenderState);
}
else
{
XTL::EmuD3DDeferredTextureState = 0;
printf("Emu (0x%X): *Warning* EmuD3DDeferredTextureState not found!\n", GetCurrentThreadId());
XTL::EmuD3DDeferredRenderState = 0;
printf("Emu (0x%X): *Warning* EmuD3DDeferredRenderState not found!\n", GetCurrentThreadId());
}
}
}
// ******************************************************************
// * Locate D3DDeferredTextureState
// ******************************************************************
{
if(BuildVersion == 4361)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_4361, lower, upper);
else if(BuildVersion == 4627)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_4627, lower, upper);
if(pFunc != 0)
{
XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x19) - 0x70);
for(int v=0;v<32*4;v++)
XTL::EmuD3DDeferredTextureState[v] = X_D3DTSS_UNK;
printf("Emu (0x%X): 0x%.08X -> EmuD3DDeferredTextureState\n", GetCurrentThreadId(), XTL::EmuD3DDeferredTextureState);
}
else
{
XTL::EmuD3DDeferredTextureState = 0;
printf("Emu (0x%X): *Warning* EmuD3DDeferredTextureState not found!\n", GetCurrentThreadId());
}
}
}
}
}
bXRefFirstPass = false;
}
while(UnResolvedXRefs < LastUnResolvedXRefs);
// ******************************************************************
// * Display XRef Summary
// ******************************************************************
printf("Emu (0x%X): Resolved %d cross reference(s)\n", GetCurrentThreadId(), UnResolvedXRefs);
printf("Emu (0x%X): Resolved %d cross reference(s)\n", GetCurrentThreadId(), OrigUnResolvedXRefs - UnResolvedXRefs);
}
// ******************************************************************
@ -483,7 +488,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit
EmuSwapFS(); // XBox FS
// _USE_XGMATH Disabled in mesh :[
//_asm int 3
_asm int 3
Entry();
@ -617,7 +622,7 @@ void *EmuLocateFunction(OOVPA *Oovpa, uint32 lower, uint32 upper)
uint32 RealValue = *(uint32*)(cur + Offset);
if(XRefDataBase[Value] == -1)
return 0; // Unsatisfied XRef is not acceptable
goto skipout_L; // Unsatisfied XRef is not acceptable
if(RealValue + cur + Offset+4 != XRefDataBase[Value])
break;
@ -642,14 +647,23 @@ void *EmuLocateFunction(OOVPA *Oovpa, uint32 lower, uint32 upper)
// ******************************************************************
if(v == count)
{
if(Loovpa->XRefSaveIndex != (uint08)-1 && XRefDataBase[Loovpa->XRefSaveIndex] == -1)
if(Loovpa->XRefSaveIndex != (uint08)-1)
{
UnResolvedXRefs--;
XRefDataBase[Loovpa->XRefSaveIndex] = cur;
if(XRefDataBase[Loovpa->XRefSaveIndex] == -1)
{
UnResolvedXRefs--;
XRefDataBase[Loovpa->XRefSaveIndex] = cur;
return (void*)cur;
}
else
return 0; // Already Found, no bother patching again
}
return (void*)cur;
}
skipout_L:;
}
}
// ******************************************************************
@ -679,9 +693,9 @@ void *EmuLocateFunction(OOVPA *Oovpa, uint32 lower, uint32 upper)
uint32 RealValue = *(uint32*)(cur + Offset);
if(XRefDataBase[Value] == -1)
return 0; // Unsatisfied XRef is not acceptable
goto skipout_S; // Unsatisfied XRef is not acceptable
if(RealValue + cur + Offset+4 != XRefDataBase[Value])
if( (RealValue + cur + Offset + 4 != XRefDataBase[Value]))
break;
}
@ -706,12 +720,21 @@ void *EmuLocateFunction(OOVPA *Oovpa, uint32 lower, uint32 upper)
{
if(Soovpa->XRefSaveIndex != (uint08)-1)
{
UnResolvedXRefs--;
XRefDataBase[Soovpa->XRefSaveIndex] = cur;
if(XRefDataBase[Soovpa->XRefSaveIndex] == -1)
{
UnResolvedXRefs--;
XRefDataBase[Soovpa->XRefSaveIndex] = cur;
return (void*)cur;
}
else
return 0; // Already Found, no bother patching again
}
return (void*)cur;
}
skipout_S:;
}
}
@ -755,6 +778,8 @@ void EmuInstallWrappers(OOVPATable *OovpaTable, uint32 OovpaTableSize, void (*En
void EmuXRefFailure()
{
EmuSwapFS(); // Win2k/XP FS
_asm int 3
EmuCleanup("XRef-only function body reached. Fatal Error.");
}

View File

@ -748,6 +748,133 @@ VOID WINAPI XTL::EmuIDirect3D8_KickOffAndWaitForIdle()
return;
}
// ******************************************************************
// * func: EmuIDirect3DDevice8_AddRef
// ******************************************************************
ULONG WINAPI XTL::EmuIDirect3DDevice8_AddRef()
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_AddRef()\n", GetCurrentThreadId());
}
#endif
ULONG ret = g_pD3DDevice8->AddRef();
EmuSwapFS(); // XBox FS
return ret;
}
// ******************************************************************
// * func: EmuIDirect3DDevice8_BeginStateBlock
// ******************************************************************
HRESULT WINAPI XTL::EmuIDirect3DDevice8_BeginStateBlock()
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_BeginStateBlock()\n", GetCurrentThreadId());
}
#endif
ULONG ret = g_pD3DDevice8->BeginStateBlock();
EmuSwapFS(); // XBox FS
return ret;
}
// ******************************************************************
// * func: EmuIDirect3DDevice8_CaptureStateBlock
// ******************************************************************
HRESULT WINAPI XTL::EmuIDirect3DDevice8_CaptureStateBlock(DWORD Token)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_CaptureStateBlock\n"
"(\n"
" Token : 0x%.08X\n"
");\n",
GetCurrentThreadId(), Token);
}
#endif
ULONG ret = g_pD3DDevice8->CaptureStateBlock(Token);
EmuSwapFS(); // XBox FS
return ret;
}
// ******************************************************************
// * func: EmuIDirect3DDevice8_ApplyStateBlock
// ******************************************************************
HRESULT WINAPI XTL::EmuIDirect3DDevice8_ApplyStateBlock(DWORD Token)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_ApplyStateBlock\n"
"(\n"
" Token : 0x%.08X\n"
");\n",
GetCurrentThreadId(), Token);
}
#endif
ULONG ret = g_pD3DDevice8->ApplyStateBlock(Token);
EmuSwapFS(); // XBox FS
return ret;
}
// ******************************************************************
// * func: EmuIDirect3DDevice8_EndStateBlock
// ******************************************************************
HRESULT WINAPI XTL::EmuIDirect3DDevice8_EndStateBlock(DWORD *pToken)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_EndStateBlock\n"
"(\n"
" pToken : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pToken);
}
#endif
ULONG ret = g_pD3DDevice8->EndStateBlock(pToken);
EmuSwapFS(); // XBox FS
return ret;
}
// ******************************************************************
// * func: EmuIDirect3DDevice8_CopyRects
// ******************************************************************
@ -2807,6 +2934,48 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetRenderState_Simple
return;
}
// ******************************************************************
// * func: EmuIDirect3DDevice8_SetRenderState_VertexBlend
// ******************************************************************
VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_VertexBlend
(
DWORD Value
)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_VertexBlend\n"
"(\n"
" Value : 0x%.08X\n"
");\n",
GetCurrentThreadId(), Value);
}
#endif
// ******************************************************************
// * Convert from Xbox D3D to PC D3D enumeration
// ******************************************************************
if(Value <= 1)
Value = Value;
else if(Value == 3)
Value = 2;
else if(Value == 5)
Value = 3;
else
EmuCleanup("Unsupported D3DVERTEXBLENDFLAGS (%d)", Value);
g_pD3DDevice8->SetRenderState(D3DRS_VERTEXBLEND, Value);
EmuSwapFS(); // XBox FS
return;
}
// ******************************************************************
// * func: EmuIDirect3DDevice8_SetRenderState_CullMode
// ******************************************************************
@ -3117,9 +3286,15 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetStreamSource
}
#endif
IDirect3DVertexBuffer8 *pVertexBuffer8 = pStreamData->EmuVertexBuffer8;
IDirect3DVertexBuffer8 *pVertexBuffer8 = NULL;
pVertexBuffer8->Unlock();
if(pStreamData != NULL)
{
EmuVerifyResourceIsRegistered(pStreamData);
pVertexBuffer8 = pStreamData->EmuVertexBuffer8;
pVertexBuffer8->Unlock();
}
HRESULT hRet = g_pD3DDevice8->SetStreamSource(StreamNumber, pVertexBuffer8, Stride);

View File

@ -958,6 +958,23 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile
#endif
}
// ******************************************************************
// * TODO: Wildcards are not allowed??
// ******************************************************************
{
for(int v=0;szBuffer[v] != '\0';v++)
{
if(szBuffer[v] == '*')
{
if(v > 0)
szBuffer[v-1] = '\0';
else
szBuffer[v] = '\0';
break;
}
}
}
wchar_t wszObjectName[160];
NtDll::UNICODE_STRING NtUnicodeString;
@ -988,7 +1005,7 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile
EmuSwapFS(); // Xbox FS
return STATUS_SUCCESS;
return ret;
}
// ******************************************************************
@ -1075,6 +1092,76 @@ XBSYSAPI EXPORTNUM(202) NTSTATUS NTAPI xboxkrnl::NtOpenFile
return NtCreateFile(FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, NULL, 0, ShareAccess, FILE_OPEN, OpenOptions);
}
// ******************************************************************
// * 0x00CF - NtQueryDirectoryFile
// ******************************************************************
XBSYSAPI EXPORTNUM(207) NTSTATUS NTAPI xboxkrnl::NtQueryDirectoryFile
(
IN HANDLE FileHandle,
IN HANDLE Event OPTIONAL,
IN PVOID ApcRoutine, // Todo: define this routine's prototype
IN PVOID ApcContext,
OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID FileInformation,
IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInformationClass,
IN PSTRING FileMask,
IN BOOLEAN RestartScan
)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuKrnl (0x%X): NtQueryDirectoryFile\n"
"(\n"
" FileHandle : 0x%.08X\n"
" Event : 0x%.08X\n"
" ApcRoutine : 0x%.08X\n"
" ApcContext : 0x%.08X\n"
" IoStatusBlock : 0x%.08X\n"
" FileInformation : 0x%.08X\n"
" Length : 0x%.08X\n"
" FileInformationClass : 0x%.08X\n"
" FileMask : 0x%.08X (%s)\n"
" RestartScan : 0x%.08X\n"
");\n",
GetCurrentThreadId(), FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock,
FileInformation, Length, FileInformationClass, FileMask,
(FileMask != 0) ? FileMask->Buffer : "", RestartScan);
}
#endif
wchar_t wszObjectName[160];
NtDll::UNICODE_STRING NtFileMask;
// ******************************************************************
// * Initialize FileMask
// ******************************************************************
{
if(FileMask != 0)
mbstowcs(wszObjectName, FileMask->Buffer, 160);
else
mbstowcs(wszObjectName, "", 160);
NtDll::RtlInitUnicodeString(&NtFileMask, wszObjectName);
}
NTSTATUS ret = NtDll::NtQueryDirectoryFile
(
FileHandle, Event, (NtDll::PIO_APC_ROUTINE)ApcRoutine, ApcContext, (NtDll::IO_STATUS_BLOCK*)IoStatusBlock, FileInformation,
Length, (NtDll::FILE_INFORMATION_CLASS)FileInformationClass, FALSE, &NtFileMask, RestartScan
);
EmuSwapFS(); // Xbox FS
return ret;
}
// ******************************************************************
// * 0x00D2 - NtQueryFullAttributesFile
// ******************************************************************

View File

@ -65,6 +65,7 @@ NtDll::FPTR_NtClose NtDll::NtClose =
NtDll::FPTR_NtDelayExecution NtDll::NtDelayExecution = (NtDll::FPTR_NtDelayExecution)GetProcAddress(hNtDll, "NtDelayExecution");
NtDll::FPTR_NtDuplicateObject NtDll::NtDuplicateObject = (NtDll::FPTR_NtDuplicateObject)GetProcAddress(hNtDll, "NtDuplicateObject");
NtDll::FPTR_NtQueryInformationFile NtDll::NtQueryInformationFile = (NtDll::FPTR_NtQueryInformationFile)GetProcAddress(hNtDll, "NtQueryInformationFile");
NtDll::FPTR_NtQueryDirectoryFile NtDll::NtQueryDirectoryFile = (NtDll::FPTR_NtQueryDirectoryFile)GetProcAddress(hNtDll, "NtQueryDirectoryFile");
NtDll::FPTR_NtQueryFullAttributesFile NtDll::NtQueryFullAttributesFile = (NtDll::FPTR_NtQueryFullAttributesFile)GetProcAddress(hNtDll, "NtQueryFullAttributesFile");
NtDll::FPTR_NtQueryVolumeInformationFile NtDll::NtQueryVolumeInformationFile = (NtDll::FPTR_NtQueryVolumeInformationFile)GetProcAddress(hNtDll, "NtQueryVolumeInformationFile");
NtDll::FPTR_NtCreateEvent NtDll::NtCreateEvent = (NtDll::FPTR_NtCreateEvent)GetProcAddress(hNtDll, "NtCreateEvent");

View File

@ -34,9 +34,6 @@
#define _CXBXKRNL_INTERNAL
#define _XBOXKRNL_LOCAL_
#undef FIELD_OFFSET // prevent macro redefinition warnings
#include <windows.h>
#include "Emu.h"
#include "EmuFS.h"
@ -62,7 +59,7 @@ namespace XTL
int WINAPI XTL::EmuWSAStartup
(
WORD wVersionRequested,
LPVOID lpWSAData // todo: use correct type
WSADATA *lpWSAData
)
{
EmuSwapFS(); // Win2k/XP FS
@ -81,10 +78,11 @@ int WINAPI XTL::EmuWSAStartup
}
#endif
int ret = XTL::WSAStartup(wVersionRequested, lpWSAData);
EmuSwapFS(); // XBox FS
// Fake Successfull...hehehe...sucker...hehehehehe
return 0;
return ret;
}
// ******************************************************************
@ -115,3 +113,131 @@ INT WINAPI XTL::EmuXNetStartup
// Fake Successfull...hehehe...sucker...hehehehehe
return 0;
}
// ******************************************************************
// * func: EmuThis::Emusocket
// ******************************************************************
SOCKET XTL::EmuThis::Emusocket
(
int af,
int type,
int protocol
)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuXapi (0x%X): EmuThis::Emusocket\n"
"(\n"
" this : 0x%.08X\n"
" af : 0x%.08X\n"
" type : 0x%.08X\n"
" protocol : 0x%.08X\n"
");\n",
GetCurrentThreadId(), this, af, type, protocol);
}
#endif
SOCKET ret = socket(af, type, protocol);
EmuSwapFS(); // XBox FS
return ret;
}
// ******************************************************************
// * func: EmuThis::Emubind
// ******************************************************************
int XTL::EmuThis::Emubind(SOCKET s, const struct sockaddr FAR *name, int namelen)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuXapi (0x%X): EmuThis::Emubind\n"
"(\n"
" this : 0x%.08X\n"
" s : 0x%.08X\n"
" name : 0x%.08X\n"
" namelen : 0x%.08X\n"
");\n",
GetCurrentThreadId(), this, s, name, namelen);
}
#endif
// TODO: Host-To-Network order if necessary (probably not?)
int ret = bind(s, name, namelen);
EmuSwapFS(); // XBox FS
return ret;
}
// ******************************************************************
// * func: EmuThis::Emulisten
// ******************************************************************
int XTL::EmuThis::Emulisten(SOCKET s, int backlog)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuXapi (0x%X): EmuThis::Emulisten\n"
"(\n"
" this : 0x%.08X\n"
" s : 0x%.08X\n"
" listen : 0x%.08X\n"
");\n",
GetCurrentThreadId(), this, s, backlog);
}
#endif
// TODO: Host-To-Network order if necessary (probably not?)
int ret = listen(s, backlog);
EmuSwapFS(); // XBox FS
return ret;
}
// ******************************************************************
// * func: EmuThis::Emuioctlsocket
// ******************************************************************
int XTL::EmuThis::Emuioctlsocket(SOCKET s, long cmd, u_long FAR *argp)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuXapi (0x%X): EmuThis::Emuioctlsocket\n"
"(\n"
" this : 0x%.08X\n"
" s : 0x%.08X\n"
" cmd : 0x%.08X\n"
" argp : 0x%.08X\n"
");\n",
GetCurrentThreadId(), this, s, cmd, argp);
}
#endif
int ret = ioctlsocket(s, cmd, argp);
EmuSwapFS(); // XBox FS
return ret;
}

View File

@ -334,6 +334,36 @@ HANDLE WINAPI XTL::EmuXInputOpen
return ret;
}
// ******************************************************************
// * func: EmuXInputClose
// ******************************************************************
VOID WINAPI XTL::EmuXInputClose
(
IN HANDLE hDevice
)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuXapi (0x%X): EmuXInputClose\n"
"(\n"
" hDevice : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hDevice);
}
#endif
// TODO: Actually clean up the device when/if necessary
EmuSwapFS(); // XBox FS
return;
}
// ******************************************************************
// * func: EmuXInputGetCapabilities
// ******************************************************************

View File

@ -164,6 +164,9 @@ extern uint32 HLEDataBaseSize = sizeof(HLEDataBase);
extern uint32 XRefDataBase[] =
{
-1, // XREF_XNINIT
-1, // XREF_FCLOSEDEVICE
-1, // XREF_CLEARSTATEBLOCKFLAGS
-1, // XREF_RECORDSTATEBLOCK
};
// ******************************************************************

View File

@ -272,7 +272,7 @@ extern "C" CXBXKRNL_API uint32 KernelThunkTable[367] =
(uint32)PANIC(0x00CC), // 0x00CC (204)
(uint32)PANIC(0x00CD), // 0x00CD (205)
(uint32)PANIC(0x00CE), // 0x00CE (206)
(uint32)PANIC(0x00CF), // 0x00CF (207)
(uint32)&xboxkrnl::NtQueryDirectoryFile, // 0x00CF (207)
(uint32)PANIC(0x00D0), // 0x00D0 (208)
(uint32)PANIC(0x00D1), // 0x00D1 (209)
(uint32)&xboxkrnl::NtQueryFullAttributesFile, // 0x00D2 (210)

View File

@ -125,6 +125,130 @@ SOOVPA<10> XnInit_1_0_4361 =
}
};
// ******************************************************************
// * socket
// ******************************************************************
SOOVPA<9> socket_1_0_4361 =
{
0, // Large == 0
9, // Count == 9
-1, // XRef Not Saved
0, // XRef Not Used
{
// socket+0x10 : push 0x276D
{ 0x10, 0x68 }, // (Offset,Value)-Pair #1
{ 0x11, 0x6D }, // (Offset,Value)-Pair #2
{ 0x12, 0x27 }, // (Offset,Value)-Pair #3
// socket+0x52 : cmp eax, 0x11
{ 0x52, 0x83 }, // (Offset,Value)-Pair #4
{ 0x53, 0xF8 }, // (Offset,Value)-Pair #5
{ 0x54, 0x11 }, // (Offset,Value)-Pair #6
// socket+0xD9 : mov [esi+4], ecx
{ 0xD9, 0x89 }, // (Offset,Value)-Pair #7
{ 0xDA, 0x4E }, // (Offset,Value)-Pair #8
{ 0xDB, 0x04 }, // (Offset,Value)-Pair #9
}
};
// ******************************************************************
// * bind
// ******************************************************************
SOOVPA<10> bind_1_0_4361 =
{
0, // Large == 0
10, // Count == 10
-1, // XRef Not Saved
0, // XRef Not Used
{
// bind+0x11 : push 0x276D
{ 0x11, 0x68 }, // (Offset,Value)-Pair #1
{ 0x12, 0x6D }, // (Offset,Value)-Pair #2
{ 0x13, 0x27 }, // (Offset,Value)-Pair #3
// bind+0x4C : mov [eax], cx
{ 0x4C, 0x66 }, // (Offset,Value)-Pair #4
{ 0x4D, 0x89 }, // (Offset,Value)-Pair #5
{ 0x4E, 0x08 }, // (Offset,Value)-Pair #6
// bind+0x5B : xor eax, eax
{ 0x5B, 0x33 }, // (Offset,Value)-Pair #7
{ 0x5C, 0xC0 }, // (Offset,Value)-Pair #8
// bind+0x80 : retn 0x0C
{ 0x80, 0xC2 }, // (Offset,Value)-Pair #9
{ 0x81, 0x0C }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * listen
// ******************************************************************
SOOVPA<9> listen_1_0_4361 =
{
0, // Large == 0
9, // Count == 9
-1, // XRef Not Saved
0, // XRef Not Used
{
// listen+0x10 : push 0x276D
{ 0x10, 0x68 }, // (Offset,Value)-Pair #1
{ 0x11, 0x6D }, // (Offset,Value)-Pair #2
{ 0x12, 0x27 }, // (Offset,Value)-Pair #3
// listen+0x42 : test al, 0x10
{ 0x42, 0xA8 }, // (Offset,Value)-Pair #4
{ 0x43, 0x10 }, // (Offset,Value)-Pair #5
// listen+0x51 : mov ecx, edi
{ 0x51, 0x8B }, // (Offset,Value)-Pair #6
{ 0x52, 0xCF }, // (Offset,Value)-Pair #7
// listen+0x7F : retn 0x08
{ 0x7F, 0xC2 }, // (Offset,Value)-Pair #8
{ 0x80, 0x08 }, // (Offset,Value)-Pair #9
}
};
// ******************************************************************
// * ioctlsocket
// ******************************************************************
SOOVPA<10> ioctlsocket_1_0_4361 =
{
0, // Large == 0
10, // Count == 10
-1, // XRef Not Saved
0, // XRef Not Used
{
// ioctlsocket+0x12 : push 0x276D
{ 0x12, 0x68 }, // (Offset,Value)-Pair #1
{ 0x13, 0x6D }, // (Offset,Value)-Pair #2
{ 0x14, 0x27 }, // (Offset,Value)-Pair #3
// ioctlsocket+0x61 : lea edx, [esi+0x24]
{ 0x61, 0x8D }, // (Offset,Value)-Pair #4
{ 0x62, 0x56 }, // (Offset,Value)-Pair #5
{ 0x63, 0x24 }, // (Offset,Value)-Pair #6
// ioctlsocket+0x80 : mov cl, al
{ 0x80, 0x8A }, // (Offset,Value)-Pair #7
{ 0x81, 0xC8 }, // (Offset,Value)-Pair #8
// ioctlsocket+0xC5 : retn 0x0C
{ 0xC5, 0xC2 }, // (Offset,Value)-Pair #9
{ 0xC6, 0x0C }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * XOnline_1_0_4361
// ******************************************************************
@ -158,6 +282,46 @@ OOVPATable XOnline_1_0_4361[] =
"XnInit (XRef)"
#endif
},
// socket
{
(OOVPA*)&socket_1_0_4361,
MFPtoFP<XTL::EmuThis>(XTL::EmuThis::Emusocket),
#ifdef _DEBUG_TRACE
"Emusocket"
#endif
},
// bind
{
(OOVPA*)&bind_1_0_4361,
MFPtoFP<XTL::EmuThis>(XTL::EmuThis::Emubind),
#ifdef _DEBUG_TRACE
"Emubind"
#endif
},
// listen
{
(OOVPA*)&listen_1_0_4361,
MFPtoFP<XTL::EmuThis>(XTL::EmuThis::Emulisten),
#ifdef _DEBUG_TRACE
"Emulisten"
#endif
},
// ioctlsocket
{
(OOVPA*)&ioctlsocket_1_0_4361,
MFPtoFP<XTL::EmuThis>(XTL::EmuThis::Emuioctlsocket),
#ifdef _DEBUG_TRACE
"Emuioctlsocket"
#endif
},
};
// ******************************************************************

View File

@ -243,6 +243,69 @@ SOOVPA<12> XInputOpen_1_0_4361 =
}
};
// ******************************************************************
// * XID_fCloseDevice
// ******************************************************************
SOOVPA<11> XID_fCloseDevice_1_0_4361 =
{
0, // Large == 0
11, // Count == 11
XREF_FCLOSEDEVICE, // XRef Is Saved
0, // XRef Not Used
{
// XID_fCloseDevice+0x1B : mov eax, [esi+0x00A3]
{ 0x1B, 0x8B }, // (Offset,Value)-Pair #1
{ 0x1C, 0x86 }, // (Offset,Value)-Pair #2
{ 0x1D, 0xA3 }, // (Offset,Value)-Pair #3
// XID_fCloseDevice+0x91 : mov [esi+0x00A7], eax
{ 0x91, 0x89 }, // (Offset,Value)-Pair #4
{ 0x92, 0x86 }, // (Offset,Value)-Pair #5
{ 0x93, 0xA7 }, // (Offset,Value)-Pair #6
// XID_fCloseDevice+0x91 : mov [esi+0x00A7], eax
{ 0x91, 0x89 }, // (Offset,Value)-Pair #7
{ 0x92, 0x86 }, // (Offset,Value)-Pair #8
{ 0x93, 0xA7 }, // (Offset,Value)-Pair #9
// XID_fCloseDevice+0x91 : leave; retn
{ 0x9F, 0xC9 }, // (Offset,Value)-Pair #10
{ 0xA0, 0xC3 }, // (Offset,Value)-Pair #11
}
};
// ******************************************************************
// * XInputClose
// ******************************************************************
SOOVPA<8> XInputClose_1_0_4361 =
{
0, // Large == 0
8, // Count == 8
-1, // XRef Not Saved
1, // XRef Is Used
{
// XInputClose+0x05 : call [fCloseDevice]
{ 0x05, XREF_FCLOSEDEVICE }, // (Offset,Value)-Pair #1
// XInputClose+0x00 : mov ecx, [esp+0x04]
{ 0x00, 0x8B }, // (Offset,Value)-Pair #2
{ 0x01, 0x4C }, // (Offset,Value)-Pair #3
{ 0x02, 0x24 }, // (Offset,Value)-Pair #4
{ 0x03, 0x04 }, // (Offset,Value)-Pair #5
// XInputClose+0x04 : call [fCloseDevice]
{ 0x04, 0xE8 }, // (Offset,Value)-Pair #6
// XInputClose+0x09 : retn 0x04
{ 0x09, 0xC2 }, // (Offset,Value)-Pair #7
{ 0x0A, 0x04 }, // (Offset,Value)-Pair #8
}
};
// ******************************************************************
// * XInputGetCapabilities
// ******************************************************************
@ -584,6 +647,24 @@ OOVPATable XAPI_1_0_4361[] =
"EmuXInputOpen"
#endif
},
// XID_fCloseDevice
{
(OOVPA*)&XID_fCloseDevice_1_0_4361, 0,
#ifdef _DEBUG_TRACE
"XID_fCloseDevice (XREF)"
#endif
},
// XInputClose
{
(OOVPA*)&XInputClose_1_0_4361,
XTL::EmuXInputClose,
#ifdef _DEBUG_TRACE
"EmuXInputClose"
#endif
},
// XInputGetCapabilities
{
(OOVPA*)&XInputGetCapabilities_1_0_4361,