mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
FS: Stub card SPI and some other things
This commit is contained in:
parent
055dbc7fb6
commit
cc669d7cab
12 changed files with 139 additions and 21 deletions
|
@ -35,6 +35,7 @@ namespace ArchiveID {
|
|||
SDMC = 9,
|
||||
SDMCWriteOnly = 0xA,
|
||||
|
||||
CardSPI = 0x12345679,
|
||||
SavedataAndNcch = 0x2345678A,
|
||||
// 3DBrew: This is the same as the regular SaveData archive, except with this the savedata ID and mediatype is loaded from the input archive
|
||||
// lowpath.
|
||||
|
|
30
include/fs/archive_card_spi.hpp
Normal file
30
include/fs/archive_card_spi.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
#include "archive_base.hpp"
|
||||
#include "result/result.hpp"
|
||||
|
||||
using Result::HorizonResult;
|
||||
|
||||
class CardSPIArchive : public ArchiveBase {
|
||||
public:
|
||||
CardSPIArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||
std::string name() override { return "Card SPI"; }
|
||||
|
||||
u64 getFreeBytes() override {
|
||||
Helpers::warn("Unimplemented GetFreeBytes for Card SPI archive");
|
||||
return 0_MB;
|
||||
}
|
||||
|
||||
HorizonResult createDirectory(const FSPath& path) override;
|
||||
HorizonResult createFile(const FSPath& path, u64 size) override;
|
||||
HorizonResult deleteFile(const FSPath& path) override;
|
||||
|
||||
Rust::Result<ArchiveBase*, HorizonResult> openArchive(const FSPath& path) override;
|
||||
Rust::Result<DirectorySession, HorizonResult> openDirectory(const FSPath& path) override;
|
||||
|
||||
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override;
|
||||
|
||||
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override {
|
||||
Helpers::panic("Unimplemented ReadFile for Card SPI archive");
|
||||
return {};
|
||||
};
|
||||
};
|
|
@ -44,9 +44,12 @@ class DSPService {
|
|||
size_t totalEventCount;
|
||||
std::vector<u8> loadedComponent;
|
||||
|
||||
bool headphonesInserted = true;
|
||||
|
||||
// Service functions
|
||||
void convertProcessAddressFromDspDram(u32 messagePointer); // Nice function name
|
||||
void flushDataCache(u32 messagePointer);
|
||||
void forceHeadphoneOut(u32 messagePointer);
|
||||
void getHeadphoneStatus(u32 messagePointer);
|
||||
void getSemaphoreEventHandle(u32 messagePointer);
|
||||
void invalidateDCache(u32 messagePointer);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "config.hpp"
|
||||
#include "fs/archive_card_spi.hpp"
|
||||
#include "fs/archive_ext_save_data.hpp"
|
||||
#include "fs/archive_ncch.hpp"
|
||||
#include "fs/archive_save_data.hpp"
|
||||
|
@ -43,6 +44,7 @@ class FSService {
|
|||
|
||||
TWLPhotoArchive twlPhoto;
|
||||
TWLSoundArchive twlSound;
|
||||
CardSPIArchive cardSpi;
|
||||
|
||||
ArchiveBase* getArchiveFromID(u32 id, const FSPath& archivePath);
|
||||
Rust::Result<Handle, HorizonResult> openArchiveHandle(u32 archiveID, const FSPath& path);
|
||||
|
@ -92,7 +94,8 @@ class FSService {
|
|||
FSService(Memory& mem, Kernel& kernel, const EmulatorConfig& config)
|
||||
: mem(mem), saveData(mem), sharedExtSaveData_nand(mem, "../SharedFiles/NAND", true), extSaveData_sdmc(mem, "SDMC"), sdmc(mem),
|
||||
sdmcWriteOnly(mem, true), selfNcch(mem), ncch(mem), userSaveData1(mem, ArchiveID::UserSaveData1),
|
||||
userSaveData2(mem, ArchiveID::UserSaveData2), systemSaveData(mem), twlPhoto(mem), twlSound(mem), kernel(kernel), config(config) {}
|
||||
userSaveData2(mem, ArchiveID::UserSaveData2), systemSaveData(mem), twlPhoto(mem), twlSound(mem), cardSpi(mem), kernel(kernel),
|
||||
config(config) {}
|
||||
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <cstring>
|
||||
#include <optional>
|
||||
|
||||
#include "PICA/gpu.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "kernel_types.hpp"
|
||||
|
@ -9,12 +10,12 @@
|
|||
#include "result/result.hpp"
|
||||
|
||||
enum class GPUInterrupt : u8 {
|
||||
PSC0 = 0, // Memory fill completed
|
||||
PSC1 = 1, // ?
|
||||
VBlank0 = 2, // ?
|
||||
VBlank1 = 3, // ?
|
||||
PPF = 4, // Display transfer finished
|
||||
P3D = 5, // Command list processing finished
|
||||
PSC0 = 0, // Memory fill completed
|
||||
PSC1 = 1, // ?
|
||||
VBlank0 = 2, // ?
|
||||
VBlank1 = 3, // ?
|
||||
PPF = 4, // Display transfer finished
|
||||
P3D = 5, // Command list processing finished
|
||||
DMA = 6
|
||||
};
|
||||
|
||||
|
@ -28,8 +29,8 @@ class GPUService {
|
|||
Memory& mem;
|
||||
GPU& gpu;
|
||||
Kernel& kernel;
|
||||
u32& currentPID; // Process ID of the current process
|
||||
u8* sharedMem; // Pointer to GSP shared memory
|
||||
u32& currentPID; // Process ID of the current process
|
||||
u8* sharedMem; // Pointer to GSP shared memory
|
||||
|
||||
// At any point in time only 1 process has privileges to use rendering functions
|
||||
// This is the PID of that process
|
||||
|
@ -64,8 +65,8 @@ class GPUService {
|
|||
|
||||
// Used for saving and restoring GPU state via ImportDisplayCaptureInfo
|
||||
struct CaptureInfo {
|
||||
u32 leftFramebuffer; // Left framebuffer VA
|
||||
u32 rightFramebuffer; // Right framebuffer VA (Top screen only)
|
||||
u32 leftFramebuffer; // Left framebuffer VA
|
||||
u32 rightFramebuffer; // Right framebuffer VA (Top screen only)
|
||||
u32 format;
|
||||
u32 stride;
|
||||
};
|
||||
|
@ -74,6 +75,7 @@ class GPUService {
|
|||
// Service commands
|
||||
void acquireRight(u32 messagePointer);
|
||||
void flushDataCache(u32 messagePointer);
|
||||
void invalidateDataCache(u32 messagePointer);
|
||||
void importDisplayCaptureInfo(u32 messagePointer);
|
||||
void readHwRegs(u32 messagePointer);
|
||||
void registerInterruptRelayQueue(u32 messagePointer);
|
||||
|
@ -108,15 +110,14 @@ class GPUService {
|
|||
FramebufferUpdate* getTopFramebufferInfo() { return getFramebufferInfo(0); }
|
||||
FramebufferUpdate* getBottomFramebufferInfo() { return getFramebufferInfo(1); }
|
||||
|
||||
public:
|
||||
GPUService(Memory& mem, GPU& gpu, Kernel& kernel, u32& currentPID) : mem(mem), gpu(gpu),
|
||||
kernel(kernel), currentPID(currentPID) {}
|
||||
public:
|
||||
GPUService(Memory& mem, GPU& gpu, Kernel& kernel, u32& currentPID) : mem(mem), gpu(gpu), kernel(kernel), currentPID(currentPID) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
void requestInterrupt(GPUInterrupt type);
|
||||
void setSharedMem(u8* ptr) {
|
||||
sharedMem = ptr;
|
||||
if (ptr != nullptr) { // Zero-fill shared memory in case the process tries to read stale service data or vice versa
|
||||
if (ptr != nullptr) { // Zero-fill shared memory in case the process tries to read stale service data or vice versa
|
||||
std::memset(ptr, 0, 0x1000);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace MCU {
|
|||
|
||||
// Service commands
|
||||
void getBatteryLevel(u32 messagePointer);
|
||||
void setInfoLEDPattern(u32 messagePointer);
|
||||
|
||||
public:
|
||||
HWCService(Memory& mem, const EmulatorConfig& config) : mem(mem), config(config) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue