rpcsx/rpcs3/Emu/RSX/Overlays/Shaders/shader_loading_dialog.cpp
Megamouse f258ae795c Add more logging for Emulator Stop events
This should give us more insight into the conditions that cause emulation stops.
This may also help find false issue reports.
2021-10-31 04:12:47 +01:00

119 lines
1.8 KiB
C++

#include "stdafx.h"
#include "shader_loading_dialog.h"
#include "Emu/System.h"
#include "Emu/Cell/Modules/cellMsgDialog.h"
#include "util/asm.hpp"
namespace rsx
{
void shader_loading_dialog::create(const std::string& msg, const std::string& title)
{
dlg = Emu.GetCallbacks().get_msg_dialog();
if (dlg)
{
dlg->type.se_normal = true;
dlg->type.bg_invisible = true;
dlg->type.progress_bar_count = 2;
dlg->ProgressBarSetTaskbarIndex(-1); // -1 to combine all progressbars in the taskbar progress
dlg->on_close = [](s32 /*status*/)
{
Emu.CallAfter([]()
{
rsx_log.notice("Aborted shader loading dialog");
Emu.Stop();
});
};
ref_cnt++;
Emu.CallAfter([&]()
{
dlg->Create(msg, title);
ref_cnt--;
});
}
while (ref_cnt.load() && !Emu.IsStopped())
{
utils::pause();
}
}
void shader_loading_dialog::update_msg(u32 index, const std::string& msg)
{
if (!dlg)
{
return;
}
ref_cnt++;
Emu.CallAfter([&, index, msg]()
{
dlg->ProgressBarSetMsg(index, msg);
ref_cnt--;
});
}
void shader_loading_dialog::inc_value(u32 index, u32 value)
{
if (!dlg)
{
return;
}
ref_cnt++;
Emu.CallAfter([&, index, value]()
{
dlg->ProgressBarInc(index, value);
ref_cnt--;
});
}
void shader_loading_dialog::set_value(u32 index, u32 value)
{
if (!dlg)
{
return;
}
ref_cnt++;
Emu.CallAfter([&, index, value]()
{
dlg->ProgressBarSetValue(index, value);
ref_cnt--;
});
}
void shader_loading_dialog::set_limit(u32 index, u32 limit)
{
if (!dlg)
{
return;
}
ref_cnt++;
Emu.CallAfter([&, index, limit]()
{
dlg->ProgressBarSetLimit(index, limit);
ref_cnt--;
});
}
void shader_loading_dialog::refresh()
{
}
void shader_loading_dialog::close()
{
while (ref_cnt.load() && !Emu.IsStopped())
{
utils::pause();
}
}
}