fadillzzz / tof-sih

GNU General Public License v3.0
33 stars 5 forks source link

[Issue] Compiling New Build #65

Closed RayshenOmega closed 6 months ago

RayshenOmega commented 6 months ago

So in short when self compiling from project, it only Compiles the launcher version while Git actions are set for both Steam and offical.

fadillzzz commented 6 months ago

I wasn't entirely sure what's the best way to tackle the two different builds without causing too much inconvenience and have it be backwards compatible. Some people may want to compile the code themselves for just one build and not care about the other version of the game.

I thought that, in order to support two different builds in the workflow, while making the build process backwards compatible I should introduce a new flag that controls which set of offsets should be used for compiling (I edited my SDK dump to contain both offsets for Steam & official version).

The BUILD_STEAM_VERSION flag was added to the CMake configuration, and can be used in the code to differentiate if we're building for the Steam version of the game as opposed to the official launcher version.

The current Github Actions workflow uses this to run two build processes at once. One with the flag off and another one with the flag on.

For people self compiling and targeting just one version of the game, they shouldn't need to care about this flag. This is more intended for people who requires to produce two builds targeting the two different version of the game.

If you'd like to replicate the Github Actions workflow's behaviour, what you can do locally is create two build folders using CMake; One for Steam and one for the official version of the game with an SDK that contains offsets for the two different versions and controlled using the macro IS_STEAM_VERSION inside the code.

// Inside your SDK Basic.hpp
    namespace Offsets {
#ifdef IS_STEAM_VERSION
        constexpr int32 GObjects = 0x08B18AC8;
        constexpr int32 AppendString = 0x02967780;
        constexpr int32 GNames = 0x00000000;
        constexpr int32 GWorld = 0x08C609A0;
        constexpr int32 ProcessEvent = 0x02B5EC70;
        constexpr int32 ProcessEventIdx = 0x00000043;
#else
        constexpr int32 GObjects = 0x08A1E848;
        constexpr int32 AppendString = 0x028DC1B0;
        constexpr int32 GNames = 0x00000000;
        constexpr int32 GWorld = 0x08B66720;
        constexpr int32 ProcessEvent = 0x02AD35A0;
        constexpr int32 ProcessEventIdx = 0x00000043;
#endif
    } // namespace Offsets
cmake -B build -S . # Configure official launcher version
cmake -B build_steam -S . -DBUILD_STEAM_VERSION=ON # Configure Steam version
cmake --build build --config Release # Build official launcher version
cmake --build build_steam --config Release # Build Steam version