Add amiibo loading interface
This commit is contained in:
@@ -98,6 +98,7 @@ class Emulator {
|
|||||||
void pause(); // Pause the emulator
|
void pause(); // Pause the emulator
|
||||||
void togglePause();
|
void togglePause();
|
||||||
|
|
||||||
|
bool loadAmiibo(const std::filesystem::path& path);
|
||||||
bool loadROM(const std::filesystem::path& path);
|
bool loadROM(const std::filesystem::path& path);
|
||||||
bool loadNCSD(const std::filesystem::path& path, ROMType type);
|
bool loadNCSD(const std::filesystem::path& path, ROMType type);
|
||||||
bool load3DSX(const std::filesystem::path& path);
|
bool load3DSX(const std::filesystem::path& path);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
#include "kernel_types.hpp"
|
#include "kernel_types.hpp"
|
||||||
#include "logger.hpp"
|
#include "logger.hpp"
|
||||||
@@ -49,8 +51,10 @@ class NFCService {
|
|||||||
void startTagScanning(u32 messagePointer);
|
void startTagScanning(u32 messagePointer);
|
||||||
void stopCommunication(u32 messagePointer);
|
void stopCommunication(u32 messagePointer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NFCService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
NFCService(Memory& mem, Kernel& kernel) : mem(mem), kernel(kernel) {}
|
||||||
void reset();
|
void reset();
|
||||||
void handleSyncRequest(u32 messagePointer);
|
void handleSyncRequest(u32 messagePointer);
|
||||||
|
|
||||||
|
bool loadAmiibo(const std::filesystem::path& path);
|
||||||
};
|
};
|
||||||
@@ -104,4 +104,5 @@ class ServiceManager {
|
|||||||
|
|
||||||
// Input function wrappers
|
// Input function wrappers
|
||||||
HIDService& getHID() { return hid; }
|
HIDService& getHID() { return hid; }
|
||||||
|
NFCService& getNFC() { return nfc; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ void NFCService::handleSyncRequest(u32 messagePointer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NFCService::loadAmiibo(const std::filesystem::path& path) { return true; }
|
||||||
|
|
||||||
void NFCService::initialize(u32 messagePointer) {
|
void NFCService::initialize(u32 messagePointer) {
|
||||||
const u8 type = mem.read8(messagePointer + 4);
|
const u8 type = mem.read8(messagePointer + 4);
|
||||||
log("NFC::Initialize (type = %d)\n", type);
|
log("NFC::Initialize (type = %d)\n", type);
|
||||||
|
|||||||
@@ -353,7 +353,14 @@ void Emulator::run() {
|
|||||||
char* droppedDir = event.drop.file;
|
char* droppedDir = event.drop.file;
|
||||||
|
|
||||||
if (droppedDir) {
|
if (droppedDir) {
|
||||||
loadROM(droppedDir);
|
const std::filesystem::path path(droppedDir);
|
||||||
|
|
||||||
|
if (path.extension() == ".amiibo") {
|
||||||
|
loadAmiibo(path);
|
||||||
|
} else {
|
||||||
|
loadROM(path);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_free(droppedDir);
|
SDL_free(droppedDir);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -478,6 +485,11 @@ bool Emulator::loadROM(const std::filesystem::path& path) {
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Emulator::loadAmiibo(const std::filesystem::path& path) {
|
||||||
|
NFCService& nfc = kernel.getServiceManager().getNFC();
|
||||||
|
return nfc.loadAmiibo(path);
|
||||||
|
}
|
||||||
|
|
||||||
// Used for loading both CXI and NCSD files since they are both so similar and use the same interface
|
// Used for loading both CXI and NCSD files since they are both so similar and use the same interface
|
||||||
// (We promote CXI files to NCSD internally for ease)
|
// (We promote CXI files to NCSD internally for ease)
|
||||||
bool Emulator::loadNCSD(const std::filesystem::path& path, ROMType type) {
|
bool Emulator::loadNCSD(const std::filesystem::path& path, ROMType type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user