规避一些导致NS的安全问题

This commit is contained in:
sin365 2025-10-08 02:06:23 +08:00
parent 8669c7a613
commit b85f2ddbbd
6 changed files with 30 additions and 22 deletions

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

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