mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-07-24 17:41:13 +03:00
Compare commits
2 Commits
46843880ef
...
8adf3a0061
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8adf3a0061 | ||
![]() |
f4e9f86ca6 |
@ -1,5 +1,4 @@
|
||||
#include "client/CmdLine.hpp"
|
||||
|
||||
#include <storm/Command.hpp>
|
||||
|
||||
int32_t CmdLineProcess() {
|
||||
@ -32,23 +31,23 @@ int32_t CmdLineProcess() {
|
||||
|
||||
void ProcessCommandLine() {
|
||||
static ARGLIST s_wowArgList[] = {
|
||||
{ 0x0, WOWCMD_RES_800x600, "800x600", nullptr },
|
||||
{ 0x0, WOWCMD_RES_1024x768, "1024x768", nullptr },
|
||||
{ 0x0, WOWCMD_RES_1280x960, "1280x960", nullptr },
|
||||
{ 0x0, WOWCMD_RES_1280x1024, "1280x1024", nullptr },
|
||||
{ 0x0, WOWCMD_RES_1600x1200, "1600x1200", nullptr },
|
||||
{ 0x0, WOWCMD_16_BIT, "16bit", nullptr },
|
||||
{ 0x0, WOWCMD_UP_TO_DATE, "uptodate", nullptr },
|
||||
{ 0x0, WOWCMD_NO_SOUND, "nosound", nullptr },
|
||||
{ 0x0, WOWCMD_SOUND_CHAOS, "soundchaos", nullptr },
|
||||
{ 0x0, WOWCMD_NO_FIX_LAG, "nofixlag", nullptr },
|
||||
{ 0x0, WOWCMD_DEPTH_16, "d16", nullptr },
|
||||
{ 0x0, WOWCMD_DEPTH_24, "d24", nullptr },
|
||||
{ 0x0, WOWCMD_DEPTH_32, "d32", nullptr },
|
||||
{ 0x0, WOWCMD_WINDOWED, "windowed", nullptr },
|
||||
{ 0x0, WOWCMD_HW_DETECT, "hwdetect", nullptr },
|
||||
{ 0x0, WOWCMD_CONSOLE, "console", nullptr },
|
||||
{ STORM_COMMAND_TYPE_STRING, WOWCMD_GX_OVERRIDE, "gxoverride", nullptr }
|
||||
{ 0x0, CMD_RES_800x600, "800x600", nullptr },
|
||||
{ 0x0, CMD_RES_1024x768, "1024x768", nullptr },
|
||||
{ 0x0, CMD_RES_1280x960, "1280x960", nullptr },
|
||||
{ 0x0, CMD_RES_1280x1024, "1280x1024", nullptr },
|
||||
{ 0x0, CMD_RES_1600x1200, "1600x1200", nullptr },
|
||||
{ 0x0, CMD_16_BIT, "16bit", nullptr },
|
||||
{ 0x0, CMD_UP_TO_DATE, "uptodate", nullptr },
|
||||
{ 0x0, CMD_NO_SOUND, "nosound", nullptr },
|
||||
{ 0x0, CMD_SOUND_CHAOS, "soundchaos", nullptr },
|
||||
{ 0x0, CMD_NO_FIX_LAG, "nofixlag", nullptr },
|
||||
{ 0x0, CMD_DEPTH_16, "d16", nullptr },
|
||||
{ 0x0, CMD_DEPTH_24, "d24", nullptr },
|
||||
{ 0x0, CMD_DEPTH_32, "d32", nullptr },
|
||||
{ 0x0, CMD_WINDOWED, "windowed", nullptr },
|
||||
{ 0x0, CMD_HW_DETECT, "hwdetect", nullptr },
|
||||
{ 0x0, CMD_CONSOLE, "console", nullptr },
|
||||
{ STORM_COMMAND_TYPE_STRING, CMD_GX_OVERRIDE, "gxoverride", nullptr }
|
||||
};
|
||||
|
||||
// Load wow-specific launch flags
|
||||
@ -57,7 +56,7 @@ void ProcessCommandLine() {
|
||||
CmdLineProcess();
|
||||
}
|
||||
|
||||
const char* CmdLineGetString(uint32_t opt) {
|
||||
const char* CmdLineGetString(CMDOPT opt) {
|
||||
static char buffer[260] = {0};
|
||||
|
||||
SCmdGetString(opt, buffer, 260);
|
||||
@ -65,10 +64,10 @@ const char* CmdLineGetString(uint32_t opt) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
uint32_t CmdLineGetUint(uint32_t opt) {
|
||||
uint32_t CmdLineGetUint(CMDOPT opt) {
|
||||
return SCmdGetNum(opt);
|
||||
}
|
||||
|
||||
int32_t CmdLineGetBool(uint32_t opt) {
|
||||
int32_t CmdLineGetBool(CMDOPT opt) {
|
||||
return SCmdGetBool(opt);
|
||||
}
|
||||
|
@ -23,35 +23,32 @@ enum CMDOPT {
|
||||
CMDOPTS
|
||||
};
|
||||
|
||||
enum WOWCMDOPT {
|
||||
WOWCMD_RES_800x600 = 16,
|
||||
WOWCMD_RES_1024x768 = 17,
|
||||
WOWCMD_RES_1280x960 = 18,
|
||||
WOWCMD_RES_1280x1024 = 19,
|
||||
WOWCMD_RES_1600x1200 = 20,
|
||||
WOWCMD_UP_TO_DATE = 21,
|
||||
WOWCMD_16_BIT = 22,
|
||||
WOWCMD_NO_FIX_LAG = 24,
|
||||
WOWCMD_NO_SOUND = 26,
|
||||
WOWCMD_SOUND_CHAOS = 27,
|
||||
WOWCMD_DEPTH_16 = 29,
|
||||
WOWCMD_DEPTH_24 = 30,
|
||||
WOWCMD_DEPTH_32 = 31,
|
||||
WOWCMD_WINDOWED = 32,
|
||||
WOWCMD_CONSOLE = 35,
|
||||
WOWCMD_HW_DETECT = 36,
|
||||
WOWCMD_GX_OVERRIDE = 39,
|
||||
WOWCMD_OPTS
|
||||
};
|
||||
#define CMD_RES_800x600 static_cast<CMDOPT>(16)
|
||||
#define CMD_RES_1024x768 static_cast<CMDOPT>(17)
|
||||
#define CMD_RES_1280x960 static_cast<CMDOPT>(18)
|
||||
#define CMD_RES_1280x1024 static_cast<CMDOPT>(19)
|
||||
#define CMD_RES_1600x1200 static_cast<CMDOPT>(20)
|
||||
#define CMD_UP_TO_DATE static_cast<CMDOPT>(21)
|
||||
#define CMD_16_BIT static_cast<CMDOPT>(22)
|
||||
#define CMD_NO_FIX_LAG static_cast<CMDOPT>(24)
|
||||
#define CMD_NO_SOUND static_cast<CMDOPT>(26)
|
||||
#define CMD_SOUND_CHAOS static_cast<CMDOPT>(27)
|
||||
#define CMD_DEPTH_16 static_cast<CMDOPT>(29)
|
||||
#define CMD_DEPTH_24 static_cast<CMDOPT>(30)
|
||||
#define CMD_DEPTH_32 static_cast<CMDOPT>(31)
|
||||
#define CMD_WINDOWED static_cast<CMDOPT>(32)
|
||||
#define CMD_CONSOLE static_cast<CMDOPT>(35)
|
||||
#define CMD_HW_DETECT static_cast<CMDOPT>(36)
|
||||
#define CMD_GX_OVERRIDE static_cast<CMDOPT>(39)
|
||||
|
||||
int32_t CmdLineProcess();
|
||||
|
||||
void ProcessCommandLine();
|
||||
|
||||
const char* CmdLineGetString(uint32_t opt);
|
||||
const char* CmdLineGetString(CMDOPT opt);
|
||||
|
||||
uint32_t CmdLineGetUint(uint32_t opt);
|
||||
uint32_t CmdLineGetUint(CMDOPT opt);
|
||||
|
||||
int32_t CmdLineGetBool(uint32_t opt);
|
||||
int32_t CmdLineGetBool(CMDOPT opt);
|
||||
|
||||
#endif
|
||||
|
@ -336,7 +336,7 @@ LRESULT CGxDeviceD3d::WindowProcD3d(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||
if (device) {
|
||||
if (device->m_d3dDevice && LOWORD(lParam) == HTCLIENT) {
|
||||
SetCursor(nullptr);
|
||||
BOOL show = device->m_cursorVisible && device->m_hardwareCursor ? TRUE : FALSE;
|
||||
BOOL show = device->m_cursorVisible && device->m_hwCursor ? TRUE : FALSE;
|
||||
device->m_d3dDevice->ShowCursor(show);
|
||||
return 1;
|
||||
}
|
||||
@ -487,15 +487,7 @@ int32_t CGxDeviceD3d::DeviceSetFormat(const CGxFormat& format) {
|
||||
CGxFormat createFormat = format;
|
||||
|
||||
if (this->ICreateWindow(createFormat) && this->ICreateD3dDevice(createFormat) && this->CGxDevice::DeviceSetFormat(format)) {
|
||||
this->intF64 = 1;
|
||||
this->m_hwCursorNeedsUpdate = 1;
|
||||
|
||||
if (this->m_format.window == 0) {
|
||||
RECT windowRect;
|
||||
GetWindowRect(this->m_hwnd, &windowRect);
|
||||
ClipCursor(&windowRect);
|
||||
}
|
||||
|
||||
this->ICursorClip(1);
|
||||
return 1;
|
||||
} else {
|
||||
CGxDevice::Log("CGxDeviceD3d::DeviceSetFormat(): unable to set format!");
|
||||
@ -1015,6 +1007,20 @@ bool CGxDeviceD3d::ICreateWindow(CGxFormat& format) {
|
||||
return this->m_hwnd != nullptr;
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::ICursorClip(int32_t a1) {
|
||||
this->intF64 = a1;
|
||||
|
||||
if (a1) {
|
||||
this->m_hwCursorNeedsUpdate = 1;
|
||||
|
||||
if (this->m_format.window) {
|
||||
RECT windowRect;
|
||||
GetWindowRect(this->m_hwnd, &windowRect);
|
||||
ClipCursor(&windowRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::IDestroyD3d() {
|
||||
this->IDestroyD3dDevice();
|
||||
CGxDeviceD3d::IUnloadD3dLib(this->m_d3dLib, this->m_d3d);
|
||||
@ -1220,7 +1226,7 @@ void CGxDeviceD3d::IRsSendToHw(EGxRenderState which) {
|
||||
void CGxDeviceD3d::ICursorCreate(const CGxFormat& format) {
|
||||
CGxDevice::ICursorCreate(format);
|
||||
|
||||
if (this->m_hardwareCursor && this->m_hwCursorTexture == nullptr) {
|
||||
if (this->m_hwCursor && this->m_hwCursorTexture == nullptr) {
|
||||
this->m_d3dDevice->CreateTexture(
|
||||
32,
|
||||
32,
|
||||
@ -1257,7 +1263,7 @@ void CGxDeviceD3d::ICursorDestroy() {
|
||||
void CGxDeviceD3d::CursorSetVisible(int32_t visible) {
|
||||
CGxDevice::CursorSetVisible(visible);
|
||||
|
||||
if (this->m_hardwareCursor && this->m_context) {
|
||||
if (this->m_hwCursor && this->m_context) {
|
||||
POINT point;
|
||||
RECT rect;
|
||||
GetCursorPos(&point);
|
||||
@ -1276,15 +1282,15 @@ void CGxDeviceD3d::CursorUnlock(uint32_t x, uint32_t y) {
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::ICursorDraw() {
|
||||
if (!this->m_hardwareCursor) {
|
||||
if (!this->m_hwCursor) {
|
||||
this->ISceneBegin();
|
||||
}
|
||||
|
||||
CGxDevice::ICursorDraw();
|
||||
|
||||
if (!this->m_hardwareCursor) {
|
||||
if (!this->m_hwCursor) {
|
||||
this->ISceneEnd();
|
||||
if (!this->m_hardwareCursor) {
|
||||
if (!this->m_hwCursor) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1312,16 +1318,19 @@ void CGxDeviceD3d::ICursorDraw() {
|
||||
|
||||
void CGxDeviceD3d::ISceneBegin() {
|
||||
if (!this->m_context) {
|
||||
auto result = this->m_d3dDevice->TestCooperativeLevel();
|
||||
if (result == D3DERR_DEVICENOTRESET) {
|
||||
this->IReleaseD3dResources(0);
|
||||
if (this->m_d3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) {
|
||||
D3DPRESENT_PARAMETERS d3dpp;
|
||||
this->IReleaseD3dResources(0);
|
||||
this->ISetPresentParms(d3dpp, this->m_format);
|
||||
result = this->m_d3dDevice->Reset(&d3dpp);
|
||||
if (result == D3D_OK) {
|
||||
if (this->m_d3dDevice->Reset(&d3dpp) == D3D_OK) {
|
||||
this->IStateSetD3dDefaults();
|
||||
// TODO: CGxDeviceD3d::ICursorClip
|
||||
// TODO: this->NotifyOnDeviceRestored()
|
||||
this->ICursorClip(1);
|
||||
this->m_context = 1;
|
||||
// TODO
|
||||
// this->intF5C = 0;
|
||||
// this->unk3ACC = 1;
|
||||
|
||||
// this->NotifyOnDeviceRestored();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1427,7 +1436,7 @@ void CGxDeviceD3d::ISetCaps(const CGxFormat& format) {
|
||||
|
||||
// Detect hardware cursor
|
||||
|
||||
this->m_caps.m_hardwareCursor = this->m_d3dCaps.CursorCaps & D3DCURSORCAPS_COLOR;
|
||||
this->m_caps.m_hwCursor = this->m_d3dCaps.CursorCaps & D3DCURSORCAPS_COLOR;
|
||||
|
||||
// Texture formats
|
||||
|
||||
@ -2191,8 +2200,9 @@ void CGxDeviceD3d::ShaderCreate(CGxShader* shaders[], EGxShTarget target, const
|
||||
}
|
||||
|
||||
int32_t CGxDeviceD3d::StereoEnabled() {
|
||||
// TODO
|
||||
return 0;
|
||||
CGxDevice::CursorUnlock(x, y);
|
||||
this->m_hwCursorNeedsUpdate = 1;
|
||||
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::XformSetProjection(const C44Matrix& matrix) {
|
||||
|
@ -252,7 +252,6 @@ class CGxDeviceD3d : public CGxDevice {
|
||||
virtual void ICursorDestroy();
|
||||
virtual void ICursorDraw();
|
||||
virtual void CursorSetVisible(int32_t visible);
|
||||
virtual void CursorUnlock(uint32_t x, uint32_t y);
|
||||
virtual int32_t DeviceCreate(int32_t (*windowProc)(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam), const CGxFormat& format);
|
||||
virtual int32_t DeviceSetFormat(const CGxFormat& format);
|
||||
virtual void* DeviceWindow();
|
||||
@ -270,6 +269,7 @@ class CGxDeviceD3d : public CGxDevice {
|
||||
virtual void IShaderCreate(CGxShader* shader);
|
||||
virtual void ShaderCreate(CGxShader* shaders[], EGxShTarget target, const char* a4, const char* a5, int32_t permutations);
|
||||
virtual int32_t StereoEnabled();
|
||||
virtual void CursorUnlock(uint32_t x, uint32_t y);
|
||||
|
||||
// Member functions
|
||||
CGxDeviceD3d();
|
||||
@ -283,6 +283,7 @@ class CGxDeviceD3d : public CGxDevice {
|
||||
LPDIRECT3DVERTEXBUFFER9 ICreateD3dVB(EGxPoolUsage usage, uint32_t size);
|
||||
LPDIRECT3DVERTEXDECLARATION9 ICreateD3dVertexDecl(D3DVERTEXELEMENT9 elements[], uint32_t count);
|
||||
bool ICreateWindow(CGxFormat& format);
|
||||
void ICursorClip(int32_t a1);
|
||||
void ISetPresentParms(D3DPRESENT_PARAMETERS& d3dpp, const CGxFormat& format);
|
||||
void IDestroyD3d();
|
||||
void IDestroyD3dDevice();
|
||||
|
Loading…
Reference in New Issue
Block a user