规避一些危险项目吧

This commit is contained in:
sin365 2025-10-08 01:06:35 +08:00
parent 8879df5e17
commit f492c29146
12 changed files with 72 additions and 60 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

@ -82,7 +82,6 @@ namespace Essgee.Utilities
} }
} }
#endregion #endregion
public static void Write(this System.IO.BinaryWriter bw, byte* bufferPtr, int offset, int count) public static void Write(this System.IO.BinaryWriter bw, byte* bufferPtr, int offset, int count)
{ {
// 使用指针复制数据到临时数组 // 使用指针复制数据到临时数组
@ -90,21 +89,22 @@ namespace Essgee.Utilities
// 使用BinaryWriter写入临时数组 // 使用BinaryWriter写入临时数组
bw.Write(TempBuffer_src, 0, count); bw.Write(TempBuffer_src, 0, count);
} }
public static void Write(this System.IO.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); // // 使用指针复制数据到临时数组
// 使用BinaryWriter写入临时数组 // Buffer.MemoryCopy(bufferPtr + offset, TempBuffer, 0, count);
fs.Write(TempBuffer_src, 0, count); // // 使用BinaryWriter写入临时数组
} // fs.Write(TempBuffer_src, 0, count);
public static int Read(this System.IO.FileStream fs, byte* bufferPtr, int offset, int count) //}
{ //public static int Read(this System.IO.FileStream fs, byte* bufferPtr, int offset, int count)
// 使用BinaryWriter写入临时数组 //{
count = fs.Read(TempBuffer_src, offset, count); // // 使用BinaryWriter写入临时数组
// 使用指针复制数据到临时数组 // count = fs.Read(TempBuffer_src, offset, count);
Buffer.MemoryCopy(TempBuffer, bufferPtr + offset, 0, count); // // 使用指针复制数据到临时数组
return count; // Buffer.MemoryCopy(TempBuffer, bufferPtr + offset, 0, count);
} // return count;
//}
} }
internal unsafe static class AxiArray internal unsafe static class AxiArray

View File

@ -39,6 +39,7 @@ namespace Essgee.Emulation
var fileExtension = System.IO.Path.GetExtension(fileName); var fileExtension = System.IO.Path.GetExtension(fileName);
if (fileExtension == ".zip") if (fileExtension == ".zip")
{ {
UnityEngine.Debug.Log("使用ZipFile.Open解压Zip:"+fileName);
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)
@ -60,7 +61,7 @@ namespace Essgee.Emulation
else if (fileExtensionSystemDictionary.ContainsKey(fileExtension)) else if (fileExtensionSystemDictionary.ContainsKey(fileExtension))
{ {
machineType = fileExtensionSystemDictionary[fileExtension]; machineType = fileExtensionSystemDictionary[fileExtension];
romData = System.IO.File.ReadAllBytes(fileName); romData = EmulatorHandler.io.File_ReadAllBytes(fileName);
} }
} }
catch (Exception ex) when (!AppEnvironment.DebugMode) catch (Exception ex) when (!AppEnvironment.DebugMode)

View File

@ -1805,7 +1805,9 @@ namespace IngameDebugConsole
public void SaveLogsToFile( string filePath ) public void SaveLogsToFile( string filePath )
{ {
#if !UNITY_SWITCH
File.WriteAllText( filePath, GetAllLogs() ); File.WriteAllText( filePath, GetAllLogs() );
#endif
Debug.Log( "Logs saved to: " + filePath ); Debug.Log( "Logs saved to: " + filePath );
} }
@ -1815,7 +1817,7 @@ namespace IngameDebugConsole
if( !avoidScreenCutout ) if( !avoidScreenCutout )
return; return;
#if UNITY_2017_2_OR_NEWER && ( UNITY_EDITOR || UNITY_ANDROID || UNITY_IOS ) #if UNITY_2017_2_OR_NEWER && (UNITY_EDITOR || UNITY_ANDROID || UNITY_IOS)
// Check if there is a cutout at the top of the screen // Check if there is a cutout at the top of the screen
int screenHeight = Screen.height; int screenHeight = Screen.height;
float safeYMax = Screen.safeArea.yMax; float safeYMax = Screen.safeArea.yMax;

View File

@ -1,4 +1,4 @@
 #if !UNITY_SWITCH
using System.IO; using System.IO;
namespace MAME.Core namespace MAME.Core
@ -82,3 +82,4 @@ namespace MAME.Core
} }
} }
} }
#endif

View File

@ -93,7 +93,6 @@ namespace StoicGooseUnity
} }
} }
#endregion #endregion
public static void Write(this System.IO.BinaryWriter bw, byte* bufferPtr, int offset, int count) public static void Write(this System.IO.BinaryWriter bw, byte* bufferPtr, int offset, int count)
{ {
// 使用指针复制数据到临时数组 // 使用指针复制数据到临时数组
@ -101,6 +100,7 @@ namespace StoicGooseUnity
// 使用BinaryWriter写入临时数组 // 使用BinaryWriter写入临时数组
bw.Write(TempBuffer_src, 0, count); bw.Write(TempBuffer_src, 0, count);
} }
/*
public static void Write(this System.IO.FileStream fs, byte* bufferPtr, int offset, int 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); Buffer.MemoryCopy(TempBuffer, bufferPtr + offset, 0, count);
return count; return count;
} }*/
} }
internal unsafe static class AxiArray internal unsafe static class AxiArray

View File

@ -3,7 +3,7 @@
--- !u!21 &2100000 --- !u!21 &2100000
Material: Material:
serializedVersion: 8 serializedVersion: 8
m_ObjectHideFlags: 0 m_ObjectHideFlags: 8
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
@ -13,7 +13,7 @@ Material:
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords: []
m_InvalidKeywords: [] m_InvalidKeywords: []
m_LightmapFlags: 1 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
m_CustomRenderQueue: -1 m_CustomRenderQueue: -1
@ -43,4 +43,3 @@ Material:
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9dc7e810a87b444ab96919f3215c2fe5 guid: 9dc7e810a87b444ab96919f3215c2fe5
timeCreated: 1523859834
licenseType: Pro
NativeFormatImporter: NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -66,6 +66,10 @@ namespace Coffee.UIExtensions
static void SaveMaterial(Material mat, Shader shader, bool isMainAsset) static void SaveMaterial(Material mat, Shader shader, bool isMainAsset)
{ {
#if !UNITY_EDITOR
return;
#endif
string materialPath = GetDefaultMaterialPath(shader); string materialPath = GetDefaultMaterialPath(shader);
#if UIEFFECT_SEPARATE #if UIEFFECT_SEPARATE

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
} }