Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Commit

Permalink
Version Update: 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SourMesen committed Jul 19, 2019
1 parent 3992486 commit cf33b46
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Core/EmuSettings.cpp
Expand Up @@ -14,9 +14,9 @@ EmuSettings::EmuSettings()

uint32_t EmuSettings::GetVersion()
{
//Version 0.1.0
//Version 0.2.0
uint16_t major = 0;
uint8_t minor = 1;
uint8_t minor = 2;
uint8_t revision = 0;
return (major << 16) | (minor << 8) | revision;
}
Expand Down
6 changes: 6 additions & 0 deletions UI/Forms/frmMain.cs
Expand Up @@ -57,6 +57,8 @@ protected override void OnShown(EventArgs e)
base.OnShown(e);

EmuApi.InitDll();
bool showUpgradeMessage = UpdateHelper.PerformUpgrade();

ConfigManager.Config.Video.ApplyConfig();
EmuApi.InitializeEmu(ConfigManager.HomeFolder, Handle, ctrlRenderer.Handle, false, false, false);

Expand Down Expand Up @@ -89,6 +91,10 @@ protected override void OnShown(EventArgs e)
}));
});

if(showUpgradeMessage) {
MesenMsgBox.Show("UpgradeSuccess", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

if(ConfigManager.Config.Preferences.AutomaticallyCheckForUpdates) {
UpdateHelper.CheckForUpdates(true);
}
Expand Down
8 changes: 4 additions & 4 deletions UI/Properties/AssemblyInfo.cs
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mesen-S (Alpha)")]
[assembly: AssemblyTitle("Mesen-S (Beta)")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mesen-S")]
[assembly: AssemblyProduct("Mesen-S (Alpha)")]
[assembly: AssemblyProduct("Mesen-S (Beta)")]
[assembly: AssemblyCopyright("Copyright © 2019 M. Bibaud")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyFileVersion("0.2.0.0")]
21 changes: 20 additions & 1 deletion UI/Updates/UpdateHelper.cs
@@ -1,4 +1,5 @@
using Mesen.GUI.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -12,6 +13,24 @@ namespace Mesen.GUI.Updates
{
public static class UpdateHelper
{
public static bool PerformUpgrade()
{
Version newVersion = EmuApi.GetMesenVersion();
Version oldVersion = new Version(ConfigManager.Config.Version);
if(oldVersion < newVersion) {
//Upgrade
if(oldVersion <= new Version("0.1.0")) {
ConfigManager.Config.Audio.MasterVolume = 100;
}

ConfigManager.Config.Version = EmuApi.GetMesenVersion().ToString();
ConfigManager.ApplyChanges();

return true;
}
return false;
}

public static void CheckForUpdates(bool silent)
{
Task.Run(() => {
Expand Down

0 comments on commit cf33b46

Please sign in to comment.