Skip to content

Commit

Permalink
Version 0.7.2.775 support
Browse files Browse the repository at this point in the history
  • Loading branch information
QuestionableM committed Dec 9, 2024
1 parent 1114742 commit 5ad005e
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 12 deletions.
8 changes: 6 additions & 2 deletions Code/Hooks/offsets.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#pragma once

#define GAME_VERSION 071772
#define GAME_VERSION 072775

#if !defined(GAME_VERSION)
#error GAME_VERSION must be defined!
#endif

#if GAME_VERSION == 071772
#if GAME_VERSION == 072775
#define OFF_LOAD_SHAPESETS_FUNCTION 0x5991A0
#define OFF_INIT_SHAPESET_MANAGER_FUNCTION 0x34DA90
#define OFF_INIT_LUA_MANAGER_FUNCTION 0x54A870
#elif GAME_VERSION == 071772
#define OFF_LOAD_SHAPESETS_FUNCTION 0x599180
#define OFF_INIT_SHAPESET_MANAGER_FUNCTION 0x34DA90
#define OFF_INIT_LUA_MANAGER_FUNCTION 0x54A850
Expand Down
4 changes: 2 additions & 2 deletions Code/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ static bool g_mhAttached = false;

void dll_attach()
{
if (!SmSdk::CheckTimestamp(_SM_TIMESTAMP_071_772))
if (!SmSdk::CheckTimestamp(_SM_TIMESTAMP_072_775))
{
MessageBoxA(
NULL,
"Your game version is not supported by Custom Audio Extension. The current version of the mod has been built for Scrap Mechanic 0.7.1.772\n\nPress OK to continue loading without the mod.",
"Your game version is not supported by Custom Audio Extension. The current version of the mod has been built for Scrap Mechanic 0.7.2.775\n\nPress OK to continue loading without the mod.",
"Unsupported Version",
MB_ICONWARNING);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GameplayOptionsMenu : public OptionsSubMenuBase
char someData[16];
#endif

}; // Size: 0x168 (+ 0x10 after 070771)
}; // Size: 0x168

#if _SM_VERSION_NUM >= 070771
static_assert(sizeof(GameplayOptionsMenu) == 0x178, "GameplayOptionsMenu: Incorrect Size");
Expand Down
5 changes: 3 additions & 2 deletions Dependencies/SmSdk/include/SmSdk/StaticValues.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#pragma once

#include "SmSdk/Util/StaticVariable.hpp"
#include "SmSdk/offsets.hpp"

class StaticValues
{
public:
using PaintToolPaintLimiterType = StaticVariable<std::int32_t, 0x3F060D>;
using PaintToolEraseLimiterType = StaticVariable<std::int32_t, 0x3F0D9B>;
using PaintToolPaintLimiterType = StaticVariable<std::int32_t, SM_VAR_PAINT_DRAG_LIMITER>;
using PaintToolEraseLimiterType = StaticVariable<std::int32_t, SM_VAR_PAINT_ERASE_LIMITER>;

//A limiter for paint tool paint function
static PaintToolPaintLimiterType sm_paintToolPaintLimiter;
Expand Down
1 change: 1 addition & 0 deletions Dependencies/SmSdk/include/SmSdk/TimestampCheck.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#define _SM_TIMESTAMP_070_771 1733399248
#define _SM_TIMESTAMP_071_772 1733491522
#define _SM_TIMESTAMP_072_775 1733754961

namespace SmSdk
{
Expand Down
33 changes: 28 additions & 5 deletions Dependencies/SmSdk/include/SmSdk/offsets.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#define _SM_VERSION_NUM 071772
#define _SM_VERSION_NUM 072775

///////STATIC VALUE OFFSETS

#if _SM_VERSION_NUM == 071772
#if _SM_VERSION_NUM == 071772 || _SM_VERSION_NUM == 072775
# define SM_CURRENT_GAME_STATE_OFFSET 0x1267518
# define SM_IN_GAME_GUI_MANAGER_OFFSET 0x12674F0
# define SM_GUI_SYSTEM_MANAGER_OFFSET 0x1267668
Expand Down Expand Up @@ -65,7 +65,7 @@

//////VFTABLE OFFSETS

#if _SM_VERSION_NUM == 071772
#if _SM_VERSION_NUM == 071772 || _SM_VERSION_NUM == 072775
# define SM_VTBL_GAME_STATE_OFFSET 0xF889B0
# define SM_VTBL_OPTIONS_MENU_OFFSET 0xF82498
# define SM_VTBL_GAMEPLAY_OPTIONS_MENU_OFFSET 0xF82438
Expand All @@ -87,7 +87,15 @@

//////CONSTRUCTOR OFFSETS

#if _SM_VERSION_NUM == 071772
#if _SM_VERSION_NUM == 072775
# define SM_CONSTRUCTOR_OPTIONS_SUB_MENU_BASE_OFFSET 0x3BF910
# define SM_CONSTRUCTOR_CONTROL_OPTIONS_MENU_OFFSET 0x3286A0
# define SM_CONSTRUCTOR_DISPLAY_OPTIONS_MENU_OFFSET 0x338040
# define SM_CONSTRUCTOR_GRAPHICS_OPTIONS_MENU_OFFSET 0x351DA0
# define SM_CONSTRUCTOR_COMPOUND_BUTTON_OFFSET 0x644AF0
# define SM_CONSTRUCTOR_RADIO_BUTTON_SET_OFFSET 0x28C730
# define SM_CONSTRUCTOR_OPTIONS_ITEM_SLIDER_OFFSET 0x3BBEA0
#elif _SM_VERSION_NUM == 071772
# define SM_CONSTRUCTOR_OPTIONS_SUB_MENU_BASE_OFFSET 0x3BF8F0
# define SM_CONSTRUCTOR_CONTROL_OPTIONS_MENU_OFFSET 0x3286A0
# define SM_CONSTRUCTOR_DISPLAY_OPTIONS_MENU_OFFSET 0x338040
Expand Down Expand Up @@ -115,10 +123,25 @@

/////FUNCTIONS

#if _SM_VERSION_NUM == 071772
#if _SM_VERSION_NUM == 072775
# define SM_FUNC_VERTICAL_STACK_BOX_ADD_NEW_ITEM_OFFSET 0x527160
#elif _SM_VERSION_NUM == 071772
# define SM_FUNC_VERTICAL_STACK_BOX_ADD_NEW_ITEM_OFFSET 0x527140
#elif _SM_VERSION_NUM == 070771
# define SM_FUNC_VERTICAL_STACK_BOX_ADD_NEW_ITEM_OFFSET 0x527140
#else
# define SM_FUNC_VERTICAL_STACK_BOX_ADD_NEW_ITEM_OFFSET 0x536A90
#endif

/////VARIABLES

#if _SM_VERSION_NUM == 072775
# define SM_VAR_PAINT_DRAG_LIMITER 0x3E0E3B
# define SM_VAR_PAINT_ERASE_LIMITER 0x2AD53D
#elif _SM_VERSION_NUM == 071772
# define SM_VAR_PAINT_DRAG_LIMITER 0x3E0E1B
# define SM_VAR_PAINT_ERASE_LIMITER 0x2AD53D
#else
# define SM_VAR_PAINT_DRAG_LIMITER 0x3F060D
# define SM_VAR_PAINT_ERASE_LIMITER 0x3F0D9B
#endif

0 comments on commit 5ad005e

Please sign in to comment.