Compare commits

..

No commits in common. "ef1c43d3fc0be36a0d1b9a99538ca3cd49454b34" and "3bbb347e8448b6551b3718ae12b036985c04d25c" have entirely different histories.

7 changed files with 52 additions and 63 deletions

View File

@ -13,7 +13,7 @@ namespace AxibugEmuOnline.Client
void Pause(); void Pause();
void Resume(); void Resume();
void SetupScheme(); void SetupScheme();
MsgBool StartGame(RomFile romFile); void StartGame(RomFile romFile);
void DoReset(); void DoReset();
IControllerSetuper GetControllerSetuper(); IControllerSetuper GetControllerSetuper();

View File

@ -56,27 +56,19 @@ namespace AxibugEmuOnline.Client.Manager
break; break;
} }
var result = m_emuCore.StartGame(romFile); m_emuCore.StartGame(romFile);
if (result) LaunchUI.Instance.HideMainMenu();
{ InGameUI.Instance.Show(romFile, m_emuCore);
LaunchUI.Instance.HideMainMenu();
InGameUI.Instance.Show(romFile, m_emuCore);
m_emuCore.SetupScheme(); m_emuCore.SetupScheme();
m_controllerSetuper = m_emuCore.GetControllerSetuper(); m_controllerSetuper = m_emuCore.GetControllerSetuper();
//自动分配0号手柄到0号手柄位 //自动分配0号手柄到0号手柄位
m_controllerSetuper.SetConnect(con0ToSlot: 0); m_controllerSetuper.SetConnect(con0ToSlot: 0);
Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged); Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged);
Eventer.Instance.RegisterEvent(EEvent.OnRoomSlotDataChanged, OnSlotDataChanged); Eventer.Instance.RegisterEvent(EEvent.OnRoomSlotDataChanged, OnSlotDataChanged);
}
else
{
StopGame();
OverlayManager.PopTip(result);
}
} }
private void OnSlotDataChanged() private void OnSlotDataChanged()

View File

@ -96,12 +96,11 @@ namespace AxibugEmuOnline.Client
if (Path.GetExtension(LocalFilePath).ToLower() == ".zip") if (Path.GetExtension(LocalFilePath).ToLower() == ".zip")
{ {
var zip = new ZipInputStream(new MemoryStream(bytes)); var zip = new ZipInputStream(new MemoryStream(bytes));
while (true) var entry = zip.GetNextEntry() as ZipEntry;
{
var currentEntry = zip.GetNextEntry();
if (currentEntry == null) break;
if (!currentEntry.Name.ToLower().EndsWith(".nes")) continue; while (entry != null)
{
if (!entry.Name.ToLower().EndsWith(".nes")) continue;
var buffer = new byte[1024]; var buffer = new byte[1024];
MemoryStream output = new MemoryStream(); MemoryStream output = new MemoryStream();
@ -127,36 +126,36 @@ namespace AxibugEmuOnline.Client
{ {
downloadRequest = AxiHttpProxy.GetDownLoad($"{App.httpAPI.WebHost}/{webData.url}"); downloadRequest = AxiHttpProxy.GetDownLoad($"{App.httpAPI.WebHost}/{webData.url}");
while (!downloadRequest.downloadHandler.isDone) while (!downloadRequest.downloadHandler.isDone)
{ {
yield return null; yield return null;
Debug.Log($"下载进度:{downloadRequest.downloadHandler.DownLoadPr} ->{downloadRequest.downloadHandler.loadedLenght}/{downloadRequest.downloadHandler.NeedloadedLenght}"); Debug.Log($"下载进度:{downloadRequest.downloadHandler.DownLoadPr} ->{downloadRequest.downloadHandler.loadedLenght}/{downloadRequest.downloadHandler.NeedloadedLenght}");
} }
AxiHttpProxy.ShowAxiHttpDebugInfo(downloadRequest.downloadHandler); AxiHttpProxy.ShowAxiHttpDebugInfo(downloadRequest.downloadHandler);
var request = downloadRequest; var request = downloadRequest;
downloadRequest = null; downloadRequest = null;
if (!request.downloadHandler.bHadErr) if (!request.downloadHandler.bHadErr)
callback(request.downloadHandler.data); callback(request.downloadHandler.data);
else else
callback(null); callback(null);
//downloadRequest = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{webData.url}"); //downloadRequest = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{webData.url}");
//yield return downloadRequest.SendWebRequest(); //yield return downloadRequest.SendWebRequest();
//var request = downloadRequest; //var request = downloadRequest;
//downloadRequest = null; //downloadRequest = null;
//if (request.result != UnityWebRequest.Result.Success) //if (request.result != UnityWebRequest.Result.Success)
//{ //{
// callback(null); // callback(null);
//} //}
//else //else
//{ //{
// callback(request.downloadHandler.data); // callback(request.downloadHandler.data);
//} //}
} }
public void SetWebData(HttpAPI.Resp_RomInfo resp_RomInfo) public void SetWebData(HttpAPI.Resp_RomInfo resp_RomInfo)
{ {

View File

@ -63,7 +63,7 @@ namespace AxibugEmuOnline.Client
/// <summary> /// <summary>
/// 指定ROM开始游戏 /// 指定ROM开始游戏
/// </summary> /// </summary>
public MsgBool StartGame(RomFile rom) public void StartGame(RomFile rom)
{ {
StopGame(); StopGame();
@ -76,13 +76,11 @@ namespace AxibugEmuOnline.Client
try try
{ {
NesCore = new NES(rom.FileName); NesCore = new NES(rom.FileName);
return true;
} }
catch (Exception ex) catch (Exception ex)
{ {
NesCore = null; NesCore = null;
App.log.Error(ex.ToString()); App.log.Error(ex.ToString());
return ex.Message;
} }
} }

View File

@ -207,7 +207,7 @@ namespace VirtualNes
{ {
for (byte i = 0; i < 8; i++) for (byte i = 0; i < 8; i++)
{ {
SetCRAM_1K_Bank(i, bank * 8 + i); SetCRAM_1K_Bank(i, bank * 8 + 1);
} }
} }

View File

@ -40,7 +40,7 @@ namespace VirtualNes.Core
irq_latch = 0; irq_latch = 0;
irq_clock = 0; irq_clock = 0;
//reg[9] = 1; reg[9] = 1;
SetPROM_32K_Bank(0, 1, PROM_8K_SIZE - 2, PROM_8K_SIZE - 1); SetPROM_32K_Bank(0, 1, PROM_8K_SIZE - 2, PROM_8K_SIZE - 1);
SetVROM_8K_Bank(0); SetVROM_8K_Bank(0);