Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
Upgrade to VS2019 and C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
SourMesen committed Dec 21, 2019
1 parent fdd9435 commit 58b6dd1
Show file tree
Hide file tree
Showing 21 changed files with 220 additions and 126 deletions.
16 changes: 7 additions & 9 deletions COMPILING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@

#### *Standalone*

1) Open the solution in VS2017
1) Open the solution in Visual Studio 2019
2) Compile as Release/x64 or Release/x86
3) Run

#### *Libretro*

1) Open the solution in VS2017
1) Open the solution in Visual Studio 2019
2) Compile as Libretro/x64 or Libretro/x86
3) Use the "mesen_libretro.dll" file in bin/(x64 or x86)/Libretro/mesen_libretro.dll

Note: It's also possible to build the Libretro core via MINGW by using the makefile in the Libretro subfolder.

### Linux

#### *Standalone*

To compile Mesen under Linux you will need a recent version of clang/gcc. This is because Mesen requires a C++14 compiler, along with support for the filesystem API (C++17). Additionally, Mesen has the following dependencies:
To compile Mesen under Linux you will need clang 7.0+ or gcc 9.0+ (Mesen requires a C++17 compiler with support for the filesystem API.) Additionally, Mesen has the following dependencies:

* Mono 5.18+ (package: mono-devel)
* SDL2 (package: libsdl2-dev)
Expand All @@ -29,9 +31,5 @@ LTO is supported under clang, which gives a large performance boost (25-30%+), s

#### *Libretro*

To compile the libretro core you will need a recent version of clang/gcc. This is because Mesen requires a C++14 compiler, along with support for the filesystem API (C++17).

Running "make libretro" will build the core and put it in "bin/mesen_libretro.(x64 or x86).so".
LTO is supported under clang, which gives a large performance boost (25-30%+), so turning it on is highly recommended (see makefile for details).

**Note:** There is also another makefile in the Libretro folder - this is used by the RetroArch's buildbot to build the core. You can also try using this makefile if you are having issues with the one in the root folder.
To compile the Libretro core you will need a version of clang/gcc that supports C++14.
Run "make" from the "Libretro" subfolder to build the Libretro core.
3 changes: 1 addition & 2 deletions Core/Console.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "stdafx.h"
#include <random>
#include <future>
#include <thread>
#include "Console.h"
#include "CPU.h"
Expand Down Expand Up @@ -624,7 +623,7 @@ void Console::ResetComponents(bool softReset)

_resetRunTimers = true;

std::async(std::launch::async, KeyManager::UpdateDevices);
KeyManager::UpdateDevices();

//This notification MUST be sent before the UpdateInputState() below to allow MovieRecorder to grab the first frame's worth of inputs
_notificationManager->SendNotification(softReset ? ConsoleNotificationType::GameReset : ConsoleNotificationType::GameLoaded);
Expand Down
34 changes: 23 additions & 11 deletions Core/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,74 +47,74 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>Core</RootNamespace>
<ProjectName>Core</ProjectName>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Libretro|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Profile|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Optimize|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Libretro|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Profile|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Optimize|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -158,53 +158,64 @@
<LibraryPath>$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Libretro|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Profile|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Optimize|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\PGO Profile\</OutDir>
<IntDir>obj\$(Platform)\PGO Profile\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Libretro|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Profile|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Optimize|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\PGO Profile\</OutDir>
<IntDir>obj\$(Platform)\PGO Profile\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -404,6 +415,7 @@
<ControlFlowGuard>false</ControlFlowGuard>
<RuntimeTypeInfo>
</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down
3 changes: 2 additions & 1 deletion Core/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "PerformanceTracker.h"
#include "EventManager.h"

const int Debugger::BreakpointTypeCount;
string Debugger::_disassemblerOutput = "";

Debugger::Debugger(shared_ptr<Console> console, shared_ptr<CPU> cpu, shared_ptr<PPU> ppu, shared_ptr<APU> apu, shared_ptr<MemoryManager> memoryManager, shared_ptr<BaseMapper> mapper)
Expand Down Expand Up @@ -1641,6 +1640,8 @@ void Debugger::ProcessEvent(EventType type)
BreakImmediately(BreakSource::BreakOnBusConflict);
}
break;

default: break;
}
}

Expand Down
4 changes: 4 additions & 0 deletions Core/EventManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ void EventManager::DrawEvent(DebugEventInfo &evt, bool drawBackground, uint32_t
bool showEvent = false;
uint32_t color = 0;
switch(evt.Type) {
case DebugEventType::None:
case DebugEventType::BgColorChange:
break;

case DebugEventType::Breakpoint: showEvent = options.ShowMarkedBreakpoints; color = options.BreakpointColor; break;
case DebugEventType::Irq: showEvent = options.ShowIrq; color = options.IrqColor; break;
case DebugEventType::Nmi: showEvent = options.ShowNmi; color = options.NmiColor; break;
Expand Down
6 changes: 3 additions & 3 deletions Core/StudyBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class StudyBox : public BaseMapper
_byteReadDelay = 3355;
_pagePosition++;

if(_pagePosition >= _pageData.size()) {
if(_pagePosition >= (int32_t)_pageData.size()) {
_pageFound = false;
_inDataRegion = false;
//_motorDisabled = true;
Expand All @@ -129,7 +129,7 @@ class StudyBox : public BaseMapper
}

_console->GetCpu()->ClearIrqSource(IRQSource::External);
if(_pagePosition >= 0 && _pagePosition < _pageData.size()) {
if(_pagePosition >= 0 && _pagePosition < (int32_t)_pageData.size()) {
//MessageManager::Log("Read: " + HexUtilities::ToHex(_pageData[_pagePosition]));
return _pageData[_pagePosition];
}
Expand Down Expand Up @@ -222,7 +222,7 @@ class StudyBox : public BaseMapper
_seekPageDelay = 3000000;
_motorDisabled = false;
} else if(_command == 0x86) {
while(_pagePosition < _pageData.size() && _pageData[_pagePosition] != 0xC5) {
while(_pagePosition < (int32_t)_pageData.size() && _pageData[_pagePosition] != 0xC5) {
_pagePosition++;
}
_pagePosition--;
Expand Down
Loading

0 comments on commit 58b6dd1

Please sign in to comment.