MainWindow: Avoid Global System Accessor
This commit is contained in:
parent
500728360c
commit
12f8b11452
|
@ -249,7 +249,8 @@ int main(int argc, char* argv[])
|
||||||
Settings::Instance().InitDefaultPalette();
|
Settings::Instance().InitDefaultPalette();
|
||||||
Settings::Instance().ApplyStyle();
|
Settings::Instance().ApplyStyle();
|
||||||
|
|
||||||
MainWindow win{std::move(boot), static_cast<const char*>(options.get("movie"))};
|
MainWindow win{Core::System::GetInstance(), std::move(boot),
|
||||||
|
static_cast<const char*>(options.get("movie"))};
|
||||||
|
|
||||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||||
if (!Config::Get(Config::MAIN_ANALYTICS_PERMISSION_ASKED))
|
if (!Config::Get(Config::MAIN_ANALYTICS_PERMISSION_ASKED))
|
||||||
|
|
|
@ -217,9 +217,9 @@ static std::vector<std::string> StringListToStdVector(QStringList list)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters,
|
MainWindow::MainWindow(Core::System& system, std::unique_ptr<BootParameters> boot_parameters,
|
||||||
const std::string& movie_path)
|
const std::string& movie_path)
|
||||||
: QMainWindow(nullptr)
|
: QMainWindow(nullptr), m_system(system)
|
||||||
{
|
{
|
||||||
setWindowTitle(QString::fromStdString(Common::GetScmRevStr()));
|
setWindowTitle(QString::fromStdString(Common::GetScmRevStr()));
|
||||||
setWindowIcon(Resources::GetAppIcon());
|
setWindowIcon(Resources::GetAppIcon());
|
||||||
|
@ -290,7 +290,7 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters,
|
||||||
if (!movie_path.empty())
|
if (!movie_path.empty())
|
||||||
{
|
{
|
||||||
std::optional<std::string> savestate_path;
|
std::optional<std::string> savestate_path;
|
||||||
if (Core::System::GetInstance().GetMovie().PlayInput(movie_path, &savestate_path))
|
if (m_system.GetMovie().PlayInput(movie_path, &savestate_path))
|
||||||
{
|
{
|
||||||
m_pending_boot->boot_session_data.SetSavestateData(std::move(savestate_path),
|
m_pending_boot->boot_session_data.SetSavestateData(std::move(savestate_path),
|
||||||
DeleteSavestateAfterBoot::No);
|
DeleteSavestateAfterBoot::No);
|
||||||
|
@ -463,17 +463,17 @@ void MainWindow::CreateComponents()
|
||||||
m_wii_tas_input_windows[i] = new WiiTASInputWindow(nullptr, i);
|
m_wii_tas_input_windows[i] = new WiiTASInputWindow(nullptr, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_jit_widget = new JITWidget(Core::System::GetInstance(), this);
|
m_jit_widget = new JITWidget(m_system, this);
|
||||||
m_log_widget = new LogWidget(this);
|
m_log_widget = new LogWidget(this);
|
||||||
m_log_config_widget = new LogConfigWidget(this);
|
m_log_config_widget = new LogConfigWidget(this);
|
||||||
m_memory_widget = new MemoryWidget(Core::System::GetInstance(), this);
|
m_memory_widget = new MemoryWidget(m_system, this);
|
||||||
m_network_widget = new NetworkWidget(this);
|
m_network_widget = new NetworkWidget(this);
|
||||||
m_register_widget = new RegisterWidget(this);
|
m_register_widget = new RegisterWidget(this);
|
||||||
m_thread_widget = new ThreadWidget(this);
|
m_thread_widget = new ThreadWidget(this);
|
||||||
m_watch_widget = new WatchWidget(this);
|
m_watch_widget = new WatchWidget(this);
|
||||||
m_breakpoint_widget = new BreakpointWidget(this);
|
m_breakpoint_widget = new BreakpointWidget(this);
|
||||||
m_code_widget = new CodeWidget(this);
|
m_code_widget = new CodeWidget(this);
|
||||||
m_cheats_manager = new CheatsManager(Core::System::GetInstance(), this);
|
m_cheats_manager = new CheatsManager(m_system, this);
|
||||||
m_assembler_widget = new AssemblerWidget(this);
|
m_assembler_widget = new AssemblerWidget(this);
|
||||||
|
|
||||||
const auto request_watch = [this](QString name, u32 addr) {
|
const auto request_watch = [this](QString name, u32 addr) {
|
||||||
|
@ -510,7 +510,7 @@ void MainWindow::CreateComponents()
|
||||||
connect(m_memory_widget, &MemoryWidget::RequestWatch, request_watch);
|
connect(m_memory_widget, &MemoryWidget::RequestWatch, request_watch);
|
||||||
|
|
||||||
connect(m_breakpoint_widget, &BreakpointWidget::ShowCode, [this](u32 address) {
|
connect(m_breakpoint_widget, &BreakpointWidget::ShowCode, [this](u32 address) {
|
||||||
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
|
if (Core::GetState(m_system) == Core::State::Paused)
|
||||||
m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithDetailedUpdate);
|
m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithDetailedUpdate);
|
||||||
});
|
});
|
||||||
connect(m_breakpoint_widget, &BreakpointWidget::ShowMemory, m_memory_widget,
|
connect(m_breakpoint_widget, &BreakpointWidget::ShowMemory, m_memory_widget,
|
||||||
|
@ -651,7 +651,7 @@ void MainWindow::ConnectHotkeys()
|
||||||
connect(m_hotkey_scheduler, &HotkeyScheduler::ConnectWiiRemote, this,
|
connect(m_hotkey_scheduler, &HotkeyScheduler::ConnectWiiRemote, this,
|
||||||
&MainWindow::OnConnectWiiRemote);
|
&MainWindow::OnConnectWiiRemote);
|
||||||
connect(m_hotkey_scheduler, &HotkeyScheduler::ToggleReadOnlyMode, [this] {
|
connect(m_hotkey_scheduler, &HotkeyScheduler::ToggleReadOnlyMode, [this] {
|
||||||
auto& movie = Core::System::GetInstance().GetMovie();
|
auto& movie = m_system.GetMovie();
|
||||||
bool read_only = !movie.IsReadOnly();
|
bool read_only = !movie.IsReadOnly();
|
||||||
movie.SetReadOnly(read_only);
|
movie.SetReadOnly(read_only);
|
||||||
emit ReadOnlyModeChanged(read_only);
|
emit ReadOnlyModeChanged(read_only);
|
||||||
|
@ -806,14 +806,12 @@ void MainWindow::ChangeDisc()
|
||||||
if (paths.empty())
|
if (paths.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& system = Core::System::GetInstance();
|
m_system.GetDVDInterface().ChangeDisc(Core::CPUThreadGuard{m_system}, paths);
|
||||||
system.GetDVDInterface().ChangeDisc(Core::CPUThreadGuard{system}, paths);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::EjectDisc()
|
void MainWindow::EjectDisc()
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
m_system.GetDVDInterface().EjectDisc(Core::CPUThreadGuard{m_system}, DVD::EjectCause::User);
|
||||||
system.GetDVDInterface().EjectDisc(Core::CPUThreadGuard{system}, DVD::EjectCause::User);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OpenUserFolder()
|
void MainWindow::OpenUserFolder()
|
||||||
|
@ -838,9 +836,9 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
|
||||||
// Otherwise, play the default game.
|
// Otherwise, play the default game.
|
||||||
// Otherwise, play the last played game, if there is one.
|
// Otherwise, play the last played game, if there is one.
|
||||||
// Otherwise, prompt for a new game.
|
// Otherwise, prompt for a new game.
|
||||||
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
|
if (Core::GetState(m_system) == Core::State::Paused)
|
||||||
{
|
{
|
||||||
Core::SetState(Core::System::GetInstance(), Core::State::Running);
|
Core::SetState(m_system, Core::State::Running);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -868,12 +866,12 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
|
||||||
|
|
||||||
void MainWindow::Pause()
|
void MainWindow::Pause()
|
||||||
{
|
{
|
||||||
Core::SetState(Core::System::GetInstance(), Core::State::Paused);
|
Core::SetState(m_system, Core::State::Paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::TogglePause()
|
void MainWindow::TogglePause()
|
||||||
{
|
{
|
||||||
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
|
if (Core::GetState(m_system) == Core::State::Paused)
|
||||||
{
|
{
|
||||||
Play();
|
Play();
|
||||||
}
|
}
|
||||||
|
@ -916,7 +914,7 @@ void MainWindow::OnStopComplete()
|
||||||
|
|
||||||
bool MainWindow::RequestStop()
|
bool MainWindow::RequestStop()
|
||||||
{
|
{
|
||||||
if (Core::IsUninitialized(Core::System::GetInstance()))
|
if (Core::IsUninitialized(m_system))
|
||||||
{
|
{
|
||||||
Core::QueueHostJob([this](Core::System&) { OnStopComplete(); }, true);
|
Core::QueueHostJob([this](Core::System&) { OnStopComplete(); }, true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -942,13 +940,13 @@ bool MainWindow::RequestStop()
|
||||||
|
|
||||||
Common::ScopeGuard confirm_lock([this] { m_stop_confirm_showing = false; });
|
Common::ScopeGuard confirm_lock([this] { m_stop_confirm_showing = false; });
|
||||||
|
|
||||||
const Core::State state = Core::GetState(Core::System::GetInstance());
|
const Core::State state = Core::GetState(m_system);
|
||||||
|
|
||||||
// Only pause the game, if NetPlay is not running
|
// Only pause the game, if NetPlay is not running
|
||||||
bool pause = !Settings::Instance().GetNetPlayClient();
|
bool pause = !Settings::Instance().GetNetPlayClient();
|
||||||
|
|
||||||
if (pause)
|
if (pause)
|
||||||
Core::SetState(Core::System::GetInstance(), Core::State::Paused);
|
Core::SetState(m_system, Core::State::Paused);
|
||||||
|
|
||||||
if (rendered_widget_was_active)
|
if (rendered_widget_was_active)
|
||||||
{
|
{
|
||||||
|
@ -978,7 +976,7 @@ bool MainWindow::RequestStop()
|
||||||
m_render_widget->SetWaitingForMessageBox(false);
|
m_render_widget->SetWaitingForMessageBox(false);
|
||||||
|
|
||||||
if (pause)
|
if (pause)
|
||||||
Core::SetState(Core::System::GetInstance(), state);
|
Core::SetState(m_system, state);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -999,8 +997,8 @@ bool MainWindow::RequestStop()
|
||||||
|
|
||||||
// Unpause because gracefully shutting down needs the game to actually request a shutdown.
|
// Unpause because gracefully shutting down needs the game to actually request a shutdown.
|
||||||
// TODO: Do not unpause in debug mode to allow debugging until the complete shutdown.
|
// TODO: Do not unpause in debug mode to allow debugging until the complete shutdown.
|
||||||
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
|
if (Core::GetState(m_system) == Core::State::Paused)
|
||||||
Core::SetState(Core::System::GetInstance(), Core::State::Running);
|
Core::SetState(m_system, Core::State::Running);
|
||||||
|
|
||||||
// Tell NetPlay about the power event
|
// Tell NetPlay about the power event
|
||||||
if (NetPlay::IsNetPlayRunning())
|
if (NetPlay::IsNetPlayRunning())
|
||||||
|
@ -1019,21 +1017,20 @@ bool MainWindow::RequestStop()
|
||||||
|
|
||||||
void MainWindow::ForceStop()
|
void MainWindow::ForceStop()
|
||||||
{
|
{
|
||||||
Core::Stop(Core::System::GetInstance());
|
Core::Stop(m_system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Reset()
|
void MainWindow::Reset()
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
auto& movie = m_system.GetMovie();
|
||||||
auto& movie = system.GetMovie();
|
|
||||||
if (movie.IsRecordingInput())
|
if (movie.IsRecordingInput())
|
||||||
movie.SetReset(true);
|
movie.SetReset(true);
|
||||||
system.GetProcessorInterface().ResetButton_Tap();
|
m_system.GetProcessorInterface().ResetButton_Tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::FrameAdvance()
|
void MainWindow::FrameAdvance()
|
||||||
{
|
{
|
||||||
Core::DoFrameStep(Core::System::GetInstance());
|
Core::DoFrameStep(m_system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::FullScreen()
|
void MainWindow::FullScreen()
|
||||||
|
@ -1124,7 +1121,7 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're running, only start a new game once we've stopped the last.
|
// If we're running, only start a new game once we've stopped the last.
|
||||||
if (!Core::IsUninitialized(Core::System::GetInstance()))
|
if (!Core::IsUninitialized(m_system))
|
||||||
{
|
{
|
||||||
if (!RequestStop())
|
if (!RequestStop())
|
||||||
return;
|
return;
|
||||||
|
@ -1138,7 +1135,7 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
|
||||||
ShowRenderWidget();
|
ShowRenderWidget();
|
||||||
|
|
||||||
// Boot up, show an error if it fails to load the game.
|
// Boot up, show an error if it fails to load the game.
|
||||||
if (!BootManager::BootCore(Core::System::GetInstance(), std::move(parameters),
|
if (!BootManager::BootCore(m_system, std::move(parameters),
|
||||||
::GetWindowSystemInfo(m_render_widget->windowHandle())))
|
::GetWindowSystemInfo(m_render_widget->windowHandle())))
|
||||||
{
|
{
|
||||||
ModalMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok);
|
ModalMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok);
|
||||||
|
@ -1377,8 +1374,7 @@ void MainWindow::ShowFIFOPlayer()
|
||||||
{
|
{
|
||||||
if (!m_fifo_window)
|
if (!m_fifo_window)
|
||||||
{
|
{
|
||||||
m_fifo_window = new FIFOPlayerWindow(Core::System::GetInstance().GetFifoPlayer(),
|
m_fifo_window = new FIFOPlayerWindow(m_system.GetFifoPlayer(), m_system.GetFifoRecorder());
|
||||||
Core::System::GetInstance().GetFifoRecorder());
|
|
||||||
connect(m_fifo_window, &FIFOPlayerWindow::LoadFIFORequested, this,
|
connect(m_fifo_window, &FIFOPlayerWindow::LoadFIFORequested, this,
|
||||||
[this](const QString& path) { StartGame(path, ScanForSecondDisc::No); });
|
[this](const QString& path) { StartGame(path, ScanForSecondDisc::No); });
|
||||||
}
|
}
|
||||||
|
@ -1424,7 +1420,7 @@ void MainWindow::StateLoad()
|
||||||
this, tr("Select a File"), dialog_path, tr("All Save States (*.sav *.s##);; All Files (*)"));
|
this, tr("Select a File"), dialog_path, tr("All Save States (*.sav *.s##);; All Files (*)"));
|
||||||
Config::SetBase(Config::MAIN_CURRENT_STATE_PATH, QFileInfo(path).dir().path().toStdString());
|
Config::SetBase(Config::MAIN_CURRENT_STATE_PATH, QFileInfo(path).dir().path().toStdString());
|
||||||
if (!path.isEmpty())
|
if (!path.isEmpty())
|
||||||
State::LoadAs(Core::System::GetInstance(), path.toStdString());
|
State::LoadAs(m_system, path.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StateSave()
|
void MainWindow::StateSave()
|
||||||
|
@ -1436,47 +1432,47 @@ void MainWindow::StateSave()
|
||||||
this, tr("Select a File"), dialog_path, tr("All Save States (*.sav *.s##);; All Files (*)"));
|
this, tr("Select a File"), dialog_path, tr("All Save States (*.sav *.s##);; All Files (*)"));
|
||||||
Config::SetBase(Config::MAIN_CURRENT_STATE_PATH, QFileInfo(path).dir().path().toStdString());
|
Config::SetBase(Config::MAIN_CURRENT_STATE_PATH, QFileInfo(path).dir().path().toStdString());
|
||||||
if (!path.isEmpty())
|
if (!path.isEmpty())
|
||||||
State::SaveAs(Core::System::GetInstance(), path.toStdString());
|
State::SaveAs(m_system, path.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StateLoadSlot()
|
void MainWindow::StateLoadSlot()
|
||||||
{
|
{
|
||||||
State::Load(Core::System::GetInstance(), m_state_slot);
|
State::Load(m_system, m_state_slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StateSaveSlot()
|
void MainWindow::StateSaveSlot()
|
||||||
{
|
{
|
||||||
State::Save(Core::System::GetInstance(), m_state_slot);
|
State::Save(m_system, m_state_slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StateLoadSlotAt(int slot)
|
void MainWindow::StateLoadSlotAt(int slot)
|
||||||
{
|
{
|
||||||
State::Load(Core::System::GetInstance(), slot);
|
State::Load(m_system, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StateLoadLastSavedAt(int slot)
|
void MainWindow::StateLoadLastSavedAt(int slot)
|
||||||
{
|
{
|
||||||
State::LoadLastSaved(Core::System::GetInstance(), slot);
|
State::LoadLastSaved(m_system, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StateSaveSlotAt(int slot)
|
void MainWindow::StateSaveSlotAt(int slot)
|
||||||
{
|
{
|
||||||
State::Save(Core::System::GetInstance(), slot);
|
State::Save(m_system, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StateLoadUndo()
|
void MainWindow::StateLoadUndo()
|
||||||
{
|
{
|
||||||
State::UndoLoadState(Core::System::GetInstance());
|
State::UndoLoadState(m_system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StateSaveUndo()
|
void MainWindow::StateSaveUndo()
|
||||||
{
|
{
|
||||||
State::UndoSaveState(Core::System::GetInstance());
|
State::UndoSaveState(m_system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StateSaveOldest()
|
void MainWindow::StateSaveOldest()
|
||||||
{
|
{
|
||||||
State::SaveFirstSaved(Core::System::GetInstance());
|
State::SaveFirstSaved(m_system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SetStateSlot(int slot)
|
void MainWindow::SetStateSlot(int slot)
|
||||||
|
@ -1548,7 +1544,7 @@ void MainWindow::NetPlayInit()
|
||||||
|
|
||||||
bool MainWindow::NetPlayJoin()
|
bool MainWindow::NetPlayJoin()
|
||||||
{
|
{
|
||||||
if (!Core::IsUninitialized(Core::System::GetInstance()))
|
if (!Core::IsUninitialized(m_system))
|
||||||
{
|
{
|
||||||
ModalMessageBox::critical(nullptr, tr("Error"),
|
ModalMessageBox::critical(nullptr, tr("Error"),
|
||||||
tr("Can't start a NetPlay Session while a game is still running!"));
|
tr("Can't start a NetPlay Session while a game is still running!"));
|
||||||
|
@ -1615,7 +1611,7 @@ bool MainWindow::NetPlayJoin()
|
||||||
|
|
||||||
bool MainWindow::NetPlayHost(const UICommon::GameFile& game)
|
bool MainWindow::NetPlayHost(const UICommon::GameFile& game)
|
||||||
{
|
{
|
||||||
if (!Core::IsUninitialized(Core::System::GetInstance()))
|
if (!Core::IsUninitialized(m_system))
|
||||||
{
|
{
|
||||||
ModalMessageBox::critical(nullptr, tr("Error"),
|
ModalMessageBox::critical(nullptr, tr("Error"),
|
||||||
tr("Can't start a NetPlay Session while a game is still running!"));
|
tr("Can't start a NetPlay Session while a game is still running!"));
|
||||||
|
@ -1677,7 +1673,7 @@ void MainWindow::NetPlayQuit()
|
||||||
void MainWindow::UpdateScreenSaverInhibition()
|
void MainWindow::UpdateScreenSaverInhibition()
|
||||||
{
|
{
|
||||||
const bool inhibit = Config::Get(Config::MAIN_DISABLE_SCREENSAVER) &&
|
const bool inhibit = Config::Get(Config::MAIN_DISABLE_SCREENSAVER) &&
|
||||||
(Core::GetState(Core::System::GetInstance()) == Core::State::Running);
|
(Core::GetState(m_system) == Core::State::Running);
|
||||||
|
|
||||||
if (inhibit == m_is_screensaver_inhibited)
|
if (inhibit == m_is_screensaver_inhibited)
|
||||||
return;
|
return;
|
||||||
|
@ -1838,7 +1834,7 @@ void MainWindow::OnPlayRecording()
|
||||||
if (dtm_file.isEmpty())
|
if (dtm_file.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& movie = Core::System::GetInstance().GetMovie();
|
auto& movie = m_system.GetMovie();
|
||||||
if (!movie.IsReadOnly())
|
if (!movie.IsReadOnly())
|
||||||
{
|
{
|
||||||
// let's make the read-only flag consistent at the start of a movie.
|
// let's make the read-only flag consistent at the start of a movie.
|
||||||
|
@ -1857,10 +1853,9 @@ void MainWindow::OnPlayRecording()
|
||||||
|
|
||||||
void MainWindow::OnStartRecording()
|
void MainWindow::OnStartRecording()
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
auto& movie = m_system.GetMovie();
|
||||||
auto& movie = system.GetMovie();
|
if (Core::GetState(m_system) == Core::State::Starting ||
|
||||||
if (Core::GetState(system) == Core::State::Starting ||
|
Core::GetState(m_system) == Core::State::Stopping || movie.IsRecordingInput() ||
|
||||||
Core::GetState(system) == Core::State::Stopping || movie.IsRecordingInput() ||
|
|
||||||
movie.IsPlayingInput())
|
movie.IsPlayingInput())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1892,14 +1887,14 @@ void MainWindow::OnStartRecording()
|
||||||
{
|
{
|
||||||
emit RecordingStatusChanged(true);
|
emit RecordingStatusChanged(true);
|
||||||
|
|
||||||
if (Core::IsUninitialized(system))
|
if (Core::IsUninitialized(m_system))
|
||||||
Play();
|
Play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OnStopRecording()
|
void MainWindow::OnStopRecording()
|
||||||
{
|
{
|
||||||
auto& movie = Core::System::GetInstance().GetMovie();
|
auto& movie = m_system.GetMovie();
|
||||||
if (movie.IsRecordingInput())
|
if (movie.IsRecordingInput())
|
||||||
OnExportRecording();
|
OnExportRecording();
|
||||||
if (movie.IsMovieActive())
|
if (movie.IsMovieActive())
|
||||||
|
@ -1909,13 +1904,12 @@ void MainWindow::OnStopRecording()
|
||||||
|
|
||||||
void MainWindow::OnExportRecording()
|
void MainWindow::OnExportRecording()
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
const Core::CPUThreadGuard guard(m_system);
|
||||||
const Core::CPUThreadGuard guard(system);
|
|
||||||
|
|
||||||
QString dtm_file = DolphinFileDialog::getSaveFileName(
|
QString dtm_file = DolphinFileDialog::getSaveFileName(
|
||||||
this, tr("Save Recording File As"), QString(), tr("Dolphin TAS Movies (*.dtm)"));
|
this, tr("Save Recording File As"), QString(), tr("Dolphin TAS Movies (*.dtm)"));
|
||||||
if (!dtm_file.isEmpty())
|
if (!dtm_file.isEmpty())
|
||||||
system.GetMovie().SaveRecording(dtm_file.toStdString());
|
m_system.GetMovie().SaveRecording(dtm_file.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OnActivateChat()
|
void MainWindow::OnActivateChat()
|
||||||
|
@ -1953,11 +1947,10 @@ void MainWindow::ShowTASInput()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& system = Core::System::GetInstance();
|
|
||||||
for (int i = 0; i < num_wii_controllers; i++)
|
for (int i = 0; i < num_wii_controllers; i++)
|
||||||
{
|
{
|
||||||
if (Config::Get(Config::GetInfoForWiimoteSource(i)) == WiimoteSource::Emulated &&
|
if (Config::Get(Config::GetInfoForWiimoteSource(i)) == WiimoteSource::Emulated &&
|
||||||
(!Core::IsRunning(system) || system.IsWii()))
|
(!Core::IsRunning(m_system) || m_system.IsWii()))
|
||||||
{
|
{
|
||||||
SetQWidgetWindowDecorations(m_wii_tas_input_windows[i]);
|
SetQWidgetWindowDecorations(m_wii_tas_input_windows[i]);
|
||||||
m_wii_tas_input_windows[i]->show();
|
m_wii_tas_input_windows[i]->show();
|
||||||
|
@ -1969,7 +1962,7 @@ void MainWindow::ShowTASInput()
|
||||||
|
|
||||||
void MainWindow::OnConnectWiiRemote(int id)
|
void MainWindow::OnConnectWiiRemote(int id)
|
||||||
{
|
{
|
||||||
const Core::CPUThreadGuard guard(Core::System::GetInstance());
|
const Core::CPUThreadGuard guard(m_system);
|
||||||
if (const auto bt = WiiUtils::GetBluetoothEmuDevice())
|
if (const auto bt = WiiUtils::GetBluetoothEmuDevice())
|
||||||
{
|
{
|
||||||
const auto wm = bt->AccessWiimoteByIndex(id);
|
const auto wm = bt->AccessWiimoteByIndex(id);
|
||||||
|
|
|
@ -54,6 +54,11 @@ class WatchWidget;
|
||||||
class WiiTASInputWindow;
|
class WiiTASInputWindow;
|
||||||
struct WindowSystemInfo;
|
struct WindowSystemInfo;
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
enum class Region;
|
enum class Region;
|
||||||
|
@ -74,7 +79,7 @@ class MainWindow final : public QMainWindow
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(std::unique_ptr<BootParameters> boot_parameters,
|
explicit MainWindow(Core::System& system, std::unique_ptr<BootParameters> boot_parameters,
|
||||||
const std::string& movie_path);
|
const std::string& movie_path);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
|
@ -213,6 +218,8 @@ private:
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
|
Core::System& m_system;
|
||||||
|
|
||||||
#ifdef HAVE_XRANDR
|
#ifdef HAVE_XRANDR
|
||||||
std::unique_ptr<X11Utils::XRRConfiguration> m_xrr_config;
|
std::unique_ptr<X11Utils::XRRConfiguration> m_xrr_config;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue