From 3bbb347e8448b6551b3718ae12b036985c04d25c Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Mon, 6 Jan 2025 11:59:06 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=8B=89=E5=8F=96rom=E5=88=97=E8=A1=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/AppMain/Manager/HttpAPI.cs | 29 +- .../Script/AppMain/Manager/RomLib/RomLib.cs | 334 ++++++++++-------- 2 files changed, 191 insertions(+), 172 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/HttpAPI.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/HttpAPI.cs index 06efc208..ece039cf 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/HttpAPI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/HttpAPI.cs @@ -1,4 +1,4 @@ -using AxibugEmuOnline.Client.ClientCore; +using AxibugEmuOnline.Client.ClientCore; using System; using System.Collections; using System.Collections.Generic; @@ -12,21 +12,20 @@ namespace AxibugEmuOnline.Client public string WebHost = "http://emu.axibug.com"; public string WebSiteApi => WebHost + "/api"; - public delegate void GetRomListAPI(Action callback, int page, int pageSize = 10); - public delegate void SearchRomListAPI(Action callback, string searchKey, int page, int pageSize = 10); - - public void GetNesRomList(Action callback, int page, int pageSize = 10) + public delegate void GetRomListAPI(Action callback, int page, int pageSize = 10); + public delegate void SearchRomListAPI(Action callback, string searchKey, int page, int pageSize = 10); + + public void GetNesRomList(Action callback, int page, int pageSize = 10) { App.StartCoroutine(GetNesRomListFlow(page, pageSize, callback)); } - public void SearchNesRomList(Action callback, string searchKey, int page, int pageSize = 10) + public void SearchNesRomList(Action callback, string searchKey, int page, int pageSize = 10) { App.StartCoroutine(SearchNesRomListFlow(searchKey, page, pageSize, callback)); } - private IEnumerator SearchNesRomListFlow(string searchKey, int page, int pageSize, Action callback) + private IEnumerator SearchNesRomListFlow(string searchKey, int page, int pageSize, Action callback) { - if (!string.IsNullOrEmpty(searchKey)) { string oldsearch = searchKey; @@ -48,19 +47,19 @@ namespace AxibugEmuOnline.Client yield return request.SendWebRequest; if (!request.downloadHandler.isDone) { - callback.Invoke(null); + callback.Invoke(page, null); yield break; } if (!request.downloadHandler.bHadErr) { var resp = JsonUtility.FromJson(request.downloadHandler.text); - callback.Invoke(resp); + callback.Invoke(page, resp); yield break; } App.log.Error(request.downloadHandler.ErrInfo); - callback.Invoke(null); + callback.Invoke(page, null); /* UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}"); @@ -73,7 +72,7 @@ namespace AxibugEmuOnline.Client }*/ } - private IEnumerator GetNesRomListFlow(int page, int pageSize, Action callback) + private IEnumerator GetNesRomListFlow(int page, int pageSize, Action callback) { string url = $"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}"; App.log.Info($"GetRomList=>{url}"); @@ -81,7 +80,7 @@ namespace AxibugEmuOnline.Client yield return request.SendWebRequest; if (!request.downloadHandler.isDone) { - callback.Invoke(null); + callback.Invoke(page, null); yield break; } @@ -89,12 +88,12 @@ namespace AxibugEmuOnline.Client if (!request.downloadHandler.bHadErr) { var resp = JsonUtility.FromJson(request.downloadHandler.text); - callback.Invoke(resp); + callback.Invoke(page, resp); yield break; } App.log.Error(request.downloadHandler.ErrInfo); - callback.Invoke(null); + callback.Invoke(page, null); /* UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}"); yield return request.SendWebRequest(); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomLib.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomLib.cs index 8db25e0c..20f31484 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomLib.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomLib.cs @@ -6,161 +6,181 @@ using System.IO; using static AxibugEmuOnline.Client.HttpAPI; namespace AxibugEmuOnline.Client -{ - public class RomLib - { - /// Rom请求,一页的大小 - private const int PAGE_SIZE = 10; - - /// 请求指令 - private HashSet FetchPageCmd = new HashSet(); - private RomFile[] nesRomFetchList; - private Dictionary nesRomFileIdMapper = new Dictionary(); - private Dictionary nesRomFileNameMapper = new Dictionary(); - private HttpAPI.GetRomListAPI m_romGetFunc; - private HttpAPI.SearchRomListAPI m_romSearchFunc; - private EnumSupportEmuPlatform m_platform; - private string lastSearchKey; - - public RomLib(EnumSupportEmuPlatform platform) - { - m_platform = platform; - switch (platform) - { - case EnumSupportEmuPlatform.NES: - m_romGetFunc = App.httpAPI.GetNesRomList; - m_romSearchFunc = App.httpAPI.SearchNesRomList; - break; - } - } - - public RomFile GetExistRom(string fileName) - { - var res = RomFile.CreateExistRom(m_platform, fileName); - - nesRomFileNameMapper[res.FileName] = res; - - return res; - } - - public RomFile GetRomFile(string romFileName) - { - RomFile romFile; - nesRomFileNameMapper.TryGetValue(romFileName, out romFile); - return romFile; - } - - - - /// 清除所有下载的Rom文件 - public void ClearRomFile() - { - var path = $"{App.PersistentDataPath}/RemoteRoms/{m_platform}"; - if (Directory.Exists(path)) Directory.Delete(path, true); - } - - /// 移除一个已下载的Rom - public void RemoveOneRomFile(RomFile romFile) - { - if (romFile.RomReady) - File.Delete(romFile.LocalFilePath); - } - - /// - /// 获得所有Rom文件 - /// - /// - public void FetchRomCount(Action callback, string searchKey = null) - { - lastSearchKey = searchKey; - if (string.IsNullOrWhiteSpace(searchKey)) - { - m_romGetFunc((romList) => - { - //TODO 请求失败对于romList为空时的处理 - - FetchPageCmd.Clear(); - nesRomFileIdMapper.Clear(); - nesRomFileNameMapper.Clear(); - nesRomFetchList = new RomFile[romList.resultAllCount]; - for (int i = 0; i < nesRomFetchList.Length; i++) - { - //以后考虑用对象池实例化RomFile - nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE); - } - SaveRomInfoFromWeb(romList); - - callback.Invoke(nesRomFetchList); - }, 0, PAGE_SIZE); - } - else - { - m_romSearchFunc((romList) => - { - //TODO 请求失败对于romList为空时的处理 - - FetchPageCmd.Clear(); - nesRomFileIdMapper.Clear(); - nesRomFileNameMapper.Clear(); - nesRomFetchList = new RomFile[romList.resultAllCount]; - for (int i = 0; i < nesRomFetchList.Length; i++) - { - //以后考虑用对象池实例化RomFile - nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE); - } - SaveRomInfoFromWeb(romList); - - callback.Invoke(nesRomFetchList); - }, searchKey, 0, PAGE_SIZE); - } - } - - public void BeginFetchRomInfo(RomFile romFile) - { - if (romFile.InfoReady) return; - - FetchPageCmd.Add(romFile.Page); - } - - public void ExecuteFetchRomInfo() - { - if (FetchPageCmd.Count == 0) return; - - foreach (var pageNo in FetchPageCmd) - { - if (!string.IsNullOrEmpty(lastSearchKey)) - { - m_romSearchFunc(SaveRomInfoFromWeb, lastSearchKey, pageNo, PAGE_SIZE); - } - else - { - m_romGetFunc(SaveRomInfoFromWeb, pageNo, PAGE_SIZE); - } - } - FetchPageCmd.Clear(); - } - - private void SaveRomInfoFromWeb(Resp_GameList resp) - { - for (int i = 0; i < resp.gameList.Count; i++) - { - var webData = resp.gameList[i]; - RomFile targetRomFile = nesRomFetchList[webData.orderid]; - - targetRomFile.SetWebData(webData); - nesRomFileIdMapper[webData.id] = nesRomFetchList[webData.orderid]; - nesRomFileNameMapper[targetRomFile.FileName] = targetRomFile; - } - } - - public static string CalcHash(byte[] data) - { - return Helper.FileMD5Hash(data); - } - - public void AddRomFile(RomFile rom) - { - nesRomFileNameMapper[rom.FileName] = rom; - } - } +{ + public class RomLib + { + /// Rom请求,一页的大小 + private const int PAGE_SIZE = 10; + + /// 请求指令 + private HashSet FetchPageCmd = new HashSet(); + private RomFile[] nesRomFetchList; + private Dictionary nesRomFileIdMapper = new Dictionary(); + private Dictionary nesRomFileNameMapper = new Dictionary(); + private HttpAPI.GetRomListAPI m_romGetFunc; + private HttpAPI.SearchRomListAPI m_romSearchFunc; + private EnumSupportEmuPlatform m_platform; + private string lastSearchKey; + + public RomLib(EnumSupportEmuPlatform platform) + { + m_platform = platform; + switch (platform) + { + case EnumSupportEmuPlatform.NES: + m_romGetFunc = App.httpAPI.GetNesRomList; + m_romSearchFunc = App.httpAPI.SearchNesRomList; + break; + } + } + + public RomFile GetExistRom(string fileName) + { + var res = RomFile.CreateExistRom(m_platform, fileName); + + nesRomFileNameMapper[res.FileName] = res; + + return res; + } + + public RomFile GetRomFile(string romFileName) + { + RomFile romFile; + nesRomFileNameMapper.TryGetValue(romFileName, out romFile); + return romFile; + } + + + + /// 清除所有下载的Rom文件 + public void ClearRomFile() + { + var path = $"{App.PersistentDataPath}/RemoteRoms/{m_platform}"; + if (Directory.Exists(path)) Directory.Delete(path, true); + } + + /// 移除一个已下载的Rom + public void RemoveOneRomFile(RomFile romFile) + { + if (romFile.RomReady) + File.Delete(romFile.LocalFilePath); + } + + /// + /// 获得所有Rom文件 + /// + /// + public void FetchRomCount(Action callback, string searchKey = null) + { + lastSearchKey = searchKey; + if (string.IsNullOrWhiteSpace(searchKey)) + { + m_romGetFunc((page, romList) => + { + FetchPageCmd.Clear(); + nesRomFileIdMapper.Clear(); + nesRomFileNameMapper.Clear(); + + if (romList != null) + nesRomFetchList = new RomFile[romList.resultAllCount]; + else + nesRomFetchList = new RomFile[0]; + + for (int i = 0; i < nesRomFetchList.Length; i++) + { + //以后考虑用对象池实例化RomFile + nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE); + } + SaveRomInfoFromWeb(romList); + + callback.Invoke(nesRomFetchList); + }, 0, PAGE_SIZE); + } + else + { + m_romSearchFunc((page, romList) => + { + FetchPageCmd.Clear(); + nesRomFileIdMapper.Clear(); + nesRomFileNameMapper.Clear(); + + if (romList != null) + nesRomFetchList = new RomFile[romList.resultAllCount]; + else + nesRomFetchList = new RomFile[0]; + + for (int i = 0; i < nesRomFetchList.Length; i++) + { + //以后考虑用对象池实例化RomFile + nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE); + } + SaveRomInfoFromWeb(romList); + + callback.Invoke(nesRomFetchList); + }, searchKey, 0, PAGE_SIZE); + } + } + + bool m_needFetch = false; + public void BeginFetchRomInfo(RomFile romFile) + { + if (romFile.InfoReady) return; + + if (FetchPageCmd.Add(romFile.Page)) + m_needFetch = true; + } + + public void ExecuteFetchRomInfo() + { + if (FetchPageCmd.Count == 0) return; + if (!m_needFetch) return; + + foreach (var pageNo in FetchPageCmd) + { + if (!string.IsNullOrEmpty(lastSearchKey)) + { + m_romSearchFunc((page, resp) => + { + FetchPageCmd.Remove(page); + SaveRomInfoFromWeb(resp); + }, lastSearchKey, pageNo, PAGE_SIZE); + } + else + { + m_romGetFunc((page, resp) => + { + FetchPageCmd.Remove(page); + SaveRomInfoFromWeb(resp); + }, pageNo, PAGE_SIZE); + } + } + + m_needFetch = false; + } + + private void SaveRomInfoFromWeb(Resp_GameList resp) + { + if (resp == null) return; + + for (int i = 0; i < resp.gameList.Count; i++) + { + var webData = resp.gameList[i]; + RomFile targetRomFile = nesRomFetchList[webData.orderid]; + + targetRomFile.SetWebData(webData); + nesRomFileIdMapper[webData.id] = nesRomFetchList[webData.orderid]; + nesRomFileNameMapper[targetRomFile.FileName] = targetRomFile; + } + } + + public static string CalcHash(byte[] data) + { + return Helper.FileMD5Hash(data); + } + + public void AddRomFile(RomFile rom) + { + nesRomFileNameMapper[rom.FileName] = rom; + } + } } -- 2.36.0.windows.1 From cd49086ddf7dd1d0d8e4ed6ec5d1c34d30220c1f Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Mon, 6 Jan 2025 16:45:54 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8DMapper023=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84reg[9]=E8=B6=8A=E7=95=8C=E9=97=AE=E9=A2=98(vi?= =?UTF-8?q?rtuanes=E6=BA=90=E7=A0=81=E5=B0=B1=E6=9C=89=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E9=97=AE=E9=A2=98,=E4=BD=86=E6=98=AFc++=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E4=B8=8D=E4=BC=9A=E6=9C=89=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/VirtualNes.Core/Mapper/Mapper023.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper023.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper023.cs index 26d768b5..f804278f 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper023.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper023.cs @@ -40,7 +40,7 @@ namespace VirtualNes.Core irq_latch = 0; irq_clock = 0; - reg[9] = 1; + //reg[9] = 1; SetPROM_32K_Bank(0, 1, PROM_8K_SIZE - 2, PROM_8K_SIZE - 1); SetVROM_8K_Bank(0); -- 2.36.0.windows.1 From ef0ab9ccb16996c54c7774644f89362c1e1db61f Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Mon, 6 Jan 2025 16:48:04 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmmu=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=B8=AD,=E4=B8=80=E5=A4=84=E6=BA=90?= =?UTF-8?q?=E7=A0=81=E7=BF=BB=E8=AF=91=E9=94=99=E8=AF=AFi=E9=94=99?= =?UTF-8?q?=E5=86=99=E6=88=90=E4=BA=861?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Client/Assets/VirtualNes.Core/MMU.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/MMU.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/MMU.cs index 1f50ab73..b8aea510 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/MMU.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/MMU.cs @@ -207,7 +207,7 @@ namespace VirtualNes { for (byte i = 0; i < 8; i++) { - SetCRAM_1K_Bank(i, bank * 8 + 1); + SetCRAM_1K_Bank(i, bank * 8 + i); } } -- 2.36.0.windows.1 From ef1c43d3fc0be36a0d1b9a99538ca3cd49454b34 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Mon, 6 Jan 2025 16:48:48 +0800 Subject: [PATCH 4/5] =?UTF-8?q?IEmuCore=E6=8E=A5=E5=8F=A3=E5=8F=98?= =?UTF-8?q?=E6=9B=B4,StartGame=E4=BC=9A=E8=BF=94=E5=9B=9E=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E5=A4=B1=E8=B4=A5=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/AppMain/IEmuCore.cs | 2 +- .../Assets/Script/AppMain/Manager/AppEmu.cs | 32 +++++---- .../Script/AppMain/Manager/RomLib/RomFile.cs | 71 ++++++++++--------- .../Script/AppMain/NesEmulator/NesEmulator.cs | 4 +- .../Supporter/ControllerState.cs | 2 +- 5 files changed, 61 insertions(+), 50 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs index c23d826f..4ca46464 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs @@ -13,7 +13,7 @@ namespace AxibugEmuOnline.Client void Pause(); void Resume(); void SetupScheme(); - void StartGame(RomFile romFile); + MsgBool StartGame(RomFile romFile); void DoReset(); IControllerSetuper GetControllerSetuper(); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs index 5bed4b24..9012dbe9 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs @@ -56,19 +56,27 @@ namespace AxibugEmuOnline.Client.Manager break; } - m_emuCore.StartGame(romFile); - LaunchUI.Instance.HideMainMenu(); - InGameUI.Instance.Show(romFile, m_emuCore); - - m_emuCore.SetupScheme(); - - m_controllerSetuper = m_emuCore.GetControllerSetuper(); + var result = m_emuCore.StartGame(romFile); + if (result) + { + LaunchUI.Instance.HideMainMenu(); + InGameUI.Instance.Show(romFile, m_emuCore); - //自动分配0号手柄到0号手柄位 - m_controllerSetuper.SetConnect(con0ToSlot: 0); - Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged); - - Eventer.Instance.RegisterEvent(EEvent.OnRoomSlotDataChanged, OnSlotDataChanged); + m_emuCore.SetupScheme(); + + m_controllerSetuper = m_emuCore.GetControllerSetuper(); + + //自动分配0号手柄到0号手柄位 + m_controllerSetuper.SetConnect(con0ToSlot: 0); + Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged); + + Eventer.Instance.RegisterEvent(EEvent.OnRoomSlotDataChanged, OnSlotDataChanged); + } + else + { + StopGame(); + OverlayManager.PopTip(result); + } } private void OnSlotDataChanged() diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomFile.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomFile.cs index 68c80391..6cd9e04d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomFile.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/RomLib/RomFile.cs @@ -95,12 +95,13 @@ namespace AxibugEmuOnline.Client var bytes = File.ReadAllBytes(LocalFilePath); if (Path.GetExtension(LocalFilePath).ToLower() == ".zip") { - var zip = new ZipInputStream(new MemoryStream(bytes)); - var entry = zip.GetNextEntry() as ZipEntry; - - while (entry != null) + var zip = new ZipInputStream(new MemoryStream(bytes)); + while (true) { - if (!entry.Name.ToLower().EndsWith(".nes")) continue; + var currentEntry = zip.GetNextEntry(); + if (currentEntry == null) break; + + if (!currentEntry.Name.ToLower().EndsWith(".nes")) continue; var buffer = new byte[1024]; MemoryStream output = new MemoryStream(); @@ -124,38 +125,38 @@ namespace AxibugEmuOnline.Client private IEnumerator DownloadRemoteRom(Action callback) { - downloadRequest = AxiHttpProxy.GetDownLoad($"{App.httpAPI.WebHost}/{webData.url}"); - - while (!downloadRequest.downloadHandler.isDone) - { - yield return null; - Debug.Log($"下载进度:{downloadRequest.downloadHandler.DownLoadPr} ->{downloadRequest.downloadHandler.loadedLenght}/{downloadRequest.downloadHandler.NeedloadedLenght}"); - } - AxiHttpProxy.ShowAxiHttpDebugInfo(downloadRequest.downloadHandler); + downloadRequest = AxiHttpProxy.GetDownLoad($"{App.httpAPI.WebHost}/{webData.url}"); + + while (!downloadRequest.downloadHandler.isDone) + { + yield return null; + Debug.Log($"下载进度:{downloadRequest.downloadHandler.DownLoadPr} ->{downloadRequest.downloadHandler.loadedLenght}/{downloadRequest.downloadHandler.NeedloadedLenght}"); + } + AxiHttpProxy.ShowAxiHttpDebugInfo(downloadRequest.downloadHandler); var request = downloadRequest; - downloadRequest = null; - - if (!request.downloadHandler.bHadErr) - callback(request.downloadHandler.data); - else - callback(null); - - //downloadRequest = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{webData.url}"); - //yield return downloadRequest.SendWebRequest(); - - //var request = downloadRequest; - //downloadRequest = null; - - //if (request.result != UnityWebRequest.Result.Success) - //{ - // callback(null); - //} - //else - //{ - // callback(request.downloadHandler.data); - //} - } + downloadRequest = null; + + if (!request.downloadHandler.bHadErr) + callback(request.downloadHandler.data); + else + callback(null); + + //downloadRequest = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{webData.url}"); + //yield return downloadRequest.SendWebRequest(); + + //var request = downloadRequest; + //downloadRequest = null; + + //if (request.result != UnityWebRequest.Result.Success) + //{ + // callback(null); + //} + //else + //{ + // callback(request.downloadHandler.data); + //} + } public void SetWebData(HttpAPI.Resp_RomInfo resp_RomInfo) { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs index f6483667..3ecf771b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs @@ -63,7 +63,7 @@ namespace AxibugEmuOnline.Client /// /// 指定ROM开始游戏 /// - public void StartGame(RomFile rom) + public MsgBool StartGame(RomFile rom) { StopGame(); @@ -76,11 +76,13 @@ namespace AxibugEmuOnline.Client try { NesCore = new NES(rom.FileName); + return true; } catch (Exception ex) { NesCore = null; App.log.Error(ex.ToString()); + return ex.Message; } } diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/ControllerState.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/ControllerState.cs index 64d01d10..61f83b09 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/ControllerState.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Supporter/ControllerState.cs @@ -19,7 +19,7 @@ namespace VirtualNes.Core raw3 = (uint)states[3]; valid = true; } - + public bool HasButton(int player, EnumButtonType button) { uint raw = player switch -- 2.36.0.windows.1 From f6bc4689e8c96778177bd15a78e69861309efc93 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Mon, 6 Jan 2025 20:31:20 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=A7=BB=E9=99=A4gamma=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/AppMain/UI/XMBBackGround.shader | 6 ------ 1 file changed, 6 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBBackGround.shader b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBBackGround.shader index 8491a00d..3c5de6f2 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBBackGround.shader +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBBackGround.shader @@ -32,8 +32,6 @@ _Power2("Power",Float)=50.0 _Frequency2("Frequency",Float)=2.1 _Speed2("Speed",Float)=0.3 - - _Gamma("GAMMA",float) = 2.2 } SubShader @@ -154,8 +152,6 @@ float _Frequency2; float _Speed2; - float _Gamma; - fixed4 frag(v2f IN) : SV_Target { float2 uv= IN.texcoord; @@ -200,8 +196,6 @@ clip (fragColor.a - 0.001); #endif - fragColor = pow(fragColor,1/_Gamma); - return fragColor; } -- 2.36.0.windows.1