diff --git a/Ryujinx.HLE/OsHle/Services/Nifm/IGeneralService.cs b/Ryujinx.HLE/OsHle/Services/Nifm/IGeneralService.cs index e289a8db8f..4f86d36b89 100644 --- a/Ryujinx.HLE/OsHle/Services/Nifm/IGeneralService.cs +++ b/Ryujinx.HLE/OsHle/Services/Nifm/IGeneralService.cs @@ -1,6 +1,9 @@ using Ryujinx.HLE.Logging; using Ryujinx.HLE.OsHle.Ipc; +using System; using System.Collections.Generic; +using System.Linq; +using System.Net; namespace Ryujinx.HLE.OsHle.Services.Nifm { @@ -14,7 +17,9 @@ namespace Ryujinx.HLE.OsHle.Services.Nifm { m_Commands = new Dictionary() { - { 4, CreateRequest } + { 4, CreateRequest }, + { 5, GetCurrentNetworkProfile }, + { 12, GetCurrentIpAddress } }; } @@ -29,5 +34,30 @@ namespace Ryujinx.HLE.OsHle.Services.Nifm return 0; } + + public long GetCurrentNetworkProfile(ServiceCtx Context) + { + Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed."); + + return 0; + } + + public long GetCurrentIpAddress(ServiceCtx Context) + { + string HostName = Dns.GetHostName(); + IPHostEntry HostEntry = Dns.GetHostEntry(HostName); + IPAddress[] Address = HostEntry.AddressList; + var IP = Address.Where(x => x.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).FirstOrDefault(); + Console.WriteLine(IP.ToString()); + string BEHexStr = string.Concat(IP.ToString().Split('.').Select(x => int.Parse(x).ToString("X2"))); + uint BENum = Convert.ToUInt32(BEHexStr, 16); + byte[] Bytes = BitConverter.GetBytes(BENum); + string LENum = ""; + foreach (byte b in Bytes) + LENum += b.ToString("X2"); + uint LocalIP = System.Convert.ToUInt32(LENum, 16); + MakeObject(Context, new IRequest()); + return LocalIP; + } } -} \ No newline at end of file +}