Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Batch Operations and fix some Loader issues #5519

Merged
merged 5 commits into from May 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion rpcs3/Emu/Cell/Modules/cellMsgDialog.h
@@ -1,4 +1,4 @@
#pragma once
#pragma once

#include "Utilities/BitField.h"

Expand Down Expand Up @@ -100,6 +100,7 @@ class MsgDialogBase

virtual ~MsgDialogBase();
virtual void Create(const std::string& msg, const std::string& title = "") = 0;
virtual void Close(bool success) = 0;
virtual void SetMsg(const std::string& msg) = 0;
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) = 0;
virtual void ProgressBarReset(u32 progressBarIndex) = 0;
Expand Down
16 changes: 12 additions & 4 deletions rpcs3/Emu/System.cpp
Expand Up @@ -340,16 +340,14 @@ void Emulator::Init()
{
while (true)
{
std::shared_ptr<MsgDialogBase> dlg;

// Wait for the start condition
while (!g_progr_ftotal && !g_progr_ptotal)
{
std::this_thread::sleep_for(5ms);
}

// Initialize message dialog
dlg = Emu.GetCallbacks().get_msg_dialog();
std::shared_ptr<MsgDialogBase> dlg = Emu.GetCallbacks().get_msg_dialog();
dlg->type.se_normal = true;
dlg->type.bg_invisible = true;
dlg->type.progress_bar_count = 1;
Expand Down Expand Up @@ -384,7 +382,9 @@ void Emulator::Init()
pdone = g_progr_pdone;

// Compute new progress in percents
const u32 new_value = ((ptotal ? pdone * 1. / ptotal : 0.) + fdone) * 100. / (ftotal ? ftotal : 1);
const u32 total = ftotal + ptotal;
const u32 done = fdone + pdone;
const u32 new_value = double(done) * 100. / double(total ? total : 1);

// Compute the difference
const u32 delta = new_value > value ? new_value - value : 0;
Expand Down Expand Up @@ -421,6 +421,11 @@ void Emulator::Init()
g_progr_fdone -= fdone;
g_progr_ptotal -= pdone;
g_progr_pdone -= pdone;

Emu.CallAfter([=]
{
dlg->Close(true);
});
}
});

Expand Down Expand Up @@ -602,6 +607,8 @@ bool Emulator::BootGame(const std::string& path, bool direct, bool add_only, boo
"/USRDIR/ISO.BIN.EDAT",
};

m_path_old = m_path;

if (direct && fs::exists(path))
{
m_path = path;
Expand Down Expand Up @@ -1121,6 +1128,7 @@ void Emulator::Load(bool add_only, bool force_global_config)
if (add_only)
{
LOG_NOTICE(LOADER, "Finished to add data to games.yml by boot for: %s", m_path);
m_path = m_path_old; // Reset m_path to fix boot from gui
return;
}

Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/System.h
Expand Up @@ -214,6 +214,7 @@ class Emulator final
atomic_t<u64> m_pause_amend_time; // increased when resumed

std::string m_path;
std::string m_path_old;
std::string m_title_id;
std::string m_title;
std::string m_cat;
Expand Down