AxiHttp网络异常处理,PSVita RenderTexture分辨率

This commit is contained in:
sin365 2024-12-27 14:10:22 +08:00
parent 5caff2dbda
commit bbcd4de0b8
4 changed files with 60 additions and 19 deletions

View File

@ -132,6 +132,13 @@ namespace AxibugEmuOnline.Client.ClientCore
yield return request.SendWebRequest; yield return request.SendWebRequest;
if (!request.downloadHandler.isDone) if (!request.downloadHandler.isDone)
yield break; yield break;
if (request.downloadHandler.Err != null)
{
App.log.Error(request.downloadHandler.Err);
yield break;
}
Resp_CheckStandInfo resp = JsonUtility.FromJson<Resp_CheckStandInfo>(request.downloadHandler.text); Resp_CheckStandInfo resp = JsonUtility.FromJson<Resp_CheckStandInfo>(request.downloadHandler.text);
/*UnityWebRequest request = UnityWebRequest.Get($"{App.httpAPI.WebSiteApi}/CheckStandInfo?platform={platform}&version={Application.version}"); /*UnityWebRequest request = UnityWebRequest.Get($"{App.httpAPI.WebSiteApi}/CheckStandInfo?platform={platform}&version={Application.version}");

View File

@ -151,16 +151,10 @@ public static class AxiHttp
{ {
if (!dictIP2Address.ContainsKey(str)) if (!dictIP2Address.ContainsKey(str))
{ {
try IPHostEntry host = Dns.GetHostEntry(str);
{ IPAddress ip = host.AddressList[0];
IPAddress ip = Dns.GetHostEntry(str).AddressList[0];
dictIP2Address[str] = ip; dictIP2Address[str] = ip;
} }
catch
{
return null;
}
}
return dictIP2Address[str]; return dictIP2Address[str];
} }
@ -232,11 +226,12 @@ public static class AxiHttp
string strRelativePath = ""; string strRelativePath = "";
bool bSSL = false; bool bSSL = false;
bool foward_302 = true; bool foward_302 = true;
string ourErrMsg = "";
if (!ParseURI(strURI, ref bSSL, ref strHost, ref strIP, ref port, ref strRelativePath)) if (!ParseURI(strURI, ref bSSL, ref strHost, ref strIP, ref port, ref strRelativePath,ref ourErrMsg))
{ {
Log("ParseURI False"); Log("ParseURI False");
respinfo.Err = "ParseURI False"; respinfo.Err = ourErrMsg;
respinfo.code = 0; respinfo.code = 0;
respinfo.isDone = true; respinfo.isDone = true;
return; return;
@ -531,11 +526,12 @@ public static class AxiHttp
string strRelativePath = ""; string strRelativePath = "";
bool bSSL = false; bool bSSL = false;
bool foward_302 = true; bool foward_302 = true;
string ourErrMsg = "";
if (!ParseURI(strURI, ref bSSL, ref strHost, ref strIP, ref port, ref strRelativePath)) if (!ParseURI(strURI, ref bSSL, ref strHost, ref strIP, ref port, ref strRelativePath, ref ourErrMsg))
{ {
Log("ParseURI False"); Log("ParseURI False");
respinfo.Err = "ParseURI False"; respinfo.Err = ourErrMsg;
respinfo.code = 0; respinfo.code = 0;
respinfo.isDone = true; respinfo.isDone = true;
return; return;
@ -980,7 +976,13 @@ public static class AxiHttp
{ {
return true; return true;
} }
public static bool ParseURI(string strURI, ref bool bIsSSL, ref string strHost, ref string strIP, ref int Port, ref string strRelativePath) public static bool ParseURI(string strURI,
ref bool bIsSSL,
ref string strHost,
ref string strIP,
ref int Port,
ref string strRelativePath,
ref string errMsg)
{ {
string strAddressRet; string strAddressRet;
string strPortRet; string strPortRet;
@ -1013,8 +1015,11 @@ public static class AxiHttp
strRelativePathRet = strLeft.Substring(nIndexRelative, strLeft.Length - nIndexRelative); strRelativePathRet = strLeft.Substring(nIndexRelative, strLeft.Length - nIndexRelative);
} }
else else
{
errMsg = "Err Url";
return false; return false;
} }
}
else else
{ {
strAddressRet = strLeft.Substring(0, nIndexPort); strAddressRet = strLeft.Substring(0, nIndexPort);
@ -1025,18 +1030,19 @@ public static class AxiHttp
strRelativePathRet = strLeft.Substring(nIndexRelative, strLeft.Length - nIndexRelative); strRelativePathRet = strLeft.Substring(nIndexRelative, strLeft.Length - nIndexRelative);
} }
else else
{
errMsg = "Err Url";
return false; return false;
} }
}
strHost = strAddressRet; strHost = strAddressRet;
try try
{ {
//IPHostEntry hostinfo = Dns.GetHostEntry(strAddressRet);
//IPAddress[] aryIP = hostinfo.AddressList;
//strIPRet = aryIP[0].ToString();
strIPRet = GetDnsIP(strAddressRet).ToString(); strIPRet = GetDnsIP(strAddressRet).ToString();
} }
catch catch(Exception ex)
{ {
errMsg = ex.ToString();
return false; return false;
} }

View File

@ -50,6 +50,13 @@ namespace AxibugEmuOnline.Client
private RenderTexture result = null; private RenderTexture result = null;
public Texture ExecuteFilterRender(Texture src) public Texture ExecuteFilterRender(Texture src)
{ {
#if UNITY_PSP2
if (result == null)
{
result = RenderTexture.GetTemporary(Screen.width / 2, Screen.height / 2);
}
#else
if (result == null) if (result == null)
{ {
result = RenderTexture.GetTemporary(Screen.width, Screen.height); result = RenderTexture.GetTemporary(Screen.width, Screen.height);
@ -59,7 +66,7 @@ namespace AxibugEmuOnline.Client
RenderTexture.ReleaseTemporary(result); RenderTexture.ReleaseTemporary(result);
result = RenderTexture.GetTemporary(Screen.width, Screen.height); result = RenderTexture.GetTemporary(Screen.width, Screen.height);
} }
#endif
bool anyFilterEnable = false; bool anyFilterEnable = false;

View File

@ -63,6 +63,13 @@ namespace AxibugEmuOnline.Client
yield break; yield break;
} }
if (request.downloadHandler.Err != null)
{
App.log.Error(request.downloadHandler.Err);
callback.Invoke(null);
yield break;
}
/* /*
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}"); UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}");
yield return request.SendWebRequest(); yield return request.SendWebRequest();
@ -85,6 +92,13 @@ namespace AxibugEmuOnline.Client
callback.Invoke(null); callback.Invoke(null);
yield break; yield break;
} }
if (request.downloadHandler.Err != null)
{
App.log.Error(request.downloadHandler.Err);
callback.Invoke(null);
yield break;
}
/* /*
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}"); UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}");
yield return request.SendWebRequest(); yield return request.SendWebRequest();
@ -110,6 +124,13 @@ namespace AxibugEmuOnline.Client
yield break; yield break;
} }
if (request.downloadHandler.Err != null)
{
App.log.Error(request.downloadHandler.Err);
callback.Invoke(null);
yield break;
}
/* /*
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/RomInfo?PType={PlatformType.Nes}&RomID={RomID}"); UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/RomInfo?PType={PlatformType.Nes}&RomID={RomID}");
yield return request.SendWebRequest(); yield return request.SendWebRequest();