Skip to content

Commit 3cbacd7

Browse files
committed
Build size + GuiInterface + IToolNetworkData
1 parent 596b438 commit 3cbacd7

6 files changed

Lines changed: 54 additions & 9 deletions

File tree

include/SmSdk/Gui/GuiInterface.hpp

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,63 @@
99

1010
class GuiBase;
1111

12+
struct GuiDeferredCallback
13+
{
14+
/* 0x0000 */ std::string m_identifier;
15+
/* 0x0020 */ std::function<void(void)> m_callback;
16+
}; // Size: 0x60
17+
18+
static_assert(offsetof(GuiDeferredCallback, GuiDeferredCallback::m_identifier) == 0x0, "GuiDeferredCallback::m_identifier: Incorrect offset");
19+
static_assert(offsetof(GuiDeferredCallback, GuiDeferredCallback::m_callback) == 0x20, "GuiDeferredCallback::m_callback: Incorrect offset");
20+
21+
static_assert(sizeof(GuiDeferredCallback) == 0x60, "GuiDeferredCallback: Incorrect Size");
22+
1223
class GuiInterface
1324
{
1425
public:
1526
virtual ~GuiInterface() = default;
16-
virtual void func2() {}
17-
virtual void func3() {}
27+
virtual void open() {}
28+
virtual void close() {}
1829
virtual void func4() {}
1930
virtual void func5(const std::string& str) { SMSDK_UNREF(str); }
2031
virtual void func6(const std::string& str, __int64 a3) { SMSDK_UNREF2(str, a3); }
2132
virtual void func7(const std::string& str, const std::string& str2) { SMSDK_UNREF2(str, str2); }
2233
virtual void func8(const std::string& str, const std::string& str2) { SMSDK_UNREF2(str, str2); }
2334
virtual void func9(const std::string& str, const std::string& str2, const Json::Value& json_val) { SMSDK_UNREF3(str, str2, json_val); }
2435
virtual void func10(const std::string& str, const std::string& str2, std::size_t idx, const Json::Value& json_val) { SMSDK_UNREF4(str, str2, idx, json_val); }
36+
virtual void func11() {}
37+
virtual void func12() {}
38+
virtual void processDeferredCallbacks() {}
2539

2640
/* 0x0008 */ std::shared_ptr<GuiBase> m_pGuiBase;
41+
/* 0x0018 */ bool m_bSomeBool;
2742
private:
28-
/* 0x0018 */ char pad_0x18[0xC8];
43+
/* 0x0019 */ char pad_0x19[0x7];
2944
public:
45+
/* 0x0020 */ std::function<void(void)> m_closeCallback;
46+
/* 0x0060 */ std::unordered_map<std::string, std::function<void(void)>> m_mapEmptyFunctionCallbacks;
47+
/* 0x00A0 */ std::unordered_map<std::string, std::function<void(__int64)>> m_mapOneArgFunctionCallbacks;
3048
/* 0x00E0 */ std::unordered_map<std::string, std::function<void(const std::string&)>> m_mapStringToFunction;
3149
private:
3250
/* 0x0120 */ char pad_0x120[0x80];
3351
public:
3452
/* 0x01A0 */ std::unordered_map<std::string, std::unordered_map<std::string, std::function<void(std::size_t, const Json::Value&)>>> m_mapMapCallbackStorage;
3553
private:
36-
/* 0x01E0 */ char pad_0x1E0[0xC0];
54+
/* 0x01E0 */ char pad_0x1E0[0x80];
55+
public:
56+
/* 0x0260 */ std::deque<std::function<void(void)>> m_deferredCallbackDeque;
57+
/* 0x0288 */ std::vector<GuiDeferredCallback> m_vecDeferredCallbacks;
3758

3859
}; // Size: 0x2A0
3960

61+
static_assert(offsetof(GuiInterface, GuiInterface::m_pGuiBase) == 0x8, "GuiInterface::m_pGuiBase: Incorrect offset");
62+
static_assert(offsetof(GuiInterface, GuiInterface::m_bSomeBool) == 0x18, "GuiInterface::m_bSomeBool: Incorrect offset");
63+
static_assert(offsetof(GuiInterface, GuiInterface::m_closeCallback) == 0x20, "GuiInterface::m_closeCallback: Incorrect offset");
64+
static_assert(offsetof(GuiInterface, GuiInterface::m_mapEmptyFunctionCallbacks) == 0x60, "GuiInterface::m_mapEmptyFunctionCallbacks: Incorrect offset");
65+
static_assert(offsetof(GuiInterface, GuiInterface::m_mapOneArgFunctionCallbacks) == 0xA0, "GuiInterface::m_mapOneArgFunctionCallbacks: Incorrect offset");
66+
static_assert(offsetof(GuiInterface, GuiInterface::m_mapStringToFunction) == 0xE0, "GuiInterface::m_mapStringToFunction: Incorrect offset");
67+
static_assert(offsetof(GuiInterface, GuiInterface::m_mapMapCallbackStorage) == 0x1A0, "GuiInterface::m_mapMapCallbackStorage: Incorrect offset");
68+
static_assert(offsetof(GuiInterface, GuiInterface::m_deferredCallbackDeque) == 0x260, "GuiInterface::m_deferredCallbackDeque: Incorrect offset");
69+
static_assert(offsetof(GuiInterface, GuiInterface::m_vecDeferredCallbacks) == 0x288, "GuiInterface::m_vecDeferredCallbacks: Incorrect offset");
70+
4071
static_assert(sizeof(GuiInterface) == 0x2A0, "GuiInterface: Incorrect Size");

include/SmSdk/StaticValues.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ class StaticValues
88
public:
99
using PaintToolPaintLimiterType = StaticVariable<std::int32_t, SM_VAR_PAINT_DRAG_LIMITER>;
1010
using PaintToolEraseLimiterType = StaticVariable<std::int32_t, SM_VAR_PAINT_ERASE_LIMITER>;
11+
using BlockBuildLimiterType = StaticVariable<std::int32_t, SM_VAR_BLOCK_BUILD_LIMITER>;
1112

12-
//A limiter for paint tool paint function
13+
// A limiter for paint tool paint function
1314
static PaintToolPaintLimiterType sm_paintToolPaintLimiter;
14-
//A limiter for paint tool erase function
15+
// A limiter for paint tool erase function
1516
static PaintToolEraseLimiterType sm_paintToolEraseLimiter;
17+
// A limiter for build size
18+
static BlockBuildLimiterType sm_blockBuildLimiter;
1619
};

include/SmSdk/Tool/IToolNetworkData.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ class IToolNetworkData
55
public:
66
virtual ~IToolNetworkData() = default;
77

8-
private:
9-
/* 0x0008 */ char pad_0x8[0x8];
8+
/* 0x0008 */ bool m_bDataChanged;
9+
1010
}; // Size: 0x10
1111

12+
static_assert(offsetof(IToolNetworkData, IToolNetworkData::m_bDataChanged) == 0x8, "IToolNetworkData::m_bDataChanged: Incorrect offset");
1213
static_assert(sizeof(IToolNetworkData) == 0x10, "IToolNetworkData: Incorrect Size");

include/SmSdk/Util/Color.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ union Color
3232
float getFloat(std::size_t idx);
3333
void setFloat(std::size_t idx, float val);
3434

35+
inline std::string toHexStringRGB() const
36+
{
37+
char v_buffer[10];
38+
sprintf_s(v_buffer, "%02X%02X%02X", std::uint32_t(this->r), std::uint32_t(this->g), std::uint32_t(this->b));
39+
40+
return std::string(v_buffer, 6);
41+
}
42+
3543
inline bool operator==(Color other) const noexcept
3644
{
3745
return this->data == other.data;

include/SmSdk/offsets.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
#if _SM_VERSION_NUM == 073776
174174
# define SM_VAR_PAINT_DRAG_LIMITER 0x3E0DBB
175175
# define SM_VAR_PAINT_ERASE_LIMITER 0x2AD4BD
176+
# define SM_VAR_BLOCK_BUILD_LIMITER 0x2C5D8E
176177
#elif _SM_VERSION_NUM == 072775
177178
# define SM_VAR_PAINT_DRAG_LIMITER 0x3E0E3B
178179
# define SM_VAR_PAINT_ERASE_LIMITER 0x2AD53D

src/PointerGetters.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ PTR_GETTER_DEFINE(GameState, GetCurrentState, SM_CURRENT_GAME_STATE_OFFSET);
5858
//STATIC VARIABLE DEFINITIONS
5959

6060
StaticValues::PaintToolEraseLimiterType StaticValues::sm_paintToolEraseLimiter{};
61-
StaticValues::PaintToolPaintLimiterType StaticValues::sm_paintToolPaintLimiter{};
61+
StaticValues::PaintToolPaintLimiterType StaticValues::sm_paintToolPaintLimiter{};
62+
StaticValues::BlockBuildLimiterType StaticValues::sm_blockBuildLimiter{};

0 commit comments

Comments
 (0)