规整代码

This commit is contained in:
sin365 2025-02-17 15:47:53 +08:00
parent 1ceb8ef211
commit 78515fec78
29 changed files with 17 additions and 55 deletions

View File

@ -1,7 +1,4 @@
using Essgee.Emulation.Configuration;
using Essgee.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Collections.Generic;
using System.Drawing;

View File

@ -1,6 +1,4 @@
using System.Collections.Generic;
namespace Essgee.Emulation.Audio
namespace Essgee.Emulation.Audio
{
public partial class CGBAudio : DMGAudio, IAudio
{

View File

@ -2,10 +2,7 @@
using Essgee.Exceptions;
using Essgee.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Unity.VisualScripting.Dependencies.Sqlite;
namespace Essgee.Emulation.Audio
{

View File

@ -2,12 +2,9 @@
using Essgee.Exceptions;
using Essgee.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using UnityEngine.Playables;
using static Essgee.Emulation.Utilities;
using static UnityEditor.Experimental.AssetDatabaseExperimental.AssetDatabaseCounters;
namespace Essgee.Emulation.Audio
{
@ -188,7 +185,7 @@ namespace Essgee.Emulation.Audio
data.MemberData[nameof(channelCounters)] = channelCounters.ToByteArray();
data.MemberData[nameof(channelOutput)] = channelOutput.ToByteArray();
data.MemberData[nameof(latchedChannel)] = BitConverter.GetBytes( latchedChannel);
data.MemberData[nameof(latchedChannel)] = BitConverter.GetBytes(latchedChannel);
data.MemberData[nameof(latchedType)] = BitConverter.GetBytes(latchedType);
data.MemberData[nameof(noiseLfsr)] = BitConverter.GetBytes(noiseLfsr);

View File

@ -1,7 +1,4 @@
using static UnityEditor.Experimental.AssetDatabaseExperimental.AssetDatabaseCounters;
using System;
namespace Essgee.Emulation.Audio
namespace Essgee.Emulation.Audio
{
public class SegaSMSPSG : SN76489
{

View File

@ -1,6 +1,6 @@
namespace Essgee.Emulation.CPU
{
interface ICPU: IAxiStatus
interface ICPU : IAxiStatus
{
void Startup();
void Shutdown();

View File

@ -2,7 +2,6 @@
using Essgee.Utilities;
using System;
using System.Linq;
using Unity.VisualScripting;
using static Essgee.Emulation.Utilities;
namespace Essgee.Emulation.CPU

View File

@ -1,6 +1,6 @@
namespace Essgee.Emulation.Cartridges
{
internal interface ICartridge :IAxiStatus
internal interface ICartridge : IAxiStatus
{
void LoadRom(byte[] data);
void LoadRam(byte[] data);

View File

@ -29,7 +29,7 @@ namespace Essgee.Emulation.Cartridges.Sega
ramData = data.MemberData[nameof(ramData)];
pagingRegisters = data.MemberData[nameof(pagingRegisters)];
bankMask = data.MemberData[nameof(bankMask)].First();
isRamEnabled = BitConverter.ToBoolean( data.MemberData[nameof(isRamEnabled)]);
isRamEnabled = BitConverter.ToBoolean(data.MemberData[nameof(isRamEnabled)]);
}
public AxiEssgssStatusData SaveAxiStatus()

View File

@ -1,7 +1,6 @@
using Essgee.Exceptions;
using Essgee.Utilities;
using System;
using UnityEngine.Playables;
namespace Essgee.Emulation.Cartridges.Sega
{

View File

@ -1,7 +1,6 @@
using Essgee.Utilities;
using System;
using System.Linq;
using UnityEngine.Playables;
namespace Essgee.Emulation.Cartridges.Sega
{

View File

@ -1,6 +1,4 @@
using Essgee.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Essgee.Emulation.Configuration
{

View File

@ -2,7 +2,6 @@
using Essgee.Emulation.ExtDevices.Nintendo;
using Essgee.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
namespace Essgee.Emulation.Configuration

View File

@ -2,7 +2,6 @@
using Essgee.Emulation.ExtDevices.Nintendo;
using Essgee.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
namespace Essgee.Emulation.Configuration

View File

@ -1,6 +1,4 @@
using Essgee.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Essgee.Emulation.Configuration
{

View File

@ -1,6 +1,4 @@
using Essgee.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Essgee.Emulation.Configuration
{

View File

@ -1,7 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Essgee.Emulation.Configuration
namespace Essgee.Emulation.Configuration
{
//todo Unity [ElementPriority(1)]
public class SC3000 : IConfiguration

View File

@ -1,7 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Essgee.Emulation.Configuration
namespace Essgee.Emulation.Configuration
{
//todo Unity [ElementPriority(0)]
public class SG1000 : IConfiguration

View File

@ -5,7 +5,6 @@ using Essgee.Metadata;
using Essgee.Utilities;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;

View File

@ -263,7 +263,7 @@ namespace Essgee.Emulation.Machines
vdp.LoadAxiStatus(data.ClassData[nameof(vdp)]);
psg.LoadAxiStatus(data.ClassData[nameof(psg)]);
portControls1 = BitConverter.ToUInt16( data.MemberData[nameof(portControls1)]);
portControls1 = BitConverter.ToUInt16(data.MemberData[nameof(portControls1)]);
portControls2 = BitConverter.ToUInt16(data.MemberData[nameof(portControls2)]);
controlsReadMode = data.MemberData[nameof(controlsReadMode)].First();
isNmi = BitConverter.ToBoolean(data.MemberData[nameof(isNmi)]);

View File

@ -326,14 +326,14 @@ namespace Essgee.Emulation.Machines
{
AxiEssgssStatusData data = new AxiEssgssStatusData();
data.MemberData[nameof(configuration.Region)] = configuration.Region.ToByteArray();
data.ClassData[nameof(bootstrap)] = bootstrap.SaveAxiStatus();
data.ClassData[nameof(cartridge)] = cartridge.SaveAxiStatus();
data.MemberData[nameof(wram)] = wram;
data.ClassData[nameof(cpu)] = cpu.SaveAxiStatus();
data.ClassData[nameof(vdp)] = vdp.SaveAxiStatus();
data.ClassData[nameof(psg)] = psg.SaveAxiStatus();
data.MemberData[nameof(portMemoryControl)] = BitConverter.GetBytes(portMemoryControl);
data.MemberData[nameof(portIoControl)] = BitConverter.GetBytes(portIoControl);
data.MemberData[nameof(hCounterLatched)] = BitConverter.GetBytes(hCounterLatched);

View File

@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace Essgee.Emulation.Machines
{
public interface IMachine:IAxiStatus
public interface IMachine : IAxiStatus
{
event EventHandler<SendLogMessageEventArgs> SendLogMessage;
event EventHandler<EventArgs> EmulationReset;

View File

@ -340,9 +340,9 @@ namespace Essgee.Emulation.Machines
{
AxiEssgssStatusData data = new AxiEssgssStatusData();
data.MemberData[nameof(configuration.TVStandard)] = configuration.TVStandard.ToByteArray();
data.MemberData[nameof(configuration.Region)] = configuration.Region.ToByteArray();
data.MemberData[nameof(configuration.Region)] = configuration.Region.ToByteArray();
if(bootstrap != null)
if (bootstrap != null)
data.ClassData[nameof(bootstrap)] = bootstrap.SaveAxiStatus();
data.ClassData[nameof(cartridge)] = cartridge.SaveAxiStatus();

View File

@ -1,7 +1,6 @@
using Essgee.EventArguments;
using Essgee.Utilities;
using System;
using System.Runtime.InteropServices;
using static Essgee.Emulation.Utilities;
namespace Essgee.Emulation.Video

View File

@ -4,8 +4,6 @@ using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using Unity.Mathematics;
using Unity.VisualScripting;
using static Essgee.Emulation.Utilities;
namespace Essgee.Emulation.Video

View File

@ -5,7 +5,6 @@ using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using static Essgee.Emulation.Utilities;
using static UnityEditor.Experimental.AssetDatabaseExperimental.AssetDatabaseCounters;
namespace Essgee.Emulation.Video
{

View File

@ -20,7 +20,7 @@ namespace Essgee.EventArguments
//}
//public static EnqueueSamplesEventArgs Create(int numChannels, short[][] channelSamples, bool[] isMuted, short[] mixedSamples)
public static EnqueueSamplesEventArgs Create(int numChannels, short*[] channelSamples, bool[] isMuted, short* mixedSamples,int mixedSamplesLength)
public static EnqueueSamplesEventArgs Create(int numChannels, short*[] channelSamples, bool[] isMuted, short* mixedSamples, int mixedSamplesLength)
{
var eventArgs = ObjectPoolAuto.Acquire<EnqueueSamplesEventArgs>();
eventArgs.NumChannels = numChannels;

View File

@ -1,10 +1,8 @@
using Essgee.Utilities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
[Serializable]
public class AxiEssgssStatusData

View File

@ -18,7 +18,7 @@ namespace Essgee.Metadata
public interface IGameMetaReources
{
public bool GetCartMetadataDatabase(out string loadedData);
public bool GetDatBytes(string DatName,out byte[] loadedData);
public bool GetDatBytes(string DatName, out byte[] loadedData);
}
public class GameMetadataHandler
@ -37,7 +37,7 @@ namespace Essgee.Metadata
{
gameMetaReources = metaresources;
if(!gameMetaReources.GetCartMetadataDatabase(out string loadedData))
if (!gameMetaReources.GetCartMetadataDatabase(out string loadedData))
throw new HandlerException("CartMetadataDatabase file not found");
cartMetadataDatabase = JsonConvert.DeserializeObject<List<CartridgeJSON>>(loadedData);