fix(gx): log what api is being used when initializing device

This commit is contained in:
superp00t 2024-07-22 16:16:41 -04:00
parent 6fa58683ad
commit 422a36cd93
7 changed files with 24 additions and 3 deletions

View File

@ -1,5 +1,5 @@
if(WHOA_SYSTEM_WIN)
file(GLOB PRIVATE_SOURCES "win/*.cpp")
file(GLOB PRIVATE_SOURCES "win/*.cpp" "win/Whoa.rc")
add_executable(Whoa WIN32 ${PRIVATE_SOURCES})

BIN
src/app/win/Whoa.cur Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
src/app/win/Whoa.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

2
src/app/win/Whoa.rc Normal file
View File

@ -0,0 +1,2 @@
BlizzardIcon.ico ICON DISCARDABLE "Whoa.ico"
BlizzardCursor.cur CURSOR "Whoa.cur"

View File

@ -6,6 +6,7 @@
#include "event/Input.hpp"
#include "gx/Device.hpp"
#include <cstring>
#include <cstdio>
CVar* s_cvGxMaximize;
CVar* s_cvGxResolution;
@ -297,6 +298,9 @@ void ConsoleDeviceInitialize(const char* title) {
}
}
// Log
printf("GxApi_%s selected\n", g_gxApiNames[api]);
// Set internally (CVar value reflects the current gxApi at launch),
// this will not Set() as CVar gxApi is latched
s_cvGxApi->InternalSet(g_gxApiNames[api], true, false, false, true);

View File

@ -1,15 +1,17 @@
#include "gx/Device.hpp"
#include "gx/CGxDevice.hpp"
#include "gx/Gx.hpp"
#include <cstdio>
CGxDevice* g_theGxDevicePtr = nullptr;
CGxDevice* GxDevCreate(EGxApi api, int32_t (*windowProc)(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam), const CGxFormat& format) {
CGxDevice* device;
CGxDevice* device = nullptr;
switch (api) {
case GxApi_OpenGl:
device = CGxDevice::NewOpenGl();
break;
#if defined(WHOA_SYSTEM_WIN)
case GxApi_D3d9:
@ -41,6 +43,8 @@ CGxDevice* GxDevCreate(EGxApi api, int32_t (*windowProc)(void* window, uint32_t
break;
}
STORM_ASSERT(device != nullptr);
g_theGxDevicePtr = device;
if (g_theGxDevicePtr->DeviceCreate(windowProc, format)) {

View File

@ -333,7 +333,18 @@ LRESULT CGxDeviceD3d::WindowProcD3d(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
}
case WM_SETCURSOR: {
// TODO
if (device) {
if (device->m_d3dDevice && lParam == 1) {
SetCursor(nullptr);
BOOL show = TRUE;
// if (device->unk2904[0x13] == 0) || (device->.unk2904[0x14] == 0)) {
// show = FALSE;
// } else {
// show = TRUE;
// }
device->m_d3dDevice->ShowCursor(show);
}
}
return 1;
}