I am trying to use a custom made GameUserSettings class, and replaced the default one in DefaultEngine.ini
.
Now wherenver i try opening the project i get this:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000240
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_JourneyFrameworkMainMenuSystem!UJF_GameUserSettings::ApplyAdvancedSettings() [C:\Users\dan00\Documents\Unreal Plugins\JourneyFramework\Plugins\JourneyFrameworkMainMenuSystem\Source\JourneyFrameworkMainMenuSystem\Private\Misc\JF_GameUserSettings.cpp:36]
UE4Editor_JourneyFrameworkMainMenuSystem!UJF_GameUserSettings::ApplySettings() [C:\Users\dan00\Documents\Unreal Plugins\JourneyFramework\Plugins\JourneyFrameworkMainMenuSystem\Source\JourneyFrameworkMainMenuSystem\Private\Misc\JF_GameUserSettings.cpp:21]
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll
i have no idea what i did wrong, i went through my code a bunch of times and couldnt find anything. Here is my source code:
.cpp:
#include "Misc/JF_GameUserSettings.h"
#include "GameFramework/GameUserSettings.h"
#include "AudioDevice.h"
#include "Engine/Engine.h"
#include "Kismet/KismetMathLibrary.h"
#include "RHI.h"
/*
Constructor
*/
UJF_GameUserSettings::UJF_GameUserSettings() {
LoadConfigIni();
}
void UJF_GameUserSettings::ApplySettings(bool bCheckForCommandLineOverrides) {
Super::ApplyNonResolutionSettings();
ApplyAdvancedSettings();
Super::ApplyResolutionSettings(bCheckForCommandLineOverrides);
SaveConfig();
}
void UJF_GameUserSettings::ApplyAdvancedSettings() {
//Misc
if (bEnableBloom) {
GetWorld()->Exec(GetWorld(), TEXT("r.DefaultFeature.Bloom 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.DefaultFeature.Bloom 0"));
}
if (bMotionBlur) {
GetWorld()->Exec(GetWorld(), TEXT("r.DefaultFeature.MotionBlur 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.DefaultFeature.MotionBlur 0"));
}
//Check for ray tracing
if (bRayTracing && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing 1"));
}
else {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing 0"));
}
if (bRayTracing && ShadowsType == EShadowsType::RayTraced && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Shadows 1"));
}
else {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Shadows 0"));
}
if (bRayTracing && AmbientOcclusionType == EAmbientOcclusionType::RayTraced && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.AmbientOcclusion 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.AmbientOcclusion 0"));
}
if (bRayTracing && ReflectionsType == EReflectionsType::RayTracing && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Reflections 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Reflections 0"));
}
if (bRayTracing && TranslucencyType == ETranslucencyType::RayTracing && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Translucency 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Translucency 0"));
}
switch (GIType)
{
case EGlobalIlluminationType::Off:
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination 0"));
GetWorld()->Exec(GetWorld(), TEXT("r.SSGI.Quality 0"));
break;
case EGlobalIlluminationType::RayTraced:
if (bRayTracing && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.SSGI.Quality 0"));
switch (RTGIType)
{
case ERayTracingGlobalIlluminationType::FinalGather:
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination 1"));
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination.EnableFinalGather 1"));
break;
case ERayTracingGlobalIlluminationType::BruteForce:
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination 1"));
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination.EnableFinalGather 0"));
break;
default:
break;
}
break;
}
else
{
break;
}
case EGlobalIlluminationType::ScreenSpace:
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination 0"));
GetWorld()->Exec(GetWorld(), TEXT("r.SSGI.Quality " + UKismetMathLibrary::Clamp(ScreenSpaceGIQuality, 1, 4)));
break;
default:
break;
}
}
#pragma region Getters And Setters
void UJF_GameUserSettings::SetBloom(bool Set) {
bEnableBloom = Set;
}
bool UJF_GameUserSettings::ReturnBloom() {
return bEnableBloom;
}
void UJF_GameUserSettings::SetMotionBlur(bool Set) {
bMotionBlur = Set;
}
bool UJF_GameUserSettings::ReturnMotionBlur()
{
return bMotionBlur;
}
void UJF_GameUserSettings::SetRayTracing(bool Set) {
bRayTracing = Set;
}
bool UJF_GameUserSettings::GetRayTracing() {
return bRayTracing;
}
void UJF_GameUserSettings::SetShadowType(EShadowsType Set) {
ShadowsType = Set;
}
EShadowsType UJF_GameUserSettings::GetShadowType() {
return ShadowsType;
}
void UJF_GameUserSettings::SetAmbientOcclusionType(EAmbientOcclusionType Set) {
AmbientOcclusionType = Set;
}
EAmbientOcclusionType UJF_GameUserSettings::GetAmbientOcclusionType() {
return AmbientOcclusionType;
}
void UJF_GameUserSettings::SetReflectionType(EReflectionsType Set) {
ReflectionsType = Set;
}
EReflectionsType UJF_GameUserSettings::GetReflectionType() {
return ReflectionsType;
}
void UJF_GameUserSettings::SetTranslucencyType(ETranslucencyType Set) {
TranslucencyType = Set;
}
ETranslucencyType UJF_GameUserSettings::GetTranslucencyType() {
return TranslucencyType;
}
void UJF_GameUserSettings::SetGlobalIlluminationType(EGlobalIlluminationType Set) {
GIType = Set;
}
EGlobalIlluminationType UJF_GameUserSettings::GetGlobalIlluminationType() {
return GIType;
}
void UJF_GameUserSettings::SetSSGIQuality(int32 Set) {
ScreenSpaceGIQuality = Set;
}
int32 UJF_GameUserSettings::GetSSGIQuality() {
return ScreenSpaceGIQuality;
}
void UJF_GameUserSettings::SetRTGIType(ERayTracingGlobalIlluminationType Set) {
RTGIType = Set;
}
ERayTracingGlobalIlluminationType UJF_GameUserSettings::GetRTGIType() {
return RTGIType;
}
void UJF_GameUserSettings::SetVolumetricLighting(bool Set) {
bVolumetricLighting = Set;
}
bool UJF_GameUserSettings::GetVolumetricLighting() {
return bVolumetricLighting;
}
void UJF_GameUserSettings::SetRAPI(int32 Set) {
RendAPI = Set;
}
int32 UJF_GameUserSettings::GetRAPI() {
return RendAPI;
}
#pragma endregion
.h:
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameUserSettings.h"
#include "JF_GameUserSettings.generated.h"
UENUM(BlueprintType)
/*
Shadow types
*/
enum class EShadowsType : uint8 {
Raster UMETA(DisplayName="Rasterized"),
RayTraced UMETA(DisplayName="Ray Traced")
};
UENUM(BlueprintType)
/*
AO Types
*/
enum class EAmbientOcclusionType : uint8 {
ScreenSpace UMETA(DisplayName="Screen Space"),
RayTraced UMETA(DisplayName="Ray Traced")
};
UENUM(BlueprintType)
/*
GI Types
*/
enum class EGlobalIlluminationType : uint8 {
Off UMETA(DisplayName="Off"),
ScreenSpace UMETA(DisplayName="Screen Space"),
RayTraced UMETA(DisplayName="Ray Traced")
};
UENUM(BlueprintType)
/*
RAPI Types
*/
enum class ERenderingAPI : uint8 {
DX10 UMETA(DisplayName="DirectX 10 (Legacy)"),
DX11 UMETA(DisplayName="DirectX 12"),
DX12 UMETA(DisplayName="DirectX 11"),
Vulkan UMETA(DisplayName="Vulkan"),
OpenGL UMETA(DisplayName="OpenGL")
};
/*
Custom GameUserSettings Class
Saves to the GameUserSettings.ini file
*/
UCLASS(config = GameUserSettings)
class JOURNEYFRAMEWORKMAINMENUSYSTEM_API UJF_GameUserSettings : public UGameUserSettings
{
GENERATED_BODY()
public:
UJF_GameUserSettings();
/*
Applys all settings and saves them
*/
virtual void ApplySettings(bool bCheckForCommandLineOverrides) override;
#pragma region Advanced Functions
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
/*
Applys advanced settings. Like ray tracing, AA types and GI types
*/
void ApplyAdvancedSettings();
#pragma region Bloom
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetBloom(bool Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
bool ReturnBloom();
#pragma endregion
#pragma region Motion Blur
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetMotionBlur(bool Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
bool ReturnMotionBlur();
#pragma endregion
#pragma region Ray Tracing
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetRayTracing(bool Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
bool GetRayTracing();
#pragma region Shadows
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetShadowType(EShadowsType Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
EShadowsType GetShadowType();
#pragma endregion
#pragma region Ambient Occlusion
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetAmbientOcclusionType(EAmbientOcclusionType Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
EAmbientOcclusionType GetAmbientOcclusionType();
#pragma endregion
#pragma region Reflections
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetReflectionType(EReflectionsType Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
EReflectionsType GetReflectionType();
#pragma endregion
#pragma region Translucency
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetTranslucencyType(ETranslucencyType Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
ETranslucencyType GetTranslucencyType();
#pragma endregion
#pragma region Global Illumination
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetGlobalIlluminationType(EGlobalIlluminationType Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
EGlobalIlluminationType GetGlobalIlluminationType();
#pragma region SSGI
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetSSGIQuality(int32 Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
int32 GetSSGIQuality();
#pragma endregion
#pragma region Ray Traced GI
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetRTGIType(ERayTracingGlobalIlluminationType Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
ERayTracingGlobalIlluminationType GetRTGIType();
#pragma endregion
#pragma region Volumetric Lighting
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
void SetVolumetricLighting(bool Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
bool GetVolumetricLighting();
#pragma endregion
#pragma endregion
#pragma region RAPI
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
/*
Sets the rendering API. REQUIRES CUSTOM LAUNCHER PROGRAM AND INI PARSER!
@param int32 Set: What to set the value to. (0 = DX10, 1 = DX11, 2 = DX12, 3 = Vulkan, 4 = OpenGL)
*/
void SetRAPI(int32 Set);
UFUNCTION(BlueprintCallable, Category = "Journey Framework|Main Menu System|Custom Game User Settings")
/*
Returns the current value of RendAPI.
@returns int32 RendAPI: 0 = DX10, 1 = DX11, 2 = DX12, 3 = Vulkan, 4 = OpenGL
*/
int32 GetRAPI();
#pragma endregion
#pragma endregion
protected:
#pragma region Advanced Visual Variables
#pragma region Quality
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
bool bMotionBlur;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
bool bDynamicResolution;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
bool bEnableBloom;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
bool bVolumetricLighting;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
bool bRayTracing;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
int32 DLSSQuality;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
int32 ScreenSpaceGIQuality;
#pragma endregion
#pragma region Type
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
EShadowsType ShadowsType;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
EReflectionsType ReflectionsType;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
ETranslucencyType TranslucencyType;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
EAmbientOcclusionType AmbientOcclusionType;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
EGlobalIlluminationType GIType;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
ERayTracingGlobalIlluminationType RTGIType;
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
int32 RendAPI;
#pragma endregion
#pragma endregion
#pragma region Sensitivity Variables
UPROPERTY(Config)
float XBaseSentitivity;
UPROPERTY(Config)
float YBaseSensitivity;
#pragma endregion
#pragma region Sound
UPROPERTY(Config, EditAnywhere, BlueprintReadWrite)
float MasterVolume;
#pragma endregion
};
I will be happy to provide more info if necessary.