Textures...
This commit is contained in:
parent
9794c28f71
commit
46f49468ef
|
@ -234,6 +234,10 @@ SOURCE=.\Include\Win32\XBController.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Include\Core\Xbe.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\Include\Win32\XBVideo.h
|
SOURCE=.\Include\Win32\XBVideo.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -286,6 +290,10 @@ SOURCE=.\Source\Win32\CxbxKrnl\EmuD3D8.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Source\Win32\CxbxKrnl\EmuD3D8Conv.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\Source\Win32\CxbxKrnl\EmuDInput.cpp
|
SOURCE=.\Source\Win32\CxbxKrnl\EmuDInput.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
cxbx website: http://www.caustik.com/xbox/
|
cxbx website: http://www.caustik.com/xbox/
|
||||||
|
|
||||||
|
version: 0.7.2 (??/??/03)
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
- Textures
|
||||||
|
|
||||||
version: 0.7.1 (05/30/03)
|
version: 0.7.1 (05/30/03)
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ typedef signed long sint32;
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * Version information
|
// * Version information
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
#define _CXBX_VERSION "0.7.1"
|
#define _CXBX_VERSION "0.7.2-pre1"
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * Define this to trace intercepted function calls
|
// * Define this to trace intercepted function calls
|
||||||
|
|
|
@ -44,20 +44,51 @@
|
||||||
class Wnd : public Error
|
class Wnd : public Error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// ******************************************************************
|
||||||
|
// * Constructor
|
||||||
|
// ******************************************************************
|
||||||
Wnd(HINSTANCE x_hInstance);
|
Wnd(HINSTANCE x_hInstance);
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Deconstructor
|
||||||
|
// ******************************************************************
|
||||||
~Wnd();
|
~Wnd();
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Process Window Messages
|
||||||
|
// ******************************************************************
|
||||||
bool ProcessMessages();
|
bool ProcessMessages();
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Forward WndProc to thiscall member function
|
||||||
|
// ******************************************************************
|
||||||
static LRESULT CALLBACK WndProcForward(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK WndProcForward(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Window Message Handling Procedure
|
||||||
|
// ******************************************************************
|
||||||
virtual LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
virtual LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
HWND GetHwnd() { return m_hwnd; }
|
// ******************************************************************
|
||||||
|
// * Retrieve this window's handle
|
||||||
|
// ******************************************************************
|
||||||
|
HWND GetHwnd() { return m_hwnd; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// ******************************************************************
|
||||||
|
// * Module's Instance Handle
|
||||||
|
// ******************************************************************
|
||||||
HINSTANCE m_hInstance;
|
HINSTANCE m_hInstance;
|
||||||
ATOM m_class;
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Module's Window Handle
|
||||||
|
// ******************************************************************
|
||||||
HWND m_hwnd;
|
HWND m_hwnd;
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Etc
|
||||||
|
// ******************************************************************
|
||||||
|
ATOM m_class;
|
||||||
const char *m_classname;
|
const char *m_classname;
|
||||||
const char *m_wndname;
|
const char *m_wndname;
|
||||||
UINT m_clsstyle;
|
UINT m_clsstyle;
|
||||||
|
|
|
@ -42,12 +42,25 @@
|
||||||
class WndAbout : public Wnd
|
class WndAbout : public Wnd
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// ******************************************************************
|
||||||
|
// * Constructor
|
||||||
|
// ******************************************************************
|
||||||
WndAbout(HINSTANCE x_hInstance, HWND x_parent);
|
WndAbout(HINSTANCE x_hInstance, HWND x_parent);
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Deconstructor
|
||||||
|
// ******************************************************************
|
||||||
~WndAbout();
|
~WndAbout();
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Window Message Handling Procedure
|
||||||
|
// ******************************************************************
|
||||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// ******************************************************************
|
||||||
|
// * Drawing Data
|
||||||
|
// ******************************************************************
|
||||||
HDC m_BackDC;
|
HDC m_BackDC;
|
||||||
HBITMAP m_OrigBmp;
|
HBITMAP m_OrigBmp;
|
||||||
HBITMAP m_BackBmp;
|
HBITMAP m_BackBmp;
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#undef FIELD_OFFSET // prevent macro redefinition warnings
|
#undef FIELD_OFFSET // prevent macro redefinition warnings
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#define DIRECT3D_VERSION 0x0800
|
#define DIRECT3D_VERSION 0x0800
|
||||||
#include <d3d8.h>
|
#include <d3d8.h>
|
||||||
#include <d3d8types.h>
|
#include <d3d8types.h>
|
||||||
|
|
|
@ -113,7 +113,15 @@ typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * pfRtlCreateHeap
|
// * pfRtlCreateHeap
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
typedef PVOID (WINAPI *pfRtlCreateHeap)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
|
typedef PVOID (WINAPI *pfRtlCreateHeap)
|
||||||
|
(
|
||||||
|
IN ULONG Flags,
|
||||||
|
IN PVOID Base OPTIONAL,
|
||||||
|
IN ULONG Reserve OPTIONAL,
|
||||||
|
IN ULONG Commit,
|
||||||
|
IN BOOLEAN Lock OPTIONAL,
|
||||||
|
IN PVOID RtlHeapParams OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * XINPUT_POLLING_PARAMETERS
|
// * XINPUT_POLLING_PARAMETERS
|
||||||
|
|
|
@ -81,15 +81,6 @@ template <uint16 COUNT> struct SOOVPA
|
||||||
Sovp[COUNT];
|
Sovp[COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
// ******************************************************************
|
|
||||||
// * DummyClass
|
|
||||||
// ******************************************************************
|
|
||||||
class DummyClass
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef (DummyClass::*DummyClassPtr)();
|
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * OOVPATable
|
// * OOVPATable
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
|
|
@ -37,12 +37,48 @@
|
||||||
#include <d3d8.h>
|
#include <d3d8.h>
|
||||||
#include <d3dx8tex.h>
|
#include <d3dx8tex.h>
|
||||||
|
|
||||||
|
#include "Emu.h"
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * X_D3DFORMAT
|
// * X_D3DFORMAT
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// NOTE: HACK: These enumerations are not equivalent!
|
// NOTE: HACK: These enumerations are not equivalent!
|
||||||
typedef D3DFORMAT X_D3DFORMAT;
|
typedef D3DFORMAT X_D3DFORMAT;
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * func: EmuXB2PC_D3DFormat
|
||||||
|
// ******************************************************************
|
||||||
|
inline D3DFORMAT EmuXB2PC_D3DFormat(X_D3DFORMAT Format)
|
||||||
|
{
|
||||||
|
if(Format == 0x07)
|
||||||
|
return D3DFMT_X8R8G8B8;
|
||||||
|
else if(Format == 0x06)
|
||||||
|
return D3DFMT_A8R8G8B8;
|
||||||
|
else if(Format == 0x2A)
|
||||||
|
return D3DFMT_D24S8;
|
||||||
|
else if(Format == 0x2C)
|
||||||
|
return D3DFMT_D16;
|
||||||
|
|
||||||
|
EmuCleanup("EmuXB2PC_D3DFormat: Unknown Format");
|
||||||
|
|
||||||
|
return Format;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * func: EmuPC2XB_D3DFormat
|
||||||
|
// ******************************************************************
|
||||||
|
inline X_D3DFORMAT EmuPC2XB_D3DFormat(D3DFORMAT Format)
|
||||||
|
{
|
||||||
|
if(Format == D3DFMT_X8R8G8B8)
|
||||||
|
return (D3DFORMAT)0x07;
|
||||||
|
else if(Format == D3DFMT_A8R8G8B8)
|
||||||
|
return (D3DFORMAT)0x06;
|
||||||
|
|
||||||
|
EmuCleanup("EmuPC2XB_D3DFormat: Unknown Format");
|
||||||
|
|
||||||
|
return Format;
|
||||||
|
}
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * X_D3DRESOURCETYPE
|
// * X_D3DRESOURCETYPE
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
@ -203,6 +239,17 @@ HRESULT WINAPI EmuIDirect3DSurface8_GetDesc
|
||||||
X_D3DSURFACE_DESC *pDesc
|
X_D3DSURFACE_DESC *pDesc
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * func: EmuIDirect3DSurface8_LockRect
|
||||||
|
// ******************************************************************
|
||||||
|
HRESULT WINAPI EmuIDirect3DSurface8_LockRect
|
||||||
|
(
|
||||||
|
PVOID pThis,
|
||||||
|
D3DLOCKED_RECT *pLockedRect,
|
||||||
|
CONST RECT *pRect,
|
||||||
|
DWORD Flags
|
||||||
|
);
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * func: EmuIDirect3DTexture8_GetSurfaceLevel
|
// * func: EmuIDirect3DTexture8_GetSurfaceLevel
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
|
|
@ -71,7 +71,7 @@ class XBVideo : public Error
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * SetVideoResolution
|
// * SetVideoResolution
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
void SetVideoResolution(const char *szBuffer) { strcpy(m_szVideoResolution, szBuffer); }
|
void SetVideoResolution(const char *szBuffer) { strcpy(m_szVideoResolution, szBuffer); }
|
||||||
const char *GetVideoResolution(){ return m_szVideoResolution; }
|
const char *GetVideoResolution(){ return m_szVideoResolution; }
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
|
|
@ -255,7 +255,7 @@ END
|
||||||
IDD_VIDEO_CFG DIALOGEX 0, 0, 258, 110
|
IDD_VIDEO_CFG DIALOGEX 0, 0, 258, 110
|
||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
CAPTION "Cxbx : Video Configuration"
|
CAPTION "Cxbx : Video Configuration"
|
||||||
FONT 8, "Verdana", 0, 0, 0x1
|
FONT 8, "Verdana"
|
||||||
BEGIN
|
BEGIN
|
||||||
CONTROL "Start in Fullscreen",IDC_CV_FULLSCREEN,"Button",
|
CONTROL "Start in Fullscreen",IDC_CV_FULLSCREEN,"Button",
|
||||||
BS_AUTOCHECKBOX | WS_TABSTOP,76,71,73,10
|
BS_AUTOCHECKBOX | WS_TABSTOP,76,71,73,10
|
||||||
|
@ -266,7 +266,7 @@ BEGIN
|
||||||
PUSHBUTTON "Cancel",IDC_VC_CANCEL,146,92,50,14,BS_FLAT
|
PUSHBUTTON "Cancel",IDC_VC_CANCEL,146,92,50,14,BS_FLAT
|
||||||
PUSHBUTTON "Accept",IDC_VC_ACCEPT,203,92,50,14,BS_FLAT
|
PUSHBUTTON "Accept",IDC_VC_ACCEPT,203,92,50,14,BS_FLAT
|
||||||
LTEXT "Other Options:",IDC_STATIC,21,71,49,8,0,WS_EX_RIGHT
|
LTEXT "Other Options:",IDC_STATIC,21,71,49,8,0,WS_EX_RIGHT
|
||||||
CONTROL "Sync to Refresh",IDC_CV_VSYNC,"Button",BS_AUTOCHECKBOX |
|
CONTROL "Force VSync",IDC_CV_VSYNC,"Button",BS_AUTOCHECKBOX |
|
||||||
WS_TABSTOP,154,71,65,10
|
WS_TABSTOP,154,71,65,10
|
||||||
COMBOBOX IDC_VC_DISPLAY_ADAPTER,76,12,173,71,CBS_DROPDOWNLIST |
|
COMBOBOX IDC_VC_DISPLAY_ADAPTER,76,12,173,71,CBS_DROPDOWNLIST |
|
||||||
WS_VSCROLL | WS_TABSTOP
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
|
@ -357,6 +357,51 @@ SOOVPA<15> IDirect3DSurface8_GetDesc_1_0_4361 =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * IDirect3DSurface8_LockRect
|
||||||
|
// ******************************************************************
|
||||||
|
SOOVPA<16> IDirect3DSurface8_LockRect_1_0_4361 =
|
||||||
|
{
|
||||||
|
0, // Large == 0
|
||||||
|
16, // Count == 16
|
||||||
|
|
||||||
|
{
|
||||||
|
// IDirect3DSurface8_LockRect+0x00 : mov eax, [esp+0x10]
|
||||||
|
{ 0x00, 0x8B }, // (Offset,Value)-Pair #1
|
||||||
|
{ 0x01, 0x44 }, // (Offset,Value)-Pair #2
|
||||||
|
{ 0x02, 0x24 }, // (Offset,Value)-Pair #3
|
||||||
|
{ 0x03, 0x10 }, // (Offset,Value)-Pair #4
|
||||||
|
|
||||||
|
// IDirect3DSurface8_LockRect+0x04 : mov ecx, [esp+0x0C]
|
||||||
|
{ 0x04, 0x8B }, // (Offset,Value)-Pair #5
|
||||||
|
{ 0x05, 0x4C }, // (Offset,Value)-Pair #6
|
||||||
|
{ 0x06, 0x24 }, // (Offset,Value)-Pair #7
|
||||||
|
{ 0x07, 0x0C }, // (Offset,Value)-Pair #8
|
||||||
|
|
||||||
|
// IDirect3DSurface8_LockRect+0x0C : push eax
|
||||||
|
{ 0x0C, 0x50 }, // (Offset,Value)-Pair #9
|
||||||
|
|
||||||
|
// IDirect3DSurface8_LockRect+0x11 : push ecx
|
||||||
|
{ 0x11, 0x51 }, // (Offset,Value)-Pair #10
|
||||||
|
|
||||||
|
// IDirect3DSurface8_LockRect+0x12 : push edx
|
||||||
|
{ 0x12, 0x52 }, // (Offset,Value)-Pair #11
|
||||||
|
|
||||||
|
// IDirect3DSurface8_LockRect+0x13 : push 0
|
||||||
|
{ 0x13, 0x6A }, // (Offset,Value)-Pair #12
|
||||||
|
|
||||||
|
// IDirect3DSurface8_LockRect+0x15 : push 0
|
||||||
|
{ 0x15, 0x6A }, // (Offset,Value)-Pair #13
|
||||||
|
|
||||||
|
// IDirect3DSurface8_LockRect+0x18 : call [abs]
|
||||||
|
{ 0x18, 0xE8 }, // (Offset,Value)-Pair #14
|
||||||
|
|
||||||
|
// IDirect3DSurface8_LockRect+0x11 : retn 0x08
|
||||||
|
{ 0x1D, 0xC2 }, // (Offset,Value)-Pair #15
|
||||||
|
{ 0x1E, 0x10 }, // (Offset,Value)-Pair #16
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * IDirect3DTexture8_GetSurfaceLevel
|
// * IDirect3DTexture8_GetSurfaceLevel
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
@ -685,6 +730,16 @@ OOVPATable D3D8_1_0_4361[] =
|
||||||
"EmuIDirect3DSurface8_GetDesc"
|
"EmuIDirect3DSurface8_GetDesc"
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
|
// IDirect3DSurface8::LockRect
|
||||||
|
{
|
||||||
|
(OOVPA*)&IDirect3DSurface8_LockRect_1_0_4361,
|
||||||
|
|
||||||
|
xd3d8::EmuIDirect3DSurface8_LockRect,
|
||||||
|
|
||||||
|
#ifdef _DEBUG_TRACE
|
||||||
|
"EmuIDirect3DSurface8_LockRect"
|
||||||
|
#endif
|
||||||
|
},
|
||||||
// IDirect3DTexture8::GetSurfaceLevel
|
// IDirect3DTexture8::GetSurfaceLevel
|
||||||
{
|
{
|
||||||
(OOVPA*)&IDirect3DTexture8_GetSurfaceLevel_1_0_4361,
|
(OOVPA*)&IDirect3DTexture8_GetSurfaceLevel_1_0_4361,
|
||||||
|
|
|
@ -403,6 +403,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit
|
||||||
{
|
{
|
||||||
EmuSwapFS(); // XBox FS
|
EmuSwapFS(); // XBox FS
|
||||||
|
|
||||||
|
__asm int 3
|
||||||
Entry();
|
Entry();
|
||||||
|
|
||||||
EmuSwapFS(); // Win2k/XP FS
|
EmuSwapFS(); // Win2k/XP FS
|
||||||
|
|
|
@ -57,6 +57,7 @@ namespace xd3d8
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "EmuD3D8.h"
|
#include "EmuD3D8.h"
|
||||||
|
|
||||||
#include "ResCxbxDll.h"
|
#include "ResCxbxDll.h"
|
||||||
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
@ -65,7 +66,7 @@ namespace xd3d8
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * Global(s)
|
// * Global(s)
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
HWND g_hEmuWindow = NULL; // Rendering Window
|
HWND g_hEmuWindow = NULL; // Rendering Window
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * Static Function(s)
|
// * Static Function(s)
|
||||||
|
@ -86,48 +87,11 @@ static HBRUSH g_hBgBrush = NULL; // Background Brush
|
||||||
static volatile bool g_ThreadInitialized = false;
|
static volatile bool g_ThreadInitialized = false;
|
||||||
static XBVideo g_XBVideo;
|
static XBVideo g_XBVideo;
|
||||||
|
|
||||||
// ******************************************************************
|
|
||||||
// * D3DVertexToPrimitive
|
|
||||||
// ******************************************************************
|
|
||||||
UINT xd3d8::D3DVertexToPrimitive[11][2] =
|
|
||||||
{
|
|
||||||
{0, 0},
|
|
||||||
{1, 0},
|
|
||||||
{2, 0},
|
|
||||||
{1, 1},
|
|
||||||
{1, 1},
|
|
||||||
{3, 0},
|
|
||||||
{1, 2},
|
|
||||||
{1, 2},
|
|
||||||
{4, 0},
|
|
||||||
{2, 2},
|
|
||||||
{0, 0},
|
|
||||||
};
|
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * EmuD3DDefferedRenderState
|
// * EmuD3DDefferedRenderState
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
DWORD *xd3d8::EmuD3DDefferedRenderState;
|
DWORD *xd3d8::EmuD3DDefferedRenderState;
|
||||||
|
|
||||||
// ******************************************************************
|
|
||||||
// * EmuPrimitiveType
|
|
||||||
// ******************************************************************
|
|
||||||
xd3d8::D3DPRIMITIVETYPE xd3d8::EmuPrimitiveTypeLookup[] =
|
|
||||||
{
|
|
||||||
/* NULL = 0 */ (xd3d8::D3DPRIMITIVETYPE)0,
|
|
||||||
/* D3DPT_POINTLIST = 1, */ xd3d8::D3DPT_POINTLIST,
|
|
||||||
/* D3DPT_LINELIST = 2, */ xd3d8::D3DPT_LINELIST,
|
|
||||||
/* D3DPT_LINELOOP = 3, Xbox */ xd3d8::D3DPT_LINELIST,
|
|
||||||
/* D3DPT_LINESTRIP = 4, */ xd3d8::D3DPT_LINESTRIP,
|
|
||||||
/* D3DPT_TRIANGLELIST = 5, */ xd3d8::D3DPT_TRIANGLELIST,
|
|
||||||
/* D3DPT_TRIANGLESTRIP = 6, */ xd3d8::D3DPT_TRIANGLESTRIP,
|
|
||||||
/* D3DPT_TRIANGLEFAN = 7, */ xd3d8::D3DPT_TRIANGLEFAN,
|
|
||||||
/* D3DPT_QUADLIST = 8, Xbox */ xd3d8::D3DPT_TRIANGLELIST,
|
|
||||||
/* D3DPT_QUADSTRIP = 9, Xbox */ xd3d8::D3DPT_TRIANGLELIST,
|
|
||||||
/* D3DPT_POLYGON = 10, Xbox */ xd3d8::D3DPT_TRIANGLELIST,
|
|
||||||
/* D3DPT_MAX = 11, */ (xd3d8::D3DPRIMITIVETYPE)11
|
|
||||||
};
|
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * func: EmuD3DInit
|
// * func: EmuD3DInit
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
@ -417,34 +381,18 @@ HRESULT WINAPI xd3d8::EmuIDirect3D8_CreateDevice
|
||||||
|
|
||||||
hFocusWindow = g_hEmuWindow;
|
hFocusWindow = g_hEmuWindow;
|
||||||
|
|
||||||
// ******************************************************************
|
pPresentationParameters->BackBufferFormat = EmuXB2PC_D3DFormat(pPresentationParameters->BackBufferFormat);
|
||||||
// * TODO: Use lookup table if it becomes necessary
|
pPresentationParameters->AutoDepthStencilFormat = EmuXB2PC_D3DFormat(pPresentationParameters->AutoDepthStencilFormat);
|
||||||
// ******************************************************************
|
|
||||||
{
|
|
||||||
if(pPresentationParameters->BackBufferFormat == 0x07)
|
|
||||||
pPresentationParameters->BackBufferFormat = D3DFMT_X8R8G8B8;
|
|
||||||
else if(pPresentationParameters->BackBufferFormat == 0x06)
|
|
||||||
pPresentationParameters->BackBufferFormat = D3DFMT_A8R8G8B8;
|
|
||||||
else
|
|
||||||
EmuCleanup("EmuIDirect3D8_CreateDevice: Unknown BackBufferFormat");
|
|
||||||
|
|
||||||
if(pPresentationParameters->AutoDepthStencilFormat == 0x2A)
|
|
||||||
pPresentationParameters->AutoDepthStencilFormat = D3DFMT_D24S8;
|
|
||||||
else if(pPresentationParameters->AutoDepthStencilFormat == 0x2C)
|
|
||||||
pPresentationParameters->AutoDepthStencilFormat = D3DFMT_D16;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * Retrieve Resolution from Configuration
|
// * Retrieve Resolution from Configuration
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
if(pPresentationParameters->Windowed)
|
if(pPresentationParameters->Windowed)
|
||||||
{
|
{
|
||||||
sscanf(g_XBVideo.GetVideoResolution(), "%d x %d",
|
|
||||||
&pPresentationParameters->BackBufferWidth,
|
|
||||||
&pPresentationParameters->BackBufferHeight);
|
|
||||||
|
|
||||||
D3DDISPLAYMODE D3DDisplayMode;
|
D3DDISPLAYMODE D3DDisplayMode;
|
||||||
|
|
||||||
|
sscanf(g_XBVideo.GetVideoResolution(), "%d x %d", &pPresentationParameters->BackBufferWidth, &pPresentationParameters->BackBufferHeight);
|
||||||
|
|
||||||
g_pD3D8->GetAdapterDisplayMode(g_XBVideo.GetDisplayAdapter(), &D3DDisplayMode);
|
g_pD3D8->GetAdapterDisplayMode(g_XBVideo.GetDisplayAdapter(), &D3DDisplayMode);
|
||||||
|
|
||||||
pPresentationParameters->BackBufferFormat = D3DDisplayMode.Format;
|
pPresentationParameters->BackBufferFormat = D3DDisplayMode.Format;
|
||||||
|
@ -551,17 +499,8 @@ HRESULT WINAPI xd3d8::EmuIDirect3DDevice8_CreateTexture
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ******************************************************************
|
// Convert Format (Xbox->PC)
|
||||||
// * make adjustments to parameters to make sense with windows d3d
|
Format = EmuXB2PC_D3DFormat(Format);
|
||||||
// ******************************************************************
|
|
||||||
{
|
|
||||||
if(Format == 0x07)
|
|
||||||
Format = D3DFMT_X8R8G8B8;
|
|
||||||
else if(Format == 0x06)
|
|
||||||
Format = D3DFMT_A8R8G8B8;
|
|
||||||
else
|
|
||||||
EmuCleanup("EmuIDirect3DDevice8_CreateTexture: Unknown Format");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * redirect to windows d3d
|
// * redirect to windows d3d
|
||||||
|
@ -611,15 +550,11 @@ HRESULT WINAPI xd3d8::EmuIDirect3DDevice8_GetDisplayMode
|
||||||
|
|
||||||
hRet = g_pD3D8Device->GetDisplayMode(pPCMode);
|
hRet = g_pD3D8Device->GetDisplayMode(pPCMode);
|
||||||
|
|
||||||
if(pPCMode->Format == D3DFMT_X8R8G8B8)
|
// Convert Format (PC->Xbox)
|
||||||
pMode->Format = (xd3d8::D3DFORMAT)0x07;
|
pMode->Format = EmuPC2XB_D3DFormat(pPCMode->Format);
|
||||||
else if(pPCMode->Format == D3DFMT_A8R8G8B8)
|
|
||||||
pMode->Format = (xd3d8::D3DFORMAT)0x06;
|
|
||||||
else
|
|
||||||
EmuCleanup("EmuIDirect3DDevice8_GetDisplayMode: Unknown Format");
|
|
||||||
|
|
||||||
// TODO: Make this configurable in the future?
|
// TODO: Make this configurable in the future?
|
||||||
pMode->Flags = 0x000000A1;
|
pMode->Flags = 0x000000A1; // D3DPRESENTFLAG_FIELD | D3DPRESENTFLAG_INTERLACED | D3DPRESENTFLAG_LOCKABLE_BACKBUFFER
|
||||||
}
|
}
|
||||||
|
|
||||||
EmuSwapFS(); // XBox FS
|
EmuSwapFS(); // XBox FS
|
||||||
|
@ -666,8 +601,6 @@ HRESULT WINAPI xd3d8::EmuIDirect3DDevice8_Clear
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
{
|
{
|
||||||
// TODO: D3DCLEAR_TARGET_A, *R, *G, *B don't exist on windows
|
// TODO: D3DCLEAR_TARGET_A, *R, *G, *B don't exist on windows
|
||||||
// TODO: Use lookup table that is dependant on library version
|
|
||||||
// Tricky MS randomizing .h #defines :[
|
|
||||||
DWORD newFlags = 0;
|
DWORD newFlags = 0;
|
||||||
|
|
||||||
if(Flags & 0x000000f0l)
|
if(Flags & 0x000000f0l)
|
||||||
|
@ -793,18 +726,14 @@ HRESULT WINAPI xd3d8::EmuIDirect3DSurface8_GetDesc
|
||||||
{
|
{
|
||||||
D3DSURFACE_DESC *pPCDesc = (D3DSURFACE_DESC*)pDesc;
|
D3DSURFACE_DESC *pPCDesc = (D3DSURFACE_DESC*)pDesc;
|
||||||
|
|
||||||
if(pDesc->Format == D3DFMT_X8R8G8B8)
|
// Convert Format (PC->Xbox)
|
||||||
pDesc->Format = (xd3d8::D3DFORMAT)0x07;
|
pDesc->Format = EmuPC2XB_D3DFormat(pPCDesc->Format);
|
||||||
else if(pDesc->Format == D3DFMT_A8R8G8B8)
|
|
||||||
pDesc->Format = (xd3d8::D3DFORMAT)0x06;
|
|
||||||
else
|
|
||||||
EmuCleanup("EmuIDirect3DSurface8_GetDesc Unknown Format");
|
|
||||||
|
|
||||||
pDesc->Format = pPCDesc->Format;
|
|
||||||
|
|
||||||
// TODO: Handle Type > 7 !? How !?
|
|
||||||
pDesc->Type = pPCDesc->Type;
|
pDesc->Type = pPCDesc->Type;
|
||||||
|
|
||||||
|
if(pDesc->Type > 7)
|
||||||
|
EmuCleanup("EmuIDirect3DSurface8_GetDesc: pDesc->Type > 7");
|
||||||
|
|
||||||
pDesc->Usage = pPCDesc->Usage;
|
pDesc->Usage = pPCDesc->Usage;
|
||||||
pDesc->Size = pPCDesc->Size;
|
pDesc->Size = pPCDesc->Size;
|
||||||
|
|
||||||
|
@ -823,6 +752,50 @@ HRESULT WINAPI xd3d8::EmuIDirect3DSurface8_GetDesc
|
||||||
return hRet;
|
return hRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * func: EmuIDirect3DSurface8_LockRect
|
||||||
|
// ******************************************************************
|
||||||
|
HRESULT WINAPI xd3d8::EmuIDirect3DSurface8_LockRect
|
||||||
|
(
|
||||||
|
PVOID pThis,
|
||||||
|
D3DLOCKED_RECT *pLockedRect,
|
||||||
|
CONST RECT *pRect,
|
||||||
|
DWORD Flags
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EmuSwapFS(); // Win2k/XP FS
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * debug trace
|
||||||
|
// ******************************************************************
|
||||||
|
#ifdef _DEBUG_TRACE
|
||||||
|
{
|
||||||
|
printf("EmuD3D8 (0x%X): EmuIDirect3DSurface8_LockRect\n"
|
||||||
|
"(\n"
|
||||||
|
" pThis : 0x%.08X\n"
|
||||||
|
" pLockedRect : 0x%.08X\n"
|
||||||
|
" pRect : 0x%.08X\n"
|
||||||
|
" Flags : 0x%.08X\n"
|
||||||
|
");\n",
|
||||||
|
GetCurrentThreadId(), pThis, pLockedRect, pRect, Flags);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(Flags == 0x40)
|
||||||
|
{
|
||||||
|
printf("EmuIDirect3DSurface8_LockRect: WARNING, TILE LOCK!\n");
|
||||||
|
Flags = 0;
|
||||||
|
}
|
||||||
|
else if(Flags != 0)
|
||||||
|
EmuCleanup("EmuIDirect3DSurface8_LockRect: Unknown Flags!");
|
||||||
|
|
||||||
|
HRESULT hRet = ((IDirect3DSurface8*)pThis)->LockRect(pLockedRect, pRect, Flags);
|
||||||
|
|
||||||
|
EmuSwapFS(); // XBox FS
|
||||||
|
|
||||||
|
return hRet;
|
||||||
|
}
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * func: EmuIDirect3DTexture8_GetSurfaceLevel
|
// * func: EmuIDirect3DTexture8_GetSurfaceLevel
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
@ -940,7 +913,6 @@ VOID WINAPI xd3d8::EmuIDirect3DDevice8_SetRenderState_CullMode
|
||||||
// * Convert from Xbox D3D to PC D3D enumeration
|
// * Convert from Xbox D3D to PC D3D enumeration
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// TODO: XDK-Specific Tables? So far they are the same
|
// TODO: XDK-Specific Tables? So far they are the same
|
||||||
|
|
||||||
switch(Value)
|
switch(Value)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -952,6 +924,8 @@ VOID WINAPI xd3d8::EmuIDirect3DDevice8_SetRenderState_CullMode
|
||||||
case 0x901:
|
case 0x901:
|
||||||
Value = D3DCULL_CCW;
|
Value = D3DCULL_CCW;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
EmuCleanup("EmuIDirect3DDevice8_SetRenderState_CullMode: Unknown Cullmode");
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pD3D8Device->SetRenderState(D3DRS_CULLMODE, Value);
|
g_pD3D8Device->SetRenderState(D3DRS_CULLMODE, Value);
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
// ******************************************************************
|
||||||
|
// *
|
||||||
|
// * .,-::::: .,:: .::::::::. .,:: .:
|
||||||
|
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
|
||||||
|
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
|
||||||
|
// * $$$ Y$$$P $$""""Y$$ Y$$$P
|
||||||
|
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
||||||
|
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
||||||
|
// *
|
||||||
|
// * Cxbx->Win32->CxbxKrnl->EmuD3D8Conv.cpp
|
||||||
|
// *
|
||||||
|
// * This file is part of the Cxbx project.
|
||||||
|
// *
|
||||||
|
// * Cxbx and Cxbe are free software; you can redistribute them
|
||||||
|
// * and/or modify them under the terms of the GNU General Public
|
||||||
|
// * License as published by the Free Software Foundation; either
|
||||||
|
// * version 2 of the license, or (at your option) any later version.
|
||||||
|
// *
|
||||||
|
// * This program is distributed in the hope that it will be useful,
|
||||||
|
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// * GNU General Public License for more details.
|
||||||
|
// *
|
||||||
|
// * You should have recieved a copy of the GNU General Public License
|
||||||
|
// * along with this program; see the file COPYING.
|
||||||
|
// * If not, write to the Free Software Foundation, Inc.,
|
||||||
|
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
|
||||||
|
// *
|
||||||
|
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
|
||||||
|
// *
|
||||||
|
// * All rights reserved
|
||||||
|
// *
|
||||||
|
// ******************************************************************
|
||||||
|
#define _CXBXKRNL_INTERNAL
|
||||||
|
#define _XBOXKRNL_LOCAL_
|
||||||
|
|
||||||
|
#include "Emu.h"
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * prevent name collisions
|
||||||
|
// ******************************************************************
|
||||||
|
namespace xd3d8
|
||||||
|
{
|
||||||
|
#include "xd3d8.h"
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "EmuD3D8.h"
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * D3DVertexToPrimitive
|
||||||
|
// ******************************************************************
|
||||||
|
UINT xd3d8::D3DVertexToPrimitive[11][2] =
|
||||||
|
{
|
||||||
|
{0, 0},
|
||||||
|
{1, 0},
|
||||||
|
{2, 0},
|
||||||
|
{1, 1},
|
||||||
|
{1, 1},
|
||||||
|
{3, 0},
|
||||||
|
{1, 2},
|
||||||
|
{1, 2},
|
||||||
|
{4, 0},
|
||||||
|
{2, 2},
|
||||||
|
{0, 0},
|
||||||
|
};
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * EmuPrimitiveType
|
||||||
|
// ******************************************************************
|
||||||
|
xd3d8::D3DPRIMITIVETYPE xd3d8::EmuPrimitiveTypeLookup[] =
|
||||||
|
{
|
||||||
|
/* NULL = 0 */ (xd3d8::D3DPRIMITIVETYPE)0,
|
||||||
|
/* D3DPT_POINTLIST = 1, */ xd3d8::D3DPT_POINTLIST,
|
||||||
|
/* D3DPT_LINELIST = 2, */ xd3d8::D3DPT_LINELIST,
|
||||||
|
/* D3DPT_LINELOOP = 3, Xbox */ xd3d8::D3DPT_LINELIST,
|
||||||
|
/* D3DPT_LINESTRIP = 4, */ xd3d8::D3DPT_LINESTRIP,
|
||||||
|
/* D3DPT_TRIANGLELIST = 5, */ xd3d8::D3DPT_TRIANGLELIST,
|
||||||
|
/* D3DPT_TRIANGLESTRIP = 6, */ xd3d8::D3DPT_TRIANGLESTRIP,
|
||||||
|
/* D3DPT_TRIANGLEFAN = 7, */ xd3d8::D3DPT_TRIANGLEFAN,
|
||||||
|
/* D3DPT_QUADLIST = 8, Xbox */ xd3d8::D3DPT_TRIANGLELIST,
|
||||||
|
/* D3DPT_QUADSTRIP = 9, Xbox */ xd3d8::D3DPT_TRIANGLELIST,
|
||||||
|
/* D3DPT_POLYGON = 10, Xbox */ xd3d8::D3DPT_TRIANGLELIST,
|
||||||
|
/* D3DPT_MAX = 11, */ (xd3d8::D3DPRIMITIVETYPE)11
|
||||||
|
};
|
Loading…
Reference in New Issue