diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-06-10 21:46:42 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-06-10 21:46:42 -0300 |
| commit | 76f3b1b3a4637ec72abfbb8cbc0679f2e0ca838f (patch) | |
| tree | 0411b709de31c1c0517763512df8eeb9f7491bc9 /Ryujinx.Core/Loaders/Executables | |
| parent | 518fe799da6dd4f12c58c9e6e174767effb0b868 (diff) | |
Rename Ryujinx.Core to Ryujinx.HLE and add a separate project for a future LLE implementation
Diffstat (limited to 'Ryujinx.Core/Loaders/Executables')
| -rw-r--r-- | Ryujinx.Core/Loaders/Executables/IExecutable.cs | 17 | ||||
| -rw-r--r-- | Ryujinx.Core/Loaders/Executables/Nro.cs | 60 | ||||
| -rw-r--r-- | Ryujinx.Core/Loaders/Executables/Nso.cs | 121 |
3 files changed, 0 insertions, 198 deletions
diff --git a/Ryujinx.Core/Loaders/Executables/IExecutable.cs b/Ryujinx.Core/Loaders/Executables/IExecutable.cs deleted file mode 100644 index 412058d8..00000000 --- a/Ryujinx.Core/Loaders/Executables/IExecutable.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Ryujinx.Core.Loaders.Executables -{ - public interface IExecutable - { - string Name { get; } - - byte[] Text { get; } - byte[] RO { get; } - byte[] Data { get; } - - int Mod0Offset { get; } - int TextOffset { get; } - int ROOffset { get; } - int DataOffset { get; } - int BssSize { get; } - } -}
\ No newline at end of file diff --git a/Ryujinx.Core/Loaders/Executables/Nro.cs b/Ryujinx.Core/Loaders/Executables/Nro.cs deleted file mode 100644 index c3411d22..00000000 --- a/Ryujinx.Core/Loaders/Executables/Nro.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System.IO; - -namespace Ryujinx.Core.Loaders.Executables -{ - class Nro : IExecutable - { - public string Name { get; private set; } - - 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 Nro(Stream Input, string Name) - { - this.Name = Name; - - 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); - } - } -}
\ No newline at end of file diff --git a/Ryujinx.Core/Loaders/Executables/Nso.cs b/Ryujinx.Core/Loaders/Executables/Nso.cs deleted file mode 100644 index bfe159d7..00000000 --- a/Ryujinx.Core/Loaders/Executables/Nso.cs +++ /dev/null @@ -1,121 +0,0 @@ -using Ryujinx.Core.Loaders.Compression; -using System; -using System.IO; - -namespace Ryujinx.Core.Loaders.Executables -{ - class Nso : IExecutable - { - public string Name { get; private set; } - - 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; } - - [Flags] - private enum NsoFlags - { - IsTextCompressed = 1 << 0, - IsROCompressed = 1 << 1, - IsDataCompressed = 1 << 2, - HasTextHash = 1 << 3, - HasROHash = 1 << 4, - HasDataHash = 1 << 5 - } - - public Nso(Stream Input, string Name) - { - this.Name = Name; - - BinaryReader Reader = new BinaryReader(Input); - - Input.Seek(0, SeekOrigin.Begin); - - int NsoMagic = Reader.ReadInt32(); - int Version = Reader.ReadInt32(); - int Reserved = Reader.ReadInt32(); - int FlagsMsk = Reader.ReadInt32(); - int TextOffset = Reader.ReadInt32(); - int TextMemOffset = Reader.ReadInt32(); - int TextDecSize = Reader.ReadInt32(); - int ModNameOffset = Reader.ReadInt32(); - int ROOffset = Reader.ReadInt32(); - int ROMemOffset = Reader.ReadInt32(); - int RODecSize = Reader.ReadInt32(); - int ModNameSize = Reader.ReadInt32(); - int DataOffset = Reader.ReadInt32(); - int DataMemOffset = Reader.ReadInt32(); - int DataDecSize = Reader.ReadInt32(); - int BssSize = Reader.ReadInt32(); - - byte[] BuildId = Reader.ReadBytes(0x20); - - int TextSize = Reader.ReadInt32(); - int ROSize = Reader.ReadInt32(); - int DataSize = Reader.ReadInt32(); - - Input.Seek(0x24, SeekOrigin.Current); - - int DynStrOffset = Reader.ReadInt32(); - int DynStrSize = Reader.ReadInt32(); - int DynSymOffset = Reader.ReadInt32(); - int DynSymSize = Reader.ReadInt32(); - - byte[] TextHash = Reader.ReadBytes(0x20); - byte[] ROHash = Reader.ReadBytes(0x20); - byte[] DataHash = Reader.ReadBytes(0x20); - - NsoFlags Flags = (NsoFlags)FlagsMsk; - - this.TextOffset = TextMemOffset; - this.ROOffset = ROMemOffset; - this.DataOffset = DataMemOffset; - this.BssSize = BssSize; - - //Text segment - Input.Seek(TextOffset, SeekOrigin.Begin); - - Text = Reader.ReadBytes(TextSize); - - if (Flags.HasFlag(NsoFlags.IsTextCompressed) || true) - { - Text = Lz4.Decompress(Text, TextDecSize); - } - - //Read-only data segment - Input.Seek(ROOffset, SeekOrigin.Begin); - - RO = Reader.ReadBytes(ROSize); - - if (Flags.HasFlag(NsoFlags.IsROCompressed) || true) - { - RO = Lz4.Decompress(RO, RODecSize); - } - - //Data segment - Input.Seek(DataOffset, SeekOrigin.Begin); - - Data = Reader.ReadBytes(DataSize); - - if (Flags.HasFlag(NsoFlags.IsDataCompressed) || true) - { - Data = Lz4.Decompress(Data, DataDecSize); - } - - using (MemoryStream TextMS = new MemoryStream(Text)) - { - BinaryReader TextReader = new BinaryReader(TextMS); - - TextMS.Seek(4, SeekOrigin.Begin); - - Mod0Offset = TextReader.ReadInt32(); - } - } - } -}
\ No newline at end of file |
