From 483c5781fc7e853d6ae9f179303cca16af09134f Mon Sep 17 00:00:00 2001 From: byuu <2107894+byuu@users.noreply.github.com> Date: Fri, 20 Mar 2020 16:59:06 +0900 Subject: [PATCH] v110 Final release. --- higan/GNUmakefile | 4 ++-- higan/emulator/emulator.hpp | 2 +- higan/pce/cartridge/cartridge.cpp | 13 ++++++++----- higan/target-byuu/byuu.hpp | 2 +- higan/target-byuu/program/platform.cpp | 4 ++-- higan/target-byuu/settings/paths.cpp | 22 ++++++++++++++++++++++ higan/target-byuu/settings/settings.cpp | 1 + higan/target-byuu/settings/settings.hpp | 6 ++++++ 8 files changed, 43 insertions(+), 11 deletions(-) diff --git a/higan/GNUmakefile b/higan/GNUmakefile index 3adce8636..e6be4d2ac 100755 --- a/higan/GNUmakefile +++ b/higan/GNUmakefile @@ -1,5 +1,5 @@ -#target := higan -target := byuu +target := higan +#target := byuu build := performance openmp := false local := true diff --git a/higan/emulator/emulator.hpp b/higan/emulator/emulator.hpp index cc1abe996..dcc438697 100755 --- a/higan/emulator/emulator.hpp +++ b/higan/emulator/emulator.hpp @@ -47,7 +47,7 @@ namespace higan { namespace higan { static const string Name = "higan"; - static const string Version = "109.4"; + static const string Version = "110"; static const string Copyright = "byuu"; static const string License = "GPLv3"; static const string Website = "https://byuu.org"; diff --git a/higan/pce/cartridge/cartridge.cpp b/higan/pce/cartridge/cartridge.cpp index b4a4684f8..3860137de 100644 --- a/higan/pce/cartridge/cartridge.cpp +++ b/higan/pce/cartridge/cartridge.cpp @@ -21,11 +21,6 @@ auto Cartridge::unload() -> void { port = {}; } -//most PC Engine HuCards lack save RAM on them due to the card size and cost savings. -//the PC Engine CD adds 2KB of backup RAM that some HuCard games can use for saves. -//however, all games must share this small amount of RAM. -//since this is an emulator, we can make this process nicer by storing BRAM per-game. - auto Cartridge::connect(Node::Peripheral with) -> void { node = Node::append(port, with, interface->name()); node->setManifest([&] { return information.manifest; }); @@ -48,6 +43,10 @@ auto Cartridge::connect(Node::Peripheral with) -> void { if(!board) board = new Board::Interface; board->load(document); + if(auto fp = platform->open(node, "save.ram", File::Read)) { + pcd.bram.load(fp); + } + power(); } @@ -61,6 +60,10 @@ auto Cartridge::save() -> void { if(!node) return; auto document = BML::unserialize(information.manifest); board->save(document); + + if(auto fp = platform->open(node, "save.ram", File::Write)) { + pcd.bram.save(fp); + } } auto Cartridge::power() -> void { diff --git a/higan/target-byuu/byuu.hpp b/higan/target-byuu/byuu.hpp index 8a4cd6c75..6b71a3880 100644 --- a/higan/target-byuu/byuu.hpp +++ b/higan/target-byuu/byuu.hpp @@ -17,7 +17,7 @@ namespace ruby { namespace byuu { static const string Name = "byuu"; - static const string Version = "3.4"; + static const string Version = "4"; static const string Copyright = "byuu"; static const string License = "GPLv3"; static const string Website = "https://byuu.org"; diff --git a/higan/target-byuu/program/platform.cpp b/higan/target-byuu/program/platform.cpp index b263e089f..16bcb0a90 100644 --- a/higan/target-byuu/program/platform.cpp +++ b/higan/target-byuu/program/platform.cpp @@ -28,8 +28,8 @@ auto Program::event(higan::Event event) -> void { auto Program::log(string_view message) -> void { if(!traceLogger.fp) { - string datetime = chrono::local::datetime().replace("-", "").replace(":", "").replace(" ", "-"); - string location = {Location::notsuffix(emulator->game.location), "-", datetime, ".log"}; + auto datetime = chrono::local::datetime().replace("-", "").replace(":", "").replace(" ", "-"); + auto location = emulator->locate({emulator->game.location, "-", datetime, ".log"}, ".log", settings.paths.traces); traceLogger.fp.open(location, file::mode::write); } traceLogger.fp.print(message); diff --git a/higan/target-byuu/settings/paths.cpp b/higan/target-byuu/settings/paths.cpp index 0e4bd7ba2..ebb70edb9 100644 --- a/higan/target-byuu/settings/paths.cpp +++ b/higan/target-byuu/settings/paths.cpp @@ -34,6 +34,22 @@ auto PathSettings::construct() -> void { refresh(); }); + tracesLabel.setText("Trace Logs").setFont(Font().setBold()); + tracesPath.setEditable(false); + tracesAssign.setText("Assign ...").onActivate([&] { + BrowserDialog dialog; + dialog.setTitle("Select Traces Path"); + dialog.setPath(Path::desktop()); + if(auto location = program.selectFolder(dialog)) { + settings.paths.traces = location; + refresh(); + } + }); + tracesReset.setText("Reset").onActivate([&] { + settings.paths.traces = ""; + refresh(); + }); + firmwareLabel.setText("DSP Firmware").setFont(Font().setBold()); firmwarePath.setEditable(false); firmwareAssign.setText("Assign ...").onActivate([&] { @@ -66,6 +82,12 @@ auto PathSettings::refresh() -> void { patchesPath.setText("(same as game path)").setForegroundColor({80, 80, 80}); } + if(settings.paths.traces) { + tracesPath.setText(settings.paths.traces).setForegroundColor(); + } else { + tracesPath.setText("(same as game path)").setForegroundColor({80, 80, 80}); + } + if(settings.paths.firmware) { firmwarePath.setText(settings.paths.firmware).setForegroundColor(); } else { diff --git a/higan/target-byuu/settings/settings.cpp b/higan/target-byuu/settings/settings.cpp index 6695f1856..5ea3bc1f3 100644 --- a/higan/target-byuu/settings/settings.cpp +++ b/higan/target-byuu/settings/settings.cpp @@ -92,6 +92,7 @@ auto Settings::process(bool load) -> void { bind(string, "Paths/Saves", paths.saves); bind(string, "Paths/Patches", paths.patches); + bind(string, "Paths/Traces", paths.traces); bind(string, "Paths/Firmware", paths.firmware); for(uint index : range(9)) { diff --git a/higan/target-byuu/settings/settings.hpp b/higan/target-byuu/settings/settings.hpp index 28a02bc6f..2f9087a45 100644 --- a/higan/target-byuu/settings/settings.hpp +++ b/higan/target-byuu/settings/settings.hpp @@ -63,6 +63,7 @@ struct Settings : Markup::Node { struct Paths { string saves; string patches; + string traces; string firmware; } paths; @@ -211,6 +212,11 @@ struct PathSettings : VerticalLayout { LineEdit patchesPath{&patchesLayout, Size{~0, 0}}; Button patchesAssign{&patchesLayout, Size{80, 0}}; Button patchesReset{&patchesLayout, Size{80, 0}}; + Label tracesLabel{this, Size{~0, 0}, 2}; + HorizontalLayout tracesLayout{this, Size{~0, 0}}; + LineEdit tracesPath{&tracesLayout, Size{~0, 0}}; + Button tracesAssign{&tracesLayout, Size{80, 0}}; + Button tracesReset{&tracesLayout, Size{80, 0}}; Label firmwareLabel{this, Size{~0, 0}, 2}; HorizontalLayout firmwareLayout{this, Size{~0, 0}}; LineEdit firmwarePath{&firmwareLayout, Size{~0, 0}};