Skip to content

Commit

Permalink
0.7.1.772 support
Browse files Browse the repository at this point in the history
  • Loading branch information
QuestionableM committed Dec 8, 2024
1 parent 0ba38a5 commit 1114742
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 15 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 070771
#define GAME_VERSION 071772

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

#if GAME_VERSION == 070771
#if GAME_VERSION == 071772
#define OFF_LOAD_SHAPESETS_FUNCTION 0x599180
#define OFF_INIT_SHAPESET_MANAGER_FUNCTION 0x34DA90
#define OFF_INIT_LUA_MANAGER_FUNCTION 0x54A850
#elif GAME_VERSION == 070771
#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_070_771))
if (!SmSdk::CheckTimestamp(_SM_TIMESTAMP_071_772))
{
MessageBoxA(
NULL,
"Your game version is unsupposed by Custom Audio Extension. The current version of the mod has been built for Scrap Mechanic 0.7.0.771",
"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.",
"Unsupported Version",
MB_ICONWARNING);
return;
Expand Down
2 changes: 1 addition & 1 deletion Dependencies/SmSdk/include/SmSdk/Character.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct CharacterScriptData

static_assert(sizeof(CharacterScriptData) == 0x8, "CharacterScriptData: Incorrect Size");

#if defined(_SM_VERSION_070_771)
#if _SM_VERSION_NUM >= 070771
struct CharacterControllerData
{
/* 0x0000 */ float m_fWalkSpeed;
Expand Down
12 changes: 8 additions & 4 deletions Dependencies/SmSdk/include/SmSdk/Gui/GameplayOptionsMenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class GameplayOptionsMenu : public OptionsSubMenuBase
GameplayOptionsMenu()
{
OptionsSubMenuBase::GameConstructor(this);
#if defined(_SM_VERSION_070_771)
#if _SM_VERSION_NUM >= 070771
std::memset(this->someData, 0, sizeof(this->someData));
#endif
Memory::OverwriteVftable(this, SM_VTBL_GAMEPLAY_OPTIONS_MENU_OFFSET);
Expand All @@ -18,10 +18,14 @@ class GameplayOptionsMenu : public OptionsSubMenuBase
virtual ~GameplayOptionsMenu() = default;
void restoreDefaults() override { /* implemented by the game */ }

#if defined(_SM_VERSION_070_771)
#if _SM_VERSION_NUM >= 070771
char someData[16];
#endif

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

static_assert(sizeof(GameplayOptionsMenu) == 0x168, "GameplayOptionsMenu: Incorrect Size");
#if _SM_VERSION_NUM >= 070771
static_assert(sizeof(GameplayOptionsMenu) == 0x178, "GameplayOptionsMenu: Incorrect Size");
#else
static_assert(sizeof(GameplayOptionsMenu) == 0x168, "GameplayOptionsMenu: Incorrect Size");
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class OptionsSubMenuBase
virtual bool someFunc2() { return 0; }
virtual bool someFunc3() { return 0; }
virtual void restoreDefaults() = 0;
#if defined(_SM_VERSION_070_771)
#if _SM_VERSION_NUM >= 070771
virtual void someFunc5() {}
#endif
virtual void someFunc4() {}
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 @@ -3,6 +3,7 @@
#include "SmSdk/win_include.hpp"

#define _SM_TIMESTAMP_070_771 1733399248
#define _SM_TIMESTAMP_071_772 1733491522

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

#define _SM_VERSION_070_771
#define _SM_VERSION_NUM 071772

///////STATIC VALUE OFFSETS

#if defined(_SM_VERSION_070_771)
#if _SM_VERSION_NUM == 071772
# define SM_CURRENT_GAME_STATE_OFFSET 0x1267518
# define SM_IN_GAME_GUI_MANAGER_OFFSET 0x12674F0
# define SM_GUI_SYSTEM_MANAGER_OFFSET 0x1267668
# define SM_CHARACTER_MANAGER_OFFSET 0x12676B8
# define SM_PLAYER_MANAGER_OFFSET 0x1267758
# define SM_AUDIO_MANAGER_OFFSET 0x12675C8
# define SM_INPUT_MANAGER_OFFSET 0x1267780
# define SM_MY_PLAYER_OFFSET 0x1267528
# define SM_GAME_SETTINGS_OFFSET 0x12676E0
# define SM_CONTAINER_MANAGER_OFFSET 0x1267718
# define SM_PORTAL_MANAGER_OFFSET 0x1267610
# define SM_PATHFINDER_MANAGER_OFFSET 0x1267630
# define SM_AREA_TRIGGER_MANAGER_OFFSET 0x12675E8
# define SM_HARVESTABLE_MANAGER_OFFSET 0x1267698
# define SM_DIRECTORY_MANAGER_OFFSET 0x1267790
# define SM_CREATION_MANAGER_OFFSET 0x12676C0
# define SM_NET_OBJ_MANAGER_OFFSET 0x1267750
# define SM_PHYSICS_OFFSET 0x1267510
#elif _SM_VERSION_NUM == 070771
# define SM_CURRENT_GAME_STATE_OFFSET 0x12674F8
# define SM_IN_GAME_GUI_MANAGER_OFFSET 0x12674D0
# define SM_GUI_SYSTEM_MANAGER_OFFSET 0x12675C0
Expand Down Expand Up @@ -46,7 +65,13 @@

//////VFTABLE OFFSETS

#if defined(_SM_VERSION_070_771)
#if _SM_VERSION_NUM == 071772
# define SM_VTBL_GAME_STATE_OFFSET 0xF889B0
# define SM_VTBL_OPTIONS_MENU_OFFSET 0xF82498
# define SM_VTBL_GAMEPLAY_OPTIONS_MENU_OFFSET 0xF82438
# define SM_VTBL_AUDIO_OPTIONS_MENU_OFFSET 0xF31370
# define SM_VTBL_OPTIONS_SUB_MENU_BASE_OFFSET 0xF6A5D8
#elif _SM_VERSION_NUM == 070771
# define SM_VTBL_GAME_STATE_OFFSET 0xF88940
# define SM_VTBL_OPTIONS_MENU_OFFSET 0xF82418
# define SM_VTBL_GAMEPLAY_OPTIONS_MENU_OFFSET 0xF823B8
Expand All @@ -62,7 +87,15 @@

//////CONSTRUCTOR OFFSETS

#if defined(_SM_VERSION_070_771)
#if _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
# define SM_CONSTRUCTOR_GRAPHICS_OPTIONS_MENU_OFFSET 0x351DA0
# define SM_CONSTRUCTOR_COMPOUND_BUTTON_OFFSET 0x644AD0
# define SM_CONSTRUCTOR_RADIO_BUTTON_SET_OFFSET 0x28C730
# define SM_CONSTRUCTOR_OPTIONS_ITEM_SLIDER_OFFSET 0x3BBE80
#elif _SM_VERSION_NUM == 070771
# 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 All @@ -82,7 +115,9 @@

/////FUNCTIONS

#if defined(_SM_VERSION_070_771)
#if _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
Expand Down

0 comments on commit 1114742

Please sign in to comment.