mame essgee 不强依赖System的文件读写

This commit is contained in:
sin365 2025-04-24 19:50:55 +08:00
parent 36b614c4a7
commit e66740b8a9
76 changed files with 399 additions and 366 deletions

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace Essgee.Utilities namespace Essgee.Utilities
@ -84,21 +83,21 @@ namespace Essgee.Utilities
} }
#endregion #endregion
public static void Write(this BinaryWriter bw, byte* bufferPtr, int offset, int count) public static void Write(this System.IO.BinaryWriter bw, byte* bufferPtr, int offset, int count)
{ {
// 使用指针复制数据到临时数组 // 使用指针复制数据到临时数组
Buffer.MemoryCopy(bufferPtr + offset, TempBuffer, 0, count); Buffer.MemoryCopy(bufferPtr + offset, TempBuffer, 0, count);
// 使用BinaryWriter写入临时数组 // 使用BinaryWriter写入临时数组
bw.Write(TempBuffer_src, 0, count); bw.Write(TempBuffer_src, 0, count);
} }
public static void Write(this FileStream fs, byte* bufferPtr, int offset, int count) public static void Write(this System.IO.FileStream fs, byte* bufferPtr, int offset, int count)
{ {
// 使用指针复制数据到临时数组 // 使用指针复制数据到临时数组
Buffer.MemoryCopy(bufferPtr + offset, TempBuffer, 0, count); Buffer.MemoryCopy(bufferPtr + offset, TempBuffer, 0, count);
// 使用BinaryWriter写入临时数组 // 使用BinaryWriter写入临时数组
fs.Write(TempBuffer_src, 0, count); fs.Write(TempBuffer_src, 0, count);
} }
public static int Read(this FileStream fs, byte* bufferPtr, int offset, int count) public static int Read(this System.IO.FileStream fs, byte* bufferPtr, int offset, int count)
{ {
// 使用BinaryWriter写入临时数组 // 使用BinaryWriter写入临时数组
count = fs.Read(TempBuffer_src, offset, count); count = fs.Read(TempBuffer_src, offset, count);

View File

@ -1,5 +1,6 @@
using Essgee; using Essgee;
using Essgee.Metadata;
using System; using System;
public static class EmuStandInfo public static class EmuStandInfo

View File

@ -131,7 +131,8 @@ namespace Essgee.Emulation.CPU
{ {
if (AppEnvironment.EnableSuperSlowCPULogger && logEntries != null) if (AppEnvironment.EnableSuperSlowCPULogger && logEntries != null)
{ {
System.IO.File.AppendAllText(logFile, string.Join("", logEntries.Take(numLogEntries))); //TODO 暂时不要日志看后续是否需要加
//System.IO.File.AppendAllText(logFile, string.Join("", logEntries.Take(numLogEntries)));
} }
// //
@ -175,7 +176,8 @@ namespace Essgee.Emulation.CPU
logEntries[numLogEntries++] = disasm; logEntries[numLogEntries++] = disasm;
if (numLogEntries >= logEntries.Length) if (numLogEntries >= logEntries.Length)
{ {
System.IO.File.AppendAllText(logFile, string.Join("", logEntries)); //TODO 暂时不要日志看后续是否需要加
//System.IO.File.AppendAllText(logFile, string.Join("", logEntries));
numLogEntries = 0; numLogEntries = 0;
} }
} }

View File

@ -207,8 +207,9 @@ namespace Essgee.Emulation.CPU
if (AppEnvironment.EnableSuperSlowCPULogger) if (AppEnvironment.EnableSuperSlowCPULogger)
{ {
string disasm = string.Format("{0} | {1} | {2} | {3}\n", DisassembleOpcode(this, pc).PadRight(48), PrintRegisters(this), PrintFlags(this), PrintInterrupt(this)); //TODO 暂时不要日志看后续是否需要加
System.IO.File.AppendAllText(@"D:\Temp\Essgee\log.txt", disasm); //string disasm = string.Format("{0} | {1} | {2} | {3}\n", DisassembleOpcode(this, pc).PadRight(48), PrintRegisters(this), PrintFlags(this), PrintInterrupt(this));
//System.IO.File.AppendAllText(@"D:\Temp\Essgee\log.txt", disasm);
} }
/* Fetch and execute opcode */ /* Fetch and execute opcode */

View File

@ -3,7 +3,6 @@ using Essgee.Exceptions;
using Essgee.Utilities; using Essgee.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -32,19 +31,19 @@ namespace Essgee.Emulation
Type machineType = null; Type machineType = null;
byte[] romData = null; byte[] romData = null;
if (!File.Exists(fileName)) if (!EmulatorHandler.io.File_Exists(fileName))
throw new CartridgeLoaderException($"{fileType} file not found."); throw new CartridgeLoaderException($"{fileType} file not found.");
try try
{ {
var fileExtension = Path.GetExtension(fileName); var fileExtension = System.IO.Path.GetExtension(fileName);
if (fileExtension == ".zip") if (fileExtension == ".zip")
{ {
using (var zip = ZipFile.Open(fileName, ZipArchiveMode.Read)) using (var zip = ZipFile.Open(fileName, ZipArchiveMode.Read))
{ {
foreach (var entry in zip.Entries) foreach (var entry in zip.Entries)
{ {
var entryExtension = Path.GetExtension(entry.Name); var entryExtension = System.IO.Path.GetExtension(entry.Name);
if (fileExtensionSystemDictionary.ContainsKey(entryExtension)) if (fileExtensionSystemDictionary.ContainsKey(entryExtension))
{ {
machineType = fileExtensionSystemDictionary[entryExtension]; machineType = fileExtensionSystemDictionary[entryExtension];
@ -61,7 +60,7 @@ namespace Essgee.Emulation
else if (fileExtensionSystemDictionary.ContainsKey(fileExtension)) else if (fileExtensionSystemDictionary.ContainsKey(fileExtension))
{ {
machineType = fileExtensionSystemDictionary[fileExtension]; machineType = fileExtensionSystemDictionary[fileExtension];
romData = File.ReadAllBytes(fileName); romData = System.IO.File.ReadAllBytes(fileName);
} }
} }
catch (Exception ex) when (!AppEnvironment.DebugMode) catch (Exception ex) when (!AppEnvironment.DebugMode)

View File

@ -5,7 +5,6 @@ using Essgee.Metadata;
using Essgee.Utilities; using Essgee.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Threading; using System.Threading;
namespace Essgee.Emulation namespace Essgee.Emulation
@ -14,6 +13,7 @@ namespace Essgee.Emulation
{ {
readonly Action<Exception> exceptionHandler; readonly Action<Exception> exceptionHandler;
public static IEssgeeIOSupport io;
public IMachine emulator { get; private set; } public IMachine emulator { get; private set; }
Thread emulationThread; Thread emulationThread;
@ -158,7 +158,7 @@ namespace Essgee.Emulation
public string GetSaveStateFilename(int number) public string GetSaveStateFilename(int number)
{ {
return Path.Combine(EmuStandInfo.SaveStatePath, $"{Path.GetFileNameWithoutExtension(currentGameMetadata.FileName)} (State {number:D2}).est"); return System.IO.Path.Combine(EmuStandInfo.SaveStatePath, $"{System.IO.Path.GetFileNameWithoutExtension(currentGameMetadata.FileName)} (State {number:D2}).est");
} }
public void LoadState(int number) public void LoadState(int number)
@ -182,9 +182,9 @@ namespace Essgee.Emulation
byte[] ramData = new byte[currentGameMetadata.RamSize]; byte[] ramData = new byte[currentGameMetadata.RamSize];
var savePath = Path.Combine(EmuStandInfo.SaveDataPath, Path.ChangeExtension(currentGameMetadata.FileName, "sav")); var savePath = System.IO.Path.Combine(EmuStandInfo.SaveDataPath, System.IO.Path.ChangeExtension(currentGameMetadata.FileName, "sav"));
if (File.Exists(savePath)) if (EmulatorHandler.io.File_Exists(savePath))
ramData = File.ReadAllBytes(savePath); ramData = EmulatorHandler.io.File_ReadAllBytes(savePath);
emulator.Load(romData, ramData, currentGameMetadata.MapperType); emulator.Load(romData, ramData, currentGameMetadata.MapperType);
@ -202,8 +202,8 @@ namespace Essgee.Emulation
cartRamSaveNeeded) cartRamSaveNeeded)
{ {
var ramData = emulator.GetCartridgeRam(); var ramData = emulator.GetCartridgeRam();
var savePath = Path.Combine(EmuStandInfo.SaveDataPath, Path.ChangeExtension(currentGameMetadata.FileName, "sav")); var savePath = System.IO.Path.Combine(EmuStandInfo.SaveDataPath, System.IO.Path.ChangeExtension(currentGameMetadata.FileName, "sav"));
File.WriteAllBytes(savePath, ramData); EmulatorHandler.io.File_WriteAllBytes(savePath, ramData);
} }
} }
@ -370,28 +370,28 @@ namespace Essgee.Emulation
// } // }
//} //}
public void SaveSnapShotToFile(int stateNumber) //public void SaveSnapShotToFile(int stateNumber)
{ //{
var statePath = GetSaveStateFilename(stateNumber); // var statePath = GetSaveStateFilename(stateNumber);
using (var stream = new FileStream(statePath, FileMode.OpenOrCreate)) // using (var stream = new FileStream(statePath, FileMode.OpenOrCreate))
{ // {
//SaveStateHandler.Save(stream, emulator.GetType().Name, emulator.GetState()); // //SaveStateHandler.Save(stream, emulator.GetType().Name, emulator.GetState());
SaveStateHandler.Save(stream, emulator.GetType().Name, emulator.SaveAxiStatus()); // SaveStateHandler.Save(stream, emulator.GetType().Name, emulator.SaveAxiStatus());
} // }
} //}
public void LoadSnapShotFromFile(int stateNumber) //public void LoadSnapShotFromFile(int stateNumber)
{ //{
var statePath = GetSaveStateFilename(stateNumber); // var statePath = GetSaveStateFilename(stateNumber);
if (File.Exists(statePath)) // if (File.Exists(statePath))
{ // {
using (var stream = new FileStream(statePath, FileMode.Open)) // using (var stream = new FileStream(statePath, FileMode.Open))
{ // {
//emulator.SetState(SaveStateHandler.Load(stream, emulator.GetType().Name)); // //emulator.SetState(SaveStateHandler.Load(stream, emulator.GetType().Name));
emulator.LoadAxiStatus(SaveStateHandler.LoadAxiStatus(stream, emulator.GetType().Name)); // emulator.LoadAxiStatus(SaveStateHandler.LoadAxiStatus(stream, emulator.GetType().Name));
} // }
} // }
} //}
public byte[] GetStateData() public byte[] GetStateData()
{ {

View File

@ -1,7 +1,6 @@
using Essgee.EventArguments; using Essgee.EventArguments;
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.IO;
using System.IO.MemoryMappedFiles; using System.IO.MemoryMappedFiles;
namespace Essgee.Emulation.ExtDevices.Nintendo namespace Essgee.Emulation.ExtDevices.Nintendo
@ -64,7 +63,7 @@ namespace Essgee.Emulation.ExtDevices.Nintendo
ipcOffsetSelf = ipcBaseOffsetSerialData + 1; ipcOffsetSelf = ipcBaseOffsetSerialData + 1;
ipcOffsetRemote = ipcBaseOffsetSerialData + 0; ipcOffsetRemote = ipcBaseOffsetSerialData + 0;
} }
catch (FileNotFoundException) catch (Exception ex)
{ {
// Mapped file does not yet exist, create file and assume this instance is first machine // Mapped file does not yet exist, create file and assume this instance is first machine
mmf = MemoryMappedFile.CreateOrOpen(ipcName, ipcLength); mmf = MemoryMappedFile.CreateOrOpen(ipcName, ipcLength);

View File

@ -10,7 +10,6 @@ using Essgee.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO;
using System.Linq; using System.Linq;
namespace Essgee.Emulation.Machines namespace Essgee.Emulation.Machines
@ -365,9 +364,22 @@ namespace Essgee.Emulation.Machines
irDatabaseCurrentIndex = irCycles = 0; irDatabaseCurrentIndex = irCycles = 0;
irExternalTransferActive = false; irExternalTransferActive = false;
if (configuration.InfraredSource == InfraredSources.PocketPikachuColor && File.Exists(configuration.InfraredDatabasePikachu)) //if (configuration.InfraredSource == InfraredSources.PocketPikachuColor && EmulatorHandler.io.File_Exists(configuration.InfraredDatabasePikachu))
//{
// using (var reader = new System.IO.BinaryReader(new FileStream(configuration.InfraredDatabasePikachu, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)))
// {
// irDatabase = new ushort[reader.BaseStream.Length / 2];
// for (var i = 0; i < irDatabase.Length; i++)
// irDatabase[i] = reader.ReadUInt16();
// irDatabaseStep = 2007;
// if ((irDatabaseBaseIndex < 0) || (irDatabaseBaseIndex * irDatabaseStep >= irDatabase.Length))
// irDatabaseBaseIndex = 0;
// }
//}
if (configuration.InfraredSource == InfraredSources.PocketPikachuColor && EmulatorHandler.io.File_Exists(configuration.InfraredDatabasePikachu))
{ {
using (var reader = new BinaryReader(new FileStream(configuration.InfraredDatabasePikachu, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))) using (var reader = new System.IO.BinaryReader(new System.IO.MemoryStream(EmulatorHandler.io.File_ReadAllBytes(configuration.InfraredDatabasePikachu))))
{ {
irDatabase = new ushort[reader.BaseStream.Length / 2]; irDatabase = new ushort[reader.BaseStream.Length / 2];
for (var i = 0; i < irDatabase.Length; i++) for (var i = 0; i < irDatabase.Length; i++)

View File

@ -1,6 +1,4 @@
using System.IO; namespace Essgee.Emulation
namespace Essgee.Emulation
{ {
public static class SaveStateHandler public static class SaveStateHandler
{ {
@ -42,12 +40,12 @@ namespace Essgee.Emulation
// } // }
//} //}
public static AxiEssgssStatusData LoadAxiStatus(Stream stream, string machineName) public static AxiEssgssStatusData LoadAxiStatus(System.IO.Stream stream, string machineName)
{ {
using (var reader = new BinaryReader(stream)) using (var reader = new System.IO.BinaryReader(stream))
{ {
/* Check CRC32 */ /* Check CRC32 */
using (var stateStream = new MemoryStream()) using (var stateStream = new System.IO.MemoryStream())
{ {
reader.BaseStream.CopyTo(stateStream); reader.BaseStream.CopyTo(stateStream);
return stateStream.ToArray().ToAxiEssgssStatusData(); return stateStream.ToArray().ToAxiEssgssStatusData();
@ -102,11 +100,11 @@ namespace Essgee.Emulation
// } // }
//} //}
public static void Save(Stream stream, string machineName, AxiEssgssStatusData state) //public static void Save(Stream stream, string machineName, AxiEssgssStatusData state)
{ //{
byte[] data = state.ToByteArray(); // byte[] data = state.ToByteArray();
stream.Write(data, 0, data.Length); // stream.Write(data, 0, data.Length);
} //}
//private static string GenerateMachineIdString(string machineId) //private static string GenerateMachineIdString(string machineId)
//{ //{
// return machineId.Substring(0, Math.Min(machineId.Length, 16)).PadRight(16); // return machineId.Substring(0, Math.Min(machineId.Length, 16)).PadRight(16);

View File

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -20,7 +19,7 @@ namespace Essgee.Extensions
public static string ReadEmbeddedTextFile(this Assembly assembly, string resourceName) public static string ReadEmbeddedTextFile(this Assembly assembly, string resourceName)
{ {
using (var reader = new StreamReader(assembly.GetManifestResourceStream(resourceName))) using (var reader = new System.IO.StreamReader(assembly.GetManifestResourceStream(resourceName)))
return reader.ReadToEnd(); return reader.ReadToEnd();
} }

View File

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

View File

@ -2,7 +2,6 @@
using Essgee.Exceptions; using Essgee.Exceptions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Xml.Serialization; using System.Xml.Serialization;
@ -17,6 +16,15 @@ namespace Essgee.Metadata
public bool GetDatBytes(string DatName, out byte[] loadedData); public bool GetDatBytes(string DatName, out byte[] loadedData);
} }
public interface IEssgeeIOSupport
{
bool File_Exists(string path);
byte[] File_ReadAllBytes(string path);
void File_WriteAllBytes(string savePath, byte[] data);
void File_WriteAllBytesFromStre(string path, System.IO.MemoryStream ms);
}
public class GameMetadataHandler public class GameMetadataHandler
{ {
public static GameMetadataHandler instance; public static GameMetadataHandler instance;
@ -24,6 +32,8 @@ namespace Essgee.Metadata
//static string metadataDatabaseFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Assets", "MetadataDatabase.json"); //static string metadataDatabaseFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Assets", "MetadataDatabase.json");
public IGameMetaReources gameMetaReources; public IGameMetaReources gameMetaReources;
public IEssgeeIOSupport uegIO;
//readonly Dictionary<string, DatFile> datFiles; //readonly Dictionary<string, DatFile> datFiles;
readonly List<CartridgeJSON> cartMetadataDatabase; readonly List<CartridgeJSON> cartMetadataDatabase;
@ -379,7 +389,7 @@ namespace Essgee.Metadata
XmlSerializer serializer; XmlSerializer serializer;
root = new XmlRootAttribute("datafile") { IsNullable = true }; root = new XmlRootAttribute("datafile") { IsNullable = true };
serializer = new XmlSerializer(typeof(DatFile), root); serializer = new XmlSerializer(typeof(DatFile), root);
using (MemoryStream stream = new MemoryStream(loadedData)) using (System.IO.MemoryStream stream = new System.IO.MemoryStream(loadedData))
{ {
datFile = (DatFile)serializer.Deserialize(stream); datFile = (DatFile)serializer.Deserialize(stream);
} }
@ -396,7 +406,7 @@ namespace Essgee.Metadata
/* Create game metadata */ /* Create game metadata */
var gameMetadata = new GameMetadata() var gameMetadata = new GameMetadata()
{ {
FileName = Path.GetFileName(romFilename), FileName = System.IO.Path.GetFileName(romFilename),
KnownName = gameInfo?.Name, KnownName = gameInfo?.Name,
RomCrc32 = romCrc32, RomCrc32 = romCrc32,
RomSize = romSize RomSize = romSize

View File

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
namespace Essgee.Utilities namespace Essgee.Utilities
{ {
@ -34,42 +33,42 @@ namespace Essgee.Utilities
if ((segmentStart + segmentLength) > dataLength) throw new Crc32Exception("Segment end offset is greater than total length"); if ((segmentStart + segmentLength) > dataLength) throw new Crc32Exception("Segment end offset is greater than total length");
} }
public static uint Calculate(FileInfo fileInfo) //public static uint Calculate(FileInfo fileInfo)
{ //{
return Calculate(fileInfo, 0, (int)fileInfo.Length); // return Calculate(fileInfo, 0, (int)fileInfo.Length);
} //}
public static uint Calculate(FileInfo fileInfo, int start, int length) //public static uint Calculate(FileInfo fileInfo, int start, int length)
{ //{
VerifyStartAndLength((int)fileInfo.Length, start, length); // VerifyStartAndLength((int)fileInfo.Length, start, length);
using (FileStream file = fileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) // using (FileStream file = fileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{ // {
return Calculate(file, start, length); // return Calculate(file, start, length);
} // }
} //}
public static uint Calculate(Stream stream) //public static uint Calculate(Stream stream)
{ //{
return Calculate(stream, 0, (int)stream.Length); // return Calculate(stream, 0, (int)stream.Length);
} //}
public static uint Calculate(Stream stream, int start, int length) //public static uint Calculate(Stream stream, int start, int length)
{ //{
VerifyStartAndLength((int)stream.Length, start, length); // VerifyStartAndLength((int)stream.Length, start, length);
uint crc = 0; // uint crc = 0;
var lastStreamPosition = stream.Position; // var lastStreamPosition = stream.Position;
byte[] data = new byte[length]; // byte[] data = new byte[length];
stream.Position = start; // stream.Position = start;
stream.Read(data, 0, length); // stream.Read(data, 0, length);
crc = Calculate(data, 0, data.Length); // crc = Calculate(data, 0, data.Length);
stream.Position = lastStreamPosition; // stream.Position = lastStreamPosition;
return crc; // return crc;
} //}
public static uint Calculate(byte[] data) public static uint Calculate(byte[] data)
{ {

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Threading; using System.Threading;
namespace MAME.Core namespace MAME.Core
@ -25,8 +24,9 @@ namespace MAME.Core
ISoundPlayer isp, ISoundPlayer isp,
IKeyboard ikb, IKeyboard ikb,
IMouse imou, IMouse imou,
ITimeSpan itime ITimeSpan itime,
) => mameMainMotion.Init(RomDir, ilog, iRes, ivp, isp, ikb, imou, itime); IMAMEIOSupport io
) => mameMainMotion.Init(RomDir, ilog, iRes, ivp, isp, ikb, imou, itime,io);
public void ResetRomRoot(string RomDir) => mameMainMotion.ResetRomRoot(RomDir); public void ResetRomRoot(string RomDir) => mameMainMotion.ResetRomRoot(RomDir);
@ -40,7 +40,7 @@ namespace MAME.Core
public void StopGame() => mameMainMotion.StopGame(); public void StopGame() => mameMainMotion.StopGame();
public long currEmuFrame => Video.screenstate.frame_number; public long currEmuFrame => Video.screenstate.frame_number;
public bool IsPaused => Mame.paused; public bool IsPaused => Mame.paused;
public void LoadState(BinaryReader sr) public void LoadState(System.IO.BinaryReader sr)
{ {
Mame.paused = true; Mame.paused = true;
Thread.Sleep(20); Thread.Sleep(20);
@ -51,7 +51,7 @@ namespace MAME.Core
Mame.paused = false; Mame.paused = false;
} }
public void SaveState(BinaryWriter sw) public void SaveState(System.IO.BinaryWriter sw)
{ {
Mame.paused = true; Mame.paused = true;
Thread.Sleep(20); Thread.Sleep(20);

View File

@ -21,6 +21,7 @@ namespace MAME.Core
public AutoResetEvent emuAutoLoopEvent; public AutoResetEvent emuAutoLoopEvent;
public static IResources resource; public static IResources resource;
public static IMAMEIOSupport IoSupport;
public bool bRom => Machine.bRom; public bool bRom => Machine.bRom;
public MameMainMotion() public MameMainMotion()
@ -42,7 +43,8 @@ namespace MAME.Core
ISoundPlayer isp, ISoundPlayer isp,
IKeyboard ikb, IKeyboard ikb,
IMouse imou, IMouse imou,
ITimeSpan itime ITimeSpan itime,
IMAMEIOSupport io
) )
{ {
AxiMemoryEx.Init(); AxiMemoryEx.Init();
@ -54,6 +56,7 @@ namespace MAME.Core
Video.BindFunc(ivp); Video.BindFunc(ivp);
Sound.BindFunc(isp); Sound.BindFunc(isp);
resource = iRes; resource = iRes;
IoSupport = io;
sSelect = string.Empty; sSelect = string.Empty;

View File

@ -1,7 +1,5 @@
using MAME.Core; using MAME.Core;
using System; using System;
using System.IO;
//using System.IO;
namespace cpu.m6502 namespace cpu.m6502
{ {
@ -232,7 +230,7 @@ namespace cpu.m6502
} }
} }
} }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(subtype); writer.Write(subtype);
writer.Write(ppc.LowWord); writer.Write(ppc.LowWord);
@ -250,7 +248,7 @@ namespace cpu.m6502
writer.Write(TotalExecutedCycles); writer.Write(TotalExecutedCycles);
writer.Write(PendingCycles); writer.Write(PendingCycles);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
subtype = reader.ReadByte(); subtype = reader.ReadByte();
ppc.LowWord = reader.ReadUInt16(); ppc.LowWord = reader.ReadUInt16();

View File

@ -1,6 +1,5 @@
using MAME.Core; using MAME.Core;
using System; using System;
using System.IO;
namespace cpu.m6800 namespace cpu.m6800
{ {
@ -1216,7 +1215,7 @@ namespace cpu.m6800
break; break;
} }
} }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(PPC.LowWord); writer.Write(PPC.LowWord);
writer.Write(PC.LowWord); writer.Write(PC.LowWord);
@ -1260,7 +1259,7 @@ namespace cpu.m6800
writer.Write(TotalExecutedCycles); writer.Write(TotalExecutedCycles);
writer.Write(PendingCycles); writer.Write(PendingCycles);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
PPC.LowWord = reader.ReadUInt16(); PPC.LowWord = reader.ReadUInt16();
PC.LowWord = reader.ReadUInt16(); PC.LowWord = reader.ReadUInt16();

View File

@ -1,7 +1,6 @@
using MAME.Core; using MAME.Core;
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace cpu.m68000 namespace cpu.m68000
@ -275,7 +274,7 @@ namespace cpu.m68000
// return a + b + c + d; // return a + b + c + d;
//} //}
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
for (i = 0; i < 0x08; i++) for (i = 0; i < 0x08; i++)
@ -304,7 +303,7 @@ namespace cpu.m68000
writer.Write(MC68000.m1.TotalExecutedCycles); writer.Write(MC68000.m1.TotalExecutedCycles);
writer.Write(MC68000.m1.PendingCycles); writer.Write(MC68000.m1.PendingCycles);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
for (i = 0; i < 0x08; i++) for (i = 0; i < 0x08; i++)
@ -333,7 +332,7 @@ namespace cpu.m68000
MC68000.m1.TotalExecutedCycles = reader.ReadUInt64(); MC68000.m1.TotalExecutedCycles = reader.ReadUInt64();
MC68000.m1.PendingCycles = reader.ReadInt32(); MC68000.m1.PendingCycles = reader.ReadInt32();
} }
public void SaveStateText(TextWriter writer, string id) public void SaveStateText(System.IO.TextWriter writer, string id)
{ {
writer.WriteLine("[{0}]", id); writer.WriteLine("[{0}]", id);
writer.WriteLine("D0 {0:X8}", D[0].s32); writer.WriteLine("D0 {0:X8}", D[0].s32);
@ -370,7 +369,7 @@ namespace cpu.m68000
writer.WriteLine("[/{0}]", id); writer.WriteLine("[/{0}]", id);
} }
public void LoadStateText(TextReader reader, string id) public void LoadStateText(System.IO.TextReader reader, string id)
{ {
while (true) while (true)
{ {

View File

@ -1,6 +1,5 @@
using MAME.Core; using MAME.Core;
using System; using System;
using System.IO;
namespace cpu.m6805 namespace cpu.m6805
{ {
@ -831,7 +830,7 @@ namespace cpu.m6805
while (pendingCycles > 0); while (pendingCycles > 0);
return cycles - pendingCycles; return cycles - pendingCycles;
} }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(ea.LowWord); writer.Write(ea.LowWord);
@ -850,7 +849,7 @@ namespace cpu.m6805
writer.Write(TotalExecutedCycles); writer.Write(TotalExecutedCycles);
writer.Write(PendingCycles); writer.Write(PendingCycles);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
ea.LowWord = reader.ReadUInt16(); ea.LowWord = reader.ReadUInt16();

View File

@ -1,6 +1,5 @@
using MAME.Core; using MAME.Core;
using System; using System;
using System.IO;
namespace cpu.m6809 namespace cpu.m6809
{ {
@ -861,7 +860,7 @@ namespace cpu.m6809
case 0xff: EA = IMMWORD(); EA.d = RM16(EA.LowWord); pendingCycles -= 8; break; case 0xff: EA = IMMWORD(); EA.d = RM16(EA.LowWord); pendingCycles -= 8; break;
} }
} }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(PC.LowWord); writer.Write(PC.LowWord);
writer.Write(PPC.LowWord); writer.Write(PPC.LowWord);
@ -879,7 +878,7 @@ namespace cpu.m6809
writer.Write(TotalExecutedCycles); writer.Write(TotalExecutedCycles);
writer.Write(PendingCycles); writer.Write(PendingCycles);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
PC.LowWord = reader.ReadUInt16(); PC.LowWord = reader.ReadUInt16();
PPC.LowWord = reader.ReadUInt16(); PPC.LowWord = reader.ReadUInt16();

View File

@ -1,6 +1,5 @@
using MAME.Core; using MAME.Core;
using System; using System;
using System.IO;
namespace cpu.nec namespace cpu.nec
{ {
@ -1190,7 +1189,7 @@ namespace cpu.nec
nec_interrupt(-1, false); nec_interrupt(-1, false);
} }
} }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(I.regs.b, 0, 16); writer.Write(I.regs.b, 0, 16);
@ -1220,7 +1219,7 @@ namespace cpu.nec
writer.Write(TotalExecutedCycles); writer.Write(TotalExecutedCycles);
writer.Write(PendingCycles); writer.Write(PendingCycles);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
I.regs.b = reader.ReadBytes(16); I.regs.b = reader.ReadBytes(16);

View File

@ -1,7 +1,6 @@
using MAME.Core; using MAME.Core;
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO;
// This Z80 emulator is a modified version of Ben Ryves 'Brazil' emulator. // This Z80 emulator is a modified version of Ben Ryves 'Brazil' emulator.
// It is MIT licensed. // It is MIT licensed.
@ -133,7 +132,7 @@ namespace cpu.z80
// State Save/Load // State Save/Load
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(PPC); writer.Write(PPC);
writer.Write(RegisterAF); writer.Write(RegisterAF);
@ -162,7 +161,7 @@ namespace cpu.z80
writer.Write(TotalExecutedCycles); writer.Write(TotalExecutedCycles);
writer.Write(PendingCycles); writer.Write(PendingCycles);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
PPC = reader.ReadUInt16(); PPC = reader.ReadUInt16();
RegisterAF = reader.ReadUInt16(); RegisterAF = reader.ReadUInt16();
@ -191,7 +190,7 @@ namespace cpu.z80
TotalExecutedCycles = reader.ReadUInt64(); TotalExecutedCycles = reader.ReadUInt64();
PendingCycles = reader.ReadInt32(); PendingCycles = reader.ReadInt32();
} }
public void SaveStateText(TextWriter writer) public void SaveStateText(System.IO.TextWriter writer)
{ {
writer.WriteLine("[Z80]"); writer.WriteLine("[Z80]");
writer.WriteLine("AF {0:X4}", RegAF.Word); writer.WriteLine("AF {0:X4}", RegAF.Word);
@ -221,7 +220,7 @@ namespace cpu.z80
writer.WriteLine(); writer.WriteLine();
} }
public void LoadStateText(TextReader reader) public void LoadStateText(System.IO.TextReader reader)
{ {
while (true) while (true)
{ {

View File

@ -6,7 +6,6 @@ using cpu.m6809;
using cpu.nec; using cpu.nec;
using cpu.z80; using cpu.z80;
using System; using System;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
@ -2808,7 +2807,7 @@ namespace MAME.Core
if (perfect_interleave.attoseconds == Attotime.ATTOSECONDS_PER_SECOND - 1) if (perfect_interleave.attoseconds == Attotime.ATTOSECONDS_PER_SECOND - 1)
perfect_interleave.attoseconds = cpu[0].attoseconds_per_cycle; perfect_interleave.attoseconds = cpu[0].attoseconds_per_cycle;
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
for (i = 0; i < ncpu; i++) for (i = 0; i < ncpu; i++)
@ -2822,7 +2821,7 @@ namespace MAME.Core
writer.Write(Cpuexec.cpu[i].localtime.attoseconds); writer.Write(Cpuexec.cpu[i].localtime.attoseconds);
} }
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
for (i = 0; i < ncpu; i++) for (i = 0; i < ncpu; i++)

View File

@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace MAME.Core namespace MAME.Core
@ -262,7 +260,7 @@ namespace MAME.Core
{ {
return cpu_irq_callback(3, line); return cpu_irq_callback(3, line);
} }
public static void SaveStateBinary_v(BinaryWriter writer) public static void SaveStateBinary_v(System.IO.BinaryWriter writer)
{ {
int i, n; int i, n;
n = lvec.Count; n = lvec.Count;
@ -280,7 +278,7 @@ namespace MAME.Core
writer.Write((long)0); writer.Write((long)0);
} }
} }
public static void LoadStateBinary_v(BinaryReader reader) public static void LoadStateBinary_v(System.IO.BinaryReader reader)
{ {
int i, n; int i, n;
n = reader.ReadInt32(); n = reader.ReadInt32();
@ -299,7 +297,7 @@ namespace MAME.Core
reader.ReadInt64(); reader.ReadInt64();
} }
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j, n; int i, j, n;
n = lirq.Count; n = lirq.Count;
@ -351,7 +349,7 @@ namespace MAME.Core
} }
} }
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j, n; int i, j, n;
n = reader.ReadInt32(); n = reader.ReadInt32();

View File

@ -1,6 +1,4 @@
using System.IO; namespace MAME.Core
namespace MAME.Core
{ {
/*public enum eeprom_command /*public enum eeprom_command
{ {
@ -378,7 +376,7 @@ namespace MAME.Core
} }
clock_line = state; clock_line = state;
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(eeprom_data); writer.Write(eeprom_data);
writer.Write(serial_buffer); writer.Write(serial_buffer);
@ -393,7 +391,7 @@ namespace MAME.Core
writer.Write(eeprom_data_bits); writer.Write(eeprom_data_bits);
writer.Write(eeprom_read_address); writer.Write(eeprom_read_address);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
eeprom_data = reader.ReadBytes(0x80); eeprom_data = reader.ReadBytes(0x80);
serial_buffer = reader.ReadBytes(40); serial_buffer = reader.ReadBytes(40);

View File

@ -1,7 +1,6 @@
using cpu.m6800; using cpu.m6800;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
@ -642,7 +641,7 @@ namespace MAME.Core
{ {
return Attotime.attotime_sub(which.expire, get_current_time()); return Attotime.attotime_sub(which.expire, get_current_time());
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, i1, n; int i, i1, n;
n = lt.Count; n = lt.Count;
@ -673,7 +672,7 @@ namespace MAME.Core
writer.Write((long)0); writer.Write((long)0);
} }
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, i1, n; int i, i1, n;
n = reader.ReadInt32(); n = reader.ReadInt32();

View File

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
@ -264,10 +263,12 @@ namespace MAME.Core
{ {
byte[] bb1; byte[] bb1;
string path = System.IO.Path.Combine(Mame.RomRoot + "/neogeo/", sFile); string path = System.IO.Path.Combine(Mame.RomRoot + "/neogeo/", sFile);
if (File.Exists(path)) //if (File.Exists(path))
if (MameMainMotion.IoSupport.File_Exists(path))
{ {
EmuLogger.Log($"Had File => {path}"); EmuLogger.Log($"Had File => {path}");
return File.ReadAllBytes(path); //return File.ReadAllBytes(path);
return MameMainMotion.IoSupport.File_ReadAllBytes(path);
//FileStream fs1 = new FileStream(path, FileMode.Open); //FileStream fs1 = new FileStream(path, FileMode.Open);
//int n1 = (int)fs1.Length; //int n1 = (int)fs1.Length;
//bb1 = new byte[n1]; //bb1 = new byte[n1];
@ -286,10 +287,10 @@ namespace MAME.Core
foreach (string s1 in lsParents) foreach (string s1 in lsParents)
{ {
string path = System.IO.Path.Combine(Mame.RomRoot + "/" + s1 + "/", sFile); string path = System.IO.Path.Combine(Mame.RomRoot + "/" + s1 + "/", sFile);
if (File.Exists(path)) if (MameMainMotion.IoSupport.File_Exists(path))
{ {
EmuLogger.Log($"Had File => {path}"); EmuLogger.Log($"Had File => {path}");
return File.ReadAllBytes(path); return MameMainMotion.IoSupport.File_ReadAllBytes(path);
} }
else else
{ {

View File

@ -1,6 +1,4 @@
using MAME.Core; 
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public class Mame public class Mame
@ -23,8 +21,8 @@ namespace MAME.Core
public static bool paused; public static bool paused;
public static bool exit_pending; public static bool exit_pending;
public static EmuTimer.emu_timer soft_reset_timer; public static EmuTimer.emu_timer soft_reset_timer;
public static BinaryReader brRecord = null; public static System.IO.BinaryReader brRecord = null;
public static BinaryWriter bwRecord = null; public static System.IO.BinaryWriter bwRecord = null;
public static bool bPP = true; public static bool bPP = true;
public static string RomRoot = string.Empty; public static string RomRoot = string.Empty;
public class AA public class AA
@ -42,7 +40,6 @@ namespace MAME.Core
new AA(6547,"2"), new AA(6547,"2"),
new AA(13955,"3") new AA(13955,"3")
}; };
private static FileStream fsRecord = null;
public static void mame_execute() public static void mame_execute()
{ {

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace MAME.Core namespace MAME.Core
@ -488,26 +487,26 @@ namespace MAME.Core
} }
#endregion #endregion
public static void Write(this BinaryWriter bw, byte* bufferPtr, int offset, int count) public static void Write(this System.IO.BinaryWriter bw, byte* bufferPtr, int offset, int count)
{ {
int singlesize = sizeof(byte); int singlesize = sizeof(byte);
long totalBytesToCopy = count * singlesize; long totalBytesToCopy = count * singlesize;
Buffer.MemoryCopy(&bufferPtr[offset], TempBuffer, totalBytesToCopy, totalBytesToCopy); Buffer.MemoryCopy(&bufferPtr[offset], TempBuffer, totalBytesToCopy, totalBytesToCopy);
bw.Write(TempBuffer_src, 0, count); bw.Write(TempBuffer_src, 0, count);
} }
public static void Write(this FileStream fs, byte* bufferPtr, int offset, int count) //public static void Write(this FileStream fs, byte* bufferPtr, int offset, int count)
{ //{
int singlesize = sizeof(byte); // int singlesize = sizeof(byte);
long totalBytesToCopy = count * singlesize; // long totalBytesToCopy = count * singlesize;
Buffer.MemoryCopy(&bufferPtr[offset], TempBuffer, totalBytesToCopy, totalBytesToCopy); // Buffer.MemoryCopy(&bufferPtr[offset], TempBuffer, totalBytesToCopy, totalBytesToCopy);
fs.Write(TempBuffer_src, 0, count); // fs.Write(TempBuffer_src, 0, count);
} //}
public static int Read(this FileStream fs, byte* bufferPtr, int offset, int count) //public static int Read(this FileStream fs, byte* bufferPtr, int offset, int count)
{ //{
count = fs.Read(TempBuffer_src, offset, count); // count = fs.Read(TempBuffer_src, offset, count);
Buffer.MemoryCopy(TempBuffer, bufferPtr + offset, 0, count); // Buffer.MemoryCopy(TempBuffer, bufferPtr + offset, 0, count);
return count; // return count;
} //}
} }
public unsafe static class AxiArray public unsafe static class AxiArray

View File

@ -1,6 +1,4 @@
using System.IO; namespace MAME.Core
namespace MAME.Core
{ {
public class Pd4900a public class Pd4900a
{ {
@ -312,7 +310,7 @@ namespace MAME.Core
{ {
pd4990a_serial_control((byte)(data & 0x7)); pd4990a_serial_control((byte)(data & 0x7));
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(pd4990a.seconds); writer.Write(pd4990a.seconds);
writer.Write(pd4990a.minutes); writer.Write(pd4990a.minutes);
@ -334,7 +332,7 @@ namespace MAME.Core
writer.Write(clock_line); writer.Write(clock_line);
writer.Write(command_line); writer.Write(command_line);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
pd4990a.seconds = reader.ReadInt32(); pd4990a.seconds = reader.ReadInt32();
pd4990a.minutes = reader.ReadInt32(); pd4990a.minutes = reader.ReadInt32();

View File

@ -1,11 +1,9 @@
using System.IO; namespace MAME.Core
namespace MAME.Core
{ {
public class State public class State
{ {
public delegate void savestate_delegate(BinaryWriter sw); public delegate void savestate_delegate(System.IO.BinaryWriter sw);
public delegate void loadstate_delegate(BinaryReader sr); public delegate void loadstate_delegate(System.IO.BinaryReader sr);
public static savestate_delegate savestate_callback; public static savestate_delegate savestate_callback;
public static loadstate_delegate loadstate_callback; public static loadstate_delegate loadstate_callback;
public static void state_init() public static void state_init()

View File

@ -1,6 +1,4 @@
using MAME.Core; using System;
using System;
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace MAME.Core namespace MAME.Core
@ -1102,7 +1100,7 @@ namespace MAME.Core
{ {
return flip_screen_x; return flip_screen_x;
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(scanline_param); writer.Write(scanline_param);
writer.Write(screenstate.last_partial_scan); writer.Write(screenstate.last_partial_scan);
@ -1112,7 +1110,7 @@ namespace MAME.Core
writer.Write(screenstate.vblank_end_time.attoseconds); writer.Write(screenstate.vblank_end_time.attoseconds);
writer.Write(screenstate.frame_number); writer.Write(screenstate.frame_number);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
scanline_param = reader.ReadInt32(); scanline_param = reader.ReadInt32();
screenstate.last_partial_scan = reader.ReadInt32(); screenstate.last_partial_scan = reader.ReadInt32();

View File

@ -1,13 +1,12 @@
using cpu.m68000; using cpu.m68000;
using cpu.m6809; using cpu.m6809;
using cpu.z80; using cpu.z80;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class Capcom public unsafe partial class Capcom
{ {
public static void SaveStateBinary_gng(BinaryWriter writer) public static void SaveStateBinary_gng(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(bytedsw1); writer.Write(bytedsw1);
@ -53,7 +52,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_gng(BinaryReader reader) public static void LoadStateBinary_gng(System.IO.BinaryReader reader)
{ {
int i; int i;
bytedsw1 = reader.ReadByte(); bytedsw1 = reader.ReadByte();
@ -99,7 +98,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_sf(BinaryWriter writer) public static void SaveStateBinary_sf(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw1); writer.Write(dsw1);
@ -148,7 +147,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_sf(BinaryReader reader) public static void LoadStateBinary_sf(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw1 = reader.ReadUInt16(); dsw1 = reader.ReadUInt16();

View File

@ -1,12 +1,11 @@
using cpu.m68000; using cpu.m68000;
using cpu.z80; using cpu.z80;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class CPS public unsafe partial class CPS
{ {
public static void SaveStateBinaryC(BinaryWriter writer) public static void SaveStateBinaryC(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dswa); writer.Write(dswa);
@ -76,7 +75,7 @@ namespace MAME.Core
break; break;
} }
} }
public static void SaveStateBinaryQ(BinaryWriter writer) public static void SaveStateBinaryQ(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dswa); writer.Write(dswa);
@ -126,7 +125,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
Eeprom.SaveStateBinary(writer); Eeprom.SaveStateBinary(writer);
} }
public static void SaveStateBinaryC2(BinaryWriter writer) public static void SaveStateBinaryC2(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(basebanksnd); writer.Write(basebanksnd);
@ -191,7 +190,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
Eeprom.SaveStateBinary(writer); Eeprom.SaveStateBinary(writer);
} }
public static void LoadStateBinaryC(BinaryReader reader) public static void LoadStateBinaryC(System.IO.BinaryReader reader)
{ {
int i; int i;
dswa = reader.ReadByte(); dswa = reader.ReadByte();
@ -261,7 +260,7 @@ namespace MAME.Core
break; break;
} }
} }
public static void LoadStateBinaryQ(BinaryReader reader) public static void LoadStateBinaryQ(System.IO.BinaryReader reader)
{ {
int i; int i;
dswa = reader.ReadByte(); dswa = reader.ReadByte();
@ -309,7 +308,7 @@ namespace MAME.Core
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
Eeprom.LoadStateBinary(reader); Eeprom.LoadStateBinary(reader);
} }
public static void LoadStateBinaryC2(BinaryReader reader) public static void LoadStateBinaryC2(System.IO.BinaryReader reader)
{ {
int i; int i;
basebanksnd = reader.ReadInt32(); basebanksnd = reader.ReadInt32();

View File

@ -1,11 +1,10 @@
using cpu.m6502; using cpu.m6502;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class Dataeast public unsafe partial class Dataeast
{ {
public static void SaveStateBinary_pcktgal(BinaryWriter writer) public static void SaveStateBinary_pcktgal(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw); writer.Write(dsw);
@ -48,7 +47,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_pcktgal(BinaryReader reader) public static void LoadStateBinary_pcktgal(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw = reader.ReadByte(); dsw = reader.ReadByte();

View File

@ -1,11 +1,10 @@
using cpu.m68000; using cpu.m68000;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class IGS011 public unsafe partial class IGS011
{ {
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
for (i = 0; i < 0x800; i++) for (i = 0; i < 0x800; i++)
@ -74,7 +73,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
for (i = 0; i < 0x800; i++) for (i = 0; i < 0x800; i++)

View File

@ -1,6 +1,4 @@
using System.IO; namespace MAME.Core
namespace MAME.Core
{ {
public unsafe partial class Konami68000 public unsafe partial class Konami68000
{ {
@ -409,7 +407,7 @@ namespace MAME.Core
{ {
return K052109_irq_enabled; return K052109_irq_enabled;
} }
public static void SaveStateBinary_K052109(BinaryWriter writer) public static void SaveStateBinary_K052109(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(K052109_ram, 0, 0x6000); writer.Write(K052109_ram, 0, 0x6000);
@ -430,7 +428,7 @@ namespace MAME.Core
writer.Write(has_extra_video_ram); writer.Write(has_extra_video_ram);
writer.Write(K052109_tileflip_enable); writer.Write(K052109_tileflip_enable);
} }
public static void LoadStateBinary_K052109(BinaryReader reader) public static void LoadStateBinary_K052109(System.IO.BinaryReader reader)
{ {
int i; int i;
K052109_ram = reader.ReadBytes(0x6000); K052109_ram = reader.ReadBytes(0x6000);
@ -451,7 +449,7 @@ namespace MAME.Core
has_extra_video_ram = reader.ReadByte(); has_extra_video_ram = reader.ReadByte();
K052109_tileflip_enable = reader.ReadInt32(); K052109_tileflip_enable = reader.ReadInt32();
} }
public static void LoadStateBinary_K052109_2(BinaryReader reader) public static void LoadStateBinary_K052109_2(System.IO.BinaryReader reader)
{ {
int i; int i;
reader.ReadBytes(0x6000); reader.ReadBytes(0x6000);
@ -722,7 +720,7 @@ namespace MAME.Core
} }
} }
} }
public static void SaveStateBinary_K051960(BinaryWriter writer) public static void SaveStateBinary_K051960(System.IO.BinaryWriter writer)
{ {
writer.Write(K051960_romoffset); writer.Write(K051960_romoffset);
writer.Write(K051960_spriteflip); writer.Write(K051960_spriteflip);
@ -734,7 +732,7 @@ namespace MAME.Core
writer.Write(K051960_irq_enabled); writer.Write(K051960_irq_enabled);
writer.Write(K051960_nmi_enabled); writer.Write(K051960_nmi_enabled);
} }
public static void LoadStateBinary_K051960(BinaryReader reader) public static void LoadStateBinary_K051960(System.IO.BinaryReader reader)
{ {
K051960_romoffset = reader.ReadInt32(); K051960_romoffset = reader.ReadInt32();
K051960_spriteflip = reader.ReadInt32(); K051960_spriteflip = reader.ReadInt32();
@ -746,7 +744,7 @@ namespace MAME.Core
K051960_irq_enabled = reader.ReadInt32(); K051960_irq_enabled = reader.ReadInt32();
K051960_nmi_enabled = reader.ReadInt32(); K051960_nmi_enabled = reader.ReadInt32();
} }
public static void LoadStateBinary_K051960_2(BinaryReader reader) public static void LoadStateBinary_K051960_2(System.IO.BinaryReader reader)
{ {
reader.ReadInt32(); reader.ReadInt32();
reader.ReadInt32(); reader.ReadInt32();
@ -1080,7 +1078,7 @@ namespace MAME.Core
} }
} }
} }
public static void SaveStateBinary_K053245(BinaryWriter writer) public static void SaveStateBinary_K053245(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(K05324x_z_rejection); writer.Write(K05324x_z_rejection);
@ -1104,7 +1102,7 @@ namespace MAME.Core
writer.Write(K053244_regs[0], 0, 0x10); writer.Write(K053244_regs[0], 0, 0x10);
writer.Write(K054000_ram, 0, 0x20); writer.Write(K054000_ram, 0, 0x20);
} }
public static void LoadStateBinary_K053245(BinaryReader reader) public static void LoadStateBinary_K053245(System.IO.BinaryReader reader)
{ {
int i; int i;
K05324x_z_rejection = reader.ReadInt32(); K05324x_z_rejection = reader.ReadInt32();
@ -1228,7 +1226,7 @@ namespace MAME.Core
K053936_offset[chip][0] = xoffs; K053936_offset[chip][0] = xoffs;
K053936_offset[chip][1] = yoffs; K053936_offset[chip][1] = yoffs;
} }
public static void SaveStateBinary_K053936(BinaryWriter writer) public static void SaveStateBinary_K053936(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
for (i = 0; i < 0x10; i++) for (i = 0; i < 0x10; i++)
@ -1251,7 +1249,7 @@ namespace MAME.Core
writer.Write(K053936_wraparound[i]); writer.Write(K053936_wraparound[i]);
} }
} }
public static void LoadStateBinary_K053936(BinaryReader reader) public static void LoadStateBinary_K053936(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
for (i = 0; i < 0x10; i++) for (i = 0; i < 0x10; i++)
@ -1373,7 +1371,7 @@ namespace MAME.Core
{ {
return K053251_palette_index[ci]; return K053251_palette_index[ci];
} }
public static void SaveStateBinary_K053251(BinaryWriter writer) public static void SaveStateBinary_K053251(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(K053251_ram); writer.Write(K053251_ram);
@ -1383,7 +1381,7 @@ namespace MAME.Core
} }
writer.Write(K053251_tilemaps_set); writer.Write(K053251_tilemaps_set);
} }
public static void LoadStateBinary_K053251(BinaryReader reader) public static void LoadStateBinary_K053251(System.IO.BinaryReader reader)
{ {
int i; int i;
K053251_ram = reader.ReadBytes(0x10); K053251_ram = reader.ReadBytes(0x10);
@ -1393,7 +1391,7 @@ namespace MAME.Core
} }
K053251_tilemaps_set = reader.ReadInt32(); K053251_tilemaps_set = reader.ReadInt32();
} }
public static void LoadStateBinary_K053251_2(BinaryReader reader) public static void LoadStateBinary_K053251_2(System.IO.BinaryReader reader)
{ {
int i; int i;
reader.ReadBytes(0x10); reader.ReadBytes(0x10);

View File

@ -1,12 +1,11 @@
using cpu.m68000; using cpu.m68000;
using cpu.z80; using cpu.z80;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class Konami68000 public unsafe partial class Konami68000
{ {
public static void SaveStateBinary_cuebrick(BinaryWriter writer) public static void SaveStateBinary_cuebrick(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw1); writer.Write(dsw1);
@ -62,7 +61,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_cuebrick(BinaryReader reader) public static void LoadStateBinary_cuebrick(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw1 = reader.ReadByte(); dsw1 = reader.ReadByte();
@ -118,7 +117,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_mia(BinaryWriter writer) public static void SaveStateBinary_mia(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw1); writer.Write(dsw1);
@ -180,7 +179,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_mia(BinaryReader reader) public static void LoadStateBinary_mia(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw1 = reader.ReadByte(); dsw1 = reader.ReadByte();
@ -242,7 +241,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_tmnt(BinaryWriter writer) public static void SaveStateBinary_tmnt(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw1); writer.Write(dsw1);
@ -314,7 +313,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_tmnt(BinaryReader reader) public static void LoadStateBinary_tmnt(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw1 = reader.ReadByte(); dsw1 = reader.ReadByte();
@ -386,7 +385,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_punkshot(BinaryWriter writer) public static void SaveStateBinary_punkshot(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw1); writer.Write(dsw1);
@ -439,7 +438,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_punkshot(BinaryReader reader) public static void LoadStateBinary_punkshot(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw1 = reader.ReadByte(); dsw1 = reader.ReadByte();
@ -492,7 +491,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_lgtnfght(BinaryWriter writer) public static void SaveStateBinary_lgtnfght(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw1); writer.Write(dsw1);
@ -545,7 +544,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_lgtnfght(BinaryReader reader) public static void LoadStateBinary_lgtnfght(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw1 = reader.ReadByte(); dsw1 = reader.ReadByte();
@ -598,7 +597,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_blswhstl(BinaryWriter writer) public static void SaveStateBinary_blswhstl(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(bytee); writer.Write(bytee);
@ -650,7 +649,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
Eeprom.SaveStateBinary(writer); Eeprom.SaveStateBinary(writer);
} }
public static void LoadStateBinary_blswhstl(BinaryReader reader) public static void LoadStateBinary_blswhstl(System.IO.BinaryReader reader)
{ {
int i; int i;
bytee = reader.ReadByte(); bytee = reader.ReadByte();
@ -702,7 +701,7 @@ namespace MAME.Core
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
Eeprom.LoadStateBinary(reader); Eeprom.LoadStateBinary(reader);
} }
public static void SaveStateBinary_glfgreat(BinaryWriter writer) public static void SaveStateBinary_glfgreat(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw1); writer.Write(dsw1);
@ -753,7 +752,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_glfgreat(BinaryReader reader) public static void LoadStateBinary_glfgreat(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw1 = reader.ReadByte(); dsw1 = reader.ReadByte();
@ -804,7 +803,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_tmnt2(BinaryWriter writer) public static void SaveStateBinary_tmnt2(System.IO.BinaryWriter writer)
{ {
int i; int i;
for (i = 0; i < 0x10; i++) for (i = 0; i < 0x10; i++)
@ -860,7 +859,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
Eeprom.SaveStateBinary(writer); Eeprom.SaveStateBinary(writer);
} }
public static void LoadStateBinary_tmnt2(BinaryReader reader) public static void LoadStateBinary_tmnt2(System.IO.BinaryReader reader)
{ {
int i; int i;
for (i = 0; i < 0x10; i++) for (i = 0; i < 0x10; i++)
@ -916,7 +915,7 @@ namespace MAME.Core
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
Eeprom.LoadStateBinary(reader); Eeprom.LoadStateBinary(reader);
} }
public static void SaveStateBinary_ssriders(BinaryWriter writer) public static void SaveStateBinary_ssriders(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(init_eeprom_count); writer.Write(init_eeprom_count);
@ -968,7 +967,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
Eeprom.SaveStateBinary(writer); Eeprom.SaveStateBinary(writer);
} }
public static void LoadStateBinary_ssriders(BinaryReader reader) public static void LoadStateBinary_ssriders(System.IO.BinaryReader reader)
{ {
int i; int i;
init_eeprom_count = reader.ReadInt32(); init_eeprom_count = reader.ReadInt32();
@ -1020,7 +1019,7 @@ namespace MAME.Core
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
Eeprom.LoadStateBinary(reader); Eeprom.LoadStateBinary(reader);
} }
public static void SaveStateBinary_thndrx2(BinaryWriter writer) public static void SaveStateBinary_thndrx2(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(bytee); writer.Write(bytee);
@ -1072,7 +1071,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
Eeprom.SaveStateBinary(writer); Eeprom.SaveStateBinary(writer);
} }
public static void LoadStateBinary_thndrx2(BinaryReader reader) public static void LoadStateBinary_thndrx2(System.IO.BinaryReader reader)
{ {
int i; int i;
bytee = reader.ReadByte(); bytee = reader.ReadByte();
@ -1124,7 +1123,7 @@ namespace MAME.Core
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
Eeprom.LoadStateBinary(reader); Eeprom.LoadStateBinary(reader);
} }
public static void SaveStateBinary_prmrsocr(BinaryWriter writer) public static void SaveStateBinary_prmrsocr(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(basebanksnd); writer.Write(basebanksnd);
@ -1182,7 +1181,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
Eeprom.SaveStateBinary(writer); Eeprom.SaveStateBinary(writer);
} }
public static void LoadStateBinary_prmrsocr(BinaryReader reader) public static void LoadStateBinary_prmrsocr(System.IO.BinaryReader reader)
{ {
int i; int i;
basebanksnd = reader.ReadInt32(); basebanksnd = reader.ReadInt32();

View File

@ -1,12 +1,11 @@
using cpu.nec; using cpu.nec;
using cpu.z80; using cpu.z80;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class M72 public unsafe partial class M72
{ {
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw); writer.Write(dsw);
@ -68,7 +67,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw = reader.ReadUInt16(); dsw = reader.ReadUInt16();

View File

@ -1,11 +1,10 @@
using cpu.nec; using cpu.nec;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class M92 public unsafe partial class M92
{ {
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
writer.Write(dsw); writer.Write(dsw);
@ -82,7 +81,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
dsw = reader.ReadUInt16(); dsw = reader.ReadUInt16();

View File

@ -1,12 +1,11 @@
using cpu.m6800; using cpu.m6800;
using cpu.m6809; using cpu.m6809;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class Namcos1 public unsafe partial class Namcos1
{ {
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
writer.Write(dipsw); writer.Write(dipsw);
@ -73,7 +72,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
dipsw = reader.ReadByte(); dipsw = reader.ReadByte();

View File

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace MAME.Core namespace MAME.Core
@ -376,19 +375,27 @@ namespace MAME.Core
public static void nvram_handler_load_neogeo() public static void nvram_handler_load_neogeo()
{ {
if (File.Exists("nvram\\" + Machine.sName + ".nv")) if (MameMainMotion.IoSupport.File_Exists("nvram\\" + Machine.sName + ".nv"))
{ {
FileStream fs1 = new FileStream("nvram\\" + Machine.sName + ".nv", FileMode.Open); MameMainMotion.IoSupport.File_ReadAllBytes("nvram\\" + Machine.sName + ".nv");
int n = (int)fs1.Length; //FileStream fs1 = new FileStream("nvram\\" + Machine.sName + ".nv", FileMode.Open);
fs1.Read(mainram2, 0, n); //int n = (int)fs1.Length;
fs1.Close(); //fs1.Read(mainram2, 0, n);
//fs1.Close();
} }
} }
public static void nvram_handler_save_neogeo() public static void nvram_handler_save_neogeo()
{ {
FileStream fs1 = new FileStream("nvram\\" + Machine.sName + ".nv", FileMode.Create); //FileStream fs1 = new FileStream("nvram\\" + Machine.sName + ".nv", FileMode.Create);
fs1.Write(mainram2, 0, 0x2000); //fs1.Write(mainram2, 0, 0x2000);
fs1.Close(); //fs1.Close();
byte[] temp = new byte[0x2000];
Buffer.BlockCopy(mainram2_src, 0, temp, 0, temp.Length);
using (System.IO.MemoryStream ms = new System.IO.MemoryStream(temp))
{
MameMainMotion.IoSupport.File_WriteAllBytesFromStre("nvram\\" + Machine.sName + ".nv",ms);
}
} }
public static void machine_reset_neogeo() public static void machine_reset_neogeo()
{ {

View File

@ -1,12 +1,11 @@
using cpu.m68000; using cpu.m68000;
using cpu.z80; using cpu.z80;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class Neogeo public unsafe partial class Neogeo
{ {
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
writer.Write(dsw); writer.Write(dsw);
@ -77,7 +76,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
Pd4900a.SaveStateBinary(writer); Pd4900a.SaveStateBinary(writer);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
dsw = reader.ReadByte(); dsw = reader.ReadByte();

View File

@ -1,12 +1,11 @@
using cpu.m68000; using cpu.m68000;
using cpu.z80; using cpu.z80;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class PGM public unsafe partial class PGM
{ {
public unsafe static void SaveStateBinary(BinaryWriter writer) public unsafe static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
writer.Write(pgm_tx_videoram, 0, 0x2000); writer.Write(pgm_tx_videoram, 0, 0x2000);
@ -58,7 +57,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
pgm_tx_videoram = reader.ReadBytes(0x2000); pgm_tx_videoram = reader.ReadBytes(0x2000);

View File

@ -1,14 +1,12 @@
using System.IO; namespace MAME.Core
namespace MAME.Core
{ {
public partial class SunA8 public partial class SunA8
{ {
public static void SaveStateBinary_starfigh(BinaryWriter writer) public static void SaveStateBinary_starfigh(System.IO.BinaryWriter writer)
{ {
} }
public static void LoadStateBinary_starfigh(BinaryReader reader) public static void LoadStateBinary_starfigh(System.IO.BinaryReader reader)
{ {
} }

View File

@ -2,13 +2,12 @@
using cpu.m68000; using cpu.m68000;
using cpu.m6805; using cpu.m6805;
using cpu.z80; using cpu.z80;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class Taito public unsafe partial class Taito
{ {
public static void SaveStateBinary_tokio(BinaryWriter writer) public static void SaveStateBinary_tokio(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw0); writer.Write(dsw0);
@ -57,7 +56,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_tokio(BinaryReader reader) public static void LoadStateBinary_tokio(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw0 = reader.ReadByte(); dsw0 = reader.ReadByte();
@ -106,7 +105,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_bublbobl(BinaryWriter writer) public static void SaveStateBinary_bublbobl(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw0); writer.Write(dsw0);
@ -170,7 +169,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_bublbobl(BinaryReader reader) public static void LoadStateBinary_bublbobl(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw0 = reader.ReadByte(); dsw0 = reader.ReadByte();
@ -234,7 +233,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_boblbobl(BinaryWriter writer) public static void SaveStateBinary_boblbobl(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw0); writer.Write(dsw0);
@ -288,7 +287,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_boblbobl(BinaryReader reader) public static void LoadStateBinary_boblbobl(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw0 = reader.ReadByte(); dsw0 = reader.ReadByte();
@ -341,7 +340,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_bub68705(BinaryWriter writer) public static void SaveStateBinary_bub68705(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw0); writer.Write(dsw0);
@ -399,7 +398,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_bub68705(BinaryReader reader) public static void LoadStateBinary_bub68705(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw0 = reader.ReadByte(); dsw0 = reader.ReadByte();
@ -457,7 +456,7 @@ namespace MAME.Core
Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32();
Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32();
} }
public static void SaveStateBinary_opwolf(BinaryWriter writer) public static void SaveStateBinary_opwolf(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dswa); writer.Write(dswa);
@ -594,7 +593,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_opwolf(BinaryReader reader) public static void LoadStateBinary_opwolf(System.IO.BinaryReader reader)
{ {
int i; int i;
dswa = reader.ReadByte(); dswa = reader.ReadByte();

View File

@ -1,13 +1,11 @@
using cpu.m68000; using cpu.m68000;
using cpu.z80; using cpu.z80;
using System;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public unsafe partial class Taitob public unsafe partial class Taitob
{ {
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
//pixel_scroll //pixel_scroll
int i; int i;
@ -97,7 +95,7 @@ namespace MAME.Core
Eeprom.SaveStateBinary(writer); Eeprom.SaveStateBinary(writer);
Taitosnd.SaveStateBinary(writer); Taitosnd.SaveStateBinary(writer);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
dswa = reader.ReadByte(); dswa = reader.ReadByte();

View File

@ -1,11 +1,10 @@
using cpu.z80; using cpu.z80;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public partial class Tehkan public partial class Tehkan
{ {
public unsafe static void SaveStateBinary_pbaction(BinaryWriter writer) public unsafe static void SaveStateBinary_pbaction(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(dsw1); writer.Write(dsw1);
@ -46,7 +45,7 @@ namespace MAME.Core
writer.Write(Sound.mixerstream.output_sampindex); writer.Write(Sound.mixerstream.output_sampindex);
writer.Write(Sound.mixerstream.output_base_sampindex); writer.Write(Sound.mixerstream.output_base_sampindex);
} }
public static void LoadStateBinary_pbaction(BinaryReader reader) public static void LoadStateBinary_pbaction(System.IO.BinaryReader reader)
{ {
int i; int i;
dsw1 = reader.ReadByte(); dsw1 = reader.ReadByte();

View File

@ -0,0 +1,11 @@
using System.IO;
namespace MAME.Core
{
public interface IMAMEIOSupport
{
bool File_Exists(string path);
byte[] File_ReadAllBytes(string path);
void File_WriteAllBytesFromStre(string path, MemoryStream ms);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: da0b580f2a446f948a80085bb9b7b3ee

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public unsafe class AY8910 public unsafe class AY8910
@ -558,7 +557,7 @@ namespace MAME.Core
} }
return ay8910info.regs[r]; return ay8910info.regs[r];
} }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(ay8910info.register_latch); writer.Write(ay8910info.register_latch);
@ -580,7 +579,7 @@ namespace MAME.Core
writer.Write(ay8910info.rng); writer.Write(ay8910info.rng);
writer.Write(ay8910info.vol_enabled, 0, 3); writer.Write(ay8910info.vol_enabled, 0, 3);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
ay8910info.register_latch = reader.ReadInt32(); ay8910info.register_latch = reader.ReadInt32();

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public class DAC public class DAC
@ -57,11 +56,11 @@ namespace MAME.Core
DAC_build_voltable(); DAC_build_voltable();
dac1.output = 0; dac1.output = 0;
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(DAC.dac1.output); writer.Write(DAC.dac1.output);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
dac1.output = reader.ReadInt16(); dac1.output = reader.ReadInt16();
} }

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public unsafe class ICS2115 public unsafe class ICS2115
@ -415,7 +414,7 @@ namespace MAME.Core
} }
recalc_irq(); recalc_irq();
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
@ -449,7 +448,7 @@ namespace MAME.Core
writer.Write(irq_pending); writer.Write(irq_pending);
writer.Write(irq_on); writer.Write(irq_on);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public unsafe class Iremga20 public unsafe class Iremga20
@ -162,7 +161,7 @@ namespace MAME.Core
chip.regs[i] = 0; chip.regs[i] = 0;
} }
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -179,7 +178,7 @@ namespace MAME.Core
writer.Write(chip.channel[i].play); writer.Write(chip.channel[i].play);
} }
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public unsafe class K007232 public unsafe class K007232
@ -232,7 +231,7 @@ namespace MAME.Core
info.bank[0] = (uint)(chABank << 17); info.bank[0] = (uint)(chABank << 17);
info.bank[1] = (uint)(chBBank << 17); info.bank[1] = (uint)(chBBank << 17);
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
@ -271,7 +270,7 @@ namespace MAME.Core
writer.Write(info.pcmbuf_offset[i]); writer.Write(info.pcmbuf_offset[i]);
} }
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public unsafe class K053260 public unsafe class K053260
@ -379,7 +378,7 @@ namespace MAME.Core
{ {
k053260_0_w(offset, data); k053260_0_w(offset, data);
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(ic1.mode); writer.Write(ic1.mode);
@ -402,7 +401,7 @@ namespace MAME.Core
writer.Write(ic1.channels[i].ppcm_data); writer.Write(ic1.channels[i].ppcm_data);
} }
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
ic1.mode = reader.ReadInt32(); ic1.mode = reader.ReadInt32();

View File

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
@ -567,7 +566,7 @@ namespace MAME.Core
{ {
return k054539_r(0, offset); return k054539_r(0, offset);
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
@ -596,7 +595,7 @@ namespace MAME.Core
writer.Write(zoneflag); writer.Write(zoneflag);
writer.Write(zonedata); writer.Write(zonedata);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)

View File

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
@ -254,7 +253,7 @@ namespace MAME.Core
mm1[num].voice.bitwidth = bitwidth; mm1[num].voice.bitwidth = bitwidth;
} }
} }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(voice.select); writer.Write(voice.select);
writer.Write(voice.index); writer.Write(voice.index);
@ -267,7 +266,7 @@ namespace MAME.Core
writer.Write(voice.signal); writer.Write(voice.signal);
writer.Write(voice.step); writer.Write(voice.step);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
voice.select = reader.ReadInt32(); voice.select = reader.ReadInt32();
voice.index = reader.ReadInt32(); voice.index = reader.ReadInt32();

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public unsafe class Namco public unsafe class Namco
@ -255,7 +254,7 @@ namespace MAME.Core
{ {
return namco_wavedata[offset]; return namco_wavedata[offset];
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
writer.Write(nam1.num_voices); writer.Write(nam1.num_voices);
@ -282,7 +281,7 @@ namespace MAME.Core
} }
writer.Write(namco_wavedata, 0, 0x400); writer.Write(namco_wavedata, 0, 0x400);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
nam1.num_voices = reader.ReadInt32(); nam1.num_voices = reader.ReadInt32();

View File

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
@ -272,7 +271,7 @@ namespace MAME.Core
//if (ACCESSING_BITS_0_7) //if (ACCESSING_BITS_0_7)
okim6295_data_w(0, data & 0xff); okim6295_data_w(0, data & 0xff);
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
writer.Write(OKI.command); writer.Write(OKI.command);
@ -288,7 +287,7 @@ namespace MAME.Core
writer.Write(adpcm[i].step); writer.Write(adpcm[i].step);
} }
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
OKI.command = reader.ReadInt32(); OKI.command = reader.ReadInt32();

View File

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
@ -195,7 +194,7 @@ namespace MAME.Core
} }
} }
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
@ -215,7 +214,7 @@ namespace MAME.Core
} }
writer.Write(QChip.data); writer.Write(QChip.data);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)

View File

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace MAME.Core namespace MAME.Core
@ -186,7 +185,7 @@ namespace MAME.Core
info.starthandler(); info.starthandler();
} }
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
for (i = 0; i < info.numchannels; i++) for (i = 0; i < info.numchannels; i++)
@ -201,7 +200,7 @@ namespace MAME.Core
writer.Write(info.channel[i].paused); writer.Write(info.channel[i].paused);
} }
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
for (i = 0; i < info.numchannels; i++) for (i = 0; i < info.numchannels; i++)

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public class Taitosnd public class Taitosnd
@ -201,7 +200,7 @@ namespace MAME.Core
{ {
return (ushort)(taitosound_comm_r(0) << 8); return (ushort)(taitosound_comm_r(0) << 8);
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(tc0140syt.slavedata, 0, 4); writer.Write(tc0140syt.slavedata, 0, 4);
writer.Write(tc0140syt.masterdata, 0, 4); writer.Write(tc0140syt.masterdata, 0, 4);
@ -211,7 +210,7 @@ namespace MAME.Core
writer.Write(tc0140syt.nmi_enabled); writer.Write(tc0140syt.nmi_enabled);
writer.Write(tc0140syt.nmi_req); writer.Write(tc0140syt.nmi_req);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
tc0140syt.slavedata = reader.ReadBytes(4); tc0140syt.slavedata = reader.ReadBytes(4);
tc0140syt.masterdata = reader.ReadBytes(4); tc0140syt.masterdata = reader.ReadBytes(4);

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public unsafe class Upd7759 public unsafe class Upd7759
@ -362,7 +361,7 @@ namespace MAME.Core
{ {
return (byte)upd7759_busy_r(0); return (byte)upd7759_busy_r(0);
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
writer.Write(chip.pos); writer.Write(chip.pos);
writer.Write(chip.step); writer.Write(chip.step);
@ -389,7 +388,7 @@ namespace MAME.Core
writer.Write(chip.romoffset); writer.Write(chip.romoffset);
writer.Write(chip.rombase); writer.Write(chip.rombase);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
chip.pos = reader.ReadUInt32(); chip.pos = reader.ReadUInt32();
chip.step = reader.ReadUInt32(); chip.step = reader.ReadUInt32();

View File

@ -1,16 +1,17 @@
using System.IO; 
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
public class WavWrite public class WavWrite
{ {
public static FileStream mWaveFile = null; public static System.IO.FileStream mWaveFile = null;
private static BinaryWriter mWriter = null; private static System.IO.BinaryWriter mWriter = null;
private static int mSampleCount = 0; private static int mSampleCount = 0;
public static void CreateSoundFile(string filename) public static void CreateSoundFile(string filename)
{ {
mWaveFile = new FileStream(filename, FileMode.Create); mWaveFile = new FileStream(filename, FileMode.Create);
mWriter = new BinaryWriter(mWaveFile); mWriter = new System.IO.BinaryWriter(mWaveFile);
/************************************************************************** /**************************************************************************
Hereiswherethefilewillbecreated.A Hereiswherethefilewillbecreated.A
wavefileisaRIFFfile,whichhaschunks wavefileisaRIFFfile,whichhaschunks

View File

@ -1,5 +1,4 @@
using System; using System;
using System.IO;
namespace MAME.Core namespace MAME.Core
{ {
@ -2038,7 +2037,7 @@ namespace MAME.Core
// chanout[imem[op1]] = PSG.oper[op1].mem_value; // chanout[imem[op1]] = PSG.oper[op1].mem_value;
// } // }
//} //}
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i; int i;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
@ -2115,7 +2114,7 @@ namespace MAME.Core
writer.Write(PSG.irqlinestate); writer.Write(PSG.irqlinestate);
writer.Write(PSG.connect); writer.Write(PSG.connect);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i; int i;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public unsafe class YM2203 public unsafe class YM2203
@ -339,7 +338,7 @@ namespace MAME.Core
} }
} }
} }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
writer.Write(REGS, 0, 256); writer.Write(REGS, 0, 256);
@ -435,7 +434,7 @@ namespace MAME.Core
writer.Write(YMDeltat.DELTAT.adpcmd); writer.Write(YMDeltat.DELTAT.adpcmd);
writer.Write(YMDeltat.DELTAT.adpcml); writer.Write(YMDeltat.DELTAT.adpcml);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
REGS = reader.ReadBytes(256); REGS = reader.ReadBytes(256);

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public unsafe class YM2610 public unsafe class YM2610
@ -654,7 +653,7 @@ namespace MAME.Core
{ {
adpcm_arrivedEndAddress &= (byte)(~changebits); adpcm_arrivedEndAddress &= (byte)(~changebits);
} }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
writer.Write(REGS, 0, 512); writer.Write(REGS, 0, 512);
@ -771,7 +770,7 @@ namespace MAME.Core
writer.Write(YMDeltat.DELTAT.adpcmd); writer.Write(YMDeltat.DELTAT.adpcmd);
writer.Write(YMDeltat.DELTAT.adpcml); writer.Write(YMDeltat.DELTAT.adpcml);
} }
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
REGS = reader.ReadBytes(512); REGS = reader.ReadBytes(512);

View File

@ -1,5 +1,4 @@
using System.IO; 
namespace MAME.Core namespace MAME.Core
{ {
public class YM3812 public class YM3812
@ -85,7 +84,7 @@ namespace MAME.Core
{ {
FMOpl.ym3812_write(1, data); FMOpl.ym3812_write(1, data);
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)
@ -140,7 +139,7 @@ namespace MAME.Core
writer.Write(FMOpl.YM3812.statusmask); writer.Write(FMOpl.YM3812.statusmask);
writer.Write(FMOpl.YM3812.mode); writer.Write(FMOpl.YM3812.mode);
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)
@ -268,7 +267,7 @@ namespace MAME.Core
{ {
return FMOpl.ym3526_read(1); return FMOpl.ym3526_read(1);
} }
public static void SaveStateBinary_YM3526(BinaryWriter writer) public static void SaveStateBinary_YM3526(System.IO.BinaryWriter writer)
{ {
int i, j; int i, j;
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)
@ -323,7 +322,7 @@ namespace MAME.Core
writer.Write(FMOpl.YM3526.statusmask); writer.Write(FMOpl.YM3526.statusmask);
writer.Write(FMOpl.YM3526.mode); writer.Write(FMOpl.YM3526.mode);
} }
public static void LoadStateBinary_YM3526(BinaryReader reader) public static void LoadStateBinary_YM3526(System.IO.BinaryReader reader)
{ {
int i, j; int i, j;
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)

View File

@ -11,7 +11,7 @@ using Essgee.Metadata;
using Essgee.Utilities; using Essgee.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
//using System.IO; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using UnityEngine; using UnityEngine;
@ -40,6 +40,7 @@ public class UEssgee : MonoBehaviour, IEmuCore
GameMetadata lastGameMetadata; GameMetadata lastGameMetadata;
Essgee.Emulation.EmulatorHandler emulatorHandler; Essgee.Emulation.EmulatorHandler emulatorHandler;
UEGResources uegResources; UEGResources uegResources;
UEGIO uegIO;
UEGLog uegLog; UEGLog uegLog;
UEGSaveByteConvert uegSaveByteConvert; UEGSaveByteConvert uegSaveByteConvert;
private Canvas mCanvas; private Canvas mCanvas;
@ -55,6 +56,7 @@ public class UEssgee : MonoBehaviour, IEmuCore
App.tick.SetFrameRate(60); App.tick.SetFrameRate(60);
instance = this; instance = this;
uegResources = new UEGResources(); uegResources = new UEGResources();
uegIO = new UEGIO();
uegLog = new UEGLog(); uegLog = new UEGLog();
uegSaveByteConvert = new UEGSaveByteConvert(); uegSaveByteConvert = new UEGSaveByteConvert();
mCanvas = GameObject.Find("Canvas").GetComponent<Canvas>(); mCanvas = GameObject.Find("Canvas").GetComponent<Canvas>();
@ -104,7 +106,7 @@ public class UEssgee : MonoBehaviour, IEmuCore
{ {
mPlatform = romFile.Platform; mPlatform = romFile.Platform;
InitAll(uegResources, App.PersistentDataPath(mPlatform)); InitAll(uegResources, uegIO, App.PersistentDataPath(mPlatform));
bLogicUpdatePause = true; bLogicUpdatePause = true;
@ -165,17 +167,18 @@ public class UEssgee : MonoBehaviour, IEmuCore
} }
#endregion #endregion
void InitAll(IGameMetaReources metaresources, string CustonDataDir) void InitAll(IGameMetaReources metaresources, IEssgeeIOSupport uegIO, string CustonDataDir)
{ {
//³õʼ»¯ÅäÖà //³õʼ»¯ÅäÖÃ
InitAppEnvironment(CustonDataDir); InitAppEnvironment(CustonDataDir, uegIO);
InitEmu(); InitEmu();
//ϸ½Ú³õʼ»¯ //ϸ½Ú³õʼ»¯
InitializeHandlers(metaresources); InitializeHandlers(metaresources);
} }
private void InitAppEnvironment(string CustonDataDir) private void InitAppEnvironment(string CustonDataDir, IEssgeeIOSupport uegIO)
{ {
EmulatorHandler.io = uegIO;
EssgeeLogger.Init(uegLog); EssgeeLogger.Init(uegLog);
//EmuStandInfo.datDirectoryPath = Path.Combine(BaseDataDir, "EssgeeAssets", "No-Intro"); //EmuStandInfo.datDirectoryPath = Path.Combine(BaseDataDir, "EssgeeAssets", "No-Intro");

View File

@ -0,0 +1,20 @@
using Essgee.Metadata;
using System.IO;
public class UEGIO : IEssgeeIOSupport
{
public bool File_Exists(string path)
{
return AxiIO.File.Exists(path);
}
public byte[] File_ReadAllBytes(string path)
{
return AxiIO.File.ReadAllBytes(path);
}
public void File_WriteAllBytesFromStre(string path, MemoryStream ms)
{
AxiIO.File.WriteAllBytesFromStream(path, ms);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2d1eadaf2f90ca44b9732206158f7599

View File

@ -20,6 +20,7 @@ public class UMAME : MonoBehaviour, IEmuCore
UniSoundPlayer mUniSoundPlayer; UniSoundPlayer mUniSoundPlayer;
UniKeyboard mUniKeyboard; UniKeyboard mUniKeyboard;
UniResources mUniResources; UniResources mUniResources;
UniIO mUniIO;
public Text mFPS; public Text mFPS;
private Canvas mCanvas; private Canvas mCanvas;
@ -53,9 +54,10 @@ public class UMAME : MonoBehaviour, IEmuCore
mUniSoundPlayer = GameObject.Find("Audio").transform.GetComponent<UniSoundPlayer>(); mUniSoundPlayer = GameObject.Find("Audio").transform.GetComponent<UniSoundPlayer>();
mUniKeyboard = this.gameObject.AddComponent<UniKeyboard>(); mUniKeyboard = this.gameObject.AddComponent<UniKeyboard>();
mUniResources = new UniResources(); mUniResources = new UniResources();
mUniIO = new UniIO();
mChangeRomName = string.Empty; mChangeRomName = string.Empty;
mTimeSpan = new UniTimeSpan(); mTimeSpan = new UniTimeSpan();
emu.Init(RomPath, mUniLog, mUniResources, mUniVideoPlayer, mUniSoundPlayer, mUniKeyboard, mUniMouse, mTimeSpan); emu.Init(RomPath, mUniLog, mUniResources, mUniVideoPlayer, mUniSoundPlayer, mUniKeyboard, mUniMouse, mTimeSpan, mUniIO);
} }
void OnEnable() void OnEnable()
{ {

View File

@ -0,0 +1,20 @@
using MAME.Core;
using System.IO;
public class UniIO : IMAMEIOSupport
{
public bool File_Exists(string path)
{
return AxiIO.File.Exists(path);
}
public byte[] File_ReadAllBytes(string path)
{
return AxiIO.File.ReadAllBytes(path);
}
public void File_WriteAllBytesFromStre(string path, MemoryStream ms)
{
AxiIO.File.WriteAllBytesFromStream(path, ms);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0bde9793324600e4da84ead00e1e9111

View File

@ -1,4 +1,5 @@
using StoicGoose.Core.Interfaces; using Essgee.Metadata;
using StoicGoose.Core.Interfaces;
using StoicGooseUnity; using StoicGooseUnity;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@ -8,6 +9,7 @@ public class EmulatorHandler
{ {
readonly static string threadName = $"Unity_Emulation"; readonly static string threadName = $"Unity_Emulation";
public static IEssgeeIOSupport io;
//Thread thread = default; //Thread thread = default;
volatile bool threadRunning = false, threadPaused = false; volatile bool threadRunning = false, threadPaused = false;