x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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?

Product Version: UE 4.15
Tags:
more ▼

asked Feb 19 '17 at 02:57 PM in C++ Programming

avatar image

cageman
673 30 33 65

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey cageman-

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

Doug Wilson

more ▼

answered Feb 20 '17 at 06:41 PM

avatar image cageman Feb 20 '17 at 07:17 PM

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.

avatar image Doug E ♦♦ STAFF Feb 20 '17 at 09:41 PM

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.

avatar image cageman Feb 21 '17 at 07:13 AM

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.

avatar image Doug E ♦♦ STAFF Feb 21 '17 at 03:06 PM

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: https://issues.unrealengine.com/issue/UE-42204 .

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question