mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
More NCSD loading
This commit is contained in:
parent
9a040e1cde
commit
f6c2e390c1
11 changed files with 142 additions and 17 deletions
|
@ -10,7 +10,7 @@
|
|||
#include "PICA/gpu.hpp"
|
||||
|
||||
enum class ROMType {
|
||||
None, ELF, Cart
|
||||
None, ELF, NCSD
|
||||
};
|
||||
|
||||
class Emulator {
|
||||
|
@ -28,7 +28,9 @@ class Emulator {
|
|||
bool running = true;
|
||||
|
||||
// Keep the handle for the ROM here to reload when necessary and to prevent deleting it
|
||||
std::ifstream loadedROM;
|
||||
// This is currently only used for ELFs, NCSDs use the IOFile API instead
|
||||
std::ifstream loadedELF;
|
||||
NCSD loadedNCSD;
|
||||
|
||||
public:
|
||||
Emulator() : kernel(cpu, memory, gpu), cpu(memory, kernel), gpu(memory), memory(cpu.getTicksRef()) {
|
||||
|
@ -51,6 +53,7 @@ public:
|
|||
void runFrame();
|
||||
|
||||
bool loadROM(const std::filesystem::path& path);
|
||||
bool loadNCSD(const std::filesystem::path& path);
|
||||
bool loadELF(const std::filesystem::path& path);
|
||||
bool loadELF(std::ifstream& file);
|
||||
void initGraphicsContext() { gpu.initGraphicsContext(); }
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
#define fseeko _fseeki64
|
||||
#define ftello _ftelli64
|
||||
#define fileno _fileno
|
||||
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
#ifdef _CRT_SECURE_NO_WARNINGS
|
||||
#undef _CRT_SECURE_NO_WARNINGS
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
class IOFile {
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
#pragma once
|
||||
#include "helpers.hpp"
|
||||
|
||||
struct NCCH {
|
||||
bool isNew3DS = false;
|
||||
bool initialized = false;
|
||||
bool compressExeFS = false;
|
||||
bool mountRomFS = false;
|
||||
bool encrypted = false;
|
||||
|
||||
static constexpr u64 mediaUnit = 0x200;
|
||||
u64 size = 0; // Size of NCCH converted to bytes
|
||||
u32 stackSize = 0;
|
||||
u32 bssSize = 0;
|
||||
|
||||
// Header: 0x200 byte NCCH header
|
||||
// Header: 0x200 + 0x800 byte NCCH header + exheadr
|
||||
// Returns true on success, false on failure
|
||||
bool loadFromHeader(u8* header);
|
||||
};
|
|
@ -1,3 +1,4 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include "helpers.hpp"
|
||||
#include "io_file.hpp"
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include "helpers.hpp"
|
||||
#include "handles.hpp"
|
||||
#include "loader/ncsd.hpp"
|
||||
|
||||
namespace PhysicalAddrs {
|
||||
enum : u32 {
|
||||
|
@ -121,6 +123,7 @@ public:
|
|||
void* getReadPointer(u32 address);
|
||||
void* getWritePointer(u32 address);
|
||||
std::optional<u32> loadELF(std::ifstream& file);
|
||||
std::optional<NCSD> loadNCSD(const std::filesystem::path& path);
|
||||
|
||||
u8 read8(u32 vaddr);
|
||||
u16 read16(u32 vaddr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue