QT Frontend: Add disk shader loading progress bar

Until we get a on screen display or async shader loading, we should at
least have some measure of progress in the meantime. This is 90% a port
from the loading screen I made for yuzu, but with a slightly different
changed detection for when to display the ETA. Now we keep track of a
rolling estimate for shader load ETA and only display a ETA if its going
to take longer than 10 seconds.
This commit is contained in:
James Rowe 2020-01-21 18:48:07 -07:00
parent c0df8271bf
commit 961a7b59c9
8 changed files with 542 additions and 6 deletions

View file

@ -47,6 +47,7 @@
#include "citra_qt/discord.h"
#include "citra_qt/game_list.h"
#include "citra_qt/hotkeys.h"
#include "citra_qt/loading_screen.h"
#include "citra_qt/main.h"
#include "citra_qt/multiplayer/state.h"
#include "citra_qt/qt_image_interface.h"
@ -222,6 +223,17 @@ void GMainWindow::InitializeWidgets() {
ui.horizontalLayout->addWidget(game_list_placeholder);
game_list_placeholder->setVisible(false);
loading_screen = new LoadingScreen(this);
loading_screen->hide();
ui.horizontalLayout->addWidget(loading_screen);
connect(loading_screen, &LoadingScreen::Hidden, [&] {
loading_screen->Clear();
if (emulation_running) {
render_window->show();
render_window->setFocus();
}
});
multiplayer_state = new MultiplayerState(this, game_list->GetModel(), ui.action_Leave_Room,
ui.action_Show_Room);
multiplayer_state->setVisible(false);
@ -917,6 +929,9 @@ void GMainWindow::BootGame(const QString& filename) {
connect(emu_thread.get(), &EmuThread::DebugModeLeft, waitTreeWidget,
&WaitTreeWidget::OnDebugModeLeft, Qt::BlockingQueuedConnection);
connect(emu_thread.get(), &EmuThread::LoadProgress, loading_screen,
&LoadingScreen::OnLoadProgress, Qt::QueuedConnection);
// Update the GUI
registersWidget->OnDebugModeEntered();
if (ui.action_Single_Window_Mode->isChecked()) {
@ -925,8 +940,12 @@ void GMainWindow::BootGame(const QString& filename) {
}
status_bar_update_timer.start(2000);
// show and hide the render_window to create the context
render_window->show();
render_window->setFocus();
render_window->hide();
loading_screen->Prepare(Core::System::GetInstance().GetAppLoader());
loading_screen->show();
emulation_running = true;
if (ui.action_Fullscreen->isChecked()) {
@ -1003,6 +1022,8 @@ void GMainWindow::ShutdownGame() {
ui.action_Advance_Frame->setEnabled(false);
ui.action_Capture_Screenshot->setEnabled(false);
render_window->hide();
loading_screen->hide();
loading_screen->Clear();
if (game_list->isEmpty())
game_list_placeholder->show();
else
@ -1326,6 +1347,10 @@ void GMainWindow::OnStopGame() {
ShutdownGame();
}
void GMainWindow::OnLoadComplete() {
loading_screen->OnLoadComplete();
}
void GMainWindow::OnMenuReportCompatibility() {
if (!Settings::values.citra_token.empty() && !Settings::values.citra_username.empty()) {
CompatDB compatdb{this};