2020-12-05 13:08:24 +01:00
|
|
|
#include "stdafx.h"
|
2020-01-03 12:04:18 +01:00
|
|
|
#include "shader_loading_dialog.h"
|
2020-02-15 23:36:20 +01:00
|
|
|
#include "Emu/System.h"
|
2025-04-08 18:46:57 +02:00
|
|
|
#include "rpcsx/fw/ps3/cellMsgDialog.h"
|
2020-01-03 12:04:18 +01:00
|
|
|
|
2025-10-05 18:28:03 +02:00
|
|
|
#include "rx/asm.hpp"
|
2020-12-21 15:12:05 +01:00
|
|
|
|
2020-01-03 12:04:18 +01:00
|
|
|
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
|
2021-10-31 03:13:37 +01:00
|
|
|
dlg->on_close = [](s32 /*status*/)
|
|
|
|
|
{
|
2022-01-20 18:44:49 +01:00
|
|
|
Emu.CallFromMainThread([]()
|
2025-04-05 21:50:45 +02:00
|
|
|
{
|
|
|
|
|
rsx_log.notice("Aborted shader loading dialog");
|
|
|
|
|
Emu.Kill(false);
|
|
|
|
|
});
|
2021-10-31 03:13:37 +01:00
|
|
|
};
|
2020-01-03 12:04:18 +01:00
|
|
|
|
|
|
|
|
ref_cnt++;
|
|
|
|
|
|
2022-01-20 18:44:49 +01:00
|
|
|
Emu.CallFromMainThread([&]()
|
2025-04-05 21:50:45 +02:00
|
|
|
{
|
|
|
|
|
dlg->Create(msg, title);
|
|
|
|
|
ref_cnt--;
|
|
|
|
|
});
|
2020-01-03 12:04:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (ref_cnt.load() && !Emu.IsStopped())
|
|
|
|
|
{
|
2025-10-05 18:28:03 +02:00
|
|
|
rx::pause();
|
2020-01-03 12:04:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-22 23:31:08 +02:00
|
|
|
void shader_loading_dialog::update_msg(u32 index, std::string msg)
|
2020-01-03 12:04:18 +01:00
|
|
|
{
|
|
|
|
|
if (!dlg)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ref_cnt++;
|
|
|
|
|
|
2023-08-22 23:31:08 +02:00
|
|
|
Emu.CallFromMainThread([&, index, message = std::move(msg)]()
|
2025-04-05 21:50:45 +02:00
|
|
|
{
|
|
|
|
|
dlg->ProgressBarSetMsg(index, message);
|
|
|
|
|
ref_cnt--;
|
|
|
|
|
});
|
2020-01-03 12:04:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void shader_loading_dialog::inc_value(u32 index, u32 value)
|
|
|
|
|
{
|
|
|
|
|
if (!dlg)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ref_cnt++;
|
|
|
|
|
|
2022-01-20 18:44:49 +01:00
|
|
|
Emu.CallFromMainThread([&, index, value]()
|
2025-04-05 21:50:45 +02:00
|
|
|
{
|
|
|
|
|
dlg->ProgressBarInc(index, value);
|
|
|
|
|
ref_cnt--;
|
|
|
|
|
});
|
2020-01-03 12:04:18 +01:00
|
|
|
}
|
|
|
|
|
|
2021-01-31 04:06:00 +01:00
|
|
|
void shader_loading_dialog::set_value(u32 index, u32 value)
|
|
|
|
|
{
|
|
|
|
|
if (!dlg)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ref_cnt++;
|
|
|
|
|
|
2022-01-20 18:44:49 +01:00
|
|
|
Emu.CallFromMainThread([&, index, value]()
|
2025-04-05 21:50:45 +02:00
|
|
|
{
|
|
|
|
|
dlg->ProgressBarSetValue(index, value);
|
|
|
|
|
ref_cnt--;
|
|
|
|
|
});
|
2021-01-31 04:06:00 +01:00
|
|
|
}
|
|
|
|
|
|
2020-01-03 12:04:18 +01:00
|
|
|
void shader_loading_dialog::set_limit(u32 index, u32 limit)
|
|
|
|
|
{
|
|
|
|
|
if (!dlg)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ref_cnt++;
|
|
|
|
|
|
2022-01-20 18:44:49 +01:00
|
|
|
Emu.CallFromMainThread([&, index, limit]()
|
2025-04-05 21:50:45 +02:00
|
|
|
{
|
|
|
|
|
dlg->ProgressBarSetLimit(index, limit);
|
|
|
|
|
ref_cnt--;
|
|
|
|
|
});
|
2020-01-03 12:04:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void shader_loading_dialog::refresh()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void shader_loading_dialog::close()
|
|
|
|
|
{
|
|
|
|
|
while (ref_cnt.load() && !Emu.IsStopped())
|
|
|
|
|
{
|
2025-10-05 18:28:03 +02:00
|
|
|
rx::pause();
|
2020-01-03 12:04:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
2025-04-05 21:50:45 +02:00
|
|
|
} // namespace rsx
|