Skip to content

Commit

Permalink
Improve bootup performance of the rebinding menu and activate AI when…
Browse files Browse the repository at this point in the history
… the control changes.
  • Loading branch information
EusthEnoptEron committed Aug 16, 2022
1 parent e138e8b commit d7fc7a1
Show file tree
Hide file tree
Showing 13 changed files with 99 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- Improved handling of haptic feedback.
- Added option to show the HP bar of P1 alongside with the others on the right side. (`ShowP1Health`)
- Added use of LED colors on gamepads that support it (e.g. PS5). Blue = 1st, Red = 2nd, Green = 3rd, Purple = 4th
- Added an experimental menu that allows changing the controller assignment (opens with <kbd>F1</kbd>). Can be used to disable controllers or move them around.
- Added a highly experimental menu that allows changing the controller assignment (opens with <kbd>F2</kbd>). Can be used to disable controllers or move them around or simply debug them.

## 1.0.5

Expand Down
17 changes: 11 additions & 6 deletions Mod/MultiplayerModeCore/Modules/BlueprintProxyModule.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
#include "BlueprintProxyModule.h"

MultiplayerMod* BlueprintProxyModule::ModRef = nullptr;
BlueprintProxyModule* BlueprintProxyModule::Instance = nullptr;

static SDK::UClass* controllerDataClazz;
static SDK::UFunction* controllerDataSetId;
static SDK::UFunction* controllerDataGetId;

void BlueprintProxyModule::Initialize(MultiplayerMod* mod)
{
controllerDataClazz = SDK::UClass::FindClass("Class ControllerData.ControllerData_C");
controllerDataSetId = SDK::UFunction::FindObject<SDK::UFunction>("Function ControllerData.ControllerData_C.SetId");
controllerDataGetId = SDK::UFunction::FindObject<SDK::UFunction>("Function ControllerData.ControllerData_C.GetId");

mod->AddBlueprintHook(
"BP_ModHelper.BP_ModHelper_C.Native_GetHudVisibility",
Native_GetHudVisibilityImpl
Expand Down Expand Up @@ -55,7 +64,7 @@ void BlueprintProxyModule::Initialize(MultiplayerMod* mod)
);

ModRef = mod;

Instance = this;
}

void BlueprintProxyModule::Native_GetHudVisibilityImpl(UE4::UObject* Context, UE4::FFrame& Stack, void* result, FNativeFuncPtr processFn)
Expand Down Expand Up @@ -166,9 +175,6 @@ void BlueprintProxyModule::Native_GetControllerCountImpl(UE4::UObject* Context,

void BlueprintProxyModule::Native_GetControllersImpl(UE4::UObject* Context, UE4::FFrame& Stack, void* result, FNativeFuncPtr processFn)
{
static const auto controllerDataClazz = SDK::UClass::FindClass("Class ControllerData.ControllerData_C");
static const auto controllerDataSetId = SDK::UFunction::FindObject<SDK::UFunction>("Function ControllerData.ControllerData_C.SetId");

const SDK::TArray<SDK::UObject*> controllerArray = *(SDK::TArray<SDK::UObject*>*)(((FOutParmRec*)Stack.OutParms)->PropAddr);

//Log::Info("%p [%d] -> %d", controllerArray, controllerArray->Num(), (*(SDK::TArray<SDK::UObject *>**)(&controllerArray))->Num());
Expand Down Expand Up @@ -198,7 +204,6 @@ void BlueprintProxyModule::Native_GetControllersImpl(UE4::UObject* Context, UE4:

void BlueprintProxyModule::Native_SetControllersImpl(UE4::UObject* Context, UE4::FFrame& Stack, void* result, FNativeFuncPtr processFn)
{
static const auto controllerDataGetId = SDK::UFunction::FindObject<SDK::UFunction>("Function ControllerData.ControllerData_C.GetId");

const auto inputManager = InputManager::GetInstance();
const auto controllerArray = *(SDK::TArray<SDK::UObject*>*)(((FOutParmRec*)Stack.OutParms)->PropAddr);
Expand All @@ -223,7 +228,7 @@ void BlueprintProxyModule::Native_SetControllersImpl(UE4::UObject* Context, UE4:
Log::Info("Pushing NULL");
}
}

inputManager->SyncColors();
}

Expand Down
1 change: 1 addition & 0 deletions Mod/MultiplayerModeCore/Modules/BlueprintProxyModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class BlueprintProxyModule :

static void PrintHierarchy(SDK::UWidget* widget, int depth = 0);

static BlueprintProxyModule *Instance;
static MultiplayerMod* ModRef;
};

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ If you want them to control separate characters (what you'd expect from multi-pl
- A.) Plug in (or emulate) a second gamepad and ignore the first one.
- B.) Set "FirstPlayerIsKeyboard=1" in the settings. (See [Customization](#customization))

## Changing the Controller Order

By pressing <kbd>F2</kbd> you can open a *highly experimental* menu that lets you rebind the gamepad order (i.e. you can move / disable certain gamepads).

A few things to note:

- You need a mouse to operate the menu.
- You should be in a menu to begin with (e.g. the main menu), otherwise the mouse cursor won't work properly.
- You can drag & drop gamepads where you want them. They should vibrate (somewhat) when you drag them, for identification.

## How to build

see [BUILDING.md](BUILDING.md)
Expand Down
Binary file not shown.
Binary file modified Unreal/Content/Mods/MultiplayerMod/ModActor.uasset
Binary file not shown.
Binary file modified Unreal/Content/Mods/MultiplayerMod/MultiPlayerController.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Unreal/Content/ThirdPersonBP/Maps/ThirdPersonExampleMap.umap
Binary file not shown.
40 changes: 38 additions & 2 deletions Unreal/Source/Arise/Private/AriseGameMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,43 @@
#include "AriseGameMode.h"


EAriseGameScene AAriseGameMode::GetDisplayScene() { return (EAriseGameScene)0; }

void AAriseGameMode::DebugCamera(bool bEnable)
{
}

EAriseGameScene AAriseGameMode::GetDisplayScene() { return (EAriseGameScene)0; }
void AAriseGameMode::DebugCamera(bool bEnable) {}
void AAriseGameMode::SetSystemPauseRequestEnable(bool bEnable)
{
}

void AAriseGameMode::RequestSystemPause()
{
}

bool AAriseGameMode::IsPausePossibleState()
{
return 0;
}

bool AAriseGameMode::IsSystemPauseRequestEnabled()
{
return 0;
}

void AAriseGameMode::FlushRequestSystemPause()
{
}

int AAriseGameMode::CheckSystemPauseState()
{
return 0;
}

void AAriseGameMode::CancelSystemPause()
{
}

void AAriseGameMode::CancelSystemPauseAll()
{
}
10 changes: 10 additions & 0 deletions Unreal/Source/Arise/Private/BtlCharacterBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,20 @@ bool ABtlCharacterBase::SetPlayerOperation(bool Enable) { return false; }

bool ABtlCharacterBase::SetEnableRestartAI(bool on) { return false; }


void ABtlCharacterBase::SetBtlAIController(class ABtl_AIControllerBase* AIController)
{
}

ABtl_AIControllerBase* ABtlCharacterBase::GetBtlAIController()
{
return 0;
}

void ABtlCharacterBase::RestartAI()
{
}

void ABtlCharacterBase::SetAIFlag(bool Enable, EBtlBitFlagCategory Category)
{
}
Expand Down
22 changes: 22 additions & 0 deletions Unreal/Source/Arise/Public/AriseGameMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,27 @@ class ARISE_API AAriseGameMode : public AGameMode
UFUNCTION(BlueprintCallable)
void DebugCamera(bool bEnable);

UFUNCTION(BlueprintCallable)
void SetSystemPauseRequestEnable(bool bEnable);

UFUNCTION(BlueprintCallable)
void RequestSystemPause();

UFUNCTION(BlueprintCallable)
bool IsPausePossibleState();

UFUNCTION(BlueprintCallable)
bool IsSystemPauseRequestEnabled();

UFUNCTION(BlueprintCallable)
void FlushRequestSystemPause();

UFUNCTION(BlueprintCallable)
int CheckSystemPauseState();

UFUNCTION(BlueprintCallable)
void CancelSystemPause();

UFUNCTION(BlueprintCallable)
void CancelSystemPauseAll();
};
6 changes: 6 additions & 0 deletions Unreal/Source/Arise/Public/BtlCharacterBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ class ARISE_API ABtlCharacterBase : public ACharacter
UFUNCTION(BlueprintCallable)
void SetBtlAIController(ABtl_AIControllerBase* AIController);

UFUNCTION(BlueprintCallable)
ABtl_AIControllerBase* GetBtlAIController();

UFUNCTION(BlueprintCallable)
void RestartAI();

UFUNCTION(BlueprintCallable)
void SetAIFlag(bool Enable, EBtlBitFlagCategory Category);

Expand Down

0 comments on commit d7fc7a1

Please sign in to comment.