This commit is contained in:
SuuperW 2025-07-30 13:15:11 -05:00 committed by GitHub
commit f414b3295a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
264 changed files with 3282 additions and 3299 deletions

View File

@ -63,16 +63,16 @@ dotnet_diagnostic.IDE0032.severity = suggestion
# Simplify default expression
dotnet_diagnostic.IDE0034.severity = suggestion
# Use pattern matching to avoid is check followed by a cast (without variable)
dotnet_diagnostic.IDE0038.severity = warning
dotnet_diagnostic.IDE0038.severity = warning # Note that this doesn't work with `dotnet build` but does work inside Visual Studio.
# Use is null check
dotnet_diagnostic.IDE0041.severity = warning
# Deconstruct variable declaration
dotnet_diagnostic.IDE0042.severity = suggestion
# dotnet_diagnostic.IDE0049.severity = error # see SA1121
# Remove unused private member
dotnet_diagnostic.IDE0051.severity = suggestion
dotnet_diagnostic.IDE0051.severity = warning
# Remove unread private member
dotnet_diagnostic.IDE0052.severity = silent # TODO: should be warning imo, but there's too much violation currently
dotnet_diagnostic.IDE0052.severity = warning
# Use compound assignment
dotnet_diagnostic.IDE0054.severity = warning
# Use index operator
@ -97,6 +97,8 @@ dotnet_diagnostic.IDE0071.severity = suggestion
dotnet_diagnostic.IDE0074.severity = suggestion
# Use pattern matching
dotnet_diagnostic.IDE0078.severity = suggestion
# Suppression operator has no effect and can be misinterpreted
dotnet_diagnostic.IDE0080.severity = warning
# Convert typeof to nameof
dotnet_diagnostic.IDE0082.severity = warning
# Use pattern matching (not operator)

View File

@ -23,3 +23,6 @@ d8d42b9f81fa3f84467276a4c6122efd6dc72a95
# Remove line-end whitespace across main solution
605deb682dacec3342c650e76fb77972e5ffbe04
# fix use of mixed spaces and tabs for indentation
95b70f2538fcca81841ba6875b4a062aa53cd4aa

View File

@ -614,7 +614,5 @@ namespace BizHawk.Bizware.Graphics
bmp.UnlockBits(bmpdata);
}
}
}

View File

@ -350,6 +350,5 @@ void main()
if(uSamplerEnable) temp *= texture(uSampler0,vTexcoord0);
FragColor = temp;
}";
}
}

View File

@ -368,4 +368,3 @@ namespace BizHawk.Bizware.Input
}
}
}

View File

@ -87,7 +87,6 @@ namespace BizHawk.Client.Common
catch (Exception e)
{
return e.ToString();
}
if (!response.IsSuccessStatusCode)
{

View File

@ -7,7 +7,7 @@ namespace BizHawk.Client.Common.cheats
public static class GbaGameSharkDecoder
{
private static readonly uint[] GameSharkSeeds = { 0x09F4FBBDU, 0x9681884AU, 0x352027E9U, 0xF3DEE5A7U };
private static readonly uint[] ProActionReplaySeeds = { 0x7AA9648FU, 0x7FAE6994U, 0xC0EFAAD5U, 0x42712C57U };
//private static readonly uint[] ProActionReplaySeeds = { 0x7AA9648FU, 0x7FAE6994U, 0xC0EFAAD5U, 0x42712C57U };
private static string Decrypt(string code)
{
@ -28,21 +28,21 @@ namespace BizHawk.Client.Common.cheats
}
// TODO: When to use this?
private static string DecryptPro(string code)
{
var sum = 0xC6EF3720;
var op1 = uint.Parse(code.Remove(8, 9), NumberStyles.HexNumber);
var op2 = uint.Parse(code.Remove(0, 9), NumberStyles.HexNumber);
//private static string DecryptPro(string code)
//{
// var sum = 0xC6EF3720;
// var op1 = uint.Parse(code.Remove(8, 9), NumberStyles.HexNumber);
// var op2 = uint.Parse(code.Remove(0, 9), NumberStyles.HexNumber);
for (int j = 0; j < 32; ++j)
{
op2 -= ((op1 << 4) + ProActionReplaySeeds[2]) ^ (op1 + sum) ^ ((op1 >> 5) + ProActionReplaySeeds[3]);
op1 -= ((op2 << 4) + ProActionReplaySeeds[0]) ^ (op2 + sum) ^ ((op2 >> 5) + ProActionReplaySeeds[1]);
sum -= 0x9E3779B9;
}
// for (int j = 0; j < 32; ++j)
// {
// op2 -= ((op1 << 4) + ProActionReplaySeeds[2]) ^ (op1 + sum) ^ ((op1 >> 5) + ProActionReplaySeeds[3]);
// op1 -= ((op2 << 4) + ProActionReplaySeeds[0]) ^ (op2 + sum) ^ ((op2 >> 5) + ProActionReplaySeeds[1]);
// sum -= 0x9E3779B9;
// }
return $"{op1:X8} {op2:X8}";
}
// return $"{op1:X8} {op2:X8}";
//}
public static IDecodeResult Decode(string code)
{

View File

@ -1,8 +0,0 @@
namespace BizHawk.Client.Common
{
/// <summary>Indicates that a property is to be saved to config for persistence.</summary>
[AttributeUsage(AttributeTargets.Property)]
public sealed class ConfigPersistAttribute : Attribute
{
}
}

View File

@ -0,0 +1,56 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
namespace BizHawk.Client.Common
{
public interface IConfigPersist
{
public class Provider
{
private Dictionary<string, object> _data;
public Provider(Dictionary<string, object> data)
{
_data = data;
}
public bool Get<T>(string name, ref T value)
{
if (_data.TryGetValue(name, out var val))
{
if (val is string str && typeof(T) != typeof(string))
{
// if a type has a TypeConverter, and that converter can convert to string,
// that will be used in place of object markup by JSON.NET
// but that doesn't work with $type metadata, and JSON.NET fails to fall
// back on regular object serialization when needed. so try to undo a TypeConverter
// operation here
var converter = TypeDescriptor.GetConverter(typeof(T));
val = converter.ConvertFromString(null, CultureInfo.InvariantCulture, str);
}
else if (val is not bool && typeof(T).IsPrimitive)
{
// numeric constants are similarly hosed
val = Convert.ChangeType(val, typeof(T), CultureInfo.InvariantCulture);
}
value = (T)val;
return true;
}
return false;
}
}
/// <summary>
/// Load the provided configuration.
/// </summary>
void LoadConfig(Provider provider);
/// <summary>
/// Return a dictionary representing the current configuration.
/// </summary>
Dictionary<string, object> SaveConfig();
}
}

View File

@ -0,0 +1,6 @@
namespace BizHawk.Client.Common
{ public interface IRestoreDefaults
{
void RestoreDefaults();
}
}

View File

@ -1,9 +0,0 @@
namespace BizHawk.Client.Common
{
/// <summary>Indicates which method of an <see cref="IToolFormAutoConfig"/> is to be called when the generated <c>Restore Defaults</c> menu item is clicked.</summary>
/// <remarks>If not present on any instance method, the menu item will do nothing. If present on multiple, the first will be called.</remarks>
[AttributeUsage(AttributeTargets.Method)]
public sealed class RestoreDefaultsAttribute : Attribute
{
}
}

View File

@ -13,7 +13,6 @@ namespace BizHawk.Client.Common
{
public sealed class FirmwareManager
{
private static readonly FirmwareID NDS_FIRMWARE = new("NDS", "firmware");
private const int DSI_NAND_LENGTH = 251658240 + 64;
public static (byte[] Patched, string ActualHash) PerformPatchInMemory(byte[] @base, in FirmwarePatchOption patchOption)

View File

@ -17,9 +17,6 @@ namespace BizHawk.Client.Common
[Description("A library for manipulating the EmuHawk client UI")]
public sealed class ClientLuaLibrary : LuaLibraryBase
{
[RequiredService]
private IEmulator Emulator { get; set; }
[OptionalService]
private IVideoProvider VideoProvider { get; set; }

View File

@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
@ -10,8 +9,6 @@ namespace BizHawk.Client.Common
[Description("A library for communicating with other programs")]
public sealed class CommLuaLibrary : LuaLibraryBase
{
private readonly IDictionary<Guid, ClientWebSocketWrapper> _websockets = new Dictionary<Guid, ClientWebSocketWrapper>();
public CommLuaLibrary(ILuaLibraries luaLibsImpl, ApiContainer apiContainer, Action<string> logOutputCallback)
: base(luaLibsImpl, apiContainer, logOutputCallback) {}

View File

@ -31,8 +31,8 @@ namespace BizHawk.Client.Common
[LuaMethod("getinput", "Returns a table of buttons pressed on a given frame of the loaded movie")]
public LuaTable GetInput(int frame, int? controller = null)
=> APIs.Movie.GetInput(frame, controller) is IReadOnlyDictionary<string, object> dict
? _th.DictToTable(dict)
: null;
? _th.DictToTable(dict)
: null;
[LuaMethodExample("local stmovget = movie.getinputasmnemonic( 500 );")]
[LuaMethod("getinputasmnemonic", "Returns the input of a given frame of the loaded movie in a raw inputlog string")]

View File

@ -142,6 +142,5 @@ namespace BizHawk.Client.Common.movie.import
// Convert the data for the controllers to a mnemonic and add it as a frame.
Result.Movie.AppendFrame(controllers);
}
}
}

View File

@ -108,9 +108,9 @@ namespace BizHawk.Client.Common
});
}
if (_movieSession.Movie.IsActive() && _movieSession.Movie is ITasMovie)
if (_movieSession.Movie.IsActive() && _movieSession.Movie is ITasMovie tasMovie)
{
bs.PutLump(BinaryStateLump.LagLog, tw => ((ITasMovie) _movieSession.Movie).LagLog.Save(tw));
bs.PutLump(BinaryStateLump.LagLog, tasMovie.LagLog.Save);
}
}
@ -193,9 +193,9 @@ namespace BizHawk.Client.Common
foreach (var (k, v) in bag) _userBag.Add(k, v);
}
if (_movieSession.Movie.IsActive() && _movieSession.Movie is ITasMovie)
if (_movieSession.Movie.IsActive() && _movieSession.Movie is ITasMovie tasMovie)
{
bl.GetLump(BinaryStateLump.LagLog, abort: false, tr => ((ITasMovie) _movieSession.Movie).LagLog.Load(tr));
bl.GetLump(BinaryStateLump.LagLog, abort: false, tasMovie.LagLog.Load);
}
return true;

View File

@ -26,7 +26,7 @@ namespace BizHawk.Client.EmuHawk
private const int NO_COMPRESSION = 0;
private const int BEST_COMPRESSION = 9;
private const int DEFAULT_COMPRESSION = -1;
private const int BEST_SPEED = 1;
//private const int BEST_SPEED = 1;
private static CompressionLevel GetCompressionLevel(int v)
{
@ -803,6 +803,4 @@ namespace BizHawk.Client.EmuHawk
public bool UsesAudio => true;
public bool UsesVideo => true;
}
}

View File

@ -1,5 +1,4 @@
using System.IO;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.Text;
@ -113,33 +112,6 @@ namespace BizHawk.Client.EmuHawk
public string DesiredExtension() => "syncless.txt";
/// <summary>
/// splits the string into chunks of length s
/// </summary>
private static List<string> StringChunkSplit(string s, int len)
{
if (len == 0)
{
throw new ArgumentException("Invalid len", nameof(len));
}
int numChunks = (s.Length + len - 1) / len;
var output = new List<string>(numChunks);
for (int i = 0, j = 0; i < numChunks; i++, j += len)
{
int todo = len;
int remain = s.Length - j;
if (remain < todo)
{
todo = remain;
}
output.Add(s.Substring(j, todo));
}
return output;
}
private string GetAndCreatePathForFrameNum(int index)
{
string subPath = GetPathFragmentForFrameNum(index);

View File

@ -11,7 +11,7 @@ using BizHawk.Emulation.Cores;
namespace BizHawk.Client.EmuHawk
{
public partial class CoreFeatureAnalysis : ToolFormBase, IToolFormAutoConfig
public partial class CoreFeatureAnalysis : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
private class CoreInfo
{
@ -93,8 +93,20 @@ namespace BizHawk.Client.EmuHawk
public static Icon ToolIcon
=> Properties.Resources.Logo;
[ConfigPersist]
private Dictionary<string, CoreInfo> KnownCores { get; set; }
private Dictionary<string, CoreInfo> KnownCores;
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(KnownCores), ref KnownCores);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(KnownCores)] = KnownCores,
};
}
// ReSharper disable once UnusedAutoPropertyAccessor.Local
[RequiredService]

View File

@ -76,6 +76,5 @@ namespace BizHawk.Client.EmuHawk
e.Graphics.DrawString(this.Text, this.Font, br, rc, fmt);
}
}
}
}

View File

@ -196,7 +196,6 @@ namespace BizHawk.Client.EmuHawk
_columns.ColumnsChanged();
Refresh();
}
}
base.OnDoubleClick(e);
@ -1151,7 +1150,7 @@ namespace BizHawk.Client.EmuHawk
{
// do marker drag here
}
else if (ModifierKeys is Keys.Shift && CurrentCell.Column! is { Type: ColumnType.Text } col)
else if (ModifierKeys is Keys.Shift && CurrentCell.Column is { Type: ColumnType.Text } col)
{
if (_selectedItems.Count is not 0)
{
@ -1493,7 +1492,6 @@ namespace BizHawk.Client.EmuHawk
else
{
SelectRow(_lastSelectedRow.Value + 1, true);
}
Refresh();
@ -1570,7 +1568,7 @@ namespace BizHawk.Client.EmuHawk
//jump to above marker with selection courser
if (LetKeysModifySelection)
{
// TODO
}
}
else if (e.IsCtrl(Keys.PageDown))
@ -1578,7 +1576,7 @@ namespace BizHawk.Client.EmuHawk
//jump to below marker with selection courser
if (LetKeysModifySelection)
{
// TODO
}
}
}

View File

@ -68,5 +68,4 @@ namespace BizHawk.Client.EmuHawk
//glyphLoc.Size = new System.Drawing.Size(SystemInformation.MenuCheckSize.Width-1,SystemInformation.MenuCheckSize.Height-1);
}
}
}

View File

@ -83,7 +83,6 @@ namespace BizHawk.Client.EmuHawk.CustomControls
{
_minButtonRowWidth += SetButtonParams(btn3, names[2], def == 3 ? 1 : 4, results[2]) + ButtonSpace;
}
}
/// <summary>

View File

@ -31,7 +31,6 @@ namespace BizHawk.Client.EmuHawk
_once = true;
PerformClick();
}
}
protected override void OnClick(EventArgs e)
@ -80,6 +79,5 @@ namespace BizHawk.Client.EmuHawk
}
}
}
}
}

View File

@ -128,7 +128,6 @@ namespace BizHawk.Client.EmuHawk.ToolExtensions
tsdd.Items.Add(tsmiMissingFile);
tsdd.Items.Add(new ToolStripSeparator());
}
} //crazystuff
//in any case, make a menuitem to let you remove the item

View File

@ -120,7 +120,6 @@ namespace BizHawk.Client.EmuHawk
}
return (byte[,])Palettes.QuickNESPalette.Clone();
}
// checkbox unchecked: we're reusing whatever palette was set

View File

@ -13,7 +13,7 @@ using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
public sealed partial class BasicBot : ToolFormBase, IToolFormAutoConfig
public sealed partial class BasicBot : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
private static readonly FilesystemFilterSet BotFilesFSFilterSet = new(new FilesystemFilter("Bot files", new[] { "bot" }));
@ -34,7 +34,6 @@ namespace BizHawk.Client.EmuHawk
: WindowTitleStatic;
UpdateWindowTitle();
}
}
private bool _isBotting;
@ -70,8 +69,19 @@ namespace BizHawk.Client.EmuHawk
[RequiredService]
private IMemoryDomains MemoryDomains { get; set; }
[ConfigPersist]
public BasicBotSettings Settings { get; set; }
private BasicBotSettings Settings;
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(Settings), ref Settings);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(Settings)] = Settings,
};
}
public class BasicBotSettings
{

View File

@ -1,12 +1,11 @@
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.Properties;
using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Emulation.Common;
// TODO - select which memorydomains go out to the CDL file. will this cause a problem when re-importing it?
// perhaps missing domains shouldn't fail a check
@ -17,7 +16,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
// TODO - context menu should have copy option too
namespace BizHawk.Client.EmuHawk
{
public partial class CDL : ToolFormBase, IToolFormAutoConfig
public partial class CDL : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
private static readonly FilesystemFilterSet CDLFilesFSFilterSet = new(new FilesystemFilter("Code Data Logger Files", new[] { "cdl" }));
@ -26,21 +25,35 @@ namespace BizHawk.Client.EmuHawk
private RecentFiles _recentFld = new RecentFiles();
[ConfigPersist]
private RecentFiles _recent
{
get => _recentFld;
set => _recentFld = value;
}
[ConfigPersist]
private bool CDLAutoSave { get; set; } = true;
private bool CDLAutoSave = true;
[ConfigPersist]
private bool CDLAutoStart { get; set; } = true;
private bool CDLAutoStart = true;
[ConfigPersist]
private bool CDLAutoResume { get; set; } = true;
private bool CDLAutoResume = true;
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(_recentFld), ref _recentFld);
provider.Get(nameof(CDLAutoSave), ref CDLAutoSave);
provider.Get(nameof(CDLAutoStart), ref CDLAutoStart);
provider.Get(nameof(CDLAutoResume), ref CDLAutoResume);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(_recent)] = _recent,
[nameof(CDLAutoSave)] = CDLAutoSave,
[nameof(CDLAutoStart)] = CDLAutoStart,
[nameof(CDLAutoResume)] = CDLAutoResume,
};
}
private void SetCurrentFilename(string fname)
{

View File

@ -4,16 +4,15 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.Properties;
using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Common.CollectionExtensions;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class Cheats : ToolFormBase, IToolFormAutoConfig
public partial class Cheats : ToolFormBase, IToolFormAutoConfig, IRestoreDefaults, IConfigPersist
{
private const string NameColumn = "NamesColumn";
private const string AddressColumn = "AddressColumn";
@ -78,8 +77,19 @@ namespace BizHawk.Client.EmuHawk
[RequiredService]
private IMemoryDomains Core { get; set; }
[ConfigPersist]
public CheatsSettings Settings { get; set; }
public CheatsSettings Settings;
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(Settings), ref Settings);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(Settings)] = Settings,
};
}
public override void Restart()
{
@ -513,8 +523,7 @@ namespace BizHawk.Client.EmuHawk
private void CheatsOnOffLoadMenuItem_Click(object sender, EventArgs e)
=> Config.Cheats.DisableOnLoad = !Config.Cheats.DisableOnLoad;
[RestoreDefaults]
private void RestoreDefaults()
void IRestoreDefaults.RestoreDefaults()
{
Settings = new CheatsSettings();

View File

@ -23,12 +23,8 @@ namespace BizHawk.Client.EmuHawk
BreakType = type;
}
private BreakpointOperation _operation;
private BreakpointOperation Operation
{
get => _operation;
set
{
switch (value)
@ -43,8 +39,6 @@ namespace BizHawk.Client.EmuHawk
Text = "Edit Breakpoint";
break;
}
_operation = value;
}
}

View File

@ -17,7 +17,9 @@ namespace BizHawk.Client.EmuHawk
{
public struct MenuItemInfo
{
#pragma warning disable IDE0052 // Remove unread private members (This is only not used in debug mode.)
private readonly string _asmChecksum;
#pragma warning restore IDE0052
private readonly string _entryPointTypeName;

View File

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text;
@ -10,7 +11,7 @@ using BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy;
namespace BizHawk.Client.EmuHawk
{
public partial class GbGpuView : ToolFormBase, IToolFormAutoConfig
public partial class GbGpuView : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
public static Icon ToolIcon
=> Properties.Resources.GambatteIcon;
@ -58,7 +59,6 @@ namespace BizHawk.Client.EmuHawk
private Color _spriteback;
[ConfigPersist]
public Color Spriteback
{
get => _spriteback;
@ -70,6 +70,19 @@ namespace BizHawk.Client.EmuHawk
}
}
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
Color outValue = default;
if (provider.Get(nameof(Spriteback), ref outValue)) Spriteback = outValue;
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(Spriteback)] = Spriteback,
};
}
protected override string WindowTitleStatic => "GPU Viewer";
public GbGpuView()

View File

@ -6,21 +6,20 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.Properties;
using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Common;
using BizHawk.Common.CollectionExtensions;
using BizHawk.Common.NumberExtensions;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
using BizHawk.WinForms.Controls;
namespace BizHawk.Client.EmuHawk
{
// int to long TODO: 32 bit domains have more digits than the hex editor can account for and the address covers up the 0 column
public partial class HexEditor : ToolFormBase, IToolFormAutoConfig
public partial class HexEditor : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
private sealed class N64MatrixDisplayDialog : Form
{
@ -121,17 +120,13 @@ namespace BizHawk.Client.EmuHawk
private HexFind _hexFind;
private string _lastRom = "";
[ConfigPersist]
private string LastDomain { get; set; }
private string LastDomain;
[ConfigPersist]
private bool BigEndian { get; set; }
private bool BigEndian;
[ConfigPersist]
private int DataSize { get; set; }
private int DataSize;
[ConfigPersist]
private RecentFiles RecentTables { get; set; }
private RecentFiles RecentTables;
internal class ColorConfig
{
@ -143,8 +138,27 @@ namespace BizHawk.Client.EmuHawk
public Color HighlightFreeze { get; set; } = Color.Violet;
}
[ConfigPersist]
internal ColorConfig Colors { get; set; } = new ColorConfig();
internal ColorConfig Colors = new ColorConfig();
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(LastDomain), ref LastDomain);
provider.Get(nameof(BigEndian), ref BigEndian);
provider.Get(nameof(DataSize), ref DataSize);
provider.Get(nameof(RecentTables), ref RecentTables);
provider.Get(nameof(Colors), ref Colors);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(LastDomain)] = LastDomain,
[nameof(BigEndian)] = BigEndian,
[nameof(DataSize)] = DataSize,
[nameof(RecentTables)] = RecentTables,
[nameof(Colors)] = Colors,
};
}
private WatchSize WatchSize => (WatchSize)DataSize;

View File

@ -41,7 +41,6 @@ namespace BizHawk.Client.EmuHawk
}
FindBox.Select();
}
private string GetFindBoxChars()

View File

@ -18,7 +18,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class LuaConsole : ToolFormBase, IToolFormAutoConfig
public partial class LuaConsole : ToolFormBase, IToolFormAutoConfig, IRestoreDefaults, IConfigPersist
{
private const string IconColumnName = "Icon";
private const string ScriptColumnName = "Script";
@ -74,8 +74,19 @@ namespace BizHawk.Client.EmuHawk
public bool WarnedOnceOnOverwrite { get; set; }
}
[ConfigPersist]
public LuaConsoleSettings Settings { get; set; }
public LuaConsoleSettings Settings;
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(Settings), ref Settings);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(Settings)] = Settings,
};
}
protected override string WindowTitleStatic => "Lua Console";
@ -503,7 +514,6 @@ namespace BizHawk.Client.EmuHawk
OutputBox.SelectionStart = OutputBox.Text.Length;
OutputBox.ScrollToCaret();
});
}
public void ClearOutputWindow()
@ -1533,8 +1543,7 @@ namespace BizHawk.Client.EmuHawk
ToggleLuaScript(file);
}
[RestoreDefaults]
private void RestoreDefaults()
void IRestoreDefaults.RestoreDefaults()
{
Settings = new LuaConsoleSettings();
LuaListView.AllColumns.Clear();

View File

@ -3,7 +3,6 @@ using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using NLua;
using NLua.Native;
@ -60,7 +59,6 @@ namespace BizHawk.Client.EmuHawk
_displayManager = displayManager;
_inputManager = inputManager;
_mainForm = mainForm;
LuaWait = new AutoResetEvent(false);
PathEntries = config.PathEntries;
RegisteredFunctions = registeredFuncList;
ScriptList = scriptList;
@ -153,8 +151,6 @@ namespace BizHawk.Client.EmuHawk
private readonly DisplayManagerBase _displayManager;
private GuiApi GuiAPI => (GuiApi)_apiContainer.Gui;
private readonly InputManager _inputManager;
private readonly MainForm _mainForm;
@ -182,8 +178,6 @@ namespace BizHawk.Client.EmuHawk
private readonly IDictionary<Type, LuaLibraryBase> Libraries = new Dictionary<Type, LuaLibraryBase>();
private EventWaitHandle LuaWait;
public PathEntryCollection PathEntries { get; private set; }
public LuaFileList ScriptList { get; }

View File

@ -249,7 +249,6 @@ namespace BizHawk.Client.EmuHawk
pulse1LastNote = lastNote;
pulse1LastType = lastType;
}
} // pulse tracks loop
// triangle track generation
@ -390,7 +389,6 @@ namespace BizHawk.Client.EmuHawk
writer.WriteLine("</Pattern>");
time += configuredPatternLength;
} // main pattern loop
writer.WriteLine("</Patterns>");

View File

@ -1,14 +1,14 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
namespace BizHawk.Client.EmuHawk
{
public partial class NESNameTableViewer : ToolFormBase, IToolFormAutoConfig
public partial class NESNameTableViewer : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
// TODO:
// Show Scroll Lines + UI Toggle
@ -28,13 +28,25 @@ namespace BizHawk.Client.EmuHawk
private IEmulator _emu
=> _core!;
[ConfigPersist]
private int RefreshRateConfig
{
get => RefreshRate.Value;
set => RefreshRate.Value = value;
}
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
int outValue = default;
if (provider.Get(nameof(RefreshRateConfig), ref outValue)) RefreshRateConfig = outValue;
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(RefreshRateConfig)] = RefreshRateConfig,
};
}
private int _scanline;
protected override string WindowTitleStatic => "Nametable Viewer";

View File

@ -1,14 +1,14 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
namespace BizHawk.Client.EmuHawk
{
public partial class NesPPU : ToolFormBase, IToolFormAutoConfig
public partial class NesPPU : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
// TODO:
// If 8/16 sprite mode, mouse over should put 32x64 version of sprite
@ -39,7 +39,6 @@ namespace BizHawk.Client.EmuHawk
private IEmulator _emu
=> _core!;
[ConfigPersist]
private int RefreshRateConfig
{
get => RefreshRate.Value;
@ -47,13 +46,28 @@ namespace BizHawk.Client.EmuHawk
}
private bool _chrRomView;
[ConfigPersist]
private bool ChrRomView
{
get => _chrRomView;
set { _chrRomView = value; CalculateFormSize(); }
}
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
int outValue = default;
if (provider.Get(nameof(RefreshRateConfig), ref outValue)) RefreshRateConfig = outValue;
bool outValue2 = default;
if (provider.Get(nameof(ChrRomView), ref outValue2)) ChrRomView = outValue2;
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(RefreshRateConfig)] = RefreshRateConfig,
[nameof(ChrRomView)] = ChrRomView,
};
}
protected override string WindowTitleStatic => "PPU Viewer";
public NesPPU()

View File

@ -46,7 +46,6 @@ namespace BizHawk.Client.EmuHawk
BgPalettesPrev[x] = new Palette(x);
SpritePalettesPrev[x] = new Palette(x + 16);
}
}
private void PaletteViewer_Paint(object sender, PaintEventArgs e)

View File

@ -1,15 +1,15 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.PCEngine;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.PCEngine;
namespace BizHawk.Client.EmuHawk
{
[SpecializedTool("BG Viewer")]
public partial class PceBgViewer : ToolFormBase, IToolFormAutoConfig
public partial class PceBgViewer : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
public static Icon ToolIcon
=> Properties.Resources.PceIcon;
@ -19,14 +19,25 @@ namespace BizHawk.Client.EmuHawk
[RequiredService]
public IEmulator Emulator { get; private set; }
[ConfigPersist]
// ReSharper disable once UnusedMember.Local
private int RefreshRateConfig
{
get => RefreshRate.Value;
set => RefreshRate.Value = Math.Max(Math.Min(value, RefreshRate.Maximum), RefreshRate.Minimum);
}
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
int outValue = default;
if (provider.Get(nameof(RefreshRateConfig), ref outValue)) RefreshRateConfig = outValue;
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(RefreshRateConfig)] = RefreshRateConfig,
};
}
private int _vdcType;
protected override string WindowTitleStatic => "Background Viewer";

View File

@ -36,22 +36,36 @@ using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
public unsafe partial class SNESGraphicsDebugger : ToolFormBase, IToolFormAutoConfig
public unsafe partial class SNESGraphicsDebugger : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
private readonly List<DisplayTypeItem> displayTypeItems = new List<DisplayTypeItem>();
[RequiredService]
private IBSNESForGfxDebugger Emulator { get; set; }
[ConfigPersist]
public bool UseUserBackdropColor
{
get => checkBackdropColor.Checked;
set => checkBackdropColor.Checked = value;
}
[ConfigPersist]
public int UserBackdropColor { get; set; }
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
bool outValue = default;
if (provider.Get(nameof(UseUserBackdropColor), ref outValue)) UseUserBackdropColor = outValue;
int outValue2 = default;
if (provider.Get(nameof(UserBackdropColor), ref outValue2)) UserBackdropColor = outValue2;
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(UseUserBackdropColor)] = UseUserBackdropColor,
[nameof(UserBackdropColor)] = UserBackdropColor,
};
}
protected override string WindowTitleStatic => "Graphics Debugger";
public SNESGraphicsDebugger()
@ -1361,7 +1375,6 @@ namespace BizHawk.Client.EmuHawk
bool all = checkEN0_OBJ.Checked && checkEN0_BG1.Checked && checkEN0_BG2.Checked && checkEN0_BG3.Checked && checkEN0_BG4.Checked;
var newVal = !all;
checkEN0_OBJ.Checked = checkEN0_BG1.Checked = checkEN0_BG2.Checked = checkEN0_BG3.Checked = checkEN0_BG4.Checked = newVal;
}
private void lblEnPrio1_Click(object sender, EventArgs e)
@ -1369,7 +1382,6 @@ namespace BizHawk.Client.EmuHawk
bool all = checkEN1_OBJ.Checked && checkEN1_BG1.Checked && checkEN1_BG2.Checked && checkEN1_BG3.Checked && checkEN1_BG4.Checked;
var newVal = !all;
checkEN1_OBJ.Checked = checkEN1_BG1.Checked = checkEN1_BG2.Checked = checkEN1_BG3.Checked = checkEN1_BG4.Checked = newVal;
}
private void lblEnPrio2_Click(object sender, EventArgs e)
@ -1377,6 +1389,5 @@ namespace BizHawk.Client.EmuHawk
private void lblEnPrio3_Click(object sender, EventArgs e)
=> checkEN3_OBJ.Checked = !checkEN3_OBJ.Checked;
} //class SNESGraphicsDebugger
} //namespace BizHawk.Client.EmuHawk

View File

@ -12,7 +12,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class TAStudio
public partial class TAStudio : IRestoreDefaults
{
private static readonly FilesystemFilterSet MoviesFSFilterSet = new(
new FilesystemFilter("All Available Files", MovieService.MovieExtensions.Reverse().ToArray()),
@ -491,7 +491,6 @@ namespace BizHawk.Client.EmuHawk
CurrentTasMovie.RemoveFrames(list);
EndBatchEdit();
SetSplicer();
}
}
@ -1267,9 +1266,7 @@ namespace BizHawk.Client.EmuHawk
});
}
// ReSharper disable once UnusedMember.Local
[RestoreDefaults]
private void RestoreDefaults()
void IRestoreDefaults.RestoreDefaults()
{
SetUpColumns();
SetUpToolStripColumns();

View File

@ -1,19 +1,19 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using System.ComponentModel;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Client.EmuHawk.Properties;
using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
using BizHawk.WinForms.Controls;
namespace BizHawk.Client.EmuHawk
{
public partial class TAStudio : ToolFormBase, IToolFormAutoConfig, IControlMainform
public partial class TAStudio : ToolFormBase, IToolFormAutoConfig, IControlMainform, IConfigPersist
{
public static readonly FilesystemFilterSet TAStudioProjectsFSFilterSet = new(FilesystemFilter.TAStudioProjects);
@ -56,13 +56,25 @@ namespace BizHawk.Client.EmuHawk
private int _seekingTo = -1;
[ConfigPersist]
public TAStudioSettings Settings { get; set; } = new TAStudioSettings();
public TAStudioSettings Settings = new TAStudioSettings();
public TAStudioPalette Palette => Settings.Palette;
[ConfigPersist]
public Font TasViewFont { get; set; } = new Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
public Font TasViewFont = new Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(Settings), ref Settings);
provider.Get(nameof(TasViewFont), ref TasViewFont);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(Settings)] = Settings,
[nameof(TasViewFont)] = TasViewFont,
};
}
public class TAStudioSettings
{
@ -492,23 +504,6 @@ namespace BizHawk.Client.EmuHawk
return controller;
}
private int? FirstNonEmptySelectedFrame
{
get
{
var empty = Bk2LogEntryGenerator.EmptyEntry(MovieSession.MovieController);
foreach (var row in TasView.SelectedRows)
{
if (CurrentTasMovie[row].LogEntry != empty)
{
return row;
}
}
return null;
}
}
private ITasMovie ConvertCurrentMovieToTasproj()
{
var tasMovie = MovieSession.Movie.ToTasMovie();
@ -991,6 +986,7 @@ namespace BizHawk.Client.EmuHawk
return base.ProcessCmdKey(ref msg, keyData);
}
#pragma warning disable IDE0051 // Remove unread private members (We might wish to do something with this. Was removed due to being broken.)
private bool AutoAdjustInput()
{
var lagLog = CurrentTasMovie[Emulator.Frame - 1]; // Minus one because get frame is +1;
@ -1043,6 +1039,7 @@ namespace BizHawk.Client.EmuHawk
return false;
}
#pragma warning restore IDE0051
private void MainVerticalSplit_SplitterMoved(object sender, SplitterEventArgs e)
{

View File

@ -1,14 +1,14 @@
using System.Collections.Generic;
using System.Drawing;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.Properties;
using BizHawk.Common;
using BizHawk.Emulation.Cores.Calculators.TI83;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Calculators.TI83;
namespace BizHawk.Client.EmuHawk
{
public sealed partial class TI83KeyPad : ToolFormBase, IToolFormAutoConfig
public sealed partial class TI83KeyPad : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
public static Icon ToolIcon
=> Resources.CalculateIcon;
@ -30,8 +30,21 @@ namespace BizHawk.Client.EmuHawk
if (OSTailoredCode.IsUnixHost) MinimumSize = (MaximumSize += new Size(48, 32)); // also updates current size
}
[ConfigPersist]
public bool TI83ToolTips { get; set; } = true;
public bool TI83ToolTips = true;
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
bool outValue = default;
if (provider.Get(nameof(TI83ToolTips), ref outValue)) TI83ToolTips = outValue;
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(TI83ToolTips)] = TI83ToolTips,
};
}
private void TI83KeyPad_Load(object sender, EventArgs e)
{

View File

@ -1,16 +1,13 @@
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.ComponentModel;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Common.CollectionExtensions;
using BizHawk.Common.ReflectionExtensions;
using BizHawk.Emulation.Common;
using BizHawk.WinForms.Controls;
@ -139,9 +136,10 @@ namespace BizHawk.Client.EmuHawk
AttachSettingHooks(autoConfigTool, _config.CommonToolSettings.GetValueOrPutNew(toolTypeName));
}
// custom settings
if (HasCustomConfig(newTool))
if (newTool is IConfigPersist persister)
{
InstallCustomConfig(newTool, _config.CustomToolSettings.GetValueOrPutNew(toolTypeName));
persister.LoadConfig(new(_config.CustomToolSettings.GetValueOrPutNew(toolTypeName)));
((Form)(IToolForm)newTool).FormClosing += (o, e) => _config.CustomToolSettings[toolTypeName] = persister.SaveConfig();
}
newTool.Restart();
@ -183,9 +181,10 @@ namespace BizHawk.Client.EmuHawk
AttachSettingHooks(autoConfigTool, _config.CommonToolSettings.GetValueOrPutNew(customFormTypeName));
}
// custom settings
if (HasCustomConfig(newTool))
if (newTool is IConfigPersist persister)
{
InstallCustomConfig(newTool, _config.CustomToolSettings.GetValueOrPutNew(customFormTypeName));
persister.LoadConfig(new(_config.CustomToolSettings.GetValueOrPutNew(customFormTypeName)));
((Form)(IToolForm)newTool).FormClosing += (o, e) => _config.CustomToolSettings[customFormTypeName] = persister.SaveConfig();
}
newTool.Restart();
@ -378,60 +377,11 @@ namespace BizHawk.Client.EmuHawk
RefreshSettings(form, dest, settings, idx);
form.Size = oldSize;
form.GetType().GetMethodsWithAttrib(typeof(RestoreDefaultsAttribute))
.FirstOrDefault()?.Invoke(form, Array.Empty<object>());
};
}
private static bool HasCustomConfig(IToolForm tool)
{
return tool.GetType().GetPropertiesWithAttrib(typeof(ConfigPersistAttribute)).Any();
}
private static void InstallCustomConfig(IToolForm tool, Dictionary<string, object> data)
{
Type type = tool.GetType();
var props = type.GetPropertiesWithAttrib(typeof(ConfigPersistAttribute)).ToList();
if (props.Count == 0)
{
return;
}
foreach (var prop in props)
{
if (data.TryGetValue(prop.Name, out var val))
if (form is IRestoreDefaults restorable)
{
if (val is string str && prop.PropertyType != typeof(string))
{
// if a type has a TypeConverter, and that converter can convert to string,
// that will be used in place of object markup by JSON.NET
// but that doesn't work with $type metadata, and JSON.NET fails to fall
// back on regular object serialization when needed. so try to undo a TypeConverter
// operation here
var converter = TypeDescriptor.GetConverter(prop.PropertyType);
val = converter.ConvertFromString(null, CultureInfo.InvariantCulture, str);
}
else if (val is not bool && prop.PropertyType.IsPrimitive)
{
// numeric constants are similarly hosed
val = Convert.ChangeType(val, prop.PropertyType, CultureInfo.InvariantCulture);
}
prop.SetValue(tool, val, null);
restorable.RestoreDefaults();
}
}
((Form)tool).FormClosing += (o, e) => SaveCustomConfig(tool, data, props);
}
private static void SaveCustomConfig(IToolForm tool, Dictionary<string, object> data, List<PropertyInfo> props)
{
data.Clear();
foreach (var prop in props)
{
data.Add(prop.Name, prop.GetValue(tool, BindingFlags.GetProperty, Type.DefaultBinder, null, CultureInfo.InvariantCulture));
}
};
}
/// <summary>

View File

@ -11,7 +11,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class TraceLogger : ToolFormBase, IToolFormAutoConfig
public partial class TraceLogger : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
public static Icon ToolIcon
=> Properties.Resources.PencilIcon;
@ -26,13 +26,10 @@ namespace BizHawk.Client.EmuHawk
private ITraceable Tracer
=> _tracerCore!;
[ConfigPersist]
private int MaxLines { get; set; }
private int MaxLines;
[ConfigPersist]
private int FileSizeCap { get; set; }
private int FileSizeCap;
[ConfigPersist]
private List<RollColumn> Columns
{
get => TraceView.AllColumns;
@ -48,6 +45,24 @@ namespace BizHawk.Client.EmuHawk
}
}
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(MaxLines), ref MaxLines);
provider.Get(nameof(FileSizeCap), ref FileSizeCap);
List<RollColumn> outValue = default;
if (provider.Get(nameof(Columns), ref outValue)) Columns = outValue;
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(MaxLines)] = MaxLines,
[nameof(FileSizeCap)] = FileSizeCap,
[nameof(Columns)] = Columns,
};
}
private FileInfo _logFile;
private FileInfo LogFile
{
@ -224,15 +239,6 @@ namespace BizHawk.Client.EmuHawk
}
}
private void LogToWindow()
{
if (_instructions.Count >= MaxLines)
{
_instructions.RemoveRange(0, _instructions.Count - MaxLines);
}
TraceView.RowCount = _instructions.Count;
}
private void SetTracerBoxTitle()
{
if (LoggingEnabled.Checked)

View File

@ -2,14 +2,13 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class VirtualpadTool : ToolFormBase, IToolFormAutoConfig
public partial class VirtualpadTool : ToolFormBase, IToolFormAutoConfig, IConfigPersist
{
public static Icon ToolIcon
=> Properties.Resources.GameControllerIcon;
@ -17,11 +16,24 @@ namespace BizHawk.Client.EmuHawk
[RequiredService]
private IEmulator Emulator { get; set; }
[ConfigPersist]
public bool StickyPads { get; set; }
public bool StickyPads;
public bool ClearAlsoClearsAnalog;
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(StickyPads), ref StickyPads);
provider.Get(nameof(ClearAlsoClearsAnalog), ref ClearAlsoClearsAnalog);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(StickyPads)] = StickyPads,
[nameof(ClearAlsoClearsAnalog)] = ClearAlsoClearsAnalog,
};
}
[ConfigPersist]
public bool ClearAlsoClearsAnalog { get; set; }
private bool _readOnly;

View File

@ -154,7 +154,7 @@ namespace BizHawk.Client.EmuHawk
private void RefreshWidgets()
{
if (!_isSet)
if (!IsSet)
{
_programmaticallyChangingValue = true;
AnalogTrackBar.Value = _stickyHoldController.AxisValue(Name);

View File

@ -185,7 +185,6 @@ namespace BizHawk.Client.EmuHawk
if (value < 0)
{
XNumeric.Value = 0;
}
else if (value <= XNumeric.Maximum)
{

View File

@ -20,7 +20,7 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// A form designed to search through ram values
/// </summary>
public partial class RamSearch : ToolFormBase, IToolFormAutoConfig
public partial class RamSearch : ToolFormBase, IToolFormAutoConfig, IRestoreDefaults, IConfigPersist
{
private const int MaxDetailedSize = 1024 * 1024; // 1mb, semi-arbitrary decision, sets the size to check for and automatically switch to fast mode for the user
private const int MaxSupportedSize = 1024 * 1024 * 64; // 64mb, semi-arbitrary decision, sets the maximum size RAM Search will support (as it will crash beyond this)
@ -106,8 +106,19 @@ namespace BizHawk.Client.EmuHawk
[OptionalService]
public IInputPollable InputPollableCore { get; set; }
[ConfigPersist]
public RamSearchSettings Settings { get; set; }
public RamSearchSettings Settings;
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(Settings), ref Settings);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(Settings)] = Settings,
};
}
private void HardSetDisplayTypeDropDown(Common.WatchDisplayType type)
{
@ -961,7 +972,6 @@ namespace BizHawk.Client.EmuHawk
PreviewMode = true;
RecentSearches = new RecentFiles(8);
AutoSearchTakeLagFramesIntoAccount = true;
}
public List<RollColumn> Columns { get; set; }
@ -1326,8 +1336,7 @@ namespace BizHawk.Client.EmuHawk
Settings.UseUndoHistory = _searches.UndoEnabled;
}
[RestoreDefaults]
private void RestoreDefaultsMenuItem()
void IRestoreDefaults.RestoreDefaults()
{
var recentFiles = Settings.RecentSearches; // We don't want to wipe recent files when restoring

View File

@ -17,7 +17,7 @@ using BizHawk.WinForms.Controls;
namespace BizHawk.Client.EmuHawk
{
public partial class RamWatch : ToolFormBase, IToolFormAutoConfig
public partial class RamWatch : ToolFormBase, IToolFormAutoConfig, IRestoreDefaults, IConfigPersist
{
public static Icon ToolIcon
=> Resources.WatchIcon;
@ -157,8 +157,19 @@ namespace BizHawk.Client.EmuHawk
WatchListView.Refresh();
}
[ConfigPersist]
public RamWatchSettings Settings { get; set; }
public RamWatchSettings Settings;
void IConfigPersist.LoadConfig(IConfigPersist.Provider provider)
{
provider.Get(nameof(Settings), ref Settings);
}
Dictionary<string, object> IConfigPersist.SaveConfig()
{
return new()
{
[nameof(Settings)] = Settings,
};
}
public class RamWatchSettings
{
@ -1062,8 +1073,7 @@ namespace BizHawk.Client.EmuHawk
Settings.DoubleClickToPoke = true;
}
[RestoreDefaults]
private void RestoreDefaultsMenuItem()
void IRestoreDefaults.RestoreDefaults()
{
Settings = new RamWatchSettings();

View File

@ -153,5 +153,4 @@ namespace BizHawk.Common
}
}
}
}

View File

@ -26,11 +26,13 @@ namespace BizHawk.Emulation.Common
private const byte LIMITED_5_PLAYS_LEFT = 0b11111100;
#pragma warning disable IDE0051 // Remove unused private members
private const int OFFSET_BROADCAST_DATE = 0x26; // 2 octets
private const int OFFSET_CHECKSUM = 0x2C; // 2 octets
private const int OFFSET_CHECKSUM_COMPLEMENT = 0x2E; // 2 octets
#pragma warning restore IDE0051 // Remove unused private members
private const int OFFSET_CONTENT_TYPE = 0x29; // 1 octet

View File

@ -102,6 +102,5 @@ namespace BizHawk.Emulation.Cores.Components.ARM
return ret[0].PadRight(8) + (ret.Length > 1 ? ret[1] : "");
}
}
}

View File

@ -0,0 +1,7 @@
# This core has existing violations, but let's assume they are in the middle of a refactor and let them be.
[*.cs]
# Remove unused private member
dotnet_diagnostic.IDE0051.severity = suggestion
# Remove unread private member
dotnet_diagnostic.IDE0052.severity = suggestion

View File

@ -14,8 +14,12 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
public byte opcode;
public long[] dLog = new long[0xFF];
#pragma warning disable IDE0052 // Remove unread private members
private string debug = "";
#pragma warning restore IDE0052 // Remove unread private members
#pragma warning disable IDE0051 // Remove unused private members
private void UpdateDebug()
#pragma warning restore IDE0051 // Remove unused private members
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 255; i++)

View File

@ -197,7 +197,9 @@ namespace BizHawk.Emulation.Cores.Components.H6280
// ==== Interrupts ====
private const ushort ResetVector = 0xFFFE;
#pragma warning disable IDE0051 // Remove unused private members
private const ushort NMIVector = 0xFFFC;
#pragma warning restore IDE0051 // Remove unused private members
private const ushort TimerVector = 0xFFFA;
private const ushort IRQ1Vector = 0xFFF8;
private const ushort IRQ2Vector = 0xFFF6;
@ -363,7 +365,9 @@ namespace BizHawk.Emulation.Cores.Components.H6280
return (ushort)((h << 8) | l);
}
#pragma warning disable IDE0051 // Remove unused private members
private void WriteWord(ushort address, ushort value)
#pragma warning restore IDE0051 // Remove unused private members
{
byte l = (byte)(value & 0xFF);
byte h = (byte)(value >> 8);

View File

@ -164,7 +164,6 @@ namespace BizHawk.Emulation.Cores.Components.I8048
IDLE);
IRQS = 9;
}
public void RET()

View File

@ -474,7 +474,6 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
Regs[dest_l] = ans_l;
Regs[dest_h] += temp;
Regs[dest_h] &= 0xFF;
}
}
}

View File

@ -34,6 +34,8 @@ namespace BizHawk.Emulation.Cores.Components.MC6800
public ushort indexed_reg;
public ushort indexed_op_reg;
#pragma warning disable IDE0051 // Remove unused private members
private void INDEX_OP(ushort oper)
{
indexed_op = oper;

View File

@ -36,7 +36,9 @@ namespace BizHawk.Emulation.Cores.Components.MC6800
IRQS = 3;
}
#pragma warning disable IDE0051 // Remove unused private members
private void DIRECT_MEM(ushort oper)
#pragma warning restore IDE0051 // Remove unused private members
{
PopulateCURINSTR(RD_INC, ALU, PC,
SET_ADDR, ADDR, DP, ALU,

View File

@ -207,7 +207,6 @@ namespace BizHawk.Emulation.Cores.Components.MC6800
FlagZ = Regs[src] == 0;
FlagH = false;
FlagN = (Regs[src] & 0xFF) > 127;
}
public void ASR_Func(ushort src)

View File

@ -258,7 +258,6 @@ namespace BizHawk.Emulation.Cores.Components.MC6809
FlagZ = Regs[src] == 0;
FlagH = false;
FlagN = (Regs[src] & 0xFF) > 127;
}
public void ASR_Func(ushort src)

View File

@ -0,0 +1,7 @@
# This core has existing violations, but let's assume they are in the middle of a refactor and let them be.
[*.cs]
# Remove unused private member
dotnet_diagnostic.IDE0051.severity = suggestion
# Remove unread private member
dotnet_diagnostic.IDE0052.severity = suggestion

View File

@ -762,7 +762,6 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void NZ_Y()
{
P = (byte)((P & 0x7D) | TableNZ[Y]);
}
private void Imp_TSX()
@ -906,7 +905,6 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void Abs_WRITE_SAX()
{
_link.WriteMemory((ushort)((opcode3 << 8) + opcode2), (byte)(X & A));
}
private void ZP_WRITE_STA()
@ -1008,7 +1006,6 @@ namespace BizHawk.Emulation.Cores.Components.M6502
_link.ReadMemory((ushort)ea);
if (alu_temp.Bit(8))
ea = (ushort)(ea + 0x100);
}
}
@ -1219,7 +1216,6 @@ namespace BizHawk.Emulation.Cores.Components.M6502
{
branch_taken = !FlagZ;
RelBranch_Stage2();
}
private void RelBranch_Stage2()
@ -2402,7 +2398,6 @@ namespace BizHawk.Emulation.Cores.Components.M6502
FlagC = (value8 & 1) != 0;
alu_temp = value8 = (byte)(value8 >> 1);
P = (byte)((P & 0x7D) | TableNZ[value8]);
}
private void ZP_RMW_ROR()
@ -2665,7 +2660,6 @@ namespace BizHawk.Emulation.Cores.Components.M6502
_link.WriteMemory((ushort)ea, (byte)alu_temp);
alu_temp = value8 = (byte)(alu_temp + 1);
P = (byte)((P & 0x7D) | TableNZ[value8]);
}
private void AbsIdx_RMW_Stage6_ROL()

View File

@ -645,7 +645,6 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
Regs[dest_l] = ans_l;
Regs[dest_h] += temp;
Regs[dest_h] &= 0xFF;
}
public void EXCH_16_Func(ushort dest_l, ushort dest_h, ushort src_l, ushort src_h)

View File

@ -0,0 +1,7 @@
# This core has existing violations, but let's assume they are in the middle of a refactor and let them be.
[*.cs]
# Remove unused private member
dotnet_diagnostic.IDE0051.severity = suggestion
# Remove unread private member
dotnet_diagnostic.IDE0052.severity = suggestion

View File

@ -321,7 +321,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
sb.Append("\n" + m.OtherMisc);
return sb.ToString();
}
}

View File

@ -118,15 +118,15 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Disk);
sb.Clear();
/*
string protection = "None";
protection = Enum.GetName(typeof(ProtectionType), _machine.UPDDiskDevice.DiskPointer.Protection);
if (protection == "None")
protection += " (OR UNKNOWN)";
string protection = "None";
protection = Enum.GetName(typeof(ProtectionType), _machine.UPDDiskDevice.DiskPointer.Protection);
if (protection == "None")
protection += " (OR UNKNOWN)";
sb.Append("Detected Protection: " + protection);
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Disk);
sb.Clear();
*/
sb.Append("Detected Protection: " + protection);
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Disk);
sb.Clear();
*/
sb.Append("Status: ");

View File

@ -117,30 +117,30 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public void Reset()
{
/*
_noiseVal = 0x0FFFF;
_outABC = 0;
_outNoiseABC = 0;
_counterNoise = 0;
_counterA = 0;
_counterB = 0;
_counterC = 0;
_EnvelopeCounterBend = 0;
_noiseVal = 0x0FFFF;
_outABC = 0;
_outNoiseABC = 0;
_counterNoise = 0;
_counterA = 0;
_counterB = 0;
_counterC = 0;
_EnvelopeCounterBend = 0;
// clear all the registers
for (int i = 0; i < 14; i++)
{
SelectedRegister = i;
PortWrite(0);
}
// clear all the registers
for (int i = 0; i < 14; i++)
{
SelectedRegister = i;
PortWrite(0);
}
randomSeed = 1;
randomSeed = 1;
// number of frames to update
var fr = (_audioBufferIndex * _tStatesPerFrame) / _audioBuffer.Length;
// number of frames to update
var fr = (_audioBufferIndex * _tStatesPerFrame) / _audioBuffer.Length;
// update the audio buffer
BufferUpdate(fr);
*/
// update the audio buffer
BufferUpdate(fr);
*/
}
/// <summary>
@ -306,8 +306,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
break;
}
}
/// <summary>
@ -359,36 +357,36 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// The register array
/// </summary>
/*
The AY-3-8910/8912 contains 16 internal registers as follows:
The AY-3-8910/8912 contains 16 internal registers as follows:
Register Function Range
0 Channel A fine pitch 8-bit (0-255)
1 Channel A course pitch 4-bit (0-15)
2 Channel B fine pitch 8-bit (0-255)
3 Channel B course pitch 4-bit (0-15)
4 Channel C fine pitch 8-bit (0-255)
5 Channel C course pitch 4-bit (0-15)
6 Noise pitch 5-bit (0-31)
7 Mixer 8-bit (see below)
8 Channel A volume 4-bit (0-15, see below)
9 Channel B volume 4-bit (0-15, see below)
10 Channel C volume 4-bit (0-15, see below)
11 Envelope fine duration 8-bit (0-255)
12 Envelope course duration 8-bit (0-255)
13 Envelope shape 4-bit (0-15)
14 I/O port A 8-bit (0-255)
15 I/O port B 8-bit (0-255) (Not present on the AY-3-8912)
Register Function Range
0 Channel A fine pitch 8-bit (0-255)
1 Channel A course pitch 4-bit (0-15)
2 Channel B fine pitch 8-bit (0-255)
3 Channel B course pitch 4-bit (0-15)
4 Channel C fine pitch 8-bit (0-255)
5 Channel C course pitch 4-bit (0-15)
6 Noise pitch 5-bit (0-31)
7 Mixer 8-bit (see below)
8 Channel A volume 4-bit (0-15, see below)
9 Channel B volume 4-bit (0-15, see below)
10 Channel C volume 4-bit (0-15, see below)
11 Envelope fine duration 8-bit (0-255)
12 Envelope course duration 8-bit (0-255)
13 Envelope shape 4-bit (0-15)
14 I/O port A 8-bit (0-255)
15 I/O port B 8-bit (0-255) (Not present on the AY-3-8912)
* The volume registers (8, 9 and 10) contain a 4-bit setting but if bit 5 is set then that channel uses the
envelope defined by register 13 and ignores its volume setting.
* The mixer (register 7) is made up of the following bits (low=enabled):
* The volume registers (8, 9 and 10) contain a 4-bit setting but if bit 5 is set then that channel uses the
envelope defined by register 13 and ignores its volume setting.
* The mixer (register 7) is made up of the following bits (low=enabled):
Bit: 7 6 5 4 3 2 1 0
Register: I/O I/O Noise Noise Noise Tone Tone Tone
Channel: B A C B A C B A
Bit: 7 6 5 4 3 2 1 0
Register: I/O I/O Noise Noise Noise Tone Tone Tone
Channel: B A C B A C B A
The AY-3-8912 ignores bit 7 of this register.
*/
The AY-3-8912 ignores bit 7 of this register.
*/
private int[] _registers = new int[16];
/// <summary>
@ -500,20 +498,20 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// </summary>
private static readonly List<uint[]> PanTabs = new List<uint[]>
{
// MONO
new uint[] { 50,50, 50,50, 50,50 },
// ABC
new uint[] { 100,10, 66,66, 10,100 },
// ACB
new uint[] { 100,10, 10,100, 66,66 },
// BAC
new uint[] { 66,66, 100,10, 10,100 },
// BCA
new uint[] { 10,100, 100,10, 66,66 },
// CAB
new uint[] { 66,66, 10,100, 100,10 },
// CBA
new uint[] { 10,100, 66,66, 100,10 }
// MONO
new uint[] { 50,50, 50,50, 50,50 },
// ABC
new uint[] { 100,10, 66,66, 10,100 },
// ACB
new uint[] { 100,10, 10,100, 66,66 },
// BAC
new uint[] { 66,66, 100,10, 10,100 },
// BCA
new uint[] { 10,100, 100,10, 66,66 },
// CAB
new uint[] { 66,66, 10,100, 100,10 },
// CBA
new uint[] { 10,100, 66,66, 100,10 }
};
/// <summary>
@ -722,40 +720,40 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
tickCounter = 0;
return;
/*
_blipL.EndFrame((uint)SampleClock);
_blipR.EndFrame((uint)SampleClock);
SampleClock = 0;
_blipL.EndFrame((uint)SampleClock);
_blipR.EndFrame((uint)SampleClock);
SampleClock = 0;
int sampL = _blipL.SamplesAvailable();
int sampR = _blipR.SamplesAvailable();
int sampL = _blipL.SamplesAvailable();
int sampR = _blipR.SamplesAvailable();
if (sampL > sampR)
nsamp = sampL;
else
nsamp = sampR;
if (sampL > sampR)
nsamp = sampL;
else
nsamp = sampR;
short[] buffL = new short[sampL];
short[] buffR = new short[sampR];
short[] buffL = new short[sampL];
short[] buffR = new short[sampR];
_blipL.ReadSamples(buffL, sampL - 1, false);
_blipR.ReadSamples(buffR, sampR - 1, false);
_blipL.ReadSamples(buffL, sampL - 1, false);
_blipR.ReadSamples(buffR, sampR - 1, false);
if (_audioBuffer.Length != nsamp * 2)
_audioBuffer = new short[nsamp * 2];
if (_audioBuffer.Length != nsamp * 2)
_audioBuffer = new short[nsamp * 2];
int p = 0;
for (int i = 0; i < nsamp; i++)
{
if (i < sampL)
_audioBuffer[p++] = buffL[i];
if (i < sampR)
_audioBuffer[p++] = buffR[i];
}
int p = 0;
for (int i = 0; i < nsamp; i++)
{
if (i < sampL)
_audioBuffer[p++] = buffL[i];
if (i < sampR)
_audioBuffer[p++] = buffR[i];
}
//nsamp = _samplesPerFrame;
samples = _audioBuffer;
DiscardSamples();
*/
//nsamp = _samplesPerFrame;
samples = _audioBuffer;
DiscardSamples();
*/
}
public int nullDump = 0;

View File

@ -222,8 +222,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
}
}
}
if (HCC == 0)

View File

@ -63,7 +63,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
Stop();
}
}
}
}
@ -498,7 +497,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
sbd.Append(bl.MetaData.First().Key + ": " + bl.MetaData.First().Value);
}
_machine.CPC.OSD_TapePlayingSkipBlockInfo(sbd.ToString());
}
// skip any empty blocks (and process any command blocks)
@ -515,40 +513,40 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
throw new Exception("spectrum tape command found in CPC tape");
/*
// Stop the tape command found - if this is the end of the tape RTZ
// otherwise just STOP and move to the next block
case TapeCommand.STOP_THE_TAPE:
// Stop the tape command found - if this is the end of the tape RTZ
// otherwise just STOP and move to the next block
case TapeCommand.STOP_THE_TAPE:
_machine.CPC.OSD_TapeStoppedAuto();
shouldStop = true;
_machine.CPC.OSD_TapeStoppedAuto();
shouldStop = true;
if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ();
else
{
Stop();
}
if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ();
else
{
Stop();
}
_monitorTimeOut = 2000;
_monitorTimeOut = 2000;
break;
case TapeCommand.STOP_THE_TAPE_48K:
if (is48k)
{
_machine.CPC.OSD_TapeStoppedAuto();
shouldStop = true;
break;
case TapeCommand.STOP_THE_TAPE_48K:
if (is48k)
{
_machine.CPC.OSD_TapeStoppedAuto();
shouldStop = true;
if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ();
else
{
Stop();
}
if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ();
else
{
Stop();
}
_monitorTimeOut = 2000;
}
break;
*/
_monitorTimeOut = 2000;
}
break;
*/
default:
break;
}
@ -579,7 +577,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// flip the current state
FlipTapeState();
}
// update lastCycle and return currentstate
@ -622,72 +619,72 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
/*
public int MaskableInterruptCount = 0;
public int MaskableInterruptCount = 0;
private void MonitorFrame()
{
if (_tapeIsPlaying && _autoPlay)
{
if (DataBlocks.Count > 1
|| _dataBlocks[_currentDataBlockIndex].BlockDescription is not (BlockType.CSW_Recording or BlockType.WAV_Recording))
{
// we should only stop the tape when there are multiple blocks
// if we just have one big block (maybe a CSW or WAV) then auto stopping will cock things up
_monitorTimeOut--;
}
private void MonitorFrame()
{
if (_tapeIsPlaying && _autoPlay)
{
if (DataBlocks.Count > 1
|| _dataBlocks[_currentDataBlockIndex].BlockDescription is not (BlockType.CSW_Recording or BlockType.WAV_Recording))
{
// we should only stop the tape when there are multiple blocks
// if we just have one big block (maybe a CSW or WAV) then auto stopping will cock things up
_monitorTimeOut--;
}
if (_monitorTimeOut < 0)
{
if (_dataBlocks[_currentDataBlockIndex].BlockDescription is not (BlockType.PAUSE_BLOCK or BlockType.PAUS))
{
AutoStopTape();
}
if (_monitorTimeOut < 0)
{
if (_dataBlocks[_currentDataBlockIndex].BlockDescription is not (BlockType.PAUSE_BLOCK or BlockType.PAUS))
{
AutoStopTape();
}
return;
}
return;
}
// fallback in case usual monitor detection methods do not work
// fallback in case usual monitor detection methods do not work
// number of t-states since last IN operation
long diff = _machine.CPU.TotalExecutedCycles - _lastINCycle;
// number of t-states since last IN operation
long diff = _machine.CPU.TotalExecutedCycles - _lastINCycle;
// get current datablock
var block = DataBlocks[_currentDataBlockIndex];
// get current datablock
var block = DataBlocks[_currentDataBlockIndex];
// is this a pause block?
if (block.BlockDescription is BlockType.PAUS or BlockType.PAUSE_BLOCK)
{
// don't autostop the tape here
return;
}
// is this a pause block?
if (block.BlockDescription is BlockType.PAUS or BlockType.PAUSE_BLOCK)
{
// don't autostop the tape here
return;
}
// pause in ms at the end of the current block
int blockPause = block.PauseInMS;
// pause in ms at the end of the current block
int blockPause = block.PauseInMS;
// timeout in t-states (equiv. to blockpause)
int timeout = ((_machine.GateArray.FrameLength * 50) / 1000) * blockPause;
// timeout in t-states (equiv. to blockpause)
int timeout = ((_machine.GateArray.FrameLength * 50) / 1000) * blockPause;
// don't use autostop detection if block has no pause at the end
if (timeout == 0)
return;
// don't use autostop detection if block has no pause at the end
if (timeout == 0)
return;
// don't autostop if there is only 1 block
if (DataBlocks.Count is 1
|| _dataBlocks[_currentDataBlockIndex].BlockDescription is BlockType.CSW_Recording or BlockType.WAV_Recording)
{
return;
}
// don't autostop if there is only 1 block
if (DataBlocks.Count is 1
|| _dataBlocks[_currentDataBlockIndex].BlockDescription is BlockType.CSW_Recording or BlockType.WAV_Recording)
{
return;
}
if (diff >= timeout * 2)
{
// There have been no attempted tape reads by the CPU within the double timeout period
// Autostop the tape
AutoStopTape();
_lastCycle = _cpu.TotalExecutedCycles;
}
}
}
*/
if (diff >= timeout * 2)
{
// There have been no attempted tape reads by the CPU within the double timeout period
// Autostop the tape
AutoStopTape();
_lastCycle = _cpu.TotalExecutedCycles;
}
}
}
*/
/// <summary>
/// Mask constants
@ -706,15 +703,15 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
GetEarBit(CPU.TotalExecutedCycles);
}
/*
if (currentState)
{
result |= TAPE_BIT;
}
else
{
result &= ~TAPE_BIT;
}
*/
if (currentState)
{
result |= TAPE_BIT;
}
else
{
result &= ~TAPE_BIT;
}
*/
if (!TapeIsPlaying)
{
@ -735,11 +732,11 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// not implemented
/*
if (!TapeIsPlaying)
{
currentState = ((byte)result & 0x10) != 0;
}
*/
if (!TapeIsPlaying)
{
currentState = ((byte)result & 0x10) != 0;
}
*/
}
/// <summary>

View File

@ -6,11 +6,11 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// Definitions
/// </summary>
/*
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
public partial class NECUPD765
{
/// <summary>

View File

@ -9,11 +9,11 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// FDC State and Methods
/// </summary>
/*
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
public partial class NECUPD765
{
/// <summary>
@ -206,69 +206,69 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// Main status register (accessed via reads to port 0x2ffd)
/// </summary>
/*
b0..3 DB FDD0..3 Busy (seek/recalib active, until succesful sense intstat)
b4 CB FDC Busy (still in command-, execution- or result-phase)
b5 EXM Execution Mode (still in execution-phase, non_DMA_only)
b6 DIO Data Input/Output (0=CPU->FDC, 1=FDC->CPU) (see b7)
b7 RQM Request For Master (1=ready for next byte) (see b6 for direction)
*/
b0..3 DB FDD0..3 Busy (seek/recalib active, until succesful sense intstat)
b4 CB FDC Busy (still in command-, execution- or result-phase)
b5 EXM Execution Mode (still in execution-phase, non_DMA_only)
b6 DIO Data Input/Output (0=CPU->FDC, 1=FDC->CPU) (see b7)
b7 RQM Request For Master (1=ready for next byte) (see b6 for direction)
*/
private byte StatusMain;
/// <summary>
/// Status Register 0
/// </summary>
/*
b0,1 US Unit Select (driveno during interrupt)
b2 HD Head Address (head during interrupt)
b3 NR Not Ready (drive not ready or non-existing 2nd head selected)
b4 EC Equipment Check (drive failure or recalibrate failed (retry))
b5 SE Seek End (Set if seek-command completed)
b6,7 IC Interrupt Code (0=OK, 1=aborted:readfail/OK if EN, 2=unknown cmd
or senseint with no int occured, 3=aborted:disc removed etc.)
*/
b0,1 US Unit Select (driveno during interrupt)
b2 HD Head Address (head during interrupt)
b3 NR Not Ready (drive not ready or non-existing 2nd head selected)
b4 EC Equipment Check (drive failure or recalibrate failed (retry))
b5 SE Seek End (Set if seek-command completed)
b6,7 IC Interrupt Code (0=OK, 1=aborted:readfail/OK if EN, 2=unknown cmd
or senseint with no int occured, 3=aborted:disc removed etc.)
*/
private byte Status0;
/// <summary>
/// Status Register 1
/// </summary>
/*
b0 MA Missing Address Mark (Sector_ID or DAM not found)
b1 NW Not Writeable (tried to write/format disc with wprot_tab=on)
b2 ND No Data (Sector_ID not found, CRC fail in ID_field)
b3,6 0 Not used
b4 OR Over Run (CPU too slow in execution-phase (ca. 26us/Byte))
b5 DE Data Error (CRC-fail in ID- or Data-Field)
b7 EN End of Track (set past most read/write commands) (see IC)
*/
b0 MA Missing Address Mark (Sector_ID or DAM not found)
b1 NW Not Writeable (tried to write/format disc with wprot_tab=on)
b2 ND No Data (Sector_ID not found, CRC fail in ID_field)
b3,6 0 Not used
b4 OR Over Run (CPU too slow in execution-phase (ca. 26us/Byte))
b5 DE Data Error (CRC-fail in ID- or Data-Field)
b7 EN End of Track (set past most read/write commands) (see IC)
*/
private byte Status1;
/// <summary>
/// Status Register 2
/// </summary>
/*
b0 MD Missing Address Mark in Data Field (DAM not found)
b1 BC Bad Cylinder (read/programmed track-ID different and read-ID = FF)
b2 SN Scan Not Satisfied (no fitting sector found)
b3 SH Scan Equal Hit (equal)
b4 WC Wrong Cylinder (read/programmed track-ID different) (see b1)
b5 DD Data Error in Data Field (CRC-fail in data-field)
b6 CM Control Mark (read/scan command found sector with deleted DAM)
b7 0 Not Used
*/
b0 MD Missing Address Mark in Data Field (DAM not found)
b1 BC Bad Cylinder (read/programmed track-ID different and read-ID = FF)
b2 SN Scan Not Satisfied (no fitting sector found)
b3 SH Scan Equal Hit (equal)
b4 WC Wrong Cylinder (read/programmed track-ID different) (see b1)
b5 DD Data Error in Data Field (CRC-fail in data-field)
b6 CM Control Mark (read/scan command found sector with deleted DAM)
b7 0 Not Used
*/
private byte Status2;
/// <summary>
/// Status Register 3
/// </summary>
/*
b0,1 US Unit Select (pin 28,29 of FDC)
b2 HD Head Address (pin 27 of FDC)
b3 TS Two Side (0=yes, 1=no (!))
b4 T0 Track 0 (on track 0 we are)
b5 RY Ready (drive ready signal)
b6 WP Write Protected (write protected)
b7 FT Fault (if supported: 1=Drive failure)
*/
b0,1 US Unit Select (pin 28,29 of FDC)
b2 HD Head Address (pin 27 of FDC)
b3 TS Two Side (0=yes, 1=no (!))
b4 T0 Track 0 (on track 0 we are)
b5 RY Ready (drive ready signal)
b6 WP Write Protected (write protected)
b7 FT Fault (if supported: 1=Drive failure)
*/
private byte Status3;
/// <summary>
@ -2128,16 +2128,16 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
ResBuffer[1] = ActiveDrive.CurrentTrackID;
}
/*
else if (ActiveDrive.SeekStatus == SEEK_INTACKNOWLEDGED)
{
// DriveA interrupt has already been acknowledged
ActiveDrive.SeekStatus = SEEK_IDLE;
else if (ActiveDrive.SeekStatus == SEEK_INTACKNOWLEDGED)
{
// DriveA interrupt has already been acknowledged
ActiveDrive.SeekStatus = SEEK_IDLE;
ResLength = 1;
Status0 = 192;
ResBuffer[0] = Status0;
}
*/
ResLength = 1;
Status0 = 192;
ResBuffer[0] = Status0;
}
*/
else if (ActiveDrive.SeekStatus == SEEK_IDLE)
{
// SIS with no interrupt
@ -2526,14 +2526,14 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
/*
if ((CMD_FLAG_MF && !ActiveCommand.MF)
|| (CMD_FLAG_MT && !ActiveCommand.MT)
|| (CMD_FLAG_SK && !ActiveCommand.SK))
{
// command byte included spurious bit 5,6 or 7 flags
CMDIndex = CommandList.Count - 1;
}
*/
if ((CMD_FLAG_MF && !ActiveCommand.MF)
|| (CMD_FLAG_MT && !ActiveCommand.MT)
|| (CMD_FLAG_SK && !ActiveCommand.SK))
{
// command byte included spurious bit 5,6 or 7 flags
CMDIndex = CommandList.Count - 1;
}
*/
}
CommCounter = 0;
@ -2544,13 +2544,13 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
ActivePhase = Phase.Command;
/*
// check for invalid SIS
if (ActiveInterrupt == InterruptState.None && CMDIndex == CC_SENSE_INTSTATUS)
{
CMDIndex = CC_INVALID;
//ActiveCommand.CommandDelegate(InstructionState.StartResult);
}
*/
// check for invalid SIS
if (ActiveInterrupt == InterruptState.None && CMDIndex == CC_SENSE_INTSTATUS)
{
CMDIndex = CC_INVALID;
//ActiveCommand.CommandDelegate(InstructionState.StartResult);
}
*/
// set reslength
ResLength = ActiveCommand.ResultByteCount;
@ -2697,7 +2697,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
ResBuffer[RS_ST0] = Status0;
ResBuffer[RS_ST1] = Status1;
ResBuffer[RS_ST2] = Status2;
}
/// <summary>

View File

@ -7,11 +7,11 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// Floppy drive related stuff
/// </summary>
/*
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
public partial class NECUPD765 : IFDDHost
{
/// <summary>
@ -298,424 +298,422 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
/*
/// <summary>
/// Moves the head across the disk cylinders
/// </summary>
public void MoveHead(SkipDirection direction, int cylinderCount)
{
// get total tracks
int trackCount = Disk.DiskTracks.Length;
/// <summary>
/// Moves the head across the disk cylinders
/// </summary>
public void MoveHead(SkipDirection direction, int cylinderCount)
{
// get total tracks
int trackCount = Disk.DiskTracks.Length;
int trk = 0;
int trk = 0;
switch (direction)
{
case SkipDirection.Increment:
trk = (int)CurrentTrack + cylinderCount;
if (trk >= trackCount)
{
// past the last track
trk = trackCount - 1;
}
else if (trk < 0)
trk = 0;
break;
case SkipDirection.Decrement:
trk = (int)CurrentTrack - cylinderCount;
if (trk < 0)
{
// before the first track
trk = 0;
}
else if (trk >= trackCount)
trk = trackCount - 1;
break;
}
switch (direction)
{
case SkipDirection.Increment:
trk = (int)CurrentTrack + cylinderCount;
if (trk >= trackCount)
{
// past the last track
trk = trackCount - 1;
}
else if (trk < 0)
trk = 0;
break;
case SkipDirection.Decrement:
trk = (int)CurrentTrack - cylinderCount;
if (trk < 0)
{
// before the first track
trk = 0;
}
else if (trk >= trackCount)
trk = trackCount - 1;
break;
}
// move the head
CurrentTrack = (byte)trk;
}
*/
// move the head
CurrentTrack = (byte)trk;
}
*/
/*
/// <summary>
/// Finds a supplied sector
/// </summary>
public FloppyDisk.Sector FindSector(ref byte[] resBuffer, CommandParameters prms)
{
int index =CurrentSector;
int lc = 0;
FloppyDisk.Sector sector = null;
/// <summary>
/// Finds a supplied sector
/// </summary>
public FloppyDisk.Sector FindSector(ref byte[] resBuffer, CommandParameters prms)
{
int index =CurrentSector;
int lc = 0;
FloppyDisk.Sector sector = null;
bool found = false;
bool found = false;
do
{
sector = Disk.DiskTracks[CurrentTrack].Sectors[index];
if (sector != null && sector.SectorID == prms.Sector)
{
// sector found
// check for data errors
if ((sector.Status1 & 0x20) != 0 || (sector.Status2 & 0x20) != 0)
{
// data errors found
}
found = true;
break;
}
do
{
sector = Disk.DiskTracks[CurrentTrack].Sectors[index];
if (sector != null && sector.SectorID == prms.Sector)
{
// sector found
// check for data errors
if ((sector.Status1 & 0x20) != 0 || (sector.Status2 & 0x20) != 0)
{
// data errors found
}
found = true;
break;
}
// sector doesnt match
var c = Disk.DiskTracks[CurrentTrack].Sectors[index].TrackNumber;
if (c == 255)
{
// bad cylinder
resBuffer[RS_ST2] |= 0x02;
}
else if (prms.Cylinder != c)
{
// cylinder mismatch
resBuffer[RS_ST2] |= 0x10;
}
// sector doesnt match
var c = Disk.DiskTracks[CurrentTrack].Sectors[index].TrackNumber;
if (c == 255)
{
// bad cylinder
resBuffer[RS_ST2] |= 0x02;
}
else if (prms.Cylinder != c)
{
// cylinder mismatch
resBuffer[RS_ST2] |= 0x10;
}
// increment index
index++;
// increment index
index++;
if (index >= Disk.DiskTracks[CurrentTrack].NumberOfSectors)
{
// out of bounds
index = 0;
lc++;
}
if (index >= Disk.DiskTracks[CurrentTrack].NumberOfSectors)
{
// out of bounds
index = 0;
lc++;
}
} while (lc < 2);
} while (lc < 2);
if ((resBuffer[RS_ST2] & 0x02) != 0)
{
// bad cylinder set - remove no cylinder
UnSetBit(SR2_WC, ref resBuffer[RS_ST2]);
}
if ((resBuffer[RS_ST2] & 0x02) != 0)
{
// bad cylinder set - remove no cylinder
UnSetBit(SR2_WC, ref resBuffer[RS_ST2]);
}
// update current sector
CurrentSector = index;
// update current sector
CurrentSector = index;
if (found)
return sector;
else
return null;
}
if (found)
return sector;
else
return null;
}
/// <summary>
/// Populates a result buffer
/// </summary>
public void FillResult(ref byte[] resBuffer, CHRN chrn)
{
// clear results
resBuffer[RS_ST0] = 0;
resBuffer[RS_ST1] = 0;
resBuffer[RS_ST2] = 0;
resBuffer[RS_C] = 0;
resBuffer[RS_H] = 0;
resBuffer[RS_R] = 0;
resBuffer[RS_N] = 0;
/// <summary>
/// Populates a result buffer
/// </summary>
public void FillResult(ref byte[] resBuffer, CHRN chrn)
{
// clear results
resBuffer[RS_ST0] = 0;
resBuffer[RS_ST1] = 0;
resBuffer[RS_ST2] = 0;
resBuffer[RS_C] = 0;
resBuffer[RS_H] = 0;
resBuffer[RS_R] = 0;
resBuffer[RS_N] = 0;
if (chrn == null)
{
// no chrn supplied
resBuffer[RS_ST0] = ST0;
resBuffer[RS_ST1] = 0;
resBuffer[RS_ST2] = 0;
resBuffer[RS_C] = 0;
resBuffer[RS_H] = 0;
resBuffer[RS_R] = 0;
resBuffer[RS_N] = 0;
}
}
if (chrn == null)
{
// no chrn supplied
resBuffer[RS_ST0] = ST0;
resBuffer[RS_ST1] = 0;
resBuffer[RS_ST2] = 0;
resBuffer[RS_C] = 0;
resBuffer[RS_H] = 0;
resBuffer[RS_R] = 0;
resBuffer[RS_N] = 0;
}
}
/// <summary>
/// Populates the result buffer with ReadID data
/// </summary>
public void ReadID(ref byte[] resBuffer)
{
if (CheckDriveStatus() == false)
{
// drive not ready
resBuffer[RS_ST0] = ST0;
return;
}
/// <summary>
/// Populates the result buffer with ReadID data
/// </summary>
public void ReadID(ref byte[] resBuffer)
{
if (CheckDriveStatus() == false)
{
// drive not ready
resBuffer[RS_ST0] = ST0;
return;
}
var track = Disk.DiskTracks.Where(a => a.TrackNumber == CurrentTrack).FirstOrDefault();
var track = Disk.DiskTracks.Where(a => a.TrackNumber == CurrentTrack).FirstOrDefault();
if (track != null && track.NumberOfSectors > 0)
{
// formatted track
if (track != null && track.NumberOfSectors > 0)
{
// formatted track
// get the current sector
int index = CurrentSector;
// get the current sector
int index = CurrentSector;
// is the index out of bounds?
if (index >= track.NumberOfSectors)
{
// reset the index
index = 0;
}
// is the index out of bounds?
if (index >= track.NumberOfSectors)
{
// reset the index
index = 0;
}
// read the sector data
var data = track.Sectors[index];
resBuffer[RS_C] = data.TrackNumber;
resBuffer[RS_H] = data.SideNumber;
resBuffer[RS_R] = data.SectorID;
resBuffer[RS_N] = data.SectorSize;
// read the sector data
var data = track.Sectors[index];
resBuffer[RS_C] = data.TrackNumber;
resBuffer[RS_H] = data.SideNumber;
resBuffer[RS_R] = data.SectorID;
resBuffer[RS_N] = data.SectorSize;
resBuffer[RS_ST0] = ST0;
resBuffer[RS_ST0] = ST0;
// increment the current sector
CurrentSector = index + 1;
return;
}
else
{
// unformatted track?
resBuffer[RS_C] = FDC.CommBuffer[CM_C];
resBuffer[RS_H] = FDC.CommBuffer[CM_H];
resBuffer[RS_R] = FDC.CommBuffer[CM_R];
resBuffer[RS_N] = FDC.CommBuffer[CM_N];
// increment the current sector
CurrentSector = index + 1;
return;
}
else
{
// unformatted track?
resBuffer[RS_C] = FDC.CommBuffer[CM_C];
resBuffer[RS_H] = FDC.CommBuffer[CM_H];
resBuffer[RS_R] = FDC.CommBuffer[CM_R];
resBuffer[RS_N] = FDC.CommBuffer[CM_N];
SetBit(SR0_IC0, ref ST0);
resBuffer[RS_ST0] = ST0;
resBuffer[RS_ST1] = 0x01;
return;
}
}
*/
SetBit(SR0_IC0, ref ST0);
resBuffer[RS_ST0] = ST0;
resBuffer[RS_ST1] = 0x01;
return;
}
}
*/
/*
/// <summary>
/// The drive performs a seek operation if necessary
/// Return value TRUE indicates seek complete
/// </summary>
public void DoSeek()
{
if (CurrentState is not (DriveMainState.Recalibrate or DriveMainState.Seek))
{
// no seek/recalibrate has been asked for
return;
}
/// <summary>
/// The drive performs a seek operation if necessary
/// Return value TRUE indicates seek complete
/// </summary>
public void DoSeek()
{
if (CurrentState is not (DriveMainState.Recalibrate or DriveMainState.Seek))
{
// no seek/recalibrate has been asked for
return;
}
if (GetBit(ID, FDC.StatusMain))
{
// drive is already seeking
return;
}
if (GetBit(ID, FDC.StatusMain))
{
// drive is already seeking
return;
}
RunSeekCycle();
}
RunSeekCycle();
}
/// <summary>
/// Runs a seek cycle
/// </summary>
public void RunSeekCycle()
{
for (;;)
{
switch (SeekState)
{
// seek or recalibrate has been requested
case SeekSubState.Idle:
/// <summary>
/// Runs a seek cycle
/// </summary>
public void RunSeekCycle()
{
for (;;)
{
switch (SeekState)
{
// seek or recalibrate has been requested
case SeekSubState.Idle:
if (CurrentState == DriveMainState.Recalibrate)
{
// recalibrate always seeks to track 0
SeekingTrack = 0;
}
SeekState = SeekSubState.MoveInit;
if (CurrentState == DriveMainState.Recalibrate)
{
// recalibrate always seeks to track 0
SeekingTrack = 0;
}
SeekState = SeekSubState.MoveInit;
// mark drive as busy
// this should be cleared by SIS command
SetBit(ID, ref FDC.StatusMain);
// mark drive as busy
// this should be cleared by SIS command
SetBit(ID, ref FDC.StatusMain);
break;
break;
// setup for the head move
case SeekSubState.MoveInit:
// setup for the head move
case SeekSubState.MoveInit:
if (CurrentTrack == SeekingTrack)
{
// we are already at the required track
if (CurrentState is DriveMainState.Recalibrate && !FLAG_TRACK0)
{
// recalibration fail
SeekIntState = SeekIntStatus.Abnormal;
if (CurrentTrack == SeekingTrack)
{
// we are already at the required track
if (CurrentState is DriveMainState.Recalibrate && !FLAG_TRACK0)
{
// recalibration fail
SeekIntState = SeekIntStatus.Abnormal;
// raise seek interrupt
FDC.ActiveInterrupt = InterruptState.Seek;
// raise seek interrupt
FDC.ActiveInterrupt = InterruptState.Seek;
// unset DB bit
UnSetBit(ID, ref FDC.StatusMain);
// unset DB bit
UnSetBit(ID, ref FDC.StatusMain);
// equipment check
SetBit(SR0_EC, ref FDC.Status0);
// equipment check
SetBit(SR0_EC, ref FDC.Status0);
SeekState = SeekSubState.PerformCompletion;
break;
}
SeekState = SeekSubState.PerformCompletion;
break;
}
if (CurrentState is DriveMainState.Recalibrate && FLAG_TRACK0)
{
// recalibration success
SeekIntState = SeekIntStatus.Normal;
if (CurrentState is DriveMainState.Recalibrate && FLAG_TRACK0)
{
// recalibration success
SeekIntState = SeekIntStatus.Normal;
// raise seek interrupt
FDC.ActiveInterrupt = InterruptState.Seek;
// raise seek interrupt
FDC.ActiveInterrupt = InterruptState.Seek;
// unset DB bit
UnSetBit(ID, ref FDC.StatusMain);
// unset DB bit
UnSetBit(ID, ref FDC.StatusMain);
SeekState = SeekSubState.PerformCompletion;
break;
}
}
SeekState = SeekSubState.PerformCompletion;
break;
}
}
// check for error
if (IntStatus >= IC_ABORTED_DISCREMOVED || Disk == null)
{
// drive not ready
FLAG_READY = false;
// check for error
if (IntStatus >= IC_ABORTED_DISCREMOVED || Disk == null)
{
// drive not ready
FLAG_READY = false;
// drive not ready
SeekIntState = SeekIntStatus.DriveNotReady;
// drive not ready
SeekIntState = SeekIntStatus.DriveNotReady;
// cancel any interrupt
FDC.ActiveInterrupt = InterruptState.None;
// cancel any interrupt
FDC.ActiveInterrupt = InterruptState.None;
// unset DB bit
UnSetBit(ID, ref FDC.StatusMain);
// unset DB bit
UnSetBit(ID, ref FDC.StatusMain);
SeekState = SeekSubState.PerformCompletion;
break;
}
SeekState = SeekSubState.PerformCompletion;
break;
}
if (SeekCounter > 1)
{
// not ready to seek yet
SeekCounter--;
return;
}
if (SeekCounter > 1)
{
// not ready to seek yet
SeekCounter--;
return;
}
if (FDC.SRT < 1 && CurrentTrack != SeekingTrack)
{
SeekState = SeekSubState.MoveImmediate;
break;
}
if (FDC.SRT < 1 && CurrentTrack != SeekingTrack)
{
SeekState = SeekSubState.MoveImmediate;
break;
}
// head move
SeekState = SeekSubState.HeadMove;
// head move
SeekState = SeekSubState.HeadMove;
break;
break;
case SeekSubState.HeadMove:
case SeekSubState.HeadMove:
// do the seek
SeekCounter = FDC.SRT;
// do the seek
SeekCounter = FDC.SRT;
if (CurrentTrack < SeekingTrack)
{
// we are seeking forward
var delta = SeekingTrack - CurrentTrack;
MoveHead(SkipDirection.Increment, 1);
}
else if (CurrentTrack > SeekingTrack)
{
// we are seeking backward
var delta = CurrentTrack - SeekingTrack;
MoveHead(SkipDirection.Decrement, 1);
}
if (CurrentTrack < SeekingTrack)
{
// we are seeking forward
var delta = SeekingTrack - CurrentTrack;
MoveHead(SkipDirection.Increment, 1);
}
else if (CurrentTrack > SeekingTrack)
{
// we are seeking backward
var delta = CurrentTrack - SeekingTrack;
MoveHead(SkipDirection.Decrement, 1);
}
// should the seek be completed now?
if (CurrentTrack == SeekingTrack)
{
SeekState = SeekSubState.PerformCompletion;
break;
}
// should the seek be completed now?
if (CurrentTrack == SeekingTrack)
{
SeekState = SeekSubState.PerformCompletion;
break;
}
// seek not finished yet
return;
// seek not finished yet
return;
// seek emulation processed immediately
case SeekSubState.MoveImmediate:
// seek emulation processed immediately
case SeekSubState.MoveImmediate:
if (CurrentTrack < SeekingTrack)
{
// we are seeking forward
var delta = SeekingTrack - CurrentTrack;
MoveHead(SkipDirection.Increment, delta);
if (CurrentTrack < SeekingTrack)
{
// we are seeking forward
var delta = SeekingTrack - CurrentTrack;
MoveHead(SkipDirection.Increment, delta);
}
else if (CurrentTrack > SeekingTrack)
{
// we are seeking backward
var delta = CurrentTrack - SeekingTrack;
MoveHead(SkipDirection.Decrement, delta);
}
}
else if (CurrentTrack > SeekingTrack)
{
// we are seeking backward
var delta = CurrentTrack - SeekingTrack;
MoveHead(SkipDirection.Decrement, delta);
}
SeekState = SeekSubState.PerformCompletion;
break;
SeekState = SeekSubState.PerformCompletion;
break;
case SeekSubState.PerformCompletion:
SeekDone();
SeekState = SeekSubState.SeekCompleted;
break;
case SeekSubState.PerformCompletion:
SeekDone();
SeekState = SeekSubState.SeekCompleted;
break;
case SeekSubState.SeekCompleted:
// seek has already completed
return;
}
}
}
case SeekSubState.SeekCompleted:
// seek has already completed
return;
}
}
}
/// <summary>
/// Called when a seek operation has completed
/// </summary>
public void SeekDone()
{
SeekCounter = 0;
SeekingTrack = CurrentTrack;
/// <summary>
/// Called when a seek operation has completed
/// </summary>
public void SeekDone()
{
SeekCounter = 0;
SeekingTrack = CurrentTrack;
// generate ST0 register data
// generate ST0 register data
// get only the IC bits
IntStatus &= IC_ABORTED_DISCREMOVED;
// get only the IC bits
IntStatus &= IC_ABORTED_DISCREMOVED;
// drive ready?
if (!FLAG_READY)
{
SetBit(SR0_NR, ref IntStatus);
SetBit(SR0_EC, ref IntStatus);
// drive ready?
if (!FLAG_READY)
{
SetBit(SR0_NR, ref IntStatus);
SetBit(SR0_EC, ref IntStatus);
// are we recalibrating?
if (CurrentState == DriveMainState.Recalibrate)
{
SetBit(SR0_EC, ref IntStatus);
}
}
// are we recalibrating?
if (CurrentState == DriveMainState.Recalibrate)
{
SetBit(SR0_EC, ref IntStatus);
}
}
// set seek end
SetBit(SR0_SE, ref IntStatus);
/*
// head address
if (CurrentSide > 0)
{
SetBit(SR0_HD, ref IntStatus);
// set seek end
SetBit(SR0_SE, ref IntStatus);
/*
// head address
if (CurrentSide > 0)
{
SetBit(SR0_HD, ref IntStatus);
// drive only supports 1 head
// set the EC bit
SetBit(SR0_EC, ref IntStatus);
}
*/
// drive only supports 1 head
// set the EC bit
SetBit(SR0_EC, ref IntStatus);
}
*/
/*
// UnitSelect
SetUnitSelect(ID, ref IntStatus);
@ -730,7 +728,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
FLAG_SEEK_INTERRUPT = true;
//CurrentState = DriveMainState.None;
}
*/

View File

@ -9,11 +9,11 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// IPortIODevice
/// </summary>
/*
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
public partial class NECUPD765 : IPortIODevice
{
public string outputfile = @"D:\Dropbox\Dropbox\_Programming\TASVideos\BizHawk\output\zxhawkio-" + DateTime.Now.ToString("yyyyMMdd_HHmmss", DateTimeFormatInfo.InvariantInfo) + ".csv";
@ -27,15 +27,15 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/*
* Status read
* Data write
* Data read
* CMD code
* CMD string
* MT flag
* MK flag
* SK flag
* */
* Status read
* Data write
* Data read
* CMD code
* CMD string
* MT flag
* MK flag
* SK flag
* */
private readonly string[] workingArr = new string[3];
private void BuildCSVLine()

View File

@ -5,11 +5,11 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// Timimng
/// </summary>
/*
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
public partial class NECUPD765
{
/// <summary>
@ -86,7 +86,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
long TStatesPerDriveCycle = (long)(_machine.GateArray.Z80ClockSpeed / DriveClock);
StatesPerDriveTick = TStatesPerDriveCycle;
}
/// <summary>

View File

@ -7,11 +7,11 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// The NEC floppy disk controller (and floppy drive) found in the +3
/// </summary>
/*
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
public partial class NECUPD765
{
/// <summary>
@ -73,9 +73,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
//d.IntStatus = 0;
//d.SeekState = SeekSubState.Idle;
//d.SeekIntState = SeekIntStatus.Normal;
}
}
/// <summary>
@ -86,56 +84,56 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
{
CommandList = new List<Command>
{
// read data
new Command { CommandDelegate = UPD_ReadData, CommandCode = 0x06, MT = true, MF = true, SK = true, IsRead = true,
// read data
new Command { CommandDelegate = UPD_ReadData, CommandCode = 0x06, MT = true, MF = true, SK = true, IsRead = true,
Direction = CommandDirection.OUT, ParameterByteCount = 8, ResultByteCount = 7 },
// read id
new Command { CommandDelegate = UPD_ReadID, CommandCode = 0x0a, MF = true, IsRead = true,
// read id
new Command { CommandDelegate = UPD_ReadID, CommandCode = 0x0a, MF = true, IsRead = true,
Direction = CommandDirection.OUT, ParameterByteCount = 1, ResultByteCount = 7 },
// specify
new Command { CommandDelegate = UPD_Specify, CommandCode = 0x03,
// specify
new Command { CommandDelegate = UPD_Specify, CommandCode = 0x03,
Direction = CommandDirection.OUT, ParameterByteCount = 2, ResultByteCount = 0 },
// read diagnostic
new Command { CommandDelegate = UPD_ReadDiagnostic, CommandCode = 0x02, MF = true, SK = true, IsRead = true,
// read diagnostic
new Command { CommandDelegate = UPD_ReadDiagnostic, CommandCode = 0x02, MF = true, SK = true, IsRead = true,
Direction = CommandDirection.OUT, ParameterByteCount = 8, ResultByteCount = 7 },
// scan equal
new Command { CommandDelegate = UPD_ScanEqual, CommandCode = 0x11, MT = true, MF = true, SK = true, IsRead = true,
// scan equal
new Command { CommandDelegate = UPD_ScanEqual, CommandCode = 0x11, MT = true, MF = true, SK = true, IsRead = true,
Direction = CommandDirection.IN, ParameterByteCount = 8, ResultByteCount = 7 },
// scan high or equal
new Command { CommandDelegate = UPD_ScanHighOrEqual, CommandCode = 0x1d, MT = true, MF = true, SK = true, IsRead = true,
// scan high or equal
new Command { CommandDelegate = UPD_ScanHighOrEqual, CommandCode = 0x1d, MT = true, MF = true, SK = true, IsRead = true,
Direction = CommandDirection.IN, ParameterByteCount = 8, ResultByteCount = 7 },
// scan low or equal
new Command { CommandDelegate = UPD_ScanLowOrEqual, CommandCode = 0x19, MT = true, MF = true, SK = true, IsRead = true,
// scan low or equal
new Command { CommandDelegate = UPD_ScanLowOrEqual, CommandCode = 0x19, MT = true, MF = true, SK = true, IsRead = true,
Direction = CommandDirection.IN, ParameterByteCount = 8, ResultByteCount = 7 },
// read deleted data
new Command { CommandDelegate = UPD_ReadDeletedData, CommandCode = 0x0c, MT = true, MF = true, SK = true, IsRead = true,
// read deleted data
new Command { CommandDelegate = UPD_ReadDeletedData, CommandCode = 0x0c, MT = true, MF = true, SK = true, IsRead = true,
Direction = CommandDirection.OUT, ParameterByteCount = 8, ResultByteCount = 7 },
// write data
new Command { CommandDelegate = UPD_WriteData, CommandCode = 0x05, MT = true, MF = true, IsWrite = true,
// write data
new Command { CommandDelegate = UPD_WriteData, CommandCode = 0x05, MT = true, MF = true, IsWrite = true,
Direction = CommandDirection.IN, ParameterByteCount = 8, ResultByteCount = 7 },
// write id
new Command { CommandDelegate = UPD_WriteID, CommandCode = 0x0d, MF = true, IsWrite = true,
// write id
new Command { CommandDelegate = UPD_WriteID, CommandCode = 0x0d, MF = true, IsWrite = true,
Direction = CommandDirection.IN, ParameterByteCount = 5, ResultByteCount = 7 },
// write deleted data
new Command { CommandDelegate = UPD_WriteDeletedData, CommandCode = 0x09, MT = true, MF = true, IsWrite = true,
// write deleted data
new Command { CommandDelegate = UPD_WriteDeletedData, CommandCode = 0x09, MT = true, MF = true, IsWrite = true,
Direction = CommandDirection.IN, ParameterByteCount = 8, ResultByteCount = 7 },
// seek
new Command { CommandDelegate = UPD_Seek, CommandCode = 0x0f,
// seek
new Command { CommandDelegate = UPD_Seek, CommandCode = 0x0f,
Direction = CommandDirection.OUT, ParameterByteCount = 2, ResultByteCount = 0 },
// recalibrate (seek track00)
new Command { CommandDelegate = UPD_Recalibrate, CommandCode = 0x07,
// recalibrate (seek track00)
new Command { CommandDelegate = UPD_Recalibrate, CommandCode = 0x07,
Direction = CommandDirection.OUT, ParameterByteCount = 1, ResultByteCount = 0 },
// sense interrupt status
new Command { CommandDelegate = UPD_SenseInterruptStatus, CommandCode = 0x08,
// sense interrupt status
new Command { CommandDelegate = UPD_SenseInterruptStatus, CommandCode = 0x08,
Direction = CommandDirection.OUT, ParameterByteCount = 0, ResultByteCount = 2 },
// sense drive status
new Command { CommandDelegate = UPD_SenseDriveStatus, CommandCode = 0x04,
// sense drive status
new Command { CommandDelegate = UPD_SenseDriveStatus, CommandCode = 0x04,
Direction = CommandDirection.OUT, ParameterByteCount = 1, ResultByteCount = 1 },
// version
new Command { CommandDelegate = UPD_Version, CommandCode = 0x10,
// version
new Command { CommandDelegate = UPD_Version, CommandCode = 0x10,
Direction = CommandDirection.OUT, ParameterByteCount = 0, ResultByteCount = 1 },
// invalid
new Command { CommandDelegate = UPD_Invalid, CommandCode = 0x00,
// invalid
new Command { CommandDelegate = UPD_Invalid, CommandCode = 0x00,
Direction = CommandDirection.OUT, ParameterByteCount = 0, ResultByteCount = 1 },
};
}

View File

@ -6,11 +6,11 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// Static helper methods
/// </summary>
/*
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
public partial class NECUPD765
{
/// <summary>

View File

@ -146,34 +146,34 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/// </summary>
private static readonly int[] CPCFirmwarePalette =
{
Colors.ARGB(0x00, 0x00, 0x00), // Black 0
Colors.ARGB(0x00, 0x00, 0x80), // Blue 1
Colors.ARGB(0x00, 0x00, 0xFF), // Bright Blue 2
Colors.ARGB(0x80, 0x00, 0x00), // Red 3
Colors.ARGB(0x80, 0x00, 0x80), // Magenta 4
Colors.ARGB(0x80, 0x00, 0xFF), // Mauve 5
Colors.ARGB(0xFF, 0x00, 0x00), // Bright Red 6
Colors.ARGB(0xFF, 0x00, 0x80), // Purple 7
Colors.ARGB(0xFF, 0x00, 0xFF), // Bright Magenta 8
Colors.ARGB(0x00, 0x80, 0x00), // Green 9
Colors.ARGB(0x00, 0x80, 0x80), // Cyan 10
Colors.ARGB(0x00, 0x80, 0xFF), // Sky Blue 11
Colors.ARGB(0x80, 0x80, 0x00), // Yellow 12
Colors.ARGB(0x80, 0x80, 0x80), // White 13
Colors.ARGB(0x80, 0x80, 0xFF), // Pastel Blue 14
Colors.ARGB(0xFF, 0x80, 0x00), // Orange 15
Colors.ARGB(0xFF, 0x80, 0x80), // Pink 16
Colors.ARGB(0xFF, 0x80, 0xFF), // Pastel Magenta 17
Colors.ARGB(0x00, 0xFF, 0x00), // Bright Green 18
Colors.ARGB(0x00, 0xFF, 0x80), // Sea Green 19
Colors.ARGB(0x00, 0xFF, 0xFF), // Bright Cyan 20
Colors.ARGB(0x80, 0xFF, 0x00), // Lime 21
Colors.ARGB(0x80, 0xFF, 0x80), // Pastel Green 22
Colors.ARGB(0x80, 0xFF, 0xFF), // Pastel Cyan 23
Colors.ARGB(0xFF, 0xFF, 0x00), // Bright Yellow 24
Colors.ARGB(0xFF, 0xFF, 0x80), // Pastel Yellow 25
Colors.ARGB(0xFF, 0xFF, 0xFF), // Bright White 26
};
Colors.ARGB(0x00, 0x00, 0x00), // Black 0
Colors.ARGB(0x00, 0x00, 0x80), // Blue 1
Colors.ARGB(0x00, 0x00, 0xFF), // Bright Blue 2
Colors.ARGB(0x80, 0x00, 0x00), // Red 3
Colors.ARGB(0x80, 0x00, 0x80), // Magenta 4
Colors.ARGB(0x80, 0x00, 0xFF), // Mauve 5
Colors.ARGB(0xFF, 0x00, 0x00), // Bright Red 6
Colors.ARGB(0xFF, 0x00, 0x80), // Purple 7
Colors.ARGB(0xFF, 0x00, 0xFF), // Bright Magenta 8
Colors.ARGB(0x00, 0x80, 0x00), // Green 9
Colors.ARGB(0x00, 0x80, 0x80), // Cyan 10
Colors.ARGB(0x00, 0x80, 0xFF), // Sky Blue 11
Colors.ARGB(0x80, 0x80, 0x00), // Yellow 12
Colors.ARGB(0x80, 0x80, 0x80), // White 13
Colors.ARGB(0x80, 0x80, 0xFF), // Pastel Blue 14
Colors.ARGB(0xFF, 0x80, 0x00), // Orange 15
Colors.ARGB(0xFF, 0x80, 0x80), // Pink 16
Colors.ARGB(0xFF, 0x80, 0xFF), // Pastel Magenta 17
Colors.ARGB(0x00, 0xFF, 0x00), // Bright Green 18
Colors.ARGB(0x00, 0xFF, 0x80), // Sea Green 19
Colors.ARGB(0x00, 0xFF, 0xFF), // Bright Cyan 20
Colors.ARGB(0x80, 0xFF, 0x00), // Lime 21
Colors.ARGB(0x80, 0xFF, 0x80), // Pastel Green 22
Colors.ARGB(0x80, 0xFF, 0xFF), // Pastel Cyan 23
Colors.ARGB(0xFF, 0xFF, 0x00), // Bright Yellow 24
Colors.ARGB(0xFF, 0xFF, 0x80), // Pastel Yellow 25
Colors.ARGB(0xFF, 0xFF, 0xFF), // Bright White 26
};
/// <summary>
/// The standard CPC Pallete (ordered by hardware #)
@ -182,38 +182,38 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
private static readonly int[] CPCHardwarePalette =
{
Colors.ARGB(0x80, 0x80, 0x80), // White
Colors.ARGB(0x80, 0x80, 0x80), // White (duplicate)
Colors.ARGB(0x00, 0xFF, 0x80), // Sea Green
Colors.ARGB(0xFF, 0xFF, 0x80), // Pastel Yellow
Colors.ARGB(0x00, 0x00, 0x80), // Blue
Colors.ARGB(0xFF, 0x00, 0x80), // Purple
Colors.ARGB(0x00, 0x80, 0x80), // Cyan
Colors.ARGB(0xFF, 0x80, 0x80), // Pink
Colors.ARGB(0xFF, 0x00, 0x80), // Purple (duplicate)
Colors.ARGB(0xFF, 0xFF, 0x80), // Pastel Yellow (duplicate)
Colors.ARGB(0xFF, 0xFF, 0x00), // Bright Yellow
Colors.ARGB(0xFF, 0xFF, 0xFF), // Bright White
Colors.ARGB(0xFF, 0x00, 0x00), // Bright Red
Colors.ARGB(0xFF, 0x00, 0xFF), // Bright Magenta
Colors.ARGB(0xFF, 0x80, 0x00), // Orange
Colors.ARGB(0xFF, 0x80, 0xFF), // Pastel Magenta
Colors.ARGB(0x00, 0x00, 0x80), // Blue (duplicate)
Colors.ARGB(0x00, 0xFF, 0x80), // Sea Green (duplicate)
Colors.ARGB(0x00, 0xFF, 0x00), // Bright Green
Colors.ARGB(0x00, 0xFF, 0xFF), // Bright Cyan
Colors.ARGB(0x00, 0x00, 0x00), // Black
Colors.ARGB(0x00, 0x00, 0xFF), // Bright Blue
Colors.ARGB(0x00, 0x80, 0x00), // Green
Colors.ARGB(0x00, 0x80, 0xFF), // Sky Blue
Colors.ARGB(0x80, 0x00, 0x80), // Magenta
Colors.ARGB(0x80, 0xFF, 0x80), // Pastel Green
Colors.ARGB(0x80, 0xFF, 0x00), // Lime
Colors.ARGB(0x80, 0xFF, 0xFF), // Pastel Cyan
Colors.ARGB(0x80, 0x00, 0x00), // Red
Colors.ARGB(0x80, 0x00, 0xFF), // Mauve
Colors.ARGB(0x80, 0x80, 0x00), // Yellow
Colors.ARGB(0x80, 0x80, 0xFF), // Pastel Blue
};
Colors.ARGB(0x80, 0x80, 0x80), // White (duplicate)
Colors.ARGB(0x00, 0xFF, 0x80), // Sea Green
Colors.ARGB(0xFF, 0xFF, 0x80), // Pastel Yellow
Colors.ARGB(0x00, 0x00, 0x80), // Blue
Colors.ARGB(0xFF, 0x00, 0x80), // Purple
Colors.ARGB(0x00, 0x80, 0x80), // Cyan
Colors.ARGB(0xFF, 0x80, 0x80), // Pink
Colors.ARGB(0xFF, 0x00, 0x80), // Purple (duplicate)
Colors.ARGB(0xFF, 0xFF, 0x80), // Pastel Yellow (duplicate)
Colors.ARGB(0xFF, 0xFF, 0x00), // Bright Yellow
Colors.ARGB(0xFF, 0xFF, 0xFF), // Bright White
Colors.ARGB(0xFF, 0x00, 0x00), // Bright Red
Colors.ARGB(0xFF, 0x00, 0xFF), // Bright Magenta
Colors.ARGB(0xFF, 0x80, 0x00), // Orange
Colors.ARGB(0xFF, 0x80, 0xFF), // Pastel Magenta
Colors.ARGB(0x00, 0x00, 0x80), // Blue (duplicate)
Colors.ARGB(0x00, 0xFF, 0x80), // Sea Green (duplicate)
Colors.ARGB(0x00, 0xFF, 0x00), // Bright Green
Colors.ARGB(0x00, 0xFF, 0xFF), // Bright Cyan
Colors.ARGB(0x00, 0x00, 0x00), // Black
Colors.ARGB(0x00, 0x00, 0xFF), // Bright Blue
Colors.ARGB(0x00, 0x80, 0x00), // Green
Colors.ARGB(0x00, 0x80, 0xFF), // Sky Blue
Colors.ARGB(0x80, 0x00, 0x80), // Magenta
Colors.ARGB(0x80, 0xFF, 0x80), // Pastel Green
Colors.ARGB(0x80, 0xFF, 0x00), // Lime
Colors.ARGB(0x80, 0xFF, 0xFF), // Pastel Cyan
Colors.ARGB(0x80, 0x00, 0x00), // Red
Colors.ARGB(0x80, 0x00, 0xFF), // Mauve
Colors.ARGB(0x80, 0x80, 0x00), // Yellow
Colors.ARGB(0x80, 0x80, 0xFF), // Pastel Blue
};
/// <summary>
/// 4bit Screen Mode Value
@ -419,8 +419,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
FrameEnd = true;
LastGAFrameClocks = GAClockCounter;
}
}
}
private int _v26;
@ -875,7 +873,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
case 7:
pen = ((dataByte & 0x10) >> 4) | ((dataByte & 0x01) << 1);
break;
}
break;

View File

@ -61,26 +61,26 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// scancode rows, ascending (Bit0 - Bit7)
KeyboardMatrix = new string[]
{
// 0x40
"Key CURUP", "Key CURRIGHT", "Key CURDOWN", "Key NUM9", "Key NUM6", "Key NUM3", "Key ENTER", "Key NUMPERIOD",
// 0x41
"Key CURLEFT", "Key COPY", "Key NUM7", "Key NUM8", "Key NUM5", "Key NUM1", "Key NUM2", "Key NUM0",
// 0x42
"Key CLR", "Key LeftBracket", "Key RETURN", "Key RightBracket", "Key NUM4", "Key SHIFT", "Key BackSlash", "Key CONTROL",
// 0x43
"Key Hat", "Key Dash", "Key @", "Key P", "Key SemiColon", "Key Colon", "Key ForwardSlash", "Key Period",
// 0x44
"Key 0", "Key 9", "Key O", "Key I", "Key L", "Key K", "Key M", "Key Comma",
// 0x45
"Key 8", "Key 7", "Key U", "Key Y", "Key H", "Key J", "Key N", "Key SPACE",
// 0x46
"Key 6", "Key 5", "Key R", "Key T", "Key G", "Key F", "Key B", "Key V",
// 0x47
"Key 4", "Key 3", "Key E", "Key W", "Key S", "Key D", "Key C", "Key X",
// 0x48
"Key 1", "Key 2", "Key ESC", "Key Q", "Key TAB", "Key A", "Key CAPSLOCK", "Key Z",
// 0x49
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Fire1", "P1 Fire2", "P1 Fire3", "Key DEL",
// 0x40
"Key CURUP", "Key CURRIGHT", "Key CURDOWN", "Key NUM9", "Key NUM6", "Key NUM3", "Key ENTER", "Key NUMPERIOD",
// 0x41
"Key CURLEFT", "Key COPY", "Key NUM7", "Key NUM8", "Key NUM5", "Key NUM1", "Key NUM2", "Key NUM0",
// 0x42
"Key CLR", "Key LeftBracket", "Key RETURN", "Key RightBracket", "Key NUM4", "Key SHIFT", "Key BackSlash", "Key CONTROL",
// 0x43
"Key Hat", "Key Dash", "Key @", "Key P", "Key SemiColon", "Key Colon", "Key ForwardSlash", "Key Period",
// 0x44
"Key 0", "Key 9", "Key O", "Key I", "Key L", "Key K", "Key M", "Key Comma",
// 0x45
"Key 8", "Key 7", "Key U", "Key Y", "Key H", "Key J", "Key N", "Key SPACE",
// 0x46
"Key 6", "Key 5", "Key R", "Key T", "Key G", "Key F", "Key B", "Key V",
// 0x47
"Key 4", "Key 3", "Key E", "Key W", "Key S", "Key D", "Key C", "Key X",
// 0x48
"Key 1", "Key 2", "Key ESC", "Key Q", "Key TAB", "Key A", "Key CAPSLOCK", "Key Z",
// 0x49
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Fire1", "P1 Fire2", "P1 Fire3", "Key DEL",
};

View File

@ -290,11 +290,11 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
/*
#F4XX %xxxx0x00 xxxxxxxx 8255 PIO Port A (PSG Data) Read Write
#F5XX %xxxx0x01 xxxxxxxx 8255 PIO Port B (Vsync,PrnBusy,Tape,etc.) Read -
#F6XX %xxxx0x10 xxxxxxxx 8255 PIO Port C (KeybRow,Tape,PSG Control) - Write
#F7XX %xxxx0x11 xxxxxxxx 8255 PIO Control-Register - Write
*/
#F4XX %xxxx0x00 xxxxxxxx 8255 PIO Port A (PSG Data) Read Write
#F5XX %xxxx0x01 xxxxxxxx 8255 PIO Port B (Vsync,PrnBusy,Tape,etc.) Read -
#F6XX %xxxx0x10 xxxxxxxx 8255 PIO Port C (KeybRow,Tape,PSG Control) - Write
#F7XX %xxxx0x11 xxxxxxxx 8255 PIO Control-Register - Write
*/
/// <summary>
/// Device responds to an IN instruction

View File

@ -114,7 +114,6 @@
for (int i = 0; i < 0x4000; i++)
{
ROMLower[i] = r.RomBytes[i];
}
}
else

View File

@ -229,7 +229,6 @@
for (int i = 0; i < 0x4000; i++)
{
ROMLower[i] = r.RomBytes[i];
}
}
else

View File

@ -202,52 +202,52 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public virtual void HardReset()
{
/*
//ULADevice.ResetInterrupt();
ROMPaged = 0;
SpecialPagingMode = false;
RAMPaged = 0;
CPU.RegPC = 0;
//ULADevice.ResetInterrupt();
ROMPaged = 0;
SpecialPagingMode = false;
RAMPaged = 0;
CPU.RegPC = 0;
Spectrum.SetCpuRegister("SP", 0xFFFF);
Spectrum.SetCpuRegister("IY", 0xFFFF);
Spectrum.SetCpuRegister("IX", 0xFFFF);
Spectrum.SetCpuRegister("AF", 0xFFFF);
Spectrum.SetCpuRegister("BC", 0xFFFF);
Spectrum.SetCpuRegister("DE", 0xFFFF);
Spectrum.SetCpuRegister("HL", 0xFFFF);
Spectrum.SetCpuRegister("SP", 0xFFFF);
Spectrum.SetCpuRegister("Shadow AF", 0xFFFF);
Spectrum.SetCpuRegister("Shadow BC", 0xFFFF);
Spectrum.SetCpuRegister("Shadow DE", 0xFFFF);
Spectrum.SetCpuRegister("Shadow HL", 0xFFFF);
Spectrum.SetCpuRegister("SP", 0xFFFF);
Spectrum.SetCpuRegister("IY", 0xFFFF);
Spectrum.SetCpuRegister("IX", 0xFFFF);
Spectrum.SetCpuRegister("AF", 0xFFFF);
Spectrum.SetCpuRegister("BC", 0xFFFF);
Spectrum.SetCpuRegister("DE", 0xFFFF);
Spectrum.SetCpuRegister("HL", 0xFFFF);
Spectrum.SetCpuRegister("SP", 0xFFFF);
Spectrum.SetCpuRegister("Shadow AF", 0xFFFF);
Spectrum.SetCpuRegister("Shadow BC", 0xFFFF);
Spectrum.SetCpuRegister("Shadow DE", 0xFFFF);
Spectrum.SetCpuRegister("Shadow HL", 0xFFFF);
CPU.Regs[CPU.I] = 0;
CPU.Regs[CPU.R] = 0;
CPU.Regs[CPU.I] = 0;
CPU.Regs[CPU.R] = 0;
TapeDevice.Reset();
if (AYDevice != null)
AYDevice.Reset();
TapeDevice.Reset();
if (AYDevice != null)
AYDevice.Reset();
byte[][] rams = new byte[][]
{
RAM0,
RAM1,
RAM2,
RAM3,
RAM4,
RAM5,
RAM6,
RAM7
};
byte[][] rams = new byte[][]
{
RAM0,
RAM1,
RAM2,
RAM3,
RAM4,
RAM5,
RAM6,
RAM7
};
foreach (var r in rams)
{
for (int i = 0; i < r.Length; i++)
{
r[i] = 0x00;
}
}
*/
foreach (var r in rams)
{
for (int i = 0; i < r.Length; i++)
{
r[i] = 0x00;
}
}
*/
}
/// <summary>
@ -256,52 +256,52 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public virtual void SoftReset()
{
/*
//ULADevice.ResetInterrupt();
ROMPaged = 0;
SpecialPagingMode = false;
RAMPaged = 0;
CPU.RegPC = 0;
//ULADevice.ResetInterrupt();
ROMPaged = 0;
SpecialPagingMode = false;
RAMPaged = 0;
CPU.RegPC = 0;
Spectrum.SetCpuRegister("SP", 0xFFFF);
Spectrum.SetCpuRegister("IY", 0xFFFF);
Spectrum.SetCpuRegister("IX", 0xFFFF);
Spectrum.SetCpuRegister("AF", 0xFFFF);
Spectrum.SetCpuRegister("BC", 0xFFFF);
Spectrum.SetCpuRegister("DE", 0xFFFF);
Spectrum.SetCpuRegister("HL", 0xFFFF);
Spectrum.SetCpuRegister("SP", 0xFFFF);
Spectrum.SetCpuRegister("Shadow AF", 0xFFFF);
Spectrum.SetCpuRegister("Shadow BC", 0xFFFF);
Spectrum.SetCpuRegister("Shadow DE", 0xFFFF);
Spectrum.SetCpuRegister("Shadow HL", 0xFFFF);
Spectrum.SetCpuRegister("SP", 0xFFFF);
Spectrum.SetCpuRegister("IY", 0xFFFF);
Spectrum.SetCpuRegister("IX", 0xFFFF);
Spectrum.SetCpuRegister("AF", 0xFFFF);
Spectrum.SetCpuRegister("BC", 0xFFFF);
Spectrum.SetCpuRegister("DE", 0xFFFF);
Spectrum.SetCpuRegister("HL", 0xFFFF);
Spectrum.SetCpuRegister("SP", 0xFFFF);
Spectrum.SetCpuRegister("Shadow AF", 0xFFFF);
Spectrum.SetCpuRegister("Shadow BC", 0xFFFF);
Spectrum.SetCpuRegister("Shadow DE", 0xFFFF);
Spectrum.SetCpuRegister("Shadow HL", 0xFFFF);
CPU.Regs[CPU.I] = 0;
CPU.Regs[CPU.R] = 0;
CPU.Regs[CPU.I] = 0;
CPU.Regs[CPU.R] = 0;
TapeDevice.Reset();
if (AYDevice != null)
AYDevice.Reset();
TapeDevice.Reset();
if (AYDevice != null)
AYDevice.Reset();
byte[][] rams = new byte[][]
{
RAM0,
RAM1,
RAM2,
RAM3,
RAM4,
RAM5,
RAM6,
RAM7
};
byte[][] rams = new byte[][]
{
RAM0,
RAM1,
RAM2,
RAM3,
RAM4,
RAM5,
RAM6,
RAM7
};
foreach (var r in rams)
{
for (int i = 0; i < r.Length; i++)
{
r[i] = 0x00;
}
}
*/
foreach (var r in rams)
{
for (int i = 0; i < r.Length; i++)
{
r[i] = 0x00;
}
}
*/
}
public void SyncState(Serializer ser)

View File

@ -400,103 +400,102 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
/*
/// <summary>
/// Should be run at the end of the ParseDisk process
/// If speedlock is detected the flag is set in the disk image
/// </summary>
protected virtual void SpeedlockDetection()
{
/// <summary>
/// Should be run at the end of the ParseDisk process
/// If speedlock is detected the flag is set in the disk image
/// </summary>
protected virtual void SpeedlockDetection()
{
if (DiskTracks.Length == 0)
return;
if (DiskTracks.Length == 0)
return;
// check for speedlock copyright notice
string ident = Encoding.ASCII.GetString(DiskData, 0x100, 0x1400);
if (!ident.ContainsIgnoreCase("SPEEDLOCK"))
{
// speedlock not found
return;
}
// check for speedlock copyright notice
string ident = Encoding.ASCII.GetString(DiskData, 0x100, 0x1400);
if (!ident.ContainsIgnoreCase("SPEEDLOCK"))
{
// speedlock not found
return;
}
// get cylinder 0
var cyl = DiskTracks[0];
// get cylinder 0
var cyl = DiskTracks[0];
// get sector with ID=2
var sec = cyl.Sectors.Where(a => a.SectorID == 2).FirstOrDefault();
// get sector with ID=2
var sec = cyl.Sectors.Where(a => a.SectorID == 2).FirstOrDefault();
if (sec == null)
return;
if (sec == null)
return;
// check for already multiple weak copies
if (sec.ContainsMultipleWeakSectors || sec.SectorData.Length != 0x80 << sec.SectorSize)
return;
// check for already multiple weak copies
if (sec.ContainsMultipleWeakSectors || sec.SectorData.Length != 0x80 << sec.SectorSize)
return;
// check for invalid crcs in sector 2
if (sec.Status1.Bit(5) || sec.Status2.Bit(5))
{
Protection = ProtectionType.Speedlock;
}
else
{
return;
}
// check for invalid crcs in sector 2
if (sec.Status1.Bit(5) || sec.Status2.Bit(5))
{
Protection = ProtectionType.Speedlock;
}
else
{
return;
}
// we are going to create a total of 5 weak sector copies
// keeping the original copy
byte[] origData = sec.SectorData.ToArray();
List<byte> data = new(); //TODO pretty sure the length and indices here are known in advance and this can just be an array --yoshi
//Random rnd = new Random();
// we are going to create a total of 5 weak sector copies
// keeping the original copy
byte[] origData = sec.SectorData.ToArray();
List<byte> data = new(); //TODO pretty sure the length and indices here are known in advance and this can just be an array --yoshi
//Random rnd = new Random();
for (int i = 0; i < 6; i++)
{
for (int s = 0; s < origData.Length; s++)
{
if (i == 0)
{
data.Add(origData[s]);
continue;
}
for (int i = 0; i < 6; i++)
{
for (int s = 0; s < origData.Length; s++)
{
if (i == 0)
{
data.Add(origData[s]);
continue;
}
// deterministic 'random' implementation
int n = origData[s] + i + 1;
if (n > 0xff)
n = n - 0xff;
else if (n < 0)
n = 0xff + n;
// deterministic 'random' implementation
int n = origData[s] + i + 1;
if (n > 0xff)
n = n - 0xff;
else if (n < 0)
n = 0xff + n;
byte nByte = (byte)n;
byte nByte = (byte)n;
if (s < 336)
{
// non weak data
data.Add(origData[s]);
}
else if (s < 511)
{
// weak data
data.Add(nByte);
}
else if (s == 511)
{
// final sector byte
data.Add(nByte);
}
else
{
// speedlock sector should not be more than 512 bytes
// but in case it is just do non weak
data.Add(origData[i]);
}
}
}
if (s < 336)
{
// non weak data
data.Add(origData[s]);
}
else if (s < 511)
{
// weak data
data.Add(nByte);
}
else if (s == 511)
{
// final sector byte
data.Add(nByte);
}
else
{
// speedlock sector should not be more than 512 bytes
// but in case it is just do non weak
data.Add(origData[i]);
}
}
}
// commit the sector data
sec.SectorData = data.ToArray();
sec.ContainsMultipleWeakSectors = true;
sec.ActualDataByteLength = data.Count;
}
*/
// commit the sector data
sec.SectorData = data.ToArray();
sec.ContainsMultipleWeakSectors = true;
sec.ActualDataByteLength = data.Count;
}
*/
/// <summary>
/// Returns the track count for the disk
@ -670,14 +669,14 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
return res;
/*
int copies = ActualDataByteLength / (0x80 << SectorSize);
Random rnd = new Random();
int r = rnd.Next(0, copies - 1);
int step = r * (0x80 << SectorSize);
byte[] res = new byte[(0x80 << SectorSize)];
Array.Copy(SectorData, step, res, 0, 0x80 << SectorSize);
return res;
*/
int copies = ActualDataByteLength / (0x80 << SectorSize);
Random rnd = new Random();
int r = rnd.Next(0, copies - 1);
int step = r * (0x80 << SectorSize);
byte[] res = new byte[(0x80 << SectorSize)];
Array.Copy(SectorData, step, res, 0, 0x80 << SectorSize);
return res;
*/
}
}
}
@ -708,5 +707,4 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
PaulOwens,
ShadowOfTheBeast
}
}

View File

@ -105,14 +105,14 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public override bool CheckType(byte[] data)
{
/*
// TZX Header
length: 10 bytes
Offset Value Type Description
0x00 "ZXTape!" ASCII[7] TZX signature
0x07 0x1A BYTE End of text file marker
0x08 1 BYTE TZX major revision number
0x09 20 BYTE TZX minor revision number
*/
// TZX Header
length: 10 bytes
Offset Value Type Description
0x00 "ZXTape!" ASCII[7] TZX signature
0x07 0x1A BYTE End of text file marker
0x08 1 BYTE TZX major revision number
0x09 20 BYTE TZX minor revision number
*/
// check whether this is a valid tzx format file by looking at the identifier in the header
// (first 7 bytes of the file)
@ -181,16 +181,16 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
/*
// convert for Amstrad CPC
List<TapeDataBlock> newBlocks = new List<TapeDataBlock>();
for (int i = 0; i < _datacorder.DataBlocks.Count; i++)
{
newBlocks.Add(ConvertClock(_datacorder.DataBlocks[i]));
}
// convert for Amstrad CPC
List<TapeDataBlock> newBlocks = new List<TapeDataBlock>();
for (int i = 0; i < _datacorder.DataBlocks.Count; i++)
{
newBlocks.Add(ConvertClock(_datacorder.DataBlocks[i]));
}
_datacorder.DataBlocks.Clear();
_datacorder.DataBlocks.AddRange(newBlocks);
*/
_datacorder.DataBlocks.Clear();
_datacorder.DataBlocks.AddRange(newBlocks);
*/
}
/// <summary>
@ -860,7 +860,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// add 1ms period
//t.DataPeriods.Add(3500);
//pauseDuration = -1;
}
else
{
@ -880,7 +879,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// generate PAUSE block
CreatePauseBlock(_datacorder.DataBlocks[_datacorder.DataBlocks.Count - 1]);
}
/* length: [00]+01
@ -1589,18 +1587,19 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
_position += 8;
}
/* length: [01,02,03]+04
Offset Value Type Description
0x00 - BYTE Snapshot type:
00: .Z80 format
01: .SNA format
0x01 L BYTE[3] Snapshot length
0x04 - BYTE[L] Snapshot itself
/* length: [01,02,03]+04
Offset Value Type Description
0x00 - BYTE Snapshot type:
00: .Z80 format
01: .SNA format
0x01 L BYTE[3] Snapshot length
0x04 - BYTE[L] Snapshot itself
This would enable one to snapshot the game at the start and still have all the tape blocks (level data, etc.) in the same file.
Only .Z80 and .SNA snapshots are supported for compatibility reasons!
The emulator should take care of that the snapshot is not taken while the actual Tape loading is taking place (which doesn't do much sense).
And when an emulator encounters the snapshot block it should load it and then continue with the next block. */
This would enable one to snapshot the game at the start and still have all the tape blocks (level data, etc.) in the same file.
Only .Z80 and .SNA snapshots are supported for compatibility reasons!
The emulator should take care of that the snapshot is not taken while the actual Tape loading is taking place (which doesn't do much sense).
And when an emulator encounters the snapshot block it should load it and then continue with the next block.
*/
private void ProcessBlockID40(byte[] data)
{
// currently not implemented properly in CPCHawk
@ -1649,12 +1648,13 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
string description = string.Empty;
// process the type byte
/* (The type is 0,1,2 or 3 for a Program, Number array, Character array or Code file.
A SCREEN$ file is regarded as a Code file with start address 16384 and length 6912 decimal.
If the file is a Program file, parameter 1 holds the autostart line number (or a number >=32768 if no LINE parameter was given)
and parameter 2 holds the start of the variable area relative to the start of the program. If it's a Code file, parameter 1 holds
the start of the code block when saved, and parameter 2 holds 32768. For data files finally, the byte at position 14 decimal holds the variable name.)
*/
/*
(The type is 0,1,2 or 3 for a Program, Number array, Character array or Code file.
A SCREEN$ file is regarded as a Code file with start address 16384 and length 6912 decimal.
If the file is a Program file, parameter 1 holds the autostart line number (or a number >=32768 if no LINE parameter was given)
and parameter 2 holds the start of the variable area relative to the start of the program. If it's a Code file, parameter 1 holds
the start of the code block when saved, and parameter 2 holds 32768. For data files finally, the byte at position 14 decimal holds the variable name.)
*/
int blockSize = blockdata.Length;
@ -1710,49 +1710,49 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
block.AddMetaData(BlockDescriptorTitle.Undefined, description);
}
/*
if (blockdata[0] == 0x00 && blockSize == 19 && (blockdata[1] == 0x00) || (blockdata[1] == 3 && blockdata.Length > 3))
{
if (dataBlockType != DataBlockType.Turbo)
{
// This is the program header
string fileName = Encoding.ASCII.GetString(blockdata.Skip(2).Take(10).ToArray()).Trim();
if (blockdata[0] == 0x00 && blockSize == 19 && (blockdata[1] == 0x00) || (blockdata[1] == 3 && blockdata.Length > 3))
{
if (dataBlockType != DataBlockType.Turbo)
{
// This is the program header
string fileName = Encoding.ASCII.GetString(blockdata.Skip(2).Take(10).ToArray()).Trim();
string type = "";
if (blockdata[0] == 0x00)
{
type = "Program";
block.AddMetaData(BlockDescriptorTitle.Program, fileName);
}
else
{
type = "Bytes";
block.AddMetaData(BlockDescriptorTitle.Bytes, fileName);
}
string type = "";
if (blockdata[0] == 0x00)
{
type = "Program";
block.AddMetaData(BlockDescriptorTitle.Program, fileName);
}
else
{
type = "Bytes";
block.AddMetaData(BlockDescriptorTitle.Bytes, fileName);
}
// now build the description string
StringBuilder sb = new StringBuilder();
sb.Append(type + ": ");
sb.Append(fileName + " ");
sb.Append(GetWordValue(blockdata, 14));
sb.Append(':');
sb.Append(GetWordValue(blockdata, 12));
description = sb.ToString();
}
}
else if (blockdata[0] == 0xFF)
{
// this is a data block
description = "Data Block " + (blockSize - 2) + "bytes";
block.AddMetaData(BlockDescriptorTitle.Data_Bytes, (blockSize - 2).ToString() + " Bytes");
}
else
{
// other type
description = $"#{blockdata[0]:X2} block, {blockSize} bytes";
//description += (crc != 0) ? $", crc bad (#{crcFile:X2}!=#{crcValue:X2})" : ", crc ok";
block.AddMetaData(BlockDescriptorTitle.Undefined, description);
}
*/
// now build the description string
StringBuilder sb = new StringBuilder();
sb.Append(type + ": ");
sb.Append(fileName + " ");
sb.Append(GetWordValue(blockdata, 14));
sb.Append(':');
sb.Append(GetWordValue(blockdata, 12));
description = sb.ToString();
}
}
else if (blockdata[0] == 0xFF)
{
// this is a data block
description = "Data Block " + (blockSize - 2) + "bytes";
block.AddMetaData(BlockDescriptorTitle.Data_Bytes, (blockSize - 2).ToString() + " Bytes");
}
else
{
// other type
description = $"#{blockdata[0]:X2} block, {blockSize} bytes";
//description += (crc != 0) ? $", crc bad (#{crcFile:X2}!=#{crcValue:X2})" : ", crc ok";
block.AddMetaData(BlockDescriptorTitle.Undefined, description);
}
*/
}
// update metadata
@ -1869,13 +1869,13 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
int pilotCount = 3220;
/*
// pilot count needs to be ascertained from flag byte
int pilotCount;
if (blockData[0] < 128)
pilotCount = 8063;
else
pilotCount = 3223;
*/
// pilot count needs to be ascertained from flag byte
int pilotCount;
if (blockData[0] < 128)
pilotCount = 8063;
else
pilotCount = 3223;
*/
// now we can decode
var nBlock = DecodeDataBlock

View File

@ -53,29 +53,29 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
/*
/// <summary>
/// An array of bytearray encoded strings (stored in this format for easy Bizhawk serialization)
/// Its basically tape information
/// </summary>
private byte[][] _tapeDescriptionData;
/// <summary>
/// An array of bytearray encoded strings (stored in this format for easy Bizhawk serialization)
/// Its basically tape information
/// </summary>
private byte[][] _tapeDescriptionData;
/// <summary>
/// Returns the Tape Description Data in a human readable format
/// </summary>
public List<string> TapeDescriptionData
{
get
{
List<string> data = new List<string>();
/// <summary>
/// Returns the Tape Description Data in a human readable format
/// </summary>
public List<string> TapeDescriptionData
{
get
{
List<string> data = new List<string>();
foreach (byte[] b in _tapeDescriptionData)
{
data.Add(Encoding.ASCII.GetString(b));
}
foreach (byte[] b in _tapeDescriptionData)
{
data.Add(Encoding.ASCII.GetString(b));
}
return data;
}
}
return data;
}
}
*/

View File

@ -193,7 +193,6 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
else
sectorVal += sp.Buffer[i];
}
}
samples[i] = sectorVal;

View File

@ -0,0 +1,7 @@
# This core has existing violations, but let's assume they are in the middle of a refactor and let them be.
[*.cs]
# Remove unused private member
dotnet_diagnostic.IDE0051.severity = suggestion
# Remove unread private member
dotnet_diagnostic.IDE0052.severity = suggestion

View File

@ -63,7 +63,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
_outputBuffer[i * 2] = unchecked((short)_mixer);
_outputBuffer[i * 2 + 1] = unchecked((short)_mixer);
}
samples = _outputBuffer;
@ -72,6 +71,5 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
_outputBufferIndex = 0;
_filterIndex = 0;
}
}
}

View File

@ -5,18 +5,18 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
public sealed partial class Sid
{
/*
Commodore SID 6581/8580 core.
Commodore SID 6581/8580 core.
Many thanks to:
- Michael Huth for die shots of the 6569R3 chip (to get ideas how to implement)
http://mail.lipsia.de/~enigma/neu/6581.html
- Kevtris for figuring out ADSR tables
http://blog.kevtris.org/?p=13
- Mixer for a lot of useful SID info
http://www.sid.fi/sidwiki/doku.php?id=sid-knowledge
- Documentation collected by the libsidplayfp team
https://sourceforge.net/projects/sidplay-residfp/
*/
Many thanks to:
- Michael Huth for die shots of the 6569R3 chip (to get ideas how to implement)
http://mail.lipsia.de/~enigma/neu/6581.html
- Kevtris for figuring out ADSR tables
http://blog.kevtris.org/?p=13
- Mixer for a lot of useful SID info
http://www.sid.fi/sidwiki/doku.php?id=sid-knowledge
- Documentation collected by the libsidplayfp team
https://sourceforge.net/projects/sidplay-residfp/
*/
// ------------------------------------
public int _databus;
@ -324,7 +324,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
attenuation = 6 * attenuation;
_fftBuffer[i] = _fftBuffer[i] * Math.Pow(2, -Math.Abs(attenuation) / 10);
}
}
// now transform back into time space and reassemble the attenuated frequency components

View File

@ -317,7 +317,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
_nextIrq |= IRQ_T2;
_t2IrqAllowed = false;
}
}
if ((_t2C & 0xFF) == 0 && (_acr & ACR_SR_USE_T2) != 0)

View File

@ -65,7 +65,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
result[i] |= PipelineSpriteDma;
if (timing[i] == sprDisp)
result[i] |= PipelineSpriteDisplay;
}
return result.ToArray();

View File

@ -248,6 +248,5 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
_disk = null;
_diskBits = 0;
}
}
}

View File

@ -373,7 +373,6 @@ namespace BizHawk.Emulation.Cores.Computers.DOS
break;
default:
throw new InvalidOperationException($"Unsupported CD sector size: {sectorSize}");
}
DriveLightOn = true;
}

View File

@ -0,0 +1,7 @@
# This core has existing violations, but let's assume they are in the middle of a refactor and let them be.
[*.cs]
# Remove unused private member
dotnet_diagnostic.IDE0051.severity = suggestion
# Remove unread private member
dotnet_diagnostic.IDE0052.severity = suggestion

View File

@ -0,0 +1,7 @@
# This core has existing violations, but let's assume they are in the middle of a refactor and let them be.
[*.cs]
# Remove unused private member
dotnet_diagnostic.IDE0051.severity = suggestion
# Remove unread private member
dotnet_diagnostic.IDE0052.severity = suggestion

Some files were not shown because too many files have changed in this diff Show More