dev_basemynes #8

Merged
sin365 merged 3 commits from Alienjack/AxibugEmuOnline:dev_basemynes into dev_basemynes 2024-07-16 16:32:30 +08:00
23 changed files with 405 additions and 315 deletions

View File

@ -5,91 +5,91 @@ namespace MyNes.Core
{
public class INes : IRom
{
public bool HasBattery { get; private set; }
public bool HasBattery { get; private set; }
public bool IsPlaychoice10 { get; private set; }
public bool IsPlaychoice10 { get; private set; }
public bool IsVSUnisystem { get; private set; }
public bool IsVSUnisystem { get; private set; }
public override void Load(string fileName, bool loadDumps)
{
FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
if (fileStream.Length < 16)
{
fileStream.Close();
base.IsValid = false;
return;
}
byte[] array = new byte[16];
fileStream.Read(array, 0, 16);
byte[] buffer = new byte[fileStream.Length - 16];
fileStream.Read(buffer, 0, (int)(fileStream.Length - 16));
base.SHA1 = "";
byte[] array2 = new SHA1Managed().ComputeHash(buffer);
foreach (byte b in array2)
{
base.SHA1 += b.ToString("x2").ToLower();
}
if (array[0] != 78 || array[1] != 69 || array[2] != 83 || array[3] != 26)
{
fileStream.Close();
base.IsValid = false;
return;
}
base.PRGCount = array[4];
base.CHRCount = array[5];
switch (array[6] & 9)
{
case 0:
base.Mirroring = Mirroring.Horz;
break;
case 1:
base.Mirroring = Mirroring.Vert;
break;
case 8:
case 9:
base.Mirroring = Mirroring.Full;
break;
}
HasBattery = (array[6] & 2) != 0;
base.HasTrainer = (array[6] & 4) != 0;
if ((array[7] & 0xF) == 0)
{
base.MapperNumber = (byte)((array[7] & 0xF0) | (array[6] >> 4));
}
else
{
base.MapperNumber = (byte)(array[6] >> 4);
}
IsVSUnisystem = (array[7] & 1) != 0;
IsPlaychoice10 = (array[7] & 2) != 0;
if (loadDumps)
{
fileStream.Seek(16L, SeekOrigin.Begin);
if (base.HasTrainer)
{
base.Trainer = new byte[512];
fileStream.Read(base.Trainer, 0, 512);
}
else
{
base.Trainer = new byte[0];
}
base.PRG = new byte[base.PRGCount * 16384];
fileStream.Read(base.PRG, 0, base.PRGCount * 16384);
if (base.CHRCount > 0)
{
base.CHR = new byte[base.CHRCount * 8192];
fileStream.Read(base.CHR, 0, base.CHRCount * 8192);
}
else
{
base.CHR = new byte[0];
}
}
base.IsValid = true;
fileStream.Dispose();
fileStream.Close();
}
public override void Load(string fileName, bool loadDumps)
{
var fileStream = MyNesMain.FileManager.OpenRomFile(fileName);
if (fileStream.Length < 16)
{
fileStream.Close();
base.IsValid = false;
return;
}
byte[] array = new byte[16];
fileStream.Read(array, 0, 16);
byte[] buffer = new byte[fileStream.Length - 16];
fileStream.Read(buffer, 0, (int)(fileStream.Length - 16));
base.SHA1 = "";
byte[] array2 = new SHA1Managed().ComputeHash(buffer);
foreach (byte b in array2)
{
base.SHA1 += b.ToString("x2").ToLower();
}
if (array[0] != 78 || array[1] != 69 || array[2] != 83 || array[3] != 26)
{
fileStream.Close();
base.IsValid = false;
return;
}
base.PRGCount = array[4];
base.CHRCount = array[5];
switch (array[6] & 9)
{
case 0:
base.Mirroring = Mirroring.Horz;
break;
case 1:
base.Mirroring = Mirroring.Vert;
break;
case 8:
case 9:
base.Mirroring = Mirroring.Full;
break;
}
HasBattery = (array[6] & 2) != 0;
base.HasTrainer = (array[6] & 4) != 0;
if ((array[7] & 0xF) == 0)
{
base.MapperNumber = (byte)((array[7] & 0xF0) | (array[6] >> 4));
}
else
{
base.MapperNumber = (byte)(array[6] >> 4);
}
IsVSUnisystem = (array[7] & 1) != 0;
IsPlaychoice10 = (array[7] & 2) != 0;
if (loadDumps)
{
fileStream.Seek(16L, SeekOrigin.Begin);
if (base.HasTrainer)
{
base.Trainer = new byte[512];
fileStream.Read(base.Trainer, 0, 512);
}
else
{
base.Trainer = new byte[0];
}
base.PRG = new byte[base.PRGCount * 16384];
fileStream.Read(base.PRG, 0, base.PRGCount * 16384);
if (base.CHRCount > 0)
{
base.CHR = new byte[base.CHRCount * 8192];
fileStream.Read(base.CHR, 0, base.CHRCount * 8192);
}
else
{
base.CHR = new byte[0];
}
}
base.IsValid = true;
fileStream.Dispose();
fileStream.Close();
}
}
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace MyNes.Core
{
@ -217,5 +218,6 @@ namespace MyNes.Core
string GetWorkingFolderPath();
public Stream OpenDatabaseFile();
public Stream OpenPaletteFile();
public Stream OpenRomFile(string path);
}
}

View File

@ -5141,47 +5141,39 @@ namespace MyNes.Core
success = false;
return;
}
string text = Path.GetExtension(fileName).ToLower();
if (text != null && text == ".nes")
Tracer.WriteLine("Checking INES header ...");
INes nes = new INes();
nes.Load(fileName, loadDumps: true);
if (nes.IsValid)
{
Tracer.WriteLine("Checking INES header ...");
INes nes = new INes();
nes.Load(fileName, loadDumps: true);
if (nes.IsValid)
emu_request_mode = RequestMode.None;
CurrentFilePath = fileName;
if (ON)
{
emu_request_mode = RequestMode.None;
CurrentFilePath = fileName;
if (ON)
{
ShutDown();
}
Tracer.WriteLine("INES header is valid, loading game ...");
ApplyRegionSetting();
MEMInitialize(nes);
ApplyAudioSettings();
ApplyFrameSkipSettings();
ApplyPaletteSetting();
PORTSInitialize();
hardReset();
Tracer.WriteLine("EMU is ready.");
success = true;
emu_frame_clocking_mode = !useThread;
ON = true;
PAUSED = false;
if (useThread)
{
Tracer.WriteLine("Running in a thread ... using custom frame limiter.");
FrameLimiterEnabled = true;
mainThread = new Thread(EmuClock);
mainThread.Start();
}
MyNesMain.VideoProvider.SignalToggle(started: true);
MyNesMain.AudioProvider.SignalToggle(started: true);
ShutDown();
}
else
Tracer.WriteLine("INES header is valid, loading game ...");
ApplyRegionSetting();
MEMInitialize(nes);
ApplyAudioSettings();
ApplyFrameSkipSettings();
ApplyPaletteSetting();
PORTSInitialize();
hardReset();
Tracer.WriteLine("EMU is ready.");
success = true;
emu_frame_clocking_mode = !useThread;
ON = true;
PAUSED = false;
if (useThread)
{
success = false;
Tracer.WriteLine("Running in a thread ... using custom frame limiter.");
FrameLimiterEnabled = true;
mainThread = new Thread(EmuClock);
mainThread.Start();
}
MyNesMain.VideoProvider.SignalToggle(started: true);
MyNesMain.AudioProvider.SignalToggle(started: true);
}
else
{
@ -5298,6 +5290,16 @@ namespace MyNes.Core
}
}
public static void ExecuteOneFrame()
{
while (!ppu_frame_finished)
{
CPUClock();
}
FrameFinished();
}
private static void EmuClock()
{
while (ON)

View File

@ -11,13 +11,13 @@ namespace MyNes.Core
public static void WriteLine(string message)
{
Tracer.EventRaised?.Invoke(null, new TracerEventArgs(message, TracerStatus.Normal));
Debug.Log(message);
//Debug.Log(message);
}
public static void WriteLine(string message, string category)
{
Tracer.EventRaised?.Invoke(null, new TracerEventArgs($"{category}: {message}", TracerStatus.Normal));
Debug.Log(message);
//Debug.Log(message);
}
public static void WriteLine(string message, TracerStatus status)
@ -28,10 +28,10 @@ namespace MyNes.Core
case TracerStatus.Error: Debug.LogError(message); break;
case TracerStatus.Infromation:
case TracerStatus.Normal:
Debug.Log(message);
//Debug.Log(message);
break;
case TracerStatus.Warning:
Debug.LogWarning(message);
//Debug.LogWarning(message);
break;
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 4664d2ef3d138e141b308c242abd4327
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,6 @@
fileFormatVersion: 2
guid: dee4e4661b99068439cc932db923d849
guid: ac852e7a0b9604940b0f7e0180fd2707
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 040fea71e1812ce45bd2b72c8ad2e2ae
guid: 01dd757415143ae46921461228964dd5
TextScriptImporter:
externalObjects: {}
userData:

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 23a003aef20e19f4d8c45acd32012718
DefaultImporter:
guid: ecb5d904338d35c43bb3b98249b36394
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 5df1a0f25b9a1864493e694ce7b40cc4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 333f6913aec8b2b41807add4cf643f6a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -167,59 +167,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ac8cd27a180bf3e489b2ca27c821bffe, type: 3}
m_Name:
m_EditorClassIdentifier:
VideoCom: {fileID: 0}
AudioCom: {fileID: 0}
--- !u!1 &455467288
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 455467291}
- component: {fileID: 455467290}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &455467290
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 455467288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 00080631f10e2834db28c37a11188a74, type: 3}
m_Name:
m_EditorClassIdentifier:
sampleRate: 44100
channels: 2
bufferLength: 1024
audioClip: {fileID: 0}
audioSource: {fileID: 0}
audioBuffer: []
isRunning: 1
--- !u!4 &455467291
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 455467288}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 253.16292, y: 149.09415, z: -2.2723875}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
VideoCom: {fileID: 730321753}
AudioCom: {fileID: 1379369700}
--- !u!1 &708549044
GameObject:
m_ObjectHideFlags: 0
@ -314,6 +263,85 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &723385291
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 723385292}
- component: {fileID: 723385294}
- component: {fileID: 723385293}
m_Layer: 5
m_Name: fps
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &723385292
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 723385291}
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: 730321749}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 1, y: 0}
--- !u!114 &723385293
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 723385291}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
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: 8
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text:
--- !u!222 &723385294
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 723385291}
m_CullTransparentMesh: 1
--- !u!1 &730321748
GameObject:
m_ObjectHideFlags: 0
@ -324,7 +352,6 @@ GameObject:
m_Component:
- component: {fileID: 730321749}
- component: {fileID: 730321752}
- component: {fileID: 730321751}
- component: {fileID: 730321753}
m_Layer: 5
m_Name: video
@ -332,7 +359,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &730321749
RectTransform:
m_ObjectHideFlags: 0
@ -342,9 +369,11 @@ RectTransform:
m_GameObject: {fileID: 730321748}
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_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 2100984176}
- {fileID: 723385292}
m_Father: {fileID: 786008058}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -352,33 +381,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &730321751
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 730321748}
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!222 &730321752
CanvasRenderer:
m_ObjectHideFlags: 0
@ -399,7 +401,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f2632911774df3c488ec24b39651c4de, type: 3}
m_Name:
m_EditorClassIdentifier:
m_image: {fileID: 730321751}
m_drawCanvas: {fileID: 2100984177}
m_fpsText: {fileID: 723385293}
--- !u!1 &786008057
GameObject:
m_ObjectHideFlags: 0
@ -809,6 +812,78 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_as: {fileID: 1379369699}
--- !u!1 &2100984175
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2100984176}
- component: {fileID: 2100984178}
- component: {fileID: 2100984177}
m_Layer: 5
m_Name: canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &2100984176
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2100984175}
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: 730321749}
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!114 &2100984177
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2100984175}
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!222 &2100984178
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2100984175}
m_CullTransparentMesh: 1
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@ -817,4 +892,3 @@ SceneRoots:
- {fileID: 708549046}
- {fileID: 258485947}
- {fileID: 1359344834}
- {fileID: 455467291}

View File

@ -1,5 +1,7 @@
using MyNes.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using UnityEngine;
@ -20,8 +22,10 @@ namespace AxibugEmuOnline.Client
[SerializeField]
private AudioSource m_as;
private Stopwatch sw = Stopwatch.StartNew();
private Queue<short> _buffer = new Queue<short>(2048);
private Queue<short> _buffer = new Queue<short>();
public double FPS { get; private set; }
public void Initialize()
{
@ -34,35 +38,34 @@ namespace AxibugEmuOnline.Client
m_as.Play();
}
float lastData = 0;
void OnAudioFilterRead(float[] data, int channels)
{
while (_buffer.Count >= data.Length / 2)
{
//Thread.Sleep(10);
break;
}
int step = channels;
for (int i = 0; i < data.Length; i += step)
{
var rawData = _buffer.Count > 0 ? _buffer.Dequeue() : 0;
var rawFloat = rawData / 124f;
var rawFloat = _buffer.Count <= 0 ? lastData : _buffer.Dequeue() / 124f;
data[i] = rawFloat;
for (int fill = 1; fill < step; fill++)
data[i + fill] = rawFloat;
}
lastData = rawFloat;
}
}
int EmuAudioTimeSample = 0;
private TimeSpan lastElapsed;
public void SubmitSamples(ref short[] buffer, ref int samples_a)
{
EmuAudioTimeSample += samples_a;
var current = sw.Elapsed;
var delta = current - lastElapsed;
lastElapsed = current;
FPS = 1d / delta.TotalSeconds;
for (int i = 0; i < samples_a; i++)
{
_buffer.Enqueue(buffer[i]);
}
}
public void TogglePause(bool paused)

View File

@ -15,18 +15,22 @@ namespace AxibugEmuOnline.Client
public string ID => nameof(UguiVideoProvider).GetHashCode().ToString();
[SerializeField]
private RawImage m_drawCanvas;
[SerializeField]
private Text m_fpsText;
private Color[] m_texRawBuffer = new Color[256 * 240];
private Texture2D m_rawBufferWarper;
[SerializeField]
private RawImage m_image;
private RenderTexture m_drawRT;
private Color temp = Color.white;
public void Initialize()
{
m_rawBufferWarper = new Texture2D(256, 240);
m_image.texture = RenderTexture.GetTemporary(256, 240, 0, UnityEngine.Experimental.Rendering.GraphicsFormat.B8G8R8A8_UNorm);
}
m_drawCanvas.texture = RenderTexture.GetTemporary(256, 240, 0, UnityEngine.Experimental.Rendering.GraphicsFormat.B8G8R8A8_UNorm);
}
public void GetColor(uint value, ref Color res)
{
@ -45,7 +49,9 @@ namespace AxibugEmuOnline.Client
var colors = m_texRawBuffer;
m_rawBufferWarper.SetPixels(colors);
m_rawBufferWarper.Apply();
Graphics.Blit(m_rawBufferWarper, m_image.texture as RenderTexture);
Graphics.Blit(m_rawBufferWarper, m_drawCanvas.texture as RenderTexture);
m_fpsText.text = $"Audio:{NesCoreProxy.Instance.AudioCom.FPS}";
}
public void WriteErrorNotification(string message, bool instant)

View File

@ -7,10 +7,15 @@ namespace AxibugEmuOnline.Client.Manager
{
public class AppEmu : IFileManager
{
public void Init(IVideoProvider videoCom,IAudioProvider audioCom)
public void Init(IVideoProvider videoCom, IAudioProvider audioCom)
{
MyNesMain.Initialize(this, videoCom, audioCom);
NesEmu.LoadGame("E:/kirby.nes", out var successed, true);
NesEmu.LoadGame("kirby.nes", out var successed, true);
}
public void ExecuteFrameLogic()
{
//NesEmu.ExecuteOneFrame();
}
public void Dispose()
@ -36,5 +41,12 @@ namespace AxibugEmuOnline.Client.Manager
{
return $"{Application.persistentDataPath}/MyNes";
}
public Stream OpenRomFile(string path)
{
var ta = Resources.Load<TextAsset>($"Roms/{path}");
MemoryStream ms = new MemoryStream(ta.bytes);
return ms;
}
}
}

View File

@ -21,6 +21,11 @@ namespace AxibugEmuOnline.Client
m_appEnum.Init(VideoCom, AudioCom);
}
private void Update()
{
m_appEnum.ExecuteFrameLogic();
}
private void OnDestroy()
{
Instance = null;

View File

@ -155,13 +155,18 @@ PlayerSettings:
useHDRDisplay: 0
hdrBitDepth: 0
m_ColorGamuts: 00000000
targetPixelDensity: 0
targetPixelDensity: 30
resolutionScalingMode: 0
resetResolutionOnWindowResize: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier: {}
buildNumber: {}
applicationIdentifier:
Standalone: com.DefaultCompany.AxibugEmuOnline.Client
buildNumber:
Standalone: 0
VisionOS: 0
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 0
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 22
@ -180,12 +185,12 @@ PlayerSettings:
strictShaderVariantMatching: 0
VertexChannelCompressionMask: 4054
iPhoneSdkVersion: 988
iOSTargetOSVersionString:
iOSTargetOSVersionString: 12.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString:
tvOSTargetOSVersionString: 12.0
VisionOSSdkVersion: 0
VisionOSTargetOSVersionString:
VisionOSTargetOSVersionString: 1.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
@ -313,7 +318,7 @@ PlayerSettings:
locationUsageDescription:
microphoneUsageDescription:
bluetoothUsageDescription:
macOSTargetOSVersion:
macOSTargetOSVersion: 10.13.0
switchNMETAOverride:
switchNetLibKey:
switchSocketMemoryPoolSize: 6144
@ -563,7 +568,8 @@ PlayerSettings:
scriptingDefineSymbols: {}
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend: {}
scriptingBackend:
Standalone: 1
il2cppCompilerConfiguration: {}
il2cppCodeGeneration: {}
managedStrippingLevel: {}
@ -651,7 +657,7 @@ PlayerSettings:
embeddedLinuxEnableGamepadInput: 1
hmiLogStartupTiming: 0
hmiCpuConfiguration:
apiCompatibilityLevel: 6
apiCompatibilityLevel: 3
activeInputHandler: 0
windowsGamepadBackendHint: 0
cloudProjectId:

View File

@ -19,7 +19,7 @@ MonoBehaviour:
width: 1920
height: 989
m_ShowMode: 4
m_Title: Console
m_Title: Hierarchy
m_RootView: {fileID: 9}
m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000}
@ -41,7 +41,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 580
width: 1175
width: 1174
height: 359
m_MinSize: {x: 101, y: 121}
m_MaxSize: {x: 4001, y: 4021}
@ -70,12 +70,12 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1175
width: 1174
height: 939
m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 8096, y: 16192}
vertical: 1
controlID: 16
controlID: 41
--- !u!114 &4
MonoBehaviour:
m_ObjectHideFlags: 52
@ -93,7 +93,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 579
width: 417
width: 418
height: 360
m_MinSize: {x: 232, y: 271}
m_MaxSize: {x: 10002, y: 10021}
@ -119,14 +119,14 @@ MonoBehaviour:
- {fileID: 4}
m_Position:
serializedVersion: 2
x: 1175
x: 1174
y: 0
width: 417
width: 418
height: 939
m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 8096, y: 16192}
vertical: 1
controlID: 77
controlID: 100
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
@ -144,10 +144,10 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 417
width: 418
height: 579
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 16}
m_Panes:
- {fileID: 16}
@ -177,7 +177,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 100}
m_MaxSize: {x: 24288, y: 16192}
vertical: 0
controlID: 140
controlID: 139
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
@ -197,8 +197,8 @@ MonoBehaviour:
y: 0
width: 328
height: 939
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 15}
m_Panes:
- {fileID: 15}
@ -299,7 +299,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 100}
m_MaxSize: {x: 16192, y: 16192}
vertical: 0
controlID: 76
controlID: 99
--- !u!114 &13
MonoBehaviour:
m_ObjectHideFlags: 52
@ -317,7 +317,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1175
width: 1174
height: 580
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
@ -346,9 +346,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1175
x: 1174
y: 652
width: 415
width: 416
height: 339
m_SerializedDataModeController:
m_DataMode: 0
@ -371,7 +371,7 @@ MonoBehaviour:
m_SkipHidden: 0
m_SearchArea: 1
m_Folders:
- Assets
- Assets/Script/Emu
m_Globs: []
m_OriginalText:
m_ImportLogFlags: 0
@ -379,16 +379,16 @@ MonoBehaviour:
m_ViewMode: 1
m_StartGridSize: 16
m_LastFolders:
- Assets
- Assets/Script/Emu
m_LastFoldersGridSize: 16
m_LastProjectPath: E:\AxibugEmuOnline\AxibugEmuOnline.Client
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 56410000
m_LastClickedID: 16726
m_ExpandedIDs: 00000000564100006c41000000ca9a3b
m_SelectedIDs: 38610000
m_LastClickedID: 24888
m_ExpandedIDs: 00000000645f0000a25f000000ca9a3b
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -416,7 +416,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 0000000056410000
m_ExpandedIDs: 00000000645f0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -443,7 +443,7 @@ MonoBehaviour:
m_ListAreaState:
m_SelectedInstanceIDs:
m_LastClickedInstanceID: 0
m_HadKeyboardFocusLastEvent: 0
m_HadKeyboardFocusLastEvent: 1
m_ExpandedInstanceIDs: c6230000
m_RenameOverlay:
m_UserAcceptedRename: 0
@ -539,9 +539,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1175
x: 1174
y: 73
width: 415
width: 416
height: 558
m_SerializedDataModeController:
m_DataMode: 0
@ -558,7 +558,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 40fbffff
m_ExpandedIDs: dae5ffff24fbfffffe5e00000a5f0000145f0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -604,7 +604,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 653
width: 1172
width: 1174
height: 338
m_SerializedDataModeController:
m_DataMode: 0
@ -1050,14 +1050,14 @@ MonoBehaviour:
m_OverrideSceneCullingMask: 6917529027641081856
m_SceneIsLit: 1
m_SceneLighting: 1
m_2DMode: 0
m_2DMode: 1
m_isRotationLocked: 0
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 0, y: 0, z: 0}
m_Target: {x: 253.16292, y: 149.09415, z: -2.2723875}
speed: 2
m_Value: {x: 0, y: 0, z: 0}
m_Value: {x: 253.16292, y: 149.09415, z: -2.2723875}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@ -1085,17 +1085,17 @@ MonoBehaviour:
m_Size: {x: 0, y: 0}
yGrid:
m_Fade:
m_Target: 1
m_Target: 0
speed: 2
m_Value: 1
m_Value: 0
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
m_Pivot: {x: 0, y: 0, z: 0}
m_Size: {x: 1, y: 1}
zGrid:
m_Fade:
m_Target: 0
m_Target: 1
speed: 2
m_Value: 0
m_Value: 1
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
m_Pivot: {x: 0, y: 0, z: 0}
m_Size: {x: 1, y: 1}
@ -1103,17 +1103,17 @@ MonoBehaviour:
m_GridAxis: 1
m_gridOpacity: 0.5
m_Rotation:
m_Target: {x: -0.08717229, y: 0.89959055, z: -0.21045254, w: -0.3726226}
m_Target: {x: 0, y: 0, z: 0, w: 1}
speed: 2
m_Value: {x: -0.08717229, y: 0.89959055, z: -0.21045254, w: -0.3726226}
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 10
m_Target: 260.2281
speed: 2
m_Value: 10
m_Value: 260.2281
m_Ortho:
m_Target: 0
m_Target: 1
speed: 2
m_Value: 0
m_Value: 1
m_CameraSettings:
m_Speed: 1
m_SpeedNormalized: 0.5
@ -1156,7 +1156,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 73
width: 1174
width: 1173
height: 559
m_SerializedDataModeController:
m_DataMode: 0
@ -1174,7 +1174,7 @@ MonoBehaviour:
m_ShowGizmos: 0
m_TargetDisplay: 0
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
m_TargetSize: {x: 1174, y: 538}
m_TargetSize: {x: 1173, y: 538}
m_TextureFilterMode: 0
m_TextureHideFlags: 61
m_RenderIMGUI: 1
@ -1189,8 +1189,8 @@ MonoBehaviour:
m_VRangeLocked: 0
hZoomLockedByDefault: 0
vZoomLockedByDefault: 0
m_HBaseRangeMin: -587
m_HBaseRangeMax: 587
m_HBaseRangeMin: -586.5
m_HBaseRangeMax: 586.5
m_VBaseRangeMin: -269
m_VBaseRangeMax: 269
m_HAllowExceedBaseRangeMin: 1
@ -1210,23 +1210,23 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 21
width: 1174
width: 1173
height: 538
m_Scale: {x: 1, y: 1}
m_Translation: {x: 587, y: 269}
m_Translation: {x: 586.5, y: 269}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -587
x: -586.5
y: -269
width: 1174
width: 1173
height: 538
m_MinimalGUI: 1
m_defaultScale: 1
m_LastWindowPixelSize: {x: 1174, y: 559}
m_LastWindowPixelSize: {x: 1173, y: 559}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000001000000000000
@ -1254,7 +1254,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 653
width: 1174
width: 1173
height: 338
m_SerializedDataModeController:
m_DataMode: 0