mirror of
https://github.com/Retropex/dolphin.git
synced 2025-05-17 22:00:43 +02:00

Core::Shutdown was only called on app exit, yet the emu thread exits whenever emulation stops; if you launched a new game it would just join via the destructor when s_emu_thread was set to a new thread. (Incidentally, the destructor also makes explicitly joining on app exit rather pointless.) Because the GUI thread wasn't waiting for the CPU thread to fully shut down, Core::IsRunning would remain true briefly after CFrame::DoStop which, given Dolphin's penchant for accessing variables belonging to other threads, can only mean trouble... In my case, because the previous commit caused UpdateGUI, which is called at the end of DoStop, to call PauseAndLock, which checks IsRunning, pressing stop at the right time would cause strange behavior.
87 lines
2.3 KiB
C++
87 lines
2.3 KiB
C++
// Copyright 2013 Dolphin Emulator Project
|
|
// Licensed under GPLv2
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
// Core
|
|
|
|
// The external interface to the emulator core. Plus some extras.
|
|
// This is another part of the emu that needs cleaning - Core.cpp really has
|
|
// too much random junk inside.
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "Common/CommonTypes.h"
|
|
#include "Core/CoreParameter.h"
|
|
|
|
// TODO: ugly, remove
|
|
extern bool g_aspect_wide;
|
|
|
|
namespace Core
|
|
{
|
|
|
|
extern bool g_want_determinism;
|
|
|
|
bool GetIsFramelimiterTempDisabled();
|
|
void SetIsFramelimiterTempDisabled(bool disable);
|
|
|
|
void Callback_VideoCopiedToXFB(bool video_update);
|
|
|
|
enum EState
|
|
{
|
|
CORE_UNINITIALIZED,
|
|
CORE_PAUSE,
|
|
CORE_RUN,
|
|
CORE_STOPPING
|
|
};
|
|
|
|
bool Init();
|
|
void Stop();
|
|
|
|
std::string StopMessage(bool, std::string);
|
|
|
|
bool IsRunning();
|
|
bool IsRunningAndStarted(); // is running and the CPU loop has been entered
|
|
bool IsRunningInCurrentThread(); // this tells us whether we are running in the CPU thread.
|
|
bool IsCPUThread(); // this tells us whether we are the CPU thread.
|
|
bool IsGPUThread();
|
|
|
|
void SetState(EState _State);
|
|
EState GetState();
|
|
|
|
void SaveScreenShot();
|
|
|
|
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
|
|
|
// This displays messages in a user-visible way.
|
|
void DisplayMessage(const std::string& message, int time_in_ms);
|
|
|
|
std::string GetStateFileName();
|
|
void SetStateFileName(std::string val);
|
|
|
|
void SetBlockStart(u32 addr);
|
|
|
|
bool ShouldSkipFrame(int skipped);
|
|
void VideoThrottle();
|
|
void RequestRefreshInfo();
|
|
|
|
void UpdateTitle();
|
|
|
|
// waits until all systems are paused and fully idle, and acquires a lock on that state.
|
|
// or, if doLock is false, releases a lock on that state and optionally unpauses.
|
|
// calls must be balanced (once with doLock true, then once with doLock false) but may be recursive.
|
|
// the return value of the first call should be passed in as the second argument of the second call.
|
|
bool PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
|
|
|
|
// for calling back into UI code without introducing a dependency on it in core
|
|
typedef void(*StoppedCallbackFunc)(void);
|
|
void SetOnStoppedCallback(StoppedCallbackFunc callback);
|
|
|
|
// Run on the GUI thread when the factors change.
|
|
void UpdateWantDeterminism(bool initial = false);
|
|
|
|
} // namespace
|