2018-02-22 01:51:17 +01:00
|
|
|
|
using ChocolArm64.Memory;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.Core.OsHle
|
|
|
|
|
{
|
2018-02-26 02:44:30 +01:00
|
|
|
|
static class Homebrew
|
2018-02-22 01:51:17 +01:00
|
|
|
|
{
|
|
|
|
|
//http://switchbrew.org/index.php?title=Homebrew_ABI
|
2018-02-26 02:44:30 +01:00
|
|
|
|
public static void WriteHbAbiData(AMemory Memory, long Position, int MainThreadHandle)
|
2018-02-22 01:51:17 +01:00
|
|
|
|
{
|
2018-02-26 02:44:30 +01:00
|
|
|
|
Memory.Manager.MapPhys(Position, AMemoryMgr.PageSize, (int)MemoryType.Normal, AMemoryPerm.RW);
|
2018-02-22 01:51:17 +01:00
|
|
|
|
|
|
|
|
|
//MainThreadHandle
|
|
|
|
|
WriteConfigEntry(Memory, ref Position, 1, 0, MainThreadHandle);
|
2018-02-26 02:44:30 +01:00
|
|
|
|
|
2018-02-22 01:51:17 +01:00
|
|
|
|
//NextLoadPath
|
2018-02-26 02:44:30 +01:00
|
|
|
|
WriteConfigEntry(Memory, ref Position, 2, 0, Position + 0x200, Position + 0x400);
|
|
|
|
|
|
2018-02-22 01:51:17 +01:00
|
|
|
|
//AppletType
|
|
|
|
|
WriteConfigEntry(Memory, ref Position, 7);
|
2018-02-26 02:44:30 +01:00
|
|
|
|
|
2018-02-22 01:51:17 +01:00
|
|
|
|
//EndOfList
|
|
|
|
|
WriteConfigEntry(Memory, ref Position, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-26 02:44:30 +01:00
|
|
|
|
private static void WriteConfigEntry(
|
|
|
|
|
AMemory Memory,
|
|
|
|
|
ref long Position,
|
|
|
|
|
int Key,
|
|
|
|
|
int Flags = 0,
|
|
|
|
|
long Value0 = 0,
|
|
|
|
|
long Value1 = 0)
|
2018-02-22 01:51:17 +01:00
|
|
|
|
{
|
|
|
|
|
Memory.WriteInt32(Position + 0x00, Key);
|
|
|
|
|
Memory.WriteInt32(Position + 0x04, Flags);
|
|
|
|
|
Memory.WriteInt64(Position + 0x08, Value0);
|
|
|
|
|
Memory.WriteInt64(Position + 0x10, Value1);
|
|
|
|
|
|
|
|
|
|
Position += 0x18;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|