Fix macOS build: wrap Xbox SDK code with Q_OS_WIN guards
The xcompress.h header and XMem compression functions require Windows.h and the Xbox SDK, which are not available on macOS. Wrap all XMem functions with #ifdef Q_OS_WIN and provide stub implementations that return empty data on non-Windows platforms. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
41cb33b5b5
commit
51d632dd90
@ -1,6 +1,9 @@
|
||||
#include "compression.h"
|
||||
#include "minilzo.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "xcompress.h"
|
||||
#endif
|
||||
|
||||
// libmspack for LZX decompression
|
||||
extern "C" {
|
||||
@ -229,6 +232,7 @@ QString Compression::quickBmsPath()
|
||||
return s_quickBmsPath;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
QByteArray Compression::CompressXMem(const QByteArray &data)
|
||||
{
|
||||
XMEMCODEC_PARAMETERS_LZX lzxParams = {};
|
||||
@ -253,7 +257,15 @@ QByteArray Compression::CompressXMem(const QByteArray &data)
|
||||
output.resize(static_cast<int>(actualSize));
|
||||
return output;
|
||||
}
|
||||
#else
|
||||
QByteArray Compression::CompressXMem(const QByteArray &)
|
||||
{
|
||||
qWarning() << "XMem compression not available on this platform";
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
QByteArray Compression::DecompressXMem(const QByteArray &data,
|
||||
int flags, int windowSize, int partSize)
|
||||
{
|
||||
@ -479,6 +491,32 @@ QByteArray Compression::DecompressXMemRaw(const QByteArray &data, int flags, int
|
||||
XMemDestroyDecompressionContext(ctx);
|
||||
return output;
|
||||
}
|
||||
#else
|
||||
// Non-Windows stub implementations
|
||||
QByteArray Compression::DecompressXMem(const QByteArray &, int, int, int)
|
||||
{
|
||||
qWarning() << "XMem decompression not available on this platform";
|
||||
return {};
|
||||
}
|
||||
|
||||
QByteArray Compression::DecompressXMemNative(const QByteArray &)
|
||||
{
|
||||
qWarning() << "XMem native decompression not available on this platform";
|
||||
return {};
|
||||
}
|
||||
|
||||
QByteArray Compression::DecompressXMemTDecode(const QByteArray &, int, int, int)
|
||||
{
|
||||
qWarning() << "XMem TDecode decompression not available on this platform";
|
||||
return {};
|
||||
}
|
||||
|
||||
QByteArray Compression::DecompressXMemRaw(const QByteArray &, int, int, int)
|
||||
{
|
||||
qWarning() << "XMem raw decompression not available on this platform";
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// lzxdhelper-style LZX decompression (UE Viewer/Gildor approach)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user