mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-01-09 00:41:59 +00:00
Avoid zero-length array allocations (#427)
This commit is contained in:
parent
decd37ce6d
commit
5913ceda40
2 changed files with 4 additions and 4 deletions
|
@ -341,7 +341,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
{
|
{
|
||||||
if (VirtualAmiibo.ApplicationBytes.Length > 0)
|
if (VirtualAmiibo.ApplicationBytes.Length > 0)
|
||||||
{
|
{
|
||||||
VirtualAmiibo.ApplicationBytes = new byte[0];
|
VirtualAmiibo.ApplicationBytes = Array.Empty<byte>();
|
||||||
VirtualAmiibo.InputBin = string.Empty;
|
VirtualAmiibo.InputBin = string.Empty;
|
||||||
}
|
}
|
||||||
if (NfpDevices[nfpDeviceId].State == NfpDeviceState.SearchingForTag)
|
if (NfpDevices[nfpDeviceId].State == NfpDeviceState.SearchingForTag)
|
||||||
|
@ -356,7 +356,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
VirtualAmiibo.InputBin = path;
|
VirtualAmiibo.InputBin = path;
|
||||||
if (VirtualAmiibo.ApplicationBytes.Length > 0)
|
if (VirtualAmiibo.ApplicationBytes.Length > 0)
|
||||||
{
|
{
|
||||||
VirtualAmiibo.ApplicationBytes = new byte[0];
|
VirtualAmiibo.ApplicationBytes = Array.Empty<byte>();
|
||||||
}
|
}
|
||||||
byte[] encryptedData = File.ReadAllBytes(path);
|
byte[] encryptedData = File.ReadAllBytes(path);
|
||||||
VirtualAmiiboFile newFile = AmiiboBinReader.ReadBinFile(encryptedData);
|
VirtualAmiiboFile newFile = AmiiboBinReader.ReadBinFile(encryptedData);
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
||||||
static class VirtualAmiibo
|
static class VirtualAmiibo
|
||||||
{
|
{
|
||||||
public static uint OpenedApplicationAreaId;
|
public static uint OpenedApplicationAreaId;
|
||||||
public static byte[] ApplicationBytes = new byte[0];
|
public static byte[] ApplicationBytes = Array.Empty<byte>();
|
||||||
public static string InputBin = string.Empty;
|
public static string InputBin = string.Empty;
|
||||||
public static string NickName = string.Empty;
|
public static string NickName = string.Empty;
|
||||||
private static readonly AmiiboJsonSerializerContext _serializerContext = AmiiboJsonSerializerContext.Default;
|
private static readonly AmiiboJsonSerializerContext _serializerContext = AmiiboJsonSerializerContext.Default;
|
||||||
|
@ -137,7 +137,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
|
||||||
if (ApplicationBytes.Length > 0)
|
if (ApplicationBytes.Length > 0)
|
||||||
{
|
{
|
||||||
byte[] bytes = ApplicationBytes;
|
byte[] bytes = ApplicationBytes;
|
||||||
ApplicationBytes = new byte[0];
|
ApplicationBytes = Array.Empty<byte>();
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
|
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
|
||||||
|
|
Loading…
Reference in a new issue