forked from sin365/AxibugEmuOnline
修复存档问题
This commit is contained in:
parent
e9dd949c10
commit
ae9fee30ef
@ -30,7 +30,7 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4232056521131536011}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &9003897287163669553
|
||||
MonoBehaviour:
|
||||
@ -141,6 +141,78 @@ AudioSource:
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &3297772745682094737
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3430872171738201552}
|
||||
- component: {fileID: 183509793067265912}
|
||||
- component: {fileID: 1908580308043775702}
|
||||
m_Layer: 5
|
||||
m_Name: img
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3430872171738201552
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3297772745682094737}
|
||||
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: 1038087993597378172}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &183509793067265912
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3297772745682094737}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1908580308043775702
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3297772745682094737}
|
||||
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: 0}
|
||||
m_UVRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
--- !u!1 &3545890545112170401
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -150,8 +222,7 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1038087993597378172}
|
||||
- component: {fileID: 3032498056073774270}
|
||||
- component: {fileID: 634277252673086327}
|
||||
- component: {fileID: 4772135422360773263}
|
||||
m_Layer: 5
|
||||
m_Name: Viewer
|
||||
m_TagString: Untagged
|
||||
@ -166,27 +237,21 @@ RectTransform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3545890545112170401}
|
||||
m_LocalRotation: {x: 1, y: 0, z: 0, w: 0}
|
||||
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_Children:
|
||||
- {fileID: 3430872171738201552}
|
||||
- {fileID: 5684774662137182450}
|
||||
m_Father: {fileID: 4232056520494431727}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 128, y: 256}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!222 &3032498056073774270
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3545890545112170401}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &634277252673086327
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &4772135422360773263
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -195,24 +260,11 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 3545890545112170401}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: c7a50c189f5be5b4ea54de444f8488a0, 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
|
||||
img: {fileID: 1908580308043775702}
|
||||
select: {fileID: 5340715074145844681}
|
||||
--- !u!1 &4232056520112715746
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -292,7 +344,7 @@ RectTransform:
|
||||
- {fileID: 4232056521759880275}
|
||||
- {fileID: 1038087993597378172}
|
||||
m_Father: {fileID: 4232056521131536011}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@ -389,7 +441,6 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4232056520112715745}
|
||||
- {fileID: 393435831810118449}
|
||||
- {fileID: 4785916497946256520}
|
||||
- {fileID: 4232056520494431727}
|
||||
m_Father: {fileID: 0}
|
||||
@ -409,6 +460,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
VideoProvider: {fileID: 4232056520112715744}
|
||||
AudioProvider: {fileID: 9003897287163669553}
|
||||
m_bPause: 0
|
||||
--- !u!1 &4232056521759880276
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -481,7 +533,7 @@ MonoBehaviour:
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
--- !u!1 &7856060136050839404
|
||||
--- !u!1 &9165783203684222035
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -489,39 +541,74 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 393435831810118449}
|
||||
- component: {fileID: 499856625911497759}
|
||||
m_Layer: 0
|
||||
m_Name: PatternViewer
|
||||
- component: {fileID: 5684774662137182450}
|
||||
- component: {fileID: 8664526960435983253}
|
||||
- component: {fileID: 5340715074145844681}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &393435831810118449
|
||||
Transform:
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5684774662137182450
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7856060136050839404}
|
||||
m_GameObject: {fileID: 9165783203684222035}
|
||||
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: 4232056521131536011}
|
||||
m_Father: {fileID: 1038087993597378172}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &499856625911497759
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: -41}
|
||||
m_SizeDelta: {x: 0, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0}
|
||||
--- !u!222 &8664526960435983253
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9165783203684222035}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &5340715074145844681
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7856060136050839404}
|
||||
m_GameObject: {fileID: 9165783203684222035}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c7a50c189f5be5b4ea54de444f8488a0, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
img: {fileID: 634277252673086327}
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 14
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 0
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: New Text
|
||||
|
@ -14,6 +14,7 @@ namespace AxibugEmuOnline.Client
|
||||
void Resume();
|
||||
void SetupScheme();
|
||||
void StartGame(RomFile romFile);
|
||||
void DoReset();
|
||||
}
|
||||
|
||||
public static class IEnumCoreTool
|
||||
|
@ -68,5 +68,12 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
|
||||
ControlScheme.Current = ControlSchemeSetts.Normal;
|
||||
}
|
||||
|
||||
public void ResetGame()
|
||||
{
|
||||
if(m_emuCore.IsNull()) return;
|
||||
|
||||
m_emuCore.DoReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.Common;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@ -112,30 +113,9 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Conditional("UNITY_EDITOR")]
|
||||
[ContextMenu("ImportNesDB")]
|
||||
public void ImportNesDB()
|
||||
public void DoReset()
|
||||
{
|
||||
var db = Resources.Load<RomDB>("NES/ROMDB");
|
||||
db.Clear();
|
||||
|
||||
var xmlStr = File.ReadAllText("nes20db.xml");
|
||||
var xml = XDocument.Parse(xmlStr);
|
||||
var games = xml.Element("nes20db").Elements("game");
|
||||
foreach (var game in games)
|
||||
{
|
||||
var crcStr = game.Element("rom").Attribute("crc32").Value;
|
||||
var crc = uint.Parse($"{crcStr}", System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
var mapper = int.Parse($"{game.Element("pcb").Attribute("mapper").Value}");
|
||||
|
||||
if (mapper > 255) continue;
|
||||
db.AddInfo(new RomDB.RomInfo { CRC = crc, Mapper = mapper });
|
||||
}
|
||||
|
||||
UnityEditor.EditorUtility.SetDirty(db);
|
||||
UnityEditor.AssetDatabase.SaveAssets();
|
||||
NesCore.Reset();
|
||||
}
|
||||
|
||||
public void SetupScheme()
|
||||
@ -164,5 +144,31 @@ namespace AxibugEmuOnline.Client
|
||||
st.FromByte(data);
|
||||
NesCore.LoadState(st);
|
||||
}
|
||||
|
||||
|
||||
[Conditional("UNITY_EDITOR")]
|
||||
[ContextMenu("ImportNesDB")]
|
||||
public void ImportNesDB()
|
||||
{
|
||||
var db = Resources.Load<RomDB>("NES/ROMDB");
|
||||
db.Clear();
|
||||
|
||||
var xmlStr = File.ReadAllText("nes20db.xml");
|
||||
var xml = XDocument.Parse(xmlStr);
|
||||
var games = xml.Element("nes20db").Elements("game");
|
||||
foreach (var game in games)
|
||||
{
|
||||
var crcStr = game.Element("rom").Attribute("crc32").Value;
|
||||
var crc = uint.Parse($"{crcStr}", System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
var mapper = int.Parse($"{game.Element("pcb").Attribute("mapper").Value}");
|
||||
|
||||
if (mapper > 255) continue;
|
||||
db.AddInfo(new RomDB.RomInfo { CRC = crc, Mapper = mapper });
|
||||
}
|
||||
|
||||
UnityEditor.EditorUtility.SetDirty(db);
|
||||
UnityEditor.AssetDatabase.SaveAssets();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using AxibugEmuOnline.Client.Common;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using VirtualNes;
|
||||
using VirtualNes.Core;
|
||||
using static AxibugEmuOnline.Client.PaletteDefine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
@ -9,24 +12,40 @@ namespace AxibugEmuOnline.Client
|
||||
public class PatternViewer : MonoBehaviour
|
||||
{
|
||||
public RawImage img;
|
||||
public Text select;
|
||||
|
||||
private Color32[] m_lpPattern = new Color32[128 * 256];
|
||||
private Texture2D m_texture;
|
||||
private Dictionary<byte, RGBQUAD> colors = new Dictionary<byte, RGBQUAD>();
|
||||
|
||||
private int selectPal = 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_texture = new Texture2D(128, 256);
|
||||
m_texture.filterMode = FilterMode.Point;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.T))
|
||||
{
|
||||
SwitchSelectPal();
|
||||
}
|
||||
Paint();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
img.gameObject.SetActive(true);
|
||||
if (selectPal < 4)
|
||||
{
|
||||
select.text = $"PatternView BG{(selectPal & 3):00}";
|
||||
}
|
||||
else
|
||||
{
|
||||
select.text = $"PatternView SP{(selectPal & 3):00}";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
@ -38,7 +57,16 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
img.texture = m_texture;
|
||||
|
||||
var pal = MMU.SPPAL;
|
||||
ArrayRef<byte> pal = null;
|
||||
if (selectPal < 4)
|
||||
{
|
||||
pal = new ArrayRef<byte>(MMU.BGPAL, selectPal * 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
pal = new ArrayRef<byte>(MMU.SPPAL, (selectPal & 3) * 4);
|
||||
}
|
||||
|
||||
var palette = PaletteDefine.GetPaletteData();
|
||||
colors[0] = palette[pal[0]];
|
||||
colors[1] = palette[pal[1]];
|
||||
@ -48,6 +76,12 @@ namespace AxibugEmuOnline.Client
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
var Ptn = MMU.PPU_MEM_BANK[i];
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.T))
|
||||
{
|
||||
Debug.Log($"{i}:{Ptn.Offset}\t{Helper.FileMD5Hash(Ptn.RawArray)}");
|
||||
}
|
||||
|
||||
int lpPtn = 0;
|
||||
for (int p = 0; p < 64; p++)
|
||||
{
|
||||
@ -81,5 +115,18 @@ namespace AxibugEmuOnline.Client
|
||||
var raw = map[(byte)v];
|
||||
return new Color32(raw.rgbRed, raw.rgbGreen, raw.rgbBlue, 255);
|
||||
}
|
||||
|
||||
void SwitchSelectPal()
|
||||
{
|
||||
selectPal = (selectPal + 1) & 7;
|
||||
if (selectPal < 4)
|
||||
{
|
||||
select.text = $"PatternView BG{(selectPal & 3):00}";
|
||||
}
|
||||
else
|
||||
{
|
||||
select.text = $"PatternView SP{(selectPal & 3):00}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,16 +38,18 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
m_stepPerformer = new StepPerformer(this);
|
||||
|
||||
menus.Add(new InGameUI_Reset(this));
|
||||
menus.Add(new InGameUI_SaveState(this));
|
||||
menus.Add(new InGameUI_LoadState(this));
|
||||
menus.Add(new InGameUI_QuitGame(this));
|
||||
|
||||
base.Awake();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
Instance = null;
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
/// <summary> 괏닸우醵우亮 </summary>
|
||||
|
@ -0,0 +1,28 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class InGameUI_Reset : ExecuteMenu
|
||||
{
|
||||
private InGameUI m_gameUI;
|
||||
|
||||
public override bool Visible => !m_gameUI.IsNetPlay || App.roomMgr.IsHost;
|
||||
|
||||
public InGameUI_Reset(InGameUI gameUI) : base("¸´Î»", null)
|
||||
{
|
||||
m_gameUI = gameUI;
|
||||
}
|
||||
|
||||
public override void OnExcute()
|
||||
{
|
||||
if (!m_gameUI.IsNetPlay)
|
||||
{
|
||||
App.emu.ResetGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eedc9c8d06bb21242bb50bee6ca858fe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -4,6 +4,7 @@ namespace VirtualNes.Core
|
||||
{
|
||||
public class ArrayRef<T>
|
||||
{
|
||||
public T[] RawArray => m_rawArray;
|
||||
private T[] m_rawArray;
|
||||
private int m_offset;
|
||||
private int m_length;
|
||||
|
@ -10,8 +10,7 @@ namespace VirtualNes.Core
|
||||
{
|
||||
public class Mapper001 : Mapper
|
||||
{
|
||||
|
||||
uint last_addr;
|
||||
ushort last_addr;
|
||||
|
||||
BYTE patch;
|
||||
BYTE wram_patch;
|
||||
@ -131,7 +130,6 @@ namespace VirtualNes.Core
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayRef<byte> _PROM_BANK = new ArrayRef<byte>();
|
||||
//void Mapper001::Write(WORD addr, BYTE data)
|
||||
public override void Write(ushort addr, byte data)
|
||||
{
|
||||
@ -145,13 +143,11 @@ namespace VirtualNes.Core
|
||||
{
|
||||
if (wram_bank != 0)
|
||||
{
|
||||
_PROM_BANK.SetArray(WRAM, 0x2000);
|
||||
SetPROM_Bank(3, _PROM_BANK, BANKTYPE_RAM);
|
||||
SetPROM_Bank(3, new ArrayRef<byte>(WRAM, 0x2000), BANKTYPE_RAM);
|
||||
}
|
||||
else
|
||||
{
|
||||
_PROM_BANK.SetArray(WRAM, 0x0000);
|
||||
SetPROM_Bank(3, _PROM_BANK, BANKTYPE_RAM);
|
||||
SetPROM_Bank(3, new ArrayRef<byte>(WRAM, 0x0000), BANKTYPE_RAM);
|
||||
}
|
||||
wram_bank = wram_count = 0;
|
||||
}
|
||||
@ -292,13 +288,11 @@ namespace VirtualNes.Core
|
||||
{
|
||||
if (((reg[1] & 0x18) == 0))
|
||||
{
|
||||
_PROM_BANK.SetArray(WRAM, 0x0000);
|
||||
SetPROM_Bank(3, _PROM_BANK, BANKTYPE_RAM);
|
||||
SetPROM_Bank(3, new ArrayRef<byte>(WRAM, 0x0000), BANKTYPE_RAM);
|
||||
}
|
||||
else
|
||||
{
|
||||
_PROM_BANK.SetArray(WRAM, 0x2000);
|
||||
SetPROM_Bank(3, _PROM_BANK, BANKTYPE_RAM);
|
||||
SetPROM_Bank(3, new ArrayRef<byte>(WRAM, 0x2000), BANKTYPE_RAM);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,11 @@ namespace VirtualNes.Core
|
||||
protected byte vs_patch;
|
||||
protected byte vs_index;
|
||||
|
||||
public override bool IsStateSave()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private byte[] VS_TKO_Security = new byte[32]
|
||||
{
|
||||
0xff, 0xbf, 0xb7, 0x97, 0x97, 0x17, 0x57, 0x4f,
|
||||
|
@ -911,7 +911,7 @@ namespace VirtualNes.Core
|
||||
CPU_CALL_COUNT++;
|
||||
}
|
||||
|
||||
internal void Reset()
|
||||
public void Reset()
|
||||
{
|
||||
SaveSRAM();
|
||||
SaveDISK();
|
||||
@ -1024,7 +1024,7 @@ namespace VirtualNes.Core
|
||||
|
||||
|
||||
|
||||
internal void SoftReset()
|
||||
public void SoftReset()
|
||||
{
|
||||
pad.Reset();
|
||||
cpu.Reset();
|
||||
@ -1974,23 +1974,45 @@ namespace VirtualNes.Core
|
||||
// BANK0,1,2¤Ï¥Ð¥ó¥¯¥»©`¥Ö¤Ëév‚S¤Ê¤·
|
||||
// VirtuaNES0.30¤«¤é
|
||||
// ¥Ð¥ó¥¯£³¤ÏSRAMʹÓäËév¤ï¤é¤º¥»©`¥Ö
|
||||
for (int i = 3; i < 8; i++)
|
||||
for (byte i = 3; i < 8; i++)
|
||||
{
|
||||
MMU.CPU_MEM_TYPE[i] = state.mmu.CPU_MEM_TYPE[i];
|
||||
MMU.CPU_MEM_PAGE[i] = state.mmu.CPU_MEM_PAGE[i];
|
||||
if (MMU.CPU_MEM_TYPE[i] == MMU.BANKTYPE_ROM)
|
||||
MMU.SetPROM_8K_Bank(i, MMU.CPU_MEM_PAGE[i]);
|
||||
else
|
||||
{
|
||||
MMU.CPU_MEM_BANK[i].SetArray(state.CPU_MEM_BANK.ToArray(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
// SAVE VRAM MEMORY DATA
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
MMU.PPU_MEM_TYPE[i] = state.mmu.PPU_MEM_TYPE[i];
|
||||
MMU.PPU_MEM_PAGE[i] = state.mmu.PPU_MEM_PAGE[i];
|
||||
}
|
||||
|
||||
// VRAM
|
||||
MemoryUtility.memcpy(MMU.VRAM, state.VRAM, 4 * 1024);
|
||||
// CRAM
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
MMU.CRAM_USED[i] = state.mmu.CRAM_USED[i];
|
||||
}
|
||||
// SAVE VRAM MEMORY DATA
|
||||
for (byte i = 0; i < 12; i++)
|
||||
{
|
||||
if (state.mmu.PPU_MEM_TYPE[i] == MMU.BANKTYPE_VROM)
|
||||
{
|
||||
MMU.SetVROM_1K_Bank(i, state.mmu.PPU_MEM_PAGE[i]);
|
||||
}
|
||||
else if (state.mmu.PPU_MEM_TYPE[i] == MMU.BANKTYPE_CRAM)
|
||||
{
|
||||
MMU.SetCRAM_1K_Bank(i, state.mmu.PPU_MEM_PAGE[i]);
|
||||
}
|
||||
else if (state.mmu.PPU_MEM_TYPE[i] == MMU.BANKTYPE_VRAM)
|
||||
{
|
||||
MMU.SetVRAM_1K_Bank(i, state.mmu.PPU_MEM_PAGE[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Unknown bank types.");
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE CPU RAM MEMORY BANK
|
||||
|
||||
@ -2024,17 +2046,7 @@ namespace VirtualNes.Core
|
||||
|
||||
// MMC STATE
|
||||
{
|
||||
state.mmc = MMCSTAT.GetDefault();
|
||||
|
||||
// Create Header
|
||||
state.mmcBLOCK.ID = "MMC DATA";
|
||||
state.mmcBLOCK.BlockVersion = 0x0100;
|
||||
state.mmcBLOCK.BlockSize = state.mmc.GetSize();
|
||||
|
||||
if (mapper.IsStateSave())
|
||||
{
|
||||
mapper.LoadState(state.mmc.mmcdata);
|
||||
}
|
||||
mapper.LoadState(state.mmc.mmcdata);
|
||||
}
|
||||
|
||||
//CONTROLLER STATE
|
||||
@ -2048,8 +2060,6 @@ namespace VirtualNes.Core
|
||||
|
||||
//SND STATE
|
||||
{
|
||||
state.snd = SNDSTAT.GetDefault();
|
||||
|
||||
var buffer = new StateReader(state.snd.snddata);
|
||||
apu.LoadState(buffer);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user