Compare commits
3 Commits
37fad1c6a0
...
b85f2ddbbd
| Author | SHA1 | Date | |
|---|---|---|---|
| b85f2ddbbd | |||
| 8669c7a613 | |||
| 2e5827f212 |
@ -24,21 +24,17 @@ public class AxiNSIO
|
||||
{
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
|
||||
// 阻止用户在保存时,退出游戏 Switch 条例 0080
|
||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
||||
using (AxiNSIOKeepingDisposable.Acquire())
|
||||
{
|
||||
nn.Result ret = FileSystem.Commit(save_name);
|
||||
|
||||
if (!ret.IsSuccess())
|
||||
{
|
||||
UnityEngine.Debug.LogError($"FileSystem.Commit({save_name}) 失败: " + ret.GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
// 停止阻止用户退出游戏
|
||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||
|
||||
bDirty = false;
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@ -162,11 +158,15 @@ public class AxiNSIO
|
||||
public bool FileToSaveWithCreate(string filePath, byte[] data, bool immediatelyCommit = true)
|
||||
{
|
||||
UnityEngine.Debug.Log($"FileToSaveWithCreate: {filePath}");
|
||||
lock (commitLock)
|
||||
{
|
||||
|
||||
#if !UNITY_SWITCH
|
||||
return false;
|
||||
#else
|
||||
lock (commitLock)
|
||||
{
|
||||
using (AxiNSIOKeepingDisposable.Acquire())
|
||||
{
|
||||
|
||||
if (!AxiNS.instance.mount.SaveIsMount)
|
||||
{
|
||||
UnityEngine.Debug.LogError($"Save 尚未挂载,无法存储 {filePath}");
|
||||
@ -202,39 +202,6 @@ public class AxiNSIO
|
||||
}
|
||||
}
|
||||
|
||||
//string directoryPath = System.IO.Path.GetDirectoryName(filePath.Replace(save_path, ""));
|
||||
//string fullDirectoryPath = $"{save_path}{directoryPath}";
|
||||
//UnityEngine.Debug.Log($"检查父目录: {fullDirectoryPath}");
|
||||
|
||||
//nn.fs.EntryType entryType = 0;
|
||||
//result = nn.fs.FileSystem.GetEntryType(ref entryType, fullDirectoryPath);
|
||||
//if (!result.IsSuccess() && nn.fs.FileSystem.ResultPathNotFound.Includes(result))
|
||||
//{
|
||||
// UnityEngine.Debug.Log($"父目录 {fullDirectoryPath} 不存在,尝试创建 (判断依据 result=>{result.ToString()})");
|
||||
// result = nn.fs.Directory.Create(fullDirectoryPath);
|
||||
// if (!result.IsSuccess())
|
||||
// {
|
||||
// UnityEngine.Debug.LogError($"创建父目录失败: {result.GetErrorInfo()}");
|
||||
// return false;
|
||||
// }
|
||||
// UnityEngine.Debug.Log($"父目录 {fullDirectoryPath} 创建成功");
|
||||
//}
|
||||
//else if (result.IsSuccess() && entryType != nn.fs.EntryType.Directory)
|
||||
//{
|
||||
// UnityEngine.Debug.LogError($"路径 {fullDirectoryPath} 已存在,但不是目录");
|
||||
// return false;
|
||||
//}
|
||||
//else if (!result.IsSuccess())
|
||||
//{
|
||||
// UnityEngine.Debug.LogError($"检查父目录失败: {result.GetErrorInfo()}");
|
||||
// return false;
|
||||
//}
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// 阻止用户在保存时,退出游戏
|
||||
// Switch 条例 0080
|
||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
||||
#endif
|
||||
if (CheckPathNotFound(filePath))
|
||||
{
|
||||
UnityEngine.Debug.Log($"文件({filePath})不存在需要创建");
|
||||
@ -299,13 +266,6 @@ public class AxiNSIO
|
||||
UnityEngine.Debug.Log("写入文件成功: " + filePath);
|
||||
|
||||
nn.fs.File.Close(fileHandle);
|
||||
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// 停止阻止用户退出游戏
|
||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||
#endif
|
||||
|
||||
if (immediatelyCommit)
|
||||
{
|
||||
//必须得提交,否则没有真实写入
|
||||
@ -316,9 +276,10 @@ public class AxiNSIO
|
||||
SetCommitDirty();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存并创建文件(如果目录不存在回先自动创建目录)
|
||||
/// </summary>
|
||||
@ -531,14 +492,8 @@ public class AxiNSIO
|
||||
#if !UNITY_SWITCH
|
||||
return false;
|
||||
#else
|
||||
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// This next line prevents the user from quitting the game while saving.
|
||||
// This is required for Nintendo Switch Guideline 0080
|
||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
||||
#endif
|
||||
|
||||
using (AxiNSIOKeepingDisposable.Acquire())
|
||||
{
|
||||
if (CheckPathNotFound(filename))
|
||||
return false;
|
||||
nn.Result result;
|
||||
@ -548,13 +503,8 @@ public class AxiNSIO
|
||||
UnityEngine.Debug.LogError($"nn.fs.File.Delete 失败 {filename} : result=>{result.GetErrorInfo()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// End preventing the user from quitting the game while saving.
|
||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||
#endif
|
||||
return CommitSave();
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
public AxiNSWait_DeletePathFile DeletePathFileAsync(string filename)
|
||||
@ -568,13 +518,8 @@ public class AxiNSIO
|
||||
#if !UNITY_SWITCH
|
||||
return false;
|
||||
#else
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// This next line prevents the user from quitting the game while saving.
|
||||
// This is required for Nintendo Switch Guideline 0080
|
||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
||||
#endif
|
||||
|
||||
using (AxiNSIOKeepingDisposable.Acquire())
|
||||
{
|
||||
if (CheckPathNotFound(filename))
|
||||
return false;
|
||||
nn.Result result;
|
||||
@ -584,12 +529,8 @@ public class AxiNSIO
|
||||
UnityEngine.Debug.LogError($"nn.fs.File.Delete 失败 {filename} : result=>{result.GetErrorInfo()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// End preventing the user from quitting the game while saving.
|
||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||
#endif
|
||||
return CommitSave();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
public AxiNSWait_DeletePathDir DeletePathDirAsync(string filename)
|
||||
@ -603,13 +544,8 @@ public class AxiNSIO
|
||||
#if !UNITY_SWITCH
|
||||
return false;
|
||||
#else
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// This next line prevents the user from quitting the game while saving.
|
||||
// This is required for Nintendo Switch Guideline 0080
|
||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
||||
#endif
|
||||
|
||||
using (AxiNSIOKeepingDisposable.Acquire())
|
||||
{
|
||||
if (CheckPathNotFound(filename))
|
||||
return false;
|
||||
nn.Result result;
|
||||
@ -619,12 +555,8 @@ public class AxiNSIO
|
||||
UnityEngine.Debug.LogError($"nn.fs.File.Recursively 失败 {filename} : result=>{result.GetErrorInfo()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// End preventing the user from quitting the game while saving.
|
||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||
#endif
|
||||
return CommitSave();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
public AxiNSWait_DeletePathDirRecursively DeletePathDirRecursivelyAsync(string filename)
|
||||
@ -644,13 +576,8 @@ public class AxiNSIO
|
||||
#if !UNITY_SWITCH
|
||||
return false;
|
||||
#else
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// This next line prevents the user from quitting the game while saving.
|
||||
// This is required for Nintendo Switch Guideline 0080
|
||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
||||
#endif
|
||||
|
||||
using (AxiNSIOKeepingDisposable.Acquire())
|
||||
{
|
||||
if (CheckPathNotFound(filename))
|
||||
return false;
|
||||
nn.Result result;
|
||||
@ -660,12 +587,8 @@ public class AxiNSIO
|
||||
UnityEngine.Debug.LogError($"nn.fs.File.DeleteRecursively 失败 {filename} : result=>{result.GetErrorInfo()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// End preventing the user from quitting the game while saving.
|
||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||
#endif
|
||||
return CommitSave();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -679,13 +602,8 @@ public class AxiNSIO
|
||||
#if !UNITY_SWITCH
|
||||
return false;
|
||||
#else
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// This next line prevents the user from quitting the game while saving.
|
||||
// This is required for Nintendo Switch Guideline 0080
|
||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
||||
#endif
|
||||
|
||||
using (AxiNSIOKeepingDisposable.Acquire())
|
||||
{
|
||||
if (CheckPathNotFound(filename))
|
||||
return false;
|
||||
nn.Result result;
|
||||
@ -695,12 +613,8 @@ public class AxiNSIO
|
||||
UnityEngine.Debug.LogError($"nn.fs.File.DeleteRecursively 失败 {filename} : result=>{result.GetErrorInfo()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// End preventing the user from quitting the game while saving.
|
||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||
#endif
|
||||
return CommitSave();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -709,16 +623,10 @@ public class AxiNSIO
|
||||
#if !UNITY_SWITCH
|
||||
return false;
|
||||
#else
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// This next line prevents the user from quitting the game while saving.
|
||||
// This is required for Nintendo Switch Guideline 0080
|
||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
||||
#endif
|
||||
|
||||
using (AxiNSIOKeepingDisposable.Acquire())
|
||||
{
|
||||
if (CheckPathNotFound(oldpath))
|
||||
return false;
|
||||
|
||||
nn.Result result;
|
||||
result = nn.fs.Directory.Rename(oldpath, newpath);
|
||||
if (result.IsSuccess() == false)
|
||||
@ -726,13 +634,8 @@ public class AxiNSIO
|
||||
UnityEngine.Debug.LogError($"nn.fs.File.Rename 失败 {oldpath} to {newpath} : result=>{result.GetErrorInfo()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if UNITY_SWITCH && !UNITY_EDITOR
|
||||
// End preventing the user from quitting the game while saving.
|
||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||
#endif
|
||||
return CommitSave();
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
#if UNITY_SWITCH
|
||||
using nn.fs;
|
||||
#endif
|
||||
|
||||
using System;
|
||||
|
||||
public class AxiNSIOKeepingDisposable : IDisposable
|
||||
{
|
||||
static object m_CurrLiveHandleLock = new object();
|
||||
static int m_CurrLiveHandleCounter = 0;
|
||||
static bool hadCounter { get { return m_CurrLiveHandleCounter > 0; } }
|
||||
public static AxiNSIOKeepingDisposable Acquire()
|
||||
{
|
||||
return new AxiNSIOKeepingDisposable();
|
||||
}
|
||||
static void UpdateKeepingState(bool add)
|
||||
{
|
||||
#if UNITY_SWITCH
|
||||
lock (m_CurrLiveHandleLock)
|
||||
{
|
||||
bool lasthadCounter = hadCounter;
|
||||
if (add)
|
||||
m_CurrLiveHandleCounter++;
|
||||
else
|
||||
m_CurrLiveHandleCounter--;
|
||||
|
||||
if (lasthadCounter == hadCounter)
|
||||
return;
|
||||
|
||||
if (hadCounter)
|
||||
{
|
||||
// This next line prevents the user from quitting the game while saving.
|
||||
// This is required for Nintendo Switch Guideline 0080
|
||||
// 开启:阻止用户在保存时,退出游戏 Switch 条例 0080
|
||||
UnityEngine.Switch.Notification.EnterExitRequestHandlingSection();
|
||||
UnityEngine.Debug.Log("开启:阻止用户在保存时,退出游戏 Switch 条例 0080");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 取消:阻止用户在保存时,退出游戏 Switch 条例 0080
|
||||
// End preventing the user from quitting the game while saving.
|
||||
UnityEngine.Switch.Notification.LeaveExitRequestHandlingSection();
|
||||
UnityEngine.Debug.Log("取消:阻止用户在保存时,退出游戏 Switch 条例 0080");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
private AxiNSIOKeepingDisposable()
|
||||
{
|
||||
UpdateKeepingState(true);
|
||||
}
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
UpdateKeepingState(false);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8a1c25dc774fb84fa91f4a87be0e507
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -7,7 +7,7 @@ public class AxiNSMono : MonoBehaviour
|
||||
float waittime;
|
||||
float lastinvokeTime;
|
||||
|
||||
public static void SetInvoke(Action _act, int _waitsec)
|
||||
public static void SetInvokeLoop(Action _act, int _waitsec)
|
||||
{
|
||||
GameObject gobj = GameObject.Find($"[{nameof(AxiNSMono)}]");
|
||||
if (gobj == null)
|
||||
|
||||
@ -49,7 +49,7 @@ public class AxiNSWaitHandle
|
||||
static void InitMonoInit()
|
||||
{
|
||||
if (bMonoInit) return;
|
||||
AxiNSMono.SetInvoke(Do,15);
|
||||
AxiNSMono.SetInvokeLoop(Do,15);
|
||||
bMonoInit = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if !UNITY_SWITCH
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@ -172,3 +173,4 @@ namespace AxiReplay
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if !UNITY_SWITCH
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@ -156,3 +157,4 @@ namespace AxiReplay
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -82,7 +82,6 @@ namespace Essgee.Utilities
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static void Write(this System.IO.BinaryWriter bw, byte* bufferPtr, int offset, int count)
|
||||
{
|
||||
// 使用指针复制数据到临时数组
|
||||
@ -90,21 +89,22 @@ namespace Essgee.Utilities
|
||||
// 使用BinaryWriter写入临时数组
|
||||
bw.Write(TempBuffer_src, 0, count);
|
||||
}
|
||||
public static void Write(this System.IO.FileStream fs, byte* bufferPtr, int offset, int count)
|
||||
{
|
||||
// 使用指针复制数据到临时数组
|
||||
Buffer.MemoryCopy(bufferPtr + offset, TempBuffer, 0, count);
|
||||
// 使用BinaryWriter写入临时数组
|
||||
fs.Write(TempBuffer_src, 0, count);
|
||||
}
|
||||
public static int Read(this System.IO.FileStream fs, byte* bufferPtr, int offset, int count)
|
||||
{
|
||||
// 使用BinaryWriter写入临时数组
|
||||
count = fs.Read(TempBuffer_src, offset, count);
|
||||
// 使用指针复制数据到临时数组
|
||||
Buffer.MemoryCopy(TempBuffer, bufferPtr + offset, 0, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
//public static void Write(this System.IO.FileStream fs, byte* bufferPtr, int offset, int count)
|
||||
//{
|
||||
// // 使用指针复制数据到临时数组
|
||||
// Buffer.MemoryCopy(bufferPtr + offset, TempBuffer, 0, count);
|
||||
// // 使用BinaryWriter写入临时数组
|
||||
// fs.Write(TempBuffer_src, 0, count);
|
||||
//}
|
||||
//public static int Read(this System.IO.FileStream fs, byte* bufferPtr, int offset, int count)
|
||||
//{
|
||||
// // 使用BinaryWriter写入临时数组
|
||||
// count = fs.Read(TempBuffer_src, offset, count);
|
||||
// // 使用指针复制数据到临时数组
|
||||
// Buffer.MemoryCopy(TempBuffer, bufferPtr + offset, 0, count);
|
||||
// return count;
|
||||
//}
|
||||
}
|
||||
|
||||
internal unsafe static class AxiArray
|
||||
|
||||
@ -39,6 +39,7 @@ namespace Essgee.Emulation
|
||||
var fileExtension = System.IO.Path.GetExtension(fileName);
|
||||
if (fileExtension == ".zip")
|
||||
{
|
||||
UnityEngine.Debug.Log("使用ZipFile.Open解压Zip:"+fileName);
|
||||
using (var zip = ZipFile.Open(fileName, ZipArchiveMode.Read))
|
||||
{
|
||||
foreach (var entry in zip.Entries)
|
||||
@ -60,7 +61,7 @@ namespace Essgee.Emulation
|
||||
else if (fileExtensionSystemDictionary.ContainsKey(fileExtension))
|
||||
{
|
||||
machineType = fileExtensionSystemDictionary[fileExtension];
|
||||
romData = System.IO.File.ReadAllBytes(fileName);
|
||||
romData = EmulatorHandler.io.File_ReadAllBytes(fileName);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!AppEnvironment.DebugMode)
|
||||
|
||||
@ -1805,7 +1805,9 @@ namespace IngameDebugConsole
|
||||
|
||||
public void SaveLogsToFile( string filePath )
|
||||
{
|
||||
#if !UNITY_SWITCH
|
||||
File.WriteAllText( filePath, GetAllLogs() );
|
||||
#endif
|
||||
Debug.Log( "Logs saved to: " + filePath );
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
|
||||
#if !UNITY_SWITCH
|
||||
using System.IO;
|
||||
|
||||
namespace MAME.Core
|
||||
@ -82,3 +82,4 @@ namespace MAME.Core
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -93,7 +93,6 @@ namespace StoicGooseUnity
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static void Write(this System.IO.BinaryWriter bw, byte* bufferPtr, int offset, int count)
|
||||
{
|
||||
// 使用指针复制数据到临时数组
|
||||
@ -101,6 +100,7 @@ namespace StoicGooseUnity
|
||||
// 使用BinaryWriter写入临时数组
|
||||
bw.Write(TempBuffer_src, 0, count);
|
||||
}
|
||||
/*
|
||||
public static void Write(this System.IO.FileStream fs, byte* bufferPtr, int offset, int count)
|
||||
{
|
||||
// 使用指针复制数据到临时数组
|
||||
@ -115,7 +115,7 @@ namespace StoicGooseUnity
|
||||
// 使用指针复制数据到临时数组
|
||||
Buffer.MemoryCopy(TempBuffer, bufferPtr + offset, 0, count);
|
||||
return count;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
internal unsafe static class AxiArray
|
||||
|
||||
@ -66,6 +66,10 @@ namespace Coffee.UIExtensions
|
||||
|
||||
static void SaveMaterial(Material mat, Shader shader, bool isMainAsset)
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
return;
|
||||
#endif
|
||||
|
||||
string materialPath = GetDefaultMaterialPath(shader);
|
||||
|
||||
#if UIEFFECT_SEPARATE
|
||||
|
||||
@ -29,8 +29,8 @@ public class UMAME : EmuCore<ulong>
|
||||
public UniTimeSpan mTimeSpan;
|
||||
public bool bQuickTestRom = false;
|
||||
public string mQuickTestRom = string.Empty;
|
||||
public ReplayWriter mReplayWriter;
|
||||
public ReplayReader mReplayReader;
|
||||
//public ReplayWriter mReplayWriter;
|
||||
//public ReplayReader mReplayReader;
|
||||
public long currEmuFrame => emu.currEmuFrame;
|
||||
public static System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
public static bool bInGame { get; private set; }
|
||||
@ -125,7 +125,7 @@ public class UMAME : EmuCore<ulong>
|
||||
{
|
||||
emu.ResetRomRoot(RomPath);
|
||||
//Application.targetFrameRate = 60;
|
||||
mReplayWriter = new ReplayWriter(mChangeRomName, "fuck", ReplayData.ReplayFormat.FM32IP64, Encoding.UTF8);
|
||||
//mReplayWriter = new ReplayWriter(mChangeRomName, "fuck", ReplayData.ReplayFormat.FM32IP64, Encoding.UTF8);
|
||||
mChangeRomName = loadRom;
|
||||
StopGame();
|
||||
//读取ROM
|
||||
@ -161,7 +161,7 @@ public class UMAME : EmuCore<ulong>
|
||||
mUniKeyboard.SyncInput(InputData);
|
||||
emu.UpdateFrame();
|
||||
//写入replay
|
||||
UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, InputData);
|
||||
//UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, InputData);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ public class UMAME : EmuCore<ulong>
|
||||
{
|
||||
string Path = SavePath + Machine.sName + ".rp";
|
||||
string dbgPath = SavePath + Machine.sName + ".rpwrite";
|
||||
mReplayWriter.SaveData(Path, true, dbgPath);
|
||||
//mReplayWriter.SaveData(Path, true, dbgPath);
|
||||
}
|
||||
public void StopGame()
|
||||
{
|
||||
|
||||
@ -121,34 +121,35 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
|
||||
}
|
||||
|
||||
}
|
||||
public class ReplayMode
|
||||
{
|
||||
ulong currInputData;
|
||||
// public class ReplayMode
|
||||
// {
|
||||
// ulong currInputData;
|
||||
|
||||
public ReplayMode()
|
||||
{
|
||||
}
|
||||
// public ReplayMode()
|
||||
// {
|
||||
// }
|
||||
|
||||
public ulong GetPressedKeys()
|
||||
{
|
||||
int targetFrame = (int)UMAME.instance.mUniVideoPlayer.mFrame;
|
||||
AxiReplay.ReplayStep stepData;
|
||||
//有变化
|
||||
if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out stepData))
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
string ShowKeyNames = string.Empty;
|
||||
foreach (string keyname in GetInputpDataToMotionKey(currInputData))
|
||||
{
|
||||
ShowKeyNames += keyname + " |";
|
||||
}
|
||||
Debug.Log("GetPressedKeys=>" + ShowKeyNames);
|
||||
#endif
|
||||
currInputData = stepData.InPut;
|
||||
}
|
||||
return currInputData;
|
||||
}
|
||||
}
|
||||
// public ulong GetPressedKeys()
|
||||
// {
|
||||
// int targetFrame = (int)UMAME.instance.mUniVideoPlayer.mFrame;
|
||||
// AxiReplay.ReplayStep stepData;
|
||||
|
||||
// //有变化
|
||||
// if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out stepData))
|
||||
// {
|
||||
//#if UNITY_EDITOR
|
||||
// string ShowKeyNames = string.Empty;
|
||||
// foreach (string keyname in GetInputpDataToMotionKey(currInputData))
|
||||
// {
|
||||
// ShowKeyNames += keyname + " |";
|
||||
// }
|
||||
// Debug.Log("GetPressedKeys=>" + ShowKeyNames);
|
||||
//#endif
|
||||
// currInputData = stepData.InPut;
|
||||
// }
|
||||
// return currInputData;
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user