From cbc61a1bac5163f46bd8168ebf9ea1a6f96846f8 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sun, 11 Dec 2016 10:56:23 -0500 Subject: [PATCH] Fixed all GCC errors and most warnings --- Core/AutoRomTest.h | 2 +- Core/BaseMapper.cpp | 2 +- Core/CheatManager.cpp | 2 +- Core/CheatManager.h | 2 +- Core/Console.cpp | 2 ++ Core/Console.h | 3 +- Core/CrossFeedFilter.cpp | 2 +- Core/Debugger.cpp | 2 +- Core/Disassembler.cpp | 3 +- Core/DisassemblyInfo.cpp | 3 +- Core/ExpressionEvaluator.cpp | 1 + Core/FdsLoader.h | 2 +- Core/GameClientConnection.cpp | 4 +++ Core/GameClientConnection.h | 4 +-- Core/GameDatabase.cpp | 3 +- Core/Ghostbusters63in1.h | 2 -- Core/IAudioDevice.h | 5 +++ Core/IKeyManager.h | 2 ++ Core/IRenderingDevice.h | 1 + Core/NsfLoader.h | 4 +-- Core/NsfMapper.cpp | 2 +- Core/PlayerListMessage.h | 4 +-- Core/RomData.h | 5 +-- Core/RomLoader.cpp | 5 ++- Core/RomLoader.h | 7 +--- Core/SaveStateManager.cpp | 2 +- Core/Snapshotable.cpp | 2 -- Core/SoundMixer.cpp | 6 ++-- Core/Supervision.h | 1 + Core/UnifLoader.h | 14 ++++---- Core/VideoDecoder.cpp | 4 ++- Core/VideoDecoder.h | 6 ++-- Core/VideoHud.cpp | 1 + Core/VideoHud.h | 2 +- Core/VideoRenderer.cpp | 3 +- Core/VideoRenderer.h | 2 +- Core/iNesLoader.cpp | 4 +-- GUI.NET/Program.cs | 6 ++++ GUI.NET/Properties/Resources.resx | 4 +-- InteropDLL/ConsoleWrapper.cpp | 48 +++++++++++++++++++------- InteropDLL/stdafx.h | 26 +++++++------- InteropDLL/targetver.h | 8 ----- Utilities/HQX/hq2x.cpp | 2 ++ Utilities/HQX/hq3x.cpp | 2 ++ Utilities/HQX/hq4x.cpp | 2 ++ Utilities/HQX/init.cpp | 2 ++ Utilities/IpsPatcher.cpp | 1 + Utilities/KreedSaiEagle/2xSai.cpp | 2 ++ Utilities/KreedSaiEagle/Super2xSai.cpp | 2 ++ Utilities/KreedSaiEagle/SuperEagle.cpp | 2 ++ Utilities/PNGHelper.cpp | 3 +- Utilities/SZReader.cpp | 4 +-- Utilities/Scale2x/scale2x.cpp | 2 ++ Utilities/Scale2x/scale2x.h | 27 --------------- Utilities/Scale2x/scale3x.cpp | 2 ++ Utilities/Scale2x/scalebit.cpp | 36 ++----------------- Utilities/UPnPPortMapper.cpp | 4 +-- Utilities/UTF8Util.cpp | 16 +++++++++ Utilities/UTF8Util.h | 4 +-- Utilities/ZipWriter.cpp | 1 + 60 files changed, 169 insertions(+), 158 deletions(-) delete mode 100644 InteropDLL/targetver.h diff --git a/Core/AutoRomTest.h b/Core/AutoRomTest.h index 81337c62..1ea67d75 100644 --- a/Core/AutoRomTest.h +++ b/Core/AutoRomTest.h @@ -36,7 +36,7 @@ private: public: AutoRomTest(); - ~AutoRomTest(); + virtual ~AutoRomTest(); void ProcessNotification(ConsoleNotificationType type, void* parameter); void Record(string filename, bool reset); diff --git a/Core/BaseMapper.cpp b/Core/BaseMapper.cpp index 7db04928..c0206360 100644 --- a/Core/BaseMapper.cpp +++ b/Core/BaseMapper.cpp @@ -459,7 +459,7 @@ void BaseMapper::Initialize(RomData &romData) _nesHeader = romData.NesHeader; - _mirroringType = romData.MirroringType; + _mirroringType = romData.Mirroring; _prgSize = (uint32_t)romData.PrgRom.size(); _chrRomSize = (uint32_t)romData.ChrRom.size(); diff --git a/Core/CheatManager.cpp b/Core/CheatManager.cpp index 535ded8f..16b99bf3 100644 --- a/Core/CheatManager.cpp +++ b/Core/CheatManager.cpp @@ -185,7 +185,7 @@ void CheatManager::SetCheats(CheatInfo cheats[], uint32_t length) for(uint32_t i = 0; i < length; i++) { CheatInfo &cheat = cheats[i]; - switch(cheat.CheatType) { + switch(cheat.Type) { case CheatType::Custom: Instance->AddCustomCode(cheat.Address, cheat.Value, cheat.UseCompareValue ? cheat.CompareValue : -1, cheat.IsRelativeAddress); break; case CheatType::GameGenie: Instance->AddGameGenieCode(cheat.GameGenieCode); break; case CheatType::ProActionRocky: Instance->AddProActionRockyCode(cheat.ProActionRockyCode); break; diff --git a/Core/CheatManager.h b/Core/CheatManager.h index 190c200b..2d4fcf15 100644 --- a/Core/CheatManager.h +++ b/Core/CheatManager.h @@ -19,7 +19,7 @@ enum class CheatType struct CheatInfo { - CheatType CheatType; + CheatType Type; uint32_t ProActionRockyCode; uint32_t Address; char GameGenieCode[9]; diff --git a/Core/Console.cpp b/Core/Console.cpp index d8451573..ea652395 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -22,6 +22,8 @@ shared_ptr Console::Instance(new Console()); Console::Console() { + _resetRequested = false; + _lagCounter = 0; } Console::~Console() diff --git a/Core/Console.h b/Core/Console.h index d3d02ecb..0ae4c33b 100644 --- a/Core/Console.h +++ b/Core/Console.h @@ -1,6 +1,7 @@ #pragma once #include "stdafx.h" +#include #include "CPU.h" #include "PPU.h" #include "APU.h" @@ -38,7 +39,7 @@ class Console bool _stop = false; bool _reset = false; - atomic _resetRequested = false; + atomic _resetRequested; atomic _lagCounter; bool _initialized = false; diff --git a/Core/CrossFeedFilter.cpp b/Core/CrossFeedFilter.cpp index 91780035..a519841e 100644 --- a/Core/CrossFeedFilter.cpp +++ b/Core/CrossFeedFilter.cpp @@ -3,7 +3,7 @@ void CrossFeedFilter::ApplyFilter(int16_t *stereoBuffer, size_t sampleCount, int ratio) { - for(int i = 0; i < sampleCount; i++) { + for(size_t i = 0; i < sampleCount; i++) { int16_t leftSample = stereoBuffer[0]; int16_t rightSample = stereoBuffer[1]; diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index b0fa1d48..97ede4a4 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -295,7 +295,7 @@ void Debugger::ProcessStepConditions(uint32_t addr) void Debugger::PrivateProcessPpuCycle() { - if(PPU::GetCurrentCycle() == _ppuViewerCycle && PPU::GetCurrentScanline() == _ppuViewerScanline) { + if(PPU::GetCurrentCycle() == (uint32_t)_ppuViewerCycle && PPU::GetCurrentScanline() == _ppuViewerScanline) { MessageManager::SendNotification(ConsoleNotificationType::PpuViewerDisplayFrame); } diff --git a/Core/Disassembler.cpp b/Core/Disassembler.cpp index 9e5e4252..fdd55109 100644 --- a/Core/Disassembler.cpp +++ b/Core/Disassembler.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include #include "Disassembler.h" #include "DisassemblyInfo.h" #include "BaseMapper.h" @@ -76,7 +77,7 @@ void Disassembler::BuildOpCodeTables(bool useLowerCase) for(int i = 0; i < 256; i++) { if(useLowerCase) { string name = opName[i]; - std::transform(name.begin(), name.end(), name.begin(), std::tolower); + std::transform(name.begin(), name.end(), name.begin(), ::tolower); DisassemblyInfo::OPName[i] = name; } else { DisassemblyInfo::OPName[i] = opName[i]; diff --git a/Core/DisassemblyInfo.cpp b/Core/DisassemblyInfo.cpp index 7cbb8c7d..bc74f82d 100644 --- a/Core/DisassemblyInfo.cpp +++ b/Core/DisassemblyInfo.cpp @@ -75,7 +75,7 @@ string DisassemblyInfo::ToString(uint32_t memoryAddr, shared_ptr uint16_t DisassemblyInfo::GetOpAddr(uint16_t memoryAddr) { - uint16_t opAddr; + uint16_t opAddr = 0; if(_opSize == 2) { opAddr = *(_opPointer + 1); } else if(_opSize == 3) { @@ -111,7 +111,6 @@ string DisassemblyInfo::GetEffectiveAddressString(State& cpuState, shared_ptrGetLabel(effectiveAddress, true); if(!label.empty()) { diff --git a/Core/ExpressionEvaluator.cpp b/Core/ExpressionEvaluator.cpp index f3aa410d..c1986757 100644 --- a/Core/ExpressionEvaluator.cpp +++ b/Core/ExpressionEvaluator.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include +#include #include "ExpressionEvaluator.h" #include "Console.h" #include "Debugger.h" diff --git a/Core/FdsLoader.h b/Core/FdsLoader.h index 3b59faf4..2604c3a3 100644 --- a/Core/FdsLoader.h +++ b/Core/FdsLoader.h @@ -155,7 +155,7 @@ public: RomData romData; romData.MapperID = MapperFactory::FdsMapperID; - romData.MirroringType = MirroringType::Vertical; + romData.Mirroring = MirroringType::Vertical; romData.PrgRom = LoadBios(); romData.System = GameSystem::FDS; diff --git a/Core/GameClientConnection.cpp b/Core/GameClientConnection.cpp index 50422478..26241817 100644 --- a/Core/GameClientConnection.cpp +++ b/Core/GameClientConnection.cpp @@ -16,6 +16,10 @@ GameClientConnection::GameClientConnection(shared_ptr socket, shared_ptr connectionData) : GameConnection(socket, connectionData) { + _shutdown = false; + _enableControllers = false; + _minimumQueueSize = 3; + MessageManager::RegisterNotificationListener(this); MessageManager::DisplayMessage("NetPlay", "ConnectedToServer"); SendHandshake(); diff --git a/Core/GameClientConnection.h b/Core/GameClientConnection.h index cdaae300..b73949b0 100644 --- a/Core/GameClientConnection.h +++ b/Core/GameClientConnection.h @@ -16,8 +16,8 @@ private: AutoResetEvent _waitForInput[4]; SimpleLock _writeLock; atomic _shutdown; - atomic _enableControllers = false; - atomic _minimumQueueSize = 3; + atomic _enableControllers; + atomic _minimumQueueSize; vector _playerList; diff --git a/Core/GameDatabase.cpp b/Core/GameDatabase.cpp index 7cb73874..6788454c 100644 --- a/Core/GameDatabase.cpp +++ b/Core/GameDatabase.cpp @@ -1,4 +1,3 @@ -#pragma once #include "stdafx.h" #include "RomData.h" #include "MessageManager.h" @@ -293,6 +292,6 @@ void GameDatabase::UpdateRomData(GameInfo &info, RomData &romData) romData.HasBattery |= info.HasBattery; if(!info.Mirroring.empty()) { - romData.MirroringType = info.Mirroring.compare("h") == 0 ? MirroringType::Horizontal : MirroringType::Vertical; + romData.Mirroring = info.Mirroring.compare("h") == 0 ? MirroringType::Horizontal : MirroringType::Vertical; } } \ No newline at end of file diff --git a/Core/Ghostbusters63in1.h b/Core/Ghostbusters63in1.h index 6ad1d3bf..34740938 100644 --- a/Core/Ghostbusters63in1.h +++ b/Core/Ghostbusters63in1.h @@ -33,8 +33,6 @@ protected: void UpdateState() { - uint8_t bank = ((_regs[0] & 0x80) >> 7) | ((_regs[1] & 0x01) << 1); - uint8_t chip = (_regs[1] << 5 & 0x20) << (_regs[0] >> 7); if(chip < (_regs[0] >> 7)) { RemoveCpuMemoryMapping(0x8000, 0xFFFF); diff --git a/Core/IAudioDevice.h b/Core/IAudioDevice.h index 871da912..19dcf227 100644 --- a/Core/IAudioDevice.h +++ b/Core/IAudioDevice.h @@ -5,7 +5,12 @@ class IAudioDevice { public: + virtual ~IAudioDevice() {} virtual void PlayBuffer(int16_t *soundBuffer, uint32_t bufferSize, uint32_t sampleRate, bool isStereo) = 0; virtual void Stop() = 0; virtual void Pause() = 0; + + virtual string GetAvailableDevices() = 0; + virtual void SetAudioDevice(string deviceName) = 0; + }; \ No newline at end of file diff --git a/Core/IKeyManager.h b/Core/IKeyManager.h index 7f731eb1..d0fbe6d8 100644 --- a/Core/IKeyManager.h +++ b/Core/IKeyManager.h @@ -12,6 +12,8 @@ enum class MouseButton class IKeyManager { public: + virtual ~IKeyManager() {} + virtual void RefreshState() = 0; virtual void UpdateDevices() = 0; virtual bool IsMouseButtonPressed(MouseButton button) = 0; diff --git a/Core/IRenderingDevice.h b/Core/IRenderingDevice.h index f68fcb29..68ea2436 100644 --- a/Core/IRenderingDevice.h +++ b/Core/IRenderingDevice.h @@ -5,6 +5,7 @@ class IRenderingDevice { public: + virtual ~IRenderingDevice() {} virtual void UpdateFrame(void *frameBuffer, uint32_t width, uint32_t height) = 0; virtual void Render() = 0; virtual void Reset() = 0; diff --git a/Core/NsfLoader.h b/Core/NsfLoader.h index 4174b2d5..a45dd604 100644 --- a/Core/NsfLoader.h +++ b/Core/NsfLoader.h @@ -25,7 +25,7 @@ private: protected: void InitializeFromHeader(RomData& romData) { - NsfHeader &header = romData.NsfHeader; + NsfHeader &header = romData.NsfInfo; romData.MapperID = MapperFactory::NsfMapperID; @@ -121,7 +121,7 @@ public: RomData LoadRom(vector& romFile) { RomData romData; - NsfHeader &header = romData.NsfHeader; + NsfHeader &header = romData.NsfInfo; InitHeader(header); diff --git a/Core/NsfMapper.cpp b/Core/NsfMapper.cpp index 0254a04b..155e4dfa 100644 --- a/Core/NsfMapper.cpp +++ b/Core/NsfMapper.cpp @@ -58,7 +58,7 @@ void NsfMapper::SetNesModel(NesModel model) void NsfMapper::InitMapper(RomData& romData) { - _nsfHeader = romData.NsfHeader; + _nsfHeader = romData.NsfInfo; _hasBankSwitching = HasBankSwitching(); if(!_hasBankSwitching) { diff --git a/Core/PlayerListMessage.h b/Core/PlayerListMessage.h index cc373c7e..d945fb09 100644 --- a/Core/PlayerListMessage.h +++ b/Core/PlayerListMessage.h @@ -13,8 +13,8 @@ protected: { uint32_t nameLength = PlayerNameMaxLength + 1; char playerName[PlayerNameMaxLength + 1]; - uint8_t playerPort; - bool isHost; + uint8_t playerPort = 0; + bool isHost = false; if(_sending) { uint32_t playerCount = (uint32_t)_playerList.size(); diff --git a/Core/RomData.h b/Core/RomData.h index 0f5ca7f6..e10c1be3 100644 --- a/Core/RomData.h +++ b/Core/RomData.h @@ -1,5 +1,6 @@ #pragma once #include "stdafx.h" +#include enum class MirroringType { @@ -273,7 +274,7 @@ struct RomData GameSystem System = GameSystem::Unknown; bool HasBattery = false; bool HasTrainer = false; - MirroringType MirroringType = MirroringType::Horizontal; + MirroringType Mirroring = MirroringType::Horizontal; int32_t ChrRamSize = -1; int32_t SaveChrRamSize = -1; @@ -294,6 +295,6 @@ struct RomData bool Error = false; NESHeader NesHeader; - NsfHeader NsfHeader; + NsfHeader NsfInfo; GameInfo DatabaseInfo; }; \ No newline at end of file diff --git a/Core/RomLoader.cpp b/Core/RomLoader.cpp index bcaf00c6..72e3ac74 100644 --- a/Core/RomLoader.cpp +++ b/Core/RomLoader.cpp @@ -1,5 +1,8 @@ -#pragma once #include "stdafx.h" +#include "../Utilities/FolderUtilities.h" +#include "../Utilities/ArchiveReader.h" +#include "../Utilities/CRC32.h" +#include "../Utilities/IpsPatcher.h" #include "../Utilities/ZipReader.h" #include "../Utilities/SZReader.h" #include "RomLoader.h" diff --git a/Core/RomLoader.h b/Core/RomLoader.h index 3c39072a..7ab553a9 100644 --- a/Core/RomLoader.h +++ b/Core/RomLoader.h @@ -1,12 +1,7 @@ #pragma once - #include "stdafx.h" -#include -#include "../Utilities/FolderUtilities.h" -#include "../Utilities/ArchiveReader.h" -#include "../Utilities/CRC32.h" -#include "../Utilities/IpsPatcher.h" #include "RomData.h" +class ArchiveReader; class RomLoader { diff --git a/Core/SaveStateManager.cpp b/Core/SaveStateManager.cpp index 417eda68..48d302f4 100644 --- a/Core/SaveStateManager.cpp +++ b/Core/SaveStateManager.cpp @@ -7,7 +7,7 @@ #include "EmulationSettings.h" const uint32_t SaveStateManager::FileFormatVersion; -atomic SaveStateManager::_lastIndex = 1; +atomic SaveStateManager::_lastIndex(1); string SaveStateManager::GetStateFilepath(int stateIndex) { diff --git a/Core/Snapshotable.cpp b/Core/Snapshotable.cpp index 104d203d..95eaf585 100644 --- a/Core/Snapshotable.cpp +++ b/Core/Snapshotable.cpp @@ -1,5 +1,3 @@ -#pragma once - #include "stdafx.h" #include #include "Snapshotable.h" diff --git a/Core/SoundMixer.cpp b/Core/SoundMixer.cpp index 8eec4e61..dbded7c8 100644 --- a/Core/SoundMixer.cpp +++ b/Core/SoundMixer.cpp @@ -70,7 +70,7 @@ void SoundMixer::Reset() _timestamps.clear(); - for(int i = 0; i < MaxChannelCount; i++) { + for(uint32_t i = 0; i < MaxChannelCount; i++) { _volumes[i] = 0; _panning[i] = 0; } @@ -192,7 +192,7 @@ void SoundMixer::EndFrame(uint32_t time) bool muteFrame = true; for(size_t i = 0, len = _timestamps.size(); i < len; i++) { uint32_t stamp = _timestamps[i]; - for(int j = 0; j < MaxChannelCount; j++) { + for(uint32_t j = 0; j < MaxChannelCount; j++) { if(_channelOutput[j][stamp] != 0) { //Assume any change in output means sound is playing, disregarding volume options //NSF tracks that mute the triangle channel by setting it to a high-frequency value will not be considered silent @@ -220,7 +220,7 @@ void SoundMixer::EndFrame(uint32_t time) } //Reset everything - for(int i = 0; i < MaxChannelCount; i++) { + for(uint32_t i = 0; i < MaxChannelCount; i++) { _volumes[i] = EmulationSettings::GetChannelVolume((AudioChannel)i); _panning[i] = EmulationSettings::GetChannelPanning((AudioChannel)i); } diff --git a/Core/Supervision.h b/Core/Supervision.h index 1bae8b48..dee96e45 100644 --- a/Core/Supervision.h +++ b/Core/Supervision.h @@ -1,5 +1,6 @@ #pragma once #include "stdafx.h" +#include "../Utilities/CRC32.h" #include "BaseMapper.h" class Supervision : public BaseMapper diff --git a/Core/UnifLoader.h b/Core/UnifLoader.h index 5e8b40e6..26bd6be6 100644 --- a/Core/UnifLoader.h +++ b/Core/UnifLoader.h @@ -217,8 +217,6 @@ private: return false; } - NsfHeader& header = romData.NsfHeader; - string fourCC = ReadFourCC(data); uint32_t length; @@ -269,11 +267,11 @@ private: switch(value) { default: - case 0: romData.MirroringType = MirroringType::Horizontal; break; - case 1: romData.MirroringType = MirroringType::Vertical; break; - case 2: romData.MirroringType = MirroringType::ScreenAOnly; break; - case 3: romData.MirroringType = MirroringType::ScreenBOnly; break; - case 4: romData.MirroringType = MirroringType::FourScreens; break; + case 0: romData.Mirroring = MirroringType::Horizontal; break; + case 1: romData.Mirroring = MirroringType::Vertical; break; + case 2: romData.Mirroring = MirroringType::ScreenAOnly; break; + case 3: romData.Mirroring = MirroringType::ScreenBOnly; break; + case 4: romData.Mirroring = MirroringType::FourScreens; break; } } else { //Unsupported/unused FourCCs: PCKn, CCKn, NAME, WRTR, READ, DINF, VROR @@ -341,7 +339,7 @@ public: } string mirroringType; - switch(romData.MirroringType) { + switch(romData.Mirroring) { case MirroringType::Horizontal: mirroringType = "Horizontal"; break; case MirroringType::Vertical: mirroringType = "Vertical"; break; case MirroringType::ScreenAOnly: mirroringType = "1-Screen (A)"; break; diff --git a/Core/VideoDecoder.cpp b/Core/VideoDecoder.cpp index 60ab2774..19bce8c9 100644 --- a/Core/VideoDecoder.cpp +++ b/Core/VideoDecoder.cpp @@ -20,6 +20,8 @@ VideoDecoder* VideoDecoder::GetInstance() VideoDecoder::VideoDecoder() { + _frameChanged = false; + _stopFlag = false; UpdateVideoFilter(); } @@ -162,7 +164,7 @@ void VideoDecoder::StopThread() if(_ppuOutputBuffer != nullptr) { //Clear whole screen - for(int i = 0; i < PPU::PixelCount; i++) { + for(uint32_t i = 0; i < PPU::PixelCount; i++) { _ppuOutputBuffer[i] = 14; //Black } DecodeFrame(); diff --git a/Core/VideoDecoder.h b/Core/VideoDecoder.h index 2ecae4c7..4b521a06 100644 --- a/Core/VideoDecoder.h +++ b/Core/VideoDecoder.h @@ -29,12 +29,12 @@ private: AutoResetEvent _waitForFrame; - atomic _frameChanged = false; - atomic _stopFlag = false; + atomic _frameChanged; + atomic _stopFlag; uint32_t _frameCount = 0; VideoFilterType _videoFilterType = VideoFilterType::None; - unique_ptr _videoFilter = nullptr; + unique_ptr _videoFilter; void UpdateVideoFilter(); diff --git a/Core/VideoHud.cpp b/Core/VideoHud.cpp index 95c996a2..4f7ad365 100644 --- a/Core/VideoHud.cpp +++ b/Core/VideoHud.cpp @@ -36,6 +36,7 @@ bool VideoHud::DisplayControllerInput(int inputPort, uint8_t *outputBuffer, Fram xStart = 3 * scale + (settings.DisplayHorizontally ? displayIndex * 40 * scale : 0); yStart = frameInfo.Height - 15 * scale - (settings.DisplayHorizontally ? 0 : displayIndex * 14 * scale); break; + default: case InputDisplayPosition::BottomRight: xStart = frameInfo.Width - 40 * scale - (settings.DisplayHorizontally ? displayIndex * 40 * scale : 0); yStart = frameInfo.Height - 15 * scale - (settings.DisplayHorizontally ? 0 : displayIndex * 14 * scale); diff --git a/Core/VideoHud.h b/Core/VideoHud.h index 4901b57f..ebd53e7a 100644 --- a/Core/VideoHud.h +++ b/Core/VideoHud.h @@ -6,7 +6,7 @@ class VideoHud { private: - static const vector VideoHud::_gamePads[4]; + static const vector _gamePads[4]; void BlendColors(uint32_t* output, uint32_t input); bool DisplayControllerInput(int inputPort, uint8_t *outputBuffer, FrameInfo frameInfo, OverscanDimensions overscan, uint32_t displayIndex); diff --git a/Core/VideoRenderer.cpp b/Core/VideoRenderer.cpp index 09ac9be9..05d55f64 100644 --- a/Core/VideoRenderer.cpp +++ b/Core/VideoRenderer.cpp @@ -14,6 +14,7 @@ VideoRenderer* VideoRenderer::GetInstance() VideoRenderer::VideoRenderer() { + _stopFlag = false; StartThread(); } @@ -59,7 +60,7 @@ void VideoRenderer::RenderThread() void VideoRenderer::UpdateFrame(void *frameBuffer, uint32_t width, uint32_t height) { - if(_renderer) { + if(_renderer) { _renderer->UpdateFrame(frameBuffer, width, height); _waitForRender.Signal(); } diff --git a/Core/VideoRenderer.h b/Core/VideoRenderer.h index e50d1827..a15fc2ee 100644 --- a/Core/VideoRenderer.h +++ b/Core/VideoRenderer.h @@ -13,7 +13,7 @@ private: AutoResetEvent _waitForRender; unique_ptr _renderThread; IRenderingDevice* _renderer = nullptr; - atomic _stopFlag = false; + atomic _stopFlag; void RenderThread(); diff --git a/Core/iNesLoader.cpp b/Core/iNesLoader.cpp index af0deef7..abab5363 100644 --- a/Core/iNesLoader.cpp +++ b/Core/iNesLoader.cpp @@ -18,7 +18,7 @@ RomData iNesLoader::LoadRom(vector& romFile) romData.IsNes20Header = (header.GetRomHeaderVersion() == RomHeaderVersion::Nes2_0); romData.MapperID = header.GetMapperID(); romData.SubMapperID = header.GetSubMapper(); - romData.MirroringType = header.GetMirroringType(); + romData.Mirroring = header.GetMirroringType(); romData.HasBattery = header.HasBattery(); if(header.IsPalRom()) { romData.System = GameSystem::NesPal; @@ -69,7 +69,7 @@ RomData iNesLoader::LoadRom(vector& romFile) MessageManager::Log("[iNes] Save RAM: " + std::to_string(romData.SaveRamSize / 1024) + " KB"); } - MessageManager::Log("[iNes] Mirroring: " + string(romData.MirroringType == MirroringType::Horizontal ? "Horizontal" : romData.MirroringType == MirroringType::Vertical ? "Vertical" : "Four Screens")); + MessageManager::Log("[iNes] Mirroring: " + string(romData.Mirroring == MirroringType::Horizontal ? "Horizontal" : romData.Mirroring == MirroringType::Vertical ? "Vertical" : "Four Screens")); MessageManager::Log("[iNes] Battery: " + string(romData.HasBattery ? "Yes" : "No")); if(romData.HasTrainer) { MessageManager::Log("[iNes] Trainer: Yes"); diff --git a/GUI.NET/Program.cs b/GUI.NET/Program.cs index 648c9cb8..e8577ed4 100644 --- a/GUI.NET/Program.cs +++ b/GUI.NET/Program.cs @@ -20,6 +20,8 @@ namespace Mesen.GUI [return: MarshalAs(UnmanagedType.Bool)] private static extern bool SetForegroundWindow(IntPtr hWnd); + public static bool IsMono { get; private set; } + private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { MesenMsgBox.Show("UnexpectedError", MessageBoxButtons.OK, MessageBoxIcon.Error, e.Exception.ToString()); @@ -58,6 +60,10 @@ namespace Mesen.GUI private static void Main(string[] args) { try { + if(Type.GetType("Mono.Runtime") != null) { + Program.IsMono = true; + } + AppDomain.CurrentDomain.AssemblyResolve += LoadAssemblies; Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += Application_ThreadException; diff --git a/GUI.NET/Properties/Resources.resx b/GUI.NET/Properties/Resources.resx index a57f345f..0f26b54d 100644 --- a/GUI.NET/Properties/Resources.resx +++ b/GUI.NET/Properties/Resources.resx @@ -119,7 +119,7 @@ - ..\resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -128,7 +128,7 @@ ..\Resources\NextArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\resources\previousarrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\PreviousArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\audio-x-generic.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/InteropDLL/ConsoleWrapper.cpp b/InteropDLL/ConsoleWrapper.cpp index efd85014..8eb9e18c 100644 --- a/InteropDLL/ConsoleWrapper.cpp +++ b/InteropDLL/ConsoleWrapper.cpp @@ -15,15 +15,24 @@ #include "../Core/SoundMixer.h" #include "../Core/RomLoader.h" #include "../Core/NsfMapper.h" -#include "../Windows/Renderer.h" -#include "../Windows/SoundManager.h" -#include "../Windows/WindowsKeyManager.h" +#include "../Core/IRenderingDevice.h" +#include "../Core/IAudioDevice.h" -NES::Renderer *_renderer = nullptr; -SoundManager *_soundManager = nullptr; +#ifdef WIN32 + #include "../Windows/Renderer.h" + #include "../Windows/SoundManager.h" + #include "../Windows/WindowsKeyManager.h" +#else + #include "../SDL/SdlRenderer.h" + #include "../SDL/SdlSoundManager.h" + #include "../SDL/SdlKeyManager.h" +#endif + +IRenderingDevice *_renderer = nullptr; +IAudioDevice *_soundManager = nullptr; IKeyManager *_keyManager = nullptr; -HWND _windowHandle = nullptr; -HWND _viewerHandle = nullptr; +void* _windowHandle = nullptr; +void* _viewerHandle = nullptr; string _returnString; string _logString; AutoRomTest *_autoRomTest = nullptr; @@ -61,24 +70,37 @@ namespace InteropEmu { DllExport uint32_t __stdcall GetMesenVersion() { return EmulationSettings::GetMesenVersion(); } - DllExport void __stdcall InitializeEmu(const char* homeFolder, HWND windowHandle, HWND dxViewerHandle, bool noAudio, bool noVideo, bool noInput) + DllExport void __stdcall InitializeEmu(const char* homeFolder, void *windowHandle, void *viewerHandle, bool noAudio, bool noVideo, bool noInput) { FolderUtilities::SetHomeFolder(homeFolder); - if(windowHandle != nullptr && dxViewerHandle != nullptr) { + if(windowHandle != nullptr && viewerHandle != nullptr) { _windowHandle = windowHandle; - _viewerHandle = dxViewerHandle; + _viewerHandle = viewerHandle; if(!noVideo) { - _renderer = new NES::Renderer(_viewerHandle); + #ifdef _WIN32 + _renderer = new NES::Renderer((HWND)_viewerHandle); + #else + _renderer = new SdlRenderer(_viewerHandle); + #endif } if(!noAudio) { - _soundManager = new SoundManager(_windowHandle); + #ifdef _WIN32 + _soundManager = new SoundManager((HWND)_windowHandle); + #else + _soundManager = new SdlSoundManager(); + #endif } if(!noInput) { - _keyManager = new WindowsKeyManager(_windowHandle); + #ifdef _WIN32 + _keyManager = new WindowsKeyManager((HWND)_windowHandle); + #else + _keyManager = new SdlKeyManager(); + #endif + ControlManager::RegisterKeyManager(_keyManager); } } diff --git a/InteropDLL/stdafx.h b/InteropDLL/stdafx.h index f1dae681..d1b8c69b 100644 --- a/InteropDLL/stdafx.h +++ b/InteropDLL/stdafx.h @@ -5,8 +5,6 @@ #pragma once -#include "targetver.h" - #if _WIN32 || _WIN64 #if _WIN64 #define ENVIRONMENT64 @@ -35,14 +33,18 @@ #define MESEN_LIBRARY_SUFFIX "x64.lib" #endif -#pragma comment(lib, "Core.lib") -#pragma comment(lib, "Utilities.lib") -#pragma comment(lib, "Windows.lib") -#pragma comment(lib, "SevenZip.lib") -#ifdef PGO - #pragma comment(lib, "../Dependencies/DirectXTK." MESEN_LIBRARY_DEBUG_SUFFIX ".Static." MESEN_LIBRARY_SUFFIX) +#if _WIN32 || _WIN64 + #pragma comment(lib, "Core.lib") + #pragma comment(lib, "Utilities.lib") + #pragma comment(lib, "Windows.lib") + #pragma comment(lib, "SevenZip.lib") + #ifdef PGO + #pragma comment(lib, "../Dependencies/DirectXTK." MESEN_LIBRARY_DEBUG_SUFFIX ".Static." MESEN_LIBRARY_SUFFIX) + #else + #pragma comment(lib, "../Dependencies/DirectXTK." MESEN_LIBRARY_DEBUG_SUFFIX "." MESEN_LIBRARY_SUFFIX) + #endif + #define DllExport __declspec(dllexport) #else - #pragma comment(lib, "../Dependencies/DirectXTK." MESEN_LIBRARY_DEBUG_SUFFIX "." MESEN_LIBRARY_SUFFIX) -#endif - -#define DllExport __declspec(dllexport) \ No newline at end of file + #define __stdcall + #define DllExport __attribute__((visibility("default"))) +#endif \ No newline at end of file diff --git a/InteropDLL/targetver.h b/InteropDLL/targetver.h deleted file mode 100644 index 87c0086d..00000000 --- a/InteropDLL/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/Utilities/HQX/hq2x.cpp b/Utilities/HQX/hq2x.cpp index ee34da75..41f60a51 100644 --- a/Utilities/HQX/hq2x.cpp +++ b/Utilities/HQX/hq2x.cpp @@ -18,7 +18,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #include #include "common.h" diff --git a/Utilities/HQX/hq3x.cpp b/Utilities/HQX/hq3x.cpp index 5aafba5a..1f2ed2e6 100644 --- a/Utilities/HQX/hq3x.cpp +++ b/Utilities/HQX/hq3x.cpp @@ -18,7 +18,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #include #include "common.h" diff --git a/Utilities/HQX/hq4x.cpp b/Utilities/HQX/hq4x.cpp index 78b06a74..ce28e4c1 100644 --- a/Utilities/HQX/hq4x.cpp +++ b/Utilities/HQX/hq4x.cpp @@ -18,7 +18,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #include #include "common.h" diff --git a/Utilities/HQX/init.cpp b/Utilities/HQX/init.cpp index 8f71198b..59cbb3b9 100644 --- a/Utilities/HQX/init.cpp +++ b/Utilities/HQX/init.cpp @@ -16,7 +16,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #include #include "hqx.h" diff --git a/Utilities/IpsPatcher.cpp b/Utilities/IpsPatcher.cpp index 4302d9c0..15d8acb0 100644 --- a/Utilities/IpsPatcher.cpp +++ b/Utilities/IpsPatcher.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include +#include #include "IpsPatcher.h" class IpsRecord diff --git a/Utilities/KreedSaiEagle/2xSai.cpp b/Utilities/KreedSaiEagle/2xSai.cpp index 843893ab..5eeab859 100644 --- a/Utilities/KreedSaiEagle/2xSai.cpp +++ b/Utilities/KreedSaiEagle/2xSai.cpp @@ -16,7 +16,9 @@ * If not, see . */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #define twoxsai_interpolate_xrgb8888(A, B) ((((A) & 0xFEFEFEFE) >> 1) + (((B) & 0xFEFEFEFE) >> 1) + ((A) & (B) & 0x01010101)) diff --git a/Utilities/KreedSaiEagle/Super2xSai.cpp b/Utilities/KreedSaiEagle/Super2xSai.cpp index d631dccf..0e323114 100644 --- a/Utilities/KreedSaiEagle/Super2xSai.cpp +++ b/Utilities/KreedSaiEagle/Super2xSai.cpp @@ -16,7 +16,9 @@ * If not, see . */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #define supertwoxsai_interpolate_xrgb8888(A, B) ((((A) & 0xFEFEFEFE) >> 1) + (((B) & 0xFEFEFEFE) >> 1) + ((A) & (B) & 0x01010101)) diff --git a/Utilities/KreedSaiEagle/SuperEagle.cpp b/Utilities/KreedSaiEagle/SuperEagle.cpp index 7751d563..b022a1f9 100644 --- a/Utilities/KreedSaiEagle/SuperEagle.cpp +++ b/Utilities/KreedSaiEagle/SuperEagle.cpp @@ -16,7 +16,9 @@ * If not, see . */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #define supereagle_interpolate_xrgb8888(A, B) ((((A) & 0xFEFEFEFE) >> 1) + (((B) & 0xFEFEFEFE) >> 1) + ((A) & (B) & 0x01010101)) diff --git a/Utilities/PNGHelper.cpp b/Utilities/PNGHelper.cpp index 5caf8b95..a28f6435 100644 --- a/Utilities/PNGHelper.cpp +++ b/Utilities/PNGHelper.cpp @@ -307,7 +307,7 @@ int PNGHelper::DecodePNG(vector& out_image, unsigned long& image_ readPngHeader(&in[0], size); if(error) return; size_t pos = 33; //first byte of the first chunk after the header std::vector idat; //the data from idat chunks - bool IEND = false, known_type = true; + bool IEND = false; info.key_defined = false; while(!IEND) //loop through the chunks, ignoring unknown chunks and stopping at IEND chunk. IDAT data is put at the start of the in buffer { @@ -359,7 +359,6 @@ int PNGHelper::DecodePNG(vector& out_image, unsigned long& image_ { if(!(in[pos + 0] & 32)) { error = 69; return; } //error: unknown critical chunk (5th bit of first byte of chunk type is 0) pos += (chunkLength + 4); //skip 4 letters and uninterpreted data of unimplemented chunk - known_type = false; } pos += 4; //step over CRC (which is ignored) } diff --git a/Utilities/SZReader.cpp b/Utilities/SZReader.cpp index 65fda091..d78f4352 100644 --- a/Utilities/SZReader.cpp +++ b/Utilities/SZReader.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include +#include #include "SZReader.h" +#include "UTF8Util.h" #include "../SevenZip/7zMemBuffer.h" SZReader::SZReader() @@ -66,8 +68,6 @@ vector SZReader::InternalGetFileList() if(_initialized) { for(uint32_t i = 0; i < _archive.NumFiles; i++) { - size_t offset = 0; - size_t outSizeProcessed = 0; unsigned isDir = SzArEx_IsDir(&_archive, i); if(isDir) { continue; diff --git a/Utilities/Scale2x/scale2x.cpp b/Utilities/Scale2x/scale2x.cpp index 005e00b8..d2380d44 100644 --- a/Utilities/Scale2x/scale2x.cpp +++ b/Utilities/Scale2x/scale2x.cpp @@ -22,7 +22,9 @@ * http://www.scale2x.it/ */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #if HAVE_CONFIG_H diff --git a/Utilities/Scale2x/scale2x.h b/Utilities/Scale2x/scale2x.h index df1b72ca..e1431c4f 100644 --- a/Utilities/Scale2x/scale2x.h +++ b/Utilities/Scale2x/scale2x.h @@ -33,32 +33,5 @@ void scale2x4_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst void scale2x4_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); void scale2x4_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - -void scale2x_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count); -void scale2x_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); -void scale2x_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); - -void scale2x3_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count); -void scale2x3_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); -void scale2x3_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); - -void scale2x4_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count); -void scale2x4_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); -void scale2x4_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); - -/** - * End the use of the MMX instructions. - * This function must be called before using any floating-point operations. - */ -static inline void scale2x_mmx_emms(void) -{ - __asm__ __volatile__ ( - "emms" - ); -} - -#endif - #endif diff --git a/Utilities/Scale2x/scale3x.cpp b/Utilities/Scale2x/scale3x.cpp index 3bee221d..3ac690f9 100644 --- a/Utilities/Scale2x/scale3x.cpp +++ b/Utilities/Scale2x/scale3x.cpp @@ -22,7 +22,9 @@ * http://www.scale2x.it/ */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #if HAVE_CONFIG_H diff --git a/Utilities/Scale2x/scalebit.cpp b/Utilities/Scale2x/scalebit.cpp index 3c305982..2eb7efc8 100644 --- a/Utilities/Scale2x/scalebit.cpp +++ b/Utilities/Scale2x/scalebit.cpp @@ -23,7 +23,9 @@ * http://www.scale2x.it/ */ +#ifdef _WIN32 #include "stdafx.h" +#endif #include "../stdafx.h" #if HAVE_CONFIG_H @@ -50,15 +52,9 @@ static inline void stage_scale2x(void* dst0, void* dst1, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) { switch (pixel) { -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - case 1 : scale2x_8_mmx(SSDST(8,0), SSDST(8,1), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; - case 2 : scale2x_16_mmx(SSDST(16,0), SSDST(16,1), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; - case 4 : scale2x_32_mmx(SSDST(32,0), SSDST(32,1), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; -#else case 1 : scale2x_8_def(SSDST(8,0), SSDST(8,1), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; case 2 : scale2x_16_def(SSDST(16,0), SSDST(16,1), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; case 4 : scale2x_32_def(SSDST(32,0), SSDST(32,1), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; -#endif } } @@ -68,15 +64,9 @@ static inline void stage_scale2x(void* dst0, void* dst1, const void* src0, const static inline void stage_scale2x3(void* dst0, void* dst1, void* dst2, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) { switch (pixel) { -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - case 1 : scale2x3_8_mmx(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; - case 2 : scale2x3_16_mmx(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; - case 4 : scale2x3_32_mmx(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; -#else case 1 : scale2x3_8_def(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; case 2 : scale2x3_16_def(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; case 4 : scale2x3_32_def(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; -#endif } } @@ -86,15 +76,9 @@ static inline void stage_scale2x3(void* dst0, void* dst1, void* dst2, const void static inline void stage_scale2x4(void* dst0, void* dst1, void* dst2, void* dst3, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) { switch (pixel) { -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - case 1 : scale2x4_8_mmx(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSDST(8,3), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; - case 2 : scale2x4_16_mmx(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSDST(16,3), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; - case 4 : scale2x4_32_mmx(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSDST(32,3), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; -#else case 1 : scale2x4_8_def(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSDST(8,3), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; case 2 : scale2x4_16_def(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSDST(16,3), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; case 4 : scale2x4_32_def(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSDST(32,3), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; -#endif } } @@ -162,10 +146,6 @@ static void scale2x(void* void_dst, unsigned dst_slice, const void* void_src, un } stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width); - -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - scale2x_mmx_emms(); -#endif } /** @@ -207,10 +187,6 @@ static void scale2x3(void* void_dst, unsigned dst_slice, const void* void_src, u } stage_scale2x3(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width); - -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - scale2x_mmx_emms(); -#endif } /** @@ -252,10 +228,6 @@ static void scale2x4(void* void_dst, unsigned dst_slice, const void* void_src, u } stage_scale2x4(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width); - -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - scale2x_mmx_emms(); -#endif } /** @@ -378,10 +350,6 @@ static void scale4x_buf(void* void_dst, unsigned dst_slice, void* void_mid, unsi dst = SCDST(4); stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(3), SCMID(4), SCMID(5), SCMID(5), pixel, width); - -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - scale2x_mmx_emms(); -#endif } /** diff --git a/Utilities/UPnPPortMapper.cpp b/Utilities/UPnPPortMapper.cpp index b64e58f8..6a942ce5 100644 --- a/Utilities/UPnPPortMapper.cpp +++ b/Utilities/UPnPPortMapper.cpp @@ -148,9 +148,9 @@ bool UPnPPortMapper::RemoveNATPortMapping(uint16_t externalPort, IPProtocol prot return false; } -wstring UPnPPortMapper::GetLocalIP() +vector UPnPPortMapper::GetLocalIPs() { - return L""; + return vector(); } #endif \ No newline at end of file diff --git a/Utilities/UTF8Util.cpp b/Utilities/UTF8Util.cpp index f3ea1a60..3739594b 100644 --- a/Utilities/UTF8Util.cpp +++ b/Utilities/UTF8Util.cpp @@ -25,4 +25,20 @@ namespace utf8 { return strTo; } } +#else +#include +#include +namespace utf8 { + std::wstring utf8::decode(const std::string &str) + { + std::wstring_convert> myconv; + return myconv.from_bytes(str); + } + + std::string utf8::encode(const std::wstring &wstr) + { + std::wstring_convert> myconv; + return myconv.to_bytes(wstr); + } +} #endif \ No newline at end of file diff --git a/Utilities/UTF8Util.h b/Utilities/UTF8Util.h index 36b2ff7f..7437def8 100644 --- a/Utilities/UTF8Util.h +++ b/Utilities/UTF8Util.h @@ -3,14 +3,14 @@ #include namespace utf8 { -#ifdef _WIN32 class utf8 { public: static std::wstring decode(const std::string &str); static std::string encode(const std::wstring &wstr); }; - + +#ifdef _WIN32 class ifstream : public std::ifstream { public: diff --git a/Utilities/ZipWriter.cpp b/Utilities/ZipWriter.cpp index 28b39aec..c427c6d3 100644 --- a/Utilities/ZipWriter.cpp +++ b/Utilities/ZipWriter.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include +#include #include #include "ZipWriter.h" #include "FolderUtilities.h"