diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/NES.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/NES.cs
index 91cb521..1b9f76b 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/NES.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/NES.cs
@@ -1,4 +1,4 @@
-using System;
+锘縰sing System;
using System.Collections.Generic;
using System.IO;
using System.Text;
@@ -249,7 +249,7 @@ namespace VirtualNes.Core
LoadDISK();
{
- // Padクラス内だと初期化タイミングが遅いのでここで
+ // Pad銈儵銈瑰唴銇犮仺鍒濇湡鍖栥偪銈ゃ儫銉炽偘銇岄亝銇勩伄銇с亾銇撱仹
uint crc = rom.GetPROM_CRC();
if (
crc == 0xe792de94 // Best Play - Pro Yakyuu (New) (J)
@@ -275,7 +275,7 @@ namespace VirtualNes.Core
LoadTurboFile();
- // VS-Unisystemのデフォルト設定
+ // VS-Unisystem銇儑銉曘偐銉儓瑷畾
if (rom.IsVSUNISYSTEM())
{
uint crc = rom.GetPROM_CRC();
@@ -286,13 +286,13 @@ namespace VirtualNes.Core
Reset();
- // ゲーム固有のデフォルトオプションを設定(設定戻す時に使う為)
+ // 銈层兗銉犲浐鏈夈伄銉囥儠銈┿儷銉堛偑銉椼偡銉с兂銈掕ō瀹(瑷畾鎴汇仚鏅傘伀浣裤亞鐐)
GameOption.defRenderMethod = (int)GetRenderMethod();
GameOption.defIRQtype = GetIrqType();
GameOption.defFrameIRQ = GetFrameIRQmode();
GameOption.defVideoMode = GetVideoMode();
- // 設定をロードして設定する(エントリが無ければデフォルトが入る)
+ // 瑷畾銈掋儹銉笺儔銇椼仸瑷畾銇欍倠(銈ㄣ兂銉堛儶銇岀劇銇戙倢銇般儑銉曘偐銉儓銇屽叆銈)
if (rom.GetMapperNo() != 20)
{
GameOption.Load(rom.GetPROM_CRC());
@@ -331,12 +331,12 @@ namespace VirtualNes.Core
{
if (fp == null)
{
- // xxx ファイルを開けません
+ // xxx 銉曘偂銈ゃ儷銈掗枊銇戙伨銇涖倱
throw new Exception($"Can Not Open File [TurboFile.vtf]");
}
long size = fp.Length;
- // ファイルサイズ取得
+ // 銉曘偂銈ゃ儷銈点偆銈哄彇寰
if (size > 32 * 1024)
{
size = 32 * 1024;
@@ -354,7 +354,7 @@ namespace VirtualNes.Core
private void LoadDISK()
{
- //todo : 磁碟机读取支持
+ //todo : 纾佺鏈鸿鍙栨敮鎸
}
private void LoadSRAM()
@@ -400,7 +400,7 @@ namespace VirtualNes.Core
{
int i;
- // 儊儌儕僋儕傾
+ // 鍎婂剬鍎曞儖鍎曞偩
MemoryUtility.ZEROMEMORY(MMU.RAM, MMU.RAM.Length);
MemoryUtility.ZEROMEMORY(MMU.WRAM, MMU.WRAM.Length);
MemoryUtility.ZEROMEMORY(MMU.DRAM, MMU.DRAM.Length);
@@ -420,11 +420,11 @@ namespace VirtualNes.Core
MMU.PROM = MMU.VROM = null;
- // 0 彍嶼杊巭懳嶔
+ // 0 褰嶅都鏉婂翻鎳冲稊
MMU.PROM_8K_SIZE = MMU.PROM_16K_SIZE = MMU.PROM_32K_SIZE = 1;
MMU.VROM_1K_SIZE = MMU.VROM_2K_SIZE = MMU.VROM_4K_SIZE = MMU.VROM_8K_SIZE = 1;
- // 僨僼僅儖僩僶儞僋愝掕
+ // 鍍ㄥ兗鍍呭剸鍍╁兌鍎炲儖鎰濇帟
for (i = 0; i < 8; i++)
{
MMU.CPU_MEM_BANK[i] = null;
@@ -432,11 +432,11 @@ namespace VirtualNes.Core
MMU.CPU_MEM_PAGE[i] = 0;
}
- // 撪憻RAM/WRAM
+ // 鎾喕RAM/WRAM
MMU.SetPROM_Bank(0, MMU.RAM, MMU.BANKTYPE_RAM);
MMU.SetPROM_Bank(3, MMU.WRAM, MMU.BANKTYPE_RAM);
- // 僟儈乕
+ // 鍍熷剤涔
MMU.SetPROM_Bank(1, MMU.XRAM, MMU.BANKTYPE_ROM);
MMU.SetPROM_Bank(2, MMU.XRAM, MMU.BANKTYPE_ROM);
@@ -522,7 +522,7 @@ namespace VirtualNes.Core
}
}
}
- ppu.ScanlineNext(); // 偙傟偺埵抲偱儔僗僞乕宯偼夋柺偑堘偆
+ ppu.ScanlineNext(); // 鍋欏偀鍋哄煹鎶插伇鍎斿儣鍍炰箷瀹伡澶嬫熀鍋戝牁鍋
if (RenderMethod == EnumRenderMethod.PRE_ALL_RENDER)
EmulationCPU(nescfg.ScanlineCycles);
@@ -583,7 +583,7 @@ namespace VirtualNes.Core
{
pad.VSync();
- // VBLANK婜娫
+ // VBLANK濠滃ǐ
if (scanline == nescfg.TotalScanlines - 1)
{
ppu.VBlankEnd();
@@ -642,7 +642,7 @@ namespace VirtualNes.Core
if (scanline == 0)
{
- // 僟儈乕僗僉儍儞儔僀儞
+ // 鍍熷剤涔曞儣鍍夊剭鍎炲剶鍍鍎
// H-Draw (4fetches*32)
EmulationCPU(FETCH_CYCLES * 128);
ppu.FrameStart();
@@ -655,7 +655,7 @@ namespace VirtualNes.Core
}
else if (scanline < 240)
{
- // 僗僋儕乕儞昤夋(Scanline 1乣239)
+ // 鍍楀儖鍎曚箷鍎炴槫澶(Scanline 1涔239)
if (bDraw)
{
ppu.Scanline(scanline, Supporter.Config.graphics.bAllSprite, Supporter.Config.graphics.bLeftClip);
@@ -707,7 +707,7 @@ namespace VirtualNes.Core
}
else if (scanline == 240)
{
- // 僟儈乕僗僉儍儞儔僀儞 (Scanline 240)
+ // 鍍熷剤涔曞儣鍍夊剭鍎炲剶鍍鍎 (Scanline 240)
mapper.VSync();
EmulationCPU(nescfg.HDrawCycles);
@@ -720,7 +720,7 @@ namespace VirtualNes.Core
{
pad.VSync();
- // VBLANK婜娫
+ // VBLANK濠滃ǐ
if (scanline == nescfg.TotalScanlines - 1)
{
ppu.VBlankEnd();
@@ -864,7 +864,7 @@ namespace VirtualNes.Core
MMU.VROM_4K_SIZE = rom.GetVROM_SIZE() * 2;
MMU.VROM_8K_SIZE = rom.GetVROM_SIZE();
- // 僨僼僅儖僩僶儞僋
+ // 鍍ㄥ兗鍍呭剸鍍╁兌鍎炲儖
if (MMU.VROM_8K_SIZE != 0)
{
MMU.SetVROM_8K_Bank(0);
@@ -874,7 +874,7 @@ namespace VirtualNes.Core
MMU.SetCRAM_8K_Bank(0);
}
- // 儈儔乕
+ // 鍎堝剶涔
if (rom.Is4SCREEN())
{
MMU.SetVRAM_Mirror(MMU.VRAM_MIRROR4);
@@ -976,13 +976,13 @@ namespace VirtualNes.Core
reg.S = 0xFF;
reg.P = CPU.Z_FLAG | CPU.R_FLAG | CPU.I_FLAG;
- // 埨慡懳嶔傪寭偹偰偁偊偰儖乕僾偵(1昩暘)
+ // 鍩ㄦ叀鎳冲稊鍌鍋瑰伆鍋佸亰鍋板剸涔曞兙鍋(1鏄╂殬)
for (int i = 0; i < nescfg.TotalScanlines * 60; i++)
{
EmulationCPU(nescfg.ScanlineCycles);
cpu.GetContext(ref reg);
- // 柍尷儖乕僾偵擖偭偨偙偲傪妋擣偟偨傜敳偗傞
+ // 鏌嶅胺鍎栦箷鍍惧伒鎿栧伃鍋ㄥ仚鍋插偑濡嬫摚鍋熷仺鍌滄暢鍋楀倿
if (reg.PC == 0x4700)
{
break;
@@ -993,7 +993,7 @@ namespace VirtualNes.Core
}
cpu.GetContext(ref reg);
- // 柍尷儖乕僾偵擖偭偰偄偨傜嵞愝掕偡傞
+ // 鏌嶅胺鍎栦箷鍍惧伒鎿栧伃鍋板亜鍋ㄥ倻宓炴劃鎺曞仭鍌
if (reg.PC == 0x4700)
{
reg.PC = 0x4720; // Play Address
@@ -1009,7 +1009,7 @@ namespace VirtualNes.Core
else
{
cpu.GetContext(ref reg);
- reg.PC = 0x4700; // 柍尷儖乕僾
+ reg.PC = 0x4700; // 鏌嶅胺鍎栦箷鍍
reg.S = 0xFF;
EmulationCPU(nescfg.ScanlineCycles * nescfg.TotalScanlines);
@@ -1186,7 +1186,7 @@ namespace VirtualNes.Core
if (m_BarcodeCycles > 1000)
{
m_BarcodeCycles = 0;
- // 掆巭丠
+ // 鎺嗗翻涓
if (m_BarcodeData[m_BarcodePtr] != 0xFF)
{
m_BarcodeOut = m_BarcodeData[m_BarcodePtr++];
@@ -1227,7 +1227,7 @@ namespace VirtualNes.Core
return;
m_TapeCycles += (nescfg.CpuClock / 32000.0);
- // m_TapeCycles += (nescfg.CpuClock / 22050.0); // 抶偡偓偰僟儊偭傐偄
+ // m_TapeCycles += (nescfg.CpuClock / 22050.0); // 鎶跺仭鍋撳伆鍍熷剨鍋倫鍋
if (m_bTapePlay)
{
@@ -1293,7 +1293,7 @@ namespace VirtualNes.Core
return MMU.CPU_MEM_BANK[addr >> 13][addr & 0x1FFF];
}
- return 0x00; // Warning梊杊
+ return 0x00; // Warning姊婃潑
}
private byte ReadReg(ushort addr)
@@ -1504,7 +1504,7 @@ namespace VirtualNes.Core
pad.Write(addr, data);
apu.Write(addr, data);
break;
- // VirtuaNES屌桳億乕僩
+ // VirtuaNES灞屾〕鍎勪箷鍍
case 0x18:
apu.Write(addr, data);
break;
@@ -1596,7 +1596,7 @@ namespace VirtualNes.Core
ref state.reg.cpureg.FrameIRQ_type,
ref state.reg.cpureg.FrameIRQ,
ref state.reg.cpureg.FrameIRQ_occur);
- state.reg.cpureg.FrameIRQ_cycles = cycles; // 参照がINTな為(ぉ
+ state.reg.cpureg.FrameIRQ_cycles = cycles; // 鍙傜収銇孖NT銇偤锛堛亯
state.reg.cpureg.DMA_cycles = cpu.GetDmaCycles();
state.reg.cpureg.emul_cycles = emul_cycles;
@@ -1625,7 +1625,7 @@ namespace VirtualNes.Core
MemoryUtility.memcpy(state.ram.SPPAL, MMU.SPPAL, state.ram.SPPAL.Length);
MemoryUtility.memcpy(state.ram.SPRAM, MMU.SPRAM, state.ram.SPRAM.Length);
- // S-RAM STATE(使用/未使用に関わらず存在すればセーブする)
+ // S-RAM STATE(浣跨敤/鏈娇鐢ㄣ伀闁€倧銈夈仛瀛樺湪銇欍倢銇般偦銉笺儢銇欍倠)
if (rom.IsSAVERAM())
{
size = (uint)SAVERAM_SIZE;
@@ -1649,9 +1649,9 @@ namespace VirtualNes.Core
uint size = 0;
// SAVE CPU MEMORY BANK DATA
- // BANK0,1,2はバンクセーブに関係なし
- // VirtuaNES0.30から
- // バンク3はSRAM使用に関わらずセーブ
+ // BANK0,1,2銇儛銉炽偗銈汇兗銉栥伀闁總銇仐
+ // VirtuaNES0.30銇嬨倝
+ // 銉愩兂銈紦銇疭RAM浣跨敤銇枹銈忋倝銇氥偦銉笺儢
for (int i = 3; i < 8; i++)
{
state.mmu.CPU_MEM_TYPE[i] = MMU.CPU_MEM_TYPE[i];
@@ -1696,7 +1696,7 @@ namespace VirtualNes.Core
}
}
- // WRITE VRAM MEMORY(常に4K分すべて書き込む)
+ // WRITE VRAM MEMORY(甯搞伀4K鍒嗐仚銇广仸鏇搞亶杈笺個)
state.VRAM = new byte[4 * 1024];
Array.Copy(MMU.VRAM, state.VRAM, state.VRAM.Length);
@@ -1764,7 +1764,7 @@ namespace VirtualNes.Core
int DiskSize = 16 + 65500 * rom.GetDiskNo();
- // 相違数をカウント
+ // 鐩搁仌鏁般倰銈偊銉炽儓
for (int i = 16; i < DiskSize; i++)
{
if (lpWrite[i] != 0)
@@ -1874,9 +1874,9 @@ namespace VirtualNes.Core
//BANK STATE
{
// SAVE CPU MEMORY BANK DATA
- // BANK0,1,2はバンクセーブに関係なし
- // VirtuaNES0.30から
- // バンク3はSRAM使用に関わらずセーブ
+ // BANK0,1,2銇儛銉炽偗銈汇兗銉栥伀闁總銇仐
+ // VirtuaNES0.30銇嬨倝
+ // 銉愩兂銈紦銇疭RAM浣跨敤銇枹銈忋倝銇氥偦銉笺儢
for (byte i = 3; i < 8; i++)
{
MMU.CPU_MEM_TYPE[i] = state.mmu.CPU_MEM_TYPE[i];
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/BLOCKHDR.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/BLOCKHDR.cs
index d43a25e..cba1d1d 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/BLOCKHDR.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/BLOCKHDR.cs
@@ -2,7 +2,7 @@
{
public struct BLOCKHDR : IStateBufferObject
{
- public bool Valid => !string.IsNullOrEmpty(ID);
+ public bool Valid => !string.IsNullOrEmpty(ID);
/// 鎬绘槸8涓瓧鑺
public string ID;
public ushort Reserved;
@@ -11,12 +11,12 @@
- public uint GetSize()
+ public uint GetSize()
{
return (uint)(8 + sizeof(ushort) + sizeof(ushort) + sizeof(uint));
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
if (Valid)
{
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/CTRSTAT.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/CTRSTAT.cs
index 24ec730..b07bedf 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/CTRSTAT.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/CTRSTAT.cs
@@ -8,12 +8,12 @@
public uint pad4bit;
public byte strobe;
- public uint GetSize()
+ public uint GetSize()
{
return sizeof(uint) * 4 + sizeof(byte);
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
buffer.Write(pad1bit);
buffer.Write(pad2bit);
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/EXCTRSTAT.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/EXCTRSTAT.cs
index 6c24dc6..ee1681e 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/EXCTRSTAT.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/EXCTRSTAT.cs
@@ -4,12 +4,12 @@
{
public uint data;
- public uint GetSize()
+ public uint GetSize()
{
return sizeof(uint);
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
buffer.Write(data);
}
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/FILEHDR2.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/FILEHDR2.cs
index cbcafdc..e9a789b 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/FILEHDR2.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/FILEHDR2.cs
@@ -14,12 +14,12 @@
- public uint GetSize()
+ public uint GetSize()
{
return (uint)(ID.Length + sizeof(ushort) + sizeof(uint) + sizeof(ushort) + sizeof(ushort));
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
buffer.Write(ID);
buffer.Write(BlockVersion);
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/MMCSTAT.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/MMCSTAT.cs
index 0ea4f3f..918b122 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/MMCSTAT.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/MMCSTAT.cs
@@ -9,12 +9,12 @@
return new MMCSTAT() { mmcdata = new byte[256] };
}
- public uint GetSize()
+ public uint GetSize()
{
return 256;
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
buffer.Write(mmcdata);
}
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/RAMSTAT.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/RAMSTAT.cs
index 2ef839a..8d7f141 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/RAMSTAT.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/RAMSTAT.cs
@@ -22,12 +22,12 @@ namespace VirtualNes.Core
return res;
}
- public uint GetSize()
+ public uint GetSize()
{
return (uint)(RAM.Length + BGPAL.Length + SPPAL.Length + SPRAM.Length);
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
buffer.Write(RAM);
buffer.Write(BGPAL);
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/REGSTAT.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/REGSTAT.cs
index d773439..4033397 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/REGSTAT.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/REGSTAT.cs
@@ -7,12 +7,12 @@
- public uint GetSize()
+ public uint GetSize()
{
return cpureg.GetSize() + ppureg.GetSize();
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
cpureg.SaveState(buffer);
ppureg.SaveState(buffer);
@@ -45,12 +45,12 @@
public long emul_cycles;
public long base_cycles;
- public uint GetSize()
+ public uint GetSize()
{
return 32;
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
buffer.Write(PC);
buffer.Write(A);
@@ -102,12 +102,12 @@
public ushort loopy_v;
public ushort loopy_x;
- public uint GetSize()
+ public uint GetSize()
{
return 12;
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
buffer.Write(reg0);
buffer.Write(reg1);
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/SNDSTAT.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/SNDSTAT.cs
index a546561..4ed6c4c 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/SNDSTAT.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/SNDSTAT.cs
@@ -9,12 +9,12 @@
return new SNDSTAT() { snddata = new byte[0x800] };
}
- public uint GetSize()
+ public uint GetSize()
{
return (uint)snddata.Length;
}
- public void SaveState(StateBuffer buffer)
+ public void SaveState(StateBuffer buffer)
{
buffer.Write(snddata);
}
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/State.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/State.cs
index 02d3261..6b66f70 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/State.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/State/State.cs
@@ -36,7 +36,7 @@ namespace VirtualNes.Core
public BLOCKHDR exctrBLOCK;
public EXCTRSTAT exctr;
- public byte[] ToBytes()
+ public byte[] ToBytes()
{
StateBuffer buffer = new StateBuffer();
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/Supporter/ControllerState.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/Supporter/ControllerState.cs
index 409ba18..edb443d 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/Supporter/ControllerState.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/Supporter/ControllerState.cs
@@ -2,7 +2,7 @@
namespace VirtualNes.Core
{
- public struct ControllerState
+ public struct ControllerState : IEquatable
{
public uint raw0;
public uint raw1;
@@ -11,19 +11,55 @@ namespace VirtualNes.Core
public bool valid;
- public ControllerState(
- EnumButtonType player0_buttons,
- EnumButtonType player1_buttons,
- EnumButtonType player2_buttons,
- EnumButtonType player3_buttons)
+ public ControllerState(EnumButtonType[] states)
{
- raw0 = (uint)player0_buttons;
- raw1 = (uint)player1_buttons;
- raw2 = (uint)player2_buttons;
- raw3 = (uint)player3_buttons;
+ raw0 = (uint)states[0];
+ raw1 = (uint)states[1];
+ raw2 = (uint)states[2];
+ raw3 = (uint)states[3];
valid = true;
}
+
+ public bool HasButton(int player, EnumButtonType button)
+ {
+ uint raw;
+ switch (player)
+ {
+ case 0: raw = raw0; break;
+ case 1: raw = raw1; break;
+ case 2: raw = raw2; break;
+ case 3: raw = raw3; break;
+ default:
+ raw = 0;
+ break;
+ }
+ return (raw & (uint)button) == (uint)button;
+ }
+
+ public override string ToString()
+ {
+ return $"{raw0}|{raw1}|{raw2}|{raw3}";
+ }
+
+ #region Impl_Equals
+ public bool Equals(ControllerState other)
+ {
+ return raw0 == other.raw0 && raw1 == other.raw1 && raw2 == other.raw2 && raw3 == other.raw3 && valid == other.valid;
+ }
+
+ public override bool Equals(object obj)
+ {
+ return obj is ControllerState other && Equals(other);
+ }
+
+ public override int GetHashCode()
+ {
+ //return HashCode.Combine(raw0, raw1, raw2, raw3, valid);
+ return raw0.GetHashCode()+ raw1.GetHashCode()+ raw2.GetHashCode()+ raw3.GetHashCode();
+
+ }
+
public static bool operator ==(ControllerState left, ControllerState right)
{
return
@@ -37,24 +73,7 @@ namespace VirtualNes.Core
{
return !(left == right);
}
-
- public override string ToString()
- {
- return $"{raw0}|{raw1}|{raw2}|{raw3}";
- }
-
- public bool HasButton(int player, EnumButtonType button)
- {
- uint raw = 0;
- switch (player)
- {
- case 0: raw = raw0; break;
- case 1: raw = raw1; break;
- case 2: raw = raw2; break;
- case 3: raw = raw3; break;
- }
- return (raw & (uint)button) == (uint)button;
- }
+ #endregion
}
[Flags]
diff --git a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/Supporter/Supporter.cs b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/Supporter/Supporter.cs
index 41ec222..2254833 100644
--- a/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/Supporter/Supporter.cs
+++ b/AxibugEmuOnline.Client.Transplant/Assets/VirtualNes.Core/Supporter/Supporter.cs
@@ -5,6 +5,7 @@ namespace VirtualNes.Core
public static class Supporter
{
private static ISupporterImpl s_support;
+
public static void Setup(ISupporterImpl supporter)
{
s_support = supporter;
@@ -44,6 +45,7 @@ namespace VirtualNes.Core
{
s_support.SaveFile(fileData, directPath, fileName);
}
+
public static Stream OpenFile(string directPath, string fileName)
{
return s_support.OpenFile(directPath, fileName);
@@ -64,6 +66,11 @@ namespace VirtualNes.Core
s_support.SampleInput(frameCount);
}
+ public static IControllerSetuper GetControllerSetuper()
+ {
+ return s_support.GetControllerSetuper();
+ }
+
public static EmulatorConfig Config => s_support.Config;
}
@@ -82,5 +89,21 @@ namespace VirtualNes.Core
bool TryGetMapperNo(ROM rom, out int mapperNo);
ControllerState GetControllerState();
void SampleInput(uint frameCount);
+ IControllerSetuper GetControllerSetuper();
}
-}
+
+ ///
+ /// 璐熻矗绠$悊鏈湴鎺у埗鍣ㄤ笌鍏蜂綋娓告垙涔嬮棿鐨勬Ы浣嶅垎閰
+ ///
+ public interface IControllerSetuper
+ {
+ ///
+ /// 璁剧疆鏈湴鎵嬫焺涓庢父鎴忔墜鏌勬Ы浣嶇殑鏄犲皠
+ ///
+ void SetConnect(
+ uint? con0ToSlot = null,
+ uint? con1ToSlot = null,
+ uint? con2ToSlot = null,
+ uint? con3ToSlot = null);
+ }
+}
\ No newline at end of file