diff --git a/bsnes/Makefile b/bsnes/Makefile index 58051cb2..0ae818e5 100755 --- a/bsnes/Makefile +++ b/bsnes/Makefile @@ -25,7 +25,7 @@ flags := $(flags) $(foreach o,$(call strupper,$(options)),-D$o) # platform ifeq ($(platform),x) - link += -ldl -lX11 -lXext + link += -s -ldl -lX11 -lXext else ifeq ($(platform),osx) else ifeq ($(platform),win) link += -mwindows diff --git a/bsnes/snes/snes.hpp b/bsnes/snes/snes.hpp index 12363d59..f109289a 100755 --- a/bsnes/snes/snes.hpp +++ b/bsnes/snes/snes.hpp @@ -1,7 +1,7 @@ namespace SNES { namespace Info { static const char Name[] = "bsnes"; - static const char Version[] = "076.01"; + static const char Version[] = "076.02"; static const unsigned SerializerVersion = 18; } } diff --git a/bsnes/snes/system/system.cpp b/bsnes/snes/system/system.cpp index 6b37600f..03c7e328 100755 --- a/bsnes/snes/system/system.cpp +++ b/bsnes/snes/system/system.cpp @@ -123,6 +123,7 @@ void System::load() { if(cartridge.has_serial()) serial.load(); serialize_init(); + cheat.init(); } void System::unload() { @@ -185,8 +186,6 @@ void System::power() { if(cartridge.has_serial()) cpu.coprocessors.append(&serial); scheduler.init(); - cheat.init(); - input.update(); } @@ -222,8 +221,6 @@ void System::reset() { if(cartridge.has_serial()) cpu.coprocessors.append(&serial); scheduler.init(); - cheat.init(); - input.port_set_device(0, config.controller_port1); input.port_set_device(1, config.controller_port2); input.update(); diff --git a/bsnes/ui-libsnes/libsnes.cpp b/bsnes/ui-libsnes/libsnes.cpp index f2a1ea3f..1c2c3157 100755 --- a/bsnes/ui-libsnes/libsnes.cpp +++ b/bsnes/ui-libsnes/libsnes.cpp @@ -181,7 +181,7 @@ bool snes_load_cartridge_super_game_boy( string xmlrom = (rom_xml && *rom_xml) ? string(rom_xml) : SNESCartridge(rom_data, rom_size).xmlMemoryMap; if(dmg_data) { string xmldmg = (dmg_xml && *dmg_xml) ? string(dmg_xml) : GameBoyCartridge(dmg_data, dmg_size).xml; - GameBoy::cartridge.load(dmg_xml, dmg_data, dmg_size); + GameBoy::cartridge.load(xmldmg, dmg_data, dmg_size); } SNES::cartridge.load(SNES::Cartridge::Mode::SuperGameBoy, { xmlrom, "" }); SNES::system.power(); diff --git a/bsnes/ui/config.cpp b/bsnes/ui/config.cpp index 9909f7e7..a2351815 100755 --- a/bsnes/ui/config.cpp +++ b/bsnes/ui/config.cpp @@ -9,11 +9,6 @@ void Configuration::save() { } void Configuration::create() { - attach(path.current = "", "path.current"); - attach(path.satellaviewBios = "", "path.satellaviewBios"); - attach(path.sufamiTurboBios = "", "path.sufamiTurboBios"); - attach(path.superGameBoyBios = "", "path.superGameBoyBios"); - attach(video.driver = "", "video.driver"); attach(video.synchronize = false, "video.synchronize"); attach(video.smooth = true, "video.smooth"); diff --git a/bsnes/ui/config.hpp b/bsnes/ui/config.hpp index 50f261b2..ac577c33 100755 --- a/bsnes/ui/config.hpp +++ b/bsnes/ui/config.hpp @@ -1,13 +1,4 @@ struct Configuration : public configuration { - struct Path { - string base; - string user; - string current; - string satellaviewBios; - string sufamiTurboBios; - string superGameBoyBios; - } path; - struct Video { string driver; bool synchronize; diff --git a/bsnes/ui/general/file-browser.cpp b/bsnes/ui/general/file-browser.cpp index 5cd995fc..9bd26e59 100755 --- a/bsnes/ui/general/file-browser.cpp +++ b/bsnes/ui/general/file-browser.cpp @@ -30,31 +30,38 @@ void FileBrowser::create() { void FileBrowser::fileOpen(FileBrowser::Mode requestedMode, function requestedCallback) { callback = requestedCallback; - if(mode == requestedMode && folder == config.path.current) { - setVisible(); - contentsBox.setFocused(); - return; - } +//if(mode == requestedMode && folder == config.path.current) { +// setVisible(); +// contentsBox.setFocused(); +// return; +//} + + setVisible(false); filters.reset(); + switch(mode = requestedMode) { case Mode::Cartridge: { setTitle("Load Cartridge"); + folderPath = "sfc"; filters.append(".sfc"); break; } case Mode::Satellaview: { setTitle("Load Satellaview Cartridge"); + folderPath = "bs"; filters.append(".bs"); break; } case Mode::SufamiTurbo: { setTitle("Load Sufami Turbo Cartridge"); + folderPath = "st"; filters.append(".st"); break; } case Mode::GameBoy: { setTitle("Load Game Boy Cartridge"); + folderPath = "gb"; filters.append(".gb"); filters.append(".gbc"); filters.append(".sgb"); @@ -62,18 +69,19 @@ void FileBrowser::fileOpen(FileBrowser::Mode requestedMode, functionsetVisible(false); OS::processEvents(); SNES::system.term(); + + path.save(); config.save(); video.term(); diff --git a/bsnes/ui/path/path.cpp b/bsnes/ui/path/path.cpp index d22caa53..9c8f2f24 100755 --- a/bsnes/ui/path/path.cpp +++ b/bsnes/ui/path/path.cpp @@ -2,10 +2,10 @@ Path path; string Path::home(const string &filename) { - string path = { config.path.base, filename }; + string path = { base, filename }; if(file::exists(path)) return path; - path = config.path.user; + path = user; #if defined(PLATFORM_X) || defined(PLATFORM_OSX) path.append(".config/"); mkdir(path, 0755); @@ -18,3 +18,60 @@ string Path::home(const string &filename) { path.append(filename); return path; } + +string Path::load(const string &path) { + string value; + + if(path == "sfc") value = sfc; + if(path == "bs") value = bs; + if(path == "st") value = st; + if(path == "gb") value = gb; + + if(path == "filter") value = filter; + if(path == "shader") value = shader; + + if(value.beginswith(":")) value.ltrim<1>(":"); + if(value == "") value = base; + return value; +} + +void Path::save(const string &path, const string &value) { + string *output = 0; + + if(path == "sfc") output = &sfc; + if(path == "bs") output = &bs; + if(path == "st") output = &st; + if(path == "gb") output = &gb; + + if(path == "filter") output = &filter; + if(path == "shader") output = &shader; + + if(output) { + string &s = *output; + if(s.beginswith(":") == false && s != "") return; + s = { ":", value }; + return; + } +} + +void Path::load() { + configuration::load(home("paths.cfg")); +} + +void Path::save() { + configuration::save(home("paths.cfg")); +} + +Path::Path() { + attach(sfc = "", "sfc"); + attach(bs = "", "bs"); + attach(st = "", "st"); + attach(gb = "", "gb"); + + attach(filter = "", "filter"); + attach(shader = "", "shader"); + + attach(satellaviewBios = "", "satellaviewBios"); + attach(sufamiTurboBios = "", "sufamiTurboBios"); + attach(superGameBoyBios = "", "superGameBoyBios"); +} diff --git a/bsnes/ui/path/path.hpp b/bsnes/ui/path/path.hpp index 721b3222..cb364cc0 100755 --- a/bsnes/ui/path/path.hpp +++ b/bsnes/ui/path/path.hpp @@ -1,5 +1,27 @@ -struct Path { +struct Path : public configuration { + string user; + string base; + + string sfc; + string bs; + string st; + string gb; + + string filter; + string shader; + + string satellaviewBios; + string sufamiTurboBios; + string superGameBoyBios; + string home(const string &filename); + string load(const string &path); + void save(const string &path, const string &value); + + void load(); + void save(); + + Path(); }; extern Path path;