mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-23 14:54:00 +00:00
00579927e4
* Initial implementation of KProcess * Some improvements to the memory manager, implement back guest stack trace printing * Better GetInfo implementation, improve checking in some places with information from process capabilities * Allow the cpu to read/write from the correct memory locations for accesses crossing a page boundary * Change long -> ulong for address/size on memory related methods to avoid unnecessary casts * Attempt at implementing ldr:ro with new KProcess * Allow BSS with size 0 on ldr:ro * Add checking for memory block slab heap usage, return errors if full, exit gracefully * Use KMemoryBlockSize const from KMemoryManager * Allow all methods to read from non-contiguous locations * Fix for TransactParcelAuto * Address PR feedback, additionally fix some small issues related to the KIP loader and implement SVCs GetProcessId, GetProcessList, GetSystemInfo, CreatePort and ManageNamedPort * Fix wrong check for source pages count from page list on MapPhysicalMemory * Fix some issues with UnloadNro on ldr:ro
64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
using System.IO;
|
|
|
|
namespace Ryujinx.HLE.Loaders.Executables
|
|
{
|
|
class NxRelocatableObject : IExecutable
|
|
{
|
|
public byte[] Text { get; private set; }
|
|
public byte[] RO { get; private set; }
|
|
public byte[] Data { get; private set; }
|
|
|
|
public int Mod0Offset { get; private set; }
|
|
public int TextOffset { get; private set; }
|
|
public int ROOffset { get; private set; }
|
|
public int DataOffset { get; private set; }
|
|
public int BssSize { get; private set; }
|
|
|
|
public int BssOffset => DataOffset + Data.Length;
|
|
|
|
public ulong SourceAddress { get; private set; }
|
|
public ulong BssAddress { get; private set; }
|
|
|
|
public NxRelocatableObject(Stream Input, ulong SourceAddress = 0, ulong BssAddress = 0)
|
|
{
|
|
this.SourceAddress = SourceAddress;
|
|
this.BssAddress = BssAddress;
|
|
|
|
BinaryReader Reader = new BinaryReader(Input);
|
|
|
|
Input.Seek(4, SeekOrigin.Begin);
|
|
|
|
int Mod0Offset = Reader.ReadInt32();
|
|
int Padding8 = Reader.ReadInt32();
|
|
int Paddingc = Reader.ReadInt32();
|
|
int NroMagic = Reader.ReadInt32();
|
|
int Unknown14 = Reader.ReadInt32();
|
|
int FileSize = Reader.ReadInt32();
|
|
int Unknown1c = Reader.ReadInt32();
|
|
int TextOffset = Reader.ReadInt32();
|
|
int TextSize = Reader.ReadInt32();
|
|
int ROOffset = Reader.ReadInt32();
|
|
int ROSize = Reader.ReadInt32();
|
|
int DataOffset = Reader.ReadInt32();
|
|
int DataSize = Reader.ReadInt32();
|
|
int BssSize = Reader.ReadInt32();
|
|
|
|
this.Mod0Offset = Mod0Offset;
|
|
this.TextOffset = TextOffset;
|
|
this.ROOffset = ROOffset;
|
|
this.DataOffset = DataOffset;
|
|
this.BssSize = BssSize;
|
|
|
|
byte[] Read(long Position, int Size)
|
|
{
|
|
Input.Seek(Position, SeekOrigin.Begin);
|
|
|
|
return Reader.ReadBytes(Size);
|
|
}
|
|
|
|
Text = Read(TextOffset, TextSize);
|
|
RO = Read(ROOffset, ROSize);
|
|
Data = Read(DataOffset, DataSize);
|
|
}
|
|
}
|
|
} |