mirror of
https://github.com/libretro/pcsx2.git
synced 2024-11-23 09:19:42 +00:00
Qt: Fix building on Linux
This commit is contained in:
parent
7f8bfb22de
commit
fbd36a4347
@ -42,7 +42,11 @@ add_subdirectory(pcsx2)
|
||||
|
||||
if (QT_BUILD)
|
||||
add_subdirectory(pcsx2-qt)
|
||||
add_subdirectory(updater)
|
||||
|
||||
# Updater is Windows only for now.
|
||||
if (WIN32)
|
||||
add_subdirectory(updater)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# tests
|
||||
|
@ -14,6 +14,9 @@ target_sources(pcsx2-qt PRIVATE
|
||||
AboutDialog.cpp
|
||||
AboutDialog.h
|
||||
AboutDialog.ui
|
||||
AutoUpdaterDialog.cpp
|
||||
AutoUpdaterDialog.h
|
||||
AutoUpdaterDialog.ui
|
||||
DisplayWidget.cpp
|
||||
DisplayWidget.h
|
||||
EmuThread.cpp
|
||||
@ -118,3 +121,11 @@ target_link_libraries(pcsx2-qt PRIVATE
|
||||
Qt6::Widgets
|
||||
Qt6::Network
|
||||
)
|
||||
|
||||
# Currently, 7z is only needed for the Windows updater.
|
||||
if(WIN32)
|
||||
target_link_libraries(pcsx2-qt PRIVATE
|
||||
LZMA::LZMA
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -3,9 +3,12 @@ add_executable(updater
|
||||
Updater.h
|
||||
)
|
||||
|
||||
target_link_libraries(updater PRIVATE common fmt::fmt lzma)
|
||||
target_link_libraries(updater PRIVATE common fmt::fmt)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(updater PRIVATE
|
||||
LZMA::LZMA
|
||||
)
|
||||
target_sources(updater PRIVATE
|
||||
Win32Update.cpp
|
||||
)
|
||||
|
@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
#include "Updater.h"
|
||||
#include "SZErrors.h"
|
||||
|
||||
#include "common/Console.h"
|
||||
#include "common/FileSystem.h"
|
||||
@ -22,9 +21,6 @@
|
||||
#include "common/ScopedGuard.h"
|
||||
#include "common/StringUtil.h"
|
||||
|
||||
#include "7zAlloc.h"
|
||||
#include "7zCrc.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@ -37,8 +33,15 @@
|
||||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "7zAlloc.h"
|
||||
#include "7zCrc.h"
|
||||
#include "SZErrors.h"
|
||||
|
||||
static constexpr size_t kInputBufSize = ((size_t)1 << 18);
|
||||
static constexpr ISzAlloc g_Alloc = {SzAlloc, SzFree};
|
||||
#endif
|
||||
|
||||
static std::FILE* s_file_console_stream;
|
||||
static constexpr IConsoleWriter s_file_console_writer = {
|
||||
@ -81,6 +84,7 @@ Updater::Updater(ProgressCallback* progress)
|
||||
|
||||
Updater::~Updater()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (m_archive_opened)
|
||||
SzArEx_Free(&m_archive, &g_Alloc);
|
||||
|
||||
@ -88,6 +92,7 @@ Updater::~Updater()
|
||||
|
||||
if (m_file_opened)
|
||||
File_Close(&m_archive_stream.file);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Updater::SetupLogging(ProgressCallback* progress, const std::string& destination_directory)
|
||||
@ -116,6 +121,7 @@ bool Updater::Initialize(std::string destination_directory)
|
||||
|
||||
bool Updater::OpenUpdateZip(const char* path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
FileInStream_CreateVTable(&m_archive_stream);
|
||||
LookToRead2_CreateVTable(&m_look_stream, False);
|
||||
CrcGenerateTable();
|
||||
@ -155,6 +161,9 @@ bool Updater::OpenUpdateZip(const char* path)
|
||||
m_archive_opened = true;
|
||||
m_progress->SetStatusText("Parsing update zip...");
|
||||
return ParseZip();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Updater::RecursiveDeleteDirectory(const char* path)
|
||||
@ -171,12 +180,13 @@ bool Updater::RecursiveDeleteDirectory(const char* path)
|
||||
|
||||
return (SHFileOperationW(&op) == 0 && !op.fAnyOperationsAborted);
|
||||
#else
|
||||
return FileSystem::DeleteDirectory(path, true);
|
||||
return FileSystem::RecursiveDeleteDirectory(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Updater::ParseZip()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::vector<UInt16> filename_buffer;
|
||||
|
||||
for (u32 file_index = 0; file_index < m_archive.NumFiles; file_index++)
|
||||
@ -250,6 +260,9 @@ bool Updater::ParseZip()
|
||||
m_progress->DisplayFormattedDebugMessage("Directory: %s", dir.c_str());
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Updater::PrepareStagingDirectory()
|
||||
@ -292,6 +305,7 @@ bool Updater::StageUpdate()
|
||||
m_progress->SetProgressRange(static_cast<u32>(m_update_paths.size()));
|
||||
m_progress->SetProgressValue(0);
|
||||
|
||||
#ifdef _WIN32
|
||||
UInt32 block_index = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
|
||||
Byte* out_buffer = 0; /* it must be 0 before first call for each new archive. */
|
||||
size_t out_buffer_size = 0; /* it can have any value before first call (if outBuffer = 0) */
|
||||
@ -339,6 +353,9 @@ bool Updater::StageUpdate()
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Updater::CommitUpdate()
|
||||
|
@ -17,8 +17,10 @@
|
||||
|
||||
#include "common/ProgressCallback.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "7z.h"
|
||||
#include "7zFile.h"
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -57,10 +59,13 @@ private:
|
||||
std::vector<std::string> m_update_directories;
|
||||
|
||||
ProgressCallback* m_progress;
|
||||
|
||||
#ifdef _WIN32
|
||||
CFileInStream m_archive_stream = {};
|
||||
CLookToRead2 m_look_stream = {};
|
||||
CSzArEx m_archive = {};
|
||||
|
||||
bool m_file_opened = false;
|
||||
bool m_archive_opened = false;
|
||||
#endif
|
||||
};
|
||||
|
@ -15,8 +15,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SZErrors.h"
|
||||
|
||||
#include "common/FileSystem.h"
|
||||
#include "common/ScopedGuard.h"
|
||||
#include "common/StringUtil.h"
|
||||
@ -28,6 +26,7 @@
|
||||
#include "7zAlloc.h"
|
||||
#include "7zCrc.h"
|
||||
#include "7zFile.h"
|
||||
#include "SZErrors.h"
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
|
Loading…
Reference in New Issue
Block a user