Skip to content

Commit

Permalink
Build size + GuiInterface + IToolNetworkData
Browse files Browse the repository at this point in the history
  • Loading branch information
QuestionableM committed Jan 4, 2025
1 parent 596b438 commit 3cbacd7
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 9 deletions.
39 changes: 35 additions & 4 deletions include/SmSdk/Gui/GuiInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,63 @@

class GuiBase;

struct GuiDeferredCallback
{
/* 0x0000 */ std::string m_identifier;
/* 0x0020 */ std::function<void(void)> m_callback;
}; // Size: 0x60

static_assert(offsetof(GuiDeferredCallback, GuiDeferredCallback::m_identifier) == 0x0, "GuiDeferredCallback::m_identifier: Incorrect offset");
static_assert(offsetof(GuiDeferredCallback, GuiDeferredCallback::m_callback) == 0x20, "GuiDeferredCallback::m_callback: Incorrect offset");

static_assert(sizeof(GuiDeferredCallback) == 0x60, "GuiDeferredCallback: Incorrect Size");

class GuiInterface
{
public:
virtual ~GuiInterface() = default;
virtual void func2() {}
virtual void func3() {}
virtual void open() {}
virtual void close() {}
virtual void func4() {}
virtual void func5(const std::string& str) { SMSDK_UNREF(str); }
virtual void func6(const std::string& str, __int64 a3) { SMSDK_UNREF2(str, a3); }
virtual void func7(const std::string& str, const std::string& str2) { SMSDK_UNREF2(str, str2); }
virtual void func8(const std::string& str, const std::string& str2) { SMSDK_UNREF2(str, str2); }
virtual void func9(const std::string& str, const std::string& str2, const Json::Value& json_val) { SMSDK_UNREF3(str, str2, json_val); }
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); }
virtual void func11() {}
virtual void func12() {}
virtual void processDeferredCallbacks() {}

/* 0x0008 */ std::shared_ptr<GuiBase> m_pGuiBase;
/* 0x0018 */ bool m_bSomeBool;
private:
/* 0x0018 */ char pad_0x18[0xC8];
/* 0x0019 */ char pad_0x19[0x7];
public:
/* 0x0020 */ std::function<void(void)> m_closeCallback;
/* 0x0060 */ std::unordered_map<std::string, std::function<void(void)>> m_mapEmptyFunctionCallbacks;
/* 0x00A0 */ std::unordered_map<std::string, std::function<void(__int64)>> m_mapOneArgFunctionCallbacks;
/* 0x00E0 */ std::unordered_map<std::string, std::function<void(const std::string&)>> m_mapStringToFunction;
private:
/* 0x0120 */ char pad_0x120[0x80];
public:
/* 0x01A0 */ std::unordered_map<std::string, std::unordered_map<std::string, std::function<void(std::size_t, const Json::Value&)>>> m_mapMapCallbackStorage;
private:
/* 0x01E0 */ char pad_0x1E0[0xC0];
/* 0x01E0 */ char pad_0x1E0[0x80];
public:
/* 0x0260 */ std::deque<std::function<void(void)>> m_deferredCallbackDeque;
/* 0x0288 */ std::vector<GuiDeferredCallback> m_vecDeferredCallbacks;

}; // Size: 0x2A0

static_assert(offsetof(GuiInterface, GuiInterface::m_pGuiBase) == 0x8, "GuiInterface::m_pGuiBase: Incorrect offset");
static_assert(offsetof(GuiInterface, GuiInterface::m_bSomeBool) == 0x18, "GuiInterface::m_bSomeBool: Incorrect offset");
static_assert(offsetof(GuiInterface, GuiInterface::m_closeCallback) == 0x20, "GuiInterface::m_closeCallback: Incorrect offset");
static_assert(offsetof(GuiInterface, GuiInterface::m_mapEmptyFunctionCallbacks) == 0x60, "GuiInterface::m_mapEmptyFunctionCallbacks: Incorrect offset");
static_assert(offsetof(GuiInterface, GuiInterface::m_mapOneArgFunctionCallbacks) == 0xA0, "GuiInterface::m_mapOneArgFunctionCallbacks: Incorrect offset");
static_assert(offsetof(GuiInterface, GuiInterface::m_mapStringToFunction) == 0xE0, "GuiInterface::m_mapStringToFunction: Incorrect offset");
static_assert(offsetof(GuiInterface, GuiInterface::m_mapMapCallbackStorage) == 0x1A0, "GuiInterface::m_mapMapCallbackStorage: Incorrect offset");
static_assert(offsetof(GuiInterface, GuiInterface::m_deferredCallbackDeque) == 0x260, "GuiInterface::m_deferredCallbackDeque: Incorrect offset");
static_assert(offsetof(GuiInterface, GuiInterface::m_vecDeferredCallbacks) == 0x288, "GuiInterface::m_vecDeferredCallbacks: Incorrect offset");

static_assert(sizeof(GuiInterface) == 0x2A0, "GuiInterface: Incorrect Size");
7 changes: 5 additions & 2 deletions include/SmSdk/StaticValues.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ class StaticValues
public:
using PaintToolPaintLimiterType = StaticVariable<std::int32_t, SM_VAR_PAINT_DRAG_LIMITER>;
using PaintToolEraseLimiterType = StaticVariable<std::int32_t, SM_VAR_PAINT_ERASE_LIMITER>;
using BlockBuildLimiterType = StaticVariable<std::int32_t, SM_VAR_BLOCK_BUILD_LIMITER>;

//A limiter for paint tool paint function
// A limiter for paint tool paint function
static PaintToolPaintLimiterType sm_paintToolPaintLimiter;
//A limiter for paint tool erase function
// A limiter for paint tool erase function
static PaintToolEraseLimiterType sm_paintToolEraseLimiter;
// A limiter for build size
static BlockBuildLimiterType sm_blockBuildLimiter;
};
5 changes: 3 additions & 2 deletions include/SmSdk/Tool/IToolNetworkData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ class IToolNetworkData
public:
virtual ~IToolNetworkData() = default;

private:
/* 0x0008 */ char pad_0x8[0x8];
/* 0x0008 */ bool m_bDataChanged;

}; // Size: 0x10

static_assert(offsetof(IToolNetworkData, IToolNetworkData::m_bDataChanged) == 0x8, "IToolNetworkData::m_bDataChanged: Incorrect offset");
static_assert(sizeof(IToolNetworkData) == 0x10, "IToolNetworkData: Incorrect Size");
8 changes: 8 additions & 0 deletions include/SmSdk/Util/Color.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ union Color
float getFloat(std::size_t idx);
void setFloat(std::size_t idx, float val);

inline std::string toHexStringRGB() const
{
char v_buffer[10];
sprintf_s(v_buffer, "%02X%02X%02X", std::uint32_t(this->r), std::uint32_t(this->g), std::uint32_t(this->b));

return std::string(v_buffer, 6);
}

inline bool operator==(Color other) const noexcept
{
return this->data == other.data;
Expand Down
1 change: 1 addition & 0 deletions include/SmSdk/offsets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
#if _SM_VERSION_NUM == 073776
# define SM_VAR_PAINT_DRAG_LIMITER 0x3E0DBB
# define SM_VAR_PAINT_ERASE_LIMITER 0x2AD4BD
# define SM_VAR_BLOCK_BUILD_LIMITER 0x2C5D8E
#elif _SM_VERSION_NUM == 072775
# define SM_VAR_PAINT_DRAG_LIMITER 0x3E0E3B
# define SM_VAR_PAINT_ERASE_LIMITER 0x2AD53D
Expand Down
3 changes: 2 additions & 1 deletion src/PointerGetters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ PTR_GETTER_DEFINE(GameState, GetCurrentState, SM_CURRENT_GAME_STATE_OFFSET);
//STATIC VARIABLE DEFINITIONS

StaticValues::PaintToolEraseLimiterType StaticValues::sm_paintToolEraseLimiter{};
StaticValues::PaintToolPaintLimiterType StaticValues::sm_paintToolPaintLimiter{};
StaticValues::PaintToolPaintLimiterType StaticValues::sm_paintToolPaintLimiter{};
StaticValues::BlockBuildLimiterType StaticValues::sm_blockBuildLimiter{};

0 comments on commit 3cbacd7

Please sign in to comment.