diff --git a/Assets/Klak/Hap/Plugin/Windows/KlakHap.dll b/Assets/Klak/Hap/Plugin/Windows/KlakHap.dll index 843225f..73415da 100644 Binary files a/Assets/Klak/Hap/Plugin/Windows/KlakHap.dll and b/Assets/Klak/Hap/Plugin/Windows/KlakHap.dll differ diff --git a/Plugin/Source/Decoder.h b/Plugin/Source/Decoder.h index cb7f883..3506c05 100644 --- a/Plugin/Source/Decoder.h +++ b/Plugin/Source/Decoder.h @@ -91,7 +91,7 @@ namespace KlakHap ) { // FIXME: This should be threaded. - for (auto i = 0; i < count; i++) work(p, i); + for (auto i = 0u; i < count; i++) work(p, i); } #pragma endregion diff --git a/Plugin/Source/Demuxer.h b/Plugin/Source/Demuxer.h index 07fdacc..f65bb49 100644 --- a/Plugin/Source/Demuxer.h +++ b/Plugin/Source/Demuxer.h @@ -76,7 +76,11 @@ namespace KlakHap auto inOffs = MP4D__frame_offset(&demux_, 0, index, &inSize, ×tamp, &duration); // Frame data read - fseek(file_, (long)inOffs, SEEK_SET); + #if defined(_WIN32) + _fseeki64(file_, inOffs, SEEK_SET); + #else + fseek(file_, inOffs, SEEK_SET); + #endif buffer.storage.resize(inSize); fread(buffer.storage.data(), inSize, 1, file_); } diff --git a/Plugin/Source/KlakHap.cpp b/Plugin/Source/KlakHap.cpp index 5ed121d..8a61e00 100644 --- a/Plugin/Source/KlakHap.cpp +++ b/Plugin/Source/KlakHap.cpp @@ -4,6 +4,13 @@ #include "ReadBuffer.h" #include "IUnityRenderingExtensions.h" +#if defined(_WIN32) +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include +#include +#endif + using namespace KlakHap; namespace @@ -71,6 +78,18 @@ namespace #pragma region Plugin common function +#if defined(_WIN32) && defined(_DEBUG) + +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* interfaces) +{ + // Open a new console for debug logging. + FILE * pConsole; + AllocConsole(); + freopen_s(&pConsole, "CONOUT$", "wb", stdout); +} + +#endif + extern "C" UnityRenderingEventAndData UNITY_INTERFACE_EXPORT KlakHap_GetTextureUpdateCallback() { return TextureUpdateCallback;