mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-08 18:36:00 +03:00
Compare commits
No commits in common. "102fc51aef138f69b2a874eab8c6cf3a549d120b" and "d59589550d74bc230baee6d3c5cde0174c509652" have entirely different histories.
102fc51aef
...
d59589550d
@ -163,7 +163,7 @@ void CGGameUI::Initialize() {
|
|||||||
//CGGameUI::SomeSavedAccountVariables((int)v23);
|
//CGGameUI::SomeSavedAccountVariables((int)v23);
|
||||||
//LoadAccountData(6, (int(__cdecl*)(int, int, int))sub_5183A0, 0);
|
//LoadAccountData(6, (int(__cdecl*)(int, int, int))sub_5183A0, 0);
|
||||||
//CGGameUI::UpdateInitCounter();
|
//CGGameUI::UpdateInitCounter();
|
||||||
CGUIBindings::LoadBindings();
|
//CGUIBindings::LoadBindings();
|
||||||
//CGUIMacros::Initialize();
|
//CGUIMacros::Initialize();
|
||||||
//CGUIMacros::LoadMacros();
|
//CGUIMacros::LoadMacros();
|
||||||
//CGChat::LoadChatSettings();
|
//CGChat::LoadChatSettings();
|
||||||
|
|||||||
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
static CStatus s_nullStatus;
|
static CStatus s_nullStatus;
|
||||||
static uint16_t s_initRound = 0;
|
static uint16_t s_initRound = 0;
|
||||||
static uint32_t s_loadPendingMask = 0;
|
|
||||||
|
|
||||||
CGUIBindings* CGUIBindings::s_bindings = nullptr;
|
CGUIBindings* CGUIBindings::s_bindings = nullptr;
|
||||||
|
|
||||||
@ -115,7 +114,7 @@ static bool ValidateKeyString(const char* key) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MODIFIEDCLICK::SetBinding(BINDING_SET set, const char* binding) {
|
void MODIFIEDCLICK::SetBinding(BINDING_SET a1, const char* binding) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -126,63 +125,6 @@ void CGUIBindings::Initialize() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGUIBindings::LoadBindings() {
|
|
||||||
char* buffer = nullptr;
|
|
||||||
if (SFile::Load(nullptr, "WTF\\DefaultBindings.wtf", reinterpret_cast<void**>(&buffer), nullptr, 1, 1, nullptr)) {
|
|
||||||
CGUIBindings::LoadBindings(BINDING_DEFAULT, buffer);
|
|
||||||
SFile::Unload(buffer);
|
|
||||||
// TODO: LoadJoystickConfig
|
|
||||||
}
|
|
||||||
s_loadPendingMask = 6;
|
|
||||||
// TODO: LoadAccountData
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGUIBindings::LoadBindings(BINDING_SET set, const char* buffer) {
|
|
||||||
auto bindings = CGUIBindings::s_bindings;
|
|
||||||
|
|
||||||
if (!CGUIBindings::s_bindings) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (set != BINDING_DEFAULT) {
|
|
||||||
// TODO: bindings->CopyBindings(BINDING_DEFAULT, set);
|
|
||||||
}
|
|
||||||
|
|
||||||
BINDING_MODE mode = BINDING_MODE_0;
|
|
||||||
|
|
||||||
while (*buffer) {
|
|
||||||
char token[1024];
|
|
||||||
SStrTokenize(&buffer, token, sizeof(token), "\r\n", nullptr);
|
|
||||||
|
|
||||||
char* line = token;
|
|
||||||
while (*line == ' ' || *line == '\t') {
|
|
||||||
++line;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(line, "BINDINGMODE ", 12)) {
|
|
||||||
auto value = SStrToInt(&line[12]);
|
|
||||||
if (value <= BINDING_MODE_3) {
|
|
||||||
mode = static_cast<BINDING_MODE>(value);
|
|
||||||
}
|
|
||||||
} else if (!SStrCmpI(line, "bind ", 5)) {
|
|
||||||
const char* command = &line[5];
|
|
||||||
char keystring[32];
|
|
||||||
SStrTokenize(&command, keystring, sizeof(keystring), " ", nullptr);
|
|
||||||
bindings->Bind(set, mode, keystring, command);
|
|
||||||
} else if (!SStrCmpI(line, "modifiedclick ", 14)) {
|
|
||||||
const char* command = &line[14];
|
|
||||||
char keystring[32];
|
|
||||||
SStrTokenize(&command, keystring, sizeof(keystring), " ", nullptr);
|
|
||||||
if (command) {
|
|
||||||
auto modifiedClick = bindings->m_modifiedClicks.Ptr(command);
|
|
||||||
if (modifiedClick)
|
|
||||||
modifiedClick->SetBinding(set, keystring);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CGUIBindings::Load(const char* commandsFile, MD5_CTX* md5, CStatus* status) {
|
bool CGUIBindings::Load(const char* commandsFile, MD5_CTX* md5, CStatus* status) {
|
||||||
if (!status) {
|
if (!status) {
|
||||||
status = &s_nullStatus;
|
status = &s_nullStatus;
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class KEYCOMMAND : public TSHashObject<KEYCOMMAND, HASHKEY_STRI> {
|
|||||||
|
|
||||||
class MODIFIEDCLICK : public TSHashObject<MODIFIEDCLICK, HASHKEY_STRI> {
|
class MODIFIEDCLICK : public TSHashObject<MODIFIEDCLICK, HASHKEY_STRI> {
|
||||||
public:
|
public:
|
||||||
void SetBinding(BINDING_SET set, const char* binding);
|
void SetBinding(BINDING_SET a1, const char* binding);
|
||||||
|
|
||||||
int32_t index;
|
int32_t index;
|
||||||
};
|
};
|
||||||
@ -53,8 +53,6 @@ class CGUIBindings {
|
|||||||
static CGUIBindings* s_bindings;
|
static CGUIBindings* s_bindings;
|
||||||
|
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void LoadBindings();
|
|
||||||
static void LoadBindings(BINDING_SET set, const char* buffer);
|
|
||||||
|
|
||||||
|
|
||||||
CGUIBindings() = default;
|
CGUIBindings() = default;
|
||||||
@ -68,9 +66,9 @@ class CGUIBindings {
|
|||||||
int32_t GetNumCommandKeys(BINDING_SET set, BINDING_MODE mode, const char* command);
|
int32_t GetNumCommandKeys(BINDING_SET set, BINDING_MODE mode, const char* command);
|
||||||
void AdjustCommandKeyIndices(BINDING_SET set, BINDING_MODE mode, const char* command, int32_t index);
|
void AdjustCommandKeyIndices(BINDING_SET set, BINDING_MODE mode, const char* command, int32_t index);
|
||||||
|
|
||||||
int32_t m_numCommands = 0;
|
int32_t m_numCommands;
|
||||||
int32_t m_numHiddenCommands = 0;
|
int32_t m_numHiddenCommands;
|
||||||
int32_t m_numModifiedClicks = 0;
|
int32_t m_numModifiedClicks;
|
||||||
TSHashTable<KEYBINDING, HASHKEY_STRI> m_bindings[4];
|
TSHashTable<KEYBINDING, HASHKEY_STRI> m_bindings[4];
|
||||||
TSHashTable<KEYCOMMAND, HASHKEY_STRI> m_commands;
|
TSHashTable<KEYCOMMAND, HASHKEY_STRI> m_commands;
|
||||||
TSHashTable<MODIFIEDCLICK, HASHKEY_STRI> m_modifiedClicks;
|
TSHashTable<MODIFIEDCLICK, HASHKEY_STRI> m_modifiedClicks;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user