Rename some remaining Mesen-S references to Mesen, prevent loading movies/states from older versions, move default home folder to "Mesen2" (for now)

This commit is contained in:
Sour 2022-12-28 15:50:29 +09:00
parent b63ea3a4d9
commit 4414723ed5
20 changed files with 38 additions and 41 deletions

View file

@ -132,6 +132,13 @@ bool MesenMovie::Play(VirtualFile &file)
auto emuLock = _emu->AcquireLock();
ParseSettings(settingsData);
string version = LoadString(_settings, MovieKeys::MesenVersion);
if(version.size() < 2 || version.substr(0, 2) == "0." || version.substr(0, 2) == "1.") {
//Prevent loading movies from Mesen/Mesen-S version 0.x.x or 1.x.x
MessageManager::DisplayMessage("Movies", "MovieIncompatibleVersion");
return false;
}
if(LoadInt(_settings, MovieKeys::MovieFormatVersion, 0) < 2) {
MessageManager::DisplayMessage("Movies", "MovieIncompatibleVersion");

View file

@ -318,7 +318,8 @@ int32_t SaveStateManager::GetSaveStatePreview(string saveStatePath, uint8_t* png
stream.read(header, 3);
if(memcmp(header, "MSS", 3) == 0) {
uint32_t emuVersion = ReadValue(stream);
if(emuVersion > _emu->GetSettings()->GetVersion()) {
if(emuVersion > _emu->GetSettings()->GetVersion() || emuVersion <= 0x10000) {
//Prevent loading files created with a newer version of Mesen or with Mesen 0.9.x or lower.
return -1;
}

View file

@ -12,7 +12,7 @@ private:
atomic<uint32_t> _lastIndex;
Emulator* _emu;
string GetStateFilepath(int stateIndex);
string GetStateFilepath(int stateIndex);
void SaveVideoData(ostream& stream);
bool GetVideoData(vector<uint8_t>& out, RenderedFrame& frame, istream& stream);

View file

@ -70,7 +70,7 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetName>MesenSCore</TargetName>
<TargetName>MesenCore</TargetName>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
@ -78,7 +78,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>MesenSCore</TargetName>
<TargetName>MesenCore</TargetName>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
@ -86,7 +86,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Profile|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>MesenSCore</TargetName>
<TargetName>MesenCore</TargetName>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
@ -94,7 +94,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PGO Optimize|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>MesenSCore</TargetName>
<TargetName>MesenCore</TargetName>
<OutDir>$(SolutionDir)\bin\$(PlatformTarget)\PGO Profile\</OutDir>
<IntDir>obj\$(Platform)\PGO Profile\</IntDir>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

View file

@ -25,7 +25,7 @@ namespace Mesen.Config
{
get
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Mesen-SCore");
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Mesen2");
}
}

View file

@ -14,7 +14,7 @@ namespace Mesen.Interop
{
public class ConfigApi
{
private const string DllPath = "MesenSCore.dll";
private const string DllPath = EmuApi.DllName;
[DllImport(DllPath)] public static extern void SetVideoConfig(InteropVideoConfig config);
[DllImport(DllPath)] public static extern void SetAudioConfig(InteropAudioConfig config);

View file

@ -15,7 +15,7 @@ namespace Mesen.Interop
{
public class DebugApi
{
private const string DllPath = "MesenSCore.dll";
private const string DllPath = EmuApi.DllName;
[DllImport(DllPath)] public static extern void InitializeDebugger();
[DllImport(DllPath)] public static extern void ReleaseDebugger();

View file

@ -15,7 +15,9 @@ namespace Mesen.Interop
{
public class EmuApi
{
private const string DllPath = "MesenSCore.dll";
public const string DllName = "MesenCore.dll";
private const string DllPath = EmuApi.DllName;
[DllImport(DllPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool TestDll();
[DllImport(DllPath)] public static extern void InitDll();

View file

@ -10,7 +10,7 @@ namespace Mesen.Interop
{
public class HistoryApi
{
private const string DllPath = "MesenSCore.dll";
private const string DllPath = EmuApi.DllName;
[DllImport(DllPath)] public static extern void HistoryViewerInitialize(IntPtr windowHandle, IntPtr viewerHandle);
[DllImport(DllPath)] public static extern void HistoryViewerRelease();

View file

@ -8,7 +8,7 @@ namespace Mesen.Interop
{
public class InputApi
{
private const string DllPath = "MesenSCore.dll";
private const string DllPath = EmuApi.DllName;
[DllImport(DllPath)] public static extern void SetKeyState(UInt16 scanCode, [MarshalAs(UnmanagedType.I1)]bool pressed);
[DllImport(DllPath)] public static extern void ResetKeyState();

View file

@ -7,7 +7,7 @@ namespace Mesen.Interop
{
public class NetplayApi
{
private const string DllPath = "MesenSCore.dll";
private const string DllPath = EmuApi.DllName;
[DllImport(DllPath)] public static extern void StartServer(UInt16 port, [MarshalAs(UnmanagedType.LPUTF8Str)]string password);
[DllImport(DllPath)] public static extern void StopServer();

View file

@ -10,7 +10,7 @@ namespace Mesen.Interop
{
class RecordApi
{
private const string DllPath = "MesenSCore.dll";
private const string DllPath = EmuApi.DllName;
[DllImport(DllPath)] public static extern void AviRecord([MarshalAs(UnmanagedType.LPUTF8Str)]string filename, VideoCodec codec, UInt32 compressionLevel);
[DllImport(DllPath)] public static extern void AviStop();

View file

@ -9,7 +9,7 @@ namespace Mesen.Interop
{
class TestApi
{
private const string DllPath = "MesenSCore.dll";
private const string DllPath = EmuApi.DllName;
[DllImport(DllPath)] public static extern Int32 RunRecordedTest([MarshalAs(UnmanagedType.LPUTF8Str)]string filename, [MarshalAs(UnmanagedType.I1)]bool inBackground);
[DllImport(DllPath)] public static extern void RomTestRecord([MarshalAs(UnmanagedType.LPUTF8Str)]string filename, [MarshalAs(UnmanagedType.I1)]bool reset);

View file

@ -1426,19 +1426,6 @@
<UserControls>
</UserControls>
<Messages>
<Message ID="FilterAll">All Files (*.*)|*.*</Message>
<Message ID="FilterZipFiles">Zip files (*.zip)|*.zip</Message>
<Message ID="FilterMovie">Movie files (*.msm)|*.msm|All Files (*.*)|*.*</Message>
<Message ID="FilterWave">Wave files (*.wav)|*.wav|All Files (*.*)|*.*</Message>
<Message ID="FilterAvi">Avi files (*.avi)|*.avi|All Files (*.*)|*.*</Message>
<Message ID="FilterGif">GIF files (*.gif)|*.gif|All Files (*.*)|*.*</Message>
<Message ID="FilterPalette">Palette Files (*.pal)|*.pal|All Files (*.*)|*.*</Message>
<Message ID="FilterRom">All supported formats (*.sfc, *.gb, *.gbc, *.bs, *.spc, *.zip, *.7z)|*.SFC;*.SMC;*.SWC;*.FIG;*.ZIP;*.7Z;*.SPC;*.BS;*.GB;*.GBC|SNES Roms (*.sfc)|*.SFC;*.SMC;*.SWC;*.FIG;*.BS|Gameboy Roms (*.gb, *.gbc)|*.GB;*.GBC|SPC Sound Files (*.spc)|*.SPC|ZIP Archives (*.zip)|*.ZIP|7-Zip Archives (*.7z)|*.7z|All (*.*)|*.*</Message>
<Message ID="FilterTest">Test files (*.mtp)|*.mtp|All (*.*)|*.*</Message>
<Message ID="FilterCheat">All supported formats (*.cht, *.xml)|*.cht;*.xml</Message>
<Message ID="FilterSavestate">Mesen Savestates (*.mss)|*.mss|All files (*.*)|*.*</Message>
<Message ID="FilterTapeFiles">Family Basic Tape files (*.fbt)|*.fbt|All Files (*.*)|*.*</Message>
<Message ID="LastSession">Last Session</Message>
<Message ID="AutoSave">Auto-save</Message>
<Message ID="SlotNumber">Slot #{0}</Message>
@ -1476,7 +1463,7 @@
<Message ID="HelpFullscreen">/fullscreen - Start Mesen in fullscreen mode</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings)</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.msm" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Resumes the game in the state it was left in when it was last played.</Message>
<Message ID="Resume">Resume</Message>
@ -1525,8 +1512,8 @@
<Message ID="PatchAndReset">Patch and reset the current game?</Message>
<Message ID="SelectRomIps">Please select a ROM for this patch file.</Message>
<Message ID="UnableToDownload">Unable to download file. Check your internet connection and try again.&#xA;&#xA;Details:&#xA;{0}</Message>
<Message ID="UnableToStartMissingDependencies">Mesen could not launch because it was unable to load MesenSCore.dll due to missing dependencies.</Message>
<Message ID="UnableToStartMissingFiles">Mesen was unable to start due to missing files.&#xA;&#xA;Error: MesenSCore.dll is missing.</Message>
<Message ID="UnableToStartMissingDependencies">Mesen could not launch because it was unable to load MesenCore.dll due to missing dependencies.</Message>
<Message ID="UnableToStartMissingFiles">Mesen was unable to start due to missing files.&#xA;&#xA;Error: MesenCore.dll is missing.</Message>
<Message ID="UnexpectedError">An unexpected error has occurred.&#xA;&#xA;Error details:&#xA;{0}</Message>
<Message ID="UpdateDownloadFailed">Download failed - the file appears to be corrupted. Please visit the Mesen website to download the latest version manually.</Message>
<Message ID="UpgradeSuccess">Upgrade completed successfully.</Message>

View file

@ -522,13 +522,13 @@
<EmbeddedResource Include="Utilities\DipSwitchDefinitions.xml" />
</ItemGroup>
<Target Name="PreBuildWindows" BeforeTargets="PreBuildEvent" Condition="'$(RuntimeIdentifier)'!='linux-x64'">
<Exec Command="cd $(OutDir)&#xD;&#xA;rd Dependencies /s /q&#xD;&#xA;md Dependencies&#xD;&#xA;xcopy /s $(ProjectDir)Dependencies\* Dependencies&#xD;&#xA;copy libHarfBuzzSharp.dll Dependencies&#xD;&#xA;copy libSkiaSharp.dll Dependencies&#xD;&#xA;copy MesenSCore.dll Dependencies&#xD;&#xA;cd Dependencies&#xD;&#xA;del ..\Dependencies.zip&#xD;&#xA;powershell Compress-Archive -Path * -DestinationPath '..\Dependencies.zip' -Force&#xD;&#xA;copy ..\Dependencies.zip $(ProjectDir)" />
<Exec Command="cd $(OutDir)&#xD;&#xA;rd Dependencies /s /q&#xD;&#xA;md Dependencies&#xD;&#xA;xcopy /s $(ProjectDir)Dependencies\* Dependencies&#xD;&#xA;copy libHarfBuzzSharp.dll Dependencies&#xD;&#xA;copy libSkiaSharp.dll Dependencies&#xD;&#xA;copy MesenCore.dll Dependencies&#xD;&#xA;cd Dependencies&#xD;&#xA;del ..\Dependencies.zip&#xD;&#xA;powershell Compress-Archive -Path * -DestinationPath '..\Dependencies.zip' -Force&#xD;&#xA;copy ..\Dependencies.zip $(ProjectDir)" />
</Target>
<PropertyGroup Condition="'$(RuntimeIdentifier)'=='linux-x64'">
<OutputPath>..\bin\x64\Release\</OutputPath>
</PropertyGroup>
<Target Name="PreBuildLinux" BeforeTargets="PreBuildEvent" Condition="'$(RuntimeIdentifier)'=='linux-x64'">
<Exec Command="cd $(OutDir)&#xD;&#xA;rm Dependencies -r&#xD;&#xA;mkdir Dependencies&#xD;&#xA;cp -R $(ProjectDir)/Dependencies/* Dependencies&#xD;&#xA;cp libHarfBuzzSharp.so Dependencies&#xD;&#xA;cp libSkiaSharp.so Dependencies&#xD;&#xA;cp libMesenSCore.dll Dependencies&#xD;&#xA;cd Dependencies&#xD;&#xA;rm ../Dependencies.zip&#xD;&#xA;zip -r ../Dependencies.zip *&#xD;&#xA;cp ../Dependencies.zip $(ProjectDir)" />
<Exec Command="cd $(OutDir)&#xD;&#xA;rm Dependencies -r&#xD;&#xA;mkdir Dependencies&#xD;&#xA;cp -R $(ProjectDir)/Dependencies/* Dependencies&#xD;&#xA;cp libHarfBuzzSharp.so Dependencies&#xD;&#xA;cp libSkiaSharp.so Dependencies&#xD;&#xA;cp libMesenCore.dll Dependencies&#xD;&#xA;cd Dependencies&#xD;&#xA;rm ../Dependencies.zip&#xD;&#xA;zip -r ../Dependencies.zip *&#xD;&#xA;cp ../Dependencies.zip $(ProjectDir)" />
</Target>
</Project>

View file

@ -15,7 +15,7 @@ namespace Mesen.Utilities
{
public const string RomExt = "[[ROMFILES]]";
public const string FirmwareExt = "[[FIRMWAREFILES]]";
public const string MesenMovieExt = "msm";
public const string MesenMovieExt = "mmo";
public const string TblExt = "tbl";
public const string PaletteExt = "pal";
public const string TraceExt = "txt";
@ -46,13 +46,13 @@ namespace Mesen.Utilities
List<FilePickerFileType> filter = new List<FilePickerFileType>();
foreach(string ext in extensions) {
if(ext == FileDialogHelper.RomExt) {
filter.Add(new FilePickerFileType("All ROM Files") { Patterns = new List<string>() { "*.sfc", "*.fig", "*.smc", "*.spc", "*.nes", "*.fds", "*.unif", "*.unf", "*.studybox", "*.nsf", "*.nsfe", "*.gb", "*.gbc", "*.gbs", "*.pce", "*.sgx", "*.cue", "*.hes", "*.zip", "*.7z" } });
filter.Add(new FilePickerFileType("SNES ROM Files") { Patterns = new List<string>() { "*.sfc", "*.fig", "*.smc", "*.spc" } });
filter.Add(new FilePickerFileType("NES ROM Files") { Patterns = new List<string>() { "*.nes", "*.fds", "*.unif", "*.unf", "*.studybox", "*.nsf", "*.nsfe" } });
filter.Add(new FilePickerFileType("GB ROM Files") { Patterns = new List<string>() { "*.gb", "*.gbc", "*.gbs" } });
filter.Add(new FilePickerFileType("PC Engine ROM Files") { Patterns = new List<string>() { "*.pce", "*.sgx", "*.cue", ".hes" } });
filter.Add(new FilePickerFileType("All ROM files") { Patterns = new List<string>() { "*.sfc", "*.fig", "*.smc", "*.spc", "*.nes", "*.fds", "*.unif", "*.unf", "*.studybox", "*.nsf", "*.nsfe", "*.gb", "*.gbc", "*.gbs", "*.pce", "*.sgx", "*.cue", "*.hes", "*.zip", "*.7z" } });
filter.Add(new FilePickerFileType("SNES ROM files") { Patterns = new List<string>() { "*.sfc", "*.fig", "*.smc", "*.spc" } });
filter.Add(new FilePickerFileType("NES ROM files") { Patterns = new List<string>() { "*.nes", "*.fds", "*.unif", "*.unf", "*.studybox", "*.nsf", "*.nsfe" } });
filter.Add(new FilePickerFileType("GB ROM files") { Patterns = new List<string>() { "*.gb", "*.gbc", "*.gbs" } });
filter.Add(new FilePickerFileType("PC Engine ROM files") { Patterns = new List<string>() { "*.pce", "*.sgx", "*.cue", ".hes" } });
} else if(ext == FileDialogHelper.FirmwareExt) {
filter.Add(new FilePickerFileType("All firmware Files") { Patterns = new List<string>() { "*.sfc", "*.pce", "*.nes", "*.bin", "*.rom" } });
filter.Add(new FilePickerFileType("All firmware files") { Patterns = new List<string>() { "*.sfc", "*.pce", "*.nes", "*.bin", "*.rom" } });
} else {
filter.Add(new FilePickerFileType(ext.ToUpper() + " files") { Patterns = new List<string>() { "*." + ext } });
}

View file

@ -46,7 +46,7 @@ ifneq ($(STATICLINK),false)
endif
OBJFOLDER=obj.$(MESENPLATFORM)
SHAREDLIB=libMesenSCore.dll
SHAREDLIB=libMesenCore.dll
RELEASEFOLDER=bin/$(MESENPLATFORM)/Release
CORESRC := $(shell find Core -name '*.cpp')