mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 04:29:13 +12:00
Add string-based renderer backend configuration
Rather than using integer-indices, just use plaintext case-insensitive names and leave the actual enum indexes as an implementation detail.
This commit is contained in:
parent
2c57936c50
commit
528ed510c2
4 changed files with 38 additions and 3 deletions
|
@ -33,7 +33,19 @@ void EmulatorConfig::load(const std::filesystem::path& path) {
|
|||
if (gpuResult.is_ok()) {
|
||||
auto gpu = gpuResult.unwrap();
|
||||
|
||||
rendererType = RendererType(toml::find_or<toml::integer>(gpu, "Renderer", int64_t(rendererType)));
|
||||
// Get renderer
|
||||
auto rendererResult = toml::expect<std::string>(gpu, "Renderer");
|
||||
if (rendererResult.is_ok()) {
|
||||
auto rendererName = rendererResult.unwrap();
|
||||
if (auto configRendererType = fromString(rendererName); configRendererType.has_value()) {
|
||||
rendererType = configRendererType.value();
|
||||
} else {
|
||||
Helpers::warn("Invalid renderer specified: %s\n", rendererName.c_str());
|
||||
}
|
||||
} else {
|
||||
Helpers::warn("Renderer not specified: %s\n", rendererResult.unwrap_err());
|
||||
}
|
||||
|
||||
shaderJitEnabled = toml::find_or<toml::boolean>(gpu, "EnableShaderJIT", false);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +69,7 @@ void EmulatorConfig::save(const std::filesystem::path& path) {
|
|||
printf("Saving new configuration file %s\n", path.string().c_str());
|
||||
}
|
||||
|
||||
data["GPU"]["Renderer"] = static_cast<s8>(rendererType);
|
||||
data["GPU"]["Renderer"] = toString(rendererType);
|
||||
data["GPU"]["EnableShaderJIT"] = shaderJitEnabled;
|
||||
|
||||
std::ofstream file(path, std::ios::out);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue