pcsx2/updater/Updater.h

67 lines
1.3 KiB
C
Raw Normal View History

// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
// SPDX-License-Identifier: GPL-3.0+
2022-05-12 10:23:01 +00:00
#pragma once
#include "common/ProgressCallback.h"
2022-05-12 16:07:09 +00:00
#ifdef _WIN32
#include "common/RedtapeWindows.h"
2022-05-12 10:23:01 +00:00
#include "7z.h"
#include "7zFile.h"
2022-05-12 16:07:09 +00:00
#endif
2022-05-12 10:23:01 +00:00
#include <string>
#include <vector>
class Updater
{
public:
Updater(ProgressCallback* progress);
~Updater();
static void SetupLogging(ProgressCallback* progress, const std::string& destination_directory);
bool Initialize(std::string destination_directory);
bool OpenUpdateZip(const char* path);
bool PrepareStagingDirectory();
bool StageUpdate();
bool CommitUpdate();
void CleanupStagingDirectory();
void RemoveUpdateZip();
2022-05-12 10:23:01 +00:00
2022-12-04 06:13:00 +00:00
std::string FindPCSX2Exe() const;
2022-05-12 10:23:01 +00:00
private:
bool RecursiveDeleteDirectory(const char* path);
2022-05-12 10:23:01 +00:00
void CloseUpdateZip();
2022-05-12 10:23:01 +00:00
struct FileToUpdate
{
u32 file_index;
std::string destination_filename;
};
bool ParseZip();
std::string m_zip_path;
2022-05-12 10:23:01 +00:00
std::string m_destination_directory;
std::string m_staging_directory;
std::vector<FileToUpdate> m_update_paths;
std::vector<std::string> m_update_directories;
ProgressCallback* m_progress;
2022-05-12 16:07:09 +00:00
#ifdef _WIN32
2022-05-12 10:23:01 +00:00
CFileInStream m_archive_stream = {};
CLookToRead2 m_look_stream = {};
CSzArEx m_archive = {};
bool m_file_opened = false;
bool m_archive_opened = false;
2022-05-12 16:07:09 +00:00
#endif
2022-05-12 10:23:01 +00:00
};