Raw input overruling defaults

Hi,

I am trying to overrule the rawinputsettings for the raw input plugin, but due to the way its structured i can’t currently. I am trying to automatically make a configuration for a specific device based on the inputs i am receiving (automatic calibration basically). I want to use that instead of specifying it myself, because that is a lot of work to support all types of devices.

FRawInputDeviceConfiguration is not exported, hence i can’t use it in other projects.

E.g. i expected:

USTRUCT()
struct RAWINPUT_API FRawInputDeviceConfiguration
{
	GENERATED_BODY()
....

}

I am trying to do something such as:

URawInputSettings* RawInputSettings = const_cast<URawInputSettings*>(GetDefault<URawInputSettings>());
if (!RawInputSettings)
{
    return;
}
    
FRawInputDeviceConfiguration newConfiguration;
newConfiguration.ProductID = FString::Printf(TEXT("%02X"), device.ProductID);
newConfiguration.VendorID = FString::Printf(TEXT("%02X"), device.VendorID);
RawInputSettings->DeviceConfigurations.Add(newConfiguration);
RawInputSettings->SaveConfig();

Can you please fix this in the upcoming hotfix for 4.15?

Hey -

THe RawInputSettings class (in RawInputSettings.h) includes a public array

UPROPERTY(config, EditAnywhere, Category="Device Configurations")
TArray<FRawInputDeviceConfiguration> DeviceConfigurations;

If you are using the URawInputSettings class, you should be able to access the struct elements for each element of the DeviceConfigurations array.

Cheers

i am using it, but as soon as i use FRawInputDeviceConfiguration i get a linker error in my code. I think the struct FRawInputDeviceConfiguration should be annotated with RAWINPUT_API to be able to use it outside the project.

Looking at the code you’re using, it seems you need to make the FRawInputDeviceConfiguration in line 7 a pointer (add an *). This should prevent the “unresolved externals” error that you’re receiving.

The problem is that the struct FRawInputDeviceConfiguration has a default constructor implemented in the RawInputSettings.cpp file. Can you please tell me why in your opinion why an export is not needed? your solution indeed solves the linker error, because you don’t call the default constructor anymore and don’t construct a new input device configuration…

I found a workaround that does construct it without calling the default constructor, which i think it not really acceptable:

RawInputSettings->DeviceConfigurations.AddUninitialized(1);
FRawInputDeviceConfiguration& newConfiguration = RawInputSettings->DeviceConfigurations.Last();

This workaround prevents calling the default constructor, which should do the job. I just have to make sure i initialize all values correctly.

I was under the impression that your issue was specifically the linker error, so my steps were meant to solve that. I have entered a report to look at extending the functionality of the Raw Input plugin that you can follow here: Unreal Engine Issues and Bug Tracker (UE-42204) .