hbabi: Implement argv (#272)
This commit implements the argv config key in Ryujinx (by creating a temporary copy of the homebrew executable in the sdmc VFS) to make it possible to load libnx's "romfs" files. This commit also call Os.Dispose in Ns.OnFinish to dispose all resources when exiting
This commit is contained in:
parent
5d698a7d8d
commit
c2c765b30f
10 changed files with 84 additions and 16 deletions
|
@ -1,11 +1,14 @@
|
|||
using ChocolArm64.Memory;
|
||||
using System.Text;
|
||||
|
||||
namespace Ryujinx.HLE.OsHle
|
||||
{
|
||||
static class Homebrew
|
||||
{
|
||||
public const string TemporaryNroSuffix = ".ryu_tmp.nro";
|
||||
|
||||
//http://switchbrew.org/index.php?title=Homebrew_ABI
|
||||
public static void WriteHbAbiData(AMemory Memory, long Position, int MainThreadHandle)
|
||||
public static void WriteHbAbiData(AMemory Memory, long Position, int MainThreadHandle, string SwitchPath)
|
||||
{
|
||||
Memory.Manager.Map(Position, AMemoryMgr.PageSize, (int)MemoryType.Normal, AMemoryPerm.RW);
|
||||
|
||||
|
@ -15,6 +18,11 @@ namespace Ryujinx.HLE.OsHle
|
|||
//NextLoadPath
|
||||
WriteConfigEntry(Memory, ref Position, 2, 0, Position + 0x200, Position + 0x400);
|
||||
|
||||
// Argv
|
||||
long ArgvPosition = Position + 0xC00;
|
||||
WriteConfigEntry(Memory, ref Position, 5, 0, 0, ArgvPosition);
|
||||
Memory.WriteBytes(ArgvPosition, Encoding.ASCII.GetBytes(SwitchPath + "\0"));
|
||||
|
||||
//AppletType
|
||||
WriteConfigEntry(Memory, ref Position, 7);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue