mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
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:
@@ -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
|
||||
|
||||
+1
-1
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,5 +20,5 @@ class RunRunnable(
|
||||
override val setting: AbstractSetting? = null
|
||||
|
||||
override val isEditable: Boolean
|
||||
get() = worksDuringEmulation || NativeLibrary.IsUninitialized()
|
||||
get() = worksDuringEmulation || !NativeLibrary.IsRunning()
|
||||
}
|
||||
|
||||
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
+2
-2
@@ -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(
|
||||
|
||||
+4
-4
@@ -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();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user