Revert "Audit uses of IsRunning and GetState"
This reverts commit 72cf2bdb87
.
SYSCONF settings are getting cleared when they shouldn't be. Let's
revert the change until I get proper time to figure out why it's broken.
This commit is contained in:
parent
3dbaf38eae
commit
bc67fc97c3
|
@ -381,15 +381,9 @@ public final class NativeLibrary
|
|||
*/
|
||||
public static native boolean IsRunning();
|
||||
|
||||
/**
|
||||
* Returns true if emulation is running and not paused.
|
||||
*/
|
||||
public static native boolean IsRunningAndUnpaused();
|
||||
public static native boolean IsRunningAndStarted();
|
||||
|
||||
/**
|
||||
* Returns true if emulation is fully shut down.
|
||||
*/
|
||||
public static native boolean IsUninitialized();
|
||||
public static native boolean IsRunningAndUnpaused();
|
||||
|
||||
/**
|
||||
* Writes out the JitBlock Cache log dump
|
||||
|
|
|
@ -36,7 +36,7 @@ class Settings : Closeable {
|
|||
|
||||
if (isGameSpecific) {
|
||||
// Loading game INIs while the core is running will mess with the game INIs loaded by the core
|
||||
check(NativeLibrary.IsUninitialized()) { "Attempted to load game INI while emulating" }
|
||||
check(!NativeLibrary.IsRunning()) { "Attempted to load game INI while emulating" }
|
||||
NativeConfig.loadGameInis(gameId, revision)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,5 +20,5 @@ class RunRunnable(
|
|||
override val setting: AbstractSetting? = null
|
||||
|
||||
override val isEditable: Boolean
|
||||
get() = worksDuringEmulation || NativeLibrary.IsUninitialized()
|
||||
get() = worksDuringEmulation || !NativeLibrary.IsRunning()
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ abstract class SettingsItem {
|
|||
|
||||
open val isEditable: Boolean
|
||||
get() {
|
||||
if (NativeLibrary.IsUninitialized()) return true
|
||||
if (!NativeLibrary.IsRunning()) return true
|
||||
val setting = setting
|
||||
return setting != null && setting.isRuntimeEditable
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class SettingsFragmentPresenter(
|
|||
} else if (
|
||||
menuTag == MenuTag.GRAPHICS
|
||||
&& this.gameId.isNullOrEmpty()
|
||||
&& NativeLibrary.IsUninitialized()
|
||||
&& !NativeLibrary.IsRunning()
|
||||
&& GpuDriverHelper.supportsCustomDriverLoading()
|
||||
) {
|
||||
this.gpuDriver =
|
||||
|
@ -1303,7 +1303,7 @@ class SettingsFragmentPresenter(
|
|||
|
||||
if (
|
||||
this.gpuDriver != null && this.gameId.isNullOrEmpty()
|
||||
&& NativeLibrary.IsUninitialized()
|
||||
&& !NativeLibrary.IsRunning()
|
||||
&& GpuDriverHelper.supportsCustomDriverLoading()
|
||||
) {
|
||||
sl.add(
|
||||
|
|
|
@ -180,11 +180,11 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||
|
||||
private fun run(isActivityRecreated: Boolean) {
|
||||
if (isActivityRecreated) {
|
||||
if (NativeLibrary.IsUninitialized()) {
|
||||
loadPreviousTemporaryState = true
|
||||
} else {
|
||||
if (NativeLibrary.IsRunning()) {
|
||||
loadPreviousTemporaryState = false
|
||||
deleteFile(temporaryStateFilePath)
|
||||
} else {
|
||||
loadPreviousTemporaryState = true
|
||||
}
|
||||
} else {
|
||||
Log.debug("[EmulationFragment] activity resumed or fresh start")
|
||||
|
@ -203,7 +203,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||
|
||||
private fun runWithValidSurface() {
|
||||
runWhenSurfaceIsValid = false
|
||||
if (NativeLibrary.IsUninitialized()) {
|
||||
if (!NativeLibrary.IsRunning()) {
|
||||
NativeLibrary.SetIsBooting()
|
||||
val emulationThread = Thread({
|
||||
if (loadPreviousTemporaryState) {
|
||||
|
|
|
@ -83,7 +83,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex
|
|||
|
||||
fun initTouchPointer() {
|
||||
// Check if we have all the data we need yet
|
||||
val aspectRatioAvailable = NativeLibrary.IsRunning()
|
||||
val aspectRatioAvailable = NativeLibrary.IsRunningAndStarted()
|
||||
if (!aspectRatioAvailable || surfacePosition == null)
|
||||
return
|
||||
|
||||
|
|
|
@ -118,7 +118,8 @@ void Host_Message(HostMessageID id)
|
|||
}
|
||||
else if (id == HostMessageID::WMUserStop)
|
||||
{
|
||||
Core::QueueHostJob(&Core::Stop);
|
||||
if (Core::IsRunning(Core::System::GetInstance()))
|
||||
Core::QueueHostJob(&Core::Stop);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,6 +276,13 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetIsBooting
|
|||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsRunning(JNIEnv*, jclass)
|
||||
{
|
||||
return s_is_booting.IsSet() ||
|
||||
static_cast<jboolean>(Core::IsRunning(Core::System::GetInstance()));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsRunningAndStarted(JNIEnv*,
|
||||
jclass)
|
||||
{
|
||||
return static_cast<jboolean>(Core::IsRunning(Core::System::GetInstance()));
|
||||
}
|
||||
|
@ -285,13 +293,6 @@ Java_org_dolphinemu_dolphinemu_NativeLibrary_IsRunningAndUnpaused(JNIEnv*, jclas
|
|||
return static_cast<jboolean>(Core::GetState(Core::System::GetInstance()) == Core::State::Running);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsUninitialized(JNIEnv*,
|
||||
jclass)
|
||||
{
|
||||
return static_cast<jboolean>(Core::IsUninitialized(Core::System::GetInstance()) &&
|
||||
!s_is_booting.IsSet());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv* env,
|
||||
jclass)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace ConfigLoaders
|
|||
{
|
||||
void SaveToSYSCONF(Config::LayerType layer, std::function<bool(const Config::Location&)> predicate)
|
||||
{
|
||||
if (!Core::IsUninitialized(Core::System::GetInstance()))
|
||||
if (Core::IsRunning(Core::System::GetInstance()))
|
||||
return;
|
||||
|
||||
IOS::HLE::Kernel ios;
|
||||
|
@ -183,7 +183,7 @@ public:
|
|||
private:
|
||||
void LoadFromSYSCONF(Config::Layer* layer)
|
||||
{
|
||||
if (!Core::IsUninitialized(Core::System::GetInstance()))
|
||||
if (Core::IsRunning(Core::System::GetInstance()))
|
||||
return;
|
||||
|
||||
IOS::HLE::Kernel ios;
|
||||
|
|
|
@ -211,11 +211,6 @@ bool IsRunningOrStarting(Core::System& system)
|
|||
return state == State::Running || state == State::Starting;
|
||||
}
|
||||
|
||||
bool IsUninitialized(Core::System& system)
|
||||
{
|
||||
return s_state.load() == State::Uninitialized;
|
||||
}
|
||||
|
||||
bool IsCPUThread()
|
||||
{
|
||||
return tls_is_cpu_thread;
|
||||
|
@ -242,7 +237,7 @@ bool Init(Core::System& system, std::unique_ptr<BootParameters> boot, const Wind
|
|||
{
|
||||
if (s_emu_thread.joinable())
|
||||
{
|
||||
if (!IsUninitialized(system))
|
||||
if (IsRunning(system))
|
||||
{
|
||||
PanicAlertFmtT("Emu Thread already running");
|
||||
return false;
|
||||
|
|
|
@ -134,13 +134,8 @@ void UndeclareAsHostThread();
|
|||
|
||||
std::string StopMessage(bool main_thread, std::string_view message);
|
||||
|
||||
// Returns true when GetState returns Running or Paused.
|
||||
bool IsRunning(Core::System& system);
|
||||
// Returns true when GetState returns Starting, Running or Paused.
|
||||
bool IsRunningOrStarting(Core::System& system);
|
||||
// Returns true when GetState returns Uninitialized.
|
||||
bool IsUninitialized(Core::System& system);
|
||||
|
||||
bool IsCPUThread(); // this tells us whether we are the CPU thread.
|
||||
bool IsGPUThread();
|
||||
bool IsHostThread();
|
||||
|
|
|
@ -159,8 +159,6 @@ void AchievementSettingsWidget::OnControllerInterfaceConfigure()
|
|||
|
||||
void AchievementSettingsWidget::LoadSettings()
|
||||
{
|
||||
Core::System& system = Core::System::GetInstance();
|
||||
|
||||
bool enabled = Config::Get(Config::RA_ENABLED);
|
||||
bool hardcore_enabled = Config::Get(Config::RA_HARDCORE_ENABLED);
|
||||
bool logged_out = Config::Get(Config::RA_API_TOKEN).empty();
|
||||
|
@ -176,15 +174,18 @@ void AchievementSettingsWidget::LoadSettings()
|
|||
SignalBlocking(m_common_password_input)->setVisible(logged_out);
|
||||
SignalBlocking(m_common_password_input)->setEnabled(enabled);
|
||||
SignalBlocking(m_common_login_button)->setVisible(logged_out);
|
||||
SignalBlocking(m_common_login_button)->setEnabled(enabled && Core::IsUninitialized(system));
|
||||
SignalBlocking(m_common_login_button)
|
||||
->setEnabled(enabled && !Core::IsRunning(Core::System::GetInstance()));
|
||||
SignalBlocking(m_common_logout_button)->setVisible(!logged_out);
|
||||
SignalBlocking(m_common_logout_button)->setEnabled(enabled);
|
||||
|
||||
SignalBlocking(m_common_hardcore_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_HARDCORE_ENABLED));
|
||||
auto& system = Core::System::GetInstance();
|
||||
SignalBlocking(m_common_hardcore_enabled_input)
|
||||
->setEnabled(enabled && (hardcore_enabled || (Core::IsUninitialized(system) &&
|
||||
!system.GetMovie().IsPlayingInput())));
|
||||
->setEnabled(enabled &&
|
||||
(hardcore_enabled || (Core::GetState(system) == Core::State::Uninitialized &&
|
||||
!system.GetMovie().IsPlayingInput())));
|
||||
|
||||
SignalBlocking(m_common_unofficial_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_UNOFFICIAL_ENABLED));
|
||||
|
|
|
@ -159,7 +159,8 @@ void CheatSearchFactoryWidget::OnNewSearchClicked()
|
|||
if (m_standard_address_space->isChecked())
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
if (!Core::IsRunning(system))
|
||||
const Core::State core_state = Core::GetState(system);
|
||||
if (core_state != Core::State::Running && core_state != Core::State::Paused)
|
||||
{
|
||||
ModalMessageBox::warning(
|
||||
this, tr("No game running."),
|
||||
|
|
|
@ -104,9 +104,8 @@ void CheatsManager::RefreshCodeTabs(Core::State state, bool force)
|
|||
if (!force && (state == Core::State::Starting || state == Core::State::Stopping))
|
||||
return;
|
||||
|
||||
const auto& game_id = state == Core::State::Running || state == Core::State::Paused ?
|
||||
SConfig::GetInstance().GetGameID() :
|
||||
std::string();
|
||||
const auto& game_id =
|
||||
state != Core::State::Uninitialized ? SConfig::GetInstance().GetGameID() : std::string();
|
||||
const auto& game_tdb_id = SConfig::GetInstance().GetGameTDBID();
|
||||
const u16 revision = SConfig::GetInstance().GetRevision();
|
||||
|
||||
|
|
|
@ -24,9 +24,8 @@ CheatWarningWidget::CheatWarningWidget(const std::string& game_id, bool restart_
|
|||
|
||||
connect(&Settings::Instance(), &Settings::EnableCheatsChanged, this,
|
||||
[this] { Update(Core::IsRunning(Core::System::GetInstance())); });
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
|
||||
Update(state == Core::State::Running || state == Core::State::Paused);
|
||||
});
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
|
||||
[this](Core::State state) { Update(state == Core::State::Running); });
|
||||
|
||||
Update(Core::IsRunning(Core::System::GetInstance()));
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ AdvancedWidget::AdvancedWidget(GraphicsWindow* parent)
|
|||
});
|
||||
|
||||
OnBackendChanged();
|
||||
OnEmulationStateChanged(!Core::IsUninitialized(Core::System::GetInstance()));
|
||||
OnEmulationStateChanged(Core::GetState(Core::System::GetInstance()) !=
|
||||
Core::State::Uninitialized);
|
||||
}
|
||||
|
||||
void AdvancedWidget::CreateWidgets()
|
||||
|
|
|
@ -44,7 +44,8 @@ GeneralWidget::GeneralWidget(GraphicsWindow* parent)
|
|||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
|
||||
OnEmulationStateChanged(state != Core::State::Uninitialized);
|
||||
});
|
||||
OnEmulationStateChanged(!Core::IsUninitialized(Core::System::GetInstance()));
|
||||
OnEmulationStateChanged(Core::GetState(Core::System::GetInstance()) !=
|
||||
Core::State::Uninitialized);
|
||||
}
|
||||
|
||||
void GeneralWidget::CreateWidgets()
|
||||
|
@ -360,8 +361,7 @@ void GeneralWidget::OnBackendChanged(const QString& backend_name)
|
|||
const bool supports_adapters = !adapters.empty();
|
||||
|
||||
m_adapter_combo->setCurrentIndex(g_Config.iAdapter);
|
||||
m_adapter_combo->setEnabled(supports_adapters &&
|
||||
Core::IsUninitialized(Core::System::GetInstance()));
|
||||
m_adapter_combo->setEnabled(supports_adapters && !Core::IsRunning(Core::System::GetInstance()));
|
||||
|
||||
static constexpr char TR_ADAPTER_AVAILABLE_DESCRIPTION[] =
|
||||
QT_TR_NOOP("Selects a hardware adapter to use.<br><br>"
|
||||
|
|
|
@ -791,7 +791,7 @@ bool AssemblerWidget::SaveEditor(AsmEditor* editor)
|
|||
|
||||
void AssemblerWidget::OnEmulationStateChanged(Core::State state)
|
||||
{
|
||||
m_inject->setEnabled(state == Core::State::Running || state == Core::State::Paused);
|
||||
m_inject->setEnabled(state != Core::State::Uninitialized);
|
||||
}
|
||||
|
||||
void AssemblerWidget::OnTabClose(int index)
|
||||
|
|
|
@ -251,7 +251,7 @@ void BreakpointWidget::UpdateButtonsEnabled()
|
|||
if (!isVisible())
|
||||
return;
|
||||
|
||||
const bool is_initialised = Core::IsRunning(m_system);
|
||||
const bool is_initialised = Core::GetState(m_system) != Core::State::Uninitialized;
|
||||
m_new->setEnabled(is_initialised);
|
||||
m_load->setEnabled(is_initialised);
|
||||
m_save->setEnabled(is_initialised);
|
||||
|
|
|
@ -560,7 +560,7 @@ void CodeViewWidget::OnContextMenu()
|
|||
QMenu* menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
const bool running = Core::IsRunning(m_system);
|
||||
const bool running = Core::GetState(m_system) != Core::State::Uninitialized;
|
||||
const bool paused = Core::GetState(m_system) == Core::State::Paused;
|
||||
|
||||
const u32 addr = GetContextAddress();
|
||||
|
|
|
@ -258,7 +258,7 @@ void ThreadWidget::Update()
|
|||
|
||||
auto& system = Core::System::GetInstance();
|
||||
const auto emu_state = Core::GetState(system);
|
||||
if (emu_state == Core::State::Stopping || emu_state == Core::State::Uninitialized)
|
||||
if (emu_state == Core::State::Stopping)
|
||||
{
|
||||
m_thread_table->setRowCount(0);
|
||||
UpdateThreadContext({});
|
||||
|
|
|
@ -195,11 +195,10 @@ void WatchWidget::Update()
|
|||
|
||||
QBrush brush = QPalette().brush(QPalette::Text);
|
||||
|
||||
const bool core_is_running = Core::IsRunning(m_system);
|
||||
if (!core_is_running || !PowerPC::MMU::HostIsRAMAddress(guard, entry.address))
|
||||
if (!Core::IsRunning(m_system) || !PowerPC::MMU::HostIsRAMAddress(guard, entry.address))
|
||||
brush.setColor(Qt::red);
|
||||
|
||||
if (core_is_running)
|
||||
if (Core::IsRunning(m_system))
|
||||
{
|
||||
if (PowerPC::MMU::HostIsRAMAddress(guard, entry.address))
|
||||
{
|
||||
|
|
|
@ -59,14 +59,11 @@ FIFOPlayerWindow::FIFOPlayerWindow(FifoPlayer& fifo_player, FifoRecorder& fifo_r
|
|||
});
|
||||
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
|
||||
if (state != m_emu_state)
|
||||
{
|
||||
if (state == Core::State::Running && m_emu_state != Core::State::Paused)
|
||||
OnEmulationStarted();
|
||||
else if (state == Core::State::Uninitialized)
|
||||
OnEmulationStopped();
|
||||
m_emu_state = state;
|
||||
}
|
||||
if (state == Core::State::Running && m_emu_state != Core::State::Paused)
|
||||
OnEmulationStarted();
|
||||
else if (state == Core::State::Uninitialized)
|
||||
OnEmulationStopped();
|
||||
m_emu_state = state;
|
||||
});
|
||||
|
||||
installEventFilter(this);
|
||||
|
@ -379,11 +376,9 @@ void FIFOPlayerWindow::UpdateLimits()
|
|||
|
||||
void FIFOPlayerWindow::UpdateControls()
|
||||
{
|
||||
Core::System& system = Core::System::GetInstance();
|
||||
const bool core_is_uninitialized = Core::IsUninitialized(system);
|
||||
const bool core_is_running = Core::IsRunning(system);
|
||||
const bool is_recording = m_fifo_recorder.IsRecording();
|
||||
const bool is_playing = m_fifo_player.IsPlaying();
|
||||
bool running = Core::IsRunning(Core::System::GetInstance());
|
||||
bool is_recording = m_fifo_recorder.IsRecording();
|
||||
bool is_playing = m_fifo_player.IsPlaying();
|
||||
|
||||
m_frame_range_from->setEnabled(is_playing);
|
||||
m_frame_range_from_label->setEnabled(is_playing);
|
||||
|
@ -399,10 +394,10 @@ void FIFOPlayerWindow::UpdateControls()
|
|||
m_frame_record_count_label->setEnabled(enable_frame_record_count);
|
||||
m_frame_record_count->setEnabled(enable_frame_record_count);
|
||||
|
||||
m_load->setEnabled(core_is_uninitialized);
|
||||
m_record->setEnabled(core_is_running && !is_playing);
|
||||
m_load->setEnabled(!running);
|
||||
m_record->setEnabled(running && !is_playing);
|
||||
|
||||
m_stop->setVisible(core_is_running && is_recording);
|
||||
m_stop->setVisible(running && is_recording);
|
||||
m_record->setVisible(!m_stop->isVisible());
|
||||
|
||||
m_save->setEnabled(m_fifo_recorder.IsRecordingDone());
|
||||
|
|
|
@ -436,7 +436,7 @@ void GameList::ShowContextMenu(const QPoint&)
|
|||
// system menu, trigger a refresh.
|
||||
Settings::Instance().NANDRefresh();
|
||||
});
|
||||
perform_disc_update->setEnabled(Core::IsUninitialized(system) || !system.IsWii());
|
||||
perform_disc_update->setEnabled(!Core::IsRunning(system) || !system.IsWii());
|
||||
}
|
||||
|
||||
if (!is_mod_descriptor && platform == DiscIO::Platform::WiiWAD)
|
||||
|
@ -449,10 +449,10 @@ void GameList::ShowContextMenu(const QPoint&)
|
|||
|
||||
for (QAction* a : {wad_install_action, wad_uninstall_action})
|
||||
{
|
||||
a->setEnabled(Core::IsUninitialized(system));
|
||||
a->setEnabled(!Core::IsRunning(system));
|
||||
menu->addAction(a);
|
||||
}
|
||||
if (Core::IsUninitialized(system))
|
||||
if (!Core::IsRunning(system))
|
||||
wad_uninstall_action->setEnabled(WiiUtils::IsTitleInstalled(game->GetTitleID()));
|
||||
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, menu,
|
||||
|
@ -473,8 +473,8 @@ void GameList::ShowContextMenu(const QPoint&)
|
|||
QAction* export_wii_save =
|
||||
menu->addAction(tr("Export Wii Save"), this, &GameList::ExportWiiSave);
|
||||
|
||||
open_wii_save_folder->setEnabled(Core::IsUninitialized(system));
|
||||
export_wii_save->setEnabled(Core::IsUninitialized(system));
|
||||
open_wii_save_folder->setEnabled(!Core::IsRunning(system));
|
||||
export_wii_save->setEnabled(!Core::IsRunning(system));
|
||||
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ void GameList::ShowContextMenu(const QPoint&)
|
|||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, menu, [=](Core::State state) {
|
||||
netplay_host->setEnabled(state == Core::State::Uninitialized);
|
||||
});
|
||||
netplay_host->setEnabled(Core::IsUninitialized(system));
|
||||
netplay_host->setEnabled(!Core::IsRunning(system));
|
||||
|
||||
menu->addAction(netplay_host);
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ void HotkeyScheduler::Run()
|
|||
if (IsHotkey(HK_EXIT))
|
||||
emit ExitHotkey();
|
||||
|
||||
if (Core::IsUninitialized(system))
|
||||
if (!Core::IsRunning(system))
|
||||
{
|
||||
// Only check for Play Recording hotkey when no game is running
|
||||
if (IsHotkey(HK_PLAY_RECORDING))
|
||||
|
|
|
@ -905,7 +905,7 @@ void MainWindow::OnStopComplete()
|
|||
|
||||
bool MainWindow::RequestStop()
|
||||
{
|
||||
if (Core::IsUninitialized(Core::System::GetInstance()))
|
||||
if (!Core::IsRunning(Core::System::GetInstance()))
|
||||
{
|
||||
Core::QueueHostJob([this](Core::System&) { OnStopComplete(); }, true);
|
||||
return true;
|
||||
|
@ -1112,7 +1112,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 (!Core::IsUninitialized(Core::System::GetInstance()))
|
||||
if (Core::GetState(Core::System::GetInstance()) != Core::State::Uninitialized)
|
||||
{
|
||||
if (!RequestStop())
|
||||
return;
|
||||
|
@ -1536,7 +1536,7 @@ void MainWindow::NetPlayInit()
|
|||
|
||||
bool MainWindow::NetPlayJoin()
|
||||
{
|
||||
if (!Core::IsUninitialized(Core::System::GetInstance()))
|
||||
if (Core::IsRunning(Core::System::GetInstance()))
|
||||
{
|
||||
ModalMessageBox::critical(nullptr, tr("Error"),
|
||||
tr("Can't start a NetPlay Session while a game is still running!"));
|
||||
|
@ -1603,7 +1603,7 @@ bool MainWindow::NetPlayJoin()
|
|||
|
||||
bool MainWindow::NetPlayHost(const UICommon::GameFile& game)
|
||||
{
|
||||
if (!Core::IsUninitialized(Core::System::GetInstance()))
|
||||
if (Core::IsRunning(Core::System::GetInstance()))
|
||||
{
|
||||
ModalMessageBox::critical(nullptr, tr("Error"),
|
||||
tr("Can't start a NetPlay Session while a game is still running!"));
|
||||
|
@ -1850,7 +1850,7 @@ void MainWindow::OnImportNANDBackup()
|
|||
|
||||
result.wait();
|
||||
|
||||
m_menu_bar->UpdateToolsMenu(Core::State::Uninitialized);
|
||||
m_menu_bar->UpdateToolsMenu(Core::IsRunning(Core::System::GetInstance()));
|
||||
}
|
||||
|
||||
void MainWindow::OnPlayRecording()
|
||||
|
@ -1882,8 +1882,7 @@ void MainWindow::OnStartRecording()
|
|||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& movie = system.GetMovie();
|
||||
if (Core::GetState(system) == Core::State::Starting ||
|
||||
Core::GetState(system) == Core::State::Stopping || movie.IsRecordingInput() ||
|
||||
if (Core::GetState(system) == Core::State::Starting || movie.IsRecordingInput() ||
|
||||
movie.IsPlayingInput())
|
||||
{
|
||||
return;
|
||||
|
@ -1915,7 +1914,7 @@ void MainWindow::OnStartRecording()
|
|||
{
|
||||
emit RecordingStatusChanged(true);
|
||||
|
||||
if (Core::IsUninitialized(system))
|
||||
if (!Core::IsRunning(system))
|
||||
Play();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,11 +138,9 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
|
|||
m_recording_stop->setEnabled(false);
|
||||
m_recording_export->setEnabled(false);
|
||||
}
|
||||
const bool can_start_from_boot = m_game_selected && state == Core::State::Uninitialized;
|
||||
const bool can_start_from_savestate =
|
||||
state == Core::State::Running || state == Core::State::Paused;
|
||||
m_recording_play->setEnabled(can_start_from_boot && !hardcore);
|
||||
m_recording_start->setEnabled((can_start_from_boot || can_start_from_savestate) &&
|
||||
m_recording_play->setEnabled(m_game_selected && !running);
|
||||
m_recording_play->setEnabled(m_game_selected && !running && !hardcore);
|
||||
m_recording_start->setEnabled((m_game_selected || running) &&
|
||||
!Core::System::GetInstance().GetMovie().IsPlayingInput());
|
||||
|
||||
// JIT
|
||||
|
@ -161,7 +159,7 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
|
|||
m_symbols->setEnabled(running);
|
||||
|
||||
UpdateStateSlotMenu();
|
||||
UpdateToolsMenu(state);
|
||||
UpdateToolsMenu(running);
|
||||
|
||||
OnDebugModeToggled(Settings::Instance().IsDebugModeEnabled());
|
||||
}
|
||||
|
@ -302,8 +300,7 @@ void MenuBar::AddToolsMenu()
|
|||
|
||||
m_boot_sysmenu->setEnabled(false);
|
||||
|
||||
connect(&Settings::Instance(), &Settings::NANDRefresh, this,
|
||||
[this] { UpdateToolsMenu(Core::State::Uninitialized); });
|
||||
connect(&Settings::Instance(), &Settings::NANDRefresh, this, [this] { UpdateToolsMenu(false); });
|
||||
|
||||
m_perform_online_update_menu = tools_menu->addMenu(tr("Perform Online System Update"));
|
||||
m_perform_online_update_for_current_region = m_perform_online_update_menu->addAction(
|
||||
|
@ -1053,23 +1050,20 @@ void MenuBar::AddSymbolsMenu()
|
|||
m_symbols->addAction(tr("&Patch HLE Functions"), this, &MenuBar::PatchHLEFunctions);
|
||||
}
|
||||
|
||||
void MenuBar::UpdateToolsMenu(Core::State state)
|
||||
void MenuBar::UpdateToolsMenu(bool emulation_started)
|
||||
{
|
||||
const bool is_uninitialized = state == Core::State::Uninitialized;
|
||||
const bool is_running = state == Core::State::Running || state == Core::State::Paused;
|
||||
m_boot_sysmenu->setEnabled(!emulation_started);
|
||||
m_perform_online_update_menu->setEnabled(!emulation_started);
|
||||
m_ntscj_ipl->setEnabled(!emulation_started && File::Exists(Config::GetBootROMPath(JAP_DIR)));
|
||||
m_ntscu_ipl->setEnabled(!emulation_started && File::Exists(Config::GetBootROMPath(USA_DIR)));
|
||||
m_pal_ipl->setEnabled(!emulation_started && File::Exists(Config::GetBootROMPath(EUR_DIR)));
|
||||
m_wad_install_action->setEnabled(!emulation_started);
|
||||
m_import_backup->setEnabled(!emulation_started);
|
||||
m_check_nand->setEnabled(!emulation_started);
|
||||
m_import_wii_save->setEnabled(!emulation_started);
|
||||
m_export_wii_saves->setEnabled(!emulation_started);
|
||||
|
||||
m_boot_sysmenu->setEnabled(is_uninitialized);
|
||||
m_perform_online_update_menu->setEnabled(is_uninitialized);
|
||||
m_ntscj_ipl->setEnabled(is_uninitialized && File::Exists(Config::GetBootROMPath(JAP_DIR)));
|
||||
m_ntscu_ipl->setEnabled(is_uninitialized && File::Exists(Config::GetBootROMPath(USA_DIR)));
|
||||
m_pal_ipl->setEnabled(is_uninitialized && File::Exists(Config::GetBootROMPath(EUR_DIR)));
|
||||
m_wad_install_action->setEnabled(is_uninitialized);
|
||||
m_import_backup->setEnabled(is_uninitialized);
|
||||
m_check_nand->setEnabled(is_uninitialized);
|
||||
m_import_wii_save->setEnabled(is_uninitialized);
|
||||
m_export_wii_saves->setEnabled(is_uninitialized);
|
||||
|
||||
if (is_uninitialized)
|
||||
if (!emulation_started)
|
||||
{
|
||||
IOS::HLE::Kernel ios;
|
||||
const auto tmd = ios.GetESCore().FindInstalledTMD(Titles::SYSTEM_MENU);
|
||||
|
@ -1092,7 +1086,7 @@ void MenuBar::UpdateToolsMenu(Core::State state)
|
|||
}
|
||||
|
||||
const auto bt = WiiUtils::GetBluetoothEmuDevice();
|
||||
const bool enable_wiimotes = is_running && bt != nullptr;
|
||||
const bool enable_wiimotes = emulation_started && bt != nullptr;
|
||||
|
||||
for (std::size_t i = 0; i < m_wii_remotes.size(); i++)
|
||||
{
|
||||
|
@ -1263,20 +1257,16 @@ void MenuBar::OnSelectionChanged(std::shared_ptr<const UICommon::GameFile> game_
|
|||
m_game_selected = !!game_file;
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
const bool can_start_from_boot = m_game_selected && Core::IsUninitialized(system);
|
||||
const bool can_start_from_savestate = Core::IsRunning(system);
|
||||
m_recording_play->setEnabled(can_start_from_boot);
|
||||
m_recording_start->setEnabled((can_start_from_boot || can_start_from_savestate) &&
|
||||
const bool core_is_running = Core::IsRunning(system);
|
||||
m_recording_play->setEnabled(m_game_selected && !core_is_running);
|
||||
m_recording_start->setEnabled((m_game_selected || core_is_running) &&
|
||||
!system.GetMovie().IsPlayingInput());
|
||||
}
|
||||
|
||||
void MenuBar::OnRecordingStatusChanged(bool recording)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
const bool can_start_from_boot = m_game_selected && Core::IsUninitialized(system);
|
||||
const bool can_start_from_savestate = Core::IsRunning(system);
|
||||
|
||||
m_recording_start->setEnabled(!recording && (can_start_from_boot || can_start_from_savestate));
|
||||
m_recording_start->setEnabled(!recording && (m_game_selected || Core::IsRunning(system)));
|
||||
m_recording_stop->setEnabled(recording);
|
||||
m_recording_export->setEnabled(recording);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
explicit MenuBar(QWidget* parent = nullptr);
|
||||
|
||||
void UpdateToolsMenu(Core::State state);
|
||||
void UpdateToolsMenu(bool emulation_started);
|
||||
|
||||
QMenu* GetListColumnsMenu() const { return m_cols_menu; }
|
||||
|
||||
|
|
|
@ -804,11 +804,9 @@ void NetPlayDialog::DisplayMessage(const QString& msg, const std::string& color,
|
|||
QColor c(color.empty() ? QStringLiteral("white") : QString::fromStdString(color));
|
||||
|
||||
if (g_ActiveConfig.bShowNetPlayMessages && Core::IsRunning(Core::System::GetInstance()))
|
||||
{
|
||||
g_netplay_chat_ui->AppendChat(msg.toStdString(),
|
||||
{static_cast<float>(c.redF()), static_cast<float>(c.greenF()),
|
||||
static_cast<float>(c.blueF())});
|
||||
}
|
||||
}
|
||||
|
||||
void NetPlayDialog::AppendChat(const std::string& msg)
|
||||
|
|
|
@ -239,7 +239,7 @@ void AdvancedPane::ConnectLayout()
|
|||
|
||||
void AdvancedPane::Update()
|
||||
{
|
||||
const bool running = !Core::IsUninitialized(Core::System::GetInstance());
|
||||
const bool running = Core::GetState(Core::System::GetInstance()) != Core::State::Uninitialized;
|
||||
const bool enable_cpu_clock_override_widgets = Config::Get(Config::MAIN_OVERCLOCK_ENABLE);
|
||||
const bool enable_ram_override_widgets = Config::Get(Config::MAIN_RAM_OVERRIDE_ENABLE);
|
||||
const bool enable_custom_rtc_widgets = Config::Get(Config::MAIN_CUSTOM_RTC_ENABLE) && !running;
|
||||
|
|
|
@ -40,7 +40,8 @@ AudioPane::AudioPane()
|
|||
OnEmulationStateChanged(state != Core::State::Uninitialized);
|
||||
});
|
||||
|
||||
OnEmulationStateChanged(!Core::IsUninitialized(Core::System::GetInstance()));
|
||||
OnEmulationStateChanged(Core::GetState(Core::System::GetInstance()) !=
|
||||
Core::State::Uninitialized);
|
||||
}
|
||||
|
||||
void AudioPane::CreateWidgets()
|
||||
|
|
|
@ -93,7 +93,8 @@ WiiPane::WiiPane(QWidget* parent) : QWidget(parent)
|
|||
LoadConfig();
|
||||
ConnectLayout();
|
||||
ValidateSelectionState();
|
||||
OnEmulationStateChanged(!Core::IsUninitialized(Core::System::GetInstance()));
|
||||
OnEmulationStateChanged(Core::GetState(Core::System::GetInstance()) !=
|
||||
Core::State::Uninitialized);
|
||||
}
|
||||
|
||||
void WiiPane::CreateLayout()
|
||||
|
|
Loading…
Reference in New Issue