修复一些拉取rom列表的bug #80

Merged
sin365 merged 5 commits from Alienjack/AxibugEmuOnline:master into master 2025-01-06 20:31:47 +08:00
5 changed files with 61 additions and 50 deletions
Showing only changes of commit ef1c43d3fc - Show all commits

View File

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

View File

@ -56,7 +56,9 @@ namespace AxibugEmuOnline.Client.Manager
break; break;
} }
m_emuCore.StartGame(romFile); var result = m_emuCore.StartGame(romFile);
if (result)
{
LaunchUI.Instance.HideMainMenu(); LaunchUI.Instance.HideMainMenu();
InGameUI.Instance.Show(romFile, m_emuCore); InGameUI.Instance.Show(romFile, m_emuCore);
@ -70,6 +72,12 @@ namespace AxibugEmuOnline.Client.Manager
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,11 +96,12 @@ 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));
var entry = zip.GetNextEntry() as ZipEntry; while (true)
while (entry != null)
{ {
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]; var buffer = new byte[1024];
MemoryStream output = new MemoryStream(); MemoryStream output = new MemoryStream();

View File

@ -63,7 +63,7 @@ namespace AxibugEmuOnline.Client
/// <summary> /// <summary>
/// 指定ROM开始游戏 /// 指定ROM开始游戏
/// </summary> /// </summary>
public void StartGame(RomFile rom) public MsgBool StartGame(RomFile rom)
{ {
StopGame(); StopGame();
@ -76,11 +76,13 @@ 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;
} }
} }