From bf734b5b202540763f6ea546791b801694fcb97b Mon Sep 17 00:00:00 2001 From: VDm Date: Fri, 4 Apr 2025 23:04:22 +0400 Subject: [PATCH] fix(build): make project compilable --- src/client/Client.cpp | 2 ++ src/console/Device.cpp | 32 +++++++++----------------------- src/gx/CGxCaps.hpp | 2 +- src/gx/CGxDevice.cpp | 4 ++-- src/gx/CGxDevice.hpp | 2 +- src/gx/Device.cpp | 4 ---- src/gx/Device.hpp | 2 ++ src/gx/d3d/CGxDeviceD3d.cpp | 17 ++++++----------- src/gx/d3d/CGxDeviceD3d.hpp | 1 + src/ui/FrameScript.cpp | 7 +------ 10 files changed, 25 insertions(+), 48 deletions(-) diff --git a/src/client/Client.cpp b/src/client/Client.cpp index 27f9ac5..28ff04c 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -21,6 +21,7 @@ #include "util/Filesystem.hpp" #include #include +#include #include #include #include @@ -468,6 +469,7 @@ int32_t InitializeGlobal() { // ); // sub_86D430(v8->m_intValue); + OsTimeStartup(SystemMethod2); // ConsoleCommandRegister("timingInfo", (int)sub_4032A0, 0, 0); diff --git a/src/console/Device.cpp b/src/console/Device.cpp index c8b9fcb..6bac109 100644 --- a/src/console/Device.cpp +++ b/src/console/Device.cpp @@ -199,20 +199,6 @@ int32_t CCGxRestart(const char*, const char*) { return 1; } -EGxApi GxApiDefault() { -#if defined(WHOA_SYSTEM_WIN) - return GxApi_D3d9; -#endif - -#if defined(WHOA_SYSTEM_MAC) - return GxApi_GLL; -#endif - -#if defined(WHOA_SYSTEM_LINUX) - return GxApi_GLSDL; -#endif -} - void RegisterGxCVars() { const auto& format = s_defaults.format; @@ -331,7 +317,7 @@ void ConsoleDeviceInitialize(const char* title) { // TODO: sub_76BA30(&unk_CABB38, &byte_CABCBD); << ConsoleDetect // TODO: byte_CABCBC = 1; - if (CmdLineGetBool(WOWCMD_HW_DETECT) || s_cvHwDetect->GetInt() != 0) { + if (CmdLineGetBool(CMD_HW_DETECT) || s_cvHwDetect->GetInt() != 0) { s_hwDetect = true; s_cvHwDetect->Set("0", true, false, false, true); } else { @@ -339,7 +325,7 @@ void ConsoleDeviceInitialize(const char* title) { } - ConsoleAccessSetEnabled(CmdLineGetBool(WOWCMD_CONSOLE)); + ConsoleAccessSetEnabled(CmdLineGetBool(CMD_CONSOLE)); // TODO: sub_76B520(&unk_CABAF0, &unk_CABB38); @@ -365,19 +351,19 @@ void ConsoleDeviceInitialize(const char* title) { GxLog("ConsoleDeviceInitialize(): hwDetect = %d, hwChanged = %d", s_hwDetect, s_hwChanged); - if (CmdLineGetBool(WOWCMD_RES_800x600)) { + if (CmdLineGetBool(CMD_RES_800x600)) { s_requestedFormat.size.x = 800; s_requestedFormat.size.y = 600; - } else if (CmdLineGetBool(WOWCMD_RES_1024x768)) { + } else if (CmdLineGetBool(CMD_RES_1024x768)) { s_requestedFormat.size.x = 1024; s_requestedFormat.size.y = 768; - } else if (CmdLineGetBool(WOWCMD_RES_1280x960)) { + } else if (CmdLineGetBool(CMD_RES_1280x960)) { s_requestedFormat.size.x = 1280; s_requestedFormat.size.y = 960; - } else if (CmdLineGetBool(WOWCMD_RES_1280x1024)) { + } else if (CmdLineGetBool(CMD_RES_1280x1024)) { s_requestedFormat.size.x = 1280; s_requestedFormat.size.y = 1024; - } else if (CmdLineGetBool(WOWCMD_RES_1600x1200)) { + } else if (CmdLineGetBool(CMD_RES_1600x1200)) { s_requestedFormat.size.x = 1600; s_requestedFormat.size.y = 1200; } @@ -406,7 +392,7 @@ void ConsoleDeviceInitialize(const char* title) { auto gxApiName = s_cvGxApi->GetString(); - auto gxOverride = CmdLineGetString(WOWCMD_GX_OVERRIDE); + auto gxOverride = CmdLineGetString(CMD_GX_OVERRIDE); if (*gxOverride != '\0') { gxApiName = gxOverride; } else if (CmdLineGetBool(CMD_OPENGL)) { @@ -432,7 +418,7 @@ void ConsoleDeviceInitialize(const char* title) { bool windowed = s_cvGxWindow->GetInt() != 0; if (CmdLineGetBool(CMD_FULL_SCREEN)) { windowed = false; - } else if (CmdLineGetBool(WOWCMD_WINDOWED)) { + } else if (CmdLineGetBool(CMD_WINDOWED)) { windowed = true; } diff --git a/src/gx/CGxCaps.hpp b/src/gx/CGxCaps.hpp index 0797ca8..469b691 100644 --- a/src/gx/CGxCaps.hpp +++ b/src/gx/CGxCaps.hpp @@ -22,7 +22,7 @@ class CGxCaps { int32_t m_texFilterAnisotropic = 0; uint32_t m_maxTexAnisotropy = 0; int32_t m_depthBias = 0; - int32_t m_hardwareCursor = 0; + int32_t m_hwCursor = 0; int32_t int130 = 1; int32_t int134 = 0; int32_t int138 = 0; diff --git a/src/gx/CGxDevice.cpp b/src/gx/CGxDevice.cpp index 71ae9c6..0bc1120 100644 --- a/src/gx/CGxDevice.cpp +++ b/src/gx/CGxDevice.cpp @@ -196,7 +196,7 @@ bool CGxDevice::AdapterMonitorModes(TSGrowableArray& modes) { dm.dmSize = sizeof(DEVMODE); DWORD i = 0; - while (EnumDisplaySettings(&device, i, &dm)) { + while (EnumDisplaySettings(device.DeviceName, i, &dm)) { if ((dm.dmPelsWidth >= 640 && dm.dmPelsHeight >= 480) && dm.dmBitsPerPel >= 16) { auto mode = modes.New(); @@ -1366,7 +1366,7 @@ void CGxDevice::XformSetViewport(float minX, float maxX, float minY, float maxY, return; } - this->intF6C = 1; + this->m_needsReset = 1; this->m_viewport.x.l = minX; this->m_viewport.x.h = maxX; diff --git a/src/gx/CGxDevice.hpp b/src/gx/CGxDevice.hpp index d3e2699..3c20308 100644 --- a/src/gx/CGxDevice.hpp +++ b/src/gx/CGxDevice.hpp @@ -111,7 +111,7 @@ class CGxDevice { TSFixedArray m_hwRenderStates; uint32_t m_baseMipLevel = 0; // TODO placeholder int32_t m_cursorVisible = 0; - int32_t m_hardwareCursor = 0; + int32_t m_hwCursor = 0; uint32_t m_cursorHotspotX = 0; uint32_t m_cursorHotspotY = 0; uint32_t m_cursor[CURSOR_IMAGE_SIZE] = { 0 }; diff --git a/src/gx/Device.cpp b/src/gx/Device.cpp index 5bb4c21..0d0c3a4 100644 --- a/src/gx/Device.cpp +++ b/src/gx/Device.cpp @@ -116,7 +116,3 @@ bool GxApiSupported(EGxApi api) { bool GxAdapterMonitorModes(TSGrowableArray& modes) { return CGxDevice::AdapterMonitorModes(modes); } - -void GxLogOpen() { - CGxDevice::LogOpen(); -} diff --git a/src/gx/Device.hpp b/src/gx/Device.hpp index 7ead52b..2f176bb 100644 --- a/src/gx/Device.hpp +++ b/src/gx/Device.hpp @@ -17,4 +17,6 @@ void* GxDevWindow(); int32_t GxMasterEnable(EGxMasterEnables state); +EGxApi GxApiDefault(); + #endif diff --git a/src/gx/d3d/CGxDeviceD3d.cpp b/src/gx/d3d/CGxDeviceD3d.cpp index db39e06..6aa0386 100644 --- a/src/gx/d3d/CGxDeviceD3d.cpp +++ b/src/gx/d3d/CGxDeviceD3d.cpp @@ -530,7 +530,7 @@ void CGxDeviceD3d::DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2) { // TODO - this->intF6C = 1; + this->m_needsReset = 1; return; } else { @@ -538,7 +538,7 @@ void CGxDeviceD3d::DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2) { } } - this->intF6C = 1; + this->m_needsReset = 1; } break; @@ -1276,11 +1276,6 @@ void CGxDeviceD3d::CursorSetVisible(int32_t visible) { } } -void CGxDeviceD3d::CursorUnlock(uint32_t x, uint32_t y) { - CGxDevice::CursorUnlock(x, y); - this->m_hwCursorNeedsUpdate = 1; -} - void CGxDeviceD3d::ICursorDraw() { if (!this->m_hwCursor) { this->ISceneBegin(); @@ -1746,7 +1741,7 @@ void CGxDeviceD3d::IStateSync() { // TODO - if (this->intF6C) { + if (this->m_needsReset) { this->IXformSetViewport(); } } @@ -2124,7 +2119,7 @@ void CGxDeviceD3d::IXformSetViewport() { this->m_d3dDevice->SetViewport(&d3dViewport); - this->intF6C = 0; + this->m_needsReset = 0; } void CGxDeviceD3d::IXformSetWorld() { @@ -2159,7 +2154,7 @@ void CGxDeviceD3d::SceneClear(uint32_t mask, CImVector color) { flags |= 0x2; } - if (this->intF6C) { + if (this->m_needsReset) { this->IXformSetViewport(); } @@ -2203,7 +2198,7 @@ int32_t CGxDeviceD3d::StereoEnabled() { return this->m_d3dStereoEnabled == 1; } -void CGxDeviceD3d::CursorUnlock() { +void CGxDeviceD3d::CursorUnlock(uint32_t x, uint32_t y) { CGxDevice::CursorUnlock(x, y); this->m_hwCursorNeedsUpdate = 1; } diff --git a/src/gx/d3d/CGxDeviceD3d.hpp b/src/gx/d3d/CGxDeviceD3d.hpp index 56c8d73..c4b786b 100644 --- a/src/gx/d3d/CGxDeviceD3d.hpp +++ b/src/gx/d3d/CGxDeviceD3d.hpp @@ -229,6 +229,7 @@ class CGxDeviceD3d : public CGxDevice { LPDIRECT3DDEVICE9 m_d3dDevice = nullptr; D3DCAPS9 m_d3dCaps; int32_t m_d3dIsHwDevice = 0; + int32_t m_d3dStereoEnabled = 0; LPDIRECT3DVERTEXDECLARATION9 m_d3dVertexDecl[GxVertexBufferFormats_Last] = { 0 }; D3DDISPLAYMODE m_desktopDisplayMode; int32_t m_inScene; diff --git a/src/ui/FrameScript.cpp b/src/ui/FrameScript.cpp index efef8f8..887635f 100644 --- a/src/ui/FrameScript.cpp +++ b/src/ui/FrameScript.cpp @@ -11,6 +11,7 @@ #include #include #include +#include const char* g_glueScriptEvents[41]; const char* g_scriptEvents[722]; @@ -98,12 +99,6 @@ const char* FrameScript_EventObject::GetName() { return this->m_key.m_str; } -int64_t OsGetAsyncClocksPerSecond() { - // TODO - - return 1000.0; -} - int32_t FrameScript_CompileFunction(const char* name, const char* wrapper, const char* body, CStatus* status) { lua_State* L = FrameScript::s_context;