libretro: load user palette

This commit is contained in:
softtwo 2019-06-23 22:29:34 -05:00 committed by Stephen Anthony
parent ffe63992fc
commit 502b8f3a3e
4 changed files with 29 additions and 18 deletions

View File

@ -17,6 +17,12 @@
#include "FSNodeLIBRETRO.hxx" #include "FSNodeLIBRETRO.hxx"
#ifdef _WIN32
const string slash = "\\";
#else
const string slash = "/";
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO() FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO()
: _name("rom"), : _name("rom"),
@ -24,11 +30,20 @@ FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO()
_isFile(true), _isFile(true),
_isValid(true) _isValid(true)
{ {
_path = "." + slash;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO(const string& p) FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO(const string& p)
: _name(p),
_path(p),
_isDirectory(false),
_isFile(true),
_isValid(true)
{ {
// TODO: use retro_vfs_mkdir_t (file) or RETRO_MEMORY_SAVE_RAM (stream) or libretro save path
if(p == "." + slash + "nvram")
_path = "." + slash;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -52,7 +67,7 @@ bool FilesystemNodeLIBRETRO::isWritable() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FilesystemNodeLIBRETRO::getShortPath() const string FilesystemNodeLIBRETRO::getShortPath() const
{ {
return ""; return ".";
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -18,24 +18,16 @@
#include "FSNode.hxx" #include "FSNode.hxx"
#include "OSystemLIBRETRO.hxx" #include "OSystemLIBRETRO.hxx"
#ifdef _WIN32
const string slash = "\\";
#else
const string slash = "/";
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemLIBRETRO::getBaseDirAndConfig(string& basedir, string& cfgfile, void OSystemLIBRETRO::getBaseDirAndConfig(string& basedir, string& cfgfile,
string& savedir, string& loaddir, string& savedir, string& loaddir,
bool useappdir, const string& usedir) bool useappdir, const string& usedir)
{ {
basedir = "."; loaddir = savedir = cfgfile = basedir = "." + slash;
#if 0
// Check to see if basedir overrides are active
if(useappdir)
cout << "ERROR: base dir in app folder not supported" << endl;
else if(usedir != "")
{
basedir = FilesystemNode(usedir).getPath();
savedir = loaddir = basedir;
}
#endif
FilesystemNode desktop(".");
savedir = ".";
} }

View File

@ -68,6 +68,9 @@ bool StellaLIBRETRO::create(bool logging)
myOSystem = make_unique<OSystemLIBRETRO>(); myOSystem = make_unique<OSystemLIBRETRO>();
myOSystem->create(); myOSystem->create();
Settings::Options options;
myOSystem->loadConfig(options);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Settings& settings = myOSystem->settings(); Settings& settings = myOSystem->settings();
@ -375,7 +378,7 @@ void StellaLIBRETRO::setVideoPalette(uInt32 mode)
{ {
case 0: video_palette = "standard"; break; case 0: video_palette = "standard"; break;
case 1: video_palette = "z26"; break; case 1: video_palette = "z26"; break;
case 2: video_palette = "custom"; break; case 2: video_palette = "user"; break;
} }
if (system_ready) if (system_ready)

View File

@ -279,6 +279,7 @@ static void update_variables(bool init = false)
if(!strcmp(var.value, "standard")) value = 0; if(!strcmp(var.value, "standard")) value = 0;
else if(!strcmp(var.value, "z26")) value = 1; else if(!strcmp(var.value, "z26")) value = 1;
else if(!strcmp(var.value, "user")) value = 2;
if(setting_palette != value) if(setting_palette != value)
{ {
@ -493,7 +494,7 @@ void retro_set_environment(retro_environment_t cb)
static struct retro_variable variables[] = { static struct retro_variable variables[] = {
// Adding more variables and rearranging them is safe. // Adding more variables and rearranging them is safe.
{ "stella_console", "Console display; auto|ntsc|pal|secam|ntsc50|pal60|secam60" }, { "stella_console", "Console display; auto|ntsc|pal|secam|ntsc50|pal60|secam60" },
{ "stella_palette", "Palette colors; standard|z26" }, { "stella_palette", "Palette colors; standard|z26|user" },
{ "stella_filter", "TV effects; disabled|composite|s-video|rgb|badly adjusted" }, { "stella_filter", "TV effects; disabled|composite|s-video|rgb|badly adjusted" },
{ "stella_ntsc_aspect", "NTSC aspect %; par|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99" }, { "stella_ntsc_aspect", "NTSC aspect %; par|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99" },
{ "stella_pal_aspect", "PAL aspect %; par|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99" }, { "stella_pal_aspect", "PAL aspect %; par|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99" },