This commit is contained in:
Aaron Robinson 2003-05-30 02:08:25 +00:00
parent f8eb82e0ca
commit 8e16163c66
15 changed files with 311 additions and 68 deletions

View File

@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="Cxbx" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 60000
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
@ -25,7 +25,7 @@ CFG=Cxbx - Win32 Release
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
CPP=xicl6.exe
MTL=midl.exe
RSC=rc.exe
@ -52,7 +52,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
LINK32=xilink6.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 /subsystem:windows /machine:I386
# ADD LINK32 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 /subsystem:windows /pdb:none /map /machine:I386
# SUBTRACT LINK32 /debug
@ -83,9 +83,9 @@ PostBuild_Cmds=cd PostBuild upxCxbx.bat
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
LINK32=xilink6.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 /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 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 /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 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 /subsystem:windows /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
@ -155,10 +155,18 @@ SOURCE=.\Include\Win32\Cxbx\DlgControllerConfig.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\Cxbx\DlgVideoConfig.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\Emu.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\EmuDInput.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\Cxbx\EmuExe.h
# End Source File
# Begin Source File
@ -239,6 +247,10 @@ SOURCE=.\Source\Win32\Cxbx\DlgControllerConfig.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\Cxbx\DlgVideoConfig.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\Cxbx\EmuExe.cpp
# End Source File
# Begin Source File

View File

@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=xilink6.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 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 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 /pdb:none /debug
!ELSEIF "$(CFG)" == "CxbxKrnl - Win32 Debug"
@ -80,7 +80,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=xilink6.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 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 /debug /machine:I386 /pdbtype:sept /libpath:"Lib"
# ADD LINK32 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 /debug /machine:I386 /pdbtype:sept /libpath:"Lib"
# SUBTRACT LINK32 /pdb:none
!ENDIF

View File

@ -8,7 +8,13 @@ Cxbx Todo (* denotes high priority)
* Retail Games (esp. XDK 4361)
* What does SetLastError check Irql for? Should this be emulated?
* Video Configuration ->
* Multimonitor support via Direct3D9::EnumAdapterModes enumeration.
* Verify that D3DADAPTER_DEFAULT isnt being used anywhere
What does SetLastError check Irql for? Should this be emulated?
Perfect the timing on KeTickCount
@ -22,8 +28,6 @@ Cxbx Todo (* denotes high priority)
Configuration screens may not necessarily need to be modal windows.
Multimonitor support via Direct3D9::EnumAdapterModes enumeration.
Closing a console should not terminate the entire process.
If possible, Direct3D Rendering window should inherit from Wnd.

View File

@ -66,7 +66,7 @@ typedef signed long sint32;
// ******************************************************************
// * Define this to trace intercepted function calls
// ******************************************************************
#define _DEBUG_TRACE
//#define _DEBUG_TRACE
// ******************************************************************
// * Round up dwValue to nearest multiple of dwMult

View File

@ -0,0 +1,44 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->DlgVideoConfig.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef DLGVIDEOCONFIG_H
#define DLGVIDEOCONFIG_H
#include <windows.h>
// ******************************************************************
// * Show Dialog
// ******************************************************************
extern void ShowVideoConfig(HWND hwnd);
#endif

View File

@ -8,6 +8,7 @@
#define IDB_LOGO 106
#define IDB_ABOUT 108
#define IDD_CONTROLLER_CFG 111
#define IDD_VIDEO_CFG 113
#define IDC_SET_X 1000
#define IDC_SET_Y 1001
#define IDC_SET_A 1002
@ -37,6 +38,13 @@
#define IDC_SET_RIGHT_POSX 1029
#define IDC_BUTTON1 1030
#define IDC_BUTTON2 1031
#define IDC_CV_FULLSCREEN 1034
#define IDC_VC_DISPLAY_ADAPTER 1037
#define IDC_VC_D3D_DEVICE 1038
#define IDC_VC_DISPLAY_RESOLUTION 1039
#define IDC_VC_ACCEPT 1040
#define IDC_VC_CANCEL 1041
#define IDC_CHECK1 1042
#define ID_FILE_EXIT 40005
#define ID_HELP_ABOUT 40008
#define ID_EMULATION_START 40009
@ -58,6 +66,7 @@
#define ID_SETTINGS_AUTOGEN 40045
#define ID_SETTINGS_CONFIG_CONTROLLER 40046
#define ID_SETTINGS_CONFIGUREGRAPHICS 40047
#define ID_SETTINGS_CONFIG_VIDEO 40047
#define ID_SETTINGS_CONFIGURESOUND 40048
#define ID_FILE_RXBE_0 40050
#define ID_FILE_RXBE_1 40051
@ -86,9 +95,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 113
#define _APS_NEXT_RESOURCE_VALUE 115
#define _APS_NEXT_COMMAND_VALUE 40073
#define _APS_NEXT_CONTROL_VALUE 1034
#define _APS_NEXT_CONTROL_VALUE 1043
#define _APS_NEXT_SYMED_VALUE 104
#endif
#endif

View File

@ -209,6 +209,16 @@ typedef struct _XINPUT_STATE
}
XINPUT_STATE, *PXINPUT_STATE;
// ******************************************************************
// * RTL_HEAP_PARAMETERS
// ******************************************************************
typedef struct _RTL_HEAP_PARAMETERS
{
ULONG Length;
BYTE Unknown[0x2C];
}
RTL_HEAP_PARAMETERS;
// ******************************************************************
// * func: EmuXInitDevices
// ******************************************************************

View File

@ -66,11 +66,6 @@ extern UINT D3DVertexToPrimitive[11][2];
#define D3DVertex2PrimitiveCount(PrimitiveType, VertexCount) \
(((VertexCount)-D3DVertexToPrimitive[PrimitiveType][1])/D3DVertexToPrimitive[PrimitiveType][0])
// ******************************************************************
// * D3DRenderState2PC (Convert Xbox->PC RenderState enum values)
// ******************************************************************
extern D3DRENDERSTATETYPE D3DRenderState2PC[160];
// ******************************************************************
// * EmuD3DDefferedRenderState
// ******************************************************************

View File

@ -248,7 +248,7 @@ class XBController : public Error
// ******************************************************************
#define DETECT_SENSITIVITY_JOYSTICK 25000
#define DETECT_SENSITIVITY_BUTTON 0
#define DETECT_SENSITIVITY_MOUSE 10
#define DETECT_SENSITIVITY_MOUSE 5
#define DETECT_SENSITIVITY_POV 50000
// ******************************************************************

View File

@ -159,8 +159,7 @@ BEGIN
MENUITEM "Config &Audio...", ID_SETTINGS_CONFIGURESOUND
, GRAYED
MENUITEM "Config &Video...", ID_SETTINGS_CONFIGUREGRAPHICS
, GRAYED
MENUITEM "Config &Video...", ID_SETTINGS_CONFIG_VIDEO
MENUITEM "", 1
MENUITEM "Generate &Exe Automatically", ID_SETTINGS_AUTOGEN
END
@ -192,6 +191,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 130
END
IDD_VIDEO_CFG, DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 255
TOPMARGIN, 6
BOTTOMMARGIN, 108
END
END
#endif // APSTUDIO_INVOKED
@ -204,7 +211,7 @@ END
IDD_CONTROLLER_CFG DIALOGEX 0, 0, 343, 137
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cxbx : Controller Configuration"
FONT 8, "Verdana", 0, 0, 0x1
FONT 8, "Verdana"
BEGIN
PUSHBUTTON "X",IDC_SET_X,7,11,50,14,BS_FLAT
PUSHBUTTON "Y",IDC_SET_Y,60,11,50,14,BS_FLAT
@ -245,6 +252,47 @@ BEGIN
WS_EX_STATICEDGE
END
IDD_VIDEO_CFG DIALOGEX 0, 0, 258, 110
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cxbx : Video Configuration"
FONT 8, "Verdana"
BEGIN
CONTROL "Start in Fullscreen",IDC_CV_FULLSCREEN,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,76,71,73,10
COMBOBOX IDC_VC_DISPLAY_ADAPTER,76,12,173,30,CBS_DROPDOWNLIST |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Direct3D Configuration",IDC_STATIC,4,1,250,87,BS_CENTER
LTEXT "Display Adapter:",IDC_STATIC,13,14,57,8,0,WS_EX_RIGHT
COMBOBOX IDC_VC_D3D_DEVICE,76,31,173,30,CBS_DROPDOWNLIST |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Direct3D Device:",IDC_STATIC,13,33,57,8,0,WS_EX_RIGHT
LTEXT "Video Resolution:",IDC_STATIC,12,53,58,8,0,WS_EX_RIGHT
COMBOBOX IDC_VC_DISPLAY_RESOLUTION,76,50,173,30,CBS_DROPDOWNLIST |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Cancel",IDC_VC_CANCEL,146,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
CONTROL "Sync to Refresh",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,154,71,65,10
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog Info
//
IDD_VIDEO_CFG DLGINIT
BEGIN
IDC_VC_DISPLAY_ADAPTER, 0x403, 16, 0
0x6544, 0x6166, 0x6c75, 0x2074, 0x6441, 0x7061, 0x6574, 0x0072,
IDC_VC_D3D_DEVICE, 0x403, 13, 0
0x6944, 0x6572, 0x7463, 0x4433, 0x4820, 0x4c41, "\000"
IDC_VC_DISPLAY_RESOLUTION, 0x403, 11, 0
0x3436, 0x7830, 0x3834, 0x7830, 0x3631, "\000"
0
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,135 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->DlgVideoConfig.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
// *
// ******************************************************************
#include "DlgVideoConfig.h"
#include "ResCxbx.h"
#include "EmuShared.h"
#include "Emu.h"
#include <stdio.h>
#include <d3d8.h>
// ******************************************************************
// * globals
// ******************************************************************
LPDIRECT3D8 g_pD3D8 = NULL; // Direct3D8
LPDIRECT3DDEVICE8 g_pD3D8Device = NULL; // Direct3D8 Device
// ******************************************************************
// * Static Function(s)
// ******************************************************************
INT_PTR CALLBACK DlgVideoConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
// ******************************************************************
// * func: ShowVideoConfig
// ******************************************************************
void ShowVideoConfig(HWND hwnd)
{
// ******************************************************************
// * Display Window
// ******************************************************************
DialogBox
(
GetModuleHandle(NULL),
MAKEINTRESOURCE(IDD_VIDEO_CFG),
hwnd,
DlgVideoConfigProc
);
}
// ******************************************************************
// * func: DlgVideoConfigProc
// ******************************************************************
INT_PTR CALLBACK DlgVideoConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
HWND hDisplayAdapter = GetDlgItem(hWndDlg, IDC_VC_DISPLAY_ADAPTER);
SetClassLong(hWndDlg, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_CXBX)));
// ******************************************************************
// * Create Direct3D
// ******************************************************************
{
g_pD3D8 = Direct3DCreate8(D3D_SDK_VERSION);
if(g_pD3D8 == NULL)
break;
}
// ******************************************************************
// * Enumerate Display Adapters
// ******************************************************************
{
D3DADAPTER_IDENTIFIER8 AdapterIdentifier;
uint32 dwCount = g_pD3D8->GetAdapterCount();
for(uint32 v=0;v<dwCount;v++)
{
g_pD3D8->GetAdapterIdentifier(v, D3DENUM_NO_WHQL_LEVEL, &AdapterIdentifier);
SendMessage(hDisplayAdapter, CB_ADDSTRING, 0, (LPARAM)AdapterIdentifier.Description);
// First enumeration is choosen by default
if(v == 0) SendMessage(hDisplayAdapter, CB_SETCURSEL, 0, 0);
}
}
}
break;
case WM_COMMAND:
{
HWND hWndButton = GetDlgItem(hWndDlg, LOWORD(wParam));
switch(LOWORD(wParam))
{
case IDC_VC_CANCEL:
EndDialog(hWndDlg, wParam);
break;
case IDC_VC_ACCEPT:
EndDialog(hWndDlg, wParam);
break;
}
}
break;
case WM_CLOSE:
EndDialog(hWndDlg, wParam);
break;
}
return FALSE;
}

View File

@ -34,6 +34,7 @@
#include "WndMain.h"
#include "WndAbout.h"
#include "DlgControllerConfig.h"
#include "DlgVideoConfig.h"
#include "EmuShared.h"
#include "ResCxbx.h"
#include "EmuExe.h"
@ -876,6 +877,10 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
ShowControllerConfig(hwnd);
break;
case ID_SETTINGS_CONFIG_VIDEO:
ShowVideoConfig(hwnd);
break;
case ID_EMULATION_DEBUGOUTPUTKERNEL_CONSOLE:
{
if(m_KrnlDebug == DM_NONE || m_KrnlDebug == DM_FILE)

View File

@ -103,37 +103,6 @@ UINT xd3d8::D3DVertexToPrimitive[11][2] =
// ******************************************************************
DWORD *xd3d8::EmuD3DDefferedRenderState;
// ******************************************************************
// * D3DRenderState2PC (Convert Xbox->PC RenderState enum values)
// ******************************************************************
xd3d8::D3DRENDERSTATETYPE D3DRenderState2PC[160] =
{
// NOTE: We may not need this...
/* 0->123 */
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
(xd3d8::D3DRENDERSTATETYPE)0, (xd3d8::D3DRENDERSTATETYPE)0,
/* D3DRS_LIGHTING = 124 */ xd3d8::D3DRS_LIGHTING
};
// ******************************************************************
// * EmuPrimitiveType
// ******************************************************************
@ -161,20 +130,26 @@ VOID EmuD3DInit(Xbe::Header *XbeHeader, uint32 XbeHeaderSize)
// ******************************************************************
// * store XbeHeader and XbeHeaderSize for further use
// ******************************************************************
{
g_XbeHeader = XbeHeader;
g_XbeHeaderSize = XbeHeaderSize;
}
g_ThreadInitialized = false;
// ******************************************************************
// * Create a thread dedicated to timing
// ******************************************************************
{
DWORD dwThreadId;
CreateThread(NULL, NULL, EmuUpdateTickCount, NULL, NULL, &dwThreadId);
}
// ******************************************************************
// * spark up a new thread to handle window message processing
// ******************************************************************
{
DWORD dwThreadId;
CreateThread(NULL, NULL, EmuUpdateTickCount, NULL, NULL, &dwThreadId);
CreateThread(NULL, NULL, EmuRenderWindow, NULL, NULL, &dwThreadId);
while(!g_ThreadInitialized)
@ -214,11 +189,15 @@ VOID EmuD3DCleanup()
// ******************************************************************
DWORD WINAPI EmuUpdateTickCount(LPVOID)
{
timeBeginPeriod(0);
while(true)
{
xboxkrnl::KeTickCount = GetTickCount();
xboxkrnl::KeTickCount = timeGetTime();
Sleep(1);
}
timeEndPeriod(0);
}
// ******************************************************************
@ -404,7 +383,9 @@ HRESULT WINAPI xd3d8::EmuIDirect3D8_CreateDevice
Adapter = D3DADAPTER_DEFAULT;
pPresentationParameters->Windowed = TRUE;
//pPresentationParameters->SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
// TODO: Enable this optionally (to slow games down)
// pPresentationParameters->SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
hFocusWindow = g_hEmuWindow;

View File

@ -287,15 +287,15 @@ VOID WINAPI xapi::EmuXapiInitProcess()
// * Call RtlCreateHeap
// ******************************************************************
{
BYTE SomeStruct[0x30];
RTL_HEAP_PARAMETERS HeapParameters;
ZeroMemory(SomeStruct, sizeof(SomeStruct));
ZeroMemory(&HeapParameters, sizeof(HeapParameters));
*(DWORD*)SomeStruct = sizeof(SomeStruct);
HeapParameters.Length = sizeof(HeapParameters);
EmuSwapFS(); // XBox FS
uint32 pSomeStruct = (uint32)SomeStruct;
uint32 pHeapParameters = (uint32)&HeapParameters;
uint32 dwPeHeapReserve = g_pXbeHeader->dwPeHeapReserve;
uint32 dwPeHeapCommit = g_pXbeHeader->dwPeHeapCommit;
@ -305,7 +305,7 @@ VOID WINAPI xapi::EmuXapiInitProcess()
{
xor ecx, ecx
push pSomeStruct
push pHeapParameters
push ecx
push dwPeHeapCommit
push dwPeHeapReserve