Lots of work on several unrelated things.
This commit is contained in:
@@ -1,25 +1,32 @@
|
||||
|
||||
#include "LockedWrapper.h"
|
||||
#include "DebugPrint.h"
|
||||
#include "LuprexGameModeBase.h"
|
||||
#include "lpx-drvutil.hpp"
|
||||
#include "lpx-paths.hpp"
|
||||
|
||||
using namespace CommonTypes;
|
||||
|
||||
|
||||
void FlxLockedWrapper::DPrintHook(const char *Msg, size_t Size)
|
||||
{
|
||||
FString FMessage(Size, (const UTF8CHAR *)Msg);
|
||||
UE_LOG(LogLuprex, Error, TEXT("%s"), *FMessage);
|
||||
}
|
||||
|
||||
void FlxLockedWrapper::InitWrapper() {
|
||||
if (Lockable.Wrapper.play_initialize != nullptr) {
|
||||
// Already initialized.
|
||||
return;
|
||||
}
|
||||
FString dll((const UTF8CHAR*)LUPREX_DLL_PATH);
|
||||
DebugPrint::DPrint(dll);
|
||||
UE_LOG(LogLuprex, Verbose, TEXT("Luprex DLL Path: %s"), *dll);
|
||||
void* DLL = FPlatformProcess::GetDllHandle(*dll);
|
||||
if (DLL != nullptr) {
|
||||
using InitFn = void (*)(EngineWrapper*);
|
||||
InitFn init = (InitFn)FPlatformProcess::GetDllExport(DLL, TEXT("init_engine_wrapper"));
|
||||
if (init != nullptr) {
|
||||
init(&Lockable.Wrapper);
|
||||
Lockable.Wrapper.hook_dprint(DebugPrint::DPrint);
|
||||
Lockable.Wrapper.hook_dprint(DPrintHook);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,16 +34,9 @@ void FlxLockedWrapper::InitWrapper() {
|
||||
FString FlxLockedWrapper::FetchStdout() {
|
||||
uint32_t ndata; const char* data;
|
||||
Lockable.Wrapper.get_outgoing(Get(), 0, &ndata, &data);
|
||||
|
||||
if (ndata == 0) {
|
||||
return FString();
|
||||
}
|
||||
|
||||
std::string_view src(data, ndata);
|
||||
int consumed;
|
||||
std::u16string cps = drvutil::utf8_to_ucs2(src, &consumed);
|
||||
Lockable.Wrapper.play_sent_outgoing(Get(), 0, consumed);
|
||||
return FString(cps.size(), (const UCS2CHAR*)(&cps[0]));
|
||||
FString result(ndata, (const UTF8CHAR *)data);
|
||||
Lockable.Wrapper.play_sent_outgoing(Get(), 0, ndata);
|
||||
return result;
|
||||
}
|
||||
|
||||
int64 FlxLockedWrapper::GetActor() {
|
||||
|
||||
Reference in New Issue
Block a user