Compare commits

...

3 Commits

Author SHA1 Message Date
Tristan 'Natrist' Cormier
2a64e5d0f9
Merge b902b5484e into 4857e817c5 2026-02-04 11:21:33 -05:00
fallenoak
4857e817c5
feat(ui): implement CSimpleFrame_CreateTexture 2026-02-04 09:45:37 -06:00
Tristan Cormier
b902b5484e feat(glue): implement Script_AcceptedScanning 2026-01-11 17:00:18 -05:00
4 changed files with 73 additions and 2 deletions

View File

@ -39,6 +39,7 @@
#include <cstdio> #include <cstdio>
int32_t CGlueMgr::m_acceptedEULA = 1; // TODO int32_t CGlueMgr::m_acceptedEULA = 1; // TODO
int32_t CGlueMgr::m_acceptedScanning = 1; // TODO
int32_t CGlueMgr::m_acceptedTerminationWithoutNotice; int32_t CGlueMgr::m_acceptedTerminationWithoutNotice;
int32_t CGlueMgr::m_acceptedTOS = 1; // TODO int32_t CGlueMgr::m_acceptedTOS = 1; // TODO
int32_t CGlueMgr::m_accountMsgAvailable; int32_t CGlueMgr::m_accountMsgAvailable;

View File

@ -33,6 +33,7 @@ class CGlueMgr {
// Static variables // Static variables
static int32_t m_acceptedEULA; static int32_t m_acceptedEULA;
static int32_t m_acceptedScanning;
static int32_t m_acceptedTerminationWithoutNotice; static int32_t m_acceptedTerminationWithoutNotice;
static int32_t m_acceptedTOS; static int32_t m_acceptedTOS;
static int32_t m_accountMsgAvailable; static int32_t m_accountMsgAvailable;

View File

@ -210,7 +210,14 @@ int32_t Script_ShowScanningNotice(lua_State* L) {
} }
int32_t Script_ScanningAccepted(lua_State* L) { int32_t Script_ScanningAccepted(lua_State* L) {
WHOA_UNIMPLEMENTED(0); if (CGlueMgr::m_acceptedScanning) {
lua_pushnumber(L, 1.0);
}
else {
lua_pushnil(L);
}
return 1;
} }
int32_t Script_AcceptScanning(lua_State* L) { int32_t Script_AcceptScanning(lua_State* L) {

View File

@ -2,10 +2,13 @@
#include "gx/Coordinate.hpp" #include "gx/Coordinate.hpp"
#include "ui/CBackdropGenerator.hpp" #include "ui/CBackdropGenerator.hpp"
#include "ui/FrameScript.hpp" #include "ui/FrameScript.hpp"
#include "ui/FrameXML.hpp"
#include "ui/simple/CSimpleFrame.hpp" #include "ui/simple/CSimpleFrame.hpp"
#include "ui/simple/CSimpleTexture.hpp"
#include "util/Lua.hpp" #include "util/Lua.hpp"
#include "util/StringTo.hpp" #include "util/StringTo.hpp"
#include "util/Unimplemented.hpp" #include "util/Unimplemented.hpp"
#include <storm/Memory.hpp>
#include <algorithm> #include <algorithm>
#include <cstdint> #include <cstdint>
#include <limits> #include <limits>
@ -19,7 +22,66 @@ int32_t CSimpleFrame_CreateTitleRegion(lua_State* L) {
} }
int32_t CSimpleFrame_CreateTexture(lua_State* L) { int32_t CSimpleFrame_CreateTexture(lua_State* L) {
WHOA_UNIMPLEMENTED(0); auto type = CSimpleFrame::GetObjectType();
auto frame = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
const char* name = nullptr;
if (lua_isstring(L, 2)) {
name = lua_tostring(L, 2);
}
int32_t drawlayer = DRAWLAYER_ARTWORK;
if (lua_isstring(L, 3)) {
auto drawlayerStr = lua_tostring(L, 3);
StringToDrawLayer(drawlayerStr, drawlayer);
}
XMLNode* inheritNode = nullptr;
if (lua_type(L, 4) == LUA_TSTRING) {
auto inheritName = lua_tostring(L, 4);
const char* tainted;
bool locked;
inheritNode = FrameXML_AcquireHashNode(inheritName, tainted, locked);
if (!inheritNode) {
luaL_error(L, "%s:CreateTexture(): Couldn't find inherited node \"%s\"", frame->GetDisplayName(), inheritName);
return 0;
}
if (locked) {
luaL_error(L, "%s:CreateTexture(): Recursively inherited node \"%s\"", frame->GetDisplayName(), inheritName);
return 0;
}
}
// TODO CDataAllocator::GetData
auto texture = STORM_NEW(CSimpleTexture)(frame, drawlayer, true);
if (name && *name) {
texture->SetName(name);
}
if (inheritNode) {
CStatus status;
texture->LoadXML(inheritNode, &status);
texture->PostLoadXML(inheritNode, &status);
auto inheritName = lua_tostring(L, 4);
FrameXML_ReleaseHashNode(inheritName);
}
// TODO anim related logic?
if (!texture->lua_registered) {
texture->RegisterScriptObject(nullptr);
}
lua_rawgeti(L, LUA_REGISTRYINDEX, texture->lua_objectRef);
return 1;
} }
int32_t CSimpleFrame_CreateFontString(lua_State* L) { int32_t CSimpleFrame_CreateFontString(lua_State* L) {