From 68155d69ff5e0b96e39c3ea66f92db2b6cb1d199 Mon Sep 17 00:00:00 2001 From: ALIENJACK Date: Tue, 24 Dec 2024 21:46:31 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E6=8A=A5=E9=94=99=EF=BC=8C=E4=BB=A5=E5=8F=8ARomItem=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E9=80=9F=E5=BA=A6=E8=BF=87=E5=BF=AB=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppMain/AxibugEmuOnline.Client.asmdef | 13 ++- .../AppMain/Filter/GameCamera Profile.asset | 84 ++++++++++++++++++- .../Script/AppMain/UI/GamesUI/RomItem.cs | 2 +- 3 files changed, 92 insertions(+), 7 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxibugEmuOnline.Client.asmdef b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxibugEmuOnline.Client.asmdef index 565fecf..ea8be2c 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxibugEmuOnline.Client.asmdef +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxibugEmuOnline.Client.asmdef @@ -1,12 +1,19 @@ { "name": "AxibugEmuOnline.Client", + "rootNamespace": "", "references": [ "UIEffect", "AxiReplay", - "Unity.Postprocessing.Runtime" + "Unity.Postprocessing.Runtime", + "VirtualNes.Core" ], - "optionalUnityReferences": [], "includePlatforms": [], "excludePlatforms": [], - "allowUnsafeCode": true + "allowUnsafeCode": true, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset index fb1eeac..fecb3d5 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset @@ -16,6 +16,68 @@ MonoBehaviour: enabled: overrideState: 1 value: 1 +--- !u!114 &-1232074899445057866 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e88ab71ab1a47d048ba0e45b742f6140, type: 3} + m_Name: FixingPixelArtGrille + m_EditorClassIdentifier: + active: 1 + enabled: + overrideState: 1 + value: 1 + MaskStyle: + overrideState: 0 + value: 1 + DrawResolution: + overrideState: 0 + value: {x: 272, y: 240} + HardScan: + overrideState: 0 + value: -10 + HardPix: + overrideState: 0 + value: -2 + HardBloomScan: + overrideState: 0 + value: -4 + HardBloomPix: + overrideState: 0 + value: -1.5 + BloomAmount: + overrideState: 0 + value: 0.0625 + Warp: + overrideState: 0 + value: {x: 0.015625, y: 0.041666668} + MaskLight: + overrideState: 0 + value: 1.5 + MaskDrak: + overrideState: 0 + value: 0.5 +--- !u!114 &-65063800318898424 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2a0a5286ac74b734ba8d1e0cfdfb9c8d, type: 3} + m_Name: LCDPostEffect + m_EditorClassIdentifier: + active: 1 + enabled: + overrideState: 1 + value: 1 --- !u!114 &11400000 MonoBehaviour: m_ObjectHideFlags: 0 @@ -29,9 +91,9 @@ MonoBehaviour: m_Name: GameCamera Profile m_EditorClassIdentifier: settings: - - {fileID: 117625959343581733} - - {fileID: -2985742813244632235} - - {fileID: 2118329037781486242} + - {fileID: -1232074899445057866} + - {fileID: -65063800318898424} + - {fileID: 1989879740823951492} --- !u!114 &117625959343581733 MonoBehaviour: m_ObjectHideFlags: 3 @@ -78,6 +140,22 @@ MonoBehaviour: MaskDrak: overrideState: 0 value: 0.5 +--- !u!114 &1989879740823951492 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98a055cea8a1355429d1cbb752c4e60e, type: 3} + m_Name: MattiasCRT + m_EditorClassIdentifier: + active: 1 + enabled: + overrideState: 1 + value: 1 --- !u!114 &2118329037781486242 MonoBehaviour: m_ObjectHideFlags: 3 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs index dba3f0f..df91364 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/GamesUI/RomItem.cs @@ -66,7 +66,7 @@ namespace AxibugEmuOnline.Client SetBaseInfo(m_romfile.Alias, m_romfile.Descript, m_romfile.GameTypeDes); App.CacheMgr.GetSpriteCache(m_romfile.ImageURL, (img, url) => { - if (url != m_romfile.ImageURL) return; + if (!m_romfile.InfoReady || url != m_romfile.ImageURL) return; m_romImage.sprite = img; }); From 4fbfd2cfc1be7c66baf1a88c1be009ae27bd3d48 Mon Sep 17 00:00:00 2001 From: ALIENJACK Date: Tue, 24 Dec 2024 21:52:23 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dnes=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=89=8B=E6=9F=84=E9=94=AE=E4=BD=8D=E6=9C=AA=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs index f60b903..3fb6985 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs @@ -173,7 +173,7 @@ namespace AxibugEmuOnline.Client { switch (controllerIndex) { - case 1: + case 0: switch (nesConBtnType) { case EnumButtonType.LEFT: @@ -197,7 +197,7 @@ namespace AxibugEmuOnline.Client } break; - case 2: + case 1: switch (nesConBtnType) { case EnumButtonType.LEFT: From 34c7eef257eb6d5960747bba58b96dca1d750244 Mon Sep 17 00:00:00 2001 From: ALIENJACK Date: Wed, 25 Dec 2024 01:03:00 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E7=A7=BB=E9=99=A4postprocess=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E7=9A=84=E6=BB=A4=E9=95=9C=E5=AE=9E=E7=8E=B0=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E4=B8=BAgraphics.Blit=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Resources/NES/NesEmulator.prefab | 46 ++--- .../Assets/Scene/AxibugEmuOnline.Client.unity | 180 +----------------- .../Assets/Script/AppMain/App.cs | 18 +- .../Script/AppMain/Filter/FilterEffect.cs | 59 +++--- .../{Manager => Filter}/FilterManager.cs | 87 +++++---- .../AppMain/Filter/FilterManager.cs.meta | 2 + .../Script/AppMain/Filter/FilterParamerter.cs | 49 +++++ .../AppMain/Filter/FilterParamerter.cs.meta | 2 + .../FixingPixelArtGrille.cs | 110 ++++------- .../AppMain/Filter/GameCamera Profile.asset | 6 +- .../Filter/LCDPostEffect/LCDPostEffect.cs | 29 +-- .../AppMain/Filter/MattiasCRT/MattiasCRT.cs | 21 +- .../Assets/Script/AppMain/Initer.cs | 1 - .../AppMain/Manager/FilterManager.cs.meta | 11 -- .../Script/AppMain/NesEmulator/NesEmulator.cs | 11 +- .../NesEmulator/NesEmulator_Screen.mat | 14 +- .../NesEmulator/NesEmulator_Screen.shader | 6 +- .../Script/AppMain/NesEmulator/UVRemapper.cs | 35 ++++ .../AppMain/NesEmulator/UVRemapper.cs.meta | 2 + .../AppMain/NesEmulator/VideoProvider.cs | 28 ++- 20 files changed, 298 insertions(+), 419 deletions(-) rename AxibugEmuOnline.Client/Assets/Script/AppMain/{Manager => Filter}/FilterManager.cs (82%) create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs.meta delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab b/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab index 81baa9f..53110e4 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/NES/NesEmulator.prefab @@ -25,12 +25,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 9760340517325694} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4232056521131536011} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &9003897287163669553 MonoBehaviour: @@ -56,6 +57,7 @@ AudioSource: serializedVersion: 4 OutputAudioMixerGroup: {fileID: 0} m_audioClip: {fileID: 0} + m_Resource: {fileID: 0} m_PlayOnAwake: 1 m_Volume: 1 m_Pitch: 1 @@ -169,9 +171,9 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: -1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1038087993597378172} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -240,11 +242,11 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 3430872171738201552} - {fileID: 5684774662137182450} m_Father: {fileID: 4232056520494431727} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -289,12 +291,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4232056520112715746} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4232056521131536011} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &4232056520112715744 MonoBehaviour: @@ -311,6 +314,8 @@ MonoBehaviour: NesEmu: {fileID: 4232056521131536012} DrawCanvas: {fileID: 4232056520494431724} Image: {fileID: 4232056521759880274} + GPUTurboMat_gpu: {fileID: 2100000, guid: 07e28fcb992bc124e986f9d8ff3beb97, type: 2} + GPUTurbo: 1 --- !u!1 &4232056520494431712 GameObject: m_ObjectHideFlags: 0 @@ -322,7 +327,6 @@ GameObject: - component: {fileID: 4232056520494431727} - component: {fileID: 4232056520494431724} - component: {fileID: 4232056520494431725} - - component: {fileID: 4232056520494431726} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -340,11 +344,11 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4232056521759880275} - {fileID: 1038087993597378172} m_Father: {fileID: 4232056521131536011} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -368,7 +372,9 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -395,23 +401,6 @@ MonoBehaviour: m_DefaultSpriteDPI: 96 m_DynamicPixelsPerUnit: 1 m_PresetInfoIsWorld: 0 ---- !u!114 &4232056520494431726 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4232056520494431712} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 4294967295 --- !u!1 &4232056521131536013 GameObject: m_ObjectHideFlags: 0 @@ -436,15 +425,16 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4232056521131536013} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4232056520112715745} - {fileID: 4785916497946256520} - {fileID: 4232056520494431727} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &4232056521131536012 MonoBehaviour: @@ -458,10 +448,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 39557e19783acee499ace6c68549e8f8, type: 3} m_Name: m_EditorClassIdentifier: - InputTemplate: {fileID: 0} VideoProvider: {fileID: 4232056520112715744} AudioProvider: {fileID: 9003897287163669553} - m_bPause: 0 --- !u!1 &4232056521759880276 GameObject: m_ObjectHideFlags: 0 @@ -490,9 +478,9 @@ RectTransform: m_LocalRotation: {x: 1, y: 0, z: 0, w: 0} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4232056520494431727} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -519,7 +507,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: 07e28fcb992bc124e986f9d8ff3beb97, type: 2} + m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} @@ -562,9 +550,9 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1038087993597378172} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} diff --git a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity index 4a40cf8..623cf05 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity @@ -353,7 +353,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: -0.97058296 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_SizeDelta.y @@ -389,7 +389,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: -0.48529053 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_AnchoredPosition.y @@ -1092,7 +1092,7 @@ Canvas: m_Enabled: 1 serializedVersion: 3 m_RenderMode: 1 - m_Camera: {fileID: 1475480931} + m_Camera: {fileID: 0} m_PlaneDistance: 100 m_PixelPerfect: 0 m_ReceivesEvents: 1 @@ -1153,7 +1153,6 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1639312037} - - {fileID: 1475480929} - {fileID: 74796459} - {fileID: 1427887270} - {fileID: 1599240741} @@ -1172,7 +1171,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 980f937ad27ad8540afeb8b7f100997e, type: 3} m_Name: m_EditorClassIdentifier: - m_filterVolume: {fileID: 1475480930} m_filterPreview: {fileID: 1124446961} m_xmbBg: {fileID: 730698712} bTest: 0 @@ -1884,174 +1882,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: imgUI: {fileID: 1471857116} ---- !u!1 &1475480928 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1475480929} - - component: {fileID: 1475480931} - - component: {fileID: 1475480932} - - component: {fileID: 1475480930} - m_Layer: 5 - m_Name: GameCamera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1475480929 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1475480928} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.98, y: 20.14, z: 6.23} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1335662459} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1475480930 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1475480928} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} - m_Name: - m_EditorClassIdentifier: - sharedProfile: {fileID: 11400000, guid: 17060e2d2f9e5c340a526f08317e5a98, type: 2} - isGlobal: 1 - blendDistance: 0 - weight: 1 - priority: 0 ---- !u!20 &1475480931 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1475480928} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_Iso: 200 - m_ShutterSpeed: 0.005 - m_Aperture: 16 - m_FocusDistance: 10 - m_FocalLength: 50 - m_BladeCount: 5 - m_Curvature: {x: 2, y: 11} - m_BarrelClipping: 0.25 - m_Anamorphism: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 1 - orthographic size: 5 - m_Depth: -2 - m_CullingMask: - serializedVersion: 2 - m_Bits: 32 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!114 &1475480932 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1475480928} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} - m_Name: - m_EditorClassIdentifier: - volumeTrigger: {fileID: 0} - volumeLayer: - serializedVersion: 2 - m_Bits: 32 - stopNaNPropagation: 1 - finalBlitToCameraTarget: 0 - antialiasingMode: 0 - temporalAntialiasing: - jitterSpread: 0.75 - sharpness: 0.25 - stationaryBlending: 0.95 - motionBlending: 0.85 - subpixelMorphologicalAntialiasing: - quality: 2 - fastApproximateAntialiasing: - fastMode: 0 - keepAlpha: 0 - fog: - enabled: 1 - excludeSkybox: 1 - debugLayer: - lightMeter: - width: 512 - height: 256 - showCurves: 1 - histogram: - width: 512 - height: 256 - channel: 3 - waveform: - exposure: 0.12 - height: 256 - vectorscope: - size: 256 - exposure: 0.12 - overlaySettings: - linearDepth: 0 - motionColorIntensity: 4 - motionGridSize: 64 - colorBlindnessType: 0 - colorBlindnessStrength: 1 - m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2} - m_ShowToolkit: 0 - m_ShowCustomSorter: 0 - breakBeforeColorGrading: 0 - m_BeforeTransparentBundles: [] - m_BeforeStackBundles: - - assemblyQualifiedName: FixingPixelArtGrille, AxibugEmuOnline.Client, Version=0.0.0.0, - Culture=neutral, PublicKeyToken=null - - assemblyQualifiedName: MattiasCRT, AxibugEmuOnline.Client, Version=0.0.0.0, Culture=neutral, - PublicKeyToken=null - - assemblyQualifiedName: LCDPostEffect, AxibugEmuOnline.Client, Version=0.0.0.0, - Culture=neutral, PublicKeyToken=null - m_AfterStackBundles: [] --- !u!1 &1498586261 GameObject: m_ObjectHideFlags: 3 @@ -2214,7 +2044,7 @@ GameObject: - component: {fileID: 1639312035} m_Layer: 0 m_Name: UICamera - m_TagString: Untagged + m_TagString: MainCamera m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -2263,7 +2093,7 @@ Camera: field of view: 60 orthographic: 1 orthographic size: 5 - m_Depth: -1 + m_Depth: 0 m_CullingMask: serializedVersion: 2 m_Bits: 32 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs index f7abd1f..2d308de 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs @@ -43,15 +43,13 @@ namespace AxibugEmuOnline.Client.ClientCore #endif public static void Init(Initer initer, bool isTest = false, string testSrvIP = "") { - PlayerPrefs.DeleteAll(); + if (UnityEngine.Application.platform == RuntimePlatform.PSP2) + { + //PSV 等平台需要手动创建目录 + PSP2Init(); + } - if (UnityEngine.Application.platform == RuntimePlatform.PSP2) - { - //PSV 等平台需要手动创建目录 - PSP2Init(); - } - - settings = new AppSettings(); + settings = new AppSettings(); log = new LogManager(); LogManager.OnLog += OnNoSugarNetLog; @@ -66,7 +64,7 @@ namespace AxibugEmuOnline.Client.ClientCore CacheMgr = new CacheManager(); roomMgr = new AppRoom(); share = new AppShare(); - filter = new FilterManager(initer.m_filterVolume, initer.m_filterPreview, initer.m_xmbBg); + filter = new FilterManager(initer.m_filterPreview, initer.m_xmbBg); bTest = isTest; mTestSrvIP = testSrvIP; var go = new GameObject("[AppAxibugEmuOnline]"); @@ -122,7 +120,7 @@ namespace AxibugEmuOnline.Client.ClientCore yield break; } - AxiHttpProxy.SendWebRequestProxy request = AxiHttpProxy.Get($"{App.httpAPI.WebSiteApi}/CheckStandInfo?platform={platform}&version={Application.version}"); + AxiHttpProxy.SendWebRequestProxy request = AxiHttpProxy.Get($"{App.httpAPI.WebSiteApi}/CheckStandInfo?platform={platform}&version={Application.version}"); yield return request.SendWebRequest; if (!request.downloadHandler.isDone) yield break; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs index 5d97e11..4efceab 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs @@ -1,28 +1,33 @@ -using System; +using Assets.Script.AppMain.Filter; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; +using UnityEngine.Rendering; namespace AxibugEmuOnline.Client { - public abstract class FilterEffect : PostProcessEffectSettings + public abstract class FilterEffect { - private List m_editableParamList; - + public BoolParameter Enable = new BoolParameter(false); + public abstract string Name { get; } public IReadOnlyCollection EditableParam => m_editableParamList.AsReadOnly(); - public abstract string Name { get; } + List m_editableParamList; + Material m_material; + + protected abstract string ShaderName { get; } public FilterEffect() { GetEditableFilterParamters(); + m_material = new Material(Shader.Find(ShaderName)); } - protected void GetEditableFilterParamters() + void GetEditableFilterParamters() { var parameters = (from t in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public) - where t.FieldType.IsSubclassOf(typeof(ParameterOverride)) + where t.FieldType.IsSubclassOf(typeof(FilterParameter)) where t.DeclaringType.IsSubclassOf(typeof(FilterEffect)) orderby t.MetadataToken select t); @@ -30,7 +35,7 @@ namespace AxibugEmuOnline.Client m_editableParamList = new List(); foreach (var param in parameters) { - var paramObj = (ParameterOverride)param.GetValue(this); + var paramObj = (FilterParameter)param.GetValue(this); var rangeAtt = param.GetCustomAttribute(); float min = 0; float max = 10; @@ -44,47 +49,41 @@ namespace AxibugEmuOnline.Client } } + public void Render(RenderTexture rt, RenderTexture result) + { + m_material.SetTexture("_MainTex", rt); + OnRenderer(m_material, rt, result); + } + + protected abstract void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result); + public class EditableParamerter { - private ParameterOverride m_paramObject; - private FieldInfo valueFieldInfo; + private FilterParameter m_paramObject; - public Type ValueType { get; private set; } + public Type ValueType => m_paramObject.ValueType; public string Name { get; private set; } public object Value { - get => valueFieldInfo.GetValue(m_paramObject); - set - { - valueFieldInfo.SetValue(m_paramObject, value); - m_paramObject.overrideState = true; - } + get => m_paramObject.Value; + set => m_paramObject.Value = value; } + public object MinValue { get; private set; } public object MaxValue { get; private set; } - public EditableParamerter(string name, ParameterOverride paramObject, object minValue, object maxValue) + public EditableParamerter(string name, FilterParameter paramObject, object minValue, object maxValue) { m_paramObject = paramObject; Name = name; var paramType = paramObject.GetType(); - valueFieldInfo = paramType.GetField("value", BindingFlags.Public | BindingFlags.Instance); - if (valueFieldInfo != null) - { - ValueType = valueFieldInfo.FieldType; - } - else - { - ValueType = typeof(object); - } - MinValue = minValue; MaxValue = maxValue; } - public void ResetToDefault() => m_paramObject.overrideState = false; + public void ResetToDefault() => m_paramObject.Value = null; public void Apply(object overrideValue) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs similarity index 82% rename from AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs rename to AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs index d38e10b..92d5a81 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs @@ -3,14 +3,13 @@ using System; using System.Collections.Generic; using System.Linq; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; using static AxibugEmuOnline.Client.FilterEffect; +using static AxibugEmuOnline.Client.FilterManager; namespace AxibugEmuOnline.Client { public class FilterManager { - private PostProcessProfile m_filterPorfile; private List m_filters; private Dictionary m_filterPlatforms = new Dictionary(); private AlphaWraper m_previewFilterWraper; @@ -20,18 +19,42 @@ namespace AxibugEmuOnline.Client /// public IReadOnlyList Filters => m_filters; - public FilterManager(PostProcessVolume filterVolume, CanvasGroup filterPreview, CanvasGroup mainBg) + public FilterManager(CanvasGroup filterPreview, CanvasGroup mainBg) { - if (filterVolume == null) - return; - m_filterPorfile = filterVolume.profile; - m_filters = m_filterPorfile.settings.Where(setting => setting is FilterEffect).Select(setting => new Filter(setting as FilterEffect)).ToList(); + m_filters = new List + { + new Filter(new FixingPixelArtGrille()), + new Filter(new LCDPostEffect()), + new Filter(new MattiasCRT()), + }; var json = PlayerPrefs.GetString(nameof(FilterRomSetting)); m_filterRomSetting = JsonUtility.FromJson(json) ?? new FilterRomSetting(); m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false); ShutDownFilterPreview(); ShutDownFilter(); + + + } + + private RenderTexture result = null; + public RenderTexture ExecuteFilterRender(RenderTexture rt) + { + if (result == null) + result = RenderTexture.GetTemporary(Screen.width, Screen.height); + + bool anyFilterEnable = false; + foreach (var filter in Filters) + { + if (!filter.m_setting.Enable.GetValue()) continue; + filter.m_setting.Render(rt, result); + anyFilterEnable = true; + } + + if (anyFilterEnable) + return result; + else + return rt; } /// 关闭滤镜预览 @@ -54,8 +77,8 @@ namespace AxibugEmuOnline.Client { foreach (var selfFiler in Filters) { - if (selfFiler != filter) selfFiler.m_setting.enabled.Override(false); - else selfFiler.m_setting.enabled.Override(true); + if (selfFiler != filter) selfFiler.m_setting.Enable.Override(false); + else selfFiler.m_setting.Enable.Override(true); } } @@ -65,8 +88,8 @@ namespace AxibugEmuOnline.Client public void ShutDownFilter() { //关闭所有后处理效果 - foreach (var setting in m_filterPorfile.settings) - setting.enabled.Override(false); + foreach (var filter in Filters) + filter.m_setting.Enable.Override(false); } /// @@ -94,21 +117,21 @@ namespace AxibugEmuOnline.Client Filter filter = null; FilterPreset preset = null; - //filter = Filters.FirstOrDefault(f => f.Name == value.filterName); - //if (filter != null) - //{ - // string presetName = value.presetName; - // preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); - //} + //filter = Filters.FirstOrDefault(f => f.Name == value.filterName); + //if (filter != null) + //{ + // string presetName = value.presetName; + // preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); + //} - filter = Filters.FirstOrDefault(f => f.Name == value.Item1); - if (filter != null) - { - string presetName = value.Item2; - preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); - } + filter = Filters.FirstOrDefault(f => f.Name == value.Item1); + if (filter != null) + { + string presetName = value.Item2; + preset = filter.Presets.FirstOrDefault(p => p.Name == presetName); + } - return new GetFilterSetting_result() + return new GetFilterSetting_result() { filter = filter, preset = preset @@ -118,10 +141,10 @@ namespace AxibugEmuOnline.Client public struct GetFilterSetting_result { public Filter filter; - public FilterPreset preset; - } + public FilterPreset preset; + } - public class Filter + public class Filter { public string Name => m_setting.Name; public IReadOnlyCollection Paramerters => m_setting.EditableParam; @@ -243,7 +266,7 @@ namespace AxibugEmuOnline.Client { prepareCache(); string value; - m_paramName2ValueJson.TryGetValue(paramName, out value); + m_paramName2ValueJson.TryGetValue(paramName, out value); return value; } @@ -253,9 +276,9 @@ namespace AxibugEmuOnline.Client if (rawStr == null) return null; if (valueType == typeof(float)) - { + { float floatVal; - float.TryParse(rawStr, out floatVal); + float.TryParse(rawStr, out floatVal); return floatVal; } else if (valueType.IsEnum) @@ -329,12 +352,12 @@ namespace AxibugEmuOnline.Client return JsonUtility.ToJson(this); } - public ValueTuple Get(RomFile rom) + public ValueTuple Get(RomFile rom) { prepareCache(); Item item; - m_cache.TryGetValue(rom.ID, out item); + m_cache.TryGetValue(rom.ID, out item); return new ValueTuple(item.FilterName, item.PresetName); } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs.meta new file mode 100644 index 0000000..dd404c5 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f61dfd2411084ec469cdb3faacca298e \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs new file mode 100644 index 0000000..bd0f51d --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace Assets.Script.AppMain.Filter +{ + public abstract class FilterParameter + { + public abstract Type ValueType { get; } + + object m_overrideValue; + protected object m_defaultValue; + public object Value + { + get => m_overrideValue ?? m_defaultValue; + set => m_overrideValue = value; + } + } + + public class FilterParameter : FilterParameter + { + public override Type ValueType => typeof(T); + public void Override(T value) + { + Value = value; + } + public T GetValue() => (T)Value; + + public FilterParameter(T defaultValue) + { + m_defaultValue = defaultValue; + } + } + + public class BoolParameter : FilterParameter + { + public BoolParameter(bool defaultValue) : base(defaultValue) { } + } + + public class Vector2Parameter : FilterParameter + { + public Vector2Parameter(Vector2 defaultValue) : base(defaultValue) { } + } + + public class FloatParameter : FilterParameter + { + public FloatParameter(float defaultValue) : base(defaultValue) { } + } +} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs.meta new file mode 100644 index 0000000..9d5761a --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterParamerter.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 53e95955f1beeb34a87d2046875fa16f \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs index 5fb1d04..df690a3 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs @@ -1,50 +1,29 @@ -using AxibugEmuOnline.Client; +using Assets.Script.AppMain.Filter; +using AxibugEmuOnline.Client; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; -[System.Serializable] -[PostProcess(typeof(FixingPixelArtGrilleRenderer), PostProcessEvent.BeforeStack, "Filter/FixingPixelArtGrille")] public sealed class FixingPixelArtGrille : FilterEffect { public override string Name => nameof(FixingPixelArtGrille); - public ParameterOverride MaskStyle = new ParameterOverride { value = EnumMaskStyle.ApertureGrille }; - - [Tooltip("Emulated input resolution\nOptimize for resize")] - public Vector2Parameter DrawResolution = new Vector2Parameter - { - value = new Vector2(272, 240) - }; - - [Tooltip("Hardness of scanline")] + protected override string ShaderName => "PostEffect/FixingPixcelArtGrille"; + public FilterParameter MaskStyle = new FilterParameter(EnumMaskStyle.ApertureGrille); + public Vector2Parameter DrawResolution = new Vector2Parameter(new Vector2(272, 240)); [Range(-32, 0)] - public FloatParameter HardScan = new FloatParameter { value = -10 }; - - [Tooltip("Hardness of pixels in scanline")] + public FloatParameter HardScan = new FloatParameter(-10); [Range(-6, 0)] - public FloatParameter HardPix = new FloatParameter { value = -2 }; - - [Tooltip("Hardness of short vertical bloom")] + public FloatParameter HardPix = new FloatParameter(-2); [Range(-8, 0)] - public FloatParameter HardBloomScan = new FloatParameter { value = -4.0f }; - - [Tooltip("Hardness of short horizontal bloom")] + public FloatParameter HardBloomScan = new FloatParameter(-4.0f); [Range(-4, 0)] - public FloatParameter HardBloomPix = new FloatParameter { value = -1.5f }; - - [Tooltip("Amount of small bloom effect")] + public FloatParameter HardBloomPix = new FloatParameter(-1.5f); [Range(0, 1)] - public FloatParameter BloomAmount = new FloatParameter { value = 1 / 16f }; - - [Tooltip("Display warp")] - public Vector2Parameter Warp = new Vector2Parameter { value = new Vector2(1f / 64f, 1f / 24f) }; - - [Tooltip("Amount of shadow mask Light")] + public FloatParameter BloomAmount = new FloatParameter(1 / 16f); + public Vector2Parameter Warp = new Vector2Parameter(new Vector2(1f / 64f, 1f / 24f)); [Range(1, 3)] - public FloatParameter MaskLight = new FloatParameter { value = 1.5f }; + public FloatParameter MaskLight = new FloatParameter(1.5f); [Range(0.1f, 1)] - [Tooltip("Amount of shadow mask Dark")] - public FloatParameter MaskDrak = new FloatParameter { value = 0.5f }; + public FloatParameter MaskDrak = new FloatParameter(0.5f); public enum EnumMaskStyle { @@ -53,54 +32,41 @@ public sealed class FixingPixelArtGrille : FilterEffect StretchedVGA, VGAStyle } -} -public sealed class FixingPixelArtGrilleRenderer : PostProcessEffectRenderer -{ - private Shader shader; - private Material material; - public override void Init() + protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result) { - shader = Shader.Find("PostEffect/FixingPixcelArtGrille"); - material = new Material(shader); - } + renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0)); + renderMat.SetVector("_res", new Vector4(DrawResolution.GetValue().x, DrawResolution.GetValue().y, 0, 0)); + renderMat.SetFloat("_hardScan", HardScan.GetValue()); + renderMat.SetFloat("_hardPix", HardPix.GetValue()); + renderMat.SetFloat("_hardBloomScan", HardBloomScan.GetValue()); + renderMat.SetFloat("_hardBloomPix", HardBloomPix.GetValue()); + renderMat.SetFloat("_bloomAmount", BloomAmount.GetValue()); + renderMat.SetVector("_warp", Warp.GetValue()); + renderMat.SetFloat("_maskDark", MaskDrak.GetValue()); + renderMat.SetFloat("_maskLight", MaskLight.GetValue()); - public override void Render(PostProcessRenderContext context) - { - material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); - var res = settings.DrawResolution; - material.SetVector("_res", new Vector4(res.value.x, res.value.y, 0, 0)); - material.SetFloat("_hardScan", settings.HardScan.value); - material.SetFloat("_hardPix", settings.HardPix.value); - material.SetFloat("_hardBloomScan", settings.HardBloomScan.value); - material.SetFloat("_hardBloomPix", settings.HardBloomPix.value); - material.SetFloat("_bloomAmount", settings.BloomAmount.value); - material.SetVector("_warp", settings.Warp.value); - material.SetFloat("_maskDark", settings.MaskDrak.value); - material.SetFloat("_maskLight", settings.MaskLight.value); + renderMat.DisableKeyword("_MASKSTYLE_VGASTYLE"); + renderMat.DisableKeyword("_MASKSTYLE_TVSTYLE"); + renderMat.DisableKeyword("_MASKSTYLE_APERTUREGRILLE"); + renderMat.DisableKeyword("_MASKSTYLE_STRETCHEDVGA"); - material.DisableKeyword("_MASKSTYLE_VGASTYLE"); - material.DisableKeyword("_MASKSTYLE_TVSTYLE"); - material.DisableKeyword("_MASKSTYLE_APERTUREGRILLE"); - material.DisableKeyword("_MASKSTYLE_STRETCHEDVGA"); - - switch (settings.MaskStyle.value) + switch (MaskStyle.GetValue()) { - case FixingPixelArtGrille.EnumMaskStyle.VGAStyle: - material.EnableKeyword("_MASKSTYLE_VGASTYLE"); + case EnumMaskStyle.VGAStyle: + renderMat.EnableKeyword("_MASKSTYLE_VGASTYLE"); break; - case FixingPixelArtGrille.EnumMaskStyle.TVStyle: - material.EnableKeyword("_MASKSTYLE_TVSTYLE"); + case EnumMaskStyle.TVStyle: + renderMat.EnableKeyword("_MASKSTYLE_TVSTYLE"); break; - case FixingPixelArtGrille.EnumMaskStyle.ApertureGrille: - material.EnableKeyword("_MASKSTYLE_APERTUREGRILLE"); + case EnumMaskStyle.ApertureGrille: + renderMat.EnableKeyword("_MASKSTYLE_APERTUREGRILLE"); break; - case FixingPixelArtGrille.EnumMaskStyle.StretchedVGA: - material.EnableKeyword("_MASKSTYLE_STRETCHEDVGA"); + case EnumMaskStyle.StretchedVGA: + renderMat.EnableKeyword("_MASKSTYLE_STRETCHEDVGA"); break; } - - context.command.Blit(context.source, context.destination, material); + Graphics.Blit(rt, result, renderMat); } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset index fecb3d5..ffb3670 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset @@ -31,7 +31,7 @@ MonoBehaviour: active: 1 enabled: overrideState: 1 - value: 1 + value: 0 MaskStyle: overrideState: 0 value: 1 @@ -77,7 +77,7 @@ MonoBehaviour: active: 1 enabled: overrideState: 1 - value: 1 + value: 0 --- !u!114 &11400000 MonoBehaviour: m_ObjectHideFlags: 0 @@ -155,7 +155,7 @@ MonoBehaviour: active: 1 enabled: overrideState: 1 - value: 1 + value: 0 --- !u!114 &2118329037781486242 MonoBehaviour: m_ObjectHideFlags: 3 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs index db3d4f5..94b1d78 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs @@ -1,28 +1,15 @@ using AxibugEmuOnline.Client; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; -[System.Serializable] -[PostProcess(typeof(LCDPostEffectRenderer), PostProcessEvent.BeforeStack, "Filter/LCDPostEffect")] public sealed class LCDPostEffect : FilterEffect { public override string Name => nameof(LCDPostEffect); + + protected override string ShaderName => "Filter/LCDPostEffect"; + + protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result) + { + renderMat.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); + Graphics.Blit(rt, result, renderMat); + } } - -public sealed class LCDPostEffectRenderer : PostProcessEffectRenderer -{ - private Shader shader; - private Material material; - - public override void Init() - { - shader = Shader.Find("Filter/LCDPostEffect"); - material = new Material(shader); - } - - public override void Render(PostProcessRenderContext context) - { - material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); - context.command.Blit(context.source, context.destination, material); - } -} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs index b398e58..01716dc 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs @@ -1,28 +1,15 @@ using AxibugEmuOnline.Client; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; -[System.Serializable] -[PostProcess(typeof(MattiasCRTRenderer), PostProcessEvent.BeforeStack, "Filter/MattiasCRT")] public sealed class MattiasCRT : FilterEffect { public override string Name => nameof(MattiasCRT); -} -public sealed class MattiasCRTRenderer : PostProcessEffectRenderer -{ - private Shader shader; - private Material material; + protected override string ShaderName => "Filter/MattiasCRT"; - public override void Init() + protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result) { - shader = Shader.Find("Filter/MattiasCRT"); - material = new Material(shader); - } - - public override void Render(PostProcessRenderContext context) - { - material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); - context.command.Blit(context.source, context.destination, material); + renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0)); + Graphics.Blit(rt, result, renderMat); } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs index 56c3eaa..44efea2 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs @@ -6,7 +6,6 @@ namespace AxibugEmuOnline.Client { public class Initer : MonoBehaviour { - public PostProcessVolume m_filterVolume; public CanvasGroup m_filterPreview; public CanvasGroup m_xmbBg; public static string dev_UUID; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs.meta deleted file mode 100644 index d7ab243..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/FilterManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5354e2e13dbff91438a04b9de2351645 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs index 085be65..402e380 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs @@ -16,7 +16,7 @@ namespace AxibugEmuOnline.Client { public VideoProvider VideoProvider; public AudioProvider AudioProvider; - + //模拟器核心实例化对象 public NES NesCore { get; private set; } @@ -38,9 +38,7 @@ namespace AxibugEmuOnline.Client /// private unsafe void Update() { - if (IsPause) return; - - if (NesCore != null) + if (NesCore != null && !IsPause) { PushEmulatorFrame(); if (InGameUI.Instance.IsNetPlay) @@ -49,6 +47,9 @@ namespace AxibugEmuOnline.Client var screenBuffer = NesCore.ppu.GetScreenPtr(); VideoProvider.SetDrawData(screenBuffer); } + + + VideoProvider.ApplyFilterEffect(); } public EnumPlatform Platform => EnumPlatform.NES; @@ -140,7 +141,7 @@ namespace AxibugEmuOnline.Client NesCore = null; } - + #if UNITY_EDITOR private ControllerState m_lastState; #endif diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat index 1eb2c7a..d581fae 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.mat @@ -2,19 +2,24 @@ %TAG !u! tag:unity3d.com,2011: --- !u!21 &2100000 Material: - serializedVersion: 6 + serializedVersion: 8 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} m_Name: NesEmulator_Screen m_Shader: {fileID: 4800000, guid: b351396ff606116478d7f4412abe4e2e, type: 3} - m_ShaderKeywords: + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: -1 stringTagMap: {} disabledShaderPasses: [] + m_LockedProperties: m_SavedProperties: serializedVersion: 3 m_TexEnvs: @@ -58,6 +63,7 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + m_Ints: [] m_Floats: - _BumpScale: 1 - _ColorMask: 15 @@ -85,3 +91,5 @@ Material: m_Colors: - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.shader index aa024f6..6fcb64d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.shader +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator_Screen.shader @@ -102,10 +102,10 @@ { float2 mapUV = IN.texcoord; - float start= 8.0/272.0; - float end = (272.0-8.0)/272.0; - + float start= 0.02941535; + float end = 0.970582; mapUV.x = lerp(start,end, mapUV.x); + //uv映射改为ugui BaseMeshEffect 机制实现uv映射,比shader代码更为平滑 half4 color = tex2D(_MainTex,mapUV); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs new file mode 100644 index 0000000..d2c437a --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs @@ -0,0 +1,35 @@ +using UnityEngine; +using UnityEngine.UI; + +public class UVRemapper : BaseMeshEffect +{ + public Vector2 uvMin = new Vector2(0, 0); + public Vector2 uvMax = new Vector2(1, 1); + + public override void ModifyMesh(VertexHelper vh) + { + UIVertex vertex = new UIVertex(); + for (int i = 0; i < vh.currentVertCount; i++) + { + vh.PopulateUIVertex(ref vertex, i); + + switch (i % 4) + { + case 0: + vertex.uv0 = uvMin; + break; + case 1: + vertex.uv0 = new Vector2(uvMin.x, uvMax.y); + break; + case 2: + vertex.uv0 = uvMax; + break; + case 3: + vertex.uv0 = new Vector2(uvMax.x, uvMin.y); + break; + } + + vh.SetUIVertex(vertex, i); + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs.meta new file mode 100644 index 0000000..6334dbb --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 68e8ce220f7d51548a7bbea061c7c70e \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs index 4450f03..8fcd3a2 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs @@ -1,3 +1,4 @@ +using AxibugEmuOnline.Client.ClientCore; using System; using System.Runtime.InteropServices; using UnityEngine; @@ -14,7 +15,6 @@ namespace AxibugEmuOnline.Client public RawImage Image; #endregion - #region GPU_TURBO //ͼֽ private int TexBufferSize_gpu; @@ -24,7 +24,9 @@ namespace AxibugEmuOnline.Client private Texture2D wrapTex_gpu; //nesɫ,תΪunity private Texture2D pPal_gpu; + [SerializeField] private Material GPUTurboMat_gpu; + private RenderTexture rt_gpu; #endregion #region CPU @@ -42,13 +44,18 @@ namespace AxibugEmuOnline.Client private void Awake() { DrawCanvas.worldCamera = Camera.main; - GPUTurboMat_gpu = Image.material; } private void OnDestroy() { if (wrapTexBufferGH.IsAllocated) wrapTexBufferGH.Free(); + + if (rt_gpu != null) + { + RenderTexture.ReleaseTemporary(rt_gpu); + rt_gpu = null; + } } public unsafe void SetDrawData(uint* screenData) @@ -61,6 +68,7 @@ namespace AxibugEmuOnline.Client { wrapTex_gpu.LoadRawTextureData(wrapTexBufferPointer_gpu, TexBufferSize_gpu); wrapTex_gpu.Apply(); + Graphics.Blit(wrapTex_gpu, rt_gpu, GPUTurboMat_gpu); } else { @@ -69,27 +77,32 @@ namespace AxibugEmuOnline.Client } } + public void ApplyFilterEffect() + { + Image.texture = App.filter.ExecuteFilterRender(rt_gpu); + } + private unsafe void PrepareUI(uint* screenData) { if (GPUTurbo) { - if (Image.material != GPUTurboMat_gpu) Image.material = GPUTurboMat_gpu; - if (wrapTex_gpu == null) { wrapTex_gpu = new Texture2D(PPU.SCREEN_WIDTH, PPU.SCREEN_HEIGHT, TextureFormat.RGBA32, false); wrapTex_gpu.filterMode = FilterMode.Point; wrapTexBufferPointer_gpu = (IntPtr)screenData; + rt_gpu = RenderTexture.GetTemporary(wrapTex_gpu.width, wrapTex_gpu.height, 0); + rt_gpu.filterMode = FilterMode.Point; + rt_gpu.anisoLevel = 0; + rt_gpu.antiAliasing = 1; TexBufferSize_gpu = wrapTex_gpu.width * wrapTex_gpu.height * 4; } - if (Image.texture != wrapTex_gpu) Image.texture = wrapTex_gpu; + if (Image.texture != rt_gpu) Image.texture = rt_gpu; } else { - if (Image.material == GPUTurboMat_gpu) Image.material = null; - if (wrapTex_cpu == null) { wrapTex_cpu = new Texture2D(PPU.SCREEN_WIDTH - 16, PPU.SCREEN_HEIGHT, TextureFormat.RGBA32, false); @@ -103,6 +116,7 @@ namespace AxibugEmuOnline.Client } if (Image.texture != wrapTex_cpu) Image.texture = wrapTex_cpu; } + } private unsafe void PrepareForGPU(uint* screenData) From 94fb19c4db976afc79459707218b15c5dfe7e6cc Mon Sep 17 00:00:00 2001 From: ALIENJACK Date: Wed, 25 Dec 2024 01:05:18 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E7=A7=BB=E9=99=A4postprocess=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs | 1 - AxibugEmuOnline.Client/Packages/manifest.json | 1 - AxibugEmuOnline.Client/Packages/packages-lock.json | 9 --------- 3 files changed, 11 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs index 44efea2..0a1eafc 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs @@ -1,6 +1,5 @@ using AxibugEmuOnline.Client.ClientCore; using UnityEngine; -using UnityEngine.Rendering.PostProcessing; namespace AxibugEmuOnline.Client { diff --git a/AxibugEmuOnline.Client/Packages/manifest.json b/AxibugEmuOnline.Client/Packages/manifest.json index 847db9d..a91a4da 100644 --- a/AxibugEmuOnline.Client/Packages/manifest.json +++ b/AxibugEmuOnline.Client/Packages/manifest.json @@ -2,7 +2,6 @@ "dependencies": { "com.unity.2d.sprite": "1.0.0", "com.unity.ide.visualstudio": "2.0.22", - "com.unity.postprocessing": "3.4.0", "com.unity.ugui": "2.0.0", "com.unity.modules.accessibility": "1.0.0", "com.unity.modules.ai": "1.0.0", diff --git a/AxibugEmuOnline.Client/Packages/packages-lock.json b/AxibugEmuOnline.Client/Packages/packages-lock.json index 0bd47a4..cfb1599 100644 --- a/AxibugEmuOnline.Client/Packages/packages-lock.json +++ b/AxibugEmuOnline.Client/Packages/packages-lock.json @@ -22,15 +22,6 @@ }, "url": "https://packages.unity.cn" }, - "com.unity.postprocessing": { - "version": "3.4.0", - "depth": 0, - "source": "registry", - "dependencies": { - "com.unity.modules.physics": "1.0.0" - }, - "url": "https://packages.unity.cn" - }, "com.unity.test-framework": { "version": "1.4.5", "depth": 1, From e21093d4193b1e9e004fdc166d789c0e276bcf88 Mon Sep 17 00:00:00 2001 From: ALIENJACK Date: Wed, 25 Dec 2024 13:52:00 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=83=8F=E7=B4=A0=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/AppMain/NesEmulator/VideoProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs index 8fcd3a2..431270b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs @@ -91,7 +91,7 @@ namespace AxibugEmuOnline.Client wrapTex_gpu = new Texture2D(PPU.SCREEN_WIDTH, PPU.SCREEN_HEIGHT, TextureFormat.RGBA32, false); wrapTex_gpu.filterMode = FilterMode.Point; wrapTexBufferPointer_gpu = (IntPtr)screenData; - rt_gpu = RenderTexture.GetTemporary(wrapTex_gpu.width, wrapTex_gpu.height, 0); + rt_gpu = RenderTexture.GetTemporary(256, wrapTex_gpu.height, 0); rt_gpu.filterMode = FilterMode.Point; rt_gpu.anisoLevel = 0; rt_gpu.antiAliasing = 1; From 35548687d0e2a6e803a90eff6bf19eea40262082 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Wed, 25 Dec 2024 14:28:34 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Scene/AxibugEmuOnline.Client.unity | 76 +------- .../Script/AppMain/Filter/FilterEffect.cs | 1 - .../AppMain/Filter/GameCamera Profile.asset | 174 ------------------ .../Filter/GameCamera Profile.asset.meta | 8 - AxibugEmuOnline.Client/Assets/Settings.meta | 8 - .../Assets/Settings/Build Profiles.meta | 8 - 6 files changed, 5 insertions(+), 270 deletions(-) delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset.meta delete mode 100644 AxibugEmuOnline.Client/Assets/Settings.meta delete mode 100644 AxibugEmuOnline.Client/Assets/Settings/Build Profiles.meta diff --git a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity index 623cf05..1fb969e 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity @@ -1010,9 +1010,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1124446957} - - component: {fileID: 1124446960} - - component: {fileID: 1124446959} - - component: {fileID: 1124446958} - component: {fileID: 1124446961} m_Layer: 5 m_Name: FilterPreview @@ -1028,83 +1025,20 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1124446956} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10799.999} m_LocalScale: {x: 0, y: 0, z: 0} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1471857115} - {fileID: 802786939} - m_Father: {fileID: 1335662459} + m_Father: {fileID: 1599240741} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 960.00006, y: 540} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} ---- !u!114 &1124446958 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1124446956} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 4294967295 ---- !u!114 &1124446959 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1124446956} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} - m_Name: - m_EditorClassIdentifier: - m_UiScaleMode: 1 - m_ReferencePixelsPerUnit: 100 - m_ScaleFactor: 1 - m_ReferenceResolution: {x: 1920, y: 1080} - m_ScreenMatchMode: 0 - m_MatchWidthOrHeight: 0 - m_PhysicalUnit: 3 - m_FallbackScreenDPI: 96 - m_DefaultSpriteDPI: 96 - m_DynamicPixelsPerUnit: 1 - m_PresetInfoIsWorld: 0 ---- !u!223 &1124446960 -Canvas: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1124446956} - m_Enabled: 1 - serializedVersion: 3 - m_RenderMode: 1 - m_Camera: {fileID: 0} - m_PlaneDistance: 100 - m_PixelPerfect: 0 - m_ReceivesEvents: 1 - m_OverrideSorting: 0 - m_OverridePixelPerfect: 0 - m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 - m_AdditionalShaderChannelsFlag: 1 - m_UpdateRectTransformForStandalone: 0 - m_SortingLayerID: 0 - m_SortingOrder: 1 - m_TargetDisplay: 0 --- !u!225 &1124446961 CanvasGroup: m_ObjectHideFlags: 0 @@ -1156,7 +1090,6 @@ Transform: - {fileID: 74796459} - {fileID: 1427887270} - {fileID: 1599240741} - - {fileID: 1124446957} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1335662460 @@ -2020,6 +1953,7 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 1124446957} - {fileID: 1983793178} - {fileID: 939125854} - {fileID: 1318590597} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs index 4efceab..c00f2b3 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using UnityEngine; -using UnityEngine.Rendering; namespace AxibugEmuOnline.Client { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset deleted file mode 100644 index ffb3670..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset +++ /dev/null @@ -1,174 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &-2985742813244632235 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 98a055cea8a1355429d1cbb752c4e60e, type: 3} - m_Name: MattiasCRT - m_EditorClassIdentifier: - active: 1 - enabled: - overrideState: 1 - value: 1 ---- !u!114 &-1232074899445057866 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e88ab71ab1a47d048ba0e45b742f6140, type: 3} - m_Name: FixingPixelArtGrille - m_EditorClassIdentifier: - active: 1 - enabled: - overrideState: 1 - value: 0 - MaskStyle: - overrideState: 0 - value: 1 - DrawResolution: - overrideState: 0 - value: {x: 272, y: 240} - HardScan: - overrideState: 0 - value: -10 - HardPix: - overrideState: 0 - value: -2 - HardBloomScan: - overrideState: 0 - value: -4 - HardBloomPix: - overrideState: 0 - value: -1.5 - BloomAmount: - overrideState: 0 - value: 0.0625 - Warp: - overrideState: 0 - value: {x: 0.015625, y: 0.041666668} - MaskLight: - overrideState: 0 - value: 1.5 - MaskDrak: - overrideState: 0 - value: 0.5 ---- !u!114 &-65063800318898424 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2a0a5286ac74b734ba8d1e0cfdfb9c8d, type: 3} - m_Name: LCDPostEffect - m_EditorClassIdentifier: - active: 1 - enabled: - overrideState: 1 - value: 0 ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8e6292b2c06870d4495f009f912b9600, type: 3} - m_Name: GameCamera Profile - m_EditorClassIdentifier: - settings: - - {fileID: -1232074899445057866} - - {fileID: -65063800318898424} - - {fileID: 1989879740823951492} ---- !u!114 &117625959343581733 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e88ab71ab1a47d048ba0e45b742f6140, type: 3} - m_Name: FixingPixelArtGrille - m_EditorClassIdentifier: - active: 1 - enabled: - overrideState: 1 - value: 1 - MaskStyle: - overrideState: 0 - value: 1 - DrawResolution: - overrideState: 0 - value: {x: 272, y: 240} - HardScan: - overrideState: 0 - value: -10 - HardPix: - overrideState: 0 - value: -2 - HardBloomScan: - overrideState: 0 - value: -4 - HardBloomPix: - overrideState: 0 - value: -1.5 - BloomAmount: - overrideState: 0 - value: 0.0625 - Warp: - overrideState: 0 - value: {x: 0.015625, y: 0.041666668} - MaskLight: - overrideState: 0 - value: 1.5 - MaskDrak: - overrideState: 0 - value: 0.5 ---- !u!114 &1989879740823951492 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 98a055cea8a1355429d1cbb752c4e60e, type: 3} - m_Name: MattiasCRT - m_EditorClassIdentifier: - active: 1 - enabled: - overrideState: 1 - value: 0 ---- !u!114 &2118329037781486242 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2a0a5286ac74b734ba8d1e0cfdfb9c8d, type: 3} - m_Name: LCDPostEffect - m_EditorClassIdentifier: - active: 1 - enabled: - overrideState: 1 - value: 1 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset.meta deleted file mode 100644 index 5376e6d..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/GameCamera Profile.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 17060e2d2f9e5c340a526f08317e5a98 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Settings.meta b/AxibugEmuOnline.Client/Assets/Settings.meta deleted file mode 100644 index 725e849..0000000 --- a/AxibugEmuOnline.Client/Assets/Settings.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7c3fabe6430be6943b1fc06a25a275a8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Settings/Build Profiles.meta b/AxibugEmuOnline.Client/Assets/Settings/Build Profiles.meta deleted file mode 100644 index c98514c..0000000 --- a/AxibugEmuOnline.Client/Assets/Settings/Build Profiles.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 13795c31ef56b3648a06122c6b1864f3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: From f129651e99cddb2da4ff59716b7e28d59f0d6fdc Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Wed, 25 Dec 2024 14:41:35 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Script/AppMain/NesEmulator/UVRemapper.cs | 35 ------------------- .../AppMain/NesEmulator/UVRemapper.cs.meta | 2 -- 2 files changed, 37 deletions(-) delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs delete mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs deleted file mode 100644 index d2c437a..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs +++ /dev/null @@ -1,35 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; - -public class UVRemapper : BaseMeshEffect -{ - public Vector2 uvMin = new Vector2(0, 0); - public Vector2 uvMax = new Vector2(1, 1); - - public override void ModifyMesh(VertexHelper vh) - { - UIVertex vertex = new UIVertex(); - for (int i = 0; i < vh.currentVertCount; i++) - { - vh.PopulateUIVertex(ref vertex, i); - - switch (i % 4) - { - case 0: - vertex.uv0 = uvMin; - break; - case 1: - vertex.uv0 = new Vector2(uvMin.x, uvMax.y); - break; - case 2: - vertex.uv0 = uvMax; - break; - case 3: - vertex.uv0 = new Vector2(uvMax.x, uvMin.y); - break; - } - - vh.SetUIVertex(vertex, i); - } - } -} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs.meta deleted file mode 100644 index 6334dbb..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/UVRemapper.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 68e8ce220f7d51548a7bbea061c7c70e \ No newline at end of file From 91ca428269ae622e7bfabb8f43bc3257d670d79c Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Wed, 25 Dec 2024 14:42:50 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=BB=A4=E9=95=9C=E6=9C=BA=E5=88=B6?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=BF=AE=E6=94=B9,=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E9=99=90=E5=88=B6=E6=BA=90=E7=BA=B9=E7=90=86=E8=A6=81=E6=B1=82?= =?UTF-8?q?rendertexture=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Script/AppMain/Filter/FilterEffect.cs | 8 ++--- .../Script/AppMain/Filter/FilterManager.cs | 6 ++-- .../FixingPixelArtGrille.cs | 4 +-- .../Filter/LCDPostEffect/LCDPostEffect.cs | 4 +-- .../AppMain/Filter/MattiasCRT/MattiasCRT.cs | 6 ++-- .../AppMain/NesEmulator/VideoProvider.cs | 36 +++++++++---------- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs index c00f2b3..9ec1ef0 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterEffect.cs @@ -48,13 +48,13 @@ namespace AxibugEmuOnline.Client } } - public void Render(RenderTexture rt, RenderTexture result) + public void Render(Texture src, RenderTexture result) { - m_material.SetTexture("_MainTex", rt); - OnRenderer(m_material, rt, result); + m_material.SetTexture("_MainTex", src); + OnRenderer(m_material, src, result); } - protected abstract void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result); + protected abstract void OnRenderer(Material renderMat, Texture src, RenderTexture result); public class EditableParamerter { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs index 92d5a81..03a6b8a 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FilterManager.cs @@ -38,7 +38,7 @@ namespace AxibugEmuOnline.Client } private RenderTexture result = null; - public RenderTexture ExecuteFilterRender(RenderTexture rt) + public Texture ExecuteFilterRender(Texture src) { if (result == null) result = RenderTexture.GetTemporary(Screen.width, Screen.height); @@ -47,14 +47,14 @@ namespace AxibugEmuOnline.Client foreach (var filter in Filters) { if (!filter.m_setting.Enable.GetValue()) continue; - filter.m_setting.Render(rt, result); + filter.m_setting.Render(src, result); anyFilterEnable = true; } if (anyFilterEnable) return result; else - return rt; + return src; } /// 关闭滤镜预览 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs index df690a3..999267e 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/FixingPixelArtGrille/FixingPixelArtGrille.cs @@ -34,7 +34,7 @@ public sealed class FixingPixelArtGrille : FilterEffect } - protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result) + protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result) { renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0)); renderMat.SetVector("_res", new Vector4(DrawResolution.GetValue().x, DrawResolution.GetValue().y, 0, 0)); @@ -67,6 +67,6 @@ public sealed class FixingPixelArtGrille : FilterEffect renderMat.EnableKeyword("_MASKSTYLE_STRETCHEDVGA"); break; } - Graphics.Blit(rt, result, renderMat); + Graphics.Blit(src, result, renderMat); } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs index 94b1d78..f8ccca3 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/LCDPostEffect/LCDPostEffect.cs @@ -7,9 +7,9 @@ public sealed class LCDPostEffect : FilterEffect protected override string ShaderName => "Filter/LCDPostEffect"; - protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result) + protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result) { renderMat.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); - Graphics.Blit(rt, result, renderMat); + Graphics.Blit(src, result, renderMat); } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs index 01716dc..6e6c79d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/MattiasCRT/MattiasCRT.cs @@ -1,4 +1,4 @@ -using AxibugEmuOnline.Client; +using AxibugEmuOnline.Client; using UnityEngine; public sealed class MattiasCRT : FilterEffect @@ -7,9 +7,9 @@ public sealed class MattiasCRT : FilterEffect protected override string ShaderName => "Filter/MattiasCRT"; - protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result) + protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result) { renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0)); - Graphics.Blit(rt, result, renderMat); + Graphics.Blit(src, result, renderMat); } } \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs index 431270b..680a3d1 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/VideoProvider.cs @@ -1,4 +1,4 @@ -using AxibugEmuOnline.Client.ClientCore; +using AxibugEmuOnline.Client.ClientCore; using System; using System.Runtime.InteropServices; using UnityEngine; @@ -16,13 +16,13 @@ namespace AxibugEmuOnline.Client #endregion #region GPU_TURBO - //ͼֽ + //图像数据字节数 private int TexBufferSize_gpu; - //ͼָ + //图像数据指针 private IntPtr wrapTexBufferPointer_gpu; - //Unity 2D,UIϻ + //Unity 2D纹理对象,用于UI上绘制最终输出画面 private Texture2D wrapTex_gpu; - //nesɫ,תΪunity + //nes调色板数据,已转换为unity纹理对象 private Texture2D pPal_gpu; [SerializeField] private Material GPUTurboMat_gpu; @@ -30,12 +30,12 @@ namespace AxibugEmuOnline.Client #endregion #region CPU - //ͼֽ + //图像数据字节数 private int TexBufferSize_cpu; - //ͼָ + //图像数据指针 private GCHandle wrapTexBufferGH; private IntPtr wrapTexBufferPointer_cpu; - //Unity 2D,UIϻ + //Unity 2D纹理对象,用于UI上绘制最终输出画面 private Texture2D wrapTex_cpu; #endregion @@ -61,8 +61,8 @@ namespace AxibugEmuOnline.Client public unsafe void SetDrawData(uint* screenData) { PrepareUI(screenData); - if (GPUTurbo) PrepareForGPU(screenData);//жʹGPUCPU - else PrepareForCPU(screenData);//ʹCPU + if (GPUTurbo) PrepareForGPU(screenData);//判断使用GPU还是CPU + else PrepareForCPU(screenData);//使用CPU if (GPUTurbo) { @@ -155,7 +155,7 @@ namespace AxibugEmuOnline.Client for (int line = 0; line < PPU.SCREEN_HEIGHT; line++) { - //PSCPU㣬ȼ16IJҪ֣ܶ + //PS:如果是CPU计算,宽度减少16的不必要部分,才能对齐 width = PPU.SCREEN_WIDTH - 16; while (width > 0) @@ -163,17 +163,17 @@ namespace AxibugEmuOnline.Client var edx = screenData[pScn + 8]; uint index = edx & 0xFF; - //±ɫұʵɫ + //按下标颜色查找表中真实颜色 var colorData = palRaw[index]; - //dstɫΪabgr,colorDataΪargb - uint r = (colorData & 0x00FF0000) >> 16; // ȡRedͨ - uint g = (colorData & 0x0000FF00) >> 8; // ȡGreenͨ - uint b = (colorData & 0x000000FF); // ȡBlueͨ + //dst中颜色排列为abgr,而colorData排列为argb + uint r = (colorData & 0x00FF0000) >> 16; // 提取Red通道 + uint g = (colorData & 0x0000FF00) >> 8; // 提取Green通道 + uint b = (colorData & 0x000000FF); // 提取Blue通道 - //rgbɫunity rgb System.Drawing.Color ɫ + //用rgb构建颜色对象(如果非unity 可以用这个rgb 构建System.Drawing.Color 单个颜色对象) uint abgr = 0xFF000000 | (b << 16) | (g << 8) | (r << 0); - //Žɫ + //放进颜色矩阵 Dst[pDst] = abgr; pScn += 1; From bac3e514b6e28450b9ab1442d9d4292044dea975 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Wed, 25 Dec 2024 14:43:25 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=BB=A4=E9=95=9C=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E9=80=82=E9=85=8D=E6=BB=A4=E9=95=9C=E6=9C=BA?= =?UTF-8?q?=E5=88=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Scene/AxibugEmuOnline.Client.unity | 64 ++++++++++++------- .../AppMain/Filter/UIFilterPreviewer.cs | 21 ++++++ .../AppMain/Filter/UIFilterPreviewer.cs.meta | 2 + 3 files changed, 64 insertions(+), 23 deletions(-) create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity index 1fb969e..ae4dfb2 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity @@ -353,7 +353,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_SizeDelta.x - value: -0.97058296 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_SizeDelta.y @@ -389,7 +389,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_AnchoredPosition.x - value: -0.48529053 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_AnchoredPosition.y @@ -931,7 +931,8 @@ GameObject: m_Component: - component: {fileID: 802786939} - component: {fileID: 802786941} - - component: {fileID: 802786940} + - component: {fileID: 802786942} + - component: {fileID: 802786943} m_Layer: 5 m_Name: Image2 m_TagString: Untagged @@ -958,7 +959,15 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &802786940 +--- !u!222 &802786941 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 802786938} + m_CullTransparentMesh: 1 +--- !u!114 &802786942 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -967,7 +976,7 @@ MonoBehaviour: m_GameObject: {fileID: 802786938} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} @@ -978,24 +987,25 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: e043954733c440645ba43b09301ee4a6, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!222 &802786941 -CanvasRenderer: + m_Texture: {fileID: 2800000, guid: e043954733c440645ba43b09301ee4a6, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!114 &802786943 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 802786938} - m_CullTransparentMesh: 1 + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a0987fcca76655248ac8defaffd1cb45, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!224 &939125854 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} @@ -1026,8 +1036,8 @@ RectTransform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1124446956} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -10799.999} - m_LocalScale: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1471857115} @@ -1035,10 +1045,10 @@ RectTransform: m_Father: {fileID: 1599240741} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 960.00006, y: 540} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} --- !u!225 &1124446961 CanvasGroup: m_ObjectHideFlags: 0 @@ -2235,6 +2245,10 @@ PrefabInstance: propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 736530578155193984, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 935090267056593628, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -2727,6 +2741,10 @@ PrefabInstance: propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 8801936766261209235, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs new file mode 100644 index 0000000..8ba8837 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs @@ -0,0 +1,21 @@ +using AxibugEmuOnline.Client.ClientCore; +using UnityEngine; +using UnityEngine.UI; + +[RequireComponent(typeof(RawImage))] +public class UIFilterPreviewer : MonoBehaviour +{ + private RawImage m_rawImg; + private Texture m_src; + + private void Awake() + { + m_rawImg = GetComponent(); + m_src = m_rawImg.texture; + } + + private void Update() + { + m_rawImg.texture = App.filter.ExecuteFilterRender(m_src); + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs.meta new file mode 100644 index 0000000..8e6b7bd --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Filter/UIFilterPreviewer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a0987fcca76655248ac8defaffd1cb45 \ No newline at end of file