AxibugEmuOnline/AxibugEmuOnline.Client/Assets/MyNes.Core/EmuSettings.cs

101 lines
2.3 KiB
C#
Raw Normal View History

2024-07-03 18:15:28 +08:00
using System.IO;
2024-07-03 18:22:22 +08:00
namespace MyNes.Core
2024-07-03 18:15:28 +08:00
{
2024-07-03 18:22:22 +08:00
public class EmuSettings : ISettings
{
public string SnapsFolder = "Snaps";
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public string WavesFolder = "SoundRecords";
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public string SnapsFormat = ".png";
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public bool SnapsReplace;
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public int RegionSetting;
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public string StateFolder = "States";
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public string GameGenieFolder = "GMCodes";
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public string SRAMFolder = "Srams";
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public bool SaveSRAMAtEmuShutdown = true;
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public EmuSettings(string path)
: base(path)
{
}
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
public override void LoadSettings()
{
base.LoadSettings();
if (MyNesMain.WorkingFolder == null)
{
MyNesMain.MakeWorkingFolder();
}
if (SnapsFolder == "Snaps")
{
SnapsFolder = Path.Combine(MyNesMain.WorkingFolder, "Snaps");
}
if (StateFolder == "States")
{
StateFolder = Path.Combine(MyNesMain.WorkingFolder, "States");
}
if (GameGenieFolder == "GMCodes")
{
GameGenieFolder = Path.Combine(MyNesMain.WorkingFolder, "GMCodes");
}
if (SRAMFolder == "Srams")
{
SRAMFolder = Path.Combine(MyNesMain.WorkingFolder, "Srams");
}
if (WavesFolder == "SoundRecords")
{
WavesFolder = Path.Combine(MyNesMain.WorkingFolder, "SoundRecords");
}
try
{
Directory.CreateDirectory(WavesFolder);
}
catch
{
Tracer.WriteError("Cannot create sound records folder !!");
}
try
{
Directory.CreateDirectory(SnapsFolder);
}
catch
{
Tracer.WriteError("Cannot create snaps folder !!");
}
try
{
Directory.CreateDirectory(StateFolder);
}
catch
{
Tracer.WriteError("Cannot create states folder !!");
}
try
{
Directory.CreateDirectory(SRAMFolder);
}
catch
{
Tracer.WriteError("Cannot create srams folder !!");
}
try
{
Directory.CreateDirectory(GameGenieFolder);
}
catch
{
Tracer.WriteError("Cannot create game genie codes folder !!");
}
StateHandler.StateFolder = StateFolder;
}
}
2024-07-03 15:40:13 +08:00
}