mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-13 10:18:40 +12:00
Implement scoped_progress_dialog
Create Emu/system_progress.hpp Remove atomic g_progr_show
This commit is contained in:
parent
2212a131ef
commit
e9a45a2f45
4 changed files with 60 additions and 48 deletions
32
rpcs3/Emu/system_progress.hpp
Normal file
32
rpcs3/Emu/system_progress.hpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "util/atomic.hpp"
|
||||
|
||||
extern atomic_t<const char*> g_progr;
|
||||
extern atomic_t<u32> g_progr_ftotal;
|
||||
extern atomic_t<u32> g_progr_fdone;
|
||||
extern atomic_t<u32> g_progr_ptotal;
|
||||
extern atomic_t<u32> g_progr_pdone;
|
||||
|
||||
// Initialize progress dialog (can be recursive)
|
||||
class scoped_progress_dialog final
|
||||
{
|
||||
// Saved previous value
|
||||
const char* const m_prev;
|
||||
|
||||
public:
|
||||
scoped_progress_dialog(const char* text)
|
||||
: m_prev(g_progr.exchange(text ? text : ""))
|
||||
{
|
||||
}
|
||||
|
||||
scoped_progress_dialog(const scoped_progress_dialog&) = delete;
|
||||
|
||||
scoped_progress_dialog& operator=(const scoped_progress_dialog&) = delete;
|
||||
|
||||
~scoped_progress_dialog()
|
||||
{
|
||||
g_progr.release(m_prev);
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue