├── .gitignore ├── EOSBasic ├── Config │ ├── DefaultEditor.ini │ ├── DefaultEngine.ini │ ├── DefaultGame.ini │ └── DefaultInput.ini ├── Content │ ├── Blueprints │ │ ├── BP_EOSBasic_GameMode.uasset │ │ └── BP_PlayerController.uasset │ ├── Maps │ │ ├── Test.umap │ │ └── Test_BuiltData.uasset │ └── Widgets │ │ ├── W_Instructions.uasset │ │ └── W_UserInfo.uasset ├── EOSBasic.uproject ├── Plugins │ └── OnlineSubsystemEOS │ │ ├── OnlineSubsystemEOS.uplugin │ │ └── Source │ │ ├── OnlineSubsystemEOS │ │ ├── OnlineSubsystemEOS.Build.cs │ │ ├── Private │ │ │ ├── OnlineIdentityInterfaceEOS.cpp │ │ │ ├── OnlineIdentityInterfaceEOS.h │ │ │ ├── OnlineSessionInterfaceEOS.cpp │ │ │ ├── OnlineSessionInterfaceEOS.h │ │ │ ├── OnlineSubsystemEOS.cpp │ │ │ ├── OnlineSubsystemEOSModule.cpp │ │ │ └── OnlineSubsystemEOSTypes.h │ │ └── Public │ │ │ ├── OnlineSubsystemEOS.h │ │ │ ├── OnlineSubsystemEOSCommon.cpp │ │ │ ├── OnlineSubsystemEOSCommon.h │ │ │ └── OnlineSubsystemEOSModule.h │ │ └── ThirdParty │ │ └── EOSSDK │ │ ├── AddSDKFoldersHere.txt │ │ └── EOSSDK.build.cs └── Source │ ├── EOSBasic.Target.cs │ ├── EOSBasic │ ├── EOSBasic.Build.cs │ ├── EOSBasic.cpp │ ├── EOSBasic.h │ ├── GameMode │ │ ├── EOSBasicGameModeBase.cpp │ │ └── EOSBasicGameModeBase.h │ └── Player │ │ ├── BasicPlayerController.cpp │ │ └── BasicPlayerController.h │ └── EOSBasicEditor.Target.cs └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # EOS includes 2 | EOSBasic/Plugins/UEOS/Source/ThirdParty/EOSSDK/Bin/ 3 | EOSBasic/Plugins/UEOS/Source/ThirdParty/EOSSDK/Include/ 4 | EOSBasic/Plugins/UEOS/Source/ThirdParty/EOSSDK/Lib/ 5 | 6 | # Shortcuts 7 | *.lnk 8 | *.url 9 | 10 | # Binary Art Source Files 11 | *.dae 12 | *.ies 13 | *.max 14 | *.png 15 | *.tga 16 | *.jpg 17 | *.dwg 18 | *.fbx 19 | *.psd 20 | *.dds 21 | *.hdr 22 | *.wav 23 | 24 | # Packages 25 | *.7z 26 | *.dmg 27 | *.gz 28 | *.iso 29 | *.jar 30 | *.rar 31 | *.tar 32 | *.zip 33 | 34 | # Some OS generated files 35 | .DS_Store 36 | .DS_Store? 37 | ._* 38 | .Spotlight-V100 39 | .Trashes 40 | ehthumbs.db 41 | Thumbs.db 42 | 43 | 44 | # Visual Studio user specific files 45 | EOSBasic/.vs/ 46 | EOSBasic/.vscode/ 47 | 48 | # Visual Studio database file 49 | *.VC.db 50 | 51 | # Compiled Object files 52 | *.slo 53 | *.lo 54 | *.o 55 | *.obj 56 | 57 | # Precompiled Headers 58 | *.gch 59 | *.pch 60 | 61 | # Compiled Dynamic libraries 62 | *.so 63 | *.dylib 64 | *.dll 65 | 66 | # Compiled Static libraries 67 | *.lai 68 | *.la 69 | *.a 70 | *.lib 71 | 72 | # Executables 73 | *.exe 74 | *.out 75 | *.app 76 | *.ipa 77 | 78 | # These project files can be generated by the engine 79 | *.xcodeproj 80 | *.xcworkspace 81 | *.code-workspace 82 | *.sln 83 | *.suo 84 | *.opensdf 85 | *.sdf 86 | *.VC.db 87 | *.VC.opendb 88 | 89 | # Binary Files 90 | EOSBasic/Binaries/* 91 | EOSBasic/Plugins/*/Binaries/* 92 | 93 | # Builds 94 | EOSBasic/Build/* 95 | 96 | # Configuration files generated by the Editor 97 | EOSBasic/Saved/* 98 | 99 | # Compiled source files for the engine to use 100 | EOSBasic/Intermediate/* 101 | EOSBasic/Plugins/*/Intermediate/* 102 | 103 | # Cache files for the editor to use 104 | EOSBasic/DerivedDataCache/* 105 | Tools 106 | /EOSBasic/Config/DefaultGame_Local.ini 107 | /EOSBasic/Plugins/OnlineSubsystemEOS/Source/ThirdParty/EOSSDK/Include 108 | /EOSBasic/Config/DefaultEngine - Local.ini 109 | /EOSBasic/Config/DefaultEngine_Live.ini 110 | -------------------------------------------------------------------------------- /EOSBasic/Config/DefaultEditor.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastlorisstudios/UE4_EOS_Plugin/d13c2fe90a5ae89bcd393670de3e425f8a478f1b/EOSBasic/Config/DefaultEditor.ini -------------------------------------------------------------------------------- /EOSBasic/Config/DefaultEngine.ini: -------------------------------------------------------------------------------- 1 | [URL] 2 | 3 | [/Script/HardwareTargeting.HardwareTargetingSettings] 4 | TargetedHardwareClass=Desktop 5 | AppliedTargetedHardwareClass=Desktop 6 | DefaultGraphicsPerformance=Maximum 7 | AppliedDefaultGraphicsPerformance=Maximum 8 | 9 | [/Script/IOSRuntimeSettings.IOSRuntimeSettings] 10 | bSupportsPortraitOrientation=False 11 | bSupportsUpsideDownOrientation=False 12 | bSupportsLandscapeLeftOrientation=True 13 | PreferredLandscapeOrientation=LandscapeLeft 14 | 15 | [/Script/EngineSettings.GameMapsSettings] 16 | EditorStartupMap=/Game/Maps/Test.Test 17 | GameDefaultMap=/Game/Maps/Test.Test 18 | GlobalDefaultGameMode=/Game/Blueprints/BP_EOSBasic_GameMode.BP_EOSBasic_GameMode_C 19 | 20 | [/Script/WindowsTargetPlatform.WindowsTargetSettings] 21 | Compiler=VisualStudio2017 22 | 23 | [/Script/Engine.PhysicsSettings] 24 | DefaultGravityZ=-980.000000 25 | DefaultTerminalVelocity=4000.000000 26 | DefaultFluidFriction=0.300000 27 | SimulateScratchMemorySize=262144 28 | RagdollAggregateThreshold=4 29 | TriangleMeshTriangleMinAreaThreshold=5.000000 30 | bEnableShapeSharing=False 31 | bEnablePCM=True 32 | bEnableStabilization=False 33 | bWarnMissingLocks=True 34 | bEnable2DPhysics=False 35 | PhysicErrorCorrection=(PingExtrapolation=0.100000,PingLimit=100.000000,ErrorPerLinearDifference=1.000000,ErrorPerAngularDifference=1.000000,MaxRestoredStateError=1.000000,MaxLinearHardSnapDistance=400.000000,PositionLerp=0.000000,AngleLerp=0.400000,LinearVelocityCoefficient=100.000000,AngularVelocityCoefficient=10.000000,ErrorAccumulationSeconds=0.500000,ErrorAccumulationDistanceSq=15.000000,ErrorAccumulationSimilarity=100.000000) 36 | LockedAxis=Invalid 37 | DefaultDegreesOfFreedom=Full3D 38 | BounceThresholdVelocity=200.000000 39 | FrictionCombineMode=Average 40 | RestitutionCombineMode=Average 41 | MaxAngularVelocity=3600.000000 42 | MaxDepenetrationVelocity=0.000000 43 | ContactOffsetMultiplier=0.020000 44 | MinContactOffset=2.000000 45 | MaxContactOffset=8.000000 46 | bSimulateSkeletalMeshOnDedicatedServer=True 47 | DefaultShapeComplexity=CTF_UseSimpleAndComplex 48 | bDefaultHasComplexCollision=True 49 | bSuppressFaceRemapTable=False 50 | bSupportUVFromHitResults=False 51 | bDisableActiveActors=False 52 | bDisableKinematicStaticPairs=False 53 | bDisableKinematicKinematicPairs=False 54 | bDisableCCD=False 55 | bEnableEnhancedDeterminism=False 56 | MaxPhysicsDeltaTime=0.033333 57 | bSubstepping=False 58 | bSubsteppingAsync=False 59 | MaxSubstepDeltaTime=0.016667 60 | MaxSubsteps=6 61 | SyncSceneSmoothingFactor=0.000000 62 | InitialAverageFrameRate=0.016667 63 | PhysXTreeRebuildRate=10 64 | DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2) 65 | 66 | [OnlineSubsystem] 67 | DefaultPlatformService=EOS 68 | bUsesPresence=true 69 | bUseBuildIdOverride=true 70 | BuildIdOverride=1234 71 | 72 | [OnlineSubsystemEOS] 73 | ProductId= 74 | SandboxId= 75 | DeploymentId= 76 | ProductName=EOS Basic 77 | ProductVersion=0.3.6 78 | ClientId= 79 | ClientSecret= 80 | -------------------------------------------------------------------------------- /EOSBasic/Config/DefaultGame.ini: -------------------------------------------------------------------------------- 1 | [/Script/EngineSettings.GeneralProjectSettings] 2 | ProjectID=D92FF8A64F8455F55350718F09A28DFF 3 | Description=A simple demo of using the Epic Online Services Plugin for UE4 4 | ProjectName=EOSBasic 5 | ProjectVersion=0.3.22.185 6 | CompanyName=Gaslight Games Ltd 7 | CopyrightNotice=Copyright (C) 2019-2020, Gaslight Games Ltd 8 | 9 | -------------------------------------------------------------------------------- /EOSBasic/Config/DefaultInput.ini: -------------------------------------------------------------------------------- 1 | 2 | 3 | [/Script/Engine.InputSettings] 4 | -AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 5 | -AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 6 | -AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 7 | -AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 8 | -AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) 9 | -AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) 10 | +AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 11 | +AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 12 | +AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 13 | +AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 14 | +AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) 15 | +AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) 16 | +AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_Z",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 17 | +AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_Z",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 18 | +AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 19 | +AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 20 | +AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 21 | +AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 22 | +AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 23 | +AxisConfig=(AxisKeyName="MotionController_Left_TriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 24 | +AxisConfig=(AxisKeyName="MotionController_Left_Grip1Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 25 | +AxisConfig=(AxisKeyName="MotionController_Left_Grip2Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 26 | +AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 27 | +AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 28 | +AxisConfig=(AxisKeyName="MotionController_Right_TriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 29 | +AxisConfig=(AxisKeyName="MotionController_Right_Grip1Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 30 | +AxisConfig=(AxisKeyName="MotionController_Right_Grip2Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 31 | +AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 32 | +AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 33 | +AxisConfig=(AxisKeyName="Daydream_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 34 | +AxisConfig=(AxisKeyName="Daydream_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 35 | +AxisConfig=(AxisKeyName="Daydream_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 36 | +AxisConfig=(AxisKeyName="Daydream_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 37 | +AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 38 | +AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 39 | +AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 40 | +AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 41 | +AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 42 | +AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 43 | +AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 44 | +AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 45 | +AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 46 | +AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 47 | +AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 48 | +AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 49 | +AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 50 | +AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 51 | +AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 52 | +AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 53 | +AxisConfig=(AxisKeyName="OculusGo_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 54 | +AxisConfig=(AxisKeyName="OculusGo_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 55 | +AxisConfig=(AxisKeyName="OculusGo_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 56 | +AxisConfig=(AxisKeyName="OculusGo_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 57 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 58 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 59 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 60 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 61 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 62 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 63 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 64 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 65 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 66 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 67 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 68 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 69 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 70 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 71 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 72 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 73 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Touch",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 74 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 75 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 76 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 77 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 78 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 79 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 80 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 81 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 82 | bAltEnterTogglesFullscreen=True 83 | bF11TogglesFullscreen=True 84 | bUseMouseForTouch=False 85 | bEnableMouseSmoothing=True 86 | bEnableFOVScaling=True 87 | bCaptureMouseOnLaunch=True 88 | bAlwaysShowTouchInterface=False 89 | bShowConsoleOnFourFingerTap=True 90 | bEnableGestureRecognizer=False 91 | bUseAutocorrect=False 92 | DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown 93 | DefaultViewportMouseLockMode=LockOnCapture 94 | FOVScale=0.011110 95 | DoubleClickTime=0.200000 96 | +ActionMappings=(ActionName="StartEOS",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=E) 97 | +ActionMappings=(ActionName="ShutdownEOS",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=S) 98 | +ActionMappings=(ActionName="Login",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=I) 99 | +ActionMappings=(ActionName="Logout",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=O) 100 | +ActionMappings=(ActionName="InitMetric",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=B) 101 | +ActionMappings=(ActionName="BeginMetricSession",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=N) 102 | +ActionMappings=(ActionName="EndMetricSession",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=M) 103 | +ActionMappings=(ActionName="GetUserInfo",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=R) 104 | DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks 105 | -ConsoleKeys=Tilde 106 | +ConsoleKeys=Tilde 107 | 108 | -------------------------------------------------------------------------------- /EOSBasic/Content/Blueprints/BP_EOSBasic_GameMode.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastlorisstudios/UE4_EOS_Plugin/d13c2fe90a5ae89bcd393670de3e425f8a478f1b/EOSBasic/Content/Blueprints/BP_EOSBasic_GameMode.uasset -------------------------------------------------------------------------------- /EOSBasic/Content/Blueprints/BP_PlayerController.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastlorisstudios/UE4_EOS_Plugin/d13c2fe90a5ae89bcd393670de3e425f8a478f1b/EOSBasic/Content/Blueprints/BP_PlayerController.uasset -------------------------------------------------------------------------------- /EOSBasic/Content/Maps/Test.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastlorisstudios/UE4_EOS_Plugin/d13c2fe90a5ae89bcd393670de3e425f8a478f1b/EOSBasic/Content/Maps/Test.umap -------------------------------------------------------------------------------- /EOSBasic/Content/Maps/Test_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastlorisstudios/UE4_EOS_Plugin/d13c2fe90a5ae89bcd393670de3e425f8a478f1b/EOSBasic/Content/Maps/Test_BuiltData.uasset -------------------------------------------------------------------------------- /EOSBasic/Content/Widgets/W_Instructions.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastlorisstudios/UE4_EOS_Plugin/d13c2fe90a5ae89bcd393670de3e425f8a478f1b/EOSBasic/Content/Widgets/W_Instructions.uasset -------------------------------------------------------------------------------- /EOSBasic/Content/Widgets/W_UserInfo.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastlorisstudios/UE4_EOS_Plugin/d13c2fe90a5ae89bcd393670de3e425f8a478f1b/EOSBasic/Content/Widgets/W_UserInfo.uasset -------------------------------------------------------------------------------- /EOSBasic/EOSBasic.uproject: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "EngineAssociation": "4.25", 4 | "Category": "", 5 | "Description": "", 6 | "Modules": [ 7 | { 8 | "Name": "EOSBasic", 9 | "Type": "Runtime", 10 | "LoadingPhase": "Default", 11 | "AdditionalDependencies": [ 12 | "Engine" 13 | ] 14 | } 15 | ], 16 | "Plugins": [ 17 | { 18 | "Name": "OnlineSubsystemEOS", 19 | "Enabled": true 20 | }, 21 | { 22 | "Name": "OculusVR", 23 | "Enabled": false 24 | }, 25 | { 26 | "Name": "SteamVR", 27 | "Enabled": false 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/OnlineSubsystemEOS.uplugin: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion" : 3, 3 | "Version" : 1, 4 | "VersionName" : "1.0", 5 | "FriendlyName" : "Epic Online Services", 6 | "Description" : "Online Subsystem Plugin for integrating the Epic Online Services into UE4.", 7 | "Category" : "Online", 8 | "CreatedBy" : "", 9 | "CreatedByURL" : "", 10 | "DocsURL" : "", 11 | "MarketplaceURL" : "", 12 | "SupportURL" : "", 13 | "EngineVersion" : "4.25.0", 14 | "CanContainContent" : true, 15 | "IsBetaVersion" : true, 16 | "Installed" : false, 17 | "Modules" : 18 | [ 19 | { 20 | "Name": "OnlineSubsystemEOS", 21 | "Type": "Runtime", 22 | "LoadingPhase": "PreDefault", 23 | "WhitelistPlatforms": 24 | [ 25 | "Win64", 26 | "Win32", 27 | "Linux", 28 | "Mac" 29 | ] 30 | } 31 | ], 32 | "Plugins": [ 33 | { 34 | "Name": "OnlineSubsystem", 35 | "Enabled": true 36 | }, 37 | { 38 | "Name": "OnlineSubsystemUtils", 39 | "Enabled": true 40 | } 41 | ] 42 | } -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/OnlineSubsystemEOS.Build.cs: -------------------------------------------------------------------------------- 1 | // (C) Gaslight Games Ltd, 2019-2020. All rights reserved. 2 | 3 | using UnrealBuildTool; 4 | using System.IO; 5 | 6 | public class OnlineSubsystemEOS : ModuleRules 7 | { 8 | public OnlineSubsystemEOS( ReadOnlyTargetRules Target ) : base( Target ) 9 | { 10 | PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; 11 | PublicDefinitions.Add( "EOS_LIB=1" ); 12 | 13 | if( Target.Configuration != UnrealTargetConfiguration.Shipping ) 14 | { 15 | OptimizeCode = CodeOptimization.Never; 16 | } 17 | 18 | PublicIncludePaths.AddRange( 19 | new string[] { 20 | Path.Combine( ModuleDirectory, "Public" ) 21 | } 22 | ); 23 | 24 | 25 | PrivateIncludePaths.AddRange( 26 | new string[] { 27 | Path.Combine( ModuleDirectory, "Private" ) 28 | } 29 | ); 30 | 31 | 32 | PublicDependencyModuleNames.AddRange( 33 | new string[] 34 | { 35 | "OnlineSubsystemUtils", 36 | "EOSSDK" 37 | } 38 | ); 39 | 40 | 41 | PrivateDependencyModuleNames.AddRange( 42 | new string[] 43 | { 44 | "Core", 45 | "CoreUObject", 46 | "NetCore", 47 | "Engine", 48 | "Sockets", 49 | "Voice", 50 | "AudioMixer", 51 | "OnlineSubsystem", 52 | "Json", 53 | "PacketHandler", 54 | "Projects", 55 | } 56 | ); 57 | 58 | 59 | DynamicallyLoadedModuleNames.AddRange( 60 | new string[] 61 | { 62 | // ... add any modules that your module loads dynamically here ... 63 | } 64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Private/OnlineIdentityInterfaceEOS.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #include "OnlineIdentityInterfaceEOS.h" 4 | #include "OnlineSubsystem.h" 5 | #include "OnlineSubsystemEOS.h" 6 | #include "OnlineSubsystemEOSCommon.h" 7 | // @todo: create helper classes/functions for converting between more BP/dev friendly types 8 | // to more generic elements for the OSS. Such as EOS Login Mode(s). 9 | //#include "OnlineSubsystemSteamTypes.h" 10 | #include "OnlineError.h" 11 | 12 | #include 13 | 14 | FOnlineIdentityEOS::FOnlineIdentityEOS( FOnlineSubsystemEOS* InSubsystem ) 15 | : EpicAccountId() 16 | , EOSSubsystem( InSubsystem ) 17 | { 18 | 19 | } 20 | 21 | bool FOnlineIdentityEOS::Login( int32 LocalUserNum, const FOnlineAccountCredentials& AccountCredentials ) 22 | { 23 | FString ErrorStr; 24 | if( LocalUserNum < MAX_LOCAL_PLAYERS ) 25 | { 26 | if( EOSSubsystem->IsEOSInitialized() == true ) 27 | { 28 | EOS_HAuth AuthHandle = EOS_Platform_GetAuthInterface( EOSSubsystem->GetPlatformHandle() ); 29 | 30 | if( AuthHandle != nullptr ) 31 | { 32 | EOS_Auth_Credentials Credentials; 33 | Credentials.ApiVersion = EOS_AUTH_CREDENTIALS_API_LATEST; 34 | 35 | EOS_Auth_LoginOptions LoginOptions; 36 | memset( &LoginOptions, 0, sizeof( LoginOptions ) ); 37 | LoginOptions.ApiVersion = EOS_AUTH_LOGIN_API_LATEST; 38 | 39 | // Use AccountCredentials.Type then: 40 | // @todo: support ALL Login types 41 | FString MessageText = FString::Printf( TEXT( "Logging In with Dev Auth Tool | ID: %s | Token: %s." ), *AccountCredentials.Id, *AccountCredentials.Token ); 42 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText ); 43 | 44 | std::string IdUTF8( TCHAR_TO_UTF8( *AccountCredentials.Id ) ); 45 | std::string TokenUTF8( TCHAR_TO_UTF8( *AccountCredentials.Token ) ); 46 | Credentials.Id = IdUTF8.c_str(); 47 | Credentials.Token = TokenUTF8.c_str(); 48 | Credentials.Type = EOS_ELoginCredentialType::EOS_LCT_Developer; 49 | 50 | LoginOptions.Credentials = &Credentials; 51 | 52 | EOS_Auth_Login( AuthHandle, &LoginOptions, NULL, LoginCompleteCallback ); 53 | 54 | return true; 55 | } 56 | else 57 | { 58 | ErrorStr = TEXT( "Failed to get AuthHandle." ); 59 | } 60 | } 61 | else 62 | { 63 | ErrorStr = TEXT( "EOS SDK Is not Initialized." ); 64 | } 65 | } 66 | else 67 | { 68 | // Requesting a local user is always invalid 69 | ErrorStr = FString::Printf( TEXT( "Invalid user %d" ), LocalUserNum ); 70 | } 71 | 72 | if( !ErrorStr.IsEmpty() ) 73 | { 74 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "Failed Epic Online Services login. %s" ), *ErrorStr ); 75 | TriggerOnLoginCompleteDelegates( LocalUserNum, false, FUniqueNetIdEOS(), ErrorStr ); 76 | } 77 | 78 | return false; 79 | } 80 | 81 | bool FOnlineIdentityEOS::Logout( int32 LocalUserNum ) 82 | { 83 | FString ErrorStr; 84 | if( EOSSubsystem->IsEOSInitialized() == true ) 85 | { 86 | EOS_HAuth AuthHandle = EOS_Platform_GetAuthInterface( EOSSubsystem->GetPlatformHandle() ); 87 | 88 | if( AuthHandle != nullptr ) 89 | { 90 | EOS_Auth_LogoutOptions LogoutOptions; 91 | LogoutOptions.ApiVersion = EOS_AUTH_LOGOUT_API_LATEST; 92 | LogoutOptions.LocalUserId = EpicAccountId; 93 | 94 | EOS_Auth_Logout( AuthHandle, &LogoutOptions, NULL, LogoutCompleteCallback ); 95 | 96 | return true; 97 | } 98 | else 99 | { 100 | ErrorStr = TEXT( "Failed to get AuthHandle." ); 101 | } 102 | } 103 | else 104 | { 105 | ErrorStr = TEXT( "EOS SDK Is not Initialized." ); 106 | } 107 | 108 | if( !ErrorStr.IsEmpty() ) 109 | { 110 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "Failed Epic Online Services logout. %s" ), *ErrorStr ); 111 | TriggerOnLoginCompleteDelegates( LocalUserNum, false, FUniqueNetIdEOS(), ErrorStr ); 112 | } 113 | 114 | return false; 115 | } 116 | 117 | bool FOnlineIdentityEOS::AutoLogin( int32 LocalUserNum ) 118 | { 119 | return false; 120 | } 121 | 122 | TSharedPtr FOnlineIdentityEOS::GetUserAccount( const FUniqueNetId& UserId ) const 123 | { 124 | //@todo - not implemented 125 | return nullptr; 126 | } 127 | 128 | TArray> FOnlineIdentityEOS::GetAllUserAccounts() const 129 | { 130 | //@todo - not implemented 131 | return TArray >(); 132 | } 133 | 134 | TSharedPtr FOnlineIdentityEOS::GetUniquePlayerId( int32 LocalUserNum ) const 135 | { 136 | return NULL; 137 | } 138 | 139 | TSharedPtr FOnlineIdentityEOS::CreateUniquePlayerId( uint8* Bytes, int32 Size ) 140 | { 141 | return NULL; 142 | } 143 | 144 | TSharedPtr FOnlineIdentityEOS::CreateUniquePlayerId( const FString& Str ) 145 | { 146 | return NULL; 147 | } 148 | 149 | ELoginStatus::Type FOnlineIdentityEOS::GetLoginStatus( int32 LocalUserNum ) const 150 | { 151 | return ELoginStatus::Type::NotLoggedIn; 152 | } 153 | 154 | ELoginStatus::Type FOnlineIdentityEOS::GetLoginStatus( const FUniqueNetId& UserId ) const 155 | { 156 | return ELoginStatus::Type::NotLoggedIn; 157 | } 158 | 159 | FString FOnlineIdentityEOS::GetPlayerNickname( int32 LocalUserNum ) const 160 | { 161 | return ""; 162 | } 163 | 164 | FString FOnlineIdentityEOS::GetPlayerNickname( const FUniqueNetId& UserId ) const 165 | { 166 | return ""; 167 | } 168 | 169 | FString FOnlineIdentityEOS::GetAuthToken( int32 LocalUserNum ) const 170 | { 171 | return ""; 172 | } 173 | 174 | void FOnlineIdentityEOS::RevokeAuthToken( const FUniqueNetId& UserId, const FOnRevokeAuthTokenCompleteDelegate& Delegate ) 175 | { 176 | 177 | } 178 | 179 | void FOnlineIdentityEOS::GetUserPrivilege( const FUniqueNetId& UserId, EUserPrivileges::Type Privilege, const FOnGetUserPrivilegeCompleteDelegate& Delegate ) 180 | { 181 | 182 | } 183 | 184 | FPlatformUserId FOnlineIdentityEOS::GetPlatformUserIdFromUniqueNetId( const FUniqueNetId& UniqueNetId ) const 185 | { 186 | return FPlatformUserId(); 187 | } 188 | 189 | FString FOnlineIdentityEOS::GetAuthType() const 190 | { 191 | return ""; 192 | } 193 | 194 | void FOnlineIdentityEOS::LoginCompleteCallback( const EOS_Auth_LoginCallbackInfo* Data ) 195 | { 196 | check( Data != NULL ); 197 | 198 | FUniqueNetIdEOS EpicId( Data->LocalUserId ); 199 | FString MessageText = FString::Printf( TEXT( "EOS Login Complete - User ID: %s" ), *EpicId.ToString() ); 200 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText ); 201 | 202 | IOnlineSubsystem* SubSystem = IOnlineSubsystem::Get( EOS_SUBSYSTEM ); 203 | FOnlineSubsystemEOS* EOSSubsystem = (FOnlineSubsystemEOS*)SubSystem; 204 | 205 | if( EOSSubsystem != nullptr ) 206 | { 207 | IOnlineIdentityPtr OnlineIdentity = EOSSubsystem->GetIdentityInterface(); 208 | 209 | if( OnlineIdentity != nullptr ) 210 | { 211 | EOS_HAuth AuthHandle = EOS_Platform_GetAuthInterface( EOSSubsystem->GetPlatformHandle() ); 212 | 213 | if( AuthHandle != nullptr ) 214 | { 215 | if( Data->ResultCode == EOS_EResult::EOS_Success ) 216 | { 217 | const int32_t AccountsCount = EOS_Auth_GetLoggedInAccountsCount( AuthHandle ); 218 | for( int32_t AccountIdx = 0; AccountIdx < AccountsCount; ++AccountIdx ) 219 | { 220 | FUniqueNetIdEOS EpicAccountId( EOS_Auth_GetLoggedInAccountByIndex( AuthHandle, AccountIdx ) ); 221 | 222 | EOS_ELoginStatus LoginStatus; 223 | LoginStatus = EOS_Auth_GetLoginStatus( AuthHandle, EpicAccountId.EpicAccountId ); 224 | 225 | MessageText = FString::Printf( TEXT( "EOS Login: AccountIdx: %d Status: %d" ), AccountIdx, (int32_t)LoginStatus ); 226 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText ); 227 | } 228 | 229 | // @todo: Match the returned User with some Local User Num. 230 | OnlineIdentity->TriggerOnLoginChangedDelegates( 0 ); 231 | // @todo: Match the returned User with some Local User Num. 232 | OnlineIdentity->TriggerOnLoginCompleteDelegates( 0, true, EpicId, TEXT( "" ) ); 233 | } 234 | else 235 | { 236 | MessageText = FString::Printf( TEXT( "EOS Login: Failed with Status: %s" ), *UEOSCommon::EOSResultToString( Data->ResultCode ) ); 237 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText ); 238 | // @todo: Match the returned User with some Local User Num. 239 | int32 LocalUserNum = 0; 240 | OnlineIdentity->TriggerOnLoginCompleteDelegates( LocalUserNum, false, FUniqueNetIdEOS(), MessageText ); 241 | } 242 | } 243 | else 244 | { 245 | MessageText = FString::Printf( TEXT( "EOS Login: Failed to retrieve EOS Auth Handle." ) ); 246 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText ); 247 | 248 | // @todo: Match the returned User with some Local User Num. 249 | int32 LocalUserNum = 0; 250 | OnlineIdentity->TriggerOnLoginCompleteDelegates( LocalUserNum, false, FUniqueNetIdEOS(), MessageText ); 251 | } 252 | } 253 | else 254 | { 255 | MessageText = FString::Printf( TEXT( "EOS Login: Failed to retrieve EOS Online Identity Interface." ) ); 256 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText ); 257 | } 258 | } 259 | else 260 | { 261 | MessageText = FString::Printf( TEXT( "EOS Login: Cannot retrieve EOS Subsystem." ) ); 262 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText ); 263 | } 264 | } 265 | 266 | void FOnlineIdentityEOS::LogoutCompleteCallback( const EOS_Auth_LogoutCallbackInfo* Data ) 267 | { 268 | check( Data != NULL ); 269 | 270 | FString MessageText = FString::Printf( TEXT( "EOS Logout Complete." ) ); 271 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText ); 272 | 273 | IOnlineSubsystem* SubSystem = IOnlineSubsystem::Get( EOS_SUBSYSTEM ); 274 | 275 | if( SubSystem != nullptr ) 276 | { 277 | IOnlineIdentityPtr OnlineIdentity = SubSystem->GetIdentityInterface(); 278 | 279 | if( OnlineIdentity != nullptr ) 280 | { 281 | OnlineIdentity->TriggerOnLogoutCompleteDelegates( 0, false ); 282 | } 283 | } 284 | else 285 | { 286 | MessageText = FString::Printf( TEXT( "EOS Login: Failed to retrieve EOS Online Identity Interface." ) ); 287 | UE_LOG_ONLINE_IDENTITY( Warning, TEXT( "%s" ), *MessageText ); 288 | } 289 | } 290 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Private/OnlineIdentityInterfaceEOS.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #pragma once 4 | 5 | // Engine Includes 6 | #include "CoreMinimal.h" 7 | #include "UObject/CoreOnline.h" 8 | #include "Interfaces/OnlineIdentityInterface.h" 9 | 10 | // EOS Subsystem Includes 11 | #include "OnlineSubsystemEOS.h" 12 | #include "OnlineSubsystemEOSTypes.h" 13 | 14 | // EOS SDK Includes 15 | #include "eos_sdk.h" 16 | #include "eos_auth.h" 17 | 18 | // Forward Declarations 19 | class FOnlineSubsystemEOS; 20 | 21 | 22 | 23 | class FOnlineIdentityEOS : public IOnlineIdentity 24 | { 25 | 26 | public: 27 | 28 | virtual ~FOnlineIdentityEOS() {}; 29 | 30 | // IOnlineIdentity 31 | 32 | virtual bool Login( int32 LocalUserNum, const FOnlineAccountCredentials& AccountCredentials ) override; 33 | virtual bool Logout( int32 LocalUserNum ) override; 34 | virtual bool AutoLogin( int32 LocalUserNum ) override; 35 | virtual TSharedPtr GetUserAccount( const FUniqueNetId& UserId ) const override; 36 | virtual TArray> GetAllUserAccounts() const override; 37 | virtual TSharedPtr GetUniquePlayerId( int32 LocalUserNum ) const override; 38 | virtual TSharedPtr CreateUniquePlayerId( uint8* Bytes, int32 Size ) override; 39 | virtual TSharedPtr CreateUniquePlayerId( const FString& Str ) override; 40 | virtual ELoginStatus::Type GetLoginStatus( int32 LocalUserNum ) const override; 41 | virtual ELoginStatus::Type GetLoginStatus( const FUniqueNetId& UserId ) const override; 42 | virtual FString GetPlayerNickname( int32 LocalUserNum ) const override; 43 | virtual FString GetPlayerNickname( const FUniqueNetId& UserId ) const override; 44 | virtual FString GetAuthToken( int32 LocalUserNum ) const override; 45 | virtual void RevokeAuthToken( const FUniqueNetId& UserId, const FOnRevokeAuthTokenCompleteDelegate& Delegate ) override; 46 | virtual void GetUserPrivilege( const FUniqueNetId& UserId, EUserPrivileges::Type Privilege, const FOnGetUserPrivilegeCompleteDelegate& Delegate ) override; 47 | virtual FPlatformUserId GetPlatformUserIdFromUniqueNetId( const FUniqueNetId& UniqueNetId ) const override; 48 | virtual FString GetAuthType() const override; 49 | 50 | protected: 51 | 52 | static void LoginCompleteCallback( const EOS_Auth_LoginCallbackInfo* Data ); 53 | 54 | static void LogoutCompleteCallback( const EOS_Auth_LogoutCallbackInfo* Data ); 55 | 56 | /** The Epic Account ID for this Authentication session. */ 57 | FUniqueNetIdEOS EpicAccountId; 58 | 59 | private: 60 | 61 | PACKAGE_SCOPE : 62 | 63 | FOnlineIdentityEOS( FOnlineSubsystemEOS* InSubsystem ); 64 | 65 | /** The steam user interface to use when interacting with steam */ 66 | //class ISteamUser* SteamUserPtr; 67 | /** The steam friends interface to use when interacting with steam */ 68 | //class ISteamFriends* SteamFriendsPtr; 69 | 70 | /** Cached pointer to owning subsystem */ 71 | FOnlineSubsystemEOS* EOSSubsystem; 72 | }; 73 | 74 | typedef TSharedPtr FOnlineIdentityEOSPtr; -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Private/OnlineSessionInterfaceEOS.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #include "OnlineSessionInterfaceEOS.h" 4 | 5 | 6 | TSharedPtr FOnlineSessionEOS::CreateSessionIdFromString( const FString& SessionIdStr ) 7 | { 8 | if( !SessionIdStr.IsEmpty() ) 9 | { 10 | return MakeShared( SessionIdStr ); 11 | } 12 | 13 | return nullptr; 14 | } 15 | 16 | FNamedOnlineSession* FOnlineSessionEOS::AddNamedSession( FName SessionName, const FOnlineSessionSettings& SessionSettings ) 17 | { 18 | FScopeLock ScopeLock( &SessionLock ); 19 | return new ( Sessions ) FNamedOnlineSession( SessionName, SessionSettings ); 20 | } 21 | 22 | FNamedOnlineSession* FOnlineSessionEOS::AddNamedSession( FName SessionName, const FOnlineSession& Session ) 23 | { 24 | FScopeLock ScopeLock( &SessionLock ); 25 | return new ( Sessions ) FNamedOnlineSession( SessionName, Session ); 26 | } 27 | 28 | FNamedOnlineSession* FOnlineSessionEOS::GetNamedSession( FName SessionName ) 29 | { 30 | FScopeLock ScopeLock( &SessionLock ); 31 | for( int32 SearchIndex = 0; SearchIndex < Sessions.Num(); SearchIndex++ ) 32 | { 33 | if( Sessions[SearchIndex].SessionName == SessionName ) 34 | { 35 | return &Sessions[SearchIndex]; 36 | } 37 | } 38 | 39 | return nullptr; 40 | } 41 | 42 | FNamedOnlineSession* FOnlineSessionEOS::GetNamedSessionFromLobbyId( FUniqueNetIdEOS& LobbyId ) 43 | { 44 | FScopeLock ScopeLock( &SessionLock ); 45 | for( int32 SearchIndex = 0; SearchIndex < Sessions.Num(); SearchIndex++ ) 46 | { 47 | FNamedOnlineSession& Session = Sessions[SearchIndex]; 48 | if( Session.SessionInfo.IsValid() ) 49 | { 50 | FOnlineSessionInfoEOS* SessionInfo = (FOnlineSessionInfoEOS*)Session.SessionInfo.Get(); 51 | if( SessionInfo->SessionType == EEOSSession::LobbySession && SessionInfo->SessionId == LobbyId ) 52 | { 53 | return &Sessions[SearchIndex]; 54 | } 55 | } 56 | } 57 | return nullptr; 58 | } 59 | 60 | void FOnlineSessionEOS::RemoveNamedSession( FName SessionName ) 61 | { 62 | FScopeLock ScopeLock( &SessionLock ); 63 | for( int32 SearchIndex = 0; SearchIndex < Sessions.Num(); SearchIndex++ ) 64 | { 65 | if( Sessions[SearchIndex].SessionName == SessionName ) 66 | { 67 | Sessions.RemoveAtSwap( SearchIndex ); 68 | return; 69 | } 70 | } 71 | } 72 | 73 | bool FOnlineSessionEOS::HasPresenceSession() 74 | { 75 | FScopeLock ScopeLock( &SessionLock ); 76 | for( int32 SearchIndex = 0; SearchIndex < Sessions.Num(); SearchIndex++ ) 77 | { 78 | if( Sessions[SearchIndex].SessionSettings.bUsesPresence ) 79 | { 80 | return true; 81 | } 82 | } 83 | 84 | return false; 85 | } 86 | 87 | EOnlineSessionState::Type FOnlineSessionEOS::GetSessionState( FName SessionName ) const 88 | { 89 | FScopeLock ScopeLock( &SessionLock ); 90 | for( int32 SearchIndex = 0; SearchIndex < Sessions.Num(); SearchIndex++ ) 91 | { 92 | if( Sessions[SearchIndex].SessionName == SessionName ) 93 | { 94 | return Sessions[SearchIndex].SessionState; 95 | } 96 | } 97 | 98 | return EOnlineSessionState::NoSession; 99 | } 100 | 101 | bool FOnlineSessionEOS::CreateSession( int32 HostingPlayerNum, FName SessionName, const FOnlineSessionSettings& NewSessionSettings ) 102 | { 103 | return false; 104 | } 105 | 106 | bool FOnlineSessionEOS::CreateSession( const FUniqueNetId& HostingPlayerId, FName SessionName, const FOnlineSessionSettings& NewSessionSettings ) 107 | { 108 | return false; 109 | } 110 | 111 | bool FOnlineSessionEOS::StartSession( FName SessionName ) 112 | { 113 | return false; 114 | } 115 | 116 | bool FOnlineSessionEOS::UpdateSession( FName SessionName, FOnlineSessionSettings& UpdatedSessionSettings, bool bShouldRefreshOnlineData ) 117 | { 118 | return false; 119 | } 120 | 121 | bool FOnlineSessionEOS::EndSession( FName SessionName ) 122 | { 123 | return false; 124 | } 125 | 126 | bool FOnlineSessionEOS::DestroySession( FName SessionName, const FOnDestroySessionCompleteDelegate& CompletionDelegate ) 127 | { 128 | return false; 129 | } 130 | 131 | bool FOnlineSessionEOS::IsPlayerInSession( FName SessionName, const FUniqueNetId& UniqueId ) 132 | { 133 | return false; 134 | } 135 | 136 | bool FOnlineSessionEOS::StartMatchmaking( const TArray< TSharedRef >& LocalPlayers, FName SessionName, const FOnlineSessionSettings& NewSessionSettings, TSharedRef& SearchSettings ) 137 | { 138 | return false; 139 | } 140 | 141 | bool FOnlineSessionEOS::CancelMatchmaking( int32 SearchingPlayerNum, FName SessionName ) 142 | { 143 | return false; 144 | } 145 | 146 | bool FOnlineSessionEOS::CancelMatchmaking( const FUniqueNetId& SearchingPlayerId, FName SessionName ) 147 | { 148 | return false; 149 | } 150 | 151 | bool FOnlineSessionEOS::FindSessions( int32 SearchingPlayerNum, const TSharedRef& SearchSettings ) 152 | { 153 | return false; 154 | } 155 | 156 | bool FOnlineSessionEOS::FindSessions( const FUniqueNetId& SearchingPlayerId, const TSharedRef& SearchSettings ) 157 | { 158 | return false; 159 | } 160 | 161 | bool FOnlineSessionEOS::FindSessionById( const FUniqueNetId& SearchingUserId, const FUniqueNetId& SessionId, const FUniqueNetId& FriendId, const FOnSingleSessionResultCompleteDelegate& CompletionDelegate ) 162 | { 163 | return false; 164 | } 165 | 166 | bool FOnlineSessionEOS::CancelFindSessions() 167 | { 168 | return false; 169 | } 170 | 171 | bool FOnlineSessionEOS::PingSearchResults( const FOnlineSessionSearchResult& SearchResult ) 172 | { 173 | return false; 174 | } 175 | 176 | bool FOnlineSessionEOS::JoinSession( int32 PlayerNum, FName SessionName, const FOnlineSessionSearchResult& DesiredSession ) 177 | { 178 | return false; 179 | } 180 | 181 | bool FOnlineSessionEOS::JoinSession( const FUniqueNetId& PlayerId, FName SessionName, const FOnlineSessionSearchResult& DesiredSession ) 182 | { 183 | return false; 184 | } 185 | 186 | bool FOnlineSessionEOS::FindFriendSession( int32 LocalUserNum, const FUniqueNetId& Friend ) 187 | { 188 | return false; 189 | } 190 | 191 | bool FOnlineSessionEOS::FindFriendSession( const FUniqueNetId& LocalUserId, const FUniqueNetId& Friend ) 192 | { 193 | return false; 194 | } 195 | 196 | bool FOnlineSessionEOS::FindFriendSession( const FUniqueNetId& LocalUserId, const TArray>& FriendList ) 197 | { 198 | return false; 199 | } 200 | 201 | bool FOnlineSessionEOS::SendSessionInviteToFriend( int32 LocalUserNum, FName SessionName, const FUniqueNetId& Friend ) 202 | { 203 | return false; 204 | } 205 | 206 | bool FOnlineSessionEOS::SendSessionInviteToFriend( const FUniqueNetId& LocalUserId, FName SessionName, const FUniqueNetId& Friend ) 207 | { 208 | return false; 209 | } 210 | 211 | bool FOnlineSessionEOS::SendSessionInviteToFriends( int32 LocalUserNum, FName SessionName, const TArray>& Friends ) 212 | { 213 | return false; 214 | } 215 | 216 | bool FOnlineSessionEOS::SendSessionInviteToFriends( const FUniqueNetId& LocalUserId, FName SessionName, const TArray>& Friends ) 217 | { 218 | return false; 219 | } 220 | 221 | bool FOnlineSessionEOS::GetResolvedConnectString( FName SessionName, FString& ConnectInfo, FName PortType ) 222 | { 223 | return false; 224 | } 225 | 226 | bool FOnlineSessionEOS::GetResolvedConnectString( const FOnlineSessionSearchResult& SearchResult, FName PortType, FString& ConnectInfo ) 227 | { 228 | return false; 229 | } 230 | 231 | FOnlineSessionSettings* FOnlineSessionEOS::GetSessionSettings( FName SessionName ) 232 | { 233 | return nullptr; 234 | } 235 | 236 | bool FOnlineSessionEOS::RegisterPlayer( FName SessionName, const FUniqueNetId& PlayerId, bool bWasInvited ) 237 | { 238 | return false; 239 | } 240 | 241 | bool FOnlineSessionEOS::RegisterPlayers( FName SessionName, const TArray< TSharedRef >& Players, bool bWasInvited ) 242 | { 243 | return false; 244 | } 245 | 246 | bool FOnlineSessionEOS::UnregisterPlayer( FName SessionName, const FUniqueNetId& PlayerId ) 247 | { 248 | return false; 249 | } 250 | 251 | bool FOnlineSessionEOS::UnregisterPlayers( FName SessionName, const TArray< TSharedRef >& Players ) 252 | { 253 | return false; 254 | } 255 | 256 | void FOnlineSessionEOS::RegisterLocalPlayer( const FUniqueNetId& PlayerId, FName SessionName, const FOnRegisterLocalPlayerCompleteDelegate& Delegate ) 257 | { 258 | 259 | } 260 | 261 | void FOnlineSessionEOS::UnregisterLocalPlayer( const FUniqueNetId& PlayerId, FName SessionName, const FOnUnregisterLocalPlayerCompleteDelegate& Delegate ) 262 | { 263 | 264 | } 265 | 266 | int32 FOnlineSessionEOS::GetNumSessions() 267 | { 268 | return -1; 269 | } 270 | 271 | void FOnlineSessionEOS::DumpSessionState() 272 | { 273 | 274 | } 275 | 276 | /** Implementation of the ConnectionMethod converters */ 277 | FString LexToString( const FEOSConnectionMethod Method ) 278 | { 279 | switch( Method ) 280 | { 281 | default: 282 | case FEOSConnectionMethod::None: 283 | return TEXT( "None" ); 284 | case FEOSConnectionMethod::Direct: 285 | return TEXT( "Direct" ); 286 | case FEOSConnectionMethod::P2P: 287 | return TEXT( "P2P" ); 288 | case FEOSConnectionMethod::PartnerHosted: 289 | return TEXT( "PartnerHosted" ); 290 | } 291 | } 292 | 293 | FEOSConnectionMethod ToConnectionMethod( const FString& InString ) 294 | { 295 | if( InString == TEXT( "Direct" ) ) 296 | { 297 | return FEOSConnectionMethod::Direct; 298 | } 299 | else if( InString == TEXT( "P2P" ) ) 300 | { 301 | return FEOSConnectionMethod::P2P; 302 | } 303 | else if( InString == TEXT( "PartnerHosted" ) ) 304 | { 305 | return FEOSConnectionMethod::PartnerHosted; 306 | } 307 | else 308 | { 309 | return FEOSConnectionMethod::None; 310 | } 311 | } 312 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Private/OnlineSessionInterfaceEOS.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #pragma once 4 | 5 | // UE4 Includes 6 | #include "CoreMinimal.h" 7 | #include "UObject/CoreOnline.h" 8 | #include "Misc/ScopeLock.h" 9 | #include "OnlineKeyValuePair.h" 10 | #include "OnlineSessionSettings.h" 11 | #include "Interfaces/OnlineSessionInterface.h" 12 | 13 | // EOS Includes 14 | #include "OnlineSubsystemEOSTypes.h" 15 | 16 | 17 | // Forward Declarations 18 | class FOnlineSubsystemEOS; 19 | class FLANSession; 20 | class FNamedOnlineSession; 21 | 22 | 23 | 24 | /** 25 | * Interface definition for the online services session services 26 | * Session services are defined as anything related managing a session 27 | * and its state within a platform service 28 | */ 29 | class FOnlineSessionEOS : public IOnlineSession 30 | { 31 | 32 | public: 33 | 34 | PACKAGE_SCOPE : 35 | 36 | FOnlineSessionEOS( FOnlineSubsystemEOS* InSubsystem ) 37 | : EOSSubsystem( InSubsystem ) 38 | , LANSession( nullptr ) 39 | {} 40 | 41 | virtual ~FOnlineSessionEOS() {} 42 | 43 | // IOnlineSession 44 | 45 | virtual TSharedPtr CreateSessionIdFromString( const FString& SessionIdStr ) override; 46 | 47 | /** 48 | * Adds a new named session to the list (new session) 49 | * 50 | * @param SessionName the name to search for 51 | * @param GameSettings the game settings to add 52 | * 53 | * @return a pointer to the struct that was added 54 | */ 55 | FNamedOnlineSession* AddNamedSession( FName SessionName, const FOnlineSessionSettings& SessionSettings ) override; 56 | 57 | /** 58 | * Adds a new named session to the list (from existing session data) 59 | * 60 | * @param SessionName the name to search for 61 | * @param GameSettings the game settings to add 62 | * 63 | * @return a pointer to the struct that was added 64 | */ 65 | FNamedOnlineSession* AddNamedSession( FName SessionName, const FOnlineSession& Session ) override; 66 | 67 | FNamedOnlineSession* GetNamedSession( FName SessionName ) override; 68 | 69 | /** 70 | * Searches the named session array for the specified session 71 | * 72 | * @param LobbyId the lobby id to search for 73 | * 74 | * @return pointer to the struct if found, NULL otherwise 75 | */ 76 | inline FNamedOnlineSession* GetNamedSessionFromLobbyId( FUniqueNetIdEOS& LobbyId ); 77 | 78 | virtual void RemoveNamedSession( FName SessionName ) override; 79 | virtual bool HasPresenceSession() override; 80 | virtual EOnlineSessionState::Type GetSessionState( FName SessionName ) const override; 81 | 82 | virtual bool CreateSession( int32 HostingPlayerNum, FName SessionName, const FOnlineSessionSettings& NewSessionSettings ) override; 83 | virtual bool CreateSession( const FUniqueNetId& HostingPlayerId, FName SessionName, const FOnlineSessionSettings& NewSessionSettings ) override; 84 | virtual bool StartSession( FName SessionName ) override; 85 | virtual bool UpdateSession( FName SessionName, FOnlineSessionSettings& UpdatedSessionSettings, bool bShouldRefreshOnlineData = true ) override; 86 | virtual bool EndSession( FName SessionName ) override; 87 | virtual bool DestroySession( FName SessionName, const FOnDestroySessionCompleteDelegate& CompletionDelegate = FOnDestroySessionCompleteDelegate() ) override; 88 | virtual bool IsPlayerInSession( FName SessionName, const FUniqueNetId& UniqueId ) override; 89 | virtual bool StartMatchmaking( const TArray< TSharedRef >& LocalPlayers, FName SessionName, const FOnlineSessionSettings& NewSessionSettings, TSharedRef& SearchSettings ) override; 90 | virtual bool CancelMatchmaking( int32 SearchingPlayerNum, FName SessionName ) override; 91 | virtual bool CancelMatchmaking( const FUniqueNetId& SearchingPlayerId, FName SessionName ) override; 92 | virtual bool FindSessions( int32 SearchingPlayerNum, const TSharedRef& SearchSettings ) override; 93 | virtual bool FindSessions( const FUniqueNetId& SearchingPlayerId, const TSharedRef& SearchSettings ) override; 94 | virtual bool FindSessionById( const FUniqueNetId& SearchingUserId, const FUniqueNetId& SessionId, const FUniqueNetId& FriendId, const FOnSingleSessionResultCompleteDelegate& CompletionDelegate ) override; 95 | virtual bool CancelFindSessions() override; 96 | virtual bool PingSearchResults( const FOnlineSessionSearchResult& SearchResult ) override; 97 | virtual bool JoinSession( int32 PlayerNum, FName SessionName, const FOnlineSessionSearchResult& DesiredSession ) override; 98 | virtual bool JoinSession( const FUniqueNetId& PlayerId, FName SessionName, const FOnlineSessionSearchResult& DesiredSession ) override; 99 | virtual bool FindFriendSession( int32 LocalUserNum, const FUniqueNetId& Friend ) override; 100 | virtual bool FindFriendSession( const FUniqueNetId& LocalUserId, const FUniqueNetId& Friend ) override; 101 | virtual bool FindFriendSession( const FUniqueNetId& LocalUserId, const TArray>& FriendList ) override; 102 | virtual bool SendSessionInviteToFriend( int32 LocalUserNum, FName SessionName, const FUniqueNetId& Friend ) override; 103 | virtual bool SendSessionInviteToFriend( const FUniqueNetId& LocalUserId, FName SessionName, const FUniqueNetId& Friend ) override; 104 | virtual bool SendSessionInviteToFriends( int32 LocalUserNum, FName SessionName, const TArray< TSharedRef >& Friends ) override; 105 | virtual bool SendSessionInviteToFriends( const FUniqueNetId& LocalUserId, FName SessionName, const TArray< TSharedRef >& Friends ) override; 106 | virtual bool GetResolvedConnectString( FName SessionName, FString& ConnectInfo, FName PortType ) override; 107 | virtual bool GetResolvedConnectString( const FOnlineSessionSearchResult& SearchResult, FName PortType, FString& ConnectInfo ) override; 108 | virtual FOnlineSessionSettings* GetSessionSettings( FName SessionName ) override; 109 | virtual bool RegisterPlayer( FName SessionName, const FUniqueNetId& PlayerId, bool bWasInvited ) override; 110 | virtual bool RegisterPlayers( FName SessionName, const TArray< TSharedRef >& Players, bool bWasInvited = false ) override; 111 | virtual bool UnregisterPlayer( FName SessionName, const FUniqueNetId& PlayerId ) override; 112 | virtual bool UnregisterPlayers( FName SessionName, const TArray< TSharedRef >& Players ) override; 113 | virtual void RegisterLocalPlayer( const FUniqueNetId& PlayerId, FName SessionName, const FOnRegisterLocalPlayerCompleteDelegate& Delegate ) override; 114 | virtual void UnregisterLocalPlayer( const FUniqueNetId& PlayerId, FName SessionName, const FOnUnregisterLocalPlayerCompleteDelegate& Delegate ) override; 115 | virtual int32 GetNumSessions() override; 116 | virtual void DumpSessionState() override; 117 | 118 | protected: 119 | 120 | /** Critical sections for thread safe operation of session lists */ 121 | mutable FCriticalSection SessionLock; 122 | 123 | /** Current session settings */ 124 | TArray Sessions; 125 | 126 | private: 127 | 128 | /** Reference to the main EOS subsystem */ 129 | FOnlineSubsystemEOS* EOSSubsystem; 130 | 131 | /** Instance of a LAN session for hosting/client searches */ 132 | FLANSession* LANSession; 133 | 134 | /** Hidden on purpose */ 135 | FOnlineSessionEOS() 136 | : EOSSubsystem( nullptr ) 137 | , LANSession( nullptr ) 138 | {} 139 | 140 | }; 141 | 142 | typedef TSharedPtr FOnlineSessionEOSPtr; 143 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Private/OnlineSubsystemEOS.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #include "OnlineSubsystemEOS.h" 4 | 5 | // UE4 Includes 6 | #include "Core.h" 7 | #include "UObject/ObjectMacros.h" 8 | 9 | // OSS EOS Includes 10 | #include "OnlineIdentityInterfaceEOS.h" 11 | #include "OnlineSessionInterfaceEOS.h" 12 | 13 | 14 | IOnlineSessionPtr FOnlineSubsystemEOS::GetSessionInterface() const 15 | { 16 | return SessionInterface; 17 | } 18 | 19 | IOnlineFriendsPtr FOnlineSubsystemEOS::GetFriendsInterface() const 20 | { 21 | return nullptr; 22 | } 23 | 24 | IOnlinePartyPtr FOnlineSubsystemEOS::GetPartyInterface() const 25 | { 26 | return nullptr; 27 | } 28 | 29 | IOnlineGroupsPtr FOnlineSubsystemEOS::GetGroupsInterface() const 30 | { 31 | return nullptr; 32 | } 33 | 34 | IOnlineSharedCloudPtr FOnlineSubsystemEOS::GetSharedCloudInterface() const 35 | { 36 | return nullptr; 37 | } 38 | 39 | IOnlineUserCloudPtr FOnlineSubsystemEOS::GetUserCloudInterface() const 40 | { 41 | return nullptr; 42 | } 43 | 44 | IOnlineLeaderboardsPtr FOnlineSubsystemEOS::GetLeaderboardsInterface() const 45 | { 46 | return nullptr; 47 | } 48 | 49 | IOnlineVoicePtr FOnlineSubsystemEOS::GetVoiceInterface() const 50 | { 51 | return nullptr; 52 | } 53 | 54 | IOnlineExternalUIPtr FOnlineSubsystemEOS::GetExternalUIInterface() const 55 | { 56 | return nullptr; 57 | } 58 | 59 | IOnlineTimePtr FOnlineSubsystemEOS::GetTimeInterface() const 60 | { 61 | return nullptr; 62 | } 63 | 64 | IOnlineIdentityPtr FOnlineSubsystemEOS::GetIdentityInterface() const 65 | { 66 | return IdentityInterface; 67 | } 68 | 69 | IOnlineTitleFilePtr FOnlineSubsystemEOS::GetTitleFileInterface() const 70 | { 71 | return nullptr; 72 | } 73 | 74 | IOnlineEntitlementsPtr FOnlineSubsystemEOS::GetEntitlementsInterface() const 75 | { 76 | return nullptr; 77 | } 78 | 79 | IOnlineStorePtr FOnlineSubsystemEOS::GetStoreInterface() const 80 | { 81 | return nullptr; 82 | } 83 | 84 | IOnlineStoreV2Ptr FOnlineSubsystemEOS::GetStoreV2Interface() const 85 | { 86 | return nullptr; 87 | } 88 | 89 | IOnlinePurchasePtr FOnlineSubsystemEOS::GetPurchaseInterface() const 90 | { 91 | return nullptr; 92 | } 93 | 94 | IOnlineEventsPtr FOnlineSubsystemEOS::GetEventsInterface() const 95 | { 96 | return nullptr; 97 | } 98 | 99 | IOnlineAchievementsPtr FOnlineSubsystemEOS::GetAchievementsInterface() const 100 | { 101 | return nullptr; 102 | } 103 | 104 | IOnlineSharingPtr FOnlineSubsystemEOS::GetSharingInterface() const 105 | { 106 | return nullptr; 107 | } 108 | 109 | IOnlineUserPtr FOnlineSubsystemEOS::GetUserInterface() const 110 | { 111 | return nullptr; 112 | } 113 | 114 | IOnlineMessagePtr FOnlineSubsystemEOS::GetMessageInterface() const 115 | { 116 | return nullptr; 117 | } 118 | 119 | IOnlinePresencePtr FOnlineSubsystemEOS::GetPresenceInterface() const 120 | { 121 | return nullptr; 122 | } 123 | 124 | IOnlineChatPtr FOnlineSubsystemEOS::GetChatInterface() const 125 | { 126 | return nullptr; 127 | } 128 | 129 | IOnlineStatsPtr FOnlineSubsystemEOS::GetStatsInterface() const 130 | { 131 | return nullptr; 132 | } 133 | 134 | IOnlineTurnBasedPtr FOnlineSubsystemEOS::GetTurnBasedInterface() const 135 | { 136 | return nullptr; 137 | } 138 | 139 | IOnlineTournamentPtr FOnlineSubsystemEOS::GetTournamentInterface() const 140 | { 141 | return nullptr; 142 | } 143 | 144 | bool FOnlineSubsystemEOS::IsLocalPlayer( const FUniqueNetId& UniqueId ) const 145 | { 146 | return false; 147 | } 148 | 149 | bool FOnlineSubsystemEOS::Init() 150 | { 151 | if( IsEOSInitialized() == false ) 152 | { 153 | // Attempt to initialize the SDK! 154 | if( GetEOSConfigOptions() == false ) 155 | { 156 | UE_LOG_ONLINE( Warning, TEXT( "Could not gather EOS Config Options! Falling back to another OSS." ) ); 157 | return false; 158 | } 159 | 160 | // Have config values, attempt to initialize the EOS SDK 161 | if( InitializeSDK() == false ) 162 | { 163 | UE_LOG_ONLINE( Warning, TEXT( "Could not initialize EOS SDK! Falling back to another OSS." ) ); 164 | return false; 165 | } 166 | } 167 | 168 | // Initialized the SDK, attempt to get a Platform Handle 169 | if( CreatePlatformHandle() == false ) 170 | { 171 | UE_LOG_ONLINE( Warning, TEXT( "Could not create Platform Handle from EOS SDK! Falling back to another OSS." ) ); 172 | return false; 173 | } 174 | 175 | // Instantiate Online Subsystem interfaces 176 | IdentityInterface = MakeShareable( new FOnlineIdentityEOS( this ) ); 177 | SessionInterface = MakeShareable( new FOnlineSessionEOS( this ) ); 178 | 179 | return true; 180 | } 181 | 182 | bool FOnlineSubsystemEOS::Shutdown() 183 | { 184 | FOnlineSubsystemImpl::Shutdown(); 185 | 186 | // Attempt to end any Async Processes. 187 | 188 | #define DESTRUCT_INTERFACE(Interface) \ 189 | if( Interface.IsValid() ) \ 190 | { \ 191 | ensure( Interface.IsUnique() ); \ 192 | Interface = nullptr; \ 193 | } 194 | 195 | // Destroy Online Subsystem interfaces 196 | DESTRUCT_INTERFACE( IdentityInterface ); 197 | DESTRUCT_INTERFACE( SessionInterface ); 198 | 199 | if( IsEOSInitialized() == true ) 200 | { 201 | // Attempt to Shutdown the SDK. 202 | EOS_EResult ShutdownResult = EOS_Shutdown(); 203 | 204 | if( ShutdownResult != EOS_EResult::EOS_Success ) 205 | { 206 | UE_LOG_ONLINE( Warning, TEXT( "EOS SDK Shutdown failed!" ) ); 207 | return false; 208 | } 209 | 210 | bEOSInitialized = false; 211 | } 212 | 213 | return true; 214 | } 215 | 216 | bool FOnlineSubsystemEOS::Exec( class UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar ) 217 | { 218 | if( FOnlineSubsystemImpl::Exec( InWorld, Cmd, Ar ) ) 219 | { 220 | return true; 221 | } 222 | 223 | return false; 224 | } 225 | 226 | bool FOnlineSubsystemEOS::IsEnabled() const 227 | { 228 | return FOnlineSubsystemImpl::IsEnabled(); 229 | } 230 | 231 | FString FOnlineSubsystemEOS::GetAppId() const 232 | { 233 | return ""; 234 | } 235 | 236 | FText FOnlineSubsystemEOS::GetOnlineServiceName() const 237 | { 238 | return NSLOCTEXT( "OnlineSubsystemEOS", "OnlineServiceName", "EOS" ); 239 | } 240 | 241 | bool FOnlineSubsystemEOS::Tick( float DeltaTime ) 242 | { 243 | if( IsEOSInitialized() == true ) 244 | { 245 | if( PlatformHandle == nullptr ) 246 | { 247 | UE_LOG_ONLINE( Warning, TEXT( "Can Tick EOS, PlatformHandle is invalid." ) ); 248 | bEOSInitialized = false; 249 | return false; 250 | } 251 | 252 | EOS_Platform_Tick( PlatformHandle ); 253 | } 254 | 255 | return true; 256 | } 257 | 258 | bool FOnlineSubsystemEOS::GetEOSConfigOptions() 259 | { 260 | if( GConfig->GetString( TEXT( "OnlineSubsystemEOS" ), TEXT( "ProductName" ), ProductName, GEngineIni ) == false ) 261 | { 262 | UE_LOG_ONLINE( Warning, TEXT( "Missing ProductName key in OnlineSubsystemEOS of DefaultEngine.ini" ) ); 263 | return false; 264 | } 265 | 266 | if( GConfig->GetString( TEXT( "OnlineSubsystemEOS" ), TEXT( "ProductVersion" ), ProductVersion, GEngineIni ) == false ) 267 | { 268 | UE_LOG_ONLINE( Warning, TEXT( "Missing ProductVersion key in OnlineSubsystemEOS of DefaultEngine.ini" ) ); 269 | return false; 270 | } 271 | 272 | if( GConfig->GetString( TEXT( "OnlineSubsystemEOS" ), TEXT( "ProductId" ), ProductId, GEngineIni ) == false ) 273 | { 274 | UE_LOG_ONLINE( Warning, TEXT( "Missing ProductId key in OnlineSubsystemEOS of DefaultEngine.ini" ) ); 275 | return false; 276 | } 277 | 278 | if( GConfig->GetString( TEXT( "OnlineSubsystemEOS" ), TEXT( "SandboxId" ), SandboxId, GEngineIni ) == false ) 279 | { 280 | UE_LOG_ONLINE( Warning, TEXT( "Missing SandboxId key in OnlineSubsystemEOS of DefaultEngine.ini" ) ); 281 | return false; 282 | } 283 | 284 | if( GConfig->GetString( TEXT( "OnlineSubsystemEOS" ), TEXT( "DeploymentId" ), DeploymentId, GEngineIni ) == false ) 285 | { 286 | UE_LOG_ONLINE( Warning, TEXT( "Missing DeploymentId key in OnlineSubsystemEOS of DefaultEngine.ini" ) ); 287 | return false; 288 | } 289 | 290 | if( GConfig->GetString( TEXT( "OnlineSubsystemEOS" ), TEXT( "ClientId" ), ClientId, GEngineIni ) == false ) 291 | { 292 | UE_LOG_ONLINE( Warning, TEXT( "Missing ClientId key in OnlineSubsystemEOS of DefaultEngine.ini" ) ); 293 | return false; 294 | } 295 | 296 | if( GConfig->GetString( TEXT( "OnlineSubsystemEOS" ), TEXT( "ClientSecret" ), ClientSecret, GEngineIni ) == false ) 297 | { 298 | UE_LOG_ONLINE( Warning, TEXT( "Missing ClientSecret key in OnlineSubsystemEOS of DefaultEngine.ini" ) ); 299 | return false; 300 | } 301 | 302 | UE_LOG_ONLINE( Warning, TEXT( "EOS Config: Success." ) ); 303 | 304 | return true; 305 | } 306 | 307 | bool FOnlineSubsystemEOS::InitializeSDK() 308 | { 309 | FTCHARToUTF8 ProductNameStr( *ProductName ); 310 | FTCHARToUTF8 ProductVersionStr( *ProductVersion ); 311 | 312 | // Init EOS SDK 313 | EOS_InitializeOptions SDKOptions; 314 | SDKOptions.ApiVersion = EOS_INITIALIZE_API_LATEST; 315 | SDKOptions.AllocateMemoryFunction = nullptr; 316 | SDKOptions.ReallocateMemoryFunction = nullptr; 317 | SDKOptions.ReleaseMemoryFunction = nullptr; 318 | SDKOptions.ProductName = ProductNameStr.Get(); 319 | SDKOptions.ProductVersion = ProductVersionStr.Get(); 320 | SDKOptions.Reserved = nullptr; 321 | SDKOptions.SystemInitializeOptions = nullptr; 322 | SDKOptions.OverrideThreadAffinity = nullptr; 323 | 324 | EOS_EResult InitResult = EOS_Initialize( &SDKOptions ); 325 | 326 | if( InitResult != EOS_EResult::EOS_Success ) 327 | { 328 | UE_LOG_ONLINE( Warning, TEXT( "EOS SDK Initialization: FAILED!" ) ); 329 | return false; 330 | } 331 | 332 | bEOSInitialized = true; 333 | UE_LOG_ONLINE( Warning, TEXT( "EOS SDK Initialization: Success!" ) ); 334 | return true; 335 | } 336 | 337 | bool FOnlineSubsystemEOS::CreatePlatformHandle() 338 | { 339 | // Create platform instance 340 | EOS_Platform_Options PlatformOptions; 341 | PlatformOptions.ApiVersion = EOS_PLATFORM_OPTIONS_API_LATEST; 342 | PlatformOptions.bIsServer = EOS_FALSE; 343 | PlatformOptions.EncryptionKey = nullptr; 344 | PlatformOptions.OverrideCountryCode = nullptr; 345 | PlatformOptions.OverrideLocaleCode = nullptr; 346 | // The EncryptionKey is a 64 ones 347 | static const char EncryptionKey[65] = "1111111111111111111111111111111111111111111111111111111111111111"; 348 | PlatformOptions.EncryptionKey = EncryptionKey; 349 | PlatformOptions.Flags = 0; 350 | 351 | // Disable the Overlay if we are in the UE4 Editor. 352 | #if WITH_EDITOR 353 | PlatformOptions.Flags |= EOS_PF_LOADING_IN_EDITOR; 354 | #endif 355 | 356 | FString TempPath = FPaths::ConvertRelativePathToFull( FPaths::ProjectSavedDir() + "/Temp/" ); 357 | if( FPlatformFileManager::Get().GetPlatformFile().DirectoryExists( *TempPath ) == false ) 358 | { 359 | if( FPlatformFileManager::Get().GetPlatformFile().CreateDirectoryTree( *TempPath ) == false ) 360 | { 361 | UE_LOG_ONLINE( Warning, TEXT( "EOS SDK Failed to create Cache Directory: %s." ), *TempPath ); 362 | return false; 363 | } 364 | } 365 | 366 | std::string CacheDirUTF8( TCHAR_TO_UTF8( *TempPath ) ); 367 | PlatformOptions.CacheDirectory = CacheDirUTF8.c_str(); 368 | 369 | FTCHARToUTF8 ProductIdStr( *ProductId ); 370 | FTCHARToUTF8 SandboxIdStr( *SandboxId ); 371 | FTCHARToUTF8 DeploymentIdStr( *DeploymentId ); 372 | 373 | if( ProductIdStr.Length() == 0 ) 374 | { 375 | UE_LOG_ONLINE( Warning, TEXT( "EOS SDK Product Id is invalid." ) ); 376 | return false; 377 | } 378 | 379 | if( SandboxIdStr.Length() == 0) 380 | { 381 | UE_LOG_ONLINE( Warning, TEXT( "EOS SDK Sandbox Id is invalid." ) ); 382 | return false; 383 | } 384 | 385 | if( DeploymentIdStr.Length() == 0 ) 386 | { 387 | UE_LOG_ONLINE( Warning, TEXT( "EOS SDK Deployment Id is invalid." ) ); 388 | return false; 389 | } 390 | 391 | PlatformOptions.ProductId = ProductIdStr.Get(); 392 | PlatformOptions.SandboxId = SandboxIdStr.Get(); 393 | PlatformOptions.DeploymentId = DeploymentIdStr.Get(); 394 | 395 | FTCHARToUTF8 ClientIdStr( *ClientId ); 396 | FTCHARToUTF8 ClientSecretStr( *ClientSecret ); 397 | 398 | PlatformOptions.ClientCredentials.ClientId = ClientIdStr.Get(); 399 | PlatformOptions.ClientCredentials.ClientSecret = ClientSecretStr.Get(); 400 | 401 | PlatformOptions.Reserved = NULL; 402 | 403 | PlatformHandle = EOS_Platform_Create( &PlatformOptions ); 404 | 405 | if( PlatformHandle == nullptr ) 406 | { 407 | UE_LOG_ONLINE( Warning, TEXT( "EOS SDK Failed to create platform." ) ); 408 | return false; 409 | } 410 | 411 | UE_LOG_ONLINE( Warning, TEXT( "EOS SDK Platform: Success." ) ); 412 | 413 | return true; 414 | } 415 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Private/OnlineSubsystemEOSModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #include "OnlineSubsystemEOSModule.h" 4 | 5 | // UE4 Includes 6 | #include "Core.h" 7 | #include "Interfaces/IPluginManager.h" 8 | #include "OnlineSubsystemModule.h" 9 | #include "OnlineSubsystemNames.h" 10 | #include "OnlineSubsystem.h" 11 | 12 | // EOS Plugin Includes 13 | #include "OnlineSubsystemEOS.h" 14 | 15 | 16 | #if WITH_EDITOR 17 | #include "ISettingsModule.h" 18 | #include "ISettingsSection.h" 19 | #include "ISettingsContainer.h" 20 | #endif 21 | 22 | #define LOCTEXT_NAMESPACE "FUEOSModule" 23 | 24 | #ifndef EOS_SDK_INSTALLED 25 | #error Epic Online Services SDK not located! Expected to be found in /Plugins/UEOS/Source/ThirdParty 26 | #endif // EOS_SDK_INSTALLED 27 | 28 | 29 | /** 30 | * Class responsible for creating instance(s) of the subsystem 31 | */ 32 | class FOnlineFactoryEOS : public IOnlineFactory 33 | { 34 | 35 | public: 36 | 37 | FOnlineFactoryEOS() {} 38 | virtual ~FOnlineFactoryEOS() 39 | { 40 | DestroySubsystem(); 41 | } 42 | 43 | virtual IOnlineSubsystemPtr CreateSubsystem( FName InstanceName ) 44 | { 45 | if( !EOSSingleton.IsValid() ) 46 | { 47 | EOSSingleton = MakeShared( InstanceName ); 48 | if( EOSSingleton->IsEnabled() ) 49 | { 50 | if( !EOSSingleton->Init() ) 51 | { 52 | UE_LOG_ONLINE( Warning, TEXT( "EOS API failed to initialize!" ) ); 53 | DestroySubsystem(); 54 | } 55 | } 56 | else 57 | { 58 | UE_LOG_ONLINE( Warning, TEXT( "EOS API disabled!" ) ); 59 | DestroySubsystem(); 60 | } 61 | 62 | return EOSSingleton; 63 | } 64 | 65 | UE_LOG_ONLINE( Warning, TEXT( "Can't create more than one instance of EOS online subsystem!" ) ); 66 | return nullptr; 67 | } 68 | 69 | private: 70 | 71 | /** Single instantiation of the STEAM interface */ 72 | static FOnlineSubsystemEOSPtr EOSSingleton; 73 | 74 | virtual void DestroySubsystem() 75 | { 76 | if( EOSSingleton.IsValid() ) 77 | { 78 | EOSSingleton->Shutdown(); 79 | EOSSingleton = nullptr; 80 | } 81 | } 82 | }; 83 | 84 | FOnlineSubsystemEOSPtr FOnlineFactoryEOS::EOSSingleton = nullptr; 85 | 86 | 87 | void FOnlineSubsystemEOSModule::StartupModule() 88 | { 89 | #if !PLATFORM_LINUX 90 | #if defined( EOS_LIB ) 91 | // Get the base directory of this plugin 92 | FString BaseDir = ""; 93 | TSharedPtr EOSOSS = IPluginManager::Get().FindPlugin( "OnlineSubsystemEOS" ); 94 | 95 | if( EOSOSS != nullptr ) 96 | { 97 | BaseDir = EOSOSS->GetBaseDir(); 98 | } 99 | 100 | const FString SDKDir = FPaths::Combine( *BaseDir, TEXT( "Source" ), TEXT( "ThirdParty" ), TEXT( "EOSSDK" ) ); 101 | bool bLoaded = false; 102 | 103 | #if PLATFORM_WINDOWS 104 | 105 | #if PLATFORM_32BITS 106 | const FString LibName = TEXT( "EOSSDK-Win32-Shipping" ); 107 | #else 108 | const FString LibName = TEXT( "EOSSDK-Win64-Shipping" ); 109 | #endif 110 | const FString LibDir = FPaths::Combine( *SDKDir, TEXT( "Bin" ) ); 111 | #elif PLATFORM_MAC 112 | const FString LibName = TEXT( "libEOSSDK-Mac-Shipping" ); 113 | const FString LibDir = FPaths::Combine( *SDKDir, TEXT( "Bin" ) ); 114 | #endif // WINDOWS/MAC 115 | 116 | if( LoadDependency( LibDir, LibName, EOSSDKHandle ) == false ) 117 | { 118 | FMessageDialog::Open( EAppMsgType::Ok, LOCTEXT( LOCTEXT_NAMESPACE, "Failed to load EOS SDK. Plugin will not be functional." ) ); 119 | FreeDependency( EOSSDKHandle ); 120 | 121 | return; 122 | } 123 | 124 | // Create and register our singleton factory with the main online subsystem for easy access 125 | EOSFactory = new FOnlineFactoryEOS(); 126 | 127 | FOnlineSubsystemModule& OSS = FModuleManager::GetModuleChecked( "OnlineSubsystem" ); 128 | OSS.RegisterPlatformService( EOS_SUBSYSTEM, EOSFactory ); 129 | 130 | #endif // EOS_LIB 131 | #endif // NOT LINUX 132 | } 133 | 134 | void FOnlineSubsystemEOSModule::ShutdownModule() 135 | { 136 | // Free the dll handle 137 | #if !PLATFORM_LINUX 138 | #if defined( EOS_LIB ) 139 | FreeDependency( EOSSDKHandle ); 140 | #endif 141 | #endif 142 | } 143 | 144 | bool FOnlineSubsystemEOSModule::LoadDependency( const FString& Dir, const FString& Name, void*& Handle ) 145 | { 146 | FString Lib = Name + TEXT( "." ) + FPlatformProcess::GetModuleExtension(); 147 | FString Path = Dir.IsEmpty() ? *Lib : FPaths::Combine( *Dir, *Lib ); 148 | 149 | Handle = FPlatformProcess::GetDllHandle( *Path ); 150 | 151 | if( Handle == nullptr ) 152 | { 153 | return false; 154 | } 155 | 156 | return true; 157 | } 158 | 159 | void FOnlineSubsystemEOSModule::FreeDependency( void*& Handle ) 160 | { 161 | if( Handle != nullptr ) 162 | { 163 | FPlatformProcess::FreeDllHandle( Handle ); 164 | Handle = nullptr; 165 | } 166 | } 167 | 168 | bool FOnlineSubsystemEOSModule::SupportsDynamicReloading() 169 | { 170 | // Due to the loading of the DLLs and how the EOS API is initialized, we cannot support dynamic reloading. 171 | return false; 172 | } 173 | 174 | //void FUEOSModule::Tick( float DeltaTime ) 175 | //{ 176 | //UEOSManager* EOSManager = UEOSManager::GetEOSManager(); 177 | // 178 | //if( EOSManager != nullptr ) 179 | //{ 180 | // EOSManager->UpdateEOS(); 181 | //} 182 | //} 183 | 184 | bool FOnlineSubsystemEOSModule::AreEOSDllsLoaded() const 185 | { 186 | return ( EOSSDKHandle != nullptr ) ? true : false; 187 | } 188 | 189 | #undef LOCTEXT_NAMESPACE 190 | 191 | IMPLEMENT_MODULE( FOnlineSubsystemEOSModule, OnlineSubsystemEOS ) 192 | 193 | DEFINE_LOG_CATEGORY( OnlineSubsystemEOSLog ); 194 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Private/OnlineSubsystemEOSTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #pragma once 4 | 5 | // Engine Includes 6 | #include "CoreMinimal.h" 7 | #include "UObject/CoreOnline.h" 8 | #include "OnlineSubsystemTypes.h" 9 | #include "IPAddress.h" 10 | 11 | // EOS Includes 12 | #include "OnlineSubsystemEOS.h" 13 | 14 | 15 | /** Possible session states */ 16 | namespace EEOSSession 17 | { 18 | enum Type 19 | { 20 | /** Session is undefined */ 21 | None, 22 | /** Session managed as a lobby on backend */ 23 | LobbySession, 24 | /** Session managed by master server publishing */ 25 | AdvertisedSessionHost, 26 | /** Session client of a game server session */ 27 | AdvertisedSessionClient, 28 | /** Session managed by LAN beacon */ 29 | LANSession, 30 | }; 31 | 32 | /** @return the stringified version of the enum passed in */ 33 | inline const TCHAR* ToString( EEOSSession::Type SessionType ) 34 | { 35 | switch( SessionType ) 36 | { 37 | case None: 38 | { 39 | return TEXT( "Session undefined" ); 40 | } 41 | case LobbySession: 42 | { 43 | return TEXT( "Lobby session" ); 44 | } 45 | case AdvertisedSessionHost: 46 | { 47 | return TEXT( "Advertised Session Host" ); 48 | } 49 | case AdvertisedSessionClient: 50 | { 51 | return TEXT( "Advertised Session Client" ); 52 | } 53 | case LANSession: 54 | { 55 | return TEXT( "LAN Session" ); 56 | } 57 | } 58 | return TEXT( "" ); 59 | } 60 | } 61 | 62 | /** 63 | * Epic Online Services specific implementation of the unique net id 64 | */ 65 | class FUniqueNetIdEOS : public FUniqueNetId 66 | { 67 | 68 | PACKAGE_SCOPE: 69 | 70 | /** The EOS SDK matching Account Id. */ 71 | EOS_EpicAccountId EpicAccountId; 72 | 73 | /** Hidden on purpose */ 74 | FUniqueNetIdEOS() : 75 | EpicAccountId() 76 | { 77 | } 78 | 79 | /** 80 | * Copy Constructor 81 | * 82 | * @param Src the id to copy 83 | */ 84 | explicit FUniqueNetIdEOS( const FUniqueNetIdEOS& Src ) 85 | : EpicAccountId( Src.EpicAccountId ) 86 | { 87 | } 88 | 89 | public: 90 | 91 | explicit FUniqueNetIdEOS( EOS_EpicAccountId InAccountId ) 92 | : EpicAccountId( InAccountId ) 93 | { 94 | } 95 | 96 | /** 97 | * Constructs this object with the specified net id 98 | * 99 | * @param String textual representation of an id 100 | */ 101 | explicit FUniqueNetIdEOS( const FString& Str ) : 102 | EpicAccountId( FUniqueNetIdEOS::FromString( *Str ) ) 103 | { 104 | } 105 | 106 | virtual FName GetType() const override 107 | { 108 | return EOS_SUBSYSTEM; 109 | } 110 | 111 | /** 112 | * Get the raw byte representation of this net id 113 | * This data is platform dependent and shouldn't be manipulated directly 114 | * 115 | * @return byte array of size GetSize() 116 | */ 117 | virtual const uint8* GetBytes() const override 118 | { 119 | return (uint8*)&EpicAccountId; 120 | } 121 | 122 | /** 123 | * Get the size of the id 124 | * 125 | * @return size in bytes of the id representation 126 | */ 127 | virtual int32 GetSize() const override 128 | { 129 | return sizeof( EOS_EpicAccountId ); 130 | } 131 | 132 | /** 133 | * Check the validity of the id 134 | * 135 | * @return true if this is a well formed ID, false otherwise 136 | */ 137 | virtual bool IsValid() const override 138 | { 139 | return ( EOS_EpicAccountId_IsValid( EpicAccountId ) == EOS_TRUE ) ? true : false; 140 | } 141 | 142 | /** 143 | * Platform specific conversion to string representation of data 144 | * 145 | * @return data in string form 146 | */ 147 | virtual FString ToString() const override 148 | { 149 | static char TempBuffer[EOS_EPICACCOUNTID_MAX_LENGTH]; 150 | int32_t TempBufferSize = sizeof( TempBuffer ); 151 | EOS_EpicAccountId_ToString( EpicAccountId, TempBuffer, &TempBufferSize ); 152 | FString returnValue( TempBuffer ); 153 | return returnValue; 154 | } 155 | 156 | static EOS_EpicAccountId FromString( const FString& AccountId ) 157 | { 158 | return EOS_EpicAccountId_FromString( TCHAR_TO_ANSI( *AccountId ) ); 159 | } 160 | 161 | /** 162 | * Get a human readable representation of the net id 163 | * Shouldn't be used for anything other than logging/debugging 164 | * 165 | * @return id in string form 166 | */ 167 | virtual FString ToDebugString() const override 168 | { 169 | if( IsValid() == true ) 170 | { 171 | return ToString(); 172 | } 173 | 174 | return TEXT( "INVALID" ); 175 | } 176 | 177 | /** Needed for TMap::GetTypeHash() */ 178 | friend uint32 GetTypeHash( const FUniqueNetIdEOS& A ) 179 | { 180 | return GetTypeHash( A.ToString() ); 181 | } 182 | 183 | /** global static instance of invalid (zero) id */ 184 | static const TSharedRef& EmptyId() 185 | { 186 | static const TSharedRef EmptyId( MakeShared() ); 187 | return EmptyId; 188 | } 189 | 190 | /** Convenience cast to EOS_EpicAccountId */ 191 | operator EOS_EpicAccountId() 192 | { 193 | return EpicAccountId; 194 | } 195 | 196 | /** Convenience cast to EOS_EpicAccountId */ 197 | operator const EOS_EpicAccountId() const 198 | { 199 | return EpicAccountId; 200 | } 201 | 202 | /** Convenience cast to EOS_EpicAccountId pointer */ 203 | operator EOS_EpicAccountId*( ) 204 | { 205 | return (EOS_EpicAccountId*)&EpicAccountId; 206 | } 207 | 208 | /** Convenience cast to EOS_EpicAccountId pointer */ 209 | operator const EOS_EpicAccountId*( ) const 210 | { 211 | return (const EOS_EpicAccountId*)&EpicAccountId; 212 | } 213 | 214 | //friend FArchive& operator<<( FArchive& Ar, FUniqueNetIdEOS& UserId ) 215 | //{ 216 | // return Ar << UserId.ToString(); 217 | //} 218 | }; 219 | 220 | /** Data regarding preferred session connection methods */ 221 | enum class FEOSConnectionMethod : int8 222 | { 223 | None = 0, 224 | Direct, 225 | P2P, 226 | PartnerHosted 227 | }; 228 | 229 | /** Functionality for converting a connection method type between formats */ 230 | FString LexToString( const FEOSConnectionMethod Method ); 231 | FEOSConnectionMethod ToConnectionMethod( const FString& InString ); 232 | 233 | /** 234 | * Implementation of session information 235 | */ 236 | class FOnlineSessionInfoEOS : public FOnlineSessionInfo 237 | { 238 | protected: 239 | 240 | /** Hidden on purpose */ 241 | FOnlineSessionInfoEOS( const FOnlineSessionInfoEOS& Src ) 242 | { 243 | } 244 | 245 | /** Hidden on purpose */ 246 | FOnlineSessionInfoEOS& operator=( const FOnlineSessionInfoEOS& Src ) 247 | { 248 | return *this; 249 | } 250 | 251 | PACKAGE_SCOPE: 252 | 253 | /** Constructor for LAN sessions */ 254 | FOnlineSessionInfoEOS( EEOSSession::Type SessionType = EEOSSession::None ); 255 | 256 | /** Constructor for sessions that represent a Steam lobby or an advertised server session */ 257 | FOnlineSessionInfoEOS( EEOSSession::Type SessionType, const FUniqueNetIdEOS& InSessionId ); 258 | 259 | /** 260 | * Initialize a Steam session info with the address of this machine 261 | */ 262 | void Init(); 263 | 264 | /** 265 | * Initialize a Steam session info with the address of this machine 266 | */ 267 | void InitLAN(); 268 | 269 | /** Type of session this is, affects interpretation of id below */ 270 | EEOSSession::Type SessionType; 271 | /** The ip & port that the host is listening on (valid for LAN/GameServer) */ 272 | TSharedPtr HostAddr; 273 | /** The Steam P2P address that the host is listening on (valid for GameServer/Lobby) */ 274 | TSharedPtr SteamP2PAddr; 275 | /** Steam Lobby Id or Gameserver Id if applicable */ 276 | FUniqueNetIdEOS SessionId; 277 | /** How this session should be connected to */ 278 | FEOSConnectionMethod ConnectionMethod; 279 | 280 | public: 281 | 282 | virtual ~FOnlineSessionInfoEOS() {} 283 | 284 | /** 285 | * Comparison operator 286 | */ 287 | bool operator==( const FOnlineSessionInfoEOS& Other ) const 288 | { 289 | return false; 290 | } 291 | 292 | virtual const uint8* GetBytes() const override 293 | { 294 | return nullptr; 295 | } 296 | 297 | virtual int32 GetSize() const override 298 | { 299 | return sizeof( uint64 ) + 300 | sizeof( EEOSSession::Type ) + 301 | sizeof( TSharedPtr ) + 302 | sizeof( TSharedPtr ) + 303 | sizeof( FUniqueNetIdEOS ) + 304 | sizeof( FEOSConnectionMethod ); 305 | } 306 | 307 | virtual bool IsValid() const override 308 | { 309 | switch( SessionType ) 310 | { 311 | case EEOSSession::LobbySession: 312 | //return SteamP2PAddr.IsValid() && SteamP2PAddr->IsValid() && SessionId.IsValid(); 313 | case EEOSSession::AdvertisedSessionHost: 314 | case EEOSSession::AdvertisedSessionClient: 315 | //return ( ( SteamP2PAddr.IsValid() && SteamP2PAddr->IsValid() ) || ( HostAddr.IsValid() && HostAddr->IsValid() ) ) && SessionId.IsValid(); 316 | case EEOSSession::LANSession: 317 | default: 318 | // LAN case 319 | return HostAddr.IsValid() && HostAddr->IsValid(); 320 | } 321 | } 322 | 323 | virtual FString ToString() const override 324 | { 325 | return SessionId.ToString(); 326 | } 327 | 328 | virtual FString ToDebugString() const override 329 | { 330 | return FString::Printf( TEXT( "HostIP: %s EOSP2P: %s Type: %s SessionId: %s" ), 331 | HostAddr.IsValid() ? *HostAddr->ToString( true ) : TEXT( "INVALID" ), 332 | SteamP2PAddr.IsValid() ? *SteamP2PAddr->ToString( true ) : TEXT( "INVALID" ), 333 | EEOSSession::ToString( SessionType ), *SessionId.ToDebugString() ); 334 | } 335 | 336 | virtual const FUniqueNetId& GetSessionId() const override 337 | { 338 | return SessionId; 339 | } 340 | }; 341 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Public/OnlineSubsystemEOS.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "OnlineDelegateMacros.h" 7 | #include "OnlineSubsystemImpl.h" 8 | 9 | // EOS Includes 10 | #include "eos_sdk.h" 11 | 12 | // Forward Declarations 13 | class FOnlineIdentityEOS; 14 | class FOnlineSessionEOS; 15 | 16 | /** Forward declarations of all interface classes */ 17 | typedef TSharedPtr FOnlineIdentityEOSPtr; 18 | typedef TSharedPtr FOnlineSessionEOSPtr; 19 | 20 | 21 | // Subsystem Name 22 | #ifndef EOS_SUBSYSTEM 23 | #define EOS_SUBSYSTEM FName( TEXT( "EOS" ) ) 24 | #endif 25 | 26 | /** 27 | * OnlineSubsystemSteam - Implementation of the online subsystem for EPIC ONLINE SERVICES (EOS) 28 | */ 29 | class ONLINESUBSYSTEMEOS_API FOnlineSubsystemEOS : public FOnlineSubsystemImpl 30 | { 31 | 32 | public: 33 | 34 | virtual ~FOnlineSubsystemEOS() 35 | { 36 | } 37 | 38 | // IOnlineSubsystem 39 | virtual IOnlineSessionPtr GetSessionInterface() const override; 40 | virtual IOnlineFriendsPtr GetFriendsInterface() const override; 41 | virtual IOnlinePartyPtr GetPartyInterface() const override; 42 | virtual IOnlineGroupsPtr GetGroupsInterface() const override; 43 | virtual IOnlineSharedCloudPtr GetSharedCloudInterface() const override; 44 | virtual IOnlineUserCloudPtr GetUserCloudInterface() const override; 45 | virtual IOnlineLeaderboardsPtr GetLeaderboardsInterface() const override; 46 | virtual IOnlineVoicePtr GetVoiceInterface() const override; 47 | virtual IOnlineExternalUIPtr GetExternalUIInterface() const override; 48 | virtual IOnlineTimePtr GetTimeInterface() const override; 49 | virtual IOnlineIdentityPtr GetIdentityInterface() const override; 50 | virtual IOnlineTitleFilePtr GetTitleFileInterface() const override; 51 | virtual IOnlineEntitlementsPtr GetEntitlementsInterface() const override; 52 | virtual IOnlineStorePtr GetStoreInterface() const override; 53 | virtual IOnlineStoreV2Ptr GetStoreV2Interface() const override; 54 | virtual IOnlinePurchasePtr GetPurchaseInterface() const override; 55 | virtual IOnlineEventsPtr GetEventsInterface() const override; 56 | virtual IOnlineAchievementsPtr GetAchievementsInterface() const override; 57 | virtual IOnlineSharingPtr GetSharingInterface() const override; 58 | virtual IOnlineUserPtr GetUserInterface() const override; 59 | virtual IOnlineMessagePtr GetMessageInterface() const override; 60 | virtual IOnlinePresencePtr GetPresenceInterface() const override; 61 | virtual IOnlineChatPtr GetChatInterface() const override; 62 | virtual IOnlineStatsPtr GetStatsInterface() const override; 63 | virtual IOnlineTurnBasedPtr GetTurnBasedInterface() const override; 64 | virtual IOnlineTournamentPtr GetTournamentInterface() const override; 65 | virtual bool IsLocalPlayer( const FUniqueNetId& UniqueId ) const override; 66 | virtual bool Init() override; 67 | virtual bool Shutdown() override; 68 | virtual bool Exec( class UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar ) override; 69 | virtual bool IsEnabled() const override; 70 | virtual FString GetAppId() const override; 71 | virtual FText GetOnlineServiceName() const override; 72 | 73 | // FTickerObjectBase 74 | virtual bool Tick( float DeltaTime ) override; 75 | 76 | /** 77 | * Checks whether the EOS SDK has been Initialized. 78 | * 79 | * @return bool True if has been initialized, otherwise false. 80 | */ 81 | bool IsEOSInitialized() { return bEOSInitialized; }; 82 | 83 | /** 84 | * Returns the current Platform Handle. 85 | * Can be NULL if the SDK has not been initialized or failed to initialize. 86 | * 87 | * @return EOS_HPlatform The current EOS Platform Handle. 88 | */ 89 | EOS_HPlatform GetPlatformHandle() { return PlatformHandle; }; 90 | 91 | protected: 92 | 93 | // Attempt to gather the Config Options for the EOS 94 | bool GetEOSConfigOptions(); 95 | 96 | // Attempt to Initialize the SDK 97 | bool InitializeSDK(); 98 | 99 | // Attempt to Create a valid Platform Handle from the SDK 100 | bool CreatePlatformHandle(); 101 | 102 | 103 | /** The Product Name for the running game. */ 104 | FString ProductName; 105 | 106 | /** The Product Version for the running game. */ 107 | FString ProductVersion; 108 | 109 | /** The ProductID for the running game. */ 110 | FString ProductId; 111 | 112 | /** The SandboxID for the running game. */ 113 | FString SandboxId; 114 | 115 | /** The DeploymentId for the running game. */ 116 | FString DeploymentId; 117 | 118 | /** The ClientID for the running game. */ 119 | FString ClientId; 120 | 121 | /** The ClientSecret for the running game. */ 122 | FString ClientSecret; 123 | 124 | /// --------------------------------------------------- 125 | /// Subsystem Interfaces 126 | /// --------------------------------------------------- 127 | 128 | /** Interface to the profile services */ 129 | FOnlineIdentityEOSPtr IdentityInterface; 130 | 131 | /** Interface to the Session services */ 132 | FOnlineSessionEOSPtr SessionInterface; 133 | 134 | /// --------------------------------------------------- 135 | 136 | PACKAGE_SCOPE : 137 | 138 | /** Only the factory makes instances */ 139 | FOnlineSubsystemEOS() = delete; 140 | FOnlineSubsystemEOS( FName InInstanceName ) 141 | : FOnlineSubsystemImpl( EOS_SUBSYSTEM, InInstanceName ) 142 | , ProductName( "" ) 143 | , ProductVersion( "" ) 144 | , ProductId( "" ) 145 | , SandboxId( "" ) 146 | , DeploymentId( "" ) 147 | , ClientId( "" ) 148 | , ClientSecret( "" ) 149 | , IdentityInterface( nullptr ) 150 | , bEOSInitialized( false ) 151 | , PlatformHandle( nullptr ) 152 | {} 153 | 154 | private: 155 | 156 | bool bEOSInitialized; 157 | 158 | /** The EOS Platform Handle for Platform operations. */ 159 | EOS_HPlatform PlatformHandle; 160 | 161 | }; 162 | 163 | typedef TSharedPtr FOnlineSubsystemEOSPtr; 164 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Public/OnlineSubsystemEOSCommon.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #include "OnlineSubsystemEOSCommon.h" 4 | 5 | 6 | EEOSResultType UEOSCommon::GetUnrealFriendlyResult( EOS_EResult SDKResult, EEOSResults& Result, EEOSAuth& Auth, EEOSFriends& Friends, EEOSPresence& Presence, EEOSEcom& Ecom ) 7 | { 8 | Result = EEOSResults::ER_UnknownError; 9 | Auth = EEOSAuth::EA_UnknownError; 10 | Friends = EEOSFriends::EF_UnknownError; 11 | Presence = EEOSPresence::EP_UnknownError; 12 | Ecom = EEOSEcom::EE_UnknownError; 13 | 14 | // Early exit on unknown error. 15 | if( (int32)SDKResult == 0x7FFFFFFF ) 16 | { 17 | return EEOSResultType::RT_Unknown; 18 | } 19 | 20 | if( (int32)SDKResult < 1000 ) 21 | { 22 | Result = GetResultsValue( SDKResult ); 23 | return EEOSResultType::RT_Result; 24 | } 25 | else if( (int32)SDKResult < 2000 ) 26 | { 27 | // Auth... 28 | } 29 | else if( (int32)SDKResult < 3000 ) 30 | { 31 | // Friends... 32 | } 33 | else if( (int32)SDKResult < 4000 ) 34 | { 35 | // Presence... 36 | } 37 | else 38 | { 39 | // Ecom 40 | } 41 | 42 | return EEOSResultType::RT_Unknown; 43 | } 44 | 45 | EEOSResults UEOSCommon::GetResultsValue( EOS_EResult SDKResult ) 46 | { 47 | switch( SDKResult ) 48 | { 49 | case EOS_EResult::EOS_Success: 50 | return EEOSResults::ER_Success; 51 | break; 52 | case EOS_EResult::EOS_NoConnection: 53 | return EEOSResults::ER_NoConnection; 54 | break; 55 | case EOS_EResult::EOS_InvalidCredentials: 56 | return EEOSResults::ER_InvalidCredentials; 57 | break; 58 | case EOS_EResult::EOS_InvalidUser: 59 | return EEOSResults::ER_InvalidUser; 60 | break; 61 | case EOS_EResult::EOS_InvalidAuth: 62 | return EEOSResults::ER_InvalidAuth; 63 | break; 64 | case EOS_EResult::EOS_AccessDenied: 65 | return EEOSResults::ER_AccessDenied; 66 | break; 67 | case EOS_EResult::EOS_MissingPermissions: 68 | return EEOSResults::ER_MissingPermissions; 69 | break; 70 | case EOS_EResult::EOS_Token_Not_Account: 71 | return EEOSResults::ER_TokenNotAccount; 72 | break; 73 | case EOS_EResult::EOS_TooManyRequests: 74 | return EEOSResults::ER_TooManyRequests; 75 | break; 76 | case EOS_EResult::EOS_AlreadyPending: 77 | return EEOSResults::ER_AlreadyPending; 78 | break; 79 | case EOS_EResult::EOS_InvalidParameters: 80 | return EEOSResults::ER_InvalidParameters; 81 | break; 82 | case EOS_EResult::EOS_InvalidRequest: 83 | return EEOSResults::ER_InvalidRequest; 84 | break; 85 | case EOS_EResult::EOS_UnrecognizedResponse: 86 | return EEOSResults::ER_UnrecognizedResponse; 87 | break; 88 | case EOS_EResult::EOS_IncompatibleVersion: 89 | return EEOSResults::ER_IncompatibleVersion; 90 | break; 91 | case EOS_EResult::EOS_NotConfigured: 92 | return EEOSResults::ER_NotConfigured; 93 | break; 94 | case EOS_EResult::EOS_AlreadyConfigured: 95 | return EEOSResults::ER_AlreadyConfigured; 96 | break; 97 | case EOS_EResult::EOS_NotImplemented: 98 | return EEOSResults::ER_NotImplemented; 99 | break; 100 | case EOS_EResult::EOS_Canceled: 101 | return EEOSResults::ER_Canceled; 102 | break; 103 | case EOS_EResult::EOS_NotFound: 104 | return EEOSResults::ER_NotFound; 105 | break; 106 | case EOS_EResult::EOS_OperationWillRetry: 107 | return EEOSResults::ER_OperationWillRetry; 108 | break; 109 | case EOS_EResult::EOS_NoChange: 110 | return EEOSResults::ER_NoChange; 111 | break; 112 | case EOS_EResult::EOS_VersionMismatch: 113 | return EEOSResults::ER_VersionMismatch; 114 | break; 115 | case EOS_EResult::EOS_LimitExceeded: 116 | return EEOSResults::ER_LimitExceeded; 117 | break; 118 | case EOS_EResult::EOS_Disabled: 119 | return EEOSResults::ER_Disabled; 120 | break; 121 | case EOS_EResult::EOS_DuplicateNotAllowed: 122 | return EEOSResults::ER_DuplicateNotAllowed; 123 | break; 124 | case EOS_EResult::EOS_MissingParameters_DEPRECATED: 125 | return EEOSResults::ER_MissingParameters; 126 | break; 127 | } 128 | 129 | return EEOSResults::ER_UnknownError; 130 | } 131 | 132 | EEOSAuth UEOSCommon::GetAuthValue( EOS_EResult SDKResult ) 133 | { 134 | return EEOSAuth::EA_UnknownError; 135 | } 136 | 137 | EEOSFriends UEOSCommon::GetFriendsValue( EOS_EResult SDKResult ) 138 | { 139 | return EEOSFriends::EF_UnknownError; 140 | } 141 | 142 | EEOSPresence UEOSCommon::GetPresenceValue( EOS_EResult SDKResult ) 143 | { 144 | return EEOSPresence::EP_UnknownError; 145 | } 146 | 147 | EEOSEcom UEOSCommon::GetEcomValue( EOS_EResult SDKResult ) 148 | { 149 | return EEOSEcom::EE_UnknownError; 150 | } 151 | 152 | FString UEOSCommon::EOSResultToString( EOS_EResult Result ) 153 | { 154 | switch( Result ) 155 | { 156 | 157 | case EOS_EResult::EOS_Success: 158 | return "EOS_Success"; 159 | case EOS_EResult::EOS_NoConnection: 160 | return "EOS_NoConnection"; 161 | case EOS_EResult::EOS_InvalidCredentials: 162 | return "EOS_InvalidCredentials"; 163 | case EOS_EResult::EOS_InvalidUser: 164 | return "EOS_InvalidUser"; 165 | case EOS_EResult::EOS_InvalidAuth: 166 | return "EOS_InvalidAuth"; 167 | case EOS_EResult::EOS_AccessDenied: 168 | return "EOS_AccessDenied"; 169 | case EOS_EResult::EOS_MissingPermissions: 170 | return "EOS_MissingPermissions"; 171 | case EOS_EResult::EOS_Token_Not_Account: 172 | return "EOS_Token_Not_Account"; 173 | case EOS_EResult::EOS_TooManyRequests: 174 | return "EOS_TooManyRequests"; 175 | case EOS_EResult::EOS_AlreadyPending: 176 | return "EOS_AlreadyPending"; 177 | case EOS_EResult::EOS_InvalidParameters: 178 | return "EOS_InvalidParameters"; 179 | case EOS_EResult::EOS_InvalidRequest: 180 | return "EOS_InvalidRequest"; 181 | case EOS_EResult::EOS_UnrecognizedResponse: 182 | return "EOS_UnrecognizedResponse"; 183 | case EOS_EResult::EOS_IncompatibleVersion: 184 | return "EOS_IncompatibleVersion"; 185 | case EOS_EResult::EOS_NotConfigured: 186 | return "EOS_NotConfigured"; 187 | case EOS_EResult::EOS_AlreadyConfigured: 188 | return "EOS_AlreadyConfigured"; 189 | case EOS_EResult::EOS_NotImplemented: 190 | return "EOS_NotImplemented"; 191 | case EOS_EResult::EOS_Canceled: 192 | return "EOS_Canceled"; 193 | case EOS_EResult::EOS_NotFound: 194 | return "EOS_NotFound"; 195 | case EOS_EResult::EOS_OperationWillRetry: 196 | return "EOS_OperationWillRetry"; 197 | case EOS_EResult::EOS_NoChange: 198 | return "EOS_NoChange"; 199 | case EOS_EResult::EOS_VersionMismatch: 200 | return "EOS_VersionMismatch"; 201 | case EOS_EResult::EOS_LimitExceeded: 202 | return "EOS_LimitExceeded"; 203 | case EOS_EResult::EOS_Disabled: 204 | return "EOS_Disabled"; 205 | case EOS_EResult::EOS_DuplicateNotAllowed: 206 | return "EOS_DuplicateNotAllowed"; 207 | case EOS_EResult::EOS_MissingParameters_DEPRECATED: 208 | return "EOS_MissingParameters"; 209 | case EOS_EResult::EOS_InvalidSandboxId: 210 | return "EOS_InvalidSandboxId"; 211 | case EOS_EResult::EOS_TimedOut: 212 | return "EOS_TimedOut"; 213 | case EOS_EResult::EOS_PartialResult: 214 | return "EOS_PartialResult"; 215 | case EOS_EResult::EOS_Missing_Role: 216 | return "EOS_Missing_Role"; 217 | case EOS_EResult::EOS_Missing_Feature: 218 | return "EOS_Missing_Feature"; 219 | case EOS_EResult::EOS_Invalid_Sandbox: 220 | return "EOS_Invalid_Sandbox"; 221 | case EOS_EResult::EOS_Invalid_Deployment: 222 | return "EOS_Invalid_Deployment"; 223 | case EOS_EResult::EOS_Invalid_Product: 224 | return "EOS_Invalid_Product"; 225 | case EOS_EResult::EOS_Invalid_ProductUserID: 226 | return "EOS_Invalid_ProductUserID"; 227 | case EOS_EResult::EOS_ServiceFailure: 228 | return "EOS_ServiceFailure"; 229 | case EOS_EResult::EOS_CacheDirectoryMissing: 230 | return "EOS_CacheDirectoryMissing"; 231 | case EOS_EResult::EOS_CacheDirectoryInvalid: 232 | return "EOS_CacheDirectoryInvalid"; 233 | case EOS_EResult::EOS_InvalidState: 234 | return "EOS_InvalidState"; 235 | 236 | case EOS_EResult::EOS_Auth_AccountLocked: 237 | return "EOS_Auth_AccountLocked"; 238 | case EOS_EResult::EOS_Auth_AccountLockedForUpdate: 239 | return "EOS_Auth_AccountLockedForUpdate"; 240 | case EOS_EResult::EOS_Auth_InvalidRefreshToken: 241 | return "EOS_Auth_InvalidRefreshToken"; 242 | case EOS_EResult::EOS_Auth_InvalidToken: 243 | return "EOS_Auth_InvalidToken"; 244 | case EOS_EResult::EOS_Auth_AuthenticationFailure: 245 | return "EOS_Auth_AuthenticationFailure"; 246 | case EOS_EResult::EOS_Auth_InvalidPlatformToken: 247 | return "EOS_Auth_InvalidPlatformToken"; 248 | case EOS_EResult::EOS_Auth_WrongAccount: 249 | return "EOS_Auth_WrongAccount"; 250 | case EOS_EResult::EOS_Auth_WrongClient: 251 | return "EOS_Auth_WrongClient"; 252 | case EOS_EResult::EOS_Auth_FullAccountRequired: 253 | return "EOS_Auth_FullAccountRequired"; 254 | case EOS_EResult::EOS_Auth_HeadlessAccountRequired: 255 | return "EOS_Auth_HeadlessAccountRequired"; 256 | case EOS_EResult::EOS_Auth_PasswordResetRequired: 257 | return "EOS_Auth_PasswordResetRequired"; 258 | case EOS_EResult::EOS_Auth_PasswordCannotBeReused: 259 | return "EOS_Auth_PasswordCannotBeReused"; 260 | case EOS_EResult::EOS_Auth_Expired: 261 | return "EOS_Auth_Expired"; 262 | case EOS_EResult::EOS_Auth_ScopeConsentRequired: 263 | return "EOS_Auth_ScopeConsentRequired"; 264 | case EOS_EResult::EOS_Auth_ApplicationNotFound: 265 | return "EOS_Auth_ApplicationNotFound"; 266 | case EOS_EResult::EOS_Auth_ScopeNotFound: 267 | return "EOS_Auth_ScopeNotFound"; 268 | case EOS_EResult::EOS_Auth_AccountFeatureRestricted: 269 | return "EOS_Auth_AccountFeatureRestricted"; 270 | case EOS_EResult::EOS_Auth_PersistentAuth_AccountNotActive: 271 | return "EOS_AccountNotActive"; 272 | 273 | case EOS_EResult::EOS_Auth_PinGrantCode: 274 | return "EOS_Auth_PinGrantCode"; 275 | case EOS_EResult::EOS_Auth_PinGrantExpired: 276 | return "EOS_Auth_PinGrantExpired"; 277 | case EOS_EResult::EOS_Auth_PinGrantPending: 278 | return "EOS_Auth_PinGrantPending"; 279 | 280 | case EOS_EResult::EOS_Auth_ExternalAuthNotLinked: 281 | return "EOS_Auth_ExternalAuthNotLinked"; 282 | case EOS_EResult::EOS_Auth_ExternalAuthRevoked: 283 | return "EOS_Auth_ExternalAuthRevoked"; 284 | case EOS_EResult::EOS_Auth_ExternalAuthInvalid: 285 | return "EOS_Auth_ExternalAuthInvalid"; 286 | case EOS_EResult::EOS_Auth_ExternalAuthRestricted: 287 | return "EOS_Auth_ExternalAuthRestricted"; 288 | case EOS_EResult::EOS_Auth_ExternalAuthCannotLogin: 289 | return "EOS_Auth_ExternalAuthCannotLogin"; 290 | case EOS_EResult::EOS_Auth_ExternalAuthExpired: 291 | return "EOS_Auth_ExternalAuthExpired"; 292 | case EOS_EResult::EOS_Auth_ExternalAuthIsLastLoginType: 293 | return "EOS_Auth_ExternalAuthIsLastLoginType"; 294 | 295 | case EOS_EResult::EOS_Auth_ExchangeCodeNotFound: 296 | return "EOS_Auth_ExchangeCodeNotFound"; 297 | case EOS_EResult::EOS_Auth_OriginatingExchangeCodeSessionExpired: 298 | return "EOS_Auth_OriginatingExchangeCodeSessionExpired"; 299 | 300 | case EOS_EResult::EOS_Auth_MFARequired: 301 | return "EOS_Auth_MFARequired"; 302 | 303 | case EOS_EResult::EOS_Auth_ParentalControls: 304 | return "EOS_Auth_ParentalControls"; 305 | 306 | case EOS_EResult::EOS_Auth_NoRealId: 307 | return "EOS_Auth_NoRealId"; 308 | 309 | case EOS_EResult::EOS_Friends_InviteAwaitingAcceptance: 310 | return "EOS_Friends_InviteAwaitingAcceptance"; 311 | case EOS_EResult::EOS_Friends_NoInvitation: 312 | return "EOS_Friends_NoInvitation"; 313 | case EOS_EResult::EOS_Friends_AlreadyFriends: 314 | return "EOS_Friends_AlreadyFriends"; 315 | case EOS_EResult::EOS_Friends_NotFriends: 316 | return "EOS_Friends_NotFriends"; 317 | case EOS_EResult::EOS_Friends_TargetUserTooManyInvites: 318 | return "EOS_Friends_TargetUserTooManyInvites"; 319 | case EOS_EResult::EOS_Friends_LocalUserTooManyInvites: 320 | return "EOS_Friends_LocalUserTooManyInvites"; 321 | case EOS_EResult::EOS_Friends_TargetUserFriendLimitExceeded: 322 | return "EOS_Friends_TargetUserFriendLimitExceeded"; 323 | case EOS_EResult::EOS_Friends_LocalUserFriendLimitExceeded: 324 | return "EOS_Friends_LocalUserFriendLimitExceeded"; 325 | 326 | case EOS_EResult::EOS_Presence_DataInvalid: 327 | return "EOS_Presence_DataInvalid"; 328 | case EOS_EResult::EOS_Presence_DataLengthInvalid: 329 | return "EOS_Presence_DataLengthInvalid"; 330 | case EOS_EResult::EOS_Presence_DataKeyInvalid: 331 | return "EOS_Presence_DataKeyInvalid"; 332 | case EOS_EResult::EOS_Presence_DataKeyLengthInvalid: 333 | return "EOS_Presence_DataKeyLengthInvalid"; 334 | case EOS_EResult::EOS_Presence_DataValueInvalid: 335 | return "EOS_Presence_DataValueInvalid"; 336 | case EOS_EResult::EOS_Presence_DataValueLengthInvalid: 337 | return "EOS_Presence_DataValueLengthInvalid"; 338 | case EOS_EResult::EOS_Presence_RichTextInvalid: 339 | return "EOS_Presence_RichTextInvalid"; 340 | case EOS_EResult::EOS_Presence_RichTextLengthInvalid: 341 | return "EOS_Presence_RichTextLengthInvalid"; 342 | case EOS_EResult::EOS_Presence_StatusInvalid: 343 | return "EOS_Presence_StatusInvalid"; 344 | 345 | case EOS_EResult::EOS_Ecom_EntitlementStale: 346 | return "EOS_Ecom_EntitlementStale"; 347 | case EOS_EResult::EOS_Ecom_CatalogOfferStale: 348 | return "EOS_Ecom_CatalogOfferStale"; 349 | case EOS_EResult::EOS_Ecom_CatalogItemStale: 350 | return "EOS_Ecom_CatalogItemStale"; 351 | case EOS_EResult::EOS_Ecom_CatalogOfferPriceInvalid: 352 | return "EOS_Ecom_CatalogOfferPriceInvalid"; 353 | case EOS_EResult::EOS_Ecom_CheckoutLoadError: 354 | return "EOS_Ecom_CheckoutLoadError"; 355 | 356 | case EOS_EResult::EOS_Sessions_SessionInProgress: 357 | return "EOS_Sessions_SessionInProgress"; 358 | case EOS_EResult::EOS_Sessions_TooManyPlayers: 359 | return "EOS_Sessions_TooManyPlayers"; 360 | case EOS_EResult::EOS_Sessions_NoPermission: 361 | return "EOS_Sessions_NoPermission"; 362 | case EOS_EResult::EOS_Sessions_SessionAlreadyExists: 363 | return "EOS_Sessions_SessionAlreadyExists"; 364 | case EOS_EResult::EOS_Sessions_InvalidLock: 365 | return "EOS_Sessions_InvalidLock"; 366 | case EOS_EResult::EOS_Sessions_InvalidSession: 367 | return "EOS_Sessions_InvalidSession"; 368 | case EOS_EResult::EOS_Sessions_SandboxNotAllowed: 369 | return "EOS_Sessions_SandboxNotAllowed"; 370 | case EOS_EResult::EOS_Sessions_InviteFailed: 371 | return "EOS_Sessions_InviteFailed"; 372 | case EOS_EResult::EOS_Sessions_InviteNotFound: 373 | return "EOS_Sessions_InviteNotFound"; 374 | case EOS_EResult::EOS_Sessions_UpsertNotAllowed: 375 | return "EOS_Sessions_UpsertNotAllowed"; 376 | case EOS_EResult::EOS_Sessions_AggregationFailed: 377 | return "EOS_Sessions_AggregationFailed"; 378 | case EOS_EResult::EOS_Sessions_HostAtCapacity: 379 | return "EOS_Sessions_HostAtCapacity"; 380 | case EOS_EResult::EOS_Sessions_SandboxAtCapacity: 381 | return "EOS_Sessions_SandboxAtCapacity"; 382 | case EOS_EResult::EOS_Sessions_SessionNotAnonymous: 383 | return "EOS_Sessions_SessionNotAnonymous"; 384 | case EOS_EResult::EOS_Sessions_OutOfSync: 385 | return "EOS_Sessions_OutOfSync"; 386 | case EOS_EResult::EOS_Sessions_TooManyInvites: 387 | return "EOS_Sessions_TooManyInvites"; 388 | case EOS_EResult::EOS_Sessions_PresenceSessionExists: 389 | return "EOS_Sessions_PresenceSessionExists"; 390 | case EOS_EResult::EOS_Sessions_DeploymentAtCapacity: 391 | return "EOS_Sessions_DeploymentAtCapacity"; 392 | case EOS_EResult::EOS_Sessions_NotAllowed: 393 | return "EOS_Sessions_NotAllowed"; 394 | 395 | case EOS_EResult::EOS_PlayerDataStorage_FilenameInvalid: 396 | return "EOS_PlayerDataStorage_FilenameInvalid"; 397 | case EOS_EResult::EOS_PlayerDataStorage_FilenameLengthInvalid: 398 | return "EOS_PlayerDataStorage_FilenameLengthInvalid"; 399 | case EOS_EResult::EOS_PlayerDataStorage_FilenameInvalidChars: 400 | return "EOS_PlayerDataStorage_FilenameInvalidChars"; 401 | case EOS_EResult::EOS_PlayerDataStorage_FileSizeTooLarge: 402 | return "EOS_PlayerDataStorage_FileSizeTooLarge"; 403 | case EOS_EResult::EOS_PlayerDataStorage_FileSizeInvalid: 404 | return "EOS_PlayerDataStorage_FileSizeInvalid"; 405 | case EOS_EResult::EOS_PlayerDataStorage_FileHandleInvalid: 406 | return "EOS_PlayerDataStorage_FileHandleInvalid"; 407 | case EOS_EResult::EOS_PlayerDataStorage_DataInvalid: 408 | return "EOS_PlayerDataStorage_DataInvalid"; 409 | case EOS_EResult::EOS_PlayerDataStorage_DataLengthInvalid: 410 | return "EOS_PlayerDataStorage_DataLengthInvalid"; 411 | case EOS_EResult::EOS_PlayerDataStorage_StartIndexInvalid: 412 | return "EOS_PlayerDataStorage_StartIndexInvalid"; 413 | case EOS_EResult::EOS_PlayerDataStorage_RequestInProgress: 414 | return "EOS_PlayerDataStorage_RequestInProgress"; 415 | case EOS_EResult::EOS_PlayerDataStorage_UserThrottled: 416 | return "EOS_PlayerDataStorage_UserThrottled"; 417 | case EOS_EResult::EOS_PlayerDataStorage_EncryptionKeyNotSet: 418 | return "EOS_PlayerDataStorage_EncryptionKeyNotSet"; 419 | case EOS_EResult::EOS_PlayerDataStorage_UserErrorFromDataCallback: 420 | return "EOS_PlayerDataStorage_UserErrorFromDataCallback"; 421 | case EOS_EResult::EOS_PlayerDataStorage_FileHeaderHasNewerVersion: 422 | return "EOS_PlayerDataStorage_FileHeaderHasNewerVersion"; 423 | case EOS_EResult::EOS_PlayerDataStorage_FileCorrupted: 424 | return "EOS_PlayerDataStorage_FileCorrupted"; 425 | 426 | case EOS_EResult::EOS_Connect_ExternalTokenValidationFailed: 427 | return "EOS_Connect_ExternalTokenValidationFailed"; 428 | case EOS_EResult::EOS_Connect_UserAlreadyExists: 429 | return "EOS_Connect_UserAlreadyExists"; 430 | case EOS_EResult::EOS_Connect_AuthExpired: 431 | return "EOS_Connect_AuthExpired"; 432 | case EOS_EResult::EOS_Connect_InvalidToken: 433 | return "EOS_Connect_InvalidToken"; 434 | case EOS_EResult::EOS_Connect_UnsupportedTokenType: 435 | return "EOS_Connect_UnsupportedTokenType"; 436 | case EOS_EResult::EOS_Connect_LinkAccountFailed: 437 | return "EOS_Connect_LinkAccountFailed"; 438 | case EOS_EResult::EOS_Connect_ExternalServiceUnavailable: 439 | return "EOS_Connect_ExternalServiceUnavailable"; 440 | case EOS_EResult::EOS_Connect_ExternalServiceConfigurationFailure: 441 | return "EOS_Connect_ExternalServiceConfigurationFailure"; 442 | 443 | case EOS_EResult::EOS_UI_SocialOverlayLoadError: 444 | return "EOS_UI_SocialOverlayLoadError"; 445 | 446 | case EOS_EResult::EOS_Lobby_NotOwner: 447 | return "EOS_Lobby_NotOwner"; 448 | case EOS_EResult::EOS_Lobby_InvalidLock: 449 | return "EOS_Lobby_InvalidLock"; 450 | case EOS_EResult::EOS_Lobby_LobbyAlreadyExists: 451 | return "EOS_Lobby_LobbyAlreadyExists"; 452 | case EOS_EResult::EOS_Lobby_SessionInProgress: 453 | return "EOS_Lobby_SessionInProgress"; 454 | case EOS_EResult::EOS_Lobby_TooManyPlayers: 455 | return "EOS_Lobby_TooManyPlayers"; 456 | case EOS_EResult::EOS_Lobby_NoPermission: 457 | return "EOS_Lobby_NoPermission"; 458 | case EOS_EResult::EOS_Lobby_InvalidSession: 459 | return "EOS_Lobby_InvalidSession"; 460 | case EOS_EResult::EOS_Lobby_SandboxNotAllowed: 461 | return "EOS_Lobby_SandboxNotAllowed"; 462 | case EOS_EResult::EOS_Lobby_InviteFailed: 463 | return "EOS_Lobby_InviteFailed"; 464 | case EOS_EResult::EOS_Lobby_InviteNotFound: 465 | return "EOS_Lobby_InviteNotFound"; 466 | case EOS_EResult::EOS_Lobby_UpsertNotAllowed: 467 | return "EOS_Lobby_UpsertNotAllowed"; 468 | case EOS_EResult::EOS_Lobby_AggregationFailed: 469 | return "EOS_Lobby_AggregationFailed"; 470 | case EOS_EResult::EOS_Lobby_HostAtCapacity: 471 | return "EOS_Lobby_HostAtCapacity"; 472 | case EOS_EResult::EOS_Lobby_SandboxAtCapacity: 473 | return "EOS_Lobby_SandboxAtCapacity"; 474 | case EOS_EResult::EOS_Lobby_TooManyInvites: 475 | return "EOS_Lobby_TooManyInvites"; 476 | case EOS_EResult::EOS_Lobby_DeploymentAtCapacity: 477 | return "EOS_Lobby_DeploymentAtCapacity"; 478 | case EOS_EResult::EOS_Lobby_NotAllowed: 479 | return "EOS_Lobby_NotAllowed"; 480 | case EOS_EResult::EOS_Lobby_MemberUpdateOnly: 481 | return "EOS_Lobby_MemberUpdateOnly"; 482 | 483 | 484 | case EOS_EResult::EOS_UnexpectedError: 485 | return "EOS_UnexpectedError"; 486 | } 487 | 488 | return "Unknown"; 489 | } 490 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Public/OnlineSubsystemEOSCommon.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #pragma once 4 | 5 | // EOS Includes 6 | #include "eos_sdk.h" 7 | #include "eos_logging.h" 8 | 9 | 10 | UENUM( BlueprintType ) 11 | enum class EEOSResultType : uint8 12 | { 13 | RT_Result UMETA( DisplayName = "Result" ), 14 | RT_Auth UMETA( DisplayName = "Auth" ), 15 | RT_Friends UMETA( DisplayName = "Friends" ), 16 | RT_Presence UMETA( DisplayName = "Presence" ), 17 | RT_Ecom UMETA( DisplayName = "Ecom" ), 18 | RT_Unknown UMETA( DisplayName = "Unknown" ) 19 | }; 20 | 21 | // Enum of EOS Results 22 | UENUM( BlueprintType ) 23 | enum class EEOSResults : uint8 24 | { 25 | ER_Success UMETA( DisplayName = "Success" ), 26 | 27 | ER_AlreadyInitialized UMETA( DisplayName = "Already Initialized" ), 28 | ER_AlreadyShutdown UMETA( DisplayName = "Already Shutdown" ), 29 | ER_NotInitialized UMETA( DisplayName = "Not Initialized" ), 30 | ER_PlatformFailed UMETA( DisplayName = "Platform Handle Failed" ), 31 | 32 | ER_NoConnection UMETA( DisplayName = "No Connection" ), 33 | ER_InvalidCredentials UMETA( DisplayName = "Invalid Credentials" ), 34 | ER_InvalidUser UMETA( DisplayName = "Invalid User" ), 35 | ER_InvalidAuth UMETA( DisplayName = "Invalid Auth" ), 36 | ER_AccessDenied UMETA( DisplayName = "Access Denied" ), 37 | ER_MissingPermissions UMETA( DisplayName = "Missing Permissions" ), 38 | ER_TokenNotAccount UMETA( DisplayName = "Token Not Account" ), 39 | ER_TooManyRequests UMETA( DisplayName = "Too Many Requests" ), 40 | ER_AlreadyPending UMETA( DisplayName = "Already Pending" ), 41 | ER_InvalidParameters UMETA( DisplayName = "Invalid Parameters" ), 42 | ER_InvalidRequest UMETA( DisplayName = "Invalid Request" ), 43 | ER_UnrecognizedResponse UMETA( DisplayName = "Unrecognized Response" ), 44 | ER_IncompatibleVersion UMETA( DisplayName = "Incompatible Version" ), 45 | ER_NotConfigured UMETA( DisplayName = "Not Configured" ), 46 | ER_AlreadyConfigured UMETA( DisplayName = "Already Configured" ), 47 | ER_NotImplemented UMETA( DisplayName = "Feature Not Implemented" ), 48 | ER_Canceled UMETA( DisplayName = "Canceled" ), 49 | ER_NotFound UMETA( DisplayName = "Not Found" ), 50 | ER_OperationWillRetry UMETA( DisplayName = "Operation Will Retry" ), 51 | ER_NoChange UMETA( DisplayName = "No Change" ), 52 | ER_VersionMismatch UMETA( DisplayName = "Version Mismatch" ), 53 | ER_LimitExceeded UMETA( DisplayName = "Limit Exceeded" ), 54 | ER_Disabled UMETA( DisplayName = "Disabled" ), 55 | ER_DuplicateNotAllowed UMETA( DisplayName = "Duplicate Not Allowed" ), 56 | ER_MissingParameters UMETA( DisplayName = "Missing Parameters" ), 57 | ER_UnknownError UMETA( DisplayName = "Unknown Error" ) 58 | }; 59 | 60 | // Enum of EOS Auth Responses 61 | UENUM( BlueprintType ) 62 | enum class EEOSAuth : uint8 63 | { 64 | EA_UnknownError UMETA( DisplayName = "Unknown Error" ) 65 | }; 66 | 67 | // Enum of EOS Friends Responses 68 | UENUM( BlueprintType ) 69 | enum class EEOSFriends : uint8 70 | { 71 | EF_UnknownError UMETA( DisplayName = "Unknown Error" ) 72 | }; 73 | 74 | // Enum of EOS Presence Responses 75 | UENUM( BlueprintType ) 76 | enum class EEOSPresence : uint8 77 | { 78 | EP_UnknownError UMETA( DisplayName = "Unknown Error" ) 79 | }; 80 | 81 | // Enum of EOS Auth Responses 82 | UENUM( BlueprintType ) 83 | enum class EEOSEcom : uint8 84 | { 85 | EE_UnknownError UMETA( DisplayName = "Unknown Error" ) 86 | }; 87 | 88 | 89 | class UEOSCommon 90 | { 91 | public: 92 | 93 | /** 94 | * Converts between an EOS SDK result Enum, to a Blueprint friendly enum. 95 | * As UENUMs must currently be uint8, we're limited to 255 values per enum, so we cannot do a direct 96 | * equivalence between the SDK values and some UENUM. Instead, we have separate enums for each 97 | * section and this function converts between them. 98 | * 99 | * @param SDKResult The Enum FROM the SDK. 100 | * @param Result If the SDK Enum is in this range, this will be populated. Otherwise ER_UnknownError. 101 | * @param Auth If the SDK Enum is in this range, this will be populated. Otherwise EA_UnknownError. 102 | * @param Friends If the SDK Enum is in this range, this will be populated. Otherwise EF_UnknownError. 103 | * @param Presence If the SDK Enum is in this range, this will be populated. Otherwise EP_UnknownError. 104 | * @param Ecom If the SDK Enum is in this range, this will be populated. Otherwise EE_UnknownError. 105 | * 106 | * @return EEOSResultType Which kind of result has been populated. 107 | */ 108 | static EEOSResultType GetUnrealFriendlyResult( EOS_EResult SDKResult, EEOSResults& Result, EEOSAuth& Auth, EEOSFriends& Friends, EEOSPresence& Presence, EEOSEcom& Ecom ); 109 | 110 | /** 111 | * Get the EOS Plugin version of the results, from the SDK Enum. 112 | * The EOS side is Engine/Blueprint ready. 113 | * 114 | * @param SDKResult The SDK Enum to request turning into a BP version. 115 | * @return EEOSResults The EOS Plugin, Engine/Blueprint version. 116 | */ 117 | static EEOSResults GetResultsValue( EOS_EResult SDKResult ); 118 | 119 | static EEOSAuth GetAuthValue( EOS_EResult SDKResult ); 120 | 121 | static EEOSFriends GetFriendsValue( EOS_EResult SDKResult ); 122 | 123 | static EEOSPresence GetPresenceValue( EOS_EResult SDKResult ); 124 | 125 | static EEOSEcom GetEcomValue( EOS_EResult SDKResult ); 126 | 127 | /** 128 | * Utility to return an EOS Result as a FString. 129 | * 130 | * @param Result The EOS Result to attempt to convert. 131 | * @return FString result of the conversion. 132 | */ 133 | static FString EOSResultToString( EOS_EResult Result ); 134 | }; 135 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/OnlineSubsystemEOS/Public/OnlineSubsystemEOSModule.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Modules/ModuleManager.h" 7 | #include "Tickable.h" 8 | 9 | class FOnlineSubsystemEOSModule : public IModuleInterface 10 | { 11 | 12 | public: 13 | 14 | /** IModuleInterface implementation */ 15 | virtual void StartupModule() override; 16 | virtual void ShutdownModule() override; 17 | virtual bool SupportsDynamicReloading() override; 18 | 19 | /** 20 | * Are the EOS Dlls loaded 21 | * 22 | * @return if the EOS DLLs are currently loaded (if we are loading them dynamically, statically linked are always true) 23 | */ 24 | bool AreEOSDllsLoaded() const; 25 | 26 | /** 27 | * Singleton-like access to this module's interface. This is just for convenience! 28 | * Beware of calling this during the shutdown phase, though. Your module might have been unloaded already. 29 | * 30 | * @return Returns singleton instance, loading the module on demand if needed 31 | */ 32 | static inline class FUEOSModule& Get() 33 | { 34 | return FModuleManager::LoadModuleChecked( "OnlineSubsystemEOS" ); 35 | } 36 | 37 | /** 38 | * Checks to see if this module is loaded and ready. It is only valid to call Get() if IsAvailable() returns true. 39 | * 40 | * @return True if the module is loaded and ready to use 41 | */ 42 | static inline bool IsAvailable() 43 | { 44 | return FModuleManager::Get().IsModuleLoaded( "OnlineSubsystemEOS" ); 45 | } 46 | 47 | protected: 48 | 49 | private: 50 | 51 | /** Class responsible for creating instance(s) of the subsystem */ 52 | class FOnlineFactoryEOS* EOSFactory; 53 | 54 | /** Handle to the DLL we will load */ 55 | void* EOSSDKHandle; 56 | 57 | /** StartupModule is covered with defines, these functions are the place to put breakpoints */ 58 | static bool LoadDependency( const FString& Dir, const FString& Name, void*& Handle ); 59 | static void FreeDependency( void*& Handle ); 60 | }; 61 | 62 | DECLARE_LOG_CATEGORY_EXTERN( OnlineSubsystemEOSLog, Log, All ); 63 | -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/ThirdParty/EOSSDK/AddSDKFoldersHere.txt: -------------------------------------------------------------------------------- 1 | Add the Bin, Include and Lib folders from the SDK to this folder. -------------------------------------------------------------------------------- /EOSBasic/Plugins/OnlineSubsystemEOS/Source/ThirdParty/EOSSDK/EOSSDK.build.cs: -------------------------------------------------------------------------------- 1 | // (C) Gaslight Games Ltd, 2019-2020. All rights reserved. 2 | 3 | using System.IO; 4 | using UnrealBuildTool; 5 | 6 | public class EOSSDK : ModuleRules 7 | { 8 | #if WITH_FORWARDED_MODULE_RULES_CTOR 9 | public EOSSDK( ReadOnlyTargetRules Target ) : base( Target ) 10 | #else 11 | public EOSSDK( TargetInfo Target ) 12 | #endif 13 | { 14 | // The currently supported version of the EOS SDK. 15 | // EOSVersion = "1.9"; 16 | 17 | Type = ModuleType.External; 18 | 19 | if( Target.Configuration == UnrealTargetConfiguration.Development ) 20 | { 21 | OptimizeCode = CodeOptimization.Never; 22 | } 23 | 24 | string BaseDirectory = Path.GetFullPath( Path.Combine( ModuleDirectory, "..", "..", "ThirdParty", "EOSSDK" ) ); 25 | 26 | // Check if the EOS SDK exists. 27 | if( Directory.Exists( BaseDirectory ) ) 28 | { 29 | PublicDefinitions.Add( "EOS_SDK_INSTALLED" ); 30 | } 31 | 32 | // Include headers 33 | PublicIncludePaths.Add( Path.Combine( BaseDirectory, "Include" ) ); 34 | 35 | if ( Target.Platform == UnrealTargetPlatform.Win64 ) 36 | { 37 | // Add the import library 38 | PublicAdditionalLibraries.Add( Path.Combine( BaseDirectory, "Lib", "EOSSDK-Win64-Shipping.lib" ) ); 39 | 40 | // Dlls 41 | RuntimeDependencies.Add( Path.Combine( BaseDirectory, "Bin", "EOSSDK-Win64-Shipping.dll" ) ); 42 | PublicDelayLoadDLLs.Add( "EOSSDK-Win64-Shipping.dll" ); 43 | } 44 | 45 | if( Target.Platform == UnrealTargetPlatform.Win32 ) 46 | { 47 | // Add the import library 48 | PublicAdditionalLibraries.Add( Path.Combine( BaseDirectory, "Lib", "EOSSDK-Win32-Shipping.lib" ) ); 49 | 50 | // Dlls 51 | RuntimeDependencies.Add( Path.Combine( BaseDirectory, "Bin", "EOSSDK-Win32-Shipping.dll" ) ); 52 | PublicDelayLoadDLLs.Add( "EOSSDK-Win32-Shipping.dll" ); 53 | } 54 | else if( Target.Platform == UnrealTargetPlatform.Linux ) 55 | { 56 | // Add the import library 57 | PublicAdditionalLibraries.Add( Path.Combine( BaseDirectory, "Bin", "libEOSSDK-Linux-Shipping.so" ) ); 58 | RuntimeDependencies.Add( Path.Combine( BaseDirectory, "Bin", "libEOSSDK-Linux-Shipping.so" ) ); 59 | } 60 | else if( Target.Platform == UnrealTargetPlatform.Mac ) 61 | { 62 | // Add the import library 63 | PublicAdditionalLibraries.Add( Path.Combine( BaseDirectory, "Bin", "libEOSSDK-Mac-Shipping.dylib" ) ); 64 | RuntimeDependencies.Add( Path.Combine( BaseDirectory, "Bin", "libEOSSDK-Mac-Shipping.dylib" ) ); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /EOSBasic/Source/EOSBasic.Target.cs: -------------------------------------------------------------------------------- 1 | // (C) Gaslight Games Ltd, 2019-2020. All rights reserved. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class EOSBasicTarget : TargetRules 7 | { 8 | public EOSBasicTarget( TargetInfo Target ) : base( Target ) 9 | { 10 | DefaultBuildSettings = BuildSettingsVersion.V2; 11 | 12 | Type = TargetType.Game; 13 | 14 | ExtraModuleNames.AddRange( new string[] { "EOSBasic" } ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /EOSBasic/Source/EOSBasic/EOSBasic.Build.cs: -------------------------------------------------------------------------------- 1 | // (C) Gaslight Games Ltd, 2019-2020. All rights reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class EOSBasic : ModuleRules 6 | { 7 | public EOSBasic( ReadOnlyTargetRules Target ) : base( Target ) 8 | { 9 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 10 | 11 | PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", "InputCore", 12 | "OnlineSubsystemEOS", "OnlineSubsystem", } ); 13 | 14 | PrivateDependencyModuleNames.AddRange( new string[] { } ); 15 | 16 | // Uncomment if you are using Slate UI 17 | // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); 18 | 19 | // Uncomment if you are using online features 20 | // PrivateDependencyModuleNames.Add("OnlineSubsystem"); 21 | 22 | // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /EOSBasic/Source/EOSBasic/EOSBasic.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #include "EOSBasic.h" 4 | #include "Modules/ModuleManager.h" 5 | 6 | IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, EOSBasic, "EOSBasic" ); 7 | -------------------------------------------------------------------------------- /EOSBasic/Source/EOSBasic/EOSBasic.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | -------------------------------------------------------------------------------- /EOSBasic/Source/EOSBasic/GameMode/EOSBasicGameModeBase.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #include "EOSBasicGameModeBase.h" 4 | 5 | -------------------------------------------------------------------------------- /EOSBasic/Source/EOSBasic/GameMode/EOSBasicGameModeBase.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/GameModeBase.h" 7 | #include "EOSBasicGameModeBase.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class EOSBASIC_API AEOSBasicGameModeBase : public AGameModeBase 14 | { 15 | GENERATED_BODY() 16 | 17 | }; 18 | -------------------------------------------------------------------------------- /EOSBasic/Source/EOSBasic/Player/BasicPlayerController.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | 4 | // EOS Basic Includes 5 | #include "BasicPlayerController.h" 6 | 7 | // Engine Includes 8 | #include "OnlineSubsystem.h" 9 | #include "Interfaces/OnlineIdentityInterface.h" 10 | 11 | // EOS Plugin Includes 12 | #include "OnlineSubsystemEOS.h" 13 | 14 | 15 | bool ABasicPlayerController::RequestLogin( FString Id, FString Token, FString Type ) 16 | { 17 | IOnlineSubsystem* SubSystem = IOnlineSubsystem::Get( EOS_SUBSYSTEM ); 18 | 19 | if( SubSystem != nullptr ) 20 | { 21 | IOnlineIdentityPtr OnlineIdentity = SubSystem->GetIdentityInterface(); 22 | 23 | if( OnlineIdentity != nullptr ) 24 | { 25 | FOnlineAccountCredentials Credentials( Type, Id, Token ); 26 | return OnlineIdentity->Login( 0, Credentials ); 27 | } 28 | } 29 | 30 | return false; 31 | } -------------------------------------------------------------------------------- /EOSBasic/Source/EOSBasic/Player/BasicPlayerController.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Gaslight Games Ltd, 2019-2020 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/PlayerController.h" 7 | #include "BasicPlayerController.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class EOSBASIC_API ABasicPlayerController : public APlayerController 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | 19 | UFUNCTION( BlueprintCallable, Category = "EOS Basic") 20 | bool RequestLogin( FString Id, FString Token, FString Type ); 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /EOSBasic/Source/EOSBasicEditor.Target.cs: -------------------------------------------------------------------------------- 1 | // (C) Gaslight Games Ltd, 2019-2020. All rights reserved. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class EOSBasicEditorTarget : TargetRules 7 | { 8 | public EOSBasicEditorTarget(TargetInfo Target) : base(Target) 9 | { 10 | DefaultBuildSettings = BuildSettingsVersion.V2; 11 | 12 | Type = TargetType.Editor; 13 | 14 | ExtraModuleNames.AddRange( new string[] { "EOSBasic" } ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UE4_EOS_Plugin 2 | 3 | **THIS PROJECT HAS BEEN ARCHIVED.** 4 | **Search for any of the more complete projects, available from other sources including the Epic Marketplace.** 5 | 6 | The time required to update and complete this project, vs those that have made leaps ahead marks the end of this product. 7 | 8 | A plugin and sample project, built for Unreal Engine 4, that implements the Epic Online Services SDK 9 | 10 | This plugin does not include the EOS (Epic Online Services) SDK. You will have to register and download this separately. Then copy the Bin, Include and Lib folders to the Plugins/Source/ThirdParty/EOSSDK directory. 11 | 12 | The project currently supports SDK **v1.9** and Engine version **4.25.x**. 13 | Additional support for Engine version 4.24 is now available. 14 | 15 | Make sure to right click the .uproject, Generate Visual Studio files and **compile**. 16 | 17 | If you download and run the sample project, you will need to: 18 | - Have registered your project on the EOS site (Dev Portal) 19 | - Retrieved your ProductId, SandboxId, DepolymentId, ClientId and Client Secret 20 | - Add the ProductId, SandboxId, DeploymentId, ClientId and Client Secret to **DefaultEngine.ini** (see the appropriate area) 21 | 22 | The project will now auto-initialize (and Shutdown) the SDK on Module startup. 23 | 24 | The current version only has support for logging **IN** to an account. You will require a **ClientId** and **Client Secret**. AND right now only using the **Dev Tool** (https://dev.epicgames.com/docs/services/en-US/DeveloperAuthenticationTool/index.html) has been tested and logging in (see Log output where "Status: 2" is given). 25 | 26 | The project has now moved over to using an Online Subsystem, so in your own project, you will need to add the appropriate sections and details to your own DefaultEngine.ini. See the sample project, EOSBasic, for more implementation details. 27 | 28 | License: 29 | Provided "as is." So feel free to use it in any and all of your own projects. Use it as a "jumping off point" to extend, fix and included into anything else you want. 30 | (I only ask that, if you do find it useful and fix/add something - please consider adding back to the plugin with a pull request!) 31 | --------------------------------------------------------------------------------