mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
Add SD card configs
This commit is contained in:
parent
388790b5fd
commit
48b19b2588
2 changed files with 16 additions and 0 deletions
|
@ -9,6 +9,9 @@ struct EmulatorConfig {
|
||||||
bool discordRpcEnabled = false;
|
bool discordRpcEnabled = false;
|
||||||
RendererType rendererType = RendererType::OpenGL;
|
RendererType rendererType = RendererType::OpenGL;
|
||||||
|
|
||||||
|
bool sdCardInserted = true;
|
||||||
|
bool sdWriteProtected = false;
|
||||||
|
|
||||||
bool chargerPlugged = true;
|
bool chargerPlugged = true;
|
||||||
// Default to 3% battery to make users suffer
|
// Default to 3% battery to make users suffer
|
||||||
int batteryPercentage = 3;
|
int batteryPercentage = 3;
|
||||||
|
|
|
@ -71,6 +71,16 @@ void EmulatorConfig::load(const std::filesystem::path& path) {
|
||||||
batteryPercentage = std::clamp(batteryPercentage, 0, 100);
|
batteryPercentage = std::clamp(batteryPercentage, 0, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.contains("SD")) {
|
||||||
|
auto sdResult = toml::expect<toml::value>(data.at("SD"));
|
||||||
|
if (sdResult.is_ok()) {
|
||||||
|
auto sd = sdResult.unwrap();
|
||||||
|
|
||||||
|
sdCardInserted = toml::find_or<toml::boolean>(sd, "UseVirtualSD", true);
|
||||||
|
sdWriteProtected = toml::find_or<toml::boolean>(sd, "WriteProtectVirtualSD", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatorConfig::save(const std::filesystem::path& path) {
|
void EmulatorConfig::save(const std::filesystem::path& path) {
|
||||||
|
@ -98,6 +108,9 @@ void EmulatorConfig::save(const std::filesystem::path& path) {
|
||||||
data["Battery"]["ChargerPlugged"] = chargerPlugged;
|
data["Battery"]["ChargerPlugged"] = chargerPlugged;
|
||||||
data["Battery"]["BatteryPercentage"] = batteryPercentage;
|
data["Battery"]["BatteryPercentage"] = batteryPercentage;
|
||||||
|
|
||||||
|
data["SD"]["UseVirtualSD"] = sdCardInserted;
|
||||||
|
data["SD"]["WriteProtectVirtualSD"] = sdWriteProtected;
|
||||||
|
|
||||||
std::ofstream file(path, std::ios::out);
|
std::ofstream file(path, std::ios::out);
|
||||||
file << data;
|
file << data;
|
||||||
file.close();
|
file.close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue