Skip to content

Commit

Permalink
Merge pull request #330 from mklierman/dev
Browse files Browse the repository at this point in the history
Add ExecCmds functionality for Shipping builds
  • Loading branch information
budak7273 authored Dec 16, 2024
2 parents 50e9b34 + 1d3bcf4 commit c88b607
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Mods/SML/Source/SML/Private/SMLModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ void FSMLModule::StartupModule() {
//UObject subsystem and Engine are initialized on PostEngineInit and we need to delay their initialization to that moment
FCoreDelegates::OnPostEngineInit.AddStatic(FSatisfactoryModLoader::InitializeModLoading);

// ExecCmds are run after Engine is initialized as they use GEngine to run the commands
FCoreDelegates::OnPostEngineInit.AddStatic(FSatisfactoryModLoader::ParseExecCmds);

RegisterPluginGameplayTagInis();
}

Expand Down
10 changes: 10 additions & 0 deletions Mods/SML/Source/SML/Private/SatisfactoryModLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "Misc/FileHelper.h"
#include "Serialization/JsonReader.h"
#include "Serialization/JsonSerializer.h"
#include "ParseExecCommands.h"

#ifndef FACTORYGAME_VERSION
#define FACTORYGAME_VERSION 0
Expand Down Expand Up @@ -216,3 +217,12 @@ void FSatisfactoryModLoader::InitializeModLoading() {
}
UE_LOG(LogSatisfactoryModLoader, Display, TEXT("Initialization finished!"));
}

void FSatisfactoryModLoader::ParseExecCmds()
{
//ExecCmds is run natively by UE on non-Shipping builds, so we only want to run our reimplementation when in Shipping (in case CSS enables it later)
#if UE_BUILD_SHIPPING && !(ENABLE_PGO_PROFILE)
UE_LOG(LogSatisfactoryModLoader, Display, TEXT("Parsing ExecCmds"));
ParseExecCommands::QueueDeferredCommands(ParseExecCommands::ParseExecCmdsFromCommandLine(TEXT("ExecCmds")));
#endif
}
3 changes: 3 additions & 0 deletions Mods/SML/Source/SML/Public/SatisfactoryModLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ class SML_API FSatisfactoryModLoader {

/** Finishes mod loading and mounts packages, initializes subsystems, loads mod configurations, etc */
static void InitializeModLoading();

/** Runs console commands using the ExecCmds argument (reimplementation; existing UE ExecCmds doesn't work in shipping) */
static void ParseExecCmds();
};

0 comments on commit c88b607

Please sign in to comment.