mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
Improve logging during RPCS3 updates
This commit is contained in:
parent
df9275819e
commit
d0a13c1a5a
@ -63,6 +63,8 @@ update_manager::update_manager(QObject* parent, std::shared_ptr<gui_settings> gu
|
|||||||
|
|
||||||
void update_manager::check_for_updates(bool automatic, bool check_only, bool auto_accept, QWidget* parent)
|
void update_manager::check_for_updates(bool automatic, bool check_only, bool auto_accept, QWidget* parent)
|
||||||
{
|
{
|
||||||
|
update_log.notice("Checking for updates: automatic=%d, check_only=%d, auto_accept=%d", automatic, check_only, auto_accept);
|
||||||
|
|
||||||
m_update_message.clear();
|
m_update_message.clear();
|
||||||
m_changelog.clear();
|
m_changelog.clear();
|
||||||
|
|
||||||
@ -70,11 +72,17 @@ void update_manager::check_for_updates(bool automatic, bool check_only, bool aut
|
|||||||
{
|
{
|
||||||
// Don't check for updates on local builds
|
// Don't check for updates on local builds
|
||||||
if (rpcs3::is_local_build())
|
if (rpcs3::is_local_build())
|
||||||
|
{
|
||||||
|
update_log.notice("Skipped automatic update check: this is a local build");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
// Don't check for updates on startup if RPCS3 is not running from an AppImage.
|
// Don't check for updates on startup if RPCS3 is not running from an AppImage.
|
||||||
if (!::getenv("APPIMAGE"))
|
if (!::getenv("APPIMAGE"))
|
||||||
|
{
|
||||||
|
update_log.notice("Skipped automatic update check: this is not an AppImage");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +140,8 @@ void update_manager::check_for_updates(bool automatic, bool check_only, bool aut
|
|||||||
|
|
||||||
bool update_manager::handle_json(bool automatic, bool check_only, bool auto_accept, const QByteArray& data)
|
bool update_manager::handle_json(bool automatic, bool check_only, bool auto_accept, const QByteArray& data)
|
||||||
{
|
{
|
||||||
|
update_log.notice("Download of update info finished. automatic=%d, check_only=%d, auto_accept=%d", automatic, check_only, auto_accept);
|
||||||
|
|
||||||
const QJsonObject json_data = QJsonDocument::fromJson(data).object();
|
const QJsonObject json_data = QJsonDocument::fromJson(data).object();
|
||||||
const int return_code = json_data["return_code"].toInt(-255);
|
const int return_code = json_data["return_code"].toInt(-255);
|
||||||
|
|
||||||
@ -325,6 +335,7 @@ bool update_manager::handle_json(bool automatic, bool check_only, bool auto_acce
|
|||||||
|
|
||||||
if (check_only)
|
if (check_only)
|
||||||
{
|
{
|
||||||
|
update_log.notice("Update postponed. Check only is active");
|
||||||
m_downloader->close_progress_dialog();
|
m_downloader->close_progress_dialog();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -335,6 +346,8 @@ bool update_manager::handle_json(bool automatic, bool check_only, bool auto_acce
|
|||||||
|
|
||||||
void update_manager::update(bool auto_accept)
|
void update_manager::update(bool auto_accept)
|
||||||
{
|
{
|
||||||
|
update_log.notice("Updating with auto_accept=%d", auto_accept);
|
||||||
|
|
||||||
ensure(m_downloader);
|
ensure(m_downloader);
|
||||||
|
|
||||||
if (!auto_accept)
|
if (!auto_accept)
|
||||||
@ -342,6 +355,7 @@ void update_manager::update(bool auto_accept)
|
|||||||
if (m_update_message.isEmpty())
|
if (m_update_message.isEmpty())
|
||||||
{
|
{
|
||||||
// This can happen if we abort the check_for_updates download. Just check again in this case.
|
// This can happen if we abort the check_for_updates download. Just check again in this case.
|
||||||
|
update_log.notice("Aborting update: Update message is empty. Trying again...");
|
||||||
m_downloader->close_progress_dialog();
|
m_downloader->close_progress_dialog();
|
||||||
check_for_updates(false, false, false, m_parent);
|
check_for_updates(false, false, false, m_parent);
|
||||||
return;
|
return;
|
||||||
@ -378,8 +392,11 @@ void update_manager::update(bool auto_accept)
|
|||||||
mb.setText(m_update_message);
|
mb.setText(m_update_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_log.notice("Asking user for permission to update...");
|
||||||
|
|
||||||
if (mb.exec() == QMessageBox::No)
|
if (mb.exec() == QMessageBox::No)
|
||||||
{
|
{
|
||||||
|
update_log.notice("Aborting update: User declined update");
|
||||||
m_downloader->close_progress_dialog();
|
m_downloader->close_progress_dialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -387,6 +404,7 @@ void update_manager::update(bool auto_accept)
|
|||||||
|
|
||||||
if (!Emu.IsStopped())
|
if (!Emu.IsStopped())
|
||||||
{
|
{
|
||||||
|
update_log.notice("Aborting update: Emulation is running...");
|
||||||
m_downloader->close_progress_dialog();
|
m_downloader->close_progress_dialog();
|
||||||
QMessageBox::warning(m_parent, tr("Auto-updater"), tr("Please stop the emulation before trying to update."));
|
QMessageBox::warning(m_parent, tr("Auto-updater"), tr("Please stop the emulation before trying to update."));
|
||||||
return;
|
return;
|
||||||
@ -414,11 +432,14 @@ void update_manager::update(bool auto_accept)
|
|||||||
Q_EMIT signal_update_available(false);
|
Q_EMIT signal_update_available(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
update_log.notice("Downloading update...");
|
||||||
m_downloader->start(m_request_url, true, true, tr("Downloading Update"), true, m_expected_size);
|
m_downloader->start(m_request_url, true, true, tr("Downloading Update"), true, m_expected_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
|
bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
|
||||||
{
|
{
|
||||||
|
update_log.notice("Download of update file finished. Updating rpcs3 with auto_accept=%d", auto_accept);
|
||||||
|
|
||||||
m_downloader->update_progress_dialog(tr("Updating RPCS3"));
|
m_downloader->update_progress_dialog(tr("Updating RPCS3"));
|
||||||
|
|
||||||
if (m_expected_size != static_cast<u64>(data.size()))
|
if (m_expected_size != static_cast<u64>(data.size()))
|
||||||
@ -446,6 +467,8 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
|
|||||||
const std::string tmpfile_path = fs::get_temp_dir() + "rpcs3_update.7z";
|
const std::string tmpfile_path = fs::get_temp_dir() + "rpcs3_update.7z";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
update_log.notice("Writing temporary update file: %s", tmpfile_path);
|
||||||
|
|
||||||
fs::file tmpfile(tmpfile_path, fs::read + fs::write + fs::create + fs::trunc);
|
fs::file tmpfile(tmpfile_path, fs::read + fs::write + fs::create + fs::trunc);
|
||||||
if (!tmpfile)
|
if (!tmpfile)
|
||||||
{
|
{
|
||||||
@ -459,6 +482,8 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
|
|||||||
}
|
}
|
||||||
tmpfile.close();
|
tmpfile.close();
|
||||||
|
|
||||||
|
update_log.notice("Unpacking update file: %s", tmpfile_path);
|
||||||
|
|
||||||
// 7z stuff (most of this stuff is from 7z Util sample and has been reworked to be more stl friendly)
|
// 7z stuff (most of this stuff is from 7z Util sample and has been reworked to be more stl friendly)
|
||||||
|
|
||||||
CFileInStream archiveStream{};
|
CFileInStream archiveStream{};
|
||||||
@ -482,15 +507,16 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
|
|||||||
LookToRead2_CreateVTable(&lookStream, False);
|
LookToRead2_CreateVTable(&lookStream, False);
|
||||||
|
|
||||||
SRes res = SZ_OK;
|
SRes res = SZ_OK;
|
||||||
|
|
||||||
|
lookStream.buf = static_cast<Byte*>(ISzAlloc_Alloc(&allocImp, kInputBufSize));
|
||||||
|
if (!lookStream.buf)
|
||||||
{
|
{
|
||||||
lookStream.buf = static_cast<Byte*>(ISzAlloc_Alloc(&allocImp, kInputBufSize));
|
res = SZ_ERROR_MEM;
|
||||||
if (!lookStream.buf)
|
}
|
||||||
res = SZ_ERROR_MEM;
|
else
|
||||||
else
|
{
|
||||||
{
|
lookStream.bufSize = kInputBufSize;
|
||||||
lookStream.bufSize = kInputBufSize;
|
lookStream.realStream = &archiveStream.vt;
|
||||||
lookStream.realStream = &archiveStream.vt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CrcGenerateTable();
|
CrcGenerateTable();
|
||||||
@ -662,6 +688,8 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
|
|||||||
if (res)
|
if (res)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
update_log.success("Update successful!");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
std::string replace_path = fs::get_executable_path();
|
std::string replace_path = fs::get_executable_path();
|
||||||
@ -724,6 +752,7 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
|
|||||||
Emu.CleanUp();
|
Emu.CleanUp();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
update_log.notice("Relaunching %s with _wexecl", wchar_to_utf8(wchar_orig_path));
|
||||||
const int ret = _wexecl(wchar_orig_path.data(), wchar_orig_path.data(), L"--updating", nullptr);
|
const int ret = _wexecl(wchar_orig_path.data(), wchar_orig_path.data(), L"--updating", nullptr);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
// Execute helper script to replace the app and relaunch
|
// Execute helper script to replace the app and relaunch
|
||||||
@ -733,6 +762,7 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
|
|||||||
const int ret = execl(helper_script.c_str(), helper_script.c_str(), extracted_app.c_str(), orig_path.c_str(), nullptr);
|
const int ret = execl(helper_script.c_str(), helper_script.c_str(), extracted_app.c_str(), orig_path.c_str(), nullptr);
|
||||||
#else
|
#else
|
||||||
// execv is used for compatibility with checkrt
|
// execv is used for compatibility with checkrt
|
||||||
|
update_log.notice("Relaunching %s with execv", replace_path);
|
||||||
const char * const params[3] = { replace_path.c_str(), "--updating", nullptr };
|
const char * const params[3] = { replace_path.c_str(), "--updating", nullptr };
|
||||||
const int ret = execv(replace_path.c_str(), const_cast<char * const *>(¶ms[0]));
|
const int ret = execv(replace_path.c_str(), const_cast<char * const *>(¶ms[0]));
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user