From 97c2c8a094743e6943e94695faedf83732f60e6a Mon Sep 17 00:00:00 2001 From: Silent Date: Wed, 23 Oct 2024 21:52:25 +0200 Subject: [PATCH] Work around libflac linking issues with v141_xp --- SilentPatchSA/AudioHardwareSA.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/SilentPatchSA/AudioHardwareSA.cpp b/SilentPatchSA/AudioHardwareSA.cpp index 650dc67..40430c8 100644 --- a/SilentPatchSA/AudioHardwareSA.cpp +++ b/SilentPatchSA/AudioHardwareSA.cpp @@ -6,6 +6,28 @@ bool CAEDataStream::m_bUseNewStruct; static void* CAEDataStream__Initialise = AddressByVersion(0x4DC2B0, 0x4DC7A0, 0x4E7550); WRAPPER bool CAEDataStream::Initialise() { VARJMP(CAEDataStream__Initialise); } +// Work around libflac linking issues with older MSVC +#if _MSC_VER < 1930 + +extern "C" unsigned long __declspec(naked) _dtoul3_legacy(const double x) { + _asm + { + cvtsd2si eax, xmm0 + xor edx, edx + retn + } +} + +extern "C" __declspec(naked) float _ltof3(long x) { + _asm + { + cvtsi2ss xmm0, ecx + retn + } +} + +#endif + DWORD CAEDataStreamOld::Seek(LONG nToSeek, DWORD nPoint) { LARGE_INTEGER filePosition;