完全移除文件形式的replay在模拟器中

This commit is contained in:
sin365 2025-10-08 02:04:37 +08:00
parent 2e5827f212
commit 8669c7a613
4 changed files with 38 additions and 33 deletions

View File

@ -1,4 +1,5 @@
using System; #if !UNITY_SWITCH
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
@ -172,3 +173,4 @@ namespace AxiReplay
} }
} }
#endif

View File

@ -1,4 +1,5 @@
using System; #if !UNITY_SWITCH
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
@ -156,3 +157,4 @@ namespace AxiReplay
} }
} }
#endif

View File

@ -29,8 +29,8 @@ public class UMAME : EmuCore<ulong>
public UniTimeSpan mTimeSpan; public UniTimeSpan mTimeSpan;
public bool bQuickTestRom = false; public bool bQuickTestRom = false;
public string mQuickTestRom = string.Empty; public string mQuickTestRom = string.Empty;
public ReplayWriter mReplayWriter; //public ReplayWriter mReplayWriter;
public ReplayReader mReplayReader; //public ReplayReader mReplayReader;
public long currEmuFrame => emu.currEmuFrame; public long currEmuFrame => emu.currEmuFrame;
public static System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew(); public static System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
public static bool bInGame { get; private set; } public static bool bInGame { get; private set; }
@ -125,7 +125,7 @@ public class UMAME : EmuCore<ulong>
{ {
emu.ResetRomRoot(RomPath); emu.ResetRomRoot(RomPath);
//Application.targetFrameRate = 60; //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; mChangeRomName = loadRom;
StopGame(); StopGame();
//读取ROM //读取ROM
@ -161,7 +161,7 @@ public class UMAME : EmuCore<ulong>
mUniKeyboard.SyncInput(InputData); mUniKeyboard.SyncInput(InputData);
emu.UpdateFrame(); emu.UpdateFrame();
//写入replay //写入replay
UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, InputData); //UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, InputData);
return true; return true;
} }
@ -188,7 +188,7 @@ public class UMAME : EmuCore<ulong>
{ {
string Path = SavePath + Machine.sName + ".rp"; string Path = SavePath + Machine.sName + ".rp";
string dbgPath = SavePath + Machine.sName + ".rpwrite"; string dbgPath = SavePath + Machine.sName + ".rpwrite";
mReplayWriter.SaveData(Path, true, dbgPath); //mReplayWriter.SaveData(Path, true, dbgPath);
} }
public void StopGame() public void StopGame()
{ {

View File

@ -121,34 +121,35 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
} }
} }
public class ReplayMode // public class ReplayMode
{ // {
ulong currInputData; // ulong currInputData;
public ReplayMode() // public ReplayMode()
{ // {
} // }
public ulong GetPressedKeys() // public ulong GetPressedKeys()
{ // {
int targetFrame = (int)UMAME.instance.mUniVideoPlayer.mFrame; // int targetFrame = (int)UMAME.instance.mUniVideoPlayer.mFrame;
AxiReplay.ReplayStep stepData; // AxiReplay.ReplayStep stepData;
//有变化
if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out stepData)) // //有变化
{ // if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out stepData))
#if UNITY_EDITOR // {
string ShowKeyNames = string.Empty; //#if UNITY_EDITOR
foreach (string keyname in GetInputpDataToMotionKey(currInputData)) // string ShowKeyNames = string.Empty;
{ // foreach (string keyname in GetInputpDataToMotionKey(currInputData))
ShowKeyNames += keyname + " |"; // {
} // ShowKeyNames += keyname + " |";
Debug.Log("GetPressedKeys=>" + ShowKeyNames); // }
#endif // Debug.Log("GetPressedKeys=>" + ShowKeyNames);
currInputData = stepData.InPut; //#endif
} // currInputData = stepData.InPut;
return currInputData; // }
} // return currInputData;
} // }
// }
#endregion #endregion
} }