mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-14 15:14:23 -04:00
loader: refactor for R_TRY
This commit is contained in:
parent
ee40dcd76f
commit
f9bf8923b1
24 changed files with 437 additions and 579 deletions
|
@ -13,7 +13,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
#include <cstdio>
|
||||
|
@ -31,7 +31,7 @@ class NsoUtils {
|
|||
u32 decomp_size;
|
||||
u32 align_or_total_size;
|
||||
};
|
||||
|
||||
|
||||
struct NsoHeader {
|
||||
u32 magic;
|
||||
u32 _0x4;
|
||||
|
@ -45,7 +45,7 @@ class NsoUtils {
|
|||
u64 dynsym_extents;
|
||||
u8 section_hashes[3][0x20];
|
||||
};
|
||||
|
||||
|
||||
struct NsoLoadExtents {
|
||||
u64 base_address;
|
||||
u64 total_size;
|
||||
|
@ -54,17 +54,17 @@ class NsoUtils {
|
|||
u64 nso_addresses[NSO_NUM_MAX];
|
||||
u64 nso_sizes[NSO_NUM_MAX];
|
||||
};
|
||||
|
||||
|
||||
struct NsoArgument {
|
||||
u32 allocated_space;
|
||||
u32 args_size;
|
||||
u8 _0x8[0x18];
|
||||
u8 arguments[];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static_assert(sizeof(NsoHeader) == 0x100, "Incorrectly defined NsoHeader!");
|
||||
|
||||
|
||||
static const char *GetNsoFileName(unsigned int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
|
@ -104,13 +104,13 @@ class NsoUtils {
|
|||
static FILE *OpenNsoFromSdCard(unsigned int index, u64 title_id);
|
||||
static bool CheckNsoStubbed(unsigned int index, u64 title_id);
|
||||
static FILE *OpenNso(unsigned int index, u64 title_id);
|
||||
|
||||
|
||||
static bool IsNsoPresent(unsigned int index);
|
||||
static unsigned char *GetNsoBuildId(unsigned int index);
|
||||
static Result LoadNsoHeaders(u64 title_id);
|
||||
static Result ValidateNsoLoadSet();
|
||||
static Result CalculateNsoLoadExtents(u32 addspace_type, u32 args_size, NsoLoadExtents *extents);
|
||||
|
||||
|
||||
static Result LoadNsoSegment(u64 title_id, unsigned int index, unsigned int segment, FILE *f_nso, u8 *map_base, u8 *map_end);
|
||||
static Result LoadNsosIntoProcessMemory(Handle process_h, u64 title_id, NsoLoadExtents *extents, u8 *args, u32 args_size);
|
||||
static Result LoadNsosIntoProcessMemory(Handle process_h, u64 title_id, NsoLoadExtents *extents, const u8 *args, u32 args_size);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue