mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-07-25 18:05:49 +03:00
Compare commits
3 Commits
ba97426d5b
...
236f0372e4
Author | SHA1 | Date | |
---|---|---|---|
![]() |
236f0372e4 | ||
![]() |
1e36638964 | ||
![]() |
35a59942ff |
@ -17,7 +17,7 @@ CVar* CVar::Lookup(const char* name) {
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const char* value, bool (*fcn)(CVar*, const char*, const char*, void*), uint32_t category, bool a7, void* arg, bool a9) {
|
CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const char* value, bool (*fcn)(CVar*, const char*, const char*, void*), uint32_t category, bool setCommand, void* arg, bool a9) {
|
||||||
CVar* var = CVar::s_registeredCVars.Ptr(name);
|
CVar* var = CVar::s_registeredCVars.Ptr(name);
|
||||||
|
|
||||||
if (var) {
|
if (var) {
|
||||||
@ -36,7 +36,7 @@ CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const c
|
|||||||
|
|
||||||
var->Set(value, setValue, setReset, setDefault, false);
|
var->Set(value, setValue, setReset, setDefault, false);
|
||||||
|
|
||||||
if (!a7) {
|
if (!setCommand) {
|
||||||
var->m_flags |= 0x80000000;
|
var->m_flags |= 0x80000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const c
|
|||||||
var->m_arg = arg;
|
var->m_arg = arg;
|
||||||
var->m_help.Copy(help);
|
var->m_help.Copy(help);
|
||||||
|
|
||||||
if (a7) {
|
if (setCommand) {
|
||||||
var->Set(value, true, true, false, false);
|
var->Set(value, true, true, false, false);
|
||||||
} else {
|
} else {
|
||||||
var->Set(value, true, false, true, false);
|
var->Set(value, true, false, true, false);
|
||||||
@ -67,7 +67,7 @@ CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const c
|
|||||||
|
|
||||||
var->m_flags = flags | 0x1;
|
var->m_flags = flags | 0x1;
|
||||||
|
|
||||||
if (!a7) {
|
if (!setCommand) {
|
||||||
var->m_flags |= 0x8000000;
|
var->m_flags |= 0x8000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <storm/Hash.hpp>
|
#include <storm/Hash.hpp>
|
||||||
#include <bc/os/File.hpp>
|
#include <bc/os/File.hpp>
|
||||||
|
|
||||||
|
#include "console/Types.hpp"
|
||||||
|
|
||||||
class CVar : public TSHashObject<CVar, HASHKEY_STRI> {
|
class CVar : public TSHashObject<CVar, HASHKEY_STRI> {
|
||||||
public:
|
public:
|
||||||
// Static variables
|
// Static variables
|
||||||
@ -14,7 +16,17 @@ class CVar : public TSHashObject<CVar, HASHKEY_STRI> {
|
|||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static CVar* Lookup(const char* name);
|
static CVar* Lookup(const char* name);
|
||||||
static CVar* Register(const char*, const char*, uint32_t, const char*, bool (*)(CVar*, const char*, const char*, void*), uint32_t, bool, void*, bool);
|
static CVar* Register(
|
||||||
|
const char* name,
|
||||||
|
const char* help,
|
||||||
|
uint32_t flags,
|
||||||
|
const char* value,
|
||||||
|
bool (*fcn)(CVar*, const char*, const char*, void*) = nullptr,
|
||||||
|
uint32_t category = CATEGORY::DEFAULT,
|
||||||
|
bool setCommand = false,
|
||||||
|
void* arg = nullptr,
|
||||||
|
bool a9 = false
|
||||||
|
);
|
||||||
static void Initialize(const char* filename);
|
static void Initialize(const char* filename);
|
||||||
static int32_t Load(const char* filename);
|
static int32_t Load(const char* filename);
|
||||||
static int32_t Load(HOSFILE fileHandle);
|
static int32_t Load(HOSFILE fileHandle);
|
||||||
|
@ -3,11 +3,32 @@
|
|||||||
#include "client/Gui.hpp"
|
#include "client/Gui.hpp"
|
||||||
#include "console/Console.hpp"
|
#include "console/Console.hpp"
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
|
#include "console/Command.hpp"
|
||||||
#include "event/Input.hpp"
|
#include "event/Input.hpp"
|
||||||
|
#include "gx/Gx.hpp"
|
||||||
#include "gx/Device.hpp"
|
#include "gx/Device.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
|
||||||
|
CVar* s_cvHwDetect;
|
||||||
|
CVar* s_cvGxFixedFunction;
|
||||||
|
CVar* s_cvGxWindowResizeLock;
|
||||||
|
CVar* s_cvGxVideoOptionsVersion;
|
||||||
|
CVar* s_cvGxMaxFPSBk;
|
||||||
|
CVar* s_cvGxMaxFPS;
|
||||||
|
CVar* s_cvGxOverride;
|
||||||
|
CVar* s_cvGxStereoEnabled;
|
||||||
|
CVar* s_cvGxFixLag;
|
||||||
|
CVar* s_cvGxMultisampleQuality;
|
||||||
|
CVar* s_cvGxMultisample;
|
||||||
|
CVar* s_cvGxCursor;
|
||||||
|
CVar* s_cvGxAspect;
|
||||||
|
CVar* s_cvGxVSync;
|
||||||
|
CVar* s_cvGxTripleBuffer;
|
||||||
|
CVar* s_cvGxRefresh;
|
||||||
|
CVar* s_cvGxDepthBits;
|
||||||
|
CVar* s_cvGxColorBits;
|
||||||
CVar* s_cvGxMaximize;
|
CVar* s_cvGxMaximize;
|
||||||
CVar* s_cvGxResolution;
|
CVar* s_cvGxResolution;
|
||||||
CVar* s_cvGxWidescreen;
|
CVar* s_cvGxWidescreen;
|
||||||
@ -44,6 +65,87 @@ EGxApi g_gxApiSupported[] = {
|
|||||||
|
|
||||||
size_t g_numGxApiSupported = sizeof(g_gxApiSupported) / sizeof(EGxApi);
|
size_t g_numGxApiSupported = sizeof(g_gxApiSupported) / sizeof(EGxApi);
|
||||||
|
|
||||||
|
|
||||||
|
bool CVGxWindowResizeLockCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GxVideoOptionsVersionCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxMaxFPSBkCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxMaxFPSCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxOverrideCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxStereoEnabledCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxFixLagCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxMultisampleQualityCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxMultisampleCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxCursorCallback(CVar*, const char*, const char* value, void*) {
|
||||||
|
s_requestedFormat.hwCursor = SStrToInt(value) != 0;
|
||||||
|
ConsoleWrite("set pending gxRestart", DEFAULT_COLOR);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxAspectCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxVSyncCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxTripleBufferCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxRefreshCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxDepthBitsCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxColorBitsCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool CVGxMaximizeCallback(CVar*, const char*, const char*, void*) {
|
bool CVGxMaximizeCallback(CVar*, const char*, const char*, void*) {
|
||||||
// TODO
|
// TODO
|
||||||
return true;
|
return true;
|
||||||
@ -92,6 +194,11 @@ bool CVGxApiCallback(CVar* h, const char* oldValue, const char* newValue, void*
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t CCGxRestart(const char*, const char*) {
|
||||||
|
// TODO
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
EGxApi GxApiDefault() {
|
EGxApi GxApiDefault() {
|
||||||
#if defined(WHOA_SYSTEM_WIN)
|
#if defined(WHOA_SYSTEM_WIN)
|
||||||
return GxApi_D3d9;
|
return GxApi_D3d9;
|
||||||
@ -107,112 +214,76 @@ EGxApi GxApiDefault() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RegisterGxCVars() {
|
void RegisterGxCVars() {
|
||||||
auto& format = s_defaults.format;
|
const auto& format = s_defaults.format;
|
||||||
|
|
||||||
// TODO CURRENT_LANGUAGE check?
|
// TODO: bool isChinese = s_currentLocaleIndex == 4 (zhCN)
|
||||||
auto v1 = true;
|
bool isChinese = false;
|
||||||
|
|
||||||
s_cvGxWidescreen = CVar::Register(
|
const uint32_t graphics = CATEGORY::GRAPHICS;
|
||||||
"widescreen",
|
|
||||||
"Allow widescreen support",
|
|
||||||
0x0,
|
|
||||||
"1",
|
|
||||||
nullptr,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
nullptr,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
s_cvGxWindow = CVar::Register(
|
s_cvGxWidescreen = CVar::Register("widescreen", "Allow widescreen support", 0x0, "1", nullptr, graphics);
|
||||||
"gxWindow",
|
s_cvGxWindow = CVar::Register("gxWindow", "toggle fullscreen/window", 0x1 | 0x2, isChinese ? "1" : "0", &CVGxWindowCallback, graphics);
|
||||||
"toggle fullscreen/window",
|
s_cvGxMaximize = CVar::Register("gxMaximize", "maximize game window", 0x1 | 0x2, isChinese ? "1" : "0", &CVGxMaximizeCallback, graphics);
|
||||||
0x1 | 0x2,
|
|
||||||
v1 ? "1" : "0",
|
|
||||||
&CVGxWindowCallback,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
s_cvGxMaximize = CVar::Register(
|
char value[260] = {};
|
||||||
"gxMaximize",
|
SStrPrintf(value, sizeof(value), "%s", CGxFormat::formatToColorBitsString[format.colorFormat]);
|
||||||
"maximize game window",
|
s_cvGxColorBits = CVar::Register("gxColorBits", "color bits", 0x1 | 0x2, value, &CVGxColorBitsCallback, graphics);
|
||||||
0x1 | 0x2,
|
|
||||||
v1 ? "1" : "0",
|
|
||||||
&CVGxMaximizeCallback,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO s_cvGxColorBits
|
SStrPrintf(value, sizeof(value), "%s", CGxFormat::formatToColorBitsString[format.depthFormat]);
|
||||||
// TODO s_cvGxDepthBits
|
s_cvGxDepthBits = CVar::Register("gxDepthBits", "depth bits", 0x1 | 0x2, value, &CVGxDepthBitsCallback, graphics);
|
||||||
|
|
||||||
char resolution[260];
|
SStrPrintf(value, 260, "%dx%d", format.size.x, format.size.y);
|
||||||
SStrPrintf(resolution, 260, "%dx%d", format.size.x, format.size.y);
|
s_cvGxResolution = CVar::Register("gxResolution", "resolution", 0x1 | 0x2, value, &CVGxResolutionCallback, graphics);
|
||||||
s_cvGxResolution = CVar::Register(
|
|
||||||
"gxResolution",
|
|
||||||
"resolution",
|
|
||||||
0x1 | 0x2,
|
|
||||||
resolution,
|
|
||||||
&CVGxResolutionCallback,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
nullptr,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO s_cvGxRefresh
|
s_cvGxRefresh = CVar::Register("gxRefresh", "refresh rate", 0x1 | 0x2, "75", &CVGxRefreshCallback, graphics);
|
||||||
// TODO s_cvGxTripleBuffer
|
s_cvGxTripleBuffer = CVar::Register("gxTripleBuffer", "triple buffer", 0x1 | 0x2, "0", &CVGxTripleBufferCallback, graphics);
|
||||||
// TODO s_cvGxApi
|
s_cvGxApi = CVar::Register("gxApi", "graphics api", 0x1 | 0x2, g_gxApiNames[GxApiDefault()], &CVGxApiCallback, graphics);
|
||||||
|
|
||||||
s_cvGxApi = CVar::Register(
|
s_cvGxVSync = CVar::Register("gxVSync", "vsync on or off", 0x1 | 0x2, "1", &CVGxVSyncCallback, graphics);
|
||||||
"gxApi",
|
s_cvGxAspect = CVar::Register("gxAspect", "constrain window aspect", 0x1 | 0x2, "1", &CVGxAspectCallback, graphics);
|
||||||
"graphics api",
|
|
||||||
0x1 | 0x2,
|
|
||||||
g_gxApiNames[GxApiDefault()],
|
|
||||||
CVGxApiCallback,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
nullptr,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO s_cvGxVSync
|
s_cvGxCursor = CVar::Register("gxCursor", "toggle hardware cursor", 0x1 | 0x2, "1", &CVGxCursorCallback, graphics);
|
||||||
// TODO s_cvGxAspect
|
|
||||||
// TODO s_cvGxCursor
|
// TODO: v10 = *(_DWORD*)(dword_CABB60 + 84);
|
||||||
// TODO s_cvGxMultisample
|
int v10 = 0;
|
||||||
// TODO s_cvGxFixLag
|
SStrPrintf(value, sizeof(value), "%d", v10);
|
||||||
// TODO s_cvGxStereoEnabled
|
s_cvGxMultisample = CVar::Register("gxMultisample", "multisample", 0x1 | 0x2, value, &CVGxMultisampleCallback, graphics);
|
||||||
// TODO s_cvGxOverride
|
s_cvGxMultisampleQuality = CVar::Register("gxMultisampleQuality", "multisample quality", 0x1 | 0x2, "0.0", &CVGxMultisampleQualityCallback, graphics);
|
||||||
// TODO s_cvGxAspect
|
|
||||||
// TODO s_cvGxMaxFPS
|
// TODO: v10 = *(_DWORD*)(dword_CABB60 + 80);
|
||||||
// TODO s_cvGxMaxFPSBk
|
SStrPrintf(value, sizeof(value), "%d", v10);
|
||||||
// TODO s_cvWindowResizeLock
|
s_cvGxFixLag = CVar::Register("gxFixLag", "prevent cursor lag", 0x1 | 0x2, value, &CVGxFixLagCallback, graphics);
|
||||||
// TODO s_cvFixedFunction
|
s_cvGxStereoEnabled = CVar::Register("gxStereoEnabled", "Enable stereoscopic rendering", 0x1, "0", &CVGxStereoEnabledCallback, graphics);
|
||||||
|
s_cvGxOverride = CVar::Register("gxOverride", "gx overrides", 0x1, "", &CVGxOverrideCallback, graphics);
|
||||||
|
s_cvGxMaxFPS = CVar::Register("maxFPS", "Set FPS limit", 0x1, "200", &CVGxMaxFPSCallback, graphics);
|
||||||
|
s_cvGxMaxFPSBk = CVar::Register("maxFPSBk", "Set background FPS limit", 0x1, "30", &CVGxMaxFPSBkCallback, graphics);
|
||||||
|
s_cvGxVideoOptionsVersion = CVar::Register("videoOptionsVersion", "Video options version", 0x1 | 0x2, "0", &GxVideoOptionsVersionCallback, graphics);
|
||||||
|
s_cvGxWindowResizeLock = CVar::Register("windowResizeLock", "prevent resizing in windowed mode", 1, "0", &CVGxWindowResizeLockCallback, graphics);
|
||||||
|
s_cvGxFixedFunction = CVar::Register("fixedFunction", "Force fixed function rendering", 0x1 | 0x2, "0", 0, graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateGxCVars() {
|
void UpdateGxCVars() {
|
||||||
// TODO others
|
s_cvGxColorBits->Update();
|
||||||
|
s_cvGxDepthBits->Update();
|
||||||
s_cvGxWindow->Update();
|
s_cvGxWindow->Update();
|
||||||
s_cvGxResolution->Update();
|
s_cvGxResolution->Update();
|
||||||
|
s_cvGxRefresh->Update();
|
||||||
// TODO others
|
s_cvGxTripleBuffer->Update();
|
||||||
|
s_cvGxApi->Update();
|
||||||
|
s_cvGxVSync->Update();
|
||||||
|
s_cvGxAspect->Update();
|
||||||
s_cvGxMaximize->Update();
|
s_cvGxMaximize->Update();
|
||||||
|
s_cvGxCursor->Update();
|
||||||
// TODO others
|
s_cvGxMultisample->Update();
|
||||||
|
s_cvGxMultisampleQuality->Update();
|
||||||
|
s_cvGxFixLag->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetGxCVars(const CGxFormat& format) {
|
void SetGxCVars(const CGxFormat& format) {
|
||||||
char value[1024];
|
char value[1024] = {};
|
||||||
|
|
||||||
// TODO s_cvGxColorBits
|
s_cvGxColorBits->Set(CGxFormat::formatToColorBitsString[format.colorFormat], true, false, false, true);
|
||||||
// TODO s_cvGxDepthBits
|
s_cvGxDepthBits->Set(CGxFormat::formatToColorBitsString[format.depthFormat], true, false, false, true);
|
||||||
|
|
||||||
SStrPrintf(value, sizeof(value), "%d", format.window);
|
SStrPrintf(value, sizeof(value), "%d", format.window);
|
||||||
s_cvGxWindow->Set(value, true, false, false, true);
|
s_cvGxWindow->Set(value, true, false, false, true);
|
||||||
@ -220,43 +291,106 @@ void SetGxCVars(const CGxFormat& format) {
|
|||||||
SStrPrintf(value, sizeof(value), "%dx%d", format.size.x, format.size.y);
|
SStrPrintf(value, sizeof(value), "%dx%d", format.size.x, format.size.y);
|
||||||
s_cvGxResolution->Set(value, true, false, false, true);
|
s_cvGxResolution->Set(value, true, false, false, true);
|
||||||
|
|
||||||
// TODO s_cvGxRefresh
|
SStrPrintf(value, sizeof(value), "%d", format.refreshRate);
|
||||||
// TODO others
|
s_cvGxRefresh->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
// TODO: (format + 28) > 1
|
||||||
|
s_cvGxTripleBuffer->Set("0", true, false, false, true);
|
||||||
|
|
||||||
|
SStrPrintf(value, sizeof(value), "%d", format.vsync);
|
||||||
|
s_cvGxVSync->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
// TODO: format.aspectRatio
|
||||||
|
SStrPrintf(value, sizeof(value), "%d", 0);
|
||||||
|
s_cvGxAspect->Set(value, true, false, false, true);
|
||||||
|
|
||||||
SStrPrintf(value, sizeof(value), "%d", format.maximize);
|
SStrPrintf(value, sizeof(value), "%d", format.maximize);
|
||||||
s_cvGxMaximize->Set(value, true, false, false, true);
|
s_cvGxMaximize->Set(value, true, false, false, true);
|
||||||
|
|
||||||
// TODO others
|
SStrPrintf(value, sizeof(value), "%d", format.hwCursor);
|
||||||
|
s_cvGxCursor->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
SStrPrintf(value, sizeof(value), "%d", format.sampleCount);
|
||||||
|
s_cvGxMultisample->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
// TODO: format.multisampleQuality
|
||||||
|
SStrPrintf(value, sizeof(value), "%f", 0.0f);
|
||||||
|
s_cvGxMultisampleQuality->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
SStrPrintf(value, sizeof(value), "%d", format.fixLag);
|
||||||
|
s_cvGxFixLag->Set(value, true, false, false, true);
|
||||||
|
|
||||||
UpdateGxCVars();
|
UpdateGxCVars();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleDeviceInitialize(const char* title) {
|
void ConsoleDeviceInitialize(const char* title) {
|
||||||
// TODO
|
GxLogOpen();
|
||||||
|
|
||||||
|
s_cvHwDetect = CVar::Register("hwDetect", "do hardware detection", 0x1, "1", nullptr, CATEGORY::GRAPHICS);
|
||||||
|
|
||||||
|
// TODO: sub_76BA30(&unk_CABB38, &byte_CABCBD); << ConsoleDetect
|
||||||
|
// TODO: byte_CABCBC = 1;
|
||||||
|
|
||||||
|
if (CmdLineGetBool(WOWCMD_HW_DETECT) || s_cvHwDetect->GetInt() != 0) {
|
||||||
|
s_hwDetect = true;
|
||||||
|
s_cvHwDetect->Set("0", true, false, false, true);
|
||||||
|
} else {
|
||||||
|
s_hwDetect = false;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO proper logic
|
|
||||||
s_hwDetect = true;
|
|
||||||
|
|
||||||
ConsoleAccessSetEnabled(CmdLineGetBool(WOWCMD_CONSOLE));
|
ConsoleAccessSetEnabled(CmdLineGetBool(WOWCMD_CONSOLE));
|
||||||
|
|
||||||
// TODO
|
// TODO: sub_76B520(&unk_CABAF0, &unk_CABB38);
|
||||||
|
|
||||||
|
// CHANGE: Remove this when the rest will be ready
|
||||||
|
s_defaults.format.size.x = 1024;
|
||||||
|
s_defaults.format.size.y = 768;
|
||||||
|
s_defaults.format.colorFormat = CGxFormat::Fmt_Argb8888;
|
||||||
|
s_defaults.format.depthFormat = CGxFormat::Fmt_Ds248;
|
||||||
|
|
||||||
RegisterGxCVars();
|
RegisterGxCVars();
|
||||||
|
ConsoleCommandRegister("gxRestart", &CCGxRestart, CATEGORY::GRAPHICS, nullptr);
|
||||||
|
|
||||||
// TODO ConsoleCommandRegister("gxRestart", &CCGxRestart, 1, nullptr);
|
// TODO: GxAdapterMonitorModes((int)&unk_CABCC8);
|
||||||
|
// TODO: ValidateFormatMonitor(&unk_CABDA8);
|
||||||
|
|
||||||
// TODO
|
// TODO: if ( GxAdapterDesktopMode(&v28) )
|
||||||
|
if (true) {
|
||||||
|
s_requestedFormat.size.x = 1024;
|
||||||
|
s_requestedFormat.size.y = 768;
|
||||||
|
s_requestedFormat.colorFormat = CGxFormat::Fmt_Argb8888;
|
||||||
|
s_requestedFormat.depthFormat = CGxFormat::Fmt_Ds248;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
GxLog("ConsoleDeviceInitialize(): hwDetect = %d, hwChanged = %d", s_hwDetect, s_hwChanged);
|
||||||
// - source the size values correctly
|
|
||||||
s_requestedFormat.size.x = 1024;
|
if (CmdLineGetBool(WOWCMD_RES_800x600)) {
|
||||||
s_requestedFormat.size.y = 768;
|
s_requestedFormat.size.x = 800;
|
||||||
s_requestedFormat.colorFormat = CGxFormat::Fmt_Argb8888;
|
s_requestedFormat.size.y = 600;
|
||||||
s_requestedFormat.depthFormat = CGxFormat::Fmt_Ds248;
|
} else if (CmdLineGetBool(WOWCMD_RES_1024x768)) {
|
||||||
|
s_requestedFormat.size.x = 1024;
|
||||||
|
s_requestedFormat.size.y = 768;
|
||||||
|
} else if (CmdLineGetBool(WOWCMD_RES_1280x960)) {
|
||||||
|
s_requestedFormat.size.x = 1280;
|
||||||
|
s_requestedFormat.size.y = 960;
|
||||||
|
} else if (CmdLineGetBool(WOWCMD_RES_1280x1024)) {
|
||||||
|
s_requestedFormat.size.x = 1280;
|
||||||
|
s_requestedFormat.size.y = 1024;
|
||||||
|
} else if (CmdLineGetBool(WOWCMD_RES_1600x1200)) {
|
||||||
|
s_requestedFormat.size.x = 1600;
|
||||||
|
s_requestedFormat.size.y = 1200;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s_cvGxFixedFunction->GetInt() != 0) {
|
||||||
|
// TODO: (dword_CABD20 = 0) s_requestedFormat.unknown_field = 0;
|
||||||
|
s_requestedFormat.pos.y = 0; // <--- CHECK THIS
|
||||||
|
s_requestedFormat.pos.x = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (s_hwDetect || s_hwChanged) {
|
if (s_hwDetect || s_hwChanged) {
|
||||||
// TODO Sub76B3F0(&UnkCABAF0, &UnkCABB38);
|
// TODO Sub76B3F0(&UnkCABAF0, &UnkCABB38);
|
||||||
// TODO s_cvFixedFunction->Set("0", 1, 0, 0, 1);
|
s_cvGxFixedFunction->Set("0", true, false, false, true);
|
||||||
// TODO memcpy(&s_requestedFormat, &s_defaults.format, sizeof(s_requestedFormat));
|
// TODO memcpy(&s_requestedFormat, &s_defaults.format, sizeof(s_requestedFormat));
|
||||||
|
|
||||||
s_requestedFormat.window = s_cvGxWindow->GetInt() != 0;
|
s_requestedFormat.window = s_cvGxWindow->GetInt() != 0;
|
||||||
@ -268,18 +402,6 @@ void ConsoleDeviceInitialize(const char* title) {
|
|||||||
SetGxCVars(s_requestedFormat);
|
SetGxCVars(s_requestedFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
// TODO s_requestedFormat.hwTnL = !CmdLineGetBool(CMD_SW_TNL);
|
|
||||||
s_requestedFormat.hwTnL = true;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
s_requestedFormat.hwCursor = true;
|
|
||||||
|
|
||||||
CGxFormat format;
|
|
||||||
memcpy(&format, &s_requestedFormat, sizeof(s_requestedFormat));
|
|
||||||
|
|
||||||
// Select gxApi based on user CVars and command-line parameters
|
|
||||||
EGxApi api = GxApiDefault();
|
EGxApi api = GxApiDefault();
|
||||||
|
|
||||||
auto gxApiName = s_cvGxApi->GetString();
|
auto gxApiName = s_cvGxApi->GetString();
|
||||||
@ -287,6 +409,12 @@ void ConsoleDeviceInitialize(const char* title) {
|
|||||||
auto gxOverride = CmdLineGetString(WOWCMD_GX_OVERRIDE);
|
auto gxOverride = CmdLineGetString(WOWCMD_GX_OVERRIDE);
|
||||||
if (*gxOverride != '\0') {
|
if (*gxOverride != '\0') {
|
||||||
gxApiName = gxOverride;
|
gxApiName = gxOverride;
|
||||||
|
} else if (CmdLineGetBool(CMD_OPENGL)) {
|
||||||
|
gxApiName = g_gxApiNames[GxApi_OpenGl];
|
||||||
|
} else if (CmdLineGetBool(CMD_D3D)) {
|
||||||
|
gxApiName = g_gxApiNames[GxApi_D3d9];
|
||||||
|
} else if (CmdLineGetBool(CMD_D3D9EX)) {
|
||||||
|
gxApiName = g_gxApiNames[GxApi_D3d9Ex];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitize chosen gxApi against list of supported gxApis
|
// Sanitize chosen gxApi against list of supported gxApis
|
||||||
@ -298,13 +426,28 @@ void ConsoleDeviceInitialize(const char* title) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log
|
s_requestedFormat.fixLag = s_cvGxFixLag->GetInt() != 0;
|
||||||
printf("GxApi_%s selected\n", g_gxApiNames[api]);
|
s_requestedFormat.hwTnL = !CmdLineGetBool(CMD_SW_TNL);
|
||||||
|
|
||||||
|
bool windowed = s_cvGxWindow->GetInt() != 0;
|
||||||
|
if (CmdLineGetBool(CMD_FULL_SCREEN)) {
|
||||||
|
windowed = false;
|
||||||
|
} else if (CmdLineGetBool(WOWCMD_WINDOWED)) {
|
||||||
|
windowed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_requestedFormat.window = windowed;
|
||||||
|
// TODO: byte_CABD47 = windowed;
|
||||||
|
|
||||||
|
GxLog("GxApi_%s selected\n", g_gxApiNames[api]);
|
||||||
|
|
||||||
// Set internally (CVar value reflects the current gxApi at launch),
|
// Set internally (CVar value reflects the current gxApi at launch),
|
||||||
// this will not Set() as CVar gxApi is latched
|
// this will not Set() as CVar gxApi is latched
|
||||||
s_cvGxApi->InternalSet(g_gxApiNames[api], true, false, false, true);
|
s_cvGxApi->InternalSet(g_gxApiNames[api], true, false, false, true);
|
||||||
|
|
||||||
|
CGxFormat format;
|
||||||
|
memcpy(&format, &s_requestedFormat, sizeof(s_requestedFormat));
|
||||||
|
|
||||||
CGxDevice* device = GxDevCreate(api, OsWindowProc, format);
|
CGxDevice* device = GxDevCreate(api, OsWindowProc, format);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -106,6 +106,14 @@ uint32_t CGxDevice::s_texFormatBytesPerBlock[] = {
|
|||||||
CGxShader* CGxDevice::s_uiVertexShader = nullptr;
|
CGxShader* CGxDevice::s_uiVertexShader = nullptr;
|
||||||
CGxShader* CGxDevice::s_uiPixelShader = nullptr;
|
CGxShader* CGxDevice::s_uiPixelShader = nullptr;
|
||||||
|
|
||||||
|
void CGxDevice::LogOpen() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGxDevice::LogClose() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
void CGxDevice::Log(const char* format, ...) {
|
void CGxDevice::Log(const char* format, ...) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,8 @@ class CGxDevice {
|
|||||||
static CGxShader* s_uiPixelShader;
|
static CGxShader* s_uiPixelShader;
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
|
static void LogOpen();
|
||||||
|
static void LogClose();
|
||||||
static void Log(const char* format, ...);
|
static void Log(const char* format, ...);
|
||||||
static void Log(const CGxFormat& format);
|
static void Log(const CGxFormat& format);
|
||||||
#if defined(WHOA_SYSTEM_WIN)
|
#if defined(WHOA_SYSTEM_WIN)
|
||||||
|
3
src/gx/CGxFormat.cpp
Normal file
3
src/gx/CGxFormat.cpp
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#include "gx/CGxFormat.hpp"
|
||||||
|
|
||||||
|
const char* CGxFormat::formatToColorBitsString[Formats_Last] = { "16", "24", "24", "30", "16", "24", "24", "32" };
|
@ -19,6 +19,8 @@ class CGxFormat {
|
|||||||
Formats_Last = 8
|
Formats_Last = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char* formatToColorBitsString[Formats_Last];
|
||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
bool hwTnL;
|
bool hwTnL;
|
||||||
bool hwCursor;
|
bool hwCursor;
|
||||||
|
@ -59,3 +59,15 @@ void GxFormatColor(CImVector& color) {
|
|||||||
color = formattedColor;
|
color = formattedColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxLogOpen() {
|
||||||
|
CGxDevice::LogOpen();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxLogClose() {
|
||||||
|
CGxDevice::LogClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxLog(const char* format, ...) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
@ -18,4 +18,10 @@ void GxCapsWindowSize(CRect&);
|
|||||||
|
|
||||||
void GxFormatColor(CImVector&);
|
void GxFormatColor(CImVector&);
|
||||||
|
|
||||||
|
void GxLogOpen();
|
||||||
|
|
||||||
|
void GxLogClose();
|
||||||
|
|
||||||
|
void GxLog(const char* format, ...);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user