diff --git a/AxibugEmuOnline.Client/Assets/Scene/EmuTest.unity b/AxibugEmuOnline.Client/Assets/Scene/EmuTest.unity index c3cf300..e73c73e 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/EmuTest.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/EmuTest.unity @@ -123,51 +123,6 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &149545946 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 149545948} - - component: {fileID: 149545947} - m_Layer: 0 - m_Name: NesEmulator - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &149545947 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 149545946} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 39557e19783acee499ace6c68549e8f8, type: 3} - m_Name: - m_EditorClassIdentifier: - VideoProvider: {fileID: 1295252151} ---- !u!4 &149545948 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 149545946} - 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_Children: - - {fileID: 1295252150} - m_Father: {fileID: 0} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &708549044 GameObject: m_ObjectHideFlags: 0 @@ -261,78 +216,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1 &861747459 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 861747460} - - component: {fileID: 861747462} - - component: {fileID: 861747461} - m_Layer: 5 - m_Name: RawImage - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &861747460 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 861747459} - 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_Children: [] - m_Father: {fileID: 1727033528} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 100, y: 100} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &861747461 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 861747459} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} - m_Name: - m_EditorClassIdentifier: - 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} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Texture: {fileID: 8400000, guid: ffe34aaf87e4b9942b4c2ac05943d444, type: 2} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!222 &861747462 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 861747459} - m_CullTransparentMesh: 1 --- !u!1 &1232273651 GameObject: m_ObjectHideFlags: 0 @@ -416,51 +299,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1295252149 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1295252150} - - component: {fileID: 1295252151} - m_Layer: 0 - m_Name: VideoProvider - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1295252150 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1295252149} - 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_Children: - - {fileID: 1727033528} - m_Father: {fileID: 149545948} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1295252151 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1295252149} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 83fbe375412d1af4482ae76e81c1dda2, type: 3} - m_Name: - m_EditorClassIdentifier: - Image: {fileID: 861747461} --- !u!1 &1359344831 GameObject: m_ObjectHideFlags: 0 @@ -527,103 +365,60 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1727033527 -GameObject: +--- !u!1001 &4232056520998800727 +PrefabInstance: m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1727033528} - - component: {fileID: 1727033531} - - component: {fileID: 1727033530} - - component: {fileID: 1727033529} - m_Layer: 5 - m_Name: Canvas - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1727033528 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1727033527} - 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_Children: - - {fileID: 861747460} - m_Father: {fileID: 1295252150} - m_RootOrder: 0 - 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_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0, y: 0} ---- !u!114 &1727033529 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1727033527} - 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 &1727033530 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1727033527} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} - m_Name: - m_EditorClassIdentifier: - m_UiScaleMode: 0 - m_ReferencePixelsPerUnit: 100 - m_ScaleFactor: 1 - m_ReferenceResolution: {x: 800, y: 600} - m_ScreenMatchMode: 0 - m_MatchWidthOrHeight: 0 - m_PhysicalUnit: 3 - m_FallbackScreenDPI: 96 - m_DefaultSpriteDPI: 96 - m_DynamicPixelsPerUnit: 1 - m_PresetInfoIsWorld: 0 ---- !u!223 &1727033531 -Canvas: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1727033527} - m_Enabled: 1 - serializedVersion: 3 - m_RenderMode: 0 - m_Camera: {fileID: 0} - m_PlaneDistance: 100 - m_PixelPerfect: 0 - m_ReceivesEvents: 1 - m_OverrideSorting: 0 - m_OverridePixelPerfect: 0 - m_SortingBucketNormalizedSize: 0 - m_AdditionalShaderChannelsFlag: 0 - m_SortingLayerID: 0 - m_SortingOrder: 0 - m_TargetDisplay: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4232056521131536013, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} + propertyPath: m_Name + value: NesEmulator + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3} diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs index a7c7010..308cd88 100644 --- a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs @@ -41,6 +41,7 @@ namespace AxibugEmuOnline.Client m_nesIns = null; } + private void Update() { if (m_nesIns != null) @@ -53,10 +54,5 @@ namespace AxibugEmuOnline.Client VideoProvider.SetDrawData(screenBuffer, lineColorMode, 256, 240); } } - - private void OnDestroy() - { - File.WriteAllLines("E:/log.txt", Debuger.logRecords); - } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.prefab b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.prefab new file mode 100644 index 0000000..d695d77 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.prefab @@ -0,0 +1,264 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4232056520112715746 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4232056520112715745} + - component: {fileID: 4232056520112715744} + m_Layer: 0 + m_Name: VideoProvider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4232056520112715745 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232056520112715746} + 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_Children: + - {fileID: 4232056520494431727} + m_Father: {fileID: 4232056521131536011} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4232056520112715744 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232056520112715746} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 83fbe375412d1af4482ae76e81c1dda2, type: 3} + m_Name: + m_EditorClassIdentifier: + Image: {fileID: 4232056521759880274} +--- !u!1 &4232056520494431712 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4232056520494431727} + - component: {fileID: 4232056520494431724} + - component: {fileID: 4232056520494431725} + - component: {fileID: 4232056520494431726} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4232056520494431727 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232056520494431712} + 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_Children: + - {fileID: 4232056521759880275} + m_Father: {fileID: 4232056520112715745} + m_RootOrder: 0 + 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_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!223 &4232056520494431724 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232056520494431712} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!114 &4232056520494431725 +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: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + 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 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4232056521131536011} + - component: {fileID: 4232056521131536012} + m_Layer: 0 + m_Name: NesEmulator + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4232056521131536011 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232056521131536013} + 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_Children: + - {fileID: 4232056520112715745} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4232056521131536012 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232056521131536013} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 39557e19783acee499ace6c68549e8f8, type: 3} + m_Name: + m_EditorClassIdentifier: + VideoProvider: {fileID: 4232056520112715744} +--- !u!1 &4232056521759880276 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4232056521759880275} + - component: {fileID: 4232056521759880273} + - component: {fileID: 4232056521759880274} + m_Layer: 5 + m_Name: RawImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4232056521759880275 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232056521759880276} + 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_Children: [] + m_Father: {fileID: 4232056520494431727} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 272, y: 240} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4232056521759880273 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232056521759880276} + m_CullTransparentMesh: 1 +--- !u!114 &4232056521759880274 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232056521759880276} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: + 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} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 8400000, guid: ffe34aaf87e4b9942b4c2ac05943d444, type: 2} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.prefab.meta b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.prefab.meta new file mode 100644 index 0000000..6e48698 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f8bea3f8aa351bb46ada33b2274729ea +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/VideoProvider.cs b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/VideoProvider.cs index 662bac7..b4372e3 100644 --- a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/VideoProvider.cs +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/VideoProvider.cs @@ -4,8 +4,10 @@ using System; using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using UnityEngine; +using UnityEngine.Playables; using UnityEngine.UI; using VirtualNes.Core; @@ -15,24 +17,32 @@ namespace AxibugEmuOnline.Client { public RawImage Image; + private Color32[] wrapTexBuffer; + private IntPtr wrapTexBufferPointer; private Texture2D wrapTex; public void SetDrawData(byte[] screenData, byte[] lineColorMode, int screenWidth, int screenHeight) { - if (wrapTex == null) wrapTex = new Texture2D(screenWidth, screenHeight); - - var str = Encoding.ASCII.GetString(screenData, 0, screenData.Length); + if (wrapTex == null) + { + wrapTex = new Texture2D(screenWidth, screenHeight, TextureFormat.BGRA32, false); + wrapTexBuffer = new Color32[screenWidth * screenHeight]; + // 固定数组,防止垃圾回收器移动它 + GCHandle handle = GCHandle.Alloc(wrapTexBuffer, GCHandleType.Pinned); + // 获取数组的指针 + wrapTexBufferPointer = handle.AddrOfPinnedObject(); + } uint[] pPal; int pScn = 0; int width; - var Dst = wrapTex.GetPixels32(); + var Dst = wrapTexBuffer; var pDst = 0; for (int line = 0; line < screenHeight; line++) { - if ((lineColorMode[line] & 0x80) != 0) + if ((lineColorMode[line] & 0x80) == 0) { pPal = PaletteDefine.m_cnPalette[lineColorMode[line] & 0x07]; } @@ -45,8 +55,7 @@ namespace AxibugEmuOnline.Client while (width > 0) { - Color32 temp = new Color32(255, 255, 255, 255); - var edx = screenData[pScn]; + var edx = screenData[pScn + 8]; byte index = (byte)(edx & 0xFF); var colorData = pPal[index]; @@ -61,7 +70,8 @@ namespace AxibugEmuOnline.Client pScn += PPU.SCREEN_WIDTH - screenWidth; } - wrapTex.SetPixels32(Dst); + //wrapTex.SetPixels32(wrapTexBuffer); + wrapTex.LoadRawTextureData(wrapTexBufferPointer, screenWidth * screenHeight * 4); wrapTex.Apply(); Graphics.Blit(wrapTex, Image.mainTexture as RenderTexture); diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CPU.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CPU.cs index 4594c8b..5203e1a 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CPU.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/CPU.cs @@ -1,6 +1,7 @@ 锘#undef DPCM_SYNCCLOCK using System; +using VirtualNes.Core.Debug; namespace VirtualNes.Core { @@ -42,7 +43,7 @@ namespace VirtualNes.Core private int DMA_cycles; private Mapper mapper; private APU apu; - private R6502 R = new R6502(); + internal R6502 R = new R6502(); private byte[] ZN_Table = new byte[256]; private Memory STACK; @@ -132,75 +133,77 @@ namespace VirtualNes.Core switch (opcode) { - case 0x69: + case 0x69: // ADC #$?? MR_IM(); ADC(); ADD_CYCLE(2); break; - case 0x65: + case 0x65: // ADC $?? MR_ZP(); ADC(); ADD_CYCLE(3); break; - case 0x75: + case 0x75: // ADC $??,X MR_ZX(); ADC(); ADD_CYCLE(4); break; - case 0x6D: + case 0x6D: // ADC $???? MR_AB(); ADC(); ADD_CYCLE(4); break; - case 0x7D: + case 0x7D: // ADC $????,X MR_AX(); ADC(); CHECK_EA(); ADD_CYCLE(4); break; - case 0x79: + case 0x79: // ADC $????,Y MR_AY(); ADC(); CHECK_EA(); ADD_CYCLE(4); break; - case 0x61: + case 0x61: // ADC ($??,X) MR_IX(); ADC(); ADD_CYCLE(6); break; - case 0x71: + case 0x71: // ADC ($??),Y MR_IY(); ADC(); CHECK_EA(); ADD_CYCLE(4); break; - case 0xE9: + + case 0xE9: // SBC #$?? MR_IM(); SBC(); ADD_CYCLE(2); break; - case 0xE5: + case 0xE5: // SBC $?? MR_ZP(); SBC(); ADD_CYCLE(3); break; - case 0xF5: + case 0xF5: // SBC $??,X MR_ZX(); SBC(); ADD_CYCLE(4); break; - case 0xED: + case 0xED: // SBC $???? MR_AB(); SBC(); ADD_CYCLE(4); break; - case 0xFD: + case 0xFD: // SBC $????,X MR_AX(); SBC(); CHECK_EA(); ADD_CYCLE(4); break; - case 0xF9: // SBC $????Y + case 0xF9: // SBC $????,Y MR_AY(); SBC(); CHECK_EA(); ADD_CYCLE(4); break; - case 0xE1: // SBC ($??X) + case 0xE1: // SBC ($??,X) MR_IX(); SBC(); ADD_CYCLE(6); break; - case 0xF1: // SBC ($??)Y + case 0xF1: // SBC ($??),Y MR_IY(); SBC(); CHECK_EA(); ADD_CYCLE(5); break; + case 0xC6: // DEC $?? MR_ZP(); DEC(); MW_ZP(); ADD_CYCLE(5); break; - case 0xD6: // DEC $??X + case 0xD6: // DEC $??,X MR_ZX(); DEC(); MW_ZP(); ADD_CYCLE(6); break; @@ -208,10 +211,11 @@ namespace VirtualNes.Core MR_AB(); DEC(); MW_EA(); ADD_CYCLE(6); break; - case 0xDE: // DEC $????X + case 0xDE: // DEC $????,X MR_AX(); DEC(); MW_EA(); ADD_CYCLE(7); break; + case 0xCA: // DEX DEX(); ADD_CYCLE(2); @@ -220,11 +224,12 @@ namespace VirtualNes.Core DEY(); ADD_CYCLE(2); break; + case 0xE6: // INC $?? MR_ZP(); INC(); MW_ZP(); ADD_CYCLE(5); break; - case 0xF6: // INC $??X + case 0xF6: // INC $??,X MR_ZX(); INC(); MW_ZP(); ADD_CYCLE(6); break; @@ -232,10 +237,11 @@ namespace VirtualNes.Core MR_AB(); INC(); MW_EA(); ADD_CYCLE(6); break; - case 0xFE: // INC $????X + case 0xFE: // INC $????,X MR_AX(); INC(); MW_EA(); ADD_CYCLE(7); break; + case 0xE8: // INX INX(); ADD_CYCLE(2); @@ -244,6 +250,7 @@ namespace VirtualNes.Core INY(); ADD_CYCLE(2); break; + case 0x29: // AND #$?? MR_IM(); AND(); ADD_CYCLE(2); @@ -252,7 +259,7 @@ namespace VirtualNes.Core MR_ZP(); AND(); ADD_CYCLE(3); break; - case 0x35: // AND $??X + case 0x35: // AND $??,X MR_ZX(); AND(); ADD_CYCLE(4); break; @@ -260,22 +267,23 @@ namespace VirtualNes.Core MR_AB(); AND(); ADD_CYCLE(4); break; - case 0x3D: // AND $????X + case 0x3D: // AND $????,X MR_AX(); AND(); CHECK_EA(); ADD_CYCLE(4); break; - case 0x39: // AND $????Y + case 0x39: // AND $????,Y MR_AY(); AND(); CHECK_EA(); ADD_CYCLE(4); break; - case 0x21: // AND ($??X) + case 0x21: // AND ($??,X) MR_IX(); AND(); ADD_CYCLE(6); break; - case 0x31: // AND ($??)Y + case 0x31: // AND ($??),Y MR_IY(); AND(); CHECK_EA(); ADD_CYCLE(5); break; + case 0x0A: // ASL A ASL_A(); ADD_CYCLE(2); @@ -705,7 +713,7 @@ namespace VirtualNes.Core ADD_CYCLE(6); break; - // 鍍煎剶鍍屾儌灞煎 + // 銉曘儵銈板埗寰$郴 case 0x18: // CLC CLC(); ADD_CYCLE(2); @@ -736,7 +744,7 @@ namespace VirtualNes.Core ADD_CYCLE(2); break; - // 鍍楀優鍍㈠儖瀹 + // 銈广偪銉冦偗绯 case 0x48: // PHA PUSH(R.A); ADD_CYCLE(3); @@ -755,7 +763,7 @@ namespace VirtualNes.Core ADD_CYCLE(4); break; - // 鍋﹀伜鎳 + // 銇濄伄浠 case 0x00: // BRK BRK(); ADD_CYCLE(7); @@ -765,7 +773,7 @@ namespace VirtualNes.Core ADD_CYCLE(2); break; - // 鏋瑰矠濂愭煢妞峰 + // 鏈叕闁嬪懡浠ょ兢 case 0x0B: // ANC #$?? case 0x2B: // ANC #$?? MR_IM(); ANC(); @@ -1105,7 +1113,7 @@ namespace VirtualNes.Core default: if (!Supporter.Config.emulator.bIllegalOp) { - throw new Exception("Illegal Opcode"); + throw new Exception("IllegalOp"); } else { @@ -1113,6 +1121,8 @@ namespace VirtualNes.Core ADD_CYCLE(4); } break; + // default: + // __assume(0); } if (nmi_request != 0) @@ -1143,7 +1153,6 @@ namespace VirtualNes.Core #endif return TOTAL_cycles - OLD_cycles; } - private void _IRQ() { PUSH((byte)(R.PC >> 8)); @@ -1836,7 +1845,7 @@ namespace VirtualNes.Core { ET = OP6502W(R.PC); R.PC += 2; - EA = (byte)(ET + R.X); + EA = (ushort)(ET + R.X); DT = RD6502(EA); } diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Debuger.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Debuger.cs index 526ef75..21ab49a 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Debuger.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Debuger.cs @@ -4,8 +4,6 @@ namespace VirtualNes.Core.Debug { public static class Debuger { - public static List logRecords = new List(); - private static IDebugerImpl s_debuger; public static void Setup(IDebugerImpl debuger) { @@ -14,7 +12,6 @@ namespace VirtualNes.Core.Debug public static void Log(string message) { s_debuger.Log(message); - logRecords.Add(message); } public static void LogError(string message) diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/NES.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/NES.cs index aad3066..39c67ce 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/NES.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/NES.cs @@ -486,8 +486,11 @@ namespace VirtualNes.Core m_CheatCode.Clear(); } + private int FrameCount = 0; public void EmulateFrame(bool bDraw) { + FrameCount++; + int scanline = 0; if (rom.IsNSF()) { @@ -498,6 +501,7 @@ namespace VirtualNes.Core CheatCodeProcess(); NES_scanline = scanline; + bool NotTile = RenderMethod != EnumRenderMethod.TILE_RENDER; if (RenderMethod != EnumRenderMethod.TILE_RENDER) { @@ -917,6 +921,7 @@ namespace VirtualNes.Core } } + int CPU_CALL_COUNT = 0; internal void EmulationCPU(int basecycles) { int cycles; @@ -926,8 +931,11 @@ namespace VirtualNes.Core if (cycles > 0) { - emul_cycles += cpu.EXEC(cycles); + var cycleAdd = cpu.EXEC(cycles); + emul_cycles += cycleAdd; } + + CPU_CALL_COUNT++; } internal void Reset() @@ -1041,10 +1049,7 @@ namespace VirtualNes.Core apu.SoundSetup(); } - public void SetRenderMethod(EnumRenderMethod type) - { - RenderMethod = type; - } + internal void SoftReset() { @@ -1514,14 +1519,12 @@ namespace VirtualNes.Core return ret; } - - static int NESWRITECOUNT = 0; + public void SetRenderMethod(EnumRenderMethod type) + { + RenderMethod = type; + } internal void Write(ushort addr, byte data) { - NESWRITECOUNT++; - - Debuger.Log($"[{NESWRITECOUNT}] addr:{addr},data:{data}"); - switch (addr >> 13) { case 0x00: // $0000-$1FFF diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/EmulatorConfig/EmulatorConfig.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/EmulatorConfig/EmulatorConfig.cs index 77f78a8..b24afe0 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/EmulatorConfig/EmulatorConfig.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/EmulatorConfig/EmulatorConfig.cs @@ -34,12 +34,18 @@ public static void Load(uint crc) { - + nRenderMethod = defRenderMethod; + nIRQtype = defIRQtype; + bFrameIRQ = defFrameIRQ; + bVideoMode = defVideoMode; } public static void Load(uint gid, uint mid) { - + nRenderMethod = defRenderMethod; + nIRQtype = defIRQtype; + bFrameIRQ = defFrameIRQ; + bVideoMode = defVideoMode; } } } diff --git a/virtuanessrc097-master/NES/CPU.h b/virtuanessrc097-master/NES/CPU.h index 8186433..52971de 100644 Binary files a/virtuanessrc097-master/NES/CPU.h and b/virtuanessrc097-master/NES/CPU.h differ diff --git a/virtuanessrc097-master/NES/Cpu.cpp b/virtuanessrc097-master/NES/Cpu.cpp index 7fdbd33..2c598ef 100644 Binary files a/virtuanessrc097-master/NES/Cpu.cpp and b/virtuanessrc097-master/NES/Cpu.cpp differ diff --git a/virtuanessrc097-master/NES/Nes.cpp b/virtuanessrc097-master/NES/Nes.cpp index 152062b..5da99b5 100644 Binary files a/virtuanessrc097-master/NES/Nes.cpp and b/virtuanessrc097-master/NES/Nes.cpp differ diff --git a/virtuanessrc097-master/NES/Nes.h b/virtuanessrc097-master/NES/Nes.h index a5501ce..90acdbd 100644 Binary files a/virtuanessrc097-master/NES/Nes.h and b/virtuanessrc097-master/NES/Nes.h differ