UE4升级4.20引擎修改

我的知乎链接:https://zhuanlan.zhihu.com/p/43314125

1、

bool FOnlineSubsystemSteam::Init()

{

bool bRelaunchInSteam = false;

int RelaunchAppId = 0;

ConfigureSteamInitDevOptions(bRelaunchInSteam, RelaunchAppId);

 

const bool bIsServer = IsRunningDedicatedServer();

if (bIsServer)

{

return false;//@CYX

}

bool bAttemptServerInit = true;

 

 

2、

/** Pass current state to server */

UFUNCTION(unreliable, server, WithValidation)//@cyx

void ServerUpdateState(float InSteeringInput, float InThrottleInput, float InBrakeInput, float InHandbrakeInput, int32 CurrentGear);

 

 

3、

 

case WM_SYSKEYDOWN:

{

// Alt-F4 or Alt+Space was pressed.

// Allow alt+f4 to close the window and alt+space to open the window menu

/*if( wParam != VK_F4 && wParam != VK_SPACE) @cyx

{

DeferMessage( CurrentNativeEventWindowPtr, hwnd, msg, wParam, lParam );

}*/

 

 

if (wParam != VK_SPACE)//@cyx

{

DeferMessage(CurrentNativeEventWindowPtr, hwnd, msg, wParam, lParam);

 

if (wParam == VK_F4)

{

return 0;

}

}

}

break;

 

4、

class FMalloc* FUnixPlatformMemory::BaseAllocator()

{

#if UE4_DO_ROOT_PRIVILEGE_CHECK

// This function gets executed very early, way before main() (because global constructors will allocate memory).

// This makes it ideal, if unobvious, place for a root privilege check.

//@CYX 允许root用户权限开启

//if (geteuid() == 0)

//{

//fprintf(stderr, "Refusing to run with the root privileges.\n");

//FPlatformMisc::RequestExit(true);

//// unreachable

//return nullptr;

//}

#endif // UE4_DO_ROOT_PRIVILEGE_CHECK

 

5、

static float AngleLerp = 0.05f; //static float AngleLerp = 0.4f; @cyx

static FAutoConsoleVariableRef CVarAngSet(TEXT("p.AngleLerp"), AngleLerp, TEXT(""));

void FPhysicsReplication::OnTick(float DeltaSeconds, TMap, FReplicatedPhysicsTarget>& ComponentsToTargets)

{

const FRigidBodyErrorCorrection& PhysicErrorCorrection = UPhysicsSettings::Get()->PhysicErrorCorrection;

 

// Get the ping between this PC & the server

const float LocalPing = GetLocalPing();

 

for (auto Itr = ComponentsToTargets.CreateIterator(); Itr; ++Itr)

{

bool bRemoveItr = false;

if (UPrimitiveComponent* PrimComp = Itr.Key().Get())

{

if(FBodyInstance* BI = PrimComp->GetBodyInstance(Itr.Value().BoneName))

{

FReplicatedPhysicsTarget& PhysicsTarget = Itr.Value();

FRigidBodyState& UpdatedState = PhysicsTarget.TargetState;

 

bool bUpdated = false;

AActor* OwningActor = PrimComp->GetOwner();

if (OwningActor && (OwningActor->Role == ROLE_SimulatedProxy || OwningActor->Role == ROLE_AutonomousProxy))//TODO: can we avoid the replication all together? @cyx

{

 

6、

void UGameInstance::StartGameInstance()

{

UEngine* const Engine = GetEngine();

 

// Create default URL.

// @note: if we change how we determine the valid start up map update LaunchEngineLoop's GetStartupMap()

FURL DefaultURL;

DefaultURL.LoadURLConfig(TEXT("DefaultPlayer"), GGameIni);

 

// Enter initial world.

EBrowseReturnVal::Type BrowseRet = EBrowseReturnVal::Failure;

FString Error;

const TCHAR* Tmp = FCommandLine::Get();

 

#if UE_BUILD_SHIPPING && !UE_SERVER && !UE_ALLOW_MAP_OVERRIDE_IN_SHIPPING && !ENABLE_PGO_PROFILE

// In shipping don't allow a map override unless on server, or running PGO profiling

//Tmp = TEXT("");//@cyx

#endif // UE_BUILD_SHIPPING && !UE_SERVER && !UE_ALLOW_MAP_OVERRIDE_IN_SHIPPING && !ENABLE_PGO_PROFILE

 

 

7、

// force game thread can be turned on later, but we are not concerned about that, those are only cvars and constants; if those are changed during a frame, they won't fully kick in till next frame.

if (CurrentState == EComponentMarkedForEndOfFrameUpdateState::Marked && bForceGameThread)

{

ComponentsThatNeedEndOfFrameUpdate.Remove(WeakComponent); //verify(ComponentsThatNeedEndOfFrameUpdate.Remove(WeakComponent) == 1);@cyx

CurrentState = EComponentMarkedForEndOfFrameUpdateState::Unmarked;

}

 

8、

 

FString appGetStartupMap(const TCHAR* CommandLine)

{

FURL DefaultURL;

DefaultURL.LoadURLConfig( TEXT("DefaultPlayer"), GGameIni );

 

// convert commandline to a URL

FString Error;

TCHAR Parm[4096]=TEXT("");

 

#if UE_BUILD_SHIPPING

// In shipping don't allow an override

//CommandLine = NULL;//@cyx

#endif // UE_BUILD_SHIPPING

 

 

9、

FReply SButton::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )

{

FReply Reply = FReply::Unhandled();

if (IsEnabled() && (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton || MouseEvent.IsTouchEvent()))

{

Press();

PressedScreenSpacePosition = MouseEvent.GetScreenSpacePosition();

if( ClickMethod == EButtonClickMethod::MouseDown )

{

//get the reply from the execute function

Reply = OnClicked.IsBound() ? OnClicked.Execute() : FReply::Handled();

 

//You should ALWAYS handle the OnClicked event.

ensure(Reply.IsEventHandled() == true);

}

else if ( IsPreciseTapOrClick(MouseEvent) )

{

// do not capture the pointer for precise taps or clicks

//

//Reply = FReply::Handled();@cyx

}

else

{

//we need to capture the mouse for MouseUp events

Reply = FReply::Handled().CaptureMouse( AsShared() );

}

}

 

10、

///

/// Enable exceptions for all modules.

///

[RequiresUniqueBuildEnvironment]

public bool bForceEnableExceptions = true;//@cyx

 

11、

if (Rules.bUseLoggingInShipping)

{

GlobalCompileEnvironment.Definitions.Add("USE_LOGGING_IN_SHIPPING=1");

}

else

{

GlobalCompileEnvironment.Definitions.Add("USE_LOGGING_IN_SHIPPING=1");//@cyx

}

 

 

12、

 

// Don't create a side-by-side manifest file for the executable.

Arguments.Add("/MANIFEST:NO");

 

//Arguments.Add("/MANIFEST"); // @CYX Arguments.Add("/MANIFEST:NO");

//Arguments.Add("/MANIFESTFILE:\"E:/MyShooterGame/Binaries/Win64/ShooterGame-Win64-Shipping.exe.intermediate.manifest\"");//@CYX

//Arguments.Add("/ALLOWISOLATION");//@CYX

//Arguments.Add("/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"");//@CYX

 

// Prevents the linker from displaying its logo for each invocation.

Arguments.Add("/NOLOGO");

 

13、

steam_api.h文件

 

virtual ~CCallbackImpl() { if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) SteamAPI_UnregisterCallback( this ); }//@cyx virtual

 

virtual ~CCallResult(); //@cyx virtual

你可能感兴趣的:(UE4升级修改)