mirror of
https://github.com/storytold/UE4-OSC.git
synced 2026-10-13 23:53:20 +00:00
4.5 port
set OSC_ENGINE_VERSION value to compile for an earlier version
This commit is contained in:
@@ -90,15 +90,25 @@ struct FOscDataElemStruct
|
||||
|
||||
void SetString(FName value)
|
||||
{
|
||||
#if OSC_ENGINE_VERSION < 40500
|
||||
static_assert(sizeof(value) <= sizeof(Data), "Too short to hold the string value.");
|
||||
Data = *reinterpret_cast<const int64*>(&value);
|
||||
#else
|
||||
static_assert(sizeof(FMinimalName) <= sizeof(Data), "Too short to hold the string value.");
|
||||
const auto mininal = NameToMinimalName(value);
|
||||
Data = *reinterpret_cast<const int64*>(&mininal);
|
||||
#endif
|
||||
Type = STRING;
|
||||
Data = *reinterpret_cast<int64*>(&value);
|
||||
assert(value == AsStringValue());
|
||||
}
|
||||
|
||||
FName AsStringValue() const
|
||||
{
|
||||
#if OSC_ENGINE_VERSION < 40500
|
||||
return *reinterpret_cast<const FName *>(&Data);
|
||||
#else
|
||||
return MinimalNameToName(*reinterpret_cast<const FMinimalName *>(&Data));
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsString() const
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// Target engine version. Used to enable compatibility code.
|
||||
#define OSC_ENGINE_VERSION 40500
|
||||
|
||||
|
||||
/* Public Dependencies
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
@@ -150,7 +150,11 @@ void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
|
||||
{
|
||||
FSimpleDelegateGraphTask::CreateAndDispatchWhenReady(
|
||||
FSimpleDelegateGraphTask::FDelegate::CreateUObject(this, &UOscDispatcher::CallbackMainThread),
|
||||
#if OSC_ENGINE_VERSION < 40500
|
||||
TEXT("OscDispatcherProcessMessages"),
|
||||
#else
|
||||
TStatId(),
|
||||
#endif
|
||||
nullptr,
|
||||
ENamedThreads::GameThread);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user