diff --git a/AxibugEmuOnline.Client/Assets/AlienUICore b/AxibugEmuOnline.Client/Assets/AlienUICore index 8b0f0be..1acd834 160000 --- a/AxibugEmuOnline.Client/Assets/AlienUICore +++ b/AxibugEmuOnline.Client/Assets/AlienUICore @@ -1 +1 @@ -Subproject commit 8b0f0be28a7697597e9d416fa90a8ba62182bfa4 +Subproject commit 1acd8341ce457e66d172834dfb909569db309c33 diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/VirtuaNesDraw.shader b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/VirtuaNesDraw.shader index 63fad39..1bd6ce8 100644 --- a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/VirtuaNesDraw.shader +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/VirtuaNesDraw.shader @@ -107,6 +107,8 @@ mapUV.x = lerp(start,end, mapUV.x); + + half4 color = tex2D(_MainTex,mapUV); float rawIndex = color.b; diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CoreLibs/MemoryUtility.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CoreLibs/MemoryUtility.cs index f8bd081..21e2b95 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CoreLibs/MemoryUtility.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CoreLibs/MemoryUtility.cs @@ -1,5 +1,7 @@ using System; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Unity.Collections.LowLevel.Unsafe; namespace VirtualNes.Core { @@ -19,27 +21,25 @@ namespace VirtualNes.Core memset(array, 0, value, length); } - public static void memset(uint[] array, uint value, int length) + public unsafe static void memset(byte[] array, int offset, byte value, int length) { - for (int i = 0; i < length; i++) + fixed (byte* ptr = array) { - array[i] = value; + var offsetptr = ptr + offset; + + Unsafe.InitBlock(offsetptr, value, (uint)length); } } - public static void memset(byte[] array, int offset, byte value, int length) + public unsafe static void memset(uint[] array, int offset, byte value, int length) { - for (int i = offset; i < length; i++) + fixed (uint* ptr = array) { - array[i] = value; - } - } - - public static void memset(uint[] array, int offset, uint value, int length) - { - for (int i = offset; i < length; i++) - { - array[i] = value; + var offsetptr = ptr + offset; + for (int i = 0; i < length; i++) + { + offsetptr[i] = value; + } } } } diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/PPU.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/PPU.cs index a33b44e..a7f158d 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/PPU.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/PPU.cs @@ -360,7 +360,7 @@ namespace VirtualNes.Core loopy_shift = 0; if (lpScreen != null) - MemoryUtility.memset(lpScreen, 0x3F, SCREEN_WIDTH * SCREEN_HEIGHT); + MemoryUtility.memset(lpScreen, 0, 0x3F, SCREEN_WIDTH * SCREEN_HEIGHT); if (lpColormode != null) MemoryUtility.memset(lpColormode, 0, SCREEN_HEIGHT); } @@ -376,7 +376,7 @@ namespace VirtualNes.Core if (lpScreen != null) { - MemoryUtility.memset(lpScreen, 0x3F, SCREEN_WIDTH); + MemoryUtility.memset(lpScreen, 0, 0x3F, SCREEN_WIDTH); } if (lpColormode != null) { diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/VirtualNes.Core.asmdef b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/VirtualNes.Core.asmdef index 49a4484..b4819ec 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/VirtualNes.Core.asmdef +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/VirtualNes.Core.asmdef @@ -4,7 +4,7 @@ "references": [], "includePlatforms": [], "excludePlatforms": [], - "allowUnsafeCode": false, + "allowUnsafeCode": true, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": false,