mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-23 09:09:45 +00:00
Linux: Fixed Linux compilation errors/warnings (due to refactoring)
This commit is contained in:
parent
97270f2b2e
commit
1489868a3f
@ -17,7 +17,7 @@ private:
|
||||
|
||||
public:
|
||||
AutomaticRomTest();
|
||||
~AutomaticRomTest();
|
||||
virtual ~AutomaticRomTest();
|
||||
|
||||
void ProcessNotification(ConsoleNotificationType type, void* parameter) override;
|
||||
int32_t Run(string filename);
|
||||
|
@ -150,7 +150,7 @@ bool Console::LoadMatchingRom(string romName, HashInfo hashInfo)
|
||||
if(!match.empty()) {
|
||||
return Initialize(match);
|
||||
}
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
string Console::FindMatchingRom(string romName, HashInfo hashInfo)
|
||||
|
@ -1,6 +1,4 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "MessageManager.h"
|
||||
#include "EmulationSettings.h"
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "IMessageManager.h"
|
||||
#include "INotificationListener.h"
|
||||
#include <unordered_map>
|
||||
#include "../Utilities/SimpleLock.h"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include <algorithm>
|
||||
#include "NotificationManager.h"
|
||||
|
||||
void NotificationManager::RegisterNotificationListener(shared_ptr<INotificationListener> notificationListener)
|
||||
|
@ -60,9 +60,10 @@ bool SaveStateManager::LoadState()
|
||||
void SaveStateManager::SaveState(ostream &stream)
|
||||
{
|
||||
uint32_t emuVersion = EmulationSettings::GetMesenVersion();
|
||||
uint32_t formatVersion = SaveStateManager::FileFormatVersion;
|
||||
stream.write("MST", 3);
|
||||
stream.write((char*)&emuVersion, sizeof(emuVersion));
|
||||
stream.write((char*)&SaveStateManager::FileFormatVersion, sizeof(uint32_t));
|
||||
stream.write((char*)&formatVersion, sizeof(uint32_t));
|
||||
|
||||
MapperInfo mapperInfo = _console->GetMapperInfo();
|
||||
stream.write((char*)&mapperInfo.MapperId, sizeof(uint16_t));
|
||||
|
@ -66,6 +66,10 @@ namespace InteropEmu {
|
||||
{
|
||||
_callback = callback;
|
||||
}
|
||||
|
||||
virtual ~InteropNotificationListener()
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessNotification(ConsoleNotificationType type, void* parameter)
|
||||
{
|
||||
@ -107,7 +111,7 @@ namespace InteropEmu {
|
||||
#ifdef _WIN32
|
||||
_renderer = new Renderer(_console, (HWND)_viewerHandle);
|
||||
#else
|
||||
_renderer = new SdlRenderer(_viewerHandle);
|
||||
_renderer = new SdlRenderer(_console, _viewerHandle);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -115,7 +119,7 @@ namespace InteropEmu {
|
||||
#ifdef _WIN32
|
||||
_soundManager = new SoundManager(_console, (HWND)_windowHandle);
|
||||
#else
|
||||
_soundManager = new SdlSoundManager();
|
||||
_soundManager = new SdlSoundManager(_console);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -123,7 +127,7 @@ namespace InteropEmu {
|
||||
#ifdef _WIN32
|
||||
_keyManager = new WindowsKeyManager(_console, (HWND)_windowHandle);
|
||||
#else
|
||||
_keyManager = new LinuxKeyManager();
|
||||
_keyManager = new LinuxKeyManager(_console);
|
||||
#endif
|
||||
|
||||
KeyManager::RegisterKeyManager(_keyManager);
|
||||
|
@ -227,8 +227,10 @@ static vector<KeyDefinition> _keyDefinitions = {
|
||||
{ "", 246, "XF86WLAN", "" },
|
||||
};
|
||||
|
||||
LinuxKeyManager::LinuxKeyManager()
|
||||
LinuxKeyManager::LinuxKeyManager(shared_ptr<Console> console)
|
||||
{
|
||||
_console = console;
|
||||
|
||||
ResetKeyState();
|
||||
|
||||
vector<string> buttonNames = {
|
||||
@ -378,14 +380,14 @@ void LinuxKeyManager::StartUpdateDeviceThread()
|
||||
}
|
||||
|
||||
if(!indexesToRemove.empty() || !controllersToAdd.empty()) {
|
||||
Console::Pause();
|
||||
_console->Pause();
|
||||
for(int index : indexesToRemove) {
|
||||
_controllers.erase(_controllers.begin()+index);
|
||||
}
|
||||
for(std::shared_ptr<LinuxGameController> controller : controllersToAdd) {
|
||||
_controllers.push_back(controller);
|
||||
}
|
||||
Console::Resume();
|
||||
_console->Resume();
|
||||
}
|
||||
|
||||
_stopSignal.Wait(2000);
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "../Utilities/AutoResetEvent.h"
|
||||
|
||||
class LinuxGameController;
|
||||
class Console;
|
||||
|
||||
struct KeyDefinition {
|
||||
string name;
|
||||
@ -17,6 +18,7 @@ struct KeyDefinition {
|
||||
class LinuxKeyManager : public IKeyManager
|
||||
{
|
||||
private:
|
||||
shared_ptr<Console> _console;
|
||||
std::vector<shared_ptr<LinuxGameController>> _controllers;
|
||||
bool _keyState[0x200];
|
||||
bool _mouseState[0x03];
|
||||
@ -31,7 +33,7 @@ private:
|
||||
void StartUpdateDeviceThread();
|
||||
|
||||
public:
|
||||
LinuxKeyManager();
|
||||
LinuxKeyManager(shared_ptr<Console> console);
|
||||
virtual ~LinuxKeyManager();
|
||||
|
||||
void RefreshState();
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "../Core/VideoDecoder.h"
|
||||
#include "../Core/EmulationSettings.h"
|
||||
|
||||
SdlRenderer::SdlRenderer(void* windowHandle) : _windowHandle(windowHandle)
|
||||
SdlRenderer::SdlRenderer(shared_ptr<Console> console, void* windowHandle) : BaseRenderer(console), _windowHandle(windowHandle)
|
||||
{
|
||||
_frameBuffer = nullptr;
|
||||
SetScreenSize(256,240);
|
||||
@ -14,7 +14,7 @@ SdlRenderer::SdlRenderer(void* windowHandle) : _windowHandle(windowHandle)
|
||||
|
||||
SdlRenderer::~SdlRenderer()
|
||||
{
|
||||
VideoRenderer::GetInstance()->UnregisterRenderingDevice(this);
|
||||
_console->GetVideoRenderer()->UnregisterRenderingDevice(this);
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ void SdlRenderer::Reset()
|
||||
{
|
||||
Cleanup();
|
||||
if(Init()) {
|
||||
VideoRenderer::GetInstance()->RegisterRenderingDevice(this);
|
||||
_console->GetVideoRenderer()->RegisterRenderingDevice(this);
|
||||
} else {
|
||||
Cleanup();
|
||||
}
|
||||
@ -108,7 +108,7 @@ void SdlRenderer::Reset()
|
||||
void SdlRenderer::SetScreenSize(uint32_t width, uint32_t height)
|
||||
{
|
||||
ScreenSize screenSize;
|
||||
VideoDecoder::GetInstance()->GetScreenSize(screenSize, false);
|
||||
_console->GetVideoDecoder()->GetScreenSize(screenSize, false);
|
||||
|
||||
if(_screenHeight != (uint32_t)screenSize.Height || _screenWidth != (uint32_t)screenSize.Width || _nesFrameHeight != height || _nesFrameWidth != width || _resizeFilter != EmulationSettings::GetVideoResizeFilter() || _vsyncEnabled != EmulationSettings::CheckFlag(EmulationFlags::VerticalSync)) {
|
||||
_reinitLock.Acquire();
|
||||
@ -147,9 +147,9 @@ void SdlRenderer::Render()
|
||||
return;
|
||||
}
|
||||
|
||||
bool paused = EmulationSettings::IsPaused() && Console::IsRunning();
|
||||
bool paused = EmulationSettings::IsPaused() && _console->IsRunning();
|
||||
bool disableOverlay = EmulationSettings::CheckFlag(EmulationFlags::HidePauseOverlay);
|
||||
shared_ptr<Debugger> debugger = Console::GetInstance()->GetDebugger(false);
|
||||
shared_ptr<Debugger> debugger = _console->GetDebugger(false);
|
||||
if(debugger && debugger->IsExecutionStopped()) {
|
||||
paused = debugger->IsPauseIconShown();
|
||||
disableOverlay = true;
|
||||
@ -185,7 +185,7 @@ void SdlRenderer::Render()
|
||||
|
||||
if(paused && !EmulationSettings::CheckFlag(EmulationFlags::HidePauseOverlay)) {
|
||||
DrawPauseScreen(disableOverlay);
|
||||
} else if(VideoDecoder::GetInstance()->IsRunning()) {
|
||||
} else if(_console->GetVideoDecoder()->IsRunning()) {
|
||||
DrawCounters();
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ struct SDL_Window
|
||||
};
|
||||
typedef struct SDL_Window SDL_Window;
|
||||
|
||||
class Console;
|
||||
|
||||
class SdlRenderer : public IRenderingDevice, public BaseRenderer
|
||||
{
|
||||
private:
|
||||
@ -59,7 +61,7 @@ private:
|
||||
bool ContainsCharacter(wchar_t character) override;
|
||||
|
||||
public:
|
||||
SdlRenderer(void* windowHandle);
|
||||
SdlRenderer(shared_ptr<Console> console, void* windowHandle);
|
||||
virtual ~SdlRenderer();
|
||||
|
||||
void UpdateFrame(void *frameBuffer, uint32_t width, uint32_t height) override;
|
||||
|
@ -2,11 +2,14 @@
|
||||
#include "../Core/EmulationSettings.h"
|
||||
#include "../Core/MessageManager.h"
|
||||
#include "../Core/SoundMixer.h"
|
||||
#include "../Core/Console.h"
|
||||
|
||||
SdlSoundManager::SdlSoundManager()
|
||||
SdlSoundManager::SdlSoundManager(shared_ptr<Console> console)
|
||||
{
|
||||
_console = console;
|
||||
|
||||
if(InitializeAudio(44100, false)) {
|
||||
SoundMixer::RegisterAudioDevice(this);
|
||||
_console->GetSoundMixer()->RegisterAudioDevice(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,12 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include "../Core/BaseSoundManager.h"
|
||||
|
||||
class Console;
|
||||
|
||||
class SdlSoundManager : public BaseSoundManager
|
||||
{
|
||||
public:
|
||||
SdlSoundManager();
|
||||
SdlSoundManager(shared_ptr<Console> console);
|
||||
~SdlSoundManager();
|
||||
|
||||
void PlayBuffer(int16_t *soundBuffer, uint32_t bufferSize, uint32_t sampleRate, bool isStereo);
|
||||
@ -28,6 +30,7 @@ private:
|
||||
void WriteToBuffer(uint8_t* output, uint32_t len);
|
||||
|
||||
private:
|
||||
shared_ptr<Console> _console;
|
||||
SDL_AudioDeviceID _audioDeviceID;
|
||||
string _deviceName;
|
||||
bool _needReset = false;
|
||||
|
Loading…
Reference in New Issue
Block a user