Make zstd mandatory - it'll also be used for compression in online nifi
This commit is contained in:
parent
3f61538844
commit
4846219327
|
@ -82,9 +82,7 @@ endif()
|
||||||
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2)
|
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2)
|
||||||
pkg_check_modules(Slirp REQUIRED IMPORTED_TARGET slirp)
|
pkg_check_modules(Slirp REQUIRED IMPORTED_TARGET slirp)
|
||||||
pkg_check_modules(LibArchive REQUIRED IMPORTED_TARGET libarchive)
|
pkg_check_modules(LibArchive REQUIRED IMPORTED_TARGET libarchive)
|
||||||
pkg_check_modules(Zstd IMPORTED_TARGET libzstd)
|
pkg_check_modules(Zstd REQUIRED IMPORTED_TARGET libzstd)
|
||||||
|
|
||||||
cmake_dependent_option(ENABLE_ZSTD "Enable support for Zstandard-compressed ROMs" ON "Zstd_FOUND" OFF)
|
|
||||||
|
|
||||||
fix_interface_includes(PkgConfig::SDL2 PkgConfig::Slirp PkgConfig::LibArchive)
|
fix_interface_includes(PkgConfig::SDL2 PkgConfig::Slirp PkgConfig::LibArchive)
|
||||||
|
|
||||||
|
@ -157,14 +155,9 @@ else()
|
||||||
target_include_directories(melonDS PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
target_include_directories(melonDS PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(melonDS PRIVATE core)
|
target_link_libraries(melonDS PRIVATE core)
|
||||||
target_link_libraries(melonDS PRIVATE PkgConfig::SDL2 PkgConfig::Slirp PkgConfig::LibArchive)
|
target_link_libraries(melonDS PRIVATE PkgConfig::SDL2 PkgConfig::Slirp PkgConfig::LibArchive PkgConfig::Zstd)
|
||||||
target_link_libraries(melonDS PRIVATE ${QT_LINK_LIBS} ${CMAKE_DL_LIBS})
|
target_link_libraries(melonDS PRIVATE ${QT_LINK_LIBS} ${CMAKE_DL_LIBS})
|
||||||
|
|
||||||
if (ENABLE_ZSTD)
|
|
||||||
target_compile_definitions(melonDS PRIVATE ZSTD_ENABLED)
|
|
||||||
target_link_libraries(melonDS PRIVATE PkgConfig::Zstd)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
option(PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF)
|
option(PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF)
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
|
|
|
@ -22,9 +22,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#ifdef ZSTD_ENABLED
|
|
||||||
#include <zstd.h>
|
#include <zstd.h>
|
||||||
#endif
|
|
||||||
#ifdef ARCHIVE_SUPPORT_ENABLED
|
#ifdef ARCHIVE_SUPPORT_ENABLED
|
||||||
#include "ArchiveUtil.h"
|
#include "ArchiveUtil.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -481,7 +479,6 @@ bool LoadBIOS()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ZSTD_ENABLED
|
|
||||||
u32 DecompressROM(const u8* inContent, const u32 inSize, u8** outContent)
|
u32 DecompressROM(const u8* inContent, const u32 inSize, u8** outContent)
|
||||||
{
|
{
|
||||||
u64 realSize = ZSTD_getFrameContentSize(inContent, inSize);
|
u64 realSize = ZSTD_getFrameContentSize(inContent, inSize);
|
||||||
|
@ -503,7 +500,6 @@ u32 DecompressROM(const u8* inContent, const u32 inSize, u8** outContent)
|
||||||
*outContent = realContent;
|
*outContent = realContent;
|
||||||
return realSize;
|
return realSize;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool LoadROM(QStringList filepath, bool reset)
|
bool LoadROM(QStringList filepath, bool reset)
|
||||||
{
|
{
|
||||||
|
@ -546,7 +542,6 @@ bool LoadROM(QStringList filepath, bool reset)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
filelen = (u32)len;
|
filelen = (u32)len;
|
||||||
|
|
||||||
#if ZSTD_ENABLED
|
|
||||||
if (filename.length() > 4 && filename.substr(filename.length() - 4) == ".zst")
|
if (filename.length() > 4 && filename.substr(filename.length() - 4) == ".zst")
|
||||||
{
|
{
|
||||||
u8* outContent = nullptr;
|
u8* outContent = nullptr;
|
||||||
|
@ -565,7 +560,6 @@ bool LoadROM(QStringList filepath, bool reset)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int pos = LastSep(filename);
|
int pos = LastSep(filename);
|
||||||
if(pos != -1)
|
if(pos != -1)
|
||||||
|
@ -729,7 +723,6 @@ bool LoadGBAROM(QStringList filepath)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
filelen = (u32)len;
|
filelen = (u32)len;
|
||||||
|
|
||||||
#if ZSTD_ENABLED
|
|
||||||
if (filename.length() > 4 && filename.substr(filename.length() - 4) == ".zst")
|
if (filename.length() > 4 && filename.substr(filename.length() - 4) == ".zst")
|
||||||
{
|
{
|
||||||
u8* outContent = nullptr;
|
u8* outContent = nullptr;
|
||||||
|
@ -748,7 +741,6 @@ bool LoadGBAROM(QStringList filepath)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int pos = LastSep(filename);
|
int pos = LastSep(filename);
|
||||||
basepath = filename.substr(0, pos);
|
basepath = filename.substr(0, pos);
|
||||||
|
|
|
@ -1568,7 +1568,6 @@ static bool SupportedArchiveByMimetype(const QMimeType& mimetype)
|
||||||
return MimeTypeInList(mimetype, ArchiveMimeTypes);
|
return MimeTypeInList(mimetype, ArchiveMimeTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ZSTD_ENABLED
|
|
||||||
static bool ZstdNdsRomByExtension(const QString& filename)
|
static bool ZstdNdsRomByExtension(const QString& filename)
|
||||||
{
|
{
|
||||||
if (filename.endsWith(".zst", Qt::CaseInsensitive))
|
if (filename.endsWith(".zst", Qt::CaseInsensitive))
|
||||||
|
@ -1580,14 +1579,12 @@ static bool ZstdGbaRomByExtension(const QString& filename)
|
||||||
if (filename.endsWith(".zst", Qt::CaseInsensitive))
|
if (filename.endsWith(".zst", Qt::CaseInsensitive))
|
||||||
return GbaRomByExtension(filename.left(filename.size() - 4));
|
return GbaRomByExtension(filename.left(filename.size() - 4));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static bool FileIsSupportedFiletype(const QString& filename, bool insideArchive = false)
|
static bool FileIsSupportedFiletype(const QString& filename, bool insideArchive = false)
|
||||||
{
|
{
|
||||||
#ifdef ZSTD_ENABLED
|
|
||||||
if (ZstdNdsRomByExtension(filename) || ZstdGbaRomByExtension(filename))
|
if (ZstdNdsRomByExtension(filename) || ZstdGbaRomByExtension(filename))
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
if (NdsRomByExtension(filename) || GbaRomByExtension(filename) || SupportedArchiveByExtension(filename))
|
if (NdsRomByExtension(filename) || GbaRomByExtension(filename) || SupportedArchiveByExtension(filename))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -2226,10 +2223,8 @@ void MainWindow::dropEvent(QDropEvent* event)
|
||||||
|
|
||||||
bool isNdsRom = NdsRomByExtension(filename) || NdsRomByMimetype(mimetype);
|
bool isNdsRom = NdsRomByExtension(filename) || NdsRomByMimetype(mimetype);
|
||||||
bool isGbaRom = GbaRomByExtension(filename) || GbaRomByMimetype(mimetype);
|
bool isGbaRom = GbaRomByExtension(filename) || GbaRomByMimetype(mimetype);
|
||||||
#ifdef ZSTD_ENABLED
|
|
||||||
isNdsRom |= ZstdNdsRomByExtension(filename);
|
isNdsRom |= ZstdNdsRomByExtension(filename);
|
||||||
isGbaRom |= ZstdGbaRomByExtension(filename);
|
isGbaRom |= ZstdGbaRomByExtension(filename);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (isNdsRom)
|
if (isNdsRom)
|
||||||
{
|
{
|
||||||
|
@ -2480,11 +2475,10 @@ QStringList MainWindow::pickROM(bool gba)
|
||||||
QString extraFilters = ";;" + console + " ROMs (*" + rawROMs;
|
QString extraFilters = ";;" + console + " ROMs (*" + rawROMs;
|
||||||
QString allROMs = rawROMs;
|
QString allROMs = rawROMs;
|
||||||
|
|
||||||
#ifdef ZSTD_ENABLED
|
|
||||||
QString zstdROMs = "*" + romexts.join(".zst *") + ".zst";
|
QString zstdROMs = "*" + romexts.join(".zst *") + ".zst";
|
||||||
extraFilters += ");;Zstandard-compressed " + console + " ROMs (" + zstdROMs + ")";
|
extraFilters += ");;Zstandard-compressed " + console + " ROMs (" + zstdROMs + ")";
|
||||||
allROMs += " " + zstdROMs;
|
allROMs += " " + zstdROMs;
|
||||||
#endif
|
|
||||||
#ifdef ARCHIVE_SUPPORT_ENABLED
|
#ifdef ARCHIVE_SUPPORT_ENABLED
|
||||||
QString archives = "*" + ArchiveExtensions.join(" *");
|
QString archives = "*" + ArchiveExtensions.join(" *");
|
||||||
extraFilters += ";;Archives (" + archives + ")";
|
extraFilters += ";;Archives (" + archives + ")";
|
||||||
|
|
Loading…
Reference in New Issue