mirror of
https://github.com/SourMesen/Mesen2.git
synced 2024-06-23 14:43:43 -04:00
Linux: Fixed build, fixed some clang warnings
This commit is contained in:
parent
e855d0466e
commit
9d226d6588
|
@ -26,7 +26,9 @@
|
|||
#include "Utilities/FolderUtilities.h"
|
||||
#include "MemoryOperationType.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4702 ) //unreachable code
|
||||
#endif
|
||||
|
||||
#define lua_pushintvalue(name, value) lua_pushliteral(lua, #name); lua_pushinteger(lua, (int)value); lua_settable(lua, -3);
|
||||
#define lua_pushdoublevalue(name, value) lua_pushliteral(lua, #name); lua_pushnumber(lua, (double)value); lua_settable(lua, -3);
|
||||
|
|
|
@ -56,13 +56,13 @@ public:
|
|||
GbEventManager(Debugger* debugger, GbCpu* cpu, GbPpu* ppu);
|
||||
~GbEventManager();
|
||||
|
||||
void AddEvent(DebugEventType type, MemoryOperationInfo& operation, int32_t breakpointId = -1);
|
||||
void AddEvent(DebugEventType type);
|
||||
void AddEvent(DebugEventType type, MemoryOperationInfo& operation, int32_t breakpointId = -1) override;
|
||||
void AddEvent(DebugEventType type) override;
|
||||
|
||||
EventViewerCategoryCfg GetEventConfig(DebugEventInfo& evt);
|
||||
EventViewerCategoryCfg GetEventConfig(DebugEventInfo& evt) override;
|
||||
|
||||
uint32_t TakeEventSnapshot();
|
||||
DebugEventInfo GetEvent(uint16_t y, uint16_t x);
|
||||
uint32_t TakeEventSnapshot() override;
|
||||
DebugEventInfo GetEvent(uint16_t y, uint16_t x) override;
|
||||
|
||||
FrameInfo GetDisplayBufferSize() override;
|
||||
void SetConfiguration(BaseEventViewerConfig& config) override;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
class Debugger;
|
||||
class Emulator;
|
||||
|
||||
class GbPpuTools : public PpuTools
|
||||
class GbPpuTools final : public PpuTools
|
||||
{
|
||||
private:
|
||||
void GetSpriteInfo(DebugSpriteInfo& sprite, uint16_t spriteIndex, GetSpritePreviewOptions& options, GbPpuState& state, uint8_t* vram, uint8_t* oamRam, uint32_t* palette);
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
GbCpu* GetCpu();
|
||||
void GetSoundSamples(int16_t* &samples, uint32_t& sampleCount);
|
||||
GbState GetState();
|
||||
void GetConsoleState(BaseState& state, ConsoleType consoleType);
|
||||
void GetConsoleState(BaseState& state, ConsoleType consoleType) override;
|
||||
GameboyHeader GetHeader();
|
||||
|
||||
uint32_t DebugGetMemorySize(MemoryType type);
|
||||
|
|
|
@ -114,7 +114,7 @@ protected:
|
|||
uint64_t _oamDecayCycles[0x40] = {};
|
||||
bool _corruptOamRow[32] = {};
|
||||
|
||||
__forceinline bool IsRenderingEnabled();
|
||||
bool IsRenderingEnabled();
|
||||
void UpdateGrayscaleAndIntensifyBits();
|
||||
void UpdateColorBitMasks();
|
||||
void UpdateMinimumDrawCycles();
|
||||
|
|
|
@ -8,7 +8,7 @@ class BaseMapper;
|
|||
class NesConsole;
|
||||
struct NesPpuState;
|
||||
|
||||
class NesPpuTools : public PpuTools
|
||||
class NesPpuTools final : public PpuTools
|
||||
{
|
||||
private:
|
||||
BaseMapper* _mapper = nullptr;
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool IsRecording()
|
||||
bool IsRecording() override
|
||||
{
|
||||
return _isRecording;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void WriteRam(uint16_t addr, uint8_t value)
|
||||
void WriteRam(uint16_t addr, uint8_t value) override
|
||||
{
|
||||
value &= 0x01;
|
||||
ControllerHub::WriteRam(addr, value);
|
||||
|
|
|
@ -10,7 +10,7 @@ public:
|
|||
TwoPlayerAdapter(Emulator* emu, ControllerType type, ControllerConfig controllers[]) : ControllerHub(emu, type, 0, controllers)
|
||||
{}
|
||||
|
||||
void WriteRam(uint16_t addr, uint8_t value)
|
||||
void WriteRam(uint16_t addr, uint8_t value) override
|
||||
{
|
||||
value &= 0x01;
|
||||
ControllerHub::WriteRam(addr, value);
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
void Reset(bool softReset) override;
|
||||
|
||||
bool IsKeyboardConnected();
|
||||
bool IsKeyboardConnected() override;
|
||||
|
||||
shared_ptr<BaseControlDevice> CreateControllerDevice(ControllerType type, uint8_t port) override;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void UpdateTimings(ConsoleRegion region, bool overclockAllowed)
|
||||
void UpdateTimings(ConsoleRegion region, bool overclockAllowed) override
|
||||
{
|
||||
NesPpu<NsfPpu>::UpdateTimings(region, false);
|
||||
}
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
#include "Debugger/MemoryAccessCounter.h"
|
||||
#include "Debugger/ExpressionEvaluator.h"
|
||||
#include "Debugger/CodeDataLogger.h"
|
||||
#include "Pce/PceConsole.h"
|
||||
#include "Pce/PceCpu.h"
|
||||
#include "Pce/PceMemoryManager.h"
|
||||
#include "Pce/Debugger/PceDebugger.h"
|
||||
#include "Pce/Debugger/PceTraceLogger.h"
|
||||
#include "Pce/Debugger/PcePpuTools.h"
|
||||
#include "Pce/Debugger/PceDisUtils.h"
|
||||
#include "Pce/Debugger/DummyPceCpu.h"
|
||||
#include "Pce/Debugger/PceEventManager.h"
|
||||
#include "PCE/PceConsole.h"
|
||||
#include "PCE/PceCpu.h"
|
||||
#include "PCE/PceMemoryManager.h"
|
||||
#include "PCE/Debugger/PceDebugger.h"
|
||||
#include "PCE/Debugger/PceTraceLogger.h"
|
||||
#include "PCE/Debugger/PcePpuTools.h"
|
||||
#include "PCE/Debugger/PceDisUtils.h"
|
||||
#include "PCE/Debugger/DummyPceCpu.h"
|
||||
#include "PCE/Debugger/PceEventManager.h"
|
||||
#include "Utilities/HexUtilities.h"
|
||||
#include "Utilities/FolderUtilities.h"
|
||||
#include "Utilities/Patches/IpsPatcher.h"
|
||||
|
|
|
@ -54,14 +54,14 @@ public:
|
|||
PceEventManager(Debugger *debugger, PceConsole *console);
|
||||
~PceEventManager();
|
||||
|
||||
void AddEvent(DebugEventType type, MemoryOperationInfo &operation, int32_t breakpointId = -1);
|
||||
void AddEvent(DebugEventType type);
|
||||
void AddEvent(DebugEventType type, MemoryOperationInfo &operation, int32_t breakpointId = -1) override;
|
||||
void AddEvent(DebugEventType type) override;
|
||||
|
||||
EventViewerCategoryCfg GetEventConfig(DebugEventInfo& evt);
|
||||
EventViewerCategoryCfg GetEventConfig(DebugEventInfo& evt) override;
|
||||
|
||||
uint32_t TakeEventSnapshot();
|
||||
uint32_t TakeEventSnapshot() override;
|
||||
FrameInfo GetDisplayBufferSize() override;
|
||||
DebugEventInfo GetEvent(uint16_t y, uint16_t x);
|
||||
DebugEventInfo GetEvent(uint16_t y, uint16_t x) override;
|
||||
|
||||
void SetConfiguration(BaseEventViewerConfig& config) override;
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ class Emulator;
|
|||
class PceConsole;
|
||||
struct PcePpuState;
|
||||
|
||||
class PcePpuTools : public PpuTools
|
||||
class PcePpuTools final : public PpuTools
|
||||
{
|
||||
private:
|
||||
void GetSpriteInfo(DebugSpriteInfo& sprite, uint16_t spriteIndex, GetSpritePreviewOptions& options, PcePpuState& state, uint8_t* vram, uint8_t* oamRam, uint32_t* palette);
|
||||
|
|
|
@ -257,22 +257,22 @@ private:
|
|||
uint16_t GetOperand();
|
||||
uint8_t GetOperandValue();
|
||||
|
||||
__forceinline void DummyRead();
|
||||
void DummyRead();
|
||||
|
||||
__forceinline uint8_t ReadByte();
|
||||
__forceinline uint16_t ReadWord();
|
||||
uint8_t ReadByte();
|
||||
uint16_t ReadWord();
|
||||
|
||||
void ClearFlags(uint8_t flags);
|
||||
void SetFlags(uint8_t flags);
|
||||
bool CheckFlag(uint8_t flag);
|
||||
void SetZeroNegativeFlags(uint8_t value);
|
||||
|
||||
__forceinline void ProcessCpuCycle();
|
||||
void ProcessCpuCycle();
|
||||
|
||||
void MemoryWrite(uint16_t addr, uint8_t value, MemoryOperationType operationType = MemoryOperationType::Write);
|
||||
|
||||
__forceinline uint8_t MemoryRead(uint16_t addr, MemoryOperationType operationType = MemoryOperationType::Read);
|
||||
__forceinline uint16_t MemoryReadWord(uint16_t addr, MemoryOperationType operationType = MemoryOperationType::Read);
|
||||
uint8_t MemoryRead(uint16_t addr, MemoryOperationType operationType = MemoryOperationType::Read);
|
||||
uint16_t MemoryReadWord(uint16_t addr, MemoryOperationType operationType = MemoryOperationType::Read);
|
||||
|
||||
__forceinline uint16_t GetIndAddr();
|
||||
__forceinline uint8_t GetImmediate();
|
||||
|
|
|
@ -242,7 +242,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
__declspec(noinline) void ExecSlow()
|
||||
__noinline void ExecSlow()
|
||||
{
|
||||
for(int i = 0; i < 4; i++) {
|
||||
ExecFast();
|
||||
|
|
|
@ -127,7 +127,7 @@ private:
|
|||
|
||||
void ProcessVramRead();
|
||||
void ProcessVramWrite();
|
||||
__declspec(noinline) void ProcessVramAccesses();
|
||||
__noinline void ProcessVramAccesses();
|
||||
|
||||
void DrawScanline();
|
||||
void SendFrame();
|
||||
|
@ -135,29 +135,29 @@ private:
|
|||
uint16_t DotsToClocks(int dots);
|
||||
void TriggerHdsIrqs();
|
||||
|
||||
__declspec(noinline) void IncrementRcrCounter();
|
||||
__declspec(noinline) void IncScrollY();
|
||||
__declspec(noinline) void ProcessEndOfScanline();
|
||||
__declspec(noinline) void ProcessEndOfVisibleFrame();
|
||||
__declspec(noinline) void ProcessSatbTransfer();
|
||||
__declspec(noinline) void ProcessVramDmaTransfer();
|
||||
__declspec(noinline) void SetHorizontalMode(PcePpuModeH hMode);
|
||||
__noinline void IncrementRcrCounter();
|
||||
__noinline void IncScrollY();
|
||||
__noinline void ProcessEndOfScanline();
|
||||
__noinline void ProcessEndOfVisibleFrame();
|
||||
__noinline void ProcessSatbTransfer();
|
||||
__noinline void ProcessVramDmaTransfer();
|
||||
__noinline void SetHorizontalMode(PcePpuModeH hMode);
|
||||
|
||||
__declspec(noinline) void ProcessVdcEvents();
|
||||
__declspec(noinline) void ProcessEvent();
|
||||
__noinline void ProcessVdcEvents();
|
||||
__noinline void ProcessEvent();
|
||||
|
||||
__declspec(noinline) void ProcessHorizontalSyncStart();
|
||||
__declspec(noinline) void ProcessVerticalSyncStart();
|
||||
__noinline void ProcessHorizontalSyncStart();
|
||||
__noinline void ProcessVerticalSyncStart();
|
||||
|
||||
__forceinline uint8_t GetTilePixelColor(const uint16_t chrData[2], const uint8_t shift);
|
||||
__forceinline uint8_t GetSpritePixelColor(const uint16_t chrData[4], const uint8_t shift);
|
||||
|
||||
__declspec(noinline) void ProcessSpriteEvaluation();
|
||||
__declspec(noinline) void LoadSpriteTiles();
|
||||
__noinline void ProcessSpriteEvaluation();
|
||||
__noinline void LoadSpriteTiles();
|
||||
|
||||
__declspec(noinline) void LoadBackgroundTiles();
|
||||
__declspec(noinline) void LoadBackgroundTilesWidth2(uint16_t end, uint16_t scrollOffset, uint16_t columnMask, uint16_t row);
|
||||
__declspec(noinline) void LoadBackgroundTilesWidth4(uint16_t end, uint16_t scrollOffset, uint16_t columnMask, uint16_t row);
|
||||
__noinline void LoadBackgroundTiles();
|
||||
__noinline void LoadBackgroundTilesWidth2(uint16_t end, uint16_t scrollOffset, uint16_t columnMask, uint16_t row);
|
||||
__noinline void LoadBackgroundTilesWidth4(uint16_t end, uint16_t scrollOffset, uint16_t columnMask, uint16_t row);
|
||||
|
||||
__forceinline void LoadBatEntry(uint16_t scrollOffset, uint16_t columnMask, uint16_t row);
|
||||
__forceinline void LoadTileDataCg0(uint16_t row);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4127 ) //conditional expression is constant
|
||||
#endif
|
||||
|
||||
// snes_spc 0.9.0. http://www.slack.net/~ant/
|
||||
|
||||
|
|
|
@ -67,14 +67,14 @@ public:
|
|||
SnesEventManager(Debugger *debugger, SnesCpu *cpu, SnesPpu *ppu, SnesMemoryManager *memoryManager, SnesDmaController *dmaController);
|
||||
~SnesEventManager();
|
||||
|
||||
void AddEvent(DebugEventType type, MemoryOperationInfo &operation, int32_t breakpointId = -1);
|
||||
void AddEvent(DebugEventType type);
|
||||
void AddEvent(DebugEventType type, MemoryOperationInfo &operation, int32_t breakpointId = -1) override;
|
||||
void AddEvent(DebugEventType type) override;
|
||||
|
||||
EventViewerCategoryCfg GetEventConfig(DebugEventInfo& evt);
|
||||
EventViewerCategoryCfg GetEventConfig(DebugEventInfo& evt) override;
|
||||
|
||||
uint32_t TakeEventSnapshot();
|
||||
uint32_t TakeEventSnapshot() override;
|
||||
FrameInfo GetDisplayBufferSize() override;
|
||||
DebugEventInfo GetEvent(uint16_t y, uint16_t x);
|
||||
DebugEventInfo GetEvent(uint16_t y, uint16_t x) override;
|
||||
|
||||
void SetConfiguration(BaseEventViewerConfig& config) override;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ class Debugger;
|
|||
class Emulator;
|
||||
struct BaseState;
|
||||
|
||||
class SnesPpuTools : public PpuTools
|
||||
class SnesPpuTools final : public PpuTools
|
||||
{
|
||||
private:
|
||||
void GetSpriteInfo(DebugSpriteInfo& sprite, uint16_t spriteIndex, GetSpritePreviewOptions& options, SnesPpuState& state, uint8_t* vram, uint8_t* oamRam, uint32_t* palette);
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
void Reset() override;
|
||||
|
||||
void ProcessConfigChange();
|
||||
void ProcessConfigChange() override;
|
||||
|
||||
void ProcessInstruction();
|
||||
void ProcessRead(uint32_t addr, uint8_t value, MemoryOperationType type);
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#include "Utilities/HexUtilities.h"
|
||||
#include "Utilities/Serializer.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4127 ) //conditional expression is constant
|
||||
#endif
|
||||
|
||||
static constexpr uint8_t _oamSizes[8][2][2] = {
|
||||
{ { 1, 1 }, { 2, 2 } }, //8x8 + 16x16
|
||||
|
|
|
@ -402,3 +402,22 @@ void CheatManager::RefreshRamCheats(CpuType cpuType)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<CpuType cpuType>
|
||||
void CheatManager::ApplyCheat(uint32_t addr, uint8_t& value)
|
||||
{
|
||||
if(_bankHasCheats[(int)cpuType][addr >> GetBankShift(cpuType)]) {
|
||||
auto result = _cheatsByAddress[(int)cpuType].find(addr);
|
||||
if(result != _cheatsByAddress[(int)cpuType].end()) {
|
||||
if(result->second.Compare == -1 || result->second.Compare == value) {
|
||||
value = result->second.Value;
|
||||
_emu->GetConsole()->ProcessCheatCode(result->second, addr, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template void CheatManager::ApplyCheat<CpuType::Nes>(uint32_t addr, uint8_t& value);
|
||||
template void CheatManager::ApplyCheat<CpuType::Snes>(uint32_t addr, uint8_t& value);
|
||||
template void CheatManager::ApplyCheat<CpuType::Pce>(uint32_t addr, uint8_t& value);
|
||||
template void CheatManager::ApplyCheat<CpuType::Gameboy>(uint32_t addr, uint8_t& value);
|
||||
|
|
|
@ -100,16 +100,5 @@ public:
|
|||
}
|
||||
|
||||
template<CpuType cpuType>
|
||||
__declspec(noinline) void ApplyCheat(uint32_t addr, uint8_t &value)
|
||||
{
|
||||
if(_bankHasCheats[(int)cpuType][addr >> GetBankShift(cpuType)]) {
|
||||
auto result = _cheatsByAddress[(int)cpuType].find(addr);
|
||||
if(result != _cheatsByAddress[(int)cpuType].end()) {
|
||||
if(result->second.Compare == -1 || result->second.Compare == value) {
|
||||
value = result->second.Value;
|
||||
_emu->GetConsole()->ProcessCheatCode(result->second, addr, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
__noinline void ApplyCheat(uint32_t addr, uint8_t& value);
|
||||
};
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
class Emulator;
|
||||
|
||||
class EmuSettings : public ISerializable
|
||||
class EmuSettings final : public ISerializable
|
||||
{
|
||||
private:
|
||||
Emulator* _emu;
|
||||
|
|
|
@ -50,10 +50,10 @@ Emulator::Emulator() :
|
|||
_debugHud(new DebugHud()),
|
||||
_notificationManager(new NotificationManager()),
|
||||
_batteryManager(new BatteryManager()),
|
||||
_videoDecoder(new VideoDecoder(this)),
|
||||
_videoRenderer(new VideoRenderer(this)),
|
||||
_saveStateManager(new SaveStateManager(this)),
|
||||
_soundMixer(new SoundMixer(this)),
|
||||
_videoRenderer(new VideoRenderer(this)),
|
||||
_videoDecoder(new VideoDecoder(this)),
|
||||
_saveStateManager(new SaveStateManager(this)),
|
||||
_cheatManager(new CheatManager(this)),
|
||||
_movieManager(new MovieManager(this)),
|
||||
_gameServer(new GameServer(this)),
|
||||
|
|
|
@ -18,21 +18,21 @@ struct RenderedFrame
|
|||
|
||||
RenderedFrame(void* buffer, uint32_t width, uint32_t height, double scale = 1.0, uint32_t frameNumber = 0) :
|
||||
FrameBuffer(buffer),
|
||||
Data(nullptr),
|
||||
Width(width),
|
||||
Height(height),
|
||||
Scale(scale),
|
||||
FrameNumber(frameNumber),
|
||||
Data(nullptr),
|
||||
InputData({})
|
||||
{}
|
||||
|
||||
RenderedFrame(void* buffer, uint32_t width, uint32_t height, double scale, uint32_t frameNumber, vector<ControllerData> inputData) :
|
||||
FrameBuffer(buffer),
|
||||
Data(nullptr),
|
||||
Width(width),
|
||||
Height(height),
|
||||
Scale(scale),
|
||||
FrameNumber(frameNumber),
|
||||
Data(nullptr),
|
||||
InputData(inputData)
|
||||
{}
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
class MessageInfo;
|
||||
|
||||
class SystemHud : public IMessageManager
|
||||
class SystemHud final : public IMessageManager
|
||||
{
|
||||
private:
|
||||
Emulator* _emu = nullptr;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4100 ) //unreferenced formal parameter
|
||||
#pragma warning( disable : 4244 ) //conversion from 'x' to 'y', possible loss of data
|
||||
#pragma warning( disable : 4245 ) //conversion from 'x' to 'y', signed/unsigned mismatch
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -28,12 +30,18 @@
|
|||
|
||||
#include "../Utilities/UTF8Util.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __noinline __declspec(noinline)
|
||||
#endif
|
||||
|
||||
#ifndef __MINGW32__
|
||||
#ifdef __clang__
|
||||
#define __forceinline __attribute__((always_inline)) inline
|
||||
#define __noinline __attribute__((noinline))
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define __forceinline __attribute__((always_inline)) inline
|
||||
#define __noinline __attribute__((noinline))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <iostream>
|
||||
|
||||
std::shared_ptr<LinuxGameController> LinuxGameController::GetController(shared_ptr<Emulator> emu, int deviceID, bool logInformation)
|
||||
std::shared_ptr<LinuxGameController> LinuxGameController::GetController(Emulator* emu, int deviceID, bool logInformation)
|
||||
{
|
||||
std::string deviceName = "/dev/input/event" + std::to_string(deviceID);
|
||||
struct stat buffer;
|
||||
|
@ -47,7 +47,7 @@ std::shared_ptr<LinuxGameController> LinuxGameController::GetController(shared_p
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
LinuxGameController::LinuxGameController(shared_ptr<Emulator> emu, int deviceID, int fileDescriptor, libevdev* device)
|
||||
LinuxGameController::LinuxGameController(Emulator* emu, int deviceID, int fileDescriptor, libevdev* device)
|
||||
{
|
||||
_emu = emu;
|
||||
_deviceID = deviceID;
|
||||
|
|
|
@ -14,17 +14,17 @@ private:
|
|||
bool _disconnected = false;
|
||||
std::thread _eventThread;
|
||||
std::atomic<bool> _stopFlag;
|
||||
shared_ptr<Emulator> _emu;
|
||||
Emulator* _emu;
|
||||
int _axisDefaultValue[0x100];
|
||||
|
||||
LinuxGameController(shared_ptr<Emulator> emu, int deviceID, int fileDescriptor, libevdev *device);
|
||||
LinuxGameController(Emulator* emu, int deviceID, int fileDescriptor, libevdev *device);
|
||||
bool CheckAxis(unsigned int code, bool forPositive);
|
||||
void Calibrate();
|
||||
|
||||
public:
|
||||
~LinuxGameController();
|
||||
|
||||
static std::shared_ptr<LinuxGameController> GetController(shared_ptr<Emulator> emu, int deviceID, bool logInformation);
|
||||
static std::shared_ptr<LinuxGameController> GetController(Emulator* emu, int deviceID, bool logInformation);
|
||||
|
||||
bool IsDisconnected();
|
||||
int GetDeviceID();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "Shared/Emulator.h"
|
||||
#include "Shared/KeyDefinitions.h"
|
||||
|
||||
LinuxKeyManager::LinuxKeyManager(shared_ptr<Emulator> emu)
|
||||
LinuxKeyManager::LinuxKeyManager(Emulator* emu)
|
||||
{
|
||||
_emu = emu;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class Emulator;
|
|||
class LinuxKeyManager : public IKeyManager
|
||||
{
|
||||
private:
|
||||
shared_ptr<Emulator> _emu;
|
||||
Emulator* _emu;
|
||||
std::vector<shared_ptr<LinuxGameController>> _controllers;
|
||||
bool _keyState[0x200];
|
||||
bool _mouseState[0x03];
|
||||
|
@ -27,7 +27,7 @@ private:
|
|||
void CheckForGamepads(bool logInformation);
|
||||
|
||||
public:
|
||||
LinuxKeyManager(shared_ptr<Emulator> emu);
|
||||
LinuxKeyManager(Emulator* emu);
|
||||
virtual ~LinuxKeyManager();
|
||||
|
||||
void RefreshState();
|
||||
|
|
|
@ -5,27 +5,23 @@
|
|||
#include "Core/Shared/Video/VideoDecoder.h"
|
||||
#include "Core/Shared/EmuSettings.h"
|
||||
#include "Core/Shared/MessageManager.h"
|
||||
#include "Core/Shared/RenderedFrame.h"
|
||||
|
||||
SimpleLock SdlRenderer::_frameLock;
|
||||
|
||||
SdlRenderer::SdlRenderer(shared_ptr<Emulator> emu, void* windowHandle, bool registerAsMessageManager) : BaseRenderer(emu, registerAsMessageManager), _windowHandle(windowHandle)
|
||||
SdlRenderer::SdlRenderer(Emulator* emu, void* windowHandle, bool registerAsMessageManager) : BaseRenderer(emu, registerAsMessageManager), _windowHandle(windowHandle)
|
||||
{
|
||||
_frameBuffer = nullptr;
|
||||
_requiredWidth = 256;
|
||||
_requiredHeight = 240;
|
||||
|
||||
shared_ptr<VideoRenderer> videoRenderer = _emu->GetVideoRenderer();
|
||||
if(videoRenderer) {
|
||||
_emu->GetVideoRenderer()->RegisterRenderingDevice(this);
|
||||
}
|
||||
_emu->GetVideoRenderer()->RegisterRenderingDevice(this);
|
||||
}
|
||||
|
||||
SdlRenderer::~SdlRenderer()
|
||||
{
|
||||
shared_ptr<VideoRenderer> videoRenderer = _emu->GetVideoRenderer();
|
||||
if(videoRenderer) {
|
||||
videoRenderer->UnregisterRenderingDevice(this);
|
||||
}
|
||||
_emu->GetVideoRenderer()->UnregisterRenderingDevice(this);
|
||||
|
||||
Cleanup();
|
||||
Cleanup();
|
||||
delete[] _frameBuffer;
|
||||
|
@ -130,24 +126,24 @@ void SdlRenderer::SetScreenSize(uint32_t width, uint32_t height)
|
|||
}
|
||||
}
|
||||
|
||||
void SdlRenderer::UpdateFrame(void *frameBuffer, uint32_t width, uint32_t height)
|
||||
void SdlRenderer::UpdateFrame(RenderedFrame& frame)
|
||||
{
|
||||
_frameLock.Acquire();
|
||||
if(_frameBuffer == nullptr || _requiredWidth != width || _requiredHeight != height) {
|
||||
_requiredWidth = width;
|
||||
_requiredHeight = height;
|
||||
if(_frameBuffer == nullptr || _requiredWidth != frame.Width || _requiredHeight != frame.Height) {
|
||||
_requiredWidth = frame.Width;
|
||||
_requiredHeight = frame.Height;
|
||||
|
||||
delete[] _frameBuffer;
|
||||
_frameBuffer = new uint32_t[width*height];
|
||||
memset(_frameBuffer, 0, width*height*4);
|
||||
_frameBuffer = new uint32_t[frame.Width*frame.Height];
|
||||
memset(_frameBuffer, 0, frame.Width * frame.Height *4);
|
||||
}
|
||||
|
||||
memcpy(_frameBuffer, frameBuffer, width*height*_bytesPerPixel);
|
||||
memcpy(_frameBuffer, frame.FrameBuffer, frame.Width * frame.Height *_bytesPerPixel);
|
||||
_frameChanged = true;
|
||||
_frameLock.Release();
|
||||
}
|
||||
|
||||
void SdlRenderer::Render()
|
||||
void SdlRenderer::Render(uint32_t* hudBuffer, uint32_t width, uint32_t height)
|
||||
{
|
||||
SetScreenSize(_requiredWidth, _requiredHeight);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "Utilities/SimpleLock.h"
|
||||
#include "Core/Shared/Video/VideoRenderer.h"
|
||||
#include "Core/Shared/Video/BaseRenderer.h"
|
||||
#include "Core/Shared/RenderedFrame.h"
|
||||
|
||||
class Emulator;
|
||||
|
||||
|
@ -40,11 +41,11 @@ private:
|
|||
void SetScreenSize(uint32_t width, uint32_t height);
|
||||
|
||||
public:
|
||||
SdlRenderer(shared_ptr<Emulator> emu, void* windowHandle, bool registerAsMessageManager);
|
||||
SdlRenderer(Emulator* emu, void* windowHandle, bool registerAsMessageManager);
|
||||
virtual ~SdlRenderer();
|
||||
|
||||
void UpdateFrame(void *frameBuffer, uint32_t width, uint32_t height) override;
|
||||
void Render() override;
|
||||
void UpdateFrame(RenderedFrame& frame) override;
|
||||
void Render(uint32_t* hudBuffer, uint32_t width, uint32_t height) override;
|
||||
void Reset() override;
|
||||
|
||||
void SetFullscreenMode(bool fullscreen, void* windowHandle, uint32_t monitorWidth, uint32_t monitorHeight) override;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "Core/Shared/Audio/SoundMixer.h"
|
||||
#include "Core/Shared/Emulator.h"
|
||||
|
||||
SdlSoundManager::SdlSoundManager(shared_ptr<Emulator> emu)
|
||||
SdlSoundManager::SdlSoundManager(Emulator* emu)
|
||||
{
|
||||
_emu = emu;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class Emulator;
|
|||
class SdlSoundManager : public BaseSoundManager
|
||||
{
|
||||
public:
|
||||
SdlSoundManager(shared_ptr<Emulator> emu);
|
||||
SdlSoundManager(Emulator* emu);
|
||||
~SdlSoundManager();
|
||||
|
||||
void PlayBuffer(int16_t *soundBuffer, uint32_t bufferSize, uint32_t sampleRate, bool isStereo);
|
||||
|
@ -30,7 +30,7 @@ private:
|
|||
void WriteToBuffer(uint8_t* output, uint32_t len);
|
||||
|
||||
private:
|
||||
shared_ptr<Emulator> _emu;
|
||||
Emulator* _emu;
|
||||
SDL_AudioDeviceID _audioDeviceID;
|
||||
string _deviceName;
|
||||
bool _needReset = false;
|
||||
|
|
|
@ -14,16 +14,15 @@
|
|||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<ApplicationIcon>Assets\Icon.ico</ApplicationIcon>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<OutputPath>$(SolutionDir)\bin\x64\Debug\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<OutputPath>$(SolutionDir)\bin\x64\Release\</OutputPath>
|
||||
<Optimize>False</Optimize>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(OptimizeUi)'=='true'">
|
||||
<Optimize>true</Optimize>
|
||||
|
@ -670,7 +669,14 @@
|
|||
<EmbeddedResource Include="Dependencies.zip" />
|
||||
<EmbeddedResource Include="Localization\resources.en.xml" WithCulture="false" Type="Non-Resx" />
|
||||
</ItemGroup>
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'">
|
||||
<Exec Command="cd $(OutDir)
rd Dependencies /s /q
md Dependencies
copy $(ProjectDir)\Dependencies\* Dependencies
copy libHarfBuzzSharp.dll Dependencies
copy libSkiaSharp.dll Dependencies
copy MesenSCore.dll Dependencies
DependencyPacker.exe
copy Dependencies.zip $(ProjectDir)" />
|
||||
</Target>
|
||||
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
||||
<OutputPath>..\bin\x64\Release\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
||||
<Exec Command="cd $(OutDir)
rmdir Dependencies
mkdir Dependencies
cp $(ProjectDir)/Dependencies/* Dependencies
cp libHarfBuzzSharp.so Dependencies
cp libSkiaSharp.so Dependencies
cp libMesenSCore.dll Dependencies
cd Dependencies
zip -r ../Dependencies.zip *
cp ../Dependencies.zip $(ProjectDir)" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -11,6 +11,7 @@ using System.IO.Compression;
|
|||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Mesen
|
||||
{
|
||||
|
@ -27,6 +28,8 @@ namespace Mesen
|
|||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), DllImportResolver);
|
||||
|
||||
Environment.CurrentDirectory = ConfigManager.HomeFolder;
|
||||
|
||||
if(!File.Exists(ConfigManager.GetConfigFile())) {
|
||||
|
@ -82,6 +85,14 @@ namespace Mesen
|
|||
}
|
||||
}
|
||||
|
||||
private static IntPtr DllImportResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
|
||||
{
|
||||
if(libraryName.Contains("Mesen")) {
|
||||
return NativeLibrary.Load(Path.Combine(ConfigManager.HomeFolder, "lib" + libraryName));
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
{
|
||||
|
|
|
@ -103,3 +103,6 @@ uint32_t HermiteResampler::Resample(int16_t* in, uint32_t inSampleCount, int16_t
|
|||
|
||||
return outPos / 2;
|
||||
}
|
||||
|
||||
template uint32_t HermiteResampler::Resample<true>(int16_t* in, uint32_t inSampleCount, int16_t* out, size_t maxOutSampleCount);
|
||||
template uint32_t HermiteResampler::Resample<false>(int16_t* in, uint32_t inSampleCount, int16_t* out, size_t maxOutSampleCount);
|
|
@ -28,6 +28,3 @@ public:
|
|||
template<bool addMode>
|
||||
uint32_t Resample(int16_t* in, uint32_t inSampleCount, int16_t* out, size_t maxOutSampleCount);
|
||||
};
|
||||
|
||||
template uint32_t HermiteResampler::Resample<true>(int16_t* in, uint32_t inSampleCount, int16_t* out, size_t maxOutSampleCount);
|
||||
template uint32_t HermiteResampler::Resample<false>(int16_t* in, uint32_t inSampleCount, int16_t* out, size_t maxOutSampleCount);
|
2
makefile
2
makefile
|
@ -107,8 +107,8 @@ all: ui
|
|||
ui: InteropDLL/$(OBJFOLDER)/$(SHAREDLIB)
|
||||
mkdir -p $(RELEASEFOLDER)/Dependencies
|
||||
rm -fr $(RELEASEFOLDER)/Dependencies/*
|
||||
cp InteropDLL/$(OBJFOLDER)/$(SHAREDLIB) bin/x64/Release/$(SHAREDLIB)
|
||||
cd NewUI && dotnet publish -c Release -r linux-x64 -p:Platform="$(MESENPLATFORM)" --self-contained true -p:PublishSingleFile=true
|
||||
cp InteropDLL/$(OBJFOLDER)/$(SHAREDLIB) NewUI/bin/x64/Release/linux-x64/publish/$(SHAREDLIB)
|
||||
|
||||
libretro: Libretro/$(OBJFOLDER)/$(LIBRETROLIB)
|
||||
mkdir -p bin
|
||||
|
|
Loading…
Reference in a new issue