From 8de9f927d25a61c62e275520b1e090b2938cd1a8 Mon Sep 17 00:00:00 2001 From: Keijiro Takahashi Date: Fri, 8 Feb 2019 15:13:24 +0900 Subject: [PATCH] Fix Windows fseek issue - Changed to use _ifseeki64 instead of fseek on Windows. --- Assets/Klak/Hap/Plugin/Windows/KlakHap.dll | Bin 39936 -> 39936 bytes Plugin/Source/Decoder.h | 2 +- Plugin/Source/Demuxer.h | 6 +++++- Plugin/Source/KlakHap.cpp | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Assets/Klak/Hap/Plugin/Windows/KlakHap.dll b/Assets/Klak/Hap/Plugin/Windows/KlakHap.dll index 843225f265d5858eec5669d2c7f1c8d61c334005..73415da1199aa0447713d458b6ba18c92df3d91f 100644 GIT binary patch delta 8407 zcmeHMi(gdL+TLqmaJUQu!T{ohK|u!)9K0Z22+#qx0y2tnQIWfs^q2;Ev`kRM#1TL9 z^;TMu_LZk&rj4hxV+CrVWoc$*Ul%>+s0WW$SpE#t&OXoDdk@3-{R!W&-<+R zU2E;N*JU%*AJx<$T_TpkB5NL8w~qB}A_5 zUozV%b_xScz8e1kVJ?(pMO{IO>?G@=+qHcuK%-;T)JHRfg*ehR?=uSU2-xab#Eww0 zXG-rcvjky_*sOoAQV_(3Q^_|PX}{+J7VhY+U9Dkz9MAMR$k^|c=6#$EbNudIq+#=@ zz%QOnq;-C&LvPPVmi<%vCCPXlwCx`{?sfUzmyBO>|DUpd$@j8k{E&X~OGw!1O4#&J z!m92B-}WYJlu0r^O4)j`F4C0}@=%IbcZ${CVfFn}}O#RZ?&^NOOXd*tBLsI)mbL2NE8SgsD4^DEGJ`1t*b2#1C zoa7}Z*(C?ebGmb!WQLRE$N_zwZf_^?b`n7jI9Hd&pW|p_ zzZ~=TMXpvrU1R=%oA);TyI-pLkFMZFZpCxlJR4Q_U(3Frj{XJa<=Bqx$~s*L>Z-rQ z&C8>?1KwmWQ=f>^gz*L4DT$zN4{mY_&IdQpD-k6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5Z#QHL2?jxLAM0I&@(MW(v5#B+T92;9?Go8G9I9;0)Me!psHM!z?@S3@tq!UBt7x4}z*w_xsAN_s9)V(FTOmD~(n;33#JaDlJEvcZo4PryXO=YfCV zzlRc04;Hg8=Aiv5I6YS~vBGhzTaC~K`oIo?3pBvq0T(!1)qAdUV!itub{;tb@4~Ku zvtq2Fu-o7%z^YPcyD)k+ATPm0@0x+%!5R^`2@IaE3|$B?U*!TDU?RT}cv9s8FRT0t z(7jB_5!hGd{ef#?6}TM&UxU?%iUetf$(;atVnr4A%o}(Ob{riNxDKmqljt?@AWY;4 zJg4&Wz%Z=2LN@|O!$h5lz%42lxF0L-Nz`+25vyVGSVncbF$sZ-u$-oVF9!ZQtOyky z23~=QN(H{Y6jy+pBfxOH166|$1ulb$oUOo*Relo~zFg7q^2OG`#4T70d>*!OH}1b6 z$7Kii4Oov?oUN$zF!0wEn62Plz=IWN6kK2%OkCM*pf7eC!9#%gFwuZOv1bV`cJfr1 z$Vmgf2s?>-#QQ^-REb|ya8iI1V9nrSV-%ZNErv*-*uLHY7btI1$Pp+u9tJKj-S*b5 SLXEa_f7gDUO~2<~{J#NU8Z%q~ 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;