forked from sin365/AxibugEmuOnline
Merge branch 'master' of http://git.axibug.com/sin365/AxibugEmuOnline
This commit is contained in:
commit
e8bac390af
AxibugEmuOnline.Client/Assets
AxiProjectTools/AxiNSPack/Editors
Plugins
AxiNSApi
Essgee.Unity
AxiMemory.csEmuStandInfo.cs
Emulation
Extensions
IAxiEssgssStatus.csMetadata
Utilities
Mame.Core
MAMEEmu.cs
Motion
cpu
emu
mame
capcom
cps
dataeast
igs011
konami68000
m72
m92
namcos1
neogeo
pgm
suna8
taito
taitob
tehkan
run_interface
sound
StoicGooseUnity
Resources/UIPrefabs
Script/AppMain
App.cs
AxiHttp
AxiIO.metaAxiIO
AxiIO.csAxiIO.cs.metaCSharpIO.csCSharpIO.cs.metaIAxiIO.csIAxiIO.cs.metaNSwitchIO.csNSwitchIO.cs.meta
AxibugEmuOnline.Client.asmdefCommon
Emulator
EssgeeEmulator
MameEmulator
NesEmulator
@ -3,7 +3,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -20,7 +19,17 @@ namespace AxibugEmuOnline.Editors
|
|||||||
static Dictionary<string, string> tools = new Dictionary<string, string>();
|
static Dictionary<string, string> tools = new Dictionary<string, string>();
|
||||||
static string prodKeysPath;
|
static string prodKeysPath;
|
||||||
|
|
||||||
[MenuItem("Axibug盧濂묏야/Switch/AxibugNSPTools/RepackNSP(쏭路劤뭐쉔NPS)")]
|
static void InitToolPath()
|
||||||
|
{
|
||||||
|
#region 初始化工具路径
|
||||||
|
// 获取环境变量(需要添加环境变量检查)
|
||||||
|
string sdkRoot = Environment.GetEnvironmentVariable("NINTENDO_SDK_ROOT");
|
||||||
|
tools["authoringTool"] = Path.Combine(sdkRoot, "Tools/CommandLineTools/AuthoringTool/AuthoringTool.exe");
|
||||||
|
tools["hacPack"] = Path.Combine(hacpack_root, "hacpack");
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem("Axibug移植工具/Switch/AxibugNSPTools/RepackNSP(仅重新构建NSP)")]
|
||||||
static void RepackNSP()
|
static void RepackNSP()
|
||||||
{
|
{
|
||||||
if (!CheckEnvironmentVariable())
|
if (!CheckEnvironmentVariable())
|
||||||
@ -38,7 +47,29 @@ namespace AxibugEmuOnline.Editors
|
|||||||
RepackNSP(path);
|
RepackNSP(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("Axibug盧濂묏야/Switch/AxibugNSPTools/Build With RepackNSP(댔관NSP깻路劤뭐쉔NPS)")]
|
|
||||||
|
//[MenuItem("Axibug移植工具/Switch/AxibugNSPTools/UnpackNSP(解包工具)")]
|
||||||
|
//static void UnpackNSP()
|
||||||
|
//{
|
||||||
|
// InitToolPath();
|
||||||
|
// if (!CheckEnvironmentVariable())
|
||||||
|
// return;
|
||||||
|
|
||||||
|
// string nspFilePath = EditorUtility.OpenFilePanel(
|
||||||
|
// title: "选择 .nsp 文件",
|
||||||
|
// directory: Path.Combine(Application.dataPath, ".."), // 默认路径为项目 Assets 目录
|
||||||
|
// extension: "nsp" // 限制文件类型为 .nsp
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (string.IsNullOrEmpty(nspFilePath))
|
||||||
|
// return;
|
||||||
|
|
||||||
|
// string nspParentDir = Path.GetDirectoryName(nspFilePath);
|
||||||
|
// string extractPath = Path.Combine(nspParentDir, "repacker_extract");
|
||||||
|
// ExecuteCommand($"{tools["authoringTool"]} extract -o \"{extractPath}\" \"{nspFilePath}\"", nspParentDir);
|
||||||
|
//}
|
||||||
|
|
||||||
|
[MenuItem("Axibug移植工具/Switch/AxibugNSPTools/Build With RepackNSP(打包NSP并重新构建NSP)")]
|
||||||
public static void BuildWithRepackNSP()
|
public static void BuildWithRepackNSP()
|
||||||
{
|
{
|
||||||
if (!CheckEnvironmentVariable())
|
if (!CheckEnvironmentVariable())
|
||||||
@ -121,12 +152,7 @@ namespace AxibugEmuOnline.Editors
|
|||||||
|
|
||||||
static void RepackNSP(string nspFile)
|
static void RepackNSP(string nspFile)
|
||||||
{
|
{
|
||||||
#region 놓迦뺏묏야쨌쓺
|
InitToolPath();
|
||||||
// 삿혤뻔쓱긴좆(矜狼警속뻔쓱긴좆쇱꿴)
|
|
||||||
string sdkRoot = Environment.GetEnvironmentVariable("NINTENDO_SDK_ROOT");
|
|
||||||
tools["authoringTool"] = Path.Combine(sdkRoot, "Tools/CommandLineTools/AuthoringTool/AuthoringTool.exe");
|
|
||||||
tools["hacPack"] = Path.Combine(hacpack_root, "hacpack");
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region ´¦ÀíNSPÎļþ·¾¶
|
#region ´¦ÀíNSPÎļþ·¾¶
|
||||||
string nspFilePath = nspFile;
|
string nspFilePath = nspFile;
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"name": "AxiNSApi"
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c8ad600c72d635843bd8aeb9d8aebfb8
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -2,20 +2,24 @@
|
|||||||
using nn.fs;
|
using nn.fs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
public class AxiNSIO
|
public class AxiNSIO
|
||||||
{
|
{
|
||||||
string save_name => AxiNS.instance.mount.SaveMountName;
|
string save_name => AxiNS.instance.mount.SaveMountName;
|
||||||
public string save_path => $"{save_name}:/";
|
public string save_path => $"{save_name}:/";
|
||||||
#if UNITY_SWITCH
|
#if UNITY_SWITCH
|
||||||
private FileHandle fileHandle = new nn.fs.FileHandle();
|
private FileHandle fileHandle = new nn.fs.FileHandle();
|
||||||
#endif
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查Path是否存在
|
/// 检查Path是否存在
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool CheckPathExists(string filePath)
|
public bool CheckPathExists(string filePath)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -25,14 +29,14 @@ public class AxiNSIO
|
|||||||
//这个异常捕获。真的别扭
|
//这个异常捕获。真的别扭
|
||||||
return nn.fs.FileSystem.ResultPathAlreadyExists.Includes(result);
|
return nn.fs.FileSystem.ResultPathAlreadyExists.Includes(result);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查Path是否不存在
|
/// 检查Path是否不存在
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool CheckPathNotFound(string filePath)
|
public bool CheckPathNotFound(string filePath)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -41,14 +45,14 @@ public class AxiNSIO
|
|||||||
//这个异常捕获。真的别扭
|
//这个异常捕获。真的别扭
|
||||||
return nn.fs.FileSystem.ResultPathNotFound.Includes(result);
|
return nn.fs.FileSystem.ResultPathNotFound.Includes(result);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建目录,目录存在也会返回true
|
/// 创建目录,目录存在也会返回true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool CreateDir(string filePath)
|
public bool CreateDir(string filePath)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -60,38 +64,38 @@ public class AxiNSIO
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
/// <param name="bw"></param>
|
/// <param name="bw"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool FileToSaveWithCreate(string filePath, System.IO.MemoryStream ms)
|
public bool FileToSaveWithCreate(string filePath, System.IO.MemoryStream ms)
|
||||||
{
|
{
|
||||||
return FileToSaveWithCreate(filePath, ms.ToArray());
|
return FileToSaveWithCreate(filePath, ms.ToArray());
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public AxiNSWait_FileToSaveByMSWithCreate FileToSaveWithCreateAsync(string filePath, System.IO.MemoryStream ms)
|
public AxiNSWait_FileToSaveByMSWithCreate FileToSaveWithCreateAsync(string filePath, System.IO.MemoryStream ms)
|
||||||
{
|
{
|
||||||
var wait = new AxiNSWait_FileToSaveByMSWithCreate(filePath, ms);
|
var wait = new AxiNSWait_FileToSaveByMSWithCreate(filePath, ms);
|
||||||
AxiNS.instance.wait.AddWait(wait);
|
AxiNS.instance.wait.AddWait(wait);
|
||||||
return wait;
|
return wait;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool FileToSaveWithCreate(string filePath, byte[] data)
|
public bool FileToSaveWithCreate(string filePath, byte[] data)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -195,33 +199,39 @@ public class AxiNSIO
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public AxiNSWait_FileToSaveWithCreate FileToSaveWithCreateAsync(string filePath, byte[] data)
|
public AxiNSWait_FileToSaveWithCreate FileToSaveWithCreateAsync(string filePath, byte[] data)
|
||||||
{
|
{
|
||||||
var wait = new AxiNSWait_FileToSaveWithCreate(filePath, data);
|
var wait = new AxiNSWait_FileToSaveWithCreate(filePath, data);
|
||||||
AxiNS.instance.wait.AddWait(wait);
|
AxiNS.instance.wait.AddWait(wait);
|
||||||
return wait;
|
return wait;
|
||||||
}
|
}
|
||||||
public bool LoadSwitchDataFile(string filename, ref System.IO.MemoryStream ms)
|
public byte[] LoadSwitchDataFile(string filename)
|
||||||
{
|
{
|
||||||
if (LoadSwitchDataFile(filename, out byte[] outputData))
|
LoadSwitchDataFile(filename, out byte[] outputData);
|
||||||
{
|
return outputData;
|
||||||
using (System.IO.BinaryWriter writer = new System.IO.BinaryWriter(ms))
|
}
|
||||||
{
|
|
||||||
writer.Write(outputData);
|
public bool LoadSwitchDataFile(string filename, ref System.IO.MemoryStream ms)
|
||||||
}
|
{
|
||||||
return true;
|
if (LoadSwitchDataFile(filename, out byte[] outputData))
|
||||||
}
|
{
|
||||||
return false;
|
using (System.IO.BinaryWriter writer = new System.IO.BinaryWriter(ms))
|
||||||
}
|
{
|
||||||
public bool LoadSwitchDataFile(string filename, out byte[] outputData)
|
writer.Write(outputData);
|
||||||
{
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public bool LoadSwitchDataFile(string filename, out byte[] outputData)
|
||||||
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
outputData = null;
|
outputData = null;
|
||||||
return false;
|
return false;
|
||||||
@ -272,15 +282,94 @@ public class AxiNSIO
|
|||||||
outputData = loadedData;
|
outputData = loadedData;
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
public AxiNSWait_LoadSwitchDataFile LoadSwitchDataFileAsync(string filename)
|
public AxiNSWait_LoadSwitchDataFile LoadSwitchDataFileAsync(string filename)
|
||||||
{
|
{
|
||||||
var wait = new AxiNSWait_LoadSwitchDataFile(filename);
|
var wait = new AxiNSWait_LoadSwitchDataFile(filename);
|
||||||
AxiNS.instance.wait.AddWait(wait);
|
AxiNS.instance.wait.AddWait(wait);
|
||||||
return wait;
|
return wait;
|
||||||
}
|
}
|
||||||
public bool DeletePathFile(string filename)
|
|
||||||
|
public bool GetDirectoryFiles(string path, out string[] entrys)
|
||||||
|
{
|
||||||
|
#if !UNITY_SWITCH
|
||||||
|
entrys = null;
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
return GetDirectoryEntrys(path,nn.fs.OpenDirectoryMode.File,out entrys);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GetDirectoryDirs(string path, out string[] entrys)
|
||||||
|
{
|
||||||
|
#if !UNITY_SWITCH
|
||||||
|
entrys = null;
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
return GetDirectoryEntrys(path, nn.fs.OpenDirectoryMode.Directory, out entrys);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if UNITY_SWITCH
|
||||||
|
public bool GetDirectoryEntrys(string path, nn.fs.OpenDirectoryMode type, out string[] entrys)
|
||||||
{
|
{
|
||||||
|
entrys = null;
|
||||||
|
return false;
|
||||||
|
nn.fs.DirectoryHandle dirHandle = new nn.fs.DirectoryHandle();
|
||||||
|
nn.Result result = nn.fs.Directory.Open(ref dirHandle, path, type);
|
||||||
|
if (nn.fs.FileSystem.ResultPathNotFound.Includes(result))
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log($"目录 {path} 不存在");
|
||||||
|
entrys = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
long entryCount = 0;
|
||||||
|
nn.fs.Directory.GetEntryCount(ref entryCount, dirHandle);
|
||||||
|
nn.fs.DirectoryEntry[] dirEntries = new nn.fs.DirectoryEntry[entryCount];
|
||||||
|
long actualEntries = 0;
|
||||||
|
nn.fs.Directory.Read(ref actualEntries, dirEntries, dirHandle, entryCount);
|
||||||
|
|
||||||
|
entrys = new string[actualEntries];
|
||||||
|
for (int i = 0; i < actualEntries; i++)
|
||||||
|
{
|
||||||
|
entrys[i] = dirEntries[i].name;
|
||||||
|
}
|
||||||
|
nn.fs.Directory.Close(dirHandle);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public IEnumerable<string> EnumerateFiles(string path, string searchPattern)
|
||||||
|
{
|
||||||
|
#if !UNITY_SWITCH
|
||||||
|
yield break;
|
||||||
|
#else
|
||||||
|
// 将通配符转换为正则表达式(支持*和?)
|
||||||
|
var regexPattern = "^" +
|
||||||
|
Regex.Escape(searchPattern)
|
||||||
|
.Replace("\\*", ".*")
|
||||||
|
.Replace("\\?", ".")
|
||||||
|
+ "$";
|
||||||
|
|
||||||
|
var regex = new Regex(regexPattern, RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
|
if (!GetDirectoryEntrys(path, nn.fs.OpenDirectoryMode.File, out string[] entrys))
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < entrys.Length; i++)
|
||||||
|
{
|
||||||
|
if (regex.IsMatch(System.IO.Path.GetFileName(entrys[i])))
|
||||||
|
{
|
||||||
|
yield return entrys[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DeletePathFile(string filename)
|
||||||
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -315,15 +404,15 @@ public class AxiNSIO
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
public AxiNSWait_DeletePathFile DeletePathFileAsync(string filename)
|
public AxiNSWait_DeletePathFile DeletePathFileAsync(string filename)
|
||||||
{
|
{
|
||||||
var wait = new AxiNSWait_DeletePathFile(filename);
|
var wait = new AxiNSWait_DeletePathFile(filename);
|
||||||
AxiNS.instance.wait.AddWait(wait);
|
AxiNS.instance.wait.AddWait(wait);
|
||||||
return wait;
|
return wait;
|
||||||
}
|
}
|
||||||
public bool DeletePathDir(string filename)
|
public bool DeletePathDir(string filename)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -356,21 +445,21 @@ public class AxiNSIO
|
|||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
public AxiNSWait_DeletePathDir DeletePathDirAsync(string filename)
|
public AxiNSWait_DeletePathDir DeletePathDirAsync(string filename)
|
||||||
{
|
{
|
||||||
var wait = new AxiNSWait_DeletePathDir(filename);
|
var wait = new AxiNSWait_DeletePathDir(filename);
|
||||||
AxiNS.instance.wait.AddWait(wait);
|
AxiNS.instance.wait.AddWait(wait);
|
||||||
return wait;
|
return wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 递归删除目录
|
/// 递归删除目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename"></param>
|
/// <param name="filename"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool DeleteRecursivelyPathDir(string filename)
|
public bool DeleteRecursivelyPathDir(string filename)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -403,15 +492,15 @@ public class AxiNSIO
|
|||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 递归删除情况
|
/// 递归删除情况
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename"></param>
|
/// <param name="filename"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool CleanRecursivelyPathDir(string filename)
|
public bool CleanRecursivelyPathDir(string filename)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -444,10 +533,10 @@ public class AxiNSIO
|
|||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RenameDir(string oldpath, string newpath)
|
public bool RenameDir(string oldpath, string newpath)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -481,9 +570,9 @@ public class AxiNSIO
|
|||||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
bool EnsureParentDirectory(string filePath, bool bAutoCreateDir = true)
|
bool EnsureParentDirectory(string filePath, bool bAutoCreateDir = true)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -559,14 +648,14 @@ public class AxiNSIO
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查指定挂载点是否可访问
|
/// 检查指定挂载点是否可访问
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pathPrefix">路径前缀,例如 "save:/" 或 "sd:/"</param>
|
/// <param name="pathPrefix">路径前缀,例如 "save:/" 或 "sd:/"</param>
|
||||||
/// <returns>挂载点是否可访问</returns>
|
/// <returns>挂载点是否可访问</returns>
|
||||||
bool IsMountPointAccessible(string pathPrefix)
|
bool IsMountPointAccessible(string pathPrefix)
|
||||||
{
|
{
|
||||||
#if !UNITY_SWITCH
|
#if !UNITY_SWITCH
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@ -604,5 +693,5 @@ public class AxiNSIO
|
|||||||
return true; // 其他挂载点需根据实际需求实现
|
return true; // 其他挂载点需根据实际需求实现
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public class AxiNSMount
|
|||||||
UnityEngine.Debug.LogError($"UnmountSDCardForDebug->ÒÑÐ¶ÔØ{m_SdCardDebugMountName}:/ ");
|
UnityEngine.Debug.LogError($"UnmountSDCardForDebug->ÒÑÐ¶ÔØ{m_SdCardDebugMountName}:/ ");
|
||||||
bInSdCardDebugMount = false;
|
bInSdCardDebugMount = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
public void UnmountSDCard()
|
public void UnmountSDCard()
|
||||||
{
|
{
|
||||||
#if UNITY_SWITCH
|
#if UNITY_SWITCH
|
||||||
|
@ -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);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
using Essgee;
|
using Essgee;
|
||||||
|
using Essgee.Metadata;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public static class EmuStandInfo
|
public static class EmuStandInfo
|
||||||
@ -8,7 +9,6 @@ public static class EmuStandInfo
|
|||||||
//public static string datDirectoryPath;
|
//public static string datDirectoryPath;
|
||||||
//public static string metadataDatabaseFilePath;
|
//public static string metadataDatabaseFilePath;
|
||||||
|
|
||||||
|
|
||||||
public static string jsonConfigFileName;//= "Config.json";
|
public static string jsonConfigFileName;//= "Config.json";
|
||||||
public static string saveDataDirectoryName;//= "Saves";
|
public static string saveDataDirectoryName;//= "Saves";
|
||||||
public static string screenshotDirectoryName;//= "Screenshots";
|
public static string screenshotDirectoryName;//= "Screenshots";
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 */
|
||||||
|
@ -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)
|
||||||
|
@ -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()
|
||||||
{
|
{
|
||||||
|
@ -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);
|
||||||
|
@ -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++)
|
||||||
|
@ -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);
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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);
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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++)
|
||||||
|
@ -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();
|
||||||
|
@ -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);
|
||||||
|
@ -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();
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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()
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
|
@ -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();
|
||||||
|
@ -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()
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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++)
|
||||||
|
@ -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);
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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()
|
||||||
{
|
{
|
||||||
|
@ -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();
|
||||||
|
@ -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);
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: da0b580f2a446f948a80085bb9b7b3ee
|
@ -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();
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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++)
|
||||||
|
@ -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++)
|
||||||
|
@ -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++)
|
||||||
|
@ -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();
|
||||||
|
@ -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++)
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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++)
|
||||||
|
@ -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++)
|
||||||
|
@ -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);
|
||||||
|
@ -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();
|
||||||
|
@ -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
|
||||||
|
@ -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++)
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
|
@ -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++)
|
||||||
|
@ -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 StoicGooseUnity
|
namespace StoicGooseUnity
|
||||||
@ -95,21 +94,21 @@ namespace StoicGooseUnity
|
|||||||
}
|
}
|
||||||
#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);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
//using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace StoicGoose.Common.Drawing
|
namespace StoicGoose.Common.Drawing
|
||||||
@ -10,46 +10,46 @@ namespace StoicGoose.Common.Drawing
|
|||||||
|
|
||||||
public class RgbaFile
|
public class RgbaFile
|
||||||
{
|
{
|
||||||
const string expectedMagic = "RGBA";
|
//const string expectedMagic = "RGBA";
|
||||||
|
|
||||||
public string MagicNumber { get; protected set; }
|
//public string MagicNumber { get; protected set; }
|
||||||
public uint Width { get; protected set; }
|
//public uint Width { get; protected set; }
|
||||||
public uint Height { get; protected set; }
|
//public uint Height { get; protected set; }
|
||||||
public byte[] PixelData { get; protected set; }
|
//public byte[] PixelData { get; protected set; }
|
||||||
|
|
||||||
public RgbaFile(string filename) : this(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { }
|
//public RgbaFile(string filename) : this(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { }
|
||||||
|
|
||||||
public RgbaFile(Stream stream)
|
//public RgbaFile(System.IO.Stream stream)
|
||||||
{
|
//{
|
||||||
MagicNumber = ReadString(stream, 4);
|
// MagicNumber = ReadString(stream, 4);
|
||||||
Width = ReadUInt32(stream);
|
// Width = ReadUInt32(stream);
|
||||||
Height = ReadUInt32(stream);
|
// Height = ReadUInt32(stream);
|
||||||
PixelData = new byte[Width * Height * 4];
|
// PixelData = new byte[Width * Height * 4];
|
||||||
stream.Read(PixelData);
|
// stream.Read(PixelData);
|
||||||
}
|
//}
|
||||||
|
|
||||||
public RgbaFile(uint width, uint height, byte[] pixelData)
|
//public RgbaFile(uint width, uint height, byte[] pixelData)
|
||||||
{
|
//{
|
||||||
MagicNumber = expectedMagic;
|
// MagicNumber = expectedMagic;
|
||||||
Width = width;
|
// Width = width;
|
||||||
Height = height;
|
// Height = height;
|
||||||
PixelData = pixelData;
|
// PixelData = pixelData;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public void Save(string filename) => Save(new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.ReadWrite));
|
//public void Save(string filename) => Save(new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.ReadWrite));
|
||||||
|
|
||||||
public void Save(Stream stream)
|
//public void Save(Stream stream)
|
||||||
{
|
//{
|
||||||
WriteString(stream, MagicNumber);
|
// WriteString(stream, MagicNumber);
|
||||||
WriteUInt32(stream, Width);
|
// WriteUInt32(stream, Width);
|
||||||
WriteUInt32(stream, Height);
|
// WriteUInt32(stream, Height);
|
||||||
stream.Write(PixelData);
|
// stream.Write(PixelData);
|
||||||
}
|
//}
|
||||||
|
|
||||||
private static string ReadString(Stream stream, int length) => new(Enumerable.Range(0, length).Select(_ => (char)stream.ReadByte()).ToArray());
|
//private static string ReadString(Stream stream, int length) => new(Enumerable.Range(0, length).Select(_ => (char)stream.ReadByte()).ToArray());
|
||||||
private static uint ReadUInt32(Stream stream) => (uint)(((stream.ReadByte() & 0xFF) << 24) | ((stream.ReadByte() & 0xFF) << 16) | ((stream.ReadByte() & 0xFF) << 8) | ((stream.ReadByte() & 0xFF) << 0));
|
//private static uint ReadUInt32(Stream stream) => (uint)(((stream.ReadByte() & 0xFF) << 24) | ((stream.ReadByte() & 0xFF) << 16) | ((stream.ReadByte() & 0xFF) << 8) | ((stream.ReadByte() & 0xFF) << 0));
|
||||||
|
|
||||||
private static void WriteString(Stream stream, string str) => Array.ForEach(str.ToCharArray(), (x) => stream.WriteByte((byte)x));
|
//private static void WriteString(Stream stream, string str) => Array.ForEach(str.ToCharArray(), (x) => stream.WriteByte((byte)x));
|
||||||
private static void WriteUInt32(Stream stream, uint val) { stream.WriteByte((byte)((val >> 24) & 0xFF)); stream.WriteByte((byte)((val >> 16) & 0xFF)); stream.WriteByte((byte)((val >> 8) & 0xFF)); stream.WriteByte((byte)((val >> 0) & 0xFF)); }
|
//private static void WriteUInt32(Stream stream, uint val) { stream.WriteByte((byte)((val >> 24) & 0xFF)); stream.WriteByte((byte)((val >> 16) & 0xFF)); stream.WriteByte((byte)((val >> 8) & 0xFF)); stream.WriteByte((byte)((val >> 0) & 0xFF)); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace StoicGoose.Common.Utilities
|
namespace StoicGoose.Common.Utilities
|
||||||
{
|
{
|
||||||
@ -32,37 +31,37 @@ namespace StoicGoose.Common.Utilities
|
|||||||
if ((segmentStart + segmentLength) > dataLength) throw new Exception("Segment end offset is greater than total length");
|
if ((segmentStart + segmentLength) > dataLength) throw new Exception("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);
|
||||||
|
|
||||||
var lastStreamPosition = stream.Position;
|
// var lastStreamPosition = stream.Position;
|
||||||
var data = new byte[length];
|
// var data = new byte[length];
|
||||||
stream.Position = start;
|
// stream.Position = start;
|
||||||
stream.Read(data, 0, length);
|
// stream.Read(data, 0, length);
|
||||||
var crc = Calculate(data, 0, data.Length);
|
// var 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)
|
||||||
{
|
{
|
||||||
|
@ -1,41 +1,40 @@
|
|||||||
using System.IO;
|
//using System.Reflection;
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
using StoicGoose.Common.Drawing;
|
//using StoicGoose.Common.Drawing;
|
||||||
|
|
||||||
namespace StoicGoose.Common.Utilities
|
//namespace StoicGoose.Common.Utilities
|
||||||
{
|
//{
|
||||||
public static class Resources
|
// public static class Resources
|
||||||
{
|
// {
|
||||||
private static Stream GetEmbeddedResourceStream(string name)
|
// //private static System.IO.Stream GetEmbeddedResourceStream(string name)
|
||||||
{
|
// //{
|
||||||
var assembly = Assembly.GetEntryAssembly();
|
// // var assembly = Assembly.GetEntryAssembly();
|
||||||
name = $"{assembly.GetName().Name}.{name}";
|
// // name = $"{assembly.GetName().Name}.{name}";
|
||||||
return assembly.GetManifestResourceStream(name);
|
// // return assembly.GetManifestResourceStream(name);
|
||||||
}
|
// //}
|
||||||
|
|
||||||
public static RgbaFile GetEmbeddedRgbaFile(string name)
|
// //public static RgbaFile GetEmbeddedRgbaFile(string name)
|
||||||
{
|
// //{
|
||||||
using var stream = GetEmbeddedResourceStream(name);
|
// // using var stream = GetEmbeddedResourceStream(name);
|
||||||
if (stream == null) return null;
|
// // if (stream == null) return null;
|
||||||
return new RgbaFile(stream);
|
// // return new RgbaFile(stream);
|
||||||
}
|
// //}
|
||||||
|
|
||||||
public static string GetEmbeddedText(string name)
|
// //public static string GetEmbeddedText(string name)
|
||||||
{
|
// //{
|
||||||
using var stream = GetEmbeddedResourceStream(name);
|
// // using var stream = GetEmbeddedResourceStream(name);
|
||||||
if (stream == null) return string.Empty;
|
// // if (stream == null) return string.Empty;
|
||||||
using var reader = new StreamReader(stream);
|
// // using var reader = new StreamReader(stream);
|
||||||
return reader.ReadToEnd();
|
// // return reader.ReadToEnd();
|
||||||
}
|
// //}
|
||||||
|
|
||||||
public static byte[] GetEmbeddedRawData(string name)
|
// //public static byte[] GetEmbeddedRawData(string name)
|
||||||
{
|
// //{
|
||||||
using var stream = GetEmbeddedResourceStream(name);
|
// // using var stream = GetEmbeddedResourceStream(name);
|
||||||
if (stream == null) return null;
|
// // if (stream == null) return null;
|
||||||
var buffer = new byte[stream.Length];
|
// // var buffer = new byte[stream.Length];
|
||||||
stream.Read(buffer, 0, buffer.Length);
|
// // stream.Read(buffer, 0, buffer.Length);
|
||||||
return buffer;
|
// // return buffer;
|
||||||
}
|
// //}
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,6 @@ using AxibugProtobuf;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static AxibugEmuOnline.Client.HttpAPI;
|
using static AxibugEmuOnline.Client.HttpAPI;
|
||||||
@ -56,9 +55,12 @@ namespace AxibugEmuOnline.Client.ClientCore
|
|||||||
static string s_persistentRoot =
|
static string s_persistentRoot =
|
||||||
#if UNITY_PSP2 && !UNITY_EDITOR //PSV真机
|
#if UNITY_PSP2 && !UNITY_EDITOR //PSV真机
|
||||||
"ux0:data/AxibugEmu";
|
"ux0:data/AxibugEmu";
|
||||||
|
#elif UNITY_SWITCH && !UNITY_EDITOR //Switch 真机
|
||||||
|
$"save:/AxibugEmu";
|
||||||
#else
|
#else
|
||||||
Application.persistentDataPath;
|
Application.persistentDataPath;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public static string PersistentDataPath(RomPlatformType emuPlatform)
|
public static string PersistentDataPath(RomPlatformType emuPlatform)
|
||||||
{
|
{
|
||||||
return s_persistentRoot + "/" + emuPlatform.ToString();
|
return s_persistentRoot + "/" + emuPlatform.ToString();
|
||||||
@ -130,8 +132,10 @@ namespace AxibugEmuOnline.Client.ClientCore
|
|||||||
private static void PSP2Init()
|
private static void PSP2Init()
|
||||||
{
|
{
|
||||||
//PSVita最好手动创建目录
|
//PSVita最好手动创建目录
|
||||||
if (!Directory.Exists("ux0:data/AxibugEmu"))
|
if (!AxiIO.Directory.Exists("ux0:data/AxibugEmu"))
|
||||||
Directory.CreateDirectory("ux0:data/AxibugEmu");
|
AxiIO.Directory.CreateDirectory("ux0:data/AxibugEmu");
|
||||||
|
//if (!Directory.Exists("ux0:data/AxibugEmu"))
|
||||||
|
// Directory.CreateDirectory("ux0:data/AxibugEmu");
|
||||||
|
|
||||||
#if UNITY_PSP2
|
#if UNITY_PSP2
|
||||||
//创建PSV弹窗UI
|
//创建PSV弹窗UI
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO.Compression;
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Security;
|
using System.Net.Security;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
@ -162,7 +161,7 @@ public static class AxiHttp
|
|||||||
public string fileName;
|
public string fileName;
|
||||||
public float DownLoadPr =>
|
public float DownLoadPr =>
|
||||||
NeedloadedLenght <= 0 ? -1 : (float)loadedLenght / NeedloadedLenght;
|
NeedloadedLenght <= 0 ? -1 : (float)loadedLenght / NeedloadedLenght;
|
||||||
public BinaryWriter binaryWriter;
|
public System.IO.BinaryWriter binaryWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPAddress GetDnsIP(string str)
|
public static IPAddress GetDnsIP(string str)
|
||||||
@ -268,7 +267,7 @@ public static class AxiHttp
|
|||||||
var ipEndPoint = new IPEndPoint(ip, port);
|
var ipEndPoint = new IPEndPoint(ip, port);
|
||||||
|
|
||||||
using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
|
using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
|
||||||
using (MemoryStream memoryStream = new MemoryStream())
|
using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
|
||||||
{
|
{
|
||||||
client.Connect(ipEndPoint);
|
client.Connect(ipEndPoint);
|
||||||
if (!client.Connected)
|
if (!client.Connected)
|
||||||
@ -497,7 +496,7 @@ public static class AxiHttp
|
|||||||
|
|
||||||
// 使用Uri类解析URL
|
// 使用Uri类解析URL
|
||||||
Uri uri = new Uri(url);
|
Uri uri = new Uri(url);
|
||||||
respinfo.fileName = Path.GetFileName(uri.LocalPath);
|
respinfo.fileName = System.IO.Path.GetFileName(uri.LocalPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -567,7 +566,7 @@ public static class AxiHttp
|
|||||||
|
|
||||||
//using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
|
//using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
|
||||||
//using (TcpClient tcpclient = new TcpClient())
|
//using (TcpClient tcpclient = new TcpClient())
|
||||||
using (MemoryStream memoryStream = new MemoryStream())
|
using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
|
||||||
{
|
{
|
||||||
//client.Connect(ipEndPoint);
|
//client.Connect(ipEndPoint);
|
||||||
|
|
||||||
@ -780,7 +779,7 @@ public static class AxiHttp
|
|||||||
|
|
||||||
// 使用Uri类解析URL
|
// 使用Uri类解析URL
|
||||||
Uri uri = new Uri(url);
|
Uri uri = new Uri(url);
|
||||||
respinfo.fileName = Path.GetFileName(uri.LocalPath);
|
respinfo.fileName = System.IO.Path.GetFileName(uri.LocalPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -865,9 +864,9 @@ public static class AxiHttp
|
|||||||
{
|
{
|
||||||
|
|
||||||
string str = "";
|
string str = "";
|
||||||
MemoryStream ms = new MemoryStream(data, 0, len);
|
System.IO.MemoryStream ms = new System.IO.MemoryStream(data, 0, len);
|
||||||
GZipStream gs = new GZipStream(ms, CompressionMode.Decompress);
|
GZipStream gs = new GZipStream(ms, CompressionMode.Decompress);
|
||||||
MemoryStream outbuf = new MemoryStream();
|
System.IO.MemoryStream outbuf = new System.IO.MemoryStream();
|
||||||
byte[] block = new byte[1024];
|
byte[] block = new byte[1024];
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -904,9 +903,9 @@ public static class AxiHttp
|
|||||||
|
|
||||||
public static byte[] unGzipBytes(byte[] data, int len)
|
public static byte[] unGzipBytes(byte[] data, int len)
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream(data, 0, len);
|
System.IO.MemoryStream ms = new System.IO.MemoryStream(data, 0, len);
|
||||||
GZipStream gs = new GZipStream(ms, CompressionMode.Decompress);
|
GZipStream gs = new GZipStream(ms, CompressionMode.Decompress);
|
||||||
MemoryStream outbuf = new MemoryStream();
|
System.IO.MemoryStream outbuf = new System.IO.MemoryStream();
|
||||||
byte[] block = new byte[1024];
|
byte[] block = new byte[1024];
|
||||||
byte[] result;
|
byte[] result;
|
||||||
try
|
try
|
||||||
|
8
AxibugEmuOnline.Client/Assets/Script/AppMain/AxiIO.meta
Normal file
8
AxibugEmuOnline.Client/Assets/Script/AppMain/AxiIO.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 83041af3f896cdd428dd120d39becacf
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
89
AxibugEmuOnline.Client/Assets/Script/AppMain/AxiIO/AxiIO.cs
Normal file
89
AxibugEmuOnline.Client/Assets/Script/AppMain/AxiIO/AxiIO.cs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AxiIO
|
||||||
|
{
|
||||||
|
|
||||||
|
public static class AxiIO
|
||||||
|
{
|
||||||
|
static IAxiIO m_io;
|
||||||
|
public static IAxiIO io
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_io == null)
|
||||||
|
{
|
||||||
|
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||||
|
m_io = new NSwitchIO();
|
||||||
|
#else
|
||||||
|
m_io = new CSharpIO();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return m_io;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class File
|
||||||
|
{
|
||||||
|
internal static void Delete(string filePath)
|
||||||
|
{
|
||||||
|
AxiIO.io.file_Delete(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static bool Exists(string filePath)
|
||||||
|
{
|
||||||
|
return AxiIO.io.file_Exists(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static byte[] ReadAllBytes(string filePath)
|
||||||
|
{
|
||||||
|
return AxiIO.io.file_ReadAllBytes(filePath);
|
||||||
|
}
|
||||||
|
internal static int ReadBytesToArr(string filePath, byte[] readToArr, int start, int len)
|
||||||
|
{
|
||||||
|
return AxiIO.io.file_ReadBytesToArr(filePath, readToArr, start, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void WriteAllBytes(string path, byte[] data)
|
||||||
|
{
|
||||||
|
AxiIO.io.file_WriteAllBytes(path, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void WriteAllBytesFromStream(string path, System.IO.MemoryStream ms)
|
||||||
|
{
|
||||||
|
AxiIO.io.file_WriteAllBytes(path, ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Directory
|
||||||
|
{
|
||||||
|
public static bool Exists(string dirpath)
|
||||||
|
{
|
||||||
|
return AxiIO.io.dir_Exists(dirpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CreateDirectory(string dirpath)
|
||||||
|
{
|
||||||
|
AxiIO.io.dir_CreateDirectory(dirpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<string> EnumerateFiles(string path, string searchPattern)
|
||||||
|
{
|
||||||
|
return AxiIO.io.dir_EnumerateFiles(path, searchPattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string[] GetDirectories(string path)
|
||||||
|
{
|
||||||
|
return AxiIO.io.dir_GetDirectories(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string[] GetFiles(string path)
|
||||||
|
{
|
||||||
|
return AxiIO.io.dir_GetFiles(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void Delete(string cacheDirPath, bool v)
|
||||||
|
{
|
||||||
|
AxiIO.io.dir_Delete(cacheDirPath, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 32f63f62398d8184590292135b011084
|
@ -0,0 +1,70 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace AxiIO
|
||||||
|
{
|
||||||
|
public class CSharpIO : IAxiIO
|
||||||
|
{
|
||||||
|
public void dir_CreateDirectory(string dirpath)
|
||||||
|
{
|
||||||
|
System.IO.Directory.CreateDirectory(dirpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dir_Delete(string path, bool recursive)
|
||||||
|
{
|
||||||
|
System.IO.Directory.Delete(path, recursive);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> dir_EnumerateFiles(string path, string searchPattern)
|
||||||
|
{
|
||||||
|
return System.IO.Directory.EnumerateFiles(path, searchPattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool dir_Exists(string dirpath)
|
||||||
|
{
|
||||||
|
return System.IO.Directory.Exists(dirpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void file_WriteAllBytes(string filePath, byte[] data)
|
||||||
|
{
|
||||||
|
System.IO.File.WriteAllBytes(filePath, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void file_WriteAllBytes(string filePath, MemoryStream ms)
|
||||||
|
{
|
||||||
|
System.IO.File.WriteAllBytes(filePath, ms.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void file_Delete(string filePath)
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool file_Exists(string filePath)
|
||||||
|
{
|
||||||
|
return System.IO.File.Exists(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] file_ReadAllBytes(string filePath)
|
||||||
|
{
|
||||||
|
return System.IO.File.ReadAllBytes(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int file_ReadBytesToArr(string filePath, byte[] readToArr, int start, int len)
|
||||||
|
{
|
||||||
|
FileStream streaming = System.IO.File.OpenRead(filePath);
|
||||||
|
return streaming.Read(readToArr, 0, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] dir_GetDirectories(string path)
|
||||||
|
{
|
||||||
|
return System.IO.Directory.GetDirectories(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] dir_GetFiles(string path)
|
||||||
|
{
|
||||||
|
return System.IO.Directory.GetFiles(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f01df62ce36a4da4f9a20b4758d59102
|
21
AxibugEmuOnline.Client/Assets/Script/AppMain/AxiIO/IAxiIO.cs
Normal file
21
AxibugEmuOnline.Client/Assets/Script/AppMain/AxiIO/IAxiIO.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AxiIO
|
||||||
|
{
|
||||||
|
public interface IAxiIO
|
||||||
|
{
|
||||||
|
bool dir_Exists(string dirpath);
|
||||||
|
void dir_CreateDirectory(string dirpath);
|
||||||
|
IEnumerable<string> dir_EnumerateFiles(string path, string searchPattern);
|
||||||
|
void dir_Delete(string path, bool recursive);
|
||||||
|
byte[] file_ReadAllBytes(string filePath);
|
||||||
|
bool file_Exists(string filePath);
|
||||||
|
void file_Delete(string filePath);
|
||||||
|
void file_WriteAllBytes(string filePath, byte[] data);
|
||||||
|
void file_WriteAllBytes(string filePath, System.IO.MemoryStream ms);
|
||||||
|
int file_ReadBytesToArr(string filePath, byte[] readToArr, int start, int len);
|
||||||
|
string[] dir_GetDirectories(string path);
|
||||||
|
string[] dir_GetFiles(string path);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 588eae2a7e121cc40907d8ac6f4250d4
|
@ -0,0 +1,83 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AxiIO
|
||||||
|
{
|
||||||
|
public class NSwitchIO : IAxiIO
|
||||||
|
{
|
||||||
|
public NSwitchIO()
|
||||||
|
{
|
||||||
|
AxiNS.instance.Init();
|
||||||
|
}
|
||||||
|
public void dir_CreateDirectory(string dirpath)
|
||||||
|
{
|
||||||
|
AxiNS.instance.io.CreateDir(dirpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dir_Delete(string path, bool recursive)
|
||||||
|
{
|
||||||
|
AxiNS.instance.io.DeletePathFile(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> dir_EnumerateFiles(string path, string searchPattern)
|
||||||
|
{
|
||||||
|
return AxiNS.instance.io.EnumerateFiles(path, searchPattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool dir_Exists(string dirpath)
|
||||||
|
{
|
||||||
|
return AxiNS.instance.io.CheckPathExists(dirpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] dir_GetDirectories(string path)
|
||||||
|
{
|
||||||
|
if (!AxiNS.instance.io.GetDirectoryDirs(path, out string[] result))
|
||||||
|
{
|
||||||
|
return new string[0];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] dir_GetFiles(string path)
|
||||||
|
{
|
||||||
|
if (!AxiNS.instance.io.GetDirectoryFiles(path, out string[] result))
|
||||||
|
{
|
||||||
|
return new string[0];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void file_Delete(string filePath)
|
||||||
|
{
|
||||||
|
AxiNS.instance.io.DeletePathFile(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool file_Exists(string filePath)
|
||||||
|
{
|
||||||
|
return AxiNS.instance.io.CheckPathExists(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] file_ReadAllBytes(string filePath)
|
||||||
|
{
|
||||||
|
return AxiNS.instance.io.LoadSwitchDataFile(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int file_ReadBytesToArr(string filePath, byte[] readToArr, int start, int len)
|
||||||
|
{
|
||||||
|
byte[] bytes = file_ReadAllBytes(filePath);
|
||||||
|
int templen = Math.Min(len, bytes.Length);
|
||||||
|
Array.Copy(readToArr, readToArr, len);
|
||||||
|
return templen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void file_WriteAllBytes(string filePath, byte[] data)
|
||||||
|
{
|
||||||
|
AxiNS.instance.io.FileToSaveWithCreate(filePath, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void file_WriteAllBytes(string filePath, System.IO.MemoryStream ms)
|
||||||
|
{
|
||||||
|
AxiNS.instance.io.FileToSaveWithCreate(filePath, ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3da9b14bf7568f34989774dc5f5fbcf4
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"name": "AxibugEmuOnline.Client",
|
"name": "AxibugEmuOnline.Client",
|
||||||
"rootNamespace": "",
|
"rootNamespace": "",
|
||||||
"references": [
|
"references": [
|
||||||
@ -7,8 +7,9 @@
|
|||||||
"UIEffect2018",
|
"UIEffect2018",
|
||||||
"Mame.Core",
|
"Mame.Core",
|
||||||
"Essgee.Unity",
|
"Essgee.Unity",
|
||||||
"StoicGooseUnity",
|
"StoicGooseUnity",
|
||||||
"Unity.InputSystem"
|
"Unity.InputSystem",
|
||||||
|
"AxiNSApi"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
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.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -26,7 +25,7 @@ namespace AxibugEmuOnline.Client.Common
|
|||||||
|
|
||||||
public static byte[] CompressByteArray(byte[] bytesToCompress)
|
public static byte[] CompressByteArray(byte[] bytesToCompress)
|
||||||
{
|
{
|
||||||
using (var compressedMemoryStream = new MemoryStream())
|
using (var compressedMemoryStream = new System.IO.MemoryStream())
|
||||||
using (var gzipStream = new GZipStream(compressedMemoryStream, CompressionMode.Compress))
|
using (var gzipStream = new GZipStream(compressedMemoryStream, CompressionMode.Compress))
|
||||||
{
|
{
|
||||||
gzipStream.Write(bytesToCompress, 0, bytesToCompress.Length);
|
gzipStream.Write(bytesToCompress, 0, bytesToCompress.Length);
|
||||||
@ -37,35 +36,35 @@ namespace AxibugEmuOnline.Client.Common
|
|||||||
|
|
||||||
public static byte[] DecompressByteArray(byte[] compressedBytes)
|
public static byte[] DecompressByteArray(byte[] compressedBytes)
|
||||||
{
|
{
|
||||||
using (var compressedMemoryStream = new MemoryStream(compressedBytes))
|
using (var compressedMemoryStream = new System.IO.MemoryStream(compressedBytes))
|
||||||
using (var gzipStream = new GZipStream(compressedMemoryStream, CompressionMode.Decompress))
|
using (var gzipStream = new GZipStream(compressedMemoryStream, CompressionMode.Decompress))
|
||||||
using (var resultMemoryStream = new MemoryStream())
|
using (var resultMemoryStream = new System.IO.MemoryStream())
|
||||||
{
|
{
|
||||||
gzipStream.CopyTo(resultMemoryStream);
|
gzipStream.CopyTo(resultMemoryStream);
|
||||||
return resultMemoryStream.ToArray();
|
return resultMemoryStream.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FileMD5Hash(string filePath)
|
//public static string FileMD5Hash(string filePath)
|
||||||
{
|
//{
|
||||||
using (var md5 = MD5.Create())
|
// using (var md5 = MD5.Create())
|
||||||
{
|
// {
|
||||||
using (var stream = File.OpenRead(filePath))
|
// using (var stream = File.OpenRead(filePath))
|
||||||
{
|
// {
|
||||||
var hash = md5.ComputeHash(stream);
|
// var hash = md5.ComputeHash(stream);
|
||||||
var sb = new StringBuilder(hash.Length * 2);
|
// var sb = new StringBuilder(hash.Length * 2);
|
||||||
foreach (var b in hash)
|
// foreach (var b in hash)
|
||||||
sb.AppendFormat("{0:x2}", b);
|
// sb.AppendFormat("{0:x2}", b);
|
||||||
return sb.ToString();
|
// return sb.ToString();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
static byte[] FileMD5HashByte(byte[] data)
|
static byte[] FileMD5HashByte(byte[] data)
|
||||||
{
|
{
|
||||||
using (var md5 = MD5.Create())
|
using (var md5 = MD5.Create())
|
||||||
{
|
{
|
||||||
using (var stream = new MemoryStream(data))
|
using (var stream = new System.IO.MemoryStream(data))
|
||||||
{
|
{
|
||||||
return md5.ComputeHash(stream);
|
return md5.ComputeHash(stream);
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
Essgee.Emulation.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");
|
||||||
@ -189,29 +192,29 @@ public class UEssgee : MonoBehaviour, IEmuCore
|
|||||||
EmuStandInfo.ProductName = "AxibugEmu";
|
EmuStandInfo.ProductName = "AxibugEmu";
|
||||||
EmuStandInfo.ProductVersion = "";
|
EmuStandInfo.ProductVersion = "";
|
||||||
|
|
||||||
EmuStandInfo.programDataDirectory = Path.Combine(CustonDataDir, EmuStandInfo.ProductName);
|
EmuStandInfo.programDataDirectory = System.IO.Path.Combine(CustonDataDir, EmuStandInfo.ProductName);
|
||||||
EmuStandInfo.programConfigPath = Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.jsonConfigFileName);
|
EmuStandInfo.programConfigPath = System.IO.Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.jsonConfigFileName);
|
||||||
|
|
||||||
EmuStandInfo.ShaderPath = Path.Combine(CustonDataDir, "Assets", "Shaders");
|
EmuStandInfo.ShaderPath = System.IO.Path.Combine(CustonDataDir, "Assets", "Shaders");
|
||||||
EmuStandInfo.SaveDataPath = Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.saveDataDirectoryName);
|
EmuStandInfo.SaveDataPath = System.IO.Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.saveDataDirectoryName);
|
||||||
EmuStandInfo.ScreenshotPath = Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.screenshotDirectoryName);
|
EmuStandInfo.ScreenshotPath = System.IO.Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.screenshotDirectoryName);
|
||||||
EmuStandInfo.SaveStatePath = Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.saveStateDirectoryName);
|
EmuStandInfo.SaveStatePath = System.IO.Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.saveStateDirectoryName);
|
||||||
EmuStandInfo.ExtraDataPath = Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.extraDataDirectoryName);
|
EmuStandInfo.ExtraDataPath = System.IO.Path.Combine(EmuStandInfo.programDataDirectory, EmuStandInfo.extraDataDirectoryName);
|
||||||
|
|
||||||
LoadConfiguration();
|
LoadConfiguration();
|
||||||
|
|
||||||
|
|
||||||
if (!Directory.Exists(EmuStandInfo.SaveDataPath))
|
if (!AxiIO.Directory.Exists(EmuStandInfo.SaveDataPath))
|
||||||
Directory.CreateDirectory(EmuStandInfo.SaveDataPath);
|
AxiIO.Directory.CreateDirectory(EmuStandInfo.SaveDataPath);
|
||||||
|
|
||||||
if (!Directory.Exists(EmuStandInfo.ScreenshotPath))
|
if (!AxiIO.Directory.Exists(EmuStandInfo.ScreenshotPath))
|
||||||
Directory.CreateDirectory(EmuStandInfo.ScreenshotPath);
|
AxiIO.Directory.CreateDirectory(EmuStandInfo.ScreenshotPath);
|
||||||
|
|
||||||
if (!Directory.Exists(EmuStandInfo.SaveStatePath))
|
if (!AxiIO.Directory.Exists(EmuStandInfo.SaveStatePath))
|
||||||
Directory.CreateDirectory(EmuStandInfo.SaveStatePath);
|
AxiIO.Directory.CreateDirectory(EmuStandInfo.SaveStatePath);
|
||||||
|
|
||||||
if (!Directory.Exists(EmuStandInfo.ExtraDataPath))
|
if (!AxiIO.Directory.Exists(EmuStandInfo.ExtraDataPath))
|
||||||
Directory.CreateDirectory(EmuStandInfo.ExtraDataPath);
|
AxiIO.Directory.CreateDirectory(EmuStandInfo.ExtraDataPath);
|
||||||
|
|
||||||
if (AppEnvironment.EnableLogger)
|
if (AppEnvironment.EnableLogger)
|
||||||
{
|
{
|
||||||
@ -756,13 +759,13 @@ public class UEssgee : MonoBehaviour, IEmuCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generate filename/path */
|
/* Generate filename/path */
|
||||||
var filePrefix = $"{Path.GetFileNameWithoutExtension(lastGameMetadata.FileName)} ({e.Description}{(includeDateTime ? $" {DateTime.Now:yyyy-MM-dd HH-mm-ss})" : ")")}";
|
var filePrefix = $"{System.IO.Path.GetFileNameWithoutExtension(lastGameMetadata.FileName)} ({e.Description}{(includeDateTime ? $" {DateTime.Now:yyyy-MM-dd HH-mm-ss})" : ")")}";
|
||||||
var filePath = Path.Combine(EmuStandInfo.ExtraDataPath, $"{filePrefix}.{extension}");
|
var filePath = System.IO.Path.Combine(EmuStandInfo.ExtraDataPath, $"{filePrefix}.{extension}");
|
||||||
if (!allowOverwrite)
|
if (!allowOverwrite)
|
||||||
{
|
{
|
||||||
var existingFiles = Directory.EnumerateFiles(EmuStandInfo.ExtraDataPath, $"{filePrefix}*{extension}");
|
var existingFiles = AxiIO.Directory.EnumerateFiles(EmuStandInfo.ExtraDataPath, $"{filePrefix}*{extension}");
|
||||||
if (existingFiles.Contains(filePath))
|
if (existingFiles.Contains(filePath))
|
||||||
for (int i = 2; existingFiles.Contains(filePath = Path.Combine(EmuStandInfo.ExtraDataPath, $"{filePrefix} ({i}).{extension}")); i++) { }
|
for (int i = 2; existingFiles.Contains(filePath = System.IO.Path.Combine(EmuStandInfo.ExtraDataPath, $"{filePrefix} ({i}).{extension}")); i++) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle data */
|
/* Handle data */
|
||||||
@ -777,10 +780,12 @@ public class UEssgee : MonoBehaviour, IEmuCore
|
|||||||
else if (e.Data is byte[] raw)
|
else if (e.Data is byte[] raw)
|
||||||
{
|
{
|
||||||
/* Raw bytes */
|
/* Raw bytes */
|
||||||
using (var file = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
|
//using (var file = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
|
||||||
{
|
//{
|
||||||
file.Write(raw, 0, raw.Length);
|
// file.Write(raw, 0, raw.Length);
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
AxiIO.File.WriteAllBytes(filePath, raw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
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_WriteAllBytes(string savePath, byte[] data)
|
||||||
|
{
|
||||||
|
AxiIO.File.WriteAllBytes(savePath, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void File_WriteAllBytesFromStre(string path, MemoryStream ms)
|
||||||
|
{
|
||||||
|
AxiIO.File.WriteAllBytesFromStream(path, ms);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2d1eadaf2f90ca44b9732206158f7599
|
@ -1,9 +1,6 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class UEGSoundPlayer : MonoBehaviour
|
public class UEGSoundPlayer : MonoBehaviour
|
||||||
|
@ -5,7 +5,6 @@ using AxiReplay;
|
|||||||
using MAME.Core;
|
using MAME.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -21,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;
|
||||||
@ -54,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()
|
||||||
{
|
{
|
||||||
@ -197,11 +198,11 @@ public class UMAME : MonoBehaviour, IEmuCore
|
|||||||
}
|
}
|
||||||
byte[] SaveState()
|
byte[] SaveState()
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(SavePath))
|
if (!AxiIO.Directory.Exists(SavePath))
|
||||||
Directory.CreateDirectory(SavePath);
|
AxiIO.Directory.CreateDirectory(SavePath);
|
||||||
|
|
||||||
MemoryStream ms = new MemoryStream();
|
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||||
BinaryWriter bw = new BinaryWriter(ms);
|
System.IO.BinaryWriter bw = new System.IO.BinaryWriter(ms);
|
||||||
emu.SaveState(bw);
|
emu.SaveState(bw);
|
||||||
byte[] data = ms.ToArray();
|
byte[] data = ms.ToArray();
|
||||||
bw.Close();
|
bw.Close();
|
||||||
@ -218,8 +219,8 @@ public class UMAME : MonoBehaviour, IEmuCore
|
|||||||
}
|
}
|
||||||
void LoadState(byte[] data)
|
void LoadState(byte[] data)
|
||||||
{
|
{
|
||||||
MemoryStream fs = new MemoryStream(data);
|
System.IO.MemoryStream fs = new System.IO.MemoryStream(data);
|
||||||
BinaryReader br = new BinaryReader(fs);
|
System.IO.BinaryReader br = new System.IO.BinaryReader(fs);
|
||||||
emu.LoadState(br);
|
emu.LoadState(br);
|
||||||
br.Close();
|
br.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
using MAME.Core;
|
||||||
|
|
||||||
|
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, System.IO.MemoryStream ms)
|
||||||
|
{
|
||||||
|
AxiIO.File.WriteAllBytesFromStream(path, ms);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0bde9793324600e4da84ead00e1e9111
|
@ -2,7 +2,6 @@
|
|||||||
using AxibugProtobuf;
|
using AxibugProtobuf;
|
||||||
using AxiReplay;
|
using AxiReplay;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VirtualNes.Core;
|
using VirtualNes.Core;
|
||||||
@ -17,14 +16,14 @@ namespace AxibugEmuOnline.Client
|
|||||||
m_controllerMapper = conMapper;
|
m_controllerMapper = conMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream OpenRom(string fname)
|
public System.IO.Stream OpenRom(string fname)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var romFile = App.GetRomLib(RomPlatformType.Nes).GetRomFile(fname);
|
var romFile = App.GetRomLib(RomPlatformType.Nes).GetRomFile(fname);
|
||||||
var bytes = romFile.GetRomFileData();
|
var bytes = romFile.GetRomFileData();
|
||||||
Debug.Log($"Open {romFile.Alias}");
|
Debug.Log($"Open {romFile.Alias}");
|
||||||
return new MemoryStream(bytes);
|
return new System.IO.MemoryStream(bytes);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -39,34 +38,34 @@ namespace AxibugEmuOnline.Client
|
|||||||
UnityEngine.Debug.Assert(romFile != null);
|
UnityEngine.Debug.Assert(romFile != null);
|
||||||
|
|
||||||
fullPath = romFile.LocalFilePath;
|
fullPath = romFile.LocalFilePath;
|
||||||
directPath = Path.GetDirectoryName(fullPath);
|
directPath = System.IO.Path.GetDirectoryName(fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream OpenFile_DISKSYS()
|
public System.IO.Stream OpenFile_DISKSYS()
|
||||||
{
|
{
|
||||||
return new MemoryStream(Resources.Load<TextAsset>("NES/Disksys.rom").bytes);
|
return new System.IO.MemoryStream(Resources.Load<TextAsset>("NES/Disksys.rom").bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveSRAMToFile(byte[] sramContent, string romName)
|
public void SaveSRAMToFile(byte[] sramContent, string romName)
|
||||||
{
|
{
|
||||||
string sramDirectoryPath = $"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/{Config.path.szSavePath}";
|
string sramDirectoryPath = $"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/{Config.path.szSavePath}";
|
||||||
Directory.CreateDirectory(sramDirectoryPath);
|
AxiIO.Directory.CreateDirectory(sramDirectoryPath);
|
||||||
romName = Path.GetFileNameWithoutExtension(romName);
|
romName = System.IO.Path.GetFileNameWithoutExtension(romName);
|
||||||
File.WriteAllBytes($"{sramDirectoryPath}/{romName}.sav", sramContent);
|
AxiIO.File.WriteAllBytes($"{sramDirectoryPath}/{romName}.sav", sramContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveDISKToFile(byte[] diskFileContent, string romName)
|
public void SaveDISKToFile(byte[] diskFileContent, string romName)
|
||||||
{
|
{
|
||||||
string diskFileDirectoryPath = $"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/dsv";
|
string diskFileDirectoryPath = $"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/dsv";
|
||||||
Directory.CreateDirectory(diskFileDirectoryPath);
|
AxiIO.Directory.CreateDirectory(diskFileDirectoryPath);
|
||||||
romName = Path.GetFileNameWithoutExtension(romName);
|
romName = System.IO.Path.GetFileNameWithoutExtension(romName);
|
||||||
File.WriteAllBytes($"{diskFileDirectoryPath}/{romName}.dsv", diskFileContent);
|
AxiIO.File.WriteAllBytes($"{diskFileDirectoryPath}/{romName}.dsv", diskFileContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmulatorConfig Config { get; private set; } = new EmulatorConfig();
|
public EmulatorConfig Config { get; private set; } = new EmulatorConfig();
|
||||||
public void PrepareDirectory(string directPath)
|
public void PrepareDirectory(string directPath)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory($"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/{directPath}");
|
AxiIO.Directory.CreateDirectory($"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/{directPath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveFile(byte[] fileData, string directPath, string fileName)
|
public void SaveFile(byte[] fileData, string directPath, string fileName)
|
||||||
@ -74,17 +73,17 @@ namespace AxibugEmuOnline.Client
|
|||||||
PrepareDirectory(directPath);
|
PrepareDirectory(directPath);
|
||||||
|
|
||||||
var fileFullpath = $"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/{directPath}/{fileName}";
|
var fileFullpath = $"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/{directPath}/{fileName}";
|
||||||
File.WriteAllBytes(fileFullpath, fileData);
|
AxiIO.File.WriteAllBytes(fileFullpath, fileData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream OpenFile(string directPath, string fileName)
|
public System.IO.Stream OpenFile(string directPath, string fileName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var path = $"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/{directPath}/{fileName}";
|
var path = $"{App.PersistentDataPath(AxibugProtobuf.RomPlatformType.Nes)}/{directPath}/{fileName}";
|
||||||
var data = File.ReadAllBytes(path);
|
var data = AxiIO.File.ReadAllBytes(path);
|
||||||
if (data == null) return null;
|
if (data == null) return null;
|
||||||
return new MemoryStream(data);
|
return new System.IO.MemoryStream(data);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user