mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-07-25 18:05:49 +03:00
Compare commits
8 Commits
f1d1dad08b
...
f039d4f88c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f039d4f88c | ||
![]() |
465b3844de | ||
![]() |
03ba4ccbb1 | ||
![]() |
6c76720c04 | ||
![]() |
f525e600a2 | ||
![]() |
a9bb4ccdce | ||
![]() |
1ad95653c7 | ||
![]() |
49e2e439c2 |
@ -110,8 +110,6 @@ int32_t RealmConnection::HandleAuthChallenge(AuthenticationChallenge* challenge)
|
|||||||
// TODO switch to WDataStore
|
// TODO switch to WDataStore
|
||||||
CDataStore msg;
|
CDataStore msg;
|
||||||
|
|
||||||
uint32_t localChallenge;
|
|
||||||
|
|
||||||
msg.Put(static_cast<uint32_t>(CMSG_AUTH_SESSION));
|
msg.Put(static_cast<uint32_t>(CMSG_AUTH_SESSION));
|
||||||
|
|
||||||
msg.Put(static_cast<uint32_t>(12340));
|
msg.Put(static_cast<uint32_t>(12340));
|
||||||
@ -119,7 +117,8 @@ int32_t RealmConnection::HandleAuthChallenge(AuthenticationChallenge* challenge)
|
|||||||
msg.PutString(this->GetLoginData().m_account);
|
msg.PutString(this->GetLoginData().m_account);
|
||||||
msg.Put(static_cast<uint32_t>(this->GetLoginData().m_loginServerType));
|
msg.Put(static_cast<uint32_t>(this->GetLoginData().m_loginServerType));
|
||||||
|
|
||||||
// TODO
|
// TODO: uint32_t localChallenge = NTempest::CRandom::uint32_(v11);
|
||||||
|
uint32_t localChallenge = 0;
|
||||||
msg.Put(localChallenge);
|
msg.Put(localChallenge);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -152,6 +152,13 @@ void CBackdropGenerator::LoadXML(XMLNode* node, CStatus* status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBackdropGenerator::SetVertexColor(const CImVector& color) {
|
||||||
|
this->m_color = color;
|
||||||
|
if (this->m_backgroundTexture) {
|
||||||
|
this->m_backgroundTexture->SetVertexColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CBackdropGenerator::SetBorderVertexColor(const CImVector& borderColor) {
|
void CBackdropGenerator::SetBorderVertexColor(const CImVector& borderColor) {
|
||||||
this->m_borderColor = borderColor;
|
this->m_borderColor = borderColor;
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ class CBackdropGenerator {
|
|||||||
CBackdropGenerator();
|
CBackdropGenerator();
|
||||||
void Generate(const CRect* rect);
|
void Generate(const CRect* rect);
|
||||||
void LoadXML(XMLNode* node, CStatus* status);
|
void LoadXML(XMLNode* node, CStatus* status);
|
||||||
|
void SetVertexColor(const CImVector& color);
|
||||||
void SetBorderVertexColor(const CImVector& borderColor);
|
void SetBorderVertexColor(const CImVector& borderColor);
|
||||||
void SetOutput(CSimpleFrame* frame);
|
void SetOutput(CSimpleFrame* frame);
|
||||||
};
|
};
|
||||||
|
@ -79,6 +79,13 @@ void CSimpleEditBox::SetKeyboardFocus(CSimpleEditBox* editBox) {
|
|||||||
editBox->m_dirtyFlags |= 0x4;
|
editBox->m_dirtyFlags |= 0x4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimpleEditBox::ClearKeyboardFocus(CSimpleEditBox* editBox, bool) {
|
||||||
|
if (CSimpleEditBox::s_currentFocus == editBox) {
|
||||||
|
CSimpleEditBox::s_currentFocus = nullptr;
|
||||||
|
// TODO: CSimpleEditBox::OnFocusChange
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CSimpleEditBox::CSimpleEditBox(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
CSimpleEditBox::CSimpleEditBox(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
||||||
this->m_autoFocus = 1;
|
this->m_autoFocus = 1;
|
||||||
this->m_multiline = 0;
|
this->m_multiline = 0;
|
||||||
|
@ -19,6 +19,7 @@ class CSimpleEditBox : public CSimpleFrame, CSimpleFontedFrame {
|
|||||||
static int32_t GetObjectType();
|
static int32_t GetObjectType();
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
static void RegisterScriptMethods(lua_State* L);
|
||||||
static void SetKeyboardFocus(CSimpleEditBox* editBox);
|
static void SetKeyboardFocus(CSimpleEditBox* editBox);
|
||||||
|
static void ClearKeyboardFocus(CSimpleEditBox* editBox, bool);
|
||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
int32_t m_autoFocus : 1;
|
int32_t m_autoFocus : 1;
|
||||||
|
@ -176,11 +176,19 @@ int32_t CSimpleEditBox_GetTextInsets(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleEditBox_SetFocus(lua_State* L) {
|
int32_t CSimpleEditBox_SetFocus(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
int32_t type = CSimpleEditBox::GetObjectType();
|
||||||
|
auto object = static_cast<CSimpleEditBox*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
CSimpleEditBox::SetKeyboardFocus(object);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleEditBox_ClearFocus(lua_State* L) {
|
int32_t CSimpleEditBox_ClearFocus(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
int32_t type = CSimpleEditBox::GetObjectType();
|
||||||
|
auto object = static_cast<CSimpleEditBox*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
CSimpleEditBox::ClearKeyboardFocus(object, true);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleEditBox_HasFocus(lua_State* L) {
|
int32_t CSimpleEditBox_HasFocus(lua_State* L) {
|
||||||
|
@ -132,7 +132,17 @@ int32_t CSimpleFontString_SetText(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFontString_SetFormattedText(lua_State* L) {
|
int32_t CSimpleFontString_SetFormattedText(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleFontString::GetObjectType();
|
||||||
|
auto string = static_cast<CSimpleFontString*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
if (!string->m_font) {
|
||||||
|
luaL_error(L, "%s:SetFormattedText(): Font not set", string->GetDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[4096] = {};
|
||||||
|
char* text = FrameScript_Sprintf(L, 2, buffer, sizeof(buffer));
|
||||||
|
string->SetText(text, 1);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFontString_GetTextColor(lua_State* L) {
|
int32_t CSimpleFontString_GetTextColor(lua_State* L) {
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
#include "ui/CSimpleFrame.hpp"
|
#include "ui/CSimpleFrame.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
|
#include "ui/CBackdropGenerator.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
|
||||||
int32_t CSimpleFrame_GetTitleRegion(lua_State* L) {
|
int32_t CSimpleFrame_GetTitleRegion(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
}
|
}
|
||||||
@ -460,7 +462,17 @@ int32_t CSimpleFrame_GetBackdropColor(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_SetBackdropColor(lua_State* L) {
|
int32_t CSimpleFrame_SetBackdropColor(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
int32_t type = CSimpleFrame::GetObjectType();
|
||||||
|
auto object = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
CImVector color = { 0 };
|
||||||
|
FrameScript_GetColor(L, 2, color);
|
||||||
|
|
||||||
|
if (object->m_backdrop) {
|
||||||
|
object->m_backdrop->SetVertexColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_GetBackdropBorderColor(lua_State* L) {
|
int32_t CSimpleFrame_GetBackdropBorderColor(lua_State* L) {
|
||||||
@ -468,7 +480,17 @@ int32_t CSimpleFrame_GetBackdropBorderColor(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_SetBackdropBorderColor(lua_State* L) {
|
int32_t CSimpleFrame_SetBackdropBorderColor(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
int32_t type = CSimpleFrame::GetObjectType();
|
||||||
|
auto object = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
CImVector color = { 0 };
|
||||||
|
FrameScript_GetColor(L, 2, color);
|
||||||
|
|
||||||
|
if (object->m_backdrop) {
|
||||||
|
object->m_backdrop->SetBorderVertexColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_SetDepth(lua_State* L) {
|
int32_t CSimpleFrame_SetDepth(lua_State* L) {
|
||||||
|
@ -444,7 +444,7 @@ void FrameScript_GetColor(lua_State* L, int32_t idx, CImVector& color) {
|
|||||||
|
|
||||||
float a = 1.0f;
|
float a = 1.0f;
|
||||||
if (lua_isnumber(L, idx + 3)) {
|
if (lua_isnumber(L, idx + 3)) {
|
||||||
a = lua_tonumber(L, idx + 2);
|
a = lua_tonumber(L, idx + 3);
|
||||||
a = std::max(0.0f, std::min(a, 1.0f));
|
a = std::max(0.0f, std::min(a, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,6 +455,173 @@ lua_State* FrameScript_GetContext(void) {
|
|||||||
return FrameScript::s_context;
|
return FrameScript::s_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* FrameScript_Sprintf(lua_State* L, int32_t idx, char* buffer, uint32_t size) {
|
||||||
|
size_t formatLength = 0;
|
||||||
|
const char* format = luaL_checklstring(L, idx, &formatLength);
|
||||||
|
const char* formatEnd = format + formatLength;
|
||||||
|
|
||||||
|
char* result = buffer;
|
||||||
|
|
||||||
|
if (format >= formatEnd) {
|
||||||
|
*buffer = '\0';
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t currentIndex = idx;
|
||||||
|
|
||||||
|
while (size > 1) {
|
||||||
|
char character = *format++;
|
||||||
|
if (character == '%') {
|
||||||
|
char argument = *format;
|
||||||
|
if (argument == '%') {
|
||||||
|
*buffer++ = '%';
|
||||||
|
++format;
|
||||||
|
--size;
|
||||||
|
} else {
|
||||||
|
char subformat[128] = {};
|
||||||
|
subformat[0] = '%';
|
||||||
|
|
||||||
|
if (argument >= '0' && argument <= '9' && format[1] == '$') {
|
||||||
|
currentIndex = argument + idx - '1';
|
||||||
|
format += 2;
|
||||||
|
}
|
||||||
|
++currentIndex;
|
||||||
|
|
||||||
|
const char* subformatStart = format;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
char flag = *format;
|
||||||
|
if (flag != '-' && flag != '+' && flag != ' ' && flag != '#' && flag != '0') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++format;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (char ch = *format; ch >= '0'; ch = *++format) {
|
||||||
|
if (ch > '9') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*format == '.') {
|
||||||
|
++format;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*format == '-') {
|
||||||
|
++format;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (char ch = *format; ch >= '0'; ch = *++format) {
|
||||||
|
if (ch > '9') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t subformatSize = format - subformatStart;
|
||||||
|
if (subformatSize > 125) {
|
||||||
|
luaL_error(L, "invalid format (width or precision too long)");
|
||||||
|
}
|
||||||
|
|
||||||
|
char specifier = *format++;
|
||||||
|
|
||||||
|
memcpy(&subformat[1], subformatStart, subformatSize + 1);
|
||||||
|
subformat[subformatSize + 2] = '\0'; // Warning: possibility of buffer overrun
|
||||||
|
|
||||||
|
switch (specifier) {
|
||||||
|
case 'E':
|
||||||
|
case 'G':
|
||||||
|
case 'e':
|
||||||
|
case 'f':
|
||||||
|
case 'g': {
|
||||||
|
double number = luaL_checknumber(L, currentIndex);
|
||||||
|
size_t length = SStrPrintf(buffer, size, subformat, number);
|
||||||
|
if (length > 0) {
|
||||||
|
buffer += length;
|
||||||
|
size -= length;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'F': {
|
||||||
|
for (auto s = subformat; *s; ++s) {
|
||||||
|
if (*s == 'F') {
|
||||||
|
*s = 'f';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double number = luaL_checknumber(L, currentIndex);
|
||||||
|
size_t length = SStrPrintf(buffer, size, subformat, number);
|
||||||
|
if (length > 0) {
|
||||||
|
// TODO: lua_convertdecimal(buffer)
|
||||||
|
buffer += length;
|
||||||
|
size -= length;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'X':
|
||||||
|
case 'o':
|
||||||
|
case 'u':
|
||||||
|
case 'x': {
|
||||||
|
auto number = static_cast<uint64_t>(luaL_checknumber(L, currentIndex));
|
||||||
|
size_t length = SStrPrintf(buffer, size, subformat, number);
|
||||||
|
if (length > 0) {
|
||||||
|
buffer += length;
|
||||||
|
size -= length;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'c': {
|
||||||
|
auto number = static_cast<int32_t>(luaL_checknumber(L, currentIndex));
|
||||||
|
*buffer++ = static_cast<char>(number);
|
||||||
|
--size;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'd':
|
||||||
|
case 'i': {
|
||||||
|
auto number = static_cast<int32_t>(luaL_checknumber(L, currentIndex));
|
||||||
|
size_t length = SStrPrintf(buffer, size, subformat, number);
|
||||||
|
if (length > 0) {
|
||||||
|
// TODO: lua_convertdecimal(buffer)
|
||||||
|
buffer += length;
|
||||||
|
size -= length;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 's': {
|
||||||
|
size_t stringLength = 0;
|
||||||
|
auto string = luaL_checklstring(L, currentIndex, &stringLength);
|
||||||
|
size_t length = SStrPrintf(buffer, size, subformat, string);
|
||||||
|
if (length > 0) {
|
||||||
|
buffer += length;
|
||||||
|
size -= length;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
luaL_error(L, "invalid option in `format'");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*buffer++ = character;
|
||||||
|
--size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format >= formatEnd) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*buffer = '\0';
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
const char* FrameScript_GetCurrentObject(lua_State* L, int32_t a2) {
|
const char* FrameScript_GetCurrentObject(lua_State* L, int32_t a2) {
|
||||||
lua_Debug info;
|
lua_Debug info;
|
||||||
|
|
||||||
|
@ -80,6 +80,8 @@ void FrameScript_GetColor(lua_State* L, int32_t idx, CImVector& color);
|
|||||||
|
|
||||||
lua_State* FrameScript_GetContext();
|
lua_State* FrameScript_GetContext();
|
||||||
|
|
||||||
|
char* FrameScript_Sprintf(lua_State * L, int32_t idx, char* buffer, uint32_t size);
|
||||||
|
|
||||||
const char* FrameScript_GetCurrentObject(lua_State* L, int32_t a2);
|
const char* FrameScript_GetCurrentObject(lua_State* L, int32_t a2);
|
||||||
|
|
||||||
char const* FrameScript_GetText(const char* a1, int32_t count, FRAMESCRIPT_GENDER gender);
|
char const* FrameScript_GetText(const char* a1, int32_t count, FRAMESCRIPT_GENDER gender);
|
||||||
|
@ -19,7 +19,15 @@ int32_t Script_IsShiftKeyDown(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetBuildInfo(lua_State* L) {
|
int32_t Script_GetBuildInfo(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto version = FrameScript_GetText("VERSION", -1, GENDER_NOT_APPLICABLE);
|
||||||
|
lua_pushstring(L, version);
|
||||||
|
|
||||||
|
auto releaseBuild = FrameScript_GetText("RELEASE_BUILD", -1, GENDER_NOT_APPLICABLE);
|
||||||
|
lua_pushstring(L, releaseBuild);
|
||||||
|
lua_pushstring(L, "3.3.5");
|
||||||
|
lua_pushstring(L, "12340");
|
||||||
|
lua_pushstring(L, "Jun 24 2010");
|
||||||
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetLocale(lua_State* L) {
|
int32_t Script_GetLocale(lua_State* L) {
|
||||||
@ -27,7 +35,9 @@ int32_t Script_GetLocale(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetSavedAccountName(lua_State* L) {
|
int32_t Script_GetSavedAccountName(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushstring(L, "");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_SetSavedAccountName(lua_State* L) {
|
int32_t Script_SetSavedAccountName(lua_State* L) {
|
||||||
|
Loading…
Reference in New Issue
Block a user