Files
dolphin/Source/Core/Core/Core.h
comex e602eac4f9 Synchronize DVDInterface::ChangeDisc with the CPU thread properly.
This addresses a bit of thread unsafety mentioned in a comment, and
fixes a 'ScheduleEvent_Threadsafe from main thread' message.

To make this work nicely, make PauseAndLock call DeclareAsCPUThread -
i.e. while you have the CPU thread locked, you can consider yourself the
CPU thread.
2015-11-03 12:42:05 +01:00

93 lines
2.4 KiB
C++

// Copyright 2008 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"
namespace Core
{
// TODO: ugly, remove
extern bool g_aspect_wide;
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();
void Shutdown();
void DeclareAsCPUThread();
void UndeclareAsCPUThread();
std::string StopMessage(bool, const 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 SaveScreenShot(const std::string& name);
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(const std::string& val);
void SetBlockStart(u32 addr);
void FrameUpdateOnCPUThread();
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