mirror of https://github.com/bsnes-emu/bsnes.git
Update to v076r02 release.
byuu says: Changelog: - fixed a crashing bug when you toggle a cheat code and then load a save state - added paths.cfg - bsnes now remembers the most recent path per file-type, like bsnes/Qt used to do - re-added -s to Linux linker flags - fixed crash with libsnes/SGB XML parsing
This commit is contained in:
parent
bc5fd8c53c
commit
8d64f9b155
bsnes
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -30,31 +30,38 @@ void FileBrowser::create() {
|
|||
|
||||
void FileBrowser::fileOpen(FileBrowser::Mode requestedMode, function<void (string)> 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, function<void (strin
|
|||
}
|
||||
case Mode::Filter: {
|
||||
setTitle("Load Video Filter");
|
||||
folderPath = "filter";
|
||||
filters.append(".filter");
|
||||
break;
|
||||
}
|
||||
case Mode::Shader: {
|
||||
setTitle("Load Pixel Shader");
|
||||
folderPath = "shader";
|
||||
filters.append(".shader");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setVisible(false);
|
||||
setFolder(config.path.current);
|
||||
setFolder(path.load(folderPath));
|
||||
setVisible(true);
|
||||
contentsBox.setFocused();
|
||||
}
|
||||
|
@ -144,6 +152,6 @@ string FileBrowser::cartridgeFolder(const string &pathname) {
|
|||
|
||||
void FileBrowser::loadFile(const string &filename) {
|
||||
setVisible(false);
|
||||
config.path.current = folder;
|
||||
path.save(folderPath, folder);
|
||||
if(callback) callback(filename);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ private:
|
|||
string folder;
|
||||
lstring filters;
|
||||
lstring contents;
|
||||
string folderPath;
|
||||
|
||||
void folderBrowse();
|
||||
void folderUp();
|
||||
|
|
|
@ -55,7 +55,7 @@ void SingleSlotLoader::loadCartridgeBsxSlotted() {
|
|||
void SingleSlotLoader::loadCartridgeBsx() {
|
||||
mode = Mode::Bsx;
|
||||
setTitle("Load BS-X Cartridge");
|
||||
basePath.setText(config.path.satellaviewBios);
|
||||
basePath.setText(path.satellaviewBios);
|
||||
slotPath.setText("");
|
||||
setVisible();
|
||||
okButton.setFocused();
|
||||
|
@ -64,7 +64,7 @@ void SingleSlotLoader::loadCartridgeBsx() {
|
|||
void SingleSlotLoader::loadCartridgeSuperGameBoy() {
|
||||
mode = Mode::SuperGameBoy;
|
||||
setTitle("Load Super Game Boy cartridge");
|
||||
basePath.setText(config.path.superGameBoyBios);
|
||||
basePath.setText(path.superGameBoyBios);
|
||||
slotPath.setText("");
|
||||
setVisible();
|
||||
okButton.setFocused();
|
||||
|
@ -79,12 +79,12 @@ void SingleSlotLoader::load() {
|
|||
break;
|
||||
}
|
||||
case Mode::Bsx: {
|
||||
config.path.satellaviewBios = basePath.text();
|
||||
path.satellaviewBios = basePath.text();
|
||||
cartridge.loadBsx(basePath.text(), slotPath.text());
|
||||
break;
|
||||
}
|
||||
case Mode::SuperGameBoy: {
|
||||
config.path.superGameBoyBios = basePath.text();
|
||||
path.superGameBoyBios = basePath.text();
|
||||
cartridge.loadSuperGameBoy(basePath.text(), slotPath.text());
|
||||
break;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ void DoubleSlotLoader::create() {
|
|||
|
||||
void DoubleSlotLoader::loadCartridgeSufamiTurbo() {
|
||||
setTitle("Load Sufami Turbo Cartridge");
|
||||
basePath.setText(config.path.sufamiTurboBios);
|
||||
basePath.setText(path.sufamiTurboBios);
|
||||
slotAPath.setText("");
|
||||
slotBPath.setText("");
|
||||
setVisible();
|
||||
|
@ -156,6 +156,6 @@ void DoubleSlotLoader::loadCartridgeSufamiTurbo() {
|
|||
|
||||
void DoubleSlotLoader::load() {
|
||||
setVisible(false);
|
||||
config.path.sufamiTurboBios = basePath.text();
|
||||
path.sufamiTurboBios = basePath.text();
|
||||
cartridge.loadSufamiTurbo(basePath.text(), slotAPath.text(), slotBPath.text());
|
||||
}
|
||||
|
|
|
@ -10,12 +10,14 @@ void Application::main(int argc, char **argv) {
|
|||
config.create();
|
||||
inputMapper.create();
|
||||
|
||||
config.path.base = dir(realpath(argv[0]));
|
||||
config.path.user = userpath();
|
||||
path.base = dir(realpath(argv[0]));
|
||||
path.user = userpath();
|
||||
path.load();
|
||||
path.save();
|
||||
|
||||
config.load();
|
||||
config.save();
|
||||
if(config.path.current == "") config.path.current = config.path.base;
|
||||
|
||||
inputMapper.bind();
|
||||
|
||||
#if defined(PLATFORM_WIN)
|
||||
|
@ -133,6 +135,8 @@ void Application::main(int argc, char **argv) {
|
|||
foreach(window, windows) window->setVisible(false);
|
||||
OS::processEvents();
|
||||
SNES::system.term();
|
||||
|
||||
path.save();
|
||||
config.save();
|
||||
|
||||
video.term();
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue