Compare commits
No commits in common. "12f8f0eea5da7f51cd75110969541702f7b71a64" and "194150b911ec13d3ccbf854b6d8ade71d92b17d7" have entirely different histories.
12f8f0eea5
...
194150b911
@ -13,7 +13,7 @@ namespace AxibugEmuOnline.Client
|
||||
void Pause();
|
||||
void Resume();
|
||||
void SetupScheme();
|
||||
MsgBool StartGame(RomFile romFile);
|
||||
void StartGame(RomFile romFile);
|
||||
void DoReset();
|
||||
IControllerSetuper GetControllerSetuper();
|
||||
|
||||
|
||||
@ -56,9 +56,7 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
break;
|
||||
}
|
||||
|
||||
var result = m_emuCore.StartGame(romFile);
|
||||
if (result)
|
||||
{
|
||||
m_emuCore.StartGame(romFile);
|
||||
LaunchUI.Instance.HideMainMenu();
|
||||
InGameUI.Instance.Show(romFile, m_emuCore);
|
||||
|
||||
@ -72,12 +70,6 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
|
||||
Eventer.Instance.RegisterEvent(EEvent.OnRoomSlotDataChanged, OnSlotDataChanged);
|
||||
}
|
||||
else
|
||||
{
|
||||
StopGame();
|
||||
OverlayManager.PopTip(result);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSlotDataChanged()
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@ -12,20 +12,21 @@ namespace AxibugEmuOnline.Client
|
||||
public string WebHost = "http://emu.axibug.com";
|
||||
public string WebSiteApi => WebHost + "/api";
|
||||
|
||||
public delegate void GetRomListAPI(Action<int, Resp_GameList> callback, int page, int pageSize = 10);
|
||||
public delegate void SearchRomListAPI(Action<int, Resp_GameList> callback, string searchKey, int page, int pageSize = 10);
|
||||
public delegate void GetRomListAPI(Action<Resp_GameList> callback, int page, int pageSize = 10);
|
||||
public delegate void SearchRomListAPI(Action<Resp_GameList> callback, string searchKey, int page, int pageSize = 10);
|
||||
|
||||
public void GetNesRomList(Action<int, Resp_GameList> callback, int page, int pageSize = 10)
|
||||
public void GetNesRomList(Action<Resp_GameList> callback, int page, int pageSize = 10)
|
||||
{
|
||||
App.StartCoroutine(GetNesRomListFlow(page, pageSize, callback));
|
||||
}
|
||||
|
||||
public void SearchNesRomList(Action<int, Resp_GameList> callback, string searchKey, int page, int pageSize = 10)
|
||||
public void SearchNesRomList(Action<Resp_GameList> 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<int, Resp_GameList> callback)
|
||||
private IEnumerator SearchNesRomListFlow(string searchKey, int page, int pageSize, Action<Resp_GameList> callback)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(searchKey))
|
||||
{
|
||||
string oldsearch = searchKey;
|
||||
@ -47,19 +48,19 @@ namespace AxibugEmuOnline.Client
|
||||
yield return request.SendWebRequest;
|
||||
if (!request.downloadHandler.isDone)
|
||||
{
|
||||
callback.Invoke(page, null);
|
||||
callback.Invoke(null);
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (!request.downloadHandler.bHadErr)
|
||||
{
|
||||
var resp = JsonUtility.FromJson<Resp_GameList>(request.downloadHandler.text);
|
||||
callback.Invoke(page, resp);
|
||||
callback.Invoke(resp);
|
||||
yield break;
|
||||
}
|
||||
|
||||
App.log.Error(request.downloadHandler.ErrInfo);
|
||||
callback.Invoke(page, null);
|
||||
callback.Invoke(null);
|
||||
|
||||
/*
|
||||
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}");
|
||||
@ -72,7 +73,7 @@ namespace AxibugEmuOnline.Client
|
||||
}*/
|
||||
|
||||
}
|
||||
private IEnumerator GetNesRomListFlow(int page, int pageSize, Action<int, Resp_GameList> callback)
|
||||
private IEnumerator GetNesRomListFlow(int page, int pageSize, Action<Resp_GameList> callback)
|
||||
{
|
||||
string url = $"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}";
|
||||
App.log.Info($"GetRomList=>{url}");
|
||||
@ -80,7 +81,7 @@ namespace AxibugEmuOnline.Client
|
||||
yield return request.SendWebRequest;
|
||||
if (!request.downloadHandler.isDone)
|
||||
{
|
||||
callback.Invoke(page, null);
|
||||
callback.Invoke(null);
|
||||
yield break;
|
||||
}
|
||||
|
||||
@ -88,12 +89,12 @@ namespace AxibugEmuOnline.Client
|
||||
if (!request.downloadHandler.bHadErr)
|
||||
{
|
||||
var resp = JsonUtility.FromJson<Resp_GameList>(request.downloadHandler.text);
|
||||
callback.Invoke(page, resp);
|
||||
callback.Invoke(resp);
|
||||
yield break;
|
||||
}
|
||||
|
||||
App.log.Error(request.downloadHandler.ErrInfo);
|
||||
callback.Invoke(page, null);
|
||||
callback.Invoke(null);
|
||||
/*
|
||||
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}");
|
||||
yield return request.SendWebRequest();
|
||||
|
||||
@ -96,12 +96,11 @@ namespace AxibugEmuOnline.Client
|
||||
if (Path.GetExtension(LocalFilePath).ToLower() == ".zip")
|
||||
{
|
||||
var zip = new ZipInputStream(new MemoryStream(bytes));
|
||||
while (true)
|
||||
{
|
||||
var currentEntry = zip.GetNextEntry();
|
||||
if (currentEntry == null) break;
|
||||
var entry = zip.GetNextEntry() as ZipEntry;
|
||||
|
||||
if (!currentEntry.Name.ToLower().EndsWith(".nes")) continue;
|
||||
while (entry != null)
|
||||
{
|
||||
if (!entry.Name.ToLower().EndsWith(".nes")) continue;
|
||||
|
||||
var buffer = new byte[1024];
|
||||
MemoryStream output = new MemoryStream();
|
||||
|
||||
@ -75,17 +75,14 @@ namespace AxibugEmuOnline.Client
|
||||
lastSearchKey = searchKey;
|
||||
if (string.IsNullOrWhiteSpace(searchKey))
|
||||
{
|
||||
m_romGetFunc((page, romList) =>
|
||||
m_romGetFunc((romList) =>
|
||||
{
|
||||
//TODO 请求失败对于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
|
||||
@ -98,17 +95,14 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
else
|
||||
{
|
||||
m_romSearchFunc((page, romList) =>
|
||||
m_romSearchFunc((romList) =>
|
||||
{
|
||||
//TODO 请求失败对于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
|
||||
@ -121,47 +115,33 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
}
|
||||
|
||||
bool m_needFetch = false;
|
||||
public void BeginFetchRomInfo(RomFile romFile)
|
||||
{
|
||||
if (romFile.InfoReady) return;
|
||||
|
||||
if (FetchPageCmd.Add(romFile.Page))
|
||||
m_needFetch = true;
|
||||
FetchPageCmd.Add(romFile.Page);
|
||||
}
|
||||
|
||||
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);
|
||||
m_romSearchFunc(SaveRomInfoFromWeb, lastSearchKey, pageNo, PAGE_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_romGetFunc((page, resp) =>
|
||||
{
|
||||
FetchPageCmd.Remove(page);
|
||||
SaveRomInfoFromWeb(resp);
|
||||
}, pageNo, PAGE_SIZE);
|
||||
m_romGetFunc(SaveRomInfoFromWeb, pageNo, PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
m_needFetch = false;
|
||||
FetchPageCmd.Clear();
|
||||
}
|
||||
|
||||
private void SaveRomInfoFromWeb(Resp_GameList resp)
|
||||
{
|
||||
if (resp == null) return;
|
||||
|
||||
for (int i = 0; i < resp.gameList.Count; i++)
|
||||
{
|
||||
var webData = resp.gameList[i];
|
||||
|
||||
@ -63,7 +63,7 @@ namespace AxibugEmuOnline.Client
|
||||
/// <summary>
|
||||
/// 指定ROM开始游戏
|
||||
/// </summary>
|
||||
public MsgBool StartGame(RomFile rom)
|
||||
public void StartGame(RomFile rom)
|
||||
{
|
||||
StopGame();
|
||||
|
||||
@ -76,13 +76,11 @@ namespace AxibugEmuOnline.Client
|
||||
try
|
||||
{
|
||||
NesCore = new NES(rom.FileName);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NesCore = null;
|
||||
App.log.Error(ex.ToString());
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,8 @@
|
||||
_Power2("Power",Float)=50.0
|
||||
_Frequency2("Frequency",Float)=2.1
|
||||
_Speed2("Speed",Float)=0.3
|
||||
|
||||
_Gamma("GAMMA",float) = 2.2
|
||||
}
|
||||
|
||||
SubShader
|
||||
@ -152,6 +154,8 @@
|
||||
float _Frequency2;
|
||||
float _Speed2;
|
||||
|
||||
float _Gamma;
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
float2 uv= IN.texcoord;
|
||||
@ -196,6 +200,8 @@
|
||||
clip (fragColor.a - 0.001);
|
||||
#endif
|
||||
|
||||
fragColor = pow(fragColor,1/_Gamma);
|
||||
|
||||
return fragColor;
|
||||
}
|
||||
|
||||
|
||||
@ -207,7 +207,7 @@ namespace VirtualNes
|
||||
{
|
||||
for (byte i = 0; i < 8; i++)
|
||||
{
|
||||
SetCRAM_1K_Bank(i, bank * 8 + i);
|
||||
SetCRAM_1K_Bank(i, bank * 8 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user