Browse Source
[desktop] feat: install firmware from ZIP (#52)
[desktop] feat: install firmware from ZIP (#52)
Closes #12 Adds a menu option to install firmware from a packed ZIP. This PR additionally lays the groundwork to add data import/export via ZIP. In the future, a qt_common subproject should be added to handle common Qt tasks such as this. Furthermore, to decrease dependency complexity, this also introduces CPM, a wrapper around FetchContent. In theory, this should also lay the groundwork for #8 as well. Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/52pull/58/head
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
8 changed files with 252 additions and 32 deletions
-
80.ci/patch/0001-quazip-strict.patch
-
1.gitignore
-
24CMakeModules/CPM.cmake
-
21src/yuzu/CMakeLists.txt
-
128src/yuzu/main.cpp
-
3src/yuzu/main.h
-
24src/yuzu/main.ui
-
3tools/update-cpm.sh
@ -0,0 +1,80 @@ |
|||||
|
diff --git a/quazip/quazipdir.cpp b/quazip/quazipdir.cpp
|
||||
|
index d43f1c1..eb24bf1 100644
|
||||
|
--- a/quazip/quazipdir.cpp
|
||||
|
+++ b/quazip/quazipdir.cpp
|
||||
|
@@ -293,8 +293,8 @@ bool QuaZipDirComparator::operator()(const QuaZipFileInfo64 &info1,
|
||||
|
} |
||||
|
|
||||
|
template<typename TFileInfoList> |
||||
|
-bool QuaZipDirPrivate::entryInfoList(QStringList nameFilters,
|
||||
|
- QDir::Filters filter, QDir::SortFlags sort, TFileInfoList &result) const
|
||||
|
+bool QuaZipDirPrivate::entryInfoList(QStringList _nameFilters,
|
||||
|
+ QDir::Filters _filter, QDir::SortFlags sort, TFileInfoList &result) const
|
||||
|
{ |
||||
|
QString basePath = simplePath(); |
||||
|
if (!basePath.isEmpty()) |
||||
|
@@ -305,12 +305,12 @@ bool QuaZipDirPrivate::entryInfoList(QStringList nameFilters,
|
||||
|
if (!zip->goToFirstFile()) { |
||||
|
return zip->getZipError() == UNZ_OK; |
||||
|
} |
||||
|
- QDir::Filters fltr = filter;
|
||||
|
+ QDir::Filters fltr = _filter;
|
||||
|
if (fltr == QDir::NoFilter) |
||||
|
fltr = this->filter; |
||||
|
if (fltr == QDir::NoFilter) |
||||
|
fltr = QDir::AllEntries; |
||||
|
- QStringList nmfltr = nameFilters;
|
||||
|
+ QStringList nmfltr = _nameFilters;
|
||||
|
if (nmfltr.isEmpty()) |
||||
|
nmfltr = this->nameFilters; |
||||
|
QSet<QString> dirsFound; |
||||
|
diff --git a/quazip/quazipfile.cpp b/quazip/quazipfile.cpp
|
||||
|
index 4a5f2f9..f7865f5 100644
|
||||
|
--- a/quazip/quazipfile.cpp
|
||||
|
+++ b/quazip/quazipfile.cpp
|
||||
|
@@ -241,14 +241,14 @@ void QuaZipFile::setFileName(const QString& fileName, QuaZip::CaseSensitivity cs
|
||||
|
p->caseSensitivity=cs; |
||||
|
} |
||||
|
|
||||
|
-void QuaZipFilePrivate::setZipError(int zipError) const
|
||||
|
+void QuaZipFilePrivate::setZipError(int _zipError) const
|
||||
|
{ |
||||
|
QuaZipFilePrivate *fakeThis = const_cast<QuaZipFilePrivate*>(this); // non-const |
||||
|
- fakeThis->zipError=zipError;
|
||||
|
- if(zipError==UNZ_OK)
|
||||
|
+ fakeThis->zipError = _zipError;
|
||||
|
+ if(_zipError == UNZ_OK)
|
||||
|
q->setErrorString(QString()); |
||||
|
else |
||||
|
- q->setErrorString(QuaZipFile::tr("ZIP/UNZIP API error %1").arg(zipError));
|
||||
|
+ q->setErrorString(QuaZipFile::tr("ZIP/UNZIP API error %1").arg(_zipError));
|
||||
|
} |
||||
|
|
||||
|
bool QuaZipFile::open(OpenMode mode) |
||||
|
diff --git a/quazip/unzip.c b/quazip/unzip.c
|
||||
|
index a39365d..ee7b487 100644
|
||||
|
--- a/quazip/unzip.c
|
||||
|
+++ b/quazip/unzip.c
|
||||
|
@@ -1054,7 +1054,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||
|
/* ZIP64 extra fields */ |
||||
|
if (headerId == 0x0001) |
||||
|
{ |
||||
|
- uLong uL;
|
||||
|
+ uLong _uL;
|
||||
|
|
||||
|
if(file_info.uncompressed_size == (ZPOS64_T)0xFFFFFFFFu) |
||||
|
{ |
||||
|
@@ -1078,7 +1078,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||
|
if(file_info.disk_num_start == 0xFFFFFFFFu) |
||||
|
{ |
||||
|
/* Disk Start Number */ |
||||
|
- if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
|
||||
|
+ if (unz64local_getLong(&s->z_filefunc, s->filestream, &_uL) != UNZ_OK)
|
||||
|
err=UNZ_ERRNO; |
||||
|
} |
||||
|
|
||||
|
@@ -2151,3 +2151,4 @@ int ZEXPORT unzClearFlags(unzFile file, unsigned flags)
|
||||
|
s->flags &= ~flags; |
||||
|
return UNZ_OK; |
||||
|
} |
||||
|
+
|
||||
@ -0,0 +1,24 @@ |
|||||
|
# SPDX-License-Identifier: MIT |
||||
|
# |
||||
|
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors |
||||
|
|
||||
|
set(CPM_DOWNLOAD_VERSION 0.42.0) |
||||
|
set(CPM_HASH_SUM "2020b4fc42dba44817983e06342e682ecfc3d2f484a581f11cc5731fbe4dce8a") |
||||
|
|
||||
|
if(CPM_SOURCE_CACHE) |
||||
|
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") |
||||
|
elseif(DEFINED ENV{CPM_SOURCE_CACHE}) |
||||
|
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") |
||||
|
else() |
||||
|
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") |
||||
|
endif() |
||||
|
|
||||
|
# Expand relative path. This is important if the provided path contains a tilde (~) |
||||
|
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) |
||||
|
|
||||
|
file(DOWNLOAD |
||||
|
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake |
||||
|
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} |
||||
|
) |
||||
|
|
||||
|
include(${CPM_DOWNLOAD_LOCATION}) |
||||
@ -0,0 +1,3 @@ |
|||||
|
#!/bin/sh |
||||
|
|
||||
|
wget -O CMakeModules/CPM.cmake https://github.com/cpm-cmake/CPM.cmake/releases/latest/download/get_cpm.cmake |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue