-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support package game feature/fix crypto issue,update to v70
- Loading branch information
Showing
29 changed files
with
1,355 additions
and
230 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
HotPatcher/Source/HotPatcherEditor/Classes/Commandlets/CommandletHelper.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#pragma once | ||
|
||
|
||
#include "ETargetPlatform.h" | ||
#include "FlibPatchParserHelper.h" | ||
|
||
#define PATCHER_CONFIG_PARAM_NAME TEXT("-config=") | ||
|
||
namespace CommandletHelper | ||
{ | ||
namespace NSPatch | ||
{ | ||
void ReceiveMsg(const FString& InMsgType,const FString& InMsg) | ||
{ | ||
UE_LOG(LogHotPatcherCommandlet,Display,TEXT("%s:%s"),*InMsgType,*InMsg); | ||
} | ||
|
||
void ReceiveShowMsg(const FString& InMsg) | ||
{ | ||
UE_LOG(LogHotPatcherCommandlet,Display,TEXT("%s"),*InMsg); | ||
} | ||
} | ||
|
||
TArray<FString> ParserPatchConfigByCommandline(const FString& Commandline,const FString& Token) | ||
{ | ||
TArray<FString> result; | ||
TMap<FString, FString> KeyValues = UFlibPatchParserHelper::GetCommandLineParamsMap(Commandline); | ||
if(KeyValues.Find(Token)) | ||
{ | ||
FString AddPakListInfo = *KeyValues.Find(Token); | ||
AddPakListInfo.ParseIntoArray(result,TEXT(",")); | ||
} | ||
return result; | ||
} | ||
|
||
|
||
#define ADD_PATCH_PLATFORMS TEXT("AddPatchPlatforms") | ||
TArray<ETargetPlatform> ParserPatchPlatforms(const FString& Commandline) | ||
{ | ||
TArray<ETargetPlatform> result; | ||
for(auto& PlatformName:ParserPatchConfigByCommandline(Commandline,ADD_PATCH_PLATFORMS)) | ||
{ | ||
ETargetPlatform Platform = ETargetPlatform::None; | ||
UFlibPatchParserHelper::GetEnumValueByName(PlatformName,Platform); | ||
if(Platform != ETargetPlatform::None) | ||
{ | ||
result.AddUnique(Platform); | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
TArray<FDirectoryPath> ParserPatchFilters(const FString& Commandline,const FString& FilterName) | ||
{ | ||
TArray<FDirectoryPath> Result; | ||
for(auto& FilterPath:ParserPatchConfigByCommandline(Commandline,FString::Printf(TEXT("Add%s"),*FilterName))) | ||
{ | ||
FDirectoryPath Path; | ||
Path.Path = FilterPath; | ||
Result.Add(Path); | ||
} | ||
return Result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
HotPatcher/Source/HotPatcherEditor/Classes/Commandlets/HotPluginCommandlet.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "HotPluginCommandlet.h" | ||
#include "ThreadUtils/FProcWorkerThread.hpp" | ||
#include "GameFeature/FGameFeaturePackagerSettings.h" | ||
#include "FlibPatchParserHelper.h" | ||
#include "HotPatcherEditor.h" | ||
#include "CommandletHelper.hpp" | ||
|
||
// engine header | ||
#include "CoreMinimal.h" | ||
#include "GameFeature/GameFeatureProxy.h" | ||
#include "Misc/FileHelper.h" | ||
#include "Misc/CommandLine.h" | ||
#include "Kismet/KismetSystemLibrary.h" | ||
#include "Misc/Paths.h" | ||
|
||
DEFINE_LOG_CATEGORY(LogHotPluginCommandlet); | ||
|
||
TSharedPtr<FProcWorkerThread> PluginProc; | ||
|
||
int32 UHotPluginCommandlet::Main(const FString& Params) | ||
{ | ||
UE_LOG(LogHotPluginCommandlet, Display, TEXT("UHotPluginCommandlet::Main")); | ||
|
||
FString config_path; | ||
bool bStatus = FParse::Value(*Params, *FString(PATCHER_CONFIG_PARAM_NAME).ToLower(), config_path); | ||
if (!bStatus) | ||
{ | ||
UE_LOG(LogHotPluginCommandlet, Error, TEXT("not -config=xxxx.json params.")); | ||
return -1; | ||
} | ||
|
||
if (!FPaths::FileExists(config_path)) | ||
{ | ||
UE_LOG(LogHotPluginCommandlet, Error, TEXT("cofnig file %s not exists."), *config_path); | ||
return -1; | ||
} | ||
|
||
FString JsonContent; | ||
bool bExportStatus = false; | ||
if (FFileHelper::LoadFileToString(JsonContent, *config_path)) | ||
{ | ||
|
||
if(IsRunningCommandlet()) | ||
{ | ||
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry")); | ||
AssetRegistryModule.Get().SearchAllAssets(true); | ||
} | ||
|
||
TSharedPtr<FGameFeaturePackagerSettings> PluginPackagerSetting = MakeShareable(new FGameFeaturePackagerSettings); | ||
UFlibPatchParserHelper::TDeserializeJsonStringAsStruct(JsonContent,*PluginPackagerSetting); | ||
|
||
TMap<FString, FString> KeyValues = UFlibPatchParserHelper::GetCommandLineParamsMap(Params); | ||
UFlibPatchParserHelper::ReplaceProperty(*PluginPackagerSetting, KeyValues); | ||
TArray<ETargetPlatform> AddPlatforms = CommandletHelper::ParserPatchPlatforms(Params); | ||
|
||
FString FinalConfig; | ||
UFlibPatchParserHelper::TSerializeStructAsJsonString(*PluginPackagerSetting,FinalConfig); | ||
UE_LOG(LogHotPluginCommandlet, Display, TEXT("%s"), *FinalConfig); | ||
|
||
|
||
UGameFeatureProxy* GameFeatureProxy = NewObject<UGameFeatureProxy>(); | ||
GameFeatureProxy->AddToRoot(); | ||
GameFeatureProxy->SetProxySettings(PluginPackagerSetting.Get()); | ||
GameFeatureProxy->OnPaking.AddStatic(&::CommandletHelper::NSPatch::ReceiveMsg); | ||
GameFeatureProxy->OnShowMsg.AddStatic(&::CommandletHelper::NSPatch::ReceiveShowMsg); | ||
bExportStatus = GameFeatureProxy->DoExport(); | ||
|
||
UE_LOG(LogHotPluginCommandlet,Display,TEXT("Generate Game Feature Misstion is %s!"),bExportStatus?TEXT("Successed"):TEXT("Failure")); | ||
} | ||
|
||
if(FParse::Param(FCommandLine::Get(), TEXT("wait"))) | ||
{ | ||
system("pause"); | ||
} | ||
|
||
return 0; | ||
} |
16 changes: 16 additions & 0 deletions
16
HotPatcher/Source/HotPatcherEditor/Classes/Commandlets/HotPluginCommandlet.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include "Commandlets/Commandlet.h" | ||
#include "HotPluginCommandlet.generated.h" | ||
|
||
DECLARE_LOG_CATEGORY_EXTERN(LogHotPluginCommandlet, Log, All); | ||
|
||
UCLASS() | ||
class UHotPluginCommandlet :public UCommandlet | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
|
||
virtual int32 Main(const FString& Params)override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.